X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPVGUI%2FPVGUI_Module.cxx;h=800fa266f10d766090baa44d62645240ff5d9132;hb=fdaf93c1e6361cebf5edcc2366e3614922c20ef2;hp=9cdc4c1b5e2e34bb640467e0c650391ae8e29d36;hpb=1cf8a004e92b0dbc3d886b9809d70addbb6391d5;p=modules%2Fparavis.git diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 9cdc4c1b..800fa266 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -24,32 +24,41 @@ // #include "PVGUI_Module.h" +#include "PVGUI_Module_impl.h" #include "PVGUI_ProcessModuleHelper.h" #include "PVGUI_ViewModel.h" #include "PVGUI_ViewManager.h" #include "PVGUI_ViewWindow.h" -#include #include +#include +#include #include #include #include +#include +#include #include -#include -#include -#include #include +#include #include +#include +#include -#include #include #include -#include +#include +#include #include +#include +#include +#include #include #include #include +#include +#include #include #include #include @@ -120,49 +129,6 @@ void ParaViewInitializeInterpreter(vtkProcessModule* pm) vtkXdmfCS_Initialize(pm->GetInterpreter()); } -////////////////////////////////////////////////////////////////////////////// -// 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 AssistantClient; - //Ui::MainWindow UI; - pqMainWindowCore Core; - //pqRecentFilesMenu* RecentFilesMenu; - //pqViewMenu* ViewMenu; - //pqViewMenu* ToolbarsMenu; - //QLineEdit* CurrentTimeWidget; - //QSpinBox* CurrentTimeIndexWidget; - QPointer 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; @@ -367,38 +333,167 @@ void PVGUI_Module::showView( bool toShow ) SUIT_ViewWindow* wnd = viewMgr->createViewWindow(); // Simulate ParaView client main window - Implementation = new pqImplementation( wnd ); + Implementation = new pqImplementation( anApp->desktop() ); PVGUI_ViewWindow* pvWnd = dynamic_cast( wnd ); pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() ); - pvCreateActions(); setupDockWidgets(); + + pvCreateActions(); + pvCreateMenus(); + pvCreateToolBars(); + + setupDockWidgetsContextMenu(); + + // Now that we're ready, initialize everything ... + Implementation->Core.initializeStates(); } } - + /*! - \brief Create actions for ParaView GUI operations - duplicating menus and toolbars in pqMainWindow ParaView class + \brief Manage the label of Undo operation. */ -void PVGUI_Module::pvCreateActions() +void PVGUI_Module::onUndoLabel(const QString& label) { - // 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 ); + action(UndoId)->setText( + label.isEmpty() ? tr("Can't Undo") : QString(tr("&Undo %1")).arg(label)); + action(UndoId)->setStatusTip( + label.isEmpty() ? tr("Can't Undo") : QString(tr("Undo %1")).arg(label)); +} + +/*! + \brief Manage the label of Redo operation. +*/ +void PVGUI_Module::onRedoLabel(const QString& label) +{ + action(RedoId)->setText( + label.isEmpty() ? tr("Can't Redo") : QString(tr("&Redo %1")).arg(label)); + action(RedoId)->setStatusTip( + label.isEmpty() ? tr("Can't Redo") : QString(tr("Redo %1")).arg(label)); +} + +/*! + \brief Manage the label of Undo Camera operation. +*/ +void PVGUI_Module::onCameraUndoLabel(const QString& label) +{ + action(CameraUndoId)->setText( + label.isEmpty() ? tr("Can't Undo Camera") : QString(tr("U&ndo %1")).arg(label)); + action(CameraUndoId)->setStatusTip( + label.isEmpty() ? tr("Can't Undo Camera") : QString(tr("Undo %1")).arg(label)); +} + +/*! + \brief Manage the label of Redo Camera operation. +*/ +void PVGUI_Module::onCameraRedoLabel(const QString& label) +{ + action(CameraRedoId)->setText( + label.isEmpty() ? tr("Can't Redo Camera") : QString(tr("R&edo %1")).arg(label)); + action(CameraRedoId)->setStatusTip( + label.isEmpty() ? tr("Can't Redo Camera") : QString(tr("Redo %1")).arg(label)); +} + +/*! + \brief Slot to delete all objects. +*/ +void PVGUI_Module::onDeleteAll() +{ + pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder(); + Implementation->Core.getApplicationUndoStack()->beginUndoSet("Delete All"); + builder->destroyPipelineProxies(); + Implementation->Core.getApplicationUndoStack()->endUndoSet(); +} + +/*! + \brief Slot to check/uncheck the action for corresponding selection mode. +*/ +void PVGUI_Module::onSelectionModeChanged(int mode) +{ + if( toolMgr()->toolBar( mySelectionControlsTb )->isEnabled() ) { + if(mode == pqRubberBandHelper::SELECT) //surface selection + action(SelectCellsOnId)->setChecked(true); + else if(mode == pqRubberBandHelper::SELECT_POINTS) //surface selection + action(SelectPointsOnId)->setChecked(true); + else if(mode == pqRubberBandHelper::FRUSTUM) + action(SelectCellsThroughId)->setChecked(true); + else if(mode == pqRubberBandHelper::FRUSTUM_POINTS) + action(SelectPointsThroughId)->setChecked(true); + else if (mode == pqRubberBandHelper::BLOCKS) + action(SelectBlockId)->setChecked(true); + else // INTERACT + action(InteractId)->setChecked(true); + } +} + +/*! + \brief Slot to manage the change of axis center. +*/ +void PVGUI_Module::onShowCenterAxisChanged(bool enabled) +{ + action(ShowCenterId)->setEnabled(enabled); + action(ShowCenterId)->blockSignals(true); + pqRenderView* renView = qobject_cast( + pqActiveView::instance().current()); + action(ShowCenterId)->setChecked( renView ? renView->getCenterAxesVisibility() : false); + action(ShowCenterId)->blockSignals(false); } +/*! + \brief Slot to set tooltips for the first anf the last frames, i.e. a time range of animation. +*/ +void PVGUI_Module::setTimeRanges(double start, double end) +{ + action(FirstFrameId)->setToolTip(QString("First Frame (%1)").arg(start, 0, 'g')); + action(LastFrameId)->setToolTip(QString("Last Frame (%1)").arg(end, 0, 'g')); +} + +/*! + \brief Slot to manage the plaing process of animation. +*/ +void PVGUI_Module::onPlaying(bool playing) +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if(playing) { + disconnect( action(PlayId), SIGNAL( triggered() ), + &Implementation->Core.VCRController(), SLOT( onPlay() ) ); + connect( action(PlayId), SIGNAL( triggered() ), + &Implementation->Core.VCRController(), SLOT( onPause() ) ); + action(PlayId)->setIcon(QIcon(resMgr->loadPixmap("ParaView",tr("ICON_PAUSE"),false))); + action(PlayId)->setText("Pa&use"); + } + else { + connect( action(PlayId), SIGNAL( triggered() ), + &Implementation->Core.VCRController(), SLOT( onPlay() ) ); + disconnect( action(PlayId), SIGNAL( triggered() ), + &Implementation->Core.VCRController(), SLOT( onPause() ) ); + action(PlayId)->setIcon(QIcon(resMgr->loadPixmap("ParaView",tr("ICON_PLAY"),false))); + action(PlayId)->setText("&Play"); + } + + Implementation->Core.setSelectiveEnabledState(!playing); +} /*! - \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc. + \brief Slot to add camera link. */ -void PVGUI_Module::setupDockWidgets() +void PVGUI_Module::onAddCameraLink() { + pqView* vm = pqActiveView::instance().current(); + pqRenderView* rm = qobject_cast(vm); + if(rm) rm->linkToOtherView(); + else SUIT_MessageBox::warning(getApp()->desktop(), + tr("WARNING"), tr("WRN_ADD_CAMERA_LINK")); +} + +/*! + \brief Slot to show information about ParaView. +*/ +void PVGUI_Module::onHelpAbout() +{ + pqClientAboutDialog* const dialog = new pqClientAboutDialog(getApp()->desktop()); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); } /*! @@ -412,7 +507,6 @@ pqViewManager* PVGUI_Module::getMultiViewManager() const return aMVM; } - /*! \brief Activate module. \param study current study