From 0589f7266df4f1d679063550ba00771c5c0a37f1 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 4 Sep 2002 18:41:52 +0000 Subject: [PATCH] Added configuration on per application basis. Added ability to override part of the configuration from console creator. Revisited a bit wineconsole startup. Added dialog part for window closing at process termination. --- programs/wineconsole/dialog.c | 270 ++++++++++++++------------------- programs/wineconsole/registry.c | 214 +++++++++++++++++++------- programs/wineconsole/user.c | 81 +++++----- programs/wineconsole/winecon_private.h | 16 +- programs/wineconsole/winecon_user.h | 1 - programs/wineconsole/wineconsole.c | 193 ++++++++++++++++++----- programs/wineconsole/wineconsole_De.rc | 30 +++- programs/wineconsole/wineconsole_En.rc | 30 +++- programs/wineconsole/wineconsole_Fr.rc | 30 +++- programs/wineconsole/wineconsole_res.h | 10 +- 10 files changed, 556 insertions(+), 319 deletions(-) diff --git a/programs/wineconsole/dialog.c b/programs/wineconsole/dialog.c index b3d5e5d48be..d41b74b885c 100644 --- a/programs/wineconsole/dialog.c +++ b/programs/wineconsole/dialog.c @@ -1,6 +1,6 @@ /* dialog management for wineconsole * USER32 backend - * Copyright (c) 2001 Eric Pouech + * Copyright (c) 2001, 2002 Eric Pouech * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,20 +27,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(wineconsole); -enum WCUSER_ApplyTo { - /* Prop sheet CFG */ - WCUSER_ApplyToCursorSize, - WCUSER_ApplyToHistorySize, WCUSER_ApplyToHistoryMode, WCUSER_ApplyToMenuMask, - WCUSER_ApplyToEditMode, - /* Prop sheet FNT */ - WCUSER_ApplyToFont, WCUSER_ApplyToAttribute, - /* Prop sheep CNF */ - WCUSER_ApplyToBufferSize, WCUSER_ApplyToWindow -}; - struct dialog_info { - struct config_data* config; /* pointer to configuration used for dialog box */ + struct config_data config; /* configuration used for dialog box */ struct inner_data* data; /* pointer to current winecon info */ HWND hDlg; /* handle to active propsheet */ int nFont; /* number of font size in size LB */ @@ -50,104 +39,9 @@ struct dialog_info UINT weight; WCHAR faceName[LF_FACESIZE]; } *font; /* array of nFont. index sync'ed with SIZE LB */ - void (*apply)(struct dialog_info*, HWND, enum WCUSER_ApplyTo, DWORD); }; /****************************************************************** - * WCUSER_ApplyDefault - * - * - */ -static void WCUSER_ApplyDefault(struct dialog_info* di, HWND hDlg, enum WCUSER_ApplyTo apply, DWORD val) -{ - switch (apply) - { - case WCUSER_ApplyToCursorSize: - case WCUSER_ApplyToHistorySize: - case WCUSER_ApplyToHistoryMode: - case WCUSER_ApplyToBufferSize: - case WCUSER_ApplyToWindow: - /* not saving those for now... */ - break; - case WCUSER_ApplyToMenuMask: - di->config->menu_mask = val; - break; - case WCUSER_ApplyToEditMode: - di->config->quick_edit = val; - break; - case WCUSER_ApplyToFont: - { - LOGFONT lf; - HFONT hFont; - - WCUSER_FillLogFont(&lf, di->font[val].faceName, - di->font[val].height, di->font[val].weight); - hFont = WCUSER_CopyFont(di->config, PRIVATE(di->data)->hWnd, &lf); - DeleteObject(hFont); - } - break; - case WCUSER_ApplyToAttribute: - di->config->def_attr = val; - break; - } - WINECON_RegSave(di->config); -} - -/****************************************************************** - * WCUSER_ApplyCurrent - * - * - */ -static void WCUSER_ApplyCurrent(struct dialog_info* di, HWND hDlg, enum WCUSER_ApplyTo apply, DWORD val) -{ - switch (apply) - { - case WCUSER_ApplyToCursorSize: - { - CONSOLE_CURSOR_INFO cinfo; - cinfo.dwSize = val; - cinfo.bVisible = di->config->cursor_visible; - /* this shall update (through notif) curcfg */ - SetConsoleCursorInfo(di->data->hConOut, &cinfo); - } - break; - case WCUSER_ApplyToHistorySize: - di->config->history_size = val; - WINECON_SetHistorySize(di->data->hConIn, val); - break; - case WCUSER_ApplyToHistoryMode: - WINECON_SetHistoryMode(di->data->hConIn, val); - break; - case WCUSER_ApplyToMenuMask: - di->config->menu_mask = val; - break; - case WCUSER_ApplyToEditMode: - di->config->quick_edit = val; - break; - case WCUSER_ApplyToFont: - { - LOGFONT lf; - WCUSER_FillLogFont(&lf, di->font[val].faceName, - di->font[val].height, di->font[val].weight); - WCUSER_SetFont(di->data, &lf); - } - break; - case WCUSER_ApplyToAttribute: - di->config->def_attr = val; - SetConsoleTextAttribute(di->data->hConOut, val); - break; - case WCUSER_ApplyToBufferSize: - /* this shall update (through notif) curcfg */ - SetConsoleScreenBufferSize(di->data->hConOut, *(COORD*)val); - break; - case WCUSER_ApplyToWindow: - /* this shall update (through notif) curcfg */ - SetConsoleWindowInfo(di->data->hConOut, FALSE, (SMALL_RECT*)val); - break; - } -} - -/****************************************************************** * WCUSER_OptionDlgProc * * Dialog prop for the option property sheet @@ -164,19 +58,19 @@ static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR di->hDlg = hDlg; SetWindowLong(hDlg, DWL_USER, (DWORD)di); - if (di->config->cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL; - else if (di->config->cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM; + if (di->config.cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL; + else if (di->config.cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM; else idc = IDC_OPT_CURSOR_LARGE; SendDlgItemMessage(hDlg, idc, BM_SETCHECK, BST_CHECKED, 0L); SetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, WINECON_GetHistorySize(di->data->hConIn), FALSE); - if (WINECON_GetHistoryMode(di->data->hConIn)) - SendDlgItemMessage(hDlg, IDC_OPT_HIST_DOUBLE, BM_SETCHECK, BST_CHECKED, 0L); + SendDlgItemMessage(hDlg, IDC_OPT_HIST_NODOUBLE, BM_SETCHECK, + (di->config.history_nodup) ? BST_CHECKED : BST_UNCHECKED, 0L); SendDlgItemMessage(hDlg, IDC_OPT_CONF_CTRL, BM_SETCHECK, - (di->config->menu_mask & MK_CONTROL) ? BST_CHECKED : BST_UNCHECKED, 0L); + (di->config.menu_mask & MK_CONTROL) ? BST_CHECKED : BST_UNCHECKED, 0L); SendDlgItemMessage(hDlg, IDC_OPT_CONF_SHIFT, BM_SETCHECK, - (di->config->menu_mask & MK_SHIFT) ? BST_CHECKED : BST_UNCHECKED, 0L); + (di->config.menu_mask & MK_SHIFT) ? BST_CHECKED : BST_UNCHECKED, 0L); SendDlgItemMessage(hDlg, IDC_OPT_QUICK_EDIT, BM_SETCHECK, - (di->config->quick_edit) ? BST_CHECKED : BST_UNCHECKED, 0L); + (di->config.quick_edit) ? BST_CHECKED : BST_UNCHECKED, 0L); return FALSE; /* because we set the focus */ case WM_COMMAND: break; @@ -207,22 +101,22 @@ static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR case PSN_APPLY: if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_SMALL) == BST_CHECKED) val = 25; else if (IsDlgButtonChecked(hDlg, IDC_OPT_CURSOR_MEDIUM) == BST_CHECKED) val = 50; - else val = 99; - (di->apply)(di, hDlg, WCUSER_ApplyToCursorSize, val); + else val = 100; + di->config.cursor_size = val; val = GetDlgItemInt(hDlg, IDC_OPT_HIST_SIZE, &done, FALSE); - if (done) (di->apply)(di, hDlg, WCUSER_ApplyToHistorySize, val); + if (done) di->config.history_size = val; - (di->apply)(di, hDlg, WCUSER_ApplyToHistoryMode, - IsDlgButtonChecked(hDlg, IDC_OPT_HIST_DOUBLE) & BST_CHECKED); + val = (IsDlgButtonChecked(hDlg, IDC_OPT_HIST_NODOUBLE) & BST_CHECKED) ? TRUE : FALSE; + di->config.history_nodup = val; 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; - (di->apply)(di, hDlg, WCUSER_ApplyToMenuMask, val); + di->config.menu_mask = val; val = (IsDlgButtonChecked(hDlg, IDC_OPT_QUICK_EDIT) & BST_CHECKED) ? TRUE : FALSE; - (di->apply)(di, hDlg, WCUSER_ApplyToEditMode, val); + di->config.quick_edit = val; SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; @@ -570,9 +464,9 @@ static BOOL fill_list_size(struct dialog_info* di, BOOL doInit) for (idx = 0; idx < di->nFont; idx++) { - if (!lstrcmp(di->font[idx].faceName, di->config->face_name) && - di->font[idx].height == di->config->cell_height && - di->font[idx].weight == di->config->font_weight) + if (!lstrcmp(di->font[idx].faceName, di->config.face_name) && + di->font[idx].height == di->config.cell_height && + di->font[idx].weight == di->config.font_weight) { if (ref == -1) ref = idx; else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx); @@ -597,7 +491,7 @@ static BOOL fill_list_font(struct dialog_info* di) SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0L, 0L); EnumFontFamilies(PRIVATE(di->data)->hMemDC, NULL, font_enum, (LPARAM)di); if (SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SELECTSTRING, - (WPARAM)-1, (LPARAM)di->config->face_name) == LB_ERR) + (WPARAM)-1, (LPARAM)di->config.face_name) == LB_ERR) SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0L, 0L); fill_list_size(di, TRUE); return TRUE; @@ -621,8 +515,8 @@ static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM /* remove dialog from this control, font will be reset when listboxes are filled */ SendDlgItemMessage(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0L, 0L); fill_list_font(di); - SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config->def_attr >> 4) & 0x0F); - SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config->def_attr & 0x0F); + SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0, (di->config.def_attr >> 4) & 0x0F); + SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F); break; case WM_COMMAND: di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER); @@ -656,11 +550,19 @@ static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: val = SendDlgItemMessage(hDlg, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0L, 0L); - if (val < di->nFont) (di->apply)(di, hDlg, WCUSER_ApplyToFont, val); + if (val < di->nFont) + { + LOGFONT lf; - (di->apply)(di, hDlg, WCUSER_ApplyToAttribute, - (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) | - GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0)); + WCUSER_FillLogFont(&lf, di->font[val].faceName, + di->font[val].height, di->font[val].weight); + DeleteObject(WCUSER_CopyFont(&di->config, + PRIVATE(di->data)->hWnd, &lf)); + } + + val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) | + GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0); + di->config.def_attr = val; SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; @@ -690,10 +592,12 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam; di->hDlg = hDlg; SetWindowLong(hDlg, DWL_USER, (DWORD)di); - 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); + 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); + SendDlgItemMessage(hDlg, IDC_CNF_CLOSE_EXIT, BM_SETCHECK, + (di->config.exit_on_die) ? BST_CHECKED : BST_UNCHECKED, 0L); break; case WM_COMMAND: di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER); @@ -704,9 +608,8 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_NOTIFY: { NMHDR* nmhdr = (NMHDR*)lParam; - COORD sb; - SMALL_RECT pos; - BOOL st_w, st_h; + int x, y; + BOOL st1, st2; di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER); switch (nmhdr->code) @@ -715,22 +618,23 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR di->hDlg = hDlg; break; case PSN_APPLY: - sb.X = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, &st_w, FALSE); - sb.Y = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st_h, FALSE); - if (st_w && st_h && (sb.X != di->config->sb_width || sb.Y != di->config->sb_height)) + x = GetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, &st1, FALSE); + y = GetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, &st2, FALSE); + if (st1 && st2) { - (di->apply)(di, hDlg, WCUSER_ApplyToBufferSize, (DWORD)&sb); + di->config.sb_width = x; + di->config.sb_height = y; } - pos.Right = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, &st_w, FALSE); - pos.Bottom = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st_h, FALSE); - if (st_w && st_h && - (pos.Right != di->config->win_width || pos.Bottom != di->config->win_height)) + x = GetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, &st1, FALSE); + y = GetDlgItemInt(hDlg, IDC_CNF_WIN_HEIGHT, &st2, FALSE); + if (st1 && st2) { - pos.Left = pos.Top = 0; - pos.Right--; pos.Bottom--; - (di->apply)(di, hDlg, WCUSER_ApplyToWindow, (DWORD)&pos); + di->config.win_width = x; + di->config.win_height = y; } + di->config.exit_on_die = IsDlgButtonChecked(hDlg, IDC_CNF_CLOSE_EXIT) ? 1 : 0; + SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; default: @@ -745,6 +649,36 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR } /****************************************************************** + * WCUSER_SaveDlgProc + * + * Dialog Procedure for choosing how to handle modification to the + * console settings. + */ +static BOOL WINAPI WCUSER_SaveDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + 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; +} + +/****************************************************************** * WCUSER_GetProperties * * Runs the dialog box to set up the wineconsole options @@ -759,23 +693,29 @@ BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current) 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}; struct dialog_info di; + struct config_data defcfg; + struct config_data* refcfg; + BOOL save, modify_session; InitCommonControls(); di.data = data; if (current) { - di.config = &data->curcfg; - di.apply = WCUSER_ApplyCurrent; + refcfg = &data->curcfg; + save = FALSE; } else { - di.config = &data->defcfg; - di.apply = WCUSER_ApplyDefault; + WINECON_RegLoad(NULL, refcfg = &defcfg); + save = TRUE; } + di.config = *refcfg; di.nFont = 0; di.font = NULL; + modify_session = FALSE; + wndclass.style = 0; wndclass.lpfnWndProc = WCUSER_FontPreviewProc; wndclass.cbClsExtra = 0; @@ -838,7 +778,29 @@ BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current) psHead.hwndParent = PRIVATE(data)->hWnd; psHead.u3.phpage = psPage; + WINECON_DumpConfig("init", refcfg); + PropertySheet(&psHead); + if (memcmp(refcfg, &di.config, sizeof(*refcfg)) == 0) + return TRUE; + + WINECON_DumpConfig("ref", refcfg); + WINECON_DumpConfig("cur", &di.config); + if (refcfg == &data->curcfg) + { + switch (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SAVE_SETTINGS), + PRIVATE(data)->hWnd, WCUSER_SaveDlgProc)) + { + 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"); + } + } + + if (modify_session) WINECON_SetConfig(data, &di.config, FALSE); + if (save) WINECON_RegSave(&di.config); + return TRUE; } diff --git a/programs/wineconsole/registry.c b/programs/wineconsole/registry.c index 53b69f8155c..4d650627b32 100644 --- a/programs/wineconsole/registry.c +++ b/programs/wineconsole/registry.c @@ -35,111 +35,177 @@ static const WCHAR wszFaceName[] = {'F','a','c','e','N','a','m','e',0}; static const WCHAR wszFontSize[] = {'F','o','n','t','S','i','z','e',0}; static const WCHAR wszFontWeight[] = {'F','o','n','t','W','e','i','g','h','t',0}; static const WCHAR wszHistoryBufferSize[] = {'H','i','s','t','o','r','y','B','u','f','f','e','r','S','i','z','e',0}; +static const WCHAR wszHistoryNoDup[] = {'H','i','s','t','o','r','y','N','o','D','u','p',0}; static const WCHAR wszMenuMask[] = {'M','e','n','u','M','a','s','k',0}; static const WCHAR wszQuickEdit[] = {'Q','u','i','c','k','E','d','i','t',0}; static const WCHAR wszScreenBufferSize[] = {'S','c','r','e','e','n','B','u','f','f','e','r','S','i','z','e',0}; static const WCHAR wszScreenColors[] = {'S','c','r','e','e','n','C','o','l','o','r','s',0}; static const WCHAR wszWindowSize[] = {'W','i','n','d','o','w','S','i','z','e',0}; +void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg) +{ + WINE_TRACE("%s cell=(%u,%u) cursor=(%d,%d) attr=%02lx font=%s/%lu hist=%lu/%d flags=%c%c msk=%08lx sb=(%u,%u) win=(%u,%u)x(%u,%u) registry=%s\n", + pfx, cfg->cell_width, cfg->cell_height, cfg->cursor_size, cfg->cursor_visible, cfg->def_attr, + wine_dbgstr_w(cfg->face_name), cfg->font_weight, cfg->history_size, cfg->history_nodup ? 1 : 2, + cfg->quick_edit ? 'Q' : 'q', cfg->exit_on_die ? 'X' : 'x', + cfg->menu_mask, cfg->sb_width, cfg->sb_height, cfg->win_pos.X, cfg->win_pos.Y, cfg->win_width, cfg->win_height, + wine_dbgstr_w(cfg->registry)); +} + /****************************************************************** - * WINECON_RegLoad + * WINECON_CreateKeyName * + * Get a proper key name from an appname (mainly convert '\\' to '_') + */ +static LPWSTR WINECON_CreateKeyName(LPCWSTR kn) +{ + LPWSTR ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(kn) + 1) * sizeof(WCHAR)); + LPWSTR ptr = ret; + + if (!ptr) WINECON_Fatal("OOM"); + + do + { + *ptr++ = *kn == '\\' ? '_' : *kn; + } while (*kn++ != 0); + return ret; +} + +/****************************************************************** + * WINECON_RegLoadHelper * + * Read the basic configuration from any console key or subkey */ -BOOL WINECON_RegLoad(struct config_data* cfg) +static void WINECON_RegLoadHelper(HKEY hConKey, struct config_data* cfg) { - HKEY hConKey; DWORD type; DWORD count; DWORD val; - WINE_TRACE("loading registry settings.\n"); - if (RegOpenKey(HKEY_CURRENT_USER, wszConsole, &hConKey)) hConKey = 0; - count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszCursorSize, 0, &type, (char*)&val, &count)) - val = 25; - cfg->cursor_size = val; + if (!RegQueryValueEx(hConKey, wszCursorSize, 0, &type, (char*)&val, &count)) + cfg->cursor_size = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszCursorVisible, 0, &type, (char*)&val, &count)) - val = 1; - cfg->cursor_visible = val; + if (!RegQueryValueEx(hConKey, wszCursorVisible, 0, &type, (char*)&val, &count)) + cfg->cursor_visible = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszExitOnDie, 0, &type, (char*)&val, &count)) - val = 1; - cfg->exit_on_die = val; + if (!RegQueryValueEx(hConKey, wszExitOnDie, 0, &type, (char*)&val, &count)) + cfg->exit_on_die = val; count = sizeof(cfg->face_name); - if (!hConKey || RegQueryValueEx(hConKey, wszFaceName, 0, &type, (char*)&cfg->face_name, &count)) - cfg->face_name[0] = 0; + RegQueryValueEx(hConKey, wszFaceName, 0, &type, (char*)&cfg->face_name, &count); count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszFontSize, 0, &type, (char*)&val, &count)) - val = 0x000C0008; - cfg->cell_height = HIWORD(val); - cfg->cell_width = LOWORD(val); + if (!RegQueryValueEx(hConKey, wszFontSize, 0, &type, (char*)&val, &count)) + { + cfg->cell_height = HIWORD(val); + cfg->cell_width = LOWORD(val); + } count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszFontWeight, 0, &type, (char*)&val, &count)) - val = 0; - cfg->font_weight = val; + if (!RegQueryValueEx(hConKey, wszFontWeight, 0, &type, (char*)&val, &count)) + cfg->font_weight = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszHistoryBufferSize, 0, &type, (char*)&val, &count)) - val = 0; - cfg->history_size = val; + if (!RegQueryValueEx(hConKey, wszHistoryBufferSize, 0, &type, (char*)&val, &count)) + cfg->history_size = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszMenuMask, 0, &type, (char*)&val, &count)) - val = 0; - cfg->menu_mask = val; + if (!RegQueryValueEx(hConKey, wszHistoryNoDup, 0, &type, (char*)&val, &count)) + cfg->history_nodup = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszQuickEdit, 0, &type, (char*)&val, &count)) - val = 0; - cfg->quick_edit = val; + if (!RegQueryValueEx(hConKey, wszMenuMask, 0, &type, (char*)&val, &count)) + cfg->menu_mask = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszScreenBufferSize, 0, &type, (char*)&val, &count)) - val = 0x00190050; - cfg->sb_height = HIWORD(val); - cfg->sb_width = LOWORD(val); + if (!RegQueryValueEx(hConKey, wszQuickEdit, 0, &type, (char*)&val, &count)) + cfg->quick_edit = val; count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszScreenColors, 0, &type, (char*)&val, &count)) - val = 0x000F; - cfg->def_attr = val; + if (!RegQueryValueEx(hConKey, wszScreenBufferSize, 0, &type, (char*)&val, &count)) + { + cfg->sb_height = HIWORD(val); + cfg->sb_width = LOWORD(val); + } count = sizeof(val); - if (!hConKey || RegQueryValueEx(hConKey, wszWindowSize, 0, &type, (char*)&val, &count)) - val = 0x00190050; - cfg->win_height = HIWORD(val); - cfg->win_width = LOWORD(val); + if (!RegQueryValueEx(hConKey, wszScreenColors, 0, &type, (char*)&val, &count)) + cfg->def_attr = val; - /* win_pos isn't read from registry */ + count = sizeof(val); + if (!RegQueryValueEx(hConKey, wszWindowSize, 0, &type, (char*)&val, &count)) + { + cfg->win_height = HIWORD(val); + cfg->win_width = LOWORD(val); + } - if (hConKey) RegCloseKey(hConKey); - return TRUE; + /* win_pos isn't read from registry */ } /****************************************************************** - * WINECON_RegSave + * WINECON_RegLoad * * */ -BOOL WINECON_RegSave(const struct config_data* cfg) +void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg) { HKEY hConKey; - DWORD val; - WINE_TRACE("saving registry settings.\n"); - if (RegCreateKey(HKEY_CURRENT_USER, wszConsole, &hConKey)) + WINE_TRACE("loading %s registry settings.\n", appname ? wine_dbgstr_w(appname) : "default"); + + /* first set default values */ + cfg->cursor_size = 25; + cfg->cursor_visible = 1; + cfg->exit_on_die = 1; + cfg->face_name[0] = 0; + cfg->cell_height = 12; + cfg->cell_width = 8; + cfg->font_weight = 0; + cfg->history_size = 0; + cfg->history_nodup = 0; + cfg->menu_mask = 0; + cfg->quick_edit = 0; + cfg->sb_height = 25; + cfg->sb_width = 80; + cfg->def_attr = 0x000F; + cfg->win_height = 25; + cfg->win_width = 80; + cfg->registry = NULL; + + /* then read global settings */ + if (!RegOpenKey(HKEY_CURRENT_USER, wszConsole, &hConKey)) { - WINE_ERR("Can't open registry for saving\n"); - return FALSE; + WINECON_RegLoadHelper(hConKey, cfg); + /* if requested, load part related to console title */ + if (appname) + { + HKEY hAppKey; + + cfg->registry = WINECON_CreateKeyName(appname); + if (!RegOpenKey(hConKey, cfg->registry, &hAppKey)) + { + WINECON_RegLoadHelper(hAppKey, cfg); + RegCloseKey(hAppKey); + } + } + RegCloseKey(hConKey); } + WINECON_DumpConfig("load", cfg); +} + +/****************************************************************** + * WINECON_RegSaveHelper + * + * + */ +static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg) +{ + DWORD val; + + WINECON_DumpConfig("save", cfg); val = cfg->cursor_size; RegSetValueEx(hConKey, wszCursorSize, 0, REG_DWORD, (char*)&val, sizeof(val)); @@ -161,6 +227,9 @@ BOOL WINECON_RegSave(const struct config_data* cfg) val = cfg->history_size; RegSetValueEx(hConKey, wszHistoryBufferSize, 0, REG_DWORD, (char*)&val, sizeof(val)); + val = cfg->history_nodup; + RegSetValueEx(hConKey, wszHistoryNoDup, 0, REG_DWORD, (char*)&val, sizeof(val)); + val = cfg->menu_mask; RegSetValueEx(hConKey, wszMenuMask, 0, REG_DWORD, (char*)&val, sizeof(val)); @@ -175,7 +244,40 @@ BOOL WINECON_RegSave(const struct config_data* cfg) val = MAKELONG(cfg->win_width, cfg->win_height); RegSetValueEx(hConKey, wszWindowSize, 0, REG_DWORD, (char*)&val, sizeof(val)); +} - RegCloseKey(hConKey); - return TRUE; +/****************************************************************** + * WINECON_RegSave + * + * + */ +void WINECON_RegSave(const struct config_data* cfg) +{ + HKEY hConKey; + + WINE_TRACE("saving registry settings.\n"); + if (RegCreateKey(HKEY_CURRENT_USER, wszConsole, &hConKey)) + { + WINE_ERR("Can't open registry for saving\n"); + } + else + { + if (cfg->registry) + { + HKEY hAppKey; + + if (RegCreateKey(hConKey, cfg->registry, &hAppKey)) + { + WINE_ERR("Can't open registry for saving\n"); + } + else + { + /* FIXME: maybe only save the values different from the default value ? */ + WINECON_RegSaveHelper(hAppKey, cfg); + RegCloseKey(hAppKey); + } + } + else WINECON_RegSaveHelper(hConKey, cfg); + RegCloseKey(hConKey); + } } diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c index 45bcad888aa..81c91ef0f53 100644 --- a/programs/wineconsole/user.c +++ b/programs/wineconsole/user.c @@ -36,6 +36,8 @@ COLORREF WCUSER_ColorMap[16] = RGB(0xFF, 0x00, 0x00), RGB(0xFF, 0x00, 0xFF), RGB(0xFF, 0xFF, 0x00), RGB(0xFF, 0xFF, 0xFF), }; +static BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* font); + /****************************************************************** * WCUSER_FillMemDC * @@ -54,8 +56,11 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_ */ if (!PRIVATE(data)->hFont) return; + /* FIXME: could set up a mechanism to reuse the line between different + * calls to this function + */ if (!(line = HeapAlloc(GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(WCHAR)))) - {WINE_ERR("OOM\n"); return;} + WINECON_Fatal("OOM\n"); hOldFont = SelectObject(PRIVATE(data)->hMemDC, PRIVATE(data)->hFont); for (j = upd_tp; j <= upd_bm; j++) @@ -85,7 +90,7 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_ * Either the font geometry or the sb geometry has changed. we need * to recreate the bitmap geometry. */ -static void WCUSER_NewBitmap(struct inner_data* data, BOOL fill) +static void WCUSER_NewBitmap(struct inner_data* data) { HDC hDC; HBITMAP hnew, hold; @@ -107,8 +112,7 @@ static void WCUSER_NewBitmap(struct inner_data* data, BOOL fill) WINE_FIXME("leak\n"); } PRIVATE(data)->hBitmap = hnew; - if (fill) - WCUSER_FillMemDC(data, 0, data->curcfg.sb_height - 1); + WCUSER_FillMemDC(data, 0, data->curcfg.sb_height - 1); } /****************************************************************** @@ -118,7 +122,7 @@ static void WCUSER_NewBitmap(struct inner_data* data, BOOL fill) */ static void WCUSER_ResizeScreenBuffer(struct inner_data* data) { - WCUSER_NewBitmap(data, FALSE); + WCUSER_NewBitmap(data); } /****************************************************************** @@ -140,7 +144,7 @@ static void WCUSER_PosCursor(const struct inner_data* data) * * Sets a new shape for the cursor */ -void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL force) +static void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL force) { if (force || size != data->curcfg.cursor_size) { @@ -155,7 +159,7 @@ void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL force) w16b = ((data->curcfg.cell_width + 15) & ~15) / 8; ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, w16b * data->curcfg.cell_height); - if (!ptr) {WINE_ERR("OOM\n"); return;} + if (!ptr) WINECON_Fatal("OOM"); nbl = max((data->curcfg.cell_height * size) / 100, 1); for (j = data->curcfg.cell_height - nbl; j < data->curcfg.cell_height; j++) { @@ -190,6 +194,7 @@ void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL force) } } } + WINECON_DumpConfig("crsr", &data->curcfg); } /****************************************************************** @@ -207,11 +212,7 @@ void WCUSER_ComputePositions(struct inner_data* data) r.right = data->curcfg.win_width * data->curcfg.cell_width; r.bottom = data->curcfg.win_height * data->curcfg.cell_height; - if (IsRectEmpty(&r)) - { - ShowWindow(PRIVATE(data)->hWnd, SW_HIDE); - return; - } + if (IsRectEmpty(&r)) return; AdjustWindowRect(&r, GetWindowLong(PRIVATE(data)->hWnd, GWL_STYLE), FALSE); @@ -243,7 +244,7 @@ void WCUSER_ComputePositions(struct inner_data* data) } SetWindowPos(PRIVATE(data)->hWnd, 0, 0, 0, r.right - r.left + dx, r.bottom - r.top + dy, - SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW); + SWP_NOMOVE|SWP_NOZORDER); WCUSER_ShapeCursor(data, data->curcfg.cursor_size, data->curcfg.cursor_visible, TRUE); WCUSER_PosCursor(data); } @@ -367,18 +368,21 @@ static int CALLBACK get_first_font_enum_2(const LOGFONT* lf, const TEXTMETRIC* t mlf.lfHeight = fc->data->curcfg.cell_height; if (WCUSER_SetFont(fc->data, &mlf)) { + struct config_data defcfg; + WCUSER_DumpLogFont("InitChoosing: ", &mlf, FontType); fc->done = 1; /* since we've modified the current config with new font information, * set this information as the new default. */ - fc->data->defcfg.cell_width = fc->data->curcfg.cell_width; - fc->data->defcfg.cell_height = fc->data->curcfg.cell_height; - lstrcpyW(fc->data->defcfg.face_name, fc->data->curcfg.face_name); + WINECON_RegLoad(NULL, &defcfg); + defcfg.cell_width = fc->data->curcfg.cell_width; + defcfg.cell_height = fc->data->curcfg.cell_height; + lstrcpyW(defcfg.face_name, fc->data->curcfg.face_name); /* Force also its writing back to the registry so that we can get it * the next time. */ - WINECON_RegSave(&fc->data->defcfg); + WINECON_RegSave(&defcfg); return 0; } } @@ -510,7 +514,7 @@ BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont) PRIVATE(data)->hFont = hFont; WCUSER_ComputePositions(data); - WCUSER_NewBitmap(data, TRUE); + WCUSER_NewBitmap(data); InvalidateRect(PRIVATE(data)->hWnd, NULL, FALSE); UpdateWindow(PRIVATE(data)->hWnd); @@ -518,30 +522,27 @@ BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont) } /****************************************************************** - * WCUSER_InitFont + * WCUSER_SetFontPmt * - * create a hFont from the settings saved in registry... - * (called on init, assuming no font has been created before) + * Sets a new font for the console. + * In fact a wrapper for WCUSER_SetFont */ -static BOOL WCUSER_InitFont(struct inner_data* data) +static void WCUSER_SetFontPmt(struct inner_data* data, const WCHAR* font, + unsigned height, unsigned weight) { + LOGFONT lf; struct font_chooser fc; - WINE_TRACE_(wc_font)("=> %s\n", wine_dbgstr_wn(data->curcfg.face_name, -1)); - if (data->curcfg.face_name[0] != '\0' && - data->curcfg.cell_height != 0 && - data->curcfg.font_weight != 0) - { - LOGFONT lf; - - WCUSER_FillLogFont(&lf, data->curcfg.face_name, - data->curcfg.cell_height, data->curcfg.font_weight); - if (PRIVATE(data)->hFont != 0) WINE_FIXME("Oh strange\n"); + WINE_TRACE_(wc_font)("=> %s h=%u w=%u\n", + wine_dbgstr_wn(font, -1), height, weight); + if (font[0] != '\0' && height != 0 && weight != 0) + { + WCUSER_FillLogFont(&lf, font, height, weight); if (WCUSER_SetFont(data, &lf)) { WCUSER_DumpLogFont("InitReuses: ", &lf, 0); - return TRUE; + return; } } @@ -550,8 +551,7 @@ static BOOL WCUSER_InitFont(struct inner_data* data) fc.data = data; fc.done = 0; EnumFontFamilies(PRIVATE(data)->hMemDC, NULL, get_first_font_enum, (LPARAM)&fc); - if (!fc.done) WINE_WARN("Couldn't find a decent font, aborting\n"); - return fc.done; + if (!fc.done) WINECON_Fatal("Couldn't find a decent font, aborting\n"); } /****************************************************************** @@ -858,8 +858,6 @@ static LRESULT WCUSER_Create(HWND hWnd, LPCREATESTRUCT lpcs) SetWindowLong(hWnd, 0L, (DWORD)data); PRIVATE(data)->hWnd = hWnd; - data->curcfg.cursor_size = 101; /* invalid value, will trigger a complete cleanup */ - hSysMenu = GetSystemMenu(hWnd, FALSE); if (!hSysMenu) return 0; PRIVATE(data)->hPopMenu = CreatePopupMenu(); @@ -1343,9 +1341,10 @@ static int WCUSER_MainLoop(struct inner_data* data) { MSG msg; + ShowWindow(PRIVATE(data)->hWnd, SW_SHOW); for (;;) { - switch(MsgWaitForMultipleObjects(1, &data->hSynchro, FALSE, INFINITE, QS_ALLINPUT)) + switch (MsgWaitForMultipleObjects(1, &data->hSynchro, FALSE, INFINITE, QS_ALLINPUT)) { case WAIT_OBJECT_0: if (!WINECON_GrabChanges(data) && data->curcfg.exit_on_die) @@ -1392,6 +1391,7 @@ BOOL WCUSER_InitBackend(struct inner_data* data) data->fnRefresh = WCUSER_Refresh; data->fnResizeScreenBuffer = WCUSER_ResizeScreenBuffer; data->fnSetTitle = WCUSER_SetTitle; + data->fnSetFont = WCUSER_SetFontPmt; data->fnScroll = WCUSER_Scroll; data->fnDeleteBackend = WCUSER_DeleteBackend; @@ -1413,10 +1413,5 @@ BOOL WCUSER_InitBackend(struct inner_data* data) CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0, 0, wndclass.hInstance, data); if (!PRIVATE(data)->hWnd) return FALSE; - /* force update of current data */ - if (!WINECON_GrabChanges(data)) return FALSE; - - if (!WCUSER_InitFont(data)) return FALSE; - return TRUE; } diff --git a/programs/wineconsole/winecon_private.h b/programs/wineconsole/winecon_private.h index bb8fd2a737d..5bb00232cae 100644 --- a/programs/wineconsole/winecon_private.h +++ b/programs/wineconsole/winecon_private.h @@ -32,7 +32,8 @@ struct config_data { DWORD def_attr; WCHAR face_name[32]; /* name of font (size is LF_FACESIZE) */ DWORD font_weight; - DWORD history_size; + DWORD history_size; /* number of commands in history buffer */ + DWORD history_nodup; /* TRUE if commands are not stored twice in buffer */ DWORD menu_mask; /* MK_CONTROL MK_SHIFT mask to drive submenu opening */ DWORD quick_edit; /* whether mouse ops are sent to app (false) or used for content selection (true) */ unsigned sb_width; /* active screen buffer width */ @@ -41,11 +42,11 @@ struct config_data { unsigned win_height; COORD win_pos; /* position (in cells) of visible part of screen buffer in window */ BOOL exit_on_die; /* whether the wineconsole should quit if server destroys the console */ + WCHAR* registry; /* part of HKLU\\\\Console where config is read from (NULL if default settings) */ }; struct inner_data { struct config_data curcfg; - struct config_data defcfg; CHAR_INFO* cells; /* local copy of cells (sb_width * sb_height) */ @@ -63,12 +64,14 @@ struct inner_data { void (*fnResizeScreenBuffer)(struct inner_data* data); void (*fnSetTitle)(const struct inner_data* data); void (*fnScroll)(struct inner_data* data, int pos, BOOL horz); + void (*fnSetFont)(struct inner_data* data, const WCHAR* font, unsigned height, unsigned weight); void (*fnDeleteBackend)(struct inner_data* data); void* private; /* data part belonging to the choosen backed */ }; /* from wineconsole.c */ +extern void WINECON_Fatal(const char* msg); extern void WINECON_NotifyWindowChange(struct inner_data* data); extern int WINECON_GetHistorySize(HANDLE hConIn); extern BOOL WINECON_SetHistorySize(HANDLE hConIn, int size); @@ -77,10 +80,13 @@ extern BOOL WINECON_SetHistoryMode(HANDLE hConIn, int mode); extern BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len); extern void WINECON_FetchCells(struct inner_data* data, int upd_tp, int upd_bm); extern int WINECON_GrabChanges(struct inner_data* data); - +extern VOID WINECON_SetConfig(struct inner_data* data, + const struct config_data* cfg, BOOL force); /* from registry.c */ -extern BOOL WINECON_RegLoad(struct config_data* cfg); -extern BOOL WINECON_RegSave(const struct config_data* cfg); +extern void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg); +extern void WINECON_RegSave(const struct config_data* cfg); +extern void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg); /* backends... */ extern BOOL WCUSER_InitBackend(struct inner_data* data); +extern BOOL WCCURSE_InitBackend(struct inner_data* data); diff --git a/programs/wineconsole/winecon_user.h b/programs/wineconsole/winecon_user.h index d62e6629c10..518db430cb2 100644 --- a/programs/wineconsole/winecon_user.h +++ b/programs/wineconsole/winecon_user.h @@ -43,7 +43,6 @@ struct inner_data_user { /* from user.c */ extern COLORREF WCUSER_ColorMap[16]; extern BOOL WCUSER_GetProperties(struct inner_data*, BOOL); -extern BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* font); extern BOOL WCUSER_ValidateFont(const struct inner_data* data, const LOGFONT* lf); extern BOOL WCUSER_ValidateFontMetric(const struct inner_data* data, const TEXTMETRIC* tm, DWORD fontType); diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index 483e9fdc629..18a8d3a7a9d 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -1,7 +1,7 @@ /* * an application for displaying Win32 console * - * Copyright 2001 Eric Pouech + * Copyright 2001, 2002 Eric Pouech * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,6 +30,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(wineconsole); +void WINECON_Fatal(const char* msg) +{ + WINE_ERR("%s\n", msg); + ExitProcess(0); +} + /****************************************************************** * WINECON_FetchCells * @@ -261,7 +267,7 @@ int WINECON_GrabChanges(struct inner_data* data) break; case CONSOLE_RENDERER_SB_RESIZE_EVENT: if (data->curcfg.sb_width != evts[i].u.resize.width || - data->curcfg.sb_height != evts[i].u.resize.height) + data->curcfg.sb_height != evts[i].u.resize.height || !data->cells) { if (WINE_TRACE_ON(wineconsole)) WINE_DPRINTF(" resize(%d,%d)", evts[i].u.resize.width, evts[i].u.resize.height); @@ -270,7 +276,7 @@ int WINECON_GrabChanges(struct inner_data* data) data->cells = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data->cells, data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO)); - if (!data->cells) {WINE_ERR("OOM\n"); exit(0);} + if (!data->cells) WINECON_Fatal("OOM\n"); data->fnResizeScreenBuffer(data); data->fnComputePositions(data); } @@ -339,6 +345,81 @@ int WINECON_GrabChanges(struct inner_data* data) } /****************************************************************** + * WINECON_SetConfig + * + * Apply to data all the configuration elements from cfg. This includes modification + * of server side equivalent and visual parts. + * If force is FALSE, only the changed items are modified. + */ +void WINECON_SetConfig(struct inner_data* data, + const struct config_data* cfg, BOOL force) +{ + if (force || data->curcfg.cursor_size != cfg->cursor_size || + data->curcfg.cursor_visible != cfg->cursor_visible) + { + CONSOLE_CURSOR_INFO cinfo; + cinfo.dwSize = cfg->cursor_size; + /* : this hack is needed to pass thru the invariant test operation on server side + * (no notification is sent when invariant operation is requested + */ + cinfo.bVisible = !cfg->cursor_visible; + SetConsoleCursorInfo(data->hConOut, &cinfo); + /* */ + cinfo.bVisible = cfg->cursor_visible; + /* this shall update (through notif) curcfg */ + SetConsoleCursorInfo(data->hConOut, &cinfo); + } + if (force || data->curcfg.history_size != cfg->history_size) + { + data->curcfg.history_size = cfg->history_size; + WINECON_SetHistorySize(data->hConIn, cfg->history_size); + } + if (force || data->curcfg.history_nodup != cfg->history_nodup) + { + data->curcfg.history_nodup = cfg->history_nodup; + WINECON_SetHistoryMode(data->hConIn, cfg->history_nodup); + } + data->curcfg.menu_mask = cfg->menu_mask; + data->curcfg.quick_edit = cfg->quick_edit; + if (force || 1 /* FIXME: font info has changed */) + { + data->fnSetFont(data, cfg->face_name, cfg->cell_height, cfg->font_weight); + } + if (force || data->curcfg.def_attr != cfg->def_attr) + { + data->curcfg.def_attr = cfg->def_attr; + SetConsoleTextAttribute(data->hConOut, cfg->def_attr); + } + if (force || data->curcfg.sb_width != cfg->sb_width || + data->curcfg.sb_height != cfg->sb_height) + { + COORD c; + + c.X = cfg->sb_width; + c.Y = cfg->sb_height; + + /* this shall update (through notif) curcfg */ + SetConsoleScreenBufferSize(data->hConOut, c); + } + if (force || data->curcfg.win_width != cfg->win_width || + data->curcfg.win_height != cfg->win_height) + { + SMALL_RECT pos; + + pos.Left = pos.Top = 0; + pos.Right = cfg->win_width - 1; + pos.Bottom = cfg->win_height - 1; + /* this shall update (through notif) curcfg */ + SetConsoleWindowInfo(data->hConOut, FALSE, &pos); + } + data->curcfg.exit_on_die = cfg->exit_on_die; + /* we now need to gather all events we got from the operations above, + * in order to get data correctly updated + */ + WINECON_GrabChanges(data); +} + +/****************************************************************** * WINECON_Delete * * Destroy wineconsole internal data @@ -361,18 +442,40 @@ static void WINECON_Delete(struct inner_data* data) * Initialisation part I. Creation of server object (console input and * active screen buffer) */ -static struct inner_data* WINECON_Init(HINSTANCE hInst, void* pid) +static struct inner_data* WINECON_Init(HINSTANCE hInst, void* pid, LPCWSTR appname, + BOOL (*backend)(struct inner_data*)) { struct inner_data* data = NULL; DWORD ret; - WCHAR szTitle[] = {'W','i','n','e',' ','c','o','n','s','o','l','e',0}; + struct config_data cfg; + STARTUPINFOW si; data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)); if (!data) return 0; - /* load default registry settings, and copy them into our current configuration */ - WINECON_RegLoad(&data->defcfg); - data->curcfg = data->defcfg; + GetStartupInfo(&si); + + if (pid == 0) + { + if (!si.lpTitle) WINECON_Fatal("Should have a title set"); + appname = si.lpTitle; + } + + /* load settings */ + WINECON_RegLoad(appname, &cfg); + + /* some overrides */ + if (pid == 0) + { + if (si.dwFlags & STARTF_USECOUNTCHARS) + { + cfg.sb_width = si.dwXCountChars; + cfg.sb_height = si.dwYCountChars; + } + if (si.dwFlags & STARTF_USEFILLATTRIBUTE) + cfg.def_attr = si.dwFillAttribute; + /* should always be defined */ + } /* the handles here are created without the whistles and bells required by console * (mainly because wineconsole doesn't need it) @@ -390,13 +493,13 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, void* pid) } SERVER_END_REQ; if (!ret) goto error; - WINE_TRACE("using hConIn event %p, hSynchro event %p\n", data->hConIn, data->hSynchro); + WINE_TRACE("using hConIn %p, hSynchro event %p\n", data->hConIn, data->hSynchro); SERVER_START_REQ( set_console_input_info ) { req->handle = (obj_handle_t)data->hConIn; req->mask = SET_CONSOLE_INPUT_INFO_TITLE; - wine_server_add_data( req, szTitle, strlenW(szTitle) * sizeof(WCHAR) ); + wine_server_add_data( req, appname, strlenW(appname) * sizeof(WCHAR) ); ret = !wine_server_call_err( req ); } SERVER_END_REQ; @@ -408,12 +511,25 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, void* pid) req->access = GENERIC_WRITE|GENERIC_READ; req->share = FILE_SHARE_READ|FILE_SHARE_WRITE; req->inherit = FALSE; - data->hConOut = (HANDLE)(wine_server_call_err( req ) ? 0 : reply->handle_out); + ret = !wine_server_call_err( req ); + data->hConOut = (HANDLE)reply->handle_out; } SERVER_END_REQ; - if (data->hConOut) return data; + if (!ret) goto error; + WINE_TRACE("using hConOut %p\n", data->hConOut); + + /* filling data->curcfg from cfg */ + if ((*backend)(data)) + { + WINECON_SetConfig(data, &cfg, TRUE); + data->curcfg.registry = cfg.registry; + WINECON_DumpConfig("fint", &data->curcfg); + return data; + } error: + WINE_ERR("failed to init.\n"); + WINECON_Delete(data); return NULL; } @@ -423,11 +539,10 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, void* pid) * * Spawn the child process when invoked with wineconsole foo bar */ -static BOOL WINECON_Spawn(struct inner_data* data, LPCSTR lpCmdLine) +static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine) { PROCESS_INFORMATION info; STARTUPINFO startup; - LPWSTR ptr = GetCommandLine(); /* we're unicode... */ BOOL done; /* we're in the case wineconsole ... spawn the new process */ @@ -443,21 +558,14 @@ static BOOL WINECON_Spawn(struct inner_data* data, LPCSTR lpCmdLine) !DuplicateHandle(GetCurrentProcess(), data->hConOut, GetCurrentProcess(), &startup.hStdOutput, GENERIC_READ|GENERIC_WRITE, TRUE, 0) || !DuplicateHandle(GetCurrentProcess(), data->hConOut, GetCurrentProcess(), - &startup.hStdError, GENERIC_READ|GENERIC_WRITE, TRUE, 0)) + &startup.hStdError, GENERIC_READ|GENERIC_WRITE, TRUE, 0)) { WINE_ERR("Can't dup handles\n"); /* no need to delete handles, we're exiting the programm anyway */ return FALSE; } - /* we could have several ' ' in process command line... so try first space... - * FIXME: - * the correct way would be to check the existence of the left part of ptr - * (to be a file) - */ - while (*ptr && *ptr++ != ' '); - - done = *ptr && CreateProcess(NULL, ptr, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info); + done = CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info); /* we no longer need the handles passed to the child for the console */ CloseHandle(startup.hStdInput); @@ -492,15 +600,14 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh struct inner_data* data; int ret = 1; unsigned evt; + BOOL (*backend)(struct inner_data*); + + backend = WCUSER_InitBackend; /* case of wineconsole , signal process that created us that we're up and running */ if (WINECON_HasEvent(lpCmdLine, &evt)) { - if (!(data = WINECON_Init(hInst, 0))) - { - WINE_ERR("failed to init1 wineconsole.\n"); - return 0; - } + if (!(data = WINECON_Init(hInst, 0, NULL, backend))) return 0; ret = SetEvent((HANDLE)evt); if (!ret) { @@ -510,12 +617,26 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh } else { - if (!(data = WINECON_Init(hInst, (void*)GetCurrentProcessId()))) - { - WINE_ERR("failed to init2 wineconsole.\n"); - return 0; - } - ret = WINECON_Spawn(data, lpCmdLine); + LPWSTR wcmdLine = GetCommandLine() /* we're unicode... */; + LPWSTR src, dst; + WCHAR buffer[256]; + + /* remove wineconsole from commandline... + * we could have several ' ' in process command line... so try first space... + */ + /* FIXME: + * the correct way would be to check the existence of the left part of ptr + * (to be a file) + */ + while (*wcmdLine && *wcmdLine++ != ' '); + + /* FIXME: see above */ + src = wcmdLine; dst = buffer; + while (*src && *src != ' ') *dst++ = *src++; + *dst = 0; + + if (!(data = WINECON_Init(hInst, (void*)GetCurrentProcessId(), buffer, backend))) return 0; + ret = WINECON_Spawn(data, wcmdLine); if (!ret) { WINE_MESSAGE("wineconsole: spawning client program failed. Invalid/missing command line arguments ?\n"); @@ -523,13 +644,11 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh } } - if (WCUSER_InitBackend(data)) + if (ret) { WINE_TRACE("calling MainLoop.\n"); ret = data->fnMainLoop(data); } - else - WINE_ERR("WCUSER_InitBackend failed.\n"); cleanup: WINECON_Delete(data); diff --git a/programs/wineconsole/wineconsole_De.rc b/programs/wineconsole/wineconsole_De.rc index 20d0d60a988..d0c2e684ec5 100644 --- a/programs/wineconsole/wineconsole_De.rc +++ b/programs/wineconsole/wineconsole_De.rc @@ -57,7 +57,7 @@ FONT 8, "Helv" LTEXT "&Anzahl gemerkter Befehle :", -1, 14, 67, 78, 18 EDITTEXT IDC_OPT_HIST_SIZE, 92, 69, 31, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_OPT_HIST_SIZE_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 - AUTOCHECKBOX "&Entferne doppelte", IDC_OPT_HIST_DOUBLE, 130, 67, 50, 18, WS_TABSTOP|BS_MULTILINE + AUTOCHECKBOX "&Entferne doppelte", IDC_OPT_HIST_NODOUBLE, 130, 67, 50, 18, WS_TABSTOP|BS_MULTILINE } IDD_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105 @@ -81,19 +81,35 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION " Konfiguration " FONT 8, "Helv" { - GROUPBOX "Pufferbereich", -1, 10, 11, 110, 42, BS_GROUPBOX + GROUPBOX "Pufferbereich", -1, 10, 11, 100, 42, BS_GROUPBOX LTEXT "&Breite :", -1, 14, 25, 54, 9 - EDITTEXT IDC_CNF_SB_WIDTH, 78, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_SB_WIDTH, 68, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_SB_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 LTEXT "&Höhe :", -1, 14, 39, 54, 9 - EDITTEXT IDC_CNF_SB_HEIGHT, 78, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_SB_HEIGHT, 68, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_SB_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 - GROUPBOX "Fenstergrösse", -1, 10, 55, 110, 42 + GROUPBOX "Fenstergrösse", -1, 10, 55, 100, 42 LTEXT "Brei&te :", -1, 14, 69, 54, 9 - EDITTEXT IDC_CNF_WIN_WIDTH, 78, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_WIN_WIDTH, 68, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_WIN_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 LTEXT "Höh&e :", -1, 14, 83, 54, 9 - EDITTEXT IDC_CNF_WIN_HEIGHT, 78, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_WIN_HEIGHT, 68, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_WIN_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 + + GROUPBOX "End of program", -1, 115, 11, 80, 42, BS_GROUPBOX + AUTOCHECKBOX "&Close console", IDC_CNF_CLOSE_EXIT, 119, 25, 75, 20, WS_TABSTOP +} + +IDD_SAVE_SETTINGS DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 140, 60 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "Console parameters" +FONT 8, "Helv" +{ + GROUPBOX "", -1, 10, 10, 120, 31, BS_GROUPBOX + AUTORADIOBUTTON "Retain these settings for later sessions", IDC_SAV_SAVE, 14, 15, 110, 10, WS_TABSTOP + AUTORADIOBUTTON "Modify only current session", IDC_SAV_SESSION, 14, 27, 110, 10, WS_TABSTOP + + PUSHBUTTON "OK", IDOK, 20, 45, 35, 12 + PUSHBUTTON "Cancel", IDCANCEL, 65, 45, 35, 12 } diff --git a/programs/wineconsole/wineconsole_En.rc b/programs/wineconsole/wineconsole_En.rc index 20e4260aadc..56877a77a35 100644 --- a/programs/wineconsole/wineconsole_En.rc +++ b/programs/wineconsole/wineconsole_En.rc @@ -57,7 +57,7 @@ FONT 8, "Helv" LTEXT "&Number of recalled commands :", -1, 14, 67, 78, 18 EDITTEXT IDC_OPT_HIST_SIZE, 92, 69, 31, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_OPT_HIST_SIZE_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 - AUTOCHECKBOX "&Remove doubles", IDC_OPT_HIST_DOUBLE, 130, 67, 50, 18, WS_TABSTOP|BS_MULTILINE + AUTOCHECKBOX "&Remove doubles", IDC_OPT_HIST_NODOUBLE, 130, 67, 50, 18, WS_TABSTOP|BS_MULTILINE } IDD_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105 @@ -81,19 +81,35 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION " Configuration " FONT 8, "Helv" { - GROUPBOX "Buffer zone", -1, 10, 11, 110, 42, BS_GROUPBOX + GROUPBOX "Buffer zone", -1, 10, 11, 100, 42, BS_GROUPBOX LTEXT "&Width :", -1, 14, 25, 54, 9 - EDITTEXT IDC_CNF_SB_WIDTH, 78, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_SB_WIDTH, 68, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_SB_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 LTEXT "&Height :", -1, 14, 39, 54, 9 - EDITTEXT IDC_CNF_SB_HEIGHT, 78, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_SB_HEIGHT, 68, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_SB_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 - GROUPBOX "Window size", -1, 10, 55, 110, 42 + GROUPBOX "Window size", -1, 10, 55, 100, 42 LTEXT "W&idth :", -1, 14, 69, 54, 9 - EDITTEXT IDC_CNF_WIN_WIDTH, 78, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_WIN_WIDTH, 68, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_WIN_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 LTEXT "H&eight :", -1, 14, 83, 54, 9 - EDITTEXT IDC_CNF_WIN_HEIGHT, 78, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_WIN_HEIGHT, 68, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_WIN_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 + + GROUPBOX "End of program", -1, 115, 11, 80, 42, BS_GROUPBOX + AUTOCHECKBOX "&Close console", IDC_CNF_CLOSE_EXIT, 119, 25, 75, 20, WS_TABSTOP +} + +IDD_SAVE_SETTINGS DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 140, 60 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "Console parameters" +FONT 8, "Helv" +{ + GROUPBOX "", -1, 10, 10, 120, 31, BS_GROUPBOX + AUTORADIOBUTTON "Retain these settings for later sessions", IDC_SAV_SAVE, 14, 15, 110, 10, WS_TABSTOP + AUTORADIOBUTTON "Modify only current session", IDC_SAV_SESSION, 14, 27, 110, 10, WS_TABSTOP + + PUSHBUTTON "OK", IDOK, 20, 45, 35, 12 + PUSHBUTTON "Cancel", IDCANCEL, 65, 45, 35, 12 } diff --git a/programs/wineconsole/wineconsole_Fr.rc b/programs/wineconsole/wineconsole_Fr.rc index 6ac7d910ff9..581a5d0ff9b 100644 --- a/programs/wineconsole/wineconsole_Fr.rc +++ b/programs/wineconsole/wineconsole_Fr.rc @@ -57,7 +57,7 @@ FONT 8, "Helv" LTEXT "&Taille de la mémoire tampon :", -1, 14, 67, 78, 18 EDITTEXT IDC_OPT_HIST_SIZE, 92, 69, 31, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_OPT_HIST_SIZE_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 - AUTOCHECKBOX "&Supprimer les doublons", IDC_OPT_HIST_DOUBLE, 130, 67, 50, 18, WS_TABSTOP|BS_MULTILINE + AUTOCHECKBOX "&Supprimer les doublons", IDC_OPT_HIST_NODOUBLE, 130, 67, 60, 18, WS_TABSTOP|BS_MULTILINE } IDD_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 140, 105 @@ -81,19 +81,35 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION " Configuration " FONT 8, "Helv" { - GROUPBOX "Taille mémoire tampon écran", -1, 10, 11, 110, 42, BS_GROUPBOX + GROUPBOX "Taille mémoire tampon écran", -1, 10, 11, 100, 42, BS_GROUPBOX LTEXT "&Largeur :", -1, 14, 25, 54, 9 - EDITTEXT IDC_CNF_SB_WIDTH, 78, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_SB_WIDTH, 68, 23, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_SB_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 LTEXT "Ha&uteur :", -1, 14, 39, 54, 9 - EDITTEXT IDC_CNF_SB_HEIGHT, 78, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_SB_HEIGHT, 68, 37, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_SB_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 - GROUPBOX "Taille de la fenêtre", -1, 10, 55, 110, 42 + GROUPBOX "Taille de la fenêtre", -1, 10, 55, 100, 42 LTEXT "La&rgeur :", -1, 14, 69, 54, 9 - EDITTEXT IDC_CNF_WIN_WIDTH, 78, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_WIN_WIDTH, 68, 67, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_WIN_WIDTH_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 LTEXT "Hau&teur :", -1, 14, 83, 54, 9 - EDITTEXT IDC_CNF_WIN_HEIGHT, 78, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER + EDITTEXT IDC_CNF_WIN_HEIGHT, 68, 81, 36, 12, WS_TABSTOP|WS_BORDER|ES_NUMBER CONTROL "", IDC_CNF_WIN_HEIGHT_UD, "msctls_updown32", UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS|UDS_NOTHOUSANDS, 0, 0, 0, 0 + + GROUPBOX "Fin du programme", -1, 115, 11, 80, 42, BS_GROUPBOX + AUTOCHECKBOX "&Fermer la console", IDC_CNF_CLOSE_EXIT, 119, 25, 75, 20, WS_TABSTOP +} + +IDD_SAVE_SETTINGS DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 200, 60 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "Paramètres de la console" +FONT 8, "Helv" +{ + GROUPBOX "", -1, 10, 10, 180, 31, BS_GROUPBOX + AUTORADIOBUTTON "Sauver les paramètres pour les prochaines sessions", IDC_SAV_SAVE, 14, 15, 170, 10, WS_TABSTOP + AUTORADIOBUTTON "Appliquer uniquement à la session courante", IDC_SAV_SESSION, 14, 27, 170, 10, WS_TABSTOP + + PUSHBUTTON "OK", IDOK, 50, 45, 35, 12 + PUSHBUTTON "Annuler", IDCANCEL, 115, 45, 35, 12 } diff --git a/programs/wineconsole/wineconsole_res.h b/programs/wineconsole/wineconsole_res.h index bb4f806003e..6eeebe2d387 100644 --- a/programs/wineconsole/wineconsole_res.h +++ b/programs/wineconsole/wineconsole_res.h @@ -37,17 +37,19 @@ #define IDS_FNT_PREVIEW_1 0x201 #define IDS_FNT_PREVIEW_2 0x202 +/* dialog boxes */ #define IDD_OPTION 0x0100 #define IDD_FONT 0x0200 #define IDD_CONFIG 0x0300 +#define IDD_SAVE_SETTINGS 0x0400 -/* dialog boxes */ +/* dialog boxes controls */ #define IDC_OPT_CURSOR_SMALL 0x0101 #define IDC_OPT_CURSOR_MEDIUM 0x0102 #define IDC_OPT_CURSOR_LARGE 0x0103 #define IDC_OPT_HIST_SIZE 0x0104 #define IDC_OPT_HIST_SIZE_UD 0x0105 -#define IDC_OPT_HIST_DOUBLE 0x0106 +#define IDC_OPT_HIST_NODOUBLE 0x0106 #define IDC_OPT_CONF_CTRL 0x0107 #define IDC_OPT_CONF_SHIFT 0x0108 #define IDC_OPT_QUICK_EDIT 0x0109 @@ -67,3 +69,7 @@ #define IDC_CNF_WIN_WIDTH_UD 0x0306 #define IDC_CNF_WIN_HEIGHT 0x0307 #define IDC_CNF_WIN_HEIGHT_UD 0x0308 +#define IDC_CNF_CLOSE_EXIT 0x0309 + +#define IDC_SAV_SAVE 0x0401 +#define IDC_SAV_SESSION 0x0402 -- 2.11.4.GIT