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
23 #define NONAMELESSUNION
24 #define NONAMELESSSTRUCT
27 #include "winecon_user.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
35 struct config_data config; /* configuration used for dialog box */
36 struct inner_data* data; /* pointer to current winecon info */
37 HWND hDlg; /* handle to active propsheet */
38 int nFont; /* number of font size in size LB */
43 WCHAR faceName[LF_FACESIZE];
44 } *font; /* array of nFont. index sync'ed with SIZE LB */
47 /******************************************************************
48 * WCUSER_OptionDlgProc
50 * Dialog prop for the option property sheet
52 static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
54 struct dialog_info* di;
60 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
62 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
64 if (di->config.cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL;
65 else if (di->config.cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM;
66 else idc = IDC_OPT_CURSOR_LARGE;
67 SendDlgItemMessage(hDlg, idc, BM_SETCHECK, BST_CHECKED, 0L);
68 SetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, WINECON_GetHistorySize(di->data->hConIn), FALSE);
69 SendDlgItemMessage(hDlg, IDC_OPT_HIST_NODOUBLE, BM_SETCHECK,
70 (di->config.history_nodup) ? BST_CHECKED : BST_UNCHECKED, 0L);
71 SendDlgItemMessage(hDlg, IDC_OPT_CONF_CTRL, BM_SETCHECK,
72 (di->config.menu_mask & MK_CONTROL) ? BST_CHECKED : BST_UNCHECKED, 0L);
73 SendDlgItemMessage(hDlg, IDC_OPT_CONF_SHIFT, BM_SETCHECK,
74 (di->config.menu_mask & MK_SHIFT) ? BST_CHECKED : BST_UNCHECKED, 0L);
75 SendDlgItemMessage(hDlg, IDC_OPT_QUICK_EDIT, BM_SETCHECK,
76 (di->config.quick_edit) ? BST_CHECKED : BST_UNCHECKED, 0L);
77 return FALSE; /* because we set the focus */
82 NMHDR* nmhdr = (NMHDR*)lParam;
86 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
91 /* needed in propsheet to keep properly the selected radio button
92 * otherwise, the focus would be set to the first tab stop in the
93 * propsheet, which would always activate the first radio button
95 if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED)
96 idc = IDC_OPT_CURSOR_SMALL;
97 else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED)
98 idc = IDC_OPT_CURSOR_MEDIUM;
100 idc = IDC_OPT_CURSOR_LARGE;
101 PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, idc), TRUE);
105 if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED) val = 25;
106 else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED) val = 50;
108 di->config.cursor_size = val;
110 val = GetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, &done, FALSE);
111 if (done) di->config.history_size = val;
113 val = (IsDlgButtonChecked(hDlg, IDC_OPT_HIST_NODOUBLE) & BST_CHECKED) ? TRUE : FALSE;
114 di->config.history_nodup = val;
117 if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_CTRL) & BST_CHECKED) val |= MK_CONTROL;
118 if (IsDlgButtonChecked(hDlg, IDC_OPT_CONF_SHIFT) & BST_CHECKED) val |= MK_SHIFT;
119 di->config.menu_mask = val;
121 val = (IsDlgButtonChecked(hDlg, IDC_OPT_QUICK_EDIT) & BST_CHECKED) ? TRUE : FALSE;
122 di->config.quick_edit = val;
124 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
137 /******************************************************************
138 * WCUSER_FontPreviewProc
140 * Window proc for font previewer in font property sheet
142 static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
147 SetWindowLong(hWnd, 0, 0);
150 return GetWindowLong(hWnd, 0);
152 SetWindowLong(hWnd, 0, wParam);
155 InvalidateRect(hWnd, NULL, TRUE);
161 HFONT hFont = (HFONT)GetWindowLong(hWnd, 0L);
162 if (hFont) DeleteObject(hFont);
170 struct dialog_info* di;
171 HFONT hFont, hOldFont;
173 di = (struct dialog_info*)GetWindowLong(GetParent(hWnd), DWL_USER);
174 BeginPaint(hWnd, &ps);
176 font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
177 size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
179 hFont = (HFONT)GetWindowLong(hWnd, 0L);
186 len1 = LoadString(GetModuleHandle(NULL), IDS_FNT_PREVIEW_1,
187 buf1, sizeof(buf1) / sizeof(WCHAR));
188 len2 = LoadString(GetModuleHandle(NULL), IDS_FNT_PREVIEW_2,
189 buf2, sizeof(buf2) / sizeof(WCHAR));
190 buf1[len1] = buf2[len2] = 0;
193 hOldFont = SelectObject(ps.hdc, hFont);
194 SetBkColor(ps.hdc, WCUSER_ColorMap[GetWindowLong(GetDlgItem(di->hDlg, IDC_FNT_COLOR_BK), 0)]);
195 SetTextColor(ps.hdc, WCUSER_ColorMap[GetWindowLong(GetDlgItem(di->hDlg, IDC_FNT_COLOR_FG), 0)]);
196 TextOut(ps.hdc, 0, 0, buf1, len1);
198 TextOut(ps.hdc, 0, di->font[size_idx].height, buf2, len2);
199 SelectObject(ps.hdc, hOldFont);
206 return DefWindowProc(hWnd, msg, wParam, lParam);
211 /******************************************************************
212 * WCUSER_ColorPreviewProc
214 * Window proc for color previewer in font property sheet
216 static LRESULT WINAPI WCUSER_ColorPreviewProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
227 BeginPaint(hWnd, &ps);
228 GetClientRect(hWnd, &client);
229 step = client.right / 8;
231 for (i = 0; i < 16; i++)
233 r.top = (i / 8) * (client.bottom / 2);
234 r.bottom = r.top + client.bottom / 2;
235 r.left = (i & 7) * step;
236 r.right = r.left + step;
237 hbr = CreateSolidBrush(WCUSER_ColorMap[i]);
238 FillRect(ps.hdc, &r, hbr);
240 if (GetWindowLong(hWnd, 0) == i)
245 hOldPen = SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
246 r.right--; r.bottom--;
249 MoveToEx(ps.hdc, r.left, r.bottom, NULL);
250 LineTo(ps.hdc, r.left, r.top);
251 LineTo(ps.hdc, r.right, r.top);
252 SelectObject(ps.hdc, GetStockObject(BLACK_PEN));
253 LineTo(ps.hdc, r.right, r.bottom);
254 LineTo(ps.hdc, r.left, r.bottom);
257 r.left++; r.top++; r.right--; r.bottom--;
258 SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
260 SelectObject(ps.hdc, hOldPen);
271 GetClientRect(hWnd, &client);
272 step = client.right / 8;
273 i = (HIWORD(lParam) >= client.bottom / 2) ? 8 : 0;
274 i += LOWORD(lParam) / step;
275 SetWindowLong(hWnd, 0, i);
276 InvalidateRect(GetDlgItem(GetParent(hWnd), IDC_FNT_PREVIEW), NULL, FALSE);
277 InvalidateRect(hWnd, NULL, FALSE);
281 return DefWindowProc(hWnd, msg, wParam, lParam);
286 /******************************************************************
289 * enumerates all the font names with at least one valid font
291 static int CALLBACK font_enum_size2(const LOGFONT* lf, const TEXTMETRIC* tm,
292 DWORD FontType, LPARAM lParam)
294 struct dialog_info* di = (struct dialog_info*)lParam;
296 WCUSER_DumpTextMetric(tm, FontType);
297 if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
305 static int CALLBACK font_enum(const LOGFONT* lf, const TEXTMETRIC* tm,
306 DWORD FontType, LPARAM lParam)
308 struct dialog_info* di = (struct dialog_info*)lParam;
310 WCUSER_DumpLogFont("DlgFamily: ", lf, FontType);
311 if (WCUSER_ValidateFont(di->data, lf))
313 if (FontType & RASTER_FONTTYPE)
316 EnumFontFamilies(PRIVATE(di->data)->hMemDC, lf->lfFaceName, font_enum_size2, (LPARAM)di);
323 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_ADDSTRING,
324 0, (LPARAM)lf->lfFaceName);
331 /******************************************************************
336 static int CALLBACK font_enum_size(const LOGFONT* lf, const TEXTMETRIC* tm,
337 DWORD FontType, LPARAM lParam)
339 struct dialog_info* di = (struct dialog_info*)lParam;
341 static const WCHAR fmt[] = {'%','l','d',0};
343 WCUSER_DumpTextMetric(tm, FontType);
344 if (di->nFont == 0 && !(FontType & RASTER_FONTTYPE))
346 static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
349 di->nFont = sizeof(sizes) / sizeof(sizes[0]);
350 di->font = HeapAlloc(GetProcessHeap(), 0, di->nFont * sizeof(di->font[0]));
351 for (i = 0; i < di->nFont; i++)
353 /* drop sizes where window size wouldn't fit on screen */
354 if (sizes[i] * di->data->curcfg.win_height > GetSystemMetrics(SM_CYSCREEN))
359 di->font[i].height = sizes[i];
360 di->font[i].weight = 400;
361 lstrcpy(di->font[i].faceName, lf->lfFaceName);
362 wsprintf(buf, fmt, sizes[i]);
363 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, i, (LPARAM)buf);
365 /* don't need to enumerate other */
369 if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
373 /* we want the string to be sorted with a numeric order, not a lexicographic...
374 * do the job by hand... get where to insert the new string
376 for (idx = 0; idx < di->nFont && tm->tmHeight > di->font[idx].height; idx++);
377 while (idx < di->nFont &&
378 tm->tmHeight == di->font[idx].height &&
379 tm->tmWeight > di->font[idx].weight)
381 if (idx == di->nFont ||
382 tm->tmHeight != di->font[idx].height ||
383 tm->tmWeight < di->font[idx].weight)
385 /* here we need to add the new entry */
386 wsprintf(buf, fmt, tm->tmHeight);
387 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf);
389 /* now grow our arrays and insert the values at the same index than in the list box */
390 di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1));
391 if (idx != di->nFont)
392 memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font));
393 di->font[idx].height = tm->tmHeight;
394 di->font[idx].weight = tm->tmWeight;
395 lstrcpy(di->font[idx].faceName, lf->lfFaceName);
402 /******************************************************************
407 static BOOL select_font(struct dialog_info* di)
409 int font_idx, size_idx;
413 HFONT hFont, hOldFont;
414 struct config_data config;
416 font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
417 size_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
419 if (font_idx < 0 || size_idx < 0 || size_idx >= di->nFont)
422 WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
423 di->font[size_idx].height, di->font[size_idx].weight);
424 hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf);
425 if (!hFont) return FALSE;
427 if (config.cell_height != di->font[size_idx].height)
428 WINE_TRACE("mismatched heights (%u<>%u)\n",
429 config.cell_height, di->font[size_idx].height);
430 hOldFont = (HFONT)SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_GETFONT, 0L, 0L);
432 SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_SETFONT, (DWORD)hFont, TRUE);
433 if (hOldFont) DeleteObject(hOldFont);
435 LoadString(GetModuleHandle(NULL), IDS_FNT_DISPLAY, fmt, sizeof(fmt) / sizeof(WCHAR));
436 wsprintf(buf, fmt, config.cell_width, config.cell_height);
438 SendDlgItemMessage(di->hDlg, IDC_FNT_FONT_INFO, WM_SETTEXT, 0, (LPARAM)buf);
443 /******************************************************************
446 * fills the size list box according to selected family in font LB
448 static BOOL fill_list_size(struct dialog_info* di, BOOL doInit)
451 WCHAR lfFaceName[LF_FACESIZE];
453 idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
454 if (idx < 0) return FALSE;
456 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)lfFaceName);
457 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0L, 0L);
458 if (di->font) HeapFree(GetProcessHeap(), 0, di->font);
462 EnumFontFamilies(PRIVATE(di->data)->hMemDC, lfFaceName, font_enum_size, (LPARAM)di);
468 for (idx = 0; idx < di->nFont; idx++)
470 if (!lstrcmp(di->font[idx].faceName, di->config.face_name) &&
471 di->font[idx].height == di->config.cell_height &&
472 di->font[idx].weight == di->config.font_weight)
474 if (ref == -1) ref = idx;
475 else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx);
478 idx = (ref == -1) ? 0 : ref;
482 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0L);
487 /******************************************************************
492 static BOOL fill_list_font(struct dialog_info* di)
494 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0L, 0L);
495 EnumFontFamilies(PRIVATE(di->data)->hMemDC, NULL, font_enum, (LPARAM)di);
496 if (SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SELECTSTRING,
497 (WPARAM)-1, (LPARAM)di->config.face_name) == LB_ERR)
498 SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0L, 0L);
499 fill_list_size(di, TRUE);
503 /******************************************************************
506 * Dialog proc for the Font property sheet
508 static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
510 struct dialog_info* di;
515 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
517 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
518 /* remove dialog from this control, font will be reset when listboxes are filled */
519 SendDlgItemMessage(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0L, 0L);
521 SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config.def_attr >> 4) & 0x0F);
522 SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F);
525 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
526 switch (LOWORD(wParam))
528 case IDC_FNT_LIST_FONT:
529 if (HIWORD(wParam) == LBN_SELCHANGE)
531 fill_list_size(di, FALSE);
534 case IDC_FNT_LIST_SIZE:
535 if (HIWORD(wParam) == LBN_SELCHANGE)
544 NMHDR* nmhdr = (NMHDR*)lParam;
547 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
554 val = SendDlgItemMessage(hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L);
560 WCUSER_FillLogFont(&lf, di->font[val].faceName,
561 di->font[val].height, di->font[val].weight);
562 DeleteObject(WCUSER_CopyFont(&di->config,
563 PRIVATE(di->data)->hWnd, &lf));
566 val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |
567 GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0);
568 di->config.def_attr = val;
570 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
583 /******************************************************************
584 * WCUSER_ConfigDlgProc
586 * Dialog proc for the config property sheet
588 static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
590 struct dialog_info* di;
595 di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
597 SetWindowLong(hDlg, DWL_USER, (DWORD)di);
598 SetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, di->config.sb_width, FALSE);
599 SetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, di->config.sb_height, FALSE);
600 SetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, di->config.win_width, FALSE);
601 SetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, di->config.win_height, FALSE);
602 SendDlgItemMessage(hDlg, IDC_CNF_CLOSE_EXIT, BM_SETCHECK,
603 (di->config.exit_on_die) ? BST_CHECKED : BST_UNCHECKED, 0L);
605 static WCHAR s1[] = {'W','i','n','3','2',0};
606 static WCHAR s2[] = {'E','m','a','c','s',0};
608 SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING,
610 SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING,
612 SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_SETCURSEL,
613 di->config.edition_mode, 0);
618 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
619 switch (LOWORD(wParam))
625 NMHDR* nmhdr = (NMHDR*)lParam;
626 int win_w, win_h, sb_w, sb_h;
629 di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
636 sb_w = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, &st1, FALSE);
637 sb_h = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE);
640 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
643 win_w = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, &st1, FALSE);
644 win_h = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE);
647 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
650 if (win_w > sb_w || win_h > sb_h)
655 LoadString(GetModuleHandle(NULL), IDS_DLG_TIT_ERROR,
656 cap, sizeof(cap) / sizeof(WCHAR));
657 LoadString(GetModuleHandle(NULL), IDS_DLG_ERR_SBWINSIZE,
658 txt, sizeof(txt) / sizeof(WCHAR));
660 MessageBox(hDlg, txt, cap, MB_OK);
661 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_INVALID);
664 di->config.win_width = win_w;
665 di->config.win_height = win_h;
666 di->config.sb_width = sb_w;
667 di->config.sb_height = sb_h;
669 di->config.exit_on_die = IsDlgButtonChecked(hDlg, IDC_CNF_CLOSE_EXIT) ? 1 : 0;
670 di->config.edition_mode = SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_GETCURSEL,
672 SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
685 /******************************************************************
688 * Dialog Procedure for choosing how to handle modification to the
691 static BOOL WINAPI WCUSER_SaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
698 switch (LOWORD(wParam))
702 (IsDlgButtonChecked(hDlg, IDC_SAV_SAVE) == BST_CHECKED) ?
703 IDC_SAV_SAVE : IDC_SAV_SESSION);
706 EndDialog(hDlg, IDCANCEL); break;
715 /******************************************************************
716 * WCUSER_GetProperties
718 * Runs the dialog box to set up the wineconsole options
720 BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
722 HPROPSHEETPAGE psPage[3];
724 PROPSHEETHEADER psHead;
727 static const WCHAR szFntPreview[] = {'W','i','n','e','C','o','n','F','o','n','t','P','r','e','v','i','e','w',0};
728 static const WCHAR szColorPreview[] = {'W','i','n','e','C','o','n','C','o','l','o','r','P','r','e','v','i','e','w',0};
729 struct dialog_info di;
730 struct config_data defcfg;
731 struct config_data* refcfg;
732 BOOL save, modify_session;
734 InitCommonControls();
739 refcfg = &data->curcfg;
744 WINECON_RegLoad(NULL, refcfg = &defcfg);
751 modify_session = FALSE;
754 wndclass.lpfnWndProc = WCUSER_FontPreviewProc;
755 wndclass.cbClsExtra = 0;
756 wndclass.cbWndExtra = 4; /* for hFont */
757 wndclass.hInstance = GetModuleHandle(NULL);
759 wndclass.hCursor = LoadCursor(0, IDC_ARROW);
760 wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
761 wndclass.lpszMenuName = NULL;
762 wndclass.lpszClassName = szFntPreview;
763 RegisterClass(&wndclass);
766 wndclass.lpfnWndProc = WCUSER_ColorPreviewProc;
767 wndclass.cbClsExtra = 0;
768 wndclass.cbWndExtra = sizeof(DWORD);
769 wndclass.hInstance = GetModuleHandle(NULL);
771 wndclass.hCursor = LoadCursor(0, IDC_ARROW);
772 wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
773 wndclass.lpszMenuName = NULL;
774 wndclass.lpszClassName = szColorPreview;
775 RegisterClass(&wndclass);
777 memset(&psp, 0, sizeof(psp));
778 psp.dwSize = sizeof(psp);
780 psp.hInstance = wndclass.hInstance;
781 psp.lParam = (LPARAM)&di;
783 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_OPTION);
784 psp.pfnDlgProc = WCUSER_OptionDlgProc;
785 psPage[0] = CreatePropertySheetPage(&psp);
787 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_FONT);
788 psp.pfnDlgProc = WCUSER_FontDlgProc;
789 psPage[1] = CreatePropertySheetPage(&psp);
791 psp.u.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
792 psp.pfnDlgProc = WCUSER_ConfigDlgProc;
793 psPage[2] = CreatePropertySheetPage(&psp);
795 memset(&psHead, 0, sizeof(psHead));
796 psHead.dwSize = sizeof(psHead);
798 if (!LoadString(GetModuleHandle(NULL),
799 (current) ? IDS_DLG_TIT_CURRENT : IDS_DLG_TIT_DEFAULT,
800 buff, sizeof(buff) / sizeof(buff[0])))
810 psHead.pszCaption = buff;
812 psHead.hwndParent = PRIVATE(data)->hWnd;
813 psHead.u3.phpage = psPage;
815 WINECON_DumpConfig("init", refcfg);
817 PropertySheet(&psHead);
819 if (memcmp(refcfg, &di.config, sizeof(*refcfg)) == 0)
822 WINECON_DumpConfig("ref", refcfg);
823 WINECON_DumpConfig("cur", &di.config);
824 if (refcfg == &data->curcfg)
826 switch (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVE_SETTINGS),
827 PRIVATE(data)->hWnd, WCUSER_SaveDlgProc))
829 case IDC_SAV_SAVE: save = TRUE; modify_session = TRUE; break;
830 case IDC_SAV_SESSION: modify_session = TRUE; break;
831 case IDCANCEL: break;
832 default: WINE_ERR("ooch\n");
836 if (modify_session) WINECON_SetConfig(data, &di.config, FALSE);
837 if (save) WINECON_RegSave(&di.config);