Added NSPSMatrix private class, added GS specific keys to NSProgressIndicator for info that GS encodes, but Cocoa doesn't. All GS specific keys shall have GS* as the prefix. Implemented encodeWithCoder: in NSTableColumn and corrected NSTable encoding to correct problems during IB loading.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23265 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-08-12 22:44:56 +00:00
parent f2beece4f3
commit 74049ce6bc
7 changed files with 152 additions and 47 deletions

View file

@ -1,3 +1,20 @@
2006-08-12 18:37-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
NSPSMatrix placeholder class.
* Source/GSNibCompatibility.m: Added dummy implementation of
NSPSMatrix placeholder class.
* Source/NSOutlineView.m: Eliminated empty if conditional
in encodeWithCoder:.
* Source/NSProgressIndicator.m: Added code to initWithCoder:
to properly unarchive. Also implemented encodeWithCoder: and added
GNUstep specific keys for information that GNUstep uses, but IB
doesn't. All GNUstep specific keys should be prefixed with
GS*.
* Source/NSTableColumn.m: Implemented encodeWithCoder:.
* Source/NSTableView.m: Fixes in encodeWithCoder: to correct issues
during load in InterfaceBuilder.
2006-08-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (displayIfNeededInRect:): Check for
@ -16,6 +33,7 @@
trackMouse:...untilMouseUp:): Code previously in the NSSlider class.
Reworked slightly to be more similar to [NSCell trackMouse:...untilMouseUp:].
>>>>>>> .r23264
2006-08-11 01:50-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Assign copies of the parameters to

View file

@ -273,4 +273,8 @@ typedef struct _GSWindowTemplateFlags
- (int) nextOid;
@end
// class needed for nib encoding/decoding by the progress bar...
@interface NSPSMatrix : NSObject
@end
#endif /* _GNUstep_H_GSNibCompatibility */

View file

@ -1212,6 +1212,8 @@ static BOOL _isInInterfaceBuilder = NO;
NSArray *oidsKeys = (NSArray *)NSAllMapTableKeys(_oids);
NSArray *oidsValues = [self _valuesForKeys: oidsKeys inMap: _oids];
[(NSKeyedArchiver *)coder setClassName: @"_NSCornerView" forClass: NSClassFromString(@"GSTableCornerView")];
[coder encodeObject: (id)_accessibilityConnectors forKey: @"NSAccessibilityConnectors"];
[coder encodeObject: (id) accessibilityOidsKeys forKey: @"NSAccessibilityOidsKeys"];
[coder encodeObject: (id) accessibilityOidsValues forKey: @"NSAccessibilityOidsValues"];
@ -1496,3 +1498,20 @@ static BOOL _isInInterfaceBuilder = NO;
}
@end
// class needed for nib encoding/decoding by
@implementation NSPSMatrix
- (void) encodeWithCoder: (NSCoder *)coder
{
// do nothing... just encoding the presence of the class.
}
- (id) initWithCoder: (NSCoder *)coder
{
// what's NSPSMatix all about?
// NSLog(@"NSPSMatrix = %@",[(NSKeyedUnarchiver *)coder keyMap]);
return self;
}
@end

View file

