winmm: Use wide-char string literals.
[wine.git] / programs / conhost / conhost.h
blob7bc102b0df085844149592d48afe38ffc9cfc36e
1 /*
2 * Copyright 1998 Alexandre Julliard
3 * Copyright 2001 Eric Pouech
4 * Copyright 2012 Detlef Riekenberg
5 * Copyright 2020 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef RC_INVOKED
24 #include <stdarg.h>
25 #include <stdlib.h>
27 #include <ntstatus.h>
28 #define WIN32_NO_STATUS
29 #include <windef.h>
30 #include <winbase.h>
31 #include <winuser.h>
32 #include <winnls.h>
33 #include <winternl.h>
35 #include "wine/condrv.h"
36 #include "wine/rbtree.h"
38 struct history_line
40 size_t len;
41 WCHAR text[1];
44 struct font_info
46 short int width;
47 short int height;
48 short int weight;
49 short int pitch_family;
50 WCHAR *face_name;
51 size_t face_len;
54 struct edit_line
56 NTSTATUS status; /* edit status */
57 WCHAR *buf; /* the line being edited */
58 unsigned int len; /* number of chars in line */
59 size_t size; /* buffer size */
60 unsigned int cursor; /* offset for cursor in current line */
61 WCHAR *yanked; /* yanked line */
62 unsigned int mark; /* marked point (emacs mode only) */
63 unsigned int history_index; /* history index */
64 WCHAR *current_history; /* buffer for the recent history entry */
65 BOOL insert_key; /* insert key state */
66 BOOL insert_mode; /* insert mode */
67 unsigned int update_begin; /* update region */
68 unsigned int update_end;
69 unsigned int end_offset; /* offset of the last written char */
70 unsigned int home_x; /* home position */
71 unsigned int home_y;
74 struct console
76 HANDLE server; /* console server handle */
77 unsigned int mode; /* input mode */
78 struct screen_buffer *active; /* active screen buffer */
79 int is_unix; /* UNIX terminal mode */
80 INPUT_RECORD *records; /* input records */
81 unsigned int record_count; /* number of input records */
82 unsigned int record_size; /* size of input records buffer */
83 WCHAR *read_buffer; /* buffer of data available for read */
84 size_t read_buffer_count; /* size of available data */
85 size_t read_buffer_size; /* size of buffer */
86 unsigned int read_ioctl; /* current read ioctl */
87 size_t pending_read; /* size of pending read buffer */
88 struct edit_line edit_line; /* edit line context */
89 struct console_window *window;
90 WCHAR *title; /* console title */
91 struct history_line **history; /* lines history */
92 unsigned int history_size; /* number of entries in history array */
93 unsigned int history_index; /* number of used entries in history array */
94 unsigned int history_mode; /* mode of history (non zero means remove doubled strings */
95 unsigned int edition_mode; /* index to edition mode flavors */
96 unsigned int input_cp; /* console input codepage */
97 unsigned int output_cp; /* console output codepage */
98 HWND win; /* window handle if backend supports it */
99 HANDLE input_thread; /* input thread handle */
100 HANDLE tty_input; /* handle to tty input stream */
101 HANDLE tty_output; /* handle to tty output stream */
102 char tty_buffer[4096]; /* tty output buffer */
103 size_t tty_buffer_count; /* tty buffer size */
104 unsigned int tty_cursor_x; /* tty cursor position */
105 unsigned int tty_cursor_y;
106 unsigned int tty_attr; /* current tty char attributes */
107 int tty_cursor_visible; /* tty cursor visibility flag */
110 struct screen_buffer
112 struct console *console; /* console reference */
113 unsigned int id; /* screen buffer id */
114 unsigned int mode; /* output mode */
115 unsigned int width; /* size (w-h) of the screen buffer */
116 unsigned int height;
117 unsigned int cursor_size; /* size of cursor (percentage filled) */
118 unsigned int cursor_visible; /* cursor visibility flag */
119 unsigned int cursor_x; /* position of cursor */
120 unsigned int cursor_y; /* position of cursor */
121 unsigned short attr; /* default fill attributes (screen colors) */
122 unsigned short popup_attr; /* pop-up color attributes */
123 unsigned int max_width; /* size (w-h) of the window given font size */
124 unsigned int max_height;
125 char_info_t *data; /* the data for each cell - a width x height matrix */
126 unsigned int color_map[16]; /* color table */
127 RECT win; /* current visible window on the screen buffer */
128 struct font_info font; /* console font information */
129 struct wine_rb_entry entry; /* map entry */
132 BOOL init_window( struct console *console );
133 void update_window_region( struct console *console, const RECT *update );
134 void update_window_config( struct console *console );
136 NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *records,
137 unsigned int count, BOOL flush );
138 NTSTATUS change_screen_buffer_size( struct screen_buffer *screen_buffer, int new_width, int new_height );
140 static inline void empty_update_rect( struct screen_buffer *screen_buffer, RECT *rect )
142 SetRect( rect, screen_buffer->width, screen_buffer->height, 0, 0 );
145 #endif /* RC_INVOKED */
147 /* strings */
148 #define IDS_EDIT 0x100
149 #define IDS_DEFAULT 0x101
150 #define IDS_PROPERTIES 0x102
152 #define IDS_MARK 0x110
153 #define IDS_COPY 0x111
154 #define IDS_PASTE 0x112
155 #define IDS_SELECTALL 0x113
156 #define IDS_SCROLL 0x114
157 #define IDS_SEARCH 0x115
159 #define IDS_DLG_TIT_DEFAULT 0x120
160 #define IDS_DLG_TIT_CURRENT 0x121
161 #define IDS_DLG_TIT_ERROR 0x122
163 #define IDS_DLG_ERR_SBWINSIZE 0x130
165 #define IDS_FNT_DISPLAY 0x200
166 #define IDS_FNT_PREVIEW 0x201
168 /* dialog boxes */
169 #define IDD_OPTION 0x0100
170 #define IDD_FONT 0x0200
171 #define IDD_CONFIG 0x0300
172 #define IDD_SAVE_SETTINGS 0x0400
174 /* dialog boxes controls */
175 #define IDC_OPT_CURSOR_SMALL 0x0101
176 #define IDC_OPT_CURSOR_MEDIUM 0x0102
177 #define IDC_OPT_CURSOR_LARGE 0x0103
178 #define IDC_OPT_HIST_SIZE 0x0104
179 #define IDC_OPT_HIST_SIZE_UD 0x0105
180 #define IDC_OPT_HIST_NODOUBLE 0x0106
181 #define IDC_OPT_CONF_CTRL 0x0107
182 #define IDC_OPT_CONF_SHIFT 0x0108
183 #define IDC_OPT_QUICK_EDIT 0x0109
184 #define IDC_OPT_INSERT_MODE 0x0110
186 #define IDC_FNT_LIST_FONT 0x0201
187 #define IDC_FNT_LIST_SIZE 0x0202
188 #define IDC_FNT_COLOR_BK 0x0203
189 #define IDC_FNT_COLOR_FG 0x0204
190 #define IDC_FNT_FONT_INFO 0x0205
191 #define IDC_FNT_PREVIEW 0x0206
193 #define IDC_CNF_SB_WIDTH 0x0301
194 #define IDC_CNF_SB_WIDTH_UD 0x0302
195 #define IDC_CNF_SB_HEIGHT 0x0303
196 #define IDC_CNF_SB_HEIGHT_UD 0x0304
197 #define IDC_CNF_WIN_WIDTH 0x0305
198 #define IDC_CNF_WIN_WIDTH_UD 0x0306
199 #define IDC_CNF_WIN_HEIGHT 0x0307
200 #define IDC_CNF_WIN_HEIGHT_UD 0x0308
201 #define IDC_CNF_CLOSE_EXIT 0x0309
202 #define IDC_CNF_EDITION_MODE 0x030a
204 #define IDC_SAV_SAVE 0x0401
205 #define IDC_SAV_SESSION 0x0402