]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Move VISU navigation preferences to Salome page
authornkv <nkv@opencascade.com>
Mon, 9 Jun 2008 10:57:53 +0000 (10:57 +0000)
committernkv <nkv@opencascade.com>
Mon, 9 Jun 2008 10:57:53 +0000 (10:57 +0000)
src/VISUGUI/VisuGUI_Module.cxx
src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_MainWindow.h
src/VVTK/VVTK_ViewModel.cxx

index fd84d71f1e0db1374206f7c08ee65b004f9aaf30..8d8d138edbd88c35170904bb3a0d9ce8b5f0c468 100644 (file)
@@ -158,9 +158,8 @@ namespace VISU
 {
   //---------------------------------------------------------------
   typedef void (SUIT_ViewWindow::* TViewVisibility)();
-  void
-  SetViewVisibility(SalomeApp_Application* app,
-                   TViewVisibility theViewVisibility)
+  void SetViewVisibility(SalomeApp_Application* app,
+                        TViewVisibility theViewVisibility)
   {
     ViewManagerList l;
     app->viewManagers( VVTK_Viewer::Type(), l );
@@ -180,8 +179,7 @@ namespace VISU
 }
 
 //---------------------------------------------------------------
-VisuGUI_Module::
-VisuGUI_Module() : 
+VisuGUI_Module::VisuGUI_Module() : 
   VisuGUI()
 {
   myExtender = new VisuGUI_ViewExtender(this);
@@ -189,16 +187,13 @@ VisuGUI_Module() :
 
 
 //---------------------------------------------------------------
-VisuGUI_Module::
-~VisuGUI_Module()
+VisuGUI_Module::~VisuGUI_Module()
 {
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-initialize( CAM_Application* theApp )
+void VisuGUI_Module::initialize( CAM_Application* theApp )
 {
   VisuGUI::initialize( theApp );
 
@@ -377,9 +372,7 @@ initialize( CAM_Application* theApp )
 }
 
 //---------------------------------------------------------------
-bool
-VisuGUI_Module::
-activateModule( SUIT_Study* theStudy )
+bool VisuGUI_Module::activateModule( SUIT_Study* theStudy )
 {
   VisuGUI::activateModule( theStudy );
 
@@ -390,9 +383,7 @@ activateModule( SUIT_Study* theStudy )
 
 
 //---------------------------------------------------------------
-bool
-VisuGUI_Module::
-deactivateModule( SUIT_Study* theStudy )
+bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy )
 {
   VisuGUI::deactivateModule( theStudy );
 
@@ -403,17 +394,22 @@ deactivateModule( SUIT_Study* theStudy )
 
 
 //---------------------------------------------------------------
-SUIT_ViewManager*
-VisuGUI_Module::
-onCreateViewManager()
+SUIT_ViewManager* VisuGUI_Module::onCreateViewManager()
 {
   SalomeApp_Application* anApp = getApp();
   SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
   VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
   VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
   aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
+  aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) );
   aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
                             aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
+  aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ),
+                               aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) );
+  aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) );
+  aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ),
+                                aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ),
+                                aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) );
 
   new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
 
