changed modifier detection from mainWindow::isCtrlPressed etc to Qt framework detection. Fixes a bunch of little glitches and enables horizontal scroll wheel.

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1940 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Andrew Kelley
2008-12-16 09:52:00 +00:00
parent 164616d45a
commit c34dffa50f
16 changed files with 55 additions and 35 deletions

View File

@@ -1,3 +1,24 @@
2008-12-16 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/gui/piano_roll.cpp:
* src/gui/automatable_model_view.cpp:
* src/gui/song_editor.cpp:
* src/gui/widgets/combobox.cpp:
* src/gui/widgets/knob.cpp:
* src/gui/widgets/automatable_slider.cpp:
* src/gui/widgets/lcd_spinbox.cpp:
* src/gui/widgets/fader.cpp:
* src/gui/widgets/automatable_button.cpp:
* src/gui/automation_editor.cpp:
* src/tracks/sample_track.cpp:
* src/tracks/pattern.cpp:
* src/core/timeline.cpp:
* src/core/track.cpp:
* src/core/piano.cpp:
changed modifier detection from mainWindow::isCtrlPressed etc to
Qt framework detection. Fixes a bunch of little glitches and
enables horizontal scroll wheels.
2008-12-15 Paul Giblock <drfaygo/at/gmail/dot/com>
* src/core/track.cpp:

View File

