From 2dc10dd31ce30b4a377cfd5a72d8c53fffb31242 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 26 Aug 2008 14:56:11 -0400 Subject: [PATCH] Adding a help window that uses WebKit to display a Help.html file * English.lproj/Help.html: New file * English.lproj/MainMenu.xib: Setting up the help window * PrintDrop.xcodeproj: Project updates for the help file and linking WebKit * Source/AppController.h: Outlets for the help window * Source/AppController.m: (awakeFromNib): Center the help window and load the help file --- English.lproj/Help.html | 14 ++ English.lproj/MainMenu.xib | 225 ++++++++++++++++++++++++++-- PrintDrop.xcodeproj/project.pbxproj | 16 ++ Source/AppController.h | 6 +- Source/AppController.m | 11 ++ 5 files changed, 258 insertions(+), 14 deletions(-) create mode 100644 English.lproj/Help.html diff --git a/English.lproj/Help.html b/English.lproj/Help.html new file mode 100644 index 0000000..6117675 --- /dev/null +++ b/English.lproj/Help.html @@ -0,0 +1,14 @@ + + + + + BU Print Drop Help + + + + +

Some Help Stuff

+ + + diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 280dcc8..ea5f472 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -8,11 +8,13 @@ 352.00 YES - - + + + YES + com.apple.WebKitIBPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin @@ -1207,6 +1209,106 @@ SUUpdater + + 7 + 2 + {{196, -86}, {634, 596}} + 603979776 + BU Print Drop Help + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 256 + + YES + + YES + Apple HTML pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {{0, 45}, {634, 551}} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + + 268 + + YES + + + 268 + {{540, 11}, {74, 25}} + + YES + + -2080244224 + 134217728 + Close + + + -2038152961 + 163 + + + 400 + 75 + + + + {{0, -1}, {634, 45}} + + GradientBackView + + + {634, 596} + + + {{0, 0}, {1440, 878}} + {3.40282e+38, 3.40282e+38} + @@ -1419,14 +1521,6 @@ 357 - - - showHelp: - - - - 360 - orderFrontColorPanel: @@ -1717,6 +1811,38 @@ 537 + + + orderOut: + + + + 552 + + + + helpWindow + + + + 555 + + + + makeKeyAndOrderFront: + + + + 556 + + + + helpWebView + + + + 557 + @@ -2626,6 +2752,53 @@ + + 538 + + + YES + + + + + + 539 + + + YES + + + + + + + 540 + + + + + 549 + + + YES + + + + + + 550 + + + YES + + + + + + 551 + + + @@ -2637,6 +2810,7 @@ -3.IBPluginDependency 103.IBPluginDependency 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect 106.IBPluginDependency 106.ImportedFromIB2 106.editorWindowContentRectSynchronizationRect @@ -2820,6 +2994,16 @@ 5.ImportedFromIB2 535.IBPluginDependency 536.IBPluginDependency + 538.IBEditorWindowLastContentRect + 538.IBPluginDependency + 538.IBWindowTemplateEditedContentRect + 538.NSWindowTemplate.visibleAtLaunch + 538.windowTemplate.maxSize + 539.IBPluginDependency + 540.IBPluginDependency + 549.IBPluginDependency + 550.IBPluginDependency + 551.IBPluginDependency 56.IBPluginDependency 56.ImportedFromIB2 57.IBEditorWindowLastContentRect @@ -2860,7 +3044,8 @@ com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin - + + {{886, 751}, {201, 23}} com.apple.InterfaceBuilder.CocoaPlugin {{408, 813}, {201, 23}} @@ -2965,7 +3150,7 @@ com.apple.InterfaceBuilder.CocoaPlugin {{337, 763}, {197, 73}} - {{534, 740}, {463, 20}} + {{484, 774}, {463, 20}} com.apple.InterfaceBuilder.CocoaPlugin {74, 862} @@ -3044,6 +3229,16 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{395, 148}, {634, 596}} + com.apple.InterfaceBuilder.CocoaPlugin + {{395, 148}, {634, 596}} + + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{546, 537}, {235, 203}} @@ -3099,7 +3294,7 @@ - 537 + 557 @@ -3116,6 +3311,8 @@ YES dragRegion + helpWebView + helpWindow password printersController progress @@ -3126,6 +3323,8 @@ YES DraggableImageView + WebView + NSWindow NSSecureTextField NSArrayController NSProgressIndicator diff --git a/PrintDrop.xcodeproj/project.pbxproj b/PrintDrop.xcodeproj/project.pbxproj index 8aaa93e..400552e 100644 --- a/PrintDrop.xcodeproj/project.pbxproj +++ b/PrintDrop.xcodeproj/project.pbxproj @@ -39,6 +39,8 @@ 1EE1E4880D748AE4002999AD /* userauth.c in Sources */ = {isa = PBXBuildFile; fileRef = 1EE1E4700D748AE4002999AD /* userauth.c */; }; 1EE1E48C0D748B19002999AD /* liblibssh2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EE1E4500D748AC9002999AD /* liblibssh2.a */; }; 1EE653530D75F5AC00D7A7FA /* Printers.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1EE653510D75F5AC00D7A7FA /* Printers.plist */; }; + 1EF0D3690E6484750007A78D /* Help.html in Resources */ = {isa = PBXBuildFile; fileRef = 1EF0D3670E6484750007A78D /* Help.html */; }; + 1EF0D3740E6484EE0007A78D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EF0D3730E6484EE0007A78D /* WebKit.framework */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -105,6 +107,8 @@ 1EE1E46F0D748AE4002999AD /* transport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = transport.c; sourceTree = ""; }; 1EE1E4700D748AE4002999AD /* userauth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = userauth.c; sourceTree = ""; }; 1EE653520D75F5AC00D7A7FA /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = English; path = English.lproj/Printers.plist; sourceTree = ""; }; + 1EF0D3680E6484750007A78D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = English; path = English.lproj/Help.html; sourceTree = ""; }; + 1EF0D3730E6484EE0007A78D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; @@ -128,6 +132,7 @@ 1EE1E48C0D748B19002999AD /* liblibssh2.a in Frameworks */, 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 1EDFC4E80E4A3EC0000E08AE /* Sparkle.framework in Frameworks */, + 1EF0D3740E6484EE0007A78D /* WebKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -151,6 +156,7 @@ isa = PBXGroup; children = ( 1EDFC4E70E4A3EC0000E08AE /* Sparkle.framework */, + 1EF0D3730E6484EE0007A78D /* WebKit.framework */, 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; @@ -247,6 +253,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 1EF0D3670E6484750007A78D /* Help.html */, 1EE653510D75F5AC00D7A7FA /* Printers.plist */, 1EE1E3E30D7482E7002999AD /* gradient.png */, 8D1107310486CEB800E47090 /* Info.plist */, @@ -350,6 +357,7 @@ 1EE1E3E50D7482E7002999AD /* gradient.png in Resources */, 1EE653530D75F5AC00D7A7FA /* Printers.plist in Resources */, 1EDFC52B0E4A4224000E08AE /* MainMenu.xib in Resources */, + 1EF0D3690E6484750007A78D /* Help.html in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -449,6 +457,14 @@ name = Printers.plist; sourceTree = ""; }; + 1EF0D3670E6484750007A78D /* Help.html */ = { + isa = PBXVariantGroup; + children = ( + 1EF0D3680E6484750007A78D /* English */, + ); + name = Help.html; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ diff --git a/Source/AppController.h b/Source/AppController.h index 4028272..1ac8a62 100644 --- a/Source/AppController.h +++ b/Source/AppController.h @@ -16,7 +16,7 @@ #import #import "DraggableImageView.h" - +#import @interface AppController : NSObject { @@ -32,6 +32,10 @@ NSArray *printers; IBOutlet NSWindow *window; + + // help + IBOutlet NSWindow *helpWindow; + IBOutlet WebView *helpWebView; } - (IBAction)print:(id)sender; diff --git a/Source/AppController.m b/Source/AppController.m index bf87a97..2cd9d9d 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -20,6 +20,7 @@ #import #include #include +#include @interface AppController (Private) - (void)setStatus:(NSString *)msg isError:(BOOL)error; @@ -71,6 +72,16 @@ } } +/** + * Awake from NIB + */ +- (void)awakeFromNib +{ + [helpWindow center]; + NSString *helpPath = [[NSBundle mainBundle] pathForResource:@"Help" ofType:@"html"]; + [[helpWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:helpPath]]]; +} + /** * Reads through a channel (in non-blocking) mode until there is no more left to read * and then it returns. This calls sleep(1) so that the channel can have time to process. -- 2.43.5