1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : ED4_root.cxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #include "ed4_class.hxx" |
---|
12 | #include "ed4_awars.hxx" |
---|
13 | #include "ed4_tools.hxx" |
---|
14 | #include "ed4_block.hxx" |
---|
15 | #include "ed4_dots.hxx" |
---|
16 | #include "ed4_nds.hxx" |
---|
17 | #include "ed4_list.hxx" |
---|
18 | #include "ed4_plugins.hxx" |
---|
19 | #include "ed4_visualizeSAI.hxx" |
---|
20 | #include "ed4_naligner.hxx" |
---|
21 | #include "ed4_ProteinViewer.hxx" |
---|
22 | #include "ed4_protein_2nd_structure.hxx" |
---|
23 | #include "graph_aligner_gui.hxx" |
---|
24 | #include "ed4_colStat.hxx" |
---|
25 | #include "ed4_seq_colors.hxx" |
---|
26 | #include "ed4_flags.hxx" |
---|
27 | |
---|
28 | #include <ed4_extern.hxx> |
---|
29 | #include <fast_aligner.hxx> |
---|
30 | |
---|
31 | #include <AW_helix.hxx> |
---|
32 | #include <gde.hxx> |
---|
33 | #include <awt.hxx> |
---|
34 | #include <awt_map_key.hxx> |
---|
35 | |
---|
36 | #include <aw_awars.hxx> |
---|
37 | #include <aw_preset.hxx> |
---|
38 | #include <aw_msg.hxx> |
---|
39 | #include <arb_progress.h> |
---|
40 | #include <aw_root.hxx> |
---|
41 | #include <aw_question.hxx> |
---|
42 | #include <aw_advice.hxx> |
---|
43 | #include <rootAsWin.h> |
---|
44 | #include "../WINDOW/aw_status.hxx" // @@@ hack - obsolete when EDIT4 status works like elsewhere |
---|
45 | |
---|
46 | #include <arb_version.h> |
---|
47 | #include <arb_file.h> |
---|
48 | #include <arb_defs.h> |
---|
49 | |
---|
50 | #include <arbdbt.h> |
---|
51 | #include <ad_cb.h> |
---|
52 | #include <macros.hxx> |
---|
53 | #include <st_window.hxx> |
---|
54 | |
---|
55 | #include <cctype> |
---|
56 | #include <map> |
---|
57 | |
---|
58 | ED4_WinContext ED4_WinContext::current_context; |
---|
59 | |
---|
60 | void ED4_folding_line::warn_illegal_dimension() { |
---|
61 | #if defined(DEBUG) |
---|
62 | if (dimension<0.0) { |
---|
63 | // e4_assert(0); // crashes gdb when called from scrollbar callback - so instead only dump backtrace |
---|
64 | const char *msg = GBS_global_string("illegal dimension %f\n", dimension); |
---|
65 | GBK_dump_backtrace(stderr, msg); |
---|
66 | } |
---|
67 | #endif |
---|
68 | } |
---|
69 | |
---|
70 | void ED4_WinContext::warn_missing_context() const { |
---|
71 | e4_assert(0); |
---|
72 | GBK_dump_backtrace(stderr, "Missing context"); |
---|
73 | aw_message("Missing context - please send information from console to devel@arb-home.de"); |
---|
74 | } |
---|
75 | |
---|
76 | static ARB_ERROR request_terminal_refresh(ED4_base *base, ED4_level lev) { |
---|
77 | if (lev == LEV_NONE || (base->spec.level&lev) != 0) { |
---|
78 | if (base->is_terminal()) base->request_refresh(); |
---|
79 | } |
---|
80 | return NULp; |
---|
81 | } |
---|
82 | |
---|
83 | void ED4_root::request_refresh_for_all_terminals() { |
---|
84 | main_manager->route_down_hierarchy(makeED4_route_cb(request_terminal_refresh, LEV_NONE)).expect_no_error(); |
---|
85 | } |
---|
86 | |
---|
87 | void ED4_root::request_refresh_for_specific_terminals(ED4_level lev) { |
---|
88 | main_manager->route_down_hierarchy(makeED4_route_cb(request_terminal_refresh, lev)).expect_no_error(); |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | static ARB_ERROR request_sequence_refresh(ED4_base *base, bool consensi) { |
---|
93 | ARB_ERROR error; |
---|
94 | if (base->spec.level & LEV_SPECIES) { |
---|
95 | if (base->is_consensus_manager() == consensi) { |
---|
96 | error = base->to_manager()->route_down_hierarchy(makeED4_route_cb(request_terminal_refresh, LEV_SEQUENCE_STRING)); |
---|
97 | } |
---|
98 | } |
---|
99 | return error; |
---|
100 | } |
---|
101 | |
---|
102 | // if you want to refresh consensi AND sequences you may use request_refresh_for_specific_terminals(LEV_SEQUENCE_STRING) |
---|
103 | void ED4_root::request_refresh_for_consensus_terminals() { |
---|
104 | main_manager->route_down_hierarchy(makeED4_route_cb(request_sequence_refresh, true)).expect_no_error(); |
---|
105 | } |
---|
106 | void ED4_root::request_refresh_for_sequence_terminals() { |
---|
107 | if (main_manager) { |
---|
108 | main_manager->route_down_hierarchy(makeED4_route_cb(request_sequence_refresh, false)).expect_no_error(); |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | void ED4_root::refresh_window_simple(bool redraw) { |
---|
113 | // if 'redraw' -> update everything (ignoring refresh flag) |
---|
114 | bool refresh_all = false; |
---|
115 | if (redraw) { |
---|
116 | #if defined(TRACE_REFRESH) |
---|
117 | fprintf(stderr, "- clear display (refresh_window_simple(redraw=true) called)\n"); fflush(stderr); |
---|
118 | #endif |
---|
119 | main_manager->update_info.set_clear_at_refresh(1); |
---|
120 | refresh_all = true; |
---|
121 | } |
---|
122 | |
---|
123 | main_manager->Show(refresh_all, false); |
---|
124 | if (redraw) main_manager->update_info.set_clear_at_refresh(0); |
---|
125 | } |
---|
126 | |
---|
127 | void ED4_root::handle_update_requests(bool& redraw) { |
---|
128 | if (main_manager->update_info.delete_requested) { |
---|
129 | #if defined(TRACE_REFRESH) |
---|
130 | fprintf(stderr, "- handling requested deletes\n"); fflush(stderr); |
---|
131 | #endif |
---|
132 | main_manager->delete_requested_children(); |
---|
133 | redraw = true; |
---|
134 | } |
---|
135 | |
---|
136 | if (main_manager->update_info.update_requested) { |
---|
137 | #if defined(TRACE_REFRESH) |
---|
138 | fprintf(stderr, "- handling requested updates\n"); fflush(stderr); |
---|
139 | #endif |
---|
140 | main_manager->update_requested_children(); |
---|
141 | redraw = true; // @@@ needed ? |
---|
142 | } |
---|
143 | |
---|
144 | while (main_manager->update_info.resize) { |
---|
145 | #if defined(TRACE_REFRESH) |
---|
146 | fprintf(stderr, "- handling requested resizes\n"); fflush(stderr); |
---|
147 | #endif |
---|
148 | main_manager->resize_requested_children(); |
---|
149 | redraw = true; |
---|
150 | } |
---|
151 | |
---|
152 | // make sure all update request have been handled: |
---|
153 | e4_assert(!main_manager->update_info.delete_requested); |
---|
154 | e4_assert(!main_manager->update_info.update_requested); |
---|
155 | e4_assert(!main_manager->update_info.resize); |
---|
156 | } |
---|
157 | |
---|
158 | void ED4_root::special_window_refresh(bool handle_updates) { |
---|
159 | // this function should only be used for window specific updates (e.g. cursor placement/deletion) |
---|
160 | e4_assert(ED4_WinContext::have_context()); |
---|
161 | |
---|
162 | bool redraw = true; |
---|
163 | if (handle_updates) handle_update_requests(redraw); |
---|
164 | refresh_window_simple(redraw); |
---|
165 | // do NOT clear_refresh_requests here!! this is no full refresh! |
---|
166 | } |
---|
167 | |
---|
168 | ED4_returncode ED4_root::refresh_all_windows(bool redraw) { |
---|
169 | // if 'redraw' -> update everything (ignoring refresh flag) |
---|
170 | GB_transaction ta(gb_main); |
---|
171 | |
---|
172 | handle_update_requests(redraw); |
---|
173 | |
---|
174 | ED4_window *window = first_window; |
---|
175 | while (window) { |
---|
176 | ED4_LocalWinContext uses(window); |
---|
177 | refresh_window_simple(redraw); |
---|
178 | window = window->next; |
---|
179 | } |
---|
180 | |
---|
181 | if (main_manager->update_info.refresh) main_manager->clear_refresh(); |
---|
182 | |
---|
183 | if (loadable_SAIs == LSAI_OUTDATED) { |
---|
184 | GB_touch(GBT_get_SAI_data(gb_main)); // touch SAI data to force update of SAI selection list |
---|
185 | loadable_SAIs = LSAI_UPTODATE; |
---|
186 | } |
---|
187 | |
---|
188 | return ED4_R_OK; |
---|
189 | } |
---|
190 | |
---|
191 | // -------------------------------------------------------------------------------- |
---|
192 | |
---|
193 | #ifdef UNIT_TESTS |
---|
194 | #ifndef TEST_UNIT_H |
---|
195 | #include <test_unit.h> |
---|
196 | #endif |
---|
197 | |
---|
198 | static arb_test::match_expectation correct_win2world_calculation(ED4_foldable& foldable, int xwin_org, int ywin_org, int xwrld_expd, int ywrld_expd) { |
---|
199 | using namespace arb_test; |
---|
200 | match_expectation precondition(all().of(that(xwrld_expd).is_more_or_equal(xwin_org), |
---|
201 | that(ywrld_expd).is_more_or_equal(ywin_org))); |
---|
202 | |
---|
203 | AW_pos xwrld_calc = xwin_org; |
---|
204 | AW_pos ywrld_calc = ywin_org; |
---|
205 | foldable.win_to_world_coords(&xwrld_calc, &ywrld_calc); |
---|
206 | |
---|
207 | match_expectation win_2_world_conversion(all().of(that(xwrld_calc).is_equal_to(xwrld_expd), |
---|
208 | that(ywrld_calc).is_equal_to(ywrld_expd))); |
---|
209 | |
---|
210 | AW_pos xwin_back = xwrld_calc; |
---|
211 | AW_pos ywin_back = ywrld_calc; |
---|
212 | foldable.world_to_win_coords(&xwin_back, &ywin_back); |
---|
213 | |
---|
214 | match_expectation world_back2_win_conversion(all().of(that(xwin_back).is_equal_to(xwin_org), |
---|
215 | that(ywin_back).is_equal_to(ywin_org))); |
---|
216 | |
---|
217 | return all().of(precondition, win_2_world_conversion, world_back2_win_conversion); |
---|
218 | } |
---|
219 | |
---|
220 | static arb_test::match_expectation correct_world2win_calculation(ED4_foldable& foldable, int xwrld_org, int ywrld_org, int xwin_expd, int ywin_expd) { |
---|
221 | using namespace arb_test; |
---|
222 | match_expectation precondition(all().of(that(xwrld_org).is_more_or_equal(xwin_expd), |
---|
223 | that(ywrld_org).is_more_or_equal(ywin_expd))); |
---|
224 | |
---|
225 | |
---|
226 | AW_pos xwin_calc = xwrld_org; |
---|
227 | AW_pos ywin_calc = ywrld_org; |
---|
228 | foldable.world_to_win_coords(&xwin_calc, &ywin_calc); |
---|
229 | |
---|
230 | match_expectation world_2_win_conversion(all().of(that(xwin_calc).is_equal_to(xwin_expd), |
---|
231 | that(ywin_calc).is_equal_to(ywin_expd))); |
---|
232 | |
---|
233 | return all().of(precondition, world_2_win_conversion); |
---|
234 | } |
---|
235 | |
---|
236 | #define TEST_EXPECT_WIN_UNFOLDED(xwi,ywi) TEST_EXPECTATION(correct_win2world_calculation(foldable, xwi, ywi, xwi, ywi)) |
---|
237 | #define TEST_EXPECT_WIN_WORLD_FOLDING(xwi,ywi,fx,fy) TEST_EXPECTATION(correct_win2world_calculation(foldable, xwi, ywi, (xwi)+(fx), (ywi)+(fy))) |
---|
238 | #define TEST_EXPECT_WORLD_WIN_FOLDING(xwo,ywo,xwi,ywi) TEST_EXPECTATION(correct_world2win_calculation(foldable, xwo, ywo, xwi, ywi)) |
---|
239 | |
---|
240 | #define TEST_EXPECT_WIN_WORLD_FOLDING__BROKEN(xwi,ywi,fx,fy) TEST_EXPECTATION__BROKEN(correct_win2world_calculation(foldable, xwi, ywi, (xwi)+(fx), (ywi)+(fy))) |
---|
241 | #define TEST_EXPECT_WIN_WORLD_FOLDING__BROKENIF(when,xwi,ywi,fx,fy) TEST_EXPECTATION__BROKENIF(when, correct_win2world_calculation(foldable, xwi, ywi, (xwi)+(fx), (ywi)+(fy))) |
---|
242 | |
---|
243 | void TEST_win_2_world() { |
---|
244 | ED4_foldable foldable; |
---|
245 | |
---|
246 | const int X1 = 200; |
---|
247 | const int X2 = 300; |
---|
248 | const int Y1 = 100; |
---|
249 | const int Y2 = 200; |
---|
250 | |
---|
251 | ED4_folding_line *hor100 = foldable.insert_folding_line(Y1, 0, PROP_HORIZONTAL); |
---|
252 | ED4_folding_line *ver200 = foldable.insert_folding_line(X1, 0, PROP_VERTICAL); |
---|
253 | ED4_folding_line *hor200 = foldable.insert_folding_line(Y2, 0, PROP_HORIZONTAL); |
---|
254 | ED4_folding_line *ver300 = foldable.insert_folding_line(X2, 0, PROP_VERTICAL); |
---|
255 | |
---|
256 | // nothing folded yet |
---|
257 | |
---|
258 | const int x01 = X1/2; |
---|
259 | const int x12 = (X1+X2)/2; |
---|
260 | const int x23 = X2+x01; |
---|
261 | |
---|
262 | const int y01 = Y1/2; |
---|
263 | const int y12 = (Y1+Y2)/2; |
---|
264 | const int y23 = Y2+y01; |
---|
265 | |
---|
266 | TEST_EXPECT_WIN_UNFOLDED(x01, y01); |
---|
267 | TEST_EXPECT_WIN_UNFOLDED(x12, y01); |
---|
268 | TEST_EXPECT_WIN_UNFOLDED(x23, y01); |
---|
269 | |
---|
270 | TEST_EXPECT_WIN_UNFOLDED(x01, y12); |
---|
271 | TEST_EXPECT_WIN_UNFOLDED(x12, y12); |
---|
272 | TEST_EXPECT_WIN_UNFOLDED(x23, y12); |
---|
273 | |
---|
274 | TEST_EXPECT_WIN_UNFOLDED(x01, y23); |
---|
275 | TEST_EXPECT_WIN_UNFOLDED(x12, y23); |
---|
276 | TEST_EXPECT_WIN_UNFOLDED(x23, y23); |
---|
277 | |
---|
278 | for (int FACTOR = 1; FACTOR <= 100; FACTOR += 7) { |
---|
279 | TEST_ANNOTATE(GBS_global_string("FACTOR=%i", FACTOR)); |
---|
280 | int H1 = FACTOR* 10; |
---|
281 | int H2 = FACTOR* 40; |
---|
282 | int V1 = FACTOR* 20; |
---|
283 | int V2 = FACTOR* 80; |
---|
284 | |
---|
285 | hor100->set_dimension(H1); |
---|
286 | hor200->set_dimension(H2); |
---|
287 | ver200->set_dimension(V1); |
---|
288 | ver300->set_dimension(V2); |
---|
289 | |
---|
290 | TEST_EXPECT_WIN_UNFOLDED (x01, y01); // always in unfolded range |
---|
291 | TEST_EXPECT_WIN_WORLD_FOLDING(x12, y01, V1, 0); |
---|
292 | TEST_EXPECT_WIN_WORLD_FOLDING(x23, y01, V1+V2, 0); |
---|
293 | |
---|
294 | TEST_EXPECT_WIN_WORLD_FOLDING(x01, y12, 0, H1); |
---|
295 | TEST_EXPECT_WIN_WORLD_FOLDING(x12, y12, V1, H1); |
---|
296 | TEST_EXPECT_WIN_WORLD_FOLDING(x23, y12, V1+V2, H1); |
---|
297 | |
---|
298 | TEST_EXPECT_WIN_WORLD_FOLDING(x01, y23, 0, H1+H2); |
---|
299 | TEST_EXPECT_WIN_WORLD_FOLDING(x12, y23, V1, H1+H2); |
---|
300 | TEST_EXPECT_WIN_WORLD_FOLDING(x23, y23, V1+V2, H1+H2); |
---|
301 | |
---|
302 | // test "folded" world positions. |
---|
303 | // they result in win positions lower than folding line! |
---|
304 | TEST_EXPECT_WORLD_WIN_FOLDING(X1-1, Y1-1, X1-1, Y1-1); // left of/above folded range |
---|
305 | TEST_EXPECT_WORLD_WIN_FOLDING(X1, Y1, X1-V1, Y1-H1); // left/upper end of folded range |
---|
306 | TEST_EXPECT_WORLD_WIN_FOLDING(X1+5, Y1+5, X1+5-V1, Y1+5-H1); // in folded range |
---|
307 | TEST_EXPECT_WORLD_WIN_FOLDING(X1+V1, Y1+H1, X1, Y1); // right/lower end of folded range |
---|
308 | TEST_EXPECT_WORLD_WIN_FOLDING(X1+V1+1, Y1+H1+1, X1+1, Y1+1); // right of/below folded range |
---|
309 | } |
---|
310 | } |
---|
311 | |
---|
312 | #endif // UNIT_TESTS |
---|
313 | |
---|
314 | // -------------------------------------------------------------------------------- |
---|
315 | |
---|
316 | ED4_returncode ED4_root::deselect_all() { |
---|
317 | ED4_multi_species_manager *main_multi_man = middle_area_man->get_multi_species_manager(); |
---|
318 | main_multi_man->deselect_all_species_and_SAI(); |
---|
319 | |
---|
320 | main_multi_man = top_area_man->get_multi_species_manager(); |
---|
321 | main_multi_man->deselect_all_species_and_SAI(); |
---|
322 | |
---|
323 | ED4_setBlocktype(ED4_BT_NOBLOCK); |
---|
324 | |
---|
325 | return ED4_R_OK; |
---|
326 | } |
---|
327 | |
---|
328 | void ED4_root::remove_from_selected(ED4_species_name_terminal *name_term) { // @@@ change param to ED4_species_manager ? |
---|
329 | if (name_term) { |
---|
330 | if ((selected_objects->has_elem(name_term->selection_info))) { |
---|
331 | selected_objects->remove_elem(name_term->selection_info); |
---|
332 | |
---|
333 | delete name_term->selection_info; |
---|
334 | name_term->selection_info = NULp; |
---|
335 | name_term->containing_species_manager()->set_selected(false); |
---|
336 | name_term->dragged = false; // @@@ caller shall do this |
---|
337 | |
---|
338 | #ifdef DEBUG |
---|
339 | GBDATA *gbd = name_term->get_species_pointer(); |
---|
340 | |
---|
341 | if (gbd) { |
---|
342 | GB_transaction ta(gbd); |
---|
343 | printf("removed term '%s'\n", GB_read_char_pntr(gbd)); |
---|
344 | } |
---|
345 | else { |
---|
346 | ED4_species_manager *spec_man = name_term->get_parent(LEV_SPECIES)->to_species_manager(); |
---|
347 | |
---|
348 | if (spec_man->is_consensus_manager()) { |
---|
349 | printf("removed consensus '%s'\n", name_term->id); |
---|
350 | } |
---|
351 | else { |
---|
352 | printf("removed unknown term '%s'\n", name_term->id ? name_term->id : "NULp"); |
---|
353 | } |
---|
354 | } |
---|
355 | #endif |
---|
356 | |
---|
357 | name_term->request_refresh(); |
---|
358 | ED4_sequence_terminal *seq_term = name_term->corresponding_sequence_terminal(); |
---|
359 | if (seq_term) seq_term->request_refresh(); |
---|
360 | |
---|
361 | // ProtView: Refresh corresponding orf terminals |
---|
362 | if (alignment_type == GB_AT_DNA) { |
---|
363 | PV_CallBackFunction(this->aw_root); |
---|
364 | } |
---|
365 | |
---|
366 | ED4_multi_species_manager *multi_man = name_term->get_parent(LEV_MULTI_SPECIES)->to_multi_species_manager(); |
---|
367 | multi_man->invalidate_species_counters(); |
---|
368 | } |
---|
369 | } |
---|
370 | } |
---|
371 | |
---|
372 | void ED4_root::announce_useraction_in(AW_window *aww) { |
---|
373 | for (ED4_window *win = first_window; win; win = win->next) { |
---|
374 | if (win->aww == aww) { |
---|
375 | most_recently_used_window = win; |
---|
376 | } |
---|
377 | } |
---|
378 | } |
---|
379 | |
---|
380 | ED4_returncode ED4_root::add_to_selected(ED4_species_name_terminal *name_term) { // @@@ change param to ED4_species_manager ? |
---|
381 | if (!name_term || !name_term->has_property(PROP_SELECTABLE)) { // check if object exists and may be selected |
---|
382 | return ED4_R_IMPOSSIBLE; |
---|
383 | } |
---|
384 | |
---|
385 | if (!(selected_objects->has_elem(name_term->selection_info))) { // object is really new to our list => calculate current extension and append it |
---|
386 | ED4_selection_entry *sel_info = new ED4_selection_entry; |
---|
387 | name_term->selection_info = sel_info; |
---|
388 | |
---|
389 | if (name_term->has_property(PROP_IS_HANDLE)) { // object is a handle for an object up in the hierarchy => search it |
---|
390 | ED4_level mlevel = name_term->spec.handled_level; |
---|
391 | ED4_base *tmp_object = name_term; |
---|
392 | |
---|
393 | while (tmp_object && !(tmp_object->spec.level & mlevel)) { |
---|
394 | tmp_object = tmp_object->parent; |
---|
395 | } |
---|
396 | |
---|
397 | if (!tmp_object) return ED4_R_WARNING; // no target level found |
---|
398 | |
---|
399 | sel_info->actual_width = tmp_object->extension.size[WIDTH]; |
---|
400 | sel_info->actual_height = tmp_object->extension.size[HEIGHT]; |
---|
401 | } |
---|
402 | else { // selected object is no handle => take it directly |
---|
403 | sel_info->actual_width = name_term->extension.size[WIDTH]; |
---|
404 | sel_info->actual_height = name_term->extension.size[HEIGHT]; |
---|
405 | } |
---|
406 | |
---|
407 | sel_info->drag_old_x = 0; |
---|
408 | sel_info->drag_old_y = 0; |
---|
409 | sel_info->drag_off_x = 0; |
---|
410 | sel_info->drag_off_y = 0; |
---|
411 | sel_info->old_event_y = 0; |
---|
412 | |
---|
413 | sel_info->object = name_term; |
---|
414 | |
---|
415 | selected_objects->prepend_elem(sel_info); |
---|
416 | |
---|
417 | name_term->containing_species_manager()->set_selected(true); |
---|
418 | |
---|
419 | #ifdef DEBUG |
---|
420 | GBDATA *gbd = name_term->get_species_pointer(); |
---|
421 | |
---|
422 | if (gbd) { |
---|
423 | printf("added term '%s'\n", GB_read_char_pntr(gbd)); |
---|
424 | } |
---|
425 | else { |
---|
426 | ED4_species_manager *spec_man = name_term->get_parent(LEV_SPECIES)->to_species_manager(); |
---|
427 | if (spec_man->is_consensus_manager()) { |
---|
428 | printf("added consensus '%s'\n", name_term->id); |
---|
429 | } |
---|
430 | else { |
---|
431 | printf("added unknown term '%s'\n", name_term->id ? name_term->id : "NULp"); |
---|
432 | } |
---|
433 | } |
---|
434 | #endif |
---|
435 | |
---|
436 | name_term->request_refresh(); |
---|
437 | ED4_sequence_terminal *seq_term = name_term->corresponding_sequence_terminal(); |
---|
438 | if (seq_term) seq_term->request_refresh(); |
---|
439 | |
---|
440 | // ProtView: Refresh corresponding orf terminals |
---|
441 | if (alignment_type == GB_AT_DNA) { |
---|
442 | PV_CallBackFunction(this->aw_root); |
---|
443 | } |
---|
444 | |
---|
445 | ED4_multi_species_manager *multi_man = name_term->get_parent(LEV_MULTI_SPECIES)->to_multi_species_manager(); |
---|
446 | multi_man->invalidate_species_counters(); |
---|
447 | |
---|
448 | return ED4_R_OK; |
---|
449 | } |
---|
450 | |
---|
451 | return ED4_R_IMPOSSIBLE; |
---|
452 | } |
---|
453 | |
---|
454 | void ED4_root::resize_all_requesting_childs() { |
---|
455 | while (main_manager->update_info.resize) { |
---|
456 | main_manager->resize_requested_children(); |
---|
457 | } |
---|
458 | } |
---|
459 | |
---|
460 | static ARB_ERROR change_char_table_length(ED4_base *base, int new_length) { |
---|
461 | if (base->is_abstract_group_manager()) { |
---|
462 | ED4_abstract_group_manager *group_man = base->to_abstract_group_manager(); |
---|
463 | group_man->table().change_table_length(new_length); |
---|
464 | } |
---|
465 | return NULp; |
---|
466 | } |
---|
467 | |
---|
468 | void ED4_alignment_length_changed(GBDATA *gb_alignment_len, GB_CB_TYPE IF_ASSERTION_USED(gbtype)) { // callback from database |
---|
469 | e4_assert(gbtype==GB_CB_CHANGED); |
---|
470 | int new_length = GB_read_int(gb_alignment_len); |
---|
471 | |
---|
472 | #if defined(DEBUG) && 1 |
---|
473 | printf("alignment_length_changed from %i to %i\n", MAXSEQUENCECHARACTERLENGTH, new_length); |
---|
474 | #endif |
---|
475 | |
---|
476 | if (MAXSEQUENCECHARACTERLENGTH!=new_length) { // otherwise we already did this (i.e. we were called by changed_by_database) |
---|
477 | bool was_increased = new_length>MAXSEQUENCECHARACTERLENGTH; |
---|
478 | |
---|
479 | MAXSEQUENCECHARACTERLENGTH = new_length; |
---|
480 | |
---|
481 | GBDATA *gb_main = ED4_ROOT->get_gb_main(); |
---|
482 | { |
---|
483 | const char *err = ED4_ROOT->helix->init(gb_main); // reload helix |
---|
484 | aw_message_if(err); |
---|
485 | } |
---|
486 | { |
---|
487 | const char *err = ED4_ROOT->ecoli_ref->init(gb_main); // reload ecoli |
---|
488 | aw_message_if(err); |
---|
489 | } |
---|
490 | |
---|
491 | if (ED4_ROOT->alignment_type == GB_AT_AA) { |
---|
492 | // TODO: is this needed here? |
---|
493 | const char *err = ED4_pfold_set_SAI(&ED4_ROOT->protstruct, gb_main, ED4_ROOT->alignment_name, &ED4_ROOT->protstruct_len); // reload protstruct |
---|
494 | aw_message_if(err); |
---|
495 | } |
---|
496 | |
---|
497 | if (was_increased) { |
---|
498 | ED4_ROOT->main_manager->route_down_hierarchy(makeED4_route_cb(change_char_table_length, new_length)).expect_no_error(); |
---|
499 | ED4_ROOT->root_group_man->remap()->mark_compile_needed_force(); |
---|
500 | } |
---|
501 | } |
---|
502 | } |
---|
503 | |
---|
504 | ARB_ERROR ED4_root::init_alignment() { |
---|
505 | GB_transaction ta(gb_main); |
---|
506 | |
---|
507 | alignment_name = GBT_get_default_alignment(gb_main); |
---|
508 | alignment_type = GBT_get_alignment_type(gb_main, alignment_name); |
---|
509 | if (alignment_type==GB_AT_UNKNOWN) { |
---|
510 | return GBS_global_string("You have to select a valid alignment before you can start ARB_EDIT4\n(%s)", GB_await_error()); |
---|
511 | } |
---|
512 | |
---|
513 | GBDATA *gb_alignment = GBT_get_alignment(gb_main, alignment_name); |
---|
514 | if (!gb_alignment) { |
---|
515 | return GBS_global_string("You can't edit without an existing alignment\n(%s)", GB_await_error()); |
---|
516 | } |
---|
517 | |
---|
518 | GBDATA *gb_alignment_len = GB_search(gb_alignment, "alignment_len", GB_FIND); |
---|
519 | int alignment_length = GB_read_int(gb_alignment_len); |
---|
520 | MAXSEQUENCECHARACTERLENGTH = alignment_length; |
---|
521 | |
---|
522 | GB_add_callback(gb_alignment_len, GB_CB_CHANGED, makeDatabaseCallback(ED4_alignment_length_changed)); |
---|
523 | |
---|
524 | aw_root->awar_string(AWAR_EDITOR_ALIGNMENT, alignment_name); |
---|
525 | |
---|
526 | return NULp; |
---|
527 | } |
---|
528 | |
---|
529 | void ED4_root::recalc_font_group() { |
---|
530 | int font_GC[] = { |
---|
531 | ED4_G_SEQUENCES, |
---|
532 | ED4_G_STANDARD, |
---|
533 | ED4_G_FLAG_INFO, |
---|
534 | }; |
---|
535 | |
---|
536 | font_group.unregisterAll(); |
---|
537 | for (unsigned i = 0; i<ARRAY_ELEMS(font_GC); ++i) { |
---|
538 | ED4_MostRecentWinContext context; |
---|
539 | font_group.registerFont(current_device(), font_GC[i]); |
---|
540 | } |
---|
541 | } |
---|
542 | |
---|
543 | static ARB_ERROR force_group_update(ED4_base *base) { |
---|
544 | if (base->is_multi_species_manager()) { |
---|
545 | base->to_multi_species_manager()->update_requested_by_child(); |
---|
546 | } |
---|
547 | return NULp; |
---|
548 | } |
---|
549 | |
---|
550 | ED4_returncode ED4_root::create_hierarchy(const char *area_string_middle, const char *area_string_top) { |
---|
551 | // creates internal hierarchy of editor |
---|
552 | |
---|
553 | long total_no_of_groups = 0; |
---|
554 | long total_no_of_species = 0; |
---|
555 | { |
---|
556 | // count species and related info (e.g. helix) displayed in the top region (a == 0) |
---|
557 | // count no of species and sais including groups in middle region (a == 1) |
---|
558 | |
---|
559 | const char *area_string[2] = { area_string_top, area_string_middle }; |
---|
560 | for (int a = 0; a<2; ++a) { |
---|
561 | long group_count; |
---|
562 | long species_count; |
---|
563 | |
---|
564 | EDB_root_bact::calc_no_of_all(area_string[a], &group_count, &species_count); |
---|
565 | |
---|
566 | total_no_of_groups += group_count; |
---|
567 | total_no_of_species += species_count; |
---|
568 | } |
---|
569 | } |
---|
570 | |
---|
571 | SmartPtr<arb_progress> startup_progress = new arb_progress("EDIT4 startup"); |
---|
572 | |
---|
573 | GB_push_transaction(gb_main); |
---|
574 | |
---|
575 | ecoli_ref = new BI_ecoli_ref; |
---|
576 | ecoli_ref->init(gb_main); |
---|
577 | |
---|
578 | // [former position of ali-init-code] |
---|
579 | |
---|
580 | main_manager = new ED4_main_manager("Main_Manager", 0, 0, NULp); // build a test hierarchy |
---|
581 | root_group_man = new ED4_root_group_manager("Root_Group_Manager", 0, 0, main_manager); |
---|
582 | |
---|
583 | main_manager->append_member(root_group_man); |
---|
584 | |
---|
585 | ED4_device_manager *device_manager = new ED4_device_manager("Device_Manager", 0, 0, root_group_man); |
---|
586 | root_group_man->append_member(device_manager); |
---|
587 | |
---|
588 | { |
---|
589 | int col_stat_term_height = 50; // @@@ Hoehe des ColumnStatistics Terminals ausrechnen |
---|
590 | |
---|
591 | ref_terminals.init( |
---|
592 | new ED4_sequence_info_terminal("Reference_Sequence_Info_Terminal", MAXINFO_WIDTH, TERMINAL_HEIGHT, NULp), |
---|
593 | new ED4_sequence_terminal ("Reference_Sequence_Terminal", 300, TERMINAL_HEIGHT, NULp, false), |
---|
594 | new ED4_sequence_info_terminal("Reference_ColumnStatistics_Info_Terminal", MAXINFO_WIDTH, col_stat_term_height, NULp), |
---|
595 | new ED4_columnStat_terminal ("Reference_ColumnStatistics_Terminal", 300, col_stat_term_height, NULp) |
---|
596 | ); |
---|
597 | } |
---|
598 | |
---|
599 | { |
---|
600 | arb_progress species_progress("Loading species", total_no_of_species); |
---|
601 | |
---|
602 | // ********** Top Area beginning ********** |
---|
603 | |
---|
604 | ED4_multi_species_manager *top_multi_species_manager; |
---|
605 | ED4_spacer_terminal *top_spacer_terminal; |
---|
606 | ED4_spacer_terminal *top_mid_spacer_terminal; |
---|
607 | ED4_spacer_terminal *top_multi_spacer_terminal_beg; |
---|
608 | ED4_line_terminal *top_mid_line_terminal; |
---|
609 | { |
---|
610 | ED4_area_manager *top_area_manager = new ED4_area_manager("Top_Area_Manager", 0, 0, device_manager); |
---|
611 | device_manager->append_member(top_area_manager); |
---|
612 | top_area_man = top_area_manager; |
---|
613 | |
---|
614 | top_spacer_terminal = new ED4_spacer_terminal("Top_Spacer", false, 100, 10, top_area_manager); |
---|
615 | top_area_manager->append_member(top_spacer_terminal); |
---|
616 | |
---|
617 | top_multi_species_manager = new ED4_multi_species_manager("Top_MultiSpecies_Manager", 0, 0, top_area_manager); |
---|
618 | top_area_manager->append_member(top_multi_species_manager); |
---|
619 | |
---|
620 | top_multi_spacer_terminal_beg = new ED4_spacer_terminal("Top_Left_Spacer", false, 0, 3, top_multi_species_manager); |
---|
621 | top_multi_species_manager->append_member(top_multi_spacer_terminal_beg); |
---|
622 | |
---|
623 | reference = new ED4_reference; |
---|
624 | |
---|
625 | int index = 0; |
---|
626 | EDB_root_bact::scan_string(top_multi_species_manager, ref_terminals, area_string_top, &index, species_progress); |
---|
627 | GB_pop_transaction(gb_main); |
---|
628 | |
---|
629 | const int TOP_MID_LINE_HEIGHT = 3; |
---|
630 | int TOP_MID_SPACER_HEIGHT = font_group.get_max_height()-TOP_MID_LINE_HEIGHT; |
---|
631 | |
---|
632 | top_mid_line_terminal = new ED4_line_terminal("Top_Mid_Line_Terminal", 0, TOP_MID_LINE_HEIGHT, device_manager); // width will be set below |
---|
633 | device_manager->append_member(top_mid_line_terminal); |
---|
634 | |
---|
635 | top_mid_spacer_terminal = new ED4_spacer_terminal("Top_Middle_Spacer", true, 880, TOP_MID_SPACER_HEIGHT, device_manager); |
---|
636 | device_manager->append_member(top_mid_spacer_terminal); |
---|
637 | |
---|
638 | // needed to avoid text-clipping problems: |
---|
639 | main_manager->set_top_middle_spacer_terminal(top_mid_spacer_terminal); |
---|
640 | main_manager->set_top_middle_line_terminal(top_mid_line_terminal); |
---|
641 | } |
---|
642 | |
---|
643 | // ********** Middle Area beginning ********** |
---|
644 | |
---|
645 | ED4_area_manager *middle_area_manager; |
---|
646 | ED4_tree_terminal *tree_terminal; |
---|
647 | ED4_multi_species_manager *mid_multi_species_manager; |
---|
648 | ED4_spacer_terminal *mid_multi_spacer_terminal_beg; |
---|
649 | ED4_line_terminal *mid_bot_line_terminal; |
---|
650 | ED4_spacer_terminal *total_bottom_spacer; |
---|
651 | { |
---|
652 | middle_area_manager = new ED4_area_manager("Middle_Area_Manager", 0, 0, device_manager); |
---|
653 | device_manager->append_member(middle_area_manager); |
---|
654 | middle_area_man = middle_area_manager; |
---|
655 | |
---|
656 | tree_terminal = new ED4_tree_terminal("Tree", 2, 0, middle_area_manager); |
---|
657 | middle_area_manager->append_member(tree_terminal); |
---|
658 | |
---|
659 | mid_multi_species_manager = new ED4_multi_species_manager("Middle_MultiSpecies_Manager", 0, 0, middle_area_manager); |
---|
660 | middle_area_manager->append_member(mid_multi_species_manager); |
---|
661 | |
---|
662 | mid_multi_spacer_terminal_beg = new ED4_spacer_terminal("Mid_Multi_Spacer_Terminal_Beg", false, 0, 3, mid_multi_species_manager); |
---|
663 | mid_multi_species_manager->append_member(mid_multi_spacer_terminal_beg); |
---|
664 | |
---|
665 | scroll_links.link_for_ver_slider = middle_area_manager; |
---|
666 | |
---|
667 | { |
---|
668 | GB_transaction ta(gb_main); |
---|
669 | int index = 0; |
---|
670 | EDB_root_bact::scan_string(mid_multi_species_manager, ref_terminals, area_string_middle, &index, species_progress); |
---|
671 | } |
---|
672 | |
---|
673 | { |
---|
674 | ED4_spacer_terminal *mid_bot_spacer_terminal = new ED4_spacer_terminal("Middle_Bot_Spacer_Terminal", false, 880, 10, device_manager); |
---|
675 | device_manager->append_member(mid_bot_spacer_terminal); |
---|
676 | } |
---|
677 | |
---|
678 | mid_bot_line_terminal = new ED4_line_terminal("Mid_Bot_Line_Terminal", 0, 3, device_manager); // width will be set below |
---|
679 | device_manager->append_member(mid_bot_line_terminal); |
---|
680 | |
---|
681 | total_bottom_spacer = new ED4_spacer_terminal("Total_Bottom_Spacer_terminal", false, 0, 10000, device_manager); |
---|
682 | total_bottom_spacer->clr_property(PROP_DYNA_RESIZE); |
---|
683 | device_manager->append_member(total_bottom_spacer); |
---|
684 | } |
---|
685 | |
---|
686 | if (scroll_links.link_for_hor_slider) { |
---|
687 | const long ext_width = long(scroll_links.link_for_hor_slider->extension.size[WIDTH]); |
---|
688 | const long spacer_width = ext_width + MAXNAME_WIDTH + SEQUENCE_INFO_WIDTH; |
---|
689 | const long line_width = spacer_width + TREE_TERMINAL_WIDTH; |
---|
690 | |
---|
691 | top_multi_spacer_terminal_beg->extension.size[WIDTH] = spacer_width; |
---|
692 | mid_multi_spacer_terminal_beg->extension.size[WIDTH] = spacer_width; |
---|
693 | total_bottom_spacer->extension.size[WIDTH] = spacer_width; |
---|
694 | |
---|
695 | top_mid_line_terminal->extension.size[WIDTH] = line_width; |
---|
696 | mid_bot_line_terminal->extension.size[WIDTH] = line_width; |
---|
697 | |
---|
698 | } |
---|
699 | |
---|
700 | tree_terminal->set_links(NULp, mid_multi_species_manager); // set links |
---|
701 | top_spacer_terminal->set_links(tree_terminal, top_multi_species_manager); |
---|
702 | top_mid_spacer_terminal->set_links(middle_area_manager, NULp); |
---|
703 | total_bottom_spacer->set_links(mid_bot_line_terminal, NULp); |
---|
704 | |
---|
705 | species_progress.done(); |
---|
706 | } |
---|
707 | |
---|
708 | first_window->update_window_coords(); |
---|
709 | resize_all_requesting_childs(); |
---|
710 | |
---|
711 | main_manager->route_down_hierarchy(makeED4_route_cb(force_group_update)).expect_no_error(); |
---|
712 | |
---|
713 | if (!scroll_links.link_for_hor_slider) { // happens when no species AND no SAI has data |
---|
714 | startup_progress->done(); |
---|
715 | startup_progress.setNull(); // make progress disappear (otherwise prompter below is often behind progress window) |
---|
716 | GB_pop_transaction(gb_main); |
---|
717 | |
---|
718 | aw_popup_ok(GBS_global_string("No species/SAI contains data in '%s'\nARB_EDIT4 will terminate", alignment_name)); |
---|
719 | ED4_exit(); |
---|
720 | } |
---|
721 | |
---|
722 | // build consensi |
---|
723 | { |
---|
724 | arb_progress consensi_progress("Initializing consensi", total_no_of_species+total_no_of_groups+1); // 1 is root_group_man |
---|
725 | |
---|
726 | root_group_man->create_consensus(root_group_man, &consensi_progress); |
---|
727 | e4_assert(root_group_man->table().ok()); |
---|
728 | consensi_progress.done(); // if there is a "top"-group, progress increment is one to low |
---|
729 | } |
---|
730 | |
---|
731 | root_group_man->remap()->mark_compile_needed_force(); |
---|
732 | root_group_man->update_remap(); |
---|
733 | |
---|
734 | // calc size and display: |
---|
735 | |
---|
736 | resize_all_requesting_childs(); |
---|
737 | |
---|
738 | e4_assert(main_manager); |
---|
739 | |
---|
740 | { |
---|
741 | ED4_base *x_link = scroll_links.link_for_hor_slider; |
---|
742 | ED4_base *y_link = scroll_links.link_for_ver_slider; |
---|
743 | ED4_base *width_link = x_link; |
---|
744 | ED4_base *height_link = y_link; |
---|
745 | |
---|
746 | ED4_window *win = first_window; |
---|
747 | while (win) { |
---|
748 | win->set_scrolled_rectangle(x_link, y_link, width_link, height_link); |
---|
749 | win->aww->show(); |
---|
750 | win->update_scrolled_rectangle(); |
---|
751 | win = win->next; |
---|
752 | } |
---|
753 | } |
---|
754 | |
---|
755 | ED4_request_relayout(); |
---|
756 | ED4_finish_and_show_notFoundMessage(); |
---|
757 | |
---|
758 | #if defined(DEBUG) && 0 |
---|
759 | // dump created hierarchy: |
---|
760 | puts("---------------------------------------- [main_manager dump start]"); |
---|
761 | main_manager->dump(1); |
---|
762 | puts("---------------------------------------- [main_manager dump end]"); |
---|
763 | #endif |
---|
764 | |
---|
765 | return ED4_R_OK; |
---|
766 | } |
---|
767 | |
---|
768 | ED4_returncode ED4_root::get_area_rectangle(AW_screen_area *rect, AW_pos x, AW_pos y) { |
---|
769 | // returns win-coordinates of area (defined by folding lines) which contains position x/y |
---|
770 | int x1, x2, y1, y2; |
---|
771 | const AW_screen_area& area_rect = current_device()->get_area_size(); |
---|
772 | |
---|
773 | x1 = area_rect.l; |
---|
774 | for (const ED4_folding_line *flv=current_ed4w()->get_vertical_folding(); ; flv = flv->get_next()) { |
---|
775 | if (flv) { |
---|
776 | x2 = int(flv->get_pos()); // @@@ use AW_INT ? |
---|
777 | } |
---|
778 | else { |
---|
779 | x2 = area_rect.r; |
---|
780 | if (x1==x2) { |
---|
781 | break; |
---|
782 | } |
---|
783 | } |
---|
784 | |
---|
785 | y1 = area_rect.t; |
---|
786 | for (const ED4_folding_line *flh=current_ed4w()->get_horizontal_folding(); ; flh = flh->get_next()) { |
---|
787 | if (flh) { |
---|
788 | y2 = int(flh->get_pos()); // @@@ use AW_INT ? |
---|
789 | } |
---|
790 | else { |
---|
791 | y2 = area_rect.b; |
---|
792 | if (y1==y2) { |
---|
793 | break; |
---|
794 | } |
---|
795 | } |
---|
796 | |
---|
797 | if (x1<=x && x<=x2 && y1<=y && y<=y2) { |
---|
798 | rect->t = y1; |
---|
799 | rect->b = y2; |
---|
800 | rect->l = x1; |
---|
801 | rect->r = x2; |
---|
802 | return ED4_R_OK; |
---|
803 | } |
---|
804 | y1 = y2; |
---|
805 | if (!flh) break; |
---|
806 | } |
---|
807 | x1 = x2; |
---|
808 | if (!flv) break; |
---|
809 | } |
---|
810 | return ED4_R_IMPOSSIBLE; // no area contains x/y :-( |
---|
811 | } |
---|
812 | |
---|
813 | void ED4_root::copy_window_struct(ED4_window *source, ED4_window *destination) { |
---|
814 | destination->slider_pos_horizontal = source->slider_pos_horizontal; |
---|
815 | destination->slider_pos_vertical = source->slider_pos_vertical; |
---|
816 | destination->coords = source->coords; |
---|
817 | } |
---|
818 | |
---|
819 | |
---|
820 | static void reload_helix_cb() { |
---|
821 | const char *err = ED4_ROOT->helix->init(ED4_ROOT->get_gb_main()); |
---|
822 | if (err) aw_message(err); |
---|
823 | ED4_request_full_refresh(); |
---|
824 | } |
---|
825 | |
---|
826 | |
---|
827 | static void reload_ecoli_cb() { |
---|
828 | const char *err = ED4_ROOT->ecoli_ref->init(ED4_ROOT->get_gb_main()); |
---|
829 | if (err) aw_message(err); |
---|
830 | ED4_request_full_refresh(); |
---|
831 | } |
---|
832 | |
---|
833 | // --------------------------------------- |
---|
834 | // recursion through all species |
---|
835 | |
---|
836 | DECLARE_CBTYPE_FVV_AND_BUILDERS(ED4_Species_Callback, ARB_ERROR, GBDATA *); // generates makeED4_Species_Callback |
---|
837 | |
---|
838 | static ARB_ERROR do_sth_with_species(ED4_base *base, const ED4_Species_Callback *cb) { |
---|
839 | ARB_ERROR error = NULp; |
---|
840 | |
---|
841 | if (base->is_species_manager()) { |
---|
842 | ED4_species_manager *species_manager = base->to_species_manager(); |
---|
843 | ED4_species_name_terminal *species_name_terminal = species_manager->search_spec_child_rek(LEV_SPECIES_NAME)->to_species_name_terminal(); |
---|
844 | |
---|
845 | if (species_name_terminal->get_species_pointer()) { |
---|
846 | char *species_name = GB_read_as_string(species_name_terminal->get_species_pointer()); |
---|
847 | |
---|
848 | e4_assert(species_name); |
---|
849 | GBDATA *species = GBT_find_species(ED4_ROOT->get_gb_main(), species_name); |
---|
850 | |
---|
851 | error = species |
---|
852 | ? (*cb)(species) |
---|
853 | : GB_append_exportedError(GBS_global_string("can't find species '%s'", species_name)); |
---|
854 | |
---|
855 | free(species_name); |
---|
856 | } |
---|
857 | } |
---|
858 | |
---|
859 | return error; |
---|
860 | } |
---|
861 | |
---|
862 | |
---|
863 | static ARB_ERROR ED4_with_all_loaded_species(const ED4_Species_Callback& cb) { |
---|
864 | return ED4_ROOT->root_group_man->route_down_hierarchy(makeED4_route_cb(do_sth_with_species, &cb)); |
---|
865 | } |
---|
866 | |
---|
867 | static bool is_named(ED4_base *base, const char *wanted_name) { |
---|
868 | ED4_species_name_terminal *name_term = base->to_species_name_terminal(); |
---|
869 | GBDATA *gbd = name_term->get_species_pointer(); |
---|
870 | if (gbd) { |
---|
871 | const char *name = GB_read_char_pntr(gbd); |
---|
872 | e4_assert(name); |
---|
873 | |
---|
874 | return strcmp(name, wanted_name) == 0; |
---|
875 | } |
---|
876 | return false; |
---|
877 | } |
---|
878 | |
---|
879 | static bool is_species_named(ED4_base *base, const char *species_name) { |
---|
880 | return base->inside_species_seq_manager() && is_named(base, species_name); |
---|
881 | } |
---|
882 | |
---|
883 | static bool is_SAI_named(ED4_base *base, const char *sai_name) { |
---|
884 | return base->inside_SAI_manager() && is_named(base, sai_name); |
---|
885 | } |
---|
886 | |
---|
887 | ED4_species_name_terminal *ED4_find_species_or_SAI_name_terminal(const char *species_name) { |
---|
888 | ED4_base *base = ED4_ROOT->root_group_man->find_first_that(LEV_SPECIES_NAME, makeED4_basePredicate(is_species_named, species_name)); |
---|
889 | return base ? base->to_species_name_terminal() : NULp; |
---|
890 | } |
---|
891 | ED4_species_name_terminal *ED4_find_species_name_terminal(const char *species_name) { |
---|
892 | ED4_base *base = ED4_ROOT->root_group_man->find_first_that(LEV_SPECIES_NAME, makeED4_basePredicate(is_species_named, species_name)); |
---|
893 | return base ? base->to_species_name_terminal() : NULp; |
---|
894 | } |
---|
895 | ED4_species_name_terminal *ED4_find_SAI_name_terminal(const char *sai_name) { |
---|
896 | ED4_base *base = ED4_ROOT->root_group_man->find_first_that(LEV_SPECIES_NAME, makeED4_basePredicate(is_SAI_named, sai_name)); |
---|
897 | return base ? base->to_species_name_terminal() : NULp; |
---|
898 | } |
---|
899 | |
---|
900 | static char *get_group_consensus(const char *species_name, PosRange range) { |
---|
901 | ED4_species_name_terminal *name_term = ED4_find_species_name_terminal(species_name); |
---|
902 | char *consensus = NULp; |
---|
903 | |
---|
904 | if (name_term) { |
---|
905 | ED4_abstract_group_manager *group_man = name_term->get_parent(ED4_level(LEV_GROUP|LEV_ROOTGROUP))->to_abstract_group_manager(); |
---|
906 | if (group_man) { |
---|
907 | consensus = group_man->build_consensus_string(range); |
---|
908 | } |
---|
909 | } |
---|
910 | |
---|
911 | return consensus; |
---|
912 | } |
---|
913 | |
---|
914 | static bool get_selected_range(PosRange& range) { |
---|
915 | ED4_selected_elem *listElem = ED4_ROOT->selected_objects->head(); |
---|
916 | if (listElem) { |
---|
917 | ED4_sequence_terminal *seqTerm = listElem->elem()->object->corresponding_sequence_terminal(); |
---|
918 | return ED4_get_selected_range(seqTerm, range); |
---|
919 | } |
---|
920 | return false; |
---|
921 | } |
---|
922 | |
---|
923 | static ED4_selected_elem *curr_aligner_elem = NULp; |
---|
924 | |
---|
925 | static GBDATA *get_next_selected_species() { |
---|
926 | if (!curr_aligner_elem) return NULp; |
---|
927 | |
---|
928 | ED4_species_manager *specMan = curr_aligner_elem->elem()->object->containing_species_manager(); |
---|
929 | curr_aligner_elem = curr_aligner_elem->next(); |
---|
930 | return specMan->get_species_pointer(); |
---|
931 | } |
---|
932 | |
---|
933 | static GBDATA *get_first_selected_species(int *total_no_of_selected_species) { |
---|
934 | int selected = ED4_ROOT->selected_objects->size(); |
---|
935 | |
---|
936 | if (total_no_of_selected_species) { |
---|
937 | *total_no_of_selected_species = selected; |
---|
938 | } |
---|
939 | |
---|
940 | if (selected) { |
---|
941 | curr_aligner_elem = ED4_ROOT->selected_objects->head(); |
---|
942 | } |
---|
943 | else { |
---|
944 | curr_aligner_elem = NULp; |
---|
945 | } |
---|
946 | |
---|
947 | return get_next_selected_species(); |
---|
948 | } |
---|
949 | |
---|
950 | static ARB_ERROR ED4_delete_temp_entries(GBDATA *species, GB_CSTR alignment_name) { |
---|
951 | return FastAligner_delete_temp_entries(species, alignment_name); |
---|
952 | } |
---|
953 | |
---|
954 | static void ED4_remove_faligner_entries() { |
---|
955 | GBDATA *gb_main = ED4_ROOT->get_gb_main(); |
---|
956 | ARB_ERROR error = GB_begin_transaction(gb_main); |
---|
957 | if (!error) error = ED4_with_all_loaded_species(makeED4_Species_Callback(ED4_delete_temp_entries, ED4_ROOT->alignment_name)); |
---|
958 | GB_end_transaction_show_error(gb_main, error, aw_message); |
---|
959 | } |
---|
960 | |
---|
961 | static void toggle_helix_for_SAI(AW_window *aww) { |
---|
962 | ED4_LocalWinContext uses(aww); |
---|
963 | ED4_cursor *cursor = ¤t_cursor(); |
---|
964 | |
---|
965 | if (cursor->in_SAI_terminal()) { |
---|
966 | ED4_sequence_terminal *sai_term = cursor->owner_of_cursor->to_sequence_terminal(); |
---|
967 | ED4_sequence_info_terminal *sai_info_term = sai_term->parent->search_spec_child_rek(LEV_SEQUENCE_INFO)->to_sequence_info_terminal(); |
---|
968 | |
---|
969 | GBDATA *gb_sai_data = sai_info_term->data(); |
---|
970 | GB_transaction ta(gb_sai_data); |
---|
971 | |
---|
972 | GBDATA *gb_sai = GB_get_grandfather(gb_sai_data); |
---|
973 | GBDATA *gb_disp_sec = GB_searchOrCreate_int(gb_sai, "showsec", 0); |
---|
974 | |
---|
975 | bool show_sec = 1-bool(GB_read_int(gb_disp_sec)); |
---|
976 | GB_ERROR error = GB_write_int(gb_disp_sec, show_sec); |
---|
977 | if (!error) { |
---|
978 | sai_term->set_secstruct_display(show_sec); |
---|
979 | sai_term->request_refresh(); |
---|
980 | } |
---|
981 | if (error) aw_message(error); |
---|
982 | } |
---|
983 | else { |
---|
984 | aw_message("Please select an SAI"); |
---|
985 | } |
---|
986 | } |
---|
987 | |
---|
988 | static void title_mode_changed(AW_root *aw_root, AW_window *aww) { |
---|
989 | int title_mode = aw_root->awar(AWAR_EDIT_TITLE_MODE)->read_int(); |
---|
990 | |
---|
991 | if (title_mode==0) { |
---|
992 | aww->set_info_area_height(57); |
---|
993 | } |
---|
994 | else { |
---|
995 | aww->set_info_area_height(170); |
---|
996 | } |
---|
997 | } |
---|
998 | |
---|
999 | static void ED4_undo_redo(AW_window *aww, GB_UNDO_TYPE undo_type) { |
---|
1000 | ED4_LocalWinContext uses(aww); |
---|
1001 | |
---|
1002 | GBDATA *gb_main = ED4_ROOT->get_gb_main(); |
---|
1003 | GB_ERROR error = GB_undo(gb_main, undo_type); |
---|
1004 | |
---|
1005 | if (error) { |
---|
1006 | aw_message(error); |
---|
1007 | } |
---|
1008 | else { |
---|
1009 | GB_begin_transaction(gb_main); |
---|
1010 | GB_commit_transaction(gb_main); |
---|
1011 | ED4_cursor *cursor = ¤t_cursor(); |
---|
1012 | if (cursor->owner_of_cursor) cursor->owner_of_cursor->request_refresh(); |
---|
1013 | } |
---|
1014 | } |
---|
1015 | |
---|
1016 | static AW_window *ED4_zoom_message_window(AW_root *root) { |
---|
1017 | AW_window_simple *aws = new AW_window_simple; |
---|
1018 | |
---|
1019 | aws->init(root, "ZOOM_ERR_MSG", "Errors and warnings"); |
---|
1020 | aws->load_xfig("edit4/message.fig"); |
---|
1021 | |
---|
1022 | aws->callback(AW_POPDOWN); |
---|
1023 | aws->at("hide"); |
---|
1024 | aws->create_button("HIDE", "HIDE"); |
---|
1025 | |
---|
1026 | aws->callback(aw_clear_message_cb); |
---|
1027 | aws->at("clear"); |
---|
1028 | aws->create_button("CLEAR", "CLEAR"); |
---|
1029 | |
---|
1030 | aws->at("errortext"); |
---|
1031 | aws->create_text_field(AWAR_ERROR_MESSAGES); |
---|
1032 | |
---|
1033 | return aws; |
---|
1034 | } |
---|
1035 | |
---|
1036 | |
---|
1037 | static char *cat(char *toBuf, const char *s1, const char *s2) { |
---|
1038 | char *buf = toBuf; |
---|
1039 | |
---|
1040 | while ((*buf++=*s1++)!=0) ; |
---|
1041 | buf--; |
---|
1042 | while ((*buf++=*s2++)!=0) ; |
---|
1043 | |
---|
1044 | return toBuf; |
---|
1045 | } |
---|
1046 | |
---|
1047 | static void insert_search_fields(AW_window_menu_modes *awmm, |
---|
1048 | const char *label_prefix, const char *macro_prefix, |
---|
1049 | const char *pattern_awar_name, const char *show_awar_name, |
---|
1050 | int short_form, ED4_SearchPositionType type, ED4_window *ed4w) |
---|
1051 | { |
---|
1052 | char buf[200]; |
---|
1053 | |
---|
1054 | if (!short_form) { |
---|
1055 | awmm->at(cat(buf, label_prefix, "search")); |
---|
1056 | awmm->create_input_field(pattern_awar_name, 30); |
---|
1057 | } |
---|
1058 | |
---|
1059 | awmm->at(cat(buf, label_prefix, "n")); |
---|
1060 | awmm->help_text("e4_search.hlp"); |
---|
1061 | awmm->callback(makeWindowCallback(ED4_search_cb, ED4_encodeSearchDescriptor(+1, type), ed4w)); |
---|
1062 | awmm->create_button(cat(buf, macro_prefix, "_SEARCH_NEXT"), "#edit/next.xpm"); |
---|
1063 | |
---|
1064 | awmm->at(cat(buf, label_prefix, "l")); |
---|
1065 | awmm->help_text("e4_search.hlp"); |
---|
1066 | awmm->callback(makeWindowCallback(ED4_search_cb, ED4_encodeSearchDescriptor(-1, type), ed4w)); |
---|
1067 | awmm->create_button(cat(buf, macro_prefix, "_SEARCH_LAST"), "#edit/last.xpm"); |
---|
1068 | |
---|
1069 | awmm->at(cat(buf, label_prefix, "d")); |
---|
1070 | awmm->help_text("e4_search.hlp"); |
---|
1071 | awmm->callback(makeWindowCallback(ED4_popup_search_window, type)); |
---|
1072 | awmm->create_button(cat(buf, macro_prefix, "_SEARCH_DETAIL"), "#edit/detail.xpm"); |
---|
1073 | |
---|
1074 | awmm->at(cat(buf, label_prefix, "s")); |
---|
1075 | awmm->create_toggle(show_awar_name); |
---|
1076 | } |
---|
1077 | |
---|
1078 | static void ED4_set_protection(AW_window *aww, int wanted_protection) { |
---|
1079 | ED4_LocalWinContext uses(aww); |
---|
1080 | ED4_cursor *cursor = ¤t_cursor(); |
---|
1081 | GB_ERROR error = NULp; |
---|
1082 | |
---|
1083 | if (cursor->owner_of_cursor) { |
---|
1084 | ED4_sequence_terminal *seq_term = cursor->owner_of_cursor->to_sequence_terminal(); |
---|
1085 | ED4_sequence_info_terminal *seq_info_term = seq_term->parent->search_spec_child_rek(LEV_SEQUENCE_INFO)->to_sequence_info_terminal(); |
---|
1086 | GBDATA *gbd = seq_info_term->data(); |
---|
1087 | |
---|
1088 | GB_transaction ta(gbd); |
---|
1089 | GB_topSecurityLevel unsecured(gbd); |
---|
1090 | |
---|
1091 | error = GB_write_security_write(gbd, wanted_protection); |
---|
1092 | error = ta.close(error); |
---|
1093 | } |
---|
1094 | else { |
---|
1095 | error = "No species selected"; |
---|
1096 | } |
---|
1097 | |
---|
1098 | if (error) aw_message(error); |
---|
1099 | } |
---|
1100 | |
---|
1101 | enum MenuSelectType { // @@@ rename -> MenuHighlightType |
---|
1102 | ED4_MS_NONE, |
---|
1103 | ED4_MS_ALL, |
---|
1104 | ED4_MS_INVERT, |
---|
1105 | ED4_MS_INVERT_GROUP, |
---|
1106 | ED4_MS_UNMARK_ALL, |
---|
1107 | ED4_MS_MARK_SELECTED, |
---|
1108 | ED4_MS_UNMARK_SELECTED, |
---|
1109 | ED4_MS_SELECT_MARKED, |
---|
1110 | ED4_MS_DESELECT_MARKED, |
---|
1111 | ED4_MS_TOGGLE_BLOCKTYPE |
---|
1112 | }; |
---|
1113 | |
---|
1114 | static void ED4_menu_highlight(AW_window *aww, MenuSelectType select) { // @@@ rename select -> hilight |
---|
1115 | GBDATA *gb_main = ED4_ROOT->get_gb_main(); |
---|
1116 | GB_transaction ta(gb_main); |
---|
1117 | |
---|
1118 | ED4_multi_species_manager *middle_multi_man = ED4_ROOT->middle_area_man->get_multi_species_manager(); |
---|
1119 | |
---|
1120 | e4_assert(middle_multi_man); |
---|
1121 | |
---|
1122 | switch (select) { |
---|
1123 | case ED4_MS_NONE: { |
---|
1124 | if (ED4_getBlocktype()!=ED4_BT_NOBLOCK) { |
---|
1125 | ED4_ROOT->deselect_all(); |
---|
1126 | } |
---|
1127 | break; |
---|
1128 | } |
---|
1129 | case ED4_MS_ALL: { |
---|
1130 | middle_multi_man->select_all(true); // only species |
---|
1131 | ED4_correctBlocktypeAfterSelection(); |
---|
1132 | break; |
---|
1133 | } |
---|
1134 | case ED4_MS_INVERT: { |
---|
1135 | middle_multi_man->invert_selection_of_all_species(); |
---|
1136 | ED4_correctBlocktypeAfterSelection(); |
---|
1137 | break; |
---|
1138 | } |
---|
1139 | case ED4_MS_SELECT_MARKED: { |
---|
1140 | middle_multi_man->marked_species_select(true); |
---|
1141 | ED4_correctBlocktypeAfterSelection(); |
---|
1142 | break; |
---|
1143 | } |
---|
1144 | case ED4_MS_DESELECT_MARKED: { |
---|
1145 | middle_multi_man->marked_species_select(false); |
---|
1146 | ED4_correctBlocktypeAfterSelection(); |
---|
1147 | break; |
---|
1148 | } |
---|
1149 | case ED4_MS_UNMARK_ALL: { |
---|
1150 | GBT_mark_all(gb_main, 0); |
---|
1151 | break; |
---|
1152 | } |
---|
1153 | case ED4_MS_MARK_SELECTED: { |
---|
1154 | middle_multi_man->selected_species_mark(true); |
---|
1155 | ED4_correctBlocktypeAfterSelection(); |
---|
1156 | break; |
---|
1157 | } |
---|
1158 | case ED4_MS_UNMARK_SELECTED: { |
---|
1159 | middle_multi_man->selected_species_mark(false); |
---|
1160 | ED4_correctBlocktypeAfterSelection(); |
---|
1161 | break; |
---|
1162 | } |
---|
1163 | case ED4_MS_INVERT_GROUP: { |
---|
1164 | ED4_cursor *cursor = &ED4_ROOT->first_window->get_matching_ed4w(aww)->cursor; |
---|
1165 | int done = 0; |
---|
1166 | |
---|
1167 | if (cursor->owner_of_cursor) { |
---|
1168 | ED4_multi_species_manager *multi_man = cursor->owner_of_cursor->get_parent(LEV_MULTI_SPECIES)->to_multi_species_manager(); |
---|
1169 | |
---|
1170 | multi_man->invert_selection_of_all_species(); |
---|
1171 | ED4_correctBlocktypeAfterSelection(); |
---|
1172 | done = 1; |
---|
1173 | } |
---|
1174 | |
---|
1175 | if (!done) { |
---|
1176 | aw_message("Place cursor into group"); |
---|
1177 | } |
---|
1178 | break; |
---|
1179 | } |
---|
1180 | case ED4_MS_TOGGLE_BLOCKTYPE: { |
---|
1181 | ED4_toggle_block_type(); |
---|
1182 | break; |
---|
1183 | } |
---|
1184 | default: { |
---|
1185 | e4_assert(0); |
---|
1186 | break; |
---|
1187 | } |
---|
1188 | } |
---|
1189 | |
---|
1190 | ED4_request_full_refresh(); |
---|
1191 | } |
---|
1192 | |
---|
1193 | static void ED4_menu_perform_block_operation(AW_window *, ED4_blockoperation_type type) { |
---|
1194 | ED4_perform_block_operation(type); |
---|
1195 | } |
---|
1196 | |
---|
1197 | static void modes_cb(AW_window*, ED4_species_mode smode) { |
---|
1198 | ED4_ROOT->species_mode = smode; |
---|
1199 | for (ED4_window *win = ED4_ROOT->first_window; win; win = win->next) { |
---|
1200 | win->aww->select_mode(smode); |
---|
1201 | } |
---|
1202 | if (smode == ED4_SM_INFO) { |
---|
1203 | AWT_trigger_remote_action(NULp, ED4_ROOT->get_gb_main(), "ARB_NT:species_info"); |
---|
1204 | } |
---|
1205 | } |
---|
1206 | |
---|
1207 | void ED4_no_dangerous_modes() { |
---|
1208 | if (ED4_ROOT->species_mode == ED4_SM_KILL) { |
---|
1209 | modes_cb(NULp, ED4_SM_MOVE); |
---|
1210 | } |
---|
1211 | } |
---|
1212 | |
---|
1213 | static char *get_helix_string(GBDATA *gb_main, const char *alignment_name) { |
---|
1214 | GB_transaction ta(gb_main); |
---|
1215 | |
---|
1216 | char *helix_string = NULp; |
---|
1217 | char *helix_name = GBT_get_default_helix(gb_main); |
---|
1218 | GBDATA *gb_helix_con = GBT_find_SAI(gb_main, helix_name); |
---|
1219 | if (gb_helix_con) { |
---|
1220 | GBDATA *gb_helix = GBT_find_sequence(gb_helix_con, alignment_name); |
---|
1221 | if (gb_helix) helix_string = GB_read_string(gb_helix); |
---|
1222 | } |
---|
1223 | free(helix_name); |
---|
1224 | |
---|
1225 | return helix_string; |
---|
1226 | } |
---|
1227 | |
---|
1228 | const AlignDataAccess *ED4_get_aligner_data_access() { |
---|
1229 | static SmartPtr<AlignDataAccess> aliDataAccess; |
---|
1230 | |
---|
1231 | if (aliDataAccess.isNull()) { |
---|
1232 | aliDataAccess = new AlignDataAccess(ED4_ROOT->get_gb_main(), |
---|
1233 | ED4_ROOT->alignment_name, |
---|
1234 | true, ED4_trigger_instant_refresh, // perform refresh |
---|
1235 | get_group_consensus, // aligner fetches consensus of group of species via this function |
---|
1236 | get_selected_range, // aligner fetches column range of selection via this function |
---|
1237 | get_first_selected_species, // aligner fetches first and.. |
---|
1238 | get_next_selected_species, // .. following selected species via these functions |
---|
1239 | get_helix_string); // used by island_hopping (if configured to use sec-structure) |
---|
1240 | } |
---|
1241 | |
---|
1242 | return aliDataAccess.content(); |
---|
1243 | } |
---|
1244 | |
---|
1245 | static AW_window *ED4_create_faligner_window(AW_root *awr, const AlignDataAccess *data_access) { |
---|
1246 | #if defined(DEBUG) |
---|
1247 | static const AlignDataAccess *last_data_access = NULp; |
---|
1248 | |
---|
1249 | e4_assert(!last_data_access || (last_data_access == data_access)); // there shall be only one AlignDataAccess |
---|
1250 | last_data_access = data_access; |
---|
1251 | #endif |
---|
1252 | |
---|
1253 | static AW_window *aws = NULp; |
---|
1254 | if (!aws) aws = FastAligner_create_window(awr, data_access); |
---|
1255 | return aws; |
---|
1256 | } |
---|
1257 | |
---|
1258 | static const char *propertyName(GBDATA *gb_main, int mode) { |
---|
1259 | // mode == 0 -> alignment specific (e.g. "edit4_ali_16s.arb") |
---|
1260 | // mode == 1 -> alignment-type specific (e.g. "edit4_rna.arb") |
---|
1261 | // mode == 2 -> unspecific (normal) (always "edit4.arb") |
---|
1262 | // |
---|
1263 | // Note : result is only valid until next call |
---|
1264 | |
---|
1265 | e4_assert(mode >= 0 && mode <= 2); |
---|
1266 | |
---|
1267 | const char *result; |
---|
1268 | if (mode == 2) { |
---|
1269 | result = "edit4.arb"; |
---|
1270 | } |
---|
1271 | else { |
---|
1272 | static char *ali_name = NULp; |
---|
1273 | static char *ali_type = NULp; |
---|
1274 | static char *result_copy = NULp; |
---|
1275 | |
---|
1276 | if (!ali_name) { |
---|
1277 | GB_transaction ta(gb_main); |
---|
1278 | |
---|
1279 | ali_name = GBT_get_default_alignment(gb_main); |
---|
1280 | ali_type = GBT_get_alignment_type_string(gb_main, ali_name); |
---|
1281 | result_copy = new char[21+strlen(ali_name)]; |
---|
1282 | } |
---|
1283 | |
---|
1284 | sprintf(result_copy, "edit4_%s.arb", mode == 0 ? ali_name : ali_type); |
---|
1285 | result = result_copy; |
---|
1286 | } |
---|
1287 | |
---|
1288 | return result; |
---|
1289 | } |
---|
1290 | |
---|
1291 | static void ED4_save_properties(AW_window *aw, int mode) { |
---|
1292 | AW_save_specific_properties(aw, propertyName(ED4_ROOT->get_gb_main(), mode)); |
---|
1293 | } |
---|
1294 | |
---|
1295 | void ED4_popup_gc_window(AW_window *awp, AW_gc_manager *gcman) { |
---|
1296 | typedef std::map<AW_gc_manager*, AW_window*> gcwin; |
---|
1297 | static gcwin win; |
---|
1298 | |
---|
1299 | gcwin::iterator found = win.find(gcman); |
---|
1300 | |
---|
1301 | AW_window *aww = NULp; |
---|
1302 | if (found == win.end()) { |
---|
1303 | aww = AW_create_gc_window(awp->get_root(), gcman); |
---|
1304 | win[gcman] = aww; |
---|
1305 | } |
---|
1306 | else { |
---|
1307 | aww = win[gcman]; |
---|
1308 | } |
---|
1309 | aww->activate(); |
---|
1310 | } |
---|
1311 | |
---|
1312 | static void gc_change_cb(GcChange whatChanged) { |
---|
1313 | if (whatChanged == GC_FONT_CHANGED) { |
---|
1314 | ED4_resize_all_extensions(); |
---|
1315 | } |
---|
1316 | ED4_request_full_instant_refresh(); |
---|
1317 | } |
---|
1318 | |
---|
1319 | ED4_returncode ED4_root::generate_window(AW_device **device, ED4_window **new_window) { |
---|
1320 | { |
---|
1321 | ED4_window *ed4w = first_window; |
---|
1322 | |
---|
1323 | while (ed4w) { // before creating a window look for a hidden window |
---|
1324 | if (ed4w->is_hidden) { |
---|
1325 | ed4w->aww->show(); |
---|
1326 | ed4w->is_hidden = false; |
---|
1327 | return ED4_R_BREAK; |
---|
1328 | } |
---|
1329 | ed4w = ed4w->next; |
---|
1330 | } |
---|
1331 | } |
---|
1332 | |
---|
1333 | if (ED4_window::no_of_windows == MAXWINDOWS) { // no more than 5 windows allowed |
---|
1334 | aw_message(GBS_global_string("Restricted to %i windows", MAXWINDOWS)); |
---|
1335 | return ED4_R_BREAK; |
---|
1336 | } |
---|
1337 | |
---|
1338 | AW_window_menu_modes *awmm = new AW_window_menu_modes; |
---|
1339 | { |
---|
1340 | int winNum = ED4_window::no_of_windows+1; |
---|
1341 | char *winName = winNum>1 ? GBS_global_string_copy("ARB_EDIT4_%i", winNum) : ARB_strdup("ARB_EDIT4"); |
---|
1342 | char *winTitle = GBS_global_string_copy("ARB_EDIT4 *%d* [%s]", winNum, alignment_name); |
---|
1343 | |
---|
1344 | awmm->init(aw_root, winName, winTitle, 800, 450); |
---|
1345 | |
---|
1346 | free(winTitle); |
---|
1347 | free(winName); |
---|
1348 | } |
---|
1349 | |
---|
1350 | *device = awmm->get_device(AW_MIDDLE_AREA); // points to Middle Area device |
---|
1351 | *new_window = ED4_window::insert_window(awmm); // append to window list |
---|
1352 | |
---|
1353 | e4_assert(ED4_window::no_of_windows >= 1); |
---|
1354 | bool clone = ED4_window::no_of_windows>1; |
---|
1355 | if (!clone) { // this is the first window |
---|
1356 | AW_init_color_group_defaults("arb_edit4"); |
---|
1357 | } |
---|
1358 | else { // additional edit windows |
---|
1359 | copy_window_struct(first_window, *new_window); |
---|
1360 | } |
---|
1361 | |
---|
1362 | ED4_LocalWinContext uses(*new_window); |
---|
1363 | |
---|
1364 | // each window has its own gc-manager |
---|
1365 | gc_manager = AW_manage_GC(awmm, |
---|
1366 | "ARB_EDIT4", // but all gc-managers use the same colors |
---|
1367 | *device, |
---|
1368 | ED4_G_DRAG, |
---|
1369 | AW_GCM_DATA_AREA, |
---|
1370 | makeGcChangedCallback(gc_change_cb), // callback triggering refresh on gc-change |
---|
1371 | |
---|
1372 | "#f8f8f8", |
---|
1373 | "STANDARD$black", // standard color showing species/group info (name, ...) |
---|
1374 | "FlagInfo$#DDD", |
---|
1375 | "#SEQUENCES (0)$#505050", // default color for sequences (color 0) |
---|
1376 | |
---|
1377 | "+-HELIX (1)$#8E0000", "+-COLOR 2$#0000dd", "-COLOR 3$#00AA55", |
---|
1378 | "+-COLOR 4$#80f", "+-COLOR 5$#c0a020", "-COLOR 6$grey", |
---|
1379 | "+-COLOR 7$#ff0000", "+-COLOR 8$#44aaff", "-COLOR 9$#ffaa00", |
---|
1380 | |
---|
1381 | "+-CURSOR$#FF0080", "+-MARKED$#f4f8e0", "-SELECTED$#FFFF80", |
---|
1382 | |
---|
1383 | "+-RANGE 0$#FFFFFF", "+-RANGE 1$#F0F0F0", "-RANGE 2$#E0E0E0", |
---|
1384 | "+-RANGE 3$#D8D8D8", "+-RANGE 4$#D0D0D0", "-RANGE 5$#C8C8C8", |
---|
1385 | "+-RANGE 6$#C0C0C0", "+-RANGE 7$#B8B8B8", "-RANGE 8$#B0B0B0", |
---|
1386 | "-RANGE 9$#A0A0A0", |
---|
1387 | |
---|
1388 | // colors used to Paint search patterns |
---|
1389 | // (do not change the names of these gcs) |
---|
1390 | "+-User1$#B8E2F8", "+-User2$#B8E2F8", "-Probe$#B8E2F8", // see also SEC_graphic::init_devices |
---|
1391 | "+-Primer(l)$#A9FE54", "+-Primer(r)$#A9FE54", "-Primer(g)$#A9FE54", |
---|
1392 | "+-Sig(l)$#DBB0FF", "+-Sig(r)$#DBB0FF", "-Sig(g)$#DBB0FF", |
---|
1393 | |
---|
1394 | "+-MISMATCHES$#FF9AFF", "+-Flag$#7c7ce3", "-FlagFill$#aacef1", |
---|
1395 | |
---|
1396 | "&color_groups", // use color groups |
---|
1397 | |
---|
1398 | NULp); |
---|
1399 | |
---|
1400 | // since the gc-managers of all EDIT4-windows point to the same window properties, |
---|
1401 | // changing fonts and colors is always done on first gc-manager |
---|
1402 | static AW_gc_manager *first_gc_manager = NULp; |
---|
1403 | if (!first_gc_manager) first_gc_manager = gc_manager; |
---|
1404 | |
---|
1405 | // -------------- |
---|
1406 | // File |
---|
1407 | |
---|
1408 | #if defined(DEBUG) |
---|
1409 | AWT_create_debug_menu(awmm); |
---|
1410 | #endif // DEBUG |
---|
1411 | |
---|
1412 | awmm->create_menu("File", "F", AWM_ALL); |
---|
1413 | |
---|
1414 | awmm->insert_menu_topic("new_win", "New Editor Window", "N", NULp, AWM_ALL, ED4_new_editor_window); |
---|
1415 | awmm->sep______________(); |
---|
1416 | awmm->insert_menu_topic("save_config", "Save configuration", "S", "species_configs_saveload.hlp", AWM_ALL, makeWindowCallback(ED4_saveConfiguration, false)); |
---|
1417 | awmm->insert_menu_topic(awmm->local_id("save_config_as"), "Save configuration as ...", "a", "species_configs_saveload.hlp", AWM_ALL, ED4_create_saveConfigurationAs_window); |
---|
1418 | awmm->insert_menu_topic(awmm->local_id("load_config"), "Load configuration ...", "L", "species_configs_saveload.hlp", AWM_ALL, ED4_create_loadConfiguration_window); |
---|
1419 | awmm->insert_menu_topic("reload_config", "Reload configuration", "R", "species_configs_saveload.hlp", AWM_ALL, ED4_reloadConfiguration); |
---|
1420 | insert_macro_menu_entry(awmm, true); |
---|
1421 | awmm->sep______________(); |
---|
1422 | // keep the following entries in sync with ../NTREE/NT_extern.cxx@common_save_menu_entries |
---|
1423 | awmm->insert_menu_topic("save_changes", "Quicksave changes", "c", "save.hlp", AWM_ALL, makeWindowCallback(AWT_trigger_remote_action, gb_main, "ARB_NT:save_changes")); |
---|
1424 | awmm->insert_menu_topic("save_all_as", "Save whole database as ...", "w", "save.hlp", AWM_ALL, makeWindowCallback(AWT_trigger_remote_action, gb_main, "ARB_NT:save_all_as")); |
---|
1425 | #if defined(DEBUG) |
---|
1426 | awmm->sep______________(); |
---|
1427 | awmm->insert_menu_topic("deb1", "[DEBUG] remote: invalid app", "D", NULp, AWM_ALL, makeWindowCallback(AWT_trigger_remote_action, gb_main, "ARB_NTREE:aljdlaisjdlad")); |
---|
1428 | awmm->insert_menu_topic("deb2", "[DEBUG] remote: invalid cmd", "E", NULp, AWM_ALL, makeWindowCallback(AWT_trigger_remote_action, gb_main, "ARB_NT:aljdlaisjdlad")); |
---|
1429 | #endif |
---|
1430 | awmm->sep______________(); |
---|
1431 | GDE_load_menu(awmm, AWM_ALL, "Print"); |
---|
1432 | awmm->sep______________(); |
---|
1433 | |
---|
1434 | if (clone) awmm->insert_menu_topic("close", "CLOSE", "C", NULp, AWM_ALL, ED4_quit_editor); |
---|
1435 | else awmm->insert_menu_topic("quit", "QUIT", "Q", NULp, AWM_ALL, ED4_quit_editor); |
---|
1436 | |
---|
1437 | // ---------------- |
---|
1438 | // Create |
---|
1439 | |
---|
1440 | awmm->create_menu("Create", "C", AWM_ALL); |
---|
1441 | awmm->insert_menu_topic(awmm->local_id("create_species"), "Create new species", "n", NULp, AWM_ALL, makeCreateWindowCallback(ED4_create_new_seq_window, CREATE_NEW_SPECIES)); |
---|
1442 | awmm->insert_menu_topic(awmm->local_id("create_species_from_consensus"), "Create new species from consensus", "u", NULp, AWM_ALL, makeCreateWindowCallback(ED4_create_new_seq_window, CREATE_FROM_CONSENSUS)); |
---|
1443 | awmm->insert_menu_topic(awmm->local_id("copy_species"), "Copy current species", "C", NULp, AWM_ALL, makeCreateWindowCallback(ED4_create_new_seq_window, COPY_SPECIES)); |
---|
1444 | awmm->sep______________(); |
---|
1445 | awmm->insert_menu_topic("create_group", "Create new Group (from selected)", "G", NULp, AWM_ALL, makeWindowCallback(group_species_cb, false)); |
---|
1446 | awmm->insert_menu_topic("create_groups_by_field", "Create new groups using Field", "F", NULp, AWM_ALL, makeWindowCallback(group_species_cb, true)); |
---|
1447 | |
---|
1448 | // -------------- |
---|
1449 | // Edit |
---|
1450 | |
---|
1451 | awmm->create_menu("Edit", "E", AWM_ALL); |
---|
1452 | awmm->insert_menu_topic("refresh", "Refresh [Ctrl-L]", "f", NULp, AWM_ALL, makeWindowCallback(ED4_request_full_refresh)); |
---|
1453 | awmm->insert_menu_topic("load_current", "Load current species [GET]", "G", "e4_get_species.hlp", AWM_ALL, makeWindowCallback(ED4_get_and_jump_to_current)); |
---|
1454 | awmm->insert_menu_topic("load_marked", "Load marked species", "m", "e4_get_species.hlp", AWM_ALL, makeWindowCallback(ED4_get_marked_from_menu)); |
---|
1455 | awmm->insert_menu_topic(awmm->local_id("load_SAI"), "Load SAI ...", "L", "e4_get_species.hlp", AWM_ALL, ED4_create_loadSAI_window); |
---|
1456 | awmm->sep______________(); |
---|
1457 | awmm->insert_menu_topic("refresh_ecoli", "Reload Ecoli sequence", "E", "ecoliref.hlp", AWM_ALL, makeWindowCallback(reload_ecoli_cb)); |
---|
1458 | awmm->insert_menu_topic("refresh_helix", "Reload Helix", "H", "helix.hlp", AWM_ALL, makeWindowCallback(reload_helix_cb)); |
---|
1459 | awmm->insert_menu_topic("helix_jump_opposite", "Jump helix opposite [Ctrl-J]", "J", NULp, AWM_ALL, ED4_helix_jump_opposite); |
---|
1460 | awmm->sep______________(); |
---|
1461 | |
---|
1462 | awmm->insert_sub_menu("Set protection of current ", "p"); |
---|
1463 | { |
---|
1464 | char macro[] = "to_0", |
---|
1465 | topic[] = ".. to 0", |
---|
1466 | hotkey[] = "0"; |
---|
1467 | |
---|
1468 | for (char i='0'; i<='6'; i++) { |
---|
1469 | macro[3] = topic[6] = hotkey[0] = i; |
---|
1470 | awmm->insert_menu_topic(macro, topic, hotkey, "security.hlp", AWM_ALL, makeWindowCallback(ED4_set_protection, i-'0')); |
---|
1471 | } |
---|
1472 | } |
---|
1473 | awmm->close_sub_menu(); |
---|
1474 | |
---|
1475 | awmm->sep______________(); |
---|
1476 | awmm->insert_menu_topic(awmm->local_id("fast_aligner"), INTEGRATED_ALIGNERS_TITLE, "I", "faligner.hlp", AWM_ALL, makeCreateWindowCallback(ED4_create_faligner_window, ED4_get_aligner_data_access())); |
---|
1477 | awmm->insert_menu_topic("fast_align_set_ref", "Set aligner reference [Ctrl-R]", "R", "faligner.hlp", AWM_ALL, RootAsWindowCallback::simple(FastAligner_set_reference_species)); |
---|
1478 | awmm->insert_menu_topic(awmm->local_id("align_sequence"), "Old aligner from ARB_EDIT [broken]", "O", "ne_align_seq.hlp", AWM_DISABLED, makeCreateWindowCallback(create_naligner_window, get_gb_main())); |
---|
1479 | awmm->insert_menu_topic("sina", "SINA (SILVA Incremental Aligner)", "S", "sina_main.hlp", sina_mask(aw_root), makeWindowCallback(show_sina_window, ED4_get_aligner_data_access())); |
---|
1480 | awmm->insert_menu_topic("del_ali_tmp", "Remove all aligner Entries", "v", NULp, AWM_ALL, makeWindowCallback(ED4_remove_faligner_entries)); |
---|
1481 | awmm->sep______________(); |
---|
1482 | awmm->insert_menu_topic("missing_bases", "Dot potentially missing bases", "D", "missbase.hlp", AWM_EXP, ED4_popup_dot_missing_bases_window); |
---|
1483 | |
---|
1484 | if (alignment_type == GB_AT_RNA) { // if the database contains valid alignment of rRNA sequences |
---|
1485 | awmm->sep______________(); |
---|
1486 | awmm->insert_menu_topic("sec_edit", "Edit secondary structure", "c", "arb_secedit.hlp", AWM_ALL, makeWindowCallback(ED4_start_plugin, gb_main, "SECEDIT")); |
---|
1487 | #if defined(ARB_OPENGL) |
---|
1488 | awmm->insert_menu_topic("rna3d", "View 3D molecule", "3", "rna3d_general.hlp", AWM_ALL, makeWindowCallback(ED4_start_plugin, gb_main, "RNA3D")); |
---|
1489 | #endif // ARB_OPENGL |
---|
1490 | #if defined(DEBUG) |
---|
1491 | awmm->insert_menu_topic("noplugin", "DEBUG: call unknown plugin", "u", NULp, AWM_ALL, makeWindowCallback(ED4_start_plugin, gb_main, "testplugin")); |
---|
1492 | #endif // DEBUG |
---|
1493 | } |
---|
1494 | |
---|
1495 | // -------------- |
---|
1496 | // View |
---|
1497 | |
---|
1498 | awmm->create_menu("View", "V", AWM_ALL); |
---|
1499 | awmm->insert_sub_menu("Search", "S"); |
---|
1500 | { |
---|
1501 | int s; |
---|
1502 | const char *hotkeys = "12Poiclrg"; |
---|
1503 | char hotkey[] = "_"; |
---|
1504 | |
---|
1505 | e4_assert(strlen(hotkeys) == SEARCH_PATTERNS); |
---|
1506 | |
---|
1507 | for (s=0; s<SEARCH_PATTERNS; s++) { |
---|
1508 | ED4_SearchPositionType type = ED4_SearchPositionType(s); |
---|
1509 | const char *id = ED4_SearchPositionTypeId[type]; |
---|
1510 | int len = strlen(id); |
---|
1511 | char *macro_name = GB_give_buffer(2*(len+8)); |
---|
1512 | char *menu_entry_name = macro_name+(len+8); |
---|
1513 | |
---|
1514 | #ifndef NDEBUG |
---|
1515 | memset(macro_name, 0, 2*(len+8)); // to avoid memchk-warning |
---|
1516 | #endif |
---|
1517 | sprintf(macro_name, "%s_SEARCH", id); |
---|
1518 | char *p = macro_name; |
---|
1519 | while (1) { |
---|
1520 | char c = *p++; |
---|
1521 | if (!c) break; |
---|
1522 | p[-1] = toupper(c); |
---|
1523 | } |
---|
1524 | sprintf(menu_entry_name, "%s Search", id); |
---|
1525 | |
---|
1526 | hotkey[0] = hotkeys[s]; |
---|
1527 | awmm->insert_menu_topic(awmm->local_id(macro_name), menu_entry_name, hotkey, "e4_search.hlp", AWM_ALL, makeWindowCallback(ED4_popup_search_window, type)); |
---|
1528 | } |
---|
1529 | } |
---|
1530 | awmm->close_sub_menu(); |
---|
1531 | awmm->sep______________(); |
---|
1532 | awmm->insert_sub_menu("Cursor position ", "p"); |
---|
1533 | awmm->insert_menu_topic("store_curpos", "Store cursor position", "S", NULp, AWM_ALL, ED4_store_curpos); |
---|
1534 | awmm->insert_menu_topic("restore_curpos", "Restore cursor position ", "R", NULp, AWM_ALL, ED4_restore_curpos); |
---|
1535 | awmm->insert_menu_topic("clear_curpos", "Clear stored positions", "C", NULp, AWM_ALL, makeWindowCallback(ED4_clear_stored_curpos)); |
---|
1536 | awmm->close_sub_menu(); |
---|
1537 | |
---|
1538 | awmm->sep______________(); |
---|
1539 | awmm->insert_menu_topic("change_cursor", "Change cursor type", "t", NULp, AWM_ALL, ED4_change_cursor); |
---|
1540 | awmm->insert_menu_topic(awmm->local_id("view_diff"), "View differences ...", "V", "viewdiff.hlp", AWM_ALL, ED4_create_viewDifferences_window); |
---|
1541 | awmm->sep______________(); |
---|
1542 | awmm->insert_menu_topic("enable_col_stat", "Activate column statistics", "A", "st_ml.hlp", AWM_EXP, ED4_activate_col_stat); |
---|
1543 | awmm->insert_menu_topic("disable_col_stat", "Disable column statistics", "i", "st_ml.hlp", AWM_EXP, ED4_disable_col_stat); |
---|
1544 | awmm->insert_menu_topic("detail_col_stat", "Toggle detailed Col.-Stat.", "C", "st_ml.hlp", AWM_EXP, ED4_toggle_detailed_column_stats); |
---|
1545 | awmm->insert_menu_topic("dcs_threshold", "Set threshold for D.c.s.", "f", "st_ml.hlp", AWM_EXP, makeWindowCallback(ED4_set_col_stat_threshold)); |
---|
1546 | awmm->sep______________(); |
---|
1547 | awmm->insert_menu_topic(awmm->local_id("visualize_SAI"), "Visualize SAIs", "z", "visualizeSAI.hlp", AWM_ALL, ED4_createVisualizeSAI_window); |
---|
1548 | awmm->insert_menu_topic("toggle_saisec", "Toggle secondary info for SAI", "o", "toggle_secinfo.hlp", AWM_ALL, toggle_helix_for_SAI); |
---|
1549 | |
---|
1550 | // Enable ProteinViewer only for DNA sequence type |
---|
1551 | if (alignment_type == GB_AT_DNA) { |
---|
1552 | awmm->insert_menu_topic(awmm->local_id("Protein_Viewer"), "Protein Viewer", "w", "proteinViewer.hlp", AWM_ALL, ED4_CreateProteinViewer_window); |
---|
1553 | } |
---|
1554 | |
---|
1555 | // --------------- |
---|
1556 | // Block |
---|
1557 | |
---|
1558 | awmm->create_menu("Block", "B", AWM_ALL); |
---|
1559 | |
---|
1560 | awmm->insert_menu_topic("select_marked", "Highlight marked species", "e", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_SELECT_MARKED)); |
---|
1561 | awmm->insert_menu_topic("deselect_marked", "De-highlight marked species", "k", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_DESELECT_MARKED)); |
---|
1562 | awmm->insert_menu_topic("select_all", "Highlight all species", "s", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_ALL)); |
---|
1563 | awmm->insert_menu_topic("deselect_all", "De-highlight all species", "D", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_NONE)); |
---|
1564 | awmm->sep______________(); |
---|
1565 | awmm->insert_menu_topic("mark_selected", "Mark highlighted species", "M", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_MARK_SELECTED)); |
---|
1566 | awmm->insert_menu_topic("unmark_selected", "Unmark highlighted species", "n", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_UNMARK_SELECTED)); |
---|
1567 | awmm->insert_menu_topic("unmark_all", "Unmark all species", "U", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_UNMARK_ALL)); |
---|
1568 | awmm->sep______________(); |
---|
1569 | awmm->insert_menu_topic("invert_all", "Invert highlighted species", "I", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_INVERT)); |
---|
1570 | awmm->insert_menu_topic("invert_group", "Invert group", "g", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_INVERT_GROUP)); |
---|
1571 | awmm->sep______________(); |
---|
1572 | awmm->insert_menu_topic("lowcase", "Change to lower case ", "w", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_LOWER_CASE)); |
---|
1573 | awmm->insert_menu_topic("upcase", "Change to upper case", "p", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_UPPER_CASE)); |
---|
1574 | awmm->sep______________(); |
---|
1575 | awmm->insert_menu_topic("reverse", "Reverse highlighted ", "v", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_REVERSE)); |
---|
1576 | awmm->insert_menu_topic("complement", "Complement highlighted ", "o", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_COMPLEMENT)); |
---|
1577 | awmm->insert_menu_topic("reverse_complement", "Reverse complement", "t", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_REVERSE_COMPLEMENT)); |
---|
1578 | awmm->sep______________(); |
---|
1579 | awmm->insert_menu_topic("unalignBlockLeft", "Unalign block left", "a", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_UNALIGN_LEFT)); |
---|
1580 | awmm->insert_menu_topic("unalignBlockCenter", "Unalign block center", "c", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_UNALIGN_CENTER)); |
---|
1581 | awmm->insert_menu_topic("unalignBlockRight", "Unalign block right", "b", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_UNALIGN_RIGHT)); |
---|
1582 | awmm->sep______________(); |
---|
1583 | awmm->insert_menu_topic(awmm->local_id("replace"), "Search & Replace ", "h", "e4_replace.hlp", AWM_ALL, ED4_create_replace_window); |
---|
1584 | awmm->insert_menu_topic(awmm->local_id("setsai"), "Modify SAI ", "y", "e4_modsai.hlp", AWM_ALL, ED4_create_modsai_window); |
---|
1585 | awmm->sep______________(); |
---|
1586 | awmm->insert_menu_topic("toggle_block_type", "Exchange: Line<->Column", "x", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_highlight, ED4_MS_TOGGLE_BLOCKTYPE)); |
---|
1587 | awmm->insert_menu_topic("shift_left", "Shift block left ", "l", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_SHIFT_LEFT)); |
---|
1588 | awmm->insert_menu_topic("shift_right", "Shift block right", "r", "e4_block.hlp", AWM_ALL, makeWindowCallback(ED4_menu_perform_block_operation, ED4_BO_SHIFT_RIGHT)); |
---|
1589 | |
---|
1590 | // -------------------- |
---|
1591 | // Properties |
---|
1592 | |
---|
1593 | awmm->create_menu("Properties", "P", AWM_ALL); |
---|
1594 | |
---|
1595 | awmm->insert_menu_topic(awmm->local_id("props_frame"), "Frame settings ...", "g", NULp, AWM_ALL, AW_preset_window); |
---|
1596 | awmm->insert_menu_topic(awmm->local_id("props_options"), "Editor Options ", "O", "e4_options.hlp", AWM_ALL, ED4_create_editor_options_window); |
---|
1597 | awmm->insert_menu_topic(awmm->local_id("props_consensus"), "Consensus Definition ", "u", "e4_consensus.hlp", AWM_ALL, ED4_create_consensus_definition_window); |
---|
1598 | awmm->sep______________(); |
---|
1599 | |
---|
1600 | awmm->insert_menu_topic("props_data", "Change Colors & Fonts ", "C", NULp, AWM_ALL, makeWindowCallback (ED4_popup_gc_window, first_gc_manager)); |
---|
1601 | awmm->insert_menu_topic(awmm->local_id("props_seq_colors"), "Sequence color mapping", "S", "sequence_colors.hlp", AWM_ALL, makeCreateWindowCallback(ED4_create_seq_colors_window, sequence_colors)); |
---|
1602 | |
---|
1603 | awmm->sep______________(); |
---|
1604 | |
---|
1605 | awmm->insert_menu_topic(awmm->local_id("props_nds"), "Select visible info (NDS) ", "D", "ed4_nds.hlp", AWM_ALL, ED4_create_nds_window); |
---|
1606 | awmm->insert_menu_topic(awmm->local_id("props_flags"), "Select species flags", "f", "ed4_flags.hlp", AWM_ALL, makeCreateWindowCallback(ED4_configure_species_flags, gb_main)); |
---|
1607 | { |
---|
1608 | static WindowCallback reqRelCb = makeWindowCallback(ED4_request_relayout); |
---|
1609 | if (alignment_type == GB_AT_AA) awmm->insert_menu_topic(awmm->local_id("props_pfold"), "Protein Match Settings ", "P", "pfold_props.hlp", AWM_ALL, makeCreateWindowCallback(ED4_pfold_create_props_window, &reqRelCb)); |
---|
1610 | else awmm->insert_menu_topic(awmm->local_id("props_helix_sym"), "Helix Settings ", "H", "helixsym.hlp", AWM_ALL, makeCreateWindowCallback(create_helix_props_window, &reqRelCb)); |
---|
1611 | } |
---|
1612 | awmm->insert_menu_topic(awmm->local_id("props_key_map"), "Key Mappings ", "K", "nekey_map.hlp", AWM_ALL, create_key_map_window); |
---|
1613 | |
---|
1614 | awmm->sep______________(); |
---|
1615 | AW_insert_common_property_menu_entries(awmm); |
---|
1616 | awmm->sep______________(); |
---|
1617 | awmm->insert_sub_menu("Save properties ...", "a"); |
---|
1618 | { |
---|
1619 | static const char * const tag[] = { "save_alispecific_props", "save_alitype_props", "save_props" }; |
---|
1620 | static const char * const entry_type[] = { "alignment specific ", "ali-type specific ", "" }; |
---|
1621 | |
---|
1622 | // check what is the default mode |
---|
1623 | int default_mode = -1; |
---|
1624 | for (int mode = 0; mode <= 2; ++mode) { |
---|
1625 | if (strcmp(GB_path_in_arbprop(propertyName(gb_main, mode)), db_name) == 0) { |
---|
1626 | default_mode = mode; |
---|
1627 | break; |
---|
1628 | } |
---|
1629 | } |
---|
1630 | if (default_mode == -1) default_mode = 2; // no properties yet -> use 'edit4.arb' |
---|
1631 | |
---|
1632 | const char *entry = GBS_global_string("Save loaded Properties (%s)", propertyName(gb_main, default_mode)); |
---|
1633 | awmm->insert_menu_topic("save_loaded_props", entry, "l", "e4_defaults.hlp", AWM_ALL, makeWindowCallback(ED4_save_properties, default_mode)); |
---|
1634 | awmm->sep______________(); |
---|
1635 | |
---|
1636 | for (int mode = 2; mode >= 0; --mode) { |
---|
1637 | char hotkey[] = "x"; |
---|
1638 | hotkey[0] = "Pta"[mode]; |
---|
1639 | entry = GBS_global_string("Save %sProperties (%s)", entry_type[mode], propertyName(gb_main, mode)); |
---|
1640 | awmm->insert_menu_topic(tag[mode], entry, hotkey, "e4_defaults.hlp", AWM_ALL, makeWindowCallback(ED4_save_properties, mode)); |
---|
1641 | } |
---|
1642 | } |
---|
1643 | awmm->close_sub_menu(); |
---|
1644 | |
---|
1645 | awmm->insert_help_topic("ARB_EDIT4 help", "E", "e4.hlp", AWM_ALL, makeHelpCallback("e4.hlp")); |
---|
1646 | |
---|
1647 | // ---------------------------------------------------------------------------------------------------- |
---|
1648 | |
---|
1649 | aw_root->awar_int(AWAR_EDIT_TITLE_MODE)->add_callback(makeRootCallback(title_mode_changed, static_cast<AW_window*>(awmm))); |
---|
1650 | awmm->set_bottom_area_height(0); // No bottom area |
---|
1651 | |
---|
1652 | awmm->auto_space(5, -2); |
---|
1653 | awmm->shadow_width(3); |
---|
1654 | |
---|
1655 | int db_pathx, db_pathy; |
---|
1656 | awmm->get_at_position(&db_pathx, &db_pathy); |
---|
1657 | |
---|
1658 | awmm->shadow_width(1); |
---|
1659 | awmm->load_xfig("edit4/editmenu.fig", false); |
---|
1660 | |
---|
1661 | // -------------------------- |
---|
1662 | // help /quit /fold |
---|
1663 | |
---|
1664 | awmm->button_length(0); |
---|
1665 | |
---|
1666 | awmm->at("quit"); |
---|
1667 | awmm->callback(ED4_quit_editor); |
---|
1668 | awmm->help_text("quit.hlp"); |
---|
1669 | |
---|
1670 | if (clone) awmm->create_button("CLOSE", "#close.xpm"); |
---|
1671 | else awmm->create_button("QUIT", "#quit.xpm"); |
---|
1672 | |
---|
1673 | awmm->at("help"); |
---|
1674 | awmm->callback(AW_help_entry_pressed); |
---|
1675 | awmm->help_text("e4.hlp"); |
---|
1676 | awmm->create_button("HELP", "#help.xpm"); |
---|
1677 | |
---|
1678 | awmm->at("fold"); |
---|
1679 | awmm->help_text("e4.hlp"); |
---|
1680 | awmm->create_toggle(AWAR_EDIT_TITLE_MODE, "#more.xpm", "#less.xpm"); |
---|
1681 | |
---|
1682 | // ------------------- |
---|
1683 | // positions |
---|
1684 | |
---|
1685 | awmm->button_length(0); |
---|
1686 | |
---|
1687 | awmm->at("posTxt"); awmm->create_button(NULp, "Position"); |
---|
1688 | |
---|
1689 | awmm->button_length(6+1); |
---|
1690 | |
---|
1691 | awmm->at("ecoliTxt"); awmm->create_button(NULp, ED4_AWAR_NDS_ECOLI_NAME, NULp, "+"); |
---|
1692 | |
---|
1693 | awmm->button_length(0); |
---|
1694 | |
---|
1695 | awmm->at("baseTxt"); awmm->create_button(NULp, "Base"); |
---|
1696 | awmm->at("iupacTxt"); awmm->create_button(NULp, "IUPAC"); |
---|
1697 | awmm->at("helixnrTxt"); awmm->create_button(NULp, "Helix#"); |
---|
1698 | |
---|
1699 | awmm->at("pos"); |
---|
1700 | awmm->callback(makeWindowCallback(ED4_jump_to_cursor_position, current_ed4w()->awar_path_for_cursor, ED4_POS_SEQUENCE)); // @@@ used as INPUTFIELD_CB (see #559) |
---|
1701 | awmm->create_input_field(current_ed4w()->awar_path_for_cursor, 7); |
---|
1702 | |
---|
1703 | awmm->at("ecoli"); |
---|
1704 | awmm->callback(makeWindowCallback(ED4_jump_to_cursor_position, current_ed4w()->awar_path_for_Ecoli, ED4_POS_ECOLI)); // @@@ used as INPUTFIELD_CB (see #559) |
---|
1705 | awmm->create_input_field(current_ed4w()->awar_path_for_Ecoli, 6); |
---|
1706 | |
---|
1707 | awmm->at("base"); |
---|
1708 | awmm->callback(makeWindowCallback(ED4_jump_to_cursor_position, current_ed4w()->awar_path_for_basePos, ED4_POS_BASE)); // @@@ used as INPUTFIELD_CB (see #559) |
---|
1709 | awmm->create_input_field(current_ed4w()->awar_path_for_basePos, 6); |
---|
1710 | |
---|
1711 | awmm->at("iupac"); |
---|
1712 | awmm->callback(makeWindowCallback(ED4_set_iupac, current_ed4w()->awar_path_for_IUPAC)); // @@@ used as INPUTFIELD_CB (see #559) |
---|
1713 | awmm->create_input_field(current_ed4w()->awar_path_for_IUPAC, 4); |
---|
1714 | |
---|
1715 | awmm->at("helixnr"); |
---|
1716 | awmm->callback(makeWindowCallback(ED4_set_helixnr, current_ed4w()->awar_path_for_helixNr)); // @@@ used as INPUTFIELD_CB (see #559) |
---|
1717 | awmm->create_input_field(current_ed4w()->awar_path_for_helixNr, 5); |
---|
1718 | |
---|
1719 | // ---------------------------- |
---|
1720 | // jump/get/undo/redo |
---|
1721 | |
---|
1722 | awmm->button_length(4); |
---|
1723 | |
---|
1724 | awmm->at("jump"); |
---|
1725 | awmm->callback(ED4_jump_to_current_species); |
---|
1726 | awmm->help_text("e4_get_species.hlp"); |
---|
1727 | awmm->create_button("JUMP", "Jump"); |
---|
1728 | |
---|
1729 | awmm->at("get"); |
---|
1730 | awmm->callback(makeWindowCallback(ED4_get_and_jump_to_current)); |
---|
1731 | awmm->help_text("e4_get_species.hlp"); |
---|
1732 | awmm->create_button("GET", "Get"); |
---|
1733 | |
---|
1734 | awmm->button_length(0); |
---|
1735 | |
---|
1736 | awmm->at("undo"); |
---|
1737 | awmm->callback(makeWindowCallback(ED4_undo_redo, GB_UNDO_UNDO)); |
---|
1738 | awmm->help_text("undo.hlp"); |
---|
1739 | awmm->create_button("UNDO", "#undo.xpm"); |
---|
1740 | |
---|
1741 | awmm->at("redo"); |
---|
1742 | awmm->callback(makeWindowCallback(ED4_undo_redo, GB_UNDO_REDO)); |
---|
1743 | awmm->help_text("undo.hlp"); |
---|
1744 | awmm->create_button("REDO", "#redo.xpm"); |
---|
1745 | |
---|
1746 | // -------------------------- |
---|
1747 | // aligner / SAIviz |
---|
1748 | |
---|
1749 | awmm->button_length(7); |
---|
1750 | |
---|
1751 | awmm->at("aligner"); |
---|
1752 | awmm->callback(makeCreateWindowCallback(ED4_create_faligner_window, ED4_get_aligner_data_access())); |
---|
1753 | awmm->help_text("faligner.hlp"); |
---|
1754 | awmm->create_button("ALIGNER", "Aligner"); |
---|
1755 | |
---|
1756 | awmm->at("saiviz"); |
---|
1757 | awmm->callback(ED4_createVisualizeSAI_window); |
---|
1758 | awmm->help_text("visualizeSAI.hlp"); |
---|
1759 | awmm->create_button("SAIVIZ", "SAIviz"); |
---|
1760 | |
---|
1761 | // ------------------------------------------- |
---|
1762 | // align/insert/protection/direction |
---|
1763 | |
---|
1764 | awmm->button_length(0); |
---|
1765 | |
---|
1766 | awmm->at("protect"); |
---|
1767 | awmm->create_option_menu(AWAR_EDIT_SECURITY_LEVEL, true); |
---|
1768 | awmm->insert_option ("0", NULp, 0); |
---|
1769 | awmm->insert_option ("1", NULp, 1); |
---|
1770 | awmm->insert_option ("2", NULp, 2); |
---|
1771 | awmm->insert_option ("3", NULp, 3); |
---|
1772 | awmm->insert_option ("4", NULp, 4); |
---|
1773 | awmm->insert_option ("5", NULp, 5); |
---|
1774 | awmm->insert_default_option("6", NULp, 6); |
---|
1775 | awmm->update_option_menu(); |
---|
1776 | |
---|
1777 | // draw protection icon AFTER protection!! |
---|
1778 | awmm->at("pico"); |
---|
1779 | awmm->create_button(NULp, "#protect.xpm"); |
---|
1780 | |
---|
1781 | // draw align/edit-button AFTER protection!! |
---|
1782 | awmm->at("edit"); |
---|
1783 | awmm->create_toggle(AWAR_EDIT_MODE, "#edit/align.xpm", "#edit/editseq.xpm", 7); |
---|
1784 | |
---|
1785 | awmm->at("insert"); |
---|
1786 | awmm->create_text_toggle(AWAR_INSERT_MODE, "Replace", "Insert", 7); |
---|
1787 | |
---|
1788 | awmm->at("direct"); |
---|
1789 | awmm->create_toggle(AWAR_EDIT_RIGHTWARD, "#edit/3to5.xpm", "#edit/5to3.xpm", 7); |
---|
1790 | |
---|
1791 | // ------------------------- |
---|
1792 | // secedit / rna3d |
---|
1793 | |
---|
1794 | int xoffset = 0; |
---|
1795 | |
---|
1796 | if (alignment_type == GB_AT_RNA) { // if the database contains valid alignment of rRNA sequences |
---|
1797 | // add buttons for RNA3D and SECEDIT plugins |
---|
1798 | |
---|
1799 | awmm->button_length(0); |
---|
1800 | |
---|
1801 | awmm->at("secedit"); |
---|
1802 | awmm->callback(makeWindowCallback(ED4_start_plugin, gb_main, "SECEDIT")); |
---|
1803 | awmm->help_text("arb_secedit.hlp"); |
---|
1804 | awmm->create_button("SECEDIT", "#edit/secedit.xpm"); |
---|
1805 | |
---|
1806 | #if defined(ARB_OPENGL) |
---|
1807 | awmm->at("rna3d"); |
---|
1808 | awmm->callback(makeWindowCallback(ED4_start_plugin, gb_main, "RNA3D")); |
---|
1809 | awmm->help_text("rna3d_general.hlp"); |
---|
1810 | awmm->create_button("RNA3D", "#edit/rna3d.xpm"); |
---|
1811 | #endif // ARB_OPENGL |
---|
1812 | } |
---|
1813 | else { |
---|
1814 | awmm->at("secedit"); |
---|
1815 | int xsecedit = awmm->get_at_xposition(); |
---|
1816 | awmm->at("zoom"); |
---|
1817 | int xzoom = awmm->get_at_xposition(); |
---|
1818 | xoffset = xsecedit-xzoom; // shift message stuff to the left by xoffset |
---|
1819 | } |
---|
1820 | |
---|
1821 | { |
---|
1822 | int x, y; |
---|
1823 | |
---|
1824 | awmm->at("zoom"); |
---|
1825 | if (xoffset) { awmm->get_at_position(&x, &y); awmm->at(x+xoffset, y); } |
---|
1826 | awmm->callback(ED4_zoom_message_window); |
---|
1827 | awmm->create_button("ZOOM", "#edit/zoom.xpm"); |
---|
1828 | |
---|
1829 | awmm->at("clear"); |
---|
1830 | if (xoffset) { awmm->get_at_position(&x, &y); awmm->at(x+xoffset, y); } |
---|
1831 | awmm->callback(aw_clear_message_cb); |
---|
1832 | awmm->create_button("CLEAR", "#edit/clear.xpm"); |
---|
1833 | |
---|
1834 | awmm->at("errortext"); |
---|
1835 | if (xoffset) { awmm->get_at_position(&x, &y); awmm->at(x+xoffset, y); } |
---|
1836 | aw_root->awar_string(AWAR_ERROR_MESSAGES, "This is ARB Edit4 [Build " ARB_VERSION "]"); |
---|
1837 | awmm->create_text_field(AWAR_ERROR_MESSAGES); |
---|
1838 | aw_set_local_message(); |
---|
1839 | } |
---|
1840 | |
---|
1841 | // --------------------- |
---|
1842 | // 'more' area |
---|
1843 | |
---|
1844 | awmm->at("cons"); |
---|
1845 | awmm->create_toggle(ED4_AWAR_CONSENSUS_SHOW, "#edit/nocons.xpm", "#edit/cons.xpm"); |
---|
1846 | |
---|
1847 | awmm->at("num"); |
---|
1848 | awmm->create_toggle(ED4_AWAR_DIGITS_AS_REPEAT, "#edit/norepeat.xpm", "#edit/repeat.xpm"); |
---|
1849 | |
---|
1850 | awmm->at("key"); |
---|
1851 | awmm->create_toggle("key_mapping/enable", "#edit/nokeymap.xpm", "#edit/keymap.xpm"); |
---|
1852 | |
---|
1853 | // search |
---|
1854 | |
---|
1855 | awmm->button_length(0); |
---|
1856 | #define INSERT_SEARCH_FIELDS(Short, label_prefix, prefix) \ |
---|
1857 | insert_search_fields(awmm, \ |
---|
1858 | #label_prefix, \ |
---|
1859 | #prefix, \ |
---|
1860 | ED4_AWAR_##prefix##_SEARCH_PATTERN, \ |
---|
1861 | ED4_AWAR_##prefix##_SEARCH_SHOW, \ |
---|
1862 | Short, \ |
---|
1863 | ED4_##prefix##_PATTERN, \ |
---|
1864 | current_ed4w() \ |
---|
1865 | ) |
---|
1866 | |
---|
1867 | INSERT_SEARCH_FIELDS(0, u1, USER1); |
---|
1868 | INSERT_SEARCH_FIELDS(0, u2, USER2); |
---|
1869 | INSERT_SEARCH_FIELDS(0, pro, PROBE); |
---|
1870 | INSERT_SEARCH_FIELDS(1, pri1, PRIMER1); |
---|
1871 | INSERT_SEARCH_FIELDS(1, pri2, PRIMER2); |
---|
1872 | INSERT_SEARCH_FIELDS(1, pri3, PRIMER3); |
---|
1873 | INSERT_SEARCH_FIELDS(1, sig1, SIG1); |
---|
1874 | INSERT_SEARCH_FIELDS(1, sig2, SIG2); |
---|
1875 | INSERT_SEARCH_FIELDS(1, sig3, SIG3); |
---|
1876 | |
---|
1877 | #undef INSERT_SEARCH_FIELDS |
---|
1878 | |
---|
1879 | awmm->at("alast"); |
---|
1880 | awmm->callback(makeWindowCallback(ED4_search_cb, ED4_encodeSearchDescriptor(-1, ED4_ANY_PATTERN), current_ed4w())); |
---|
1881 | awmm->create_button("ALL_SEARCH_LAST", "#edit/last.xpm"); |
---|
1882 | |
---|
1883 | awmm->at("anext"); |
---|
1884 | awmm->callback(makeWindowCallback(ED4_search_cb, ED4_encodeSearchDescriptor(+1, ED4_ANY_PATTERN), current_ed4w())); |
---|
1885 | awmm->create_button("ALL_SEARCH_NEXT", "#edit/next.xpm"); |
---|
1886 | |
---|
1887 | title_mode_changed(aw_root, awmm); |
---|
1888 | |
---|
1889 | // Buttons at left window border |
---|
1890 | |
---|
1891 | awmm->create_mode("edit/arrow.xpm", "e4_mode.hlp", AWM_ALL, makeWindowCallback(modes_cb, ED4_SM_MOVE)); |
---|
1892 | awmm->create_mode("edit/kill.xpm", "e4_mode.hlp", AWM_ALL, makeWindowCallback(modes_cb, ED4_SM_KILL)); |
---|
1893 | awmm->create_mode("edit/mark.xpm", "e4_mode.hlp", AWM_ALL, makeWindowCallback(modes_cb, ED4_SM_MARK)); |
---|
1894 | awmm->create_mode("mode_info.xpm", "e4_mode.hlp", AWM_ALL, makeWindowCallback(modes_cb, ED4_SM_INFO)); |
---|
1895 | |
---|
1896 | FastAligner_create_variables(awmm->get_root(), props_db); |
---|
1897 | |
---|
1898 | #if defined(DEBUG) |
---|
1899 | AWT_check_action_ids(awmm->get_root(), ""); |
---|
1900 | #endif |
---|
1901 | |
---|
1902 | announce_useraction_in(awmm); |
---|
1903 | |
---|
1904 | return ED4_R_OK; |
---|
1905 | } |
---|
1906 | |
---|
1907 | AW_window *ED4_root::create_first_window() { |
---|
1908 | // Note: other windows are generated by generate_window |
---|
1909 | AW_device *device = NULp; |
---|
1910 | ED4_window *new_window = NULp; |
---|
1911 | |
---|
1912 | generate_window(&device, &new_window); |
---|
1913 | |
---|
1914 | ED4_LocalWinContext uses(new_window); |
---|
1915 | |
---|
1916 | ED4_calc_terminal_extentions(); // (Note: done again later, but otherwise variables are used uninitialized); |
---|
1917 | |
---|
1918 | DRAW = 1; |
---|
1919 | move_cursor = 0; |
---|
1920 | max_seq_terminal_length = 0; |
---|
1921 | |
---|
1922 | ED4_init_notFoundMessage(); |
---|
1923 | |
---|
1924 | return new_window->aww; |
---|
1925 | } |
---|
1926 | |
---|
1927 | ED4_index ED4_root::pixel2pos(AW_pos click_x) { |
---|
1928 | // 'click_x' is the x-offset into the terminal in pixels |
---|
1929 | // returns the x-offset into the terminal in base positions (clipped to max. allowed position) |
---|
1930 | |
---|
1931 | int length_of_char = font_group.get_width(ED4_G_SEQUENCES); |
---|
1932 | ED4_index scr_pos = int((click_x-CHARACTEROFFSET) / length_of_char); |
---|
1933 | int max_scrpos = root_group_man->remap()->get_max_screen_pos(); |
---|
1934 | |
---|
1935 | if (scr_pos>max_scrpos) scr_pos = max_scrpos; |
---|
1936 | |
---|
1937 | return scr_pos; |
---|
1938 | } |
---|
1939 | |
---|
1940 | inline char *detectProperties(GBDATA *gb_main) { |
---|
1941 | char *propname = NULp; |
---|
1942 | |
---|
1943 | // check if edit4_?na.arb / edit4_ali_???.arb exist in $ARB_PROP |
---|
1944 | for (int mode = 0; !propname && mode <= 1; ++mode) { |
---|
1945 | const char *fullprop = GB_path_in_arbprop(propertyName(gb_main, mode)); |
---|
1946 | if (GB_is_regularfile(fullprop)) { |
---|
1947 | freedup(propname, fullprop); |
---|
1948 | } |
---|
1949 | } |
---|
1950 | |
---|
1951 | // if not, use 'mode 2', i.e. "edit4.arb" |
---|
1952 | // (no full path, we want to load default from arb_defaults) |
---|
1953 | if (!propname) propname = ARB_strdup(propertyName(gb_main, 2)); |
---|
1954 | |
---|
1955 | return propname; |
---|
1956 | } |
---|
1957 | |
---|
1958 | ED4_root::ED4_root(GBDATA *gb_main_) |
---|
1959 | : most_recently_used_window(NULp), |
---|
1960 | cons_param(NULp), |
---|
1961 | gb_main(gb_main_), |
---|
1962 | db_name(detectProperties(gb_main)), |
---|
1963 | aw_root(AWT_create_root(db_name, "ARB_EDIT4", need_macro_ability())), |
---|
1964 | props_db(AW_ROOT_DEFAULT), |
---|
1965 | first_window(NULp), |
---|
1966 | main_manager(NULp), |
---|
1967 | middle_area_man(NULp), |
---|
1968 | top_area_man(NULp), |
---|
1969 | root_group_man(NULp), |
---|
1970 | selected_objects(new ED4_selected_list), |
---|
1971 | folding_action(false), |
---|
1972 | species_mode(ED4_SM_MOVE), |
---|
1973 | ecoli_ref(NULp), |
---|
1974 | alignment_name(NULp), |
---|
1975 | alignment_type(GB_AT_UNKNOWN), |
---|
1976 | reference(NULp), |
---|
1977 | sequence_colors(NULp), |
---|
1978 | gc_manager(NULp), |
---|
1979 | st_ml(NULp), |
---|
1980 | helix(NULp), |
---|
1981 | helix_spacing(0), |
---|
1982 | helix_add_spacing(0), |
---|
1983 | terminal_add_spacing(0), |
---|
1984 | protstruct(NULp), |
---|
1985 | protstruct_len(0), |
---|
1986 | edk(NULp), |
---|
1987 | column_stat_activated(false), |
---|
1988 | column_stat_initialized(false), |
---|
1989 | visualizeSAI(false), |
---|
1990 | visualizeSAI_allSpecies(false), |
---|
1991 | loadable_SAIs(LSAI_UNUSED), |
---|
1992 | temp_gc(0) |
---|
1993 | {} |
---|
1994 | |
---|
1995 | |
---|
1996 | ED4_root::~ED4_root() { |
---|
1997 | delete aw_root; |
---|
1998 | delete first_window; |
---|
1999 | delete reference; // needs to be deleted before main_manager (to ensure reference callbacks are removed) |
---|
2000 | delete main_manager; // also deletes middle_area_man + top_area_man |
---|
2001 | delete ecoli_ref; |
---|
2002 | delete selected_objects; |
---|
2003 | delete helix; |
---|
2004 | delete sequence_colors; |
---|
2005 | delete edk; |
---|
2006 | STAT_destroy_ST_ML(st_ml); |
---|
2007 | |
---|
2008 | free(protstruct); |
---|
2009 | free(db_name); |
---|
2010 | free(alignment_name); |
---|
2011 | } |
---|