1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
22 // GEOM GEOMGUI : GUI for Geometry component
23 // File : GroupGUI.cxx
24 // Author : Sergey ANIKIN
29 #include "GroupGUI_GroupDlg.h"
31 #include "GEOMImpl_Types.hxx"
33 #include "SUIT_Session.h"
34 #include "SUIT_Desktop.h"
35 #include "SUIT_MessageBox.h"
36 #include "SalomeApp_Application.h"
37 #include "SalomeApp_Study.h"
38 #include "LightApp_SelectionMgr.h"
40 //=======================================================================
41 // function : GroupGUI()
42 // purpose : Constructor
43 //=======================================================================
44 GroupGUI::GroupGUI(GeometryGUI* parent)
49 //=======================================================================
50 // function : ~GroupGUI()
51 // purpose : Destructor
52 //=======================================================================
58 //=======================================================================
59 // function : OnGUIEvent()
61 //=======================================================================
62 bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
64 SalomeApp_Application* app = getGeometryGUI()->getApp();
65 if ( !app ) return false;
67 getGeometryGUI()->EmitSignalDeactivateDialog();
71 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
72 if ( !appStudy ) return false;
73 _PTR(Study) aStudy = appStudy->studyDS();
75 if ( aStudy->GetProperties()->IsLocked() ) {
76 SUIT_MessageBox::warn1 ( parent,
77 QObject::tr("WRN_WARNING"),
78 QObject::tr("WRN_STUDY_LOCKED"),
79 QObject::tr("BUT_OK") );
83 switch ( theCommandID ) {
85 case 8001: // CREATE GROUP
86 aDlg = new GroupGUI_GroupDlg (GroupGUI_GroupDlg::CreateGroup, getGeometryGUI(), parent);
88 case 801: // EDIT GROUP
93 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
95 aSelMgr->selectedObjects(aList);
97 if (aList.Extent() == 1) {
98 Standard_Boolean aResult = Standard_False;
99 GEOM::GEOM_Object_var anObj =
100 GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult );
102 if (aResult && !CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) {
103 aDlg = new GroupGUI_GroupDlg (GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent);
107 SUIT_MessageBox::warn1(parent, tr("WRN_WARNING"), tr("NO_GROUP"), tr("BUT_OK") );
111 app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
121 //=====================================================================================
123 //=====================================================================================
127 __declspec( dllexport )
129 GEOMGUI* GetLibGUI(GeometryGUI* p)
131 return new GroupGUI(p);