summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/English.lproj/HBTitleSelection.xib183
-rw-r--r--macosx/HBTitleSelectionController.h4
-rw-r--r--macosx/HBTitleSelectionController.m88
3 files changed, 177 insertions, 98 deletions
diff --git a/macosx/English.lproj/HBTitleSelection.xib b/macosx/English.lproj/HBTitleSelection.xib
index 4a6040c1c..f0134e6b3 100644
--- a/macosx/English.lproj/HBTitleSelection.xib
+++ b/macosx/English.lproj/HBTitleSelection.xib
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8164.2" systemVersion="15A225f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<development version="6300" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8164.2"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HBTitleSelectionController">
@@ -11,6 +11,11 @@
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
+ <arrayController id="Btd-Nt-z41" userLabel="Titles Array Controller">
+ <connections>
+ <binding destination="-2" name="contentArray" keyPath="self.titles" id="ujR-MW-HYh"/>
+ </connections>
+ </arrayController>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
@@ -23,6 +28,46 @@
<rect key="frame" x="0.0" y="0.0" width="504" height="250"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="5Jw-On-iU3">
+ <rect key="frame" x="18" y="216" width="263" height="14"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <animations/>
+ <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Select the titles to add to the queue:" id="5tD-fg-g4t">
+ <font key="font" metaFont="smallSystemBold"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <button verticalHuggingPriority="750" id="TFh-c7-W2w">
+ <rect key="frame" x="425" y="14" width="64" height="28"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mOe-XL-tl1">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="add:" target="-2" id="3wk-rU-eSZ"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" id="t5w-9e-K60">
+ <rect key="frame" x="342" y="14" width="81" height="28"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="jHg-nh-9NJ">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="cancel:" target="-2" id="DP7-vq-pVX"/>
+ </connections>
+ </button>
<scrollView autohidesScrollers="YES" horizontalLineScroll="18" horizontalPageScroll="10" verticalLineScroll="18" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="a1K-L9-fU9">
<rect key="frame" x="20" y="57" width="464" height="151"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -30,8 +75,8 @@
<rect key="frame" x="1" y="0.0" width="238" height="134"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="14" id="wM9-Ln-dr0">
- <rect key="frame" x="0.0" y="0.0" width="462" height="18"/>
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="14" viewBased="YES" id="wM9-Ln-dr0">
+ <rect key="frame" x="0.0" y="0.0" width="462" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="4"/>
@@ -51,6 +96,31 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="6H6-2e-RPZ">
+ <rect key="frame" x="1" y="2" width="30" height="15"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="gLJ-VQ-3cg">
+ <rect key="frame" x="0.0" y="1" width="29" height="14"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+ <animations/>
+ <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="0" id="hQc-RA-phB">
+ <font key="font" metaFont="smallSystem"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <binding destination="6H6-2e-RPZ" name="value" keyPath="objectValue.title.index" id="bD2-qX-18u"/>
+ </connections>
+ </textField>
+ </subviews>
+ <animations/>
+ <connections>
+ <outlet property="textField" destination="gLJ-VQ-3cg" id="0FP-jj-mZ3"/>
+ </connections>
+ </tableCellView>
+ </prototypeCellViews>
</tableColumn>
<tableColumn identifier="title" width="333" minWidth="40" maxWidth="2000" id="FQY-Ye-g0f">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
@@ -63,6 +133,28 @@
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="Sil-eA-Flj">
+ <rect key="frame" x="34" y="2" width="333" height="15"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <button id="LSj-el-4SZ">
+ <rect key="frame" x="0.0" y="-2" width="332" height="20"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+ <animations/>
+ <buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="JqJ-5C-Yhw">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ </buttonCell>
+ <connections>
+ <binding destination="Sil-eA-Flj" name="value" keyPath="objectValue.selected" id="DB2-Lb-KSc"/>
+ <binding destination="Sil-eA-Flj" name="title" keyPath="objectValue.title.name" id="Iph-ut-pMv"/>
+ </connections>
+ </button>
+ </subviews>
+ <animations/>
+ </tableCellView>
+ </prototypeCellViews>
</tableColumn>
<tableColumn identifier="duration" width="90" minWidth="90" maxWidth="90" id="a6r-ky-REh">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
@@ -76,11 +168,36 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="eNN-Bb-hW0">
+ <rect key="frame" x="370" y="2" width="90" height="15"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="dTs-ND-Vgf">
+ <rect key="frame" x="0.0" y="1" width="90" height="14"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+ <animations/>
+ <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="dsG-Ho-vsT">
+ <font key="font" metaFont="smallSystem"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <binding destination="eNN-Bb-hW0" name="value" keyPath="objectValue.title.timeCode" id="rtf-VT-Ibw"/>
+ </connections>
+ </textField>
+ </subviews>
+ <animations/>
+ <connections>
+ <outlet property="textField" destination="dTs-ND-Vgf" id="XHC-5X-yGo"/>
+ </connections>
+ </tableCellView>
+ </prototypeCellViews>
</tableColumn>
</tableColumns>
<connections>
- <outlet property="dataSource" destination="-2" id="bFm-Ca-P9Y"/>
- <outlet property="delegate" destination="-2" id="jJ2-f7-lui"/>
+ <binding destination="Btd-Nt-z41" name="content" keyPath="arrangedObjects" id="Yyh-f8-EYR"/>
+ <outlet property="menu" destination="vdO-DI-vks" id="Iux-VV-EDo"/>
</connections>
</tableView>
</subviews>
@@ -88,57 +205,17 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<animations/>
- <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="KUp-wz-bHB">
+ <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="KUp-wz-bHB">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
- <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="iFv-s2-21F">
+ <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="iFv-s2-21F">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
</scrollView>
- <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="5Jw-On-iU3">
- <rect key="frame" x="18" y="216" width="263" height="14"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
- <animations/>
- <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Select the titles to add to the queue:" id="5tD-fg-g4t">
- <font key="font" metaFont="smallSystemBold"/>
- <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
- </textFieldCell>
- </textField>
- <button verticalHuggingPriority="750" id="TFh-c7-W2w">
- <rect key="frame" x="425" y="14" width="64" height="28"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- <animations/>
- <buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mOe-XL-tl1">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="smallSystem"/>
- <string key="keyEquivalent" base64-UTF8="YES">
-DQ
-</string>
- </buttonCell>
- <connections>
- <action selector="add:" target="-2" id="3wk-rU-eSZ"/>
- </connections>
- </button>
- <button verticalHuggingPriority="750" id="t5w-9e-K60">
- <rect key="frame" x="342" y="14" width="81" height="28"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- <animations/>
- <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="jHg-nh-9NJ">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="smallSystem"/>
- <string key="keyEquivalent" base64-UTF8="YES">
-Gw
-</string>
- </buttonCell>
- <connections>
- <action selector="cancel:" target="-2" id="DP7-vq-pVX"/>
- </connections>
- </button>
</subviews>
<animations/>
</view>
@@ -147,5 +224,15 @@ Gw
</connections>
<point key="canvasLocation" x="501" y="-14"/>
</window>
+ <menu id="vdO-DI-vks">
+ <items>
+ <menuItem title="Deselect All" id="PXF-7D-BKR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="deselectAll:" target="-2" id="Sxn-Dj-lrs"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
</objects>
</document>
diff --git a/macosx/HBTitleSelectionController.h b/macosx/HBTitleSelectionController.h
index 226340347..8aa7e33eb 100644
--- a/macosx/HBTitleSelectionController.h
+++ b/macosx/HBTitleSelectionController.h
@@ -8,6 +8,8 @@
NS_ASSUME_NONNULL_BEGIN
+@class HBTitle;
+
@protocol HBTitleSelectionDelegate <NSObject>
- (void)didSelectIndexes:(NSIndexSet *)indexes;
@@ -16,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface HBTitleSelectionController : NSWindowController
-- (instancetype)initWithTitles:(NSArray *)titles delegate:(id<HBTitleSelectionDelegate>)delegate;
+- (instancetype)initWithTitles:(NSArray<HBTitle *> *)titles delegate:(id<HBTitleSelectionDelegate>)delegate;
@end
diff --git a/macosx/HBTitleSelectionController.m b/macosx/HBTitleSelectionController.m
index 7575eb74a..7e9ea0af0 100644
--- a/macosx/HBTitleSelectionController.m
+++ b/macosx/HBTitleSelectionController.m
@@ -7,11 +7,37 @@
#import "HBTitleSelectionController.h"
#import "HBTitle.h"
-@interface HBTitleSelectionController () <NSTableViewDataSource, NSTableViewDelegate>
+@interface HBTitleSelection : NSObject
+@property (nonatomic, readonly) HBTitle *title;
+@property (nonatomic, readonly) BOOL selected;
+@property (nonatomic, readonly, assign) NSUndoManager *undo;
+@end
+
+@implementation HBTitleSelection
+- (instancetype)initWithTitle:(HBTitle *)title undo:(NSUndoManager *)undo
+{
+ if (self = [super init])
+ {
+ _title = title;
+ _selected = YES;
+ _undo = undo;
+ }
+ return self;
+}
+
+- (void)setSelected:(BOOL)selected
+{
+ if (selected != _selected)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setSelected:_selected];
+ }
+ _selected = selected;
+}
+@end
-@property (nonatomic, readonly) NSArray *titles;
-@property (nonatomic, readonly) NSMutableArray *selection;
+@interface HBTitleSelectionController () <NSTableViewDataSource, NSTableViewDelegate>
+@property (nonatomic, readwrite) NSArray<HBTitleSelection *> *titles;
@property (nonatomic, readonly, assign) id<HBTitleSelectionDelegate> delegate;
@end
@@ -23,58 +49,24 @@
self = [super initWithWindowNibName:@"HBTitleSelection"];
if (self)
{
- _titles = titles;
- _selection = [[NSMutableArray alloc] initWithCapacity:titles.count];
_delegate = delegate;
- for (NSUInteger i = 0; i < titles.count; i++)
+ NSMutableArray<HBTitleSelection *> *array = [[NSMutableArray alloc] init];
+ for (HBTitle *title in titles)
{
- _selection[i] = @YES;
+ [array addObject:[[HBTitleSelection alloc] initWithTitle:title undo:self.window.undoManager]];
}
+ self.titles = [array copy];
}
return self;
}
-- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
-{
- return self.titles.count;
-}
-
-- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+- (IBAction)deselectAll:(id)sender
{
- HBTitle *title = self.titles[row];
-
- if ([tableColumn.identifier isEqualTo:@"index"])
- {
- return @(title.index);
- }
- else if ([tableColumn.identifier isEqualTo:@"title"])
- {
- return self.selection[row];
- }
- else if ([tableColumn.identifier isEqualTo:@"duration"])
+ for (HBTitleSelection *title in self.titles)
{
- return title.timeCode;
- }
-
- return nil;
-}
-
-- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
-{
- if ([tableColumn.identifier isEqualTo:@"title"])
- {
- self.selection[row] = object;
- }
-}
-
-- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
-{
- if ([tableColumn.identifier isEqualTo:@"title"])
- {
- HBTitle *title = self.titles[row];
- [aCell setTitle:title.name];
+ title.selected = NO;
}
}
@@ -82,13 +74,11 @@
{
NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet];
- [self.selection enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- if ([obj boolValue])
+ [self.titles enumerateObjectsUsingBlock:^(HBTitleSelection *obj, NSUInteger idx, BOOL *stop) {
+ if (obj.selected)
{
- HBTitle *title = self.titles[idx];
- [indexes addIndex:title.index];
+ [indexes addIndex:obj.title.index];
}
-
}];
[self.delegate didSelectIndexes:indexes];
}