1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-25 06:06:21 +03:00

GH-436 Move WorkspaceTheme into Workspace

This commit is contained in:
Tae Won Ha 2017-06-25 00:11:12 +02:00
parent b49279ca9a
commit 0a21c43acd
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
11 changed files with 34 additions and 49 deletions

View File

@ -17,7 +17,6 @@
1929B13A458CB49BC44A92F5 /* ImageAndTextTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B015804B46789F719C01 /* ImageAndTextTableCell.swift */; };
1929B1837C750CADB3A5BCB9 /* OpenQuicklyFileViewRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B1558455B3A74D93EF2A /* OpenQuicklyFileViewRow.swift */; };
1929B18A0D7C7407C51DB642 /* DataWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB6CFF4CC0B5E8B00C62 /* DataWrapper.m */; };
1929B1D88B7E5DB89B836ED1 /* WorkspaceTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BE99ECAE182A9A4491B4 /* WorkspaceTheme.swift */; };
1929B1E05C116514C1D3A384 /* CocoaCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B5C3F2F1CA4113DABFFD /* CocoaCategories.m */; };
1929B29B95AD176D57942E08 /* UiRootReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B457B9D0FA4D21F3751E /* UiRootReducer.swift */; };
1929B3217A7A3D79E28C80DB /* PrefWindowReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B49E6924847AD085C8C9 /* PrefWindowReducer.swift */; };
@ -25,7 +24,6 @@
1929B3557317755A43513B17 /* OpenQuicklyWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B71A92C24FEFE79A851E /* OpenQuicklyWindow.swift */; };
1929B370A275F8C70AD5AA08 /* UrlCommonsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B11D672134E52A256A7F /* UrlCommonsTest.swift */; };
1929B3AC66EFE35D68C020E3 /* PreviewToolReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BFB0F294F3714D5E095F /* PreviewToolReducer.swift */; };
1929B3F1D5D4BC3EF8FEF57E /* WorkspaceTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BE99ECAE182A9A4491B4 /* WorkspaceTheme.swift */; };
1929B3F5743967125F357C9F /* Matcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BEEB33113B0E33C3830F /* Matcher.swift */; };
1929B462CD4935AFF6D69457 /* FileItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B7CB4863F80230C32D3C /* FileItem.swift */; };
1929B4B00D7BB191A9A6532D /* HtmlPreviewToolReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BE5AEA3D0980860EED50 /* HtmlPreviewToolReducer.swift */; };
@ -451,7 +449,6 @@
1929BE37AA2843779CAFA76F /* PreviewReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewReducer.swift; sourceTree = "<group>"; };
1929BE5AEA3D0980860EED50 /* HtmlPreviewToolReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HtmlPreviewToolReducer.swift; sourceTree = "<group>"; };
1929BE69CF9AB1A10D0DD4F2 /* CocoaCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaCategories.h; sourceTree = "<group>"; };
1929BE99ECAE182A9A4491B4 /* WorkspaceTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceTheme.swift; sourceTree = "<group>"; };
1929BED01F5D94BFCA4CF80F /* AppearancePrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearancePrefReducer.swift; sourceTree = "<group>"; };
1929BEDE7F92BC7B49E802AF /* OpenQuicklyFilterOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyFilterOperation.swift; sourceTree = "<group>"; };
1929BEEB33113B0E33C3830F /* Matcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matcher.swift; sourceTree = "<group>"; };
@ -868,7 +865,6 @@
4BB489411D952CF6005BB0E8 /* WorkspaceToolButton.swift */,
4BB409ED1DDA77E9005F39A2 /* ProxyWorkspaceBar.swift */,
4B3965351DEB21300082D3C1 /* InnterToolBar.swift */,
1929BE99ECAE182A9A4491B4 /* WorkspaceTheme.swift */,
);
name = Workspace;
sourceTree = "<group>";
@ -1642,7 +1638,6 @@
1929B6C0393DE40E34F4A49A /* ToolsPrefReducer.swift in Sources */,
1929B542A071BD03C846F6EF /* PrefUtils.swift in Sources */,
1929BE407A667356E29386EF /* Logger.swift in Sources */,
1929B3F1D5D4BC3EF8FEF57E /* WorkspaceTheme.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1669,7 +1664,6 @@
1929BAAD7336FDFF1F78E749 /* ScorerTest.swift in Sources */,
1929B8E90A1378E494D481E7 /* PrefUtilsTest.swift in Sources */,
1929BCA03A420A83174FD7E7 /* Logger.swift in Sources */,
1929B1D88B7E5DB89B836ED1 /* WorkspaceTheme.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -113,7 +113,7 @@ extension FileBrowser {
self.addViews()
}
override func repaint(with theme: WorkspaceTheme) {
override func repaint(with theme: Workspace.Theme) {
self.goToParentButton.image = NSImage.fontAwesomeIcon(name: .levelUp,
textColor: theme.toolbarForeground,
dimension: InnerToolBar.iconDimension)

View File

@ -141,7 +141,7 @@ extension HtmlPreviewTool {
self.addViews()
}
override func repaint(with: WorkspaceTheme) {
override func repaint(with: Workspace.Theme) {
}

View File

@ -236,7 +236,7 @@ class MainWindow: NSObject,
}
@IBAction func debug2(_: Any?) {
var theme = WorkspaceTheme()
var theme = Workspace.Theme()
theme.foreground = .red
theme.background = .yellow

View File

@ -9,7 +9,7 @@ import CocoaFontAwesome
class CustomToolBar: NSView {
func repaint(with: WorkspaceTheme) {
func repaint(with: Workspace.Theme) {
// please implement
}
}
@ -21,12 +21,9 @@ class CustomToolBar: NSView {
*/
class InnerToolBar: NSView, NSUserInterfaceValidations {
fileprivate static let separatorColor = NSColor.controlShadowColor
fileprivate static let separatorThickness = CGFloat(1)
fileprivate static let height = InnerToolBar.iconDimension + 2 + 2 + InnerToolBar.separatorThickness
static fileprivate let backgroundColor = NSColor(red: 0.899, green: 0.934, blue: 0.997, alpha: 1)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@ -48,7 +45,7 @@ class InnerToolBar: NSView, NSUserInterfaceValidations {
static func configureToStandardIconButton(button: NSButton,
iconName: CocoaFontAwesome.FontAwesome,
color: NSColor = WorkspaceTheme.default.toolbarForeground) {
color: NSColor = Workspace.Theme.default.toolbarForeground) {
let icon = NSImage.fontAwesomeIcon(name: iconName, textColor: color, dimension: InnerToolBar.iconDimension)
@ -74,8 +71,8 @@ class InnerToolBar: NSView, NSUserInterfaceValidations {
}
}
var theme: WorkspaceTheme {
return self.tool?.theme ?? WorkspaceTheme.default
var theme: Workspace.Theme {
return self.tool?.theme ?? Workspace.Theme.default
}
weak var tool: WorkspaceTool? {

View File

@ -11,7 +11,7 @@ import PureLayout
*/
class ProxyWorkspaceBar: NSView {
var theme = WorkspaceTheme.default
var theme = Workspace.Theme.default
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")

View File

@ -32,6 +32,25 @@ class Workspace: NSView, WorkspaceBarDelegate {
let mainViewMinimumSize: CGSize
}
struct Theme {
static let `default` = Workspace.Theme()
var foreground = NSColor.black
var background = NSColor.white
var separator = NSColor.controlShadowColor
var barBackground = NSColor.windowBackgroundColor
var barFocusRing = NSColor.selectedControlColor
var barButtonBackground = NSColor.clear
var barButtonHighlight = NSColor.controlShadowColor
var toolbarForeground = NSColor.darkGray
var toolbarBackground = NSColor(red: 0.899, green: 0.934, blue: 0.997, alpha: 1)
}
fileprivate(set) var isAllToolsVisible = true {
didSet {
self.relayout()
@ -61,7 +80,7 @@ class Workspace: NSView, WorkspaceBarDelegate {
let bars: [WorkspaceBarLocation: WorkspaceBar]
let config: Config
var theme = WorkspaceTheme.default {
var theme = Workspace.Theme.default {
didSet {
self.repaint()
}

View File

@ -76,8 +76,8 @@ class WorkspaceBar: NSView, WorkspaceToolDelegate {
}
var dimensionConstraint = NSLayoutConstraint()
var theme: WorkspaceTheme {
return self.workspace?.theme ?? WorkspaceTheme.default
var theme: Workspace.Theme {
return self.workspace?.theme ?? Workspace.Theme.default
}
weak var delegate: WorkspaceBarDelegate?

View File

@ -50,8 +50,8 @@ class WorkspaceTool: NSView {
}
}
var theme: WorkspaceTheme {
return self.bar?.theme ?? WorkspaceTheme.default
var theme: Workspace.Theme {
return self.bar?.theme ?? Workspace.Theme.default
}
weak var delegate: WorkspaceToolDelegate?

View File

@ -35,8 +35,8 @@ class WorkspaceToolButton: NSView, NSDraggingSource {
return self.tool?.isSelected ?? false
}
var theme: WorkspaceTheme {
return self.tool?.theme ?? WorkspaceTheme.default
var theme: Workspace.Theme {
return self.tool?.theme ?? Workspace.Theme.default
}
weak var tool: WorkspaceTool?

View File

@ -1,25 +0,0 @@
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Cocoa
struct WorkspaceTheme {
static let `default` = WorkspaceTheme()
var foreground = NSColor.black
var background = NSColor.white
var separator = NSColor.controlShadowColor
var barBackground = NSColor.windowBackgroundColor
var barFocusRing = NSColor.selectedControlColor
var barButtonBackground = NSColor.clear
var barButtonHighlight = NSColor.controlShadowColor
var toolbarForeground = NSColor.darkGray
var toolbarBackground = NSColor(red: 0.899, green: 0.934, blue: 0.997, alpha: 1)
}