NODE: remove lots of deprecated code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
26fba883a7
commit
2133a00c6b
9
main.go
9
main.go
|
@ -27,15 +27,6 @@ func ExampleWindow() {
|
|||
log.Println("START gui.ExampleWindow()")
|
||||
|
||||
Config.Title = "ExampleWindow"
|
||||
/*
|
||||
node := InitWindow(nil, nil, title, 0)
|
||||
box := node.box
|
||||
window := box.Window
|
||||
log.Println("box =", box)
|
||||
log.Println("window =", window)
|
||||
*/
|
||||
node := NewWindow()
|
||||
node.AddDebugTab("jcarr Debug")
|
||||
|
||||
// window.UiWindow.Show()
|
||||
}
|
||||
|
|
3
table.go
3
table.go
|
@ -98,10 +98,7 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
|
|||
}
|
||||
|
||||
func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData) *TableData {
|
||||
// node := InitWindow(nil, gw, name, Yaxis)
|
||||
node := NewWindow()
|
||||
// node.AddDebugTab("jcarr Debug")
|
||||
|
||||
return AddTableBox(node.box, name, rowcount, parts)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,22 +12,9 @@ var names = make([]string, 100)
|
|||
var nodeNames = make([]string, 100)
|
||||
|
||||
func DebugWindow() {
|
||||
log.Println("START gui.DebugWindow()")
|
||||
|
||||
/*
|
||||
title := "WIT GUI Debug Window"
|
||||
node := InitWindow(nil, nil, title, 0)
|
||||
box := node.box
|
||||
window := box.Window
|
||||
log.Println("box =", box)
|
||||
log.Println("window =", window)
|
||||
*/
|
||||
|
||||
Config.Title = "replace InitWindow()"
|
||||
node := NewWindow()
|
||||
node.AddDebugTab("WIT GUI Debug Tab")
|
||||
|
||||
// window.UiWindow.Show()
|
||||
}
|
||||
|
||||
// TODO: remove this crap
|
||||
|
@ -191,13 +178,6 @@ func makeWindowDebug() ui.Control {
|
|||
Data.DumpNodeMap()
|
||||
})
|
||||
|
||||
/*
|
||||
n1 = addButton(vbox, "DebugDataNodeChildren()")
|
||||
n1.OnClicked(func(*ui.Button) {
|
||||
DebugDataNodeChildren()
|
||||
})
|
||||
*/
|
||||
|
||||
n1 = addButton(vbox, "Data.ListChildren(false)")
|
||||
n1.OnClicked(func(*ui.Button) {
|
||||
Data.ListChildren(false)
|
||||
|
|
169
window.go
169
window.go
|
@ -4,46 +4,11 @@ import (
|
|||
"log"
|
||||
"fmt"
|
||||
"strconv"
|
||||
// "time"
|
||||
|
||||
"github.com/andlabs/ui"
|
||||
|
||||
// import "regexp"
|
||||
|
||||
_ "github.com/andlabs/ui/winmanifest"
|
||||
)
|
||||
|
||||
/*
|
||||
func initUI(name string, callback func(*GuiBox) *GuiBox) {
|
||||
ui.Main(func() {
|
||||
log.Println("gui.initUI() inside ui.Main()")
|
||||
|
||||
node := NewWindow()
|
||||
|
||||
// node := InitWindow(nil, nil, "StartNewWindow"+name, 0)
|
||||
box := node.box
|
||||
box = callback(box)
|
||||
window := box.Window
|
||||
log.Println("StartNewWindow() box =", box)
|
||||
|
||||
window.UiWindow.Show()
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func StartNewWindow(bg bool, name string, axis int, callback func(*GuiBox) *GuiBox) {
|
||||
log.Println("StartNewWindow() ui.Main() Create a new window")
|
||||
|
||||
if bg {
|
||||
go initUI(name, callback)
|
||||
time.Sleep(500 * time.Millisecond) // this might make it more stable on windows?
|
||||
} else {
|
||||
initUI(name, callback)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||
ui.MsgBox(gw.UiWindow, msg1, msg2)
|
||||
}
|
||||
|
@ -52,140 +17,6 @@ func ErrorWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
|||
ui.MsgBoxError(gw.UiWindow, msg1, msg2)
|
||||
}
|
||||
|
||||
//
|
||||
// This creates a new 'window' (which is just a tab in the window)
|
||||
// This is this way because on Linux you can have more than one
|
||||
// actual window but that does not appear to work on the MacOS or Windows
|
||||
//
|
||||
/*
|
||||
func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
|
||||
log.Println("gui.InitWindow() START")
|
||||
|
||||
var box *GuiBox
|
||||
var node *Node
|
||||
|
||||
if gw == nil {
|
||||
node = mapWindow(parent, nil, name, Config.Width, Config.Height)
|
||||
box = node.box
|
||||
} else {
|
||||
node = mapWindow(parent, gw.UiWindow, name, Config.Width, Config.Height)
|
||||
box = node.box
|
||||
}
|
||||
|
||||
// box.Window = &newGuiWindow
|
||||
newGuiWindow := box.Window
|
||||
|
||||
// This is the first window. One must create it here
|
||||
if gw == nil {
|
||||
log.Println("gui.initWindow() ADDING ui.NewWindow()")
|
||||
node.uiNewWindow(name, Config.Width, Config.Height)
|
||||
box.node = node
|
||||
if (node.box == nil) {
|
||||
node.box = box
|
||||
}
|
||||
w := node.uiWindow
|
||||
newGuiWindow.UiWindow = w
|
||||
|
||||
f := Config.Exit
|
||||
w.OnClosing(func(*ui.Window) bool {
|
||||
if (Config.Debug) {
|
||||
log.Println("gui.InitWindow() OnClosing()")
|
||||
}
|
||||
// newGuiWindow.UiWindow.Destroy()
|
||||
if f == nil {
|
||||
ui.Quit()
|
||||
} else {
|
||||
// use a custom exit function
|
||||
f(node)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
newGuiWindow.UiTab = ui.NewTab()
|
||||
newGuiWindow.UiWindow.SetChild(newGuiWindow.UiTab)
|
||||
newGuiWindow.UiWindow.SetMargined(true)
|
||||
tmp := 0
|
||||
newGuiWindow.TabNumber = &tmp
|
||||
node.uiTab = newGuiWindow.UiTab
|
||||
} else {
|
||||
newGuiWindow.UiWindow = gw.UiWindow
|
||||
newGuiWindow.UiTab = gw.UiTab
|
||||
node.uiTab = newGuiWindow.UiTab
|
||||
}
|
||||
|
||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
||||
// Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||
|
||||
if newGuiWindow.UiTab == nil {
|
||||
tabnum := 0
|
||||
newGuiWindow.TabNumber = &tabnum
|
||||
} else {
|
||||
tabnum := newGuiWindow.UiTab.NumPages()
|
||||
newGuiWindow.TabNumber = &tabnum
|
||||
if (node.uiTab == nil) {
|
||||
node.uiTab = newGuiWindow.UiTab
|
||||
}
|
||||
}
|
||||
|
||||
Data.WindowMap[newGuiWindow.Name] = newGuiWindow
|
||||
|
||||
if (box.node == nil) {
|
||||
fn := FindNode("full initTab")
|
||||
log.Println("InitWindow() fn =", fn)
|
||||
log.Println("InitWindow() mapping node <=> box")
|
||||
box.node = fn
|
||||
if (fn.box == nil) {
|
||||
log.Println("InitWindow() mapping node <=> box")
|
||||
fn.box = box
|
||||
}
|
||||
}
|
||||
if (box.node == nil) {
|
||||
if (Config.Debug) {
|
||||
Data.ListChildren(true)
|
||||
}
|
||||
log.Println("InitWindow() box has a FUCKING nil node")
|
||||
fn := FindNode("full initTab")
|
||||
log.Println("InitWindow() fn =", fn)
|
||||
panic(-1)
|
||||
}
|
||||
|
||||
if (newGuiWindow.node == nil) {
|
||||
if (Config.Debug) {
|
||||
Data.ListChildren(true)
|
||||
}
|
||||
log.Println("InitWindow() newGuiWindow has a FUCKING nil node")
|
||||
// panic(-1)
|
||||
}
|
||||
|
||||
log.Println("InitWindow() END *GuiWindow =", newGuiWindow)
|
||||
if (box.node == nil) {
|
||||
box.Dump()
|
||||
panic(-1)
|
||||
}
|
||||
if (Config.DebugWindow) {
|
||||
box.Dump()
|
||||
box.node.Dump()
|
||||
}
|
||||
if (box.node != node) {
|
||||
log.Println("InitWindow() box.node != node. Hmmm....")
|
||||
log.Println("InitWindow() box.node != node. Hmmm....")
|
||||
log.Println("InitWindow() box.node != node. Hmmm....")
|
||||
panic(-1)
|
||||
}
|
||||
if (node.box != box) {
|
||||
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||
panic(-1)
|
||||
}
|
||||
if (node.uiTab == nil) {
|
||||
panic("node.uiTab = nil")
|
||||
}
|
||||
return node
|
||||
}
|
||||
*/
|
||||
|
||||
func DeleteWindow(name string) {
|
||||
log.Println("gui.DeleteWindow() START name =", name)
|
||||
window := Data.WindowMap[name]
|
||||
|
|
Loading…
Reference in New Issue