Patches backported from trunk.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_stable_20070311@25587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2007-11-17 16:05:47 +00:00
parent 99c6b7e28e
commit bad8642e29
18 changed files with 1207 additions and 874 deletions

View file

@ -1,3 +1,92 @@
2007-06-07 Sergii Stoian <stoyan255@gmail.com>
* Source/NSBrowser.m: ([drawWithFrame:inView:]) Pass inset rect by
1 to drawInteriorWithFrame:.
* Source/NSSavePanel.m: ([_initWithoutGModel]) Change propeties of
buttons: remove setting buttons type (by default
NSMomentaryPushInButton); refuse first responder for buttons.
Set setImageDimsWhenDisabled:NO to image button. Cleanup.
* Backported from trunk.
2007-06-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSOpenPanel.m: In -filenames append name to directory using
the standard method rather than by concatenating them joined by a
slash. Might fix bug #19929 but even if it doesn't cure that, it
certainly fixes an error.
* Backported from trunk.
2007-05-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSView.m: ([scrollRect:by:]) restrict scrolled rectangle to
the bounds of the view.
* Backported from trunk.
2007-05-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPrintOperation.m
(-runOperationModalForWindow:...contextInfo:,
-_printOperationDidRun:returnCode:contextInfo:) Only set and use
GSModalRunDelegate and GSModalRunSelector values when not nil.
* Backported from trunk.
2007-05-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSTextAttachment.m: For MacOS-X compatibility, don't call
([-setAttachment:]) on the cell if the cell class doesn't implement
it.
* Backported from trunk.
2007-05-10 Riccardo Mottola <rmottola@users.sf.net>
* Source/NSAnimation.m: removed some C99-isms
* Source/NSBitmapImageRep+GIF.m : removed some C99-isms
* Source/NSDocument.m : removed some C99-isms
* Backported from trunk.
2007-05-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAnimation.m: removed some C99-isms and simplified by
removing attempt to avoid locking when in single threaded mode.
* Headers/AppKit/NSAnimation.h: added an ivar and FIXME comments.
* Backported from trunk.
2007-05-08 Riccardo Mottola <rmottola@users.sf.net>
* Source/NSAnimation.m: removed some C99-isms
* Backported from trunk.
2007-04-29 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSButtonCell.m
* Source/NSMenuItemCell.m: Whitespace cleanup.
* Backported from trunk.
2007-04-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-editColumn::row:withEvent:select:): Set
the background colour of the text object and make it draw its background.
* Backported from trunk.
2007-04-24 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-noteNumberOfRowsChanged): Handle the case
correctly where an empty selection is not allowed and now there
are rows available.
* Backported from trunk.
2007-04-13 Adam Fedor <fedor@gnu.org> 2007-04-13 Adam Fedor <fedor@gnu.org>
* Version 0.12.0 * Version 0.12.0
@ -171,9 +260,9 @@
2007-03-09 Sergii Stoian <stoyan255@yahoo.com> 2007-03-09 Sergii Stoian <stoyan255@yahoo.com>
* Source/GSSlideView.m: (- _slideFrom:to:): Calcuate number of * Source/GSSlideView.m: (- _slideFrom:to:): Calcuate number of
steps wrt image size. steps wrt image size.
* Source/GSDragView.m: (- slideDraggedImageTo:): Ditto. * Source/GSDragView.m: (- slideDraggedImageTo:): Ditto.
2007-03-08 Fred Kiefer <FredKiefer@gmx.de> 2007-03-08 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -19,6 +19,81 @@
changes and other information that might help developers and users changes and other information that might help developers and users
migrate to using a newer version of the library. migrate to using a newer version of the library.
</p> </p>
<section>
<heading>Version 0.12.1</heading>
<p>
</p>
</section>
<section>
<heading>Version 0.12.0</heading>
<p>
It has been a long time since the last release and many things
have been added and changed, including new classes, new ivars,
and new methods.
</p>
<deflist>
<term>Tooltips</term>
<desc>
A Tooltip implementation was added.
</desc>
<term>NSBitmapImage Improvements</term>
<desc>
Lots of improvements to the NSBitmapImage subclasses.
</desc>
<term>Theming Improvements</term>
<desc>
GSTheme and other classes were added to improve support
of theming.
</desc>
<term>New Methods added</term>
<desc>
Added new methods from Mac OS X 10.4 for NSControl, NSResponder,
NSDocument, NSPrintOperation, NSWindowController, NSCell,
NSMenuItem, NSView. Some ivar names were changed also.
</desc>
<term>New ivars added</term>
<desc>
Added new ivars for NSMenuItem, NSPrintOperation, NSTableView,
NSDrawer, NSScrollView, NSAlert, NSTextView.
</desc>
<term>New Classes Added</term>
<desc>
New classes from Mac OS X 10.4 and earlier were added including
NSLevelIndicator, NSObjectController, NSUserDefaultsController,
NSKeyValueBinding, NSArrayController, NSController.
</desc>
<term>NSSpellServer moved to base</term>
<desc>
NSSpellServer was moved to GNUstep base for Mac OS X
compatibility.
</desc>
<term>NSTabViewType enumerations</term>
<desc>
Enumerations were changed to match values from Mac OS X.
</desc>
<term>GNUstep GUI updated for Make 2.0</term>
<desc>
GNUstep GUI was updated to work with GNUstep Make 2.0. This
includes versioned resources.
</desc>
<term>NSAffineTransform moved to base</term>
<desc>
Much of NSAffineTransform was moved to gnustep-base to match
with Mac OS X. Many older methods were marked as deprecated
in favor of the more recent Mac OS X methods.
</desc>
<term>NSAlert in alternate threads</term>
<desc>
NSAlerts are performed in the main thread even if called
from another thread.
</desc>
<term>NSAnimation Class Added</term>
<desc>
Preliminary code for the NSAnimation class has been added.
Only NSAnimationNonBlocking mode implemented.
</desc>
</deflist>
</section>
<section> <section>
<heading>Version 0.12.0</heading> <heading>Version 0.12.0</heading>
<p> <p>

View file

@ -9,6 +9,10 @@
The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}. The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}.
@end ifclear @end ifclear
@section Noteworthy changes in version @samp{0.12.1}
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.12.0} @section Noteworthy changes in version @samp{0.12.0}
It has been a long time since the last release and many things have been It has been a long time since the last release and many things have been
@ -29,7 +33,25 @@ NSKeyValueBinding, NSArrayController, NSController.
for Mac OS X compatibility. for Mac OS X compatibility.
@end itemize @end itemize
@ifclear ANNOUNCE-ONLY @section Noteworthy changes in version @samp{0.12.0}
It has been a long time since the last release and many things have been
added and changed, including new classes, new ivars, and new methods.
@itemize @bullet
@item Lots of improvements to the NSBitmapImage subclasses thanks to Mark Tracy
@item GSTheme and other classes were added to improve support of theming.
@item Added new methods from Mac OS X 10.4 for NSControl, NSResponder,
NSDocument, NSPrintOperation, NSWindowController, NSCell,
NSMenuItem, NSView. Some ivar names were changed also.
@item Added new ivars for NSMenuItem, NSPrintOperation, NSTableView,
NSDrawer, NSScrollView.
@item New classes from Mac OS X 10.4 and earlier were added including
NSLevelIndicator, NSObjectController, NSUserDefaultsController,
NSKeyValueBinding, NSArrayController, NSController.
@item NSSpellServer and NSAffineTransform was moved to GNUstep base
for Mac OS X compatibility.
@end itemize
@section Noteworthy changes in version @samp{0.11.0} @section Noteworthy changes in version @samp{0.11.0}

View file

