mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
fix 4 of the 7 bugs in the menus that Richard picked up.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4499 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8c83ccf86e
commit
0aa53018c5
2 changed files with 51 additions and 17 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
1999-06-30 Michael Hanni <mhanni@sprintmail.com>
|
||||
|
||||
* Source/NSMenuView.m: fixes:
|
||||
|
||||
2. Clicking on the menu item that opened a sub-menu should close the
|
||||
sub-menu again - it doesn't. [FIXED]
|
||||
5. Menus are not always closed properly at the end of a click and drag -
|
||||
I'm not sure if you already know about this one. [FIXED]
|
||||
6. If I drag off the bottom of a menu (or submenu) then release the mouse
|
||||
button, the app crashes. [FIXED]
|
||||
|
||||
1999-06-29 Michael Hanni <mhanni@sprintmail.com>
|
||||
|
||||
* Source/NSMenu.m: complete rewrite. Some work still required to
|
||||
|
|
|
@ -88,6 +88,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
|||
{
|
||||
NSArray *menu_items = [menuv_menu itemArray];
|
||||
id anItem;
|
||||
BOOL _closeASubmenu = NO;
|
||||
|
||||
[self lockFocus];
|
||||
|
||||
|
@ -115,22 +116,26 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
|||
[anItem setState:0];
|
||||
}
|
||||
|
||||
anItem = [menu_items objectAtIndex:index];
|
||||
if (menuv_highlightedItemIndex != index) {
|
||||
anItem = [menu_items objectAtIndex:index];
|
||||
|
||||
[anItem highlight:YES
|
||||
withFrame:[self rectOfItemAtIndex:index]
|
||||
inView:self];
|
||||
[anItem highlight:YES
|
||||
withFrame:[self rectOfItemAtIndex:index]
|
||||
inView:self];
|
||||
|
||||
[anItem setState:1];
|
||||
[anItem setState:1];
|
||||
|
||||
if ([anItem hasSubmenu])
|
||||
[[anItem target] display];
|
||||
if ([anItem hasSubmenu])
|
||||
[[anItem target] display];
|
||||
|
||||
// set view needs to be redrawn
|
||||
[window flushWindow];
|
||||
// set view needs to be redrawn
|
||||
[window flushWindow];
|
||||
|
||||
// set ivar to new index
|
||||
menuv_highlightedItemIndex = index;
|
||||
// set ivar to new index
|
||||
menuv_highlightedItemIndex = index;
|
||||
} else {
|
||||
menuv_highlightedItemIndex = -1;
|
||||
}
|
||||
}
|
||||
[self unlockFocus];
|
||||
[window flushWindow];
|
||||
|
@ -484,15 +489,24 @@ frame].origin.x, [[self window] frame].size.width);
|
|||
aRect.origin.y + aRect.size.height && [[[menuv_menu itemArray] objectAtIndex:lastIndex] hasSubmenu]) {
|
||||
weLeftMenu = YES;
|
||||
done = YES;
|
||||
}
|
||||
} else {
|
||||
[self setHighlightedItemIndex:-1];
|
||||
lastIndex = index;
|
||||
weWereOut = YES;
|
||||
[window flushWindow];
|
||||
}
|
||||
} else if (lastLocation.x < 0) {
|
||||
if ([menuv_menu supermenu]) {
|
||||
weRightMenu = YES;
|
||||
done = YES;
|
||||
} else {
|
||||
[self setHighlightedItemIndex:-1];
|
||||
lastIndex = index;
|
||||
weWereOut = YES;
|
||||
[window flushWindow];
|
||||
}
|
||||
} else {
|
||||
// FIXME, Michael. This might be needed... or not?
|
||||
/*
|
||||
NSLog(@"This is the final else... its evil\n");
|
||||
if (lastIndex >= 0 && lastIndex < theCount) {
|
||||
[self setHighlightedItemIndex:-1];
|
||||
|
@ -500,7 +514,6 @@ NSLog(@"This is the final else... its evil\n");
|
|||
weWereOut = YES;
|
||||
[window flushWindow];
|
||||
}
|
||||
*/
|
||||
}
|
||||
[window flushWindow];
|
||||
default:
|
||||
|
@ -508,7 +521,7 @@ NSLog(@"This is the final else... its evil\n");
|
|||
}
|
||||
}
|
||||
|
||||
if (!weLeftMenu && !weRightMenu) {
|
||||
if (!weLeftMenu && !weRightMenu && !weWereOut && menuv_highlightedItemIndex != -1) {
|
||||
if (![[[menuv_menu itemArray] objectAtIndex:menuv_highlightedItemIndex] hasSubmenu]) {
|
||||
BOOL finished = NO;
|
||||
NSMenu *aMenu = menuv_menu;
|
||||
|
@ -517,11 +530,21 @@ NSLog(@"This is the final else... its evil\n");
|
|||
[self setHighlightedItemIndex:-1];
|
||||
|
||||
if ([selectedCell action])
|
||||
[menuv_menu performActionForItem:[[menuv_menu itemArray] objectAtIndex:index]];
|
||||
[menuv_menu performActionForItem:[[menuv_menu itemArray] objectAtIndex:lastIndex]];
|
||||
|
||||
if ([selectedCell hasSubmenu])
|
||||
[[selectedCell target] close];
|
||||
|
||||
while (!finished) { // "forward"cursive menu find.
|
||||
if ([aMenu attachedMenu]) {
|
||||
aMenu = [aMenu attachedMenu];
|
||||
}
|
||||
else
|
||||
finished = YES;
|
||||
}
|
||||
|
||||
finished = NO;
|
||||
|
||||
while (!finished) { // Recursive menu close & deselect.
|
||||
if ([aMenu supermenu] && ![aMenu isTornOff]) {
|
||||
[[[aMenu supermenu] menuView] setHighlightedItemIndex:-1];
|
||||
|
@ -562,7 +585,7 @@ NSLog(@"This is the final else... its evil\n");
|
|||
clickCount:[event clickCount]
|
||||
pressure:[event pressure]]];
|
||||
}
|
||||
} else /* The weLeftMenu case */ {
|
||||
} else if (weLeftMenu) { /* The weLeftMenu case */
|
||||
NSPoint cP = [[self window] convertBaseToScreen:lastLocation];
|
||||
|
||||
NSLog(@"Urph.\n");
|
||||
|
|
Loading…
Reference in a new issue