- allow to save/restore some properties into the registry (like font,
[wine] / programs / wineconsole / winecon_private.h
1 /*
2  * an application for displaying Win32 console
3  *
4  * Copyright 2001 Eric Pouech
5  */
6
7 #include <winbase.h>
8 #include <wincon.h>
9
10 #include "wineconsole_res.h"
11
12 /* this is the configuration stored & loaded into the registry */
13 struct config_data {
14     unsigned    cell_width;     /* width in pixels of a character */    
15     unsigned    cell_height;    /* height in pixels of a character */
16     int         cursor_size;    /* in % of cell height */
17     int         cursor_visible;
18     DWORD       def_attr;
19     WCHAR       face_name[32];  /* name of font (size is LF_FACESIZE) */
20     DWORD       font_weight;
21     DWORD       history_size;
22     DWORD       menu_mask;      /* MK_CONTROL MK_SHIFT mask to drive submenu opening */
23     unsigned    sb_width;       /* active screen buffer width */
24     unsigned    sb_height;      /* active screen buffer height */
25     unsigned    win_width;      /* size (in cells) of visible part of window (width & height) */
26     unsigned    win_height;
27     COORD       win_pos;        /* position (in cells) of visible part of screen buffer in window */
28 };
29
30 struct inner_data {
31     struct config_data  curcfg;
32     struct config_data  defcfg;
33
34     CHAR_INFO*          cells;          /* local copy of cells (sb_width * sb_height) */
35
36     COORD               cursor;         /* position in cells of cursor */
37
38     HANDLE              hConIn;         /* console input handle */
39     HANDLE              hConOut;        /* screen buffer handle: has to be changed when active sb changes */
40     HANDLE              hSynchro;       /* waitable handle signalled by server when something in server has been modified */
41
42     int                 (*fnMainLoop)(struct inner_data* data);
43     void                (*fnPosCursor)(const struct inner_data* data);
44     void                (*fnShapeCursor)(struct inner_data* data, int size, int vis, BOOL force);
45     void                (*fnComputePositions)(struct inner_data* data);
46     void                (*fnRefresh)(const struct inner_data* data, int tp, int bm);
47     void                (*fnResizeScreenBuffer)(struct inner_data* data);
48     void                (*fnSetTitle)(const struct inner_data* data);
49     void                (*fnScroll)(struct inner_data* data, int pos, BOOL horz);
50     void                (*fnDeleteBackend)(struct inner_data* data);
51
52     void*               private;        /* data part belonging to the choosen backed */
53 };
54
55 #  ifdef __GNUC__
56 extern void  XTracer(int level, const char* format, ...) __attribute__((format (printf,2,3)));
57 #  else
58 extern void  XTracer(int level, const char* format, ...);
59 #  endif
60 #if 0
61 /* Trace mode */
62 #  define Trace XTracer
63 #else
64 /* non trace mode */
65 #  define Trace (1) ? (void)0 : XTracer
66 #endif
67
68 /* from wineconsole.c */
69 extern void WINECON_NotifyWindowChange(struct inner_data* data);
70 extern int  WINECON_GetHistorySize(HANDLE hConIn);
71 extern BOOL WINECON_SetHistorySize(HANDLE hConIn, int size);
72 extern int  WINECON_GetHistoryMode(HANDLE hConIn);
73 extern BOOL WINECON_SetHistoryMode(HANDLE hConIn, int mode);
74 extern BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len);
75 extern void WINECON_FetchCells(struct inner_data* data, int upd_tp, int upd_bm);
76 extern int  WINECON_GrabChanges(struct inner_data* data);
77
78 /* from registry.c */
79 extern BOOL WINECON_RegLoad(struct config_data* cfg);
80 extern BOOL WINECON_RegSave(const struct config_data* cfg);
81
82 /* backends... */
83 extern BOOL WCUSER_InitBackend(struct inner_data* data);