diff options
Diffstat (limited to 'color.go')
| -rw-r--r-- | color.go | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -1,10 +1,12 @@ package main import ( - "github.com/awesome-gocui/gocui" "math/rand" + "github.com/awesome-gocui/gocui" + "go.wit.com/log" + "go.wit.com/toolkits/tree" ) //w.v.SelBgColor = gocui.ColorCyan @@ -65,8 +67,10 @@ var colorNone colorT = colorT{none, none, none, none, none, "debug none"} // TODO: maybe enough of us could actually do that if we made it a goal. // TODO: start with riscv boards and fix it universally there // TODO: so just a small little 'todo' item here -func (n *node) setColor(newColor *colorT) { - tk := n.tk +func setColor(n *tree.Node, newColor *colorT) { + var tk *guiWidget + tk = n.TK.(*guiWidget) + if tk.color == newColor { // nothing to do since the colors have nto changed return @@ -80,15 +84,18 @@ func (n *node) setColor(newColor *colorT) { tk.color = &colorNone } log.Log(NOW, "Set the node to color =", tk.color.name) - n.recreateView() + tk.recreateView() } -func (n *node) setDefaultWidgetColor() { - n.showView() +func setDefaultWidgetColor(n *tree.Node) { + var w *guiWidget + w = n.TK.(*guiWidget) + w.showView() } -func (n *node) setDefaultHighlight() { - w := n.tk +func setDefaultHighlight(n *tree.Node) { + var w *guiWidget + w = n.TK.(*guiWidget) if w.v == nil { log.Log(ERROR, "SetColor() failed on view == nil") return @@ -104,17 +111,16 @@ func randColor() gocui.Attribute { return gocui.GetColor(colors[i]) } -func (n *node) redoColor(draw bool) { - w := n.tk +func (w *guiWidget) redoColor(draw bool) { if w == nil { return } log.Sleep(.05) - n.setDefaultHighlight() - n.setDefaultWidgetColor() + setDefaultHighlight(w.node) + setDefaultWidgetColor(w.node) - for _, child := range n.children { + for _, child := range w.children { child.redoColor(draw) } } |
