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 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
33 #include "winecon_user.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
41 struct config_data config; /* configuration used for dialog box */
42 struct inner_data* data; /* pointer to current winecon info */
43 HWND hDlg; /* handle to active propsheet */
44 int nFont; /* number of font size in size LB */
49 WCHAR faceName[LF_FACESIZE];
50 } *font; /* array of nFont. index sync'ed with SIZE LB */
53 /******************************************************************
54 * WCUSER_OptionDlgProc
56 * Dialog prop for the option property sheet
58 static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
60 struct dialog_info* di;
66 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
68 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
70 if (di->config.cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL;
71 else if (di->config.cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM;
72 else idc = IDC_OPT_CURSOR_LARGE;
73 SendDlgItemMessage(hDlg, idc, BM_SETCHECK, BST_CHECKED, 0L);
74 SetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, WINECON_GetHistorySize(di->data->hConIn), FALSE);
75 SendDlgItemMessage(hDlg, IDC_OPT_HIST_NODOUBLE, BM_SETCHECK,
76 (di->config.history_nodup) ? BST_CHECKED : BST_UNCHECKED, 0L);
77 SendDlgItemMessage(hDlg, IDC_OPT_CONF_CTRL, BM_SETCHECK,
78 (di->config.menu_mask & MK_CONTROL) ? BST_CHECKED : BST_UNCHECKED, 0L);
79 SendDlgItemMessage(hDlg, IDC_OPT_CONF_SHIFT, BM_SETCHECK,
80 (di->config.menu_mask & MK_SHIFT) ? BST_CHECKED : BST_UNCHECKED, 0L);
81 SendDlgItemMessage(hDlg, IDC_OPT_QUICK_EDIT, BM_SETCHECK,
82 (di->config.quick_edit) ? BST_CHECKED : BST_UNCHECKED, 0L);
83 return FALSE; /* because we set the focus */
88 NMHDR* nmhdr = (NMHDR*)lParam;
92 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
97 /* needed in propsheet to keep properly the selected radio button
98 * otherwise, the focus would be set to the first tab stop in the
99 * propsheet, which would always activate the first radio button
101 if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED)
102 idc = IDC_OPT_CURSOR_SMALL;
103 else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED)
104 idc = IDC_OPT_CURSOR_MEDIUM;
106 idc = IDC_OPT_CURSOR_LARGE;
107 PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, idc), TRUE);
111 if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED) val = 25;
112 else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED) val = 50;
114 di->config.cursor_size = val;
116 val = GetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, &done, FALSE);
117 if (done) di->config.history_size = val;
119 val = (IsDlgButtonChecked(hDlg, IDC_OPT_HIST_NODOUBLE) & BST_CHECKED) ? TRUE : FALSE;
120 di->config.history_nodup = val;
123 if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_CTRL) & BST_CHECKED) val |= MK_CONTROL;
124 if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_SHIFT) & BST_CHECKED) val |= MK_SHIFT;
125 di->config.menu_mask = val;
127 val = (IsDlgButtonChecked(hDlg, IDC_OPT_QUICK_EDIT) & BST_CHECKED) ? TRUE : FALSE;
128 di->config.quick_edit = val;
130 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
143 /******************************************************************
144 * WCUSER_FontPreviewProc
146 * Window proc for font previewer in font property sheet
148 static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
153 SetWindowLong(hWnd, 0, 0);
156 return GetWindowLong(hWnd, 0);
158 SetWindowLong(hWnd, 0, wParam);
161 InvalidateRect(hWnd, NULL, TRUE);
167 HFONT hFont = (HFONT)GetWindowLong(hWnd, 0L);
168 if (hFont) DeleteObject(hFont);
176 struct dialog_info* di;
177 HFONT hFont, hOldFont;
179 di = (struct dialog_info*)GetWindowLong(GetParent(hWnd), DWL_USER);
180 BeginPaint(hWnd, &ps);
182 font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
183 size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
185 hFont = (HFONT)GetWindowLong(hWnd, 0L);
192 len1 = LoadString(GetModuleHandle(NULL), IDS_FNT_PREVIEW_1,
193 buf1, sizeof(buf1) / sizeof(WCHAR));
194 len2 = LoadString(GetModuleHandle(NULL), IDS_FNT_PREVIEW_2,
195 buf2, sizeof(buf2) / sizeof(WCHAR));
196 buf1[len1] = buf2[len2] = 0;
199 hOldFont = SelectObject(ps.hdc, hFont);
200 SetBkColor(ps.hdc, WCUSER_ColorMap[GetWindowLong(GetDlgItem(di->hDlg, IDC_FNT_COLOR_BK), 0)]);
201 SetTextColor(ps.hdc, WCUSER_ColorMap[GetWindowLong(GetDlgItem(di->hDlg, IDC_FNT_COLOR_FG), 0)]);
202 TextOut(ps.hdc, 0, 0, buf1, len1);
204 TextOut(ps.hdc, 0, di->font[size_idx].height, buf2, len2);
205 SelectObject(ps.hdc, hOldFont);
212 return DefWindowProc(hWnd, msg, wParam, lParam);
217 /******************************************************************
218 * WCUSER_ColorPreviewProc
220 * Window proc for color previewer in font property sheet
222 static LRESULT WINAPI WCUSER_ColorPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
233 BeginPaint(hWnd, &ps);
234 GetClientRect(hWnd, &client);
235 step = client.right / 8;
237 for (i = 0; i < 16; i++)
239 r.top = (i / 8) * (client.bottom / 2);
240 r.bottom = r.top + client.bottom / 2;
241 r.left = (i & 7) * step;
242 r.right = r.left + step;
243 hbr = CreateSolidBrush(WCUSER_ColorMap[i]);
244 FillRect(ps.hdc, &r, hbr);
246 if (GetWindowLong(hWnd, 0) == i)
251 hOldPen = SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
252 r.right--; r.bottom--;
255 MoveToEx(ps.hdc, r.left, r.bottom, NULL);
256 LineTo(ps.hdc, r.left, r.top);
257 LineTo(ps.hdc, r.right, r.top);
258 SelectObject(ps.hdc, GetStockObject(BLACK_PEN));
259 LineTo(ps.hdc, r.right, r.bottom);
260 LineTo(ps.hdc, r.left, r.bottom);
263 r.left++; r.top++; r.right--; r.bottom--;
264 SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
266 SelectObject(ps.hdc, hOldPen);
277 GetClientRect(hWnd, &client);
278 step = client.right / 8;
279 i = (HIWORD(lParam) >= client.bottom / 2) ? 8 : 0;
280 i += LOWORD(lParam) / step;
281 SetWindowLong(hWnd, 0, i);
282 InvalidateRect(GetDlgItem(GetParent(hWnd), IDC_FNT_PREVIEW), NULL, FALSE);
283 InvalidateRect(hWnd, NULL, FALSE);
287 return DefWindowProc(hWnd, msg, wParam, lParam);
292 /******************************************************************
295 * enumerates all the font names with at least one valid font
297 static int CALLBACK font_enum_size2(const LOGFONT* lf, const TEXTMETRIC* tm,
298 DWORD FontType, LPARAM lParam)
300 struct dialog_info* di = (struct dialog_info*)lParam;
302 WCUSER_DumpTextMetric(tm, FontType);
303 if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
311 static int CALLBACK font_enum(const LOGFONT* lf, const TEXTMETRIC* tm,
312 DWORD FontType, LPARAM lParam)
314 struct dialog_info* di = (struct dialog_info*)lParam;
316 WCUSER_DumpLogFont("DlgFamily: ", lf, FontType);
317 if (WCUSER_ValidateFont(di->data, lf))
319 if (FontType & RASTER_FONTTYPE)
322 EnumFontFamilies(PRIVATE(di->data)->hMemDC, lf->lfFaceName, font_enum_size2, (LPARAM)di);
329 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_ADDSTRING,
330 0, (LPARAM)lf->lfFaceName);
337 /******************************************************************
342 static int CALLBACK font_enum_size(const LOGFONT* lf, const TEXTMETRIC* tm,
343 DWORD FontType, LPARAM lParam)
345 struct dialog_info* di = (struct dialog_info*)lParam;
347 static const WCHAR fmt[] = {'%','l','d',0};
349 WCUSER_DumpTextMetric(tm, FontType);
350 if (di->nFont == 0 && !(FontType & RASTER_FONTTYPE))
352 static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
355 di->nFont = sizeof(sizes) / sizeof(sizes[0]);
356 di->font = HeapAlloc(GetProcessHeap(), 0, di->nFont * sizeof(di->font[0]));
357 for (i = 0; i < di->nFont; i++)
359 /* drop sizes where window size wouldn't fit on screen */
360 if (sizes[i] * di->data->curcfg.win_height > GetSystemMetrics(SM_CYSCREEN))
365 di->font[i].height = sizes[i];
366 di->font[i].weight = 400;
367 lstrcpy(di->font[i].faceName, lf->lfFaceName);
368 wsprintf(buf, fmt, sizes[i]);
369 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, i, (LPARAM)buf);
371 /* don't need to enumerate other */
375 if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
379 /* we want the string to be sorted with a numeric order, not a lexicographic...
380 * do the job by hand... get where to insert the new string
382 for (idx = 0; idx < di->nFont && tm->tmHeight > di->font[idx].height; idx++);
383 while (idx < di->nFont &&
384 tm->tmHeight == di->font[idx].height &&
385 tm->tmWeight > di->font[idx].weight)
387 if (idx == di->nFont ||
388 tm->tmHeight != di->font[idx].height ||
389 tm->tmWeight < di->font[idx].weight)
391 /* here we need to add the new entry */
392 wsprintf(buf, fmt, tm->tmHeight);
393 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf);
395 /* now grow our arrays and insert the values at the same index than in the list box */
396 di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1));
397 if (idx != di->nFont)
398 memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font));
399 di->font[idx].height = tm->tmHeight;
400 di->font[idx].weight = tm->tmWeight;
401 lstrcpy(di->font[idx].faceName, lf->lfFaceName);
408 /******************************************************************
413 static BOOL select_font(struct dialog_info* di)
415 int font_idx, size_idx;
419 HFONT hFont, hOldFont;
420 struct config_data config;
422 font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
423 size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
425 if (font_idx < 0 || size_idx < 0 || size_idx >= di->nFont)
428 WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
429 di->font[size_idx].height, di->font[size_idx].weight);
430 hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf);
431 if (!hFont) return FALSE;
433 if (config.cell_height != di->font[size_idx].height)
434 WINE_TRACE("mismatched heights (%u<>%u)\n",
435 config.cell_height, di->font[size_idx].height);
436 hOldFont = (HFONT)SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_GETFONT, 0L, 0L);
438 SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_SETFONT, (DWORD)hFont, TRUE);
439 if (hOldFont) DeleteObject(hOldFont);
441 LoadString(GetModuleHandle(NULL), IDS_FNT_DISPLAY, fmt, sizeof(fmt) / sizeof(WCHAR));
442 wsprintf(buf, fmt, config.cell_width, config.cell_height);
444 SendDlgItemMessage(di->hDlg, IDC_FNT_FONT_INFO, WM_SETTEXT, 0, (LPARAM)buf);
449 /******************************************************************
452 * fills the size list box according to selected family in font LB
454 static BOOL fill_list_size(struct dialog_info* di, BOOL doInit)
457 WCHAR lfFaceName[LF_FACESIZE];
459 idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
460 if (idx < 0) return FALSE;
462 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)lfFaceName);
463 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0L, 0L);
464 if (di->font) HeapFree(GetProcessHeap(), 0, di->font);
468 EnumFontFamilies(PRIVATE(di->data)->hMemDC, lfFaceName, font_enum_size, (LPARAM)di);
474 for (idx = 0; idx < di->nFont; idx++)
476 if (!lstrcmp(di->font[idx].faceName, di->config.face_name) &&
477 di->font[idx].height == di->config.cell_height &&
478 di->font[idx].weight == di->config.font_weight)
480 if (ref == -1) ref = idx;
481 else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx);
484 idx = (ref == -1) ? 0 : ref;
488 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0L);
493 /******************************************************************
498 static BOOL fill_list_font(struct dialog_info* di)
500 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0L, 0L);
501 EnumFontFamilies(PRIVATE(di->data)->hMemDC, NULL, font_enum, (LPARAM)di);
502 if (SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SELECTSTRING,
503 (WPARAM)-1, (LPARAM)di->config.face_name) == LB_ERR)
504 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0L, 0L);
505 fill_list_size(di, TRUE);
509 /******************************************************************
512 * Dialog proc for the Font property sheet
514 static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
516 struct dialog_info* di;
521 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
523 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
524 /* remove dialog from this control, font will be reset when listboxes are filled */
525 SendDlgItemMessage(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0L, 0L);
527 SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config.def_attr >> 4) & 0x0F);
528 SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F);
531 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
532 switch (LOWORD(wParam))
534 case IDC_FNT_LIST_FONT:
535 if (HIWORD(wParam) == LBN_SELCHANGE)
537 fill_list_size(di, FALSE);
540 case IDC_FNT_LIST_SIZE:
541 if (HIWORD(wParam) == LBN_SELCHANGE)
550 NMHDR* nmhdr = (NMHDR*)lParam;
553 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
560 val = SendDlgItemMessage(hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
566 WCUSER_FillLogFont(&lf, di->font[val].faceName,
567 di->font[val].height, di->font[val].weight);
568 DeleteObject(WCUSER_CopyFont(&di->config,
569 PRIVATE(di->data)->hWnd, &lf));
572 val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |
573 GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0);
574 di->config.def_attr = val;
576 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
589 /******************************************************************
590 * WCUSER_ConfigDlgProc
592 * Dialog proc for the config property sheet
594 static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
596 struct dialog_info* di;
601 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
603 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
604 SetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, di->config.sb_width, FALSE);
605 SetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, di->config.sb_height, FALSE);
606 SetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, di->config.win_width, FALSE);
607 SetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, di->config.win_height, FALSE);
608 SendDlgItemMessage(hDlg, IDC_CNF_CLOSE_EXIT, BM_SETCHECK,
609 (di->config.exit_on_die) ? BST_CHECKED : BST_UNCHECKED, 0L);
611 static WCHAR s1[] = {'W','i','n','3','2',0};
612 static WCHAR s2[] = {'E','m','a','c','s',0};
614 SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING,
616 SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING,
618 SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_SETCURSEL,
619 di->config.edition_mode, 0);
624 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
625 switch (LOWORD(wParam))
631 NMHDR* nmhdr = (NMHDR*)lParam;
632 int win_w, win_h, sb_w, sb_h;
635 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
642 sb_w = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, &st1, FALSE);
643 sb_h = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE);
646 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
649 win_w = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, &st1, FALSE);
650 win_h = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE);
653 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
656 if (win_w > sb_w || win_h > sb_h)
661 LoadString(GetModuleHandle(NULL), IDS_DLG_TIT_ERROR,
662 cap, sizeof(cap) / sizeof(WCHAR));
663 LoadString(GetModuleHandle(NULL), IDS_DLG_ERR_SBWINSIZE,
664 txt, sizeof(txt) / sizeof(WCHAR));
666 MessageBox(hDlg, txt, cap, MB_OK);
667 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
670 di->config.win_width = win_w;
671 di->config.win_height = win_h;
672 di->config.sb_width = sb_w;
673 di->config.sb_height = sb_h;
675 di->config.exit_on_die = IsDlgButtonChecked(hDlg, IDC_CNF_CLOSE_EXIT) ? 1 : 0;
676 di->config.edition_mode = SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_GETCURSEL,
678 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
691 /******************************************************************
694 * Dialog Procedure for choosing how to handle modification to the
697 static BOOL WINAPI WCUSER_SaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
704 switch (LOWORD(wParam))
708 (IsDlgButtonChecked(hDlg, IDC_SAV_SAVE) == BST_CHECKED) ?
709 IDC_SAV_SAVE : IDC_SAV_SESSION);
712 EndDialog(hDlg, IDCANCEL); break;
721 /******************************************************************
722 * WCUSER_GetProperties
724 * Runs the dialog box to set up the wineconsole options
726 BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
728 HPROPSHEETPAGE psPage[3];
730 PROPSHEETHEADER psHead;
733 static const WCHAR szFntPreview[] = {'W','i','n','e','C','o','n','F','o','n','t','P','r','e','v','i','e','w',0};
734 static const WCHAR szColorPreview[] = {'W','i','n','e','C','o','n','C','o','l','o','r','P','r','e','v','i','e','w',0};
735 struct dialog_info di;
736 struct config_data defcfg;
737 struct config_data* refcfg;
738 BOOL save, modify_session;
740 InitCommonControls();
745 refcfg = &data->curcfg;
750 WINECON_RegLoad(NULL, refcfg = &defcfg);
757 modify_session = FALSE;
760 wndclass.lpfnWndProc = WCUSER_FontPreviewProc;
761 wndclass.cbClsExtra = 0;
762 wndclass.cbWndExtra = 4; /* for hFont */
763 wndclass.hInstance = GetModuleHandle(NULL);
765 wndclass.hCursor = LoadCursor(0, IDC_ARROW);
766 wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
767 wndclass.lpszMenuName = NULL;
768 wndclass.lpszClassName = szFntPreview;
769 RegisterClass(&wndclass);
772 wndclass.lpfnWndProc = WCUSER_ColorPreviewProc;
773 wndclass.cbClsExtra = 0;
774 wndclass.cbWndExtra = sizeof(DWORD);
775 wndclass.hInstance = GetModuleHandle(NULL);
777 wndclass.hCursor = LoadCursor(0, IDC_ARROW);
778 wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
779 wndclass.lpszMenuName = NULL;
780 wndclass.lpszClassName = szColorPreview;
781 RegisterClass(&wndclass);
783 memset(&psp, 0, sizeof(psp));
784 psp.dwSize = sizeof(psp);
786 psp.hInstance = wndclass.hInstance;
787 psp.lParam = (LPARAM)&di;
789 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_OPTION);
790 psp.pfnDlgProc = WCUSER_OptionDlgProc;
791 psPage[0] = CreatePropertySheetPage(&psp);
793 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_FONT);
794 psp.pfnDlgProc = WCUSER_FontDlgProc;
795 psPage[1] = CreatePropertySheetPage(&psp);
797 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
798 psp.pfnDlgProc = WCUSER_ConfigDlgProc;
799 psPage[2] = CreatePropertySheetPage(&psp);
801 memset(&psHead, 0, sizeof(psHead));
802 psHead.dwSize = sizeof(psHead);
804 if (!LoadString(GetModuleHandle(NULL),
805 (current) ? IDS_DLG_TIT_CURRENT : IDS_DLG_TIT_DEFAULT,
806 buff, sizeof(buff) / sizeof(buff[0])))
816 psHead.pszCaption = buff;
818 psHead.hwndParent = PRIVATE(data)->hWnd;
819 psHead.u3.phpage = psPage;
821 WINECON_DumpConfig("init", refcfg);
823 PropertySheet(&psHead);
825 if (memcmp(refcfg, &di.config, sizeof(*refcfg)) == 0)
828 WINECON_DumpConfig("ref", refcfg);
829 WINECON_DumpConfig("cur", &di.config);
830 if (refcfg == &data->curcfg)
832 switch (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVE_SETTINGS),
833 PRIVATE(data)->hWnd, WCUSER_SaveDlgProc))
835 case IDC_SAV_SAVE: save = TRUE; modify_session = TRUE; break;
836 case IDC_SAV_SESSION: modify_session = TRUE; break;
837 case IDCANCEL: break;
838 default: WINE_ERR("ooch\n");
842 if (modify_session) WINECON_SetConfig(data, &di.config, FALSE);
843 if (save) WINECON_RegSave(&di.config);