From d0ea904cdf914afa716830350c653dae9d7e3c1c Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 3 Nov 2015 20:14:02 +0100 Subject: [PATCH] spu2x: remove hyperlink in windows about box Code isn't free (and kinda useless) --- plugins/spu2-x/src/Windows/AboutBox.cpp | 4 - plugins/spu2-x/src/Windows/Hyperlinks.cpp | 168 ------------------ plugins/spu2-x/src/Windows/Hyperlinks.h | 10 -- plugins/spu2-x/src/Windows/Spu2-X.vcxproj | 13 +- .../spu2-x/src/Windows/Spu2-X.vcxproj.filters | 8 +- 5 files changed, 2 insertions(+), 201 deletions(-) delete mode 100644 plugins/spu2-x/src/Windows/Hyperlinks.cpp delete mode 100644 plugins/spu2-x/src/Windows/Hyperlinks.h diff --git a/plugins/spu2-x/src/Windows/AboutBox.cpp b/plugins/spu2-x/src/Windows/AboutBox.cpp index 9b4c4ecc22..7405355c7f 100644 --- a/plugins/spu2-x/src/Windows/AboutBox.cpp +++ b/plugins/spu2-x/src/Windows/AboutBox.cpp @@ -19,7 +19,6 @@ #include "Dialogs.h" #include "svnrev.h" -#include "Hyperlinks.h" static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -27,9 +26,6 @@ static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { case WM_INITDIALOG: { - ConvertStaticToHyperlink( hDlg, IDC_LINK_GOOGLECODE ); - ConvertStaticToHyperlink( hDlg, IDC_LINK_WEBSITE ); - wchar_t outstr[256]; if( IsDevBuild ) swprintf_s( outstr, L"Build %lld -- Compiled on " _T(__DATE__), SVN_REV ); diff --git a/plugins/spu2-x/src/Windows/Hyperlinks.cpp b/plugins/spu2-x/src/Windows/Hyperlinks.cpp deleted file mode 100644 index d533fcc07a..0000000000 --- a/plugins/spu2-x/src/Windows/Hyperlinks.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// Hyperlinks.cpp -// -// Copyright 2002 Neal Stublen -// All rights reserved. -// -// http://www.awesoftware.com -// - -// This taken as found on Codeguru: http://www.codeguru.com/cpp/controls/staticctrl/article.php/c5803 - -#include - -#include "Hyperlinks.h" - - -#define PROP_ORIGINAL_FONT TEXT("_Hyperlink_Original_Font_") -#define PROP_ORIGINAL_PROC TEXT("_Hyperlink_Original_Proc_") -#define PROP_STATIC_HYPERLINK TEXT("_Hyperlink_From_Static_") -#define PROP_UNDERLINE_FONT TEXT("_Hyperlink_Underline_Font_") - - -LRESULT CALLBACK _HyperlinkParentProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - WNDPROC pfnOrigProc = (WNDPROC) GetProp(hwnd, PROP_ORIGINAL_PROC); - - switch (message) - { - case WM_CTLCOLORSTATIC: - { - HDC hdc = (HDC) wParam; - HWND hwndCtl = (HWND) lParam; - - BOOL fHyperlink = (NULL != GetProp(hwndCtl, PROP_STATIC_HYPERLINK)); - if (fHyperlink) - { - LRESULT lr = CallWindowProc(pfnOrigProc, hwnd, message, wParam, lParam); - SetTextColor(hdc, RGB(0, 0, 192)); - return lr; - } - - break; - } - case WM_DESTROY: - { - SetWindowLong(hwnd, GWL_WNDPROC, (LONG) pfnOrigProc); - RemoveProp(hwnd, PROP_ORIGINAL_PROC); - break; - } - } - return CallWindowProc(pfnOrigProc, hwnd, message, wParam, lParam); -} - -LRESULT CALLBACK _HyperlinkProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - WNDPROC pfnOrigProc = (WNDPROC) GetProp(hwnd, PROP_ORIGINAL_PROC); - - switch (message) - { - case WM_DESTROY: - { - SetWindowLong(hwnd, GWL_WNDPROC, (LONG) pfnOrigProc); - RemoveProp(hwnd, PROP_ORIGINAL_PROC); - - HFONT hOrigFont = (HFONT) GetProp(hwnd, PROP_ORIGINAL_FONT); - SendMessage(hwnd, WM_SETFONT, (WPARAM) hOrigFont, 0); - RemoveProp(hwnd, PROP_ORIGINAL_FONT); - - HFONT hFont = (HFONT) GetProp(hwnd, PROP_UNDERLINE_FONT); - DeleteObject(hFont); - RemoveProp(hwnd, PROP_UNDERLINE_FONT); - - RemoveProp(hwnd, PROP_STATIC_HYPERLINK); - - break; - } - case WM_MOUSEMOVE: - { - if (GetCapture() != hwnd) - { - HFONT hFont = (HFONT) GetProp(hwnd, PROP_UNDERLINE_FONT); - SendMessage(hwnd, WM_SETFONT, (WPARAM) hFont, FALSE); - InvalidateRect(hwnd, NULL, FALSE); - SetCapture(hwnd); - } - else - { - RECT rect; - GetWindowRect(hwnd, &rect); - - POINT pt = { LOWORD(lParam), HIWORD(lParam) }; - ClientToScreen(hwnd, &pt); - - if (!PtInRect(&rect, pt)) - { - HFONT hFont = (HFONT) GetProp(hwnd, PROP_ORIGINAL_FONT); - SendMessage(hwnd, WM_SETFONT, (WPARAM) hFont, FALSE); - InvalidateRect(hwnd, NULL, FALSE); - ReleaseCapture(); - } - } - break; - } - case WM_SETCURSOR: - { - // Since IDC_HAND is not available on all operating systems, - // we will load the arrow cursor if IDC_HAND is not present. - HCURSOR hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)); - if (NULL == hCursor) - { - hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); - } - SetCursor(hCursor); - return TRUE; - } - } - - return CallWindowProc(pfnOrigProc, hwnd, message, wParam, lParam); -} - -BOOL ConvertStaticToHyperlink(HWND hwndCtl) -{ - // Subclass the parent so we can color the controls as we desire. - - HWND hwndParent = GetParent(hwndCtl); - if (NULL != hwndParent) - { - WNDPROC pfnOrigProc = (WNDPROC) GetWindowLong(hwndParent, GWL_WNDPROC); - if (pfnOrigProc != _HyperlinkParentProc) - { - SetProp(hwndParent, PROP_ORIGINAL_PROC, (HANDLE) pfnOrigProc); - SetWindowLong(hwndParent, GWL_WNDPROC, (LONG) (WNDPROC) _HyperlinkParentProc); - } - } - - // Make sure the control will send notifications. - - DWORD dwStyle = GetWindowLong(hwndCtl, GWL_STYLE); - SetWindowLong(hwndCtl, GWL_STYLE, dwStyle | SS_NOTIFY); - - // Subclass the existing control. - - WNDPROC pfnOrigProc = (WNDPROC) GetWindowLong(hwndCtl, GWL_WNDPROC); - SetProp(hwndCtl, PROP_ORIGINAL_PROC, (HANDLE) pfnOrigProc); - SetWindowLong(hwndCtl, GWL_WNDPROC, (LONG) (WNDPROC) _HyperlinkProc); - - // Create an updated font by adding an underline. - - HFONT hOrigFont = (HFONT) SendMessage(hwndCtl, WM_GETFONT, 0, 0); - SetProp(hwndCtl, PROP_ORIGINAL_FONT, (HANDLE) hOrigFont); - - LOGFONT lf; - GetObject(hOrigFont, sizeof(lf), &lf); - lf.lfUnderline = TRUE; - - HFONT hFont = CreateFontIndirect(&lf); - SetProp(hwndCtl, PROP_UNDERLINE_FONT, (HANDLE) hFont); - - // Set a flag on the control so we know what color it should be. - - SetProp(hwndCtl, PROP_STATIC_HYPERLINK, (HANDLE) 1); - - return TRUE; -} - -BOOL ConvertStaticToHyperlink(HWND hwndParent, UINT uiCtlId) -{ - return ConvertStaticToHyperlink(GetDlgItem(hwndParent, uiCtlId)); -} diff --git a/plugins/spu2-x/src/Windows/Hyperlinks.h b/plugins/spu2-x/src/Windows/Hyperlinks.h deleted file mode 100644 index 3b92a4d3ee..0000000000 --- a/plugins/spu2-x/src/Windows/Hyperlinks.h +++ /dev/null @@ -1,10 +0,0 @@ -// Hyperlinks.h -// -// Copyright 2002 Neal Stublen -// All rights reserved. -// -// http://www.awesoftware.com -// - -BOOL ConvertStaticToHyperlink(HWND hwndCtl); -BOOL ConvertStaticToHyperlink(HWND hwndParent, UINT uiCtlId); diff --git a/plugins/spu2-x/src/Windows/Spu2-X.vcxproj b/plugins/spu2-x/src/Windows/Spu2-X.vcxproj index 96ef8eeb14..c290ec2133 100644 --- a/plugins/spu2-x/src/Windows/Spu2-X.vcxproj +++ b/plugins/spu2-x/src/Windows/Spu2-X.vcxproj @@ -282,7 +282,6 @@ - @@ -421,16 +420,6 @@ - - - - - - - - - - @@ -480,4 +469,4 @@ - \ No newline at end of file + diff --git a/plugins/spu2-x/src/Windows/Spu2-X.vcxproj.filters b/plugins/spu2-x/src/Windows/Spu2-X.vcxproj.filters index 9d5f669b5b..d456189de8 100644 --- a/plugins/spu2-x/src/Windows/Spu2-X.vcxproj.filters +++ b/plugins/spu2-x/src/Windows/Spu2-X.vcxproj.filters @@ -103,9 +103,6 @@ Source Files\GUI\Windows - - Source Files\GUI\Windows - Source Files\GUI\Windows @@ -204,9 +201,6 @@ Source Files\GUI\Windows - - Source Files\GUI\Windows - Source Files\GUI\Windows @@ -245,4 +239,4 @@ Resources - \ No newline at end of file +