mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 04:41:10 +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>
|
||||
|
||||
* Source/NSButtonCell.m: Improvements in both initWithCoder: and
|
||||
|
|
|
@ -151,6 +151,11 @@ static NSTextFieldCell *titleCell;
|
|||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
int dummy = 0;
|
||||
|
||||
|
@ -160,8 +165,15 @@ static NSTextFieldCell *titleCell;
|
|||
[aCoder encodeValueOfObjCType: @encode(int) at: &dummy];
|
||||
[aCoder encodeObject: _columnTitle];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
if([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int dummy = 0;
|
||||
|
||||
|
@ -176,6 +188,7 @@ static NSTextFieldCell *titleCell;
|
|||
_columnTitle = [aDecoder decodeObject];
|
||||
if (_columnTitle)
|
||||
RETAIN(_columnTitle);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -2488,7 +2501,33 @@ static NSTextFieldCell *titleCell;
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: _browserCellPrototype forKey: @"NSCellPrototype"];
|
||||
[aCoder encodeObject: [self _getTitleOfColumn: 0] forKey: @"NSFirstColumnTitle"];
|
||||
[aCoder encodeObject: _pathSeparator forKey: @"NSPathSeparator"];
|
||||
|
||||
long flags = 0;
|
||||
flags |= [self hasHorizontalScroller] ? 0x10000 : 0;
|
||||
flags |= ([self allowsEmptySelection] == NO) ? 0x20000 : 0;
|
||||
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 encodeInt: _maxVisibleColumns forKey: @"NSNumberOfVisibleColumns"];
|
||||
[aCoder encodeFloat: _minColumnWidth forKey: @"NSMinColumnWidth"];
|
||||
|
||||
//[aCoder encodeInt: columnResizingType forKey: @"NSColumnResizingType"]];
|
||||
//[aCoder encodeInt: prefWidth forKey: @"NSPreferedColumnWidth"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here to keep compatibility with old version
|
||||
[aCoder encodeObject: nil];
|
||||
[aCoder encodeObject:_browserCellPrototype];
|
||||
|
@ -2532,7 +2571,7 @@ static NSTextFieldCell *titleCell;
|
|||
[aCoder encodeValueOfObjCType: @encode(int) at: &colCount];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -2544,7 +2583,7 @@ static NSTextFieldCell *titleCell;
|
|||
NSCell *proto = [aDecoder decodeObjectForKey: @"NSCellPrototype"];
|
||||
NSString *title = [aDecoder decodeObjectForKey: @"NSFirstColumnTitle"];
|
||||
NSString *sep = [aDecoder decodeObjectForKey: @"NSPathSeparator"];
|
||||
int flags;
|
||||
long flags;
|
||||
|
||||
// start //
|
||||
NSSize bs;
|
||||
|
@ -2615,16 +2654,16 @@ static NSTextFieldCell *titleCell;
|
|||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NSBrFlags"];
|
||||
|
||||
[self setHasHorizontalScroller: (flags & 0x10000)];
|
||||
[self setAllowsEmptySelection: !(flags & 0x20000)];
|
||||
[self setSendsActionOnArrowKeys: (flags & 0x40000)];
|
||||
[self setAcceptsArrowKeys: (flags & 0x100000)];
|
||||
[self setSeparatesColumns: (flags & 0x4000000)];
|
||||
[self setTakesTitleFromPreviousColumn: (flags & 0x8000000)];
|
||||
[self setTitled: (flags & 0x10000000)];
|
||||
[self setReusesColumns: (flags & 0x20000000)];
|
||||
[self setAllowsBranchSelection: (flags & 0x40000000)];
|
||||
[self setAllowsMultipleSelection: (flags & 0x80000000)];
|
||||
[self setHasHorizontalScroller: ((flags & 0x10000) == 0x10000)];
|
||||
[self setAllowsEmptySelection: !((flags & 0x20000) == 0x20000)];
|
||||
[self setSendsActionOnArrowKeys: ((flags & 0x40000) == 0x40000)];
|
||||
[self setAcceptsArrowKeys: ((flags & 0x100000) == 0x100000)];
|
||||
[self setSeparatesColumns: ((flags & 0x4000000) == 0x4000000)];
|
||||
[self setTakesTitleFromPreviousColumn: ((flags & 0x8000000) == 0x8000000)];
|
||||
[self setTitled: ((flags & 0x10000000) == 0x10000000)];
|
||||
[self setReusesColumns: ((flags & 0x20000000) == 0x20000000)];
|
||||
[self setAllowsBranchSelection: ((flags & 0x40000000) == 0x40000000)];
|
||||
[self setAllowsMultipleSelection: ((flags & 0x80000000) == 0x80000000)];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSNumberOfVisibleColumns"])
|
||||
|
|
|
@ -338,15 +338,21 @@ static NSFont *_leafFont;
|
|||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
BOOL tmp;
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
// simply encodes prescence...
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -354,7 +360,7 @@ static NSFont *_leafFont;
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
// Nothing special
|
||||
// Nothing to decode...
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1236,6 +1236,8 @@ static float scrollerWidth;
|
|||
scrollViewFlags.hasVScroller = _hasVertScroller;
|
||||
scrollViewFlags.hasHScroller = _hasHorizScroller;
|
||||
scrollViewFlags.border = _borderType;
|
||||
scrollViewFlags.__unused4 = 0;
|
||||
scrollViewFlags.__unused0 = 0;
|
||||
memcpy((void *)&flags, (void *)&scrollViewFlags,sizeof(unsigned long));
|
||||
|
||||
[aCoder encodeInt: flags forKey: @"NSsFlags"];
|
||||
|
|
Loading…
Reference in a new issue