#include "PVGUI_Module.h"
#include "PVGUI_ProcessModuleHelper.h"
+#include "PVGUI_ViewModel.h"
+#include "PVGUI_ViewManager.h"
+#include "PVGUI_ViewWindow.h"
#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
-#include <LightApp_Selection.h>
-#include <OCCViewer_ViewManager.h>
-#include <SOCC_ViewModel.h>
-#include <SOCC_Prs.h>
#include <QApplication>
#include <QInputDialog>
#include <QString>
#include <pqOptions.h>
+#include <pqApplicationCore.h>
+#include <pqActiveServer.h>
+#include <pqMainWindowCore.h>
+#include <pqObjectBuilder.h>
+#include <pqServer.h>
+#include <pqServerManagerModel.h>
+#include <pqServerResource.h>
+#include <pqViewManager.h>
#include <vtkPVMain.h>
#include <vtkProcessModule.h>
vtkXdmfCS_Initialize(pm->GetInterpreter());
}
-vtkPVMain* PVGUI_Module::myPVMain = 0;
-pqOptions* PVGUI_Module::myPVOptions = 0;
-PVGUI_ProcessModuleHelper* PVGUI_Module::myPVHelper = 0;
+//////////////////////////////////////////////////////////////////////////////
+// PVGUI_Module::pqImplementation
+
+class PVGUI_Module::pqImplementation
+{
+public:
+ pqImplementation(QWidget* parent) :
+ //AssistantClient(0),
+ Core(parent)//,
+ //RecentFilesMenu(0),
+ //ViewMenu(0),
+ //ToolbarsMenu(0)
+ {
+ }
+
+ ~pqImplementation()
+ {
+ //delete this->ViewMenu;
+ //delete this->ToolbarsMenu;
+ //if(this->AssistantClient)
+ // {
+ // this->AssistantClient->closeAssistant();
+ // delete this->AssistantClient;
+ // }
+ }
+
+ //QPointer<QAssistantClient> AssistantClient;
+ //Ui::MainWindow UI;
+ pqMainWindowCore Core;
+ //pqRecentFilesMenu* RecentFilesMenu;
+ //pqViewMenu* ViewMenu;
+ //pqViewMenu* ToolbarsMenu;
+ //QLineEdit* CurrentTimeWidget;
+ //QSpinBox* CurrentTimeIndexWidget;
+ QPointer<pqServer> ActiveServer;
+ QString DocumentationDir;
+
+ static vtkPVMain* myPVMain;
+ static pqOptions* myPVOptions;
+ static PVGUI_ProcessModuleHelper* myPVHelper;
+};
+
+
+vtkPVMain* PVGUI_Module::pqImplementation::myPVMain = 0;
+pqOptions* PVGUI_Module::pqImplementation::myPVOptions = 0;
+PVGUI_ProcessModuleHelper* PVGUI_Module::pqImplementation::myPVHelper = 0;
/*!
\class PVGUI_Module
\brief Constructor. Sets the default name for the module.
*/
PVGUI_Module::PVGUI_Module()
-: LightApp_Module( "PARAVIS" )
+ : LightApp_Module( "PARAVIS" ),
+ Implementation( 0 )
{
}
{
LightApp_Module::initialize( app );
- SUIT_Desktop* desk = application()->desktop();
-
- if ( pvInit() ) {
- pvCreateActions();
+ /*
+ int i = 1;
+ while( i ){
+ i = i;
}
+ */
+
+ pvInit();
+
/*
createAction( lgLoadFile, tr( "TOP_LOAD_FILE" ), QIcon(), tr( "MEN_LOAD_FILE" ),
tr( "STB_LOAD_FILE" ), 0, desk, false, this, SLOT( onLoadFile() ) );
*/
bool PVGUI_Module::pvInit()
{
- if ( !myPVMain ){
+ if ( !pqImplementation::myPVMain ){
// Obtain command-line arguments
int argc = 0;
QStringList args = QApplication::arguments();
// TODO: Set plugin dir from preferences
//QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
- myPVMain = vtkPVMain::New();
- if ( !myPVOptions )
- myPVOptions = pqOptions::New();
- if ( !myPVHelper )
- myPVHelper = PVGUI_ProcessModuleHelper::New();
+ pqImplementation::myPVMain = vtkPVMain::New();
+ if ( !pqImplementation::myPVOptions )
+ pqImplementation::myPVOptions = pqOptions::New();
+ if ( !pqImplementation::myPVHelper )
+ pqImplementation::myPVHelper = PVGUI_ProcessModuleHelper::New();
- myPVOptions->SetProcessType(vtkPVOptions::PVCLIENT);
+ pqImplementation::myPVOptions->SetProcessType(vtkPVOptions::PVCLIENT);
// This creates the Process Module and initializes it.
- int ret = myPVMain->Initialize(myPVOptions, myPVHelper, ParaViewInitializeInterpreter,
- argc, argv);
+ int ret = pqImplementation::myPVMain->Initialize(pqImplementation::myPVOptions,
+ pqImplementation::myPVHelper,
+ ParaViewInitializeInterpreter,
+ argc, argv);
if (!ret){
// Tell process module that we support Multiple connections.
// This must be set before starting the event loop.
vtkProcessModule::GetProcessModule()->SupportMultipleConnectionsOn();
- ret = myPVHelper->Run(myPVOptions);
+ ret = pqImplementation::myPVHelper->Run(pqImplementation::myPVOptions);
}
- //delete[] argv;
- cout << "*** ParaView client initalized!!!" << endl;
+ delete[] argv;
return !ret;
}
{
// TODO...
}
+
+/*!
+ \brief Shows (toShow = true) or hides ParaView view window
+*/
+void PVGUI_Module::showView( bool toShow )
+{
+ // TODO: check if ParaView view already exists
+ if ( !Implementation ){
+ LightApp_Application* anApp = getApp();
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ PVGUI_ViewManager* viewMgr = new PVGUI_ViewManager( anApp->activeStudy(), anApp->desktop() );
+ anApp->addViewManager( viewMgr );
+ connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
+ anApp, SLOT( onCloseView( SUIT_ViewManager* ) ) );
+ //connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), vm, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
+ //connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), this, SLOT( onViewDeleted( SUIT_ViewWindow* ) ) );
+ SUIT_ViewWindow* wnd = viewMgr->createViewWindow();
+
+ // Simulate ParaView client main window
+ Implementation = new pqImplementation( wnd );
+ PVGUI_ViewWindow* pvWnd = dynamic_cast<PVGUI_ViewWindow*>( wnd );
+ pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() );
+
+ pvCreateActions();
+ setupDockWidgets();
+ }
+}
/*!
\brief Create actions for ParaView GUI operations
void PVGUI_Module::pvCreateActions()
{
// TODO...
+ SUIT_Desktop* desk = application()->desktop();
+
+ // TEST
+ int actionManagePlugins = 999;
+ createAction( actionManagePlugins, tr( "TOP_MANAGE_PLUGINS" ), QIcon(), tr( "MEN_MANAGE_PLUGINS" ),
+ tr( "STB_MANAGE_PLUGINS" ), 0, desk, false, &Implementation->Core, SLOT( onManagePlugins() ) );
+ int aPVMnu = createMenu( tr( "MEN_TEST_PARAVIEW" ), -1, -1, 50 );
+ createMenu( actionManagePlugins, aPVMnu, 10 );
+}
+
+
+/*!
+ \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
+*/
+void PVGUI_Module::setupDockWidgets()
+{
+}
+
+/*!
+ \brief Returns the ParaView multi-view manager.
+*/
+pqViewManager* PVGUI_Module::getMultiViewManager() const
+{
+ pqViewManager* aMVM = 0;
+ if ( Implementation )
+ aMVM = &Implementation->Core.multiViewManager();
+ return aMVM;
}
+
/*!
\brief Activate module.
\param study current study
setMenuShown( true );
+ showView( true );
+
+ // Make default server connection
+ if ( Implementation )
+ Implementation->Core.makeDefaultConnectionIfNoneExists();
+
return isDone;
}
+
/*!
\brief Deactivate module.
\param study current study