41 const wxPoint& pos,
const wxSize& size,
42 long style,
const wxString&
name ) :
149 wxColour color_ok( 122, 166, 194 );
150 wxColour color_text( 0, 0, 0 );
160 if( entryA.m_symbol.size() > 0 )
162 label = entryA.m_symbol;
166 label = entryA.m_name;
171 if( entryA.m_name.size() > 0 )
173 label = entryA.m_name;
177 label = entryA.m_symbol;
181 m_table->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER );
182 m_table->SetRowLabelValue( i, label );
183 m_table->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
184 m_table->SetColLabelValue( i, label );
185 m_table->SetCellAlignment( i, j, wxALIGN_CENTER, wxALIGN_CENTER );
189 double diff = entryA.m_potential - entryB.m_potential;
190 int diff_temp =
KiROUND( abs( diff * 84 ) );
192 value << diff * 1000;
193 m_table->SetCellValue( i, j, value );
196 m_table->SetCellTextColour( i, j, color_text );
198 if( abs( diff ) == 0 )
200 m_table->SetCellBackgroundColour( i, j, wxColor( 193, 231, 255 ) );
207 m_table->SetCellBackgroundColour( i, j, wxColour( 202 - diff_temp,
213 m_table->SetCellBackgroundColour( i, j, wxColour( 255 - diff_temp,
220 m_table->SetCellBackgroundColour( i, j, color_ok );
223 m_table->SetReadOnly( i, j,
true );
230 m_table->SetColLabelTextOrientation( wxVERTICAL );
232 m_table->SetColLabelSize( wxGRID_AUTOSIZE );
233 m_table->SetRowLabelSize( wxGRID_AUTOSIZE );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
wxString m_symbol
Chemical symbol (Cu), not translatable.
wxString m_name
Translatable name ( Copper )
double m_potential
potential in volts, relative to copper
CORROSION_TABLE_ENTRY(const wxString &aName, const wxString &aSymbol, double aPotential)
bool SetPage(const wxString &aSource) override
Class PANEL_GALVANIC_CORROSION_BASE.
wxTextCtrl * m_corFilterCtrl
wxRadioButton * m_radioBtnName
wxRadioButton * m_radioBtnSymbol
void OnNomenclatureChange(wxCommandEvent &aEvent) override
~PANEL_GALVANIC_CORROSION()
PANEL_GALVANIC_CORROSION(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
std::vector< CORROSION_TABLE_ENTRY > m_entries
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
void OnCorFilterChange(wxCommandEvent &aEvent) override
void LoadSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Load the settings into the panel.
void SaveSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Save the settings from the panel.
CORROSION_TABLE m_CorrosionTable
Some functions to handle hotkeys in KiCad.
double DoubleFromString(const wxString &TextValue)
wxString galvanic_corrosion_help
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
wxString threshold_voltage