| 1 | #include <stdio.h> |
|---|
| 2 | #include <stdlib.h> |
|---|
| 3 | |
|---|
| 4 | #include <arbdb.h> |
|---|
| 5 | #include <arbdbt.h> |
|---|
| 6 | |
|---|
| 7 | #include <aw_root.hxx> |
|---|
| 8 | #include <aw_device.hxx> |
|---|
| 9 | #include <aw_window.hxx> |
|---|
| 10 | #include <aw_awars.hxx> |
|---|
| 11 | #include <awt_canvas.hxx> |
|---|
| 12 | #include <awt.hxx> |
|---|
| 13 | |
|---|
| 14 | #include <awt_tree.hxx> |
|---|
| 15 | #include <awt_dtree.hxx> |
|---|
| 16 | #include "ad_trees.hxx" |
|---|
| 17 | #include "ntree.hxx" |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | #define AWT_TREE(ntw) ((AWT_graphic_tree *)ntw->tree_disp) |
|---|
| 21 | |
|---|
| 22 | void |
|---|
| 23 | NT_delete_mark_all_cb(void *dummy, AWT_canvas *ntw) { |
|---|
| 24 | AWUSE(dummy); |
|---|
| 25 | GB_ERROR error = 0; |
|---|
| 26 | if (aw_message("Are you sure to delete species ??\n" |
|---|
| 27 | "This will destroy primary data !!!","YES,NO")) return; |
|---|
| 28 | GB_begin_transaction(ntw->gb_main); |
|---|
| 29 | GBDATA *gb_species,*gb_next; |
|---|
| 30 | for (gb_species = GBT_first_marked_species(gb_main); gb_species; gb_species = gb_next ) { |
|---|
| 31 | gb_next = GBT_next_marked_species(gb_species); |
|---|
| 32 | if (!error) error = GB_delete(gb_species); |
|---|
| 33 | else break; |
|---|
| 34 | } |
|---|
| 35 | if (error) { |
|---|
| 36 | aw_message(error); |
|---|
| 37 | GB_abort_transaction(ntw->gb_main); |
|---|
| 38 | }else{ |
|---|
| 39 | GB_commit_transaction(ntw->gb_main); |
|---|
| 40 | } |
|---|
| 41 | ntw->refresh(); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | AW_window * |
|---|
| 46 | NT_open_select_tree_window(AW_root *awr,char *awar_tree) |
|---|
| 47 | { |
|---|
| 48 | AW_window_simple *aws; |
|---|
| 49 | |
|---|
| 50 | aws = new AW_window_simple; |
|---|
| 51 | aws->init( awr, "SELECT_TREE", "SELECT A TREE", 400, 200 ); |
|---|
| 52 | aws->load_xfig("select_tree.fig"); |
|---|
| 53 | |
|---|
| 54 | aws->at("trees"); |
|---|
| 55 | aws->callback((AW_CB0)AW_POPDOWN); |
|---|
| 56 | awt_create_selection_list_on_trees(gb_main,(AW_window *)aws,awar_tree); |
|---|
| 57 | |
|---|
| 58 | aws->at("close"); |
|---|
| 59 | aws->callback(AW_POPDOWN); |
|---|
| 60 | aws->create_button("CLOSE","CLOSE","C"); |
|---|
| 61 | |
|---|
| 62 | aws->at("modify"); |
|---|
| 63 | aws->callback(AW_POPUP,(AW_CL)create_trees_window,0); |
|---|
| 64 | aws->help_text("treeadm.hlp"); |
|---|
| 65 | aws->create_button("MODIFY","MODIFY","M"); |
|---|
| 66 | |
|---|
| 67 | return (AW_window *)aws; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | void NT_select_last_tree(AW_window *aww,char *awar_tree){ |
|---|
| 71 | GB_transaction dummy(gb_main); |
|---|
| 72 | char *ltree = GBT_find_latest_tree(gb_main); |
|---|
| 73 | if (ltree){ |
|---|
| 74 | aww->get_root()->awar(awar_tree)->write_string(ltree); |
|---|
| 75 | delete ltree; |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | AW_window *create_alignment_window(AW_root *root,AW_default aw_def); |
|---|
| 80 | |
|---|
| 81 | AW_window * |
|---|
| 82 | NT_open_select_alignment_window(AW_root *awr) |
|---|
| 83 | { |
|---|
| 84 | static AW_window_simple *aws = 0; |
|---|
| 85 | if (aws) return (AW_window *)aws; |
|---|
| 86 | |
|---|
| 87 | aws = new AW_window_simple; |
|---|
| 88 | aws->init( awr, "SELECT_ALIGNMENT", "SELECT AN ALIGNMENT", 400, 200 ); |
|---|
| 89 | aws->at(10,10); |
|---|
| 90 | aws->auto_space(0,0); |
|---|
| 91 | aws->callback((AW_CB0)AW_POPDOWN); |
|---|
| 92 | awt_create_selection_list_on_ad(gb_main,(AW_window *)aws,AWAR_DEFAULT_ALIGNMENT,"*="); |
|---|
| 93 | aws->at_newline(); |
|---|
| 94 | |
|---|
| 95 | aws->callback(AW_POPDOWN); |
|---|
| 96 | aws->create_button("CLOSE","CLOSE","C"); |
|---|
| 97 | |
|---|
| 98 | aws->callback(AW_POPUP,(AW_CL)create_alignment_window,0); |
|---|
| 99 | aws->help_text("ad_align.hlp"); |
|---|
| 100 | aws->create_button("MODIFY","MODIFY","M"); |
|---|
| 101 | |
|---|
| 102 | aws->window_fit(); |
|---|
| 103 | return (AW_window *)aws; |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | void NT_system_cb(AW_window *aww, AW_CL command, AW_CL auto_help_file) |
|---|
| 107 | { |
|---|
| 108 | char *sys = (char *)command; |
|---|
| 109 | if (auto_help_file) { |
|---|
| 110 | AW_POPUP_HELP(aww,auto_help_file); |
|---|
| 111 | } |
|---|
| 112 | GBCMC_system(gb_main,sys); |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | void NT_system_cb2(AW_window *aww, AW_CL command, AW_CL auto_help_file) |
|---|
| 116 | { |
|---|
| 117 | char *sys = (char *)command; |
|---|
| 118 | if (auto_help_file) { |
|---|
| 119 | AW_POPUP_HELP(aww,auto_help_file); |
|---|
| 120 | } |
|---|
| 121 | GB_xcmd(sys,GB_TRUE); |
|---|
| 122 | } |
|---|