From 15e5eabb9124471a7a31bdeb6823d7f51be1ce66 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 29 Apr 2024 13:44:09 +0200 Subject: [PATCH] DIALOG_ZONE_MANAGER: refresh zone display when resizing the dialog. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17892 --- pcbnew/zone_manager/dialog_zone_manager.cpp | 7 +++++++ pcbnew/zone_manager/dialog_zone_manager.h | 1 + pcbnew/zone_manager/dialog_zone_manager_base.cpp | 4 +++- pcbnew/zone_manager/dialog_zone_manager_base.fbp | 1 + pcbnew/zone_manager/dialog_zone_manager_base.h | 3 ++- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pcbnew/zone_manager/dialog_zone_manager.cpp b/pcbnew/zone_manager/dialog_zone_manager.cpp index 56c2519a8e..4e3d94f391 100644 --- a/pcbnew/zone_manager/dialog_zone_manager.cpp +++ b/pcbnew/zone_manager/dialog_zone_manager.cpp @@ -226,6 +226,13 @@ int InvokeZonesManager( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aZoneInfo ) } +void DIALOG_ZONE_MANAGER::onDialogResize( wxSizeEvent& event ) +{ + event.Skip(); + FitCanvasToScreen(); +} + + void DIALOG_ZONE_MANAGER::OnZoneSelectionChanged( ZONE* zone ) { for( ZONE_SELECTION_CHANGE_NOTIFIER* i : diff --git a/pcbnew/zone_manager/dialog_zone_manager.h b/pcbnew/zone_manager/dialog_zone_manager.h index 48dbdf975f..104775d947 100644 --- a/pcbnew/zone_manager/dialog_zone_manager.h +++ b/pcbnew/zone_manager/dialog_zone_manager.h @@ -74,6 +74,7 @@ protected: void SelectZoneTableItem( wxDataViewItem const& aItem ); void OnViewZonesOverviewOnLeftUp( wxMouseEvent& aEvent ) override; + void onDialogResize( wxSizeEvent& event ) override; void OnOk( wxCommandEvent& aEvt ); diff --git a/pcbnew/zone_manager/dialog_zone_manager_base.cpp b/pcbnew/zone_manager/dialog_zone_manager_base.cpp index 0eead1d469..0e86dca615 100644 --- a/pcbnew/zone_manager/dialog_zone_manager_base.cpp +++ b/pcbnew/zone_manager/dialog_zone_manager_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -104,6 +104,7 @@ DIALOG_ZONE_MANAGER_BASE::DIALOG_ZONE_MANAGER_BASE( wxWindow* parent, wxWindowID m_MainBoxSizer->Fit( this ); // Connect Events + this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_ZONE_MANAGER_BASE::onDialogResize ) ); m_viewZonesOverview->Connect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableChar ), NULL, this ); m_viewZonesOverview->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableCharHook ), NULL, this ); m_viewZonesOverview->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ZONE_MANAGER_BASE::OnDataViewCtrlSelectionChanged ), NULL, this ); @@ -119,6 +120,7 @@ DIALOG_ZONE_MANAGER_BASE::DIALOG_ZONE_MANAGER_BASE( wxWindow* parent, wxWindowID DIALOG_ZONE_MANAGER_BASE::~DIALOG_ZONE_MANAGER_BASE() { // Disconnect Events + this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_ZONE_MANAGER_BASE::onDialogResize ) ); m_viewZonesOverview->Disconnect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableChar ), NULL, this ); m_viewZonesOverview->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_ZONE_MANAGER_BASE::OnTableCharHook ), NULL, this ); m_viewZonesOverview->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ZONE_MANAGER_BASE::OnDataViewCtrlSelectionChanged ), NULL, this ); diff --git a/pcbnew/zone_manager/dialog_zone_manager_base.fbp b/pcbnew/zone_manager/dialog_zone_manager_base.fbp index 225d5e51fe..27a24b2ef5 100644 --- a/pcbnew/zone_manager/dialog_zone_manager_base.fbp +++ b/pcbnew/zone_manager/dialog_zone_manager_base.fbp @@ -57,6 +57,7 @@ + onDialogResize -1,-1 m_MainBoxSizer diff --git a/pcbnew/zone_manager/dialog_zone_manager_base.h b/pcbnew/zone_manager/dialog_zone_manager_base.h index b0bcefeec0..f860f4aed1 100644 --- a/pcbnew/zone_manager/dialog_zone_manager_base.h +++ b/pcbnew/zone_manager/dialog_zone_manager_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -62,6 +62,7 @@ class DIALOG_ZONE_MANAGER_BASE : public DIALOG_SHIM wxButton* m_sdbSizerCancel; // Virtual event handlers, override them in your derived class + virtual void onDialogResize( wxSizeEvent& event ) { event.Skip(); } virtual void OnTableChar( wxKeyEvent& event ) { event.Skip(); } virtual void OnTableCharHook( wxKeyEvent& event ) { event.Skip(); } virtual void OnDataViewCtrlSelectionChanged( wxDataViewEvent& event ) { event.Skip(); }