xref: /haiku/src/apps/terminal/TermConst.h (revision 5115ca085884f7b604a3d607688f0ca20fb7cf57)
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 // Message constants for menu items
42 
43 // Menu Message
44 const uint32 MENU_SWITCH_TERM   = 'MSWT';
45 const uint32 MENU_NEW_TERM      = 'MNTE';
46 const uint32 MENU_PREF_OPEN     = 'MPre';
47 const uint32 MENU_CLEAR_ALL     = 'MCAl';
48 const uint32 MENU_HELP          = 'Mhlp';
49 const uint32 MENU_COMMAND_HELP  = 'Mchp';
50 const uint32 MENU_SHOW_GPL      = 'Mgpl';
51 const uint32 MENU_ENCODING      = 'Menc';
52 const uint32 MENU_PAGE_SETUP    = 'Mpst';
53 const uint32 MENU_PRINT         = 'Mpnt';
54 const uint32 MENU_FIND_STRING   = 'Mfnd';
55 const uint32 MENU_FIND_FORWARD  = 'Mffw';
56 const uint32 MENU_FIND_BACKWARD = 'Mfbw';
57 const uint32 MENU_SHOW_COLOR	= 'Mcol';
58 
59 const uint32 M_GET_DEVICE_NUM	= 'Mgdn';
60 
61 // Message Runner
62 const uint32 MSGRUN_CURSOR	= 'Rcur';
63 const uint32 MSGRUN_WINDOW	= 'Rwin';
64 
65 // Preference Message
66 const ulong PSET__COLS		= 'pcol';
67 const ulong PSET__ROWS		= 'prow';
68 const ulong PSET__HFONT		= 'phfn';
69 const ulong PSET__FFONT		= 'pffn';
70 const ulong PSET__HFONT_SIZE	= 'phfs';
71 const ulong PSET__FFONT_SIZE	= 'pffs';
72 const ulong PSET_FORE_COLOR	= 'pfcl';
73 const ulong PSET_BACK_COLOR	= 'pbcl';
74 const ulong PSET__CODING	= 'pcod';
75 
76 // Terminal Size Messages
77 const uint32 EIGHTYTWENTYFOUR 		= 'etfo';
78 const uint32 EIGHTYTWENTYFIVE 		= 'etfv';
79 const uint32 EIGHTYFORTY 			= 'efor';
80 const uint32 ONETHREETWOTWENTYFOUR 	= 'hunf';
81 const uint32 ONETHREETWOTWENTYFIVE 	= 'hunv';
82 const uint32 FULLSCREEN			= 'fscr';
83 
84 const uint32 MSG_FONT_CHANGED		= 'fntc';
85 const uint32 SAVE_AS_DEFAULT 		= 'sadf';
86 
87 // Preference Read/Write Keys
88 const char* const PREF_HALF_FONT_FAMILY = "Half Font Famly";
89 const char* const PREF_HALF_FONT_STYLE = "Half Font Style";
90 const char* const PREF_HALF_FONT_SIZE = "Half Font Size";
91 
92 const char* const PREF_FULL_FONT_FAMILY = "Full Font Famly";
93 const char* const PREF_FULL_FONT_STYLE = "Full Font Style";
94 const char* const PREF_FULL_FONT_SIZE = "Full Font Size";
95 
96 const char* const PREF_TEXT_FORE_COLOR = "Text Foreground Color";
97 const char* const PREF_TEXT_BACK_COLOR = "Text Background Color";
98 const char* const PREF_SELECT_FORE_COLOR = "Selection Foreground Color";
99 const char* const PREF_SELECT_BACK_COLOR = "Selection Background Color";
100 const char* const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color";
101 const char* const PREF_CURSOR_BACK_COLOR = "Cursor Background Color";
102 
103 const char* const PREF_IM_FORE_COLOR = "IM Foreground Color";
104 const char* const PREF_IM_BACK_COLOR = "IM Background Color";
105 const char* const PREF_IM_SELECT_COLOR = "IM Selection Color";
106 const char* const PREF_DRAGN_COPY = "Drag'n Copy";
107 
108 const char* const PREF_HISTORY_SIZE = "Histry Size";
109 const char* const PREF_CURSOR_BLINKING = "Cursor Blinking rate";
110 
111 const char* const PREF_IM_AWARE = "Input Method Aware";
112 const char* const PREF_MOUSE_IMAGE = "Cursor Image";
113 
114 const char* const PREF_COLS = "Cols";
115 const char* const PREF_ROWS = "Rows";
116 const char* const PREF_SHELL = "Shell";
117 
118 const char* const PREF_TEXT_ENCODING = "Text encoding";
119 const char* const PREF_GUI_LANGUAGE = "Language";
120 
121 // Color type
122 enum {
123   TEXT_FOREGROUND_COLOR,
124   TEXT_BACKGROUND_COLOR,
125   SELECTION_FOREGROUND_COLOR,
126   SELECTION_BACKGROUND_COLOR
127 };
128 
129 // Preference Folder and setting path
130 
131 const int32 DEFAULT = -1;
132 
133 // Font Width
134 const int  HALF_WIDTH = 1;
135 const int  FULL_WIDTH = 2;
136 
137 // Scroll direction flag
138 enum{
139   SCRUP,
140   SCRDOWN
141 };
142 
143 // Insert mode flag
144 #define MODE_OVER 0
145 #define MODE_INSERT 1
146 
147 const float VIEW_OFFSET = 3;
148 
149 #define CURSOR_RECT \
150 	BRect r (fFontWidth * fCurPos.x, \
151 		 fFontHeight * fCurPos.y + fTop, \
152 		 fFontWidth * (fCurPos.x + 1) - 1, \
153 		 fFontHeight * fCurPos.y + fTop + fCursorHeight - 1)
154 
155 // Define TermBuffer internal code
156 #define NO_CHAR 0x00
157 #define A_CHAR 0x01
158 #define IN_STRING 0xFF
159 
160 // TermBuffer extended attribute
161 #define A_WIDTH		0x8000
162 #define BOLD		0x4000
163 #define UNDERLINE	0x2000
164 #define INVERSE		0x1000
165 #define MOUSE		0x0800
166 #define FORESET		0x0400
167 #define BACKSET		0x0200
168 #define FONT		0x0100
169 #define RESERVE		0x0080
170 #define DUMPCR		0x0040
171 #define FORECOLOR	0x0038
172 #define BACKCOLOR	0x0007
173 
174 #define IS_WIDTH(x)	(((x) & A_WIDTH)   )
175 #define IS_BOLD(x)	(((x) & BOLD)      )
176 #define IS_UNDER(x)	(((x) & UNDERLINE) )
177 #define IS_INVERSE(x)	(((x) & INVERSE)   )
178 #define IS_MOUSE(x)	(((x) & MOUSE)     )
179 #define IS_FORESET(x)	(((x) & FORESET)   )
180 #define IS_BACKSET(x)	(((x) & BACKSET)   )
181 #define IS_FONT(x)	(((x) & FONT)      )
182 #define IS_CR(x)	(((x) & DUMPCR)	   )
183 #define IS_FORECOLOR(x) (((x) & FORECOLOR) >> 3)
184 #define IS_BACKCOLOR(x) (((x) & BACKCOLOR) )
185 
186 #define FORECOLORED(x) ((x) << 3)
187 #define BACKCOLORED(x) ((x) << 0)
188 
189 // TypeDefs
190 typedef unsigned short ushort;
191 
192 typedef struct {
193   int x1;
194   int y1;
195   int x2;
196   int y2;
197 } sDrawRect;
198 
199 #endif	// TERMCONST_H_INCLUDED
200