root/trunk/EDIT4/ED4_tools.cxx

Revision 8617, 2.2 KB (checked in by westram, 5 weeks ago)

merge from e4fix [8191] [8192] [8193] [8194] [8195] [8200] [8201] [8202]

  • removed unused default parameter 'only_text' from ED4_terminal::draw
  • removed implementation of pure member functions (draw,Show)
  • ED4_root
    • replaced initialization via memset with explicit member-initialization-list
    • added default-ctors for those member w/o any
  • introduced ED4_WinContext
    • (currently only stub replacing tmp_aww etc)
    • wrapped access to current device/aww/ed4w
  • added AWT_install_postcb_cb
    • installs a callback which is called after most user interactions (when action-cb finishes)
      • track most-recently-used edit-window
  • world_to_win_coords / win_to_world_coords
    • removed useless parameter AW_window
    • moved into ED4_window
    • refactored
    • bugfix
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
25char ED4_encode_iupac(const char bases[], GB_alignment_type ali) {
26    return iupac::encode(bases, ali);
27}
28
29const 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
33void 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
43void 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}
Note: See TracBrowser for help on using the browser.