| 1 | #ifndef ED4_DEFS_HXX |
|---|
| 2 | #define ED4_DEFS_HXX |
|---|
| 3 | |
|---|
| 4 | #ifndef AW_COLOR_GROUPS_HXX |
|---|
| 5 | #include <aw_color_groups.hxx> |
|---|
| 6 | #endif |
|---|
| 7 | #ifndef AW_WINDOW_HXX |
|---|
| 8 | #include <aw_window.hxx> |
|---|
| 9 | #endif |
|---|
| 10 | #ifndef ARBDB_H |
|---|
| 11 | #include <arbdb.h> |
|---|
| 12 | #endif |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | //needed prototype classes |
|---|
| 16 | class ED4_root; |
|---|
| 17 | class ED4_database; |
|---|
| 18 | |
|---|
| 19 | typedef const char ED4_ERROR; |
|---|
| 20 | typedef int ED4_COORDINATE; |
|---|
| 21 | |
|---|
| 22 | typedef enum ad_edit_modus { |
|---|
| 23 | AD_ALIGN, // add & remove of . possible (default) |
|---|
| 24 | AD_NOWRITE, // no edits allowed |
|---|
| 25 | AD_NOWRITE_IF_COMPRESSED, |
|---|
| 26 | AD_REPLACE, // all edits (overwrite) |
|---|
| 27 | AD_INSERT // all edits (insert) |
|---|
| 28 | } ED4_EDITMODI; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | //global variables |
|---|
| 32 | extern GBDATA *GLOBAL_gb_main; |
|---|
| 33 | extern ED4_root *ED4_ROOT; |
|---|
| 34 | extern ED4_database *main_db; |
|---|
| 35 | |
|---|
| 36 | extern int TERMINALHEIGHT; // this variable replaces the define |
|---|
| 37 | extern int INFO_TERM_TEXT_YOFFSET; |
|---|
| 38 | extern int SEQ_TERM_TEXT_YOFFSET; |
|---|
| 39 | |
|---|
| 40 | extern int MAXSEQUENCECHARACTERLENGTH; // greatest # of characters in a sequence string terminal |
|---|
| 41 | extern int MAXSPECIESWIDTH; |
|---|
| 42 | extern int MAXINFOWIDTH; |
|---|
| 43 | extern long ED4_counter; |
|---|
| 44 | extern long all_found; // nr of species which haven't been found |
|---|
| 45 | extern long species_read; // nr of species read; important during loading |
|---|
| 46 | extern GBS_strstruct *not_found_message; |
|---|
| 47 | extern long max_seq_terminal_length; // global maximum of sequence terminal length |
|---|
| 48 | extern ED4_EDITMODI awar_edit_modus; |
|---|
| 49 | extern long awar_edit_direction; |
|---|
| 50 | extern bool move_cursor; //only needed for editing in consensus |
|---|
| 51 | extern bool DRAW; |
|---|
| 52 | extern bool last_window_reached; //only needed for refreshing all windows |
|---|
| 53 | |
|---|
| 54 | extern size_t status_count_total; // used for consensus progress bar |
|---|
| 55 | extern size_t status_count_curr; |
|---|
| 56 | |
|---|
| 57 | extern bool loading; |
|---|
| 58 | |
|---|
| 59 | // globally used defines and flags |
|---|
| 60 | |
|---|
| 61 | #define INFINITE -1 |
|---|
| 62 | #define SLIDER_OFFSET 5 |
|---|
| 63 | |
|---|
| 64 | // these are recommended for accessing ED4_extension: |
|---|
| 65 | #define X_POS 0 |
|---|
| 66 | #define Y_POS 1 |
|---|
| 67 | #define WIDTH 0 |
|---|
| 68 | #define HEIGHT 1 |
|---|
| 69 | |
|---|
| 70 | // size of some display elements: |
|---|
| 71 | #define BRACKETWIDTH 10 |
|---|
| 72 | #define SPACERHEIGHT 5 |
|---|
| 73 | #define SPACERNOCONSENSUSHEIGHT 15 // height of spacer at top of group (used if consensus is hidden and group is folded) |
|---|
| 74 | #define SEQUENCEINFOSIZE 50 |
|---|
| 75 | #define TREETERMINALSIZE 100 |
|---|
| 76 | |
|---|
| 77 | #define COLUMN_STAT_ROW_HEIGHT(font_height) (2.2*(font_height)) // each row contains 2 sub-rows (plus some xtra space) |
|---|
| 78 | #define COLUMN_STAT_ROWS 4 |
|---|
| 79 | |
|---|
| 80 | #define MAX_POSSIBLE_SEQ_LENGTH 100000000 |
|---|
| 81 | |
|---|
| 82 | #define MAXCHARTABLE 256 // Maximum of Consensustable |
|---|
| 83 | #define MAXWINDOWS 5 |
|---|
| 84 | #define MINSPECFORSTATWIN 200 |
|---|
| 85 | |
|---|
| 86 | #define AWAR_EDIT_MODE "tmp/edit4/edit_mode" |
|---|
| 87 | #define AWAR_INSERT_MODE "tmp/edit4/insert_mode" |
|---|
| 88 | #define AWAR_EDIT_SECURITY_LEVEL "tmp/edit4/security_level" |
|---|
| 89 | #define AWAR_EDIT_SECURITY_LEVEL_ALIGN "tmp/edit4/security_level_align" |
|---|
| 90 | #define AWAR_EDIT_SECURITY_LEVEL_CHANGE "tmp/edit4/security_level_change" |
|---|
| 91 | #define AWAR_EDIT_CONFIGURATION "tmp/edit4/configuration" |
|---|
| 92 | |
|---|
| 93 | #define AWAR_EDIT_SEQ_POSITION "tmp/edit4/jump_to_position%d" // used to create ED4_window.awar_path_for_cursor[] |
|---|
| 94 | #define AWAR_EDIT_ECOLI_POSITION "tmp/edit4/cursor_ref_ecoli%d" // used to create ED4_window.awar_path_for_Ecoli[] |
|---|
| 95 | #define AWAR_EDIT_BASE_POSITION "tmp/edit4/cursor_to_basepos%d" // used to create ED4_window.awar_path_for_basePos[] |
|---|
| 96 | #define AWAR_EDIT_IUPAC "tmp/edit4/iupac%d" // used to create ED4_window.awar_path_for_IUPAC[] |
|---|
| 97 | #define AWAR_EDIT_HELIXNR "tmp/edit4/helixnr%d" // used to create ED4_window.awar_path_for_helixNr[] |
|---|
| 98 | |
|---|
| 99 | #define AWAR_FIELD_CHOSEN "tmp/edit4/field_chosen" // used for field selection box |
|---|
| 100 | |
|---|
| 101 | #define AWAR_EDIT_TITLE_MODE "edit4/title_mode" |
|---|
| 102 | #define AWAR_EDIT_HELIX_SPACING "edit4/helix_add_spacing" |
|---|
| 103 | #define AWAR_EDIT_TERMINAL_SPACING "edit4/terminal_add_spacing" |
|---|
| 104 | |
|---|
| 105 | #define CHARACTEROFFSET 5 // spacer-width left of text-terminal |
|---|
| 106 | #define CONSENSUS "Consensusfunktion" |
|---|
| 107 | |
|---|
| 108 | #define ED4_index long |
|---|
| 109 | |
|---|
| 110 | inline int max(int x, int y) { return x>y ? x : y; } |
|---|
| 111 | inline int min(int x, int y) { return x<y ? x : y; } |
|---|
| 112 | inline int ABS(int x) { return x<0 ? -x : x; } |
|---|
| 113 | |
|---|
| 114 | #define ED4_SCROLL_OVERLAP 20 // 15 Pixels overlap |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | typedef enum |
|---|
| 118 | { |
|---|
| 119 | ED4_L_NO_LEVEL = 0x0, |
|---|
| 120 | ED4_L_ROOT = 0x1, |
|---|
| 121 | ED4_L_DEVICE = 0x2, |
|---|
| 122 | ED4_L_AREA = 0x4, |
|---|
| 123 | ED4_L_MULTI_SPECIES = 0x8, |
|---|
| 124 | ED4_L_SPECIES = 0x10, |
|---|
| 125 | ED4_L_MULTI_SEQUENCE = 0x20, |
|---|
| 126 | ED4_L_SEQUENCE = 0x40, |
|---|
| 127 | ED4_L_TREE = 0x80, |
|---|
| 128 | ED4_L_SPECIES_NAME = 0x100, |
|---|
| 129 | ED4_L_SEQUENCE_INFO = 0x200, //evtl. aendern fuer Name-Manager und group-manager |
|---|
| 130 | ED4_L_SEQUENCE_STRING = 0x400, |
|---|
| 131 | ED4_L_AA_SEQUENCE_STRING = 0x600, //ykadi |
|---|
| 132 | ED4_L_SPACER = 0x800, |
|---|
| 133 | ED4_L_LINE = 0x1000, |
|---|
| 134 | ED4_L_MULTI_NAME = 0x2000, |
|---|
| 135 | ED4_L_NAME_MANAGER = 0x4000, |
|---|
| 136 | ED4_L_GROUP = 0x8000, |
|---|
| 137 | ED4_L_BRACKET = 0x10000, |
|---|
| 138 | ED4_L_PURE_TEXT = 0x20000, |
|---|
| 139 | ED4_L_COL_STAT = 0x40000 |
|---|
| 140 | } ED4_level; |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | typedef enum |
|---|
| 145 | { |
|---|
| 146 | ED4_D_SPECIES, |
|---|
| 147 | ED4_D_EXTENDED |
|---|
| 148 | } ED4_datamode; |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | typedef enum |
|---|
| 152 | { |
|---|
| 153 | ED4_M_NO_MOVE = 0, |
|---|
| 154 | ED4_M_HORIZONTAL = 1, |
|---|
| 155 | ED4_M_VERTICAL = 2, |
|---|
| 156 | ED4_M_FREE = 4 |
|---|
| 157 | } ED4_movemode; |
|---|
| 158 | |
|---|
| 159 | typedef enum |
|---|
| 160 | { |
|---|
| 161 | ED4_R_OK = 0, |
|---|
| 162 | ED4_R_WARNING = 1, |
|---|
| 163 | ED4_R_IMPOSSIBLE = 2, |
|---|
| 164 | ED4_R_ERROR = 4, |
|---|
| 165 | ED4_R_BREAK = 8, |
|---|
| 166 | ED4_R_DESASTER = 16, |
|---|
| 167 | ED4_R_ALL = 0x7fffffff |
|---|
| 168 | } ED4_returncode; |
|---|
| 169 | |
|---|
| 170 | typedef enum |
|---|
| 171 | { |
|---|
| 172 | ED4_A_TOP_AREA, |
|---|
| 173 | ED4_A_MIDDLE_AREA, |
|---|
| 174 | ED4_A_BOTTOM_AREA, |
|---|
| 175 | ED4_A_ERROR |
|---|
| 176 | } ED4_AREA_LEVEL; |
|---|
| 177 | |
|---|
| 178 | typedef enum |
|---|
| 179 | { |
|---|
| 180 | ED4_B_LEFT_BUTTON = 1, |
|---|
| 181 | ED4_B_MIDDLE_BUTTON = 2, |
|---|
| 182 | ED4_B_RIGHT_BUTTON = 3 |
|---|
| 183 | } ED4_mouse_buttons; |
|---|
| 184 | |
|---|
| 185 | typedef enum |
|---|
| 186 | { |
|---|
| 187 | ED4_P_NO_PROP = 0, |
|---|
| 188 | ED4_P_IS_MANAGER = 1, |
|---|
| 189 | ED4_P_IS_TERMINAL = 2, |
|---|
| 190 | ED4_P_HORIZONTAL = 4, |
|---|
| 191 | ED4_P_VERTICAL = 8, |
|---|
| 192 | ED4_P_TMP = 16, |
|---|
| 193 | ED4_P_SELECTABLE = 32, |
|---|
| 194 | ED4_P_DRAGABLE = 64, |
|---|
| 195 | ED4_P_MOVABLE = 128, |
|---|
| 196 | ED4_P_IS_HANDLE = 256, |
|---|
| 197 | ED4_P_CURSOR_ALLOWED = 512, |
|---|
| 198 | // ED4_P_ = 1024, |
|---|
| 199 | // ED4_P_ = 2048, |
|---|
| 200 | ED4_P_IS_FOLDED = 4096, // Flag whether group is folded or not |
|---|
| 201 | ED4_P_CONSENSUS_RELEVANT= 8192, // contains information relevant for consensus |
|---|
| 202 | ED4_P_ALIGNMENT_DATA= 16384, // contains aligned data (also SAIs) |
|---|
| 203 | ED4_P_ALL = 0x7fffffff |
|---|
| 204 | } ED4_properties; |
|---|
| 205 | |
|---|
| 206 | typedef enum |
|---|
| 207 | { |
|---|
| 208 | ED4_C_UP, |
|---|
| 209 | ED4_C_DOWN, |
|---|
| 210 | ED4_C_LEFT, |
|---|
| 211 | ED4_C_RIGHT, |
|---|
| 212 | ED4_C_NONE |
|---|
| 213 | } ED4_cursor_move; |
|---|
| 214 | |
|---|
| 215 | typedef enum |
|---|
| 216 | { |
|---|
| 217 | ED4_U_UP = 0, |
|---|
| 218 | ED4_U_UP_DOWN |
|---|
| 219 | } ED4_update_flag; |
|---|
| 220 | |
|---|
| 221 | typedef enum |
|---|
| 222 | { |
|---|
| 223 | ED4_B_BORDER, |
|---|
| 224 | ED4_B_INDENT, |
|---|
| 225 | ED4_B_BOTTOM_AREA |
|---|
| 226 | } ED4_border_flag; |
|---|
| 227 | |
|---|
| 228 | typedef enum |
|---|
| 229 | { |
|---|
| 230 | ED4_K_ADD, |
|---|
| 231 | ED4_K_SUB |
|---|
| 232 | } ED4_consensus; |
|---|
| 233 | |
|---|
| 234 | typedef enum |
|---|
| 235 | { |
|---|
| 236 | ED4_A_DEFAULT, |
|---|
| 237 | ED4_A_CONTAINER |
|---|
| 238 | } ED4_alignment; |
|---|
| 239 | |
|---|
| 240 | typedef enum |
|---|
| 241 | { |
|---|
| 242 | ED4_AA_FRWD_1, |
|---|
| 243 | ED4_AA_FRWD_2, |
|---|
| 244 | ED4_AA_FRWD_3, |
|---|
| 245 | ED4_AA_RVRS_1, |
|---|
| 246 | ED4_AA_RVRS_2, |
|---|
| 247 | ED4_AA_RVRS_3, |
|---|
| 248 | ED4_AA_DB_FIELD |
|---|
| 249 | } ED4_aa_seq_flag; |
|---|
| 250 | |
|---|
| 251 | typedef enum |
|---|
| 252 | { |
|---|
| 253 | ED4_D_VERTICAL, |
|---|
| 254 | ED4_D_HORIZONTAL, |
|---|
| 255 | ED4_D_ALL_DIRECTION, |
|---|
| 256 | ED4_D_VERTICAL_ALL |
|---|
| 257 | } ED4_direction; |
|---|
| 258 | |
|---|
| 259 | |
|---|
| 260 | class ED4_base; |
|---|
| 261 | class ED4_terminal; |
|---|
| 262 | |
|---|
| 263 | struct ED4_move_info |
|---|
| 264 | { |
|---|
| 265 | ED4_base *object; // object to be moved |
|---|
| 266 | AW_pos end_x, end_y; // position to move to |
|---|
| 267 | ED4_movemode mode; // move mode |
|---|
| 268 | ED4_level preferred_parent; // level to move to |
|---|
| 269 | }; |
|---|
| 270 | |
|---|
| 271 | struct ED4_selection_entry |
|---|
| 272 | { |
|---|
| 273 | AW_pos drag_off_x, drag_off_y; |
|---|
| 274 | AW_pos drag_old_x, drag_old_y; |
|---|
| 275 | AW_pos actual_width, actual_height; |
|---|
| 276 | int old_event_y; |
|---|
| 277 | ED4_terminal *object; |
|---|
| 278 | }; |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | |
|---|
| 282 | struct ED4_extension // contains info about graphical properties |
|---|
| 283 | { |
|---|
| 284 | AW_pos position[2]; // upper left corner (pos_x, pos_y) in relation to parent |
|---|
| 285 | // !!! WARNING: This is a hack!!! Every time you change 'position' you HAVE TO call ED4_base::touch_world_cache() !!! |
|---|
| 286 | |
|---|
| 287 | AW_pos size[2]; // width and height |
|---|
| 288 | ED4_index y_folded; // remember old position of consensus when folding group |
|---|
| 289 | |
|---|
| 290 | #if defined(IMPLEMENT_DUMP) |
|---|
| 291 | void dump(size_t indent) const; |
|---|
| 292 | #endif // IMPLEMENT_DUMP |
|---|
| 293 | }; |
|---|
| 294 | |
|---|
| 295 | struct ED4_scroll_picture |
|---|
| 296 | { |
|---|
| 297 | bool scroll; |
|---|
| 298 | long old_x; |
|---|
| 299 | long old_y; |
|---|
| 300 | }; |
|---|
| 301 | |
|---|
| 302 | enum ED4_CursorJumpType { |
|---|
| 303 | ED4_JUMP_CENTERED, // centers the cursor |
|---|
| 304 | ED4_JUMP_KEEP_VISIBLE, // keeps the cursor visible (keeps a fixed margin) |
|---|
| 305 | ED4_JUMP_KEEP_POSITION, // paint cursor at previous position |
|---|
| 306 | }; |
|---|
| 307 | |
|---|
| 308 | struct ED4_work_info |
|---|
| 309 | { |
|---|
| 310 | AW_event event; |
|---|
| 311 | GBDATA *gb_data; |
|---|
| 312 | char *string; // pointer to consensus; only if editing the consensus |
|---|
| 313 | long char_position; // screen position after cursor |
|---|
| 314 | |
|---|
| 315 | int direction; // contains direction of editing (-1 left, +1 right ) |
|---|
| 316 | ED4_EDITMODI mode; |
|---|
| 317 | |
|---|
| 318 | bool is_sequence; // ==1 -> special handling for sequences |
|---|
| 319 | bool cannot_handle; // if TRUE than cannot edit |
|---|
| 320 | |
|---|
| 321 | ED4_CursorJumpType cursor_jump; |
|---|
| 322 | bool refresh_needed; |
|---|
| 323 | |
|---|
| 324 | long out_seq_position; // sequence position (after editing) |
|---|
| 325 | |
|---|
| 326 | char *out_string; // nur falls new malloc |
|---|
| 327 | char *error; |
|---|
| 328 | |
|---|
| 329 | int repeat_count; // only for keystrokes: contains # of times key should be repeated |
|---|
| 330 | |
|---|
| 331 | ED4_terminal *working_terminal; // this contains the terminal |
|---|
| 332 | }; |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | struct ED4_update_info // if you add new elements, please ensure to initialize them in ED4_base::ED4_base() |
|---|
| 336 | { |
|---|
| 337 | unsigned int resize:1; |
|---|
| 338 | unsigned int refresh:1; |
|---|
| 339 | unsigned int clear_at_refresh:1; |
|---|
| 340 | unsigned int linked_to_folding_line:1; |
|---|
| 341 | unsigned int linked_to_scrolled_rectangle:1; |
|---|
| 342 | unsigned int refresh_horizontal_scrolling:1; |
|---|
| 343 | unsigned int refresh_vertical_scrolling:1; |
|---|
| 344 | unsigned int delete_requested:1; |
|---|
| 345 | |
|---|
| 346 | void set_clear_at_refresh(int value) { |
|---|
| 347 | clear_at_refresh = value; |
|---|
| 348 | } |
|---|
| 349 | void set_refresh(int value) { |
|---|
| 350 | refresh = value; |
|---|
| 351 | } |
|---|
| 352 | void set_resize(int value) { |
|---|
| 353 | resize = value; |
|---|
| 354 | } |
|---|
| 355 | |
|---|
| 356 | #if defined(IMPLEMENT_DUMP) |
|---|
| 357 | void dump(size_t indent) const; |
|---|
| 358 | #endif // IMPLEMENT_DUMP |
|---|
| 359 | }; |
|---|
| 360 | |
|---|
| 361 | struct ED4_coords |
|---|
| 362 | { |
|---|
| 363 | long top_area_x, |
|---|
| 364 | top_area_y, |
|---|
| 365 | top_area_height, |
|---|
| 366 | |
|---|
| 367 | middle_area_x, |
|---|
| 368 | middle_area_y, |
|---|
| 369 | |
|---|
| 370 | window_width, //of whole window (top and middle area and ... ) |
|---|
| 371 | window_height, //of whole window (top and middle area and ... ) |
|---|
| 372 | |
|---|
| 373 | window_upper_clip_point, //absolute coordinate of upper visible clipping point in middle area |
|---|
| 374 | window_lower_clip_point, //absolute coordinate of lower visible clipping point in middle area |
|---|
| 375 | window_left_clip_point, //absolute coordinate of left visible clipping point in top and middle area |
|---|
| 376 | window_right_clip_point; //absolute coordinate of right visible clipping point in top and middle area |
|---|
| 377 | |
|---|
| 378 | void clear() { |
|---|
| 379 | top_area_x = 0; |
|---|
| 380 | top_area_y = 0; |
|---|
| 381 | top_area_height = 0; |
|---|
| 382 | |
|---|
| 383 | middle_area_x = 0; |
|---|
| 384 | middle_area_y = 0; |
|---|
| 385 | |
|---|
| 386 | window_width = 0; |
|---|
| 387 | window_height = 0; |
|---|
| 388 | |
|---|
| 389 | window_upper_clip_point = 0; |
|---|
| 390 | window_lower_clip_point = 0; |
|---|
| 391 | window_left_clip_point = 0; |
|---|
| 392 | window_right_clip_point = 0; |
|---|
| 393 | } |
|---|
| 394 | }; |
|---|
| 395 | |
|---|
| 396 | #else |
|---|
| 397 | #error ed4_defs.hxx included twice |
|---|
| 398 | #endif |
|---|