Permalink
Browse files

Merge branch 'master' of github.com:beelsebob/Stash

  • Loading branch information...
2 parents 6e27347 + dab3e86 commit e8556d7ee887df6afef570ca34a367d7e14c145b @beelsebob committed Mar 3, 2013
Showing with 242 additions and 376 deletions.
  1. +1 −0 Stash/STAAppDelegate.h
  2. +26 −11 Stash/STAAppDelegate.m
  3. +215 −365 Stash/en.lproj/MainMenu.xib
View
@@ -27,6 +27,7 @@
@property (weak) IBOutlet NSTableView *indexingDocsetsView;
@property (weak) IBOutlet NSScrollView *indexingDocsetsContainer;
@property (weak) IBOutlet NSView *docsetsNotFoundView;
+@property (weak) IBOutlet NSLayoutConstraint *findBarHeightConstraint;
- (IBAction)toggleStashWindow:(id)sender;
- (IBAction)search:(id)sender;
View
@@ -68,6 +68,8 @@ - (void)setDocsets:(NSArray *)docsets
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
_docsetArrayEditingQueue = dispatch_queue_create("org.beelsebob.Stash.docsetArrayEditing", DISPATCH_QUEUE_SERIAL);
+
+ [[self findBarHeightConstraint] setConstant:0.0f];
[self setPreferencesController:[[STAPreferencesController alloc] initWithNibNamed:@"STAPreferencesController" bundle:nil]];
[[self preferencesController] setDelegate:self];
@@ -85,6 +87,11 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyRegular];
}
+
+ if (![[self preferencesController] appShouldHideWhenNotActive])
+ {
+ [self toggleStashWindow:nil];
+ }
unichar c = [[self preferencesController] keyboardShortcutCharacter];
[[self openStashMenuItem] setKeyEquivalent:[NSString stringWithCharacters:&c length:1]];
@@ -179,6 +186,16 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
});
}
+- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)hasVisibleWindows
+{
+ if (!hasVisibleWindows)
+ {
+ [self toggleStashWindow:nil];
+ }
+
+ return YES;
+}
+
- (void)dealloc
{
dispatch_release(_docsetArrayEditingQueue);
@@ -190,16 +207,12 @@ - (void)showFindUI
if (![self isFindUIShowing])
{
[self setFindUIShowing:YES];
- NSRect currentFrame = [[self resultWebView] frame];
- currentFrame.size.height -= 25.0f;
[NSAnimationContext runAnimationGroup:^ (NSAnimationContext *ctx)
{
- [[[self resultWebView] animator] setFrame:currentFrame];
+ [ctx setDuration:0.15];
+ [[[self findBarHeightConstraint] animator] setConstant:25.0f];
}
- completionHandler:^()
- {
- [[self resultWebView] setFrame:currentFrame];
- }];
+ completionHandler:^(){}];
}
}
@@ -214,9 +227,8 @@ - (IBAction)hideSearchBar:(id)sender
[self setFindUIShowing:NO];
[NSAnimationContext runAnimationGroup:^ (NSAnimationContext *ctx)
{
- NSRect currentFrame = [[self resultWebView] frame];
- currentFrame.size.height += 25.0f;
- [[[self resultWebView] animator] setFrame:currentFrame];
+ [ctx setDuration:0.15];
+ [[[self findBarHeightConstraint] animator] setConstant:0.0f];
}
completionHandler:^(){}];
}
@@ -581,7 +593,10 @@ - (IBAction)toggleStashWindow:(id)sender
- (void)cancelOperation:(id)sender
{
- [self toggleStashWindow:sender];
+ if ([[self preferencesController] appShouldHideWhenNotActive])
+ {
+ [self toggleStashWindow:sender];
+ }
}
- (void)windowDidResignKey:(NSNotification *)notification
Oops, something went wrong.

0 comments on commit e8556d7

Please sign in to comment.