From a90d781a012463c18887d6fdb32c78fe10489df4 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 20 Mar 2017 13:23:50 +0300 Subject: [PATCH] Issue #2024 - Redesign of circle and arc of circle: fill Reference Attribute See preview button visibility in Property Panel should be read from XML definition of the feature --- src/Config/Config_FeatureReader.cpp | 4 ++-- src/XGUI/XGUI_Workshop.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index f22337d07..6a27228a3 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -145,6 +145,8 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theFeatureNode, outFeatureMessage->setActionsWhenNested(getNormalizedProperty(theFeatureNode, FEATURE_WHEN_NESTED)); outFeatureMessage->setModal(getBooleanAttribute(theFeatureNode, FEATURE_MODAL, false)); + bool isAutoPreview = getBooleanAttribute(theFeatureNode, FEATURE_AUTO_PREVIEW, true); + outFeatureMessage->setAutoPreview(isAutoPreview); bool isInternal = getBooleanAttribute(theFeatureNode, ATTR_INTERNAL, false); outFeatureMessage->setInternal(isInternal); @@ -168,6 +170,4 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theFeatureNode, aDocKind = restoreAttribute(NODE_WORKBENCH, WORKBENCH_DOC); } outFeatureMessage->setDocumentKind(aDocKind); - bool isAutoPreview = getBooleanAttribute(theFeatureNode, FEATURE_AUTO_PREVIEW, true); - outFeatureMessage->setAutoPreview(isAutoPreview); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index bbf1f0420..12ec57391 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -81,6 +81,8 @@ #include #include #include +#include +#include #include @@ -587,7 +589,15 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation) #else AppElements_MainMenu* aMenuBar = mainWindow()->menuObject(); AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str()); - bool anIsAutoPreview = aCommand && aCommand->featureMessage()->isAutoPreview(); + bool anIsAutoPreview = true; + if (aCommand) + anIsAutoPreview = aCommand->featureMessage()->isAutoPreview(); + else { + std::string aXmlCfg, aDescription; + module()->getXMLRepresentation(aFeatureKind, aXmlCfg, aDescription); + ModuleBase_WidgetFactory aFactory(aXmlCfg, moduleConnector()); + anIsAutoPreview = aFactory.widgetAPI()->getBooleanAttribute(FEATURE_AUTO_PREVIEW, true); + } #endif if (!anIsAutoPreview) { myPropertyPanel->findButton(PROP_PANEL_PREVIEW)->setVisible(true); -- 2.39.2