@@ -506,7 +506,7 @@ void pianoView::mousePressEvent( QMouseEvent * _me )
}
else
{
if( engine::getMainWindow()->isCtrlPressed() )
if( _me->modifiers() & Qt::ControlModifier )
{
new stringPairDrag( "automatable_model",
QString::number( m_piano->

View File

@@ -336,7 +336,7 @@ void timeLine::mouseMoveEvent( QMouseEvent * _me )
case MoveLoopEnd:
{
const Uint8 i = m_action - MoveLoopBegin;
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _me->modifiers() & Qt::ControlModifier )
{
// no ctrl-press-hint when having ctrl pressed
delete m_hint;

View File

@@ -543,7 +543,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
// if rubberband is active, we can be selected
if( !m_trackView->getTrackContainerView()->rubberBandActive() )
{
if( engine::getMainWindow()->isCtrlPressed() == true )
if( _me->modifiers() & Qt::ControlModifier )
{
setSelected( !isSelected() );
}
@@ -559,13 +559,13 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
}
return;
}
else if( engine::getMainWindow()->isShiftPressed() == true )
else if( _me->modifiers() & Qt::ShiftModifier )
{
// add/remove object to/from selection
selectableObject::mousePressEvent( _me );
}
else if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == true )
_me->modifiers() & Qt::ControlModifier )
{
// start drag-action
multimediaProject mmp( multimediaProject::DragNDropData );
@@ -620,7 +620,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
}
else if( _me->button() == Qt::MidButton )
{
if( engine::getMainWindow()->isCtrlPressed() )
if( _me->modifiers() & Qt::ControlModifier )
{
m_tco->toggleMute();
}
@@ -649,7 +649,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
*/
void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
{
if( engine::getMainWindow()->isCtrlPressed() == true )
if( _me->modifiers() & Qt::ControlModifier )
{
delete m_hint;
m_hint = NULL;
@@ -663,8 +663,8 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
m_trackView->getTrackContainerView()->currentPosition()+
static_cast<int>( x * midiTime::ticksPerTact() /
ppt ) );
if( engine::getMainWindow()->isCtrlPressed() ==
false && _me->button() == Qt::NoButton )
if( _me->modifiers() & Qt::ControlModifier
&& _me->button() == Qt::NoButton )
{
t = t.toNearestTact();
}
@@ -716,8 +716,8 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
midiTime t = qMax( midiTime::ticksPerTact(),
static_cast<int>( _me->x() *
midiTime::ticksPerTact() / ppt ) );
if( engine::getMainWindow()->isCtrlPressed() ==
false && _me->button() == Qt::NoButton )
if( _me->modifiers() & Qt::ControlModifier
&& _me->button() == Qt::NoButton )
{
t = t.toNearestTact();
}
@@ -1106,7 +1106,7 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me )
{
QWidget::mousePressEvent( _me );
}
else if( engine::getMainWindow()->isShiftPressed() == true )
else if( _me->modifiers() & Qt::ShiftModifier )
{
QWidget::mousePressEvent( _me );
}
@@ -1408,7 +1408,7 @@ trackOperationsWidget::~trackOperationsWidget()
void trackOperationsWidget::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == true &&
_me->modifiers() & Qt::ControlModifier &&
m_trackView->getTrack()->type() != track::BBTrack )
{
multimediaProject mmp( multimediaProject::DragNDropData );
@@ -2307,7 +2307,7 @@ void trackView::mousePressEvent( QMouseEvent * _me )
}
else if( _me->button() == Qt::LeftButton )
{
if( engine::getMainWindow()->isShiftPressed() == true )
if( _me->modifiers() & Qt::ShiftModifier )
{
m_action = ResizeTrack;
QCursor::setPos( mapToGlobal( QPoint( _me->x(),

View File

@@ -144,7 +144,7 @@ void automatableModelView::setModel( model * _model, bool _old_model_valid )
void automatableModelView::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == TRUE )
_me->modifiers() & Qt::ControlModifier )
{
new stringPairDrag( "automatable_model",
QString::number( modelUntyped()->id() ),

View File

@@ -745,7 +745,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me )
m_editMode == DRAW )
{
// Connect the dots
if( engine::getMainWindow()->isShiftPressed() )
if( _me->modifiers() & Qt::ShiftModifier )
{
drawLine( m_drawLastTick,
m_drawLastLevel,
@@ -1612,7 +1612,7 @@ void automationEditor::resizeEvent( QResizeEvent * )
void automationEditor::wheelEvent( QWheelEvent * _we )
{
_we->accept();
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _we->modifiers() & Qt::ControlModifier )
{
if( _we->delta() > 0 )
{
@@ -1632,7 +1632,8 @@ void automationEditor::wheelEvent( QWheelEvent * _we )
m_timeLine->setPixelsPerTact( m_ppt );
update();
}
else if( engine::getMainWindow()->isShiftPressed() )
else if( _we->modifiers() & Qt::ShiftModifier
|| _we->orientation() == Qt::Horizontal )
{
m_leftRightScroll->setValue( m_leftRightScroll->value() -
_we->delta() * 2 / 15 );

View File

@@ -2919,7 +2919,7 @@ void pianoRoll::wheelEvent( QWheelEvent * _we )
m_timeLine->setPixelsPerTact( m_ppt );
update();
}
else if( engine::getMainWindow()->isShiftPressed()
else if( _we->modifiers() & Qt::ShiftModifier
|| _we->orientation() == Qt::Horizontal )
{
m_leftRightScroll->setValue( m_leftRightScroll->value() -

View File

@@ -318,14 +318,12 @@ void songEditor::stop( void )
void songEditor::keyPressEvent( QKeyEvent * _ke )
{
if( /*_ke->modifiers() & Qt::ShiftModifier*/
engine::getMainWindow()->isShiftPressed() == TRUE &&
if( _ke->modifiers() & Qt::ShiftModifier &&
_ke->key() == Qt::Key_Insert )
{
m_s->insertBar();
}
else if(/* _ke->modifiers() & Qt::ShiftModifier &&*/
engine::getMainWindow()->isShiftPressed() == TRUE &&
else if( _ke->modifiers() & Qt::ShiftModifier &&
_ke->key() == Qt::Key_Delete )
{
m_s->removeBar();
@@ -381,7 +379,7 @@ void songEditor::paintEvent( QPaintEvent * _pe )
void songEditor::wheelEvent( QWheelEvent * _we )
{
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _we->modifiers() & Qt::ControlModifier )
{
if( _we->delta() > 0 )
{
@@ -405,7 +403,7 @@ void songEditor::wheelEvent( QWheelEvent * _we )
// and make sure, all TCO's are resized and relocated
realignTracks();
}
else if( engine::getMainWindow()->isShiftPressed() == TRUE )
else if( _we->modifiers() & Qt::ShiftModifier )
{
m_leftRightScroll->setValue( m_leftRightScroll->value() -
_we->delta() / 30 );

View File

@@ -115,7 +115,7 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
void automatableButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
_me->modifiers() & Qt::ControlModifier )
{
if( isCheckable() )
{

View File

@@ -76,7 +76,7 @@ void automatableSlider::contextMenuEvent( QContextMenuEvent * _me )
void automatableSlider::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
_me->modifiers() & Qt::ControlModifier )
{
m_showStatus = TRUE;
QSlider::mousePressEvent( _me );

View File

@@ -114,7 +114,7 @@ void comboBox::contextMenuEvent( QContextMenuEvent * _me )
void comboBox::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
_me->modifiers() & Qt::ControlModifier )
{
if( _me->x() > width() - CB_ARROW_BTN_WIDTH )
{

View File

@@ -112,7 +112,7 @@ void fader::mouseMoveEvent( QMouseEvent *ev )
void fader::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE )
_me->modifiers() & Qt::ControlModifier )
{
mouseMoveEvent( _me );
_me->accept();

View File

@@ -439,8 +439,8 @@ void knob::dropEvent( QDropEvent * _de )
void knob::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == FALSE &&
engine::getMainWindow()->isShiftPressed() == FALSE )
_me->modifiers() & Qt::ControlModifier &&
_me->modifiers() & Qt::ShiftModifier )
{
model()->prepareJournalEntryFromOldVal();

View File

@@ -285,7 +285,7 @@ void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me )
void lcdSpinBox::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == false &&
_me->modifiers() & Qt::ControlModifier &&
_me->y() < m_cellHeight + 2 )
{
m_origMousePos = _me->globalPos();

View File

@@ -1052,7 +1052,7 @@ void patternView::mousePressEvent( QMouseEvent * _me )
}
else if( m_pat->m_frozenPattern != NULL &&
_me->button() == Qt::LeftButton &&
engine::getMainWindow()->isShiftPressed() == true )
_me->modifiers() & Qt::ShiftModifier )
{
QString s;
new stringPairDrag( "sampledata",

View File

@@ -297,8 +297,8 @@ void sampleTCOView::dropEvent( QDropEvent * _de )
void sampleTCOView::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() &&
engine::getMainWindow()->isShiftPressed() )
_me->modifiers() & Qt::ControlModifier &&
_me->modifiers() & Qt::ShiftModifier )
{
m_tco->toggleRecord();
}