Annotation of Examples/AppKit/Draw/graphicsUndo.subproj/DeleteGraphicsChange.m, revision 1.1.1.1

1.1       root        1: #import "drawundo.h"
                      2: 
                      3: @interface DeleteGraphicsChange(PrivateMethods)
                      4: 
                      5: - undoDetails;
                      6: - redoDetails;
                      7: 
                      8: @end
                      9: 
                     10: @implementation DeleteGraphicsChange
                     11: 
                     12: - free
                     13: {
                     14:     if ([self hasBeenDone])
                     15:         [graphics freeObjects];
                     16:     return [super free];
                     17: }
                     18: 
                     19: - (const char *)changeName
                     20: {
                     21:     return DELETE_OPERATION;
                     22: }
                     23: 
                     24: - saveBeforeChange
                     25: {
                     26:     [super saveBeforeChange];
                     27:     [changeDetails makeObjectsPerform:@selector(recordGraphicPositionIn:) with:[graphicView graphics]];
                     28: 
                     29:     return self;
                     30: }
                     31: 
                     32: - undoDetails
                     33: {
                     34:     int count, i;
                     35:     id detail, graphic;
                     36:     List *allGraphics;
                     37: 
                     38:     count = [changeDetails count];
                     39:     allGraphics = [graphicView graphics];
                     40:     for (i = 0; i < count; i++) {
                     41:        detail = [changeDetails objectAt:i];
                     42:        graphic = [detail graphic];
                     43:         [allGraphics insertObject:graphic at:[detail graphicPosition]];
                     44:        [graphic wasAddedTo:graphicView];
                     45:     }
                     46:     [graphicView getSelection];
                     47:        
                     48:     return self;
                     49: }
                     50: 
                     51: - redoDetails
                     52: {
                     53:     int count, i;
                     54:     id detail, graphic;
                     55:     List *selectedGraphics;
                     56:     List *allGraphics;
                     57: 
                     58:     selectedGraphics = [graphicView selectedGraphics];
                     59:     allGraphics = [graphicView graphics];
                     60:     count = [changeDetails count];
                     61:     for (i = 0; i < count; i++) {
                     62:        detail = [changeDetails objectAt:i];
                     63:        graphic = [detail graphic];
                     64:         [selectedGraphics removeObject:graphic];
                     65:         [allGraphics removeObject:graphic];
                     66:        [graphic wasRemovedFrom:graphicView];
                     67:     }
                     68:     [graphicView resetGroupInSlist];
                     69: 
                     70:     return self;
                     71: }
                     72: 
                     73: - changeDetailClass
                     74: {
                     75:     return [OrderChangeDetail class];
                     76: }
                     77: 
                     78: @end

unix.superglobalmegacorp.com

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