mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Custom class related changes in Gorm. Simple, but necessary for some palettes which might use custom class substitution.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19934 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b26ee4cfc1
commit
3d3f002ee3
5 changed files with 55 additions and 6 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2004-08-28 11:00 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Gorm.m: Added calls to [GSClassSwapper
|
||||
setIsInInterfaceBuilder:] to shut off the custom class -> real
|
||||
class morphing when testing. Added implementation for
|
||||
method which changes the static value of the flag as well
|
||||
called setIsInInterfaceBuilder:.
|
||||
* GormDocument.m: Added calls in loadDocument: to
|
||||
[GSClassSwapper setIsInInterfaceBuilder:] to turn off custom
|
||||
class conversion while loading the .gorm document.
|
||||
* GormCustomView.m: Added implementation of a method
|
||||
called _bestPossibleSuperClass to get the best substitute
|
||||
for the custom class specified when testing the interface.
|
||||
This allows the user to see a more accurate picture
|
||||
of what the gui will look like when it's done.
|
||||
|
||||
2004-08-25 22:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Palettes/1Windows/GormNSWindow.m: Removed canBecomeKeyWindow
|
||||
|
|
16
Gorm.m
16
Gorm.m
|
@ -43,6 +43,9 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
|
|||
NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectFromDocumentNotification";
|
||||
NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||
|
||||
// Define this as "NO" initially. We only want to turn this on while loading or testing.
|
||||
static BOOL _isInInterfaceBuilder = NO;
|
||||
|
||||
@class InfoPanel;
|
||||
|
||||
// we had this include for grouping/ungrouping selectors
|
||||
|
@ -709,10 +712,12 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
[archiver encodeClassName: @"GormNSOutlineView"
|
||||
intoClassName: @"NSOutlineView"];
|
||||
*/
|
||||
[GSClassSwapper setIsInInterfaceBuilder: YES]; // do not allow custom classes during testing.
|
||||
[archiver encodeRootObject: activDoc];
|
||||
data = RETAIN([archiver archiverData]); // Released below...
|
||||
[activDoc endArchiving];
|
||||
RELEASE(archiver);
|
||||
[GSClassSwapper setIsInInterfaceBuilder: NO]; // beginal allowing custom classes...
|
||||
|
||||
[notifCenter postNotificationName: IBWillBeginTestingInterfaceNotification
|
||||
object: self];
|
||||
|
@ -1499,14 +1504,15 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
@end
|
||||
|
||||
// custom class additions...
|
||||
@interface GSClassSwapper (GormCustomClassAdditions)
|
||||
- (BOOL) isInInterfaceBuilder;
|
||||
@end
|
||||
|
||||
@implementation GSClassSwapper (GormCustomClassAdditions)
|
||||
+ (void) setIsInInterfaceBuilder: (BOOL)flag
|
||||
{
|
||||
_isInInterfaceBuilder = flag;
|
||||
}
|
||||
|
||||
- (BOOL) isInInterfaceBuilder
|
||||
{
|
||||
return YES;
|
||||
return _isInInterfaceBuilder;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
#include <GNUstepGUI/GSNibTemplates.h>
|
||||
#include "GormPrivate.h"
|
||||
|
||||
@class GSCustomView;
|
||||
|
||||
|
@ -126,6 +127,25 @@
|
|||
|
||||
@implementation GormTestCustomView
|
||||
|
||||
- (Class) _bestPossibleSuperClass
|
||||
{
|
||||
Class cls = [NSView class];
|
||||
GormClassManager *classManager = [(Gorm *)NSApp classManager];
|
||||
NSString *superClass = [classManager nonCustomSuperClassOf: theClass];
|
||||
|
||||
// get the superclass if one exists...
|
||||
if(superClass != nil)
|
||||
{
|
||||
cls = NSClassFromString(superClass);
|
||||
if(cls == nil)
|
||||
{
|
||||
cls = [NSView class];
|
||||
}
|
||||
}
|
||||
|
||||
return cls;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
id obj;
|
||||
|
@ -140,7 +160,7 @@
|
|||
cls = NSClassFromString(theClass);
|
||||
if (cls == nil)
|
||||
{
|
||||
cls = [NSView class];
|
||||
cls = [self _bestPossibleSuperClass];
|
||||
}
|
||||
|
||||
obj = [cls allocWithZone: [self zone]];
|
||||
|
|
|
@ -1940,6 +1940,7 @@ static NSImage *fileImage = nil;
|
|||
[u decodeClassName: @"NSOutlineView"
|
||||
asClassName: @"GormNSOutlineView"];
|
||||
|
||||
[GSClassSwapper setIsInInterfaceBuilder: YES]; // turn off custom classes.
|
||||
c = [u decodeObject];
|
||||
if (c == nil || [c isKindOfClass: [GSNibContainer class]] == NO)
|
||||
{
|
||||
|
@ -1947,6 +1948,7 @@ static NSImage *fileImage = nil;
|
|||
_(@"OK"), NULL, NULL);
|
||||
return nil;
|
||||
}
|
||||
[GSClassSwapper setIsInInterfaceBuilder: NO]; // turn on custom classes.
|
||||
|
||||
// retrieve the custom class data...
|
||||
cc = [[c nameTable] objectForKey: GSCustomClassMap];
|
||||
|
|
|
@ -52,6 +52,11 @@ extern NSString *GormResizeCellNotification;
|
|||
- (NSString*) className;
|
||||
@end
|
||||
|
||||
@interface GSClassSwapper (GormCustomClassAdditions)
|
||||
+ (void) setIsInInterfaceBuilder: (BOOL)flag;
|
||||
- (BOOL) isInInterfaceBuilder;
|
||||
@end
|
||||
|
||||
@interface GormObjectProxy : GSNibItem
|
||||
/*
|
||||
* Use a GormObjectProxy in Gorm, but encode a GSNibItem in the archive.
|
||||
|
|
Loading…
Reference in a new issue