Salome HOME
0023450: Fields are not displayed in GEOM
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewModel.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 83e9355..9de7848
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -21,6 +21,7 @@
 //
 
 #include "OCCViewer_ViewModel.h"
+#include "OCCViewer.h"
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_ViewFrame.h"
 #include "OCCViewer_VService.h"
@@ -36,8 +37,6 @@
 
 #include "ViewerData_AISShape.hxx"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include "QtxActionToolMgr.h"
 #include "QtxBackgroundTool.h"
 
 #include <QDesktopWidget>
 
 #include <AIS_Axis.hxx>
-#if OCC_VERSION_LARGE > 0x06080000
-  #include <Prs3d_Drawer.hxx>
-#else
-  #include <AIS_Drawer.hxx>
-#endif
-#include <AIS_ListOfInteractive.hxx>
+#include <Prs3d_Drawer.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 
 #include <Graphic3d_Texture2Dmanual.hxx>
@@ -71,7 +65,8 @@
 #include <Prs3d_LineAspect.hxx>
 #include <Prs3d_TextAspect.hxx>
 
-#include <Visual3d_View.hxx>
+#include <V3d_DirectionalLight.hxx>
+#include <V3d_AmbientLight.hxx>
 
 /*!
   Get data for supported background modes: gradient types, identifiers and supported image formats
@@ -90,6 +85,21 @@ QString OCCViewer_Viewer::backgroundData( QStringList& gradList, QIntList& idLis
   return tr("BG_IMAGE_FILES");
 }
 
+/*!
+  Get data for supported stereo pair modes: stereo types and identifiers
+*/
+void OCCViewer_Viewer::stereoData( QStringList& typeList, QIntList& idList)
+{
+  typeList << tr("ST_QUADBUFFER")    << tr("ST_ANAGLYPH")         <<
+              tr("ST_ROWINTERLACED") << tr("ST_COLUMNINTERLACED") <<
+              tr("ST_CHESSBOARD")    << tr("ST_SIDEBYSIDE")       <<
+              tr("ST_OVERUNDER");
+  idList   << QuadBufferType    << AnaglyphType         <<
+              RowInterlacedType << ColumnInterlacedType <<
+              ChessBoardType    << SideBySideType       <<
+              OverUnderType;
+}
+
 /*!
   Constructor
   \param DisplayTrihedron - is trihedron displayed
@@ -100,19 +110,26 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
   myIsRelative(true),
   myTopLayerId( 0 ),
   myTrihedronSize(100),
-  myClippingDlg (NULL)
+  myClippingDlg (NULL),
+  myIsUseLocalSelection(false)
 {
   // init CasCade viewers
   myV3dViewer = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Viewer3d").ToExtString() );
   //myV3dViewer->Init(); // to avoid creation of the useless perspective view (see OCCT issue 0024267)
-  myV3dViewer->SetDefaultLights();
+  setDefaultLights();
 
   // init selector
   myAISContext = new AIS_InteractiveContext( myV3dViewer );
-  myAISContext->SelectionColor( Quantity_NOC_WHITE );
+  myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor( Quantity_NOC_WHITE );
+  myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected)->SetColor( Quantity_NOC_WHITE );
   
   // display isoline on planar faces (box for ex.)
   myAISContext->IsoOnPlane( true );
+
+  // create color scale
+  myColorScale = new AIS_ColorScale();
+  myColorScale->SetZLayer( Graphic3d_ZLayerId_TopOSD );
+  myColorScale->SetTransformPersistence( Graphic3d_TransformPers::FromDeprecatedParams( Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0) ) );
   
   /* create trihedron */
   if ( DisplayTrihedron )
@@ -125,13 +142,8 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
     //myTrihedron->SetColor( Col );
     myTrihedron->SetArrowColor( Col.Name() );
     myTrihedron->SetSize(100);
