--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// internal includes
+#include "DXFPluginGUI.h"
+#include "DXFPlugin_ExportDlg.h"
+#include "DXFPlugin_ImportDlg.h"
+
+// GUI includes
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SalomeApp_Application.h>
+#include <SALOME_ListIteratorOfListIO.hxx>
+#include <LightApp_SelectionMgr.h>
+
+// GEOM includes
+#include <GeometryGUI.h>
+
+//=======================================================================
+// function : DXFPluginGUI()
+// purpose : Constructor
+//=======================================================================
+DXFPluginGUI::DXFPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
+{
+}
+
+//=======================================================================
+// function : ~DXFPluginGUI
+// purpose : Destructor
+//=======================================================================
+DXFPluginGUI::~DXFPluginGUI()
+{
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool DXFPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
+{
+ switch ( theCommandID ) {
+ case 1:
+ return OnGUIEvent("Export_DXF", parent);
+ case 2:
+ return OnGUIEvent("Import_DXF", parent);
+ default:
+ return OnGUIEvent("", parent);
+ }
+ return false;
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool DXFPluginGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
+{
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if (!app) return false;
+
+ getGeometryGUI()->EmitSignalDeactivateDialog();
+
+ SUIT_FileDlg* dialog = NULL;
+ if( theCommandID == "Export_DXF" ) {
+ // Get selected objects
+ LightApp_SelectionMgr* sm = app->selectionMgr();
+ if( !sm ) return false;
+ SALOME_ListIO selectedObjects;
+ sm->selectedObjects( selectedObjects );
+ if( selectedObjects.Extent() == 0 ) {
+ SUIT_MessageBox::warning( app->desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") );
+ }
+ else {
+ SALOME_ListIteratorOfListIO It( selectedObjects );
+ for( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ dialog = new DXFPlugin_ExportDlg( IObject, parent );
+ if( dialog->exec() == QDialog::Accepted )
+ delete dialog;
+ }
+ }
+ }
+ else if (theCommandID == "Import_DXF") {
+ dialog = new DXFPlugin_ImportDlg( parent );
+ if (dialog != NULL)
+ dialog->show();
+ if( dialog->exec() == QDialog::Accepted )
+ delete dialog;
+ }
+ else {
+ app->putInfo( tr("GEOM_PRP_COMMAND").arg( theCommandID ) );
+ }
+
+ return true;
+}
+
+//=====================================================================================
+// EXPORTED METHODS
+//=====================================================================================
+extern "C"
+{
+#ifdef WIN32
+ __declspec( dllexport )
+#endif
+ GEOMGUI* GetLibGUI( GeometryGUI* parent )
+ {
+ return new DXFPluginGUI( parent );
+ }
+}