mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 21:10:48 +00:00
Added keyed decoding.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18510 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7ba988efd5
commit
5f72e933d1
14 changed files with 816 additions and 458 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2004-01-30 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSBrowser.m
|
||||
* Source/NSBrowserCell.m
|
||||
* Source/NSButtonCell.m
|
||||
* Source/NSCell.m
|
||||
* Source/NSClipView.m
|
||||
* Source/NSColor.m
|
||||
* Source/NSControl.m
|
||||
* Source/NSCursor.m
|
||||
* Source/NSFont.m
|
||||
* Source/NSProgressIndicator.m
|
||||
* Source/NSScroller.m
|
||||
* Source/NSScrollView.m
|
||||
* Source/NSView.m
|
||||
Added keyed decoding.
|
||||
|
||||
2004-01-26 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* /Headers/Additions/GNUstepGUI/GSHbox.h: Fix doc markup.
|
||||
|
|
|
@ -2396,11 +2396,53 @@ static NSTextFieldCell *titleCell;
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSCell *proto = [aDecoder decodeObjectForKey: @"NSCellPrototype"];
|
||||
NSString *title = [aDecoder decodeObjectForKey: @"NSFirstColumnTitle"];
|
||||
NSString *sep = [aDecoder decodeObjectForKey: @"NSPathSeparator"];
|
||||
int flags;
|
||||
|
||||
self = [super initWithCoder: aDecoder];
|
||||
[self setCellPrototype: proto];
|
||||
[self setPathSeparator: sep];
|
||||
[self setTitle: title ofColumn: 0];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSBrFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NSBrFlags"];
|
||||
// FIXME
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSNumberOfVisibleColumns"])
|
||||
{
|
||||
[self setMaxVisibleColumns: [aDecoder decodeIntForKey:
|
||||
@"NSNumberOfVisibleColumns"]];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSMinColumnWidth"])
|
||||
{
|
||||
[self setMinColumnWidth: [aDecoder decodeIntForKey: @"NSMinColumnWidth"]];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSColumnResizingType"])
|
||||
{
|
||||
//[self setColumnResizingType: [aDecoder decodeIntForKey: @"NSColumnResizingType"]];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSPreferedColumnWidth"])
|
||||
{
|
||||
//int prefWidth = [aDecoder decodeIntForKey: @"NSPreferedColumnWidth"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int colCount;
|
||||
id dummy;
|
||||
|
||||
[super initWithCoder: aDecoder];
|
||||
// Here to keep compatibility with old version
|
||||
dummy = [aDecoder decodeObject];
|
||||
_browserCellPrototype = RETAIN([aDecoder decodeObject]);
|
||||
|
@ -2447,12 +2489,10 @@ static NSTextFieldCell *titleCell;
|
|||
else
|
||||
_passiveDelegate = YES;
|
||||
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
||||
_target = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
|
||||
|
||||
// Do the minimal thing to initiate the browser...
|
||||
/*
|
||||
_lastColumnLoaded = -1;
|
||||
|
@ -2464,10 +2504,12 @@ static NSTextFieldCell *titleCell;
|
|||
// ..and rebuild any existing browser columns
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &colCount];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
||||
}
|
||||
|
||||
// Display even if there isn't any column
|
||||
_isLoaded = NO;
|
||||
[self tile];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -329,14 +329,22 @@ static NSFont *_leafFont;
|
|||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
BOOL tmp;
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
// Nothing special
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL tmp;
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
[self setLeaf: tmp];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
[self setLoaded: tmp];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_alternateImage];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -1127,10 +1127,49 @@
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *alternateContents = [aDecoder decodeObjectForKey: @"NSAlternateContents"];
|
||||
NSImage *alternateImage = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
|
||||
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquivalent"];
|
||||
int bFlags;
|
||||
int bFlags2;
|
||||
int delay = 0;
|
||||
int interval = 0;
|
||||
|
||||
[self setAlternateImage: alternateImage];
|
||||
[self setAlternateTitle: alternateContents];
|
||||
[self setKeyEquivalent: key];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
|
||||
{
|
||||
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
||||
// FIXME
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
|
||||
{
|
||||
bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
|
||||
// FIXME
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSPeriodicDelay"])
|
||||
{
|
||||
delay = [aDecoder decodeIntForKey: @"NSPeriodicDelay"];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSPeriodicInterval"])
|
||||
{
|
||||
interval = [aDecoder decodeIntForKey: @"NSPeriodicInterval"];
|
||||
}
|
||||
[self setPeriodicDelay: delay interval: interval];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: Add new ivars
|
||||
BOOL tmp;
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalent];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
||||
|
@ -1144,7 +1183,7 @@
|
|||
at: &_highlightsByMask];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1979,6 +1979,29 @@ static NSColor *shadowCol;
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *contents = [aDecoder decodeObjectForKey: @"NSContents"];
|
||||
NSFont *support = [aDecoder decodeObjectForKey: @"NSSupport"];
|
||||
int cFlags;
|
||||
int cFlags2;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSCellFlags"])
|
||||
{
|
||||
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
|
||||
// FIXME
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
|
||||
{
|
||||
cFlags2 = [aDecoder decodeIntForKey: @"NSCellFlags2"];
|
||||
// FIXME
|
||||
}
|
||||
|
||||
self = [self initTextCell: contents];
|
||||
[self setFont: support];
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL flag;
|
||||
unsigned int tmp_int;
|
||||
|
@ -2051,7 +2074,7 @@ static NSColor *shadowCol;
|
|||
_cell.contents_is_attributed_string = NO;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -717,11 +717,28 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
int flags;
|
||||
|
||||
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSBGColor"]];
|
||||
[self setDocumentCursor: [aDecoder decodeObjectForKey: @"NSCursor"]];
|
||||
[self setDocumentView: [aDecoder decodeObjectForKey: @"NSDocView"]];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NScvFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NScvFlags"];
|
||||
// FIXME setCopiesOnScroll: setDrawsBackground:
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSView *document;
|
||||
BOOL temp;
|
||||
|
||||
self = [super initWithCoder: aDecoder];
|
||||
[self setAutoresizesSubviews: YES];
|
||||
|
||||
[self setBackgroundColor: [aDecoder decodeObject]];
|
||||
|
@ -736,7 +753,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
[self removeSubview: document];
|
||||
[self setDocumentView: document];
|
||||
}
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -1044,7 +1044,72 @@ systemColorWithName(NSString *name)
|
|||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder versionForClassName: @"NSColor"] < 3)
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
int colorSpace = [aDecoder decodeIntForKey: @"NSColorSpace"];
|
||||
|
||||
DESTROY(self);
|
||||
if (colorSpace == 1)
|
||||
{
|
||||
unsigned length;
|
||||
const uint8_t *data;
|
||||
float red = 0.0;
|
||||
float green = 0.0;
|
||||
float blue = 0.0;
|
||||
float alpha = 0.0;
|
||||
NSString *str;
|
||||
NSScanner *scanner;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSRGB"])
|
||||
{
|
||||
data = [aDecoder decodeBytesForKey: @"NSRGB"
|
||||
returnedLength: &length];
|
||||
str = [[NSString alloc] initWithCString: data length: length];
|
||||
scanner = [[NSScanner alloc] initWithString: str];
|
||||
[scanner scanFloat: &red];
|
||||
[scanner scanFloat: &green];
|
||||
[scanner scanFloat: &blue];
|
||||
}
|
||||
|
||||
self = [NSColor colorWithCalibratedRed: red
|
||||
green: green
|
||||
blue: blue
|
||||
alpha: alpha];
|
||||
}
|
||||
else if (colorSpace == 3)
|
||||
{
|
||||
unsigned length;
|
||||
const uint8_t *data;
|
||||
float white = 0.0;
|
||||
float alpha = 0.0;
|
||||
NSString *str;
|
||||
NSScanner *scanner;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSWhite"])
|
||||
{
|
||||
data = [aDecoder decodeBytesForKey: @"NSWhite"
|
||||
returnedLength: &length];
|
||||
str = [[NSString alloc] initWithCString: data length: length];
|
||||
scanner = [[NSScanner alloc] initWithString: str];
|
||||
[scanner scanFloat: &white];
|
||||
}
|
||||
|
||||
self = [NSColor colorWithDeviceWhite: white
|
||||
alpha: alpha];
|
||||
}
|
||||
else if (colorSpace == 6)
|
||||
{
|
||||
NSString *catalog = [aDecoder decodeObjectForKey: @"NSCatalogName"];
|
||||
NSString *name = [aDecoder decodeObjectForKey: @"NSColorName"];
|
||||
//NSColor *color = [aDecoder decodeObjectForKey: @"NSColor"];
|
||||
|
||||
self = [NSColor colorWithCatalogName: catalog
|
||||
colorName: name];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
else if ([aDecoder versionForClassName: @"NSColor"] < 3)
|
||||
{
|
||||
float red;
|
||||
float green;
|
||||
|
|
|
@ -643,9 +643,25 @@ static Class actionCellClass;
|
|||
{
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSCell *cell = [aDecoder decodeObjectForKey: @"NSCell"];
|
||||
|
||||
if (cell != nil)
|
||||
{
|
||||
[self setCell: cell];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSEnabled"])
|
||||
{
|
||||
[self setEnabled: [aDecoder decodeBoolForKey: @"NSEnabled"]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
|
||||
#include "AppKit/NSColor.h"
|
||||
#include "AppKit/NSCursor.h"
|
||||
|
@ -370,13 +371,41 @@ backgroundColorHint:(NSColor *)bg
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
int type = 0;
|
||||
NSPoint hotSpot;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSCursorType"])
|
||||
{
|
||||
type = [aDecoder decodeIntForKey: @"NSCursorType"];
|
||||
}
|
||||
|
||||
DESTROY(self);
|
||||
// FIXME
|
||||
if (type == 0)
|
||||
{
|
||||
self = [NSCursor arrowCursor];
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
self = [NSCursor IBeamCursor];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSHotSpot"])
|
||||
{
|
||||
hotSpot = [aDecoder decodePointForKey: @"NSHotSpot"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_entered];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_exited];
|
||||
_cursor_image = [aDecoder decodeObject];
|
||||
_hot_spot = [aDecoder decodePoint];
|
||||
[self _computeCid];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -977,6 +977,23 @@ static BOOL flip_hack;
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *name = [aDecoder decodeObjectForKey: @"NSName"];
|
||||
int size = [aDecoder decodeIntForKey: @"NSSize"];
|
||||
|
||||
RELEASE(self);
|
||||
if ([aDecoder containsValueForKey: @"NSfFlags"])
|
||||
{
|
||||
//int flags = [aDecoder decodeIntForKey: @"NSfFlags"];
|
||||
// FIXME
|
||||
}
|
||||
|
||||
self = [NSFont fontWithName: name size: size];
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
int version = [aDecoder versionForClassName: @"NSFont"];
|
||||
id name;
|
||||
|
@ -1095,6 +1112,7 @@ static BOOL flip_hack;
|
|||
return RETAIN(new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end /* NSFont */
|
||||
|
||||
|
|
|
@ -303,6 +303,24 @@ static NSImage *images[maxCount];
|
|||
- (id)initWithCoder:(NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder:aDecoder];
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
//id *matrix = [aDecoder decodeObjectForKey: @"NSDrawMatrix"];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSMaxValue"])
|
||||
{
|
||||
int max = [aDecoder decodeIntForKey: @"NSMaxValue"];
|
||||
|
||||
[self setMaxValue: max];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSpiFlags"])
|
||||
{
|
||||
//int flags = [aDecoder decodeIntForKey: @"NSpiFlags"];
|
||||
// FIXME
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isIndeterminate];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isBezeled];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_usesThreadedAnimation];
|
||||
|
@ -312,6 +330,7 @@ static NSImage *images[maxCount];
|
|||
[aDecoder decodeValueOfObjCType: @encode(double) at:&_minValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(double) at:&_maxValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1236,13 +1236,37 @@ static float scrollerWidth;
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSClipView *content = [aDecoder decodeObjectForKey: @"NSContentView"];
|
||||
NSScroller *hScroller = [aDecoder decodeObjectForKey: @"NSHScroller"];
|
||||
NSScroller *vScroller = [aDecoder decodeObjectForKey: @"NSVScroller"];
|
||||
|
||||
if (content != nil)
|
||||
{
|
||||
[self setContentView: content];
|
||||
}
|
||||
if (hScroller != nil)
|
||||
{
|
||||
[self setHorizontalScroller: hScroller];
|
||||
}
|
||||
if (vScroller != nil)
|
||||
{
|
||||
[self setVerticalScroller: vScroller];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||
{
|
||||
//int flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||
// FIXME
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int version = [aDecoder versionForClassName:
|
||||
@"NSScrollView"];
|
||||
if (version == 2)
|
||||
{
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||
|
@ -1269,61 +1293,30 @@ static float scrollerWidth;
|
|||
if (_hasVertRuler)
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertRuler];
|
||||
|
||||
if (version == 2)
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
||||
if (_hasHeaderView)
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||
|
||||
[self tile];
|
||||
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
||||
|
||||
return self;
|
||||
}
|
||||
else if (version == 1)
|
||||
{
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
||||
if (_hasHorizScroller)
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_horizScroller];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
||||
if (_hasVertScroller)
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertScroller];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
||||
if (_hasHorizRuler)
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_horizRuler];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
||||
if (_hasVertRuler)
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertRuler];
|
||||
|
||||
/* This recreates all the info about headerView, cornerView, etc */
|
||||
[self setDocumentView: [_contentView documentView]];
|
||||
[self tile];
|
||||
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
||||
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unknown NSScrollView version (%d)", version);
|
||||
return nil;
|
||||
DESTROY(self);
|
||||
}
|
||||
[self tile];
|
||||
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -153,6 +153,38 @@ static NSColor *scrollBarColor = nil;
|
|||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||
id target = [aDecoder decodeObjectForKey: @"NSTarget"];
|
||||
float value = 0.0;
|
||||
float percent = 0.0;
|
||||
int flags;
|
||||
|
||||
if (action != nil)
|
||||
{
|
||||
[self setAction: NSSelectorFromString(action)];
|
||||
}
|
||||
[self setTarget: target];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSCurValue"])
|
||||
{
|
||||
value = [aDecoder decodeFloatForKey: @"NSCurValue"];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSPercent"])
|
||||
{
|
||||
percent = [aDecoder decodeFloatForKey: @"NSPercent"];
|
||||
}
|
||||
[self setFloatValue: value knobProportion: percent];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||
// FIXME
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_frame.size.width > _frame.size.height)
|
||||
{
|
||||
_isHorizontal = YES;
|
||||
|
@ -182,6 +214,7 @@ static NSColor *scrollBarColor = nil;
|
|||
|
||||
[self drawParts];
|
||||
[self checkSpaceForParts];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSCalendarDate.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
|
@ -3618,6 +3619,45 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSRect frame = NSZeroRect;
|
||||
id next = [aDecoder decodeObjectForKey: @"NSNextResponder"];
|
||||
//NSView *superView = [aDecoder decodeObjectForKey: @"NSSuperview"];
|
||||
NSView *nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||
NSArray *subViews = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSFrame"])
|
||||
{
|
||||
frame = [aDecoder decodeRectForKey: @"NSFrame"];
|
||||
}
|
||||
self = [self initWithFrame: frame];
|
||||
if (next != nil)
|
||||
{
|
||||
[self setNextResponder: next];
|
||||
}
|
||||
if (subViews != nil)
|
||||
{
|
||||
NSEnumerator *enumerator = [subViews objectEnumerator];
|
||||
NSView *sub;
|
||||
|
||||
while ((sub = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self addSubview: sub];
|
||||
}
|
||||
}
|
||||
if (nextKeyView != nil)
|
||||
{
|
||||
[self setNextKeyView: nextKeyView];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSvFlags"])
|
||||
{
|
||||
//int vFlags = [aDecoder decodeIntForKey: @"NSvFlags"];
|
||||
// FIXME set the flags
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRect rect;
|
||||
NSEnumerator *e;
|
||||
|
@ -3662,7 +3702,6 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
[self setNextKeyView: [aDecoder decodeObject]];
|
||||
[[aDecoder decodeObject] setNextKeyView: self];
|
||||
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
||||
e = [subs objectEnumerator];
|
||||
while ((sub = [e nextObject]) != nil)
|
||||
|
@ -3681,8 +3720,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
[self didAddSubview: sub];
|
||||
}
|
||||
RELEASE(subs);
|
||||
|
||||
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue