mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 21:00:47 +00:00
Additional keyed archiving implementation.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23026 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ae5adeab36
commit
d567eebe96
11 changed files with 429 additions and 170 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
||||||
|
2006-06-04 01:09 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/GSHbox.m: Implemented keyed coding.
|
||||||
|
* Source/GSNibCompatibility.m: Added private method to help
|
||||||
|
better decode keys/values in the nib data structures.
|
||||||
|
* Source/GSTable.m: Implemented keyed coding.
|
||||||
|
* Source/GSTextStorage.m: Added code to skip existing
|
||||||
|
coding method contents, if the coder is a keyed coder.
|
||||||
|
* Source/GSVbox.m: Implemented keyed coding.
|
||||||
|
* Source/NSMenuView.m: Added code to skip coding, if
|
||||||
|
it is a keyed coder.
|
||||||
|
* Source/NSPanel.m: Added comment indicating that the
|
||||||
|
call to the superclass initWithCoder method should throw
|
||||||
|
an exception per documentation.
|
||||||
|
* Source/NSPrinter.m: Added if to skip the coder logic,
|
||||||
|
if using a keyed coder.
|
||||||
|
* Source/NSStepper.m: Removed dummy initWithCoder:/encodeWithCoder:
|
||||||
|
methods since they only called the superclass.
|
||||||
|
* Source/NSWindow.m: Added exception called for in the
|
||||||
|
documentation if NSWindow initWithCoder:/encodeWithCoder:
|
||||||
|
is called with a keyed archiver.
|
||||||
|
|
||||||
2006-06-03 Fred Kiefer <FredKiefer@gmx.de>
|
2006-06-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSPrinter.m (-interpretQuotedValue:, -gethex:): Better
|
* Source/NSPrinter.m (-interpretQuotedValue:, -gethex:): Better
|
||||||
|
|
|
@ -160,15 +160,31 @@ enablingXResizing: (BOOL)aFlag
|
||||||
-(void) encodeWithCoder: (NSCoder*)aCoder
|
-(void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_defaultMinXMargin];
|
{
|
||||||
|
[aCoder encodeBool: _haveViews forKey: @"GSHaveViews"];
|
||||||
|
[aCoder encodeFloat: _defaultMinXMargin forKey: @"GSDefaultMinXMargin"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_defaultMinXMargin];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id) initWithCoder: (NSCoder*)aDecoder
|
-(id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
if([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_defaultMinXMargin];
|
{
|
||||||
|
_haveViews = [aDecoder decodeBoolForKey: @"GSHaveViews"];
|
||||||
|
_defaultMinXMargin = [aDecoder decodeFloatForKey: @"GSDefaultMinXMargin"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_defaultMinXMargin];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -820,6 +820,14 @@
|
||||||
[coder encodeObject: (id)originalClassName forKey: @"NSOriginalClassName"];
|
[coder encodeObject: (id)originalClassName forKey: @"NSOriginalClassName"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
RELEASE(_className);
|
||||||
|
RELEASE(_originalClassName);
|
||||||
|
RELEASE(_template);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* Correct some instances where the ":" is missing from the method name in the label */
|
/* Correct some instances where the ":" is missing from the method name in the label */
|
||||||
|
@ -944,20 +952,36 @@
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the values from the map in the same order as the keys.
|
||||||
|
*/
|
||||||
|
- (NSArray *) _valuesForKeys: (NSArray *)keys inMap: (NSMapTable *)map
|
||||||
|
{
|
||||||
|
NSMutableArray *result = [NSMutableArray array];
|
||||||
|
NSEnumerator *en = [keys objectEnumerator];
|
||||||
|
id key = nil;
|
||||||
|
while((key = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
id value = (id)NSMapGet(map,key);
|
||||||
|
[result addObject: value];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder *)coder
|
- (void) encodeWithCoder: (NSCoder *)coder
|
||||||
{
|
{
|
||||||
if([coder allowsKeyedCoding])
|
if([coder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
NSArray *accessibilityOidsKeys = (NSArray *)NSAllMapTableKeys(_accessibilityOids);
|
NSArray *accessibilityOidsKeys = (NSArray *)NSAllMapTableKeys(_accessibilityOids);
|
||||||
NSArray *accessibilityOidsValues = (NSArray *)NSAllMapTableValues(_accessibilityOids);
|
NSArray *accessibilityOidsValues = [self _valuesForKeys: accessibilityOidsKeys inMap: _accessibilityOids];
|
||||||
NSArray *classKeys = (NSArray *)NSAllMapTableKeys(_classes);
|
NSArray *classKeys = (NSArray *)NSAllMapTableKeys(_classes);
|
||||||
NSArray *classValues = (NSArray *)NSAllMapTableValues(_classes);
|
NSArray *classValues = [self _valuesForKeys: classKeys inMap: _classes];
|
||||||
NSArray *nameKeys = (NSArray *)NSAllMapTableKeys(_names);
|
NSArray *nameKeys = (NSArray *)NSAllMapTableKeys(_names);
|
||||||
NSArray *nameValues = (NSArray *)NSAllMapTableValues(_names);
|
NSArray *nameValues = [self _valuesForKeys: nameKeys inMap: _names];
|
||||||
NSArray *objectsKeys = (NSArray *)NSAllMapTableKeys(_objects);
|
NSArray *objectsKeys = (NSArray *)NSAllMapTableKeys(_objects);
|
||||||
NSArray *objectsValues = (NSArray *)NSAllMapTableValues(_objects);
|
NSArray *objectsValues = [self _valuesForKeys: objectsKeys inMap: _objects];
|
||||||
NSArray *oidsKeys = (NSArray *)NSAllMapTableKeys(_oids);
|
NSArray *oidsKeys = (NSArray *)NSAllMapTableKeys(_oids);
|
||||||
NSArray *oidsValues = (NSArray *)NSAllMapTableValues(_oids);
|
NSArray *oidsValues = [self _valuesForKeys: oidsKeys inMap: _oids];
|
||||||
|
|
||||||
[coder encodeObject: (id)_accessibilityConnectors forKey: @"NSAccessibilityConnectors"];
|
[coder encodeObject: (id)_accessibilityConnectors forKey: @"NSAccessibilityConnectors"];
|
||||||
[coder encodeObject: (id) accessibilityOidsKeys forKey: @"NSAccessibilityOidsKeys"];
|
[coder encodeObject: (id) accessibilityOidsKeys forKey: @"NSAccessibilityOidsKeys"];
|
||||||
|
|
320
Source/GSTable.m
320
Source/GSTable.m
|
@ -722,118 +722,248 @@
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
|
||||||
for (i = 0; i < _numberOfRows * _numberOfColumns; i++)
|
|
||||||
{
|
{
|
||||||
[aCoder encodeObject: _jails[i]];
|
[aCoder encodeInt: _numberOfRows forKey: @"GSNumberOfRows"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_havePrisoner[i]];
|
[aCoder encodeInt: _numberOfColumns forKey: @"GSNumberOfColumns"];
|
||||||
|
for (i = 0; i < _numberOfRows * _numberOfColumns; i++)
|
||||||
|
{
|
||||||
|
[aCoder encodeObject: _jails[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSJail%d",i]];
|
||||||
|
[aCoder encodeBool: _havePrisoner[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSHavePrisoner%d",i]];
|
||||||
|
}
|
||||||
|
[aCoder encodeFloat: _minXBorder forKey: @"GSMinXBorder"];
|
||||||
|
[aCoder encodeFloat: _maxXBorder forKey: @"GSMaxXBorder"];
|
||||||
|
[aCoder encodeFloat: _minYBorder forKey: @"GSMinYBorder"];
|
||||||
|
[aCoder encodeFloat: _maxYBorder forKey: @"GSMaxYBorder"];
|
||||||
|
for (i = 0; i < _numberOfColumns; i++)
|
||||||
|
{
|
||||||
|
[aCoder encodeBool: _expandColumn[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSExpandColumn%d",i]];
|
||||||
|
[aCoder encodeFloat: _columnDimension[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSColumnDimension%d",i]];
|
||||||
|
[aCoder encodeFloat: _minColumnDimension[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSMinColumnDimension%d",i]];
|
||||||
|
}
|
||||||
|
for (i = 0; i < _numberOfRows; i++)
|
||||||
|
{
|
||||||
|
[aCoder encodeBool: _expandRow[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSExpandRow%d",i]];
|
||||||
|
[aCoder encodeFloat: _rowDimension[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSRowDimension%d",i]];
|
||||||
|
[aCoder encodeFloat: _minRowDimension[i] forKey:
|
||||||
|
[NSString stringWithFormat: @"GSMinRowDimension%d",i]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_minXBorder];
|
else
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_maxXBorder];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_minYBorder];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_maxYBorder];
|
|
||||||
for (i = 0; i < _numberOfColumns; i++)
|
|
||||||
{
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_expandColumn[i]];
|
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_columnDimension[i]];
|
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
||||||
[aCoder encodeValueOfObjCType: @encode(float)
|
for (i = 0; i < _numberOfRows * _numberOfColumns; i++)
|
||||||
at: &_minColumnDimension[i]];
|
{
|
||||||
}
|
[aCoder encodeObject: _jails[i]];
|
||||||
for (i = 0; i < _numberOfRows; i++)
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_havePrisoner[i]];
|
||||||
{
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_expandRow[i]];
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_minXBorder];
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_rowDimension[i]];
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_maxXBorder];
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_minRowDimension[i]];
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_minYBorder];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_maxYBorder];
|
||||||
|
for (i = 0; i < _numberOfColumns; i++)
|
||||||
|
{
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_expandColumn[i]];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_columnDimension[i]];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float)
|
||||||
|
at: &_minColumnDimension[i]];
|
||||||
|
}
|
||||||
|
for (i = 0; i < _numberOfRows; i++)
|
||||||
|
{
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_expandRow[i]];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_rowDimension[i]];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_minRowDimension[i]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id) initWithCoder: (NSCoder*)aDecoder
|
-(id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
[super setAutoresizesSubviews: NO];
|
[super setAutoresizesSubviews: NO];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
if([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
|
||||||
|
|
||||||
//
|
|
||||||
_jails = NSZoneMalloc (NSDefaultMallocZone (),
|
|
||||||
sizeof (NSView *)
|
|
||||||
* (_numberOfRows * _numberOfColumns));
|
|
||||||
|
|
||||||
_havePrisoner = NSZoneMalloc (NSDefaultMallocZone (),
|
|
||||||
sizeof (BOOL)
|
|
||||||
* (_numberOfRows * _numberOfColumns));
|
|
||||||
|
|
||||||
for (i = 0; i < _numberOfRows * _numberOfColumns; i++)
|
|
||||||
{
|
{
|
||||||
_jails[i] = [aDecoder decodeObject];
|
_numberOfRows = [aDecoder decodeIntForKey: @"GSNumberOfRows"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_havePrisoner[i]];
|
_numberOfColumns = [aDecoder decodeIntForKey: @"GSNumberOfColumns"];
|
||||||
}
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minXBorder];
|
// create the jails...
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_maxXBorder];
|
_jails = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minYBorder];
|
sizeof (NSView *)
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_maxYBorder];
|
* (_numberOfRows * _numberOfColumns));
|
||||||
|
|
||||||
|
_havePrisoner = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (BOOL)
|
||||||
|
* (_numberOfRows * _numberOfColumns));
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < _numberOfRows * _numberOfColumns; i++)
|
||||||
|
{
|
||||||
|
_jails[i] = [aDecoder decodeObjectForKey:
|
||||||
|
[NSString stringWithFormat: @"GSJail%d",i]];
|
||||||
|
_havePrisoner[i] = [aDecoder decodeBoolForKey:
|
||||||
|
[NSString stringWithFormat: @"GSHavePrisoner%d",i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
_minXBorder = [aDecoder decodeFloatForKey: @"GSMinXBorder"];
|
||||||
|
_maxXBorder = [aDecoder decodeFloatForKey: @"GSMaxXBorder"];
|
||||||
|
_minYBorder = [aDecoder decodeFloatForKey: @"GSMinYBorder"];
|
||||||
|
_maxYBorder = [aDecoder decodeFloatForKey: @"GSMaxYBorder"];
|
||||||
|
|
||||||
// We compute _minimumSize, _expandingRowNumber
|
// We compute _minimumSize, _expandingRowNumber
|
||||||
// and _expandingColumnNumber during deconding.
|
// and _expandingColumnNumber during deconding.
|
||||||
_minimumSize = NSZeroSize;
|
_minimumSize = NSZeroSize;
|
||||||
_expandingRowNumber = 0;
|
_expandingRowNumber = 0;
|
||||||
_expandingColumnNumber = 0;
|
_expandingColumnNumber = 0;
|
||||||
|
|
||||||
// Columns
|
// Columns
|
||||||
_expandColumn = NSZoneMalloc (NSDefaultMallocZone (),
|
_expandColumn = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
sizeof (BOOL) * _numberOfColumns);
|
sizeof (BOOL) * _numberOfColumns);
|
||||||
_columnDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
_columnDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
sizeof (float) * _numberOfColumns);
|
sizeof (float) * _numberOfColumns);
|
||||||
_minColumnDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
_minColumnDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
sizeof (float) * _numberOfColumns);
|
sizeof (float) * _numberOfColumns);
|
||||||
_minimumSize.width += _minXBorder;
|
_minimumSize.width += _minXBorder;
|
||||||
for (i = 0; i < _numberOfColumns; i++)
|
for (i = 0; i < _numberOfColumns; i++)
|
||||||
{
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_expandColumn[i]];
|
_expandColumn[i] = [aDecoder decodeBoolForKey:
|
||||||
if (_expandColumn[i])
|
[NSString stringWithFormat: @"GSExpandColumn%d",i]];
|
||||||
_expandingColumnNumber++;
|
if (_expandColumn[i])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_columnDimension[i]];
|
_expandingColumnNumber++;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float)
|
_columnDimension[i] = [aDecoder decodeFloatForKey:
|
||||||
at: &_minColumnDimension[i]];
|
[NSString stringWithFormat: @"GSColumnDimension%d",i]];
|
||||||
_minimumSize.width += _minColumnDimension[i];
|
_minColumnDimension[i] = [aDecoder decodeFloatForKey:
|
||||||
}
|
[NSString stringWithFormat: @"GSMinColumnDimension%d",i]];
|
||||||
_minimumSize.width += _maxXBorder;
|
_minimumSize.width += _minColumnDimension[i];
|
||||||
// Calculate column origins
|
}
|
||||||
_columnXOrigin = NSZoneMalloc (NSDefaultMallocZone (),
|
_minimumSize.width += _maxXBorder;
|
||||||
sizeof (float) * _numberOfColumns);
|
// Calculate column origins
|
||||||
_columnXOrigin[0] = _minXBorder;
|
_columnXOrigin = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
for (i = 1; i < _numberOfColumns; i++)
|
sizeof (float) * _numberOfColumns);
|
||||||
_columnXOrigin[i] = _columnXOrigin[i - 1] + _columnDimension[i - 1];
|
_columnXOrigin[0] = _minXBorder;
|
||||||
|
for (i = 1; i < _numberOfColumns; i++)
|
||||||
// Rows
|
_columnXOrigin[i] = _columnXOrigin[i - 1] + _columnDimension[i - 1];
|
||||||
_expandRow = NSZoneMalloc (NSDefaultMallocZone (),
|
|
||||||
sizeof (BOOL) * _numberOfRows);
|
// Rows
|
||||||
_rowDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
_expandRow = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
sizeof (float) * _numberOfRows);
|
sizeof (BOOL) * _numberOfRows);
|
||||||
_minRowDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
_rowDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfRows);
|
||||||
|
_minRowDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfRows);
|
||||||
|
_minimumSize.height += _minYBorder;
|
||||||
|
for (i = 0; i < _numberOfRows; i++)
|
||||||
|
{
|
||||||
|
_expandRow[i] = [aDecoder decodeBoolForKey:
|
||||||
|
[NSString stringWithFormat: @"GSExpandRow%d",i]];
|
||||||
|
if (_expandRow[i])
|
||||||
|
_expandingRowNumber++;
|
||||||
|
_rowDimension[i] = [aDecoder decodeFloatForKey:
|
||||||
|
[NSString stringWithFormat: @"GSRowDimension%d",i]];
|
||||||
|
_minRowDimension[i] = [aDecoder decodeFloatForKey:
|
||||||
|
[NSString stringWithFormat: @"GSMinRowDimension%d",i]];
|
||||||
|
_minimumSize.height += _minRowDimension[i];
|
||||||
|
}
|
||||||
|
_minimumSize.height += _maxYBorder;
|
||||||
|
// Calculate row origins
|
||||||
|
_rowYOrigin = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
sizeof (float) * _numberOfRows);
|
sizeof (float) * _numberOfRows);
|
||||||
_minimumSize.height += _minYBorder;
|
_rowYOrigin[0] = _minYBorder;
|
||||||
for (i = 0; i < _numberOfRows; i++)
|
for (i = 1; i < _numberOfRows; i++)
|
||||||
{
|
_rowYOrigin[i] = _rowYOrigin[i - 1] + _rowDimension[i - 1];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_expandRow[i]];
|
}
|
||||||
if (_expandRow[i])
|
else
|
||||||
_expandingRowNumber++;
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_rowDimension[i]];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minRowDimension[i]];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
||||||
_minimumSize.height += _minRowDimension[i];
|
|
||||||
|
//
|
||||||
|
_jails = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (NSView *)
|
||||||
|
* (_numberOfRows * _numberOfColumns));
|
||||||
|
|
||||||
|
_havePrisoner = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (BOOL)
|
||||||
|
* (_numberOfRows * _numberOfColumns));
|
||||||
|
|
||||||
|
for (i = 0; i < _numberOfRows * _numberOfColumns; i++)
|
||||||
|
{
|
||||||
|
_jails[i] = [aDecoder decodeObject];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_havePrisoner[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minXBorder];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_maxXBorder];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minYBorder];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_maxYBorder];
|
||||||
|
|
||||||
|
// We compute _minimumSize, _expandingRowNumber
|
||||||
|
// and _expandingColumnNumber during deconding.
|
||||||
|
_minimumSize = NSZeroSize;
|
||||||
|
_expandingRowNumber = 0;
|
||||||
|
_expandingColumnNumber = 0;
|
||||||
|
|
||||||
|
// Columns
|
||||||
|
_expandColumn = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (BOOL) * _numberOfColumns);
|
||||||
|
_columnDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfColumns);
|
||||||
|
_minColumnDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfColumns);
|
||||||
|
_minimumSize.width += _minXBorder;
|
||||||
|
for (i = 0; i < _numberOfColumns; i++)
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_expandColumn[i]];
|
||||||
|
if (_expandColumn[i])
|
||||||
|
_expandingColumnNumber++;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_columnDimension[i]];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float)
|
||||||
|
at: &_minColumnDimension[i]];
|
||||||
|
_minimumSize.width += _minColumnDimension[i];
|
||||||
|
}
|
||||||
|
_minimumSize.width += _maxXBorder;
|
||||||
|
// Calculate column origins
|
||||||
|
_columnXOrigin = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfColumns);
|
||||||
|
_columnXOrigin[0] = _minXBorder;
|
||||||
|
for (i = 1; i < _numberOfColumns; i++)
|
||||||
|
_columnXOrigin[i] = _columnXOrigin[i - 1] + _columnDimension[i - 1];
|
||||||
|
|
||||||
|
// Rows
|
||||||
|
_expandRow = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (BOOL) * _numberOfRows);
|
||||||
|
_rowDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfRows);
|
||||||
|
_minRowDimension = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfRows);
|
||||||
|
_minimumSize.height += _minYBorder;
|
||||||
|
for (i = 0; i < _numberOfRows; i++)
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_expandRow[i]];
|
||||||
|
if (_expandRow[i])
|
||||||
|
_expandingRowNumber++;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_rowDimension[i]];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minRowDimension[i]];
|
||||||
|
_minimumSize.height += _minRowDimension[i];
|
||||||
|
}
|
||||||
|
_minimumSize.height += _maxYBorder;
|
||||||
|
// Calculate row origins
|
||||||
|
_rowYOrigin = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (float) * _numberOfRows);
|
||||||
|
_rowYOrigin[0] = _minYBorder;
|
||||||
|
for (i = 1; i < _numberOfRows; i++)
|
||||||
|
_rowYOrigin[i] = _rowYOrigin[i - 1] + _rowDimension[i - 1];
|
||||||
}
|
}
|
||||||
_minimumSize.height += _maxYBorder;
|
|
||||||
// Calculate row origins
|
|
||||||
_rowYOrigin = NSZoneMalloc (NSDefaultMallocZone (),
|
|
||||||
sizeof (float) * _numberOfRows);
|
|
||||||
_rowYOrigin[0] = _minYBorder;
|
|
||||||
for (i = 1; i < _numberOfRows; i++)
|
|
||||||
_rowYOrigin[i] = _rowYOrigin[i - 1] + _rowDimension[i - 1];
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,8 +177,11 @@ unCacheAttributes(NSDictionary *attrs)
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &loc];
|
if([aCoder allowsKeyedCoding] == NO)
|
||||||
[aCoder encodeValueOfObjCType: @encode(id) at: &attrs];
|
{
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &loc];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(id) at: &attrs];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) gcFinalize
|
- (void) gcFinalize
|
||||||
|
@ -189,11 +192,13 @@ unCacheAttributes(NSDictionary *attrs)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aCoder
|
- (id) initWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
NSDictionary *a;
|
if([aCoder allowsKeyedCoding] == NO)
|
||||||
|
{
|
||||||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &loc];
|
NSDictionary *a;
|
||||||
a = [aCoder decodeObject];
|
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &loc];
|
||||||
attrs = cacheAttributes(a);
|
a = [aCoder decodeObject];
|
||||||
|
attrs = cacheAttributes(a);
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,15 +163,31 @@ enablingYResizing: (BOOL)aFlag
|
||||||
-(void) encodeWithCoder: (NSCoder*)aCoder
|
-(void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_defaultMinYMargin];
|
{
|
||||||
|
[aCoder encodeBool: _haveViews forKey: @"GSHaveViews"];
|
||||||
|
[aCoder encodeFloat: _defaultMinYMargin forKey: @"GSDefaultMinYMargin"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_defaultMinYMargin];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id) initWithCoder: (NSCoder*)aDecoder
|
-(id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
if([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_defaultMinYMargin];
|
{
|
||||||
|
_haveViews = [aDecoder decodeBoolForKey: @"GSHaveViews"];
|
||||||
|
_defaultMinYMargin = [aDecoder decodeFloatForKey: @"GSDefaultMinYMargin"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_haveViews];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_defaultMinYMargin];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1572,31 +1572,34 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
- (void) encodeWithCoder: (NSCoder*)encoder
|
- (void) encodeWithCoder: (NSCoder*)encoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: encoder];
|
[super encodeWithCoder: encoder];
|
||||||
|
if([encoder allowsKeyedCoding] == NO)
|
||||||
[encoder encodeObject: _itemCells];
|
{
|
||||||
[encoder encodeObject: _font];
|
[encoder encodeObject: _itemCells];
|
||||||
[encoder encodeValueOfObjCType: @encode(BOOL) at: &_horizontal];
|
[encoder encodeObject: _font];
|
||||||
[encoder encodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
[encoder encodeValueOfObjCType: @encode(BOOL) at: &_horizontal];
|
||||||
[encoder encodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
[encoder encodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
||||||
|
[encoder encodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)decoder
|
- (id) initWithCoder: (NSCoder*)decoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: decoder];
|
self = [super initWithCoder: decoder];
|
||||||
|
if([decoder allowsKeyedCoding] == NO)
|
||||||
[decoder decodeValueOfObjCType: @encode(id) at: &_itemCells];
|
{
|
||||||
|
[decoder decodeValueOfObjCType: @encode(id) at: &_itemCells];
|
||||||
[_itemCells makeObjectsPerformSelector: @selector(setMenuView:)
|
|
||||||
withObject: self];
|
[_itemCells makeObjectsPerformSelector: @selector(setMenuView:)
|
||||||
|
withObject: self];
|
||||||
[decoder decodeValueOfObjCType: @encode(id) at: &_font];
|
|
||||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_horizontal];
|
[decoder decodeValueOfObjCType: @encode(id) at: &_font];
|
||||||
[decoder decodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_horizontal];
|
||||||
[decoder decodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
[decoder decodeValueOfObjCType: @encode(float) at: &_horizontalEdgePad];
|
||||||
|
[decoder decodeValueOfObjCType: @encode(NSSize) at: &_cellSize];
|
||||||
_highlightedItemIndex = -1;
|
|
||||||
_needsSizing = YES;
|
_highlightedItemIndex = -1;
|
||||||
|
_needsSizing = YES;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,12 +163,20 @@
|
||||||
BOOL flag;
|
BOOL flag;
|
||||||
|
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
flag = _becomesKeyOnlyIfNeeded;
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
{
|
||||||
flag = _isFloatingPanel;
|
// Nothing to do here, for keyed coding this is handled by NSWindowTemplate.
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
// Calling the above method should throw an NSInvalidArgumentException.
|
||||||
flag = _worksWhenModal;
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
else
|
||||||
|
{
|
||||||
|
flag = _becomesKeyOnlyIfNeeded;
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
flag = _isFloatingPanel;
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
flag = _worksWhenModal;
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -176,12 +184,20 @@
|
||||||
BOOL flag;
|
BOOL flag;
|
||||||
|
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
if([aDecoder allowsKeyedCoding])
|
||||||
[self setBecomesKeyOnlyIfNeeded: flag];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
// Nothing to do here, for keyed coding this is handled by NSWindowTemplate.
|
||||||
[self setFloatingPanel: flag];
|
// Calling the above method should throw an NSInvalidArgumentException.
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
}
|
||||||
[self setWorksWhenModal: flag];
|
else
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
[self setBecomesKeyOnlyIfNeeded: flag];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
[self setFloatingPanel: flag];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
[self setWorksWhenModal: flag];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,21 +646,34 @@ static NSMutableDictionary* printerCache;
|
||||||
//
|
//
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[aCoder encodeObject: _printerHost];
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeObject: _printerName];
|
{
|
||||||
[aCoder encodeObject: _printerNote];
|
// TODO: Determine keys for NSPrinter.
|
||||||
[aCoder encodeObject: _printerType];
|
}
|
||||||
[aCoder encodeObject: _tables];
|
else
|
||||||
|
{
|
||||||
|
[aCoder encodeObject: _printerHost];
|
||||||
|
[aCoder encodeObject: _printerName];
|
||||||
|
[aCoder encodeObject: _printerNote];
|
||||||
|
[aCoder encodeObject: _printerType];
|
||||||
|
[aCoder encodeObject: _tables];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
_printerHost = [aDecoder decodeObject];
|
if([aDecoder allowsKeyedCoding])
|
||||||
_printerName = [aDecoder decodeObject];
|
{
|
||||||
_printerNote = [aDecoder decodeObject];
|
// TODO: Determine keys for NSPrinter.
|
||||||
_printerType = [aDecoder decodeObject];
|
}
|
||||||
_tables = [aDecoder decodeObject];
|
else
|
||||||
|
{
|
||||||
|
_printerHost = [aDecoder decodeObject];
|
||||||
|
_printerName = [aDecoder decodeObject];
|
||||||
|
_printerNote = [aDecoder decodeObject];
|
||||||
|
_printerType = [aDecoder decodeObject];
|
||||||
|
_tables = [aDecoder decodeObject];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,18 +99,6 @@ id _nsstepperCellClass = nil;
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
|
||||||
{
|
|
||||||
[super encodeWithCoder: aCoder];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
|
||||||
{
|
|
||||||
[super initWithCoder: aDecoder];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (double) maxValue
|
- (double) maxValue
|
||||||
{
|
{
|
||||||
return [_cell maxValue];
|
return [_cell maxValue];
|
||||||
|
|
|
@ -4188,6 +4188,19 @@ resetCursorRectsForView(NSView *theView)
|
||||||
{
|
{
|
||||||
BOOL flag;
|
BOOL flag;
|
||||||
|
|
||||||
|
|
||||||
|
// If were're being initialized from a keyed coder...
|
||||||
|
if([aCoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
// The docs indicate that there should be an error when directly encoding with
|
||||||
|
// a keyed coding archiver. We should only encode NSWindow and subclasses
|
||||||
|
// using NSWindowTemplate.
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"%@ keyed coding not implemented for %@.",
|
||||||
|
NSStringFromClass([self class])];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
||||||
[aCoder encodeRect: [[self contentView] frame]];
|
[aCoder encodeRect: [[self contentView] frame]];
|
||||||
|
@ -4234,6 +4247,19 @@ resetCursorRectsForView(NSView *theView)
|
||||||
id oldself = self;
|
id oldself = self;
|
||||||
BOOL flag;
|
BOOL flag;
|
||||||
|
|
||||||
|
|
||||||
|
// If were're being initialized from a keyed coder...
|
||||||
|
if([aDecoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
// The docs indicate that there should be an error when directly encoding with
|
||||||
|
// a keyed coding archiver. We should only encode NSWindow and subclasses
|
||||||
|
// using NSWindowTemplate.
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"%@ keyed coding not implemented for %@.",
|
||||||
|
NSStringFromClass([self class])];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((self = [super initWithCoder: aDecoder]) == oldself)
|
if ((self = [super initWithCoder: aDecoder]) == oldself)
|
||||||
{
|
{
|
||||||
NSSize aSize;
|
NSSize aSize;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue