Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_Viewer.cpp
1 #include "XGUI_Viewer.h"
2 #include "XGUI_MainWindow.h"
3 #include "XGUI_ViewWindow.h"
4 #include "XGUI_ViewPort.h"
5
6 #include <QMdiArea>
7 #include <QMdiSubWindow>
8 #include <QApplication>
9
10 #include <V3d_View.hxx>
11
12 #include <Aspect_DisplayConnection.hxx>
13 #include <Graphic3d.hxx>
14 #include <Graphic3d_GraphicDriver.hxx>
15 #include <Geom_Axis2Placement.hxx>
16 #include <AIS_Drawer.hxx>
17 #include <Prs3d_DatumAspect.hxx>
18 #include <Prs3d_LineAspect.hxx>
19 #include <V3d_View.hxx>
20 #include <Visual3d_View.hxx>
21 #include <AIS_ListOfInteractive.hxx>
22 #include <AIS_ListIteratorOfListOfInteractive.hxx>
23 #include <AIS_Shape.hxx>
24
25 #include <QMouseEvent>
26
27 #ifdef WIN32
28 #include <WNT_Window.hxx>
29 #else
30 #include <Xw_Window.hxx>
31 #endif
32
33 XGUI_Viewer::InteractionStyle2StatesMap XGUI_Viewer::myStateMap;
34 XGUI_Viewer::InteractionStyle2ButtonsMap XGUI_Viewer::myButtonMap;
35 static bool isInitialized = false;
36
37 /*!
38  Creates viewer 3d [ static ]
39  */
40 Handle(V3d_Viewer) CreateViewer(const Standard_ExtString name, const Standard_CString displayName,
41                                 const Standard_CString domain, const Standard_Real viewSize,
42                                 const V3d_TypeOfOrientation viewProjection,
43                                 const Standard_Boolean computedMode,
44                                 const Standard_Boolean defaultComputedMode)
45 {
46   static Handle(Graphic3d_GraphicDriver) aGraphicDriver;
47   if (aGraphicDriver.IsNull()) {
48     Handle(Aspect_DisplayConnection) aDisplayConnection;
49 #ifndef WIN32
50     aDisplayConnection = new Aspect_DisplayConnection( displayName );
51 #else
52     aDisplayConnection = new Aspect_DisplayConnection();
53 #endif
54     aGraphicDriver = Graphic3d::InitGraphicDriver(aDisplayConnection);
55   }
56
57   return new V3d_Viewer(aGraphicDriver, name, domain, viewSize, viewProjection, Quantity_NOC_GRAY30,
58                         V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, computedMode, defaultComputedMode,
59                         V3d_TEX_NONE);
60 }
61
62 // VSR: Uncomment below line to allow texture background support in OCC viewer
63 #define OCC_ENABLE_TEXTURED_BACKGROUND
64
65 /*!
66  Get data for supported background modes: gradient types, identifiers and supported image formats
67  */
68 QString XGUI_Viewer::backgroundData(QStringList& gradList, QIntList& idList, QIntList& txtList)
69 {
70   gradList << tr("Horizontal gradient") << tr("Vertical gradient")
71       << tr("First diagonal gradient") << tr("Second diagonal gradient")
72       << tr("First corner gradient") << tr("Second corner gradient")
73       << tr("Third corner gradient") << tr("Fourth corner gradient");
74   idList << XGUI::HorizontalGradient << XGUI::VerticalGradient << XGUI::Diagonal1Gradient
75       << XGUI::Diagonal2Gradient << XGUI::Corner1Gradient << XGUI::Corner2Gradient
76       << XGUI::Corner3Gradient << XGUI::Corner4Gradient;
77 #ifdef OCC_ENABLE_TEXTURED_BACKGROUND
78   txtList << XGUI::CenterTexture << XGUI::TileTexture << XGUI::StretchTexture;
79 #endif
80   return tr("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)");
81 }
82
83 XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron)
84     : QObject(theParent), 
85     myMainWindow(theParent), 
86     myPreselectionEnabled(true), 
87     mySelectionEnabled(true), 
88     myMultiSelectionEnabled(true), 
89     myIsRelative(true), 
90     myInteractionStyle(XGUI::STANDARD), 
91     myTrihedronSize(100),
92     myActiveView(0),
93     myWndIdCount(0)
94 {
95   if (!isInitialized) {
96     isInitialized = true;
97
98     // standard interaction style
99     XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::ZOOM] = Qt::ControlModifier;
100     XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::ZOOM] = Qt::LeftButton;
101
102     XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::PAN] = Qt::ControlModifier;
103     XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::PAN] = Qt::MidButton;
104
105     XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::ROTATE] = Qt::ControlModifier;
106     XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::ROTATE] = Qt::RightButton;
107
108     XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::FIT_AREA] = Qt::ControlModifier;
109     XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::FIT_AREA] = Qt::RightButton;
110
111     // "key free" interaction style
112     XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::ZOOM] = Qt::NoModifier;
113     XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::ZOOM] = Qt::RightButton;
114
115     XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::PAN] = Qt::NoModifier;
116     XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::PAN] = Qt::MidButton;
117
118     XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::ROTATE] = Qt::NoModifier;
119     XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::ROTATE] = Qt::LeftButton;
120
121     XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoModifier; // unused
122     XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoButton; // unused
123   }
124
125   // init CasCade viewers
126   myV3dViewer = CreateViewer(TCollection_ExtendedString("Viewer3d").ToExtString(), "", "", 1000.0,
127                              V3d_XposYnegZpos, Standard_True, Standard_True);
128   myV3dViewer->SetDefaultLights();
129
130   // init selector
131   myAISContext = new AIS_InteractiveContext(myV3dViewer);
132   myAISContext->SelectionColor(Quantity_NOC_WHITE);
133
134   // display isoline on planar faces (box for ex.)
135   myAISContext->IsoOnPlane(true);
136
137   if (DisplayTrihedron) {
138     Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(gp::XOY());
139     myTrihedron = new AIS_Trihedron(anAxis);
140     myTrihedron->SetInfiniteState( Standard_True);
141
142     Quantity_Color Col(193 / 255., 205 / 255., 193 / 255., Quantity_TOC_RGB);
143     myTrihedron->SetArrowColor(Col.Name());
144     myTrihedron->SetSize(myTrihedronSize);
145     Handle(AIS_Drawer) drawer = myTrihedron->Attributes();
146     if (drawer->HasDatumAspect()) {
147       Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect();
148       daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB));
149       daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB));
150       daspect->ThirdAxisAspect()->SetColor(Quantity_Color(0.0, 0.0, 1.0, Quantity_TOC_RGB));
151     }
152   }
153   // set zooming style to standard
154   //myZoomingStyle = 0;
155
156   QMdiArea* aMDI = myMainWindow->mdiArea();
157   connect(aMDI, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(onWindowActivated(QMdiSubWindow*)));
158
159 }
160
161 XGUI_Viewer::~XGUI_Viewer(void)
162 {
163   myAISContext.Nullify();
164   myV3dViewer.Nullify();
165 }
166
167 QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType)
168 {
169   // create view frame
170   XGUI_ViewWindow* view = new XGUI_ViewWindow(this, theType);
171   // get main view window (created by view frame)
172   //OCCViewer_ViewWindow* vw = view->getView(OCCViewer_ViewFrame::MAIN_VIEW);
173   // initialize main view window
174   //initView( vw );
175   // set default background for view window
176   //vw->setBackground( background(0) ); // 0 means MAIN_VIEW (other views are not yet created here)
177   // connect signal from viewport
178   //connect(view->viewPort(), SIGNAL(vpClosed()), this, SLOT(onViewClosed()));
179     //connect(view->viewPort(), SIGNAL(vpMapped()), this, SLOT(onViewMapped()));
180   if (myViews.size() == 0) 
181     setTrihedronShown(true);
182
183   view->setBackground(XGUI_ViewBackground(XGUI::VerticalGradient, Qt::white, QColor(Qt::blue).lighter()));
184   //view->setBackground(XGUI_ViewBackground(Qt::black));
185   view->updateEnabledDrawMode();
186
187   QMdiArea* aMDI = myMainWindow->mdiArea();
188   QMdiSubWindow* aWnd = aMDI->addSubWindow(view, Qt::FramelessWindowHint);
189   addView(aWnd);
190   aWnd->setGeometry(0, 0, aMDI->width() / 2, aMDI->height() / 2);
191   aWnd->show();
192   aWnd->setWindowTitle(QString("Viewer #%1").arg(++myWndIdCount));
193   emit viewCreated(view);
194   return aWnd;
195 }
196
197 XGUI_ViewWindow* XGUI_Viewer::activeViewWindow() const
198 {
199   return dynamic_cast<XGUI_ViewWindow*>(myActiveView->widget());
200 }
201
202 void XGUI_Viewer::getSelectedObjects(AIS_ListOfInteractive& theList)
203 {
204   theList.Clear();
205   for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected())
206     theList.Append(myAISContext->SelectedInteractive());
207 }
208
209 void XGUI_Viewer::getSelectedShapes(NCollection_List<TopoDS_Shape>& theList)
210 {
211   Handle(AIS_InteractiveContext) ic = AISContext();
212
213   for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected()) {
214     TopoDS_Shape aShape = ic->SelectedShape();
215     if (!aShape.IsNull())
216       theList.Append(aShape);
217   }
218 }
219
220 void XGUI_Viewer::setObjectsSelected(const AIS_ListOfInteractive& theList)
221 {
222   AIS_ListIteratorOfListOfInteractive aIt;
223   for (aIt.Initialize(theList); aIt.More(); aIt.Next())
224     myAISContext->AddOrRemoveSelected(aIt.Value(), false);
225   myAISContext->UpdateCurrentViewer();
226 }
227
228 /*! Sets hot button
229  *\param theOper - hot operation
230  *\param theState - adding state to state map operations.
231  *\param theButton - adding state to button map operations.
232  */
233 void XGUI_Viewer::setHotButton(XGUI::InteractionStyle theInteractionStyle,
234                                XGUI::HotOperation theOper, Qt::KeyboardModifiers theState,
235                                Qt::MouseButtons theButton)
236 {
237   myStateMap[theInteractionStyle][theOper] = theState;
238   myButtonMap[theInteractionStyle][theOper] = theButton;
239 }
240
241 /*! Gets hot button for operation \a theOper.
242  *\param theOper - input hot operation
243  *\param theState - output state from state map operations.
244  *\param theButton - output state from button map operations.
245  */
246 void XGUI_Viewer::getHotButton(XGUI::InteractionStyle theInteractionStyle,
247                                XGUI::HotOperation theOper, Qt::KeyboardModifiers& theState,
248                                Qt::MouseButtons& theButton)
249 {
250   theState = myStateMap[theInteractionStyle][theOper];
251   theButton = myButtonMap[theInteractionStyle][theOper];
252 }
253
254 /*!
255  Changes visibility of trihedron to opposite
256  */
257 void XGUI_Viewer::toggleTrihedron()
258 {
259   setTrihedronShown(!isTrihedronVisible());
260 }
261
262 /*!
263  \return true if trihedron is visible
264  */
265 bool XGUI_Viewer::isTrihedronVisible() const
266 {
267   return !myTrihedron.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed(myTrihedron);
268 }
269
270 /*!
271  Sets visibility state of trihedron
272  \param on - new state
273  */
274
275 void XGUI_Viewer::setTrihedronShown(bool on)
276 {
277   if (myTrihedron.IsNull())
278     return;
279
280   if (on) {
281     myAISContext->Display(myTrihedron);
282     myAISContext->Deactivate(myTrihedron);
283   } else {
284     myAISContext->Erase(myTrihedron);
285   }
286 }
287
288 /*!
289  \return trihedron size
290  */
291 double XGUI_Viewer::trihedronSize() const
292 {
293   double sz = 0;
294   if (!myTrihedron.IsNull())
295     sz = myTrihedron->Size();
296   return sz;
297 }
298
299 /*!
300  Changes trihedron size
301  \param sz - new size
302  */
303 void XGUI_Viewer::setTrihedronSize(const double sz, bool isRelative)
304 {
305   if (myTrihedronSize != sz || isRelative != myIsRelative) {
306     myTrihedronSize = sz;
307     myIsRelative = isRelative;
308     updateTrihedron();
309   }
310 }
311
312 /*! 
313  * Update the size of the trihedron
314  */
315 void XGUI_Viewer::updateTrihedron()
316 {
317   if (myTrihedron.IsNull())
318     return;
319
320   if (myIsRelative) {
321     double newSz, oldSz;
322
323     if (computeTrihedronSize(newSz, oldSz))
324       myTrihedron->SetSize(newSz);
325
326   } else if (myTrihedron->Size() != myTrihedronSize) {
327     myTrihedron->SetSize(myTrihedronSize);
328   }
329 }
330
331 /*!
332  Get new and current trihedron size corresponding to the current model size
333  */
334 bool XGUI_Viewer::computeTrihedronSize(double& theNewSize, double& theSize)
335 {
336   theNewSize = 100;
337   theSize = 100;
338
339   //SRN: BUG IPAL8996, a usage of method ActiveView without an initialization
340   Handle(V3d_Viewer) viewer = v3dViewer();
341   viewer->InitActiveViews();
342   if (!viewer->MoreActiveViews())
343     return false;
344
345   Handle(V3d_View) view3d = viewer->ActiveView();
346   //SRN: END of fix
347
348   if (view3d.IsNull())
349     return false;
350
351   double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;
352   double aMaxSide;
353
354   view3d->View()->MinMaxValues(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
355
356   if (Xmin == RealFirst() || Ymin == RealFirst() || Zmin == RealFirst() || Xmax == RealLast()
357       || Ymax == RealLast() || Zmax == RealLast())
358     return false;
359
360   aMaxSide = Xmax - Xmin;
361   if (aMaxSide < Ymax - Ymin)
362     aMaxSide = Ymax - Ymin;
363   if (aMaxSide < Zmax - Zmin)
364     aMaxSide = Zmax - Zmin;
365
366   // IPAL21687
367   // The boundary box of the view may be initialized but nullified
368   // (case of infinite objects)
369   if (aMaxSide < Precision::Confusion())
370     return false;
371
372   static float EPS = (float)5.0E-3;
373   theSize = trihedron()->Size();
374   //theNewSize = aMaxSide*aSizeInPercents / 100.0;
375
376   return fabs(theNewSize - theSize) > theSize * EPS || fabs(theNewSize - theSize) > theNewSize * EPS;
377 }
378
379 void XGUI_Viewer::onViewClosed(QMdiSubWindow* theView)
380 {
381   if ( !theView )
382     return;
383
384   emit deleteView( static_cast<XGUI_ViewWindow*>(theView->widget()) );
385   removeView( theView );
386
387   // if this is last view
388   if (myViews.size() == 0) {
389     Standard_Integer aViewsNb = 0;
390     for ( myV3dViewer->InitActiveViews(); myV3dViewer->MoreActiveViews(); myV3dViewer->NextActiveViews())
391       ++aViewsNb;
392     if ( aViewsNb < 2 ) {
393       //clean up presentations before last view is closed
394       myAISContext->RemoveAll(Standard_False);
395     }
396   }
397 }
398
399 /*!Remove view window \a theView from view manager.
400  *And close the last view, if it has \a theView.
401 */
402 void XGUI_Viewer::removeView( QMdiSubWindow* theView )
403 {
404     XGUI_ViewWindow* aWindow = static_cast<XGUI_ViewWindow*>(theView->widget());
405
406     aWindow->disconnect( this );
407     myViews.removeAt( myViews.indexOf( theView ) );
408     if ( myActiveView == theView )
409         myActiveView = 0;
410     if ( myViews.size() == 0 )
411         emit lastViewClosed();
412 }
413
414
415 /*void XGUI_Viewer::onViewMapped()
416 {
417   setTrihedronShown(true);
418 }*/
419
420
421 void XGUI_Viewer::addView(QMdiSubWindow* theView)
422 {
423     XGUI_ViewWindow* aWindow = dynamic_cast<XGUI_ViewWindow*>(theView->widget());
424
425     connect(aWindow, SIGNAL(closed(QMdiSubWindow*)),
426             this,    SLOT(onViewClosed(QMdiSubWindow*)));
427
428     connect(aWindow, SIGNAL(tryClosing(XGUI_ViewWindow*)),
429             this,    SIGNAL(tryCloseView(XGUI_ViewWindow*)));
430
431     connect(aWindow, SIGNAL(mousePressed(XGUI_ViewWindow*, QMouseEvent*)),
432             this,    SLOT(onMousePressed(XGUI_ViewWindow*, QMouseEvent*)));
433
434     connect(aWindow, SIGNAL(mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*)),
435             this,    SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)));
436
437     connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
438             this,    SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)));
439
440     connect(aWindow, SIGNAL(keyPressed(XGUI_ViewWindow*, QKeyEvent*)),
441             this,    SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)));
442
443     connect(aWindow, SIGNAL(keyReleased(XGUI_ViewWindow*, QKeyEvent*)),
444             this,    SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)));
445
446     //connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )),
447     //        this,    SLOT  (onContextMenuRequested( QContextMenuEvent* )));
448     //connect(aWindow, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
449     //        this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
450
451     connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
452             this, SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
453
454     connect(aWindow, SIGNAL(mouseReleased(XGUI_ViewWindow*, QMouseEvent*)),
455             this, SLOT(onMouseReleased(XGUI_ViewWindow*, QMouseEvent*)));
456
457     myViews.append(theView);
458 }
459
460 /*!
461     Emit activated for view \a view.
462 */
463 void XGUI_Viewer::onWindowActivated(QMdiSubWindow* view)
464 {
465   if (view && (view != myActiveView) && (!view->isMinimized())) {
466     qDebug("onWindowActivated");
467     myActiveView = view;
468     ((XGUI_ViewWindow*)myActiveView->widget())->windowActivated();
469     QList<QMdiSubWindow*>::iterator aIt;
470     for (aIt = myViews.begin(); aIt != myViews.end(); ++aIt) {
471       if ((*aIt) != myActiveView) {
472         ((XGUI_ViewWindow*)(*aIt)->widget())->windowDeactivated();
473       }
474     }
475   }
476 }
477
478
479 void XGUI_Viewer::onWindowMinimized(QMdiSubWindow* theWnd)
480 {
481   if (myActiveView == theWnd) {
482     myActiveView = 0;
483     QList<QMdiSubWindow*>::iterator aIt;
484     for (aIt = myViews.begin(); aIt != myViews.end(); ++aIt) {
485       if (!(*aIt)->widget()->isMinimized()) {
486         (*aIt)->raise();
487         onWindowActivated(*aIt);
488         break;
489       }
490     }
491   }
492 }
493
494 /*!
495   SLOT: called on mouse button press, stores current mouse position as start point for transformations
496 */
497 void XGUI_Viewer::onMousePressed(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent)
498 {
499   myStartPnt.setX(theEvent->x()); myStartPnt.setY(theEvent->y());
500   emit mousePress(theWindow, theEvent);
501 }
502
503 /*!
504   SLOT: called on mouse move, processes hilighting
505 */
506 void XGUI_Viewer::onMouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent)
507 {
508   if (!mySelectionEnabled) return;
509
510   myCurPnt.setX(theEvent->x()); myCurPnt.setY(theEvent->y());
511   Handle(V3d_View) aView3d = theWindow->viewPort()->getView();
512   if ( !aView3d.IsNull() ) {
513     myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
514   }
515 }
516
517 /*!
518   SLOT: called on mouse button release, finishes selection
519 */
520 void XGUI_Viewer::onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent)
521 {
522   if (!mySelectionEnabled) return;
523   if (theEvent->button() != Qt::LeftButton) return;
524
525   myEndPnt.setX(theEvent->x()); myEndPnt.setY(theEvent->y());
526   bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
527   
528   //if (!aHasShift) 
529   //  emit deselection();
530
531   if (myStartPnt == myEndPnt) {
532     if (aHasShift && myMultiSelectionEnabled)
533       myAISContext->ShiftSelect();
534     else
535       myAISContext->Select();
536   } else {
537     if (aHasShift && myMultiSelectionEnabled)
538       myAISContext->ShiftSelect(myStartPnt.x(), myStartPnt.y(),
539                                 myEndPnt.x(), myEndPnt.y(),
540                                 theWindow->viewPort()->getView(), false );
541     else
542       myAISContext->Select(myStartPnt.x(), myStartPnt.y(),
543                            myEndPnt.x(), myEndPnt.y(),
544                            theWindow->viewPort()->getView(), false );
545
546     int Nb = myAISContext->NbSelected();
547     if( Nb>1 && !myMultiSelectionEnabled ) {
548       myAISContext->InitSelected();
549       Handle( SelectMgr_EntityOwner ) anOwner = myAISContext->SelectedOwner();
550       if( !anOwner.IsNull() ) {
551         myAISContext->ClearSelected( Standard_False );
552         myAISContext->AddOrRemoveSelected( anOwner, Standard_False );
553       }
554     }
555
556     myAISContext->UpdateCurrentViewer();
557   }
558   emit mouseRelease(theWindow, theEvent);
559   emit selectionChanged();
560 }
561
562 //******************************************************
563 void XGUI_Viewer::setMultiSelectionEnabled(bool toEnable) 
564
565   myMultiSelectionEnabled = toEnable; 
566   updateViewsDrawMode();
567 }
568
569 //******************************************************
570 void XGUI_Viewer::setSelectionEnabled(bool toEnable) 
571
572   mySelectionEnabled = toEnable; 
573   updateViewsDrawMode();
574 }
575
576 //******************************************************
577 void XGUI_Viewer::updateViewsDrawMode() const
578 {
579   foreach(QMdiSubWindow* aWnd, myViews){
580     XGUI_ViewWindow* aView = static_cast<XGUI_ViewWindow*>(aWnd->widget());
581     aView->updateEnabledDrawMode();
582   }
583 }