summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-04 18:45:59 -0500
committerJeff Carr <[email protected]>2023-04-04 18:45:59 -0500
commit693a6f4398604e9932d714d24adc5c12472e750b (patch)
treeb89e71d55713b2df09b537b8d8022910e989e69b
parenta59d294f37d0dd5731c833763a3678fd0099c55f (diff)
I can't add
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--tab.go2
-rw-r--r--toolkit/gocui/click.go2
-rw-r--r--toolkit/gocui/logical.go45
-rw-r--r--toolkit/gocui/place.go1
-rw-r--r--toolkit/gocui/tab.go37
5 files changed, 45 insertions, 42 deletions
diff --git a/tab.go b/tab.go
index 49632ee..e425068 100644
--- a/tab.go
+++ b/tab.go
@@ -16,6 +16,6 @@ func (n *Node) NewTab(text string) *Node {
a.Text = text
newaction(&a, newNode, n)
- newBox := newNode.NewBox(text, true)
+ newBox := newNode.NewBox(text + "tab hbox", true)
return newBox
}
diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go
index d00603f..142f00c 100644
--- a/toolkit/gocui/click.go
+++ b/toolkit/gocui/click.go
@@ -24,7 +24,9 @@ func (w *cuiWidget) doWidgetClick() {
w.redoBox(true)
w.toggleTree()
case toolkit.Grid:
+ w.setParentLogical()
w.gridBounds()
+ w.setParentLogical()
for _, child := range w.children {
child.showWidgetPlacement(logNow, "gridBounds:")
if (child.v == nil) {
diff --git a/toolkit/gocui/logical.go b/toolkit/gocui/logical.go
index 2c6081b..a9ceff1 100644
--- a/toolkit/gocui/logical.go
+++ b/toolkit/gocui/logical.go
@@ -7,26 +7,9 @@ import (
var adjusted bool = false
// expands the logical size of the parents
-func (w *cuiWidget) setParentLogical(p *cuiWidget) {
- if (w.visable) {
- // expand the parent logicalsize to include the widget realSize
- if (p.logicalSize.w0 > w.realSize.w0) {
- p.logicalSize.w0 = w.realSize.w0
- adjusted = true
- }
- if (p.logicalSize.h0 > w.realSize.h0) {
- p.logicalSize.h0 = w.realSize.h0
- adjusted = true
- }
- if (p.logicalSize.w1 < w.realSize.w1) {
- p.logicalSize.w1 = w.realSize.w1
- adjusted = true
- }
- if (p.logicalSize.h1 < w.realSize.h1) {
- p.logicalSize.h1 = w.realSize.h1
- adjusted = true
- }
- } else {
+func (w *cuiWidget) setParentLogical() {
+ p := w.parent
+ if (w.isFake) {
// expand the parent logicalsize to include the widget logicalsize
if (p.logicalSize.w0 > w.logicalSize.w0) {
p.logicalSize.w0 = w.logicalSize.w0
@@ -44,8 +27,26 @@ func (w *cuiWidget) setParentLogical(p *cuiWidget) {
p.logicalSize.h1 = w.logicalSize.h1
adjusted = true
}
+ } else {
+ // expand the parent logicalsize to include the widget realSize
+ if (p.logicalSize.w0 > w.realSize.w0) {
+ p.logicalSize.w0 = w.realSize.w0
+ adjusted = true
+ }
+ if (p.logicalSize.h0 > w.realSize.h0) {
+ p.logicalSize.h0 = w.realSize.h0
+ adjusted = true
+ }
+ if (p.logicalSize.w1 < w.realSize.w1) {
+ p.logicalSize.w1 = w.realSize.w1
+ adjusted = true
+ }
+ if (p.logicalSize.h1 < w.realSize.h1) {
+ p.logicalSize.h1 = w.realSize.h1
+ adjusted = true
+ }
}
- if (w.visable) {
+ if (! w.isFake) {
// adjust the widget realSize to the top left corner of the logicalsize
if (w.logicalSize.w0 > w.realSize.w0) {
w.realSize.w0 = w.logicalSize.w0
@@ -67,6 +68,6 @@ func (w *cuiWidget) setParentLogical(p *cuiWidget) {
// pass the logical resizing up
pP := w.parent
if (pP != nil) {
- p.setParentLogical(pP)
+ pP.setParentLogical()
}
}
diff --git a/toolkit/gocui/place.go b/toolkit/gocui/place.go
index f4b253e..1f0c768 100644
--- a/toolkit/gocui/place.go
+++ b/toolkit/gocui/place.go
@@ -141,6 +141,7 @@ func (w *cuiWidget) moveTo(leftW int, topH int) {
func (w *cuiWidget) updateLogicalSizes() {
for _, child := range w.children {
+ // if (w.isReal)
child.updateLogicalSizes()
if (w.logicalSize.w0 > child.logicalSize.w0) {
w.logicalSize.w0 = child.logicalSize.w0
diff --git a/toolkit/gocui/tab.go b/toolkit/gocui/tab.go
index 0a0656e..c434461 100644
--- a/toolkit/gocui/tab.go
+++ b/toolkit/gocui/tab.go
@@ -49,7 +49,7 @@ func (w *cuiWidget) showWidgets() {
}
func (w *cuiWidget) redoTabs(draw bool) {
- log(logNow, "redoTabs() START", w.name)
+ log(logVerbose, "redoTabs() START", w.name)
if (w == nil) {
return
}
@@ -59,45 +59,44 @@ func (w *cuiWidget) redoTabs(draw bool) {
w.logicalSize.w1 = 0
w.logicalSize.h1 = 0
- w.nextW = 2
- w.nextH = 2
+ w.nextW = 1
+ w.nextH = 1
}
- log(logNow, "redoTabs() about to check for window and tab ", w.name)
+ log(logVerbose, "redoTabs() 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)) {
- log(logNow, "redoTabs() in Window and Tab", w.name)
- w.realWidth = t + 2
+ log(logVerbose, "redoTabs() in Window and Tab", w.name)
+ w.realWidth = t + me.buttonPadding
w.realHeight = me.defaultHeight
w.realSize.w0 = me.rootNode.logicalSize.w1
- w.realSize.h0 = 0
w.realSize.w1 = w.realSize.w0 + w.realWidth
+ w.realSize.h0 = 0
w.realSize.h1 = w.realHeight
- w.logicalSize.w0 = 0
- w.logicalSize.h0 = 0
- w.logicalSize.w1 = 0
+ // start logical sizes windows and in the top left corner
+ w.logicalSize.w0 = 2
+ w.logicalSize.w1 = 2
+ w.logicalSize.h0 = w.realHeight
w.logicalSize.h1 = w.realHeight
- // spaces right 1 space to next tab widget
- // spaces down 1 line to the next widget
- w.nextW = 2
- w.nextH = w.realHeight + 1
+ // start all windows and in the top left corner
+ w.nextW = w.logicalSize.w0
+ w.nextH = w.logicalSize.h0
- me.rootNode.logicalSize.w1 = w.realSize.w1 + 1
- me.rootNode.logicalSize.h1 = 0
+ me.rootNode.logicalSize.w1 = w.realSize.w1
+ me.rootNode.logicalSize.h1 = w.realSize.h1
w.deleteView()
- w.v = nil
w.drawView()
w.showWidgetPlacement(logNow, "redoTabs()")
}
- log(logNow, "redoTabs() about to for loop children", w.name)
+ log(logVerbose, "redoTabs() about to for loop children", w.name)
for _, child := range w.children {
- log(logNow, "redoTabs() got to child", child.name)
+ log(logVerbose, "redoTabs() got to child", child.name)
child.redoTabs(draw)
}
}