Skip to content

Commit

Permalink
Add dual-button mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Spekular committed May 16, 2022
1 parent 7dc9ac0 commit 76bedae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/gui/TimeLineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ TimeLineWidget::actions TimeLineWidget::getLoopAction(QMouseEvent* event)
const TimePos t = getClickedTime(event);
const QString loopMode = ConfigManager::inst()->value( "app", "loopmarkermode" );

if (loopMode == "Handles")
if (loopMode == "Handles" && event->button() == Qt::LeftButton)
{
const int leftMost = std::max(markerX(loopBegin()), m_xOffset);
const int deltaLeft = event->x() - leftMost;
Expand All @@ -360,12 +360,19 @@ TimeLineWidget::actions TimeLineWidget::getLoopAction(QMouseEvent* event)
else if (deltaRight <= 5) { return MoveLoopEnd; }
else { return NoAction; } // TODO: Loop slide
}
else /**if (loopMode == "Grab closest")**/
else if (loopMode == "Grab closest" && event->button() == Qt::LeftButton)
{
const TimePos loopMid = (m_loopPos[0] + m_loopPos[1])/2;
return t < loopMid ? MoveLoopBegin : MoveLoopEnd;
}
// TODO: shortcut mode
else if (loopMode == "Dual-button")
{
if (event->button() == Qt::LeftButton){ return MoveLoopBegin; }
else if (event->button() == Qt::RightButton){ return MoveLoopEnd; }
}

//Fallback
return NoAction;
}


Expand Down
1 change: 1 addition & 0 deletions src/gui/modals/SetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :

m_loopMarkerModes.append(QString("Grab closest"));
m_loopMarkerModes.append(QString("Handles"));
m_loopMarkerModes.append(QString("Dual-button"));

for (QString mode : m_loopMarkerModes)
{
Expand Down

1 comment on commit 76bedae

@Xeno-Idaltu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very handy tweak, Thanks!

Please sign in to comment.