From: Joe Wreschnig Date: Sat, 16 Mar 2013 19:23:42 +0000 (+0100) Subject: Split view management out of NJDeviceController. Right now this probably just makes... X-Git-Tag: version-1.1~21 X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=commitdiff_plain;h=58ce8f7f50f382f18e7b416eca737803af284868 Split view management out of NJDeviceController. Right now this probably just makes things worse, but once all the views are out, all the regular controllers can just be merged. --- diff --git a/Categories/NSOutlineView+ItemAccessors.h b/Categories/NSOutlineView+ItemAccessors.h new file mode 100644 index 0000000..bd7bc88 --- /dev/null +++ b/Categories/NSOutlineView+ItemAccessors.h @@ -0,0 +1,16 @@ +// +// NSOutlineView+ItemAccessors.h +// Enjoyable +// +// Created by Joe Wreschnig on 3/16/13. +// +// + +#import + +@interface NSOutlineView (ItemAccessors) + +- (void)selectItem:(id)item; +- (id)selectedItem; + +@end diff --git a/Categories/NSOutlineView+ItemAccessors.m b/Categories/NSOutlineView+ItemAccessors.m new file mode 100644 index 0000000..8f1a9be --- /dev/null +++ b/Categories/NSOutlineView+ItemAccessors.m @@ -0,0 +1,27 @@ +// +// NSOutlineView+ItemAccessors.m +// Enjoyable +// +// Created by Joe Wreschnig on 3/16/13. +// +// + +#import "NSOutlineView+ItemAccessors.h" + +@implementation NSOutlineView (ItemAccessors) + +- (void)selectItem:(id)item { + NSInteger row = [self rowForItem:item]; + if (row >= 0) { + [self selectRowIndexes:[[NSIndexSet alloc] initWithIndex:row] + byExtendingSelection:NO]; + } else { + [self deselectAll:nil]; + } +} + +- (id)selectedItem { + return self.selectedRow >= 0 ? [self itemAtRow:self.selectedRow] : nil; +} + +@end diff --git a/Classes/NJDevice.m b/Classes/NJDevice.m index b03898f..ddc6cde 100644 --- a/Classes/NJDevice.m +++ b/Classes/NJDevice.m @@ -76,6 +76,12 @@ static NSArray *InputsForElement(IOHIDDeviceRef device, id parent) { return self; } +- (BOOL)isEqual:(id)object { + return [object isKindOfClass:NJDevice.class] + && [[(NJDevice *)object productName] isEqualToString:self.productName] + && [(NJDevice *)object index] == self.index; +} + - (NSString *)name { return [NSString stringWithFormat:@"%@ #%d", _productName, _index]; } diff --git a/Classes/NJDeviceController.h b/Classes/NJDeviceController.h index 1d13a98..fcc09ef 100644 --- a/Classes/NJDeviceController.h +++ b/Classes/NJDeviceController.h @@ -7,21 +7,20 @@ // #import "NJHIDManager.h" +#import "NJDeviceViewController.h" @class NJDevice; @class NJInput; @class NJMappingsController; @class NJOutputController; +@class NJDeviceViewController; -@interface NJDeviceController : NSObject { - IBOutlet NSOutlineView *outlineView; IBOutlet NJOutputController *outputController; IBOutlet NJMappingsController *mappingsController; IBOutlet NSButton *simulatingEventsButton; - IBOutlet NSView *connectDevicePrompt; - IBOutlet NSView *hidSleepingPrompt; + IBOutlet NJDeviceViewController *devicesViewController; } @property (nonatomic, readonly) NJInput *selectedInput; diff --git a/Classes/NJDeviceController.m b/Classes/NJDeviceController.m index 4a6d3dc..b0e8de3 100644 --- a/Classes/NJDeviceController.m +++ b/Classes/NJDeviceController.m @@ -14,16 +14,15 @@ #import "NJOutput.h" #import "NJOutputController.h" #import "NJEvents.h" +#import "NJDeviceViewController.h" @implementation NJDeviceController { NJHIDManager *_hidManager; NSTimer *_continuousOutputsTick; NSMutableArray *_continousOutputs; NSMutableArray *_devices; - NSMutableArray *_expanded; } -#define EXPANDED_MEMORY_MAX_SIZE 100 #define NSSTR(e) ((NSString *)CFSTR(e)) - (id)init { @@ -31,12 +30,6 @@ _devices = [[NSMutableArray alloc] initWithCapacity:16]; _continousOutputs = [[NSMutableArray alloc] initWithCapacity:32]; - NSArray *expanded = [NSUserDefaults.standardUserDefaults objectForKey:@"expanded rows"]; - if (![expanded isKindOfClass:NSArray.class]) - expanded = @[]; - _expanded = [[NSMutableArray alloc] initWithCapacity:MAX(16, _expanded.count)]; - [_expanded addObjectsFromArray:expanded]; - _hidManager = [[NJHIDManager alloc] initWithCriteria:@[ @{ NSSTR(kIOHIDDeviceUsagePageKey) : @(kHIDPage_GenericDesktop), NSSTR(kIOHIDDeviceUsageKey) : @(kHIDUsage_GD_Joystick) }, @@ -47,12 +40,6 @@ ] delegate:self]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(startHid) - name:NSApplicationDidFinishLaunchingNotification - object:nil]; - // The HID manager uses 5-10ms per second doing basically // nothing if a noisy device is plugged in (the % of that // spent in input_callback is negligible, so it's not @@ -81,13 +68,6 @@ [_continuousOutputsTick invalidate]; } -- (void)expandRecursive:(NJInputPathElement *)pathElement { - if (pathElement) { - [self expandRecursive:pathElement.parent]; - [outlineView expandItem:pathElement]; - } -} - - (id)elementForUID:(NSString *)uid { for (NJDevice *dev in _devices) { id item = [dev elementForUID:uid]; @@ -97,10 +77,6 @@ return nil; } -- (void)expandRecursiveByUID:(NSString *)uid { - [self expandRecursive:[self elementForUID:uid]]; -} - - (void)addRunningOutput:(NJOutput *)output { // Axis events will trigger every small movement, don't keep // re-adding them or they trigger multiple times each time. @@ -135,11 +111,8 @@ if (!handler) return; - [self expandRecursive:handler]; - [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[outlineView rowForItem:handler]] - byExtendingSelection: NO]; - if (!self.simulatingEvents) - [outputController focusKey]; + [devicesViewController expandAndSelectItem:handler]; + [outputController focusKey]; } - (void)hidManager:(NJHIDManager *)manager @@ -153,29 +126,22 @@ } } -static int findAvailableIndex(NSArray *list, NJDevice *dev) { - for (int index = 1; ; index++) { - BOOL available = YES; - for (NJDevice *used in list) { - if ([used.productName isEqualToString:dev.productName] - && used.index == index) { +- (void)hidManager:(NJHIDManager *)manager deviceAdded:(IOHIDDeviceRef)device { + NJDevice *match = [[NJDevice alloc] initWithDevice:device]; + match.index = 1; + BOOL available; + do { + available = YES; + for (NJDevice *used in _devices) { + if ([used isEqual:match]) { + match.index += 1; available = NO; - break; } } - if (available) - return index; - } -} + } while (!available); -- (void)hidManager:(NJHIDManager *)manager deviceAdded:(IOHIDDeviceRef)device { - NJDevice *match = [[NJDevice alloc] initWithDevice:device]; - match.index = findAvailableIndex(_devices, match); [_devices addObject:match]; - [outlineView reloadData]; - [self reexpandAll]; - hidSleepingPrompt.hidden = YES; - connectDevicePrompt.hidden = !!_devices.count; + [devicesViewController addedDevice:match atIndex:_devices.count - 1]; } - (NJDevice *)findDeviceByRef:(IOHIDDeviceRef)device { @@ -189,13 +155,10 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { NJDevice *match = [self findDeviceByRef:device]; IOHIDDeviceRegisterInputValueCallback(device, NULL, NULL); if (match) { - [_devices removeObject:match]; - [outlineView reloadData]; - connectDevicePrompt.hidden = !!_devices.count; - hidSleepingPrompt.hidden = YES; + NSInteger idx = [_devices indexOfObjectIdenticalTo:match]; + [_devices removeObjectAtIndex:idx]; + [devicesViewController removedDevice:match atIndex:idx]; } - if (_devices.count == 1) - [outlineView expandItem:_devices[0]]; } - (void)updateContinuousOutputs:(NSTimer *)timer { @@ -215,32 +178,25 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { // Since the error shows the window, it can trigger another attempt // to re-open the HID manager, which will also probably fail and error, // so don't bother repeating ourselves. - if (!outlineView.window.attachedSheet) { + if (!simulatingEventsButton.window.attachedSheet) { [NSApplication.sharedApplication activateIgnoringOtherApps:YES]; - [outlineView.window makeKeyAndOrderFront:nil]; - [outlineView.window presentError:error - modalForWindow:outlineView.window - delegate:nil - didPresentSelector:nil - contextInfo:nil]; + [simulatingEventsButton.window makeKeyAndOrderFront:nil]; + [simulatingEventsButton.window presentError:error + modalForWindow:simulatingEventsButton.window + delegate:nil + didPresentSelector:nil + contextInfo:nil]; } self.simulatingEvents = NO; - if (manager.running) - [self hidManagerDidStart:manager]; - else - [self hidManagerDidStop:manager]; } - (void)hidManagerDidStart:(NJHIDManager *)manager { - hidSleepingPrompt.hidden = YES; - connectDevicePrompt.hidden = !!_devices.count; + [devicesViewController hidStarted]; } - (void)hidManagerDidStop:(NJHIDManager *)manager { [_devices removeAllObjects]; - [outlineView reloadData]; - hidSleepingPrompt.hidden = NO; - connectDevicePrompt.hidden = YES; + [devicesViewController hidStopped]; } - (void)startHid { @@ -252,66 +208,7 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { } - (NJInput *)selectedInput { - NJInputPathElement *item = [outlineView itemAtRow:outlineView.selectedRow]; - return (NJInput *)((!item.children && item.parent) ? item : nil); -} - -- (NSInteger)outlineView:(NSOutlineView *)outlineView - numberOfChildrenOfItem:(NJInputPathElement *)item { - return item ? item.children.count : _devices.count; -} - -- (BOOL)outlineView:(NSOutlineView *)outlineView - isItemExpandable:(NJInputPathElement *)item { - return item ? [[item children] count] > 0: YES; -} - -- (id)outlineView:(NSOutlineView *)outlineView - child:(NSInteger)index - ofItem:(NJInputPathElement *)item { - return item ? item.children[index] : _devices[index]; -} - -- (id)outlineView:(NSOutlineView *)outlineView -objectValueForTableColumn:(NSTableColumn *)tableColumn - byItem:(NJInputPathElement *)item { - return item ? item.name : @"root"; -} - -- (void)outlineViewSelectionDidChange:(NSNotification *)notification { - NJInputPathElement *item = [outlineView itemAtRow:outlineView.selectedRow]; - if (item) - [NSUserDefaults.standardUserDefaults setObject:item.uid - forKey:@"selected input"]; - [outputController loadCurrent]; -} - -- (BOOL)outlineView:(NSOutlineView *)outlineView - isGroupItem:(NJInputPathElement *)item { - return [item isKindOfClass:NJDevice.class]; -} - -- (BOOL)outlineView:(NSOutlineView *)outlineView_ - shouldSelectItem:(NJInputPathElement *)item { - return ![self outlineView:outlineView_ isGroupItem:item]; -} - -- (void)outlineViewItemDidExpand:(NSNotification *)notification { - NJInputPathElement *item = notification.userInfo[@"NSObject"]; - NSString *uid = item.uid; - if (![_expanded containsObject:uid]) - [_expanded addObject:uid]; - while (_expanded.count > EXPANDED_MEMORY_MAX_SIZE) - [_expanded removeObjectAtIndex:0]; - [NSUserDefaults.standardUserDefaults setObject:_expanded - forKey:@"expanded rows"]; -} - -- (void)outlineViewItemDidCollapse:(NSNotification *)notification { - NJInputPathElement *item = notification.userInfo[@"NSObject"]; - [_expanded removeObject:item.uid]; - [NSUserDefaults.standardUserDefaults setObject:_expanded - forKey:@"expanded rows"]; + return (NJInput *)devicesViewController.selectedHandler; } - (void)setSimulatingEvents:(BOOL)simulatingEvents { @@ -332,18 +229,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn } } -- (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)stopHidIfDisabled:(NSNotification *)application { if (!self.simulatingEvents) [self stopHid]; @@ -353,4 +238,23 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn self.simulatingEvents = sender.state == NSOnState; } +- (void)deviceViewControllerDidSelectNothing:(NJDeviceViewController *)devices { + [outputController loadCurrent]; +} + +- (void)deviceViewController:(NJDeviceViewController *)devices + didSelectBranch:(NJInputPathElement *)handler { + [outputController loadCurrent]; +} + +- (void)deviceViewController:(NJDeviceViewController *)devices + didSelectHandler:(NJInputPathElement *)handler { + [outputController loadCurrent]; +} + +- (void)deviceViewController:(NJDeviceViewController *)devices + didSelectDevice:(NJInputPathElement *)device { + [outputController loadCurrent]; +} + @end diff --git a/Classes/NJDeviceViewController.h b/Classes/NJDeviceViewController.h new file mode 100644 index 0000000..9e1a43f --- /dev/null +++ b/Classes/NJDeviceViewController.h @@ -0,0 +1,49 @@ +// +// NJDeviceViewController.h +// Enjoyable +// +// Created by Joe Wreschnig on 3/16/13. +// +// + +@class NJDevice; +@class NJInputPathElement; + +@protocol NJDeviceViewControllerDelegate; + +@interface NJDeviceViewController : NSObject + +@property (nonatomic, strong) IBOutlet NSOutlineView *inputsTree; +@property (nonatomic, strong) IBOutlet NSView *noDevicesNotice; +@property (nonatomic, strong) IBOutlet NSView *hidStoppedNotice; + +@property (nonatomic, weak) IBOutlet id delegate; + +@property (nonatomic, copy) NSArray *devices; + // Assigning directly will trigger a full reload. + +- (void)addedDevice:(NJDevice *)device atIndex:(NSUInteger)idx; +- (void)removedDevice:(NJDevice *)device atIndex:(NSUInteger)idx; + // But using these will animate nicely. + +- (void)hidStarted; +- (void)hidStopped; + +- (void)expandAndSelectItem:(NJInputPathElement *)item; + +- (NJInputPathElement *)selectedHandler; + +@end + +@protocol NJDeviceViewControllerDelegate + +- (void)deviceViewController:(NJDeviceViewController *)devices + didSelectDevice:(NJInputPathElement *)device; +- (void)deviceViewController:(NJDeviceViewController *)devices + didSelectBranch:(NJInputPathElement *)handler; +- (void)deviceViewController:(NJDeviceViewController *)devices + didSelectHandler:(NJInputPathElement *)handler; +- (void)deviceViewControllerDidSelectNothing:(NJDeviceViewController *)devices; + +@end diff --git a/Classes/NJDeviceViewController.m b/Classes/NJDeviceViewController.m new file mode 100644 index 0000000..3d20e65 --- /dev/null +++ b/Classes/NJDeviceViewController.m @@ -0,0 +1,181 @@ +// +// NJDeviceViewController.m +// Enjoyable +// +// Created by Joe Wreschnig on 3/16/13. +// +// + +#import "NJDeviceViewController.h" + +#import "NJInputPathElement.h" + +@implementation NJDeviceViewController { + NSMutableArray *_devices; + NSMutableArray *_expanded; +} + +- (id)init { + if ((self = [super init])) { + NSArray *expanded = [NSUserDefaults.standardUserDefaults objectForKey:@"expanded rows"]; + if (![expanded isKindOfClass:NSArray.class]) + expanded = @[]; + _expanded = [[NSMutableArray alloc] initWithCapacity:MAX(16, _expanded.count)]; + [_expanded addObjectsFromArray:expanded]; + _devices = [[NSMutableArray alloc] initWithCapacity:16]; + } + return self; +} + +- (void)expandRecursive:(NJInputPathElement *)pathElement { + if (pathElement) { + [self expandRecursive:pathElement.parent]; + [self.inputsTree expandItem:pathElement]; + } +} + +- (id)elementForUID:(NSString *)uid { + for (NJInputPathElement *dev in _devices) { + id item = [dev elementForUID:uid]; + if (item) + return item; + } + return nil; +} + +- (void)expandRecursiveByUID:(NSString *)uid { + [self expandRecursive:[self elementForUID:uid]]; +} + +- (void)reexpandAll { + for (NSString *uid in [_expanded copy]) + [self expandRecursiveByUID:uid]; + if (self.inputsTree.selectedRow == -1) { + NSString *selectedUid = [NSUserDefaults.standardUserDefaults objectForKey:@"selected input"]; + id item = [self elementForUID:selectedUid]; + [self.inputsTree selectItem:item]; + } +} + +- (void)setDevices:(NSArray *)devices { + _devices = [devices mutableCopy]; + id item = self.inputsTree.selectedItem; + [self.inputsTree selectItem:nil]; + [self.inputsTree reloadData]; + [self reexpandAll]; + [self.inputsTree selectItem:item]; + self.noDevicesNotice.hidden = self.devices.count || !self.hidStoppedNotice.isHidden; +} + +- (void)addedDevice:(NJDevice *)device atIndex:(NSUInteger)idx { + [_devices insertObject:device atIndex:idx]; + [self.inputsTree beginUpdates]; + [self.inputsTree insertItemsAtIndexes:[[NSIndexSet alloc] initWithIndex:idx] + inParent:nil + withAnimation:NSTableViewAnimationSlideLeft]; + [self reexpandAll]; + [self.inputsTree endUpdates]; + self.noDevicesNotice.hidden = YES; +} + +- (void)removedDevice:(NJDevice *)device atIndex:(NSUInteger)idx { + [_devices removeObjectAtIndex:idx]; + [self.inputsTree beginUpdates]; + [self.inputsTree removeItemsAtIndexes:[[NSIndexSet alloc] initWithIndex:idx] + inParent:nil + withAnimation:NSTableViewAnimationSlideLeft]; + [self.inputsTree endUpdates]; + self.noDevicesNotice.hidden = self.devices.count || !self.hidStoppedNotice.isHidden; +} + +- (void)hidStarted { + self.noDevicesNotice.hidden = !!self.devices.count; + self.hidStoppedNotice.hidden = YES; +} + +- (void)hidStopped { + self.hidStoppedNotice.hidden = NO; + self.devices = @[]; +} + +- (void)expandAndSelectItem:(NJInputPathElement *)item { + [self expandRecursive:item]; + NSInteger row = [self.inputsTree rowForItem:item]; + if (row >= 0) { + [self.inputsTree selectRowIndexes:[[NSIndexSet alloc] initWithIndex:row] + byExtendingSelection:NO]; + [self.inputsTree scrollRowToVisible:row]; + } +} + +- (NSInteger)outlineView:(NSOutlineView *)outlineView + numberOfChildrenOfItem:(NJInputPathElement *)item { + return item ? item.children.count : _devices.count; +} + +- (BOOL)outlineView:(NSOutlineView *)outlineView + isItemExpandable:(NJInputPathElement *)item { + return item ? [[item children] count] > 0: YES; +} + +- (id)outlineView:(NSOutlineView *)outlineView + child:(NSInteger)index + ofItem:(NJInputPathElement *)item { + return item ? item.children[index] : _devices[index]; +} + +- (id)outlineView:(NSOutlineView *)outlineView +objectValueForTableColumn:(NSTableColumn *)tableColumn + byItem:(NJInputPathElement *)item { + return item ? item.name : @"root"; +} + +- (void)outlineViewSelectionDidChange:(NSNotification *)notification { + NSOutlineView *outlineView = notification.object; + NJInputPathElement *item = outlineView.selectedItem; + if (item) { + [NSUserDefaults.standardUserDefaults setObject:item.uid + forKey:@"selected input"]; + if (!item.children) + [self.delegate deviceViewController:self + didSelectHandler:item]; + else if (!item.parent) + [self.delegate deviceViewController:self + didSelectDevice:item]; + else + [self.delegate deviceViewController:self + didSelectBranch:item]; + } else { + [self.delegate deviceViewControllerDidSelectNothing:self]; + } +} + +- (void)outlineViewItemDidExpand:(NSNotification *)notification { + NSString *uid = [notification.userInfo[@"NSObject"] uid]; + if (![_expanded containsObject:uid]) + [_expanded addObject:uid]; + +} + +- (void)outlineViewItemDidCollapse:(NSNotification *)notification { + [_expanded removeObject:[notification.userInfo[@"NSObject"] uid]]; +} + +- (BOOL)outlineView:(NSOutlineView *)outlineView + isGroupItem:(NJInputPathElement *)item { + return !item.parent; +} + +- (BOOL)outlineView:(NSOutlineView *)outlineView + shouldSelectItem:(NJInputPathElement *)item { + return ![self outlineView:outlineView isGroupItem:item]; +} + +- (NJInputPathElement *)selectedHandler { + NJInputPathElement *element = self.inputsTree.selectedItem; + return element.children ? nil : element; +} + + + +@end diff --git a/Enjoyable.xcodeproj/project.pbxproj b/Enjoyable.xcodeproj/project.pbxproj index d428220..e633c35 100644 --- a/Enjoyable.xcodeproj/project.pbxproj +++ b/Enjoyable.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ EE3D897C16EA806E00596D1F /* Status Menu Icon Disabled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = EE3D897B16EA806E00596D1F /* Status Menu Icon Disabled@2x.png */; }; EE3D897F16EA817E00596D1F /* Status Menu Icon Disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = EE3D897D16EA817E00596D1F /* Status Menu Icon Disabled.png */; }; EE3D898016EA817E00596D1F /* Status Menu Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = EE3D897E16EA817E00596D1F /* Status Menu Icon.png */; }; + EE52145C16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.m in Sources */ = {isa = PBXBuildFile; fileRef = EE52145B16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.m */; }; + EE52145F16F404D500E3C574 /* NJDeviceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE52145E16F404D500E3C574 /* NJDeviceViewController.m */; }; EE6A122E16E8F46300EDBD32 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = EE6A122D16E8F46300EDBD32 /* Icon.icns */; }; EE8455DD16F0E46B00F32A01 /* NSRunningApplication+LoginItem.m in Sources */ = {isa = PBXBuildFile; fileRef = EE8455DC16F0E46B00F32A01 /* NSRunningApplication+LoginItem.m */; }; EED4CE6E16ED692400C65AA8 /* NJMappingMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = EED4CE6D16ED692400C65AA8 /* NJMappingMenuController.m */; }; @@ -78,6 +80,10 @@ EE3D897B16EA806E00596D1F /* Status Menu Icon Disabled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Status Menu Icon Disabled@2x.png"; path = "Resources/Status Menu Icon Disabled@2x.png"; sourceTree = ""; }; EE3D897D16EA817E00596D1F /* Status Menu Icon Disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Status Menu Icon Disabled.png"; path = "Resources/Status Menu Icon Disabled.png"; sourceTree = ""; }; EE3D897E16EA817E00596D1F /* Status Menu Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Status Menu Icon.png"; path = "Resources/Status Menu Icon.png"; sourceTree = ""; }; + EE52145A16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSOutlineView+ItemAccessors.h"; path = "Categories/NSOutlineView+ItemAccessors.h"; sourceTree = ""; }; + EE52145B16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSOutlineView+ItemAccessors.m"; path = "Categories/NSOutlineView+ItemAccessors.m"; sourceTree = ""; }; + EE52145D16F404D500E3C574 /* NJDeviceViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NJDeviceViewController.h; path = Classes/NJDeviceViewController.h; sourceTree = ""; }; + EE52145E16F404D500E3C574 /* NJDeviceViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NJDeviceViewController.m; path = Classes/NJDeviceViewController.m; sourceTree = ""; }; EE6A122D16E8F46300EDBD32 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; EE8455DB16F0E46B00F32A01 /* NSRunningApplication+LoginItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSRunningApplication+LoginItem.h"; path = "Categories/NSRunningApplication+LoginItem.h"; sourceTree = ""; }; EE8455DC16F0E46B00F32A01 /* NSRunningApplication+LoginItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSRunningApplication+LoginItem.m"; path = "Categories/NSRunningApplication+LoginItem.m"; sourceTree = ""; }; @@ -202,6 +208,8 @@ EED4CE6D16ED692400C65AA8 /* NJMappingMenuController.m */, EEE703DA16F089FE002FDD69 /* NJHIDManager.h */, EEE703DB16F089FE002FDD69 /* NJHIDManager.m */, + EE52145D16F404D500E3C574 /* NJDeviceViewController.h */, + EE52145E16F404D500E3C574 /* NJDeviceViewController.m */, ); name = Classes; sourceTree = ""; @@ -302,6 +310,8 @@ EEF17D3216E8E2E100D7DC4D /* NSView+FirstResponder.m */, EEE73B1416EA42E5009D9D99 /* NSRunningApplication+NJPossibleNames.h */, EEE73B1516EA42E5009D9D99 /* NSRunningApplication+NJPossibleNames.m */, + EE52145A16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.h */, + EE52145B16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.m */, ); name = Categories; sourceTree = ""; @@ -442,6 +452,8 @@ EEE703DC16F089FE002FDD69 /* NJHIDManager.m in Sources */, EEE703DE16F0B3F6002FDD69 /* NJInputPathElement.m in Sources */, EE8455DD16F0E46B00F32A01 /* NSRunningApplication+LoginItem.m in Sources */, + EE52145C16F3E8BD00E3C574 /* NSOutlineView+ItemAccessors.m in Sources */, + EE52145F16F404D500E3C574 /* NJDeviceViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Info.plist b/Info.plist index b17e626..0b9f61d 100644 --- a/Info.plist +++ b/Info.plist @@ -46,7 +46,7 @@ CFBundleSignature ???? CFBundleVersion - 306 + 328 LSApplicationCategoryType public.app-category.utilities NSHumanReadableCopyright diff --git a/Other Sources/Enjoyable_Prefix.pch b/Other Sources/Enjoyable_Prefix.pch index b0d1f40..e074f78 100644 --- a/Other Sources/Enjoyable_Prefix.pch +++ b/Other Sources/Enjoyable_Prefix.pch @@ -16,3 +16,4 @@ #import "NSString+FixFilename.h" #import "NSRunningApplication+NJPossibleNames.h" #import "NSRunningApplication+LoginItem.h" +#import "NSOutlineView+ItemAccessors.h" diff --git a/Resources/English.lproj/MainMenu.xib b/Resources/English.lproj/MainMenu.xib index be18595..48ed439 100644 --- a/Resources/English.lproj/MainMenu.xib +++ b/Resources/English.lproj/MainMenu.xib @@ -2,10 +2,10 @@ 1080 - 12C2034 + 12D78 3084 - 1187.34 - 625.00 + 1187.37 + 626.00 com.apple.InterfaceBuilder.CocoaPlugin 3084 @@ -489,7 +489,7 @@ {664, 323} - + 256 @@ -501,6 +501,7 @@ -2147483374 {{20, 20}, {194, 283}} + _NS:22 YES @@ -530,6 +531,7 @@ Lg 274 {{20, 20}, {194, 283}} + _NS:22 YES @@ -564,7 +566,8 @@ aW5nLg {232, 321} - + + YES NO YES @@ -659,6 +662,7 @@ aW5nLg {{1, 1}, {232, 321}} + @@ -669,6 +673,7 @@ aW5nLg -2147483392 {{1, 1}, {8, 298}} + NO @@ -680,6 +685,7 @@ aW5nLg -2147483392 {{-100, -100}, {473, 15}} + NO 1 @@ -690,7 +696,8 @@ aW5nLg {234, 323} - + + 150034 @@ -703,6 +710,7 @@ aW5nLg {234, 323} + _NS:9 NSView @@ -716,6 +724,7 @@ aW5nLg 265 {{189, 117}, {224, 20}} + _NS:9 YES @@ -757,6 +766,8 @@ aW5nLg 268 {{343, 31}, {70, 18}} + + _NS:9 YES @@ -787,6 +798,7 @@ aW5nLg 265 {{189, 33}, {150, 20}} + _NS:9 YES @@ -831,6 +843,7 @@ aW5nLg 265 {{191, 24}, {146, 16}} + _NS:9 YES @@ -856,6 +869,7 @@ aW5nLg 265 {{189, 70}, {224, 24}} + _NS:9 YES @@ -909,6 +923,7 @@ aW5nLg 265 {{191, 108}, {220, 16}} + _NS:9 YES @@ -934,6 +949,7 @@ aW5nLg 265 {{191, 196}, {220, 23}} + _NS:9 NJKeyInputField @@ -943,6 +959,7 @@ aW5nLg 265 {{188, 153}, {226, 26}} + YES @@ -975,6 +992,7 @@ aW5nLg 268 {{24, 20}, {163, 250}} + NO 6 @@ -1105,6 +1123,7 @@ aW5nLg 266 {{9, 286}, {412, 17}} + YES @@ -1128,6 +1147,7 @@ aW5nLg 10 {{12, 276}, {406, 5}} + {0, 0} @@ -1154,12 +1174,15 @@ aW5nLg {{233, 0}, {431, 323}} + _NS:9 NSView {664, 323} + + {{0, 0}, {1440, 878}} @@ -1516,6 +1539,9 @@ aW5nLg SUUpdater + + NJDeviceViewController + @@ -1647,14 +1673,6 @@ aW5nLg 826 - - - outlineView - - - - 648 - connectDevicePrompt @@ -1687,6 +1705,14 @@ aW5nLg 982 + + + devicesViewController + + + + 992 + mappingsController @@ -1851,17 +1877,17 @@ aW5nLg dataSource - + - 647 + 990 delegate - + - 696 + 991 @@ -2159,6 +2185,38 @@ aW5nLg 969 + + + delegate + + + + 984 + + + + hidStoppedNotice + + + + 987 + + + + noDevicesNotice + + + + 988 + + + + inputsTree + + + + 989 + @@ -2989,6 +3047,11 @@ aW5nLg + + 983 + + + @@ -3240,12 +3303,13 @@ aW5nLg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin - 982 + 992 @@ -3296,47 +3360,37 @@ aW5nLg NJDeviceController NSObject - translatingEventsChanged: + simulatingEventsChanged: NSButton - translatingEventsChanged: + simulatingEventsChanged: - translatingEventsChanged: + simulatingEventsChanged: NSButton - NSView - NSView + NJDeviceViewController NJMappingsController - NSOutlineView NJOutputController - NSButton + NSButton - - connectDevicePrompt - NSView - - - hidSleepingPrompt - NSView + + devicesViewController + NJDeviceViewController mappingsController NJMappingsController - - outlineView - NSOutlineView - outputController NJOutputController - - translatingEventsButton + + simulatingEventsButton NSButton @@ -3345,6 +3399,38 @@ aW5nLg ./Classes/NJDeviceController.h + + NJDeviceViewController + NSObject + + id + NSView + NSOutlineView + NSView + + + + delegate + id + + + hidStoppedNotice + NSView + + + inputsTree + NSOutlineView + + + noDevicesNotice + NSView + + + + IBProjectSource + ./Classes/NJDeviceViewController.h + + NJKeyInputField NSControl @@ -3369,7 +3455,7 @@ aW5nLg NSObject id - NSMenuItem + NSMenuItem NSMenu @@ -3377,8 +3463,8 @@ aW5nLg delegate id - - eventTranslationToggle + + eventSimulationToggle NSMenuItem