diff --git a/ChangeLog b/ChangeLog index 4d09c2462..0eabb8ca6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2008-12-16 Andrew Kelley + + * 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 * src/core/track.cpp: diff --git a/src/core/piano.cpp b/src/core/piano.cpp index cb8a740a5..503d99627 100644 --- a/src/core/piano.cpp +++ b/src/core/piano.cpp @@ -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-> diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index ac860c3c1..693e7f87e 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -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; diff --git a/src/core/track.cpp b/src/core/track.cpp index 2e0309197..084f4a461 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -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( 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( _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(), diff --git a/src/gui/automatable_model_view.cpp b/src/gui/automatable_model_view.cpp index 2b8189fd0..3c53ac723 100644 --- a/src/gui/automatable_model_view.cpp +++ b/src/gui/automatable_model_view.cpp @@ -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() ), diff --git a/src/gui/automation_editor.cpp b/src/gui/automation_editor.cpp index 3f4b8ae01..afe484c55 100644 --- a/src/gui/automation_editor.cpp +++ b/src/gui/automation_editor.cpp @@ -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 ); diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 1b8d54ee5..314c2cf0f 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -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() - diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index f76d7d121..95b97447f 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -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 ); diff --git a/src/gui/widgets/automatable_button.cpp b/src/gui/widgets/automatable_button.cpp index fee79649a..f09c1b874 100644 --- a/src/gui/widgets/automatable_button.cpp +++ b/src/gui/widgets/automatable_button.cpp @@ -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() ) { diff --git a/src/gui/widgets/automatable_slider.cpp b/src/gui/widgets/automatable_slider.cpp index 83474f9f2..7c1d6c525 100644 --- a/src/gui/widgets/automatable_slider.cpp +++ b/src/gui/widgets/automatable_slider.cpp @@ -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 ); diff --git a/src/gui/widgets/combobox.cpp b/src/gui/widgets/combobox.cpp index 67a693855..c3b722a22 100644 --- a/src/gui/widgets/combobox.cpp +++ b/src/gui/widgets/combobox.cpp @@ -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 ) { diff --git a/src/gui/widgets/fader.cpp b/src/gui/widgets/fader.cpp index b43ff491b..161b4af4f 100644 --- a/src/gui/widgets/fader.cpp +++ b/src/gui/widgets/fader.cpp @@ -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(); diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index 138bea0c3..5eaa1c664 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -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(); diff --git a/src/gui/widgets/lcd_spinbox.cpp b/src/gui/widgets/lcd_spinbox.cpp index 2653f9d6a..7125bc8aa 100644 --- a/src/gui/widgets/lcd_spinbox.cpp +++ b/src/gui/widgets/lcd_spinbox.cpp @@ -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(); diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index d6f4a141f..ddc54e109 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -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", diff --git a/src/tracks/sample_track.cpp b/src/tracks/sample_track.cpp index 3c3b73474..48466ec6b 100644 --- a/src/tracks/sample_track.cpp +++ b/src/tracks/sample_track.cpp @@ -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(); }