mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-19 18:49:19 +01:00
Persist LogWidget "scroll to the end" checkbox value
This commit is contained in:
parent
04bbf626a1
commit
b03078ff27
@ -7,7 +7,9 @@ import ocelot.desktop.ui.widget.LogWidget.{LogEntry, TextLogEntry}
|
||||
import ocelot.desktop.ui.widget.window.PanelWindow
|
||||
import ocelot.desktop.ui.widget.{Button, Checkbox, Filler, Label, LogWidget, PaddingBox, TextInput, Widget}
|
||||
import ocelot.desktop.util.{OcelotInterfaceLogStorage, Orientation}
|
||||
import ocelot.desktop.windows.OcelotInterfaceWindow.ScrollToEndTag
|
||||
import org.lwjgl.input.Keyboard
|
||||
import totoro.ocelot.brain.nbt.NBTTagCompound
|
||||
|
||||
class OcelotInterfaceWindow(storage: OcelotInterfaceLogStorage) extends PanelWindow {
|
||||
override protected def title: String = s"${storage.name} ${storage.ocelotInterface.node.address}"
|
||||
@ -127,4 +129,20 @@ class OcelotInterfaceWindow(storage: OcelotInterfaceLogStorage) extends PanelWin
|
||||
def pushLine(line: String): Unit = {
|
||||
storage.ocelotInterface.pushMessage(line)
|
||||
}
|
||||
|
||||
override def save(nbt: NBTTagCompound): Unit = {
|
||||
super.save(nbt)
|
||||
nbt.setBoolean(ScrollToEndTag, logWidget.scrollToEnd)
|
||||
}
|
||||
|
||||
override def load(nbt: NBTTagCompound): Unit = {
|
||||
super.load(nbt)
|
||||
if (nbt.hasKey(ScrollToEndTag)) {
|
||||
logWidget.scrollToEnd = nbt.getBoolean(ScrollToEndTag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object OcelotInterfaceWindow {
|
||||
private val ScrollToEndTag = "scrollToEnd"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user