mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 16:56:40 +03:00
Use private where appropriate
This commit is contained in:
parent
dcd79fbaa7
commit
0df758d275
@ -7,7 +7,7 @@ import Cocoa
|
||||
import RxSwift
|
||||
import EonilFileSystemEvents
|
||||
|
||||
fileprivate let monitorDispatchQueue = DispatchQueue.global(qos: .userInitiated)
|
||||
private let monitorDispatchQueue = DispatchQueue.global(qos: .userInitiated)
|
||||
|
||||
class FileMonitor: UiComponent {
|
||||
|
||||
@ -59,9 +59,9 @@ class FileMonitor: UiComponent {
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
fileprivate let emit: (Action) -> Void
|
||||
fileprivate let disposeBag = DisposeBag()
|
||||
private let emit: (Action) -> Void
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
fileprivate var monitoredUrls = Set<URL>()
|
||||
fileprivate var monitors = [URL: FileSystemEventMonitor]()
|
||||
private var monitoredUrls = Set<URL>()
|
||||
private var monitors = [URL: FileSystemEventMonitor]()
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import PureLayout
|
||||
import WebKit
|
||||
import EonilFileSystemEvents
|
||||
|
||||
fileprivate let fileSystemEventsLatency = 1.0
|
||||
fileprivate let monitorDispatchQueue = DispatchQueue.global(qos: .userInitiated)
|
||||
private let fileSystemEventsLatency = 1.0
|
||||
private let monitorDispatchQueue = DispatchQueue.global(qos: .userInitiated)
|
||||
|
||||
class HtmlPreviewTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
|
||||
@ -69,7 +69,7 @@ class HtmlPreviewTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
fileprivate func reloadWebview(with url: URL) {
|
||||
private func reloadWebview(with url: URL) {
|
||||
self.webview.evaluateJavaScript("document.body.scrollTop") { (result, error) in
|
||||
self.scrollTop = result as? Int ?? 0
|
||||
|
||||
@ -77,23 +77,23 @@ class HtmlPreviewTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func addViews() {
|
||||
private func addViews() {
|
||||
self.webview.configureForAutoLayout()
|
||||
|
||||
self.addSubview(self.webview)
|
||||
self.webview.autoPinEdgesToSuperviewEdges()
|
||||
}
|
||||
|
||||
fileprivate let emit: (UuidAction<Action>) -> Void
|
||||
fileprivate let uuid: String
|
||||
private let emit: (UuidAction<Action>) -> Void
|
||||
private let uuid: String
|
||||
|
||||
fileprivate var mark = Token()
|
||||
fileprivate var scrollTop = 0
|
||||
private var mark = Token()
|
||||
private var scrollTop = 0
|
||||
|
||||
fileprivate let webview: WKWebView
|
||||
fileprivate var monitor: FileSystemEventMonitor?
|
||||
private let webview: WKWebView
|
||||
private var monitor: FileSystemEventMonitor?
|
||||
|
||||
fileprivate let disposeBag = DisposeBag()
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
@ -145,7 +145,7 @@ extension HtmlPreviewTool {
|
||||
|
||||
}
|
||||
|
||||
fileprivate func addViews() {
|
||||
private func addViews() {
|
||||
let selectHtmlFile = self.selectHtmlFile
|
||||
InnerToolBar.configureToStandardIconButton(button: selectHtmlFile, iconName: .fileCodeO)
|
||||
selectHtmlFile.toolTip = "Select the HTML file"
|
||||
|
@ -21,7 +21,7 @@ class BuffersList: NSView,
|
||||
case open(NvimView.Buffer)
|
||||
}
|
||||
|
||||
fileprivate(set) var theme = Theme.default
|
||||
private(set) var theme = Theme.default
|
||||
|
||||
required init(source: Observable<StateType>, emitter: ActionEmitter, state: StateType) {
|
||||
self.emit = emitter.typedEmit()
|
||||
@ -66,31 +66,31 @@ class BuffersList: NSView,
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
fileprivate let emit: (UuidAction<Action>) -> Void
|
||||
fileprivate let disposeBag = DisposeBag()
|
||||
private let emit: (UuidAction<Action>) -> Void
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
fileprivate let uuid: String
|
||||
fileprivate var usesTheme: Bool
|
||||
fileprivate var lastThemeMark = Token()
|
||||
fileprivate var showsFileIcon: Bool
|
||||
private let uuid: String
|
||||
private var usesTheme: Bool
|
||||
private var lastThemeMark = Token()
|
||||
private var showsFileIcon: Bool
|
||||
|
||||
fileprivate let bufferList = NSTableView.standardTableView()
|
||||
fileprivate let genericIcon: NSImage
|
||||
private let bufferList = NSTableView.standardTableView()
|
||||
private let genericIcon: NSImage
|
||||
|
||||
fileprivate var buffers = [NvimView.Buffer]()
|
||||
private var buffers = [NvimView.Buffer]()
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate func updateTheme(_ theme: Marked<Theme>) {
|
||||
private func updateTheme(_ theme: Marked<Theme>) {
|
||||
self.theme = theme.payload
|
||||
self.bufferList.enclosingScrollView?.backgroundColor = self.theme.background
|
||||
self.bufferList.backgroundColor = self.theme.background
|
||||
self.lastThemeMark = theme.mark
|
||||
}
|
||||
|
||||
fileprivate func addViews() {
|
||||
private func addViews() {
|
||||
let scrollView = NSScrollView.standardScrollView()
|
||||
scrollView.borderType = .noBorder
|
||||
scrollView.documentView = self.bufferList
|
||||
@ -99,7 +99,7 @@ class BuffersList: NSView,
|
||||
scrollView.autoPinEdgesToSuperviewEdges()
|
||||
}
|
||||
|
||||
fileprivate func adjustFileViewWidth() {
|
||||
private func adjustFileViewWidth() {
|
||||
let maxWidth = self.buffers.reduce(CGFloat(100)) { (curMaxWidth, buffer) in
|
||||
return max(self.text(for: buffer).size().width, curMaxWidth)
|
||||
}
|
||||
@ -158,7 +158,7 @@ extension BuffersList {
|
||||
return cell
|
||||
}
|
||||
|
||||
fileprivate func text(for buffer: NvimView.Buffer) -> NSAttributedString {
|
||||
private func text(for buffer: NvimView.Buffer) -> NSAttributedString {
|
||||
guard let name = buffer.name else {
|
||||
return NSAttributedString(string: "No Name")
|
||||
}
|
||||
@ -181,7 +181,7 @@ extension BuffersList {
|
||||
return rowText
|
||||
}
|
||||
|
||||
fileprivate func icon(for buffer: NvimView.Buffer) -> NSImage? {
|
||||
private func icon(for buffer: NvimView.Buffer) -> NSImage? {
|
||||
if let url = buffer.url {
|
||||
return FileUtils.icon(forUrl: url)
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class PreviewTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
fileprivate func addViews() {
|
||||
private func addViews() {
|
||||
self.webview.navigationDelegate = self
|
||||
self.userContentController.add(webviewMessageHandler, name: "com_vimr_tools_preview_markdown")
|
||||
self.webview.configureForAutoLayout()
|
||||
@ -142,36 +142,36 @@ class PreviewTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
self.webview.evaluateJavaScript("document.body.scrollTop = \(self.scrollTop)")
|
||||
}
|
||||
|
||||
fileprivate let emit: (UuidAction<Action>) -> Void
|
||||
fileprivate let uuid: String
|
||||
private let emit: (UuidAction<Action>) -> Void
|
||||
private let uuid: String
|
||||
|
||||
fileprivate let webview: WKWebView
|
||||
fileprivate let disposeBag = DisposeBag()
|
||||
fileprivate let scheduler = ConcurrentDispatchQueueScheduler(qos: .userInitiated)
|
||||
fileprivate var isOpen = false
|
||||
private let webview: WKWebView
|
||||
private let disposeBag = DisposeBag()
|
||||
private let scheduler = ConcurrentDispatchQueueScheduler(qos: .userInitiated)
|
||||
private var isOpen = false
|
||||
|
||||
fileprivate var url: URL?
|
||||
fileprivate var lastUpdateDate = Date.distantPast
|
||||
fileprivate var editorPosition = Marked(Position.beginning)
|
||||
fileprivate var previewPosition = Position.beginning
|
||||
fileprivate var scrollTop = 0
|
||||
private var url: URL?
|
||||
private var lastUpdateDate = Date.distantPast
|
||||
private var editorPosition = Marked(Position.beginning)
|
||||
private var previewPosition = Position.beginning
|
||||
private var scrollTop = 0
|
||||
|
||||
fileprivate let userContentController = WKUserContentController()
|
||||
fileprivate let webviewMessageHandler = WebviewMessageHandler()
|
||||
private let userContentController = WKUserContentController()
|
||||
private let webviewMessageHandler = WebviewMessageHandler()
|
||||
|
||||
fileprivate let automaticForwardMenuItem = NSMenuItem(title: "Automatic Forward Search",
|
||||
private let automaticForwardMenuItem = NSMenuItem(title: "Automatic Forward Search",
|
||||
action: nil,
|
||||
keyEquivalent: "")
|
||||
fileprivate let automaticReverseMenuItem = NSMenuItem(title: "Automatic Reverse Search",
|
||||
private let automaticReverseMenuItem = NSMenuItem(title: "Automatic Reverse Search",
|
||||
action: nil,
|
||||
keyEquivalent: "")
|
||||
fileprivate let refreshOnWriteMenuItem = NSMenuItem(title: "Refresh on Write", action: nil, keyEquivalent: "")
|
||||
private let refreshOnWriteMenuItem = NSMenuItem(title: "Refresh on Write", action: nil, keyEquivalent: "")
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate func forwardSearch(position: Position) {
|
||||
private func forwardSearch(position: Position) {
|
||||
self.webview.evaluateJavaScript("scrollToPosition(\(position.row), \(position.column));") { result, error in
|
||||
if let scrollTop = result as? Int {
|
||||
self.scrollTop = scrollTop
|
||||
@ -208,7 +208,7 @@ extension PreviewTool {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate class WebviewMessageHandler: NSObject, WKScriptMessageHandler {
|
||||
private class WebviewMessageHandler: NSObject, WKScriptMessageHandler {
|
||||
|
||||
var source: Observable<(Position, Int)> {
|
||||
return self.subject.asObservable()
|
||||
|
@ -62,19 +62,19 @@ class UiRoot: UiComponent {
|
||||
self.mainWindows.values.forEach { $0.quitNeoVimWithoutSaving() }
|
||||
}
|
||||
|
||||
fileprivate let source: Observable<AppState>
|
||||
fileprivate let emitter: ActionEmitter
|
||||
fileprivate let disposeBag = DisposeBag()
|
||||
private let source: Observable<AppState>
|
||||
private let emitter: ActionEmitter
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
fileprivate let fileMonitor: FileMonitor
|
||||
fileprivate let openQuicklyWindow: OpenQuicklyWindow
|
||||
fileprivate let prefWindow: PrefWindow
|
||||
private let fileMonitor: FileMonitor
|
||||
private let openQuicklyWindow: OpenQuicklyWindow
|
||||
private let prefWindow: PrefWindow
|
||||
|
||||
fileprivate var mainWindows = [String: MainWindow]()
|
||||
fileprivate var subjectForMainWindows = [String: PublishSubject<MainWindow.State>]()
|
||||
fileprivate var disposables = [String: Disposable]()
|
||||
private var mainWindows = [String: MainWindow]()
|
||||
private var subjectForMainWindows = [String: PublishSubject<MainWindow.State>]()
|
||||
private var disposables = [String: Disposable]()
|
||||
|
||||
fileprivate func newMainWindow(with state: MainWindow.State) -> MainWindow {
|
||||
private func newMainWindow(with state: MainWindow.State) -> MainWindow {
|
||||
let subject = PublishSubject<MainWindow.State>()
|
||||
let source = self.source.mapOmittingNil { $0.mainWindows[state.uuid] }
|
||||
|
||||
@ -84,7 +84,7 @@ class UiRoot: UiComponent {
|
||||
return MainWindow(source: subject.asObservable(), emitter: self.emitter, state: state)
|
||||
}
|
||||
|
||||
fileprivate func removeMainWindow(with uuid: String) {
|
||||
private func removeMainWindow(with uuid: String) {
|
||||
self.subjectForMainWindows[uuid]?.onCompleted()
|
||||
self.disposables[uuid]?.dispose()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user