}
}
-- (void)expandRecursiveByUID:(NSString *)uid {
+- (id)elementForUID:(NSString *)uid {
for (NJDevice *dev in _devices) {
id item = [dev elementForUID:uid];
if (item)
- [self expandRecursive:item];
+ return item;
}
+ return nil;
+}
+
+- (void)expandRecursiveByUID:(NSString *)uid {
+ [self expandRecursive:[self elementForUID:uid]];
}
- (void)addRunningOutput:(NJOutput *)output {
[_devices addObject:dev];
[outlineView reloadData];
[self reexpandAll];
+ hidSleepingPrompt.hidden = YES;
connectDevicePrompt.hidden = !!_devices.count;
}
[_devices removeObject:match];
[outlineView reloadData];
connectDevicePrompt.hidden = !!_devices.count;
+ hidSleepingPrompt.hidden = YES;
}
if (_devices.count == 1)
[outlineView expandItem:_devices[0]];
} else {
IOHIDManagerRegisterDeviceMatchingCallback(_hidManager, add_callback, (__bridge void *)self);
IOHIDManagerRegisterDeviceRemovalCallback(_hidManager, remove_callback, (__bridge void *)self);
+ hidSleepingPrompt.hidden = YES;
+ connectDevicePrompt.hidden = !!_devices.count;
}
}
}
[_devices removeAllObjects];
[outlineView reloadData];
- connectDevicePrompt.hidden = !!_devices.count;
+ hidSleepingPrompt.hidden = NO;
+ connectDevicePrompt.hidden = YES;
}
- (NJInput *)selectedInput {
}
- (void)outlineViewSelectionDidChange:(NSNotification *)notification {
+ id <NJInputPathElement> item = [outlineView itemAtRow:outlineView.selectedRow];
+ if (item)
+ [NSUserDefaults.standardUserDefaults setObject:item.uid
+ forKey:@"selected input"];
[outputController loadCurrent];
}
- (void)reexpandAll {
for (NSString *uid in [_expanded copy])
[self expandRecursiveByUID:uid];
+ if (outlineView.selectedRow == -1) {
+ NSString *selectedUid = [NSUserDefaults.standardUserDefaults objectForKey:@"selected input"];
+ id item = [self elementForUID:selectedUid];
+ NSInteger row = [outlineView rowForItem:item];
+ if (row >= 0)
+ [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
+ }
}
- (void)closeHidIfDisabled:(NSNotification *)application {
<reference key="NSNextResponder" ref="177223957"/>
<int key="NSvFlags">275</int>
<array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="12898323">
+ <object class="NSButton" id="918286878">
<reference key="NSNextResponder" ref="734312853"/>
- <int key="NSvFlags">274</int>
+ <int key="NSvFlags">-2147483374</int>
<string key="NSFrame">{{20, 20}, {194, 283}}</string>
<reference key="NSSuperview" ref="734312853"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="471332453"/>
<string key="NSReuseIdentifierKey">_NS:22</string>
<bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="468117320">
+ <object class="NSButtonCell" key="NSCell" id="543930440">
<int key="NSCellFlags">603979776</int>
<int key="NSCellFlags2">134217728</int>
- <string type="base64-UTF8" key="NSContents">Tm8gaW5wdXQgZGV2aWNlcyB3ZXJlIGZvdW5kLgoKQ29ubmVjdCBhIGRldmljZSB0byBiZWdpbiBtYXBw
-aW5nLg</string>
- <object class="NSFont" key="NSSupport">
+ <string type="base64-UTF8" key="NSContents">SW5wdXQgaXMgY3VycmVudGx5IGRpc2FibGVkLgoKU3dpdGNoIGJhY2sgdG8gcmUtZW5hYmxlIGlucHV0
+Lg</string>
+ <object class="NSFont" key="NSSupport" id="644067327">
<string key="NSName">LucidaGrande-Bold</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
<string key="NSCellIdentifier">_NS:22</string>
+ <reference key="NSControlView" ref="918286878"/>
+ <int key="NSButtonFlags">-2041823232</int>
+ <int key="NSButtonFlags2">134</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+ </object>
+ <object class="NSButton" id="12898323">
+ <reference key="NSNextResponder" ref="734312853"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrame">{{20, 20}, {194, 283}}</string>
+ <reference key="NSSuperview" ref="734312853"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="918286878"/>
+ <string key="NSReuseIdentifierKey">_NS:22</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="468117320">
+ <int key="NSCellFlags">603979776</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string type="base64-UTF8" key="NSContents">Tm8gaW5wdXQgZGV2aWNlcyB3ZXJlIGZvdW5kLgoKQ29ubmVjdCBhIGRldmljZSB0byBiZWdpbiBtYXBw
+aW5nLg</string>
+ <reference key="NSSupport" ref="644067327"/>
+ <string key="NSCellIdentifier">_NS:22</string>
<reference key="NSControlView" ref="12898323"/>
<int key="NSButtonFlags">-2041823232</int>
<int key="NSButtonFlags2">134</int>
<string key="NSFrame">{{343, 31}, {70, 18}}</string>
<reference key="NSSuperview" ref="471332453"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="868379451">
</object>
<int key="connectionID">915</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">hidSleepingPrompt</string>
+ <reference key="source" ref="1007832501"/>
+ <reference key="destination" ref="918286878"/>
+ </object>
+ <int key="connectionID">976</int>
+ </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">mappingsController</string>
<array class="NSMutableArray" key="children">
<reference ref="364857164"/>
<reference ref="12898323"/>
+ <reference ref="918286878"/>
</array>
<reference key="parent" ref="177223957"/>
</object>
<reference key="object" ref="331930027"/>
<reference key="parent" ref="720053764"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">974</int>
+ <reference key="object" ref="918286878"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="543930440"/>
+ </array>
+ <reference key="parent" ref="734312853"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">975</int>
+ <reference key="object" ref="543930440"/>
+ <reference key="parent" ref="918286878"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="967.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="968.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="970.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="974.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="975.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">971</int>
+ <int key="maxID">976</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="connectDevicePrompt">NSView</string>
+ <string key="hidSleepingPrompt">NSView</string>
<string key="mappingsController">NJMappingsController</string>
<string key="outlineView">NSOutlineView</string>
<string key="outputController">NJOutputController</string>
<string key="name">connectDevicePrompt</string>
<string key="candidateClassName">NSView</string>
</object>
+ <object class="IBToOneOutletInfo" key="hidSleepingPrompt">
+ <string key="name">hidSleepingPrompt</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
<object class="IBToOneOutletInfo" key="mappingsController">
<string key="name">mappingsController</string>
<string key="candidateClassName">NJMappingsController</string>