summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--structs.go49
-rw-r--r--window-debug.go48
2 files changed, 48 insertions, 49 deletions
diff --git a/structs.go b/structs.go
index dca855f..8833dd5 100644
--- a/structs.go
+++ b/structs.go
@@ -188,55 +188,6 @@ func (s GuiBox) Append(child ui.Control, x bool) {
s.UiBox.Append(child, x)
}
-/*
-func (s *GuiBox) AddTab(title string, custom ui.Control) *ui.Tab {
- if s.Window == nil {
- return nil
- }
- if s.Window.UiTab == nil {
- return nil
- }
-
- tab := s.Window.UiTab
- tab.Append(title, custom)
- return tab
-}
-*/
-
-/*
-func (s GuiBox) AddBoxTab(title string) *GuiBox {
- uiTab := s.AddTab(title, initBlankWindow())
- tabSetMargined(uiTab)
-
- var box *GuiBox
- box = HardBox(s.Window, Xaxis, "jcarrAddBoxTab")
- box.Window.UiTab = uiTab
- return box
-}
-*/
-
-func (n *Node) AddDemoTab(title string) {
- newNode := n.AddTab(title, makeWindowTemplate())
- newNode.Dump()
- tabSetMargined(newNode.uiTab)
-}
-
-func (n *Node) AddDebugTab(title string) {
- newNode := n.AddTab(title, makeWindowDebug())
- newNode.Dump()
- tabSetMargined(newNode.uiTab)
-}
-
-func tabSetMargined(tab *ui.Tab) {
- log.Println("tabSetMargined() IGNORE THIS")
- return
- c := tab.NumPages()
- for i := 0; i < c; i++ {
- log.Println("tabSetMargined() i =", i)
- // tab.SetMargined(i, true)
- }
-}
-
// Note: every mouse click is handled
// as a 'Button' regardless of where
// the user clicks it. You could probably
diff --git a/window-debug.go b/window-debug.go
index de4b31b..ef457aa 100644
--- a/window-debug.go
+++ b/window-debug.go
@@ -12,6 +12,8 @@ var names = make([]string, 100)
var nodeNames = make([]string, 100)
// TODO: remove this crap
+// What does this actually do?
+// It populates the nodeNames in a map. No, not a map, an array. What is the difference again?
func addNodeName(c *ui.Combobox, s string) {
c.Append(s)
nodeNames[y] = s
@@ -220,6 +222,28 @@ func makeWindowDebug() ui.Control {
}
})
+ n1 = addButton(vbox, "Node.AddDebugTab")
+ 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.AddDebugTab("added this DebugTab")
+ }
+ })
+
+ n1 = addButton(vbox, "Node.DemoTab")
+ 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.AddDemoTab("added this DemoTab")
+ }
+ })
+
/*
/////////////////////////////////////////////////////
vbox = addGroup(hbox, "Numbers")
@@ -331,3 +355,27 @@ func addButton(box *ui.Box, name string) *ui.Button {
box.Append(button, false)
return button
}
+
+func (n *Node) AddDemoTab(title string) {
+ newNode := n.AddTab(title, makeWindowTemplate())
+ newNode.Dump()
+ tabSetMargined(newNode.uiTab)
+}
+
+func (n *Node) AddDebugTab(title string) {
+ newNode := n.AddTab(title, makeWindowDebug())
+ newNode.Dump()
+ tabSetMargined(newNode.uiTab)
+}
+
+// This sets _all_ the tabs to Margin = true
+//
+// TODO: do proper tab tracking (will be complicated). low priority
+func tabSetMargined(tab *ui.Tab) {
+ log.Println("tabSetMargined() IGNORE THIS")
+ c := tab.NumPages()
+ for i := 0; i < c; i++ {
+ log.Println("tabSetMargined() i =", i)
+ tab.SetMargined(i, true)
+ }
+}