Make OpenGL default for all apps

Fixes https://gitlab.com/kicad/code/kicad/issues/9699
This commit is contained in:
Seth Hillbrand 2021-11-21 12:32:39 -08:00
parent bbafce6ab3
commit 3f2d86adec
7 changed files with 33 additions and 61 deletions

View File

@ -747,10 +747,9 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
} }
// Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation // Legacy canvas no longer supported. Switch to OpenGL, falls back to Cairo on failure
// the user will be prompted to switch to OpenGL
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
canvasType = EDA_DRAW_PANEL_GAL::GAL_FALLBACK; canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
return canvasType; return canvasType;
} }
@ -763,7 +762,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
// a parent frame) // a parent frame)
FRAME_T allowed_frames[] = FRAME_T allowed_frames[] =
{ {
FRAME_SCH, FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR, FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER, FRAME_GERBER,
FRAME_PL_EDITOR FRAME_PL_EDITOR
@ -1105,20 +1104,6 @@ void EDA_DRAW_FRAME::resolveCanvasType()
if( m_firstRunDialogSetting < 1 ) if( m_firstRunDialogSetting < 1 )
{ {
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
{
wxString msg =
_( "KiCad can use your graphics card to give you a smoother "
"and faster experience. This option is turned off by "
"default since it is not compatible with all computers.\n\n"
"Would you like to try enabling graphics acceleration?\n\n"
"If you'd like to choose later, select Accelerated Graphics "
"in the Preferences menu." );
wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
if( dlg.ShowModal() == wxID_YES )
{ {
// Save Cairo as default in case OpenGL crashes // Save Cairo as default in case OpenGL crashes
saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
@ -1132,13 +1117,6 @@ void EDA_DRAW_FRAME::resolveCanvasType()
HardRedraw(); HardRedraw();
} }
else
{
// If they were on legacy, switch to Cairo
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
HardRedraw();
}
}
m_firstRunDialogSetting = 1; m_firstRunDialogSetting = 1;
SaveSettings( config() ); SaveSettings( config() );

View File

@ -286,13 +286,6 @@ void SCH_BASE_FRAME::createCanvas()
{ {
m_canvasType = loadCanvasTypeSetting(); m_canvasType = loadCanvasTypeSetting();
// Allows only a CAIRO or OPENGL canvas:
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL
&& m_canvasType != EDA_DRAW_PANEL_GAL::GAL_FALLBACK )
{
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
}
SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize, SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize,
GetGalDisplayOptions(), m_canvasType ) ); GetGalDisplayOptions(), m_canvasType ) );
ActivateGalCanvas(); ActivateGalCanvas();

View File

@ -126,6 +126,19 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>(); m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
LoadSettings( m_settings ); LoadSettings( m_settings );
m_libMgr = new SYMBOL_LIBRARY_MANAGER( *this );
// Preload libraries before using SyncLibraries the first time, as the preload is threaded
WX_PROGRESS_REPORTER reporter( this, _( "Loading Symbol Libraries" ),
m_libMgr->GetLibraryCount(), true );
m_libMgr->Preload( reporter );
SyncLibraries( false );
m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
resolveCanvasType();
SwitchCanvas( m_canvasType );
// Ensure axis are always drawn // Ensure axis are always drawn
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions(); KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
gal_opts.m_axesEnabled = true; gal_opts.m_axesEnabled = true;
@ -143,16 +156,6 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
setupTools(); setupTools();
setupUIConditions(); setupUIConditions();
m_libMgr = new SYMBOL_LIBRARY_MANAGER( *this );
// Preload libraries before using SyncLibraries the first time, as the preload is threaded
WX_PROGRESS_REPORTER reporter( this, _( "Loading Symbol Libraries" ),
m_libMgr->GetLibraryCount(), true );
m_libMgr->Preload( reporter );
SyncLibraries( false );
m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();

View File

@ -108,15 +108,13 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
END_EVENT_TABLE() 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_FOOTPRINT_EDITOR, wxEmptyString, PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ), KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ),
m_show_layer_manager_tools( true ) m_show_layer_manager_tools( true )
{ {
m_showBorderAndTitleBlock = false; // true to show the frame references m_showBorderAndTitleBlock = false; // true to show the frame references
m_canvasType = aBackend;
m_aboutTitle = _( "KiCad Footprint Editor" ); m_aboutTitle = _( "KiCad Footprint Editor" );
m_selLayerBox = nullptr; m_selLayerBox = nullptr;
m_editorSettings = nullptr; m_editorSettings = nullptr;
@ -135,17 +133,13 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
SetIcons( icon_bundle ); SetIcons( icon_bundle );
// Create GAL canvas // Create GAL canvas
if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN )
m_canvasType = loadCanvasTypeSetting(); m_canvasType = loadCanvasTypeSetting();
else
m_canvasType = aBackend;
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 );
SetCanvas( drawPanel ); SetCanvas( drawPanel );
SetBoard( new BOARD() ); SetBoard( new BOARD() );
// This board will only be used to hold a footprint for editing // This board will only be used to hold a footprint for editing
GetBoard()->SetBoardUse( BOARD_USE::FPHOLDER ); GetBoard()->SetBoardUse( BOARD_USE::FPHOLDER );
@ -191,6 +185,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this ); m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true ); m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
resolveCanvasType();
// LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
// parameters in m_LayersManager // parameters in m_LayersManager
// NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew

View File

@ -316,7 +316,7 @@ public:
protected: 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, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ); FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
/** /**
* 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

View File

@ -178,7 +178,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
fpPanel->Fit(); fpPanel->Fit();
// Create GAL canvas // Create GAL canvas
resolveCanvasType();
m_canvasType = loadCanvasTypeSetting(); m_canvasType = loadCanvasTypeSetting();
SwitchCanvas( m_canvasType );
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 );
SetCanvas( drawPanel ); SetCanvas( drawPanel );

View File

@ -96,8 +96,7 @@ static struct IFACE : public KIFACE_BASE
} }
case FRAME_FOOTPRINT_EDITOR: case FRAME_FOOTPRINT_EDITOR:
return new FOOTPRINT_EDIT_FRAME( aKiway, aParent, return new FOOTPRINT_EDIT_FRAME( aKiway, aParent );
EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN );
case FRAME_FOOTPRINT_VIEWER: case FRAME_FOOTPRINT_VIEWER:
case FRAME_FOOTPRINT_VIEWER_MODAL: case FRAME_FOOTPRINT_VIEWER_MODAL: