Skip to content

Commit

Permalink
apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Oct 2, 2014
1 parent da36797 commit 8cab03e
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 246 deletions.
18 changes: 9 additions & 9 deletions AppDelegate.h
Expand Up @@ -8,15 +8,15 @@

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (assign) IBOutlet LanguageColorTableViewController* languageColorTableViewController;
@property (assign) IBOutlet NSTextField* currentInputSourceID;
@property (assign) IBOutlet NSWindow* preferencesWindow;
@property (assign) IBOutlet NSWindow* window;
@property (assign) IBOutlet PreferencesController* preferences;
@property (assign) IBOutlet SUUpdater* suupdater;
@property(assign) IBOutlet LanguageColorTableViewController* languageColorTableViewController;
@property(assign) IBOutlet NSTextField* currentInputSourceID;
@property(assign) IBOutlet NSWindow* preferencesWindow;
@property(assign) IBOutlet NSWindow* window;
@property(assign) IBOutlet PreferencesController* preferences;
@property(assign) IBOutlet SUUpdater* suupdater;

- (IBAction) add:(id)sender;
- (IBAction) remove:(id)sender;
- (IBAction) checkForUpdatesWithBetaVersion:(id)sender;
- (IBAction)add:(id)sender;
- (IBAction)remove:(id)sender;
- (IBAction)checkForUpdatesWithBetaVersion:(id)sender;

@end
59 changes: 24 additions & 35 deletions AppDelegate.m
Expand Up @@ -12,15 +12,13 @@ @implementation AppDelegate

@synthesize window;

- (void) observer_NSWorkspaceDidActivateApplicationNotification:(NSNotification*)notification
{
- (void)observer_NSWorkspaceDidActivateApplicationNotification:(NSNotification*)notification {
dispatch_async(dispatch_get_main_queue(), ^{
[self adjustFrame];
});
}

- (void) observer_kTISNotifySelectedKeyboardInputSourceChanged:(NSNotification*)notification
{
- (void)observer_kTISNotifySelectedKeyboardInputSourceChanged:(NSNotification*)notification {
dispatch_async(dispatch_get_main_queue(), ^{
[self adjustFrame];

Expand Down Expand Up @@ -140,27 +138,26 @@ - (void) observer_kTISNotifySelectedKeyboardInputSourceChanged:(NSNotification*)
});
}

- (void) adjustFrame
{
- (void)adjustFrame {
NSRect rect = [[NSScreen mainScreen] frame];

if ([[NSUserDefaults standardUserDefaults] boolForKey:kUseCustomFrame]) {
CGFloat top = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameTop];
CGFloat left = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameLeft];
CGFloat width = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameWidth];
CGFloat top = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameTop];
CGFloat left = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameLeft];
CGFloat width = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameWidth];
CGFloat height = [[NSUserDefaults standardUserDefaults] integerForKey:kCustomFrameHeight];
if (width < 1.0) width = 1.0;
if (height < 1.0) height = 1.0;

rect.origin.x += left;
rect.origin.y += rect.size.height - top - height;
rect.size.width = width;
rect.origin.x += left;
rect.origin.y += rect.size.height - top - height;
rect.size.width = width;
rect.size.height = height;

[window setFrame:rect display:NO];

} else {
CGFloat width = rect.size.width;
CGFloat width = rect.size.width;
CGFloat height = [PreferencesController indicatorHeight];

// To avoid top 1px gap, we need to add an adjust value to frame.size.height.
Expand All @@ -172,11 +169,11 @@ - (void) adjustFrame
// origin.x origin.x + size.width
//

CGFloat adjustHeight = 2.0;
CGFloat adjustHeight = 2.0;

rect.origin.x += 0;
rect.origin.y += rect.size.height - height;
rect.size.width = width;
rect.origin.x += 0;
rect.origin.y += rect.size.height - height;
rect.size.width = width;
rect.size.height = height + adjustHeight;

[window setFrame:rect display:NO];
Expand All @@ -188,28 +185,25 @@ - (void) adjustFrame
[window orderFront:nil];
}

