Add general tab to preferences and refactor FX IDs
This commit is contained in:
parent
bc9d09c39f
commit
6446c2d9c8
@ -4,6 +4,7 @@ import com.marvinelsen.willow.Config
|
||||
import com.marvinelsen.willow.WillowApplication
|
||||
import com.marvinelsen.willow.ui.Pronunciation
|
||||
import com.marvinelsen.willow.ui.formatters.FontSizeTextFormatter
|
||||
import javafx.fxml.FXML
|
||||
import javafx.fxml.FXMLLoader
|
||||
import javafx.scene.control.ButtonType
|
||||
import javafx.scene.control.CheckBox
|
||||
@ -16,7 +17,6 @@ import javafx.stage.Stage
|
||||
import javafx.stage.Window
|
||||
import javafx.util.Callback
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
class PreferencesDialog(owner: Window?, config: Config) : Dialog<PreferencesDialog.Result>() {
|
||||
companion object {
|
||||
private const val DIALOG_MIN_HEIGHT = 400.0
|
||||
@ -27,17 +27,32 @@ class PreferencesDialog(owner: Window?, config: Config) : Dialog<PreferencesDial
|
||||
CHANGES, NO_CHANGES
|
||||
}
|
||||
|
||||
lateinit var comboBoxEntryPronunciation: ComboBox<Pronunciation>
|
||||
lateinit var comboBoxListPronunciation: ComboBox<Pronunciation>
|
||||
@FXML
|
||||
private lateinit var comboBoxPronunciationDetails: ComboBox<Pronunciation>
|
||||
|
||||
lateinit var checkBoxListShowPronunciation: CheckBox
|
||||
lateinit var checkBoxListShowDefinition: CheckBox
|
||||
@FXML
|
||||
private lateinit var comboBoxPronunciationSearchResults: ComboBox<Pronunciation>
|
||||
|
||||
lateinit var spinnerEntryHeadwordFontSize: Spinner<Int>
|
||||
lateinit var spinnerEntryPronunciationFontSize: Spinner<Int>
|
||||
lateinit var spinnerListHeadwordFontSize: Spinner<Int>
|
||||
lateinit var spinnerListPronunciationFontSize: Spinner<Int>
|
||||
lateinit var spinnerListDefinitionFontSize: Spinner<Int>
|
||||
@FXML
|
||||
private lateinit var checkBoxShowPronunciationSearchResults: CheckBox
|
||||
|
||||
@FXML
|
||||
private lateinit var checkBoxShowDefinitionSearchResults: CheckBox
|
||||
|
||||
@FXML
|
||||
private lateinit var spinnerHeadwordFontSizeDetails: Spinner<Int>
|
||||
|
||||
@FXML
|
||||
private lateinit var spinnerPronunciationFontSizeDetails: Spinner<Int>
|
||||
|
||||
@FXML
|
||||
private lateinit var spinnerHeadwordFontSizeSearchResults: Spinner<Int>
|
||||
|
||||
@FXML
|
||||
private lateinit var spinnerPronunciationFontSizeSearchResults: Spinner<Int>
|
||||
|
||||
@FXML
|
||||
private lateinit var spinnerDefinitionFontSizeSearchResults: Spinner<Int>
|
||||
|
||||
private val entryHeadwordFontSizeObjectProperty = config.detailHeadwordFontSize.asObject()
|
||||
|
||||
@ -58,7 +73,7 @@ class PreferencesDialog(owner: Window?, config: Config) : Dialog<PreferencesDial
|
||||
minHeight = DIALOG_MIN_HEIGHT
|
||||
}
|
||||
|
||||
with(spinnerEntryHeadwordFontSize) {
|
||||
with(spinnerHeadwordFontSizeDetails) {
|
||||
editor.textFormatter = FontSizeTextFormatter()
|
||||
valueFactory.valueProperty().bindBidirectional(entryHeadwordFontSizeObjectProperty)
|
||||
}
|
||||
|
@ -18,7 +18,23 @@
|
||||
<content>
|
||||
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
|
||||
tabClosingPolicy="UNAVAILABLE">
|
||||
<Tab closable="false" text="Entry">
|
||||
<Tab closable="false" text="General">
|
||||
<GridPane alignment="TOP_CENTER" hgap="8.0" vgap="8.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="ALWAYS"/>
|
||||
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS"/>
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" valignment="BASELINE" vgrow="NEVER"/>
|
||||
</rowConstraints>
|
||||
<padding>
|
||||
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0"/>
|
||||
</padding>
|
||||
<Label text="Script:"/>
|
||||
<ComboBox fx:id="comboBoxScript" GridPane.columnIndex="1"/>
|
||||
</GridPane>
|
||||
</Tab>
|
||||
<Tab closable="false" text="Details View">
|
||||
<GridPane alignment="TOP_CENTER" hgap="8.0" vgap="8.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="ALWAYS"/>
|
||||
@ -34,7 +50,7 @@
|
||||
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0"/>
|
||||
</padding>
|
||||
<Label text="Pronunciation:"/>
|
||||
<ComboBox fx:id="comboBoxEntryPronunciation" GridPane.columnIndex="1">
|
||||
<ComboBox fx:id="comboBoxPronunciationDetails" items="$phoneticAlphabets" GridPane.columnIndex="1">
|
||||
<value>
|
||||
<Pronunciation fx:value="PINYIN_WITH_TONE_MARKS"/>
|
||||
</value>
|
||||
@ -44,13 +60,13 @@
|
||||
</ComboBox>
|
||||
<Label text="Headword font size:" GridPane.rowIndex="2"/>
|
||||
<Label text="Pronunciation font size:" GridPane.rowIndex="3"/>
|
||||
<Spinner fx:id="spinnerEntryPronunciationFontSize" editable="true" GridPane.columnIndex="1"
|
||||
<Spinner fx:id="spinnerPronunciationFontSizeDetails" editable="true" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="3">
|
||||
<valueFactory>
|
||||
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" max="300" min="1"/>
|
||||
</valueFactory>
|
||||
</Spinner>
|
||||
<Spinner fx:id="spinnerEntryHeadwordFontSize" editable="true" GridPane.columnIndex="1"
|
||||
<Spinner fx:id="spinnerHeadwordFontSizeDetails" editable="true" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="2">
|
||||
<valueFactory>
|
||||
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" max="300" min="1"/>
|
||||
@ -59,7 +75,7 @@
|
||||
<Separator prefWidth="200.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="1"/>
|
||||
</GridPane>
|
||||
</Tab>
|
||||
<Tab closable="false" text="List">
|
||||
<Tab closable="false" text="Search Results">
|
||||
<GridPane alignment="TOP_CENTER" hgap="8.0" vgap="8.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="ALWAYS"/>
|
||||
@ -79,7 +95,8 @@
|
||||
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0"/>
|
||||
</padding>
|
||||
<Label text="Pronunciation:"/>
|
||||
<ComboBox fx:id="comboBoxListPronunciation" GridPane.columnIndex="1">
|
||||
<ComboBox fx:id="comboBoxPronunciationSearchResults" items="$phoneticAlphabets"
|
||||
GridPane.columnIndex="1">
|
||||
<value>
|
||||
<Pronunciation fx:value="PINYIN_WITH_TONE_MARKS"/>
|
||||
</value>
|
||||
@ -89,19 +106,19 @@
|
||||
</ComboBox>
|
||||
<Label text="Headword font size:" GridPane.rowIndex="5"/>
|
||||
<Label text="Pronunciation font size:" GridPane.rowIndex="6"/>
|
||||
<Spinner fx:id="spinnerListPronunciationFontSize" editable="true" GridPane.columnIndex="1"
|
||||
<Spinner fx:id="spinnerPronunciationFontSizeSearchResults" editable="true" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="6">
|
||||
<valueFactory>
|
||||
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" max="300" min="1"/>
|
||||
</valueFactory>
|
||||
</Spinner>
|
||||
<Spinner fx:id="spinnerListHeadwordFontSize" editable="true" GridPane.columnIndex="1"
|
||||
<Spinner fx:id="spinnerHeadwordFontSizeSearchResults" editable="true" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="5">
|
||||
<valueFactory>
|
||||
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" max="300" min="1"/>
|
||||
</valueFactory>
|
||||
</Spinner>
|
||||
<Spinner fx:id="spinnerListDefinitionFontSize" editable="true" GridPane.columnIndex="1"
|
||||
<Spinner fx:id="spinnerDefinitionFontSizeSearchResults" editable="true" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="7">
|
||||
<valueFactory>
|
||||
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" max="300" min="1"/>
|
||||
@ -110,9 +127,9 @@
|
||||
<Separator prefWidth="200.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="4"/>
|
||||
<Label text="Definition font size:" GridPane.rowIndex="7"/>
|
||||
<Label text="Display:" GridPane.rowIndex="2"/>
|
||||
<CheckBox fx:id="checkBoxListShowPronunciation" mnemonicParsing="false" selected="true"
|
||||
<CheckBox fx:id="checkBoxShowPronunciationSearchResults" mnemonicParsing="false" selected="true"
|
||||
text="Show pronunciation" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
<CheckBox fx:id="checkBoxListShowDefinition" mnemonicParsing="false" selected="true"
|
||||
<CheckBox fx:id="checkBoxShowDefinitionSearchResults" mnemonicParsing="false" selected="true"
|
||||
text="Show definition" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
||||
<Separator prefWidth="200.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="1"/>
|
||||
</GridPane>
|
||||
|
Loading…
Reference in New Issue
Block a user