1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : GroupGUI.cxx
25 // Author : Sergey ANIKIN
30 #include "GroupGUI_GroupDlg.h"
32 #include "GEOMImpl_Types.hxx"
34 #include "SUIT_Session.h"
35 #include "SUIT_Desktop.h"
36 #include "SUIT_MessageBox.h"
37 #include "SalomeApp_Application.h"
38 #include "SalomeApp_Study.h"
39 #include "LightApp_SelectionMgr.h"
41 //=======================================================================
42 // function : GroupGUI()
43 // purpose : Constructor
44 //=======================================================================
45 GroupGUI::GroupGUI(GeometryGUI* parent)
50 //=======================================================================
51 // function : ~GroupGUI()
52 // purpose : Destructor
53 //=======================================================================
59 //=======================================================================
60 // function : OnGUIEvent()
62 //=======================================================================
63 bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
65 SalomeApp_Application* app = getGeometryGUI()->getApp();
66 if ( !app ) return false;
68 getGeometryGUI()->EmitSignalDeactivateDialog();
72 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
73 if ( !appStudy ) return false;
74 _PTR(Study) aStudy = appStudy->studyDS();
76 if ( aStudy->GetProperties()->IsLocked() ) {
77 SUIT_MessageBox::warn1 ( parent,
78 QObject::tr("WRN_WARNING"),
79 QObject::tr("WRN_STUDY_LOCKED"),
80 QObject::tr("BUT_OK") );
84 switch ( theCommandID ) {
86 case 8001: // CREATE GROUP
87 aDlg = new GroupGUI_GroupDlg (GroupGUI_GroupDlg::CreateGroup, getGeometryGUI(), parent);
89 case 801: // EDIT GROUP
94 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
96 aSelMgr->selectedObjects(aList);
98 if (aList.Extent() == 1) {
99 Standard_Boolean aResult = Standard_False;
100 GEOM::GEOM_Object_var anObj =
101 GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult );
103 if (aResult && !CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) {
104 aDlg = new GroupGUI_GroupDlg (GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent);
108 SUIT_MessageBox::warn1(parent, tr("WRN_WARNING"), tr("NO_GROUP"), tr("BUT_OK") );
112 app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
122 //=====================================================================================
124 //=====================================================================================
128 __declspec( dllexport )
130 GEOMGUI* GetLibGUI(GeometryGUI* p)
132 return new GroupGUI(p);