mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:10:47 +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,77 +2397,119 @@ static NSTextFieldCell *titleCell;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
int colCount;
|
self = [super initWithCoder: aDecoder];
|
||||||
id dummy;
|
|
||||||
|
|
||||||
[super initWithCoder: aDecoder];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
// Here to keep compatibility with old version
|
{
|
||||||
dummy = [aDecoder decodeObject];
|
NSCell *proto = [aDecoder decodeObjectForKey: @"NSCellPrototype"];
|
||||||
_browserCellPrototype = RETAIN([aDecoder decodeObject]);
|
NSString *title = [aDecoder decodeObjectForKey: @"NSFirstColumnTitle"];
|
||||||
_browserMatrixClass = NSClassFromString ((NSString *)[aDecoder decodeObject]);
|
NSString *sep = [aDecoder decodeObjectForKey: @"NSPathSeparator"];
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
self = [super initWithCoder: aDecoder];
|
||||||
|
[self setCellPrototype: proto];
|
||||||
|
[self setPathSeparator: sep];
|
||||||
|
[self setTitle: title ofColumn: 0];
|
||||||
|
|
||||||
[self setPathSeparator: [aDecoder decodeObject]];
|
if ([aDecoder containsValueForKey: @"NSBrFlags"])
|
||||||
|
{
|
||||||
|
flags = [aDecoder decodeIntForKey: @"NSBrFlags"];
|
||||||
|
// FIXME
|
||||||
|
}
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
if ([aDecoder containsValueForKey: @"NSNumberOfVisibleColumns"])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsBranchSelection];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
[self setMaxVisibleColumns: [aDecoder decodeIntForKey:
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
@"NSNumberOfVisibleColumns"]];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_maxVisibleColumns];
|
}
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minColumnWidth];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_reusesColumns];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_separatesColumns];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_takesTitleFromPreviousColumn];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isTitled];
|
|
||||||
|
|
||||||
//NSBox *_horizontalScrollerBox;
|
if ([aDecoder containsValueForKey: @"NSMinColumnWidth"])
|
||||||
_horizontalScroller = RETAIN([aDecoder decodeObject]);
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizontalScroller];
|
[self setMinColumnWidth: [aDecoder decodeIntForKey: @"NSMinColumnWidth"]];
|
||||||
_scrollerRect = [aDecoder decodeRect];
|
}
|
||||||
_columnSize = [aDecoder decodeSize];
|
|
||||||
|
|
||||||
_skipUpdateScroller = NO;
|
if ([aDecoder containsValueForKey: @"NSColumnResizingType"])
|
||||||
/*
|
{
|
||||||
_horizontalScroller = [[NSScroller alloc] initWithFrame: _scrollerRect];
|
//[self setColumnResizingType: [aDecoder decodeIntForKey: @"NSColumnResizingType"]];
|
||||||
[_horizontalScroller setTarget: self];
|
}
|
||||||
[_horizontalScroller setAction: @selector(scrollViaScroller:)];
|
|
||||||
*/
|
|
||||||
[self setHasHorizontalScroller: _hasHorizontalScroller];
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_acceptsArrowKeys];
|
if ([aDecoder containsValueForKey: @"NSPreferedColumnWidth"])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnArrowKeys];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_acceptsAlphaNumericalKeys];
|
//int prefWidth = [aDecoder decodeIntForKey: @"NSPreferedColumnWidth"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnAlphaNumericalKeys];
|
}
|
||||||
_lastKeyPressed = 0;
|
}
|
||||||
_charBuffer = nil;
|
|
||||||
// Skip: int _alphaNumericalLastColumn;
|
|
||||||
|
|
||||||
_browserDelegate = [aDecoder decodeObject];
|
|
||||||
if (_browserDelegate != nil)
|
|
||||||
[self setDelegate:_browserDelegate];
|
|
||||||
else
|
else
|
||||||
_passiveDelegate = YES;
|
{
|
||||||
|
int colCount;
|
||||||
|
id dummy;
|
||||||
|
|
||||||
|
// Here to keep compatibility with old version
|
||||||
|
dummy = [aDecoder decodeObject];
|
||||||
|
_browserCellPrototype = RETAIN([aDecoder decodeObject]);
|
||||||
|
_browserMatrixClass = NSClassFromString ((NSString *)[aDecoder decodeObject]);
|
||||||
|
|
||||||
|
[self setPathSeparator: [aDecoder decodeObject]];
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isLoaded];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsBranchSelection];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &_maxVisibleColumns];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_minColumnWidth];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_reusesColumns];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_separatesColumns];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_takesTitleFromPreviousColumn];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isTitled];
|
||||||
|
|
||||||
|
//NSBox *_horizontalScrollerBox;
|
||||||
|
_horizontalScroller = RETAIN([aDecoder decodeObject]);
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizontalScroller];
|
||||||
|
_scrollerRect = [aDecoder decodeRect];
|
||||||
|
_columnSize = [aDecoder decodeSize];
|
||||||
|
|
||||||
|
_skipUpdateScroller = NO;
|
||||||
|
/*
|
||||||
|
_horizontalScroller = [[NSScroller alloc] initWithFrame: _scrollerRect];
|
||||||
|
[_horizontalScroller setTarget: self];
|
||||||
|
[_horizontalScroller setAction: @selector(scrollViaScroller:)];
|
||||||
|
*/
|
||||||
|
[self setHasHorizontalScroller: _hasHorizontalScroller];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_acceptsArrowKeys];
|
||||||
_target = [aDecoder decodeObject];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnArrowKeys];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_acceptsAlphaNumericalKeys];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sendsActionOnAlphaNumericalKeys];
|
||||||
|
_lastKeyPressed = 0;
|
||||||
// Do the minimal thing to initiate the browser...
|
_charBuffer = nil;
|
||||||
/*
|
// Skip: int _alphaNumericalLastColumn;
|
||||||
_lastColumnLoaded = -1;
|
|
||||||
_firstVisibleColumn = 0;
|
|
||||||
_lastVisibleColumn = 0;
|
|
||||||
[self _createColumn];
|
|
||||||
*/
|
|
||||||
_browserColumns = RETAIN([aDecoder decodeObject]);
|
|
||||||
// ..and rebuild any existing browser columns
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &colCount];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_firstVisibleColumn];
|
|
||||||
|
|
||||||
|
_browserDelegate = [aDecoder decodeObject];
|
||||||
|
if (_browserDelegate != nil)
|
||||||
|
[self setDelegate:_browserDelegate];
|
||||||
|
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;
|
||||||
|
_firstVisibleColumn = 0;
|
||||||
|
_lastVisibleColumn = 0;
|
||||||
|
[self _createColumn];
|
||||||
|
*/
|
||||||
|
_browserColumns = RETAIN([aDecoder decodeObject]);
|
||||||
|
// ..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
|
// Display even if there isn't any column
|
||||||
_isLoaded = NO;
|
_isLoaded = NO;
|
||||||
[self tile];
|
[self tile];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,15 +329,23 @@ static NSFont *_leafFont;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
BOOL tmp;
|
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
[self setLeaf: tmp];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
// Nothing special
|
||||||
[self setLoaded: tmp];
|
}
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_alternateImage];
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1128,23 +1128,62 @@
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
// FIXME: Add new ivars
|
self = [super initWithCoder: aDecoder];
|
||||||
BOOL tmp;
|
|
||||||
[super initWithCoder: aDecoder];
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalent];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altContents];
|
NSString *alternateContents = [aDecoder decodeObjectForKey: @"NSAlternateContents"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altImage];
|
NSImage *alternateImage = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||||
_buttoncell_is_transparent = tmp;
|
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquivalent"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
int bFlags;
|
||||||
at: &_keyEquivalentModifierMask];
|
int bFlags2;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
int delay = 0;
|
||||||
at: &_highlightsByMask];
|
int interval = 0;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
|
||||||
at: &_showAltStateMask];
|
[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;
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalent];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altContents];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altImage];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||||
|
_buttoncell_is_transparent = tmp;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &_keyEquivalentModifierMask];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &_highlightsByMask];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &_showAltStateMask];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
159
Source/NSCell.m
159
Source/NSCell.m
|
@ -1980,78 +1980,101 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
BOOL flag;
|
if ([aDecoder allowsKeyedCoding])
|
||||||
unsigned int tmp_int;
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contents];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell_image];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_font];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_objectValue];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.contents_is_attributed_string = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_highlighted = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_disabled = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_editable = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_rich_text = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.imports_graphics = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.shows_first_responder = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.refuses_first_responder = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.sends_action_on_end_editing = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_bordered = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_bezeled = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_scrollable = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.is_selectable = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
// This used to be is_continuous, which has been replaced.
|
|
||||||
//_cell.is_continuous = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.allows_mixed_state = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_cell.wraps = flag;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
|
||||||
_cell.text_align = tmp_int;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
|
||||||
_cell.type = tmp_int;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
|
||||||
_cell.image_position = tmp_int;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
|
||||||
_cell.entry_type = tmp_int;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
|
||||||
_cell.state = tmp_int;
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
|
||||||
at: &_mnemonic_location];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
|
||||||
at: &_mouse_down_flags];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &_action_mask];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_formatter];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_menu];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_represented_object];
|
|
||||||
|
|
||||||
if (_formatter != nil)
|
|
||||||
{
|
{
|
||||||
NSString *contents;
|
NSString *contents = [aDecoder decodeObjectForKey: @"NSContents"];
|
||||||
|
NSFont *support = [aDecoder decodeObjectForKey: @"NSSupport"];
|
||||||
|
int cFlags;
|
||||||
|
int cFlags2;
|
||||||
|
|
||||||
contents = [_formatter stringForObjectValue: _objectValue];
|
if ([aDecoder containsValueForKey: @"NSCellFlags"])
|
||||||
if (contents != nil)
|
{
|
||||||
{
|
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
|
||||||
_cell.has_valid_object_value = YES;
|
// FIXME
|
||||||
ASSIGN (_contents, contents);
|
}
|
||||||
_cell.contents_is_attributed_string = NO;
|
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
|
||||||
|
{
|
||||||
|
cFlags2 = [aDecoder decodeIntForKey: @"NSCellFlags2"];
|
||||||
|
// FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
self = [self initTextCell: contents];
|
||||||
|
[self setFont: support];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOL flag;
|
||||||
|
unsigned int tmp_int;
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contents];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell_image];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_font];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_objectValue];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.contents_is_attributed_string = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_highlighted = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_disabled = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_editable = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_rich_text = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.imports_graphics = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.shows_first_responder = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.refuses_first_responder = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.sends_action_on_end_editing = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_bordered = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_bezeled = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_scrollable = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.is_selectable = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
// This used to be is_continuous, which has been replaced.
|
||||||
|
//_cell.is_continuous = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.allows_mixed_state = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_cell.wraps = flag;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||||
|
_cell.text_align = tmp_int;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||||
|
_cell.type = tmp_int;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||||
|
_cell.image_position = tmp_int;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||||
|
_cell.entry_type = tmp_int;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||||
|
_cell.state = tmp_int;
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &_mnemonic_location];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &_mouse_down_flags];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &_action_mask];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_formatter];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_menu];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_represented_object];
|
||||||
|
|
||||||
|
if (_formatter != nil)
|
||||||
|
{
|
||||||
|
NSString *contents;
|
||||||
|
|
||||||
|
contents = [_formatter stringForObjectValue: _objectValue];
|
||||||
|
if (contents != nil)
|
||||||
|
{
|
||||||
|
_cell.has_valid_object_value = YES;
|
||||||
|
ASSIGN (_contents, contents);
|
||||||
|
_cell.contents_is_attributed_string = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -718,25 +718,42 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
NSView *document;
|
|
||||||
BOOL temp;
|
|
||||||
|
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
[self setAutoresizesSubviews: YES];
|
|
||||||
|
|
||||||
[self setBackgroundColor: [aDecoder decodeObject]];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &temp];
|
|
||||||
[self setDrawsBackground: temp];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cursor];
|
|
||||||
|
|
||||||
if ([[self subviews] count] > 0)
|
|
||||||
{
|
{
|
||||||
document = AUTORELEASE(RETAIN([[self subviews] objectAtIndex: 0]));
|
int flags;
|
||||||
[self removeSubview: document];
|
|
||||||
[self setDocumentView: document];
|
[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 setAutoresizesSubviews: YES];
|
||||||
|
|
||||||
|
[self setBackgroundColor: [aDecoder decodeObject]];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &temp];
|
||||||
|
[self setDrawsBackground: temp];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cursor];
|
||||||
|
|
||||||
|
if ([[self subviews] count] > 0)
|
||||||
|
{
|
||||||
|
document = AUTORELEASE(RETAIN([[self subviews] objectAtIndex: 0]));
|
||||||
|
[self removeSubview: 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];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_tag];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
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;
|
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
|
||||||
{
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_entered];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_exited];
|
{
|
||||||
_cursor_image = [aDecoder decodeObject];
|
int type = 0;
|
||||||
_hot_spot = [aDecoder decodePoint];
|
NSPoint hotSpot;
|
||||||
[self _computeCid];
|
|
||||||
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
242
Source/NSFont.m
242
Source/NSFont.m
|
@ -978,121 +978,139 @@ static BOOL flip_hack;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
int version = [aDecoder versionForClassName: @"NSFont"];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
id name;
|
|
||||||
float fontMatrix[6];
|
|
||||||
BOOL fix;
|
|
||||||
int the_role;
|
|
||||||
|
|
||||||
if (version == 3)
|
|
||||||
{
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
NSString *name = [aDecoder decodeObjectForKey: @"NSName"];
|
||||||
at: &the_role];
|
int size = [aDecoder decodeIntForKey: @"NSSize"];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
the_role = RoleExplicit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (the_role == RoleExplicit)
|
|
||||||
{
|
|
||||||
/* The easy case: an explicit font, or a font encoded with
|
|
||||||
version <= 2. */
|
|
||||||
name = [aDecoder decodeObject];
|
|
||||||
[aDecoder decodeArrayOfObjCType: @encode(float)
|
|
||||||
count: 6
|
|
||||||
at: fontMatrix];
|
|
||||||
|
|
||||||
if (version >= 2)
|
|
||||||
{
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
|
||||||
at: &fix];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (fontMatrix[0] == fontMatrix[3]
|
|
||||||
&& fontMatrix[1] == 0.0 && fontMatrix[2] == 0.0)
|
|
||||||
fix = NO;
|
|
||||||
else
|
|
||||||
fix = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
self = [self initWithName: name
|
|
||||||
matrix: fontMatrix
|
|
||||||
fix: fix
|
|
||||||
screenFont: NO
|
|
||||||
role: RoleExplicit];
|
|
||||||
if (self)
|
|
||||||
return self;
|
|
||||||
|
|
||||||
self = [NSFont userFontOfSize: fontMatrix[0]];
|
|
||||||
NSAssert(self != nil, @"Couldn't find a valid font when decoding.");
|
|
||||||
return RETAIN(self);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* A non-explicit font. */
|
|
||||||
float size;
|
|
||||||
NSFont *new;
|
|
||||||
|
|
||||||
if (the_role & 1)
|
|
||||||
{
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float)
|
|
||||||
at: &size];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (the_role >> 1)
|
|
||||||
{
|
|
||||||
case RoleBoldSystemFont:
|
|
||||||
new = [NSFont boldSystemFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleSystemFont:
|
|
||||||
new = [NSFont systemFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleUserFixedPitchFont:
|
|
||||||
new = [NSFont userFixedPitchFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleTitleBarFont:
|
|
||||||
new = [NSFont titleBarFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleMenuFont:
|
|
||||||
new = [NSFont menuFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleMessageFont:
|
|
||||||
new = [NSFont messageFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RolePaletteFont:
|
|
||||||
new = [NSFont paletteFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleToolTipsFont:
|
|
||||||
new = [NSFont toolTipsFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleControlContentFont:
|
|
||||||
new = [NSFont controlContentFontOfSize: size];
|
|
||||||
break;
|
|
||||||
case RoleLabelFont:
|
|
||||||
new = [NSFont labelFontOfSize: size];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
NSDebugLLog(@"NSFont", @"unknown role %i", the_role);
|
|
||||||
/* fall through */
|
|
||||||
case RoleUserFont:
|
|
||||||
new = [NSFont userFontOfSize: size];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
if (new)
|
if ([aDecoder containsValueForKey: @"NSfFlags"])
|
||||||
return RETAIN(new);
|
{
|
||||||
|
//int flags = [aDecoder decodeIntForKey: @"NSfFlags"];
|
||||||
|
// FIXME
|
||||||
|
}
|
||||||
|
|
||||||
new = [NSFont userFontOfSize: size];
|
self = [NSFont fontWithName: name size: size];
|
||||||
NSAssert(new != nil, @"Couldn't find a valid font when decoding.");
|
return self;
|
||||||
return RETAIN(new);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int version = [aDecoder versionForClassName: @"NSFont"];
|
||||||
|
id name;
|
||||||
|
float fontMatrix[6];
|
||||||
|
BOOL fix;
|
||||||
|
int the_role;
|
||||||
|
|
||||||
|
if (version == 3)
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||||
|
at: &the_role];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
the_role = RoleExplicit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (the_role == RoleExplicit)
|
||||||
|
{
|
||||||
|
/* The easy case: an explicit font, or a font encoded with
|
||||||
|
version <= 2. */
|
||||||
|
name = [aDecoder decodeObject];
|
||||||
|
[aDecoder decodeArrayOfObjCType: @encode(float)
|
||||||
|
count: 6
|
||||||
|
at: fontMatrix];
|
||||||
|
|
||||||
|
if (version >= 2)
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||||
|
at: &fix];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (fontMatrix[0] == fontMatrix[3]
|
||||||
|
&& fontMatrix[1] == 0.0 && fontMatrix[2] == 0.0)
|
||||||
|
fix = NO;
|
||||||
|
else
|
||||||
|
fix = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
self = [self initWithName: name
|
||||||
|
matrix: fontMatrix
|
||||||
|
fix: fix
|
||||||
|
screenFont: NO
|
||||||
|
role: RoleExplicit];
|
||||||
|
if (self)
|
||||||
|
return self;
|
||||||
|
|
||||||
|
self = [NSFont userFontOfSize: fontMatrix[0]];
|
||||||
|
NSAssert(self != nil, @"Couldn't find a valid font when decoding.");
|
||||||
|
return RETAIN(self);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* A non-explicit font. */
|
||||||
|
float size;
|
||||||
|
NSFont *new;
|
||||||
|
|
||||||
|
if (the_role & 1)
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float)
|
||||||
|
at: &size];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (the_role >> 1)
|
||||||
|
{
|
||||||
|
case RoleBoldSystemFont:
|
||||||
|
new = [NSFont boldSystemFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleSystemFont:
|
||||||
|
new = [NSFont systemFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleUserFixedPitchFont:
|
||||||
|
new = [NSFont userFixedPitchFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleTitleBarFont:
|
||||||
|
new = [NSFont titleBarFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleMenuFont:
|
||||||
|
new = [NSFont menuFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleMessageFont:
|
||||||
|
new = [NSFont messageFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RolePaletteFont:
|
||||||
|
new = [NSFont paletteFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleToolTipsFont:
|
||||||
|
new = [NSFont toolTipsFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleControlContentFont:
|
||||||
|
new = [NSFont controlContentFontOfSize: size];
|
||||||
|
break;
|
||||||
|
case RoleLabelFont:
|
||||||
|
new = [NSFont labelFontOfSize: size];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NSDebugLLog(@"NSFont", @"unknown role %i", the_role);
|
||||||
|
/* fall through */
|
||||||
|
case RoleUserFont:
|
||||||
|
new = [NSFont userFontOfSize: size];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
RELEASE(self);
|
||||||
|
if (new)
|
||||||
|
return RETAIN(new);
|
||||||
|
|
||||||
|
new = [NSFont userFontOfSize: size];
|
||||||
|
NSAssert(new != nil, @"Couldn't find a valid font when decoding.");
|
||||||
|
return RETAIN(new);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,16 +302,35 @@ static NSImage *images[maxCount];
|
||||||
|
|
||||||
- (id)initWithCoder:(NSCoder *)aDecoder
|
- (id)initWithCoder:(NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder:aDecoder];
|
self = [super initWithCoder:aDecoder];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isIndeterminate];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isBezeled];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_usesThreadedAnimation];
|
//id *matrix = [aDecoder decodeObjectForKey: @"NSDrawMatrix"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSTimeInterval)
|
|
||||||
at:&_animationDelay];
|
if ([aDecoder containsValueForKey: @"NSMaxValue"])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double) at:&_doubleValue];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double) at:&_minValue];
|
int max = [aDecoder decodeIntForKey: @"NSMaxValue"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double) at:&_maxValue];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
|
[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];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(NSTimeInterval)
|
||||||
|
at:&_animationDelay];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(double) at:&_doubleValue];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(double) at:&_minValue];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(double) at:&_maxValue];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at:&_isVertical];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1237,93 +1237,86 @@ static float scrollerWidth;
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
int version = [aDecoder versionForClassName:
|
self = [super initWithCoder: aDecoder];
|
||||||
@"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];
|
|
||||||
[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];
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
|
||||||
if (_hasHeaderView)
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView];
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
|
||||||
|
|
||||||
[self tile];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
|
|
||||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
else if (version == 1)
|
|
||||||
{
|
{
|
||||||
[super initWithCoder: aDecoder];
|
NSClipView *content = [aDecoder decodeObjectForKey: @"NSContentView"];
|
||||||
|
NSScroller *hScroller = [aDecoder decodeObjectForKey: @"NSHScroller"];
|
||||||
|
NSScroller *vScroller = [aDecoder decodeObjectForKey: @"NSVScroller"];
|
||||||
|
|
||||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
if (content != nil)
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
[self setContentView: content];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
}
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
if (hScroller != nil)
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
[self setHorizontalScroller: hScroller];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
}
|
||||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
if (vScroller != nil)
|
||||||
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
[self setVerticalScroller: vScroller];
|
||||||
if (_hasHorizScroller)
|
}
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_horizScroller];
|
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||||
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
//int flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||||
if (_hasVertScroller)
|
// FIXME
|
||||||
[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
|
else
|
||||||
{
|
{
|
||||||
NSLog(@"unknown NSScrollView version (%d)", version);
|
int version = [aDecoder versionForClassName:
|
||||||
return nil;
|
@"NSScrollView"];
|
||||||
|
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];
|
||||||
|
|
||||||
|
if (version == 2)
|
||||||
|
{
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
||||||
|
if (_hasHeaderView)
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView];
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||||
|
}
|
||||||
|
else if (version == 1)
|
||||||
|
{
|
||||||
|
/* This recreates all the info about headerView, cornerView, etc */
|
||||||
|
[self setDocumentView: [_contentView documentView]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"unknown NSScrollView version (%d)", version);
|
||||||
|
DESTROY(self);
|
||||||
|
}
|
||||||
|
[self tile];
|
||||||
|
|
||||||
|
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -153,36 +153,69 @@ static NSColor *scrollBarColor = nil;
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
|
||||||
if (_frame.size.width > _frame.size.height)
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
_isHorizontal = YES;
|
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
|
else
|
||||||
{
|
{
|
||||||
_isHorizontal = NO;
|
if (_frame.size.width > _frame.size.height)
|
||||||
|
{
|
||||||
|
_isHorizontal = YES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isHorizontal = NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_isHorizontal)
|
||||||
|
{
|
||||||
|
_floatValue = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_floatValue = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_hitPart = NSScrollerNoPart;
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &_arrowsPosition];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isEnabled];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||||
|
// Undo RETAIN by decoder
|
||||||
|
TEST_RELEASE(_target);
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||||
|
|
||||||
|
[self drawParts];
|
||||||
|
[self checkSpaceForParts];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isHorizontal)
|
|
||||||
{
|
|
||||||
_floatValue = 0.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_floatValue = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_hitPart = NSScrollerNoPart;
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &_arrowsPosition];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isEnabled];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_target];
|
|
||||||
// Undo RETAIN by decoder
|
|
||||||
TEST_RELEASE(_target);
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
|
||||||
|
|
||||||
[self drawParts];
|
|
||||||
[self checkSpaceForParts];
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
161
Source/NSView.m
161
Source/NSView.m
|
@ -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,71 +3620,109 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
NSRect rect;
|
if ([aDecoder allowsKeyedCoding])
|
||||||
NSEnumerator *e;
|
|
||||||
NSView *sub;
|
|
||||||
NSArray *subs;
|
|
||||||
|
|
||||||
self = [super initWithCoder: aDecoder];
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSView", @"NSView: start decoding\n");
|
|
||||||
|
|
||||||
_frame = [aDecoder decodeRect];
|
|
||||||
_bounds.origin = NSZeroPoint;
|
|
||||||
_bounds.size = _frame.size;
|
|
||||||
|
|
||||||
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
|
|
||||||
_boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds
|
|
||||||
_matrixToWindow = [NSAffineTransform new]; // Map to window coordinates
|
|
||||||
_matrixFromWindow = [NSAffineTransform new]; // Map from window coordinates
|
|
||||||
[_frameMatrix setFrameOrigin: _frame.origin];
|
|
||||||
|
|
||||||
rect = [aDecoder decodeRect];
|
|
||||||
[self setBounds: rect];
|
|
||||||
|
|
||||||
_sub_views = [NSMutableArray new];
|
|
||||||
_tracking_rects = [NSMutableArray new];
|
|
||||||
_cursor_rects = [NSMutableArray new];
|
|
||||||
|
|
||||||
_super_view = nil;
|
|
||||||
_window = nil;
|
|
||||||
_rFlags.needs_display = YES;
|
|
||||||
_coordinates_valid = NO;
|
|
||||||
|
|
||||||
_rFlags.flipped_view = [self isFlipped];
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_rotated_from_base];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
|
||||||
at: &_is_rotated_or_scaled_from_base];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_post_frame_changes];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoresizes_subviews];
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
|
||||||
at: &_autoresizingMask];
|
|
||||||
[self setNextKeyView: [aDecoder decodeObject]];
|
|
||||||
[[aDecoder decodeObject] setNextKeyView: self];
|
|
||||||
|
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
|
||||||
e = [subs objectEnumerator];
|
|
||||||
while ((sub = [e nextObject]) != nil)
|
|
||||||
{
|
{
|
||||||
NSAssert(sub->_window == nil, NSInternalInconsistencyException);
|
NSRect frame = NSZeroRect;
|
||||||
NSAssert(sub->_super_view == nil, NSInternalInconsistencyException);
|
id next = [aDecoder decodeObjectForKey: @"NSNextResponder"];
|
||||||
[sub viewWillMoveToWindow: _window];
|
//NSView *superView = [aDecoder decodeObjectForKey: @"NSSuperview"];
|
||||||
[sub viewWillMoveToSuperview: self];
|
NSView *nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||||
[sub setNextResponder: self];
|
NSArray *subViews = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
||||||
[_sub_views addObject: sub];
|
|
||||||
_rFlags.has_subviews = 1;
|
if ([aDecoder containsValueForKey: @"NSFrame"])
|
||||||
[sub resetCursorRects];
|
{
|
||||||
[sub setNeedsDisplay: YES];
|
frame = [aDecoder decodeRectForKey: @"NSFrame"];
|
||||||
[sub viewDidMoveToWindow];
|
}
|
||||||
[sub viewDidMoveToSuperview];
|
self = [self initWithFrame: frame];
|
||||||
[self didAddSubview: sub];
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RELEASE(subs);
|
else
|
||||||
|
{
|
||||||
|
NSRect rect;
|
||||||
|
NSEnumerator *e;
|
||||||
|
NSView *sub;
|
||||||
|
NSArray *subs;
|
||||||
|
|
||||||
|
self = [super initWithCoder: aDecoder];
|
||||||
|
|
||||||
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
NSDebugLLog(@"NSView", @"NSView: start decoding\n");
|
||||||
|
|
||||||
|
_frame = [aDecoder decodeRect];
|
||||||
|
_bounds.origin = NSZeroPoint;
|
||||||
|
_bounds.size = _frame.size;
|
||||||
|
|
||||||
|
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
|
||||||
|
_boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds
|
||||||
|
_matrixToWindow = [NSAffineTransform new]; // Map to window coordinates
|
||||||
|
_matrixFromWindow = [NSAffineTransform new];// Map from window coordinates
|
||||||
|
[_frameMatrix setFrameOrigin: _frame.origin];
|
||||||
|
|
||||||
|
rect = [aDecoder decodeRect];
|
||||||
|
[self setBounds: rect];
|
||||||
|
|
||||||
|
_sub_views = [NSMutableArray new];
|
||||||
|
_tracking_rects = [NSMutableArray new];
|
||||||
|
_cursor_rects = [NSMutableArray new];
|
||||||
|
|
||||||
|
_super_view = nil;
|
||||||
|
_window = nil;
|
||||||
|
_rFlags.needs_display = YES;
|
||||||
|
_coordinates_valid = NO;
|
||||||
|
|
||||||
|
_rFlags.flipped_view = [self isFlipped];
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_rotated_from_base];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||||
|
at: &_is_rotated_or_scaled_from_base];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_post_frame_changes];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoresizes_subviews];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &_autoresizingMask];
|
||||||
|
[self setNextKeyView: [aDecoder decodeObject]];
|
||||||
|
[[aDecoder decodeObject] setNextKeyView: self];
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
||||||
|
e = [subs objectEnumerator];
|
||||||
|
while ((sub = [e nextObject]) != nil)
|
||||||
|
{
|
||||||
|
NSAssert(sub->_window == nil, NSInternalInconsistencyException);
|
||||||
|
NSAssert(sub->_super_view == nil, NSInternalInconsistencyException);
|
||||||
|
[sub viewWillMoveToWindow: _window];
|
||||||
|
[sub viewWillMoveToSuperview: self];
|
||||||
|
[sub setNextResponder: self];
|
||||||
|
[_sub_views addObject: sub];
|
||||||
|
_rFlags.has_subviews = 1;
|
||||||
|
[sub resetCursorRects];
|
||||||
|
[sub setNeedsDisplay: YES];
|
||||||
|
[sub viewDidMoveToWindow];
|
||||||
|
[sub viewDidMoveToSuperview];
|
||||||
|
[self didAddSubview: sub];
|
||||||
|
}
|
||||||
|
RELEASE(subs);
|
||||||
|
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue