Merge branch 'master' into devel
This commit is contained in:
commit
bc37f5c4a2
4
area.go
4
area.go
|
@ -107,7 +107,7 @@ func (ah GuiArea) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString, custom func(*GuiButton)) *GuiBox {
|
func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString, custom func(*GuiButton), name string) *GuiBox {
|
||||||
log.Println("ShowTextBox() START")
|
log.Println("ShowTextBox() START")
|
||||||
if (gw == nil) {
|
if (gw == nil) {
|
||||||
log.Println("ShowTextBox() ERROR gw = nil")
|
log.Println("ShowTextBox() ERROR gw = nil")
|
||||||
|
@ -118,7 +118,7 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString, custom func(*GuiBu
|
||||||
var newbox *GuiBox
|
var newbox *GuiBox
|
||||||
newbox = new(GuiBox)
|
newbox = new(GuiBox)
|
||||||
newbox.Window = gw
|
newbox.Window = gw
|
||||||
newbox.Name = "Hbox1"
|
newbox.Name = name
|
||||||
hbox := ui.NewVerticalBox()
|
hbox := ui.NewVerticalBox()
|
||||||
newbox.UiBox = hbox
|
newbox.UiBox = hbox
|
||||||
|
|
||||||
|
|
58
debug.go
58
debug.go
|
@ -3,11 +3,11 @@ package gui
|
||||||
import "log"
|
import "log"
|
||||||
import "time"
|
import "time"
|
||||||
import "fmt"
|
import "fmt"
|
||||||
// import "reflect"
|
import "reflect"
|
||||||
|
|
||||||
// import "github.com/andlabs/ui"
|
// import "github.com/andlabs/ui"
|
||||||
// import _ "github.com/andlabs/ui/winmanifest"
|
// import _ "github.com/andlabs/ui/winmanifest"
|
||||||
// import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
// import pb "git.wit.com/wit/witProtobuf"
|
// import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -20,24 +20,8 @@ func WatchGUI() {
|
||||||
for {
|
for {
|
||||||
if (count > 20) {
|
if (count > 20) {
|
||||||
log.Println("Sleep() in watchGUI()")
|
log.Println("Sleep() in watchGUI()")
|
||||||
for i, window := range Data.Windows {
|
if (Config.Debug) {
|
||||||
log.Println("watchGUI() Data.Windows", i, "Name =", window.Name)
|
DumpBoxes()
|
||||||
for name, abox := range window.BoxMap {
|
|
||||||
log.Printf("\twatchGUI() BOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
|
||||||
/*
|
|
||||||
if (name == "DEBUG") {
|
|
||||||
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
|
|
||||||
win := abox.Window
|
|
||||||
log.Println("\t\twatchGUI() BOX win =", reflect.TypeOf(win))
|
|
||||||
area := win.Area
|
|
||||||
log.Println("\t\twatchGUI() BOX area =", reflect.TypeOf(area), area.UiArea)
|
|
||||||
// spew.Dump(area.UiArea)
|
|
||||||
// area.UiArea.Show()
|
|
||||||
// time.Sleep(2000 * time.Millisecond)
|
|
||||||
// os.Exit(0)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
count = 0
|
count = 0
|
||||||
}
|
}
|
||||||
|
@ -46,6 +30,40 @@ func WatchGUI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DumpBoxes() {
|
||||||
|
for name, window := range Data.WindowMap {
|
||||||
|
log.Println("gui.DumpBoxes()", name)
|
||||||
|
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)
|
||||||
|
if (window.UiTab != nil) {
|
||||||
|
log.Println("gui.DumpBoxes()\tWindow.UiTab type =", reflect.TypeOf(window.UiTab))
|
||||||
|
log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
||||||
|
log.Println("gui.DumpBoxes()\tWindow.UiTab.NumPages() =", window.UiTab.NumPages())
|
||||||
|
spew.Dump(window.UiTab)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i, window := range Data.Windows {
|
||||||
|
log.Println("gui.DumpBoxes() Data.Windows", i, "Name =", window.Name)
|
||||||
|
for name, abox := range window.BoxMap {
|
||||||
|
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))
|
||||||
|
win := abox.Window
|
||||||
|
log.Println("\t\twatchGUI() BOX win =", reflect.TypeOf(win))
|
||||||
|
area := win.Area
|
||||||
|
log.Println("\t\twatchGUI() BOX area =", reflect.TypeOf(area), area.UiArea)
|
||||||
|
// spew.Dump(area.UiArea)
|
||||||
|
// area.UiArea.Show()
|
||||||
|
// time.Sleep(2000 * time.Millisecond)
|
||||||
|
// os.Exit(0)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func addTableTab() {
|
func addTableTab() {
|
||||||
var parts []TableColumnData
|
var parts []TableColumnData
|
||||||
|
|
||||||
|
|
29
gui.go
29
gui.go
|
@ -12,25 +12,35 @@ const Yaxis = 1 // box that is vertical
|
||||||
|
|
||||||
func GuiInit() {
|
func GuiInit() {
|
||||||
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
||||||
|
Data.WindowMap = make(map[string]*GuiWindow)
|
||||||
|
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
ui.Quit()
|
ui.Quit()
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
|
func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow {
|
||||||
log.Println("InitGuiWindow() START")
|
log.Println("InitGuiWindow() START")
|
||||||
var newGuiWindow GuiWindow
|
var newGuiWindow GuiWindow
|
||||||
newGuiWindow.Width = Config.Width
|
newGuiWindow.Width = Config.Width
|
||||||
newGuiWindow.Height = Config.Height
|
newGuiWindow.Height = Config.Height
|
||||||
// newGuiWindow.Action = action
|
newGuiWindow.Name = name
|
||||||
newGuiWindow.MakeWindow = gw.MakeWindow
|
newGuiWindow.MakeWindow = gw.MakeWindow
|
||||||
newGuiWindow.UiWindow = gw.UiWindow
|
newGuiWindow.UiWindow = gw.UiWindow
|
||||||
newGuiWindow.UiTab = gw.UiTab
|
newGuiWindow.UiTab = gw.UiTab
|
||||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||||
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
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) {
|
if (Data.buttonMap == nil) {
|
||||||
GuiInit()
|
GuiInit()
|
||||||
|
@ -40,12 +50,11 @@ func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) {
|
func StartNewWindow(bg bool, name string, callback func(*GuiWindow) *GuiBox) {
|
||||||
log.Println("StartNewWindow() Create a new window")
|
log.Println("StartNewWindow() Create a new window")
|
||||||
var junk GuiWindow
|
var junk GuiWindow
|
||||||
junk.MakeWindow = callback
|
junk.MakeWindow = callback
|
||||||
// junk.Action = action
|
window := InitGuiWindow(name, &junk)
|
||||||
window := InitGuiWindow(action, &junk)
|
|
||||||
if (bg) {
|
if (bg) {
|
||||||
log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()")
|
log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()")
|
||||||
go ui.Main(func() {
|
go ui.Main(func() {
|
||||||
|
@ -65,7 +74,7 @@ func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) {
|
||||||
func InitTabWindow(gw *GuiWindow) {
|
func InitTabWindow(gw *GuiWindow) {
|
||||||
log.Println("InitTabWindow() START. THIS WINDOW IS NOT YET SHOWN")
|
log.Println("InitTabWindow() START. THIS WINDOW IS NOT YET SHOWN")
|
||||||
|
|
||||||
gw.UiWindow = ui.NewWindow("InitTabWindow()", int(gw.Width), int(gw.Height), true)
|
gw.UiWindow = ui.NewWindow(gw.Name, int(gw.Width), int(gw.Height), true)
|
||||||
gw.UiWindow.SetBorderless(false)
|
gw.UiWindow.SetBorderless(false)
|
||||||
|
|
||||||
gw.UiWindow.OnClosing(func(*ui.Window) bool {
|
gw.UiWindow.OnClosing(func(*ui.Window) bool {
|
||||||
|
@ -120,9 +129,13 @@ func normalizeInt(s string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||||
|
log.Println("gui.MessageWindow() msg1 =", msg1)
|
||||||
|
log.Println("gui.MessageWindow() msg2 =", msg2)
|
||||||
ui.MsgBox(gw.UiWindow, msg1, msg2)
|
ui.MsgBox(gw.UiWindow, msg1, msg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ErrorWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
func ErrorWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||||
|
log.Println("gui.ErrorWindow() msg1 =", msg1)
|
||||||
|
log.Println("gui.ErrorWindow() msg2 =", msg2)
|
||||||
ui.MsgBoxError(gw.UiWindow, msg1, msg2)
|
ui.MsgBoxError(gw.UiWindow, msg1, msg2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ type GuiData struct {
|
||||||
// A map of all the entry boxes
|
// A map of all the entry boxes
|
||||||
AllEntries []*GuiEntry
|
AllEntries []*GuiEntry
|
||||||
Windows []*GuiWindow
|
Windows []*GuiWindow
|
||||||
|
WindowMap map[string]*GuiWindow
|
||||||
|
|
||||||
// A map of all buttons everywhere on all
|
// A map of all buttons everywhere on all
|
||||||
// windows, all tabs, across all goroutines
|
// windows, all tabs, across all goroutines
|
||||||
|
|
Loading…
Reference in New Issue