@@ -424,9 +420,7 @@ onCreateViewManager()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createPreferences()
+void VisuGUI_Module::createPreferences()
 {
   VisuGUI::createPreferences();
 
@@ -440,9 +434,7 @@ createPreferences()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createGaussPointsPreferences()
+void VisuGUI_Module::createGaussPointsPreferences()
 {
   int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
   int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
@@ -605,9 +597,7 @@ createGaussPointsPreferences()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createInsideCursorPreferences()
+void VisuGUI_Module::createInsideCursorPreferences()
 {
   int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
 
@@ -693,9 +683,7 @@ createInsideCursorPreferences()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createOutsideCursorPreferences()
+void VisuGUI_Module::createOutsideCursorPreferences()
 {
   int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
 
@@ -767,9 +755,7 @@ createOutsideCursorPreferences()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createPickingPreferences()
+void VisuGUI_Module::createPickingPreferences()
 {
   int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
 
@@ -856,9 +842,7 @@ createPickingPreferences()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createSpaceMousePreferences()
+void VisuGUI_Module::createSpaceMousePreferences()
 {
   int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
 
@@ -936,9 +920,7 @@ createSpaceMousePreferences()
 
 
 //---------------------------------------------------------------
-void 
-VisuGUI_Module::
-createRecorderPreferences()
+void VisuGUI_Module::createRecorderPreferences()
 {
   int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
 
@@ -972,9 +954,7 @@ createRecorderPreferences()
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnCreateGaussPoints()
+void VisuGUI_Module::OnCreateGaussPoints()
 {
   double initialTime = vtkTimerLog::GetCPUTime();
   CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
@@ -982,9 +962,7 @@ OnCreateGaussPoints()
         vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
 }
 
-void
-VisuGUI_Module::
-OnViewManagerAdded(SUIT_ViewManager* viewMgr)
+void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
 {
   QString type = viewMgr->getViewModel()->getType();
   if ( type == VVTK_Viewer::Type() ) 
@@ -992,9 +970,7 @@ OnViewManagerAdded(SUIT_ViewManager* viewMgr)
              this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
 }
 
-void
-VisuGUI_Module::
-OnViewCreated(SUIT_ViewWindow* view)
+void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view)
 {
   SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
   if ( viewWindow ) {
@@ -1007,9 +983,7 @@ OnViewCreated(SUIT_ViewWindow* view)
   }
 }
 
-void
-VisuGUI_Module::
-setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
+void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
 {
   if ( !viewWindow )
     return;
@@ -1043,9 +1017,7 @@ setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
   }
 }
 
-void
-VisuGUI_Module::
-setProperty( SVTK_ViewManager* vm, const QString& prop )
+void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop )
 {
   if ( !vm )
     return;
@@ -1055,9 +1027,7 @@ setProperty( SVTK_ViewManager* vm, const QString& prop )
     setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
 }
 
-void
-VisuGUI_Module::
-preferencesChanged( const QString& group, const QString& pref )
+void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref )
 {
   VisuGUI::preferencesChanged(group,pref);
 
@@ -1074,9 +1044,7 @@ preferencesChanged( const QString& group, const QString& pref )
 
 
 //---------------------------------------------------------------
-SUIT_ViewManager*
-VisuGUI_Module::
-getViewManager(const QString& theType, 
+SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType, 
                const bool theIsCreate)
 {
   if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
@@ -1089,9 +1057,7 @@ getViewManager(const QString& theType,
 }
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnEditGaussPoints()
+void VisuGUI_Module::OnEditGaussPoints()
 {
   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
   if(aSelectionInfo.empty())
@@ -1112,10 +1078,9 @@ OnEditGaussPoints()
 //---------------------------------------------------------------
 namespace
 {
-  void
-  GetViewParams(VVTK_MainWindow* theViewWindow,
-               const char* theSuffix,
-               std::ostringstream& theStr)
+  void   GetViewParams(VVTK_MainWindow* theViewWindow,
+                      const char* theSuffix,
+                      std::ostringstream& theStr)
   {
     vtkFloatingPointType aColor[3];
     vtkRenderer* aRenderer = theViewWindow->getRenderer();
@@ -1154,10 +1119,9 @@ namespace
   }
 
   //---------------------------------------------------------------
-  void
-  SetViewParams(VVTK_MainWindow* theViewWindow,
-               const char* theSuffix,
-               const Storable::TRestoringMap& theMap)
+  void SetViewParams(VVTK_MainWindow* theViewWindow,
+                    const char* theSuffix,
+                    const Storable::TRestoringMap& theMap)
   {
     vtkFloatingPointType aColor[3];
     aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
@@ -1196,9 +1160,8 @@ namespace
   }
 
   //---------------------------------------------------------------
-  void
-  GetViewParams(VVTK_MainWindow1* theViewWindow,
-               std::ostringstream& theStr)
+  void   GetViewParams(VVTK_MainWindow1* theViewWindow,
+                      std::ostringstream& theStr)
   {
     GetViewParams(theViewWindow,"1",theStr);
 
@@ -1242,33 +1205,29 @@ namespace
   }
 
   //---------------------------------------------------------------
-  void
-  SetViewParams(VVTK_MainWindow1* theViewWindow,
-               const Storable::TRestoringMap& theMap)
+  void SetViewParams(VVTK_MainWindow1* theViewWindow,
+                    const Storable::TRestoringMap& theMap)
   {
     SetViewParams(theViewWindow,"1",theMap);
   }
 
 
   //---------------------------------------------------------------
-  void
-  GetViewParams(VVTK_MainWindow2* theViewWindow,
-               std::ostringstream& theStr)
+  void GetViewParams(VVTK_MainWindow2* theViewWindow,
+                    std::ostringstream& theStr)
   {
     GetViewParams(theViewWindow,"2",theStr);
   }
 
-  void
-  SetViewParams(VVTK_MainWindow2* theViewWindow,
-               const Storable::TRestoringMap& theMap)
+  void SetViewParams(VVTK_MainWindow2* theViewWindow,
+                    const Storable::TRestoringMap& theMap)
   {
     SetViewParams(theViewWindow,"2",theMap);
   }
 
 
   //---------------------------------------------------------------
-  std::string
-  GetViewParams(VVTK_ViewWindow* theViewWindow)
+  std::string GetViewParams(VVTK_ViewWindow* theViewWindow)
   {
     std::ostringstream aStream;
 
@@ -1308,8 +1267,7 @@ namespace
       myVisibleEntries(theVisibleEntries)
     {}
 
-    void
-    operator()(VISU_GaussPtsAct* theActor) 
+    void operator()(VISU_GaussPtsAct* theActor) 
     {
       if(theActor->GetVisibility()){
        const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
@@ -1318,9 +1276,8 @@ namespace
     }
   };
 
-  void
-  GetGaussPointsSelection(VVTK_ViewWindow* theViewWindow,
-                         TVisibleEntries& theVisibleEntries)
+  void GetGaussPointsSelection(VVTK_ViewWindow* theViewWindow,
+                              TVisibleEntries& theVisibleEntries)
   {
     // First find all visible Gauss Points presentations
     vtkRenderer* aRenderer = theViewWindow->getRenderer();
@@ -1352,13 +1309,11 @@ namespace
 
 
   //---------------------------------------------------------------
-  inline
-  void
-  CreateReference(_PTR(Study) theStudyDocument,
-                 _PTR(StudyBuilder) theStudyBuilder,
-                 _PTR(SObject) theFatherSObject, 
-                 const string& theRefEntry,
-                 const TSelection& theSelection)
+  inline void CreateReference(_PTR(Study) theStudyDocument,
+                             _PTR(StudyBuilder) theStudyBuilder,
+                             _PTR(SObject) theFatherSObject, 
+                             const string& theRefEntry,
+                             const TSelection& theSelection)
   {
     _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
     _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
@@ -1377,11 +1332,10 @@ namespace
 
 
   //---------------------------------------------------------------
-  void
-  SetGaussPointsSelection(VisuGUI* theModule,
-                         VVTK_ViewWindow* theViewWindow,
-                         _PTR(Study) theCStudy,
-                         _PTR(SObject) theSObject)
+  void SetGaussPointsSelection(VisuGUI* theModule,
+                              VVTK_ViewWindow* theViewWindow,
+                              _PTR(Study) theCStudy,
+                              _PTR(SObject) theSObject)
   {
     SVTK_Selector* aSelector = theViewWindow->GetSelector();
     aSelector->ClearIObjects();
@@ -1423,9 +1377,8 @@ namespace
 
 
   //---------------------------------------------------------------
-  void
-  OnStoreConfiguration(SalomeApp_Module* theModule,
-                      bool theIsNew)
+  void OnStoreConfiguration(SalomeApp_Module* theModule,
+                           bool theIsNew)
   {
     _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
     if (CheckLock(aCStudy,GetDesktop(theModule)))
@@ -1514,11 +1467,10 @@ namespace
 
   //---------------------------------------------------------------
   template<class TMainWindow>
-  void
-  SetMainWindowParams(VisuGUI* theModule,
-                     _PTR(SObject) theSObject,
-                     VVTK_ViewWindow* theViewWindow,
-                     TMainWindow* theMainWindow)
+  void SetMainWindowParams(VisuGUI* theModule,
+                          _PTR(SObject) theSObject,
+                          VVTK_ViewWindow* theViewWindow,
+                          TMainWindow* theMainWindow)
   {
     _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
 
@@ -1530,27 +1482,21 @@ namespace
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnSaveConfiguration()
+void VisuGUI_Module::OnSaveConfiguration()
 {
   ::OnStoreConfiguration(this,true);
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnOverwriteConfiguration()
+void VisuGUI_Module::OnOverwriteConfiguration()
 {
   ::OnStoreConfiguration(this,false);
 }
 
 
 //---------------------------------------------------------------
-void
-VisuGUI_Module::
-OnRestoreConfiguration()
+void VisuGUI_Module::OnRestoreConfiguration()
 {
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
 
@@ -1640,9 +1586,7 @@ OnRestoreConfiguration()
 
 
 //---------------------------------------------------------------
-bool
-VisuGUI_Module::
-eventFilter( QObject * theWatched, QEvent * theEvent )
+bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent )
 {
   bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
   if(theEvent->type() == QEvent::Show){
index 456b27150991eacb9bde2037dc41d66ef8b4b1e2..158542a5d8c36e0e077ce1e1982d8032e2f365f3 100644 (file)
 #include <QApplication>
 
 //----------------------------------------------------------------------------
-VVTK_MainWindow
-::VVTK_MainWindow(QWidget* theParent, 
-                 const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr,
-                 SUIT_ViewWindow* theViewWindow):
+VVTK_MainWindow::VVTK_MainWindow(QWidget* theParent, 
+                                const char* theName,
+                                SUIT_ResourceMgr* theResourceMgr,
+                                SUIT_ViewWindow* theViewWindow):
   SVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow),
-  myInteractorStyle(VVTK_InteractorStyle::New()),
   myControllerIncrement(VVTK_ControllerIncrement::New()),
   myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New())
 {
   myToolMgr = new QtxActionToolMgr( this );
-  myInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
-  myControllerIncrement->Delete();
 
-  myInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
+  myControllerIncrement->Delete();
   myControllerOnKeyDown->Delete();
 
-  myInteractorStyle->Delete();
-
   // Recording
   myRecordingToolBar = new QToolBar(tr("LBL_TOOLBAR_RECORD_LABEL"), this);
   addToolBar(Qt::LeftToolBarArea, myRecordingToolBar );
@@ -132,9 +126,7 @@ QtxActionToolMgr* VVTK_MainWindow::toolMgr() const
 }
 
 //----------------------------------------------------------------------------
-void
-VVTK_MainWindow
-::Initialize(SVTK_RenderWindowInteractor* theInteractor)
+void VVTK_MainWindow::Initialize(SVTK_RenderWindowInteractor* theInteractor)
 { 
   vtkInteractorStyle* aStyle = theInteractor->GetInteractorStyle();
   if(SVTK_InteractorStyle *anInteractorStyle = dynamic_cast<SVTK_InteractorStyle*>(aStyle)){
@@ -189,17 +181,6 @@ void VVTK_MainWindow::onDumpView()
   QApplication::restoreOverrideCursor();
 }
 
-//----------------------------------------------------------------------------
-void
-VVTK_MainWindow
-::OnInteractorStyleSwitch(bool theIsGaussStyleOn)
-{
-  if ( theIsGaussStyleOn )
-    this->PushInteractorStyle(myInteractorStyle.GetPointer());
-  else
-    this->PopInteractorStyle();
-}
-
 //----------------------------------------------------------------------------
 void VVTK_MainWindow::OnStartRecording()
 {
@@ -256,9 +237,7 @@ void VVTK_MainWindow::OnStopRecording()
 }
 
 //----------------------------------------------------------------------------
-void 
-VVTK_MainWindow
-::action( const int accelAction  )
+void VVTK_MainWindow::action( const int accelAction  )
 {
   if ( accelAction == SUIT_Accel::ZoomFit )
     onFitAll();
@@ -269,13 +248,11 @@ VVTK_MainWindow
 }
 
 //----------------------------------------------------------------------------
-VVTK_MainWindow1
-::VVTK_MainWindow1(QSplitter* theParent, 
-                 const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr,
-                 SUIT_ViewWindow* theViewWindow):
+VVTK_MainWindow1::VVTK_MainWindow1(QSplitter* theParent, 
+                                  const char* theName,
+                                  SUIT_ResourceMgr* theResourceMgr,
+                                  SUIT_ViewWindow* theViewWindow):
   VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow),
-  myStyleSwitchAction(NULL),
   mySplitter(theParent),
   myPickingDlg(NULL)
 {
@@ -285,23 +262,6 @@ VVTK_MainWindow1
   QPixmap aPixmap;
   QtxAction* anAction;
 
-  aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) );
-  anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"), 
-                          aPixmap,
-                          tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ), 
-                          0, 
-                          this, 
-                          //"VVTK/SVTK StyleSwitch", 
-                          true);
-  anAction->setCheckable(true);
-  anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
-
-  myPtsToolBar->addAction( anAction );
-  myStyleSwitchAction = anAction;
-
-  if( theResourceMgr->integerValue( "VISU", "mouse_behaviour", true ) == 1 )
-    myStyleSwitchAction->toggle();
-
   aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
   myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), 
                                  aPixmap,
@@ -356,18 +316,12 @@ VVTK_MainWindow1
   myPtsToolBar->addAction( aSegmentationAction );
 }
 
-void
-VVTK_MainWindow1
-::Initialize(SVTK_RenderWindowInteractor* theInteractor,
-            VVTK_Renderer1* theRenderer)
+void VVTK_MainWindow1::Initialize(SVTK_RenderWindowInteractor* theInteractor,
+                                 VVTK_Renderer1* theRenderer)
 {
   myRenderer = theRenderer;
   VVTK_MainWindow::Initialize(theInteractor);
 
-  if( myStyleSwitchAction->isChecked() )
-    PushInteractorStyle(myInteractorStyle.GetPointer());
-  connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
-
   mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() );
   mySegmentationCursorDlg->SetInteractor( theInteractor );
 
@@ -375,31 +329,25 @@ VVTK_MainWindow1
   myPickingDlg->SetInteractor( theInteractor );
 }
 
-VVTK_MainWindow1
-::~VVTK_MainWindow1()
+VVTK_MainWindow1::~VVTK_MainWindow1()
 {}
 
 //----------------------------------------------------------------------------
-VVTK_MainWindow2*
-VVTK_MainWindow1
-::CreateMainWindow2(QWidget* theParent, 
-                   const char* theName,
-                   SUIT_ResourceMgr* theResourceMgr,
-                   SUIT_ViewWindow* theViewWindow)
+VVTK_MainWindow2* VVTK_MainWindow1::CreateMainWindow2(QWidget* theParent, 
+                                                     const char* theName,
+                                                     SUIT_ResourceMgr* theResourceMgr,
+                                                     SUIT_ViewWindow* theViewWindow)
 {
   myMainWindow2 = new VVTK_MainWindow2(theParent,
                                       theName,
                                       theResourceMgr,
-                                      theViewWindow,
-                                      myStyleSwitchAction);
+                                      theViewWindow);
   return myMainWindow2;
 }
 
 
 //----------------------------------------------------------------------------
-void
-VVTK_MainWindow1
-::OnSelectionModeSwitch(bool theIsSelectionOn)
+void VVTK_MainWindow1::OnSelectionModeSwitch(bool theIsSelectionOn)
 {
   if ( theIsSelectionOn && !isVisible() )
     return;
@@ -419,9 +367,7 @@ VVTK_MainWindow1
     myPickingDlg->hide();
 }
 
-void
-VVTK_MainWindow1
-::OnSelectionChanged()
+void VVTK_MainWindow1::OnSelectionChanged()
 {
   Selection_Mode aSelectionMode = SelectionMode();
   if(myPickingAction->isChecked() && aSelectionMode != GaussPointSelection)
@@ -432,54 +378,40 @@ VVTK_MainWindow1
 
 
 //----------------------------------------------------------------------------
-VISU_WidgetCtrl* 
-VVTK_MainWindow1
-::GetWidgetCtrl()
+VISU_WidgetCtrl* VVTK_MainWindow1::GetWidgetCtrl()
 {
   return myRenderer->GetWidgetCtrl();
 }
 
-VISU_InsideCursorSettings* 
-VVTK_MainWindow1
-::GetInsideCursorSettings()
+VISU_InsideCursorSettings* VVTK_MainWindow1::GetInsideCursorSettings()
 {
   return mySegmentationCursorDlg->GetInsideCursorSettings();
 }
 
-VISU_OutsideCursorSettings* 
-VVTK_MainWindow1
-::GetOutsideCursorSettings()
+VISU_OutsideCursorSettings* VVTK_MainWindow1::GetOutsideCursorSettings()
 {
   return mySegmentationCursorDlg->GetOutsideCursorSettings();
 }
 
-VISU_PickingSettings* 
-VVTK_MainWindow1
-::GetPickingSettings()
+VISU_PickingSettings* VVTK_MainWindow1::GetPickingSettings()
 {
   return myPickingDlg->GetPickingSettings();
 }
 
 //----------------------------------------------------------------------------
-void
-VVTK_MainWindow1
-::SetPlanesSegementation(bool theIsOn)
+void VVTK_MainWindow1::SetPlanesSegementation(bool theIsOn)
 {
   myPlaneSegmentationAction->setChecked( theIsOn );
   OnSegmentationSwitch(myPlaneSegmentationAction);
 }
 
-void
-VVTK_MainWindow1
-::SetSphereSegementation(bool theIsOn)
+void VVTK_MainWindow1::SetSphereSegementation(bool theIsOn)
 {
   mySphereSegmentationAction->setChecked( theIsOn );
   OnSegmentationSwitch(mySphereSegmentationAction);
 }
 
-void
-VVTK_MainWindow1
-::OnSegmentationSwitch(QtxAction* theAction)
+void VVTK_MainWindow1::OnSegmentationSwitch(QtxAction* theAction)
 {
   bool anIsSegmentationOn = myPlaneSegmentationAction->isChecked() ||
     mySphereSegmentationAction->isChecked();
@@ -516,9 +448,7 @@ VVTK_MainWindow1
   }
 }
 
-void
-VVTK_MainWindow1
-::OnSegmentationSwitch()
+void VVTK_MainWindow1::OnSegmentationSwitch()
 {
   QtxAction* anAction = ( QtxAction* )sender();
   OnSegmentationSwitch(anAction);
@@ -526,30 +456,20 @@ VVTK_MainWindow1
 
 
 //----------------------------------------------------------------------------
-VVTK_MainWindow2
-::VVTK_MainWindow2(QWidget* theParent, 
-                  const char* theName,
-                  SUIT_ResourceMgr* theResourceMgr,
-                  SUIT_ViewWindow* theViewWindow,
-                  QtxAction* theStyleSwitchAction):
-  VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow),
-  myStyleSwitchAction(theStyleSwitchAction)
+VVTK_MainWindow2::VVTK_MainWindow2(QWidget* theParent, 
+                                  const char* theName,
+                                  SUIT_ResourceMgr* theResourceMgr,
+                                  SUIT_ViewWindow* theViewWindow):
+  VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow)
 {}
 
-VVTK_MainWindow2
-::~VVTK_MainWindow2()
+VVTK_MainWindow2::~VVTK_MainWindow2()
 {}
 
 
 //----------------------------------------------------------------------------
-void
-VVTK_MainWindow2
-::Initialize(SVTK_RenderWindowInteractor* theInteractor)
+void VVTK_MainWindow2::Initialize(SVTK_RenderWindowInteractor* theInteractor)
 {
   VVTK_MainWindow::Initialize(theInteractor);
-
-  if( myStyleSwitchAction->isChecked() )
-    PushInteractorStyle(myInteractorStyle.GetPointer());
-  connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
 }
 
index 2471822051f5d1b297cf7b5afd4e5241821f5c1b..068774eaa1d5e9bc4613b1fce4ac902086b68c5b 100644 (file)
@@ -57,49 +57,28 @@ public:
                  SUIT_ViewWindow* theViewWindow);
 
   //! Reimplement SVTK_MainWindow::Initialize
-  virtual
-  void
-  Initialize(SVTK_RenderWindowInteractor* theInteractor);
+  virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor);
 
   //! Destroy instance of the class
-  virtual
-  ~VVTK_MainWindow();
+  virtual ~VVTK_MainWindow();
 
  public slots:
 
-  virtual
-  void
-  onDumpView();
+  virtual void onDumpView();
 
-   //! To change active interactor style at run-time
-  virtual
-  void
-  OnInteractorStyleSwitch(bool theIsGaussStyleOn); 
+  virtual void action( const int );
 
-  virtual 
-  void
-  action( const int );
+  virtual void OnStartRecording();
 
-  virtual
-  void
-  OnStartRecording();
+  virtual void OnPlayRecording();
 
-  virtual
-  void
-  OnPlayRecording();
+  virtual void OnPauseRecording();
 
-  virtual
-  void
-  OnPauseRecording();
-
-  virtual
-  void
-  OnStopRecording();
+  virtual void OnStopRecording();
 
  protected:
   virtual QtxActionToolMgr* toolMgr() const;
 
-  vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
   vtkSmartPointer<VVTK_ControllerIncrement> myControllerIncrement;
   vtkSmartPointer<VVTK_ControllerOnKeyDown> myControllerOnKeyDown; 
 
@@ -128,69 +107,53 @@ public:
                   SUIT_ViewWindow* theViewWindow);
 
   //! Reimplement VVTK_MainWindow::Initialize
-  virtual
-  void
-  Initialize(SVTK_RenderWindowInteractor* theInteractor,
-            VVTK_Renderer1* theRenderer);
+  virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor,
+                         VVTK_Renderer1* theRenderer);
 
   //! Destroy instance of the class
-  virtual
-  ~VVTK_MainWindow1();
+  virtual ~VVTK_MainWindow1();
 
   //! Create instance of the segmented VVTK_MainWindow
   /*!
     The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time.
     So, it is necessary to synhronize them through sharing some common pointers.
   */
-  VVTK_MainWindow2*
-  CreateMainWindow2(QWidget* theParent, 
-                   const char* theName,
-                   SUIT_ResourceMgr* theResourceMgr,
-                   SUIT_ViewWindow* theViewWindow);
+  VVTK_MainWindow2* CreateMainWindow2(QWidget* theParent, 
+                                     const char* theName,
+                                     SUIT_ResourceMgr* theResourceMgr,
+                                     SUIT_ViewWindow* theViewWindow);
 
   VISU_WidgetCtrl*  GetWidgetCtrl();
 
-  void
-  SetPlanesSegementation(bool theIsOn);
+  void SetPlanesSegementation(bool theIsOn);
 
-  void
-  SetSphereSegementation(bool theIsOn);
+  void SetSphereSegementation(bool theIsOn);
 
-  VISU_InsideCursorSettings*
-  GetInsideCursorSettings();
+  VISU_InsideCursorSettings* GetInsideCursorSettings();
 
   //! Get contained VISU_OutsideCursorSettings
-  VISU_OutsideCursorSettings*
-  GetOutsideCursorSettings();
+  VISU_OutsideCursorSettings* GetOutsideCursorSettings();
 
   //! Get contained VISU_PickingSettings
-  VISU_PickingSettings* 
-  GetPickingSettings();
+  VISU_PickingSettings* GetPickingSettings();
 
  public slots:
   //! To activate/ deactivate the segementation cursor at run-time
-  void
-  OnSegmentationSwitch();//bool theIsSegmentationOn); 
+  void OnSegmentationSwitch();//bool theIsSegmentationOn); 
 
-  void
-  OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); 
+  void OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); 
 
    //! To change active selection mode at run-time
