/* DefaultKeys.swift Copyright (c) 2017, Hori, Masaki. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* DefaultKeys.swift CotEditor https://coteditor.com Created by 1024jp on 2017-02-14. ------------------------------------------------------------------------------ © 2016-2017 1024jp Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import Foundation import AppKit.NSColor import AppKit.NSControl func rangeReguletor(_ range: ClosedRange) -> (T) -> T { return { let min = range.lowerBound let max = range.upperBound switch $0 { case let v where v < min: return min case let v where v > max: return max default: return $0 } } } extension DefaultKeys { // Table sort descriptor static let slotItemSortDescriptors = DefaultKey<[NSSortDescriptor]>("slotItemSortKey2") static let shipviewSortDescriptors = DefaultKey<[NSSortDescriptor]>("shipviewsortdescriptor") static let powerupSupportSortDecriptors = DefaultKey<[NSSortDescriptor]>("powerupsupportsortdecriptor") // Debugging static let showsDebugMenu = DefaultKey("ShowsDebugMenu") static let degugPrintLevel = DefaultKey("DebugPrintLevel", alternative: .none) // Main Window static let prevReloadDate = DefaultKey("previousReloadDate", alternative: .distantPast) // PowerUpSupport static let hideMaxKaryoku = DefaultKey("hideMaxKaryoku") static let hideMaxLucky = DefaultKey("hideMaxLucky") static let hideMaxRaisou = DefaultKey("hideMaxRaisou") static let hideMaxSoukou = DefaultKey("hideMaxSoukou") static let hideMaxTaiku = DefaultKey("hideMaxTaiku") // Plan Color static let showsPlanColor = DefaultKey("showsPlanColor") static let plan01Color = DefaultKey("plan01Color", alternative: #colorLiteral(red: 0.000, green: 0.043, blue: 0.518, alpha: 1)) static let plan02Color = DefaultKey("plan02Color", alternative: #colorLiteral(red: 0.800, green: 0.223, blue: 0.000, alpha: 1)) static let plan03Color = DefaultKey("plan03Color", alternative: #colorLiteral(red: 0.539, green: 0.012, blue: 0.046, alpha: 1)) static let plan04Color = DefaultKey("plan04Color", alternative: #colorLiteral(red: 0.000, green: 0.535, blue: 0.535, alpha: 1)) static let plan05Color = DefaultKey("plan05Color", alternative: #colorLiteral(red: 0.376, green: 0.035, blue: 0.535, alpha: 1)) static let plan06Color = DefaultKey("plan06Color", alternative: #colorLiteral(red: 0.535, green: 0.535, blue: 0.000, alpha: 1)) // Resource View static let minimumColoredShipCount = DefaultKey("minimumColoredShipCount", regulator: rangeReguletor(0...9)) // Notifiy Sound static let playFinishMissionSound = DefaultKey("playFinishMissionSound") static let playFinishNyukyoSound = DefaultKey("playFinishNyukyoSound") static let playFinishKenzoSound = DefaultKey("playFinishKenzoSound") // Upgradable List static let showLevelOneShipInUpgradableList = DefaultKey("showLevelOneShipInUpgradableList") static let showsExcludedShipInUpgradableList = DefaultKey("showsExcludedShipInUpgradableList") // Equipment List static let showEquipmentType = DefaultKey("showEquipmentType", alternative: .all) // FleetView static let fleetViewPosition = DefaultKey("fleetViewPosition", alternative: .above) static let fleetViewShipOrder = DefaultKey("fleetViewShipOrder", alternative: .doubleLine) static let repairTime = DefaultKey("repairTime", alternative: .distantPast) // Combined View static let lastHasCombinedView = DefaultKey("lastHasCombinedView") static let autoCombinedView = DefaultKey("autoCombinedView") static let useSwipeChangeCombinedView = DefaultKey("useSwipeChangeCombinedView") // Screenshos static let appendKanColleTag = DefaultKey("appendKanColleTag") static let showsListWindowAtScreenshot = DefaultKey("showsListWindowAtScreenshot") static let screenshotPreviewZoomValue = DefaultKey("screenshotPreviewZoomValue", regulator: rangeReguletor(0.2...0.99)) static let screenshotEditorColumnCount = DefaultKey("screenshotEditorColumnCount", regulator: rangeReguletor(1...50)) static let scrennshotEditorType = DefaultKey("scrennshotEditorType") static let screenshotButtonSize = DefaultKey("screenshotButtonSize", alternative: .regular) static let useMask = DefaultKey("useMask") static let screenShotBorderWidth = DefaultKey("screenShotBorderWidth", regulator: rangeReguletor(0.0...20.0)) static let screenShotSaveDirectory = DefaultKey("screenShotSaveDirectory") // Old History Item Clean static let cleanOldHistoryItems = DefaultKey("cleanOldHistoryItems") static let cleanSinceDays = DefaultKey("cleanSiceDays", regulator: rangeReguletor(1...Int.max)) // Notify time signal static let notifyTimeSignal = DefaultKey("notifyTimeSignal") static let notifyTimeBeforeTimeSignal = DefaultKey("notifyTimeBeforeTimeSignal", regulator: rangeReguletor(1...59)) static let playNotifyTimeSignalSound = DefaultKey("playNotifyTimeSignalSound") // Sakuteki Calculate static let sakutekiCalclationSterategy = DefaultKey("sakutekiCalclationSterategy", alternative: .total) static let formula33Factor = DefaultKey("formula33Factor") }