| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : ED4_tools.cxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in January 2010 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // =============================================================== // |
|---|
| 11 | |
|---|
| 12 | #include "ed4_class.hxx" |
|---|
| 13 | #include "ed4_edit_string.hxx" |
|---|
| 14 | #include "ed4_tools.hxx" |
|---|
| 15 | #include "ed4_awars.hxx" |
|---|
| 16 | |
|---|
| 17 | #include <arbdbt.h> |
|---|
| 18 | #include <aw_awar.hxx> |
|---|
| 19 | #include <aw_root.hxx> |
|---|
| 20 | #include <fast_aligner.hxx> |
|---|
| 21 | #include <iupac.h> |
|---|
| 22 | |
|---|
| 23 | #include <cctype> |
|---|
| 24 | |
|---|
| 25 | char ED4_encode_iupac(const char bases[], GB_alignment_type ali) { |
|---|
| 26 | return iupac::encode(bases, ali); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | const char *ED4_decode_iupac(char iupac, GB_alignment_type ali) { |
|---|
| 30 | return iupac::decode(iupac, ali, ED4_ROOT->aw_root->awar(ED4_AWAR_CONSENSUS_GROUP)->read_int()); // IUPAC shown in consensus! |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | void ED4_set_clipping_rectangle(AW_screen_area *rect) |
|---|
| 34 | { |
|---|
| 35 | // The following can't be replaced by set_cliprect (set_cliprect clears font overlaps): |
|---|
| 36 | |
|---|
| 37 | current_device()->set_top_clip_border(rect->t); |
|---|
| 38 | current_device()->set_bottom_clip_border(rect->b); |
|---|
| 39 | current_device()->set_left_clip_border(rect->l); |
|---|
| 40 | current_device()->set_right_clip_border(rect->r); |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | void ED4_aws_init(AW_root *root, AW_window_simple *aws, GB_CSTR macro_format, GB_CSTR window_format, GB_CSTR typeId) { |
|---|
| 44 | int typeIdLen = strlen(typeId); |
|---|
| 45 | int macro_format_len = strlen(macro_format); |
|---|
| 46 | int window_format_len = strlen(window_format); |
|---|
| 47 | char *macro_buffer = GB_give_buffer(macro_format_len+window_format_len+2*typeIdLen); |
|---|
| 48 | char *window_buffer = macro_buffer+macro_format_len+typeIdLen; |
|---|
| 49 | |
|---|
| 50 | sprintf(macro_buffer, macro_format, typeId); |
|---|
| 51 | sprintf(window_buffer, window_format, typeId); |
|---|
| 52 | |
|---|
| 53 | char *macro = GBS_string_2_key(macro_buffer); |
|---|
| 54 | aws->init(root, macro, window_buffer); |
|---|
| 55 | free(macro); |
|---|
| 56 | } |
|---|