From 18160be57e656a3733fc29878caddcda5081a2c2 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 7 Mar 2013 17:16:34 +0100 Subject: [PATCH] Show/hide prompt for device connection. --- Classes/EnjoyableApplicationDelegate.m | 5 +++++ Classes/NJDeviceController.h | 1 + Classes/NJDeviceController.m | 2 ++ 3 files changed, 8 insertions(+) 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]; } } -- 2.30.2