xref: /haiku/src/apps/terminal/TermConst.h (revision 746cac055adc6ac3308c7bc2d29040fb95689cc9)
1 /*
2  * Copyright 2001-2007, 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 Muterminal.rsrc)
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 const uint32 MENU_SWITCH_TERM   = 'MSWT';
51 const uint32 MENU_NEW_TERM      = 'MNTE';
52 const uint32 MENU_PREF_OPEN     = 'MPre';
53 const uint32 MENU_CLEAR_ALL     = 'MCAl';
54 const uint32 MENU_HELP          = 'Mhlp';
55 const uint32 MENU_COMMAND_HELP  = 'Mchp';
56 const uint32 MENU_SHOW_GPL      = 'Mgpl';
57 const uint32 MENU_ENCODING      = 'Menc';
58 const uint32 MENU_PAGE_SETUP    = 'Mpst';
59 const uint32 MENU_PRINT         = 'Mpnt';
60 const uint32 MENU_FIND_STRING   = 'Mfnd';
61 const uint32 MENU_FIND_FORWARD  = 'Mffw';
62 const uint32 MENU_FIND_BACKWARD = 'Mfbw';
63 const uint32 MENU_SHOW_COLOR	= 'Mcol';
64 
65 const uint32 M_GET_DEVICE_NUM	= 'Mgdn';
66 
67 
68 // Preference Message
69 const ulong PSET__COLS		= 'pcol';
70 const ulong PSET__ROWS		= 'prow';
71 const ulong PSET__HFONT		= 'phfn';
72 const ulong PSET__HFONT_SIZE	= 'phfs';
73 const ulong PSET_FORE_COLOR	= 'pfcl';
74 const ulong PSET_BACK_COLOR	= 'pbcl';
75 const ulong PSET__CODING	= 'pcod';
76 
77 // Terminal Size Messages
78 const uint32 EIGHTYTWENTYFOUR 		= 'etfo';
79 const uint32 EIGHTYTWENTYFIVE 		= 'etfv';
80 const uint32 EIGHTYFORTY 			= 'efor';
81 const uint32 ONETHREETWOTWENTYFOUR 	= 'hunf';
82 const uint32 ONETHREETWOTWENTYFIVE 	= 'hunv';
83 const uint32 FULLSCREEN			= 'fscr';
84 
85 const uint32 MSG_FONT_CHANGED		= 'fntc';
86 const uint32 SAVE_AS_DEFAULT 		= 'sadf';
87 const uint32 MSG_CHECK_CHILDREN		= 'ckch';
88 const uint32 MSG_PREVIOUS_TAB		= 'ptab';
89 const uint32 MSG_NEXT_TAB			= 'ntab';
90 
91 const uint32 MSG_TERMINAL_BUFFER_CHANGED	= 'bufc';
92 const uint32 MSG_SET_TERMNAL_TITLE			= 'sett';
93 const uint32 MSG_QUIT_TERMNAL				= 'qutt';
94 
95 // Preference Read/Write Keys
96 const char* const PREF_HALF_FONT_FAMILY = "Half Font Family";
97 const char* const PREF_HALF_FONT_STYLE = "Half Font Style";
98 const char* const PREF_HALF_FONT_SIZE = "Half Font Size";
99 
100 const char* const PREF_TEXT_FORE_COLOR = "Text Foreground Color";
101 const char* const PREF_TEXT_BACK_COLOR = "Text Background Color";
102 const char* const PREF_SELECT_FORE_COLOR = "Selection Foreground Color";
103 const char* const PREF_SELECT_BACK_COLOR = "Selection Background Color";
104 const char* const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color";
105 const char* const PREF_CURSOR_BACK_COLOR = "Cursor Background Color";
106 
107 const char* const PREF_IM_FORE_COLOR = "IM Foreground Color";
108 const char* const PREF_IM_BACK_COLOR = "IM Background Color";
109 const char* const PREF_IM_SELECT_COLOR = "IM Selection Color";
110 
111 const char* const PREF_ANSI_BLACK_COLOR = "ANSI Black Color";
112 const char* const PREF_ANSI_RED_COLOR = "ANSI Red Color";
113 const char* const PREF_ANSI_GREEN_COLOR = "ANSI Green Color";
114 const char* const PREF_ANSI_YELLOW_COLOR = "ANSI Yellow Color";
115 const char* const PREF_ANSI_BLUE_COLOR = "ANSI Blue Color";
116 const char* const PREF_ANSI_MAGENTA_COLOR = "ANSI Magenta Color";
117 const char* const PREF_ANSI_CYAN_COLOR = "ANSI Cyan Color";
118 const char* const PREF_ANSI_WHITE_COLOR = "ANSI White Color";
119 
120 const char* const PREF_HISTORY_SIZE = "History Size";
121 const char* const PREF_CURSOR_BLINKING = "Cursor Blinking rate";
122 
123 const char* const PREF_IM_AWARE = "Input Method Aware";
124 
125 const char* const PREF_COLS = "Cols";
126 const char* const PREF_ROWS = "Rows";
127 const char* const PREF_SHELL = "Shell";
128 
129 const char* const PREF_TEXT_ENCODING = "Text encoding";
130 const char* const PREF_GUI_LANGUAGE = "Language";
131 
132 // Color type
133 enum {
134   TEXT_FOREGROUND_COLOR,
135   TEXT_BACKGROUND_COLOR,
136   SELECTION_FOREGROUND_COLOR,
137   SELECTION_BACKGROUND_COLOR
138 };
139 
140 // Preference Folder and setting path
141 
142 const int32 DEFAULT = -1;
143 
144 // Font Width
145 const int  HALF_WIDTH = 1;
146 const int  FULL_WIDTH = 2;
147 
148 // Scroll direction flag
149 enum{
150   SCRUP,
151   SCRDOWN
152 };
153 
154 #define MIN_COLS 10
155 #define MAX_COLS 256
156 #define MIN_ROWS 10
157 #define MAX_ROWS 256
158 
159 // Insert mode flag
160 #define MODE_OVER 0
161 #define MODE_INSERT 1
162 
163 // Define TermBuffer internal code
164 #define NO_CHAR 0x00
165 #define A_CHAR 0x01
166 #define IN_STRING 0xFF
167 
168 // TermBuffer extended attribute
169 #define A_WIDTH			0x8000
170 #define BOLD			0x4000
171 #define UNDERLINE		0x2000
172 #define INVERSE			0x1000
173 #define MOUSE			0x0800
174 #define FORESET			0x0400
175 #define BACKSET			0x0200
176 #define FONT			0x0100
177 #define RESERVE			0x0080
178 #define DUMPCR			0x0040
179 #define FORECOLOR		0x0038
180 #define BACKCOLOR		0x0007
181 #define CHAR_ATTRIBUTES	0x773f
182 
183 #define IS_WIDTH(x)	(((x) & A_WIDTH)   )
184 #define IS_BOLD(x)	(((x) & BOLD)      )
185 #define IS_UNDER(x)	(((x) & UNDERLINE) )
186 #define IS_INVERSE(x)	(((x) & INVERSE)   )
187 #define IS_MOUSE(x)	(((x) & MOUSE)     )
188 #define IS_FORESET(x)	(((x) & FORESET)   )
189 #define IS_BACKSET(x)	(((x) & BACKSET)   )
190 #define IS_FONT(x)	(((x) & FONT)      )
191 #define IS_CR(x)	(((x) & DUMPCR)	   )
192 #define IS_FORECOLOR(x) (((x) & FORECOLOR) >> 3)
193 #define IS_BACKCOLOR(x) (((x) & BACKCOLOR) )
194 
195 #define FORECOLORED(x) ((x) << 3)
196 #define BACKCOLORED(x) ((x) << 0)
197 
198 
199 #endif	// TERMCONST_H_INCLUDED
200