ARB
ed4_defs.hxx
Go to the documentation of this file.
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 AW_POSITION_HXX
11 #include <aw_position.hxx>
12 #endif
13 #ifndef ARBDB_BASE_H
14 #include <arbdb_base.h>
15 #endif
16 
17 #if defined(DEBUG)
18 // #define TRACE_REFRESH
19 // #define TRACE_JUMPS
20 #endif
21 
22 #define e4_assert(bed) arb_assert(bed)
23 
24 class ED4_root;
25 class ED4_database;
27 
28 typedef int ED4_COORDINATE;
29 
31  AD_ALIGN, // add & remove of . possible (default)
32  AD_NOWRITE, // no edits allowed
34  AD_REPLACE, // all edits (overwrite)
35  AD_INSERT // all edits (insert)
36 };
37 
38 
39 // global variables
40 extern GBDATA *GLOBAL_gb_main;
41 extern ED4_root *ED4_ROOT;
42 
43 extern int INFO_TERM_TEXT_YOFFSET;
44 extern int SEQ_TERM_TEXT_YOFFSET;
45 
46 extern int TERMINAL_HEIGHT; // standard terminal height (sequences, name, info, etc..)
47 extern int MAXSEQUENCECHARACTERLENGTH; // greatest # of characters in a sequence string terminal
48 extern int MAXNAME_WIDTH; // max. pixel width of ED4_species_name_terminal (effective width also depends on group-nesting)
49 extern int MAXINFO_WIDTH; // pixel width used to display sequence info ("CONS", "4data", etc.)
50 extern int FLAG_WIDTH; // pixel width used to display species flags (and its header)
51 
52 extern long ED4_counter;
53 
54 // use ED4_init_notFoundMessage and ED4_finish_and_show_notFoundMessage to
55 // modify the following elements
56 #define MAX_SHOWN_MISSING_SPECIES 200U // limit no of missing species/data printed into not_found_message
57 extern size_t not_found_counter; // nr of species which haven't been found
58 extern GBS_strstruct *not_found_message; // error message containing (some) missing/unloadable species
59 
60 extern long max_seq_terminal_length; // global maximum of sequence terminal length
62 extern long awar_edit_rightward; // 0 = leftward, 1 = rightward
63 extern bool move_cursor; // only needed for editing in consensus
64 extern bool DRAW;
65 
66 // globally used defines and flags
67 
68 #define INFINITE -1
69 
70 #define SLIDER_OFFSET 5
71 
72 // these are recommended for accessing ED4_extension:
73 #define X_POS 0
74 #define Y_POS 1
75 #define WIDTH 0
76 #define HEIGHT 1
77 
78 // size of some display elements:
79 #define BRACKET_WIDTH 11
80 #define SPACER_HEIGHT 5
81 #define SPACER_NOCONS_HEIGHT 15 // height of spacer at top of group (used if consensus is hidden and group is folded)
82 #define SEQUENCE_INFO_WIDTH 50 // default width of ED4_sequence_info_terminal (overridden via ref-terminal)
83 #define TREE_TERMINAL_WIDTH 100 // some default-width (used for ED4_line_terminal only; @@@ has no noteable effect)
84 
85 #define COLUMN_STAT_ROW_HEIGHT(font_height) (2.2*(font_height)) // each row contains 2 sub-rows (plus some xtra space)
86 #define COLUMN_STAT_ROWS 4
87 
88 #define MAX_POSSIBLE_SEQ_LENGTH 100000000
89 
90 #define MAXWINDOWS 5
91 
92 #define AWAR_EDIT_MODE "tmp/edit4/edit_mode"
93 #define AWAR_INSERT_MODE "tmp/edit4/insert_mode"
94 #define AWAR_EDIT_SECURITY_LEVEL "tmp/edit4/security_level"
95 #define AWAR_EDIT_SECURITY_LEVEL_ALIGN "tmp/edit4/security_level_align"
96 #define AWAR_EDIT_SECURITY_LEVEL_CHANGE "tmp/edit4/security_level_change"
97 #define AWAR_EDIT_CONFIGURATION "tmp/edit4/configuration"
98 
99 #define AWAR_EDIT_SEQ_POSITION "tmp/edit4/jump_to_position%d" // used to create ED4_window.awar_path_for_cursor[]
100 #define AWAR_EDIT_ECOLI_POSITION "tmp/edit4/cursor_ref_ecoli%d" // used to create ED4_window.awar_path_for_Ecoli[]
101 #define AWAR_EDIT_BASE_POSITION "tmp/edit4/cursor_to_basepos%d" // used to create ED4_window.awar_path_for_basePos[]
102 #define AWAR_EDIT_IUPAC "tmp/edit4/iupac%d" // used to create ED4_window.awar_path_for_IUPAC[]
103 #define AWAR_EDIT_HELIXNR "tmp/edit4/helixnr%d" // used to create ED4_window.awar_path_for_helixNr[]
104 
105 #define AWAR_FIELD_CHOSEN "tmp/edit4/field_chosen" // used for field selection box
106 
107 #define AWAR_EDIT_TITLE_MODE "edit4/title_mode"
108 #define AWAR_EDIT_HELIX_SPACING "edit4/helix_add_spacing"
109 #define AWAR_EDIT_TERMINAL_SPACING "edit4/terminal_add_spacing"
110 
111 #define CHARACTEROFFSET 5 // spacer-width left of text-terminal
112 
113 #define NAME_BUFFERSIZE 100 // size of buffer used to build terminal/manager IDs
114 
115 typedef long ED4_index;
116 
117 #define ED4_SCROLL_OVERLAP 20 // 15 Pixels overlap
118 
119 
120 enum ED4_level { // has to contain bit values
122  LEV_NONE = 0,
123  LEV_ROOT = 0x1,
124  LEV_DEVICE = 0x2,
125  LEV_AREA = 0x4,
127  LEV_SPECIES = 0x10,
129  LEV_SEQUENCE = 0x40,
130  LEV_TREE = 0x80,
134  LEV_ORF = 0x800,
135  LEV_SPACER = 0x1000,
136  LEV_LINE = 0x2000,
137  LEV_MULTI_NAME = 0x4000,
139  LEV_GROUP = 0x10000,
140  LEV_ROOTGROUP = 0x20000,
141  LEV_BRACKET = 0x40000,
142  LEV_PURE_TEXT = 0x80000,
143  LEV_COL_STAT = 0x100000,
144  LEV_FLAG_HEADER = 0x200000,
145  LEV_FLAG = 0x400000,
146 };
147 
151 };
152 
153 
159 };
160 
162  ED4_R_OK = 0,
167 };
168 
174 };
175 
182  PROP_DYNA_RESIZE = 0x10, // if set => allowed to resize dynamically (static_prop => object type is capable; auto-copied to dynamic_prop)
185  PROP_MOVABLE = 0x80,
186  PROP_IS_HANDLE = 0x100,
188  // PROP_ = 0x400,
189  // PROP_ = 0x800,
190  PROP_IS_FOLDED = 0x1000, // Flag whether group is folded or not
191  PROP_CONSENSUS_RELEVANT = 0x2000, // contains information relevant for consensus
192  PROP_ALIGNMENT_DATA = 0x4000, // contains aligned data (also SAIs)
193 };
194 
201 };
202 
204  ED4_U_UP = 0,
206 };
207 
212 };
213 
217 };
218 
227 };
228 
233 };
234 
235 
236 class ED4_base;
237 class ED4_terminal;
238 class ED4_species_name_terminal;
239 
241  ED4_base *object; // object to be moved
242  AW_pos end_x, end_y; // position to move to
243  ED4_movemode mode; // move mode
244  ED4_level preferred_parent; // level to move to
245 };
246 
252 
253  ED4_species_name_terminal *object;
254 };
255 
256 
257 
258 struct ED4_extension { // contains info about graphical properties
259  AW_pos position[2]; // upper left corner (pos_x, pos_y) in relation to parent
260  // !!! WARNING: This is a hack!!! Every time you change 'position' you HAVE TO call ED4_base::touch_world_cache() !!!
261 
262  AW_pos size[2]; // width and height
263  ED4_index y_folded; // remember old position of consensus when folding group
264 
265  AW::Vector get_size() const { return AW::Vector(size[WIDTH], size[HEIGHT]); }
266  AW::Vector get_parent_offset() const { return AW::Vector(position[X_POS], position[Y_POS]); }
267 
268  bool set_size_does_change(int idx, AW_pos value) {
269  // returns true if changed
270  e4_assert(idx == WIDTH || idx == HEIGHT);
271  if (size[idx] != value) {
272  size[idx] = value;
273  return true;
274  }
275  return false;
276  }
277 
278 #if defined(IMPLEMENT_DUMP)
279  void dump(size_t indent) const;
280 #endif // IMPLEMENT_DUMP
281 };
282 
284  bool scroll;
285  long old_x;
286  long old_y;
287 
288  ED4_scroll_picture() : scroll(false), old_x(0), old_y(0) {}
289 };
290 
292  ED4_JUMP_CENTERED, // centers the cursor
293  ED4_JUMP_KEEP_VISIBLE, // keeps the cursor visible (keeps a fixed margin)
294  ED4_JUMP_KEEP_POSITION, // paint cursor at previous position
295 };
296 
300  char *string; // pointer to consensus; only if editing the consensus
301  long char_position; // screen position after cursor
302 
303  bool rightward; // contains direction of editing (0 = leftward, 1 = rightward)
304 
306 
307  bool is_sequence; // ==1 -> special handling for sequences
308  bool cannot_handle; // if TRUE then cannot edit
309 
312 
313  long out_seq_position; // sequence position (after editing)
314 
315  char *out_string; // nur falls new malloc
316 
317  int repeat_count; // only for keystrokes: contains # of times key should be repeated
318 
319  ED4_terminal *working_terminal; // this contains the terminal
320 };
321 
322 
323 struct ED4_update_info { // if you add new elements, please ensure to initialize them in ED4_base::ED4_base()
324  unsigned int resize : 1;
325  unsigned int refresh : 1;
326  unsigned int clear_at_refresh : 1;
327  unsigned int linked_to_folding_line : 1;
330  unsigned int refresh_vertical_scrolling : 1;
331  unsigned int delete_requested : 1;
332  unsigned int update_requested : 1;
333 
334  void set_clear_at_refresh(int value) {
335  clear_at_refresh = value;
336  }
337  void set_refresh(int value) {
338  refresh = value;
339  }
340  void set_resize(int value) {
341  resize = value;
342  }
343 
344 #if defined(IMPLEMENT_DUMP)
345  void dump(size_t indent) const;
346 #endif // IMPLEMENT_DUMP
347 };
348 
349 struct ED4_coords {
351  top_area_y,
353 
356 
357  window_width, // of whole window (top and middle area and ... )
358  window_height, // of whole window (top and middle area and ... )
359 
360  window_upper_clip_point, // absolute coordinate of upper visible clipping point in middle area
361  window_lower_clip_point, // absolute coordinate of lower visible clipping point in middle area
362  window_left_clip_point, // absolute coordinate of left visible clipping point in top and middle area
363  window_right_clip_point; // absolute coordinate of right visible clipping point in top and middle area
364 
365  void clear() {
366  top_area_x = 0;
367  top_area_y = 0;
368  top_area_height = 0;
369 
370  middle_area_x = 0;
371  middle_area_y = 0;
372 
373  window_width = 0;
374  window_height = 0;
375 
376  window_upper_clip_point = 0;
377  window_lower_clip_point = 0;
378  window_left_clip_point = 0;
379  window_right_clip_point = 0;
380  }
381 };
382 
383 #else
384 #error ed4_defs.hxx included twice
385 #endif
ED4_update_flag
Definition: ed4_defs.hxx:203
void set_resize(int value)
Definition: ed4_defs.hxx:340
ED4_movemode mode
Definition: ed4_defs.hxx:243
ED4_EDITMODE
Definition: ed4_defs.hxx:30
size_t not_found_counter
Definition: ED4_main.cxx:63
ED4_terminal * working_terminal
Definition: ed4_defs.hxx:319
long char_position
Definition: ed4_defs.hxx:301
AW_pos size[2]
Definition: ed4_defs.hxx:262
ED4_EDITMODE mode
Definition: ed4_defs.hxx:305
ED4_direction
Definition: ed4_defs.hxx:229
long window_height
Definition: ed4_defs.hxx:350
bool DRAW
Definition: ED4_main.cxx:70
ED4_level preferred_parent
Definition: ed4_defs.hxx:244
int MAXNAME_WIDTH
Definition: ED4_main.cxx:57
ED4_datamode
Definition: ed4_defs.hxx:148
#define e4_assert(bed)
Definition: ed4_defs.hxx:22
char * out_string
Definition: ed4_defs.hxx:315
AW_pos drag_off_y
Definition: ed4_defs.hxx:248
ED4_species_name_terminal * object
Definition: ed4_defs.hxx:253
bool refresh_needed
Definition: ed4_defs.hxx:311
AW_pos actual_width
Definition: ed4_defs.hxx:250
#define Y_POS
Definition: ed4_defs.hxx:74
long top_area_height
Definition: ed4_defs.hxx:350
ED4_root * ED4_ROOT
Definition: ED4_main.cxx:48
ED4_AREA_LEVEL
Definition: ed4_defs.hxx:169
ED4_movemode
Definition: ed4_defs.hxx:154
long ED4_counter
Definition: ED4_main.cxx:61
bool cannot_handle
Definition: ed4_defs.hxx:308
AW::Vector get_size() const
Definition: ed4_defs.hxx:265
ED4_level
Definition: ed4_defs.hxx:120
double AW_pos
Definition: aw_base.hxx:29
ED4_consensus
Definition: ed4_defs.hxx:214
int ED4_COORDINATE
Definition: ed4_defs.hxx:26
int SEQ_TERM_TEXT_YOFFSET
Definition: ED4_main.cxx:54
unsigned int clear_at_refresh
Definition: ed4_defs.hxx:326
char * string
Definition: ed4_defs.hxx:300
ED4_returncode
Definition: ed4_defs.hxx:161
long window_upper_clip_point
Definition: ed4_defs.hxx:350
ED4_index y_folded
Definition: ed4_defs.hxx:263
bool is_sequence
Definition: ed4_defs.hxx:307
long window_lower_clip_point
Definition: ed4_defs.hxx:350
#define X_POS
Definition: ed4_defs.hxx:73
void set_refresh(int value)
Definition: ed4_defs.hxx:337
ED4_border_flag
Definition: ed4_defs.hxx:208
long top_area_y
Definition: ed4_defs.hxx:350
#define false
Definition: ureadseq.h:13
unsigned int linked_to_folding_line
Definition: ed4_defs.hxx:327
#define WIDTH
Definition: ed4_defs.hxx:75
AW_event event
Definition: ed4_defs.hxx:298
long out_seq_position
Definition: ed4_defs.hxx:313
ED4_aa_seq_flag
Definition: ed4_defs.hxx:219
int FLAG_WIDTH
Definition: ED4_main.cxx:59
bool set_size_does_change(int idx, AW_pos value)
Definition: ed4_defs.hxx:268
ED4_base * object
Definition: ed4_defs.hxx:241
unsigned int refresh_horizontal_scrolling
Definition: ed4_defs.hxx:329
GBS_strstruct * not_found_message
Definition: ED4_main.cxx:64
AW::Vector get_parent_offset() const
Definition: ed4_defs.hxx:266
unsigned int update_requested
Definition: ed4_defs.hxx:332
unsigned int delete_requested
Definition: ed4_defs.hxx:331
AW_pos drag_old_y
Definition: ed4_defs.hxx:249
int TERMINAL_HEIGHT
Definition: ED4_main.cxx:51
GBDATA * GLOBAL_gb_main
Definition: DI_main.cxx:27
long middle_area_y
Definition: ed4_defs.hxx:350
Definition: ed4_defs.hxx:247
ED4_CursorJumpType
Definition: ed4_defs.hxx:291
AW_pos position[2]
Definition: ed4_defs.hxx:259
int MAXSEQUENCECHARACTERLENGTH
Definition: ED4_main.cxx:56
unsigned int refresh
Definition: ed4_defs.hxx:325
long window_width
Definition: ed4_defs.hxx:350
AW_pos drag_old_x
Definition: ed4_defs.hxx:249
AW_pos drag_off_x
Definition: ed4_defs.hxx:248
Definition: output.h:122
GBDATA * gb_data
Definition: ed4_defs.hxx:299
ED4_CursorJumpType cursor_jump
Definition: ed4_defs.hxx:310
long awar_edit_rightward
Definition: ED4_main.cxx:68
bool move_cursor
Definition: ED4_main.cxx:69
long middle_area_x
Definition: ed4_defs.hxx:350
ED4_properties
Definition: ed4_defs.hxx:176
long window_right_clip_point
Definition: ed4_defs.hxx:350
AW_pos end_x
Definition: ed4_defs.hxx:242
long max_seq_terminal_length
Definition: ED4_main.cxx:66
unsigned int resize
Definition: ed4_defs.hxx:324
long top_area_x
Definition: ed4_defs.hxx:350
unsigned int refresh_vertical_scrolling
Definition: ed4_defs.hxx:330
void clear()
Definition: ed4_defs.hxx:365
AW_pos end_y
Definition: ed4_defs.hxx:242
ED4_cursor_move
Definition: ed4_defs.hxx:195
int INFO_TERM_TEXT_YOFFSET
Definition: ED4_main.cxx:53
long window_left_clip_point
Definition: ed4_defs.hxx:350
int MAXINFO_WIDTH
Definition: ED4_main.cxx:58
void set_clear_at_refresh(int value)
Definition: ed4_defs.hxx:334
ED4_EDITMODE awar_edit_mode
Definition: ED4_main.cxx:67
#define HEIGHT
Definition: ed4_defs.hxx:76
int old_event_y
Definition: ed4_defs.hxx:251
AW_pos actual_height
Definition: ed4_defs.hxx:250
long ED4_index
Definition: ed4_defs.hxx:115
static Score ** U
Definition: align.cxx:67
unsigned int linked_to_scrolled_rectangle
Definition: ed4_defs.hxx:328