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
|
||||||
|
|
||||||
|
|
36
debug.go
36
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,10 +20,33 @@ func WatchGUI() {
|
||||||
for {
|
for {
|
||||||
if (count > 20) {
|
if (count > 20) {
|
||||||
log.Println("Sleep() in watchGUI()")
|
log.Println("Sleep() in watchGUI()")
|
||||||
|
if (Config.Debug) {
|
||||||
|
DumpBoxes()
|
||||||
|
}
|
||||||
|
count = 0
|
||||||
|
}
|
||||||
|
count += 1
|
||||||
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
for i, window := range Data.Windows {
|
||||||
log.Println("watchGUI() Data.Windows", i, "Name =", window.Name)
|
log.Println("gui.DumpBoxes() Data.Windows", i, "Name =", window.Name)
|
||||||
for name, abox := range window.BoxMap {
|
for name, abox := range window.BoxMap {
|
||||||
log.Printf("\twatchGUI() BOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||||
/*
|
/*
|
||||||
if (name == "DEBUG") {
|
if (name == "DEBUG") {
|
||||||
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
|
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
|
||||||
|
@ -39,11 +62,6 @@ func WatchGUI() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count = 0
|
|
||||||
}
|
|
||||||
count += 1
|
|
||||||
time.Sleep(200 * time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func addTableTab() {
|
func addTableTab() {
|
||||||
|
|
27
gui.go
27
gui.go
|
@ -12,26 +12,36 @@ 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