Refactor post-load actions in PcbNew and apply them consistently
Fixes: lp:1751589 * https://bugs.launchpad.net/kicad/+bug/1751589
This commit is contained in:
parent
b90528a7ae
commit
cfd67163a1
|
@ -197,8 +197,8 @@ bool PCB_EDIT_FRAME::AppendBoardFile( const wxString& aFullFileName, int aCtl )
|
|||
enabledLayers |= initialEnabledLayers;
|
||||
GetBoard()->SetEnabledLayers( enabledLayers );
|
||||
GetBoard()->SetVisibleLayers( enabledLayers );
|
||||
ReCreateLayerBox();
|
||||
ReFillLayerWidget();
|
||||
|
||||
onBoardLoaded();
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() );
|
||||
|
@ -206,9 +206,6 @@ bool PCB_EDIT_FRAME::AppendBoardFile( const wxString& aFullFileName, int aCtl )
|
|||
GetBoard()->BuildListOfNets();
|
||||
GetBoard()->SynchronizeNetsAndNetClasses();
|
||||
|
||||
SetStatusText( wxEmptyString );
|
||||
Zoom_Automatique( false );
|
||||
|
||||
// Finish block move command:
|
||||
wxPoint cpos = GetNearestGridPosition( bbox.Centre() );
|
||||
blockmove.SetOrigin( bbox.GetOrigin() );
|
||||
|
|
|
@ -329,8 +329,9 @@ void PCB_EDIT_FRAME::Files_io_from_id( int id )
|
|||
fn.SetExt( PcbFileExtension );
|
||||
|
||||
GetBoard()->SetFileName( fn.GetFullPath() );
|
||||
UpdateTitle();
|
||||
ReCreateLayerBox();
|
||||
|
||||
onBoardLoaded();
|
||||
|
||||
OnModify();
|
||||
break;
|
||||
}
|
||||
|
@ -532,12 +533,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
loadedBoard->BuildListOfNets();
|
||||
loadedBoard->SynchronizeNetsAndNetClasses();
|
||||
|
||||
SetStatusText( wxEmptyString );
|
||||
Zoom_Automatique( false );
|
||||
|
||||
// update the layer names in the listbox
|
||||
ReCreateLayerBox( false );
|
||||
|
||||
GetScreen()->ClrModify();
|
||||
|
||||
{
|
||||
|
@ -567,8 +562,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
GetBoard()->SetFileName( fname );
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
if( !converted )
|
||||
UpdateFileHistory( GetBoard()->GetFileName() );
|
||||
|
||||
|
@ -582,27 +575,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
Compile_Ratsnest( NULL, true );
|
||||
GetBoard()->BuildConnectivity();
|
||||
|
||||
// Update info shown by the horizontal toolbars
|
||||
ReFillLayerWidget();
|
||||
ReCreateLayerBox();
|
||||
|
||||
// upate the layer widget to match board visibility states, both layers and render columns.
|
||||
syncLayerVisibilities();
|
||||
syncLayerWidgetLayer();
|
||||
syncRenderStates();
|
||||
|
||||
// Update the tracks / vias available sizes list:
|
||||
ReCreateAuxiliaryToolbar();
|
||||
|
||||
// Update the RATSNEST items, which were not loaded at the time
|
||||
// BOARD::SetVisibleElements() was called from within any PLUGIN.
|
||||
// See case LAYER_RATSNEST: in BOARD::SetElementVisibility()
|
||||
GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() );
|
||||
|
||||
// Display the loaded board:
|
||||
Zoom_Automatique( false );
|
||||
|
||||
SetMsgPanel( GetBoard() );
|
||||
onBoardLoaded();
|
||||
|
||||
// Refresh the 3D view, if any
|
||||
EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
|
||||
|
|
|
@ -946,6 +946,35 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::onBoardLoaded()
|
||||
{
|
||||
UpdateTitle();
|
||||
|
||||
// Re-create layers manager based on layer info in board
|
||||
ReFillLayerWidget();
|
||||
ReCreateLayerBox();
|
||||
|
||||
// Sync layer and item visibility
|
||||
syncLayerVisibilities();
|
||||
syncLayerWidgetLayer();
|
||||
syncRenderStates();
|
||||
|
||||
// Update the tracks / vias available sizes list:
|
||||
ReCreateAuxiliaryToolbar();
|
||||
|
||||
// Update the RATSNEST items, which were not loaded at the time
|
||||
// BOARD::SetVisibleElements() was called from within any PLUGIN.
|
||||
// See case LAYER_RATSNEST: in BOARD::SetElementVisibility()
|
||||
GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() );
|
||||
|
||||
// Display the loaded board:
|
||||
Zoom_Automatique( false );
|
||||
|
||||
SetMsgPanel( GetBoard() );
|
||||
SetStatusText( wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::syncLayerWidgetLayer()
|
||||
{
|
||||
m_Layers->SelectLayer( GetActiveLayer() );
|
||||
|
|
|
@ -163,6 +163,11 @@ protected:
|
|||
return FindWindowByName( pythonConsoleNameId() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the state of the GUI after a new board is loaded or created
|
||||
*/
|
||||
void onBoardLoaded();
|
||||
|
||||
/**
|
||||
* Function syncLayerWidgetLayer
|
||||
* updates the currently layer "selection" within the PCB_LAYER_WIDGET.
|
||||
|
|
Loading…
Reference in New Issue