2010-06-03 00:56:00 +02:00
|
|
|
/*
|
|
|
|
* WineCfg about panel
|
|
|
|
*
|
|
|
|
* Copyright 2002 Jaco Greeff
|
|
|
|
* Copyright 2003 Dimitrie O. Paun
|
|
|
|
* Copyright 2003 Mike Hearn
|
|
|
|
* Copyright 2010 Joel Holdsworth
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-06-09 01:03:50 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2010-06-03 00:56:00 +02:00
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
2010-06-09 01:03:50 +02:00
|
|
|
#include <shellapi.h>
|
2010-06-03 00:56:00 +02:00
|
|
|
|
|
|
|
#include "resource.h"
|
|
|
|
#include "winecfg.h"
|
|
|
|
|
|
|
|
|
2010-06-09 01:03:50 +02:00
|
|
|
static HICON logo = NULL;
|
|
|
|
static HFONT titleFont = NULL;
|
|
|
|
|
2010-06-03 00:56:00 +02:00
|
|
|
INT_PTR CALLBACK
|
|
|
|
AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2020-04-09 09:31:02 +02:00
|
|
|
const char * (CDECL *wine_get_version)(void);
|
2010-06-09 01:03:50 +02:00
|
|
|
HWND hWnd;
|
|
|
|
HDC hDC;
|
|
|
|
RECT rcClient, rcRect;
|
2021-09-07 17:14:22 +02:00
|
|
|
WCHAR *owner, *org;
|
2010-06-03 00:56:00 +02:00
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_NOTIFY:
|
|
|
|
switch(((LPNMHDR)lParam)->code)
|
|
|
|
{
|
|
|
|
case PSN_APPLY:
|
|
|
|
/*save registration info to registry */
|
|
|
|
owner = get_text(hDlg, IDC_ABT_OWNER);
|
|
|
|
org = get_text(hDlg, IDC_ABT_ORG);
|
|
|
|
|
2021-09-07 17:14:22 +02:00
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion",
|
|
|
|
L"RegisteredOwner", owner ? owner : L"");
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion",
|
|
|
|
L"RegisteredOrganization", org ? org : L"");
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
L"RegisteredOwner", owner ? owner : L"");
|
|
|
|
set_reg_key(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
L"RegisteredOrganization", org ? org : L"");
|
2010-06-03 00:56:00 +02:00
|
|
|
apply();
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, owner);
|
|
|
|
HeapFree(GetProcessHeap(), 0, org);
|
|
|
|
break;
|
2010-06-09 01:03:50 +02:00
|
|
|
|
|
|
|
case NM_CLICK:
|
|
|
|
case NM_RETURN:
|
|
|
|
if(wParam == IDC_ABT_WEB_LINK)
|
2021-09-07 13:41:35 +02:00
|
|
|
ShellExecuteW(NULL, L"open", ((NMLINK *)lParam)->item.szUrl, NULL, NULL, SW_SHOW);
|
2010-06-09 01:03:50 +02:00
|
|
|
break;
|
2010-06-03 00:56:00 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_INITDIALOG:
|
2010-06-09 01:03:50 +02:00
|
|
|
hDC = GetDC(hDlg);
|
|
|
|
|
2010-06-03 00:56:00 +02:00
|
|
|
/* read owner and organization info from registry, load it into text box */
|
2021-09-07 17:14:22 +02:00
|
|
|
owner = get_reg_key(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
L"RegisteredOwner", L"");
|
|
|
|
org = get_reg_key(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
L"RegisteredOrganization", L"");
|
2010-06-03 00:56:00 +02:00
|
|
|
|
2021-09-07 17:14:22 +02:00
|
|
|
SetDlgItemTextW(hDlg, IDC_ABT_OWNER, owner);
|
|
|
|
SetDlgItemTextW(hDlg, IDC_ABT_ORG, org);
|
2010-06-03 00:56:00 +02:00
|
|
|
|
2012-01-20 12:42:33 +01:00
|
|
|
SendMessageW(GetParent(hDlg), PSM_UNCHANGED, 0, 0);
|
2010-06-03 00:56:00 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, owner);
|
|
|
|
HeapFree(GetProcessHeap(), 0, org);
|
2010-06-09 01:03:50 +02:00
|
|
|
|
|
|
|
/* prepare the panel */
|
|
|
|
hWnd = GetDlgItem(hDlg, IDC_ABT_PANEL);
|
|
|
|
if(hWnd)
|
|
|
|
{
|
|
|
|
GetClientRect(hDlg, &rcClient);
|
|
|
|
GetClientRect(hWnd, &rcRect);
|
|
|
|
MoveWindow(hWnd, 0, 0, rcClient.right, rcRect.bottom, FALSE);
|
|
|
|
|
|
|
|
logo = LoadImageW((HINSTANCE)GetWindowLongPtrW(hDlg, GWLP_HINSTANCE),
|
|
|
|
MAKEINTRESOURCEW(IDI_LOGO), IMAGE_ICON, 0, 0, LR_SHARED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prepare the title text */
|
2020-04-09 09:31:02 +02:00
|
|
|
titleFont = CreateFontW( -MulDiv(24, GetDeviceCaps(hDC, LOGPIXELSY), 72),
|
2021-09-07 13:41:35 +02:00
|
|
|
0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, L"Tahoma" );
|
2020-04-09 09:31:02 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_ABT_TITLE_TEXT, WM_SETFONT, (WPARAM)titleFont, TRUE);
|
2010-06-09 01:03:50 +02:00
|
|
|
|
2021-09-07 17:14:22 +02:00
|
|
|
wine_get_version = (void *)GetProcAddress( GetModuleHandleW(L"ntdll.dll"), "wine_get_version" );
|
2020-04-09 09:31:02 +02:00
|
|
|
if (wine_get_version) SetDlgItemTextA(hDlg, IDC_ABT_PANEL_TEXT, wine_get_version());
|
2010-06-09 01:03:50 +02:00
|
|
|
|
|
|
|
ReleaseDC(hDlg, hDC);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
if(logo)
|
|
|
|
{
|
|
|
|
DestroyIcon(logo);
|
|
|
|
logo = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(titleFont)
|
|
|
|
{
|
|
|
|
DeleteObject(titleFont);
|
|
|
|
titleFont = NULL;
|
|
|
|
}
|
|
|
|
|
2010-06-03 00:56:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch(HIWORD(wParam))
|
|
|
|
{
|
|
|
|
case EN_CHANGE:
|
|
|
|
/* enable apply button */
|
2012-01-20 12:42:33 +01:00
|
|
|
SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
|
2010-06-03 00:56:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2010-06-09 01:03:50 +02:00
|
|
|
|
|
|
|
case WM_DRAWITEM:
|
|
|
|
if(wParam == IDC_ABT_PANEL)
|
|
|
|
{
|
|
|
|
LPDRAWITEMSTRUCT pDIS = (LPDRAWITEMSTRUCT)lParam;
|
|
|
|
FillRect(pDIS->hDC, &pDIS->rcItem, (HBRUSH) (COLOR_WINDOW+1));
|
|
|
|
DrawIconEx(pDIS->hDC, 0, 0, logo, 0, 0, 0, 0, DI_IMAGE);
|
|
|
|
DrawEdge(pDIS->hDC, &pDIS->rcItem, EDGE_SUNKEN, BF_BOTTOM);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_CTLCOLORSTATIC:
|
|
|
|
switch(GetDlgCtrlID((HWND)lParam))
|
|
|
|
{
|
|
|
|
case IDC_ABT_TITLE_TEXT:
|
|
|
|
/* set the title to a wine color */
|
|
|
|
SetTextColor((HDC)wParam, 0x0000007F);
|
2019-04-16 03:16:19 +02:00
|
|
|
SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
|
|
|
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
|
2010-06-09 01:03:50 +02:00
|
|
|
case IDC_ABT_PANEL_TEXT:
|
|
|
|
case IDC_ABT_LICENSE_TEXT:
|
2011-09-26 22:53:14 +02:00
|
|
|
case IDC_ABT_WEB_LINK:
|
2019-04-16 03:16:19 +02:00
|
|
|
SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
|
2017-03-27 05:26:16 +02:00
|
|
|
SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
2019-04-16 03:16:18 +02:00
|
|
|
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
|
2010-06-09 01:03:50 +02:00
|
|
|
}
|
|
|
|
break;
|
2010-06-03 00:56:00 +02:00
|
|
|
}
|
2010-06-09 01:03:50 +02:00
|
|
|
|
2010-06-03 00:56:00 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|