diff options
author | Florian Jung <flo@windfisch.org> | 2011-06-10 13:48:16 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-06-10 13:48:16 +0000 |
commit | 2f4a98c62adf7241944ea7949d4b6a50d4b4af36 (patch) | |
tree | 6f80f42c6e598e010810a844bbcd58418c1206db /muse2/muse | |
parent | c6f2151b1589c91292563a1b319cdbd193834d67 (diff) |
fixed problem with forbidden notes (see previous commit)
shift now also selects all items on the same pitch when ctrl is pressed
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/midiedit/prcanvas.cpp | 9 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 1 | ||||
-rw-r--r-- | muse2/muse/widgets/canvas.cpp | 23 |
3 files changed, 18 insertions, 15 deletions
diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index db42be6c..11a142e1 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -492,8 +492,10 @@ void PianoCanvas::newItem(CItem* item, bool noSnap) printf("newItem: extending\n"); } } - //FINDMICH TODO: forbid action! this is currently wrong! + //else forbid action by not applying it song->applyOperationGroup(operations); + songChanged(SC_EVENT_INSERTED); //this forces an update of the itemlist, which is neccessary + //to remove "forbidden" events from the list again } //--------------------------------------------------------- @@ -533,9 +535,10 @@ void PianoCanvas::resizeItem(CItem* item, bool noSnap, bool) // experime schedule_resize_all_same_len_clone_parts(part, event.tick()+len, operations); printf("resizeItem: extending\n");} } - //FINDMICH TODO: forbid action! this is currently wrong! + //else forbid action by not performing it song->applyOperationGroup(operations); - + songChanged(SC_EVENT_MODIFIED); //this forces an update of the itemlist, which is neccessary + //to remove "forbidden" events from the list again } //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index f7d9237b..c14c14fd 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4452,7 +4452,6 @@ void staff_t::update_part_indices() /* BUGS and potential bugs - * o when the keymap is not used, this will probably lead to a bug * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index 9025590a..a74e8a8f 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -525,7 +525,6 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) //printf("viewMousePressEvent ignoring buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button()); return; } - bool shift = keyState & Qt::ShiftModifier; bool alt = keyState & Qt::AltModifier; bool ctrl = keyState & Qt::ControlModifier; start = event->pos(); @@ -624,15 +623,6 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) else if (alt) { drag = DRAG_CLONE_START; } - else if (shift) { //Select all on the same pitch (e.g. same y-value) - deselectAll(); - for (iCItem i = items.begin(); i != items.end(); ++i) { - if (i->second->y() == curItem->y() ) - selectItem(i->second, true); - } - updateSelection(); - redraw(); - } else drag = DRAG_MOVE_START; } @@ -1088,6 +1078,7 @@ void Canvas::viewMouseReleaseEvent(QMouseEvent* event) QPoint pos = event->pos(); bool ctrl = ((QInputEvent*)event)->modifiers() & Qt::ControlModifier; + bool shift = ((QInputEvent*)event)->modifiers() & Qt::ShiftModifier; bool redrawFlag = false; switch (drag) { @@ -1096,7 +1087,17 @@ void Canvas::viewMouseReleaseEvent(QMouseEvent* event) case DRAG_CLONE_START: if (!ctrl) deselectAll(); - selectItem(curItem, !(ctrl && curItem->isSelected())); + + if (!shift) { //Select or deselect only the clicked item + selectItem(curItem, !(ctrl && curItem->isSelected())); + } + else { //Select or deselect all on the same pitch (e.g. same y-value) + bool selectionFlag = !(ctrl && curItem->isSelected()); + for (iCItem i = items.begin(); i != items.end(); ++i) + if (i->second->y() == curItem->y() ) + selectItem(i->second, selectionFlag); + } + updateSelection(); redrawFlag = true; itemReleased(curItem, curItem->pos()); |