From a5800917e8383929e5c9dc8ad0265d6a4b4357bf Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 19 Feb 2025 04:22:26 -0600 Subject: [PATCH] still more --- debug.go | 10 +++++----- place.go | 22 +++++++++++----------- size.go | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/debug.go b/debug.go index 189ef31..84630f5 100644 --- a/debug.go +++ b/debug.go @@ -69,10 +69,10 @@ func (tk *guiWidget) dumpWidget(s string) { s1 += fmt.Sprintf(" %3s %3s %3s %3s ", "", "", "", "") } s1 += fmt.Sprintf(" full=(%3d,%3d,%3d,%3d)", tk.full.w0, tk.full.h0, tk.full.w1, tk.full.h1) - if tk.node.Parent != nil { - if tk.node.Parent.WidgetType == widget.Grid { - s1 += fmt.Sprintf("At(%3d,%3d)", tk.node.State.AtW, tk.node.State.AtH) - s1 += fmt.Sprintf("(%3d,%3d) ", tk.parent.widths[tk.node.State.AtW], tk.parent.heights[tk.node.State.AtH]) + if tk.parent != nil { + if tk.parent.WidgetType() == widget.Grid { + s1 += fmt.Sprintf("At(%3d,%3d)", tk.GridW(), tk.GridH()) + s1 += fmt.Sprintf("(%3d,%3d) ", tk.parent.widths[tk.GridW()], tk.parent.heights[tk.GridH()]) } else { s1 += fmt.Sprintf(" %3s %3s ", "", "") s1 += fmt.Sprintf(" %3s %3s ", "", "") @@ -82,7 +82,7 @@ func (tk *guiWidget) dumpWidget(s string) { } var end string if tk.WidgetType() == widget.Box { - end = fmt.Sprintf("%-8s %-8s %s %s", tk.WidgetType(), tk.cuiName, tk.node.State.Direction.String(), tk.String()) + end = fmt.Sprintf("%-8s %-8s %s %s", tk.WidgetType(), tk.cuiName, tk.Direction().String(), tk.String()) } else { end = fmt.Sprintf("%-8s %-8s %s", tk.WidgetType(), tk.cuiName, tk.String()) } diff --git a/place.go b/place.go index 11038a1..27fc9e4 100644 --- a/place.go +++ b/place.go @@ -203,22 +203,22 @@ func (w *guiWidget) placeGrid(startW int, startH int) (int, int) { childW, childH := child.placeWidgets(child.startW, child.startH) // set the child's realWidth, and grid offset - if w.widths[child.node.State.AtW] < childW { - w.widths[child.node.State.AtW] = childW + if w.widths[child.GridW()] < childW { + w.widths[child.GridW()] = childW } - if w.heights[child.node.State.AtH] < childH { - w.heights[child.node.State.AtH] = childH + if w.heights[child.GridH()] < childH { + w.heights[child.GridH()] = childH } if dense { - if w.heights[child.node.State.AtH] > 0 { - w.heights[child.node.State.AtH] = 1 + if w.heights[child.GridH()] > 0 { + w.heights[child.GridH()] = 1 } else { - w.heights[child.node.State.AtH] = 0 + w.heights[child.GridH()] = 0 } } // child.showWidgetPlacement("grid: ") - log.Log(INFO, "placeGrid:", child.String(), "child()", childW, childH, "At()", child.node.State.AtW, child.node.State.AtH) + log.Log(INFO, "placeGrid:", child.String(), "child()", childW, childH, "At()", child.GridW(), child.GridH()) } var maxW int = 0 @@ -230,12 +230,12 @@ func (w *guiWidget) placeGrid(startW int, startH int) (int, int) { var totalW, totalH int for i, w := range w.widths { - if i < child.node.State.AtW { + if i < child.GridW() { totalW += w } } for i, h := range w.heights { - if i < child.node.State.AtH { + if i < child.GridH() { totalH += h } } @@ -251,7 +251,7 @@ func (w *guiWidget) placeGrid(startW int, startH int) (int, int) { maxH = totalH } - log.Log(INFO, "placeGrid:", child.String(), "new()", newW, newH, "At()", child.node.State.AtW, child.node.State.AtH) + log.Log(INFO, "placeGrid:", child.String(), "new()", newW, newH, "At()", child.GridW(), child.GridH()) child.placeWidgets(newW, newH) // child.showWidgetPlacement("grid2:") } diff --git a/size.go b/size.go index 94248ff..0d86128 100644 --- a/size.go +++ b/size.go @@ -91,11 +91,11 @@ func (w *guiWidget) sizeGrid() (int, int) { sizeW, sizeH := child.Size() // set the child's realWidth, and grid offset - if w.widths[child.node.State.AtW] < sizeW { - w.widths[child.node.State.AtW] = sizeW + if w.widths[child.GridW()] < sizeW { + w.widths[child.GridW()] = sizeW } - if w.heights[child.node.State.AtH] < sizeH { - w.heights[child.node.State.AtH] = sizeH + if w.heights[child.GridH()] < sizeH { + w.heights[child.GridH()] = sizeH } }