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_TREM = '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_AGAIN = 'Mfag'; 67 const uint32 MENU_SHOW_COLOR = 'Mcol'; 68 69 const uint32 M_GET_DEVICE_NUM = 'Mgdn'; 70 71 // Message Runner. 72 73 const uint32 MSGRUN_CURSOR = 'Rcur'; 74 const uint32 MSGRUN_WINDOW = 'Rwin'; 75 76 // Preference Message. 77 // 78 const ulong PSET__COLS = 'pcol'; 79 const ulong PSET__ROWS = 'prow'; 80 const ulong PSET__HFONT = 'phfn'; 81 const ulong PSET__FFONT = 'pffn'; 82 const ulong PSET__HFONT_SIZE = 'phfs'; 83 const ulong PSET__FFONT_SIZE = 'pffs'; 84 const ulong PSET_FORE_COLOR = 'pfcl'; 85 const ulong PSET_BACK_COLOR = 'pbcl'; 86 const ulong PSET__CODING = 'pcod'; 87 88 // Terminal Size Messages 89 const uint32 EIGHTYTWENTYFOUR = 'etfo'; 90 const uint32 EIGHTYTWENTYFIVE = 'etfv'; 91 const uint32 EIGHTYFORTY = 'efor'; 92 const uint32 ONETHREETWOTWENTYFOUR = 'hunf'; 93 const uint32 ONETHREETWOTWENTYFIVE = 'hunv'; 94 const uint32 FULLSCREEN = 'fscr'; 95 96 const uint32 MSG_FONT_CHANGED = 'fntc'; 97 98 const uint32 SAVE_AS_DEFAULT = 'sadf'; 99 100 //////////////////////////////////////////////////////////////////////////// 101 // Preference Read/Write Keys 102 //////////////////////////////////////////////////////////////////////////// 103 const char * const PREF_HALF_FONT_FAMILY = "Half Font Famly"; 104 const char * const PREF_HALF_FONT_STYLE = "Half Font Style"; 105 const char * const PREF_HALF_FONT_SIZE = "Half Font Size"; 106 107 const char * const PREF_FULL_FONT_FAMILY = "Full Font Famly"; 108 const char * const PREF_FULL_FONT_STYLE = "Full Font Style"; 109 const char * const PREF_FULL_FONT_SIZE = "Full Font Size"; 110 111 const char * const PREF_TEXT_FORE_COLOR = "Text Foreground Color"; 112 const char * const PREF_TEXT_BACK_COLOR = "Text Background Color"; 113 const char * const PREF_SELECT_FORE_COLOR = "Selection Foreground Color"; 114 const char * const PREF_SELECT_BACK_COLOR = "Selection Background Color"; 115 const char * const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color"; 116 const char * const PREF_CURSOR_BACK_COLOR = "Cursor Background Color"; 117 118 const char * const PREF_IM_FORE_COLOR = "IM Foreground Color"; 119 const char * const PREF_IM_BACK_COLOR = "IM Background Color"; 120 const char * const PREF_IM_SELECT_COLOR = "IM Selection Color"; 121 const char * const PREF_DRAGN_COPY = "Drag'n Copy"; 122 123 const char * const PREF_HISTORY_SIZE = "Histry Size"; 124 const char * const PREF_CURSOR_BLINKING = "Cursor Blinking rate"; 125 126 const char * const PREF_IM_AWARE = "Input Method Aware"; 127 const char * const PREF_MOUSE_IMAGE = "Cursor Image"; 128 129 const char * const PREF_SELECT_MBUTTON = "Select Region Buttion"; 130 const char * const PREF_SUBMENU_MBUTTON = "Submenu Mouse Button"; 131 const char * const PREF_PASTE_MBUTTON = "Paste Mouse Button"; 132 133 const char * const PREF_COLS = "Cols"; 134 const char * const PREF_ROWS = "Rows"; 135 const char * const PREF_SHELL = "Shell"; 136 137 const char * const PREF_TEXT_ENCODING = "Text encoding"; 138 const char * const PREF_GUI_LANGUAGE = "Language"; 139 140 //////////////////////////////////////////////////////////////////////////// 141 // Color type 142 //////////////////////////////////////////////////////////////////////////// 143 enum { 144 TEXT_FOREGROUND_COLOR, 145 TEXT_BACKGROUND_COLOR, 146 SELECTION_FOREGROUND_COLOR, 147 SELECTION_BACKGROUND_COLOR 148 }; 149 150 //////////////////////////////////////////////////////////////////////////// 151 // Preference Folder and setting path 152 //////////////////////////////////////////////////////////////////////////// 153 154 const int32 DEFAULT = -1; 155 156 //////////////////////////////////////////////////////////////////////////// 157 // 158 //////////////////////////////////////////////////////////////////////////// 159 /* Font Width */ 160 const int HALF_WIDTH = 1; 161 const int FULL_WIDTH = 2; 162 163 /* Scroll direction flag */ 164 enum{ 165 SCRUP, 166 SCRDOWN 167 }; 168 169 /* Insert mode flag */ 170 #define MODE_OVER 0 171 #define MODE_INSERT 1 172 173 const float VIEW_OFFSET = 3; 174 175 #define CURSOR_RECT \ 176 BRect r (fFontWidth * fCurPos.x, \ 177 fFontHeight * fCurPos.y + fTop, \ 178 fFontWidth * (fCurPos.x + 1) - 1, \ 179 fFontHeight * fCurPos.y + fTop + fCursorHeight - 1) 180 181 //////////////////////////////////////////////////////////////////////////// 182 // 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 0x0038 201 #define BACKCOLOR 0x0007 202 203 #define IS_WIDTH(x) (((x) & A_WIDTH) ) 204 #define IS_BOLD(x) (((x) & BOLD) ) 205 #define IS_UNDER(x) (((x) & UNDERLINE) ) 206 #define IS_INVERSE(x) (((x) & INVERSE) ) 207 #define IS_MOUSE(x) (((x) & MOUSE) ) 208 #define IS_FORESET(x) (((x) & FORESET) ) 209 #define IS_BACKSET(x) (((x) & BACKSET) ) 210 #define IS_FONT(x) (((x) & FONT) ) 211 #define IS_CR(x) (((x) & DUMPCR) ) 212 #define IS_FORECOLOR(x) (((x) & FORECOLOR) >> 3) 213 #define IS_BACKCOLOR(x) (((x) & BACKCOLOR) ) 214 215 #define FORECOLORED(x) ((x) << 3) 216 #define BACKCOLORED(x) ((x) << 0) 217 218 //////////////////////////////////////////////////////////////////////////// 219 // TypeDefs 220 //////////////////////////////////////////////////////////////////////////// 221 typedef unsigned short ushort; 222 223 typedef struct 224 { 225 int x1; 226 int y1; 227 int x2; 228 int y2; 229 } 230 sDrawRect; 231 232 233 234 #endif //TERMCONST_H_INCLUDED 235