CLEAN: more code removals
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
db6c60decc
commit
51d324e805
|
@ -33,57 +33,6 @@ func makeWindowDebug() *ui.Box {
|
|||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
||||
/*
|
||||
/////////////////////////////////////////////////////
|
||||
vbox := addGroup(hbox, "range Data.WindowMap")
|
||||
cbox := ui.NewCombobox()
|
||||
|
||||
for name, _ := range Data.WindowMap {
|
||||
if (Config.Debug) {
|
||||
log.Println("range Data.WindowMap() name =", name)
|
||||
}
|
||||
addName(cbox, name)
|
||||
}
|
||||
cbox.SetSelected(0)
|
||||
vbox.Append(cbox, false)
|
||||
|
||||
cbox.OnSelected(func(*ui.Combobox) {
|
||||
x := cbox.Selected()
|
||||
log.Println("x =", x)
|
||||
log.Println("names[x] =", names[x])
|
||||
dumpBox(names[x])
|
||||
})
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
vbox = addGroup(hbox, "Debug Window")
|
||||
|
||||
b1 := addButton(vbox, "dumpBox(window)")
|
||||
b1.OnClicked(func(*ui.Button) {
|
||||
x := cbox.Selected()
|
||||
log.Println("x =", x)
|
||||
log.Println("names[x] =", names[x])
|
||||
dumpBox(names[x])
|
||||
})
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
vbox = addGroup(hbox, "Global Debug")
|
||||
|
||||
dump3 := addButton(vbox, "Dump Windows")
|
||||
dump3.OnClicked(func(*ui.Button) {
|
||||
DumpWindows()
|
||||
})
|
||||
|
||||
dump2 := addButton(vbox, "Dump Boxes")
|
||||
dump2.OnClicked(func(*ui.Button) {
|
||||
DumpBoxes()
|
||||
})
|
||||
|
||||
dump1 := addButton(vbox, "Dump MAP")
|
||||
dump1.OnClicked(func(*ui.Button) {
|
||||
DumpMap()
|
||||
})
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
nodeBox := addGroup(hbox, "Windows:")
|
||||
nodeCombo := ui.NewCombobox()
|
||||
|
@ -208,38 +157,6 @@ func addGroup(b *ui.Box, name string) *ui.Box {
|
|||
return vbox
|
||||
}
|
||||
|
||||
/*
|
||||
func dumpBox(s string) {
|
||||
var name string
|
||||
var window *GuiWindow
|
||||
|
||||
for name, window = range Data.WindowMap {
|
||||
if name != s {
|
||||
continue
|
||||
}
|
||||
log.Println("gui.DumpBoxes() MAP: ", name)
|
||||
if window.TabNumber == nil {
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber = nil")
|
||||
} else {
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber =", *window.TabNumber)
|
||||
}
|
||||
log.Println("gui.DumpBoxes()\tWindow.name =", window.Name)
|
||||
// log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow))
|
||||
log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow)
|
||||
log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
||||
if window.UiTab != nil {
|
||||
pages := window.UiTab.NumPages()
|
||||
log.Println("gui.DumpBoxes()\tWindow.UiTab.NumPages() =", pages)
|
||||
tabSetMargined(window.UiTab)
|
||||
if Config.Debug {
|
||||
scs := spew.ConfigState{MaxDepth: 2}
|
||||
scs.Dump(window.UiTab)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func addButton(box *ui.Box, name string) *ui.Button {
|
||||
button := ui.NewButton(name)
|
||||
|
||||
|
|
6
find.go
6
find.go
|
@ -17,12 +17,6 @@ func (n *Node) FindControl() *ui.Control {
|
|||
return n.uiControl
|
||||
}
|
||||
|
||||
/*
|
||||
func (w *GuiWindow) FindNode() *Node {
|
||||
return w.node
|
||||
}
|
||||
*/
|
||||
|
||||
func FindNode(name string) *Node {
|
||||
if Data.NodeMap == nil {
|
||||
log.Println("gui.FindNode() gui.Data.NodeMap == nil")
|
||||
|
|
1
gui.go
1
gui.go
|
@ -17,7 +17,6 @@ func init() {
|
|||
log.Println("gui.init() has been run")
|
||||
|
||||
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
||||
// Data.WindowMap = make(map[string]*GuiWindow)
|
||||
Data.NodeMap = make(map[string]*Node)
|
||||
|
||||
Data.NodeSlice = make([]*Node, 0)
|
||||
|
|
|
@ -49,7 +49,6 @@ type Node struct {
|
|||
parent *Node
|
||||
children []*Node
|
||||
|
||||
// window *GuiWindow
|
||||
area *GuiArea
|
||||
custom func(*Node)
|
||||
|
||||
|
|
59
structs.go
59
structs.go
|
@ -65,65 +65,6 @@ type GuiTab struct {
|
|||
// Window *GuiWindow // the parent Window
|
||||
}
|
||||
|
||||
//
|
||||
// stores information on the 'window'
|
||||
//
|
||||
// This merges the concept of andlabs/ui *Window and *Tab
|
||||
//
|
||||
// More than one Window is not supported in a cross platform
|
||||
// sense & may never be. On Windows and MacOS, you have to have
|
||||
// 'tabs'. Even under Linux, more than one Window is currently
|
||||
// unstable
|
||||
//
|
||||
// This code will make a 'GuiWindow' regardless of if it is
|
||||
// a stand alone window (which is more or less working on Linux)
|
||||
// or a 'tab' inside a window (which is all that works on MacOS
|
||||
// and MSWindows.
|
||||
//
|
||||
// This struct keeps track of what is in the window so you
|
||||
// can destroy and replace it with something else
|
||||
//
|
||||
/*
|
||||
type GuiWindow struct {
|
||||
Name string // field for human readable name
|
||||
Width int
|
||||
Height int
|
||||
Axis int // does it add items to the X or Y axis
|
||||
TabNumber *int // the andlabs/ui tab index
|
||||
|
||||
// the components of the window
|
||||
EntryMap map[string]*GuiEntry
|
||||
Area *GuiArea
|
||||
|
||||
node *Node
|
||||
|
||||
// andlabs/ui abstraction mapping
|
||||
UiWindow *ui.Window
|
||||
UiTab *ui.Tab // if this != nil, the window is 'tabbed'
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func (w *GuiWindow) Dump() {
|
||||
log.Println("gui.GuiWindow.Dump() Name = ", w.Name)
|
||||
log.Println("gui.GuiWindow.Dump() node = ", w.node)
|
||||
log.Println("gui.GuiWindow.Dump() Width = ", w.Width)
|
||||
log.Println("gui.GuiWindow.Dump() Height = ", w.Height)
|
||||
}
|
||||
|
||||
func (w *GuiWindow) SetNode(n *Node) {
|
||||
if (w.node != nil) {
|
||||
w.Dump()
|
||||
panic("gui.SetNode() Error not nil")
|
||||
}
|
||||
w.node = n
|
||||
if (w.node == nil) {
|
||||
w.Dump()
|
||||
panic("gui.SetNode() node == nil")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Note: every mouse click is handled
|
||||
// as a 'Button' regardless of where
|
||||
// the user clicks it. You could probably
|
||||
|
|
37
window.go
37
window.go
|
@ -21,43 +21,6 @@ func (n *Node) ErrorWindow2(msg1 string, msg2 string) (*Node) {
|
|||
return n
|
||||
}
|
||||
|
||||
/*
|
||||
func DeleteWindow(name string) {
|
||||
log.Println("gui.DeleteWindow() START name =", name)
|
||||
window := Data.WindowMap[name]
|
||||
if window == nil {
|
||||
log.Println("gui.DeleteWindow() NO WINDOW WITH name =", name)
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("gui.DumpBoxes() MAP: ", name)
|
||||
log.Println("gui.DumpBoxes()\tWindow.name =", window.Name)
|
||||
if window.TabNumber == nil {
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber = nil")
|
||||
}
|
||||
tab := *window.TabNumber
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber =", tab)
|
||||
log.Println("gui.DumpBoxes() \tSHOULD DELETE TAB", tab, "HERE")
|
||||
window.UiTab.Delete(tab)
|
||||
delete(Data.WindowMap, name)
|
||||
|
||||
// renumber tabs here
|
||||
for name, window := range Data.WindowMap {
|
||||
log.Println("gui.DumpBoxes() MAP: ", name)
|
||||
if window.TabNumber == nil {
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber = nil")
|
||||
} else {
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber =", *window.TabNumber)
|
||||
if tab < *window.TabNumber {
|
||||
log.Println("gui.DumpBoxes() \tSubtracting 1 from TabNumber")
|
||||
*window.TabNumber -= 1
|
||||
log.Println("gui.DumpBoxes() \tWindows.TabNumber is now =", *window.TabNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func makeNode(parent *Node, title string, x int, y int) *Node {
|
||||
var node Node
|
||||
node.Name = title
|
||||
|
|
Loading…
Reference in New Issue