diff --git a/include/piano_roll.h b/include/piano_roll.h index 5cc2e9382..f12f0636f 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -152,7 +152,7 @@ private: ModeDraw, ModeErase, ModeSelect, - ModeOpen, + ModeEditDetuning, }; enum Actions @@ -313,8 +313,7 @@ private: void drawDetuningInfo( QPainter & _p, note * _n, int _x, int _y ); bool mouseOverNote( void ); note * noteUnderMouse( void ); - NoteVector::const_iterator noteIteratorUnderMouse( void ); - + // turn a selection rectangle into selected notes void computeSelectedNotes( bool shift ); void clearSelectedNotes( void ); diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 9424410a9..f6786fb03 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -1303,7 +1303,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) return; } - if( m_editMode == ModeOpen && noteUnderMouse() ) + if( m_editMode == ModeEditDetuning && noteUnderMouse() ) { noteUnderMouse()->editDetuningPattern(); return; @@ -2887,7 +2887,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe ) break; case ModeErase: cursor = s_toolErase; break; case ModeSelect: cursor = s_toolSelect; break; - case ModeOpen: cursor = s_toolOpen; break; + case ModeEditDetuning: cursor = s_toolOpen; break; } if( cursor != NULL ) { @@ -3216,7 +3216,7 @@ void pianoRoll::selectButtonToggled( void ) void pianoRoll::detuneButtonToggled( void ) { - m_editMode = ModeOpen; + m_editMode = ModeEditDetuning; update(); } @@ -3580,22 +3580,13 @@ midiTime pianoRoll::newNoteLen( void ) const bool pianoRoll::mouseOverNote( void ) { - return validPattern() && - noteIteratorUnderMouse() != m_pattern->notes().end(); + return validPattern() && noteUnderMouse() != NULL; } note * pianoRoll::noteUnderMouse( void ) -{ - return *noteIteratorUnderMouse(); -} - - - - -NoteVector::ConstIterator pianoRoll::noteIteratorUnderMouse( void ) { QPoint pos = mapFromGlobal( QCursor::pos() ); @@ -3606,7 +3597,7 @@ NoteVector::ConstIterator pianoRoll::noteIteratorUnderMouse( void ) || pos.y() < TopMargin || pos.y() > keyAreaBottom() ) { - return notes.end(); + return NULL; } int key_num = getKey( pos.y() ); @@ -3630,11 +3621,12 @@ NoteVector::ConstIterator pianoRoll::noteIteratorUnderMouse( void ) ++it; } - return it; + return *it; } + #include "moc_piano_roll.cxx"