- /*
- createAction( lgLoadFile, tr( "TOP_LOAD_FILE" ), QIcon(), tr( "MEN_LOAD_FILE" ),
- tr( "STB_LOAD_FILE" ), 0, desk, false, this, SLOT( onLoadFile() ) );
- createAction( lgDisplayLine, tr( "TOP_DISPLAY_LINE" ), QIcon(), tr( "MEN_DISPLAY_LINE" ),
- tr( "STB_DISPLAY_LINE" ), 0, desk, false, this, SLOT( onDisplayLine() ) );
- createAction( lgEraseLine, tr( "TOP_ERASE_LINE" ), QIcon(), tr( "MEN_ERASE_LINE" ),
- tr( "STB_ERASE_LINE" ), 0, desk, false, this, SLOT( onEraseLine() ) );
- createAction( lgSaveFile, tr( "TOP_SAVE_FILE" ), QIcon(), tr( "MEN_SAVE_FILE" ),
- tr( "STB_SAVE_FILE" ), 0, desk, false, this, SLOT( onSaveFile() ) );
- createAction( lgEditLine, tr( "TOP_EDIT_LINE" ), QIcon(), tr( "MEN_EDIT_LINE" ),
- tr( "STB_EDIT_LINE" ), 0, desk, false, this, SLOT( onEditLine() ) );
- createAction( lgAddLine, tr( "TOP_ADD_LINE" ), QIcon(), tr( "MEN_ADD_LINE" ),
- tr( "STB_ADD_LINE" ), 0, desk, false, this, SLOT( onAddLine() ) );
- createAction( lgDelLine, tr( "TOP_DEL_LINE" ), QIcon(), tr( "MEN_DEL_LINE" ),
- tr( "STB_DEL_LINE" ), 0, desk, false, this, SLOT( onDelLine() ) );
- createAction( lgClear, tr( "TOP_CLEAR_ALL" ), QIcon(), tr( "MEN_CLEAR_ALL" ),
- tr( "STB_CLEAR_ALL" ), 0, desk, false, this, SLOT( onClear() ) );
+ // Create GUI elements (menus, toolbars, dock widgets)
+ //if ( !Implementation ){
+ SalomeApp_Application* anApp = getApp();
+ SUIT_Desktop* aDesktop = anApp->desktop();
+
+ // connect(aDesktop, SIGNAL()
+
+ // Remember current state of desktop toolbars
+ QList<QToolBar*> foreignToolbars = aDesktop->findChildren<QToolBar*>();
+
+ // Simulate ParaView client main window
+ //Implementation = new pqImplementation( aDesktop );
+
+ setupDockWidgets();
+
+ pvCreateActions();
+ pvCreateToolBars();
+ pvCreateMenus();
+
+ QList<QDockWidget*> activeDocks = aDesktop->findChildren<QDockWidget*>();
+ QList<QMenu*> activeMenus = aDesktop->findChildren<QMenu*>();
+
+ // new pqParaViewBehaviors(anApp->desktop(), this);
+ // Has to be replaced in order to exclude using of pqQtMessageHandlerBehaviour
+ // Start pqParaViewBehaviors
+ // Register ParaView interfaces.
+ //pqPluginManager* pgm = pqApplicationCore::instance()->getPluginManager();
+ pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
+
+ // * adds support for standard paraview views.
+ pgm->addInterface(new pqStandardViewModules(pgm));
+ pgm->addInterface(new pqStandardSummaryPanelImplementation(pgm));
+ pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
+
+ // Load plugins distributed with application.
+ pqApplicationCore::instance()->loadDistributedPlugins();
+
+ // Define application behaviors.
+ //new pqQtMessageHandlerBehavior(this);
+ new pqDataTimeStepBehavior(this);
+ new pqViewFrameActionsBehavior(this);
+ new pqSpreadSheetVisibilityBehavior(this);
+ new pqPipelineContextMenuBehavior(this);
+ new pqDefaultViewBehavior(this);
+ new pqAlwaysConnectedBehavior(this);
+ new pqPVNewSourceBehavior(this);
+ new pqDeleteBehavior(this);
+ new pqUndoRedoBehavior(this);
+ new pqCrashRecoveryBehavior(this);
+ new pqAutoLoadPluginXMLBehavior(this);
+ new pqPluginDockWidgetsBehavior(aDesktop);
+ //new pqVerifyRequiredPluginBehavior(this);
+ new pqPluginActionGroupBehavior(aDesktop);
+ //new pqFixPathsInStateFilesBehavior(this);
+ new pqCommandLineOptionsBehavior(this);
+ new pqPersistentMainWindowStateBehavior(aDesktop);
+ new pqObjectPickingBehavior(aDesktop);
+ new pqCollaborationBehavior(this);
+ new pqMultiServerBehavior(this);
+ new pqViewStreamingBehavior(this);
+
+ // Setup quick-launch shortcuts.
+ QShortcut *ctrlSpace = new QShortcut(Qt::CTRL + Qt::Key_Space, aDesktop);
+ QObject::connect(ctrlSpace, SIGNAL(activated()),
+ pqApplicationCore::instance(), SLOT(quickLaunch()));
+
+ // Find Plugin Dock Widgets
+ QList<QDockWidget*> currentDocks = aDesktop->findChildren<QDockWidget*>();
+ QList<QDockWidget*>::iterator i;
+ for (i = currentDocks.begin(); i != currentDocks.end(); ++i) {
+ if(!activeDocks.contains(*i)) {
+ myDockWidgets[*i] = false; // hidden by default
+ (*i)->hide();
+ }
+ }
+
+ // Find Plugin Menus
+ QList<QMenu*> currentMenus = aDesktop->findChildren<QMenu*>();
+ QList<QMenu*>::iterator im;
+ for (im = currentMenus.begin(); im != currentMenus.end(); ++im) {
+ if(!activeMenus.contains(*im)) {
+ myMenus.append(*im);
+ }
+ }
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QString aPath = resMgr->stringValue("resources", "PARAVIS", QString());
+ if (!aPath.isNull()) {
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewFilters.xml");
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewReaders.xml");
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewSources.xml");
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewWriters.xml");
+ }
+
+ // Force creation of engine
+ PARAVIS::GetParavisGen(this);
+ updateObjBrowser();
+
+ // Find created toolbars
+ QCoreApplication::processEvents();
+
+ QList<QToolBar*> allToolbars = aDesktop->findChildren<QToolBar*>();
+ foreach(QToolBar* aBar, allToolbars) {
+ if (!foreignToolbars.contains(aBar)) {
+ myToolbars[aBar] = true;
+ myToolbarBreaks[aBar] = false;
+ aBar->setVisible(false);
+ aBar->toggleViewAction()->setVisible(false);
+ }
+ }
+ //}
+
+ updateMacros();
+
+ // we need to start trace after connection is done
+ connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(finishedAddingServer(pqServer*)),
+ this, SLOT(onFinishedAddingServer(pqServer*)));
+
+ connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(dataRepresentationCreated(pqDataRepresentation*)),
+ this, SLOT(onDataRepresentationCreated(pqDataRepresentation*)));
+
+
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ bool isStop = aResourceMgr->booleanValue( "PARAVIS", "stop_trace", false );
+ // start timer to activate trace in a proper moment
+ if(!isStop)
+ startTimer( 1000 );
+
+ this->VTKConnect = vtkEventQtSlotConnect::New();
+
+ vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
+ if(pm) {
+ vtkPVSession* pvs = dynamic_cast<vtkPVSession*>(pm->GetSession());
+ if(pvs) {
+ vtkPVProgressHandler* ph = pvs->GetProgressHandler();
+ if(ph) {
+ this->VTKConnect->Connect(ph, vtkCommand::StartEvent,
+ this, SLOT(onStartProgress()));
+ this->VTKConnect->Connect(ph, vtkCommand::EndEvent,
+ this, SLOT(onEndProgress()));
+ }
+ }
+ }
+
+ connect(&pqActiveObjects::instance(),
+ SIGNAL(representationChanged(pqRepresentation*)),
+ this, SLOT(onRepresentationChanged(pqRepresentation*)));
+}
+
+void PVGUI_Module::onStartProgress()
+{
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+}
+
+void PVGUI_Module::onEndProgress()
+{
+ QApplication::restoreOverrideCursor();
+}
+
+void PVGUI_Module::onFinishedAddingServer(pqServer* /*server*/)
+{
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ bool isStop = aResourceMgr->booleanValue( "PARAVIS", "stop_trace", false );
+ if(!isStop)
+ startTimer( 500 );
+}
+
+void PVGUI_Module::onDataRepresentationCreated(pqDataRepresentation* data) {
+ if(!data)
+ return;
+
+ if(!data->getLookupTable())
+ return;
+
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ if(!aResourceMgr)
+ return;
+
+ bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false );
+ pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager();
+
+ if(lut_mgr) {
+ lut_mgr->setScalarBarVisibility(data,visible);
+ }
+
+ connect(data, SIGNAL(dataUpdated()), this, SLOT(onDataRepresentationUpdated()));
+}
+
+void PVGUI_Module::onDataRepresentationUpdated() {
+ SalomeApp_Study* activeStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
+ if(!activeStudy) return;
+
+ activeStudy->Modified();
+}