mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-03 17:10:43 +00:00
* Headers/AppKit/NSColorPanel.h: Change -alpha to CGFloat.
* Source/NSColorPanel.m: Remove left over GModel loading code. Set default mode to colour wheel. Small cleanups mostly in comments. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40229 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0ac235927d
commit
53fac69b5f
3 changed files with 20 additions and 28 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2016-11-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSColorPanel.h: Change -alpha to CGFloat.
|
||||||
|
* Source/NSColorPanel.m: Remove left over GModel loading code.
|
||||||
|
Set default mode to colour wheel.
|
||||||
|
Small cleanups mostly in comments.
|
||||||
|
|
||||||
2016-11-21 Fred Kiefer <FredKiefer@gmx.de>
|
2016-11-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSColorPanel.m (-_initWithoutGModel): Correct target for
|
* Source/NSColorPanel.m (-_initWithoutGModel): Correct target for
|
||||||
|
|
|
@ -132,7 +132,7 @@ enum {
|
||||||
fromView:(NSView *)sourceView;
|
fromView:(NSView *)sourceView;
|
||||||
- (void)setColor:(NSColor *)aColor;
|
- (void)setColor:(NSColor *)aColor;
|
||||||
|
|
||||||
- (float)alpha;
|
- (CGFloat)alpha;
|
||||||
- (NSColor *)color;
|
- (NSColor *)color;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -56,8 +56,6 @@
|
||||||
#import "AppKit/NSSplitView.h"
|
#import "AppKit/NSSplitView.h"
|
||||||
#import "AppKit/NSWindow.h"
|
#import "AppKit/NSWindow.h"
|
||||||
#import "GNUstepGUI/GSDisplayServer.h"
|
#import "GNUstepGUI/GSDisplayServer.h"
|
||||||
#import "GNUstepGUI/IMLoading.h"
|
|
||||||
|
|
||||||
|
|
||||||
#import "GSGuiPrivate.h"
|
#import "GSGuiPrivate.h"
|
||||||
|
|
||||||
|
@ -65,8 +63,7 @@
|
||||||
static NSLock *_gs_gui_color_panel_lock = nil;
|
static NSLock *_gs_gui_color_panel_lock = nil;
|
||||||
static NSColorPanel *_gs_gui_color_panel = nil;
|
static NSColorPanel *_gs_gui_color_panel = nil;
|
||||||
static int _gs_gui_color_picker_mask = NSColorPanelAllModesMask;
|
static int _gs_gui_color_picker_mask = NSColorPanelAllModesMask;
|
||||||
// FIXME: This should be NSWheelModeColorPanel
|
static int _gs_gui_color_picker_mode = NSWheelModeColorPanel;
|
||||||
static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NSApplication (NSColorPanel)
|
@implementation NSApplication (NSColorPanel)
|
||||||
|
@ -86,7 +83,6 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
@interface NSColorPanel (PrivateMethods)
|
@interface NSColorPanel (PrivateMethods)
|
||||||
- (void) _loadPickers;
|
- (void) _loadPickers;
|
||||||
- (void) _loadPickerAtPath: (NSString *)path;
|
- (void) _loadPickerAtPath: (NSString *)path;
|
||||||
- (void) _fixupMatrix;
|
|
||||||
- (void) _setupPickers;
|
- (void) _setupPickers;
|
||||||
- (void) _showNewPicker: (id)sender;
|
- (void) _showNewPicker: (id)sender;
|
||||||
- (id) _initWithoutGModel;
|
- (id) _initWithoutGModel;
|
||||||
|
@ -156,18 +152,6 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - this is a HACK to get around problems in the gmodel code
|
|
||||||
- (void) _fixupMatrix
|
|
||||||
{
|
|
||||||
NSButtonCell *prototype;
|
|
||||||
|
|
||||||
[_pickerMatrix setFrame: NSMakeRect(4, 190, 192, 36)];
|
|
||||||
prototype = [[NSButtonCell alloc] initImageCell: nil];
|
|
||||||
[prototype setButtonType: NSOnOffButton];
|
|
||||||
[_pickerMatrix setPrototype: prototype];
|
|
||||||
RELEASE(prototype);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) _setupPickers
|
- (void) _setupPickers
|
||||||
{
|
{
|
||||||
id<NSColorPickingDefault, NSColorPickingCustom> picker;
|
id<NSColorPickingDefault, NSColorPickingCustom> picker;
|
||||||
|
@ -462,6 +446,8 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
[_gs_gui_color_panel_lock lock];
|
[_gs_gui_color_panel_lock lock];
|
||||||
if (!_gs_gui_color_panel)
|
if (!_gs_gui_color_panel)
|
||||||
{
|
{
|
||||||
|
// if (![NSBundle loadNibNamed: @"ColorPanel" owner: self]);
|
||||||
|
|
||||||
// Keep this two lines separated so the check in [init] works.
|
// Keep this two lines separated so the check in [init] works.
|
||||||
_gs_gui_color_panel = [self alloc];
|
_gs_gui_color_panel = [self alloc];
|
||||||
[_gs_gui_color_panel init];
|
[_gs_gui_color_panel init];
|
||||||
|
@ -491,9 +477,9 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
_gs_gui_color_picker_mode = mode;
|
_gs_gui_color_picker_mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**<p>Drags <var>aColor</var> frome <var>sourceView</var> at the location
|
/**<p>Drags <var>aColor</var> from <var>sourceView</var> at the location
|
||||||
give by the event <var>anEvent</var> ( [NSView-convertPoint:fromView:] ).
|
give by the event <var>anEvent</var> ( [NSView-convertPoint:fromView:] ).
|
||||||
The type declare into the pasteboard is NSColorPboardType</p>
|
The type declared into the pasteboard is NSColorPboardType</p>
|
||||||
<p>See Also: [NSView-convertPoint:fromView:]
|
<p>See Also: [NSView-convertPoint:fromView:]
|
||||||
[NSView-dragImage:at:offset:event:pasteboard:source:slideBack:</p>
|
[NSView-dragImage:at:offset:event:pasteboard:source:slideBack:</p>
|
||||||
*/
|
*/
|
||||||
|
@ -539,7 +525,6 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
return _gs_gui_color_panel;
|
return _gs_gui_color_panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (![NSBundle loadNibNamed: @"ColorPanel" owner: self]);
|
|
||||||
[self _initWithoutGModel];
|
[self _initWithoutGModel];
|
||||||
|
|
||||||
[self _loadPickers];
|
[self _loadPickers];
|
||||||
|
@ -593,7 +578,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**<p> Sets the accessoryView to a view. The old view ( if exists ) will be
|
/**<p> Sets the accessoryView to a view. The old view ( if exists ) will be
|
||||||
remove ( and release ). You need to retain it if you want to use
|
removed ( and released ). You need to retain it if you want to use
|
||||||
it later</p>
|
it later</p>
|
||||||
<p>See Also: -accessoryView</p>
|
<p>See Also: -accessoryView</p>
|
||||||
*/
|
*/
|
||||||
|
@ -610,8 +595,8 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
|
|
||||||
/**<p>Sets the NSColorPanl action method to <var>aSelector</var> The
|
/**<p>Sets the NSColorPanl action method to <var>aSelector</var> The
|
||||||
action message is usally send in -setColor:, when the picker is updated,
|
action message is usally send in -setColor:, when the picker is updated,
|
||||||
when a new picker is show, when the alpha is changed or when one of the
|
when a new picker is shown, when the alpha is changed or when one of the
|
||||||
color well at the bottom is selected.</p>
|
color wells at the bottom is selected.</p>
|
||||||
*/
|
*/
|
||||||
- (void) setAction: (SEL)aSelector
|
- (void) setAction: (SEL)aSelector
|
||||||
{
|
{
|
||||||
|
@ -660,7 +645,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
NSRect newFrame = [_pickerBox frame];
|
NSRect newFrame = [_pickerBox frame];
|
||||||
float offset = [_alphaSlider frame].size.height + 4;
|
CGFloat offset = [_alphaSlider frame].size.height + 4.0;
|
||||||
|
|
||||||
[_alphaSlider setFrameOrigin: newFrame.origin];
|
[_alphaSlider setFrameOrigin: newFrame.origin];
|
||||||
[[_pickerBox superview] addSubview: _alphaSlider];
|
[[_pickerBox superview] addSubview: _alphaSlider];
|
||||||
|
@ -670,7 +655,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Remove the alpha slider, and add its size to the pickeBox
|
// Remove the alpha slider, and add its size to the pickerBox
|
||||||
[_alphaSlider removeFromSuperview];
|
[_alphaSlider removeFromSuperview];
|
||||||
[_pickerBox setFrame: NSUnionRect([_pickerBox frame],
|
[_pickerBox setFrame: NSUnionRect([_pickerBox frame],
|
||||||
[_alphaSlider frame])];
|
[_alphaSlider frame])];
|
||||||
|
@ -718,7 +703,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
1.0 if the NSColorPanel does not show alpha</p>
|
1.0 if the NSColorPanel does not show alpha</p>
|
||||||
<p>See Also: -showsAlpha -setShowsAlpha:</p>
|
<p>See Also: -showsAlpha -setShowsAlpha:</p>
|
||||||
*/
|
*/
|
||||||
- (float) alpha
|
- (CGFloat) alpha
|
||||||
{
|
{
|
||||||
if ([self showsAlpha])
|
if ([self showsAlpha])
|
||||||
return [_alphaSlider floatValue] / MAX_ALPHA_VALUE;
|
return [_alphaSlider floatValue] / MAX_ALPHA_VALUE;
|
||||||
|
@ -734,7 +719,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
||||||
return [_colorWell color];
|
return [_colorWell color];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <p>Sets the NSColor displayed to aColor. This method post a
|
/** <p>Sets the NSColor displayed to aColor. This method posts a
|
||||||
NSColorPanelColorDidChangeNotification notification if needed.</p>
|
NSColorPanelColorDidChangeNotification notification if needed.</p>
|
||||||
<p>See Also: -color [NSColorWell-setColor:]
|
<p>See Also: -color [NSColorWell-setColor:]
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue