X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=ApplicationController.m;h=6a34916400c52691039436c05003fc94ed94357d;hp=2b122b6298755bb11dc87bf90c77ad1452efdbcc;hb=15a3aec049658f4a1c3c6e8c9f8a549fb8de0782;hpb=4ce3f2876a51400f7e3baa213bd23ecd0101398a diff --git a/ApplicationController.m b/ApplicationController.m index 2b122b6..6a34916 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]; @@ -28,7 +24,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification { [drawer open]; self.targetController.enabled = NO; - self.active = NO; [self.jsController setup]; [self.configsController load]; [[NSWorkspace sharedWorkspace].notificationCenter @@ -46,22 +41,12 @@ object:nil]; } -// TODO: Active state should probably be in the ConfigsController or -// JoystickController, not here. - -- (BOOL)active { - return active; -} - -- (void)setActive:(BOOL)newActive { - activeButton.label = newActive ? @"Stop" : @"Start"; - activeButton.image = [NSImage imageNamed:newActive ? @"NSStopProgressFreestandingTemplate" : @"NSGoRightTemplate"]; - activeMenuItem.state = newActive; - active = newActive; -} - - (IBAction)toggleActivity:(id)sender { - self.active = !self.active; + BOOL sendRealEvents = !self.jsController.sendingRealEvents; + self.jsController.sendingRealEvents = sendRealEvents; + activeButton.label = sendRealEvents ? @"Stop" : @"Start"; + activeButton.image = [NSImage imageNamed:sendRealEvents ? @"NSStopProgressFreestandingTemplate" : @"NSGoRightTemplate"]; + activeMenuItem.state = sendRealEvents; } - (NSUInteger)firstConfigMenuIndex { @@ -92,6 +77,6 @@ - (void)chooseConfig:(id)sender { int idx = [dockMenuBase indexOfItem:sender] - [self firstConfigMenuIndex]; Config *chosen = self.configsController.configs[idx]; - [configsController activateConfig:chosen]; + [_configsController activateConfig:chosen]; } @end