Rework toolbar UI. No more drawer, use a popover. No more weird toggle button, use...
[enjoyable.git] / EnjoyableApplicationDelegate.m
index 23324d3..74e8265 100644 (file)
@@ -43,7 +43,6 @@
     while (![dockMenuBase itemAtIndex:mappingsMenuIndex - 1].isSeparatorItem)
         --mappingsMenuIndex;
     
-    [drawer open];
     self.outputController.enabled = NO;
     [self.inputController setup];
     [self.mappingsController load];
 }
 
 - (void)eventTranslationActivated:(NSNotification *)note {
-    activeButton.image = [NSImage imageNamed:@"NSStopProgressFreestandingTemplate"];
-    activeMenuItem.state = [note.object translatingEvents];
     [NSWorkspace.sharedWorkspace.notificationCenter
-     addObserver:self
-     selector:@selector(didSwitchApplication:)
-     name:NSWorkspaceDidActivateApplicationNotification
-     object:nil];
+        addObserver:self
+        selector:@selector(didSwitchApplication:)
+        name:NSWorkspaceDidActivateApplicationNotification
+        object:nil];
     NSLog(@"Listening for application changes.");
 }
 
 - (void)eventTranslationDeactivated:(NSNotification *)note {
-    activeButton.image = [NSImage imageNamed:@"NSGoRightTemplate"];
-    activeMenuItem.state = [note.object translatingEvents];
     [NSWorkspace.sharedWorkspace.notificationCenter
-     removeObserver:self
-     name:NSWorkspaceDidActivateApplicationNotification
-     object:nil];
+        removeObserver:self
+        name:NSWorkspaceDidActivateApplicationNotification
+        object:nil];
     NSLog(@"Ignoring application changes.");
 }
 
@@ -83,7 +78,7 @@
     while (dockMenuBase.numberOfItems > removeFrom)
         [dockMenuBase removeItemAtIndex:dockMenuBase.numberOfItems - 1];
     int added = 0;
-    for (NJMapping *mapping in self.mappingsController.mappings) {
+    for (NJMapping *mapping in self.mappingsController) {
         NSString *keyEquiv = ++added < 10 ? @(added).stringValue : @"";
         [dockMenuBase addItemWithTitle:mapping.name
                                 action:@selector(chooseMapping:)
 
 - (void)chooseMapping:(id)sender {
     NSInteger idx = [dockMenuBase indexOfItem:sender] - mappingsMenuIndex;
-    NJMapping *chosen = self.mappingsController.mappings[idx];
+    NJMapping *chosen = self.mappingsController[idx];
     [_mappingsController activateMapping:chosen];
 }