diff --git a/ChangeLog b/ChangeLog index 1d40cd4c7..496dce595 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-11-01 Eric Wasylishen + + * 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 * Source/NSView.m: centerScanRect patch from Sebastian Reitenbach. diff --git a/Source/NSColorPanel.m b/Source/NSColorPanel.m index 2c879a421..ab886c623 100644 --- a/Source/NSColorPanel.m +++ b/Source/NSColorPanel.m @@ -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] diff --git a/Source/NSTextView.m b/Source/NSTextView.m index ba261dbfd..3b666c577 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -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