- changed some accelerators
- redirect keyboard events to the piano widget - fixed segfault when pressing Ctrl with no pattern git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@259 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
#include "tool_button.h"
|
||||
#include "text_float.h"
|
||||
#include "combobox.h"
|
||||
#include "piano_widget.h"
|
||||
|
||||
|
||||
extern tones whiteKeys[]; // defined in piano_widget.cpp
|
||||
@@ -284,27 +285,27 @@ pianoRoll::pianoRoll( engine * _engine ) :
|
||||
|
||||
// init edit-buttons at the top
|
||||
m_drawButton = new toolButton( embed::getIconPixmap( "edit_draw" ),
|
||||
tr( "Draw mode (D)" ),
|
||||
tr( "Draw mode (Shift+D)" ),
|
||||
this, SLOT( drawButtonToggled() ),
|
||||
m_toolBar );
|
||||
m_drawButton->setCheckable( TRUE );
|
||||
m_drawButton->setChecked( TRUE );
|
||||
|
||||
m_eraseButton = new toolButton( embed::getIconPixmap( "edit_erase" ),
|
||||
tr( "Erase mode (E)" ),
|
||||
tr( "Erase mode (Shift+E)" ),
|
||||
this, SLOT( eraseButtonToggled() ),
|
||||
m_toolBar );
|
||||
m_eraseButton->setCheckable( TRUE );
|
||||
|
||||
m_selectButton = new toolButton( embed::getIconPixmap(
|
||||
"edit_select" ),
|
||||
tr( "Select mode (S)" ),
|
||||
tr( "Select mode (Shift+S)" ),
|
||||
this, SLOT( selectButtonToggled() ),
|
||||
m_toolBar );
|
||||
m_selectButton->setCheckable( TRUE );
|
||||
|
||||
m_moveButton = new toolButton( embed::getIconPixmap( "edit_move" ),
|
||||
tr( "Move selection mode (M)" ),
|
||||
tr( "Move selection mode (Shift+M)" ),
|
||||
this, SLOT( moveButtonToggled() ),
|
||||
m_toolBar );
|
||||
m_moveButton->setCheckable( TRUE );
|
||||
@@ -327,8 +328,8 @@ pianoRoll::pianoRoll( engine * _engine ) :
|
||||
tr( "If you click here, draw-mode will be activated. In this "
|
||||
"mode you can add, resize and move single notes. This "
|
||||
"is the default-mode which is used most of the time. "
|
||||
"You can also press 'D' on your keyboard to activate "
|
||||
"this mode." ) );
|
||||
"You can also press 'Shift+D' on your keyboard to "
|
||||
"activate this mode." ) );
|
||||
#ifdef QT4
|
||||
m_eraseButton->setWhatsThis(
|
||||
#else
|
||||
@@ -336,7 +337,7 @@ pianoRoll::pianoRoll( engine * _engine ) :
|
||||
#endif
|
||||
tr( "If you click here, erase-mode will be activated. In this "
|
||||
"mode you can erase single notes. You can also press "
|
||||
"'E' on your keyboard to activate this mode." ) );
|
||||
"'Shift+E' on your keyboard to activate this mode." ) );
|
||||
#ifdef QT4
|
||||
m_selectButton->setWhatsThis(
|
||||
#else
|
||||
@@ -345,8 +346,8 @@ pianoRoll::pianoRoll( engine * _engine ) :
|
||||
tr( "If you click here, 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 'S' on your keyboard to "
|
||||
"activate this mode." ) );
|
||||
"notes. You can also press 'Shift+S' on your keyboard "
|
||||
"to activate this mode." ) );
|
||||
#ifdef QT4
|
||||
m_moveButton->setWhatsThis(
|
||||
#else
|
||||
@@ -354,8 +355,8 @@ pianoRoll::pianoRoll( engine * _engine ) :
|
||||
#endif
|
||||
tr( "If you click here, move-mode will be activated. In this "
|
||||
"mode you can move the notes you selected in select-"
|
||||
"mode. You can also press 'M' on your keyboard to "
|
||||
"activate this mode." ) );
|
||||
"mode. You can also press 'Shift+M' on your keyboard "
|
||||
"to activate this mode." ) );
|
||||
|
||||
m_cutButton = new toolButton( embed::getIconPixmap( "edit_cut" ),
|
||||
tr( "Cut selected notes (Ctrl+X)" ),
|
||||
@@ -1020,6 +1021,11 @@ void pianoRoll::enterEvent( QEvent * _e )
|
||||
|
||||
void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
if( validPattern() )
|
||||
{
|
||||
m_pattern->getInstrumentTrack()->getPianoWidget()
|
||||
->keyPressEvent( _ke );
|
||||
}
|
||||
switch( _ke->key() )
|
||||
{
|
||||
case Qt::Key_Up:
|
||||
@@ -1096,19 +1102,47 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
break;
|
||||
|
||||
case Qt::Key_D:
|
||||
m_drawButton->setChecked( TRUE );
|
||||
if( _ke->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
m_drawButton->setChecked( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_E:
|
||||
m_eraseButton->setChecked( TRUE );
|
||||
if( _ke->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
m_eraseButton->setChecked( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_S:
|
||||
m_selectButton->setChecked( TRUE );
|
||||
if( _ke->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
m_selectButton->setChecked( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_M:
|
||||
m_moveButton->setChecked( TRUE );
|
||||
if( _ke->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
m_moveButton->setChecked( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Delete:
|
||||
@@ -1152,6 +1186,11 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
|
||||
void pianoRoll::keyReleaseEvent( QKeyEvent * _ke )
|
||||
{
|
||||
if( validPattern() )
|
||||
{
|
||||
m_pattern->getInstrumentTrack()->getPianoWidget()
|
||||
->keyReleaseEvent( _ke );
|
||||
}
|
||||
switch( _ke->key() )
|
||||
{
|
||||
case Key_Control:
|
||||
@@ -2579,7 +2618,8 @@ midiTime pianoRoll::newNoteLen( void ) const
|
||||
|
||||
bool pianoRoll::mouseOverNote( void )
|
||||
{
|
||||
return( noteIteratorUnderMouse() != m_pattern->notes().end() );
|
||||
return( validPattern()
|
||||
&& noteIteratorUnderMouse() != m_pattern->notes().end() );
|
||||
}
|
||||
|
||||
|
||||
@@ -2634,6 +2674,19 @@ noteVector::iterator pianoRoll::noteIteratorUnderMouse( void )
|
||||
|
||||
|
||||
|
||||
bool pianoRoll::x11Event( XEvent * _xe )
|
||||
{
|
||||
if( validPattern() )
|
||||
{
|
||||
return( m_pattern->getInstrumentTrack()->getPianoWidget()
|
||||
->x11Event( _xe ) );
|
||||
}
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "piano_roll.moc"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user