source: tags/arb_5.3/ARBDBPP/adtsequence.cxx

Last change on this file was 5968, checked in by westram, 15 years ago
  • new flag -w to aisc_mkpt (add include wrapper)
  • uniform style for several include wrappers
  • removed duplicated includes
  • removed useless nt_concatenate.hxx
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1#include <memory.h>
2#include <string.h>
3#include <stdio.h>
4
5#include <arbdb.h>
6#include "adtools.hxx"
7
8ADT_SEQUENCE::ADT_SEQUENCE() {
9    memset(this,0,sizeof(ADT_SEQUENCE));
10    adt_ali = 0;
11}
12
13ADT_SEQUENCE::~ADT_SEQUENCE() {
14    //      if (showsequence) delete showsequence;
15}
16
17
18void ADT_SEQUENCE::init(ADT_ALI *adtali,AD_CONT * adcont) {
19    adt_ali =  adtali;
20    AD_SEQ::init(adcont);
21    show_timestamp = timestamp;
22
23}
24
25char *ADT_SEQUENCE::show_get() {
26    if (adt_ali != 0) {
27        if ((seq == 0) || (show_timestamp < timestamp)  ) {
28            ADT_SEQUENCE::show_update();
29        }
30        return seq;
31    }
32    new AD_ERR("ADT_SEQUENCE::show_get() class not inited ?",CORE);
33    return 0;
34}
35
36void ADT_SEQUENCE::show_update() {
37    ;
38}
39
40int ADT_SEQUENCE::show_len() {
41    return seq_len;
42}
43
44AD_ERR * ADT_SEQUENCE::show_put() {
45    AD_ERR * error = 0;
46    error = put();
47    if (error != 0) {
48        show_update();
49        return error;
50    }
51    show_timestamp = timestamp;
52    return  error ;
53}
54
55
56/*** EDITIERFUNKTIONEN *******/
57// show_insert
58// show_remov5// show_replace
59//
60// beeinflussen nicht seq_len und showseq_len ( -> wird von gaps beeinflusst)
61// seq_len entspricht der alignment laenge
62// das Ende wird mit punkten aufgefuellt
63//
64
65AD_ERR * ADT_SEQUENCE::show_insert(char *text,int showposition) {
66    // insert text in showsequenc und seq (AD)
67    // funktionen: gap_realpos,
68    // nur erlaubt, wenn kein gap dahinter
69    AD_ERR *ad_err;
70    int realposition = adt_ali->gap_realpos(showposition);      // bereich in der richtigen sequence
71    if (show_timestamp != timestamp) {
72        return new AD_ERR("ADT_SEQUENCE::show_insert  -- not allowed -- because timeupdate not done !");
73    }
74    if (adt_ali->gap_behind(realposition) == 1) {       // kein insert wenn luecke dahinter
75        return new AD_ERR("ADT_SEQUENCE::show_insert  -- not allowed because Gap behind position");
76    }
77    ad_err = this->insert(text,realposition,1);                         //@@@ insert in blocks !!!
78    if (!ad_err){
79        this->show_update();
80    }
81    return ad_err;
82}
83
84
85
86AD_ERR  * ADT_SEQUENCE::show_remove(int charsToDelete, int showposition) {
87    AD_ERR *ad_err;
88    int realposition = adt_ali->gap_realpos(showposition);
89    if ((realposition < 0) || (charsToDelete<0) || (charsToDelete > seq_len) || (showposition >= seq_len)) {
90        return new AD_ERR("ADT_SEQ.remove() WARNING ! Wrong Parameters !");
91    }
92    if (adt_ali->gap_behind(realposition) == 1) {   // kein remove wenn luecke dahinter
93        return new AD_ERR("ADT_SEQUENCE::show_remove  -- not allowed because Gap behind position");
94    }
95    if (show_timestamp != timestamp) {
96        return new AD_ERR("ADT_SEQUENCE::show_remove  -- not allowed -- because timeupdate not done !");
97    }
98    ad_err = this->remove(charsToDelete,realposition,1);
99    if (!ad_err) this->show_update();
100    return ad_err;
101}
102
103
104AD_ERR * ADT_SEQUENCE::show_replace(char *text,int showposition) {
105    if (show_timestamp != timestamp) {
106        return new AD_ERR("ADT_SEQUENCE::show_replace  -- not allowed -- because timeupdate not done !");
107    }
108    AD_ERR *ad_err;
109    ad_err = this->replace(text,showposition,1);
110    if (!ad_err) this->show_update();
111    return ad_err;
112}
113
114AD_ERR *ADT_SEQUENCE::show_command( AW_key_mod keymod, AW_key_code keycode, char key, int direction, long &cursorpos, int& changeflag)
115{
116    AD_ERR *err= this->command(keymod,keycode,key,direction, cursorpos,changeflag);
117    if (changeflag) this->show_update();
118    return err;
119}
Note: See TracBrowser for help on using the repository browser.