[qet] [3359] Conductor: when delete conductor, if option one text/ folio is enable, and the curent conductor own the displayed text,

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3359
Author:   blacksun
Date:     2014-10-06 10:33:17 +0200 (Mon, 06 Oct 2014)
Log Message:
-----------
Conductor: when delete conductor, if option one text/folio is enable, and the curent conductor own the displayed text,
We upate other conductor text item at the same potential, to keep text always visible.

Modified Paths:
--------------
    trunk/sources/diagramcommands.cpp

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2014-10-05 23:18:31 UTC (rev 3358)
+++ trunk/sources/diagramcommands.cpp	2014-10-06 08:33:17 UTC (rev 3359)
@@ -267,30 +267,46 @@
 	}
 }
 
-/// refait les suppressions
+/**
+ * @brief DeleteElementsCommand::redo
+ * Redo the delete command
+ */
 void DeleteElementsCommand::redo() {
 	diagram -> showMe();
-	// enleve les conducteurs
+
+	// Remove Conductor
 	foreach(Conductor *c, removed_content.conductors(DiagramContent::AnyConductor)) {
 		diagram -> removeConductor(c);
+
+		//If option one text per folio is enable, and the text item of
+		//current conductor is visible (that mean the conductor own the single displayed text)
+		//We call adjustTextItemPosition to other conductor at the same potential to keep
+		//a visible text on this potential.
+		if (diagram -> defaultConductorProperties.m_one_text_per_folio && c -> textItem() -> isVisible()) {
+			QList <Conductor *> conductor_list;
+			conductor_list << c -> relatedPotentialConductors(false).toList();
+			if (conductor_list.count()) {
+				conductor_list.first() -> adjustTextItemPosition();
+			}
+		}
 	}
 	
-	// enleve les elements
+	// Remove elements
 	foreach(Element *e, removed_content.elements) {
 		diagram -> removeElement(e);
 	}
 	
-	// enleve les textes
+	// Remove texts
 	foreach(IndependentTextItem *t, removed_content.textFields) {
 		diagram -> removeIndependentTextItem(t);
 	}
 
-	//enleve les images
+	// Remove images
 	foreach(DiagramImageItem *dii, removed_content.images) {
 		diagram -> removeItem(dii);
 	}
 
-	//enleve les shapes
+	// Remove shapes
 	foreach(QetShapeItem *dsi, removed_content.shapes) {
 		diagram -> removeItem(dsi);
 	}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/