source: branches/profile/EDIT4/ed4_edit_string.hxx

Last change on this file was 8696, checked in by westram, 12 years ago
  • merge from saiali log:branches/saiali@8635-8695
    • unalign center (blockop)
    • modify SAI range (using ACI/SRT)
    • align ranges defined by SAI
    • refactorings
      • block ops
      • selection lists
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : ed4_edit_string.hxx                               //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef ED4_EDIT_STRING_HXX
12#define ED4_EDIT_STRING_HXX
13
14#ifndef ED4_DEFS_HXX
15#include "ed4_defs.hxx"
16#endif
17
18struct ED4_work_info;
19
20 // @@@ replace ED4_is_align_character by class containing table (store whereever)
21extern unsigned char *ED4_is_align_character;
22inline bool ADPP_IS_ALIGN_CHARACTER(unsigned char chr) { return ED4_is_align_character[chr] != 0; }
23void ED4_init_is_align_character(GB_CSTR gap_chars);
24
25const char SEQ_POINT = '.';
26
27class ED4_remap;
28
29class ED4_Edit_String : virtual Noncopyable {
30    GBDATA      *gbd;
31    char        *seq;
32    long        seq_len;
33    ED4_remap   *remap;
34    static int  nrepeat;
35    static int  nrepeat_is_already_set;
36    static int  nrepeat_zero_requested;
37
38    int legal_curpos(long pos) const            { return pos>=0 && pos<=seq_len; }
39    int legal_seqpos(long pos) const            { return pos>=0 && pos<seq_len; }
40
41    GB_ERROR moveBase(long source_position, long dest_position, unsigned char gap_to_use); // moves a base from source_position to dest_position
42
43    GB_ERROR shiftBases(long source_pos, long source_endpos, long dest_position,
44                        int direction, long *dest_endpos, unsigned char gap_to_use); // shifts a line of bases from source_position to dest_position
45
46    long get_next_base(long seq_position, int direction);
47    long get_next_gap(long seq_position, int direction);
48
49    long get_next_visible_base(long position, int direction);
50    long get_next_visible_gap(long position, int direction);
51    long get_next_visible_pos(long position, int direction);
52
53    GB_ERROR insert(char *, long position, int direction, int removeAtNextGap);
54    GB_ERROR remove(int len, long position, int direction, int insertAtNextGap);
55    GB_ERROR replace(char *text, long position, int direction);
56    GB_ERROR swap_gaps(long position, char ch);
57
58    GB_ERROR command(AW_key_mod keymod, AW_key_code keycode, char key, int direction, ED4_EDITMODI mode, bool is_consensus,
59                     long &cursorpos, bool& changed_flag, ED4_CursorJumpType& cursor_jump, bool& cannot_handle, bool& write_fault, GBDATA *gb_data, bool is_sequence);
60
61    unsigned char get_gap_type(long pos, int direction);
62
63public:
64    char *old_seq;
65    long old_seq_len;
66
67    ED4_Edit_String();
68    void init_edit();
69    GB_ERROR edit(ED4_work_info *info) __ATTR__USERESULT;
70    void finish_edit();
71    ~ED4_Edit_String();
72
73    int use_nrepeat() { // external functions use this to get and use nrepeat
74        int nrep = nrepeat==0 ? 1 : nrepeat;
75        nrepeat = 0;
76        return nrep;
77    }
78};
79
80#else
81#error ed4_edit_string.hxx included twice
82#endif // ED4_EDIT_STRING_HXX
Note: See TracBrowser for help on using the repository browser.