@@ -126,29 +126,51 @@ fun SettingsTheme() {
126
126
Box (contentAlignment = Alignment .Center ) {
127
127
DropdownMenuWithLabel (
128
128
label = " Window scale" ,
129
- currentValue = ConfigurationHandler .getInstance().themeSettings.windowScale,
130
- options = listOf (" 150%" , " 125%" , " 100%" , " Resizable" , " Maximized" ),
129
+ currentValue = run {
130
+ val currentScale = ConfigurationHandler .getInstance().themeSettings.windowScale
131
+
132
+ when (currentScale) {
133
+ " Resizable" -> " Resizable (unstable)"
134
+ " Maximized" -> " Maximized (unstable)"
135
+ else -> currentScale
136
+ }
137
+ },
138
+ options =
139
+ listOf (
140
+ " 150%" ,
141
+ " 125%" ,
142
+ " 100%" ,
143
+ " Resizable (unstable)" ,
144
+ " Maximized (unstable)" ,
145
+ ),
131
146
) { newValue ->
147
+ val processedValue =
148
+ when {
149
+ newValue.contains(" Resizable (unstable)" ) -> " Resizable"
150
+ newValue.contains(" Maximized (unstable)" ) -> " Maximized"
151
+ else -> newValue
152
+ }
153
+
132
154
val currentScale = ConfigurationHandler .getInstance().themeSettings.windowScale
133
155
134
- if (newValue in listOf (" Resizable" , " Maximized" ) &&
156
+ if (processedValue in listOf (" Resizable" , " Maximized" ) &&
135
157
currentScale in WindowUtility .windowScaleMapping.keys
136
158
) {
137
159
ConfigurationHandler .updateValue {
138
160
windowProperties.previousScale = currentScale
139
161
}
140
162
}
141
163
142
- windowFrame.isResizable = newValue == " Resizable"
143
- isWindowMaximized = newValue == " Maximized"
164
+ windowFrame.isResizable = processedValue == " Resizable"
165
+ isWindowMaximized = processedValue == " Maximized"
144
166
ConfigurationHandler .updateValue {
145
- windowProperties.wasPreviousScaleResizable = newValue == " Resizable"
167
+ windowProperties.wasPreviousScaleResizable = processedValue == " Resizable"
146
168
}
147
169
148
170
ConfigurationHandler .updateValue {
149
- themeSettings.windowScale = newValue
171
+ themeSettings.windowScale = processedValue
150
172
151
- when (newValue ) {
173
+ when (processedValue ) {
152
174
" Maximized" -> {
153
175
if (currentScale != " Resizable" ) {
154
176
windowProperties.previousScale = currentScale
@@ -166,18 +188,17 @@ fun SettingsTheme() {
166
188
ConfigurationHandler .getInstance().let { config ->
167
189
config.themeSettings.windowScale.let { scale ->
168
190
WindowUtility .windowScaleMapping[scale]
169
- ? : WindowUtility
170
- .windowScaleMapping[config.windowProperties.previousScale]
191
+ ? : WindowUtility .windowScaleMapping[
192
+ config.windowProperties.previousScale,
193
+ ]
171
194
? : scale.toFloatOrNull()
172
195
? : 1f
173
196
}.let { windowScale ->
174
197
config.windowProperties.currentWindowSize?.let {
175
198
(width, height) ->
176
199
width to height
177
- } ? : (800 * windowScale).toInt().let {
178
- width ->
179
- (600 * windowScale).toInt().let {
180
- height ->
200
+ } ? : (800 * windowScale).toInt().let { width ->
201
+ (600 * windowScale).toInt().let { height ->
181
202
width to height
182
203
}
183
204
}
@@ -186,7 +207,7 @@ fun SettingsTheme() {
186
207
centerOnScreen()
187
208
}
188
209
in WindowUtility .windowScaleMapping.keys -> {
189
- val newScale = WindowUtility .windowScaleMapping[newValue ]!!
210
+ val newScale = WindowUtility .windowScaleMapping[processedValue ]!!
190
211
191
212
ConfigurationHandler .updateValue {
192
213
windowProperties.wasPreviousScaleResizable = false
@@ -198,7 +219,7 @@ fun SettingsTheme() {
198
219
}
199
220
}
200
221
else -> throw IllegalArgumentException (
201
- " Invalid window scale value: $newValue " ,
222
+ " Invalid window scale value: $processedValue " ,
202
223
)
203
224
}
204
225
}
0 commit comments