-  virtual
-  void
-  OnSelectionModeSwitch(bool theIsSelectionOn); 
+  virtual void OnSelectionModeSwitch(bool theIsSelectionOn); 
 
    //! To adjust to the current selection mode
-  virtual
-  void
-  OnSelectionChanged(); 
+  virtual void OnSelectionChanged(); 
 
  protected:
   VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer
 
   VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view
 
-  QtxAction* myStyleSwitchAction; //!< Action for switch interactor style
   QToolBar* myPtsToolBar; //!< Additional tool bar
 
   //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor
@@ -218,21 +181,13 @@ class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow
   VVTK_MainWindow2(QWidget* theParent, 
                   const char* theName,
                   SUIT_ResourceMgr* theResourceMgr,
-                  SUIT_ViewWindow* theViewWindow,
-                  QtxAction* theStyleSwitchAction);
+                  SUIT_ViewWindow* theViewWindow);
 public:
   //! Destroy instance of the class
-  virtual
-  ~VVTK_MainWindow2();
+  virtual ~VVTK_MainWindow2();
 
   //! Reimplement SVTK_MainWindow::Initialize
-  virtual
-  void
-  Initialize(SVTK_RenderWindowInteractor* theInteractor);
-
- protected:
-  // Refer to the VVTK_MainWindow1::myStyleSwitchAction instance
-  QtxAction* myStyleSwitchAction; 
+  virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor);
 
 };
 
