New .gorm file version support and some other minor changes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19650 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-06-29 03:27:37 +00:00
parent 60ac2cab0d
commit ead6139314
7 changed files with 72 additions and 49 deletions

View file

@ -1,3 +1,27 @@
2004-06-28 23:14 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: -[Gorm testInterface:] changed awakeWithContext: call
to use new signature.
* GormDocument.m: [GormDocument rebuildObjToNameMapping]
added logic to add all of the objects in the topLevelObjects
set to the objects view. Modified
[GormDocument attachObject:toParent:] so that any top level
object which is attached, such as a window, the main, menu,
or a controller is automatically added to the topLevelObjects
set. Modified [GormDocument loadDocument:] so that the
topLevelObjects set is properly merged into the current
document's data structures. [GormDocument setupDefaults:]
removed explicit call to [GormDocument setName:forObject:]
since the attachObject:toParent: method automatically makes
the new menu in a .gorm which doesn't have any menus the
main menu and adds it to the topLevelItems array.
* GormPalettesManager.m: Removed some of the palette prefs
code for now so I could concentrate on the version update.
* GormSoundView.m: Commented out currently unused function.
* Resources/Gorm.gorm: Updated to a version 1 gorm file.
This prevent someone from running the new Gorm with the old
gnustep which doesn't contain the recent changes.
2004-06-27 08:45 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: -[Gorm testInterface:] removed NSWindowsMenu and

3
Gorm.m
View file

@ -724,8 +724,7 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
NSMutableDictionary *nameTable = [testContainer nameTable];
[nameTable removeObjectForKey: @"NSServicesMenu"];
[nameTable removeObjectForKey: @"NSWindowsMenu"];
[testContainer awakeWithContext: nil
topLevelItems: nil]; // FIXME: Top level items will leak...
[testContainer awakeWithContext: nil];
RETAIN(testContainer); // released in endTesting:
}

View file

