From 387b7ead6e94b745d1b0ec007df6eb392798eb77 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 7 Oct 2021 21:31:15 -0500 Subject: [PATCH] NODE: continued work on implementing a node tree Signed-off-by: Jeff Carr --- debug.go | 5 +++++ new-structs.go | 4 ++-- window-debug.go | 15 +++++++++++++++ window.go | 6 +++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/debug.go b/debug.go index 79a5fb3..d9cb9b5 100644 --- a/debug.go +++ b/debug.go @@ -122,6 +122,11 @@ func DebugDataNodeMap() { log.Println("Dumping Data.NodeMap:") for name, node := range Data.NodeMap { log.Println("\tData.NodeMap name =", node.Width, node.Height, name) + if (node.children == nil) { + log.Println("\t\tNo children") + } else { + log.Println("\t\tHas children:", node.children) + } // node.SetName("yahoo") // log.Println("\tData.NodeMap node =", node) } diff --git a/new-structs.go b/new-structs.go index a24262d..03b6b94 100644 --- a/new-structs.go +++ b/new-structs.go @@ -129,9 +129,9 @@ func (n *Node) InitTab(title string, custom func() ui.Control) *Node { os.Exit(-1) } if n.box != nil { - log.Println("gui.InitTab() ERROR box already exists") + log.Println("gui.InitTab() ERROR box already exists title =", title) n.Dump() - os.Exit(-1) + // os.Exit(-1) } tab := ui.NewTab() diff --git a/window-debug.go b/window-debug.go index 7ffcb8e..19aadad 100644 --- a/window-debug.go +++ b/window-debug.go @@ -132,10 +132,25 @@ func makeWindowDebug() ui.Control { DumpMap() }) + ///////////////////////////////////////////////////// + vbox = addGroup(hbox, "Node Debug") + + n1 := addButton(vbox, "DebugDataNodeMap()") + n1.OnClicked(func(*ui.Button) { + DebugDataNodeMap() + }) + + n2 := addButton(vbox, "DebugNodeChildren()") + n2.OnClicked(func(*ui.Button) { + DebugNodeChildren() + }) + +/* ///////////////////////////////////////////////////// vbox = addGroup(hbox, "Numbers") pbar := ui.NewProgressBar() vbox.Append(pbar, false) +*/ return hbox diff --git a/window.go b/window.go index 7370dca..3c5589c 100644 --- a/window.go +++ b/window.go @@ -55,9 +55,9 @@ func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox { var box *GuiBox if gw == nil { - box = mapWindow(nil, name, Config.Height, Config.Width) + box = mapWindow(nil, name, Config.Width, Config.Height) } else { - box = mapWindow(gw.UiWindow, name, Config.Height, Config.Width) + box = mapWindow(gw.UiWindow, name, Config.Width, Config.Height) } // box.Window = &newGuiWindow @@ -66,7 +66,7 @@ func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox { // This is the first window. One must create it here if gw == nil { log.Println("gui.initWindow() ADDING ui.NewWindow()") - n := uiNewWindow(name, Config.Height, Config.Width) + n := uiNewWindow(name, Config.Width, Config.Height) box.node = n if (n.box == nil) { n.box = box