diff --git a/ChangeLog b/ChangeLog index ce5bb8e1f..c747e94c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2013-10-15 Eric Wasylishen + + * Source/NSTabView.m (-initWithCoder:): Make non-keyed archives + call -selectTabViewItem: to select the current tab at unarchiving + time (keyed archives were already doing this.) + + Comment: "N.B.: As a side effect, this discards the subview frame + and sets it to [self contentRect]. + + This is desirable because the subview frame will be different + depending on whether the arcive is from Cocoa or GNUstep, + and which GNUstep theme was active at save time. + + However, it does mean that the tab view contents should be + prepared to resize slightly." + + The immediate need for this is tab views were changed to use + flipped coordinates, so the subview frames stored in existing + archives are now in the wrong coordinate system. + + This is essentially the same idea as NSScrollView calling -tile at the + end of -initWithCoder: so I hope it makes sense for tab views too. + 2013-10-14 Eric Wasylishen * Source/GSThemeDrawing.m (-tabHeightForType:): Check for nil diff --git a/Source/NSTabView.m b/Source/NSTabView.m index ced578387..2fd1df61b 100644 --- a/Source/NSTabView.m +++ b/Source/NSTabView.m @@ -605,6 +605,15 @@ } if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"]) { + // N.B.: As a side effect, this discards the subview frame + // and sets it to [self contentRect]. + // + // This is desirable because the subview frame will be different + // depending on whether the arcive is from Cocoa or GNUstep, + // and which GNUstep theme was active at save time. + // + // However, it does mean that the tab view contents should be + // prepared to resize slightly. [self selectTabViewItem: [aDecoder decodeObjectForKey: @"NSSelectedTabViewItem"]]; } @@ -660,9 +669,9 @@ { [aDecoder decodeValueOfObjCType: @encode(NSUInteger) at: &selected_item]; } - - if (selected_item != NSNotFound) - _selected = [_items objectAtIndex: selected_item]; + + // N.B. Recalculates subview frame; see comment above. + [self selectTabViewItemAtIndex: selected_item]; } return self; }