First pass - XIB 5 loading - much work still needed - currently limits changes to

initWithCoder methods and encompasses entire loading to translate XIB 5 into older
XIB key processing.  ALl this eventually should be cleaned up properly but done
this way in order to expedite the code push into svn for Testplant usage.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40300 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2017-01-25 15:49:14 +00:00
parent 741024d6ed
commit 31f52310df
30 changed files with 4840 additions and 1292 deletions

View file

@ -213,6 +213,7 @@ typedef struct _GSWindowTemplateFlags
- (NSString *)className; - (NSString *)className;
- (void) setExtension: (NSString *)ext; - (void) setExtension: (NSString *)ext;
- (NSString *)extension; - (NSString *)extension;
- (void) setRealObject: (id)obj;
@end @end
@interface NSCustomView : NSView <GSNibLoading> @interface NSCustomView : NSView <GSNibLoading>

View file

@ -38,7 +38,7 @@
@interface GSXibElement: NSObject @interface GSXibElement: NSObject
{ {
NSString *type; NSString *type;
NSDictionary *attributes; NSMutableDictionary *attributes;
NSString *value; NSString *value;
NSMutableDictionary *elements; NSMutableDictionary *elements;
NSMutableArray *values; NSMutableArray *values;
@ -60,3 +60,6 @@
#endif #endif
@interface GSXib5Element : GSXibElement
- (void) setAttribute: (id)attribute forKey: (NSString*)key;
@end

View file

@ -191,16 +191,4 @@
@end @end
@interface GSXibKeyedUnarchiver: NSKeyedUnarchiver
{
NSMutableDictionary *objects;
NSMutableArray *stack;
GSXibElement *currentElement;
NSMutableDictionary *decoded;
}
- (id) _decodeArrayOfObjectsForElement: (GSXibElement*)element;
- (id) _decodeDictionaryOfObjectsForElement: (GSXibElement*)element;
@end
#endif #endif

View file

@ -114,6 +114,87 @@ typedef enum _NSGradientType {
NSGradientConvexStrong NSGradientConvexStrong
} NSGradientType; } NSGradientType;
typedef struct _GSButtonCellFlags
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int isPushin:1;
unsigned int changeContents:1;
unsigned int changeBackground:1;
unsigned int changeGray:1;
unsigned int highlightByContents:1;
unsigned int highlightByBackground:1;
unsigned int highlightByGray:1;
unsigned int drawing:1;
unsigned int isBordered:1;
unsigned int imageDoesOverlap:1;
unsigned int isHorizontal:1;
unsigned int isBottomOrLeft:1;
unsigned int isImageAndText:1;
unsigned int isImageSizeDiff:1;
unsigned int hasKeyEquiv:1;
unsigned int lastState:1;
unsigned int isTransparent:1;
unsigned int inset:2; // inset:2
unsigned int doesNotDimImage:1; //doesn't dim:1
unsigned int gradient:3; // gradient:3
unsigned int useButtonImageSource:1;
unsigned int unused2:8; // alt mnemonic loc.
#else
unsigned int unused2:8; // alt mnemonic loc.
unsigned int useButtonImageSource:1;
unsigned int gradient:3; // gradient:3
unsigned int doesNotDimImage:1; // doesn't dim:1
unsigned int inset:2; // inset:2
unsigned int isTransparent:1;
unsigned int lastState:1;
unsigned int hasKeyEquiv:1;
unsigned int isImageSizeDiff:1;
unsigned int isImageAndText:1;
unsigned int isBottomOrLeft:1;
unsigned int isHorizontal:1;
unsigned int imageDoesOverlap:1;
unsigned int isBordered:1;
unsigned int drawing:1;
unsigned int highlightByGray:1;
unsigned int highlightByBackground:1;
unsigned int highlightByContents:1;
unsigned int changeGray:1;
unsigned int changeBackground:1;
unsigned int changeContents:1;
unsigned int isPushin:1;
#endif
} GSButtonCellFlags;
typedef struct _GSButtonCellFlags2 {
#if GS_WORDS_BIGENDIAN == 1
unsigned int keyEquivalentModifierMask:24;
unsigned int imageScaling:2;
unsigned int bezelStyle2:1;
unsigned int mouseInside:1;
unsigned int showsBorderOnlyWhileMouseInside:1;
unsigned int bezelStyle:3;
#else
unsigned int bezelStyle:3;
unsigned int showsBorderOnlyWhileMouseInside:1;
unsigned int mouseInside:1;
unsigned int bezelStyle2:1;
unsigned int imageScaling:2;
unsigned int keyEquivalentModifierMask:24;
#endif
} GSButtonCellFlags2;
@interface NSCell (Private)
- (NSSize) _scaleImageWithSize: (NSSize)imageSize
toFitInSize: (NSSize)canvasSize
scalingType: (NSImageScaling)scalingType;
@end
@interface NSButtonCell : NSActionCell @interface NSButtonCell : NSActionCell
{ {

View file

@ -163,6 +163,184 @@ enum {
}; };
typedef NSInteger NSBackgroundStyle; typedef NSInteger NSBackgroundStyle;
enum __NSControlSize {
NSControlSizeRegular,
NSControlSizeSmall,
NSControlSizeMini
};
typedef struct _GSCellFlags {
#if GS_WORDS_BIGENDIAN == 1
unsigned int state:1;
unsigned int highlighted:1;
unsigned int disabled:1;
unsigned int editable:1;
NSCellType type:2;
unsigned int vCentered:1;
unsigned int hCentered:1;
unsigned int bordered:1;
unsigned int bezeled:1;
unsigned int selectable:1;
unsigned int scrollable:1;
unsigned int continuous:1;
unsigned int actOnMouseDown:1;
unsigned int isLeaf:1;
unsigned int invalidObjectValue:1;
unsigned int invalidFont:1;
NSLineBreakMode lineBreakMode:3;
unsigned int weakTargetHelperFlag:1;
unsigned int allowsAppearanceEffects:1;
unsigned int singleLineMode:1;
unsigned int actOnMouseDragged:1;
unsigned int isLoaded:1;
unsigned int truncateLastLine:1;
unsigned int dontActOnMouseUp:1;
unsigned int isWhite:1;
unsigned int useUserKeyEquivalent:1;
unsigned int showsFirstResponder:1;
unsigned int focusRingType:2;
#if 0 // FROM COCOA...
// 32 BIT BREAK
unsigned int wasSelectable:1;
unsigned int hasInvalidObject:1;
unsigned int allowsEditingTextAttributes:1;
unsigned int importsGraphics:1;
NSTextAlignment alignment:3;
unsigned int layoutDirectionRTL:1;
unsigned int backgroundStyle:3;
unsigned int cellReserved2:4;
unsigned int refusesFirstResponder:1;
unsigned int needsHighlightedText:1;
unsigned int dontAllowsUndo:1;
unsigned int currentlyEditing:1;
unsigned int allowsMixedState:1;
unsigned int inMixedState:1;
unsigned int sendsActionOnEndEditing:1;
unsigned int inSendAction:1;
unsigned int menuWasSet:1;
unsigned int controlTint:3;
unsigned int controlSize:2;
unsigned int branchImageDisabled:1;
unsigned int drawingInRevealover:1;
unsigned int needsHighlightedTextHint:1;
#endif
#else
#if 0 // FROM COCOA...
unsigned int needsHighlightedTextHint:1;
unsigned int drawingInRevealover:1;
unsigned int branchImageDisabled:1;
unsigned int controlSize:2;
unsigned int controlTint:3;
unsigned int menuWasSet:1;
unsigned int inSendAction:1;
unsigned int sendsActionOnEndEditing:1;
unsigned int inMixedState:1;
unsigned int allowsMixedState:1;
unsigned int currentlyEditing:1;
unsigned int dontAllowsUndo:1;
unsigned int needsHighlightedText:1;
unsigned int refusesFirstResponder:1;
unsigned int cellReserved2:4;
unsigned int backgroundStyle:3;
unsigned int layoutDirectionRTL:1;
NSTextAlignment alignment:3;
unsigned int importsGraphics:1;
unsigned int allowsEditingTextAttributes:1;
unsigned int hasInvalidObject:1;
unsigned int wasSelectable:1;
// 32 BIT BREAK
#endif
unsigned int focusRingType:2;
unsigned int showsFirstResponder:1;
unsigned int useUserKeyEquivalent:1;
unsigned int isWhite:1;
unsigned int dontActOnMouseUp:1;
unsigned int truncateLastLine:1;
unsigned int isLoaded:1;
unsigned int actOnMouseDragged:1;
unsigned int singleLineMode:1;
unsigned int allowsAppearanceEffects:1;
unsigned int weakTargetHelperFlag:1;
NSLineBreakMode lineBreakMode:3;
unsigned int invalidFont:1;
unsigned int invalidObjectValue:1;
unsigned int isLeaf:1;
unsigned int actOnMouseDown:1;
unsigned int continuous:1;
unsigned int scrollable:1;
unsigned int selectable:1;
unsigned int bezeled:1;
unsigned int bordered:1;
unsigned int hCentered:1;
unsigned int vCentered:1;
NSCellType type:2;
unsigned int editable:1;
unsigned int disabled:1;
unsigned int highlighted:1;
unsigned int state:1;
#endif
} GSCellFlags;
typedef union _GSCellFlagsUnion
{
GSCellFlags flags;
uint32_t value;
} GSCellFlagsUnion;
typedef struct _GSCellflags2
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int unused1:1;
unsigned int allowsEditingTextAttributes:1;
unsigned int importsGraphics:1;
unsigned int alignment:3;
unsigned int refusesFirstResponder:1;
unsigned int allowsMixedState:1;
unsigned int unused2:1;
unsigned int sendsActionOnEndEditing:1;
unsigned int unused3:2;
unsigned int controlSize:3;
unsigned int unused4:4;
unsigned int doesNotAllowUndo:1;
unsigned int lineBreakMode:3;
unsigned int unused5:1;
unsigned int controlTint:3;
unsigned int unused6:5;
#else
unsigned int unused6:5;
unsigned int controlTint:3;
unsigned int unused5:1;
unsigned int lineBreakMode:3;
unsigned int doesNotAllowUndo:1;
unsigned int unused4:4;
unsigned int controlSize:3;
unsigned int unused3:2;
unsigned int sendsActionOnEndEditing:1;
unsigned int unused2:1;
unsigned int allowsMixedState:1;
unsigned int refusesFirstResponder:1;
unsigned int alignment:3;
unsigned int importsGraphics:1;
unsigned int allowsEditingTextAttributes:1;
unsigned int unused1:1;
#endif
} GSCellFlags2;
typedef union _GSCellFlags2Union
{
GSCellFlags2 flags;
uint32_t value;
} GSCellFlags2Union;
@interface NSCell : NSObject <NSCopying, NSCoding> @interface NSCell : NSObject <NSCopying, NSCoding>
{ {
// Attributes // Attributes
@ -170,7 +348,7 @@ typedef NSInteger NSBackgroundStyle;
NSImage *_cell_image; NSImage *_cell_image;
NSFont *_font; NSFont *_font;
id _object_value; id _object_value;
struct GSCellFlagsType { struct GSCellFlagsType {
// total 32 bits. 0 bits left. // total 32 bits. 0 bits left.
unsigned contents_is_attributed_string: 1; unsigned contents_is_attributed_string: 1;
unsigned is_highlighted: 1; unsigned is_highlighted: 1;

View file

@ -49,6 +49,46 @@ typedef enum _NSMatrixMode {
NSTrackModeMatrix NSTrackModeMatrix
} NSMatrixMode; } NSMatrixMode;
typedef struct _GSMatrixFlags {
#if GS_WORDS_BIGENDIAN == 1
unsigned int isHighlight:1;
unsigned int isRadio:1;
unsigned int isList:1;
unsigned int allowsEmptySelection:1;
unsigned int autoScroll:1;
unsigned int selectionByRect:1;
unsigned int drawCellBackground:1;
unsigned int drawBackground:1;
unsigned int autosizesCells:1;
unsigned int drawingAncestor:1;
unsigned int tabKeyTraversesCells:1;
unsigned int tabKeyTraversesCellsExplicitly:1;
unsigned int canSearchIncrementally:1;
unsigned int unused:19;
#else
unsigned int unused:19;
unsigned int canSearchIncrementally:1;
unsigned int tabKeyTraversesCellsExplicitly:1;
unsigned int tabKeyTraversesCells:1;
unsigned int drawingAncestor:1;
unsigned int autosizesCells:1;
unsigned int drawBackground:1;
unsigned int drawCellBackground:1;
unsigned int selectionByRect:1;
unsigned int autoScroll:1;
unsigned int allowsEmptySelection:1;
unsigned int isList:1;
unsigned int isRadio:1;
unsigned int isHighlight:1;
#endif
} GSMatrixFlags;
typedef union _GSMatrixFlagsUnion
{
GSMatrixFlags flags;
unsigned int value;
} GSMatrixFlagsUnion;
@protocol NSMatrixDelegate <NSControlTextEditingDelegate> @protocol NSMatrixDelegate <NSControlTextEditingDelegate>
@end @end

View file

@ -38,6 +38,9 @@
enum { enum {
NSSplitViewDividerStyleThick = 1, NSSplitViewDividerStyleThick = 1,
NSSplitViewDividerStyleThin = 2, NSSplitViewDividerStyleThin = 2,
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
NSSplitViewDividerStylePaneSplitter = 3,
#endif
}; };
typedef NSInteger NSSplitViewDividerStyle; typedef NSInteger NSSplitViewDividerStyle;
#endif #endif

View file

@ -45,6 +45,31 @@ typedef enum {
@class NSFont; @class NSFont;
@class NSTabViewItem; @class NSTabViewItem;
typedef struct _GSTabViewTypeFlags
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int reserved1:1;
unsigned int controlTint:3;
unsigned int controlSize:2;
unsigned int reserved2:18;
unsigned int tabPosition:5;
unsigned int tabViewBorderType:3;
#else
unsigned int tabViewBorderType:3;
unsigned int tabPosition:5;
unsigned int reserved2:18;
unsigned int controlSize:2;
unsigned int controlTint:3;
unsigned int reserved1:1;
#endif
} GSTabViewTypeFlags;
typedef union _GSTabViewTypeFlagsUnion
{
GSTabViewTypeFlags flags;
unsigned int value;
} GSTabViewTypeFlagsUnion;
@interface NSTabView : NSView <NSCoding> @interface NSTabView : NSView <NSCoding>
{ {
NSMutableArray *_items; NSMutableArray *_items;

View file

@ -90,6 +90,35 @@ typedef enum _NSTableViewAnimationOptions
} NSTableViewAnimationOptions; } NSTableViewAnimationOptions;
#endif #endif
/*
* Nib compatibility struct. This structure is used to
* pull the attributes out of the nib that we need to fill
* in the flags.
*/
typedef struct _tableViewFlags
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int columnOrdering:1;
unsigned int columnResizing:1;
unsigned int drawsGrid:1;
unsigned int emptySelection:1;
unsigned int multipleSelection:1;
unsigned int columnSelection:1;
unsigned int columnAutosave:1;
unsigned int _unused:24;
#else
unsigned int _unused:24;
unsigned int columnAutosave:1;
unsigned int unknown1:1;
unsigned int columnSelection:1;
unsigned int multipleSelection:1;
unsigned int emptySelection:1;
unsigned int drawsGrid:1;
unsigned int columnResizing:1;
unsigned int columnOrdering:1;
#endif
} GSTableViewFlags;
@interface NSTableView : NSControl <NSUserInterfaceValidations> @interface NSTableView : NSControl <NSUserInterfaceValidations>
{ {

View file

@ -96,6 +96,33 @@ typedef enum _NSFocusRingType {
NSFocusRingTypeExterior = 2 NSFocusRingTypeExterior = 2
} NSFocusRingType; } NSFocusRingType;
typedef struct _GSvFlags
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int isHidden:1;
unsigned int unused1:3;
unsigned int unused2:4;
unsigned int unused3:4;
unsigned int unused4:4;
unsigned int unused5:4;
unsigned int unused6:3;
unsigned int autoresizesSubviews:1;
unsigned int unused7:2;
unsigned int autoresizingMask:6;
#else
unsigned int autoresizingMask:6;
unsigned int unused7:2;
unsigned int autoresizesSubviews:1;
unsigned int unused6:3;
unsigned int unused5:4;
unsigned int unused4:4;
unsigned int unused3:4;
unsigned int unused2:4;
unsigned int unused1:3;
unsigned int isHidden:1;
#endif
} GSvFlags;
@interface NSView : NSResponder @interface NSView : NSResponder
{ {
NSRect _frame; NSRect _frame;

View file

@ -254,6 +254,8 @@ GSNibLoader.m \
GSXibElement.m \ GSXibElement.m \
GSXibLoader.m \ GSXibLoader.m \
GSXibLoading.m \ GSXibLoading.m \
GSXibKeyedUnarchiver.m \
GSXib5KeyedUnarchiver.m \
GSXibObjectContainer.m \ GSXibObjectContainer.m \
GSXibParser.m \ GSXibParser.m \
GSHelpAttachment.m GSHelpAttachment.m

View file

@ -52,6 +52,7 @@
#import "GNUstepGUI/GSNibLoading.h" #import "GNUstepGUI/GSNibLoading.h"
#import "AppKit/NSApplication.h" #import "AppKit/NSApplication.h"
#import "AppKit/NSFontManager.h"
#import "AppKit/NSImage.h" #import "AppKit/NSImage.h"
#import "AppKit/NSMenuItem.h" #import "AppKit/NSMenuItem.h"
#import "AppKit/NSMenuView.h" #import "AppKit/NSMenuView.h"
@ -339,6 +340,10 @@ static BOOL _isInInterfaceBuilder = NO;
{ {
if ([coder allowsKeyedCoding]) if ([coder allowsKeyedCoding])
{ {
_windowStyle = 0;
_viewClass = @"NSView";
_windowClass = @"NSWindow";
if ([coder containsValueForKey: @"NSViewClass"]) if ([coder containsValueForKey: @"NSViewClass"])
{ {
ASSIGN(_viewClass, [coder decodeObjectForKey: @"NSViewClass"]); ASSIGN(_viewClass, [coder decodeObjectForKey: @"NSViewClass"]);
@ -347,6 +352,10 @@ static BOOL _isInInterfaceBuilder = NO;
{ {
ASSIGN(_windowClass, [coder decodeObjectForKey: @"NSWindowClass"]); ASSIGN(_windowClass, [coder decodeObjectForKey: @"NSWindowClass"]);
} }
else
{
ASSIGN(_windowClass, @"NSWindow");
}
if ([coder containsValueForKey: @"NSWindowStyleMask"]) if ([coder containsValueForKey: @"NSWindowStyleMask"])
{ {
_windowStyle = [coder decodeIntForKey: @"NSWindowStyleMask"]; _windowStyle = [coder decodeIntForKey: @"NSWindowStyleMask"];
@ -401,7 +410,7 @@ static BOOL _isInInterfaceBuilder = NO;
} }
if ([coder containsValueForKey: @"NSFrameAutosaveName"]) if ([coder containsValueForKey: @"NSFrameAutosaveName"])
{ {
ASSIGN(_autosaveName, [coder decodeObjectForKey: @"NSFrameAutosaveName"]); ASSIGN(_autosaveName, [coder decodeObjectForKey: @"NSFrameAutosaveName"]);
} }
if ([coder containsValueForKey: @"NSWindowTitle"]) if ([coder containsValueForKey: @"NSWindowTitle"])
{ {
@ -467,12 +476,11 @@ static BOOL _isInInterfaceBuilder = NO;
format: @"Unable to find class '%@'", _windowClass]; format: @"Unable to find class '%@'", _windowClass];
} }
_realObject = [[aClass allocWithZone: NSDefaultMallocZone()] _realObject = [[aClass allocWithZone: NSDefaultMallocZone()] initWithContentRect: _windowRect
initWithContentRect: _windowRect styleMask: _windowStyle
styleMask: _windowStyle backing: _backingStoreType
backing: _backingStoreType defer: _flags.isDeferred];
defer: _flags.isDeferred];
// set flags... // set flags...
[_realObject setHidesOnDeactivate: _flags.isHiddenOnDeactivate]; [_realObject setHidesOnDeactivate: _flags.isHiddenOnDeactivate];
[_realObject setReleasedWhenClosed: !(_flags.isNotReleasedOnClose)]; [_realObject setReleasedWhenClosed: !(_flags.isNotReleasedOnClose)];
@ -493,10 +501,10 @@ static BOOL _isInInterfaceBuilder = NO;
[_realObject setTitle: _title]; [_realObject setTitle: _title];
if ([_viewClass isKindOfClass: [NSToolbar class]]) if ([_viewClass isKindOfClass: [NSToolbar class]])
{ {
// FIXME: No idea what is going on here // FIXME: No idea what is going on here
[_realObject setToolbar: (NSToolbar*)_viewClass]; [_realObject setToolbar: (NSToolbar*)_viewClass];
} }
[_realObject setContentMinSize: _minSize]; [_realObject setContentMinSize: _minSize];
[_realObject setContentMaxSize: _maxSize]; [_realObject setContentMaxSize: _maxSize];
@ -506,11 +514,11 @@ static BOOL _isInInterfaceBuilder = NO;
// FIXME What is the point of calling -setFrame:display: here? It looks // FIXME What is the point of calling -setFrame:display: here? It looks
// like an effective no op to me. // like an effective no op to me.
// resize the window... // resize the window...
[_realObject setFrame: [NSWindow frameRectForContentRect: [self windowRect] [_realObject setFrame: [NSWindow frameRectForContentRect: [self windowRect]
styleMask: [self windowStyle]] styleMask: [self windowStyle]]
display: NO]; display: NO];
[_realObject setFrameAutosaveName: _autosaveName]; [_realObject setFrameAutosaveName: _autosaveName];
} }
return _realObject; return _realObject;
} }
@ -914,6 +922,7 @@ static BOOL _isInInterfaceBuilder = NO;
@end @end
@implementation NSCustomObject @implementation NSCustomObject
- (void) setClassName: (NSString *)name - (void) setClassName: (NSString *)name
{ {
ASSIGNCOPY(_className, name); ASSIGNCOPY(_className, name);
@ -999,16 +1008,22 @@ static BOOL _isInInterfaceBuilder = NO;
format: @"Unable to find class '%@'", _className]; format: @"Unable to find class '%@'", _className];
} }
if (GSObjCIsKindOf(aClass, [NSApplication class]) || if ((GSObjCIsKindOf(aClass, [NSApplication class])) ||
[_className isEqual: @"NSApplication"]) ([_className isEqual: @"NSApplication"]))
{ {
_object = RETAIN([aClass sharedApplication]); _object = RETAIN([aClass sharedApplication]);
} }
else if ((GSObjCIsKindOf(aClass, [NSFontManager class])) ||
([_className isEqual: @"NSFontManager"]))
{
_object = RETAIN([aClass sharedFontManager]);
}
else else
{ {
_object = [[aClass allocWithZone: NSDefaultMallocZone()] init]; _object = [[aClass allocWithZone: NSDefaultMallocZone()] init];
} }
} }
return _object; return _object;
} }

