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) outBuf.delete(0, outBuf.length)
outputChanged.invoke(OutputEvent()) outputChanged.invoke(OutputEvent())
ip.mode = IpMode.Inactive ip.mode = IpMode.Inactive
return true return false
} }
private fun pushDig(dig: Char): Boolean { private fun pushDig(dig: Char): Boolean {

View File

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

View File

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