1 | #include <stdio.h> |
---|
2 | #include <ctype.h> |
---|
3 | #include <memory.h> |
---|
4 | #include <string.h> |
---|
5 | |
---|
6 | #include <arbdb.h> |
---|
7 | #include <arbdbt.h> |
---|
8 | |
---|
9 | #include <aw_root.hxx> |
---|
10 | #include <aw_awars.hxx> |
---|
11 | #include <aw_window.hxx> |
---|
12 | #include <aw_preset.hxx> |
---|
13 | |
---|
14 | #include <awt.hxx> |
---|
15 | #include <awt_seq_colors.hxx> |
---|
16 | #include <awt_map_key.hxx> |
---|
17 | |
---|
18 | #include <awtc_fast_aligner.hxx> |
---|
19 | #include <awtc_constructSequence.hxx> |
---|
20 | |
---|
21 | #include "../NTREE/nt_date.h" |
---|
22 | |
---|
23 | #define _USE_AW_WINDOW |
---|
24 | #include <BI_helix.hxx> |
---|
25 | #include <st_window.hxx> |
---|
26 | #include <gde.hxx> |
---|
27 | |
---|
28 | #include "ed4_class.hxx" |
---|
29 | #include "ed4_awars.hxx" |
---|
30 | #include "ed4_tools.hxx" |
---|
31 | #include "ed4_block.hxx" |
---|
32 | #include "ed4_nds.hxx" |
---|
33 | #include "ed4_secedit.hxx" |
---|
34 | |
---|
35 | #include "edit_naligner.hxx" |
---|
36 | |
---|
37 | |
---|
38 | //***************************************** |
---|
39 | //* ED4_root Methods beginning * |
---|
40 | //***************************************** |
---|
41 | |
---|
42 | // ED4_returncode ED4_root::resize_all_windows( void ) // resizes all windows for updating folding actions, new groups, movements etc. |
---|
43 | // { |
---|
44 | // ED4_window *window, *ed4w_temp; |
---|
45 | // AW_window *aw_temp; |
---|
46 | // AW_device *dev_temp; |
---|
47 | |
---|
48 | // ed4w_temp = ED4_ROOT->temp_ed4w; |
---|
49 | // aw_temp = ED4_ROOT->temp_aww; |
---|
50 | // dev_temp = ED4_ROOT->temp_device; |
---|
51 | |
---|
52 | // window = ED4_ROOT->first_window; |
---|
53 | // while (window) |
---|
54 | // { |
---|
55 | // ED4_ROOT->temp_aww = window->aww; |
---|
56 | // ED4_ROOT->temp_device = window->aww->get_device(AW_MIDDLE_AREA); |
---|
57 | // ED4_ROOT->temp_ed4w = window; |
---|
58 | |
---|
59 | // ED4_ROOT->resize_all(); |
---|
60 | // ED4_ROOT->temp_ed4w->update_scrolled_rectangle(); |
---|
61 | // // ED4_ROOT->main_manager->clear_whole_background(); |
---|
62 | // ED4_ROOT->show_all(); |
---|
63 | |
---|
64 | // window = window->next; |
---|
65 | // } |
---|
66 | |
---|
67 | // ED4_ROOT->temp_ed4w = ed4w_temp; |
---|
68 | // ED4_ROOT->temp_aww = aw_temp; |
---|
69 | // ED4_ROOT->temp_device = dev_temp; |
---|
70 | |
---|
71 | // return ( ED4_R_OK ); |
---|
72 | // } |
---|
73 | |
---|
74 | ED4_returncode ED4_root::refresh_window_simple(int redraw) |
---|
75 | { |
---|
76 | e4_assert(!main_manager->update_info.delete_requested); |
---|
77 | e4_assert(!main_manager->update_info.resize); |
---|
78 | |
---|
79 | int refresh_all = 0; |
---|
80 | if (redraw) { |
---|
81 | main_manager->update_info.set_clear_at_refresh(1); |
---|
82 | refresh_all = 1; |
---|
83 | } |
---|
84 | main_manager->Show(refresh_all, 0); |
---|
85 | return ( ED4_R_OK ); |
---|
86 | } |
---|
87 | |
---|
88 | ED4_returncode ED4_root::refresh_window(int redraw) // this function should only be used for window specific updates (i.e. cursor placement) |
---|
89 | { |
---|
90 | if (main_manager->update_info.delete_requested) { |
---|
91 | main_manager->delete_requested_childs(); |
---|
92 | redraw = 1; |
---|
93 | } |
---|
94 | |
---|
95 | while (main_manager->update_info.resize) { |
---|
96 | main_manager->resize_requested_by_parent(); |
---|
97 | redraw = 1; |
---|
98 | } |
---|
99 | |
---|
100 | return refresh_window_simple(redraw); |
---|
101 | } |
---|
102 | |
---|
103 | ED4_returncode ED4_root::refresh_all_windows(int redraw) |
---|
104 | { |
---|
105 | #ifdef DEBUG |
---|
106 | // printf("ED4_root::refresh_all_windows this=%p\n", this); |
---|
107 | #endif |
---|
108 | ED4_window *window, *ed4w_temp; |
---|
109 | AW_window *aw_temp; |
---|
110 | AW_device *dev_temp; |
---|
111 | |
---|
112 | ed4w_temp = ED4_ROOT->temp_ed4w; |
---|
113 | aw_temp = ED4_ROOT->temp_aww; |
---|
114 | dev_temp = ED4_ROOT->temp_device; |
---|
115 | |
---|
116 | last_window_reached = 0; |
---|
117 | |
---|
118 | if (main_manager->update_info.delete_requested) { |
---|
119 | main_manager->delete_requested_childs(); |
---|
120 | redraw = 1; |
---|
121 | } |
---|
122 | |
---|
123 | while (main_manager->update_info.resize) { |
---|
124 | main_manager->resize_requested_by_parent(); |
---|
125 | redraw = 1; |
---|
126 | } |
---|
127 | |
---|
128 | #ifdef DEBUG |
---|
129 | // printf("ED4_root::refresh_all_windows this=%p [mid]\n", this); |
---|
130 | #endif |
---|
131 | |
---|
132 | window = ED4_ROOT->first_window; |
---|
133 | GB_transaction dummy(gb_main); |
---|
134 | while (window) { |
---|
135 | if (window->next == NULL) { |
---|
136 | last_window_reached = 1; |
---|
137 | } |
---|
138 | |
---|
139 | ED4_ROOT->temp_aww = window->aww; |
---|
140 | ED4_ROOT->temp_device = window->aww->get_device(AW_MIDDLE_AREA); |
---|
141 | ED4_ROOT->temp_ed4w = window; |
---|
142 | |
---|
143 | refresh_window_simple(redraw); |
---|
144 | |
---|
145 | window = window->next; |
---|
146 | } |
---|
147 | |
---|
148 | ED4_ROOT->temp_ed4w = ed4w_temp; |
---|
149 | ED4_ROOT->temp_aww = aw_temp; |
---|
150 | ED4_ROOT->temp_device = dev_temp; |
---|
151 | |
---|
152 | #ifdef DEBUG |
---|
153 | // printf("ED4_root::refresh_all_windows this=%p [done]\n", this); |
---|
154 | #endif |
---|
155 | return ( ED4_R_OK ); |
---|
156 | } |
---|
157 | |
---|
158 | |
---|
159 | ED4_returncode ED4_root::win_to_world_coords( AW_window *aww, AW_pos *x, AW_pos *y ) // calculates transformation from window to |
---|
160 | { // world coordinates in a given window |
---|
161 | ED4_window *current_window; |
---|
162 | ED4_folding_line *current_fl; |
---|
163 | AW_pos temp_x, temp_y; |
---|
164 | |
---|
165 | current_window = ED4_ROOT->first_window->get_matching_ed4w( aww ); |
---|
166 | |
---|
167 | if ( current_window == NULL ) |
---|
168 | return ( ED4_R_WARNING ); |
---|
169 | |
---|
170 | temp_x = *x; |
---|
171 | temp_y = *y; |
---|
172 | |
---|
173 | current_fl = current_window->vertical_fl; // calculate x-offset due to vertical folding lines |
---|
174 | while ( (current_fl != NULL) && (*x >= current_fl->world_pos[X_POS]) ) |
---|
175 | { |
---|
176 | if ( (current_fl->length == INFINITE) || |
---|
177 | ((*y >= current_fl->window_pos[Y_POS]) && (*y <= (current_fl->window_pos[Y_POS] + current_fl->length))) ) |
---|
178 | temp_x += current_fl->dimension; |
---|
179 | |
---|
180 | current_fl = current_fl->next; |
---|
181 | } |
---|
182 | |
---|
183 | current_fl = current_window->horizontal_fl; // calculate y-offset due to horizontal folding lines |
---|
184 | while ( (current_fl != NULL) && (*y >= current_fl->world_pos[Y_POS]) ) |
---|
185 | { |
---|
186 | if ( (current_fl->length == INFINITE) || |
---|
187 | ((*x >= current_fl->window_pos[X_POS]) && (*x <= (current_fl->window_pos[X_POS] + current_fl->length))) ) |
---|
188 | temp_y += current_fl->dimension; |
---|
189 | |
---|
190 | current_fl = current_fl->next; |
---|
191 | } |
---|
192 | |
---|
193 | *x = temp_x; |
---|
194 | *y = temp_y; |
---|
195 | |
---|
196 | return ( ED4_R_OK ); |
---|
197 | } |
---|
198 | |
---|
199 | |
---|
200 | short ED4_root::is_primary_selection(ED4_terminal *object ) |
---|
201 | { |
---|
202 | ED4_list_elem *tmp_elem; |
---|
203 | ED4_selection_entry *tmp_entry; |
---|
204 | |
---|
205 | tmp_elem = ( ED4_list_elem *) selected_objects.last(); |
---|
206 | if (!tmp_elem) return 0; |
---|
207 | |
---|
208 | tmp_entry = ( ED4_selection_entry *) tmp_elem->elem(); |
---|
209 | return (tmp_entry != NULL) && (tmp_entry->object == object); |
---|
210 | } |
---|
211 | |
---|
212 | ED4_returncode ED4_root::deselect_all( void ) |
---|
213 | { |
---|
214 | ED4_multi_species_manager *main_multi_man = ED4_ROOT->middle_area_man->get_defined_level(ED4_L_MULTI_SPECIES)->to_multi_species_manager(); |
---|
215 | |
---|
216 | main_multi_man->deselect_all_species(); |
---|
217 | main_multi_man = ED4_ROOT->top_area_man->get_defined_level(ED4_L_MULTI_SPECIES)->to_multi_species_manager(); |
---|
218 | main_multi_man->deselect_all_species(); |
---|
219 | |
---|
220 | return ED4_R_OK; |
---|
221 | |
---|
222 | // ED4_list_elem *current_list_elem; |
---|
223 | // ED4_selection_entry *tmp_entry; |
---|
224 | |
---|
225 | // current_list_elem = selected_objects.last(); |
---|
226 | |
---|
227 | // while ( current_list_elem ) { |
---|
228 | // tmp_entry = ( ED4_selection_entry *) current_list_elem->elem(); |
---|
229 | // ED4_terminal *term = tmp_entry->object; |
---|
230 | // remove_from_selected(term); |
---|
231 | // current_list_elem = selected_objects.first(); |
---|
232 | // } |
---|
233 | |
---|
234 | // return ( ED4_R_OK ); |
---|
235 | } |
---|
236 | |
---|
237 | ED4_returncode ED4_root::remove_from_selected( ED4_terminal *object ) |
---|
238 | { |
---|
239 | if ( object == NULL ) |
---|
240 | return ( ED4_R_IMPOSSIBLE ); |
---|
241 | |
---|
242 | if ( (selected_objects.is_elem( (void *) object->selection_info )) ) { |
---|
243 | selected_objects.delete_elem( (void *) object->selection_info ); |
---|
244 | |
---|
245 | delete object->selection_info; |
---|
246 | object->selection_info = NULL; |
---|
247 | object->flag.selected = 0; |
---|
248 | object->flag.dragged = 0; |
---|
249 | |
---|
250 | if (object->is_species_name_terminal()) { |
---|
251 | ED4_species_name_terminal *name_term = object->to_species_name_terminal(); |
---|
252 | |
---|
253 | #ifdef DEBUG |
---|
254 | GBDATA *gbd = name_term->get_species_pointer(); |
---|
255 | |
---|
256 | if (gbd) { |
---|
257 | printf("removed term '%s'\n", GB_read_char_pntr(gbd)); |
---|
258 | } |
---|
259 | else { |
---|
260 | ED4_species_manager *spec_man = name_term->get_parent(ED4_L_SPECIES)->to_species_manager(); |
---|
261 | |
---|
262 | if (spec_man->flag.is_consensus) { |
---|
263 | printf("removed consensus '%s'\n", name_term->id); |
---|
264 | } |
---|
265 | else { |
---|
266 | printf("removed unknown term '%s'\n", name_term->id ? name_term->id : "NULL"); |
---|
267 | } |
---|
268 | } |
---|
269 | #endif |
---|
270 | |
---|
271 | name_term->set_refresh(1); |
---|
272 | name_term->parent->refresh_requested_by_child(); |
---|
273 | |
---|
274 | ED4_sequence_terminal *seq_term = object->to_species_name_terminal()->corresponding_sequence_terminal(); |
---|
275 | if (seq_term) { |
---|
276 | seq_term->set_refresh(1); |
---|
277 | seq_term->parent->refresh_requested_by_child(); |
---|
278 | } |
---|
279 | |
---|
280 | ED4_multi_species_manager *multi_man = object->get_parent(ED4_L_MULTI_SPECIES)->to_multi_species_manager(); |
---|
281 | multi_man->invalidate_species_counters(); |
---|
282 | } |
---|
283 | else { |
---|
284 | object->set_refresh(); |
---|
285 | object->parent->refresh_requested_by_child(); |
---|
286 | } |
---|
287 | } |
---|
288 | |
---|
289 | return ( ED4_R_OK ); |
---|
290 | } |
---|
291 | |
---|
292 | ED4_returncode ED4_root::add_to_selected( ED4_terminal *object ) |
---|
293 | { |
---|
294 | ED4_base *tmp_object; |
---|
295 | ED4_level mlevel; |
---|
296 | ED4_terminal *sel_object; |
---|
297 | ED4_selection_entry *sel_info; |
---|
298 | |
---|
299 | |
---|
300 | if ( (object == NULL) || !(object->dynamic_prop & ED4_P_SELECTABLE) ) { // check if object exists and may be selected |
---|
301 | return ( ED4_R_IMPOSSIBLE ); |
---|
302 | } |
---|
303 | |
---|
304 | if ( selected_objects.no_of_entries() > 0 ) { // check if object is of the same type as previously selected objects |
---|
305 | sel_info = (ED4_selection_entry *) selected_objects.first()->elem(); |
---|
306 | sel_object = sel_info->object; |
---|
307 | if ( object->spec->level != sel_object->spec->level ) { // object levels are different |
---|
308 | return ( ED4_R_IMPOSSIBLE ); |
---|
309 | } |
---|
310 | } |
---|
311 | |
---|
312 | |
---|
313 | if ( !(selected_objects.is_elem( (void *) object->selection_info )) ) { // object is really new to our list => calculate current extension and append it |
---|
314 | object->selection_info = new ED4_selection_entry; |
---|
315 | |
---|
316 | if ( object->dynamic_prop & ED4_P_IS_HANDLE ) // object is a handle for an object up in the hierarchy => search it |
---|
317 | { |
---|
318 | mlevel = object->spec->handled_level; |
---|
319 | tmp_object = object; |
---|
320 | |
---|
321 | while ( (tmp_object != NULL) && !(tmp_object->spec->level & mlevel) ) { |
---|
322 | tmp_object = tmp_object->parent; |
---|
323 | } |
---|
324 | |
---|
325 | if ( tmp_object == NULL ) { |
---|
326 | return ( ED4_R_WARNING ); // no target level found |
---|
327 | } |
---|
328 | |
---|
329 | object->selection_info->actual_width = tmp_object->extension.size[WIDTH]; |
---|
330 | object->selection_info->actual_height = tmp_object->extension.size[HEIGHT]; |
---|
331 | } |
---|
332 | else // selected object is no handle => take it directly |
---|
333 | { |
---|
334 | object->selection_info->actual_width = object->extension.size[WIDTH]; |
---|
335 | object->selection_info->actual_height = object->extension.size[HEIGHT]; |
---|
336 | } |
---|
337 | |
---|
338 | object->selection_info->drag_old_x = 0; |
---|
339 | object->selection_info->drag_old_y = 0; |
---|
340 | object->selection_info->drag_off_x = 0; |
---|
341 | object->selection_info->drag_off_y = 0; |
---|
342 | object->selection_info->old_event_y = 0; |
---|
343 | object->selection_info->object = object; |
---|
344 | selected_objects.append_elem_backwards( (void *) object->selection_info ); |
---|
345 | object->flag.selected = 1; |
---|
346 | |
---|
347 | if (object->is_species_name_terminal()) { |
---|
348 | ED4_species_name_terminal *name_term = object->to_species_name_terminal(); |
---|
349 | |
---|
350 | #ifdef DEBUG |
---|
351 | GBDATA *gbd = name_term->get_species_pointer(); |
---|
352 | |
---|
353 | if (gbd) { |
---|
354 | printf("added term '%s'\n", GB_read_char_pntr(gbd)); |
---|
355 | } |
---|
356 | else { |
---|
357 | ED4_species_manager *spec_man = name_term->get_parent(ED4_L_SPECIES)->to_species_manager(); |
---|
358 | if (spec_man->flag.is_consensus) { |
---|
359 | printf("added consensus '%s'\n", name_term->id); |
---|
360 | } |
---|
361 | else { |
---|
362 | printf("added unknown term '%s'\n", name_term->id ? name_term->id : "NULL"); |
---|
363 | } |
---|
364 | } |
---|
365 | #endif |
---|
366 | |
---|
367 | name_term->set_refresh(); |
---|
368 | name_term->parent->refresh_requested_by_child(); |
---|
369 | |
---|
370 | ED4_sequence_terminal *seq_term = object->to_species_name_terminal()->corresponding_sequence_terminal(); |
---|
371 | if (seq_term) { |
---|
372 | seq_term->set_refresh(); |
---|
373 | seq_term->parent->refresh_requested_by_child(); |
---|
374 | } |
---|
375 | |
---|
376 | ED4_multi_species_manager *multi_man = object->get_parent(ED4_L_MULTI_SPECIES)->to_multi_species_manager(); |
---|
377 | multi_man->invalidate_species_counters(); |
---|
378 | } |
---|
379 | else { |
---|
380 | e4_assert(0); // test ob ueberhaupt was anderes als species_name_terminals verwendet wird |
---|
381 | object->set_refresh(); |
---|
382 | object->parent->refresh_requested_by_child(); |
---|
383 | } |
---|
384 | |
---|
385 | return ( ED4_R_OK ); |
---|
386 | } |
---|
387 | |
---|
388 | return ( ED4_R_IMPOSSIBLE ); |
---|
389 | } |
---|
390 | |
---|
391 | |
---|
392 | // ED4_returncode ED4_root::show_all( void ) |
---|
393 | // { |
---|
394 | // if (main_manager->update_info.delete_requested) { |
---|
395 | // main_manager->delete_requested_childs(); |
---|
396 | // } |
---|
397 | |
---|
398 | // // ED4_ROOT->temp_ed4w->redraw(); |
---|
399 | // ED4_ROOT->refresh_all_windows(); |
---|
400 | |
---|
401 | // return ( ED4_R_OK ); |
---|
402 | // } |
---|
403 | |
---|
404 | |
---|
405 | ED4_returncode ED4_root::resize_all( void ) |
---|
406 | { |
---|
407 | while ( main_manager->update_info.resize ) { |
---|
408 | main_manager->resize_requested_by_parent(); |
---|
409 | } |
---|
410 | |
---|
411 | return ( ED4_R_OK ); |
---|
412 | } |
---|
413 | |
---|
414 | static ED4_returncode change_char_table_length(void **new_length_intPtr, void **/*not_used*/, ED4_base *base) |
---|
415 | { |
---|
416 | if (base->is_group_manager()) { |
---|
417 | int new_length = *(int*)new_length_intPtr; |
---|
418 | ED4_group_manager *group_man = base->to_group_manager(); |
---|
419 | group_man->table().change_table_length(new_length); |
---|
420 | } |
---|
421 | |
---|
422 | return ED4_R_OK; |
---|
423 | } |
---|
424 | |
---|
425 | void ED4_alignment_length_changed(GBDATA *gb_alignment_len, int */*cl*/, GB_CB_TYPE gbtype) // callback from database |
---|
426 | { |
---|
427 | e4_assert(gbtype==GB_CB_CHANGED); |
---|
428 | int new_length = GB_read_int(gb_alignment_len); |
---|
429 | |
---|
430 | #if defined(DEBUG) && 1 |
---|
431 | printf("alignment_length_changed from %i to %i\n", MAXSEQUENCECHARACTERLENGTH, new_length); |
---|
432 | #endif |
---|
433 | |
---|
434 | MAXSEQUENCECHARACTERLENGTH = new_length; |
---|
435 | ED4_ROOT->main_manager->route_down_hierarchy((void**)&new_length, 0, change_char_table_length); |
---|
436 | ED4_ROOT->root_group_man->remap()->mark_compile_needed_force(); |
---|
437 | } |
---|
438 | |
---|
439 | ED4_returncode ED4_root::init_alignment() { |
---|
440 | GB_transaction dummy(gb_main); |
---|
441 | |
---|
442 | alignment_name = GBT_get_default_alignment(gb_main); |
---|
443 | alignment_type = GBT_get_alignment_type(gb_main,alignment_name); |
---|
444 | if (alignment_type==GB_AT_UNKNOWN) aw_message("You have to select a valid alignment before you can start ARB_EDIT4", "EXIT"); |
---|
445 | |
---|
446 | GBDATA *gb_alignment = GBT_get_alignment(gb_main,ED4_ROOT->alignment_name); |
---|
447 | if (!gb_alignment) aw_message("You can't edit without an existing alignment", "EXIT"); |
---|
448 | |
---|
449 | GBDATA *gb_alignment_len = GB_search(gb_alignment,"alignment_len",GB_FIND); |
---|
450 | int alignment_length = GB_read_int(gb_alignment_len); |
---|
451 | MAXSEQUENCECHARACTERLENGTH = alignment_length; // GBT_get_alignment_len(gb_main, ED4_ROOT->alignment_name); |
---|
452 | |
---|
453 | GB_add_callback(gb_alignment_len, (GB_CB_TYPE)GB_CB_CHANGED, (GB_CB)ED4_alignment_length_changed, 0); |
---|
454 | |
---|
455 | ED4_ROOT->aw_root->awar_string(AWAR_EDITOR_ALIGNMENT, ED4_ROOT->alignment_name); |
---|
456 | |
---|
457 | return ED4_R_OK; |
---|
458 | } |
---|
459 | |
---|
460 | ED4_returncode ED4_root::create_hierarchy(char *area_string_middle, char *area_string_top) // creates internal hierarchy of editor |
---|
461 | { |
---|
462 | int index = 0, x = 0, change = 0; |
---|
463 | ED4_index y = 0, help = 0; |
---|
464 | ED4_base *x_link, *y_link, *width_link, *height_link; |
---|
465 | ED4_window *new_window; |
---|
466 | long total_no_of_species, total_no_of_groups, group_count, species_count; |
---|
467 | |
---|
468 | database->calc_no_of_all(area_string_top, &group_count, &species_count); |
---|
469 | total_no_of_groups = group_count; |
---|
470 | total_no_of_species = species_count; |
---|
471 | loading = 1; |
---|
472 | |
---|
473 | database->calc_no_of_all(area_string_middle, &group_count, &species_count); |
---|
474 | total_no_of_groups += group_count; |
---|
475 | total_no_of_species += species_count; |
---|
476 | |
---|
477 | status_add_count = (double) (1.0 / (double) total_no_of_species); |
---|
478 | status_total_count = 0; |
---|
479 | |
---|
480 | GB_push_transaction( gb_main ); |
---|
481 | |
---|
482 | ecoli_ref = new BI_ecoli_ref(); |
---|
483 | ecoli_ref->init(gb_main); |
---|
484 | |
---|
485 | // [former position of ali-init-code] |
---|
486 | |
---|
487 | main_manager = new ED4_main_manager ( "Main_Manager" , 0, 0, 0, 0, NULL ); // build a test hierarchy |
---|
488 | root_group_man = new ED4_root_group_manager ( "Root_Group_Manager" ,0 ,0 ,0 ,0 , main_manager); |
---|
489 | main_manager->children->append_member ( root_group_man ); |
---|
490 | |
---|
491 | ED4_device_manager *device_manager = new ED4_device_manager( "Device_Manager", 0, 0, 0, 0, root_group_man ); |
---|
492 | root_group_man->children->append_member( device_manager ); |
---|
493 | |
---|
494 | ED4_calc_terminal_extenstions(); |
---|
495 | |
---|
496 | { |
---|
497 | int col_stat_term_height = 50; // @@@ Hoehe des ColumnStatistics Terminals ausrechnen |
---|
498 | |
---|
499 | ref_terminals.init(new ED4_sequence_info_terminal("Reference_Sequence_Info_Terminal",NULL, 250, 0, MAXCHARWIDTH*5, TERMINALHEIGHT, NULL), |
---|
500 | new ED4_sequence_terminal("Reference_Sequence_Terminal", 300, 0, 300, TERMINALHEIGHT, NULL), |
---|
501 | new ED4_sequence_info_terminal("Reference_ColumnStatistics_Info_Terminal",NULL, 250, 0, MAXCHARWIDTH*5, col_stat_term_height, NULL), |
---|
502 | new ED4_columnStat_terminal("Reference_ColumnStatistics_Terminal", 300, 0, 300, col_stat_term_height, NULL)); |
---|
503 | } |
---|
504 | x = 100; |
---|
505 | |
---|
506 | { |
---|
507 | ED4_area_manager *middle_area_manager; |
---|
508 | ED4_tree_terminal *tree_terminal; |
---|
509 | ED4_multi_species_manager *top_multi_species_manager; |
---|
510 | ED4_multi_species_manager *mid_multi_species_manager; |
---|
511 | ED4_spacer_terminal *top_spacer_terminal; |
---|
512 | ED4_spacer_terminal *top_mid_spacer_terminal; |
---|
513 | ED4_spacer_terminal *top_multi_spacer_terminal_beg; |
---|
514 | ED4_spacer_terminal *mid_multi_spacer_terminal_beg; |
---|
515 | ED4_line_terminal *top_mid_line_terminal; |
---|
516 | ED4_line_terminal *mid_bot_line_terminal; |
---|
517 | ED4_spacer_terminal *total_bottom_spacer; |
---|
518 | |
---|
519 | // ********** Top Area beginning ********** |
---|
520 | |
---|
521 | { |
---|
522 | ED4_area_manager *top_area_manager = new ED4_area_manager("Top_Area_Manager", 0, y, 0, 0, device_manager); |
---|
523 | device_manager->children->append_member(top_area_manager); |
---|
524 | ED4_ROOT->top_area_man = top_area_manager; |
---|
525 | |
---|
526 | top_spacer_terminal = new ED4_spacer_terminal( "Top_Spacer" , 0, 0, 100, 10, top_area_manager); |
---|
527 | top_area_manager->children->append_member( top_spacer_terminal ); |
---|
528 | |
---|
529 | top_multi_species_manager = new ED4_multi_species_manager("Top_MultiSpecies_Manager", x, 0, 0, 0, top_area_manager); |
---|
530 | top_area_manager->children->append_member( top_multi_species_manager ); |
---|
531 | |
---|
532 | top_multi_spacer_terminal_beg = new ED4_spacer_terminal("Top_Multi_Spacer_Terminal_Beg",0,0,0,3, top_multi_species_manager); |
---|
533 | top_multi_species_manager->children->append_member( top_multi_spacer_terminal_beg ); |
---|
534 | |
---|
535 | y+=3; |
---|
536 | |
---|
537 | |
---|
538 | if (total_no_of_species > MINSPECFORSTATWIN) { |
---|
539 | aw_openstatus("Reading species from database"); |
---|
540 | aw_status((double)0); |
---|
541 | } |
---|
542 | |
---|
543 | |
---|
544 | ED4_ROOT->reference = new AWT_reference(gb_main); |
---|
545 | |
---|
546 | ED4_ROOT->database->scan_string(top_multi_species_manager, ref_terminals.get_ref_sequence_info(), ref_terminals.get_ref_sequence(), area_string_top, &index, &y); |
---|
547 | GB_pop_transaction( gb_main ); |
---|
548 | |
---|
549 | top_mid_line_terminal = new ED4_line_terminal( "Top_Mid_Line_Terminal" ,0, y, 0, 3, device_manager ); // width will be set below |
---|
550 | device_manager->children->append_member( top_mid_line_terminal ); |
---|
551 | |
---|
552 | y+=3; |
---|
553 | |
---|
554 | |
---|
555 | top_mid_spacer_terminal = new ED4_spacer_terminal( "Top_Middle_Spacer", 0, y, 880, 10 , device_manager); |
---|
556 | device_manager->children->append_member( top_mid_spacer_terminal ); |
---|
557 | y += 10; // add top-mid_spacer_terminal height |
---|
558 | |
---|
559 | top_multi_species_manager->generate_id_for_groups(); |
---|
560 | |
---|
561 | // top_area_manager->check_all(); |
---|
562 | } |
---|
563 | |
---|
564 | // ********** Top Area end ********** |
---|
565 | |
---|
566 | |
---|
567 | // ********** Middle Area beginning ********** |
---|
568 | |
---|
569 | { |
---|
570 | // printf("Middle Area y : %d\n",y); |
---|
571 | middle_area_manager = new ED4_area_manager("Middle_Area_Manager", 0, y, 0, 0, device_manager); |
---|
572 | device_manager->children->append_member(middle_area_manager); |
---|
573 | ED4_ROOT->middle_area_man = middle_area_manager; |
---|
574 | |
---|
575 | tree_terminal = new ED4_tree_terminal( "Tree", 0, 0, 2, change, middle_area_manager); |
---|
576 | middle_area_manager->children->append_member( tree_terminal ); |
---|
577 | |
---|
578 | mid_multi_species_manager = new ED4_multi_species_manager("Middle_MultiSpecies_Manager", x, 0, 0, 0, middle_area_manager); |
---|
579 | middle_area_manager->children->append_member( mid_multi_species_manager ); |
---|
580 | |
---|
581 | mid_multi_spacer_terminal_beg = new ED4_spacer_terminal("Mid_Multi_Spacer_Terminal_Beg",0,0,0,3, mid_multi_species_manager); |
---|
582 | mid_multi_species_manager->children->append_member( mid_multi_spacer_terminal_beg ); |
---|
583 | |
---|
584 | y+=3; // dummy height, to create a dummy layout ( to preserve order of objects ) |
---|
585 | |
---|
586 | scroll_links.link_for_ver_slider = middle_area_manager; |
---|
587 | |
---|
588 | help = y; |
---|
589 | index = 0; |
---|
590 | { |
---|
591 | GB_transaction dummy(gb_main); |
---|
592 | ED4_ROOT->database->scan_string(mid_multi_species_manager, ref_terminals.get_ref_sequence_info(), ref_terminals.get_ref_sequence(), area_string_middle, &index, &y); |
---|
593 | } |
---|
594 | |
---|
595 | if (total_no_of_species > MINSPECFORSTATWIN) { |
---|
596 | aw_closestatus(); |
---|
597 | } |
---|
598 | |
---|
599 | { |
---|
600 | ED4_spacer_terminal *mid_bot_spacer_terminal = new ED4_spacer_terminal( "Middle_Bot_Spacer_Terminal", 0, y, 880, 10, device_manager); |
---|
601 | device_manager->children->append_member( mid_bot_spacer_terminal ); |
---|
602 | } |
---|
603 | |
---|
604 | tree_terminal->extension.size[HEIGHT] = y - help; |
---|
605 | |
---|
606 | mid_multi_species_manager->generate_id_for_groups(); |
---|
607 | y += 10; // add top-mid_spacer_terminal height |
---|
608 | |
---|
609 | mid_bot_line_terminal = new ED4_line_terminal( "Mid_Bot_Line_Terminal" ,0, y, 0, 3, device_manager ); // width will be set below |
---|
610 | device_manager->children->append_member( mid_bot_line_terminal ); |
---|
611 | y += 3; |
---|
612 | |
---|
613 | total_bottom_spacer = new ED4_spacer_terminal("Total_Bottom_Spacer_terminal", 0, y, 0, 10000, device_manager); |
---|
614 | device_manager->children->append_member(total_bottom_spacer); |
---|
615 | y += 10000; |
---|
616 | } |
---|
617 | |
---|
618 | // ********** Middle Area end ********** |
---|
619 | |
---|
620 | if (ED4_ROOT->scroll_links.link_for_hor_slider) { |
---|
621 | long ext_width = long(ED4_ROOT->scroll_links.link_for_hor_slider->extension.size[WIDTH]); |
---|
622 | |
---|
623 | top_multi_spacer_terminal_beg->extension.size[WIDTH] = ext_width + MAXSPECIESWIDTH + SEQUENCEINFOSIZE; |
---|
624 | mid_multi_spacer_terminal_beg->extension.size[WIDTH] = ext_width + MAXSPECIESWIDTH + SEQUENCEINFOSIZE; |
---|
625 | total_bottom_spacer->extension.size[WIDTH] = ext_width + MAXSPECIESWIDTH + SEQUENCEINFOSIZE; |
---|
626 | |
---|
627 | top_mid_line_terminal->extension.size[WIDTH] = ext_width + TREETERMINALSIZE + MAXSPECIESWIDTH + SEQUENCEINFOSIZE; |
---|
628 | mid_bot_line_terminal->extension.size[WIDTH] = ext_width + TREETERMINALSIZE + MAXSPECIESWIDTH + SEQUENCEINFOSIZE; |
---|
629 | |
---|
630 | } |
---|
631 | |
---|
632 | tree_terminal->set_links( NULL, mid_multi_species_manager ); // set links |
---|
633 | top_spacer_terminal->set_links( tree_terminal, top_multi_species_manager ); |
---|
634 | top_mid_spacer_terminal->set_links( middle_area_manager, NULL ); |
---|
635 | total_bottom_spacer->set_links(mid_bot_line_terminal, 0); |
---|
636 | } |
---|
637 | |
---|
638 | first_window->update_window_coords(); |
---|
639 | resize_all(); |
---|
640 | |
---|
641 | |
---|
642 | if (total_no_of_species > MINSPECFORSTATWIN) |
---|
643 | { |
---|
644 | aw_openstatus("Initializing consensi"); |
---|
645 | aw_status((double)0); |
---|
646 | } |
---|
647 | |
---|
648 | status_add_count = (double) (1.0 / (double) total_no_of_groups); |
---|
649 | status_total_count = 0; |
---|
650 | |
---|
651 | root_group_man->create_consensus(root_group_man); |
---|
652 | e4_assert(root_group_man->table().ok()); |
---|
653 | |
---|
654 | if (total_no_of_species > MINSPECFORSTATWIN) |
---|
655 | aw_closestatus(); |
---|
656 | |
---|
657 | // main_manager->check_all(); |
---|
658 | |
---|
659 | root_group_man->remap()->mark_compile_needed_force(); |
---|
660 | root_group_man->update_remap(); |
---|
661 | |
---|
662 | // calc size and display: |
---|
663 | |
---|
664 | resize_all(); |
---|
665 | loading = 0; |
---|
666 | |
---|
667 | x_link = y_link = NULL; |
---|
668 | if (main_manager) |
---|
669 | { |
---|
670 | x_link = scroll_links.link_for_hor_slider; |
---|
671 | y_link = scroll_links.link_for_ver_slider; |
---|
672 | } |
---|
673 | |
---|
674 | width_link = x_link; |
---|
675 | height_link = y_link; |
---|
676 | |
---|
677 | new_window = first_window; |
---|
678 | |
---|
679 | while (new_window) |
---|
680 | { |
---|
681 | new_window->set_scrolled_rectangle( 0, 0, 0, 0, x_link, y_link, width_link, height_link ); |
---|
682 | new_window->aww->show(); |
---|
683 | new_window->update_scrolled_rectangle(); |
---|
684 | ED4_refresh_window(new_window->aww, 0, 0); |
---|
685 | new_window = new_window->next; |
---|
686 | } |
---|
687 | |
---|
688 | ED4_ROOT->aw_root->add_timed_callback(2000,ED4_timer,(AW_CL)0,(AW_CL)0); |
---|
689 | |
---|
690 | char *out_message = GBS_strclose(not_found_message,0); |
---|
691 | if (all_found != 0) { |
---|
692 | aw_message(out_message); |
---|
693 | } |
---|
694 | delete out_message; |
---|
695 | |
---|
696 | return ( ED4_R_OK ); |
---|
697 | } |
---|
698 | |
---|
699 | ED4_returncode ED4_root::get_area_rectangle(AW_rectangle *rect, AW_pos x, AW_pos y) { // returns win-coordinates of area (defined by folding lines) which contains position x/y |
---|
700 | ED4_folding_line *flv, *flh; |
---|
701 | int x1, x2, y1, y2; |
---|
702 | AW_rectangle area_rect; |
---|
703 | temp_device->get_area_size(&area_rect); |
---|
704 | |
---|
705 | x1 = area_rect.l; |
---|
706 | for (flv=temp_ed4w->vertical_fl; ; flv = flv->next) { |
---|
707 | if (flv) { |
---|
708 | e4_assert(flv->length==INFINITE); |
---|
709 | x2 = int(flv->window_pos[X_POS]); |
---|
710 | } |
---|
711 | else { |
---|
712 | x2 = area_rect.r; |
---|
713 | if (x1==x2) { |
---|
714 | break; |
---|
715 | } |
---|
716 | } |
---|
717 | |
---|
718 | y1 = area_rect.t; |
---|
719 | for (flh=temp_ed4w->horizontal_fl; ; flh = flh->next) { |
---|
720 | if (flh) { |
---|
721 | e4_assert(flh->length==INFINITE); |
---|
722 | y2 = int(flh->window_pos[Y_POS]); |
---|
723 | } |
---|
724 | else { |
---|
725 | y2 = area_rect.b; |
---|
726 | if (y1==y2) { |
---|
727 | break; |
---|
728 | } |
---|
729 | } |
---|
730 | |
---|
731 | if (x1<=x && x<=x2 && y1<=y && y<=y2) { |
---|
732 | rect->t = y1; |
---|
733 | rect->b = y2; |
---|
734 | rect->l = x1; |
---|
735 | rect->r = x2; |
---|
736 | return ED4_R_OK; |
---|
737 | } |
---|
738 | y1 = y2; |
---|
739 | if (!flh) break; |
---|
740 | } |
---|
741 | x1 = x2; |
---|
742 | if (!flv) break; |
---|
743 | } |
---|
744 | return ED4_R_IMPOSSIBLE; // no area contains x/y :-( |
---|
745 | } |
---|
746 | |
---|
747 | ED4_returncode ED4_root::world_to_win_coords(AW_window *aww, AW_pos *xPtr, AW_pos *yPtr) // calculates transformation from world to window |
---|
748 | { // coordinates in a given window |
---|
749 | ED4_window *current_window; |
---|
750 | ED4_folding_line *current_fl; |
---|
751 | AW_pos temp_x, temp_y, x, y; |
---|
752 | |
---|
753 | current_window = ED4_ROOT->temp_ed4w; |
---|
754 | e4_assert(current_window==ED4_ROOT->first_window->get_matching_ed4w(aww)); |
---|
755 | |
---|
756 | if (! current_window) { |
---|
757 | e4_assert(0); |
---|
758 | return ( ED4_R_WARNING ); // should never occur |
---|
759 | } |
---|
760 | |
---|
761 | temp_x = x = *xPtr; |
---|
762 | temp_y = y = *yPtr; |
---|
763 | |
---|
764 | current_fl = current_window->vertical_fl; // calculate x-offset due to vertical folding lines |
---|
765 | while (current_fl && (x>=current_fl->world_pos[X_POS])) { |
---|
766 | if ((current_fl->length == INFINITE) || |
---|
767 | ((y >= current_fl->world_pos[Y_POS]) && |
---|
768 | (y <= current_fl->world_pos[Y_POS] + current_fl->length))) |
---|
769 | { |
---|
770 | temp_x -= current_fl->dimension; |
---|
771 | |
---|
772 | } |
---|
773 | current_fl = current_fl->next; |
---|
774 | } |
---|
775 | |
---|
776 | current_fl = current_window->horizontal_fl; // calculate y-offset due to horizontal folding lines |
---|
777 | while (current_fl && (y >= current_fl->world_pos[Y_POS])) { |
---|
778 | if ((current_fl->length == INFINITE) || |
---|
779 | ((x >= current_fl->world_pos[X_POS]) && |
---|
780 | (x <= (current_fl->world_pos[X_POS] + current_fl->length)))) |
---|
781 | { |
---|
782 | temp_y -= current_fl->dimension; |
---|
783 | } |
---|
784 | current_fl = current_fl->next; |
---|
785 | } |
---|
786 | |
---|
787 | *xPtr = temp_x; |
---|
788 | *yPtr = temp_y; |
---|
789 | |
---|
790 | return ( ED4_R_OK ); |
---|
791 | } |
---|
792 | |
---|
793 | void ED4_root::copy_window_struct( ED4_window *source , ED4_window *destination ) |
---|
794 | { |
---|
795 | destination->slider_pos_horizontal = source->slider_pos_horizontal; |
---|
796 | destination->slider_pos_vertical = source->slider_pos_vertical; |
---|
797 | destination->coords = source->coords; |
---|
798 | } |
---|
799 | |
---|
800 | |
---|
801 | void ED4_reload_helix(AW_window *aww,AW_CL cd1, AW_CL cd2) |
---|
802 | { |
---|
803 | const char *err = ED4_ROOT->helix->init(gb_main); |
---|
804 | if (err) aw_message(err); |
---|
805 | ED4_refresh_window(aww,cd1,cd2); |
---|
806 | } |
---|
807 | |
---|
808 | void ED4_reload_ecoli(AW_window *aww,AW_CL cd1, AW_CL cd2) |
---|
809 | { |
---|
810 | const char *err = ED4_ROOT->ecoli_ref->init(gb_main); |
---|
811 | if (err) aw_message(err); |
---|
812 | ED4_refresh_window(aww,cd1,cd2); |
---|
813 | } |
---|
814 | |
---|
815 | // -------------------------------------------------------------------------------- |
---|
816 | // recursion through all species |
---|
817 | // -------------------------------------------------------------------------------- |
---|
818 | |
---|
819 | static GB_ERROR do_sth_with_species_error = NULL; |
---|
820 | |
---|
821 | ED4_returncode do_sth_with_species(void **arg1, void **arg2, ED4_base *base) |
---|
822 | { |
---|
823 | if (!do_sth_with_species_error && base->is_species_manager()) { |
---|
824 | GB_ERROR (*what_to_do_with_species)(GBDATA*,void**) = (GB_ERROR (*)(GBDATA*,void**))arg1; |
---|
825 | ED4_species_manager *species_manager = base->to_species_manager(); |
---|
826 | ED4_species_name_terminal *species_name_terminal = species_manager->search_spec_child_rek(ED4_L_SPECIES_NAME)->to_species_name_terminal(); |
---|
827 | |
---|
828 | if (species_name_terminal->get_species_pointer()) { |
---|
829 | char *species_name = GB_read_as_string(species_name_terminal->get_species_pointer()); |
---|
830 | |
---|
831 | e4_assert(species_name); |
---|
832 | GBDATA *species = GBT_find_species(gb_main, species_name); |
---|
833 | if (species) do_sth_with_species_error = what_to_do_with_species(species, arg2); |
---|
834 | delete species_name; |
---|
835 | } |
---|
836 | } |
---|
837 | |
---|
838 | return ED4_R_OK; |
---|
839 | } |
---|
840 | |
---|
841 | |
---|
842 | GB_ERROR ED4_with_all_loaded_species(GB_ERROR (*what_to_do_with_species)(GBDATA*,void**), void **arg) |
---|
843 | { |
---|
844 | ED4_ROOT->root_group_man->route_down_hierarchy((void**)what_to_do_with_species, arg, do_sth_with_species); |
---|
845 | GB_ERROR error = do_sth_with_species_error; |
---|
846 | do_sth_with_species_error = NULL; |
---|
847 | return error; |
---|
848 | } |
---|
849 | |
---|
850 | // -------------------------------------------------------------------------------- |
---|
851 | // faligner |
---|
852 | // -------------------------------------------------------------------------------- |
---|
853 | |
---|
854 | static int has_species_name(ED4_base *base, AW_CL cl_species_name) |
---|
855 | { |
---|
856 | ED4_species_name_terminal *name_term = base->to_species_name_terminal(); |
---|
857 | GBDATA *gbd = name_term->get_species_pointer(); |
---|
858 | |
---|
859 | if (gbd) { |
---|
860 | char *name = GB_read_char_pntr(gbd); |
---|
861 | e4_assert(name); |
---|
862 | int has_name = strcmp(name,(const char*)cl_species_name)==0; |
---|
863 | return has_name; |
---|
864 | } |
---|
865 | |
---|
866 | return 0; |
---|
867 | } |
---|
868 | |
---|
869 | ED4_species_name_terminal *ED4_find_species_name_terminal(const char *species_name) |
---|
870 | { |
---|
871 | ED4_base *base = ED4_ROOT->root_group_man->find_first_that(ED4_L_SPECIES_NAME, has_species_name, (AW_CL)species_name); |
---|
872 | |
---|
873 | return base ? base->to_species_name_terminal() : 0; |
---|
874 | } |
---|
875 | |
---|
876 | static char *get_group_consensus(const char *species_name, int start_pos, int end_pos) |
---|
877 | { |
---|
878 | ED4_species_name_terminal *name_term = ED4_find_species_name_terminal(species_name); |
---|
879 | char *consensus = 0; |
---|
880 | |
---|
881 | if (name_term) { |
---|
882 | ED4_group_manager *group_man = name_term->get_parent(ED4_L_GROUP)->to_group_manager(); |
---|
883 | if (group_man) { |
---|
884 | consensus = group_man->table().build_consensus_string(start_pos, end_pos, 0); |
---|
885 | } |
---|
886 | } |
---|
887 | |
---|
888 | return consensus; |
---|
889 | } |
---|
890 | |
---|
891 | static int get_selected_range(int *firstColumn, int *lastColumn) |
---|
892 | { |
---|
893 | ED4_list_elem *listElem = ED4_ROOT->selected_objects.first(); |
---|
894 | if (listElem) { |
---|
895 | ED4_selection_entry *selectionEntry = (ED4_selection_entry*)listElem->elem(); |
---|
896 | ED4_sequence_terminal *seqTerm = selectionEntry->object->get_parent(ED4_L_SPECIES)->search_spec_child_rek(ED4_L_SEQUENCE_STRING)->to_sequence_terminal(); |
---|
897 | |
---|
898 | ED4_get_selected_range(seqTerm, firstColumn, lastColumn); |
---|
899 | return 1; |
---|
900 | } |
---|
901 | return 0; |
---|
902 | } |
---|
903 | |
---|
904 | static ED4_list_elem *actual_aligner_elem = 0; |
---|
905 | static GBDATA *get_next_selected_species(void) |
---|
906 | { |
---|
907 | if (!actual_aligner_elem) return 0; |
---|
908 | |
---|
909 | ED4_selection_entry *selectionEntry = (ED4_selection_entry*)actual_aligner_elem->elem(); |
---|
910 | ED4_species_manager *specMan = selectionEntry->object->get_parent(ED4_L_SPECIES)->to_species_manager(); |
---|
911 | |
---|
912 | actual_aligner_elem = actual_aligner_elem->next(); |
---|
913 | return specMan->get_species_pointer(); |
---|
914 | } |
---|
915 | static GBDATA *get_first_selected_species(int *total_no_of_selected_species) |
---|
916 | { |
---|
917 | int selected = ED4_ROOT->selected_objects.no_of_entries(); |
---|
918 | |
---|
919 | if (total_no_of_selected_species) { |
---|
920 | *total_no_of_selected_species = selected; |
---|
921 | } |
---|
922 | |
---|
923 | if (selected) { |
---|
924 | actual_aligner_elem = ED4_ROOT->selected_objects.first(); |
---|
925 | } |
---|
926 | else { |
---|
927 | actual_aligner_elem = 0; |
---|
928 | } |
---|
929 | |
---|
930 | return get_next_selected_species(); |
---|
931 | } |
---|
932 | |
---|
933 | struct AWTC_faligner_cd faligner_client_data = |
---|
934 | { |
---|
935 | 1, // default is to do a refresh |
---|
936 | ED4_timer_refresh, // with this function |
---|
937 | get_group_consensus, // aligner fetches consensus of group of species via this function |
---|
938 | get_selected_range, // aligner fetches column range of selection via this function |
---|
939 | get_first_selected_species, // aligner fetches first and.. |
---|
940 | get_next_selected_species // .. following selected species via this functions |
---|
941 | }; |
---|
942 | |
---|
943 | static GB_ERROR ED4_delete_temp_entries(GBDATA *species, void **alignment_char_ptr) |
---|
944 | { |
---|
945 | GB_CSTR alignment = (GB_CSTR)alignment_char_ptr; |
---|
946 | GB_ERROR error = AWTC_delete_temp_entries(species, alignment); |
---|
947 | |
---|
948 | return error; |
---|
949 | } |
---|
950 | |
---|
951 | void ED4_remove_faligner_entries(AW_window *, AW_CL, AW_CL) |
---|
952 | { |
---|
953 | GB_ERROR error = GB_begin_transaction(gb_main); |
---|
954 | |
---|
955 | if (!error) { |
---|
956 | error = ED4_with_all_loaded_species(ED4_delete_temp_entries, (void**)ED4_ROOT->alignment_name); |
---|
957 | } |
---|
958 | |
---|
959 | if (error) { |
---|
960 | aw_message(error); |
---|
961 | GB_abort_transaction(gb_main); |
---|
962 | } |
---|
963 | else { |
---|
964 | GB_commit_transaction(gb_main); |
---|
965 | } |
---|
966 | } |
---|
967 | |
---|
968 | void ED4_turnSpecies(AW_window *aw, AW_CL, AW_CL) |
---|
969 | { |
---|
970 | AW_root *root = aw->get_root(); |
---|
971 | char *name; |
---|
972 | GBDATA *species; |
---|
973 | GBDATA *gbd; |
---|
974 | char *data; |
---|
975 | GB_ERROR error = GB_begin_transaction(gb_main); |
---|
976 | char *ali = ED4_ROOT->alignment_name; |
---|
977 | |
---|
978 | if (!error) { |
---|
979 | name = root->awar(AWAR_SPECIES_NAME)->read_string(); |
---|
980 | species = GBT_find_species(gb_main, name); |
---|
981 | |
---|
982 | gbd = species ? GBT_read_sequence(species, ali) : (GBDATA*)NULL; |
---|
983 | data = gbd ? GB_read_string(gbd) : (char*)NULL; |
---|
984 | |
---|
985 | if (data) { |
---|
986 | long length = GB_read_string_count(gbd); |
---|
987 | |
---|
988 | AWTC_mirrorSequence(data, length, ED4_ROOT->alignment_type); |
---|
989 | error = GB_write_string(gbd,data); |
---|
990 | } |
---|
991 | else { |
---|
992 | error = GB_get_error(); |
---|
993 | if (!error) error = GB_export_error("Can't read data of '%s'", name); |
---|
994 | } |
---|
995 | |
---|
996 | delete name; |
---|
997 | } |
---|
998 | |
---|
999 | if (error) { |
---|
1000 | aw_message(error); |
---|
1001 | GB_abort_transaction(gb_main); |
---|
1002 | } |
---|
1003 | else { |
---|
1004 | GB_commit_transaction(gb_main); |
---|
1005 | } |
---|
1006 | } |
---|
1007 | |
---|
1008 | |
---|
1009 | #if defined(DEBUG) && 0 |
---|
1010 | |
---|
1011 | void ED4_testSplitNMerge(AW_window *aw, AW_CL, AW_CL) |
---|
1012 | { |
---|
1013 | AW_root *root = aw->get_root(); |
---|
1014 | char *name; |
---|
1015 | GBDATA *species; |
---|
1016 | GBDATA *gbd; |
---|
1017 | char *data; |
---|
1018 | long length; |
---|
1019 | |
---|
1020 | GB_ERROR error = GB_begin_transaction(gb_main); |
---|
1021 | char *ali = ED4_ROOT->alignment_name; |
---|
1022 | |
---|
1023 | if (!error) |
---|
1024 | { |
---|
1025 | name = root->awar(AWAR_SPECIES_NAME)->read_string(); |
---|
1026 | species = GBT_find_species(gb_main, name); |
---|
1027 | gbd = species ? GBT_read_sequence(species, ali) : NULL; |
---|
1028 | data = gbd ? GB_read_string(gbd) : NULL; |
---|
1029 | length = gbd ? GB_read_string_count(gbd) : NULL; |
---|
1030 | |
---|
1031 | if (data) |
---|
1032 | { |
---|
1033 | char *newData = AWTC_testConstructSequence(data); |
---|
1034 | |
---|
1035 | if (newData) |
---|
1036 | { |
---|
1037 | error = GB_write_string(gbd,newData); |
---|
1038 | delete [] newData; |
---|
1039 | } |
---|
1040 | } |
---|
1041 | else |
---|
1042 | { |
---|
1043 | error = GB_get_error(); |
---|
1044 | if (!error) error = GB_export_error("Can't read data of '%s'", name); |
---|
1045 | } |
---|
1046 | |
---|
1047 | delete name; |
---|
1048 | delete data; |
---|
1049 | } |
---|
1050 | |
---|
1051 | if (error) |
---|
1052 | { |
---|
1053 | aw_message(error); |
---|
1054 | GB_abort_transaction(gb_main); |
---|
1055 | } |
---|
1056 | else |
---|
1057 | GB_commit_transaction(gb_main); |
---|
1058 | } |
---|
1059 | |
---|
1060 | #endif |
---|
1061 | |
---|
1062 | static void col_stat_activated(AW_window *) |
---|
1063 | { |
---|
1064 | ED4_ROOT->column_stat_initialized = 1; |
---|
1065 | ED4_ROOT->column_stat_activated = 1; |
---|
1066 | ED4_ROOT->refresh_all_windows(1); |
---|
1067 | } |
---|
1068 | |
---|
1069 | void ED4_activate_col_stat(AW_window *aww,AW_CL, AW_CL){ |
---|
1070 | if (!ED4_ROOT->column_stat_initialized) { |
---|
1071 | AW_window *aww_st = st_create_main_window(ED4_ROOT->aw_root,ED4_ROOT->st_ml,(AW_CB0)col_stat_activated,(AW_window *)aww); |
---|
1072 | aww_st->show(); |
---|
1073 | return; |
---|
1074 | } |
---|
1075 | else { // re-activate |
---|
1076 | ED4_ROOT->column_stat_activated = 1; |
---|
1077 | ED4_ROOT->refresh_all_windows(1); |
---|
1078 | } |
---|
1079 | } |
---|
1080 | static void disable_col_stat(AW_window *, AW_CL, AW_CL) { |
---|
1081 | if (ED4_ROOT->column_stat_initialized && ED4_ROOT->column_stat_activated) { |
---|
1082 | ED4_ROOT->column_stat_activated = 0; |
---|
1083 | ED4_ROOT->refresh_all_windows(1); |
---|
1084 | } |
---|
1085 | } |
---|
1086 | |
---|
1087 | static void title_mode_changed(AW_root *aw_root, AW_window *aww) |
---|
1088 | { |
---|
1089 | int title_mode = aw_root->awar(AWAR_EDIT_TITLE_MODE)->read_int(); |
---|
1090 | |
---|
1091 | if (title_mode==0) { |
---|
1092 | aww->set_info_area_height(55); |
---|
1093 | } |
---|
1094 | else { |
---|
1095 | aww->set_info_area_height(170); |
---|
1096 | } |
---|
1097 | } |
---|
1098 | |
---|
1099 | // static void ED4_unfold_if_folded(AW_window *aww, AW_CL, AW_CL) |
---|
1100 | // { |
---|
1101 | // AW_root *aw_root = ED4_ROOT->aw_root; |
---|
1102 | // int title_mode = aw_root->awar(AWAR_EDIT_TITLE_MODE)->read_int(); |
---|
1103 | |
---|
1104 | // if (title_mode==0) { |
---|
1105 | // aw_root->awar(AWAR_EDIT_TITLE_MODE)->write_int(1); |
---|
1106 | // title_mode_changed(aw_root, aww); |
---|
1107 | // } |
---|
1108 | // } |
---|
1109 | |
---|
1110 | void ED4_undo_redo(AW_window*, AW_CL undo_type) |
---|
1111 | { |
---|
1112 | GB_ERROR error = GB_undo(gb_main,(GB_UNDO_TYPE)undo_type); |
---|
1113 | |
---|
1114 | if (error) { |
---|
1115 | aw_message(error); |
---|
1116 | } |
---|
1117 | else { |
---|
1118 | GB_begin_transaction(gb_main); |
---|
1119 | GB_commit_transaction(gb_main); |
---|
1120 | ED4_cursor *cursor = &ED4_ROOT->temp_ed4w->cursor; |
---|
1121 | if (cursor->owner_of_cursor) { |
---|
1122 | ED4_terminal *terminal = cursor->owner_of_cursor->to_terminal(); |
---|
1123 | |
---|
1124 | terminal->set_refresh(); |
---|
1125 | terminal->parent->refresh_requested_by_child(); |
---|
1126 | } |
---|
1127 | // aed_expose(aw,cd1,0); |
---|
1128 | } |
---|
1129 | } |
---|
1130 | |
---|
1131 | void aw_clear_message_cb(AW_window *aww); |
---|
1132 | |
---|
1133 | void ED4_clear_errors(AW_window*, AW_CL) |
---|
1134 | { |
---|
1135 | // ED4_ROOT->aw_root->awar(AWAR_ERROR_MESSAGES)->write_string(""); |
---|
1136 | aw_clear_message_cb(ED4_ROOT->temp_aww); |
---|
1137 | } |
---|
1138 | |
---|
1139 | AW_window *ED4_zoom_message_window(AW_root *root, AW_CL) |
---|
1140 | { |
---|
1141 | AW_window_simple *aws = new AW_window_simple; |
---|
1142 | |
---|
1143 | aws->init(root, "ZOOM_ERR_MSG", "Errors and warnings", 100, 100); |
---|
1144 | aws->load_xfig("edit4/message.fig"); |
---|
1145 | |
---|
1146 | aws->callback((AW_CB0)AW_POPDOWN); |
---|
1147 | aws->at("hide"); |
---|
1148 | aws->create_button("HIDE", "HIDE"); |
---|
1149 | |
---|
1150 | aws->callback(ED4_clear_errors, (AW_CL)0); |
---|
1151 | aws->at("clear"); |
---|
1152 | aws->create_button("CLEAR", "CLEAR"); |
---|
1153 | |
---|
1154 | aws->at("errortext"); |
---|
1155 | aws->create_text_field(AWAR_ERROR_MESSAGES); |
---|
1156 | |
---|
1157 | return (AW_window *)aws; |
---|
1158 | } |
---|
1159 | |
---|
1160 | |
---|
1161 | char *cat(char *toBuf, const char *s1, const char *s2) |
---|
1162 | { |
---|
1163 | char *buf = toBuf; |
---|
1164 | |
---|
1165 | while ((*buf++=*s1++)!=0) ; |
---|
1166 | buf--; |
---|
1167 | while ((*buf++=*s2++)!=0) ; |
---|
1168 | |
---|
1169 | return toBuf; |
---|
1170 | } |
---|
1171 | |
---|
1172 | static void insert_search_fields(AW_window_menu_modes *awmm, |
---|
1173 | const char *label_prefix, const char *macro_prefix, |
---|
1174 | const char *pattern_awar_name, ED4_SearchPositionType type, const char *show_awar_name, |
---|
1175 | int short_form) |
---|
1176 | { |
---|
1177 | char buf[200]; |
---|
1178 | |
---|
1179 | if (!short_form) { |
---|
1180 | awmm->at(cat(buf, label_prefix, "search")); |
---|
1181 | awmm->create_input_field(pattern_awar_name, 30); |
---|
1182 | } |
---|
1183 | |
---|
1184 | awmm->at(cat(buf, label_prefix, "n")); |
---|
1185 | awmm->callback(ED4_search, ED4_encodeSearchDescriptor(+1, type)); |
---|
1186 | awmm->create_button(cat(buf, macro_prefix, "_SEARCH_NEXT"), "#edit/next.bitmap"); |
---|
1187 | |
---|
1188 | awmm->at(cat(buf, label_prefix, "l")); |
---|
1189 | awmm->callback(ED4_search, ED4_encodeSearchDescriptor(-1, type)); |
---|
1190 | awmm->create_button(cat(buf, macro_prefix, "_SEARCH_LAST"), "#edit/last.bitmap"); |
---|
1191 | |
---|
1192 | awmm->at(cat(buf, label_prefix, "d")); |
---|
1193 | awmm->callback(AW_POPUP, (AW_CL)ED4_create_search_window, (AW_CL)type); |
---|
1194 | awmm->create_button(cat(buf, macro_prefix, "_SEARCH_DETAIL"), "#edit/detail.bitmap"); |
---|
1195 | |
---|
1196 | awmm->at(cat(buf, label_prefix, "s")); |
---|
1197 | awmm->create_toggle(show_awar_name); |
---|
1198 | } |
---|
1199 | |
---|
1200 | void ED4_set_protection(AW_window */*aww*/, AW_CL cd1, AW_CL /*cd2*/) |
---|
1201 | { |
---|
1202 | ED4_cursor *cursor = &ED4_ROOT->temp_ed4w->cursor; |
---|
1203 | |
---|
1204 | if (cursor->owner_of_cursor) { |
---|
1205 | int wanted_protection = int(cd1); |
---|
1206 | ED4_sequence_terminal *seq_term = cursor->owner_of_cursor->to_sequence_terminal(); |
---|
1207 | ED4_sequence_info_terminal *seq_info_term = seq_term->parent->search_spec_child_rek(ED4_L_SEQUENCE_INFO)->to_sequence_info_terminal(); |
---|
1208 | GBDATA *gbd = seq_info_term->data(); |
---|
1209 | |
---|
1210 | GB_push_transaction(gbd); |
---|
1211 | GB_push_my_security(gbd); |
---|
1212 | GB_ERROR err = GB_write_security_write(gbd, wanted_protection); |
---|
1213 | GB_pop_my_security(gbd); |
---|
1214 | |
---|
1215 | if (err) { |
---|
1216 | GB_abort_transaction(gbd); |
---|
1217 | aw_message(err); |
---|
1218 | } |
---|
1219 | else { |
---|
1220 | GB_pop_transaction(gbd); |
---|
1221 | } |
---|
1222 | } |
---|
1223 | else { |
---|
1224 | aw_message("No species selected"); |
---|
1225 | } |
---|
1226 | } |
---|
1227 | |
---|
1228 | typedef enum { |
---|
1229 | ED4_MS_NONE, |
---|
1230 | ED4_MS_ALL, |
---|
1231 | ED4_MS_INVERT, |
---|
1232 | ED4_MS_INVERT_GROUP, |
---|
1233 | ED4_MS_UNMARK_ALL, |
---|
1234 | ED4_MS_MARK_SELECTED, |
---|
1235 | ED4_MS_UNMARK_SELECTED, |
---|
1236 | ED4_MS_SELECT_MARKED, |
---|
1237 | ED4_MS_DESELECT_MARKED, |
---|
1238 | ED4_MS_TOGGLE_BLOCKTYPE |
---|
1239 | |
---|
1240 | } MenuSelectType; |
---|
1241 | |
---|
1242 | static void ED4_menu_select(AW_window *aww, AW_CL type,AW_CL) { |
---|
1243 | GB_transaction dummy(gb_main); |
---|
1244 | MenuSelectType select = MenuSelectType(type); |
---|
1245 | ED4_multi_species_manager *middle_multi_man = ED4_ROOT->middle_area_man->get_defined_level(ED4_L_MULTI_SPECIES)->to_multi_species_manager(); |
---|
1246 | |
---|
1247 | e4_assert(middle_multi_man); |
---|
1248 | |
---|
1249 | switch(select) { |
---|
1250 | case ED4_MS_NONE: { |
---|
1251 | if (ED4_getBlocktype()!=ED4_BT_NOBLOCK) { |
---|
1252 | ED4_ROOT->deselect_all(); |
---|
1253 | ED4_setBlocktype(ED4_BT_NOBLOCK); |
---|
1254 | } |
---|
1255 | break; |
---|
1256 | } |
---|
1257 | case ED4_MS_ALL: { |
---|
1258 | middle_multi_man->select_all_species(); |
---|
1259 | ED4_correctBlocktypeAfterSelection(); |
---|
1260 | break; |
---|
1261 | } |
---|
1262 | case ED4_MS_INVERT: { |
---|
1263 | middle_multi_man->invert_selection_of_all_species(); |
---|
1264 | ED4_correctBlocktypeAfterSelection(); |
---|
1265 | break; |
---|
1266 | } |
---|
1267 | case ED4_MS_SELECT_MARKED: { |
---|
1268 | middle_multi_man->select_marked_species(1); |
---|
1269 | ED4_correctBlocktypeAfterSelection(); |
---|
1270 | break; |
---|
1271 | } |
---|
1272 | case ED4_MS_DESELECT_MARKED: { |
---|
1273 | middle_multi_man->select_marked_species(0); |
---|
1274 | ED4_correctBlocktypeAfterSelection(); |
---|
1275 | break; |
---|
1276 | } |
---|
1277 | case ED4_MS_UNMARK_ALL: { |
---|
1278 | GBT_mark_all(gb_main, 0); |
---|
1279 | break; |
---|
1280 | } |
---|
1281 | case ED4_MS_MARK_SELECTED: { |
---|
1282 | middle_multi_man->mark_selected_species(1); |
---|
1283 | ED4_correctBlocktypeAfterSelection(); |
---|
1284 | break; |
---|
1285 | } |
---|
1286 | case ED4_MS_UNMARK_SELECTED: { |
---|
1287 | middle_multi_man->mark_selected_species(0); |
---|
1288 | ED4_correctBlocktypeAfterSelection(); |
---|
1289 | break; |
---|
1290 | } |
---|
1291 | case ED4_MS_INVERT_GROUP: { |
---|
1292 | ED4_cursor *cursor = &ED4_ROOT->first_window->get_matching_ed4w(aww)->cursor; |
---|
1293 | int done = 0; |
---|
1294 | |
---|
1295 | if (cursor->owner_of_cursor) { |
---|
1296 | ED4_multi_species_manager *multi_man = cursor->owner_of_cursor->get_parent(ED4_L_MULTI_SPECIES)->to_multi_species_manager(); |
---|
1297 | |
---|
1298 | multi_man->invert_selection_of_all_species(); |
---|
1299 | ED4_correctBlocktypeAfterSelection(); |
---|
1300 | done = 1; |
---|
1301 | } |
---|
1302 | |
---|
1303 | if (!done) { |
---|
1304 | aw_message("Place cursor into group"); |
---|
1305 | } |
---|
1306 | break; |
---|
1307 | } |
---|
1308 | case ED4_MS_TOGGLE_BLOCKTYPE: { |
---|
1309 | ED4_toggle_block_type(); |
---|
1310 | break; |
---|
1311 | } |
---|
1312 | default: { |
---|
1313 | e4_assert(0); |
---|
1314 | break; |
---|
1315 | } |
---|
1316 | } |
---|
1317 | |
---|
1318 | ED4_refresh_window(aww, 1, 0); |
---|
1319 | } |
---|
1320 | |
---|
1321 | void ED4_menu_perform_block_operation(AW_window*, AW_CL type, AW_CL) { |
---|
1322 | ED4_perform_block_operation(ED4_blockoperation_type(type)); |
---|
1323 | } |
---|
1324 | |
---|
1325 | static void modes_cb(AW_window*, AW_CL cd1, AW_CL) |
---|
1326 | { |
---|
1327 | ED4_ROOT->species_mode = ED4_species_mode(cd1); |
---|
1328 | } |
---|
1329 | void ED4_no_dangerous_modes(void) |
---|
1330 | { |
---|
1331 | switch (ED4_ROOT->species_mode) { |
---|
1332 | case ED4_SM_KILL: { |
---|
1333 | ED4_ROOT->species_mode = ED4_SM_MOVE; |
---|
1334 | ED4_ROOT->temp_aww->select_mode(0); |
---|
1335 | break; |
---|
1336 | } |
---|
1337 | default: { |
---|
1338 | break; |
---|
1339 | } |
---|
1340 | } |
---|
1341 | } |
---|
1342 | |
---|
1343 | |
---|
1344 | ED4_returncode ED4_root::generate_window( AW_device **device, ED4_window **new_window) |
---|
1345 | { |
---|
1346 | AW_window_menu_modes *awmm; |
---|
1347 | AW_gc_manager aw_gc_manager; //every window has its own gc_manager |
---|
1348 | char buf[25]; |
---|
1349 | ED4_window *ed4w = ED4_ROOT->first_window; |
---|
1350 | |
---|
1351 | while (ed4w) // before creating a window look for a hidden window |
---|
1352 | { |
---|
1353 | if (ed4w->is_hidden) |
---|
1354 | { |
---|
1355 | ed4w->aww->show(); |
---|
1356 | ed4w->is_hidden = 0; |
---|
1357 | return ED4_R_BREAK; |
---|
1358 | } |
---|
1359 | ed4w = ed4w->next; |
---|
1360 | } |
---|
1361 | |
---|
1362 | |
---|
1363 | if (ED4_window::no_of_windows == MAXWINDOWS) // no more then 5 windows allowed |
---|
1364 | { |
---|
1365 | aw_message("Restricted to 5 windows", 0); |
---|
1366 | return ED4_R_BREAK; |
---|
1367 | } |
---|
1368 | |
---|
1369 | sprintf(buf,"ARB_EDIT4 *%d*", ED4_window::no_of_windows+1 ); |
---|
1370 | |
---|
1371 | awmm = new AW_window_menu_modes; |
---|
1372 | awmm->init( aw_root, buf,buf, 800,600,20, 20 ); //create window |
---|
1373 | *device = awmm->get_device(AW_MIDDLE_AREA); //Points to Middle Area device |
---|
1374 | |
---|
1375 | *new_window = first_window->insert_window( awmm ); //append to window list |
---|
1376 | |
---|
1377 | if (ED4_window::no_of_windows >= 1) // this is the first window |
---|
1378 | { |
---|
1379 | copy_window_struct( first_window, *new_window ); |
---|
1380 | } |
---|
1381 | |
---|
1382 | |
---|
1383 | |
---|
1384 | aw_gc_manager = AW_manage_GC( awmm, //Window |
---|
1385 | *device, //device-handle of window |
---|
1386 | ED4_G_STANDARD, //GC_Standard configuration |
---|
1387 | ED4_G_DRAG, |
---|
1388 | AW_GCM_DATA_AREA, |
---|
1389 | ED4_expose_cb, //callback function |
---|
1390 | 1, // AW_CL for callback function |
---|
1391 | 0, // AW_CL for callback function |
---|
1392 | |
---|
1393 | "#ffffe0", |
---|
1394 | "STANDARD$black", // Standard Color showing sequences |
---|
1395 | "#SEQUENCES$navy", // Color for selected sequences |
---|
1396 | "+-HELIX (1)$#8E0000", "+-COLOR 2$#07f", "-COLOR 3$#0a0", |
---|
1397 | "+-COLOR 4$#80f", "+-COLOR 5$#a90", "-COLOR 6$grey", |
---|
1398 | "+-COLOR 7$red", "+-COLOR 8$red", "-COLOR 9$red", |
---|
1399 | "+-RANGE 0$#FFFFFF", "+-RANGE 1$#E0E0E0", "-RANGE 2$#C0C0C0", |
---|
1400 | "+-RANGE 3$#A0A0A0", "+-RANGE 4$#909090", "-RANGE 5$#808080", |
---|
1401 | "+-RANGE 6$#808080", "+-RANGE 7$#505050", "-RANGE 8$#404040", |
---|
1402 | "-RANGE 9$#303030", |
---|
1403 | "+-User1$#B8E2F8", "+-User2$#B8E2F8", "-Probe$#B8E2F8", |
---|
1404 | "+-Primer(l)$#A9FE54", "+-Primer(r)$#A9FE54", "-Primer(g)$#A9FE54", |
---|
1405 | "+-Sig(l)$#DBB0FF", "+-Sig(r)$#DBB0FF", "-Sig(g)$#DBB0FF", |
---|
1406 | "+-MISMATCHES$#FF9AFF", "-CURSOR$#FF0080", |
---|
1407 | "+-MARKED$#FFFFBD", "-SELECTED$#FFFF80", |
---|
1408 | 0); |
---|
1409 | |
---|
1410 | #define ____________________________SEP awmm->insert_separator() |
---|
1411 | |
---|
1412 | // ------------------------------ |
---|
1413 | // File |
---|
1414 | // ------------------------------ |
---|
1415 | |
---|
1416 | awmm->create_menu ( 0, "File", "F", "No Help", AWM_ALL ); |
---|
1417 | |
---|
1418 | awmm->insert_menu_topic ( "save_config", "Save Configuration", "S", "No Help", AWM_ALL, (AW_CB)ED4_save_configuration, (AW_CL) 0, (int) 0 ); |
---|
1419 | awmm->insert_menu_topic ( "save_config_as", "Save Configuration As", "A", "No Help", AWM_ALL, AW_POPUP, (AW_CL) ED4_save_configuration_as_open_window, (int) 0 ); |
---|
1420 | ____________________________SEP; |
---|
1421 | |
---|
1422 | awmm->insert_menu_topic ( "load_config", "Load Configuration", "L", "No Help", AWM_ALL, AW_POPUP, (AW_CL)ED4_start_editor_on_old_configuration, 0); |
---|
1423 | awmm->insert_menu_topic ( "reload_config", "Reload Configuration", "R", "No Help", AWM_ALL, ED4_restart_editor, 0, 0); |
---|
1424 | |
---|
1425 | GDE_load_menu(awmm,"pretty_print"); |
---|
1426 | ____________________________SEP; |
---|
1427 | |
---|
1428 | awmm->insert_menu_topic ( "new_win", "New Editor Window", "W", "No Help", AWM_ALL, ED4_new_editor_window, 0, 0); |
---|
1429 | |
---|
1430 | if (ED4_window::no_of_windows == 1) { // this is the first window |
---|
1431 | awmm->insert_menu_topic( "quit", "QUIT", "Q", "No Help", AWM_ALL, ED4_quit_editor, 0, 0 ); |
---|
1432 | } |
---|
1433 | else { |
---|
1434 | awmm->insert_menu_topic( "close", "CLOSE", "C", "No Help", AWM_ALL, ED4_quit_editor, 0, 0 ); |
---|
1435 | } |
---|
1436 | |
---|
1437 | // ------------------------------ |
---|
1438 | // Create |
---|
1439 | // ------------------------------ |
---|
1440 | |
---|
1441 | awmm->create_menu(0, "Create", "C", 0, AWM_ALL); |
---|
1442 | |
---|
1443 | awmm->insert_menu_topic("create_species", "Create new species", "C", "No Help", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_new_seq_window, (int)0); |
---|
1444 | awmm->insert_menu_topic("create_species_from_consensus", "Create new species from consensus", "", "No Help", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_new_seq_window, (int)1); |
---|
1445 | awmm->insert_menu_topic("copy_species", "Copy current species", "", "No Help", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_new_seq_window, (int)2); |
---|
1446 | ____________________________SEP; |
---|
1447 | |
---|
1448 | awmm->insert_menu_topic( "create_group", "Create new group", "G", "No Help", AWM_ALL, group_species_cb, 0, 0); |
---|
1449 | awmm->insert_menu_topic( "create_groups_by_field", "Create new groups using field", "", "No Help", AWM_ALL, group_species_cb, 1, 0); |
---|
1450 | |
---|
1451 | // ------------------------------ |
---|
1452 | // Edit |
---|
1453 | // ------------------------------ |
---|
1454 | |
---|
1455 | awmm->create_menu ( 0 , "Edit", "E", 0, AWM_ALL); |
---|
1456 | |
---|
1457 | awmm->insert_menu_topic( "refresh", "Refresh [Ctrl-L]", "", 0, AWM_ALL, ED4_refresh_window, 1, 0 ); |
---|
1458 | ____________________________SEP; |
---|
1459 | |
---|
1460 | awmm->insert_sub_menu("SET_PROTECTION", "Set protection of current", "p"); |
---|
1461 | { |
---|
1462 | char macro[] = "to_0", |
---|
1463 | topic[] = ".. to 0", |
---|
1464 | hotkey[] = "0"; |
---|
1465 | |
---|
1466 | for (char i='0'; i<='6'; i++) { |
---|
1467 | macro[3] = topic[6] = hotkey[0] = i; |
---|
1468 | awmm->insert_menu_topic(macro, topic, hotkey, 0, AWM_ALL, ED4_set_protection, AW_CL(i-'0'), 0); |
---|
1469 | } |
---|
1470 | } |
---|
1471 | awmm->close_sub_menu(); |
---|
1472 | ____________________________SEP; |
---|
1473 | |
---|
1474 | awmm->insert_sub_menu(0, "Search", "S"); |
---|
1475 | { |
---|
1476 | int s; |
---|
1477 | |
---|
1478 | for (s=0; s<SEARCH_PATTERNS; s++) { |
---|
1479 | ED4_SearchPositionType type = ED4_SearchPositionType(s); |
---|
1480 | const char *id = ED4_SearchPositionTypeId[type]; |
---|
1481 | int len = strlen(id); |
---|
1482 | char *macro_name = GB_give_buffer(2*(len+8)); |
---|
1483 | char *menu_entry_name = macro_name+(len+8); |
---|
1484 | |
---|
1485 | #ifndef NDEBUG |
---|
1486 | memset(macro_name, 0, 2*(len+8)); // to avoid memchk-warning |
---|
1487 | #endif |
---|
1488 | sprintf(macro_name, "%s_SEARCH", id); |
---|
1489 | char *p = macro_name; |
---|
1490 | while (1) { |
---|
1491 | char c = *p++; |
---|
1492 | if (!c) break; |
---|
1493 | p[-1] = toupper(c); |
---|
1494 | } |
---|
1495 | sprintf(menu_entry_name, "%s Search", id); |
---|
1496 | |
---|
1497 | awmm->insert_menu_topic(macro_name, menu_entry_name, 0, "e4_search.hlp", AWM_ALL, AW_POPUP, AW_CL(ED4_create_search_window), AW_CL(type)); |
---|
1498 | } |
---|
1499 | } |
---|
1500 | awmm->close_sub_menu(); |
---|
1501 | ____________________________SEP; |
---|
1502 | |
---|
1503 | awmm->insert_sub_menu(0, "Position of cursor", "c"); |
---|
1504 | awmm->insert_menu_topic( "store_curpos", "Store cursor position", "S", 0, AWM_ALL, ED4_store_curpos, 0, 0 ); |
---|
1505 | awmm->insert_menu_topic( "restore_curpos", "Restore cursor position", "R", 0, AWM_ALL, ED4_restore_curpos, 0, 0 ); |
---|
1506 | awmm->insert_menu_topic( "clear_curpos", "Clear stored positions", "C", 0, AWM_ALL, ED4_clear_stored_curpos, 0, 0 ); |
---|
1507 | awmm->close_sub_menu(); |
---|
1508 | awmm->insert_menu_topic( "helix_jump_opposite", "Jump helix opposite [Ctrl-J]", "J", 0, AWM_ALL, ED4_helix_jump_opposite, 0, 0); |
---|
1509 | ____________________________SEP; |
---|
1510 | |
---|
1511 | awmm->insert_menu_topic( "refresh_helix", "Reload Helix", "H", 0, AWM_ALL, ED4_reload_helix, 0, 0 ); |
---|
1512 | awmm->insert_menu_topic( "refresh_ecoli", "Reload Ecoli Sequence", "E", 0, AWM_ALL, ED4_reload_ecoli, 0, 0 ); |
---|
1513 | ____________________________SEP; |
---|
1514 | |
---|
1515 | awmm->insert_menu_topic( "load_actual", "Load current species [GET]","G","", AWM_ALL, ED4_get_and_jump_to_actual_from_menu, 0, 0 ); |
---|
1516 | awmm->insert_menu_topic( "load_marked", "Load marked species","m","", AWM_ALL, ED4_get_marked_from_menu, 0, 0 ); |
---|
1517 | ____________________________SEP; |
---|
1518 | |
---|
1519 | awmm->insert_menu_topic( "show_diff", "Show only differences to Selected","d","set_reference.hlp", AWM_ALL, ED4_set_reference_species, 0, 0 ); |
---|
1520 | awmm->insert_menu_topic( "show_all", "Show all bases", "a", "set_reference.hlp", AWM_ALL, ED4_set_reference_species, 1, 0 ); |
---|
1521 | ____________________________SEP; |
---|
1522 | |
---|
1523 | awmm->insert_menu_topic( "enable_col_stat", "Activate column statistics", "v", "st_ml.hlp",AWM_ALL,ED4_activate_col_stat, 0, 0); |
---|
1524 | awmm->insert_menu_topic( "disable_col_stat", "Disable column statistics", "", "st_ml.hlp",AWM_ALL,disable_col_stat, 0, 0); |
---|
1525 | awmm->insert_menu_topic( "detail_col_stat", "Detailed column statistics", "", "st_ml.hlp",AWM_ALL, ED4_show_detailed_column_stats, 0, 0); |
---|
1526 | awmm->insert_menu_topic( "dcs_threshold", "Set threshold for D.c.s.", "", "st_ml.hlp",AWM_ALL, ED4_set_col_stat_threshold, 1, 0); |
---|
1527 | ____________________________SEP; |
---|
1528 | |
---|
1529 | awmm->insert_menu_topic("fast_aligner",FAST_ALIGNER_TITLE "... [Ctrl-A]","F","faligner.hlp",AWM_ALL,AW_POPUP,(AW_CL)AWTC_create_faligner_window,(AW_CL)&faligner_client_data); |
---|
1530 | awmm->insert_menu_topic("align_sequence","Old aligner from ARB_EDIT...", "2","ne_align_seq.hlp", AWM_ALL,AW_POPUP, (AW_CL)create_naligner_window, 0 ); |
---|
1531 | awmm->insert_menu_topic("del_ali_tmp", "Remove all aligner entries", "R", 0, AWM_ALL, ED4_remove_faligner_entries, 1, 0); |
---|
1532 | |
---|
1533 | #if !defined(NDEBUG) && 0 |
---|
1534 | awmm->insert_menu_topic("turn_sequence", "Turn Sequence", "T", 0, AWM_ALL, ED4_turnSpecies, 1, 0); |
---|
1535 | awmm->insert_menu_topic(0, "Test (test split & merge)", "T", 0, AWM_ALL, ED4_testSplitNMerge, 1, 0); |
---|
1536 | #endif |
---|
1537 | ____________________________SEP; |
---|
1538 | |
---|
1539 | awmm->insert_menu_topic("sec_edit", "Edit secondary structure", "", 0, AWM_ALL, ED4_SECEDIT_start, 0, 0); |
---|
1540 | |
---|
1541 | // ------------------------------ |
---|
1542 | // Block |
---|
1543 | // ------------------------------ |
---|
1544 | |
---|
1545 | awmm->create_menu(0, "Block", "B", 0, AWM_ALL); |
---|
1546 | awmm->insert_menu_topic("deselect_all", "Deselect all", "D", "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_NONE), 0); |
---|
1547 | awmm->insert_menu_topic("select_all", "Select all", "S", "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_ALL), 0); |
---|
1548 | awmm->insert_menu_topic("invert_all", "Invert all", "I", "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_INVERT), 0); |
---|
1549 | awmm->insert_menu_topic("invert_group", "Invert group", 0, "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_INVERT_GROUP), 0); |
---|
1550 | awmm->insert_menu_topic("toggle_block_type", "Line block <-> column block", 0, "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_TOGGLE_BLOCKTYPE), 0); |
---|
1551 | ____________________________SEP; |
---|
1552 | |
---|
1553 | awmm->insert_menu_topic("mark_selected", "Mark selected species", "M", "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_MARK_SELECTED), 0); |
---|
1554 | awmm->insert_menu_topic("unmark_selected", "Unmark selected species", 0, "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_UNMARK_SELECTED), 0); |
---|
1555 | awmm->insert_menu_topic("unmark_all", "Unmark all species", 0, "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_UNMARK_ALL), 0); |
---|
1556 | awmm->insert_menu_topic("select_marked", "Select marked species", 0, "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_SELECT_MARKED), 0); |
---|
1557 | awmm->insert_menu_topic("deselect_marked", "Deselect marked species", 0, "e4_block.hlp", AWM_ALL, ED4_menu_select, AW_CL(ED4_MS_DESELECT_MARKED), 0); |
---|
1558 | ____________________________SEP; |
---|
1559 | |
---|
1560 | awmm->insert_menu_topic("lowcase", "Lower case", "L", "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_LOWER_CASE), 0); |
---|
1561 | awmm->insert_menu_topic("upcase", "Upper case", "U", "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_UPPER_CASE), 0); |
---|
1562 | awmm->insert_menu_topic("reverse", "Reverse", 0, "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_REVERSE), 0); |
---|
1563 | awmm->insert_menu_topic("reverse_complement", "Reverse Complement", 0, "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_REVERSE_COMPLEMENT), 0); |
---|
1564 | awmm->insert_menu_topic("complement", "Complement", 0, "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_COMPLEMENT), 0); |
---|
1565 | awmm->insert_menu_topic("unalign", "Unalign", "a", "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_UNALIGN), 0); |
---|
1566 | awmm->insert_menu_topic("replace", "Replace ...", "R", "e4_replace.hlp", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_replace_window, 0); |
---|
1567 | awmm->insert_menu_topic("shift_left", "Shift left", 0, "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_SHIFT_LEFT), 0); |
---|
1568 | awmm->insert_menu_topic("shift_right", "Shift right", 0, "e4_block.hlp", AWM_ALL, ED4_menu_perform_block_operation, AW_CL(ED4_BO_SHIFT_RIGHT), 0); |
---|
1569 | |
---|
1570 | // ------------------------------ |
---|
1571 | // Properties |
---|
1572 | // ------------------------------ |
---|
1573 | |
---|
1574 | awmm->create_menu ( 0, "Properties", "P", "Select something", AWM_ALL); |
---|
1575 | awmm->insert_menu_topic( "props_frame", "Frame ..." , "F", 0, AWM_ALL, AW_POPUP, (AW_CL)AW_preset_window, 0 ); |
---|
1576 | awmm->insert_menu_topic( "props_options", "Options ..." , "O", "e4_options.hlp", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_level_1_options_window, 0 ); |
---|
1577 | awmm->insert_menu_topic( "props_consensus", "Consensus ..." , 0, "e4_consensus.hlp", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_consensus_definition_window, 0 ); |
---|
1578 | ____________________________SEP; |
---|
1579 | |
---|
1580 | awmm->insert_menu_topic( "props_data", "Colors ..." , "C", 0, AWM_ALL, AW_POPUP, (AW_CL)AW_create_gc_window, (AW_CL)aw_gc_manager ); |
---|
1581 | awmm->insert_menu_topic( "props_seq_colors", "Sequence Colors ..." , "S", "no help", AWM_ALL, AW_POPUP, (AW_CL)create_seq_colors_window, (AW_CL)ED4_ROOT->sequence_colors ); |
---|
1582 | awmm->insert_menu_topic( "change_cursor", "Change Cursor", "u", 0, AWM_ALL, ED4_change_cursor, 0, 0); |
---|
1583 | awmm->insert_menu_topic( "props_helix_sym", "Helix Symbols ...","H","helixsym.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_helix_props_window, (AW_CL)new AW_cb_struct(awmm,(AW_CB)ED4_refresh_window,0,0) ); |
---|
1584 | ____________________________SEP; |
---|
1585 | |
---|
1586 | awmm->insert_menu_topic( "props_key_map", "Key Mappings ...", "K","nekey_map.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_key_map_window, 0 ); |
---|
1587 | awmm->insert_menu_topic( "props_nds", "NDS ...", "N","e4_nds.hlp", AWM_ALL, AW_POPUP, (AW_CL)ED4_create_nds_window, 0 ); |
---|
1588 | ____________________________SEP; |
---|
1589 | |
---|
1590 | awmm->insert_menu_topic ( "save_props", "Save Defaults (in $home/.arb_prob/edit4)", "D","Save Def", AWM_ALL, (AW_CB) AW_save_defaults, 0, 0 ); |
---|
1591 | |
---|
1592 | // ---------------------------------------------------------------------------------------------------- |
---|
1593 | |
---|
1594 | #undef ____________________________SEP |
---|
1595 | |
---|
1596 | aw_root->awar_int(AWAR_EDIT_TITLE_MODE)->add_callback((AW_RCB1)title_mode_changed, (AW_CL)awmm); |
---|
1597 | awmm->set_bottom_area_height( 0 ); //No bottom area |
---|
1598 | |
---|
1599 | awmm->auto_space(5,-2); |
---|
1600 | awmm->shadow_width(3); |
---|
1601 | |
---|
1602 | int db_pathx,db_pathy; |
---|
1603 | awmm->get_at_position( &db_pathx,&db_pathy ); |
---|
1604 | awmm->callback( ED4_quit_editor, 0, 0); |
---|
1605 | awmm->button_length(0); |
---|
1606 | awmm->help_text("quit.hlp"); |
---|
1607 | |
---|
1608 | awmm->shadow_width(1); |
---|
1609 | awmm->load_xfig("edit4/editmenu.fig", AW_FALSE); |
---|
1610 | |
---|
1611 | awmm->at("quit"); |
---|
1612 | if (ED4_window::no_of_windows == 1) awmm->create_button("QUIT","Quit"); // this is the first window |
---|
1613 | else awmm->create_button("CLOSE","Close"); |
---|
1614 | |
---|
1615 | awmm->at("fold"); |
---|
1616 | awmm->create_toggle(AWAR_EDIT_TITLE_MODE, "edit/folded.bitmap", "edit/unfolded.bitmap"); |
---|
1617 | |
---|
1618 | int db_treex,db_treey; |
---|
1619 | awmm->get_at_position( &db_treex,&db_treey ); |
---|
1620 | awmm->button_length(200); |
---|
1621 | |
---|
1622 | awmm->at("pos"); |
---|
1623 | awmm->callback((AW_CB)ED4_jump_to_cursor_position, (AW_CL) ED4_ROOT->temp_ed4w->awar_path_for_cursor, AW_CL(1)); |
---|
1624 | awmm->create_input_field(ED4_ROOT->temp_ed4w->awar_path_for_cursor,5); |
---|
1625 | |
---|
1626 | awmm->at("ecoli"); |
---|
1627 | awmm->callback((AW_CB)ED4_jump_to_cursor_position,(AW_CL) ED4_ROOT->temp_ed4w->awar_path_for_Ecoli, AW_CL(0)); |
---|
1628 | awmm->create_input_field(ED4_ROOT->temp_ed4w->awar_path_for_Ecoli,5); |
---|
1629 | |
---|
1630 | awmm->at("base"); |
---|
1631 | awmm->callback((AW_CB)ED4_jump_to_cursor_position,(AW_CL) ED4_ROOT->temp_ed4w->awar_path_for_basePos, AW_CL(0)); |
---|
1632 | awmm->create_input_field(ED4_ROOT->temp_ed4w->awar_path_for_basePos,5); |
---|
1633 | |
---|
1634 | awmm->at("iupac"); |
---|
1635 | awmm->callback((AW_CB)ED4_set_iupac,(AW_CL) ED4_ROOT->temp_ed4w->awar_path_for_IUPAC, AW_CL(0)); |
---|
1636 | awmm->create_input_field(ED4_ROOT->temp_ed4w->awar_path_for_IUPAC,6); |
---|
1637 | |
---|
1638 | awmm->at("helixnr"); |
---|
1639 | awmm->callback((AW_CB)ED4_set_helixnr,(AW_CL) ED4_ROOT->temp_ed4w->awar_path_for_helixNr, AW_CL(0)); |
---|
1640 | awmm->create_input_field(ED4_ROOT->temp_ed4w->awar_path_for_helixNr,5); |
---|
1641 | |
---|
1642 | awmm->at("insert"); |
---|
1643 | awmm->create_toggle(AWAR_INSERT_MODE, "edit/replace.bitmap", "edit/insert.bitmap"); |
---|
1644 | |
---|
1645 | awmm->at("edit"); |
---|
1646 | awmm->create_toggle(AWAR_EDIT_MODE, "edit/align.bitmap", "edit/noalign.bitmap"); |
---|
1647 | |
---|
1648 | awmm->at("direct"); |
---|
1649 | awmm->create_toggle(AWAR_EDIT_DIRECTION,"edit/r2l.bitmap","edit/l2r.bitmap"); |
---|
1650 | |
---|
1651 | awmm->at("cons"); |
---|
1652 | awmm->create_toggle(ED4_AWAR_CONSENSUS_SHOW, "edit/nocons.bitmap", "edit/cons.bitmap"); |
---|
1653 | |
---|
1654 | awmm->at("num"); |
---|
1655 | awmm->create_toggle(ED4_AWAR_DIGITS_AS_REPEAT, "edit/norepeat.bitmap", "edit/repeat.bitmap"); |
---|
1656 | |
---|
1657 | awmm->at("key"); |
---|
1658 | awmm->create_toggle("key_mapping/enable", "edit/nokeymap.bitmap", "edit/keymap.bitmap"); |
---|
1659 | |
---|
1660 | awmm->button_length(0); |
---|
1661 | |
---|
1662 | awmm->at("secedit"); |
---|
1663 | awmm->callback((void(*)(AW_window*, AW_CL))ED4_SECEDIT_start, 0); |
---|
1664 | awmm->create_button("SECEDIT", "#edit/edit_sec.bitmap"); |
---|
1665 | |
---|
1666 | awmm->at("jump"); |
---|
1667 | awmm->callback(ED4_jump_to_current_species, 0); |
---|
1668 | awmm->create_button("JUMP", "Jump"); |
---|
1669 | awmm->at("get"); |
---|
1670 | awmm->callback(ED4_get_and_jump_to_actual, 0); |
---|
1671 | awmm->create_button("GET", "Get"); |
---|
1672 | |
---|
1673 | awmm->at("undo"); |
---|
1674 | awmm->callback(ED4_undo_redo, GB_UNDO_UNDO); |
---|
1675 | awmm->create_button("UNDO", "Undo"); |
---|
1676 | awmm->at("redo"); |
---|
1677 | awmm->callback(ED4_undo_redo, GB_UNDO_REDO); |
---|
1678 | awmm->create_button("REDO", "Redo"); |
---|
1679 | |
---|
1680 | awmm->at("help"); |
---|
1681 | awmm->callback(AW_POPUP_HELP,(AW_CL)"e4.hlp"); |
---|
1682 | awmm->create_button("HELP","Help"); |
---|
1683 | |
---|
1684 | awmm->at("protect"); |
---|
1685 | awmm->create_option_menu(AWAR_EDIT_SECURITY_LEVEL); |
---|
1686 | awmm->insert_option("0",0,0); |
---|
1687 | awmm->insert_option("1",0,1); |
---|
1688 | awmm->insert_option("2",0,2); |
---|
1689 | awmm->insert_option("3",0,3); |
---|
1690 | awmm->insert_option("4",0,4); |
---|
1691 | awmm->insert_option("5",0,5); |
---|
1692 | awmm->insert_default_option("6",0,6); |
---|
1693 | awmm->update_option_menu(); |
---|
1694 | |
---|
1695 | // search |
---|
1696 | |
---|
1697 | #define INSERT_SEARCH_FIELDS(Short, label_prefix, prefix) insert_search_fields(awmm, #label_prefix, #prefix, ED4_AWAR_##prefix##_SEARCH_PATTERN, ED4_##prefix##_PATTERN, ED4_AWAR_##prefix##_SEARCH_SHOW, Short) |
---|
1698 | |
---|
1699 | INSERT_SEARCH_FIELDS(0, u1, USER1); |
---|
1700 | INSERT_SEARCH_FIELDS(0, u2, USER2); |
---|
1701 | INSERT_SEARCH_FIELDS(0, pro, PROBE); |
---|
1702 | INSERT_SEARCH_FIELDS(1, pri1, PRIMER1); |
---|
1703 | INSERT_SEARCH_FIELDS(1, pri2, PRIMER2); |
---|
1704 | INSERT_SEARCH_FIELDS(1, pri3, PRIMER3); |
---|
1705 | INSERT_SEARCH_FIELDS(1, sig1, SIG1); |
---|
1706 | INSERT_SEARCH_FIELDS(1, sig2, SIG2); |
---|
1707 | INSERT_SEARCH_FIELDS(1, sig3, SIG3); |
---|
1708 | |
---|
1709 | #undef INSERT_SEARCH_FIELDS |
---|
1710 | |
---|
1711 | awmm->at("alast"); |
---|
1712 | awmm->callback(ED4_search, ED4_encodeSearchDescriptor(-1, ED4_ANY_PATTERN)); |
---|
1713 | awmm->create_button("ALL_SEARCH_LAST", "#edit/last.bitmap"); |
---|
1714 | |
---|
1715 | awmm->at("anext"); |
---|
1716 | awmm->callback(ED4_search, ED4_encodeSearchDescriptor(+1, ED4_ANY_PATTERN)); |
---|
1717 | awmm->create_button("ALL_SEARCH_NEXT", "#edit/next.bitmap"); |
---|
1718 | |
---|
1719 | awmm->at("zoom"); |
---|
1720 | awmm->callback(AW_POPUP, (AW_CL)ED4_zoom_message_window, (AW_CL)0); |
---|
1721 | awmm->create_button("ZOOM", "#edit/zoom.bitmap"); |
---|
1722 | |
---|
1723 | awmm->at("clear"); |
---|
1724 | awmm->callback(ED4_clear_errors, (AW_CL)0); |
---|
1725 | awmm->create_button("CLEAR", "#edit/clear.bitmap"); |
---|
1726 | |
---|
1727 | awmm->at("errortext"); |
---|
1728 | aw_root->awar_string(AWAR_ERROR_MESSAGES, "This is ARB Edit4 [Build " DATE "]"); |
---|
1729 | awmm->create_text_field(AWAR_ERROR_MESSAGES); |
---|
1730 | aw_set_local_message(); |
---|
1731 | |
---|
1732 | title_mode_changed(aw_root, awmm); |
---|
1733 | |
---|
1734 | // Buttons at left window border |
---|
1735 | |
---|
1736 | awmm->create_mode( 0, "edit/arrow.bitmap", "normal.hlp", ((AW_active)-1), (AW_CB)modes_cb, (AW_CL)0, (AW_CL)0); |
---|
1737 | awmm->create_mode( 0, "edit/kill.bitmap", "kill.hlp", ((AW_active)-1), (AW_CB)modes_cb, (AW_CL)1, (AW_CL)0); |
---|
1738 | awmm->create_mode( 0, "edit/mark.bitmap", "mark.hlp", ((AW_active)-1), (AW_CB)modes_cb, (AW_CL)2, (AW_CL)0); |
---|
1739 | |
---|
1740 | AWTC_create_faligner_variables(awmm->get_root(), ED4_ROOT->db); |
---|
1741 | |
---|
1742 | return ( ED4_R_OK ); |
---|
1743 | } |
---|
1744 | |
---|
1745 | |
---|
1746 | AW_window *ED4_root::create_new_window( void ) // only the first time, other cases: generate_window |
---|
1747 | { |
---|
1748 | AW_device *device = NULL; |
---|
1749 | ED4_window *new_window = NULL; |
---|
1750 | |
---|
1751 | generate_window( &device, &new_window ); |
---|
1752 | ED4_calc_terminal_extenstions(); |
---|
1753 | |
---|
1754 | last_window_reached = 1; |
---|
1755 | MARGIN = 5; |
---|
1756 | DRAW = 1; |
---|
1757 | move_cursor = 0; |
---|
1758 | all_found = 0; |
---|
1759 | species_read = 0; |
---|
1760 | max_seq_terminal_length = 0; |
---|
1761 | not_found_message = GBS_stropen(1000); |
---|
1762 | GBS_strcat(not_found_message,"Some species not found:\n"); |
---|
1763 | |
---|
1764 | return ( new_window->aww ); |
---|
1765 | } |
---|
1766 | |
---|
1767 | |
---|
1768 | ED4_root::ED4_root() |
---|
1769 | { |
---|
1770 | memset((char *)this,0,sizeof(*this)); |
---|
1771 | aw_root = new AW_root; |
---|
1772 | first_window = NULL; |
---|
1773 | main_manager = NULL; |
---|
1774 | database = NULL; |
---|
1775 | temp_ed4w = NULL; |
---|
1776 | temp_aww = NULL; |
---|
1777 | temp_device = NULL; |
---|
1778 | temp_gc = 0; |
---|
1779 | scroll_links.link_for_hor_slider= NULL; |
---|
1780 | scroll_links.link_for_ver_slider= NULL; |
---|
1781 | folding_action = 0; |
---|
1782 | // ref_terminals.ref_sequence_info = NULL; |
---|
1783 | // ref_terminals.ref_sequence = NULL; |
---|
1784 | species_mode = ED4_SM_MOVE; |
---|
1785 | scroll_picture.scroll = 0; |
---|
1786 | scroll_picture.old_x = 0; |
---|
1787 | scroll_picture.old_y = 0; |
---|
1788 | middle_area_man = NULL; |
---|
1789 | top_area_man = NULL; |
---|
1790 | root_group_man = NULL; |
---|
1791 | ecoli_ref = NULL; |
---|
1792 | column_stat_activated = 0; |
---|
1793 | column_stat_initialized = 0; |
---|
1794 | |
---|
1795 | aw_initstatus(); |
---|
1796 | } |
---|
1797 | |
---|
1798 | |
---|
1799 | ED4_root::~ED4_root() |
---|
1800 | { |
---|
1801 | delete aw_root; |
---|
1802 | delete first_window; |
---|
1803 | delete main_manager; |
---|
1804 | delete middle_area_man; |
---|
1805 | delete top_area_man; |
---|
1806 | delete database; |
---|
1807 | delete ecoli_ref; |
---|
1808 | } |
---|
1809 | |
---|
1810 | //*********************************** |
---|
1811 | //* ED4_root Methods end * |
---|
1812 | //*********************************** |
---|