lots of code cleanup and debugging work

This commit is contained in:
Jeff Carr 2025-02-01 13:43:51 -06:00
parent ebb03139bb
commit e4f0524bdf
9 changed files with 19 additions and 17 deletions

View File

@ -16,14 +16,15 @@ func (w *guiWidget) dumpTree(s string) {
log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
return
}
w.showWidgetPlacement("dumpTree() " + s)
w.dumpWidget("dumpTree() " + s)
for _, child := range w.children {
child.dumpTree(s)
}
}
func (w *guiWidget) showWidgetPlacement(s string) {
// a standard function to print out information about a widget
func (w *guiWidget) dumpWidget(s string) {
var s1 string
var pId int
if w.node.Parent == nil {

View File

@ -164,17 +164,18 @@ func theLetterD(g *gocui.Gui, v *gocui.View) error {
}
func theHelp(g *gocui.Gui, v *gocui.View) error {
if showHelp {
if me.showHelp {
helplayout()
showHelp = false
me.showHelp = false
if me.dropdownV == nil {
log.Info("FIXME: MADE me.dropdownV AGAIN")
me.dropdownV = makeDropdownView("addWidget() ddview")
}
me.dropdownV.Show()
// me.dropdownV.Show()
} else {
me.baseGui.DeleteView("help")
showHelp = true
me.dropdownV.Hide()
me.showHelp = true
// me.dropdownV.Hide()
}
return nil
}

View File

@ -35,7 +35,8 @@ func mouseMove(g *gocui.Gui) {
if me.supermouse {
for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() mouseMove() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
tk.dumpWidget("findByXY()")
// log.Log(GOCUI, fmt.Sprintf("findByXY() mouseMove() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
}
}

View File

@ -85,7 +85,7 @@ func findUnderMouse() *guiWidget {
if w.WidgetType == widget.Checkbox {
return w
}
w.showWidgetPlacement("findUnderMouse() found something unknown")
w.dumpWidget("findUnderMouse() found something unknown")
found = w
}
// maybe something else was found

View File

@ -1,4 +1,3 @@
//gjcarro:pjcarrlugin
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

View File

@ -29,7 +29,6 @@ import (
var me config
var showDebug bool = true
var showHelp bool = true
var redoWidgets bool = true
// This is the window that is currently active
@ -100,6 +99,7 @@ type config struct {
writeMutex sync.Mutex // TODO: writeMutex protects locks the write process
fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
dtoggle bool // is a dropdown or combobox currently active?
showHelp bool // toggle boolean for the help menu (deprecate?)
// debugging things
ecount int // counts how many mouse and keyboard events have occurred

View File

@ -93,5 +93,5 @@ func addWidget(n *tree.Node) {
}
*/
}
nw.showWidgetPlacement("addWidget()")
nw.dumpWidget("in addWidget()")
}

View File

@ -18,7 +18,7 @@ func (w *guiWidget) DrawAt(offsetW, offsetH int) {
w.setColor(&colorActiveW)
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
w.active = false
w.showWidgets()
w.dumpWidget("DrawAt()")
}
func (w *guiWidget) toggleTree() {
@ -36,7 +36,7 @@ func (w *guiWidget) drawTree(draw bool) {
if w == nil {
return
}
w.showWidgetPlacement("drawTree()")
w.dumpWidget("in drawTree()")
if draw {
// w.textResize()
w.Show()
@ -77,12 +77,12 @@ func (w *guiWidget) drawView() {
w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0)
if err == nil {
w.showWidgetPlacement("drawView()")
w.dumpWidget("drawView() err")
log.Log(ERROR, "drawView() internal plugin error err = nil")
return
}
if !errors.Is(err, gocui.ErrUnknownView) {
w.showWidgetPlacement("drawView()")
w.dumpWidget("drawView() err")
log.Log(ERROR, "drawView() internal plugin error error.IS()", err)
return
}

View File

@ -91,7 +91,7 @@ func (w *guiWidget) hideFake() {
func (w *guiWidget) showFake() {
if w.isFake {
w.drawView()
w.showWidgetPlacement("showFake:")
w.dumpWidget("in showFake()")
}
for _, child := range w.children {
child.showFake()