termination updates UI

This commit is contained in:
2018-11-26 13:37:27 -05:00
parent 145d9fcf3c
commit 02fc840c4d
3 changed files with 16 additions and 5 deletions

View File

@@ -266,7 +266,7 @@ class B93Interpreter : Interpreter {
outBuf.delete(0, outBuf.length)
outputChanged.invoke(OutputEvent())
ip.mode = IpMode.Inactive
return true
return false
}
private fun pushDig(dig: Char): Boolean {

View File

@@ -1,6 +1,7 @@
package befide.ide
import befide.befunge.core.Interpreter
import befide.befunge.state.IpMode
import javafx.animation.Animation
import javafx.animation.Timeline
import javafx.beans.property.SimpleBooleanProperty
@@ -13,11 +14,13 @@ import tornadofx.setValue
import java.io.File
class ActionView(val interp: Interpreter, val codeView: CodeView, val ioView: IOView) : View() {
val stepProperty = SimpleBooleanProperty(false)
var step by stepProperty
var runTimeline: Timeline = timeline(false) {
keyframe(Duration.seconds(0.0)) {
setOnFinished {
if (!interp.step())
this@timeline.stop()
step = interp.step()
}
}
keyframe(Duration.seconds(1.0)) {}
@@ -51,7 +54,7 @@ class ActionView(val interp: Interpreter, val codeView: CodeView, val ioView: IO
interp.funge.values = codeView.values
interp.step()
step = interp.step()
}
fun stop() {
@@ -136,7 +139,7 @@ class ActionView(val interp: Interpreter, val codeView: CodeView, val ioView: IO
button("reset") {
setOnAction { reset() }
enableWhen(canResetProperty.and(isRunningProperty.not()))
enableWhen(canResetProperty)
}
separator {}
@@ -164,4 +167,10 @@ class ActionView(val interp: Interpreter, val codeView: CodeView, val ioView: IO
disableWhen(isRunningProperty)
}
}
init {
stepProperty.onChange {
if (!it) stop()
}
}
}

View File

@@ -36,6 +36,8 @@ class IOView(val interp: Interpreter) : View() {
textarea(oldinputProperty) {
isEditable = false
prefHeight = 0.0
oldinputProperty.onChange { scrollTop = Double.MAX_VALUE }
}
textfield {
onAction = EventHandler {