Salome HOME
PARAVIS HTML docs
[modules/paravis.git] / src / PVGUI / PVGUI_Module_actions.cxx
index 5332dba084824903a9cb7145e42589356ca18232..c2469df2a8084af780c402d8598771111d68c002 100644 (file)
@@ -1,4 +1,4 @@
-// LIGHT : sample (no-corba-engine) SALOME module
+// PARAVIS : ParaView wrapper SALOME module
 //
 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -67,7 +67,7 @@ void PVGUI_Module::pvCreateActions()
   // Open File
   aPixmap = resMgr->loadPixmap( "ParaView", tr("ICON_OPEN_FILE"), false );
   createAction( OpenFileId, tr("TOP_OPEN_FILE"), QIcon(aPixmap),
-                tr("MEN_OPEN_FILE"), tr("STB_OPEN_FILE"), 
+                tr("MEN_OPEN"), tr("STB_OPEN_FILE"), 
                0, desk, false, &Implementation->Core, SLOT( onFileOpen() ) );
 
   // Load State
@@ -533,6 +533,7 @@ void PVGUI_Module::pvCreateActions()
                              tr("MEN_ENABLE_TOOLTIPS"), 0, desk );
   aQtxAction->setStatusTip( tr( "PRP_APP_ENABLE_TOOLTIPS" ) );
   aQtxAction->setCheckable(true);
+  aQtxAction->setChecked(true);
   registerAction( EnableTooltipsId, aQtxAction );
 }
 
@@ -550,6 +551,18 @@ void PVGUI_Module::pvCreateMenus()
   int aPVMnu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1 );
 
   createMenu( OpenFileId, aPVMnu, 5 );
+
+  // Recent Files
+  int aMenuId = createMenu( tr( "MEN_RECENT_FILES" ), aPVMnu, -1, 5 );
+  QMenu* aMenu = menuMgr()->findMenu( aMenuId );
+  Implementation->RecentFilesMenu = new pqRecentFilesMenu( *aMenu, getApp()->desktop() );
+  connect( Implementation->RecentFilesMenu, SIGNAL( serverConnectFailed() ),
+          &Implementation->Core,           SLOT( makeDefaultConnectionIfNoneExists() ) );
+  QList<QAction*> anActns = aMenu->actions();
+  for (int i = 0; i < anActns.size(); ++i)
+    createMenu( anActns.at(i), aMenuId );
+
+
   createMenu( separator(), aPVMnu, -1, 5 );
 
   createMenu( LoadStateId, aPVMnu, 15 );
@@ -620,8 +633,8 @@ void PVGUI_Module::pvCreateMenus()
 
   // Install ParaView managers for "Sources" menu
   QMenu* aRes = 0;
-  aPVMnu = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60 );
-  if ( (aRes = getMenu( aPVMnu )) ) {
+  mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60 );
+  if ( (aRes = getMenu( mySourcesMenuId )) ) {
     Implementation->Core.setSourceMenu( aRes );
     connect( &Implementation->Core, SIGNAL( enableSourceCreate(bool) ),
             aRes,                  SLOT( setEnabled(bool) ) );
@@ -630,8 +643,8 @@ void PVGUI_Module::pvCreateMenus()
   // --- Menu "Filters"
 
   // Install ParaView managers for "Filters" menu
-  aPVMnu = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70 );
-  if ( (aRes = getMenu( aPVMnu )) ) {
+  myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70 );
+  if ( (aRes = getMenu( myFiltersMenuId )) ) {
     Implementation->Core.setFilterMenu( aRes );
     connect( &Implementation->Core, SIGNAL( enableFilterCreate(bool) ),
             aRes,                  SLOT( setEnabled(bool) ) );
@@ -744,6 +757,7 @@ void PVGUI_Module::pvCreateToolBars()
   // --- Toolbar "Active Variable Controls"
 
   aToolId = createTool( tr("TOOL_ACTIVE_VARIABLE_CONTROLS") );
+  QToolBar* aTB = toolMgr()->toolBar( aToolId );
   
   createTool( ShowColorLegendId, aToolId );
 
@@ -772,14 +786,27 @@ void PVGUI_Module::pvCreateToolBars()
   colorScale->setRescaleAction( aQtxAction ); /// !!!
   createTool( ResetRangeId, aToolId );
 
+  Implementation->Core.setupVariableToolbar(aTB);
+  QList<QAction*> anActns = aTB->actions();
+  for (int i = 0; i < anActns.size(); ++i)
+    if ( anActns.at(i) != action(ShowColorLegendId) ) {
+      createTool( anActns.at(i), aToolId );
+      connect( &Implementation->Core, SIGNAL( enableVariableToolbar(bool) ),
+              anActns.at(i),         SLOT( setEnabled(bool) ) );
+    }
+  
   // --- Toolbar "Representation"
 
-  QToolBar* aTB = toolMgr()->toolBar( createTool( tr("TOOL_REPRESENTATION") ) );
+  aToolId = createTool( tr("TOOL_REPRESENTATION") );
+  aTB = toolMgr()->toolBar( aToolId );
+
   Implementation->Core.setupRepresentationToolbar(aTB);
-  QList<QAction*> anActns = aTB->actions();
-  for (int i = 0; i < anActns.size(); ++i)
+  anActns = aTB->actions();
+  for (int i = 0; i < anActns.size(); ++i) {
+    createTool( anActns.at(i), aToolId );
     connect( &Implementation->Core, SIGNAL( enableVariableToolbar(bool) ),
             anActns.at(i),         SLOT( setEnabled(bool) ) );
+  }
 
   // --- Toolbar "Camera Controls"
 
@@ -803,15 +830,24 @@ void PVGUI_Module::pvCreateToolBars()
 
   // --- Toolbar "Common Filters"
 
-  aTB = toolMgr()->toolBar( createTool( tr("TOOL_COMMON_FILTERS") ) );
+  aToolId = createTool( tr("TOOL_COMMON_FILTERS") );
+  aTB = toolMgr()->toolBar( aToolId );
+
   Implementation->Core.setupCommonFiltersToolbar(aTB);
-  //QList<QAction*> anActns = aTB->actions();
-  //for (int i = 0; i < anActns.size(); ++i)
-  //  createTool(anActns.at(i),aToolId); /// !!!
+  anActns = aTB->actions();
+  for (int i = 0; i < anActns.size(); ++i)
+    createTool( anActns.at(i), aToolId );
  
   // --- Toolbar "Lookmarks"
 
-  Implementation->Core.setupLookmarkToolbar(toolMgr()->toolBar(createTool( tr("TOOL_LOOKMARKS") )));
+  aToolId = createTool( tr("TOOL_LOOKMARKS") );
+  aTB = toolMgr()->toolBar(aToolId);
+
+  aTB->setContextMenuPolicy(Qt::CustomContextMenu);
+  aTB->setOrientation(Qt::Vertical);
+  aTB->setAllowedAreas(Qt::RightToolBarArea);
+  toolMgr()->mainWindow()->addToolBar(Qt::RightToolBarArea,aTB);
+  Implementation->Core.setupLookmarkToolbar(aTB);
 }
 
 /*!