From 65f4d0e23186d06b8e1ee59cd48d96cc7b6066a8 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 5 Apr 2023 19:33:31 -0500 Subject: [PATCH] more fixes Signed-off-by: Jeff Carr --- toolkit/gocui/debug.go | 9 +++++---- toolkit/gocui/plugin.go | 20 ++++++++++---------- toolkit/gocui/view.go | 7 +++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/toolkit/gocui/debug.go b/toolkit/gocui/debug.go index 91c3d98..8fef722 100644 --- a/toolkit/gocui/debug.go +++ b/toolkit/gocui/debug.go @@ -46,16 +46,17 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) { pId = w.parent.id } s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.id, pId) - s1 += fmt.Sprintf("W,H()=(%2d,%2d) ", w.startW, w.startH) + s1 += fmt.Sprintf("start()=(%2d,%2d) ", w.startW, w.startH) + s1 += fmt.Sprintf("size()=(%2d,%2d) ", w.realWidth, w.realHeight) s1 += fmt.Sprintf("gocui()=(%2d,%2d,%2d,%2d,%2d,%2d) ", - w.gocuiSize.startW, w.gocuiSize.startH, + w.gocuiSize.width, w.gocuiSize.height, w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1) switch w.widgetType { case toolkit.Grid: s1 += fmt.Sprintf("next()=(%2d,%2d)", w.nextW, w.nextH) default: - s1 += fmt.Sprintf("L()=(%2d,%2d,%2d,%2d)", - w.logicalSize.w0, w.logicalSize.h0, w.logicalSize.w1, w.logicalSize.h1) + // s1 += fmt.Sprintf("L()=(%2d,%2d,%2d,%2d)", + // w.logicalSize.w0, w.logicalSize.h0, w.logicalSize.w1, w.logicalSize.h1) } log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text) diff --git a/toolkit/gocui/plugin.go b/toolkit/gocui/plugin.go index 9cdfffb..120d14b 100644 --- a/toolkit/gocui/plugin.go +++ b/toolkit/gocui/plugin.go @@ -37,23 +37,24 @@ func (w *cuiWidget) setStartWH() { case toolkit.Box: w.isFake = true w.setFake() + w.getBoxWH() + w.setWH() w.showWidgetPlacement(logNow, "StartWH:") + return case toolkit.Grid: w.isFake = true w.setFake() - w.showWidgetPlacement(logNow, "StartWH:") - } - p := w.parent - switch p.widgetType { - case toolkit.Box: - w.getBoxWH() - return - case toolkit.Grid: w.getGridWH() + w.setWH() + w.showWidgetPlacement(logNow, "StartWH:") return case toolkit.Group: w.getGroupWH() + w.setWH() + w.showWidgetPlacement(logNow, "StartWH:") return + default: + w.setWH() } } @@ -64,9 +65,8 @@ func Action(a *toolkit.Action) { case toolkit.Add: w = setupWidget(a) w.setStartWH() - w.moveTo(w.startW, w.startH) + // w.moveTo(w.startW, w.startH) w.drawView() - // findPlace(w) case toolkit.Show: if (a.B) { diff --git a/toolkit/gocui/view.go b/toolkit/gocui/view.go index 89059c2..c1a514b 100644 --- a/toolkit/gocui/view.go +++ b/toolkit/gocui/view.go @@ -30,10 +30,9 @@ func (w *cuiWidget) textResize() { } height = i } - w.realWidth = width + 3 - w.realHeight = me.defaultHeight + height - w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth - w.gocuiSize.h1 = w.gocuiSize.h0 + w.realHeight + w.gocuiSize.width = width + 3 + w.gocuiSize.height = me.defaultHeight + height + w.setWH() w.showWidgetPlacement(logNow, "textResize()") }