[qet] [2907] Basic Shapes: Added Delete shape (not from keyboard DEL)

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


Revision: 2907
Author:   abhishekm71
Date:     2014-03-06 15:04:19 +0100 (Thu, 06 Mar 2014)
Log Message:
-----------
Basic Shapes: Added Delete shape (not from keyboard DEL)

Modified Paths:
--------------
    trunk/sources/diagram.cpp
    trunk/sources/diagramcommands.cpp
    trunk/sources/diagramcontent.h
    trunk/sources/qetdiagrameditor.cpp

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2014-03-03 17:31:45 UTC (rev 2906)
+++ trunk/sources/diagram.cpp	2014-03-06 14:04:19 UTC (rev 2907)
@@ -1277,6 +1277,8 @@
 			}
 		} else if (DiagramImageItem *dii = qgraphicsitem_cast<DiagramImageItem *>(item)) {
 			dc.images << dii;
+		} else if (QetShapeItem *dsi = qgraphicsitem_cast<QetShapeItem *>(item)) {
+			dc.shapes << dsi;
 		}
 	}
 	

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2014-03-03 17:31:45 UTC (rev 2906)
+++ trunk/sources/diagramcommands.cpp	2014-03-06 14:04:19 UTC (rev 2907)
@@ -260,6 +260,10 @@
 	foreach(DiagramImageItem *dii, removed_content.images) {
 		diagram -> addItem(dii);
 	}
+
+	foreach(QetShapeItem *dsi, removed_content.shapes) {
+		diagram -> addItem(dsi);
+	}
 }
 
 /// refait les suppressions
@@ -284,6 +288,11 @@
 	foreach(DiagramImageItem *dii, removed_content.images) {
 		diagram -> removeItem(dii);
 	}
+
+	//enleve les shapes
+	foreach(QetShapeItem *dsi, removed_content.shapes) {
+		diagram -> removeItem(dsi);
+	}
 }
 
 /**

Modified: trunk/sources/diagramcontent.h
===================================================================
--- trunk/sources/diagramcontent.h	2014-03-03 17:31:45 UTC (rev 2906)
+++ trunk/sources/diagramcontent.h	2014-03-06 14:04:19 UTC (rev 2907)
@@ -50,7 +50,7 @@
 		AnyConductor = 56,
 		Shapes = 64,
 		All = 127,
-		SelectedOnly = 128,
+		SelectedOnly = 128
 	};
 	
 	/// Hold electrical elements

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2014-03-03 17:31:45 UTC (rev 2906)
+++ trunk/sources/qetdiagrameditor.cpp	2014-03-06 14:04:19 UTC (rev 2907)
@@ -1226,8 +1226,10 @@
 
 	// actions need only one editable item
 	int selected_image = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Images) : 0;
-	int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts) + selected_image;
 
+	int selected_shape = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Shapes) : 0;
+	int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts) + selected_image + selected_shape;
+
 	if (selected_editable == 1) {
 		edit_selection -> setEnabled(true);
 		//edit element


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