ftp.nice.ch/pub/next/science/mathematics/HippoDraw.2.0.s.tar.gz#/HippoDraw/Hippo.bproj/Draw.subproj/textUndo.subproj/CutSelection.m

This is CutSelection.m in view mode; [Download] [Up]

#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

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.