Salome HOME
Windows porting
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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
34 #include <TopTools_MapOfShape.hxx>
35 #include <TopExp_Explorer.hxx>
36 #include <Precision.hxx>
37
38 #include "OperationGUI_PartitionDlg.h"   // Method PARTITION
39 #include "OperationGUI_ArchimedeDlg.h"   // Method ARCHIMEDE
40 #include "OperationGUI_FilletDlg.h"      // Method FILLET
41 #include "OperationGUI_ChamferDlg.h"     // Method CHAMFER
42
43 #include "OperationGUI_ClippingDlg.h"
44
45 using namespace std;
46
47 OperationGUI* OperationGUI::myGUIObject = 0;
48
49 //=======================================================================
50 // function : GetOperationGUI()
51 // purpose  : Get the only OperationGUI object [ static ]
52 //=======================================================================
53 OperationGUI* OperationGUI::GetOperationGUI( GeometryGUI* parent )
54 {
55   if ( myGUIObject == 0 ) {
56     // init OperationGUI only once
57     myGUIObject = new OperationGUI( parent );
58   }
59   return myGUIObject;
60 }
61
62 //=======================================================================
63 // function : OperationGUI()
64 // purpose  : Constructor
65 //=======================================================================
66 OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent)
67 {
68 }
69
70
71 //=======================================================================
72 // function : ~OperationGUI()
73 // purpose  : Destructor
74 //=======================================================================
75 OperationGUI::~OperationGUI()
76 {
77 }
78
79
80 //=======================================================================
81 // function : OnGUIEvent()
82 // purpose  : 
83 //=======================================================================
84 bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
85 {
86   getGeometryGUI()->EmitSignalDeactivateDialog();
87   
88   switch ( theCommandID )
89   {
90     case 503: // PARTITION
91       ( new OperationGUI_PartitionDlg( parent, "" ) )->show();
92     break;
93     case 504: // ARCHIMEDE
94       new OperationGUI_ArchimedeDlg( getGeometryGUI(), parent );
95     break;
96     case 505: // FILLET
97       new OperationGUI_FilletDlg( parent );     
98     break;
99     case 506: // CHAMFER
100       new OperationGUI_ChamferDlg( parent );
101     break;
102     case 507: // CLIPPING RANGE
103       ( new OperationGUI_ClippingDlg( parent, "" ) )->show();
104     break;
105     default:
106       SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
107     break;
108   }
109   
110   return true;
111 }
112
113 //=====================================================================================
114 // EXPORTED METHODS
115 //=====================================================================================
116 extern "C"
117 {
118   GEOMGUI* GetLibGUI(GeometryGUI* parent)
119   {
120     return OperationGUI::GetOperationGUI(parent);
121   }
122 }