From 3392c83481d991362bdeaa9491c0a8a77f120427 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 16 Dec 2008 02:09:28 +0000 Subject: [PATCH] added a note detuning tool and fixed mouse cursor glitch when mousing over notes git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1935 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 2 + TODO | 1 - include/piano_roll.h | 2 +- src/gui/piano_roll.cpp | 90 ++++++++++++++++++++---------------------- 4 files changed, 46 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8bebfde2d..a6f892883 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ - if you pressed both controls at the same time, the piano roll would get stuck in selection mode (FIXED) - shift drag on an unselected note didn't work (FIXED) + - added a note detuning tool + - fixed mouse cursor glitch when mousing over notes 2008-12-14 Andrew Kelley diff --git a/TODO b/TODO index ff6285963..6f00bc78f 100644 --- a/TODO +++ b/TODO @@ -52,7 +52,6 @@ - add FLAC as export-format? Andrew Kelley's todo: -- when you resize a note, it should deselect single notes too - when looking at a piano roll, if the song is playing that pattern, move the position ticker to where it should be - multiview button - show notes from every instrument in the current beat+bassline with different colors - undo/redo for piano roll diff --git a/include/piano_roll.h b/include/piano_roll.h index d7d950416..a4fd75bc0 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -118,6 +118,7 @@ protected slots: void drawButtonToggled( void ); void eraseButtonToggled( void ); void selectButtonToggled( void ); + void detuneButtonToggled( void ); void copySelectedNotes( void ); void cutSelectedNotes( void ); @@ -139,7 +140,6 @@ private: ModeDraw, ModeErase, ModeSelect, - ModeMove, ModeOpen }; diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 44921cdbc..be566bcec 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -322,30 +322,42 @@ pianoRoll::pianoRoll( void ) : this, SLOT( selectButtonToggled() ), m_toolBar ); m_selectButton->setCheckable( true ); - + + m_detuneButton = new toolButton( embed::getIconPixmap( "automation"), + tr( "Detune mode (Shift+T)" ), + this, SLOT( detuneButtonToggled() ), + m_toolBar ); + m_detuneButton->setCheckable( true ); QButtonGroup * tool_button_group = new QButtonGroup( this ); tool_button_group->addButton( m_drawButton ); tool_button_group->addButton( m_eraseButton ); tool_button_group->addButton( m_selectButton ); + tool_button_group->addButton( m_detuneButton ); tool_button_group->setExclusive( true ); m_drawButton->setWhatsThis( tr( "Click here and draw mode will be activated. In this " - "mode you can add, resize and move single notes. This " + "mode you can add, resize and move notes. This " "is the default mode which is used most of the time. " "You can also press 'Shift+D' on your keyboard to " - "activate this mode." ) ); + "activate this mode. In this mode, hold Ctrl to " + "temporarily go into select mode." ) ); m_eraseButton->setWhatsThis( tr( "Click here and erase mode will be activated. In this " - "mode you can erase single notes. You can also press " + "mode you can erase notes. You can also press " "'Shift+E' on your keyboard to activate this mode." ) ); m_selectButton->setWhatsThis( tr( "Click here and select mode will be activated. " - "In this mode you can select notes. This is neccessary " - "if you want to cut, copy, paste, delete or move " - "notes. You can also press 'Shift+S' on your keyboard " - "to activate this mode." ) ); + "In this mode you can select notes. Alternatively, " + "you can hold Ctrl in draw mode to temporarily use " + "select mode." ) ); + m_detuneButton->setWhatsThis( + tr( "Click here and detune mode will be activated. " + "In this mode you can click a note to open its " + "automation detuning. You can utilize this to slide " + "notes from one to another. You can also press " + "'Shift+T' on your keyboard to activate this mode." ) ); m_cutButton = new toolButton( embed::getIconPixmap( "edit_cut" ), tr( "Cut selected notes (Ctrl+X)" ), @@ -453,6 +465,7 @@ pianoRoll::pianoRoll( void ) : tb_layout->addWidget( m_drawButton ); tb_layout->addWidget( m_eraseButton ); tb_layout->addWidget( m_selectButton ); + tb_layout->addWidget( m_detuneButton ); tb_layout->addSpacing( 10 ); tb_layout->addWidget( m_cutButton ); tb_layout->addWidget( m_copyButton ); @@ -1078,7 +1091,18 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) _ke->ignore(); } break; - + + case Qt::Key_T: + if( _ke->modifiers() & Qt::ShiftModifier ) + { + m_detuneButton->setChecked( true ); + } + else + { + _ke->ignore(); + } + break; + case Qt::Key_Delete: deleteSelectedNotes(); break; @@ -1135,16 +1159,6 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) update(); } break; - case Qt::Key_Shift: - /* TODO: implement note detuning some other way. - if( mouseOverNote() ) - { - m_editMode = ModeOpen; - QApplication::changeOverrideCursor( - QCursor( Qt::ArrowCursor ) ); - update(); - } */ - break; default: _ke->ignore(); break; @@ -1176,13 +1190,6 @@ void pianoRoll::keyReleaseEvent( QKeyEvent * _ke ) m_editMode = m_ctrlMode; update(); break; - case Qt::Key_Shift: - if( m_editMode == ModeOpen ) - { - m_editMode = ModeDraw; - update(); - } - break; } _ke->ignore(); } @@ -1870,11 +1877,6 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) QCursor( Qt::SizeVerCursor ) ); return; } - else - { - QApplication::setOverrideCursor( - QCursor( Qt::ArrowCursor ) ); - } } else if( m_action == ActionResizeNoteEditArea ) { @@ -2062,14 +2064,8 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) // no note?? if( it != notes.end() ) { - if( _me->modifiers() & Qt::ControlModifier ) - { - m_editMode = ModeOpen; - QApplication::changeOverrideCursor( - QCursor( Qt::ArrowCursor ) ); - } // cursor at the "tail" of the note? - else if( ( *it )->length() > 0 && + if( ( *it )->length() > 0 && pos_ticks*m_ppt / midiTime::ticksPerTact() > ( ( *it )->pos() + @@ -2153,11 +2149,6 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) --m_selectedKeys; } } - else if( m_editMode == ModeOpen && !( mouseOverNote() - && _me->modifiers() & Qt::ShiftModifier ) ) - { - m_editMode = ModeDraw; - } else if( m_editMode == ModeDraw && _me->buttons() & Qt::RightButton ) { // holding down right-click to delete notes @@ -2851,7 +2842,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe ) break; case ModeErase: cursor = s_toolErase; break; case ModeSelect: cursor = s_toolSelect; break; - case ModeMove: cursor = s_toolMove; break; + //case ModeMove: cursor = s_toolMove; break; case ModeOpen: cursor = s_toolOpen; break; } p.drawPixmap( mapFromGlobal( QCursor::pos() ) + QPoint( 8, 8 ), @@ -3094,7 +3085,6 @@ void pianoRoll::verScrolled( int _new_pos ) void pianoRoll::drawButtonToggled( void ) { m_editMode = ModeDraw; - removeSelection(); update(); } @@ -3104,7 +3094,6 @@ void pianoRoll::drawButtonToggled( void ) void pianoRoll::eraseButtonToggled( void ) { m_editMode = ModeErase; - removeSelection(); update(); } @@ -3114,7 +3103,14 @@ void pianoRoll::eraseButtonToggled( void ) void pianoRoll::selectButtonToggled( void ) { m_editMode = ModeSelect; - removeSelection(); + update(); +} + + + +void pianoRoll::detuneButtonToggled( void ) +{ + m_editMode = ModeOpen; update(); }