From c655d31b3e79af7c819ff9542c00634bd0065ecb Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:25:27 -0400 Subject: [PATCH 1/6] Add Proportional Scrolling --- src/gui/editors/PianoRoll.cpp | 4 ++-- src/gui/editors/SongEditor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 1c89f6a0b34..c5d5e9bb60e 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3876,12 +3876,12 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 15); + we->angleDelta().x() * 2 / 15 / m_zoomLevels[m_zoomingModel.value()]); } else if(we->modifiers() & Qt::ShiftModifier) { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 15); + we->angleDelta().y() * 2 / 15 / m_zoomLevels[m_zoomingModel.value()]); } else { diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index f6e9fc83bf8..e8fd2cca91c 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -545,12 +545,12 @@ void SongEditor::wheelEvent( QWheelEvent * we ) else if (std::abs(we->angleDelta().x()) > std::abs(we->angleDelta().y())) // scrolling is horizontal { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x()); + - we->angleDelta().x() * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); } else if (we->modifiers() & Qt::ShiftModifier) { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y()); + - we->angleDelta().y() * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); } else { From 53a21f58a02017aff7c259327f9937888b1dc9e4 Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:38:55 -0400 Subject: [PATCH 2/6] Add proportional scrolling to Automation Editor --- src/gui/editors/AutomationEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index a7ca0727972..91b41c52c1e 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1626,12 +1626,12 @@ void AutomationEditor::wheelEvent(QWheelEvent * we ) else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 15); + we->angleDelta().x() * 2 / 15 / m_zoomXLevels[m_zoomingXModel.value()]); } else if(we->modifiers() & Qt::ShiftModifier) { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 15); + we->angleDelta().y() * 2 / 15 / m_zoomXLevels[m_zoomingXModel.value()]); } else { From ffd3967bdb92b3af8faa1695bebc4f32324e0c2b Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Fri, 30 Aug 2024 16:35:22 -0400 Subject: [PATCH 3/6] Increase horizontal scrolling speed 3x in Piano and Automation Editors --- src/gui/editors/AutomationEditor.cpp | 4 ++-- src/gui/editors/PianoRoll.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 91b41c52c1e..619ee679650 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1626,12 +1626,12 @@ void AutomationEditor::wheelEvent(QWheelEvent * we ) else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 15 / m_zoomXLevels[m_zoomingXModel.value()]); + we->angleDelta().x() * 2 / 6 / m_zoomXLevels[m_zoomingXModel.value()]); } else if(we->modifiers() & Qt::ShiftModifier) { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 15 / m_zoomXLevels[m_zoomingXModel.value()]); + we->angleDelta().y() * 2 / 6 / m_zoomXLevels[m_zoomingXModel.value()]); } else { diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index c5d5e9bb60e..0c4e8e635d2 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3876,12 +3876,12 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 15 / m_zoomLevels[m_zoomingModel.value()]); + we->angleDelta().x() * 2 / 6 / m_zoomLevels[m_zoomingModel.value()]); } else if(we->modifiers() & Qt::ShiftModifier) { m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 15 / m_zoomLevels[m_zoomingModel.value()]); + we->angleDelta().y() * 2 / 6 / m_zoomLevels[m_zoomingModel.value()]); } else { From 2f71e41fe7459b98036d17afa1564eba075e1c40 Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:39:03 -0400 Subject: [PATCH 4/6] Add helper method for incrementing scoll position --- include/AutomationEditor.h | 2 ++ include/PianoRoll.h | 2 ++ include/SongEditor.h | 2 ++ src/gui/editors/AutomationEditor.cpp | 12 +++++++----- src/gui/editors/PianoRoll.cpp | 12 ++++++++---- src/gui/editors/SongEditor.cpp | 12 ++++++++---- 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 1110e8e4c9e..dbead7d7f1a 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -241,6 +241,8 @@ protected slots: QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; + void incrementLeftRightScoll(int value); + TimePos m_currentPosition; Action m_action; diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 35550a5b32f..476e02e127b 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -374,6 +374,8 @@ protected slots: QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; + void incrementLeftRightScoll(int value); + TimePos m_currentPosition; bool m_recording; bool m_doAutoQuantization{false}; diff --git a/include/SongEditor.h b/include/SongEditor.h index 98a9096fb26..ff1f4f1d95e 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -128,6 +128,8 @@ private slots: QScrollBar * m_leftRightScroll; + void incrementLeftRightScoll(int value); + LcdSpinBox * m_tempoSpinBox; TimeLineWidget * m_timeLine; diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 619ee679650..30237bb9ced 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1560,7 +1560,11 @@ void AutomationEditor::resizeEvent(QResizeEvent * re) update(); } - +void AutomationEditor::incrementLeftRightScoll(int value) +{ + m_leftRightScroll->setValue(m_leftRightScroll->value() - + value * 0.3f / m_zoomXLevels[m_zoomingXModel.value()]); +} // TODO: Move this method up so it's closer to the other mouse events @@ -1625,13 +1629,11 @@ void AutomationEditor::wheelEvent(QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 6 / m_zoomXLevels[m_zoomingXModel.value()]); + incrementLeftRightScoll(we->angleDelta().x()); } else if(we->modifiers() & Qt::ShiftModifier) { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 6 / m_zoomXLevels[m_zoomingXModel.value()]); + incrementLeftRightScoll(we->angleDelta().y()); } else { diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 0c4e8e635d2..d415403b818 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3743,6 +3743,12 @@ void PianoRoll::resizeEvent(QResizeEvent* re) } +void PianoRoll::incrementLeftRightScoll(int value) +{ + m_leftRightScroll->setValue(m_leftRightScroll->value() - + value * 0.3f / m_zoomXLevels[m_zoomingXModel.value()]); +} + void PianoRoll::wheelEvent(QWheelEvent * we ) @@ -3875,13 +3881,11 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 6 / m_zoomLevels[m_zoomingModel.value()]); + incrementLeftRightScoll(we->angleDelta().x()); } else if(we->modifiers() & Qt::ShiftModifier) { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 6 / m_zoomLevels[m_zoomingModel.value()]); + incrementLeftRightScoll(we->angleDelta().y()); } else { diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index e8fd2cca91c..914e4680d8c 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -516,6 +516,12 @@ void SongEditor::keyPressEvent( QKeyEvent * ke ) +void SongEditor::incrementLeftRightScoll(int value) +{ + m_leftRightScroll->setValue(m_leftRightScroll->value() + - value * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); +} + void SongEditor::wheelEvent( QWheelEvent * we ) { @@ -544,13 +550,11 @@ void SongEditor::wheelEvent( QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if (std::abs(we->angleDelta().x()) > std::abs(we->angleDelta().y())) // scrolling is horizontal { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); + incrementLeftRightScoll(we->angleDelta().x()); } else if (we->modifiers() & Qt::ShiftModifier) { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); + incrementLeftRightScoll(we->angleDelta().y()); } else { From bf95ea2053a11f03822eef963755522fe42b8f96 Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:51:19 -0400 Subject: [PATCH 5/6] Fix copy-paste error --- src/gui/editors/PianoRoll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index d415403b818..0ab43c33a57 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3746,7 +3746,7 @@ void PianoRoll::resizeEvent(QResizeEvent* re) void PianoRoll::incrementLeftRightScoll(int value) { m_leftRightScroll->setValue(m_leftRightScroll->value() - - value * 0.3f / m_zoomXLevels[m_zoomingXModel.value()]); + value * 0.3f / m_zoomLevels[m_zoomingModel.value()]); } From a89073b2cdda76f3a3badf1e911ad2afa12a73bb Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:06:49 -0400 Subject: [PATCH 6/6] Change name of helper method --- include/AutomationEditor.h | 2 +- include/PianoRoll.h | 2 +- include/SongEditor.h | 2 +- src/gui/editors/AutomationEditor.cpp | 6 +++--- src/gui/editors/PianoRoll.cpp | 6 +++--- src/gui/editors/SongEditor.cpp | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index dbead7d7f1a..15f6dd22ec5 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -241,7 +241,7 @@ protected slots: QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; - void incrementLeftRightScoll(int value); + void adjustLeftRightScoll(int value); TimePos m_currentPosition; diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 476e02e127b..a85e50a163b 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -374,7 +374,7 @@ protected slots: QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; - void incrementLeftRightScoll(int value); + void adjustLeftRightScoll(int value); TimePos m_currentPosition; bool m_recording; diff --git a/include/SongEditor.h b/include/SongEditor.h index ff1f4f1d95e..1f719623a1e 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -128,7 +128,7 @@ private slots: QScrollBar * m_leftRightScroll; - void incrementLeftRightScoll(int value); + void adjustLeftRightScoll(int value); LcdSpinBox * m_tempoSpinBox; diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 30237bb9ced..1fc38a345ed 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1560,7 +1560,7 @@ void AutomationEditor::resizeEvent(QResizeEvent * re) update(); } -void AutomationEditor::incrementLeftRightScoll(int value) +void AutomationEditor::adjustLeftRightScoll(int value) { m_leftRightScroll->setValue(m_leftRightScroll->value() - value * 0.3f / m_zoomXLevels[m_zoomingXModel.value()]); @@ -1629,11 +1629,11 @@ void AutomationEditor::wheelEvent(QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { - incrementLeftRightScoll(we->angleDelta().x()); + adjustLeftRightScoll(we->angleDelta().x()); } else if(we->modifiers() & Qt::ShiftModifier) { - incrementLeftRightScoll(we->angleDelta().y()); + adjustLeftRightScoll(we->angleDelta().y()); } else { diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 0ab43c33a57..bce317a1231 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3743,7 +3743,7 @@ void PianoRoll::resizeEvent(QResizeEvent* re) } -void PianoRoll::incrementLeftRightScoll(int value) +void PianoRoll::adjustLeftRightScoll(int value) { m_leftRightScroll->setValue(m_leftRightScroll->value() - value * 0.3f / m_zoomLevels[m_zoomingModel.value()]); @@ -3881,11 +3881,11 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { - incrementLeftRightScoll(we->angleDelta().x()); + adjustLeftRightScoll(we->angleDelta().x()); } else if(we->modifiers() & Qt::ShiftModifier) { - incrementLeftRightScoll(we->angleDelta().y()); + adjustLeftRightScoll(we->angleDelta().y()); } else { diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 914e4680d8c..72ee28bc82a 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -516,7 +516,7 @@ void SongEditor::keyPressEvent( QKeyEvent * ke ) -void SongEditor::incrementLeftRightScoll(int value) +void SongEditor::adjustLeftRightScoll(int value) { m_leftRightScroll->setValue(m_leftRightScroll->value() - value * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); @@ -550,11 +550,11 @@ void SongEditor::wheelEvent( QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if (std::abs(we->angleDelta().x()) > std::abs(we->angleDelta().y())) // scrolling is horizontal { - incrementLeftRightScoll(we->angleDelta().x()); + adjustLeftRightScoll(we->angleDelta().x()); } else if (we->modifiers() & Qt::ShiftModifier) { - incrementLeftRightScoll(we->angleDelta().y()); + adjustLeftRightScoll(we->angleDelta().y()); } else {