gadget window displays correctly for some reason
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
a15aea03ea
commit
94b41aa18a
8
Makefile
8
Makefile
|
@ -5,7 +5,13 @@ plugin:
|
||||||
GO111MODULE=off go build -v -buildmode=plugin -o ../gocui.so
|
GO111MODULE=off go build -v -buildmode=plugin -o ../gocui.so
|
||||||
|
|
||||||
pluginreal:
|
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:
|
||||||
objdump -t ../gocui.so |less
|
objdump -t ../gocui.so |less
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# a console toolkit around gocui
|
# 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)
|
||||||
|
|
3
add.go
3
add.go
|
@ -43,7 +43,8 @@ func addWidget(n *tree.Node) {
|
||||||
return
|
return
|
||||||
case widget.Window:
|
case widget.Window:
|
||||||
nw.frame = false
|
nw.frame = false
|
||||||
nw.color = &colorWindow
|
// nw.color = &colorWindow
|
||||||
|
nw.setColor(&colorWindow)
|
||||||
wRoot := me.treeRoot.TK.(*guiWidget)
|
wRoot := me.treeRoot.TK.(*guiWidget)
|
||||||
wRoot.redoWindows(0, 0)
|
wRoot.redoWindows(0, 0)
|
||||||
// TODO: record the first window here?
|
// TODO: record the first window here?
|
||||||
|
|
4
click.go
4
click.go
|
@ -85,12 +85,12 @@ func (w *guiWidget) doWidgetClick() {
|
||||||
w.showWidgets()
|
w.showWidgets()
|
||||||
case widget.Box:
|
case widget.Box:
|
||||||
// w.showWidgetPlacement(logNow, "drawTree()")
|
// w.showWidgetPlacement(logNow, "drawTree()")
|
||||||
if w.direction == widget.Horizontal {
|
if w.node.State.Direction == widget.Horizontal {
|
||||||
log.Log(NOW, "BOX IS HORIZONTAL", w.String())
|
log.Log(NOW, "BOX IS HORIZONTAL", w.String())
|
||||||
} else {
|
} else {
|
||||||
log.Log(NOW, "BOX IS VERTICAL", w.String())
|
log.Log(NOW, "BOX IS VERTICAL", w.String())
|
||||||
}
|
}
|
||||||
w.placeWidgets(me.RawW, me.RawH)
|
w.placeWidgets(w.startW, w.startH)
|
||||||
w.toggleTree()
|
w.toggleTree()
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
// doUserEvent(n)
|
// doUserEvent(n)
|
||||||
|
|
14
place.go
14
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)
|
log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
|
||||||
child.placeWidgets(newW, newH)
|
child.placeWidgets(newW, newH)
|
||||||
sizeW, sizeH = child.Size()
|
sizeW, sizeH = child.Size()
|
||||||
if child.direction == widget.Horizontal {
|
if child.node.State.Direction == widget.Vertical {
|
||||||
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 {
|
|
||||||
log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String())
|
log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String())
|
||||||
// expand based on the child height
|
// 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
|
newH += sizeH
|
||||||
}
|
}
|
||||||
log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
|
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:
|
case widget.Group:
|
||||||
// move the group to the parent's next location
|
// move the group to the parent's next location
|
||||||
tk.gocuiSetWH(startW, startH)
|
tk.gocuiSetWH(startW, startH)
|
||||||
// tk.dumpTree("start place")
|
|
||||||
|
|
||||||
newW := startW + me.GroupPadW
|
newW := startW + me.GroupPadW
|
||||||
newH := startH + 1 // normal hight of the group label
|
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)
|
log.Log(INFO, "REAL HEIGHT sizeW:", sizeW, "sizeH:", sizeH)
|
||||||
}
|
}
|
||||||
// tk.dumpTree("end place")
|
|
||||||
return maxW, newH - startH
|
return maxW, newH - startH
|
||||||
default:
|
default:
|
||||||
tk.gocuiSetWH(startW, startH)
|
tk.gocuiSetWH(startW, startH)
|
||||||
|
|
2
size.go
2
size.go
|
@ -116,7 +116,7 @@ func (w *guiWidget) sizeBox() (int, int) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sizeW, sizeH := child.Size()
|
sizeW, sizeH := child.Size()
|
||||||
if child.direction == widget.Horizontal {
|
if child.node.State.Direction == widget.Horizontal {
|
||||||
maxW += sizeW
|
maxW += sizeW
|
||||||
if sizeH > maxH {
|
if sizeH > maxH {
|
||||||
maxH = sizeH
|
maxH = sizeH
|
||||||
|
|
|
@ -155,7 +155,7 @@ type guiWidget struct {
|
||||||
// AtW int
|
// AtW int
|
||||||
// AtH int
|
// AtH int
|
||||||
|
|
||||||
direction widget.Orientation
|
// direction widget.Orientation
|
||||||
|
|
||||||
// progname string
|
// progname string
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue