summaryrefslogtreecommitdiff
path: root/toolkit/gocui/debug.go
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/gocui/debug.go')
-rw-r--r--toolkit/gocui/debug.go69
1 files changed, 52 insertions, 17 deletions
diff --git a/toolkit/gocui/debug.go b/toolkit/gocui/debug.go
index e3f3586..3ea31b0 100644
--- a/toolkit/gocui/debug.go
+++ b/toolkit/gocui/debug.go
@@ -2,37 +2,72 @@ package main
import (
"fmt"
+ "git.wit.org/wit/gui/toolkit"
)
-func (w *cuiWidget) dumpTree(draw bool) {
+func (n *node) dumpTree(draw bool) {
+ w := n.tk
if (w == nil) {
return
}
- w.showWidgetPlacement(logNow, "Tree:")
+ n.showWidgetPlacement(logNow, "Tree:")
- for _, child := range w.children {
+ for _, child := range n.children {
child.dumpTree(draw)
}
}
-func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
- var s1 string
- var pId int
- if (w == nil) {
+func (n *node) showWidgetPlacement(b bool, s string) {
+ if (n == nil) {
log(logError, "WTF w == nil")
return
}
- if (w.parent == nil) {
- log(logVerbose, "showWidgetPlacement() parent == nil", w.id, w.cuiName)
+ w := n.tk
+
+ var s1 string
+ var pId int
+ if (n.parent == nil) {
+ log(logVerbose, "showWidgetPlacement() parent == nil", n.WidgetId, w.cuiName)
pId = 0
} else {
- pId = w.parent.id
+ pId = n.parent.WidgetId
+ }
+ s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", n.WidgetId, pId)
+ s1 += fmt.Sprintf("size=(%2d,%2d)(%2d,%2d,%2d,%2d)",
+ w.size.Width(), w.size.Height(),
+ w.size.w0, w.size.h0, w.size.w1, w.size.h1)
+ if n.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)
+ }
+ if (n.parent != nil) {
+ if (n.parent.WidgetType == toolkit.Grid) {
+ s1 += fmt.Sprintf("At(%2d,%2d) ", n.AtW, n.AtH)
+ }
+ }
+ log(b, s1, s, n.WidgetType, ",", n.Name) // , "text=", w.text)
+}
+
+func (n *node) dumpWidget(pad string) {
+ log(true, "node:", pad, n.WidgetId, "At(", n.AtW, n.AtH, ") ,", n.WidgetType, ",", n.Name)
+}
+
+func (n *node) listWidgets() {
+ if (n == nil) {
+ return
+ }
+
+ var pad string
+ for i := 0; i < me.depth; i++ {
+ pad = pad + " "
+ }
+ n.dumpWidget(pad)
+
+ for _, child := range n.children {
+ me.depth += 1
+ child.listWidgets()
+ me.depth -= 1
}
- s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.id, pId)
- s1 += fmt.Sprintf("s/n (%2d,%2d) (%2d,%2d) ", w.startW, w.startH, w.nextW, w.nextH)
- s1 += fmt.Sprintf("size (%2d,%2d) ", w.realWidth, w.realHeight)
- 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)
- log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
+ return
}