mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Many updates to fix problems with menus etc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3500 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9b5c4cc695
commit
07295c17fe
7 changed files with 70 additions and 56 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
Tue Dec 22 12:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/GSServicesManager.m: ([-rebuildServicesMenu:]) release submenu
|
||||
once it's added to main menu.a ([-update]) Don't force a display -
|
||||
let the autodisplay mechanism do it.
|
||||
* Source/NSMenu.m: ([-update]) Check to see if autoupdate is enabled
|
||||
properly and don't force a redisplay unnecessarily.
|
||||
* Source/NSApplication.m: ([-run]) update main menu items.
|
||||
* Source/NSMenuItem.m: Fix memory leak when copying an item with a
|
||||
submenu - the submenu was never released.
|
||||
* Source/NSWindow.m: Don't add window to windows menu in
|
||||
([-initWithContentRect:styleMask:backing:defer:screen:]).
|
||||
([-setMiniwindowTitle:]) Don't change windows menu if excluded.
|
||||
([-makeKeyAndOrderFront:]) Make main window as well as key window.
|
||||
([-initWithCoder:]) Don't put in windows menu automatically.
|
||||
* Source/NSpanel.m: Implemented ([canBecomeMainWindow]) to return NO.
|
||||
|
||||
Sat Dec 19 01:26:06 1998 Matthias Klose <doko@cs.tu-berlin.de>
|
||||
|
||||
* Images/Makefile.postamble: Use macro MKDIRS.
|
||||
|
|
|
@ -689,6 +689,7 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
menu = [[NSMenu alloc] initWithTitle: parentTitle];
|
||||
[servicesMenu setSubmenu: menu
|
||||
forItem: item];
|
||||
[menu release];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -957,7 +958,7 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
|
||||
/*
|
||||
* If there is no title mapping, this cell must be a
|
||||
* submenu - so we chaeck the submenu cells.
|
||||
* submenu - so we check the submenu cells.
|
||||
*/
|
||||
if (title == nil && [[cell target] isKindOfClass: [NSMenu class]])
|
||||
{
|
||||
|
@ -984,9 +985,6 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
[subMenuCells cellFrameAtRow: j]];
|
||||
}
|
||||
}
|
||||
/* FIXME - only doing this here 'cos auto-display doesn't work */
|
||||
if ([subMenuCells needsDisplay])
|
||||
[subMenuCells display];
|
||||
}
|
||||
else
|
||||
shouldBeEnabled = [self validateMenuItem: cell];
|
||||
|
@ -997,9 +995,6 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
[menuCells setNeedsDisplayInRect: [menuCells cellFrameAtRow: i]];
|
||||
}
|
||||
}
|
||||
/* FIXME - only doing this here 'cos auto-display doesn't work */
|
||||
if ([menuCells needsDisplay])
|
||||
[menuCells display];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,11 +286,13 @@ NSAutoreleasePool* pool;
|
|||
if (e)
|
||||
[self sendEvent: e];
|
||||
|
||||
[listener updateServicesMenu]; // update (en/disable) the
|
||||
// services menu's items
|
||||
[main_menu update];
|
||||
|
||||
if (windows_need_update) // send an update message
|
||||
[self updateWindows]; // to all visible windows
|
||||
|
||||
[listener updateServicesMenu]; // update (en/disable) the
|
||||
// services menu's items
|
||||
[pool release];
|
||||
}
|
||||
while (!app_should_quit);
|
||||
|
|
|
@ -440,13 +440,13 @@ static Class menuCellClass = nil;
|
|||
|
||||
- (void)update
|
||||
{
|
||||
// SUBCLASS to redisplay the menu
|
||||
// SUBCLASS to redisplay the menu if necessary
|
||||
|
||||
id cells;
|
||||
int i, count;
|
||||
id theApp = [NSApplication sharedApplication];
|
||||
|
||||
if (![[theApp mainMenu] autoenablesItems])
|
||||
if (![self autoenablesItems])
|
||||
return;
|
||||
|
||||
cells = [menuCells itemArray];
|
||||
|
@ -509,15 +509,11 @@ static Class menuCellClass = nil;
|
|||
}
|
||||
}
|
||||
|
||||
/* Reenable displaying of menus */
|
||||
[self setMenuChangedMessagesEnabled:YES];
|
||||
|
||||
if (menuHasChanged)
|
||||
[self sizeToFit];
|
||||
|
||||
/* FIXME - only doing this here 'cos auto-display doesn't work */
|
||||
if ([menuCells needsDisplay])
|
||||
[menuCells display];
|
||||
/* Reenable displaying of menus */
|
||||
[self setMenuChangedMessagesEnabled:YES];
|
||||
}
|
||||
|
||||
- (void) performActionForItem: (id <NSMenuItem>)cell
|
||||
|
@ -531,11 +527,11 @@ static Class menuCellClass = nil;
|
|||
nc = [NSNotificationCenter defaultCenter];
|
||||
d = [NSDictionary dictionaryWithObject: cell forKey: @"MenuItem"];
|
||||
[nc postNotificationName: NSMenuWillSendActionNotification
|
||||
object: self
|
||||
userInfo: d];
|
||||
object: self
|
||||
userInfo: d];
|
||||
[[NSApplication sharedApplication] sendAction: [cell action]
|
||||
to: [cell target]
|
||||
from: cell];
|
||||
to: [cell target]
|
||||
from: cell];
|
||||
[nc postNotificationName: NSMenuDidSendActionNotification
|
||||
object: self
|
||||
userInfo: d];
|
||||
|
|
|
@ -72,17 +72,19 @@ static BOOL usesUserKeyEquivalents = YES;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSMenuItem* copy = [super copyWithZone:zone];
|
||||
|
||||
NSDebugLog (@"menu item '%@' copy", [self title]);
|
||||
copy->representedObject = [representedObject retain];
|
||||
copy->hasSubmenu = hasSubmenu;
|
||||
if (hasSubmenu) { // recursive call
|
||||
id submenu = [target copyWithZone:zone]; // to create our
|
||||
copy->target = [submenu retain]; // submenus
|
||||
}
|
||||
if (hasSubmenu)
|
||||
{
|
||||
// recursive call
|
||||
id submenu = [target copyWithZone: zone];
|
||||
copy->target = submenu;
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,11 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) canBecomeKeyWindow
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
//
|
||||
// If we receive an escape, close.
|
||||
//
|
||||
|
|
|
@ -193,9 +193,6 @@ NSRect cframe;
|
|||
cframe.size = frame.size;
|
||||
[self setContentView:[[[NSView alloc] initWithFrame:cframe] autorelease]];
|
||||
|
||||
|
||||
[theApp addWindowsItem: self title: nil filename: NO];
|
||||
|
||||
_flushRectangles = [[NSMutableArray alloc] initWithCapacity:10];
|
||||
|
||||
NSDebugLog(@"NSWindow end of init\n");
|
||||
|
@ -304,9 +301,10 @@ NSView *wv;
|
|||
title = window_title;
|
||||
if ([title isEqual: represented_filename])
|
||||
isDoc = YES;
|
||||
[[NSApplication sharedApplication] changeWindowsItem: self
|
||||
title: title
|
||||
filename: isDoc];
|
||||
if (menu_exclude == NO)
|
||||
[[NSApplication sharedApplication] changeWindowsItem: self
|
||||
title: title
|
||||
filename: isDoc];
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -365,20 +363,25 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|||
|
||||
- (void)makeKeyAndOrderFront:sender
|
||||
{
|
||||
[self makeKeyWindow]; // Make self the key window
|
||||
[self orderFront:sender]; // order self to the front
|
||||
[self makeKeyWindow]; // Make self the key window
|
||||
/*
|
||||
* OPENSTEP makes a window the main window when it makes it the key window.
|
||||
* So we do the same (though the documentation doesn't mention it).
|
||||
*/
|
||||
[self makeMainWindow];
|
||||
[self orderFront: sender]; // order self to the front
|
||||
}
|
||||
|
||||
- (void)makeKeyWindow
|
||||
- (void) makeKeyWindow
|
||||
{
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
// Can we become the key
|
||||
if (![self canBecomeKeyWindow]) // window?
|
||||
return;
|
||||
// ask the current key
|
||||
[[theApp keyWindow] resignKeyWindow]; // window to resign status
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
// Can we become the key
|
||||
if (![self canBecomeKeyWindow]) // window?
|
||||
return;
|
||||
// ask the current key
|
||||
[[theApp keyWindow] resignKeyWindow]; // window to resign status
|
||||
|
||||
[self becomeKeyWindow]; // become the key window
|
||||
[self becomeKeyWindow]; // become the key window
|
||||
}
|
||||
|
||||
- (void)makeMainWindow
|
||||
|
@ -524,17 +527,16 @@ NSPoint basePoint;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)update
|
||||
- (void) update
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (is_autodisplay && needs_display) // if autodisplay is
|
||||
{ // enabled and window
|
||||
[self displayIfNeeded]; // display
|
||||
[self flushWindowIfNeeded];
|
||||
}
|
||||
|
||||
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
|
||||
if (is_autodisplay && needs_display) // if autodisplay is
|
||||
{ // enabled and window
|
||||
[self displayIfNeeded]; // display
|
||||
[self flushWindowIfNeeded];
|
||||
}
|
||||
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
|
||||
}
|
||||
|
||||
- (void)flushWindowIfNeeded
|
||||
|
@ -1314,11 +1316,6 @@ id result = nil;
|
|||
[aDecoder decodeValueOfObjCType:@encode(BOOL) at: &hides_on_deactivate];
|
||||
[aDecoder decodeValueOfObjCType:@encode(BOOL) at: &accepts_mouse_moved];
|
||||
|
||||
// Register ourselves with the Application object
|
||||
// +++ we shouldn't do this because coding may not be done?
|
||||
// better to do it in the awakeFromCoder method
|
||||
theApp = [NSApplication sharedApplication];
|
||||
[theApp addWindowsItem: self title: nil filename: NO];
|
||||
NSDebugLog(@"NSWindow: finish decoding\n");
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Reference in a new issue