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 95 const uint32 MSG_FONT_CHANGED = 'fntc'; 96 97 //////////////////////////////////////////////////////////////////////////// 98 // Preference Read/Write Keys 99 //////////////////////////////////////////////////////////////////////////// 100 const char * const PREF_HALF_FONT_FAMILY = "Half Font Famly"; 101 const char * const PREF_HALF_FONT_STYLE = "Half Font Style"; 102 const char * const PREF_HALF_FONT_SIZE = "Half Font Size"; 103 104 const char * const PREF_FULL_FONT_FAMILY = "Full Font Famly"; 105 const char * const PREF_FULL_FONT_STYLE = "Full Font Style"; 106 const char * const PREF_FULL_FONT_SIZE = "Full Font Size"; 107 108 const char * const PREF_TEXT_FORE_COLOR = "Text Foreground Color"; 109 const char * const PREF_TEXT_BACK_COLOR = "Text Background Color"; 110 const char * const PREF_SELECT_FORE_COLOR = "Selection Foreground Color"; 111 const char * const PREF_SELECT_BACK_COLOR = "Selection Background Color"; 112 const char * const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color"; 113 const char * const PREF_CURSOR_BACK_COLOR = "Cursor Background Color"; 114 115 const char * const PREF_IM_FORE_COLOR = "IM Foreground Color"; 116 const char * const PREF_IM_BACK_COLOR = "IM Background Color"; 117 const char * const PREF_IM_SELECT_COLOR = "IM Selection Color"; 118 const char * const PREF_DRAGN_COPY = "Drag'n Copy"; 119 120 const char * const PREF_HISTORY_SIZE = "Histry Size"; 121 const char * const PREF_CURSOR_BLINKING = "Cursor Blinking rate"; 122 123 const char * const PREF_IM_AWARE = "Input Method Aware"; 124 const char * const PREF_MOUSE_IMAGE = "Cursor Image"; 125 126 const char * const PREF_SELECT_MBUTTON = "Select Region Buttion"; 127 const char * const PREF_SUBMENU_MBUTTON = "Submenu Mouse Button"; 128 const char * const PREF_PASTE_MBUTTON = "Paste Mouse Button"; 129 130 const char * const PREF_COLS = "Cols"; 131 const char * const PREF_ROWS = "Rows"; 132 const char * const PREF_SHELL = "Shell"; 133 134 const char * const PREF_TEXT_ENCODING = "Text encoding"; 135 const char * const PREF_GUI_LANGUAGE = "Language"; 136 137 //////////////////////////////////////////////////////////////////////////// 138 // Color type 139 //////////////////////////////////////////////////////////////////////////// 140 enum { 141 TEXT_FOREGROUND_COLOR, 142 TEXT_BACKGROUND_COLOR, 143 SELECTION_FOREGROUND_COLOR, 144 SELECTION_BACKGROUND_COLOR 145 }; 146 147 //////////////////////////////////////////////////////////////////////////// 148 // Preference Folder and setting path 149 //////////////////////////////////////////////////////////////////////////// 150 151 const int32 DEFAULT = -1; 152 153 //////////////////////////////////////////////////////////////////////////// 154 // 155 //////////////////////////////////////////////////////////////////////////// 156 /* Font Width */ 157 const int HALF_WIDTH = 1; 158 const int FULL_WIDTH = 2; 159 160 /* Scroll direction flag */ 161 enum{ 162 SCRUP, 163 SCRDOWN 164 }; 165 166 /* Insert mode flag */ 167 #define MODE_OVER 0 168 #define MODE_INSERT 1 169 170 const float VIEW_OFFSET = 3; 171 172 #define CURSOR_RECT \ 173 BRect r (fFontWidth * fCurPos.x, \ 174 fFontHeight * fCurPos.y + fTop, \ 175 fFontWidth * (fCurPos.x + 1) - 1, \ 176 fFontHeight * fCurPos.y + fTop + fCursorHeight - 1) 177 178 //////////////////////////////////////////////////////////////////////////// 179 // 180 //////////////////////////////////////////////////////////////////////////// 181 /* Define TermBuffer internal code */ 182 #define NO_CHAR 0x00 183 #define A_CHAR 0x01 184 #define IN_STRING 0xFF 185 186 /* TermBuffer extended attribute */ 187 #define A_WIDTH 0x8000 188 #define BOLD 0x4000 189 #define UNDERLINE 0x2000 190 #define INVERSE 0x1000 191 #define MOUSE 0x0800 192 #define FORESET 0x0400 193 #define BACKSET 0x0200 194 #define FONT 0x0100 195 #define RESERVE 0x0080 196 #define DUMPCR 0x0040 197 #define FORECOLOR 0x0038 198 #define BACKCOLOR 0x0007 199 200 #define IS_WIDTH(x) (((x) & A_WIDTH) ) 201 #define IS_BOLD(x) (((x) & BOLD) ) 202 #define IS_UNDER(x) (((x) & UNDERLINE) ) 203 #define IS_INVERSE(x) (((x) & INVERSE) ) 204 #define IS_MOUSE(x) (((x) & MOUSE) ) 205 #define IS_FORESET(x) (((x) & FORESET) ) 206 #define IS_BACKSET(x) (((x) & BACKSET) ) 207 #define IS_FONT(x) (((x) & FONT) ) 208 #define IS_CR(x) (((x) & DUMPCR) ) 209 #define IS_FORECOLOR(x) (((x) & FORECOLOR) >> 3) 210 #define IS_BACKCOLOR(x) (((x) & BACKCOLOR) ) 211 212 #define FORECOLORED(x) ((x) << 3) 213 #define BACKCOLORED(x) ((x) << 0) 214 215 //////////////////////////////////////////////////////////////////////////// 216 // TypeDefs 217 //////////////////////////////////////////////////////////////////////////// 218 typedef unsigned short ushort; 219 220 typedef struct 221 { 222 int x1; 223 int y1; 224 int x2; 225 int y2; 226 } 227 sDrawRect; 228 229 230 231 #endif //TERMCONST_H_INCLUDED 232