Nib improvments and a document bugfix.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23059 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-06-15 04:53:09 +00:00
parent cad6a29fde
commit 464ee79c8d
4 changed files with 86 additions and 27 deletions

View file

@ -1,3 +1,12 @@
2006-06-15 00:51 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
new method declarations.
* Source/GSNibCompatibility.m: Added isInterfaceBuilder method
here.
* Source/NSDocument.m: Added code to prevent the popup from
showing blank when the fileType is set to a non-Editor type.
2006-06-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView_actions.m (-deleteToEndOfLine:): New method

View file

@ -100,6 +100,7 @@ typedef struct _GSWindowTemplateFlags
id _view;
GSWindowTemplateFlags _flags;
NSString *_autosaveName;
Class _baseWindowClass;
}
- (void) setBackingStoreType: (NSBackingStoreType)type;
- (NSBackingStoreType) backingStoreType;
@ -122,6 +123,7 @@ typedef struct _GSWindowTemplateFlags
- (id) realObject;
- (void) setView: (id)view;
- (id) view;
- (Class) baseWindowClass;
@end
@interface NSViewTemplate : NSView <OSXNibTemplate, NSCoding>
@ -204,6 +206,8 @@ typedef struct _GSWindowTemplateFlags
NSString *_originalClassName;
id _template;
}
+ (void) setIsInInterfaceBuilder: (BOOL)flag;
+ (BOOL) isInInterfaceBuilder;
- (void) setTemplate: (id)temp;
- (id) template;
- (void) setClassName: (NSString *)className;
@ -227,12 +231,15 @@ typedef struct _GSWindowTemplateFlags
unsigned _nextOid;
NSMutableArray *_accessibilityConnectors;
NSMapTable *_accessibilityOids;
NSMutableSet *_topLevelObjects;
}
- (id) instantiateObject: (id)obj;
- (void) nibInstantiateWithOwner: (id)owner;
- (void) nibInstantiateWithOwner: (id)owner topLevelObjects: (NSMutableArray *)toplevel;
- (id) objectForName: (NSString *)name;
- (NSString *) nameForObject: (id)name;
- (NSMapTable) objects;
- (NSArray *) visibleWindows;
@end
#endif /* _GNUstep_H_GSNibCompatibility */

View file

@ -52,6 +52,8 @@
#include <GNUstepGUI/GSNibCompatibility.h>
#include <GNUstepGUI/GSInstantiator.h>
static BOOL _isInInterfaceBuilder = NO;
@implementation NSWindowTemplate
+ (void) initialize
{
@ -121,6 +123,8 @@
ASSIGN(_title, [coder decodeObjectForKey: @"NSWindowTitle"]);
_windowStyle |= NSTitledWindowMask;
}
_baseWindowClass = [NSWindow class];
}
else
{
@ -157,10 +161,19 @@
{
if(_realObject == nil)
{
Class aClass = NSClassFromString(_windowClass);
Class aClass;
NSEnumerator *en;
id v = nil;
if([NSClassSwapper isInInterfaceBuilder])
{
aClass = [self baseWindowClass];
}
else
{
aClass = NSClassFromString(_windowClass);
}
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
@ -321,6 +334,11 @@
{
return _windowClass;
}
- (Class) baseWindowClass
{
return _baseWindowClass;
}
@end
// Template for any classes which derive from NSView
@ -546,7 +564,17 @@
{
if(_object == nil)
{
Class aClass = NSClassFromString(_className);
Class aClass;
if([NSClassSwapper isInInterfaceBuilder])
{
aClass = [self class];
}
else
{
aClass = NSClassFromString(_className);
}
if(aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
@ -583,7 +611,17 @@
{
if(_view == nil)
{
Class aClass = NSClassFromString(_className);
Class aClass;
if([NSClassSwapper isInInterfaceBuilder])
{
aClass = [self class];
}
else
{
aClass = NSClassFromString(_className);
}
if(aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
@ -738,6 +776,16 @@
@end
@implementation NSClassSwapper
+ (void) setIsInInterfaceBuilder: (BOOL)flag
{
_isInInterfaceBuilder = flag;
}
+ (BOOL) isInInterfaceBuilder
{
return _isInInterfaceBuilder;
}
- (void) setTemplate: (id)temp
{
ASSIGN(_template, temp);
@ -758,11 +806,6 @@
return _className;
}
+ (BOOL) isInInterfaceBuilder
{
return NO;
}
- (void) instantiateRealObject: (NSCoder *)coder withClassName: (NSString *)className
{
Class aClass = NSClassFromString(className);
@ -947,7 +990,7 @@
- (NSMutableSet *) topLevelObjects
{
return nil;
return _topLevelObjects;
}
- (NSMutableDictionary *) nameTable
@ -955,16 +998,16 @@
return nil;
}
- (NSDictionary *) customClasses
{
return nil;
}
- (NSArray *) visibleWindows
{
return [_visibleWindows allObjects];
}
- (NSMapTable) objects
{
return _objects;
}
- (id) objectForName: (NSString *)name
{
NSArray *nameKeys = (NSArray *)NSAllMapTableKeys(_names);
@ -989,17 +1032,6 @@
return result;
}
- (void) setName: (NSString *)name forObject: (id)obj
{
// TODO_NIB: Implement this in GSNibCompatibility.
}
- (BOOL) containsObject: (id) obj
{
// TODO_NIB: Implement this in GSNibCompatibility.
return NO;
}
/**
* Get the values from the map in the same order as the keys.
*/
@ -1124,6 +1156,9 @@
[self _buildMap: _names withKeys: nameKeys andValues: nameValues];
[self _buildMap: _objects withKeys: objectsKeys andValues: objectsValues];
[self _buildMap: _oids withKeys: oidsKeys andValues: oidsValues];
// instantiate...
_topLevelObjects = [[NSMutableSet alloc] init];
}
}
else
@ -1180,6 +1215,7 @@
RELEASE(_framework);
RELEASE(_visibleWindows);
RELEASE(_root);
RELEASE(_topLevelObjects);
[super dealloc];
}

View file

@ -523,7 +523,14 @@
{
NSString *title = [[NSDocumentController sharedDocumentController]
displayNameForType: [self fileType]];
[spaButton selectItemWithTitle: title];
if([spaButton itemWithTitle: title] != nil)
{
[spaButton selectItemWithTitle: title];
}
else
{
[spaButton selectItemAtIndex: 0];
}
}
}