builds and works again

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-01 15:38:47 -07:00
parent f85cb5c0f0
commit c9d46e1905
3 changed files with 39 additions and 24 deletions

21
gui.go
View File

@ -303,30 +303,39 @@ func AddEntry(box *GuiBox, name string) *GuiEntry {
func HardHorizontalBreak(box *GuiBox) { func HardHorizontalBreak(box *GuiBox) {
log.Println("HardHorizontalBreak START") log.Println("HardHorizontalBreak START")
gw := box.Window gw := box.Window
mainbox := gw.mainbox mainbox := gw.BoxMap["MAIN"]
if (mainbox == nil) {
log.Println("HardHorizontalBreak ERROR MAIN box == nil")
return
}
uibox := mainbox.UiBox
tmp := ui.NewHorizontalSeparator() tmp := ui.NewHorizontalSeparator()
mainbox.Append(tmp, false) uibox.Append(tmp, false)
hbox := ui.NewVerticalBox() hbox := ui.NewVerticalBox()
hbox.SetPadded(true) hbox.SetPadded(true)
box.UiBox = hbox box.UiBox = hbox
mainbox.Append(hbox, true) uibox.Append(hbox, true)
log.Println("HardHorizontalBreak END") log.Println("HardHorizontalBreak END")
} }
func HardVerticalBreak(box *GuiBox) { func HardVerticalBreak(box *GuiBox) {
log.Println("HardVerticalBreak START") log.Println("HardVerticalBreak START")
gw := box.Window gw := box.Window
mainbox := gw.mainbox mainbox := gw.BoxMap["MAIN"]
if (mainbox == nil) {
log.Println("HardHorizontalBreak ERROR MAIN box == nil")
return
}
tmp := ui.NewVerticalSeparator() tmp := ui.NewVerticalSeparator()
mainbox.Append(tmp, false) mainbox.UiBox.Append(tmp, false)
hbox := ui.NewVerticalBox() hbox := ui.NewVerticalBox()
hbox.SetPadded(true) hbox.SetPadded(true)
box.UiBox = hbox box.UiBox = hbox
mainbox.Append(hbox, false) mainbox.UiBox.Append(hbox, false)
log.Println("HardVerticalBreak END") log.Println("HardVerticalBreak END")
} }

40
misc.go
View File

@ -43,26 +43,13 @@ func AddMainTab(gw *GuiWindow) *GuiBox {
log.Println("ShowMainTab() gw.UiTab =", gw.UiTab) log.Println("ShowMainTab() gw.UiTab =", gw.UiTab)
window := InitGuiWindow(Data.Config, "MAIN", nil, gw.UiWindow, gw.UiTab) window := InitGuiWindow(Data.Config, "MAIN", nil, gw.UiWindow, gw.UiTab)
// newWindow := new(GuiWindow)
// newWindow.UiWindow = gw.UiWindow
// Data.Windows = append(Data.Windows, newWindow)
var box *GuiBox box := InitGuiBox(window, nil, ui.NewHorizontalBox(), "MAIN")
box = new(GuiBox)
box.Window = window
// box.EntryMap = make(map[string]*GuiEntry)
// box.EntryMap["test"] = nil
hbox := ui.NewHorizontalBox()
hbox.SetPadded(true)
box.UiBox = hbox
gw.mainbox = hbox
if (Data.Debug) { if (Data.Debug) {
log.Println("makeCloudInfoBox() add debugging buttons") log.Println("makeCloudInfoBox() add debugging buttons")
addDebuggingButtons(box) addDebuggingButtons(box)
hbox.Append(ui.NewVerticalSeparator(), false) box.UiBox.Append(ui.NewVerticalSeparator(), false)
} }
// box := gw.MakeWindow(gw) // box := gw.MakeWindow(gw)
@ -73,11 +60,30 @@ func AddMainTab(gw *GuiWindow) *GuiBox {
func ShowMainTabShowBox(gw *GuiWindow, box *GuiBox) { func ShowMainTabShowBox(gw *GuiWindow, box *GuiBox) {
log.Println("gui.ShowMainTabShowBox() box =", box) log.Println("gui.ShowMainTabShowBox() box =", box)
// gw.UiTab.Delete(0) // gw.UiTab.Delete(0)
gw.BoxMap["Box3"] = box gw.BoxMap["MAIN3"] = box
gw.UiTab.InsertAt("Main", 0, gw.mainbox) // gw.UiTab.InsertAt("Main", 0, box.UiBox)
gw.UiTab.SetMargined(0, true) gw.UiTab.SetMargined(0, true)
} }
func InitGuiBox(gw *GuiWindow, box *GuiBox, uiBox *ui.Box, name string) *GuiBox {
log.Println("InitGuiBox() START")
var newGuiBox GuiBox
newGuiBox.UiBox = uiBox
newGuiBox.Window = gw
uiBox.SetPadded(true)
if (box != nil) {
log.Println("InitGuiBox() APPEND NEW BOX TO OLD BOX")
box.UiBox.Append(uiBox, false)
} else {
log.Println("InitGuiBox() APPEND NEW BOX TO TAB")
gw.UiTab.Append(name, uiBox)
}
gw.BoxMap[name] = &newGuiBox
log.Println("InitGuiBox() END")
return &newGuiBox
}
func InitGuiWindow(c *pb.Config, action string, maketab func(*GuiWindow) *GuiBox, uiW *ui.Window, uiT *ui.Tab) *GuiWindow { func InitGuiWindow(c *pb.Config, action string, maketab func(*GuiWindow) *GuiBox, uiW *ui.Window, uiT *ui.Tab) *GuiWindow {
log.Println("InitGuiWindow() START") log.Println("InitGuiWindow() START")
var newGuiWindow GuiWindow var newGuiWindow GuiWindow

View File

@ -82,7 +82,7 @@ type GuiWindow struct {
Width int Width int
Height int Height int
mainbox *ui.Box // mainbox *ui.Box
// the callback function to make the window contents // the callback function to make the window contents
MakeWindow func(*GuiWindow) *GuiBox MakeWindow func(*GuiWindow) *GuiBox