Disable legacy canvas on GTK3

This make the use of legacy canvas on GTK3 a default-off
advanced config. Legacy is substantially broken on GTK3
and is of basically no use at all to general users on this
platform.

If the program starts with legacy canvas in the config,
it is forced into a GAL mode, as otherwise it could happen
that the user is stuck and unable to get into pcbnew to change
the setting.

Fixes: lp:1803156
* https://bugs.launchpad.net/kicad/+bug/1803156
This commit is contained in:
John Beard 2018-12-12 14:16:50 +00:00 committed by Wayne Stambaugh
parent 892f7cf8ff
commit e856a7a09c
7 changed files with 88 additions and 22 deletions

View File

@ -61,6 +61,13 @@ namespace AC_KEYS
*/
static const wxChar EnableSvgImport[] = wxT( "EnableSvgImport" );
/**
* Allow legacy canvas to be shown in GTK3. Legacy canvas is generally pretty
* broken, but this avoids code in an ifdef where it could become broken
* on other platforms
*/
static const wxChar AllowLegacyCanvasInGtk3[] = wxT( "AllowLegacyCanvasInGtk3" );
} // namespace KEYS
@ -139,6 +146,7 @@ ADVANCED_CFG::ADVANCED_CFG()
// Init defaults - this is done in case the config doesn't exist,
// then the values will remain as set here.
m_enableSvgImport = false;
m_allowLegacyCanvasInGtk3 = false;
loadFromConfigFile();
}
@ -175,7 +183,24 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back(
new PARAM_CFG_BOOL( true, AC_KEYS::EnableSvgImport, &m_enableSvgImport, false ) );
configParams.push_back( new PARAM_CFG_BOOL(
true, AC_KEYS::AllowLegacyCanvasInGtk3, &m_allowLegacyCanvasInGtk3, false ) );
wxConfigLoadSetups( &aCfg, configParams );
dumpCfg( configParams );
}
bool ADVANCED_CFG::AllowLegacyCanvas() const
{
// default is to allow
bool allow = true;
// on GTK3, check the config
#ifdef __WXGTK3__
allow = m_allowLegacyCanvasInGtk3;
#endif
return allow;
}

View File

@ -67,6 +67,7 @@
#include <worksheet_shape_builder.h>
#include <page_info.h>
#include <title_block.h>
#include <advanced_config.h>
/**
* Definition for enabling and disabling scroll bar setting trace output. See the
@ -1083,6 +1084,13 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
}
// Coerce the value into a GAL type when Legacy is not available
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
&& !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
}
return canvasType;
}

View File

@ -66,10 +66,11 @@
#include <tool/tool_dispatcher.h>
#include <tool/actions.h>
#include <advanced_config.h>
#include <menus_helpers.h>
#include <worksheet_shape_builder.h>
#include <page_info.h>
#include <title_block.h>
#include <worksheet_shape_builder.h>
/**
* Definition for enabling and disabling scroll bar setting trace output. See the
@ -1329,6 +1330,13 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
}
// Coerce the value into a GAL type when Legacy is not available
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
&& !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
}
return canvasType;
}

View File

@ -28,11 +28,12 @@
* @brief (Re)Create the main menubar for GerbView
*/
#include "gerbview_frame.h"
#include <advanced_config.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include "gerbview_frame.h"
#include "gerbview_id.h"
#include "hotkeys.h"
#include <menus_helpers.h>
@ -300,10 +301,13 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
// Canvas selection
configMenu->AppendSeparator();
text = AddHotkeyName( _( "Legacy Tool&set" ), GerbviewHokeysDescr, HK_CANVAS_LEGACY );
AddMenuItem( configMenu, ID_MENU_CANVAS_LEGACY,
text, _( "Use Legacy Toolset (not all features will be available)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
text = AddHotkeyName( _( "Legacy Tool&set" ), GerbviewHokeysDescr, HK_CANVAS_LEGACY );
AddMenuItem( configMenu, ID_MENU_CANVAS_LEGACY, text,
_( "Use Legacy Toolset (not all features will be available)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
}
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), GerbviewHokeysDescr, HK_CANVAS_OPENGL );
AddMenuItem( configMenu, ID_MENU_CANVAS_OPENGL, text,

View File

@ -73,6 +73,21 @@ public:
*/
bool m_enableSvgImport;
/**
* Helper to determine if legacy canvas is allowed (according to platform
* and config)
* @return true if legacy canvas should be shown
*/
bool AllowLegacyCanvas() const;
private:
/*
* These settings are private, as there is extra logic provide by helper
* functions above.
*/
bool m_allowLegacyCanvasInGtk3;
private:
ADVANCED_CFG();

View File

@ -29,13 +29,14 @@
* @brief (Re)Create the main menubar for the footprint editor
*/
#include "footprint_edit_frame.h"
#include <advanced_config.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "footprint_edit_frame.h"
#include "pcbnew.h"
#include "pcbnew_id.h"
@ -431,10 +432,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
prefs_menu->AppendSeparator();
text = AddHotkeyName( _( "Legacy Tool&set" ), m_hotkeysDescrList, HK_CANVAS_LEGACY );
AddMenuItem( prefs_menu, ID_MENU_CANVAS_LEGACY, text,
_( "Use Legacy Toolset (not all features will be available)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
text = AddHotkeyName( _( "Legacy Tool&set" ), m_hotkeysDescrList, HK_CANVAS_LEGACY );
AddMenuItem( prefs_menu, ID_MENU_CANVAS_LEGACY, text,
_( "Use Legacy Toolset (not all features will be available)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
}
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), m_hotkeysDescrList, HK_CANVAS_OPENGL );
AddMenuItem( prefs_menu, ID_MENU_CANVAS_OPENGL, text,

View File

@ -28,20 +28,19 @@
* @file menubar_pcb_editor.cpp
* board editor menubars
*/
#include <menus_helpers.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <pcb_edit_frame.h>
#include <advanced_config.h>
#include <kiface_i.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "pcbnew.h"
#include "pcbnew_id.h"
// Build the files menu. Because some commands are available only if
// Pcbnew is run outside a project (run alone), aIsOutsideProject is false
// when Pcbnew is run from Kicad manager, and true is run as stand alone app.
@ -158,11 +157,14 @@ void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
_( "&Preferences..." ), _( "Show preferences for all open tools" ),
KiBitmap( preference_xpm ) );
text = AddHotkeyName( _( "Legacy Tool&set" ), g_Board_Editor_Hotkeys_Descr,
HK_CANVAS_LEGACY );
AddMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY, text,
_( "Use Legacy Toolset (not all features will be available)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
{
text = AddHotkeyName(
_( "Legacy Tool&set" ), g_Board_Editor_Hotkeys_Descr, HK_CANVAS_LEGACY );
AddMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY, text,
_( "Use Legacy Toolset (not all features will be available)" ),
KiBitmap( tools_xpm ), wxITEM_RADIO );
}
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Board_Editor_Hotkeys_Descr,
HK_CANVAS_OPENGL );