Also allow objects to be edited by double-click in the viewport

Thu, 13 Jun 2013 16:33:17 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 13 Jun 2013 16:33:17 +0300
changeset 285
836e77323ab0
parent 284
8d6d9cf9e8b9
child 286
7a562bf3d829

Also allow objects to be edited by double-click in the viewport

changelog.txt file | annotate | diff | comparison | revisions
src/gldraw.cpp file | annotate | diff | comparison | revisions
src/gldraw.h file | annotate | diff | comparison | revisions
--- a/changelog.txt	Thu Jun 13 16:17:58 2013 +0300
+++ b/changelog.txt	Thu Jun 13 16:33:17 2013 +0300
@@ -8,14 +8,14 @@
 - Added an export to file action, moved it + insert from to File menu
 - Parts are now zoomed to fit properly, making the initial view of the part clearer.
 - Replace coords: allow replacing all coords regardless of original value, plus relative moving (offset)
-- Objects can now be edited by double-clicking on them in the object list view.
+- Objects can now be edited by double-clicking on them.
 - Changed default keys for Y-axis moving from PgUp/PgDown to Home and End ala MLCAD.
 - Added a progress box for file loading to respond to desktops while loading files. With large files
 	the no-response policy could be a bad thing.
+- Fixed: Recent files should behave coherently now.
 - Fixed: text editing did not trigger checks while setting LDraw path, removed the Configure
 	button from the LDraw path config dialog, it's no longer needed.
 - Fixed: Coordinates weren't drawn properly on a bright background (was always drawn in bright colors..).
-- Fixed: Recent files should behave coherently now.
 - Renamed "Set Contents" into "Edit LDraw Code", should be clearer
 - The dialog box for setting a comment's text is now a lot wider
 - Calculated coordinates are now rounded down (to prevent stuff like Z:160.000001)
--- a/src/gldraw.cpp	Thu Jun 13 16:17:58 2013 +0300
+++ b/src/gldraw.cpp	Thu Jun 13 16:33:17 2013 +0300
@@ -34,6 +34,7 @@
 #include "misc.h"
 #include "history.h"
 #include "dialogs.h"
+#include "addObjectDialog.h"
 
 static const struct staticCameraMeta {
 	const char glrotate[3];
@@ -1588,4 +1589,15 @@
 	m_rectverts[2][ay] = v1[ay];
 	m_rectverts[3][ax] = v0[ax];
 	m_rectverts[3][ay] = v1[ay];
+}
+
+void GLRenderer::mouseDoubleClickEvent (QMouseEvent* ev) {
+	pick (ev->x (), ev->y ());
+	
+	if (g_win->sel ().size () == 0)
+		return;
+	
+	LDObject* obj = g_win->sel ()[0];
+	AddObjectDialog::staticDialog (obj->getType (), obj);
+	ev->accept ();
 }
\ No newline at end of file
--- a/src/gldraw.h	Thu Jun 13 16:17:58 2013 +0300
+++ b/src/gldraw.h	Thu Jun 13 16:33:17 2013 +0300
@@ -94,17 +94,18 @@
 	static void    deleteLists         (LDObject* obj);
 
 protected:
-	void           contextMenuEvent    (QContextMenuEvent* ev);
-	void           initializeGL        ();
-	void           keyPressEvent       (QKeyEvent* ev);
-	void           keyReleaseEvent     (QKeyEvent* ev);
-	void           leaveEvent          (QEvent* ev);
-	void           mousePressEvent     (QMouseEvent* ev);
-	void           mouseMoveEvent      (QMouseEvent* ev);
-	void           mouseReleaseEvent   (QMouseEvent* ev);
-	void           paintEvent          (QPaintEvent* ev);
-	void           resizeGL            (int w, int h);
-	void           wheelEvent          (QWheelEvent* ev);
+	void           contextMenuEvent      (QContextMenuEvent* ev);
+	void           initializeGL          ();
+	void           keyPressEvent         (QKeyEvent* ev);
+	void           keyReleaseEvent       (QKeyEvent* ev);
+	void           leaveEvent            (QEvent* ev);
+	void           mouseDoubleClickEvent (QMouseEvent* ev);
+	void           mousePressEvent       (QMouseEvent* ev);
+	void           mouseMoveEvent        (QMouseEvent* ev);
+	void           mouseReleaseEvent     (QMouseEvent* ev);
+	void           paintEvent            (QPaintEvent* ev);
+	void           resizeGL              (int w, int h);
+	void           wheelEvent            (QWheelEvent* ev);
 
 private:
 	QTimer* m_toolTipTimer;
@@ -136,13 +137,13 @@
 	void           compileVertex        (const vertex& vrt);                     // Compile a single vertex to a list
 	vertex         coordconv2_3         (const QPoint& pos2d, bool snap) const;  // Convert a 2D point to a 3D point
 	QPoint         coordconv3_2         (const vertex& pos3d) const;             // Convert a 3D point to a 2D point
-	void           buildKnownVertBlips ();
+	void           buildKnownVertBlips  ();
 	void           updateRectVerts      ();
 	void           pick                 (uint mouseX, uint mouseY);              // Perform object selection
 	void           setObjectColor       (LDObject* obj, const ListType list);    // Set the color to an object list
 	
 private slots:
-	void	slot_toolTipTimer	();
+	void           slot_toolTipTimer    ();
 };
 
 // Alias for short namespaces

mercurial