dialog_pad_properties: Some fixes. Dialog_edit_module_text: fix an issue related to displayed texts, which were deleted and replaced by the unit symbol only, and the name of the parameter was therefore lost.

This commit is contained in:
jean-pierre charras 2016-04-10 12:40:31 +02:00
parent 3ac5fc41cc
commit f294834f4d
6 changed files with 27 additions and 35 deletions

View File

@ -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() );

View File

@ -35,14 +35,10 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcbnew.h>
#include <trigo.h>
#include <macros.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <base_units.h>
#include <wx/dcbuffer.h>
#include <class_board.h>
#include <class_module.h>
@ -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;
}

View File

@ -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_

View File

@ -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 );
}

View File

@ -9357,7 +9357,7 @@
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">PadPropertiesAccept</event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>

View File

@ -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: