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