@ -757,10 +757,7 @@ static NSImage *unexpandable = nil;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if ([aCoder allowsKeyedCoding])
{
}
else
if ([aCoder allowsKeyedCoding] == NO)
{
[aCoder encodeValueOfObjCType: @encode(BOOL)
at: &_autoResizesOutlineColumn];

View file

@ -28,6 +28,7 @@
#include "AppKit/NSGraphics.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSNibCompatibility.h"
@implementation NSProgressIndicator
@ -289,14 +290,44 @@ static NSColor *fillColour = nil;
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_isIndeterminate];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_isBezeled];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_usesThreadedAnimation];
[aCoder encodeValueOfObjCType: @encode(NSTimeInterval) at:&_animationDelay];
[aCoder encodeValueOfObjCType: @encode(double) at:&_doubleValue];
[aCoder encodeValueOfObjCType: @encode(double) at:&_minValue];
[aCoder encodeValueOfObjCType: @encode(double) at:&_maxValue];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
if([aCoder allowsKeyedCoding])
{
unsigned long flags = 0;
id matrix = AUTORELEASE([[NSPSMatrix alloc] init]);
[aCoder encodeDouble: _minValue forKey: @"NSMinValue"];
[aCoder encodeDouble: _maxValue forKey: @"NSMaxValue"];
[aCoder encodeObject: matrix forKey: @"NSDrawMatrix"];
// add flag values.
flags |= (_isIndeterminate)? 2 : 0;
//
// Hard coded... this value forces it to be a regular-sized,
// bar type progress indicator since this is the only type
// gnustep supports.
//
flags |= 8200;
[aCoder encodeInt: flags forKey: @"NSpiFlags"];
// things which Gorm encodes, but IB doesn't care about.
[aCoder encodeDouble: _doubleValue forKey: @"GSDoubleValue"];
[aCoder encodeBool: _isBezeled forKey: @"GSIsBezeled"];
[aCoder encodeBool: _isVertical forKey: @"GSIsVertical"];
[aCoder encodeBool: _usesThreadedAnimation forKey: @"GSUsesThreadAnimation"];
[aCoder encodeDouble: _animationDelay forKey: @"GSAnimationDelay"];
}
else
{
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_isIndeterminate];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_isBezeled];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_usesThreadedAnimation];
[aCoder encodeValueOfObjCType: @encode(NSTimeInterval) at:&_animationDelay];
[aCoder encodeValueOfObjCType: @encode(double) at:&_doubleValue];
[aCoder encodeValueOfObjCType: @encode(double) at:&_minValue];
[aCoder encodeValueOfObjCType: @encode(double) at:&_maxValue];
[aCoder encodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
}
}
- (id)initWithCoder:(NSCoder *)aDecoder
@ -304,18 +335,47 @@ static NSColor *fillColour = nil;
self = [super initWithCoder:aDecoder];
if ([aDecoder allowsKeyedCoding])
{
//id *matrix = [aDecoder decodeObjectForKey: @"NSDrawMatrix"];
// id matrix = [aDecoder decodeObjectForKey: @"NSDrawMatrix"];
if ([aDecoder containsValueForKey: @"NSMaxValue"])
{
int max = [aDecoder decodeIntForKey: @"NSMaxValue"];
int max = [aDecoder decodeDoubleForKey: @"NSMaxValue"];
[self setMaxValue: max];
}
if ([aDecoder containsValueForKey: @"NSMinValue"])
{
int min = [aDecoder decodeDoubleForKey: @"NSMinValue"];
[self setMinValue: min];
}
if ([aDecoder containsValueForKey: @"NSpiFlags"])
{
//int flags = [aDecoder decodeIntForKey: @"NSpiFlags"];
// FIXME
int flags = [aDecoder decodeIntForKey: @"NSpiFlags"];
_isIndeterminate = ((flags & 2) == 2);
// ignore the rest, since they are not pertinent to GNUstep.
}
// things which Gorm encodes, but IB doesn't care about.
if ([aDecoder containsValueForKey: @"GSDoubleValue"])
{
_doubleValue = [aDecoder decodeDoubleForKey: @"GSDoubleValue"];
}
if ([aDecoder containsValueForKey: @"GSIsBezeled"])
{
_isBezeled = [aDecoder decodeBoolForKey: @"GSIsBezeled"];
}
if ([aDecoder containsValueForKey: @"GSIsVertical"])
{
_isVertical = [aDecoder decodeBoolForKey: @"GSIsVertical"];
}
if ([aDecoder containsValueForKey: @"GSUsesThreadAnimation"])
{
_usesThreadedAnimation = [aDecoder decodeBoolForKey: @"GSUsesThreadAnimation"];
}
if ([aDecoder containsValueForKey: @"GSAnimationDelay"])
{
_animationDelay = [aDecoder decodeDoubleForKey: @"GSAnimationDelay"];
}
}
else
@ -348,3 +408,4 @@ static NSColor *fillColour = nil;
}
@end

