Convert some cells to Swift.
This commit is contained in:
25 files changed
+173
-288
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13189.4" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13528" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13189.4"/>
|
||||
<plugIn identifier="com.apple.imagekit.ibplugin" version="13189.4"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13528"/>
|
||||
<plugIn identifier="com.apple.imagekit.ibplugin" version="13528"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -35,7 +35,7 @@
|
||||
<rect key="frame" x="20" y="86" width="179" height="296"/>
|
||||
<clipView key="contentView" copiesOnScroll="NO" id="7IP-Gn-Bxd">
|
||||
<rect key="frame" x="1" y="1" width="177" height="294"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<ikImageBrowserView autoresizesSubviews="NO" zoomValue="1" allowsReordering="YES" animates="YES" translatesAutoresizingMaskIntoConstraints="NO" id="217" customClass="SBImageBrowserView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="177" height="294"/>
|
||||
@@ -163,7 +163,7 @@
|
||||
<rect key="frame" x="207" y="86" width="473" height="296"/>
|
||||
<clipView key="contentView" id="cQT-bX-0YB">
|
||||
<rect key="frame" x="1" y="0.0" width="471" height="295"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" rowSizeStyle="automatic" headerView="qXU-xB-xRF" viewBased="YES" floatsGroupRows="NO" id="qg5-r0-E4V" customClass="SBTableView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="471" height="272"/>
|
||||
@@ -273,7 +273,7 @@
|
||||
<outlet property="textField" destination="AmC-rT-7Rf" id="L5l-ht-Zv3"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="PopUpCell" id="JEU-aR-J9v" customClass="SBPopUpCellView">
|
||||
<tableCellView identifier="PopUpCell" id="JEU-aR-J9v" customClass="PopUpCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="122" y="33" width="347" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@@ -302,7 +302,7 @@
|
||||
<outlet property="popUpButton" destination="cFv-4U-VzM" id="ELP-zT-lga"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="BoolCell" id="DGy-Nb-PAN" customClass="SBCheckBoxCellView">
|
||||
<tableCellView identifier="BoolCell" id="DGy-Nb-PAN" customClass="CheckBoxCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="122" y="49" width="347" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@@ -327,13 +327,13 @@
|
||||
<outlet property="checkboxButton" destination="oyk-jS-zmh" id="8Ei-w1-gg3"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="ComboCell" id="vy5-48-Vip" customClass="SBComboBoxCellView">
|
||||
<tableCellView identifier="ComboCell" id="vy5-48-Vip" customClass="ComboBoxCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="122" y="68" width="347" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<comboBox verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="1000" translatesAutoresizingMaskIntoConstraints="NO" id="LbC-r6-Pau">
|
||||
<rect key="frame" x="3" y="0.0" width="344" height="19"/>
|
||||
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn" customClass="SBComboBoxCell">
|
||||
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn" customClass="ComboBoxCell" customModule="Subler" customModuleProvider="target">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13168.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13528" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13168.3"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13528"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -99,7 +99,7 @@
|
||||
<subviews>
|
||||
<tokenField verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3sj-gY-zSo">
|
||||
<rect key="frame" x="1" y="1" width="205" height="16"/>
|
||||
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" allowsEditingTextAttributes="YES" id="BaM-xn-Wzr" customClass="SBTokenFieldCell">
|
||||
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" allowsEditingTextAttributes="YES" id="BaM-xn-Wzr" customClass="TokenFieldCell" customModule="Subler" customModuleProvider="target">
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// CheckBoxCellView.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 20/10/2017.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class CheckBoxCellView : NSTableCellView {
|
||||
@IBOutlet var checkboxButton: NSButton!
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// ComboBoxCellView.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 20/10/2017.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class ComboBoxCellView : NSTableCellView {
|
||||
@IBOutlet var comboBox: NSComboBox!
|
||||
}
|
||||
@@ -169,8 +169,8 @@ class FileImportController: NSWindowController, NSTableViewDataSource, NSTableVi
|
||||
private var importMetadata: Bool
|
||||
private weak var delegate: FileImportControllerDelegate?
|
||||
|
||||
@IBOutlet weak var tableView: SBTableView!
|
||||
@IBOutlet weak var importMetadataCheckbox: NSButton!
|
||||
@IBOutlet var tableView: SBTableView!
|
||||
@IBOutlet var importMetadataCheckbox: NSButton!
|
||||
|
||||
override public var windowNibName: NSNib.Name? {
|
||||
return NSNib.Name(rawValue: "FileImportController")
|
||||
@@ -410,7 +410,7 @@ class FileImportController: NSWindowController, NSTableViewDataSource, NSTableVi
|
||||
switch tableColumn?.identifier {
|
||||
|
||||
case checkColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: checkColumn, owner:self) as? SBCheckBoxCellView
|
||||
let cell = tableView.makeView(withIdentifier: checkColumn, owner:self) as? CheckBoxCellView
|
||||
cell?.checkboxButton?.state = settings.checked ? NSControl.StateValue.on : NSControl.StateValue.off
|
||||
return cell
|
||||
|
||||
@@ -440,7 +440,7 @@ class FileImportController: NSWindowController, NSTableViewDataSource, NSTableVi
|
||||
return cell
|
||||
|
||||
case trackActionColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackActionColumn, owner:self) as? SBPopUpCellView
|
||||
let cell = tableView.makeView(withIdentifier: trackActionColumn, owner:self) as? PopUpCellView
|
||||
if let menu = cell?.popUpButton?.menu {
|
||||
menu.removeAllItems()
|
||||
_ = settings.actions.map {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// PopUpCellView.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 20/10/2017.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class PopUpCellView : NSTableCellView {
|
||||
@IBOutlet var popUpButton: NSPopUpButton!
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13526" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13528" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13526"/>
|
||||
<plugIn identifier="com.apple.imagekit.ibplugin" version="13526"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13528"/>
|
||||
<plugIn identifier="com.apple.imagekit.ibplugin" version="13528"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -203,7 +203,7 @@
|
||||
<outlet property="textField" destination="AmC-rT-7Rf" id="L5l-ht-Zv3"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="PopUpCell" id="JEU-aR-J9v" customClass="SBPopUpCellView">
|
||||
<tableCellView identifier="PopUpCell" id="JEU-aR-J9v" customClass="PopUpCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="122" y="33" width="322" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@@ -228,7 +228,7 @@
|
||||
<outlet property="popUpButton" destination="cFv-4U-VzM" id="ELP-zT-lga"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="BoolCell" id="DGy-Nb-PAN" customClass="SBCheckBoxCellView">
|
||||
<tableCellView identifier="BoolCell" id="DGy-Nb-PAN" customClass="CheckBoxCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="122" y="49" width="322" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@@ -248,14 +248,14 @@
|
||||
<outlet property="checkboxButton" destination="oyk-jS-zmh" id="8Ei-w1-gg3"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="ComboCell" id="vy5-48-Vip" customClass="SBComboBoxCellView">
|
||||
<tableCellView identifier="ComboCell" id="vy5-48-Vip" customClass="ComboBoxCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="122" y="68" width="322" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<comboBox verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="1000" translatesAutoresizingMaskIntoConstraints="NO" id="LbC-r6-Pau">
|
||||
<rect key="frame" x="3" y="0.0" width="319" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn" customClass="SBComboBoxCell">
|
||||
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn" customClass="ComboBoxCell" customModule="Subler" customModuleProvider="target">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@@ -12,9 +12,6 @@ NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType";
|
||||
#import "SBMovieViewController.h"
|
||||
#import "SBTableView.h"
|
||||
#import "SBImageBrowserView.h"
|
||||
#import "SBPopUpCellView.h"
|
||||
#import "SBCheckBoxCellView.h"
|
||||
#import "SBComboBoxCellView.h"
|
||||
|
||||
#import <MP42Foundation/MP42Ratings.h>
|
||||
#import <MP42Foundation/MP42Image.h>
|
||||
@@ -431,7 +428,7 @@ static NSArray<NSArray *> *_mediaKinds;
|
||||
|
||||
- (NSTableCellView *)boolCellWithState:(BOOL)state tableView:(NSTableView *)tableView
|
||||
{
|
||||
SBCheckBoxCellView *cell = [tableView makeViewWithIdentifier:@"BoolCell" owner:self];
|
||||
CheckBoxCellView *cell = [tableView makeViewWithIdentifier:@"BoolCell" owner:self];
|
||||
cell.checkboxButton.state = state;
|
||||
return cell;
|
||||
}
|
||||
@@ -445,7 +442,7 @@ static NSArray<NSArray *> *_mediaKinds;
|
||||
|
||||
- (NSTableCellView *)popUpRatingCellWithContents:(NSArray<NSString *> *)contents value:(NSString *)value tableView:(NSTableView *)tableView
|
||||
{
|
||||
SBPopUpCellView *popUpCell = [tableView makeViewWithIdentifier:@"PopUpCell" owner:self];
|
||||
PopUpCellView *popUpCell = [tableView makeViewWithIdentifier:@"PopUpCell" owner:self];
|
||||
[popUpCell.popUpButton removeAllItems];
|
||||
for (NSString *title in contents) {
|
||||
[popUpCell.popUpButton.menu addItem:[[NSMenuItem alloc] initWithTitle:title action:NULL keyEquivalent:@""]];
|
||||
@@ -468,7 +465,7 @@ static NSArray<NSArray *> *_mediaKinds;
|
||||
- (NSTableCellView *)popUpCellWithArrayContents:(NSArray<NSArray *> *)contents value:(NSNumber *)value tableView:(NSTableView *)tableView
|
||||
{
|
||||
NSInteger index = 0;
|
||||
SBPopUpCellView *popUpCell = [tableView makeViewWithIdentifier:@"PopUpCell" owner:self];
|
||||
PopUpCellView *popUpCell = [tableView makeViewWithIdentifier:@"PopUpCell" owner:self];
|
||||
[popUpCell.popUpButton removeAllItems];
|
||||
for (NSArray *array in contents) {
|
||||
[popUpCell.popUpButton.menu addItem:[[NSMenuItem alloc] initWithTitle:array.firstObject action:NULL keyEquivalent:@""]];
|
||||
@@ -489,7 +486,7 @@ static NSArray<NSArray *> *_mediaKinds;
|
||||
|
||||
- (NSTableCellView *)comboBoxCellWithArrayContents:(NSArray<NSString *> *)contents value:(NSString *)value tableView:(NSTableView *)tableView
|
||||
{
|
||||
SBComboBoxCellView *comboBoxCell = [tableView makeViewWithIdentifier:@"ComboCell" owner:self];
|
||||
ComboBoxCellView *comboBoxCell = [tableView makeViewWithIdentifier:@"ComboCell" owner:self];
|
||||
comboBoxCell.comboBox.stringValue = value;
|
||||
[comboBoxCell.comboBox addItemsWithObjectValues:contents];
|
||||
return comboBoxCell;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// SBCheckBoxCellView.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SBCheckBoxCellView : NSTableCellView
|
||||
|
||||
@property (nonatomic, nullable, assign) IBOutlet NSButton *checkboxButton;
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// SBCheckBoxCellView.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBCheckBoxCellView.h"
|
||||
|
||||
@implementation SBCheckBoxCellView
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// SBComboBoxCell.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/11/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SBComboBoxCell : NSComboBoxCell
|
||||
|
||||
@end
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// SBComboBoxCell.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/11/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBComboBoxCell.h"
|
||||
|
||||
@interface SBComboBoxCell ()
|
||||
|
||||
@property (nonatomic) NSBackgroundStyle SB_originalBackgroundStyle;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBComboBoxCell
|
||||
|
||||
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle
|
||||
{
|
||||
[super setBackgroundStyle:backgroundStyle];
|
||||
if (backgroundStyle == NSBackgroundStyleDark) {
|
||||
self.textColor = [NSColor controlHighlightColor];
|
||||
}
|
||||
else {
|
||||
self.textColor = [NSColor controlTextColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj;
|
||||
{
|
||||
self.SB_originalBackgroundStyle = self.backgroundStyle;
|
||||
|
||||
self.backgroundStyle = NSBackgroundStyleLight;
|
||||
self.drawsBackground = YES;
|
||||
|
||||
return [super setUpFieldEditorAttributes:textObj];
|
||||
}
|
||||
|
||||
- (void)endEditing:(NSText *)textObj
|
||||
{
|
||||
[super endEditing:textObj];
|
||||
self.drawsBackground = NO;
|
||||
self.backgroundStyle = self.SB_originalBackgroundStyle;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// SBComboBoxCellView.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 11/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SBComboBoxCellView : NSTableCellView
|
||||
|
||||
@property (nonatomic, nullable, assign) IBOutlet NSComboBox *comboBox;
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// SBComboBoxCellView.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 11/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBComboBoxCellView.h"
|
||||
|
||||
@implementation SBComboBoxCellView
|
||||
|
||||
@end
|
||||
@@ -10,8 +10,6 @@
|
||||
#import "SBQueueController.h"
|
||||
#import "SBQueueItem.h"
|
||||
#import "SBTableView.h"
|
||||
#import "SBCheckBoxCellView.h"
|
||||
#import "SBPopUpCellView.h"
|
||||
|
||||
#import "SBEmptyViewController.h"
|
||||
#import "SBMovieViewController.h"
|
||||
@@ -567,7 +565,7 @@ static NSDictionary *_detailMonospacedAttr;
|
||||
cell.textField.stringValue = track.formatSummary;
|
||||
}
|
||||
else if ([tableColumn.identifier isEqualToString:@"trackEnabled"]) {
|
||||
SBCheckBoxCellView *checkCell = [tableView makeViewWithIdentifier:@"CheckCell" owner:self];
|
||||
CheckBoxCellView *checkCell = [tableView makeViewWithIdentifier:@"CheckCell" owner:self];
|
||||
checkCell.checkboxButton.state = track.isEnabled;
|
||||
cell = checkCell;
|
||||
}
|
||||
@@ -582,7 +580,7 @@ static NSDictionary *_detailMonospacedAttr;
|
||||
}
|
||||
}
|
||||
else if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
|
||||
SBPopUpCellView *popUpCell = [tableView makeViewWithIdentifier:@"PopUpCell" owner:self];
|
||||
PopUpCellView *popUpCell = [tableView makeViewWithIdentifier:@"PopUpCell" owner:self];
|
||||
|
||||
if (popUpCell.popUpButton.numberOfItems == 0) {
|
||||
popUpCell.popUpButton.menu = [_languagesMenu copy];
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// SBPopUpCellView.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SBPopUpCellView : NSTableCellView
|
||||
|
||||
@property (nonatomic, nullable, assign) IBOutlet NSPopUpButton *popUpButton;
|
||||
|
||||
@end
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// SBPopUpCellView.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/10/2016.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBPopUpCellView.h"
|
||||
|
||||
@implementation SBPopUpCellView
|
||||
|
||||
- (instancetype)initWithFrame:(NSRect)frameRec
|
||||
{
|
||||
self = [super initWithFrame:frameRec];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (nullable instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// SBTokenFieldCell.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/11/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SBTokenFieldCell : NSTokenFieldCell
|
||||
|
||||
@end
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// SBTokenFieldCell.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/11/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBTokenFieldCell.h"
|
||||
|
||||
@interface SBTokenFieldCell ()
|
||||
|
||||
@property (nonatomic) NSBackgroundStyle SB_originalBackgroundStyle;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBTokenFieldCell
|
||||
|
||||
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle
|
||||
{
|
||||
[super setBackgroundStyle:backgroundStyle];
|
||||
if (backgroundStyle == NSBackgroundStyleDark) {
|
||||
self.textColor = [NSColor controlHighlightColor];
|
||||
}
|
||||
else {
|
||||
self.textColor = [NSColor controlTextColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj;
|
||||
{
|
||||
self.SB_originalBackgroundStyle = self.backgroundStyle;
|
||||
|
||||
self.backgroundStyle = NSBackgroundStyleLight;
|
||||
self.drawsBackground = YES;
|
||||
|
||||
return [super setUpFieldEditorAttributes:textObj];
|
||||
}
|
||||
|
||||
- (void)endEditing:(NSText *)textObj
|
||||
{
|
||||
[super endEditing:textObj];
|
||||
self.drawsBackground = NO;
|
||||
self.backgroundStyle = self.SB_originalBackgroundStyle;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// TokenFieldCell.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 20/10/2017.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class TokenFieldCell : NSTokenFieldCell {
|
||||
|
||||
private var originalBackgroundStyle: NSView.BackgroundStyle = NSView.BackgroundStyle.light
|
||||
|
||||
override var backgroundStyle: NSView.BackgroundStyle {
|
||||
get {
|
||||
return super.backgroundStyle
|
||||
}
|
||||
set (newBackgroundStyle) {
|
||||
super.backgroundStyle = newBackgroundStyle
|
||||
if newBackgroundStyle == NSView.BackgroundStyle.dark {
|
||||
textColor = NSColor.controlHighlightColor
|
||||
} else {
|
||||
textColor = NSColor.controlTextColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func setUpFieldEditorAttributes(_ textObj: NSText) -> NSText {
|
||||
originalBackgroundStyle = backgroundStyle
|
||||
backgroundStyle = NSView.BackgroundStyle.light
|
||||
drawsBackground = true
|
||||
return super.setUpFieldEditorAttributes(textObj)
|
||||
}
|
||||
|
||||
override func endEditing(_ textObj: NSText) {
|
||||
super.endEditing(textObj)
|
||||
drawsBackground = false
|
||||
backgroundStyle = originalBackgroundStyle
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user