diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index 2b93b9e3eb..ce51f5fd7a 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -69,6 +69,8 @@ #include #include +#include + using namespace std::placeholders; @@ -124,56 +126,6 @@ public: }; -/** - * Helper widget to add controls to a wxFileDialog to set netlist configuration options. - */ -class NETLIST_OPTIONS_HELPER : public wxPanel -{ -public: - NETLIST_OPTIONS_HELPER( wxWindow* aParent ) - : wxPanel( aParent ) - { - m_cbOmitExtras = new wxCheckBox( this, wxID_ANY, _( "Omit extra information" ) ); - m_cbOmitNets = new wxCheckBox( this, wxID_ANY, _( "Omit nets" ) ); - m_cbOmitFpUuids = new wxCheckBox( this, wxID_ANY, - _( "Do not prefix path with footprint UUID." ) ); - - wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL ); - sizer->Add( m_cbOmitExtras, 0, wxALL, 5 ); - sizer->Add( m_cbOmitNets, 0, wxALL, 5 ); - sizer->Add( m_cbOmitFpUuids, 0, wxALL, 5 ); - - SetSizerAndFit( sizer ); - } - - int GetNetlistOptions() const - { - int options = 0; - - if( m_cbOmitExtras->GetValue() ) - options |= CTL_OMIT_EXTRA; - - if( m_cbOmitNets->GetValue() ) - options |= CTL_OMIT_NETS; - - if( m_cbOmitFpUuids->GetValue() ) - options |= CTL_OMIT_FP_UUID; - - return options; - } - - static wxWindow* Create( wxWindow* aParent ) - { - return new NETLIST_OPTIONS_HELPER( aParent ); - } - -protected: - wxCheckBox* m_cbOmitExtras; - wxCheckBox* m_cbOmitNets; - wxCheckBox* m_cbOmitFpUuids; -}; - - BOARD_EDITOR_CONTROL::BOARD_EDITOR_CONTROL() : PCB_TOOL_BASE( "pcbnew.EditorControl" ), m_frame( nullptr ), @@ -478,7 +430,7 @@ int BOARD_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent ) _( "KiCad board netlist files" ) + AddFileExtListToFilter( { "pcb_net" } ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - dlg.SetExtraControlCreator( &NETLIST_OPTIONS_HELPER::Create ); + dlg.SetExtraControlCreator( &LEGACYFILEDLG_NETLIST_OPTIONS::Create ); if( dlg.ShowModal() == wxID_CANCEL ) return 0; @@ -494,8 +446,8 @@ int BOARD_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent ) return 0; } - const NETLIST_OPTIONS_HELPER* noh = - dynamic_cast( dlg.GetExtraControl() ); + const LEGACYFILEDLG_NETLIST_OPTIONS* noh = + dynamic_cast( dlg.GetExtraControl() ); wxCHECK( noh, 0 ); NETLIST netlist; diff --git a/pcbnew/widgets/legacyfiledlg_netlist_options.h b/pcbnew/widgets/legacyfiledlg_netlist_options.h new file mode 100644 index 0000000000..e177aecc09 --- /dev/null +++ b/pcbnew/widgets/legacyfiledlg_netlist_options.h @@ -0,0 +1,75 @@ +/* +* This program source code file is part of KiCad, a free EDA CAD application. +* +* Copyright (C) 2022 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 3 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, see . +*/ + +#ifndef LEGACYFILEDLG_NETLIST_OPTIONS_H_ +#define LEGACYFILEDLG_NETLIST_OPTIONS_H_ + +#include +#include +#include + +/** + * Helper widget to add controls to a wxFileDialog to set netlist configuration options. + */ +class LEGACYFILEDLG_NETLIST_OPTIONS : public wxPanel +{ +public: + LEGACYFILEDLG_NETLIST_OPTIONS( wxWindow* aParent ) : wxPanel( aParent ) + { + m_cbOmitExtras = new wxCheckBox( this, wxID_ANY, _( "Omit extra information" ) ); + m_cbOmitNets = new wxCheckBox( this, wxID_ANY, _( "Omit nets" ) ); + m_cbOmitFpUuids = + new wxCheckBox( this, wxID_ANY, _( "Do not prefix path with footprint UUID." ) ); + + wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL ); + sizer->Add( m_cbOmitExtras, 0, wxALL, 5 ); + sizer->Add( m_cbOmitNets, 0, wxALL, 5 ); + sizer->Add( m_cbOmitFpUuids, 0, wxALL, 5 ); + + SetSizerAndFit( sizer ); + } + + int GetNetlistOptions() const + { + int options = 0; + + if( m_cbOmitExtras->GetValue() ) + options |= CTL_OMIT_EXTRA; + + if( m_cbOmitNets->GetValue() ) + options |= CTL_OMIT_NETS; + + if( m_cbOmitFpUuids->GetValue() ) + options |= CTL_OMIT_FP_UUID; + + return options; + } + + static wxWindow* Create( wxWindow* aParent ) + { + return new LEGACYFILEDLG_NETLIST_OPTIONS( aParent ); + } + +protected: + wxCheckBox* m_cbOmitExtras; + wxCheckBox* m_cbOmitNets; + wxCheckBox* m_cbOmitFpUuids; +}; + +#endif \ No newline at end of file diff --git a/pcbnew/widgets/legacyfiledlg_save_project.h b/pcbnew/widgets/legacyfiledlg_save_project.h index f121f21cc9..236f0136e3 100644 --- a/pcbnew/widgets/legacyfiledlg_save_project.h +++ b/pcbnew/widgets/legacyfiledlg_save_project.h @@ -17,8 +17,8 @@ * with this program. If not, see . */ -#ifndef LEGACYFILEDLG_SAVE_PROJ_H -#define LEGACYFILEDLG_SVE_PROJ_H +#ifndef LEGACYFILEDLG_SAVE_PROJ_H_ +#define LEGACYFILEDLG_SAVE_PROJ_H_ #include #include