diff --git a/src/main/kotlin/com/marvinelsen/willow/ui/controllers/dialogs/PreferencesDialogController.kt b/src/main/kotlin/com/marvinelsen/willow/ui/controllers/dialogs/PreferencesDialogController.kt index 08f70df..6ec1edc 100644 --- a/src/main/kotlin/com/marvinelsen/willow/ui/controllers/dialogs/PreferencesDialogController.kt +++ b/src/main/kotlin/com/marvinelsen/willow/ui/controllers/dialogs/PreferencesDialogController.kt @@ -49,13 +49,6 @@ class PreferencesDialogController(private val config: Config) { @FXML private lateinit var spinnerDefinitionFontSizeSearchResults: Spinner - private val entryHeadwordFontSizeObjectProperty = config.details.headwordFontSize.asObject() - private val entryPronunciationFontSizeObjectProperty = config.details.pronunciationFontSize.asObject() - - private val searchResultHeadwordFontSizeObjectProperty = config.searchResults.headwordFontSize.asObject() - private val searchResultPronunciationFontSizeObjectProperty = config.searchResults.pronunciationFontSize.asObject() - private val searchResultDefinitionFontSizeObjectProperty = config.searchResults.definitionFontSize.asObject() - @FXML private fun initialize() { comboBoxLocale.items.addAll( @@ -82,27 +75,42 @@ class PreferencesDialogController(private val config: Config) { with(spinnerHeadwordFontSizeDetails) { editor.textFormatter = FontSizeTextFormatter() - valueFactory.valueProperty().bindBidirectional(entryHeadwordFontSizeObjectProperty) + valueFactory.value = config.details.headwordFontSize.value + valueProperty().addListener { _, _, newValue -> + config.details.headwordFontSize.value = newValue + } } with(spinnerPronunciationFontSizeDetails) { editor.textFormatter = FontSizeTextFormatter() - valueFactory.valueProperty().bindBidirectional(entryPronunciationFontSizeObjectProperty) + valueFactory.value = config.details.pronunciationFontSize.value + valueProperty().addListener { _, _, newValue -> + config.details.pronunciationFontSize.value = newValue + } } with(spinnerHeadwordFontSizeSearchResults) { editor.textFormatter = FontSizeTextFormatter() - valueFactory.valueProperty().bindBidirectional(searchResultHeadwordFontSizeObjectProperty) + valueFactory.value = config.searchResults.headwordFontSize.value + valueProperty().addListener { _, _, newValue -> + config.searchResults.headwordFontSize.value = newValue + } } with(spinnerPronunciationFontSizeSearchResults) { editor.textFormatter = FontSizeTextFormatter() - valueFactory.valueProperty().bindBidirectional(searchResultPronunciationFontSizeObjectProperty) + valueFactory.value = config.searchResults.pronunciationFontSize.value + valueProperty().addListener { _, _, newValue -> + config.searchResults.pronunciationFontSize.value = newValue + } } with(spinnerDefinitionFontSizeSearchResults) { editor.textFormatter = FontSizeTextFormatter() - valueFactory.valueProperty().bindBidirectional(searchResultDefinitionFontSizeObjectProperty) + valueFactory.value = config.searchResults.definitionFontSize.value + valueProperty().addListener { _, _, newValue -> + config.searchResults.definitionFontSize.value = newValue + } } } }