View file

@ -0,0 +1,41 @@
/** <title>GSXibParserDelegate.h</title>
<abstract>The XIB 5 keyed unarchiver</abstract>
Copyright (C) 1996-2017 Free Software Foundation, Inc.
Author: Marcian Lytwyn <gnustep@advcsi.com>
Date: 12/28/16
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/Foundation.h>
#import "GSXibKeyedUnarchiver.h"
@class GSXib5Element;
@interface GSXib5KeyedUnarchiver : GSXibKeyedUnarchiver
{
NSDictionary *_context;
}
- (NSRange) decodeRangeForKey: (NSString*)key;
- (void) setContext: (NSDictionary*)context;
@end

File diff suppressed because it is too large Load diff

View file

@ -34,11 +34,11 @@
@implementation GSXibElement @implementation GSXibElement
- (GSXibElement*) initWithType: (NSString*)typeName - (GSXibElement*) initWithType: (NSString*)typeName
andAttributes: (NSDictionary*)attribs andAttributes: (NSDictionary*)attribs
{ {
ASSIGN(type, typeName); ASSIGN(type, typeName);
ASSIGN(attributes, attribs); ASSIGN(attributes, AUTORELEASE([attribs mutableCopy]));
elements = [[NSMutableDictionary alloc] init]; elements = [[NSMutableDictionary alloc] init];
values = [[NSMutableArray alloc] init]; values = [[NSMutableArray alloc] init];
@ -114,3 +114,11 @@
@end @end
@implementation GSXib5Element
- (void) setAttribute: (id)attribute forKey: (NSString*)key
{
[attributes setObject:attribute forKey:key];
}
@end

View file

@ -0,0 +1,52 @@
/** <title>GSXibKeyedUnarchiver.h</title>
<abstract>
These are templates for use with OSX XIB 5 files. These classes are the
templates and other things which are needed for reading XIB 5 files.
</abstract>
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
File created by Marcian Lytwyn on 12/30/16 from original code by:
Author: Gregory John Casamento
Date: 2003, 2005
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/Foundation.h>
@class GSXibElement;
@interface GSXibKeyedUnarchiver : NSKeyedUnarchiver
{
NSMutableDictionary *objects;
NSMutableArray *stack;
GSXibElement *currentElement;
NSMutableDictionary *decoded;
}
- (id) decodeObjectForXib: (GSXibElement*)element
forClassName: (NSString*)classname
withID: (NSString*)objID;
- (id) _decodeArrayOfObjectsForElement: (GSXibElement*)element;
- (id) _decodeDictionaryOfObjectsForElement: (GSXibElement*)element;
- (id) objectForXib: (GSXibElement*)element;
@end

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -65,6 +65,17 @@
return value; return value;
} }
- (NSString*) description
{
NSMutableString *description = [[super description] mutableCopy];
[description appendString: @" <"];
[description appendFormat: @" type: %@", typeIdentifier];
[description appendFormat: @" keyPath: %@", keyPath];
[description appendFormat: @" value: %@", value];
[description appendString: @">"];
return AUTORELEASE(description);
}
@end @end
@implementation IBUserDefinedRuntimeAttributesPlaceholder @implementation IBUserDefinedRuntimeAttributesPlaceholder

View file

@ -59,59 +59,6 @@
#include <math.h> #include <math.h>
typedef struct _GSButtonCellFlags
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int isPushin:1;
unsigned int changeContents:1;
unsigned int changeBackground:1;
unsigned int changeGray:1;
unsigned int highlightByContents:1;
unsigned int highlightByBackground:1;
unsigned int highlightByGray:1;
unsigned int drawing:1;
unsigned int isBordered:1;
unsigned int imageDoesOverlap:1;
unsigned int isHorizontal:1;
unsigned int isBottomOrLeft:1;
unsigned int isImageAndText:1;
unsigned int isImageSizeDiff:1;
unsigned int hasKeyEquiv:1;
unsigned int lastState:1;
unsigned int isTransparent:1;
unsigned int unused1:6; // inset:2 doesn't dim:1 gradient:3
unsigned int useButtonImageSource:1;
unsigned int unused2:8; // alt mnemonic loc.
#else
unsigned int unused2:8; // alt mnemonic loc.
unsigned int useButtonImageSource:1;
unsigned int unused1:6; // inset:2 doesn't dim:1 gradient:3
unsigned int isTransparent:1;
unsigned int lastState:1;
unsigned int hasKeyEquiv:1;
unsigned int isImageSizeDiff:1;
unsigned int isImageAndText:1;
unsigned int isBottomOrLeft:1;
unsigned int isHorizontal:1;
unsigned int imageDoesOverlap:1;
unsigned int isBordered:1;
unsigned int drawing:1;
unsigned int highlightByGray:1;
unsigned int highlightByBackground:1;
unsigned int highlightByContents:1;
unsigned int changeGray:1;
unsigned int changeBackground:1;
unsigned int changeContents:1;
unsigned int isPushin:1;
#endif
} GSButtonCellFlags;
@interface NSCell (Private)
- (NSSize) _scaleImageWithSize: (NSSize)imageSize
toFitInSize: (NSSize)canvasSize
scalingType: (NSImageScaling)scalingType;
@end
/**<p> TODO Description</p> /**<p> TODO Description</p>
*/ */
@implementation NSButtonCell @implementation NSButtonCell
@ -1105,10 +1052,11 @@ typedef struct _GSButtonCellFlags
// The inside check could also be done via a track rect, but then this would // The inside check could also be done via a track rect, but then this would
// only work with specially prepared controls. Therefore we dont use // only work with specially prepared controls. Therefore we dont use
// _mouse_inside here. // _mouse_inside here.
if ((_cell.is_bordered) && (_bezel_style != NSCircularBezelStyle) if ((_cell.is_bordered) &&
&& (!_shows_border_only_while_mouse_inside (_bezel_style != NSCircularBezelStyle) &&
|| [controlView mouse: [[controlView window] mouseLocationOutsideOfEventStream] (!_shows_border_only_while_mouse_inside
inRect: cellFrame])) || [controlView mouse: [[controlView window] mouseLocationOutsideOfEventStream]
inRect: cellFrame]))
{ {
// Testplat-MAL-2015-08-22: Turns out this draw is using the full // Testplat-MAL-2015-08-22: Turns out this draw is using the full
// frame as opposed to the reduced frame. This ends up drawing // frame as opposed to the reduced frame. This ends up drawing
@ -1698,7 +1646,9 @@ typedef struct _GSButtonCellFlags
buttonCellFlags.changeGray = [self cellAttribute: NSChangeGrayCell]; buttonCellFlags.changeGray = [self cellAttribute: NSChangeGrayCell];
// set these to zero... // set these to zero...
buttonCellFlags.unused1 = 0; // 32; buttonCellFlags.inset = 0; // 32;
buttonCellFlags.doesNotDimImage = 0; // 32;
buttonCellFlags.gradient = 0; // 32;
buttonCellFlags.unused2 = 0; // 255; buttonCellFlags.unused2 = 0; // 255;
buttonCellFlags.lastState = 0; buttonCellFlags.lastState = 0;
buttonCellFlags.isImageSizeDiff = 0; buttonCellFlags.isImageSizeDiff = 0;
@ -1836,8 +1786,9 @@ typedef struct _GSButtonCellFlags
} }
if ([aDecoder containsValueForKey: @"NSButtonFlags"]) if ([aDecoder containsValueForKey: @"NSButtonFlags"])
{ {
unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"]; unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
GSButtonCellFlags buttonCellFlags; GSButtonCellFlags buttonCellFlags;
memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags)); memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags));
[self setTransparent: buttonCellFlags.isTransparent]; [self setTransparent: buttonCellFlags.isTransparent];
@ -1859,50 +1810,62 @@ typedef struct _GSButtonCellFlags
to: buttonCellFlags.changeGray]; to: buttonCellFlags.changeGray];
if (buttonCellFlags.imageDoesOverlap) if (buttonCellFlags.imageDoesOverlap)
{
if (buttonCellFlags.isImageAndText) if (buttonCellFlags.isImageAndText)
[self setImagePosition: NSImageOverlaps]; [self setImagePosition: NSImageOverlaps];
else else
[self setImagePosition: NSImageOnly]; [self setImagePosition: NSImageOnly];
}
else if (buttonCellFlags.isImageAndText) else if (buttonCellFlags.isImageAndText)
{
if (buttonCellFlags.isHorizontal) if (buttonCellFlags.isHorizontal)
{
if (buttonCellFlags.isBottomOrLeft) if (buttonCellFlags.isBottomOrLeft)
[self setImagePosition: NSImageLeft]; [self setImagePosition: NSImageLeft];
else else
[self setImagePosition: NSImageRight]; [self setImagePosition: NSImageRight];
}
else else
{
if (buttonCellFlags.isBottomOrLeft) if (buttonCellFlags.isBottomOrLeft)
[self setImagePosition: NSImageBelow]; [self setImagePosition: NSImageBelow];
else else
[self setImagePosition: NSImageAbove]; [self setImagePosition: NSImageAbove];
}
}
else else
{
[self setImagePosition: NSNoImage]; [self setImagePosition: NSNoImage];
}
} }
if ([aDecoder containsValueForKey: @"NSButtonFlags2"]) if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
{ {
NSUInteger imageScale; unsigned int bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
int bFlags2; GSButtonCellFlags2 buttonCellFlags2;
NSUInteger imageScale;
bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
[self setShowsBorderOnlyWhileMouseInside: (bFlags2 & 0x8)]; memcpy((void *)&buttonCellFlags2, (void *)&bFlags2, sizeof(struct _GSButtonCellFlags2));
[self setBezelStyle: (bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2)];
[self setKeyEquivalentModifierMask: ((bFlags2 >> 8) & [self setShowsBorderOnlyWhileMouseInside: buttonCellFlags2.showsBorderOnlyWhileMouseInside];
[self setBezelStyle: buttonCellFlags2.bezelStyle | (buttonCellFlags2.bezelStyle2 << 3)];
[self setKeyEquivalentModifierMask: (buttonCellFlags2.keyEquivalentModifierMask &
NSDeviceIndependentModifierFlagsMask)]; NSDeviceIndependentModifierFlagsMask)];
switch ((bFlags2 >> 6) & 3) switch (buttonCellFlags2.imageScaling)
{ {
case 3:
imageScale = NSImageScaleAxesIndependently;
break;
case 2: case 2:
imageScale = NSImageScaleProportionallyDown; imageScale = NSImageScaleProportionallyDown;
break; break;
case 3: case 1:
imageScale = NSImageScaleAxesIndependently; imageScale = NSImageScaleProportionallyUpOrDown;
break; break;
case 0: case 0:
default: default:
imageScale = NSImageScaleNone; imageScale = NSImageScaleNone;
break; break;
case 1:
imageScale = NSImageScaleProportionallyUpOrDown;
break;
} }
[self setImageScaling: imageScale]; [self setImageScaling: imageScale];
} }

