49 const wxSize& size,
long style,
const wxString&
name ) :
57 int minWidth =
m_ResRequired->GetTextExtent( wxT(
"XXX.XXX" ) ).GetWidth();
64 minWidth =
m_ESeriesError2R->GetTextExtent( wxT(
"XX" ) +
_(
"Exact" ) ).GetWidth();
76 GetSizer()->SetSizeHints(
this );
106 if( std::isnan( reqr ) || reqr < min_target_value || reqr >
max_target_value )
108 wxMessageBox( wxString::Format(
_(
"Incorrect required resistance value: %s" ),
113 wxBusyCursor busyCursor;
130 catch(
const std::exception& exc )
132 wxMessageBox( wxString::Format(
"Internal error: %s", exc.what() ) );
136 auto showResult = [reqr](
const std::optional<RESISTANCE>& aResult, wxTextCtrl* aFormulaField,
137 wxTextCtrl* aErrorField )
144 double sol = aResult->value;
145 double error = ( sol / reqr - 1 ) * 100;
150 es.Printf(
"<%.2f", 0.01 );
152 es.Printf(
"%+.2f", error );
156 fs =
_(
"Not worth using" );
160 aFormulaField->SetValue( fs );
161 aErrorField->SetValue( es );
172 if( event.GetEventObject() ==
m_e1 )
174 else if( event.GetEventObject() ==
m_e3 )
176 else if( event.GetEventObject() ==
m_e12 )
178 else if( event.GetEventObject() ==
m_e24 )
wxTextCtrl * m_ResRequired
wxTextCtrl * m_ESeriesError4R
wxTextCtrl * m_ESeries_Sol3R
wxStaticText * m_reqResUnits
wxTextCtrl * m_ResExclude2
wxTextCtrl * m_ESeriesError3R
wxTextCtrl * m_ESeries_Sol4R
PANEL_R_CALCULATOR_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)
wxTextCtrl * m_ESeriesError2R
wxStaticText * m_exclude2Units
wxStaticText * m_exclude1Units
wxTextCtrl * m_ESeries_Sol2R
wxTextCtrl * m_ResExclude1
HTML_WINDOW * m_panelESeriesHelp
PANEL_R_CALCULATOR(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void OnCalculateESeries(wxCommandEvent &event) override
Called on calculate button and executes all E-series calculations.
void LoadSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Load the settings into the panel.
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
void OnESeriesSelection(wxCommandEvent &event) override
Radio Buttons to select the E-series for the resistor calculator.
void SaveSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Save the settings from the panel.
const int minSize
Push and Shove router track width and via size dialog.
Some functions to handle hotkeys in KiCad.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
double DoubleFromString(const wxString &TextValue)
static const double max_target_value
double DoubleFromString(const wxString &TextValue)
wxString r_calculator_help
#define RES_EQUIV_CALC_FIRST_VALUE
#define RES_EQUIV_CALC_LAST_VALUE
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)