2001-11-24 00:04:58 +01:00
|
|
|
/* dialog management for wineconsole
|
2001-12-04 21:46:54 +01:00
|
|
|
* USER32 backend
|
2002-09-04 20:41:52 +02:00
|
|
|
* Copyright (c) 2001, 2002 Eric Pouech
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-11-24 00:04:58 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2002-01-01 01:14:02 +01:00
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-01-08 00:11:12 +01:00
|
|
|
|
|
|
|
#define NONAMELESSUNION
|
2015-04-02 12:25:37 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winnls.h"
|
2001-11-24 00:04:58 +01:00
|
|
|
#include "commctrl.h"
|
|
|
|
#include "prsht.h"
|
2001-12-04 21:46:54 +01:00
|
|
|
#include "winecon_user.h"
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-05-14 23:45:13 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
struct dialog_info
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2002-09-04 20:41:52 +02:00
|
|
|
struct config_data config; /* configuration used for dialog box */
|
2001-12-04 21:46:54 +01:00
|
|
|
struct inner_data* data; /* pointer to current winecon info */
|
|
|
|
HWND hDlg; /* handle to active propsheet */
|
2001-11-24 00:04:58 +01:00
|
|
|
int nFont; /* number of font size in size LB */
|
2002-06-01 01:06:46 +02:00
|
|
|
struct font_info
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
UINT height;
|
|
|
|
UINT weight;
|
|
|
|
WCHAR faceName[LF_FACESIZE];
|
2001-11-24 00:04:58 +01:00
|
|
|
} *font; /* array of nFont. index sync'ed with SIZE LB */
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_OptionDlgProc
|
|
|
|
*
|
|
|
|
* Dialog prop for the option property sheet
|
|
|
|
*/
|
2006-06-06 07:33:17 +02:00
|
|
|
static INT_PTR WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
struct dialog_info* di;
|
|
|
|
unsigned idc;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
switch (msg)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
|
|
|
|
di->hDlg = hDlg;
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_USER, (LONG_PTR)di);
|
2002-02-04 19:41:32 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendMessageW(GetDlgItem(hDlg,IDC_OPT_HIST_SIZE_UD), UDM_SETRANGE, 0, MAKELPARAM(500, 0));
|
2007-02-19 14:53:39 +01:00
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
if (di->config.cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL;
|
|
|
|
else if (di->config.cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM;
|
2001-12-04 21:46:54 +01:00
|
|
|
else idc = IDC_OPT_CURSOR_LARGE;
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, idc, BM_SETCHECK, BST_CHECKED, 0);
|
2009-01-20 09:15:15 +01:00
|
|
|
SetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, di->config.history_size, FALSE);
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_OPT_HIST_NODOUBLE, BM_SETCHECK,
|
|
|
|
(di->config.history_nodup) ? BST_CHECKED : BST_UNCHECKED, 0);
|
2015-07-13 15:18:37 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_OPT_INSERT_MODE, BM_SETCHECK,
|
|
|
|
(di->config.insert_mode) ? BST_CHECKED : BST_UNCHECKED, 0);
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_OPT_CONF_CTRL, BM_SETCHECK,
|
|
|
|
(di->config.menu_mask & MK_CONTROL) ? BST_CHECKED : BST_UNCHECKED, 0);
|
|
|
|
SendDlgItemMessageW(hDlg, IDC_OPT_CONF_SHIFT, BM_SETCHECK,
|
|
|
|
(di->config.menu_mask & MK_SHIFT) ? BST_CHECKED : BST_UNCHECKED, 0);
|
|
|
|
SendDlgItemMessageW(hDlg, IDC_OPT_QUICK_EDIT, BM_SETCHECK,
|
|
|
|
(di->config.quick_edit) ? BST_CHECKED : BST_UNCHECKED, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
return FALSE; /* because we set the focus */
|
|
|
|
case WM_COMMAND:
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
NMHDR* nmhdr = (NMHDR*)lParam;
|
2001-12-04 21:46:54 +01:00
|
|
|
DWORD val;
|
|
|
|
BOOL done;
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
di = (struct dialog_info*)GetWindowLongPtrW(hDlg, DWLP_USER);
|
2002-02-04 19:41:32 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (nmhdr->code)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* needed in propsheet to keep properly the selected radio button
|
|
|
|
* otherwise, the focus would be set to the first tab stop in the
|
|
|
|
* propsheet, which would always activate the first radio button
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED)
|
2001-11-24 00:04:58 +01:00
|
|
|
idc = IDC_OPT_CURSOR_SMALL;
|
|
|
|
else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED)
|
|
|
|
idc = IDC_OPT_CURSOR_MEDIUM;
|
|
|
|
else
|
|
|
|
idc = IDC_OPT_CURSOR_LARGE;
|
2010-04-28 01:08:48 +02:00
|
|
|
PostMessageW(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, idc), TRUE);
|
2001-12-04 21:46:54 +01:00
|
|
|
di->hDlg = hDlg;
|
2001-11-24 00:04:58 +01:00
|
|
|
break;
|
|
|
|
case PSN_APPLY:
|
2001-12-04 21:46:54 +01:00
|
|
|
if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED) val = 25;
|
|
|
|
else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED) val = 50;
|
2002-09-04 20:41:52 +02:00
|
|
|
else val = 100;
|
|
|
|
di->config.cursor_size = val;
|
2001-12-04 21:46:54 +01:00
|
|
|
|
|
|
|
val = GetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, &done, FALSE);
|
2002-09-04 20:41:52 +02:00
|
|
|
if (done) di->config.history_size = val;
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2012-08-27 13:29:31 +02:00
|
|
|
val = (IsDlgButtonChecked(hDlg, IDC_OPT_HIST_NODOUBLE) & BST_CHECKED) != 0;
|
2002-09-04 20:41:52 +02:00
|
|
|
di->config.history_nodup = val;
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2015-07-13 15:18:37 +02:00
|
|
|
val = (IsDlgButtonChecked(hDlg, IDC_OPT_INSERT_MODE) & BST_CHECKED) != 0;
|
|
|
|
di->config.insert_mode = val;
|
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
val = 0;
|
|
|
|
if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_CTRL) & BST_CHECKED) val |= MK_CONTROL;
|
|
|
|
if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_SHIFT) & BST_CHECKED) val |= MK_SHIFT;
|
2002-09-04 20:41:52 +02:00
|
|
|
di->config.menu_mask = val;
|
2002-02-04 19:41:32 +01:00
|
|
|
|
2012-08-27 13:29:31 +02:00
|
|
|
val = (IsDlgButtonChecked(hDlg, IDC_OPT_QUICK_EDIT) & BST_CHECKED) != 0;
|
2002-09-04 20:41:52 +02:00
|
|
|
di->config.quick_edit = val;
|
2002-02-04 19:41:32 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
2001-11-24 00:04:58 +01:00
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_FontPreviewProc
|
|
|
|
*
|
|
|
|
* Window proc for font previewer in font property sheet
|
|
|
|
*/
|
|
|
|
static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (msg)
|
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
case WM_CREATE:
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hWnd, 0, 0);
|
2002-03-23 21:14:04 +01:00
|
|
|
break;
|
|
|
|
case WM_GETFONT:
|
2010-04-28 01:08:48 +02:00
|
|
|
return GetWindowLongPtrW(hWnd, 0);
|
2002-03-23 21:14:04 +01:00
|
|
|
case WM_SETFONT:
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hWnd, 0, wParam);
|
2002-03-23 21:14:04 +01:00
|
|
|
if (LOWORD(lParam))
|
|
|
|
{
|
|
|
|
InvalidateRect(hWnd, NULL, TRUE);
|
|
|
|
UpdateWindow(hWnd);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_DESTROY:
|
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
HFONT hFont = (HFONT)GetWindowLongPtrW(hWnd, 0);
|
2002-03-23 21:14:04 +01:00
|
|
|
if (hFont) DeleteObject(hFont);
|
|
|
|
}
|
|
|
|
break;
|
2001-11-24 00:04:58 +01:00
|
|
|
case WM_PAINT:
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
int size_idx;
|
|
|
|
struct dialog_info* di;
|
2002-03-23 21:14:04 +01:00
|
|
|
HFONT hFont, hOldFont;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
di = (struct dialog_info*)GetWindowLongPtrW(GetParent(hWnd), DWLP_USER);
|
2001-12-04 21:46:54 +01:00
|
|
|
BeginPaint(hWnd, &ps);
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
size_idx = SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
hFont = (HFONT)GetWindowLongPtrW(hWnd, 0);
|
2002-03-23 21:14:04 +01:00
|
|
|
if (hFont)
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
2010-04-20 11:19:18 +02:00
|
|
|
WCHAR ascii[] = {'A','S','C','I','I',':',' ','a','b','c','X','Y','Z','\0'};
|
|
|
|
WCHAR buf[256];
|
|
|
|
int len;
|
|
|
|
|
|
|
|
hOldFont = SelectObject(ps.hdc, hFont);
|
2010-04-28 01:08:48 +02:00
|
|
|
SetBkColor(ps.hdc, WCUSER_ColorMap[GetWindowLongW(GetDlgItem(di->hDlg, IDC_FNT_COLOR_BK), 0)]);
|
|
|
|
SetTextColor(ps.hdc, WCUSER_ColorMap[GetWindowLongW(GetDlgItem(di->hDlg, IDC_FNT_COLOR_FG), 0)]);
|
|
|
|
len = LoadStringW(GetModuleHandleW(NULL), IDS_FNT_PREVIEW,
|
|
|
|
buf, sizeof(buf) / sizeof(buf[0]));
|
2010-04-20 11:19:18 +02:00
|
|
|
if (len)
|
2010-04-28 01:08:48 +02:00
|
|
|
TextOutW(ps.hdc, 0, 0, buf, len);
|
|
|
|
TextOutW(ps.hdc, 0, di->font[size_idx].height, ascii,
|
|
|
|
sizeof(ascii)/sizeof(ascii[0]) - 1);
|
2010-04-20 11:19:18 +02:00
|
|
|
SelectObject(ps.hdc, hOldFont);
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
|
|
|
EndPaint(hWnd, &ps);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2010-04-28 01:08:48 +02:00
|
|
|
return DefWindowProcW(hWnd, msg, wParam, lParam);
|
2001-11-24 00:04:58 +01:00
|
|
|
}
|
2001-12-04 21:46:54 +01:00
|
|
|
return 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_ColorPreviewProc
|
|
|
|
*
|
|
|
|
* Window proc for color previewer in font property sheet
|
|
|
|
*/
|
|
|
|
static LRESULT WINAPI WCUSER_ColorPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (msg)
|
|
|
|
{
|
|
|
|
case WM_PAINT:
|
|
|
|
{
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
int i, step;
|
|
|
|
RECT client, r;
|
|
|
|
HBRUSH hbr;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
BeginPaint(hWnd, &ps);
|
|
|
|
GetClientRect(hWnd, &client);
|
|
|
|
step = client.right / 8;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
|
|
|
r.top = (i / 8) * (client.bottom / 2);
|
|
|
|
r.bottom = r.top + client.bottom / 2;
|
|
|
|
r.left = (i & 7) * step;
|
|
|
|
r.right = r.left + step;
|
|
|
|
hbr = CreateSolidBrush(WCUSER_ColorMap[i]);
|
|
|
|
FillRect(ps.hdc, &r, hbr);
|
|
|
|
DeleteObject(hbr);
|
2010-04-28 01:08:48 +02:00
|
|
|
if (GetWindowLongW(hWnd, 0) == i)
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
|
|
|
HPEN hOldPen;
|
|
|
|
int i = 2;
|
|
|
|
|
|
|
|
hOldPen = SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
|
|
|
|
r.right--; r.bottom--;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
MoveToEx(ps.hdc, r.left, r.bottom, NULL);
|
|
|
|
LineTo(ps.hdc, r.left, r.top);
|
|
|
|
LineTo(ps.hdc, r.right, r.top);
|
|
|
|
SelectObject(ps.hdc, GetStockObject(BLACK_PEN));
|
|
|
|
LineTo(ps.hdc, r.right, r.bottom);
|
|
|
|
LineTo(ps.hdc, r.left, r.bottom);
|
|
|
|
|
|
|
|
if (--i == 0) break;
|
|
|
|
r.left++; r.top++; r.right--; r.bottom--;
|
|
|
|
SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
|
|
|
|
}
|
|
|
|
SelectObject(ps.hdc, hOldPen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EndPaint(hWnd, &ps);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
{
|
|
|
|
int i, step;
|
|
|
|
RECT client;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
GetClientRect(hWnd, &client);
|
|
|
|
step = client.right / 8;
|
|
|
|
i = (HIWORD(lParam) >= client.bottom / 2) ? 8 : 0;
|
|
|
|
i += LOWORD(lParam) / step;
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongW(hWnd, 0, i);
|
2001-12-04 21:46:54 +01:00
|
|
|
InvalidateRect(GetDlgItem(GetParent(hWnd), IDC_FNT_PREVIEW), NULL, FALSE);
|
|
|
|
InvalidateRect(hWnd, NULL, FALSE);
|
|
|
|
}
|
|
|
|
break;
|
2001-11-24 00:04:58 +01:00
|
|
|
default:
|
2010-04-28 01:08:48 +02:00
|
|
|
return DefWindowProcW(hWnd, msg, wParam, lParam);
|
2001-11-24 00:04:58 +01:00
|
|
|
}
|
|
|
|
return 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* font_enum
|
|
|
|
*
|
2001-12-04 21:46:54 +01:00
|
|
|
* enumerates all the font names with at least one valid font
|
2001-11-24 00:04:58 +01:00
|
|
|
*/
|
2010-04-28 01:08:48 +02:00
|
|
|
static int CALLBACK font_enum_size2(const LOGFONTW* lf, const TEXTMETRICW* tm,
|
|
|
|
DWORD FontType, LPARAM lParam)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
struct dialog_info* di = (struct dialog_info*)lParam;
|
|
|
|
|
2002-05-14 23:45:13 +02:00
|
|
|
WCUSER_DumpTextMetric(tm, FontType);
|
2015-10-20 09:47:35 +02:00
|
|
|
if (WCUSER_ValidateFontMetric(di->data, tm, FontType, TRUE))
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
di->nFont++;
|
|
|
|
}
|
2002-03-23 21:14:04 +01:00
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
static int CALLBACK font_enum(const LOGFONTW* lf, const TEXTMETRICW* tm,
|
|
|
|
DWORD FontType, LPARAM lParam)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
struct dialog_info* di = (struct dialog_info*)lParam;
|
|
|
|
|
2002-05-21 20:05:16 +02:00
|
|
|
WCUSER_DumpLogFont("DlgFamily: ", lf, FontType);
|
|
|
|
if (WCUSER_ValidateFont(di->data, lf))
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
if (FontType & RASTER_FONTTYPE)
|
|
|
|
{
|
|
|
|
di->nFont = 0;
|
2010-04-28 01:08:48 +02:00
|
|
|
EnumFontFamiliesW(PRIVATE(di->data)->hMemDC, lf->lfFaceName, font_enum_size2, (LPARAM)di);
|
2002-03-23 21:14:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
di->nFont = 1;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-03-23 21:14:04 +01:00
|
|
|
if (di->nFont)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_ADDSTRING,
|
|
|
|
0, (LPARAM)lf->lfFaceName);
|
2002-03-23 21:14:04 +01:00
|
|
|
}
|
2001-11-24 00:04:58 +01:00
|
|
|
}
|
2002-03-23 21:14:04 +01:00
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* font_enum_size
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2010-04-28 01:08:48 +02:00
|
|
|
static int CALLBACK font_enum_size(const LOGFONTW* lf, const TEXTMETRICW* tm,
|
|
|
|
DWORD FontType, LPARAM lParam)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
struct dialog_info* di = (struct dialog_info*)lParam;
|
2002-03-23 21:14:04 +01:00
|
|
|
WCHAR buf[32];
|
|
|
|
static const WCHAR fmt[] = {'%','l','d',0};
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-05-14 23:45:13 +02:00
|
|
|
WCUSER_DumpTextMetric(tm, FontType);
|
2002-03-23 21:14:04 +01:00
|
|
|
if (di->nFont == 0 && !(FontType & RASTER_FONTTYPE))
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
|
|
|
|
int i;
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-03-23 21:14:04 +01:00
|
|
|
di->nFont = sizeof(sizes) / sizeof(sizes[0]);
|
|
|
|
di->font = HeapAlloc(GetProcessHeap(), 0, di->nFont * sizeof(di->font[0]));
|
|
|
|
for (i = 0; i < di->nFont; i++)
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
/* drop sizes where window size wouldn't fit on screen */
|
|
|
|
if (sizes[i] * di->data->curcfg.win_height > GetSystemMetrics(SM_CYSCREEN))
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
di->nFont = i;
|
|
|
|
break;
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
2002-03-23 21:14:04 +01:00
|
|
|
di->font[i].height = sizes[i];
|
|
|
|
di->font[i].weight = 400;
|
2010-04-28 01:08:48 +02:00
|
|
|
lstrcpyW(di->font[i].faceName, lf->lfFaceName);
|
|
|
|
wsprintfW(buf, fmt, sizes[i]);
|
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, i, (LPARAM)buf);
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
2002-03-23 21:14:04 +01:00
|
|
|
/* don't need to enumerate other */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-20 09:47:35 +02:00
|
|
|
if (WCUSER_ValidateFontMetric(di->data, tm, FontType, TRUE))
|
2002-03-23 21:14:04 +01:00
|
|
|
{
|
2013-10-21 20:23:39 +02:00
|
|
|
int idx = 0;
|
2002-03-23 21:14:04 +01:00
|
|
|
|
|
|
|
/* we want the string to be sorted with a numeric order, not a lexicographic...
|
|
|
|
* do the job by hand... get where to insert the new string
|
|
|
|
*/
|
2013-10-21 20:23:39 +02:00
|
|
|
while (idx < di->nFont && tm->tmHeight > di->font[idx].height)
|
|
|
|
idx++;
|
2002-06-01 01:06:46 +02:00
|
|
|
while (idx < di->nFont &&
|
|
|
|
tm->tmHeight == di->font[idx].height &&
|
2002-03-23 21:14:04 +01:00
|
|
|
tm->tmWeight > di->font[idx].weight)
|
|
|
|
idx++;
|
2002-06-01 01:06:46 +02:00
|
|
|
if (idx == di->nFont ||
|
2002-03-23 21:14:04 +01:00
|
|
|
tm->tmHeight != di->font[idx].height ||
|
|
|
|
tm->tmWeight < di->font[idx].weight)
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
|
|
|
/* here we need to add the new entry */
|
2010-04-28 01:08:48 +02:00
|
|
|
wsprintfW(buf, fmt, tm->tmHeight);
|
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf);
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2002-03-23 21:14:04 +01:00
|
|
|
/* now grow our arrays and insert the values at the same index than in the list box */
|
2005-11-02 21:51:16 +01:00
|
|
|
if (di->nFont)
|
|
|
|
{
|
|
|
|
di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1));
|
|
|
|
if (idx != di->nFont)
|
|
|
|
memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
di->font = HeapAlloc(GetProcessHeap(), 0, sizeof(*di->font));
|
2002-03-23 21:14:04 +01:00
|
|
|
di->font[idx].height = tm->tmHeight;
|
|
|
|
di->font[idx].weight = tm->tmWeight;
|
2010-04-28 01:08:48 +02:00
|
|
|
lstrcpyW(di->font[idx].faceName, lf->lfFaceName);
|
2001-12-04 21:46:54 +01:00
|
|
|
di->nFont++;
|
|
|
|
}
|
2001-11-24 00:04:58 +01:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* select_font
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static BOOL select_font(struct dialog_info* di)
|
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
int font_idx, size_idx;
|
2001-11-24 00:04:58 +01:00
|
|
|
WCHAR buf[256];
|
|
|
|
WCHAR fmt[128];
|
2011-10-20 14:48:14 +02:00
|
|
|
DWORD_PTR args[2];
|
2010-04-28 01:08:48 +02:00
|
|
|
LOGFONTW lf;
|
2002-03-23 21:14:04 +01:00
|
|
|
HFONT hFont, hOldFont;
|
|
|
|
struct config_data config;
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
font_idx = SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0, 0);
|
|
|
|
size_idx = SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-03-23 21:14:04 +01:00
|
|
|
if (font_idx < 0 || size_idx < 0 || size_idx >= di->nFont)
|
2001-11-24 00:04:58 +01:00
|
|
|
return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
|
2002-03-23 21:14:04 +01:00
|
|
|
di->font[size_idx].height, di->font[size_idx].weight);
|
2007-08-23 17:14:58 +02:00
|
|
|
hFont = WCUSER_CopyFont(&config, di->data->hWnd, &lf, NULL);
|
2002-03-23 21:14:04 +01:00
|
|
|
if (!hFont) return FALSE;
|
|
|
|
|
|
|
|
if (config.cell_height != di->font[size_idx].height)
|
2002-07-23 04:02:46 +02:00
|
|
|
WINE_TRACE("mismatched heights (%u<>%u)\n",
|
2002-05-14 23:45:13 +02:00
|
|
|
config.cell_height, di->font[size_idx].height);
|
2010-04-28 01:08:48 +02:00
|
|
|
hOldFont = (HFONT)SendDlgItemMessageW(di->hDlg, IDC_FNT_PREVIEW, WM_GETFONT, 0, 0);
|
2002-03-23 21:14:04 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_PREVIEW, WM_SETFONT, (WPARAM)hFont, TRUE);
|
2002-03-23 21:14:04 +01:00
|
|
|
if (hOldFont) DeleteObject(hOldFont);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_FNT_DISPLAY, fmt, sizeof(fmt) / sizeof(fmt[0]));
|
2011-10-20 14:48:14 +02:00
|
|
|
args[0] = config.cell_width;
|
|
|
|
args[1] = config.cell_height;
|
|
|
|
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
|
|
|
fmt, 0, 0, buf, sizeof(buf)/sizeof(*buf), (__ms_va_list*)args);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_FONT_INFO, WM_SETTEXT, 0, (LPARAM)buf);
|
2002-03-23 21:14:04 +01:00
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* fill_list_size
|
|
|
|
*
|
|
|
|
* fills the size list box according to selected family in font LB
|
|
|
|
*/
|
|
|
|
static BOOL fill_list_size(struct dialog_info* di, BOOL doInit)
|
|
|
|
{
|
|
|
|
int idx;
|
|
|
|
WCHAR lfFaceName[LF_FACESIZE];
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
idx = SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
if (idx < 0) return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)lfFaceName);
|
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0, 0);
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, di->font);
|
2001-11-24 00:04:58 +01:00
|
|
|
di->nFont = 0;
|
|
|
|
di->font = NULL;
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
EnumFontFamiliesW(PRIVATE(di->data)->hMemDC, lfFaceName, font_enum_size, (LPARAM)di);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
|
|
|
if (doInit)
|
|
|
|
{
|
2002-03-23 21:14:04 +01:00
|
|
|
int ref = -1;
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
for (idx = 0; idx < di->nFont; idx++)
|
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
if (!lstrcmpW(di->font[idx].faceName, di->config.face_name) &&
|
2002-09-04 20:41:52 +02:00
|
|
|
di->font[idx].height == di->config.cell_height &&
|
|
|
|
di->font[idx].weight == di->config.font_weight)
|
2002-03-23 21:14:04 +01:00
|
|
|
{
|
|
|
|
if (ref == -1) ref = idx;
|
2002-05-14 23:45:13 +02:00
|
|
|
else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx);
|
2002-03-23 21:14:04 +01:00
|
|
|
}
|
2001-11-24 00:04:58 +01:00
|
|
|
}
|
2002-03-23 21:14:04 +01:00
|
|
|
idx = (ref == -1) ? 0 : ref;
|
2001-11-24 00:04:58 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
idx = 0;
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
select_font(di);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* fill_list_font
|
|
|
|
*
|
|
|
|
* Fills the font LB
|
|
|
|
*/
|
|
|
|
static BOOL fill_list_font(struct dialog_info* di)
|
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0, 0);
|
|
|
|
EnumFontFamiliesW(PRIVATE(di->data)->hMemDC, NULL, font_enum, (LPARAM)di);
|
|
|
|
if (SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_SELECTSTRING,
|
|
|
|
-1, (LPARAM)di->config.face_name) == LB_ERR)
|
|
|
|
SendDlgItemMessageW(di->hDlg, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
fill_list_size(di, TRUE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_FontDlgProc
|
|
|
|
*
|
|
|
|
* Dialog proc for the Font property sheet
|
|
|
|
*/
|
2006-06-06 07:33:17 +02:00
|
|
|
static INT_PTR WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
struct dialog_info* di;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (msg)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
|
|
|
|
di->hDlg = hDlg;
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_USER, (DWORD_PTR)di);
|
2002-03-23 21:14:04 +01:00
|
|
|
/* remove dialog from this control, font will be reset when listboxes are filled */
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
fill_list_font(di);
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongW(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config.def_attr >> 4) & 0x0F);
|
|
|
|
SetWindowLongW(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F);
|
2001-11-24 00:04:58 +01:00
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
2010-04-28 01:08:48 +02:00
|
|
|
di = (struct dialog_info*)GetWindowLongPtrW(hDlg, DWLP_USER);
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (LOWORD(wParam))
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
case IDC_FNT_LIST_FONT:
|
2001-11-24 00:04:58 +01:00
|
|
|
if (HIWORD(wParam) == LBN_SELCHANGE)
|
|
|
|
{
|
|
|
|
fill_list_size(di, FALSE);
|
|
|
|
}
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
case IDC_FNT_LIST_SIZE:
|
2001-11-24 00:04:58 +01:00
|
|
|
if (HIWORD(wParam) == LBN_SELCHANGE)
|
|
|
|
{
|
|
|
|
select_font(di);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
NMHDR* nmhdr = (NMHDR*)lParam;
|
2001-12-04 21:46:54 +01:00
|
|
|
DWORD val;
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
di = (struct dialog_info*)GetWindowLongPtrW(hDlg, DWLP_USER);
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (nmhdr->code)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2001-12-04 21:46:54 +01:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
di->hDlg = hDlg;
|
|
|
|
break;
|
2001-11-24 00:04:58 +01:00
|
|
|
case PSN_APPLY:
|
2010-04-28 01:08:48 +02:00
|
|
|
val = SendDlgItemMessageW(hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0, 0);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
if (val < di->nFont)
|
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
LOGFONTW lf;
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
WCUSER_FillLogFont(&lf, di->font[val].faceName,
|
|
|
|
di->font[val].height, di->font[val].weight);
|
|
|
|
DeleteObject(WCUSER_CopyFont(&di->config,
|
2007-08-23 17:14:58 +02:00
|
|
|
di->data->hWnd, &lf, NULL));
|
2002-09-04 20:41:52 +02:00
|
|
|
}
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
val = (GetWindowLongW(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |
|
|
|
|
GetWindowLongW(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0);
|
2002-09-04 20:41:52 +02:00
|
|
|
di->config.def_attr = val;
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
2001-11-24 00:04:58 +01:00
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_ConfigDlgProc
|
|
|
|
*
|
|
|
|
* Dialog proc for the config property sheet
|
|
|
|
*/
|
2006-06-06 07:33:17 +02:00
|
|
|
static INT_PTR WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
struct dialog_info* di;
|
2007-02-10 12:44:18 +01:00
|
|
|
int nMaxUD = 2000;
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (msg)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2007-02-10 12:44:18 +01:00
|
|
|
di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
|
|
|
|
di->hDlg = hDlg;
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_USER, (DWORD_PTR)di);
|
2007-02-10 12:44:18 +01:00
|
|
|
SetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, di->config.sb_width, FALSE);
|
|
|
|
SetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, di->config.sb_height, FALSE);
|
|
|
|
SetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, di->config.win_width, FALSE);
|
|
|
|
SetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, di->config.win_height, FALSE);
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendMessageW(GetDlgItem(hDlg,IDC_CNF_WIN_HEIGHT_UD), UDM_SETRANGE, 0, MAKELPARAM(nMaxUD, 0));
|
|
|
|
SendMessageW(GetDlgItem(hDlg,IDC_CNF_WIN_WIDTH_UD), UDM_SETRANGE, 0, MAKELPARAM(nMaxUD, 0));
|
|
|
|
SendMessageW(GetDlgItem(hDlg,IDC_CNF_SB_HEIGHT_UD), UDM_SETRANGE, 0, MAKELPARAM(nMaxUD, 0));
|
|
|
|
SendMessageW(GetDlgItem(hDlg,IDC_CNF_SB_WIDTH_UD), UDM_SETRANGE, 0, MAKELPARAM(nMaxUD, 0));
|
2007-02-10 12:44:18 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_CNF_CLOSE_EXIT, BM_SETCHECK,
|
|
|
|
(di->config.exit_on_die) ? BST_CHECKED : BST_UNCHECKED, 0);
|
2003-01-11 22:00:20 +01:00
|
|
|
{
|
2004-04-20 02:34:52 +02:00
|
|
|
static const WCHAR s1[] = {'W','i','n','3','2',0};
|
|
|
|
static const WCHAR s2[] = {'E','m','a','c','s',0};
|
2003-01-11 22:00:20 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING, 0, (LPARAM)s1);
|
|
|
|
SendDlgItemMessageW(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING, 0, (LPARAM)s2);
|
|
|
|
SendDlgItemMessageW(hDlg, IDC_CNF_EDITION_MODE, CB_SETCURSEL, di->config.edition_mode, 0);
|
2003-01-11 22:00:20 +01:00
|
|
|
}
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
2010-04-28 01:08:48 +02:00
|
|
|
di = (struct dialog_info*)GetWindowLongPtrW(hDlg, DWLP_USER);
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (LOWORD(wParam))
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
2001-12-04 21:46:54 +01:00
|
|
|
NMHDR* nmhdr = (NMHDR*)lParam;
|
2003-02-24 21:41:08 +01:00
|
|
|
int win_w, win_h, sb_w, sb_h;
|
2002-09-04 20:41:52 +02:00
|
|
|
BOOL st1, st2;
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
di = (struct dialog_info*)GetWindowLongPtrW(hDlg, DWLP_USER);
|
2002-06-01 01:06:46 +02:00
|
|
|
switch (nmhdr->code)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2001-12-04 21:46:54 +01:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
di->hDlg = hDlg;
|
|
|
|
break;
|
2001-11-24 00:04:58 +01:00
|
|
|
case PSN_APPLY:
|
2003-02-24 21:41:08 +01:00
|
|
|
sb_w = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, &st1, FALSE);
|
|
|
|
sb_h = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE);
|
|
|
|
if (!st1 || ! st2)
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_INVALID);
|
2003-02-24 21:41:08 +01:00
|
|
|
return TRUE;
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
2003-02-24 21:41:08 +01:00
|
|
|
win_w = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, &st1, FALSE);
|
|
|
|
win_h = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE);
|
|
|
|
if (!st1 || !st2)
|
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_INVALID);
|
2003-02-24 21:41:08 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (win_w > sb_w || win_h > sb_h)
|
2001-12-04 21:46:54 +01:00
|
|
|
{
|
2003-02-24 21:41:08 +01:00
|
|
|
WCHAR cap[256];
|
|
|
|
WCHAR txt[256];
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_DLG_TIT_ERROR,
|
|
|
|
cap, sizeof(cap) / sizeof(cap[0]));
|
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_DLG_ERR_SBWINSIZE,
|
|
|
|
txt, sizeof(txt) / sizeof(cap[0]));
|
|
|
|
|
|
|
|
MessageBoxW(hDlg, txt, cap, MB_OK);
|
|
|
|
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_INVALID);
|
2003-02-24 21:41:08 +01:00
|
|
|
return TRUE;
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
2003-02-24 21:41:08 +01:00
|
|
|
di->config.win_width = win_w;
|
|
|
|
di->config.win_height = win_h;
|
|
|
|
di->config.sb_width = sb_w;
|
|
|
|
di->config.sb_height = sb_h;
|
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
di->config.exit_on_die = IsDlgButtonChecked(hDlg, IDC_CNF_CLOSE_EXIT) ? 1 : 0;
|
2010-04-28 01:08:48 +02:00
|
|
|
di->config.edition_mode = SendDlgItemMessageW(hDlg, IDC_CNF_EDITION_MODE,
|
|
|
|
CB_GETCURSEL, 0, 0);
|
|
|
|
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
2001-11-24 00:04:58 +01:00
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_SaveDlgProc
|
|
|
|
*
|
|
|
|
* Dialog Procedure for choosing how to handle modification to the
|
|
|
|
* console settings.
|
|
|
|
*/
|
2006-06-06 07:33:17 +02:00
|
|
|
static INT_PTR WINAPI WCUSER_SaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
2002-09-04 20:41:52 +02:00
|
|
|
{
|
|
|
|
switch (msg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2010-04-28 01:08:48 +02:00
|
|
|
SendDlgItemMessageW(hDlg, IDC_SAV_SESSION, BM_SETCHECK, BST_CHECKED, 0);
|
2002-09-04 20:41:52 +02:00
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDOK:
|
|
|
|
EndDialog(hDlg,
|
|
|
|
(IsDlgButtonChecked(hDlg, IDC_SAV_SAVE) == BST_CHECKED) ?
|
|
|
|
IDC_SAV_SAVE : IDC_SAV_SESSION);
|
|
|
|
break;
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hDlg, IDCANCEL); break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
/******************************************************************
|
|
|
|
* WCUSER_GetProperties
|
|
|
|
*
|
2002-07-23 04:02:46 +02:00
|
|
|
* Runs the dialog box to set up the wineconsole options
|
2001-11-24 00:04:58 +01:00
|
|
|
*/
|
2001-12-04 21:46:54 +01:00
|
|
|
BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
|
2001-11-24 00:04:58 +01:00
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
HPROPSHEETPAGE psPage[3];
|
|
|
|
PROPSHEETPAGEW psp;
|
|
|
|
PROPSHEETHEADERW psHead;
|
|
|
|
WCHAR buff[256];
|
|
|
|
WNDCLASSW wndclass;
|
2001-12-04 21:46:54 +01:00
|
|
|
static const WCHAR szFntPreview[] = {'W','i','n','e','C','o','n','F','o','n','t','P','r','e','v','i','e','w',0};
|
|
|
|
static const WCHAR szColorPreview[] = {'W','i','n','e','C','o','n','C','o','l','o','r','P','r','e','v','i','e','w',0};
|
2001-11-24 00:04:58 +01:00
|
|
|
struct dialog_info di;
|
2002-09-04 20:41:52 +02:00
|
|
|
struct config_data defcfg;
|
|
|
|
struct config_data* refcfg;
|
|
|
|
BOOL save, modify_session;
|
2001-11-24 00:04:58 +01:00
|
|
|
|
|
|
|
InitCommonControls();
|
|
|
|
|
|
|
|
di.data = data;
|
2001-12-04 21:46:54 +01:00
|
|
|
if (current)
|
|
|
|
{
|
2002-09-04 20:41:52 +02:00
|
|
|
refcfg = &data->curcfg;
|
|
|
|
save = FALSE;
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-04 20:41:52 +02:00
|
|
|
WINECON_RegLoad(NULL, refcfg = &defcfg);
|
|
|
|
save = TRUE;
|
2001-12-04 21:46:54 +01:00
|
|
|
}
|
2002-09-04 20:41:52 +02:00
|
|
|
di.config = *refcfg;
|
2001-11-24 00:04:58 +01:00
|
|
|
di.nFont = 0;
|
|
|
|
di.font = NULL;
|
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
modify_session = FALSE;
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
wndclass.style = 0;
|
|
|
|
wndclass.lpfnWndProc = WCUSER_FontPreviewProc;
|
|
|
|
wndclass.cbClsExtra = 0;
|
2006-05-31 09:28:16 +02:00
|
|
|
wndclass.cbWndExtra = sizeof (DWORD_PTR); /* for hFont */
|
2010-04-28 01:08:48 +02:00
|
|
|
wndclass.hInstance = GetModuleHandleW(NULL);
|
2001-11-24 00:04:58 +01:00
|
|
|
wndclass.hIcon = 0;
|
2010-04-28 01:08:48 +02:00
|
|
|
wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
|
2001-11-24 00:04:58 +01:00
|
|
|
wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
|
|
|
|
wndclass.lpszMenuName = NULL;
|
|
|
|
wndclass.lpszClassName = szFntPreview;
|
2010-04-28 01:08:48 +02:00
|
|
|
RegisterClassW(&wndclass);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
wndclass.style = 0;
|
|
|
|
wndclass.lpfnWndProc = WCUSER_ColorPreviewProc;
|
|
|
|
wndclass.cbClsExtra = 0;
|
|
|
|
wndclass.cbWndExtra = sizeof(DWORD);
|
2010-04-28 01:08:48 +02:00
|
|
|
wndclass.hInstance = GetModuleHandleW(NULL);
|
2001-12-04 21:46:54 +01:00
|
|
|
wndclass.hIcon = 0;
|
2010-04-28 01:08:48 +02:00
|
|
|
wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
|
2001-12-04 21:46:54 +01:00
|
|
|
wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
|
|
|
|
wndclass.lpszMenuName = NULL;
|
|
|
|
wndclass.lpszClassName = szColorPreview;
|
2010-04-28 01:08:48 +02:00
|
|
|
RegisterClassW(&wndclass);
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
memset(&psp, 0, sizeof(psp));
|
|
|
|
psp.dwSize = sizeof(psp);
|
|
|
|
psp.dwFlags = 0;
|
|
|
|
psp.hInstance = wndclass.hInstance;
|
|
|
|
psp.lParam = (LPARAM)&di;
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
psp.u.pszTemplate = MAKEINTRESOURCEW(IDD_OPTION);
|
2001-11-24 00:04:58 +01:00
|
|
|
psp.pfnDlgProc = WCUSER_OptionDlgProc;
|
2010-04-28 01:08:48 +02:00
|
|
|
psPage[0] = CreatePropertySheetPageW(&psp);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
psp.u.pszTemplate = MAKEINTRESOURCEW(IDD_FONT);
|
2001-11-24 00:04:58 +01:00
|
|
|
psp.pfnDlgProc = WCUSER_FontDlgProc;
|
2010-04-28 01:08:48 +02:00
|
|
|
psPage[1] = CreatePropertySheetPageW(&psp);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
psp.u.pszTemplate = MAKEINTRESOURCEW(IDD_CONFIG);
|
2001-11-24 00:04:58 +01:00
|
|
|
psp.pfnDlgProc = WCUSER_ConfigDlgProc;
|
2010-04-28 01:08:48 +02:00
|
|
|
psPage[2] = CreatePropertySheetPageW(&psp);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
|
|
|
memset(&psHead, 0, sizeof(psHead));
|
|
|
|
psHead.dwSize = sizeof(psHead);
|
2001-12-04 21:46:54 +01:00
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
if (!LoadStringW(GetModuleHandleW(NULL),
|
|
|
|
(current) ? IDS_DLG_TIT_CURRENT : IDS_DLG_TIT_DEFAULT,
|
|
|
|
buff, sizeof(buff) / sizeof(buff[0])))
|
2002-02-04 19:41:32 +01:00
|
|
|
{
|
|
|
|
buff[0] = 'S';
|
|
|
|
buff[1] = 'e';
|
|
|
|
buff[2] = 't';
|
|
|
|
buff[3] = 'u';
|
|
|
|
buff[4] = 'p';
|
|
|
|
buff[5] = '\0';
|
|
|
|
}
|
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
psHead.pszCaption = buff;
|
2001-11-24 00:04:58 +01:00
|
|
|
psHead.nPages = 3;
|
2007-08-23 17:14:58 +02:00
|
|
|
psHead.hwndParent = data->hWnd;
|
2001-11-24 00:04:58 +01:00
|
|
|
psHead.u3.phpage = psPage;
|
2007-11-14 16:17:55 +01:00
|
|
|
psHead.dwFlags = PSH_NOAPPLYNOW;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
WINECON_DumpConfig("init", refcfg);
|
|
|
|
|
2010-04-28 01:08:48 +02:00
|
|
|
PropertySheetW(&psHead);
|
2001-11-24 00:04:58 +01:00
|
|
|
|
2002-09-04 20:41:52 +02:00
|
|
|
if (memcmp(refcfg, &di.config, sizeof(*refcfg)) == 0)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
WINECON_DumpConfig("ref", refcfg);
|
|
|
|
WINECON_DumpConfig("cur", &di.config);
|
|
|
|
if (refcfg == &data->curcfg)
|
|
|
|
{
|
2010-04-28 01:08:48 +02:00
|
|
|
switch (DialogBoxW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDD_SAVE_SETTINGS),
|
|
|
|
data->hWnd, WCUSER_SaveDlgProc))
|
2002-09-04 20:41:52 +02:00
|
|
|
{
|
|
|
|
case IDC_SAV_SAVE: save = TRUE; modify_session = TRUE; break;
|
|
|
|
case IDC_SAV_SESSION: modify_session = TRUE; break;
|
|
|
|
case IDCANCEL: break;
|
|
|
|
default: WINE_ERR("ooch\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-03 12:32:52 +01:00
|
|
|
if (modify_session) WINECON_SetConfig(data, &di.config);
|
2002-09-04 20:41:52 +02:00
|
|
|
if (save) WINECON_RegSave(&di.config);
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|