gocui: more size debugging

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-03 16:32:01 -05:00
parent c4890c4c84
commit b0ae0810c4
5 changed files with 10 additions and 13 deletions

View File

@ -13,9 +13,8 @@ func (n *Node) NewSlider(name string, x int, y int) *Node {
a.ActionType = toolkit.Add a.ActionType = toolkit.Add
a.X = x a.X = x
a.Y = y a.Y = y
// a.Widget = &newNode.widget a.Name = name
// a.Where = &n.widget a.Text = name
// action(&a)
newaction(&a, newNode, n) newaction(&a, newNode, n)
return newNode return newNode

View File

@ -13,9 +13,8 @@ func (n *Node) NewSpinner(name string, x int, y int) *Node {
a.ActionType = toolkit.Add a.ActionType = toolkit.Add
a.X = x a.X = x
a.Y = y a.Y = y
// a.Widget = &newNode.widget a.Name = name
// a.Where = &n.widget a.Text = name
// action(&a)
newaction(&a, newNode, n) newaction(&a, newNode, n)
return newNode return newNode

View File

@ -11,9 +11,8 @@ func (n *Node) NewTextbox(name string) *Node {
var a toolkit.Action var a toolkit.Action
a.ActionType = toolkit.Add a.ActionType = toolkit.Add
// a.Widget = &newNode.widget a.Name = name
// a.Where = &n.widget a.Text = name
// action(&a)
newaction(&a, newNode, n) newaction(&a, newNode, n)
return newNode return newNode

View File

@ -125,7 +125,8 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
// find buttons that are below where the mouse button click // find buttons that are below where the mouse button click
f = func(widget *cuiWidget) { f = func(widget *cuiWidget) {
// if ((widget.logicalSize.w0 < w) && (w < widget.logicalSize.w1)) { // if ((widget.logicalSize.w0 < w) && (w < widget.logicalSize.w1)) {
if ((widget.realSize.w0 < w) && (w < widget.realSize.w1)) { if ((widget.realSize.w0 < w) && (w < widget.realSize.w1) &&
(widget.realSize.h0 < h) && (h < widget.realSize.h1)) {
widgets = append(widgets, widget) widgets = append(widgets, widget)
found = widget found = widget
} }
@ -151,6 +152,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
if (found == nil) { if (found == nil) {
found = me.rootNode found = me.rootNode
} }
found.updateLogicalSizes()
me.ctrlDown.realSize.w0 = found.logicalSize.w0 me.ctrlDown.realSize.w0 = found.logicalSize.w0
me.ctrlDown.realSize.w1 = found.logicalSize.w1 me.ctrlDown.realSize.w1 = found.logicalSize.w1
me.ctrlDown.realSize.h0 = found.logicalSize.h0 me.ctrlDown.realSize.h0 = found.logicalSize.h0

View File

@ -42,9 +42,7 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
return return
} }
if (w.parent == nil) { if (w.parent == nil) {
log(logError, "showWidgetPlacement() WTF parent == nil", w.id, w.cuiName) log(logError, "showWidgetPlacement() ERROR parent == nil", w.id, w.cuiName)
log(logError, "showWidgetPlacement() WTF parent == nil", w.id, w.cuiName)
log(logError, "showWidgetPlacement() WTF parent == nil", w.id, w.cuiName)
} }
log(b, "dump()", s, log(b, "dump()", s,
fmt.Sprintf("(wId,pId)=(%3d,%3d)", w.id, w.parent.id), fmt.Sprintf("(wId,pId)=(%3d,%3d)", w.id, w.parent.id),