Salome HOME
e2707c163aaa952fb7dbc686ef6ff764be1380d8
[modules/geom.git] / src / BlocksGUI / BlocksGUI.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  CEA
4 //
5 //  This library is free software; you can redistribute it and/or
6 //  modify it under the terms of the GNU Lesser General Public
7 //  License as published by the Free Software Foundation; either
8 //  version 2.1 of the License.
9 //
10 //  This library is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 //  Lesser General Public License for more details.
14 //
15 //  You should have received a copy of the GNU Lesser General Public
16 //  License along with this library; if not, write to the Free Software
17 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 //
19 //  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
20 //
21 //
22 //
23 //  File   : BooleanGUI.cxx
24 //  Author : Julia DOOVSKIKH
25 //  Module : GEOM
26 //  $Header$
27
28 #include "BlocksGUI.h"
29
30 #include "BlocksGUI_QuadFaceDlg.h"
31 #include "BlocksGUI_BlockDlg.h"
32 #include "BlocksGUI_TrsfDlg.h"
33 //#include "BlocksGUI_CheckMultiBlockDlg.h"
34 #include "BlocksGUI_ExplodeDlg.h"
35 #include "BlocksGUI_PropagateDlg.h"
36
37 #include "SALOMEGUI_QtCatchCorbaException.hxx"
38
39 #include "QAD_Desktop.h"
40 #include "QAD_MessageBox.h"
41
42 BlocksGUI* BlocksGUI::myGUIObject = 0;
43
44 //=======================================================================
45 // function : GetBlocksGUI()
46 // purpose  : Get the only BlocksGUI object [ static ]
47 //=======================================================================
48 BlocksGUI* BlocksGUI::GetBlocksGUI()
49 {
50   if ( myGUIObject == 0 )
51     myGUIObject = new BlocksGUI();
52
53   return myGUIObject;
54 }
55
56 //=======================================================================
57 // function : BlocksGUI()
58 // purpose  : Constructor
59 //=======================================================================
60 BlocksGUI::BlocksGUI()
61      : GEOMGUI()
62 {
63 }
64
65 //=======================================================================
66 // function : ~BlocksGUI()
67 // purpose  : Destructor
68 //=======================================================================
69 BlocksGUI::~BlocksGUI()
70 {
71 }
72
73 //=======================================================================
74 // function : OnGUIEvent()
75 // purpose  :
76 //=======================================================================
77 bool BlocksGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
78 {
79   GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
80
81   SALOME_Selection* Sel = SALOME_Selection::Selection
82     (QAD_Application::getDesktop()->getActiveStudy()->getSelection());
83
84   QDialog* aDlg = NULL;
85
86   switch (theCommandID)
87   {
88     case 9999:
89       aDlg = new BlocksGUI_BlockDlg (parent, Sel);
90       break;
91
92     case 9998:
93       aDlg = new BlocksGUI_TrsfDlg (parent, Sel);
94       break;
95
96     case 9997:
97       aDlg = new BlocksGUI_QuadFaceDlg (parent, Sel);
98       break;
99
100     case 9996:
101 //      aDlg = new BlocksGUI_CheckMultiBlockDlg (parent, Sel);
102       QAD_MessageBox::warn1 (parent,
103                              QObject::tr("WRN_WARNING"), 
104                              QObject::tr("WRN_NOT_IMPLEMENTED"),
105                              QObject::tr("BUT_OK"));
106       break;
107
108     case 9995:
109       aDlg = new BlocksGUI_ExplodeDlg (parent, Sel);
110       break;
111     case 99991:
112       aDlg = new BlocksGUI_PropagateDlg (parent, "", Sel);
113       break;
114
115     default:
116       parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
117       break;
118   }
119
120   if (aDlg != NULL)
121     aDlg->show();
122
123   return true;
124 }
125
126 //=====================================================================================
127 // EXPORTED METHODS
128 //=====================================================================================
129 extern "C"
130 {
131   GEOMGUI* GetLibGUI()
132   {
133     return BlocksGUI::GetBlocksGUI();
134   }
135 }