From 31b1e34ae8539cac577355edeff363132217b42f Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Mon, 5 Oct 2015 16:44:58 +0100 Subject: [PATCH] gui:windows: Fix memory card dialogs at high DPI Specifying a minimum size for the filename text controls seems to mess up the size calculations at higher DPIs and causes usability issues. Use sizers and proportions instead. Also scale the dialog widths with the DPI. --- pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp | 15 +++++++++------ pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp | 16 +++++++++------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp b/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp index acf13bb82ccfe..d8731ec903fba 100644 --- a/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp +++ b/pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp @@ -17,6 +17,8 @@ #include "ConfigurationDialog.h" #include "System.h" +#include "MSWstuff.h" + #include "MemoryCardFile.h" #include "MemoryCardFolder.h" #include @@ -35,7 +37,7 @@ Dialogs::ConvertMemoryCardDialog::ConvertMemoryCardDialog( wxWindow* parent, con , m_mcdPath( mcdPath ) , m_mcdSourceFilename( mcdSourceConfig.Filename.GetFullName() ) { - SetMinWidth( 472 ); + SetMinWidth( 472 * MSW_GetDPIScale()); CreateControls( mcdSourceConfig.Type ); @@ -51,13 +53,12 @@ Dialogs::ConvertMemoryCardDialog::ConvertMemoryCardDialog( wxWindow* parent, con s_padding += Heading( wxString( _( "Convert: " ) ) + ( mcdPath + m_mcdSourceFilename ).GetFullPath() ).Unwrapped() | pxSizerFlags::StdExpand(); wxBoxSizer& s_filename( *new wxBoxSizer( wxHORIZONTAL ) ); - s_filename += Heading( _( "To: " ) ).SetMinWidth( 50 ); - m_text_filenameInput->SetMinSize( wxSize( 250, 20 ) ); + s_filename += Heading( _( "To: " ) ).Unwrapped().Align(wxALIGN_RIGHT) | pxProportion(1); m_text_filenameInput->SetValue( wxFileName( m_mcdSourceFilename ).GetName() + L"_converted" ); - s_filename += m_text_filenameInput; - s_filename += Heading( L".ps2" ); + s_filename += m_text_filenameInput | pxProportion(2); + s_filename += Heading( L".ps2" ).Align(wxALIGN_LEFT) | pxProportion(1); - s_padding += s_filename | wxALIGN_LEFT; + s_padding += s_filename | pxSizerFlags::StdExpand(); s_padding += m_radio_CardType | pxSizerFlags::StdExpand(); @@ -74,6 +75,8 @@ Dialogs::ConvertMemoryCardDialog::ConvertMemoryCardDialog( wxWindow* parent, con Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ConvertMemoryCardDialog::OnOk_Click ) ); Connect( m_text_filenameInput->GetId(), wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( ConvertMemoryCardDialog::OnOk_Click ) ); + SetSizerAndFit(GetSizer()); + m_text_filenameInput->SetFocus(); m_text_filenameInput->SelectAll(); } diff --git a/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp b/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp index 5e2685be4c7c1..e7637d7c0cf9d 100644 --- a/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp +++ b/pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #include "ConfigurationDialog.h" #include "System.h" +#include "MSWstuff.h" #include "MemoryCardFile.h" //#include @@ -41,8 +42,7 @@ Dialogs::CreateMemoryCardDialog::CreateMemoryCardDialog( wxWindow* parent, const , m_mcdpath( mcdpath ) , m_mcdfile( suggested_mcdfileName )//suggested_and_result_mcdfileName.IsEmpty() ? g_Conf->Mcd[slot].Filename.GetFullName() { - - SetMinWidth( 472 ); + SetMinWidth( 472 * MSW_GetDPIScale()); //m_filepicker = NULL; CreateControls(); @@ -72,13 +72,12 @@ Dialogs::CreateMemoryCardDialog::CreateMemoryCardDialog( wxWindow* parent, const s_padding += Heading( wxString(_("At folder: ")) + (m_mcdpath + m_mcdfile).GetPath() ).Unwrapped() | StdExpand(); wxBoxSizer& s_filename( *new wxBoxSizer(wxHORIZONTAL) ); - s_filename += Heading( _("Select file name: ")).SetMinWidth(150); - m_text_filenameInput->SetMinSize(wxSize(150,20)); + s_filename += Heading( _("Select file name: ")).Unwrapped().Align(wxALIGN_RIGHT) | pxProportion(1); m_text_filenameInput->SetValue ((m_mcdpath + m_mcdfile).GetName()); - s_filename += m_text_filenameInput; - s_filename += Heading( L".ps2" ); + s_filename += m_text_filenameInput | pxProportion(2); + s_filename += Heading( L".ps2" ).Align(wxALIGN_LEFT) | pxProportion(1); - s_padding += s_filename | wxALIGN_LEFT; + s_padding += s_filename | StdExpand(); } @@ -96,6 +95,9 @@ Dialogs::CreateMemoryCardDialog::CreateMemoryCardDialog( wxWindow* parent, const Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CreateMemoryCardDialog::OnOk_Click ) ); Connect( m_text_filenameInput->GetId(), wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( CreateMemoryCardDialog::OnOk_Click ) ); + // ...Typical solution to everything? Or are we doing something weird? + SetSizerAndFit(GetSizer()); + m_text_filenameInput->SetFocus(); m_text_filenameInput->SelectAll(); }