Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
turtleli committed Oct 5, 2015
1 parent f11596f commit 31b1e34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
15 changes: 9 additions & 6 deletions pcsx2/gui/Dialogs/ConvertMemoryCardDialog.cpp
Expand Up @@ -17,6 +17,8 @@
#include "ConfigurationDialog.h"
#include "System.h"

#include "MSWstuff.h"

#include "MemoryCardFile.h"
#include "MemoryCardFolder.h"
#include <wx/ffile.h>
Expand All @@ -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 );

Expand All @@ -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();

Expand All @@ -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();
}
Expand Down
16 changes: 9 additions & 7 deletions pcsx2/gui/Dialogs/CreateMemoryCardDialog.cpp
Expand Up @@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "ConfigurationDialog.h"
#include "System.h"
#include "MSWstuff.h"

#include "MemoryCardFile.h"
//#include <wx/filepicker.h>
Expand All @@ -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();
Expand Down Expand Up @@ -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();

}

Expand All @@ -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();
}
Expand Down

0 comments on commit 31b1e34

Please sign in to comment.