Pcbnew, DIALOG_NETLIST: fix incorrect storage of wx_MessageWindow options.

Config values were not stored into the right variables.

Make also an option persistent during the session
in DIALOG_UPDATE_PCB and DIALOG_NETLIST

DIALOG_UPDATE_PCB and DIALOG_NETLIST match options: use same order in dialogs.
This commit is contained in:
jean-pierre charras 2020-03-01 20:20:31 +01:00
parent aa95ff10df
commit 911c6eb781
9 changed files with 560 additions and 544 deletions

View File

@ -34,7 +34,7 @@ WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
long style ) : long style ) :
WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ), WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ),
m_reporter( this ), m_reporter( this ),
m_severities( -1 ), m_severities( REPORTER::RPT_ALL ),
m_lazyUpdate( false ) m_lazyUpdate( false )
{ {
syncCheckboxes(); syncCheckboxes();

File diff suppressed because it is too large Load Diff

View File

@ -57,6 +57,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame()
} }
bool DIALOG_NETLIST::m_warnForNoNetPads = false; bool DIALOG_NETLIST::m_warnForNoNetPads = false;
bool DIALOG_NETLIST::m_matchByUUID = false;
DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullFilename ) DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullFilename )
@ -77,6 +78,7 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullF
m_cbDeleteSinglePadNets->SetValue( cfg->m_NetlistDialog.delete_single_pad_nets ); m_cbDeleteSinglePadNets->SetValue( cfg->m_NetlistDialog.delete_single_pad_nets );
m_cbWarnNoNetPad->SetValue( m_warnForNoNetPads ); m_cbWarnNoNetPad->SetValue( m_warnForNoNetPads );
m_matchByTimestamp->SetSelection( m_matchByUUID ? 0 : 1 );
m_MessageWindow->SetLabel( _("Changes To Be Applied") ); m_MessageWindow->SetLabel( _("Changes To Be Applied") );
m_MessageWindow->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter ); m_MessageWindow->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter );
@ -98,14 +100,15 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullF
DIALOG_NETLIST::~DIALOG_NETLIST() DIALOG_NETLIST::~DIALOG_NETLIST()
{ {
m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue(); m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue();
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
auto cfg = m_parent->GetSettings(); auto cfg = m_parent->GetSettings();
cfg->m_NetlistDialog.report_filter = m_cbUpdateFootprints->GetValue(); cfg->m_NetlistDialog.report_filter = m_MessageWindow->GetVisibleSeverities();
cfg->m_NetlistDialog.update_footprints = m_cbDeleteShortingTracks->GetValue(); cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();
cfg->m_NetlistDialog.delete_shorting_tracks = m_cbDeleteExtraFootprints->GetValue(); cfg->m_NetlistDialog.delete_shorting_tracks = m_cbDeleteShortingTracks->GetValue();
cfg->m_NetlistDialog.delete_extra_footprints = m_cbDeleteSinglePadNets->GetValue(); cfg->m_NetlistDialog.delete_extra_footprints = m_cbDeleteExtraFootprints->GetValue();
cfg->m_NetlistDialog.delete_single_pad_nets = m_MessageWindow->GetVisibleSeverities(); cfg->m_NetlistDialog.delete_single_pad_nets = m_cbDeleteSinglePadNets->GetValue();
if( m_runDragCommand ) if( m_runDragCommand )
{ {
@ -271,18 +274,20 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun )
msg.Printf( _( "Reading netlist file \"%s\".\n" ), GetChars( netlistFileName ) ); msg.Printf( _( "Reading netlist file \"%s\".\n" ), GetChars( netlistFileName ) );
reporter.ReportHead( msg, REPORTER::RPT_INFO ); reporter.ReportHead( msg, REPORTER::RPT_INFO );
if( m_matchByTimestamp->GetSelection() == 0 ) if( m_matchByTimestamp->GetSelection() == 1 )
msg = _( "Using references to match components and footprints.\n" ); msg = _( "Using references to match components and footprints.\n" );
else else
msg = _( "Using tstamp fields to match components and footprints.\n" ); msg = _( "Using time stamp fields (UUID) to match components and footprints.\n" );
reporter.ReportHead( msg, REPORTER::RPT_INFO ); reporter.ReportHead( msg, REPORTER::RPT_INFO );
m_MessageWindow->SetLazyUpdate( true ); // Use lazy update to speed the creation of the report m_MessageWindow->SetLazyUpdate( true ); // Use lazy update to speed the creation of the report
// (the window is not updated for each message) // (the window is not updated for each message)
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
NETLIST netlist; NETLIST netlist;
netlist.SetDeleteExtraFootprints( m_cbDeleteExtraFootprints->GetValue() ); netlist.SetDeleteExtraFootprints( m_cbDeleteExtraFootprints->GetValue() );
netlist.SetFindByTimeStamp( m_matchByTimestamp->GetSelection() == 1 ); netlist.SetFindByTimeStamp( m_matchByUUID );
netlist.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); netlist.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() );
if( !m_parent->ReadNetlistFromFile( netlistFileName, netlist, reporter ) ) if( !m_parent->ReadNetlistFromFile( netlistFileName, netlist, reporter ) )
@ -291,7 +296,7 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun )
BOARD_NETLIST_UPDATER updater( m_parent, m_parent->GetBoard() ); BOARD_NETLIST_UPDATER updater( m_parent, m_parent->GetBoard() );
updater.SetReporter ( &reporter ); updater.SetReporter ( &reporter );
updater.SetIsDryRun( aDryRun ); updater.SetIsDryRun( aDryRun );
updater.SetLookupByTimestamp( m_matchByTimestamp->GetSelection() == 1 ); updater.SetLookupByTimestamp( m_matchByUUID );
updater.SetDeleteUnusedComponents ( m_cbDeleteExtraFootprints->GetValue() ); updater.SetDeleteUnusedComponents ( m_cbDeleteExtraFootprints->GetValue() );
updater.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); updater.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() );
updater.SetDeleteSinglePadNets( m_cbDeleteSinglePadNets->GetValue() ); updater.SetDeleteSinglePadNets( m_cbDeleteSinglePadNets->GetValue() );

