mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 04:31:16 +00:00
* Source/NSBrowserCell.m: Improved encoding and decoding in
encodeWithCoder: and initWithCoder: * Source/NSBrowser.m: Improved encoding and decoding in encodeWithCoder: and initWithCoder: * Source/NSScrollView.m: Improved encoding and decoding in encodeWithCoder: and initWithCoder: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23315 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e97c9a158f
commit
d24ee43d13
4 changed files with 137 additions and 81 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-08-19 10:33-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSBrowserCell.m: Improved encoding and decoding in
|
||||||
|
encodeWithCoder: and initWithCoder:
|
||||||
|
* Source/NSBrowser.m: Improved encoding and decoding in
|
||||||
|
encodeWithCoder: and initWithCoder:
|
||||||
|
* Source/NSScrollView.m: Improved encoding and decoding in
|
||||||
|
encodeWithCoder: and initWithCoder:
|
||||||
|
|
||||||
2006-08-17 00:54-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
2006-08-17 00:54-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/NSButtonCell.m: Improvements in both initWithCoder: and
|
* Source/NSButtonCell.m: Improvements in both initWithCoder: and
|
||||||
|
|
|
@ -152,30 +152,43 @@ static NSTextFieldCell *titleCell;
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||||
{
|
{
|
||||||
int dummy = 0;
|
if([aCoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
}
|
||||||
[aCoder encodeObject: _columnScrollView];
|
else
|
||||||
[aCoder encodeObject: _columnMatrix];
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &dummy];
|
int dummy = 0;
|
||||||
[aCoder encodeObject: _columnTitle];
|
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
||||||
|
[aCoder encodeObject: _columnScrollView];
|
||||||
|
[aCoder encodeObject: _columnMatrix];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(int) at: &dummy];
|
||||||
|
[aCoder encodeObject: _columnTitle];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
int dummy = 0;
|
if([aDecoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int dummy = 0;
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
||||||
_columnScrollView = [aDecoder decodeObject];
|
_columnScrollView = [aDecoder decodeObject];
|
||||||
if (_columnScrollView)
|
if (_columnScrollView)
|
||||||
RETAIN(_columnScrollView);
|
RETAIN(_columnScrollView);
|
||||||
_columnMatrix = [aDecoder decodeObject];
|
_columnMatrix = [aDecoder decodeObject];
|
||||||
if (_columnMatrix)
|
if (_columnMatrix)
|
||||||
RETAIN(_columnMatrix);
|
RETAIN(_columnMatrix);
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &dummy];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &dummy];
|
||||||
_columnTitle = [aDecoder decodeObject];
|
_columnTitle = [aDecoder decodeObject];
|
||||||
if (_columnTitle)
|
if (_columnTitle)
|
||||||
RETAIN(_columnTitle);
|
RETAIN(_columnTitle);
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2488,51 +2501,77 @@ static NSTextFieldCell *titleCell;
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
if([aCoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
[aCoder encodeObject: _browserCellPrototype forKey: @"NSCellPrototype"];
|
||||||
|
[aCoder encodeObject: [self _getTitleOfColumn: 0] forKey: @"NSFirstColumnTitle"];
|
||||||
|
[aCoder encodeObject: _pathSeparator forKey: @"NSPathSeparator"];
|
||||||
|
|
||||||
// Here to keep compatibility with old version
|
long flags = 0;
|
||||||
[aCoder encodeObject: nil];
|
flags |= [self hasHorizontalScroller] ? 0x10000 : 0;
|
||||||
[aCoder encodeObject:_browserCellPrototype];
|
flags |= ([self allowsEmptySelection] == NO) ? 0x20000 : 0;
|
||||||
[aCoder encodeObject: NSStringFromClass (_browserMatrixClass)];
|
flags |= [self sendsActionOnArrowKeys] ? 0x40000 : 0;
|
||||||
|
flags |= [self acceptsArrowKeys] ? 0x100000 : 0;
|
||||||
|
flags |= [self separatesColumns] ? 0x4000000 : 0;
|
||||||
|
flags |= [self takesTitleFromPreviousColumn] ? 0x8000000 : 0;
|
||||||
|
flags |= [self isTitled] ? 0x10000000 : 0;
|
||||||
|
flags |= [self reusesColumns] ? 0x20000000 : 0;
|
||||||
|
flags |= [self allowsBranchSelection] ? 0x40000000 : 0;
|
||||||
|
flags |= [self allowsMultipleSelection] ? 0x80000000 : 0;
|
||||||
|
[aCoder encodeInt: flags forKey: @"NSBrFlags"];
|
||||||
|
|
||||||
[aCoder encodeObject:_pathSeparator];
|
[aCoder encodeInt: _maxVisibleColumns forKey: @"NSNumberOfVisibleColumns"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
[aCoder encodeFloat: _minColumnWidth forKey: @"NSMinColumnWidth"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsBranchSelection];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_maxVisibleColumns];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_minColumnWidth];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_reusesColumns];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_separatesColumns];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_takesTitleFromPreviousColumn];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isTitled];
|
|
||||||
|
|
||||||
|
|
||||||
[aCoder encodeObject:_horizontalScroller];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizontalScroller];
|
|
||||||
[aCoder encodeRect: _scrollerRect];
|
|
||||||
[aCoder encodeSize: _columnSize];
|
|
||||||
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_acceptsArrowKeys];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnArrowKeys];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_acceptsAlphaNumericalKeys];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnAlphaNumericalKeys];
|
|
||||||
|
|
||||||
[aCoder encodeConditionalObject:_browserDelegate];
|
|
||||||
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
|
||||||
[aCoder encodeConditionalObject: _target];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
|
||||||
|
|
||||||
[aCoder encodeObject: _browserColumns];
|
|
||||||
|
|
||||||
// Just encode the number of columns and the first visible
|
|
||||||
// and rebuild the browser columns on the decoding side
|
|
||||||
{
|
|
||||||
int colCount = [_browserColumns count];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &colCount];
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//[aCoder encodeInt: columnResizingType forKey: @"NSColumnResizingType"]];
|
||||||
|
//[aCoder encodeInt: prefWidth forKey: @"NSPreferedColumnWidth"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Here to keep compatibility with old version
|
||||||
|
[aCoder encodeObject: nil];
|
||||||
|
[aCoder encodeObject:_browserCellPrototype];
|
||||||
|
[aCoder encodeObject: NSStringFromClass (_browserMatrixClass)];
|
||||||
|
|
||||||
|
[aCoder encodeObject:_pathSeparator];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsBranchSelection];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(int) at: &_maxVisibleColumns];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_minColumnWidth];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_reusesColumns];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_separatesColumns];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_takesTitleFromPreviousColumn];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isTitled];
|
||||||
|
|
||||||
|
|
||||||
|
[aCoder encodeObject:_horizontalScroller];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizontalScroller];
|
||||||
|
[aCoder encodeRect: _scrollerRect];
|
||||||
|
[aCoder encodeSize: _columnSize];
|
||||||
|
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_acceptsArrowKeys];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnArrowKeys];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_acceptsAlphaNumericalKeys];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnAlphaNumericalKeys];
|
||||||
|
|
||||||
|
[aCoder encodeConditionalObject:_browserDelegate];
|
||||||
|
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
||||||
|
[aCoder encodeConditionalObject: _target];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||||
|
|
||||||
|
[aCoder encodeObject: _browserColumns];
|
||||||
|
|
||||||
|
// Just encode the number of columns and the first visible
|
||||||
|
// and rebuild the browser columns on the decoding side
|
||||||
|
{
|
||||||
|
int colCount = [_browserColumns count];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(int) at: &colCount];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -2544,7 +2583,7 @@ static NSTextFieldCell *titleCell;
|
||||||
NSCell *proto = [aDecoder decodeObjectForKey: @"NSCellPrototype"];
|
NSCell *proto = [aDecoder decodeObjectForKey: @"NSCellPrototype"];
|
||||||
NSString *title = [aDecoder decodeObjectForKey: @"NSFirstColumnTitle"];
|
NSString *title = [aDecoder decodeObjectForKey: @"NSFirstColumnTitle"];
|
||||||
NSString *sep = [aDecoder decodeObjectForKey: @"NSPathSeparator"];
|
NSString *sep = [aDecoder decodeObjectForKey: @"NSPathSeparator"];
|
||||||
int flags;
|
long flags;
|
||||||
|
|
||||||
// start //
|
// start //
|
||||||
NSSize bs;
|
NSSize bs;
|
||||||
|
@ -2615,16 +2654,16 @@ static NSTextFieldCell *titleCell;
|
||||||
{
|
{
|
||||||
flags = [aDecoder decodeIntForKey: @"NSBrFlags"];
|
flags = [aDecoder decodeIntForKey: @"NSBrFlags"];
|
||||||
|
|
||||||
[self setHasHorizontalScroller: (flags & 0x10000)];
|
[self setHasHorizontalScroller: ((flags & 0x10000) == 0x10000)];
|
||||||
[self setAllowsEmptySelection: !(flags & 0x20000)];
|
[self setAllowsEmptySelection: !((flags & 0x20000) == 0x20000)];
|
||||||
[self setSendsActionOnArrowKeys: (flags & 0x40000)];
|
[self setSendsActionOnArrowKeys: ((flags & 0x40000) == 0x40000)];
|
||||||
[self setAcceptsArrowKeys: (flags & 0x100000)];
|
[self setAcceptsArrowKeys: ((flags & 0x100000) == 0x100000)];
|
||||||
[self setSeparatesColumns: (flags & 0x4000000)];
|
[self setSeparatesColumns: ((flags & 0x4000000) == 0x4000000)];
|
||||||
[self setTakesTitleFromPreviousColumn: (flags & 0x8000000)];
|
[self setTakesTitleFromPreviousColumn: ((flags & 0x8000000) == 0x8000000)];
|
||||||
[self setTitled: (flags & 0x10000000)];
|
[self setTitled: ((flags & 0x10000000) == 0x10000000)];
|
||||||
[self setReusesColumns: (flags & 0x20000000)];
|
[self setReusesColumns: ((flags & 0x20000000) == 0x20000000)];
|
||||||
[self setAllowsBranchSelection: (flags & 0x40000000)];
|
[self setAllowsBranchSelection: ((flags & 0x40000000) == 0x40000000)];
|
||||||
[self setAllowsMultipleSelection: (flags & 0x80000000)];
|
[self setAllowsMultipleSelection: ((flags & 0x80000000) == 0x80000000)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSNumberOfVisibleColumns"])
|
if ([aDecoder containsValueForKey: @"NSNumberOfVisibleColumns"])
|
||||||
|
|
|
@ -338,14 +338,20 @@ static NSFont *_leafFont;
|
||||||
*/
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
BOOL tmp;
|
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
if([aCoder allowsKeyedCoding])
|
||||||
tmp = _browsercell_is_leaf;
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
// simply encodes prescence...
|
||||||
tmp = _browsercell_is_loaded;
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
else
|
||||||
[aCoder encodeObject: _alternateImage];
|
{
|
||||||
|
BOOL tmp;
|
||||||
|
tmp = _browsercell_is_leaf;
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||||
|
tmp = _browsercell_is_loaded;
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||||
|
[aCoder encodeObject: _alternateImage];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -354,7 +360,7 @@ static NSFont *_leafFont;
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
// Nothing special
|
// Nothing to decode...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1236,6 +1236,8 @@ static float scrollerWidth;
|
||||||
scrollViewFlags.hasVScroller = _hasVertScroller;
|
scrollViewFlags.hasVScroller = _hasVertScroller;
|
||||||
scrollViewFlags.hasHScroller = _hasHorizScroller;
|
scrollViewFlags.hasHScroller = _hasHorizScroller;
|
||||||
scrollViewFlags.border = _borderType;
|
scrollViewFlags.border = _borderType;
|
||||||
|
scrollViewFlags.__unused4 = 0;
|
||||||
|
scrollViewFlags.__unused0 = 0;
|
||||||
memcpy((void *)&flags, (void *)&scrollViewFlags,sizeof(unsigned long));
|
memcpy((void *)&flags, (void *)&scrollViewFlags,sizeof(unsigned long));
|
||||||
|
|
||||||
[aCoder encodeInt: flags forKey: @"NSsFlags"];
|
[aCoder encodeInt: flags forKey: @"NSsFlags"];
|
||||||
|
|
Loading…
Reference in a new issue