Skip to content

Commit

Permalink
Fixed bad looking icons on Mavericks.
Browse files Browse the repository at this point in the history
Oddly enough I had to manually set the size of all icons before
assigning them to their respective menu items and status bar item,
otherwise the icons look all messed up on Mavericks. This was not
needed in order to work on Mountain Lion though.
  • Loading branch information
ccidral committed Nov 5, 2013
1 parent 3e4776c commit 0f5a912
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 193 deletions.
14 changes: 10 additions & 4 deletions src/Tomighty.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
301ABD0C17A602E800F19F3C /* Sounds.m in Sources */ = {isa = PBXBuildFile; fileRef = 301ABD0B17A602E800F19F3C /* Sounds.m */; };
3025F55717A7299000970DA9 /* Tomighty.m in Sources */ = {isa = PBXBuildFile; fileRef = 3025F55617A7299000970DA9 /* Tomighty.m */; };
3025F55A17A74A6100970DA9 /* TimerContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 3025F55917A74A6100970DA9 /* TimerContext.m */; };
30429410179F2CD3008CB481 /* status-normal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3042940E179F2CD3008CB481 /* status-normal.tiff */; };
3055C8C718297D540040918A /* status-normal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3055C8C618297D540040918A /* status-normal.tiff */; };
3055C8CA1829A4F30040918A /* ImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 3055C8C91829A4F30040918A /* ImageLoader.m */; };
30AA857217A154C400F4ADC6 /* tomighty.icns in Resources */ = {isa = PBXBuildFile; fileRef = 30AA857117A154C400F4ADC6 /* tomighty.icns */; };
30B829CF17A0AC1500DFC201 /* Timer.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B829CE17A0AC1500DFC201 /* Timer.m */; };
30B829D417A0CCD000DFC201 /* status-white.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 30B829D317A0CCD000DFC201 /* status-white.tiff */; };
Expand Down Expand Up @@ -57,7 +58,9 @@
3025F55617A7299000970DA9 /* Tomighty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tomighty.m; sourceTree = "<group>"; };
3025F55817A74A6100970DA9 /* TimerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimerContext.h; sourceTree = "<group>"; };
3025F55917A74A6100970DA9 /* TimerContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TimerContext.m; sourceTree = "<group>"; };
3042940E179F2CD3008CB481 /* status-normal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "status-normal.tiff"; sourceTree = "<group>"; };
3055C8C618297D540040918A /* status-normal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "status-normal.tiff"; sourceTree = "<group>"; };
3055C8C81829A4F30040918A /* ImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageLoader.h; sourceTree = "<group>"; };
3055C8C91829A4F30040918A /* ImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageLoader.m; sourceTree = "<group>"; };
30AA857117A154C400F4ADC6 /* tomighty.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = tomighty.icns; sourceTree = "<group>"; };
30B829CD17A0AC1500DFC201 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
30B829CE17A0AC1500DFC201 /* Timer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Timer.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -98,6 +101,7 @@
301ABCF317A5A53300F19F3C /* Icons */ = {
isa = PBXGroup;
children = (
3055C8C618297D540040918A /* status-normal.tiff */,
301ABCF117A5999400F19F3C /* clock.tiff */,
301ABCED17A593AA00F19F3C /* start-pomodoro.tiff */,
301ABCEE17A593AA00F19F3C /* status-pomodoro.tiff */,
Expand All @@ -107,7 +111,6 @@
30FA9D9B17A586A0005D0A80 /* start-long-break.tiff */,
30FA9D9D17A586A0005D0A80 /* start-short-break.tiff */,
30B829D317A0CCD000DFC201 /* status-white.tiff */,
3042940E179F2CD3008CB481 /* status-normal.tiff */,
);
name = Icons;
sourceTree = "<group>";
Expand All @@ -128,6 +131,8 @@
3025F55617A7299000970DA9 /* Tomighty.m */,
3025F55817A74A6100970DA9 /* TimerContext.h */,
3025F55917A74A6100970DA9 /* TimerContext.m */,
3055C8C81829A4F30040918A /* ImageLoader.h */,
3055C8C91829A4F30040918A /* ImageLoader.m */,
);
name = Core;
sourceTree = "<group>";
Expand Down Expand Up @@ -262,7 +267,6 @@
30F01B06179EC3F00061D183 /* InfoPlist.strings in Resources */,
30F01B0C179EC3F00061D183 /* Credits.rtf in Resources */,
30F01B12179EC3F10061D183 /* MainMenu.xib in Resources */,
30429410179F2CD3008CB481 /* status-normal.tiff in Resources */,
30B829D417A0CCD000DFC201 /* status-white.tiff in Resources */,
30AA857217A154C400F4ADC6 /* tomighty.icns in Resources */,
30FA9D9F17A586A0005D0A80 /* start-long-break.tiff in Resources */,
Expand All @@ -271,6 +275,7 @@
301ABCE617A5910C00F19F3C /* status-long-break.tiff in Resources */,
301ABCE817A5910C00F19F3C /* status-short-break.tiff in Resources */,
301ABCEF17A593AA00F19F3C /* start-pomodoro.tiff in Resources */,
3055C8C718297D540040918A /* status-normal.tiff in Resources */,
301ABCF017A593AA00F19F3C /* status-pomodoro.tiff in Resources */,
301ABCF217A5999400F19F3C /* clock.tiff in Resources */,
301ABCFC17A5A8E100F19F3C /* PreferencesWindow.xib in Resources */,
Expand All @@ -295,6 +300,7 @@
301ABD0217A5C48500F19F3C /* Preferences.m in Sources */,
301ABD0C17A602E800F19F3C /* Sounds.m in Sources */,
3025F55717A7299000970DA9 /* Tomighty.m in Sources */,
3055C8CA1829A4F30040918A /* ImageLoader.m in Sources */,
3025F55A17A74A6100970DA9 /* TimerContext.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
11 changes: 10 additions & 1 deletion src/Tomighty/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "AppDelegate.h"
#import "ImageLoader.h"
#import "Preferences.h"
#import "PreferencesWindowController.h"
#import "Sounds.h"
Expand Down Expand Up @@ -35,8 +36,16 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
shortBreakContext = [[TimerContext alloc] initWithName:@"Short break"];
longBreakContext = [[TimerContext alloc] initWithName:@"Long break"];

[self initMenuItemsIcons];
[self updateRemainingTime:0];

}

- (void)initMenuItemsIcons {
[self.remainingTimeMenuItem setImage:[ImageLoader loadIcon:@"clock"]];
[self.stopTimerMenuItem setImage:[ImageLoader loadIcon:@"stop"]];
[self.startPomodoroMenuItem setImage:[ImageLoader loadIcon:@"start-pomodoro"]];
[self.startShortBreakMenuItem setImage:[ImageLoader loadIcon:@"start-short-break"]];
[self.startLongBreakMenuItem setImage:[ImageLoader loadIcon:@"start-long-break"]];
}

- (IBAction)showPreferences:(id)sender {
Expand Down
16 changes: 16 additions & 0 deletions src/Tomighty/ImageLoader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// ImageFactory.h
// Tomighty
//
// Created by Célio Cidral Jr on 05/11/13.
// Copyright (c) 2013 Célio Cidral Jr. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface ImageLoader : NSObject

+ (NSImage*) loadIcon:(NSString*)name;
+ (NSImage*) loadTiffImage:(NSString*)name withSize:(int)size;

@end
32 changes: 32 additions & 0 deletions src/Tomighty/ImageLoader.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// ImageFactory.m
// Tomighty
//
// Created by Célio Cidral Jr on 05/11/13.
// Copyright (c) 2013 Célio Cidral Jr. All rights reserved.
//

#import "ImageLoader.h"

@implementation ImageLoader

int const ICON_SIZE = 16;

+ (NSImage*) loadIcon:(NSString*)name {
return [self loadTiffImage:name withSize:ICON_SIZE];
}

+ (NSImage*) loadTiffImage:(NSString*)name withSize:(int)widthAndHeight {
NSString* fileName = [NSString stringWithFormat:@"%@.tiff", name];
NSImage* image = [NSImage imageNamed:fileName];

NSSize size;
size.width = widthAndHeight;
size.height = widthAndHeight;

[image setSize:size];

return image;
}

@end
Loading

0 comments on commit 0f5a912

Please sign in to comment.