Calculator: Simplify color code tolerance chooser + typo
Since for this tool the only difference for different tolerances is the 4th band, which is present for tolerance <= 2% and not present for 10%/5%, reduce radio choices to those two groups for clarity. Fix a typo (4rd -> 4th) and rename one variable to make it more descriptive as well.
This commit is contained in:
parent
e96673ed8d
commit
0a29e94a60
|
@ -36,25 +36,27 @@ void PCB_CALCULATOR_FRAME::OnToleranceSelection( wxCommandEvent& event )
|
|||
|
||||
void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection )
|
||||
{
|
||||
/* For tolerance = 5 or 10 %, there are 3 ring for the value
|
||||
* but for tolerance < 5 %, there are 4 ring
|
||||
/* For tolerance = 5 or 10 %, there are 3 bands for the value
|
||||
* but for tolerance < 5 %, there are 4 bands
|
||||
*/
|
||||
bool enable = true;
|
||||
bool show4thBand;
|
||||
switch( aSelection )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
enable = false;
|
||||
case 0: // 5 or 10 %
|
||||
show4thBand = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 1: // < 5 %
|
||||
show4thBand = true;
|
||||
break;
|
||||
default: // Show 4th band if something went wrong
|
||||
show4thBand = true;
|
||||
break;
|
||||
}
|
||||
bool oldstate = m_Band4Label->IsShown();
|
||||
if( oldstate != enable )
|
||||
if( oldstate != show4thBand )
|
||||
{
|
||||
m_Band4bitmap->Show(enable);
|
||||
m_Band4Label->Show(enable);
|
||||
m_Band4bitmap->Show(show4thBand);
|
||||
m_Band4Label->Show(show4thBand);
|
||||
// m_Band4Label visibility has changed:
|
||||
// The new size must be taken in account
|
||||
m_panelColorCode->GetSizer()->Layout();
|
||||
|
|
|
@ -1176,7 +1176,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
wxBoxSizer* bSizerPanelColorCode;
|
||||
bSizerPanelColorCode = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxString m_rbToleranceSelectionChoices[] = { _("10%"), _("5%"), _("2%"), _("1%"), _("0.5%"), _("0.25%"), _("0.1%"), _("0.05%") };
|
||||
wxString m_rbToleranceSelectionChoices[] = { _("10% / 5%"), _("<= 2%") };
|
||||
int m_rbToleranceSelectionNChoices = sizeof( m_rbToleranceSelectionChoices ) / sizeof( wxString );
|
||||
m_rbToleranceSelection = new wxRadioBox( m_panelColorCode, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDefaultSize, m_rbToleranceSelectionNChoices, m_rbToleranceSelectionChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_rbToleranceSelection->SetSelection( 0 );
|
||||
|
@ -1199,7 +1199,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
|
|||
m_staticText35->Wrap( -1 );
|
||||
fgSizerColoCode->Add( m_staticText35, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_Band4Label = new wxStaticText( m_panelColorCode, wxID_ANY, _("4rd Band"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Band4Label = new wxStaticText( m_panelColorCode, wxID_ANY, _("4th Band"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Band4Label->Wrap( -1 );
|
||||
fgSizerColoCode->Add( m_Band4Label, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
|
|
@ -17732,7 +17732,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"10%" "5%" "2%" "1%" "0.5%" "0.25%" "0.1%" "0.05%"</property>
|
||||
<property name="choices">"10% / 5%" "<= 2%"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
@ -18101,7 +18101,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">4rd Band</property>
|
||||
<property name="label">4th Band</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
|
Loading…
Reference in New Issue