Put only one separator item between the steady upper part of the "Windows" menu and its dynamic lower part that lists the open windows.

This commit is contained in:
Dr. Rolf Jansen 2009-07-01 21:48:07 +00:00
parent 0c666b973e
commit f1b3200ae7

View File

@ -169,10 +169,13 @@ id NSApp=nil;
}
-(NSMenu *)windowsMenu {
if(_windowsMenu==nil)
if(_windowsMenu==nil) {
_windowsMenu=[[NSApp mainMenu] _menuWithName:@"_NSWindowsMenu"];
return _windowsMenu;
if (_windowsMenu && ![[[_windowsMenu itemArray] lastObject] isSeparatorItem])
[_windowsMenu addItem:[NSMenuItem separatorItem]];
}
return _windowsMenu;
}
-(NSWindow *)mainWindow {
@ -314,15 +317,13 @@ id NSApp=nil;
_windowsMenu=[menu retain];
}
-(void)addWindowsItem:(NSWindow *)window title:(NSString *)title filename:(BOOL)isFilename {
NSMenuItem *item;
if ([[self windowsMenu] indexOfItemWithTarget:window andAction:@selector(makeKeyAndOrderFront:)] != -1)
return;
if (![[[[self windowsMenu] itemArray] lastObject] isSeparatorItem])
[[self windowsMenu] addItem:[NSMenuItem separatorItem]];
if (isFilename)
title = [NSString stringWithFormat:@"%@ -- %@", [title lastPathComponent],[title stringByDeletingLastPathComponent]];