# HG changeset patch # User Santeri Piippo # Date 1401708863 -10800 # Node ID c9d1dad83ad0fc00f6c8ac954af0cac9be61d7c4 # Parent 67cc5b47bbff6192f5688f9ee8634de27d17cda8 - added an action for opening the subfiles pointed to by selected references as editable documents diff -r 67cc5b47bbff -r c9d1dad83ad0 changelog.txt --- a/changelog.txt Mon Jun 02 13:35:41 2014 +0300 +++ b/changelog.txt Mon Jun 02 14:34:23 2014 +0300 @@ -35,6 +35,7 @@ + - Selecting an invertnext'd object now also selects the invertnext. + - Made the coordinate rounding precision configurable. + - Inverting a subfile now detects whether the subfile is flat and flips it if it is instead of naively invertnexting everything. ++ - Added an action for opening the subfiles pointed to by selected references as editable documents. - - The camera is now changed to the top one if switching to draw mode while using the free camera instead of disabling the draw mode. - - The color selector now uses the color's edge color for the borders instead of black. diff -r 67cc5b47bbff -r c9d1dad83ad0 src/actions.cc --- a/src/actions.cc Mon Jun 02 13:35:41 2014 +0300 +++ b/src/actions.cc Mon Jun 02 14:34:23 2014 +0300 @@ -895,4 +895,17 @@ updateActions(); R()->refresh(); -} \ No newline at end of file +} + +DEFINE_ACTION (OpenSubfiles, 0) +{ + for (LDObjectPtr obj : selection()) + { + LDSubfilePtr ref = obj.dynamicCast(); + + if (ref == null || not ref->fileInfo()->isImplicit()) + continue; + + ref->fileInfo()->setImplicit (false); + } +} diff -r 67cc5b47bbff -r c9d1dad83ad0 src/ldDocument.cc --- a/src/ldDocument.cc Mon Jun 02 13:35:41 2014 +0300 +++ b/src/ldDocument.cc Mon Jun 02 14:34:23 2014 +0300 @@ -168,7 +168,15 @@ m_isImplicit = a; if (a == false) + { g_explicitDocuments << self().toStrongRef(); + print ("Opened %1", name()); + + // Implicit files are not compiled by the GL renderer. Now that this + // part is no longer implicit, it needs to be compiled. + if (g_win != null) + g_win->R()->compiler()->compileDocument (self()); + } else { g_explicitDocuments.removeOne (self().toStrongRef()); diff -r 67cc5b47bbff -r c9d1dad83ad0 src/mainWindow.cc --- a/src/mainWindow.cc Mon Jun 02 13:35:41 2014 +0300 +++ b/src/mainWindow.cc Mon Jun 02 14:34:23 2014 +0300 @@ -622,6 +622,17 @@ const bool single = (selection().size() == 1); LDObjectPtr singleObj = single ? selection().first() : LDObjectPtr(); + bool hasSubfiles = false; + + for (LDObjectPtr obj : selection()) + { + if (obj->type() == OBJ_Subfile) + { + hasSubfiles = true; + break; + } + } + QMenu* contextMenu = new QMenu; if (single && singleObj->type() != OBJ_Empty) @@ -643,6 +654,14 @@ contextMenu->addAction (ui->actionBorders); contextMenu->addAction (ui->actionSetOverlay); contextMenu->addAction (ui->actionClearOverlay); + + if (hasSubfiles) + { + contextMenu->addSeparator(); + contextMenu->addAction (ui->actionOpenSubfiles); + } + + contextMenu->addSeparator(); contextMenu->addAction (ui->actionModeSelect); contextMenu->addAction (ui->actionModeDraw); contextMenu->addAction (ui->actionModeCircle); diff -r 67cc5b47bbff -r c9d1dad83ad0 src/mainWindow.h --- a/src/mainWindow.h Mon Jun 02 13:35:41 2014 +0300 +++ b/src/mainWindow.h Mon Jun 02 14:34:23 2014 +0300 @@ -286,6 +286,7 @@ void slot_actionSubfileSelection(); void slot_actionDrawAngles(); void slot_actionRandomColors(); + void slot_actionOpenSubfiles(); protected: void closeEvent (QCloseEvent* ev); diff -r 67cc5b47bbff -r c9d1dad83ad0 ui/ldforge.ui --- a/ui/ldforge.ui Mon Jun 02 13:35:41 2014 +0300 +++ b/ui/ldforge.ui Mon Jun 02 14:34:23 2014 +0300 @@ -60,7 +60,7 @@ 0 0 1010 - 27 + 24 @@ -177,6 +177,7 @@ + @@ -1364,6 +1365,14 @@ Random colors + + + Open Subfiles + + + Opens the documents used by the selected subparts for editing. + +