Adding proportional scrolling (#7476)
Add proportional scrolling to the song editor, piano roll and automation editor. Proportional scrolling means that if for example a certain measure is on the right side of the song editor then it will take a certain number of mouse wheel moves to get it to the left side of the editor. It is the same number of wheel moves regardless of the zoom level.
This commit is contained in:
@@ -241,6 +241,8 @@ private:
|
||||
QScrollBar * m_leftRightScroll;
|
||||
QScrollBar * m_topBottomScroll;
|
||||
|
||||
void adjustLeftRightScoll(int value);
|
||||
|
||||
TimePos m_currentPosition;
|
||||
|
||||
Action m_action;
|
||||
|
||||
@@ -374,6 +374,8 @@ private:
|
||||
QScrollBar * m_leftRightScroll;
|
||||
QScrollBar * m_topBottomScroll;
|
||||
|
||||
void adjustLeftRightScoll(int value);
|
||||
|
||||
TimePos m_currentPosition;
|
||||
bool m_recording;
|
||||
bool m_doAutoQuantization{false};
|
||||
|
||||
@@ -128,6 +128,8 @@ private:
|
||||
|
||||
QScrollBar * m_leftRightScroll;
|
||||
|
||||
void adjustLeftRightScoll(int value);
|
||||
|
||||
LcdSpinBox * m_tempoSpinBox;
|
||||
|
||||
TimeLineWidget * m_timeLine;
|
||||
|
||||
@@ -1560,7 +1560,11 @@ void AutomationEditor::resizeEvent(QResizeEvent * re)
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void AutomationEditor::adjustLeftRightScoll(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 / 15);
|
||||
adjustLeftRightScoll(we->angleDelta().x());
|
||||
}
|
||||
else if(we->modifiers() & Qt::ShiftModifier)
|
||||
{
|
||||
m_leftRightScroll->setValue(m_leftRightScroll->value() -
|
||||
we->angleDelta().y() * 2 / 15);
|
||||
adjustLeftRightScoll(we->angleDelta().y());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3743,6 +3743,12 @@ void PianoRoll::resizeEvent(QResizeEvent* re)
|
||||
}
|
||||
|
||||
|
||||
void PianoRoll::adjustLeftRightScoll(int value)
|
||||
{
|
||||
m_leftRightScroll->setValue(m_leftRightScroll->value() -
|
||||
value * 0.3f / m_zoomLevels[m_zoomingModel.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 / 15);
|
||||
adjustLeftRightScoll(we->angleDelta().x());
|
||||
}
|
||||
else if(we->modifiers() & Qt::ShiftModifier)
|
||||
{
|
||||
m_leftRightScroll->setValue(m_leftRightScroll->value() -
|
||||
we->angleDelta().y() * 2 / 15);
|
||||
adjustLeftRightScoll(we->angleDelta().y());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -516,6 +516,12 @@ void SongEditor::keyPressEvent( QKeyEvent * ke )
|
||||
|
||||
|
||||
|
||||
void SongEditor::adjustLeftRightScoll(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());
|
||||
adjustLeftRightScoll(we->angleDelta().x());
|
||||
}
|
||||
else if (we->modifiers() & Qt::ShiftModifier)
|
||||
{
|
||||
m_leftRightScroll->setValue(m_leftRightScroll->value()
|
||||
- we->angleDelta().y());
|
||||
adjustLeftRightScoll(we->angleDelta().y());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user