New Features #1

Open
marvinelsen wants to merge 76 commits from develop into main
Showing only changes of commit 8ada0a5510 - Show all commits

View File

@ -6,12 +6,14 @@ import com.marvinelsen.willow.config.Pronunciation
import com.marvinelsen.willow.config.Script import com.marvinelsen.willow.config.Script
import com.marvinelsen.willow.ui.DictionaryEntryFx import com.marvinelsen.willow.ui.DictionaryEntryFx
import com.marvinelsen.willow.ui.cells.DictionaryEntryCellFactory import com.marvinelsen.willow.ui.cells.DictionaryEntryCellFactory
import com.marvinelsen.willow.ui.util.createContextMenuForEntry
import javafx.beans.binding.Bindings import javafx.beans.binding.Bindings
import javafx.fxml.FXML import javafx.fxml.FXML
import javafx.scene.control.Label import javafx.scene.control.Label
import javafx.scene.control.ListView import javafx.scene.control.ListView
import javafx.scene.control.TabPane import javafx.scene.control.TabPane
import javafx.scene.input.ContextMenuEvent import javafx.scene.input.ContextMenuEvent
import javafx.scene.layout.FlowPane
import javafx.scene.web.WebView import javafx.scene.web.WebView
import kotlinx.html.body import kotlinx.html.body
import kotlinx.html.h1 import kotlinx.html.h1
@ -22,6 +24,9 @@ import kotlinx.html.stream.createHTML
import java.util.ResourceBundle import java.util.ResourceBundle
class DetailsController(private val model: Model, private val config: Config) { class DetailsController(private val model: Model, private val config: Config) {
@FXML
private lateinit var flowPaneSelectedEntry: FlowPane
@FXML @FXML
private lateinit var labelPronunciation: Label private lateinit var labelPronunciation: Label
@ -177,5 +182,12 @@ class DetailsController(private val model: Model, private val config: Config) {
} }
fun showSelectedEntryContextMenu(contextMenuEvent: ContextMenuEvent) { fun showSelectedEntryContextMenu(contextMenuEvent: ContextMenuEvent) {
if (model.selectedEntry.value == null) return
createContextMenuForEntry(model.selectedEntry.value, resources).show(
flowPaneSelectedEntry.scene.window,
contextMenuEvent.screenX,
contextMenuEvent.screenY
)
} }
} }