Performance enhancements for Footprint Editor construction.
This commit is contained in:
parent
92b3aca0ef
commit
33fc74a04d
|
@ -1262,7 +1262,7 @@ bool EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
|||
}
|
||||
|
||||
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting() const
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
|
||||
{
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
wxConfigBase* cfg = Kiface().KifaceSettings();
|
||||
|
|
|
@ -201,7 +201,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
SetActiveLayer( 0, true );
|
||||
Zoom_Automatique( false ); // Gives a default zoom value
|
||||
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
||||
|
||||
// Nudge user to switch to OpenGL if they are on legacy or Cairo
|
||||
if( m_firstRunDialogSetting < 1 )
|
||||
|
|
|
@ -257,6 +257,7 @@ void GERBER_LAYER_WIDGET::ReFill()
|
|||
wxEmptyString, visible, true ) );
|
||||
}
|
||||
|
||||
UpdateLayouts();
|
||||
Thaw();
|
||||
}
|
||||
|
||||
|
|
|
@ -211,11 +211,6 @@ protected:
|
|||
*/
|
||||
bool isBusy() const;
|
||||
|
||||
/**
|
||||
* Returns the canvas type stored in the application settings.
|
||||
*/
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting() const;
|
||||
|
||||
/**
|
||||
* Stores the canvas type in the application settings.
|
||||
*/
|
||||
|
@ -872,6 +867,11 @@ public:
|
|||
*/
|
||||
virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
|
||||
|
||||
/**
|
||||
* Returns the canvas type stored in the application settings.
|
||||
*/
|
||||
static EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting();
|
||||
|
||||
/**
|
||||
* Function UseGalCanvas
|
||||
* used to switch between standard and GAL-based canvas.
|
||||
|
|
|
@ -202,7 +202,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) :
|
||||
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
|
||||
|
@ -218,11 +219,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
SetIcon( icon );
|
||||
|
||||
// Create GAL canvas
|
||||
bool boardEditorWasRunning = Kiway().Player( FRAME_PCB, false ) != nullptr;
|
||||
PCB_BASE_FRAME* pcbFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(),
|
||||
pcbFrame->GetGalCanvas()->GetBackend() );
|
||||
GetGalDisplayOptions(), aBackend );
|
||||
SetGalCanvas( drawPanel );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
@ -333,7 +331,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
setupTools();
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
UseGalCanvas( pcbFrame->IsGalCanvasActive() );
|
||||
UseGalCanvas( aBackend != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
||||
|
||||
if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() )
|
||||
{
|
||||
|
@ -345,9 +343,6 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_Layers->OnLayerSelected();
|
||||
}
|
||||
|
||||
if( !boardEditorWasRunning )
|
||||
pcbFrame->Destroy();
|
||||
|
||||
m_auimgr.Update();
|
||||
updateTitle();
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ public:
|
|||
protected:
|
||||
|
||||
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
|
||||
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend );
|
||||
|
||||
PCB_LAYER_WIDGET* m_Layers; ///< the layer manager
|
||||
|
||||
|
|
|
@ -120,7 +120,9 @@ END_EVENT_TABLE()
|
|||
#endif
|
||||
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) :
|
||||
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
FRAME_T aFrameType,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
||||
|
@ -185,22 +187,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
ReCreateLibraryList();
|
||||
UpdateTitle();
|
||||
|
||||
// See for an existing board editor frame opened
|
||||
// (we need it just to know some settings )
|
||||
// TODO: find a better way to retrieve these settings)
|
||||
bool isBordEditorRunning = Kiway().Player( FRAME_PCB, false ) != nullptr;
|
||||
PCB_BASE_FRAME* pcbEditorFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
|
||||
|
||||
// Create GAL canvas
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
pcbEditorFrame->GetGalDisplayOptions(),
|
||||
pcbEditorFrame->GetGalCanvas()->GetBackend() );
|
||||
GetGalDisplayOptions(), aBackend );
|
||||
SetGalCanvas( drawPanel );
|
||||
bool switchToGalCanvas = pcbEditorFrame->IsGalCanvasActive();
|
||||
|
||||
// delete pcbEditorFrame if it was not yet in use:
|
||||
if( !isBordEditorRunning )
|
||||
pcbEditorFrame->Destroy();
|
||||
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
|
@ -295,7 +285,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
#endif
|
||||
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
UseGalCanvas( switchToGalCanvas );
|
||||
UseGalCanvas( aBackend != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
||||
updateView();
|
||||
|
||||
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
|
||||
|
|
|
@ -48,7 +48,8 @@ class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME
|
|||
friend struct PCB::IFACE; // constructor called from here only
|
||||
|
||||
protected:
|
||||
FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType );
|
||||
FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend );
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -610,7 +610,6 @@ void LAYER_WIDGET::AppendLayerRow( const ROW& aRow )
|
|||
{
|
||||
int nextRow = GetLayerRowCount();
|
||||
insertLayerRow( nextRow, aRow );
|
||||
UpdateLayouts();
|
||||
}
|
||||
|
||||
|
||||
|
@ -624,7 +623,6 @@ void LAYER_WIDGET::AppendRenderRow( const ROW& aRow )
|
|||
{
|
||||
int nextRow = GetRenderRowCount();
|
||||
insertRenderRow( nextRow, aRow );
|
||||
UpdateLayouts();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -307,6 +307,8 @@ public:
|
|||
{
|
||||
for( int row=0; row<aRowCount; ++row )
|
||||
AppendLayerRow( aRowsArray[row] );
|
||||
|
||||
UpdateLayouts();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,6 +333,8 @@ public:
|
|||
{
|
||||
for( int row=0; row<aRowCount; ++row )
|
||||
AppendRenderRow( aRowsArray[row] );
|
||||
|
||||
UpdateLayouts();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -437,7 +437,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
Zoom_Automatique( false );
|
||||
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
||||
|
||||
// Nudge user to switch to OpenGL if they are on legacy or Cairo
|
||||
if( m_firstRunDialogSetting < 1 )
|
||||
|
|
|
@ -426,6 +426,8 @@ void PCB_LAYER_WIDGET::ReFillRender()
|
|||
|
||||
AppendRenderRow( renderRow );
|
||||
}
|
||||
|
||||
UpdateLayouts();
|
||||
}
|
||||
|
||||
|
||||
|
@ -526,6 +528,8 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
}
|
||||
}
|
||||
|
||||
UpdateLayouts();
|
||||
|
||||
|
||||
// technical layers are shown in this order:
|
||||
// Because they are static, wxGetTranslation must be explicitly
|
||||
|
|
|
@ -127,11 +127,26 @@ static struct IFACE : public KIFACE_I
|
|||
}
|
||||
|
||||
case FRAME_PCB_MODULE_EDITOR:
|
||||
return new FOOTPRINT_EDIT_FRAME( aKiway, aParent );
|
||||
|
||||
case FRAME_PCB_MODULE_VIEWER:
|
||||
case FRAME_PCB_MODULE_VIEWER_MODAL:
|
||||
return new FOOTPRINT_VIEWER_FRAME( aKiway, aParent, FRAME_T( aClassId ) );
|
||||
{
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE backend;
|
||||
auto pcbFrame = static_cast<PCB_EDIT_FRAME*>( wxWindow::FindWindowByName( wxT( "Pcbnew" ) ) );
|
||||
|
||||
if( pcbFrame )
|
||||
backend = pcbFrame->GetGalCanvas()->GetBackend();
|
||||
else
|
||||
backend = EDA_DRAW_FRAME::LoadCanvasTypeSetting();
|
||||
|
||||
switch( aClassId )
|
||||
{
|
||||
case FRAME_PCB_MODULE_EDITOR:
|
||||
return new FOOTPRINT_EDIT_FRAME( aKiway, aParent, backend );
|
||||
case FRAME_PCB_MODULE_VIEWER:
|
||||
case FRAME_PCB_MODULE_VIEWER_MODAL:
|
||||
return new FOOTPRINT_VIEWER_FRAME( aKiway, aParent, FRAME_T( aClassId ), backend );
|
||||
}
|
||||
}
|
||||
|
||||
case FRAME_PCB_FOOTPRINT_WIZARD_MODAL:
|
||||
return new FOOTPRINT_WIZARD_FRAME( aKiway, aParent, FRAME_T( aClassId ) );
|
||||
|
|
Loading…
Reference in New Issue