Added select all

Fri, 03 May 2013 23:46:46 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 03 May 2013 23:46:46 +0300
changeset 155
e21c24bfcdf3
parent 154
cc53e5cbad54
child 156
d35b7e440585

Added select all

gldraw.cpp file | annotate | diff | comparison | revisions
gldraw.h file | annotate | diff | comparison | revisions
gui.cpp file | annotate | diff | comparison | revisions
gui_actions.cpp file | annotate | diff | comparison | revisions
gui_editactions.cpp file | annotate | diff | comparison | revisions
--- a/gldraw.cpp	Fri May 03 20:26:25 2013 +0300
+++ b/gldraw.cpp	Fri May 03 23:46:46 2013 +0300
@@ -359,7 +359,7 @@
 		glPushMatrix ();
 		glLoadIdentity ();
 		
-		glTranslatef (0.0f, 0.0f, -5.0f);
+		glTranslatef (0.0f, 0.0f, -2.0f);
 		glTranslatef (panX, panY, -zoom);
 		glRotatef (rotX, 1.0f, 0.0f, 0.0f);
 		glRotatef (rotY, 0.0f, 1.0f, 0.0f);
@@ -941,7 +941,10 @@
 	w = width;
 	h = height;
 	uchar* cap = new uchar[4 * w * h];
+	
+	screencapping = true;
 	update ();
+	screencapping = false;
 	
 	// Capture the pixels
 	glReadPixels (0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, cap);
--- a/gldraw.h	Fri May 03 20:26:25 2013 +0300
+++ b/gldraw.h	Fri May 03 23:46:46 2013 +0300
@@ -91,7 +91,7 @@
 	Camera m_camera;
 	vertex m_hoverpos;
 	double rotX, rotY, rotZ, panX, panY, zoom;
-	bool rangepick, addpick, drawToolTip;
+	bool rangepick, addpick, drawToolTip, screencapping;
 	QPoint pos, rangeStart;
 	QPen thinBorderPen, thickBorderPen;
 	Camera toolTipCamera;
--- a/gui.cpp	Fri May 03 20:26:25 2013 +0300
+++ b/gui.cpp	Fri May 03 23:46:46 2013 +0300
@@ -68,6 +68,7 @@
 EXTERN_ACTION (undo)
 EXTERN_ACTION (redo)
 EXTERN_ACTION (showHistory)
+EXTERN_ACTION (selectAll)
 EXTERN_ACTION (selectByColor)
 EXTERN_ACTION (selectByType)
 EXTERN_ACTION (moveXNeg)
@@ -239,6 +240,7 @@
 	qEditMenu->addAction (ACTION (paste));				// Paste
 	qEditMenu->addAction (ACTION (del));					// Delete
 	qEditMenu->addSeparator ();							// -----
+	qEditMenu->addAction (ACTION (selectAll));			// Select All
 	qEditMenu->addAction (ACTION (selectByColor));		// Select by Color
 	qEditMenu->addAction (ACTION (selectByType));		// Select by Type
 	qEditMenu->addSeparator ();							// -----
@@ -358,6 +360,7 @@
 	
 	// ==========================================
 	initSingleToolBar ("Select");
+	g_CurrentToolBar->addAction (ACTION (selectAll));
 	g_CurrentToolBar->addAction (ACTION (selectByColor));
 	g_CurrentToolBar->addAction (ACTION (selectByType));
 	
@@ -911,15 +914,24 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void ForgeWindow::spawnContextMenu (const QPoint pos) {
+	const bool single = (g_ForgeWindow->sel.size () == 1);
+	
 	QMenu* contextMenu = new QMenu;
-	contextMenu->addAction (ACTION (editObject));
-	contextMenu->addSeparator ();
+	
+	if (single) {
+		contextMenu->addAction (ACTION (editObject));
+		contextMenu->addSeparator ();
+	}
+	
 	contextMenu->addAction (ACTION (cut));
 	contextMenu->addAction (ACTION (copy));
 	contextMenu->addAction (ACTION (paste));
 	contextMenu->addAction (ACTION (del));
-	
-	ACTION (editObject)->setEnabled (g_ForgeWindow->sel.size () == 1);
+	contextMenu->addSeparator ();
+	contextMenu->addAction (ACTION (setColor));
+	if (single)
+		contextMenu->addAction (ACTION (setContents));
+	contextMenu->addAction (ACTION (makeBorders));
 	
 	contextMenu->exec (pos);
 }
--- a/gui_actions.cpp	Fri May 03 20:26:25 2013 +0300
+++ b/gui_actions.cpp	Fri May 03 23:46:46 2013 +0300
@@ -183,6 +183,16 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
+MAKE_ACTION (selectAll, "Select All", "select-all", "Selects all objects.", CTRL (A)) {
+	g_ForgeWindow->sel.clear ();
+	
+	for (LDObject* obj : g_CurrentFile->objects)
+		g_ForgeWindow->sel.push_back (obj);
+	
+	g_ForgeWindow->updateSelection ();
+}
+
+// =============================================================================
 MAKE_ACTION (selectByColor, "Select by Color", "select-color",
 	"Select all objects by the given color.", CTRL_SHIFT (A))
 {
@@ -199,6 +209,7 @@
 	g_ForgeWindow->updateSelection ();
 }
 
+// =============================================================================
 MAKE_ACTION (selectByType, "Select by Type", "select-type",
 	"Select all objects by the given type.", (0))
 {
--- a/gui_editactions.cpp	Fri May 03 20:26:25 2013 +0300
+++ b/gui_editactions.cpp	Fri May 03 23:46:46 2013 +0300
@@ -661,7 +661,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-MAKE_ACTION (uncolorize, "Uncolorize", "uncolorize", "Reduce colors from everything selected to main and edge colors", (0)) {
+MAKE_ACTION (uncolorize, "Uncolorize", "uncolorize", "Reduce colors of everything selected to main and edge colors", (0)) {
 	vector<LDObject*> oldCopies, newCopies;
 	vector<ulong> indices;
 	

mercurial