-    #if OCC_VERSION_LARGE > 0x06080000
-      Handle(Prs3d_Drawer) drawer = myTrihedron->Attributes();
-      if (drawer->HasOwnDatumAspect()) {
-    #else
-      Handle(AIS_Drawer) drawer = myTrihedron->Attributes();
-      if (drawer->HasDatumAspect()) {
-    #endif
+    Handle(Prs3d_Drawer) drawer = myTrihedron->Attributes();
+    if (drawer->HasOwnDatumAspect()) {
       Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect();
       daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB));
       daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB));
@@ -152,6 +164,18 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
   mySelectionEnabled = true;
   myMultiSelectionEnabled = true;
 
+  // set projection type to orthographic
+  myProjectionType = 0;
+  // set stereo parameters
+  myStereoType = 0;
+  myAnaglyphFilter = 0;
+  myToReverseStereo = 0;
+  myVSyncMode = 1;
+  myQuadBufferSupport = 0;
+  myStereographicFocusType = 1;
+  myInterocularDistanceType = 1;
+  myStereographicFocusValue = 1.0;
+  myInterocularDistanceValue = 0.05;
   //set clipping color and texture to standard
   myClippingColor = QColor( 50, 50, 50 );
   myDefaultTextureUsed = true;
@@ -215,14 +239,21 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
     view->initLayout();
     view->initSketchers();
     view->setInteractionStyle( interactionStyle() );
+    view->setProjectionType( projectionType() );
+    view->setStereoType( stereoType() );
+    view->setAnaglyphFilter( anaglyphFilter() );
+    view->setStereographicFocus( stereographicFocusType(), stereographicFocusValue() );
+    view->setInterocularDistance( interocularDistanceType(), interocularDistanceValue() );
+    view->setReverseStereo( isReverseStereo() );
+    view->setVSync( isVSync() );
+    view->setQuadBufferSupport( isQuadBufferSupport() );
     view->setZoomingStyle( zoomingStyle() );
     view->enablePreselection( isPreselectionEnabled() );
     view->enableSelection( isSelectionEnabled() );
-    
+
     OCCViewer_ViewPort3d* vp3d = view->getViewPort();
     if ( vp3d )
     {
-      vp3d->getView()->SetSurfaceDetail(V3d_TEX_ALL);
       // connect signal from viewport
       connect(vp3d, SIGNAL(vpClosed(OCCViewer_ViewPort3d*)), this, SLOT(onViewClosed(OCCViewer_ViewPort3d*)));
       connect(vp3d, SIGNAL(vpMapped(OCCViewer_ViewPort3d*)), this, SLOT(onViewMapped(OCCViewer_ViewPort3d*)));
@@ -299,7 +330,7 @@ void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theE
     }
     Handle(V3d_View) aView3d = aView->getViewPort()->getView();
     if ( !aView3d.IsNull() ) {
-      myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
+      myAISContext->MoveTo( theEvent->x(), theEvent->y(), aView3d, Standard_True );
     }
   }
 }
@@ -331,14 +362,14 @@ void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* t
     if ( !isPreselectionEnabled() ) {
       Handle(V3d_View) aView3d = aView->getViewPort()->getView();
       if ( !aView3d.IsNull() ) {
-       myAISContext->MoveTo(myEndPnt.x(), myEndPnt.y(), aView3d);
+       myAISContext->MoveTo( myEndPnt.x(), myEndPnt.y(), aView3d, Standard_True );
       }
     }
 
     if (aHasShift && myMultiSelectionEnabled)
