Various fixes and changes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18843 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-03-13 12:40:44 +00:00
parent fab1da799f
commit 33bdeb15af
4 changed files with 78 additions and 3 deletions

View file

@ -1,3 +1,15 @@
2004-03-13 07:45 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: [GormDocument loadDocument:] added call to
[GormDocument _repairFile] if a given default is true. This gives
the user the ability to repair older files which might have
issues.
* GormFilesOwner.m: [GormFilesOwnerInspector setObject:] only
return NSView subclasses if the object passed in is a
GormCustomView. This was causing an issue when users were simply
arbitrarily setting the object without regard to this.
* GormPalettesManager.m: Minor cleanup.
2004-03-05 01:45 Gregory John Casamento <greg_casamento@yahoo.com>
* GormViewWithSubviewsEditor.m: Removed call in

View file

@ -1923,6 +1923,51 @@ static NSImage *classesImage = nil;
return [nameTable allValues];
}
// The sole purpose of this method is to clean up .gorm files from older
// versions of Gorm which might have some dangling references. This method
// should possibly added to as time goes on to make sure that it's possible
// to repair old .gorm files.
- (void) _repairFile
{
NSEnumerator *en = [nameTable keyEnumerator];
NSString *key = nil;
while((key = [en nextObject]) != nil)
{
id obj = [nameTable objectForKey: key];
if([obj isKindOfClass: [NSMenu class]] && ![key isEqual: @"NSMenu"])
{
id sm = [obj supermenu];
if(sm == nil)
{
NSArray *menus = findAll(obj);
[self detachObjects: menus];
NSLog(@"Found and removed a dangling menu %@, %@.",obj,[self nameForObject: obj]);
}
}
if([obj isKindOfClass: [NSMenuItem class]])
{
id m = [obj menu];
if(m == nil)
{
NSArray *menus = findAll(obj);
[self detachObjects: menus];
NSLog(@"Found and removed a dangling menu item %@, %@.",obj,[self nameForObject: obj]);
}
}
if([obj isKindOfClass: [NSView class]])
{
id sv = [obj superview];
if(sv == nil)
{
NSLog(@"Found a dangling view %@, %@.",obj,[self nameForObject: obj]);
}
}
}
}
/*
* NB. This assumes we have an empty document to start with - the loaded
* document is merged in to it.
@ -1941,7 +1986,8 @@ static NSImage *classesImage = nil;
NSFileManager *mgr = [NSFileManager defaultManager];
BOOL isDir = NO;
NSDirectoryEnumerator *dirEnumerator;
BOOL repairFile = [[NSUserDefaults standardUserDefaults] boolForKey: @"GormRepairFileOnLoad"];
if ([mgr fileExistsAtPath: aFile isDirectory: &isDir])
{
// if the data is in a directory, then load from objects.gorm
@ -2162,6 +2208,12 @@ static NSImage *classesImage = nil;
}
*/
// repair the .gorm file, if needed.
if(repairFile == YES)
{
[self _repairFile];
}
// this is the last thing we should do...
[nc postNotificationName: IBDidOpenDocumentNotification
object: self];

View file

@ -25,6 +25,8 @@
#include <AppKit/NSNibConnector.h>
#include "GormPrivate.h"
@class GormCustomView;
@implementation GormFilesOwner
- (NSString*) className
{
@ -167,7 +169,16 @@
- (void) setObject: (id)anObject
{
ASSIGN(classes, [[NSApp classManager] allClassNames]);
// filter the classes to view only when a custom view is selected.
if([anObject isKindOfClass: [GormCustomView class]])
{
ASSIGN(classes, [[NSApp classManager] allSubclassesOf: @"NSView"]);
}
else
{
ASSIGN(classes, [[NSApp classManager] allClassNames]);
}
if (anObject != nil)
{
NSArray *array;

View file

@ -244,7 +244,7 @@ static NSImage *dragImage = nil;
NSRect selectionRect = {{0, 0}, {52, 52}};
NSRect scrollRect = {{0, 192}, {272, 74}};
NSRect dragRect = {{0, 0}, {272, 192}};
unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
panel = [[GormPalettePanel alloc] initWithContentRect: contentRect
styleMask: style