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: Comparable>(_ range: ClosedRange<T>) -> (T) -> T {
53 let min = range.lowerBound
54 let max = range.upperBound
57 case let v where v < min: return min
58 case let v where v > max: return max
65 extension DefaultKeys {
67 // Table sort descriptor
68 static let slotItemSortDescriptors = DefaultKey<[NSSortDescriptor]>("slotItemSortKey2")
69 static let shipviewSortDescriptors = DefaultKey<[NSSortDescriptor]>("shipviewsortdescriptor")
70 static let powerupSupportSortDecriptors = DefaultKey<[NSSortDescriptor]>("powerupsupportsortdecriptor")
73 static let showsDebugMenu = DefaultKey<Bool>("ShowsDebugMenu")
74 static let degugPrintLevel = DefaultKey<Debug.Level>("DebugPrintLevel", alternative: .none)
77 static let prevReloadDate = DefaultKey<Date>("previousReloadDate", alternative: .distantPast)
80 static let hideMaxKaryoku = DefaultKey<Bool>("hideMaxKaryoku")
81 static let hideMaxLucky = DefaultKey<Bool>("hideMaxLucky")
82 static let hideMaxRaisou = DefaultKey<Bool>("hideMaxRaisou")
83 static let hideMaxSoukou = DefaultKey<Bool>("hideMaxSoukou")
84 static let hideMaxTaiku = DefaultKey<Bool>("hideMaxTaiku")
87 static let showsPlanColor = DefaultKey<Bool>("showsPlanColor")
88 static let plan01Color = DefaultKey<NSColor>("plan01Color", alternative: #colorLiteral(red: 0.000, green: 0.043, blue: 0.518, alpha: 1))
89 static let plan02Color = DefaultKey<NSColor>("plan02Color", alternative: #colorLiteral(red: 0.800, green: 0.223, blue: 0.000, alpha: 1))
90 static let plan03Color = DefaultKey<NSColor>("plan03Color", alternative: #colorLiteral(red: 0.539, green: 0.012, blue: 0.046, alpha: 1))
91 static let plan04Color = DefaultKey<NSColor>("plan04Color", alternative: #colorLiteral(red: 0.000, green: 0.535, blue: 0.535, alpha: 1))
92 static let plan05Color = DefaultKey<NSColor>("plan05Color", alternative: #colorLiteral(red: 0.376, green: 0.035, blue: 0.535, alpha: 1))
93 static let plan06Color = DefaultKey<NSColor>("plan06Color", alternative: #colorLiteral(red: 0.535, green: 0.535, blue: 0.000, alpha: 1))
96 static let minimumColoredShipCount = DefaultKey<Int>("minimumColoredShipCount", regulator: rangeReguletor(0...9))
99 static let playFinishMissionSound = DefaultKey<Bool>("playFinishMissionSound")
100 static let playFinishNyukyoSound = DefaultKey<Bool>("playFinishNyukyoSound")
101 static let playFinishKenzoSound = DefaultKey<Bool>("playFinishKenzoSound")
104 static let showLevelOneShipInUpgradableList = DefaultKey<Bool>("showLevelOneShipInUpgradableList")
105 static let showsExcludedShipInUpgradableList = DefaultKey<Bool>("showsExcludedShipInUpgradableList")
108 static let showEquipmentType = DefaultKey<SlotItemWindowController.ShowType>("showEquipmentType", alternative: .all)
111 static let fleetViewPosition = DefaultKey<BroserWindowController.FleetViewPosition>("fleetViewPosition", alternative: .above)
112 static let fleetViewShipOrder = DefaultKey<FleetViewController.ShipOrder>("fleetViewShipOrder", alternative: .doubleLine)
113 static let repairTime = DefaultKey<Date>("repairTime", alternative: .distantPast)
116 static let lastHasCombinedView = DefaultKey<Bool>("lastHasCombinedView")
117 static let autoCombinedView = DefaultKey<Bool>("autoCombinedView")
118 static let useSwipeChangeCombinedView = DefaultKey<Bool>("useSwipeChangeCombinedView")
121 static let appendKanColleTag = DefaultKey<Bool>("appendKanColleTag")
122 static let showsListWindowAtScreenshot = DefaultKey<Bool>("showsListWindowAtScreenshot")
123 static let screenshotPreviewZoomValue = DefaultKey<Double>("screenshotPreviewZoomValue", regulator: rangeReguletor(0.2...0.99))
124 static let screenshotEditorColumnCount = DefaultKey<Int>("screenshotEditorColumnCount", regulator: rangeReguletor(1...50))
125 static let scrennshotEditorType = DefaultKey<Int>("scrennshotEditorType")
126 static let screenshotButtonSize = DefaultKey<NSControlSize>("screenshotButtonSize", alternative: .regular)
127 static let useMask = DefaultKey<Bool>("useMask")
128 static let screenShotBorderWidth = DefaultKey<CGFloat>("screenShotBorderWidth", regulator: rangeReguletor(0.0...20.0))
129 static let screenShotSaveDirectory = DefaultKey<String?>("screenShotSaveDirectory")
131 // Old History Item Clean
132 static let cleanOldHistoryItems = DefaultKey<Bool>("cleanOldHistoryItems")
133 static let cleanSinceDays = DefaultKey<Int>("cleanSiceDays", regulator: rangeReguletor(1...Int.max))
135 // Notify time signal
136 static let notifyTimeSignal = DefaultKey<Bool>("notifyTimeSignal")
137 static let notifyTimeBeforeTimeSignal = DefaultKey<Int>("notifyTimeBeforeTimeSignal", regulator: rangeReguletor(1...59))
138 static let playNotifyTimeSignalSound = DefaultKey<Bool>("playNotifyTimeSignalSound")
140 // Sakuteki Calculate
141 static let sakutekiCalclationSterategy = DefaultKey<FleetViewController.SakutekiCalclationSterategy>("sakutekiCalclationSterategy", alternative: .total)
142 static let formula33Factor = DefaultKey<Double>("formula33Factor")