DIALOG_FOOTPRINT_PROPERTIES: fix an issue when selecting 0.0 orientation.

Allows also entering a rotation angle in 0.001 degrees
(The limitation to 0.1 degree is outdated since years)
This commit is contained in:
jean-pierre charras 2020-10-29 18:33:28 +01:00
parent 5abb61e195
commit 0ef480dc84
5 changed files with 8 additions and 9 deletions

View File

@ -55,7 +55,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
DIALOG_FOOTPRINT_PROPERTIES_BASE( aParent ),
m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
m_OrientValidator( 1, &m_OrientValue ),
m_OrientValidator( 3, &m_OrientValue ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ),
m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl, m_SolderPasteMarginUnits ),
@ -729,7 +729,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
// positions on board (so that relative positions are held constant)
m_OrientValidator.TransferFromWindow();
int orient = KiROUND( m_OrientValue * 10.0 );
double orient = m_OrientValue * 10;
if( m_footprint->GetOrientation() != orient )
m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() );

View File

@ -560,7 +560,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_itemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnGridSize ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_Orient0->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ModuleOrientEvent ), NULL, this );
m_Orient0->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient90->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient270->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient180->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
@ -587,7 +587,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::~DIALOG_FOOTPRINT_PROPERTIES_BASE()
m_itemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnGridSize ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_Orient0->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ModuleOrientEvent ), NULL, this );
m_Orient0->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient90->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient270->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient180->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );

View File

@ -1097,7 +1097,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">ModuleOrientEvent</event>
<event name="OnRadioButton">FootprintOrientEvent</event>
</object>
</object>
<object class="gbsizeritem" expanded="0">

View File

@ -130,7 +130,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void ModuleOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void FootprintOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOtherOrientation( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateFootprint( wxCommandEvent& event ) { event.Skip(); }

View File

@ -131,7 +131,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
m_cornerRadius( aParent, m_cornerRadiusLabel, m_tcCornerRadius, m_cornerRadiusUnits, true ),
m_holeX( aParent, m_holeXLabel, m_holeXCtrl, m_holeXUnits, true ),
m_holeY( aParent, m_holeYLabel, m_holeYCtrl, m_holeYUnits, true ),
m_OrientValidator( 1, &m_OrientValue ),
m_OrientValidator( 3, &m_OrientValue ),
m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits, true ),
m_maskClearance( aParent, m_maskClearanceLabel, m_maskClearanceCtrl, m_maskClearanceUnits, true ),
m_pasteClearance( aParent, m_pasteClearanceLabel, m_pasteClearanceCtrl, m_pasteClearanceUnits, true ),
@ -470,12 +470,12 @@ void DIALOG_PAD_PROPERTIES::initValues()
if( footprint )
{
msg.Printf( _("Footprint %s (%s), %s, rotated %.1f deg"),
msg.Printf( _("Footprint %s (%s), %s, rotated %g deg"),
footprint->Reference().GetShownText(),
footprint->Value().GetShownText(),
footprint->IsFlipped() ? _( "back side (mirrored)" )
: _( "front side" ),
footprint->GetOrientation() / 10.0 );
footprint->GetOrientationDegrees() );
}
m_parentInfo->SetLabel( msg );