* 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.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37232 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-10-15 06:17:36 +00:00
parent a55c2a9189
commit fc5c32e1b3
2 changed files with 35 additions and 3 deletions

View file

@ -1,3 +1,26 @@
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
* 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 <ewasylishen@gmail.com>
* Source/GSThemeDrawing.m (-tabHeightForType:): Check for nil

View file

@ -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;
}