From 4ee942aba2c8dfbe1d015c531167db7551eda4d5 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 9 Nov 2016 00:28:14 +0100 Subject: [PATCH] pcsx2 gui: use pxGetFixedFont helper instead of wxFont constructor --- common/include/Utilities/wxGuiTools.h | 2 +- common/src/Utilities/wxGuiTools.cpp | 4 ++-- pcsx2/gui/ConsoleLogger.cpp | 3 --- pcsx2/gui/Debugger/CtrlDisassemblyView.cpp | 11 +++-------- pcsx2/gui/Debugger/CtrlMemView.cpp | 9 ++------- pcsx2/gui/Debugger/CtrlRegisterList.cpp | 8 ++------ pcsx2/gui/FrameForGS.cpp | 2 +- pcsx2/gui/Panels/BiosSelectorPanel.cpp | 4 ++-- pcsx2/gui/Panels/ThemeSelectorPanel.cpp | 2 +- 9 files changed, 14 insertions(+), 31 deletions(-) diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index 77bf84ed64..4c679c2961 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -800,7 +800,7 @@ extern int pxGetCharHeight(const wxWindow &wind, int rows = 1); extern void pxSetToolTip(wxWindow *wind, const wxString &src); extern void pxSetToolTip(wxWindow &wind, const wxString &src); -extern wxFont pxGetFixedFont(int ptsize = 8, wxFontWeight weight = wxFONTWEIGHT_NORMAL); +extern wxFont pxGetFixedFont(int ptsize = 8, wxFontWeight weight = wxFONTWEIGHT_NORMAL, bool underline = false); extern pxDialogCreationFlags pxDialogFlags(); diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp index 38bf740965..ae6be020d4 100644 --- a/common/src/Utilities/wxGuiTools.cpp +++ b/common/src/Utilities/wxGuiTools.cpp @@ -601,10 +601,10 @@ void pxSetToolTip(wxWindow &wind, const wxString &src) } -wxFont pxGetFixedFont(int ptsize, wxFontWeight weight) +wxFont pxGetFixedFont(int ptsize, wxFontWeight weight, bool underline) { return wxFont( - ptsize, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, weight, false + ptsize, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, weight, underline #ifdef __WXMSW__ , L"Lucida Console" // better than courier new (win32 only) diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index 80d3c868c1..02978fb487 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -158,9 +158,6 @@ void ConsoleLogFrame::ColorArray::SetFont( int fontsize ) const wxFont fixed( pxGetFixedFont( fontsize ) ); const wxFont fixedB( pxGetFixedFont( fontsize+1, wxFONTWEIGHT_BOLD ) ); - //const wxFont fixed( fontsize, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ); - //const wxFont fixedB( fontsize, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ); - // Standard R, G, B format: for (size_t i = 0; i < Color_StrongBlack; ++i) m_table[i].SetFont(fixed); diff --git a/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp b/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp index f3945ffdfc..64785976d3 100644 --- a/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp +++ b/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp @@ -472,18 +472,13 @@ void CtrlDisassemblyView::render(wxDC& dc) if (!cpu->isAlive()) return; - #ifdef _WIN32 - wxFont font = wxFont(wxSize(charWidth,rowHeight-2),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console"); - wxFont boldFont = wxFont(wxSize(charWidth,rowHeight-2),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,L"Lucida Console"); - #else - wxFont font = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console"); + wxFont font = pxGetFixedFont(8); + wxFont boldFont = pxGetFixedFont(8, wxFONTWEIGHT_BOLD); font.SetPixelSize(wxSize(charWidth,rowHeight-2)); - wxFont boldFont = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,L"Lucida Console"); boldFont.SetPixelSize(wxSize(charWidth,rowHeight-2)); - #endif bool hasFocus = wxWindow::FindFocus() == this; - + std::map addressPositions; unsigned int address = windowStart; diff --git a/pcsx2/gui/Debugger/CtrlMemView.cpp b/pcsx2/gui/Debugger/CtrlMemView.cpp index 198175d714..cd503fdaba 100644 --- a/pcsx2/gui/Debugger/CtrlMemView.cpp +++ b/pcsx2/gui/Debugger/CtrlMemView.cpp @@ -76,15 +76,10 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu) setRowSize(16); - #ifdef _WIN32 - font = wxFont(wxSize(charWidth,rowHeight),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console"); - underlineFont = wxFont(wxSize(charWidth,rowHeight),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,true,L"Lucida Console"); - #else - font = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console"); + font = pxGetFixedFont(8); + underlineFont = pxGetFixedFont(8, wxFONTWEIGHT_NORMAL, true); font.SetPixelSize(wxSize(charWidth,rowHeight)); - underlineFont = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,true,L"Lucida Console"); underlineFont.SetPixelSize(wxSize(charWidth,rowHeight)); - #endif menu.Append(ID_MEMVIEW_GOTOINDISASM, L"Go to in Disasm"); menu.Append(ID_MEMVIEW_COPYADDRESS, L"Copy address"); diff --git a/pcsx2/gui/Debugger/CtrlRegisterList.cpp b/pcsx2/gui/Debugger/CtrlRegisterList.cpp index 5e89b8b5a6..0a6e808506 100644 --- a/pcsx2/gui/Debugger/CtrlRegisterList.cpp +++ b/pcsx2/gui/Debugger/CtrlRegisterList.cpp @@ -196,14 +196,10 @@ void drawU32Text(wxDC& dc, u32 value, int x, int y) void CtrlRegisterList::OnDraw(wxDC& dc) { - #ifdef _WIN32 - wxFont font = wxFont(wxSize(charWidth,rowHeight-2),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console"); - #else - wxFont font = wxFont(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console"); + wxFont font = pxGetFixedFont(8); font.SetPixelSize(wxSize(charWidth,rowHeight-2)); - #endif dc.SetFont(font); - + refreshChangedRegs(); wxColor colorChanged = wxColor(0xFF0000FF); diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 7a9659e5e5..8e05d38cff 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -443,7 +443,7 @@ GSFrame::GSFrame( const wxString& title) wxStaticText* label = new wxStaticText( this, wxID_ANY, _("GS Output is Disabled!") ); m_id_OutputDisabled = label->GetId(); - label->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) ); + label->SetFont( pxGetFixedFont( 20, wxFONTWEIGHT_BOLD ) ); label->SetForegroundColour( *wxWHITE ); AppStatusEvent_OnSettingsApplied(); diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index b24202bae4..9aefdfb869 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -105,9 +105,9 @@ Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow* parent ) _("Select folder with PS2 BIOS roms") // dir picker popup label ); - m_ComboBox->SetFont( wxFont( m_ComboBox->GetFont().GetPointSize()+1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console" ) ); + m_ComboBox->SetFont( pxGetFixedFont( m_ComboBox->GetFont().GetPointSize()+1 ) ); m_ComboBox->SetMinSize( wxSize( wxDefaultCoord, std::max( m_ComboBox->GetMinSize().GetHeight(), 96 ) ) ); - + //if (InstallationMode != InstallMode_Portable) m_FolderPicker->SetStaticDesc( _("Click the Browse button to select a different folder where PCSX2 will look for PS2 BIOS roms.") ); diff --git a/pcsx2/gui/Panels/ThemeSelectorPanel.cpp b/pcsx2/gui/Panels/ThemeSelectorPanel.cpp index a87b856ca4..91abc8853d 100644 --- a/pcsx2/gui/Panels/ThemeSelectorPanel.cpp +++ b/pcsx2/gui/Panels/ThemeSelectorPanel.cpp @@ -39,7 +39,7 @@ Panels::ThemeSelectorPanel::ThemeSelectorPanel( wxWindow* parent ) _("Select folder containing PCSX2 visual themes") // dir picker popup label ); - m_ComboBox->SetFont( wxFont( m_ComboBox->GetFont().GetPointSize()+1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console" ) ); + m_ComboBox->SetFont( pxGetFixedFont( m_ComboBox->GetFont().GetPointSize()+1 ) ); m_ComboBox->SetMinSize( wxSize( wxDefaultCoord, std::max( m_ComboBox->GetMinSize().GetHeight(), 96 ) ) ); if (InstallationMode != InstallMode_Portable)