Revision: 12249
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12249&view=rev
Author: amaxwell
Date: 2008-01-03 22:31:40 -0800 (Thu, 03 Jan 2008)
Log Message:
-----------
Add an optional help button to the alert, hidden by default. API same as
NSAlert, except for the delegate option.
Modified Paths:
--------------
trunk/bibdesk/BDSKAlert.h
trunk/bibdesk/BDSKAlert.m
trunk/bibdesk/English.lproj/BDSKAlert.nib/classes.nib
trunk/bibdesk/English.lproj/BDSKAlert.nib/keyedobjects.nib
trunk/bibdesk/French.lproj/BDSKAlert.nib/classes.nib
trunk/bibdesk/French.lproj/BDSKAlert.nib/keyedobjects.nib
Modified: trunk/bibdesk/BDSKAlert.h
===================================================================
--- trunk/bibdesk/BDSKAlert.h 2008-01-04 05:52:23 UTC (rev 12248)
+++ trunk/bibdesk/BDSKAlert.h 2008-01-04 06:31:40 UTC (rev 12249)
@@ -45,6 +45,8 @@
IBOutlet NSTextField *messageField;
IBOutlet NSButton *checkButton;
IBOutlet NSImageView *imageView;
+ IBOutlet NSButton *helpButton;
+ NSString *helpAnchor;
NSMutableArray *buttons;
NSImage *unbadgedImage;
int alertStyle;
@@ -73,6 +75,12 @@
- (NSArray *)buttons;
- (NSButton *)checkButton;
+- (IBAction)helpAction:(id)sender;
+- (void)setHelpAnchor:(NSString *)anchor;
+- (NSString *)helpAnchor;
+- (void)setShowsHelp:(BOOL)flag;
+- (BOOL)showsHelp;
+
- (void)setAlertStyle:(NSAlertStyle)style;
- (NSAlertStyle)alertStyle;
Modified: trunk/bibdesk/BDSKAlert.m
===================================================================
--- trunk/bibdesk/BDSKAlert.m 2008-01-04 05:52:23 UTC (rev 12248)
+++ trunk/bibdesk/BDSKAlert.m 2008-01-04 06:31:40 UTC (rev 12249)
@@ -72,12 +72,14 @@
hasCheckButton = NO;
minButtonSize = NSMakeSize(90.0, 32.0);
buttons = [[NSMutableArray alloc] initWithCapacity:3];
+ helpAnchor = nil;
unbadgedImage = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
}
return self;
}
- (void)dealloc {
+ [helpAnchor release];
[buttons release];
[unbadgedImage release];
[super dealloc];
@@ -144,6 +146,33 @@
return ([checkButton state] == NSOnState);
}
+- (void)setShowsHelp:(BOOL)flag {
+ [self window]; // force the nib to be loaded
+ [helpButton setHidden:(NO == flag)];
+}
+
+- (BOOL)showsHelp {
+ return [helpButton isHidden] == NO;
+}
+
+- (NSString *)helpAnchor {
+ return helpAnchor;
+}
+
+- (void)setHelpAnchor:(NSString *)anchor {
+ [helpAnchor autorelease];
+ helpAnchor = [anchor copy];
+}
+
+- (IBAction)helpAction:(id)sender {
+ // standard NSAlert sends alertShowHelp: to the delegate, but we don't
have a delegate
+ NSString *helpBookName = [[NSBundle mainBundle]
objectForInfoDictionaryKey: @"CFBundleHelpBookName"];
+ NSString *anchor = [self helpAnchor];
+ if (nil == anchor)
+ [NSException raise:NSInvalidArgumentException format:@"No help anchor
set for %@", self];
+ [[NSHelpManager sharedHelpManager] openHelpAnchor:anchor
inBook:helpBookName];
+}
+
- (NSImage *)icon {
return unbadgedImage;
}
Modified: trunk/bibdesk/English.lproj/BDSKAlert.nib/classes.nib
===================================================================
--- trunk/bibdesk/English.lproj/BDSKAlert.nib/classes.nib 2008-01-04
05:52:23 UTC (rev 12248)
+++ trunk/bibdesk/English.lproj/BDSKAlert.nib/classes.nib 2008-01-04
06:31:40 UTC (rev 12249)
@@ -6,19 +6,19 @@
<array>
<dict>
<key>CLASS</key>
- <string>NSMenu</string>
+ <string>NSControl</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSObject</string>
+ <string>NSView</string>
</dict>
<dict>
<key>CLASS</key>
- <string>NSControl</string>
+ <string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSView</string>
+ <string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
@@ -76,6 +76,11 @@
<string>NSWindowController</string>
</dict>
<dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>helpAction</key>
+ <string>id</string>
+ </dict>
<key>CLASS</key>
<string>BDSKAlert</string>
<key>LANGUAGE</key>
@@ -84,6 +89,8 @@
<dict>
<key>checkButton</key>
<string>NSButton</string>
+ <key>helpButton</key>
+ <string>NSButton</string>
<key>imageView</key>
<string>NSImageView</string>
<key>informationField</key>
@@ -94,6 +101,19 @@
<key>SUPERCLASS</key>
<string>BDSKSheetController</string>
</dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>helpAction</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>NSButtonCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSActionCell</string>
+ </dict>
</array>
<key>IBVersion</key>
<string>1</string>
Modified: trunk/bibdesk/English.lproj/BDSKAlert.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/bibdesk/French.lproj/BDSKAlert.nib/classes.nib
===================================================================
--- trunk/bibdesk/French.lproj/BDSKAlert.nib/classes.nib 2008-01-04
05:52:23 UTC (rev 12248)
+++ trunk/bibdesk/French.lproj/BDSKAlert.nib/classes.nib 2008-01-04
06:31:40 UTC (rev 12249)
@@ -6,19 +6,19 @@
<array>
<dict>
<key>CLASS</key>
- <string>NSControl</string>
+ <string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSView</string>
+ <string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
- <string>NSMenu</string>
+ <string>NSControl</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSObject</string>
+ <string>NSView</string>
</dict>
<dict>
<key>ACTIONS</key>
@@ -76,6 +76,11 @@
<string>NSWindowController</string>
</dict>
<dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>helpAction</key>
+ <string>id</string>
+ </dict>
<key>CLASS</key>
<string>BDSKAlert</string>
<key>LANGUAGE</key>
@@ -84,6 +89,8 @@
<dict>
<key>checkButton</key>
<string>NSButton</string>
+ <key>helpButton</key>
+ <string>NSButton</string>
<key>imageView</key>
<string>NSImageView</string>
<key>informationField</key>
Modified: trunk/bibdesk/French.lproj/BDSKAlert.nib/keyedobjects.nib
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit