File:  [NeXTSTEP 3.3 examples] / Examples / AppKit / Draw / textUndo.subproj / WholeTextChange.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 WholeTextChange

/*
 * This is another variant of a TextSelChange which always records the entire
 * contents of the text object. This is useful when a particular kind of
 * change isn't restricted to the current selection. Examples include ruler
 * changes for tabs and margins, and characters entered from the keyboard.
 */

- saveBeforeChange
{
    NXSelPt start, end;

    [textView getSel:&start :&end];

    oldSel = [[[CutSelection alloc] initText:textView
	                               start:0
	                                 end:[textView textLength]] capture];
    [oldSel setVisible:start.cp :end.cp];
    return self;
}

- saveAfterChange
{
    NXSelPt start, end;

    [textView getSel:&start :&end];

    newSel = [[[CutSelection alloc] initText:textView
	                               start:0
	                                 end:[textView textLength]] capture];
    [newSel setVisible:start.cp :end.cp];
    return self;
}

- setStart:(int)start end:(int)end
{
    [newSel setVisible:start :end];
    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.