4 Copyright (c) 2017, Hori, Masaki.
7 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11 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.
13 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.
24 Created by 1024jp on 2017-02-14.
26 ------------------------------------------------------------------------------
30 Licensed under the Apache License, Version 2.0 (the "License");
31 you may not use this file except in compliance with the License.
32 You may obtain a copy of the License at
34 https://www.apache.org/licenses/LICENSE-2.0
36 Unless required by applicable law or agreed to in writing, software
37 distributed under the License is distributed on an "AS IS" BASIS,
38 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 See the License for the specific language governing permissions and
40 limitations under the License.
46 import AppKit.NSControl
49 func rangeReguletor<T>(_ range: ClosedRange<T>) -> (T) -> T {
53 let min = range.lowerBound
54 let max = range.upperBound
58 case let v where v < min: return min
60 case let v where v > max: return max
69 extension DefaultKeys {
71 // Table sort descriptor
72 static let slotItemSortDescriptors = DefaultKey<[NSSortDescriptor]>("slotItemSortKey2")
73 static let shipviewSortDescriptors = DefaultKey<[NSSortDescriptor]>("shipviewsortdescriptor")
74 static let powerupSupportSortDecriptors = DefaultKey<[NSSortDescriptor]>("powerupsupportsortdecriptor")
77 static let showsDebugMenu = DefaultKey<Bool>("ShowsDebugMenu")
78 static let degugPrintLevel = DefaultKey<Debug.Level>("DebugPrintLevel", alternative: .none)
81 static let prevReloadDate = DefaultKey<Date>("previousReloadDate", alternative: .distantPast)
84 static let hideMaxKaryoku = DefaultKey<Bool>("hideMaxKaryoku")
85 static let hideMaxLucky = DefaultKey<Bool>("hideMaxLucky")
86 static let hideMaxRaisou = DefaultKey<Bool>("hideMaxRaisou")
87 static let hideMaxSoukou = DefaultKey<Bool>("hideMaxSoukou")
88 static let hideMaxTaiku = DefaultKey<Bool>("hideMaxTaiku")
91 static let showsPlanColor = DefaultKey<Bool>("showsPlanColor")
92 static let plan01Color = DefaultKey<NSColor>("plan01Color", alternative: #colorLiteral(red: 0.000, green: 0.043, blue: 0.518, alpha: 1))
93 static let plan02Color = DefaultKey<NSColor>("plan02Color", alternative: #colorLiteral(red: 0.800, green: 0.223, blue: 0.000, alpha: 1))
94 static let plan03Color = DefaultKey<NSColor>("plan03Color", alternative: #colorLiteral(red: 0.539, green: 0.012, blue: 0.046, alpha: 1))
95 static let plan04Color = DefaultKey<NSColor>("plan04Color", alternative: #colorLiteral(red: 0.000, green: 0.535, blue: 0.535, alpha: 1))
96 static let plan05Color = DefaultKey<NSColor>("plan05Color", alternative: #colorLiteral(red: 0.376, green: 0.035, blue: 0.535, alpha: 1))
97 static let plan06Color = DefaultKey<NSColor>("plan06Color", alternative: #colorLiteral(red: 0.535, green: 0.535, blue: 0.000, alpha: 1))
100 static let minimumColoredShipCount = DefaultKey<Int>("minimumColoredShipCount", regulator: rangeReguletor(0...9))
103 static let playFinishMissionSound = DefaultKey<Bool>("playFinishMissionSound")
104 static let playFinishNyukyoSound = DefaultKey<Bool>("playFinishNyukyoSound")
105 static let playFinishKenzoSound = DefaultKey<Bool>("playFinishKenzoSound")
108 static let showLevelOneShipInUpgradableList = DefaultKey<Bool>("showLevelOneShipInUpgradableList")
109 static let showsExcludedShipInUpgradableList = DefaultKey<Bool>("showsExcludedShipInUpgradableList")
112 static let showEquipmentType = DefaultKey<SlotItemWindowController.ShowType>("showEquipmentType", alternative: .all)
115 static let fleetViewPosition = DefaultKey<BroserWindowController.FleetViewPosition>("fleetViewPosition", alternative: .above)
116 static let fleetViewShipOrder = DefaultKey<FleetViewController.ShipOrder>("fleetViewShipOrder", alternative: .doubleLine)
117 static let repairTime = DefaultKey<Date>("repairTime", alternative: .distantPast)
120 static let lastHasCombinedView = DefaultKey<Bool>("lastHasCombinedView")
121 static let autoCombinedView = DefaultKey<Bool>("autoCombinedView")
122 static let useSwipeChangeCombinedView = DefaultKey<Bool>("useSwipeChangeCombinedView")
125 static let appendKanColleTag = DefaultKey<Bool>("appendKanColleTag")
126 static let showsListWindowAtScreenshot = DefaultKey<Bool>("showsListWindowAtScreenshot")
127 static let screenshotPreviewZoomValue = DefaultKey<Double>("screenshotPreviewZoomValue", regulator: rangeReguletor(0.2...0.99))
128 static let screenshotEditorColumnCount = DefaultKey<Int>("screenshotEditorColumnCount", regulator: rangeReguletor(1...50))
129 static let scrennshotEditorType = DefaultKey<Int>("scrennshotEditorType")
130 static let screenshotButtonSize = DefaultKey<NSControl.ControlSize>("screenshotButtonSize", alternative: .regular)
131 static let useMask = DefaultKey<Bool>("useMask")
132 static let screenShotBorderWidth = DefaultKey<CGFloat>("screenShotBorderWidth", regulator: rangeReguletor(0.0...20.0))
133 static let screenShotSaveDirectory = DefaultKey<String?>("screenShotSaveDirectory")
135 // Old History Item Clean
136 static let cleanOldHistoryItems = DefaultKey<Bool>("cleanOldHistoryItems")
137 static let cleanSinceDays = DefaultKey<Int>("cleanSiceDays", regulator: rangeReguletor(1...Int.max))
139 // Notify time signal
140 static let notifyTimeSignal = DefaultKey<Bool>("notifyTimeSignal")
141 static let notifyTimeBeforeTimeSignal = DefaultKey<Int>("notifyTimeBeforeTimeSignal", regulator: rangeReguletor(1...59))
142 static let playNotifyTimeSignalSound = DefaultKey<Bool>("playNotifyTimeSignalSound")
144 // Sakuteki Calculate
145 static let sakutekiCalclationSterategy = DefaultKey<FleetViewController.SakutekiCalclationSterategy>("sakutekiCalclationSterategy", alternative: .total)
146 static let formula33Factor = DefaultKey<Double>("formula33Factor")