From 6d0d45de91fec2434fc640aa511b22b85701d65b Mon Sep 17 00:00:00 2001 From: pjbeardsley Date: Wed, 18 Jul 2012 14:24:09 -0400 Subject: [PATCH] Finished adding COLOURLovers link to config panel. --- Helveticolor/ConfigSheet.xib | 400 ++++++++++++++++---------------- Helveticolor/HelveticolorView.h | 2 + Helveticolor/HelveticolorView.m | 19 ++ 3 files changed, 222 insertions(+), 199 deletions(-) diff --git a/Helveticolor/ConfigSheet.xib b/Helveticolor/ConfigSheet.xib index 471c946..350ae02 100644 --- a/Helveticolor/ConfigSheet.xib +++ b/Helveticolor/ConfigSheet.xib @@ -44,7 +44,7 @@ 2 - {{196, 240}, {314, 160}} + {{196, 240}, {314, 138}} 1618477056 Window NSPanel @@ -109,7 +109,7 @@ 268 - {{20, 123}, {42, 17}} + {{20, 101}, {42, 17}} @@ -135,7 +135,7 @@ 6 System controlTextColor - + 3 MAA @@ -145,7 +145,7 @@ 268 - {{64, 116}, {233, 26}} + {{64, 94}, {233, 26}} @@ -220,16 +220,16 @@ 268 - {{17, 72}, {132, 17}} + {{44, 59}, {128, 17}} - + _NS:1505 YES 68288064 272630784 - Palettes provided by + Palettes courtesy of _NS:1505 @@ -237,41 +237,28 @@ - + 268 - {{154, 69}, {140, 22}} + {{174, 59}, {111, 17}} - _NS:9 + + _NS:1505 YES - - -1804468671 + + 68288064 272630784 - + COLOURLovers - _NS:9 - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - textColor - - + _NS:1505 + + + - {314, 160} + {314, 138} @@ -326,6 +313,14 @@ 428 + + + colourLoversLink + + + + 546 + @@ -367,13 +362,11 @@ - - 6 0 - + 6 1 @@ -386,93 +379,77 @@ - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - 6 - 24 - 2 - - - - - 3 + + + 5 0 - 3 + 5 1 - - 20 + + 47 1000 - 8 - 29 + 3 + 9 3 - - - 6 + + + 5 0 - + 6 1 - 20 + 8 1000 - 8 - 29 + 6 + 24 3 - - - 4 + + + + 3 0 - - 4 + + 3 1 - - 20 + + 62 1000 - 8 - 29 + 3 + 9 3 - - - - 5 + + + 9 0 - - 6 + + 9 1 - - 8 + + 0.0 1000 6 24 - 3 + 2 - - - 10 + + + 11 0 - 10 + 11 1 0.0 @@ -483,28 +460,28 @@ 2 - - - 10 + + + 5 0 - - 10 + + 6 1 - - 0.0 + + 8 1000 - 5 - 22 - 2 + 6 + 24 + 3 - - - 4 + + + 3 0 - - 4 + + 3 1 20 @@ -515,12 +492,12 @@ 3 - - - 6 + + + 3 0 - - 6 + + 3 1 20 @@ -531,12 +508,13 @@ 3 - - - 3 + + + + 4 0 - - 3 + + 4 1 20 @@ -547,28 +525,29 @@ 3 - - - 5 + + + + 6 0 - + 6 1 - 8 + 20 1000 - 6 - 24 + 8 + 29 3 - - - 5 + + + 4 0 - - 5 + + 4 1 20 @@ -699,16 +678,6 @@ - - 475 - - - - - 477 - - - 478 @@ -723,82 +692,108 @@ - 490 - + 516 + + + + + + 7 + 0 + + 0 + 1 + + 105 + + 1000 + 3 + 9 + 1 + + + - 491 - - + 517 + + - 494 - + 590 + - 495 - + 594 + - 498 - - - - + 595 + - 499 - - + 604 + + - 502 - + 605 + + + + + 606 + + + + + 607 + - 503 - + 608 + - 504 - + 610 + - 505 - + 612 + - 506 - + 613 + - 507 - + 616 + - 508 - + 618 + - 509 - + 619 + - 510 - - + 620 + + @@ -811,18 +806,17 @@ + + + + + - + - - - - - - - - + + com.apple.InterfaceBuilder.CocoaPlugin @@ -843,28 +837,31 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -874,7 +871,7 @@ - 510 + 620 @@ -882,10 +879,15 @@ HelveticolorView ScreenSaverView + id id id + + colourLoversLink + id + configSheet id diff --git a/Helveticolor/HelveticolorView.h b/Helveticolor/HelveticolorView.h index 3329a2b..79ea18c 100644 --- a/Helveticolor/HelveticolorView.h +++ b/Helveticolor/HelveticolorView.h @@ -12,6 +12,7 @@ int curColorIndex; IBOutlet id configSheet; IBOutlet id showPaletteTypePopUpButton; + IBOutlet id colourLoversLink; } @property (assign) int curColorIndex; @@ -19,6 +20,7 @@ @property (assign) bool firstTime; @property (assign) int curOrientation; @property (retain) id configSheet; +@property (retain) id colourLoversLink; @property (retain) id showPaletteTypePopUpButton; @property (retain) NSMutableArray *colors; @property (retain) NSMutableArray *palettes; diff --git a/Helveticolor/HelveticolorView.m b/Helveticolor/HelveticolorView.m index 6170edb..68278a9 100644 --- a/Helveticolor/HelveticolorView.m +++ b/Helveticolor/HelveticolorView.m @@ -9,6 +9,7 @@ #import "HelveticolorView.h" #import "Color.h" #import "Palette.h" +#import "NSAttributedString+Hyperlink.h" @implementation HelveticolorView @@ -38,6 +39,7 @@ @implementation HelveticolorView @synthesize curColorIndex; @synthesize curPaletteIndex; @synthesize configSheet; +@synthesize colourLoversLink; @synthesize showPaletteTypePopUpButton; @synthesize colors; @synthesize palettes; @@ -438,6 +440,23 @@ - (NSWindow *)configureSheet ScreenSaverDefaults *defaults = [ScreenSaverDefaults defaultsForModuleWithName: MODULE_NAME]; [self.showPaletteTypePopUpButton selectItemAtIndex:[[defaults objectForKey: SHOW_PALETTES_TYPE_DEFAULTS_KEY] intValue]]; + + // both are needed, otherwise hyperlink won't accept mousedown + NSLog(@"%@", self.colourLoversLink); + [self.colourLoversLink setDrawsBackground:NO]; + [self.colourLoversLink setAllowsEditingTextAttributes: YES]; + [self.colourLoversLink setSelectable: YES]; + + NSURL* url = [NSURL URLWithString:@"http://www.colourlovers.com"]; + + NSMutableAttributedString* string = [[NSMutableAttributedString alloc] init]; + [string appendAttributedString: [NSAttributedString hyperlinkFromString:@"COLOURLovers" withURL:url]]; + + // set the attributed string to the NSTextField + [self.colourLoversLink setAttributedStringValue: string]; + + [string release]; + return self.configSheet; }