mirror of
https://github.com/ksherlock/ample.git
synced 2025-02-22 13:29:02 +00:00
use bindings for media table views
This commit is contained in:
parent
058da073ee
commit
a5a6222c9f
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@ -51,6 +52,9 @@
|
|||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
|
<connections>
|
||||||
|
<binding destination="33q-UT-ur5" name="value" keyPath="objectValue.title" id="JQR-UW-ifh"/>
|
||||||
|
</connections>
|
||||||
</textField>
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
<connections>
|
<connections>
|
||||||
@ -69,6 +73,8 @@
|
|||||||
</pathCell>
|
</pathCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="pathAction:" target="-2" id="4oX-bW-ANp"/>
|
<action selector="pathAction:" target="-2" id="4oX-bW-ANp"/>
|
||||||
|
<binding destination="yGq-lc-RCM" name="enabled" keyPath="objectValue.valid" id="f8P-gt-vmK"/>
|
||||||
|
<binding destination="yGq-lc-RCM" name="value" keyPath="objectValue.url" id="Ony-ph-VVo"/>
|
||||||
</connections>
|
</connections>
|
||||||
</pathControl>
|
</pathControl>
|
||||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="6g1-NT-J1w">
|
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="6g1-NT-J1w">
|
||||||
@ -85,6 +91,11 @@
|
|||||||
</buttonCell>
|
</buttonCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="ejectAction:" target="-2" id="XAl-eQ-nUj"/>
|
<action selector="ejectAction:" target="-2" id="XAl-eQ-nUj"/>
|
||||||
|
<binding destination="yGq-lc-RCM" name="enabled" keyPath="objectValue.url" id="suf-EI-g6t">
|
||||||
|
<dictionary key="options">
|
||||||
|
<string key="NSValueTransformerName">NSIsNotNil</string>
|
||||||
|
</dictionary>
|
||||||
|
</binding>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
@ -81,8 +81,6 @@
|
|||||||
|
|
||||||
-(void)prepareView: (NSTableCellView *)view {
|
-(void)prepareView: (NSTableCellView *)view {
|
||||||
|
|
||||||
[view setObjectValue: self];
|
|
||||||
[[view textField] setStringValue: _title];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(CGFloat)height {
|
-(CGFloat)height {
|
||||||
@ -208,39 +206,6 @@
|
|||||||
|
|
||||||
-(void)prepareView: (TablePathView *)view {
|
-(void)prepareView: (TablePathView *)view {
|
||||||
|
|
||||||
NSValueTransformer *t;
|
|
||||||
NSDictionary *options;
|
|
||||||
|
|
||||||
[view setObjectValue: self];
|
|
||||||
|
|
||||||
NSPathControl *pc = [view pathControl];
|
|
||||||
NSButton *button = [view ejectButton];
|
|
||||||
|
|
||||||
[pc unbind: @"value"];
|
|
||||||
[pc unbind: @"enabled"];
|
|
||||||
[pc bind: @"value" toObject: self withKeyPath: @"url" options: nil];
|
|
||||||
[pc bind: @"enabled" toObject: self withKeyPath: @"valid" options: options];
|
|
||||||
|
|
||||||
[button unbind: @"enabled"];
|
|
||||||
t = [NSValueTransformer valueTransformerForName: NSIsNotNilTransformerName];
|
|
||||||
options = @{ NSValueTransformerBindingOption: t};
|
|
||||||
[button bind: @"enabled" toObject: self withKeyPath: @"url" options: options];
|
|
||||||
|
|
||||||
|
|
||||||
if (@available(macOS 10.14, *)) {
|
|
||||||
[button unbind: @"contentTintColor"];
|
|
||||||
|
|
||||||
t = [NSValueTransformer valueTransformerForName: @"ValidColorTransformer"];
|
|
||||||
options = @{ NSValueTransformerBindingOption: t};
|
|
||||||
[button bind: @"contentTintColor" toObject: self withKeyPath: @"valid" options: options];
|
|
||||||
} else {
|
|
||||||
// El Capitan TODO...
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
NSColor *tintColor = nil;
|
|
||||||
if (!_valid) tintColor = [NSColor systemRedColor];
|
|
||||||
[button setContentTintColor: tintColor];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(CGFloat)height {
|
-(CGFloat)height {
|
||||||
@ -436,8 +401,9 @@ static NSString *kDragType = @"private.ample.media";
|
|||||||
NSString *ident = [item viewIdentifier];
|
NSString *ident = [item viewIdentifier];
|
||||||
if (!ident) return nil;
|
if (!ident) return nil;
|
||||||
NSTableCellView *v = [outlineView makeViewWithIdentifier: ident owner: self];
|
NSTableCellView *v = [outlineView makeViewWithIdentifier: ident owner: self];
|
||||||
[(id<MediaNode>)item prepareView: v];
|
|
||||||
[v setObjectValue: item];
|
[v setObjectValue: item];
|
||||||
|
|
||||||
|
[(id<MediaNode>)item prepareView: v];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,24 @@
|
|||||||
NSTrackingRectTag _trackingRect;
|
NSTrackingRectTag _trackingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)awakeFromNib {
|
||||||
|
|
||||||
|
// need to do it here for 10.11 compatibility.
|
||||||
|
|
||||||
|
if (@available(macOS 10.14, *)) {
|
||||||
|
NSValueTransformer *t;
|
||||||
|
NSDictionary *options;
|
||||||
|
|
||||||
|
t = [NSValueTransformer valueTransformerForName: @"ValidColorTransformer"];
|
||||||
|
options = @{ NSValueTransformerBindingOption: t};
|
||||||
|
[_ejectButton bind: @"contentTintColor" toObject: self withKeyPath: @"objectValue.valid" options: options];
|
||||||
|
} else {
|
||||||
|
// El Capitan TODO...
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
-(void)awakeFromNib {
|
-(void)awakeFromNib {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user