xref: /haiku/src/apps/terminal/TermConst.h (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
1 /*
2  * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
3  * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files or portions
7  * thereof (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so, subject
11  * to the following conditions:
12  *
13  *  * Redistributions of source code must retain the above copyright notice,
14  *    this list of conditions and the following disclaimer.
15  *
16  *  * Redistributions in binary form must reproduce the above copyright notice
17  *    in the  binary, as well as this list of conditions and the following
18  *    disclaimer in the documentation and/or other materials provided with
19  *    the distribution.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27  * THE SOFTWARE.
28  *
29  */
30 #ifndef TERMCONST_H_INCLUDED
31 #define TERMCONST_H_INCLUDED
32 
33 #ifndef NODEBUG
34 #define MALLOC_DEBUG
35 #endif
36 
37 //////////////////////////////////////////////////////////////////////////////
38 // Application signature (Must same in Muterminal.rsrc)//
39 //////////////////////////////////////////////////////////////////////////////
40 #define TERM_SIGNATURE "application/x-vnd.Haiku-Terminal"
41 #define PREFFILE_MIMETYPE "text/x-terminal-pref"
42 
43 //////////////////////////////////////////////////////////////////////////////
44 // Signature of R5's Terminal. Needed for proper drop-in window count support
45 //////////////////////////////////////////////////////////////////////////////
46 #define R5_TERM_SIGNATURE "application/x-vnd.Be-SHEL"
47 
48 //////////////////////////////////////////////////////////////////////////////
49 // Message constants for menu items.
50 //////////////////////////////////////////////////////////////////////////////
51 
52 // Menu Message.
53 //
54 const uint32 MENU_SWITCH_TERM   = 'MSWT';
55 const uint32 MENU_NEW_TERM      = 'MNTE';
56 const uint32 MENU_PREF_OPEN     = 'MPre';
57 const uint32 MENU_FILE_QUIT     = 'MFqu';
58 const uint32 MENU_CLEAR_ALL     = 'MCAl';
59 const uint32 MENU_HELP          = 'Mhlp';
60 const uint32 MENU_COMMAND_HELP  = 'Mchp';
61 const uint32 MENU_SHOW_GPL      = 'Mgpl';
62 const uint32 MENU_ENCODING      = 'Menc';
63 const uint32 MENU_PAGE_SETUP    = 'Mpst';
64 const uint32 MENU_PRINT         = 'Mpnt';
65 const uint32 MENU_FIND_STRING   = 'Mfnd';
66 const uint32 MENU_FIND_FORWARD  = 'Mffw';
67 const uint32 MENU_FIND_BACKWARD = 'Mfbw';
68 const uint32 MENU_SHOW_COLOR	= 'Mcol';
69 
70 const uint32 M_GET_DEVICE_NUM	= 'Mgdn';
71 
72 // Message Runner.
73 
74 const uint32 MSGRUN_CURSOR	= 'Rcur';
75 const uint32 MSGRUN_WINDOW	= 'Rwin';
76 
77 // Preference Message.
78 //
79 const ulong PSET__COLS		= 'pcol';
80 const ulong PSET__ROWS		= 'prow';
81 const ulong PSET__HFONT		= 'phfn';
82 const ulong PSET__FFONT		= 'pffn';
83 const ulong PSET__HFONT_SIZE	= 'phfs';
84 const ulong PSET__FFONT_SIZE	= 'pffs';
85 const ulong PSET_FORE_COLOR	= 'pfcl';
86 const ulong PSET_BACK_COLOR	= 'pbcl';
87 const ulong PSET__CODING	= 'pcod';
88 
89 // Terminal Size Messages
90 const uint32 EIGHTYTWENTYFOUR 		= 'etfo';
91 const uint32 EIGHTYTWENTYFIVE 		= 'etfv';
92 const uint32 EIGHTYFORTY 			= 'efor';
93 const uint32 ONETHREETWOTWENTYFOUR 	= 'hunf';
94 const uint32 ONETHREETWOTWENTYFIVE 	= 'hunv';
95 const uint32 FULLSCREEN			= 'fscr';
96 
97 const uint32 MSG_FONT_CHANGED		= 'fntc';
98 
99 const uint32 SAVE_AS_DEFAULT 		= 'sadf';
100 
101 ////////////////////////////////////////////////////////////////////////////
102 // Preference Read/Write Keys
103 ////////////////////////////////////////////////////////////////////////////
104 const char * const PREF_HALF_FONT_FAMILY = "Half Font Famly";
105 const char * const PREF_HALF_FONT_STYLE = "Half Font Style";
106 const char * const PREF_HALF_FONT_SIZE = "Half Font Size";
107 
108 const char * const PREF_FULL_FONT_FAMILY = "Full Font Famly";
109 const char * const PREF_FULL_FONT_STYLE = "Full Font Style";
110 const char * const PREF_FULL_FONT_SIZE = "Full Font Size";
111 
112 const char * const PREF_TEXT_FORE_COLOR = "Text Foreground Color";
113 const char * const PREF_TEXT_BACK_COLOR = "Text Background Color";
114 const char * const PREF_SELECT_FORE_COLOR = "Selection Foreground Color";
115 const char * const PREF_SELECT_BACK_COLOR = "Selection Background Color";
116 const char * const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color";
117 const char * const PREF_CURSOR_BACK_COLOR = "Cursor Background Color";
118 
119 const char * const PREF_IM_FORE_COLOR = "IM Foreground Color";
120 const char * const PREF_IM_BACK_COLOR = "IM Background Color";
121 const char * const PREF_IM_SELECT_COLOR = "IM Selection Color";
122 const char * const PREF_DRAGN_COPY = "Drag'n Copy";
123 
124 const char * const PREF_HISTORY_SIZE = "Histry Size";
125 const char * const PREF_CURSOR_BLINKING = "Cursor Blinking rate";
126 
127 const char * const PREF_IM_AWARE = "Input Method Aware";
128 const char * const PREF_MOUSE_IMAGE = "Cursor Image";
129 
130 const char * const PREF_SELECT_MBUTTON = "Select Region Buttion";
131 const char * const PREF_SUBMENU_MBUTTON = "Submenu Mouse Button";
132 const char * const PREF_PASTE_MBUTTON = "Paste Mouse Button";
133 
134 const char * const PREF_COLS = "Cols";
135 const char * const PREF_ROWS = "Rows";
136 const char * const PREF_SHELL = "Shell";
137 
138 const char * const PREF_TEXT_ENCODING = "Text encoding";
139 const char * const PREF_GUI_LANGUAGE = "Language";
140 
141 ////////////////////////////////////////////////////////////////////////////
142 // Color type
143 ////////////////////////////////////////////////////////////////////////////
144 enum {
145   TEXT_FOREGROUND_COLOR,
146   TEXT_BACKGROUND_COLOR,
147   SELECTION_FOREGROUND_COLOR,
148   SELECTION_BACKGROUND_COLOR
149 };
150 
151 ////////////////////////////////////////////////////////////////////////////
152 // Preference Folder and setting path
153 ////////////////////////////////////////////////////////////////////////////
154 
155 const int32 DEFAULT = -1;
156 
157 ////////////////////////////////////////////////////////////////////////////
158 //
159 ////////////////////////////////////////////////////////////////////////////
160 /* Font Width */
161 const int  HALF_WIDTH = 1;
162 const int  FULL_WIDTH = 2;
163 
164 /* Scroll direction flag */
165 enum{
166   SCRUP,
167   SCRDOWN
168 };
169 
170 /* Insert mode flag */
171 #define MODE_OVER 0
172 #define MODE_INSERT 1
173 
174 const float VIEW_OFFSET = 3;
175 
176 #define CURSOR_RECT \
177 	BRect r (fFontWidth * fCurPos.x, \
178 		 fFontHeight * fCurPos.y + fTop, \
179 		 fFontWidth * (fCurPos.x + 1) - 1, \
180 		 fFontHeight * fCurPos.y + fTop + fCursorHeight - 1)
181 
182 ////////////////////////////////////////////////////////////////////////////
183 //
184 ////////////////////////////////////////////////////////////////////////////
185 /* Define TermBuffer internal code */
186 #define NO_CHAR 0x00
187 #define A_CHAR 0x01
188 #define IN_STRING 0xFF
189 
190 /* TermBuffer extended attribute */
191 #define A_WIDTH		0x8000
192 #define BOLD		0x4000
193 #define UNDERLINE	0x2000
194 #define INVERSE		0x1000
195 #define MOUSE		0x0800
196 #define FORESET		0x0400
197 #define BACKSET		0x0200
198 #define FONT		0x0100
199 #define RESERVE		0x0080
200 #define DUMPCR		0x0040
201 #define FORECOLOR	0x0038
202 #define BACKCOLOR	0x0007
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) >> 3)
214 #define IS_BACKCOLOR(x) (((x) & BACKCOLOR) )
215 
216 #define FORECOLORED(x) ((x) << 3)
217 #define BACKCOLORED(x) ((x) << 0)
218 
219 ////////////////////////////////////////////////////////////////////////////
220 // TypeDefs
221 ////////////////////////////////////////////////////////////////////////////
222 typedef unsigned short ushort;
223 
224 typedef struct
225 {
226   int x1;
227   int y1;
228   int x2;
229   int y2;
230 }
231 sDrawRect;
232 
233 
234 
235 #endif //TERMCONST_H_INCLUDED
236