Show/hide prompt for device connection.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 7 Mar 2013 16:16:34 +0000 (17:16 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 7 Mar 2013 16:16:34 +0000 (17:16 +0100)
Classes/EnjoyableApplicationDelegate.m
Classes/NJDeviceController.h
Classes/NJDeviceController.m

index c477511686b30a9db005603dd3fc0bdac24c6300..5c6847645b8be5f28587c0977f6bd0f7f9865dbf 100644 (file)
 }
 
 #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;
index 7658c64afc615bc3c78aca4daf649aa40d4c97f1..07695f7581693daabdc8d6094853acfc5f9f84c2 100644 (file)
@@ -17,6 +17,7 @@
     IBOutlet NJMappingsController *mappingsController;
     IBOutlet NSButton *translatingEventsButton;
     IBOutlet NSMenuItem *translatingEventsMenu;
+    IBOutlet NSView *connectDevicePrompt;
 }
 
 @property (nonatomic, readonly) NJInput *selectedInput;
index d553d7de3330c1eecfa503aa040a439e23ddf037..0ed8bc697ad3efdbfb602d54aa68f80003415bf4 100644 (file)
@@ -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];
     }
     
 }