mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 16:56:40 +03:00
GH-426 Add stub tools pref
This commit is contained in:
parent
fa0bf52932
commit
f428ca5adf
@ -68,6 +68,7 @@
|
||||
1929BEB90DCDAF7A2B68C886 /* ColorUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BA6128BFDD54CA92F46E /* ColorUtils.swift */; };
|
||||
1929BEDE1BE950EDA9497363 /* GeneralPref.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB55946DAEBF55D24048 /* GeneralPref.swift */; };
|
||||
1929BEFEABA0448306CDB6D4 /* FileItemIgnorePatternTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BBC84557C8351EC6183E /* FileItemIgnorePatternTest.swift */; };
|
||||
1929BF03FD6465F289AA80B2 /* ToolsPref.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB2AD21A10A0ECA66A5E /* ToolsPref.swift */; };
|
||||
1929BF81A40B4154D3EA33CE /* server_ui.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B93013228985F509C8F6 /* server_ui.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
1929BFDE22D155F7C4B19E96 /* HtmlPreviewTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B85023B042C485409CE1 /* HtmlPreviewTool.swift */; };
|
||||
4B029F1A1D45E349004EE0D3 /* PrefWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B029F1C1D45E349004EE0D3 /* PrefWindow.xib */; };
|
||||
@ -372,6 +373,7 @@
|
||||
1929BA6128BFDD54CA92F46E /* ColorUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorUtils.swift; sourceTree = "<group>"; };
|
||||
1929BA8AC40B901B20F20B71 /* FileUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileUtils.swift; sourceTree = "<group>"; };
|
||||
1929BADEB143008EFA6F3318 /* NetUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetUtils.h; sourceTree = "<group>"; };
|
||||
1929BB2AD21A10A0ECA66A5E /* ToolsPref.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToolsPref.swift; sourceTree = "<group>"; };
|
||||
1929BB55946DAEBF55D24048 /* GeneralPref.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPref.swift; sourceTree = "<group>"; };
|
||||
1929BB6608B4F0E037CA0F4C /* States.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = States.swift; sourceTree = "<group>"; };
|
||||
1929BB6CFF4CC0B5E8B00C62 /* DataWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataWrapper.m; sourceTree = "<group>"; };
|
||||
@ -664,6 +666,7 @@
|
||||
1929BB55946DAEBF55D24048 /* GeneralPref.swift */,
|
||||
1929B0FBFB766042CF06E463 /* AppearancePref.swift */,
|
||||
1929BBE0A534F2F6009D31BE /* AdvencedPref.swift */,
|
||||
1929BB2AD21A10A0ECA66A5E /* ToolsPref.swift */,
|
||||
);
|
||||
name = Preferences;
|
||||
sourceTree = "<group>";
|
||||
@ -1483,6 +1486,7 @@
|
||||
1929BFDE22D155F7C4B19E96 /* HtmlPreviewTool.swift in Sources */,
|
||||
1929B4B00D7BB191A9A6532D /* HtmlPreviewToolReducer.swift in Sources */,
|
||||
1929BCF7F7B9CC5499A3F506 /* AdvancedPrefReducer.swift in Sources */,
|
||||
1929BF03FD6465F289AA80B2 /* ToolsPref.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -29,6 +29,7 @@ class PrefWindow: NSObject,
|
||||
GeneralPref(source: source, emitter: emitter, state: state),
|
||||
AppearancePref(source: source, emitter: emitter, state: state),
|
||||
AdvancedPref(source: source, emitter: emitter, state: state),
|
||||
ToolsPref(source: source, emitter: emitter, state: state),
|
||||
]
|
||||
|
||||
super.init()
|
||||
|
130
VimR/ToolsPref.swift
Normal file
130
VimR/ToolsPref.swift
Normal file
@ -0,0 +1,130 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Cocoa
|
||||
import PureLayout
|
||||
import RxSwift
|
||||
|
||||
class ToolsPref: PrefPane, UiComponent {
|
||||
|
||||
typealias StateType = AppState
|
||||
|
||||
enum Action {
|
||||
|
||||
}
|
||||
|
||||
override var displayName: String {
|
||||
return "Tools"
|
||||
}
|
||||
|
||||
override var pinToContainer: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
required init(source: Observable<StateType>, emitter: ActionEmitter, state: StateType) {
|
||||
self.emit = emitter.typedEmit()
|
||||
|
||||
super.init(frame: .zero)
|
||||
|
||||
self.addViews()
|
||||
self.updateViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
|
||||
self.updateViews()
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
fileprivate let emit: (Action) -> Void
|
||||
fileprivate let disposeBag = DisposeBag()
|
||||
|
||||
fileprivate let fileBrowserCheckbox = NSButton(forAutoLayout: ())
|
||||
fileprivate let openedFilesListCheckbox = NSButton(forAutoLayout: ())
|
||||
fileprivate let previewCheckbox = NSButton(forAutoLayout: ())
|
||||
fileprivate let htmlCheckbox = NSButton(forAutoLayout: ())
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate func updateViews() {
|
||||
}
|
||||
|
||||
fileprivate func addViews() {
|
||||
let paneTitle = self.paneTitleTextField(title: "Tools")
|
||||
|
||||
let fileBrowser = self.fileBrowserCheckbox
|
||||
self.configureCheckbox(button: fileBrowser,
|
||||
title: "File Browser",
|
||||
action: #selector(ToolsPref.fileBrowserAction(_:)))
|
||||
let openedFilesList = self.openedFilesListCheckbox
|
||||
self.configureCheckbox(button: openedFilesList,
|
||||
title: "Buffers",
|
||||
action: #selector(ToolsPref.openedFilesListAction(_:)))
|
||||
let preview = self.previewCheckbox
|
||||
self.configureCheckbox(button: preview,
|
||||
title: "Markdown Preview",
|
||||
action: #selector(ToolsPref.previewAction(_:)))
|
||||
let html = self.htmlCheckbox
|
||||
self.configureCheckbox(button: html,
|
||||
title: "HTML Preview",
|
||||
action: #selector(ToolsPref.htmlAction(_:)))
|
||||
|
||||
let info = self.infoTextField(
|
||||
markdown: "You can turn off tools you don't need. The effect takes place when new windows are opened."
|
||||
)
|
||||
|
||||
self.addSubview(paneTitle)
|
||||
|
||||
self.addSubview(fileBrowser)
|
||||
self.addSubview(openedFilesList)
|
||||
self.addSubview(preview)
|
||||
self.addSubview(html)
|
||||
|
||||
self.addSubview(info)
|
||||
|
||||
paneTitle.autoPinEdge(toSuperviewEdge: .top, withInset: 18)
|
||||
paneTitle.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
paneTitle.autoPinEdge(toSuperviewEdge: .right, withInset: 18, relation: .greaterThanOrEqual)
|
||||
|
||||
fileBrowser.autoPinEdge(.top, to: .bottom, of: paneTitle, withOffset: 18)
|
||||
fileBrowser.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
|
||||
openedFilesList.autoPinEdge(.top, to: .bottom, of: fileBrowser, withOffset: 5)
|
||||
openedFilesList.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
|
||||
preview.autoPinEdge(.top, to: .bottom, of: openedFilesList, withOffset: 5)
|
||||
preview.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
|
||||
html.autoPinEdge(.top, to: .bottom, of: preview, withOffset: 5)
|
||||
html.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
|
||||
info.autoPinEdge(.top, to: .bottom, of: html, withOffset: 18)
|
||||
info.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
extension ToolsPref {
|
||||
|
||||
@IBAction func fileBrowserAction(_ sender: Any?) {
|
||||
|
||||
}
|
||||
|
||||
@IBAction func openedFilesListAction(_ sender: Any?) {
|
||||
|
||||
}
|
||||
|
||||
@IBAction func previewAction(_ sender: Any?) {
|
||||
|
||||
}
|
||||
|
||||
@IBAction func htmlAction(_ sender: Any?) {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user