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
28 #define WIN32_NO_STATUS
35 #include "wine/condrv.h"
36 #include "wine/rbtree.h"
49 short int pitch_family
;
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 */
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 int signaled
; /* is server in signaled state */
84 WCHAR
*read_buffer
; /* buffer of data available for read */
85 size_t read_buffer_count
; /* size of available data */
86 size_t read_buffer_size
; /* size of buffer */
87 unsigned int read_ioctl
; /* current read ioctl */
88 size_t pending_read
; /* size of pending read buffer */
89 struct edit_line edit_line
; /* edit line context */
90 struct console_window
*window
;
91 WCHAR
*title
; /* console title */
92 struct history_line
**history
; /* lines history */
93 unsigned int history_size
; /* number of entries in history array */
94 unsigned int history_index
; /* number of used entries in history array */
95 unsigned int history_mode
; /* mode of history (non zero means remove doubled strings */
96 unsigned int edition_mode
; /* index to edition mode flavors */
97 unsigned int input_cp
; /* console input codepage */
98 unsigned int output_cp
; /* console output codepage */
99 HWND win
; /* window handle if backend supports it */
100 HANDLE input_thread
; /* input thread handle */
101 HANDLE tty_input
; /* handle to tty input stream */
102 HANDLE tty_output
; /* handle to tty output stream */
103 char tty_buffer
[4096]; /* tty output buffer */
104 size_t tty_buffer_count
; /* tty buffer size */
105 unsigned int tty_cursor_x
; /* tty cursor position */
106 unsigned int tty_cursor_y
;
107 unsigned int tty_attr
; /* current tty char attributes */
108 int tty_cursor_visible
; /* tty cursor visibility flag */
113 struct console
*console
; /* console reference */
114 unsigned int id
; /* screen buffer id */
115 unsigned int mode
; /* output mode */
116 unsigned int width
; /* size (w-h) of the screen buffer */
118 unsigned int cursor_size
; /* size of cursor (percentage filled) */
119 unsigned int cursor_visible
; /* cursor visibility flag */
120 unsigned int cursor_x
; /* position of cursor */
121 unsigned int cursor_y
; /* position of cursor */
122 unsigned short attr
; /* default fill attributes (screen colors) */
123 unsigned short popup_attr
; /* pop-up color attributes */
124 unsigned int max_width
; /* size (w-h) of the window given font size */
125 unsigned int max_height
;
126 char_info_t
*data
; /* the data for each cell - a width x height matrix */
127 unsigned int color_map
[16]; /* color table */
128 RECT win
; /* current visible window on the screen buffer */
129 struct font_info font
; /* console font information */
130 struct wine_rb_entry entry
; /* map entry */
133 BOOL
init_window( struct console
*console
);
134 void update_window_region( struct console
*console
, const RECT
*update
);
135 void update_window_config( struct console
*console
, BOOL delay
);
137 NTSTATUS
write_console_input( struct console
*console
, const INPUT_RECORD
*records
,
138 unsigned int count
, BOOL flush
);
140 void notify_screen_buffer_size( struct screen_buffer
*screen_buffer
);
141 NTSTATUS
change_screen_buffer_size( struct screen_buffer
*screen_buffer
, int new_width
, int new_height
);
143 static inline void empty_update_rect( struct screen_buffer
*screen_buffer
, RECT
*rect
)
145 SetRect( rect
, screen_buffer
->width
, screen_buffer
->height
, 0, 0 );
148 static inline unsigned int get_bounded_cursor_x( struct screen_buffer
*screen_buffer
)
150 return min( screen_buffer
->cursor_x
, screen_buffer
->width
- 1 );
153 #endif /* RC_INVOKED */
156 #define IDS_EDIT 0x100
157 #define IDS_DEFAULT 0x101
158 #define IDS_PROPERTIES 0x102
160 #define IDS_MARK 0x110
161 #define IDS_COPY 0x111
162 #define IDS_PASTE 0x112
163 #define IDS_SELECTALL 0x113
164 #define IDS_SCROLL 0x114
165 #define IDS_SEARCH 0x115
167 #define IDS_DLG_TIT_DEFAULT 0x120
168 #define IDS_DLG_TIT_CURRENT 0x121
169 #define IDS_DLG_TIT_ERROR 0x122
171 #define IDS_DLG_ERR_SBWINSIZE 0x130
173 #define IDS_FNT_DISPLAY 0x200
174 #define IDS_FNT_PREVIEW 0x201
177 #define IDD_OPTION 0x0100
178 #define IDD_FONT 0x0200
179 #define IDD_CONFIG 0x0300
180 #define IDD_SAVE_SETTINGS 0x0400
182 /* dialog boxes controls */
183 #define IDC_OPT_CURSOR_SMALL 0x0101
184 #define IDC_OPT_CURSOR_MEDIUM 0x0102
185 #define IDC_OPT_CURSOR_LARGE 0x0103
186 #define IDC_OPT_HIST_SIZE 0x0104
187 #define IDC_OPT_HIST_SIZE_UD 0x0105
188 #define IDC_OPT_HIST_NODOUBLE 0x0106
189 #define IDC_OPT_CONF_CTRL 0x0107
190 #define IDC_OPT_CONF_SHIFT 0x0108
191 #define IDC_OPT_QUICK_EDIT 0x0109
192 #define IDC_OPT_INSERT_MODE 0x0110
194 #define IDC_FNT_LIST_FONT 0x0201
195 #define IDC_FNT_LIST_SIZE 0x0202
196 #define IDC_FNT_COLOR_BK 0x0203
197 #define IDC_FNT_COLOR_FG 0x0204
198 #define IDC_FNT_FONT_INFO 0x0205
199 #define IDC_FNT_PREVIEW 0x0206
201 #define IDC_CNF_SB_WIDTH 0x0301
202 #define IDC_CNF_SB_WIDTH_UD 0x0302
203 #define IDC_CNF_SB_HEIGHT 0x0303
204 #define IDC_CNF_SB_HEIGHT_UD 0x0304
205 #define IDC_CNF_WIN_WIDTH 0x0305
206 #define IDC_CNF_WIN_WIDTH_UD 0x0306
207 #define IDC_CNF_WIN_HEIGHT 0x0307
208 #define IDC_CNF_WIN_HEIGHT_UD 0x0308
209 #define IDC_CNF_CLOSE_EXIT 0x0309
210 #define IDC_CNF_EDITION_MODE 0x030a
212 #define IDC_SAV_SAVE 0x0401
213 #define IDC_SAV_SESSION 0x0402