index df70b0834be3eea488d739be4f77919f658e99ad..08d3c34e8aac977718946da3d29da3e5a82b50f5 100644 (file)
 #include <vtkRenderer.h>
 
 //---------------------------------------------------------------
-VVTK_Viewer
-::VVTK_Viewer()
+VVTK_Viewer::VVTK_Viewer()
 {
 }
 
 //---------------------------------------------------------------
-VVTK_Viewer
-::~VVTK_Viewer() 
+VVTK_Viewer::~VVTK_Viewer() 
 {
 }
 
 //---------------------------------------------------------------
-SUIT_ViewWindow*
-VVTK_Viewer
-::createView( SUIT_Desktop* theDesktop )
+SUIT_ViewWindow* VVTK_Viewer::createView( SUIT_Desktop* theDesktop )
 {
   TViewWindow* aViewWindow = new TViewWindow (theDesktop);
   aViewWindow->Initialize(this);
 
   aViewWindow->setBackgroundColor( backgroundColor() );
   aViewWindow->SetTrihedronSize( trihedronSize() );
+  aViewWindow->SetProjectionMode( projectionMode() );
+  aViewWindow->SetInteractionStyle( interactionStyle() );
+  aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() );
+  aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) );
 
   return aViewWindow;
 }
 
 //---------------------------------------------------------------
-void
-VVTK_Viewer
-::Display(const SALOME_VTKPrs* thePrs)
+void VVTK_Viewer::Display(const SALOME_VTKPrs* thePrs)
 {
   // try do downcast object
   if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>(thePrs)){
@@ -106,9 +104,7 @@ namespace VVTK
 }
 
 //---------------------------------------------------------------
-bool
-VVTK_Viewer
-::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
+bool VVTK_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
 {
   QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
   for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)