From: sbh Date: Wed, 21 May 2014 13:58:10 +0000 (+0400) Subject: "Internal" feature XML procesing. Fixes #40 X-Git-Tag: V_0.2~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=761f0db64165dd5208998f29db8c7a8ae6c30e60;p=modules%2Fshaper.git "Internal" feature XML procesing. Fixes #40 --- diff --git a/src/Config/Config_FeatureMessage.cpp b/src/Config/Config_FeatureMessage.cpp index 9408522e6..7b0f60337 100644 --- a/src/Config/Config_FeatureMessage.cpp +++ b/src/Config/Config_FeatureMessage.cpp @@ -14,6 +14,11 @@ Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* myGroupId = ""; myWorkbenchId = ""; + myPluginLibrary = ""; + + myInternal = false; + myUseInput = false; + myNestedFeatures = ""; } const std::string& Config_FeatureMessage::icon() const @@ -101,11 +106,21 @@ bool Config_FeatureMessage::isUseInput() const return myUseInput; } +bool Config_FeatureMessage::isInternal() const +{ + return myInternal; +} + void Config_FeatureMessage::setUseInput(bool isUseInput) { myUseInput = isUseInput; } +void Config_FeatureMessage::setInternal(bool isInternal) +{ + myInternal = isInternal; +} + const std::string& Config_FeatureMessage::nestedFeatures() const { return myNestedFeatures; diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index 99116d707..9328e0690 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -27,6 +27,7 @@ class Config_FeatureMessage: public Events_Message std::string myPluginLibrary; //Name of feature's library bool myUseInput; //Action is being checked until user commit the operation + bool myInternal; //Internal feature without GUI representation std::string myNestedFeatures; public: @@ -45,6 +46,7 @@ public: CONFIG_EXPORT const std::string& pluginLibrary() const; CONFIG_EXPORT const std::string& nestedFeatures() const; CONFIG_EXPORT bool isUseInput() const; + CONFIG_EXPORT bool isInternal() const; CONFIG_EXPORT void setIcon(const std::string& icon); CONFIG_EXPORT void setId(const std::string& id); @@ -56,6 +58,7 @@ public: CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary); CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures); CONFIG_EXPORT void setUseInput(bool isUseInput); + CONFIG_EXPORT void setInternal(bool isInternal); }; #endif // CONFIG_MESSAGE_H diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index 78e485e91..6e6bbb85f 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -17,6 +17,7 @@ #include #include +#include #ifdef _DEBUG #include @@ -72,12 +73,28 @@ bool Config_FeatureReader::processChildren(xmlNodePtr theNode) void Config_FeatureReader::fillFeature(xmlNodePtr theRoot, Config_FeatureMessage& outFtMessage) { outFtMessage.setId(getProperty(theRoot, _ID)); + outFtMessage.setPluginLibrary(myLibraryName); + outFtMessage.setNestedFeatures(getProperty(theRoot, FEATURE_NESTED)); + bool isFtInternal = isInternalFeature(theRoot); + outFtMessage.setInternal(isFtInternal); + if(isFtInternal) { + //Internal feature has no visual representation. + return; + } outFtMessage.setText(getProperty(theRoot, FEATURE_TEXT)); outFtMessage.setTooltip(getProperty(theRoot, FEATURE_TOOLTIP)); outFtMessage.setIcon(getProperty(theRoot, FEATURE_ICON)); outFtMessage.setKeysequence(getProperty(theRoot, FEATURE_KEYSEQUENCE)); outFtMessage.setGroupId(myLastGroup); outFtMessage.setWorkbenchId(myLastWorkbench); - outFtMessage.setPluginLibrary(myLibraryName); - outFtMessage.setNestedFeatures(getProperty(theRoot, FEATURE_NESTED)); +} + +bool Config_FeatureReader::isInternalFeature(xmlNodePtr theRoot) +{ + std::string prop = getProperty(theRoot, FEATURE_INTERNAL); + std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower); + if(prop.empty() || prop == "false" || prop == "0") { + return false; + } + return true; } diff --git a/src/Config/Config_FeatureReader.h b/src/Config/Config_FeatureReader.h index e4e7c63db..1add8438d 100644 --- a/src/Config/Config_FeatureReader.h +++ b/src/Config/Config_FeatureReader.h @@ -31,6 +31,7 @@ protected: bool processChildren(xmlNodePtr aNode); void fillFeature(xmlNodePtr theRoot, Config_FeatureMessage& outFeatureMessage); + bool isInternalFeature(xmlNodePtr theRoot); private: std::string myLastWorkbench; diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 281248f85..25433ffa9 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -39,6 +39,7 @@ const static char* FEATURE_TOOLTIP = "tooltip"; const static char* FEATURE_ICON = "icon"; const static char* FEATURE_KEYSEQUENCE = "keysequence"; const static char* FEATURE_NESTED = "nested"; +const static char* FEATURE_INTERNAL = "internal"; const static char* SOURCE_FILE = "path"; diff --git a/src/Config/Config_ModuleReader.cpp b/src/Config/Config_ModuleReader.cpp index 0291b83b4..9d9a78a02 100644 --- a/src/Config/Config_ModuleReader.cpp +++ b/src/Config/Config_ModuleReader.cpp @@ -84,9 +84,6 @@ std::list Config_ModuleReader::importPlugin(const std::string& theP void Config_ModuleReader::loadLibrary(const std::string theLibName) { -#ifdef _DEBUG - std::cout << "Config_ModuleReader::loading library... " << theLibName.c_str() << std::endl; -#endif std::string aFileName = library(theLibName); if (aFileName.empty()) return; diff --git a/src/ConstructionPlugin/plugin-Construction.xml b/src/ConstructionPlugin/plugin-Construction.xml index 912d04e0c..26a27bc83 100644 --- a/src/ConstructionPlugin/plugin-Construction.xml +++ b/src/ConstructionPlugin/plugin-Construction.xml @@ -4,8 +4,8 @@ - - + + diff --git a/src/ModelAPI/ModelAPI_PluginManager.cpp b/src/ModelAPI/ModelAPI_PluginManager.cpp index a8d497c7c..eb79b9d03 100644 --- a/src/ModelAPI/ModelAPI_PluginManager.cpp +++ b/src/ModelAPI/ModelAPI_PluginManager.cpp @@ -49,9 +49,6 @@ void ModelAPI_PluginManager::SetPluginManager( boost::shared_ptr ModelAPI_PluginManager::get() { if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI - #ifdef _DEBUG - std::cout << "ModelAPI_PluginManager::get: " << "Model library has not been loaded from xml." << std::endl; - #endif Config_ModuleReader::loadLibrary("Model"); } return MY_MANAGER; diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 29cf61b04..5f100983e 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -5,12 +5,12 @@ - + - + diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 85046a2db..cb7a3c790 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -200,7 +200,9 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) static Events_ID aFeatureLoadedId = Events_Loop::loop()->eventByName(EVENT_FEATURE_LOADED); if (theMessage->eventID() == aFeatureLoadedId) { const Config_FeatureMessage* aFeatureMsg = dynamic_cast(theMessage); - addFeature(aFeatureMsg); + if(!aFeatureMsg->isInternal()) { + addFeature(aFeatureMsg); + } return; } //Update property panel on corresponding message. If there is no current operation (no