Prevent initWithCoder: from calling initWithFrame: in NSView. According to the documentation, initWithFrame: should not be called when the view is unarchiving itself. Similar changes were needed in other classes since they depended on this call to initialize themselves, so some init code was added to initWithCoder:.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23143 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2006-07-07 01:39:16 +00:00
parent 30eca5ede6
commit f6fb00fad1
6 changed files with 184 additions and 40 deletions

View file

@ -5215,6 +5215,32 @@ static inline float computePeriod(NSPoint mouseLocationWin,
NSEnumerator *e;
NSTableColumn *col;
// assign defaults, so that there's color in case none is specified
ASSIGN (_gridColor, [NSColor gridColor]);
ASSIGN (_backgroundColor, [NSColor controlBackgroundColor]);
ASSIGN (_tableColumns, [NSMutableArray array]);
ASSIGN (_selectedColumns, [NSMutableIndexSet indexSet]);
ASSIGN (_selectedRows, [NSMutableIndexSet indexSet]);
_autoresizesAllColumnsToFit = NO;
_clickedRow = -1;
_clickedColumn = -1;
_drawsGrid = YES;
_editedColumn = -1;
_editedRow = -1;
_highlightedTableColumn = nil;
_intercellSpacing = NSMakeSize (5.0, 2.0);
_rowHeight = 16.0;
_selectedColumn = -1;
_selectedRow = -1;
_selectingColumns = NO;
/*
_headerView = [NSTableHeaderView new];
[_headerView setFrameSize: NSMakeSize (_frame.size.width, 22.0)];
[_headerView setTableView: self];
*/
[(NSKeyedUnarchiver *)aDecoder setClass: [GSTableCornerView class] forClassName: @"_NSCornerView"];
if ([aDecoder containsValueForKey: @"NSDataSource"])
{
@ -5254,16 +5280,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
{
[self setRowHeight: [aDecoder decodeFloatForKey: @"NSRowHeight"]];
}
if ([aDecoder containsValueForKey: @"NSHeaderView"])
{
NSRect viewFrame = [self frame];
float rowHeight = [self rowHeight];
_headerView = [NSTableHeaderView new];
[_headerView setFrameSize: NSMakeSize(viewFrame.size.width, rowHeight)];
[_headerView setTableView: self];
}
if ([aDecoder containsValueForKey: @"NSCornerView"])
{
NSRect viewFrame;
@ -5275,6 +5292,17 @@ static inline float computePeriod(NSPoint mouseLocationWin,
[[self cornerView] setFrame: viewFrame];
}
if ([aDecoder containsValueForKey: @"NSHeaderView"])
{
NSRect viewFrame = [self frame];
float rowHeight = [self rowHeight];
_headerView = [NSTableHeaderView new];
[_headerView setFrameSize: NSMakeSize(viewFrame.size.width, rowHeight)];
[_headerView setTableView: self];
}
// get the table columns...
columns = [aDecoder decodeObjectForKey: @"NSTableColumns"];
e = [columns objectEnumerator];
@ -5305,14 +5333,6 @@ static inline float computePeriod(NSPoint mouseLocationWin,
_columnOrigins = NSZoneMalloc (NSDefaultMallocZone (),
sizeof(float) * _numberOfColumns);
_clickedRow = -1;
_clickedColumn = -1;
_selectingColumns = NO;
_selectedColumn = -1;
_selectedRow = -1;
_editedColumn = -1;
_editedRow = -1;
[self tile];
}
else