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;
- (void) setExtension: (NSString *)ext;
- (NSString *)extension;
- (void) setRealObject: (id)obj;
@end
@interface NSCustomView : NSView <GSNibLoading>

View file

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

View file

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

View file

@ -114,6 +114,87 @@ typedef enum _NSGradientType {
NSGradientConvexStrong
} 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
{

View file

@ -163,6 +163,184 @@ enum {
};
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>
{
// Attributes

View file

@ -49,6 +49,46 @@ typedef enum _NSMatrixMode {
NSTrackModeMatrix
} 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>
@end

View file

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

View file

@ -45,6 +45,31 @@ typedef enum {
@class NSFont;
@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>
{
NSMutableArray *_items;

View file

@ -90,6 +90,35 @@ typedef enum _NSTableViewAnimationOptions
} NSTableViewAnimationOptions;
#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>
{

View file

@ -96,6 +96,33 @@ typedef enum _NSFocusRingType {
NSFocusRingTypeExterior = 2
} 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
{
NSRect _frame;

View file

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

View file

@ -52,6 +52,7 @@
#import "GNUstepGUI/GSNibLoading.h"
#import "AppKit/NSApplication.h"
#import "AppKit/NSFontManager.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSMenuItem.h"
#import "AppKit/NSMenuView.h"
@ -339,6 +340,10 @@ static BOOL _isInInterfaceBuilder = NO;
{
if ([coder allowsKeyedCoding])
{
_windowStyle = 0;
_viewClass = @"NSView";
_windowClass = @"NSWindow";
if ([coder containsValueForKey: @"NSViewClass"])
{
ASSIGN(_viewClass, [coder decodeObjectForKey: @"NSViewClass"]);
@ -347,6 +352,10 @@ static BOOL _isInInterfaceBuilder = NO;
{
ASSIGN(_windowClass, [coder decodeObjectForKey: @"NSWindowClass"]);
}
else
{
ASSIGN(_windowClass, @"NSWindow");
}
if ([coder containsValueForKey: @"NSWindowStyleMask"])
{
_windowStyle = [coder decodeIntForKey: @"NSWindowStyleMask"];
@ -467,8 +476,7 @@ static BOOL _isInInterfaceBuilder = NO;
format: @"Unable to find class '%@'", _windowClass];
}
_realObject = [[aClass allocWithZone: NSDefaultMallocZone()]
initWithContentRect: _windowRect
_realObject = [[aClass allocWithZone: NSDefaultMallocZone()] initWithContentRect: _windowRect
styleMask: _windowStyle
backing: _backingStoreType
defer: _flags.isDeferred];
@ -914,6 +922,7 @@ static BOOL _isInInterfaceBuilder = NO;
@end
@implementation NSCustomObject
- (void) setClassName: (NSString *)name
{
ASSIGNCOPY(_className, name);
@ -999,16 +1008,22 @@ static BOOL _isInInterfaceBuilder = NO;
format: @"Unable to find class '%@'", _className];
}
if (GSObjCIsKindOf(aClass, [NSApplication class]) ||
[_className isEqual: @"NSApplication"])
if ((GSObjCIsKindOf(aClass, [NSApplication class])) ||
([_className isEqual: @"NSApplication"]))
{
_object = RETAIN([aClass sharedApplication]);
}
else if ((GSObjCIsKindOf(aClass, [NSFontManager class])) ||
([_className isEqual: @"NSFontManager"]))
{
_object = RETAIN([aClass sharedFontManager]);
}
else
{
_object = [[aClass allocWithZone: NSDefaultMallocZone()] init];
}
}
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

@ -38,7 +38,7 @@
andAttributes: (NSDictionary*)attribs
{
ASSIGN(type, typeName);
ASSIGN(attributes, attribs);
ASSIGN(attributes, AUTORELEASE([attribs mutableCopy]));
elements = [[NSMutableDictionary alloc] init];
values = [[NSMutableArray alloc] init];
@ -114,3 +114,11 @@
@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;
}
- (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
@implementation IBUserDefinedRuntimeAttributesPlaceholder

View file

@ -59,59 +59,6 @@
#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>
*/
@implementation NSButtonCell
@ -1105,8 +1052,9 @@ typedef struct _GSButtonCellFlags
// 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
// _mouse_inside here.
if ((_cell.is_bordered) && (_bezel_style != NSCircularBezelStyle)
&& (!_shows_border_only_while_mouse_inside
if ((_cell.is_bordered) &&
(_bezel_style != NSCircularBezelStyle) &&
(!_shows_border_only_while_mouse_inside
|| [controlView mouse: [[controlView window] mouseLocationOutsideOfEventStream]
inRect: cellFrame]))
{
@ -1698,7 +1646,9 @@ typedef struct _GSButtonCellFlags
buttonCellFlags.changeGray = [self cellAttribute: NSChangeGrayCell];
// 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.lastState = 0;
buttonCellFlags.isImageSizeDiff = 0;
@ -1838,6 +1788,7 @@ typedef struct _GSButtonCellFlags
{
unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
GSButtonCellFlags buttonCellFlags;
memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags));
[self setTransparent: buttonCellFlags.isTransparent];
@ -1859,50 +1810,62 @@ typedef struct _GSButtonCellFlags
to: buttonCellFlags.changeGray];
if (buttonCellFlags.imageDoesOverlap)
{
if (buttonCellFlags.isImageAndText)
[self setImagePosition: NSImageOverlaps];
else
[self setImagePosition: NSImageOnly];
}
else if (buttonCellFlags.isImageAndText)
{
if (buttonCellFlags.isHorizontal)
{
if (buttonCellFlags.isBottomOrLeft)
[self setImagePosition: NSImageLeft];
else
[self setImagePosition: NSImageRight];
}
else
{
if (buttonCellFlags.isBottomOrLeft)
[self setImagePosition: NSImageBelow];
else
[self setImagePosition: NSImageAbove];
}
}
else
{
[self setImagePosition: NSNoImage];
}
}
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
{
unsigned int bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
GSButtonCellFlags2 buttonCellFlags2;
NSUInteger imageScale;
int bFlags2;
bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
[self setShowsBorderOnlyWhileMouseInside: (bFlags2 & 0x8)];
[self setBezelStyle: (bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2)];
[self setKeyEquivalentModifierMask: ((bFlags2 >> 8) &
memcpy((void *)&buttonCellFlags2, (void *)&bFlags2, sizeof(struct _GSButtonCellFlags2));
[self setShowsBorderOnlyWhileMouseInside: buttonCellFlags2.showsBorderOnlyWhileMouseInside];
[self setBezelStyle: buttonCellFlags2.bezelStyle | (buttonCellFlags2.bezelStyle2 << 3)];
[self setKeyEquivalentModifierMask: (buttonCellFlags2.keyEquivalentModifierMask &
NSDeviceIndependentModifierFlagsMask)];
switch ((bFlags2 >> 6) & 3)
switch (buttonCellFlags2.imageScaling)
{
case 3:
imageScale = NSImageScaleAxesIndependently;
break;
case 2:
imageScale = NSImageScaleProportionallyDown;
break;
case 3:
imageScale = NSImageScaleAxesIndependently;
case 1:
imageScale = NSImageScaleProportionallyUpOrDown;
break;
case 0:
default:
imageScale = NSImageScaleNone;
break;
case 1:
imageScale = NSImageScaleProportionallyUpOrDown;
break;
}
[self setImageScaling: imageScale];
}

View file

@ -2668,52 +2668,55 @@ static NSColor *dtxtCol;
if ([aDecoder containsValueForKey: @"NSCellFlags"])
{
unsigned long cFlags;
NSUInteger mask = 0;
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
GSCellFlags cellFLags;
unsigned long flagValue = [aDecoder decodeIntForKey: @"NSCellFlags"];
memcpy(&cellFLags, &flagValue, sizeof(cellFLags));
//NSWarnMLog(@"title: %@ cellFLags: %u", [self title], flagValue);
[self setFocusRingType: (cFlags & 0x3)];
[self setShowsFirstResponder: ((cFlags & 0x4) == 0x4)];
[self setFocusRingType: cellFLags.focusRingType];
[self setShowsFirstResponder: cellFLags.showsFirstResponder];
// This bit flag is the other way around!
if ((cFlags & 0x20) != 0x20)
if (cellFLags.dontActOnMouseUp == NO)
mask |= NSLeftMouseUpMask;
// This bit flag is the other way around!
[self setWraps: ((cFlags & 0x40) != 0x40)];
if ((cFlags & 0x100) == 0x100)
[self setWraps: cellFLags.truncateLastLine == NO];
if (cellFLags.actOnMouseDragged)
mask |= NSLeftMouseDraggedMask;
if ((cFlags & 0x40000) == 0x40000)
if (cellFLags.actOnMouseDown)
mask |= NSLeftMouseDownMask;
if ((cFlags & 0x80000) == 0x80000)
if (cellFLags.continuous)
mask |= NSPeriodicMask;
[self sendActionOn: mask];
[self setScrollable: ((cFlags & 0x100000) == 0x100000)];
[self setSelectable: ((cFlags & 0x200000) == 0x200000)];
[self setBezeled: ((cFlags & 0x400000) == 0x400000)];
[self setBordered: ((cFlags & 0x800000) == 0x800000)];
[self setType: ((cFlags & 0xC000000) >> 26)];
[self setEditable: ((cFlags & 0x10000000) == 0x10000000)];
[self setScrollable: cellFLags.scrollable];
[self setSelectable: cellFLags.selectable];
[self setBezeled: cellFLags.bezeled];
[self setBordered: cellFLags.bordered];
[self setType: cellFLags.type];
[self setEditable: cellFLags.editable];
// This bit flag is the other way around!
[self setEnabled: ((cFlags & 0x20000000) != 0x20000000)];
[self setHighlighted: ((cFlags & 0x40000000) == 0x40000000)];
[self setState: ((cFlags & 0x80000000) == 0x80000000) ? NSOnState : NSOffState];
[self setEnabled: (cellFLags.disabled == NO)];
[self setHighlighted: cellFLags.highlighted];
[self setState: cellFLags.state ? NSOnState : NSOffState];
}
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
{
int cFlags2;
GSCellFlags2Union cFlags2;
cFlags2.value = [aDecoder decodeIntForKey: @"NSCellFlags2"];
//NSWarnMLog(@"title: %@ cFlags2: %u", [self title], cFlags2.value);
cFlags2 = [aDecoder decodeIntForKey: @"NSCellFlags2"];
[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!
[self setAllowsUndo: ((cFlags2 & 0x1000) != 0x1000)];
[self setAllowsUndo: (cFlags2.flags.doesNotAllowUndo ? NO : YES)];
}
if ([aDecoder containsValueForKey: @"NSSupport"])
{

View file

@ -2096,13 +2096,22 @@ static NSRecursiveLock *namedColorLock = nil;
{
listName = [aDecoder decodeObjectForKey: @"NSCatalogName"];
colorName = [aDecoder decodeObjectForKey: @"NSColorName"];
NSColor *color = (NSColor*)[aDecoder decodeObjectForKey: @"NSColor"];
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);
[[NSColorList colorListNamed:listName] setColor:color forKey:colorName];
color = [aDecoder decodeObjectForKey: @"NSColor"];
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

View file

@ -129,40 +129,6 @@ typedef struct {
NSInteger height;
} 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)
{
MPoint point = { x, y };

View file

@ -267,6 +267,11 @@ static CGFloat scrollerWidth;
[_contentView removeFromSuperview];
[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,
// otherwise it will get unset again.
_contentView = aView;

View file

@ -249,6 +249,9 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
if ([aDecoder allowsKeyedCoding])
{
// Set default action - overridden by XIB when changed...
[self setAction: NSSelectorFromString(@"_doScroller:")];
if (_frame.size.width > _frame.size.height)
{
_scFlags.isHorizontal = YES;

View file

@ -295,6 +295,7 @@ static inline NSRect textCellFrameFromRect(NSRect cellRect)
[c setTarget: self];
[c setKeyEquivalent: @"\e"];
[c setKeyEquivalentModifierMask: 0];
[self setTitle: @""];
}
- (void) resetSearchButtonCell
@ -526,6 +527,12 @@ static inline NSRect textCellFrameFromRect(NSRect cellRect)
[self setRecentsAutosaveName: [aDecoder decodeObjectForKey: @"NSRecentsAutosaveName"]];
[self setSendsWholeSearchString: [aDecoder decodeBoolForKey: @"NSSendsWholeSearchString"]];
[self setMaximumRecents: [aDecoder decodeIntForKey: @"NSMaximumRecents"]];
if ([[aDecoder class] coderVersion] > 0)
{
[self setDrawsBackground: YES];
[self setBackgroundColor: [NSColor whiteColor]];
}
}
else
{

View file

@ -555,11 +555,12 @@
}
if ([aDecoder containsValueForKey: @"NSTvFlags"])
{
int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
GSTabViewTypeFlagsUnion mask;
mask.value = [aDecoder decodeIntForKey: @"NSTvFlags"];
[self setControlTint: ((vFlags & 0x70000000) >> 28)];
[self setControlSize: ((vFlags & 0x0c000000) >> 26)];
[self setTabViewType: (vFlags & 0x00000007)];
[self setControlTint: mask.flags.controlTint];
[self setControlSize: mask.flags.controlSize];
[self setTabViewType: mask.flags.tabViewBorderType];
}
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. */
- (void) setResizingMask: (NSUInteger)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 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_EMPTY (1 << 1)
#define SHIFT_DOWN (1 << 2)
@ -2019,7 +1990,7 @@ static void computeNewSelection
{
_isValidating = NO;
_drawsGrid = YES;
_rowHeight = 16.0;
_rowHeight = 17.0; // XIB 5 defaults to 17 so we'll use that...
_intercellSpacing = NSMakeSize (5.0, 2.0);
ASSIGN(_selectedColumns, [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"])
{
GSvFlags VFlags;
NSUInteger vFlags = [aDecoder decodeIntForKey: @"NSvFlags"];
memcpy(&VFlags, &vFlags, sizeof(VFlags));
// We are lucky here, Apple use the same constants
// in the lower bits of the flags
[self setAutoresizingMask: vFlags & 0x3F];
[self setAutoresizesSubviews: ((vFlags & 0x100) == 0x100)];
[self setHidden: ((vFlags & 0x80000000) == 0x80000000)];
[self setAutoresizingMask: VFlags.autoresizingMask];
[self setAutoresizesSubviews: VFlags.autoresizesSubviews];
[self setHidden: VFlags.isHidden];
}
// iterate over subviews and put them into the view...