diff --git a/CHDocumentationBrowser.xib b/CHDocumentationBrowser.xib index 43ae275..5cbca0f 100644 --- a/CHDocumentationBrowser.xib +++ b/CHDocumentationBrowser.xib @@ -23,10 +23,11 @@ YES + + - YES @@ -187,7 +188,7 @@ IGKArrayController - + 274 YES @@ -451,17 +452,17 @@ 274 YES - + 290 YES - - + + 257 {{590, 4}, {18, 18}} - - + + -1 YES @@ -489,9 +490,9 @@ - + _addOption: - + -2038284033 36 @@ -504,12 +505,12 @@ 75 - - + + -2147483391 {{570, 4}, {18, 18}} - - + + -1 YES @@ -533,9 +534,9 @@ - + _deleteOption: - + -2038284033 36 @@ -545,10 +546,10 @@ - + 256 {{7, 3}, {58, 19}} - + -1 YES @@ -614,11 +615,11 @@ - + 256 {{71, 3}, {167, 19}} - - + + -1 YES @@ -676,7 +677,7 @@ {{71, 3}, {167, 19}} YES - + YES YES @@ -702,7 +703,7 @@ - + YES YES @@ -719,23 +720,23 @@ 2 {{7, 3}, {58, 19}} {{71, 3}, {167, 19}} - - + + 0 0 YES - + 290 YES - - + + 257 {{590, 4}, {18, 18}} - - + + -1 YES @@ -759,9 +760,9 @@ - + _addOption: - + -2038284033 36 @@ -770,12 +771,12 @@ 75 - - + + 257 {{570, 4}, {18, 18}} - - + + -1 YES @@ -799,9 +800,9 @@ - + _deleteOption: - + -2038284033 36 @@ -811,10 +812,10 @@ - + 256 {{37, 3}, {116, 19}} - + -1 YES @@ -917,10 +918,10 @@ - + 256 {{159, 3}, {99, 19}} - + -1 YES @@ -1024,11 +1025,11 @@ - + 256 {{264, 4}, {160, 18}} - - + + YES 343014976 @@ -1066,7 +1067,7 @@ {{264, 4}, {160, 18}} YES - + YES YES @@ -1093,7 +1094,7 @@ - + YES YES @@ -1106,7 +1107,7 @@ - + YES YES @@ -1124,23 +1125,23 @@ {{37, 3}, {116, 19}} {{159, 3}, {99, 19}} {{264, 4}, {160, 18}} - - + + 0 0 YES - + 290 YES - - + + 257 {{590, 4}, {18, 18}} - - + + -1 YES @@ -1164,9 +1165,9 @@ - + _addOption: - + -2038284033 36 @@ -1175,12 +1176,12 @@ 75 - - + + 257 {{570, 4}, {18, 18}} - - + + -1 YES @@ -1204,9 +1205,9 @@ - + _deleteOption: - + -2038284033 36 @@ -1216,10 +1217,10 @@ - + 256 {{37, 3}, {116, 19}} - + -1 YES @@ -1274,10 +1275,10 @@ - + 256 {{159, 3}, {99, 19}} - + -1 YES @@ -1321,11 +1322,11 @@ - + 256 {{264, 4}, {160, 18}} - - + + YES 343014976 @@ -1358,7 +1359,7 @@ {{264, 4}, {160, 18}} YES - + YES YES @@ -1385,7 +1386,7 @@ - + YES YES @@ -1398,7 +1399,7 @@ - + YES YES @@ -1416,22 +1417,22 @@ {{37, 3}, {116, 19}} {{159, 3}, {99, 19}} {{264, 4}, {160, 18}} - - + + 0 0 YES - + 290 YES - - + + 257 {{590, 4}, {18, 18}} - + -1 YES @@ -1456,9 +1457,9 @@ - + _addOption: - + -2038284033 36 @@ -1467,12 +1468,12 @@ 75 - - + + 257 {{570, 4}, {18, 18}} - - + + -1 YES @@ -1496,9 +1497,9 @@ - + _deleteOption: - + -2038284033 36 @@ -1508,10 +1509,10 @@ - + 256 {{37, 3}, {68, 19}} - + -1 YES @@ -1566,10 +1567,10 @@ - + 256 {{111, 3}, {46, 19}} - + -1 YES @@ -1613,11 +1614,11 @@ - + 256 {{163, 3}, {155, 19}} - - + + -1 YES @@ -1880,7 +1881,7 @@ {{163, 3}, {155, 19}} YES - + YES YES @@ -1907,7 +1908,7 @@ - + YES YES @@ -1920,7 +1921,7 @@ - + YES YES @@ -1938,8 +1939,8 @@ {{37, 3}, {68, 19}} {{111, 3}, {46, 19}} {{163, 3}, {155, 19}} - - + + 0 0 YES @@ -1947,7 +1948,7 @@ {{1, 1}, {618, 100}} - + @@ -1991,8 +1992,8 @@ YES YES - - + + YES @@ -2015,9 +2016,9 @@ YES YES - - - + + + YES @@ -2044,9 +2045,9 @@ YES YES - - - + + + YES @@ -2073,9 +2074,9 @@ YES YES - - - + + + YES @@ -2096,10 +2097,10 @@ YES - - - - + + + + YES @@ -2298,6 +2299,7 @@ {635, 466} + NSView @@ -2308,272 +2310,282 @@ 274 YES - + 274 YES - - - 258 + + + 274 YES - - - 274 + + + 258 YES - - - 290 + + + 274 YES - - + + 290 - {{9, 8}, {291, 14}} - - 2 - YES - - 69336641 - 4196352 - - - LucidaGrande-Bold - 11 - 16 - - - - 6 - System - controlColor - + + YES + + + 290 + {{9, 8}, {291, 14}} + + 2 + YES + + 69336641 + 4196352 + + + LucidaGrande-Bold + 11 + 16 + + + + 6 + System + controlColor + + + + 2 + MC4zNDkwMTk2MTY4IDAuMzQ5MDE5NjE2OCAwLjM0OTAxOTYxNjgAA + + YES + YES + NO + + 2 + MSAxIDEAA + + + YES + + YES + NSColor + NSFont + NSOriginalFont + NSParagraphStyle + NSShadow + + + YES + + + + + 2 + + + + -1 + + + + + + 1 + MC4zMjk3MTQ5MjQxIDAuMzc5MjE3MjY3IDAuNDMzNjczNDcxMgA + + + 1 + MC41NjA2NDczNjg0IDAuNjA1Mzg4OTk5IDAuNjU4MTYzMjQ5NQA + + + - - 2 - MC4zNDkwMTk2MTY4IDAuMzQ5MDE5NjE2OCAwLjM0OTAxOTYxNjgAA + + + 289 + {{312, 7}, {110, 17}} + + 2 + YES + + -2080244224 + 134348800 + Open in Browser + + + -2038152961 + 164 + + + 400 + 75 + - YES - YES - NO - - 2 - MSAxIDEAA + + {434, 31} + + 2 + + 2 + MC45MjU0OTAyNjAxIDAuOTI1NDkwMjYwMSAwLjkyNTQ5MDI2MDEAA + + + 2 + MC44NTQ5MDIwMjkgMC44NTQ5MDIwMjkgMC44NTQ5MDIwMjkAA + + + 1 + MC42MTk2MDA4MzI1IDAuNjYxMTkxOTk5OSAwLjcxOTM4Nzc2OTcAA + + + 1 + MC41NTc2NjQ2OTI0IDAuNTk4ODkyNTA5OSAwLjY0Mjg1NzEzNDMAA + + + 2 + MC41NTY4NjI3NzE1IDAuNTU2ODYyNzcxNSAwLjU1Njg2Mjc3MTUAA + + YES + NO + YES + NO + 0.30000001192092896 + 0.0 + + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF 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, 31}, {434, 395}} + + + 2 + + + + + YES YES - NSColor - NSFont - NSOriginalFont - NSParagraphStyle - NSShadow + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize YES - - - - - 2 - - - - -1 - - + + + - - 1 - MC4zMjk3MTQ5MjQxIDAuMzc5MjE3MjY3IDAuNDMzNjczNDcxMgA - - - 1 - MC41NjA2NDczNjg0IDAuNjA1Mzg4OTk5IDAuNjU4MTYzMjQ5NQA - - - - - - - 289 - {{312, 7}, {110, 17}} - - 2 - YES - - -2080244224 - 134348800 - Open in Browser - - - -2038152961 - 164 - - - 400 - 75 + YES + YES - {434, 31} - + {434, 426} + 2 - - 2 - MC45MjU0OTAyNjAxIDAuOTI1NDkwMjYwMSAwLjkyNTQ5MDI2MDEAA - - - 2 - MC44NTQ5MDIwMjkgMC44NTQ5MDIwMjkgMC44NTQ5MDIwMjkAA - - - 1 - MC42MTk2MDA4MzI1IDAuNjYxMTkxOTk5OSAwLjcxOTM4Nzc2OTcAA - - - 1 - MC41NTc2NjQ2OTI0IDAuNTk4ODkyNTA5OSAwLjY0Mjg1NzEzNDMAA - - - 2 - MC41NTY4NjI3NzE1IDAuNTU2ODYyNzcxNSAwLjU1Njg2Mjc3MTUAA - - YES - NO - YES - NO - 0.30000001192092896 - 0.0 - - - - 274 - - YES - - YES - Apple HTML pasteboard type - Apple PDF 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, 31}, {434, 395}} - - - 2 - - - - - - YES - - YES - WebKitDefaultFixedFontSize - WebKitDefaultFontSize - WebKitMinimumFontSize - - - YES - - - - - - - YES - YES + NSView {434, 426} - - 2 + + IGKResizeDelegatedView + + + + 256 + {{435, 0}, {200, 426}} + NSView - {434, 426} - - IGKResizeDelegatedView - - - - 256 - {{435, 0}, {200, 426}} - - NSView + {635, 426} + + YES + 2 + + NO + + YES + + YES + + + + + YES + + + + + + YES + + + YES + + + + YES + + YES + + + + + YES + + + + + + YES + + YES + + + + + YES + + + + + 0 + NO {635, 426} - YES - 2 - - NO - - YES - - YES - - - - - YES - - - - - - YES - - - YES - - - - YES - - YES - - - - - YES - - - - - - YES - - YES - - - - - YES - - - - - 0 - NO + NSView @@ -3720,7 +3732,7 @@ 7 2 - {{196, 475}, {350, 35}} + {{196, 477}, {300, 33}} 1685590016 Find IGKFindWindow @@ -3738,8 +3750,8 @@ YES - 268 - {{45, 8}, {221, 19}} + 266 + {{36, 8}, {184, 19}} YES @@ -3756,7 +3768,7 @@ 265 - {{276, 7}, {62, 19}} + {{229, 7}, {62, 19}} YES @@ -3788,7 +3800,7 @@ 268 - {{12, 8}, {21, 17}} + {{8, 8}, {21, 17}} YES @@ -3810,12 +3822,12 @@ - {350, 35} + {300, 33} IGKFindBackgroundView - {350, 35} + {300, 33} {{0, 0}, {1680, 1028}} @@ -4162,22 +4174,6 @@ 488 - - - value: advancedFilterPredicate - - - - - - value: advancedFilterPredicate - value - advancedFilterPredicate - 2 - - - 492 - changeSelectedFilterDocset: @@ -4570,6 +4566,30 @@ 846 + + + delegate + + + + 847 + + + + predicateEditor: + + + + 848 + + + + browserSplitViewContainer + + + + 850 + @@ -4658,7 +4678,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA YES - + Browser View @@ -5634,83 +5654,6 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA - - 741 - - - YES - - - - - - - 742 - - - YES - - - - - - 743 - - - - - 392 - - - YES - - - - - - - 393 - - - YES - - - - - - - 59 - - - - - 421 - - - YES - - - - - - 409 - - - YES - - - - - - 410 - - - - - 422 - - - 759 @@ -5864,6 +5807,92 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA + + 849 + + + YES + + + + + + 741 + + + YES + + + + + + + 743 + + + + + 742 + + + YES + + + + + + 392 + + + YES + + + + + + + 59 + + + + + 393 + + + YES + + + + + + + 409 + + + YES + + + + + + 421 + + + YES + + + + + + 422 + + + + + 410 + + + @@ -6222,9 +6251,9 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{243, 848}, {350, 35}} + {{243, 850}, {300, 33}} com.apple.InterfaceBuilder.CocoaPlugin - {{243, 848}, {350, 35}} + {{243, 850}, {300, 33}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6262,7 +6291,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA - 846 + 850 @@ -6521,6 +6550,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA findPanelSegmentedControl: noselectionSearchField: openInSafari: + predicateEditor: rightFilterGroupByMenu: rightFilterSearchField: toggleRightFilterBar: @@ -6542,6 +6572,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA id id id + id @@ -6552,6 +6583,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA backForwardButton backForwardManager browserSplitView + browserSplitViewContainer browserToolbar browserTopbar browserView @@ -6606,6 +6638,7 @@ ZQCUhAEqhIQLe0NHU2l6ZT1kZH2aAIOQAAAAAAAAAIaGA NSView NSView NSView + NSView NSTextField NSTextField WebView diff --git a/IGKArrayController.m b/IGKArrayController.m index 12669fc..7b47f07 100644 --- a/IGKArrayController.m +++ b/IGKArrayController.m @@ -47,7 +47,6 @@ - (void)fetch:(void (^)(NSArray *managedObjectIDs, BOOL fetchContainsVip))comple NSArray *copiedCurrentSortDescriptors = [currentSortDescriptors copy]; NSManagedObjectID *vipObjectID = [vipObject objectID]; - NSLog(@"START"); isSearching = YES; startedSearchTimeInterval = [NSDate timeIntervalSinceReferenceDate]; [self performSelector:@selector(doTimeout) withObject:nil afterDelay:timeoutInterval]; @@ -91,7 +90,6 @@ - (void)fetch:(void (^)(NSArray *managedObjectIDs, BOOL fetchContainsVip))comple //Run the completion block on the main thread dispatch_async(dispatch_get_main_queue(), ^{ - NSLog(@"END"); isSearching = NO; if ([delegate respondsToSelector:@selector(arrayControllerFinishedSearching:)]) @@ -108,15 +106,11 @@ - (void)refresh - (void)doTimeout { - NSLog(@"Do timeout"); - NSLog(@"isSearching = %d", isSearching); if (!isSearching) return; - NSLog(@"startedSearchTimeInterval + timeoutInterval = %lf, [NSDate timeIntervalSinceReferenceDate] = %lf", startedSearchTimeInterval + timeoutInterval, [NSDate timeIntervalSinceReferenceDate]); if (startedSearchTimeInterval + timeoutInterval >= [NSDate timeIntervalSinceReferenceDate]) return; - NSLog(@"[delegate respondsToSelector:@selector(arrayControllerTimedOut:)] = %d", [delegate respondsToSelector:@selector(arrayControllerTimedOut:)]); if ([delegate respondsToSelector:@selector(arrayControllerTimedOut:)]) [delegate arrayControllerTimedOut:self]; } diff --git a/IGKDocRecordManagedObject.m b/IGKDocRecordManagedObject.m index c1b6a5f..d25f640 100644 --- a/IGKDocRecordManagedObject.m +++ b/IGKDocRecordManagedObject.m @@ -190,6 +190,26 @@ + (IGKDocRecordManagedObject *)resolveURL:(NSURL *)url inContext:(NSManagedObjec return [items objectAtIndex:0]; } +- (NSString *)pageTitle:(IGKHTMLDisplayTypeMask)mask +{ + NSString *name = [self valueForKey:@"name"]; + NSMutableArray *tocComponents = [[self class] tocComponentsForMask:mask]; + + //Remove "all" + [tocComponents removeObject:@"all"]; + + //Titleize + NSArray *tocComponentsArray = [tocComponents valueForKey:@"capitalizedString"]; + + //Join using commas + NSString *tocComponentsString = [tocComponentsArray componentsJoinedByString:@", "]; + + if ([tocComponentsString length]) + return [name stringByAppendingFormat:@" (%@)", tocComponentsString]; + else + return name; +} + + (NSString *)entityNameFromURLComponentExtension:(NSString *)ext { if ([ext isEqual:@"class"]) @@ -288,19 +308,8 @@ - (NSString *)URLComponent return [n stringByAppendingFormat:@".%@", [self URLComponentExtension]]; } -- (NSURL *)docURL:(IGKHTMLDisplayTypeMask)tocMask ++ (NSMutableArray *)tocComponentsForMask:(IGKHTMLDisplayTypeMask)tocMask { - IGKDocSetManagedObject *docset = [self valueForKey:@"docset"]; - NSString *host = [docset shortPlatformName];; - - NSString *containerComponent = nil; - if ([self hasKey:@"container"]) - containerComponent = [[self valueForKey:@"container"] URLComponent]; - - NSString *itemComponent = [self URLComponent]; - - - NSString *tocComponent = nil; NSMutableArray *tocComponents = [[NSMutableArray alloc] init]; if (tocMask & IGKHTMLDisplayType_All) [tocComponents addObject:@"all"]; @@ -324,6 +333,23 @@ - (NSURL *)docURL:(IGKHTMLDisplayTypeMask)tocMask if (![tocComponents count]) [tocComponents addObject:@"all"]; + return tocComponents; +} +- (NSURL *)docURL:(IGKHTMLDisplayTypeMask)tocMask +{ + IGKDocSetManagedObject *docset = [self valueForKey:@"docset"]; + NSString *host = [docset shortPlatformName];; + + NSString *containerComponent = nil; + if ([self hasKey:@"container"]) + containerComponent = [[self valueForKey:@"container"] URLComponent]; + + NSString *itemComponent = [self URLComponent]; + + + NSString *tocComponent = nil; + NSArray *tocComponents = [[self class] tocComponentsForMask:tocMask]; + tocComponent = [tocComponents componentsJoinedByString:@"."]; diff --git a/IGKFindWindow.m b/IGKFindWindow.m index 8e0626e..94cb753 100644 --- a/IGKFindWindow.m +++ b/IGKFindWindow.m @@ -23,29 +23,59 @@ - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backi return self; } -/* -- (BOOL)resignFirstResponder + +//This is a bit of a hack to ensure the parent's window controller gets action messages. We forward everything we don't respond to, to the parent's window controller +- (id)actionForwardee +{ + return [[self parentWindow] windowController]; +} +- (BOOL)respondsToSelector:(SEL)aSelector +{ + if ([super respondsToSelector:aSelector]) + return YES; + if ([[self actionForwardee] respondsToSelector:aSelector]) + return YES; + return NO; +} +- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector +{ + if ([super respondsToSelector:aSelector]) + return [super methodSignatureForSelector:aSelector]; + + id forwardee = [self actionForwardee]; + if ([forwardee respondsToSelector:aSelector]) + return [forwardee methodSignatureForSelector:aSelector]; + + return [super methodSignatureForSelector:aSelector]; +} +- (void)forwardInvocation:(NSInvocation *)anInvocation { - if (![self parentWindow]) - return; - if (ignoreResponderChanges) - return; + id forwardee = [self actionForwardee]; - [controller setShown:NO]; - return [super resignFirstResponder]; + if ([forwardee respondsToSelector:[anInvocation selector]]) + { + [anInvocation invokeWithTarget:forwardee]; + } + else + { + [super forwardInvocation:anInvocation]; + } } -- (void)resignMainWindow +- (void)becomeKeyWindow +{ + [super becomeKeyWindow]; + + //If this window becomes key, we should make the parent window main + [[self parentWindow] makeMainWindow]; +} +- (void)becomeMainWindow { - if (![self parentWindow]) - return; - if (ignoreResponderChanges) - return; + [super becomeMainWindow]; - [controller setShown:NO]; - [super resignMainWindow]; + //Ditto here. For some reason Apple sends -becomeKeyWindow first then -becomeMainWindow + [[self parentWindow] makeMainWindow]; } -*/ - (BOOL)canBecomeKeyWindow { diff --git a/IGKTableOfContentsView.m b/IGKTableOfContentsView.m index 326b1f8..2dc5286 100644 --- a/IGKTableOfContentsView.m +++ b/IGKTableOfContentsView.m @@ -262,22 +262,22 @@ - (void)viewWillMoveToWindow:(NSWindow *)window { if (window) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResignMain:) name:NSWindowDidResignMainNotification object:window]; } else { - [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:[self window]]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:[self window]]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeMainNotification object:[self window]]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignMainNotification object:[self window]]; } } -- (void)windowDidBecomeKey:(NSNotification *)notif +- (void)windowDidBecomeMain:(NSNotification *)notif { [splitView setColor:[NSColor colorWithCalibratedRed:0.591 green:0.626 blue:0.684 alpha:1.000]]; [self setNeedsDisplay:YES]; } -- (void)windowDidResignKey:(NSNotification *)notif +- (void)windowDidResignMain:(NSNotification *)notif { [splitView setColor:[NSColor colorWithCalibratedRed:0.647 green:0.647 blue:0.647 alpha:1.000]]; @@ -285,7 +285,7 @@ - (void)windowDidResignKey:(NSNotification *)notif } - (BOOL)isActive { - return [[self window] isKeyWindow]; + return [[self window] isMainWindow]; } diff --git a/IGKWindowController.h b/IGKWindowController.h index 14e0c11..cce317c 100644 --- a/IGKWindowController.h +++ b/IGKWindowController.h @@ -52,6 +52,7 @@ typedef enum { IBOutlet NSSegmentedControl *backForwardButton; IBOutlet IGKBackForwardManager *backForwardManager; + IBOutlet NSView *browserSplitViewContainer; IBOutlet NSSplitView *browserSplitView; IBOutlet NSView *browserView; @@ -188,6 +189,8 @@ typedef enum { - (BOOL)filterBarTableRowIsGroup:(NSInteger)row; +- (IBAction)predicateEditor:(id)sender; + //Find Panel - (IBAction)closeFindPanel:(id)sender; - (IBAction)findPanelSearchField:(id)sender; diff --git a/IGKWindowController.m b/IGKWindowController.m index 113c0cd..579cc75 100644 --- a/IGKWindowController.m +++ b/IGKWindowController.m @@ -254,11 +254,9 @@ - (void)windowDidLoad [advancedController setSmartSortDescriptors:[NSArray arrayWithObject:sideSortDescriptor]]; + if ([searchViewPredicateEditor numberOfRows] > 0) + [searchViewPredicateEditor removeRowsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [searchViewPredicateEditor numberOfRows])] includeSubrows:YES]; [searchViewPredicateEditor addRow:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ruleEditorRowsDidChange:) name:NSRuleEditorRowsDidChangeNotification object:searchViewPredicateEditor]; - - //[[WebPreferences standardPreferences] setMinimumFontSize:12]; - //[[WebPreferences standardPreferences] setMinimumLogicalFontSize:12]; [[browserWebView preferences] setDefaultFontSize:16]; [[browserWebView preferences] setDefaultFixedFontSize:16]; @@ -474,6 +472,8 @@ - (void)setMode:(int)modeIndex } else if (modeIndex == CHDocumentationBrowserUIMode_AdvancedSearch) { + [self closeFindPanel:nil]; + [[searchViewField window] makeFirstResponder:searchViewField]; } } @@ -712,9 +712,9 @@ - (void)startIndexing [browserTopbar setFrame:topBarFrame]; [browserTopbar setHidden:YES]; - NSRect browserViewFrame = [browserSplitView frame]; + NSRect browserViewFrame = [browserSplitViewContainer frame]; browserViewFrame.size.height += topBarFrame.size.height; - [browserSplitView setFrame:browserViewFrame]; + [browserSplitViewContainer setFrame:browserViewFrame]; [twoPaneSplitView setColorIsEnabled:YES]; [twoPaneSplitView setColor:[NSColor colorWithCalibratedRed:0.166 green:0.166 blue:0.166 alpha:1.000]]; @@ -764,14 +764,14 @@ - (void)stopIndexing [browserTopbar setHidden:NO]; //Geometry for the browser container - NSRect browserViewFrame = [browserSplitView frame]; + NSRect browserViewFrame = [browserSplitViewContainer frame]; browserViewFrame.size.height -= topBarFrame.size.height; //Animate [NSAnimationContext beginGrouping]; [[browserTopbar animator] setFrame:topBarFrame]; - [[browserSplitView animator] setFrame:browserViewFrame]; + [[browserSplitViewContainer animator] setFrame:browserViewFrame]; [NSAnimationContext endGrouping]; } @@ -818,8 +818,8 @@ - (IBAction)changeSelectedFilterDocset:(id)sender [self executeSearch:sideSearchViewField]; } -- (void)ruleEditorRowsDidChange:(NSNotification *)notification -{ +- (IBAction)predicateEditor:(id)sender +{ //Work out the new height of the rule editor NSUInteger numRows = [searchViewPredicateEditor numberOfRows]; CGFloat height = numRows * [searchViewPredicateEditor rowHeight]; @@ -859,17 +859,17 @@ - (void)setBrowserActive:(BOOL)active if (superview) { [noselectionView removeFromSuperview]; - [browserSplitView setFrame:[noselectionView frame]]; - [superview addSubview:browserSplitView]; + [browserSplitViewContainer setFrame:[noselectionView frame]]; + [superview addSubview:browserSplitViewContainer]; } } else { - id superview = [browserSplitView superview]; + id superview = [browserSplitViewContainer superview]; if (superview) { - [browserSplitView removeFromSuperview]; - [noselectionView setFrame:[browserSplitView frame]]; + [browserSplitViewContainer removeFromSuperview]; + [noselectionView setFrame:[browserSplitViewContainer frame]]; [superview addSubview:noselectionView]; } @@ -1491,7 +1491,7 @@ - (void)loadDocIntoBrowser [self loadManagedObject:(IGKDocRecordManagedObject *)currentSelectionObject tableOfContentsMask:[self tableOfContentsSelectedDisplayTypeMask]]; - [self recordHistoryForURL:[(IGKDocRecordManagedObject *)currentSelectionObject docURL:[self tableOfContentsSelectedDisplayTypeMask]] title:[currentSelectionObject valueForKey:@"name"]]; + [self recordHistoryForURL:[(IGKDocRecordManagedObject *)currentSelectionObject docURL:[self tableOfContentsSelectedDisplayTypeMask]] title:[currentSelectionObject pageTitle:[self tableOfContentsSelectedDisplayTypeMask]]]; } - (IBAction)openInSafari:(id)sender @@ -1529,8 +1529,8 @@ - (IBAction)noselectionSearchField:(id)sender if (superview) { [noselectionView removeFromSuperview]; - [browserSplitView setFrame:[noselectionView frame]]; - [superview addSubview:browserSplitView]; + [browserSplitViewContainer setFrame:[noselectionView frame]]; + [superview addSubview:browserSplitViewContainer]; } [self loadURL:[NSURL URLWithString:url] recordHistory:YES]; @@ -1702,7 +1702,6 @@ - (void)setRightFilterBarShown:(BOOL)shown - (void)arrayControllerTimedOut:(IGKArrayController *)ac { - NSLog(@"ac == sideSearchController = %@ = %@", ac, sideSearchController); if (ac == sideSearchController) [sideSearchIndicator startAnimation:nil]; } @@ -1725,9 +1724,13 @@ - (void)viewResized:(id)resizedView - (IBAction)doFindPanelAction:(id)sender { + if (![self isInValidStateForFindPanel]) + return; + [self relayoutFindPanel]; [[self window] addChildWindow:findWindow ordered:NSWindowAbove]; + [findWindow setParentWindow:[self window]]; [findWindow makeKeyAndOrderFront:nil]; [[self window] makeMainWindow]; } @@ -1754,17 +1757,39 @@ - (IBAction)findPanelSegmentedControl:(id)sender } - (IBAction)findPanelPrevious:(id)sender { + if (![self isInValidStateForFindPanel]) + return; + [browserWebView searchFor:[findSearchField stringValue] direction:NO caseSensitive:NO wrap:YES]; } - (IBAction)findPanelNext:(id)sender { + if (![self isInValidStateForFindPanel]) + return; + [browserWebView searchFor:[findSearchField stringValue] direction:YES caseSensitive:NO wrap:YES]; } -- (void)relayoutFindPanel +- (BOOL)isInValidStateForFindPanel { if (![browserWebView window]) + { [self closeFindPanel:self]; + return NO; + } + if (currentModeIndex == CHDocumentationBrowserUIMode_AdvancedSearch) + { + [self closeFindPanel:self]; + return NO; + } + + return YES; +} + +- (void)relayoutFindPanel +{ + if (![self isInValidStateForFindPanel]) + return; NSRect newFindViewFrame = [findView frame]; newFindViewFrame.origin.y = [browserWebViewContainer frame].size.height - newFindViewFrame.size.height + 1;