diff --git a/pcbnew/import_dxf/dialog_dxf_import.cpp b/pcbnew/import_dxf/dialog_dxf_import.cpp index 612fba07c4..5f9ff5acf1 100644 --- a/pcbnew/import_dxf/dialog_dxf_import.cpp +++ b/pcbnew/import_dxf/dialog_dxf_import.cpp @@ -27,12 +27,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include //#include #include -#include -#include #include -#include #include #include @@ -42,43 +40,11 @@ #include #include - // Keys to store setup in config #define DXF_IMPORT_LAYER_OPTION_KEY wxT("DxfImportBrdLayer") #define DXF_IMPORT_COORD_ORIGIN_KEY wxT("DxfImportCoordOrigin") #define DXF_IMPORT_LAST_FILE_KEY wxT("DxfImportLastFile") -class DIALOG_DXF_IMPORT : public DIALOG_DXF_IMPORT_BASE -{ -public: - DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent ); - ~DIALOG_DXF_IMPORT(); - - /** - * Function GetImportedItems() - * - * Returns a list of items imported from a DXF file. - */ - const std::list& GetImportedItems() const - { - return m_dxfImporter.GetItemsList(); - } - -private: - PCB_BASE_FRAME* m_parent; - wxConfigBase* m_config; // Current config - DXF2BRD_CONVERTER m_dxfImporter; - - static wxString m_dxfFilename; - static int m_offsetSelection; - static LAYER_NUM m_layer; - - // Virtual event handlers - void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - void OnOKClick( wxCommandEvent& event ); - void OnBrowseDxfFiles( wxCommandEvent& event ); -}; - // Static members of DIALOG_DXF_IMPORT, to remember // the user's choices during the session wxString DIALOG_DXF_IMPORT::m_dxfFilename; @@ -137,15 +103,17 @@ DIALOG_DXF_IMPORT::~DIALOG_DXF_IMPORT() void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event ) { wxString path; + wxString filename; if( !m_dxfFilename.IsEmpty() ) { wxFileName fn( m_dxfFilename ); path = fn.GetPath(); + filename = fn.GetFullName(); } wxFileDialog dlg( m_parent, wxT( "Open File" ), - path, m_dxfFilename, + path, filename, wxT( "dxf Files (*.dxf)|*.dxf" ), wxFD_OPEN|wxFD_FILE_MUST_EXIST ); dlg.ShowModal(); @@ -209,14 +177,12 @@ bool InvokeDXFDialogBoardImport( PCB_BASE_FRAME* aCaller ) if( success ) { - // Prepare the undo list const std::list& list = dlg.GetImportedItems(); PICKED_ITEMS_LIST picklist; BOARD* board = aCaller->GetBoard(); KIGFX::VIEW* view = aCaller->GetGalCanvas()->GetView(); - // Build the undo list & add items to the current view std::list::const_iterator it, itEnd; for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it ) { @@ -245,17 +211,13 @@ bool InvokeDXFDialogModuleImport( PCB_BASE_FRAME* aCaller, MODULE* aModule ) if( success ) { - // Prepare the undo list const std::list& list = dlg.GetImportedItems(); - PICKED_ITEMS_LIST picklist; - MODULE* module = aCaller->GetBoard()->m_Modules; KIGFX::VIEW* view = aCaller->GetGalCanvas()->GetView(); aCaller->SaveCopyInUndoList( module, UR_MODEDIT ); aCaller->OnModify(); - // Build the undo list & add items to the current view std::list::const_iterator it, itEnd; for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it ) { diff --git a/pcbnew/import_dxf/dialog_dxf_import.h b/pcbnew/import_dxf/dialog_dxf_import.h new file mode 100644 index 0000000000..2785732841 --- /dev/null +++ b/pcbnew/import_dxf/dialog_dxf_import.h @@ -0,0 +1,58 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include + +class DIALOG_DXF_IMPORT : public DIALOG_DXF_IMPORT_BASE +{ +public: + DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent ); + ~DIALOG_DXF_IMPORT(); + + /** + * Function GetImportedItems() + * + * Returns a list of items imported from a DXF file. + */ + const std::list& GetImportedItems() const + { + return m_dxfImporter.GetItemsList(); + } + +private: + PCB_BASE_FRAME* m_parent; + wxConfigBase* m_config; // Current config + DXF2BRD_CONVERTER m_dxfImporter; + + static wxString m_dxfFilename; + static int m_offsetSelection; + static LAYER_NUM m_layer; + + // Virtual event handlers + void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + void OnOKClick( wxCommandEvent& event ); + void OnBrowseDxfFiles( wxCommandEvent& event ); +};