View File

@ -5,7 +5,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -43,6 +43,9 @@ private:
bool m_initialized; bool m_initialized;
bool m_runDragCommand; bool m_runDragCommand;
static bool m_warnForNoNetPads; static bool m_warnForNoNetPads;
static bool m_matchByUUID; // True to use UUID as link between symbol and footprint
// False to use reference designator as link
// between symbol and footprint
public: public:
DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullFilename ); DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullFilename );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version v3.8.0) // C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -40,7 +40,7 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const
wxBoxSizer* bUpperSizer; wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_matchByTimestampChoices[] = { _("Associate footprints by reference"), _("Associate footprints using time stamp field") }; wxString m_matchByTimestampChoices[] = { _("Associate footprints using time stamp (UUID)"), _("Associate footprints using reference") };
int m_matchByTimestampNChoices = sizeof( m_matchByTimestampChoices ) / sizeof( wxString ); int m_matchByTimestampNChoices = sizeof( m_matchByTimestampChoices ) / sizeof( wxString );
m_matchByTimestamp = new wxRadioBox( this, wxID_ANY, _("Match Method"), wxDefaultPosition, wxDefaultSize, m_matchByTimestampNChoices, m_matchByTimestampChoices, 1, wxRA_SPECIFY_COLS ); m_matchByTimestamp = new wxRadioBox( this, wxID_ANY, _("Match Method"), wxDefaultPosition, wxDefaultSize, m_matchByTimestampNChoices, m_matchByTimestampChoices, 1, wxRA_SPECIFY_COLS );
m_matchByTimestamp->SetSelection( 1 ); m_matchByTimestamp->SetSelection( 1 );
@ -108,7 +108,6 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
m_NetlistFilenameCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_NETLIST_BASE::OnFilenameKillFocus ), NULL, this ); m_NetlistFilenameCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_NETLIST_BASE::OnFilenameKillFocus ), NULL, this );

View File

@ -14,6 +14,7 @@
<property name="file">dialog_netlist_base</property> <property name="file">dialog_netlist_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">dialog_netlist_base</property> <property name="name">dialog_netlist_base</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property> <property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
@ -45,7 +47,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_NETLIST_BASE</property> <property name="name">DIALOG_NETLIST_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">499,464</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Import Netlist</property> <property name="title">Import Netlist</property>
@ -295,7 +297,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="choices">&quot;Associate footprints by reference&quot; &quot;Associate footprints using time stamp field&quot;</property> <property name="choices">&quot;Associate footprints using time stamp (UUID)&quot; &quot;Associate footprints using reference&quot;</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version v3.8.0) // C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -76,7 +76,7 @@ class DIALOG_NETLIST_BASE : public DIALOG_SHIM
public: public:
DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 499,464 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_NETLIST_BASE(); ~DIALOG_NETLIST_BASE();
}; };

View File

@ -46,6 +46,7 @@ using namespace std::placeholders;
bool DIALOG_UPDATE_PCB::m_warnForNoNetPads = false; bool DIALOG_UPDATE_PCB::m_warnForNoNetPads = false;
bool DIALOG_UPDATE_PCB::m_matchByUUID = false;
DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist ) : DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist ) :
@ -60,6 +61,7 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
m_cbDeleteExtraFootprints->SetValue( cfg->m_NetlistDialog.delete_extra_footprints ); m_cbDeleteExtraFootprints->SetValue( cfg->m_NetlistDialog.delete_extra_footprints );
m_cbDeleteSinglePadNets->SetValue( cfg->m_NetlistDialog.delete_single_pad_nets ); m_cbDeleteSinglePadNets->SetValue( cfg->m_NetlistDialog.delete_single_pad_nets );
m_cbWarnNoNetPad->SetValue( m_warnForNoNetPads ); m_cbWarnNoNetPad->SetValue( m_warnForNoNetPads );
m_matchByTimestamp->SetSelection( m_matchByUUID ? 0 : 1 );
m_messagePanel->SetLabel( _("Changes To Be Applied") ); m_messagePanel->SetLabel( _("Changes To Be Applied") );
m_messagePanel->SetLazyUpdate( true ); m_messagePanel->SetLazyUpdate( true );
@ -86,6 +88,7 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB() DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB()
{ {
m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue(); m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue();
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
auto cfg = m_frame->GetSettings(); auto cfg = m_frame->GetSettings();
@ -123,6 +126,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun )
updater.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); updater.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() );
updater.SetDeleteSinglePadNets( m_cbDeleteSinglePadNets->GetValue() ); updater.SetDeleteSinglePadNets( m_cbDeleteSinglePadNets->GetValue() );
m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue(); m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue();
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
updater.SetWarnPadNoNetInNetlist( m_warnForNoNetPads ); updater.SetWarnPadNoNetInNetlist( m_warnForNoNetPads );
updater.UpdateNetlist( *m_netlist ); updater.UpdateNetlist( *m_netlist );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -37,6 +37,9 @@ private:
bool m_initialized; bool m_initialized;
bool m_runDragCommand; bool m_runDragCommand;
static bool m_warnForNoNetPads; static bool m_warnForNoNetPads;
static bool m_matchByUUID; // True to use UUID as link between symbol and footprint
// False to use reference designator as link
// between symbol and footprint
public: public:
DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST *aNetlist ); DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST *aNetlist );