mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:10:47 +00:00
Color dragging minor improvement.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9162 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a002d02682
commit
7106a1459a
3 changed files with 57 additions and 60 deletions
|
@ -5,6 +5,9 @@
|
|||
1. colorwell should not deactivate when panel is closed.
|
||||
2. setting color of an active well should set the color of the panel
|
||||
(though it should not raise it).
|
||||
* Source/NSColorPanel.m: Minor tidy.
|
||||
* Images/common_ColorSwatch.tiff: Updated to same size as NeXTstep
|
||||
color swatch.
|
||||
|
||||
Sun Feb 18 13:35:55 2001 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
|
|
Binary file not shown.
|
@ -92,16 +92,20 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
|
||||
bundleEnumerator = [bundles objectEnumerator];
|
||||
while ((bundleName = [bundleEnumerator nextObject]))
|
||||
{
|
||||
[self _loadPickerAtPath:
|
||||
[path stringByAppendingPathComponent: bundleName]];
|
||||
}
|
||||
}
|
||||
|
||||
paths = [[NSBundle mainBundle] pathsForResourcesOfType: @"bundle"
|
||||
inDirectory: @"ColorPickers"];
|
||||
|
||||
pathEnumerator = [paths objectEnumerator];
|
||||
while ((path = [pathEnumerator nextObject]))
|
||||
{
|
||||
[self _loadPickerAtPath: path];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _loadPickerAtPath: (NSString *)path
|
||||
|
@ -121,8 +125,10 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
[_pickers addObject: picker];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"%@ does not contain a valid color picker.", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME - this is a HACK to get around problems in the gmodel code
|
||||
|
@ -341,22 +347,19 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
|
||||
@implementation NSColorPanel
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+ (void)initialize
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSColorPanel class])
|
||||
{
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
[self setVersion: 1];
|
||||
_gs_gui_color_panel_lock = [NSLock new];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Creating the NSColorPanel
|
||||
//
|
||||
+ (NSColorPanel *)sharedColorPanel
|
||||
{
|
||||
if (_gs_gui_color_panel == nil)
|
||||
|
@ -385,30 +388,24 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
return _gs_gui_color_panel;
|
||||
}
|
||||
|
||||
+ (BOOL)sharedColorPanelExists
|
||||
+ (BOOL) sharedColorPanelExists
|
||||
{
|
||||
return (_gs_gui_color_panel == nil) ? NO : YES;
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the NSColorPanel
|
||||
//
|
||||
+ (void)setPickerMask:(int)mask
|
||||
+ (void) setPickerMask: (int)mask
|
||||
{
|
||||
_gs_gui_color_picker_mask = mask;
|
||||
}
|
||||
|
||||
+ (void)setPickerMode:(int)mode
|
||||
+ (void) setPickerMode: (int)mode
|
||||
{
|
||||
_gs_gui_color_picker_mode = mode;
|
||||
}
|
||||
|
||||
//
|
||||
// Setting Color
|
||||
//
|
||||
+ (BOOL)dragColor:(NSColor *)aColor
|
||||
withEvent:(NSEvent *)anEvent
|
||||
fromView:(NSView *)sourceView
|
||||
+ (BOOL) dragColor: (NSColor *)aColor
|
||||
withEvent: (NSEvent *)anEvent
|
||||
fromView: (NSView *)sourceView
|
||||
{
|
||||
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSDragPboard];
|
||||
NSImage *image = [NSImage imageNamed: @"common_ColorSwatch"];
|
||||
|
@ -429,9 +426,9 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
return YES;
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
|
@ -448,20 +445,17 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the NSColorPanel
|
||||
//
|
||||
- (NSView *)accessoryView
|
||||
- (NSView *) accessoryView
|
||||
{
|
||||
return _accessoryView;
|
||||
}
|
||||
|
||||
- (BOOL)isContinuous
|
||||
- (BOOL) isContinuous
|
||||
{
|
||||
return _isContinuous;
|
||||
}
|
||||
|
||||
- (int)mode
|
||||
- (int) mode
|
||||
{
|
||||
if (_currentPicker != nil)
|
||||
return [_currentPicker currentMode];
|
||||
|
@ -469,7 +463,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (void)setAccessoryView:(NSView *)aView
|
||||
- (void) setAccessoryView: (NSView *)aView
|
||||
{
|
||||
if (_accessoryView == aView)
|
||||
return;
|
||||
|
@ -480,17 +474,17 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
[_splitView addSubview: _accessoryView];
|
||||
}
|
||||
|
||||
- (void)setAction:(SEL)aSelector
|
||||
- (void) setAction: (SEL)aSelector
|
||||
{
|
||||
_action = aSelector;
|
||||
}
|
||||
|
||||
- (void)setContinuous:(BOOL)flag
|
||||
- (void) setContinuous: (BOOL)flag
|
||||
{
|
||||
_isContinuous = flag;
|
||||
}
|
||||
|
||||
- (void)setMode:(int)mode
|
||||
- (void) setMode: (int)mode
|
||||
{
|
||||
int i, count;
|
||||
|
||||
|
@ -510,7 +504,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)setShowsAlpha:(BOOL)flag
|
||||
- (void) setShowsAlpha: (BOOL)flag
|
||||
{
|
||||
if (flag == _showsAlpha)
|
||||
return;
|
||||
|
@ -542,12 +536,12 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
[_topView setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void)setTarget:(id)anObject
|
||||
- (void) setTarget: (id)anObject
|
||||
{
|
||||
_target = anObject;
|
||||
}
|
||||
|
||||
- (BOOL)showsAlpha
|
||||
- (BOOL) showsAlpha
|
||||
{
|
||||
return _showsAlpha;
|
||||
}
|
||||
|
@ -555,13 +549,13 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
//
|
||||
// Attaching a Color List
|
||||
//
|
||||
- (void)attachColorList:(NSColorList *)aColorList
|
||||
- (void) attachColorList: (NSColorList *)aColorList
|
||||
{
|
||||
[_pickers makeObjectsPerformSelector: @selector(attachColorList:)
|
||||
withObject: aColorList];
|
||||
}
|
||||
|
||||
- (void)detachColorList:(NSColorList *)aColorList
|
||||
- (void) detachColorList: (NSColorList *)aColorList
|
||||
{
|
||||
[_pickers makeObjectsPerformSelector: @selector(detachColorList:)
|
||||
withObject: aColorList];
|
||||
|
@ -570,7 +564,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
//
|
||||
// Setting Color
|
||||
//
|
||||
- (float)alpha
|
||||
- (float) alpha
|
||||
{
|
||||
if ([self showsAlpha])
|
||||
return [_alphaSlider floatValue] / MAX_ALPHA_VALUE;
|
||||
|
@ -578,12 +572,12 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
|
|||
return 1.0;
|
||||
}
|
||||
|
||||
- (NSColor *)color
|
||||
- (NSColor *) color
|
||||
{
|
||||
return [_colorWell color];
|
||||
}
|
||||
|
||||
- (void)setColor:(NSColor *)aColor
|
||||
- (void) setColor: (NSColor *)aColor
|
||||
{
|
||||
[_colorWell setColor: aColor];
|
||||
[_currentPicker setColor: aColor];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue