ARB
ED4_manager.cxx
Go to the documentation of this file.
1 #include <arbdbt.h>
2 
3 #include <aw_preset.hxx>
4 #include <aw_awar.hxx>
5 #include <aw_msg.hxx>
6 #include <aw_root.hxx>
7 
8 #include "ed4_class.hxx"
9 #include "ed4_awars.hxx"
10 #include "ed4_edit_string.hxx"
11 #include "ed4_tools.hxx"
12 #include "ed4_list.hxx"
13 #include "ed4_ProteinViewer.hxx"
15 #include "ed4_seq_colors.hxx"
16 
17 #if defined(DEBUG)
18 #define TEST_REFRESH_FLAG
19 #endif
20 
21 // -----------------------------------------------------------------
22 // Manager static properties (used by manager-constructors)
23 
25  (ED4_properties)(PROP_IS_MANAGER | PROP_HORIZONTAL), // static props
26  LEV_ROOT, // level
27  LEV_ROOTGROUP, // allowed children level
28  LEV_NONE, // handled object
29  LEV_NONE // restriction level
30  );
31 
33  (ED4_properties)(PROP_IS_MANAGER | PROP_HORIZONTAL), // static props
34  LEV_DEVICE, // level
35  (ED4_level)(LEV_AREA | LEV_SPACER | LEV_LINE), // allowed children level
36  LEV_NONE, // handled object
37  LEV_NONE // restriction level
38  );
39 
41  (ED4_properties)(PROP_IS_MANAGER | PROP_VERTICAL), // static props
42  LEV_AREA, // level
43  (ED4_level)(LEV_MULTI_SPECIES | LEV_TREE | LEV_SPACER), // allowed children level
44  LEV_NONE, // handled object
45  LEV_NONE // restriction level
46  );
47 
49  (ED4_properties)(PROP_IS_MANAGER | PROP_HORIZONTAL), // static props
50  LEV_MULTI_SPECIES, // level
51  (ED4_level)(LEV_SPECIES | LEV_GROUP | LEV_SPACER), // allowed children level
52  LEV_NONE, // handled object
53  LEV_NONE // restriction level
54  );
55 
57  (ED4_properties)(PROP_IS_MANAGER | PROP_VERTICAL), // static props
58  LEV_SPECIES, // level
59  (ED4_level)(LEV_MULTI_SEQUENCE | LEV_MULTI_NAME | // (used by normal species)
60  LEV_SPECIES_NAME | LEV_SEQUENCE | // allowed children level (used by consensus)
62  LEV_NONE, // handled object
63  LEV_NONE // restriction level
64  );
65 
67  (ED4_properties)(PROP_IS_MANAGER | PROP_HORIZONTAL), // static props
68  LEV_MULTI_SEQUENCE, // level
69  LEV_SEQUENCE, // allowed children level
70  LEV_NONE, // handled object
71  LEV_NONE // restriction level
72  );
73 
75  (ED4_properties)(PROP_IS_MANAGER | PROP_VERTICAL), // static props
76  LEV_SEQUENCE, // level
78  LEV_NONE, // handled object
79  LEV_SPECIES // restriction level
80  );
81 
83  (ED4_properties)(PROP_IS_MANAGER | PROP_HORIZONTAL), // static props
84  LEV_MULTI_NAME, // level
85  LEV_NAME_MANAGER, // allowed children level
86  LEV_NONE, // handled object
87  LEV_NONE // restriction level
88  );
89 
91  (ED4_properties)(PROP_IS_MANAGER | PROP_VERTICAL), // static props
92  LEV_NAME_MANAGER, // level
93  (ED4_level)(LEV_SPECIES_NAME | LEV_FLAG), // allowed children level
94  LEV_NONE, // handled object
95  LEV_SPECIES // restriction level
96  );
97 
99  (ED4_properties)(PROP_IS_MANAGER | PROP_VERTICAL), // static props
100  LEV_GROUP, // level
101  (ED4_level)(LEV_MULTI_SPECIES | LEV_BRACKET), // allowed children level
102  LEV_NONE, // handled object
103  LEV_NONE // restriction level
104  );
105 
107  (ED4_properties)(PROP_IS_MANAGER | PROP_VERTICAL), // static props
108  LEV_ROOTGROUP, // level
109  (ED4_level)(LEV_DEVICE), // allowed children level
110  LEV_NONE, // handled object
111  LEV_NONE // restriction level
112  );
113 
114 // ----------------------------
115 // ED4_manager methods
116 
118  int i;
119  ED4_base *temp_parent;
120  ED4_multi_species_manager *multi_species_manager = NULp;
121  ED4_group_manager *first_group_manager = NULp;
122 
123  temp_parent = start_species;
124 
125  switch (update_flag) {
126  case ED4_U_UP: // rebuild consensus from a certain starting point upwards
127  while (temp_parent) {
128  if (temp_parent->is_group_manager()) {
129  multi_species_manager = temp_parent->to_group_manager()->get_multi_species_manager();
130  for (i=0; i<multi_species_manager->members(); i++) {
131  if (multi_species_manager->member(i)->is_consensus_manager()) {
132  rebuild_consensus(multi_species_manager->member(i)).expect_no_error();
133  }
134  }
135  }
136  temp_parent = temp_parent->parent;
137  }
138  break;
139  case ED4_U_UP_DOWN: // only search first groupmanager and update consensi recursively downwards
140  while (temp_parent) {
141  if (temp_parent->is_group_manager()) {
142  first_group_manager = temp_parent->to_group_manager();
143  }
144  temp_parent = temp_parent->parent;
145  }
146  if (first_group_manager)
147  first_group_manager->route_down_hierarchy(makeED4_route_cb(rebuild_consensus)).expect_no_error();
148  break;
149  }
150  return ED4_R_OK;
151 }
152 
154  if (added_base->is_species_manager()) { // add a sequence
155  ED4_species_manager *species_manager = added_base->to_species_manager();
156  const ED4_terminal *sequence_terminal = species_manager->get_consensus_relevant_terminal();
157 
158  if (sequence_terminal) {
159  int seq_len;
160  char *seq = sequence_terminal->resolve_pointer_to_string_copy(&seq_len);
161  ED4_returncode res = update_bases(NULp, 0, seq, seq_len);
162  free(seq);
163  return res;
164  }
165  }
166 
167  e4_assert(!added_base->is_root_group_manager());
168  if (added_base->is_group_manager()) { // add a group
169  return update_bases(NULp, &added_base->to_group_manager()->table());
170  }
171 
172  e4_assert(0); // wrong type
173 
174  return ED4_R_OK;
175 }
176 
178  if (subbed_base->is_species_manager()) { // sub a sequence
179  ED4_species_manager *species_manager = subbed_base->to_species_manager();
180  const ED4_terminal *sequence_terminal = species_manager->get_consensus_relevant_terminal();
181 
182  if (sequence_terminal) {
183  int seq_len;
184  char *seq = sequence_terminal->resolve_pointer_to_string_copy(&seq_len);
185  ED4_returncode res = update_bases(seq, seq_len, NULp, 0);
186  free(seq);
187  return res;
188  }
189  }
190  else {
191  e4_assert(!subbed_base->is_root_group_manager());
192  if (subbed_base->is_group_manager()) { // sub a group
193  return update_bases(&subbed_base->to_group_manager()->table(), NULp);
194  }
195  e4_assert(0); // wrong type
196  }
197  return ED4_R_OK;
198 }
199 
200 ED4_returncode ED4_manager::update_bases(const char *old_sequence, int old_len, const ED4_base *new_base, PosRange range) {
201  if (!new_base) {
202  return update_bases(old_sequence, old_len, NULp, 0, range);
203  }
204 
205  e4_assert(new_base->is_species_manager());
206 
207  const ED4_species_manager *new_species_manager = new_base->to_species_manager();
208  const ED4_terminal *new_sequence_terminal = new_species_manager->get_consensus_relevant_terminal();
209 
210  int new_len;
211  char *new_sequence = new_sequence_terminal->resolve_pointer_to_string_copy(&new_len);
212 
213  if (range.is_whole()) {
214  const PosRange *restricted = BaseFrequencies::changed_range(old_sequence, new_sequence, std::min(old_len, new_len));
215 
216  e4_assert(restricted);
217  range = *restricted;
218  }
219 
220  ED4_returncode res = update_bases(old_sequence, old_len, new_sequence, new_len, range);
221  free(new_sequence);
222  return res;
223 }
224 
225 ED4_returncode ED4_manager::update_bases_and_rebuild_consensi(const char *old_sequence, int old_len, ED4_base *new_base, ED4_update_flag update_flag, PosRange range) {
226  e4_assert(new_base);
227  e4_assert(new_base->is_species_manager());
228 
229  ED4_species_manager *new_species_manager = new_base->to_species_manager();
230  const ED4_terminal *new_sequence_terminal = new_species_manager->get_consensus_relevant_terminal();
231 
232  int new_len;
233  const char *new_sequence = new_sequence_terminal->resolve_pointer_to_char_pntr(&new_len);
234 
235 #if defined(DEBUG) && 0
236  printf("old: %s\n", old_sequence);
237  printf("new: %s\n", new_sequence);
238 #endif // DEBUG
239 
240  const PosRange *changedRange = NULp;
241  if (range.is_whole()) {
242  changedRange = BaseFrequencies::changed_range(old_sequence, new_sequence, std::min(old_len, new_len));
243  }
244  else {
245  changedRange = &range; // @@@ use method similar to changed_range here, which just reduces the existing range
246  }
247 
249  if (changedRange) {
250  ED4_returncode result1 = update_bases(old_sequence, old_len, new_sequence, new_len, *changedRange);
251  ED4_returncode result2 = rebuild_consensi(new_base, update_flag);
252 
253  result = (result1 != ED4_R_OK) ? result1 : result2;
254 
255  // Refresh aminoacid sequence terminals in Protein Viewer or protstruct // @@@ this is definitely wrong here (omg)
258  }
259  else if (ED4_ROOT->alignment_type == GB_AT_AA) {
261  if (err) { aw_message(err); result = ED4_R_WARNING; }
262  }
263  }
264  return result;
265 }
266 
267 ED4_returncode ED4_manager::update_bases(const ED4_base *old_base, const ED4_base *new_base, PosRange range) {
268  e4_assert(old_base);
269  e4_assert(new_base);
270 
271  if (old_base->is_species_manager()) {
272  e4_assert(new_base->is_species_manager());
273  const ED4_species_manager *old_species_manager = old_base->to_species_manager();
274  const ED4_species_manager *new_species_manager = new_base->to_species_manager();
275  const ED4_terminal *old_sequence_terminal = old_species_manager->get_consensus_relevant_terminal();
276  const ED4_terminal *new_sequence_terminal = new_species_manager->get_consensus_relevant_terminal();
277 
278  int old_len;
279  int new_len;
280  char *old_seq = old_sequence_terminal->resolve_pointer_to_string_copy(&old_len);
281  char *new_seq = new_sequence_terminal->resolve_pointer_to_string_copy(&new_len);
282 
283  ED4_returncode res = update_bases(old_seq, old_len, new_seq, new_len, range);
284  free(new_seq);
285  free(old_seq);
286  return res;
287  }
288 
289  e4_assert(!old_base->is_root_group_manager());
290  e4_assert(!new_base->is_root_group_manager());
291  if (old_base->is_group_manager()) {
292  e4_assert(new_base->is_group_manager());
293 
294  return update_bases(&old_base->to_group_manager()->table(),
295  &new_base->to_group_manager()->table(),
296  range);
297  }
298 
299  return ED4_R_OK;
300 }
301 
302 // WITH_ALL_ABOVE_GROUP_MANAGER_TABLES performs a command with all groupmanager-tables
303 // starting at walk_up (normally the current) until top (or until one table has an ignore flag)
304 
305 #define WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, COMMAND) \
306  do { \
307  while (walk_up) { \
308  if (walk_up->is_abstract_group_manager()) { \
309  BaseFrequencies& char_table = walk_up->to_abstract_group_manager()->table(); \
310  char_table.COMMAND; \
311  if (char_table.is_ignored()) break; /* @@@ problematic */ \
312  } \
313  walk_up = walk_up->parent; \
314  } \
315  } while (0)
316 
317 ED4_returncode ED4_manager::update_bases(const char *old_sequence, int old_len, const char *new_sequence, int new_len, PosRange range) {
318  ED4_manager *walk_up = this;
319 
320  if (old_sequence) {
321  if (new_sequence) {
322  if (range.is_whole()) {
323  const PosRange *restricted = BaseFrequencies::changed_range(old_sequence, new_sequence, std::min(old_len, new_len));
324  if (!restricted) return ED4_R_OK;
325 
326  range = *restricted;
327  }
328 
329 #if defined(DEBUG) && 0
330  printf("update_bases(..., %i, %i)\n", start_pos, end_pos);
331 #endif
332 
333  WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, sub_and_add(old_sequence, new_sequence, range));
334  }
335  else {
336  e4_assert(range.is_whole());
337  WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, sub(old_sequence, old_len));
338  }
339  }
340  else {
341  if (new_sequence) {
342  e4_assert(range.is_whole());
343  WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, add(new_sequence, new_len));
344  }
345  else {
346  return ED4_R_OK;
347  }
348  }
349 
351  return ED4_R_OK;
352 }
353 
355  ED4_manager *walk_up = this;
356 
357  if (old_table) {
358  if (new_table) {
359  if (range.is_whole()) {
360  const PosRange *restricted = old_table->changed_range(*new_table);
361  if (!restricted) return ED4_R_OK;
362 
363  range = *restricted;
364  }
365  WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, sub_and_add(*old_table, *new_table, range));
366  }
367  else {
368  e4_assert(range.is_whole());
369  WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, sub(*old_table));
370  }
371  }
372  else {
373  if (new_table) {
374  e4_assert(range.is_whole());
375  WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, add(*new_table));
376  }
377  else {
378  return ED4_R_OK;
379  }
380  }
381 
383  return ED4_R_OK;
384 }
385 
386 #undef WITH_ALL_ABOVE_GROUP_MANAGER_TABLES
387 
389  // removes callbacks
390  for (int i=0; i < members(); i++) {
391  member(i)->remove_callbacks();
392  }
393 }
394 
395 void ED4_manager::update_consensus(ED4_manager *old_parent, ED4_manager *new_parent, ED4_base *sequence) {
396  if (old_parent) old_parent->check_out_bases(sequence);
397  if (new_parent) new_parent->check_in_bases(sequence);
398 }
399 
401  ED4_terminal *terminal = NULp;
402 
403  for (int i=start_index; !terminal && i>=0 && i<members(); i++) {
404  ED4_base *base = member(i);
405  if (base->is_terminal()) {
406  terminal = base->to_terminal();
407  }
408  else {
409  terminal = base->to_manager()->get_first_terminal();
410  }
411  }
412 
413  return terminal;
414 }
415 
417  ED4_terminal *terminal = NULp;
418 
419  if (start_index<0) start_index = members()-1;
420  for (int i=start_index; !terminal && i>=0 && i<members(); i--) {
421  ED4_base *base = member(i);
422  if (base->is_terminal()) {
423  terminal = base->to_terminal();
424  }
425  else {
426  terminal = base->to_manager()->get_last_terminal();
427  }
428  }
429 
430  return terminal;
431 }
432 
434  ED4_extension ext;
435  ED4_index temp_index;
436  ED4_base *child;
437 
438  ext.position[X_POS] = x;
439  ext.position[Y_POS] = y;
441 
442  temp_index = search_member(&ext, spec.static_prop);
443 
444  if ((temp_index < 0) || (temp_index >= members())) { // no child at given location
445  return NULp;
446  }
447 
448  child = member(temp_index);
449 
450  return (child->spec.static_prop & relevant_prop) ? child : (ED4_base*)NULp;
451 }
452 
454  ED4_extension ext;
455  ED4_base *child;
456  ED4_base *temp_parent = NULp;
457 
458  ext.position[X_POS] = x;
459  ext.position[Y_POS] = y;
461 
463 
464  if (!temp_parent) {
465  temp_parent = this;
466  }
467 
468  child = temp_parent;
469  if (child->spec.static_prop & relevant_prop) {
470  return child;
471  }
472  else {
473  return NULp;
474  }
475 }
476 
478  // handles a move request with target world
479  // coordinates within current object's borders
480 
481  if ((!mi) || (mi->object->spec.level <= spec.level)) {
482  return ED4_R_IMPOSSIBLE;
483  }
484 
485  AW_pos rel_x = mi->end_x; // calculate target position relative to current object
486  AW_pos rel_y = mi->end_y;
487  calc_rel_coords(&rel_x, &rel_y);
488 
489  if ((mi->preferred_parent & spec.level) || // desired parent or levels match = > can handle moving
490  (mi->object->spec.level & spec.allowed_children)) // object(s) myself, take info from list of selected objects
491  {
492  ED4_base *object;
493  bool i_am_consensus = false;
494 
495  if (mi->object->has_property(PROP_IS_HANDLE)) { // object is a handle for an object up in the hierarchy = > search it
496  ED4_level mlevel = mi->object->spec.handled_level;
497 
498  object = mi->object;
499 
500  while (object && !(object->spec.level & mlevel)) object = object->parent;
501  if (!object) return ED4_R_IMPOSSIBLE; // no target level found
502  }
503  else {
504  object = mi->object; // selected object is no handle => take it directly
505 
506  if (object->is_consensus_manager()) {
507  if (this->is_child_of(object->parent)) return ED4_R_IMPOSSIBLE; // has to pass multi_species_manager
508  i_am_consensus = true;
509  if (object->parent != this) {
510  object = object->parent->parent;
511  mi->object = object;
512  }
513  }
514  }
515 
516  ED4_manager *old_parent = object->parent;
517 
518  // now do move action => determine insertion offsets and insert object
519  {
520  ED4_extension loc;
521  loc.position[Y_POS] = mi->end_y;
522  loc.position[X_POS] = mi->end_x;
524 
525  ED4_base *found_member = NULp;
526  {
527  ED4_manager *dummy_mark = ED4_ROOT->main_manager->search_spec_child_rek(LEV_DEVICE)->to_manager();
528  dummy_mark->search_target_species(&loc, PROP_HORIZONTAL, &found_member, LEV_NONE);
529  }
530 
531  if (found_member==object) { // if we are dropped on ourself => don't move
532  return ED4_R_BREAK;
533  }
534  }
535 
536  {
537  ED4_base *parent_man = object->get_parent(LEV_MULTI_SPECIES);
538  object->parent->remove_member(object);
539  parent_man->to_multi_species_manager()->invalidate_species_counters();
540  }
541 
542  object->extension.position[X_POS] = rel_x;
543  object->extension.position[Y_POS] = rel_y;
545 
546  object->parent = this;
547 
548  if (old_parent != this) { // check whether consensus has to be calculated new or not
550  update_consensus(old_parent, this, object);
551  rebuild_consensi(old_parent, ED4_U_UP);
552  rebuild_consensi(this, ED4_U_UP);
553  }
554 
555  if ((i_am_consensus && object->parent != old_parent) || !i_am_consensus) {
556  object->set_width();
557 
558  if (parent->has_property(PROP_IS_FOLDED)) { // add spacer and consensusheight
560  object->extension.position[Y_POS] = member(0)->extension.size[HEIGHT] + member(1)->extension.size[HEIGHT];
561  object->flag.hidden = 1;
563  }
564  }
565 
566  insert_member(object);
567  if (is_multi_species_manager()) {
568  to_multi_species_manager()->invalidate_species_counters();
569  }
570  else {
571  get_parent(LEV_MULTI_SPECIES)->to_multi_species_manager()->invalidate_species_counters();
572  }
573 
575 
576  return ED4_R_OK;
577  }
578  else {
579  // levels do not match = > ask competent manager child to handle move request
580  ED4_manager *manager = (ED4_manager *) get_competent_child(rel_x, rel_y, PROP_IS_MANAGER);
581  if (!manager) return ED4_R_IMPOSSIBLE; // no manager child covering target location = > move not possible
582  return manager->move_requested_by_parent(mi); // there is a manager child covering target location = > pass on move request
583  }
584 }
585 
586 
588  // handles a move request with target world coordinates coming from parent
589  if ((!mi) || !(in_border(mi->end_x, mi->end_y, mi->mode)))
590  return ED4_R_IMPOSSIBLE;
591 
592  return handle_move(mi);
593 }
594 
595 
597  // handles a move request coming from a child,
598  // target location can be out of borders
599  if (!mi)
600  return ED4_R_IMPOSSIBLE;
601 
602  if (spec.level < mi->object->spec.restriction_level) return ED4_R_IMPOSSIBLE; // check if there is a level restriction to the move request
603 
604  if (mi->object->has_property(PROP_IS_HANDLE)) { // determine first if we could be the moving object
605  if (has_property(PROP_MOVABLE) && (spec.level & mi->object->spec.handled_level)) { // yes, we are meant to be the moving object
606  mi->object = this;
607  }
608 
609  if (!parent) return ED4_R_WARNING;
610 
611  return parent->move_requested_by_child(mi);
612  }
613 
614  if (!(in_border(mi->end_x, mi->end_y, mi->mode))) {
615  // determine if target location is within
616  // the borders of current object, do boundary
617  // adjustment of target coordinates if necessary
618  // target location is not within borders =>
619  // ask parent, i.e. move recursively up
620  if (!parent) return ED4_R_WARNING;
621  return parent->move_requested_by_child(mi);
622  }
623  else { // target location within current borders = > handle move myself
625 
626  if (!temp_parent) {
627  return handle_move(mi);
628  }
629  else {
630  if ((temp_parent->is_group_manager()) || (temp_parent->is_area_manager())) {
631  temp_parent = temp_parent->to_group_manager()->get_defined_level(LEV_MULTI_SPECIES);
632  }
633  else if (!(temp_parent->is_multi_species_manager())) {
634  temp_parent = temp_parent->get_parent(LEV_MULTI_SPECIES);
635  }
636  if (!temp_parent) {
637  return ED4_R_IMPOSSIBLE;
638  }
639  return temp_parent->to_manager()->handle_move(mi);
640  }
641  }
642 }
643 
645  // handles an input event coming from parent
646  if (flag.hidden) {
647  return ED4_R_BREAK;
648  }
649 
650  ED4_extension ext;
651  ext.position[X_POS] = event->x;
652  ext.position[Y_POS] = event->y;
653 
655 
656  ED4_index temp_index = search_member(&ext, spec.static_prop); // search child who is competent for the location of given event
657  if (!existing_index(temp_index)) {
658  return ED4_R_IMPOSSIBLE; // no suitable member found
659  }
660 
661  return member(temp_index)->event_sent_by_parent(event, aww);
662 }
663 
665  // handles a refresh-request from a child
666  if (!update_info.refresh) { // determine if there were more refresh requests already => no need to tell parent about it
667  update_info.set_refresh(1); // this is the first refresh request
668  if (parent) parent->refresh_requested_by_child(); // if we have a parent, tell him about the refresh request
669  }
670 
671 #ifdef TEST_REFRESH_FLAG
673 #endif
674  return ED4_R_OK;
675 }
676 
678  ED4_index i;
679 
680  for (i=0; i<members(); i++) {
681  ED4_base *child = member(i);
682 
683  if (child->is_manager()) {
684  if (!child->to_manager()->refresh_flag_ok()) {
685  return 0;
686  }
687  }
688 
689  if (child->update_info.refresh==1 && update_info.refresh==0) {
690  printf("Forgotten refresh-flag in '%s' (son of '%s')\n", child->id, id);
691  fflush(stdout);
692  return 0;
693  }
694  }
695 
696  return 1;
697 }
698 
700  e4_assert((width_link == link) || (height_link == link)); // wrong link
702 }
703 
705  if (linked_objects) {
706  ED4_base_list_elem *current_list_elem = linked_objects->head();
707  while (current_list_elem) {
708  ED4_base *object = current_list_elem->elem();
709  object->resize_requested_by_link(this);
710  current_list_elem = current_list_elem->next();
711  }
712  }
713 }
714 
716  // calculates the smallest rectangle containing the object.
717  // returns true if bounding box has changed.
718  AW_pos sum_width = 0;
719  AW_pos sum_height = 0;
720  AW_pos max_x = 0;
721  AW_pos max_y = 0;
722  AW_pos dummy = 0;
723 
724  for (ED4_index i = 0; existing_index(i); ++i) { // check all children
725  ED4_base *child = member(i);
726  if (!child->flag.hidden) {
727  sum_width += child->extension.size[WIDTH];
728  sum_height += child->extension.size[HEIGHT];
729 
730  dummy = child->extension.position[X_POS] + child->extension.size[WIDTH];
731  if (dummy > max_x) {
732  max_x = dummy;
733  }
734 
735  dummy = child->extension.position[Y_POS] + child->extension.size[HEIGHT];
736  if (dummy > max_y) {
737  max_y = dummy;
738  }
740  }
741  }
742 
743  bool bb_changed = false;
745  bb_changed = extension.set_size_does_change(WIDTH, max_x) || bb_changed;
746  bb_changed = extension.set_size_does_change(HEIGHT, sum_height) || bb_changed;
747  }
748 
750  bb_changed = extension.set_size_does_change(WIDTH, sum_width) || bb_changed;
751  bb_changed = extension.set_size_does_change(HEIGHT, max_y) || bb_changed;
752  }
753 
754  if (bb_changed) {
756  }
757  return bb_changed;
758 }
759 
761  // distributes all children of current object according to current object's properties and
762  // justification value; a recalculation of current object's extension will take place if necessary
763 
764  ED4_index rel_pos = 0;
765  ED4_index rel_size = 0;
766  ED4_index other_pos = 0;
767  ED4_index other_size = 0;
768  AW_pos max_rel_size = 0;
769  AW_pos max_other_size = 0;
770 
771  // set extension-indexes rel_pos and rel_size according to properties
773  rel_pos = X_POS;
774  other_pos = Y_POS;
775  rel_size = WIDTH;
776  other_size = HEIGHT;
777  }
779  rel_pos = Y_POS;
780  other_pos = X_POS;
781  rel_size = HEIGHT;
782  other_size = WIDTH;
783  }
784 
785  // get maximal relevant and other size of children, set children's other position increasingly
786  for (ED4_index i = 0; existing_index(i); ++i) {
787  ED4_base *child = member(i);
788 
789  max_rel_size = std::max(int(max_rel_size), int(child->extension.size[rel_size]));
790  if (child->extension.position[other_pos] != max_other_size) {
791  child->extension.position[other_pos] = max_other_size;
793  }
794  max_other_size += child->extension.size[other_size];
795  }
796 
797  // set children's relevant position according to justification value
798  // (0.0 means top- or left-justified, 1.0 means bottom- or right-justified)
799  for (ED4_index i = 0; existing_index(i); ++i) {
800  member(i)->extension.position[rel_pos] = 0.0;
802  }
803 
805  return ED4_R_OK;
806 }
807 
809  if (update_info.resize) { // object wants to resize
810  update_info.set_resize(0); // first clear the resize flag (remember it could be set again from somewhere below the hierarchy)
811 
812  for (ED4_index i = 0; existing_index(i); ++i) {
813  ED4_base *child = member(i);
814 
815  child->update_info.set_resize(1);
816  child->resize_requested_children();
817  }
818 
821  }
822 }
824  if (update_info.resize) {
827  }
828  else {
830  }
831 }
832 
834 void ED4_main_manager::resize_requested_children() {
835  if (update_info.resize) {
838  }
839 }
840 
841 void ED4_main_manager::Show(bool refresh_all, bool is_cleared) {
842 #ifdef TEST_REFRESH_FLAG
843  e4_assert(refresh_flag_ok());
844 #endif
845 
846  AW_device *device = current_device();
847 
848  if (!flag.hidden && (refresh_all || update_info.refresh)) {
849 #if defined(TRACE_REFRESH)
850  fprintf(stderr, "- really paint in ED4_main_manager::Show(refresh_all=%i, is_cleared=%i)\n", int(refresh_all), int(is_cleared)); fflush(stderr);
851 #endif
852  const AW_screen_area& area_rect = device->get_area_size();
853 
854  // if update all -> clear_background
855 
856  if (update_info.clear_at_refresh && !is_cleared) {
857  device->push_clip_scale();
858  if (device->reduceClipBorders(area_rect.t, area_rect.b, area_rect.l, area_rect.r)) {
859  clear_background();
860  }
861  is_cleared = 1;
862  device->pop_clip_scale();
863  }
864 
865  // loop through all rectangles between folding lines:
866 
867  int x1, y1, x2, y2;
869  x1 = area_rect.l;
870  for (const ED4_folding_line *flv = win.get_vertical_folding(); ; flv = flv->get_next()) {
871  if (flv) {
872  x2 = int(flv->get_pos()); // @@@ use AW_INT ?
873  }
874  else {
875  x2 = area_rect.r;
876  if (x1==x2) break; // do not draw last range, if it's only 1 pixel width
877  }
878 
879  y1 = area_rect.t;
880  for (const ED4_folding_line *flh = win.get_horizontal_folding(); ; flh = flh->get_next()) {
881  if (flh) {
882  y2 = int(flh->get_pos()); // @@@ use AW_INT ?
883  }
884  else {
885  y2 = area_rect.b;
886  if (y1==y2) break; // do not draw last range, if it's only 1 pixel high
887  }
888 
889  device->push_clip_scale();
890  if (device->reduceClipBorders(y1, y2-1, x1, x2-1)) {
891  ED4_manager::Show(refresh_all, is_cleared);
892  }
893  device->pop_clip_scale();
894 
895  if (!flh) break; // break out after drawing lowest range
896  y1 = y2;
897  }
898  if (!flv) break; // break out after drawing rightmost range
899 
900  x1 = x2;
901  }
902 
903  // to avoid text clipping problems between top and middle area we redraw the top-middle-spacer :
904  {
905  device->push_clip_scale();
906  const AW_screen_area& clip_rect = device->get_cliprect();
907  device->set_top_clip_border(clip_rect.t-TERMINAL_HEIGHT);
908 
909  int char_width = ED4_ROOT->font_group.get_max_width();
910  device->set_left_clip_border(clip_rect.l-char_width);
911  device->set_right_clip_border(clip_rect.r+char_width);
912 
913  get_top_middle_spacer_terminal()->Show(true, false);
914  get_top_middle_line_terminal()->Show(true, false);
915  device->pop_clip_scale();
916  }
917 
918  // always draw cursor
919  ED4_cursor& cursor = current_cursor();
920  if (cursor.owner_of_cursor && cursor.allowed_to_draw) {
921  if (cursor.is_partly_visible()) {
922  cursor.ShowCursor(0, ED4_C_NONE, 0);
923  }
924  }
925  }
926 #ifdef TEST_REFRESH_FLAG
927  e4_assert(refresh_flag_ok());
928 #endif
929 }
930 
931 
932 void ED4_root_group_manager::Show(bool refresh_all, bool is_cleared) {
933  if (update_remap()) { // @@@ dont call here ?
934 #if defined(TRACE_REFRESH)
935  printf("map updated in ED4_root_group_manager::Show (bad?)\n");
936 #endif
937  }
938  ED4_manager::Show(refresh_all, is_cleared);
939 }
940 
941 void ED4_manager::Show(bool refresh_all, bool is_cleared) {
942 #ifdef TEST_REFRESH_FLAG
944 #endif
945 
946  if (!flag.hidden && (refresh_all || update_info.refresh)) {
947  if (update_info.clear_at_refresh && !is_cleared) {
949  is_cleared = 1;
950  }
951 
952  AW_screen_area rect; // clipped rectangle in world coordinates
953 
954  {
955  const AW_screen_area &clip_rect = current_device()->get_cliprect(); // clipped rectangle in win coordinates
956 
957  double x, y;
958  x = clip_rect.l;
959  y = clip_rect.t;
960 
962 
963  rect.l = int(x);
964  rect.t = int(y);
965 
966  e4_assert(AW::nearlyEqual(current_device()->get_scale(), 1.0)); // assumed by calculation below
967  rect.r = rect.l+(clip_rect.r-clip_rect.l);
968  rect.b = rect.t+(clip_rect.b-clip_rect.t);
969  }
970 
971  // binary search to find first visible child
972 
973  int first_visible_child = 0; //@@@FIXME: this variable is never again set
974 
975  {
976  int l = 0;
977  int h = members()-1;
978 
979  while (l<h) {
980 
981  while (member(l)->flag.hidden && l<h) l++;
982  while (member(h)->flag.hidden && l<h) h--;
983 
984  int m = (l+h)/2;
985  int min_m = m;
986  int max_m = m+1;
987 
988  while (member(m)->flag.hidden) {
989  if (m==h) {
990  m = (l+h)/2-1;
991  while (member(m)->flag.hidden) {
992  if (m==l) {
993  // all children between l..h are flag.hidden
994  goto no_visible_child_found;
995  }
996  m--;
997  }
998  min_m = m;
999  break;
1000  }
1001  m++;
1002  max_m = m;
1003  }
1004 
1005  ED4_base *child = member(m);
1006  e4_assert(!child->flag.hidden);
1007 
1008  AW_pos x, y;
1009  child->calc_world_coords(&x, &y);
1010 
1011  if (spec.static_prop & PROP_HORIZONTAL) { // horizontal manager
1012  e4_assert((spec.static_prop&PROP_VERTICAL)==0); // otherwise this binary search will not work correctly
1013  if ((x+child->extension.size[WIDTH])<=rect.l) { // left of clipping range
1014  l = max_m;
1015  }
1016  else {
1017  h = min_m;
1018  }
1019  }
1020  else if (spec.static_prop & PROP_VERTICAL) { // vertical manager
1021  if ((y+child->extension.size[HEIGHT])<=rect.t) { // above clipping range
1022  l = max_m;
1023  }
1024  else {
1025  h = min_m;
1026  }
1027  }
1028  else {
1029  e4_assert(0);
1030  }
1031  }
1032  }
1033 
1034  no_visible_child_found :
1035 
1036  for (ED4_index i = 0; existing_index(i); ++i) {
1037  ED4_base *child = member(i);
1038  e4_assert(child);
1039 
1040  if (!child->flag.hidden && (refresh_all || child->update_info.refresh) && i>=first_visible_child) {
1041  AW_pos x, y;
1042  child->calc_world_coords(&x, &y);
1043 
1044  AW_device *device = current_device();
1045 
1046  if (!(((y-rect.b)>0.5) ||
1047  ((rect.t-(y+child->extension.size[HEIGHT]-1))>0.5) ||
1048  ((x-rect.r)>0.5) ||
1049  ((rect.l-(x+child->extension.size[WIDTH]-1))>0.5)
1050  ))
1051  {
1052  // they overlap -> show it
1053  device->push_clip_scale();
1054  if (child->adjust_clipping_rectangle()) {
1055  child->Show(refresh_all, is_cleared);
1056  }
1057  device->pop_clip_scale();
1058  }
1059  }
1060  }
1061  }
1062 
1063 #ifdef TEST_REFRESH_FLAG
1065 #endif
1066 }
1067 
1070 
1071  for (int i=0; i<members(); i++) {
1072  ED4_base *child = member(i);
1073 
1074  if (child->update_info.refresh) {
1075  if (child->is_manager()) {
1076  child->to_manager()->clear_refresh();
1077  }
1078  else {
1079  child->update_info.set_refresh(0);
1081  }
1082  }
1083  }
1084 
1087 
1088  return ED4_R_OK;
1089 }
1090 
1091 void ED4_manager::update_requested_by_child() { // @@@ same as set_update -> DRY
1095  }
1096 }
1101  }
1102 }
1105  e4_assert(tflag.deleted);
1106 
1107  ED4_ROOT->announce_deletion(this);
1108 
1110  delete this;
1111 }
1112 
1115 
1116  for (int i=0; i<members(); i++) {
1117  ED4_base *child = member(i);
1118  if (child->update_info.update_requested) {
1119  child->update_requested_children();
1120  }
1121  }
1122 
1124 }
1125 
1129  update_species_counters();
1130  update_group_id();
1131 
1132  ED4_base *group_base = get_parent(LEV_GROUP);
1133  if (group_base) {
1134  e4_assert(group_base->is_group_manager());
1135  e4_assert(!group_base->is_root_group_manager());
1136 
1137  ED4_group_manager *group_man = parent->to_group_manager();
1138  ED4_base *bracket_base = group_man->get_defined_level(LEV_BRACKET);
1139 
1140  if (bracket_base) bracket_base->request_refresh();
1141  }
1142 }
1143 
1146 
1147  for (int i = members()-1; i >= 0; --i) {
1148  ED4_base *child = member(i);
1149  if (child->update_info.delete_requested) {
1150  child->delete_requested_children();
1151  }
1152  }
1153 
1155 
1156  if (!members()) {
1157  ED4_ROOT->announce_deletion(this);
1158 
1160  delete this;
1161  }
1162 }
1163 
1168 }
1169 
1171  if (!tflag.deleted) {
1172  tflag.deleted = 1;
1175  }
1176 }
1177 
1179  delete_cbs.call(this);
1180  delete_cbs.clear();
1181 
1182  for (int i=0; i<members(); i++) {
1183  member(i)->Delete();
1184  }
1185 }
1186 
1187 void ED4_manager::request_refresh(int clear_at_refresh) {
1188  // sets refresh flag of current object and its children
1190  update_info.set_clear_at_refresh(clear_at_refresh);
1191 
1193 
1194  for (ED4_index i = 0; existing_index(i); ++i) {
1195  member(i)->request_refresh(0); // clear_at_refresh not needed for childs!
1196  }
1197 }
1198 
1199 
1200 ED4_base* ED4_manager::search_ID(const char *temp_id) {
1201  if (strcmp(temp_id, id) == 0) return this; // this object is the sought one
1202 
1203  // search whole memberlist recursively for object with the given id
1204  for (ED4_index i = 0; existing_index(i); ++i) {
1205  ED4_base *object = member(i)->search_ID(temp_id);
1206  if (object) return object;
1207  }
1208 
1209  return NULp; // no object found
1210 }
1211 
1212 
1213 ED4_manager::ED4_manager(const ED4_objspec& spec_, const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1214  ED4_base(spec_, temp_id, width, height, temp_parent)
1215 {}
1216 
1219 }
1220 
1221 // --------------------------
1222 // ED4_main_manager
1223 
1224 ED4_main_manager::ED4_main_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1225  ED4_manager(main_manager_spec, temp_id, width, height, temp_parent),
1226  top_middle_line(NULp),
1227  top_middle_spacer(NULp)
1228 {
1229 }
1230 
1231 // ----------------------------
1232 // ED4_device_manager
1233 
1234 ED4_device_manager::ED4_device_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1235  ED4_manager(device_manager_spec, temp_id, width, height, temp_parent)
1236 {
1237 }
1238 
1239 // --------------------------
1240 // ED4_area_manager
1241 
1242 ED4_area_manager::ED4_area_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1243  ED4_manager(area_manager_spec, temp_id, width, height, temp_parent)
1244 {
1245 }
1246 
1247 // -----------------------------------
1248 // ED4_multi_species_manager
1249 
1250 ED4_multi_species_manager::ED4_multi_species_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1251  ED4_manager(multi_species_manager_spec, temp_id, width, height, temp_parent),
1252  species(-1),
1253  selected_species(-1)
1254 {
1255 }
1256 
1258  if (!has_valid_counters()) {
1259  update_species_counters();
1261  }
1262  return species;
1263 }
1264 
1266  if (!has_valid_counters()) {
1267  update_species_counters();
1269  }
1270  return selected_species;
1271 }
1272 
1274  if (has_valid_counters()) {
1275  species = -1;
1276  selected_species = -1;
1277 
1279  if (pms) pms->to_multi_species_manager()->invalidate_species_counters();
1280 
1282  }
1283 }
1284 
1285 void ED4_multi_species_manager::set_species_counters(int no_of_species, int no_of_selected) {
1286 
1287 #if defined(DEBUG)
1288  int sp, sel;
1289 
1290  count_species(&sp, &sel);
1291  e4_assert(no_of_species==sp);
1292  e4_assert(no_of_selected==sel);
1293 #endif
1294 
1295  e4_assert(no_of_species>=no_of_selected);
1296 
1297  if (species!=no_of_species || selected_species!=no_of_selected) {
1298  int species_diff = no_of_species-species;
1299  int selected_diff = no_of_selected-selected_species;
1300 
1301  int quickSet = 1;
1302  if (species==-1 || selected_species==-1) {
1303  quickSet = 0;
1304  }
1305 
1306  species = no_of_species;
1307  selected_species = no_of_selected;
1308 
1311 
1313  if (ms) {
1314  ED4_multi_species_manager *parent_multi_species_man = ms->to_multi_species_manager();
1315 
1316  if (!quickSet) parent_multi_species_man->invalidate_species_counters();
1317 
1318  if (parent_multi_species_man->has_valid_counters()) {
1319  parent_multi_species_man->set_species_counters(parent_multi_species_man->species+species_diff,
1320  parent_multi_species_man->selected_species+selected_diff);
1321  }
1322  }
1323  }
1324 }
1325 
1326 #ifdef DEBUG
1327 void ED4_multi_species_manager::count_species(int *speciesPtr, int *selectedPtr) const {
1328  int m;
1329  int sp = 0;
1330  int sel = 0;
1331 
1332  for (m=0; m<members(); m++) {
1333  ED4_base *child = member(m);
1334 
1335  if (child->is_group_manager()) {
1336  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1337 
1338  if (!multi_species_man->has_valid_counters()) {
1339  int sp1, sel1;
1340 
1341  multi_species_man->count_species(&sp1, &sel1);
1342  sel += sel1;
1343  sp += sp1;
1344  }
1345  else {
1346  sel += multi_species_man->get_no_of_selected_species();
1347  sp += multi_species_man->get_no_of_species();
1348  }
1349  }
1350  else if (child->is_species_manager()) {
1351  ED4_species_manager *species_man = child->to_species_manager();
1352  if (!species_man->is_consensus_manager()) {
1353  sp++;
1354  if (species_man->is_highlighted()) sel++;
1355  }
1356  }
1357  }
1358 
1359  *speciesPtr = sp;
1360  *selectedPtr = sel;
1361 }
1362 #endif
1363 
1364 void ED4_multi_species_manager::update_species_counters() {
1365  int m;
1366  int sp = 0;
1367  int sel = 0;
1368 
1369  for (m=0; m<members(); m++) {
1370  ED4_base *child = member(m);
1371 
1372  if (child->is_group_manager()) {
1373  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1374 
1375  if (!multi_species_man->has_valid_counters()) {
1376  multi_species_man->update_species_counters();
1377  }
1378  sel += multi_species_man->get_no_of_selected_species();
1379  sp += multi_species_man->get_no_of_species();
1380  }
1381  else if (child->is_species_manager()) {
1382  ED4_species_manager *species_man = child->to_species_manager();
1383 
1384  if (!species_man->is_consensus_manager()) {
1385  sp++;
1386  if (species_man->is_highlighted()) sel++;
1387  }
1388  }
1389  }
1390  set_species_counters(sp, sel);
1391 }
1392 
1393 void ED4_multi_species_manager::select_all(bool only_species) {
1394  int m;
1395  int sp = 0;
1396  int sel = 0;
1397 
1398  for (m=0; m<members(); m++) {
1399  ED4_base *child = member(m);
1400 
1401  if (child->is_group_manager()) {
1402  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1403  multi_species_man->select_all(only_species);
1404  sp += multi_species_man->get_no_of_species();
1405  sel += multi_species_man->get_no_of_selected_species();
1406  }
1407  else if (child->is_species_manager()) {
1408  ED4_species_manager *species_man = child->to_species_manager();
1409 
1410  if (!species_man->is_consensus_manager()) {
1411  sp++;
1412  if (!species_man->is_highlighted()) {
1413  if (!only_species || !species_man->is_SAI_manager()) {
1414  ED4_species_name_terminal *species_name = species_man->search_spec_child_rek(LEV_SPECIES_NAME)->to_species_name_terminal();
1415  ED4_ROOT->add_to_highlighted(species_name);
1416  }
1417  }
1418  if (species_man->is_highlighted()) sel++;
1419  }
1420  }
1421  }
1422  set_species_counters(sp, sel);
1423 }
1425  int m;
1426  int sp = 0;
1427 
1428  for (m=0; m<members(); m++) {
1429  ED4_base *child = member(m);
1430 
1431  if (child->is_group_manager()) {
1432  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1433  multi_species_man->deselect_all_species_and_SAI();
1434  sp += multi_species_man->get_no_of_species();
1435  }
1436  else if (child->is_species_manager()) {
1437  ED4_species_manager *species_man = child->to_species_manager();
1438 
1439  if (!species_man->is_consensus_manager()) {
1440  sp++;
1441  if (species_man->is_highlighted()) {
1442  ED4_species_name_terminal *species_name = species_man->search_spec_child_rek(LEV_SPECIES_NAME)->to_species_name_terminal();
1443  ED4_ROOT->remove_from_highlighted(species_name);
1444  }
1445  }
1446  }
1447  else {
1448  e4_assert(!child->is_manager());
1449  }
1450  }
1451  set_species_counters(sp, 0);
1452 }
1454  int m;
1455  int sp = 0;
1456  int sel = 0;
1457 
1458  for (m=0; m<members(); m++) {
1459  ED4_base *child = member(m);
1460 
1461  if (child->is_group_manager()) {
1462  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1463  multi_species_man->invert_selection_of_all_species();
1464  sp += multi_species_man->get_no_of_species();
1465  sel += multi_species_man->get_no_of_selected_species();
1466  }
1467  else if (child->is_species_manager()) {
1468  ED4_species_manager *species_man = child->to_species_manager();
1469 
1470  if (!species_man->is_consensus_manager()) {
1471  sp++;
1472 
1473  if (!species_man->is_SAI_manager()) {
1474  ED4_species_name_terminal *species_name = species_man->search_spec_child_rek(LEV_SPECIES_NAME)->to_species_name_terminal();
1475 
1476  if (species_man->is_highlighted()) ED4_ROOT->remove_from_highlighted(species_name);
1477  else ED4_ROOT->add_to_highlighted(species_name);
1478  }
1479  if (species_man->is_highlighted()) sel++;
1480  }
1481  }
1482  else {
1483  e4_assert(!child->is_manager());
1484  }
1485  }
1486 
1489 }
1491  int m;
1492  int sp = 0;
1493  int sel = 0;
1494 
1495  for (m=0; m<members(); m++) {
1496  ED4_base *child = member(m);
1497 
1498  if (child->is_group_manager()) {
1499  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1500  multi_species_man->marked_species_select(select);
1501  sp += multi_species_man->get_no_of_species();
1502  sel += multi_species_man->get_no_of_selected_species();
1503  }
1504  else if (child->is_species_manager()) {
1505  ED4_species_manager *species_man = child->to_species_manager();
1506 
1507  if (!species_man->is_consensus_manager()) {
1508  sp++;
1509 
1510  if (species_man->is_species_seq_manager()) {
1511  GBDATA *gbd = species_man->get_species_pointer();
1512  e4_assert(gbd);
1513  int is_marked = GB_read_flag(gbd);
1514 
1515  if (is_marked) {
1516  if (select) { // select marked
1517  if (!species_man->is_highlighted()) {
1518  ED4_species_name_terminal *species_name = species_man->search_spec_child_rek(LEV_SPECIES_NAME)->to_species_name_terminal();
1519  ED4_ROOT->add_to_highlighted(species_name);
1520  }
1521  }
1522  else { // de-select marked
1523  if (species_man->is_highlighted()) {
1524  ED4_species_name_terminal *species_name = species_man->search_spec_child_rek(LEV_SPECIES_NAME)->to_species_name_terminal();
1525  ED4_ROOT->remove_from_highlighted(species_name);
1526  }
1527  }
1528  }
1529  }
1530  if (species_man->is_highlighted()) sel++;
1531  }
1532  }
1533  else {
1534  e4_assert(!child->is_manager());
1535  }
1536  }
1537  set_species_counters(sp, sel);
1538 }
1540  int m;
1541  int sp = 0;
1542  int sel = 0;
1543 
1544  for (m=0; m<members(); m++) {
1545  ED4_base *child = member(m);
1546 
1547  if (child->is_group_manager()) {
1548  ED4_multi_species_manager *multi_species_man = child->to_group_manager()->get_multi_species_manager();
1549  multi_species_man->selected_species_mark(mark);
1550  sp += multi_species_man->get_no_of_species();
1551  sel += multi_species_man->get_no_of_selected_species();
1552  }
1553  else if (child->is_species_manager()) {
1554  ED4_species_manager *species_man = child->to_species_manager();
1555 
1556  if (!species_man->is_consensus_manager()) {
1557  sp++;
1558  if (species_man->is_highlighted()) {
1559  if (species_man->is_species_seq_manager()) {
1560  GBDATA *gbd = species_man->get_species_pointer();
1561  e4_assert(gbd);
1562 
1563  GB_write_flag(gbd, mark ? 1 : 0);
1564  }
1565  sel++;
1566  }
1567  }
1568  }
1569  else {
1570  e4_assert(!child->is_manager());
1571  }
1572  }
1573  set_species_counters(sp, sel);
1574 }
1575 
1577  ED4_species_manager *consensus_manager = NULp;
1578 
1579  for (int i=0; i<members(); i++) {
1580  ED4_base *child = member(i);
1581  if (child->is_consensus_manager()) {
1582  consensus_manager = child->to_species_manager();
1583  break;
1584  }
1585  }
1586 
1587  return consensus_manager;
1588 }
1589 
1590 // -----------------------------
1591 // ED4_species_manager
1592 
1593 ED4_species_manager::ED4_species_manager(ED4_species_type type_, const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1594  ED4_manager(species_manager_spec, temp_id, width, height, temp_parent),
1595  type(type_),
1596  highlighted(false)
1597 {
1600 }
1601 
1602 ED4_species_manager::~ED4_species_manager() {
1604 }
1605 
1607  for (ED4_window *ew = first_window; ew; ew = ew->next) {
1608  ew->cursor.prepare_shutdown(); // removes any callbacks
1609  }
1611 }
1612 
1613 // ------------------------
1614 // group managers
1615 
1616 ED4_abstract_group_manager::ED4_abstract_group_manager(const ED4_objspec& spec_, const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1617  ED4_manager(spec_, temp_id, width, height, temp_parent),
1618  my_table(0)
1619 {
1620 }
1621 
1622 ED4_group_manager::ED4_group_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
1623  ED4_abstract_group_manager(group_manager_spec, temp_id, width, height, temp_parent)
1624 {
1625 }
1626 
1627 // -------------------
1628 // ED4_remap
1629 
1631  mode = ED4_RM_NONE;
1632  show_above_percent = 0;
1633 
1634  sequence_table_len = 1;
1635  screen_table_len = 1;
1636 
1637  screen_to_sequence_tab = new int[1]; screen_to_sequence_tab[0] = 0;
1638  sequence_to_screen_tab = new int[1]; sequence_to_screen_tab[0] = 0;
1639 
1640  sequence_len = 0;
1641  MAXSEQUENCECHARACTERLENGTH = screen_len = 0;
1642 
1643  update_needed = true;
1644 
1645 }
1647  delete [] screen_to_sequence_tab;
1648  delete [] sequence_to_screen_tab;
1649 }
1650 int ED4_remap::screen_to_sequence(int screen_pos) const {
1651  if (size_t(screen_pos) == screen_len) {
1652  return screen_to_sequence_tab[screen_len-1];
1653  }
1654  e4_assert(screen_pos>=0 && size_t(screen_pos)<screen_len);
1655  return screen_to_sequence_tab[screen_pos];
1656 }
1657 int ED4_remap::clipped_sequence_to_screen_PLAIN(int sequence_pos) const {
1658  if (sequence_pos<0) {
1659  sequence_pos = 0;
1660  }
1661  else if (size_t(sequence_pos)>sequence_len) {
1662  sequence_pos = sequence_len;
1663  }
1664  return sequence_to_screen_PLAIN(sequence_pos);
1665 }
1666 int ED4_remap::sequence_to_screen(int sequence_pos) const {
1667  int scr_pos = sequence_to_screen_PLAIN(sequence_pos);
1668  if (scr_pos<0) scr_pos = -scr_pos;
1669  return scr_pos;
1670 }
1671 
1672 void ED4_remap::adjacent_screen_positions(int seq_pos, int& screen_pos_left, int& screen_pos_right) {
1673  e4_assert(!is_shown(seq_pos)); // otherwise use sequence_to_screen()
1674 
1675  screen_pos_left = -1;
1676  for (int p = seq_pos-1; screen_pos_left<0 && p>=0; --p) {
1677  screen_pos_left = sequence_to_screen_PLAIN(p);
1678  }
1679  screen_pos_right = -1;
1680  for (int p = seq_pos+1; screen_pos_right<0 && size_t(p)<=sequence_len; ++p) {
1681  screen_pos_right = sequence_to_screen_PLAIN(p);
1682  }
1683 }
1684 
1685 inline void ED4_remap::set_sequence_to_screen(int pos, int newVal, bool& mapping_changed) {
1686  e4_assert(pos>=0 && size_t(pos)<sequence_table_len);
1687  if (sequence_to_screen_tab[pos]!=newVal) {
1688  sequence_to_screen_tab[pos] = newVal;
1689  mapping_changed = true;
1690  }
1691 }
1693  if (!update_needed) {
1694  update_needed = true;
1695  if (ED4_ROOT && ED4_ROOT->root_group_man) { // test if root_group_man already exists
1696  ED4_ROOT->root_group_man->resize_requested_by_child(); // remapping is recompiled while re-displaying the root_group_manager
1697  }
1698  }
1699 }
1702 }
1703 
1705  e4_assert(update_needed);
1706 
1707  const BaseFrequencies& table = gm->table();
1708  size_t i, j;
1709 
1710  bool mapping_changed = false; // is changed by set_sequence_to_screen
1711  update_needed = false;
1712 
1713  sequence_len = table.size(); // take size of any table
1714  if ((sequence_len+1) > sequence_table_len) {
1715  delete [] sequence_to_screen_tab;
1716  sequence_to_screen_tab = new int[sequence_table_len = sequence_len+1];
1717  memset(sequence_to_screen_tab, 0, sequence_table_len*sizeof(int));
1718  mapping_changed = true;
1719  }
1720 
1721  int above_percent;
1722  switch (gm->remap()->get_mode()) {
1723  default: e4_assert(0); FALLTHROUGH; // in NDEBUG
1724  case ED4_RM_NONE: {
1725  dont_map :
1726  for (i=0; i<sequence_table_len; i++) {
1727  set_sequence_to_screen(i, i, mapping_changed);
1728  }
1729  screen_len = sequence_len;
1730  break;
1731  }
1732  case ED4_RM_SHOW_ABOVE: {
1733  above_percent = show_above_percent;
1734  goto calc_percent;
1735  }
1736  case ED4_RM_MAX_ALIGN:
1737  case ED4_RM_MAX_EDIT: {
1738  above_percent = 0;
1739  calc_percent :
1740  for (i=0, j=0; i<(sequence_table_len-1); i++) {
1741  int bases;
1742  int gaps;
1743 
1744  table.bases_and_gaps_at(i, &bases, &gaps);
1745 
1746  if (bases==0 && gaps==0) { // special case (should occur only after inserting columns)
1747  set_sequence_to_screen(i, -j, mapping_changed); // hide
1748  }
1749  else {
1750  int percent = (int)((bases*100L)/table.added_sequences());
1751 
1752  e4_assert(percent==((bases*100)/(bases+gaps)));
1753 
1754  if (bases && percent>=above_percent) {
1755  set_sequence_to_screen(i, j++, mapping_changed);
1756  }
1757  else {
1758  set_sequence_to_screen(i, -j, mapping_changed);
1759  }
1760  }
1761  }
1762  for (; i<sequence_table_len; i++) { // fill rest of table
1763  set_sequence_to_screen(i, j++, mapping_changed);
1764  }
1765  screen_len = j;
1766  break;
1767  }
1768  case ED4_RM_DYNAMIC_GAPS: {
1769  for (i=0, j=0; i<(sequence_table_len-1); i++) {
1770  int bases;
1771 
1772  table.bases_and_gaps_at(i, &bases, NULp);
1773  if (bases) {
1774  set_sequence_to_screen(i, j++, mapping_changed);
1775  }
1776  else {
1777  size_t k = i+1;
1778 
1779  while (k<(sequence_table_len-1)) {
1780  int bases2;
1781 
1782  table.bases_and_gaps_at(k, &bases2, NULp);
1783  if (bases2) {
1784  break;
1785  }
1786  k++;
1787  }
1788 
1789  int gaps = k-i;
1790  int shown_gapsize;
1791 
1792  if (gaps<100) {
1793  shown_gapsize = gaps/10 + 1;
1794  }
1795  else if (gaps<1000) {
1796  shown_gapsize = gaps/100 + 10;
1797  }
1798  else {
1799  shown_gapsize = gaps/1000 + 19;
1800  }
1801 
1802  for (; i<k && shown_gapsize; i++, shown_gapsize--) {
1803  set_sequence_to_screen(i, j++, mapping_changed);
1804  }
1805  for (; i<k; i++) {
1806  set_sequence_to_screen(i, -j, mapping_changed);
1807  }
1808  i--;
1809  }
1810  }
1811  for (; i<sequence_table_len; i++) {
1812  set_sequence_to_screen(i, j++, mapping_changed); // fill rest of table
1813  }
1814  screen_len = j;
1815  break;
1816  }
1817  }
1818 
1819  if (sequence_table_len) {
1820  if (!screen_len && sequence_len) {
1821  goto dont_map;
1822  }
1823  if ((screen_len+1) > screen_table_len) {
1824  delete [] screen_to_sequence_tab;
1825  screen_to_sequence_tab = new int[screen_table_len = screen_len+1];
1826  }
1827  memset(screen_to_sequence_tab, 0, sizeof(int)*screen_table_len);
1828  for (i=0; i<sequence_table_len; i++) {
1829  int screen_pos = sequence_to_screen_tab[i];
1830  if (screen_pos>=0) {
1831  screen_to_sequence_tab[screen_pos] = i;
1832  }
1833  }
1834  }
1835 
1836  if (sequence_len>1) {
1837  MAXSEQUENCECHARACTERLENGTH = sequence_len;
1838  }
1839 
1840 #if defined(DEBUG) && 0
1841  fputs("-------------------- rebuild column mapping:\n", stderr);
1842  fprintf(stderr, "sequence: len=%6zu table_len=%6zu\n", sequence_len, sequence_table_len);
1843  fprintf(stderr, "screen: len=%6zu table_len=%6zu\n", screen_len, screen_table_len);
1844  fputs("--------------------\n", stderr);
1845 #endif
1846 
1847  // raise a warning if all columns are collapsed:
1848  static bool checked_all_collapsed = false;
1849  if (!checked_all_collapsed) {
1850  if (sequence_len>1) { // ignore first call(s) to compile during startup
1851  checked_all_collapsed = true;
1852  if (screen_len<2) {
1853  aw_message("All columns hidden. Check 'Properties/Editor options/Show all gaps'");
1854  }
1855  }
1856  }
1857 
1858  return mapping_changed;
1859 }
1860 
1861 // --------------------------------
1862 // ED4_root_group_manager
1863 
1864 ED4_root_group_manager::ED4_root_group_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent)
1865  : ED4_abstract_group_manager(root_group_manager_spec, temp_id, width, height, temp_parent),
1866  my_remap()
1867 {
1868  AW_root *awr = ED4_ROOT->aw_root;
1871  my_remap.mark_compile_needed_force();
1872 }
1873 
1875  return my_remap.compile_needed() && my_remap.compile(this);
1876 }
1877 
1878 // -----------------------------------
1879 // ED4_multi_species_manager
1880 
1881 ED4_multi_sequence_manager::ED4_multi_sequence_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent)
1882  : ED4_manager(multi_sequence_manager_spec, temp_id, width, height, temp_parent)
1883 {}
1884 
1885 ED4_sequence_manager::ED4_sequence_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent)
1886  : ED4_manager(sequence_manager_spec, temp_id, width, height, temp_parent)
1887 {}
1888 
1889 ED4_multi_name_manager::ED4_multi_name_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent)
1890  : ED4_manager(multi_name_manager_spec, temp_id, width, height, temp_parent)
1891 {}
1892 
1893 ED4_name_manager::ED4_name_manager(const char *temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent)
1894  : ED4_manager(name_manager_spec, temp_id, width, height, temp_parent)
1895 {}
1896 
1897 
void calc_rel_coords(AW_pos *x, AW_pos *y)
Definition: ED4_base.cxx:810
static ED4_objspec multi_species_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_HORIZONTAL), LEV_MULTI_SPECIES,(ED4_level)(LEV_SPECIES|LEV_GROUP|LEV_SPACER), LEV_NONE, LEV_NONE)
ED4_update_flag
Definition: ed4_defs.hxx:201
void PV_SequenceUpdate_CB(GB_CB_TYPE gbtype)
void mark_compile_needed()
void set_resize(int value)
Definition: ed4_defs.hxx:307
ED4_returncode clear_refresh()
string result
GB_TYPES type
bool is_whole() const
Definition: pos_range.h:71
ED4_base * get_competent_child(AW_pos x, AW_pos y, ED4_properties relevant_prop)
virtual void delete_requested_children()=0
ED4_movemode mode
Definition: ed4_defs.hxx:241
AW_device * current_device()
Definition: ed4_class.hxx:1397
ED4_multi_species_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
const char * resolve_pointer_to_char_pntr(int *str_len=NULp) const FINAL_OVERRIDE
int screen_to_sequence(int screen_pos) const
void resize_requested_by_child()
Definition: ed4_class.hxx:2192
AW_font_group font_group
Definition: ed4_class.hxx:1467
AW_pos size[2]
Definition: ed4_defs.hxx:255
static ED4_objspec sequence_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_VERTICAL), LEV_SEQUENCE,(ED4_level)(LEV_SEQUENCE_INFO|LEV_SEQUENCE_STRING|LEV_ORF|LEV_PURE_TEXT|LEV_COL_STAT), LEV_NONE, LEV_SPECIES)
ED4_returncode ShowCursor(ED4_index offset_x, ED4_cursor_move move, int move_pos=1)
void insert_member(ED4_base *new_member)
const AW_screen_area & get_area_size() const
Definition: AW_device.cxx:57
static char * y[maxsp+1]
bool compile_needed() const
Definition: ed4_class.hxx:1757
void resize_requested_by_link(ED4_base *link)
ED4_level preferred_parent
Definition: ed4_defs.hxx:242
bool nearlyEqual(const double &val1, const double &val2)
Definition: aw_position.hxx:75
void set_left_clip_border(int left, bool allow_oversize=false)
ARB_ERROR rebuild_consensus(ED4_base *object)
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
Definition: ed4_class.hxx:795
const AW_screen_area & get_cliprect() const
Definition: aw_device.hxx:237
void clear()
Definition: ed4_class.hxx:871
ED4_properties static_prop
Definition: ed4_class.hxx:224
char * id
Definition: ed4_class.hxx:920
ED4_remap_mode get_mode() const
Definition: ed4_class.hxx:1737
virtual void remove_callbacks()=0
void add(int v)
Definition: ClustalV.cxx:461
void update_requested_children() OVERRIDE
BaseFrequencies & table()
Definition: ed4_class.hxx:1648
void request_resize()
Definition: ed4_class.hxx:2187
void ED4_request_relayout()
virtual void resize_requested_children()=0
void Show(bool refresh_all, bool is_cleared) OVERRIDE
long read_int() const
Definition: AW_awar.cxx:184
void win_to_world_coords(AW_pos *xPtr, AW_pos *yPtr) const
Definition: ed4_class.hxx:361
void set_top_clip_border(int top, bool allow_oversize=false)
bool is_shown(int seq_pos) const
Definition: ed4_class.hxx:1761
ED4_level level
Definition: ed4_class.hxx:225
#define ED4_AWAR_COMPRESS_SEQUENCE_TYPE
Definition: ed4_awars.hxx:22
#define Y_POS
Definition: ed4_defs.hxx:72
ED4_species_manager * get_consensus_manager() const
void marked_species_select(bool select)
static void touch_world_cache()
Definition: ed4_class.hxx:1008
ED4_root * ED4_ROOT
Definition: ED4_main.cxx:48
int is_species_manager() const
Definition: ed4_class.hxx:1109
void delete_requested_children() OVERRIDE
ED4_update_info update_info
Definition: ed4_class.hxx:925
void delete_requested_children() OVERRIDE
ED4_base * search_ID(const char *id) FINAL_OVERRIDE
void update_scrolled_rectangle()
Definition: ED4_window.cxx:144
ED4_terminal * owner_of_cursor
Definition: ed4_class.hxx:644
virtual void Show(bool refresh_all, bool is_cleared)=0
ED4_root_group_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
ED4_returncode clear_background(int color=0)
Definition: ED4_base.cxx:939
ED4_manager * parent
Definition: ed4_class.hxx:916
static ED4_objspec root_group_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_VERTICAL), LEV_ROOTGROUP,(ED4_level)(LEV_DEVICE), LEV_NONE, LEV_NONE)
const ED4_folding_line * get_horizontal_folding()
Definition: ed4_class.hxx:351
char * protstruct
Definition: ed4_class.hxx:1449
FILE * seq
Definition: rns.c:46
virtual void update_requested_children()=0
void unlink_from_parent()
Definition: ED4_base.cxx:675
#define e4_assert(bed)
Definition: ed4_class.hxx:14
const int WIDTH
int is_multi_species_manager() const
Definition: ed4_class.hxx:1101
const ED4_objspec & spec
Definition: ed4_class.hxx:914
bool compile(ED4_root_group_manager *gm)
void remove_callbacks() OVERRIDE
bool has_property(ED4_properties prop) const
Definition: ed4_class.hxx:977
void request_refresh_for_specific_terminals(ED4_level lev)
Definition: ED4_root.cxx:87
ED4_level restriction_level
Definition: ed4_class.hxx:228
bool is_consensus_manager() const
Definition: ed4_class.hxx:1835
bool is_child_of(ED4_manager *Parent)
Definition: ed4_class.hxx:1050
ED4_level
Definition: ed4_defs.hxx:118
virtual ED4_returncode event_sent_by_parent(AW_event *event, AW_window *aww)=0
double AW_pos
Definition: aw_base.hxx:29
fflush(stdout)
int is_manager() const
Definition: ed4_class.hxx:1096
ED4_index members() const
Definition: ed4_class.hxx:797
unsigned int clear_at_refresh
Definition: ed4_defs.hxx:293
ED4_window * next
Definition: ed4_class.hxx:706
ED4_returncode
Definition: ed4_defs.hxx:159
void push_clip_scale()
Definition: AW_device.cxx:91
GB_ERROR ED4_pfold_set_SAI(char **protstruct, GBDATA *gb_main, const char *alignment_name, long *protstruct_len)
Sets the reference protein secondary structure SAI.
void update_requested_children() OVERRIDE
T * elem() const
Definition: ed4_list.hxx:25
ED4_manager(const ED4_objspec &spec_, const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
GBDATA * get_gb_main() const
Definition: ed4_class.hxx:1422
int sequence_to_screen(int sequence_pos) const
ED4_returncode handle_move(ED4_move_info *moveinfo)
ED4_terminal * get_last_terminal(int start_index=-1) const
#define WITH_ALL_ABOVE_GROUP_MANAGER_TABLES(walk_up, COMMAND)
const PosRange * changed_range(const BaseFrequencies &other) const
Definition: chartable.cxx:821
#define X_POS
Definition: ed4_defs.hxx:71
ED4_multi_sequence_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
virtual void request_refresh(int clear=1)=0
ED4_returncode rebuild_consensi(ED4_base *start_species, ED4_update_flag update_flag)
void set_refresh(int value)
Definition: ed4_defs.hxx:304
struct ED4_terminal::@8 tflag
void remove_from_highlighted(ED4_species_name_terminal *object)
Definition: ED4_root.cxx:328
#define false
Definition: ureadseq.h:13
ED4_returncode add_to_highlighted(ED4_species_name_terminal *object)
Definition: ED4_root.cxx:380
ED4_species_type
Definition: ed4_class.hxx:886
static ED4_objspec group_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_VERTICAL), LEV_GROUP,(ED4_level)(LEV_MULTI_SPECIES|LEV_BRACKET), LEV_NONE, LEV_NONE)
void pop_clip_scale()
Definition: AW_device.cxx:62
ED4_window * first_window
Definition: ed4_class.hxx:1428
virtual void Delete()=0
void bases_and_gaps_at(int column, int *bases, int *gaps) const
Definition: chartable.cxx:738
static ED4_objspec area_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_VERTICAL), LEV_AREA,(ED4_level)(LEV_MULTI_SPECIES|LEV_TREE|LEV_SPACER), LEV_NONE, LEV_NONE)
ED4_returncode event_sent_by_parent(AW_event *event, AW_window *aww) FINAL_OVERRIDE
void expect_no_error() const
Definition: arb_error.h:138
void mark_compile_needed_force()
int get_max_width() const
ED4_returncode move_requested_by_parent(ED4_move_info *mi)
bool set_size_does_change(int idx, AW_pos value)
Definition: ed4_defs.hxx:261
ED4_device_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
ED4_level handled_level
Definition: ed4_class.hxx:227
#define ED4_AWAR_COMPRESS_SEQUENCE_PERCENT
Definition: ed4_awars.hxx:25
ED4_base * object
Definition: ed4_defs.hxx:239
ED4_root_group_manager * root_group_man
Definition: ed4_class.hxx:1432
int sequence_to_screen_PLAIN(int sequence_pos) const
Definition: ed4_class.hxx:1709
ED4_name_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
GB_write_int const char GB_write_autoconv_string WRITE_SKELETON(write_pointer, GBDATA *,"%p", GB_write_pointer) char *AW_awa if)(!gb_var) return strdup("")
Definition: AW_awar.cxx:163
ARB_ERROR route_down_hierarchy(const ED4_route_cb &cb) FINAL_OVERRIDE
Definition: ED4_base.cxx:392
ED4_main_manager * main_manager
Definition: ed4_class.hxx:1429
static ED4_objspec multi_name_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_HORIZONTAL), LEV_MULTI_NAME, LEV_NAME_MANAGER, LEV_NONE, LEV_NONE)
bool calc_bounding_box() FINAL_OVERRIDE
void calc_world_coords(AW_pos *x, AW_pos *y) const
Definition: ed4_class.hxx:983
int GB_read_flag(GBDATA *gbd)
Definition: arbdb.cxx:2796
void Delete() OVERRIDE
void set_mode(ED4_remap_mode Mode, int above_percent)
Definition: ed4_class.hxx:1738
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
unsigned int update_requested
Definition: ed4_defs.hxx:299
unsigned int delete_requested
Definition: ed4_defs.hxx:298
int refresh_flag_ok()
static ED4_objspec multi_sequence_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_HORIZONTAL), LEV_MULTI_SEQUENCE, LEV_SEQUENCE, LEV_NONE, LEV_NONE)
ED4_list_elem * next() const
Definition: ed4_list.hxx:24
GB_alignment_type alignment_type
Definition: ed4_class.hxx:1440
ED4_extension extension
Definition: ed4_class.hxx:924
static ED4_objspec species_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_VERTICAL), LEV_SPECIES,(ED4_level)(LEV_MULTI_SEQUENCE|LEV_MULTI_NAME|LEV_SPECIES_NAME|LEV_SEQUENCE|LEV_FLAG_HEADER), LEV_NONE, LEV_NONE)
void selected_species_mark(bool mark)
int TERMINAL_HEIGHT
Definition: ED4_main.cxx:50
int adjust_clipping_rectangle()
Definition: ED4_base.cxx:907
int size() const
Definition: chartable.h:242
long int flag
Definition: f2c.h:39
static void update_scrolled_rectangles(ED4_window *win)
static ED4_objspec name_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_VERTICAL), LEV_NAME_MANAGER,(ED4_level)(LEV_SPECIES_NAME|LEV_FLAG), LEV_NONE, LEV_SPECIES)
void Delete() FINAL_OVERRIDE
void set_right_clip_border(int right, bool allow_oversize=false)
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())
fputs(TRACE_PREFIX, stderr)
ED4_base * search_spec_child_rek(ED4_level level)
Definition: ED4_base.cxx:434
ED4_sequence_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
ED4_base * width_link
Definition: ed4_class.hxx:922
void call(BASE *b)
Definition: ed4_class.hxx:864
ED4_cursor & current_cursor()
Definition: ed4_class.hxx:1400
ED4_group_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
long protstruct_len
Definition: ed4_class.hxx:1450
#define IF_ASSERTION_USED(x)
Definition: arb_assert.h:308
AW_pos position[2]
Definition: ed4_defs.hxx:252
int MAXSEQUENCECHARACTERLENGTH
Definition: ED4_main.cxx:55
unsigned int refresh
Definition: ed4_defs.hxx:292
void remove_all_callbacks()
ED4_returncode remove_member(ED4_base *member)
void GB_write_flag(GBDATA *gbd, long flag)
Definition: arbdb.cxx:2773
void ED4_with_all_edit_windows(void(*cb)(ED4_window *))
Definition: ED4_main.cxx:262
aisc_com * link
const ED4_folding_line * get_next() const
Definition: ed4_class.hxx:306
void ED4_viewDifferences_disable()
bool existing_index(ED4_index idx) const
Definition: ed4_class.hxx:788
ED4_returncode distribute_children()
ED4_returncode update_bases(const ED4_base *old_base, const ED4_base *new_base, PosRange range=PosRange::whole())
ED4_returncode move_requested_by_child(ED4_move_info *moveinfo)
const char * get_alignment_name() const
Definition: ed4_class.hxx:1458
ED4_window * current_ed4w()
Definition: ed4_class.hxx:1398
void resize_requested_children() OVERRIDE
AW_root * aw_root
Definition: ed4_class.hxx:1425
void delete_requested_by_child()
ED4_list_elem< T > * head() const
Definition: ed4_list.hxx:45
static ED4_objspec main_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_HORIZONTAL), LEV_ROOT, LEV_ROOTGROUP, LEV_NONE, LEV_NONE)
ED4_properties
Definition: ed4_defs.hxx:174
unsigned int hidden
Definition: ed4_class.hxx:927
void update_requested_by_child()
void aw_message(const char *msg)
Definition: AW_status.cxx:1142
void select_all(bool only_species)
ED4_area_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
ED4_returncode refresh_requested_by_child()
AW_pos end_x
Definition: ed4_defs.hxx:240
ED4_level allowed_children
Definition: ed4_class.hxx:226
AW_window_simple * win
void delete_requested_children() OVERRIDE
#define NULp
Definition: cxxforward.h:114
unsigned int resize
Definition: ed4_defs.hxx:291
int is_area_manager() const
Definition: ed4_class.hxx:1110
ED4_index search_member(ED4_extension *location, ED4_properties prop)
const ED4_remap * remap() const
Definition: ed4_class.hxx:1781
static ED4_objspec device_manager_spec((ED4_properties)(PROP_IS_MANAGER|PROP_HORIZONTAL), LEV_DEVICE,(ED4_level)(LEV_AREA|LEV_SPACER|LEV_LINE), LEV_NONE, LEV_NONE)
ED4_abstract_group_manager(const ED4_objspec &spec_, const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
void request_resize_of_linked()
AW_pos end_y
Definition: ed4_defs.hxx:240
ED4_returncode search_target_species(ED4_extension *location, ED4_properties prop, ED4_base **found_member, ED4_level return_level)
virtual ED4_base * search_ID(const char *id)=0
int clipped_sequence_to_screen_PLAIN(int sequence_pos) const
void resize_requested_children() OVERRIDE
char * resolve_pointer_to_string_copy(int *str_len=NULp) const FINAL_OVERRIDE
void adjacent_screen_positions(int seq_pos, int &screen_pos_left, int &screen_pos_right)
ED4_returncode check_in_bases(ED4_base *added_base)
#define FALLTHROUGH
Definition: cxxforward.h:128
GB_transaction ta(gb_var)
const ED4_folding_line * get_vertical_folding()
Definition: ed4_class.hxx:352
int has_valid_counters() const
Definition: ed4_class.hxx:1626
ED4_returncode check_out_bases(ED4_base *subbed_base)
bool is_partly_visible() const
int is_terminal() const
Definition: ed4_class.hxx:1076
ED4_base * height_link
Definition: ed4_class.hxx:923
void Show(bool refresh_all, bool is_cleared) OVERRIDE
ED4_manager * get_parent(ED4_level lev) const
Definition: ed4_class.hxx:1821
void set_clear_at_refresh(int value)
Definition: ed4_defs.hxx:301
void update_consensus(ED4_manager *old_parent, ED4_manager *new_parent, ED4_base *sequence)
#define min(a, b)
Definition: f2c.h:153
struct ED4_base::@7 flag
#define HEIGHT
Definition: ed4_defs.hxx:74
ED4_remap_mode
Definition: ed4_class.hxx:1673
const ED4_terminal * get_consensus_relevant_terminal() const
Definition: ED4_base.cxx:619
int is_group_manager() const
Definition: ed4_class.hxx:1105
void loadable_SAIs_may_have_changed()
Definition: ed4_class.hxx:1464
void announce_deletion(ED4_base *object)
Definition: ed4_class.hxx:1535
virtual bool calc_bounding_box()=0
long ED4_index
Definition: ed4_defs.hxx:113
int added_sequences() const
Definition: chartable.h:243
bool allowed_to_draw
Definition: ed4_class.hxx:643
void request_refresh(int clear=1) FINAL_OVERRIDE
ED4_base * get_competent_clicked_child(AW_pos x, AW_pos y, ED4_properties relevant_prop)
ED4_multi_name_manager(const char *id, AW_pos width, AW_pos height, ED4_manager *parent)
Adds support for protein structure prediction, comparison of two protein secondary structures and of ...
int is_root_group_manager() const
Definition: ed4_class.hxx:1106
~ED4_manager() OVERRIDE
short in_border(AW_pos abs_x, AW_pos abs_y, ED4_movemode mode)
Definition: ED4_base.cxx:789
#define max(a, b)
Definition: f2c.h:154