* Source/NSColorPanel.m: Always send action and colorChanged: when

the color changes. NSColorPanel is always "continuous" for now...
to support -isContinuous == NO, we need to augment the API between
the color panel and the pickers so they can send a message when
the mouse is released.
* Source/NSTextView.m: Change typing attributes in response to
colorChanged:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34105 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-11-01 20:31:24 +00:00
parent e6db640322
commit 26567e31d8
3 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,13 @@
2011-11-01 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSColorPanel.m: Always send action and colorChanged: when
the color changes. NSColorPanel is always "continuous" for now...
to support -isContinuous == NO, we need to augment the API between
the color panel and the pickers so they can send a message when
the mouse is released.
* Source/NSTextView.m: Change typing attributes in response to
colorChanged:
2011-11-01 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSView.m: centerScanRect patch from Sebastian Reitenbach.

View file

@ -365,9 +365,6 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
- (void) _apply: (id) sender
{
// This is currently not used
[NSApp sendAction: @selector(changeColor:) to: nil from: self];
if ((_action) && (_target != nil))
[NSApp sendAction: _action to: _target from: self];
}
- (void) _magnify: (id) sender
@ -745,7 +742,12 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
if ([self showsAlpha])
[_alphaSlider setFloatValue: [aColor alphaComponent] * MAX_ALPHA_VALUE];
if (_isContinuous && (_action) && (_target != nil))
// FIXME: to support [self isContinuous] the API between color pickers
// and NSColorPanel needs some changes. Currently the color panel is
// always continuous
[NSApp sendAction: @selector(changeColor:) to: nil from: self];
if ((_action) && (_target != nil))
[NSApp sendAction: _action to: _target from: self];
[[NSNotificationCenter defaultCenter]

View file

@ -3175,7 +3175,18 @@ This method is for user changes; see NSTextView_actions.m.
NSColor *aColor = (NSColor *)[sender color];
NSRange aRange = [self rangeForUserCharacterAttributeChange];
if (aRange.location == NSNotFound)
// FIXME: support undo
/* Set typing attributes */
if (_layoutManager)
{
[_layoutManager->_typingAttributes setObject: aColor
forKey: NSForegroundColorAttributeName];
[notificationCenter postNotificationName: NSTextViewDidChangeTypingAttributesNotification
object: _notifObject];
}
if (aRange.location == NSNotFound || aRange.length == 0)
return;
if (![self shouldChangeTextInRange: aRange