From a321a86f3802948db2ea71d9704b59e1a8cbb804 Mon Sep 17 00:00:00 2001 From: JamesJ <13408010-JamesJCode@users.noreply.gitlab.com> Date: Mon, 1 Apr 2024 20:56:10 +0100 Subject: [PATCH] Update net inspector after connectivity update when loading board Fixes issue where if the net inspector was open when a board was loaded, the track data would not be updated until a board edit action triggered an update. --- pcbnew/pcb_edit_frame.cpp | 4 ++++ pcbnew/widgets/net_inspector_panel.h | 5 +++++ pcbnew/widgets/pcb_net_inspector_panel.cpp | 6 +----- pcbnew/widgets/pcb_net_inspector_panel.h | 5 ++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 652aecffbe..c39c8252fd 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1578,6 +1578,10 @@ void PCB_EDIT_FRAME::onBoardLoaded() // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes unitsChangeRefresh(); + // Sync the net inspector now we have connectivity calculated + if( m_netInspectorPanel ) + m_netInspectorPanel->OnBoardChanged(); + // Display the loaded board: Zoom_Automatique( false ); diff --git a/pcbnew/widgets/net_inspector_panel.h b/pcbnew/widgets/net_inspector_panel.h index e9b28be741..1aebcef51b 100644 --- a/pcbnew/widgets/net_inspector_panel.h +++ b/pcbnew/widgets/net_inspector_panel.h @@ -65,6 +65,11 @@ public: */ virtual void OnShowPanel() {} + /** + * Notification from file loader when board changed and connectivity rebuilt + */ + virtual void OnBoardChanged() {} + protected: // User-driven UI events (override in derrived classes as required) virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); } diff --git a/pcbnew/widgets/pcb_net_inspector_panel.cpp b/pcbnew/widgets/pcb_net_inspector_panel.cpp index 7baecbb755..8237c464ae 100644 --- a/pcbnew/widgets/pcb_net_inspector_panel.cpp +++ b/pcbnew/widgets/pcb_net_inspector_panel.cpp @@ -61,7 +61,6 @@ PCB_NET_INSPECTOR_PANEL::PCB_NET_INSPECTOR_PANEL( wxWindow* parent, PCB_EDIT_FRA // Connect to board events m_frame->Bind( EDA_EVT_UNITS_CHANGED, &PCB_NET_INSPECTOR_PANEL::onUnitsChanged, this ); - m_frame->Bind( EDA_EVT_BOARD_CHANGED, &PCB_NET_INSPECTOR_PANEL::onBoardChanged, this ); // Connect to wxDataViewCtrl events m_netsList->Bind( wxEVT_DATAVIEW_ITEM_EXPANDED, &PCB_NET_INSPECTOR_PANEL::OnExpandCollapseRow, @@ -89,7 +88,6 @@ PCB_NET_INSPECTOR_PANEL::~PCB_NET_INSPECTOR_PANEL() // Disconnect from board events m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &PCB_NET_INSPECTOR_PANEL::onUnitsChanged, this ); - m_frame->Unbind( EDA_EVT_BOARD_CHANGED, &PCB_NET_INSPECTOR_PANEL::onBoardChanged, this ); // Connect to wxDataViewCtrl events m_netsList->Unbind( wxEVT_DATAVIEW_ITEM_EXPANDED, &PCB_NET_INSPECTOR_PANEL::OnExpandCollapseRow, @@ -854,7 +852,7 @@ void PCB_NET_INSPECTOR_PANEL::updateDisplayedRowValues( const std::optionalGetBoard(); @@ -871,8 +869,6 @@ void PCB_NET_INSPECTOR_PANEL::onBoardChanged( wxCommandEvent& event ) buildNetsList( true ); m_board_loading = false; - - event.Skip(); } void PCB_NET_INSPECTOR_PANEL::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) diff --git a/pcbnew/widgets/pcb_net_inspector_panel.h b/pcbnew/widgets/pcb_net_inspector_panel.h index 86bd409dcb..0ac4e2b718 100644 --- a/pcbnew/widgets/pcb_net_inspector_panel.h +++ b/pcbnew/widgets/pcb_net_inspector_panel.h @@ -85,6 +85,10 @@ public: virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector& aAddedItems, std::vector& aRemovedItems, std::vector& aDeletedItems ) override; + /** + * Update panel when board is changed + */ + virtual void OnBoardChanged() override; /** * Prepare the panel when shown in the editor @@ -187,7 +191,6 @@ private: void highlightSelectedNets(); void onUnitsChanged( wxCommandEvent& event ); - void onBoardChanged( wxCommandEvent& event ); void onSettingsMenu( wxCommandEvent& event ); void onItemContextMenu( wxCommandEvent& event ); void onAddNet();