X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSHAPERGUI%2FSHAPERGUI.cpp;h=cb1deb39284170aa3484d300ebcb5060e3590d92;hb=85b662214060cf733b44ac7822e3e4db49e2da4b;hp=fecbbb031be34f7f22b092cc3709357fe7ef1249;hpb=6ffc65a82f0a74e7b844f8dd81a287f16ca1f28c;p=modules%2Fshaper.git diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index fecbbb031..cb1deb392 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -373,7 +374,8 @@ CAM_DataModel* SHAPERGUI::createDataModel() return new SHAPERGUI_DataModel(this); } -QAction* SHAPERGUI::addFeature(const QString& theWBName, const ActionInfo& theInfo) +QAction* SHAPERGUI::addFeature(const QString& theWBName, const ActionInfo& theInfo, + const bool isAddSeparator) { return addFeature(theWBName, theInfo.id, @@ -381,14 +383,15 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const ActionInfo& theIn theInfo.toolTip, theInfo.icon, theInfo.shortcut, - theInfo.checkable); + theInfo.checkable, + isAddSeparator); } //****************************************************** QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theId, - const QString& theTitle, const QString& theTip, - const QIcon& theIcon, const QKeySequence& theKeys, - bool isCheckable) + const QString& theTitle, const QString& theTip, + const QIcon& theIcon, const QKeySequence& theKeys, + bool isCheckable, const bool isAddSeparator) { static QString aLastTool = ""; static int aNb = 0; @@ -403,9 +406,6 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theId, } aNb++; - int aMenu = createMenu(theWBName, -1, -1, 50); - int aTool = createTool(theWBName, theWBName); - int aId = myActionsList.size(); myActionsList.append(theId); SUIT_Desktop* aDesk = application()->desktop(); @@ -415,8 +415,16 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theId, QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk, isCheckable); aAction->setData(theId); - int aItemId = createMenu(aId, aMenu, -1, 10); - int aToolId = createTool(aId, aTool); + + int aWBMenu = createMenu(theWBName, -1, -1, 50/*10-Window, 1000 - Help*/); + int aItemId = createMenu(aId, aWBMenu); + if (isAddSeparator) + createMenu(separator(), aWBMenu); + + int aWBTool = createTool(theWBName, theWBName); + int aToolId = createTool(aId, aWBTool); + if (isAddSeparator) + createTool(separator(), aWBTool); return aAction; } @@ -427,13 +435,9 @@ bool SHAPERGUI::isFeatureOfNested(const QAction* theAction) } QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName, - const ActionInfo& theInfo, - const QList& theNestedActions) + const ActionInfo& theInfo, + const QList& theNestedActions) { - int aMenu = createMenu(theWBName, -1, -1, 50); - int aTool = createTool(theWBName, theWBName); - - int aId = myActionsList.size(); myActionsList.append(theInfo.id); SUIT_Desktop* aDesk = application()->desktop(); SHAPERGUI_NestedButton* anAction = new SHAPERGUI_NestedButton(aDesk, theNestedActions); @@ -448,8 +452,13 @@ QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName, anAction->setShortcut(theInfo.shortcut); anAction->setFont(theInfo.font); - //int aItemId = createMenu(aId, aMenu, -1, 10); - int aToolId = createTool(anAction, aTool, aId); + int aWBMenu = createMenu(theWBName, -1, -1, 50); + int aItemId = createMenu(anAction, aWBMenu); + createMenu(separator(), aWBMenu); /// nested action is always separated of others + + int aWBTool = createTool(theWBName, theWBName); + int aToolId = createTool(anAction, aWBTool); + createTool(separator(), aWBTool); /// nested action is always separated of others return anAction; } @@ -509,13 +518,8 @@ QList SHAPERGUI::commandList() const if (aCmd && myActionsList.contains(aCmd->data().toString())) aActions.append(aCmd); } - return aActions; -} -//****************************************************** -QStringList SHAPERGUI::commandIdList() const -{ - return myActionsList; + return aActions; } //****************************************************** @@ -524,25 +528,6 @@ QMainWindow* SHAPERGUI::desktop() const return application()->desktop(); } -//****************************************************** -QString SHAPERGUI::commandId(const QAction* theCmd) const -{ - int aId = actionId(theCmd); - if (aId < myActionsList.size()) - return myActionsList[aId]; - return QString(); -} - -//****************************************************** -QAction* SHAPERGUI::command(const QString& theId) const -{ - int aId = myActionsList.indexOf(theId); - if ((aId != -1) && (aId < myActionsList.size())) { - return action(aId); - } - return 0; -} - void SHAPERGUI::setFeatureInfo(const QString& theFeatureId, const std::shared_ptr& theMessage) { @@ -551,7 +536,10 @@ void SHAPERGUI::setFeatureInfo(const QString& theFeatureId, std::shared_ptr SHAPERGUI::featureInfo(const QString& theFeatureId) { - return myFeaturesInfo.contains(theFeatureId) ? myFeaturesInfo[theFeatureId] : NULL; + std::shared_ptr aMessage; + if (myFeaturesInfo.contains(theFeatureId)) + aMessage = myFeaturesInfo[theFeatureId]; + return aMessage; } //****************************************************** @@ -648,3 +636,8 @@ bool SHAPERGUI::abortAllOperations() { return workshop()->operationMgr()->abortAllOperations(); } + +void SHAPERGUI::createFeatureActions() +{ + myWorkshop->menuMgr()->createFeatureActions(); +}