From e03e6d9a44899591aa591a69c0ec001afd718709 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 31 Aug 2019 18:03:43 +0800 Subject: [PATCH] Gui: expose link selection and navigation command --- src/Gui/CommandLink.cpp | 34 ++++++++++++-- src/Gui/Icons/LinkSelect.svg | 41 ++++++++-------- src/Gui/Icons/LinkSelectAll.svg | 77 +++++++++++++++---------------- src/Gui/Icons/LinkSelectFinal.svg | 51 ++++++++++---------- src/Gui/Workbench.cpp | 5 +- 5 files changed, 117 insertions(+), 91 deletions(-) diff --git a/src/Gui/CommandLink.cpp b/src/Gui/CommandLink.cpp index 5d9b0cf596..4126c330c9 100644 --- a/src/Gui/CommandLink.cpp +++ b/src/Gui/CommandLink.cpp @@ -36,6 +36,7 @@ #include "Document.h" #include "Selection.h" #include "WaitCursor.h" +#include "BitmapFactory.h" #include "ViewProviderDocumentObject.h" #include @@ -609,6 +610,7 @@ void StdCmdLinkImportAll::activated(int) { } } + //////////////////////////////////////////////////////////////////////////////////////////// DEF_STD_CMD_A(StdCmdLinkSelectLinked) @@ -805,6 +807,33 @@ void StdCmdLinkSelectAllLinks::activated(int) Selection().selStackPush(); } + +//====================================================================== +// Std_LinkSelectActions +//=========================================================================== + +class StdCmdLinkSelectActions : public GroupCommand +{ +public: + StdCmdLinkSelectActions() + : GroupCommand("Std_LinkSelectActions") + { + sGroup = QT_TR_NOOP("View"); + sMenuText = QT_TR_NOOP("Link navigation"); + sToolTipText = QT_TR_NOOP("Link navigation actions"); + sWhatsThis = "Std_LinkSelectActions"; + sStatusTip = QT_TR_NOOP("Link navigation actions"); + eType = AlterSelection; + bCanLog = false; + + addCommand(new StdCmdLinkSelectLinked()); + addCommand(new StdCmdLinkSelectLinkedFinal()); + addCommand(new StdCmdLinkSelectAllLinks()); + } + + virtual const char* className() const {return "StdCmdLinkSelectActions";} +}; + //=========================================================================== // Instantiation //=========================================================================== @@ -815,9 +844,6 @@ namespace Gui { void CreateLinkCommands(void) { CommandManager &rcCmdMgr = Application::Instance->commandManager(); - rcCmdMgr.addCommand(new StdCmdLinkSelectLinked()); - rcCmdMgr.addCommand(new StdCmdLinkSelectLinkedFinal()); - rcCmdMgr.addCommand(new StdCmdLinkSelectAllLinks()); rcCmdMgr.addCommand(new StdCmdLinkMake()); rcCmdMgr.addCommand(new StdCmdLinkMakeRelative()); rcCmdMgr.addCommand(new StdCmdLinkMakeGroup()); @@ -825,6 +851,8 @@ void CreateLinkCommands(void) rcCmdMgr.addCommand(new StdCmdLinkUnlink()); rcCmdMgr.addCommand(new StdCmdLinkImport()); rcCmdMgr.addCommand(new StdCmdLinkImportAll()); + rcCmdMgr.addCommand(new StdCmdLinkSelectActions()); + } } // namespace Gui diff --git a/src/Gui/Icons/LinkSelect.svg b/src/Gui/Icons/LinkSelect.svg index 22dd52531d..4f5122191a 100644 --- a/src/Gui/Icons/LinkSelect.svg +++ b/src/Gui/Icons/LinkSelect.svg @@ -31,26 +31,14 @@ id="defs12"> - - - - + x1="376.4729" + y1="126.48917" + x2="227.8653" + y2="325.55527" /> + + + + + style="opacity:1;fill:#34e0e2;fill-opacity:1;stroke:#042a2a;stroke-width:16.26075878;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + x1="375.16592" + y1="28.0254" + x2="209.299" + y2="342.99905" /> - - - - + x1="365.19101" + y1="121.74049" + x2="250.10538" + y2="329.15479" /> + + + + + style="opacity:1;fill:#34e0e2;fill-opacity:1;stroke:#042a2a;stroke-width:14.7937903;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="opacity:1;fill:#34e0e2;fill-opacity:1;stroke:#042a2a;stroke-width:14.7937903;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - + x1="438.20734" + y1="166.44759" + x2="292.12607" + y2="348.30722" /> + x1="440.64899" + y1="112.18765" + x2="313.50818" + y2="364.89471" /> + + + + + style="opacity:1;fill:#34e0e2;fill-opacity:1;stroke:#042a2a;stroke-width:16.26075878;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="opacity:1;fill:#34e0e2;fill-opacity:1;stroke:#042a2a;stroke-width:16.26075878;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> setCommand("View"); *view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_DrawStyle" << "Std_SelBoundingBox" + << "Separator" << "Std_SelBack" << "Std_SelForward" << "Std_LinkSelectActions" << "Separator" << "Std_TreeViewActions" << "Std_ViewIsometric" << "Separator" << "Std_ViewFront" << "Std_ViewTop" << "Std_ViewRight" << "Separator" << "Std_ViewRear" << "Std_ViewBottom" << "Std_ViewLeft" << "Separator" << "Std_MeasureDistance" ; - + // Structure ToolBarItem* structure = new ToolBarItem( root ); structure->setCommand("Structure"); *structure << "Std_Part" << "Std_Group" << "Std_LinkMake" << "Std_LinkMakeRelative"; - + return root; }