|
|
1.1 root 1: #import "textundo.h"
2:
3: @implementation CutSelection
4:
5: /*
6: * The CutSelection class works like a normal TextSelection except that
7: * we maintain seperate variables for the visible start and end of the
8: * selection. This is handy when you want to save a block of characters,
9: * but when you install: the selection, you want the insertion point at
10: * the end. Use this class when the characters to be saved don't correspond
11: * directly to the characters to be shown in the selection.
12: */
13:
14: - initText:aView start:(int)aPos end:(int)anotherPos
15: {
16: [super initText:aView start:aPos end:anotherPos];
17: visibleStart = start;
18: visibleEnd = end;
19:
20: return self;
21: }
22:
23: - install
24: {
25: [super install];
26: [text setSel:visibleStart :visibleEnd];
27:
28: return self;
29: }
30:
31: - (int)visibleLength
32: {
33: return (visibleEnd - visibleStart);
34: }
35:
36: - setVisible:(int)vStart :(int)vEnd
37: {
38: visibleStart = vStart;
39: visibleEnd = vEnd;
40:
41: return self;
42: }
43:
44: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.