From 7c1ac6fbcc06c776fb40e96a0c385e94ad06ae4c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 20 Sep 2017 15:37:20 +0200 Subject: [PATCH] Refinements in pad properties dialog --- pcbnew/dialogs/dialog_pad_properties.cpp | 18 ++++++++++++++++++ pcbnew/dialogs/dialog_pad_properties.h | 1 + pcbnew/dialogs/dialog_pad_properties_base.cpp | 4 ++-- pcbnew/dialogs/dialog_pad_properties_base.fbp | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index ade833efdd..c9c35ffe76 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -150,6 +150,20 @@ void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event ) m_PadNumCtrl->SetSelection( -1, -1 ); } + +void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable ) +{ + // Enable or disable the widgets in page managing custom shape primitives + m_listCtrlPrimitives->Enable( aEnable ); + m_buttonDel->Enable( aEnable ); + m_buttonEditShape->Enable( aEnable ); + m_buttonAddShape->Enable( aEnable ); + m_buttonDup->Enable( aEnable ); + m_buttonGeometry->Enable( aEnable ); + m_buttonImport->Enable( aEnable ); +} + + void DIALOG_PAD_PROPERTIES::prepareCanvas() { // Initialize the canvases (legacy or gal) to display the pad @@ -629,6 +643,8 @@ void DIALOG_PAD_PROPERTIES::initValues() break; } + enablePrimitivePage( PAD_SHAPE_CUSTOM == m_dummyPad->GetShape() ); + m_OrientValue = angle / 10.0; // Type of pad selection @@ -815,6 +831,8 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event ) break; } + enablePrimitivePage( is_custom ); + // A few widgets are enabled only for rounded rect pads: m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT ); diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index 71ba2a8194..a1da50f470 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -98,6 +98,7 @@ private: void redraw(); void editPrimitive(); void updateRoundRectCornerValues(); + void enablePrimitivePage( bool aEnable ); ///< enable (or disable) the primitive page editor /** * Function setPadLayersList diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index b14cd1473a..95e781cb56 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -63,7 +63,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_staticText45->Wrap( -1 ); fgSizerPadType->Add( m_staticText45, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); - wxString m_PadShapeChoices[] = { _("Circular"), _("Oval"), _("Rectangular"), _("Trapezoidal"), _("Rounded Rectangle"), _("Custom Shape with Circular Anchor"), _("Custom Shape with Rectangular Anchor") }; + wxString m_PadShapeChoices[] = { _("Circular"), _("Oval"), _("Rectangular"), _("Trapezoidal"), _("Rounded Rectangle"), _("Custom Shape (Circular Anchor)"), _("Custom Shape (Rectangular Anchor)") }; int m_PadShapeNChoices = sizeof( m_PadShapeChoices ) / sizeof( wxString ); m_PadShape = new wxChoice( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PadShapeNChoices, m_PadShapeChoices, 0 ); m_PadShape->SetSelection( 0 ); @@ -223,7 +223,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_staticline9 = new wxStaticLine( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); fgSizerShapeType->Add( m_staticline9, 0, wxEXPAND | wxALL, 5 ); - m_staticTextCornerSizeRatio = new wxStaticText( m_panelGeneral, wxID_ANY, _("Corner size (percent of width):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCornerSizeRatio = new wxStaticText( m_panelGeneral, wxID_ANY, _("Corner size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCornerSizeRatio->Wrap( -1 ); m_staticTextCornerSizeRatio->SetToolTip( _("Corner radius in percent of the pad width.\nThe width is the smaller value between size X and size Y\nThe max value is 50 percent ") ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index 5a29b374df..741a3885b8 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -912,7 +912,7 @@ 1 0 - "Circular" "Oval" "Rectangular" "Trapezoidal" "Rounded Rectangle" "Custom Shape with Circular Anchor" "Custom Shape with Rectangular Anchor" + "Circular" "Oval" "Rectangular" "Trapezoidal" "Rounded Rectangle" "Custom Shape (Circular Anchor)" "Custom Shape (Rectangular Anchor)" 1 1 @@ -4193,7 +4193,7 @@ 0 0 wxID_ANY - Corner size (percent of width): + Corner size: 0