File:  [NeXTSTEP 3.3 examples] / Examples / AppKit / Draw / textUndo.subproj / CutSelection.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:39 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

#import "textundo.h"

@implementation CutSelection

/*
 * The CutSelection class works like a normal TextSelection except that
 * we maintain seperate variables for the visible start and end of the
 * selection. This is handy when you want to save a block of characters,
 * but when you install: the selection, you want the insertion point at
 * the end. Use this class when the characters to be saved don't correspond
 * directly to the characters to be shown in the selection.
 */

- initText:aView start:(int)aPos end:(int)anotherPos
{
    [super initText:aView start:aPos end:anotherPos];
    visibleStart = start;
    visibleEnd = end;

    return self;
}

- install
{
    [super install];
    [text setSel:visibleStart :visibleEnd];

    return self;
}

- (int)visibleLength
{
    return (visibleEnd - visibleStart);
}

- setVisible:(int)vStart :(int)vEnd
{
    visibleStart = vStart;
    visibleEnd = vEnd;

    return self;
}

@end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.