]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Properties mySelectionEnabled and myMultiSelectionEnabled taked into account now.
authorstv <stv@opencascade.com>
Fri, 16 Dec 2005 09:26:42 +0000 (09:26 +0000)
committerstv <stv@opencascade.com>
Fri, 16 Dec 2005 09:26:42 +0000 (09:26 +0000)
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h

index c23da3779c3f6b963d00b5ff51462a843460fe5b..216c9ec845c0507f548621c4f58f98f1e1da2109 100755 (executable)
@@ -158,7 +158,8 @@ void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theE
   if (!theWindow->inherits("OCCViewer_ViewWindow")) return;
 
   OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
-  myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView->getViewPort()->getView());
+  if ( isSelectionEnabled() )
+    myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView->getViewPort()->getView());
 }
 
 
@@ -215,6 +216,16 @@ void OCCViewer_Viewer::enableSelection(bool isEnabled)
 {
   mySelectionEnabled = isEnabled;
   //!! To be done for view windows
+  if ( !myViewManager )
+    return;
+
+  QPtrVector<SUIT_ViewWindow> wins = myViewManager->getViews();
+  for ( int i = 0; i < wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qt_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->updateEnabledDrawMode();
+  }
 }
 
 //*********************************************************************
@@ -222,6 +233,16 @@ void OCCViewer_Viewer::enableMultiselection(bool isEnable)
 {
   myMultiSelectionEnabled = isEnable;
   //!! To be done for view windows
+  if ( !myViewManager )
+    return;
+
+  QPtrVector<SUIT_ViewWindow> wins = myViewManager->getViews();
+  for ( int i = 0; i < wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qt_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->updateEnabledDrawMode();
+  }
 }
 
 //*********************************************************************
index 846a6bcf3ae7c67a8398c0fe075c837b6dd34490..5e0fca13954a89d85aa48e6bf7087a207655b9d3 100755 (executable)
@@ -178,8 +178,9 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_V
 : SUIT_ViewWindow(theDesktop)
 {
   myModel = theModel;
-  myEnableDrawMode = true;
   myRestoreFlag = 0;
+  myEnableDrawMode = false;
+  updateEnabledDrawMode();
 }
 
 //****************************************************************
@@ -265,6 +266,11 @@ bool OCCViewer_ViewWindow::eventFilter(QObject* watched, QEvent* e)
   return SUIT_ViewWindow::eventFilter(watched, e);
 }
 
+void OCCViewer_ViewWindow::updateEnabledDrawMode()
+{
+  if ( myModel )
+    myEnableDrawMode = myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled();
+}
 
 //****************************************************************
 void OCCViewer_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent)
index 17c59fc72aa78a486f11646dbeea6832fe35af1c..14ee51c3b2463b011ca10774984af824ae9182c5 100755 (executable)
@@ -56,6 +56,8 @@ public:
   
   virtual void initLayout();
 
+  void updateEnabledDrawMode();
+
 public slots:
   void onFrontView();
   void onViewFitAll();