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 Frith-MacDonald 1999-12-01 08:26:33 +00:00
parent 135cf168a5
commit 9bced6fe97
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>
* Headers/gnustep/gui/NSBrowser.m: Add some ivars, removed others.

View file

@ -44,34 +44,33 @@
@class NSView;
@interface NSImage : NSObject <NSCoding>
{
// 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;
}

View file

@ -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;

View file

@ -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];

View file

@ -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
*

View file

@ -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;
}