FOOTPRINT_EDIT_FRAME: ensure the canvas type comes from the FOOTPRINT_EDITOR_SETTINGS config
Previously, although the fp editor preferences has an option to select the canvas type, it was read from the the PCBNEW_SETTINGS config, using Kiface().KifaceSettings().
This commit is contained in:
parent
ca9fdbbedb
commit
93b5038382
|
@ -846,7 +846,7 @@ void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting()
|
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting( APP_SETTINGS_BASE* aCfg )
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
// Cairo renderer doesn't handle Retina displays so there's really only one game
|
// Cairo renderer doesn't handle Retina displays so there's really only one game
|
||||||
|
@ -855,7 +855,7 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||||
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
|
APP_SETTINGS_BASE* cfg = aCfg ? aCfg : Kiface().KifaceSettings();
|
||||||
|
|
||||||
if( cfg )
|
if( cfg )
|
||||||
canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( cfg->m_Graphics.canvas_type );
|
canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( cfg->m_Graphics.canvas_type );
|
||||||
|
|
|
@ -502,12 +502,14 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Determines the Canvas type to load (with prompt if required) and initializes m_canvasType
|
* Determines the Canvas type to load (with prompt if required) and initializes m_canvasType
|
||||||
*/
|
*/
|
||||||
void resolveCanvasType();
|
virtual void resolveCanvasType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the canvas type stored in the application settings.
|
* Returns the canvas type stored in the application settings.
|
||||||
|
* @param aCfg is the APP_SETTINGS_BASE config storing the canvas type.
|
||||||
|
* If nullptr (default) the KifaceSettings() will be used
|
||||||
*/
|
*/
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting();
|
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting( APP_SETTINGS_BASE* aCfg = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the canvas type in the application settings.
|
* Stores the canvas type in the application settings.
|
||||||
|
|
|
@ -130,7 +130,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
SetIcons( icon_bundle );
|
SetIcons( icon_bundle );
|
||||||
|
|
||||||
// Create GAL canvas
|
// Create GAL canvas
|
||||||
m_canvasType = loadCanvasTypeSetting();
|
m_canvasType = loadCanvasTypeSetting( GetSettings() );
|
||||||
|
|
||||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
|
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
|
||||||
GetGalDisplayOptions(), m_canvasType );
|
GetGalDisplayOptions(), m_canvasType );
|
||||||
|
@ -632,6 +632,19 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FOOTPRINT_EDIT_FRAME::resolveCanvasType()
|
||||||
|
{
|
||||||
|
// Load canvas type from the FOOTPRINT_EDITOR_SETTINGS:
|
||||||
|
m_canvasType = loadCanvasTypeSetting( GetSettings() );
|
||||||
|
|
||||||
|
// If we had an OpenGL failure this session, use the fallback GAL but don't update the
|
||||||
|
// user preference silently:
|
||||||
|
|
||||||
|
if( m_openGLFailureOccured && m_canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
|
||||||
|
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_FALLBACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
{
|
{
|
||||||
GetGalDisplayOptions().m_axesEnabled = true;
|
GetGalDisplayOptions().m_axesEnabled = true;
|
||||||
|
|
|
@ -331,6 +331,11 @@ protected:
|
||||||
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
|
/// 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 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the Canvas type to load (with prompt if required) and initializes m_canvasType
|
||||||
|
*/
|
||||||
|
void resolveCanvasType() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure the footprint info list is loaded (with a progress dialog) and then initialize
|
* Make sure the footprint info list is loaded (with a progress dialog) and then initialize
|
||||||
* the footprint library tree.
|
* the footprint library tree.
|
||||||
|
|
Loading…
Reference in New Issue