diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index e2f23e300a..eedb3a6f05 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -62,6 +62,7 @@ set( PCBNEW_DIALOGS dialogs/dialog_enum_pads.cpp dialogs/dialog_enum_pads_base.cpp dialogs/dialog_exchange_modules_base.cpp + dialogs/dialog_exchange_modules.cpp dialogs/dialog_export_idf.cpp dialogs/dialog_export_idf_base.cpp dialogs/dialog_export_vrml_base.cpp @@ -264,7 +265,6 @@ set( PCBNEW_CLASS_SRCS tracepcb.cpp tr_modif.cpp undo_redo.cpp - xchgmod.cpp zones_convert_brd_items_to_polygons_with_Boost.cpp zones_convert_to_polygons_aux_functions.cpp zones_by_polygon.cpp diff --git a/pcbnew/xchgmod.cpp b/pcbnew/dialogs/dialog_exchange_modules.cpp similarity index 91% rename from pcbnew/xchgmod.cpp rename to pcbnew/dialogs/dialog_exchange_modules.cpp index 59fe238550..8004e72e96 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/dialogs/dialog_exchange_modules.cpp @@ -1,14 +1,10 @@ -/** - * @file xchgmod.cpp - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2013-2016 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -42,7 +38,7 @@ #include #include -#include +#include #include #include @@ -50,37 +46,6 @@ static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ); -class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE -{ -private: - PCB_EDIT_FRAME* m_parent; - MODULE* m_currentModule; - static int m_selectionMode; // Remember the last exchange option - -public: - DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* aParent, MODULE* aModule ); - ~DIALOG_EXCHANGE_MODULE() { }; - -private: - void OnSelectionClicked( wxCommandEvent& event ) override; - void OnOkClick( wxCommandEvent& event ) override; - void OnQuit( wxCommandEvent& event ) override; - void BrowseAndSelectFootprint( wxCommandEvent& event ) override; - void ViewAndSelectFootprint( wxCommandEvent& event ) override; - void RebuildCmpList( wxCommandEvent& event ) override; - void init(); - - bool changeCurrentFootprint(); - bool changeSameFootprints( bool aUseValue); - bool changeAllFootprints(); - bool change_1_Module( MODULE* aModule, - const LIB_ID& aNewFootprintFPID, - bool eShowError ); - - BOARD_COMMIT m_commit; -}; - - int DIALOG_EXCHANGE_MODULE::m_selectionMode = 0; @@ -96,14 +61,6 @@ DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE* } -int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module ) -{ - DIALOG_EXCHANGE_MODULE dialog( this, Module ); - - return dialog.ShowQuasiModal(); -} - - void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& event ) { m_selectionMode = m_Selection->GetSelection(); diff --git a/pcbnew/dialogs/dialog_exchange_modules.h b/pcbnew/dialogs/dialog_exchange_modules.h new file mode 100644 index 0000000000..7c225791b5 --- /dev/null +++ b/pcbnew/dialogs/dialog_exchange_modules.h @@ -0,0 +1,65 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2017 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 + */ + +#ifndef DIALOG_EXCHANGE_MODULES_H_ +#define DIALOG_EXCHANGE_MODULES_H_ + +#include + +#include + +class PCB_EDIT_FRAME; +class MODULE; + +class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE +{ +private: + PCB_EDIT_FRAME* m_parent; + MODULE* m_currentModule; + static int m_selectionMode; // Remember the last exchange option + +public: + DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* aParent, MODULE* aModule ); + ~DIALOG_EXCHANGE_MODULE() { }; + +private: + void OnSelectionClicked( wxCommandEvent& event ) override; + void OnOkClick( wxCommandEvent& event ) override; + void OnQuit( wxCommandEvent& event ) override; + void BrowseAndSelectFootprint( wxCommandEvent& event ) override; + void ViewAndSelectFootprint( wxCommandEvent& event ) override; + void RebuildCmpList( wxCommandEvent& event ) override; + void init(); + + bool changeCurrentFootprint(); + bool changeSameFootprints( bool aUseValue); + bool changeAllFootprints(); + bool change_1_Module( MODULE* aModule, + const LIB_ID& aNewFootprintFPID, + bool eShowError ); + + BOARD_COMMIT m_commit; +}; + +#endif // DIALOG_EXCHANGE_MODULES_H_ diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index cfd4bf540e..11cef6dd44 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -1175,3 +1176,11 @@ void PCB_EDIT_FRAME::PythonPluginsReload() #endif #endif } + + +int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module ) +{ + DIALOG_EXCHANGE_MODULE dialog( this, Module ); + + return dialog.ShowQuasiModal(); +}