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.
This commit is contained in:
JamesJ 2024-04-01 20:56:10 +01:00 committed by Jon Evans
parent 951065390e
commit a321a86f38
4 changed files with 14 additions and 6 deletions

View File

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

View File

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

View File

@ -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::optional<LIST
* ***************************************************************************************/
void PCB_NET_INSPECTOR_PANEL::onBoardChanged( wxCommandEvent& event )
void PCB_NET_INSPECTOR_PANEL::OnBoardChanged()
{
m_brd = m_frame->GetBoard();
@ -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 )

View File

@ -85,6 +85,10 @@ public:
virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
std::vector<BOARD_ITEM*>& aRemovedItems,
std::vector<BOARD_ITEM*>& 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();