mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
Add changes to fix fontMenu issue
This commit is contained in:
parent
407a0403ad
commit
f56cf39b0a
4 changed files with 79 additions and 9 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2021-05-15 Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
|
* English.lproj/Gorm.rtfd/TXT.rtf: Add help file
|
||||||
|
* GNUmakefile: Copy help file.
|
||||||
|
* GormCore/GormClassEditor.m
|
||||||
|
* GormCore/GormClassManager.m
|
||||||
|
* GormCore/GormConnectionInspector.m: Code cleanup.
|
||||||
|
* GormCore/GormDocument.h: Declaration of setFontMenu:/fontMenu
|
||||||
|
* GormCore/GormDocument.m: Add setFontMenu:/fontMenu methods.
|
||||||
|
Add outlet connector so that font menu us connected to the font
|
||||||
|
manager when the model is loaded.
|
||||||
|
* GormInfo.plist: Update version
|
||||||
|
* Palettes/0Menus/MenusPalette.m: Use auto variable to hold
|
||||||
|
the NSFontManager singleton.
|
||||||
|
|
||||||
2021-05-09 Gregory John Casamento <greg.casamento@gmail.com>
|
2021-05-09 Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
* GormCore/GormClassManager.m: Code cleanup
|
* GormCore/GormClassManager.m: Code cleanup
|
||||||
|
|
|
@ -283,6 +283,16 @@
|
||||||
*/
|
*/
|
||||||
- (NSMenu *) servicesMenu;
|
- (NSMenu *) servicesMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the font menu.
|
||||||
|
*/
|
||||||
|
- (void) setFontMenu: (NSMenu *)menu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the font menu for the document.
|
||||||
|
*/
|
||||||
|
- (NSMenu *) fontMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the windows menu.
|
* Sets the windows menu.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -499,9 +499,12 @@ static NSImage *fileImage = nil;
|
||||||
if ([connections indexOfObjectIdenticalTo: aConnector] == NSNotFound)
|
if ([connections indexOfObjectIdenticalTo: aConnector] == NSNotFound)
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
[nc postNotificationName: IBWillAddConnectorNotification
|
[nc postNotificationName: IBWillAddConnectorNotification
|
||||||
object: aConnector];
|
object: aConnector];
|
||||||
|
|
||||||
[connections addObject: aConnector];
|
[connections addObject: aConnector];
|
||||||
|
|
||||||
[nc postNotificationName: IBDidAddConnectorNotification
|
[nc postNotificationName: IBDidAddConnectorNotification
|
||||||
object: aConnector];
|
object: aConnector];
|
||||||
}
|
}
|
||||||
|
@ -521,6 +524,7 @@ static NSImage *fileImage = nil;
|
||||||
- (void) _instantiateFontManager
|
- (void) _instantiateFontManager
|
||||||
{
|
{
|
||||||
GSNibItem *item = nil;
|
GSNibItem *item = nil;
|
||||||
|
NSMenu *fontMenu = nil;
|
||||||
|
|
||||||
item = [[GormObjectProxy alloc] initWithClassName: @"NSFontManager"];
|
item = [[GormObjectProxy alloc] initWithClassName: @"NSFontManager"];
|
||||||
|
|
||||||
|
@ -531,6 +535,17 @@ static NSImage *fileImage = nil;
|
||||||
// set the holder in the document.
|
// set the holder in the document.
|
||||||
fontManager = (GormObjectProxy *)item;
|
fontManager = (GormObjectProxy *)item;
|
||||||
[self changeToViewWithTag: 0];
|
[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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -629,6 +644,7 @@ static NSImage *fileImage = nil;
|
||||||
// the proxy instead.
|
// the proxy instead.
|
||||||
[self _instantiateFontManager];
|
[self _instantiateFontManager];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the menu items from the popup.
|
* Add the menu items from the popup.
|
||||||
*/
|
*/
|
||||||
|
@ -681,6 +697,10 @@ static NSImage *fileImage = nil;
|
||||||
{
|
{
|
||||||
[self setRecentDocumentsMenu: menu];
|
[self setRecentDocumentsMenu: menu];
|
||||||
}
|
}
|
||||||
|
if([[menu title] isEqual: @"Font"] && [self fontMenu] == nil)
|
||||||
|
{
|
||||||
|
[self setFontMenu: menu];
|
||||||
|
}
|
||||||
// if it doesn't have a supermenu and it's owned by the file's owner, then it's a top level menu....
|
// if it doesn't have a supermenu and it's owned by the file's owner, then it's a top level menu....
|
||||||
else if([menu supermenu] == nil && aParent == filesOwner)
|
else if([menu supermenu] == nil && aParent == filesOwner)
|
||||||
{
|
{
|
||||||
|
@ -2038,6 +2058,7 @@ static void _real_close(GormDocument *self,
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
RETAIN(aConnector); // prevent it from being dealloc'd until the notification is done.
|
RETAIN(aConnector); // prevent it from being dealloc'd until the notification is done.
|
||||||
|
|
||||||
// issue pre notification..
|
// issue pre notification..
|
||||||
[nc postNotificationName: IBWillRemoveConnectorNotification
|
[nc postNotificationName: IBWillRemoveConnectorNotification
|
||||||
object: aConnector];
|
object: aConnector];
|
||||||
|
@ -2045,10 +2066,12 @@ static void _real_close(GormDocument *self,
|
||||||
// mark the document as changed.
|
// mark the document as changed.
|
||||||
[self touch];
|
[self touch];
|
||||||
|
|
||||||
// issue post notification..
|
|
||||||
[connections removeObjectIdenticalTo: aConnector];
|
[connections removeObjectIdenticalTo: aConnector];
|
||||||
|
|
||||||
|
// issue post notification..
|
||||||
[nc postNotificationName: IBDidRemoveConnectorNotification
|
[nc postNotificationName: IBDidRemoveConnectorNotification
|
||||||
object: aConnector];
|
object: aConnector];
|
||||||
|
|
||||||
RELEASE(aConnector); // NOW we can dealloc it.
|
RELEASE(aConnector); // NOW we can dealloc it.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2297,6 +2320,29 @@ static void _real_close(GormDocument *self,
|
||||||
return [nameTable objectForKey: @"NSServicesMenu"];
|
return [nameTable objectForKey: @"NSServicesMenu"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the object that will be the font menu in the app.
|
||||||
|
*/
|
||||||
|
- (void) setFontMenu: (NSMenu *)anObject
|
||||||
|
{
|
||||||
|
if(anObject != nil)
|
||||||
|
{
|
||||||
|
[nameTable setObject: anObject forKey: @"NSFontMenu"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[nameTable removeObjectForKey: @"NSFontMenu"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the object that will be the services menu.
|
||||||
|
*/
|
||||||
|
- (NSMenu *) fontMenu
|
||||||
|
{
|
||||||
|
return [nameTable objectForKey: @"NSFontMenu"];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the menu that will be the recent documents menu in the app.
|
* Set the menu that will be the recent documents menu in the app.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -127,7 +127,6 @@
|
||||||
*/
|
*/
|
||||||
fm = [NSFontManager sharedFontManager];
|
fm = [NSFontManager sharedFontManager];
|
||||||
m = [GormNSMenu menuWithMenu: [fm fontMenu: YES]];
|
m = [GormNSMenu menuWithMenu: [fm fontMenu: YES]];
|
||||||
[fm setFontMenu: m];
|
|
||||||
|
|
||||||
// Other font menu items
|
// Other font menu items
|
||||||
[m addItemWithTitle: @"Underline"
|
[m addItemWithTitle: @"Underline"
|
||||||
|
@ -363,7 +362,7 @@
|
||||||
action: NULL
|
action: NULL
|
||||||
keyEquivalent: @""];
|
keyEquivalent: @""];
|
||||||
|
|
||||||
s = [GormNSMenu menuWithMenu: [[NSFontManager sharedFontManager] fontMenu: YES]];
|
s = [GormNSMenu menuWithMenu: [fm fontMenu: YES]];
|
||||||
|
|
||||||
// Other font menu items
|
// Other font menu items
|
||||||
[s addItemWithTitle: @"Underline"
|
[s addItemWithTitle: @"Underline"
|
||||||
|
|
Loading…
Reference in a new issue