23 if (!group)
return NULp;
45 int alignment_length =
GB_read_int(gb_alignment_len);
60 char *dup_data =
new char[data_len+1];
62 memcpy(dup_data, data, data_len);
63 dup_data[data_len] = 0;
65 #if defined(DEBUG) && 0
72 spman->do_callbacks();
104 printf(
"ED4_sequence_terminal::deleted_from_database (%p)\n",
this);
113 if (was_consensus_relevant) {
128 ED4_species_manager *species_man = to_species_manager();
150 aw_message(
"Illegal callback (ED4_sequence_changed_cb())");
168 species_pointer =
NULp;
174 void ED4_species_pointer::addCallback(
ED4_base *base) {
178 void ED4_species_pointer::removeCallback(
ED4_base *base) {
184 if (species_pointer) removeCallback(base);
185 species_pointer = gbd;
186 if (species_pointer) addCallback(base);
197 return !((r2 <= p1) || (p2 <= r1));
205 return p1 >= r1 && p2 <= r2;
242 sprintf(namebuffer,
"Group_Manager.%ld",
ED4_counter);
246 sprintf(namebuffer,
"Bracket_Terminal.%ld",
ED4_counter);
250 sprintf(namebuffer,
"MultiSpecies_Manager.%ld",
ED4_counter);
261 sprintf(namebuffer,
"Group_Spacer_Terminal_Beg.%ld",
ED4_counter);
262 ED4_spacer_terminal *group_spacer_terminal =
new ED4_spacer_terminal(namebuffer,
false, 10,
SPACER_HEIGHT, multi_species_manager);
267 sprintf(namebuffer,
"Consensus_Manager.%ld",
ED4_counter);
268 ED4_species_manager *species_manager =
new ED4_species_manager(
ED4_SP_CONSENSUS, namebuffer, 0, 0, multi_species_manager);
275 species_name_terminal->set_links(
NULp, refterms.
sequence());
276 species_manager->append_member(species_name_terminal);
282 sprintf(namebuffer,
"Flag_Header_Terminal.%ld",
ED4_counter);
283 ED4_flag_header_terminal *flag_header_terminal =
new ED4_flag_header_terminal(namebuffer, 100,
TERMINAL_HEIGHT, species_manager);
284 flag_header_terminal->set_links(
NULp, refterms.
sequence());
285 species_manager->append_member(flag_header_terminal);
289 sprintf(namebuffer,
"Consensus_Seq_Manager.%ld",
ED4_counter);
292 species_manager->append_member(sequence_manager);
302 sprintf(namebuffer,
"Consensus_Seq_Terminal.%ld",
ED4_counter);
313 return group_manager;
319 sprintf(namebuffer,
"Group_Spacer_Terminal_End.%ld",
ED4_counter);
320 ED4_spacer_terminal *group_spacer_terminal =
new ED4_spacer_terminal(namebuffer,
false, 10,
SPACER_HEIGHT, multi_species_manager);
329 buffer.
put(SEPARATOR);
332 for (
int writeConsensus = 1; writeConsensus>=0; --writeConsensus) {
333 for (
int i=0; i<container->
members(); ++i) {
337 if (
bool(writeConsensus) == isConsensus) {
343 buffer.
put(SEPARATOR);
347 for (
int i=0; i<container->
members(); i++) {
355 switch (species_type) {
358 const char *paren = strchr(
id,
'(');
360 int namelen =
std::max(
int(paren-
id)-1, 0);
362 if (namelen>0) buffer.
ncat(
id, namelen);
363 else buffer.
cat(
"<unnamed>");
369 buffer.
put(SEPARATOR);
374 buffer.
put(SEPARATOR);
403 if ((
spec.
level&level) && fulfills_predicate(
this)) {
407 for (
int i=0; i<
members(); i++) {
411 ED4_base *found = child->to_manager()->find_first_that(level, fulfills_predicate);
416 else if ((child->
spec.
level&level) && fulfills_predicate(child)) {
429 temp_parent = temp_parent->
parent;
438 for (
int i=0; i<
members(); i++) {
444 for (
int i=0; i<
members(); i++) {
447 if (result)
return result;
487 if (
this == static_cast<ED4_base*>(Parent)) {
492 if (!
parent)
return false;
507 if (result !=
ED4_A_ERROR && multi_species_manager) {
517 if (consensus_name_terminal) {
520 const char *cntid = consensus_name_terminal->id;
521 char *name = ARB_calloc<char>(strlen(cntid)+10);
524 for (i=0; cntid[i] && cntid[i] !=
'('; i++) {
527 if (i>0 && cntid[i-1] ==
' ') --i;
528 sprintf(name+i,
" (%d)", species);
530 freeset(consensus_name_terminal->id, name);
532 consensus_name_terminal->request_refresh();
536 PosRange ED4_abstract_sequence_terminal::pixel2index(
PosRange pixel_range) {
550 int rel_left_x =
int(rect->
l-x);
551 int rel_right_x =
int(rect->
r-x);
553 return pixel2index(
PosRange(rel_left_x, rel_right_x));
563 int rel_left_x =
int(clip_rect.
l - x + scroll_shift);
564 int rel_right_x =
int(clip_rect.
r - x + scroll_shift);
566 return pixel2index(
PosRange(rel_left_x, rel_right_x));
579 group_manager_for_child = group_manager;
581 if (progress) progress->
inc();
584 for (
int i=0; i<
members(); i++) {
588 ED4_species_manager *species_manager = child->to_species_manager();
591 if (sequence_data_terminal) {
594 group_manager_for_child->
table().add(db_pointer, db_pointer_len);
598 if (progress) progress->
inc();
605 e4_assert(sub_group!=upper_group_manager);
606 upper_group_manager->
table().add(sub_group->
table());
607 #if defined(TEST_CHAR_TABLE_INTEGRITY)
614 child->to_manager()->create_consensus(group_manager_for_child, progress);
624 return this->to_terminal();
632 int members = manager->
members();
634 for (i=0; !relevant_terminal && i<members; ++i) {
640 if (relevant_terminal) {
641 for (; i<members; ++i) {
648 return relevant_terminal;
654 for (
int i=0; i<
members(); i++) {
686 GBDATA *gb_name = species_name->get_species_pointer();
697 for (
int i=0; i<
members(); i++) {
703 for (
int i=0; i<
members(); i++) {
707 return child->to_multi_species_manager()->get_defined_level(lev);
710 return child->to_group_manager()->member(1)->to_multi_species_manager()->get_defined_level(lev);
724 ED4_species_manager *species_manager = to_species_manager();
726 if (!species_manager->is_consensus_manager()) {
728 ED4_species_name_terminal *consensus_terminal =
parent->to_multi_species_manager()->get_consensus_name_terminal();
730 for (
int i=0; i<multi_name_manager->
members(); i++) {
739 for (
int i=0; i<species_manager->members(); i++) {
740 ED4_base *smember = species_manager->member(i);
741 if (consensus_terminal) {
763 ED4_species_name_terminal *consensus_terminal =
parent->to_multi_species_manager()->get_consensus_name_terminal();
765 if (consensus_terminal) {
772 mark_consensus_terminal->request_resize();
774 for (
int i=0; i<multi_species_manager->
members(); i++) {
778 for (
int i=0; i < group_manager->
members(); i++) {
820 for (
int i=0; i<
members(); i++) {
831 for (
int i=0; i<
members(); i++) {
838 for (
int i=0; i<
members(); i++) {
854 bool consensus_shown =
false;
858 for (i=0; i<multi_species_manager->
members(); i++) {
860 consensus_manager = multi_species_manager->
member(i)->to_manager();
865 if (consensus_manager) {
869 consensus_shown =
true;
873 consensus_shown =
true;
877 consensus_shown =
false;
891 parent->to_group_manager()->toggle_folding();
899 printf(
"Typ des Aufrufers :\t\t\t%s\n",
is_manager() ?
"Manager" :
"Terminal");
900 printf(
"Name des Aufrufers von Check_All : \t%.30s\n", (
id) ?
id :
"Keine ID");
903 printf(
"World Coords x, y : \t\t%f, %f\n\n", x, y);
904 printf(
"***********************************************\n\n");
921 if (!width_ref->linked_objects) width_ref->linked_objects =
new ED4_base_list;
928 if (!height_ref->linked_objects) height_ref->linked_objects =
new ED4_base_list;
933 int ED4_base::currTimestamp = 1;
948 #if defined(VISIBLE_AREA_REFRESH)
954 #else // !defined(VISIBLE_AREA_REFRESH)
968 void ED4_main_manager::clear_whole_background() {
971 AW_device *device = window->get_device();
1002 id = ARB_alloc<char>(strlen(temp_id)+1);
1003 strcpy(
id, temp_id);
1006 linked_objects =
NULp;
1022 memset((
char*)&
flag, 0,
sizeof(
flag));
1030 if (linked_objects) {
1035 object->width_link->linked_objects->remove_elem(
this);
1036 object->width_link =
NULp;
1040 object->height_link->linked_objects->remove_elem(
this);
1041 object->height_link =
NULp;
1045 list_elem = list_elem->
next();
1048 delete linked_objects;
void calc_rel_coords(AW_pos *x, AW_pos *y)
void clr_property(ED4_properties prop)
void set_both_links(ED4_base *ref)
virtual void clear(AW_bitset filteri)
void deleted_from_database() OVERRIDE
AW_device * current_device()
ED4_returncode set_width()
long GB_read_int(GBDATA *gbd)
void deleted_from_database() OVERRIDE
ED4_area_manager * top_area_man
virtual char * resolve_pointer_to_string_copy(int *str_len=NULp) const
int reduceClipBorders(int top, int bottom, int left, int right)
ED4_terminal * get_first_terminal(int start_index=0) const
ED4_base * member(ED4_index i) const
GB_ERROR GB_add_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
ED4_scrolled_rectangle scrolled_rect
ED4_group_manager * is_in_folded_group() const
GBDATA * get_species_pointer() const
virtual ARB_ERROR route_down_hierarchy(const ED4_route_cb &cb)
const AW_screen_area & get_cliprect() const
virtual void clear_part(const AW::Rectangle &rect, AW_bitset filteri)
ED4_properties static_prop
ED4_base * get_defined_level(ED4_level lev) const
ED4_area_manager * middle_area_man
GBDATA * GBT_get_alignment(GBDATA *gb_main, const char *aliname)
NOT4PERL const void * GB_read_old_value()
BaseFrequencies & table()
void ED4_request_relayout()
char * GB_read_as_string(GBDATA *gbd)
void set_species_pointer(GBDATA *gbd)
ED4_multi_species_manager * get_multi_species_manager() const
static void touch_world_cache()
int is_species_manager() const
ED4_update_info update_info
ED4_list< ED4_base > ED4_base_list
void cat(const char *from)
ED4_species_type get_species_type() const
const AW_bitset AW_ALL_DEVICES
ED4_group_manager * ED4_build_group_manager_start(ED4_manager *group_parent, GB_CSTR group_name, int group_depth, bool is_folded, ED4_reference_terminals &refterms, ED4_multi_species_manager *&multi_species_manager)
void create_consensus(ED4_abstract_group_manager *upper_group_manager, arb_progress *progress)
int get_width(int gc) const
ED4_returncode clear_background(int color=0)
virtual void deleted_from_database()
char buffer[MESSAGE_BUFFERSIZE]
#define ED4_AWAR_CONSENSUS_SHOW
ED4_base * find_first_that(ED4_level level, const ED4_basePredicate &fulfills_predicate)
void unlink_from_parent()
int is_multi_species_manager() const
bool has_property(ED4_properties prop) const
void world_to_win_coords(AW_pos *xPtr, AW_pos *yPtr) const
const AW::Position & calc_world_coords() const
bool is_consensus_manager() const
#define SEQUENCE_INFO_WIDTH
char * get_name_of_species()
void append_member(ED4_base *new_member)
GB_TYPES GB_read_type(GBDATA *gbd)
void init(int maxseqlength)
void ED4_build_group_manager_end(ED4_multi_species_manager *multi_species_manager)
ED4_index members() const
int is_abstract_group_manager() const
ED4_returncode move_member(ED4_index old_pos, ED4_index new_pos)
long window_upper_clip_point
PosRange calc_update_interval()
long window_lower_clip_point
GBDATA * get_gb_main() const
ED4_terminal * get_last_terminal(int start_index=-1) const
void ED4_alignment_length_changed(GBDATA *gb_alignment_len, GB_CB_TYPE gbtype)
ED4_returncode rebuild_consensi(ED4_base *start_species, ED4_update_flag update_flag)
virtual const char * resolve_pointer_to_char_pntr(int *str_len=NULp) const
void Set(GBDATA *gbd, ED4_base *base)
ED4_window * first_window
ED4_terminal * get_next_terminal()
bool range_contained_in(int p1, int p2, int r1, int r2)
static void error(const char *msg)
void set_links(ED4_base *width_ref, ED4_base *height_ref)
int count_visible_children()
virtual void changed_by_database()
PosRange calc_interval_displayed_in_rectangle(AW_screen_area *area_rect)
ARB_ERROR route_down_hierarchy(const ED4_route_cb &cb) FINAL_OVERRIDE
ED4_main_manager * main_manager
void deleted_from_database() OVERRIDE
AW_awar * awar(const char *awar)
ED4_scroll_links scroll_links
ED4_list_elem * next() const
ED4_base(const ED4_objspec &spec_, GB_CSTR id, AW_pos width, AW_pos height, ED4_manager *parent)
int adjust_clipping_rectangle()
ED4_species_name_terminal * get_consensus_name_terminal() const
ED4_multi_species_manager * get_multi_species_manager() const
ED4_sequence_info_terminal * sequence_info()
void Delete() FINAL_OVERRIDE
ED4_returncode update_bases_and_rebuild_consensi(const char *old_seq, int old_len, ED4_base *species, ED4_update_flag update_flag, PosRange range=PosRange::whole())
ED4_base * search_spec_child_rek(ED4_level level)
void append_elem(T *elem)
void ncat(const char *from, size_t count)
void changed_by_database() OVERRIDE
void generate_configuration_string(GBS_strstruct &buffer)
int MAXSEQUENCECHARACTERLENGTH
ED4_returncode remove_member(ED4_base *member)
void set_property(ED4_properties prop)
bool ranges_overlap(int p1, int p2, int r1, int r2)
ED4_AREA_LEVEL get_area_level(ED4_multi_species_manager **multi_species_manager=NULp) const
static void sequence_changed_cb(GBDATA *gb_seq, ED4_base *base, GB_CB_TYPE gbtype)
ED4_returncode update_bases(const ED4_base *old_base, const ED4_base *new_base, PosRange range=PosRange::whole())
const char * get_alignment_name() const
char * GB_read_string(GBDATA *gbd)
void deleted_from_database() OVERRIDE
ED4_window * current_ed4w()
void GB_remove_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
ED4_list_elem< T > * head() const
ED4_sequence_terminal * sequence()
long window_right_clip_point
void request_refresh(int clear=1) FINAL_OVERRIDE
void aw_message(const char *msg)
bool completely_shows(int x1, int y1, int x2, int y2) const
long GB_read_clock(GBDATA *gbd)
int is_area_manager() const
AW::Rectangle get_win_area(ED4_window *ed4w) const
void remove_elem(const T *elem)
char * resolve_pointer_to_string_copy(int *str_len=NULp) const FINAL_OVERRIDE
void changed_by_database() OVERRIDE
GB_transaction ta(gb_var)
bool box(int gc, AW::FillStyle filled, const AW::Rectangle &rect, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
bool partly_shows(int x1, int y1, int x2, int y2) const
int has_valid_counters() const
long window_left_clip_point
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
ED4_terminal * get_prev_terminal()
int is_spacer_terminal() const
ED4_manager * get_parent(ED4_level lev) const
void update_consensus(ED4_manager *old_parent, ED4_manager *new_parent, ED4_base *sequence)
bool has_parent(ED4_manager *Parent)
const ED4_terminal * get_consensus_relevant_terminal() const
int is_group_manager() const
ED4_properties dynamic_prop
int is_species_name_terminal() const
void request_refresh(int clear=1) FINAL_OVERRIDE
unsigned int linked_to_scrolled_rectangle
short in_border(AW_pos abs_x, AW_pos abs_y, ED4_movemode mode)