diff --git a/ChangeLog b/ChangeLog index 07acef817..f25783010 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Web Dec 1 8:27:00 1999 Richard Frith-Macdonald + + Applied and modified/rewrote patch by Jonathan Gapen + * Headers/gnustep/gui/NSImage.h: Moved excess BOOL ivar to _flags. + * Headers/NSView.h: Added -enclosingScrollView method and NSScrollView + class reference. + * Source/NSImage.m ([NSImage -setFlipped:]): Implemented. + ([NSImage -isFlipped]): Implemented. + NOTE: NSImage not updated to respect flipped setting. + * Source/NSView.m ([NSView -enclosingScrollView]): Implemented. + 1999-11-30 Adam Fedor * Headers/gnustep/gui/NSBrowser.m: Add some ivars, removed others. diff --git a/Headers/gnustep/gui/NSImage.h b/Headers/gnustep/gui/NSImage.h index c023aaf07..7c7b5bfba 100644 --- a/Headers/gnustep/gui/NSImage.h +++ b/Headers/gnustep/gui/NSImage.h @@ -44,34 +44,33 @@ @class NSView; @interface NSImage : NSObject - { // Attributes NSString* name; NSSize _size; struct __imageFlags { - unsigned int scalable:1; - unsigned int dataRetained:1; - unsigned int flipDraw:1; - unsigned int uniqueWindow:1; - unsigned int uniqueWasExplicitlySet:1; - unsigned int sizeWasExplicitlySet:1; - unsigned int builtIn:1; - unsigned int needsToExpand:1; - unsigned int useEPSOnResolutionMismatch:1; - unsigned int colorMatchPreferred:1; - unsigned int multipleResolutionMatching:1; - unsigned int subImage:1; - unsigned int aSynch:1; - unsigned int archiveByName:1; - unsigned int cacheSeparately:1; - unsigned int unboundedCacheDepth:1; - } _flags; - NSMutableArray* _reps; - NSMutableArray* _repList; - NSColor* _color; - BOOL _syncLoad; - NSView* _lockedView; + unsigned scalable:1; + unsigned dataRetained:1; + unsigned flipDraw:1; + unsigned uniqueWindow:1; + unsigned uniqueWasExplicitlySet:1; + unsigned sizeWasExplicitlySet:1; + unsigned builtIn:1; + unsigned needsToExpand:1; + unsigned useEPSOnResolutionMismatch:1; + unsigned colorMatchPreferred:1; + unsigned multipleResolutionMatching:1; + unsigned subImage:1; + unsigned aSynch:1; + unsigned archiveByName:1; + unsigned cacheSeparately:1; + unsigned unboundedCacheDepth:1; + unsigned syncLoad:1; + } _flags; + NSMutableArray *_reps; + NSMutableArray *_repList; + NSColor *_color; + NSView *_lockedView; id delegate; } diff --git a/Headers/gnustep/gui/NSView.h b/Headers/gnustep/gui/NSView.h index 8c62519cd..deec8958d 100644 --- a/Headers/gnustep/gui/NSView.h +++ b/Headers/gnustep/gui/NSView.h @@ -47,6 +47,7 @@ @class NSClipView; @class NSImage; @class NSCursor; +@class NSScrollView; typedef int NSTrackingRectTag; @@ -235,6 +236,7 @@ enum { // - (NSRect)adjustScroll:(NSRect)newVisible; - (BOOL)autoscroll:(NSEvent *)theEvent; +- (NSScrollView*) enclosingScrollView; - (void)reflectScrolledClipView:(NSClipView *)aClipView; - (void)scrollClipView:(NSClipView *)aClipView toPoint:(NSPoint)aPoint; diff --git a/Source/NSImage.m b/Source/NSImage.m index 30d88f07a..2d2615061 100644 --- a/Source/NSImage.m +++ b/Source/NSImage.m @@ -261,6 +261,16 @@ static NSDictionary* nsmapping = nil; return [nameDict objectForKey: aName]; } +- (BOOL) isFlipped +{ + return _flags.flipDraw; +} + +- (void) setFlipped: (BOOL)flag +{ + _flags.flipDraw = flag; +} + // Designated initializer for nearly everything. - initWithSize: (NSSize)aSize { @@ -540,7 +550,7 @@ static NSDictionary* nsmapping = nil; unsigned i, count; GSRepData *repd; - _syncLoad = NO; + _flags.syncLoad = NO; count = [_reps count]; for (i = 0; i < count; i++) { @@ -744,7 +754,7 @@ static NSDictionary* nsmapping = nil; repd->fileName = [fileName retain]; [_reps addObject: repd]; [repd release]; - _syncLoad = YES; + _flags.syncLoad = YES; return YES; } @@ -761,7 +771,7 @@ static NSDictionary* nsmapping = nil; if (!imageRepArray) return; - if (_syncLoad) + if (_flags.syncLoad) [self _loadImageFilenames]; count = [imageRepArray count]; for (i = 0; i < count; i++) @@ -838,7 +848,7 @@ static NSDictionary* nsmapping = nil; { if (![imageRep isKindOfClass: [NSCachedImageRep class]]) { - GSRepData *repd, *cached; + GSRepData *cached; int depth; if (_flags.unboundedCacheDepth) @@ -880,7 +890,7 @@ static NSDictionary* nsmapping = nil; unsigned count; /* Make sure we have the images loaded in. */ - if (_syncLoad) + if (_flags.syncLoad) [self _loadImageFilenames]; count = [_reps count]; @@ -977,7 +987,7 @@ static NSDictionary* nsmapping = nil; if (!_repList) _repList = [[NSMutableArray alloc] init]; - if (_syncLoad) + if (_flags.syncLoad) [self _loadImageFilenames]; [_repList removeAllObjects]; count = [_reps count]; diff --git a/Source/NSView.m b/Source/NSView.m index 9e5d359d8..0a24abe93 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -1790,6 +1790,22 @@ GSSetDragTypes(NSView* obj, NSArray *types) return NO; } +- (NSScrollView*) enclosingScrollView +{ + id aView = [self superview]; + + while (aView != nil) + { + if ([aView isKindOfClass: [NSScrollView class]]) + { + break; + } + aView = [aView superview]; + } + + return aView; +} + /* * Managing the Cursor * diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 5637fa0de..f26945ed9 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2351,6 +2351,43 @@ resetCursorRectsForView(NSView *theView) autosave_name = name; [name release]; } + else + { + NSUserDefaults *defs; + NSString *key; + + /* + * Autosave name cleared - remove from defaults database. + */ + defs = [NSUserDefaults standardUserDefaults]; + if ([self isKindOfClass: [NSMenuWindow class]]) + { + id dict; + + key = @"NSMenuLocations"; + dict = [defs objectForKey: key]; + if (dict == nil) + { + dict = [NSMutableDictionary dictionaryWithCapacity: 1]; + } + else if ([dict isKindOfClass: [NSDictionary class]] == NO) + { + NSLog(@"NSMenuLocations is not a dictionary - overwriting"); + dict = [NSMutableDictionary dictionaryWithCapacity: 1]; + } + else + { + dict = AUTORELEASE([dict mutableCopy]); + } + [dict removeObjectForKey: name]; + [defs setObject: dict forKey: key]; + } + else + { + key = [NSString stringWithFormat: @"NSWindow Frame %@", name]; + [defs removeObjectForKey: key]; + } + } [windowsLock unlock]; return YES; }