Right Mouse Button To Erase Nodes In Automation Editor Cursor Icon... (#3414)

* Right Mouse Button To Erase Nodes In Automation Editor Cursor Icon Does Not Change #3310

* Remove unused member m_mouseDownLeft from PianoRoll

* Add move cursor for automation points drag
This commit is contained in:
Uroš Šišović
2017-03-13 01:14:42 +01:00
committed by Umcaruje
parent 899e386df7
commit e879fad25d
4 changed files with 40 additions and 4 deletions

View File

@@ -239,6 +239,7 @@ private:
EditModes m_editMode;
bool m_mouseDownRight; //true if right click is being held down
TimeLineWidget * m_timeLine;
bool m_scrollBack;

View File

@@ -358,7 +358,6 @@ private:
EditModes m_editMode;
EditModes m_ctrlMode; // mode they were in before they hit ctrl
bool m_mouseDownLeft; //true if left click is being held down
bool m_mouseDownRight; //true if right click is being held down
TimeLineWidget * m_timeLine;

View File

@@ -103,6 +103,7 @@ AutomationEditor::AutomationEditor() :
m_y_delta( DEFAULT_Y_DELTA ),
m_y_auto( true ),
m_editMode( DRAW ),
m_mouseDownRight( false ),
m_scrollBack( false ),
m_barLineColor( 0, 0, 0 ),
m_beatLineColor( 0, 0, 0 ),
@@ -539,6 +540,11 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
++it;
}
if( mouseEvent->button() == Qt::RightButton )
{
m_mouseDownRight = true;
}
// left button??
if( mouseEvent->button() == Qt::LeftButton &&
m_editMode == DRAW )
@@ -649,6 +655,19 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
void AutomationEditor::mouseReleaseEvent(QMouseEvent * mouseEvent )
{
bool mustRepaint = false;
if ( mouseEvent->button() == Qt::RightButton )
{
m_mouseDownRight = false;
mustRepaint = true;
}
if( mouseEvent->button() == Qt::LeftButton )
{
mustRepaint = true;
}
if( m_editMode == DRAW )
{
if( m_action == MOVE_VALUE )
@@ -659,6 +678,11 @@ void AutomationEditor::mouseReleaseEvent(QMouseEvent * mouseEvent )
}
m_action = NONE;
if( mustRepaint )
{
repaint();
}
}
@@ -1433,7 +1457,21 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
// draw current edit-mode-icon below the cursor
switch( m_editMode )
{
case DRAW: cursor = s_toolDraw; break;
case DRAW:
if( m_mouseDownRight )
{
cursor = s_toolErase;
}
else if( m_action == MOVE_VALUE )
{
cursor = s_toolMove;
}
else
{
cursor = s_toolDraw;
}
break;
case ERASE: cursor = s_toolErase; break;
case SELECT: cursor = s_toolSelect; break;
case MOVE: cursor = s_toolMove; break;

View File

@@ -186,7 +186,6 @@ PianoRoll::PianoRoll() :
m_startKey( INITIAL_START_KEY ),
m_lastKey( 0 ),
m_editMode( ModeDraw ),
m_mouseDownLeft( false ),
m_mouseDownRight( false ),
m_scrollBack( false ),
m_barLineColor( 0, 0, 0 ),
@@ -1922,7 +1921,6 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * me )
if( me->button() & Qt::LeftButton )
{
m_mouseDownLeft = false;
mustRepaint = true;
if( m_action == ActionSelectNotes && m_editMode == ModeSelect )