Salome HOME
fb2a849b40c7f9c046756d3ae0fcd10540f431c9
[modules/geom.git] / src / AdvancedGUI / AdvancedGUI.cxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  File   : AdvancedGUI.cxx
21 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22 //
23 #include "AdvancedGUI.h"
24
25 #include "GeometryGUI.h"
26 //#include "GeometryGUI_Operations.h"
27
28 #include <SUIT_Desktop.h>
29 #include <SalomeApp_Application.h>
30
31 #include "AdvancedGUI_PipeTShapeDlg.h"
32 #include "AdvancedGUI_DividedDiskDlg.h"
33 #include "AdvancedGUI_DividedCylinderDlg.h"
34 #include "AdvancedGUI_SmoothingSurfaceDlg.h"
35 //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
36
37 #include <QDialog>
38
39 #include <iostream>
40
41 //=======================================================================
42 // function : AdvancedGUI()
43 // purpose  : Constructor
44 //=======================================================================
45 AdvancedGUI::AdvancedGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
46 {
47 }
48
49 //=======================================================================
50 // function : ~AdvancedGUI
51 // purpose  : Destructor
52 //=======================================================================
53 AdvancedGUI::~AdvancedGUI()
54 {
55 }
56
57 //=======================================================================
58 // function : OnGUIEvent()
59 // purpose  : 
60 //=======================================================================
61 bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
62 {
63   switch ( theCommandID ) {
64   case 1:
65     return OnGUIEvent("TShape_Basic", parent);
66   case 2:
67     return OnGUIEvent("DividedDisk", parent);
68   case 3:
69     return OnGUIEvent("DividedCylinder", parent);
70   case 4:
71     return OnGUIEvent("SmoothingSurface", parent);
72   //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
73   default:
74     return OnGUIEvent("", parent);
75   }
76   return false;
77 }
78
79 //=======================================================================
80 // function : OnGUIEvent()
81 // purpose  : 
82 //=======================================================================
83 bool AdvancedGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
84 {
85   SalomeApp_Application* app = getGeometryGUI()->getApp();
86   if ( !app ) return false;
87
88   getGeometryGUI()->EmitSignalDeactivateDialog();
89
90   QDialog* aDlg = NULL;
91
92   if (theCommandID == "TShape_Basic") {
93     aDlg = new AdvancedGUI_PipeTShapeDlg( getGeometryGUI(), parent );
94   }
95   //else if (theCommandID == "TShape_Groups") {
96   //  aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent );
97   //}
98   else if (theCommandID == "DividedDisk") {
99     aDlg = new AdvancedGUI_DividedDiskDlg( getGeometryGUI(), parent );
100   }
101   else if (theCommandID == "DividedCylinder") {
102     aDlg = new AdvancedGUI_DividedCylinderDlg( getGeometryGUI(), parent );
103   }
104   else if (theCommandID == "SmoothingSurface") {
105     aDlg = new AdvancedGUI_SmoothingSurfaceDlg( getGeometryGUI(), parent );
106   }
107   //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
108   else {
109     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
110   }
111
112   if ( aDlg != NULL )
113     aDlg->show();
114
115   return true;
116 }
117
118 //=====================================================================================
119 // EXPORTED METHODS
120 //=====================================================================================
121 extern "C"
122 {
123 #ifdef WIN32
124   __declspec( dllexport )
125 #endif
126   GEOMPluginGUI* GetLibGUI( GeometryGUI* parent )
127   {
128     return new AdvancedGUI( parent );
129   }
130 }