Exemplo n.º 1
0
 public void shift_vertical_move(int p)
 {
     if (canvas.selects.visible) canvas.selects.visible = false;
     if (to == null) to = new Target(from);
     to.move_vertical(p);
 }
Exemplo n.º 2
0
 public void shift_click(Point p)
 {
     if (to == null) to = new Target(from);
     to.click(p.X, p.Y);
 }
Exemplo n.º 3
0
 public Text(Text_page canvas)
 {
     this.canvas = canvas;
     start = new Word(this);
     from = new Target(0, this); to = null;
 }
Exemplo n.º 4
0
 public String delete(Target to)
 {
     String ret = "";
     Target start, end;
     if (word == to.word) {
         if (pos == to.pos) return "";
         else if (pos < to.pos) {
             ret += word.Str.Substring(pos, to.pos - pos);
             word.Str = word.Str.Remove(pos, to.pos - pos);
         }
         else {
             ret += word.Str.Substring(to.pos, pos - to.pos);
             word.Str = word.Str.Remove(to.pos, pos - to.pos);
             pos = to.pos;
         }
         if (word.Str.Length == 0) {
             word.remove();
             word = word.before;
             pos = word.length;
         }
         goto finish;
     }
     else if (word.order < to.word.order) {
         start = this; end = to;
     }
     else {
         start = to; end = this;
     }
     ret += start.word.Str.Substring(start.pos);
     start.word.Str = start.word.Str.Substring(0, start.pos);
     if (start.word.Str.Length == 0) {
         start.word.remove();
         if (start == this) {
             word = word.before;
             pos = word.length;
         }
     }
     for (Word now = start.word.next; ; ) {
         if (now == end.word) {
             ret += now.Str.Substring(0, end.pos);
             end.word.Str = now.Str.Substring(end.pos, now.length - end.pos);
             if (now.Str.Length == 0) {
                 if (end == this) {
                     word = now.next;
                     pos = 0;
                 }
                 now.remove();
             }
             else if (end == this) pos = 0;
             break;
         }
         ret += now.Str;
         now.remove();
         now = now.next;
     }
     finish:
     if (word.kind == Kind_word.Letter || word.kind == Kind_word.Space || word.kind == Kind_word.MultiByte) {
         if (pos == 0 && word.kind == word.before.kind) {
             word = word.before;
             pos = word.length;
             word.Str += word.next.Str;
             word.next.remove();
         }
         else if (pos == word.length && word.kind == word.next.kind) {
             word.Str += word.next.Str;
             word.next.remove();
         }
     }
     return ret;
 }
Exemplo n.º 5
0
 public Target(Target origin)
 {
     word = origin.word;
     pos = origin.pos;
     text = origin.text;
     compile = origin.compile;
 }
Exemplo n.º 6
0
 public void set_word(Text text, String input)
 {
     if (selected == false) return;
     Word start, end;
     start = end = text.from.word;
     if (Word.In_call(start))
     {
         for (; ; start = start.before) {
             if (Word.In_call(start.before) == false) break;
         }
         for (; ; end = end.next)
         {
             if (Word.In_call(end.next) == false) break;
         }
         text.from.word = start; text.from.pos = 0;
         Target to = new Target(text.from); to.word = end; to.pos = to.word.length;
         text.from.delete(to);
     }
     text.from.input(input, false);
 }