2023-03-01 11:35:36 -06:00
|
|
|
package gui
|
|
|
|
|
|
|
|
// Let's you toggle on and off the various types of debugging output
|
|
|
|
// These checkboxes should be in the same order as the are printed
|
2023-03-12 08:47:16 -05:00
|
|
|
func (n *Node) DebugFlags(makeWindow bool) {
|
2023-03-01 11:35:36 -06:00
|
|
|
var w, g *Node
|
|
|
|
|
|
|
|
// Either:
|
|
|
|
// make a new window
|
|
|
|
// make a new tab in the existing window
|
|
|
|
if (makeWindow) {
|
|
|
|
Config.Title = "Debug Flags"
|
|
|
|
Config.Width = 300
|
|
|
|
Config.Height = 400
|
|
|
|
w = NewWindow()
|
|
|
|
w.Custom = w.StandardClose
|
|
|
|
} else {
|
2023-03-03 14:41:38 -06:00
|
|
|
w = n.NewTab("Flags")
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
g = w.NewGroup("Show")
|
2023-03-01 11:35:36 -06:00
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
g.NewButton("Dump Flags", func () {
|
|
|
|
ShowDebugValues()
|
|
|
|
})
|
|
|
|
|
|
|
|
g.NewButton("All On", func () {
|
2023-03-01 11:35:36 -06:00
|
|
|
SetDebug(true)
|
|
|
|
})
|
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
g.NewButton("All Off", func () {
|
2023-03-01 11:35:36 -06:00
|
|
|
SetDebug(false)
|
|
|
|
})
|
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
g = w.NewGroup("List")
|
2023-03-23 12:35:12 -05:00
|
|
|
g = g.NewGrid("flags grid", 2, 2)
|
2023-03-01 11:35:36 -06:00
|
|
|
// generally useful debugging
|
2023-03-23 12:35:12 -05:00
|
|
|
cb1 := g.NewCheckbox("debug Gui")
|
|
|
|
g.NewLabel("like verbose=1")
|
2023-03-01 11:35:36 -06:00
|
|
|
cb1.Custom = func() {
|
|
|
|
debugGui = cb1.widget.B
|
2023-04-03 10:26:47 -05:00
|
|
|
log(debugGui, "Custom() n.widget =", cb1.Name, cb1.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
2023-03-03 14:41:38 -06:00
|
|
|
// errors. by default these always output somewhere
|
2023-03-23 12:35:12 -05:00
|
|
|
cbE := g.NewCheckbox("debug Error")
|
|
|
|
g.NewLabel("(bad things. default=true)")
|
2023-03-03 14:41:38 -06:00
|
|
|
cbE.Custom = func() {
|
2023-03-12 08:47:16 -05:00
|
|
|
SetFlag("Error", cbE.widget.B)
|
2023-03-03 14:41:38 -06:00
|
|
|
}
|
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
// debugging that will show you things like mouse clicks, user inputing text, etc
|
|
|
|
// also set toolkit.DebugChange
|
2023-03-23 12:35:12 -05:00
|
|
|
cb2 := g.NewCheckbox("debug Change")
|
|
|
|
g.NewLabel("keyboard and mouse events")
|
2023-03-01 11:35:36 -06:00
|
|
|
cb2.Custom = func() {
|
2023-03-12 08:47:16 -05:00
|
|
|
SetFlag("Change", cb2.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// supposed to tell if you are going to dump full variable output
|
2023-03-23 12:35:12 -05:00
|
|
|
cb3 := g.NewCheckbox("debug Dump")
|
|
|
|
g.NewLabel("show lots of output")
|
2023-03-01 11:35:36 -06:00
|
|
|
cb3.Custom = func() {
|
2023-03-12 08:47:16 -05:00
|
|
|
SetFlag("Dump", cbE.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
cb4 := g.NewCheckbox("debug Tabs")
|
|
|
|
g.NewLabel("tabs and windows")
|
2023-03-01 11:35:36 -06:00
|
|
|
cb4.Custom = func() {
|
2023-03-12 08:47:16 -05:00
|
|
|
SetFlag("Tabs", cb4.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
cb6 := g.NewCheckbox("debug Node")
|
|
|
|
g.NewLabel("the binary tree)")
|
2023-03-12 08:47:16 -05:00
|
|
|
cb6.Custom = func() {
|
2023-03-23 12:35:12 -05:00
|
|
|
SetFlag("Node", cb6.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
// should show you when things go into or come back from the plugin
|
2023-03-23 12:35:12 -05:00
|
|
|
cb5 := g.NewCheckbox("debug Plugin")
|
|
|
|
g.NewLabel("plugin interaction)")
|
2023-03-12 08:47:16 -05:00
|
|
|
cb5.Custom = func() {
|
|
|
|
SetFlag("Plugin", cb5.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// turns on debugging inside the plugin toolkit
|
2023-03-23 12:35:12 -05:00
|
|
|
cb7 := g.NewCheckbox("debug Toolkit")
|
|
|
|
g.NewLabel("the plugin internals)")
|
2023-03-01 11:35:36 -06:00
|
|
|
cb7.Custom = func() {
|
2023-03-03 14:41:38 -06:00
|
|
|
// SetDebugToolkit(cb7.widget.B)
|
|
|
|
SetFlag("Toolkit", cb7.widget.B)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|
|
|
|
}
|