Patches backported from trunk.

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,6 +27,7 @@
*/
#include <AppKit/NSAnimation.h>
#include <GNUstepBase/GSLock.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSException.h>
@ -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; i<GSIArrayCount(_progressMarks); i++)
NSDebugFLLog (@"NSAnimationMark",
@"%@ Mark #%d : %f",
@ -707,10 +763,11 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
if (_delegate != nil)
{
id delegate;
NSDebugFLLog (@"NSAnimationDelegate",
@"%@ Cache delegation methods",self);
// delegation methods are cached while the animation is running
id delegate;
delegate = GS_GC_UNHIDE (_delegate);
_delegate_animationDidReachProgressMark =
([delegate respondsToSelector: @selector (animation:didReachProgressMark:)]) ?
@ -807,6 +864,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) startWhenAnimation: (NSAnimation*)animation
reachesProgress: (NSAnimationProgress)start
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
_startAnimation = animation;
@ -825,6 +884,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) stopAnimation
{
_NSANIMATION_LOCKING_SETUP;
if ([self isAnimating])
{
_NSANIMATION_LOCK;
@ -836,6 +897,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) stopWhenAnimation: (NSAnimation*)animation
reachesProgress: (NSAnimationProgress)stop
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
_stopAnimation = animation;
@ -868,11 +931,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) animatorDidStart
{
id delegate;
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationAnimator",@"%@",self);
_NSANIMATION_LOCK;
id delegate;
delegate = GS_GC_UNHIDE (_currentDelegate);
if (_delegate_animationShouldStart) // method is cached (the animation is running)
@ -887,11 +952,13 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) animatorDidStop
{
id delegate;
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationAnimator",@"%@ Progress = %f",self,_currentProgress);
_NSANIMATION_LOCK;
id delegate;
delegate = GS_GC_UNHIDE (_currentDelegate);
if (_currentProgress < 1.0)
{
@ -916,11 +983,14 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) animatorStep: (NSTimeInterval) elapsedTime;
{
NSAnimationProgress progress;
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationAnimator",@"%@ Elapsed time : %f",self,elapsedTime);
_NSANIMATION_LOCK;
NSAnimationProgress progress = (elapsedTime / _duration);
progress = (elapsedTime / _duration);
{ // have some marks been passed ?
// NOTE: the case where progress == markedProgress is
@ -945,14 +1015,17 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) _gs_startAnimationReachesProgressMark: (NSNotification*)notification
{
NSAnimation *animation = [notification object];
NSAnimationProgress mark
= [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue];
NSAnimation *animation;
NSAnimationProgress mark;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
animation = [notification object];
mark = [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue];
NSDebugFLLog (@"NSAnimationMark",
@"%@ Start Animation %@ reaches %f",self,animation,mark);
_NSANIMATION_LOCK;
if ( animation == _startAnimation && mark == _startMark)
{
// [self clearStartAnimation];
@ -962,15 +1035,20 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
_NSANIMATION_UNLOCK;
}
- (void) _gs_stopAnimationReachesProgressMark: (NSNotification*)notification
{
NSAnimation *animation = [notification object];
NSAnimationProgress mark
= [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue];
NSAnimation *animation;
NSAnimationProgress mark;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
animation = [notification object];
mark = [[[notification userInfo] objectForKey: NSAnimationProgressMark] floatValue];
NSDebugFLLog (@"NSAnimationMark",
@"%@ Stop Animation %@ reaches %f",self,animation,mark);
_NSANIMATION_LOCK;
if ( animation == _stopAnimation && mark == _stopMark)
{
@ -987,6 +1065,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) _gs_didReachProgressMark: (NSAnimationProgress) progress
{
_NSANIMATION_LOCKING_SETUP;
NSDebugFLLog (@"NSAnimationMark",@"%@ progress %f",self, progress);
_NSANIMATION_LOCK;
@ -1074,6 +1154,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (unsigned int) frameCount
{
unsigned c;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
c = (_animator != nil)? [_animator frameCount] : 0;
_NSANIMATION_UNLOCK;
@ -1082,6 +1164,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) resetCounters
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
if (_animator != nil) [_animator resetCounters];
_NSANIMATION_UNLOCK;
@ -1090,6 +1174,8 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (float) actualFrameRate;
{
float r;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
r = (_animator != nil)? [_animator frameRate] : 0.0;
_NSANIMATION_UNLOCK;
@ -1314,6 +1400,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) setViewAnimations: (NSArray*)animations
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
if (_viewAnimations != animations)
DESTROY (_viewAnimationDesc);
@ -1324,6 +1412,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (NSArray*) viewAnimations
{
NSArray *a;
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
a = _viewAnimations;
_NSANIMATION_UNLOCK;
@ -1332,6 +1422,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) startAnimation
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
if (_viewAnimationDesc == nil)
{
@ -1351,6 +1443,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) stopAnimation
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
[super stopAnimation];
[self setCurrentProgress: 1.0];
@ -1371,6 +1465,8 @@ NSString *NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
- (void) setCurrentProgress: (NSAnimationProgress)progress
{
_NSANIMATION_LOCKING_SETUP;
_NSANIMATION_LOCK;
[super setCurrentProgress: progress];
[self performSelectorOnMainThread: @selector (_gs_updateViewsWithValue:)

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 <NSTextAttachmentCell>)cell
- (void)setAttachmentCell: (id <NSTextAttachmentCell>)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;
}

View file

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

View file

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