Merge pull request #1677 from curlymorphic/1416
Proposed fix 1416 Drag-and-drop of automatables to Automation Editor
This commit is contained in:
@@ -262,6 +262,9 @@ public:
|
||||
void setCurrentPattern(AutomationPattern* pattern);
|
||||
const AutomationPattern* currentPattern();
|
||||
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
|
||||
void open(AutomationPattern* pattern);
|
||||
|
||||
AutomationEditor* m_editor;
|
||||
|
||||
@@ -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,8 @@ AutomationEditorWindow::AutomationEditorWindow() :
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
setFocus();
|
||||
setWindowIcon( embed::getIconPixmap( "automation" ) );
|
||||
setAcceptDrops( true );
|
||||
m_toolBar->setAcceptDrops( true );
|
||||
}
|
||||
|
||||
|
||||
@@ -2282,6 +2286,30 @@ 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 )
|
||||
{
|
||||
m_editor->m_pattern->addObject( mod );
|
||||
setCurrentPattern( m_editor->m_pattern );
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void AutomationEditorWindow::dragEnterEvent( QDragEnterEvent *_dee )
|
||||
{
|
||||
StringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
|
||||
}
|
||||
|
||||
void AutomationEditorWindow::open(AutomationPattern* pattern)
|
||||
{
|
||||
setCurrentPattern(pattern);
|
||||
|
||||
Reference in New Issue
Block a user