Commit 5477453c authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added an edition mode flavor (win32/emacs...) to the console settings

in the registry.
parent fa8b85aa
...@@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wineconsole); ...@@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
static const WCHAR wszConsole[] = {'C','o','n','s','o','l','e',0}; static const WCHAR wszConsole[] = {'C','o','n','s','o','l','e',0};
static const WCHAR wszCursorSize[] = {'C','u','r','s','o','r','S','i','z','e',0}; static const WCHAR wszCursorSize[] = {'C','u','r','s','o','r','S','i','z','e',0};
static const WCHAR wszCursorVisible[] = {'C','u','r','s','o','r','V','i','s','i','b','l','e',0}; static const WCHAR wszCursorVisible[] = {'C','u','r','s','o','r','V','i','s','i','b','l','e',0};
static const WCHAR wszEditionMode[] = {'E','d','i','t','i','o','n','M','o','d','e',0};
static const WCHAR wszExitOnDie[] = {'E','x','i','t','O','n','D','i','e',0}; static const WCHAR wszExitOnDie[] = {'E','x','i','t','O','n','D','i','e',0};
static const WCHAR wszFaceName[] = {'F','a','c','e','N','a','m','e',0}; 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 wszFontSize[] = {'F','o','n','t','S','i','z','e',0};
...@@ -44,11 +45,12 @@ static const WCHAR wszWindowSize[] = {'W','i','n','d','o','w','S','i','z' ...@@ -44,11 +45,12 @@ static const WCHAR wszWindowSize[] = {'W','i','n','d','o','w','S','i','z'
void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg) 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", 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) edit=%u registry=%s\n",
pfx, cfg->cell_width, cfg->cell_height, cfg->cursor_size, cfg->cursor_visible, cfg->def_attr, 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, 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->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, cfg->menu_mask, cfg->sb_width, cfg->sb_height, cfg->win_pos.X, cfg->win_pos.Y, cfg->win_width, cfg->win_height,
cfg->edition_mode,
wine_dbgstr_w(cfg->registry)); wine_dbgstr_w(cfg->registry));
} }
...@@ -91,6 +93,10 @@ static void WINECON_RegLoadHelper(HKEY hConKey, struct config_data* cfg) ...@@ -91,6 +93,10 @@ static void WINECON_RegLoadHelper(HKEY hConKey, struct config_data* cfg)
cfg->cursor_visible = val; cfg->cursor_visible = val;
count = sizeof(val); count = sizeof(val);
if (!RegQueryValueEx(hConKey, wszEditionMode, 0, &type, (char*)&val, &count))
cfg->edition_mode = val;
count = sizeof(val);
if (!RegQueryValueEx(hConKey, wszExitOnDie, 0, &type, (char*)&val, &count)) if (!RegQueryValueEx(hConKey, wszExitOnDie, 0, &type, (char*)&val, &count))
cfg->exit_on_die = val; cfg->exit_on_die = val;
...@@ -173,6 +179,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg) ...@@ -173,6 +179,7 @@ void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg)
cfg->def_attr = 0x000F; cfg->def_attr = 0x000F;
cfg->win_height = 25; cfg->win_height = 25;
cfg->win_width = 80; cfg->win_width = 80;
cfg->edition_mode = 0;
cfg->registry = NULL; cfg->registry = NULL;
/* then read global settings */ /* then read global settings */
...@@ -213,6 +220,9 @@ static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg) ...@@ -213,6 +220,9 @@ static void WINECON_RegSaveHelper(HKEY hConKey, const struct config_data* cfg)
val = cfg->cursor_visible; val = cfg->cursor_visible;
RegSetValueEx(hConKey, wszCursorVisible, 0, REG_DWORD, (char*)&val, sizeof(val)); RegSetValueEx(hConKey, wszCursorVisible, 0, REG_DWORD, (char*)&val, sizeof(val));
val = cfg->edition_mode;
RegSetValueEx(hConKey, wszEditionMode, 0, REG_DWORD, (char*)&val, sizeof(val));
val = cfg->exit_on_die; val = cfg->exit_on_die;
RegSetValueEx(hConKey, wszExitOnDie, 0, REG_DWORD, (char*)&val, sizeof(val)); RegSetValueEx(hConKey, wszExitOnDie, 0, REG_DWORD, (char*)&val, sizeof(val));
......
...@@ -42,6 +42,7 @@ struct config_data { ...@@ -42,6 +42,7 @@ struct config_data {
unsigned win_height; unsigned win_height;
COORD win_pos; /* position (in cells) of visible part of screen buffer in window */ 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 */ BOOL exit_on_die; /* whether the wineconsole should quit if server destroys the console */
unsigned edition_mode; /* edition mode flavor while line editing */
WCHAR* registry; /* <x> part of HKLU\\<x>\\Console where config is read from (NULL if default settings) */ WCHAR* registry; /* <x> part of HKLU\\<x>\\Console where config is read from (NULL if default settings) */
}; };
......
...@@ -181,6 +181,26 @@ BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len) ...@@ -181,6 +181,26 @@ BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len)
} }
/****************************************************************** /******************************************************************
* WINECON_SetEditionMode
*
*
*/
static BOOL WINECON_SetEditionMode(HANDLE hConIn, int edition_mode)
{
BOOL ret;
SERVER_START_REQ( set_console_input_info )
{
req->handle = (obj_handle_t)hConIn;
req->mask = SET_CONSOLE_INPUT_INFO_EDITION_MODE;
req->edition_mode = edition_mode;
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
return ret;
}
/******************************************************************
* WINECON_GrabChanges * WINECON_GrabChanges
* *
* A change occurs, try to figure out which * A change occurs, try to figure out which
...@@ -413,6 +433,11 @@ void WINECON_SetConfig(struct inner_data* data, ...@@ -413,6 +433,11 @@ void WINECON_SetConfig(struct inner_data* data,
SetConsoleWindowInfo(data->hConOut, FALSE, &pos); SetConsoleWindowInfo(data->hConOut, FALSE, &pos);
} }
data->curcfg.exit_on_die = cfg->exit_on_die; data->curcfg.exit_on_die = cfg->exit_on_die;
if (force || data->curcfg.edition_mode != cfg->edition_mode)
{
data->curcfg.edition_mode = cfg->edition_mode;
WINECON_SetEditionMode(data->hConIn, cfg->edition_mode);
}
/* we now need to gather all events we got from the operations above, /* we now need to gather all events we got from the operations above,
* in order to get data correctly updated * in order to get data correctly updated
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment