Fixes for NSFontManager handling

This commit is contained in:
Gregory John Casamento 2023-12-17 13:30:16 -05:00
parent 608c5218ce
commit 21226a0fa3
2 changed files with 43 additions and 25 deletions

View file

@ -518,28 +518,35 @@ static NSImage *fileImage = nil;
*/
- (void) _instantiateFontManager
{
GSNibItem *item = nil;
NSMenu *fontMenu = nil;
item = [[GormObjectProxy alloc] initWithClassName: @"NSFontManager"];
[self setName: @"NSFont" forObject: item];
[self attachObject: item toParent: nil];
RELEASE(item);
// set the holder in the document.
fontManager = (GormObjectProxy *)item;
[self changeToViewWithTag: 0];
// Add the connection to the menu from the font manager, if the NSFontMenu exists...
fontMenu = [self fontMenu];
if (fontMenu != nil)
if (fontManager != nil)
{
NSNibOutletConnector *con = [[NSNibOutletConnector alloc] init];
[con setSource: item];
[con setDestination: fontMenu];
[con setLabel: @"menu"];
[self addConnector: con];
return;
}
else
{
GSNibItem *item = nil;
NSMenu *fontMenu = nil;
item = [[GormObjectProxy alloc] initWithClassName: @"NSFontManager"];
[self setName: @"NSFont" forObject: item];
[self attachObject: item toParent: nil];
RELEASE(item);
// set the holder in the document.
fontManager = (GormObjectProxy *)item;
[self changeToViewWithTag: 0];
// Add the connection to the menu from the font manager, if the NSFontMenu exists...
fontMenu = [self fontMenu];
if (fontMenu != nil)
{
NSNibOutletConnector *con = [[NSNibOutletConnector alloc] init];
[con setSource: item];
[con setDestination: fontMenu];
[con setLabel: @"menu"];
[self addConnector: con];
}
}
}

View file

@ -38,12 +38,17 @@
/*
* This allows us to retrieve the customClasses from the XIB unarchiver.
*/
@interface NSKeyedUnarchiver (Private)
- (NSDictionary *) customClasses;
- (NSDictionary *) decoded;
@end
/*
* Allow access to the method to instantiate the font manager
*/
@interface GormDocument (XibPluginPrivate)
- (void) _instantiateFontManager;
@end
/*
* Xib loader...
@ -92,6 +97,12 @@
result = [document firstResponder];
[obj setRealObject: result];
}
else if ([className isEqualToString: @"NSFontManager"])
{
[document _instantiateFontManager];
result = [document fontManager];
[obj setRealObject: result];
}
else
{
result = [obj realObject];
@ -139,8 +150,7 @@
// these are preset values
if ([theId isEqualToString: @"-1"]
|| [theId isEqualToString: @"-3"]
|| [customClassName isEqualToString: @"NSFontManager"])
|| [theId isEqualToString: @"-3"])
{
return;
}
@ -224,6 +234,7 @@
NSString *subClassName = nil;
GormClassManager *classManager = [doc classManager];
document = doc; // make sure they are the same...
if ([super loadFileWrapper: wrapper
withDocument: doc] &&
[wrapper isDirectory] == NO)
@ -325,7 +336,7 @@
// skip the file's owner, it is handled above...
if ((obj == _nibFilesOwner)
|| (obj == xibFirstResponder))
// || (obj == xibFontManager))
// || (obj == xibFontManager))
{
continue;
}