1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] enable automatic hyperlinks in the copyrights section

* Use a RichEdit control with EM_AUTOURLDETECT
This commit is contained in:
Pete Batard 2012-11-08 20:36:48 +00:00
parent 05d7b757e6
commit bc01064678
2 changed files with 30 additions and 7 deletions

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 316
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.2.0.191"
CAPTION "Rufus v1.2.0.192"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,278,50,14
@ -77,9 +77,9 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL,
"SysLink",WS_TABSTOP,46,47,114,9
LTEXT "Version 1.2.0 (Build 191)",IDC_STATIC,46,19,78,8
LTEXT "Version 1.2.0 (Build 192)",IDC_STATIC,46,19,78,8
PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP
EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL
CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,107,235,63,WS_EX_STATICEDGE
LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
LTEXT "Portions copyright:",IDC_STATIC,46,95,59,8
CONTROL "<a>https://github.com/pbatard/rufus/issues</a>",IDC_ABOUT_BUG_URL,
@ -237,8 +237,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,0,191
PRODUCTVERSION 1,2,0,191
FILEVERSION 1,2,0,192
PRODUCTVERSION 1,2,0,192
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -255,13 +255,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.2.0.191"
VALUE "FileVersion", "1.2.0.192"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.2.0.191"
VALUE "ProductVersion", "1.2.0.192"
END
END
BLOCK "VarFileInfo"

View file

@ -33,6 +33,7 @@
#include <shlobj.h>
#include <commdlg.h>
#include <sddl.h>
#include <richedit.h>
#include "rufus.h"
#include "msapi_utf8.h"
@ -667,10 +668,20 @@ INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
*/
INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static HWND hCopyrights;
TEXTRANGEW tr;
ENLINK* enl;
wchar_t wUrl[256];
switch (message) {
case WM_INITDIALOG:
CenterDialog(hDlg);
hCopyrights = GetDlgItem(hDlg, IDC_ABOUT_COPYRIGHTS);
SendMessageA(hCopyrights, EM_AUTOURLDETECT, 1, 0);
SetDlgItemTextA(hDlg, IDC_ABOUT_COPYRIGHTS, additional_copyrights);
SendMessage(hCopyrights, EM_SETSEL, -1, -1);
SendMessage(hCopyrights, EM_SETEVENTMASK, 0, ENM_LINK);
SendMessageA(hCopyrights, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == GetDlgItem(hDlg, IDC_RUFUS_BOLD)) {
@ -693,6 +704,16 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
break;
}
break;
case EN_LINK:
enl = (ENLINK*) lParam;
if (enl->msg == WM_LBUTTONUP) {
tr.lpstrText = wUrl;
tr.chrg.cpMin = enl->chrg.cpMin;
tr.chrg.cpMax = enl->chrg.cpMax;
SendMessageW(enl->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
ShellExecuteW(hDlg, L"open", wUrl, NULL, NULL, SW_SHOWNORMAL);
}
break;
}
break;
case WM_COMMAND:
@ -712,6 +733,8 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
INT_PTR CreateAboutBox(void)
{
// Required to display the license in a rich edit control
LoadLibraryA("Riched20.dll");
return DialogBoxA(hMainInstance, MAKEINTRESOURCEA(IDD_ABOUTBOX), hMainDialog, AboutCallback);
}