48 const wxSize& size,
long style,
const wxString&
name ) :
56 int minWidth =
m_ResRequired->GetTextExtent( wxT(
"XXX.XXX" ) ).GetWidth();
63 minWidth =
m_ESeriesError2R->GetTextExtent( wxT(
"XX" ) +
_(
"Exact" ) ).GetWidth();
75 GetSizer()->SetSizeHints(
this );
105 if( std::isnan( reqr ) || reqr < min_target_value || reqr >
max_target_value )
107 wxMessageBox( wxString::Format(
_(
"Incorrect required resistance value: %s" ),
112 wxBusyCursor busyCursor;
129 catch(
const std::exception& exc )
131 wxMessageBox( wxString::Format(
"Internal error: %s", exc.what() ) );
135 auto showResult = [reqr](
const std::optional<RESISTANCE>& aResult, wxTextCtrl* aFormulaField,
136 wxTextCtrl* aErrorField )
143 double sol = aResult->value;
144 double error = ( sol / reqr - 1 ) * 100;
149 es.Printf(
"<%.2f", 0.01 );
151 es.Printf(
"%+.2f", error );
155 fs =
_(
"Not worth using" );
159 aFormulaField->SetValue( fs );
160 aErrorField->SetValue( es );
171 if( event.GetEventObject() ==
m_e1 )
173 else if( event.GetEventObject() ==
m_e3 )
175 else if( event.GetEventObject() ==
m_e12 )
177 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)
static const double max_target_value
wxString r_calculator_help
double DoubleFromString(const wxString &TextValue)
#define RES_EQUIV_CALC_FIRST_VALUE
#define RES_EQUIV_CALC_LAST_VALUE
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)