1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 11:37:32 +03:00

Add use vcs ignores checkbox

This commit is contained in:
Tae Won Ha 2020-01-18 14:56:03 +01:00
parent 207afdb84d
commit cf474f70ae
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
4 changed files with 52 additions and 21 deletions

View File

@ -231,6 +231,17 @@ extension NSOutlineView {
}
}
extension NSTextField {
static func defaultTitleTextField() -> NSTextField {
let field = NSTextField(forAutoLayout: ())
field.backgroundColor = NSColor.clear;
field.isEditable = false;
field.isBordered = false;
return field
}
}
extension NSScrollView {
static func standardScrollView() -> NSScrollView {

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<?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">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSWindowController">
@ -12,12 +13,12 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Open Quickly" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="38.open-quickly-window.frame" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES" texturedBackground="YES"/>
<window title="Open Quickly" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="38.open-quickly-window.frame" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="QvC-M9-y7g" customClass="TitlelessKeyWindow" customModule="VimR" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES" fullSizeContentView="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<windowPositionMask key="initialPositionMask" topStrut="YES"/>
<rect key="contentRect" x="196" y="420" width="365" height="255"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<value key="minFullScreenContentSize" type="size" width="200" height="255"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="365" height="255"/>

View File

@ -31,7 +31,7 @@ class OpenQuicklyWindow: NSObject,
super.init()
self.window.delegate = self
self.configureWindow()
self.addViews()
source
@ -55,11 +55,12 @@ class OpenQuicklyWindow: NSObject,
private let scoredUrlsController = NSArrayController()
private let windowController: NSWindowController
private let titleField = NSTextField.defaultTitleTextField()
private let useVcsIgnores = NSButton(forAutoLayout: ())
private let searchField = NSTextField(forAutoLayout: ())
private let progressIndicator = NSProgressIndicator(forAutoLayout: ())
private let cwdControl = NSPathControl(forAutoLayout: ())
private let fileView = NSTableView.standardTableView()
private let vcsIgnoreCheckbox = NSButton(forAutoLayout: ())
private let log = OSLog(subsystem: Defs.loggerSubsystem,
category: Defs.LoggerCategory.uiComponents)
@ -67,6 +68,15 @@ class OpenQuicklyWindow: NSObject,
private var rootUrls: Set<URL> { Set(self.fileServicesPerRootUrl.map { url, _ in url }) }
private var window: NSWindow { self.windowController.window! }
private func configureWindow() {
[
NSWindow.ButtonType.closeButton,
NSWindow.ButtonType.miniaturizeButton,
NSWindow.ButtonType.zoomButton,
].forEach { self.window.standardWindowButton($0)?.isHidden = true }
self.window.delegate = self
}
private func subscription(_ state: StateType) {
self.updateRootUrls(state: state)
@ -147,6 +157,15 @@ class OpenQuicklyWindow: NSObject,
}
private func addViews() {
let useVcsIg = self.useVcsIgnores
useVcsIg.setButtonType(.switch)
useVcsIg.controlSize = .mini
useVcsIg.title = "Use VCS Ignores"
let title = self.titleField
title.font = .boldSystemFont(ofSize: 11)
title.stringValue = "Open Quickly"
let searchField = self.searchField
searchField.rx.delegate.setForwardToDelegate(self, retainDelegate: false)
@ -184,14 +203,22 @@ class OpenQuicklyWindow: NSObject,
cwdControl.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
let contentView = self.window.contentView!
contentView.addSubview(title)
contentView.addSubview(useVcsIg)
contentView.addSubview(searchField)
contentView.addSubview(progressIndicator)
contentView.addSubview(fileScrollView)
contentView.addSubview(cwdControl)
searchField.autoPinEdge(toSuperviewEdge: .top, withInset: 8)
searchField.autoPinEdge(toSuperviewEdge: .right, withInset: 8)
searchField.autoPinEdge(toSuperviewEdge: .left, withInset: 8)
title.autoPinEdge(toSuperviewEdge: .left, withInset: 8)
title.autoPinEdge(toSuperviewEdge: .top, withInset: 8)
useVcsIg.autoAlignAxis(.horizontal, toSameAxisOf: title)
useVcsIg.autoPinEdge(toSuperviewEdge: .right, withInset: 8)
searchField.autoPinEdge(.top, to: .bottom, of: useVcsIg, withOffset: 8)
searchField.autoPinEdge(.left, to: .left, of: title)
searchField.autoPinEdge(.right, to: .right, of: useVcsIg)
fileScrollView.autoPinEdge(.top, to: .bottom, of: searchField, withOffset: 8)
fileScrollView.autoPinEdge(toSuperviewEdge: .left, withInset: -1)

View File

@ -29,7 +29,7 @@ class PrefPane: NSView {
extension PrefPane {
func paneTitleTextField(title: String) -> NSTextField {
let field = defaultTitleTextField()
let field = NSTextField.defaultTitleTextField()
field.font = NSFont.boldSystemFont(ofSize: 16)
field.alignment = .left;
field.stringValue = title
@ -37,7 +37,7 @@ extension PrefPane {
}
func titleTextField(title: String) -> NSTextField {
let field = defaultTitleTextField()
let field = NSTextField.defaultTitleTextField()
field.alignment = .right;
field.stringValue = title
return field
@ -65,12 +65,4 @@ extension PrefPane {
button.target = self
button.action = action
}
private func defaultTitleTextField() -> NSTextField {
let field = NSTextField(forAutoLayout: ())
field.backgroundColor = NSColor.clear;
field.isEditable = false;
field.isBordered = false;
return field
}
}