1 // Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include "ACISPluginGUI.h"
22 #include "ACISPlugin_ExportDlg.h"
23 #include "ACISPlugin_ImportDlg.h"
26 #include <SUIT_Desktop.h>
27 #include <SUIT_MessageBox.h>
28 #include <SalomeApp_Application.h>
29 #include <SALOME_ListIteratorOfListIO.hxx>
30 #include <LightApp_SelectionMgr.h>
33 #include <GeometryGUI.h>
35 //=======================================================================
36 // function : ACISPluginGUI()
37 // purpose : Constructor
38 //=======================================================================
39 ACISPluginGUI::ACISPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
43 //=======================================================================
44 // function : ~ACISPluginGUI
45 // purpose : Destructor
46 //=======================================================================
47 ACISPluginGUI::~ACISPluginGUI()
51 //=======================================================================
52 // function : OnGUIEvent()
54 //=======================================================================
55 bool ACISPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
57 switch ( theCommandID ) {
59 return OnGUIEvent("Export_ACIS", parent);
61 return OnGUIEvent("Import_ACIS", parent);
63 return OnGUIEvent("", parent);
68 //=======================================================================
69 // function : OnGUIEvent()
71 //=======================================================================
72 bool ACISPluginGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
74 SalomeApp_Application* app = getGeometryGUI()->getApp();
75 if (!app) return false;
77 getGeometryGUI()->EmitSignalDeactivateDialog();
79 SUIT_FileDlg* dialog = NULL;
80 if( theCommandID == "Export_ACIS" ) {
81 // Get selected objects
82 LightApp_SelectionMgr* sm = app->selectionMgr();
83 if( !sm ) return false;
84 SALOME_ListIO selectedObjects;
85 sm->selectedObjects( selectedObjects );
86 if( selectedObjects.Extent() == 0 ) {
87 SUIT_MessageBox::warning( app->desktop(),
88 QObject::tr("WRN_WARNING"),
89 QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") );
92 SALOME_ListIteratorOfListIO It( selectedObjects );
93 for( ; It.More(); It.Next() ) {
94 Handle(SALOME_InteractiveObject) IObject = It.Value();
95 dialog = new ACISPlugin_ExportDlg( IObject, parent );
96 if( dialog->exec() == QDialog::Accepted )
101 else if (theCommandID == "Import_ACIS") {
102 dialog = new ACISPlugin_ImportDlg( parent );
105 if( dialog->exec() == QDialog::Accepted )
109 app->putInfo( tr("GEOM_PRP_COMMAND").arg( theCommandID ) );
115 //=====================================================================================
117 //=====================================================================================
121 __declspec( dllexport )
123 GEOMGUI* GetLibGUI( GeometryGUI* parent )
125 return new ACISPluginGUI( parent );