41 const wxPoint& pos,
const wxSize& size,
42 long style,
const wxString&
name ) :
140 wxColour color_ok( 122, 166, 194 );
141 wxColour color_text( 0, 0, 0 );
151 if( entryA.m_symbol.size() > 0 )
153 label = entryA.m_symbol;
157 label = entryA.m_name;
162 if( entryA.m_name.size() > 0 )
164 label = entryA.m_name;
168 label = entryA.m_symbol;
172 m_table->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER );
173 m_table->SetRowLabelValue( i, label );
174 m_table->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
175 m_table->SetColLabelValue( i, label );
176 m_table->SetCellAlignment( i, j, wxALIGN_CENTER, wxALIGN_CENTER );
180 double diff = entryA.m_potential - entryB.m_potential;
181 int diff_temp =
KiROUND( abs( diff * 84 ) );
183 value << diff * 1000;
184 m_table->SetCellValue( i, j, value );
187 m_table->SetCellTextColour( i, j, color_text );
189 if( abs( diff ) == 0 )
191 m_table->SetCellBackgroundColour( i, j, wxColor( 193, 231, 255 ) );
198 m_table->SetCellBackgroundColour( i, j, wxColour( 202 - diff_temp,
204 m_table->SetCellBackgroundColour( i, j, wxColour( 255 - diff_temp,
211 m_table->SetCellBackgroundColour( i, j, color_ok );
214 m_table->SetReadOnly( i, j,
true );
221 m_table->SetColLabelTextOrientation( wxVERTICAL );
223 m_table->SetColLabelSize( wxGRID_AUTOSIZE );
224 m_table->SetRowLabelSize( wxGRID_AUTOSIZE );
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
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".