Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mdeh

macrumors 6502
Original poster
Jan 3, 2009
345
2
Hi All,
I think this is an easy issue...for those with more knowledge than I :)

I am puzzled about one of the setters of an NSArray (_graphics) in the document.m file. It clearly assigns any objects that were unarchived ( as the setter is called by:
Code:
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError {

....set up stuff.......
 [self setGraphics:graphics];
;

Which calls:

Code:
- (void)setGraphics:(NSArray *)graphics {
    unsigned i = [_graphics count];
    while (i-- > 0) {
        [self removeGraphicAtIndex:i];
    }
    i = [graphics count];
    while (i-- > 0) {
        [self insertGraphic:[graphics objectAtIndex:i] atIndex:0];
    }
}

which calls

Code:
- (void)insertGraphic:(SKTGraphic *)graphic atIndex:(unsigned)index {
    [[[self undoManager] prepareWithInvocationTarget:self] removeGraphicAtIndex:index];
    [_graphics insertObject:graphic atIndex:index];
    [graphic setDocument:self];
    [self invalidateGraphic:graphic];

and the part that I do not get

Code:
- (void)invalidateGraphic:(SKTGraphic *)graphic {
    NSArray *windowControllers = [self windowControllers];

    [windowControllers makeObjectsPerformSelector:@selector(invalidateGraphic:) withObject:graphic];
}


I see the general gist, but am lost in the details of the point of the "invalidiateGraphic" call and exactly what it does. If anyone sees the issue, I would gladly like to hear your point of view.
Thanks kindly in advance
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.