diff --git a/VimR.xcodeproj/project.pbxproj b/VimR.xcodeproj/project.pbxproj index b06e63df..7dca5d84 100644 --- a/VimR.xcodeproj/project.pbxproj +++ b/VimR.xcodeproj/project.pbxproj @@ -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 = ""; }; 1929BE5AEA3D0980860EED50 /* HtmlPreviewToolReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HtmlPreviewToolReducer.swift; sourceTree = ""; }; 1929BE69CF9AB1A10D0DD4F2 /* CocoaCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaCategories.h; sourceTree = ""; }; - 1929BE99ECAE182A9A4491B4 /* WorkspaceTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceTheme.swift; sourceTree = ""; }; 1929BED01F5D94BFCA4CF80F /* AppearancePrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearancePrefReducer.swift; sourceTree = ""; }; 1929BEDE7F92BC7B49E802AF /* OpenQuicklyFilterOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyFilterOperation.swift; sourceTree = ""; }; 1929BEEB33113B0E33C3830F /* Matcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matcher.swift; sourceTree = ""; }; @@ -868,7 +865,6 @@ 4BB489411D952CF6005BB0E8 /* WorkspaceToolButton.swift */, 4BB409ED1DDA77E9005F39A2 /* ProxyWorkspaceBar.swift */, 4B3965351DEB21300082D3C1 /* InnterToolBar.swift */, - 1929BE99ECAE182A9A4491B4 /* WorkspaceTheme.swift */, ); name = Workspace; sourceTree = ""; @@ -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; }; diff --git a/VimR/FileBrowser.swift b/VimR/FileBrowser.swift index 225f8261..ff5cfc0d 100644 --- a/VimR/FileBrowser.swift +++ b/VimR/FileBrowser.swift @@ -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) diff --git a/VimR/HtmlPreviewTool.swift b/VimR/HtmlPreviewTool.swift index 313d277c..8fa46dcf 100644 --- a/VimR/HtmlPreviewTool.swift +++ b/VimR/HtmlPreviewTool.swift @@ -141,7 +141,7 @@ extension HtmlPreviewTool { self.addViews() } - override func repaint(with: WorkspaceTheme) { + override func repaint(with: Workspace.Theme) { } diff --git a/VimR/MainWindow.swift b/VimR/MainWindow.swift index 62fd6042..fd078862 100644 --- a/VimR/MainWindow.swift +++ b/VimR/MainWindow.swift @@ -236,7 +236,7 @@ class MainWindow: NSObject, } @IBAction func debug2(_: Any?) { - var theme = WorkspaceTheme() + var theme = Workspace.Theme() theme.foreground = .red theme.background = .yellow diff --git a/VimR/Workspace/InnterToolBar.swift b/VimR/Workspace/InnterToolBar.swift index 974cf8d9..481bbdea 100644 --- a/VimR/Workspace/InnterToolBar.swift +++ b/VimR/Workspace/InnterToolBar.swift @@ -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? { diff --git a/VimR/Workspace/ProxyWorkspaceBar.swift b/VimR/Workspace/ProxyWorkspaceBar.swift index 4091eb4d..be1ae639 100644 --- a/VimR/Workspace/ProxyWorkspaceBar.swift +++ b/VimR/Workspace/ProxyWorkspaceBar.swift @@ -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") diff --git a/VimR/Workspace/Workspace.swift b/VimR/Workspace/Workspace.swift index d3ccd154..81813042 100644 --- a/VimR/Workspace/Workspace.swift +++ b/VimR/Workspace/Workspace.swift @@ -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() } diff --git a/VimR/Workspace/WorkspaceBar.swift b/VimR/Workspace/WorkspaceBar.swift index 65ee731e..06ca0095 100644 --- a/VimR/Workspace/WorkspaceBar.swift +++ b/VimR/Workspace/WorkspaceBar.swift @@ -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? diff --git a/VimR/Workspace/WorkspaceTool.swift b/VimR/Workspace/WorkspaceTool.swift index 64c4fcf4..c0340152 100644 --- a/VimR/Workspace/WorkspaceTool.swift +++ b/VimR/Workspace/WorkspaceTool.swift @@ -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? diff --git a/VimR/Workspace/WorkspaceToolButton.swift b/VimR/Workspace/WorkspaceToolButton.swift index 415c8fe2..44f9abc4 100644 --- a/VimR/Workspace/WorkspaceToolButton.swift +++ b/VimR/Workspace/WorkspaceToolButton.swift @@ -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? diff --git a/VimR/WorkspaceTheme.swift b/VimR/WorkspaceTheme.swift deleted file mode 100644 index 436b9b14..00000000 --- a/VimR/WorkspaceTheme.swift +++ /dev/null @@ -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) -}