@ -106,6 +106,9 @@ APPKIT_EXPORT NSString *NSAnimationProgressMark;
*/ */
@interface NSAnimation : NSObject < NSCopying, NSCoding, GSAnimation > @interface NSAnimation : NSObject < NSCopying, NSCoding, GSAnimation >
{ {
// FIXME ... all these ivars should be hidden inside a pointer to an
// FIXME ... opaque data structure, so that layout etc can be changed
// FIXME ... without breaking binary compatibility.
NSTimeInterval _duration; // Duration of the animation NSTimeInterval _duration; // Duration of the animation
float _frameRate; // Wanted frame rate float _frameRate; // Wanted frame rate
NSAnimationCurve _curve; // Id of progres->value function NSAnimationCurve _curve; // Id of progres->value function

View file

@ -208,6 +208,10 @@ static GSDragView *sharedDragView = nil;
return loc; return loc;
} }
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
return [[self draggingSource] namesOfPromisedFilesDroppedAtDestination: dropDestination];
}
- (BOOL) isDragging - (BOOL) isDragging
{ {
@ -306,25 +310,25 @@ static GSDragView *sharedDragView = nil;
NSDragOperation action = [theEvent data2]; NSDragOperation action = [theEvent data2];
if (destExternal) if (destExternal)
{ {
} }
else else
{ {
if (action != targetMask) if (action != targetMask)
{ {
targetMask = action; targetMask = action;
[self _setCursor]; [self _setCursor];
} }
} }
} }
} }
- (void) sendExternalEvent: (GSAppKitSubtype)subtype - (void) sendExternalEvent: (GSAppKitSubtype)subtype
action: (NSDragOperation)action action: (NSDragOperation)action
position: (NSPoint)eventLocation position: (NSPoint)eventLocation
timestamp: (NSTimeInterval)time timestamp: (NSTimeInterval)time
toWindow: (int)dWindowNumber toWindow: (int)dWindowNumber
{ {
} }
@ -334,7 +338,7 @@ static GSDragView *sharedDragView = nil;
set, if there is a native window, but no GNUstep window at this location. set, if there is a native window, but no GNUstep window at this location.
*/ */
- (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation - (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
windowRef: (int*)mouseWindowRef windowRef: (int*)mouseWindowRef
{ {
int win; int win;
@ -363,8 +367,8 @@ static GSDragView *sharedDragView = nil;
- all instance variables pertaining to moving the window are initialized - all instance variables pertaining to moving the window are initialized
*/ */
- (void) _setupWindowFor: (NSImage*)anImage - (void) _setupWindowFor: (NSImage*)anImage
mousePosition: (NSPoint)mPoint mousePosition: (NSPoint)mPoint
imagePosition: (NSPoint)iPoint imagePosition: (NSPoint)iPoint
{ {
NSSize imageSize; NSSize imageSize;
@ -678,21 +682,21 @@ static GSDragView *sharedDragView = nil;
[cursorBeforeDrag set]; [cursorBeforeDrag set];
NSDebugLLog(@"NSDragging", @"sending dnd drop\n"); NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
if (!destExternal) if (!destExternal)
{ {
[self _sendLocalEvent: GSAppKitDraggingDrop [self _sendLocalEvent: GSAppKitDraggingDrop
action: 0 action: 0
position: NSZeroPoint position: NSZeroPoint
timestamp: [theEvent timestamp] timestamp: [theEvent timestamp]
toWindow: destWindow]; toWindow: destWindow];
} }
else else
{ {
[self sendExternalEvent: GSAppKitDraggingDrop [self sendExternalEvent: GSAppKitDraggingDrop
action: 0 action: 0
position: NSZeroPoint position: NSZeroPoint
timestamp: [theEvent timestamp] timestamp: [theEvent timestamp]
toWindow: targetWindowRef]; toWindow: targetWindowRef];
} }
deposited = YES; deposited = YES;
} }
else else
@ -707,7 +711,21 @@ static GSDragView *sharedDragView = nil;
} }
if ([dragSource respondsToSelector: if ([dragSource respondsToSelector:
@selector(draggedImage:endedAt:deposited:)]) @selector(draggedImage:endedAt:operation:)])
{
NSPoint point;
point = [theEvent locationInWindow];
// Convert from mouse cursor coordinate to image coordinate
point.x -= offset.width;
point.y -= offset.height;
point = [[theEvent window] convertBaseToScreen: point];
[dragSource draggedImage: [self draggedImage]
endedAt: point
operation: targetMask & dragMask & operationMask];
}
else if ([dragSource respondsToSelector:
@selector(draggedImage:endedAt:deposited:)])
{ {
NSPoint point; NSPoint point;
@ -717,8 +735,8 @@ static GSDragView *sharedDragView = nil;
point.y -= offset.height; point.y -= offset.height;
point = [[theEvent window] convertBaseToScreen: point]; point = [[theEvent window] convertBaseToScreen: point];
[dragSource draggedImage: [self draggedImage] [dragSource draggedImage: [self draggedImage]
endedAt: point endedAt: point
deposited: deposited]; deposited: deposited];
} }
} }
@ -737,7 +755,7 @@ static GSDragView *sharedDragView = nil;
{ {
case GSAppKitWindowMoved: case GSAppKitWindowMoved:
case GSAppKitWindowResized: case GSAppKitWindowResized:
case GSAppKitRegionExposed: case GSAppKitRegionExposed:
/* /*
* Keep window up-to-date with its current position. * Keep window up-to-date with its current position.
*/ */
@ -763,9 +781,9 @@ static GSDragView *sharedDragView = nil;
break; break;
case GSAppKitWindowFocusIn: case GSAppKitWindowFocusIn:
case GSAppKitWindowFocusOut: case GSAppKitWindowFocusOut:
case GSAppKitWindowLeave: case GSAppKitWindowLeave:
case GSAppKitWindowEnter: case GSAppKitWindowEnter:
break; break;
default: default:
@ -780,29 +798,29 @@ static GSDragView *sharedDragView = nil;
case NSLeftMouseDown: case NSLeftMouseDown:
case NSLeftMouseUp: case NSLeftMouseUp:
newPosition = [[theEvent window] convertBaseToScreen: newPosition = [[theEvent window] convertBaseToScreen:
[theEvent locationInWindow]]; [theEvent locationInWindow]];
break; break;
case NSFlagsChanged: case NSFlagsChanged:
if ([self _updateOperationMask: theEvent]) if ([self _updateOperationMask: theEvent])
{ {
// If flags change, send update to allow // If flags change, send update to allow
// destination to take note. // destination to take note.
if (destWindow) if (destWindow)
{ {
[self _sendLocalEvent: GSAppKitDraggingUpdate [self _sendLocalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask action: dragMask & operationMask
position: newPosition position: newPosition
timestamp: [theEvent timestamp] timestamp: [theEvent timestamp]
toWindow: destWindow]; toWindow: destWindow];
} }
else else
{ {
[self sendExternalEvent: GSAppKitDraggingUpdate [self sendExternalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask action: dragMask & operationMask
position: newPosition position: newPosition
timestamp: [theEvent timestamp] timestamp: [theEvent timestamp]
toWindow: targetWindowRef]; toWindow: targetWindowRef];
} }
[self _setCursor]; [self _setCursor];
} }
break; break;
@ -836,7 +854,7 @@ static GSDragView *sharedDragView = nil;
destWindow = [self windowAcceptingDnDunder: dragPosition destWindow = [self windowAcceptingDnDunder: dragPosition
windowRef: &mouseWindowRef]; windowRef: &mouseWindowRef];
// If we have are not hovering above a window that we own // If we are not hovering above a window that we own
// we are dragging to an external application. // we are dragging to an external application.
destExternal = (mouseWindowRef != 0) && (destWindow == nil); destExternal = (mouseWindowRef != 0) && (destWindow == nil);
@ -858,18 +876,18 @@ static GSDragView *sharedDragView = nil;
if (oldDestWindow != nil) if (oldDestWindow != nil)
{ {
[self _sendLocalEvent: GSAppKitDraggingExit [self _sendLocalEvent: GSAppKitDraggingExit
action: dragMask & operationMask action: dragMask & operationMask
position: NSZeroPoint position: NSZeroPoint
timestamp: dragSequence timestamp: dragSequence
toWindow: oldDestWindow]; toWindow: oldDestWindow];
} }
else else
{ {
[self sendExternalEvent: GSAppKitDraggingExit [self sendExternalEvent: GSAppKitDraggingExit
action: dragMask & operationMask action: dragMask & operationMask
position: NSZeroPoint position: NSZeroPoint
timestamp: dragSequence timestamp: dragSequence
toWindow: targetWindowRef]; toWindow: targetWindowRef];
} }
} }
@ -891,21 +909,22 @@ static GSDragView *sharedDragView = nil;
// same window, sending update // same window, sending update
NSDebugLLog(@"NSDragging", @"sending dnd pos\n"); NSDebugLLog(@"NSDragging", @"sending dnd pos\n");
// FIXME: We should only send this when the destination wantsPeriodicDraggingUpdates
if (destWindow != nil) if (destWindow != nil)
{ {
[self _sendLocalEvent: GSAppKitDraggingUpdate [self _sendLocalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask action: dragMask & operationMask
position: dragPosition position: dragPosition
timestamp: dragSequence timestamp: dragSequence
toWindow: destWindow]; toWindow: destWindow];
} }
else else
{ {
[self sendExternalEvent: GSAppKitDraggingUpdate [self sendExternalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask action: dragMask & operationMask
position: dragPosition position: dragPosition
timestamp: dragSequence timestamp: dragSequence
toWindow: targetWindowRef]; toWindow: targetWindowRef];
} }
} }
else if (mouseWindowRef != 0) else if (mouseWindowRef != 0)
@ -917,10 +936,10 @@ static GSDragView *sharedDragView = nil;
if (destWindow != nil) if (destWindow != nil)
{ {
[self _sendLocalEvent: GSAppKitDraggingEnter [self _sendLocalEvent: GSAppKitDraggingEnter
action: dragMask action: dragMask
position: dragPosition position: dragPosition
timestamp: dragSequence timestamp: dragSequence
toWindow: destWindow]; toWindow: destWindow];
} }
else else
{ {

View file

@ -27,6 +27,7 @@
*/ */
#include <AppKit/NSAnimation.h> #include <AppKit/NSAnimation.h>
#include <GNUstepBase/GSLock.h>
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSValue.h> #include <Foundation/NSValue.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
@ -115,9 +116,10 @@ _GSRationalBezierEval (_GSRationalBezierDesc *rb, float t)
static inline float static inline float
_GSRationalBezierDerivEval (_GSRationalBezierDesc *rb, float t) _GSRationalBezierDerivEval (_GSRationalBezierDesc *rb, float t)
{ {
float h;
if (!rb->areBezierDescComputed) if (!rb->areBezierDescComputed)
_GSRationalBezierComputeBezierDesc (rb); _GSRationalBezierComputeBezierDesc (rb);
float h = _GSBezierEval (&(rb->d),t); h = _GSBezierEval (&(rb->d),t);
return ( _GSBezierDerivEval(&(rb->n),t) * h return ( _GSBezierDerivEval(&(rb->n),t) * h
- _GSBezierEval (&(rb->n),t) * _GSBezierDerivEval(&(rb->d),t) ) - _GSBezierEval (&(rb->n),t) * _GSBezierDerivEval(&(rb->d),t) )
/ (h*h); / (h*h);
@ -176,22 +178,36 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
return (NSComparisonResult)(diff / fabs (diff)); return (NSComparisonResult)(diff / fabs (diff));
} }
/* Thread locking/unlocking support macros.
* _isThreaded flag is an ivar that records whether the
* NSAnimation is running in thread mode.
* __gs_isLocked flag is local to each method and records
* whether the thread is locked and must be locked before
* the method exits.
* Both are needed because _isThreaded is reset when the
* NSAnimation stops : that may happen at any time between
* a lock/unlock pair.
*/
#define _NSANIMATION_LOCKING_SETUP \
BOOL __gs_isLocked = NO;
#define _NSANIMATION_LOCK \ #define _NSANIMATION_LOCK \
BOOL __gs_isLocked = NO; \
if (_isThreaded) \ if (_isThreaded) \
{ \ { \
__gs_isLocked = YES; \ NSAssert(__gs_isLocked == NO, NSInternalInconsistencyException); \
NSDebugFLLog(@"NSAnimationLock",\ NSDebugFLLog(@"NSAnimationLock",\
@"%@ LOCK %@",self,[NSThread currentThread]);\ @"%@ LOCK %@",self,[NSThread currentThread]);\
[_isAnimatingLock lock]; \ [_isAnimatingLock lock]; \
} __gs_isLocked = YES; \
}
#define _NSANIMATION_UNLOCK \ #define _NSANIMATION_UNLOCK \
if (__gs_isLocked) \ if (__gs_isLocked) \
{ \ { \
__gs_isLocked = YES; \ /* NSAssert(__gs_isLocked == YES, NSInternalInconsistencyException); */ \
NSDebugFLLog(@"NSAnimationLock",\ NSDebugFLLog(@"NSAnimationLock",\
@"%@ UNLOCK %@",self,[NSThread currentThread]);\ @"%@ UNLOCK %@",self,[NSThread currentThread]);\
__gs_isLocked = NO; \
[_isAnimatingLock unlock]; \ [_isAnimatingLock unlock]; \
} }
@ -212,11 +228,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) addProgressMark: (NSAnimationProgress)progress - (void) addProgressMark: (NSAnimationProgress)progress
{ {
_NSANIMATION_LOCKING_SETUP;
if (progress < 0.0) progress = 0.0; if (progress < 0.0) progress = 0.0;
if (progress > 1.0) progress = 1.0; if (progress > 1.0) progress = 1.0;
_NSANIMATION_LOCK;
_NSANIMATION_LOCK;
if (GSIArrayCount(_progressMarks) == 0) if (GSIArrayCount(_progressMarks) == 0)
{ // First mark { // First mark
GSIArrayAddItem (_progressMarks,progress); GSIArrayAddItem (_progressMarks,progress);
@ -248,6 +266,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSAnimationBlockingMode) animationBlockingMode - (NSAnimationBlockingMode) animationBlockingMode
{ {
NSAnimationBlockingMode m; NSAnimationBlockingMode m;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
m = _blockingMode; m = _blockingMode;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -257,6 +277,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSAnimationCurve) animationCurve - (NSAnimationCurve) animationCurve
{ {
NSAnimationCurve c; NSAnimationCurve c;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
c = _curve; c = _curve;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -265,6 +287,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) clearStartAnimation - (void) clearStartAnimation
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver: self removeObserver: self
@ -277,6 +301,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) clearStopAnimation - (void) clearStopAnimation
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver: self removeObserver: self
@ -290,6 +316,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSAnimationProgress) currentProgress - (NSAnimationProgress) currentProgress
{ {
NSAnimationProgress p; NSAnimationProgress p;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
p = _currentProgress; p = _currentProgress;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -299,6 +327,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (float) currentValue - (float) currentValue
{ {
float value; float value;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
@ -344,6 +373,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (id) delegate - (id) delegate
{ {
id d; id d;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
d = (_delegate == nil)? nil : GS_GC_UNHIDE (_delegate); d = (_delegate == nil)? nil : GS_GC_UNHIDE (_delegate);
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -353,6 +384,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSTimeInterval) duration - (NSTimeInterval) duration
{ {
NSTimeInterval d; NSTimeInterval d;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
d = _duration; d = _duration;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -362,6 +395,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (float) frameRate - (float) frameRate
{ {
float f; float f;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
f = _frameRate; f = _frameRate;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -410,7 +445,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
(BOOL (*)(id,SEL,NSAnimation*)) NULL; (BOOL (*)(id,SEL,NSAnimation*)) NULL;
_isThreaded = NO; _isThreaded = NO;
_isAnimatingLock = [[NSRecursiveLock alloc] init]; _isAnimatingLock = [GSLazyRecursiveLock new];
} }
return self; return self;
} }
@ -447,6 +482,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (BOOL) isAnimating - (BOOL) isAnimating
{ {
BOOL f; BOOL f;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
f = (_animator != nil)? [_animator isAnimationRunning] : NO; f = (_animator != nil)? [_animator isAnimationRunning] : NO;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -456,10 +493,12 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSArray*) progressMarks - (NSArray*) progressMarks
{ {
NSNumber **cpmn; NSNumber **cpmn;
unsigned count;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
unsigned count = GSIArrayCount (_progressMarks); count = GSIArrayCount (_progressMarks);
if (!_isCachedProgressMarkNumbersValid) if (!_isCachedProgressMarkNumbersValid)
{ {
@ -494,9 +533,12 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) removeProgressMark: (NSAnimationProgress)progress - (void) removeProgressMark: (NSAnimationProgress)progress
{ {
unsigned index;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
unsigned index = GSIArraySearch (_progressMarks,progress,nsanimation_progressMarkSorter); index = GSIArraySearch (_progressMarks,progress,nsanimation_progressMarkSorter);
if ( index < GSIArrayCount(_progressMarks) if ( index < GSIArrayCount(_progressMarks)
&& progress == GSIArrayItemAtIndex (_progressMarks,index) ) && progress == GSIArrayItemAtIndex (_progressMarks,index) )
{ {
@ -518,6 +560,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setAnimationBlockingMode: (NSAnimationBlockingMode)mode - (void) setAnimationBlockingMode: (NSAnimationBlockingMode)mode
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
_isANewAnimatorNeeded |= (_blockingMode != mode); _isANewAnimatorNeeded |= (_blockingMode != mode);
_blockingMode = mode; _blockingMode = mode;
@ -526,6 +570,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setAnimationCurve: (NSAnimationCurve)curve - (void) setAnimationCurve: (NSAnimationCurve)curve
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
if (_currentProgress <= 0.0f || _currentProgress >= 1.0f) if (_currentProgress <= 0.0f || _currentProgress >= 1.0f)
@ -589,6 +635,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
{ {
BOOL needSearchNextMark = NO; BOOL needSearchNextMark = NO;
NSAnimationProgress markedProgress; NSAnimationProgress markedProgress;
_NSANIMATION_LOCKING_SETUP;
if (progress < 0.0) progress = 0.0; if (progress < 0.0) progress = 0.0;
if (progress > 1.0) progress = 1.0; if (progress > 1.0) progress = 1.0;
@ -636,6 +683,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setDelegate: (id)delegate - (void) setDelegate: (id)delegate
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
_delegate = (delegate == nil)? nil : GS_GC_HIDE (delegate); _delegate = (delegate == nil)? nil : GS_GC_HIDE (delegate);
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -643,6 +692,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setDuration: (NSTimeInterval)duration - (void) setDuration: (NSTimeInterval)duration
{ {
_NSANIMATION_LOCKING_SETUP;
if (duration<=0.0) if (duration<=0.0)
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"%@ Duration must be > 0.0 (passed: %f)",self,duration]; format: @"%@ Duration must be > 0.0 (passed: %f)",self,duration];
@ -653,6 +704,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setFrameRate: (float)fps - (void) setFrameRate: (float)fps
{ {
_NSANIMATION_LOCKING_SETUP;
if (fps<0.0) if (fps<0.0)
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"%@ Framerate must be >= 0.0 (passed: %f)",self,fps]; format: @"%@ Framerate must be >= 0.0 (passed: %f)",self,fps];
@ -670,6 +723,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setProgressMarks: (NSArray*)marks - (void) setProgressMarks: (NSArray*)marks
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
GSIArrayEmpty (_progressMarks); GSIArrayEmpty (_progressMarks);
_nextMark = 0; _nextMark = 0;
@ -685,12 +740,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) startAnimation - (void) startAnimation
{ {
unsigned i;
if ([self isAnimating]) if ([self isAnimating])
return; return;
NSDebugFLLog (@"NSAnimationStart",@"%@",self); NSDebugFLLog (@"NSAnimationStart",@"%@",self);
unsigned i;
for (i=0; i<GSIArrayCount(_progressMarks); i++) for (i=0; i<GSIArrayCount(_progressMarks); i++)
NSDebugFLLog (@"NSAnimationMark", NSDebugFLLog (@"NSAnimationMark",
@"%@ Mark #%d : %f", @"%@ Mark #%d : %f",
@ -707,10 +763,11 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
if (_delegate != nil) if (_delegate != nil)
{ {
id delegate;
NSDebugFLLog (@"NSAnimationDelegate", NSDebugFLLog (@"NSAnimationDelegate",
@"%@ Cache delegation methods",self); @"%@ Cache delegation methods",self);
// delegation methods are cached while the animation is running // delegation methods are cached while the animation is running
id delegate;
delegate = GS_GC_UNHIDE (_delegate); delegate = GS_GC_UNHIDE (_delegate);
_delegate_animationDidReachProgressMark = _delegate_animationDidReachProgressMark =
([delegate respondsToSelector: @selector (animation:didReachProgressMark:)]) ? ([delegate respondsToSelector: @selector (animation:didReachProgressMark:)]) ?
@ -807,6 +864,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) startWhenAnimation: (NSAnimation*)animation - (void) startWhenAnimation: (NSAnimation*)animation
reachesProgress: (NSAnimationProgress)start reachesProgress: (NSAnimationProgress)start
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
_startAnimation = animation; _startAnimation = animation;
@ -825,6 +884,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) stopAnimation - (void) stopAnimation
{ {
_NSANIMATION_LOCKING_SETUP;
if ([self isAnimating]) if ([self isAnimating])
{ {
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
@ -836,6 +897,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) stopWhenAnimation: (NSAnimation*)animation - (void) stopWhenAnimation: (NSAnimation*)animation
reachesProgress: (NSAnimationProgress)stop reachesProgress: (NSAnimationProgress)stop
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
_stopAnimation = animation; _stopAnimation = animation;
@ -868,11 +931,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) animatorDidStart - (void) animatorDidStart
{ {
id delegate;
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationAnimator",@"%@",self); NSDebugFLLog (@"NSAnimationAnimator",@"%@",self);
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
id delegate;
delegate = GS_GC_UNHIDE (_currentDelegate); delegate = GS_GC_UNHIDE (_currentDelegate);
if (_delegate_animationShouldStart) // method is cached (the animation is running) if (_delegate_animationShouldStart) // method is cached (the animation is running)
@ -887,11 +952,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) animatorDidStop - (void) animatorDidStop
{ {
id delegate;
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationAnimator",@"%@ Progress = %f",self,_currentProgress); NSDebugFLLog (@"NSAnimationAnimator",@"%@ Progress = %f",self,_currentProgress);
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
id delegate;
delegate = GS_GC_UNHIDE (_currentDelegate); delegate = GS_GC_UNHIDE (_currentDelegate);
if (_currentProgress < 1.0) if (_currentProgress < 1.0)
{ {
@ -916,11 +983,14 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) animatorStep: (NSTimeInterval) elapsedTime; - (void) animatorStep: (NSTimeInterval) elapsedTime;
{ {
NSAnimationProgress progress;
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationAnimator",@"%@ Elapsed time : %f",self,elapsedTime); NSDebugFLLog (@"NSAnimationAnimator",@"%@ Elapsed time : %f",self,elapsedTime);
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
NSAnimationProgress progress = (elapsedTime / _duration); progress = (elapsedTime / _duration);
{ // have some marks been passed ? { // have some marks been passed ?
// NOTE: the case where progress == markedProgress is // NOTE: the case where progress == markedProgress is
@ -945,14 +1015,17 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) _gs_startAnimationReachesProgressMark: (NSNotification*)notification - (void) _gs_startAnimationReachesProgressMark: (NSNotification*)notification
{ {
NSAnimation *animation = [notification object]; NSAnimation *animation;
NSAnimationProgress mark NSAnimationProgress mark;
= [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue]; _NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
animation = [notification object];
mark = [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue];
NSDebugFLLog (@"NSAnimationMark", NSDebugFLLog (@"NSAnimationMark",
@"%@ Start Animation %@ reaches %f",self,animation,mark); @"%@ Start Animation %@ reaches %f",self,animation,mark);
_NSANIMATION_LOCK;
if ( animation == _startAnimation && mark == _startMark) if ( animation == _startAnimation && mark == _startMark)
{ {
// [self clearStartAnimation]; // [self clearStartAnimation];
@ -962,15 +1035,20 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
} }
- (void) _gs_stopAnimationReachesProgressMark: (NSNotification*)notification - (void) _gs_stopAnimationReachesProgressMark: (NSNotification*)notification
{ {
NSAnimation *animation = [notification object]; NSAnimation *animation;
NSAnimationProgress mark NSAnimationProgress mark;
= [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue]; _NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
animation = [notification object];
mark = [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue];
NSDebugFLLog (@"NSAnimationMark", NSDebugFLLog (@"NSAnimationMark",
@"%@ Stop Animation %@ reaches %f",self,animation,mark); @"%@ Stop Animation %@ reaches %f",self,animation,mark);
_NSANIMATION_LOCK;
if ( animation == _stopAnimation && mark == _stopMark) if ( animation == _stopAnimation && mark == _stopMark)
{ {
@ -987,6 +1065,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) _gs_didReachProgressMark: (NSAnimationProgress) progress - (void) _gs_didReachProgressMark: (NSAnimationProgress) progress
{ {
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationMark",@"%@ progress %f",self, progress); NSDebugFLLog (@"NSAnimationMark",@"%@ progress %f",self, progress);
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
@ -1074,6 +1154,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (unsigned int) frameCount - (unsigned int) frameCount
{ {
unsigned c; unsigned c;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
c = (_animator != nil)? [_animator frameCount] : 0; c = (_animator != nil)? [_animator frameCount] : 0;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -1082,6 +1164,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) resetCounters - (void) resetCounters
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
if (_animator != nil) [_animator resetCounters]; if (_animator != nil) [_animator resetCounters];
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -1090,6 +1174,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (float) actualFrameRate; - (float) actualFrameRate;
{ {
float r; float r;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
r = (_animator != nil)? [_animator frameRate] : 0.0; r = (_animator != nil)? [_animator frameRate] : 0.0;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -1314,6 +1400,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) setViewAnimations: (NSArray*)animations - (void) setViewAnimations: (NSArray*)animations
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
if (_viewAnimations != animations) if (_viewAnimations != animations)
DESTROY (_viewAnimationDesc); DESTROY (_viewAnimationDesc);
@ -1324,6 +1412,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (NSArray*) viewAnimations - (NSArray*) viewAnimations
{ {
NSArray *a; NSArray *a;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
a = _viewAnimations; a = _viewAnimations;
_NSANIMATION_UNLOCK; _NSANIMATION_UNLOCK;
@ -1332,6 +1422,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) startAnimation - (void) startAnimation
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
if (_viewAnimationDesc == nil) if (_viewAnimationDesc == nil)
{ {
@ -1351,6 +1443,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) stopAnimation - (void) stopAnimation
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
[super stopAnimation]; [super stopAnimation];
[self setCurrentProgress: 1.0]; [self setCurrentProgress: 1.0];
@ -1371,6 +1465,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) setCurrentProgress: (NSAnimationProgress)progress - (void) setCurrentProgress: (NSAnimationProgress)progress
{ {
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK; _NSANIMATION_LOCK;
[super setCurrentProgress: progress]; [super setCurrentProgress: progress];
[self performSelectorOnMainThread: @selector (_gs_updateViewsWithValue:) [self performSelectorOnMainThread: @selector (_gs_updateViewsWithValue:)

View file

@ -112,9 +112,11 @@ static void gs_gif_init_input_source(gs_gif_input_src *src, NSData *data)
/* Function to write GIF to buffer */ /* Function to write GIF to buffer */
static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len) static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
{ {
NSMutableData *nsData;
if (len <= 0) return 0; if (len <= 0) return 0;
NSMutableData * nsData = file->UserData; nsData = file->UserData;
[nsData appendBytes: buffer length: len]; [nsData appendBytes: buffer length: len];
return len; return len;
} }

View file

@ -207,7 +207,8 @@ static NSTextFieldCell *titleCell;
} }
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect]; [[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
[self drawInteriorWithFrame: cellFrame inView: controlView]; [self drawInteriorWithFrame: NSInsetRect(cellFrame, 1.0, 1.0)
inView: controlView];
} }
@end @end

File diff suppressed because it is too large Load diff

View file

@ -565,12 +565,14 @@ withContentsOfURL: (NSURL *)url
- (NSFileWrapper *)fileWrapperOfType: (NSString *)type - (NSFileWrapper *)fileWrapperOfType: (NSString *)type
error: (NSError **)error error: (NSError **)error
{ {
NSData *data;
if (OVERRIDDEN(fileWrapperRepresentationOfType:)) if (OVERRIDDEN(fileWrapperRepresentationOfType:))
{ {
return [self fileWrapperRepresentationOfType: type]; return [self fileWrapperRepresentationOfType: type];
} }
NSData *data = [self dataOfType: type error: error]; data = [self dataOfType: type error: error];
if (data == nil) if (data == nil)
return nil; return nil;

View file

@ -47,7 +47,7 @@
@implementation NSMenuItemCell @implementation NSMenuItemCell
static NSImage *arrowImage = nil; /* Cache arrow image. */ static NSImage *arrowImage = nil; /* Cache arrow image. */
+ (void) initialize + (void) initialize
@ -113,7 +113,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
mask = _highlightsByMask; mask = _highlightsByMask;
if (_cell.state) if (_cell.state)
mask &= ~_showAltStateMask; mask &= ~_showAltStateMask;
} }
else if (_cell.state) else if (_cell.state)
mask = _showAltStateMask; mask = _showAltStateMask;
@ -197,11 +197,11 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
shift = (m & NSShiftKeyMask) & ![key isEqualToString: ucKey]; shift = (m & NSShiftKeyMask) & ![key isEqualToString: ucKey];
key = [NSString stringWithFormat:@"%@%@%@%@%@", key = [NSString stringWithFormat:@"%@%@%@%@%@",
(m & NSControlKeyMask) ? @"^" : @"", (m & NSControlKeyMask) ? @"^" : @"",
(m & NSAlternateKeyMask) ? @"+" : @"", (m & NSAlternateKeyMask) ? @"+" : @"",
shift ? @"/" : @"", shift ? @"/" : @"",
(m & NSCommandKeyMask) ? @"#" : @"", (m & NSCommandKeyMask) ? @"#" : @"",
key]; key];
return key; return key;
} }
@ -226,30 +226,30 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
if ([_menuItem onStateImage]) if ([_menuItem onStateImage])
componentSize = [[_menuItem onStateImage] size]; componentSize = [[_menuItem onStateImage] size];
else else
componentSize = NSMakeSize(0,0); componentSize = NSMakeSize(0,0);
_stateImageWidth = componentSize.width; _stateImageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight) if (componentSize.height > neededMenuItemHeight)
neededMenuItemHeight = componentSize.height; neededMenuItemHeight = componentSize.height;
// NSOffState // NSOffState
if ([_menuItem offStateImage]) if ([_menuItem offStateImage])
componentSize = [[_menuItem offStateImage] size]; componentSize = [[_menuItem offStateImage] size];
else else
componentSize = NSMakeSize(0,0); componentSize = NSMakeSize(0,0);
if (componentSize.width > _stateImageWidth) if (componentSize.width > _stateImageWidth)
_stateImageWidth = componentSize.width; _stateImageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight) if (componentSize.height > neededMenuItemHeight)
neededMenuItemHeight = componentSize.height; neededMenuItemHeight = componentSize.height;
// NSMixedState // NSMixedState
if ([_menuItem mixedStateImage]) if ([_menuItem mixedStateImage])
componentSize = [[_menuItem mixedStateImage] size]; componentSize = [[_menuItem mixedStateImage] size];
else else
componentSize = NSMakeSize(0,0); componentSize = NSMakeSize(0,0);
if (componentSize.width > _stateImageWidth) if (componentSize.width > _stateImageWidth)
_stateImageWidth = componentSize.width; _stateImageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight) if (componentSize.height > neededMenuItemHeight)
neededMenuItemHeight = componentSize.height; neededMenuItemHeight = componentSize.height;
} }
else else
{ {
@ -264,7 +264,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
componentSize = [anImage size]; componentSize = [anImage size];
_imageWidth = componentSize.width; _imageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight) if (componentSize.height > neededMenuItemHeight)
neededMenuItemHeight = componentSize.height; neededMenuItemHeight = componentSize.height;
} }
else else
{ {
@ -287,7 +287,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
componentSize = [arrowImage size]; componentSize = [arrowImage size];
_keyEquivalentWidth = componentSize.width; _keyEquivalentWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight) if (componentSize.height > neededMenuItemHeight)
neededMenuItemHeight = componentSize.height; neededMenuItemHeight = componentSize.height;
} }
// Cache definitive height // Cache definitive height
@ -360,42 +360,42 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
if (_mcell_belongs_to_popupbutton && _cell.image_position) if (_mcell_belongs_to_popupbutton && _cell.image_position)
{ {
// Special case: draw image on the extreme right // Special case: draw image on the extreme right
cellFrame.origin.x += cellFrame.size.width - _imageWidth - 4; cellFrame.origin.x += cellFrame.size.width - _imageWidth - 4;
cellFrame.size.width = _imageWidth; cellFrame.size.width = _imageWidth;
return cellFrame; return cellFrame;
} }
if ([_menuView isHorizontal] == YES) if ([_menuView isHorizontal] == YES)
{ {
switch (_cell.image_position) switch (_cell.image_position)
{ {
case NSNoImage: case NSNoImage:
cellFrame = NSZeroRect; cellFrame = NSZeroRect;
break; break;
case NSImageOnly: case NSImageOnly:
case NSImageOverlaps: case NSImageOverlaps:
break; break;
case NSImageLeft: case NSImageLeft:
cellFrame.origin.x += 4.; // _horizontalEdgePad cellFrame.origin.x += 4.; // _horizontalEdgePad
cellFrame.size.width = _imageWidth; cellFrame.size.width = _imageWidth;
break; break;
case NSImageRight: case NSImageRight:
cellFrame.origin.x += _titleWidth; cellFrame.origin.x += _titleWidth;
cellFrame.size.width = _imageWidth; cellFrame.size.width = _imageWidth;
break; break;
case NSImageBelow: case NSImageBelow:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
break; break;
case NSImageAbove: case NSImageAbove:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
cellFrame.origin.y += cellFrame.size.height; cellFrame.origin.y += cellFrame.size.height;
break; break;
} }
} }
else else
{ {
@ -404,33 +404,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
cellFrame.size.width = [_menuView imageAndTitleWidth]; cellFrame.size.width = [_menuView imageAndTitleWidth];
switch (_cell.image_position) switch (_cell.image_position)
{ {
case NSNoImage: case NSNoImage:
cellFrame = NSZeroRect; cellFrame = NSZeroRect;
break; break;
case NSImageOnly: case NSImageOnly:
case NSImageOverlaps: case NSImageOverlaps:
break; break;
case NSImageLeft: case NSImageLeft:
cellFrame.size.width = _imageWidth; cellFrame.size.width = _imageWidth;
break; break;
case NSImageRight: case NSImageRight:
cellFrame.origin.x += _titleWidth + GSCellTextImageXDist; cellFrame.origin.x += _titleWidth + GSCellTextImageXDist;
cellFrame.size.width = _imageWidth; cellFrame.size.width = _imageWidth;
break; break;
case NSImageBelow: case NSImageBelow:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
break; break;
case NSImageAbove: case NSImageAbove:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
cellFrame.origin.y += cellFrame.size.height; cellFrame.origin.y += cellFrame.size.height;
break; break;
} }
} }
return cellFrame; return cellFrame;
} }
@ -465,33 +465,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
cellFrame.size.height -= 2; cellFrame.size.height -= 2;
switch (_cell.image_position) switch (_cell.image_position)
{ {
case NSNoImage: case NSNoImage:
case NSImageOverlaps: case NSImageOverlaps:
break; break;
case NSImageOnly: case NSImageOnly:
cellFrame = NSZeroRect; cellFrame = NSZeroRect;
break; break;
case NSImageLeft: case NSImageLeft:
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist + 4; cellFrame.origin.x += _imageWidth + GSCellTextImageXDist + 4;
cellFrame.size.width = _titleWidth; cellFrame.size.width = _titleWidth;
break; break;
case NSImageRight: case NSImageRight:
cellFrame.size.width = _titleWidth; cellFrame.size.width = _titleWidth;
break; break;
case NSImageBelow: case NSImageBelow:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
cellFrame.origin.y += cellFrame.size.height; cellFrame.origin.y += cellFrame.size.height;
break; break;
case NSImageAbove: case NSImageAbove:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
break; break;
} }
} }
else else
{ {
@ -500,33 +500,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
cellFrame.size.width = [_menuView imageAndTitleWidth]; cellFrame.size.width = [_menuView imageAndTitleWidth];
switch (_cell.image_position) switch (_cell.image_position)
{ {
case NSNoImage: case NSNoImage:
case NSImageOverlaps: case NSImageOverlaps:
break; break;
case NSImageOnly: case NSImageOnly:
cellFrame = NSZeroRect; cellFrame = NSZeroRect;
break; break;
case NSImageLeft: case NSImageLeft:
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist; cellFrame.origin.x += _imageWidth + GSCellTextImageXDist;
cellFrame.size.width = _titleWidth; cellFrame.size.width = _titleWidth;
break; break;
case NSImageRight: case NSImageRight:
cellFrame.size.width = _titleWidth; cellFrame.size.width = _titleWidth;
break; break;
case NSImageBelow: case NSImageBelow:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
cellFrame.origin.y += cellFrame.size.height; cellFrame.origin.y += cellFrame.size.height;
break; break;
case NSImageAbove: case NSImageAbove:
cellFrame.size.height /= 2; cellFrame.size.height /= 2;
break; break;
} }
} }
return cellFrame; return cellFrame;
} }
@ -540,50 +540,50 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
* must inset from that. * must inset from that.
*/ */
return NSMakeRect (theRect.origin.x, theRect.origin.y + 2, return NSMakeRect (theRect.origin.x, theRect.origin.y + 2,
theRect.size.width, theRect.size.height - 2); theRect.size.width, theRect.size.height - 2);
} }
else else
{ {
if (_cell.is_bordered) if (_cell.is_bordered)
{ {
float yDelta = [_control_view isFlipped] ? 1. : 2.; float yDelta = [_control_view isFlipped] ? 1. : 2.;
unsigned mask; unsigned mask;
NSRect interiorFrame; NSRect interiorFrame;
if (_cell.is_highlighted) if (_cell.is_highlighted)
{ {
mask = _highlightsByMask; mask = _highlightsByMask;
if (_cell.state) if (_cell.state)
mask &= ~_showAltStateMask; mask &= ~_showAltStateMask;
} }
else if (_cell.state) else if (_cell.state)
mask = _showAltStateMask; mask = _showAltStateMask;
else else
mask = NSNoCellMask; mask = NSNoCellMask;
/* /*
* Special case: Buttons have only three different paths for border. * Special case: Buttons have only three different paths for border.
* One white path at the top left corner, one black path at the * One white path at the top left corner, one black path at the
* bottom right and another in dark gray at the inner bottom right. * bottom right and another in dark gray at the inner bottom right.
*/ */
interiorFrame = NSMakeRect(theRect.origin.x + 1., interiorFrame = NSMakeRect(theRect.origin.x + 1.,
theRect.origin.y + yDelta, theRect.origin.y + yDelta,
theRect.size.width - 3., theRect.size.width - 3.,
theRect.size.height - 3.); theRect.size.height - 3.);
// pushed in buttons contents are displaced to the bottom right 1px // pushed in buttons contents are displaced to the bottom right 1px
if ((mask & NSPushInCellMask)) if ((mask & NSPushInCellMask))
{ {
interiorFrame interiorFrame
= NSOffsetRect(interiorFrame, 1., [_control_view isFlipped] ? 1. : -1.); = NSOffsetRect(interiorFrame, 1., [_control_view isFlipped] ? 1. : -1.);
} }
return interiorFrame; return interiorFrame;
} }
else else
{ {
return theRect; return theRect;
} }
} }
} }
@ -591,7 +591,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
// Drawing. // Drawing.
// //
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame - (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView inView: (NSView *)controlView
{ {
if ([_menuView isHorizontal] == YES) if ([_menuView isHorizontal] == YES)
{ {
@ -619,21 +619,21 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
} }
- (void) drawImageWithFrame: (NSRect)cellFrame - (void) drawImageWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView inView: (NSView *)controlView
{ {
cellFrame = [self imageRectForBounds: cellFrame]; cellFrame = [self imageRectForBounds: cellFrame];
[self drawImage: _imageToDisplay withFrame: cellFrame inView: controlView]; [self drawImage: _imageToDisplay withFrame: cellFrame inView: controlView];
} }
- (void) drawKeyEquivalentWithFrame:(NSRect)cellFrame - (void) drawKeyEquivalentWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView inView:(NSView *)controlView
{ {
cellFrame = [self keyEquivalentRectForBounds: cellFrame]; cellFrame = [self keyEquivalentRectForBounds: cellFrame];
if ([_menuItem hasSubmenu] && arrowImage != nil) if ([_menuItem hasSubmenu] && arrowImage != nil)
{ {
NSSize size; NSSize size;
NSPoint position; NSPoint position;
size = [arrowImage size]; size = [arrowImage size];
position.x = cellFrame.origin.x + cellFrame.size.width - size.width; position.x = cellFrame.origin.x + cellFrame.size.width - size.width;
@ -643,7 +643,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
* so we must adjust the position to take account of a flipped view. * so we must adjust the position to take account of a flipped view.
*/ */
if ([controlView isFlipped]) if ([controlView isFlipped])
position.y += size.height; position.y += size.height;
[arrowImage compositeToPoint: position operation: NSCompositeSourceOver]; [arrowImage compositeToPoint: position operation: NSCompositeSourceOver];
} }
@ -665,33 +665,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
- (void) drawSeparatorItemWithFrame:(NSRect)cellFrame - (void) drawSeparatorItemWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView inView:(NSView *)controlView
{ {
// FIXME: This only has sense in MacOS or Windows interface styles. // FIXME: This only has sense in MacOS or Windows interface styles.
// Maybe somebody wants to support this (Lazaro). // Maybe somebody wants to support this (Lazaro).
} }
- (void) drawStateImageWithFrame: (NSRect)cellFrame - (void) drawStateImageWithFrame: (NSRect)cellFrame
inView: (NSView*)controlView inView: (NSView*)controlView
{ {
NSSize size; NSSize size;
NSPoint position; NSPoint position;
NSImage *imageToDisplay; NSImage *imageToDisplay;
switch ([_menuItem state]) switch ([_menuItem state])
{ {
case NSOnState: case NSOnState:
imageToDisplay = [_menuItem onStateImage]; imageToDisplay = [_menuItem onStateImage];
break; break;
case NSMixedState: case NSMixedState:
imageToDisplay = [_menuItem mixedStateImage]; imageToDisplay = [_menuItem mixedStateImage];
break; break;
case NSOffState: case NSOffState:
default: default:
imageToDisplay = [_menuItem offStateImage]; imageToDisplay = [_menuItem offStateImage];
break; break;
} }
if (imageToDisplay == nil) if (imageToDisplay == nil)
@ -717,7 +717,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
} }
- (void) drawTitleWithFrame:(NSRect)cellFrame - (void) drawTitleWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView inView:(NSView *)controlView
{ {
if ([_menuView isHorizontal] == YES) if ([_menuView isHorizontal] == YES)
{ {
@ -728,13 +728,13 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
NSRect cf = [self titleRectForBounds: cellFrame]; NSRect cf = [self titleRectForBounds: cellFrame];
if (!_imageWidth) if (!_imageWidth)
[value setAlignment: NSCenterTextAlignment]; [value setAlignment: NSCenterTextAlignment];
attr = [[NSDictionary alloc] initWithObjectsAndKeys: attr = [[NSDictionary alloc] initWithObjectsAndKeys:
value, NSParagraphStyleAttributeName, value, NSParagraphStyleAttributeName,
_font, NSFontAttributeName, _font, NSFontAttributeName,
[NSColor controlTextColor], NSForegroundColorAttributeName, [NSColor controlTextColor], NSForegroundColorAttributeName,
nil]; nil];
[[_menuItem title] drawInRect: cf withAttributes: attr]; [[_menuItem title] drawInRect: cf withAttributes: attr];
@ -743,7 +743,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
else else
{ {
[self _drawText: [_menuItem title] [self _drawText: [_menuItem title]
inFrame: [self titleRectForBounds: cellFrame]]; inFrame: [self titleRectForBounds: cellFrame]];
} }
} }
@ -774,7 +774,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
mask = _highlightsByMask; mask = _highlightsByMask;
if (_cell.state) if (_cell.state)
mask &= ~_showAltStateMask; mask &= ~_showAltStateMask;
} }
else if (_cell.state) else if (_cell.state)
mask = _showAltStateMask; mask = _showAltStateMask;
@ -794,10 +794,10 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
{ {
_imageToDisplay = _altImage; _imageToDisplay = _altImage;
if (!_imageToDisplay) if (!_imageToDisplay)
_imageToDisplay = [_menuItem image]; _imageToDisplay = [_menuItem image];
_titleToDisplay = _altContents; _titleToDisplay = _altContents;
if (_titleToDisplay == nil || [_titleToDisplay isEqual: @""]) if (_titleToDisplay == nil || [_titleToDisplay isEqual: @""])
_titleToDisplay = [_menuItem title]; _titleToDisplay = [_menuItem title];
} }
else else
{ {
@ -814,29 +814,29 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
{ {
// Draw the image // Draw the image
if (_imageWidth > 0) if (_imageWidth > 0)
[self drawImageWithFrame: cellFrame inView: controlView]; [self drawImageWithFrame: cellFrame inView: controlView];
// Draw the title // Draw the title
if (_titleWidth > 0) if (_titleWidth > 0)
[self drawTitleWithFrame: cellFrame inView: controlView]; [self drawTitleWithFrame: cellFrame inView: controlView];
} }
else else
{ {
// Draw the state image // Draw the state image
if (_stateImageWidth > 0) if (_stateImageWidth > 0)
[self drawStateImageWithFrame: cellFrame inView: controlView]; [self drawStateImageWithFrame: cellFrame inView: controlView];
// Draw the image // Draw the image
if (_imageWidth > 0) if (_imageWidth > 0)
[self drawImageWithFrame: cellFrame inView: controlView]; [self drawImageWithFrame: cellFrame inView: controlView];
// Draw the title // Draw the title
if (_titleWidth > 0) if (_titleWidth > 0)
[self drawTitleWithFrame: cellFrame inView: controlView]; [self drawTitleWithFrame: cellFrame inView: controlView];
// Draw the key equivalent // Draw the key equivalent
if (_keyEquivalentWidth > 0) if (_keyEquivalentWidth > 0)
[self drawKeyEquivalentWithFrame: cellFrame inView: controlView]; [self drawKeyEquivalentWithFrame: cellFrame inView: controlView];
} }
} }
@ -889,9 +889,9 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2) if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2)
{ {
/* In version 1, we used to encode the _menuView here. */ /* In version 1, we used to encode the _menuView here. */
[aDecoder decodeObject]; [aDecoder decodeObject];
} }
} }
_needs_sizing = YES; _needs_sizing = YES;

View file

@ -385,8 +385,8 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
{ {
while ((currCell = [cellEnum nextObject])) while ((currCell = [cellEnum nextObject]))
{ {
[ret addObject: [NSString stringWithFormat: @"%@/%@", dir, [ret addObject:
[currCell stringValue]]]; [dir stringByAppendingPathComponent: [currCell stringValue]]];
} }
} }
return ret; return ret;

View file

@ -510,19 +510,22 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
/** Run a print operation modally with respect to a window. /** Run a print operation modally with respect to a window.
*/ */
- (void)runOperationModalForWindow: (NSWindow *)docWindow - (void)runOperationModalForWindow: (NSWindow *)docWindow
delegate: (id)delegate delegate: (id)delegate
didRunSelector: (SEL)didRunSelector didRunSelector: (SEL)didRunSelector
contextInfo:(void *)contextInfo contextInfo:(void *)contextInfo
{ {
NSMutableDictionary *dict; NSMutableDictionary *dict;
NSPrintPanel *panel = [self printPanel]; NSPrintPanel *panel = [self printPanel];
/* Save the selector so we can use it later */ if (delegate != nil && didRunSelector != NULL)
dict = [_print_info dictionary]; {
[dict setObject: [NSValue value: &didRunSelector withObjCType: @encode(SEL)] /* Save the selector so we can use it later */
forKey: @"GSModalRunSelector"]; dict = [_print_info dictionary];
[dict setObject: delegate [dict setObject: [NSValue value: &didRunSelector withObjCType: @encode(SEL)]
forKey: @"GSModalRunDelegate"]; forKey: @"GSModalRunSelector"];
[dict setObject: delegate
forKey: @"GSModalRunDelegate"];
}
/* Assume we want to show the panel regardless of the value /* Assume we want to show the panel regardless of the value
of _showPanels of _showPanels
@ -701,11 +704,14 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
} }
[self cleanUpOperation]; [self cleanUpOperation];
dict = [_print_info dictionary]; dict = [_print_info dictionary];
[[dict objectForKey: @"GSModalRunSelector"] getValue:&didRunSelector]; [[dict objectForKey: @"GSModalRunSelector"] getValue: &didRunSelector];
delegate = [dict objectForKey: @"GSModalRunDelegate"]; delegate = [dict objectForKey: @"GSModalRunDelegate"];
didRun = (void (*)(id, SEL, BOOL, id))[delegate methodForSelector: if (delegate != nil && didRunSelector != NULL)
didRunSelector]; {
didRun (delegate, didRunSelector, success, contextInfo); didRun = (void (*)(id, SEL, BOOL, id))[delegate methodForSelector:
didRunSelector];
didRun (delegate, didRunSelector, success, contextInfo);
}
} }

View file

@ -220,15 +220,14 @@ static BOOL _gs_display_reading_progress = NO;
[_form release]; [_form release];
r = NSMakeRect (43, 6, 27, 27); r = NSMakeRect (43, 6, 27, 27);
button = [[NSButton alloc] initWithFrame: r]; button = [[NSButton alloc] initWithFrame: r];
[button setRefusesFirstResponder: YES];
[button setBordered: YES]; [button setBordered: YES];
[button setButtonType: NSMomentaryPushButton];
image = [NSImage imageNamed: @"common_Home"]; image = [NSImage imageNamed: @"common_Home"];
[button setImage: image]; [button setImage: image];
[button setImagePosition: NSImageOnly]; [button setImagePosition: NSImageOnly];
[button setTarget: self]; [button setTarget: self];
[button setAction: @selector(_setHomeDirectory)]; [button setAction: @selector(_setHomeDirectory)];
// [_form setNextKeyView: button];
[button setAutoresizingMask: NSViewMinXMargin]; [button setAutoresizingMask: NSViewMinXMargin];
[button setTag: NSFileHandlingPanelHomeButton]; [button setTag: NSFileHandlingPanelHomeButton];
[_bottomView addSubview: button]; [_bottomView addSubview: button];
@ -238,8 +237,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (78, 6, 27, 27); r = NSMakeRect (78, 6, 27, 27);
button = [[NSButton alloc] initWithFrame: r]; button = [[NSButton alloc] initWithFrame: r];
[button setRefusesFirstResponder: YES];
[button setBordered: YES]; [button setBordered: YES];
[button setButtonType: NSMomentaryPushButton];
image = [NSImage imageNamed: @"common_Mount"]; image = [NSImage imageNamed: @"common_Mount"];
[button setImage: image]; [button setImage: image];
[button setImagePosition: NSImageOnly]; [button setImagePosition: NSImageOnly];
@ -254,8 +253,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (112, 6, 27, 27); r = NSMakeRect (112, 6, 27, 27);
button = [[NSButton alloc] initWithFrame: r]; button = [[NSButton alloc] initWithFrame: r];
[button setRefusesFirstResponder: YES];
[button setBordered: YES]; [button setBordered: YES];
[button setButtonType: NSMomentaryPushButton];
image = [NSImage imageNamed: @"common_Unmount"]; image = [NSImage imageNamed: @"common_Unmount"];
[button setImage: image]; [button setImage: image];
[button setImagePosition: NSImageOnly]; [button setImagePosition: NSImageOnly];
@ -270,8 +269,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (148, 6, 71, 27); r = NSMakeRect (148, 6, 71, 27);
button = [[NSButton alloc] initWithFrame: r]; button = [[NSButton alloc] initWithFrame: r];
[button setRefusesFirstResponder: YES];
[button setBordered: YES]; [button setBordered: YES];
[button setButtonType: NSMomentaryPushButton];
[button setTitle: @"Cancel"]; [button setTitle: @"Cancel"];
[button setImagePosition: NSNoImage]; [button setImagePosition: NSNoImage];
[button setTarget: self]; [button setTarget: self];
@ -285,8 +284,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (228, 6, 71, 27); r = NSMakeRect (228, 6, 71, 27);
_okButton = [[NSButton alloc] initWithFrame: r]; _okButton = [[NSButton alloc] initWithFrame: r];
[button setRefusesFirstResponder: YES];
[_okButton setBordered: YES]; [_okButton setBordered: YES];
[_okButton setButtonType: NSMomentaryPushButton];
[_okButton setTitle: @"OK"]; [_okButton setTitle: @"OK"];
[_okButton setImagePosition: NSImageRight]; [_okButton setImagePosition: NSImageRight];
[_okButton setImage: [NSImage imageNamed: @"common_ret"]]; [_okButton setImage: [NSImage imageNamed: @"common_ret"]];
@ -311,6 +310,7 @@ static BOOL _gs_display_reading_progress = NO;
[button setImage: image]; [button setImage: image];
[button setBordered: NO]; [button setBordered: NO];
[button setEnabled: NO]; [button setEnabled: NO];
[[button cell] setImageDimsWhenDisabled: NO];
[button setImagePosition: NSImageOnly]; [button setImagePosition: NSImageOnly];
[button setAutoresizingMask: NSViewMinYMargin]; [button setAutoresizingMask: NSViewMinYMargin];
[button setTag: NSFileHandlingPanelImageButton]; [button setTag: NSFileHandlingPanelImageButton];

View file

@ -3267,19 +3267,6 @@ byExtendingSelection: (BOOL)flag
[_editedCell setEditable: _dataSource_editable]; [_editedCell setEditable: _dataSource_editable];
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb [_editedCell setObjectValue: [self _objectValueForTableColumn: tb
row: rowIndex]]; row: rowIndex]];
/* [_dataSource tableView: self
objectValueForTableColumn: tb
row: rowIndex]]; */
// We really want the correct background color!
if ([_editedCell respondsToSelector: @selector(setBackgroundColor:)])
{
[(NSTextFieldCell *)_editedCell setBackgroundColor: _backgroundColor];
}
else
{
[t setBackgroundColor: _backgroundColor];
}
// But of course the delegate can mess it up if it wants // But of course the delegate can mess it up if it wants
[self _willDisplayCell: _editedCell [self _willDisplayCell: _editedCell
@ -3302,6 +3289,9 @@ byExtendingSelection: (BOOL)flag
} }
_textObject = [_editedCell setUpFieldEditorAttributes: t]; _textObject = [_editedCell setUpFieldEditorAttributes: t];
// FIXME: Which background color do we want here?
[_textObject setBackgroundColor: [NSColor selectedControlColor]];
[_textObject setDrawsBackground: YES];
drawingRect = [self frameOfCellAtColumn: columnIndex row: rowIndex]; drawingRect = [self frameOfCellAtColumn: columnIndex row: rowIndex];
if (flag) if (flag)
@ -4727,6 +4717,7 @@ static BOOL selectContiguousRegion(NSTableView *self,
NSLog(@"exiting sizeToFit"); NSLog(@"exiting sizeToFit");
} }
*/ */
- (void) noteNumberOfRowsChanged - (void) noteNumberOfRowsChanged
{ {
_numberOfRows = [self _numRows]; _numberOfRows = [self _numRows];
@ -4737,50 +4728,72 @@ static BOOL selectContiguousRegion(NSTableView *self,
{ {
int row = [_selectedRows lastIndex]; int row = [_selectedRows lastIndex];
/* Check that all selected rows are in the new range of rows */ if (row == NSNotFound)
if ((row != NSNotFound) && (row >= _numberOfRows))
{ {
[_selectedRows removeIndexesInRange: if (!_allowsEmptySelection)
NSMakeRange(_numberOfRows, row + 1 - _numberOfRows)]; {
if (_selectedRow >= _numberOfRows) /* We shouldn't allow empty selection - try
{ selecting the last row */
row = [_selectedRows lastIndex]; int lastRow = _numberOfRows - 1;
[self _postSelectionIsChangingNotification];
if (row != NSNotFound)
{
_selectedRow = row;
}
else
{
/* Argh - all selected rows were outside the table */
if (_allowsEmptySelection)
{
_selectedRow = -1;
}
else
{
/* We shouldn't allow empty selection - try
selecting the last row */
int lastRow = _numberOfRows - 1;
if (lastRow > -1) if (lastRow > -1)
{ {
[_selectedRows addIndex: lastRow]; [self _postSelectionIsChangingNotification];
_selectedRow = lastRow; [_selectedRows addIndex: lastRow];
} _selectedRow = lastRow;
else [self _postSelectionDidChangeNotification];
{ }
/* problem - there are no rows at all */ else
_selectedRow = -1; {
} /* problem - there are no rows at all */
} _selectedRow = -1;
} }
[self _postSelectionDidChangeNotification]; }
} }
} /* Check that all selected rows are in the new range of rows */
else if (row >= _numberOfRows)
{
[_selectedRows removeIndexesInRange:
NSMakeRange(_numberOfRows, row + 1 - _numberOfRows)];
if (_selectedRow >= _numberOfRows)
{
row = [_selectedRows lastIndex];
[self _postSelectionIsChangingNotification];
if (row != NSNotFound)
{
_selectedRow = row;
}
else
{
/* Argh - all selected rows were outside the table */
if (_allowsEmptySelection)
{
_selectedRow = -1;
}
else
{
/* We shouldn't allow empty selection - try
selecting the last row */
int lastRow = _numberOfRows - 1;
if (lastRow > -1)
{
[_selectedRows addIndex: lastRow];
_selectedRow = lastRow;
}
else
{
/* problem - there are no rows at all */
_selectedRow = -1;
}
}
}
[self _postSelectionDidChangeNotification];
}
}
} }
[self setFrame: NSMakeRect (_frame.origin.x, [self setFrame: NSMakeRect (_frame.origin.x,
_frame.origin.y, _frame.origin.y,
_frame.size.width, _frame.size.width,
@ -4793,10 +4806,10 @@ static BOOL selectContiguousRegion(NSTableView *self,
NSRect superviewBounds; // Get this *after* [self setFrame:] NSRect superviewBounds; // Get this *after* [self setFrame:]
superviewBounds = [_super_view bounds]; superviewBounds = [_super_view bounds];
if ((superviewBounds.origin.x <= _frame.origin.x) if ((superviewBounds.origin.x <= _frame.origin.x)
&& (NSMaxY (superviewBounds) >= NSMaxY (_frame))) && (NSMaxY(superviewBounds) >= NSMaxY(_frame)))
{ {
[self setNeedsDisplay: YES]; [self setNeedsDisplay: YES];
} }
} }
} }
@ -6336,21 +6349,20 @@ static BOOL selectContiguousRegion(NSTableView *self,
*/ */
- (void) _postSelectionIsChangingNotification - (void) _postSelectionIsChangingNotification
{ {
[nc postNotificationName: [nc postNotificationName: NSTableViewSelectionIsChangingNotification
NSTableViewSelectionIsChangingNotification
object: self]; object: self];
} }
- (void) _postSelectionDidChangeNotification - (void) _postSelectionDidChangeNotification
{ {
[nc postNotificationName: [nc postNotificationName: NSTableViewSelectionDidChangeNotification
NSTableViewSelectionDidChangeNotification
object: self]; object: self];
} }
- (void) _postColumnDidMoveNotificationWithOldIndex: (int) oldIndex - (void) _postColumnDidMoveNotificationWithOldIndex: (int) oldIndex
newIndex: (int) newIndex newIndex: (int) newIndex
{ {
[nc postNotificationName: [nc postNotificationName: NSTableViewColumnDidMoveNotification
NSTableViewColumnDidMoveNotification
object: self object: self
userInfo: [NSDictionary userInfo: [NSDictionary
dictionaryWithObjectsAndKeys: dictionaryWithObjectsAndKeys:

View file

@ -31,7 +31,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "AppKit/NSCell.h" #include "AppKit/NSCell.h"
@ -45,18 +46,18 @@
@implementation NSTextAttachmentCell @implementation NSTextAttachmentCell
- (void)drawWithFrame:(NSRect)cellFrame - (void)drawWithFrame: (NSRect)cellFrame
inView:(NSView *)controlView inView: (NSView *)controlView
characterIndex:(unsigned)charIndex characterIndex: (unsigned)charIndex
{ {
[self drawWithFrame: cellFrame [self drawWithFrame: cellFrame
inView: controlView]; inView: controlView];
} }
- (void)drawWithFrame:(NSRect)cellFrame - (void)drawWithFrame: (NSRect)cellFrame
inView:(NSView *)controlView inView: (NSView *)controlView
characterIndex:(unsigned)charIndex characterIndex: (unsigned)charIndex
layoutManager:(NSLayoutManager *)layoutManager layoutManager: (NSLayoutManager *)layoutManager
{ {
[self drawWithFrame: cellFrame [self drawWithFrame: cellFrame
inView: controlView inView: controlView
@ -68,10 +69,10 @@
return NSZeroPoint; return NSZeroPoint;
} }
- (NSRect)cellFrameForTextContainer:(NSTextContainer *)textContainer - (NSRect)cellFrameForTextContainer: (NSTextContainer *)textContainer
proposedLineFragment:(NSRect)lineFrag proposedLineFragment: (NSRect)lineFrag
glyphPosition:(NSPoint)position glyphPosition: (NSPoint)position
characterIndex:(unsigned)charIndex characterIndex: (unsigned)charIndex
{ {
NSRect aRect; NSRect aRect;
@ -85,18 +86,18 @@
return YES; return YES;
} }
- (BOOL)wantsToTrackMouseForEvent:(NSEvent *)theEvent - (BOOL)wantsToTrackMouseForEvent: (NSEvent *)theEvent
inRect:(NSRect)cellFrame inRect: (NSRect)cellFrame
ofView:(NSView *)controlView ofView: (NSView *)controlView
atCharacterIndex:(unsigned)charIndex atCharacterIndex: (unsigned)charIndex
{ {
return [self wantsToTrackMouse]; return [self wantsToTrackMouse];
} }
- (BOOL)trackMouse:(NSEvent *)theEvent - (BOOL)trackMouse: (NSEvent *)theEvent
inRect:(NSRect)cellFrame inRect: (NSRect)cellFrame
ofView:(NSView *)controlView ofView: (NSView *)controlView
untilMouseUp:(BOOL)flag untilMouseUp: (BOOL)flag
{ {
if ([controlView respondsToSelector: @selector(delegate)]) if ([controlView respondsToSelector: @selector(delegate)])
{ {
@ -108,9 +109,8 @@
{ {
if ([theEvent clickCount] == 2) if ([theEvent clickCount] == 2)
{ {
if (delegate != nil && if (delegate != nil && [delegate respondsToSelector:
[delegate respondsToSelector: @selector(textView:doubleClickedOnCell:inRect:)])
@selector(textView:doubleClickedOnCell:inRect:)])
{ {
[delegate textView: textView [delegate textView: textView
doubleClickedOnCell: self doubleClickedOnCell: self
@ -120,9 +120,8 @@
} }
else else
{ {
if (delegate != nil && if (delegate != nil && [delegate respondsToSelector:
[delegate respondsToSelector: @selector(textView:clickedOnCell:inRect:)])
@selector(textView:clickedOnCell:inRect:)])
{ {
[delegate textView: textView [delegate textView: textView
clickedOnCell: self clickedOnCell: self
@ -133,9 +132,8 @@
} }
else if (type == NSLeftMouseDragged) else if (type == NSLeftMouseDragged)
{ {
if (delegate != nil && if (delegate != nil && [delegate respondsToSelector:
[delegate respondsToSelector: @selector(textView:draggedCell:inRect:event:)])
@selector(textView:draggedCell:inRect:event:)])
{ {
[delegate textView: textView [delegate textView: textView
draggedCell: self draggedCell: self
@ -152,11 +150,11 @@
untilMouseUp: flag]; untilMouseUp: flag];
} }
- (BOOL)trackMouse:(NSEvent *)theEvent - (BOOL)trackMouse: (NSEvent *)theEvent
inRect:(NSRect)cellFrame inRect: (NSRect)cellFrame
ofView:(NSView *)controlView ofView: (NSView *)controlView
atCharacterIndex:(unsigned)charIndex atCharacterIndex: (unsigned)charIndex
untilMouseUp:(BOOL)flag untilMouseUp: (BOOL)flag
{ {
if ([controlView respondsToSelector: @selector(delegate)]) if ([controlView respondsToSelector: @selector(delegate)])
{ {
@ -168,9 +166,8 @@
{ {
if ([theEvent clickCount] == 2) if ([theEvent clickCount] == 2)
{ {
if (delegate != nil && if (delegate != nil && [delegate respondsToSelector:
[delegate respondsToSelector: @selector(textView:doubleClickedOnCell:inRect:atIndex:)])
@selector(textView:doubleClickedOnCell:inRect:atIndex:)])
{ {
[delegate textView: textView [delegate textView: textView
doubleClickedOnCell: self doubleClickedOnCell: self
@ -181,9 +178,8 @@
} }
else else
{ {
if (delegate != nil && if (delegate != nil && [delegate respondsToSelector:
[delegate respondsToSelector: @selector(textView:clickedOnCell:inRect:atIndex:)])
@selector(textView:clickedOnCell:inRect:atIndex:)])
{ {
[delegate textView: textView [delegate textView: textView
clickedOnCell: self clickedOnCell: self
@ -195,9 +191,8 @@
} }
else if (type == NSLeftMouseDragged) else if (type == NSLeftMouseDragged)
{ {
if (delegate != nil && if (delegate != nil && [delegate respondsToSelector:
[delegate respondsToSelector: @selector(textView:draggedCell:inRect:event:atIndex:)])
@selector(textView:draggedCell:inRect:event:atIndex:)])
{ {
[delegate textView: textView [delegate textView: textView
draggedCell: self draggedCell: self
@ -215,7 +210,7 @@
untilMouseUp: flag]; untilMouseUp: flag];
} }
- (void)setAttachment:(NSTextAttachment *)anObject - (void)setAttachment: (NSTextAttachment *)anObject
{ {
NSFileWrapper *fileWrap = [anObject fileWrapper]; NSFileWrapper *fileWrap = [anObject fileWrapper];
@ -252,16 +247,16 @@
return [super cellSize]; return [super cellSize];
} }
- (void)highlight:(BOOL)flag - (void)highlight: (BOOL)flag
withFrame:(NSRect)cellFrame withFrame: (NSRect)cellFrame
inView:(NSView *)controlView inView: (NSView *)controlView
{ {
[super highlight: flag [super highlight: flag
withFrame: cellFrame withFrame: cellFrame
inView: controlView]; inView: controlView];
} }
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView - (void)drawWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
{ {
[super drawWithFrame: cellFrame inView: controlView]; [super drawWithFrame: cellFrame inView: controlView];
} }
@ -283,7 +278,7 @@
[super dealloc]; [super dealloc];
} }
- (id) initWithFileWrapper:(NSFileWrapper *)fileWrapper - (id) initWithFileWrapper: (NSFileWrapper *)fileWrapper
{ {
self = [super init]; self = [super init];
if (self != nil) if (self != nil)
@ -295,11 +290,14 @@
return self; return self;
} }
- (void)setFileWrapper:(NSFileWrapper *)fileWrapper - (void)setFileWrapper: (NSFileWrapper *)fileWrapper
{ {
ASSIGN(_fileWrapper, fileWrapper); ASSIGN(_fileWrapper, fileWrapper);
// Reset the cell, so it shows the new attachment // Reset the cell, so it shows the new attachment
[_cell setAttachment: self]; if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
{
[_cell setAttachment: self];
}
} }
- (NSFileWrapper *)fileWrapper - (NSFileWrapper *)fileWrapper
@ -312,10 +310,13 @@
return _cell; return _cell;
} }
- (void)setAttachmentCell:(id <NSTextAttachmentCell>)cell - (void)setAttachmentCell: (id <NSTextAttachmentCell>)cell
{ {
ASSIGN(_cell, cell); ASSIGN(_cell, cell);
[_cell setAttachment: self]; if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
{
[_cell setAttachment: self];
}
} }
/* /*
@ -346,7 +347,10 @@
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
// Reconnect the cell, so the cell does not have to store the attachment // Reconnect the cell, so the cell does not have to store the attachment
[_cell setAttachment: self]; if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
{
[_cell setAttachment: self];
}
} }
return self; return self;
} }

View file

@ -2680,8 +2680,10 @@ in the main thread.
*/ */
- (void) scrollRect: (NSRect)aRect by: (NSSize)delta - (void) scrollRect: (NSRect)aRect by: (NSSize)delta
{ {
NSPoint destPoint = aRect.origin; NSPoint destPoint;
aRect = NSIntersectionRect(aRect, _bounds); // Don't copy stuff outside.
destPoint = aRect.origin;
destPoint.x -= delta.width; destPoint.x -= delta.width;
destPoint.y -= delta.height; destPoint.y -= delta.height;

View file

@ -11,9 +11,9 @@ GNUSTEP_GUI_LIBTIFF=3.4
# The version number of this release. # The version number of this release.
GNUSTEP_GUI_MAJOR_VERSION=0 GNUSTEP_GUI_MAJOR_VERSION=0
GNUSTEP_GUI_MINOR_VERSION=12 GNUSTEP_GUI_MINOR_VERSION=12
GNUSTEP_GUI_SUBMINOR_VERSION=0 GNUSTEP_GUI_SUBMINOR_VERSION=1
# numeric value should match above # numeric value should match above
VERSION_NUMBER=012.0 VERSION_NUMBER=012.1
GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION} GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION}
VERSION=${GNUSTEP_GUI_VERSION} VERSION=${GNUSTEP_GUI_VERSION}