-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Proposed fix 1416 Drag-and-drop of automatables to Automation Editor #1677
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ | |
#include "PianoRoll.h" | ||
#include "debug.h" | ||
#include "MeterModel.h" | ||
#include "StringPairDrag.h" | ||
#include "ProjectJournal.h" | ||
|
||
|
||
QPixmap * AutomationEditor::s_toolDraw = NULL; | ||
|
@@ -2220,6 +2222,7 @@ AutomationEditorWindow::AutomationEditorWindow() : | |
setFocusPolicy( Qt::StrongFocus ); | ||
setFocus(); | ||
setWindowIcon( embed::getIconPixmap( "automation" ) ); | ||
setAcceptDrops( true ); | ||
} | ||
|
||
|
||
|
@@ -2282,6 +2285,35 @@ const AutomationPattern* AutomationEditorWindow::currentPattern() | |
return m_editor->currentPattern(); | ||
} | ||
|
||
void AutomationEditorWindow::dropEvent(QDropEvent *_de) | ||
{ | ||
QString type = StringPairDrag::decodeKey( _de ); | ||
QString val = StringPairDrag::decodeValue( _de ); | ||
if( type == "automatable_model" ) | ||
{ | ||
AutomatableModel * mod = dynamic_cast<AutomatableModel *>( | ||
Engine::projectJournal()-> | ||
journallingObject( val.toInt() ) ); | ||
if( mod != NULL ) | ||
{ | ||
if( m_editor->m_pattern->firstObject() ) | ||
{ | ||
m_editor->m_pattern->objectDestroyed( m_editor->m_pattern->firstObject()->id() ); | ||
} | ||
m_editor->m_pattern->clear(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @diizy do we normally clear the pattern when we drag in a new item? Currently we can link one automation event to multiple similar controls, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Now i understand what the code is doing, changing this now |
||
m_editor->m_pattern->addObject( mod ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
setCurrentPattern( m_editor->m_pattern ); | ||
} | ||
} | ||
|
||
update(); | ||
} | ||
|
||
void AutomationEditorWindow::dragEnterEvent(QDragEnterEvent *_dee) | ||
{ | ||
StringPairDrag::processDragEnterEvent( _dee, "automatable_model" ); | ||
} | ||
|
||
void AutomationEditorWindow::open(AutomationPattern* pattern) | ||
{ | ||
setCurrentPattern(pattern); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking here... it appears we generally link the toolbar as well per
BBEditor.cpp#L56