X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=ApplicationController.m;h=a3ad5ed24955f095252f004086bf8835f1532761;hp=aa51eeb4f18a0a810a0daaa6c018327e5be24563;hb=62aa5b73be6ec1e499e6b155cd0e7687c338cbaa;hpb=dd1f684886c2809133356bb9b335a35293e8849e diff --git a/ApplicationController.m b/ApplicationController.m index aa51eeb..a3ad5ed 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -16,10 +16,6 @@ BOOL active; } -@synthesize jsController; -@synthesize targetController; -@synthesize configsController; - - (void)didSwitchApplication:(NSNotification *)notification { NSRunningApplication *currentApp = notification.userInfo[NSWorkspaceApplicationKey]; [self.configsController activateConfigForProcess:currentApp.localizedName]; @@ -53,8 +49,8 @@ activeMenuItem.state = sendRealEvents; } -- (NSUInteger)firstConfigMenuIndex { - NSUInteger count = dockMenuBase.numberOfItems; +- (NSInteger)firstConfigMenuIndex { + NSInteger count = dockMenuBase.numberOfItems; for (int i = 0; i < count; ++i) if ([dockMenuBase itemAtIndex:i].isSeparatorItem) return i + 1; @@ -62,16 +58,17 @@ } - (void)configsChanged { - NSUInteger removeFrom = [self firstConfigMenuIndex]; + NSInteger removeFrom = [self firstConfigMenuIndex]; while (dockMenuBase.numberOfItems > removeFrom) [dockMenuBase removeItemAtIndex:dockMenuBase.numberOfItems - 1]; for (Config *config in self.configsController.configs) [dockMenuBase addItemWithTitle:config.name action:@selector(chooseConfig:) keyEquivalent:@""]; + [_targetController refreshConfigs]; [self configChanged]; } - (void)configChanged { - NSUInteger firstConfig = [self firstConfigMenuIndex]; + NSInteger firstConfig = [self firstConfigMenuIndex]; Config *current = self.configsController.currentConfig; NSArray *configs = self.configsController.configs; for (int i = 0; i < configs.count; ++i) @@ -79,8 +76,8 @@ } - (void)chooseConfig:(id)sender { - int idx = [dockMenuBase indexOfItem:sender] - [self firstConfigMenuIndex]; + NSInteger idx = [dockMenuBase indexOfItem:sender] - [self firstConfigMenuIndex]; Config *chosen = self.configsController.configs[idx]; - [configsController activateConfig:chosen]; + [_configsController activateConfig:chosen]; } @end