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()) log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
return return
} }
w.showWidgetPlacement("dumpTree() " + s) w.dumpWidget("dumpTree() " + s)
for _, child := range w.children { for _, child := range w.children {
child.dumpTree(s) 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 s1 string
var pId int var pId int
if w.node.Parent == nil { 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 { func theHelp(g *gocui.Gui, v *gocui.View) error {
if showHelp { if me.showHelp {
helplayout() helplayout()
showHelp = false me.showHelp = false
if me.dropdownV == nil { if me.dropdownV == nil {
log.Info("FIXME: MADE me.dropdownV AGAIN")
me.dropdownV = makeDropdownView("addWidget() ddview") me.dropdownV = makeDropdownView("addWidget() ddview")
} }
me.dropdownV.Show() // me.dropdownV.Show()
} else { } else {
me.baseGui.DeleteView("help") me.baseGui.DeleteView("help")
showHelp = true me.showHelp = true
me.dropdownV.Hide() // me.dropdownV.Hide()
} }
return nil return nil
} }

View File

@ -35,7 +35,8 @@ func mouseMove(g *gocui.Gui) {
if me.supermouse { if me.supermouse {
for _, tk := range findByXY(w, h) { 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 { if w.WidgetType == widget.Checkbox {
return w return w
} }
w.showWidgetPlacement("findUnderMouse() found something unknown") w.dumpWidget("findUnderMouse() found something unknown")
found = w found = w
} }
// maybe something else was found // maybe something else was found

View File

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

View File

@ -29,7 +29,6 @@ import (
var me config var me config
var showDebug bool = true var showDebug bool = true
var showHelp bool = true
var redoWidgets bool = true var redoWidgets bool = true
// This is the window that is currently active // 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 writeMutex sync.Mutex // TODO: writeMutex protects locks the write process
fakefile *FakeFile // JUNK? used to attempt to write to the stdout window fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
dtoggle bool // is a dropdown or combobox currently active? dtoggle bool // is a dropdown or combobox currently active?
showHelp bool // toggle boolean for the help menu (deprecate?)
// debugging things // debugging things
ecount int // counts how many mouse and keyboard events have occurred 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.setColor(&colorActiveW)
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
w.active = false w.active = false
w.showWidgets() w.dumpWidget("DrawAt()")
} }
func (w *guiWidget) toggleTree() { func (w *guiWidget) toggleTree() {
@ -36,7 +36,7 @@ func (w *guiWidget) drawTree(draw bool) {
if w == nil { if w == nil {
return return
} }
w.showWidgetPlacement("drawTree()") w.dumpWidget("in drawTree()")
if draw { if draw {
// w.textResize() // w.textResize()
w.Show() w.Show()
@ -77,12 +77,12 @@ func (w *guiWidget) drawView() {
w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0) w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0)
if err == nil { if err == nil {
w.showWidgetPlacement("drawView()") w.dumpWidget("drawView() err")
log.Log(ERROR, "drawView() internal plugin error err = nil") log.Log(ERROR, "drawView() internal plugin error err = nil")
return return
} }
if !errors.Is(err, gocui.ErrUnknownView) { if !errors.Is(err, gocui.ErrUnknownView) {
w.showWidgetPlacement("drawView()") w.dumpWidget("drawView() err")
log.Log(ERROR, "drawView() internal plugin error error.IS()", err) log.Log(ERROR, "drawView() internal plugin error error.IS()", err)
return return
} }

View File

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