DOCS: clean up variable names for node.*() functions
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
5e5df9630e
commit
e5763fa317
13
box.go
13
box.go
|
@ -73,17 +73,18 @@ func add(box *GuiBox, newbox *GuiBox) {
|
||||||
log.Println("gui.add() END")
|
log.Println("gui.add() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (parent *Node) NewBox(axis int, name string) *Node {
|
func (n *Node) NewBox(axis int, name string) *Node {
|
||||||
if (parent.box == nil) {
|
if (n.box == nil) {
|
||||||
panic("gui.Node.NewBox() parent.box == nil")
|
log.Println("box == nil. I can't add a box!")
|
||||||
|
panic("gui.Node.NewBox() node.box == nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
newBox := new(GuiBox)
|
newBox := new(GuiBox)
|
||||||
newBox.Window = parent.window
|
newBox.Window = n.window
|
||||||
newBox.Name = name
|
newBox.Name = name
|
||||||
|
|
||||||
// make a new box & a new node
|
// make a new box & a new node
|
||||||
newNode := parent.makeNode(name, 111, 100 + Config.counter)
|
newNode := n.makeNode(name, 111, 100 + Config.counter)
|
||||||
Config.counter += 1
|
Config.counter += 1
|
||||||
|
|
||||||
var uiBox *ui.Box
|
var uiBox *ui.Box
|
||||||
|
@ -96,7 +97,7 @@ func (parent *Node) NewBox(axis int, name string) *Node {
|
||||||
newBox.UiBox = uiBox
|
newBox.UiBox = uiBox
|
||||||
newNode.uiBox = uiBox
|
newNode.uiBox = uiBox
|
||||||
|
|
||||||
parent.Append(newNode)
|
n.Append(newNode)
|
||||||
// add(n.box, newBox)
|
// add(n.box, newBox)
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,54 +198,37 @@ func (n *Node) ListChildren(dump bool) {
|
||||||
//
|
//
|
||||||
// This function should make a new node with the parent and
|
// This function should make a new node with the parent and
|
||||||
// the 'stuff' Node as a child
|
// the 'stuff' Node as a child
|
||||||
func (parent *Node) AddTabNode(title string, b *GuiBox) *Node {
|
func (n *Node) AddTabNode(title string, b *GuiBox) *Node {
|
||||||
// Ybox := gui.NewBox(box, gui.Yaxis, "Working Stuff")
|
|
||||||
// var baseControl ui.Control
|
|
||||||
// baseControl = Ybox.UiBox
|
|
||||||
// return baseControl
|
|
||||||
|
|
||||||
var newNode *Node
|
var newNode *Node
|
||||||
// var newControl ui.Control
|
parent := n
|
||||||
|
|
||||||
/*
|
|
||||||
if (parent.box == nil) {
|
|
||||||
// TODO: fix this to use a blank box
|
|
||||||
// uiC := parent.initBlankWindow()
|
|
||||||
hbox := ui.NewHorizontalBox()
|
|
||||||
hbox.SetPadded(true)
|
|
||||||
newNode.uiBox = hbox
|
|
||||||
panic("node.AddTabNode() can not add a tab if the box == nil")
|
|
||||||
}
|
|
||||||
if (parent.uiTab == nil) {
|
|
||||||
panic("node.AddTabNode() can not add a tab if parent.uiTab == nil")
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
newNode = parent.makeNode(title, 444, 400 + Config.counter)
|
newNode = parent.makeNode(title, 444, 400 + Config.counter)
|
||||||
newNode.uiTab = parent.uiTab
|
newNode.uiTab = parent.uiTab
|
||||||
newNode.box = b
|
newNode.box = b
|
||||||
|
|
||||||
/*
|
if (Config.DebugNode) {
|
||||||
newControl = b.UiBox
|
fmt.Println("")
|
||||||
newNode.uiTab.Append(title, newControl)
|
log.Println("parent:")
|
||||||
*/
|
parent.Dump()
|
||||||
|
|
||||||
|
fmt.Println("")
|
||||||
|
log.Println("newNode:")
|
||||||
|
newNode.Dump()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newNode.uiTab == nil) {
|
||||||
|
log.Println("wit/gui/ AddTabNode() Something went wrong tab == nil")
|
||||||
|
// TODO: try to find the tab or window and make them if need be
|
||||||
|
return newNode
|
||||||
|
}
|
||||||
newNode.uiTab.Append(title, b.UiBox)
|
newNode.uiTab.Append(title, b.UiBox)
|
||||||
|
|
||||||
fmt.Println("")
|
|
||||||
log.Println("parent:")
|
|
||||||
parent.Dump()
|
|
||||||
|
|
||||||
fmt.Println("")
|
|
||||||
log.Println("newNode:")
|
|
||||||
newNode.Dump()
|
|
||||||
|
|
||||||
// panic("node.AddTabNode()")
|
|
||||||
|
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
||||||
// func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
|
// func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
|
||||||
func (parent *Node) AddTab(title string, uiC *ui.Box) *Node {
|
func (n *Node) AddTab(title string, uiC *ui.Box) *Node {
|
||||||
|
parent := n
|
||||||
log.Println("gui.Node.AddTab() START name =", title)
|
log.Println("gui.Node.AddTab() START name =", title)
|
||||||
if parent.uiWindow == nil {
|
if parent.uiWindow == nil {
|
||||||
parent.Dump()
|
parent.Dump()
|
||||||
|
@ -275,7 +258,6 @@ func (parent *Node) AddTab(title string, uiC *ui.Box) *Node {
|
||||||
}
|
}
|
||||||
tab.Append(title, uiC)
|
tab.Append(title, uiC)
|
||||||
|
|
||||||
// panic("gui.AddTab() before makeNode()")
|
|
||||||
newNode := parent.makeNode(title, 555, 600 + Config.counter)
|
newNode := parent.makeNode(title, 555, 600 + Config.counter)
|
||||||
newNode.uiTab = tab
|
newNode.uiTab = tab
|
||||||
newNode.uiBox = uiC
|
newNode.uiBox = uiC
|
||||||
|
|
10
window.go
10
window.go
|
@ -147,18 +147,18 @@ func (parent *Node) makeNode(title string, x int, y int) *Node {
|
||||||
return &node
|
return &node
|
||||||
}
|
}
|
||||||
|
|
||||||
func (parent *Node) AddNode(title string) *Node {
|
func (n *Node) AddNode(title string) *Node {
|
||||||
var node Node
|
var node Node
|
||||||
node.Name = title
|
node.Name = title
|
||||||
node.Width = parent.Width
|
node.Width = n.Width
|
||||||
node.Height = parent.Height
|
node.Height = n.Height
|
||||||
|
|
||||||
id := Config.prefix + strconv.Itoa(Config.counter)
|
id := Config.prefix + strconv.Itoa(Config.counter)
|
||||||
Config.counter += 1
|
Config.counter += 1
|
||||||
node.id = id
|
node.id = id
|
||||||
|
|
||||||
parent.Append(&node)
|
n.Append(&node)
|
||||||
node.parent = parent
|
node.parent = n
|
||||||
return &node
|
return &node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue