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