gocui: s/realSize/gocuiSize/
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
fb43b88a0b
commit
0fb9ab6702
|
@ -13,8 +13,8 @@ import (
|
|||
func (w *cuiWidget) doWidgetClick() {
|
||||
switch w.widgetType {
|
||||
case toolkit.Root:
|
||||
me.rootNode.logicalSize.w1 = 1
|
||||
me.rootNode.redoTabs(true)
|
||||
// me.rootNode.redoFake(true)
|
||||
case toolkit.Flag:
|
||||
me.rootNode.redoColor(true)
|
||||
case toolkit.Window:
|
||||
|
@ -137,8 +137,8 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
|
|||
// find buttons that are below where the mouse button click
|
||||
f = func(widget *cuiWidget) {
|
||||
// if ((widget.logicalSize.w0 < w) && (w < widget.logicalSize.w1)) {
|
||||
if ((widget.realSize.w0 <= w) && (w <= widget.realSize.w1) &&
|
||||
(widget.realSize.h0 <= h) && (h <= widget.realSize.h1)) {
|
||||
if ((widget.gocuiSize.w0 <= w) && (w <= widget.gocuiSize.w1) &&
|
||||
(widget.gocuiSize.h0 <= h) && (h <= widget.gocuiSize.h1)) {
|
||||
widgets = append(widgets, widget)
|
||||
found = widget
|
||||
}
|
||||
|
@ -165,10 +165,10 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
|
|||
found = me.rootNode
|
||||
}
|
||||
found.updateLogicalSizes()
|
||||
me.ctrlDown.realSize.w0 = found.logicalSize.w0
|
||||
me.ctrlDown.realSize.w1 = found.logicalSize.w1
|
||||
me.ctrlDown.realSize.h0 = found.logicalSize.h0
|
||||
me.ctrlDown.realSize.h1 = found.logicalSize.h1
|
||||
me.ctrlDown.gocuiSize.w0 = found.logicalSize.w0
|
||||
me.ctrlDown.gocuiSize.w1 = found.logicalSize.w1
|
||||
me.ctrlDown.gocuiSize.h0 = found.logicalSize.h0
|
||||
me.ctrlDown.gocuiSize.h1 = found.logicalSize.h1
|
||||
|
||||
if (me.ctrlDown.v == nil) {
|
||||
me.ctrlDown.text = found.text
|
||||
|
|
|
@ -46,7 +46,7 @@ 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("real()=(%2d,%2d,%2d,%2d) ", w.realSize.w0, w.realSize.h0, w.realSize.w1, w.realSize.h1)
|
||||
s1 += fmt.Sprintf("real()=(%2d,%2d,%2d,%2d) ", w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
||||
s1 += fmt.Sprintf("size()=(%2d,%2d) ", w.realWidth, w.realHeight)
|
||||
|
||||
switch w.widgetType {
|
||||
|
@ -58,16 +58,16 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
|
|||
}
|
||||
log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
|
||||
|
||||
if (w.realWidth != (w.realSize.w1 - w.realSize.w0)) {
|
||||
if (w.realWidth != (w.gocuiSize.w1 - w.gocuiSize.w0)) {
|
||||
log(b, "dump()", s,
|
||||
"badsize()=(", w.realWidth, ",", w.realHeight, ")",
|
||||
"badreal()=(", w.realSize.w0, ",", w.realSize.h0, ",", w.realSize.w1, ",", w.realSize.h1, ")",
|
||||
"badreal()=(", w.gocuiSize.w0, ",", w.gocuiSize.h0, ",", w.gocuiSize.w1, ",", w.gocuiSize.h1, ")",
|
||||
w.widgetType, ",", w.name)
|
||||
}
|
||||
if (w.realHeight != (w.realSize.h1 - w.realSize.h0)) {
|
||||
if (w.realHeight != (w.gocuiSize.h1 - w.gocuiSize.h0)) {
|
||||
log(b, "dump()", s,
|
||||
"badsize()=(", w.realWidth, ",", w.realHeight, ")",
|
||||
"badreal()=(", w.realSize.w0, ",", w.realSize.h0, ",", w.realSize.w1, ",", w.realSize.h1, ")",
|
||||
"badreal()=(", w.gocuiSize.w0, ",", w.gocuiSize.h0, ",", w.gocuiSize.w1, ",", w.gocuiSize.h1, ")",
|
||||
w.widgetType, ",", w.name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
var logNow bool = true // useful for active development
|
||||
var logError bool = true
|
||||
var logWarn bool = false
|
||||
var logInfo bool = true
|
||||
var logInfo bool = false
|
||||
var logVerbose bool = false
|
||||
|
||||
func log(a ...any) {
|
||||
|
|
|
@ -15,10 +15,10 @@ func (w *cuiWidget) setFake() {
|
|||
// setup fake labels for non-visable things off screen
|
||||
w.realWidth = t + 2
|
||||
w.realHeight = me.defaultHeight
|
||||
w.realSize.w0 = fakeStartWidth
|
||||
w.realSize.h0 = fakeStartHeight
|
||||
w.realSize.w1 = w.realSize.w0 + w.realWidth
|
||||
w.realSize.h1 = w.realSize.h0 + w.realHeight
|
||||
w.gocuiSize.w0 = fakeStartWidth
|
||||
w.gocuiSize.h0 = fakeStartHeight
|
||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth
|
||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.realHeight
|
||||
fakeStartHeight += 3
|
||||
if (fakeStartHeight > 24) {
|
||||
fakeStartHeight = 3
|
||||
|
@ -51,7 +51,7 @@ func findPlace(w *cuiWidget) {
|
|||
func (w *cuiWidget) getBoxWH() {
|
||||
p := w.parent // the parent must be a box widget
|
||||
|
||||
// update parent realSize
|
||||
// update parent gocuiSize
|
||||
p.realWidth = 0
|
||||
p.realHeight = 0
|
||||
for _, child := range p.children {
|
||||
|
@ -85,7 +85,7 @@ func (w *cuiWidget) getBoxWH() {
|
|||
func (w *cuiWidget) getGroupWH() {
|
||||
p := w.parent // the parent must be a group widget
|
||||
|
||||
// update parent realSize
|
||||
// update parent gocuiSize
|
||||
p.realWidth = 0
|
||||
p.realHeight = 0
|
||||
p.realHeight += me.buttonPadding // pad height for the group label
|
||||
|
@ -188,8 +188,8 @@ func (w *cuiWidget) redoBox(draw bool) {
|
|||
w.showWidgetPlacement(logNow, "group:")
|
||||
default:
|
||||
w.moveTo(p.nextW, p.nextH)
|
||||
w.nextW = w.realSize.w1
|
||||
w.nextH = w.realSize.h1
|
||||
w.nextW = w.gocuiSize.w1
|
||||
w.nextH = w.gocuiSize.h1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,16 +197,16 @@ func (w *cuiWidget) moveTo(leftW int, topH int) {
|
|||
if (w.isFake) {
|
||||
// don't ever move these
|
||||
} else {
|
||||
w.realSize.w0 = leftW
|
||||
w.realSize.h0 = topH
|
||||
w.gocuiSize.w0 = leftW
|
||||
w.gocuiSize.h0 = topH
|
||||
}
|
||||
w.realSize.w1 = w.realSize.w0 + w.realWidth
|
||||
w.realSize.h1 = w.realSize.h0 + w.realHeight
|
||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth
|
||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.realHeight
|
||||
|
||||
w.logicalSize.w0 = w.realSize.w0
|
||||
w.logicalSize.h0 = w.realSize.h0
|
||||
w.logicalSize.w1 = w.realSize.w1
|
||||
w.logicalSize.h1 = w.realSize.h1
|
||||
w.logicalSize.w0 = w.gocuiSize.w0
|
||||
w.logicalSize.h0 = w.gocuiSize.h0
|
||||
w.logicalSize.w1 = w.gocuiSize.w1
|
||||
w.logicalSize.h1 = w.gocuiSize.h1
|
||||
|
||||
w.showWidgetPlacement(logNow, "moveTo()")
|
||||
}
|
||||
|
|
|
@ -43,17 +43,9 @@ func (w *cuiWidget) setStartWH() {
|
|||
p := w.parent
|
||||
switch p.widgetType {
|
||||
case toolkit.Box:
|
||||
if (w.isFake == false) {
|
||||
w.isFake = true
|
||||
w.setFake()
|
||||
}
|
||||
w.getBoxWH()
|
||||
return
|
||||
case toolkit.Grid:
|
||||
if (w.isFake == false) {
|
||||
w.isFake = true
|
||||
w.setFake()
|
||||
}
|
||||
w.getGridWH()
|
||||
return
|
||||
case toolkit.Group:
|
||||
|
|
|
@ -98,7 +98,7 @@ type cuiWidget struct {
|
|||
realWidth int
|
||||
realHeight int
|
||||
|
||||
realSize rectType // the display size of this widget
|
||||
gocuiSize rectType // the display size of this widget
|
||||
logicalSize rectType // the logical size. Includes all the child widgets
|
||||
|
||||
// used to track the size of grids
|
||||
|
|
|
@ -49,21 +49,10 @@ func (w *cuiWidget) showWidgets() {
|
|||
}
|
||||
|
||||
func (w *cuiWidget) redoTabs(draw bool) {
|
||||
log(logVerbose, "redoTabs() START", w.name)
|
||||
if (w == nil) {
|
||||
return
|
||||
}
|
||||
if (w.widgetType == toolkit.Root) {
|
||||
w.logicalSize.w0 = 0
|
||||
w.logicalSize.h0 = 0
|
||||
w.logicalSize.w1 = 0
|
||||
w.logicalSize.h1 = 0
|
||||
|
||||
w.nextW = 1
|
||||
w.nextH = 1
|
||||
}
|
||||
|
||||
log(logVerbose, "redoTabs() about to check for window and tab ", w.name)
|
||||
log(logVerbose, "redoTabs() START about to check for window and tab ", w.name)
|
||||
w.text = w.name
|
||||
t := len(w.text)
|
||||
if ((w.widgetType == toolkit.Window) || (w.widgetType == toolkit.Tab)) {
|
||||
|
@ -71,10 +60,10 @@ func (w *cuiWidget) redoTabs(draw bool) {
|
|||
w.realWidth = t + me.buttonPadding
|
||||
w.realHeight = me.defaultHeight
|
||||
|
||||
w.realSize.w0 = me.rootNode.logicalSize.w1
|
||||
w.realSize.w1 = w.realSize.w0 + w.realWidth
|
||||
w.realSize.h0 = 0
|
||||
w.realSize.h1 = w.realHeight
|
||||
w.gocuiSize.w0 = me.rootNode.logicalSize.w1
|
||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth
|
||||
w.gocuiSize.h0 = 0
|
||||
w.gocuiSize.h1 = w.realHeight
|
||||
|
||||
// start logical sizes windows and in the top left corner
|
||||
w.logicalSize.w0 = 2
|
||||
|
@ -86,8 +75,8 @@ func (w *cuiWidget) redoTabs(draw bool) {
|
|||
w.nextW = w.logicalSize.w0
|
||||
w.nextH = w.logicalSize.h0
|
||||
|
||||
me.rootNode.logicalSize.w1 = w.realSize.w1
|
||||
me.rootNode.logicalSize.h1 = w.realSize.h1
|
||||
me.rootNode.logicalSize.w1 = w.gocuiSize.w1
|
||||
me.rootNode.logicalSize.h1 = w.gocuiSize.h1
|
||||
|
||||
w.deleteView()
|
||||
w.drawView()
|
||||
|
|
|
@ -32,8 +32,8 @@ func (w *cuiWidget) textResize() {
|
|||
}
|
||||
w.realWidth = width + 3
|
||||
w.realHeight = me.defaultHeight + height
|
||||
w.realSize.w1 = w.realSize.w0 + w.realWidth
|
||||
w.realSize.h1 = w.realSize.h0 + w.realHeight
|
||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth
|
||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.realHeight
|
||||
w.showWidgetPlacement(logNow, "textResize()")
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,10 @@ func (w *cuiWidget) drawView() {
|
|||
return
|
||||
}
|
||||
|
||||
a := w.realSize.w0
|
||||
b := w.realSize.h0
|
||||
c := w.realSize.w1
|
||||
d := w.realSize.h1
|
||||
a := w.gocuiSize.w0
|
||||
b := w.gocuiSize.h0
|
||||
c := w.gocuiSize.w1
|
||||
d := w.gocuiSize.h1
|
||||
|
||||
w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0)
|
||||
if err == nil {
|
||||
|
|
Loading…
Reference in New Issue