misc code cleanups

This commit is contained in:
Jeff Carr 2025-02-04 12:45:52 -06:00
parent 1867bae62c
commit 652cf2b73b
4 changed files with 19 additions and 38 deletions

View File

@ -79,24 +79,24 @@ func (tk *guiWidget) verifyRect() bool {
// return false
}
var ok bool = true
if vw0 != tk.gocuiSize.w0 {
if vw0 != tk.full.w0 {
// log.Info("verifyRect() FIXING w0", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.w0, "w0 =", vw0)
tk.gocuiSize.w0 = vw0
tk.full.w0 = vw0
ok = false
}
if vw1 != tk.gocuiSize.w1 {
if vw1 != tk.full.w1 {
// log.Info("verifyRect() FIXING w1", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.w1, "w1 =", vw1)
tk.gocuiSize.w1 = vw1
tk.full.w1 = vw1
ok = false
}
if vh0 != tk.gocuiSize.h0 {
if vh0 != tk.full.h0 {
// log.Info("verifyRect() FIXING h0", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.h0)
tk.gocuiSize.h0 = vh0
tk.full.h0 = vh0
ok = false
}
if vh1 != tk.gocuiSize.h1 {
if vh1 != tk.full.h1 {
// log.Info("verifyRect() FIXING h1", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.h1)
tk.gocuiSize.h1 = vh1
tk.full.h1 = vh1
ok = false
}
if !ok {
@ -145,9 +145,9 @@ var notsure *guiWidget
func theNotsure(g *gocui.Gui, v *gocui.View) error {
log.Info("got keypress 2. now what?")
wRoot := me.treeRoot.TK.(*guiWidget)
wRoot.redoWindows(0, 0)
// closes anything under your mouse
w, h := g.MousePosition()
wRoot.redoWindows(w, h)
// closes anything under your mouse
if notsure == nil {
// notsure = makeDropdownView("addWidget() notsure")
notsure = addDropdownTK(-118)

View File

@ -13,8 +13,7 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
if tk.node.WidgetType != widget.Window {
return
}
// might make the green box the right size
tk.setFullSize()
tk.setFullSize() // might make the green box the right size
// draw the current window
// w = tk.gocuiSize.w0 + 4

View File

@ -92,33 +92,20 @@ func mouseMove(g *gocui.Gui) {
func (tk *guiWidget) moveNew() {
w, h := me.baseGui.MousePosition()
if tk.node.WidgetType == widget.Window {
/*
w1, h1 := tk.Size()
g.SetView(tk.cuiName, w, h, w+w1, h+h1, 0)
tk.verifyRect()
s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)
*/
tk.gocuiSize.w0 = w
tk.gocuiSize.h0 = h
tk.DrawAt(w, h)
tk.redrawWindow(w, h)
s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)
tk.dumpWidget(s)
return
}
if tk.node.WidgetType == widget.Flag {
// outputW, outputH := tk.Size()
// g.SetView(tk.cuiName, w-xOffset, h-yOffset, w-xOffset+outputW+20, h-yOffset+outputH+me.FramePadH+20, 0)
me.baseGui.SetView(tk.cuiName, w-3, h-3, w+20, h+20, 0)
tk.verifyRect()
s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName)
tk.dumpWidget(s)
// me.startOutputW = w - xOffset
// me.startOutputH = h - yOffset
// g.SetViewOnBottom(tk.cuiName)
return
} else {
// log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
}
// tk.dumpWidget("moveNew() MSG" + tk.cuiName)
outputW := 180
outputH := 40
@ -127,6 +114,7 @@ func (tk *guiWidget) moveNew() {
me.startOutputH = h - yOffset
me.baseGui.SetViewOnBottom("msg")
}
}
func createStdout(g *gocui.Gui) bool {
makeOutputWidget(g, "this is a create before a mouse click")

View File

@ -61,12 +61,6 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget {
func (tk *guiWidget) setFullSize() rectType {
r := tk.getFullSize()
/*
r.w0 = tk.gocuiSize.w0
r.w1 = tk.gocuiSize.w1
r.h0 = tk.gocuiSize.h0
r.h1 = tk.gocuiSize.h1
*/
var changed bool
if tk.full.w0 != r.w0 {
tk.full.w0 = r.w0