- (void) observer_NSApplicationDidChangeScreenParametersNotification:(NSNotification*)notification
{
- (void)observer_NSApplicationDidChangeScreenParametersNotification:(NSNotification*)notification {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"observer_NSApplicationDidChangeScreenParametersNotification");
[self adjustFrame];
});
}

- (void) observer_kIndicatorHeightChangedNotification:(NSNotification*)notification
{
- (void)observer_kIndicatorHeightChangedNotification:(NSNotification*)notification {
dispatch_async(dispatch_get_main_queue(), ^{
[self adjustFrame];
[self observer_kTISNotifySelectedKeyboardInputSourceChanged:nil];
});
}

- (void) applicationDidFinishLaunching:(NSNotification*)aNotification
{
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
[self.preferences load];

if ([[NSUserDefaults standardUserDefaults] boolForKey:kShowIconInDock]) {
ProcessSerialNumber psn = { 0, kCurrentProcess };
ProcessSerialNumber psn = {0, kCurrentProcess};
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}

Expand Down Expand Up @@ -268,39 +262,34 @@ - (void) applicationDidFinishLaunching:(NSNotification*)aNotification
object:nil];

// ------------------------------------------------------------
if (! [StartAtLoginController isStartAtLogin]) {
if (![StartAtLoginController isStartAtLogin]) {
[self.preferencesWindow makeKeyAndOrderFront:nil];
}

// ------------------------------------------------------------
[self.suupdater checkForUpdatesInBackground];
}

- (BOOL) applicationShouldHandleReopen:(NSApplication*)theApplication hasVisibleWindows:(BOOL)flag
{
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication hasVisibleWindows:(BOOL)flag {
[self.preferencesWindow makeKeyAndOrderFront:nil];
return YES;
}

- (void) dealloc
{
- (void)dealloc {
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

// ======================================================================
- (IBAction) add:(id)sender
{
- (IBAction)add:(id)sender {
[self.languageColorTableViewController add:[self.currentInputSourceID stringValue]];
}

- (IBAction) remove:(id)sender
{
- (IBAction)remove:(id)sender {
[self.languageColorTableViewController remove];
}

- (IBAction) checkForUpdatesWithBetaVersion:(id)sender
{
- (IBAction)checkForUpdatesWithBetaVersion:(id)sender {
NSURL* originalURL = [self.suupdater feedURL];
NSURL* url = [NSURL URLWithString:@"https://pqrs.org/osx/ShowyEdge/files/appcast-devel.xml"];
[self.suupdater setFeedURL:url];
Expand Down
20 changes: 10 additions & 10 deletions Classes/LanguageColorTableViewController.h
Expand Up @@ -4,16 +4,16 @@

@interface LanguageColorTableViewController : NSObject

@property (assign) IBOutlet NSTableView* tableview;
@property (assign) IBOutlet NSMenu* menu_color0;
@property (assign) IBOutlet NSMenu* menu_color1;
@property (assign) IBOutlet NSMenu* menu_color2;
@property(assign) IBOutlet NSTableView* tableview;
@property(assign) IBOutlet NSMenu* menu_color0;
@property(assign) IBOutlet NSMenu* menu_color1;
@property(assign) IBOutlet NSMenu* menu_color2;

- (void) setupMenu;
- (void) load;
- (void) add:(NSString*)newInputSourceID;
- (void) remove;
- (NSDictionary*) getDictionaryFromInputSourceID:(NSString*)inputsourceid;
- (NSColor*) getColorFromName:(NSString*)colorName;
- (void)setupMenu;
- (void)load;
- (void)add:(NSString*)newInputSourceID;
- (void)remove;
- (NSDictionary*)getDictionaryFromInputSourceID:(NSString*)inputsourceid;
- (NSColor*)getColorFromName:(NSString*)colorName;

@end

0 comments on commit 8cab03e

Please sign in to comment.