Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Improved: Code formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Shpakovski committed Jul 5, 2011
1 parent 926464d commit 219370f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Popup/ApplicationDelegate.m
Expand Up @@ -41,7 +41,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification

- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
// Remove the icon from the menu bar
// Explicitly remove the icon from the menu bar
self.menubarController = nil;

return NSTerminateNow;
Expand Down
2 changes: 2 additions & 0 deletions Popup/BackgroundView.m
Expand Up @@ -8,6 +8,8 @@

#define SEARCH_INSET 10

#pragma mark -

@implementation BackgroundView

@synthesize arrowX = _arrowX;
Expand Down
6 changes: 3 additions & 3 deletions Popup/MenubarController.m
Expand Up @@ -9,7 +9,8 @@ @implementation MenubarController

- (id)init
{
if ((self = [super init]))
self = [super init];
if (self != nil)
{
// Install status item into the menu bar
NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:STATUS_ITEM_VIEW_WIDTH];
Expand All @@ -33,8 +34,7 @@ - (void)dealloc

- (NSStatusItem *)statusItem
{
NSStatusItem *item = self.statusItemView.statusItem;
return item;
return self.statusItemView.statusItem;
}

#pragma mark -
Expand Down
7 changes: 1 addition & 6 deletions Popup/Panel.m
Expand Up @@ -4,12 +4,7 @@ @implementation Panel

- (BOOL)canBecomeKeyWindow;
{
return YES;
}

- (void)flagsChanged:(NSEvent *)theEvent;
{
[[self contentView] setNeedsDisplay:YES];
return YES; // Allow Search field to become the first responder
}

@end
1 change: 0 additions & 1 deletion Popup/PanelController.h
Expand Up @@ -34,6 +34,5 @@
- (void)openPanel;
- (void)closePanel;
- (NSRect)statusRectForWindow:(NSWindow *)window;
- (void)resetPanelHeight;

@end
16 changes: 6 additions & 10 deletions Popup/PanelController.m
Expand Up @@ -26,7 +26,7 @@ @implementation PanelController
- (id)initWithDelegate:(id<PanelControllerDelegate>)delegate
{
self = [super initWithWindowNibName:@"Panel"];
if (self)
if (self != nil)
{
_delegate = delegate;
}
Expand All @@ -53,9 +53,12 @@ - (void)awakeFromNib
[panel setOpaque:NO];
[panel setBackgroundColor:[NSColor clearColor]];

[self resetPanelHeight];
// Resize panel
NSRect panelRect = [[self window] frame];
panelRect.size.height = POPUP_HEIGHT;
[[self window] setFrame:panelRect display:NO];

// Track search results
// Follow search string
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(runSearch) name:NSControlTextDidChangeNotification object:self.searchField];
}

Expand Down Expand Up @@ -247,11 +250,4 @@ - (void)closePanel
});
}

- (void)resetPanelHeight
{
NSRect panelRect = [[self window] frame];
panelRect.size.height = POPUP_HEIGHT;
[[self window] setFrame:panelRect display:NO];
}

@end
2 changes: 1 addition & 1 deletion Popup/Popup-Info.plist
Expand Up @@ -25,7 +25,7 @@
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
10 changes: 9 additions & 1 deletion Popup/StatusItemView.m
Expand Up @@ -16,7 +16,9 @@ - (id)initWithStatusItem:(NSStatusItem *)statusItem
CGFloat itemWidth = [statusItem length];
CGFloat itemHeight = [[NSStatusBar systemStatusBar] thickness];
NSRect itemRect = NSMakeRect(0.0, 0.0, itemWidth, itemHeight);
if ((self = [super initWithFrame:itemRect]))
self = [super initWithFrame:itemRect];

if (self != nil)
{
_statusItem = [statusItem retain];
_statusItem.view = self;
Expand All @@ -29,6 +31,7 @@ - (void)dealloc
[_statusItem release];
[_image release];
[_alternateImage release];

[super dealloc];
}

Expand All @@ -37,6 +40,7 @@ - (void)dealloc
- (void)drawRect:(NSRect)dirtyRect
{
[self.statusItem drawStatusBarBackgroundInRect:dirtyRect withHighlight:self.isHighlighted];

NSImage *icon = self.isHighlighted ? self.alternateImage : self.image;
NSSize iconSize = [icon size];
NSRect bounds = self.bounds;
Expand Down Expand Up @@ -64,6 +68,8 @@ - (void)setHighlighted:(BOOL)newFlag
[self setNeedsDisplay:YES];
}

#pragma mark -

- (void)setImage:(NSImage *)newImage
{
[newImage retain];
Expand All @@ -81,6 +87,8 @@ - (void)setAlternateImage:(NSImage *)newImage
[self setNeedsDisplay:YES];
}

#pragma mark -

- (NSRect)globalRect
{
NSRect frame = [self frame];
Expand Down

0 comments on commit 219370f

Please sign in to comment.