Thu, 13 Jun 2013 16:16:55 +0300
Objects can now be edited by double-clicking on them in the object list view
changelog.txt | file | annotate | diff | comparison | revisions | |
src/gui.cpp | file | annotate | diff | comparison | revisions | |
src/gui.h | file | annotate | diff | comparison | revisions | |
src/gui_editactions.cpp | file | annotate | diff | comparison | revisions |
--- a/changelog.txt Thu Jun 13 14:00:34 2013 +0300 +++ b/changelog.txt Thu Jun 13 16:16:55 2013 +0300 @@ -8,6 +8,7 @@ - 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. - 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: text editing did not trigger checks while setting LDraw path, removed the Configure
--- a/src/gui.cpp Thu Jun 13 14:00:34 2013 +0300 +++ b/src/gui.cpp Thu Jun 13 16:16:55 2013 +0300 @@ -39,6 +39,7 @@ #include "colors.h" #include "history.h" #include "widgets.h" +#include "addObjectDialog.h" #include "config.h" actionmeta g_actionMeta[MAX_ACTIONS]; @@ -71,6 +72,7 @@ m_objList->setSelectionMode (QListWidget::ExtendedSelection); m_objList->setAlternatingRowColors (true); connect (m_objList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ())); + connect (m_objList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (slot_editObject (QListWidgetItem*))); m_splitter = new QSplitter; m_splitter->addWidget (m_renderer); @@ -944,7 +946,7 @@ contextMenu->exec (pos); } -// ======================================================================================================================================== +// ============================================================================= void ForgeWindow::deleteObjVector (vector<LDObject*> objs) { for (LDObject* obj : objs) { g_curfile->forgetObject (obj); @@ -952,7 +954,7 @@ } } -// ======================================================================================================================================== +// ============================================================================= void ForgeWindow::deleteByColor (const short colnum) { vector<LDObject*> objs; for (LDObject* obj : g_curfile->objs ()) { @@ -965,7 +967,7 @@ deleteObjVector (objs); } -// ======================================================================================================================================== +// ============================================================================= void ForgeWindow::updateEditModeActions () { const EditMode mode = R ()->editMode (); const size_t numModeActions = (sizeof g_modeActionNames / sizeof *g_modeActionNames); @@ -982,7 +984,19 @@ } } -// ======================================================================================================================================== +void ForgeWindow::slot_editObject (QListWidgetItem* listitem) { + LDObject* obj = null; + for (LDObject* it : *g_curfile) { + if (it->qObjListEntry == listitem) { + obj = it; + break; + } + } + + AddObjectDialog::staticDialog (obj->getType (), obj); +} + +// ============================================================================ void ObjectList::contextMenuEvent (QContextMenuEvent* ev) { g_win->spawnContextMenu (ev->globalPos ()); }
--- a/src/gui.h Thu Jun 13 14:00:34 2013 +0300 +++ b/src/gui.h Thu Jun 13 16:16:55 2013 +0300 @@ -164,6 +164,7 @@ void slot_recentFile (); void slot_quickColor (); void slot_lastSecondCleanup (); + void slot_editObject (QListWidgetItem* listitem); }; // -----------------------------------------------------------------------------
--- a/src/gui_editactions.cpp Thu Jun 13 14:00:34 2013 +0300 +++ b/src/gui_editactions.cpp Thu Jun 13 16:16:55 2013 +0300 @@ -342,11 +342,11 @@ g_win->buildObjList (); } -MAKE_ACTION (moveUp, "Move Up", "arrow-up", "Move the current selection up.", SHIFT (Up)) { +MAKE_ACTION (moveUp, "Move Up", "arrow-up", "Move the current selection up.", KEY (PageUp)) { doMoveSelection (true); } -MAKE_ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", SHIFT (Down)) { +MAKE_ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", KEY (PageDown)) { doMoveSelection (false); } @@ -387,7 +387,7 @@ doMoveObjects ({-1, 0, 0}); } -MAKE_ACTION (moveYNeg, "Move -Y", "move-y-neg", "Move selected objects negative on the Y axis.", KEY (PageUp)) { +MAKE_ACTION (moveYNeg, "Move -Y", "move-y-neg", "Move selected objects negative on the Y axis.", KEY (Home)) { doMoveObjects ({0, -1, 0}); } @@ -399,7 +399,7 @@ doMoveObjects ({1, 0, 0}); } -MAKE_ACTION (moveYPos, "Move +Y", "move-y-pos", "Move selected objects positive on the Y axis.", KEY (PageDown)) { +MAKE_ACTION (moveYPos, "Move +Y", "move-y-pos", "Move selected objects positive on the Y axis.", KEY (End)) { doMoveObjects ({0, 1, 0}); } @@ -481,7 +481,7 @@ doRotate (1, 0, 0); } -MAKE_ACTION (rotateYPos, "Rotate +Y", "rotate-y-pos", "Rotate objects around Y axis", CTRL (PageDown)) { +MAKE_ACTION (rotateYPos, "Rotate +Y", "rotate-y-pos", "Rotate objects around Y axis", CTRL (End)) { doRotate (0, 1, 0); } @@ -493,7 +493,7 @@ doRotate (-1, 0, 0); } -MAKE_ACTION (rotateYNeg, "Rotate -Y", "rotate-y-neg", "Rotate objects around Y axis", CTRL (PageUp)) { +MAKE_ACTION (rotateYNeg, "Rotate -Y", "rotate-y-neg", "Rotate objects around Y axis", CTRL (Home)) { doRotate (0, -1, 0); }