1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : NT_extern.cxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #include "map_viewer.h" |
---|
12 | #include "NT_local.h" |
---|
13 | #include "ad_trees.h" |
---|
14 | #include "NT_cb.h" |
---|
15 | |
---|
16 | #include <seq_quality.h> |
---|
17 | #include <multi_probe.hxx> |
---|
18 | #include <st_window.hxx> |
---|
19 | #include <GEN.hxx> |
---|
20 | #include <EXP.hxx> |
---|
21 | |
---|
22 | #include <TreeCallbacks.hxx> |
---|
23 | #include <AW_rename.hxx> |
---|
24 | #include <probe_design.hxx> |
---|
25 | #include <primer_design.hxx> |
---|
26 | #include <gde.hxx> |
---|
27 | #include <awtc_submission.hxx> |
---|
28 | |
---|
29 | #include <awti_export.hxx> |
---|
30 | |
---|
31 | #include <awt.hxx> |
---|
32 | #include <macros.hxx> |
---|
33 | #include <awt_config_manager.hxx> |
---|
34 | #include <awt_input_mask.hxx> |
---|
35 | #include <awt_sel_boxes.hxx> |
---|
36 | #include <awt_www.hxx> |
---|
37 | #include <nds.h> |
---|
38 | |
---|
39 | #include <db_query.h> |
---|
40 | #include <dbui.h> |
---|
41 | |
---|
42 | #include <aw_advice.hxx> |
---|
43 | #include <aw_preset.hxx> |
---|
44 | #include <aw_awars.hxx> |
---|
45 | #include <aw_global_awars.hxx> |
---|
46 | #include <aw_file.hxx> |
---|
47 | #include <aw_msg.hxx> |
---|
48 | #include <arb_progress.h> |
---|
49 | #include <aw_root.hxx> |
---|
50 | #include <aw_question.hxx> |
---|
51 | #include <arb_strbuf.h> |
---|
52 | #include <arb_strarray.h> |
---|
53 | #include <arb_file.h> |
---|
54 | |
---|
55 | #include <arb_version.h> |
---|
56 | #include <refentries.h> |
---|
57 | |
---|
58 | #define AWAR_EXPORT_NDS "tmp/export_nds" |
---|
59 | #define AWAR_EXPORT_NDS_SEPARATOR AWAR_EXPORT_NDS "/separator" |
---|
60 | #define AWAR_MARKED_SPECIES_COUNTER "tmp/disp_marked_species" |
---|
61 | #define AWAR_NTREE_TITLE_MODE "tmp/title_mode" |
---|
62 | |
---|
63 | void create_probe_design_variables(AW_root *aw_root, AW_default def, AW_default global); |
---|
64 | void create_cprofile_var(AW_root *aw_root, AW_default aw_def); |
---|
65 | |
---|
66 | void create_insertDeleteColumn_variables(AW_root *root, AW_default db1); |
---|
67 | AW_window *create_insertDeleteColumn_window(AW_root *root); |
---|
68 | AW_window *create_insertDeleteBySAI_window(AW_root *root, AW_CL cl_gbmain); |
---|
69 | |
---|
70 | AW_window *create_tree_window(AW_root *aw_root, AWT_graphic *awd); |
---|
71 | |
---|
72 | static void nt_changesecurity(AW_root *aw_root) { |
---|
73 | int level = aw_root->awar(AWAR_SECURITY_LEVEL)->read_int(); |
---|
74 | GB_push_transaction(GLOBAL.gb_main); |
---|
75 | GB_change_my_security(GLOBAL.gb_main, level); |
---|
76 | GB_pop_transaction(GLOBAL.gb_main); |
---|
77 | } |
---|
78 | |
---|
79 | static void export_nds_cb(AW_window *aww, AW_CL print_flag) { |
---|
80 | GB_transaction dummy(GLOBAL.gb_main); |
---|
81 | GBDATA *gb_species; |
---|
82 | const char *buf; |
---|
83 | AW_root *aw_root = aww->get_root(); |
---|
84 | char *name = aw_root->awar(AWAR_EXPORT_NDS"/file_name")->read_string(); |
---|
85 | FILE *out = fopen(name, "w"); |
---|
86 | |
---|
87 | if (!out) { |
---|
88 | delete name; |
---|
89 | aw_message("Error: Cannot open and write to file"); |
---|
90 | return; |
---|
91 | } |
---|
92 | make_node_text_init(GLOBAL.gb_main); |
---|
93 | NDS_Type nds_type = (NDS_Type)aw_root->awar(AWAR_EXPORT_NDS_SEPARATOR)->read_int(); |
---|
94 | char *tree_name = aw_root->awar(AWAR_TREE)->read_string(); |
---|
95 | |
---|
96 | for (gb_species = GBT_first_marked_species(GLOBAL.gb_main); |
---|
97 | gb_species; |
---|
98 | gb_species = GBT_next_marked_species(gb_species)) |
---|
99 | { |
---|
100 | buf = make_node_text_nds(GLOBAL.gb_main, gb_species, nds_type, 0, tree_name); |
---|
101 | fprintf(out, "%s\n", buf); |
---|
102 | } |
---|
103 | AW_refresh_fileselection(aw_root, AWAR_EXPORT_NDS); |
---|
104 | fclose(out); |
---|
105 | if (print_flag) { |
---|
106 | GB_ERROR error = GB_textprint(name); |
---|
107 | if (error) aw_message(error); |
---|
108 | } |
---|
109 | free(tree_name); |
---|
110 | free(name); |
---|
111 | } |
---|
112 | |
---|
113 | static AW_window *create_nds_export_window(AW_root *root) { |
---|
114 | AW_window_simple *aws = new AW_window_simple; |
---|
115 | aws->init(root, "EXPORT_NDS_OF_MARKED", "EXPORT NDS OF MARKED SPECIES"); |
---|
116 | aws->load_xfig("sel_box_nds.fig"); |
---|
117 | |
---|
118 | aws->callback((AW_CB0)AW_POPDOWN); |
---|
119 | aws->at("close"); |
---|
120 | aws->create_button("CLOSE", "CLOSE", "C"); |
---|
121 | |
---|
122 | aws->callback(AW_POPUP_HELP, (AW_CL)"arb_export_nds.hlp"); |
---|
123 | aws->at("help"); |
---|
124 | aws->create_button("HELP", "HELP", "H"); |
---|
125 | |
---|
126 | aws->callback((AW_CB0)AW_POPDOWN); |
---|
127 | aws->at("cancel"); |
---|
128 | aws->create_button("CLOSE", "CANCEL", "C"); |
---|
129 | |
---|
130 | aws->at("save"); |
---|
131 | aws->callback(export_nds_cb, 0); |
---|
132 | aws->create_button("SAVE", "SAVE", "S"); |
---|
133 | |
---|
134 | aws->at("print"); |
---|
135 | aws->callback(export_nds_cb, 1); |
---|
136 | aws->create_button("PRINT", "PRINT", "P"); |
---|
137 | |
---|
138 | aws->at("toggle1"); |
---|
139 | aws->label("Column output"); |
---|
140 | aws->create_option_menu(AWAR_EXPORT_NDS_SEPARATOR); |
---|
141 | aws->insert_default_option("Space padded", "S", NDS_OUTPUT_SPACE_PADDED); |
---|
142 | aws->insert_option ("TAB separated", "T", NDS_OUTPUT_TAB_SEPARATED); |
---|
143 | aws->insert_option ("Comma separated", "C", NDS_OUTPUT_COMMA_SEPARATED); |
---|
144 | aws->update_option_menu(); |
---|
145 | |
---|
146 | AW_create_fileselection(aws, AWAR_EXPORT_NDS); |
---|
147 | |
---|
148 | return aws; |
---|
149 | } |
---|
150 | |
---|
151 | static void create_export_nds_awars(AW_root *awr, AW_default def) |
---|
152 | { |
---|
153 | AW_create_fileselection_awars(awr, AWAR_EXPORT_NDS, "", ".nds", "export.nds", def); |
---|
154 | awr->awar_int(AWAR_EXPORT_NDS_SEPARATOR, NDS_OUTPUT_SPACE_PADDED, def); |
---|
155 | } |
---|
156 | |
---|
157 | static void AWAR_INFO_BUTTON_TEXT_change_cb(AW_root *awr) { |
---|
158 | char *value = awr->awar(AWAR_SPECIES_NAME)->read_string(); |
---|
159 | awr->awar(AWAR_INFO_BUTTON_TEXT)->write_string(value[0] ? value : "Species Info"); |
---|
160 | free(value); |
---|
161 | } |
---|
162 | |
---|
163 | static void expert_mode_changed_cb(AW_root *aw_root) { |
---|
164 | aw_root->awar(AWAR_AWM_MASK)->write_int(aw_root->awar(AWAR_EXPERT)->read_int() ? AWM_ALL : AWM_BASIC); // publish expert-mode globally |
---|
165 | } |
---|
166 | |
---|
167 | static void NT_toggle_expert_mode(AW_window *aww, AW_CL, AW_CL) { aww->get_root()->awar(AWAR_EXPERT)->toggle_toggle(); } |
---|
168 | static void NT_toggle_focus_policy(AW_window *aww, AW_CL, AW_CL) { aww->get_root()->awar(AWAR_AW_FOCUS_FOLLOWS_MOUSE)->toggle_toggle(); } |
---|
169 | |
---|
170 | static void nt_create_all_awars(AW_root *awr, AW_default def) { |
---|
171 | // creates awars for all modules reachable from ARB_NT main window |
---|
172 | |
---|
173 | awr->awar_string(AWAR_FOOTER, "", def); |
---|
174 | if (GB_read_clients(GLOBAL.gb_main)>=0) { |
---|
175 | awr->awar_string(AWAR_TREE, "", GLOBAL.gb_main); |
---|
176 | } |
---|
177 | else { |
---|
178 | awr->awar_string(AWAR_TREE, "", def); |
---|
179 | } |
---|
180 | |
---|
181 | awr->awar_string(AWAR_SPECIES_NAME, "", GLOBAL.gb_main); |
---|
182 | awr->awar_string(AWAR_SAI_NAME, "", GLOBAL.gb_main); |
---|
183 | awr->awar_string(AWAR_SAI_GLOBAL, "", GLOBAL.gb_main); |
---|
184 | awr->awar_string(AWAR_MARKED_SPECIES_COUNTER, "unknown", GLOBAL.gb_main); |
---|
185 | awr->awar_string(AWAR_INFO_BUTTON_TEXT, "Species Info", GLOBAL.gb_main); |
---|
186 | awr->awar(AWAR_SPECIES_NAME)->add_callback(AWAR_INFO_BUTTON_TEXT_change_cb); |
---|
187 | awr->awar_int(AWAR_NTREE_TITLE_MODE, 1); |
---|
188 | |
---|
189 | awr->awar_string(AWAR_SAI_COLOR_STR, "", GLOBAL.gb_main); // sai visualization in probe match |
---|
190 | |
---|
191 | GEN_create_awars(awr, def, GLOBAL.gb_main); |
---|
192 | EXP_create_awars(awr, def, GLOBAL.gb_main); |
---|
193 | #if defined(DEBUG) |
---|
194 | AWT_create_db_browser_awars(awr, def); |
---|
195 | #endif // DEBUG |
---|
196 | |
---|
197 | AW_create_namesadmin_awars(awr, GLOBAL.gb_main); |
---|
198 | |
---|
199 | awr->awar_int(AWAR_SECURITY_LEVEL, 0, def); |
---|
200 | awr->awar(AWAR_SECURITY_LEVEL)->add_callback(nt_changesecurity); |
---|
201 | #if defined(DEBUG) && 0 |
---|
202 | awr->awar(AWAR_SECURITY_LEVEL)->write_int(6); // no security for debugging.. |
---|
203 | #endif // DEBUG |
---|
204 | |
---|
205 | create_insertDeleteColumn_variables(awr, def); |
---|
206 | create_probe_design_variables(awr, def, GLOBAL.gb_main); |
---|
207 | create_primer_design_variables(awr, def, GLOBAL.gb_main); |
---|
208 | create_trees_var(awr, def); |
---|
209 | DBUI::create_dbui_awars(awr, def); |
---|
210 | AP_create_consensus_var(awr, def); |
---|
211 | GDE_create_var(awr, def, GLOBAL.gb_main); |
---|
212 | create_cprofile_var(awr, def); |
---|
213 | NT_create_transpro_variables(awr, def); |
---|
214 | NT_build_resort_awars(awr, def); |
---|
215 | NT_create_trackAliChanges_Awars(awr, GLOBAL.gb_main); |
---|
216 | |
---|
217 | NT_create_alignment_vars(awr, def); |
---|
218 | create_nds_vars(awr, def, GLOBAL.gb_main); |
---|
219 | create_export_nds_awars(awr, def); |
---|
220 | awt_create_dtree_awars(awr, GLOBAL.gb_main); |
---|
221 | |
---|
222 | awr->awar_string(AWAR_ERROR_MESSAGES, "", GLOBAL.gb_main); |
---|
223 | awr->awar_string(AWAR_DB_COMMENT, "<no description>", GLOBAL.gb_main); |
---|
224 | |
---|
225 | AWTC_create_submission_variables(awr, GLOBAL.gb_main); |
---|
226 | NT_createConcatenationAwars(awr, def); |
---|
227 | NT_createValidNamesAwars(awr, def); // lothar |
---|
228 | SQ_create_awars(awr, def); |
---|
229 | RefEntries::create_refentries_awars(awr, def); |
---|
230 | |
---|
231 | GB_ERROR error = ARB_bind_global_awars(GLOBAL.gb_main); |
---|
232 | if (!error) { |
---|
233 | AW_awar *awar_expert = awr->awar(AWAR_EXPERT); |
---|
234 | awar_expert->add_callback(expert_mode_changed_cb); |
---|
235 | awar_expert->touch(); |
---|
236 | |
---|
237 | awt_create_aww_vars(awr, def); |
---|
238 | } |
---|
239 | |
---|
240 | if (error) aw_message(error); |
---|
241 | } |
---|
242 | |
---|
243 | // -------------------------------------------------------------------------------- |
---|
244 | |
---|
245 | bool nt_disconnect_from_db(AW_root *aw_root, GBDATA*& gb_main_ref) { |
---|
246 | // ask user if DB was not saved |
---|
247 | // returns true if user allows to quit |
---|
248 | |
---|
249 | // @@@ code here could as well be applied to both merge DBs |
---|
250 | // - question about saving only with target DB! |
---|
251 | |
---|
252 | if (gb_main_ref) { |
---|
253 | if (GB_read_clients(gb_main_ref)>=0) { |
---|
254 | if (GB_read_clock(gb_main_ref) > GB_last_saved_clock(gb_main_ref)) { |
---|
255 | long secs; |
---|
256 | secs = GB_last_saved_time(gb_main_ref); |
---|
257 | |
---|
258 | #if defined(DEBUG) |
---|
259 | secs = GB_time_of_day(); // simulate "just saved" |
---|
260 | #endif // DEBUG |
---|
261 | |
---|
262 | const char *quit_buttons = "Quit ARB,Do NOT quit"; |
---|
263 | if (secs) { |
---|
264 | secs = GB_time_of_day() - secs; |
---|
265 | if (secs>10) { |
---|
266 | char *question = GBS_global_string_copy("You last saved your data %li:%li minutes ago\nSure to quit ?", secs/60, secs%60); |
---|
267 | int dontQuit = aw_question("quit_arb", question, quit_buttons); |
---|
268 | free(question); |
---|
269 | if (dontQuit) { |
---|
270 | return false; |
---|
271 | } |
---|
272 | } |
---|
273 | } |
---|
274 | else { |
---|
275 | if (aw_question("quit_arb", "You never saved any data\nSure to quit ???", quit_buttons)) { |
---|
276 | return false; |
---|
277 | } |
---|
278 | } |
---|
279 | } |
---|
280 | } |
---|
281 | |
---|
282 | GBCMS_shutdown(gb_main_ref); |
---|
283 | |
---|
284 | GBDATA *gb_main = gb_main_ref; |
---|
285 | gb_main_ref = NULL; // avoid further usage |
---|
286 | |
---|
287 | nt_assert(aw_root); |
---|
288 | #if defined(WARN_TODO) |
---|
289 | #warning instead of directly calling the following functions, try to add them as GB_atclose-callbacks |
---|
290 | #endif |
---|
291 | aw_root->unlink_awars_from_DB(gb_main); |
---|
292 | AWT_destroy_input_masks(); |
---|
293 | #if defined(DEBUG) |
---|
294 | AWT_browser_forget_db(gb_main); |
---|
295 | #endif // DEBUG |
---|
296 | |
---|
297 | GB_close(gb_main); |
---|
298 | } |
---|
299 | return true; |
---|
300 | } |
---|
301 | |
---|
302 | static void nt_run(const char *command) { |
---|
303 | GB_ERROR error = GBK_system(command); |
---|
304 | if (error) { |
---|
305 | fprintf(stderr, "nt_run: Failed to run '%s' (Reason: %s)\n", command, error); |
---|
306 | #if defined(DEBUG) |
---|
307 | GBK_dump_backtrace(stderr, "nt_run-error"); |
---|
308 | #endif |
---|
309 | } |
---|
310 | } |
---|
311 | |
---|
312 | void nt_start(const char *arb_ntree_args, bool restart_with_new_ARB_PID) { |
---|
313 | char *command = GBS_global_string_copy("(%s %s) &", restart_with_new_ARB_PID ? "arb" : "arb_ntree", arb_ntree_args); |
---|
314 | nt_run(command); |
---|
315 | free(command); |
---|
316 | } |
---|
317 | |
---|
318 | __ATTR__NORETURN static void really_exit(int exitcode, bool kill_my_clients) { |
---|
319 | if (kill_my_clients) { |
---|
320 | nt_run("(arb_clean >/dev/null 2>&1;echo ARB done) &"); // kills all clients |
---|
321 | } |
---|
322 | exit(exitcode); |
---|
323 | } |
---|
324 | |
---|
325 | void nt_exit(AW_window *aws, AW_CL exitcode) { |
---|
326 | AW_root *aw_root = aws->get_root(); |
---|
327 | shutdown_macro_recording(aw_root); |
---|
328 | bool is_server_and_has_clients = GLOBAL.gb_main && GB_read_clients(GLOBAL.gb_main)>0; |
---|
329 | if (nt_disconnect_from_db(aw_root, GLOBAL.gb_main)) { |
---|
330 | really_exit(exitcode, is_server_and_has_clients); |
---|
331 | } |
---|
332 | } |
---|
333 | void nt_restart(AW_root *aw_root, const char *arb_ntree_args, bool restart_with_new_ARB_PID) { |
---|
334 | bool is_server_and_has_clients = GLOBAL.gb_main && GB_read_clients(GLOBAL.gb_main)>0; |
---|
335 | if (nt_disconnect_from_db(aw_root, GLOBAL.gb_main)) { |
---|
336 | nt_start(arb_ntree_args, restart_with_new_ARB_PID); |
---|
337 | really_exit(EXIT_SUCCESS, restart_with_new_ARB_PID && is_server_and_has_clients); |
---|
338 | } |
---|
339 | } |
---|
340 | |
---|
341 | static void nt_start_2nd_arb(AW_window *aww, AW_CL cl_quit) { |
---|
342 | // start 2nd arb with intro window |
---|
343 | AW_root *aw_root = aww->get_root(); |
---|
344 | char *dir4intro; |
---|
345 | GB_split_full_path(aw_root->awar(AWAR_DB_PATH)->read_char_pntr(), &dir4intro, NULL, NULL, NULL); |
---|
346 | |
---|
347 | if (cl_quit) { |
---|
348 | nt_restart(aw_root, dir4intro, true); |
---|
349 | } |
---|
350 | else { |
---|
351 | nt_start(dir4intro, true); |
---|
352 | } |
---|
353 | free(dir4intro); |
---|
354 | } |
---|
355 | |
---|
356 | // -------------------------------------------------------------------------------- |
---|
357 | |
---|
358 | static void NT_save_quick_cb(AW_window *aww) { |
---|
359 | AW_root *awr = aww->get_root(); |
---|
360 | char *filename = awr->awar(AWAR_DB_PATH)->read_string(); |
---|
361 | |
---|
362 | awr->dont_save_awars_with_default_value(GLOBAL.gb_main); |
---|
363 | |
---|
364 | GB_ERROR error = GB_save_quick(GLOBAL.gb_main, filename); |
---|
365 | free( filename); |
---|
366 | if (error) aw_message(error); |
---|
367 | else AW_refresh_fileselection(awr, "tmp/nt/arbdb"); |
---|
368 | } |
---|
369 | |
---|
370 | |
---|
371 | static void NT_save_quick_as_cb(AW_window *aww) { |
---|
372 | AW_root *awr = aww->get_root(); |
---|
373 | char *filename = awr->awar(AWAR_DB_PATH)->read_string(); |
---|
374 | GB_ERROR error = GB_save_quick_as(GLOBAL.gb_main, filename); |
---|
375 | if (!error) AW_refresh_fileselection(awr, "tmp/nt/arbdb"); |
---|
376 | aww->hide_or_notify(error); |
---|
377 | |
---|
378 | free(filename); |
---|
379 | } |
---|
380 | static void NT_save_as_cb(AW_window *aww) { |
---|
381 | AW_root *awr = aww->get_root(); |
---|
382 | char *filename = awr->awar(AWAR_DB_PATH)->read_string(); |
---|
383 | char *filetype = awr->awar(AWAR_DB_TYPE)->read_string(); |
---|
384 | |
---|
385 | awr->dont_save_awars_with_default_value(GLOBAL.gb_main); |
---|
386 | GB_ERROR error = GB_save(GLOBAL.gb_main, filename, filetype); |
---|
387 | if (!error) AW_refresh_fileselection(awr, "tmp/nt/arbdb"); |
---|
388 | aww->hide_or_notify(error); |
---|
389 | |
---|
390 | free(filetype); |
---|
391 | free(filename); |
---|
392 | } |
---|
393 | |
---|
394 | static AW_window *NT_create_save_quick_as(AW_root *aw_root, char *base_name) |
---|
395 | { |
---|
396 | static AW_window_simple *aws = 0; |
---|
397 | if (aws) return (AW_window *)aws; |
---|
398 | |
---|
399 | aws = new AW_window_simple; |
---|
400 | aws->init(aw_root, "SAVE_CHANGES_TO", "SAVE CHANGES TO"); |
---|
401 | aws->load_xfig("save_as.fig"); |
---|
402 | |
---|
403 | aws->at("close"); aws->callback((AW_CB0)AW_POPDOWN); |
---|
404 | aws->create_button("CLOSE", "CLOSE", "C"); |
---|
405 | |
---|
406 | aws->callback(AW_POPUP_HELP, (AW_CL)"save.hlp"); |
---|
407 | aws->at("help"); |
---|
408 | aws->create_button("HELP", "HELP", "H"); |
---|
409 | |
---|
410 | AW_create_fileselection(aws, base_name); |
---|
411 | |
---|
412 | aws->at("comment"); |
---|
413 | aws->create_text_field(AWAR_DB_COMMENT); |
---|
414 | |
---|
415 | aws->at("save"); aws->callback(NT_save_quick_as_cb); |
---|
416 | aws->create_button("SAVE", "SAVE", "S"); |
---|
417 | |
---|
418 | return aws; |
---|
419 | } |
---|
420 | |
---|
421 | static void NT_database_optimization(AW_window *aww) { |
---|
422 | arb_progress progress("Optimizing database", 2); |
---|
423 | |
---|
424 | GB_push_my_security(GLOBAL.gb_main); |
---|
425 | GB_ERROR error = GB_begin_transaction(GLOBAL.gb_main); |
---|
426 | if (!error) { |
---|
427 | ConstStrArray ali_names; |
---|
428 | GBT_get_alignment_names(ali_names, GLOBAL.gb_main); |
---|
429 | |
---|
430 | arb_progress ali_progress("Optimizing sequence data", ali_names.size()); |
---|
431 | ali_progress.allow_title_reuse(); |
---|
432 | |
---|
433 | error = GBT_check_data(GLOBAL.gb_main, 0); |
---|
434 | error = GB_end_transaction(GLOBAL.gb_main, error); |
---|
435 | |
---|
436 | if (!error) { |
---|
437 | char *tree_name = aww->get_root()->awar("tmp/nt/arbdb/optimize_tree_name")->read_string(); |
---|
438 | for (int i = 0; ali_names[i]; ++i) { |
---|
439 | error = GBT_compress_sequence_tree2(GLOBAL.gb_main, tree_name, ali_names[i]); |
---|
440 | ali_progress.inc_and_check_user_abort(error); |
---|
441 | } |
---|
442 | free(tree_name); |
---|
443 | } |
---|
444 | } |
---|
445 | progress.inc_and_check_user_abort(error); |
---|
446 | |
---|
447 | if (!error) { |
---|
448 | error = GB_optimize(GLOBAL.gb_main); |
---|
449 | progress.inc_and_check_user_abort(error); |
---|
450 | } |
---|
451 | |
---|
452 | GB_pop_my_security(GLOBAL.gb_main); |
---|
453 | aww->hide_or_notify(error); |
---|
454 | } |
---|
455 | |
---|
456 | static AW_window *NT_create_database_optimization_window(AW_root *aw_root) { |
---|
457 | static AW_window_simple *aws = 0; |
---|
458 | if (aws) return (AW_window *)aws; |
---|
459 | GB_transaction dummy(GLOBAL.gb_main); |
---|
460 | |
---|
461 | const char *largest_tree = GBT_name_of_largest_tree(GLOBAL.gb_main); |
---|
462 | aw_root->awar_string("tmp/nt/arbdb/optimize_tree_name", largest_tree); |
---|
463 | |
---|
464 | aws = new AW_window_simple; |
---|
465 | aws->init(aw_root, "OPTIMIZE_DATABASE", "OPTIMIZE DATABASE"); |
---|
466 | aws->load_xfig("optimize.fig"); |
---|
467 | |
---|
468 | aws->at("trees"); |
---|
469 | awt_create_selection_list_on_trees(GLOBAL.gb_main, (AW_window *)aws, "tmp/nt/arbdb/optimize_tree_name"); |
---|
470 | |
---|
471 | aws->at("close"); aws->callback((AW_CB0)AW_POPDOWN); |
---|
472 | aws->create_button("CLOSE", "CLOSE", "C"); |
---|
473 | |
---|
474 | aws->callback(AW_POPUP_HELP, (AW_CL)"optimize.hlp"); |
---|
475 | aws->at("help"); |
---|
476 | aws->create_button("HELP", "HELP", "H"); |
---|
477 | |
---|
478 | aws->at("go"); |
---|
479 | aws->callback(NT_database_optimization); |
---|
480 | aws->create_button("GO", "GO"); |
---|
481 | return aws; |
---|
482 | } |
---|
483 | |
---|
484 | static AW_window *NT_create_save_as(AW_root *aw_root, const char *base_name) |
---|
485 | { |
---|
486 | static AW_window_simple *aws = 0; |
---|
487 | if (aws) return (AW_window *)aws; |
---|
488 | |
---|
489 | aws = new AW_window_simple; |
---|
490 | aws->init(aw_root, "SAVE_DB", "SAVE ARB DB"); |
---|
491 | aws->load_xfig("save_as.fig"); |
---|
492 | |
---|
493 | aws->at("close"); aws->callback((AW_CB0)AW_POPDOWN); |
---|
494 | aws->create_button("CLOSE", "CLOSE", "C"); |
---|
495 | |
---|
496 | aws->callback(AW_POPUP_HELP, (AW_CL)"save.hlp"); |
---|
497 | aws->at("help"); |
---|
498 | aws->create_button("HELP", "HELP", "H"); |
---|
499 | |
---|
500 | AW_create_fileselection(aws, base_name); |
---|
501 | |
---|
502 | aws->at("type"); |
---|
503 | aws->label("Type "); |
---|
504 | aws->create_option_menu(AWAR_DB_TYPE); |
---|
505 | aws->insert_option("Binary", "B", "b"); |
---|
506 | aws->insert_option("Bin (with FastLoad File)", "f", "bm"); |
---|
507 | aws->insert_default_option("Ascii", "A", "a"); |
---|
508 | aws->update_option_menu(); |
---|
509 | |
---|
510 | aws->at("optimize"); |
---|
511 | aws->callback(AW_POPUP, (AW_CL)NT_create_database_optimization_window, 0); |
---|
512 | aws->help_text("optimize.hlp"); |
---|
513 | aws->create_button("OPTIMIZE", "OPTIMIZE"); |
---|
514 | |
---|
515 | aws->at("save"); aws->callback(NT_save_as_cb); |
---|
516 | aws->create_button("SAVE", "SAVE", "S"); |
---|
517 | |
---|
518 | aws->at("comment"); |
---|
519 | aws->create_text_field(AWAR_DB_COMMENT); |
---|
520 | |
---|
521 | return aws; |
---|
522 | } |
---|
523 | |
---|
524 | static void NT_undo_cb(AW_window *, AW_CL undo_type, AW_CL ntw) { |
---|
525 | GB_ERROR error = GB_undo(GLOBAL.gb_main, (GB_UNDO_TYPE)undo_type); |
---|
526 | if (error) aw_message(error); |
---|
527 | else { |
---|
528 | GB_transaction dummy(GLOBAL.gb_main); |
---|
529 | ((AWT_canvas *)ntw)->refresh(); |
---|
530 | } |
---|
531 | } |
---|
532 | |
---|
533 | static AWT_config_mapping_def tree_setting_config_mapping[] = { |
---|
534 | { AWAR_DTREE_BASELINEWIDTH, "line_width" }, |
---|
535 | { AWAR_DTREE_VERICAL_DIST, "vert_dist" }, |
---|
536 | { AWAR_DTREE_AUTO_JUMP, "auto_jump" }, |
---|
537 | { AWAR_DTREE_SHOW_CIRCLE, "show_circle" }, |
---|
538 | { AWAR_DTREE_SHOW_BRACKETS, "show_brackets" }, |
---|
539 | { AWAR_DTREE_USE_ELLIPSE, "use_ellipse" }, |
---|
540 | { AWAR_DTREE_CIRCLE_ZOOM, "circle_zoom" }, |
---|
541 | { AWAR_DTREE_CIRCLE_MAX_SIZE, "circle_max_size" }, |
---|
542 | { AWAR_DTREE_GREY_LEVEL, "grey_level" }, |
---|
543 | { AWAR_DTREE_DENDRO_ZOOM_TEXT, "dendro_zoomtext" }, |
---|
544 | { AWAR_DTREE_DENDRO_XPAD, "dendro_xpadding" }, |
---|
545 | { AWAR_DTREE_RADIAL_ZOOM_TEXT, "radial_zoomtext" }, |
---|
546 | { AWAR_DTREE_RADIAL_XPAD, "radial_xpadding" }, |
---|
547 | { 0, 0 } |
---|
548 | }; |
---|
549 | |
---|
550 | static char *tree_setting_store_config(AW_window *aww, AW_CL, AW_CL) { |
---|
551 | AWT_config_definition cdef(aww->get_root(), tree_setting_config_mapping); |
---|
552 | return cdef.read(); |
---|
553 | } |
---|
554 | static void tree_setting_restore_config(AW_window *aww, const char *stored_string, AW_CL, AW_CL) { |
---|
555 | AWT_config_definition cdef(aww->get_root(), tree_setting_config_mapping); |
---|
556 | cdef.write(stored_string); |
---|
557 | } |
---|
558 | |
---|
559 | static AW_window *NT_create_tree_setting(AW_root *aw_root) |
---|
560 | { |
---|
561 | static AW_window_simple *aws = 0; |
---|
562 | if (aws) return (AW_window *)aws; |
---|
563 | |
---|
564 | aws = new AW_window_simple; |
---|
565 | aws->init(aw_root, "TREE_PROPS", "TREE SETTINGS"); |
---|
566 | aws->load_xfig("awt/tree_settings.fig"); |
---|
567 | |
---|
568 | aws->at("close"); |
---|
569 | aws->callback((AW_CB0)AW_POPDOWN); |
---|
570 | aws->create_button("CLOSE", "CLOSE", "C"); |
---|
571 | |
---|
572 | aws->at("help"); |
---|
573 | aws->callback(AW_POPUP_HELP, (AW_CL)"nt_tree_settings.hlp"); |
---|
574 | aws->create_button("HELP", "HELP", "H"); |
---|
575 | |
---|
576 | aws->at("button"); |
---|
577 | aws->auto_space(10, 10); |
---|
578 | aws->label_length(30); |
---|
579 | |
---|
580 | aws->label("Base line width"); |
---|
581 | aws->create_input_field(AWAR_DTREE_BASELINEWIDTH, 4); |
---|
582 | aws->at_newline(); |
---|
583 | |
---|
584 | aws->label("Relative vertical distance"); |
---|
585 | aws->create_input_field(AWAR_DTREE_VERICAL_DIST, 4); |
---|
586 | aws->at_newline(); |
---|
587 | |
---|
588 | aws->label("Auto jump"); |
---|
589 | aws->create_toggle(AWAR_DTREE_AUTO_JUMP); |
---|
590 | aws->at_newline(); |
---|
591 | |
---|
592 | aws->label("Show group brackets"); |
---|
593 | aws->create_toggle(AWAR_DTREE_SHOW_BRACKETS); |
---|
594 | aws->at_newline(); |
---|
595 | |
---|
596 | aws->label("Show bootstrap circles"); |
---|
597 | aws->create_toggle(AWAR_DTREE_SHOW_CIRCLE); |
---|
598 | aws->at_newline(); |
---|
599 | |
---|
600 | aws->label("Use ellipses"); |
---|
601 | aws->create_toggle(AWAR_DTREE_USE_ELLIPSE); |
---|
602 | aws->at_newline(); |
---|
603 | |
---|
604 | aws->label("Bootstrap circle zoom factor"); |
---|
605 | aws->create_input_field(AWAR_DTREE_CIRCLE_ZOOM, 4); |
---|
606 | aws->at_newline(); |
---|
607 | |
---|
608 | aws->label("Boostrap radius limit"); |
---|
609 | aws->create_input_field(AWAR_DTREE_CIRCLE_MAX_SIZE, 4); |
---|
610 | aws->at_newline(); |
---|
611 | |
---|
612 | aws->label("Grey Level of Groups%"); |
---|
613 | aws->create_input_field(AWAR_DTREE_GREY_LEVEL, 4); |
---|
614 | aws->at_newline(); |
---|
615 | |
---|
616 | aws->label("Text zoom/pad (dendro)"); |
---|
617 | aws->create_toggle(AWAR_DTREE_DENDRO_ZOOM_TEXT); |
---|
618 | aws->create_input_field(AWAR_DTREE_DENDRO_XPAD, 4); |
---|
619 | aws->at_newline(); |
---|
620 | |
---|
621 | aws->label("Text zoom/pad (radial)"); |
---|
622 | aws->create_toggle(AWAR_DTREE_RADIAL_ZOOM_TEXT); |
---|
623 | aws->create_input_field(AWAR_DTREE_RADIAL_XPAD, 4); |
---|
624 | aws->at_newline(); |
---|
625 | |
---|
626 | aws->at("config"); |
---|
627 | AWT_insert_config_manager(aws, AW_ROOT_DEFAULT, "tree_settings", tree_setting_store_config, tree_setting_restore_config, 0, 0); |
---|
628 | |
---|
629 | return (AW_window *)aws; |
---|
630 | |
---|
631 | } |
---|
632 | |
---|
633 | enum streamSource { FROM_PIPE, FROM_FILE }; |
---|
634 | static char *stream2str(streamSource source, const char *commandOrFile) { |
---|
635 | char *output = 0; |
---|
636 | FILE *in = 0; |
---|
637 | |
---|
638 | switch (source) { |
---|
639 | case FROM_PIPE: in = popen(commandOrFile, "r"); break; |
---|
640 | case FROM_FILE: in = fopen(commandOrFile, "rt"); break; |
---|
641 | } |
---|
642 | |
---|
643 | if (in) { |
---|
644 | GBS_strstruct *out = GBS_stropen(2000); |
---|
645 | int c; |
---|
646 | |
---|
647 | while (EOF != (c = fgetc(in))) GBS_chrcat(out, c); |
---|
648 | |
---|
649 | switch (source) { |
---|
650 | case FROM_PIPE: pclose(in); break; |
---|
651 | case FROM_FILE: fclose(in); break; |
---|
652 | } |
---|
653 | |
---|
654 | // skip trailing linefeeds |
---|
655 | long offset = GBS_memoffset(out); |
---|
656 | while (offset>0 && GBS_mempntr(out)[offset-1] == '\n') { |
---|
657 | GBS_str_cut_tail(out, 1); |
---|
658 | offset--; |
---|
659 | } |
---|
660 | |
---|
661 | output = GBS_strclose(out); |
---|
662 | } |
---|
663 | return output; |
---|
664 | } |
---|
665 | |
---|
666 | inline void removeTrailingNewlines(char *str) { |
---|
667 | char *eos = strchr(str, 0)-1; |
---|
668 | while (eos >= str && eos[0] == '\n') *eos-- = 0; |
---|
669 | } |
---|
670 | |
---|
671 | inline void append_named_value(GBS_strstruct *out, const char *prefix, const char *value) { |
---|
672 | GBS_strcat(out, GBS_global_string("%-*s: %s\n", 12, prefix, value)); |
---|
673 | } |
---|
674 | inline void append_command_output(GBS_strstruct *out, const char *prefix, const char *command) { |
---|
675 | char *output = stream2str(FROM_PIPE, command); |
---|
676 | if (output) { |
---|
677 | removeTrailingNewlines(output); |
---|
678 | if (strcmp(output, "unknown") != 0) append_named_value(out, prefix, output); |
---|
679 | free(output); |
---|
680 | } |
---|
681 | } |
---|
682 | |
---|
683 | static void append_existing_file(GBS_strstruct *out, const char *file) { |
---|
684 | char *content = stream2str(FROM_FILE, file); |
---|
685 | if (content) { |
---|
686 | GBS_strcat(out, file); |
---|
687 | GBS_strcat(out, ":"); |
---|
688 | GBS_chrcat(out, strchr(content, '\n') ? '\n' : ' '); |
---|
689 | GBS_strcat(out, content); |
---|
690 | GBS_chrcat(out, '\n'); |
---|
691 | free(content); |
---|
692 | } |
---|
693 | } |
---|
694 | |
---|
695 | static char *get_system_info(bool extended) { |
---|
696 | GBS_strstruct *info = GBS_stropen(2000); |
---|
697 | |
---|
698 | GBS_strcat(info, |
---|
699 | "\n\n" |
---|
700 | "----------------------------------------\n" |
---|
701 | "Information about your system:\n" |
---|
702 | "----------------------------------------\n" |
---|
703 | ); |
---|
704 | append_named_value(info, "ARB version", ARB_VERSION); |
---|
705 | #if defined(SHOW_WHERE_BUILD) |
---|
706 | append_named_value(info, "build by", ARB_BUILD_USER "@" ARB_BUILD_HOST); |
---|
707 | #endif // SHOW_WHERE_BUILD |
---|
708 | append_named_value(info, "ARBHOME", GB_getenvARBHOME()); |
---|
709 | |
---|
710 | GBS_chrcat(info, '\n'); |
---|
711 | append_command_output(info, "Kernel", "uname -srv"); |
---|
712 | append_command_output(info, "Machine", "uname -m"); |
---|
713 | append_command_output(info, "CPU", "uname -p"); |
---|
714 | append_command_output(info, "Platform", "uname -i"); |
---|
715 | append_command_output(info, "OS", "uname -o"); |
---|
716 | |
---|
717 | GBS_chrcat(info, '\n'); |
---|
718 | append_existing_file(info, "/proc/version"); |
---|
719 | append_existing_file(info, "/proc/version_signature"); |
---|
720 | if (extended) { |
---|
721 | append_existing_file(info, "/proc/cpuinfo"); |
---|
722 | append_existing_file(info, "/proc/meminfo"); |
---|
723 | } |
---|
724 | |
---|
725 | return GBS_strclose(info); |
---|
726 | } |
---|
727 | |
---|
728 | static void NT_submit_mail(AW_window *aww, AW_CL cl_awar_base) { |
---|
729 | char *mail_file; |
---|
730 | char *mail_name = GB_unique_filename("arb_bugreport", "txt"); |
---|
731 | FILE *mail = GB_fopen_tempfile(mail_name, "wt", &mail_file); |
---|
732 | GB_ERROR error = 0; |
---|
733 | |
---|
734 | if (!mail) error = GB_await_error(); |
---|
735 | else { |
---|
736 | char *awar_base = (char *)cl_awar_base; |
---|
737 | char *address = aww->get_root()->awar(GBS_global_string("%s/address", awar_base))->read_string(); |
---|
738 | char *text = aww->get_root()->awar(GBS_global_string("%s/text", awar_base))->read_string(); |
---|
739 | char *plainaddress = GBS_string_eval(address, "\"=:'=\\=", 0); // Remove all dangerous symbols |
---|
740 | |
---|
741 | fprintf(mail, "%s\n", text); |
---|
742 | fclose(mail); |
---|
743 | |
---|
744 | const char *command = GBS_global_string("mail '%s' <%s", plainaddress, mail_file); |
---|
745 | |
---|
746 | nt_assert(GB_is_privatefile(mail_file, false)); |
---|
747 | |
---|
748 | error = GBK_system(command); |
---|
749 | GB_unlink_or_warn(mail_file, &error); |
---|
750 | |
---|
751 | free(plainaddress); |
---|
752 | free(text); |
---|
753 | free(address); |
---|
754 | } |
---|
755 | |
---|
756 | aww->hide_or_notify(error); |
---|
757 | |
---|
758 | free(mail_file); |
---|
759 | free(mail_name); |
---|
760 | } |
---|
761 | |
---|
762 | |
---|
763 | static AW_window *NT_submit_bug(AW_root *aw_root, int bug_report) { |
---|
764 | static AW_window_simple *awss[2] = { 0, 0 }; |
---|
765 | if (awss[bug_report]) return (AW_window *)awss[bug_report]; |
---|
766 | |
---|
767 | AW_window_simple *aws = new AW_window_simple; |
---|
768 | if (bug_report) { |
---|
769 | aws->init(aw_root, "SUBMIT_BUG", "Submit a bug"); |
---|
770 | } |
---|
771 | else { |
---|
772 | aws->init(aw_root, "SUBMIT_REG", "Submit registration"); |
---|
773 | } |
---|
774 | aws->load_xfig("bug_report.fig"); |
---|
775 | |
---|
776 | aws->at("close"); |
---|
777 | aws->callback((AW_CB0)AW_POPDOWN); |
---|
778 | aws->create_button("CLOSE", "CLOSE", "C"); |
---|
779 | |
---|
780 | aws->at("help"); |
---|
781 | aws->callback(AW_POPUP_HELP, (AW_CL)"registration.hlp"); |
---|
782 | aws->create_button("HELP", "HELP", "H"); |
---|
783 | |
---|
784 | aws->at("what"); |
---|
785 | aws->create_autosize_button(NULL, (bug_report ? "Bug report" : "ARB Registration")); |
---|
786 | |
---|
787 | char *awar_name_start = GBS_global_string_copy("/tmp/nt/feedback/%s", bug_report ? "bugreport" : "registration"); |
---|
788 | |
---|
789 | { |
---|
790 | const char *awar_name_address = GBS_global_string("%s/address", awar_name_start); |
---|
791 | aw_root->awar_string(awar_name_address, "arb@arb-home.de"); |
---|
792 | |
---|
793 | aws->at("mail"); |
---|
794 | aws->create_input_field(awar_name_address); |
---|
795 | } |
---|
796 | |
---|
797 | { |
---|
798 | char *system_info = get_system_info(bug_report); |
---|
799 | char *custom_text = 0; |
---|
800 | |
---|
801 | if (bug_report) { |
---|
802 | custom_text = strdup("Bug occurred in:\n" |
---|
803 | " [which part of ARB?]\n" |
---|
804 | "\n" |
---|
805 | "The bug [ ] is reproducible\n" |
---|
806 | " [ ] occurs randomly\n" |
---|
807 | " [ ] occurs with specific data\n" |
---|
808 | "\n" |
---|
809 | "Detailed description:\n" |
---|
810 | "[put your bug description here]\n" |
---|
811 | "\n" |
---|
812 | "\n" |
---|
813 | "\n" |
---|
814 | "Note: If the bug only occurs with a specific database,\n" |
---|
815 | " please provide a way how we can download your database.\n" |
---|
816 | " (e.g. upload it to a filesharing site and provide the URL here)\n" |
---|
817 | "\n" |
---|
818 | ); |
---|
819 | } |
---|
820 | else { |
---|
821 | custom_text = GBS_global_string_copy("******* Registration *******\n" |
---|
822 | "\n" |
---|
823 | "Name : %s\n" |
---|
824 | "Department : \n" |
---|
825 | "How many users : \n" |
---|
826 | "\n" |
---|
827 | "Why do you want to use arb ?\n" |
---|
828 | "\n", |
---|
829 | GB_getenvUSER()); |
---|
830 | } |
---|
831 | |
---|
832 | const char *awar_name_text = GBS_global_string("%s/text", awar_name_start); |
---|
833 | aw_root->awar_string(awar_name_text, GBS_global_string("%s\n%s", custom_text, system_info)); |
---|
834 | aws->at("box"); |
---|
835 | aws->create_text_field(awar_name_text); |
---|
836 | |
---|
837 | free(custom_text); |
---|
838 | free(system_info); |
---|
839 | } |
---|
840 | |
---|
841 | aws->at("go"); |
---|
842 | aws->callback(NT_submit_mail, (AW_CL)awar_name_start); // do not free awar_name_start |
---|
843 | aws->create_button("SEND", "SEND"); |
---|
844 | |
---|
845 | awss[bug_report] = aws; // store for further use |
---|
846 | |
---|
847 | char *haveMail = GB_executable("mail"); |
---|
848 | if (haveMail) free(haveMail); |
---|
849 | else aw_message("Won't be able to send your mail (no mail program found)\nCopy&paste the text to your favorite mail software"); |
---|
850 | |
---|
851 | return aws; |
---|
852 | } |
---|
853 | |
---|
854 | static void NT_modify_cb(AW_window *aww, AW_CL cd1, AW_CL cd2) |
---|
855 | { |
---|
856 | AWT_canvas *canvas = (AWT_canvas*)cd1; |
---|
857 | AW_window *aws = DBUI::create_species_info_window(aww->get_root(), (AW_CL)canvas->gb_main); |
---|
858 | aws->activate(); |
---|
859 | nt_mode_event(aww, canvas, (AWT_COMMAND_MODE)cd2); |
---|
860 | } |
---|
861 | |
---|
862 | static void NT_primer_cb() { |
---|
863 | GB_ERROR error = GB_xcmd("arb_primer", true, false); |
---|
864 | if (error) aw_message(error); |
---|
865 | } |
---|
866 | |
---|
867 | static void NT_mark_duplicates(AW_window *aww, AW_CL ntwcl) { |
---|
868 | AWT_canvas *ntw = (AWT_canvas *)ntwcl; |
---|
869 | GB_transaction dummy(ntw->gb_main); |
---|
870 | NT_mark_all_cb(aww, (AW_CL)ntw, (AW_CL)0); |
---|
871 | AP_tree *tree_root = AWT_TREE(ntw)->get_root_node(); |
---|
872 | tree_root->mark_duplicates(); |
---|
873 | tree_root->compute_tree(ntw->gb_main); |
---|
874 | ntw->refresh(); |
---|
875 | } |
---|
876 | |
---|
877 | static void NT_justify_branch_lenghs(AW_window *, AW_CL cl_ntw, AW_CL) { |
---|
878 | AWT_canvas *ntw = (AWT_canvas *)cl_ntw; |
---|
879 | GB_transaction dummy(ntw->gb_main); |
---|
880 | AP_tree *tree_root = AWT_TREE(ntw)->get_root_node(); |
---|
881 | |
---|
882 | if (tree_root) { |
---|
883 | tree_root->justify_branch_lenghs(ntw->gb_main); |
---|
884 | tree_root->compute_tree(ntw->gb_main); |
---|
885 | GB_ERROR error = AWT_TREE(ntw)->save(ntw->gb_main, 0, 0, 0); |
---|
886 | if (error) aw_message(error); |
---|
887 | ntw->refresh(); |
---|
888 | } |
---|
889 | } |
---|
890 | |
---|
891 | #if defined(DEBUG) |
---|
892 | static void NT_fix_database(AW_window *) { |
---|
893 | GB_ERROR err = 0; |
---|
894 | err = GB_fix_database(GLOBAL.gb_main); |
---|
895 | if (err) aw_message(err); |
---|
896 | } |
---|
897 | #endif |
---|
898 | |
---|
899 | static void relink_pseudo_species_to_organisms(GBDATA *&ref_gb_node, char *&ref_name, GB_HASH *organism_hash) { |
---|
900 | if (ref_gb_node) { |
---|
901 | if (GEN_is_pseudo_gene_species(ref_gb_node)) { |
---|
902 | GBDATA *gb_organism = GEN_find_origin_organism(ref_gb_node, organism_hash); |
---|
903 | |
---|
904 | if (gb_organism) { |
---|
905 | char *name = GBT_read_string(gb_organism, "name"); |
---|
906 | |
---|
907 | if (name) { |
---|
908 | freeset(ref_name, name); |
---|
909 | ref_gb_node = gb_organism; |
---|
910 | } |
---|
911 | } |
---|
912 | } |
---|
913 | } |
---|
914 | } |
---|
915 | |
---|
916 | static void NT_pseudo_species_to_organism(AW_window *, AW_CL ntwcl) { |
---|
917 | AWT_canvas *ntw = (AWT_canvas *)ntwcl; |
---|
918 | GB_transaction dummy(ntw->gb_main); |
---|
919 | AP_tree *tree_root = AWT_TREE(ntw)->get_root_node(); |
---|
920 | |
---|
921 | if (tree_root) { |
---|
922 | GB_HASH *organism_hash = GBT_create_organism_hash(ntw->gb_main); |
---|
923 | tree_root->relink_tree(ntw->gb_main, relink_pseudo_species_to_organisms, organism_hash); |
---|
924 | tree_root->compute_tree(ntw->gb_main); |
---|
925 | GB_ERROR error = AWT_TREE(ntw)->save(ntw->gb_main, 0, 0, 0); |
---|
926 | if (error) aw_message(error); |
---|
927 | ntw->refresh(); |
---|
928 | GBS_free_hash(organism_hash); |
---|
929 | } |
---|
930 | } |
---|
931 | |
---|
932 | |
---|
933 | // ######################################### |
---|
934 | // ######################################### |
---|
935 | // ### ### |
---|
936 | // ## user mask section ## |
---|
937 | // ### ### |
---|
938 | // ######################################### |
---|
939 | // ######################################### |
---|
940 | |
---|
941 | class nt_item_type_species_selector : public awt_item_type_selector { |
---|
942 | public: |
---|
943 | nt_item_type_species_selector() : awt_item_type_selector(AWT_IT_SPECIES) {} |
---|
944 | virtual ~nt_item_type_species_selector() OVERRIDE {} |
---|
945 | |
---|
946 | virtual const char *get_self_awar() const OVERRIDE { |
---|
947 | return AWAR_SPECIES_NAME; |
---|
948 | } |
---|
949 | virtual size_t get_self_awar_content_length() const OVERRIDE { |
---|
950 | return 12; // should be enough for "nnaammee.999" |
---|
951 | } |
---|
952 | virtual void add_awar_callbacks(AW_root *root, void (*f)(AW_root*, AW_CL), AW_CL cl_mask) const OVERRIDE { // add callbacks to awars |
---|
953 | root->awar(get_self_awar())->add_callback(f, cl_mask); |
---|
954 | } |
---|
955 | virtual void remove_awar_callbacks(AW_root *root, void (*f)(AW_root*, AW_CL), AW_CL cl_mask) const OVERRIDE { // remove callbacks to awars |
---|
956 | root->awar(get_self_awar())->remove_callback(f, cl_mask); |
---|
957 | } |
---|
958 | virtual GBDATA *current(AW_root *root, GBDATA *gb_main) const OVERRIDE { // give the current item |
---|
959 | char *species_name = root->awar(get_self_awar())->read_string(); |
---|
960 | GBDATA *gb_species = 0; |
---|
961 | |
---|
962 | if (species_name[0]) { |
---|
963 | GB_transaction dummy(gb_main); |
---|
964 | gb_species = GBT_find_species(gb_main, species_name); |
---|
965 | } |
---|
966 | |
---|
967 | free(species_name); |
---|
968 | return gb_species; |
---|
969 | } |
---|
970 | virtual const char *getKeyPath() const OVERRIDE { // give the keypath for items |
---|
971 | return CHANGE_KEY_PATH; |
---|
972 | } |
---|
973 | }; |
---|
974 | |
---|
975 | static nt_item_type_species_selector item_type_species; |
---|
976 | |
---|
977 | static void NT_open_mask_window(AW_window *aww, AW_CL cl_id, AW_CL) { |
---|
978 | int id = int(cl_id); |
---|
979 | const awt_input_mask_descriptor *descriptor = AWT_look_input_mask(id); |
---|
980 | nt_assert(descriptor); |
---|
981 | if (descriptor) AWT_initialize_input_mask(aww->get_root(), GLOBAL.gb_main, &item_type_species, descriptor->get_internal_maskname(), descriptor->is_local_mask()); |
---|
982 | } |
---|
983 | |
---|
984 | static void NT_create_mask_submenu(AW_window_menu_modes *awm) { |
---|
985 | AWT_create_mask_submenu(awm, AWT_IT_SPECIES, NT_open_mask_window, 0); |
---|
986 | } |
---|
987 | static AW_window *create_colorize_species_window(AW_root *aw_root) { |
---|
988 | return QUERY::create_colorize_items_window(aw_root, GLOBAL.gb_main, SPECIES_get_selector()); |
---|
989 | } |
---|
990 | |
---|
991 | /** |
---|
992 | * Updates marked counter and issues redraw on tree if #marked changes. |
---|
993 | * Called on any change of species_information container. |
---|
994 | */ |
---|
995 | static void NT_update_marked_counter(GBDATA* /*species_info*/, int* cl_aww, GB_CB_TYPE /*cbt*/) { |
---|
996 | AW_window* aww = (AW_window*) cl_aww; |
---|
997 | long count = GBT_count_marked_species(GLOBAL.gb_main); |
---|
998 | const char *buffer = count ? GBS_global_string("%li marked", count) : ""; |
---|
999 | AW_awar *counter = aww->get_root()->awar(AWAR_MARKED_SPECIES_COUNTER); |
---|
1000 | char *oldval = counter->read_string(); |
---|
1001 | if (strcmp(oldval, buffer)) { |
---|
1002 | counter->write_string(buffer); |
---|
1003 | aww->get_root()->awar(AWAR_TREE_REFRESH)->touch(); |
---|
1004 | } |
---|
1005 | free(oldval); |
---|
1006 | } |
---|
1007 | |
---|
1008 | static void NT_popup_species_window(AW_window *aww, AW_CL cl_gb_main, AW_CL) { |
---|
1009 | // used to avoid that the species info window is stored in a menu (or with a button) |
---|
1010 | DBUI::create_species_info_window(aww->get_root(), cl_gb_main)->activate(); |
---|
1011 | } |
---|
1012 | |
---|
1013 | // -------------------------------------------------------------------------------------------------- |
---|
1014 | |
---|
1015 | static void NT_alltree_remove_leafs(AW_window *, AW_CL cl_mode, AW_CL cl_gb_main) { // @@@ test and activate for public |
---|
1016 | GBDATA *gb_main = (GBDATA*)cl_gb_main; |
---|
1017 | GBT_TREE_REMOVE_TYPE mode = (GBT_TREE_REMOVE_TYPE)cl_mode; |
---|
1018 | |
---|
1019 | GB_ERROR error = 0; |
---|
1020 | GB_transaction ta(gb_main); |
---|
1021 | |
---|
1022 | ConstStrArray tree_names; |
---|
1023 | GBT_get_tree_names(tree_names, gb_main, false); |
---|
1024 | |
---|
1025 | if (!tree_names.empty()) { |
---|
1026 | int treeCount = tree_names.size(); |
---|
1027 | arb_progress progress("Deleting from trees", treeCount); |
---|
1028 | GB_HASH *species_hash = GBT_create_species_hash(gb_main); |
---|
1029 | |
---|
1030 | for (int t = 0; t<treeCount && !error; t++) { |
---|
1031 | progress.subtitle(tree_names[t]); |
---|
1032 | GBT_TREE *tree = GBT_read_tree(gb_main, tree_names[t], -sizeof(GBT_TREE)); |
---|
1033 | if (!tree) { |
---|
1034 | aw_message(GBS_global_string("Can't load tree '%s' - skipped", tree_names[t])); |
---|
1035 | } |
---|
1036 | else { |
---|
1037 | int removed = 0; |
---|
1038 | int groups_removed = 0; |
---|
1039 | |
---|
1040 | tree = GBT_remove_leafs(tree, mode, species_hash, &removed, &groups_removed); |
---|
1041 | |
---|
1042 | nt_assert(removed >= groups_removed); |
---|
1043 | |
---|
1044 | if (!tree) { |
---|
1045 | aw_message(GBS_global_string("'%s' would disappear. Please delete tree manually.", tree_names[t])); |
---|
1046 | } |
---|
1047 | else { |
---|
1048 | if (removed>0) { |
---|
1049 | error = GBT_write_tree(gb_main, 0, tree_names[t], tree); |
---|
1050 | if (groups_removed>0) { |
---|
1051 | aw_message(GBS_global_string("Removed %i species and %i groups from '%s'", removed, groups_removed, tree_names[t])); |
---|
1052 | } |
---|
1053 | else { |
---|
1054 | aw_message(GBS_global_string("Removed %i species from '%s'", removed, tree_names[t])); |
---|
1055 | } |
---|
1056 | } |
---|
1057 | GBT_delete_tree(tree); |
---|
1058 | } |
---|
1059 | } |
---|
1060 | progress.inc_and_check_user_abort(error); |
---|
1061 | } |
---|
1062 | |
---|
1063 | GBS_free_hash(species_hash); |
---|
1064 | } |
---|
1065 | |
---|
1066 | aw_message_if(ta.close(error)); |
---|
1067 | } |
---|
1068 | |
---|
1069 | GBT_TREE *nt_get_tree_root_of_canvas(AWT_canvas *ntw) { |
---|
1070 | AWT_graphic_tree *tree = AWT_TREE(ntw); |
---|
1071 | if (tree) { |
---|
1072 | AP_tree *root = tree->get_root_node(); |
---|
1073 | if (root) return root->get_gbt_tree(); |
---|
1074 | } |
---|
1075 | return NULL; |
---|
1076 | } |
---|
1077 | |
---|
1078 | // -------------------------------------------------------------------------------------------------- |
---|
1079 | |
---|
1080 | static ARB_ERROR mark_referred_species(GBDATA *gb_main, const DBItemSet& referred) { |
---|
1081 | GB_transaction ta(gb_main); |
---|
1082 | GBT_mark_all(gb_main, 0); |
---|
1083 | |
---|
1084 | DBItemSetIter end = referred.end(); |
---|
1085 | for (DBItemSetIter s = referred.begin(); s != end; ++s) { |
---|
1086 | GB_write_flag(*s, 1); |
---|
1087 | } |
---|
1088 | return ARB_ERROR(); |
---|
1089 | } |
---|
1090 | |
---|
1091 | static AW_window *create_mark_by_refentries_window(AW_root *awr, AW_CL cl_gbmain) { |
---|
1092 | static AW_window *aws = NULL; |
---|
1093 | if (!aws) { |
---|
1094 | static RefEntries::ReferringEntriesHandler reh((GBDATA*)cl_gbmain, SPECIES_get_selector()); |
---|
1095 | aws = RefEntries::create_refentries_window(awr, &reh, "markbyref", "Mark by reference", "markbyref.hlp", NULL, "Mark referenced", mark_referred_species); |
---|
1096 | } |
---|
1097 | return aws; |
---|
1098 | } |
---|
1099 | |
---|
1100 | // -------------------------------------------------------------------------------------------------- |
---|
1101 | |
---|
1102 | static void merge_from_to(AW_root *awr, const char *db_awar_name, bool merge_to) { |
---|
1103 | const char *db_name = awr->awar(db_awar_name)->read_char_pntr(); |
---|
1104 | |
---|
1105 | char *cmd = GBS_global_string_copy( |
---|
1106 | merge_to |
---|
1107 | ? "arb_ntree : %s &" |
---|
1108 | : "arb_ntree %s : &", |
---|
1109 | db_name); |
---|
1110 | |
---|
1111 | aw_message_if(GBK_system(cmd)); |
---|
1112 | free(cmd); |
---|
1113 | } |
---|
1114 | |
---|
1115 | static void merge_from_cb(AW_window *aww, AW_CL cl_awarNamePtr) { merge_from_to(aww->get_root(), *(const char**)cl_awarNamePtr, false); } |
---|
1116 | static void merge_into_cb(AW_window *aww, AW_CL cl_awarNamePtr) { merge_from_to(aww->get_root(), *(const char**)cl_awarNamePtr, true); } |
---|
1117 | |
---|
1118 | static AW_window *NT_create_merge_from_window(AW_root *awr, AW_CL) { |
---|
1119 | static char *awar_name = NULL; // do not free, bound to callback |
---|
1120 | |
---|
1121 | AW_window *aw_from = |
---|
1122 | awt_create_load_box(awr, "Merge data from", "other ARB database", |
---|
1123 | ".", ".arb", &awar_name, |
---|
1124 | merge_from_cb, NULL, NULL, NULL, AW_CL(&awar_name)); |
---|
1125 | return aw_from; |
---|
1126 | } |
---|
1127 | static AW_window *NT_create_merge_to_window(AW_root *awr, AW_CL) { |
---|
1128 | static char *awar_name = NULL; // do not free, bound to callback |
---|
1129 | |
---|
1130 | AW_window *aw_to = |
---|
1131 | awt_create_load_box(awr, "Merge data to", "other ARB database", |
---|
1132 | ".", ".arb", &awar_name, |
---|
1133 | merge_into_cb, NULL, NULL, NULL, AW_CL(&awar_name)); |
---|
1134 | return aw_to; |
---|
1135 | } |
---|
1136 | |
---|
1137 | // -------------------------------------------------------------------------------------------------- |
---|
1138 | |
---|
1139 | int NT_get_canvas_id(AWT_canvas *ntw) { |
---|
1140 | // return number of canvas [0..MAX_NT_WINDOWS-1] |
---|
1141 | |
---|
1142 | const char *tree_awar_name = ntw->user_awar; |
---|
1143 | |
---|
1144 | const unsigned LEN = 15; |
---|
1145 | #if defined(ASSERTION_USED) |
---|
1146 | const char *EXPECT = "focus/tree_name"; |
---|
1147 | #endif |
---|
1148 | |
---|
1149 | nt_assert(strlen(EXPECT) == LEN); |
---|
1150 | nt_assert(memcmp(tree_awar_name, EXPECT, LEN) == 0); |
---|
1151 | |
---|
1152 | int id; |
---|
1153 | switch (tree_awar_name[LEN]) { |
---|
1154 | default : |
---|
1155 | nt_assert(0); |
---|
1156 | // NDEBUG: fallback to 0 |
---|
1157 | case 0: |
---|
1158 | id = 0; |
---|
1159 | break; |
---|
1160 | |
---|
1161 | case '_': |
---|
1162 | id = atoi(tree_awar_name+LEN+1); |
---|
1163 | nt_assert(id >= 1); |
---|
1164 | break; |
---|
1165 | } |
---|
1166 | return id; |
---|
1167 | } |
---|
1168 | |
---|
1169 | // ########################################## |
---|
1170 | // ########################################## |
---|
1171 | // ### ### |
---|
1172 | // ## create main window ## |
---|
1173 | // ### ### |
---|
1174 | // ########################################## |
---|
1175 | // ########################################## |
---|
1176 | |
---|
1177 | static AW_window *popup_new_main_window(AW_root *awr, AW_CL clone) { |
---|
1178 | GB_push_transaction(GLOBAL.gb_main); |
---|
1179 | |
---|
1180 | char window_title[256]; |
---|
1181 | char * const awar_tree = (char *)GB_calloc(sizeof(char), strlen(AWAR_TREE) + 10); // do not free this |
---|
1182 | |
---|
1183 | if (clone) { |
---|
1184 | sprintf(awar_tree, AWAR_TREE "_%li", clone); |
---|
1185 | sprintf(window_title, "ARB_NT_%li", clone); |
---|
1186 | } |
---|
1187 | else { |
---|
1188 | sprintf(awar_tree, AWAR_TREE); |
---|
1189 | sprintf(window_title, "ARB_NT"); |
---|
1190 | } |
---|
1191 | AW_window_menu_modes *awm = new AW_window_menu_modes; |
---|
1192 | awm->init(awr, window_title, window_title, 0, 0); |
---|
1193 | |
---|
1194 | awm->button_length(5); |
---|
1195 | |
---|
1196 | if (!clone) AW_init_color_group_defaults("arb_ntree"); |
---|
1197 | |
---|
1198 | AWT_graphic_tree *tree = NT_generate_tree(awr, GLOBAL.gb_main, launch_MapViewer_cb); |
---|
1199 | |
---|
1200 | AWT_canvas *ntw; |
---|
1201 | { |
---|
1202 | AP_tree_sort old_sort_type = tree->tree_sort; |
---|
1203 | tree->set_tree_type(AP_LIST_SIMPLE, NULL); // avoid NDS warnings during startup |
---|
1204 | |
---|
1205 | ntw = new AWT_canvas(GLOBAL.gb_main, awm, "ARB_NT", tree, awar_tree); |
---|
1206 | tree->set_tree_type(old_sort_type, ntw); |
---|
1207 | ntw->set_mode(AWT_MODE_SELECT); |
---|
1208 | } |
---|
1209 | |
---|
1210 | { |
---|
1211 | AW_awar *tree_awar = awr->awar_string(awar_tree); |
---|
1212 | const char *tree_name = tree_awar->read_char_pntr(); |
---|
1213 | const char *existing_tree_name = GBT_existing_tree(GLOBAL.gb_main, tree_name); |
---|
1214 | |
---|
1215 | if (existing_tree_name) { |
---|
1216 | tree_awar->write_string(existing_tree_name); |
---|
1217 | NT_reload_tree_event(awr, ntw, 1); // load first tree |
---|
1218 | } |
---|
1219 | else { |
---|
1220 | AW_advice("Your database contains no tree.", AW_ADVICE_TOGGLE|AW_ADVICE_HELP, 0, "no_tree.hlp"); |
---|
1221 | tree->set_tree_type(AP_LIST_NDS, ntw); // no tree -> show NDS list |
---|
1222 | } |
---|
1223 | |
---|
1224 | tree_awar->add_callback((AW_RCB)NT_reload_tree_event, (AW_CL)ntw, 1); |
---|
1225 | } |
---|
1226 | |
---|
1227 | awr->awar(AWAR_SPECIES_NAME)->add_callback((AW_RCB)NT_jump_cb_auto, (AW_CL)ntw, 0); |
---|
1228 | awr->awar(AWAR_DTREE_VERICAL_DIST)->add_callback((AW_RCB)AWT_resize_cb, (AW_CL)ntw, 0); |
---|
1229 | awr->awar(AWAR_DTREE_BASELINEWIDTH)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1230 | awr->awar(AWAR_DTREE_SHOW_CIRCLE)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1231 | awr->awar(AWAR_DTREE_SHOW_BRACKETS)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1232 | awr->awar(AWAR_DTREE_CIRCLE_ZOOM)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1233 | awr->awar(AWAR_DTREE_CIRCLE_MAX_SIZE)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1234 | awr->awar(AWAR_DTREE_USE_ELLIPSE)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1235 | |
---|
1236 | awr->awar(AWAR_DTREE_RADIAL_ZOOM_TEXT)->add_callback((AW_RCB)NT_reinit_treetype, (AW_CL)ntw, 0); |
---|
1237 | awr->awar(AWAR_DTREE_RADIAL_XPAD)->add_callback((AW_RCB)NT_reinit_treetype, (AW_CL)ntw, 0); |
---|
1238 | awr->awar(AWAR_DTREE_DENDRO_ZOOM_TEXT)->add_callback((AW_RCB)NT_reinit_treetype, (AW_CL)ntw, 0); |
---|
1239 | awr->awar(AWAR_DTREE_DENDRO_XPAD)->add_callback((AW_RCB)NT_reinit_treetype, (AW_CL)ntw, 0); |
---|
1240 | |
---|
1241 | awr->awar(AWAR_TREE_REFRESH)->add_callback((AW_RCB)AWT_expose_cb, (AW_CL)ntw, 0); |
---|
1242 | awr->awar(AWAR_COLOR_GROUPS_USE)->add_callback((AW_RCB)NT_recompute_cb, (AW_CL)ntw, 0); |
---|
1243 | |
---|
1244 | GBDATA *gb_arb_presets = GB_search(GLOBAL.gb_main, "arb_presets", GB_CREATE_CONTAINER); |
---|
1245 | GB_add_callback(gb_arb_presets, GB_CB_CHANGED, (GB_CB)AWT_expose_cb, (int *)ntw); |
---|
1246 | |
---|
1247 | bool is_genome_db = GEN_is_genome_db(GLOBAL.gb_main, 0); // is this a genome database ? (default = 0 = not a genom db) |
---|
1248 | |
---|
1249 | // -------------- |
---|
1250 | // File |
---|
1251 | |
---|
1252 | #if defined(DEBUG) |
---|
1253 | AWT_create_debug_menu(awm); |
---|
1254 | #endif // DEBUG |
---|
1255 | |
---|
1256 | bool allow_new_window = (NT_get_canvas_id(ntw)+1) < MAX_NT_WINDOWS; |
---|
1257 | |
---|
1258 | if (clone) { |
---|
1259 | awm->create_menu("File", "F", AWM_ALL); |
---|
1260 | if (allow_new_window) { |
---|
1261 | awm->insert_menu_topic(awm->local_id("new_window"), "New window (same database)", "N", "newwindow.hlp", AWM_ALL, AW_POPUP, (AW_CL)popup_new_main_window, clone+1); |
---|
1262 | } |
---|
1263 | awm->insert_menu_topic("close", "Close", "C", 0, AWM_ALL, (AW_CB)AW_POPDOWN, 0, 0); |
---|
1264 | } |
---|
1265 | else { |
---|
1266 | #if defined(DEBUG) |
---|
1267 | // add more to debug-menu |
---|
1268 | awm->sep______________(); |
---|
1269 | awm->insert_menu_topic("fix_db", "Fix database", "F", 0, AWM_ALL, (AW_CB)NT_fix_database, 0, 0); |
---|
1270 | awm->insert_menu_topic("debug_arbdb", "Print debug information", "d", 0, AWM_ALL, (AW_CB)GB_print_debug_information, (AW_CL) GLOBAL.gb_main, 0); |
---|
1271 | awm->insert_menu_topic("test_compr", "Test compression", "T", 0, AWM_ALL, (AW_CB)GBT_compression_test, (AW_CL) GLOBAL.gb_main, 0); |
---|
1272 | awm->sep______________(); |
---|
1273 | awm->insert_menu_topic("table_admin", "Table Admin (unfinished/unknown purpose)", "A", "tableadm.hlp", AWM_ALL, AW_POPUP, (AW_CL)AWT_create_tables_admin_window, (AW_CL)GLOBAL.gb_main); |
---|
1274 | #endif // DEBUG |
---|
1275 | |
---|
1276 | awm->create_menu("File", "F", AWM_ALL); |
---|
1277 | { |
---|
1278 | awm->insert_menu_topic("save_changes", "Quicksave changes", "s", "save.hlp", AWM_ALL, (AW_CB)NT_save_quick_cb, 0, 0); |
---|
1279 | awm->insert_menu_topic("save_all_as", "Save whole database as ...", "w", "save.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_save_as, (AW_CL)"tmp/nt/arbdb"); |
---|
1280 | if (allow_new_window) { |
---|
1281 | awm->sep______________(); |
---|
1282 | awm->insert_menu_topic("new_window", "New window (same database)", "N", "newwindow.hlp", AWM_ALL, AW_POPUP, (AW_CL)popup_new_main_window, clone+1); |
---|
1283 | } |
---|
1284 | awm->sep______________(); |
---|
1285 | awm->insert_menu_topic("optimize_db", "Optimize database", "O", "optimize.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_database_optimization_window, 0); |
---|
1286 | awm->sep______________(); |
---|
1287 | |
---|
1288 | awm->insert_sub_menu("Import", "I"); |
---|
1289 | { |
---|
1290 | awm->insert_menu_topic("merge_from", "Merge from other ARB database", "d", "arb_merge_into.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_merge_from_window, 0); |
---|
1291 | awm->insert_menu_topic("import_seq", "Import from external format", "I", "arb_import.hlp", AWM_ALL, NT_import_sequences, 0, 0); |
---|
1292 | GDE_load_menu(awm, AWM_EXP, "Import"); |
---|
1293 | } |
---|
1294 | awm->close_sub_menu(); |
---|
1295 | |
---|
1296 | awm->insert_sub_menu("Export", "E"); |
---|
1297 | { |
---|
1298 | awm->insert_menu_topic("export_to_ARB", "Merge to (new) ARB database", "A", "arb_merge_outof.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_merge_to_window, 0); |
---|
1299 | awm->insert_menu_topic("export_seqs", "Export to external format", "f", "arb_export.hlp", AWM_ALL, AW_POPUP, (AW_CL)open_AWTC_export_window, (AW_CL)GLOBAL.gb_main); |
---|
1300 | GDE_load_menu(awm, AWM_ALL, "Export"); |
---|
1301 | awm->insert_menu_topic("export_nds", "Export fields (to calc-sheet using NDS)", "N", "arb_export_nds.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_nds_export_window, 0); |
---|
1302 | } |
---|
1303 | awm->close_sub_menu(); |
---|
1304 | awm->sep______________(); |
---|
1305 | |
---|
1306 | insert_macro_menu_entry(awm, false); |
---|
1307 | |
---|
1308 | awm->insert_sub_menu("Registration/Bug report/Version info", "R"); |
---|
1309 | { |
---|
1310 | awm->insert_menu_topic("registration", "Registration", "R", "registration.hlp", AWM_ALL, (AW_CB)AW_POPUP, (AW_CL)NT_submit_bug, 0); |
---|
1311 | awm->insert_menu_topic("bug_report", "Bug report", "B", "registration.hlp", AWM_ALL, (AW_CB)AW_POPUP, (AW_CL)NT_submit_bug, 1); |
---|
1312 | awm->insert_menu_topic("version_info", "Version info (" ARB_VERSION ")", "V", "version.hlp", AWM_ALL, (AW_CB)AW_POPUP_HELP, (AW_CL)"version.hlp", 0); |
---|
1313 | } |
---|
1314 | awm->close_sub_menu(); |
---|
1315 | #if 0 |
---|
1316 | awm->sep______________(); |
---|
1317 | awm->insert_menu_topic("undo", "Undo", "U", "undo.hlp", AWM_ALL, (AW_CB)NT_undo_cb, (AW_CL)GB_UNDO_UNDO, (AW_CL)ntw); |
---|
1318 | awm->insert_menu_topic("redo", "Redo", "d", "undo.hlp", AWM_ALL, (AW_CB)NT_undo_cb, (AW_CL)GB_UNDO_REDO, (AW_CL)ntw); |
---|
1319 | awm->insert_menu_topic("undo_info", "Undo info", "f", "undo.hlp", AWM_ALL, (AW_CB)NT_undo_info_cb, (AW_CL)GB_UNDO_UNDO, (AW_CL)0); |
---|
1320 | awm->insert_menu_topic("redo_info", "Redo info", "o", "undo.hlp", AWM_ALL, (AW_CB)NT_undo_info_cb, (AW_CL)GB_UNDO_REDO, (AW_CL)0); |
---|
1321 | #endif |
---|
1322 | |
---|
1323 | awm->sep______________(); |
---|
1324 | |
---|
1325 | awm->insert_menu_topic("new_arb", "Start second database", "o", "quit.hlp", AWM_ALL, nt_start_2nd_arb, 0); |
---|
1326 | awm->insert_menu_topic("restart_arb", "Quit + load other database", "l", "quit.hlp", AWM_ALL, nt_start_2nd_arb, 1); |
---|
1327 | awm->insert_menu_topic("quit", "Quit", "Q", "quit.hlp", AWM_ALL, nt_exit, EXIT_SUCCESS); |
---|
1328 | } |
---|
1329 | |
---|
1330 | // ----------------- |
---|
1331 | // Species |
---|
1332 | |
---|
1333 | awm->create_menu("Species", "c", AWM_ALL); |
---|
1334 | { |
---|
1335 | awm->insert_menu_topic("species_search", "Search and query", "q", "sp_search.hlp", AWM_ALL, AW_POPUP, (AW_CL)DBUI::create_species_query_window, (AW_CL)GLOBAL.gb_main); |
---|
1336 | awm->insert_menu_topic("species_info", "Species information", "i", "sp_info.hlp", AWM_ALL, NT_popup_species_window, (AW_CL)GLOBAL.gb_main, 0); |
---|
1337 | |
---|
1338 | awm->sep______________(); |
---|
1339 | |
---|
1340 | NT_insert_mark_submenus(awm, ntw, 1); |
---|
1341 | awm->insert_menu_topic("mark_by_ref", "Mark by reference..", "r", "markbyref.hlp", AWM_EXP, AW_POPUP, (AW_CL)create_mark_by_refentries_window, (AW_CL)GLOBAL.gb_main); |
---|
1342 | awm->insert_menu_topic("species_colors", "Set Colors", "l", "mark_colors.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_colorize_species_window, 0); |
---|
1343 | awm->insert_menu_topic("selection_admin", "Configurations", "o", "configuration.hlp", AWM_ALL, NT_popup_configuration_admin, (AW_CL)ntw, 0); |
---|
1344 | |
---|
1345 | awm->sep______________(); |
---|
1346 | |
---|
1347 | awm->insert_sub_menu("Database fields admin", "f"); |
---|
1348 | DBUI::insert_field_admin_menuitems(awm, GLOBAL.gb_main); |
---|
1349 | awm->close_sub_menu(); |
---|
1350 | NT_create_mask_submenu(awm); |
---|
1351 | |
---|
1352 | awm->sep______________(); |
---|
1353 | |
---|
1354 | awm->insert_menu_topic("del_marked", "Delete Marked Species", "D", "sp_del_mrkd.hlp", AWM_ALL, (AW_CB)NT_delete_mark_all_cb, (AW_CL)ntw, 0); |
---|
1355 | |
---|
1356 | awm->insert_sub_menu("Sort Species", "r"); |
---|
1357 | { |
---|
1358 | awm->insert_menu_topic("sort_by_field", "According to Database Entries", "D", "sp_sort_fld.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_build_resort_window, 0); |
---|
1359 | awm->insert_menu_topic("sort_by_tree", "According to Phylogeny", "P", "sp_sort_phyl.hlp", AWM_ALL, NT_resort_data_by_phylogeny, (AW_CL)ntw, 0); |
---|
1360 | } |
---|
1361 | awm->close_sub_menu(); |
---|
1362 | |
---|
1363 | awm->insert_sub_menu("Merge Species", "g", AWM_EXP); |
---|
1364 | { |
---|
1365 | awm->insert_menu_topic("merge_species", "Create merged species from similar species", "m", "sp_merge.hlp", AWM_EXP, AW_POPUP, (AW_CL)NT_createMergeSimilarSpeciesWindow, 0); |
---|
1366 | awm->insert_menu_topic("join_marked", "Join Marked Species", "J", "join_species.hlp", AWM_EXP, AW_POPUP, (AW_CL)NT_create_species_join_window, 0); |
---|
1367 | } |
---|
1368 | awm->close_sub_menu(); |
---|
1369 | |
---|
1370 | awm->sep______________(); |
---|
1371 | |
---|
1372 | awm->insert_menu_topic("species_submission", "Submit Species", "b", "submission.hlp", AWM_EXP, AW_POPUP, (AW_CL)AWTC_create_submission_window, (AW_CL)GLOBAL.gb_main); |
---|
1373 | |
---|
1374 | awm->sep______________(); |
---|
1375 | |
---|
1376 | awm->insert_menu_topic("new_names", "Generate New Names", "e", "sp_rename.hlp", AWM_ALL, AW_POPUP, (AW_CL)AWTC_create_rename_window, (AW_CL)GLOBAL.gb_main); |
---|
1377 | |
---|
1378 | awm->insert_sub_menu("Valid Names ...", "V", AWM_EXP); |
---|
1379 | { |
---|
1380 | awm->insert_menu_topic("imp_names", "Import names from file", "I", "vn_import.hlp", AWM_EXP, NT_importValidNames, 0, 0); |
---|
1381 | awm->insert_menu_topic("del_names", "Delete names from DB", "D", "vn_delete.hlp", AWM_EXP, NT_deleteValidNames, 0, 0); |
---|
1382 | awm->insert_menu_topic("sug_names", "Suggest valid names", "v", "vn_suggest.hlp", AWM_EXP, NT_suggestValidNames, 0, 0); |
---|
1383 | awm->insert_menu_topic("search_names", "Search manually", "m", "vn_search.hlp", AWM_EXP, AW_POPUP, (AW_CL)NT_searchManuallyNames, 0); |
---|
1384 | } |
---|
1385 | awm->close_sub_menu(); |
---|
1386 | } |
---|
1387 | |
---|
1388 | // ---------------------------- |
---|
1389 | // Genes + Experiment |
---|
1390 | |
---|
1391 | if (is_genome_db) GEN_create_genes_submenu(awm, GLOBAL.gb_main, true); |
---|
1392 | |
---|
1393 | // ------------------ |
---|
1394 | // Sequence |
---|
1395 | |
---|
1396 | awm->create_menu("Sequence", "S", AWM_ALL); |
---|
1397 | { |
---|
1398 | awm->insert_menu_topic("seq_admin", "Sequence/Alignment Admin", "A", "ad_align.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_alignment_window, 0); |
---|
1399 | awm->insert_sub_menu("Insert/delete", "I"); |
---|
1400 | { |
---|
1401 | awm->insert_menu_topic("ins_del_col", ".. column", "I", "insdel.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_insertDeleteColumn_window, 0); |
---|
1402 | awm->insert_menu_topic("ins_del_sai", ".. using SAI", "S", "insdel_sai.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_insertDeleteBySAI_window, (AW_CL)GLOBAL.gb_main); |
---|
1403 | } |
---|
1404 | awm->close_sub_menu(); |
---|
1405 | awm->sep______________(); |
---|
1406 | |
---|
1407 | awm->insert_sub_menu("Edit Sequences", "E"); |
---|
1408 | { |
---|
1409 | awm->insert_menu_topic("new_arb_edit4", "Using marked species and tree", "m", "arb_edit4.hlp", AWM_ALL, NT_start_editor_on_tree, 0, (AW_CL)ntw); |
---|
1410 | awm->insert_menu_topic("new2_arb_edit4", "... plus relatives", "r", "arb_edit4.hlp", AWM_ALL, NT_start_editor_on_tree, -1, (AW_CL)ntw); |
---|
1411 | awm->insert_menu_topic("old_arb_edit4", "Using earlier configuration", "c", "arb_edit4.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_start_editor_on_old_configuration, 0); |
---|
1412 | } |
---|
1413 | awm->close_sub_menu(); |
---|
1414 | |
---|
1415 | awm->sep______________(); |
---|
1416 | |
---|
1417 | awm->insert_sub_menu("Align Sequences", "S"); |
---|
1418 | { |
---|
1419 | awm->insert_menu_topic("arb_align", "Align sequence into an existing alignment", "A", "align.hlp", AWM_EXP, (AW_CB) AW_POPUP_HELP, (AW_CL)"align.hlp", 0); |
---|
1420 | awm->insert_menu_topic("realign_dna", "Realign nucleic acid according to aligned protein", "R", "realign_dna.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_realign_dna_window, 0); |
---|
1421 | GDE_load_menu(awm, AWM_ALL, "Align"); |
---|
1422 | } |
---|
1423 | awm->close_sub_menu(); |
---|
1424 | awm->insert_menu_topic("seq_concat", "Concatenate Sequences/Alignments", "C", "concatenate_align.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_createConcatenationWindow, 0); |
---|
1425 | awm->insert_menu_topic("track_changes", "Track alignment changes", "k", "track_ali_changes.hlp", AWM_EXP, AW_POPUP, (AW_CL)NT_create_trackAliChanges_window, 0); |
---|
1426 | awm->sep______________(); |
---|
1427 | |
---|
1428 | awm->insert_menu_topic("dna_2_pro", "Perform translation", "t", "translate_dna_2_pro.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_dna_2_pro_window, 0); |
---|
1429 | awm->insert_menu_topic("arb_dist", "Distance matrix", "D", "dist.hlp", AWM_ALL, (AW_CB)NT_system_cb, (AW_CL)"arb_dist &", 0); |
---|
1430 | awm->sep______________(); |
---|
1431 | |
---|
1432 | awm->insert_menu_topic("seq_quality", "Check Sequence Quality", "Q", "seq_quality.hlp", AWM_EXP, AW_POPUP, (AW_CL)SQ_create_seq_quality_window, (AW_CL)GLOBAL.gb_main); |
---|
1433 | awm->insert_menu_topic("chimera_check", "Chimera Check", "m", "check_quality.hlp", AWM_EXP, AW_POPUP, (AW_CL)STAT_create_quality_check_window, (AW_CL)GLOBAL.gb_main); |
---|
1434 | |
---|
1435 | awm->sep______________(); |
---|
1436 | |
---|
1437 | GDE_load_menu(awm, AWM_ALL, "Print"); |
---|
1438 | } |
---|
1439 | |
---|
1440 | // ------------- |
---|
1441 | // SAI |
---|
1442 | |
---|
1443 | awm->create_menu("SAI", "A", AWM_ALL); |
---|
1444 | { |
---|
1445 | awm->insert_menu_topic("sai_admin", "Manage SAIs", "S", "ad_extended.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_extendeds_window, 0); |
---|
1446 | awm->insert_sub_menu("Create SAI using ...", "C"); |
---|
1447 | { |
---|
1448 | awm->insert_menu_topic("sai_max_freq", "Max. Frequency", "M", "max_freq.hlp", AWM_EXP, AW_POPUP, (AW_CL)AP_open_max_freq_window, 0); |
---|
1449 | awm->insert_menu_topic("sai_consensus", "Consensus", "C", "consensus.hlp", AWM_ALL, AW_POPUP, (AW_CL)AP_open_con_expert_window, 0); |
---|
1450 | awm->insert_menu_topic("pos_var_pars", "Positional variability + Column statistic (parsimony method)", "a", "pos_var_pars.hlp", AWM_ALL, AW_POPUP, (AW_CL)AP_open_pos_var_pars_window, 0); |
---|
1451 | awm->insert_menu_topic("arb_phyl", "Filter by base frequency", "F", "phylo.hlp", AWM_ALL, (AW_CB)NT_system_cb, (AW_CL)"arb_phylo &", 0); |
---|
1452 | awm->insert_menu_topic("sai_pfold", "Protein secondary structure (field \"sec_struct\")", "P", "pfold.hlp", AWM_EXP, NT_create_sai_from_pfold, (AW_CL)ntw, 0); |
---|
1453 | |
---|
1454 | GDE_load_menu(awm, AWM_EXP, "SAI"); |
---|
1455 | } |
---|
1456 | awm->close_sub_menu(); |
---|
1457 | |
---|
1458 | awm->insert_sub_menu("Other functions", "O"); |
---|
1459 | { |
---|
1460 | awm->insert_menu_topic("pos_var_dist", "Positional variability (distance method)", "P", "pos_variability.ps", AWM_EXP, AW_POPUP, (AW_CL)AP_open_cprofile_window, 0); |
---|
1461 | awm->insert_menu_topic("count_different_chars", "Count different chars/column", "C", "count_chars.hlp", AWM_EXP, NT_count_different_chars, (AW_CL)GLOBAL.gb_main, 0); |
---|
1462 | awm->insert_menu_topic("corr_mutat_analysis", "Compute clusters of correlated positions", "m", "", AWM_ALL, NT_system_in_xterm_cb, (AW_CL)"arb_rnacma", 0); |
---|
1463 | awm->insert_menu_topic("export_pos_var", "Export Column Statistic (GNUPLOT format)", "E", "csp_2_gnuplot.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_colstat_2_gnuplot_window, 0); |
---|
1464 | } |
---|
1465 | awm->close_sub_menu(); |
---|
1466 | } |
---|
1467 | |
---|
1468 | // ---------------- |
---|
1469 | // Probes |
---|
1470 | |
---|
1471 | awm->create_menu("Probes", "P", AWM_ALL); |
---|
1472 | { |
---|
1473 | awm->insert_menu_topic("probe_design", "Design Probes", "D", "probedesign.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_probe_design_window, (AW_CL)GLOBAL.gb_main); |
---|
1474 | awm->insert_menu_topic("probe_multi", "Calculate Multi-Probes", "u", "multiprobe.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_multiprobe_window, (AW_CL)ntw); |
---|
1475 | awm->insert_menu_topic("probe_match", "Match Probes", "M", "probematch.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_probe_match_window, (AW_CL)GLOBAL.gb_main); |
---|
1476 | awm->sep______________(); |
---|
1477 | awm->insert_menu_topic("primer_design_new", "Design Primers", "P", "primer_new.hlp", AWM_EXP, AW_POPUP,(AW_CL)create_primer_design_window, (AW_CL)GLOBAL.gb_main); |
---|
1478 | awm->insert_menu_topic("primer_design", "Design Sequencing Primers", "S", "primer.hlp", AWM_EXP, (AW_CB)NT_primer_cb, 0, 0); |
---|
1479 | awm->sep______________(); |
---|
1480 | awm->insert_menu_topic("pt_server_admin", "PT_SERVER Admin", "A", "probeadmin.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_probe_admin_window, (AW_CL)GLOBAL.gb_main); |
---|
1481 | } |
---|
1482 | |
---|
1483 | } |
---|
1484 | |
---|
1485 | // -------------- |
---|
1486 | // Tree |
---|
1487 | |
---|
1488 | awm->create_menu("Tree", "T", AWM_ALL); |
---|
1489 | { |
---|
1490 | if (!clone) { |
---|
1491 | awm->insert_sub_menu("Add Species to Existing Tree", "A"); |
---|
1492 | { |
---|
1493 | awm->insert_menu_topic("arb_pars_quick", "ARB Parsimony (Quick add marked)", "Q", "pars.hlp", AWM_ALL, (AW_CB)NT_system_cb, (AW_CL)"arb_pars -add_marked -quit &", 0); |
---|
1494 | awm->insert_menu_topic("arb_pars", "ARB Parsimony interactive", "i", "pars.hlp", AWM_ALL, (AW_CB)NT_system_cb, (AW_CL)"arb_pars &", 0); |
---|
1495 | GDE_load_menu(awm, AWM_EXP, "Incremental phylogeny"); |
---|
1496 | } |
---|
1497 | awm->close_sub_menu(); |
---|
1498 | } |
---|
1499 | |
---|
1500 | awm->insert_sub_menu("Remove Species from Tree", "R"); |
---|
1501 | { |
---|
1502 | awm->insert_menu_topic(awm->local_id("tree_remove_deleted"), "Remove zombies", "z", "trm_del.hlp", AWM_ALL, (AW_CB)NT_remove_leafs, (AW_CL)ntw, AWT_REMOVE_DELETED); |
---|
1503 | awm->insert_menu_topic(awm->local_id("tree_remove_marked"), "Remove marked", "m", "trm_mrkd.hlp", AWM_ALL, (AW_CB)NT_remove_leafs, (AW_CL)ntw, AWT_REMOVE_MARKED); |
---|
1504 | awm->insert_menu_topic(awm->local_id("tree_keep_marked"), "Keep marked", "K", "tkeep_mrkd.hlp", AWM_ALL, (AW_CB)NT_remove_leafs, (AW_CL)ntw, AWT_REMOVE_NOT_MARKED|AWT_REMOVE_DELETED); |
---|
1505 | #if defined(DEVEL_RALF) |
---|
1506 | #if defined(WARN_TODO) |
---|
1507 | #warning add "remove duplicates from tree" |
---|
1508 | #endif |
---|
1509 | awm->sep______________(); |
---|
1510 | awm->insert_menu_topic("all_tree_remove_deleted", "Remove zombies from all trees", "a", "trm_del.hlp", AWM_ALL, (AW_CB)NT_alltree_remove_leafs, AWT_REMOVE_DELETED, (AW_CL)GLOBAL.gb_main); |
---|
1511 | awm->insert_menu_topic("all_tree_remove_marked", "Remove marked from all trees", "l", "trm_del.hlp", AWM_ALL, (AW_CB)NT_alltree_remove_leafs, AWT_REMOVE_MARKED, (AW_CL)GLOBAL.gb_main); |
---|
1512 | #endif // DEVEL_RALF |
---|
1513 | } |
---|
1514 | awm->close_sub_menu(); |
---|
1515 | |
---|
1516 | if (!clone) { |
---|
1517 | awm->insert_sub_menu("Build tree from sequence data", "B"); |
---|
1518 | { |
---|
1519 | awm->insert_sub_menu("Distance matrix methods", "D"); |
---|
1520 | awm->insert_menu_topic("arb_dist", "ARB Neighbour Joining", "J", "dist.hlp", AWM_ALL, (AW_CB)NT_system_cb, (AW_CL)"arb_dist &", 0); |
---|
1521 | GDE_load_menu(awm, AWM_ALL, "Phylogeny Distance Matrix"); |
---|
1522 | awm->close_sub_menu(); |
---|
1523 | |
---|
1524 | awm->insert_sub_menu("Maximum Parsimony methods", "P"); |
---|
1525 | GDE_load_menu(awm, AWM_ALL, "Phylogeny max. parsimony"); |
---|
1526 | awm->close_sub_menu(); |
---|
1527 | |
---|
1528 | awm->insert_sub_menu("Maximum Likelihood methods", "L"); |
---|
1529 | GDE_load_menu(awm, AWM_EXP, "Phylogeny max. Likelyhood EXP"); |
---|
1530 | GDE_load_menu(awm, AWM_ALL, "Phylogeny max. Likelyhood"); |
---|
1531 | awm->close_sub_menu(); |
---|
1532 | |
---|
1533 | awm->insert_sub_menu("Other methods", "O", AWM_EXP); |
---|
1534 | GDE_load_menu(awm, AWM_EXP, "Phylogeny (Other)"); |
---|
1535 | awm->close_sub_menu(); |
---|
1536 | } |
---|
1537 | awm->close_sub_menu(); |
---|
1538 | } |
---|
1539 | |
---|
1540 | awm->insert_menu_topic("consense_tree", "Build consense tree", "c", "consense_tree.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_consense_window, 0); |
---|
1541 | awm->sep______________(); |
---|
1542 | |
---|
1543 | awm->insert_sub_menu("Reset zoom", "z"); |
---|
1544 | { |
---|
1545 | awm->insert_menu_topic(awm->local_id("reset_logical_zoom"), "Logical zoom", "L", "rst_log_zoom.hlp", AWM_ALL, (AW_CB)NT_reset_lzoom_cb, (AW_CL)ntw, 0); |
---|
1546 | awm->insert_menu_topic(awm->local_id("reset_physical_zoom"), "Physical zoom", "P", "rst_phys_zoom.hlp", AWM_ALL, (AW_CB)NT_reset_pzoom_cb, (AW_CL)ntw, 0); |
---|
1547 | } |
---|
1548 | awm->close_sub_menu(); |
---|
1549 | awm->insert_sub_menu("Collapse/Expand tree", "C"); |
---|
1550 | { |
---|
1551 | awm->insert_menu_topic(awm->local_id("tree_group_all"), "Group all", "a", "tgroupall.hlp", AWM_ALL, (AW_CB)NT_group_tree_cb, (AW_CL)ntw, 0); |
---|
1552 | awm->insert_menu_topic(awm->local_id("tree_group_not_marked"), "Group all except marked", "m", "tgroupnmrkd.hlp", AWM_ALL, (AW_CB)NT_group_not_marked_cb, (AW_CL)ntw, 0); |
---|
1553 | awm->insert_menu_topic(awm->local_id("tree_group_term_groups"), "Group terminal groups", "t", "tgroupterm.hlp", AWM_ALL, (AW_CB)NT_group_terminal_cb, (AW_CL)ntw, 0); |
---|
1554 | awm->insert_menu_topic(awm->local_id("tree_ungroup_all"), "Ungroup all", "U", "tungroupall.hlp", AWM_ALL, (AW_CB)NT_ungroup_all_cb, (AW_CL)ntw, 0); |
---|
1555 | awm->sep______________(); |
---|
1556 | NT_insert_color_collapse_submenu(awm, ntw); |
---|
1557 | } |
---|
1558 | awm->close_sub_menu(); |
---|
1559 | awm->insert_sub_menu("Beautify tree", "e"); |
---|
1560 | { |
---|
1561 | awm->insert_menu_topic(awm->local_id("beautifyt_tree"), "#beautifyt.xpm", "", "resorttree.hlp", AWM_ALL, (AW_CB)NT_resort_tree_cb, (AW_CL)ntw, 0); |
---|
1562 | awm->insert_menu_topic(awm->local_id("beautifyc_tree"), "#beautifyc.xpm", "", "resorttree.hlp", AWM_ALL, (AW_CB)NT_resort_tree_cb, (AW_CL)ntw, 1); |
---|
1563 | awm->insert_menu_topic(awm->local_id("beautifyb_tree"), "#beautifyb.xpm", "", "resorttree.hlp", AWM_ALL, (AW_CB)NT_resort_tree_cb, (AW_CL)ntw, 2); |
---|
1564 | } |
---|
1565 | awm->close_sub_menu(); |
---|
1566 | awm->insert_sub_menu("Modify branches", "M"); |
---|
1567 | { |
---|
1568 | awm->insert_menu_topic(awm->local_id("tree_remove_remark"), "Remove bootstraps", "b", "trm_boot.hlp", AWM_ALL, NT_remove_bootstrap, (AW_CL)ntw, 0); |
---|
1569 | awm->sep______________(); |
---|
1570 | awm->insert_menu_topic(awm->local_id("tree_reset_lengths"), "Reset branchlengths", "R", "tbl_reset.hlp", AWM_ALL, NT_reset_branchlengths, (AW_CL)ntw, 0); |
---|
1571 | awm->insert_menu_topic(awm->local_id("justify_branch_lengths"), "Justify branchlengths", "J", "tbl_justify.hlp", AWM_ALL, NT_justify_branch_lenghs, (AW_CL)ntw, 0); |
---|
1572 | awm->insert_menu_topic(awm->local_id("tree_scale_lengths"), "Scale Branchlengths", "S", "tbl_scale.hlp", AWM_ALL, NT_scale_tree, (AW_CL)ntw, 0); |
---|
1573 | awm->sep______________(); |
---|
1574 | awm->insert_menu_topic(awm->local_id("tree_boot2len"), "Bootstraps -> Branchlengths", "l", "tbl_boot2len.hlp", AWM_ALL, NT_move_boot_branch, (AW_CL)ntw, 0); |
---|
1575 | awm->insert_menu_topic(awm->local_id("tree_len2boot"), "Bootstraps <- Branchlengths", "o", "tbl_boot2len.hlp", AWM_ALL, NT_move_boot_branch, (AW_CL)ntw, 1); |
---|
1576 | |
---|
1577 | } |
---|
1578 | awm->close_sub_menu(); |
---|
1579 | |
---|
1580 | awm->insert_menu_topic(awm->local_id("branch_analysis"), "Branch analysis", "B", "branch_analysis.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_open_branch_analysis_window, (AW_CL)ntw); |
---|
1581 | awm->insert_menu_topic(awm->local_id("mark_duplicates"), "Mark duplicates", "u", "mark_duplicates.hlp", AWM_ALL, (AW_CB)NT_mark_duplicates, (AW_CL)ntw, 0); |
---|
1582 | |
---|
1583 | awm->sep______________(); |
---|
1584 | |
---|
1585 | awm->insert_menu_topic(awm->local_id("tree_select"), "Select Tree", "T", 0, AWM_ALL, AW_POPUP, (AW_CL)NT_create_select_tree_window, (AW_CL)awar_tree); |
---|
1586 | awm->insert_menu_topic(awm->local_id("tree_select_latest"), "Select Last Tree", "L", 0, AWM_ALL, (AW_CB)NT_select_bottom_tree, (AW_CL)awar_tree, 0); |
---|
1587 | |
---|
1588 | awm->sep______________(); |
---|
1589 | |
---|
1590 | if (!clone) { |
---|
1591 | awm->insert_menu_topic("tree_admin", "Tree admin", "i", "treeadm.hlp", AWM_ALL, popup_tree_admin_window); |
---|
1592 | awm->insert_menu_topic("nds", "NDS (Node display setup)", "N", "props_nds.hlp", AWM_ALL, AW_POPUP, (AW_CL)AWT_create_nds_window, (AW_CL)GLOBAL.gb_main); |
---|
1593 | } |
---|
1594 | awm->sep______________(); |
---|
1595 | |
---|
1596 | awm->insert_menu_topic("transversion", "Transversion analysis", "y", "trans_anal.hlp", AWM_EXP, (AW_CB)AW_POPUP_HELP, (AW_CL)"trans_anal.hlp", 0); |
---|
1597 | |
---|
1598 | awm->sep______________(); |
---|
1599 | |
---|
1600 | if (!clone) { |
---|
1601 | awm->insert_menu_topic("print_tree", "Print tree", "P", "tree2prt.hlp", AWM_ALL, AWT_popup_print_window, (AW_CL)ntw, 0); |
---|
1602 | awm->insert_menu_topic("tree_2_xfig", "Export tree to XFIG", "X", "tree2file.hlp", AWM_ALL, AWT_popup_tree_export_window, (AW_CL)ntw, 0); |
---|
1603 | awm->sep______________(); |
---|
1604 | } |
---|
1605 | |
---|
1606 | if (is_genome_db) { |
---|
1607 | awm->insert_sub_menu("Other..", "O", AWM_EXP); |
---|
1608 | { |
---|
1609 | awm->insert_menu_topic(awm->local_id("tree_pseudo_species_to_organism"), "Change pseudo species to organisms in tree", "p", "tree_pseudo.hlp", AWM_EXP, (AW_CB)NT_pseudo_species_to_organism, (AW_CL)ntw, 0); |
---|
1610 | } |
---|
1611 | awm->close_sub_menu(); |
---|
1612 | } |
---|
1613 | } |
---|
1614 | |
---|
1615 | if (!clone) { |
---|
1616 | // --------------- |
---|
1617 | // Tools |
---|
1618 | |
---|
1619 | awm->create_menu("Tools", "o", AWM_ALL); |
---|
1620 | { |
---|
1621 | awm->insert_menu_topic("names_admin", "Name server admin", "s", "namesadmin.hlp", AWM_ALL, AW_POPUP, (AW_CL)AW_create_namesadmin_window, (AW_CL)GLOBAL.gb_main); |
---|
1622 | awm->insert_sub_menu("DB admin", "D", AWM_EXP); |
---|
1623 | { |
---|
1624 | awm->insert_menu_topic("db_admin", "Re-repair DB", "R", "rerepair.hlp", AWM_EXP, NT_rerepair_DB, (AW_CL)GLOBAL.gb_main, 0); |
---|
1625 | } |
---|
1626 | awm->close_sub_menu(); |
---|
1627 | awm->insert_sub_menu("Network", "N", AWM_EXP); |
---|
1628 | { |
---|
1629 | GDE_load_menu(awm, AWM_EXP, "User"); |
---|
1630 | } |
---|
1631 | awm->close_sub_menu(); |
---|
1632 | awm->sep______________(); |
---|
1633 | |
---|
1634 | awm->insert_sub_menu("GDE specials", "G", AWM_EXP); |
---|
1635 | { |
---|
1636 | GDE_load_menu(awm, AWM_EXP, 0, 0); |
---|
1637 | } |
---|
1638 | awm->close_sub_menu(); |
---|
1639 | |
---|
1640 | awm->insert_sub_menu("WL specials", "W", AWM_EXP); |
---|
1641 | { |
---|
1642 | awm->insert_menu_topic(awm->local_id("view_probe_group_result"), "View probe group result", "V", "", AWM_EXP, AW_POPUP, (AW_CL)create_probe_group_result_window, (AW_CL)ntw); |
---|
1643 | } |
---|
1644 | awm->close_sub_menu(); |
---|
1645 | |
---|
1646 | awm->sep______________(); |
---|
1647 | awm->insert_menu_topic("xterm", "Start XTERM", "X", 0, AWM_ALL, (AW_CB)GB_xterm, 0, 0); |
---|
1648 | } |
---|
1649 | // -------------------- |
---|
1650 | // Properties |
---|
1651 | |
---|
1652 | awm->create_menu("Properties", "r", AWM_ALL); |
---|
1653 | { |
---|
1654 | awm->insert_menu_topic("props_menu", "Frame settings", "F", "props_frame.hlp", AWM_ALL, AW_POPUP, (AW_CL)AW_preset_window, 0); |
---|
1655 | awm->insert_sub_menu("Tree settings", "T"); |
---|
1656 | { |
---|
1657 | awm->insert_menu_topic(awm->local_id("props_tree2"), "Tree options", "o", "nt_tree_settings.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_tree_setting, (AW_CL)ntw); |
---|
1658 | awm->insert_menu_topic("props_tree", "Tree colors & fonts", "c", "nt_props_data.hlp", AWM_ALL, AW_POPUP, (AW_CL)AW_create_gc_window, (AW_CL)ntw->gc_manager); |
---|
1659 | } |
---|
1660 | awm->close_sub_menu(); |
---|
1661 | awm->insert_menu_topic("props_www", "Search world wide web (WWW)", "W", "props_www.hlp", AWM_ALL, AW_POPUP, (AW_CL)AWT_open_www_window, (AW_CL)GLOBAL.gb_main); |
---|
1662 | awm->sep______________(); |
---|
1663 | awm->insert_menu_topic("!toggle_expert", "Toggle expert mode", "x", 0, AWM_ALL, NT_toggle_expert_mode, 0, 0); |
---|
1664 | awm->insert_menu_topic("!toggle_focus", "Toggle focus follows mouse", "f", 0, AWM_ALL, NT_toggle_focus_policy, 0, 0); |
---|
1665 | awm->sep______________(); |
---|
1666 | AW_insert_common_property_menu_entries(awm); |
---|
1667 | awm->sep______________(); |
---|
1668 | awm->insert_menu_topic("save_props", "Save properties (ntree.arb)", "S", "savedef.hlp", AWM_ALL, (AW_CB) AW_save_properties, 0, 0); |
---|
1669 | } |
---|
1670 | } |
---|
1671 | |
---|
1672 | awm->insert_help_topic("ARB_NT help", "N", "arb_ntree.hlp", AWM_ALL, (AW_CB)AW_POPUP_HELP, (AW_CL)"arb_ntree.hlp", 0); |
---|
1673 | |
---|
1674 | awm->create_mode("select.xpm", "mode_select.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_SELECT); |
---|
1675 | awm->create_mode("mark.xpm", "mode_mark.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_MARK); |
---|
1676 | awm->create_mode("group.xpm", "mode_group.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_GROUP); |
---|
1677 | awm->create_mode("pzoom.xpm", "mode_pzoom.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_ZOOM); |
---|
1678 | awm->create_mode("lzoom.xpm", "mode_lzoom.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_LZOOM); |
---|
1679 | awm->create_mode("modify.xpm", "mode_info.hlp", AWM_ALL, (AW_CB)NT_modify_cb, (AW_CL)ntw, (AW_CL)AWT_MODE_EDIT); |
---|
1680 | awm->create_mode("www_mode.xpm", "mode_www.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_WWW); |
---|
1681 | |
---|
1682 | awm->create_mode("line.xpm", "mode_width.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_LINE); |
---|
1683 | awm->create_mode("rot.xpm", "mode_rotate.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_ROT); |
---|
1684 | awm->create_mode("spread.xpm", "mode_angle.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_SPREAD); |
---|
1685 | awm->create_mode("swap.xpm", "mode_swap.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_SWAP); |
---|
1686 | awm->create_mode("length.xpm", "mode_length.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_LENGTH); |
---|
1687 | awm->create_mode("move.xpm", "mode_move.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_MOVE); |
---|
1688 | awm->create_mode("setroot.xpm", "mode_set_root.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_SETROOT); |
---|
1689 | awm->create_mode("reset.xpm", "mode_reset.hlp", AWM_ALL, (AW_CB)nt_mode_event, (AW_CL)ntw, (AW_CL)AWT_MODE_RESET); |
---|
1690 | |
---|
1691 | awm->set_info_area_height(250); |
---|
1692 | awm->at(5, 2); |
---|
1693 | awm->auto_space(-2, -2); |
---|
1694 | awm->shadow_width(1); |
---|
1695 | |
---|
1696 | // ------------------------- |
---|
1697 | // create top area |
---|
1698 | |
---|
1699 | int first_liney; |
---|
1700 | int leftx; |
---|
1701 | awm->get_at_position(&leftx, &first_liney); |
---|
1702 | |
---|
1703 | // --------------------- |
---|
1704 | // quit + help |
---|
1705 | |
---|
1706 | awm->button_length(0); |
---|
1707 | |
---|
1708 | if (clone) { |
---|
1709 | awm->callback(AW_POPDOWN); |
---|
1710 | awm->create_button("CLOSE", "#close.xpm"); |
---|
1711 | } |
---|
1712 | else { |
---|
1713 | awm->callback(nt_exit, EXIT_SUCCESS); |
---|
1714 | awm->help_text("quit.hlp"); |
---|
1715 | awm->create_button("QUIT", "#quit.xpm"); |
---|
1716 | } |
---|
1717 | |
---|
1718 | int db_pathx = awm->get_at_xposition(); |
---|
1719 | |
---|
1720 | // now fetch the yposition for the 2nd button line |
---|
1721 | awm->at_newline(); |
---|
1722 | int second_liney = awm->get_at_yposition(); |
---|
1723 | |
---|
1724 | awm->callback(AW_help_entry_pressed); |
---|
1725 | awm->help_text("arb_ntree.hlp"); |
---|
1726 | awm->create_button("?", "#help.xpm"); |
---|
1727 | |
---|
1728 | // -------------------------- |
---|
1729 | // save + undo/redo |
---|
1730 | |
---|
1731 | awm->callback(NT_save_quick_cb); |
---|
1732 | awm->help_text("save.hlp"); |
---|
1733 | awm->create_button("SAVE", "#save.xpm"); |
---|
1734 | |
---|
1735 | awm->callback(AW_POPUP, (AW_CL)NT_create_save_as, (AW_CL)"tmp/nt/arbdb"); |
---|
1736 | awm->help_text("saveas.hlp"); |
---|
1737 | awm->create_button("SAVE_AS", "#saveAs.xpm"); |
---|
1738 | |
---|
1739 | // undo/redo: |
---|
1740 | awm->callback(NT_undo_cb, (AW_CL)GB_UNDO_UNDO, (AW_CL)ntw); |
---|
1741 | awm->help_text("undo.hlp"); |
---|
1742 | awm->create_button("UNDO", "#undo.xpm"); |
---|
1743 | |
---|
1744 | awm->callback(NT_undo_cb, (AW_CL)GB_UNDO_REDO, (AW_CL)ntw); |
---|
1745 | awm->help_text("undo.hlp"); |
---|
1746 | awm->create_button("REDO", "#redo.xpm"); |
---|
1747 | |
---|
1748 | int db_pathx2 = awm->get_at_xposition(); |
---|
1749 | |
---|
1750 | // fetch position for mode help-line: |
---|
1751 | awm->at_newline(); |
---|
1752 | int third_liney = awm->get_at_yposition(); |
---|
1753 | |
---|
1754 | awm->at(db_pathx, first_liney); |
---|
1755 | // size of DB-name button is determined by buttons below: |
---|
1756 | awm->at_set_to(false, false, db_pathx2-db_pathx-1, second_liney-first_liney+1); |
---|
1757 | awm->callback(AW_POPUP, (AW_CL)NT_create_save_quick_as, (AW_CL)"tmp/nt/arbdb"); // do sth else |
---|
1758 | awm->help_text("saveas.hlp"); |
---|
1759 | awm->create_button("QUICK_SAVE_AS", AWAR_DB_NAME); |
---|
1760 | |
---|
1761 | // ----------------------------- |
---|
1762 | // tree + tree display |
---|
1763 | |
---|
1764 | #define TREE_BUTTON_OVERSIZE 6 |
---|
1765 | |
---|
1766 | int db_treex = awm->get_at_xposition(); |
---|
1767 | int second_uppery = second_liney-TREE_BUTTON_OVERSIZE; |
---|
1768 | |
---|
1769 | awm->at(db_treex, second_uppery); |
---|
1770 | awm->button_length(0); |
---|
1771 | |
---|
1772 | awm->callback((AW_CB)NT_set_tree_style, (AW_CL)ntw, (AW_CL)AP_TREE_RADIAL); |
---|
1773 | awm->help_text("tr_type_radial.hlp"); |
---|
1774 | awm->create_button("RADIAL_TREE_TYPE", "#radial.xpm"); |
---|
1775 | |
---|
1776 | awm->callback((AW_CB)NT_set_tree_style, (AW_CL)ntw, (AW_CL)AP_TREE_NORMAL); |
---|
1777 | awm->help_text("tr_type_list.hlp"); |
---|
1778 | awm->create_button("LIST_TREE_TYPE", "#dendro.xpm"); |
---|
1779 | |
---|
1780 | awm->callback((AW_CB)NT_set_tree_style, (AW_CL)ntw, (AW_CL)AP_TREE_IRS); |
---|
1781 | awm->help_text("tr_type_irs.hlp"); |
---|
1782 | awm->create_button("FOLDED_LIST_TREE_TYPE", "#dendroIrs.xpm"); |
---|
1783 | |
---|
1784 | awm->callback((AW_CB)NT_set_tree_style, (AW_CL)ntw, (AW_CL)AP_LIST_NDS); |
---|
1785 | awm->help_text("tr_type_nds.hlp"); |
---|
1786 | awm->create_button("NO_TREE_TYPE", "#listdisp.xpm"); |
---|
1787 | |
---|
1788 | int db_treex2 = awm->get_at_xposition(); |
---|
1789 | |
---|
1790 | awm->at(db_treex, first_liney); |
---|
1791 | // size of tree-name button is determined by buttons below: |
---|
1792 | awm->at_set_to(false, false, db_treex2-db_treex-1, second_uppery-first_liney+1); |
---|
1793 | awm->callback((AW_CB2)AW_POPUP, (AW_CL)NT_create_select_tree_window, (AW_CL)awar_tree); |
---|
1794 | awm->help_text("nt_tree_select.hlp"); |
---|
1795 | awm->create_button("SELECT_A_TREE", awar_tree); |
---|
1796 | |
---|
1797 | // --------------------------------------------------------------- |
---|
1798 | // protection, alignment + editor (and maybe Genome Map) |
---|
1799 | |
---|
1800 | int db_alignx = awm->get_at_xposition(); |
---|
1801 | |
---|
1802 | // editor and genemap buttons have to be 44x24 sized |
---|
1803 | #define EDIT_XSIZE 50 |
---|
1804 | #define EDIT_YSIZE 30 // same as 'save as' buttons |
---|
1805 | |
---|
1806 | // first draw protection: |
---|
1807 | int protectx = db_alignx + 2*EDIT_XSIZE; |
---|
1808 | |
---|
1809 | awm->at(protectx+2, first_liney+1); |
---|
1810 | awm->button_length(0); |
---|
1811 | awm->create_button(NULL, "#protect.xpm"); |
---|
1812 | |
---|
1813 | awm->at(protectx, second_liney+2); |
---|
1814 | awm->create_option_menu(AWAR_SECURITY_LEVEL); |
---|
1815 | awm->insert_option("0", 0, 0); |
---|
1816 | awm->insert_option("1", 0, 1); |
---|
1817 | awm->insert_option("2", 0, 2); |
---|
1818 | awm->insert_option("3", 0, 3); |
---|
1819 | awm->insert_option("4", 0, 4); |
---|
1820 | awm->insert_option("5", 0, 5); |
---|
1821 | awm->insert_default_option("6", 0, 6); |
---|
1822 | awm->update_option_menu(); |
---|
1823 | |
---|
1824 | int db_searchx = awm->get_at_xposition() - 7; |
---|
1825 | |
---|
1826 | // draw ali/editor buttons AFTER protect menu (to get rid of it's label) |
---|
1827 | awm->at(db_alignx, second_liney); |
---|
1828 | |
---|
1829 | awm->at_set_to(false, false, ((2-is_genome_db)*EDIT_XSIZE), EDIT_YSIZE); |
---|
1830 | awm->callback(NT_start_editor_on_tree, 0, (AW_CL)ntw); |
---|
1831 | awm->help_text("arb_edit4.hlp"); |
---|
1832 | awm->create_button("EDIT_SEQUENCES", "#edit.xpm"); |
---|
1833 | |
---|
1834 | if (is_genome_db) { |
---|
1835 | awm->at_set_to(false, false, EDIT_XSIZE, EDIT_YSIZE); |
---|
1836 | awm->callback((AW_CB)AW_POPUP, (AW_CL)GEN_create_first_map, (AW_CL)GLOBAL.gb_main); // initial gene map |
---|
1837 | awm->help_text("gene_map.hlp"); |
---|
1838 | awm->create_button("OPEN_GENE_MAP", "#gen_map.xpm"); |
---|
1839 | } |
---|
1840 | |
---|
1841 | int db_alignx2 = awm->get_at_xposition(); |
---|
1842 | |
---|
1843 | awm->at(db_alignx, first_liney); |
---|
1844 | awm->at_set_to(false, false, db_alignx2-db_alignx-1, second_liney-first_liney+1); |
---|
1845 | awm->callback(AW_POPUP, (AW_CL)NT_open_select_alignment_window, 0); |
---|
1846 | awm->help_text("nt_align_select.hlp"); |
---|
1847 | awm->create_button("SELECT_AN_ALIGNMENT", AWAR_DEFAULT_ALIGNMENT); |
---|
1848 | |
---|
1849 | // ------------------------------- |
---|
1850 | // create mode-help line |
---|
1851 | |
---|
1852 | awm->at(leftx, third_liney); |
---|
1853 | awm->button_length(AWAR_FOOTER_MAX_LEN); |
---|
1854 | awm->create_button(0, AWAR_FOOTER); |
---|
1855 | |
---|
1856 | awm->at_newline(); |
---|
1857 | int bottomy = awm->get_at_yposition(); |
---|
1858 | |
---|
1859 | // --------------------------------------- |
---|
1860 | // Info / marked / Search / Jump |
---|
1861 | |
---|
1862 | awm->button_length(7); |
---|
1863 | |
---|
1864 | awm->at(db_searchx, first_liney); |
---|
1865 | awm->callback(AW_POPUP, (AW_CL)DBUI::create_species_query_window, (AW_CL)GLOBAL.gb_main); |
---|
1866 | awm->help_text("sp_search.hlp"); |
---|
1867 | awm->create_button("SEARCH", "Search"); |
---|
1868 | |
---|
1869 | awm->at(db_searchx, second_uppery); |
---|
1870 | awm->callback((AW_CB)NT_jump_cb, (AW_CL)ntw, 1); |
---|
1871 | awm->help_text("tr_jump.hlp"); |
---|
1872 | awm->create_button("JUMP", "Jump"); |
---|
1873 | |
---|
1874 | int db_infox = awm->get_at_xposition(); |
---|
1875 | |
---|
1876 | awm->at(db_infox, first_liney); |
---|
1877 | awm->button_length(13); |
---|
1878 | awm->callback(NT_popup_species_window, (AW_CL)GLOBAL.gb_main, 0); |
---|
1879 | awm->help_text("sp_search.hlp"); |
---|
1880 | awm->create_button("INFO", AWAR_INFO_BUTTON_TEXT); |
---|
1881 | |
---|
1882 | awm->at(db_infox, second_uppery); |
---|
1883 | awm->button_length(13); |
---|
1884 | awm->help_text("marked_species.hlp"); |
---|
1885 | awm->callback(NT_popup_configuration_admin, (AW_CL)ntw, 0); |
---|
1886 | awm->create_button("selection_admin", AWAR_MARKED_SPECIES_COUNTER); |
---|
1887 | { |
---|
1888 | GBDATA *gb_species_data = GBT_get_species_data(GLOBAL.gb_main); |
---|
1889 | GB_add_callback(gb_species_data, GB_CB_CHANGED, NT_update_marked_counter, (int*)awm); |
---|
1890 | NT_update_marked_counter(NULL, (int*)awm, GB_CB_NONE); |
---|
1891 | } |
---|
1892 | |
---|
1893 | // set height of top area: |
---|
1894 | awm->set_info_area_height(bottomy+2); |
---|
1895 | awm->set_bottom_area_height(0); |
---|
1896 | |
---|
1897 | // ------------------------------------ |
---|
1898 | // Autostarts for development |
---|
1899 | |
---|
1900 | #if defined(DEVEL_RALF) |
---|
1901 | // if (is_genome_db) GEN_map_first(awr)->show(); |
---|
1902 | #endif // DEVEL_RALF |
---|
1903 | |
---|
1904 | GB_pop_transaction(GLOBAL.gb_main); |
---|
1905 | |
---|
1906 | return awm; |
---|
1907 | } |
---|
1908 | |
---|
1909 | void nt_create_main_window(AW_root *aw_root) { |
---|
1910 | GB_ERROR error = GB_request_undo_type(GLOBAL.gb_main, GB_UNDO_NONE); |
---|
1911 | if (error) aw_message(error); |
---|
1912 | |
---|
1913 | nt_create_all_awars(aw_root, AW_ROOT_DEFAULT); |
---|
1914 | |
---|
1915 | AW_window *aww = popup_new_main_window(aw_root, 0); |
---|
1916 | aww->show(); |
---|
1917 | |
---|
1918 | error = GB_request_undo_type(GLOBAL.gb_main, GB_UNDO_UNDO); |
---|
1919 | if (error) aw_message(error); |
---|
1920 | } |
---|