diff --git a/Ample/Base.lproj/LaunchWindow.xib b/Ample/Base.lproj/LaunchWindow.xib index a61c19a..ee20223 100644 --- a/Ample/Base.lproj/LaunchWindow.xib +++ b/Ample/Base.lproj/LaunchWindow.xib @@ -32,7 +32,7 @@ - + @@ -348,7 +348,7 @@ DQ - + diff --git a/Ample/Base.lproj/MediaView.xib b/Ample/Base.lproj/MediaView.xib index 6089746..e02ae57 100644 --- a/Ample/Base.lproj/MediaView.xib +++ b/Ample/Base.lproj/MediaView.xib @@ -14,20 +14,20 @@ - - + + - + - - + + - + @@ -40,11 +40,11 @@ - + - + @@ -58,11 +58,11 @@ - + - + @@ -77,7 +77,7 @@ + @@ -99,5 +116,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ample/NewSlotViewController.m b/Ample/NewSlotViewController.m index 678eef5..54e9af3 100644 --- a/Ample/NewSlotViewController.m +++ b/Ample/NewSlotViewController.m @@ -41,6 +41,7 @@ static_assert(SLOT_COUNT <= sizeof(unsigned) * 8, "too many slot types"); NSDictionary *_machine_data; + IBOutlet NSPopover *_popover; } @@ -49,7 +50,7 @@ static_assert(SLOT_COUNT <= sizeof(unsigned) * 8, "too many slot types"); // Do view setup here. _root = @[]; - [_outlineView setIndentationPerLevel: 2.0]; + //[_outlineView setIndentationPerLevel: 2.0]; } -(void)resetMachine { @@ -219,6 +220,18 @@ static_assert(SLOT_COUNT <= sizeof(unsigned) * 8, "too many slot types"); } [self rebuildArgs]; } +- (IBAction)hamburger:(id)sender { + +#if 1 + if ([_popover isShown]) { + [_popover close]; + } +#endif + [_popover showRelativeToRect: [sender bounds] + ofView: sender + preferredEdge: NSRectEdgeMaxX]; +} + -(IBAction)resetSlots:(id)sender { _slots_explicit = 0; diff --git a/Ample/Slot.h b/Ample/Slot.h index b1cd403..687727b 100644 --- a/Ample/Slot.h +++ b/Ample/Slot.h @@ -24,6 +24,7 @@ @property (readonly) NSString *title; @property (readonly) NSArray *menuItems; +@property (readonly) SlotOption *selectedItem; -(NSArray *)args; -(NSArray *)serialize; @@ -32,7 +33,7 @@ -(void)prepareView: (SlotTableCellView *)view; -(void)selectValue: (NSString *)value; --(SlotOption *)selectedItem; + -(Media)selectedMedia; -(NSArray *)selectedChildren; @@ -51,7 +52,7 @@ @interface SlotTableCellView : NSTableCellView @property (weak) IBOutlet NSPopUpButton *menuButton; - +@property (weak) IBOutlet NSButton *hamburgerButton; @end diff --git a/Ample/Slot.m b/Ample/Slot.m index 7042c6a..45b5776 100644 --- a/Ample/Slot.m +++ b/Ample/Slot.m @@ -308,6 +308,9 @@ static NSDictionary *IndexMap = nil; NSPopUpButton *button = [view menuButton]; NSTextField *text = [view textField]; + + [view setObjectValue: self]; + [text setObjectValue: _title]; [button unbind: @"selectedIndex"]; NSMenu *menu = [button menu]; @@ -316,8 +319,25 @@ static NSDictionary *IndexMap = nil; [menu setItemArray: menuItems]; [button bind: @"selectedIndex" toObject: self withKeyPath: @"selectedIndex" options: nil]; [button setTag: _index]; + + NSButton *hb = [view hamburgerButton]; + [hb setTag: _index]; +#if 0 + // bind w/ NSIsNilTransformerName? selected index would need to flag it dirty. + if ([self selectedChildren]) { + [hb setHidden: NO]; + } else { + [hb setHidden: YES]; + } +#endif } +/* +https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueObserving/Articles/KVODependentKeys.html + */ ++ (NSSet *)keyPathsForValuesAffectingSelectedItem { + return [NSSet setWithObject: @"selectedIndex"]; +} @end