|
|
|
@ -37,62 +37,11 @@ id createColorDialog() { |
|
|
|
|
const char* hexColor(awColorPanel* cPanel) { |
|
|
|
|
return [cPanel hexColor]; |
|
|
|
|
} |
|
|
|
|
// @interface NSColorPanel (CPL) |
|
|
|
|
// |
|
|
|
|
// - (void)disablePanel; |
|
|
|
|
// - (void)enablePanel; |
|
|
|
|
// + (NSString *)strColor; |
|
|
|
|
// |
|
|
|
|
// @end |
|
|
|
|
// |
|
|
|
|
// #include <tgmath.h> |
|
|
|
|
// |
|
|
|
|
// static BOOL colorPanelEnabled = YES; |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// @implementation NSColorPanel (CPL) |
|
|
|
|
// |
|
|
|
|
// - (void)disablePanel { |
|
|
|
|
// colorPanelEnabled = NO; |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// - (void)enablePanel { |
|
|
|
|
// colorPanelEnabled = YES; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// - (void)orderFront:(id)sender { |
|
|
|
|
// if (colorPanelEnabled) { |
|
|
|
|
// NSColorPanel *panel = [BFColorPickerPopover sharedPopover].colorPanel; |
|
|
|
|
// if (panel) { |
|
|
|
|
// self.contentView = panel.contentView; |
|
|
|
|
// } |
|
|
|
|
// [super orderFront:sender]; |
|
|
|
|
// } else { |
|
|
|
|
// // Don't do anything. |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// + (NSString *)strColor { |
|
|
|
|
// NSColorPanel *panel = [NSColorPanel sharedColorPanel]; |
|
|
|
|
// [panel orderFront:nil]; |
|
|
|
|
// NSColor *color = [panel.color colorUsingColorSpaceName: NSDeviceRGBColorSpace]; |
|
|
|
|
// return [NSString stringWithFormat:@"r: %d, g: %d, b: %d, a: %d", |
|
|
|
|
// (int)round([color redComponent]*255), |
|
|
|
|
// (int)round([color greenComponent]*255), |
|
|
|
|
// (int)round([color blueComponent]*255), |
|
|
|
|
// (int)round([color alphaComponent]*255)]; |
|
|
|
|
// // return @""; |
|
|
|
|
// } |
|
|
|
|
// @end |
|
|
|
|
id getColor(id panel) { |
|
|
|
|
return theColor; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// const char* ColorDialog() { |
|
|
|
|
// NSColorPanel *panel = [NSColorPanel sharedColorPanel]; |
|
|
|
|
// [panel orderFront:nil]; |
|
|
|
|
// NSString *aColor = [NSColorPanel strColor]; |
|
|
|
|
// return [[NSString stringWithFormat:@"r: %d, g: %d, b: %d, a: %d", |
|
|
|
|
// (int)round([color redComponent]*255), |
|
|
|
|
// (int)round([color greenComponent]*255), |
|
|
|
|
// (int)round([color blueComponent]*255), |
|
|
|
|
// (int)round([color alphaComponent]*255)] UTF8String]; |
|
|
|
|
// return [aColor UTF8String]; |
|
|
|
|
// } |
|
|
|
|
void setColor(id target, id source) { |
|
|
|
|
[target setBackgroundColor: [source color]]; |
|
|
|
|
} |