diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go index ae845df..21a964c 100644 --- a/toolkit/gocui/click.go +++ b/toolkit/gocui/click.go @@ -13,7 +13,9 @@ import ( func (w *cuiWidget) doWidgetClick() { switch w.widgetType { case toolkit.Root: - // me.rootNode.logicalSize.w1 = 1 + // THIS IS THE BEGINING OF THE LAYOUT + me.rootNode.nextW = 0 + me.rootNode.nextH = 0 me.rootNode.redoTabs(true) case toolkit.Flag: me.rootNode.redoColor(true) diff --git a/toolkit/gocui/keybindings.go b/toolkit/gocui/keybindings.go index c3e92d7..dd39e2d 100644 --- a/toolkit/gocui/keybindings.go +++ b/toolkit/gocui/keybindings.go @@ -46,9 +46,9 @@ func addDebugKeys(g *gocui.Gui) { func(g *gocui.Gui, v *gocui.View) error { log(logNow, "gocui.SetKeyBinding() dumpTree() START") // me.rootNode.dumpTree(true) + fakeStartWidth = me.DevelOffsetW + fakeStartHeight = me.TabH + me.FramePadH if (showDebug) { - fakeStartWidth = me.DevelOffsetW - fakeStartHeight = me.TabH + me.FramePadH me.rootNode.showFake() showDebug = false } else { diff --git a/toolkit/gocui/mouse.go b/toolkit/gocui/mouse.go index 0ad8e29..591691d 100644 --- a/toolkit/gocui/mouse.go +++ b/toolkit/gocui/mouse.go @@ -39,9 +39,9 @@ func layout(g *gocui.Gui) error { if _, err := g.View("msg"); msgMouseDown && err == nil { moveMsg(g) } - // if v, err := g.SetView("global", -1, -1, maxX, maxY, 0); err != nil { - // what is this do? I made it just the top 2 lines for now. Is this useful for something? - if v, err := g.SetView("global", -1, -1, maxX, 2, 10); err != nil { + // TODO: figure out what this might be useful for + // what is this do? I made it just 2 lines for now. Is this useful for something? + if v, err := g.SetView("global", 15, 5, maxX, 8, 10); err != nil { if !errors.Is(err, gocui.ErrUnknownView) { log("global failed", maxX, maxY) return err diff --git a/toolkit/gocui/structs.go b/toolkit/gocui/structs.go index 9cc4eb8..a772d8a 100644 --- a/toolkit/gocui/structs.go +++ b/toolkit/gocui/structs.go @@ -51,10 +51,13 @@ type config struct { PadH int `default:"1" dense:"0"` // additional amount of space to put between window & tab widgets - TabPadW int `default:"2" dense:"0"` + WindowPadW int `default:"8" dense:"0"` + TabPadW int `default:"4" dense:"0"` // how far down to start Window or Tab headings - WindowH int `default:"1" dense:"0"` + WindowW int `default:"20" dense:"0"` + WindowH int `default:"0" dense:"0"` + TabW int `default:"2" dense:"0"` TabH int `default:"2" dense:"0"` // additional amount of space to indent on a group diff --git a/toolkit/gocui/tab.go b/toolkit/gocui/tab.go index 4102702..dc0566c 100644 --- a/toolkit/gocui/tab.go +++ b/toolkit/gocui/tab.go @@ -56,11 +56,19 @@ func (w *cuiWidget) showWidgets() { func (w *cuiWidget) setTabWH() { // set the start and size of the tab gocui button + if w.frame { + // this means it should work like a tab + w.gocuiSize.w0 = me.rootNode.nextW + w.gocuiSize.h0 = me.TabH + } else { + // this means it should just be a window label + w.gocuiSize.w0 = me.rootNode.nextW + w.gocuiSize.h0 = me.WindowH + } + t := len(w.text) - w.gocuiSize.w0 = me.rootNode.nextW - w.gocuiSize.h0 = me.rootNode.nextH - w.gocuiSize.w1 = w.gocuiSize.w1 + t + me.PadW - w.gocuiSize.h1 = w.gocuiSize.h1 + me.DefaultHeight + me.PadH + w.gocuiSize.w1 = w.gocuiSize.w0 + t + me.PadW + w.gocuiSize.h1 = w.gocuiSize.h0 + me.DefaultHeight + me.PadH w.realWidth = w.gocuiSize.Width() w.realHeight = w.gocuiSize.Height() @@ -68,10 +76,13 @@ func (w *cuiWidget) setTabWH() { if w.frame { w.realWidth += me.FramePadW w.realHeight += me.FramePadH - } - // move the rootNode width over for the next window or tab - me.rootNode.nextW += w.realWidth + me.TabPadW + // move the rootNode width over for the next tab + me.rootNode.nextW += w.realWidth + me.TabPadW + } else { + // move the rootNode width over for the next window + me.rootNode.nextW += w.realWidth + me.WindowPadW + } w.showWidgetPlacement(logNow, "setTabWH:") } @@ -92,11 +103,11 @@ func (w *cuiWidget) redoTabs(draw bool) { w.frame = true } w.setTabWH() - w.deleteView() w.drawView() } if (w.widgetType == toolkit.Tab) { + w.setTabWH() w.deleteView() w.drawView() }