Skip to content

Commit fdf9a16

Browse files
committed
Add checkbox to console window that allows showing all VM messages
1 parent c57941e commit fdf9a16

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

‎src/main/kotlin/be/ugent/topl/mio/debugger/Debugger.kt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ open class Debugger(private val connection: Connection, start: Boolean = true, p
2020
var printListener: ((String) -> Unit)? = null
2121
private val messageQueue = MessageQueue {
2222
for (msg in it) {
23-
if (msg.startsWith("EMU: ")) {
24-
this.printListener?.invoke(msg.substring(5))
25-
}
23+
this.printListener?.invoke(msg)
2624
}
2725
}
2826
val errorHandlers = mutableListOf<(String) -> Unit>()

‎src/main/kotlin/be/ugent/topl/mio/ui/ConsoleWindow.kt‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package be.ugent.topl.mio.ui
22

33
import be.ugent.topl.mio.debugger.Debugger
4+
import java.awt.BorderLayout
5+
import java.awt.Checkbox
46
import java.awt.Dimension
57
import java.awt.Font
8+
import javax.swing.JCheckBox
69
import javax.swing.JFrame
710
import javax.swing.JScrollPane
811
import javax.swing.JTextArea
@@ -20,9 +23,19 @@ class ConsoleWindow(debugger: Debugger) : JFrame("Console") {
2023
val scrollPane = JScrollPane(textArea)
2124
val caret = textArea.caret as DefaultCaret
2225
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE)
23-
add(scrollPane)
24-
debugger.printListener = {
25-
textArea.text += it + "\n"
26+
layout = BorderLayout()
27+
add(scrollPane, BorderLayout.CENTER)
28+
val emuCheckBox = JCheckBox("EMU Only", true)
29+
add(emuCheckBox, BorderLayout.SOUTH)
30+
debugger.printListener = { msg ->
31+
if (emuCheckBox.isSelected) {
32+
if (msg.startsWith("EMU: ")) {
33+
textArea.text += msg.substring(5) + "\n"
34+
}
35+
}
36+
else {
37+
textArea.text += msg + "\n"
38+
}
2639
}
2740
isAlwaysOnTop = true
2841
}

‎src/main/kotlin/be/ugent/topl/mio/ui/InteractiveDebugger.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class InteractiveDebugger(
281281
}
282282
}
283283
})
284-
//toolBar.add(consoleToggle)
284+
toolBar.add(consoleToggle)
285285
toolBar.add(progressBar)
286286

287287
val theme =

0 commit comments

Comments
 (0)