Improve default canvas handling.

Fixes: lp:1813973
* https://bugs.launchpad.net/kicad/+bug/1813973
This commit is contained in:
Jeff Young 2019-01-31 19:43:13 +00:00
parent a375edf9ac
commit b6a06aa129
5 changed files with 26 additions and 25 deletions

View File

@ -258,11 +258,6 @@ int BASE_SCREEN::SetGrid( const wxRealPoint& size )
}
m_Grid = nearest_grid;
wxLogWarning( _( "Grid size( %f, %f ) not in grid list, falling back "
"to grid size( %f, %f )." ),
size.x, size.y, m_Grid.m_Size.x, m_Grid.m_Size.y );
return gridIdx;
}
@ -281,11 +276,6 @@ int BASE_SCREEN::SetGrid( int aCommandId )
}
m_Grid = m_grids[0];
wxLogWarning( _( "Grid ID %d not in grid list, falling back to "
"grid size( %g, %g )." ), aCommandId,
m_Grid.m_Size.x, m_Grid.m_Size.y );
return m_grids[0].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
}

View File

@ -1069,8 +1069,10 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
wxConfigBase* cfg = Kiface().KifaceSettings();
if( cfg )
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( GetCanvasTypeKey(),
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
{
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
cfg->ReadLong( GetCanvasTypeKey(), EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
}
if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|| canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
@ -1084,7 +1086,12 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
&& !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
#ifdef __WXMAC__
// Cairo renderer doesn't handle Retina displays
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#else
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
#endif
}
return canvasType;

View File

@ -1322,8 +1322,10 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
wxConfigBase* cfg = Kiface().KifaceSettings();
if( cfg )
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( GetCanvasTypeKey(),
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
{
canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
cfg->ReadLong( GetCanvasTypeKey(), EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
}
if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
|| canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
@ -1337,7 +1339,12 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
&& !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
#ifdef __WXMAC__
// Cairo renderer doesn't handle Retina displays
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#else
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
#endif
}
return canvasType;

View File

@ -396,13 +396,15 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow*
}
#ifdef __WXMAC__
// Cairo renderer doesn't handle Retina displays
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
// Cairo renderer doesn't handle Retina displays so default to OpenGL
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
cfg->ReadLong( CanvasTypeKeyBase, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
#else
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
cfg->ReadLong( CanvasTypeKeyBase, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
#endif
auto panel = new FOOTPRINT_PREVIEW_PANEL( aKiway, aParent, gal_opts, backend );
auto panel = new FOOTPRINT_PREVIEW_PANEL( aKiway, aParent, gal_opts, canvasType );
if( pcbnew )
{

View File

@ -193,14 +193,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
UpdateTitle();
// Create GAL canvas
#ifdef __WXMAC__
// Cairo renderer doesn't handle Retina displays
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#else
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
#endif
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), backend );
GetGalDisplayOptions(),
LoadCanvasTypeSetting() );
SetGalCanvas( drawPanel );
// Create the manager and dispatcher & route draw panel events to the dispatcher