Adding a help window that uses WebKit to display a Help.html file
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 26 Aug 2008 18:56:11 +0000 (14:56 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 26 Aug 2008 18:56:11 +0000 (14:56 -0400)
* 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 [new file with mode: 0644]
English.lproj/MainMenu.xib
PrintDrop.xcodeproj/project.pbxproj
Source/AppController.h
Source/AppController.m

diff --git a/English.lproj/Help.html b/English.lproj/Help.html
new file mode 100644 (file)
index 0000000..6117675
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+       <title>BU Print Drop Help</title>
+</head>
+
+<body>
+
+<h1>Some Help Stuff</h1>
+
+</body>
+</html>
index 280dcc88c1cb96968915c10b8e2eb212b21453b3..ea5f472bc4b65ed73fa4b08f29466296b0942314 100644 (file)
@@ -8,11 +8,13 @@
                <string key="IBDocument.HIToolboxVersion">352.00</string>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <integer value="372"/>
-                       <integer value="536"/>
+                       <integer value="106"/>
+                       <integer value="391"/>
+                       <integer value="538"/>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
+                       <string>com.apple.WebKitIBPlugin</string>
                        <string>com.apple.InterfaceBuilderKit</string>
                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                </object>
                        <object class="NSCustomObject" id="236721087">
                                <string key="NSClassName">SUUpdater</string>
                        </object>
+                       <object class="NSWindowTemplate" id="140279203">
+                               <int key="NSWindowStyleMask">7</int>
+                               <int key="NSWindowBacking">2</int>
+                               <string key="NSWindowRect">{{196, -86}, {634, 596}}</string>
+                               <int key="NSWTFlags">603979776</int>
+                               <string key="NSWindowTitle">BU Print Drop Help</string>
+                               <string key="NSWindowClass">NSWindow</string>
+                               <nil key="NSViewClass"/>
+                               <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+                               <object class="NSView" key="NSWindowView" id="788273458">
+                                       <reference key="NSNextResponder"/>
+                                       <int key="NSvFlags">256</int>
+                                       <object class="NSMutableArray" key="NSSubviews">
+                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                               <object class="WebView" id="19271532">
+                                                       <reference key="NSNextResponder" ref="788273458"/>
+                                                       <int key="NSvFlags">256</int>
+                                                       <object class="NSMutableSet" key="NSDragTypes">
+                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                               <object class="NSMutableArray" key="set.sortedObjects">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <string>Apple HTML pasteboard type</string>
+                                                                       <string>Apple PICT pasteboard type</string>
+                                                                       <string>Apple URL pasteboard type</string>
+                                                                       <string>Apple Web Archive pasteboard type</string>
+                                                                       <string>NSColor pasteboard type</string>
+                                                                       <string>NSFilenamesPboardType</string>
+                                                                       <string>NSStringPboardType</string>
+                                                                       <string>NeXT RTFD pasteboard type</string>
+                                                                       <string>NeXT Rich Text Format v1.0 pasteboard type</string>
+                                                                       <string>NeXT TIFF v4.0 pasteboard type</string>
+                                                                       <string>WebURLsWithTitlesPboardType</string>
+                                                                       <string>public.png</string>
+                                                                       <string>public.url</string>
+                                                                       <string>public.url-name</string>
+                                                               </object>
+                                                       </object>
+                                                       <string key="NSFrame">{{0, 45}, {634, 551}}</string>
+                                                       <reference key="NSSuperview" ref="788273458"/>
+                                                       <reference key="NSNextKeyView"/>
+                                                       <string key="FrameName"/>
+                                                       <string key="GroupName"/>
+                                                       <object class="WebPreferences" key="Preferences">
+                                                               <string key="Identifier"/>
+                                                               <object class="NSMutableDictionary" key="Values">
+                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                       <object class="NSMutableArray" key="dict.sortedKeys">
+                                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                               <string>WebKitDefaultFixedFontSize</string>
+                                                                               <string>WebKitDefaultFontSize</string>
+                                                                               <string>WebKitMinimumFontSize</string>
+                                                                       </object>
+                                                                       <object class="NSMutableArray" key="dict.values">
+                                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                               <integer value="12" id="969860167"/>
+                                                                               <reference ref="969860167"/>
+                                                                               <integer value="1" id="9"/>
+                                                                       </object>
+                                                               </object>
+                                                       </object>
+                                                       <bool key="UseBackForwardList">YES</bool>
+                                                       <bool key="AllowsUndo">YES</bool>
+                                               </object>
+                                               <object class="NSCustomView" id="984818098">
+                                                       <reference key="NSNextResponder" ref="788273458"/>
+                                                       <int key="NSvFlags">268</int>
+                                                       <object class="NSMutableArray" key="NSSubviews">
+                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                               <object class="NSButton" id="304186309">
+                                                                       <reference key="NSNextResponder" ref="984818098"/>
+                                                                       <int key="NSvFlags">268</int>
+                                                                       <string key="NSFrame">{{540, 11}, {74, 25}}</string>
+                                                                       <reference key="NSSuperview" ref="984818098"/>
+                                                                       <bool key="NSEnabled">YES</bool>
+                                                                       <object class="NSButtonCell" key="NSCell" id="834198221">
+                                                                               <int key="NSCellFlags">-2080244224</int>
+                                                                               <int key="NSCellFlags2">134217728</int>
+                                                                               <string key="NSContents">Close</string>
+                                                                               <reference key="NSSupport" ref="672889376"/>
+                                                                               <reference key="NSControlView" ref="304186309"/>
+                                                                               <int key="NSButtonFlags">-2038152961</int>
+                                                                               <int key="NSButtonFlags2">163</int>
+                                                                               <string key="NSAlternateContents"/>
+                                                                               <string key="NSKeyEquivalent"/>
+                                                                               <int key="NSPeriodicDelay">400</int>
+                                                                               <int key="NSPeriodicInterval">75</int>
+                                                                       </object>
+                                                               </object>
+                                                       </object>
+                                                       <string key="NSFrame">{{0, -1}, {634, 45}}</string>
+                                                       <reference key="NSSuperview" ref="788273458"/>
+                                                       <string key="NSClassName">GradientBackView</string>
+                                               </object>
+                                       </object>
+                                       <string key="NSFrameSize">{634, 596}</string>
+                                       <reference key="NSSuperview"/>
+                               </object>
+                               <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+                               <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+                       </object>
                </object>
                <object class="IBObjectContainer" key="IBDocument.Objects">
                        <object class="NSMutableArray" key="connectionRecords">
                                        </object>
                                        <int key="connectionID">357</int>
                                </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBActionConnection" key="connection">
-                                               <string key="label">showHelp:</string>
-                                               <reference key="source" ref="1014"/>
-                                               <reference key="destination" ref="238773614"/>
-                                       </object>
-                                       <int key="connectionID">360</int>
-                               </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBActionConnection" key="connection">
                                                <string key="label">orderFrontColorPanel:</string>
                                        </object>
                                        <int key="connectionID">537</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBActionConnection" key="connection">
+                                               <string key="label">orderOut:</string>
+                                               <reference key="source" ref="140279203"/>
+                                               <reference key="destination" ref="304186309"/>
+                                       </object>
+                                       <int key="connectionID">552</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">helpWindow</string>
+                                               <reference key="source" ref="591533163"/>
+                                               <reference key="destination" ref="140279203"/>
+                                       </object>
+                                       <int key="connectionID">555</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBActionConnection" key="connection">
+                                               <string key="label">makeKeyAndOrderFront:</string>
+                                               <reference key="source" ref="140279203"/>
+                                               <reference key="destination" ref="238773614"/>
+                                       </object>
+                                       <int key="connectionID">556</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">helpWebView</string>
+                                               <reference key="source" ref="591533163"/>
+                                               <reference key="destination" ref="19271532"/>
+                                       </object>
+                                       <int key="connectionID">557</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                                <reference key="object" ref="446729160"/>
                                                <reference key="parent" ref="110575045"/>
                                        </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">538</int>
+                                               <reference key="object" ref="140279203"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="788273458"/>
+                                               </object>
+                                               <reference key="parent" ref="1049"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">539</int>
+                                               <reference key="object" ref="788273458"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="19271532"/>
+                                                       <reference ref="984818098"/>
+                                               </object>
+                                               <reference key="parent" ref="140279203"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">540</int>
+                                               <reference key="object" ref="19271532"/>
+                                               <reference key="parent" ref="788273458"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">549</int>
+                                               <reference key="object" ref="984818098"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="304186309"/>
+                                               </object>
+                                               <reference key="parent" ref="788273458"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">550</int>
+                                               <reference key="object" ref="304186309"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="834198221"/>
+                                               </object>
+                                               <reference key="parent" ref="984818098"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">551</int>
+                                               <reference key="object" ref="834198221"/>
+                                               <reference key="parent" ref="304186309"/>
+                                       </object>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" key="flattenedProperties">
                                        <string>-3.IBPluginDependency</string>
                                        <string>103.IBPluginDependency</string>
                                        <string>103.ImportedFromIB2</string>
+                                       <string>106.IBEditorWindowLastContentRect</string>
                                        <string>106.IBPluginDependency</string>
                                        <string>106.ImportedFromIB2</string>
                                        <string>106.editorWindowContentRectSynchronizationRect</string>
                                        <string>5.ImportedFromIB2</string>
                                        <string>535.IBPluginDependency</string>
                                        <string>536.IBPluginDependency</string>
+                                       <string>538.IBEditorWindowLastContentRect</string>
+                                       <string>538.IBPluginDependency</string>
+                                       <string>538.IBWindowTemplateEditedContentRect</string>
+                                       <string>538.NSWindowTemplate.visibleAtLaunch</string>
+                                       <string>538.windowTemplate.maxSize</string>
+                                       <string>539.IBPluginDependency</string>
+                                       <string>540.IBPluginDependency</string>
+                                       <string>549.IBPluginDependency</string>
+                                       <string>550.IBPluginDependency</string>
+                                       <string>551.IBPluginDependency</string>
                                        <string>56.IBPluginDependency</string>
                                        <string>56.ImportedFromIB2</string>
                                        <string>57.IBEditorWindowLastContentRect</string>
                                        <string>com.apple.InterfaceBuilderKit</string>
                                        <string>com.apple.InterfaceBuilderKit</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <integer value="1" id="9"/>
+                                       <reference ref="9"/>
+                                       <string>{{886, 751}, {201, 23}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <reference ref="9"/>
                                        <string>{{408, 813}, {201, 23}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <reference ref="9"/>
                                        <string>{{337, 763}, {197, 73}}</string>
-                                       <string>{{534, 740}, {463, 20}}</string>
+                                       <string>{{484, 774}, {463, 20}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <reference ref="9"/>
                                        <string>{74, 862}</string>
                                        <reference ref="9"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>{{395, 148}, {634, 596}}</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>{{395, 148}, {634, 596}}</string>
+                                       <integer value="0"/>
+                                       <string>{3.40282e+38, 3.40282e+38}</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.WebKitIBPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <reference ref="9"/>
                                        <string>{{546, 537}, {235, 203}}</string>
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">537</int>
+                       <int key="maxID">557</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
                                                <object class="NSMutableArray" key="dict.sortedKeys">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <string>dragRegion</string>
+                                                       <string>helpWebView</string>
+                                                       <string>helpWindow</string>
                                                        <string>password</string>
                                                        <string>printersController</string>
                                                        <string>progress</string>
                                                <object class="NSMutableArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <string>DraggableImageView</string>
+                                                       <string>WebView</string>
+                                                       <string>NSWindow</string>
                                                        <string>NSSecureTextField</string>
                                                        <string>NSArrayController</string>
                                                        <string>NSProgressIndicator</string>
index 8aaa93ed0a9646d3da50a1fed0c8e859296650f7..400552eca9432c44ce81b06a615a24f52c2951b6 100644 (file)
@@ -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 */; };
                1EE1E46F0D748AE4002999AD /* transport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = transport.c; sourceTree = "<group>"; };
                1EE1E4700D748AE4002999AD /* userauth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = userauth.c; sourceTree = "<group>"; };
                1EE653520D75F5AC00D7A7FA /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = English; path = English.lproj/Printers.plist; sourceTree = "<group>"; };
+               1EF0D3680E6484750007A78D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = English; path = English.lproj/Help.html; sourceTree = "<group>"; };
+               1EF0D3730E6484EE0007A78D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
                29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
                29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
                29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
                                1EE1E48C0D748B19002999AD /* liblibssh2.a in Frameworks */,
                                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
                                1EDFC4E80E4A3EC0000E08AE /* Sparkle.framework in Frameworks */,
+                               1EF0D3740E6484EE0007A78D /* WebKit.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXGroup;
                        children = (
                                1EDFC4E70E4A3EC0000E08AE /* Sparkle.framework */,
+                               1EF0D3730E6484EE0007A78D /* WebKit.framework */,
                                1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
                        );
                        name = "Linked Frameworks";
                29B97317FDCFA39411CA2CEA /* Resources */ = {
                        isa = PBXGroup;
                        children = (
+                               1EF0D3670E6484750007A78D /* Help.html */,
                                1EE653510D75F5AC00D7A7FA /* Printers.plist */,
                                1EE1E3E30D7482E7002999AD /* gradient.png */,
                                8D1107310486CEB800E47090 /* Info.plist */,
                                1EE1E3E50D7482E7002999AD /* gradient.png in Resources */,
                                1EE653530D75F5AC00D7A7FA /* Printers.plist in Resources */,
                                1EDFC52B0E4A4224000E08AE /* MainMenu.xib in Resources */,
+                               1EF0D3690E6484750007A78D /* Help.html in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        name = Printers.plist;
                        sourceTree = "<group>";
                };
+               1EF0D3670E6484750007A78D /* Help.html */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               1EF0D3680E6484750007A78D /* English */,
+                       );
+                       name = Help.html;
+                       sourceTree = "<group>";
+               };
 /* End PBXVariantGroup section */
 
 /* Begin XCBuildConfiguration section */
index 4028272328d2beab74e08c2d29f76a0ef2355b74..1ac8a6253df228d4e1bbda0ebba65fd17de72094 100644 (file)
@@ -16,7 +16,7 @@
 
 #import <Cocoa/Cocoa.h>
 #import "DraggableImageView.h"
-
+#import <WebKit/WebKit.h>
 
 @interface AppController : NSObject
 {
        NSArray *printers;
        
        IBOutlet NSWindow *window;
+       
+       // help
+       IBOutlet NSWindow *helpWindow;
+       IBOutlet WebView *helpWebView;
 }
 
 - (IBAction)print:(id)sender;
index bf87a976b42aff73e347d73e19239449c455c0c5..2cd9d9dba6e972359efa2aab11ce9728ea57a890 100644 (file)
@@ -20,6 +20,7 @@
 #import <arpa/inet.h>
 #include <netdb.h>
 #include <stdlib.h>
+#include <WebKit/WebKit.h>
 
 @interface AppController (Private)
 - (void)setStatus:(NSString *)msg isError:(BOOL)error;
        }
 }
 
+/**
+ * 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.