xref: /haiku/src/apps/terminal/TermConst.h (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
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_ACTIVATE_TERM					= 'msat';
92 static const uint32 MSG_SET_CURSOR_STYLE				= 'mscs';
93 static const uint32 MSG_GET_TERMINAL_COLOR				= 'getc';
94 
95 
96 // Preference Read/Write Keys
97 static const char* const PREF_THEME_NAME = "Theme name";
98 static const char* const PREF_HALF_FONT_FAMILY = "Half Font Family";
99 static const char* const PREF_HALF_FONT_STYLE = "Half Font Style";
100 static const char* const PREF_HALF_FONT_SIZE = "Half Font Size";
101 
102 static const char* const PREF_TEXT_FORE_COLOR = "Text";
103 static const char* const PREF_TEXT_BACK_COLOR = "Background";
104 static const char* const PREF_CURSOR_FORE_COLOR = "Text under cursor";
105 static const char* const PREF_CURSOR_BACK_COLOR = "Cursor";
106 static const char* const PREF_SELECT_FORE_COLOR = "Selected text";
107 static const char* const PREF_SELECT_BACK_COLOR = "Selected background";
108 
109 static const char* const PREF_IM_FORE_COLOR = "IM foreground color";
110 static const char* const PREF_IM_BACK_COLOR = "IM background color";
111 static const char* const PREF_IM_SELECT_COLOR = "IM selection color";
112 
113 static const char* const PREF_ANSI_BLACK_COLOR = "ANSI black color";
114 static const char* const PREF_ANSI_RED_COLOR = "ANSI red color";
115 static const char* const PREF_ANSI_GREEN_COLOR = "ANSI green color";
116 static const char* const PREF_ANSI_YELLOW_COLOR = "ANSI yellow color";
117 static const char* const PREF_ANSI_BLUE_COLOR = "ANSI blue color";
118 static const char* const PREF_ANSI_MAGENTA_COLOR = "ANSI magenta color";
119 static const char* const PREF_ANSI_CYAN_COLOR = "ANSI cyan color";
120 static const char* const PREF_ANSI_WHITE_COLOR = "ANSI white color";
121 
122 static const char* const PREF_ANSI_BLACK_HCOLOR = "ANSI bright black color";
123 static const char* const PREF_ANSI_RED_HCOLOR = "ANSI bright red color";
124 static const char* const PREF_ANSI_GREEN_HCOLOR = "ANSI bright green color";
125 static const char* const PREF_ANSI_YELLOW_HCOLOR = "ANSI bright yellow color";
126 static const char* const PREF_ANSI_BLUE_HCOLOR = "ANSI bright blue color";
127 static const char* const PREF_ANSI_MAGENTA_HCOLOR = "ANSI bright magenta color";
128 static const char* const PREF_ANSI_CYAN_HCOLOR = "ANSI bright cyan color";
129 static const char* const PREF_ANSI_WHITE_HCOLOR = "ANSI bright white color";
130 
131 static const char* const PREF_HISTORY_SIZE = "History size";
132 static const char* const PREF_CURSOR_BLINKING = "Cursor blinking rate";
133 
134 static const char* const PREF_IM_AWARE = "Input method aware";
135 
136 static const char* const PREF_COLS = "Cols";
137 static const char* const PREF_ROWS = "Rows";
138 
139 static const char* const PREF_TEXT_ENCODING = "Text encoding";
140 
141 static const char* const PREF_BLINK_CURSOR = "Blinking cursor";
142 static const char* const PREF_ALLOW_BOLD = "Allow bold text";
143 static const char* const PREF_USE_OPTION_AS_META =
144 	"Use left Option as Meta key";
145 static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
146 static const char* const PREF_CURSOR_STYLE = "Cursor style";
147 static const char* const PREF_EMULATE_BOLD = "Emulate bold";
148 
149 static const char* const PREF_TAB_TITLE = "Tab title";
150 static const char* const PREF_WINDOW_TITLE = "Window title";
151 
152 // shared strings
153 extern const char* const kToolTipSetTabTitlePlaceholders;
154 extern const char* const kToolTipSetWindowTitlePlaceholders;
155 extern const char* const kToolTipCommonTitlePlaceholders;
156 
157 extern const char* const kShellEscapeCharacters;
158 extern const char* const kDefaultAdditionalWordCharacters;
159 extern const char* const kURLAdditionalWordCharacters;
160 
161 
162 // Cursor style
163 enum {
164 	BLOCK_CURSOR,
165 	UNDERLINE_CURSOR,
166 	IBEAM_CURSOR
167 };
168 
169 
170 // Preference Folder and setting path
171 
172 static const int32 DEFAULT = -1;
173 
174 // Font Width
175 enum {
176 	HALF_WIDTH = 1,
177 	FULL_WIDTH = 2
178 };
179 
180 #define M_UTF8 -1
181 
182 #define TAB_WIDTH 8
183 
184 #define MIN_COLS 10
185 #define MAX_COLS 999
186 #define MIN_ROWS 10
187 #define MAX_ROWS 999
188 
189 // Insert mode flag
190 #define MODE_OVER 0
191 #define MODE_INSERT 1
192 
193 // Define TermBuffer internal code
194 #define NO_CHAR 0x00
195 #define A_CHAR 0x01
196 #define IN_STRING 0xFF
197 
198 // TermBuffer extended attribute
199 #define A_WIDTH			0x8000
200 #define BOLD			0x4000
201 #define UNDERLINE		0x2000
202 #define INVERSE			0x1000
203 #define MOUSE			0x0800
204 #define FORESET			0x0400
205 #define BACKSET			0x0200
206 #define FONT			0x0100
207 #define RESERVE			0x0080
208 #define DUMPCR			0x0040
209 #define FORECOLOR		0xFF0000
210 #define BACKCOLOR		0xFF000000
211 #define CHAR_ATTRIBUTES	0xFFFF7700
212 
213 #define FORECOLORED(x) ((x) << 16)
214 #define BACKCOLORED(x) ((x) << 24)
215 
216 
217 #endif	// TERMCONST_H_INCLUDED
218