View file

@ -370,16 +370,30 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[aCoder encodeObject: _identifier];
[aCoder encodeValueOfObjCType: @encode(float) at: &_width];
[aCoder encodeValueOfObjCType: @encode(float) at: &_min_width];
[aCoder encodeValueOfObjCType: @encode(float) at: &_max_width];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_resizable];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_editable];
[aCoder encodeObject: _headerCell];
[aCoder encodeObject: _dataCell];
if([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: _identifier forKey: @"NSIdentifier"];
[aCoder encodeObject: _dataCell forKey: @"NSDataCell"];
[aCoder encodeObject: _headerCell forKey: @"NSHeaderCell"];
[aCoder encodeBool: _is_resizable forKey: @"NSIsResizable"];
[aCoder encodeBool: _is_editable forKey: @"NSIsEditable"];
[aCoder encodeFloat: _max_width forKey: @"NSMaxWidth"];
[aCoder encodeFloat: _min_width forKey: @"NSMinWidth"];
[aCoder encodeFloat: _width forKey: @"NSWidth"];
}
else
{
[aCoder encodeObject: _identifier];
[aCoder encodeValueOfObjCType: @encode(float) at: &_width];
[aCoder encodeValueOfObjCType: @encode(float) at: &_min_width];
[aCoder encodeValueOfObjCType: @encode(float) at: &_max_width];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_resizable];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_editable];
[aCoder encodeObject: _headerCell];
[aCoder encodeObject: _dataCell];
}
}
- (id) initWithCoder: (NSCoder*)aDecoder

View file

@ -5123,11 +5123,11 @@ static inline float computePeriod(NSPoint mouseLocationWin,
{
if ([aCoder allowsKeyedCoding])
{
unsigned int vFlags = 0; // (raw >> 26); // filter out settings not pertinent to us.
unsigned long vFlags = 0;
NSSize intercellSpacing = [self intercellSpacing];
GSTableViewFlags tableViewFlags;
// make sure the corner view is properly encoded...
[(NSKeyedArchiver *)aCoder setClassName: @"_NSCornerView" forClass: [GSTableCornerView class]];
[super encodeWithCoder: aCoder];
[aCoder encodeObject: [self dataSource] forKey: @"NSDataSource"];
[aCoder encodeObject: [self delegate] forKey: @"NSDelegate"];
@ -5139,25 +5139,17 @@ static inline float computePeriod(NSPoint mouseLocationWin,
[aCoder encodeFloat: intercellSpacing.width forKey: @"NSIntercellSpacingWidth"];
[aCoder encodeFloat: [self rowHeight] forKey: @"NSRowHeight"];
[aCoder encodeObject: [self tableColumns] forKey: @"NSTableColumns"];
[aCoder encodeObject: _headerView forKey: @"NSHeaderView"];
[aCoder encodeObject: _cornerView forKey: @"NSCornerView"];
tableViewFlags.columnSelection = [self allowsColumnSelection];
tableViewFlags.multipleSelection = [self allowsMultipleSelection];
tableViewFlags.emptySelection = [self allowsEmptySelection];
tableViewFlags.drawsGrid = [self drawsGrid];
tableViewFlags.columnResizing = [self allowsColumnResizing];
tableViewFlags.columnOrdering = [self allowsColumnReordering];
if([self allowsColumnSelection])
vFlags |= 1;
if([self allowsMultipleSelection])
vFlags |= 2;
if([self allowsEmptySelection])
vFlags |= 4;
if([self allowsColumnResizing])
vFlags |= 16;
if([self allowsColumnReordering])
vFlags |= 32;
// shift...
vFlags = vFlags << 26;
vFlags |= 0x2400000; // add the constant...
memcpy((void *)&vFlags,(void *)&tableViewFlags,sizeof(unsigned long));
// encode..
[aCoder encodeInt: vFlags forKey: @"NSTvFlags"];