Beat wxWidgets into submission.

Fixes https://gitlab.com/kicad/code/kicad/issues/5534
This commit is contained in:
Jeff Young 2020-09-06 22:38:00 +01:00
parent f2e0b4a6f6
commit a1e8ecc616
5 changed files with 43 additions and 0 deletions

View File

@ -1098,6 +1098,42 @@ void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask, bool remove_uncon
}
bool DIALOG_PAD_PROPERTIES::Show( bool aShow )
{
bool retVal = DIALOG_SHIM::Show( aShow );
if( aShow )
{
// It *should* work to set the stackup bitmap in the constructor, but it doesn't.
// wxWidgets needs to have these set when the panel is visible for some reason.
// https://gitlab.com/kicad/code/kicad/-/issues/5534
setPadLayersList( m_dummyPad->GetLayerSet(), m_dummyPad->GetRemoveUnconnected(),
m_dummyPad->GetKeepTopBottom() );
m_stackupPanel->Layout();
}
return retVal;
}
void DIALOG_PAD_PROPERTIES::OnPreviewPageChanged( wxNotebookEvent& event )
{
if( event.GetSelection() == 1 )
{
// It *should* work to set the stackup bitmap in the constructor, but it doesn't.
// wxWidgets needs to have these set when the panel is visible for some reason.
// https://gitlab.com/kicad/code/kicad/-/issues/5534
setPadLayersList( m_dummyPad->GetLayerSet(), m_dummyPad->GetRemoveUnconnected(),
m_dummyPad->GetKeepTopBottom() );
m_stackupPanel->Layout();
}
event.Skip();
}
void DIALOG_PAD_PROPERTIES::OnSetCopperLayers( wxCommandEvent& event )
{
if( m_PadType->GetSelection() == 0 || m_PadType->GetSelection() == 3 )

View File

@ -106,11 +106,14 @@ private:
/// Copy values from dialog field to aPad's members
bool transferDataToPad( D_PAD* aPad );
bool Show( bool aShow ) override;
// event handlers:
void OnInitDialog( wxInitDialogEvent& event ) override;
void OnResize( wxSizeEvent& event );
void OnCancel( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void OnPreviewPageChanged( wxNotebookEvent& event ) override;
void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override
{

View File

@ -979,6 +979,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_buttonDup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDuplicatePrimitive ), NULL, this );
m_buttonGeometry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
m_buttonDel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDeletePrimitive ), NULL, this );
m_previewNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPreviewPageChanged ), NULL, this );
m_cbShowPadOutline->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onChangePadMode ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );
}
@ -1039,6 +1040,7 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
m_buttonDup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDuplicatePrimitive ), NULL, this );
m_buttonGeometry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
m_buttonDel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDeletePrimitive ), NULL, this );
m_previewNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPreviewPageChanged ), NULL, this );
m_cbShowPadOutline->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onChangePadMode ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );

View File

@ -9864,6 +9864,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnNotebookPageChanged">OnPreviewPageChanged</event>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Board View</property>

View File

@ -245,6 +245,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
virtual void onDuplicatePrimitive( wxCommandEvent& event ) { event.Skip(); }
virtual void onGeometryTransform( wxCommandEvent& event ) { event.Skip(); }
virtual void onDeletePrimitive( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPreviewPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void onChangePadMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }