diff --git a/ChangeLog b/ChangeLog
index 1e4248f76..1f32a476e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,92 @@
+2007-06-07 Sergii Stoian
+
+ * 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
+
+ * 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
+
+ * Source/NSView.m: ([scrollRect:by:]) restrict scrolled rectangle to
+ the bounds of the view.
+
+ * Backported from trunk.
+
+2007-05-23 Fred Kiefer
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Source/NSAnimation.m: removed some C99-isms
+
+ * Backported from trunk.
+
+2007-04-29 Fred Kiefer
+
+ * Source/NSButtonCell.m
+ * Source/NSMenuItemCell.m: Whitespace cleanup.
+
+ * Backported from trunk.
+
+2007-04-27 Fred Kiefer
+
+ * 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
+
+ * 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
* Version 0.12.0
@@ -171,9 +260,9 @@
2007-03-09 Sergii Stoian
- * Source/GSSlideView.m: (- _slideFrom:to:): Calcuate number of
- steps wrt image size.
- * Source/GSDragView.m: (- slideDraggedImageTo:): Ditto.
+ * Source/GSSlideView.m: (- _slideFrom:to:): Calcuate number of
+ steps wrt image size.
+ * Source/GSDragView.m: (- slideDraggedImageTo:): Ditto.
2007-03-08 Fred Kiefer
diff --git a/Documentation/ReleaseNotes.gsdoc b/Documentation/ReleaseNotes.gsdoc
index 3e95ecb17..2a2758789 100644
--- a/Documentation/ReleaseNotes.gsdoc
+++ b/Documentation/ReleaseNotes.gsdoc
@@ -19,6 +19,81 @@
changes and other information that might help developers and users
migrate to using a newer version of the library.
+
Version 0.12.0
diff --git a/Documentation/news.texi b/Documentation/news.texi
index 089240fa5..0771622bc 100644
--- a/Documentation/news.texi
+++ b/Documentation/news.texi
@@ -9,6 +9,10 @@
The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}.
@end ifclear
+@section Noteworthy changes in version @samp{0.12.1}
+
+@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
@@ -29,7 +33,25 @@ NSKeyValueBinding, NSArrayController, NSController.
for Mac OS X compatibility.
@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}
diff --git a/Headers/AppKit/NSAnimation.h b/Headers/AppKit/NSAnimation.h
index 45ba5a506..dda468367 100644
--- a/Headers/AppKit/NSAnimation.h
+++ b/Headers/AppKit/NSAnimation.h
@@ -106,6 +106,9 @@ APPKIT_EXPORT NSString *NSAnimationProgressMark;
*/
@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
float _frameRate; // Wanted frame rate
NSAnimationCurve _curve; // Id of progres->value function
diff --git a/Source/GSDragView.m b/Source/GSDragView.m
index 58bf01e95..baca4a52f 100644
--- a/Source/GSDragView.m
+++ b/Source/GSDragView.m
@@ -208,6 +208,10 @@ static GSDragView *sharedDragView = nil;
return loc;
}
+- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
+{
+ return [[self draggingSource] namesOfPromisedFilesDroppedAtDestination: dropDestination];
+}
- (BOOL) isDragging
{
@@ -306,25 +310,25 @@ static GSDragView *sharedDragView = nil;
NSDragOperation action = [theEvent data2];
if (destExternal)
- {
+ {
- }
+ }
else
{
- if (action != targetMask)
- {
- targetMask = action;
- [self _setCursor];
- }
- }
+ if (action != targetMask)
+ {
+ targetMask = action;
+ [self _setCursor];
+ }
+ }
}
}
- (void) sendExternalEvent: (GSAppKitSubtype)subtype
- action: (NSDragOperation)action
- position: (NSPoint)eventLocation
- timestamp: (NSTimeInterval)time
- toWindow: (int)dWindowNumber
+ action: (NSDragOperation)action
+ position: (NSPoint)eventLocation
+ timestamp: (NSTimeInterval)time
+ 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.
*/
- (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
- windowRef: (int*)mouseWindowRef
+ windowRef: (int*)mouseWindowRef
{
int win;
@@ -363,8 +367,8 @@ static GSDragView *sharedDragView = nil;
- all instance variables pertaining to moving the window are initialized
*/
- (void) _setupWindowFor: (NSImage*)anImage
- mousePosition: (NSPoint)mPoint
- imagePosition: (NSPoint)iPoint
+ mousePosition: (NSPoint)mPoint
+ imagePosition: (NSPoint)iPoint
{
NSSize imageSize;
@@ -678,21 +682,21 @@ static GSDragView *sharedDragView = nil;
[cursorBeforeDrag set];
NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
if (!destExternal)
- {
- [self _sendLocalEvent: GSAppKitDraggingDrop
- action: 0
- position: NSZeroPoint
- timestamp: [theEvent timestamp]
- toWindow: destWindow];
- }
+ {
+ [self _sendLocalEvent: GSAppKitDraggingDrop
+ action: 0
+ position: NSZeroPoint
+ timestamp: [theEvent timestamp]
+ toWindow: destWindow];
+ }
else
- {
- [self sendExternalEvent: GSAppKitDraggingDrop
- action: 0
- position: NSZeroPoint
- timestamp: [theEvent timestamp]
- toWindow: targetWindowRef];
- }
+ {
+ [self sendExternalEvent: GSAppKitDraggingDrop
+ action: 0
+ position: NSZeroPoint
+ timestamp: [theEvent timestamp]
+ toWindow: targetWindowRef];
+ }
deposited = YES;
}
else
@@ -707,7 +711,21 @@ static GSDragView *sharedDragView = nil;
}
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;
@@ -717,8 +735,8 @@ static GSDragView *sharedDragView = nil;
point.y -= offset.height;
point = [[theEvent window] convertBaseToScreen: point];
[dragSource draggedImage: [self draggedImage]
- endedAt: point
- deposited: deposited];
+ endedAt: point
+ deposited: deposited];
}
}
@@ -737,7 +755,7 @@ static GSDragView *sharedDragView = nil;
{
case GSAppKitWindowMoved:
case GSAppKitWindowResized:
- case GSAppKitRegionExposed:
+ case GSAppKitRegionExposed:
/*
* Keep window up-to-date with its current position.
*/
@@ -763,9 +781,9 @@ static GSDragView *sharedDragView = nil;
break;
case GSAppKitWindowFocusIn:
- case GSAppKitWindowFocusOut:
- case GSAppKitWindowLeave:
- case GSAppKitWindowEnter:
+ case GSAppKitWindowFocusOut:
+ case GSAppKitWindowLeave:
+ case GSAppKitWindowEnter:
break;
default:
@@ -780,29 +798,29 @@ static GSDragView *sharedDragView = nil;
case NSLeftMouseDown:
case NSLeftMouseUp:
newPosition = [[theEvent window] convertBaseToScreen:
- [theEvent locationInWindow]];
+ [theEvent locationInWindow]];
break;
case NSFlagsChanged:
if ([self _updateOperationMask: theEvent])
{
- // If flags change, send update to allow
- // destination to take note.
- if (destWindow)
+ // If flags change, send update to allow
+ // destination to take note.
+ if (destWindow)
{
[self _sendLocalEvent: GSAppKitDraggingUpdate
- action: dragMask & operationMask
- position: newPosition
- timestamp: [theEvent timestamp]
- toWindow: destWindow];
- }
- else
- {
+ action: dragMask & operationMask
+ position: newPosition
+ timestamp: [theEvent timestamp]
+ toWindow: destWindow];
+ }
+ else
+ {
[self sendExternalEvent: GSAppKitDraggingUpdate
- action: dragMask & operationMask
- position: newPosition
- timestamp: [theEvent timestamp]
- toWindow: targetWindowRef];
- }
+ action: dragMask & operationMask
+ position: newPosition
+ timestamp: [theEvent timestamp]
+ toWindow: targetWindowRef];
+ }
[self _setCursor];
}
break;
@@ -836,7 +854,7 @@ static GSDragView *sharedDragView = nil;
destWindow = [self windowAcceptingDnDunder: dragPosition
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.
destExternal = (mouseWindowRef != 0) && (destWindow == nil);
@@ -858,18 +876,18 @@ static GSDragView *sharedDragView = nil;
if (oldDestWindow != nil)
{
[self _sendLocalEvent: GSAppKitDraggingExit
- action: dragMask & operationMask
- position: NSZeroPoint
+ action: dragMask & operationMask
+ position: NSZeroPoint
timestamp: dragSequence
- toWindow: oldDestWindow];
+ toWindow: oldDestWindow];
}
else
{
[self sendExternalEvent: GSAppKitDraggingExit
- action: dragMask & operationMask
- position: NSZeroPoint
- timestamp: dragSequence
- toWindow: targetWindowRef];
+ action: dragMask & operationMask
+ position: NSZeroPoint
+ timestamp: dragSequence
+ toWindow: targetWindowRef];
}
}
@@ -891,21 +909,22 @@ static GSDragView *sharedDragView = nil;
// same window, sending update
NSDebugLLog(@"NSDragging", @"sending dnd pos\n");
+ // FIXME: We should only send this when the destination wantsPeriodicDraggingUpdates
if (destWindow != nil)
{
[self _sendLocalEvent: GSAppKitDraggingUpdate
- action: dragMask & operationMask
- position: dragPosition
- timestamp: dragSequence
- toWindow: destWindow];
+ action: dragMask & operationMask
+ position: dragPosition
+ timestamp: dragSequence
+ toWindow: destWindow];
}
else
{
- [self sendExternalEvent: GSAppKitDraggingUpdate
- action: dragMask & operationMask
- position: dragPosition
- timestamp: dragSequence
- toWindow: targetWindowRef];
+ [self sendExternalEvent: GSAppKitDraggingUpdate
+ action: dragMask & operationMask
+ position: dragPosition
+ timestamp: dragSequence
+ toWindow: targetWindowRef];
}
}
else if (mouseWindowRef != 0)
@@ -917,10 +936,10 @@ static GSDragView *sharedDragView = nil;
if (destWindow != nil)
{
[self _sendLocalEvent: GSAppKitDraggingEnter
- action: dragMask
- position: dragPosition
- timestamp: dragSequence
- toWindow: destWindow];
+ action: dragMask
+ position: dragPosition
+ timestamp: dragSequence
+ toWindow: destWindow];
}
else
{
diff --git a/Source/NSAnimation.m b/Source/NSAnimation.m
index c8ea40014..ad0ec18c3 100644
--- a/Source/NSAnimation.m
+++ b/Source/NSAnimation.m
@@ -27,6 +27,7 @@
*/
#include
+#include
#include
#include
#include
@@ -115,9 +116,10 @@ _GSRationalBezierEval (_GSRationalBezierDesc *rb, float t)
static inline float
_GSRationalBezierDerivEval (_GSRationalBezierDesc *rb, float t)
{
+ float h;
if (!rb->areBezierDescComputed)
_GSRationalBezierComputeBezierDesc (rb);
- float h = _GSBezierEval (&(rb->d),t);
+ h = _GSBezierEval (&(rb->d),t);
return ( _GSBezierDerivEval(&(rb->n),t) * h
- _GSBezierEval (&(rb->n),t) * _GSBezierDerivEval(&(rb->d),t) )
/ (h*h);
@@ -176,22 +178,36 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
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 \
- BOOL __gs_isLocked = NO; \
if (_isThreaded) \
{ \
- __gs_isLocked = YES; \
+ NSAssert(__gs_isLocked == NO, NSInternalInconsistencyException); \
NSDebugFLLog(@"NSAnimationLock",\
@"%@ LOCK %@",self,[NSThread currentThread]);\
[_isAnimatingLock lock]; \
- }
+ __gs_isLocked = YES; \
+ }
#define _NSANIMATION_UNLOCK \
if (__gs_isLocked) \
{ \
- __gs_isLocked = YES; \
+ /* NSAssert(__gs_isLocked == YES, NSInternalInconsistencyException); */ \
NSDebugFLLog(@"NSAnimationLock",\
@"%@ UNLOCK %@",self,[NSThread currentThread]);\
+ __gs_isLocked = NO; \
[_isAnimatingLock unlock]; \
}
@@ -212,11 +228,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) addProgressMark: (NSAnimationProgress)progress
{
+ _NSANIMATION_LOCKING_SETUP;
+
if (progress < 0.0) progress = 0.0;
if (progress > 1.0) progress = 1.0;
- _NSANIMATION_LOCK;
+ _NSANIMATION_LOCK;
if (GSIArrayCount(_progressMarks) == 0)
{ // First mark
GSIArrayAddItem (_progressMarks,progress);
@@ -248,6 +266,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSAnimationBlockingMode) animationBlockingMode
{
NSAnimationBlockingMode m;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
m = _blockingMode;
_NSANIMATION_UNLOCK;
@@ -257,6 +277,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSAnimationCurve) animationCurve
{
NSAnimationCurve c;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
c = _curve;
_NSANIMATION_UNLOCK;
@@ -265,6 +287,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) clearStartAnimation
{
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
[[NSNotificationCenter defaultCenter]
removeObserver: self
@@ -277,6 +301,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) clearStopAnimation
{
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
[[NSNotificationCenter defaultCenter]
removeObserver: self
@@ -290,6 +316,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSAnimationProgress) currentProgress
{
NSAnimationProgress p;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
p = _currentProgress;
_NSANIMATION_UNLOCK;
@@ -299,6 +327,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (float) currentValue
{
float value;
+ _NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
@@ -344,6 +373,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (id) delegate
{
id d;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
d = (_delegate == nil)? nil : GS_GC_UNHIDE (_delegate);
_NSANIMATION_UNLOCK;
@@ -353,6 +384,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSTimeInterval) duration
{
NSTimeInterval d;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
d = _duration;
_NSANIMATION_UNLOCK;
@@ -362,6 +395,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (float) frameRate
{
float f;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
f = _frameRate;
_NSANIMATION_UNLOCK;
@@ -410,7 +445,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
(BOOL (*)(id,SEL,NSAnimation*)) NULL;
_isThreaded = NO;
- _isAnimatingLock = [[NSRecursiveLock alloc] init];
+ _isAnimatingLock = [GSLazyRecursiveLock new];
}
return self;
}
@@ -447,6 +482,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (BOOL) isAnimating
{
BOOL f;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
f = (_animator != nil)? [_animator isAnimationRunning] : NO;
_NSANIMATION_UNLOCK;
@@ -456,10 +493,12 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (NSArray*) progressMarks
{
NSNumber **cpmn;
+ unsigned count;
+ _NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
- unsigned count = GSIArrayCount (_progressMarks);
+ count = GSIArrayCount (_progressMarks);
if (!_isCachedProgressMarkNumbersValid)
{
@@ -494,9 +533,12 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) removeProgressMark: (NSAnimationProgress)progress
{
+ unsigned index;
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
- unsigned index = GSIArraySearch (_progressMarks,progress,nsanimation_progressMarkSorter);
+ index = GSIArraySearch (_progressMarks,progress,nsanimation_progressMarkSorter);
if ( index < GSIArrayCount(_progressMarks)
&& progress == GSIArrayItemAtIndex (_progressMarks,index) )
{
@@ -518,6 +560,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setAnimationBlockingMode: (NSAnimationBlockingMode)mode
{
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
_isANewAnimatorNeeded |= (_blockingMode != mode);
_blockingMode = mode;
@@ -526,6 +570,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setAnimationCurve: (NSAnimationCurve)curve
{
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
if (_currentProgress <= 0.0f || _currentProgress >= 1.0f)
@@ -589,6 +635,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
{
BOOL needSearchNextMark = NO;
NSAnimationProgress markedProgress;
+ _NSANIMATION_LOCKING_SETUP;
if (progress < 0.0) progress = 0.0;
if (progress > 1.0) progress = 1.0;
@@ -636,6 +683,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setDelegate: (id)delegate
{
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
_delegate = (delegate == nil)? nil : GS_GC_HIDE (delegate);
_NSANIMATION_UNLOCK;
@@ -643,6 +692,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setDuration: (NSTimeInterval)duration
{
+ _NSANIMATION_LOCKING_SETUP;
+
if (duration<=0.0)
[NSException raise: NSInvalidArgumentException
format: @"%@ Duration must be > 0.0 (passed: %f)",self,duration];
@@ -653,6 +704,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setFrameRate: (float)fps
{
+ _NSANIMATION_LOCKING_SETUP;
+
if (fps<0.0)
[NSException raise: NSInvalidArgumentException
format: @"%@ Framerate must be >= 0.0 (passed: %f)",self,fps];
@@ -670,6 +723,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) setProgressMarks: (NSArray*)marks
{
+ _NSANIMATION_LOCKING_SETUP;
+
_NSANIMATION_LOCK;
GSIArrayEmpty (_progressMarks);
_nextMark = 0;
@@ -685,12 +740,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) startAnimation
{
+ unsigned i;
+
if ([self isAnimating])
return;
NSDebugFLLog (@"NSAnimationStart",@"%@",self);
- unsigned i;
for (i=0; iUserData;
+ nsData = file->UserData;
[nsData appendBytes: buffer length: len];
return len;
}
diff --git a/Source/NSBrowser.m b/Source/NSBrowser.m
index 012462a2f..5d7b3b86c 100644
--- a/Source/NSBrowser.m
+++ b/Source/NSBrowser.m
@@ -207,7 +207,8 @@ static NSTextFieldCell *titleCell;
}
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
- [self drawInteriorWithFrame: cellFrame inView: controlView];
+ [self drawInteriorWithFrame: NSInsetRect(cellFrame, 1.0, 1.0)
+ inView: controlView];
}
@end
diff --git a/Source/NSButtonCell.m b/Source/NSButtonCell.m
index 1599cd35e..3a6c99920 100644
--- a/Source/NSButtonCell.m
+++ b/Source/NSButtonCell.m
@@ -5,7 +5,7 @@
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Author: Scott Christley
- Ovidiu Predescu
+ Ovidiu Predescu
Date: 1996
Author: Felipe A. Rodriguez
Date: August 1998
@@ -213,31 +213,31 @@ typedef struct _GSButtonCellFlags
{
case NSPushInCell:
if (_highlightsByMask & NSPushInCellMask)
- value = 1;
+ value = 1;
break;
case NSChangeGrayCell:
if (_showAltStateMask & NSChangeGrayCellMask)
- value = 1;
+ value = 1;
break;
case NSCellLightsByGray:
if (_highlightsByMask & NSChangeGrayCellMask)
- value = 1;
+ value = 1;
break;
case NSChangeBackgroundCell:
if (_showAltStateMask & NSChangeBackgroundCellMask)
- value = 1;
+ value = 1;
break;
case NSCellLightsByBackground:
if (_highlightsByMask & NSChangeBackgroundCellMask)
- value = 1;
+ value = 1;
break;
case NSCellChangesContents:
if (_showAltStateMask & NSContentsCellMask)
- value = 1;
+ value = 1;
break;
case NSCellLightsByContents:
if (_highlightsByMask & NSContentsCellMask)
- value = 1;
+ value = 1;
break;
default:
value = [super cellAttribute: aParameter];
@@ -253,45 +253,45 @@ typedef struct _GSButtonCellFlags
{
case NSPushInCell:
if (value)
- _highlightsByMask |= NSPushInCellMask;
+ _highlightsByMask |= NSPushInCellMask;
else
- _highlightsByMask &= ~NSPushInCellMask;
+ _highlightsByMask &= ~NSPushInCellMask;
break;
case NSChangeGrayCell:
if (value)
- _showAltStateMask |= NSChangeGrayCellMask;
+ _showAltStateMask |= NSChangeGrayCellMask;
else
- _showAltStateMask &= ~NSChangeGrayCellMask;
+ _showAltStateMask &= ~NSChangeGrayCellMask;
break;
case NSChangeBackgroundCell:
if (value)
- _showAltStateMask |= NSChangeBackgroundCellMask;
+ _showAltStateMask |= NSChangeBackgroundCellMask;
else
- _showAltStateMask &= ~NSChangeBackgroundCellMask;
+ _showAltStateMask &= ~NSChangeBackgroundCellMask;
break;
case NSCellChangesContents:
if (value)
- _showAltStateMask |= NSContentsCellMask;
+ _showAltStateMask |= NSContentsCellMask;
else
- _showAltStateMask &= ~NSContentsCellMask;
+ _showAltStateMask &= ~NSContentsCellMask;
break;
case NSCellLightsByGray:
if (value)
- _highlightsByMask |= NSChangeGrayCellMask;
+ _highlightsByMask |= NSChangeGrayCellMask;
else
- _highlightsByMask &= ~NSChangeGrayCellMask;
+ _highlightsByMask &= ~NSChangeGrayCellMask;
break;
case NSCellLightsByBackground:
if (value)
- _highlightsByMask |= NSChangeBackgroundCellMask;
+ _highlightsByMask |= NSChangeBackgroundCellMask;
else
- _highlightsByMask &= ~NSChangeBackgroundCellMask;
+ _highlightsByMask &= ~NSChangeBackgroundCellMask;
break;
case NSCellLightsByContents:
if (value)
- _highlightsByMask |= NSContentsCellMask;
+ _highlightsByMask |= NSContentsCellMask;
else
- _highlightsByMask &= ~NSContentsCellMask;
+ _highlightsByMask &= ~NSContentsCellMask;
break;
default:
[super setCellAttribute: aParameter to: value];
@@ -313,7 +313,7 @@ typedef struct _GSButtonCellFlags
((size = [fontObject pointSize]) != [_keyEquivalentFont pointSize]))
{
[self setKeyEquivalentFont: [_keyEquivalentFont fontName]
- size: size];
+ size: size];
}
}
@@ -336,9 +336,9 @@ typedef struct _GSButtonCellFlags
if (_control_view)
{
if ([_control_view isKindOfClass: [NSControl class]])
- {
- [(NSControl*)_control_view updateCell: self];
- }
+ {
+ [(NSControl*)_control_view updateCell: self];
+ }
}
}
@@ -350,7 +350,7 @@ typedef struct _GSButtonCellFlags
dict = [self _nonAutoreleasedTypingAttributes];
attrStr = [[NSAttributedString alloc] initWithString: _altContents
- attributes: dict];
+ attributes: dict];
RELEASE(dict);
return AUTORELEASE(attrStr);
@@ -404,7 +404,7 @@ typedef struct _GSButtonCellFlags
unsigned int location = [aString rangeOfString: @"&"].location;
[self setAlternateTitle: [aString stringByReplacingString: @"&"
- withString: @""]];
+ withString: @""]];
// TODO: We should underline this character
[self setAlternateMnemonicLocation: location];
}
@@ -431,7 +431,7 @@ typedef struct _GSButtonCellFlags
if (anImage)
{
NSAssert ([anImage isKindOfClass: [NSImage class]],
- NSInvalidArgumentException);
+ NSInvalidArgumentException);
}
if (_cell.image_position == NSNoImage)
@@ -692,57 +692,57 @@ typedef struct _GSButtonCellFlags
switch (buttonType)
{
case NSMomentaryLightButton:
- [self setHighlightsBy: NSChangeBackgroundCellMask];
- [self setShowsStateBy: NSNoCellMask];
- [self setImageDimsWhenDisabled: YES];
- break;
+ [self setHighlightsBy: NSChangeBackgroundCellMask];
+ [self setShowsStateBy: NSNoCellMask];
+ [self setImageDimsWhenDisabled: YES];
+ break;
case NSMomentaryPushInButton:
- [self setHighlightsBy: NSPushInCellMask | NSChangeGrayCellMask];
- [self setShowsStateBy: NSNoCellMask];
- [self setImageDimsWhenDisabled: YES];
- break;
+ [self setHighlightsBy: NSPushInCellMask | NSChangeGrayCellMask];
+ [self setShowsStateBy: NSNoCellMask];
+ [self setImageDimsWhenDisabled: YES];
+ break;
case NSMomentaryChangeButton:
- [self setHighlightsBy: NSContentsCellMask];
- [self setShowsStateBy: NSNoCellMask];
- [self setImageDimsWhenDisabled: YES];
- break;
+ [self setHighlightsBy: NSContentsCellMask];
+ [self setShowsStateBy: NSNoCellMask];
+ [self setImageDimsWhenDisabled: YES];
+ break;
case NSPushOnPushOffButton:
- [self setHighlightsBy: NSPushInCellMask | NSChangeGrayCellMask];
- [self setShowsStateBy: NSChangeBackgroundCellMask];
- [self setImageDimsWhenDisabled: YES];
- break;
+ [self setHighlightsBy: NSPushInCellMask | NSChangeGrayCellMask];
+ [self setShowsStateBy: NSChangeBackgroundCellMask];
+ [self setImageDimsWhenDisabled: YES];
+ break;
case NSOnOffButton:
- [self setHighlightsBy: NSChangeBackgroundCellMask];
- [self setShowsStateBy: NSChangeBackgroundCellMask];
- [self setImageDimsWhenDisabled: YES];
- break;
+ [self setHighlightsBy: NSChangeBackgroundCellMask];
+ [self setShowsStateBy: NSChangeBackgroundCellMask];
+ [self setImageDimsWhenDisabled: YES];
+ break;
case NSToggleButton:
- [self setHighlightsBy: NSPushInCellMask | NSContentsCellMask];
- [self setShowsStateBy: NSContentsCellMask];
- [self setImageDimsWhenDisabled: YES];
- break;
+ [self setHighlightsBy: NSPushInCellMask | NSContentsCellMask];
+ [self setShowsStateBy: NSContentsCellMask];
+ [self setImageDimsWhenDisabled: YES];
+ break;
case NSSwitchButton:
- [self setHighlightsBy: NSContentsCellMask];
- [self setShowsStateBy: NSContentsCellMask];
- [self setImage: [NSImage imageNamed: @"NSSwitch"]];
- [self setAlternateImage: [NSImage imageNamed: @"NSHighlightedSwitch"]];
- [self setImagePosition: NSImageLeft];
- [self setAlignment: NSLeftTextAlignment];
- [self setBordered: NO];
- [self setBezeled: NO];
- [self setImageDimsWhenDisabled: NO];
- break;
+ [self setHighlightsBy: NSContentsCellMask];
+ [self setShowsStateBy: NSContentsCellMask];
+ [self setImage: [NSImage imageNamed: @"NSSwitch"]];
+ [self setAlternateImage: [NSImage imageNamed: @"NSHighlightedSwitch"]];
+ [self setImagePosition: NSImageLeft];
+ [self setAlignment: NSLeftTextAlignment];
+ [self setBordered: NO];
+ [self setBezeled: NO];
+ [self setImageDimsWhenDisabled: NO];
+ break;
case NSRadioButton:
- [self setHighlightsBy: NSContentsCellMask];
- [self setShowsStateBy: NSContentsCellMask];
- [self setImage: [NSImage imageNamed: @"NSRadioButton"]];
- [self setAlternateImage: [NSImage imageNamed: @"NSHighlightedRadioButton"]];
- [self setImagePosition: NSImageLeft];
- [self setAlignment: NSLeftTextAlignment];
- [self setBordered: NO];
- [self setBezeled: NO];
- [self setImageDimsWhenDisabled: NO];
- break;
+ [self setHighlightsBy: NSContentsCellMask];
+ [self setShowsStateBy: NSContentsCellMask];
+ [self setImage: [NSImage imageNamed: @"NSRadioButton"]];
+ [self setAlternateImage: [NSImage imageNamed: @"NSHighlightedRadioButton"]];
+ [self setImagePosition: NSImageLeft];
+ [self setAlignment: NSLeftTextAlignment];
+ [self setBordered: NO];
+ [self setBezeled: NO];
+ [self setImageDimsWhenDisabled: NO];
+ break;
}
}
@@ -800,15 +800,15 @@ typedef struct _GSButtonCellFlags
- (id) objectValue
{
if (_cell.state == NSOffState)
- {
+ {
return [NSNumber numberWithBool: NO];
}
else if (_cell.state == NSOnState)
- {
+ {
return [NSNumber numberWithBool: YES];
}
else // NSMixedState
- {
+ {
return [NSNumber numberWithInt: -1];
}
}
@@ -838,8 +838,8 @@ typedef struct _GSButtonCellFlags
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
{
- unsigned mask;
- GSThemeControlState buttonState = GSThemeNormalState;
+ unsigned mask;
+ GSThemeControlState buttonState = GSThemeNormalState;
// set the mask
if (_cell.is_highlighted)
@@ -847,8 +847,8 @@ typedef struct _GSButtonCellFlags
mask = _highlightsByMask;
if (_cell.state)
{
- mask &= ~_showAltStateMask;
- }
+ mask &= ~_showAltStateMask;
+ }
}
else if (_cell.state)
mask = _showAltStateMask;
@@ -871,15 +871,15 @@ typedef struct _GSButtonCellFlags
}
[[GSTheme theme] drawButton: cellFrame
- in: self
- view: controlView
- style: _bezel_style
- state: buttonState];
+ in: self
+ view: controlView
+ style: _bezel_style
+ state: buttonState];
}
- (void) drawImage: (NSImage*)anImage
- withFrame: (NSRect)aRect
- inView: (NSView*)controlView
+ withFrame: (NSRect)aRect
+ inView: (NSView*)controlView
{
// Draw image
if (anImage != nil)
@@ -897,27 +897,27 @@ typedef struct _GSButtonCellFlags
*/
if ([controlView isFlipped])
{
- position.y += size.height;
- }
+ position.y += size.height;
+ }
if (_cell.is_disabled && _image_dims_when_disabled)
{
- [anImage dissolveToPoint: position fraction: 0.5];
- }
+ [anImage dissolveToPoint: position fraction: 0.5];
+ }
else
{
- [anImage compositeToPoint: position
- operation: NSCompositeSourceOver];
- }
+ [anImage compositeToPoint: position
+ operation: NSCompositeSourceOver];
+ }
}
}
- (void) drawTitle: (NSAttributedString*)titleToDisplay
- withFrame: (NSRect)frame
- inView: (NSView*)control
+ withFrame: (NSRect)frame
+ inView: (NSView*)control
{
[self _drawAttributedText: titleToDisplay
- inFrame: frame];
+ inFrame: frame];
}
// Private helper method overridden in subclasses
@@ -949,35 +949,35 @@ typedef struct _GSButtonCellFlags
switch (_gradient_type)
{
case NSGradientNone:
- return;
- break;
+ return;
+ break;
case NSGradientConcaveWeak:
- [gray getHue: &h saturation: &s brightness: &v alpha: &a];
- start_white = [lightGray brightnessComponent];
- end_white = [gray brightnessComponent];
- break;
-
+ [gray getHue: &h saturation: &s brightness: &v alpha: &a];
+ start_white = [lightGray brightnessComponent];
+ end_white = [gray brightnessComponent];
+ break;
+
case NSGradientConvexWeak:
- [darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
- start_white = [gray brightnessComponent];
- end_white = [lightGray brightnessComponent];
- break;
-
+ [darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
+ start_white = [gray brightnessComponent];
+ end_white = [lightGray brightnessComponent];
+ break;
+
case NSGradientConcaveStrong:
- [lightGray getHue: &h saturation: &s brightness: &v alpha: &a];
- start_white = [lightGray brightnessComponent];
- end_white = [darkGray brightnessComponent];
- break;
-
+ [lightGray getHue: &h saturation: &s brightness: &v alpha: &a];
+ start_white = [lightGray brightnessComponent];
+ end_white = [darkGray brightnessComponent];
+ break;
+
case NSGradientConvexStrong:
- [darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
- start_white = [darkGray brightnessComponent];
- end_white = [lightGray brightnessComponent];
- break;
+ [darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
+ start_white = [darkGray brightnessComponent];
+ end_white = [lightGray brightnessComponent];
+ break;
default:
- break;
+ break;
}
white = start_white;
@@ -994,51 +994,51 @@ typedef struct _GSButtonCellFlags
while (p1.y > cellFrame.origin.y)
{
[[NSColor
- colorWithDeviceHue: h saturation: s brightness: white alpha: 1.0] set];
+ colorWithDeviceHue: h saturation: s brightness: white alpha: 1.0] set];
[NSBezierPath strokeLineFromPoint: p1 toPoint: p2];
if (start_white > end_white)
- white -= white_step;
+ white -= white_step;
else
- white += white_step;
+ white += white_step;
p1.y -= 1.0;
if (p2.x < (cellFrame.size.width + cellFrame.origin.x))
- p2.x += 1.0;
+ p2.x += 1.0;
else
- p2.y -= 1.0;
+ p2.y -= 1.0;
}
// Move by X
while (p1.x < (cellFrame.size.width + cellFrame.origin.x))
{
[[NSColor
- colorWithDeviceHue: h saturation: s brightness: white alpha: 1.0] set];
+ colorWithDeviceHue: h saturation: s brightness: white alpha: 1.0] set];
[NSBezierPath strokeLineFromPoint: p1 toPoint: p2];
if (start_white > end_white)
- white -= white_step;
+ white -= white_step;
else
- white += white_step;
+ white += white_step;
p1.x += 1.0;
if (p2.x >= (cellFrame.size.width + cellFrame.origin.x))
- p2.y -= 1.0;
+ p2.y -= 1.0;
else
- p2.x += 1.0;
+ p2.x += 1.0;
}
}
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
- unsigned mask;
- NSImage *imageToDisplay;
- NSRect imageRect;
- NSAttributedString *titleToDisplay;
- NSRect titleRect;
- NSSize imageSize = {0, 0};
- NSSize titleSize = {0, 0};
- BOOL flippedView = [controlView isFlipped];
+ unsigned mask;
+ NSImage *imageToDisplay;
+ NSRect imageRect;
+ NSAttributedString *titleToDisplay;
+ NSRect titleRect;
+ NSSize imageSize = {0, 0};
+ NSSize titleSize = {0, 0};
+ BOOL flippedView = [controlView isFlipped];
NSCellImagePosition ipos = _cell.image_position;
// transparent buttons never draw
@@ -1054,7 +1054,7 @@ typedef struct _GSButtonCellFlags
mask = _highlightsByMask;
if (_cell.state)
- mask &= ~_showAltStateMask;
+ mask &= ~_showAltStateMask;
}
else if (_cell.state)
mask = _showAltStateMask;
@@ -1073,13 +1073,13 @@ typedef struct _GSButtonCellFlags
imageToDisplay = _altImage;
if (!imageToDisplay)
{
- imageToDisplay = _cell_image;
- }
+ imageToDisplay = _cell_image;
+ }
titleToDisplay = [self attributedAlternateTitle];
if (titleToDisplay == nil || [titleToDisplay length] == 0)
{
- titleToDisplay = [self attributedTitle];
- }
+ titleToDisplay = [self attributedTitle];
+ }
}
else
{
@@ -1100,13 +1100,13 @@ typedef struct _GSButtonCellFlags
if (flippedView == YES)
{
if (ipos == NSImageAbove)
- {
- ipos = NSImageBelow;
- }
+ {
+ ipos = NSImageBelow;
+ }
else if (ipos == NSImageBelow)
- {
- ipos = NSImageAbove;
- }
+ {
+ ipos = NSImageAbove;
+ }
}
/*
@@ -1125,137 +1125,137 @@ typedef struct _GSButtonCellFlags
{
default:
case NSNoImage:
- imageToDisplay = nil;
- titleRect = cellFrame;
- imageRect = NSZeroRect;
- if (titleSize.width + 6 <= titleRect.size.width)
- {
- titleRect.origin.x += 3;
- titleRect.size.width -= 6;
- }
- break;
+ imageToDisplay = nil;
+ titleRect = cellFrame;
+ imageRect = NSZeroRect;
+ if (titleSize.width + 6 <= titleRect.size.width)
+ {
+ titleRect.origin.x += 3;
+ titleRect.size.width -= 6;
+ }
+ break;
case NSImageOnly:
- titleToDisplay = nil;
- imageRect = cellFrame;
- titleRect = NSZeroRect;
- break;
+ titleToDisplay = nil;
+ imageRect = cellFrame;
+ titleRect = NSZeroRect;
+ break;
case NSImageLeft:
- imageRect.origin = cellFrame.origin;
- imageRect.size.width = imageSize.width;
- imageRect.size.height = cellFrame.size.height;
- if (_cell.is_bordered || _cell.is_bezeled)
- {
- imageRect.origin.x += 3;
- }
- titleRect = imageRect;
- titleRect.origin.x += imageSize.width + GSCellTextImageXDist;
- titleRect.size.width = NSMaxX(cellFrame) - titleRect.origin.x;
- if (titleSize.width + 3 <= titleRect.size.width)
- {
- titleRect.size.width -= 3;
- }
- break;
+ imageRect.origin = cellFrame.origin;
+ imageRect.size.width = imageSize.width;
+ imageRect.size.height = cellFrame.size.height;
+ if (_cell.is_bordered || _cell.is_bezeled)
+ {
+ imageRect.origin.x += 3;
+ }
+ titleRect = imageRect;
+ titleRect.origin.x += imageSize.width + GSCellTextImageXDist;
+ titleRect.size.width = NSMaxX(cellFrame) - titleRect.origin.x;
+ if (titleSize.width + 3 <= titleRect.size.width)
+ {
+ titleRect.size.width -= 3;
+ }
+ break;
case NSImageRight:
- imageRect.origin.x = NSMaxX(cellFrame) - imageSize.width;
- imageRect.origin.y = cellFrame.origin.y;
- imageRect.size.width = imageSize.width;
- imageRect.size.height = cellFrame.size.height;
- if (_cell.is_bordered || _cell.is_bezeled)
- {
- imageRect.origin.x -= 3;
- }
- titleRect.origin = cellFrame.origin;
- titleRect.size.width = imageRect.origin.x - titleRect.origin.x
- - GSCellTextImageXDist;
- titleRect.size.height = cellFrame.size.height;
- if (titleSize.width + 3 <= titleRect.size.width)
- {
- titleRect.origin.x += 3;
- titleRect.size.width -= 3;
- }
- break;
+ imageRect.origin.x = NSMaxX(cellFrame) - imageSize.width;
+ imageRect.origin.y = cellFrame.origin.y;
+ imageRect.size.width = imageSize.width;
+ imageRect.size.height = cellFrame.size.height;
+ if (_cell.is_bordered || _cell.is_bezeled)
+ {
+ imageRect.origin.x -= 3;
+ }
+ titleRect.origin = cellFrame.origin;
+ titleRect.size.width = imageRect.origin.x - titleRect.origin.x
+ - GSCellTextImageXDist;
+ titleRect.size.height = cellFrame.size.height;
+ if (titleSize.width + 3 <= titleRect.size.width)
+ {
+ titleRect.origin.x += 3;
+ titleRect.size.width -= 3;
+ }
+ break;
case NSImageAbove:
- /*
+ /*
* In this case, imageRect is all the space we can allocate
- * above the text.
- * The drawing code below will then center the image in imageRect.
- */
- titleRect.origin = cellFrame.origin;
- titleRect.size.width = cellFrame.size.width;
- titleRect.size.height = titleSize.height;
- if (_cell.is_bordered || _cell.is_bezeled)
- {
- titleRect.origin.y += 3;
- }
+ * above the text.
+ * The drawing code below will then center the image in imageRect.
+ */
+ titleRect.origin = cellFrame.origin;
+ titleRect.size.width = cellFrame.size.width;
+ titleRect.size.height = titleSize.height;
+ if (_cell.is_bordered || _cell.is_bezeled)
+ {
+ titleRect.origin.y += 3;
+ }
- imageRect.origin.x = cellFrame.origin.x;
- imageRect.origin.y = NSMaxY(titleRect) + GSCellTextImageYDist;
- imageRect.size.width = cellFrame.size.width;
- imageRect.size.height = NSMaxY(cellFrame) - imageRect.origin.y;
+ imageRect.origin.x = cellFrame.origin.x;
+ imageRect.origin.y = NSMaxY(titleRect) + GSCellTextImageYDist;
+ imageRect.size.width = cellFrame.size.width;
+ imageRect.size.height = NSMaxY(cellFrame) - imageRect.origin.y;
- if (_cell.is_bordered || _cell.is_bezeled)
- {
- imageRect.size.height -= 3;
- }
- if (titleSize.width + 6 <= titleRect.size.width)
- {
- titleRect.origin.x += 3;
- titleRect.size.width -= 6;
- }
- break;
+ if (_cell.is_bordered || _cell.is_bezeled)
+ {
+ imageRect.size.height -= 3;
+ }
+ if (titleSize.width + 6 <= titleRect.size.width)
+ {
+ titleRect.origin.x += 3;
+ titleRect.size.width -= 6;
+ }
+ break;
case NSImageBelow:
- /*
- * In this case, imageRect is all the space we can allocate
- * below the text.
- * The drawing code below will then center the image in imageRect.
- */
- titleRect.origin.x = cellFrame.origin.x;
- titleRect.origin.y = NSMaxY(cellFrame) - titleSize.height;
- titleRect.size.width = cellFrame.size.width;
- titleRect.size.height = titleSize.height;
- if (_cell.is_bordered || _cell.is_bezeled)
- {
- titleRect.origin.y -= 3;
- }
+ /*
+ * In this case, imageRect is all the space we can allocate
+ * below the text.
+ * The drawing code below will then center the image in imageRect.
+ */
+ titleRect.origin.x = cellFrame.origin.x;
+ titleRect.origin.y = NSMaxY(cellFrame) - titleSize.height;
+ titleRect.size.width = cellFrame.size.width;
+ titleRect.size.height = titleSize.height;
+ if (_cell.is_bordered || _cell.is_bezeled)
+ {
+ titleRect.origin.y -= 3;
+ }
- imageRect.origin.x = cellFrame.origin.x;
- imageRect.origin.y = cellFrame.origin.y;
- imageRect.size.width = cellFrame.size.width;
- imageRect.size.height
- = titleRect.origin.y - GSCellTextImageYDist - imageRect.origin.y;
+ imageRect.origin.x = cellFrame.origin.x;
+ imageRect.origin.y = cellFrame.origin.y;
+ imageRect.size.width = cellFrame.size.width;
+ imageRect.size.height
+ = titleRect.origin.y - GSCellTextImageYDist - imageRect.origin.y;
- if (_cell.is_bordered || _cell.is_bezeled)
- {
- imageRect.origin.y += 3;
- imageRect.size.height -= 3;
- }
- if (titleSize.width + 6 <= titleRect.size.width)
- {
- titleRect.origin.x += 3;
- titleRect.size.width -= 6;
- }
- break;
+ if (_cell.is_bordered || _cell.is_bezeled)
+ {
+ imageRect.origin.y += 3;
+ imageRect.size.height -= 3;
+ }
+ if (titleSize.width + 6 <= titleRect.size.width)
+ {
+ titleRect.origin.x += 3;
+ titleRect.size.width -= 6;
+ }
+ break;
case NSImageOverlaps:
- imageRect = cellFrame;
- titleRect = cellFrame;
- if (titleSize.width + 6 <= titleRect.size.width)
- {
- titleRect.origin.x += 3;
- titleRect.size.width -= 6;
- }
- break;
+ imageRect = cellFrame;
+ titleRect = cellFrame;
+ if (titleSize.width + 6 <= titleRect.size.width)
+ {
+ titleRect.origin.x += 3;
+ titleRect.size.width -= 6;
+ }
+ break;
}
// Draw gradient
if (!_cell.is_highlighted && _gradient_type != NSGradientNone)
{
- // FIXME: I think this method is wrong.
+ // FIXME: I think this method is wrong.
[self drawGradientWithFrame: cellFrame inView: controlView];
}
@@ -1263,8 +1263,8 @@ typedef struct _GSButtonCellFlags
if (imageToDisplay != nil)
{
[self drawImage: imageToDisplay
- withFrame: imageRect
- inView: controlView];
+ withFrame: imageRect
+ inView: controlView];
}
// Draw title
@@ -1278,11 +1278,11 @@ typedef struct _GSButtonCellFlags
{
NSSize s;
NSSize borderSize;
- unsigned mask;
- NSImage *imageToDisplay;
- NSAttributedString *titleToDisplay;
- NSSize imageSize = NSZeroSize;
- NSSize titleSize = NSZeroSize;
+ unsigned mask;
+ NSImage *imageToDisplay;
+ NSAttributedString *titleToDisplay;
+ NSSize imageSize = NSZeroSize;
+ NSSize titleSize = NSZeroSize;
/* The size calculations here must be kept in sync with
-drawInteriorWithFrame. */
@@ -1292,7 +1292,7 @@ typedef struct _GSButtonCellFlags
mask = _highlightsByMask;
if (_cell.state)
- mask &= ~_showAltStateMask;
+ mask &= ~_showAltStateMask;
}
else if (_cell.state)
mask = _showAltStateMask;
@@ -1303,14 +1303,14 @@ typedef struct _GSButtonCellFlags
{
imageToDisplay = _altImage;
if (!imageToDisplay)
- {
- imageToDisplay = _cell_image;
- }
+ {
+ imageToDisplay = _cell_image;
+ }
titleToDisplay = [self attributedAlternateTitle];
if (titleToDisplay == nil || [titleToDisplay length] == 0)
{
- titleToDisplay = [self attributedTitle];
- }
+ titleToDisplay = [self attributedTitle];
+ }
}
else
{
@@ -1332,53 +1332,53 @@ typedef struct _GSButtonCellFlags
{
default:
case NSNoImage:
- s = titleSize;
- break;
-
+ s = titleSize;
+ break;
+
case NSImageOnly:
- s = imageSize;
- break;
-
+ s = imageSize;
+ break;
+
case NSImageLeft:
case NSImageRight:
- s.width = imageSize.width + titleSize.width + GSCellTextImageXDist;
- s.height = MAX(imageSize.height, titleSize.height);
- break;
-
+ s.width = imageSize.width + titleSize.width + GSCellTextImageXDist;
+ s.height = MAX(imageSize.height, titleSize.height);
+ break;
+
case NSImageBelow:
case NSImageAbove:
- s.width = MAX(imageSize.width, titleSize.width);
- s.height = imageSize.height + titleSize.height + GSCellTextImageYDist;
- break;
-
+ s.width = MAX(imageSize.width, titleSize.width);
+ s.height = imageSize.height + titleSize.height + GSCellTextImageYDist;
+ break;
+
case NSImageOverlaps:
- s.width = MAX(imageSize.width, titleSize.width);
- s.height = MAX(imageSize.height, titleSize.height);
- break;
+ s.width = MAX(imageSize.width, titleSize.width);
+ s.height = MAX(imageSize.height, titleSize.height);
+ break;
}
// Get border size
if (_cell.is_bordered)
{
- GSThemeControlState buttonState = GSThemeNormalState;
+ GSThemeControlState buttonState = GSThemeNormalState;
/* Determine the background color.
- We draw when there is a border or when highlightsByMask
- is NSChangeBackgroundCellMask or NSChangeGrayCellMask,
- as required by our nextstep-like look and feel. */
+ We draw when there is a border or when highlightsByMask
+ is NSChangeBackgroundCellMask or NSChangeGrayCellMask,
+ as required by our nextstep-like look and feel. */
if (mask & (NSChangeGrayCellMask | NSChangeBackgroundCellMask))
{
- buttonState = GSThemeHighlightedState;
- }
+ buttonState = GSThemeHighlightedState;
+ }
/* Pushed in buttons contents are displaced to the bottom right 1px. */
if (mask & NSPushInCellMask)
{
- buttonState = GSThemeSelectedState;
- }
+ buttonState = GSThemeSelectedState;
+ }
borderSize = [[GSTheme theme] buttonBorderForStyle: _bezel_style
- state: buttonState];
+ state: buttonState];
}
else
borderSize = NSZeroSize;
@@ -1395,46 +1395,46 @@ typedef struct _GSButtonCellFlags
if (_cell.is_bordered)
{
NSSize borderSize;
- unsigned mask;
+ unsigned mask;
GSThemeControlState buttonState = GSThemeNormalState;
NSRect interiorFrame;
if (_cell.is_highlighted)
{
- mask = _highlightsByMask;
+ mask = _highlightsByMask;
- if (_cell.state)
- mask &= ~_showAltStateMask;
- }
+ if (_cell.state)
+ mask &= ~_showAltStateMask;
+ }
else if (_cell.state)
- mask = _showAltStateMask;
+ mask = _showAltStateMask;
else
- mask = NSNoCellMask;
+ mask = NSNoCellMask;
/* Determine the background color.
- We draw when there is a border or when highlightsByMask
- is NSChangeBackgroundCellMask or NSChangeGrayCellMask,
- as required by our nextstep-like look and feel. */
+ We draw when there is a border or when highlightsByMask
+ is NSChangeBackgroundCellMask or NSChangeGrayCellMask,
+ as required by our nextstep-like look and feel. */
if (mask & (NSChangeGrayCellMask | NSChangeBackgroundCellMask))
{
- buttonState = GSThemeHighlightedState;
- }
+ buttonState = GSThemeHighlightedState;
+ }
if (mask & NSPushInCellMask)
{
- buttonState = GSThemeSelectedState;
- }
+ buttonState = GSThemeSelectedState;
+ }
borderSize = [[GSTheme theme] buttonBorderForStyle: _bezel_style
- state: buttonState];
+ state: buttonState];
interiorFrame = NSInsetRect(theRect, borderSize.width, borderSize.height);
/* Pushed in buttons contents are displaced to the bottom right 1px. */
if (mask & NSPushInCellMask)
- {
- interiorFrame
- = NSOffsetRect(interiorFrame, 1.0, [_control_view isFlipped] ? 1.0 : -1.0);
- }
+ {
+ interiorFrame
+ = NSOffsetRect(interiorFrame, 1.0, [_control_view isFlipped] ? 1.0 : -1.0);
+ }
return interiorFrame;
}
else
@@ -1487,7 +1487,7 @@ typedef struct _GSButtonCellFlags
if ([otherCell isKindOfClass: [NSButtonCell class]] == NO)
{
[NSException raise: NSBadComparisonException
- format: @"NSButtonCell comparison with non-NSButtonCell"];
+ format: @"NSButtonCell comparison with non-NSButtonCell"];
}
return [super compare: otherCell];
}
@@ -1497,7 +1497,7 @@ typedef struct _GSButtonCellFlags
*/
- (id) copyWithZone: (NSZone*)zone
{
- NSButtonCell *c = [super copyWithZone: zone];
+ NSButtonCell *c = [super copyWithZone: zone];
c->_altContents = [_altContents copyWithZone: zone];
TEST_RETAIN(_altImage);
@@ -1526,20 +1526,20 @@ typedef struct _GSButtonCellFlags
NSButtonImageSource *bi = nil;
if ([self keyEquivalent] != nil)
- {
- [aCoder encodeObject: [self keyEquivalent] forKey: @"NSKeyEquivalent"];
- }
+ {
+ [aCoder encodeObject: [self keyEquivalent] forKey: @"NSKeyEquivalent"];
+ }
if ([self image] != nil)
- {
- [aCoder encodeObject: [self image] forKey: @"NSNormalImage"];
- }
+ {
+ [aCoder encodeObject: [self image] forKey: @"NSNormalImage"];
+ }
if ([self alternateTitle] != nil)
- {
- [aCoder encodeObject: [self alternateTitle] forKey: @"NSAlternateContents"];
- }
+ {
+ [aCoder encodeObject: [self alternateTitle] forKey: @"NSAlternateContents"];
+ }
buttonCellFlags.useButtonImageSource = (([NSImage imageNamed: @"NSSwitch"] == image) ||
- ([NSImage imageNamed: @"NSRadioButton"] == image));
+ ([NSImage imageNamed: @"NSRadioButton"] == image));
buttonCellFlags.isTransparent = [self isTransparent];
buttonCellFlags.isBordered = [self isBordered];
buttonCellFlags.isImageAndText = (image != nil);
@@ -1573,29 +1573,29 @@ typedef struct _GSButtonCellFlags
// alternate image encoding...
if (image != nil)
- {
- if ([image isKindOfClass: [NSImage class]] && buttonCellFlags.useButtonImageSource)
- {
- if ([NSImage imageNamed: @"NSSwitch"] == image)
- {
- bi = [[NSButtonImageSource alloc] initWithImageNamed: @"NSHighlightedSwitch"];
- }
- else if ([NSImage imageNamed: @"NSRadioButton"] == image)
- {
- bi = [[NSButtonImageSource alloc] initWithImageNamed: @"NSHighlightedRadioButton"];
- }
- }
- }
+ {
+ if ([image isKindOfClass: [NSImage class]] && buttonCellFlags.useButtonImageSource)
+ {
+ if ([NSImage imageNamed: @"NSSwitch"] == image)
+ {
+ bi = [[NSButtonImageSource alloc] initWithImageNamed: @"NSHighlightedSwitch"];
+ }
+ else if ([NSImage imageNamed: @"NSRadioButton"] == image)
+ {
+ bi = [[NSButtonImageSource alloc] initWithImageNamed: @"NSHighlightedRadioButton"];
+ }
+ }
+ }
// encode button image source, if it exists...
if (bi != nil)
- {
- [aCoder encodeObject: bi forKey: @"NSAlternateImage"];
- }
+ {
+ [aCoder encodeObject: bi forKey: @"NSAlternateImage"];
+ }
else if (_altImage != nil)
- {
- [aCoder encodeObject: _altImage forKey: @"NSAlternateImage"];
- }
+ {
+ [aCoder encodeObject: _altImage forKey: @"NSAlternateImage"];
+ }
// repeat and delay
[aCoder encodeInt: (int)_delayInterval forKey: @"NSPeriodicDelay"];
@@ -1609,30 +1609,30 @@ typedef struct _GSButtonCellFlags
[aCoder encodeObject: _altImage];
tmp = _buttoncell_is_transparent;
[aCoder encodeValueOfObjCType: @encode(BOOL)
- at: &tmp];
+ at: &tmp];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
- at: &_keyEquivalentModifierMask];
+ at: &_keyEquivalentModifierMask];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
- at: &_highlightsByMask];
+ at: &_highlightsByMask];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
- at: &_showAltStateMask];
+ at: &_showAltStateMask];
[aCoder encodeObject: _sound];
[aCoder encodeObject: _backgroundColor];
[aCoder encodeValueOfObjCType: @encode(float)
- at: &_delayInterval];
+ at: &_delayInterval];
[aCoder encodeValueOfObjCType: @encode(float)
- at: &_repeatInterval];
+ at: &_repeatInterval];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
- at: &_bezel_style];
+ at: &_bezel_style];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
- at: &_gradient_type];
+ at: &_gradient_type];
tmp = _image_dims_when_disabled;
[aCoder encodeValueOfObjCType: @encode(BOOL)
- at: &tmp];
+ at: &tmp];
tmp = _shows_border_only_while_mouse_inside;
[aCoder encodeValueOfObjCType: @encode(BOOL)
- at: &tmp];
+ at: &tmp];
}
}
@@ -1648,92 +1648,92 @@ typedef struct _GSButtonCellFlags
if ([aDecoder containsValueForKey: @"NSKeyEquivalent"])
{
- [self setKeyEquivalent: [aDecoder decodeObjectForKey: @"NSKeyEquivalent"]];
- }
+ [self setKeyEquivalent: [aDecoder decodeObjectForKey: @"NSKeyEquivalent"]];
+ }
if ([aDecoder containsValueForKey: @"NSNormalImage"])
{
- [self setImage: [aDecoder decodeObjectForKey: @"NSNormalImage"]];
- }
+ [self setImage: [aDecoder decodeObjectForKey: @"NSNormalImage"]];
+ }
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
{
- [self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
- }
+ [self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
+ }
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
{
- unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
- GSButtonCellFlags buttonCellFlags;
- memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags));
+ unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
+ GSButtonCellFlags buttonCellFlags;
+ memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags));
- [self setTransparent: buttonCellFlags.isTransparent];
- [self setBordered: buttonCellFlags.isBordered];
-
- [self setCellAttribute: NSPushInCell
- to: buttonCellFlags.isPushin];
- [self setCellAttribute: NSCellLightsByBackground
- to: buttonCellFlags.highlightByBackground];
- [self setCellAttribute: NSCellLightsByContents
- to: buttonCellFlags.highlightByContents];
- [self setCellAttribute: NSCellLightsByGray
- to: buttonCellFlags.highlightByGray];
- [self setCellAttribute: NSChangeBackgroundCell
- to: buttonCellFlags.changeBackground];
- [self setCellAttribute: NSCellChangesContents
- to: buttonCellFlags.changeContents];
- [self setCellAttribute: NSChangeGrayCell
- to: buttonCellFlags.changeGray];
-
- [self setImagePosition: NSImageLeft];
- }
+ [self setTransparent: buttonCellFlags.isTransparent];
+ [self setBordered: buttonCellFlags.isBordered];
+
+ [self setCellAttribute: NSPushInCell
+ to: buttonCellFlags.isPushin];
+ [self setCellAttribute: NSCellLightsByBackground
+ to: buttonCellFlags.highlightByBackground];
+ [self setCellAttribute: NSCellLightsByContents
+ to: buttonCellFlags.highlightByContents];
+ [self setCellAttribute: NSCellLightsByGray
+ to: buttonCellFlags.highlightByGray];
+ [self setCellAttribute: NSChangeBackgroundCell
+ to: buttonCellFlags.changeBackground];
+ [self setCellAttribute: NSCellChangesContents
+ to: buttonCellFlags.changeContents];
+ [self setCellAttribute: NSChangeGrayCell
+ to: buttonCellFlags.changeGray];
+
+ [self setImagePosition: NSImageLeft];
+ }
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
{
- int bFlags2;
+ int bFlags2;
- bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
- [self setShowsBorderOnlyWhileMouseInside: (bFlags2 & 0x8)];
- [self setBezelStyle: (bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2)];
- }
+ bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
+ [self setShowsBorderOnlyWhileMouseInside: (bFlags2 & 0x8)];
+ [self setBezelStyle: (bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2)];
+ }
if ([aDecoder containsValueForKey: @"NSAlternateImage"])
{
- id image;
+ id image;
- //
- // NOTE: Okay... this is a humongous kludge. It seems as though
- // Cocoa is doing something very odd here. It doesn't seem to
- // encode system images for buttons normally, if it is using
- // images at all. Until I figure out what, this will stay.
- // Danger, Will Robinson! :)
- //
- image = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
- if ([image isKindOfClass: [NSImage class]])
- {
- if ([NSImage imageNamed: @"NSSwitch"] == image)
- {
- image = [NSImage imageNamed: @"NSHighlightedSwitch"];
- if ([self image] == nil)
- {
- [self setImage: [NSImage imageNamed: @"NSSwitch"]];
- }
- }
- else if ([NSImage imageNamed: @"NSRadioButton"] == image)
- {
- image = [NSImage imageNamed: @"NSHighlightedRadioButton"];
- if ([self image] == nil)
- {
- [self setImage: [NSImage imageNamed: @"NSRadioButton"]];
- }
- }
-
- [self setAlternateImage: image];
- }
- }
+ //
+ // NOTE: Okay... this is a humongous kludge. It seems as though
+ // Cocoa is doing something very odd here. It doesn't seem to
+ // encode system images for buttons normally, if it is using
+ // images at all. Until I figure out what, this will stay.
+ // Danger, Will Robinson! :)
+ //
+ image = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
+ if ([image isKindOfClass: [NSImage class]])
+ {
+ if ([NSImage imageNamed: @"NSSwitch"] == image)
+ {
+ image = [NSImage imageNamed: @"NSHighlightedSwitch"];
+ if ([self image] == nil)
+ {
+ [self setImage: [NSImage imageNamed: @"NSSwitch"]];
+ }
+ }
+ else if ([NSImage imageNamed: @"NSRadioButton"] == image)
+ {
+ image = [NSImage imageNamed: @"NSHighlightedRadioButton"];
+ if ([self image] == nil)
+ {
+ [self setImage: [NSImage imageNamed: @"NSRadioButton"]];
+ }
+ }
+
+ [self setAlternateImage: image];
+ }
+ }
if ([aDecoder containsValueForKey: @"NSPeriodicDelay"])
{
- delay = [aDecoder decodeIntForKey: @"NSPeriodicDelay"];
- }
+ delay = [aDecoder decodeIntForKey: @"NSPeriodicDelay"];
+ }
if ([aDecoder containsValueForKey: @"NSPeriodicInterval"])
{
- interval = [aDecoder decodeIntForKey: @"NSPeriodicInterval"];
- }
+ interval = [aDecoder decodeIntForKey: @"NSPeriodicInterval"];
+ }
[self setPeriodicDelay: delay interval: interval];
}
else
@@ -1747,26 +1747,26 @@ typedef struct _GSButtonCellFlags
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
_buttoncell_is_transparent = tmp;
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
- at: &_keyEquivalentModifierMask];
+ at: &_keyEquivalentModifierMask];
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
- at: &_highlightsByMask];
+ at: &_highlightsByMask];
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
- at: &_showAltStateMask];
+ at: &_showAltStateMask];
if ([aDecoder versionForClassName: @"NSButtonCell"] >= 2)
{
- [aDecoder decodeValueOfObjCType: @encode(id) at: &_sound];
- [aDecoder decodeValueOfObjCType: @encode(id) at: &_backgroundColor];
- [aDecoder decodeValueOfObjCType: @encode(float) at: &_delayInterval];
- [aDecoder decodeValueOfObjCType: @encode(float) at: &_repeatInterval];
- [aDecoder decodeValueOfObjCType: @encode(unsigned int)
- at: &_bezel_style];
- [aDecoder decodeValueOfObjCType: @encode(unsigned int)
- at: &_gradient_type];
- [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
- _image_dims_when_disabled = tmp;
- [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
- _shows_border_only_while_mouse_inside = tmp;
+ [aDecoder decodeValueOfObjCType: @encode(id) at: &_sound];
+ [aDecoder decodeValueOfObjCType: @encode(id) at: &_backgroundColor];
+ [aDecoder decodeValueOfObjCType: @encode(float) at: &_delayInterval];
+ [aDecoder decodeValueOfObjCType: @encode(float) at: &_repeatInterval];
+ [aDecoder decodeValueOfObjCType: @encode(unsigned int)
+ at: &_bezel_style];
+ [aDecoder decodeValueOfObjCType: @encode(unsigned int)
+ at: &_gradient_type];
+ [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
+ _image_dims_when_disabled = tmp;
+ [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
+ _shows_border_only_while_mouse_inside = tmp;
}
}
return self;
diff --git a/Source/NSDocument.m b/Source/NSDocument.m
index 2673669d5..c7e38368f 100644
--- a/Source/NSDocument.m
+++ b/Source/NSDocument.m
@@ -565,12 +565,14 @@ withContentsOfURL: (NSURL *)url
- (NSFileWrapper *)fileWrapperOfType: (NSString *)type
error: (NSError **)error
{
+ NSData *data;
+
if (OVERRIDDEN(fileWrapperRepresentationOfType:))
{
return [self fileWrapperRepresentationOfType: type];
}
- NSData *data = [self dataOfType: type error: error];
+ data = [self dataOfType: type error: error];
if (data == nil)
return nil;
diff --git a/Source/NSMenuItemCell.m b/Source/NSMenuItemCell.m
index 07f404511..1ee34e14e 100644
--- a/Source/NSMenuItemCell.m
+++ b/Source/NSMenuItemCell.m
@@ -47,7 +47,7 @@
@implementation NSMenuItemCell
-static NSImage *arrowImage = nil; /* Cache arrow image. */
+static NSImage *arrowImage = nil; /* Cache arrow image. */
+ (void) initialize
@@ -113,7 +113,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
mask = _highlightsByMask;
if (_cell.state)
- mask &= ~_showAltStateMask;
+ mask &= ~_showAltStateMask;
}
else if (_cell.state)
mask = _showAltStateMask;
@@ -197,11 +197,11 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
shift = (m & NSShiftKeyMask) & ![key isEqualToString: ucKey];
key = [NSString stringWithFormat:@"%@%@%@%@%@",
- (m & NSControlKeyMask) ? @"^" : @"",
- (m & NSAlternateKeyMask) ? @"+" : @"",
- shift ? @"/" : @"",
- (m & NSCommandKeyMask) ? @"#" : @"",
- key];
+ (m & NSControlKeyMask) ? @"^" : @"",
+ (m & NSAlternateKeyMask) ? @"+" : @"",
+ shift ? @"/" : @"",
+ (m & NSCommandKeyMask) ? @"#" : @"",
+ key];
return key;
}
@@ -226,30 +226,30 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
if ([_menuItem onStateImage])
componentSize = [[_menuItem onStateImage] size];
else
- componentSize = NSMakeSize(0,0);
+ componentSize = NSMakeSize(0,0);
_stateImageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight)
- neededMenuItemHeight = componentSize.height;
+ neededMenuItemHeight = componentSize.height;
// NSOffState
if ([_menuItem offStateImage])
componentSize = [[_menuItem offStateImage] size];
else
- componentSize = NSMakeSize(0,0);
+ componentSize = NSMakeSize(0,0);
if (componentSize.width > _stateImageWidth)
- _stateImageWidth = componentSize.width;
+ _stateImageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight)
- neededMenuItemHeight = componentSize.height;
+ neededMenuItemHeight = componentSize.height;
// NSMixedState
if ([_menuItem mixedStateImage])
componentSize = [[_menuItem mixedStateImage] size];
else
- componentSize = NSMakeSize(0,0);
+ componentSize = NSMakeSize(0,0);
if (componentSize.width > _stateImageWidth)
- _stateImageWidth = componentSize.width;
+ _stateImageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight)
- neededMenuItemHeight = componentSize.height;
+ neededMenuItemHeight = componentSize.height;
}
else
{
@@ -264,7 +264,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
componentSize = [anImage size];
_imageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight)
- neededMenuItemHeight = componentSize.height;
+ neededMenuItemHeight = componentSize.height;
}
else
{
@@ -287,7 +287,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
componentSize = [arrowImage size];
_keyEquivalentWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight)
- neededMenuItemHeight = componentSize.height;
+ neededMenuItemHeight = componentSize.height;
}
// Cache definitive height
@@ -360,42 +360,42 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
if (_mcell_belongs_to_popupbutton && _cell.image_position)
{
// Special case: draw image on the extreme right
- cellFrame.origin.x += cellFrame.size.width - _imageWidth - 4;
- cellFrame.size.width = _imageWidth;
- return cellFrame;
+ cellFrame.origin.x += cellFrame.size.width - _imageWidth - 4;
+ cellFrame.size.width = _imageWidth;
+ return cellFrame;
}
if ([_menuView isHorizontal] == YES)
{
switch (_cell.image_position)
- {
- case NSNoImage:
- cellFrame = NSZeroRect;
- break;
-
- case NSImageOnly:
- case NSImageOverlaps:
- break;
-
- case NSImageLeft:
- cellFrame.origin.x += 4.; // _horizontalEdgePad
- cellFrame.size.width = _imageWidth;
- break;
-
- case NSImageRight:
- cellFrame.origin.x += _titleWidth;
- cellFrame.size.width = _imageWidth;
- break;
-
- case NSImageBelow:
- cellFrame.size.height /= 2;
- break;
-
- case NSImageAbove:
- cellFrame.size.height /= 2;
- cellFrame.origin.y += cellFrame.size.height;
- break;
- }
+ {
+ case NSNoImage:
+ cellFrame = NSZeroRect;
+ break;
+
+ case NSImageOnly:
+ case NSImageOverlaps:
+ break;
+
+ case NSImageLeft:
+ cellFrame.origin.x += 4.; // _horizontalEdgePad
+ cellFrame.size.width = _imageWidth;
+ break;
+
+ case NSImageRight:
+ cellFrame.origin.x += _titleWidth;
+ cellFrame.size.width = _imageWidth;
+ break;
+
+ case NSImageBelow:
+ cellFrame.size.height /= 2;
+ break;
+
+ case NSImageAbove:
+ cellFrame.size.height /= 2;
+ cellFrame.origin.y += cellFrame.size.height;
+ break;
+ }
}
else
{
@@ -404,33 +404,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
cellFrame.size.width = [_menuView imageAndTitleWidth];
switch (_cell.image_position)
- {
- case NSNoImage:
- cellFrame = NSZeroRect;
- break;
+ {
+ case NSNoImage:
+ cellFrame = NSZeroRect;
+ break;
- case NSImageOnly:
- case NSImageOverlaps:
- break;
+ case NSImageOnly:
+ case NSImageOverlaps:
+ break;
- case NSImageLeft:
- cellFrame.size.width = _imageWidth;
- break;
+ case NSImageLeft:
+ cellFrame.size.width = _imageWidth;
+ break;
- case NSImageRight:
- cellFrame.origin.x += _titleWidth + GSCellTextImageXDist;
- cellFrame.size.width = _imageWidth;
- break;
+ case NSImageRight:
+ cellFrame.origin.x += _titleWidth + GSCellTextImageXDist;
+ cellFrame.size.width = _imageWidth;
+ break;
- case NSImageBelow:
- cellFrame.size.height /= 2;
- break;
+ case NSImageBelow:
+ cellFrame.size.height /= 2;
+ break;
- case NSImageAbove:
- cellFrame.size.height /= 2;
- cellFrame.origin.y += cellFrame.size.height;
- break;
- }
+ case NSImageAbove:
+ cellFrame.size.height /= 2;
+ cellFrame.origin.y += cellFrame.size.height;
+ break;
+ }
}
return cellFrame;
}
@@ -465,33 +465,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
cellFrame.size.height -= 2;
switch (_cell.image_position)
- {
- case NSNoImage:
- case NSImageOverlaps:
- break;
+ {
+ case NSNoImage:
+ case NSImageOverlaps:
+ break;
- case NSImageOnly:
- cellFrame = NSZeroRect;
- break;
-
- case NSImageLeft:
- cellFrame.origin.x += _imageWidth + GSCellTextImageXDist + 4;
- cellFrame.size.width = _titleWidth;
- break;
-
- case NSImageRight:
- cellFrame.size.width = _titleWidth;
- break;
-
- case NSImageBelow:
- cellFrame.size.height /= 2;
- cellFrame.origin.y += cellFrame.size.height;
- break;
+ case NSImageOnly:
+ cellFrame = NSZeroRect;
+ break;
+
+ case NSImageLeft:
+ cellFrame.origin.x += _imageWidth + GSCellTextImageXDist + 4;
+ cellFrame.size.width = _titleWidth;
+ break;
+
+ case NSImageRight:
+ cellFrame.size.width = _titleWidth;
+ break;
+
+ case NSImageBelow:
+ cellFrame.size.height /= 2;
+ cellFrame.origin.y += cellFrame.size.height;
+ break;
- case NSImageAbove:
- cellFrame.size.height /= 2;
- break;
- }
+ case NSImageAbove:
+ cellFrame.size.height /= 2;
+ break;
+ }
}
else
{
@@ -500,33 +500,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
cellFrame.size.width = [_menuView imageAndTitleWidth];
switch (_cell.image_position)
- {
- case NSNoImage:
- case NSImageOverlaps:
- break;
+ {
+ case NSNoImage:
+ case NSImageOverlaps:
+ break;
- case NSImageOnly:
- cellFrame = NSZeroRect;
- break;
+ case NSImageOnly:
+ cellFrame = NSZeroRect;
+ break;
- case NSImageLeft:
- cellFrame.origin.x += _imageWidth + GSCellTextImageXDist;
- cellFrame.size.width = _titleWidth;
- break;
+ case NSImageLeft:
+ cellFrame.origin.x += _imageWidth + GSCellTextImageXDist;
+ cellFrame.size.width = _titleWidth;
+ break;
- case NSImageRight:
- cellFrame.size.width = _titleWidth;
- break;
+ case NSImageRight:
+ cellFrame.size.width = _titleWidth;
+ break;
- case NSImageBelow:
- cellFrame.size.height /= 2;
- cellFrame.origin.y += cellFrame.size.height;
- break;
+ case NSImageBelow:
+ cellFrame.size.height /= 2;
+ cellFrame.origin.y += cellFrame.size.height;
+ break;
- case NSImageAbove:
- cellFrame.size.height /= 2;
- break;
- }
+ case NSImageAbove:
+ cellFrame.size.height /= 2;
+ break;
+ }
}
return cellFrame;
}
@@ -540,50 +540,50 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
* must inset from that.
*/
return NSMakeRect (theRect.origin.x, theRect.origin.y + 2,
- theRect.size.width, theRect.size.height - 2);
+ theRect.size.width, theRect.size.height - 2);
}
else
{
if (_cell.is_bordered)
{
- float yDelta = [_control_view isFlipped] ? 1. : 2.;
- unsigned mask;
- NSRect interiorFrame;
-
- if (_cell.is_highlighted)
- {
- mask = _highlightsByMask;
-
- if (_cell.state)
- mask &= ~_showAltStateMask;
- }
- else if (_cell.state)
- mask = _showAltStateMask;
- else
- mask = NSNoCellMask;
+ float yDelta = [_control_view isFlipped] ? 1. : 2.;
+ unsigned mask;
+ NSRect interiorFrame;
+
+ if (_cell.is_highlighted)
+ {
+ mask = _highlightsByMask;
+
+ if (_cell.state)
+ mask &= ~_showAltStateMask;
+ }
+ else if (_cell.state)
+ mask = _showAltStateMask;
+ else
+ mask = NSNoCellMask;
- /*
- * Special case: Buttons have only three different paths for border.
- * 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.
- */
- interiorFrame = NSMakeRect(theRect.origin.x + 1.,
- theRect.origin.y + yDelta,
- theRect.size.width - 3.,
- theRect.size.height - 3.);
+ /*
+ * Special case: Buttons have only three different paths for border.
+ * 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.
+ */
+ interiorFrame = NSMakeRect(theRect.origin.x + 1.,
+ theRect.origin.y + yDelta,
+ theRect.size.width - 3.,
+ theRect.size.height - 3.);
- // pushed in buttons contents are displaced to the bottom right 1px
- if ((mask & NSPushInCellMask))
- {
- interiorFrame
- = NSOffsetRect(interiorFrame, 1., [_control_view isFlipped] ? 1. : -1.);
- }
- return interiorFrame;
- }
+ // pushed in buttons contents are displaced to the bottom right 1px
+ if ((mask & NSPushInCellMask))
+ {
+ interiorFrame
+ = NSOffsetRect(interiorFrame, 1., [_control_view isFlipped] ? 1. : -1.);
+ }
+ return interiorFrame;
+ }
else
{
- return theRect;
- }
+ return theRect;
+ }
}
}
@@ -591,7 +591,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
// Drawing.
//
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
- inView: (NSView *)controlView
+ inView: (NSView *)controlView
{
if ([_menuView isHorizontal] == YES)
{
@@ -619,21 +619,21 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
}
- (void) drawImageWithFrame: (NSRect)cellFrame
- inView: (NSView *)controlView
+ inView: (NSView *)controlView
{
cellFrame = [self imageRectForBounds: cellFrame];
[self drawImage: _imageToDisplay withFrame: cellFrame inView: controlView];
}
- (void) drawKeyEquivalentWithFrame:(NSRect)cellFrame
- inView:(NSView *)controlView
+ inView:(NSView *)controlView
{
cellFrame = [self keyEquivalentRectForBounds: cellFrame];
if ([_menuItem hasSubmenu] && arrowImage != nil)
{
- NSSize size;
- NSPoint position;
+ NSSize size;
+ NSPoint position;
size = [arrowImage size];
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.
*/
if ([controlView isFlipped])
- position.y += size.height;
+ position.y += size.height;
[arrowImage compositeToPoint: position operation: NSCompositeSourceOver];
}
@@ -665,33 +665,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
- (void) drawSeparatorItemWithFrame:(NSRect)cellFrame
- inView:(NSView *)controlView
+ inView:(NSView *)controlView
{
// FIXME: This only has sense in MacOS or Windows interface styles.
// Maybe somebody wants to support this (Lazaro).
}
- (void) drawStateImageWithFrame: (NSRect)cellFrame
- inView: (NSView*)controlView
+ inView: (NSView*)controlView
{
- NSSize size;
- NSPoint position;
- NSImage *imageToDisplay;
+ NSSize size;
+ NSPoint position;
+ NSImage *imageToDisplay;
switch ([_menuItem state])
{
case NSOnState:
- imageToDisplay = [_menuItem onStateImage];
- break;
+ imageToDisplay = [_menuItem onStateImage];
+ break;
case NSMixedState:
- imageToDisplay = [_menuItem mixedStateImage];
- break;
+ imageToDisplay = [_menuItem mixedStateImage];
+ break;
case NSOffState:
default:
- imageToDisplay = [_menuItem offStateImage];
- break;
+ imageToDisplay = [_menuItem offStateImage];
+ break;
}
if (imageToDisplay == nil)
@@ -717,7 +717,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
}
- (void) drawTitleWithFrame:(NSRect)cellFrame
- inView:(NSView *)controlView
+ inView:(NSView *)controlView
{
if ([_menuView isHorizontal] == YES)
{
@@ -728,13 +728,13 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
NSRect cf = [self titleRectForBounds: cellFrame];
if (!_imageWidth)
- [value setAlignment: NSCenterTextAlignment];
+ [value setAlignment: NSCenterTextAlignment];
attr = [[NSDictionary alloc] initWithObjectsAndKeys:
- value, NSParagraphStyleAttributeName,
- _font, NSFontAttributeName,
- [NSColor controlTextColor], NSForegroundColorAttributeName,
- nil];
+ value, NSParagraphStyleAttributeName,
+ _font, NSFontAttributeName,
+ [NSColor controlTextColor], NSForegroundColorAttributeName,
+ nil];
[[_menuItem title] drawInRect: cf withAttributes: attr];
@@ -743,7 +743,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
else
{
[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;
if (_cell.state)
- mask &= ~_showAltStateMask;
+ mask &= ~_showAltStateMask;
}
else if (_cell.state)
mask = _showAltStateMask;
@@ -794,10 +794,10 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
{
_imageToDisplay = _altImage;
if (!_imageToDisplay)
- _imageToDisplay = [_menuItem image];
+ _imageToDisplay = [_menuItem image];
_titleToDisplay = _altContents;
if (_titleToDisplay == nil || [_titleToDisplay isEqual: @""])
- _titleToDisplay = [_menuItem title];
+ _titleToDisplay = [_menuItem title];
}
else
{
@@ -814,29 +814,29 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
{
// Draw the image
if (_imageWidth > 0)
- [self drawImageWithFrame: cellFrame inView: controlView];
-
+ [self drawImageWithFrame: cellFrame inView: controlView];
+
// Draw the title
if (_titleWidth > 0)
- [self drawTitleWithFrame: cellFrame inView: controlView];
+ [self drawTitleWithFrame: cellFrame inView: controlView];
}
else
{
// Draw the state image
if (_stateImageWidth > 0)
- [self drawStateImageWithFrame: cellFrame inView: controlView];
+ [self drawStateImageWithFrame: cellFrame inView: controlView];
// Draw the image
if (_imageWidth > 0)
- [self drawImageWithFrame: cellFrame inView: controlView];
+ [self drawImageWithFrame: cellFrame inView: controlView];
// Draw the title
if (_titleWidth > 0)
- [self drawTitleWithFrame: cellFrame inView: controlView];
+ [self drawTitleWithFrame: cellFrame inView: controlView];
// Draw the key equivalent
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)
{
- /* In version 1, we used to encode the _menuView here. */
- [aDecoder decodeObject];
- }
+ /* In version 1, we used to encode the _menuView here. */
+ [aDecoder decodeObject];
+ }
}
_needs_sizing = YES;
diff --git a/Source/NSOpenPanel.m b/Source/NSOpenPanel.m
index 4676ebe5a..b4017209d 100644
--- a/Source/NSOpenPanel.m
+++ b/Source/NSOpenPanel.m
@@ -385,8 +385,8 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
{
while ((currCell = [cellEnum nextObject]))
{
- [ret addObject: [NSString stringWithFormat: @"%@/%@", dir,
- [currCell stringValue]]];
+ [ret addObject:
+ [dir stringByAppendingPathComponent: [currCell stringValue]]];
}
}
return ret;
diff --git a/Source/NSPrintOperation.m b/Source/NSPrintOperation.m
index a5b4d1f7f..353b54fcc 100644
--- a/Source/NSPrintOperation.m
+++ b/Source/NSPrintOperation.m
@@ -510,19 +510,22 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
/** Run a print operation modally with respect to a window.
*/
- (void)runOperationModalForWindow: (NSWindow *)docWindow
- delegate: (id)delegate
- didRunSelector: (SEL)didRunSelector
- contextInfo:(void *)contextInfo
+ delegate: (id)delegate
+ didRunSelector: (SEL)didRunSelector
+ contextInfo:(void *)contextInfo
{
NSMutableDictionary *dict;
NSPrintPanel *panel = [self printPanel];
- /* Save the selector so we can use it later */
- dict = [_print_info dictionary];
- [dict setObject: [NSValue value: &didRunSelector withObjCType: @encode(SEL)]
- forKey: @"GSModalRunSelector"];
- [dict setObject: delegate
- forKey: @"GSModalRunDelegate"];
+ if (delegate != nil && didRunSelector != NULL)
+ {
+ /* Save the selector so we can use it later */
+ dict = [_print_info dictionary];
+ [dict setObject: [NSValue value: &didRunSelector withObjCType: @encode(SEL)]
+ forKey: @"GSModalRunSelector"];
+ [dict setObject: delegate
+ forKey: @"GSModalRunDelegate"];
+ }
/* Assume we want to show the panel regardless of the value
of _showPanels
@@ -701,11 +704,14 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
}
[self cleanUpOperation];
dict = [_print_info dictionary];
- [[dict objectForKey: @"GSModalRunSelector"] getValue:&didRunSelector];
+ [[dict objectForKey: @"GSModalRunSelector"] getValue: &didRunSelector];
delegate = [dict objectForKey: @"GSModalRunDelegate"];
- didRun = (void (*)(id, SEL, BOOL, id))[delegate methodForSelector:
- didRunSelector];
- didRun (delegate, didRunSelector, success, contextInfo);
+ if (delegate != nil && didRunSelector != NULL)
+ {
+ didRun = (void (*)(id, SEL, BOOL, id))[delegate methodForSelector:
+ didRunSelector];
+ didRun (delegate, didRunSelector, success, contextInfo);
+ }
}
diff --git a/Source/NSSavePanel.m b/Source/NSSavePanel.m
index 9be1bf0ca..f4cde955f 100644
--- a/Source/NSSavePanel.m
+++ b/Source/NSSavePanel.m
@@ -220,15 +220,14 @@ static BOOL _gs_display_reading_progress = NO;
[_form release];
r = NSMakeRect (43, 6, 27, 27);
- button = [[NSButton alloc] initWithFrame: r];
+ button = [[NSButton alloc] initWithFrame: r];
+ [button setRefusesFirstResponder: YES];
[button setBordered: YES];
- [button setButtonType: NSMomentaryPushButton];
image = [NSImage imageNamed: @"common_Home"];
[button setImage: image];
[button setImagePosition: NSImageOnly];
[button setTarget: self];
[button setAction: @selector(_setHomeDirectory)];
- // [_form setNextKeyView: button];
[button setAutoresizingMask: NSViewMinXMargin];
[button setTag: NSFileHandlingPanelHomeButton];
[_bottomView addSubview: button];
@@ -238,8 +237,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (78, 6, 27, 27);
button = [[NSButton alloc] initWithFrame: r];
+ [button setRefusesFirstResponder: YES];
[button setBordered: YES];
- [button setButtonType: NSMomentaryPushButton];
image = [NSImage imageNamed: @"common_Mount"];
[button setImage: image];
[button setImagePosition: NSImageOnly];
@@ -254,8 +253,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (112, 6, 27, 27);
button = [[NSButton alloc] initWithFrame: r];
+ [button setRefusesFirstResponder: YES];
[button setBordered: YES];
- [button setButtonType: NSMomentaryPushButton];
image = [NSImage imageNamed: @"common_Unmount"];
[button setImage: image];
[button setImagePosition: NSImageOnly];
@@ -270,8 +269,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (148, 6, 71, 27);
button = [[NSButton alloc] initWithFrame: r];
+ [button setRefusesFirstResponder: YES];
[button setBordered: YES];
- [button setButtonType: NSMomentaryPushButton];
[button setTitle: @"Cancel"];
[button setImagePosition: NSNoImage];
[button setTarget: self];
@@ -285,8 +284,8 @@ static BOOL _gs_display_reading_progress = NO;
r = NSMakeRect (228, 6, 71, 27);
_okButton = [[NSButton alloc] initWithFrame: r];
+ [button setRefusesFirstResponder: YES];
[_okButton setBordered: YES];
- [_okButton setButtonType: NSMomentaryPushButton];
[_okButton setTitle: @"OK"];
[_okButton setImagePosition: NSImageRight];
[_okButton setImage: [NSImage imageNamed: @"common_ret"]];
@@ -311,6 +310,7 @@ static BOOL _gs_display_reading_progress = NO;
[button setImage: image];
[button setBordered: NO];
[button setEnabled: NO];
+ [[button cell] setImageDimsWhenDisabled: NO];
[button setImagePosition: NSImageOnly];
[button setAutoresizingMask: NSViewMinYMargin];
[button setTag: NSFileHandlingPanelImageButton];
diff --git a/Source/NSTableView.m b/Source/NSTableView.m
index 48e8059aa..7683dec8c 100644
--- a/Source/NSTableView.m
+++ b/Source/NSTableView.m
@@ -3267,19 +3267,6 @@ byExtendingSelection: (BOOL)flag
[_editedCell setEditable: _dataSource_editable];
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
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
[self _willDisplayCell: _editedCell
@@ -3302,6 +3289,9 @@ byExtendingSelection: (BOOL)flag
}
_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];
if (flag)
@@ -4727,6 +4717,7 @@ static BOOL selectContiguousRegion(NSTableView *self,
NSLog(@"exiting sizeToFit");
}
*/
+
- (void) noteNumberOfRowsChanged
{
_numberOfRows = [self _numRows];
@@ -4737,50 +4728,72 @@ static BOOL selectContiguousRegion(NSTableView *self,
{
int row = [_selectedRows lastIndex];
- /* Check that all selected rows are in the new range of rows */
- if ((row != NSNotFound) && (row >= _numberOfRows))
+ if (row == NSNotFound)
{
- [_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 (!_allowsEmptySelection)
+ {
+ /* 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];
- }
- }
+ if (lastRow > -1)
+ {
+ [self _postSelectionIsChangingNotification];
+ [_selectedRows addIndex: lastRow];
+ _selectedRow = lastRow;
+ [self _postSelectionDidChangeNotification];
+ }
+ else
+ {
+ /* problem - there are no rows at all */
+ _selectedRow = -1;
+ }
+ }
+ }
+ /* 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,
_frame.origin.y,
_frame.size.width,
@@ -4793,10 +4806,10 @@ static BOOL selectContiguousRegion(NSTableView *self,
NSRect superviewBounds; // Get this *after* [self setFrame:]
superviewBounds = [_super_view bounds];
if ((superviewBounds.origin.x <= _frame.origin.x)
- && (NSMaxY (superviewBounds) >= NSMaxY (_frame)))
- {
- [self setNeedsDisplay: YES];
- }
+ && (NSMaxY(superviewBounds) >= NSMaxY(_frame)))
+ {
+ [self setNeedsDisplay: YES];
+ }
}
}
@@ -6336,21 +6349,20 @@ static BOOL selectContiguousRegion(NSTableView *self,
*/
- (void) _postSelectionIsChangingNotification
{
- [nc postNotificationName:
- NSTableViewSelectionIsChangingNotification
+ [nc postNotificationName: NSTableViewSelectionIsChangingNotification
object: self];
}
+
- (void) _postSelectionDidChangeNotification
{
- [nc postNotificationName:
- NSTableViewSelectionDidChangeNotification
+ [nc postNotificationName: NSTableViewSelectionDidChangeNotification
object: self];
}
+
- (void) _postColumnDidMoveNotificationWithOldIndex: (int) oldIndex
newIndex: (int) newIndex
{
- [nc postNotificationName:
- NSTableViewColumnDidMoveNotification
+ [nc postNotificationName: NSTableViewColumnDidMoveNotification
object: self
userInfo: [NSDictionary
dictionaryWithObjectsAndKeys:
diff --git a/Source/NSTextAttachment.m b/Source/NSTextAttachment.m
index 192112d74..696045df6 100644
--- a/Source/NSTextAttachment.m
+++ b/Source/NSTextAttachment.m
@@ -31,7 +31,8 @@
You should have received a copy of the GNU Library General Public
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"
@@ -45,18 +46,18 @@
@implementation NSTextAttachmentCell
-- (void)drawWithFrame:(NSRect)cellFrame
- inView:(NSView *)controlView
- characterIndex:(unsigned)charIndex
+- (void)drawWithFrame: (NSRect)cellFrame
+ inView: (NSView *)controlView
+ characterIndex: (unsigned)charIndex
{
[self drawWithFrame: cellFrame
inView: controlView];
}
-- (void)drawWithFrame:(NSRect)cellFrame
- inView:(NSView *)controlView
- characterIndex:(unsigned)charIndex
- layoutManager:(NSLayoutManager *)layoutManager
+- (void)drawWithFrame: (NSRect)cellFrame
+ inView: (NSView *)controlView
+ characterIndex: (unsigned)charIndex
+ layoutManager: (NSLayoutManager *)layoutManager
{
[self drawWithFrame: cellFrame
inView: controlView
@@ -68,10 +69,10 @@
return NSZeroPoint;
}
-- (NSRect)cellFrameForTextContainer:(NSTextContainer *)textContainer
- proposedLineFragment:(NSRect)lineFrag
- glyphPosition:(NSPoint)position
- characterIndex:(unsigned)charIndex
+- (NSRect)cellFrameForTextContainer: (NSTextContainer *)textContainer
+ proposedLineFragment: (NSRect)lineFrag
+ glyphPosition: (NSPoint)position
+ characterIndex: (unsigned)charIndex
{
NSRect aRect;
@@ -85,18 +86,18 @@
return YES;
}
-- (BOOL)wantsToTrackMouseForEvent:(NSEvent *)theEvent
- inRect:(NSRect)cellFrame
- ofView:(NSView *)controlView
- atCharacterIndex:(unsigned)charIndex
+- (BOOL)wantsToTrackMouseForEvent: (NSEvent *)theEvent
+ inRect: (NSRect)cellFrame
+ ofView: (NSView *)controlView
+ atCharacterIndex: (unsigned)charIndex
{
return [self wantsToTrackMouse];
}
-- (BOOL)trackMouse:(NSEvent *)theEvent
- inRect:(NSRect)cellFrame
- ofView:(NSView *)controlView
- untilMouseUp:(BOOL)flag
+- (BOOL)trackMouse: (NSEvent *)theEvent
+ inRect: (NSRect)cellFrame
+ ofView: (NSView *)controlView
+ untilMouseUp: (BOOL)flag
{
if ([controlView respondsToSelector: @selector(delegate)])
{
@@ -108,9 +109,8 @@
{
if ([theEvent clickCount] == 2)
{
- if (delegate != nil &&
- [delegate respondsToSelector:
- @selector(textView:doubleClickedOnCell:inRect:)])
+ if (delegate != nil && [delegate respondsToSelector:
+ @selector(textView:doubleClickedOnCell:inRect:)])
{
[delegate textView: textView
doubleClickedOnCell: self
@@ -120,9 +120,8 @@
}
else
{
- if (delegate != nil &&
- [delegate respondsToSelector:
- @selector(textView:clickedOnCell:inRect:)])
+ if (delegate != nil && [delegate respondsToSelector:
+ @selector(textView:clickedOnCell:inRect:)])
{
[delegate textView: textView
clickedOnCell: self
@@ -133,9 +132,8 @@
}
else if (type == NSLeftMouseDragged)
{
- if (delegate != nil &&
- [delegate respondsToSelector:
- @selector(textView:draggedCell:inRect:event:)])
+ if (delegate != nil && [delegate respondsToSelector:
+ @selector(textView:draggedCell:inRect:event:)])
{
[delegate textView: textView
draggedCell: self
@@ -152,11 +150,11 @@
untilMouseUp: flag];
}
-- (BOOL)trackMouse:(NSEvent *)theEvent
- inRect:(NSRect)cellFrame
- ofView:(NSView *)controlView
- atCharacterIndex:(unsigned)charIndex
- untilMouseUp:(BOOL)flag
+- (BOOL)trackMouse: (NSEvent *)theEvent
+ inRect: (NSRect)cellFrame
+ ofView: (NSView *)controlView
+ atCharacterIndex: (unsigned)charIndex
+ untilMouseUp: (BOOL)flag
{
if ([controlView respondsToSelector: @selector(delegate)])
{
@@ -168,9 +166,8 @@
{
if ([theEvent clickCount] == 2)
{
- if (delegate != nil &&
- [delegate respondsToSelector:
- @selector(textView:doubleClickedOnCell:inRect:atIndex:)])
+ if (delegate != nil && [delegate respondsToSelector:
+ @selector(textView:doubleClickedOnCell:inRect:atIndex:)])
{
[delegate textView: textView
doubleClickedOnCell: self
@@ -181,9 +178,8 @@
}
else
{
- if (delegate != nil &&
- [delegate respondsToSelector:
- @selector(textView:clickedOnCell:inRect:atIndex:)])
+ if (delegate != nil && [delegate respondsToSelector:
+ @selector(textView:clickedOnCell:inRect:atIndex:)])
{
[delegate textView: textView
clickedOnCell: self
@@ -195,9 +191,8 @@
}
else if (type == NSLeftMouseDragged)
{
- if (delegate != nil &&
- [delegate respondsToSelector:
- @selector(textView:draggedCell:inRect:event:atIndex:)])
+ if (delegate != nil && [delegate respondsToSelector:
+ @selector(textView:draggedCell:inRect:event:atIndex:)])
{
[delegate textView: textView
draggedCell: self
@@ -215,7 +210,7 @@
untilMouseUp: flag];
}
-- (void)setAttachment:(NSTextAttachment *)anObject
+- (void)setAttachment: (NSTextAttachment *)anObject
{
NSFileWrapper *fileWrap = [anObject fileWrapper];
@@ -252,16 +247,16 @@
return [super cellSize];
}
-- (void)highlight:(BOOL)flag
- withFrame:(NSRect)cellFrame
- inView:(NSView *)controlView
+- (void)highlight: (BOOL)flag
+ withFrame: (NSRect)cellFrame
+ inView: (NSView *)controlView
{
[super highlight: flag
withFrame: cellFrame
inView: controlView];
}
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
+- (void)drawWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
{
[super drawWithFrame: cellFrame inView: controlView];
}
@@ -283,7 +278,7 @@
[super dealloc];
}
-- (id) initWithFileWrapper:(NSFileWrapper *)fileWrapper
+- (id) initWithFileWrapper: (NSFileWrapper *)fileWrapper
{
self = [super init];
if (self != nil)
@@ -295,11 +290,14 @@
return self;
}
-- (void)setFileWrapper:(NSFileWrapper *)fileWrapper
+- (void)setFileWrapper: (NSFileWrapper *)fileWrapper
{
ASSIGN(_fileWrapper, fileWrapper);
// Reset the cell, so it shows the new attachment
- [_cell setAttachment: self];
+ if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
+ {
+ [_cell setAttachment: self];
+ }
}
- (NSFileWrapper *)fileWrapper
@@ -312,10 +310,13 @@
return _cell;
}
-- (void)setAttachmentCell:(id )cell
+- (void)setAttachmentCell: (id )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];
// 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;
}
diff --git a/Source/NSView.m b/Source/NSView.m
index 3b2b01953..92e1d9141 100644
--- a/Source/NSView.m
+++ b/Source/NSView.m
@@ -2680,8 +2680,10 @@ in the main thread.
*/
- (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.y -= delta.height;
diff --git a/Version b/Version
index c66ec9bf9..00c20708d 100644
--- a/Version
+++ b/Version
@@ -11,9 +11,9 @@ GNUSTEP_GUI_LIBTIFF=3.4
# The version number of this release.
GNUSTEP_GUI_MAJOR_VERSION=0
GNUSTEP_GUI_MINOR_VERSION=12
-GNUSTEP_GUI_SUBMINOR_VERSION=0
+GNUSTEP_GUI_SUBMINOR_VERSION=1
# 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}
VERSION=${GNUSTEP_GUI_VERSION}