Change two-pass behavior for loading mappings. Allow lazy binding of mappings by...
[enjoyable.git] / Classes / NJOutputController.m
index 07c077b..fd160e6 100644 (file)
@@ -53,8 +53,8 @@
     if (row != 2) {
         [mappingPopup selectItemAtIndex:-1];
         [mappingPopup resignIfFirstResponder];
-    } else if (!mappingPopup.selectedItem)
-        [mappingPopup selectItemAtIndex:0];
+        unknownMapping.hidden = YES;
+    }
     
     if (row != 3) {
         mouseDirSelect.selectedSegment = -1;
 - (void)mappingChosen:(id)sender {
     [radioButtons selectCellAtRow:2 column:0];
     [mappingPopup.window makeFirstResponder:mappingPopup];
+    unknownMapping.hidden = YES;
     [self commit];
 }
 
     scrollDirSelect.enabled = enabled;
     smoothCheck.enabled = enabled;
     scrollSpeedSlider.enabled = enabled && smoothCheck.state;
+    if (!enabled)
+        unknownMapping.hidden = YES;
 }
 
 - (void)loadOutput:(NJOutput *)output forInput:(NJInput *)input {
         [radioButtons selectCellAtRow:2 column:0];
         NSMenuItem *item = [mappingPopup itemWithRepresentedObject:[(NJOutputMapping *)output mapping]];
         [mappingPopup selectItem:item];
-        if (!item)
-            [radioButtons selectCellAtRow:self.enabled ? 0 : -1 column:0];
+        unknownMapping.hidden = !!item;
+        unknownMapping.title = [(NJOutputMapping *)output mappingName];
     }
     else if ([output isKindOfClass:NJOutputMouseMove.class]) {
         [radioButtons selectCellAtRow:3 column:0];