summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-04 10:44:27 -0500
committerJeff Carr <[email protected]>2023-04-04 10:44:27 -0500
commita59d294f37d0dd5731c833763a3678fd0099c55f (patch)
tree98ac910af9dce163ed8b745eb6b1850e9062c468
parent8429f76b551ebeb04277f0ae6e5fa68e8f173364 (diff)
minor reorg
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--toolkit/gocui/click.go74
-rw-r--r--toolkit/gocui/place.go74
2 files changed, 74 insertions, 74 deletions
diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go
index 2c24f3e..d00603f 100644
--- a/toolkit/gocui/click.go
+++ b/toolkit/gocui/click.go
@@ -10,80 +10,6 @@ import (
"git.wit.org/wit/gui/toolkit"
)
-func (w *cuiWidget) gridBounds() {
- w.showWidgetPlacement(logNow, "gridBounds:")
- p := w.parent
-
- /*
- for a := 0; a < w.x; a++ {
- for b := 0; b < w.y; b++ {
- log(logNow, "gridBounds() (w,h)", a, b,
- "logical(W,H)", w.logicalW[a], w.logicalH[b],
- "p.next(W,H)", p.nextW, p.nextH)
- }
- log("\n")
- }
- */
- var wCount int = 0
- var hCount int = 0
- for _, child := range w.children {
- // increment for the next child
- w.nextW = p.nextW + wCount * 20
- w.nextH = p.nextH + hCount * 2
- child.redoBox(true)
-
- // set the child's realWidth, and grid offset
- child.parentH = hCount
- child.parentW = wCount
- if (w.logicalW[wCount] < child.realWidth) {
- w.logicalW[wCount] = child.realWidth
- }
- if (w.logicalH[hCount] < child.realHeight) {
- w.logicalH[hCount] = child.realHeight
- }
- log(logNow, "redoBox(GRID) (w,h count)", wCount, hCount, "(X,Y)", w.x, w.y, w.name)
- child.showWidgetPlacement(logNow, "grid:")
-
- if ((wCount + 1) < w.y) {
- wCount += 1
- } else {
- wCount = 0
- hCount += 1
- }
- }
-
-
- for _, child := range w.children {
- child.showWidgetPlacement(logVerbose, "gridBounds:")
- var totalW, totalH int
- for i, val := range w.logicalW {
- if (i < child.parentW) {
- log(logVerbose, "gridBounds() (w, logicalW[])", i, val)
- totalW += w.logicalW[i]
- }
- }
- for i, h := range w.logicalH {
- if (i < child.parentH) {
- totalH += h
- }
- }
-
- // the new corner to move the child to
- realW := w.nextW + totalW
- realH := w.nextH + totalH
-
-
- log(logInfo, "gridBounds()", child.id, "parent (W,H) =", child.parentW, child.parentH,
- "total (W,H) =", totalW, totalH,
- "real (W,H) =", realW, realH)
- child.moveTo(realW, realH)
- child.showWidgetPlacement(logInfo, "gridBounds:")
- log(logInfo)
- }
- w.updateLogicalSizes()
- w.showWidgetPlacement(logNow, "gridBounds:")
-}
-
func (w *cuiWidget) doWidgetClick() {
switch w.widgetType {
case toolkit.Root:
diff --git a/toolkit/gocui/place.go b/toolkit/gocui/place.go
index 35c0980..f4b253e 100644
--- a/toolkit/gocui/place.go
+++ b/toolkit/gocui/place.go
@@ -156,3 +156,77 @@ func (w *cuiWidget) updateLogicalSizes() {
}
}
}
+
+func (w *cuiWidget) gridBounds() {
+ w.showWidgetPlacement(logNow, "gridBounds:")
+ p := w.parent
+
+ /*
+ for a := 0; a < w.x; a++ {
+ for b := 0; b < w.y; b++ {
+ log(logNow, "gridBounds() (w,h)", a, b,
+ "logical(W,H)", w.logicalW[a], w.logicalH[b],
+ "p.next(W,H)", p.nextW, p.nextH)
+ }
+ log("\n")
+ }
+ */
+ var wCount int = 0
+ var hCount int = 0
+ for _, child := range w.children {
+ // increment for the next child
+ w.nextW = p.nextW + wCount * 20
+ w.nextH = p.nextH + hCount * 2
+ child.redoBox(true)
+
+ // set the child's realWidth, and grid offset
+ child.parentH = hCount
+ child.parentW = wCount
+ if (w.logicalW[wCount] < child.realWidth) {
+ w.logicalW[wCount] = child.realWidth
+ }
+ if (w.logicalH[hCount] < child.realHeight) {
+ w.logicalH[hCount] = child.realHeight
+ }
+ log(logNow, "redoBox(GRID) (w,h count)", wCount, hCount, "(X,Y)", w.x, w.y, w.name)
+ child.showWidgetPlacement(logNow, "grid:")
+
+ if ((wCount + 1) < w.y) {
+ wCount += 1
+ } else {
+ wCount = 0
+ hCount += 1
+ }
+ }
+
+
+ for _, child := range w.children {
+ child.showWidgetPlacement(logVerbose, "gridBounds:")
+ var totalW, totalH int
+ for i, val := range w.logicalW {
+ if (i < child.parentW) {
+ log(logVerbose, "gridBounds() (w, logicalW[])", i, val)
+ totalW += w.logicalW[i]
+ }
+ }
+ for i, h := range w.logicalH {
+ if (i < child.parentH) {
+ totalH += h
+ }
+ }
+
+ // the new corner to move the child to
+ realW := w.nextW + totalW
+ realH := w.nextH + totalH
+
+
+ log(logInfo, "gridBounds()", child.id, "parent (W,H) =", child.parentW, child.parentH,
+ "total (W,H) =", totalW, totalH,
+ "real (W,H) =", realW, realH)
+ child.moveTo(realW, realH)
+ child.showWidgetPlacement(logInfo, "gridBounds:")
+ log(logInfo)
+ }
+ w.updateLogicalSizes()
+ w.showWidgetPlacement(logNow, "gridBounds:")
+}