From e730dd94e3e7bfaa294bc4084b2c03e5644ad063 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 16 Jun 2019 13:05:39 +0200 Subject: [PATCH] Automatic visibility handling of axis cross --- src/Gui/CommandDoc.cpp | 4 ++++ src/Gui/CommandView.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 73fbdf815e..77954c1e2e 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -417,6 +417,10 @@ void StdCmdNew::activated(int iMsg) .arg(qApp->translate("StdCmdNew","Unnamed")); runCommand(Command::Doc,cmd.toUtf8()); doCommand(Command::Gui,"Gui.activeDocument().activeView().viewDefaultOrientation()"); + + ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); + if (hViewGrp->GetBool("ShowAxisCross")) + doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)"); } //=========================================================================== diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index ad53be551e..841bcdf885 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1925,6 +1925,10 @@ void StdCmdViewCreate::activated(int iMsg) Q_UNUSED(iMsg); getActiveGuiDocument()->createView(View3DInventor::getClassTypeId()); getActiveGuiDocument()->getActiveView()->viewAll(); + + ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); + if (hViewGrp->GetBool("ShowAxisCross")) + doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)"); } bool StdCmdViewCreate::isActive(void) @@ -2087,10 +2091,13 @@ void StdCmdAxisCross::activated(int iMsg) Q_UNUSED(iMsg); Gui::View3DInventor* view = qobject_cast(Gui::getMainWindow()->activeWindow()); if (view) { - if(view->getViewer()->hasAxisCross()== false) + if (view->getViewer()->hasAxisCross() == false) doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)"); else doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(False)"); + + ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); + hViewGrp->SetBool("ShowAxisCross", view->getViewer()->hasAxisCross()); } }