Rename the application delegate, and hopefully catch the last vestiges of the old...
[enjoyable.git] / NJMappingsController.m
index e5b2b7d..fe96462 100644 (file)
@@ -7,11 +7,11 @@
 
 #import "NJMappingsController.h"
 
-#import "ApplicationController.h"
+#import "EnjoyableApplicationDelegate.h"
 #import "NJMapping.h"
 #import "NJMappingsController.h"
-#import "Target.h"
-#import "TargetController.h"
+#import "NJOutput.h"
+#import "NJOutputController.h"
 #import "NJEvents.h"
 
 @implementation NJMappingsController {
@@ -53,7 +53,7 @@
     manualMapping = mapping;
     _currentMapping = mapping;
     [removeButton setEnabled:_mappings[0] != mapping];
-    [targetController loadCurrent];
+    [outputController loadCurrent];
     [NSNotificationCenter.defaultCenter postNotificationName:NJEventMappingChanged
                                                       object:_currentMapping];
     [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[_mappings indexOfObject:mapping]] byExtendingSelection:NO];
@@ -62,7 +62,7 @@
 - (IBAction)addPressed:(id)sender {
     NJMapping *newMapping = [[NJMapping alloc] initWithName:@"Untitled"];
     [_mappings addObject:newMapping];
-    [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged];
+    [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged];
     [tableView reloadData];
     [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:_mappings.count - 1] byExtendingSelection:NO];
     [tableView editColumn:0 row:_mappings.count - 1 withEvent:nil select:YES];
@@ -75,7 +75,7 @@
     
     [_mappings removeObjectAtIndex:tableView.selectedRow];
     [tableView reloadData];
-    [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged];
+    [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged];
     [self activateMapping:_mappings[0]];
     [self save];
 }
@@ -92,7 +92,7 @@
 - (void)tableView:(NSTableView *)view setObjectValue:(NSString *)obj forTableColumn:(NSTableColumn *)col row:(NSInteger)index {
     [(NJMapping *)_mappings[index] setName:obj];
     [tableView reloadData];
-    [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged];
+    [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged];
 }
 
 - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
     NSArray *storedMappings = envelope[@"mappings"];
     NSMutableArray* newMappings = [[NSMutableArray alloc] initWithCapacity:storedMappings.count];
 
-    // have to do two passes in case mapping1 refers to mapping2 via a TargetMapping
+    // have to do two passes in case mapping1 refers to mapping2 via a NJOutputMapping
     for (NSDictionary *storedMapping in storedMappings) {
         NJMapping *mapping = [[NJMapping alloc] initWithName:storedMapping[@"name"]];
         [newMappings addObject:mapping];
         NSDictionary *entries = storedMappings[i][@"entries"];
         NJMapping *mapping = newMappings[i];
         for (id key in entries) {
-            Target *target = [Target targetDeserialize:entries[key]
-                                            withMappings:newMappings];
-            if (target)
-                mapping.entries[key] = target;
+            NJOutput *output = [NJOutput outputDeserialize:entries[key]
+                                              withMappings:newMappings];
+            if (output)
+                mapping.entries[key] = output;
         }
     }
     
             current = 0;
         _mappings = newMappings;
         [tableView reloadData];
-        [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged];
+        [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged];
         [self activateMapping:_mappings[current]];
     }
 }
     for (id key in entries) {
         NSDictionary *value = entries[key];
         if ([key isKindOfClass:NSString.class]) {
-            Target *target = [Target targetDeserialize:value
-                                           withMappings:_mappings];
-            if (target)
-                mapping.entries[key] = target;
+            NJOutput *output = [NJOutput outputDeserialize:value
+                                              withMappings:_mappings];
+            if (output)
+                mapping.entries[key] = output;
         }
     }
     return mapping;
                           }
                           
                           [self save];
-                          [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged];
+                          [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged];
                           [self activateMapping:mapping];
-                          [targetController loadCurrent];
+                          [outputController loadCurrent];
                           
                           if (conflict && !mergeInto) {
                               [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:_mappings.count - 1] byExtendingSelection:NO];