Correction for a couple of minor issues.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20397 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-11-30 04:51:19 +00:00
parent 2363466584
commit e8e0f1d5d0
5 changed files with 41 additions and 18 deletions

View file

@ -1,3 +1,12 @@
2004-11-29 23:40 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPalettesManager.[hm]: [GormPalettesManager loadPalette:] now
returns BOOL.
* GormPalettesManager.m: [GormPalettesManager openPalette:] returns
nil of loadPalette returns NO.
* GormObjCHeaderParser/OCHeaderParser.m: Returns NO if there is no
class in the file.
2004-11-27 13:22 Gregory John Casamento <greg_casamento@yahoo.com>
* GormObjCHeaderParser/OCClass.m

View file

@ -540,8 +540,7 @@ static NSImage *fileImage = nil;
toParent: aParent];
}
}
else if ([[anObject documentView] isKindOfClass:
[NSTextView class]] == YES)
else if ([[anObject documentView] isKindOfClass: [NSTextView class]] == YES)
{
[self attachObject: [anObject documentView] toParent: aParent];
}
@ -1265,8 +1264,9 @@ static NSImage *fileImage = nil;
{
if(![classManager parseHeader: fileName])
{
NSString *file = [fileName lastPathComponent];
NSString *message = [NSString stringWithFormat:
_(@"An error occurred while parsing %@"),fileName];
_(@"Unable to parse class in %@"),file];
NSRunAlertPanel(_(@"Problem parsing class"),
message,
nil, nil, nil);

View file

@ -133,9 +133,16 @@
[scanner scanUpToString: @"@interface" intoString: NULL];
[scanner scanUpToAndIncludingString: @"@end" intoString: &classString];
cls = AUTORELEASE([[OCClass alloc] initWithString: classString]);
[cls parse];
[classes addObject: cls];
if(classString != nil && [classString length] != 0)
{
cls = AUTORELEASE([[OCClass alloc] initWithString: classString]);
[cls parse];
[classes addObject: cls];
}
else
{
result = NO;
}
}
}
NS_HANDLER

View file

@ -46,7 +46,7 @@
}
// methods for loading and display the palette panels
- (void) loadPalette: (NSString*)path;
- (BOOL) loadPalette: (NSString*)path;
- (id) openPalette: (id) sender;
- (NSPanel*) panel;
- (void) setCurrentPalette: (id)anObject;

View file

@ -357,7 +357,7 @@ static NSImage *dragImage = nil;
return self;
}
- (void) loadPalette: (NSString*)path
- (BOOL) loadPalette: (NSString*)path
{
NSBundle *bundle;
NSWindow *window;
@ -370,7 +370,7 @@ static NSImage *dragImage = nil;
IBPalette *palette;
NSImageCell *cell;
int col;
for (col = 0; col < [bundles count]; col++)
{
bundle = [bundles objectAtIndex: col];
@ -378,7 +378,7 @@ static NSImage *dragImage = nil;
{
NSRunAlertPanel (NULL, _(@"Palette has already been loaded"),
_(@"OK"), NULL, NULL);
return;
return NO;
}
}
bundle = [NSBundle bundleWithPath: path];
@ -386,16 +386,15 @@ static NSImage *dragImage = nil;
{
NSRunAlertPanel(NULL, _(@"Could not load Palette"),
_(@"OK"), NULL, NULL);
return;
return NO;
}
[bundles addObject: bundle];
path = [bundle pathForResource: @"palette" ofType: @"table"];
if (path == nil)
{
NSRunAlertPanel(NULL, _(@"File 'palette.table' missing"),
_(@"OK"), NULL, NULL);
return;
return NO;
}
paletteInfo = [[NSString stringWithContentsOfFile: path] propertyList];
@ -403,7 +402,7 @@ static NSImage *dragImage = nil;
{
NSRunAlertPanel(NULL, _(@"Failed to load 'palette.table', you may need to update GNUstep-make and do a clean build of Gorm and it's palettes."),
_(@"OK"), NULL, NULL);
return;
return NO;
}
className = [paletteInfo objectForKey: @"Class"];
@ -411,7 +410,7 @@ static NSImage *dragImage = nil;
{
NSRunAlertPanel(NULL, _(@"No palette class in 'palette.table'"),
_(@"OK"), NULL, NULL);
return;
return NO;
}
paletteClass = [bundle classNamed: className];
@ -419,7 +418,7 @@ static NSImage *dragImage = nil;
{
NSRunAlertPanel (NULL, _(@"Could not load palette class"),
_(@"OK"), NULL, NULL);
return;
return NO;
}
palette = [paletteClass new];
@ -428,9 +427,12 @@ static NSImage *dragImage = nil;
NSRunAlertPanel (NULL, _(@"Palette contains wrong type of class"),
_(@"OK"), NULL, NULL);
RELEASE(palette);
return;
return NO;
}
// add to the bundles list...
[bundles addObject: bundle];
exportClasses = [paletteInfo objectForKey: @"ExportClasses"];
if(exportClasses != nil)
{
@ -475,6 +477,8 @@ static NSImage *dragImage = nil;
[selectionView selectCellAtRow: 0 column: col];
[self setCurrentPalette: selectionView];
RELEASE(palette);
return YES;
}
- (id) openPalette: (id) sender
@ -505,7 +509,10 @@ static NSImage *dragImage = nil;
NSString *aFile = [filesToOpen objectAtIndex: i];
[newUserPalettes addObject: aFile];
[self loadPalette: aFile];
if([self loadPalette: aFile] == NO)
{
return nil;
}
}
// reset the defaults to include the new palette.