1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 01:32:04 +03:00
vimr/VimR/States.swift

113 lines
2.3 KiB
Swift
Raw Normal View History

2017-01-22 16:22:05 +03:00
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Foundation
import RxSwift
2017-01-22 16:22:05 +03:00
struct AppState {
2017-02-20 20:04:45 +03:00
static let `default` = AppState(mainWindow: MainWindow.State.default)
2017-01-22 16:22:05 +03:00
var currentMainWindow: MainWindow.State
var mainWindows: [String: MainWindow.State] = [:]
var quitWhenNoMainWindow = false
2017-02-19 20:00:41 +03:00
let root = FileItem(URL(fileURLWithPath: "/", isDirectory: true))
2017-02-20 20:04:45 +03:00
init(mainWindow: MainWindow.State) {
2017-01-22 16:22:05 +03:00
self.currentMainWindow = mainWindow
}
}
2017-02-06 00:39:55 +03:00
struct PreviewState {
2017-02-03 00:39:05 +03:00
2017-02-07 00:54:22 +03:00
static let `default` = PreviewState()
2017-02-06 20:36:57 +03:00
enum Status {
case none
case notSaved
case error
case markdown
}
var status = Status.none
2017-02-06 00:39:55 +03:00
var buffer: URL?
var html: URL?
var server: URL?
2017-02-07 00:54:22 +03:00
2017-02-12 13:24:15 +03:00
var updateDate: Date
2017-02-07 00:54:22 +03:00
2017-02-12 15:41:12 +03:00
var editorPosition = Marked(Position.beginning)
var previewPosition = Marked(Position.beginning)
var ignoreNextForward = false
2017-02-12 18:40:49 +03:00
var forceNextReverse = false
2017-02-07 00:54:22 +03:00
init(status: Status = .none,
buffer: URL? = nil,
html: URL? = nil,
server: URL? = nil,
2017-02-12 13:24:15 +03:00
updateDate: Date = Date())
2017-02-07 00:54:22 +03:00
{
self.status = status
self.buffer = buffer
self.html = html
self.server = server
self.updateDate = updateDate
}
2017-02-03 00:39:05 +03:00
}
extension MainWindow {
2017-01-22 16:22:05 +03:00
struct State {
static let `default` = State(isAllToolsVisible: true, isToolButtonsVisible: true)
var isAllToolsVisible = true
var isToolButtonsVisible = true
2017-01-22 16:22:05 +03:00
////// transient
2017-02-06 00:39:55 +03:00
var preview = PreviewState.default
2017-02-07 00:54:22 +03:00
var previewTool = PreviewTool.State.default
var isClosed = false
2017-02-03 00:39:05 +03:00
2017-01-22 16:22:05 +03:00
// neovim
var uuid = UUID().uuidString
2017-01-22 16:22:05 +03:00
var currentBuffer: NeoVimBuffer?
var buffers = [NeoVimBuffer]()
var cwd = FileUtils.userHomeUrl
var isDirty = false
var font = NSFont.userFixedPitchFont(ofSize: 13)!
var linespacing: CGFloat = 1
var isUseLigatures = false
var isUseInteractiveZsh = false
// transient^2
var urlsToOpen = [URL: OpenMode]()
init(isAllToolsVisible: Bool, isToolButtonsVisible: Bool) {
self.isAllToolsVisible = isAllToolsVisible
self.isToolButtonsVisible = isToolButtonsVisible
}
}
}
2017-02-07 00:54:22 +03:00
extension PreviewTool {
struct State {
static let `default` = State()
var isForwardSearchAutomatically = false
var isReverseSearchAutomatically = false
var isRefreshOnWrite = true
}
}