|
|
1.1 ! root 1: #import "change.h" ! 2: ! 3: @implementation MultipleChange ! 4: ! 5: - init ! 6: { ! 7: [super init]; ! 8: lastChange = nil; ! 9: changes = [[List alloc] init]; ! 10: name = NULL; ! 11: ! 12: return self; ! 13: } ! 14: ! 15: - initChangeName:(const char *)changeName ! 16: { ! 17: [self init]; ! 18: name = changeName; ! 19: return self; ! 20: } ! 21: ! 22: - free ! 23: { ! 24: [[changes freeObjects] free]; ! 25: return [super free]; ! 26: } ! 27: ! 28: - (const char *)changeName ! 29: { ! 30: if (name != NULL) ! 31: return name; ! 32: ! 33: if (lastChange != nil) ! 34: return [lastChange changeName]; ! 35: ! 36: return(""); ! 37: } ! 38: ! 39: - undoChange ! 40: { ! 41: int i; ! 42: ! 43: for (i = [changes count] - 1; i >= 0; i--) { ! 44: [[changes objectAt:i] undoChange]; ! 45: } ! 46: ! 47: return [super undoChange]; ! 48: } ! 49: ! 50: - redoChange ! 51: { ! 52: int i, count; ! 53: ! 54: count = [changes count]; ! 55: for (i = 0; i < count; i++) { ! 56: [[changes objectAt:i] redoChange]; ! 57: } ! 58: ! 59: return [super redoChange]; ! 60: } ! 61: ! 62: - (BOOL)subsumeChange:change ! 63: { ! 64: if (lastChange != nil) { ! 65: return [lastChange subsumeChange:change]; ! 66: } else { ! 67: return NO; ! 68: } ! 69: } ! 70: ! 71: - (BOOL)incorporateChange:change ! 72: { ! 73: if (lastChange != nil && [lastChange incorporateChange:change]) { ! 74: return YES; ! 75: } ! 76: ! 77: [changes addObject:change]; ! 78: lastChange = change; ! 79: return YES; ! 80: } ! 81: ! 82: - finishChange ! 83: { ! 84: if (lastChange != nil) { ! 85: [lastChange finishChange]; ! 86: } ! 87: ! 88: return self; ! 89: } ! 90: ! 91: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.