diff --git a/ChangeLog b/ChangeLog index 5f84fe1da..34696b831 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 1999-08-20 Michael Hanni * Source/NSSlider.m: added missing [self unlockFocus];. + * Source/NSMenu.m: fixes to sizeToFit and update. This allows you + to keep the windows and services menus tornoff and when you rerun + the program these menus will look correct. + * Source/NSMenuView.m: ditto. 1999-08-19 Michael Hanni diff --git a/Source/GSServicesManager.m b/Source/GSServicesManager.m index 7ff3ae350..5f0baed46 100644 --- a/Source/GSServicesManager.m +++ b/Source/GSServicesManager.m @@ -792,8 +792,9 @@ static NSString *disabledName = @".GNUstepDisabled"; [item setTag: pos]; } } - [submenu sizeToFit]; - [servicesMenu sizeToFit]; + [submenu update]; +// [submenu sizeToFit]; +// [servicesMenu sizeToFit]; [servicesMenu update]; } } diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 05315ae98..b9ee7d5b9 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1214,13 +1214,18 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException); break; i++; } + + NSLog(@"aString = %@", aString); + item = [menu insertItemWithTitle: aString action: @selector(makeKeyAndOrderFront:) keyEquivalent: @"" atIndex: i]; [item setTarget: aWindow]; - [menu sizeToFit]; +// [menu sizeToFit]; +NSLog(@"sizeToFit the windowsMenu."); [menu update]; +NSLog(@"update the windowsMenu."); } - (void) removeWindowsItem: (NSWindow*)aWindow @@ -1243,7 +1248,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException); if ([item target] == aWindow) { [menu removeItem: item]; - [menu sizeToFit]; +// [menu sizeToFit]; [menu update]; break; } @@ -1300,7 +1305,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException); filename: [win representedFilename] != nil]; [windows removeLastObject]; } - [aMenu sizeToFit]; +// [aMenu sizeToFit]; [aMenu update]; } } @@ -1362,7 +1367,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException); if (changed) { [(id)[item controlView] sizeToFit]; - [menu sizeToFit]; +// [menu sizeToFit]; [menu update]; } break; diff --git a/Source/NSMenu.m b/Source/NSMenu.m index 2d030db8d..05ec4853e 100644 --- a/Source/NSMenu.m +++ b/Source/NSMenu.m @@ -537,7 +537,7 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations"; id cells; unsigned i, count; id theApp = [NSApplication sharedApplication]; - + if (menu_changed) [self sizeToFit]; @@ -599,7 +599,7 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations"; if (shouldBeEnabled != wasEnabled) { [cell setEnabled: shouldBeEnabled]; - [[self window] flushWindow]; + [[self window] display]; // [menu_view setNeedsDisplay:YES]; // [menu_view setNeedsDisplayInRect:[menu_view rectOfItemAtIndex:i]]; // FIXME @@ -607,9 +607,6 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations"; } } - if (menu_changed) - [self sizeToFit]; - /* Reenable displaying of menus */ [self setMenuChangedMessagesEnabled: YES]; } @@ -716,41 +713,11 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations"; if (!menu_is_beholdenToPopUpButton) { - [titleView setFrameOrigin: NSMakePoint(0, mFrame.size.height)]; - [titleView setFrameSize: NSMakeSize (mFrame.size.width,21)]; - size.height = mFrame.size.height+21; + size.height += 21; [aWindow setContentSize: size]; [bWindow setContentSize: size]; - -/* - if (menu_supermenu) - { - frame.origin = [supermenu locationForSubmenu: self]; - } - else - { - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary* menuLocations = [defaults - objectForKey: NSMenuLocationsKey]; - NSString* key; - NSArray* array; - - if ([[NSApplication sharedApplication] mainMenu] == self) - key = @"Main menu"; - else - key = [self title]; - - if (key) - { - array = [menuLocations objectForKey: key]; - if (array && [array isKindOfClass: [NSArray class]]) - { - frame.origin.x = [[array objectAtIndex: 0] floatValue]; - frame.origin.y = [[array objectAtIndex: 1] floatValue]; - } - } - } -*/ + [menu_view setFrameOrigin: NSMakePoint(0, 0)]; + [titleView setFrame: NSMakeRect(0,size.height-21,size.width,21)]; } else { @@ -758,8 +725,10 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations"; } // FIXME, popup sets itself up. - - [menu_view setNeedsDisplay:YES]; +// [menu_view setNeedsDisplay:YES]; + + [aWindow display]; + menu_changed = NO; } diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index 654145496..420234613 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -306,10 +306,11 @@ static float GSMenuBarHeight = 25.0; // a guess. if (![menuv_menu _isBeholdenToPopUpButton]) cellSize.width = 7 + neededWidth + 7 + 7 + 5; - if ([window contentView] == self) - [window setContentSize: NSMakeSize(cellSize.width,howHigh)]; - else - [self setFrame: NSMakeRect(0,0,cellSize.width,howHigh)]; +// if ([window contentView] == self) +// [window setContentSize: NSMakeSize(cellSize.width,howHigh)]; +// else +// [self setFrame: NSMakeRect(0,0,cellSize.width,howHigh)]; + [self setFrameSize: NSMakeSize(cellSize.width,howHigh)]; } - (void)sizeToFitForPopUpButton diff --git a/Source/NSText.m b/Source/NSText.m index 7da48f05c..8fa146c9c 100644 --- a/Source/NSText.m +++ b/Source/NSText.m @@ -1215,8 +1215,6 @@ currentCursorY=[self rectForCharacterIndex:NSMaxRange([self selectedRange])].ori unsigned startIndex; BOOL didDragging=NO; - NSLog(@"mouseDown:"); - if (!is_selectable) return; // If not selectable then don't recognize the mouse down [[self window] makeFirstResponder:self]; @@ -2056,13 +2054,13 @@ NSLog(@"opti hook 2"); //FIXME return MakeRangeFromAbs(startLine,endLine+1); if ([plainContent length] != 0) { myTest = MakeRangeFromAbs(startLine,endLine+1); - NSLog(@"myTest: length = %d, location = %d\n", + NSDebugLog(@"myTest: length = %d, location = %d\n", (int)myTest.length, (int)myTest.location); return myTest; } else { myTest = MakeRangeFromAbs(startLine,endLine); - NSLog(@"myTest: length = %d, location = %d\n", + NSDebugLog(@"myTest: length = %d, location = %d\n", (int)myTest.length, (int)myTest.location); return myTest; @@ -2078,8 +2076,6 @@ NSLog(@"opti hook 2"); redrawLineRange=[self lineRangeForRect:rect]; - NSLog(@"should be drawing text here. No big deal.\n"); - if([self drawsBackground]) // clear area under text { [[self backgroundColor] set]; NSRectFill(rect); }