From 2f4a98c62adf7241944ea7949d4b6a50d4b4af36 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Fri, 10 Jun 2011 13:48:16 +0000 Subject: fixed problem with forbidden notes (see previous commit) shift now also selects all items on the same pitch when ctrl is pressed --- muse2/muse/midiedit/prcanvas.cpp | 9 ++++++--- muse2/muse/midiedit/scoreedit.cpp | 1 - muse2/muse/widgets/canvas.cpp | 23 ++++++++++++----------- 3 files changed, 18 insertions(+), 15 deletions(-) (limited to 'muse2') 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()); -- cgit v1.2.3