diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 796c3162ee..223d9b53b2 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -747,10 +747,9 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting() canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; } - // Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation - // the user will be prompted to switch to OpenGL + // Legacy canvas no longer supported. Switch to OpenGL, falls back to Cairo on failure 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; } @@ -763,7 +762,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas // a parent frame) FRAME_T allowed_frames[] = { - FRAME_SCH, + FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR, FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR, FRAME_GERBER, FRAME_PL_EDITOR @@ -1106,38 +1105,17 @@ void EDA_DRAW_FRAME::resolveCanvasType() { 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." ); + // Save Cairo as default in case OpenGL crashes + saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); - wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO ); + // Switch to OpenGL, which will save the new setting if successful + SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ); - dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) ); - - if( dlg.ShowModal() == wxID_YES ) - { - // Save Cairo as default in case OpenGL crashes - saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); - - // Switch to OpenGL, which will save the new setting if successful - SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ); - - // Switch back to Cairo if OpenGL is not supported - if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) - SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); - - HardRedraw(); - } - else - { - // If they were on legacy, switch to Cairo + // Switch back to Cairo if OpenGL is not supported + if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); - HardRedraw(); - } + + HardRedraw(); } m_firstRunDialogSetting = 1; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 5d7a736b42..c8f5c80e97 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -286,13 +286,6 @@ void SCH_BASE_FRAME::createCanvas() { 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, GetGalDisplayOptions(), m_canvasType ) ); ActivateGalCanvas(); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 1155db6826..0a463a9b84 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -126,6 +126,19 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_settings = Pgm().GetSettingsManager().GetAppSettings(); 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 KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions(); gal_opts.m_axesEnabled = true; @@ -143,16 +156,6 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : setupTools(); 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(); ReCreateHToolbar(); ReCreateVToolbar(); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index d146ae1342..3571c1720e 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -108,15 +108,13 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) END_EVENT_TABLE() -FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, - EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) : +FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString, wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ), m_show_layer_manager_tools( true ) { m_showBorderAndTitleBlock = false; // true to show the frame references - m_canvasType = aBackend; m_aboutTitle = _( "KiCad Footprint Editor" ); m_selLayerBox = nullptr; m_editorSettings = nullptr; @@ -135,17 +133,13 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, SetIcons( icon_bundle ); // Create GAL canvas - if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN ) - m_canvasType = loadCanvasTypeSetting(); - else - m_canvasType = aBackend; + m_canvasType = loadCanvasTypeSetting(); PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize, GetGalDisplayOptions(), m_canvasType ); SetCanvas( drawPanel ); SetBoard( new BOARD() ); - // This board will only be used to hold a footprint for editing 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_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true ); + resolveCanvasType(); + // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize // parameters in m_LayersManager // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 3bbb729fbc..b60c6bc394 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -316,7 +316,7 @@ public: protected: /// 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 diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index d41b01221c..ac367510f1 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -178,7 +178,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent fpPanel->Fit(); // Create GAL canvas + resolveCanvasType(); m_canvasType = loadCanvasTypeSetting(); + SwitchCanvas( m_canvasType ); + PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize, GetGalDisplayOptions(), m_canvasType ); SetCanvas( drawPanel ); diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index e82abc2e9a..8407508560 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -96,8 +96,7 @@ static struct IFACE : public KIFACE_BASE } case FRAME_FOOTPRINT_EDITOR: - return new FOOTPRINT_EDIT_FRAME( aKiway, aParent, - EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN ); + return new FOOTPRINT_EDIT_FRAME( aKiway, aParent ); case FRAME_FOOTPRINT_VIEWER: case FRAME_FOOTPRINT_VIEWER_MODAL: