Skip to content

Commit

Permalink
Added editor scroll up/down, fast up/down + left/right shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim committed Dec 12, 2023
1 parent c7600db commit b7da63c
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
11.12.2023
- Shortcuts: Forum request: Added editor scroll up/down, fast up/down + left/right. (Tim)
25.09.2023
- LV2: Streamline discovery. Eliminate duplicate load_world and load_all_plugins. (Tim)
This might make only slightly faster startup time. But code is more proper now.
Expand Down
72 changes: 66 additions & 6 deletions src/muse/midiedit/drumedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,15 +2009,75 @@ void DrumEdit::keyPressEvent(QKeyEvent* event)
return;
}
else if (key == shortcuts[SHRT_SCROLL_LEFT].key) {
int pos = hscroll->pos() - MusEGlobal::config.division;
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
if(hscroll)
{
int pos = hscroll->pos() - MusEGlobal::config.division;
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) {
int pos = hscroll->pos() + MusEGlobal::config.division;
hscroll->setPos(pos);
if(hscroll)
{
int pos = hscroll->pos() + MusEGlobal::config.division;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_LEFT_FAST].key) {
if(hscroll)
{
int pos = hscroll->pos() - (MusEGlobal::config.division * 5);
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_RIGHT_FAST].key) {
if(hscroll)
{
int pos = hscroll->pos() + (MusEGlobal::config.division * 5);
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_UP].key) {
if(vscroll)
{
int pos = vscroll->pos() - 20;
if (pos < 0)
pos = 0;
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_DOWN].key) {
if(vscroll)
{
int pos = vscroll->pos() + 20;
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_UP_FAST].key) {
if(vscroll)
{
int pos = vscroll->pos() - (20 * 5);
if (pos < 0)
pos = 0;
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_DOWN_FAST].key) {
if(vscroll)
{
int pos = vscroll->pos() + (20 * 5);
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SET_QUANT_BAR].key)
Expand Down
72 changes: 66 additions & 6 deletions src/muse/midiedit/pianoroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1673,15 +1673,75 @@ void PianoRoll::keyPressEvent(QKeyEvent* event)
return;
}
else if (key == shortcuts[SHRT_SCROLL_LEFT].key) {
int pos = hscroll->pos() - MusEGlobal::config.division;
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
if(hscroll)
{
int pos = hscroll->pos() - MusEGlobal::config.division;
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) {
int pos = hscroll->pos() + MusEGlobal::config.division;
hscroll->setPos(pos);
if(hscroll)
{
int pos = hscroll->pos() + MusEGlobal::config.division;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_LEFT_FAST].key) {
if(hscroll)
{
int pos = hscroll->pos() - (MusEGlobal::config.division * 5);
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_RIGHT_FAST].key) {
if(hscroll)
{
int pos = hscroll->pos() + (MusEGlobal::config.division * 5);
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_UP].key) {
if(vscroll)
{
int pos = vscroll->pos() - 20;
if (pos < 0)
pos = 0;
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_DOWN].key) {
if(vscroll)
{
int pos = vscroll->pos() + 20;
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_UP_FAST].key) {
if(vscroll)
{
int pos = vscroll->pos() - (20 * 5);
if (pos < 0)
pos = 0;
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_DOWN_FAST].key) {
if(vscroll)
{
int pos = vscroll->pos() + (20 * 5);
vscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SET_QUANT_BAR].key)
Expand Down
8 changes: 7 additions & 1 deletion src/muse/shortcuts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,13 @@ void initShortCuts()
defShrt(SHRT_ZOOM_OUT, Qt::CTRL + Qt::Key_PageDown, QT_TRANSLATE_NOOP("shortcuts", "View: Zoom out"), PROLL_SHRT + DEDIT_SHRT + ARRANG_SHRT + WAVE_SHRT, "zoom_out");
defShrt(SHRT_GOTO_CPOS, Qt::Key_I, QT_TRANSLATE_NOOP("shortcuts", "View: Goto Current Position"), PROLL_SHRT + DEDIT_SHRT + WAVE_SHRT, "goto_cpos");
defShrt(SHRT_SCROLL_LEFT, Qt::Key_H, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll left"), PROLL_SHRT + DEDIT_SHRT + WAVE_SHRT, "scroll_left");
defShrt(SHRT_SCROLL_RIGHT, Qt::Key_L, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll left"), PROLL_SHRT + DEDIT_SHRT + WAVE_SHRT, "scroll_right");
defShrt(SHRT_SCROLL_RIGHT, Qt::Key_L, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll right"), PROLL_SHRT + DEDIT_SHRT + WAVE_SHRT, "scroll_right");
defShrt(SHRT_SCROLL_LEFT_FAST, 0, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll left fast"), PROLL_SHRT + DEDIT_SHRT + WAVE_SHRT, "scroll_left_fast");
defShrt(SHRT_SCROLL_RIGHT_FAST, 0, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll right fast"), PROLL_SHRT + DEDIT_SHRT + WAVE_SHRT, "scroll_right_fast");
defShrt(SHRT_SCROLL_UP, Qt::Key_O, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll up"), PROLL_SHRT + DEDIT_SHRT, "scroll_up");
defShrt(SHRT_SCROLL_DOWN, Qt::Key_K, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll down"), PROLL_SHRT + DEDIT_SHRT, "scroll_down");
defShrt(SHRT_SCROLL_UP_FAST, Qt::SHIFT + Qt::Key_O, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll up fast"), PROLL_SHRT + DEDIT_SHRT, "scroll_up_fast");
defShrt(SHRT_SCROLL_DOWN_FAST, Qt::SHIFT + Qt::Key_K, QT_TRANSLATE_NOOP("shortcuts", "View: Scroll down fast"), PROLL_SHRT + DEDIT_SHRT, "scroll_down_fast");

defShrt(SHRT_STEP_RECORD, Qt::CTRL + Qt::Key_R, QT_TRANSLATE_NOOP("shortcuts", "Transport: Step record"), PROLL_SHRT + DEDIT_SHRT, "step_record");
defShrt(SHRT_MIDI_INPUT, Qt::CTRL + Qt::Key_U, QT_TRANSLATE_NOOP("shortcuts", "Transport: Midi input"), PROLL_SHRT + DEDIT_SHRT, "midi_input");
Expand Down
7 changes: 7 additions & 0 deletions src/muse/shortcuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ enum {
SHRT_GOTO_CPOS, // c
SHRT_SCROLL_LEFT, // h
SHRT_SCROLL_RIGHT, // l
SHRT_SCROLL_LEFT_FAST, //Default: undefined
SHRT_SCROLL_RIGHT_FAST, //Default: undefined
SHRT_SCROLL_UP, // o
SHRT_SCROLL_DOWN, // k
SHRT_SCROLL_UP_FAST, // Shift+o
SHRT_SCROLL_DOWN_FAST, // Shift+k

SHRT_FIXED_LEN, //Alt+L, currently only drumeditor
SHRT_QUANTIZE, //q
SHRT_MODIFY_GATE_TIME, //Default: undefined
Expand Down
38 changes: 31 additions & 7 deletions src/muse/waveedit/waveedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,18 +929,42 @@ void WaveEdit::keyPressEvent(QKeyEvent* event)
return;
}
else if (key == shortcuts[SHRT_SCROLL_LEFT].key) {
int pos = hscroll->pos() - MusEGlobal::config.division;
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
if(hscroll)
{
int pos = hscroll->pos() - MusEGlobal::config.division;
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) {
int pos = hscroll->pos() + MusEGlobal::config.division;
hscroll->setPos(pos);
if(hscroll)
{
int pos = hscroll->pos() + MusEGlobal::config.division;
hscroll->setPos(pos);
}
return;
}

else if (key == shortcuts[SHRT_SCROLL_LEFT_FAST].key) {
if(hscroll)
{
int pos = hscroll->pos() - (MusEGlobal::config.division * 5);
if (pos < 0)
pos = 0;
hscroll->setPos(pos);
}
return;
}
else if (key == shortcuts[SHRT_SCROLL_RIGHT_FAST].key) {
if(hscroll)
{
int pos = hscroll->pos() + (MusEGlobal::config.division * 5);
hscroll->setPos(pos);
}
return;
}

else if (key == shortcuts[SHRT_SET_QUANT_BAR].key)
rast_pick = RasterizerModel::GotoBar;
else if (key == shortcuts[SHRT_SET_QUANT_OFF].key)
Expand Down

0 comments on commit b7da63c

Please sign in to comment.