gui:windows: Scale settings dialog widths with DPI

Height is calculated automatically, so that's sort of ok. A lot more
fixes will be needed to fix the rest of the DPI stuff.
This commit is contained in:
Jonathan Li 2015-09-01 17:31:31 +01:00
parent 149b7fc347
commit 9929962d54
3 changed files with 16 additions and 1 deletions

View File

@ -135,7 +135,9 @@ void BaseApplicableDialog::OnSettingsApplied( wxCommandEvent& evt )
Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, const wxString& title, int idealWidth ) Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, const wxString& title, int idealWidth )
: _parent( parent, title ) : _parent( parent, title )
{ {
SetMinWidth( idealWidth ); float scale = MSW_GetDPIScale();
SetMinWidth( scale * idealWidth );
m_listbook = NULL; m_listbook = NULL;
m_allowApplyActivation = true; m_allowApplyActivation = true;

View File

@ -54,3 +54,15 @@ void MSW_ListView_SetIconSpacing( wxListbook* listbook, int width )
MSW_ListView_SetIconSpacing( *listbook, width ); MSW_ListView_SetIconSpacing( *listbook, width );
} }
float MSW_GetDPIScale()
{
#ifdef __WXMSW__
HDC screen = GetDC(0);
float scale = GetDeviceCaps(screen, LOGPIXELSX) / 96.0;
ReleaseDC(NULL, screen);
return scale;
#else
return 1.0;
#endif
}

View File

@ -21,6 +21,7 @@ extern void MSW_SetWindowAfter( WXWidget hwnd, WXWidget hwndAfter );
extern void MSW_OutputDebugString( const wxString& text ); extern void MSW_OutputDebugString( const wxString& text );
extern void MSW_ListView_SetIconSpacing( wxListbook& listbook, int width ); extern void MSW_ListView_SetIconSpacing( wxListbook& listbook, int width );
extern void MSW_ListView_SetIconSpacing( wxListbook* listbook, int width ); extern void MSW_ListView_SetIconSpacing( wxListbook* listbook, int width );
extern float MSW_GetDPIScale();
extern void pxDwm_Load(); extern void pxDwm_Load();
extern void pxDwm_Unload(); extern void pxDwm_Unload();