-      myAISContext->ShiftSelect();
-    else
-      myAISContext->Select();
+      myAISContext->ShiftSelect( Standard_True );
+    else 
+      myAISContext->Select( Standard_True );
   }
   else
   {
@@ -390,21 +421,21 @@ void OCCViewer_Viewer::onKeyPress(SUIT_ViewWindow* theWindow, QKeyEvent* theEven
     if ( !isPreselectionEnabled() ) {
       Handle(V3d_View) aView3d = aView->getViewPort()->getView();
       if ( !aView3d.IsNull() ) {
-       myAISContext->MoveTo(myCurPnt.x(), myCurPnt.y(), aView3d);
+       myAISContext->MoveTo(myCurPnt.x(), myCurPnt.y(), aView3d, Standard_True );
       }
     }
 
     if (aHasShift && myMultiSelectionEnabled)
-      myAISContext->ShiftSelect();
+      myAISContext->ShiftSelect( Standard_True );
     else
-      myAISContext->Select();
+      myAISContext->Select( Standard_True );
 
     emit selectionChanged();
 
     break;
   case  Qt::Key_N:
     if ( isPreselectionEnabled() ) {
-      if ( getAISContext()->HasOpenedContext() )
+      if ( useLocalSelection() )
        getAISContext()->HilightNextDetected( aView->getViewPort()->getView() );
     }
     break;
@@ -475,6 +506,253 @@ void OCCViewer_Viewer::setInteractionStyle( const int theStyle )
   }
 }
 
+/*!
+  \return projection type
+*/
+int OCCViewer_Viewer::projectionType() const
+{
+  return myProjectionType;
+}
+
+/*!
+  Sets projection type: 0 - orthographic, 1 - perspective
+  \param theType - new projection type
+*/
+void OCCViewer_Viewer::setProjectionType( const int theType )
+{
+  if ( myProjectionType != theType ) {
+    if ( theType != OCCViewer_ViewWindow::Stereo )
+      myProjectionType = theType;
+
+    if ( !myViewManager )
+      return;
+
+    QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+    for ( int i = 0; i < (int)wins.count(); i++ )
+    {
+      OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+      if ( win )
+        win->setProjectionType( (OCCViewer_ViewWindow::ProjectionType)theType );
+    }
+  }
+}
+
+/*!
+  \return stereo type
+*/
+int OCCViewer_Viewer::stereoType() const
+{
+  return myStereoType;
+}
+
+/*!
+  Sets stereo type
+  \param theType - new stereo type
+*/
+void OCCViewer_Viewer::setStereoType( const int theType )
+{
+  myStereoType = theType;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setStereoType( (OCCViewer_ViewWindow::StereoType)theType );
+  }
+}
+
+/*!
+  \return stereographic focus type
+*/
+int OCCViewer_Viewer::stereographicFocusType() const
+{
+  return myStereographicFocusType;
+}
+
+/*!
+  \return stereographic focus value
+*/
+double OCCViewer_Viewer::stereographicFocusValue() const
+{
+  return myStereographicFocusValue;
+}
+
+/*!
+  Sets stereographic focus parameters
+  \param theType - new stereographic focus type
+  \param theValue - new stereographic focus value
+*/
+void OCCViewer_Viewer::setStereographicFocus( const int theType, const double theValue )
+{
+  myStereographicFocusType = theType;
+  myStereographicFocusValue = theValue;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setStereographicFocus( (OCCViewer_ViewWindow::FocusIODType)theType, theValue );
+  }
+}
+
+/*!
+  \return stereographic focus type
+*/
+int OCCViewer_Viewer::interocularDistanceType() const
+{
+  return myInterocularDistanceType;
+}
+
+/*!
+  \return stereographic focus value
+*/
+double OCCViewer_Viewer::interocularDistanceValue() const
+{
+  return myInterocularDistanceValue;
+}
+
+/*!
+  Sets interocular distance parameters
+  \param theType - new IOD type
+  \param theValue - new IOD value
+*/
+void OCCViewer_Viewer::setInterocularDistance( const int theType, const double theValue )
+{
+  myInterocularDistanceType = theType;
+  myInterocularDistanceValue = theValue;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setInterocularDistance( (OCCViewer_ViewWindow::FocusIODType)theType, theValue );
+  }
+}
+
+/*!
+  \return anaglyph filter
+*/
+int OCCViewer_Viewer::anaglyphFilter() const
+{
+  return myAnaglyphFilter;
+}
+
+/*!
+  Sets anaglyph filter
+  \param theType - new anaglyph filter
+*/
+void OCCViewer_Viewer::setAnaglyphFilter( const int theType )
+{
+  myAnaglyphFilter = theType;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setAnaglyphFilter( (OCCViewer_ViewWindow::AnaglyphFilter)theType );
+  }
+}
+
+/*!
+  \return reverse stereo
+*/
+bool OCCViewer_Viewer::isReverseStereo() const
+{
+  return myToReverseStereo;
+}
+
+/*!
+  Sets reverse stereo
+  \param theReverse - enable/disable reverse mode
+*/
+void OCCViewer_Viewer::setReverseStereo( const bool theReverse )
+{
+  myToReverseStereo = theReverse;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setReverseStereo( theReverse );
+  }
+}
+
+/*!
+  \return V-Sync mode
+*/
+bool OCCViewer_Viewer::isVSync() const
+{
+  return myVSyncMode;
+}
+
+/*!
+  Set V-Sync mode
+  \param theEnable - enable/disable V-Sync mode
+*/
+void OCCViewer_Viewer::setVSync( const bool theEnable )
+{
+  myVSyncMode = theEnable;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setVSync( theEnable );
+  }
+}
+
+/*!
+  \return support quad-buffered stereo
+*/
+bool OCCViewer_Viewer::isQuadBufferSupport() const
+{
+  return myQuadBufferSupport;
+}
+
+/*!
+  Set support quad-buffered stereo
+  \param theEnable - enable/disable support quad-buffered stereo
+*/
+void OCCViewer_Viewer::setQuadBufferSupport( const bool theEnable )
+{
+  myQuadBufferSupport = theEnable;
+
+  if ( !myViewManager )
+    return;
+
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win )
+      win->setQuadBufferSupport( theEnable );
+  }
+}
+
 /*!
   \return zooming style
 */
