Removing console specific defines [3/4]

Eric Pouech eric.pouech at wanadoo.fr
Mon Jan 6 15:54:37 CST 2003


See 1/4 for the details.
A+
-- 
Eric Pouech
-------------- next part --------------
Name:          wc_edmo_reg
ChangeLog:     - Added an edition mode flavor (win32/emacs...) to the console settings in the registry
License:       X11
GenDate:       2003/01/06 21:47:05 UTC
ModifiedFiles: programs/wineconsole/winecon_private.h programs/wineconsole/wineconsole.c programs/wineconsole/registry.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/winecon_private.h,v
retrieving revision 1.9
diff -u -u -r1.9 winecon_private.h
--- programs/wineconsole/winecon_private.h	23 Dec 2002 01:35:27 -0000	1.9
+++ programs/wineconsole/winecon_private.h	5 Jan 2003 21:14:05 -0000
@@ -42,6 +42,7 @@
     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 */
+    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) */
 };
 
Index: programs/wineconsole/wineconsole.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole.c,v
retrieving revision 1.19
diff -u -u -r1.19 wineconsole.c
--- programs/wineconsole/wineconsole.c	23 Dec 2002 01:35:27 -0000	1.19
+++ programs/wineconsole/wineconsole.c	6 Jan 2003 21:30:30 -0000
@@ -181,6 +181,26 @@
 }
 
 /******************************************************************
+ *		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
  *
  * A change occurs, try to figure out which
@@ -413,6 +433,11 @@
         SetConsoleWindowInfo(data->hConOut, FALSE, &pos);
     }
     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,
      * in order to get data correctly updated
      */
Index: programs/wineconsole/registry.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/registry.c,v
retrieving revision 1.10
diff -u -u -r1.10 registry.c
--- programs/wineconsole/registry.c	13 Dec 2002 23:37:06 -0000	1.10
+++ programs/wineconsole/registry.c	5 Jan 2003 21:22:31 -0000
@@ -30,6 +30,7 @@
 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 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 wszFaceName[]          = {'F','a','c','e','N','a','m','e',0};
 static const WCHAR wszFontSize[]          = {'F','o','n','t','S','i','z','e',0};
@@ -44,11 +45,12 @@
 
 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,
                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,
+               cfg->edition_mode,
                wine_dbgstr_w(cfg->registry));
 }
 
@@ -91,6 +93,10 @@
         cfg->cursor_visible = 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))
         cfg->exit_on_die = val;
 
@@ -173,6 +179,7 @@
     cfg->def_attr = 0x000F;
     cfg->win_height = 25;
     cfg->win_width  = 80;
+    cfg->edition_mode = 0;
     cfg->registry = NULL;
 
     /* then read global settings */
@@ -212,6 +219,9 @@
 
     val = cfg->cursor_visible;
     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;
     RegSetValueEx(hConKey, wszExitOnDie, 0, REG_DWORD, (char*)&val, sizeof(val));


More information about the wine-patches mailing list