@ -491,10 +491,11 @@ static NSImage *classesImage = nil;
/*
* Add top-level objects to objectsView and open their editors.
*/
if ([anObject isKindOfClass: [NSWindow class]] == YES ||
[anObject isKindOfClass: [GSNibItem class]] == YES)
if ([anObject isKindOfClass: [NSWindow class]] ||
[anObject isKindOfClass: [GSNibItem class]])
{
[objectsView addObject: anObject];
[topLevelObjects addObject: anObject];
[[self openEditorForObject: anObject] activate];
if ([anObject isKindOfClass: [NSWindow class]] == YES)
{
@ -515,6 +516,7 @@ static NSImage *classesImage = nil;
{
[self setName: @"NSMenu" forObject: anObject];
[objectsView addObject: anObject];
[topLevelObjects addObject: anObject];
isMainMenu = YES;
}
else
@ -1078,6 +1080,12 @@ static NSImage *classesImage = nil;
[objectsView removeObject: anObject];
}
// if it's in the top level items array, remove it.
if([topLevelObjects containsObject: anObject])
{
[topLevelObjects removeObject: anObject];
}
// eliminate it from being the windows/services menu, if it's being detached.
if ([anObject isKindOfClass: [NSMenu class]])
{
@ -1961,10 +1969,11 @@ static NSImage *classesImage = nil;
*/
[nt removeObjectForKey: @"NSOwner"];
[nt removeObjectForKey: @"NSFirst"];
[topLevelObjects addObjectsFromArray: [[c topLevelObjects] allObjects]];
[connections addObjectsFromArray: [c connections]];
[nameTable addEntriesFromDictionary: nt];
[self rebuildObjToNameMapping];
// repair the .gorm file, if needed.
if(repairFile == YES)
{
@ -2079,6 +2088,7 @@ static NSImage *classesImage = nil;
{
NSEnumerator *enumerator;
NSString *name;
id o;
NSDebugLog(@"------ Rebuilding object to name mapping...");
NSResetMapTable(objToName);
@ -2087,32 +2097,23 @@ static NSImage *classesImage = nil;
enumerator = [[nameTable allKeys] objectEnumerator];
while ((name = [enumerator nextObject]) != nil)
{
id obj = [nameTable objectForKey: name];
id obj = [nameTable objectForKey: name];
NSDebugLog(@"%@ --> %@",name, obj);
NSMapInsert(objToName, (void*)obj, (void*)name);
if ([obj isKindOfClass: [NSMenu class]] == YES)
{
if ([name isEqual: @"NSMenu"] == YES)
{
NSRect frame = [[NSScreen mainScreen] frame];
[[obj window] setFrameTopLeftPoint:
NSMakePoint(1, frame.size.height-200)];
[[self openEditorForObject: obj] activate];
[objectsView addObject: obj];
}
}
else if ([obj isKindOfClass: [NSWindow class]] == YES)
NSMapInsert(objToName, (void*)obj, (void*)name);
if (([obj isKindOfClass: [NSMenu class]] && [name isEqual: @"NSMenu"]) || [obj isKindOfClass: [NSWindow class]])
{
[objectsView addObject: obj];
[[self openEditorForObject: obj] activate];
}
else if ([obj isKindOfClass: [GSNibItem class]] == YES
&& [obj isKindOfClass: [GormCustomView class]] == NO)
{
[objectsView addObject: obj];
}
}
// All of the entries in the items array are "top level items"
// which should be visible in the object's view.
enumerator = [topLevelObjects objectEnumerator];
while((o = [enumerator nextObject]) != nil)
{
[objectsView addObject: o];
}
}
@ -2125,8 +2126,8 @@ static NSImage *classesImage = nil;
NSArray *fileTypes;
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
int result;
NSString *pth = [[NSUserDefaults standardUserDefaults]
objectForKey:@"OpenDir"];
NSString *pth = [[NSUserDefaults standardUserDefaults]
objectForKey:@"OpenDir"];
fileTypes = [NSArray arrayWithObjects: @"gorm", @"gmodel", nil];
[oPanel setAllowsMultipleSelection: NO];
@ -2137,9 +2138,9 @@ static NSImage *classesImage = nil;
types: fileTypes];
if (result == NSOKButton)
{
NSString *filename = [oPanel filename];
NSString *ext = [filename pathExtension];
BOOL uniqueName = [(Gorm *)NSApp documentNameIsUnique: filename];
NSString *filename = [oPanel filename];
NSString *ext = [filename pathExtension];
BOOL uniqueName = [(Gorm *)NSApp documentNameIsUnique: filename];
if(uniqueName)
{
@ -2380,8 +2381,9 @@ static NSImage *classesImage = nil;
[aMenu addItemWithTitle: _(@"Quit")
action: @selector(terminate:)
keyEquivalent: @"q"];
[self setName: @"NSMenu" forObject: aMenu];
[self attachObject: aMenu toParent: nil];
// the first menu attached becomes the main menu.
[self attachObject: aMenu toParent: nil];
[objectsView addObject: aMenu];
[[aMenu window] setFrameTopLeftPoint: origin];
RELEASE(aMenu);

View file

@ -1006,7 +1006,6 @@ selectCellWithString: (NSString*)title
self = [super init];
if (self != nil)
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSView *contents;
NSSplitView *split;
NSRect rect;

View file

@ -264,22 +264,10 @@ static NSImage *dragImage = nil;
NSRect scrollRect = {{0, 192}, {272, 74}};
NSRect dragRect = {{0, 0}, {272, 192}};
unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *builtinPalettes = [defaults arrayForKey: BUILTIN_PALETTES];
NSArray *userPalettes = [defaults arrayForKey: USER_PALETTES];
// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// NSArray *builtinPalettes = [defaults arrayForKey: BUILTIN_PALETTES];
// NSArray *userPalettes = [defaults arrayForKey: USER_PALETTES];
// set the default, if not already set...
if(builtinPalettes == nil)
{
builtinPalettes = [NSArray arrayWithObjects: @"0Menus.palette",
@"1Windows.palette",
@"2Controls.palette",
@"3Containers.palette",
@"4Data.palette", nil];
[defaults setObject: builtinPalettes forKey: BUILTIN_PALETTES];
}
NSLog(@"builtin = %@",builtinPalettes);
panel = [[GormPalettePanel alloc] initWithContentRect: contentRect
styleMask: style
backing: NSBackingStoreRetained
@ -321,16 +309,25 @@ static NSImage *dragImage = nil;
array = [[NSBundle mainBundle] pathsForResourcesOfType: @"palette"
inDirectory: nil];
if ([array count] > 0)
if ([array count] > 0)
{
unsigned index;
array = [array sortedArrayUsingSelector: @selector(compare:)];
/*
if(userPalettes != nil)
{
[array addObjectFromArray: userPalettes];
}
*/
for (index = 0; index < [array count]; index++)
{
[self loadPalette: [array objectAtIndex: index]];
}
}
/*
* Select initial palette - this should be the standard controls palette.
*/

View file

@ -42,6 +42,7 @@
}
@end
/*
static float findMax(NSData *data)
{
float max = 0.0;
@ -61,6 +62,7 @@ static float findMax(NSData *data)
return max;
}
*/
@implementation GormSoundView
- (void) setSound: (NSSound *)sound

Binary file not shown.