1 /* dialog management for wineconsole
3 * Copyright (c) 2001, 2002 Eric Pouech
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "winecon_user.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
32 struct config_data config; /* configuration used for dialog box */
33 struct inner_data* data; /* pointer to current winecon info */
34 HWND hDlg; /* handle to active propsheet */
35 int nFont; /* number of font size in size LB */
40 WCHAR faceName[LF_FACESIZE];
41 } *font; /* array of nFont. index sync'ed with SIZE LB */
44 /******************************************************************
45 * WCUSER_OptionDlgProc
47 * Dialog prop for the option property sheet
49 static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
51 struct dialog_info* di;
57 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
59 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
61 if (di->config.cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL;
62 else if (di->config.cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM;
63 else idc = IDC_OPT_CURSOR_LARGE;
64 SendDlgItemMessage(hDlg, idc, BM_SETCHECK, BST_CHECKED, 0L);
65 SetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, WINECON_GetHistorySize(di->data->hConIn), FALSE);
66 SendDlgItemMessage(hDlg, IDC_OPT_HIST_NODOUBLE, BM_SETCHECK,
67 (di->config.history_nodup) ? BST_CHECKED : BST_UNCHECKED, 0L);
68 SendDlgItemMessage(hDlg, IDC_OPT_CONF_CTRL, BM_SETCHECK,
69 (di->config.menu_mask & MK_CONTROL) ? BST_CHECKED : BST_UNCHECKED, 0L);
70 SendDlgItemMessage(hDlg, IDC_OPT_CONF_SHIFT, BM_SETCHECK,
71 (di->config.menu_mask & MK_SHIFT) ? BST_CHECKED : BST_UNCHECKED, 0L);
72 SendDlgItemMessage(hDlg, IDC_OPT_QUICK_EDIT, BM_SETCHECK,
73 (di->config.quick_edit) ? BST_CHECKED : BST_UNCHECKED, 0L);
74 return FALSE; /* because we set the focus */
79 NMHDR* nmhdr = (NMHDR*)lParam;
83 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
88 /* needed in propsheet to keep properly the selected radio button
89 * otherwise, the focus would be set to the first tab stop in the
90 * propsheet, which would always activate the first radio button
92 if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED)
93 idc = IDC_OPT_CURSOR_SMALL;
94 else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED)
95 idc = IDC_OPT_CURSOR_MEDIUM;
97 idc = IDC_OPT_CURSOR_LARGE;
98 PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, idc), TRUE);
102 if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED) val = 25;
103 else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED) val = 50;
105 di->config.cursor_size = val;
107 val = GetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, &done, FALSE);
108 if (done) di->config.history_size = val;
110 val = (IsDlgButtonChecked(hDlg, IDC_OPT_HIST_NODOUBLE) & BST_CHECKED) ? TRUE : FALSE;
111 di->config.history_nodup = val;
114 if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_CTRL) & BST_CHECKED) val |= MK_CONTROL;
115 if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_SHIFT) & BST_CHECKED) val |= MK_SHIFT;
116 di->config.menu_mask = val;
118 val = (IsDlgButtonChecked(hDlg, IDC_OPT_QUICK_EDIT) & BST_CHECKED) ? TRUE : FALSE;
119 di->config.quick_edit = val;
121 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
134 /******************************************************************
135 * WCUSER_FontPreviewProc
137 * Window proc for font previewer in font property sheet
139 static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
144 SetWindowLong(hWnd, 0, 0);
147 return GetWindowLong(hWnd, 0);
149 SetWindowLong(hWnd, 0, wParam);
152 InvalidateRect(hWnd, NULL, TRUE);
158 HFONT hFont = (HFONT)GetWindowLong(hWnd, 0L);
159 if (hFont) DeleteObject(hFont);
167 struct dialog_info* di;
168 HFONT hFont, hOldFont;
170 di = (struct dialog_info*)GetWindowLong(GetParent(hWnd), DWL_USER);
171 BeginPaint(hWnd, &ps);
173 font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
174 size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
176 hFont = (HFONT)GetWindowLong(hWnd, 0L);
183 len1 = LoadString(GetModuleHandle(NULL), IDS_FNT_PREVIEW_1,
184 buf1, sizeof(buf1) / sizeof(WCHAR));
185 len2 = LoadString(GetModuleHandle(NULL), IDS_FNT_PREVIEW_2,
186 buf2, sizeof(buf2) / sizeof(WCHAR));
187 buf1[len1] = buf2[len2] = 0;
190 hOldFont = SelectObject(ps.hdc, hFont);
191 SetBkColor(ps.hdc, WCUSER_ColorMap[GetWindowLong(GetDlgItem(di->hDlg, IDC_FNT_COLOR_BK), 0)]);
192 SetTextColor(ps.hdc, WCUSER_ColorMap[GetWindowLong(GetDlgItem(di->hDlg, IDC_FNT_COLOR_FG), 0)]);
193 TextOut(ps.hdc, 0, 0, buf1, len1);
195 TextOut(ps.hdc, 0, di->font[size_idx].height, buf2, len2);
196 SelectObject(ps.hdc, hOldFont);
203 return DefWindowProc(hWnd, msg, wParam, lParam);
208 /******************************************************************
209 * WCUSER_ColorPreviewProc
211 * Window proc for color previewer in font property sheet
213 static LRESULT WINAPI WCUSER_ColorPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
224 BeginPaint(hWnd, &ps);
225 GetClientRect(hWnd, &client);
226 step = client.right / 8;
228 for (i = 0; i < 16; i++)
230 r.top = (i / 8) * (client.bottom / 2);
231 r.bottom = r.top + client.bottom / 2;
232 r.left = (i & 7) * step;
233 r.right = r.left + step;
234 hbr = CreateSolidBrush(WCUSER_ColorMap[i]);
235 FillRect(ps.hdc, &r, hbr);
237 if (GetWindowLong(hWnd, 0) == i)
242 hOldPen = SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
243 r.right--; r.bottom--;
246 MoveToEx(ps.hdc, r.left, r.bottom, NULL);
247 LineTo(ps.hdc, r.left, r.top);
248 LineTo(ps.hdc, r.right, r.top);
249 SelectObject(ps.hdc, GetStockObject(BLACK_PEN));
250 LineTo(ps.hdc, r.right, r.bottom);
251 LineTo(ps.hdc, r.left, r.bottom);
254 r.left++; r.top++; r.right--; r.bottom--;
255 SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
257 SelectObject(ps.hdc, hOldPen);
268 GetClientRect(hWnd, &client);
269 step = client.right / 8;
270 i = (HIWORD(lParam) >= client.bottom / 2) ? 8 : 0;
271 i += LOWORD(lParam) / step;
272 SetWindowLong(hWnd, 0, i);
273 InvalidateRect(GetDlgItem(GetParent(hWnd), IDC_FNT_PREVIEW), NULL, FALSE);
274 InvalidateRect(hWnd, NULL, FALSE);
278 return DefWindowProc(hWnd, msg, wParam, lParam);
283 /******************************************************************
286 * enumerates all the font names with at least one valid font
288 static int CALLBACK font_enum_size2(const LOGFONT* lf, const TEXTMETRIC* tm,
289 DWORD FontType, LPARAM lParam)
291 struct dialog_info* di = (struct dialog_info*)lParam;
293 WCUSER_DumpTextMetric(tm, FontType);
294 if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
302 static int CALLBACK font_enum(const LOGFONT* lf, const TEXTMETRIC* tm,
303 DWORD FontType, LPARAM lParam)
305 struct dialog_info* di = (struct dialog_info*)lParam;
307 WCUSER_DumpLogFont("DlgFamily: ", lf, FontType);
308 if (WCUSER_ValidateFont(di->data, lf))
310 if (FontType & RASTER_FONTTYPE)
313 EnumFontFamilies(PRIVATE(di->data)->hMemDC, lf->lfFaceName, font_enum_size2, (LPARAM)di);
320 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_ADDSTRING,
321 0, (LPARAM)lf->lfFaceName);
328 /******************************************************************
333 static int CALLBACK font_enum_size(const LOGFONT* lf, const TEXTMETRIC* tm,
334 DWORD FontType, LPARAM lParam)
336 struct dialog_info* di = (struct dialog_info*)lParam;
338 static const WCHAR fmt[] = {'%','l','d',0};
340 WCUSER_DumpTextMetric(tm, FontType);
341 if (di->nFont == 0 && !(FontType & RASTER_FONTTYPE))
343 static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
346 di->nFont = sizeof(sizes) / sizeof(sizes[0]);
347 di->font = HeapAlloc(GetProcessHeap(), 0, di->nFont * sizeof(di->font[0]));
348 for (i = 0; i < di->nFont; i++)
350 /* drop sizes where window size wouldn't fit on screen */
351 if (sizes[i] * di->data->curcfg.win_height > GetSystemMetrics(SM_CYSCREEN))
356 di->font[i].height = sizes[i];
357 di->font[i].weight = 400;
358 lstrcpy(di->font[i].faceName, lf->lfFaceName);
359 wsprintf(buf, fmt, sizes[i]);
360 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, i, (LPARAM)buf);
362 /* don't need to enumerate other */
366 if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
370 /* we want the string to be sorted with a numeric order, not a lexicographic...
371 * do the job by hand... get where to insert the new string
373 for (idx = 0; idx < di->nFont && tm->tmHeight > di->font[idx].height; idx++);
374 while (idx < di->nFont &&
375 tm->tmHeight == di->font[idx].height &&
376 tm->tmWeight > di->font[idx].weight)
378 if (idx == di->nFont ||
379 tm->tmHeight != di->font[idx].height ||
380 tm->tmWeight < di->font[idx].weight)
382 /* here we need to add the new entry */
383 wsprintf(buf, fmt, tm->tmHeight);
384 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf);
386 /* now grow our arrays and insert the values at the same index than in the list box */
387 di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1));
388 if (idx != di->nFont)
389 memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font));
390 di->font[idx].height = tm->tmHeight;
391 di->font[idx].weight = tm->tmWeight;
392 lstrcpy(di->font[idx].faceName, lf->lfFaceName);
399 /******************************************************************
404 static BOOL select_font(struct dialog_info* di)
406 int font_idx, size_idx;
410 HFONT hFont, hOldFont;
411 struct config_data config;
413 font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
414 size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
416 if (font_idx < 0 || size_idx < 0 || size_idx >= di->nFont)
419 WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
420 di->font[size_idx].height, di->font[size_idx].weight);
421 hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf);
422 if (!hFont) return FALSE;
424 if (config.cell_height != di->font[size_idx].height)
425 WINE_TRACE("mismatched heights (%u<>%u)\n",
426 config.cell_height, di->font[size_idx].height);
427 hOldFont = (HFONT)SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_GETFONT, 0L, 0L);
429 SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_SETFONT, (DWORD)hFont, TRUE);
430 if (hOldFont) DeleteObject(hOldFont);
432 LoadString(GetModuleHandle(NULL), IDS_FNT_DISPLAY, fmt, sizeof(fmt) / sizeof(WCHAR));
433 wsprintf(buf, fmt, config.cell_width, config.cell_height);
435 SendDlgItemMessage(di->hDlg, IDC_FNT_FONT_INFO, WM_SETTEXT, 0, (LPARAM)buf);
440 /******************************************************************
443 * fills the size list box according to selected family in font LB
445 static BOOL fill_list_size(struct dialog_info* di, BOOL doInit)
448 WCHAR lfFaceName[LF_FACESIZE];
450 idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
451 if (idx < 0) return FALSE;
453 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)lfFaceName);
454 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0L, 0L);
455 if (di->font) HeapFree(GetProcessHeap(), 0, di->font);
459 EnumFontFamilies(PRIVATE(di->data)->hMemDC, lfFaceName, font_enum_size, (LPARAM)di);
465 for (idx = 0; idx < di->nFont; idx++)
467 if (!lstrcmp(di->font[idx].faceName, di->config.face_name) &&
468 di->font[idx].height == di->config.cell_height &&
469 di->font[idx].weight == di->config.font_weight)
471 if (ref == -1) ref = idx;
472 else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx);
475 idx = (ref == -1) ? 0 : ref;
479 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0L);
484 /******************************************************************
489 static BOOL fill_list_font(struct dialog_info* di)
491 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0L, 0L);
492 EnumFontFamilies(PRIVATE(di->data)->hMemDC, NULL, font_enum, (LPARAM)di);
493 if (SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SELECTSTRING,
494 (WPARAM)-1, (LPARAM)di->config.face_name) == LB_ERR)
495 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0L, 0L);
496 fill_list_size(di, TRUE);
500 /******************************************************************
503 * Dialog proc for the Font property sheet
505 static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
507 struct dialog_info* di;
512 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
514 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
515 /* remove dialog from this control, font will be reset when listboxes are filled */
516 SendDlgItemMessage(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0L, 0L);
518 SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config.def_attr >> 4) & 0x0F);
519 SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F);
522 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
523 switch (LOWORD(wParam))
525 case IDC_FNT_LIST_FONT:
526 if (HIWORD(wParam) == LBN_SELCHANGE)
528 fill_list_size(di, FALSE);
531 case IDC_FNT_LIST_SIZE:
532 if (HIWORD(wParam) == LBN_SELCHANGE)
541 NMHDR* nmhdr = (NMHDR*)lParam;
544 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
551 val = SendDlgItemMessage(hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
557 WCUSER_FillLogFont(&lf, di->font[val].faceName,
558 di->font[val].height, di->font[val].weight);
559 DeleteObject(WCUSER_CopyFont(&di->config,
560 PRIVATE(di->data)->hWnd, &lf));
563 val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |
564 GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0);
565 di->config.def_attr = val;
567 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
580 /******************************************************************
581 * WCUSER_ConfigDlgProc
583 * Dialog proc for the config property sheet
585 static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
587 struct dialog_info* di;
592 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
594 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
595 SetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, di->config.sb_width, FALSE);
596 SetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, di->config.sb_height, FALSE);
597 SetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, di->config.win_width, FALSE);
598 SetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, di->config.win_height, FALSE);
599 SendDlgItemMessage(hDlg, IDC_CNF_CLOSE_EXIT, BM_SETCHECK,
600 (di->config.exit_on_die) ? BST_CHECKED : BST_UNCHECKED, 0L);
603 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
604 switch (LOWORD(wParam))
610 NMHDR* nmhdr = (NMHDR*)lParam;
614 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
621 x = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, &st1, FALSE);
622 y = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE);
625 di->config.sb_width = x;
626 di->config.sb_height = y;
629 x = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, &st1, FALSE);
630 y = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE);
633 di->config.win_width = x;
634 di->config.win_height = y;
636 di->config.exit_on_die = IsDlgButtonChecked(hDlg, IDC_CNF_CLOSE_EXIT) ? 1 : 0;
638 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
651 /******************************************************************
654 * Dialog Procedure for choosing how to handle modification to the
657 static BOOL WINAPI WCUSER_SaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
664 switch (LOWORD(wParam))
668 (IsDlgButtonChecked(hDlg, IDC_SAV_SAVE) == BST_CHECKED) ?
669 IDC_SAV_SAVE : IDC_SAV_SESSION);
672 EndDialog(hDlg, IDCANCEL); break;
681 /******************************************************************
682 * WCUSER_GetProperties
684 * Runs the dialog box to set up the wineconsole options
686 BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
688 HPROPSHEETPAGE psPage[3];
690 PROPSHEETHEADER psHead;
693 static const WCHAR szFntPreview[] = {'W','i','n','e','C','o','n','F','o','n','t','P','r','e','v','i','e','w',0};
694 static const WCHAR szColorPreview[] = {'W','i','n','e','C','o','n','C','o','l','o','r','P','r','e','v','i','e','w',0};
695 struct dialog_info di;
696 struct config_data defcfg;
697 struct config_data* refcfg;
698 BOOL save, modify_session;
700 InitCommonControls();
705 refcfg = &data->curcfg;
710 WINECON_RegLoad(NULL, refcfg = &defcfg);
717 modify_session = FALSE;
720 wndclass.lpfnWndProc = WCUSER_FontPreviewProc;
721 wndclass.cbClsExtra = 0;
722 wndclass.cbWndExtra = 4; /* for hFont */
723 wndclass.hInstance = GetModuleHandle(NULL);
725 wndclass.hCursor = LoadCursor(0, IDC_ARROW);
726 wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
727 wndclass.lpszMenuName = NULL;
728 wndclass.lpszClassName = szFntPreview;
729 RegisterClass(&wndclass);
732 wndclass.lpfnWndProc = WCUSER_ColorPreviewProc;
733 wndclass.cbClsExtra = 0;
734 wndclass.cbWndExtra = sizeof(DWORD);
735 wndclass.hInstance = GetModuleHandle(NULL);
737 wndclass.hCursor = LoadCursor(0, IDC_ARROW);
738 wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
739 wndclass.lpszMenuName = NULL;
740 wndclass.lpszClassName = szColorPreview;
741 RegisterClass(&wndclass);
743 memset(&psp, 0, sizeof(psp));
744 psp.dwSize = sizeof(psp);
746 psp.hInstance = wndclass.hInstance;
747 psp.lParam = (LPARAM)&di;
749 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_OPTION);
750 psp.pfnDlgProc = WCUSER_OptionDlgProc;
751 psPage[0] = CreatePropertySheetPage(&psp);
753 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_FONT);
754 psp.pfnDlgProc = WCUSER_FontDlgProc;
755 psPage[1] = CreatePropertySheetPage(&psp);
757 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
758 psp.pfnDlgProc = WCUSER_ConfigDlgProc;
759 psPage[2] = CreatePropertySheetPage(&psp);
761 memset(&psHead, 0, sizeof(psHead));
762 psHead.dwSize = sizeof(psHead);
764 if (!LoadString(GetModuleHandle(NULL),
765 (current) ? IDS_DLG_TIT_CURRENT : IDS_DLG_TIT_DEFAULT,
766 buff, sizeof(buff) / sizeof(buff[0])))
776 psHead.pszCaption = buff;
778 psHead.hwndParent = PRIVATE(data)->hWnd;
779 psHead.u3.phpage = psPage;
781 WINECON_DumpConfig("init", refcfg);
783 PropertySheet(&psHead);
785 if (memcmp(refcfg, &di.config, sizeof(*refcfg)) == 0)
788 WINECON_DumpConfig("ref", refcfg);
789 WINECON_DumpConfig("cur", &di.config);
790 if (refcfg == &data->curcfg)
792 switch (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVE_SETTINGS),
793 PRIVATE(data)->hWnd, WCUSER_SaveDlgProc))
795 case IDC_SAV_SAVE: save = TRUE; modify_session = TRUE; break;
796 case IDC_SAV_SESSION: modify_session = TRUE; break;
797 case IDCANCEL: break;
798 default: WINE_ERR("ooch\n");
802 if (modify_session) WINECON_SetConfig(data, &di.config, FALSE);
803 if (save) WINECON_RegSave(&di.config);