@@ -708,7 +986,7 @@ void OCCViewer_Viewer::contextMenuPopup(QMenu* thePopup)
   OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
 
   //Support of several toolbars in the popup menu
-  QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+  QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
   QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
   for ( ; it!=last; it++ ) {
     if ( (*it)->parentWidget()->isVisible() )
@@ -801,6 +1079,33 @@ void OCCViewer_Viewer::performSelectionChanged()
     emit selectionChanged();
 }
 
+/*
+ * Defines default lights
+ */
+void OCCViewer_Viewer::setDefaultLights()
+{
+  // clear all light sources
+  myV3dViewer->InitDefinedLights();
+  while ( myV3dViewer->MoreDefinedLights() )
+  {
+    myV3dViewer->DelLight( myV3dViewer->DefinedLight() );
+    myV3dViewer->InitDefinedLights();
+  }
+
+  // get light source parameters from preferences
+  QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "OCCViewer", "light_color", QColor( 0, 0, 0 ) );
+  double aDx = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dx", 0.0 );
+  double aDy = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dy", 0.0 );
+  double aDz = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dz", -1.0 );
+
+  Handle(V3d_DirectionalLight) aLight =
+    new V3d_DirectionalLight( myV3dViewer, V3d_Zneg, OCCViewer::color( aColor ).Name(), Standard_True );
+  if( !( aDx == 0 && aDy == 0 && aDz == 0 ) )
+    aLight->SetDirection( aDx, aDy, aDz );
+  myV3dViewer->SetLightOn( aLight );
+  myV3dViewer->SetLightOn( new V3d_AmbientLight( myV3dViewer ) );
+}
+
 /*!
   Hilights/unhilights object in viewer
   \param obj - object to be updated
@@ -929,6 +1234,28 @@ void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj
     myV3dViewer->Update();
 }
 
+bool OCCViewer_Viewer::isColorScaleVisible() const
+{
+  return !myColorScale.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myColorScale );
+}
+
+void OCCViewer_Viewer::setColorScaleShown( const bool on )
+{
+  if ( myColorScale.IsNull() )
+    return;
+  if ( on )
+  {
+    if ( !myAISContext->IsDisplayed( myColorScale ) )
+      myAISContext->Display( myColorScale, Standard_True );
+    myAISContext->Redisplay( myColorScale, Standard_True, Standard_True );
+  }
+  else
+  {
+    if ( myAISContext->IsDisplayed( myColorScale ) )
+      myAISContext->Erase( myColorScale, Standard_True );
+  }
+}
+
 /*!
   Changes visibility of trihedron to opposite
 */
