Skip to content

Commit

Permalink
add help
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardelben committed Sep 6, 2011
1 parent 685ea8c commit 3ea01d5
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 47 deletions.
12 changes: 11 additions & 1 deletion Color Picker.xcodeproj/project.pbxproj
Expand Up @@ -14,6 +14,8 @@
55A8833E14153BCA0076BB4A /* close.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A8833D14153BCA0076BB4A /* close.png */; };
55A883421415F8EF0076BB4A /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55A883401415F8EE0076BB4A /* PreferencesController.m */; };
55A883431415F8EF0076BB4A /* PreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55A883411415F8EE0076BB4A /* PreferencesController.xib */; };
55A8835014162EF80076BB4A /* HelpController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55A8834F14162EF80076BB4A /* HelpController.m */; };
55A8835214162F720076BB4A /* HelpController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55A8835114162F710076BB4A /* HelpController.xib */; };
55C9F16E1400FAF000321C9E /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C9F16D1400FAF000321C9E /* AppController.m */; };
55C9F1751400FB0200321C9E /* CustomStatusItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C9F1721400FB0200321C9E /* CustomStatusItem.m */; };
55C9F1761400FB0200321C9E /* CustomWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C9F1741400FB0200321C9E /* CustomWindow.m */; };
Expand Down Expand Up @@ -45,6 +47,9 @@
55A8833F1415F8EE0076BB4A /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesController.h; sourceTree = "<group>"; };
55A883401415F8EE0076BB4A /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesController.m; sourceTree = "<group>"; };
55A883411415F8EE0076BB4A /* PreferencesController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesController.xib; sourceTree = "<group>"; };
55A8834E14162EF80076BB4A /* HelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelpController.h; sourceTree = "<group>"; };
55A8834F14162EF80076BB4A /* HelpController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelpController.m; sourceTree = "<group>"; };
55A8835114162F710076BB4A /* HelpController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HelpController.xib; sourceTree = "<group>"; };
55C9F16C1400FAF000321C9E /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
55C9F16D1400FAF000321C9E /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
55C9F1701400FAF900321C9E /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -122,7 +127,6 @@
isa = PBXGroup;
children = (
55A8833B141539E10076BB4A /* APPL.icns */,
55C9F1B71402F45B00321C9E /* Carbon.framework */,
55D4EC8513FFF18D00D13344 /* ColorPicker */,
55D4EC7E13FFF18D00D13344 /* Frameworks */,
55D4EC7C13FFF18D00D13344 /* Products */,
Expand All @@ -140,6 +144,7 @@
55D4EC7E13FFF18D00D13344 /* Frameworks */ = {
isa = PBXGroup;
children = (
55C9F1B71402F45B00321C9E /* Carbon.framework */,
55D4EC7F13FFF18D00D13344 /* Cocoa.framework */,
55D4EC8113FFF18D00D13344 /* Other Frameworks */,
);
Expand Down Expand Up @@ -188,6 +193,9 @@
55A8833F1415F8EE0076BB4A /* PreferencesController.h */,
55A883401415F8EE0076BB4A /* PreferencesController.m */,
55A883411415F8EE0076BB4A /* PreferencesController.xib */,
55A8834E14162EF80076BB4A /* HelpController.h */,
55A8834F14162EF80076BB4A /* HelpController.m */,
55A8835114162F710076BB4A /* HelpController.xib */,
);
path = ColorPicker;
sourceTree = "<group>";
Expand Down Expand Up @@ -262,6 +270,7 @@
55A8833C141539E10076BB4A /* APPL.icns in Resources */,
55A8833E14153BCA0076BB4A /* close.png in Resources */,
55A883431415F8EF0076BB4A /* PreferencesController.xib in Resources */,
55A8835214162F720076BB4A /* HelpController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -287,6 +296,7 @@
550A63CF1406567B00864125 /* NSColorFormatter.m in Sources */,
55A8833714151D5D0076BB4A /* NSScreen+PointConversion.m in Sources */,
55A883421415F8EF0076BB4A /* PreferencesController.m in Sources */,
55A8835014162EF80076BB4A /* HelpController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 3 additions & 0 deletions ColorPicker/AppController.h
Expand Up @@ -6,6 +6,7 @@
@class RSLoginItems;
@class ColorPickerViewController;
@class PreferencesController;
@class HelpController;

@interface AppController : NSObject <CustomStatusItemDelegate>

Expand All @@ -16,6 +17,7 @@
@property (retain) NSView *view;
@property (retain) RSLoginItems *loginItems;
@property (retain) PreferencesController *preferencesController;
@property (retain) HelpController *helpController;

- (void)toggleShowWindow;
- (void)toggleShowWindowFromPoint:(NSPoint)point forceAnchoring:(BOOL)forceAnchoring;
Expand All @@ -28,5 +30,6 @@
- (void)copyColorToPasteboard:(NSColor *)color;

- (IBAction)showPreferences:(id)sender;
- (IBAction)showHelp:(id)sender;

@end
12 changes: 11 additions & 1 deletion ColorPicker/AppController.m
Expand Up @@ -5,6 +5,7 @@
#import "NSColorFormatter.h"
#import "NSScreen+PointConversion.h"
#import "PreferencesController.h"
#import "HelpController.h"

@implementation AppController

Expand All @@ -15,6 +16,7 @@ @implementation AppController
@synthesize loginItems;
@synthesize viewController;
@synthesize preferencesController;
@synthesize helpController;

- (void)awakeFromNib
{
Expand Down Expand Up @@ -124,7 +126,7 @@ - (void)registerHotKey
DDHotKeyCenter * c = [[DDHotKeyCenter alloc] init];
DDHotKeyTask task = ^(NSEvent *hkEvent) {
[viewController captureColor:YES];
[self toggleShowWindowFromPoint:[statusItemView getAnchorPoint] forceAnchoring:YES];
[window setAlphaValue:1.0]; // force show window
};
if (![c registerHotKeyWithKeyCode:35 modifierFlags:(NSCommandKeyMask | NSShiftKeyMask) task:task]) { // cmd shift p
NSLog(@"Unable to register hotkey");
Expand Down Expand Up @@ -168,5 +170,13 @@ - (IBAction)showPreferences:(id)sender
[preferencesController showWindow:self];
}

- (IBAction)showHelp:(id)sender
{
if (!helpController) {
self.helpController = [[HelpController alloc] init];
}
[helpController showWindow:self];
}


@end
4 changes: 3 additions & 1 deletion ColorPicker/Constants.h
Expand Up @@ -15,4 +15,6 @@
#define kNumberOfColorsHistory 5

#define kAlertTitleStartupItem @"Run at Login?"
#define kAlertTextStartupItem @"Click \"Yes\" if you would like to run Color Picker when you login."
#define kAlertTextStartupItem @"Click \"Yes\" if you would like to run Color Picker when you login."

#define kInstructions @"Color Picker makes it easy to get color information from the screen.\n\nTo capture a color, simply press cmd + p. You can see a preview of the color directly on the window or in the menu bar at any time.\n\nWhen you copy a color, it will get copied to your clipboard and added to the colors history. To copy a color back from the history simply click on it.\n\n You can hide and show the main interface by clicking on its menu bar icon. There are many preferences that you can tweak to customize the behavior of Color Picker."
14 changes: 14 additions & 0 deletions ColorPicker/HelpController.h
@@ -0,0 +1,14 @@
//
// HelpController.h
// Color Picker
//
// Created by Oscar Del Ben on 9/6/11.
// Copyright 2011 DibiStore. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface HelpController : NSWindowController

@property (strong) IBOutlet NSTextField *instructions;
@end
29 changes: 29 additions & 0 deletions ColorPicker/HelpController.m
@@ -0,0 +1,29 @@
//
// HelpController.m
// Color Picker
//
// Created by Oscar Del Ben on 9/6/11.
// Copyright 2011 DibiStore. All rights reserved.
//

#import "HelpController.h"

@implementation HelpController
@synthesize instructions;

- (id)init
{
self = [super initWithWindowNibName:@"HelpController"];
if (self) {
// Initialization code here.
}

return self;
}

- (void)awakeFromNib
{
[instructions setStringValue:kInstructions];
}

@end

0 comments on commit 3ea01d5

Please sign in to comment.