Skip to content

Commit

Permalink
Few minor UI bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
atg committed Apr 20, 2010
1 parent a98b8fe commit 527080d
Show file tree
Hide file tree
Showing 7 changed files with 620 additions and 509 deletions.
929 changes: 481 additions & 448 deletions CHDocumentationBrowser.xib

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions IGKArrayController.m
Expand Up @@ -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];
Expand Down Expand Up @@ -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:)])
Expand All @@ -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];
}
Expand Down
50 changes: 38 additions & 12 deletions IGKDocRecordManagedObject.m
Expand Up @@ -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"])
Expand Down Expand Up @@ -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"];
Expand 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:@"."];


Expand Down
62 changes: 46 additions & 16 deletions IGKFindWindow.m
Expand Up @@ -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
{
Expand Down
14 changes: 7 additions & 7 deletions IGKTableOfContentsView.m
Expand Up @@ -262,30 +262,30 @@ - (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]];

[self setNeedsDisplay:YES];
}
- (BOOL)isActive
{
return [[self window] isKeyWindow];
return [[self window] isMainWindow];
}


Expand Down
3 changes: 3 additions & 0 deletions IGKWindowController.h
Expand Up @@ -52,6 +52,7 @@ typedef enum {
IBOutlet NSSegmentedControl *backForwardButton;
IBOutlet IGKBackForwardManager *backForwardManager;

IBOutlet NSView *browserSplitViewContainer;
IBOutlet NSSplitView *browserSplitView;

IBOutlet NSView *browserView;
Expand Down Expand Up @@ -188,6 +189,8 @@ typedef enum {

- (BOOL)filterBarTableRowIsGroup:(NSInteger)row;

- (IBAction)predicateEditor:(id)sender;

//Find Panel
- (IBAction)closeFindPanel:(id)sender;
- (IBAction)findPanelSearchField:(id)sender;
Expand Down

0 comments on commit 527080d

Please sign in to comment.