trying to fix windows
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
dab898f0f9
commit
2e2e68ce07
17
click.go
17
click.go
|
@ -119,8 +119,10 @@ func (w *guiWidget) doWidgetClick() {
|
||||||
w.setColor(&colorActiveW)
|
w.setColor(&colorActiveW)
|
||||||
if w.active {
|
if w.active {
|
||||||
w.active = false
|
w.active = false
|
||||||
w.placeWidgets(me.RawW, me.RawH)
|
w.dumpTree("before")
|
||||||
|
w.placeWidgets(3, 2)
|
||||||
w.showWidgets()
|
w.showWidgets()
|
||||||
|
w.dumpTree("after")
|
||||||
} else {
|
} else {
|
||||||
w.active = true
|
w.active = true
|
||||||
w.hideWidgets()
|
w.hideWidgets()
|
||||||
|
@ -165,22 +167,27 @@ func (w *guiWidget) doWidgetClick() {
|
||||||
w.showWidgets()
|
w.showWidgets()
|
||||||
case widget.Group:
|
case widget.Group:
|
||||||
// n.placeWidgets(p.tk.startH, newH)
|
// n.placeWidgets(p.tk.startH, newH)
|
||||||
|
w.dumpTree("click start")
|
||||||
if w.active {
|
if w.active {
|
||||||
w.active = false
|
w.active = false
|
||||||
startW := me.RawW
|
startW := w.parent.AtW
|
||||||
startH := me.RawH
|
startH := w.parent.AtH
|
||||||
|
w.placeWidgets(startW, startH)
|
||||||
|
w.showWidgets()
|
||||||
|
/*
|
||||||
for _, child := range w.children {
|
for _, child := range w.children {
|
||||||
log.Log(INFO, "START W,H", startW, startH)
|
log.Log(INFO, "START W,H", startW, startH)
|
||||||
child.placeWidgets(me.RawW, me.RawH)
|
child.placeWidgets(startW, startH)
|
||||||
child.showWidgets()
|
child.showWidgets()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
w.active = true
|
w.active = true
|
||||||
for _, child := range w.children {
|
for _, child := range w.children {
|
||||||
child.hideWidgets()
|
child.hideWidgets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.dumpTree()
|
w.dumpTree("click end")
|
||||||
case widget.Checkbox:
|
case widget.Checkbox:
|
||||||
if widget.GetBool(w.value) {
|
if widget.GetBool(w.value) {
|
||||||
w.setCheckbox(false)
|
w.setCheckbox(false)
|
||||||
|
|
6
debug.go
6
debug.go
|
@ -7,16 +7,16 @@ import (
|
||||||
"go.wit.com/widget"
|
"go.wit.com/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (w *guiWidget) dumpTree() {
|
func (w *guiWidget) dumpTree(s string) {
|
||||||
// log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
|
// log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
|
||||||
if w == nil {
|
if w == nil {
|
||||||
log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
|
log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.showWidgetPlacement("dumpTree()")
|
w.showWidgetPlacement("dumpTree() " + s)
|
||||||
|
|
||||||
for _, child := range w.children {
|
for _, child := range w.children {
|
||||||
child.dumpTree()
|
child.dumpTree(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
gocui.go
6
gocui.go
|
@ -50,7 +50,7 @@ func gocuiMain() {
|
||||||
func gocuiEvent(g *gocui.Gui) error {
|
func gocuiEvent(g *gocui.Gui) error {
|
||||||
maxX, maxY := g.Size()
|
maxX, maxY := g.Size()
|
||||||
mx, my := g.MousePosition()
|
mx, my := g.MousePosition()
|
||||||
log.Log(NOW, "handleEvent() START", maxX, maxY, mx, my, msgMouseDown)
|
log.Verbose("handleEvent() START", maxX, maxY, mx, my, msgMouseDown)
|
||||||
if _, err := g.View("msg"); msgMouseDown && err == nil {
|
if _, err := g.View("msg"); msgMouseDown && err == nil {
|
||||||
moveMsg(g)
|
moveMsg(g)
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,10 @@ func gocuiEvent(g *gocui.Gui) error {
|
||||||
// setOutput(me.logStdout)
|
// setOutput(me.logStdout)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "output widget already exists", maxX, maxY, mx, my)
|
log.Verbose("output widget already exists", maxX, maxY, mx, my)
|
||||||
}
|
}
|
||||||
mouseMove(g)
|
mouseMove(g)
|
||||||
log.Log(INFO, "handleEvent() END ", maxX, maxY, mx, my, msgMouseDown)
|
log.Verbose("handleEvent() END ", maxX, maxY, mx, my, msgMouseDown)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,14 @@ func addDebugKeys(g *gocui.Gui) {
|
||||||
g.SetKeybinding("", 'M', gocui.ModNone,
|
g.SetKeybinding("", 'M', gocui.ModNone,
|
||||||
func(g *gocui.Gui, v *gocui.View) error {
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
w := me.treeRoot.TK.(*guiWidget)
|
w := me.treeRoot.TK.(*guiWidget)
|
||||||
w.dumpTree()
|
w.dumpTree("M")
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
// redo windows
|
||||||
|
g.SetKeybinding("", 'w', gocui.ModNone,
|
||||||
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
redoWindows(0, 0)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
4
place.go
4
place.go
|
@ -65,7 +65,7 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) {
|
||||||
case widget.Group:
|
case widget.Group:
|
||||||
// move the group to the parent's next location
|
// move the group to the parent's next location
|
||||||
tk.gocuiSetWH(startW, startH)
|
tk.gocuiSetWH(startW, startH)
|
||||||
tk.showWidgetPlacement("group()")
|
tk.dumpTree("start place")
|
||||||
|
|
||||||
newW := startW + me.GroupPadW
|
newW := startW + me.GroupPadW
|
||||||
newH := startH + 3 // normal hight of the group label
|
newH := startH + 3 // normal hight of the group label
|
||||||
|
@ -78,7 +78,9 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) {
|
||||||
|
|
||||||
// increment straight down
|
// increment straight down
|
||||||
newH += h
|
newH += h
|
||||||
|
log.Log(INFO, "REAL HIGHT ADDED", h, "newH", newH)
|
||||||
}
|
}
|
||||||
|
tk.dumpTree("end place")
|
||||||
default:
|
default:
|
||||||
tk.gocuiSetWH(startW, startH)
|
tk.gocuiSetWH(startW, startH)
|
||||||
// n.moveTo(startW, startH)
|
// n.moveTo(startW, startH)
|
||||||
|
|
2
view.go
2
view.go
|
@ -174,7 +174,7 @@ func (w *guiWidget) recreateView() {
|
||||||
}
|
}
|
||||||
if w.String() == "CLOUDFLARE_EMAIL" {
|
if w.String() == "CLOUDFLARE_EMAIL" {
|
||||||
w.showWidgetPlacement("w.String()="+w.String()+" w.label="+w.labelN+" "+w.cuiName)
|
w.showWidgetPlacement("w.String()="+w.String()+" w.label="+w.labelN+" "+w.cuiName)
|
||||||
w.dumpTree()
|
w.dumpTree("cloudflare")
|
||||||
}
|
}
|
||||||
log.Log(ERROR, "recreateView() END")
|
log.Log(ERROR, "recreateView() END")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue