diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index 63fc539983..d8ec1addb1 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -135,23 +135,18 @@ bool DialogEditModuleText::TransferDataToWindow() m_Style->SetSelection( m_currentText->IsItalic() ? 1 : 0 ); - m_SizeXTitle->SetLabelText( wxEmptyString ); AddUnitSymbol( *m_SizeXTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->GetSize().x ); - m_SizeYTitle->SetLabelText( wxEmptyString ); AddUnitSymbol( *m_SizeYTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->GetSize().y ); - m_PosXTitle->SetLabelText( wxEmptyString ); AddUnitSymbol( *m_PosXTitle ); PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x ); - m_PosYTitle->SetLabelText( wxEmptyString ); AddUnitSymbol( *m_PosYTitle ); PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y ); - m_WidthTitle->SetLabelText( wxEmptyString ); AddUnitSymbol( *m_WidthTitle ); PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() ); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 2206106c17..e99f13d1c2 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -35,14 +35,10 @@ #include #include #include -#include -#include #include #include #include -#include - #include #include @@ -266,6 +262,11 @@ void DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues() m_staticTextCornerRadiusValue->SetLabel( StringFromValue( g_UserUnit, m_dummyPad->GetRoundRectCornerRadius() ) ); } + else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT ) + { + m_tcCornerSizeRatio->ChangeValue( "0" ); + m_staticTextCornerRadiusValue->SetLabel( "0" ); + } else { m_tcCornerSizeRatio->ChangeValue( wxEmptyString ); @@ -549,14 +550,6 @@ void DIALOG_PAD_PROPERTIES::initValues() updateRoundRectCornerValues(); } -// A small helper function, to display coordinates: -static wxString formatCoord( wxPoint aCoord ) -{ - return wxString::Format( "X=%s Y=%s", - CoordinateToString( aCoord.x, true ), - CoordinateToString( aCoord.y, true ) ); -} - void DIALOG_PAD_PROPERTIES::OnResize( wxSizeEvent& event ) { @@ -607,18 +600,14 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event ) m_ShapeSize_Y_Ctrl->Enable( true ); m_ShapeOffset_X_Ctrl->Enable( true ); m_ShapeOffset_Y_Ctrl->Enable( true ); + // Ensure m_tcCornerSizeRatio contains the right value: + m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f", + m_dummyPad->GetRoundRectRadiusRatio()*100 ) ); break; } // A few widgets are enabled only for rounded rect pads: - bool roundrect = m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT; - - m_staticTextCornerSizeRatio->Enable( roundrect ); - m_tcCornerSizeRatio->Enable( roundrect ); - m_staticTextCornerSizeRatioUnit->Enable( roundrect ); - m_staticTextCornerRadius->Enable( roundrect ); - m_staticTextCornerRadiusValue->Enable( roundrect ); - m_staticTextCornerSizeUnit->Enable( roundrect ); + m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT ); transferDataToPad( m_dummyPad ); @@ -903,10 +892,13 @@ void DIALOG_PAD_PROPERTIES::redraw() } -void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) +bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() { + if( !wxDialog::TransferDataFromWindow() ) + return false; + if( !padValuesOK() ) - return; + return false; bool rastnestIsChanged = false; int isign = m_isFlipped ? -1 : 1; @@ -1007,6 +999,14 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) m_currentPad->SetThermalGap( m_padMaster->GetThermalGap() ); m_currentPad->SetRoundRectRadiusRatio( m_padMaster->GetRoundRectRadiusRatio() ); + // rounded rect pads with radius ratio = 0 are in fact rect pads. + // So set the right shape (and perhaps issues with a radius = 0) + if( m_currentPad->GetShape() == PAD_SHAPE_ROUNDRECT && + m_currentPad->GetRoundRectRadiusRatio() == 0.0 ) + { + m_currentPad->SetShape( PAD_SHAPE_RECT ); + } + footprint->CalculateBoundingBox(); m_parent->SetMsgPanel( m_currentPad ); @@ -1015,10 +1015,10 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) m_parent->OnModify(); } - EndModal( wxID_OK ); - if( rastnestIsChanged ) // The net ratsnest must be recalculated m_board->m_Status_Pcb = 0; + + return true; } diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index bc93579be0..f14c4e28e4 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -116,8 +116,8 @@ private: void OnValuesChanged( wxCommandEvent& event ); /// Updates the different parameters for the component being edited. - /// Fired from the OK button click. - void PadPropertiesAccept( wxCommandEvent& event ); + /// Automatically fired from the OK button click. + bool TransferDataFromWindow(); }; #endif // #ifndef _DIALOG_PAD_PROPERTIES_H_ diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index 922a82ac86..bf3c590114 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -624,7 +624,6 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_PadLayerECO2->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this ); m_NetClearanceValueCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this ); m_panelShowPad->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this ); } DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE() @@ -660,6 +659,5 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE() m_PadLayerECO2->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this ); m_NetClearanceValueCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this ); m_panelShowPad->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index 033ef3e77a..5a2b40a6b0 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -9357,7 +9357,7 @@ - PadPropertiesAccept + diff --git a/pcbnew/dialogs/dialog_pad_properties_base.h b/pcbnew/dialogs/dialog_pad_properties_base.h index 4e6f700f02..8ac149ea4a 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.h +++ b/pcbnew/dialogs/dialog_pad_properties_base.h @@ -170,7 +170,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM virtual void onCornerSizePercentChange( wxCommandEvent& event ) { event.Skip(); } virtual void OnDrillShapeSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); } - virtual void PadPropertiesAccept( wxCommandEvent& event ) { event.Skip(); } public: