source: tags/ms_r16q2/EDIT4/ED4_consensus.cxx

Last change on this file was 14483, checked in by westram, 8 years ago
  • use typed callbacks in route_down_hierarchy
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : ED4_consensus.cxx                                 //
4//   Purpose   : consensus control functions                       //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11
12#include "ed4_class.hxx"
13#include "ed4_awars.hxx"
14#include "ed4_seq_colors.hxx"
15
16#include <aw_root.hxx>
17#include <aw_awar.hxx>
18
19#define CONSENSUS_AWAR_SOURCE CAS_EDIT4
20#include <consensus.h>
21
22// ------------------------
23//      Build consensus
24
25const ConsensusBuildParams& ED4_root::get_consensus_params() {
26    if (!cons_param) cons_param = new ConsensusBuildParams(aw_root);
27    return *cons_param;
28}
29
30void ED4_root::reset_consensus_params() {
31    if (cons_param) {
32        delete cons_param;
33        cons_param = NULL;
34    }
35}
36
37void ED4_consensus_definition_changed(AW_root*) {
38    ED4_ROOT->reset_consensus_params();
39
40    ED4_reference *ref = ED4_ROOT->reference;
41    if (ref->reference_is_a_consensus()) {
42        ref->data_changed_cb(NULL);
43        ED4_ROOT->request_refresh_for_specific_terminals(ED4_L_SEQUENCE_STRING); // refresh all sequences
44    }
45    else {
46        ED4_ROOT->request_refresh_for_consensus_terminals();
47    }
48}
49
50static ARB_ERROR toggle_consensus_display(ED4_base *base, bool show) {
51    if (base->is_consensus_manager()) {
52        ED4_manager *consensus_man = base->to_manager();
53        ED4_spacer_terminal *spacer = consensus_man->parent->get_defined_level(ED4_L_SPACER)->to_spacer_terminal();
54
55        if (show) {
56            consensus_man->unhide_children();
57            spacer->extension.size[HEIGHT] = SPACERHEIGHT;
58        }
59        else {
60            consensus_man->hide_children();
61
62            ED4_group_manager *group_man = consensus_man->get_parent(ED4_L_GROUP)->to_group_manager();
63            spacer->extension.size[HEIGHT] = (group_man->dynamic_prop&ED4_P_IS_FOLDED) ? SPACERNOCONSENSUSHEIGHT : SPACERHEIGHT;
64        }
65    }
66
67    return NULL;
68}
69
70void ED4_consensus_display_changed(AW_root *root) {
71    bool show = root->awar(ED4_AWAR_CONSENSUS_SHOW)->read_int();
72    ED4_ROOT->root_group_man->route_down_hierarchy(makeED4_route_cb(toggle_consensus_display, show)).expect_no_error();
73}
74
Note: See TracBrowser for help on using the repository browser.