mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Fix screen scaling
We don't use wxWidget DPI (which is the screen DPI) for our on-screen display. Instead, we use 91 (?!?). Make this configurable in advanced config and use the set value in our scaling widget
This commit is contained in:
parent
1df5ad0e4c
commit
6dd03bc735
@ -131,6 +131,7 @@ static const wxChar ConfigurableToolbars[] = wxT( "ConfigurableToolbars" );
|
||||
static const wxChar MaxPastedTextLength[] = wxT( "MaxPastedTextLength" );
|
||||
static const wxChar PNSProcessClusterTimeout[] = wxT( "PNSProcessClusterTimeout" );
|
||||
static const wxChar ImportSkipComponentBodies[] = wxT( "ImportSkipComponentBodies" );
|
||||
static const wxChar ScreenDPI[] = wxT( "ScreenDPI" );
|
||||
|
||||
} // namespace KEYS
|
||||
|
||||
@ -320,6 +321,8 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
|
||||
m_ImportSkipComponentBodies = false;
|
||||
|
||||
m_ScreenDPI = 91;
|
||||
|
||||
loadFromConfigFile();
|
||||
}
|
||||
|
||||
@ -634,6 +637,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
&m_ImportSkipComponentBodies,
|
||||
m_ImportSkipComponentBodies ) );
|
||||
|
||||
m_entries.push_back( std::make_unique<PARAM_CFG_INT>( true, AC_KEYS::ScreenDPI,
|
||||
&m_ScreenDPI, m_ScreenDPI,
|
||||
50, 500 ) );
|
||||
|
||||
// Special case for trace mask setting...we just grab them and set them immediately
|
||||
// Because we even use wxLogTrace inside of advanced config
|
||||
m_entries.push_back( std::make_unique<PARAM_CFG_WXSTRING>( true, AC_KEYS::TraceMasks, &m_traceMasks,
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <bitmaps.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <dpi_scaling_common.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <kiface_base.h>
|
||||
#include <kiplatform/ui.h>
|
||||
#include <pgm_base.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <wx/log.h>
|
||||
|
||||
#include <advanced_config.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <gal/definitions.h>
|
||||
#include <font/font.h>
|
||||
@ -62,7 +62,7 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
||||
|
||||
// wxDC::GetPPI() reports 96 DPI, but somehow this value
|
||||
// is the closest match to the legacy renderer
|
||||
SetScreenDPI( 91 );
|
||||
SetScreenDPI( ADVANCED_CFG::GetCfg().m_ScreenDPI );
|
||||
SetDepthRange( VECTOR2D( GAL::MIN_DEPTH, GAL::MAX_DEPTH ) );
|
||||
SetLayerDepth( 0.0 );
|
||||
SetFlip( false, false );
|
||||
|
@ -23,6 +23,7 @@
|
||||
* Released under GNU GPL v2+
|
||||
*/
|
||||
|
||||
#include <advanced_config.h>
|
||||
#include <widgets/zoom_correction_ctrl.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
@ -55,7 +56,7 @@ private:
|
||||
double value = parent->GetValue();
|
||||
ZOOM_CORRECTION_UNITS units = static_cast<ZOOM_CORRECTION_UNITS>( parent->GetUnitsSelection() );
|
||||
|
||||
double dpi = GetDPI().x;
|
||||
double dpi = ADVANCED_CFG::GetCfg().m_ScreenDPI;
|
||||
double unitsPerInch = 25.4;
|
||||
|
||||
if( units == ZOOM_CORRECTION_UNITS::CM )
|
||||
@ -222,6 +223,7 @@ int ZOOM_CORRECTION_CTRL::GetUnitsSelection() const
|
||||
return m_unitsChoice->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
bool ZOOM_CORRECTION_CTRL::TransferDataToWindow()
|
||||
{
|
||||
m_slider->SetValue( (int)( *m_value * 100 ) );
|
||||
|
@ -803,6 +803,18 @@ public:
|
||||
*/
|
||||
bool m_ImportSkipComponentBodies;
|
||||
|
||||
/**
|
||||
* Screen DPI setting for display calculations.
|
||||
*
|
||||
* This setting controls the assumed screen DPI for various display calculations.
|
||||
* Can be used to adjust sizing for high-DPI displays or unusual screen configurations.
|
||||
*
|
||||
* Setting name: "ScreenDPI"
|
||||
* Valid values: 50 to 500
|
||||
* Default value: 91
|
||||
*/
|
||||
int m_ScreenDPI;
|
||||
|
||||
wxString m_traceMasks; ///< Trace masks for wxLogTrace, loaded from the config file.
|
||||
///@}
|
||||
|
||||
|
@ -644,6 +644,7 @@ public:
|
||||
* For instance a typical notebook with HD+ resolution (1600x900) has 106 DPI.
|
||||
*/
|
||||
void SetScreenDPI( double aScreenDPI ) { m_screenDPI = aScreenDPI; }
|
||||
double GetScreenDPI() const { return m_screenDPI; }
|
||||
|
||||
/**
|
||||
* Get/set the Point in world space to look at.
|
||||
|
@ -49,11 +49,11 @@ class ZOOM_CORRECTION_CTRL : public wxPanel
|
||||
public:
|
||||
ZOOM_CORRECTION_CTRL( wxWindow* aParent, double& aValue );
|
||||
|
||||
void SetDisplayedValue( double aValue );
|
||||
void SetDisplayedValue( double aValue );
|
||||
double GetValue() const;
|
||||
int GetUnitsSelection() const;
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
int GetUnitsSelection() const;
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
private:
|
||||
void sliderChanged( wxCommandEvent& aEvent );
|
||||
|
Loading…
x
Reference in New Issue
Block a user