xref: /haiku/src/apps/terminal/TermConst.h (revision e8cd7007416a323259791ac09c013dcce2956976)
1 /*
2  * Copyright 2001-2009, Haiku.
3  * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
4  * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files or portions
8  * thereof (the "Software"), to deal in the Software without restriction,
9  * including without limitation the rights to use, copy, modify, merge,
10  * publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so, subject
12  * to the following conditions:
13  *
14  *  * Redistributions of source code must retain the above copyright notice,
15  *    this list of conditions and the following disclaimer.
16  *
17  *  * Redistributions in binary form must reproduce the above copyright notice
18  *    in the  binary, as well as this list of conditions and the following
19  *    disclaimer in the documentation and/or other materials provided with
20  *    the distribution.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28  * THE SOFTWARE.
29  *
30  */
31 #ifndef TERMCONST_H_INCLUDED
32 #define TERMCONST_H_INCLUDED
33 
34 // Application signature (Must same in Terminal.rdef)
35 #define TERM_SIGNATURE "application/x-vnd.Haiku-Terminal"
36 #define PREFFILE_MIMETYPE "text/x-terminal-pref"
37 
38 // Signature of R5's Terminal. Needed for proper drop-in window count support
39 #define R5_TERM_SIGNATURE "application/x-vnd.Be-SHEL"
40 
41 // Name of the clipboard used for mouse copy'n'paste.
42 #define MOUSE_CLIPBOARD_NAME TERM_SIGNATURE "/mouse"
43 
44 // Message constants for menu items
45 
46 #include <SupportDefs.h>
47 
48 
49 // Menu Message
50 static const uint32 MENU_SWITCH_TERM	= 'MSWT';
51 static const uint32 MENU_NEW_TERM		= 'MNTE';
52 static const uint32 MENU_PREF_OPEN		= 'MPre';
53 static const uint32 MENU_CLEAR_ALL		= 'MCAl';
54 static const uint32 MENU_HELP			= 'Mhlp';
55 static const uint32 MENU_COMMAND_HELP	= 'Mchp';
56 static const uint32 MENU_SHOW_GPL		= 'Mgpl';
57 static const uint32 MENU_ENCODING		= 'Menc';
58 static const uint32 MENU_PAGE_SETUP		= 'Mpst';
59 static const uint32 MENU_PRINT			= 'Mpnt';
60 static const uint32 MENU_FIND_STRING	= 'Mfpr';
61 static const uint32 MENU_FIND_NEXT		= 'Mfnx';
62 static const uint32 MENU_FIND_PREVIOUS	= 'Mfbw';
63 static const uint32 MENU_SHOW_COLOR		= 'Mcol';
64 
65 static const uint32 M_GET_DEVICE_NUM	= 'Mgdn';
66 
67 
68 // Preference Message
69 static const ulong PSET__COLS							= 'pcol';
70 static const ulong PSET__ROWS							= 'prow';
71 static const ulong PSET__HFONT							= 'phfn';
72 static const ulong PSET__HFONT_SIZE						= 'phfs';
73 static const ulong PSET_FORE_COLOR						= 'pfcl';
74 static const ulong PSET_BACK_COLOR						= 'pbcl';
75 static const ulong PSET__CODING							= 'pcod';
76 
77 // Terminal Size Messages
78 static const uint32 EIGHTYTWENTYFOUR					= 'etfo';
79 static const uint32 EIGHTYTWENTYFIVE					= 'etfv';
80 static const uint32 EIGHTYFORTY							= 'efor';
81 static const uint32 ONETHREETWOTWENTYFOUR				= 'hunf';
82 static const uint32 ONETHREETWOTWENTYFIVE				= 'hunv';
83 static const uint32 FULLSCREEN							= 'fscr';
84 
85 static const uint32 MSG_FONT_CHANGED					= 'fntc';
86 static const uint32 SAVE_AS_DEFAULT 					= 'sadf';
87 static const uint32 MSG_CHECK_CHILDREN					= 'ckch';
88 static const uint32 MSG_REMOVE_RESIZE_VIEW_IF_NEEDED	= 'rmrv';
89 static const uint32 MSG_TERMINAL_BUFFER_CHANGED			= 'bufc';
90 static const uint32 MSG_SET_TERMNAL_TITLE				= 'sett';
91 static const uint32 MSG_QUIT_TERMNAL					= 'qutt';
92 static const uint32 MSG_REPORT_MOUSE_EVENT				= 'mous';
93 static const uint32 MSG_SAVE_WINDOW_POSITION			= 'swps';
94 static const uint32 MSG_MOVE_TAB_LEFT					= 'mvtl';
95 static const uint32 MSG_MOVE_TAB_RIGHT					= 'mvtr';
96 static const uint32 MSG_ACTIVATE_TERM					= 'msat';
97 
98 
99 // Preference Read/Write Keys
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_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_HISTORY_SIZE = "History size";
123 static const char* const PREF_CURSOR_BLINKING = "Cursor blinking rate";
124 
125 static const char* const PREF_IM_AWARE = "Input method aware";
126 
127 static const char* const PREF_COLS = "Cols";
128 static const char* const PREF_ROWS = "Rows";
129 static const char* const PREF_SHELL = "Shell";
130 
131 static const char* const PREF_TEXT_ENCODING = "Text encoding";
132 static const char* const PREF_GUI_LANGUAGE = "Language";
133 
134 static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
135 
136 static const char* const PREF_TAB_TITLE = "Tab title";
137 static const char* const PREF_WINDOW_TITLE = "Window title";
138 
139 // shared strings
140 extern const char* const kTooTipSetTabTitlePlaceholders;
141 extern const char* const kTooTipSetWindowTitlePlaceholders;
142 
143 // Color type
144 enum {
145   TEXT_FOREGROUND_COLOR,
146   TEXT_BACKGROUND_COLOR,
147   SELECTION_FOREGROUND_COLOR,
148   SELECTION_BACKGROUND_COLOR
149 };
150 
151 // Preference Folder and setting path
152 
153 static const int32 DEFAULT = -1;
154 
155 // Font Width
156 static const int  HALF_WIDTH = 1;
157 static const int  FULL_WIDTH = 2;
158 
159 // Scroll direction flag
160 enum{
161   SCRUP,
162   SCRDOWN
163 };
164 
165 #define M_UTF8 -1
166 
167 #define TAB_WIDTH 8
168 
169 #define MIN_COLS 10
170 #define MAX_COLS 256
171 #define MIN_ROWS 10
172 #define MAX_ROWS 256
173 
174 // Insert mode flag
175 #define MODE_OVER 0
176 #define MODE_INSERT 1
177 
178 // Define TermBuffer internal code
179 #define NO_CHAR 0x00
180 #define A_CHAR 0x01
181 #define IN_STRING 0xFF
182 
183 // TermBuffer extended attribute
184 #define A_WIDTH			0x8000
185 #define BOLD			0x4000
186 #define UNDERLINE		0x2000
187 #define INVERSE			0x1000
188 #define MOUSE			0x0800
189 #define FORESET			0x0400
190 #define BACKSET			0x0200
191 #define FONT			0x0100
192 #define RESERVE			0x0080
193 #define DUMPCR			0x0040
194 #define FORECOLOR		0xFF0000
195 #define BACKCOLOR		0xFF000000
196 #define CHAR_ATTRIBUTES	0xFFFF7700
197 
198 #define IS_WIDTH(x)	(((x) & A_WIDTH)   )
199 #define IS_BOLD(x)	(((x) & BOLD)      )
200 #define IS_UNDER(x)	(((x) & UNDERLINE) )
201 #define IS_INVERSE(x)	(((x) & INVERSE)   )
202 #define IS_MOUSE(x)	(((x) & MOUSE)     )
203 #define IS_FORESET(x)	(((x) & FORESET)   )
204 #define IS_BACKSET(x)	(((x) & BACKSET)   )
205 #define IS_FONT(x)	(((x) & FONT)      )
206 #define IS_CR(x)	(((x) & DUMPCR)	   )
207 #define IS_FORECOLOR(x) (((x) & FORECOLOR) >> 16)
208 #define IS_BACKCOLOR(x) (((x) & BACKCOLOR) >> 24)
209 
210 #define FORECOLORED(x) ((x) << 16)
211 #define BACKCOLORED(x) ((x) << 24)
212 
213 
214 #endif	// TERMCONST_H_INCLUDED
215