Move DIALOG_EXCHANGE_MODULE to dialogs dir

DIALOG_EXCHANGE_MODULE class now has its own header file in the
pcbnew/dialogs directory, and the xchgmod.cpp files was moved along with
it. This has two aims:

* (minor) Standardise the location of "base dialog" derived classes,
  like most other dialogs in KiCad.
* (major) Allow inclusion of this dialog class into both legacy-mode
  pcbframe.cpp and into GAL tools.
This commit is contained in:
John Beard 2017-01-31 15:55:02 +08:00 committed by Maciej Suminski
parent e03fef3266
commit 32ddd72038
4 changed files with 77 additions and 46 deletions

View File

@ -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

View File

@ -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 <dick@softplc.com>
* Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>
* 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 <project.h>
#include <pcbnew.h>
#include <dialog_exchange_modules_base.h>
#include <dialog_exchange_modules.h>
#include <wildcards_and_files_ext.h>
#include <kiway.h>
@ -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();

View File

@ -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 <dialog_exchange_modules_base.h>
#include <board_commit.h>
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_

View File

@ -53,6 +53,7 @@
#include <module_editor_frame.h>
#include <dialog_helpers.h>
#include <dialog_plot.h>
#include <dialog_exchange_modules.h>
#include <convert_to_biu.h>
#include <view/view.h>
#include <view/view_controls.h>
@ -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();
}