xref: /haiku/src/apps/terminal/TermConst.h (revision 47c05920fde47c2618efccd24bd82f1e79cdf05a)
1 /*
2  * Copyright 2001-2023, Haiku, Inc. All rights reserved.
3  * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
4  * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
5  *
6  * Distributed under the terms of the MIT License.
7  *
8  * Authors:
9  *		Kian Duffy, myob@users.sourceforge.net
10  *		Simon South, simon@simonsouth.net
11  *		Siarzhuk Zharski, zharik@gmx.li
12  */
13 #ifndef TERMCONST_H_INCLUDED
14 #define TERMCONST_H_INCLUDED
15 
16 // Application signature (Must same in Terminal.rdef)
17 #define TERM_SIGNATURE "application/x-vnd.Haiku-Terminal"
18 #define PREFFILE_MIMETYPE "text/x-terminal-pref"
19 #define THEMEFILE_MIMETYPE "text/x-terminal-theme"
20 
21 // Signature of R5's Terminal. Needed for proper drop-in window count support
22 #define R5_TERM_SIGNATURE "application/x-vnd.Be-SHEL"
23 
24 // Name of the clipboard used for mouse copy'n'paste.
25 #define MOUSE_CLIPBOARD_NAME TERM_SIGNATURE "/mouse"
26 
27 // Message constants for menu items
28 
29 #include <SupportDefs.h>
30 
31 
32 // define to get Ctrl-Cmd-S / Ctrl-Cmd-C shortcuts
33 // to get the debug buffers snapshots and control
34 // sequences capture logging
35 #define USE_DEBUG_SNAPSHOTS
36 #ifdef USE_DEBUG_SNAPSHOTS
37 const uint32 SHORTCUT_DEBUG_SNAPSHOTS	= 'sdbs';
38 const uint32 SHORTCUT_DEBUG_CAPTURE		= 'srdc';
39 #endif
40 
41 // Menu Message
42 static const uint32 MENU_SWITCH_TERM	= 'MSWT';
43 static const uint32 MENU_NEW_TERM		= 'MNTE';
44 static const uint32 MENU_PREF_OPEN		= 'MPre';
45 static const uint32 MENU_CLEAR_ALL		= 'MCAl';
46 static const uint32 MENU_HELP			= 'Mhlp';
47 static const uint32 MENU_COMMAND_HELP	= 'Mchp';
48 static const uint32 MENU_SHOW_GPL		= 'Mgpl';
49 static const uint32 MENU_ENCODING		= 'Menc';
50 static const uint32 MENU_PAGE_SETUP		= 'Mpst';
51 static const uint32 MENU_PRINT			= 'Mpnt';
52 static const uint32 MENU_FIND_STRING	= 'Mfpr';
53 static const uint32 MENU_FIND_NEXT		= 'Mfnx';
54 static const uint32 MENU_FIND_PREVIOUS	= 'Mfbw';
55 static const uint32 MENU_SHOW_COLOR		= 'Mcol';
56 static const uint32 MENU_THEME_OPEN		= 'Mthm';
57 
58 static const uint32 M_GET_DEVICE_NUM	= 'Mgdn';
59 
60 
61 // Preference Message
62 static const ulong PSET__COLS							= 'pcol';
63 static const ulong PSET__ROWS							= 'prow';
64 static const ulong PSET__HFONT							= 'phfn';
65 static const ulong PSET__HFONT_SIZE						= 'phfs';
66 static const ulong PSET_FORE_COLOR						= 'pfcl';
67 static const ulong PSET_BACK_COLOR						= 'pbcl';
68 static const ulong PSET__CODING							= 'pcod';
69 
70 // Terminal Size Messages
71 static const uint32 EIGHTYTWENTYFIVE					= 'etfv';
72 static const uint32 EIGHTYFORTY							= 'efor';
73 static const uint32 ONETHREETWOTWENTYFIVE				= 'hunv';
74 static const uint32 FULLSCREEN							= 'fscr';
75 
76 static const uint32 MSG_FONT_CHANGED					= 'fntc';
77 static const uint32 MSG_SAVE_AS_DEFAULT					= 'sadf';
78 static const uint32 MSG_CHECK_CHILDREN					= 'ckch';
79 static const uint32 MSG_REMOVE_RESIZE_VIEW_IF_NEEDED	= 'rmrv';
80 static const uint32 MSG_TERMINAL_BUFFER_CHANGED			= 'bufc';
81 static const uint32 MSG_SET_TERMINAL_TITLE				= 'sett';
82 static const uint32 MSG_SET_TERMINAL_COLORS				= 'setc';
83 static const uint32 MSG_RESET_TERMINAL_COLORS			= 'rstc';
84 static const uint32 MSG_QUIT_TERMNAL					= 'qutt';
85 static const uint32 MSG_ENABLE_META_KEY					= 'emtk';
86 static const uint32 MSG_ENABLE_BRACKETED_PASTE			= 'ebkp';
87 static const uint32 MSG_REPORT_MOUSE_EVENT				= 'mous';
88 static const uint32 MSG_SAVE_WINDOW_POSITION			= 'swps';
89 static const uint32 MSG_MOVE_TAB_LEFT					= 'mvtl';
90 static const uint32 MSG_MOVE_TAB_RIGHT					= 'mvtr';
91 static const uint32 MSG_SWITCH_TAB_LEFT					= 'swtl';
92 static const uint32 MSG_SWITCH_TAB_RIGHT				= 'swtr';
93 static const uint32 MSG_ACTIVATE_TERM					= 'msat';
94 static const uint32 MSG_SET_CURSOR_STYLE				= 'mscs';
95 static const uint32 MSG_GET_TERMINAL_COLOR				= 'getc';
96 
97 
98 // Preference Read/Write Keys
99 static const char* const PREF_THEME_NAME = "Theme name";
100 static const char* const PREF_HALF_FONT_FAMILY = "Half Font Family";
101 static const char* const PREF_HALF_FONT_STYLE = "Half Font Style";
102 static const char* const PREF_HALF_FONT_SIZE = "Half Font Size";
103 
104 static const char* const PREF_TEXT_FORE_COLOR = "Text";
105 static const char* const PREF_TEXT_BACK_COLOR = "Background";
106 static const char* const PREF_CURSOR_FORE_COLOR = "Text under cursor";
107 static const char* const PREF_CURSOR_BACK_COLOR = "Cursor";
108 static const char* const PREF_SELECT_FORE_COLOR = "Selected text";
109 static const char* const PREF_SELECT_BACK_COLOR = "Selected background";
110 
111 static const char* const PREF_IM_FORE_COLOR = "IM foreground color";
112 static const char* const PREF_IM_BACK_COLOR = "IM background color";
113 static const char* const PREF_IM_SELECT_COLOR = "IM selection color";
114 
115 static const char* const PREF_ANSI_BLACK_COLOR = "ANSI black color";
116 static const char* const PREF_ANSI_RED_COLOR = "ANSI red color";
117 static const char* const PREF_ANSI_GREEN_COLOR = "ANSI green color";
118 static const char* const PREF_ANSI_YELLOW_COLOR = "ANSI yellow color";
119 static const char* const PREF_ANSI_BLUE_COLOR = "ANSI blue color";
120 static const char* const PREF_ANSI_MAGENTA_COLOR = "ANSI magenta color";
121 static const char* const PREF_ANSI_CYAN_COLOR = "ANSI cyan color";
122 static const char* const PREF_ANSI_WHITE_COLOR = "ANSI white color";
123 
124 static const char* const PREF_ANSI_BLACK_HCOLOR = "ANSI bright black color";
125 static const char* const PREF_ANSI_RED_HCOLOR = "ANSI bright red color";
126 static const char* const PREF_ANSI_GREEN_HCOLOR = "ANSI bright green color";
127 static const char* const PREF_ANSI_YELLOW_HCOLOR = "ANSI bright yellow color";
128 static const char* const PREF_ANSI_BLUE_HCOLOR = "ANSI bright blue color";
129 static const char* const PREF_ANSI_MAGENTA_HCOLOR = "ANSI bright magenta color";
130 static const char* const PREF_ANSI_CYAN_HCOLOR = "ANSI bright cyan color";
131 static const char* const PREF_ANSI_WHITE_HCOLOR = "ANSI bright white color";
132 
133 static const char* const PREF_HISTORY_SIZE = "History size";
134 static const char* const PREF_CURSOR_BLINKING = "Cursor blinking rate";
135 
136 static const char* const PREF_IM_AWARE = "Input method aware";
137 
138 static const char* const PREF_COLS = "Cols";
139 static const char* const PREF_ROWS = "Rows";
140 
141 static const char* const PREF_TEXT_ENCODING = "Text encoding";
142 
143 static const char* const PREF_BLINK_CURSOR = "Blinking cursor";
144 static const char* const PREF_ALLOW_BOLD = "Allow bold text";
145 static const char* const PREF_USE_OPTION_AS_META =
146 	"Use left Option as Meta key";
147 static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
148 static const char* const PREF_CURSOR_STYLE = "Cursor style";
149 static const char* const PREF_EMULATE_BOLD = "Emulate bold";
150 
151 static const char* const PREF_TAB_TITLE = "Tab title";
152 static const char* const PREF_WINDOW_TITLE = "Window title";
153 
154 // shared strings
155 extern const char* const kToolTipSetTabTitlePlaceholders;
156 extern const char* const kToolTipSetWindowTitlePlaceholders;
157 extern const char* const kToolTipCommonTitlePlaceholders;
158 
159 extern const char* const kShellEscapeCharacters;
160 extern const char* const kDefaultAdditionalWordCharacters;
161 extern const char* const kURLAdditionalWordCharacters;
162 
163 
164 // Cursor style
165 enum {
166 	BLOCK_CURSOR,
167 	UNDERLINE_CURSOR,
168 	IBEAM_CURSOR
169 };
170 
171 
172 // Underline style
173 enum {
174 	SINGLE_UNDERLINE = 1,
175 	DOUBLE_UNDERLINE,
176 	CURLY_UNDERLINE,
177 	DOTTED_UNDERLINE,
178 	DASHED_UNDERLINE
179 };
180 
181 
182 // Preference Folder and setting path
183 
184 static const int32 DEFAULT = -1;
185 
186 // Font Width
187 enum {
188 	HALF_WIDTH = 1,
189 	FULL_WIDTH = 2
190 };
191 
192 #define M_UTF8 -1
193 
194 #define TAB_WIDTH 8
195 
196 #define MIN_COLS 10
197 #define MAX_COLS 999
198 #define MIN_ROWS 10
199 #define MAX_ROWS 999
200 
201 // Insert mode flag
202 #define MODE_OVER 0
203 #define MODE_INSERT 1
204 
205 // Define TermBuffer internal code
206 #define NO_CHAR 0x00
207 #define A_CHAR 0x01
208 #define IN_STRING 0xFF
209 
210 // TermBuffer extended attribute
211 #define A_WIDTH			0x8000
212 #define BOLD			0x4000
213 #define UNDERLINE		0x2000
214 #define INVERSE			0x1000
215 #define MOUSE			0x0800
216 #define FORESET			0x0400
217 #define BACKSET			0x0200
218 #define FONT			0x0100
219 #define RESERVE			0x0080
220 #define DUMPCR			0x0040
221 #define UNDERSET		0x0020
222 #define FORECOLOR		0xFF0000
223 #define BACKCOLOR		0xFF000000
224 #define CHAR_ATTRIBUTES	0xFFFF7720
225 
226 #define FORECOLORED(x) ((x) << 16)
227 #define BACKCOLORED(x) ((x) << 24)
228 
229 
230 #endif	// TERMCONST_H_INCLUDED
231