source: trunk/EDIT4/ED4_consensus.cxx

Last change on this file was 16763, checked in by westram, 7 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 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 = NULp;
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(NULp);
43        ED4_ROOT->request_refresh_for_specific_terminals(LEV_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(LEV_SPACER)->to_spacer_terminal();
54
55        if (show) {
56            consensus_man->unhide_children();
57        }
58        else {
59            consensus_man->hide_children();
60        }
61        spacer->resize_dynamic();
62    }
63
64    return NULp;
65}
66
67void ED4_consensus_display_changed(AW_root *root) {
68    bool show = root->awar(ED4_AWAR_CONSENSUS_SHOW)->read_int();
69    ED4_ROOT->root_group_man->route_down_hierarchy(makeED4_route_cb(toggle_consensus_display, show)).expect_no_error();
70}
71
Note: See TracBrowser for help on using the repository browser.