X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNewGeom%2FNewGeom_Module.cpp;h=cb422b659c850801ca655f136328d0d9118a3013;hb=0c64a21a042cfdd26920de8b2fbb11604547d4d0;hp=3a0227476b3619f0307882bd85da043d8f3f7b1c;hpb=6c923258afce0242f7a1c69bbacda73be37bc4b0;p=modules%2Fshaper.git diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index 3a0227476..cb422b659 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -151,6 +152,7 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy) aViewAct->setEnabled(true); myWorkshop->objectBrowser()->setVisible(true); aObjDoc->setVisible(true); + desktop()->tabifyDockWidget(aObjDoc, myWorkshop->propertyPanel()); } if (!mySelector) { @@ -365,8 +367,21 @@ QAction* NewGeom_Module::addFeature(const QString& theWBName, const QString& the const QIcon& theIcon, const QKeySequence& theKeys, bool isCheckable) { + static QString aLastTool = ""; + static int aNb = 0; + if (aLastTool.isEmpty()) + aLastTool = theWBName; + else if (theWBName != aLastTool) { + aLastTool = theWBName; + if (aNb > 20) { + desktop()->addToolBarBreak(); + aNb = 0; + } + } + aNb++; + int aMenu = createMenu(theWBName, -1, -1, 50); - int aTool = createTool(theWBName); + int aTool = createTool(theWBName, theWBName); int aId = myActionsList.size(); myActionsList.append(theId); @@ -389,7 +404,7 @@ QAction* NewGeom_Module::addNestedFeature(const QString& theWBName, const QList& theNestedActions) { int aMenu = createMenu(theWBName, -1, -1, 50); - int aTool = createTool(theWBName); + int aTool = createTool(theWBName, theWBName); int aId = myActionsList.size(); myActionsList.append(theInfo.id); @@ -441,6 +456,23 @@ void NewGeom_Module::addDesktopMenuSeparator(const char* theMenuSourceText, cons createMenu(separator(), aMenu, -1, theMenuPosition); } +bool NewGeom_Module::addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) +{ + if( !theAction ) + return false; + + SUIT_Desktop* aDesktop = application()->desktop(); + if( !aDesktop ) + return false; + + QtxActionToolMgr* aToolMgr = aDesktop->toolMgr(); + if( !aToolMgr ) + return false; + + aToolMgr->append( theAction, theToolBarTitle ); + return true; +} + //****************************************************** QList NewGeom_Module::commandList() const { @@ -523,8 +555,8 @@ void NewGeom_Module::selectionChanged() //****************************************************** void NewGeom_Module::contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle) { - theMenu->addActions(myWorkshop->contextMenuMgr()->viewerMenu()->actions()); - //myWorkshop->contextMenuMgr()->addViewerMenu(theMenu); + myWorkshop->contextMenuMgr()->updateViewerMenu(); + myWorkshop->contextMenuMgr()->addViewerMenu(theMenu); LightApp_Module::contextMenuPopup(theClient, theMenu, theTitle); }