diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-09 16:33:22 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-09 16:33:22 +0000 |
commit | 3793e801b3116509fadd853e158b522a65fb6d22 (patch) | |
tree | b754aa39e12f8b8e55543f9af1d655a117d0b65a /muse2/muse | |
parent | a3670594c5a3c5a7053dd8bd8280b7c2b20cefbe (diff) |
swapped ctrl and shift for selecting stuff
-> made muse's behaviour according to common standards
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 10 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 10 | ||||
-rw-r--r-- | muse2/muse/ctrl/ctrlcanvas.cpp | 24 | ||||
-rw-r--r-- | muse2/muse/midiedit/dcanvas.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/midiedit/dlist.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/midiedit/pianoroll.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/shortcuts.h | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/canvas.cpp | 29 |
8 files changed, 34 insertions, 52 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 35de93ee..599e90a0 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -231,9 +231,9 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) } QPoint cpos = event->pos(); curItem = items.find(cpos); - bool shift = event->modifiers() & Qt::ShiftModifier; + bool ctrl = event->modifiers() & Qt::ControlModifier; if (curItem) { - if (event->button() == Qt::LeftButton && shift) { + if (event->button() == Qt::LeftButton && ctrl) { editPart = (NPart*)curItem; QRect r = map(curItem->bbox()); if (lineEditor == 0) { @@ -1002,7 +1002,7 @@ void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt) void PartCanvas::mousePress(QMouseEvent* event) { - if (event->modifiers() & Qt::ShiftModifier) { + if (event->modifiers() & Qt::ControlModifier) { return; } QPoint pt = event->pos(); @@ -1059,7 +1059,7 @@ void PartCanvas::mouseMove(QMouseEvent* event) x = 0; if (_tool == AutomationTool) - processAutomationMovements(event->pos(), event->modifiers() & Qt::ControlModifier); + processAutomationMovements(event->pos(), event->modifiers() & Qt::ShiftModifier); emit timeChanged(AL::sigmap.raster(x, *_raster)); } @@ -1665,7 +1665,7 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) // pr - part rectangle //--------------------------------------------------------- -void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) +void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) { //printf("x=%d y=%d h=%d w=%d\n",r.x(),r.y(),r.height(),r.width()); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index b907b555..2a397a4e 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -348,7 +348,7 @@ void TList::paint(const QRect& r) if (cl->isVisible()) countVisible++; } - int count = ((AudioTrack*)track)->controller()->size(); + //int count = ((AudioTrack*)track)->controller()->size(); //commented out by flo: gives a "unused variable" warning s.sprintf(" %d(%d) visible",countVisible, countAll); } @@ -914,7 +914,7 @@ void TList::mousePressEvent(QMouseEvent* ev) int x = ev->x(); int y = ev->y(); int button = ev->button(); - bool shift = ((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier; + bool ctrl = ((QInputEvent*)ev)->modifiers() & Qt::ControlModifier; Track* t = y2Track(y + ypos); @@ -1152,7 +1152,7 @@ void TList::mousePressEvent(QMouseEvent* ev) break; case COL_MUTE: // p3.3.29 - if ((button == Qt::RightButton) || (((QInputEvent*)ev)->modifiers() & Qt::ControlModifier)) + if ((button == Qt::RightButton) || (((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier)) t->setOff(!t->off()); else { @@ -1170,7 +1170,7 @@ void TList::mousePressEvent(QMouseEvent* ev) case COL_NAME: if (button == Qt::LeftButton) { - if (!shift) { + if (!ctrl) { song->deselectTracks(); t->setSelected(true); @@ -1463,7 +1463,7 @@ void TList::wheelEvent(QWheelEvent* ev) break; case COL_MUTE: // p3.3.29 - if (((QInputEvent*)ev)->modifiers() & Qt::ControlModifier) + if (((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier) t->setOff(!t->off()); else { diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 56f19384..5e97ed90 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -743,7 +743,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) start = event->pos(); Tool activeTool = tool; - bool shift = event->modifiers() & Qt::ShiftModifier; + bool ctrlKey = event->modifiers() & Qt::ControlModifier; int xpos = start.x(); int ypos = start.y(); @@ -755,7 +755,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) { bool do_redraw = false; - if (!shift) + if (!ctrlKey) { deselectAll(); do_redraw = true; @@ -780,7 +780,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; if (ev->intersects(_controller, r, tickstep, h)) { - if (shift && ev->selected()) + if (ctrlKey && ev->selected()) deselectItem(ev); else selectItem(ev); @@ -797,7 +797,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; case PencilTool: - if (shift) { + if (ctrlKey) { if (type != MidiController::Velo) { drag = DRAG_NEW; song->startUndo(); @@ -824,7 +824,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) if (drawLineMode) { line2x = xpos; line2y = ypos; - if (shift) + if (ctrlKey) newValRamp(line1x, line1y, line2x, line2y); else changeValRamp(line1x, line1y, line2x, line2y); @@ -899,7 +899,7 @@ void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event) void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) { - bool shift = event->modifiers() & Qt::ShiftModifier; + bool ctrlKey = event->modifiers() & Qt::ControlModifier; switch (drag) { ///case DRAG_RESIZE: @@ -922,7 +922,7 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) case DRAG_LASSO: { - ///if (!shift) + ///if (!ctrlKey) /// deselectAll(); lasso = lasso.normalized(); int h = height(); @@ -932,9 +932,9 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) if((*i)->part() != curPart) continue; if ((*i)->intersects(_controller, lasso, tickstep, h)) { - if (shift && (*i)->selected()) + if (ctrlKey && (*i)->selected()) { - //if (!shift) // Shift p4.0.18 + //if (!ctrlKey) // ctrlKey p4.0.18 { ///deselectItem(*i); //do_redraw = true; @@ -2211,8 +2211,8 @@ void CtrlCanvas::drawOverlay(QPainter& p) if (noEvents) { //p.setFont(config.fonts[3]); //p.setPen(Qt::black); - //p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events"); - p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events"); + //p.drawText(width()/2-100,height()/2-10, "Use ctrlKey + pencil or line tool to draw new events"); + p.drawText(2 , y * 2, "Use ctrlKey + pencil or line tool to draw new events"); } } @@ -2232,7 +2232,7 @@ QRect CtrlCanvas::overlayRect() const r.translate(2, y); if (noEvents) { - QRect r2(fm.boundingRect(QString("Use shift + pencil or line tool to draw new events"))); + QRect r2(fm.boundingRect(QString("Use ctrlKey + pencil or line tool to draw new events"))); //r2.translate(width()/2-100, height()/2-10); r2.translate(2, y * 2); r |= r2; diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 9c50c8b2..a21f04c0 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -1352,13 +1352,10 @@ void DrumCanvas::keyPress(QKeyEvent* event) if (_tool == CursorTool) { int key = event->key(); - ///if (event->state() & Qt::ShiftButton) if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; - ///if (event->state() & Qt::AltButton) if (((QInputEvent*)event)->modifiers() & Qt::AltModifier) key += Qt::ALT; - ///if (event->state() & Qt::ControlButton) if (((QInputEvent*)event)->modifiers() & Qt::ControlModifier) key+= Qt::CTRL; diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 3736d6aa..3b8670db 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -220,8 +220,6 @@ void DList::viewMousePressEvent(QMouseEvent* ev) int x = ev->x(); int y = ev->y(); int button = ev->button(); - ///bool shift = ev->state() & Qt::ShiftButton; - //bool shift = ev->modifiers() & Qt::ShiftModifier; unsigned pitch = y / TH; DrumMap* dm = &drumMap[pitch]; @@ -259,7 +257,6 @@ void DList::viewMousePressEvent(QMouseEvent* ev) break; case COL_PORT: if (button == Qt::RightButton) { - ///bool changeAll = ev->state() & Qt::ControlButton; bool changeAll = ev->modifiers() & Qt::ControlModifier; devicesPopupMenu(dm, mapx(x), mapy(pitch * TH), changeAll); } @@ -328,7 +325,6 @@ void DList::viewMousePressEvent(QMouseEvent* ev) else if (val > 127) val = 127; - ///if (ev->state() & Qt::ControlButton) { if (ev->modifiers() & Qt::ControlModifier) { audio->msgIdle(true); // Delete all port controller events. @@ -724,7 +720,6 @@ void DList::viewMouseReleaseEvent(QMouseEvent* ev) editor->setFocus(); int x = ev->x(); int y = ev->y(); - ///bool shift = ev->state() & Qt::ShiftButton; bool shift = ev->modifiers() & Qt::ShiftModifier; unsigned pitch = y / TH; diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index d008b35f..6b0e37cb 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -1045,13 +1045,10 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) PianoCanvas* pc = (PianoCanvas*)canvas; int key = event->key(); - //if (event->state() & Qt::ShiftButton) if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; - //if (event->state() & Qt::AltButton) if (((QInputEvent*)event)->modifiers() & Qt::AltModifier) key += Qt::ALT; - //if (event->state() & Qt::ControlButton) if (((QInputEvent*)event)->modifiers() & Qt::ControlModifier) key+= Qt::CTRL; diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h index 1098be49..ede91d22 100644 --- a/muse2/muse/shortcuts.h +++ b/muse2/muse/shortcuts.h @@ -22,7 +22,7 @@ #define DEDIT_SHRT 2 // Drumedit shortcut #define LEDIT_SHRT 4 // Listedit shortcut #define SCORE_SHRT 8 // Score shortcut -#define ARRANG_SHRT 16 // Arrenger shortcut +#define ARRANG_SHRT 16 // Arranger shortcut #define TRANSP_SHRT 32 // Transport shortcut #define WAVE_SHRT 64 // Waveedit shortcut #define GLOBAL_SHRT 128 // Global shortcuts diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index 14f414b7..c12ac956 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -538,11 +538,11 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) updateSelection(); redraw(); } - startDrag(curItem, shift); + startDrag(curItem, ctrl); } else if (event->button() == Qt::RightButton) { if (curItem) { - if (shift) { + if (ctrl) { drag = DRAG_RESIZE; setCursor(); int dx = start.x() - curItem->x(); @@ -586,15 +586,14 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) // Changed by T356. Alt is default reserved for moving the whole window in KDE. Changed to Shift-Alt. // Hmm, nope, shift-alt is also reserved sometimes. Must find a way to bypass, // why make user turn off setting? Left alone for now... - if (shift && !ctrl) + if (ctrl && !shift) drag = DRAG_COPY_START; else if (alt) { drag = DRAG_CLONE_START; } - else if (ctrl) { //Select all on the same pitch (e.g. same y-value) - if (!shift) + else if (shift) { //Select all on the same pitch (e.g. same y-value) + if (!ctrl) deselectAll(); - //printf("Yes, ctrl and press\n"); for (iCItem i = items.begin(); i != items.end(); ++i) { if (i->second->y() == curItem->y() ) selectItem(i->second, true); @@ -1046,32 +1045,26 @@ void Canvas::viewMouseMoveEvent(QMouseEvent* event) void Canvas::viewMouseReleaseEvent(QMouseEvent* event) { -// printf("release %x %x\n", event->state(), event->button()); - doScroll = false; canScrollLeft = true; canScrollRight = true; canScrollUp = true; canScrollDown = true; - ///if (event->state() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) { if (event->buttons() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) { - ///printf("ignore %x %x\n", keyState, event->button()); - //printf("viewMouseReleaseEvent ignore buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button()); return; } QPoint pos = event->pos(); - ///bool shift = event->state() & Qt::ShiftModifier; - bool shift = ((QInputEvent*)event)->modifiers() & Qt::ShiftModifier; + bool ctrl = ((QInputEvent*)event)->modifiers() & Qt::ControlModifier; bool redrawFlag = false; switch (drag) { case DRAG_MOVE_START: case DRAG_COPY_START: case DRAG_CLONE_START: - if (!shift) + if (!ctrl) deselectAll(); - selectItem(curItem, !(shift && curItem->isSelected())); + selectItem(curItem, !(ctrl && curItem->isSelected())); updateSelection(); redrawFlag = true; itemReleased(curItem, curItem->pos()); @@ -1114,17 +1107,17 @@ void Canvas::viewMouseReleaseEvent(QMouseEvent* event) break; case DRAG_LASSO_START: lasso.setRect(-1, -1, -1, -1); - if (!shift) + if (!ctrl) deselectAll(); updateSelection(); redrawFlag = true; break; case DRAG_LASSO: - if (!shift) + if (!ctrl) deselectAll(); lasso = lasso.normalized(); - selectLasso(shift); + selectLasso(ctrl); updateSelection(); redrawFlag = true; break; |