@@ -956,11 +1283,16 @@ void OCCViewer_Viewer::setTrihedronShown( const bool on )
     return;
 
   if ( on ) {
-    myAISContext->Display( myTrihedron );
-    myAISContext->Deactivate(myTrihedron);
+    myAISContext->Display( myTrihedron,
+                           0 /*wireframe*/,
+                           -1 /* selection mode */,
+                           Standard_True /* update viewer*/,
+                           Standard_False /* allow decomposition */,
+                           AIS_DS_Displayed /* display status */);
+    myAISContext->Deactivate( myTrihedron );
   }
   else {
-    myAISContext->Erase( myTrihedron );
+    myAISContext->Erase( myTrihedron , Standard_True );
   }
 }
 
@@ -1026,6 +1358,27 @@ OCCViewer_ViewWindow* OCCViewer_Viewer::createSubWindow()
   return new OCCViewer_ViewWindow(0,  this);
 }
 
+/*!
+  Sets using local selection state
+  \param theIsUseLocalSelection - state
+*/
+void OCCViewer_Viewer::setUseLocalSelection(bool theIsUseLocalSelection)
+{
+  myIsUseLocalSelection = theIsUseLocalSelection;
+}
+
+/* 
+ * Returns true if local context is opened or view model local state is set
+ */
+bool OCCViewer_Viewer::useLocalSelection() const
+{
+  if (myIsUseLocalSelection)
+    return true;
+
+  Handle(AIS_InteractiveContext) ic = getAISContext();
+  return !ic.IsNull() && ic->HasOpenedContext();
+}
+
 // obsolete  
 QColor OCCViewer_Viewer::backgroundColor( int theViewId ) const
 {
@@ -1108,7 +1461,6 @@ double OCCViewer_Viewer::computeSceneSize(const Handle(V3d_View)& view3d) const
   double aMaxSide = 0;
   double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;
 
-#if OCC_VERSION_LARGE > 0x06070100
   Bnd_Box aBox = view3d->View()->MinMaxValues();
   Xmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
   Ymin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
@@ -1116,9 +1468,6 @@ double OCCViewer_Viewer::computeSceneSize(const Handle(V3d_View)& view3d) const
   Xmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().X();
   Ymax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Y();
   Zmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Z();
-#else
-  view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
-#endif
 
   if ( Xmin != RealFirst() && Ymin != RealFirst() && Zmin != RealFirst() &&
        Xmax != RealLast()  && Ymax != RealLast()  && Zmax != RealLast() )
@@ -1257,3 +1606,22 @@ void OCCViewer_Viewer::setClippingDlg(OCCViewer_ClippingDlg* theDlg) {
     myClippingDlg = theDlg;
   }
 }
+
+
+bool OCCViewer_Viewer::enableDrawMode( bool on )
+{
+  //!! To be done for view windows
+  if ( !myViewManager )
+    return false;
+
+  bool prev = false;
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+  for ( int i = 0; i < (int)wins.count(); i++ )
+  {
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    if ( win ) {
+      prev = prev || win->enableDrawMode( on ); 
+    }
+  }
+  return prev;
+}