1 | #ifndef ED4_CLASS_HXX |
---|
2 | #define ED4_CLASS_HXX |
---|
3 | |
---|
4 | #ifndef ARB_ASSERT_H |
---|
5 | #include <arb_assert.h> |
---|
6 | #endif |
---|
7 | #ifndef AW_FONT_GROUP_HXX |
---|
8 | #include <aw_font_group.hxx> |
---|
9 | #endif |
---|
10 | |
---|
11 | #define e4_assert(bed) arb_assert(bed) |
---|
12 | |
---|
13 | #ifdef DEBUG |
---|
14 | # define IMPLEMENT_DUMP // comment out this line to skip compilation of the dump() methods |
---|
15 | #endif |
---|
16 | |
---|
17 | // #define LIMIT_TOP_AREA_SPACE // // if defined, top area is size-limited |
---|
18 | #ifdef LIMIT_TOP_AREA_SPACE |
---|
19 | #define MAX_TOP_AREA_SIZE 10 // size limit for top-area |
---|
20 | #endif |
---|
21 | |
---|
22 | #ifndef ED4_DEFS_HXX |
---|
23 | #include "ed4_defs.hxx" |
---|
24 | #endif |
---|
25 | #ifndef ED4_SEARCH_HXX |
---|
26 | #include "ed4_search.hxx" |
---|
27 | #endif |
---|
28 | #ifndef _CPP_CSTRING |
---|
29 | #include <cstring> |
---|
30 | #endif |
---|
31 | #ifndef _CPP_SET |
---|
32 | #include <set> |
---|
33 | #endif |
---|
34 | |
---|
35 | #define ed4_beep() do {fputc(char(7), stdout); fflush(stdout); } while(0) |
---|
36 | |
---|
37 | //**************************************** |
---|
38 | // needed prototypes, definitions below |
---|
39 | //**************************************** |
---|
40 | |
---|
41 | class ED4_Edit_String; |
---|
42 | class ED4_area_manager; |
---|
43 | class ED4_base; |
---|
44 | class ED4_bases_table; |
---|
45 | class ED4_bracket_terminal; |
---|
46 | class ED4_char_table; |
---|
47 | class ED4_columnStat_terminal; |
---|
48 | class ED4_consensus_sequence_terminal; |
---|
49 | class ED4_cursor; |
---|
50 | class ED4_device_manager; |
---|
51 | class ED4_folding_line; |
---|
52 | class ED4_group_manager; |
---|
53 | class ED4_line_terminal; |
---|
54 | class ED4_list; |
---|
55 | class ED4_main_manager; |
---|
56 | class ED4_manager; |
---|
57 | class ED4_members; |
---|
58 | class ED4_multi_name_manager; |
---|
59 | class ED4_multi_sequence_manager; |
---|
60 | class ED4_multi_species_manager; |
---|
61 | class ED4_name_manager; |
---|
62 | class ED4_pure_text_terminal; |
---|
63 | class ED4_remap; |
---|
64 | class ED4_root; |
---|
65 | class ED4_root_group_manager; |
---|
66 | class ED4_sequence_info_terminal; |
---|
67 | class ED4_sequence_manager; |
---|
68 | class ED4_sequence_terminal; |
---|
69 | class ED4_AA_sequence_terminal; |
---|
70 | class ED4_spacer_terminal; |
---|
71 | class ED4_species_manager; |
---|
72 | class ED4_species_name_terminal; |
---|
73 | class ED4_species_pointer; |
---|
74 | class ED4_terminal; |
---|
75 | class ED4_text_terminal; |
---|
76 | class ED4_tree_terminal; |
---|
77 | class ED4_window; |
---|
78 | |
---|
79 | class AP_tree; |
---|
80 | class AWT_reference; |
---|
81 | class AWT_seq_colors; |
---|
82 | class BI_ecoli_ref; |
---|
83 | class AW_helix; |
---|
84 | class ST_ML; |
---|
85 | class ed_key; |
---|
86 | |
---|
87 | // -------------------------------------------------------------------------------- |
---|
88 | // class EDB_root_bact |
---|
89 | // -------------------------------------------------------------------------------- |
---|
90 | class EDB_root_bact { |
---|
91 | |
---|
92 | public: |
---|
93 | char *make_string(); //just for debuggig |
---|
94 | char *make_top_bot_string(); //just for debugging |
---|
95 | |
---|
96 | void calc_no_of_all(char *string_to_scan, // group gets the number of groups in string_to_scan, |
---|
97 | long *group, // species gets the number of species in string_to_scan |
---|
98 | long *species); |
---|
99 | |
---|
100 | ED4_returncode fill_species(ED4_multi_species_manager *multi_species_manager, |
---|
101 | ED4_sequence_info_terminal *ref_sequence_info_terminal, |
---|
102 | ED4_sequence_terminal *ref_sequence_terminal, |
---|
103 | char *string, |
---|
104 | int *index, |
---|
105 | ED4_index *y, |
---|
106 | ED4_index actual_local_position, |
---|
107 | ED4_index *length_of_terminals, |
---|
108 | int group_depth); |
---|
109 | |
---|
110 | ED4_returncode fill_data(ED4_multi_species_manager *multi_species_manager, |
---|
111 | ED4_sequence_info_terminal *ref_sequence_info_terminal, |
---|
112 | ED4_sequence_terminal *ref_sequence_terminal, |
---|
113 | char *string, |
---|
114 | ED4_index *y, |
---|
115 | ED4_index actual_local_position, |
---|
116 | ED4_index *length_of_terminals, |
---|
117 | int group_depth, |
---|
118 | ED4_datamode datamode); // flag only needed for loading a new configuration |
---|
119 | |
---|
120 | ED4_returncode search_sequence_data_rek(ED4_multi_sequence_manager *multi_sequence_manager, |
---|
121 | ED4_sequence_info_terminal *ref_sequence_info_terminal, |
---|
122 | ED4_sequence_terminal *ref_sequence_terminal, |
---|
123 | GBDATA *gb_datamode, |
---|
124 | int count_too, |
---|
125 | ED4_index *seq_coords, |
---|
126 | ED4_index *max_seq_terminal_length, |
---|
127 | ED4_alignment alignment_flag); |
---|
128 | |
---|
129 | ED4_index scan_string(ED4_multi_species_manager *parent, |
---|
130 | ED4_sequence_info_terminal *ref_sequence_info_terminal, |
---|
131 | ED4_sequence_terminal *ref_sequence_terminal, |
---|
132 | char *string, |
---|
133 | int *index, |
---|
134 | ED4_index *y); |
---|
135 | |
---|
136 | ED4_returncode create_group_header(ED4_multi_species_manager *parent, |
---|
137 | ED4_sequence_info_terminal *ref_sequence_info_terminal, |
---|
138 | ED4_sequence_terminal *ref_sequence_terminal, |
---|
139 | ED4_multi_species_manager **multi_species_manager, |
---|
140 | ED4_bracket_terminal **bracket_terminal, |
---|
141 | ED4_index *y, |
---|
142 | char *groupname, |
---|
143 | int group_depth, |
---|
144 | bool is_folded, |
---|
145 | ED4_index local_count_position); |
---|
146 | |
---|
147 | char *generate_config_string(char *confname); |
---|
148 | |
---|
149 | |
---|
150 | EDB_root_bact(); |
---|
151 | ~EDB_root_bact(); |
---|
152 | }; |
---|
153 | |
---|
154 | |
---|
155 | |
---|
156 | // -------------------------------------------------------------------------------- |
---|
157 | // struct ED4_object_specification |
---|
158 | // -------------------------------------------------------------------------------- |
---|
159 | struct ED4_object_specification |
---|
160 | { |
---|
161 | ED4_properties static_prop; |
---|
162 | ED4_level level; |
---|
163 | ED4_level allowed_children; |
---|
164 | ED4_level handled_level; |
---|
165 | ED4_level restriction_level; |
---|
166 | float justification; //Justification of Object, which is controlled by a manager |
---|
167 | |
---|
168 | #if defined(IMPLEMENT_DUMP) |
---|
169 | void dump(size_t indent) const; |
---|
170 | #endif // IMPLEMENT_DUMP |
---|
171 | |
---|
172 | }; //Manager coordinates Layout |
---|
173 | |
---|
174 | |
---|
175 | // -------------------------------------------------------------------------------- |
---|
176 | // class ED4_folding_line |
---|
177 | // -------------------------------------------------------------------------------- |
---|
178 | class ED4_folding_line |
---|
179 | //properties of an object, i.e. concerning rectangles on screen showing sequences |
---|
180 | { |
---|
181 | ED4_folding_line(const ED4_folding_line&); // copy-constructor not allowed |
---|
182 | public: |
---|
183 | AW_pos world_pos[2]; |
---|
184 | AW_pos window_pos[2]; |
---|
185 | AW_pos length; |
---|
186 | AW_pos dimension; |
---|
187 | ED4_base *link; |
---|
188 | ED4_folding_line *next; |
---|
189 | |
---|
190 | ED4_folding_line(); |
---|
191 | ~ED4_folding_line(); |
---|
192 | }; |
---|
193 | |
---|
194 | // -------------------------------------------------------------------------------- |
---|
195 | // struct ED4_scroll_links |
---|
196 | // -------------------------------------------------------------------------------- |
---|
197 | struct ED4_scroll_links |
---|
198 | { |
---|
199 | ED4_base *link_for_hor_slider; |
---|
200 | ED4_base *link_for_ver_slider; |
---|
201 | |
---|
202 | }; |
---|
203 | |
---|
204 | // -------------------------------------------------------------------------------- |
---|
205 | // struct ED4_scrolled_rectangle |
---|
206 | // -------------------------------------------------------------------------------- |
---|
207 | struct ED4_scrolled_rectangle |
---|
208 | { |
---|
209 | ED4_folding_line *scroll_top, *scroll_bottom, *scroll_left, *scroll_right; |
---|
210 | ED4_base *x_link, *y_link, *width_link, *height_link; |
---|
211 | AW_pos world_x, world_y, width, height; |
---|
212 | |
---|
213 | void clear() { |
---|
214 | scroll_top = 0; |
---|
215 | scroll_bottom = 0; |
---|
216 | scroll_left = 0; |
---|
217 | scroll_right = 0; |
---|
218 | x_link = 0; |
---|
219 | y_link = 0; |
---|
220 | width_link = 0; |
---|
221 | height_link = 0; |
---|
222 | world_x = 0; |
---|
223 | world_y = 0; |
---|
224 | width = 0; |
---|
225 | height = 0; |
---|
226 | } |
---|
227 | }; |
---|
228 | |
---|
229 | // -------------------------------------------------------------------------------- |
---|
230 | // class ED4_list_elem |
---|
231 | // -------------------------------------------------------------------------------- |
---|
232 | class ED4_list_elem |
---|
233 | { |
---|
234 | void *my_elem; |
---|
235 | ED4_list_elem *my_next; |
---|
236 | public: |
---|
237 | ED4_list_elem(void *element) { my_elem = element; my_next = 0; } |
---|
238 | ~ED4_list_elem() {} |
---|
239 | |
---|
240 | ED4_list_elem *next() const { return my_next; } |
---|
241 | void *elem() const { return my_elem; } |
---|
242 | |
---|
243 | void set_next(ED4_list_elem *the_next) { my_next = the_next; } |
---|
244 | }; |
---|
245 | |
---|
246 | |
---|
247 | // -------------------------------------------------------------------------------- |
---|
248 | // class ED4_list |
---|
249 | // -------------------------------------------------------------------------------- |
---|
250 | class ED4_list |
---|
251 | // class which implements a general purpose linked list of void* |
---|
252 | { |
---|
253 | ED4_list_elem *my_first; |
---|
254 | ED4_list_elem *my_last; |
---|
255 | ED4_index my_no_of_entries; |
---|
256 | |
---|
257 | ED4_list(const ED4_list&); // copy-constructor not allowed |
---|
258 | |
---|
259 | public: |
---|
260 | |
---|
261 | ED4_list_elem *first() const { return my_first; } |
---|
262 | ED4_list_elem *last() const { return my_last; } |
---|
263 | ED4_index no_of_entries() const { return my_no_of_entries; } |
---|
264 | |
---|
265 | ED4_returncode append_elem( void *elem ); |
---|
266 | ED4_returncode delete_elem( void *elem ); |
---|
267 | ED4_returncode append_elem_backwards( void *elem ); |
---|
268 | short is_elem( void *elem ); |
---|
269 | |
---|
270 | ED4_list(); |
---|
271 | ~ED4_list(); |
---|
272 | }; |
---|
273 | |
---|
274 | class ED4_window; |
---|
275 | |
---|
276 | // -------------------------------------------------------------------------------- |
---|
277 | // class ED4_base_position |
---|
278 | // -------------------------------------------------------------------------------- |
---|
279 | class ED4_base_position |
---|
280 | { |
---|
281 | const ED4_base *calced4base; |
---|
282 | int *seq_pos; |
---|
283 | int count; |
---|
284 | |
---|
285 | void calc4base(const ED4_base *base); |
---|
286 | |
---|
287 | ED4_base_position(const ED4_base_position&); // copy-constructor not allowed |
---|
288 | |
---|
289 | public: |
---|
290 | |
---|
291 | ED4_base_position(); |
---|
292 | ~ED4_base_position(); |
---|
293 | |
---|
294 | void invalidate(); |
---|
295 | |
---|
296 | int get_base_position(const ED4_base *base, int sequence_position); |
---|
297 | int get_sequence_position(const ED4_base *base, int base_position); |
---|
298 | |
---|
299 | }; |
---|
300 | |
---|
301 | class ED4_CursorShape; |
---|
302 | |
---|
303 | |
---|
304 | enum ED4_CursorType { |
---|
305 | ED4_RIGHT_ORIENTED_CURSOR, |
---|
306 | ED4_RIGHT_ORIENTED_CURSOR_THIN, |
---|
307 | ED4_TRADITIONAL_CURSOR, |
---|
308 | ED4_TRADITIONAL_CURSOR_BOTTOM, |
---|
309 | ED4_TRADITIONAL_CURSOR_CONNECTED, |
---|
310 | ED4_FUCKING_BIG_CURSOR, |
---|
311 | |
---|
312 | ED4_CURSOR_TYPES |
---|
313 | |
---|
314 | }; |
---|
315 | |
---|
316 | extern int ED4_update_global_cursor_awars_allowed; |
---|
317 | |
---|
318 | // -------------------------------------------------------------------------------- |
---|
319 | // class ED4_cursor |
---|
320 | // -------------------------------------------------------------------------------- |
---|
321 | |
---|
322 | typedef bool (*ED4_TerminalTest)(ED4_base *terminal, int seqPos); |
---|
323 | |
---|
324 | class ED4_cursor |
---|
325 | { |
---|
326 | ED4_index cursor_abs_x; // absolute (to terminal) x-position of cursor (absolute world coordinate of edit window) |
---|
327 | int screen_position; // number of displayed characters leading the cursor |
---|
328 | mutable ED4_base_position base_position; // # of bases left of cursor |
---|
329 | ED4_CursorType ctype; |
---|
330 | ED4_CursorShape *cursor_shape; |
---|
331 | |
---|
332 | ED4_returncode draw_cursor(AW_pos x, AW_pos y); |
---|
333 | ED4_returncode delete_cursor(AW_pos del_mark , ED4_base *target_terminal); |
---|
334 | ED4_terminal *get_upper_lower_cursor_pos(ED4_manager *starting_point, ED4_cursor_move cursor_move, AW_pos current_y, bool isScreen, ED4_TerminalTest terminal_is_appropriate, int seq_pos); |
---|
335 | void updateAwars(); |
---|
336 | |
---|
337 | ED4_cursor(const ED4_cursor&); // copy-constructor not allowed |
---|
338 | |
---|
339 | public: |
---|
340 | |
---|
341 | bool allowed_to_draw; //needed for cursor handling |
---|
342 | ED4_base *owner_of_cursor; |
---|
343 | |
---|
344 | bool is_partly_visible() const; |
---|
345 | |
---|
346 | void changeType(ED4_CursorType typ); |
---|
347 | ED4_CursorType getType() const { return ctype; } |
---|
348 | |
---|
349 | void redraw() { changeType(getType()); } |
---|
350 | |
---|
351 | ED4_returncode HideCursor(); // deletes cursor and does refresh |
---|
352 | ED4_returncode move_cursor( AW_event *event ); |
---|
353 | ED4_returncode show_clicked_cursor(AW_pos click_xpos, ED4_terminal *target_terminal); |
---|
354 | ED4_returncode show_cursor_at(ED4_terminal *target_terminal, ED4_index what_pos); |
---|
355 | ED4_returncode ShowCursor(ED4_index offset_x, ED4_cursor_move move, int move_pos = 1); |
---|
356 | |
---|
357 | int get_sequence_pos() const; |
---|
358 | int get_screen_pos() const { return screen_position; } |
---|
359 | |
---|
360 | long get_abs_x() const { return cursor_abs_x; } |
---|
361 | void set_abs_x(); |
---|
362 | |
---|
363 | int base2sequence_position(int base_pos) const { return base_position.get_sequence_position(owner_of_cursor, base_pos); } |
---|
364 | int sequence2base_position(int seq_pos) const { return base_position.get_base_position(owner_of_cursor, seq_pos); } |
---|
365 | |
---|
366 | int get_base_position() const { return sequence2base_position(get_sequence_pos()); } |
---|
367 | |
---|
368 | void invalidate_base_position() { base_position.invalidate(); } |
---|
369 | |
---|
370 | void jump_screen_pos(AW_window *aww, int screen_pos, ED4_CursorJumpType jump_type); |
---|
371 | void jump_sequence_pos(AW_window *aww, int sequence_pos, ED4_CursorJumpType jump_type); |
---|
372 | void jump_base_pos(AW_window *aww, int base_pos, ED4_CursorJumpType jump_type); |
---|
373 | |
---|
374 | int get_screen_relative_pos(); |
---|
375 | void set_screen_relative_pos(AW_window *aww, int scroll_to_relpos); |
---|
376 | |
---|
377 | void set_to_terminal(AW_window *aww, ED4_terminal *terminal, int seq_pos, ED4_CursorJumpType jump_type); |
---|
378 | |
---|
379 | void init(); |
---|
380 | |
---|
381 | ED4_window *window() const; |
---|
382 | |
---|
383 | ED4_cursor(); |
---|
384 | ~ED4_cursor(); |
---|
385 | }; |
---|
386 | |
---|
387 | // -------------------------------------------------------------------------------- |
---|
388 | // class ED4_window |
---|
389 | // -------------------------------------------------------------------------------- |
---|
390 | class ED4_window |
---|
391 | { |
---|
392 | ED4_window(const ED4_window&); // copy-constructor not allowed |
---|
393 | public: |
---|
394 | AW_window *aww; //Points to Window |
---|
395 | ED4_window *next; |
---|
396 | int slider_pos_horizontal; |
---|
397 | int slider_pos_vertical; |
---|
398 | ED4_folding_line *horizontal_fl; |
---|
399 | ED4_folding_line *vertical_fl; |
---|
400 | ED4_scrolled_rectangle scrolled_rect; |
---|
401 | int id; //unique id in window-list |
---|
402 | ED4_coords coords; |
---|
403 | static int no_of_windows; |
---|
404 | |
---|
405 | char awar_path_for_cursor[50]; // position in current sequence, range=[1;len] |
---|
406 | char awar_path_for_Ecoli[50]; // position relative to ecoli |
---|
407 | char awar_path_for_basePos[50]; // base position in current sequence (# of bases left to cursor) |
---|
408 | char awar_path_for_IUPAC[50]; // IUPAC decoder content for current position |
---|
409 | char awar_path_for_helixNr[50]; // # of helix (or 0) for current position |
---|
410 | |
---|
411 | bool is_hidden; |
---|
412 | ED4_cursor cursor; |
---|
413 | |
---|
414 | //ED4_window controlling functions |
---|
415 | static ED4_window *insert_window(AW_window *new_aww); //append to window list |
---|
416 | |
---|
417 | void delete_window( ED4_window *window); //delete from window list |
---|
418 | void reset_all_for_new_config(); //reset structures for loading new config |
---|
419 | ED4_window *get_matching_ed4w( AW_window *aww ); |
---|
420 | |
---|
421 | //functions concerned the scrolled area |
---|
422 | ED4_returncode update_scrolled_rectangle( void ); |
---|
423 | ED4_returncode set_scrollbar_indents( void ); |
---|
424 | ED4_returncode scroll_rectangle( int dx, int dy ); |
---|
425 | ED4_returncode set_scrolled_rectangle( AW_pos world_x, AW_pos world_y, AW_pos width, AW_pos height, |
---|
426 | ED4_base *x_link, ED4_base *y_link, ED4_base *width_link, ED4_base *height_link ); |
---|
427 | |
---|
428 | void update_window_coords(); |
---|
429 | |
---|
430 | // functions concerned with folding lines |
---|
431 | ED4_folding_line *insert_folding_line( AW_pos world_x, AW_pos world_y, AW_pos length, AW_pos dimension, ED4_base *link, ED4_properties prop ); |
---|
432 | ED4_returncode delete_folding_line( ED4_folding_line *fl, ED4_properties prop ); |
---|
433 | |
---|
434 | ED4_window(AW_window *window); |
---|
435 | ~ED4_window(); |
---|
436 | }; |
---|
437 | |
---|
438 | // -------------------------------------------------------------------------------- |
---|
439 | // class ED4_members |
---|
440 | // -------------------------------------------------------------------------------- |
---|
441 | class ED4_members |
---|
442 | //contains children related functions from members of a manager |
---|
443 | { |
---|
444 | ED4_members(const ED4_members&); // copy-constructor not allowed |
---|
445 | |
---|
446 | ED4_manager *my_owner; //who is controlling this object |
---|
447 | ED4_base **memberList; |
---|
448 | ED4_index no_of_members; //How much members are in the list |
---|
449 | ED4_index size_of_list; |
---|
450 | |
---|
451 | public: |
---|
452 | |
---|
453 | ED4_manager* owner() const { return my_owner; } |
---|
454 | ED4_base* member(ED4_index i) const { e4_assert(i>=0 && i<size_of_list); return memberList[i]; } |
---|
455 | ED4_index members() const { return no_of_members; } |
---|
456 | |
---|
457 | ED4_returncode insert_member (ED4_base *new_member); // only used to move members with mouse |
---|
458 | ED4_returncode append_member (ED4_base *new_member); |
---|
459 | |
---|
460 | // an array is chosen instead of a linked list, because destructorhandling is more comfortable in various destructors (manager-destructors) |
---|
461 | |
---|
462 | ED4_returncode delete_member (ED4_base *member ); |
---|
463 | ED4_index search_member (ED4_extension *location, ED4_properties prop); // search member |
---|
464 | ED4_returncode shift_list (ED4_index start_index, int length); |
---|
465 | // list has to be shifted because member_list is an array and not a linked list |
---|
466 | |
---|
467 | ED4_returncode search_target_species ( ED4_extension *location, ED4_properties prop, ED4_base **found_member, ED4_level return_level ); |
---|
468 | |
---|
469 | ED4_returncode move_member (ED4_index old_pos, ED4_index new_pos); |
---|
470 | |
---|
471 | #if defined(IMPLEMENT_DUMP) |
---|
472 | void dump(size_t indent) const; |
---|
473 | #endif // IMPLEMENT_DUMP |
---|
474 | |
---|
475 | #if defined(ASSERTION_USED) |
---|
476 | int members_ok() const; |
---|
477 | #endif // ASSERTION_USED |
---|
478 | |
---|
479 | ED4_members(ED4_manager *the_owner); |
---|
480 | ~ED4_members(); |
---|
481 | }; |
---|
482 | |
---|
483 | #ifdef DEBUG |
---|
484 | // # define TEST_BASES_TABLE |
---|
485 | #endif |
---|
486 | |
---|
487 | #define SHORT_TABLE_ELEM_SIZE 1 |
---|
488 | #define SHORT_TABLE_MAX_VALUE 0xff |
---|
489 | #define LONG_TABLE_ELEM_SIZE 4 |
---|
490 | |
---|
491 | // -------------------------------------------------------------------------------- |
---|
492 | // class ED4_bases_table |
---|
493 | // -------------------------------------------------------------------------------- |
---|
494 | class ED4_bases_table |
---|
495 | { |
---|
496 | int table_entry_size; // how many bytes are used for each element of 'no_of_bases' (1 or 4 bytes) |
---|
497 | union { |
---|
498 | unsigned char *shortTable; |
---|
499 | int *longTable; |
---|
500 | } no_of_bases; // counts bases for each sequence position |
---|
501 | int no_of_entries; // length of bases table |
---|
502 | |
---|
503 | int legal(int offset) const { return offset>=0 && offset<no_of_entries; } |
---|
504 | |
---|
505 | void set_elem_long(int offset, int value) { |
---|
506 | #ifdef TEST_BASES_TABLE |
---|
507 | e4_assert(legal(offset)); |
---|
508 | e4_assert(table_entry_size==LONG_TABLE_ELEM_SIZE); |
---|
509 | #endif |
---|
510 | no_of_bases.longTable[offset] = value; |
---|
511 | } |
---|
512 | |
---|
513 | void set_elem_short(int offset, int value) { |
---|
514 | #ifdef TEST_BASES_TABLE |
---|
515 | e4_assert(legal(offset)); |
---|
516 | e4_assert(table_entry_size==SHORT_TABLE_ELEM_SIZE); |
---|
517 | e4_assert(value>=0 && value<=SHORT_TABLE_MAX_VALUE); |
---|
518 | #endif |
---|
519 | no_of_bases.shortTable[offset] = value; |
---|
520 | } |
---|
521 | |
---|
522 | int get_elem_long(int offset) const { |
---|
523 | #ifdef TEST_BASES_TABLE |
---|
524 | e4_assert(legal(offset)); |
---|
525 | e4_assert(table_entry_size==LONG_TABLE_ELEM_SIZE); |
---|
526 | #endif |
---|
527 | return no_of_bases.longTable[offset]; |
---|
528 | } |
---|
529 | |
---|
530 | int get_elem_short(int offset) const { |
---|
531 | #ifdef TEST_BASES_TABLE |
---|
532 | e4_assert(legal(offset)); |
---|
533 | e4_assert(table_entry_size==SHORT_TABLE_ELEM_SIZE); |
---|
534 | #endif |
---|
535 | return no_of_bases.shortTable[offset]; |
---|
536 | } |
---|
537 | |
---|
538 | ED4_bases_table(const ED4_bases_table&); // copy-constructor not allowed |
---|
539 | |
---|
540 | public: |
---|
541 | |
---|
542 | ED4_bases_table(int maxseqlength); |
---|
543 | ~ED4_bases_table(); |
---|
544 | |
---|
545 | void init(int length); |
---|
546 | int size() const { return no_of_entries; } |
---|
547 | |
---|
548 | int get_table_entry_size() const { return table_entry_size; } |
---|
549 | void expand_table_entry_size(); |
---|
550 | int bigger_table_entry_size_needed(int new_no_of_sequences) { return table_entry_size==SHORT_TABLE_ELEM_SIZE ? (new_no_of_sequences>SHORT_TABLE_MAX_VALUE) : 0; } |
---|
551 | |
---|
552 | int operator[](int offset) const {return table_entry_size==SHORT_TABLE_ELEM_SIZE ? get_elem_short(offset) : get_elem_long(offset);} |
---|
553 | |
---|
554 | void inc_short(int offset) { set_elem_short(offset, get_elem_short(offset)+1); } |
---|
555 | void dec_short(int offset) { set_elem_short(offset, get_elem_short(offset)-1); } |
---|
556 | void inc_long(int offset) { set_elem_long(offset, get_elem_long(offset)+1); } |
---|
557 | void dec_long(int offset) { set_elem_long(offset, get_elem_long(offset)-1); } |
---|
558 | |
---|
559 | int firstDifference(const ED4_bases_table& other, int start, int end, int *firstDifferentPos) const; |
---|
560 | int lastDifference(const ED4_bases_table& other, int start, int end, int *lastDifferentPos) const; |
---|
561 | |
---|
562 | void add(const ED4_bases_table& other, int start, int end); |
---|
563 | void sub(const ED4_bases_table& other, int start, int end); |
---|
564 | void sub_and_add(const ED4_bases_table& Sub, const ED4_bases_table& Add, int start, int end); |
---|
565 | |
---|
566 | void change_table_length(int new_length, int default_entry); |
---|
567 | |
---|
568 | |
---|
569 | #ifdef ASSERTION_USED |
---|
570 | int empty() const; |
---|
571 | #endif // ASSERTION_USED |
---|
572 | }; |
---|
573 | |
---|
574 | typedef ED4_bases_table *ED4_bases_table_ptr; |
---|
575 | |
---|
576 | #if defined(DEBUG) && !defined(DEVEL_RELEASE) |
---|
577 | # define TEST_CHAR_TABLE_INTEGRITY // uncomment to remove tests for ED4_char_table |
---|
578 | #endif // DEBUG |
---|
579 | |
---|
580 | // -------------------------------------------------------------------------------- |
---|
581 | // class ED4_char_table |
---|
582 | // -------------------------------------------------------------------------------- |
---|
583 | class ED4_char_table |
---|
584 | { |
---|
585 | ED4_bases_table_ptr *bases_table; |
---|
586 | int sequences; // # of sequences added to the table |
---|
587 | int ignore; // this table will be ignored when calculating tables higher in hierarchy |
---|
588 | // (used to suppress SAI in root_group_man tables) |
---|
589 | |
---|
590 | static bool initialized; |
---|
591 | static unsigned char char_to_index_tab[MAXCHARTABLE]; |
---|
592 | static unsigned char *upper_index_chars; |
---|
593 | static unsigned char *lower_index_chars; |
---|
594 | static int used_bases_tables; // size of 'bases_table' |
---|
595 | |
---|
596 | inline void set_char_to_index(unsigned char c, int index); |
---|
597 | inline void set_string_to_index(const char *s, int index); |
---|
598 | |
---|
599 | ED4_char_table(const ED4_char_table&); // copy-constructor not allowed |
---|
600 | |
---|
601 | void add(const ED4_char_table& other, int start, int end); |
---|
602 | void sub(const ED4_char_table& other, int start, int end); |
---|
603 | |
---|
604 | void expand_tables(); |
---|
605 | int get_table_entry_size() const { |
---|
606 | return linear_table(0).get_table_entry_size(); |
---|
607 | } |
---|
608 | void prepare_to_add_elements(int new_sequences) { |
---|
609 | e4_assert(used_bases_tables); |
---|
610 | if (linear_table(0).bigger_table_entry_size_needed(sequences+new_sequences)) { |
---|
611 | expand_tables(); |
---|
612 | } |
---|
613 | } |
---|
614 | |
---|
615 | public: |
---|
616 | |
---|
617 | #if defined(TEST_CHAR_TABLE_INTEGRITY) || defined(ASSERTION_USED) |
---|
618 | bool ok() const; |
---|
619 | bool empty() const; |
---|
620 | #endif |
---|
621 | |
---|
622 | #if defined(TEST_CHAR_TABLE_INTEGRITY) |
---|
623 | void test() const; // test if table is valid (dumps core if invalid) |
---|
624 | #else |
---|
625 | void test() const { } |
---|
626 | #endif |
---|
627 | |
---|
628 | ED4_char_table(int maxseqlength=0); |
---|
629 | ~ED4_char_table(); |
---|
630 | |
---|
631 | void ignore_me() { ignore = 1; } |
---|
632 | int is_ignored() const { return ignore; } |
---|
633 | |
---|
634 | void init(int maxseqlength); |
---|
635 | int size() const { return bases_table[0]->size(); } |
---|
636 | int added_sequences() const { return sequences; } |
---|
637 | |
---|
638 | void bases_and_gaps_at(int column, int *bases, int *gaps) const; |
---|
639 | |
---|
640 | unsigned char index_to_upperChar(int index) const; |
---|
641 | unsigned char index_to_lowerChar(int index) const; |
---|
642 | |
---|
643 | // linear access to all tables |
---|
644 | ED4_bases_table& linear_table(int c) { e4_assert(c<used_bases_tables); return *bases_table[c]; } |
---|
645 | const ED4_bases_table& linear_table(int c) const { e4_assert(c<used_bases_tables); return *bases_table[c]; } |
---|
646 | |
---|
647 | // access via character |
---|
648 | ED4_bases_table& table(int c) { e4_assert(c>0 && c<MAXCHARTABLE); return linear_table(char_to_index_tab[c]); } |
---|
649 | const ED4_bases_table& table(int c) const { e4_assert(c>0 && c<MAXCHARTABLE); return linear_table(char_to_index_tab[c]); } |
---|
650 | |
---|
651 | int changed_range(const ED4_char_table& other, int *start, int *end) const; |
---|
652 | static int changed_range(const char *string1, const char *string2, int min_len, int *start, int *end); |
---|
653 | |
---|
654 | void add(const ED4_char_table& other); |
---|
655 | void sub(const ED4_char_table& other); |
---|
656 | void sub_and_add(const ED4_char_table& Sub, const ED4_char_table& Add); |
---|
657 | void sub_and_add(const ED4_char_table& Sub, const ED4_char_table& Add, int start, int end); |
---|
658 | |
---|
659 | void add(const char *string, int len); |
---|
660 | void sub(const char *string, int len); |
---|
661 | void sub_and_add(const char *old_string, const char *new_string, int start, int end); |
---|
662 | |
---|
663 | char *build_consensus_string(int left_idx=0, int right_index=-1, char *fill_id=0) const; |
---|
664 | |
---|
665 | void change_table_length(int new_length); |
---|
666 | }; |
---|
667 | |
---|
668 | // -------------------------------------------------------------------------------- |
---|
669 | // class ED4_species_pointer |
---|
670 | // -------------------------------------------------------------------------------- |
---|
671 | class ED4_species_pointer // @@@ shall be renamed into ED4_gbdata_pointer to reflect general usage |
---|
672 | { |
---|
673 | GBDATA *species_pointer; // points to database |
---|
674 | |
---|
675 | void add_callback(int *clientdata); |
---|
676 | void remove_callback(int *clientdata); |
---|
677 | |
---|
678 | public: |
---|
679 | |
---|
680 | ED4_species_pointer(); |
---|
681 | ~ED4_species_pointer(); |
---|
682 | |
---|
683 | GBDATA *get_species_pointer() const { return species_pointer; } |
---|
684 | void set_species_pointer(GBDATA *gbd, int *clientdata); |
---|
685 | void notify_deleted() { |
---|
686 | species_pointer=0; |
---|
687 | } |
---|
688 | }; |
---|
689 | |
---|
690 | // -------------------------------------------------------------------------------- |
---|
691 | // class ED4_base |
---|
692 | // -------------------------------------------------------------------------------- |
---|
693 | class ED4_base //functions and variables which are available in all objects |
---|
694 | { |
---|
695 | ED4_species_pointer my_species_pointer; |
---|
696 | ED4_base(const ED4_base&); // copy-constructor not allowed |
---|
697 | |
---|
698 | // cache world coordinates: |
---|
699 | |
---|
700 | static int actualTimestamp; |
---|
701 | AW_pos lastXpos; |
---|
702 | AW_pos lastYpos; |
---|
703 | int timestamp; |
---|
704 | |
---|
705 | public: |
---|
706 | |
---|
707 | ED4_manager *parent; //Points to parent |
---|
708 | ED4_object_specification *spec; //contains information about Objectproperties |
---|
709 | ED4_properties dynamic_prop; //contains info about what i am, what i can do, what i should do |
---|
710 | char *id; //globally unique name in hierarchy |
---|
711 | ED4_index index; //defines the order of child objects |
---|
712 | ED4_base *width_link; //concerning the hierarchy |
---|
713 | ED4_base *height_link; //concerning the hierarchy |
---|
714 | ED4_extension extension; //contains relativ info about graphical properties |
---|
715 | ED4_list linked_objects; //linked list of objects which are depending from this object |
---|
716 | ED4_update_info update_info; //info about things to be done for the object, i.e. refresh; flag structure |
---|
717 | struct { |
---|
718 | unsigned int hidden:1; //flag whether object is hidden or not |
---|
719 | unsigned int is_consensus:1; //indicates whether object is consensus(manager) |
---|
720 | unsigned int is_SAI:1; //indicates whether object is extendend |
---|
721 | } flag; |
---|
722 | |
---|
723 | void draw_bb(int color); |
---|
724 | |
---|
725 | #if defined(IMPLEMENT_DUMP) |
---|
726 | virtual void dump(size_t indent) const = 0; |
---|
727 | void dump_base(size_t indent) const; |
---|
728 | #endif // IMPLEMENT_DUMP |
---|
729 | |
---|
730 | // function for species_pointer |
---|
731 | |
---|
732 | GBDATA *get_species_pointer() const { return my_species_pointer.get_species_pointer(); } |
---|
733 | void set_species_pointer(GBDATA *gbd) { my_species_pointer.set_species_pointer(gbd, (int*)(this)); } |
---|
734 | int has_callback() const { return get_species_pointer()!=0; } |
---|
735 | |
---|
736 | // callbacks |
---|
737 | |
---|
738 | virtual void changed_by_database(); |
---|
739 | virtual void deleted_from_database(); |
---|
740 | |
---|
741 | virtual bool remove_deleted_childs(); |
---|
742 | |
---|
743 | // functions concerned with graphic output |
---|
744 | virtual int adjust_clipping_rectangle(void); //sets scrolling area in AW_MIDDLE_AREA |
---|
745 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0) = 0; |
---|
746 | virtual ED4_returncode Resize() = 0; |
---|
747 | virtual ED4_returncode clear_background(int color=0); |
---|
748 | virtual short calc_bounding_box(void) = 0; |
---|
749 | |
---|
750 | ED4_returncode clear_whole_background( void ); // clear AW_MIDDLE_AREA |
---|
751 | bool is_visible(AW_pos x, AW_pos y, ED4_direction direction); |
---|
752 | bool is_visible(AW_pos x1, AW_pos y1, AW_pos x2, AW_pos y2, ED4_direction direction); |
---|
753 | |
---|
754 | //functions concerned with links in the hierarchy |
---|
755 | virtual ED4_returncode set_links(ED4_base *width_link, ED4_base *height_link); |
---|
756 | virtual ED4_returncode link_changed(ED4_base *link); |
---|
757 | |
---|
758 | //functions concerned with special initialisation |
---|
759 | virtual void set_properties (ED4_properties prop); |
---|
760 | |
---|
761 | //functions concerned with coordinate transformation |
---|
762 | |
---|
763 | void update_world_coords_cache(); |
---|
764 | void calc_rel_coords( AW_pos *x, AW_pos *y ); |
---|
765 | |
---|
766 | void calc_world_coords(AW_pos *x, AW_pos *y) { |
---|
767 | bool cache_up_to_date = timestamp == actualTimestamp; |
---|
768 | if (!cache_up_to_date) { |
---|
769 | update_world_coords_cache(); |
---|
770 | } |
---|
771 | *x = lastXpos; |
---|
772 | *y = lastYpos; |
---|
773 | } |
---|
774 | |
---|
775 | static void touch_world_cache() { |
---|
776 | actualTimestamp++; |
---|
777 | } |
---|
778 | |
---|
779 | //functions which refer to the object as a child, i.e. travelling down the hierarchy |
---|
780 | virtual ED4_returncode set_refresh (int clear=1)=0; |
---|
781 | virtual ED4_returncode resize_requested_by_child(void)=0; |
---|
782 | virtual ED4_returncode resize_requested_by_parent(void)=0; |
---|
783 | |
---|
784 | virtual ED4_returncode delete_requested_by_parent(void)=0; |
---|
785 | virtual ED4_returncode delete_requested_by_child(void); |
---|
786 | virtual ED4_returncode delete_requested_childs(void)=0; |
---|
787 | |
---|
788 | virtual ED4_returncode calc_size_requested_by_parent( void )=0; |
---|
789 | virtual ED4_returncode move_requested_by_parent( ED4_move_info *mi )=0; |
---|
790 | virtual ED4_returncode event_sent_by_parent(AW_event *event, AW_window *aww); |
---|
791 | virtual ED4_returncode move_requested_by_child(ED4_move_info *moveinfo)=0; |
---|
792 | |
---|
793 | virtual ED4_returncode handle_move(ED4_move_info *moveinfo)=0; |
---|
794 | virtual ED4_returncode route_down_hierarchy(void **arg1, void **arg2, ED4_returncode (*function) (void **, void **, ED4_base *)); |
---|
795 | int calc_group_depth(); |
---|
796 | |
---|
797 | //general purpose functions |
---|
798 | virtual ED4_base *search_ID(const char *id)=0; |
---|
799 | virtual void check_all(); |
---|
800 | virtual short in_border( AW_pos abs_x, AW_pos abs_y, ED4_movemode mode ); |
---|
801 | virtual ED4_returncode set_width(); |
---|
802 | ED4_base *get_parent(ED4_level lev) const; |
---|
803 | |
---|
804 | ED4_AREA_LEVEL get_area_level(ED4_multi_species_manager **multi_species_manager=0) const; // returns area we belong to and the next multi species manager of the area |
---|
805 | |
---|
806 | bool has_parent(ED4_manager *Parent); |
---|
807 | bool is_child_of(ED4_manager *Parent) { return has_parent(Parent); } |
---|
808 | |
---|
809 | ED4_group_manager *is_in_folded_group() const; |
---|
810 | virtual char *resolve_pointer_to_string_copy(int *str_len = 0) const; |
---|
811 | virtual const char *resolve_pointer_to_char_pntr(int *str_len = 0) const; |
---|
812 | virtual ED4_ERROR *write_sequence(const char *seq, int seq_len); |
---|
813 | char *get_name_of_species(); // go from terminal to name of species |
---|
814 | |
---|
815 | // functions which refer to the selected object(s), i.e. across the hierarchy |
---|
816 | virtual ED4_base *get_competent_child( AW_pos x, AW_pos y, ED4_properties relevant_prop)=0; |
---|
817 | virtual ED4_base *get_competent_clicked_child( AW_pos x, AW_pos y, ED4_properties relevant_prop)=0; |
---|
818 | virtual ED4_base *search_spec_child_rek( ED4_level level ); //recursive search for level |
---|
819 | |
---|
820 | ED4_terminal *get_next_terminal(); |
---|
821 | ED4_terminal *get_prev_terminal(); |
---|
822 | |
---|
823 | ED4_returncode generate_configuration_string(char **generated_string); |
---|
824 | |
---|
825 | virtual ED4_returncode remove_callbacks(); |
---|
826 | ED4_terminal *get_consensus_relevant_terminal(); |
---|
827 | |
---|
828 | ED4_base(GB_CSTR id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); |
---|
829 | virtual ~ED4_base(); |
---|
830 | |
---|
831 | // use the following functions to test which derived class we have |
---|
832 | |
---|
833 | int is_terminal() const { return !this || spec->static_prop & ED4_P_IS_TERMINAL; } |
---|
834 | |
---|
835 | int is_text_terminal() const { return !this || spec->level & (ED4_L_SPECIES_NAME|ED4_L_SEQUENCE_INFO|ED4_L_SEQUENCE_STRING|ED4_L_PURE_TEXT|ED4_L_COL_STAT); } |
---|
836 | |
---|
837 | int is_species_name_terminal() const { return !this || spec->level & ED4_L_SPECIES_NAME; } |
---|
838 | int is_sequence_info_terminal() const { return !this || spec->level & ED4_L_SEQUENCE_INFO; } |
---|
839 | int is_sequence_terminal() const { return !this || spec->level & ED4_L_SEQUENCE_STRING; } |
---|
840 | int is_aa_sequence_terminal() const { return !this || spec->level & ED4_L_AA_SEQUENCE_STRING; }//ykadi |
---|
841 | int is_pure_text_terminal() const { return !this || spec->level & ED4_L_PURE_TEXT; } |
---|
842 | int is_columnStat_terminal() const { return !this || spec->level & ED4_L_COL_STAT; } |
---|
843 | |
---|
844 | int is_bracket_terminal() const { return !this || spec->level & ED4_L_BRACKET; } |
---|
845 | int is_spacer_terminal() const { return !this || spec->level & ED4_L_SPACER; } |
---|
846 | int is_line_terminal() const { return !this || spec->level & ED4_L_LINE; } |
---|
847 | |
---|
848 | int is_manager() const { return !this || spec->static_prop & ED4_P_IS_MANAGER; } |
---|
849 | |
---|
850 | int is_sequence_manager() const { return !this || spec->level & ED4_L_SEQUENCE; } |
---|
851 | int is_multi_name_manager() const { return !this || spec->level & ED4_L_MULTI_NAME; } |
---|
852 | int is_name_manager() const { return !this || spec->level & ED4_L_NAME_MANAGER; } |
---|
853 | int is_multi_species_manager() const { return !this || spec->level & ED4_L_MULTI_SPECIES; } |
---|
854 | int is_multi_sequence_manager() const { return !this || spec->level & ED4_L_MULTI_SEQUENCE; } |
---|
855 | int is_device_manager() const { return !this || spec->level & ED4_L_DEVICE; } |
---|
856 | int is_group_manager() const { return !this || spec->level & ED4_L_GROUP; } |
---|
857 | int is_species_manager() const { return !this || spec->level & ED4_L_SPECIES; } |
---|
858 | int is_area_manager() const { return !this || spec->level & ED4_L_AREA; } |
---|
859 | |
---|
860 | // use the following functions to cast ED4_base to derived classes: |
---|
861 | |
---|
862 | ED4_base *to_base() const { e4_assert(is_terminal() || is_manager()); return (ED4_base *)this; } |
---|
863 | |
---|
864 | ED4_terminal *to_terminal() const { e4_assert(is_terminal()); return (ED4_terminal *)this; } |
---|
865 | |
---|
866 | ED4_text_terminal *to_text_terminal() const { e4_assert(is_text_terminal()); return (ED4_text_terminal *)this; } |
---|
867 | |
---|
868 | ED4_species_name_terminal *to_species_name_terminal() const { e4_assert(is_species_name_terminal()); return (ED4_species_name_terminal *)this; } |
---|
869 | ED4_sequence_info_terminal *to_sequence_info_terminal() const { e4_assert(is_sequence_info_terminal()); return (ED4_sequence_info_terminal*)this; } |
---|
870 | ED4_sequence_terminal *to_sequence_terminal() const { e4_assert(is_sequence_terminal()); return (ED4_sequence_terminal*)this; } |
---|
871 | ED4_AA_sequence_terminal *to_aa_sequence_terminal() const { e4_assert(is_aa_sequence_terminal()); return (ED4_AA_sequence_terminal*)this; } //ykadi |
---|
872 | ED4_pure_text_terminal *to_pure_text_terminal() const { e4_assert(is_pure_text_terminal()); return (ED4_pure_text_terminal*)this; } |
---|
873 | ED4_columnStat_terminal *to_columnStat_terminal() const { e4_assert(is_columnStat_terminal()); return (ED4_columnStat_terminal*)this; } |
---|
874 | |
---|
875 | ED4_bracket_terminal *to_bracket_terminal() const { e4_assert(is_bracket_terminal()); return (ED4_bracket_terminal*)this; } |
---|
876 | ED4_spacer_terminal *to_spacer_terminal() const { e4_assert(is_spacer_terminal()); return (ED4_spacer_terminal*)this; } |
---|
877 | ED4_line_terminal *to_line_terminal() const { e4_assert(is_line_terminal()); return (ED4_line_terminal*)this; } |
---|
878 | |
---|
879 | ED4_manager *to_manager() const { e4_assert(is_manager()); return (ED4_manager *)this; } |
---|
880 | |
---|
881 | ED4_sequence_manager *to_sequence_manager() const { e4_assert(is_sequence_manager()); return (ED4_sequence_manager*)this; } |
---|
882 | ED4_multi_name_manager *to_multi_name_manager() const { e4_assert(is_multi_name_manager()); return (ED4_multi_name_manager *)this; } |
---|
883 | ED4_name_manager *to_name_manager() const { e4_assert(is_name_manager()); return (ED4_name_manager *)this; } |
---|
884 | ED4_multi_species_manager *to_multi_species_manager() const { e4_assert(is_multi_species_manager()); return (ED4_multi_species_manager *)this; } |
---|
885 | ED4_multi_sequence_manager *to_multi_sequence_manager() const { e4_assert(is_multi_sequence_manager()); return (ED4_multi_sequence_manager *)this; } |
---|
886 | ED4_device_manager *to_device_manager() const { e4_assert(is_device_manager()); return (ED4_device_manager *)this; } |
---|
887 | ED4_group_manager *to_group_manager() const { e4_assert(is_group_manager()); return (ED4_group_manager *)this; } |
---|
888 | ED4_species_manager *to_species_manager() const { e4_assert(is_species_manager()); return (ED4_species_manager *)this; } |
---|
889 | ED4_area_manager *to_area_manager() const { e4_assert(is_area_manager()); return (ED4_area_manager *)this; } |
---|
890 | }; |
---|
891 | |
---|
892 | // -------------------------------------------------------------------------------- |
---|
893 | // class ED4_manager : public ED4_base |
---|
894 | // -------------------------------------------------------------------------------- |
---|
895 | class ED4_manager : public ED4_base |
---|
896 | { |
---|
897 | ED4_manager(const ED4_manager&); // copy-constructor not allowed |
---|
898 | |
---|
899 | public: |
---|
900 | ED4_members *children; |
---|
901 | bool is_group; |
---|
902 | |
---|
903 | #if defined(IMPLEMENT_DUMP) |
---|
904 | virtual void dump(size_t indent) const; |
---|
905 | #endif // IMPLEMENT_DUMP |
---|
906 | |
---|
907 | int refresh_flag_ok(); |
---|
908 | |
---|
909 | virtual void changed_by_database(); |
---|
910 | virtual void deleted_from_database(); |
---|
911 | |
---|
912 | virtual bool remove_deleted_childs(); |
---|
913 | |
---|
914 | //functions concerned with graphics |
---|
915 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
916 | virtual ED4_returncode Resize(); |
---|
917 | virtual short calc_bounding_box(void); |
---|
918 | virtual ED4_returncode distribute_children(); |
---|
919 | |
---|
920 | //top-down functions, means travelling down the hierarchy |
---|
921 | virtual ED4_returncode event_sent_by_parent(AW_event *event, AW_window *aww); |
---|
922 | virtual ED4_returncode set_refresh(int clear=1); |
---|
923 | ED4_returncode clear_refresh(void); |
---|
924 | virtual ED4_returncode resize_requested_by_parent( void ); |
---|
925 | |
---|
926 | virtual ED4_returncode delete_requested_by_parent(void); |
---|
927 | virtual ED4_returncode delete_requested_childs(void); |
---|
928 | |
---|
929 | virtual ED4_returncode calc_size_requested_by_parent( void ); |
---|
930 | virtual ED4_returncode move_requested_by_parent( ED4_move_info *mi ); |
---|
931 | void create_consensus(ED4_group_manager *upper_group_manager); |
---|
932 | virtual ED4_returncode route_down_hierarchy(void **arg1, void **arg2, ED4_returncode (*function) (void **, void **, ED4_base *)); |
---|
933 | |
---|
934 | virtual ED4_base* find_first_that(ED4_level level, int (*condition)(ED4_base *to_test, AW_CL arg), AW_CL arg); |
---|
935 | virtual ED4_base* find_first_that(ED4_level level, int (*condition)(ED4_base *to_test)); |
---|
936 | |
---|
937 | // bottom-up functions |
---|
938 | virtual ED4_returncode move_requested_by_child(ED4_move_info *moveinfo); |
---|
939 | virtual ED4_returncode resize_requested_by_child(void); |
---|
940 | virtual ED4_returncode refresh_requested_by_child(void); |
---|
941 | ED4_base *get_defined_level(ED4_level lev) const; |
---|
942 | |
---|
943 | // functions refering the consensus |
---|
944 | |
---|
945 | ED4_returncode create_group( ED4_group_manager **group_manager, GB_CSTR group_name); |
---|
946 | |
---|
947 | virtual ED4_returncode update_consensus(ED4_manager *old_parent, ED4_manager *new_parent, ED4_base *sequence, int start_pos = 0, int end_pos = -1); |
---|
948 | virtual ED4_returncode rebuild_consensi( ED4_base *start_species, ED4_update_flag update_flag); |
---|
949 | |
---|
950 | virtual ED4_returncode check_in_bases(ED4_base *added_base, int start_pos=0, int end_pos=-1); |
---|
951 | virtual ED4_returncode check_out_bases(ED4_base *subbed_base, int start_pos=0, int end_pos=-1); |
---|
952 | virtual ED4_returncode check_bases(const ED4_base *old_base, const ED4_base *new_base, int start_pos=0, int end_pos=-1); |
---|
953 | virtual ED4_returncode check_bases(const char *old_seq, int old_len, const char *new_seq, int new_len, int start_pos=0, int end_pos=-1); |
---|
954 | virtual ED4_returncode check_bases(const char *old_seq, int old_len, const ED4_base *new_base, int start_pos=0, int end_pos=-1); |
---|
955 | virtual ED4_returncode check_bases(const ED4_char_table *old_table, const ED4_char_table *new_table, int start_pos=0, int end_pos=-1); |
---|
956 | |
---|
957 | virtual ED4_returncode check_bases_and_rebuild_consensi(const char *old_seq, int old_len, ED4_base *species, ED4_update_flag update_flag, int start_pos=0, int end_pos=-1); |
---|
958 | |
---|
959 | void generate_id_for_groups(); |
---|
960 | |
---|
961 | // handle moves across the hierarchy |
---|
962 | virtual ED4_returncode handle_move(ED4_move_info *moveinfo); |
---|
963 | virtual ED4_base *get_competent_child( AW_pos x, AW_pos y, ED4_properties relevant_prop); |
---|
964 | virtual ED4_base *get_competent_clicked_child( AW_pos x, AW_pos y, ED4_properties relevant_prop); |
---|
965 | virtual ED4_base *search_spec_child_rek( ED4_level level ); //recursive search for level |
---|
966 | |
---|
967 | //general purpose functions |
---|
968 | virtual ED4_base *search_ID(const char *id); |
---|
969 | virtual ED4_returncode remove_callbacks(); |
---|
970 | |
---|
971 | ED4_terminal *get_first_terminal(int start_index=0) const; |
---|
972 | ED4_terminal *get_last_terminal(int start_index=-1) const; |
---|
973 | |
---|
974 | //general folding functions |
---|
975 | virtual ED4_returncode unfold_group(char *bracketID_to_unfold); |
---|
976 | virtual ED4_returncode fold_group(char *bracketID_to_fold); |
---|
977 | virtual ED4_returncode make_children_visible(void); |
---|
978 | virtual ED4_returncode hide_children(void); |
---|
979 | |
---|
980 | ED4_manager(const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0); |
---|
981 | virtual ~ED4_manager(); |
---|
982 | }; |
---|
983 | |
---|
984 | |
---|
985 | // -------------------------------------------------------------------------------- |
---|
986 | // class ED4_terminal : public ED4_base |
---|
987 | // -------------------------------------------------------------------------------- |
---|
988 | class ED4_terminal : public ED4_base |
---|
989 | { |
---|
990 | ED4_terminal(const ED4_terminal&); // copy-constructor not allowed |
---|
991 | public: |
---|
992 | struct { |
---|
993 | unsigned int selected:1; //Flag for 'Object selected' |
---|
994 | unsigned int dragged:1; //Flag for 'Object dragged' |
---|
995 | unsigned int deleted:1; |
---|
996 | } flag; |
---|
997 | // unsigned int has_callback:1; |
---|
998 | ED4_selection_entry *selection_info; //Info about i.e. Position |
---|
999 | long actual_timestamp; |
---|
1000 | |
---|
1001 | #if defined(IMPLEMENT_DUMP) |
---|
1002 | virtual void dump(size_t indent) const; |
---|
1003 | #endif // IMPLEMENT_DUMP |
---|
1004 | |
---|
1005 | // callbacks |
---|
1006 | |
---|
1007 | virtual void changed_by_database(void); |
---|
1008 | virtual void deleted_from_database(void); |
---|
1009 | |
---|
1010 | virtual bool remove_deleted_childs(); |
---|
1011 | |
---|
1012 | //functions concerning graphic output |
---|
1013 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0) = 0; |
---|
1014 | virtual ED4_returncode Resize(); |
---|
1015 | virtual ED4_returncode draw( int only_text = 0 ) = 0; |
---|
1016 | |
---|
1017 | virtual int adjust_clipping_rectangle(void); |
---|
1018 | virtual short calc_bounding_box(void); |
---|
1019 | virtual ED4_returncode calc_size_requested_by_parent( void ); |
---|
1020 | |
---|
1021 | virtual ED4_returncode draw_drag_box( AW_pos x, AW_pos y, GB_CSTR text = NULL, int cursor_y=-1 ); |
---|
1022 | |
---|
1023 | //functions which concern the object as a child |
---|
1024 | virtual ED4_returncode set_refresh(int clear=1); |
---|
1025 | virtual ED4_returncode resize_requested_by_child(void); |
---|
1026 | virtual ED4_returncode resize_requested_by_parent(void); |
---|
1027 | |
---|
1028 | virtual ED4_returncode delete_requested_by_parent(void); |
---|
1029 | virtual ED4_returncode delete_requested_childs(void); |
---|
1030 | |
---|
1031 | virtual ED4_returncode move_requested_by_parent( ED4_move_info *mi ); |
---|
1032 | virtual ED4_returncode event_sent_by_parent(AW_event *event, AW_window *aww); |
---|
1033 | virtual ED4_base *get_competent_child( AW_pos x, AW_pos y, ED4_properties relevant_prop); |
---|
1034 | virtual ED4_base *get_competent_clicked_child( AW_pos x, AW_pos y, ED4_properties relevant_prop); |
---|
1035 | virtual ED4_returncode move_requested_by_child(ED4_move_info *moveinfo); |
---|
1036 | virtual ED4_returncode handle_move(ED4_move_info *moveinfo); |
---|
1037 | virtual ED4_returncode kill_object(); |
---|
1038 | |
---|
1039 | //general purpose functions |
---|
1040 | virtual ED4_base *search_ID(const char *id); |
---|
1041 | virtual char *resolve_pointer_to_string_copy(int *str_len = 0) const; // concerning terminal and database |
---|
1042 | virtual const char *resolve_pointer_to_char_pntr(int *str_len = 0) const; // concerning terminal and database |
---|
1043 | virtual ED4_ERROR *write_sequence(const char *seq, int seq_len); |
---|
1044 | virtual ED4_returncode remove_callbacks(); |
---|
1045 | |
---|
1046 | void scroll_into_view(AW_window *aww); |
---|
1047 | inline bool setCursorTo(ED4_cursor *cursor, int seq_pos, bool unfoldGroups, ED4_CursorJumpType jump_type); |
---|
1048 | |
---|
1049 | ED4_terminal(GB_CSTR id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); |
---|
1050 | virtual ~ED4_terminal(); |
---|
1051 | }; |
---|
1052 | |
---|
1053 | typedef enum { |
---|
1054 | ED4_SM_MOVE, |
---|
1055 | ED4_SM_KILL, |
---|
1056 | ED4_SM_MARK |
---|
1057 | } ED4_species_mode; |
---|
1058 | |
---|
1059 | // -------------------------------------------------------------------------------- |
---|
1060 | // class ED4_reference_terminals |
---|
1061 | // -------------------------------------------------------------------------------- |
---|
1062 | class ED4_reference_terminals |
---|
1063 | { |
---|
1064 | ED4_sequence_info_terminal *ref_sequence_info; |
---|
1065 | ED4_sequence_terminal *ref_sequence; |
---|
1066 | ED4_sequence_info_terminal *ref_column_stat_info; |
---|
1067 | ED4_columnStat_terminal *ref_column_stat; |
---|
1068 | |
---|
1069 | void null() { ref_sequence_info = 0; ref_sequence = 0; ref_column_stat = 0; ref_column_stat_info = 0; } |
---|
1070 | public: |
---|
1071 | void clear(); |
---|
1072 | void init(ED4_sequence_info_terminal *, ED4_sequence_terminal *, ED4_sequence_info_terminal *, ED4_columnStat_terminal *); |
---|
1073 | |
---|
1074 | ED4_sequence_info_terminal *get_ref_sequence_info() { return ref_sequence_info; } |
---|
1075 | ED4_sequence_terminal *get_ref_sequence() { return ref_sequence; } |
---|
1076 | ED4_sequence_info_terminal *get_ref_column_stat_info() { return ref_column_stat_info; } |
---|
1077 | ED4_columnStat_terminal *get_ref_column_stat() { return ref_column_stat; } |
---|
1078 | |
---|
1079 | ED4_reference_terminals() { null(); } |
---|
1080 | ~ED4_reference_terminals() { clear(); } |
---|
1081 | }; |
---|
1082 | |
---|
1083 | // -------------------------------------------------------------------------------- |
---|
1084 | // class ED4_root |
---|
1085 | // -------------------------------------------------------------------------------- |
---|
1086 | class ED4_root |
---|
1087 | { |
---|
1088 | int ED4_ROOT; |
---|
1089 | ED4_root(const ED4_root&); // copy-constructor not allowed |
---|
1090 | public: |
---|
1091 | AW_root *aw_root; // Points to 'AW-Window-Controller' |
---|
1092 | AW_default db; // Default Properties database |
---|
1093 | const char *db_name; // name of Default Properties database |
---|
1094 | ED4_window *first_window; // Points to List of Main Windows of ED4 |
---|
1095 | ED4_main_manager *main_manager; // Points to Main manager of ED4 |
---|
1096 | ED4_area_manager *middle_area_man; // Points to middle area |
---|
1097 | ED4_area_manager *top_area_man; |
---|
1098 | ED4_root_group_manager *root_group_man; |
---|
1099 | EDB_root_bact *database; // Points to Object which controls Data |
---|
1100 | ED4_list selected_objects; |
---|
1101 | ED4_scroll_links scroll_links; |
---|
1102 | bool folding_action; // flag tells whether action was folding action or not |
---|
1103 | // ED4_cursor has_cursor[MAXWINDOWS]; // class for cursor handling |
---|
1104 | ED4_reference_terminals ref_terminals; |
---|
1105 | ED4_species_mode species_mode; |
---|
1106 | ED4_scroll_picture scroll_picture; |
---|
1107 | BI_ecoli_ref *ecoli_ref; |
---|
1108 | char *alignment_name; |
---|
1109 | GB_alignment_type alignment_type; |
---|
1110 | AWT_reference *reference; |
---|
1111 | AWT_seq_colors *sequence_colors; |
---|
1112 | AW_gc_manager aw_gc_manager; |
---|
1113 | ST_ML *st_ml; |
---|
1114 | AW_helix *helix; |
---|
1115 | int helix_spacing; |
---|
1116 | long helix_add_spacing; |
---|
1117 | long terminal_add_spacing; |
---|
1118 | char *protstruct; // protein structure summary |
---|
1119 | long protstruct_len; // protein structure summary |
---|
1120 | ed_key *edk; |
---|
1121 | ED4_Edit_String *edit_string; |
---|
1122 | int column_stat_activated; |
---|
1123 | int column_stat_initialized; |
---|
1124 | int visualizeSAI; |
---|
1125 | int visualizeSAI_allSpecies; |
---|
1126 | |
---|
1127 | private: |
---|
1128 | AW_window *tmp_aww; |
---|
1129 | ED4_window *tmp_ed4w; |
---|
1130 | AW_device *tmp_device; |
---|
1131 | |
---|
1132 | public: |
---|
1133 | void use_window(AW_window *aww) { |
---|
1134 | if (aww != tmp_aww) { |
---|
1135 | e4_assert(aww); |
---|
1136 | tmp_aww = aww; |
---|
1137 | tmp_device = aww->get_device(AW_MIDDLE_AREA); |
---|
1138 | e4_assert(tmp_device); |
---|
1139 | tmp_ed4w = first_window->get_matching_ed4w(aww); |
---|
1140 | e4_assert(tmp_ed4w); |
---|
1141 | } |
---|
1142 | } |
---|
1143 | void use_window(ED4_window *ed4w) { |
---|
1144 | e4_assert(ed4w); |
---|
1145 | tmp_ed4w = ed4w; |
---|
1146 | tmp_aww = ed4w->aww; |
---|
1147 | tmp_device = tmp_aww->get_device(AW_MIDDLE_AREA); |
---|
1148 | e4_assert(tmp_device); |
---|
1149 | } |
---|
1150 | void use_first_window() { use_window(first_window); } |
---|
1151 | |
---|
1152 | AW_window *get_aww() const { e4_assert(tmp_aww); return tmp_aww; } |
---|
1153 | AW_device *get_device() const { e4_assert(tmp_device); return tmp_device; } |
---|
1154 | ED4_window *get_ed4w() const { e4_assert(tmp_ed4w); return tmp_ed4w; } |
---|
1155 | |
---|
1156 | int temp_gc; |
---|
1157 | AW_font_group font_group; |
---|
1158 | |
---|
1159 | //Initializing functions |
---|
1160 | ED4_returncode create_hierarchy(char *area_string_middle, char *area_string_top); // flag only needed for loading a new configuration |
---|
1161 | ED4_returncode init_alignment(); |
---|
1162 | void recalc_font_group(); |
---|
1163 | |
---|
1164 | AW_window *create_new_window(void); |
---|
1165 | ED4_returncode generate_window( AW_device **device, ED4_window **new_window); |
---|
1166 | void copy_window_struct( ED4_window *source , ED4_window *destination ); |
---|
1167 | |
---|
1168 | //functions concerned with global refresh and resize |
---|
1169 | ED4_returncode resize_all( void ); |
---|
1170 | |
---|
1171 | private: |
---|
1172 | ED4_returncode refresh_window_simple(int redraw); |
---|
1173 | public: |
---|
1174 | ED4_returncode refresh_window(int redraw); |
---|
1175 | ED4_returncode refresh_all_windows(int redraw); |
---|
1176 | |
---|
1177 | void announce_deletion(ED4_base *object); // before deleting an object, announce here |
---|
1178 | |
---|
1179 | // functions concerned with list of selected objects |
---|
1180 | ED4_returncode add_to_selected( ED4_terminal *object ); |
---|
1181 | ED4_returncode remove_from_selected( ED4_terminal *object); |
---|
1182 | short is_primary_selection( ED4_terminal *object); |
---|
1183 | ED4_returncode deselect_all( void ); |
---|
1184 | |
---|
1185 | //functions concerning coordinate transformation |
---|
1186 | ED4_returncode world_to_win_coords(AW_window *aww, AW_pos *x, AW_pos *y); |
---|
1187 | ED4_returncode win_to_world_coords( AW_window *aww, AW_pos *x, AW_pos *y ); |
---|
1188 | ED4_returncode get_area_rectangle(AW_rectangle *rect, AW_pos x, AW_pos y); |
---|
1189 | |
---|
1190 | ED4_index pixel2pos(AW_pos click_x); |
---|
1191 | |
---|
1192 | ED4_root(); |
---|
1193 | ~ED4_root(); |
---|
1194 | }; |
---|
1195 | |
---|
1196 | //*************************************** |
---|
1197 | //* Manager specifications beginning * |
---|
1198 | //*************************************** |
---|
1199 | // All manager class only differ in their static properties. This kind of construction was chosen for using a minimum of RAM |
---|
1200 | |
---|
1201 | // -------------------------------------------------------------------------------- |
---|
1202 | // class ED4_main_manager : public ED4_manager |
---|
1203 | // -------------------------------------------------------------------------------- |
---|
1204 | class ED4_main_manager : public ED4_manager // first in hierarchy |
---|
1205 | { |
---|
1206 | // these terminals are redrawn after refresh (with increase clipping area) |
---|
1207 | // to revert text from middle area drawn into top area: |
---|
1208 | ED4_terminal *top_middle_line; |
---|
1209 | ED4_terminal *top_middle_spacer; |
---|
1210 | |
---|
1211 | ED4_main_manager(const ED4_main_manager&); // copy-constructor not allowed |
---|
1212 | public: |
---|
1213 | ED4_main_manager( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1214 | ~ED4_main_manager(); |
---|
1215 | |
---|
1216 | void set_top_middle_spacer_terminal(ED4_terminal *top_middle_spacer_) { top_middle_spacer = top_middle_spacer_; } |
---|
1217 | void set_top_middle_line_terminal(ED4_terminal *top_middle_line_) { top_middle_line = top_middle_line_; } |
---|
1218 | |
---|
1219 | ED4_terminal *get_top_middle_spacer_terminal() const { return top_middle_spacer; } |
---|
1220 | ED4_terminal *get_top_middle_line_terminal() const { return top_middle_line; } |
---|
1221 | |
---|
1222 | #if defined(IMPLEMENT_DUMP) |
---|
1223 | virtual void dump(size_t indent) const; |
---|
1224 | #endif // IMPLEMENT_DUMP |
---|
1225 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1226 | virtual ED4_returncode resize_requested_by_parent(void); |
---|
1227 | }; |
---|
1228 | |
---|
1229 | // -------------------------------------------------------------------------------- |
---|
1230 | // class ED4_device_manager : public ED4_manager |
---|
1231 | // -------------------------------------------------------------------------------- |
---|
1232 | class ED4_device_manager : public ED4_manager |
---|
1233 | { |
---|
1234 | ED4_device_manager(const ED4_device_manager&); // copy-constructor not allowed |
---|
1235 | public: |
---|
1236 | ED4_device_manager ( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1237 | ~ED4_device_manager (); |
---|
1238 | |
---|
1239 | #if defined(IMPLEMENT_DUMP) |
---|
1240 | virtual void dump(size_t indent) const; |
---|
1241 | #endif // IMPLEMENT_DUMP |
---|
1242 | }; |
---|
1243 | |
---|
1244 | // -------------------------------------------------------------------------------- |
---|
1245 | // class ED4_area_manager : public ED4_manager |
---|
1246 | // -------------------------------------------------------------------------------- |
---|
1247 | class ED4_area_manager : public ED4_manager |
---|
1248 | { |
---|
1249 | ED4_area_manager(const ED4_area_manager&); // copy-constructor not allowed |
---|
1250 | public: |
---|
1251 | ED4_area_manager ( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1252 | ~ED4_area_manager (); |
---|
1253 | #if defined(IMPLEMENT_DUMP) |
---|
1254 | virtual void dump(size_t indent) const; |
---|
1255 | #endif // IMPLEMENT_DUMP |
---|
1256 | }; |
---|
1257 | |
---|
1258 | // -------------------------------------------------------------------------------- |
---|
1259 | // class ED4_multi_species_manager : public ED4_manager |
---|
1260 | // -------------------------------------------------------------------------------- |
---|
1261 | class ED4_multi_species_manager : public ED4_manager |
---|
1262 | { |
---|
1263 | int species; // # of species (-1 == unknown) |
---|
1264 | int selected_species; // # of selected species (-1 == unknown) |
---|
1265 | |
---|
1266 | void set_species_counters(int no_of_species, int no_of_selected); |
---|
1267 | #ifdef DEBUG |
---|
1268 | void count_species(int *speciesPtr, int *selectedPtr) const; |
---|
1269 | #endif |
---|
1270 | void update_species_counters(); |
---|
1271 | |
---|
1272 | ED4_multi_species_manager(const ED4_multi_species_manager&); // copy-constructor not allowed |
---|
1273 | |
---|
1274 | public: |
---|
1275 | ED4_multi_species_manager( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1276 | ~ED4_multi_species_manager(); |
---|
1277 | |
---|
1278 | #if defined(IMPLEMENT_DUMP) |
---|
1279 | virtual void dump(size_t indent) const; |
---|
1280 | #endif // IMPLEMENT_DUMP |
---|
1281 | |
---|
1282 | int count_visible_children(); // is called by a multi_species_manager |
---|
1283 | int count_all_children_and_set_group_id(); // counts all children of a parent |
---|
1284 | ED4_terminal *get_consensus_terminal(); // returns the consensus-terminal or 0 |
---|
1285 | ED4_species_manager *get_consensus_manager() const; // returns the consensus-manager or 0 |
---|
1286 | |
---|
1287 | // functions concerned with selection |
---|
1288 | int get_no_of_selected_species(); |
---|
1289 | int get_no_of_species(); |
---|
1290 | |
---|
1291 | void invalidate_species_counters(); |
---|
1292 | int has_valid_counters() const { return species!=-1 && selected_species!=-1; } |
---|
1293 | |
---|
1294 | void select_all_species(); |
---|
1295 | void deselect_all_species(); |
---|
1296 | void invert_selection_of_all_species(); |
---|
1297 | void select_marked_species(int select); |
---|
1298 | void mark_selected_species(int mark); |
---|
1299 | }; |
---|
1300 | |
---|
1301 | // -------------------------------------------------------------------------------- |
---|
1302 | // class ED4_group_manager : public ED4_manager |
---|
1303 | // -------------------------------------------------------------------------------- |
---|
1304 | class ED4_group_manager : public ED4_manager |
---|
1305 | { |
---|
1306 | ED4_group_manager(const ED4_group_manager&); // copy-constructor not allowed |
---|
1307 | |
---|
1308 | protected: |
---|
1309 | |
---|
1310 | ED4_char_table my_table; // table concerning Consensusfunction |
---|
1311 | |
---|
1312 | public: |
---|
1313 | |
---|
1314 | ED4_group_manager( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1315 | virtual ~ED4_group_manager(); |
---|
1316 | |
---|
1317 | #if defined(IMPLEMENT_DUMP) |
---|
1318 | virtual void dump(size_t indent) const; |
---|
1319 | #endif // IMPLEMENT_DUMP |
---|
1320 | |
---|
1321 | ED4_char_table& table() { return my_table; } |
---|
1322 | const ED4_char_table& table() const { return my_table; } |
---|
1323 | |
---|
1324 | ED4_bases_table& table(unsigned char c) {return table().table(c);} |
---|
1325 | const ED4_bases_table& table(unsigned char c) const {return table().table(c);} |
---|
1326 | |
---|
1327 | void reinit_char_table(); |
---|
1328 | }; |
---|
1329 | |
---|
1330 | typedef enum |
---|
1331 | { |
---|
1332 | ED4_RM_NONE, // no remapping (normal mode) |
---|
1333 | ED4_RM_SHOW_ABOVE, // Show all positions, where xxx% of all edited sequences have any base |
---|
1334 | ED4_RM_MAX_ALIGN, // ------------------------- any edited sequence has a base |
---|
1335 | ED4_RM_MAX_EDIT, // like ED4_RM_MAX_ALIGN, but bases are pushed OVER remapped gaps (not INTO) |
---|
1336 | ED4_RM_DYNAMIC_GAPS, // gaps shown as spaces (more gaps => more spaces) |
---|
1337 | |
---|
1338 | ED4_RM_MODES |
---|
1339 | |
---|
1340 | } ED4_remap_mode; |
---|
1341 | |
---|
1342 | // -------------------------------------------------------------------------------- |
---|
1343 | // class ED4_remap |
---|
1344 | // -------------------------------------------------------------------------------- |
---|
1345 | class ED4_remap { |
---|
1346 | |
---|
1347 | ED4_remap_mode mode; |
---|
1348 | int show_above_percent; // used only for ED4_RM_SHOW_ABOVE |
---|
1349 | |
---|
1350 | size_t sequence_table_len; // allocated size of sequence_to_screen_tab |
---|
1351 | size_t screen_table_len; // allocated size of screen_to_sequence_tab |
---|
1352 | |
---|
1353 | size_t sequence_len; // size of recently compiled part of sequence_to_screen_tab |
---|
1354 | size_t screen_len; // size of recently compiled part of screen_to_sequence_tab |
---|
1355 | |
---|
1356 | int *screen_to_sequence_tab; |
---|
1357 | int *sequence_to_screen_tab; // <0 means position is not mapped (last displayed sequence position) |
---|
1358 | |
---|
1359 | int changed; // remap-table changed at last compile |
---|
1360 | int update_needed; // remapping should be recompiled |
---|
1361 | |
---|
1362 | long clip(long pos, long min_pos, long max_pos) const { return pos<min_pos ? min_pos : (pos<=max_pos ? pos : max_pos); } |
---|
1363 | inline void set_sequence_to_screen(int pos, int newVal); |
---|
1364 | |
---|
1365 | ED4_remap(const ED4_remap&); // copy-constructor not allowed |
---|
1366 | |
---|
1367 | public: |
---|
1368 | |
---|
1369 | ED4_remap(); |
---|
1370 | ~ED4_remap(); |
---|
1371 | |
---|
1372 | int screen_to_sequence(int screen_pos) const; |
---|
1373 | int sequence_to_screen(int sequence_pos) const; |
---|
1374 | int clipped_sequence_to_screen(int sequence_pos) const; |
---|
1375 | int sequence_to_screen_clipped(int sequence_pos) const; |
---|
1376 | size_t get_max_screen_pos() const { return screen_len-1; } |
---|
1377 | |
---|
1378 | ED4_remap_mode get_mode() const { return mode; } |
---|
1379 | void set_mode(ED4_remap_mode Mode, int above_percent) { |
---|
1380 | if (Mode<0 || Mode>=ED4_RM_MODES) { |
---|
1381 | Mode = ED4_RM_NONE; |
---|
1382 | } |
---|
1383 | if (mode!=Mode) { |
---|
1384 | mode = Mode; |
---|
1385 | update_needed = 1; |
---|
1386 | } |
---|
1387 | |
---|
1388 | if (show_above_percent!=above_percent) { |
---|
1389 | show_above_percent = above_percent; |
---|
1390 | if (mode==ED4_RM_SHOW_ABOVE) { |
---|
1391 | update_needed = 1; |
---|
1392 | } |
---|
1393 | } |
---|
1394 | } |
---|
1395 | |
---|
1396 | void mark_compile_needed(); // recompile if mode != none |
---|
1397 | void mark_compile_needed_force(); // always recompile |
---|
1398 | int compile_needed() const { return update_needed; } |
---|
1399 | |
---|
1400 | GB_ERROR compile(ED4_root_group_manager *gm); |
---|
1401 | int was_changed() const { return changed; } // mapping changed by last compile ? |
---|
1402 | |
---|
1403 | int is_visible(int position) const { return sequence_to_screen(position)>=0; } |
---|
1404 | |
---|
1405 | void clip_screen_range(long *left_screen_pos, long *right_screen_pos) const { |
---|
1406 | *right_screen_pos = clip(*right_screen_pos, 0, screen_len-1); |
---|
1407 | *left_screen_pos = clip(*left_screen_pos, 0, screen_len-1); |
---|
1408 | } |
---|
1409 | }; |
---|
1410 | |
---|
1411 | // -------------------------------------------------------------------------------- |
---|
1412 | // class ED4_root_group_manager : public ED4_group_manager |
---|
1413 | // -------------------------------------------------------------------------------- |
---|
1414 | class ED4_root_group_manager : public ED4_group_manager |
---|
1415 | { |
---|
1416 | ED4_remap my_remap; |
---|
1417 | |
---|
1418 | ED4_root_group_manager(const ED4_root_group_manager&); // copy-constructor not allowed |
---|
1419 | |
---|
1420 | public: |
---|
1421 | |
---|
1422 | ED4_root_group_manager( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1423 | ~ED4_root_group_manager(); |
---|
1424 | |
---|
1425 | int update_remap(); // TRUE if mapping has changed |
---|
1426 | |
---|
1427 | const ED4_remap *remap() const { return &my_remap; } |
---|
1428 | ED4_remap *remap() { return &my_remap; } |
---|
1429 | |
---|
1430 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1431 | virtual ED4_returncode resize_requested_by_parent( void ); |
---|
1432 | }; |
---|
1433 | |
---|
1434 | // ----------------------------------------------- |
---|
1435 | // callback decls for ED4_species_manager |
---|
1436 | // ----------------------------------------------- |
---|
1437 | |
---|
1438 | typedef void (*ED4_species_manager_cb)(ED4_species_manager*, AW_CL); |
---|
1439 | |
---|
1440 | class ED4_species_manager_cb_data { |
---|
1441 | ED4_species_manager_cb cb; |
---|
1442 | AW_CL cd; // client data |
---|
1443 | |
---|
1444 | public: |
---|
1445 | ED4_species_manager_cb_data(ED4_species_manager_cb cb_, AW_CL cd_) : cb(cb_), cd(cd_) {} |
---|
1446 | |
---|
1447 | void call(ED4_species_manager *man) const { cb(man, cd); } |
---|
1448 | bool operator<(const ED4_species_manager_cb_data& other) const { |
---|
1449 | return (char*)cb < (char*)other.cb && |
---|
1450 | (char*)cd < (char*)other.cd; |
---|
1451 | } |
---|
1452 | }; |
---|
1453 | |
---|
1454 | // -------------------------------------------------------------------------------- |
---|
1455 | // class ED4_species_manager : public ED4_manager |
---|
1456 | // -------------------------------------------------------------------------------- |
---|
1457 | class ED4_species_manager : public ED4_manager |
---|
1458 | { |
---|
1459 | std::set<ED4_species_manager_cb_data> callbacks; |
---|
1460 | |
---|
1461 | ED4_species_manager(const ED4_species_manager&); // copy-constructor not allowed |
---|
1462 | public: |
---|
1463 | ED4_species_manager ( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1464 | ~ED4_species_manager (); |
---|
1465 | |
---|
1466 | #if defined(IMPLEMENT_DUMP) |
---|
1467 | virtual void dump(size_t indent) const; |
---|
1468 | #endif // IMPLEMENT_DUMP |
---|
1469 | |
---|
1470 | bool setCursorTo(ED4_cursor *cursor, int seq_pos, bool unfold_groups, ED4_CursorJumpType jump_type); |
---|
1471 | |
---|
1472 | void add_sequence_changed_cb(ED4_species_manager_cb cb, AW_CL cd); |
---|
1473 | void remove_sequence_changed_cb(ED4_species_manager_cb cb, AW_CL cd); |
---|
1474 | void remove_all_callbacks(); |
---|
1475 | |
---|
1476 | void do_callbacks(); |
---|
1477 | }; |
---|
1478 | |
---|
1479 | // -------------------------------------------------------------------------------- |
---|
1480 | // class ED4_multi_sequence_manager : public ED4_manager |
---|
1481 | // -------------------------------------------------------------------------------- |
---|
1482 | class ED4_multi_sequence_manager : public ED4_manager |
---|
1483 | { |
---|
1484 | ED4_multi_sequence_manager(const ED4_multi_sequence_manager&); // copy-constructor not allowed |
---|
1485 | public: |
---|
1486 | ED4_multi_sequence_manager( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1487 | ~ED4_multi_sequence_manager(); |
---|
1488 | |
---|
1489 | #if defined(IMPLEMENT_DUMP) |
---|
1490 | virtual void dump(size_t indent) const; |
---|
1491 | #endif // IMPLEMENT_DUMP |
---|
1492 | }; |
---|
1493 | |
---|
1494 | // -------------------------------------------------------------------------------- |
---|
1495 | // class ED4_sequence_manager : public ED4_manager |
---|
1496 | // -------------------------------------------------------------------------------- |
---|
1497 | class ED4_sequence_manager : public ED4_manager |
---|
1498 | { |
---|
1499 | ED4_sequence_manager(const ED4_sequence_manager&); // copy-constructor not allowed |
---|
1500 | public: |
---|
1501 | ED4_sequence_manager ( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1502 | ~ED4_sequence_manager (); |
---|
1503 | |
---|
1504 | #if defined(IMPLEMENT_DUMP) |
---|
1505 | virtual void dump(size_t indent) const; |
---|
1506 | #endif // IMPLEMENT_DUMP |
---|
1507 | }; |
---|
1508 | |
---|
1509 | // -------------------------------------------------------------------------------- |
---|
1510 | // class ED4_multi_name_manager : public ED4_manager // contains info concerning the species; it's linked into speciesmanager |
---|
1511 | // -------------------------------------------------------------------------------- |
---|
1512 | class ED4_multi_name_manager : public ED4_manager // contains info concerning the species; it's linked into speciesmanager |
---|
1513 | { |
---|
1514 | ED4_multi_name_manager(const ED4_multi_name_manager&); // copy-constructor not allowed |
---|
1515 | public: |
---|
1516 | ED4_multi_name_manager ( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1517 | virtual ~ED4_multi_name_manager (); |
---|
1518 | |
---|
1519 | #if defined(IMPLEMENT_DUMP) |
---|
1520 | virtual void dump(size_t indent) const; |
---|
1521 | #endif // IMPLEMENT_DUMP |
---|
1522 | }; |
---|
1523 | |
---|
1524 | |
---|
1525 | // -------------------------------------------------------------------------------- |
---|
1526 | // class ED4_name_manager : public ED4_manager // contains speciesname and other info concerning the species; it's linked into speciesmanager |
---|
1527 | // -------------------------------------------------------------------------------- |
---|
1528 | class ED4_name_manager : public ED4_manager // contains speciesname and other info concerning the species; it's linked into speciesmanager |
---|
1529 | { |
---|
1530 | ED4_name_manager(const ED4_name_manager&); // copy-constructor not allowed |
---|
1531 | public: |
---|
1532 | ED4_name_manager( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent, bool temp_is_group = 0 ); |
---|
1533 | ~ED4_name_manager(); |
---|
1534 | |
---|
1535 | #if defined(IMPLEMENT_DUMP) |
---|
1536 | virtual void dump(size_t indent) const; |
---|
1537 | #endif // IMPLEMENT_DUMP |
---|
1538 | }; |
---|
1539 | |
---|
1540 | //*************************************** |
---|
1541 | //* Manager specifications end * |
---|
1542 | //*************************************** |
---|
1543 | |
---|
1544 | |
---|
1545 | |
---|
1546 | //*************************************** |
---|
1547 | //* Terminal specifications beginning * |
---|
1548 | //*************************************** |
---|
1549 | |
---|
1550 | // -------------------------------------------------------------------------------- |
---|
1551 | // class ED4_tree_terminal : public ED4_terminal |
---|
1552 | // -------------------------------------------------------------------------------- |
---|
1553 | class ED4_tree_terminal : public ED4_terminal |
---|
1554 | { |
---|
1555 | ED4_tree_terminal(const ED4_tree_terminal&); // copy-constructor not allowed |
---|
1556 | public: |
---|
1557 | virtual ED4_returncode draw(int only_text=0); |
---|
1558 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1559 | |
---|
1560 | ED4_tree_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1561 | ~ED4_tree_terminal(); |
---|
1562 | |
---|
1563 | #if defined(IMPLEMENT_DUMP) |
---|
1564 | virtual void dump(size_t indent) const; |
---|
1565 | #endif // IMPLEMENT_DUMP |
---|
1566 | }; |
---|
1567 | |
---|
1568 | // -------------------------------------------------------------------------------- |
---|
1569 | // class ED4_bracket_terminal : public ED4_terminal |
---|
1570 | // -------------------------------------------------------------------------------- |
---|
1571 | class ED4_bracket_terminal : public ED4_terminal |
---|
1572 | { |
---|
1573 | ED4_bracket_terminal(const ED4_bracket_terminal&); // copy-constructor not allowed |
---|
1574 | public: |
---|
1575 | virtual ED4_returncode draw( int only_text = 0 ); |
---|
1576 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1577 | |
---|
1578 | ED4_bracket_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1579 | ~ED4_bracket_terminal(); |
---|
1580 | |
---|
1581 | #if defined(IMPLEMENT_DUMP) |
---|
1582 | virtual void dump(size_t indent) const; |
---|
1583 | #endif // IMPLEMENT_DUMP |
---|
1584 | }; |
---|
1585 | |
---|
1586 | // -------------------------------------------------------------------------------- |
---|
1587 | // class ED4_text_terminal : public ED4_terminal |
---|
1588 | // -------------------------------------------------------------------------------- |
---|
1589 | class ED4_text_terminal : public ED4_terminal |
---|
1590 | { |
---|
1591 | ED4_text_terminal(const ED4_text_terminal&); // copy-constructor not allowed |
---|
1592 | public: |
---|
1593 | //functions concerning graphic output |
---|
1594 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1595 | virtual ED4_returncode draw(int only_text=0); |
---|
1596 | |
---|
1597 | virtual int get_length() const = 0; |
---|
1598 | virtual void deleted_from_database(); |
---|
1599 | |
---|
1600 | ED4_text_terminal(GB_CSTR id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); |
---|
1601 | virtual ~ED4_text_terminal(); |
---|
1602 | |
---|
1603 | #if defined(IMPLEMENT_DUMP) |
---|
1604 | virtual void dump(size_t indent) const; |
---|
1605 | #endif // IMPLEMENT_DUMP |
---|
1606 | }; |
---|
1607 | |
---|
1608 | /* Beispielklasse : |
---|
1609 | |
---|
1610 | class Beispiel : public ED4_terminal |
---|
1611 | { |
---|
1612 | public: |
---|
1613 | . |
---|
1614 | . |
---|
1615 | . |
---|
1616 | |
---|
1617 | Beispiel(const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); // Construktorparameter an parents weitergeben |
---|
1618 | ~Beispiel(); |
---|
1619 | }; |
---|
1620 | |
---|
1621 | */ |
---|
1622 | |
---|
1623 | // -------------------------------------------------------------------------------- |
---|
1624 | // class ED4_sequence_terminal_basic: public ED4_text_terminal |
---|
1625 | // -------------------------------------------------------------------------------- |
---|
1626 | class ED4_sequence_terminal_basic: public ED4_text_terminal |
---|
1627 | { |
---|
1628 | public: |
---|
1629 | |
---|
1630 | char *species_name; |
---|
1631 | |
---|
1632 | ED4_sequence_terminal_basic( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1633 | virtual ~ED4_sequence_terminal_basic(); |
---|
1634 | |
---|
1635 | virtual GB_alignment_type GetAliType() = 0; |
---|
1636 | virtual int get_length() const { int len; resolve_pointer_to_char_pntr(&len); return len; } |
---|
1637 | |
---|
1638 | ED4_species_name_terminal *corresponding_species_name_terminal() const { |
---|
1639 | return get_parent(ED4_L_SPECIES)->search_spec_child_rek(ED4_L_SPECIES_NAME)->to_species_name_terminal(); |
---|
1640 | } |
---|
1641 | void calc_intervall_displayed_in_rectangle(AW_rectangle *area_rect, long *left_index, long *right_index ); |
---|
1642 | void calc_update_intervall(long *left_index, long *right_index ); |
---|
1643 | |
---|
1644 | }; |
---|
1645 | |
---|
1646 | // ----------------------------------------------------------------------------------------------------- |
---|
1647 | // class ED4_AA_sequence_terminal: public ED4_sequence_terminal_basic |
---|
1648 | // ----------------------------------------------------------------------------------------------------- |
---|
1649 | // NOTE: ED4_AA_sequence_terminal is a separte terminal class used to Open Reading Frames (ORFs) |
---|
1650 | // for the corresponding gene (DNA) sequence. It is used in ProteinViewer Module and should not be |
---|
1651 | // used for drawing aminoacid sequence alone as in protien alignment. Aminoacid sequences are |
---|
1652 | // handled by the standard "ED4_sequence_terminal" class. |
---|
1653 | // ------------------------------------------------------------------------------------------------------ |
---|
1654 | |
---|
1655 | class ED4_AA_sequence_terminal: public ED4_sequence_terminal_basic |
---|
1656 | { |
---|
1657 | virtual ED4_returncode draw( int only_text = 0 ); |
---|
1658 | ED4_AA_sequence_terminal(const ED4_AA_sequence_terminal&); |
---|
1659 | public: |
---|
1660 | ED4_AA_sequence_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1661 | virtual ~ED4_AA_sequence_terminal(); |
---|
1662 | |
---|
1663 | char *aaSequence; |
---|
1664 | int aaStartPos; |
---|
1665 | int aaStrandType; |
---|
1666 | |
---|
1667 | virtual GB_alignment_type GetAliType(); |
---|
1668 | void SET_aaSeqFlags (int startPos, int strandType) { aaStartPos = startPos; aaStrandType = strandType;} |
---|
1669 | int GET_aaStartPos (){ return aaStartPos;} |
---|
1670 | int GET_aaStrandType (){ return aaStrandType;} |
---|
1671 | void SET_aaSequence_pointer(char *aaSeq) { aaSequence = new char[strlen(aaSeq)]; aaSequence = aaSeq;} |
---|
1672 | }; |
---|
1673 | |
---|
1674 | // -------------------------------------------------------------------------------- |
---|
1675 | // class ED4_sequence_terminal : public ED4_text_terminal |
---|
1676 | // -------------------------------------------------------------------------------- |
---|
1677 | class ED4_sequence_terminal : public ED4_sequence_terminal_basic |
---|
1678 | { |
---|
1679 | mutable ED4_SearchResults searchResults; |
---|
1680 | |
---|
1681 | virtual ED4_returncode draw( int only_text = 0 ); |
---|
1682 | ED4_sequence_terminal(const ED4_sequence_terminal&); // copy-constructor not allowed |
---|
1683 | |
---|
1684 | public: |
---|
1685 | |
---|
1686 | AP_tree *st_ml_node; |
---|
1687 | |
---|
1688 | ED4_sequence_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1689 | virtual ~ED4_sequence_terminal(); |
---|
1690 | |
---|
1691 | virtual GB_alignment_type GetAliType(); |
---|
1692 | |
---|
1693 | virtual void deleted_from_database(); |
---|
1694 | virtual int get_length() const { return ED4_sequence_terminal_basic::get_length(); } |
---|
1695 | |
---|
1696 | ED4_SearchResults& results() const { return searchResults; } |
---|
1697 | |
---|
1698 | ED4_columnStat_terminal *corresponding_columnStat_terminal() const { |
---|
1699 | ED4_base *col_term = get_parent(ED4_L_MULTI_SEQUENCE)->search_spec_child_rek(ED4_L_COL_STAT); |
---|
1700 | return col_term ? col_term->to_columnStat_terminal() : 0; |
---|
1701 | } |
---|
1702 | |
---|
1703 | #if defined(IMPLEMENT_DUMP) |
---|
1704 | virtual void dump(size_t indent) const; |
---|
1705 | #endif // IMPLEMENT_DUMP |
---|
1706 | }; |
---|
1707 | |
---|
1708 | // -------------------------------------------------------------------------------- |
---|
1709 | // class ED4_columnStat_terminal : public ED4_text_terminal |
---|
1710 | // -------------------------------------------------------------------------------- |
---|
1711 | class ED4_columnStat_terminal : public ED4_text_terminal |
---|
1712 | { |
---|
1713 | char *likelihood[4]; // likelihood-array for each base (ACGU) [length of array = alignment_length] |
---|
1714 | int latest_update; |
---|
1715 | |
---|
1716 | static double threshold; |
---|
1717 | |
---|
1718 | int update_likelihood(); |
---|
1719 | |
---|
1720 | ED4_columnStat_terminal(const ED4_columnStat_terminal&); // copy-constructor not allowed |
---|
1721 | public: |
---|
1722 | //functions concerning graphic output |
---|
1723 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1724 | virtual ED4_returncode draw(int only_text=0); |
---|
1725 | virtual int get_length() const { return corresponding_sequence_terminal()->to_text_terminal()->get_length(); } |
---|
1726 | |
---|
1727 | static int threshold_is_set(); |
---|
1728 | static void set_threshold(double aThreshold); |
---|
1729 | static double get_threshold() { return threshold; } |
---|
1730 | |
---|
1731 | ED4_sequence_terminal *corresponding_sequence_terminal() const { return get_parent(ED4_L_MULTI_SEQUENCE)->search_spec_child_rek(ED4_L_SEQUENCE_STRING)->to_sequence_terminal(); } |
---|
1732 | |
---|
1733 | GB_CSTR build_probe_match_string(int start_pos, int end_pos) const; |
---|
1734 | |
---|
1735 | ED4_columnStat_terminal(GB_CSTR id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); |
---|
1736 | ~ED4_columnStat_terminal(); |
---|
1737 | |
---|
1738 | #if defined(IMPLEMENT_DUMP) |
---|
1739 | virtual void dump(size_t indent) const; |
---|
1740 | #endif // IMPLEMENT_DUMP |
---|
1741 | }; |
---|
1742 | |
---|
1743 | // -------------------------------------------------------------------------------- |
---|
1744 | // class ED4_species_name_terminal : public ED4_text_terminal |
---|
1745 | // -------------------------------------------------------------------------------- |
---|
1746 | class ED4_species_name_terminal : public ED4_text_terminal |
---|
1747 | { |
---|
1748 | ED4_species_name_terminal(const ED4_species_name_terminal&); // copy-constructor not allowed |
---|
1749 | public: |
---|
1750 | //functions concerning graphic output |
---|
1751 | |
---|
1752 | ED4_species_name_terminal( GB_CSTR id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1753 | ~ED4_species_name_terminal(); |
---|
1754 | |
---|
1755 | GB_CSTR get_displayed_text() const; |
---|
1756 | virtual int get_length() const { return strlen(get_displayed_text()); } |
---|
1757 | |
---|
1758 | ED4_sequence_terminal *corresponding_sequence_terminal() const { |
---|
1759 | ED4_base *seq_term = get_parent(ED4_L_SPECIES)->search_spec_child_rek(ED4_L_SEQUENCE_STRING); |
---|
1760 | return seq_term ? seq_term->to_sequence_terminal() : 0; |
---|
1761 | } |
---|
1762 | |
---|
1763 | #if defined(IMPLEMENT_DUMP) |
---|
1764 | virtual void dump(size_t indent) const; |
---|
1765 | #endif // IMPLEMENT_DUMP |
---|
1766 | }; |
---|
1767 | |
---|
1768 | // -------------------------------------------------------------------------------- |
---|
1769 | // class ED4_sequence_info_terminal : public ED4_text_terminal |
---|
1770 | // -------------------------------------------------------------------------------- |
---|
1771 | class ED4_sequence_info_terminal : public ED4_text_terminal |
---|
1772 | { |
---|
1773 | // now handled via ED4_species_pointer // GBDATA *gbdata; |
---|
1774 | ED4_sequence_info_terminal(const ED4_sequence_info_terminal&); // copy-constructor not allowed |
---|
1775 | public: |
---|
1776 | ED4_sequence_info_terminal( const char *id, /*GBDATA *gbd,*/ AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1777 | virtual ~ED4_sequence_info_terminal(); |
---|
1778 | |
---|
1779 | ED4_species_name_terminal *corresponding_species_name_terminal() const { |
---|
1780 | return get_parent(ED4_L_SPECIES)->search_spec_child_rek(ED4_L_SPECIES_NAME)->to_species_name_terminal(); |
---|
1781 | } |
---|
1782 | |
---|
1783 | virtual ED4_returncode draw( int only_text = 0); |
---|
1784 | |
---|
1785 | GBDATA *data() { return get_species_pointer(); } |
---|
1786 | const GBDATA *data() const { return get_species_pointer(); } |
---|
1787 | |
---|
1788 | virtual int get_length() const { return 1+strlen(id); } |
---|
1789 | |
---|
1790 | virtual bool remove_deleted_childs(); |
---|
1791 | |
---|
1792 | #if defined(IMPLEMENT_DUMP) |
---|
1793 | virtual void dump(size_t indent) const; |
---|
1794 | #endif // IMPLEMENT_DUMP |
---|
1795 | }; |
---|
1796 | |
---|
1797 | // -------------------------------------------------------------------------------- |
---|
1798 | // class ED4_pure_text_terminal : public ED4_text_terminal |
---|
1799 | // -------------------------------------------------------------------------------- |
---|
1800 | class ED4_pure_text_terminal : public ED4_text_terminal |
---|
1801 | { |
---|
1802 | ED4_pure_text_terminal(const ED4_pure_text_terminal&); // copy-constructor not allowed |
---|
1803 | public: |
---|
1804 | ED4_pure_text_terminal(const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); |
---|
1805 | ~ED4_pure_text_terminal(); |
---|
1806 | |
---|
1807 | virtual int get_length() const { int len; resolve_pointer_to_char_pntr(&len); return len; } |
---|
1808 | |
---|
1809 | #if defined(IMPLEMENT_DUMP) |
---|
1810 | virtual void dump(size_t indent) const; |
---|
1811 | #endif // IMPLEMENT_DUMP |
---|
1812 | }; |
---|
1813 | |
---|
1814 | // -------------------------------------------------------------------------------- |
---|
1815 | // class ED4_consensus_sequence_terminal : public ED4_sequence_terminal |
---|
1816 | // -------------------------------------------------------------------------------- |
---|
1817 | class ED4_consensus_sequence_terminal : public ED4_sequence_terminal |
---|
1818 | { |
---|
1819 | virtual ED4_returncode draw( int only_text = 0 ); |
---|
1820 | ED4_consensus_sequence_terminal(const ED4_consensus_sequence_terminal&); // copy-constructor not allowed |
---|
1821 | |
---|
1822 | ED4_char_table& get_char_table() const { return get_parent( ED4_L_GROUP )->to_group_manager()->table(); } |
---|
1823 | public: |
---|
1824 | ED4_consensus_sequence_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1825 | virtual ~ED4_consensus_sequence_terminal(); |
---|
1826 | |
---|
1827 | virtual int get_length() const; |
---|
1828 | |
---|
1829 | #if defined(IMPLEMENT_DUMP) |
---|
1830 | virtual void dump(size_t indent) const; |
---|
1831 | #endif // IMPLEMENT_DUMP |
---|
1832 | }; |
---|
1833 | |
---|
1834 | // -------------------------------------------------------------------------------- |
---|
1835 | // class ED4_spacer_terminal : public ED4_terminal |
---|
1836 | // -------------------------------------------------------------------------------- |
---|
1837 | class ED4_spacer_terminal : public ED4_terminal |
---|
1838 | { |
---|
1839 | ED4_spacer_terminal(const ED4_spacer_terminal&); // copy-constructor not allowed |
---|
1840 | public: |
---|
1841 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1842 | virtual ED4_returncode draw(int only_text = 0); |
---|
1843 | |
---|
1844 | ED4_spacer_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1845 | ~ED4_spacer_terminal(); |
---|
1846 | |
---|
1847 | #if defined(IMPLEMENT_DUMP) |
---|
1848 | virtual void dump(size_t indent) const; |
---|
1849 | #endif // IMPLEMENT_DUMP |
---|
1850 | }; |
---|
1851 | |
---|
1852 | // -------------------------------------------------------------------------------- |
---|
1853 | // class ED4_line_terminal : public ED4_terminal |
---|
1854 | // -------------------------------------------------------------------------------- |
---|
1855 | class ED4_line_terminal : public ED4_terminal |
---|
1856 | { |
---|
1857 | ED4_line_terminal(const ED4_line_terminal&); // copy-constructor not allowed |
---|
1858 | public: |
---|
1859 | virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); |
---|
1860 | virtual ED4_returncode draw(int only_text = 0); |
---|
1861 | |
---|
1862 | ED4_line_terminal( const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent ); |
---|
1863 | ~ED4_line_terminal(); |
---|
1864 | |
---|
1865 | #if defined(IMPLEMENT_DUMP) |
---|
1866 | virtual void dump(size_t indent) const; |
---|
1867 | #endif // IMPLEMENT_DUMP |
---|
1868 | }; |
---|
1869 | |
---|
1870 | //*************************************** |
---|
1871 | //* Terminal specifications end * |
---|
1872 | //*************************************** |
---|
1873 | |
---|
1874 | //************************************************** |
---|
1875 | //* inline expansion which need complete classdefs * |
---|
1876 | //************************************************** |
---|
1877 | |
---|
1878 | inline bool ED4_terminal::setCursorTo(ED4_cursor *cursor, int seq_pos, bool unfoldGroups, ED4_CursorJumpType jump_type) { |
---|
1879 | ED4_species_manager *sm = get_parent(ED4_L_SPECIES)->to_species_manager(); |
---|
1880 | return sm->setCursorTo(cursor, seq_pos, unfoldGroups, jump_type); |
---|
1881 | } |
---|
1882 | |
---|
1883 | //*************************************** |
---|
1884 | //* Prototype functions without a class * |
---|
1885 | //*************************************** |
---|
1886 | |
---|
1887 | extern ST_ML *st_ml; |
---|
1888 | |
---|
1889 | void ED4_expose_cb(AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1890 | void ED4_expose_all_windows(); |
---|
1891 | |
---|
1892 | void ED4_calc_terminal_extentions(); |
---|
1893 | |
---|
1894 | void ED4_input_cb (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1895 | void ED4_resize_cb (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1896 | |
---|
1897 | void ED4_gc_is_modified (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1898 | void ED4_quit (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1899 | |
---|
1900 | void ED4_motion_cb (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1901 | void ED4_vertical_change_cb (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1902 | void ED4_horizontal_change_cb (AW_window *aww,AW_CL cd1, AW_CL cd2); |
---|
1903 | void ED4_scrollbar_change_cb (AW_window *aww, AW_CL cd1, AW_CL cd2); |
---|
1904 | |
---|
1905 | void ED4_no_dangerous_modes (void); |
---|
1906 | void group_species_cb (AW_window *aww, AW_CL cd1, AW_CL cd2); |
---|
1907 | AW_window *ED4_create_group_species_by_field_window( AW_root *aw_root); |
---|
1908 | |
---|
1909 | void ED4_timer (AW_root *ar , AW_CL cd1, AW_CL cd2 ); |
---|
1910 | void ED4_timer_refresh (); |
---|
1911 | |
---|
1912 | ED4_returncode update_terminal_extension (void **arg1, void **arg2, ED4_base *this_object ); |
---|
1913 | |
---|
1914 | void ED4_load_new_config (char *string); |
---|
1915 | void ED4_start_editor_on_configuration (AW_window *aww); |
---|
1916 | AW_window *ED4_start_editor_on_old_configuration (AW_root *awr); |
---|
1917 | void ED4_restart_editor (AW_window *aww, AW_CL,AW_CL); |
---|
1918 | void ED4_save_configuration (AW_window *aww,AW_CL close_flag); |
---|
1919 | AW_window *ED4_save_configuration_as_open_window (AW_root *awr); |
---|
1920 | |
---|
1921 | void ED4_set_iupac (AW_window *aww, char *awar_name, bool callback_flag); |
---|
1922 | void ED4_set_helixnr (AW_window *aww, char *awar_name, bool callback_flag); |
---|
1923 | void ed4_changesecurity (AW_root *root, AW_CL cd1); |
---|
1924 | void ed4_change_edit_mode (AW_root *root, AW_CL cd1); |
---|
1925 | |
---|
1926 | ED4_returncode call_edit (void **error, void **work_info, ED4_base *object ); // function for editing sequences |
---|
1927 | ED4_returncode rebuild_consensus (void **arg1, void **arg2, ED4_base *object); |
---|
1928 | |
---|
1929 | void ED4_exit() __ATTR__NORETURN; |
---|
1930 | |
---|
1931 | void ED4_quit_editor (AW_window *aww, AW_CL cd1, AW_CL cd2 ); //Be Careful: Is this the last window? |
---|
1932 | void ED4_load_data (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1933 | void ED4_save_data (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1934 | void ED4_refresh_window (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1935 | |
---|
1936 | void ED4_store_curpos (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1937 | void ED4_restore_curpos (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1938 | void ED4_clear_stored_curpos (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1939 | void ED4_helix_jump_opposite (AW_window *aww, AW_CL /*cd1*/, AW_CL /*cd2*/); |
---|
1940 | void ED4_jump_to_cursor_position (AW_window *aww, char *awar_name, bool callback_flag); |
---|
1941 | void ED4_remote_set_cursor_cb (AW_root *awr, AW_CL, AW_CL); |
---|
1942 | void ED4_change_cursor (AW_window */*aww*/, AW_CL /*cd1*/, AW_CL /*cd2*/); |
---|
1943 | void ED4_set_reference_species (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1944 | |
---|
1945 | void ED4_show_detailed_column_stats (AW_window *aww, AW_CL, AW_CL); |
---|
1946 | void ED4_set_col_stat_threshold (AW_window *aww, AW_CL, AW_CL); |
---|
1947 | |
---|
1948 | void ED4_new_editor_window (AW_window *aww, AW_CL cd1, AW_CL cd2 ); |
---|
1949 | |
---|
1950 | AW_window *ED4_create_consensus_definition_window (AW_root *root); |
---|
1951 | void ED4_create_consensus_awars (AW_root *aw_root); |
---|
1952 | void ED4_consensus_definition_changed (AW_root*, AW_CL,AW_CL); |
---|
1953 | void ED4_consensus_display_changed (AW_root*, AW_CL,AW_CL); |
---|
1954 | |
---|
1955 | AW_window *ED4_create_level_1_options_window (AW_root *root); |
---|
1956 | void ED4_compression_toggle_changed_cb (AW_root *root, AW_CL cd1, AW_CL cd2); |
---|
1957 | |
---|
1958 | AW_window *ED4_create_new_seq_window (AW_root *root, AW_CL cl_creation_mode); |
---|
1959 | |
---|
1960 | void ED4_jump_to_current_species (AW_window *, AW_CL); |
---|
1961 | void ED4_get_and_jump_to_actual (AW_window *, AW_CL); |
---|
1962 | void ED4_get_and_jump_to_actual_from_menu (AW_window *aw, AW_CL cl, AW_CL); |
---|
1963 | void ED4_get_and_jump_to_species (GB_CSTR species_name); |
---|
1964 | void ED4_get_marked_from_menu (AW_window *, AW_CL, AW_CL); |
---|
1965 | void ED4_selected_species_changed_cb (AW_root *aw_root); |
---|
1966 | void ED4_selected_SAI_changed_cb (AW_root *aw_root); |
---|
1967 | |
---|
1968 | extern int ED4_elements_in_species_container; // # of elements in species container |
---|
1969 | void ED4_undo_redo (AW_window*, AW_CL undo_type); |
---|
1970 | |
---|
1971 | ED4_species_name_terminal *ED4_find_species_name_terminal(const char *species_name); |
---|
1972 | ED4_multi_species_manager *ED4_new_species_multi_species_manager(void); // returns manager into which new species should be inserted |
---|
1973 | |
---|
1974 | void ED4_activate_col_stat(AW_window *aww,AW_CL, AW_CL); |
---|
1975 | |
---|
1976 | void ED4_compression_changed_cb(AW_root *awr); |
---|
1977 | |
---|
1978 | // functions passed to external c-functions (i.e. as callbacks) have to be declared as 'extern "C"' |
---|
1979 | |
---|
1980 | extern "C" { |
---|
1981 | void ED4_species_container_changed_cb(GBDATA *gbd, int *cl, GB_CB_TYPE gbtype); |
---|
1982 | void ED4_sequence_changed_cb(GBDATA *gb_seq, int *cl, GB_CB_TYPE gbtype); |
---|
1983 | void ED4_alignment_length_changed(GBDATA *gb_alignment_len, int *dummy, GB_CB_TYPE gbtype); |
---|
1984 | } |
---|
1985 | |
---|
1986 | struct AWTC_faligner_cd; |
---|
1987 | void ED4_init_faligner_data(AWTC_faligner_cd *faligner_data); |
---|
1988 | |
---|
1989 | #else |
---|
1990 | #error ed4_class included twice |
---|
1991 | #endif |
---|