From 73fe9713c20096054d1c20a6b01157dae6a3fdc9 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 15 Aug 2006 16:28:25 +0000 Subject: [PATCH] added knob linking-support git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@331 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 6 ++++++ src/widgets/knob.cpp | 29 ++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05147b3f9..862457100 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-15 Tobias Doerffel + + * src/widgets/knob.cpp: + support for linking knobs using + drag'n'drop (note that + connetions are not saved!) + 2006-08-15 Danny McRae * src/widgets/rack_plugin.cpp: added deletion of the control view to the dtor to make it clean diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index e29e720a8..4fb7b4732 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -396,7 +396,8 @@ void knob::contextMenuEvent( QContextMenuEvent * ) void knob::dragEnterEvent( QDragEnterEvent * _dee ) { - stringPairDrag::processDragEnterEvent( _dee, "float_value" ); + stringPairDrag::processDragEnterEvent( _dee, "float_value," + "link_object" ); } @@ -405,12 +406,20 @@ void knob::dragEnterEvent( QDragEnterEvent * _dee ) void knob::dropEvent( QDropEvent * _de ) { QString type = stringPairDrag::decodeKey( _de ); - QString value = stringPairDrag::decodeValue( _de ); + QString val = stringPairDrag::decodeValue( _de ); if( type == "float_value" ) { - setValue( value.toFloat() ); + printf("set val\n"); + setValue( val.toFloat() ); _de->accept(); } + else if( type == "link_object" ) + { + printf("link!\n"); + knob * obj = (knob *)( val.toULong() ); + linkObjects( this, obj ); + obj->setValue( value() ); + } } @@ -420,7 +429,8 @@ void knob::dropEvent( QDropEvent * _de ) void knob::mousePressEvent( QMouseEvent * _me ) { if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == FALSE ) + eng()->getMainWindow()->isCtrlPressed() == FALSE && + eng()->getMainWindow()->isShiftPressed() == FALSE ) { setJournalling( FALSE ); m_oldValue = value(); @@ -450,11 +460,20 @@ void knob::mousePressEvent( QMouseEvent * _me ) m_buttonPressed = TRUE; } else if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == TRUE ) + eng()->getMainWindow()->isCtrlPressed() == TRUE/* && + eng()->getMainWindow()->isShiftPressed() == FALSE*/ ) { new stringPairDrag( "float_value", QString::number( value() ), QPixmap(), this, eng() ); } + else if( _me->button() == Qt::LeftButton && +/* eng()->getMainWindow()->isCtrlPressed() == TRUE &&*/ + eng()->getMainWindow()->isShiftPressed() == TRUE ) + { + new stringPairDrag( "link_object", + QString::number( (uint) this ), + QPixmap(), this, eng() ); + } else if( _me->button() == Qt::MidButton ) { reset();