diff --git a/Makefile b/Makefile index c8926c5..ff43e7c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,13 @@ plugin: GO111MODULE=off go build -v -buildmode=plugin -o ../gocui.so pluginreal: - go build -v -buildmode=plugin -o ~/go/lib/gocui.so + go build -v -buildmode=plugin -o ~/go/lib/toolkits/gocui.so + +# Test the README.md & doc.go file +# this runs pkgsite, the binary that does dev.go.dev +# go install golang.org/x/pkgsite/cmd/pkgsite@latest +pkgsite: + pkgsite objdump: objdump -t ../gocui.so |less diff --git a/README.md b/README.md index 4c65ffb..03207c1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # a console toolkit around gocui -https://github.com/termstandard/colors#truecolor-support-in-output-devices +[terminals that support ture color](https://github.com/termstandard/colors#truecolor-support-in-output-devices) diff --git a/add.go b/add.go index f7a0749..ea6103e 100644 --- a/add.go +++ b/add.go @@ -43,7 +43,8 @@ func addWidget(n *tree.Node) { return case widget.Window: nw.frame = false - nw.color = &colorWindow + // nw.color = &colorWindow + nw.setColor(&colorWindow) wRoot := me.treeRoot.TK.(*guiWidget) wRoot.redoWindows(0, 0) // TODO: record the first window here? diff --git a/click.go b/click.go index 0074c3b..a08f60b 100644 --- a/click.go +++ b/click.go @@ -85,12 +85,12 @@ func (w *guiWidget) doWidgetClick() { w.showWidgets() case widget.Box: // w.showWidgetPlacement(logNow, "drawTree()") - if w.direction == widget.Horizontal { + if w.node.State.Direction == widget.Horizontal { log.Log(NOW, "BOX IS HORIZONTAL", w.String()) } else { log.Log(NOW, "BOX IS VERTICAL", w.String()) } - w.placeWidgets(me.RawW, me.RawH) + w.placeWidgets(w.startW, w.startH) w.toggleTree() case widget.Button: // doUserEvent(n) diff --git a/place.go b/place.go index 1ef1775..4f24c48 100644 --- a/place.go +++ b/place.go @@ -22,13 +22,15 @@ func (tk *guiWidget) placeBox(startW int, startH int) { log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) child.placeWidgets(newW, newH) sizeW, sizeH = child.Size() - if child.direction == widget.Horizontal { - log.Log(INFO, "BOX IS HORIZONTAL", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) - // expand based on the child width - newW += sizeW - } else { + if child.node.State.Direction == widget.Vertical { log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) // expand based on the child height + // something is wrong here + newW += sizeW + } else { + log.Log(INFO, "BOX IS HORIZONTAL", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) + // expand based on the child width + // something is wrong here newH += sizeH } log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) @@ -74,7 +76,6 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) { case widget.Group: // move the group to the parent's next location tk.gocuiSetWH(startW, startH) - // tk.dumpTree("start place") newW := startW + me.GroupPadW newH := startH + 1 // normal hight of the group label @@ -93,7 +94,6 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) { } log.Log(INFO, "REAL HEIGHT sizeW:", sizeW, "sizeH:", sizeH) } - // tk.dumpTree("end place") return maxW, newH - startH default: tk.gocuiSetWH(startW, startH) diff --git a/size.go b/size.go index 4fe3b43..b8971e9 100644 --- a/size.go +++ b/size.go @@ -116,7 +116,7 @@ func (w *guiWidget) sizeBox() (int, int) { continue } sizeW, sizeH := child.Size() - if child.direction == widget.Horizontal { + if child.node.State.Direction == widget.Horizontal { maxW += sizeW if sizeH > maxH { maxH = sizeH diff --git a/structs.go b/structs.go index 5dc3fea..4a3cd50 100644 --- a/structs.go +++ b/structs.go @@ -155,7 +155,7 @@ type guiWidget struct { // AtW int // AtH int - direction widget.Orientation + // direction widget.Orientation // progname string