summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.go23
-rw-r--r--new-structs.go12
-rw-r--r--window-debug.go38
3 files changed, 48 insertions, 25 deletions
diff --git a/debug.go b/debug.go
index d5273e0..9d6ad3b 100644
--- a/debug.go
+++ b/debug.go
@@ -114,14 +114,10 @@ func addTableTab() {
time.Sleep(1 * time.Second)
}
-func DebugDataNodeMap() {
- if Data.NodeMap == nil {
- log.Println("DebugDataNodeMap() NodeMap == nil")
- return
- }
+func (dn *GuiData) DumpNodeMap() {
log.Println("DebugDataNodeMap():")
- for name, node := range Data.NodeMap {
- log.Println("\tNode name =", node.Width, node.Height, name)
+ for name, node := range dn.NodeMap {
+ log.Println("\tNode =", node.id, node.Width, node.Height, name)
if (node.children == nil) {
log.Println("\t\tNo children")
} else {
@@ -173,12 +169,12 @@ func FindNode(name string) *Node {
func (dn *GuiData) ListChildren(dump bool) {
if Data.NodeMap == nil {
- log.Println("Data.NodeMap == nil")
+ log.Println("gui.Data.ListChildren() Data.NodeMap == nil")
return
}
- log.Println("Dumping Data.NodeMap:")
+ log.Println("gui.Data.ListChildren() Data.NodeMap:")
for name, node := range Data.NodeMap {
- log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
+ log.Println("\tgui.Data.ListChildren() node =", node.id, node.Width, node.Height, name)
if (dump == true) {
node.Dump()
}
@@ -188,13 +184,14 @@ func (dn *GuiData) ListChildren(dump bool) {
func (dn *GuiData) findId(id string) *Node {
if Data.NodeMap == nil {
- log.Println("Data.NodeMap == nil")
+ log.Println("gui.Data.findId() map == nil")
return nil
}
- log.Println("Dumping Data.NodeMap:")
+ // log.Println("Dumping Data.NodeMap:")
for name, node := range Data.NodeMap {
- log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
+ // log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
if (id == node.id) {
+ log.Println("\tgui.Data.findId() found node =", node.id, node.Width, node.Height, name)
return node
}
// TODO: fix // Oct 9
diff --git a/new-structs.go b/new-structs.go
index 4c24692..d5aa2fb 100644
--- a/new-structs.go
+++ b/new-structs.go
@@ -102,14 +102,16 @@ func (n *Node) List() {
func (n *Node) ListChildren(dump bool) {
log.Println("\tListChildren() node =", n.id, n.Name, n.Width, n.Height)
+ if (dump == true) {
+ n.Dump()
+ }
if len(n.children) == 0 {
if (n.parent != nil) {
log.Println("\t\t\tparent =",n.parent.id)
}
- log.Println("\t\tNo children START")
+ log.Println("\t\t", n.id, "has no children")
return
}
- // spew.Dump(n)
for _, child := range n.children {
log.Println("\t\tListChildren() child =",child.id, child.Name, child.Width, child.Height)
if (child.parent != nil) {
@@ -118,12 +120,14 @@ func (n *Node) ListChildren(dump bool) {
log.Println("\t\t\tno parent")
panic("no parent")
}
+ /*
if (dump == true) {
child.Dump()
}
+ */
if (child.children == nil) {
- log.Println("\t\t\tNo children END")
- // break
+ log.Println("\t\t", child.id, "has no children")
+ break
}
log.Println("\t\t\tHas children:", child.children)
child.ListChildren(dump)
diff --git a/window-debug.go b/window-debug.go
index 308c3ea..9b0525a 100644
--- a/window-debug.go
+++ b/window-debug.go
@@ -165,26 +165,48 @@ func makeWindowDebug() ui.Control {
/////////////////////////////////////////////////////
vbox = addGroup(hbox, "Node Debug")
- n1 := addButton(vbox, "DebugDataNodeMap()")
+ n1 := addButton(vbox, "Data.DumpNodeMap()")
n1.OnClicked(func(*ui.Button) {
- DebugDataNodeMap()
+ Data.DumpNodeMap()
})
- n2 := addButton(vbox, "DebugDataNodeChildren()")
- n2.OnClicked(func(*ui.Button) {
+ n1 = addButton(vbox, "DebugDataNodeChildren()")
+ n1.OnClicked(func(*ui.Button) {
DebugDataNodeChildren()
})
- n3 := addButton(vbox, "Node.ListChildren(false)")
- n3.OnClicked(func(*ui.Button) {
+ n1 = addButton(vbox, "Data.ListChildren(false)")
+ n1.OnClicked(func(*ui.Button) {
Data.ListChildren(false)
})
- n4 := addButton(vbox, "Node.ListChildren(true)")
- n4.OnClicked(func(*ui.Button) {
+ n1 = addButton(vbox, "Data.ListChildren(true)")
+ n1.OnClicked(func(*ui.Button) {
Data.ListChildren(true)
})
+ n1 = addButton(vbox, "Node.ListChildren(false)")
+ n1.OnClicked(func(*ui.Button) {
+ y := nodeCombo.Selected()
+ log.Println("y =", y)
+ log.Println("nodeNames[y] =", nodeNames[y])
+ node := Data.findId(nodeNames[y])
+ if (node != nil) {
+ node.ListChildren(false)
+ }
+ })
+
+ n1 = addButton(vbox, "Node.ListChildren(true)")
+ n1.OnClicked(func(*ui.Button) {
+ y := nodeCombo.Selected()
+ log.Println("y =", y)
+ log.Println("nodeNames[y] =", nodeNames[y])
+ node := Data.findId(nodeNames[y])
+ if (node != nil) {
+ node.ListChildren(true)
+ }
+ })
+
/*
/////////////////////////////////////////////////////
vbox = addGroup(hbox, "Numbers")