Remove manual canvas scale from GTK

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9912
This commit is contained in:
Jon Evans 2021-12-09 18:36:44 -05:00
parent 62e6f542ed
commit 3cb7ca1db4
4 changed files with 43 additions and 37 deletions

View File

@ -181,6 +181,8 @@ static const wxChar ShowRepairSchematic[] = wxT( "ShowRepairSchematic" );
static const wxChar ShowEventCounters[] = wxT( "ShowEventCounters" ); static const wxChar ShowEventCounters[] = wxT( "ShowEventCounters" );
static const wxChar AllowManualCanvasScale[] = wxT( "AllowManualCanvasScale" );
} // namespace KEYS } // namespace KEYS
@ -288,6 +290,7 @@ ADVANCED_CFG::ADVANCED_CFG()
m_Skip3DModelMemoryCache = false; m_Skip3DModelMemoryCache = false;
m_HideVersionFromTitle = false; m_HideVersionFromTitle = false;
m_ShowEventCounters = false; m_ShowEventCounters = false;
m_AllowManualCanvasScale = false;
loadFromConfigFile(); loadFromConfigFile();
} }
@ -406,6 +409,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowEventCounters, configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowEventCounters,
&m_ShowEventCounters, false ) ); &m_ShowEventCounters, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::AllowManualCanvasScale,
&m_AllowManualCanvasScale, false ) );
// Special case for trace mask setting...we just grab them and set them immediately // Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config // Because we even use wxLogTrace inside of advanced config
wxString traceMasks = ""; wxString traceMasks = "";
@ -416,6 +422,7 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
// Now actually set the trace masks // Now actually set the trace masks
wxStringTokenizer traceMaskTokenizer( traceMasks, "," ); wxStringTokenizer traceMaskTokenizer( traceMasks, "," );
while( traceMaskTokenizer.HasMoreTokens() ) while( traceMaskTokenizer.HasMoreTokens() )
{ {
wxString mask = traceMaskTokenizer.GetNextToken(); wxString mask = traceMaskTokenizer.GetNextToken();

View File

@ -95,40 +95,42 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP
#endif #endif
/* /*
* Automatic canvas scaling works fine on Mac and MSW, and on GTK under wxWidgets 3.1 or * Automatic canvas scaling works fine on all supported platforms, so manual scaling is disabled
* better.
*/ */
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 ) if( ADVANCED_CFG::GetCfg().m_AllowManualCanvasScale )
static constexpr int dpi_scaling_precision = 1; {
static constexpr double dpi_scaling_increment = 0.5; static constexpr int dpi_scaling_precision = 1;
static constexpr double dpi_scaling_increment = 0.5;
m_canvasScaleCtrl->SetRange( DPI_SCALING::GetMinScaleFactor(), m_canvasScaleCtrl->SetRange( DPI_SCALING::GetMinScaleFactor(),
DPI_SCALING::GetMaxScaleFactor() ); DPI_SCALING::GetMaxScaleFactor() );
m_canvasScaleCtrl->SetDigits( dpi_scaling_precision ); m_canvasScaleCtrl->SetDigits( dpi_scaling_precision );
m_canvasScaleCtrl->SetIncrement( dpi_scaling_increment ); m_canvasScaleCtrl->SetIncrement( dpi_scaling_increment );
m_canvasScaleCtrl->SetValue( DPI_SCALING::GetDefaultScaleFactor() ); m_canvasScaleCtrl->SetValue( DPI_SCALING::GetDefaultScaleFactor() );
m_canvasScaleCtrl->SetToolTip( m_canvasScaleCtrl->SetToolTip(
_( "Set the scale for the canvas." _( "Set the scale for the canvas."
"\n\n" "\n\n"
"On high-DPI displays on some platforms, KiCad cannot determine the " "On high-DPI displays on some platforms, KiCad cannot determine the "
"scaling factor. In this case you may need to set this to a value to " "scaling factor. In this case you may need to set this to a value to "
"match your system's DPI scaling. 2.0 is a common value. " "match your system's DPI scaling. 2.0 is a common value. "
"\n\n" "\n\n"
"If this does not match the system DPI scaling, the canvas will " "If this does not match the system DPI scaling, the canvas will "
"not match the window size and cursor position." ) ); "not match the window size and cursor position." ) );
m_canvasScaleAuto->SetToolTip( m_canvasScaleAuto->SetToolTip(
_( "Use an automatic value for the canvas scale." _( "Use an automatic value for the canvas scale."
"\n\n" "\n\n"
"On some platforms, the automatic value is incorrect and should be " "On some platforms, the automatic value is incorrect and should be "
"set manually." ) ); "set manually." ) );
#else }
m_staticTextCanvasScale->Show( false ); else
m_canvasScaleCtrl->Show( false ); {
m_canvasScaleCtrl = nullptr; m_staticTextCanvasScale->Show( false );
m_canvasScaleAuto->Show( false ); m_canvasScaleCtrl->Show( false );
#endif m_canvasScaleCtrl = nullptr;
m_canvasScaleAuto->Show( false );
}
/* /*
* Font scaling hacks are only needed on GTK under wxWidgets 3.0. * Font scaling hacks are only needed on GTK under wxWidgets 3.0.

View File

@ -77,15 +77,10 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
#endif #endif
/* /*
* Automatic canvas scaling works fine on Mac and MSW, and on GTK under wxWidgets 3.1 or * Automatic canvas scaling works fine on all supported platforms, so it's no longer exposed as
* better. * a configuration option.
*/ */
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
m_params.emplace_back( new PARAM<double>( "appearance.canvas_scale",
&m_Appearance.canvas_scale, 1.0 ) );
#else
m_Appearance.canvas_scale = 0.0; m_Appearance.canvas_scale = 0.0;
#endif
/* /*
* Menu icons are off by default on OSX and on for all other platforms. * Menu icons are off by default on OSX and on for all other platforms.

View File

@ -202,6 +202,8 @@ public:
*/ */
bool m_ShowEventCounters; bool m_ShowEventCounters;
bool m_AllowManualCanvasScale;
private: private:
ADVANCED_CFG(); ADVANCED_CFG();