View file

@ -2668,52 +2668,55 @@ static NSColor *dtxtCol;
if ([aDecoder containsValueForKey: @"NSCellFlags"]) if ([aDecoder containsValueForKey: @"NSCellFlags"])
{ {
unsigned long cFlags; NSUInteger mask = 0;
NSUInteger mask = 0; GSCellFlags cellFLags;
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"]; unsigned long flagValue = [aDecoder decodeIntForKey: @"NSCellFlags"];
memcpy(&cellFLags, &flagValue, sizeof(cellFLags));
[self setFocusRingType: (cFlags & 0x3)]; //NSWarnMLog(@"title: %@ cellFLags: %u", [self title], flagValue);
[self setShowsFirstResponder: ((cFlags & 0x4) == 0x4)];
[self setFocusRingType: cellFLags.focusRingType];
[self setShowsFirstResponder: cellFLags.showsFirstResponder];
// This bit flag is the other way around! // This bit flag is the other way around!
if ((cFlags & 0x20) != 0x20) if (cellFLags.dontActOnMouseUp == NO)
mask |= NSLeftMouseUpMask; mask |= NSLeftMouseUpMask;
// This bit flag is the other way around! // This bit flag is the other way around!
[self setWraps: ((cFlags & 0x40) != 0x40)]; [self setWraps: cellFLags.truncateLastLine == NO];
if ((cFlags & 0x100) == 0x100) if (cellFLags.actOnMouseDragged)
mask |= NSLeftMouseDraggedMask; mask |= NSLeftMouseDraggedMask;
if ((cFlags & 0x40000) == 0x40000) if (cellFLags.actOnMouseDown)
mask |= NSLeftMouseDownMask; mask |= NSLeftMouseDownMask;
if ((cFlags & 0x80000) == 0x80000) if (cellFLags.continuous)
mask |= NSPeriodicMask; mask |= NSPeriodicMask;
[self sendActionOn: mask]; [self sendActionOn: mask];
[self setScrollable: ((cFlags & 0x100000) == 0x100000)]; [self setScrollable: cellFLags.scrollable];
[self setSelectable: ((cFlags & 0x200000) == 0x200000)]; [self setSelectable: cellFLags.selectable];
[self setBezeled: ((cFlags & 0x400000) == 0x400000)]; [self setBezeled: cellFLags.bezeled];
[self setBordered: ((cFlags & 0x800000) == 0x800000)]; [self setBordered: cellFLags.bordered];
[self setType: ((cFlags & 0xC000000) >> 26)]; [self setType: cellFLags.type];
[self setEditable: ((cFlags & 0x10000000) == 0x10000000)]; [self setEditable: cellFLags.editable];
// This bit flag is the other way around! // This bit flag is the other way around!
[self setEnabled: ((cFlags & 0x20000000) != 0x20000000)]; [self setEnabled: (cellFLags.disabled == NO)];
[self setHighlighted: ((cFlags & 0x40000000) == 0x40000000)]; [self setHighlighted: cellFLags.highlighted];
[self setState: ((cFlags & 0x80000000) == 0x80000000) ? NSOnState : NSOffState]; [self setState: cellFLags.state ? NSOnState : NSOffState];
} }
if ([aDecoder containsValueForKey: @"NSCellFlags2"]) if ([aDecoder containsValueForKey: @"NSCellFlags2"])
{ {
int cFlags2; GSCellFlags2Union cFlags2;
cFlags2.value = [aDecoder decodeIntForKey: @"NSCellFlags2"];
cFlags2 = [aDecoder decodeIntForKey: @"NSCellFlags2"]; //NSWarnMLog(@"title: %@ cFlags2: %u", [self title], cFlags2.value);
[self setControlTint: ((cFlags2 & 0xE0) >> 5)];
[self setLineBreakMode: ((cFlags2 & 0xE00) >> 9)];
[self setControlSize: ((cFlags2 & 0xE0000) >> 17)];
[self setSendsActionOnEndEditing: ((cFlags2 & 0x400000) == 0x400000)];
[self setAllowsMixedState: ((cFlags2 & 0x1000000) == 0x1000000)];
[self setRefusesFirstResponder: ((cFlags2 & 0x2000000) == 0x2000000)];
[self setAlignment: ((cFlags2 & 0x1C000000) >> 26)];
[self setImportsGraphics: ((cFlags2 & 0x20000000) == 0x20000000)];
[self setAllowsEditingTextAttributes: ((cFlags2 & 0x40000000) == 0x40000000)];
[self setControlTint: cFlags2.flags.controlTint];
[self setLineBreakMode: cFlags2.flags.lineBreakMode];
[self setControlSize: cFlags2.flags.controlSize];
[self setSendsActionOnEndEditing: cFlags2.flags.sendsActionOnEndEditing];
[self setAllowsMixedState: cFlags2.flags.allowsMixedState];
[self setRefusesFirstResponder: cFlags2.flags.refusesFirstResponder];
[self setAlignment: cFlags2.flags.alignment];
[self setImportsGraphics: cFlags2.flags.importsGraphics];
[self setAllowsEditingTextAttributes: cFlags2.flags.allowsEditingTextAttributes];
// These bit flags are the other way around! // These bit flags are the other way around!
[self setAllowsUndo: ((cFlags2 & 0x1000) != 0x1000)]; [self setAllowsUndo: (cFlags2.flags.doesNotAllowUndo ? NO : YES)];
} }
if ([aDecoder containsValueForKey: @"NSSupport"]) if ([aDecoder containsValueForKey: @"NSSupport"])
{ {

View file

@ -1471,7 +1471,7 @@ systemColorWithName(NSString *name)
RELEASE(scanner); RELEASE(scanner);
RELEASE(str); RELEASE(str);
} }
if (colorSpace == 1) if (colorSpace == 1)
{ {
self = RETAIN([NSColor colorWithCalibratedRed: red self = RETAIN([NSColor colorWithCalibratedRed: red
@ -1873,7 +1873,7 @@ systemColorWithName(NSString *name)
} }
NSAssert([[list name] isEqual: @"System"], NSInvalidArgumentException); NSAssert([[list name] isEqual: @"System"], NSInvalidArgumentException);
[NSColorList _setThemeSystemColorList: list]; [NSColorList _setThemeSystemColorList: list];
/* We always update the system dictionary and send a notification, since /* We always update the system dictionary and send a notification, since
* the theme may have given us a pre-existing color list, but have changed * the theme may have given us a pre-existing color list, but have changed
* one or more of the colors in it. * one or more of the colors in it.
@ -1909,7 +1909,7 @@ static NSRecursiveLock *namedColorLock = nil;
} }
- (NSColor*) initWithCatalogName: (NSString *)listName - (NSColor*) initWithCatalogName: (NSString *)listName
colorName: (NSString *)colorName colorName: (NSString *)colorName
{ {
NSMutableDictionary *d; NSMutableDictionary *d;
NSColor *c; NSColor *c;
@ -2018,7 +2018,7 @@ static NSRecursiveLock *namedColorLock = nil;
} }
- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace - (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
device: (NSDictionary *)deviceDescription device: (NSDictionary *)deviceDescription
{ {
NSColorList *list; NSColorList *list;
NSColor *real; NSColor *real;
@ -2096,13 +2096,22 @@ static NSRecursiveLock *namedColorLock = nil;
{ {
listName = [aDecoder decodeObjectForKey: @"NSCatalogName"]; listName = [aDecoder decodeObjectForKey: @"NSCatalogName"];
colorName = [aDecoder decodeObjectForKey: @"NSColorName"]; colorName = [aDecoder decodeObjectForKey: @"NSColorName"];
NSColor *color = (NSColor*)[aDecoder decodeObjectForKey: @"NSColor"];
NSColorList *colorList = [NSColorList colorListNamed: listName]; NSColorList *colorList = [NSColorList colorListNamed: listName];
NSColor *color = (NSColor*)[colorList colorWithKey:colorName];
if ([colorList colorWithKey:colorName] == nil)
if (color == nil)
{ {
NSWarnMLog(@"adding to color list: %@ name: %@ color: %@", listName, colorName, color); color = [aDecoder decodeObjectForKey: @"NSColor"];
[[NSColorList colorListNamed:listName] setColor:color forKey:colorName]; if (color == nil)
{
NSWarnMLog(@"no color available for listName: %@ colorName: %@ color: %@", listName, colorName, color);
[[NSColorList colorListNamed: listName] setColor: [NSColor redColor] forKey: colorName];
}
else
{
NSWarnMLog(@"adding to color list: %@ colorName: %@ color: %@", listName, colorName, color);
[[NSColorList colorListNamed: listName] setColor: color forKey: colorName];
}
} }
} }
else else

View file

@ -129,40 +129,6 @@ typedef struct {
NSInteger height; NSInteger height;
} MRect; } MRect;
typedef struct _GSMatrixFlags {
#if GS_WORDS_BIGENDIAN == 1
unsigned int isHighlight:1;
unsigned int isRadio:1;
unsigned int isList:1;
unsigned int allowsEmptySelection:1;
unsigned int autoScroll:1;
unsigned int selectionByRect:1;
unsigned int drawCellBackground:1;
unsigned int drawBackground:1;
unsigned int autosizesCells:1;
unsigned int drawingAncestor:1;
unsigned int tabKeyTraversesCells:1;
unsigned int tabKeyTraversesCellsExplicitly:1;
unsigned int canSearchIncrementally:1;
unsigned int unused:19;
#else
unsigned int unused:19;
unsigned int canSearchIncrementally:1;
unsigned int tabKeyTraversesCellsExplicitly:1;
unsigned int tabKeyTraversesCells:1;
unsigned int drawingAncestor:1;
unsigned int autosizesCells:1;
unsigned int drawBackground:1;
unsigned int drawCellBackground:1;
unsigned int selectionByRect:1;
unsigned int autoScroll:1;
unsigned int allowsEmptySelection:1;
unsigned int isList:1;
unsigned int isRadio:1;
unsigned int isHighlight:1;
#endif
} GSMatrixFlags;
static inline MPoint MakePoint (NSInteger x, NSInteger y) static inline MPoint MakePoint (NSInteger x, NSInteger y)
{ {
MPoint point = { x, y }; MPoint point = { x, y };

View file

@ -267,6 +267,11 @@ static CGFloat scrollerWidth;
[_contentView removeFromSuperview]; [_contentView removeFromSuperview];
[self addSubview: aView]; [self addSubview: aView];
// Testplant-MAL-01092017: XIB 5 support...
if (_headerClipView && ([[self subviews] count] == 1))
[self addSubview: _headerClipView];
// This must be done after adding it as a subview, // This must be done after adding it as a subview,
// otherwise it will get unset again. // otherwise it will get unset again.
_contentView = aView; _contentView = aView;
@ -1686,13 +1691,13 @@ GSOppositeEdge(NSRectEdge edge)
if (hScroller != nil && _hasHorizScroller) if (hScroller != nil && _hasHorizScroller)
{ {
[self setHorizontalScroller: hScroller]; [self setHorizontalScroller: hScroller];
[hScroller setHidden: NO]; [hScroller setHidden: NO];
} }
if (vScroller != nil && _hasVertScroller) if (vScroller != nil && _hasVertScroller)
{ {
[self setVerticalScroller: vScroller]; [self setVerticalScroller: vScroller];
[vScroller setHidden: NO]; [vScroller setHidden: NO];
} }
if ([aDecoder containsValueForKey: @"NSHeaderClipView"]) if ([aDecoder containsValueForKey: @"NSHeaderClipView"])
@ -1700,7 +1705,7 @@ GSOppositeEdge(NSRectEdge edge)
_hasHeaderView = YES; _hasHeaderView = YES;
_headerClipView = [aDecoder decodeObjectForKey: @"NSHeaderClipView"]; _headerClipView = [aDecoder decodeObjectForKey: @"NSHeaderClipView"];
} }
// set the document view into the content. // set the document view into the content.
[self setContentView: content]; [self setContentView: content];
[self tile]; [self tile];

View file

@ -249,23 +249,26 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
// Set default action - overridden by XIB when changed...
[self setAction: NSSelectorFromString(@"_doScroller:")];
if (_frame.size.width > _frame.size.height) if (_frame.size.width > _frame.size.height)
{ {
_scFlags.isHorizontal = YES; _scFlags.isHorizontal = YES;
} }
else else
{ {
_scFlags.isHorizontal = NO; _scFlags.isHorizontal = NO;
} }
if (_scFlags.isHorizontal) if (_scFlags.isHorizontal)
{ {
_doubleValue = 0.0; _doubleValue = 0.0;
} }
else else
{ {
_doubleValue = 1.0; _doubleValue = 1.0;
} }
if ([aDecoder containsValueForKey: @"NSAction"]) if ([aDecoder containsValueForKey: @"NSAction"])
{ {
@ -282,32 +285,32 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
} }
if ([aDecoder containsValueForKey: @"NSCurValue"]) if ([aDecoder containsValueForKey: @"NSCurValue"])
{ {
float value = [aDecoder decodeFloatForKey: @"NSCurValue"]; float value = [aDecoder decodeFloatForKey: @"NSCurValue"];
[self setFloatValue: value]; [self setFloatValue: value];
} }
if ([aDecoder containsValueForKey: @"NSPercent"]) if ([aDecoder containsValueForKey: @"NSPercent"])
{ {
float percent = [aDecoder decodeFloatForKey: @"NSPercent"]; float percent = [aDecoder decodeFloatForKey: @"NSPercent"];
[self setKnobProportion: percent / 100.0]; [self setKnobProportion: percent / 100.0];
} }
if ([aDecoder containsValueForKey: @"NSsFlags"]) if ([aDecoder containsValueForKey: @"NSsFlags"])
{ {
int flags; int flags;
flags = [aDecoder decodeIntForKey: @"NSsFlags"]; flags = [aDecoder decodeIntForKey: @"NSsFlags"];
// is horiz is set above... // is horiz is set above...
[self setControlTint: ((flags >> 16) & 7)]; [self setControlTint: ((flags >> 16) & 7)];
[self setArrowsPosition: ((flags >> 29) & 3)]; [self setArrowsPosition: ((flags >> 29) & 3)];
_usableParts = ((flags >> 27) & 3); _usableParts = ((flags >> 27) & 3);
} }
if ([aDecoder containsValueForKey: @"NSsFlags2"]) if ([aDecoder containsValueForKey: @"NSsFlags2"])
{ {
int flags2; int flags2;
flags2 = [aDecoder decodeIntForKey: @"NSsFlags2"]; flags2 = [aDecoder decodeIntForKey: @"NSsFlags2"];
[self setControlSize: ((flags2 >> 26) & 3)]; [self setControlSize: ((flags2 >> 26) & 3)];
} }
// setup... // setup...
_hitPart = NSScrollerNoPart; _hitPart = NSScrollerNoPart;

View file

@ -295,6 +295,7 @@ static inline NSRect textCellFrameFromRect(NSRect cellRect)
[c setTarget: self]; [c setTarget: self];
[c setKeyEquivalent: @"\e"]; [c setKeyEquivalent: @"\e"];
[c setKeyEquivalentModifierMask: 0]; [c setKeyEquivalentModifierMask: 0];
[self setTitle: @""];
} }
- (void) resetSearchButtonCell - (void) resetSearchButtonCell
@ -520,24 +521,30 @@ static inline NSRect textCellFrameFromRect(NSRect cellRect)
if (self != nil) if (self != nil)
{ {
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
[self setSearchButtonCell: [aDecoder decodeObjectForKey: @"NSSearchButtonCell"]]; [self setSearchButtonCell: [aDecoder decodeObjectForKey: @"NSSearchButtonCell"]];
[self setCancelButtonCell: [aDecoder decodeObjectForKey: @"NSCancelButtonCell"]]; [self setCancelButtonCell: [aDecoder decodeObjectForKey: @"NSCancelButtonCell"]];
[self setRecentsAutosaveName: [aDecoder decodeObjectForKey: @"NSRecentsAutosaveName"]]; [self setRecentsAutosaveName: [aDecoder decodeObjectForKey: @"NSRecentsAutosaveName"]];
[self setSendsWholeSearchString: [aDecoder decodeBoolForKey: @"NSSendsWholeSearchString"]]; [self setSendsWholeSearchString: [aDecoder decodeBoolForKey: @"NSSendsWholeSearchString"]];
[self setMaximumRecents: [aDecoder decodeIntForKey: @"NSMaximumRecents"]]; [self setMaximumRecents: [aDecoder decodeIntForKey: @"NSMaximumRecents"]];
}
if ([[aDecoder class] coderVersion] > 0)
{
[self setDrawsBackground: YES];
[self setBackgroundColor: [NSColor whiteColor]];
}
}
else else
{ {
NSInteger max; NSInteger max;
[self setSearchButtonCell: [aDecoder decodeObject]]; [self setSearchButtonCell: [aDecoder decodeObject]];
[self setCancelButtonCell: [aDecoder decodeObject]]; [self setCancelButtonCell: [aDecoder decodeObject]];
[self setRecentsAutosaveName: [aDecoder decodeObject]]; [self setRecentsAutosaveName: [aDecoder decodeObject]];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sends_whole_search_string]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sends_whole_search_string];
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &max]; [aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &max];
[self setMaximumRecents: max]; [self setMaximumRecents: max];
} }
[self resetCancelButtonCell]; [self resetCancelButtonCell];
[self resetSearchButtonCell]; [self resetSearchButtonCell];

View file

@ -555,11 +555,12 @@
} }
if ([aDecoder containsValueForKey: @"NSTvFlags"]) if ([aDecoder containsValueForKey: @"NSTvFlags"])
{ {
int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"]; GSTabViewTypeFlagsUnion mask;
mask.value = [aDecoder decodeIntForKey: @"NSTvFlags"];
[self setControlTint: ((vFlags & 0x70000000) >> 28)]; [self setControlTint: mask.flags.controlTint];
[self setControlSize: ((vFlags & 0x0c000000) >> 26)]; [self setControlSize: mask.flags.controlSize];
[self setTabViewType: (vFlags & 0x00000007)]; [self setTabViewType: mask.flags.tabViewBorderType];
} }
if ([aDecoder containsValueForKey: @"NSTabViewItems"]) if ([aDecoder containsValueForKey: @"NSTabViewItems"])
{ {

View file

@ -311,7 +311,11 @@ Return the resizing mask that describes whether the column is resizable and how
it resizes. */ it resizes. */
- (void) setResizingMask: (NSUInteger)resizingMask - (void) setResizingMask: (NSUInteger)resizingMask
{ {
_resizing_mask = resizingMask; if (_resizing_mask != resizingMask)
{
_resizing_mask = resizingMask;
[self setResizable:(_resizing_mask & NSTableColumnUserResizingMask ? YES : NO)];
}
} }
/** /**

View file

@ -84,35 +84,6 @@ static NSInteger currentDropRow;
static NSInteger lastQuarterPosition; static NSInteger lastQuarterPosition;
static NSDragOperation currentDragOperation; static NSDragOperation currentDragOperation;
/*
* Nib compatibility struct. This structure is used to
* pull the attributes out of the nib that we need to fill
* in the flags.
*/
typedef struct _tableViewFlags
{
#if GS_WORDS_BIGENDIAN == 1
unsigned int columnOrdering:1;
unsigned int columnResizing:1;
unsigned int drawsGrid:1;
unsigned int emptySelection:1;
unsigned int multipleSelection:1;
unsigned int columnSelection:1;
unsigned int columnAutosave:1;
unsigned int _unused:24;
#else
unsigned int _unused:24;
unsigned int columnAutosave:1;
unsigned int unknown1:1;
unsigned int columnSelection:1;
unsigned int multipleSelection:1;
unsigned int emptySelection:1;
unsigned int drawsGrid:1;
unsigned int columnResizing:1;
unsigned int columnOrdering:1;
#endif
} GSTableViewFlags;
#define ALLOWS_MULTIPLE (1) #define ALLOWS_MULTIPLE (1)
#define ALLOWS_EMPTY (1 << 1) #define ALLOWS_EMPTY (1 << 1)
#define SHIFT_DOWN (1 << 2) #define SHIFT_DOWN (1 << 2)
@ -2019,7 +1990,7 @@ static void computeNewSelection
{ {
_isValidating = NO; _isValidating = NO;
_drawsGrid = YES; _drawsGrid = YES;
_rowHeight = 16.0; _rowHeight = 17.0; // XIB 5 defaults to 17 so we'll use that...
_intercellSpacing = NSMakeSize (5.0, 2.0); _intercellSpacing = NSMakeSize (5.0, 2.0);
ASSIGN(_selectedColumns, [NSMutableIndexSet indexSet]); ASSIGN(_selectedColumns, [NSMutableIndexSet indexSet]);
ASSIGN(_selectedRows, [NSMutableIndexSet indexSet]); ASSIGN(_selectedRows, [NSMutableIndexSet indexSet]);

View file

@ -4726,13 +4726,15 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
} }
if ([aDecoder containsValueForKey: @"NSvFlags"]) if ([aDecoder containsValueForKey: @"NSvFlags"])
{ {
GSvFlags VFlags;
NSUInteger vFlags = [aDecoder decodeIntForKey: @"NSvFlags"]; NSUInteger vFlags = [aDecoder decodeIntForKey: @"NSvFlags"];
memcpy(&VFlags, &vFlags, sizeof(VFlags));
// We are lucky here, Apple use the same constants // We are lucky here, Apple use the same constants
// in the lower bits of the flags // in the lower bits of the flags
[self setAutoresizingMask: vFlags & 0x3F]; [self setAutoresizingMask: VFlags.autoresizingMask];
[self setAutoresizesSubviews: ((vFlags & 0x100) == 0x100)]; [self setAutoresizesSubviews: VFlags.autoresizesSubviews];
[self setHidden: ((vFlags & 0x80000000) == 0x80000000)]; [self setHidden: VFlags.isHidden];
} }
// iterate over subviews and put them into the view... // iterate over subviews and put them into the view...