From 50756d69c08e5f6da8d0a9d14eb924aeb5cec3ca Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Wed, 3 Aug 2016 14:36:32 +0000 Subject: [PATCH 1/2] WX: Various fixes. Dolphin no longer lowers itself below the top window when opening. Dolphin no longer draws garbage lines all over the game list. Use the correct platform macros so Dolphin can actually find the translation catalogs on Unix. --- Externals/wxWidgets3/build/msw/wx_base.vcxproj | 4 +++- Externals/wxWidgets3/wx/wxmsw.h | 2 +- Source/Core/DolphinWX/GameListCtrl.cpp | 7 +++++++ Source/Core/DolphinWX/Main.cpp | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Externals/wxWidgets3/build/msw/wx_base.vcxproj b/Externals/wxWidgets3/build/msw/wx_base.vcxproj index d212dce20f..7a2591b851 100644 --- a/Externals/wxWidgets3/build/msw/wx_base.vcxproj +++ b/Externals/wxWidgets3/build/msw/wx_base.vcxproj @@ -1273,7 +1273,9 @@ true - + + true + diff --git a/Externals/wxWidgets3/wx/wxmsw.h b/Externals/wxWidgets3/wx/wxmsw.h index 5443e75795..b53fdb6ed8 100644 --- a/Externals/wxWidgets3/wx/wxmsw.h +++ b/Externals/wxWidgets3/wx/wxmsw.h @@ -1209,7 +1209,7 @@ // Set to 0 to disable the use of the native progress dialog (currently only // available under MSW and suffering from some bugs there, hence this option). -#define wxUSE_NATIVE_PROGRESSDLG 1 +#define wxUSE_NATIVE_PROGRESSDLG 0 // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index cbbd4ad6b7..0f629d70b0 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -173,6 +173,13 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoin Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC); wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CGameListCtrl::OnLocalIniModified, this); + +#ifdef _WIN32 + // Default Windows Themes (Aero, Win10) draw column separators which do not appear when + // using the default unthemed appearance. This is a new behavior in wx3.1 since wx3.0 + // and lower did not support themes at all. + EnableSystemTheme(false); +#endif } CGameListCtrl::~CGameListCtrl() diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 20460e258c..6e94b06316 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -307,11 +307,11 @@ void DolphinApp::InitLanguageSupport() m_locale.reset(new wxLocale(language)); // Specify where dolphins *.gmo files are located on each operating system -#ifdef _WIN32 +#ifdef __WXMSW__ m_locale->AddCatalogLookupPathPrefix(StrToWxStr(File::GetExeDirectory() + DIR_SEP "Languages")); -#elif defined(__LINUX__) +#elif defined(__WXGTK__) m_locale->AddCatalogLookupPathPrefix(StrToWxStr(DATA_DIR "../locale")); -#elif defined(__APPLE__) +#elif defined(__WXOSX__) m_locale->AddCatalogLookupPathPrefix( StrToWxStr(File::GetBundleDirectory() + "Contents/Resources")); #endif From 9842cef13f6a5ff8b524f6676f65fb3495846e7f Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Wed, 3 Aug 2016 15:03:18 +0000 Subject: [PATCH 2/2] GameListCtrl: Reimplement Custom Paint to remove column lines. This leaves system themes enabled and instead just repaints the list view background to eliminate the column ruler lines. --- Source/Core/DolphinWX/GameListCtrl.cpp | 39 +++++++++++++++++++++----- Source/Core/DolphinWX/GameListCtrl.h | 4 +++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 0f629d70b0..a86d54c406 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -30,6 +30,11 @@ #include #include +#ifdef __WXMSW__ +#include +#include +#endif + #include "Common/CDUtils.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" @@ -173,13 +178,6 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoin Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC); wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CGameListCtrl::OnLocalIniModified, this); - -#ifdef _WIN32 - // Default Windows Themes (Aero, Win10) draw column separators which do not appear when - // using the default unthemed appearance. This is a new behavior in wx3.1 since wx3.0 - // and lower did not support themes at all. - EnableSystemTheme(false); -#endif } CGameListCtrl::~CGameListCtrl() @@ -1396,3 +1394,30 @@ bool CGameListCtrl::WiiCompressWarning() "by removing padding data. Your disc image will still work. Continue?"), _("Warning"), wxYES_NO) == wxYES; } + +#ifdef __WXMSW__ +// Windows draws vertical rules between columns when using UXTheme (e.g. Aero, Win10) +// This function paints over those lines which removes them. +// [The repaint background idea is ripped off from Eclipse SWT which does the same thing] +bool CGameListCtrl::MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result) +{ + NMLVCUSTOMDRAW* nmlv = reinterpret_cast(lparam); + // Intercept the NM_CUSTOMDRAW[CDDS_PREPAINT] + // This event occurs after the background has been painted before the content of the list + // is painted. We can repaint the background to eliminate the column lines here. + if (nmlv->nmcd.hdr.hwndFrom == GetHWND() && nmlv->nmcd.hdr.code == NM_CUSTOMDRAW && + nmlv->nmcd.dwDrawStage == CDDS_PREPAINT) + { + // The column separators have already been painted, paint over them. + wxDCTemp dc(nmlv->nmcd.hdc); + dc.SetBrush(GetBackgroundColour()); + dc.SetPen(*wxTRANSPARENT_PEN); + dc.DrawRectangle(nmlv->nmcd.rc.left, nmlv->nmcd.rc.top, + nmlv->nmcd.rc.right - nmlv->nmcd.rc.left, + nmlv->nmcd.rc.bottom - nmlv->nmcd.rc.top); + } + + // Defer to wxWidgets for normal processing. + return wxListCtrl::MSWOnNotify(id, lparam, result); +} +#endif diff --git a/Source/Core/DolphinWX/GameListCtrl.h b/Source/Core/DolphinWX/GameListCtrl.h index 4c23aa5941..5031b411c2 100644 --- a/Source/Core/DolphinWX/GameListCtrl.h +++ b/Source/Core/DolphinWX/GameListCtrl.h @@ -61,6 +61,10 @@ public: NUMBER_OF_COLUMN }; +#ifdef __WXMSW__ + bool MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result) override; +#endif + private: std::vector m_FlagImageIndex; std::vector m_PlatformImageIndex;