diff --git a/toolkit/gocui/debug.go b/toolkit/gocui/debug.go index 4e7bf83..770c0c5 100644 --- a/toolkit/gocui/debug.go +++ b/toolkit/gocui/debug.go @@ -47,9 +47,9 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) { } s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.id, pId) s1 += fmt.Sprintf("W,H()=(%2d,%2d) ", w.startW, w.startH) - s1 += fmt.Sprintf("size()=(%2d,%2d) ", w.realWidth, w.realHeight) - s1 += fmt.Sprintf("gocui()=(%2d,%2d,%2d,%2d) ", w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1) - + s1 += fmt.Sprintf("gocui()=(%2d,%2d,%2d,%2d,%2d,%2d) ", + w.gocuiSize.startW, w.gocuiSize.startH, + 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) diff --git a/toolkit/gocui/place.go b/toolkit/gocui/place.go index bee9063..2d0967d 100644 --- a/toolkit/gocui/place.go +++ b/toolkit/gocui/place.go @@ -15,8 +15,11 @@ func (w *cuiWidget) setFake() { // setup fake labels for non-visable things off screen w.realWidth = t + 2 w.realHeight = me.defaultHeight - w.startW = fakeStartWidth - w.startH = fakeStartHeight + + w.gocuiSize.width = t + 2 + w.gocuiSize.height = me.defaultHeight + w.gocuiSize.startW = fakeStartWidth + w.gocuiSize.startH = fakeStartHeight fakeStartHeight += 3 if (fakeStartHeight > 24) { @@ -194,10 +197,10 @@ func (w *cuiWidget) redoBox(draw bool) { } func (w *cuiWidget) setWH() { - w.gocuiSize.w0 = w.startW - w.gocuiSize.h0 = w.startH - w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth - w.gocuiSize.h1 = w.gocuiSize.h0 + w.realHeight + w.gocuiSize.w0 = w.gocuiSize.startW + w.gocuiSize.h0 = w.gocuiSize.startH + w.gocuiSize.w1 = w.gocuiSize.w0 + w.gocuiSize.width + w.gocuiSize.h1 = w.gocuiSize.h0 + w.gocuiSize.height w.logicalSize.w0 = w.gocuiSize.w0 w.logicalSize.h0 = w.gocuiSize.h0 diff --git a/toolkit/gocui/structs.go b/toolkit/gocui/structs.go index 27059fd..3b10296 100644 --- a/toolkit/gocui/structs.go +++ b/toolkit/gocui/structs.go @@ -65,6 +65,14 @@ var ( // the logical size of the widget // corner starts at in the upper left corner type rectType struct { + // where the widget should calculate it's existance from + startW int + startH int + + // the actual size + width int + height int + // this is the gocui way w0, h0, w1, h1 int // left top right bottom } @@ -90,7 +98,7 @@ type cuiWidget struct { // visable bool // track if it's currently supposed to be shown isFake bool // widget types like 'box' are 'false' - // where the widget should calculate it's existance from + // where the widget should add children startW int startH int diff --git a/toolkit/gocui/tab.go b/toolkit/gocui/tab.go index b2552b4..bd56545 100644 --- a/toolkit/gocui/tab.go +++ b/toolkit/gocui/tab.go @@ -59,12 +59,13 @@ func (w *cuiWidget) setTabWH() { for _, child := range me.rootNode.children { if (child.isFake) { - w.showWidgetPlacement(logNow, "SETTABWH:") continue } if (w == child) { w.startW = startW w.startH = startH + w.gocuiSize.startW = startW + w.gocuiSize.startH = startH w.setWH() w.showWidgetPlacement(logNow, "setTABWH:") return @@ -73,6 +74,8 @@ func (w *cuiWidget) setTabWH() { } w.startW = startW w.startH = startH + w.gocuiSize.startW = startW + w.gocuiSize.startH = startH w.setWH() w.showWidgetPlacement(logNow, "setTabWH:") }