Index: Headers/AppKit/NSApplication.h =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Headers/AppKit/NSApplication.h,v retrieving revision 1.3 diff -u -a -r1.3 NSApplication.h --- Headers/AppKit/NSApplication.h 29 Feb 2004 00:11:51 -0000 1.3 +++ Headers/AppKit/NSApplication.h 15 Oct 2004 13:42:46 -0000 @@ -102,6 +102,7 @@ BOOL _app_is_running; BOOL _app_is_active; BOOL _app_is_hidden; + BOOL _app_is_launched; BOOL _unhide_on_activation; BOOL _windows_need_update; NSImage *_app_icon; Index: Headers/AppKit/NSScroller.h =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Headers/AppKit/NSScroller.h,v retrieving revision 1.2 diff -u -a -r1.2 NSScroller.h --- Headers/AppKit/NSScroller.h 28 Jun 2004 13:24:54 -0000 1.2 +++ Headers/AppKit/NSScroller.h 15 Oct 2004 13:42:46 -0000 @@ -75,6 +75,7 @@ NSScrollArrowPosition _arrowsPosition; NSUsableScrollerParts _usableParts; BOOL _cacheValid; + int _buttonsWidth; } // Index: Source/Functions.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/Functions.m,v retrieving revision 1.31 diff -u -a -r1.31 Functions.m --- Source/Functions.m 8 Feb 2004 13:07:24 -0000 1.31 +++ Source/Functions.m 15 Oct 2004 13:42:47 -0000 @@ -139,8 +139,9 @@ const NSWindowDepth *depths = NSAvailableWindowDepths(); NSWindowDepth bestDepth = NSDefaultDepth; - *exactMatch = NO; - + if (exactMatch != NULL) + *exactMatch = NO; + if (components == 1) { for (index = 0; depths[index] != 0; index++) @@ -152,7 +153,8 @@ bestDepth = depth; if (NSBitsPerSampleFromDepth(depth) == bitsPerSample) { - *exactMatch = YES; + if (exactMatch != NULL) + *exactMatch = YES; } } } @@ -168,7 +170,8 @@ bestDepth = depth; if (NSBitsPerSampleFromDepth(depth) == bitsPerSample) { - *exactMatch = YES; + if (exactMatch != NULL) + *exactMatch = YES; } } } Index: Source/NSApplication.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSApplication.m,v retrieving revision 1.265 diff -u -a -r1.265 NSApplication.m --- Source/NSApplication.m 22 Jul 2004 23:57:46 -0000 1.265 +++ Source/NSApplication.m 15 Oct 2004 13:42:49 -0000 @@ -1088,18 +1088,23 @@ format: @"NSApp's run called recursively"]; } - IF_NO_GC(_runLoopPool = [arpClass new]); /* * Set this flag here in case the application is actually terminated * inside -finishLaunching. */ _app_is_running = YES; - [self finishLaunching]; + if (_app_is_launched == NO) + { + _app_is_launched = YES; + IF_NO_GC(_runLoopPool = [arpClass new]); + + [self finishLaunching]; - [_listener updateServicesMenu]; - [_main_menu update]; - DESTROY(_runLoopPool); + [_listener updateServicesMenu]; + [_main_menu update]; + DESTROY(_runLoopPool); + } while (_app_is_running) { @@ -1117,7 +1122,10 @@ [self sendEvent: e]; // update (en/disable) the services menu's items - if (type != NSPeriodic && type != NSMouseMoved) + ///FIXME: should we really be updating menus on so many event types? + if (type != NSPeriodic && type != NSMouseMoved + /*&& type != NSApplicationDefined && type != NSScrollWheel + && type != NSKeyUp && type != NSKeyDown*/) { [_listener updateServicesMenu]; [_main_menu update]; @@ -2225,6 +2233,8 @@ { [_main_menu close]; [[_main_menu window] setLevel: NSSubmenuWindowLevel]; + //FIXME: should only do if determine that prev menu was visible.. + [aMenu display]; } ASSIGN(_main_menu, aMenu); Index: Source/NSColorList.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSColorList.m,v retrieving revision 1.18 diff -u -a -r1.18 NSColorList.m --- Source/NSColorList.m 31 Jul 2003 23:52:09 -0000 1.18 +++ Source/NSColorList.m 15 Oct 2004 13:42:49 -0000 @@ -32,9 +32,11 @@ #include #include #include +#include #include #include #include +#include #include #include "AppKit/NSColorList.h" @@ -104,9 +106,12 @@ { if ([[file pathExtension] isEqualToString: @"clr"]) { - file = [file stringByDeletingPathExtension]; - newList = [[NSColorList alloc] initWithName: file - fromFile: dir]; + NSString *name = [file stringByDeletingPathExtension]; + ///PENDING, judging by behavior in OS X fromFile: should have the + // path including the filename, though the docs are not worded + // clearly... + newList = [[NSColorList alloc] initWithName: name + fromFile: [dir stringByAppendingPathComponent: file]]; [_gnustep_available_color_lists addObject: newList]; RELEASE(newList); } @@ -190,16 +195,38 @@ if (path != nil) { - ASSIGN (_fullFileName, [[path stringByAppendingPathComponent: name] - stringByAppendingPathExtension: @"clr"]); + BOOL isDir = NO; + // previously impl wrongly expected directory containing color file + // rather than color file; we support this for apps that rely on it + if (([[NSFileManager defaultManager] fileExistsAtPath: path + isDirectory: &isDir]==NO) + || (isDir == YES)) + { + NSLog(@"NSColorList -initWithName:fromFile: warning: including " +@"filename as path of path (%@) is deprecated.", path); + ASSIGN (_fullFileName, [[path stringByAppendingPathComponent: name] + stringByAppendingPathExtension: @"clr"]); + } + else + { + ASSIGN (_fullFileName, path); + } // Unarchive the color list // TODO [Optm]: Rewrite to initialize directly without unarchiving // in another object + NS_DURING + { + cl = + (NSColorList*)[NSUnarchiver unarchiveObjectWithFile: _fullFileName]; + } + NS_HANDLER + { + cl = nil; + } + NS_ENDHANDLER ; - cl = (NSColorList*)[NSUnarchiver unarchiveObjectWithFile: _fullFileName]; - if (cl && [cl isKindOfClass: [NSColorList class]]) { could_load = YES; @@ -213,6 +240,77 @@ ASSIGN(_orderedColorKeys, [NSMutableArray arrayWithArray: cl->_orderedColorKeys]); } + else if ([[NSFileManager defaultManager] fileExistsAtPath: path]) + { + _colorDictionary = [[NSMutableDictionary alloc] init]; + _orderedColorKeys = [[NSMutableArray alloc] init]; + _is_editable = YES; + /* + * Try reading the following text format accepted by OS X: + * first line = <#/colors> + * each subsequent line describes a color as + * the first int describes the method (ARGB, etc.), the floats + * provide its arguments (e.g., r, g, b, alpha), and string is name. + */ + NSScanner *scanner = + [NSScanner scannerWithString: + [NSString stringWithContentsOfFile: _fullFileName]]; + int nColors; + int method; + float r; + float g; + float b; + float alpha; + NSString *cname; + int i; + BOOL st; + NSColor *color; + NSCharacterSet *newlineSet = + [NSCharacterSet characterSetWithCharactersInString: @"\n"]; + if ([scanner scanInt: &nColors] == NO) + { + NSLog(@"Unable to read color file at \"address@hidden" -- unknown format.", + _fullFileName); + } + else + { + for (i=0; i= buttonsWidth + 3) + if (size >= _buttonsWidth + 3) { _usableParts = NSAllScrollerParts; } @@ -352,11 +354,12 @@ } else { - if (size >= 4 /* spacing */ + 1 /* min. scroll area */ + buttonsWidth * 3) + if (size >= 4 /* spacing */ + 1 /* min. scroll area */ + + _buttonsWidth * 3) { _usableParts = NSAllScrollerParts; } - else if (size >= 3 /* spacing */ + buttonsWidth * 2) + else if (size >= 3 /* spacing */ + _buttonsWidth * 2) { _usableParts = NSOnlyScrollerArrows; } @@ -911,7 +914,7 @@ NSRect scrollerFrame = _frame; float x = 1, y = 1; float width, height; - float buttonsSize = 2 * buttonsWidth + 2; + float buttonsSize = 2 * _buttonsWidth + 2; NSUsableScrollerParts usableParts; /* * If the scroller is disabled then the scroller buttons and the @@ -965,8 +968,8 @@ ? 0 : buttonsSize); knobHeight = _knobProportion * slotHeight; knobHeight = (float)floor(knobHeight); - if (knobHeight < buttonsWidth) - knobHeight = buttonsWidth; + if (knobHeight < _buttonsWidth) + knobHeight = _buttonsWidth; /* calc knob's position */ knobPosition = _floatValue * (slotHeight - knobHeight); @@ -978,7 +981,7 @@ || _arrowsPosition == NSScrollerArrowsNone) ? 0 : buttonsSize); height = knobHeight; - width = buttonsWidth; + width = _buttonsWidth; break; } @@ -1010,8 +1013,8 @@ { y += (height - buttonsSize + 1); } - width = buttonsWidth; - height = buttonsWidth; + width = _buttonsWidth; + height = _buttonsWidth; break; case NSScrollerIncrementLine: @@ -1023,14 +1026,14 @@ } else if (_arrowsPosition == NSScrollerArrowsMaxEnd) { - y += (height - buttonsWidth); + y += (height - _buttonsWidth); } else if (_arrowsPosition == NSScrollerArrowsMinEnd) { - y += (buttonsWidth + 1); + y += (_buttonsWidth + 1); } - height = buttonsWidth; - width = buttonsWidth; + height = _buttonsWidth; + width = _buttonsWidth; break; case NSScrollerNoPart: @@ -1050,7 +1053,7 @@ + (float) scrollerWidthForControlSize: (NSControlSize)controlSize { // FIXME - return scrollerWidth; + return [isa scrollerWidth]; } - (void) setControlSize: (NSControlSize)controlSize Index: Source/NSTabView.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSTabView.m,v retrieving revision 1.45 diff -u -a -r1.45 NSTabView.m --- Source/NSTabView.m 7 Jun 2004 23:54:14 -0000 1.45 +++ Source/NSTabView.m 15 Oct 2004 13:42:50 -0000 @@ -88,6 +88,7 @@ if ([tabViewItem isEqual: _selected]) { + [[_selected view] removeFromSuperview]; _selected = nil; } @@ -98,6 +99,9 @@ { [_delegate tabViewDidChangeNumberOfTabViewItems: self]; } + + if ([_items count] == 0) + [self setNeedsDisplay: YES]; } - (int) indexOfTabViewItem: (NSTabViewItem*)tabViewItem @@ -383,7 +387,7 @@ break; } - if (!_selected) + if (!_selected && howMany > 0) [self selectFirstTabViewItem: nil]; if (_type == NSNoTabsBezelBorder || _type == NSNoTabsLineBorder)