mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 06:41:12 +00:00
nib loading fix added.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12491 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3e53223862
commit
f20aa934fc
2 changed files with 66 additions and 40 deletions
|
@ -1,4 +1,10 @@
|
||||||
2002-02-10 Michael Hanni <mhanni@sprintmail.com>
|
2002-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSBundleAdditions.m:
|
||||||
|
([loadNibFile:externalNameTable:withZone:]) fix so that, if given a
|
||||||
|
name with a .nib extension, try correctly to use a .gorm or .gmodel.
|
||||||
|
|
||||||
|
002-02-10 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
* Source/NSMenuView.m ([-drawRect:]): make this more efficent,
|
* Source/NSMenuView.m ([-drawRect:]): make this more efficent,
|
||||||
only redraw cells that we clip.
|
only redraw cells that we clip.
|
||||||
|
@ -140,6 +146,7 @@ Sun Feb 3 11:53:13 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
* Source/GSTextStorage.m: Use new GSI API from latest CVS base
|
* Source/GSTextStorage.m: Use new GSI API from latest CVS base
|
||||||
* library.
|
* library.
|
||||||
|
|
||||||
|
>>>>>>> 1.1333
|
||||||
2002-01-31 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
2002-01-31 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||||
|
|
||||||
* Source/NSCell.m
|
* Source/NSCell.m
|
||||||
|
|
|
@ -203,49 +203,62 @@ Class gmodel_class(void)
|
||||||
|
|
||||||
if (gmclass == Nil)
|
if (gmclass == Nil)
|
||||||
{
|
{
|
||||||
NSBundle *theBundle;
|
NSBundle *theBundle;
|
||||||
NSEnumerator *benum;
|
NSEnumerator *benum;
|
||||||
NSString *path;
|
NSString *path;
|
||||||
|
|
||||||
/* Find the bundle */
|
/* Find the bundle */
|
||||||
benum = [NSStandardLibraryPaths() objectEnumerator];
|
benum = [NSStandardLibraryPaths() objectEnumerator];
|
||||||
while ((path = [benum nextObject]))
|
while ((path = [benum nextObject]))
|
||||||
{
|
{
|
||||||
path = [path stringByAppendingPathComponent: @"Bundles"];
|
path = [path stringByAppendingPathComponent: @"Bundles"];
|
||||||
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
|
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
|
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
|
||||||
break;
|
break;
|
||||||
path = nil;
|
path = nil;
|
||||||
}
|
}
|
||||||
NSCAssert(path != nil, @"Unable to load gmodel bundle");
|
NSCAssert(path != nil, @"Unable to load gmodel bundle");
|
||||||
NSDebugLog(@"Loading gmodel from %@", path);
|
NSDebugLog(@"Loading gmodel from %@", path);
|
||||||
|
|
||||||
theBundle = [NSBundle bundleWithPath: path];
|
theBundle = [NSBundle bundleWithPath: path];
|
||||||
NSCAssert(theBundle != nil, @"Can't init gmodel bundle");
|
NSCAssert(theBundle != nil, @"Can't init gmodel bundle");
|
||||||
gmclass = [theBundle classNamed: @"GMModel"];
|
gmclass = [theBundle classNamed: @"GMModel"];
|
||||||
NSCAssert(gmclass, @"Can't load gmodel bundle");
|
NSCAssert(gmclass, @"Can't load gmodel bundle");
|
||||||
}
|
}
|
||||||
return gmclass;
|
return gmclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL) loadNibFile: (NSString *)fileName
|
+ (BOOL) loadNibFile: (NSString*)fileName
|
||||||
externalNameTable: (NSDictionary *)context
|
externalNameTable: (NSDictionary*)context
|
||||||
withZone: (NSZone *)zone
|
withZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
BOOL loaded = NO;
|
BOOL loaded = NO;
|
||||||
NSUnarchiver *unarchiver = nil;
|
NSUnarchiver *unarchiver = nil;
|
||||||
NSString *ext = [fileName pathExtension];
|
NSString *ext = [fileName pathExtension];
|
||||||
|
|
||||||
if ([[fileName pathExtension] isEqual: @"nib"])
|
if ([ext isEqual: @"nib"])
|
||||||
{
|
{
|
||||||
/* We can't read nibs, look for an equivalent gmodel file */
|
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||||
fileName = [fileName stringByDeletingPathExtension];
|
NSString *base = [fileName stringByDeletingPathExtension];
|
||||||
fileName = [fileName stringByAppendingPathExtension: @"gmodel"];
|
|
||||||
|
/* We can't read nibs, look for an equivalent gorm or gmodel file */
|
||||||
|
fileName = [base stringByAppendingPathExtension: @"gorm"];
|
||||||
|
if ([mgr isReadableFileAtPath: fileName])
|
||||||
|
{
|
||||||
|
ext = @"gorm";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileName = [fileName stringByAppendingPathExtension: @"gmodel"];
|
||||||
|
ext = @"gmodel";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file to be read is a gmodel, use the GMModel method to
|
/*
|
||||||
// read it in and skip the dearchiving below.
|
* If the file to be read is a gmodel, use the GMModel method to
|
||||||
if([ext isEqualToString: @"gmodel"])
|
* read it in and skip the dearchiving below.
|
||||||
|
*/
|
||||||
|
if ([ext isEqualToString: @"gmodel"])
|
||||||
{
|
{
|
||||||
return [gmodel_class() loadIMFile: fileName
|
return [gmodel_class() loadIMFile: fileName
|
||||||
owner: [context objectForKey: @"NSOwner"]];
|
owner: [context objectForKey: @"NSOwner"]];
|
||||||
|
@ -293,9 +306,10 @@ Class gmodel_class(void)
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
|
|
||||||
if (!loaded)
|
if (loaded == NO)
|
||||||
NSLog(@"Failed to load Nib\n");
|
{
|
||||||
|
NSLog(@"Failed to load Nib\n");
|
||||||
|
}
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,8 +320,9 @@ Class gmodel_class(void)
|
||||||
NSBundle *bundle;
|
NSBundle *bundle;
|
||||||
|
|
||||||
if (owner == nil || aNibName == nil)
|
if (owner == nil || aNibName == nil)
|
||||||
return NO;
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
table = [NSDictionary dictionaryWithObject: owner forKey: @"NSOwner"];
|
table = [NSDictionary dictionaryWithObject: owner forKey: @"NSOwner"];
|
||||||
bundle = [self bundleForClass: [owner class]];
|
bundle = [self bundleForClass: [owner class]];
|
||||||
if (bundle == nil)
|
if (bundle == nil)
|
||||||
|
@ -403,11 +418,15 @@ Class gmodel_class(void)
|
||||||
NSString *path = [self pathForNibResource: fileName];
|
NSString *path = [self pathForNibResource: fileName];
|
||||||
|
|
||||||
if (path != nil)
|
if (path != nil)
|
||||||
return [NSBundle loadNibFile: path
|
{
|
||||||
externalNameTable: context
|
return [NSBundle loadNibFile: path
|
||||||
withZone: (NSZone*)zone];
|
externalNameTable: context
|
||||||
|
withZone: (NSZone*)zone];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return NO;
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -422,7 +441,7 @@ Class gmodel_class(void)
|
||||||
active, [win -orderFront:] requests get ignored, so we add the window
|
active, [win -orderFront:] requests get ignored, so we add the window
|
||||||
to the inactive list, so it gets sent an -orderFront when the app
|
to the inactive list, so it gets sent an -orderFront when the app
|
||||||
becomes active. */
|
becomes active. */
|
||||||
- (void)_deactivateVisibleWindow: (NSWindow *)win
|
- (void) _deactivateVisibleWindow: (NSWindow *)win
|
||||||
{
|
{
|
||||||
if (_inactive)
|
if (_inactive)
|
||||||
[_inactive addObject: win];
|
[_inactive addObject: win];
|
||||||
|
|
Loading…
Reference in a new issue