]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI.cxx
Salome HOME
357507e17aef52a342c17ea19f8c2e5a60beea0d
[modules/geom.git] / src / GEOMGUI / GeometryGUI.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GeometryGUI.cxx
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 using namespace std;
30 #include "GeometryGUI.h"
31
32 // Open CASCADE Includes
33 #include <Prs3d_Drawer.hxx>
34 #include <Prs3d_IsoAspect.hxx>
35
36 // SALOME Includes
37 #include "QAD_RightFrame.h"
38 #include "QAD_Config.h"
39
40 #include "OCCViewer_Viewer3d.h"
41 #include "OCCViewer_ViewPort3d.h"
42 #include "VTKViewer_ViewFrame.h"
43
44 #include "SALOME_Selection.h"
45
46 /* The object itself created in the static method 'GetOrCreateGEOMBase()' */
47 static GEOMContext* GeomGUI = 0;
48
49 typedef bool OGE(int, QAD_Desktop*);
50 typedef bool OMP(QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*);
51 typedef void BP(const Handle(SALOME_InteractiveObject)&);
52 typedef bool CP(QAD_Desktop*, QPopupMenu*, const QString&,
53                 const QString&, const QString&);
54
55 //=======================================================================
56 // function : GeometryGUI()
57 // purpose  : Constructor
58 //=======================================================================
59 GeometryGUI::GeometryGUI() :
60   QObject()
61 {
62 }
63
64
65 //=======================================================================
66 // function : ~GeometryGUI()
67 // purpose  : Destructor
68 //=======================================================================
69 GeometryGUI::~GeometryGUI()
70 {
71 }
72
73
74 //=======================================================================
75 // function : GetOrCreateGEOMBase()
76 // purpose  : Gets or create an object 'GEOMBase' with initialisations
77 //          : Returns 'GeomGUI' as a pointer
78 //=======================================================================
79 GEOMContext* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop)
80 {
81   GeomGUI = GeomGUI->GetOrCreateGeomGUI(desktop);
82   return GeomGUI;
83 }
84
85
86 //=======================================================================
87 // function : OnGUIEvent() [static]
88 // purpose  : manage all events on GUI
89 //=======================================================================
90 bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
91 {
92   GeometryGUI::GetOrCreateGeometryGUI(parent);
93
94   QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar();
95   bool ViewOCC;
96
97   if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
98     ViewOCC = true;    
99   else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
100     ViewOCC = false;
101   else
102     return false;
103
104   Mb->setItemEnabled(404, ViewOCC);//SKETCHER
105   Mb->setItemEnabled(406, ViewOCC);//SKETCHER
106
107   Mb->setItemEnabled(603, ViewOCC);//SuppressFace
108   Mb->setItemEnabled(604, ViewOCC);//SuppressHole
109   
110   Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings
111   Mb->setItemEnabled(414, ViewOCC);// Isos Settings
112
113   if(theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT
114      theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC
115      theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE
116      theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X
117      theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y
118      theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE
119      theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END
120      theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE
121      theCommandID == 4051 || // SKETCHER - MENU - SET PLANE
122      theCommandID == 4052 || // SKETCHER - MENU - TANGENT
123      theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR
124      theCommandID == 4061 || // SKETCHER - MENU - LENGTH
125      theCommandID == 4062 || // SKETCHER - MENU - ANGLE
126      theCommandID == 4063 || // SKETCHER - MENU - RADIUS
127      theCommandID == 4064 || // SKETCHER - MENU - X
128      theCommandID == 4065) {  // SKETCHER - MENU - Y
129     if(!GeomGUI->LoadLibrary("libEntityGUI.so")) 
130       return false;
131   }
132   else {
133     if(GeomGUI->myState == 2) {
134       Mb->setItemEnabled(405, false);//SKETCHER
135       GeomGUI->GetSketcher().Clear();
136       GeomGUI->myState = -1;
137     }
138
139     if(theCommandID == 111 ||  // MENU FILE - IMPORT BREP
140        theCommandID == 112 ||  // MENU FILE - IMPORT IGES
141        theCommandID == 113 ||  // MENU FILE - IMPORT STEP
142        theCommandID == 121 ||  // MENU FILE - EXPORT BREP
143        theCommandID == 122 ||  // MENU FILE - EXPORT IGES
144        theCommandID == 123 ||  // MENU FILE - EXPORT STEP
145        theCommandID == 31 ||   // MENU EDIT - COPY
146        theCommandID == 33 ||   // MENU EDIT - DELETE
147        theCommandID == 411 ||  // MENU SETTINGS - ADD IN STUDY
148        theCommandID == 412 ||  // MENU SETTINGS - SHADING COLOR
149        theCommandID == 413 ||  // MENU SETTINGS - ISOS
150        theCommandID == 414 ||  // MENU SETTINGS - STEP VALUE FOR SPIN BOXES
151        theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY
152        theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT
153        theCommandID == 8032 || // POPUP VIEWER - COLOR
154        theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY
155        theCommandID == 8034 || // POPUP VIEWER - ISOS
156        theCommandID == 804 ||  // POPUP VIEWER - ADD IN STUDY
157        theCommandID == 901 ||  // OBJECT BROWSER - RENAME
158        theCommandID == 9024) { // OBJECT BROWSER - OPEN
159       if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) 
160         return false;
161     }
162     else if(theCommandID == 211 ||  // MENU VIEW - WIREFRAME/SHADING
163             theCommandID == 212 ||  // MENU VIEW - DISPLAY ALL
164             theCommandID == 213 ||  // MENU VIEW - DISPLAY ONLY
165             theCommandID == 214 ||  // MENU VIEW - ERASE ALL
166             theCommandID == 215 ||  // MENU VIEW - ERASE ONLY
167             theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING
168       if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) 
169         return false;
170     }
171     else if(theCommandID == 4011 || // MENU BASIC - POINT
172             theCommandID == 4012 || // MENU BASIC - LINE
173             theCommandID == 4013 || // MENU BASIC - CIRCLE
174             theCommandID == 4014 || // MENU BASIC - ELLIPSE
175             theCommandID == 4015 || // MENU BASIC - ARC
176             theCommandID == 4016 || // MENU BASIC - VECTOR
177             theCommandID == 4017 || // MENU BASIC - PLANE
178             theCommandID == 4018) { // MENU BASIC - WPLANE
179       if(!GeomGUI->LoadLibrary("libBasicGUI.so")) 
180         return false;
181     }
182     else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX
183             theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER
184             theCommandID == 4023 || // MENU PRIMITIVE - SPHERE
185             theCommandID == 4024 || // MENU PRIMITIVE - TORUS
186             theCommandID == 4025) { // MENU PRIMITIVE - CONE
187       if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so"))
188         return false;
189     }
190     else if(theCommandID == 4031 || // MENU GENERATION - PRISM
191             theCommandID == 4032 || // MENU GENERATION - REVOLUTION
192             theCommandID == 4033 || // MENU GENERATION - FILLING
193             theCommandID == 4034) { // MENU GENERATION - PIPE
194       if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) 
195         return false;
196     }
197     else if(theCommandID == 404 ||  // SKETCHER
198             theCommandID == 407) {  // MENU ENTITY - EXPLODE
199       if(!GeomGUI->LoadLibrary("libEntityGUI.so")) 
200         return false;
201     }
202     else if(theCommandID == 4081 || // MENU BUILD - EDGE
203             theCommandID == 4082 || // MENU BUILD - WIRE
204             theCommandID == 4083 || // MENU BUILD - FACE
205             theCommandID == 4084 || // MENU BUILD - SHELL
206             theCommandID == 4085 || // MENU BUILD - SOLID
207             theCommandID == 4086) { // MENU BUILD - COMPUND
208       if(!GeomGUI->LoadLibrary("libBuildGUI.so")) 
209         return false;
210     }
211     else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE
212             theCommandID == 5012 || // MENU BOOLEAN - COMMON
213             theCommandID == 5013 || // MENU BOOLEAN - CUT
214             theCommandID == 5014) { // MENU BOOLEAN - SECTION
215       if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) 
216         return false;
217     }
218     else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION
219             theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION
220             theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR
221             theCommandID == 5024 || // MENU TRANSFORMATION - SCALE
222             theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION
223             theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION
224       if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) 
225         return false;
226     }
227     else if(theCommandID == 503 ||  // MENU OPERATION - PARTITION
228             theCommandID == 504 ||  // MENU OPERATION - ARCHIMEDE
229             theCommandID == 505 ||  // MENU OPERATION - FILLET
230             theCommandID == 506) {  // MENU OPERATION - CHAMFER
231       if(!GeomGUI->LoadLibrary("libOperationGUI.so")) 
232         return false;
233     }
234     else if(theCommandID == 601 ||  // MENU REPAIR - SEWING
235             theCommandID == 602 ||  // MENU REPAIR - ORIENTATION
236             theCommandID == 603 ||  // MENU REPAIR - SUPPRESS FACES
237             theCommandID == 604) {  // MENU REPAIR - SUPPRESS HOLE
238       if(!GeomGUI->LoadLibrary("libRepairGUI.so")) 
239         return false;
240     }
241     else if(theCommandID == 701 ||  // MENU MEASURE - PROPERTIES
242             theCommandID == 702 ||  // MENU MEASURE - CDG
243             theCommandID == 703 ||  // MENU MEASURE - INERTIA
244             theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX
245             theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE
246             theCommandID == 705 ||  // MENU MEASURE - TOLERANCE
247             theCommandID == 706 ||  // MENU MEASURE - WHATIS
248             theCommandID == 707) {  // MENU MEASURE - CHECK
249       if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) 
250         return false;
251     }
252     else
253       return false;
254   }
255   
256   //Load Function OnGUIEvent
257   OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnGUIEvent");
258   OGE (*f1) = NULL;
259   if(osdF != NULL) {
260     f1 = (bool (*) (int, QAD_Desktop*)) osdF;
261     (*f1)(theCommandID, parent);
262   }
263   else
264     return false;
265
266   return true;
267 }
268
269
270 //=================================================================================
271 // function : OnKeyPress()
272 // purpose  : [static]
273 //=================================================================================
274 bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
275 {
276   GeometryGUI::GetOrCreateGeometryGUI(parent);
277
278   if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
279     return false;
280   else
281   return true;
282 }
283
284
285 //=================================================================================
286 // function : OnMouseMove()
287 // purpose  : [static] manage mouse events
288 //=================================================================================
289 bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
290 {
291   GeometryGUI::GetOrCreateGeometryGUI(parent);
292
293   if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
294     return false;
295
296   if(GeomGUI->myState == 2) {
297     OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
298     GeomGUI->GetSketcher().MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
299   }
300
301   return true;
302 }
303
304
305 //=================================================================================
306 // function : 0nMousePress()
307 // purpose  : [static] manage mouse events
308 //=================================================================================
309 bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
310 {
311   GeometryGUI::GetOrCreateGeometryGUI(parent);
312
313   if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
314     return false;
315
316   if(GeomGUI->myState == 2) {
317     GeomGUI->GetSketcher().ValidateEdge();
318     if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) {
319       QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar();
320       Mb->setItemEnabled(405, true);  // SKETCH CONTRAINTS
321     }
322   }
323   else if(GeomGUI->myState == 0) {
324     if(!GeomGUI->LoadLibrary("libBasicGUI.so")) 
325       return false;
326
327     //Load Function OnMousePress
328     OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnMousePress");
329     OMP (*f1) = NULL;
330     if(osdF != NULL) {
331       f1 = (bool (*) (QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*)) osdF;
332       (*f1)(pe, parent, studyFrame);
333     }
334   }
335
336   return false;
337 }
338
339
340 //=================================================================================
341 // function : SetSettings()
342 // purpose  : [static]
343 //=================================================================================
344 bool GeometryGUI::SetSettings(QAD_Desktop* parent)
345 {
346   GeometryGUI::GetOrCreateGeometryGUI(parent);
347   QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar();
348   QAD_Study* ActiveStudy = parent->getActiveStudy();
349
350   /* Wireframe or Shading */
351   int DisplayMode = 0;
352   bool ViewOCC = false;
353   if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
354     OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
355     Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
356     DisplayMode = ic->DisplayMode();
357     ViewOCC = true;
358   }
359   else if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
360     VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
361     DisplayMode = myRenderInter->GetDisplayMode();
362   }
363
364   if(DisplayMode == 1)
365     Mb->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
366   else
367     Mb->changeItem(211, tr("GEOM_MEN_SHADING"));
368
369
370   /* Add in Study */
371   QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy");
372   int Settings_AddInStudy;
373   if(!AddInStudy.isEmpty())
374     Settings_AddInStudy = AddInStudy.toInt();
375   else
376     Settings_AddInStudy = 1;
377   Mb->setItemChecked(411, Settings_AddInStudy);
378
379
380   /* step value */
381   QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
382   if(S.isEmpty())
383     QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100");
384
385
386   /* isos */
387   int count = ActiveStudy->getStudyFramesCount();
388   for(int i = 0; i < count; i++) {
389     if(ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC) {
390       OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
391       Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
392       
393       QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
394       QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
395       if(!IsoU.isEmpty())
396         ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
397       if(!IsoV.isEmpty())
398         ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
399     }
400   }
401
402   Mb->setItemEnabled(404, ViewOCC);//SKETCHER
403   Mb->setItemEnabled(405, false);//SKETCHER
404   Mb->setItemEnabled(406, ViewOCC);//SKETCHER
405
406   Mb->setItemEnabled(603, ViewOCC);//SuppressFace
407   Mb->setItemEnabled(604, ViewOCC);//SuppressHole
408   
409   Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings
410   Mb->setItemEnabled(414, ViewOCC);// Isos Settings
411
412   return true;
413 }
414
415
416 //=================================================================================
417 // function : DefinePopup()
418 // purpose  : [static]
419 //=================================================================================
420 void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
421 {
422   GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop());
423
424   QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
425   SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection());
426   theObject = "";
427   theContext = "";
428
429
430   if((theParent.compare("Viewer") == 0)) {
431     if(GeomGUI->myState == 2) 
432       theContext = "Sketch";
433     else if(Sel->IObjectCount() == 0)
434       theContext = "NothingSelected";
435   }
436
437   if(Sel->IObjectCount() == 1) {
438     Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
439     if(IO->hasEntry()) {
440       SALOMEDS::SObject_var sobj = ActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry());
441       if(!sobj->_is_nil()) {
442         SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent();
443         if(strcmp(scomp->GetID(), IO->getEntry()) == 0) {
444           // component is selected
445           theObject = "Component";
446         }
447       }
448     }
449   }
450
451   return;
452 }
453
454
455 //=================================================================================
456 // function : CustomPopup()
457 // purpose  : [static]
458 //=================================================================================
459 bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
460                               const QString& theParent, const QString& theObject)
461 {
462   GeometryGUI::GetOrCreateGeometryGUI(parent);
463
464   if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
465     if(theParent.compare("Viewer") == 0) {
466       if(theContext.compare("Sketch") == 0) {
467         SketchStatus myCS = GeomGUI->GetSketcher().GetCurrentStatus();
468         popup->setCheckable(TRUE);
469         if(myCS == SEGMENT) {
470           popup->setItemChecked(4041, true);  //Sketch Segment Menu
471           popup->setItemChecked(4042, false); //Sketch Arc Menu
472         }
473         else if(myCS == ARC_CHORD) {
474           popup->setItemChecked(4041, false); //Sketch Segment Menu
475           popup->setItemChecked(4042, true);  //Sketch Arc Menu
476         }   
477         return true;
478       }
479     }
480   }
481
482   if(!GeomGUI->LoadLibrary("libGEOMBase.so")) 
483     return false;
484
485   //Load Function BuildPresentation
486   OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("CustomPopup");
487   CP (*f1) = NULL;
488   if(osdF != NULL) {
489     f1 = (bool (*) (QAD_Desktop*, QPopupMenu*, const QString&,
490                     const QString&, const QString&)) osdF;
491     (*f1)(parent, popup, theContext, theParent, theObject);
492   }
493   else
494     return false;
495
496   return true;
497 }
498
499
500 //=================================================================================
501 // function : activeStudyChanged()
502 // purpose  : static
503 //=================================================================================
504 void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
505 {
506   GeometryGUI::GetOrCreateGeometryGUI(parent); 
507
508   if(GeomGUI != 0) {
509     QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar();
510     if(GeomGUI->myState == 2) {
511       Mb->setItemEnabled(405, false);//SKETCHER
512       GeomGUI->GetSketcher().Clear();
513       GeomGUI->myState = -1;
514     }
515
516     bool ViewOCC = false;
517     if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) 
518       ViewOCC = true;
519
520     Mb->setItemEnabled(404, ViewOCC);//SKETCHER
521     Mb->setItemEnabled(406, ViewOCC);//SKETCHER
522
523     Mb->setItemEnabled(603, ViewOCC);//SuppressFace
524     Mb->setItemEnabled(604, ViewOCC);//SuppressHole
525   
526     Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings
527     Mb->setItemEnabled(414, ViewOCC);// Isos Settings
528
529     GeomGUI->EmitSignalCloseAllDialogs();
530     GeomGUI = 0;
531   }
532   return;
533 }
534
535
536 //=======================================================================
537 // function : BuildPresentation()
538 // purpose  : static
539 //=======================================================================
540 void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
541 {
542   GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop());
543
544   if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) 
545     return;
546
547   //Load Function BuildPresentation
548   OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("BuildPresentation");
549   BP (*f1) = NULL;
550   if(osdF != NULL) {
551     f1 = (void (*) (const Handle(SALOME_InteractiveObject)&)) osdF;
552     (*f1)(theIO);
553   }
554   return;
555 }
556
557
558 //=================================================================================
559 // EXPORTED METHODS
560 //=================================================================================
561 extern "C"
562 {
563   bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
564   {return GeometryGUI::OnGUIEvent(theCommandID, parent);}
565
566   bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
567   {return GeometryGUI::OnKeyPress(pe, parent, studyFrame);}
568
569   bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
570   {return GeometryGUI::OnMousePress(pe, parent, studyFrame);}
571
572   bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
573   {return GeometryGUI::OnMouseMove(pe, parent, studyFrame);}
574
575   bool SetSettings(QAD_Desktop* parent)
576   {return GeometryGUI::SetSettings(parent);}
577
578   bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
579                      const QString & theParent, const QString & theObject)
580   {return GeometryGUI::CustomPopup(parent, popup, theContext, theParent, theObject);}
581
582   void definePopup(QString & theContext, QString & parent, QString & theObject)
583   {GeometryGUI::DefinePopup(theContext, parent, theObject);}
584   
585   bool activeStudyChanged(QAD_Desktop* parent)
586   {GeometryGUI::activeStudyChanged(parent);}
587
588   void buildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
589   {GeometryGUI::BuildPresentation(theIO);}
590
591   void supportedViewType(int* buffer, int bufferSize)
592   {
593     if(!buffer || !bufferSize) return;
594     buffer[0] = (int)VIEW_OCC;
595     if (--bufferSize) buffer[1] = (int)VIEW_VTK;
596   }
597 }