mapi32: Add Portuguese Portugal translation.
[wine/hacks.git] / programs / winecfg / about.c
blobb8a69644264610c4a6ba3b341d456c88c15c1fe1
1 /*
2 * WineCfg about panel
4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2003 Mike Hearn
7 * Copyright 2010 Joel Holdsworth
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #define COBJMACROS
27 #include "config.h"
29 #include <windows.h>
30 #include <commctrl.h>
31 #include <shellapi.h>
32 #include <wine/debug.h>
34 #include "resource.h"
35 #include "winecfg.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
39 static HICON logo = NULL;
40 static HFONT titleFont = NULL;
42 INT_PTR CALLBACK
43 AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
45 HWND hWnd;
46 HDC hDC;
47 RECT rcClient, rcRect;
48 char *owner, *org;
50 switch (uMsg)
52 case WM_NOTIFY:
53 switch(((LPNMHDR)lParam)->code)
55 case PSN_APPLY:
56 /*save registration info to registry */
57 owner = get_text(hDlg, IDC_ABT_OWNER);
58 org = get_text(hDlg, IDC_ABT_ORG);
60 set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
61 "RegisteredOwner", owner ? owner : "");
62 set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
63 "RegisteredOrganization", org ? org : "");
64 set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
65 "RegisteredOwner", owner ? owner : "");
66 set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
67 "RegisteredOrganization", org ? org : "");
68 apply();
70 HeapFree(GetProcessHeap(), 0, owner);
71 HeapFree(GetProcessHeap(), 0, org);
72 break;
74 case NM_CLICK:
75 case NM_RETURN:
76 if(wParam == IDC_ABT_WEB_LINK)
77 ShellExecuteA(NULL, "open", PACKAGE_URL, NULL, NULL, SW_SHOW);
78 break;
80 break;
82 case WM_INITDIALOG:
84 hDC = GetDC(hDlg);
86 /* read owner and organization info from registry, load it into text box */
87 owner = get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
88 "RegisteredOwner", "");
89 org = get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
90 "RegisteredOrganization", "");
92 SetDlgItemText(hDlg, IDC_ABT_OWNER, owner);
93 SetDlgItemText(hDlg, IDC_ABT_ORG, org);
95 SendMessage(GetParent(hDlg), PSM_UNCHANGED, 0, 0);
97 HeapFree(GetProcessHeap(), 0, owner);
98 HeapFree(GetProcessHeap(), 0, org);
100 /* prepare the panel */
101 hWnd = GetDlgItem(hDlg, IDC_ABT_PANEL);
102 if(hWnd)
104 GetClientRect(hDlg, &rcClient);
105 GetClientRect(hWnd, &rcRect);
106 MoveWindow(hWnd, 0, 0, rcClient.right, rcRect.bottom, FALSE);
108 logo = LoadImageW((HINSTANCE)GetWindowLongPtrW(hDlg, GWLP_HINSTANCE),
109 MAKEINTRESOURCEW(IDI_LOGO), IMAGE_ICON, 0, 0, LR_SHARED);
112 /* prepare the title text */
113 hWnd = GetDlgItem(hDlg, IDC_ABT_TITLE_TEXT);
114 if(hWnd)
116 titleFont = CreateFont(
117 -MulDiv(24, GetDeviceCaps(hDC, LOGPIXELSY), 72),
118 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0,
119 "Tahoma");
120 SendMessage(hWnd, WM_SETFONT, (WPARAM)titleFont, TRUE);
123 /* prepare the web link */
124 hWnd = GetDlgItem(hDlg, IDC_ABT_WEB_LINK);
125 if(hWnd)
126 SetWindowTextA(hWnd, "<a href=\"" PACKAGE_URL "\">" PACKAGE_URL "</a>");
128 ReleaseDC(hDlg, hDC);
130 break;
132 case WM_DESTROY:
133 if(logo)
135 DestroyIcon(logo);
136 logo = NULL;
139 if(titleFont)
141 DeleteObject(titleFont);
142 titleFont = NULL;
145 break;
147 case WM_COMMAND:
148 switch(HIWORD(wParam))
150 case EN_CHANGE:
151 /* enable apply button */
152 SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
153 break;
155 break;
157 case WM_DRAWITEM:
158 if(wParam == IDC_ABT_PANEL)
160 LPDRAWITEMSTRUCT pDIS = (LPDRAWITEMSTRUCT)lParam;
161 FillRect(pDIS->hDC, &pDIS->rcItem, (HBRUSH) (COLOR_WINDOW+1));
162 DrawIconEx(pDIS->hDC, 0, 0, logo, 0, 0, 0, 0, DI_IMAGE);
163 DrawEdge(pDIS->hDC, &pDIS->rcItem, EDGE_SUNKEN, BF_BOTTOM);
165 break;
167 case WM_CTLCOLORSTATIC:
168 switch(GetDlgCtrlID((HWND)lParam))
170 case IDC_ABT_TITLE_TEXT:
171 /* set the title to a wine color */
172 SetTextColor((HDC)wParam, 0x0000007F);
173 case IDC_ABT_PANEL_TEXT:
174 case IDC_ABT_LICENSE_TEXT:
175 return (BOOL)CreateSolidBrush(GetSysColor(COLOR_WINDOW));
177 break;
180 return FALSE;