Salome HOME
e3d4ffc2c28baadc4c9b984cadc0b2b331375ea0
[modules/geom.git] / src / TransformationGUI / TransformationGUI.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   : TransformationGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "TransformationGUI.h"
30 #include "GeometryGUI.h"
31
32 #include "SUIT_Desktop.h"
33
34 #include "SalomeApp_Application.h"
35
36 #include "TransformationGUI_MultiTranslationDlg.h"   // Method MULTI TRANSLATION
37 #include "TransformationGUI_MultiRotationDlg.h"      // Method MULTI ROTATION
38 #include "TransformationGUI_TranslationDlg.h"        // Method TRANSLATION
39 #include "TransformationGUI_RotationDlg.h"           // Method ROTATION
40 #include "TransformationGUI_MirrorDlg.h"             // Method MIRROR
41 #include "TransformationGUI_ScaleDlg.h"              // Method SCALE
42 #include "TransformationGUI_OffsetDlg.h"             // Method OFFSET
43 #include "TransformationGUI_PositionDlg.h"           // Method POSITION
44
45 using namespace std;
46
47 //=======================================================================
48 // function : TransformationGUI()
49 // purpose  : Constructor
50 //=======================================================================
51 TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent)
52 {
53 }
54
55 //=======================================================================
56 // function : ~TransformationGUI()
57 // purpose  : Destructor
58 //=======================================================================
59 TransformationGUI::~TransformationGUI()
60 {
61 }
62
63
64 //=======================================================================
65 // function : OnGUIEvent()
66 // purpose  : 
67 //=======================================================================
68 bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
69 {
70   SalomeApp_Application* app = getGeometryGUI()->getApp();
71   if (!app) return false;
72
73   getGeometryGUI()->EmitSignalDeactivateDialog();
74   QDialog* aDlg = NULL;
75
76   switch (theCommandID)
77   {
78   case 5021: // TRANSLATION
79     aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" );
80     break;
81   case 5022: // ROTATION
82     aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent, "" );
83     break;
84   case 5023: // POSITION
85     aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent, "" );
86     break;
87   case 5024: // MIRROR
88     aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent, "" );
89     break;
90   case 5025: // SCALE
91     aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" );
92     break;
93   case 5026: // OFFSET
94     aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent, "" );
95     break;
96   case 5027: // MULTI TRANSLATION
97     aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" );
98     break;
99   case 5028: // MULTI ROTATION
100     aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" );
101     break;
102   default:
103     app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
104     break;
105   }
106
107   if (aDlg != NULL)
108     aDlg->show();
109
110   return true;
111 }
112
113
114 //=====================================================================================
115 // EXPORTED METHODS
116 //=====================================================================================
117 extern "C"
118 {
119 #ifdef WNT
120         __declspec( dllexport )
121 #endif
122   GEOMGUI* GetLibGUI( GeometryGUI* parent )
123   {
124     return new TransformationGUI( parent );
125   }
126 }