2023-03-29 23:03:04 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
2024-01-03 18:15:54 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-05 13:18:44 -06:00
|
|
|
"go.wit.com/gui/widget"
|
2023-03-29 23:03:04 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// This recreates the whole GUI for a plugin
|
|
|
|
|
|
|
|
// func (n *Node) ListChildren(dump bool, dropdown *Node, mapNodes map[string]*Node) {
|
2023-04-08 12:08:57 -05:00
|
|
|
func (n *Node) redraw(p *aplug) {
|
2023-03-29 23:03:04 -05:00
|
|
|
if (n == nil) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
n.redo(p)
|
|
|
|
for _, child := range n.children {
|
2023-04-08 12:08:57 -05:00
|
|
|
child.redraw(p)
|
2023-03-29 23:03:04 -05:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-08 08:40:31 -05:00
|
|
|
func (n *Node) redo(plug *aplug) {
|
2024-01-03 18:15:54 -06:00
|
|
|
log.Info("redo()", plug.name, n.id, n.WidgetType, n.Name)
|
2023-03-29 23:03:04 -05:00
|
|
|
|
2024-01-05 13:18:44 -06:00
|
|
|
var a *widget.Action
|
|
|
|
a = new(widget.Action)
|
2023-03-29 23:03:04 -05:00
|
|
|
a.Name = n.Name
|
|
|
|
a.Text = n.Text
|
2023-04-03 10:26:47 -05:00
|
|
|
|
2024-01-05 13:18:44 -06:00
|
|
|
a.ActionType = widget.Add
|
2023-03-29 23:03:04 -05:00
|
|
|
a.WidgetType = n.WidgetType
|
|
|
|
a.WidgetId = n.id
|
2023-04-03 10:26:47 -05:00
|
|
|
|
|
|
|
// used for anything that needs a range
|
|
|
|
a.X = n.X
|
|
|
|
a.Y = n.Y
|
|
|
|
|
2023-05-09 20:37:21 -05:00
|
|
|
// grid stuff
|
|
|
|
a.AtW = n.AtW
|
|
|
|
a.AtH = n.AtH
|
|
|
|
|
2023-04-03 10:26:47 -05:00
|
|
|
// used for values
|
|
|
|
a.I = n.I
|
|
|
|
a.S = n.S
|
|
|
|
a.B = n.B
|
|
|
|
|
2023-03-29 23:03:04 -05:00
|
|
|
if (n.parent == nil) {
|
|
|
|
a.ParentId = 0
|
|
|
|
} else {
|
|
|
|
a.ParentId = n.parent.id
|
|
|
|
}
|
|
|
|
|
2023-04-08 12:08:57 -05:00
|
|
|
plug.pluginChan <- *a
|
2023-04-23 16:00:38 -05:00
|
|
|
// sleep(.5)
|
2023-03-29 23:03:04 -05:00
|
|
|
}
|