Image updates from Jonathon Gapen

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5343 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-12-01 08:26:33 +00:00
parent e58e3b260e
commit fc849e3129
6 changed files with 104 additions and 29 deletions

View file

@ -1,3 +1,14 @@
Web Dec 1 8:27:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
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 <fedor@gnu.org> 1999-11-30 Adam Fedor <fedor@gnu.org>
* Headers/gnustep/gui/NSBrowser.m: Add some ivars, removed others. * Headers/gnustep/gui/NSBrowser.m: Add some ivars, removed others.

View file

@ -44,34 +44,33 @@
@class NSView; @class NSView;
@interface NSImage : NSObject <NSCoding> @interface NSImage : NSObject <NSCoding>
{ {
// Attributes // Attributes
NSString* name; NSString* name;
NSSize _size; NSSize _size;
struct __imageFlags { struct __imageFlags {
unsigned int scalable:1; unsigned scalable:1;
unsigned int dataRetained:1; unsigned dataRetained:1;
unsigned int flipDraw:1; unsigned flipDraw:1;
unsigned int uniqueWindow:1; unsigned uniqueWindow:1;
unsigned int uniqueWasExplicitlySet:1; unsigned uniqueWasExplicitlySet:1;
unsigned int sizeWasExplicitlySet:1; unsigned sizeWasExplicitlySet:1;
unsigned int builtIn:1; unsigned builtIn:1;
unsigned int needsToExpand:1; unsigned needsToExpand:1;
unsigned int useEPSOnResolutionMismatch:1; unsigned useEPSOnResolutionMismatch:1;
unsigned int colorMatchPreferred:1; unsigned colorMatchPreferred:1;
unsigned int multipleResolutionMatching:1; unsigned multipleResolutionMatching:1;
unsigned int subImage:1; unsigned subImage:1;
unsigned int aSynch:1; unsigned aSynch:1;
unsigned int archiveByName:1; unsigned archiveByName:1;
unsigned int cacheSeparately:1; unsigned cacheSeparately:1;
unsigned int unboundedCacheDepth:1; unsigned unboundedCacheDepth:1;
} _flags; unsigned syncLoad:1;
NSMutableArray* _reps; } _flags;
NSMutableArray* _repList; NSMutableArray *_reps;
NSColor* _color; NSMutableArray *_repList;
BOOL _syncLoad; NSColor *_color;
NSView* _lockedView; NSView *_lockedView;
id delegate; id delegate;
} }

View file

@ -47,6 +47,7 @@
@class NSClipView; @class NSClipView;
@class NSImage; @class NSImage;
@class NSCursor; @class NSCursor;
@class NSScrollView;
typedef int NSTrackingRectTag; typedef int NSTrackingRectTag;
@ -235,6 +236,7 @@ enum {
// //
- (NSRect)adjustScroll:(NSRect)newVisible; - (NSRect)adjustScroll:(NSRect)newVisible;
- (BOOL)autoscroll:(NSEvent *)theEvent; - (BOOL)autoscroll:(NSEvent *)theEvent;
- (NSScrollView*) enclosingScrollView;
- (void)reflectScrolledClipView:(NSClipView *)aClipView; - (void)reflectScrolledClipView:(NSClipView *)aClipView;
- (void)scrollClipView:(NSClipView *)aClipView - (void)scrollClipView:(NSClipView *)aClipView
toPoint:(NSPoint)aPoint; toPoint:(NSPoint)aPoint;

View file

@ -261,6 +261,16 @@ static NSDictionary* nsmapping = nil;
return [nameDict objectForKey: aName]; return [nameDict objectForKey: aName];
} }
- (BOOL) isFlipped
{
return _flags.flipDraw;
}
- (void) setFlipped: (BOOL)flag
{
_flags.flipDraw = flag;
}
// Designated initializer for nearly everything. // Designated initializer for nearly everything.
- initWithSize: (NSSize)aSize - initWithSize: (NSSize)aSize
{ {
@ -540,7 +550,7 @@ static NSDictionary* nsmapping = nil;
unsigned i, count; unsigned i, count;
GSRepData *repd; GSRepData *repd;
_syncLoad = NO; _flags.syncLoad = NO;
count = [_reps count]; count = [_reps count];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -744,7 +754,7 @@ static NSDictionary* nsmapping = nil;
repd->fileName = [fileName retain]; repd->fileName = [fileName retain];
[_reps addObject: repd]; [_reps addObject: repd];
[repd release]; [repd release];
_syncLoad = YES; _flags.syncLoad = YES;
return YES; return YES;
} }
@ -761,7 +771,7 @@ static NSDictionary* nsmapping = nil;
if (!imageRepArray) if (!imageRepArray)
return; return;
if (_syncLoad) if (_flags.syncLoad)
[self _loadImageFilenames]; [self _loadImageFilenames];
count = [imageRepArray count]; count = [imageRepArray count];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -838,7 +848,7 @@ static NSDictionary* nsmapping = nil;
{ {
if (![imageRep isKindOfClass: [NSCachedImageRep class]]) if (![imageRep isKindOfClass: [NSCachedImageRep class]])
{ {
GSRepData *repd, *cached; GSRepData *cached;
int depth; int depth;
if (_flags.unboundedCacheDepth) if (_flags.unboundedCacheDepth)
@ -880,7 +890,7 @@ static NSDictionary* nsmapping = nil;
unsigned count; unsigned count;
/* Make sure we have the images loaded in. */ /* Make sure we have the images loaded in. */
if (_syncLoad) if (_flags.syncLoad)
[self _loadImageFilenames]; [self _loadImageFilenames];
count = [_reps count]; count = [_reps count];
@ -977,7 +987,7 @@ static NSDictionary* nsmapping = nil;
if (!_repList) if (!_repList)
_repList = [[NSMutableArray alloc] init]; _repList = [[NSMutableArray alloc] init];
if (_syncLoad) if (_flags.syncLoad)
[self _loadImageFilenames]; [self _loadImageFilenames];
[_repList removeAllObjects]; [_repList removeAllObjects];
count = [_reps count]; count = [_reps count];

View file

@ -1790,6 +1790,22 @@ GSSetDragTypes(NSView* obj, NSArray *types)
return NO; 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 * Managing the Cursor
* *

View file

@ -2351,6 +2351,43 @@ resetCursorRectsForView(NSView *theView)
autosave_name = name; autosave_name = name;
[name release]; [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]; [windowsLock unlock];
return YES; return YES;
} }