]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #632: Activate/Deactivate zoom tracking on activation/deactivation of module
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 25 Jun 2015 07:35:32 +0000 (10:35 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 25 Jun 2015 07:36:27 +0000 (10:36 +0300)
src/NewGeom/NewGeom_Module.cpp
src/NewGeom/NewGeom_SalomeViewer.cpp
src/NewGeom/NewGeom_SalomeViewer.h

index 547ed1ab5778302b0d8f8a90642ea3e4e099ecf7..16dc0216c9886d621ea7d940ff34cd1a64350cdb 100644 (file)
@@ -215,13 +215,14 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
     }
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
   }
-
+  myProxyViewer->activateViewer(true);
   return isDone;
 }
 
 //******************************************************
 bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy)
 {
+  myProxyViewer->activateViewer(false);
   setMenuShown(false);
   setToolShown(false);
 
index 4539bbdbc6aaed27943fd36be319c61570e099a4..deb1723311fb636eb94e078b08d21d7d6023d140 100644 (file)
@@ -356,3 +356,27 @@ void NewGeom_SalomeViewer::onViewTransformed(OCCViewer_ViewWindow::OperationType
 {
   emit viewTransformed((int) theType);
 }
+
+//***************************************
+void NewGeom_SalomeViewer::activateViewer(bool toActivate)
+{
+  if (!mySelector || !mySelector->viewer())
+    return;
+  SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+  QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
+  if (toActivate) {
+    foreach (SUIT_ViewWindow* aView, aViews) {
+      OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
+      OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+      connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+        this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+    }
+  } else {
+    foreach (SUIT_ViewWindow* aView, aViews) {
+      OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
+      OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+      disconnect((OCCViewer_ViewWindow*)aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+        this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+    }
+  }
+}
\ No newline at end of file
index b02058daa824f627f902124eeb499148cd240597..56a456bb446c145d581ab1448d18b88c805a00ed 100644 (file)
@@ -126,6 +126,10 @@ Q_OBJECT
   /// by mouse drugging. If this is impossible thet it has to return False.
   virtual bool canDragByMouse() const;
 
+  /// Activate or deactivate viewer
+  /// \param toActivate - activation flag
+  void activateViewer(bool toActivate);
+
  private slots:
   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);