diff --git a/macOS/Source/UI/Search/Search.xib b/macOS/Source/UI/Search/Search.xib index b605c0d32..5693ad176 100644 --- a/macOS/Source/UI/Search/Search.xib +++ b/macOS/Source/UI/Search/Search.xib @@ -8,38 +8,178 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -52,8 +192,22 @@ + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + @@ -322,7 +354,7 @@ Gw - - - - - - - - - - - + + + + + - + - - - - + + + - - - - + + + + + + diff --git a/macOS/Source/UI/Search/SearchViewController+Theming.swift b/macOS/Source/UI/Search/SearchViewController+Theming.swift index 52788ac94..16f417142 100644 --- a/macOS/Source/UI/Search/SearchViewController+Theming.swift +++ b/macOS/Source/UI/Search/SearchViewController+Theming.swift @@ -15,9 +15,12 @@ extension SearchViewController: ThemeInitialization { func initTheme() { searchField.font = systemFontScheme.normalFont + searchField.textColor = systemColorScheme.primaryTextColor captionLabels.forEach { + $0.font = systemFontScheme.smallFont + $0.textColor = systemColorScheme.secondaryTextColor } checkBoxes.forEach { @@ -26,7 +29,8 @@ extension SearchViewController: ThemeInitialization { btnComparisonType.font = systemFontScheme.smallFont - lblSummary.font = systemFontScheme.normalFont + lblSummary.font = systemFontScheme.smallFont + lblSummary.textColor = systemColorScheme.tertiaryTextColor resultsTable.reloadDataMaintainingSelection() } @@ -57,5 +61,14 @@ extension SearchViewController: FontSchemeObserver { extension SearchViewController: ColorSchemeObserver { func colorSchemeChanged() { + + searchField.textColor = systemColorScheme.primaryTextColor + lblSummary.textColor = systemColorScheme.tertiaryTextColor + + captionLabels.forEach { + $0.textColor = systemColorScheme.secondaryTextColor + } + + resultsTable.reloadDataMaintainingSelection() } } diff --git a/macOS/Source/UI/Search/SearchViewController.swift b/macOS/Source/UI/Search/SearchViewController.swift index 04b4131e7..3ebfd3c5c 100644 --- a/macOS/Source/UI/Search/SearchViewController.swift +++ b/macOS/Source/UI/Search/SearchViewController.swift @@ -22,6 +22,9 @@ class SearchViewController: NSViewController { lazy var captionLabels: [NSTextField] = [lblSeachByCaption, lblComparisonTypeCaption, lblOptionsCaption] + @IBOutlet weak var settingsBox: NSBox! + @IBOutlet weak var settingsBoxHeightConstraint: NSLayoutConstraint! + @IBOutlet weak var btnNextSearch: NSButton! @IBOutlet weak var btnPreviousSearch: NSButton! @@ -44,6 +47,8 @@ class SearchViewController: NSViewController { // Current search results private(set) var searchResults: SearchResults! + private var isShowingSettings: Bool = false + private lazy var messenger = Messenger(for: self) override func viewDidLoad() { @@ -52,6 +57,8 @@ class SearchViewController: NSViewController { fontSchemesManager.registerObserver(self) colorSchemesManager.registerSchemeObserver(self) + + showOrHideSettingsView() } override func viewDidAppear() { @@ -83,7 +90,7 @@ class SearchViewController: NSViewController { return } - NSView.showViews(btnPreviousSearch, btnNextSearch) +// NSView.showViews(btnPreviousSearch, btnNextSearch) lblSummary.stringValue = "\(searchResults.count) \(searchResults.count == 1 ? "result" : "results") found in \(searchQuery.scope.description)" } @@ -145,6 +152,24 @@ class SearchViewController: NSViewController { redoSearchIfPossible() } + @IBAction func toggleSettingsViewAction(_ sender: Any) { + + isShowingSettings.toggle() + showOrHideSettingsView() + } + + private func showOrHideSettingsView() { + + NSAnimationContext.runAnimationGroup({ context in + + context.duration = 0.3 + context.timingFunction = CAMediaTimingFunction(name: .easeIn) + + settingsBoxHeightConstraint.animator().constant = isShowingSettings ? 118 : 1 + + }, completionHandler: nil) + } + // // // Iterates to the previous search result // @IBAction func previousSearchAction(_ sender: Any) {