1 | |
---|
2 | struct ED4_work_info; |
---|
3 | |
---|
4 | extern unsigned char ED4_is_align_character[256]; |
---|
5 | inline bool ADPP_IS_ALIGN_CHARACTER(unsigned char chr) { return ED4_is_align_character[chr] != 0; } |
---|
6 | void ED4_init_is_align_character(GB_CSTR gap_chars); |
---|
7 | |
---|
8 | const char SEQ_POINT = '.'; |
---|
9 | |
---|
10 | class ED4_remap; |
---|
11 | |
---|
12 | class ED4_Edit_String { |
---|
13 | GBDATA *gbd; |
---|
14 | char *seq; |
---|
15 | long seq_len; |
---|
16 | ED4_remap *remap; |
---|
17 | static int nrepeat; |
---|
18 | static int nrepeat_is_already_set; |
---|
19 | static int nrepeat_zero_requested; |
---|
20 | |
---|
21 | int legal_curpos(long pos) const { return pos>=0 && pos<=seq_len; } |
---|
22 | int legal_seqpos(long pos) const { return pos>=0 && pos<seq_len; } |
---|
23 | |
---|
24 | ED4_ERROR *moveBase(long source_position, long dest_position, unsigned char gap_to_use); // moves a base from source_position to dest_position |
---|
25 | |
---|
26 | ED4_ERROR *shiftBases(long source_pos, long source_endpos, long dest_position, |
---|
27 | int direction, long *dest_endpos, unsigned char gap_to_use); // shifts a line of bases from source_position to dest_position |
---|
28 | |
---|
29 | long get_next_base(long seq_position, int direction); |
---|
30 | long get_next_gap(long seq_position, int direction); |
---|
31 | |
---|
32 | long get_next_visible_base(long position, int direction); |
---|
33 | long get_next_visible_gap(long position, int direction); |
---|
34 | long get_next_visible_pos(long position, int direction); |
---|
35 | |
---|
36 | ED4_ERROR *insert(char *,long position, int direction, int removeAtNextGap); |
---|
37 | ED4_ERROR *remove(int len,long position, int direction, int insertAtNextGap); |
---|
38 | ED4_ERROR *replace(char *text,long position, int direction); |
---|
39 | ED4_ERROR *swap_gaps(long position, char ch); |
---|
40 | ED4_ERROR *command( AW_key_mod keymod, AW_key_code keycode, char key, int direction, ED4_EDITMODI mode, bool is_consensus, |
---|
41 | long &cursorpos, bool& changed_flag, ED4_CursorJumpType& cursor_jump, bool& cannot_handle, bool& write_fault, GBDATA *gb_data, bool is_sequence); |
---|
42 | unsigned char get_gap_type(long pos, int direction); |
---|
43 | |
---|
44 | public: |
---|
45 | char *old_seq; |
---|
46 | long old_seq_len; |
---|
47 | |
---|
48 | ED4_Edit_String(); |
---|
49 | void init_edit(); |
---|
50 | void edit(ED4_work_info *info); |
---|
51 | void finish_edit(); |
---|
52 | ~ED4_Edit_String(); |
---|
53 | |
---|
54 | int use_nrepeat() { // external functions use this to get and use nrepeat |
---|
55 | int nrep = nrepeat==0 ? 1 : nrepeat; |
---|
56 | nrepeat = 0; |
---|
57 | return nrep; |
---|
58 | } |
---|
59 | }; |
---|
60 | |
---|