OSDN Git Service

洋上補給の補強増設用のショートネームをつけた
[kcd/KCD.git] / KCD / DefaultKeys.swift
1 /*
2  DefaultKeys.swift
3  
4  Copyright (c) 2017, Hori, Masaki.
5  All rights reserved.
6  
7  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8  
9  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10  
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.
12  
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.
14  
15  */
16
17 /*
18  
19  DefaultKeys.swift
20  
21  CotEditor
22  https://coteditor.com
23  
24  Created by 1024jp on 2017-02-14.
25  
26  ------------------------------------------------------------------------------
27  
28  © 2016-2017 1024jp
29  
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
33  
34  https://www.apache.org/licenses/LICENSE-2.0
35  
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.
41  
42  */
43
44 import Foundation
45 import AppKit.NSColor
46 import AppKit.NSControl
47
48
49 func rangeReguletor<T>(_ range: ClosedRange<T>) -> (T) -> T {
50     
51     return {
52         
53         let min = range.lowerBound
54         let max = range.upperBound
55         
56         switch $0 {
57         case let v where v < min: return min
58         case let v where v > max: return max
59         default: return $0
60         }
61     }
62 }
63
64
65 extension DefaultKeys {
66     
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")
71     
72     // Debugging
73     static let showsDebugMenu = DefaultKey<Bool>("ShowsDebugMenu")
74     static let degugPrintLevel = DefaultKey<Debug.Level>("DebugPrintLevel", alternative: .none)
75     
76     // Main Window
77     static let prevReloadDate = DefaultKey<Date>("previousReloadDate", alternative: .distantPast)
78     
79     // PowerUpSupport
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")
85     
86     // Plan Color
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))
94     
95     // Resource View
96     static let minimumColoredShipCount = DefaultKey<Int>("minimumColoredShipCount", regulator: rangeReguletor(0...9))
97
98     // Notifiy Sound
99     static let playFinishMissionSound = DefaultKey<Bool>("playFinishMissionSound")
100     static let playFinishNyukyoSound = DefaultKey<Bool>("playFinishNyukyoSound")
101     static let playFinishKenzoSound = DefaultKey<Bool>("playFinishKenzoSound")
102     
103     // Upgradable List
104     static let showLevelOneShipInUpgradableList = DefaultKey<Bool>("showLevelOneShipInUpgradableList")
105     static let showsExcludedShipInUpgradableList = DefaultKey<Bool>("showsExcludedShipInUpgradableList")
106     
107     // Equipment List
108     static let showEquipmentType = DefaultKey<SlotItemWindowController.ShowType>("showEquipmentType", alternative: .all)
109     
110     // FleetView
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)
114     
115     // Combined View
116     static let lastHasCombinedView = DefaultKey<Bool>("lastHasCombinedView")
117     static let autoCombinedView = DefaultKey<Bool>("autoCombinedView")
118     static let useSwipeChangeCombinedView = DefaultKey<Bool>("useSwipeChangeCombinedView")
119     
120     // Screenshos
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<NSControl.ControlSize>("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")
130     
131     // Old History Item Clean
132     static let cleanOldHistoryItems = DefaultKey<Bool>("cleanOldHistoryItems")
133     static let cleanSinceDays = DefaultKey<Int>("cleanSiceDays", regulator: rangeReguletor(1...Int.max))
134     
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")
139     
140     // Sakuteki Calculate
141     static let sakutekiCalclationSterategy = DefaultKey<FleetViewController.SakutekiCalclationSterategy>("sakutekiCalclationSterategy", alternative: .total)
142     static let formula33Factor = DefaultKey<Double>("formula33Factor")
143     
144 }