source: tags/arb_5.1/EDIT4/ED4_tools.cxx

Last change on this file was 5885, checked in by westram, 15 years ago
  • moved fast-aligner to separate library
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <ctype.h>
5
6#include <arbdb.h>
7#include <arbdbt.h>
8#include <aw_root.hxx>
9#include <aw_awars.hxx>
10#include <aw_window.hxx>
11#include <fast_aligner.hxx>
12#include <awt_iupac.hxx>
13
14#include "ed4_class.hxx"
15#include "ed4_edit_string.hxx"
16#include "ed4_tools.hxx"
17#include "ed4_awars.hxx"
18
19char ED4_encode_iupac(const char bases[], GB_alignment_type ali) {
20    return AWT_encode_iupac(bases, ali);
21}
22
23const char *ED4_decode_iupac(char iupac, GB_alignment_type ali) {
24    return AWT_decode_iupac(iupac, ali, ED4_ROOT->aw_root->awar(ED4_AWAR_CONSENSUS_GROUP)->read_int()); // IUPAC shown in consensus!
25}
26
27void ED4_set_clipping_rectangle(AW_rectangle *rect)
28{
29    // The following can't be replaced by set_cliprect (set_cliprect clears font overlaps):
30
31    ED4_ROOT->get_device()->set_top_clip_border(rect->t);
32    ED4_ROOT->get_device()->set_bottom_clip_border(rect->b);
33    ED4_ROOT->get_device()->set_left_clip_border(rect->l);
34    ED4_ROOT->get_device()->set_right_clip_border(rect->r);
35}
36
37void ED4_aws_init(AW_root *root, AW_window_simple *aws, GB_CSTR macro_format, GB_CSTR window_format, GB_CSTR typeId) {
38    int typeIdLen = strlen(typeId);
39    int macro_format_len = strlen(macro_format);
40    int window_format_len = strlen(window_format);
41    char *macro_buffer = GB_give_buffer(macro_format_len+window_format_len+2*typeIdLen);
42    char *window_buffer = macro_buffer+macro_format_len+typeIdLen;
43
44    sprintf(macro_buffer, macro_format, typeId);
45    sprintf(window_buffer, window_format, typeId);
46
47    char *macro = GBS_string_2_key(macro_buffer);
48    aws->init(root, macro, window_buffer);
49    delete macro;
50}
51
Note: See TracBrowser for help on using the repository browser.