Salome HOME
SQUISH test for refs #576
[modules/shaper.git] / src / NewGeom / NewGeom_Module.cpp
index 3a0227476b3619f0307882bd85da043d8f3f7b1c..cb422b659c850801ca655f136328d0d9118a3013 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <QtxPopupMgr.h>
 #include <QtxActionMenuMgr.h>
+#include <QtxActionToolMgr.h>
 #include <QtxResourceMgr.h>
 
 #include <Config_PropManager.h>
@@ -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<QAction*>& 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<QAction*> 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);
 }