# HG changeset patch # User Santeri Piippo # Date 1371130397 -10800 # Node ID 836e77323ab0140efac81c31a2ff9ac20c4b84c3 # Parent 8d6d9cf9e8b93761f7e0c02ed2f79fa278b7b51a Also allow objects to be edited by double-click in the viewport diff -r 8d6d9cf9e8b9 -r 836e77323ab0 changelog.txt --- 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) diff -r 8d6d9cf9e8b9 -r 836e77323ab0 src/gldraw.cpp --- 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 diff -r 8d6d9cf9e8b9 -r 836e77323ab0 src/gldraw.h --- 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