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

1.1       root        1: #import "drawundo.h"
                      2: 
                      3: @interface GroupGraphicsChange(PrivateMethods)
                      4: 
                      5: - undoDetails;
                      6: - redoDetails;
                      7: 
                      8: @end
                      9: 
                     10: @implementation GroupGraphicsChange
                     11: 
                     12: - free
                     13: {
                     14:     if (![self hasBeenDone]) {
                     15:         [[group subGraphics] empty];
                     16:         [group free];
                     17:     }
                     18:     return [super free];
                     19: }
                     20: 
                     21: - (const char *)changeName
                     22: {
                     23:     return NXLocalStringFromTable("Operations", "Group", NULL, "The operation of grouping a bunch of graphical entities together.");
                     24: }
                     25: 
                     26: - saveBeforeChange
                     27: {
                     28:     [super saveBeforeChange];
                     29:     [changeDetails makeObjectsPerform:@selector(recordGraphicPositionIn:) with:[graphicView graphics]];
                     30: 
                     31:     return self;
                     32: }
                     33: 
                     34: - changeDetailClass
                     35: {
                     36:     return [OrderChangeDetail class];
                     37: }
                     38: 
                     39: - noteGroup:aGroup
                     40: {
                     41:     group = aGroup;
                     42:     return self;
                     43: }
                     44: 
                     45: - undoDetails
                     46: {
                     47:     int count, i;
                     48:     id detail, graphic;
                     49:     List *allGraphics;
                     50: 
                     51:     allGraphics = [graphicView graphics];
                     52:     [allGraphics removeObject:group];
                     53:     count = [changeDetails count];
                     54:     for (i = 0; i < count; i++) {
                     55:        detail = [changeDetails objectAt:i];
                     56:        graphic = [detail graphic];
                     57:        [graphic setCacheable:YES];
                     58:         [allGraphics insertObject:graphic at:[detail graphicPosition]];
                     59:     }
                     60:     [graphicView getSelection];
                     61:     [graphicView resetGroupInSlist];
                     62:        
                     63:     return self;
                     64: }
                     65: 
                     66: - redoDetails
                     67: {
                     68:     int count, i;
                     69:     id detail, graphic;
                     70:     List *selectedGraphics;
                     71:     List *allGraphics;
                     72: 
                     73:     selectedGraphics = [graphicView selectedGraphics];
                     74:     allGraphics = [graphicView graphics];
                     75:     count = [changeDetails count];
                     76:     for (i = 0; i < count; i++) {
                     77:        detail = [changeDetails objectAt:i];
                     78:        graphic = [detail graphic];
                     79:        [graphic setCacheable:NO];
                     80:         [selectedGraphics removeObject:graphic];
                     81:         [allGraphics removeObject:graphic];
                     82:     }
                     83:     [allGraphics insertObject:group at:0];
                     84:     [graphicView setGroupInSlist:YES];
                     85:     [graphicView getSelection];
                     86: 
                     87: 
                     88:     return self;
                     89: }
                     90: 
                     91: @end

unix.superglobalmegacorp.com

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