* Source/GSNibLoading.m: use the new code committed to NSMenu to

lay out the menu when vertical.  Get rid of the duplicate code here.
	* Source/NSDrawer.m: set the child window position when opening.
	* Source/NSMatrix.m: -_selectCell:atRow:column: Check to make 
	sure the selectedRow and selectedColumn are > -1.  This check is 
	done elsewhere and was not done here.  This was causing a crash.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27907 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2009-02-18 04:04:13 +00:00
parent 2886fd56a6
commit 32c4192f32
4 changed files with 19 additions and 116 deletions

View file

@ -1,3 +1,12 @@
2009-02-17 23:09-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibLoading.m: use the new code committed to NSMenu to
lay out the menu when vertical. Get rid of the duplicate code here.
* Source/NSDrawer.m: set the child window position when opening.
* Source/NSMatrix.m: -_selectCell:atRow:column: Check to make
sure the selectedRow and selectedColumn are > -1. This check is
done elsewhere and was not done here. This was causing a crash.
2009-02-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSImageView.m (-initWithFrame:): Set non-editable as

View file

@ -71,10 +71,6 @@ static BOOL _isInInterfaceBuilder = NO;
- (Class) replacementClassForClassName: (NSString *)className;
@end
@interface NSApplication (NibCompatibility)
- (void) _setMainMenu: (NSMenu*)aMenu;
@end
@interface NSView (NibCompatibility)
- (void) _fixSubviews;
@end
@ -94,114 +90,6 @@ static BOOL _isInInterfaceBuilder = NO;
@interface _NSCornerView : NSView
@end
@interface NSMenu (NibCompatibility)
- (void) _setMain: (BOOL)isMain;
@end
@interface NSMenu (GNUstepPrivate)
- (void) _setGeometry;
@end
@implementation NSMenu (NibCompatibility)
// FIXME: Why can't this be merged with setMain: ?
- (void) _setMain: (BOOL)isMain
{
if (isMain)
{
NSMenuView *oldRep;
NSInterfaceStyle oldStyle;
NSInterfaceStyle newStyle;
NSString *processName;
if([self numberOfItems] == 0)
return;
oldRep = [self menuRepresentation];
oldStyle = [oldRep interfaceStyle];
newStyle = NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil);
processName = [[NSProcessInfo processInfo] processName];
/*
* If necessary, rebuild menu for (different) style
*/
if (oldStyle != newStyle)
{
NSMenuView *newRep;
newRep = [[NSMenuView alloc] initWithFrame: NSZeroRect];
if (newStyle == NSMacintoshInterfaceStyle
|| newStyle == NSWindows95InterfaceStyle)
{
[newRep setHorizontal: YES];
}
else
{
[newRep setHorizontal: NO];
}
[newRep setInterfaceStyle: newStyle];
[self setMenuRepresentation: newRep];
RELEASE(newRep);
}
[[self window] setTitle: processName];
[[self window] setLevel: NSMainMenuWindowLevel];
// if it's a standard menu, transform it to be more NeXT'ish/GNUstep-like
if(_menu.horizontal == NO)
{
NSString *infoString = NSLocalizedString (@"Info", @"Info");
NSString *quitString = [NSString stringWithFormat: @"%@ %@",
NSLocalizedString (@"Quit", @"Quit"), processName];
NSMenuItem *quitItem = [[NSMenuItem alloc] initWithTitle: quitString
action: @selector(terminate:)
keyEquivalent: @"q"];
NSMenuItem *appItem;
appItem = (NSMenuItem*)[self itemAtIndex: 0]; // Info item.
[self addItem: quitItem];
[self setTitle: processName];
[appItem setTitle: infoString];
[[appItem submenu] setTitle: infoString];
}
[self _setGeometry];
[self sizeToFit];
if ([NSApp isActive])
{
[self display];
}
}
else
{
[self close];
[[self window] setLevel: NSSubmenuWindowLevel];
}
}
@end
@implementation NSApplication (NibCompatibility)
- (void) _setMainMenu: (NSMenu*)aMenu
{
if (_main_menu == aMenu)
{
return;
}
if (_main_menu != nil)
{
[_main_menu setMain: NO];
}
ASSIGN(_main_menu, aMenu);
if (_main_menu != nil)
{
[_main_menu _setMain: YES];
}
}
@end
@implementation NSView (NibCompatibility)
- (void) _setWindow: (id) w
{
@ -1874,7 +1762,7 @@ static BOOL _isInInterfaceBuilder = NO;
if (menu != nil)
{
menu = [self instantiateObject: menu];
[NSApp _setMainMenu: menu];
[NSApp setMainMenu: menu];
}
}

View file

@ -235,8 +235,11 @@ static NSNotificationCenter *nc = nil;
- (void) openOnEdge
{
[self orderFront: self];
NSRect frame = [self frameFromParentWindowFrame];
[self setFrame: frame display: YES];
[self slide];
[self orderFront: self];
[self startTimer];
}
@ -263,6 +266,7 @@ static NSNotificationCenter *nc = nil;
NSRectEdge edge = [_drawer preferredEdge];
NSSize size = [_drawer maxContentSize];
[super setParentWindow: nil];
if (edge == NSMinXEdge) // left
{
frame.origin.x -= size.width;
@ -283,6 +287,7 @@ static NSNotificationCenter *nc = nil;
frame.origin.y += size.height;
[self setFrame: frame display: YES];
}
[super setParentWindow: _parentWindow];
}
- (void) _resetWindowPosition
@ -295,7 +300,7 @@ static NSNotificationCenter *nc = nil;
{
NSRect frame = [_parentWindow frame];
[self _resetWindowPosition];
[_parentWindow setFrame: frame display: YES];
// [_parentWindow setFrame: frame display: YES];
}
- (void) handleWindowClose: (NSNotification *)notification
@ -319,6 +324,7 @@ static NSNotificationCenter *nc = nil;
{
if (_parentWindow != window)
{
[super setParentWindow: window];
ASSIGN(_parentWindow, window);
[nc removeObserver: self];

View file

@ -1185,7 +1185,7 @@ static SEL getSel;
if (_selectedCell && _selectedCell != aCell)
{
if (_mode == NSRadioModeMatrix)
if (_mode == NSRadioModeMatrix && _selectedRow > -1 && _selectedColumn > -1)
{
_selectedCells[_selectedRow][_selectedColumn] = NO;
[_selectedCell setState: NSOffState];