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

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

#import "drawundo.h"

@interface UnlockGraphicsChange(PrivateMethods)

- undoDetails;

@end

@implementation UnlockGraphicsChange

- (const char *)changeName
{
    return NXLocalStringFromTable("Operations", "Unlock", NULL, "The operation of unlocking all the graphical entities which were previously locked down (see Lock).");
    return "Unlock";
}

- saveBeforeChange
{
    List *allGraphics;
    int i, count;
    id	graphic;

    graphics = [[List alloc] init];

    allGraphics = [graphicView graphics];
    count = [allGraphics count];
    for (i = 0; i < count; i++) {
        graphic = [allGraphics objectAt:i];
	if ([graphic isLocked])
	    [graphics addObject:graphic];
    }

    if ([graphics count] == 0)
        [self disable];
	
    return self;
}

- redoChange
{
    [graphics makeObjectsPerform:@selector(unlock)];
    [graphicView resetLockedFlag];

    return [super redoChange];
}

- changeDetailClass
{
    return nil;
}

- undoDetails
{
    int i, count;
    List *selectedGraphics;
    id graphic;
    
    selectedGraphics = [graphicView selectedGraphics];
    count = [graphics count];
    for (i = 0; i < count; i++) {
        graphic = [graphics objectAt:i];
	[graphic lock];
	[graphic deselect];
	[selectedGraphics removeObject:graphic];
    }
    [graphicView resetLockedFlag];

    return self;
}

@end

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