Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solves issue #2028 (Slow MIDI import due to repeated message) #2033

Merged
merged 3 commits into from
May 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/AutomationPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class EXPORT AutomationPattern : public TrackContentObject
AutomationPattern( const AutomationPattern & _pat_to_copy );
virtual ~AutomationPattern();

void addObject( AutomatableModel * _obj, bool _search_dup = true );
bool addObject( AutomatableModel * _obj, bool _search_dup = true );

const AutomatableModel * firstObject() const;

Expand Down
10 changes: 4 additions & 6 deletions src/core/AutomationPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "ProjectJournal.h"
#include "BBTrackContainer.h"
#include "Song.h"
#include "TextFloat.h"
#include "embed.h"

int AutomationPattern::s_quantization = 1;
Expand Down Expand Up @@ -107,18 +106,16 @@ AutomationPattern::~AutomationPattern()



void AutomationPattern::addObject( AutomatableModel * _obj, bool _search_dup )
bool AutomationPattern::addObject( AutomatableModel * _obj, bool _search_dup )
{
if( _search_dup )
{
for( objectVector::iterator it = m_objects.begin();
it != m_objects.end(); ++it )
{
if( *it == _obj )
{
TextFloat::displayMessage( _obj->displayName(), tr( "Model is already connected "
"to this pattern." ), embed::getIconPixmap( "automation" ), 2000 );
return;
{
return false;
}
}
}
Expand All @@ -138,6 +135,7 @@ void AutomationPattern::addObject( AutomatableModel * _obj, bool _search_dup )

emit dataChanged();

return true;
}


Expand Down
11 changes: 10 additions & 1 deletion src/gui/AutomationPatternView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "ProjectJournal.h"
#include "RenameDialog.h"
#include "StringPairDrag.h"
#include "TextFloat.h"
#include "ToolTip.h"


Expand Down Expand Up @@ -420,7 +421,15 @@ void AutomationPatternView::dropEvent( QDropEvent * _de )
journallingObject( val.toInt() ) );
if( mod != NULL )
{
m_pat->addObject( mod );
bool added = m_pat->addObject( mod );
if ( !added )
{
TextFloat::displayMessage( mod->displayName(),
tr( "Model is already connected "
"to this pattern." ),
embed::getIconPixmap( "automation" ),
2000 );
}
}
update();

Expand Down
10 changes: 9 additions & 1 deletion src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,15 @@ void AutomationEditorWindow::dropEvent( QDropEvent *_de )
journallingObject( val.toInt() ) );
if( mod != NULL )
{
m_editor->m_pattern->addObject( mod );
bool added = m_editor->m_pattern->addObject( mod );
if ( !added )
{
TextFloat::displayMessage( mod->displayName(),
tr( "Model is already connected "
"to this pattern." ),
embed::getIconPixmap( "automation" ),
2000 );
}
setCurrentPattern( m_editor->m_pattern );
}
}
Expand Down