pcbnew: pad editor UI fixes

When editing a pad with circular hole the Y dimension is hidden
and Diameter is shown instead of Size X when opening the properties
of an existing pad.
Adjusted Pad shape: label to be vertically aligned to the pad shape
combobox.
This commit is contained in:
Miklos Marton 2022-06-20 17:42:06 +02:00 committed by Seth Hillbrand
parent 6679decc8d
commit 426c46abb1
4 changed files with 111 additions and 73 deletions

View File

@ -218,6 +218,9 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
// Do not allow locking items in the footprint editor
m_locked->Show( !m_isFpEditor );
updateHoleControls();
updatePadSizeControls();
// Usually, TransferDataToWindow is called by OnInitDialog
// calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
TransferDataToWindow();
@ -907,14 +910,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
if( m_MainSizer->GetSize().y < m_MainSizer->GetMinSize().y )
m_MainSizer->SetSizeHints( this );
m_sizeXLabel->SetLabel( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CIRCLE
|| m_PadShapeSelector->GetSelection()
== CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
? _( "Diameter:" )
: _( "Pad size X:" ) );
m_sizeY.Show( m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CIRCLE
&& m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
m_sizeXLabel->GetParent()->Layout();
updatePadSizeControls();
redraw();
}
@ -922,12 +918,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
m_holeXLabel->SetLabel( ( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE )
? _( "Diameter:" )
: _( "Hole size X:" ) );
m_holeY.Show( m_holeShapeCtrl->GetSelection() != CHOICE_SHAPE_CIRCLE
&& m_holeShapeCtrl->GetSelection() != CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
m_holeXLabel->GetParent()->Layout();
updateHoleControls();
redraw();
}
@ -1717,6 +1708,28 @@ PAD_PROP DIALOG_PAD_PROPERTIES::getSelectedProperty()
return prop;
}
void DIALOG_PAD_PROPERTIES::updateHoleControls()
{
m_holeXLabel->SetLabel( ( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE )
? _( "Diameter:" )
: _( "Hole size X:" ) );
m_holeY.Show( m_holeShapeCtrl->GetSelection() != CHOICE_SHAPE_CIRCLE
&& m_holeShapeCtrl->GetSelection() != CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
m_holeXLabel->GetParent()->Layout();
}
void DIALOG_PAD_PROPERTIES::updatePadSizeControls()
{
m_sizeXLabel->SetLabel( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CIRCLE
|| m_PadShapeSelector->GetSelection()
== CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
? _( "Diameter:" )
: _( "Pad size X:" ) );
m_sizeY.Show( m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CIRCLE
&& m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
m_sizeXLabel->GetParent()->Layout();
}
bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
{

View File

@ -167,6 +167,14 @@ private:
UNIT_BINDER m_spokeWidth;
UNIT_BINDER m_spokeAngle;
UNIT_BINDER m_pad_orientation;
// Show/hide the hole size Y widgets
// Setting the X/Diameter label according to the selected hole type
void updateHoleControls();
// Show/hide the pad size Y widgets
// Setting the X/Diameter label according to the selected hole type
void updatePadSizeControls();
};
/**

View File

@ -333,14 +333,20 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
gbSizerPadOrientation->Add( m_shapePropsBook, wxGBPosition( 1, 0 ), wxGBSpan( 1, 6 ), wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer39;
bSizer39 = new wxBoxSizer( wxVERTICAL );
m_shapeLabel = new wxStaticText( m_panelGeneral, wxID_ANY, _("Pad shape:"), wxDefaultPosition, wxDefaultSize, 0 );
m_shapeLabel->Wrap( -1 );
gbSizerPadOrientation->Add( m_shapeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
bSizer39->Add( m_shapeLabel, 0, wxALL, 5 );
gbSizerPadOrientation->Add( bSizer39, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxString m_PadShapeSelectorChoices[] = { _("Circular"), _("Oval"), _("Rectangular"), _("Trapezoidal"), _("Rounded rectangle"), _("Chamfered rectangle"), _("Chamfered with other corners rounded"), _("Custom (circular base)"), _("Custom (rectangular base)") };
int m_PadShapeSelectorNChoices = sizeof( m_PadShapeSelectorChoices ) / sizeof( wxString );
m_PadShapeSelector = new wxChoice( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PadShapeSelectorNChoices, m_PadShapeSelectorChoices, 0 );
m_PadShapeSelector->SetSelection( 2 );
m_PadShapeSelector->SetSelection( 4 );
gbSizerPadOrientation->Add( m_PadShapeSelector, wxGBPosition( 0, 1 ), wxGBSpan( 1, 5 ), wxALL, 5 );

View File

@ -1147,7 +1147,7 @@
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxGridBagSizer" expanded="0">
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
@ -4068,13 +4068,22 @@
</object>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer39</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -4132,6 +4141,8 @@
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">5</property>