Add a first-run dialog to encourage user to switch to OpenGL
This commit is contained in:
parent
0945c319f0
commit
2dec95b4e6
|
@ -76,6 +76,7 @@ static const wxString GalDisplayOptionsKeyword( wxT( "GalDisplayOptions" ) );
|
|||
|
||||
const wxChar EDA_DRAW_FRAME::CANVAS_TYPE_KEY[] = wxT( "canvas_type" );
|
||||
|
||||
static const wxString FirstRunShownKeyword( wxT( "FirstRunShown" ) );
|
||||
|
||||
///@}
|
||||
|
||||
|
@ -739,6 +740,8 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
|
||||
long( DEFAULT_MAX_UNDO_ITEMS ) );
|
||||
|
||||
aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L );
|
||||
|
||||
m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
|
||||
}
|
||||
|
||||
|
@ -753,6 +756,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
aCfg->Write( baseCfgName + GridColorEntryKeyword,
|
||||
GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
|
||||
aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
|
||||
aCfg->Write( baseCfgName + FirstRunShownKeyword, m_firstRunDialogSetting );
|
||||
|
||||
if( GetScreen() )
|
||||
aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
|
||||
|
|
|
@ -211,6 +211,53 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
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 )
|
||||
{
|
||||
if( 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 the Modern "
|
||||
"(Accelerated) graphics mode in the View 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
|
||||
saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
|
||||
// Switch to OpenGL, which will save the new setting if successful
|
||||
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
|
||||
auto handler = GetEventHandler();
|
||||
handler->ProcessEvent( evt );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If they were on legacy, switch them to Cairo
|
||||
|
||||
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||
{
|
||||
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
|
||||
auto handler = GetEventHandler();
|
||||
handler->ProcessEvent( evt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_firstRunDialogSetting = 1;
|
||||
SaveSettings( config() );
|
||||
}
|
||||
|
||||
// Canvas may have been updated by the dialog
|
||||
canvasType = loadCanvasTypeSetting();
|
||||
|
||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||
{
|
||||
if( GetGalCanvas()->SwitchBackend( canvasType ) )
|
||||
|
|
|
@ -50,9 +50,6 @@ enum gerbview_ids
|
|||
|
||||
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
|
||||
ID_MENU_CANVAS_LEGACY,
|
||||
ID_MENU_CANVAS_OPENGL,
|
||||
ID_MENU_CANVAS_CAIRO,
|
||||
|
||||
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE,
|
||||
ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE,
|
||||
|
|
|
@ -211,28 +211,28 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
// Canvas selection
|
||||
configMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "Legacy Canva&s" ), GerbviewHokeysDescr,
|
||||
text = AddHotkeyName( _( "Legacy graphic&s" ), GerbviewHokeysDescr,
|
||||
HK_CANVAS_LEGACY );
|
||||
|
||||
configMenu->Append(
|
||||
new wxMenuItem( configMenu, ID_MENU_CANVAS_LEGACY,
|
||||
text, _( "Switch the canvas implementation to Legacy" ),
|
||||
text, _( "Use legacy graphics mode (not all features will be available" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
text = AddHotkeyName( _( "Open&GL Canvas" ), GerbviewHokeysDescr,
|
||||
text = AddHotkeyName( _( "Modern (&Accelerated)" ), GerbviewHokeysDescr,
|
||||
HK_CANVAS_OPENGL );
|
||||
|
||||
configMenu->Append(
|
||||
new wxMenuItem( configMenu, ID_MENU_CANVAS_OPENGL,
|
||||
text, _( "Switch the canvas implementation to OpenGL" ),
|
||||
text, _( "Use modern hardware-accelerated (OpenGL) graphics mode (recommended)" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Cairo Canvas" ), GerbviewHokeysDescr,
|
||||
text = AddHotkeyName( _( "Modern (Fallba&ck)" ), GerbviewHokeysDescr,
|
||||
HK_CANVAS_CAIRO );
|
||||
|
||||
configMenu->Append(
|
||||
new wxMenuItem( configMenu, ID_MENU_CANVAS_CAIRO,
|
||||
text, _( "Switch the canvas implementation to Cairo" ),
|
||||
text, _( "Use modern fallback (Cairo) graphics mode" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
// Menu miscellaneous
|
||||
|
|
|
@ -112,6 +112,9 @@ protected:
|
|||
/// True shows the drawing border and title block.
|
||||
bool m_showBorderAndTitleBlock;
|
||||
|
||||
/// Key to control whether first run dialog is shown on startup
|
||||
long m_firstRunDialogSetting;
|
||||
|
||||
/// Choice box to choose the grid size.
|
||||
wxChoice* m_gridSelectBox;
|
||||
|
||||
|
|
|
@ -85,6 +85,10 @@ enum main_id
|
|||
ID_CONFIG_SAVE,
|
||||
ID_CONFIG_READ,
|
||||
|
||||
ID_MENU_CANVAS_LEGACY,
|
||||
ID_MENU_CANVAS_OPENGL,
|
||||
ID_MENU_CANVAS_CAIRO,
|
||||
|
||||
ID_PREFERENCES_HOTKEY_START,
|
||||
ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
|
||||
ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
|
||||
|
|
|
@ -957,8 +957,8 @@ void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
|
|||
break;
|
||||
}
|
||||
|
||||
saveCanvasTypeSetting( canvasType );
|
||||
UseGalCanvas( use_gal );
|
||||
saveCanvasTypeSetting( canvasType );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -254,28 +254,28 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
// Add canvas selection
|
||||
viewMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "Legacy Canva&s" ), m_hotkeysDescrList,
|
||||
text = AddHotkeyName( _( "Legacy graphic&s" ), m_hotkeysDescrList,
|
||||
HK_CANVAS_LEGACY );
|
||||
|
||||
viewMenu->Append(
|
||||
new wxMenuItem( viewMenu, ID_MENU_CANVAS_LEGACY,
|
||||
text, _( "Switch the canvas implementation to Legacy" ),
|
||||
text, _( "Use legacy graphics mode (not all features will be available" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
text = AddHotkeyName( _( "Open&GL Canvas" ), m_hotkeysDescrList,
|
||||
text = AddHotkeyName( _( "Modern (&Accelerated)" ), m_hotkeysDescrList,
|
||||
HK_CANVAS_OPENGL );
|
||||
|
||||
viewMenu->Append(
|
||||
new wxMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL,
|
||||
text, _( "Switch the canvas implementation to OpenGL" ),
|
||||
text, _( "Use modern hardware-accelerated (OpenGL) graphics mode (recommended)" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Cairo Canvas" ), m_hotkeysDescrList,
|
||||
text = AddHotkeyName( _( "Modern (Fallba&ck)" ), m_hotkeysDescrList,
|
||||
HK_CANVAS_CAIRO );
|
||||
|
||||
viewMenu->Append(
|
||||
new wxMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO,
|
||||
text, _( "Switch the canvas implementation to Cairo" ),
|
||||
text, _( "Use modern fallback (Cairo) graphics mode" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
//-------- Place menu --------------------
|
||||
|
|
|
@ -559,28 +559,28 @@ void prepareViewMenu( wxMenu* aParentMenu )
|
|||
|
||||
aParentMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "Legacy Canva&s" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
text = AddHotkeyName( _( "Legacy graphic&s" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
HK_CANVAS_LEGACY );
|
||||
|
||||
aParentMenu->Append(
|
||||
new wxMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY,
|
||||
text, _( "Switch canvas implementation to Legacy" ),
|
||||
text, _( "Use legacy graphics mode (not all features will be available" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
text = AddHotkeyName( _( "Open&GL Canvas" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
text = AddHotkeyName( _( "Modern (&Accelerated)" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
HK_CANVAS_OPENGL );
|
||||
|
||||
aParentMenu->Append(
|
||||
new wxMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL,
|
||||
text, _( "Switch canvas implementation to OpenGL" ),
|
||||
text, _( "Use modern hardware-accelerated (OpenGL) graphics mode (recommended)" ),
|
||||
wxITEM_RADIO ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Cairo Canvas" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
text = AddHotkeyName( _( "Modern (Fallba&ck)" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
HK_CANVAS_CAIRO );
|
||||
|
||||
aParentMenu->Append(
|
||||
new wxMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO,
|
||||
text, _( "Switch canvas implementation to Cairo" ),
|
||||
text, _( "Use modern fallback (Cairo) graphics mode" ),
|
||||
wxITEM_RADIO ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -470,6 +470,53 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
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 )
|
||||
{
|
||||
if( 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 the Modern "
|
||||
"(Accelerated) graphics mode in the View 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
|
||||
saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
|
||||
// Switch to OpenGL, which will save the new setting if successful
|
||||
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
|
||||
auto handler = GetEventHandler();
|
||||
handler->ProcessEvent( evt );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If they were on legacy, switch them to Cairo
|
||||
|
||||
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||
{
|
||||
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
|
||||
auto handler = GetEventHandler();
|
||||
handler->ProcessEvent( evt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_firstRunDialogSetting = 1;
|
||||
SaveSettings( config() );
|
||||
}
|
||||
|
||||
// Canvas may have been updated by the dialog
|
||||
canvasType = loadCanvasTypeSetting();
|
||||
|
||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
||||
{
|
||||
if( GetGalCanvas()->SwitchBackend( canvasType ) )
|
||||
|
|
|
@ -299,9 +299,6 @@ enum pcbnew_ids
|
|||
|
||||
ID_PCB_GEN_CMP_FILE,
|
||||
ID_MENU_PCB_SHOW_3D_FRAME,
|
||||
ID_MENU_CANVAS_LEGACY,
|
||||
ID_MENU_CANVAS_OPENGL,
|
||||
ID_MENU_CANVAS_CAIRO,
|
||||
ID_PCB_USER_GRID_SETUP,
|
||||
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
|
||||
ID_PCB_LIB_WIZARD,
|
||||
|
|
Loading…
Reference in New Issue