mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
* Source/NSMenuView.m ([NSMenuView -trackWithEvent:]):
new tracking code. The menu feels snappier now (at least for me). * Source/NSColorWell.m ([-activate:], [-deactivate]) register/unregister for NSColorPanelColorChangedNotification. ([NSColorWell _takeColorFromPanel:]): new method to prevent endless loop when setting the well's color from the color panel. ([NSColorWell -initWithCoder:]): register for NSColorPboardType. * Source/NSColorPanel.m ([NSColorPanel -_bottomWellAction:]): called when hitting one of the well at the bottom of the panel. Previous behaviour would not send a NSColorPanelColorChangedNotification. ([NSColorPanel -initWithCoder:]): update bottom wells construction to call _bottomWellAction: instead of takeColorFrom:. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14853 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd896cbb66
commit
118c53a894
4 changed files with 50 additions and 36 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2002-10-27 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||||
|
|
||||||
|
* Source/NSMenuView.m ([NSMenuView -trackWithEvent:]):
|
||||||
|
new tracking code. The menu feels snappier now (at least for me).
|
||||||
|
|
||||||
|
* Source/NSColorWell.m ([-activate:], [-deactivate])
|
||||||
|
register/unregister for NSColorPanelColorChangedNotification.
|
||||||
|
([NSColorWell _takeColorFromPanel:]): new method to prevent endless
|
||||||
|
loop when setting the well's color from the color panel.
|
||||||
|
([NSColorWell -initWithCoder:]): register for NSColorPboardType.
|
||||||
|
|
||||||
|
* Source/NSColorPanel.m ([NSColorPanel -_bottomWellAction:]):
|
||||||
|
called when hitting one of the well at the bottom of the panel.
|
||||||
|
Previous behaviour would not send a
|
||||||
|
NSColorPanelColorChangedNotification.
|
||||||
|
([NSColorPanel -initWithCoder:]): update bottom wells construction to
|
||||||
|
call _bottomWellAction: instead of takeColorFrom:.
|
||||||
|
|
||||||
2002-10-26 Adam Fedor <fedor@gnu.org>
|
2002-10-26 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Source/NSOutlineView.m (-drawRow:clipRect:): Release imageCell
|
* Source/NSOutlineView.m (-drawRow:clipRect:): Release imageCell
|
||||||
|
|
|
@ -324,7 +324,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
[well setBordered: NO];
|
[well setBordered: NO];
|
||||||
[well setEnabled: NO];
|
[well setEnabled: NO];
|
||||||
[well setTarget: _colorWell];
|
[well setTarget: _colorWell];
|
||||||
[well setAction: @selector(takeColorFrom:)];
|
[well setAction: @selector(_bottomWellAction:)];
|
||||||
[swatchView addSubview: well];
|
[swatchView addSubview: well];
|
||||||
RELEASE(well);
|
RELEASE(well);
|
||||||
}
|
}
|
||||||
|
@ -355,6 +355,11 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
[_currentPicker setColor: [_colorWell color]];
|
[_currentPicker setColor: [_colorWell color]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _bottomWellAction: (id) sender
|
||||||
|
{
|
||||||
|
[self setColor: [sender color]];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSColorPanel
|
@implementation NSColorPanel
|
||||||
|
|
|
@ -86,6 +86,11 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
||||||
name: GSColorWellDidBecomeExclusiveNotification
|
name: GSColorWellDidBecomeExclusiveNotification
|
||||||
object: nil];
|
object: nil];
|
||||||
|
|
||||||
|
[nc addObserver: self
|
||||||
|
selector: @selector(_takeColorFromPanel:)
|
||||||
|
name: NSColorPanelColorChangedNotification
|
||||||
|
object: nil];
|
||||||
|
|
||||||
_is_active = YES;
|
_is_active = YES;
|
||||||
|
|
||||||
[colorPanel setColor: _the_color];
|
[colorPanel setColor: _the_color];
|
||||||
|
@ -233,6 +238,8 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
||||||
// Undo RETAIN by decoder
|
// Undo RETAIN by decoder
|
||||||
TEST_RELEASE(_target);
|
TEST_RELEASE(_target);
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||||
|
[self registerForDraggedTypes:
|
||||||
|
[NSArray arrayWithObjects: NSColorPboardType, nil]];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -346,6 +353,19 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _takeColorFromPanel: (NSNotification *) notification
|
||||||
|
{
|
||||||
|
id sender = [notification object];
|
||||||
|
|
||||||
|
if ([sender respondsToSelector: @selector(color)])
|
||||||
|
{
|
||||||
|
ASSIGN(_the_color, [(id)sender color]);
|
||||||
|
|
||||||
|
[self sendAction: _action to: _target];
|
||||||
|
[self setNeedsDisplay: YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (id) target
|
- (id) target
|
||||||
{
|
{
|
||||||
return _target;
|
return _target;
|
||||||
|
|
|
@ -885,7 +885,7 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOVE_THRESHOLD_DELTA 2.0
|
#define MOVE_THRESHOLD_DELTA 2.0
|
||||||
#define DELAY_MULTIPLIER 6
|
#define DELAY_MULTIPLIER 10
|
||||||
|
|
||||||
- (BOOL) trackWithEvent: (NSEvent*)event
|
- (BOOL) trackWithEvent: (NSEvent*)event
|
||||||
{
|
{
|
||||||
|
@ -899,7 +899,6 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
||||||
BOOL delayedSelect = NO;
|
BOOL delayedSelect = NO;
|
||||||
int delayCount = 0;
|
int delayCount = 0;
|
||||||
float xDelta = MOVE_THRESHOLD_DELTA;
|
float xDelta = MOVE_THRESHOLD_DELTA;
|
||||||
float yDelta = 0.0;
|
|
||||||
NSEvent *original;
|
NSEvent *original;
|
||||||
NSEventType type = [event type];
|
NSEventType type = [event type];
|
||||||
NSEventType end;
|
NSEventType end;
|
||||||
|
@ -951,45 +950,18 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
||||||
if (delayedSelect && mouseMoved && [event type] == NSPeriodic)
|
if (delayedSelect && mouseMoved && [event type] == NSPeriodic)
|
||||||
{
|
{
|
||||||
float xDiff = location.x - lastLocation.x;
|
float xDiff = location.x - lastLocation.x;
|
||||||
float yDiff = location.y - lastLocation.y;
|
|
||||||
|
|
||||||
/*
|
if (xDiff > xDelta)
|
||||||
* Once the mouse movement has started in one vertical
|
|
||||||
* direction, it must continue in the same direction if
|
|
||||||
* selection is to be delayed.
|
|
||||||
*/
|
|
||||||
if (yDelta == 0.0)
|
|
||||||
{
|
{
|
||||||
if (yDiff < 0.0)
|
|
||||||
yDelta = -MOVE_THRESHOLD_DELTA;
|
|
||||||
else if (yDiff > 0.0)
|
|
||||||
yDelta = MOVE_THRESHOLD_DELTA;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Check to see if movement is less than the threshold.
|
|
||||||
*/
|
|
||||||
if (xDiff < xDelta
|
|
||||||
|| (yDelta < 0.0 && yDiff > yDelta)
|
|
||||||
|| (yDelta > 0.0 && yDiff < yDelta))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* if we have had too many successive small movements, or
|
|
||||||
* a single movement too far in the wrong direction, we
|
|
||||||
* leave 'delayedSelect' mode.
|
|
||||||
*/
|
|
||||||
delayCount++;
|
delayCount++;
|
||||||
if (delayCount >= DELAY_MULTIPLIER
|
if (delayCount >= DELAY_MULTIPLIER)
|
||||||
|| (xDiff < 0)
|
delayedSelect = NO;
|
||||||
|| (yDelta < 0.0 && yDiff > -yDelta)
|
|
||||||
|| (yDelta > 0.0 && yDiff < -yDelta))
|
|
||||||
{
|
|
||||||
delayedSelect = NO;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delayCount = 0;
|
delayedSelect = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastLocation = location;
|
lastLocation = location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1047,7 +1019,6 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
||||||
mouseMoved = NO;
|
mouseMoved = NO;
|
||||||
delayedSelect = YES;
|
delayedSelect = YES;
|
||||||
delayCount = 0;
|
delayCount = 0;
|
||||||
yDelta = 0.0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue