Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3fc650d
Showing
43 changed files
with
10,628 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} | ||
{\colortbl;\red255\green255\blue255;} | ||
\paperw9840\paperh8400 | ||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural | ||
|
||
\f0\b\fs24 \cf0 Engineering: | ||
\b0 \ | ||
Some people\ | ||
\ | ||
|
||
\b Human Interface Design: | ||
\b0 \ | ||
Some other people\ | ||
\ | ||
|
||
\b Testing: | ||
\b0 \ | ||
Hopefully not nobody\ | ||
\ | ||
|
||
\b Documentation: | ||
\b0 \ | ||
Whoever\ | ||
\ | ||
|
||
\b With special thanks to: | ||
\b0 \ | ||
Mom\ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleDocumentTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>1</string> | ||
</array> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>ManDocument.icns</string> | ||
<key>CFBundleTypeName</key> | ||
<string>Man Page Document</string> | ||
<key>CFBundleTypeOSTypes</key> | ||
<array> | ||
<string>****</string> | ||
</array> | ||
<key>CFBundleTypeRole</key> | ||
<string>Editor</string> | ||
<key>NSDocumentClass</key> | ||
<string>ManDrakeDocument</string> | ||
</dict> | ||
</array> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleIdentifier</key> | ||
<string>org.sveinbjorn.ManDrake</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>ManDrake</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>2</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>2.0</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.6</string> | ||
<key>NSMainNibFile</key> | ||
<string>MainMenu</string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
</dict> | ||
</plist> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// | ||
// Prefix header for all source files of the 'ManDrake2' target in the 'ManDrake2' project | ||
// | ||
|
||
#ifdef __OBJC__ | ||
#import <Cocoa/Cocoa.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// MyDocument.h | ||
// ManDrake2 | ||
// | ||
// Created by Sveinbjorn Thordarson on 8/1/10. | ||
// Copyright 2010 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <WebKit/WebKit.h> | ||
#import <Cocoa/Cocoa.h> | ||
#import "UKSyntaxColoredTextDocument.h" | ||
#import "NoodleLineNumberView.h" | ||
#import "MarkerLineNumberView.h" | ||
|
||
@interface ManDrakeDocument : UKSyntaxColoredTextDocument | ||
{ | ||
IBOutlet WebView *webView; | ||
IBOutlet id refreshTypePopupButton; | ||
IBOutlet id refreshProgressIndicator; | ||
|
||
IBOutlet NSScrollView *scrollView; | ||
NoodleLineNumberView *lineNumberView; | ||
IBOutlet NSWindow *syntaxCheckerWindow; | ||
|
||
NSPoint currentScrollPosition; | ||
NSTimer *refreshTimer; | ||
} | ||
- (IBAction)refresh:(id)sender; | ||
- (IBAction)checkSyntax:(id)sender; | ||
- (void)syntaxClosed; | ||
- (void)drawWebView; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
// | ||
// MyDocument.m | ||
// ManDrake2 | ||
// | ||
// Created by Sveinbjorn Thordarson on 8/1/10. | ||
// Copyright 2010 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "ManDrakeDocument.h" | ||
#import "UKSyntaxColoredTextViewController.H" | ||
|
||
@implementation ManDrakeDocument | ||
|
||
- (id)init | ||
{ | ||
self = [super init]; | ||
if (self) | ||
{ | ||
refreshTimer = NULL; | ||
} | ||
return self; | ||
} | ||
|
||
- (NSString *)windowNibName | ||
{ | ||
return @"ManDrakeDocument"; | ||
} | ||
|
||
- (void)windowControllerDidLoadNib:(NSWindowController *) aController | ||
{ | ||
// set up line numbering for text view | ||
scrollView = [textView enclosingScrollView]; | ||
lineNumberView = [[MarkerLineNumberView alloc] initWithScrollView:scrollView]; | ||
[scrollView setVerticalRulerView:lineNumberView]; | ||
[scrollView setHasHorizontalRuler:NO]; | ||
[scrollView setHasVerticalRuler:YES]; | ||
[scrollView setRulersVisible:YES]; | ||
|
||
// Register for "text changed" notifications of the text storage: | ||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(textDidChange:) | ||
name: NSTextStorageDidProcessEditingNotification | ||
object: [textView textStorage]]; | ||
|
||
[super windowControllerDidLoadNib: aController]; | ||
} | ||
|
||
-(void)dealloc | ||
{ | ||
[lineNumberView release]; | ||
[super dealloc]; | ||
} | ||
|
||
#pragma mark Syntax checking | ||
|
||
- (IBAction)checkSyntax:(id)sender | ||
{ | ||
NSTask *cmd; | ||
NSPipe *outputPipe = [NSPipe pipe]; | ||
NSFileHandle *readHandle; | ||
|
||
cmd = [[NSTask alloc] init]; | ||
[cmd setLaunchPath: @"/usr/bin/nroff"]; | ||
[cmd setArguments: [NSArray arrayWithObjects: @"-c", @"/tmp/ManDrakeTemp.manText", nil]]; | ||
|
||
//direct the output of the task into a file handle for reading | ||
[cmd setStandardOutput: outputPipe]; | ||
[cmd setStandardError: outputPipe]; | ||
readHandle = [outputPipe fileHandleForReading]; | ||
|
||
//launch task | ||
[cmd launch]; | ||
[cmd waitUntilExit]; | ||
|
||
//get output in string | ||
NSString *outputStr = [[[NSString alloc] initWithData: [readHandle readDataToEndOfFile] encoding: NSUTF8StringEncoding] autorelease]; | ||
|
||
if ([outputStr length] == 0) //if the syntax report string is empty, we report syntax as OK | ||
outputStr = [NSString stringWithString: @"Syntax OK"]; | ||
|
||
[cmd release];//release the NSTask | ||
|
||
//report the result | ||
[NSApp beginSheet: syntaxCheckerWindow | ||
modalForWindow: [webView window] | ||
modalDelegate:nil | ||
didEndSelector: @selector(syntaxClosed) | ||
contextInfo:nil]; | ||
[NSApp runModalForWindow: syntaxCheckerWindow]; | ||
|
||
[syntaxCheckerWindow orderOut: self]; | ||
} | ||
|
||
- (void) syntaxClosed | ||
{ | ||
[NSApp endSheet:syntaxCheckerWindow]; | ||
[NSApp stopModal]; | ||
} | ||
|
||
#pragma mark Web Preview | ||
|
||
- (IBAction)refresh:(id)sender | ||
{ | ||
// generate preview | ||
[refreshProgressIndicator startAnimation: self]; | ||
[self drawWebView]; | ||
[refreshProgressIndicator stopAnimation: self]; | ||
} | ||
|
||
|
||
- (void)textDidChange:(NSNotification *)aNotification | ||
{ | ||
NSString *refreshText = [refreshTypePopupButton titleOfSelectedItem]; | ||
|
||
// use delayed timer | ||
if ([refreshText isEqualToString: @"delayed"]) | ||
{ | ||
if (refreshTimer != NULL) | ||
{ | ||
[refreshTimer invalidate]; | ||
refreshTimer = NULL; | ||
} | ||
refreshTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updatePreview) userInfo:nil repeats:NO]; | ||
|
||
} | ||
// or else do it for every change | ||
else if ([refreshText isEqualToString: @"live"]) | ||
{ | ||
[self refresh: self]; | ||
} | ||
} | ||
|
||
- (void)drawWebView | ||
{ | ||
// write man text to tmp document | ||
[[textView string] writeToFile: @"/tmp/ManDrakeTemp.manText" atomically: YES encoding: NSUTF8StringEncoding error: NULL]; | ||
|
||
// generate command string to create html from man text using nroff and cat2html | ||
NSString *cmdString = [NSString stringWithFormat: @"/usr/bin/nroff -mandoc /tmp/ManDrakeTemp.manText | %@ > /tmp/ManDrakeTemp.html", | ||
[[NSBundle mainBundle] pathForResource: @"cat2html" ofType: NULL] | ||
]; | ||
|
||
// run the command | ||
system([cmdString cStringUsingEncoding: NSUTF8StringEncoding]); | ||
|
||
// get the current scroll position of the document view of the web view | ||
NSScrollView *theScrollView = [[[[webView mainFrame] frameView] documentView] enclosingScrollView]; | ||
NSRect scrollViewBounds = [[theScrollView contentView] bounds]; | ||
currentScrollPosition=scrollViewBounds.origin; | ||
|
||
// tell the web view to load the generated, local html file | ||
[[webView mainFrame] loadRequest: [NSURLRequest requestWithURL: [NSURL fileURLWithPath: @"/tmp/ManDrakeTemp.html"]]]; | ||
|
||
} | ||
|
||
// delegate method we receive when it's done loading the html file. | ||
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame | ||
{ | ||
// restore the scroll position | ||
[[[[webView mainFrame] frameView] documentView] scrollPoint:currentScrollPosition]; | ||
} | ||
|
||
- (void)updatePreview | ||
{ | ||
[self refresh: self]; | ||
[refreshTimer invalidate]; | ||
refreshTimer = NULL; | ||
} | ||
|
||
#pragma mark UKSyntaxColored stuff | ||
|
||
-(NSString*) syntaxDefinitionFilename | ||
{ | ||
return @"Man"; | ||
} | ||
|
||
-(NSStringEncoding) stringEncoding | ||
{ | ||
return NSUTF8StringEncoding; | ||
} | ||
|
||
#pragma mark UKSyntaxColoredTextViewDelegate methods | ||
|
||
-(NSString *)syntaxDefinitionFilenameForTextViewController: (UKSyntaxColoredTextViewController *)sender | ||
{ | ||
return @"Man"; | ||
} | ||
|
||
-(NSDictionary*) syntaxDefinitionDictionaryForTextViewController: (UKSyntaxColoredTextViewController*)sender | ||
{ | ||
NSBundle* theBundle = [NSBundle mainBundle]; | ||
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile: [theBundle pathForResource: @"Man" ofType:@"plist"]]; | ||
if (!dict) | ||
{ | ||
NSLog(@"Failed to find the syntax dictionary"); | ||
} | ||
return dict; | ||
} | ||
|
||
|
||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// MarkerTextView.h | ||
// Line View Test | ||
// | ||
// Created by Paul Kim on 10/4/08. | ||
// Copyright (c) 2008 Noodlesoft, LLC. All rights reserved. | ||
// | ||
// Permission is hereby granted, free of charge, to any person | ||
// obtaining a copy of this software and associated documentation | ||
// files (the "Software"), to deal in the Software without | ||
// restriction, including without limitation the rights to use, | ||
// copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following | ||
// conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
// OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "NoodleLineNumberView.h" | ||
|
||
@interface MarkerLineNumberView : NoodleLineNumberView | ||
{ | ||
NSImage *markerImage; | ||
} | ||
|
||
@end |
Oops, something went wrong.