[qet] [2476] improve the copy/paste of DiagramImageItem |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2476
Author: blacksun
Date: 2013-09-02 14:30:28 +0200 (Mon, 02 Sep 2013)
Log Message:
-----------
improve the copy/paste of DiagramImageItem
Modified Paths:
--------------
trunk/sources/diagramcommands.cpp
Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp 2013-09-01 07:28:14 UTC (rev 2475)
+++ trunk/sources/diagramcommands.cpp 2013-09-02 12:30:28 UTC (rev 2476)
@@ -252,7 +252,7 @@
QUndoCommand(parent),
content(c),
diagram(dia),
- filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::ConductorsToMove),
+ filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove),
first_redo(true)
{
@@ -274,32 +274,39 @@
/// annule le coller
void PasteDiagramCommand::undo() {
- // enleve les conducteurs
+ // remove the conductors
foreach(Conductor *c, content.conductorsToMove) diagram -> removeConductor(c);
- // enleve les elements
+ // remove the elements
foreach(Element *e, content.elements) diagram -> removeElement(e);
- // enleve les textes
+ // remove the texts
foreach(IndependentTextItem *t, content.textFields) diagram -> removeIndependentTextItem(t);
+
+ // remove the images
+ foreach(DiagramImageItem *dii, content.images) diagram -> removeItem(dii);
}
/// refait le coller
void PasteDiagramCommand::redo() {
if (first_redo) first_redo = false;
else {
- // pose les elements
+ // paste the elements
foreach(Element *e, content.elements) diagram -> addElement(e);
- // pose les conducteurs
+ // paste the conductors
foreach(Conductor *c, content.conductorsToMove) diagram -> addConductor(c);
- // pose les textes
+ // paste the texts
foreach(IndependentTextItem *t, content.textFields) diagram -> addIndependentTextItem(t);
+
+ // paste the images
+ foreach(DiagramImageItem *dii, content.images) diagram -> addDiagramImageItem(dii);
}
foreach(Element *e, content.elements) e -> setSelected(true);
foreach(Conductor *c, content.conductorsToMove) c -> setSelected(true);
foreach(IndependentTextItem *t, content.textFields) t -> setSelected(true);
+ foreach(DiagramImageItem *dii, content.images) dii -> setSelected(true);
}
/**