Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/geom.git] / src / OperationGUI / OperationGUI.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : OperationGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "OperationGUI.h"
30
31 #include "SUIT_Session.h"
32 #include "SUIT_Desktop.h"
33 #include "SalomeApp_Application.h"
34
35 #include <TopTools_MapOfShape.hxx>
36 #include <TopExp_Explorer.hxx>
37 #include <Precision.hxx>
38
39 #include "OperationGUI_PartitionDlg.h"   // Method PARTITION
40 #include "OperationGUI_ArchimedeDlg.h"   // Method ARCHIMEDE
41 #include "OperationGUI_FilletDlg.h"      // Method FILLET
42 #include "OperationGUI_ChamferDlg.h"     // Method CHAMFER
43
44 #include "OperationGUI_ClippingDlg.h"
45
46 using namespace std;
47
48 OperationGUI* OperationGUI::myGUIObject = 0;
49
50 //=======================================================================
51 // function : GetOperationGUI()
52 // purpose  : Get the only OperationGUI object [ static ]
53 //=======================================================================
54 OperationGUI* OperationGUI::GetOperationGUI( GeometryGUI* parent )
55 {
56   if ( myGUIObject == 0 ) {
57     // init OperationGUI only once
58     myGUIObject = new OperationGUI( parent );
59   }
60   return myGUIObject;
61 }
62
63 //=======================================================================
64 // function : OperationGUI()
65 // purpose  : Constructor
66 //=======================================================================
67 OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent)
68 {
69 }
70
71
72 //=======================================================================
73 // function : ~OperationGUI()
74 // purpose  : Destructor
75 //=======================================================================
76 OperationGUI::~OperationGUI()
77 {
78 }
79
80
81 //=======================================================================
82 // function : OnGUIEvent()
83 // purpose  : 
84 //=======================================================================
85 bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
86 {
87   getGeometryGUI()->EmitSignalDeactivateDialog();
88
89   switch (theCommandID)
90   {
91   case 503: (new OperationGUI_PartitionDlg(getGeometryGUI(), parent))->show(); break;
92   case 504: (new OperationGUI_ArchimedeDlg(getGeometryGUI(), parent))->show(); break;
93   case 505: (new OperationGUI_FilletDlg   (getGeometryGUI(), parent))->show(); break;
94   case 506: (new OperationGUI_ChamferDlg  (getGeometryGUI(), parent))->show(); break;
95   case 507: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
96   default:
97     getGeometryGUI()->getApp()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
98   }
99
100   return true;
101 }
102
103 //=====================================================================================
104 // EXPORTED METHODS
105 //=====================================================================================
106 extern "C"
107 {
108 #ifdef WNT
109         __declspec( dllexport )
110 #endif
111   GEOMGUI* GetLibGUI(GeometryGUI* parent)
112   {
113     return OperationGUI::GetOperationGUI(parent);
114   }
115 }