70 #define MARK_MODE_LOWER_BITS (1|2)
71 #define MARK_MODE_UPPER_BITS (4|8|16)
73 #define COUNTING_MARKED(mode) (((mode)&MARK_MODE_LOWER_BITS) == 3)
81 case 0: buf.
cat(
"There are NO");
break;
82 case 1: buf.
cat(
"There is 1");
break;
83 default: buf.
nprintf(100,
"There are %li", count);
break;
92 buf.
cat(
" full-sequence species");
95 buf.
cat(
" partial-sequence species");
100 buf.
nprintf(100,
" species with data in '%s'", ali);
112 buf.
cat(
" inside the tree");
115 buf.
cat(
" outside the tree");
120 if ((mark_mode&MARK_MODE_UPPER_BITS) == 0 && tree_mode == 0) {
121 static bool hintShown =
false;
123 buf.
cat(
"\n(The number of species is displayed in the top area as well)");
137 long wanted = (
long)cd_partial;
141 return partial == wanted;
254 bool mark_me =
false;
325 bool append = attrib[0] ==
'-';
326 if (append) ++attrib;
337 if (islower(entry[0])) entry[0] = toupper(entry[0]);
353 id = strdup(id_suffix);
359 const char *hotkey,
const char *helpfile,
const WindowCallback& wcb)
373 insert_mark_topic(awm, mask, attrib,
"count_marked",
"Count marks of all %sSpecies%s",
"C",
"sp_mark.hlp", makeWindowCallback(
NT_mark_all_cb, ntw, 3+affect));
377 insert_mark_topic(awm, mask, attrib,
"swap_marked",
"Invert marks of all %sSpecies%s",
"I",
"sp_mark.hlp", makeWindowCallback(
NT_mark_all_cb, ntw, 2+affect));
383 insert_mark_topic(awm, mask, attrib,
"count_marked_tree",
"Count marks of %sSpecies%s in Tree",
"C",
"sp_mark.hlp", makeWindowCallback(
mark_tree_cb, ntw, 3+affect));
385 insert_mark_topic(awm, mask, attrib,
"mark_tree",
"Mark %sSpecies%s in Tree",
"M",
"sp_mark.hlp", makeWindowCallback(
mark_tree_cb, ntw, 1+affect));
386 insert_mark_topic(awm, mask, attrib,
"unmark_tree",
"Unmark %sSpecies%s in Tree",
"U",
"sp_mark.hlp", makeWindowCallback(
mark_tree_cb, ntw, 0+affect));
387 insert_mark_topic(awm, mask, attrib,
"swap_marked_tree",
"Invert marks of %sSpecies%s in Tree",
"I",
"sp_mark.hlp", makeWindowCallback(
mark_tree_cb, ntw, 2+affect));
393 insert_mark_topic(awm, mask, attrib,
"count_marked_nontree",
"Count marks of %sSpecies%s NOT in Tree",
"C",
"sp_mark.hlp", makeWindowCallback(
mark_nontree_cb, ntw, 3+affect));
395 insert_mark_topic(awm, mask, attrib,
"mark_nontree",
"Mark %sSpecies%s NOT in Tree",
"M",
"sp_mark.hlp", makeWindowCallback(
mark_nontree_cb, ntw, 1+affect));
396 insert_mark_topic(awm, mask, attrib,
"unmark_nontree",
"Unmark %sSpecies%s NOT in Tree",
"U",
"sp_mark.hlp", makeWindowCallback(
mark_nontree_cb, ntw, 0+affect));
397 insert_mark_topic(awm, mask, attrib,
"swap_marked_nontree",
"Invert marks of %sSpecies%s NOT in Tree",
"I",
"sp_mark.hlp", makeWindowCallback(
mark_nontree_cb, ntw, 2+affect));
404 if (insert_as_submenu) {
425 if (insert_as_submenu) {
439 agt->
group_tree(root_node, mode, color_group);
454 const int MAXLABEL = 31;
461 char label_buf[MAXLABEL+1];
462 char entry_buf[MAXENTRY+1];
464 const char *hotkeys =
"AN1234567890BC"+1;
467 hotkey[0] = hotkeys[i];
468 if (hotkey[0] ==
' ') hotkey[0] = 0;
472 strcpy(label_buf,
"tree_group_not_any_color");
473 strcpy(entry_buf,
"Any color group");
476 sprintf(label_buf,
"tree_group_not_color_%i", i);
479 size_t len = strlen(color_group_name);
483 sprintf(entry_buf,
"%s group '%s'", hotkey, color_group_name);
484 free(color_group_name);
488 strcpy(label_buf,
"tree_group_not_no_color");
489 strcpy(entry_buf,
"No color group");
501 const char *grouphelp =
"tree_group.hlp";
525 if (displayed_tree_cb(
AWT_TREE(ntw)->get_root_node(), error)) {
557 AWT_TREE(ntw)->set_tree_style(style, ntw);
573 AWT_TREE(ntw)->get_tree_root()->remove_leafs(mode);
601 char *aci =
aw_input(
"Enter ACI to apply to all branch remarks:");
611 error = ta.
close(error);
662 direction ?
"bootstrap values" :
"branchlengths");
672 char *answer =
aw_input(
"Enter scale factor",
"Scale branchlengths by factor:",
"100");
674 double factor = atof(answer);
710 if (name[0] || gb_group) {
713 bool jump_to_group = gb_group &&
is_tree;
760 if (found || !is_tree) {
762 bool repeat = is_IRS;
792 int border = screen.
b/10;
793 do_vcenter = S.
ypos()<border || S.
ypos()>(screen.
b-border);
796 do_vcenter = S.
ypos()<0.0 || S.
ypos()>screen.
b;
801 scroll_y = (
int)(S.
ypos() - screen.
b*(is_IRS ? .6 : .5));
809 scroll_x = (
int) (S.
xpos() - screen.
r * (is_tree ? .5 : .02));
821 scroll_x = (
int)(S.
xpos() - screen.
r * relPos);
823 else if (S.
xpos()>screen.
r) {
824 scroll_x = (
int)(S.
xpos() - screen.
r * .5);
828 if (scroll_x || scroll_y) ntw->
scroll(scroll_x, scroll_y);
842 if (!found && is_tree && verboose && !msg) {
851 msg = strdup(
"Neither species nor group selected");
913 int zombies, duplicates;
916 if (zombies || duplicates) {
917 const char *msg =
NULp;
930 if (unzoom_and_expose) {
GB_HASH * GBT_create_marked_species_hash(GBDATA *gb_main)
AW::Vector transform(const AW::Vector &vec) const
AWT_graphic_tree * get_graphic_tree() const
GB_ERROR NT_with_displayed_tree_do(TREE_canvas *ntw, bool(*displayed_tree_cb)(TreeNode *tree, GB_ERROR &error))
GBDATA * get_group_data() const
AP_tree * get_logical_root()
void bootstrap2branchlen()
AP_tree_root * get_tree_root()
static void group_and_refold_tree(TREE_canvas *ntw, CollapseMode mode, int color_group)
virtual GB_ERROR load_from_DB(GBDATA *gb_main, const char *name)=0
static void tree_recompute_cb(UNFIXED, AWT_canvas *ntw)
static void expand_color_cb(UNFIXED, TREE_canvas *ntw, int colornum)
static char * create_mark_menu_id(const char *attrib, const char *id_suffix)
void request_zoom_reset()
void NT_remove_leafs(UNFIXED, TREE_canvas *ntw, AWT_RemoveType mode)
void suppress_update_and_refresh()
void NT_edit_bootstrap(UNFIXED, TREE_canvas *ntw)
void nt_mode_event(UNFIXED, TREE_canvas *ntw, AWT_COMMAND_MODE mode)
const AW_screen_area & get_area_size() const
TreeNode * findLeafNamed(const char *wantedName)
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
long GBT_mark_all_that(GBDATA *gb_main, int flag, bool(*condition)(GBDATA *, void *), void *cd)
#define MODE_TEXT_2BUTTONS(modeName, leftInfo, rightInfo)
void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback &wcb)
void NT_remove_species_in_tree_from_hash(AP_tree *tree, GB_HASH *hash)
void set_logical_root_to(AP_tree *node)
#define AWAR_DTREE_AUTO_JUMP_TREE
long GBT_mark_all(GBDATA *gb_main, int flag)
void NT_mark_all_cb(UNFIXED, TREE_canvas *ntw, int mark_mode)
void NT_remove_bootstrap(UNFIXED, TREE_canvas *ntw)
void NT_move_boot_branch(UNFIXED, TREE_canvas *ntw, int direction)
long mark_species_in_tree_that(AP_tree *at, int mark, bool(*condition)(GBDATA *, void *), void *cd)
void NT_reset_pzoom_cb(UNFIXED, TREE_canvas *ntw)
static void mark_nontree_cb(UNFIXED, TREE_canvas *ntw, int mark_mode)
static void mark_tree_cb(UNFIXED, TREE_canvas *ntw, int mark_mode)
#define MODE_TEXT_PLACEHOLDER()
static void insert_mark_topic(AW_window_menu_modes *awm, AW_active mask, const char *attrib, const char *id_suffix, const char *entry_template, const char *hotkey, const char *helpfile, const WindowCallback &wcb)
const char * GBS_global_string(const char *templat,...)
void sync_DB_model_and_view(bool perform_refresh)
void AW_advice(const char *message, AW_Advice_Type type, const char *title, const char *corresponding_help)
Show a message box with an advice for the user.
void forget_auto_unfolded()
void TREE_auto_jump_cb(UNFIXED, TREE_canvas *ntw, AP_tree_jump_reason cause)
static void insert_mark_topics(AW_window_menu_modes *awm, AW_active mask, TREE_canvas *ntw, int affect, const char *attrib)
void NT_reinit_treetype(UNFIXED, TREE_canvas *ntw)
int GBT_is_partial(GBDATA *gb_species, int default_value, bool define_if_undef)
GB_HASH * GBT_create_species_hash(GBDATA *gb_main)
void cat(const char *from)
long mark_species_in_tree(AP_tree *at, int mark)
void TREE_GC_changed_cb(GcChange whatChanged, AWT_canvas *ntw)
bool is_logically_zoomed()
#define AWAR_FOOTER_MAX_LEN
GB_ERROR GB_push_transaction(GBDATA *gbd)
void reset_branchlengths()
#define DOWNCAST(totype, expr)
AW_device_size * get_size_device(AW_area area)
#define AWAR_DTREE_AUTO_UNFOLD
struct Unfixed_cb_parameter * UNFIXED
const char * plural(NUM val)
void auto_unfold(AP_tree *want_visible)
static void collapse_all_cb(UNFIXED, TREE_canvas *ntw)
const char * read_char_pntr() const
GB_ERROR GB_await_error()
void branchlen2bootstrap()
#define MODE_TEXT_STANDARD_ZOOMMODE()
static void expand_all_cb(UNFIXED, TREE_canvas *ntw)
void NT_insert_collapse_submenu(AW_window_menu_modes *awm, TREE_canvas *ntw)
GBDATA * get_gb_tree() const
const TreeNode * ancestor_common_with(const TreeNode *other) const
const double & ypos() const
#define MODE_TEXT_1BUTTON(modeName, leftInfo)
bool are_distinct(const Position &p1, const Position &p2)
static void show_count(GBDATA *gb_main, int mark_mode, int tree_mode, long count)
AP_tree * common_ancestor(AP_tree *t1, AP_tree *t2)
void NT_jump_cb(UNFIXED, TREE_canvas *ntw, AP_tree_jump_type jumpType)
static void error(const char *msg)
#define COUNTING_MARKED(mode)
static char * create_mark_menu_entry(const char *attrib, const char *entry_template)
const char * get_name() const
void NT_expand_marked_cb(UNFIXED, TREE_canvas *ntw)
#define MARK_MODE_UPPER_BITS
#define AWAR_SPECIES_NAME
void multifurcate_whole_tree(const multifurc_limits &below)
AP_tree_display_style get_tree_style() const
bool is_tree(GBDATA *gb_tree)
bool is_inside_folded_group() const
char * read_string() const
#define AW_COLOR_GROUP_NAME_LEN
void fast_sync_changed_folding(AP_tree *parent_of_all_changes)
AW_awar * awar(const char *awar)
GB_ERROR GB_pop_transaction(GBDATA *gbd)
void insert_sub_menu(const char *name, const char *mnemonic, AW_active mask=AWM_ALL)
const char * no_mode_text_defined()
void NT_set_tree_style(UNFIXED, TREE_canvas *ntw, AP_tree_display_style style)
GBDATA * GBT_find_sequence(GBDATA *gb_species, const char *aliname)
static AW_window_menu_modes_opengl * awm
void NT_insert_mark_submenus(AW_window_menu_modes *awm, TREE_canvas *ntw, int insert_as_submenu)
bool group_tree(AP_tree *at, CollapseMode mode, int color_group)
static void insert_color_collapse_submenu(AW_window_menu_modes *awm, TREE_canvas *ntree_canvas)
static bool sequence_is_partial(GBDATA *gb_species, void *cd_partial)
const AW::Position & get_group_cursor() const
const Group & get_selected_group() const
void set_mode(AWT_COMMAND_MODE mo)
void NT_resort_tree_cb(UNFIXED, TREE_canvas *ntw, TreeOrder order)
void scroll(int delta_x, int delta_y, bool dont_update_scrollbars=false)
void request_save_and_zoom_reset()
GB_ERROR close(GB_ERROR error)
#define MARK_MODE_LOWER_BITS
void request_structure_update()
void nprintf(size_t maxlen, const char *templat,...) __ATTR__FORMAT_MEMBER(2)
AP_tree * locate_selected_group(AP_tree *in_subtree)
const AW::Position & get_cursor() const
AP_tree * get_root_node()
#define MODE_TEXT_1BUTTON_KEYS(modeName, leftInfo, keyInfo)
AWT_graphic_exports exports
void scale_branchlengths(double factor)
char * AW_get_color_group_name(AW_root *awr, int color_group)
void init_device(AW_device *device)
static bool are_not_in_tree(GBDATA *gb_species, void *cb_data)
const AW_bitset AW_SIZE_UNSCALED
void aw_message(const char *msg)
const double & xpos() const
GB_ERROR apply_aci_to_remarks(const char *aci, const GBL_call_env &callEnv)
void set_filter(AW_bitset filteri)
GB_ERROR write_string(const char *aw_string)
char * GBT_get_default_alignment(GBDATA *gb_main)
const char * get_data() const
bool is_tree_style(AP_tree_display_style style)
void NT_scale_tree(UNFIXED, TREE_canvas *ntw)
const char * local_id(const char *id) const
static void expand_zombies_cb(UNFIXED, TREE_canvas *ntw)
GB_transaction ta(gb_var)
static void expand_unmarked_cb(UNFIXED, TREE_canvas *ntw)
GB_CSTR GBT_get_name_or_description(GBDATA *gb_item)
char * aw_input(const char *title, const char *prompt, const char *default_input)
#define MODE_TEXT_2BUTTONS_KEYS(modeName, leftInfo, rightInfo, keyInfo)
#define AWAR_DTREE_AUTO_JUMP
AW_awar * get_awar_tree() const
#define KEYINFO_ABORT_AND_RESET
void NT_reset_branchlengths(UNFIXED, TREE_canvas *ntw)
void NT_reset_lzoom_cb(UNFIXED, TREE_canvas *ntw)
long GBS_read_hash(const GB_HASH *hs, const char *key)
static bool species_has_alignment(GBDATA *gb_species, void *cd_use)
static void collapse_terminal_cb(UNFIXED, TREE_canvas *ntw)
char * GBS_global_string_copy(const char *templat,...)
void AWT_GC_changed_cb(GcChange whatChanged, AWT_canvas *scr)
void NT_multifurcate_tree(TREE_canvas *ntw, const TreeNode::multifurc_limits &below)
void NT_reload_tree_event(AW_root *, TREE_canvas *ntw, bool unzoom_and_expose)
virtual void show(AW_device *device)=0