Differentiate between normal select without undo and deep dive select with undo
This commit is contained in:
parent
b22e436f8b
commit
5baccc4b3f
@ -142,7 +142,7 @@ class Model(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun selectEntry(entry: DictionaryEntry) {
|
fun deepDive(entry: DictionaryEntry) {
|
||||||
undoManager.execute(object : Command {
|
undoManager.execute(object : Command {
|
||||||
private val previouslySelectedEntry = internalSelectedEntry.value
|
private val previouslySelectedEntry = internalSelectedEntry.value
|
||||||
|
|
||||||
@ -158,6 +158,11 @@ class Model(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun normalSelect(entry: DictionaryEntry) {
|
||||||
|
undoManager.reset()
|
||||||
|
select(entry)
|
||||||
|
}
|
||||||
|
|
||||||
private fun select(entry: DictionaryEntry) {
|
private fun select(entry: DictionaryEntry) {
|
||||||
internalFinishedFindingCharacters.value = false
|
internalFinishedFindingCharacters.value = false
|
||||||
internalFinishedFindingWordsBeginning.value = false
|
internalFinishedFindingWordsBeginning.value = false
|
||||||
|
@ -207,7 +207,7 @@ class DetailsController(
|
|||||||
|
|
||||||
selectionModel.selectedItemProperty().addListener { _, _, newEntry ->
|
selectionModel.selectedItemProperty().addListener { _, _, newEntry ->
|
||||||
if (newEntry == null) return@addListener
|
if (newEntry == null) return@addListener
|
||||||
model.selectEntry(newEntry)
|
model.deepDive(newEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progressIndicatorWordsContaining.visibleProperty().bind(model.isFindingWordsContaining)
|
progressIndicatorWordsContaining.visibleProperty().bind(model.isFindingWordsContaining)
|
||||||
@ -225,7 +225,7 @@ class DetailsController(
|
|||||||
|
|
||||||
selectionModel.selectedItemProperty().addListener { _, _, newEntry ->
|
selectionModel.selectedItemProperty().addListener { _, _, newEntry ->
|
||||||
if (newEntry == null) return@addListener
|
if (newEntry == null) return@addListener
|
||||||
model.selectEntry(newEntry)
|
model.deepDive(newEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progressIndicatorWordsBeginning.visibleProperty().bind(model.isFindingWordsBeginning)
|
progressIndicatorWordsBeginning.visibleProperty().bind(model.isFindingWordsBeginning)
|
||||||
@ -243,7 +243,7 @@ class DetailsController(
|
|||||||
|
|
||||||
selectionModel.selectedItemProperty().addListener { _, _, newEntry ->
|
selectionModel.selectedItemProperty().addListener { _, _, newEntry ->
|
||||||
if (newEntry == null) return@addListener
|
if (newEntry == null) return@addListener
|
||||||
model.selectEntry(newEntry)
|
model.deepDive(newEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progressIndicatorCharacters.visibleProperty().bind(model.isFindingCharacters)
|
progressIndicatorCharacters.visibleProperty().bind(model.isFindingCharacters)
|
||||||
|
@ -49,7 +49,7 @@ class SearchResultsController(
|
|||||||
if (newValue == null) {
|
if (newValue == null) {
|
||||||
return@addListener
|
return@addListener
|
||||||
}
|
}
|
||||||
model.selectEntry(newValue)
|
model.normalSelect(newValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class UndoManager {
|
|||||||
|
|
||||||
undoStack.push(command).execute()
|
undoStack.push(command).execute()
|
||||||
|
|
||||||
canUndoProperty.value = undoStack.size > 1
|
canUndoProperty.value = !undoStack.isEmpty()
|
||||||
canRedoProperty.value = false
|
canRedoProperty.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class UndoManager {
|
|||||||
|
|
||||||
redoStack.push(undoStack.pop()).undo()
|
redoStack.push(undoStack.pop()).undo()
|
||||||
|
|
||||||
canUndoProperty.value = undoStack.size > 1
|
canUndoProperty.value = !undoStack.isEmpty()
|
||||||
canRedoProperty.value = true
|
canRedoProperty.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,4 +36,11 @@ class UndoManager {
|
|||||||
canUndoProperty.value = true
|
canUndoProperty.value = true
|
||||||
canRedoProperty.value = !redoStack.isEmpty()
|
canRedoProperty.value = !redoStack.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun reset() {
|
||||||
|
undoStack.clear()
|
||||||
|
redoStack.clear()
|
||||||
|
canUndoProperty.value = false
|
||||||
|
canRedoProperty.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user