Insert window menu items strictly at the bottom of the menu, keeping

only items with actions -performMiniaturize: and -performClose:
beneath them. This allows having additional items at the top of the
menu and works better for window menus that follow the Mac OS X UI
guidelines and have miniaturize and zoom commands at the top and
arrange in front below them.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31891 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2011-01-15 14:19:24 +00:00
parent 3afec9e148
commit 9464856dfe
2 changed files with 23 additions and 20 deletions

View file

@ -1,3 +1,13 @@
2011-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSApplication.m (-changeWindowsItem:title:filename):
Insert window menu items strictly at the bottom of the menu,
keeping only items with actions -performMiniaturize: and
-performClose: beneath them. This allows having additional items
at the top of the menu and works better for window menus that
follow the Mac OS X UI guidelines and have miniaturize and zoom
commands at the top and arrange in front below them.
2011-01-09 21:58-EST Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSSavePanel.m: (-_initWithoutGModel): added

View file

@ -3022,24 +3022,27 @@ image.</p><p>See Also: -applicationIconImage</p>
/*
* Now we insert a menu item for the window in the correct order.
* Make special allowance for menu entries to 'arrangeInFront: '
* Window menu items are inserted in alphabetic order at the bottom
* of the windows menu except for two special items with actions
* 'performMiniaturize: ' and 'performClose: '. If these exist the
* window entries should stay after the first one and before the
* other two.
* they are kept at the below all window entries in the menu.
*/
itemArray = [_windows_menu itemArray];
count = [itemArray count];
i = 0;
if (count > 0 && sel_isEqual([[itemArray objectAtIndex: 0] action],
@selector(arrangeInFront:)))
i++;
if (count > i && sel_isEqual([[itemArray objectAtIndex: count-1] action],
if (count > 0 && sel_isEqual([[itemArray objectAtIndex: count-1] action],
@selector(performClose:)))
count--;
if (count > i && sel_isEqual([[itemArray objectAtIndex: count-1] action],
if (count > 0 && sel_isEqual([[itemArray objectAtIndex: count-1] action],
@selector(performMiniaturize:)))
count--;
for (i = 0; i < count; i++)
{
NSMenuItem *item = [itemArray objectAtIndex: i];
if ([[item target] isKindOfClass: [NSWindow class]] &&
sel_isEqual([item action], @selector(makeKeyAndOrderFront:)))
break;
}
while (i < count)
{
@ -3050,20 +3053,10 @@ image.</p><p>See Also: -applicationIconImage</p>
i++;
}
if ([aWindow canBecomeKeyWindow])
{
item = [_windows_menu insertItemWithTitle: aString
item = [_windows_menu insertItemWithTitle: aString
action: @selector(makeKeyAndOrderFront:)
keyEquivalent: @""
atIndex: i];
}
else
{
item = [_windows_menu insertItemWithTitle: aString
action: @selector(orderFront:)
keyEquivalent: @""
atIndex: i];
}
[item setTarget: aWindow];
// When changing for a window with a file, we should also set the image.