* Source/NSStepperCell.m (-trackMouse:...untilMouseUp:): Adjust

to changes in super class.
This commit is contained in:
fredkiefer 2017-08-31 23:57:41 +02:00
parent c72d2df3ff
commit 3ac7a369c5
2 changed files with 46 additions and 23 deletions

View file

@ -1,3 +1,8 @@
2017-08-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSStepperCell.m (-trackMouse:...untilMouseUp:): Adjust
to changes in super class.
2017-08-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSButtonCell.m (-setButtonType:): Warn about unsupported

View file

@ -184,6 +184,7 @@
{
NSPoint location = [theEvent locationInWindow];
NSPoint point = [controlView convertPoint: location fromView: nil];
NSPoint last_point = point;
NSRect upRect;
NSRect downRect;
NSRect rect;
@ -194,18 +195,18 @@
unsigned int periodCount = 0;
BOOL isDirectionUp;
BOOL autorepeat = [self autorepeat];
BOOL done = NO;
BOOL mouseWentUp = NO;
BOOL tracking;
_mouse_down_flags = [theEvent modifierFlags];
if (![self startTrackingAt: point inView: controlView])
if ([self isEnabled] == NO)
return NO;
if (![controlView mouse: point inRect: cellFrame])
return NO; // point is not in cell
if ([self isEnabled] == NO)
return NO;
tracking = [self startTrackingAt: point inView: controlView];
if ([theEvent type] != NSLeftMouseDown)
return NO;
@ -226,7 +227,7 @@
}
else
{
return mouseWentUp;
return NO;
}
[self setHighlighted: YES
@ -241,9 +242,9 @@
event_mask |= NSPeriodicMask;
}
while (!done)
while (YES)
{
NSEventType eventType;
NSEventType eventType;
theEvent = [NSApp nextEventMatchingMask: event_mask
untilDate: [NSDate distantFuture]
@ -255,39 +256,48 @@
if (eventType == NSLeftMouseUp)
{
mouseWentUp = YES;
done = YES;
break;
}
if (eventType == NSPeriodic)
else if (eventType == NSPeriodic)
{
periodCount++;
if (periodCount == 4)
periodCount = 0;
if (periodCount == 0)
{
if (isDirectionUp)
{
if (isDirectionUp)
[self _increment];
else
[self _decrement];
[(NSControl*)controlView sendAction: [self action] to: [self target]];
location = [[controlView window] mouseLocationOutsideOfEventStream];
last_point = point;
point = [controlView convertPoint: location fromView: nil];
periodCount = 0;
}
location = [[controlView window] mouseLocationOutsideOfEventStream];
else
{
periodCount++;
}
}
else
{
location = [theEvent locationInWindow];
last_point = point;
point = [controlView convertPoint: location fromView: nil];
}
point = [controlView convertPoint: location fromView: nil];
if (![controlView mouse: point inRect: cellFrame])
if (!flag && ![controlView mouse: point inRect: cellFrame])
{
if (flag == NO)
{
done = YES;
}
break;
}
if (NSMouseInRect(point, rect, NO) != overButton)
if (tracking)
{
tracking = [self continueTracking: last_point
at: point
inView: controlView];
}
if (NSMouseInRect(point, rect, NO) != overButton)
{
overButton = !overButton;
if (overButton && autorepeat)
@ -306,6 +316,14 @@
}
}
if (tracking)
{
[self stopTracking: last_point
at: point
inView: controlView
mouseIsUp: mouseWentUp];
}
if (overButton && autorepeat)
{
[NSEvent stopPeriodicEvents];