Removed user bundle check. The code will issue a warning in the log if poseAs: is called. Also corrected the implementation of IBObjectAdditions in GormImage and GormSound.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21563 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-07-28 04:01:24 +00:00
parent 182a1a4e05
commit e012b61325
8 changed files with 50 additions and 45 deletions

View file

@ -1,3 +1,13 @@
2005-07-28 00:04 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormImage.h: Added documentation.
* GormCore/GormImage.m: Properly implemented IBObjectAdditions.
* GormCore/GormPrivate.h: Remove illegalClassSubstitution method.
* GormCore/GormPrivate.m: Remove illegalClassSubstitution method.
* GormCore/GormSound.h: Added documentation.
* GormCore/GormSound.m: Properly implemented IBObjectAdditions.
* Gorm.m: Removed methods which check for user bundles.
2005-07-27 02:10 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPrefs/GormGeneralPref.m: Removed extra calls to synchronize.

20
Gorm.m
View file

@ -193,7 +193,6 @@
- (void) applicationDidFinishLaunching: (NSApplication*)sender
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *a = nil;
if ( [defaults boolForKey: @"ShowInspectors"] )
{
@ -203,26 +202,7 @@
{
[[[self palettesManager] panel] makeKeyAndOrderFront: self];
}
if((a = [defaults arrayForKey: @"GSAppKitUserBundles"]) != nil ||
[self illegalClassSubstitution] == YES)
{
if([a count] > 0)
{
NSRunAlertPanel(_(@"User Bundle Warning"),
_(@"Gorm has detected that you are using user bundles. Please make certain that these are compatible with Gorm as some bundles can cause issues which may corrupt your .gorm files."),
_(@"OK"), nil, nil);
}
if([self illegalClassSubstitution] == YES)
{
NSRunAlertPanel(_(@"Illegal Class Substitution"),
_(@"A bundle has invoked 'poseAsClass:', this could corrupt .gorm files. Quitting."),
_(@"OK"), nil, nil);
NSBeep();
[self terminate: self];
}
}
if(GSGetMethod([GSNibContainer class],@selector(awakeWithContext:),YES,YES) == NULL)
{
NSRunAlertPanel(_(@"Incorrect GNUstep Version"),

View file

@ -39,19 +39,41 @@
NSImage *smallImage;
}
/**
* Initialize with image data located at path.
*/
+ (GormImage *) imageForPath: (NSString *)path;
/**
* Initialize with image data located at path. Mark it as in the
* wrapper depending on the value of flag.
*/
+ (GormImage *) imageForPath: (NSString *)path inWrapper: (BOOL)flag;
- (NSString *)inspectorClassName;
/**
* A thumbnail of the image.
*/
- (NSImage *)image;
/**
* The full sized image.
*/
- (NSImage *)normalImage;
@end
/**
/*
* A category which will allow us to set whether or not
* an image is archived by reference, or directly.
*/
@interface NSImage (GormNSImageAddition)
/**
* Set to YES, if the image should be archived by name only, NO otherwise.
*/
- (void) setArchiveByName: (BOOL) archiveByName;
/**
* Returns YES, if the image should be archived by name only, NO otherwise.
*/
- (BOOL) archiveByName;
@end

View file

@ -23,6 +23,7 @@
*/
#include <AppKit/NSImage.h>
#include <InterfaceBuilder/IBObjectAdditions.h>
#include "GormImage.h"
// implementation of category on NSImage.
@ -121,7 +122,9 @@
[image setArchiveByName: flag];
[smallImage setArchiveByName: flag];
}
@end
@implementation GormImage (IBObjectAdditions)
- (NSString *)inspectorClassName
{
return @"GormImageInspector";

View file

@ -120,10 +120,6 @@ extern NSString *GormResizeCellNotification;
- (NSImage *) imageForViewer;
@end
@interface NSApplication (GormAdditions)
- (BOOL) illegalClassSubstitution;
@end
@interface IBResourceManager (GormAdditions)
+ (void) registerForAllPboardTypes: (id)editor
inDocument: (id)document;

View file

@ -43,9 +43,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
// Define this as "NO" initially. We only want to turn this on while loading or testing.
static BOOL _isInInterfaceBuilder = NO;
// Has poseAs: been called?
static BOOL _illegalClassSubstitution = NO;
@class InfoPanel;
// we had this include for grouping/ungrouping selectors
@ -74,14 +71,9 @@ static BOOL _illegalClassSubstitution = NO;
@implementation NSObject (GormPrivate)
+ (void) poseAsClass: (Class)aClassObject
{
BOOL allow = [[NSUserDefaults standardUserDefaults] boolForKey: @"AllowUserBundles"];
// disable poseAs: while in Gorm.
class_pose_as(self, aClassObject);
if(!allow)
{
_illegalClassSubstitution = YES;
}
NSLog(@"WARNING: poseAs: called in Gorm.");
}
+ (BOOL) canSubstituteForClass: (Class)origClass
@ -236,13 +228,6 @@ static BOOL _illegalClassSubstitution = NO;
}
@end
@implementation NSApplication (GormAdditions)
- (BOOL) illegalClassSubstitution
{
return _illegalClassSubstitution;
}
@end
// custom class additions...
@implementation GSClassSwapper (GormCustomClassAdditions)
+ (void) setIsInInterfaceBuilder: (BOOL)flag

View file

@ -34,12 +34,18 @@
@class NSString;
@interface GormSound : GormResource
{
}
/**
* Creates a GormSound object using the file at path.
*/
+ (GormSound*) soundForPath: (NSString *)path;
/**
* Creates a GormSound object using the file at path, and marks it as
* inside or outside of the .gorm/.nib wrapper.
*/
+ (GormSound*) soundForPath: (NSString *)path inWrapper: (BOOL)flag;
- (NSString *)inspectorClassName;
@end
#endif

View file

@ -25,6 +25,7 @@
#include <Foundation/NSString.h>
#include <AppKit/NSSound.h>
#include <AppKit/NSImage.h>
#include <InterfaceBuilder/IBObjectAdditions.h>
#include "GormSound.h"
// sound proxy object...
@ -52,7 +53,9 @@
}
return self;
}
@end
@implementation GormSound (IBObjectAdditions)
- (NSString *)inspectorClassName
{
return @"GormSoundInspector";