From: stv Date: Fri, 16 Dec 2005 09:26:42 +0000 (+0000) Subject: Properties mySelectionEnabled and myMultiSelectionEnabled taked into account now. X-Git-Tag: TG-D5-38-2003_D2005-20-12~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=26b74521c81d41a3cca009fbce3cc1bc850d060c;p=modules%2Fgui.git Properties mySelectionEnabled and myMultiSelectionEnabled taked into account now. --- diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index c23da3779..216c9ec84 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -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 wins = myViewManager->getViews(); + for ( int i = 0; i < wins.count(); i++ ) + { + OCCViewer_ViewWindow* win = ::qt_cast( 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 wins = myViewManager->getViews(); + for ( int i = 0; i < wins.count(); i++ ) + { + OCCViewer_ViewWindow* win = ::qt_cast( wins.at( i ) ); + if ( win ) + win->updateEnabledDrawMode(); + } } //********************************************************************* diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 846a6bcf3..5e0fca139 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -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) diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 17c59fc72..14ee51c3b 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -56,6 +56,8 @@ public: virtual void initLayout(); + void updateEnabledDrawMode(); + public slots: void onFrontView(); void onViewFitAll();