summaryrefslogtreecommitdiff
path: root/debug.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-28 02:20:31 -0600
committerJeff Carr <[email protected]>2024-01-28 02:20:31 -0600
commit4fbbd2cee13546dbe570509e2c2e0755225a1489 (patch)
tree8e5c8238e0b28b2a03b682789095b5f61b72b3c5 /debug.go
parenta9913b70edec4cf4e5bf51dadebfb64c87085fd6 (diff)
large refactor to use the tree package
Things build and now need to be fixed treeRoot has no children lists all widgets works shows help module loads Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'debug.go')
-rw-r--r--debug.go50
1 files changed, 30 insertions, 20 deletions
diff --git a/debug.go b/debug.go
index c7888c0..0ff8e1d 100644
--- a/debug.go
+++ b/debug.go
@@ -2,59 +2,68 @@ package main
import (
"fmt"
+
"go.wit.com/log"
+ "go.wit.com/toolkits/tree"
"go.wit.com/widget"
)
-func (n *node) dumpTree(draw bool) {
- w := n.tk
+func dumpTree(n *tree.Node, draw bool) {
+ w := n.TK.(*guiWidget)
+ log.Log(ERROR, "dumpTree n", n.WidgetId, n.WidgetType, n.String())
if w == nil {
+ log.Log(ERROR, "dumpTree n.TK == nil", n.WidgetId, n.WidgetType, n.String())
return
}
- n.showWidgetPlacement(true, "dumpTree()")
+ showWidgetPlacement(n, true, "dumpTree()")
- for _, child := range n.children {
- child.dumpTree(draw)
+ for _, child := range w.children {
+ dumpTree(child.node, draw)
}
}
-func (n *node) showWidgetPlacement(b bool, s string) {
+func showWidgetPlacement(n *tree.Node, b bool, s string) {
if n == nil {
log.Log(ERROR, "WTF w == nil")
return
}
- w := n.tk
+ w := n.TK.(*guiWidget)
+ w.showWidgetPlacement(b, s)
+}
+func (w *guiWidget) showWidgetPlacement(b bool, s string) {
var s1 string
var pId int
- if n.parent == nil {
- log.Log(INFO, "showWidgetPlacement() parent == nil", n.WidgetId, w.cuiName)
+ if w.node.Parent == nil {
+ log.Log(INFO, "showWidgetPlacement() parent == nil", w.node.WidgetId, w.cuiName)
pId = 0
} else {
- pId = n.parent.WidgetId
+ pId = w.node.Parent.WidgetId
}
- s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", n.WidgetId, pId)
- if n.Visible() {
+ s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId)
+ if w.Visible() {
s1 += fmt.Sprintf("gocui=(%2d,%2d)(%2d,%2d,%2d,%2d)",
w.gocuiSize.Width(), w.gocuiSize.Height(),
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
} else {
s1 += fmt.Sprintf(" ")
}
- if n.parent != nil {
- if n.parent.WidgetType == widget.Grid {
- s1 += fmt.Sprintf("At(%2d,%2d) ", n.AtW, n.AtH)
+ if w.node.Parent != nil {
+ if w.node.Parent.WidgetType == widget.Grid {
+ s1 += fmt.Sprintf("At(%2d,%2d) ", w.AtW, w.AtH)
}
}
- tmp := "." + n.progname + "."
- log.Log(INFO, s1, s, n.WidgetType, ",", tmp) // , "text=", w.text)
+ tmp := "." + w.String() + "."
+ log.Log(INFO, s1, s, w.node.WidgetType, ",", tmp) // , "text=", w.text)
}
-func (n *node) dumpWidget(pad string) {
+/*
+func dumpWidget(n *tree.Node, pad string) {
log.Log(NOW, "node:", pad, n.WidgetId, "At(", n.AtW, n.AtH, ") ,", n.WidgetType, ", n.progname =", n.progname, ", n.label =", n.label)
}
-
-func (n *node) listWidgets() {
+*/
+/*
+func listWidgets(n *tree.Node) {
if n == nil {
return
}
@@ -72,3 +81,4 @@ func (n *node) listWidgets() {
}
return
}
+*/