mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 07:20:58 +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>
|
2004-01-26 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* /Headers/Additions/GNUstepGUI/GSHbox.h: Fix doc markup.
|
* /Headers/Additions/GNUstepGUI/GSHbox.h: Fix doc markup.
|
||||||
|
|
|
@ -2397,10 +2397,52 @@ static NSTextFieldCell *titleCell;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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;
|
int colCount;
|
||||||
id dummy;
|
id dummy;
|
||||||
|
|
||||||
[super initWithCoder: aDecoder];
|
|
||||||
// Here to keep compatibility with old version
|
// Here to keep compatibility with old version
|
||||||
dummy = [aDecoder decodeObject];
|
dummy = [aDecoder decodeObject];
|
||||||
_browserCellPrototype = RETAIN([aDecoder decodeObject]);
|
_browserCellPrototype = RETAIN([aDecoder decodeObject]);
|
||||||
|
@ -2447,12 +2489,10 @@ static NSTextFieldCell *titleCell;
|
||||||
else
|
else
|
||||||
_passiveDelegate = YES;
|
_passiveDelegate = YES;
|
||||||
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
||||||
_target = [aDecoder decodeObject];
|
_target = [aDecoder decodeObject];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||||
|
|
||||||
|
|
||||||
// Do the minimal thing to initiate the browser...
|
// Do the minimal thing to initiate the browser...
|
||||||
/*
|
/*
|
||||||
_lastColumnLoaded = -1;
|
_lastColumnLoaded = -1;
|
||||||
|
@ -2464,10 +2504,12 @@ static NSTextFieldCell *titleCell;
|
||||||
// ..and rebuild any existing browser columns
|
// ..and rebuild any existing browser columns
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &colCount];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &colCount];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
||||||
|
}
|
||||||
|
|
||||||
// Display even if there isn't any column
|
// Display even if there isn't any column
|
||||||
_isLoaded = NO;
|
_isLoaded = NO;
|
||||||
[self tile];
|
[self tile];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,14 +329,22 @@ static NSFont *_leafFont;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
BOOL tmp;
|
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
|
|
||||||
|
if ([aDecoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
// Nothing special
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOL tmp;
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||||
[self setLeaf: tmp];
|
[self setLeaf: tmp];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||||
[self setLoaded: tmp];
|
[self setLoaded: tmp];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_alternateImage];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_alternateImage];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1128,9 +1128,48 @@
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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
|
// FIXME: Add new ivars
|
||||||
BOOL tmp;
|
BOOL tmp;
|
||||||
[super initWithCoder: aDecoder];
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalent];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalent];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
||||||
|
@ -1144,7 +1183,7 @@
|
||||||
at: &_highlightsByMask];
|
at: &_highlightsByMask];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
at: &_showAltStateMask];
|
at: &_showAltStateMask];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1980,6 +1980,29 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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;
|
BOOL flag;
|
||||||
unsigned int tmp_int;
|
unsigned int tmp_int;
|
||||||
|
|
||||||
|
@ -2051,7 +2074,7 @@ static NSColor *shadowCol;
|
||||||
_cell.contents_is_attributed_string = NO;
|
_cell.contents_is_attributed_string = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -718,10 +718,27 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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;
|
NSView *document;
|
||||||
BOOL temp;
|
BOOL temp;
|
||||||
|
|
||||||
self = [super initWithCoder: aDecoder];
|
|
||||||
[self setAutoresizesSubviews: YES];
|
[self setAutoresizesSubviews: YES];
|
||||||
|
|
||||||
[self setBackgroundColor: [aDecoder decodeObject]];
|
[self setBackgroundColor: [aDecoder decodeObject]];
|
||||||
|
@ -736,7 +753,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
[self removeSubview: document];
|
[self removeSubview: document];
|
||||||
[self setDocumentView: document];
|
[self setDocumentView: document];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1044,7 +1044,72 @@ systemColorWithName(NSString *name)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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 red;
|
||||||
float green;
|
float green;
|
||||||
|
|
|
@ -643,9 +643,25 @@ static Class actionCellClass;
|
||||||
{
|
{
|
||||||
[super initWithCoder: aDecoder];
|
[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(int) at: &_tag];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
|
#include <Foundation/NSKeyedArchiver.h>
|
||||||
|
|
||||||
#include "AppKit/NSColor.h"
|
#include "AppKit/NSColor.h"
|
||||||
#include "AppKit/NSCursor.h"
|
#include "AppKit/NSCursor.h"
|
||||||
|
@ -371,12 +372,40 @@ backgroundColorHint:(NSColor *)bg
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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_entered];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_exited];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_exited];
|
||||||
_cursor_image = [aDecoder decodeObject];
|
_cursor_image = [aDecoder decodeObject];
|
||||||
_hot_spot = [aDecoder decodePoint];
|
_hot_spot = [aDecoder decodePoint];
|
||||||
[self _computeCid];
|
[self _computeCid];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -978,6 +978,23 @@ static BOOL flip_hack;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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"];
|
int version = [aDecoder versionForClassName: @"NSFont"];
|
||||||
id name;
|
id name;
|
||||||
float fontMatrix[6];
|
float fontMatrix[6];
|
||||||
|
@ -1094,6 +1111,7 @@ static BOOL flip_hack;
|
||||||
NSAssert(new != nil, @"Couldn't find a valid font when decoding.");
|
NSAssert(new != nil, @"Couldn't find a valid font when decoding.");
|
||||||
return RETAIN(new);
|
return RETAIN(new);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end /* NSFont */
|
@end /* NSFont */
|
||||||
|
|
|
@ -303,6 +303,24 @@ static NSImage *images[maxCount];
|
||||||
- (id)initWithCoder:(NSCoder *)aDecoder
|
- (id)initWithCoder:(NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: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:&_isIndeterminate];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isBezeled];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isBezeled];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_usesThreadedAnimation];
|
[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:&_minValue];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double) at:&_maxValue];
|
[aDecoder decodeValueOfObjCType: @encode(double) at:&_maxValue];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1237,12 +1237,36 @@ static float scrollerWidth;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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:
|
int version = [aDecoder versionForClassName:
|
||||||
@"NSScrollView"];
|
@"NSScrollView"];
|
||||||
if (version == 2)
|
|
||||||
{
|
|
||||||
[super initWithCoder: aDecoder];
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||||
|
@ -1269,61 +1293,30 @@ static float scrollerWidth;
|
||||||
if (_hasVertRuler)
|
if (_hasVertRuler)
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertRuler];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertRuler];
|
||||||
|
|
||||||
|
if (version == 2)
|
||||||
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
||||||
if (_hasHeaderView)
|
if (_hasHeaderView)
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||||
|
|
||||||
[self tile];
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
else if (version == 1)
|
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 */
|
/* This recreates all the info about headerView, cornerView, etc */
|
||||||
[self setDocumentView: [_contentView documentView]];
|
[self setDocumentView: [_contentView documentView]];
|
||||||
[self tile];
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSLog(@"unknown NSScrollView version (%d)", version);
|
NSLog(@"unknown NSScrollView version (%d)", version);
|
||||||
return nil;
|
DESTROY(self);
|
||||||
}
|
}
|
||||||
|
[self tile];
|
||||||
|
|
||||||
|
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -153,6 +153,38 @@ static NSColor *scrollBarColor = nil;
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: aDecoder];
|
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)
|
if (_frame.size.width > _frame.size.height)
|
||||||
{
|
{
|
||||||
_isHorizontal = YES;
|
_isHorizontal = YES;
|
||||||
|
@ -182,6 +214,7 @@ static NSColor *scrollBarColor = nil;
|
||||||
|
|
||||||
[self drawParts];
|
[self drawParts];
|
||||||
[self checkSpaceForParts];
|
[self checkSpaceForParts];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSCalendarDate.h>
|
#include <Foundation/NSCalendarDate.h>
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
|
#include <Foundation/NSKeyedArchiver.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
#include <Foundation/NSThread.h>
|
#include <Foundation/NSThread.h>
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
|
@ -3619,6 +3620,45 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (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;
|
NSRect rect;
|
||||||
NSEnumerator *e;
|
NSEnumerator *e;
|
||||||
NSView *sub;
|
NSView *sub;
|
||||||
|
@ -3635,7 +3675,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
|
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
|
||||||
_boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds
|
_boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds
|
||||||
_matrixToWindow = [NSAffineTransform new]; // Map to window coordinates
|
_matrixToWindow = [NSAffineTransform new]; // Map to window coordinates
|
||||||
_matrixFromWindow = [NSAffineTransform new]; // Map from window coordinates
|
_matrixFromWindow = [NSAffineTransform new];// Map from window coordinates
|
||||||
[_frameMatrix setFrameOrigin: _frame.origin];
|
[_frameMatrix setFrameOrigin: _frame.origin];
|
||||||
|
|
||||||
rect = [aDecoder decodeRect];
|
rect = [aDecoder decodeRect];
|
||||||
|
@ -3662,7 +3702,6 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
[self setNextKeyView: [aDecoder decodeObject]];
|
[self setNextKeyView: [aDecoder decodeObject]];
|
||||||
[[aDecoder decodeObject] setNextKeyView: self];
|
[[aDecoder decodeObject] setNextKeyView: self];
|
||||||
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
||||||
e = [subs objectEnumerator];
|
e = [subs objectEnumerator];
|
||||||
while ((sub = [e nextObject]) != nil)
|
while ((sub = [e nextObject]) != nil)
|
||||||
|
@ -3681,8 +3720,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
[self didAddSubview: sub];
|
[self didAddSubview: sub];
|
||||||
}
|
}
|
||||||
RELEASE(subs);
|
RELEASE(subs);
|
||||||
|
|
||||||
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue