added knob linking-support

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@331 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-08-15 16:28:25 +00:00
parent 8ccfa5d9ac
commit 73fe9713c2
2 changed files with 30 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
2006-08-15 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/widgets/knob.cpp:
support for linking knobs using <Shift> + drag'n'drop (note that
connetions are not saved!)
2006-08-15 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
* src/widgets/rack_plugin.cpp:
added deletion of the control view to the dtor to make it clean

View File

@@ -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();