Use wxWidgets to track DPI.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17981
(cherry picked from commit 931de12072
)
This commit is contained in:
parent
769060c584
commit
c6215b08ed
|
@ -103,11 +103,6 @@ EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribL
|
||||||
m_BiuTo3dUnits = 1.0;
|
m_BiuTo3dUnits = 1.0;
|
||||||
|
|
||||||
m_glRC = nullptr;
|
m_glRC = nullptr;
|
||||||
|
|
||||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
|
||||||
|
|
||||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
|
||||||
SetScaleFactor( dpi.GetScaleFactor() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -812,9 +812,6 @@ void EDA_3D_VIEWER_FRAME::loadCommonSettings()
|
||||||
|
|
||||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||||
|
|
||||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
|
||||||
m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
|
|
||||||
|
|
||||||
// TODO(JE) use all control options
|
// TODO(JE) use all control options
|
||||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,9 +210,6 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||||
|
|
||||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||||
|
|
||||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
|
||||||
m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
|
|
||||||
|
|
||||||
// TODO(JE) use all control options
|
// TODO(JE) use all control options
|
||||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@ HIDPI_GL_CANVAS::HIDPI_GL_CANVAS( const KIGFX::VC_SETTINGS& aSettings, wxWindow*
|
||||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||||
const wxString& aName, const wxPalette& aPalette ) :
|
const wxString& aName, const wxPalette& aPalette ) :
|
||||||
wxGLCanvas( aParent, aId, aAttribList, aPos, aSize, aStyle, aName, aPalette ),
|
wxGLCanvas( aParent, aId, aAttribList, aPos, aSize, aStyle, aName, aPalette ),
|
||||||
m_settings( aSettings ),
|
m_settings( aSettings )
|
||||||
m_scale_factor( DPI_SCALING::GetDefaultScaleFactor() )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,13 +63,7 @@ wxPoint HIDPI_GL_CANVAS::GetNativePosition( const wxPoint& aPoint ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HIDPI_GL_CANVAS::SetScaleFactor( double aNewScaleFactor )
|
|
||||||
{
|
|
||||||
m_scale_factor = aNewScaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double HIDPI_GL_CANVAS::GetScaleFactor() const
|
double HIDPI_GL_CANVAS::GetScaleFactor() const
|
||||||
{
|
{
|
||||||
return m_scale_factor;
|
return GetContentScaleFactor();
|
||||||
}
|
}
|
|
@ -507,13 +507,6 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
||||||
refresh = true;
|
refresh = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_options.m_scaleFactor != GetScaleFactor() )
|
|
||||||
{
|
|
||||||
SetScaleFactor( m_options.m_scaleFactor );
|
|
||||||
m_gridLineWidth = m_options.m_scaleFactor * ( m_options.m_gridLineWidth + 0.25 );
|
|
||||||
refresh = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( super::updatedGalDisplayOptions( aOptions ) || refresh )
|
if( super::updatedGalDisplayOptions( aOptions ) || refresh )
|
||||||
{
|
{
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
|
@ -54,11 +54,6 @@ public:
|
||||||
*/
|
*/
|
||||||
wxPoint GetNativePosition( const wxPoint& aPoint ) const;
|
wxPoint GetNativePosition( const wxPoint& aPoint ) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the canvas scale factor, probably for a hi-DPI display.
|
|
||||||
*/
|
|
||||||
void SetScaleFactor( double aFactor );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current scale factor
|
* Get the current scale factor
|
||||||
*/
|
*/
|
||||||
|
@ -69,12 +64,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
///< Current VIEW_CONTROLS settings.
|
///< Current VIEW_CONTROLS settings.
|
||||||
KIGFX::VC_SETTINGS m_settings;
|
KIGFX::VC_SETTINGS m_settings;
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* The current scale factor (e.g. for hi-DPI displays)
|
|
||||||
*/
|
|
||||||
double m_scale_factor;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HIDPI_GL_CANVAS_H
|
#endif // HIDPI_GL_CANVAS_H
|
||||||
|
|
|
@ -173,9 +173,6 @@ void DIALOG_FOOTPRINT_CHOOSER::build3DCanvas()
|
||||||
|
|
||||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||||
|
|
||||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
|
||||||
m_preview3DCanvas->SetScaleFactor( dpi.GetScaleFactor() );
|
|
||||||
|
|
||||||
// TODO(JE) use all control options
|
// TODO(JE) use all control options
|
||||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue