From 02cba3c0588040450531b7d41690e31f4412be78 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 20 Aug 2013 17:31:43 +0200 Subject: Event/Part selection now via UndoOp::Select* additionally: added Song::applyOperation() removed unused param from (un)chainTrackParts --- muse2/muse/arranger/pcanvas.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'muse2/muse/arranger/pcanvas.cpp') diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 91c0df5e..fde31c08 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -484,14 +484,23 @@ void PartCanvas::partsChanged() //--------------------------------------------------------- void PartCanvas::updateSelection() - { +{ + Undo operations; + bool changed=false; for (iCItem i = items.begin(); i != items.end(); ++i) { NPart* part = (NPart*)(i->second); - part->part()->setSelected(i->second->isSelected()); + operations.push_back(UndoOp(UndoOp::SelectPart, part->part(), i->second->isSelected(), part->part()->selected())); + if (i->second->isSelected() != part->part()->selected()) + changed=true; } - emit selectionChanged(); - redraw(); + + if (changed) + { + MusEGlobal::song->applyOperationGroup(operations); + emit selectionChanged(); + redraw(); } +} //--------------------------------------------------------- // resizeItem @@ -886,13 +895,14 @@ void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt) // The loop is a safety net. MusECore::Part* p = part; + Undo operations; if(part->hasClones()) { - p->setSelected(true); + operations.push_back(UndoOp(UndoOp::SelectPart, p, true, p->selected())); for(MusECore::Part* it = p->nextClone(); it!=p; it=it->nextClone()) - it->setSelected(true); + operations.push_back(UndoOp(UndoOp::SelectPart, it, true, it->selected())); - MusEGlobal::song->update(SC_SELECTION); + MusEGlobal::song->applyOperationGroup(operations); } break; -- cgit v1.2.3