Permalink
Browse files

URLs

  • Loading branch information...
1 parent 081b232 commit 5862b97267683581382561d2e7f4e8a5a471ba80 Alex Gordon committed Mar 12, 2010
View
@@ -23,13 +23,13 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="42"/>
- <integer value="63"/>
+ <integer value="1"/>
+ <integer value="40"/>
+ <integer value="370"/>
<integer value="85"/>
<integer value="571"/>
- <integer value="370"/>
- <integer value="191"/>
- <integer value="1"/>
+ <integer value="63"/>
+ <integer value="190"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -104,19 +104,19 @@
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 136}, {200, 466}}</string>
<reference key="NSSuperview" ref="467360731"/>
- <string key="NSClassName">NSView</string>
+ <string key="NSClassName">IGKEaseInOutAnimatedView</string>
</object>
</object>
<string key="NSFrameSize">{200, 602}</string>
<reference key="NSSuperview" ref="883370765"/>
- <string key="NSClassName">NSView</string>
+ <string key="NSClassName">IGKEaseInOutAnimatedView</string>
</object>
<object class="BWCustomView" id="885798329">
<reference key="NSNextResponder" ref="883370765"/>
<int key="NSvFlags">258</int>
<string key="NSFrame">{{201, 0}, {555, 602}}</string>
<reference key="NSSuperview" ref="883370765"/>
- <string key="NSClassName">NSView</string>
+ <string key="NSClassName">IGKEaseInOutAnimatedView</string>
</object>
</object>
<string key="NSFrameSize">{756, 602}</string>
@@ -3825,6 +3825,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA</bytes>
<string>119.IBPluginDependency</string>
<string>122.IBPluginDependency</string>
<string>123.IBPluginDependency</string>
+ <string>189.CustomClassName</string>
<string>189.IBEditorWindowLastContentRect</string>
<string>189.IBPluginDependency</string>
<string>19.IBEditorWindowLastContentRect</string>
@@ -3947,6 +3948,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>IGKEaseInOutAnimatedView</string>
<string>{{70, 87}, {756, 602}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{593, 365}, {247, 404}}</string>
@@ -3985,7 +3987,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA</bytes>
<integer value="0"/>
<string>{{212, 639}, {166, 79}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{54, -70}, {830, 530}}</string>
+ <string>{{54, 4}, {830, 530}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4147,6 +4149,14 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA</bytes>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">IGKEaseInOutAnimatedView</string>
+ <string key="superclassName">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">IGKEaseInOutAnimatedView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">IGKMattePopUpButtonCell</string>
<string key="superclassName">NSPopUpButtonCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -4196,7 +4206,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA</bytes>
</object>
<object class="IBPartialClassDescription">
<string key="className">IGKTableOfContentsView</string>
- <string key="superclassName">NSView</string>
+ <string key="superclassName">IGKEaseInOutAnimatedView</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -4795,6 +4805,27 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA</bytes>
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Sparkle.framework/Headers/SUAppcast.h</string>
</object>
</object>
View
@@ -37,7 +37,8 @@ - (void)visitPage:(WebHistoryItem *)item
//If item has the same URL as currentItem, we ignore it
NSString *itemURL = [item URLString];
NSString *currentItemURL = [currentItem URLString];
- if ([itemURL length] && [currentItemURL length] && [[NSURL URLWithString:itemURL] isEqual:[NSURL URLWithString:currentItemURL]])
+ NSURL *newURL = [NSURL URLWithString:itemURL];
+ if ([itemURL length] && [currentItemURL length] && ([newURL isEqual:[NSURL URLWithString:currentItemURL]] || [[newURL scheme] isEqual:@"file"]))
{
return;
}
@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
+#import "IGKHTMLGenerator.h"
//Priorities of different objects when sorting the list in case of a tiebreak. From lowest priority to highest
typedef enum {
@@ -23,7 +24,8 @@ typedef enum {
}
-+ (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjectContext *)ctx;
++ (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjectContext *)ctx tableOfContentsMask:(IGKHTMLDisplayTypeMask *)tocMaskPointer;
+- (NSURL *)docURL:(IGKHTMLDisplayTypeMask)tocMask;
- (BOOL)isKindOfEntityNamed:(NSString *)entityName;
- (BOOL)hasKey:(NSString *)key;
@@ -22,20 +22,20 @@ - (CHSymbolButtonImageMask)iconMask;
@implementation IGKDocRecordManagedObject
-+ (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjectContext *)ctx
++ (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjectContext *)ctx tableOfContentsMask:(IGKHTMLDisplayTypeMask *)tocMaskPointer
{
NSLog(@"Resolve URL = %@, %@", url, ctx);
NSArray *components = [url pathComponents];
NSLog(@"components = %@", components);
/*
- ingr-doc:// <docset-family> / <docset-version> / <item-name> . <item-type>
- ingr-doc:// <docset-family> / <docset-version> / <container-name> . <container-type> / <item-name> . <item-type>
+ ingr-doc:// <docset-family> / <docset-version> / <table-of-contents> / <item-name> . <item-type>
+ ingr-doc:// <docset-family> / <docset-version> / <table-of-contents> / <container-name> . <container-type> / <item-name> . <item-type>
*/
- //There should be at least 3 components
- if ([components count] < 3)
+ //There should be at least 4 components
+ if ([components count] < 4)
return nil;
//Remove an initial "/" component
@@ -73,15 +73,51 @@ + (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjec
return nil;
IGKDocSetManagedObject *docset = [docsets objectAtIndex:0];
+
+
+ // <table-of-contents>
+ NSLog(@"tocMaskPointer = %d", tocMaskPointer);
+ if (tocMaskPointer)
+ {
+ NSString *tableOfContents = [components objectAtIndex:2];
+ NSArray *tableOfContentsItems = [tableOfContents componentsSeparatedByString:@"."];
+ IGKHTMLDisplayTypeMask tocMask = IGKHTMLDisplayType_None;
+
+ for (NSString *n in tableOfContentsItems)
+ {
+ if ([n isEqual:@"all"])
+ tocMask |= IGKHTMLDisplayType_All;
+ else if ([n isEqual:@"overview"])
+ tocMask |= IGKHTMLDisplayType_Overview;
+ else if ([n isEqual:@"tasks"])
+ tocMask |= IGKHTMLDisplayType_Tasks;
+ else if ([n isEqual:@"properties"])
+ tocMask |= IGKHTMLDisplayType_Properties;
+ else if ([n isEqual:@"methods"])
+ tocMask |= IGKHTMLDisplayType_Methods;
+ else if ([n isEqual:@"notifications"])
+ tocMask |= IGKHTMLDisplayType_Notifications;
+ else if ([n isEqual:@"delegate"])
+ tocMask |= IGKHTMLDisplayType_Delegate;
+ else if ([n isEqual:@"misc"])
+ tocMask |= IGKHTMLDisplayType_Misc;
+ else if ([n isEqual:@"bindings"])
+ tocMask |= IGKHTMLDisplayType_BindingListings;
+ }
+
+ NSLog(@"tocMask = %d", tocMask);
+ NSLog(@"tableOfContentsItems = %@", tableOfContentsItems);
+
+ *tocMaskPointer = tocMask;
+ }
- NSLog(@"docset = %@", docset);
// <container-name> . <container-type>
IGKDocSetManagedObject *container = nil;
- BOOL hasContainer = ([components count] >= 4);
+ BOOL hasContainer = ([components count] >= 5);
if (hasContainer)
{
- NSString *containerComponent = [components objectAtIndex:2];
+ NSString *containerComponent = [components objectAtIndex:3];
NSString *containerName = [containerComponent stringByDeletingPathExtension];
NSString *containerExtension = [containerComponent pathExtension];
@@ -108,22 +144,22 @@ + (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjec
NSLog(@"a");
// <item-name> . <item-type>
- NSString *itemComponent = [components objectAtIndex:2];
+ NSString *itemComponent = [components lastObject];
NSString *itemName = [itemComponent stringByDeletingPathExtension];
NSString *itemExtension = [itemComponent pathExtension];
if (![itemName length] || ![itemExtension length])
return nil;
NSLog(@"b");
-
+
NSString *itemEntity = [self entityNameFromURLComponentExtension:itemExtension];
if (![itemEntity length])
return nil;
NSLog(@"c");
-
+
NSFetchRequest *itemFetchRequest = [[NSFetchRequest alloc] init];
[itemFetchRequest setEntity:[NSEntityDescription entityForName:itemEntity inManagedObjectContext:ctx]];
@@ -249,7 +285,7 @@ - (NSString *)URLComponent
return [n stringByAppendingFormat:@".%@", [self URLComponentExtension]];
}
-- (NSURL *)docURL
+- (NSURL *)docURL:(IGKHTMLDisplayTypeMask)tocMask
{
IGKDocSetManagedObject *docset = [self valueForKey:@"docset"];
NSString *host = [docset shortPlatformName];;
@@ -260,6 +296,35 @@ - (NSURL *)docURL
NSString *itemComponent = [self URLComponent];
+
+ NSString *tocComponent = nil;
+ NSMutableArray *tocComponents = [[NSMutableArray alloc] init];
+ if (tocMask & IGKHTMLDisplayType_All)
+ [tocComponents addObject:@"all"];
+ if (tocMask & IGKHTMLDisplayType_Overview)
+ [tocComponents addObject:@"overview"];
+ if (tocMask & IGKHTMLDisplayType_Tasks)
+ [tocComponents addObject:@"tasks"];
+ if (tocMask & IGKHTMLDisplayType_Properties)
+ [tocComponents addObject:@"properties"];
+ if (tocMask & IGKHTMLDisplayType_Methods)
+ [tocComponents addObject:@"methods"];
+ if (tocMask & IGKHTMLDisplayType_Notifications)
+ [tocComponents addObject:@"notifications"];
+ if (tocMask & IGKHTMLDisplayType_Delegate)
+ [tocComponents addObject:@"delegate"];
+ if (tocMask & IGKHTMLDisplayType_Misc)
+ [tocComponents addObject:@"misc"];
+ if (tocMask & IGKHTMLDisplayType_BindingListings)
+ [tocComponents addObject:@"bindings"];
+
+ if (![tocComponents count])
+ [tocComponents addObject:@"all"];
+
+ tocComponent = [tocComponents componentsJoinedByString:@"."];
+
+
+
NSString *path = @"unknown";
if ([containerComponent length])
{
@@ -274,7 +339,7 @@ - (NSURL *)docURL
path = itemComponent;
}
- path = [[@"/" stringByAppendingPathComponent:[docset shortVersionName]] stringByAppendingPathComponent:path];
+ path = [[[@"/" stringByAppendingPathComponent:[docset shortVersionName]] stringByAppendingPathComponent:tocComponent] stringByAppendingPathComponent:path];
return [[NSURL alloc] initWithScheme:@"ingr-doc" host:host path:path];
}
View
@@ -7,7 +7,7 @@
//
#import <Cocoa/Cocoa.h>
-#import "IGKDocRecordManagedObject.h"
+@class IGKDocRecordManagedObject;
@class IGKFullScraper;
View
@@ -8,6 +8,7 @@
#import "IGKHTMLGenerator.h"
#import "IGKScraper.h"
+#import "IGKDocRecordManagedObject.h"
BOOL IGKHTMLDisplayTypeMaskIsSingle(IGKHTMLDisplayTypeMask mask)
{
View
@@ -28,6 +28,8 @@ - (void)sideSearchTableChangedSelection;
- (void)tableOfContentsChangedSelection;
- (void)registerDisplayTypeInTableView:(IGKHTMLDisplayType)type title:(NSString *)title;
+- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(IGKHTMLDisplayTypeMask)tableOfContentsMask;
+
- (void)setMode:(int)modeIndex;
- (IGKArrayController *)currentArrayController;
@@ -487,13 +489,20 @@ - (void)loadURL:(NSURL *)url recordHistory:(BOOL)recordHistory
else if ([[url scheme] isEqual:@"ingr-doc"])
{
NSManagedObjectContext *ctx = [[[NSApp delegate] valueForKey:@"kitController"] managedObjectContext];
- IGKDocRecordManagedObject *result = [IGKDocRecordManagedObject resolveURL:url inContext:ctx];
+
+ tableOfContentsMask = IGKHTMLDisplayType_None;
+ IGKDocRecordManagedObject *result = [IGKDocRecordManagedObject resolveURL:url inContext:ctx tableOfContentsMask:&tableOfContentsMask];
+
+ NSLog(@"result = %d, %d", result, tableOfContentsMask);
if (result)
{
- [self loadManagedObject:result];
- [self recordHistoryForURL:[result docURL] title:[result valueForKey:@"name"]];
+ [self setBrowserActive:YES];
+ [self loadManagedObject:result tableOfContentsMask:tableOfContentsMask];
+ //[self recordHistoryForURL:[result docURL] title:[result valueForKey:@"name"]];
}
+
+ [self reloadTableOfContents];
}
else
{
@@ -503,14 +512,14 @@ - (void)loadURL:(NSURL *)url recordHistory:(BOOL)recordHistory
[[browserWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
}
}
-- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo
+- (void)loadManagedObject:(IGKDocRecordManagedObject *)mo tableOfContentsMask:(IGKHTMLDisplayTypeMask)tableOfContentsMask
{
currentObjectIDInBrowser = [mo objectID];
IGKHTMLGenerator *generator = [[IGKHTMLGenerator alloc] init];
[generator setContext:[[[NSApp delegate] valueForKey:@"kitController"] managedObjectContext]];
[generator setManagedObject:mo];
- [generator setDisplayTypeMask:[self tableOfContentsSelectedDisplayTypeMask]];
+ [generator setDisplayTypeMask:tableOfContentsMask];
acceptableDisplayTypes = [generator acceptableDisplayTypes];
@@ -522,6 +531,7 @@ - (void)loadManagedObject:(IGKDocRecordManagedObject *)mo
}
- (void)recordHistoryForURL:(NSURL *)url title:(NSString *)title
{
+
WebHistoryItem *item = [[WebHistoryItem alloc] initWithURLString:[url absoluteString] title:title lastVisitedTimeInterval:[NSDate timeIntervalSinceReferenceDate]];
[backForwardManager visitPage:item];
}
@@ -1014,9 +1024,9 @@ - (void)loadDocIntoBrowser
tableOfContentsMask = dtmask;
- [self loadManagedObject:currentSelectionObject];
+ [self loadManagedObject:currentSelectionObject tableOfContentsMask:[self tableOfContentsSelectedDisplayTypeMask]];
- [self recordHistoryForURL:[currentSelectionObject docURL] title:[currentSelectionObject valueForKey:@"name"]];
+ [self recordHistoryForURL:[currentSelectionObject docURL:[self tableOfContentsSelectedDisplayTypeMask]] title:[currentSelectionObject valueForKey:@"name"]];
}
- (IBAction)openInSafari:(id)sender

0 comments on commit 5862b97

Please sign in to comment.