spu2x: remove hyperlink in windows about box

Code isn't free (and kinda useless)
This commit is contained in:
Gregory Hainaut 2015-11-03 20:14:02 +01:00
parent 6e7962e06a
commit d0ea904cdf
5 changed files with 2 additions and 201 deletions

View File

@ -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 );

View File

@ -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 <windows.h>
#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));
}

View File

@ -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);

View File

@ -282,7 +282,6 @@
<ClInclude Include="..\Linux\Config.h" />
<ClInclude Include="..\Linux\Dialogs.h" />
<ClInclude Include="Dialogs.h" />
<ClInclude Include="Hyperlinks.h" />
<ClInclude Include="WinConfig.h" />
<ClInclude Include="..\PS2E-spu2.h" />
<ClInclude Include="resource.h" />
@ -421,16 +420,6 @@
</ClCompile>
<ClCompile Include="ConfigDebug.cpp" />
<ClCompile Include="ConfigSoundtouch.cpp" />
<ClCompile Include="Hyperlinks.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugStrict|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="RealtimeDebugger.cpp" />
<ClCompile Include="UIHelpers.cpp" />
<ClCompile Include="..\PS2E-spu2.cpp" />
@ -480,4 +469,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -103,9 +103,6 @@
<ClInclude Include="Dialogs.h">
<Filter>Source Files\GUI\Windows</Filter>
</ClInclude>
<ClInclude Include="Hyperlinks.h">
<Filter>Source Files\GUI\Windows</Filter>
</ClInclude>
<ClInclude Include="WinConfig.h">
<Filter>Source Files\GUI\Windows</Filter>
</ClInclude>
@ -204,9 +201,6 @@
<ClCompile Include="ConfigSoundtouch.cpp">
<Filter>Source Files\GUI\Windows</Filter>
</ClCompile>
<ClCompile Include="Hyperlinks.cpp">
<Filter>Source Files\GUI\Windows</Filter>
</ClCompile>
<ClCompile Include="RealtimeDebugger.cpp">
<Filter>Source Files\GUI\Windows</Filter>
</ClCompile>
@ -245,4 +239,4 @@
<Filter>Resources</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>