Browse Source

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.

pull/12/head
jean-pierre charras 10 years ago
parent
commit
f294834f4d
  1. 5
      pcbnew/dialogs/dialog_edit_module_text.cpp
  2. 48
      pcbnew/dialogs/dialog_pad_properties.cpp
  3. 4
      pcbnew/dialogs/dialog_pad_properties.h
  4. 2
      pcbnew/dialogs/dialog_pad_properties_base.cpp
  5. 2
      pcbnew/dialogs/dialog_pad_properties_base.fbp
  6. 1
      pcbnew/dialogs/dialog_pad_properties_base.h

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

48
pcbnew/dialogs/dialog_pad_properties.cpp

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

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

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

2
pcbnew/dialogs/dialog_pad_properties_base.fbp

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

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

Loading…
Cancel
Save