diff options
author | Florian Jung <flo@windfisch.org> | 2013-08-20 17:31:43 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2013-08-20 17:31:43 +0200 |
commit | 02cba3c0588040450531b7d41690e31f4412be78 (patch) | |
tree | aaad063cf1d2f3795185706a4426fc4c7b7c3b62 /muse2/muse/arranger/pcanvas.cpp | |
parent | 6204579f625a34cc0a70e09aa868f8e0edafea7e (diff) |
Event/Part selection now via UndoOp::Select*
additionally:
added Song::applyOperation()
removed unused param from (un)chainTrackParts
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
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; |