summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.go7
-rw-r--r--gui.go14
-rw-r--r--structs.go1
3 files changed, 18 insertions, 4 deletions
diff --git a/debug.go b/debug.go
index 9d862bc..89ac686 100644
--- a/debug.go
+++ b/debug.go
@@ -31,10 +31,13 @@ func WatchGUI() {
}
func DumpBoxes() {
+ for name, window := range Data.WindowMap {
+ log.Println("gui.DumpBoxes() Data.WindowMap name =", name, "Window.Name =", window.Name)
+ }
for i, window := range Data.Windows {
- log.Println("watchGUI() Data.Windows", i, "Name =", window.Name)
+ log.Println("gui.DumpBoxes() Data.Windows", i, "Name =", window.Name)
for name, abox := range window.BoxMap {
- log.Printf("\twatchGUI() BOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
+ log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
/*
if (name == "DEBUG") {
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
diff --git a/gui.go b/gui.go
index e54517c..ef1ff49 100644
--- a/gui.go
+++ b/gui.go
@@ -12,6 +12,8 @@ const Yaxis = 1 // box that is vertical
func GuiInit() {
Data.buttonMap = make(map[*ui.Button]*GuiButton)
+ Data.WindowMap = make(map[string]*GuiWindow)
+
ui.OnShouldQuit(func() bool {
ui.Quit()
return true
@@ -29,8 +31,16 @@ func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow {
newGuiWindow.UiTab = gw.UiTab
newGuiWindow.BoxMap = make(map[string]*GuiBox)
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
- newGuiWindow.EntryMap["test"] = nil
- Data.Windows = append(Data.Windows, &newGuiWindow)
+ Data.Windows = append(Data.Windows, &newGuiWindow)
+
+ if (Data.WindowMap == nil) {
+ log.Println("gui.InitGuiWindow() making the Data.WindowMap here")
+ Data.WindowMap = make(map[string]*GuiWindow)
+ }
+ Data.WindowMap[name] = &newGuiWindow
+
+ // make a blank entry for testing
+ // newGuiWindow.EntryMap["test"] = nil
if (Data.buttonMap == nil) {
GuiInit()
diff --git a/structs.go b/structs.go
index a074e56..aae0b7f 100644
--- a/structs.go
+++ b/structs.go
@@ -29,6 +29,7 @@ type GuiData struct {
// A map of all the entry boxes
AllEntries []*GuiEntry
Windows []*GuiWindow
+ WindowMap map[string]*GuiWindow
// A map of all buttons everywhere on all
// windows, all tabs, across all goroutines