From: Joe Wreschnig Date: Thu, 7 Mar 2013 16:16:34 +0000 (+0100) Subject: Show/hide prompt for device connection. X-Git-Tag: version-1.0~3 X-Git-Url: https://git.yukkurigames.com/?a=commitdiff_plain;h=18160be57e656a3733fc29878caddcda5081a2c2;p=enjoyable.git Show/hide prompt for device connection. --- diff --git a/Classes/EnjoyableApplicationDelegate.m b/Classes/EnjoyableApplicationDelegate.m index c477511..5c68476 100644 --- a/Classes/EnjoyableApplicationDelegate.m +++ b/Classes/EnjoyableApplicationDelegate.m @@ -108,6 +108,11 @@ } #define OUTPUT_PANE_MIN_WIDTH 390 +#define INPUT_PANE_MIN_WIDTH 160 + +- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex { + return INPUT_PANE_MIN_WIDTH; +} - (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset { return proposedMax - OUTPUT_PANE_MIN_WIDTH; diff --git a/Classes/NJDeviceController.h b/Classes/NJDeviceController.h index 7658c64..07695f7 100644 --- a/Classes/NJDeviceController.h +++ b/Classes/NJDeviceController.h @@ -17,6 +17,7 @@ IBOutlet NJMappingsController *mappingsController; IBOutlet NSButton *translatingEventsButton; IBOutlet NSMenuItem *translatingEventsMenu; + IBOutlet NSView *connectDevicePrompt; } @property (nonatomic, readonly) NJInput *selectedInput; diff --git a/Classes/NJDeviceController.m b/Classes/NJDeviceController.m index d553d7d..0ed8bc6 100644 --- a/Classes/NJDeviceController.m +++ b/Classes/NJDeviceController.m @@ -113,6 +113,7 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { dev.index = findAvailableIndex(_devices, dev); [_devices addObject:dev]; [outlineView reloadData]; + [connectDevicePrompt setHidden:!!_devices.count]; } static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDeviceRef device) { @@ -138,6 +139,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD if (match) { [_devices removeObject:match]; [outlineView reloadData]; + [connectDevicePrompt setHidden:!!_devices.count]; } }