diff options
author | Tim E. Real <termtech@rogers.com> | 2011-01-02 07:53:30 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2011-01-02 07:53:30 +0000 |
commit | 2b6b35d94ace955c3a2d468ee761fa3afe59d5d9 (patch) | |
tree | 440411c08e63f1843fbdc1cd71975693c0e6c21f /muse2/muse | |
parent | 89f610ac96d0bf1d40abe4849d9fb9d4b2ec84ba (diff) |
Focussing, shortcuts, transport position snapping.
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/app.cpp | 46 | ||||
-rw-r--r-- | muse2/muse/app.h | 1 | ||||
-rw-r--r-- | muse2/muse/arranger/arranger.cpp | 12 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 29 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/main.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/midiedit/cmd.h | 2 | ||||
-rw-r--r-- | muse2/muse/midiedit/dcanvas.cpp | 33 | ||||
-rw-r--r-- | muse2/muse/midiedit/dcanvas.h | 2 | ||||
-rw-r--r-- | muse2/muse/midiedit/drumedit.cpp | 9 | ||||
-rw-r--r-- | muse2/muse/midiedit/pianoroll.cpp | 10 | ||||
-rw-r--r-- | muse2/muse/midiedit/prcanvas.cpp | 31 | ||||
-rw-r--r-- | muse2/muse/shortcuts.cpp | 38 | ||||
-rw-r--r-- | muse2/muse/shortcuts.h | 36 | ||||
-rw-r--r-- | muse2/muse/song.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/song.h | 6 | ||||
-rw-r--r-- | muse2/muse/wave.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/bigtime.cpp | 1 | ||||
-rw-r--r-- | muse2/muse/widgets/scrollscale.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/shortcutcapturedialog.cpp | 16 | ||||
-rw-r--r-- | muse2/muse/widgets/view.cpp | 2 |
21 files changed, 254 insertions, 48 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 3758bcb9..f988a4b7 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -3386,6 +3386,16 @@ void MusE::ctrlChanged() #endif //--------------------------------------------------------- +// keyPressEvent +//--------------------------------------------------------- + +void MusE::keyPressEvent(QKeyEvent* event) + { + // Pass it on to arranger part canvas. + arranger->getCanvas()->redirKeypress(event); + } + +//--------------------------------------------------------- // kbAccel //--------------------------------------------------------- @@ -3419,22 +3429,42 @@ void MusE::kbAccel(int key) song->setPlay(true); } - /* + // p4.0.10 Tim. Normally each editor window handles these, to inc by the editor's raster snap value. + // But users were asking for a global version - "they don't work when I'm in mixer or transport". + // Since no editor claimed the key event, we don't know a specific editor's snap setting, + // so adopt a policy where the arranger is the 'main' raster reference, I guess... else if (key == shortcuts[SHRT_POS_DEC].key) { - int pos = song->pos(); - int frames = pos - AL::sigmap.rasterStep(pos, *_raster); - if (frames < 0) - frames = 0; - Pos p(frames,true); + int spos = song->cpos(); + if(spos > 0) + { + spos -= 1; // Nudge by -1, then snap down with raster1. + spos = AL::sigmap.raster1(spos, song->arrangerRaster()); + } + if(spos < 0) + spos = 0; + Pos p(spos,true); song->setPos(0, p, true, true, true); return; } else if (key == shortcuts[SHRT_POS_INC].key) { - Pos p(pos[0] + AL::sigmap.rasterStep(pos[0], *_raster), true); + int spos = AL::sigmap.raster2(song->cpos() + 1, song->arrangerRaster()); // Nudge by +1, then snap up with raster2. + Pos p(spos,true); song->setPos(0, p, true, true, true); //CDW return; } - */ + else if (key == shortcuts[SHRT_POS_DEC_NOSNAP].key) { + int spos = song->cpos() - AL::sigmap.rasterStep(song->cpos(), song->arrangerRaster()); + if(spos < 0) + spos = 0; + Pos p(spos,true); + song->setPos(0, p, true, true, true); + return; + } + else if (key == shortcuts[SHRT_POS_INC_NOSNAP].key) { + Pos p(song->cpos() + AL::sigmap.rasterStep(song->cpos(), song->arrangerRaster()), true); + song->setPos(0, p, true, true, true); + return; + } else if (key == shortcuts[SHRT_GOTO_LEFT].key) { if (!song->record()) diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 3a9925aa..a270a599 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -210,6 +210,7 @@ class MusE : public QMainWindow void updateConfiguration(); virtual void focusInEvent(QFocusEvent*); + virtual void keyPressEvent(QKeyEvent*); // p4.0.10 Tim. QSignalMapper *editSignalMapper; QSignalMapper *midiPluginSignalMapper; diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 6d722f34..b27a47d1 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -138,6 +138,8 @@ Arranger::Arranger(QMainWindow* parent, const char* name) for (int i = 0; i < 6; i++) raster->insertItem(i, tr(rastval[i])); raster->setCurrentIndex(1); + // Set the audio record part snapping. Set to 0 (bar), the same as this combo box intial raster. + song->setArrangerRaster(0); toolbar->addWidget(raster); connect(raster, SIGNAL(activated(int)), SLOT(_setRaster(int))); ///raster->setFocusPolicy(Qt::NoFocus); @@ -266,6 +268,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) ib->setText(tr("TrackInfo")); ib->setCheckable(true); ib->setChecked(showTrackinfoFlag); + ib->setFocusPolicy(Qt::NoFocus); connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool))); header = new Header(tracklist, "header"); @@ -337,6 +340,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) int offset = AL::sigmap.ticksMeasure(0); hscroll = new ScrollScale(-1000, -10, xscale, song->len(), Qt::Horizontal, editor, -offset); + hscroll->setFocusPolicy(Qt::NoFocus); ib->setFixedHeight(hscroll->sizeHint().height()); // Changed p3.3.43 Too small steps for me... @@ -370,7 +374,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) canvas->setCanvasTools(arrangerTools); canvas->setOrigin(-offset, 0); canvas->setFocus(); - parent->setFocusProxy(canvas); // Tim. + //parent->setFocusProxy(canvas); // Tim. connect(canvas, SIGNAL(setUsedTool(int)), this, SIGNAL(setUsedTool(int))); connect(canvas, SIGNAL(trackChanged(Track*)), list, SLOT(selectTrack(Track*))); @@ -430,8 +434,8 @@ Arranger::Arranger(QMainWindow* parent, const char* name) setTabOrder(trackInfo, infoScroll); setTabOrder(infoScroll, list); setTabOrder(list, canvas); - setTabOrder(canvas, ib); - setTabOrder(ib, hscroll); + //setTabOrder(canvas, ib); + //setTabOrder(ib, hscroll); } //--------------------------------------------------------- @@ -698,7 +702,7 @@ void Arranger::_setRaster(int index) }; _raster = rasterTable[index]; // Set the audio record part snapping. - song->setRecRaster(_raster); + song->setArrangerRaster(_raster); canvas->redraw(); } diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index ae0392d8..b57f524f 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -1103,16 +1103,35 @@ void PartCanvas::keyPress(QKeyEvent* event) return; } else if (key == shortcuts[SHRT_POS_DEC].key) { - int frames = pos[0] - AL::sigmap.rasterStep(pos[0], *_raster); - if (frames < 0) - frames = 0; - Pos p(frames,true); + int spos = pos[0]; + if(spos > 0) + { + spos -= 1; // Nudge by -1, then snap down with raster1. + spos = AL::sigmap.raster1(spos, *_raster); + } + if(spos < 0) + spos = 0; + Pos p(spos,true); song->setPos(0, p, true, true, true); return; } else if (key == shortcuts[SHRT_POS_INC].key) { + int spos = AL::sigmap.raster2(pos[0] + 1, *_raster); // Nudge by +1, then snap up with raster2. + Pos p(spos,true); + song->setPos(0, p, true, true, true); + return; + } + else if (key == shortcuts[SHRT_POS_DEC_NOSNAP].key) { + int spos = pos[0] - AL::sigmap.rasterStep(pos[0], *_raster); + if(spos < 0) + spos = 0; + Pos p(spos,true); + song->setPos(0, p, true, true, true); + return; + } + else if (key == shortcuts[SHRT_POS_INC_NOSNAP].key) { Pos p(pos[0] + AL::sigmap.rasterStep(pos[0], *_raster), true); - song->setPos(0, p, true, true, true); //CDW + song->setPos(0, p, true, true, true); return; } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index d419866a..4c104e0b 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -679,7 +679,11 @@ void TList::keyPressEvent(QKeyEvent* e) } } emit keyPressExt(e); //redirect keypress events to main app - e->ignore(); + + // p4.0.10 Removed by Tim. keyPressExt are sent to part canvas, where they are + // ignored *only* if necessary. + //e->ignore(); + /* int key = e->key(); switch (key) { @@ -1402,7 +1406,7 @@ void TList::setYPos(int y) // resizeEvent //--------------------------------------------------------- -void TList::resizeEvent(QResizeEvent* ev) +void TList::resizeEvent(QResizeEvent* /*ev*/) { } diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index fccf801d..936a8aa3 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -107,10 +107,10 @@ class MuseApplication : public QApplication { bool notify(QObject* receiver, QEvent* event) { //if (event->type() == QEvent::KeyPress) - // printf("notify key press before app::notify accepted:%d\n", event->isAccepted()); + // printf("notify key press before app::notify accepted:%d\n", event->isAccepted()); // REMOVE Tim bool flag = QApplication::notify(receiver, event); if (event->type() == QEvent::KeyPress) { - //printf("notify key press after app::notify accepted:%d\n", event->isAccepted()); + //printf("notify key press after app::notify accepted:%d\n", event->isAccepted()); // REMOVE Tim QKeyEvent* ke = (QKeyEvent*)event; ///globalKeyState = ke->stateAfter(); globalKeyState = ke->modifiers(); diff --git a/muse2/muse/midiedit/cmd.h b/muse2/muse/midiedit/cmd.h index abbcdcf3..8339b7ae 100644 --- a/muse2/muse/midiedit/cmd.h +++ b/muse2/muse/midiedit/cmd.h @@ -21,6 +21,8 @@ #define CMD_7 10 #define CMD_T 11 #define CMD_period 12 +#define CMD_LEFT_NOSNAP 13 +#define CMD_RIGHT_NOSNAP 14 #endif diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index a8c133e4..34622296 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -748,17 +748,40 @@ void DrumCanvas::cmd(int cmd) break; case CMD_LEFT: { - int frames = pos[0] - editor->rasterStep(pos[0]); - if (frames < 0) - frames = 0; - Pos p(frames,true); + int spos = pos[0]; + if(spos > 0) + { + spos -= 1; // Nudge by -1, then snap down with raster1. + spos = AL::sigmap.raster1(spos, editor->rasterStep(pos[0])); + } + if(spos < 0) + spos = 0; + Pos p(spos,true); song->setPos(0, p, true, true, true); } break; case CMD_RIGHT: { + int spos = AL::sigmap.raster2(pos[0] + 1, editor->rasterStep(pos[0])); // Nudge by +1, then snap up with raster2. + Pos p(spos,true); + song->setPos(0, p, true, true, true); + } + break; + case CMD_LEFT_NOSNAP: + { + int spos = pos[0] - editor->rasterStep(pos[0]); + if (spos < 0) + spos = 0; + Pos p(spos,true); + song->setPos(0, p, true, true, true); //CDW + } + break; + case CMD_RIGHT_NOSNAP: + { Pos p(pos[0] + editor->rasterStep(pos[0]), true); - song->setPos(0, p, true, true, true); + //if (p > part->tick()) + // p = part->tick(); + song->setPos(0, p, true, true, true); //CDW } break; case CMD_MODIFY_VELOCITY: diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 996608bd..0b81df68 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -79,7 +79,7 @@ class DrumCanvas : public EventCanvas { CMD_CUT, CMD_COPY, CMD_PASTE, CMD_SAVE, CMD_LOAD, CMD_RESET, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, - CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_MODIFY_VELOCITY + CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index d4940c86..80eb1b6b 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -1066,6 +1066,15 @@ void DrumEdit::keyPressEvent(QKeyEvent* event) return; } + else if (key == shortcuts[SHRT_POS_INC_NOSNAP].key) { + dc->cmd(DrumCanvas::CMD_RIGHT_NOSNAP); + return; + } + else if (key == shortcuts[SHRT_POS_DEC_NOSNAP].key) { + dc->cmd(DrumCanvas::CMD_LEFT_NOSNAP); + return; + } + else if (key == shortcuts[SHRT_TOOL_POINTER].key) { tools2->set(PointerTool); return; diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 56507466..c9c5632d 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -410,7 +410,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i canvas = new PianoCanvas(this, split1, xscale, yscale); vscroll = new ScrollScale(-3, 7, yscale, KH * 75, Qt::Vertical, split1); - setFocusProxy(canvas); // Tim. + //setFocusProxy(canvas); // Tim. int offset = -(config.division/4); canvas->setOrigin(offset, 0); @@ -1081,6 +1081,14 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) pc->pianoCmd(CMD_LEFT); return; } + else if (key == shortcuts[SHRT_POS_INC_NOSNAP].key) { + pc->pianoCmd(CMD_RIGHT_NOSNAP); + return; + } + else if (key == shortcuts[SHRT_POS_DEC_NOSNAP].key) { + pc->pianoCmd(CMD_LEFT_NOSNAP); + return; + } else if (key == shortcuts[SHRT_INSERT_AT_LOCATION].key) { pc->pianoCmd(CMD_INSERT); return; diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 9489c4ab..84e19e86 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -658,15 +658,36 @@ void PianoCanvas::pianoCmd(int cmd) switch(cmd) { case CMD_LEFT: { - int frames = pos[0] - editor->rasterStep(pos[0]); - if (frames < 0) - frames = 0; - Pos p(frames,true); - song->setPos(0, p, true, true, true); //CDW + int spos = pos[0]; + if(spos > 0) + { + spos -= 1; // Nudge by -1, then snap down with raster1. + spos = AL::sigmap.raster1(spos, editor->rasterStep(pos[0])); + } + if(spos < 0) + spos = 0; + Pos p(spos,true); + song->setPos(0, p, true, true, true); } break; case CMD_RIGHT: { + int spos = AL::sigmap.raster2(pos[0] + 1, editor->rasterStep(pos[0])); // Nudge by +1, then snap up with raster2. + Pos p(spos,true); + song->setPos(0, p, true, true, true); + } + break; + case CMD_LEFT_NOSNAP: + { + int spos = pos[0] - editor->rasterStep(pos[0]); + if (spos < 0) + spos = 0; + Pos p(spos,true); + song->setPos(0, p, true, true, true); //CDW + } + break; + case CMD_RIGHT_NOSNAP: + { Pos p(pos[0] + editor->rasterStep(pos[0]), true); //if (p > part->tick()) // p = part->tick(); diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp index 3a1f5eb9..a02b9ea4 100644 --- a/muse2/muse/shortcuts.cpp +++ b/muse2/muse/shortcuts.cpp @@ -214,8 +214,44 @@ void initShortCuts() defShrt(SHRT_TOOL_MUTE, 0, "Tool: Mute", ARRANG_SHRT, "mute_tool"); //Increase/decrease current position, is going to be in arranger & drumeditor as well + // p4.0.10 Editors and arranger handle these by themselves, otherwise global handler will now use them, too. defShrt(SHRT_POS_INC, Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase"); - defShrt(SHRT_POS_DEC, Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease"); + defShrt(SHRT_POS_DEC, Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease"); + + defShrt(SHRT_POS_INC_NOSNAP, Qt::SHIFT + Qt::Key_Plus, "Transport: Increase current position, no snap", GLOBAL_SHRT, "curpos_increase_nosnap"); + defShrt(SHRT_POS_DEC_NOSNAP, Qt::SHIFT + Qt::Key_Minus, "Transport: Increase current position, no snap", GLOBAL_SHRT, "curpos_decrease_nosnap"); + + /* + defShrt(SHRT_POS_INC_BAR, Qt::CTRL + Qt::ALT + Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_bar"); + defShrt(SHRT_POS_DEC_BAR, Qt::CTRL + Qt::ALT + Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_bar"); + defShrt(SHRT_POS_INC_BAR_NOSNAP, Qt::SHIFT + Qt::CTRL + Qt::ALT + Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_bar_nosnap"); + defShrt(SHRT_POS_DEC_BAR_NOSNAP, Qt::SHIFT + Qt::CTRL + Qt::ALT + Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_bar_nosnap"); + + defShrt(SHRT_POS_INC_BEAT, Qt::ALT + Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_beat"); + defShrt(SHRT_POS_DEC_BEAT, Qt::ALT + Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_beat"); + defShrt(SHRT_POS_INC_BEAT_NOSNAP, Qt::SHIFT + Qt::ALT + Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_beat_nosnap"); + defShrt(SHRT_POS_DEC_BEAT_NOSNAP, Qt::SHIFT + Qt::ALT + Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_beat_nosnap"); + + defShrt(SHRT_POS_INC_TICK, Qt::CTRL + Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_tick"); + defShrt(SHRT_POS_DEC_TICK, Qt::CTRL + Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_tick"); + defShrt(SHRT_POS_INC_TICK_NOSNAP, Qt::SHIFT + Qt::CTRL + Qt::Key_Plus, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_tick"); + defShrt(SHRT_POS_DEC_TICK_NOSNAP, Qt::SHIFT + Qt::CTRL + Qt::Key_Minus, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_tick"); + + defShrt(SHRT_POS_INC_FRAME, Qt::Key_N, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_frame"); + defShrt(SHRT_POS_DEC_FRAME, Qt::Key_B, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_frame"); + + defShrt(SHRT_POS_INC_SECOND, Qt::CTRL + Qt::Key_N, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_second"); + defShrt(SHRT_POS_DEC_SECOND, Qt::CTRL + Qt::Key_B, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_second"); + defShrt(SHRT_POS_INC_SECOND_NOSNAP, Qt::SHIFT + Qt::CTRL + Qt::Key_N, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_second_nosnap"); + defShrt(SHRT_POS_DEC_SECOND_NOSNAP, Qt::SHIFT + Qt::CTRL + Qt::Key_B, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_second_nosnap"); + + defShrt(SHRT_POS_INC_MINUTE, Qt::ALT + Qt::Key_N, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_minute"); + defShrt(SHRT_POS_DEC_MINUTE, Qt::ALT + Qt::Key_B, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_minute"); + defShrt(SHRT_POS_INC_MINUTE_NOSNAP, Qt::SHIFT + Qt::ALT + Qt::Key_N, "Transport: Increase current position", GLOBAL_SHRT, "curpos_increase_minute_nosnap"); + defShrt(SHRT_POS_DEC_MINUTE_NOSNAP, Qt::SHIFT + Qt::ALT + Qt::Key_B, "Transport: Decrease current position", GLOBAL_SHRT, "curpos_decrease_minute_nosnap"); + */ + + defShrt(SHRT_SET_QUANT_1, Qt::Key_1, "Quantize: Set quantize to 1/1 note", PROLL_SHRT, "midi_quant_1"); defShrt(SHRT_SET_QUANT_2, Qt::Key_2, "Quantize: Set quantize to 1/2 note", PROLL_SHRT, "midi_quant_2"); defShrt(SHRT_SET_QUANT_3, Qt::Key_3, "Quantize: Set quantize to 1/4 note", PROLL_SHRT, "midi_quant_3"); diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h index d39532de..7cd47bd5 100644 --- a/muse2/muse/shortcuts.h +++ b/muse2/muse/shortcuts.h @@ -175,7 +175,7 @@ enum { SHRT_SEL_TRACK_BELOW, SHRT_SEL_TRACK_ABOVE, - //To be in arranger, pianoroll & drumeditor + //To be in arranger, pianoroll & drumeditor. p4.0.10 now globally handled, too. SHRT_SELECT_ALL, //Ctrl+A SHRT_SELECT_NONE, //Ctrl+Shift+A SHRT_SELECT_INVERT, //Ctrl+I @@ -191,6 +191,40 @@ enum { SHRT_DEC_PITCH, SHRT_INC_POS, SHRT_DEC_POS, + + SHRT_POS_INC_NOSNAP, + SHRT_POS_DEC_NOSNAP, + + /* + SHRT_POS_INC_BAR, + SHRT_POS_DEC_BAR, + SHRT_POS_INC_BAR_NOSNAP, + SHRT_POS_DEC_BAR_NOSNAP, + + SHRT_POS_INC_BEAT, + SHRT_POS_DEC_BEAT, + SHRT_POS_INC_BEAT_NOSNAP, + SHRT_POS_DEC_BEAT_NOSNAP, + + SHRT_POS_INC_TICK, + SHRT_POS_DEC_TICK, + SHRT_POS_INC_TICK_NOSNAP, + SHRT_POS_DEC_TICK_NOSNAP, + + SHRT_POS_INC_MINUTE, + SHRT_POS_DEC_MINUTE, + SHRT_POS_INC_MINUTE_NOSNAP, + SHRT_POS_DEC_MINUTE_NOSNAP, + + SHRT_POS_INC_SECOND, + SHRT_POS_DEC_SECOND, + SHRT_POS_INC_SECOND_NOSNAP, + SHRT_POS_DEC_SECOND_NOSNAP, + + SHRT_POS_INC_FRAME, + SHRT_POS_DEC_FRAME, + */ + SHRT_LOCATORS_TO_SELECTION, //Alt+P, currently in arranger & pianoroll SHRT_INSERT_AT_LOCATION, //Shift+CrsrRight SHRT_INCREASE_LEN, diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 4feda40f..3ac818e5 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -76,7 +76,7 @@ Song::Song(const char* name) :QObject(0) { setObjectName(name); - _recRaster = 0; // Set to measure, the same as Arranger intial value. Arranger snap combo will set this. + _arrangerRaster = 0; // Set to measure, the same as Arranger intial value. Arranger snap combo will set this. noteFifoSize = 0; noteFifoWindex = 0; noteFifoRindex = 0; @@ -798,9 +798,9 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start //startTick = roundDownBar(startTick); //endTick = roundUpBar(endTick); // Round the start down using the Arranger part snap raster value. - startTick = AL::sigmap.raster1(startTick, recRaster()); + startTick = AL::sigmap.raster1(startTick, arrangerRaster()); // Round the end up using the Arranger part snap raster value. - endTick = AL::sigmap.raster2(endTick, recRaster()); + endTick = AL::sigmap.raster2(endTick, arrangerRaster()); part->setTick(startTick); part->setLenTick(endTick - startTick); @@ -835,7 +835,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start // Added by Tim. p3.3.8 // Round the end up (again) using the Arranger part snap raster value. - endTick = AL::sigmap.raster2(endTick, recRaster()); + endTick = AL::sigmap.raster2(endTick, arrangerRaster()); // Remove all of the part's port controller values. Indicate do not do clone parts. removePortCtrlEvents(part, false); diff --git a/muse2/muse/song.h b/muse2/muse/song.h index 632d60c4..90dc3205 100644 --- a/muse2/muse/song.h +++ b/muse2/muse/song.h @@ -131,7 +131,7 @@ class Song : public QObject { int _cycleMode; bool _click; bool _quantize; - int _recRaster; // Used for audio rec new part snapping. Set by Arranger snap combo box. + int _arrangerRaster; // Used for audio rec new part snapping. Set by Arranger snap combo box. unsigned _len; // song len in ticks FollowMode _follow; int _globalPitchShift; @@ -263,8 +263,8 @@ class Song : public QObject { void cmdChangePart(Part* oldPart, Part* newPart, bool doCtrls, bool doClones); void cmdRemovePart(Part* part); void cmdAddPart(Part* part); - int recRaster() { return _recRaster; } // Used by Song::cmdAddRecordedWave to snap new wave parts - void setRecRaster(int r) { _recRaster = r; } // Used by Arranger snap combo box + int arrangerRaster() { return _arrangerRaster; } // Used by Song::cmdAddRecordedWave to snap new wave parts + void setArrangerRaster(int r) { _arrangerRaster = r; } // Used by Arranger snap combo box //----------------------------------------- // track manipulations diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index b3f7b091..b519ca70 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -1078,9 +1078,9 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) return; } // Round the start down using the Arranger part snap raster value. - unsigned startTick = AL::sigmap.raster1(s.tick(), song->recRaster()); + unsigned startTick = AL::sigmap.raster1(s.tick(), song->arrangerRaster()); // Round the end up using the Arranger part snap raster value. - unsigned endTick = AL::sigmap.raster2(e.tick(), song->recRaster()); + unsigned endTick = AL::sigmap.raster2(e.tick(), song->arrangerRaster()); f->update(); diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp index ba9defa9..479f4103 100644 --- a/muse2/muse/widgets/bigtime.cpp +++ b/muse2/muse/widgets/bigtime.cpp @@ -34,6 +34,7 @@ BigTime::BigTime(QWidget* parent) fmtButton->resize(18,18); fmtButton->setChecked(true); fmtButton->setToolTip(tr("format display")); + fmtButton->setFocusPolicy(Qt::NoFocus); barLabel = new QLabel(dwin); beatLabel = new QLabel(dwin); tickLabel = new QLabel(dwin); diff --git a/muse2/muse/widgets/scrollscale.cpp b/muse2/muse/widgets/scrollscale.cpp index f279e6ce..de383deb 100644 --- a/muse2/muse/widgets/scrollscale.cpp +++ b/muse2/muse/widgets/scrollscale.cpp @@ -241,12 +241,16 @@ ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o, } scale = new QSlider (o); + // Added by Tim. For some reason focus was on. + // It messes up tabbing, and really should have a shortcut instead. + scale->setFocusPolicy(Qt::NoFocus); scale->setMinimum(0); scale->setMaximum(1024); scale->setPageStep(1); scale->setValue(cur); scroll = new QScrollBar ( o ); + //scroll->setFocusPolicy(Qt::NoFocus); // Tim. setScale ( cur ); if ( o == Qt::Horizontal ) diff --git a/muse2/muse/widgets/shortcutcapturedialog.cpp b/muse2/muse/widgets/shortcutcapturedialog.cpp index 5a76d1d9..0b2b66d2 100644 --- a/muse2/muse/widgets/shortcutcapturedialog.cpp +++ b/muse2/muse/widgets/shortcutcapturedialog.cpp @@ -15,6 +15,7 @@ #include <QKeyEvent> #include <QKeySequence> #include <QInputEvent> +#include <QChar> ShortcutCaptureDialog::ShortcutCaptureDialog(QWidget* parent, int index) : QDialog(parent) @@ -40,11 +41,19 @@ void ShortcutCaptureDialog::keyPressEvent(QKeyEvent* e) bool shift, alt, ctrl, conflict = false, realkey = false; QString msgString = ""; int temp_key; - shift = ((QInputEvent*)e)->modifiers() & Qt::ShiftModifier; - ctrl = ((QInputEvent*)e)->modifiers() & Qt::ControlModifier; - alt = ((QInputEvent*)e)->modifiers() & Qt::AltModifier; + Qt::KeyboardModifiers mods = ((QInputEvent*)e)->modifiers(); + shift = mods & Qt::ShiftModifier; + ctrl = mods & Qt::ControlModifier; + alt = mods & Qt::AltModifier; //printf("Key total: %d, alt: %d, ctrl: %d shift: %d\n",e->key(), alt, ctrl, shift); temp_key = e->key(); + + QChar keychar(temp_key); + bool ispunct = keychar.isPunct(); + bool issymbol = keychar.isSymbol(); + //printf("Key:%x, alt:%d, ctrl:%d shift:%d ispunct:%d issymbol:%d text:%s\n", + // e->key(), alt, ctrl, shift, ispunct, issymbol, e->text().toLatin1().constData()); // REMOVE Tim. + temp_key += (shift ? (int)Qt::SHIFT : 0); // (int) Tim temp_key += (ctrl ? (int)Qt::CTRL : 0); // temp_key += (alt ? (int)Qt::ALT : 0); // @@ -58,6 +67,7 @@ void ShortcutCaptureDialog::keyPressEvent(QKeyEvent* e) key = temp_key; realkey = true; QKeySequence q = QKeySequence(key); + //QKeySequence q = QKeySequence(k, mods); QString keyString = q; if (keyString != QString::null) nshrtLabel->setText(q); diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp index 5bf63dc8..31cc212e 100644 --- a/muse2/muse/widgets/view.cpp +++ b/muse2/muse/widgets/view.cpp @@ -235,7 +235,7 @@ void View::paintEvent(QPaintEvent* ev) //bitBlt(this, ev->rect().topLeft(), &pm, ev->rect(), CopyROP, true); QPainter p(this); - p.setCompositionMode(QPainter::CompositionMode_Source); + //p.setCompositionMode(QPainter::CompositionMode_Source); p.drawPixmap(ev->rect().topLeft(), pm, ev->rect()); #else |