pcb_calculator, PANEL_GALVANIC_CORROSION: store selection in config.

Other minor cosmetic enhancement.
This commit is contained in:
jean-pierre charras 2023-10-21 20:42:23 +02:00
parent 24a9245f81
commit 79fb832b9e
6 changed files with 140 additions and 63 deletions

View File

@ -101,12 +101,21 @@ void PANEL_GALVANIC_CORROSION::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
m_corFilterCtrl->SetValue( aCfg->m_CorrosionTable.threshold_voltage );
m_corFilterValue = DoubleFromString( m_corFilterCtrl->GetValue() );
bool refill_table = m_symbolicStatus != aCfg->m_CorrosionTable.show_symbols;
m_symbolicStatus = aCfg->m_CorrosionTable.show_symbols;
m_radioBtnSymbol->SetValue( m_symbolicStatus );
m_radioBtnName->SetValue( !m_symbolicStatus );
if( refill_table )
fillTable();
}
void PANEL_GALVANIC_CORROSION::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
aCfg->m_CorrosionTable.threshold_voltage = wxString( "" ) << m_corFilterValue;
aCfg->m_CorrosionTable.show_symbols = m_symbolicStatus;
}
void PANEL_GALVANIC_CORROSION::OnNomenclatureChange( wxCommandEvent& aEvent )

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,12 +11,12 @@
PANEL_GALVANIC_CORROSION_BASE::PANEL_GALVANIC_CORROSION_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : CALCULATOR_PANEL( parent, id, pos, size, style, name )
{
bSizer6 = new wxBoxSizer( wxVERTICAL );
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_scrolledWindow1 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL );
m_scrolledWindow1->SetScrollRate( 5, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerGrid;
bSizerGrid = new wxBoxSizer( wxVERTICAL );
m_table = new wxGrid( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
@ -42,65 +42,68 @@ PANEL_GALVANIC_CORROSION_BASE::PANEL_GALVANIC_CORROSION_BASE( wxWindow* parent,
// Cell Defaults
m_table->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
bSizer7->Add( m_table, 0, 0, 5 );
bSizerGrid->Add( m_table, 0, 0, 5 );
m_scrolledWindow1->SetSizer( bSizer7 );
m_scrolledWindow1->SetSizer( bSizerGrid );
m_scrolledWindow1->Layout();
bSizer7->Fit( m_scrolledWindow1 );
bSizer6->Add( m_scrolledWindow1, 1, wxEXPAND|wxALL, 5 );
bSizerGrid->Fit( m_scrolledWindow1 );
bSizerMain->Add( m_scrolledWindow1, 1, wxEXPAND|wxALL, 5 );
m_helpText = new HTML_WINDOW( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
m_helpText->SetMinSize( wxSize( 400,110 ) );
bSizer6->Add( m_helpText, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( m_helpText, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerBottom;
bSizerBottom = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerVoltage;
bSizerVoltage = new wxBoxSizer( wxHORIZONTAL );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Threshold voltage:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizer3->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxTOP, 5 );
bSizerVoltage->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxTOP, 5 );
m_corFilterCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_corFilterCtrl->SetMinSize( wxSize( 100,-1 ) );
bSizer3->Add( m_corFilterCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizerVoltage->Add( m_corFilterCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("mV"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
bSizer3->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
m_staticline1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer3->Add( m_staticline1, 0, wxEXPAND, 5 );
bSizerVoltage->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizer5->Add( bSizer3, 0, 0, 5 );
bSizerBottom->Add( bSizerVoltage, 0, 0, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
m_staticline->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_radioBtnSymbol = new wxRadioButton( this, wxID_ANY, _("Symbols"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_radioBtnSymbol, 0, 0, 5 );
bSizerBottom->Add( m_staticline, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bSizerOpts;
bSizerOpts = new wxBoxSizer( wxHORIZONTAL );
m_stOpts = new wxStaticText( this, wxID_ANY, _("Material names:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stOpts->Wrap( -1 );
bSizerOpts->Add( m_stOpts, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_radioBtnSymbol = new wxRadioButton( this, wxID_ANY, _("Chemical symbols"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOpts->Add( m_radioBtnSymbol, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_radioBtnName = new wxRadioButton( this, wxID_ANY, _("Names"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_radioBtnName, 0, 0, 5 );
bSizerOpts->Add( m_radioBtnName, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bSizer5->Add( bSizer4, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerBottom->Add( bSizerOpts, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer6->Add( bSizer5, 0, wxEXPAND, 5 );
bSizerMain->Add( bSizerBottom, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
this->SetSizer( bSizer6 );
this->SetSizer( bSizerMain );
this->Layout();
bSizer6->Fit( this );
// Connect Events
m_corFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_GALVANIC_CORROSION_BASE::OnCorFilterChange ), NULL, this );

View File

@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_GALVANIC_CORROSION_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">509,245</property>
<property name="subclass">CALCULATOR_PANEL; calculator_panels/calculator_panel.h; </property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
@ -54,7 +54,7 @@
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer6</property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
@ -116,7 +116,7 @@
<property name="window_style">wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer7</property>
<property name="name">bSizerGrid</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
@ -270,20 +270,20 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer5</property>
<property name="name">bSizerBottom</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
<property name="name">bSizerVoltage</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
@ -349,7 +349,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@ -473,11 +473,80 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font">,90,90,-1,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_VERTICAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerOpts</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="0">
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -501,10 +570,12 @@
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font">,90,90,-1,70,0</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Material names:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -512,7 +583,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="name">m_stOpts</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -522,29 +593,19 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_VERTICAL</property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -574,7 +635,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Symbols</property>
<property name="label">Chemical symbols</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -609,7 +670,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -38,14 +38,15 @@ class PANEL_GALVANIC_CORROSION_BASE : public CALCULATOR_PANEL
private:
protected:
wxBoxSizer* bSizer6;
wxBoxSizer* bSizerMain;
wxScrolledWindow* m_scrolledWindow1;
wxGrid* m_table;
HTML_WINDOW* m_helpText;
wxStaticText* m_staticText2;
wxTextCtrl* m_corFilterCtrl;
wxStaticText* m_staticText3;
wxStaticLine* m_staticline1;
wxStaticLine* m_staticline;
wxStaticText* m_stOpts;
wxRadioButton* m_radioBtnSymbol;
wxRadioButton* m_radioBtnName;
@ -56,7 +57,7 @@ class PANEL_GALVANIC_CORROSION_BASE : public CALCULATOR_PANEL
public:
PANEL_GALVANIC_CORROSION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_GALVANIC_CORROSION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 509,245 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_GALVANIC_CORROSION_BASE();

View File

@ -276,6 +276,8 @@ PCB_CALCULATOR_SETTINGS::PCB_CALCULATOR_SETTINGS() :
m_params.emplace_back( new PARAM<wxString>( "corrosion_table.threshold_voltage",
&m_CorrosionTable.threshold_voltage, "0" ) );
m_params.emplace_back( new PARAM<bool>( "corrosion_table.show_symbols",
&m_CorrosionTable.show_symbols, true ) );
}

View File

@ -155,6 +155,7 @@ public:
struct CORROSION_TABLE
{
wxString threshold_voltage;
bool show_symbols;
};
PCB_CALCULATOR_SETTINGS();