Author: fredkiefer
Date: Fri Aug 14 00:03:03 2015
New Revision: 38882
URL: http://svn.gna.org/viewcvs/gnustep?rev=38882&view=rev
Log:
* Source/NSButtonCell.m (-initWithCoder:):
Fix image scaling value extract from XIB.
* Headers/Additions/GNUstepGUI/GSXibLoading.h
* Source/GSXibLoading.m
* Source/GSXibLoader.m
Add IB defined runtime attribute processing for XIB
Patch by Marcian Lytwyn <[email protected]>.
Modified:
libs/gui/trunk/ChangeLog
libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibLoading.h
libs/gui/trunk/Source/GSXibLoader.m
libs/gui/trunk/Source/GSXibLoading.m
libs/gui/trunk/Source/NSButtonCell.m
Modified: libs/gui/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=38882&r1=38881&r2=38882&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog (original)
+++ libs/gui/trunk/ChangeLog Fri Aug 14 00:03:03 2015
@@ -1,3 +1,13 @@
+2015-08-13 Fred Kiefer <[email protected]>
+
+ * Source/NSButtonCell.m (-initWithCoder:):
+ Fix image scaling value extract from XIB.
+ * Headers/Additions/GNUstepGUI/GSXibLoading.h
+ * Source/GSXibLoading.m
+ * Source/GSXibLoader.m
+ Add IB defined runtime attribute processing for XIB
+ Patch by Marcian Lytwyn <[email protected]>.
+
2015-08-11 Fred Kiefer <[email protected]>
* Source/NSTextView.m: Rewrite
Modified: libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibLoading.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibLoading.h?rev=38882&r1=38881&r2=38882&view=diff
==============================================================================
--- libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibLoading.h (original)
+++ libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibLoading.h Fri Aug 14
00:03:03 2015
@@ -37,6 +37,7 @@
@class NSString, NSDictionary, NSArray, NSMutableDictionary, NSMutableArray;
@class NSNibBindingConnector;
@class GSXibElement;
+@class NSNibConnector;
// Hack: This allows the class name FirstResponder in NSCustomObject and
// correctly returns nil as the corresponding object.
@@ -158,6 +159,39 @@
- (NSEnumerator *) objectRecordEnumerator;
@end
+@interface IBUserDefinedRuntimeAttributesPlaceholder : NSObject <NSCoding>
+{
+ NSArray *runtimeAttributes;
+ NSString *name;
+}
+
+- (void) setName: (NSString *)name;
+- (NSString *) name;
+
+- (void) setRuntimeAttributes: (NSArray *)attributes;
+- (NSArray *) runtimeAttributes;
+
+@end
+
+@interface IBUserDefinedRuntimeAttribute : NSObject <NSCoding>
+{
+ NSString *typeIdentifier;
+ NSString *keyPath;
+ id value;
+}
+
+- (void) setTypeIdentifier: (NSString *)type;
+- (NSString *) typeIdentifier;
+
+- (void) setKeyPath: (NSString *)keyPath;
+- (NSString *) keyPath;
+
+- (void) setValue: (id)value;
+- (id) value;
+
+@end
+
+
@interface GSXibKeyedUnarchiver: NSKeyedUnarchiver
{
NSMutableDictionary *objects;
Modified: libs/gui/trunk/Source/GSXibLoader.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/GSXibLoader.m?rev=38882&r1=38881&r2=38882&view=diff
==============================================================================
--- libs/gui/trunk/Source/GSXibLoader.m (original)
+++ libs/gui/trunk/Source/GSXibLoader.m Fri Aug 14 00:03:03 2015
@@ -32,6 +32,7 @@
#import <Foundation/NSException.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSKeyedArchiver.h>
+#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSXMLParser.h>
@@ -857,11 +858,29 @@
value = [properties objectForKey: @"IBAttributePlaceholdersKey"];
if (value != nil)
{
- IBToolTipAttribute *tta = [(NSDictionary*)value objectForKey:
@"ToolTip"];
-
- if ([realObj respondsToSelector: @selector(setToolTip:)])
+ NSDictionary *infodict = (NSDictionary*)value;
+
+ // Process tooltips...
+ IBToolTipAttribute *tooltip = [infodict objectForKey: @"ToolTip"];
+
+ if (tooltip && [realObj respondsToSelector: @selector(setToolTip:)])
{
- [realObj setToolTip: [tta toolTip]];
+ [realObj setToolTip: [tooltip toolTip]];
+ }
+
+ // Process XIB runtime attributes...
+ if ([infodict
objectForKey:@"IBUserDefinedRuntimeAttributesPlaceholderName"])
+ {
+ IBUserDefinedRuntimeAttributesPlaceholder *placeholder =
+ [infodict
objectForKey:@"IBUserDefinedRuntimeAttributesPlaceholderName"];
+ NSArray *attributes = [placeholder runtimeAttributes];
+ NSEnumerator *objectIter = [attributes objectEnumerator];
+ IBUserDefinedRuntimeAttribute *attribute;
+
+ while ((attribute = [objectIter nextObject]) != nil)
+ {
+ [realObj setValue: [attribute value] forKeyPath: [attribute
keyPath]];
+ }
}
}
Modified: libs/gui/trunk/Source/GSXibLoading.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/GSXibLoading.m?rev=38882&r1=38881&r2=38882&view=diff
==============================================================================
--- libs/gui/trunk/Source/GSXibLoading.m (original)
+++ libs/gui/trunk/Source/GSXibLoading.m Fri Aug 14 00:03:03 2015
@@ -1,24 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSKeyedArchiver.h>
#import "GNUstepGUI/GSXibElement.h"
-
-@interface IBUserDefinedRuntimeAttributesPlaceholder : NSObject <NSCoding>
-{
- NSString *typeIdentifier;
- NSString *keyPath;
- id value;
-}
-
-- (void) setTypeIdentifier: (NSString *)type;
-- (NSString *) typeIdentifier;
-
-- (void) setKeyPath: (NSString *)keyPath;
-- (NSString *) keyPath;
-
-- (void) setValue: (id)value;
-- (id) value;
-
-@end
+#import "GNUstepGUI/GSXibLoading.h"
@interface IBAccessibilityAttribute : NSObject <NSCoding>
@end
@@ -29,20 +12,17 @@
@interface IBLayoutConstant : NSObject <NSCoding>
@end
-@implementation IBUserDefinedRuntimeAttributesPlaceholder
-
-- (void) encodeWithCoder: (NSCoder *)coder
-{
- if([coder allowsKeyedCoding])
- {
- [coder encodeObject: typeIdentifier
- forKey: @"typeIdentifier"];
- [coder encodeObject: keyPath
- forKey: @"keyPath"];
- [coder encodeObject: value
- forKey: @"value"];
- }
-}
+@implementation IBUserDefinedRuntimeAttribute
+
+ - (void) encodeWithCoder: (NSCoder *)coder
+ {
+ if([coder allowsKeyedCoding])
+ {
+ [coder encodeObject: typeIdentifier forKey: @"typeIdentifier"];
+ [coder encodeObject: keyPath forKey: @"keyPath"];
+ [coder encodeObject: value forKey: @"value"];
+ }
+ }
- (id) initWithCoder: (NSCoder *)coder
{
@@ -87,6 +67,49 @@
@end
+@implementation IBUserDefinedRuntimeAttributesPlaceholder
+
+- (void) encodeWithCoder: (NSCoder *)coder
+{
+ if([coder allowsKeyedCoding])
+ {
+ [coder encodeObject: name forKey:
@"IBUserDefinedRuntimeAttributesPlaceholderName"];
+ [coder encodeObject: runtimeAttributes forKey:
@"userDefinedRuntimeAttributes"];
+ }
+}
+
+- (id) initWithCoder: (NSCoder *)coder
+{
+ if([coder allowsKeyedCoding])
+ {
+ [self setName: [coder decodeObjectForKey:
@"IBUserDefinedRuntimeAttributesPlaceholderName"]];
+ [self setRuntimeAttributes: [coder decodeObjectForKey:
@"userDefinedRuntimeAttributes"]];
+ }
+ return self;
+}
+
+- (void) setName: (NSString *)value
+{
+ ASSIGN(name, value);
+}
+
+- (NSString *) name
+{
+ return name;
+}
+
+- (void) setRuntimeAttributes: (NSArray *)attrbutes
+{
+ ASSIGN(runtimeAttributes, attrbutes);
+}
+
+- (NSArray *) runtimeAttributes
+{
+ return runtimeAttributes;
+}
+
+@end
+
@implementation IBAccessibilityAttribute
- (void) encodeWithCoder: (NSCoder *)coder
Modified: libs/gui/trunk/Source/NSButtonCell.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSButtonCell.m?rev=38882&r1=38881&r2=38882&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSButtonCell.m (original)
+++ libs/gui/trunk/Source/NSButtonCell.m Fri Aug 14 00:03:03 2015
@@ -1877,7 +1877,7 @@
[self setKeyEquivalentModifierMask: ((bFlags2 >> 8) &
NSDeviceIndependentModifierFlagsMask)];
- switch (bFlags2 & (3 << 6))
+ switch ((bFlags2 >> 6) & 3)
{
case 2:
imageScale = NSImageScaleProportionallyDown;
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs