summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-31 16:15:41 -0600
committerJeff Carr <[email protected]>2025-01-31 22:08:29 -0600
commit39e851c76c3154390e7835e995b8aad7638d5e73 (patch)
tree97bc2898bdebd6778370ed2f5836c52dd1ef7c6e
parentbac14a675bb0cf284809ff31db98f4a3799fe1f6 (diff)
very quiet output now with good debugging options
-rw-r--r--Makefile3
-rw-r--r--eventMouse.go8
-rw-r--r--junk1.go209
3 files changed, 8 insertions, 212 deletions
diff --git a/Makefile b/Makefile
index bf73fc0..853c4ff 100644
--- a/Makefile
+++ b/Makefile
@@ -44,5 +44,8 @@ redomod:
GO111MODULE= go mod init
GO111MODULE= go mod tidy
+view:
+ autogenpb --proto view.proto
+
view.pb.go: view.proto
autogenpb --proto view.proto
diff --git a/eventMouse.go b/eventMouse.go
index 8840359..92e09eb 100644
--- a/eventMouse.go
+++ b/eventMouse.go
@@ -75,9 +75,11 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
w, h := g.MousePosition()
// useful to debug everything that is being clicked on
- for _, tk := range findByXY(w, h) {
- log.Log(GOCUI, fmt.Sprintf("findByXY() mouseUp() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
- }
+ /*
+ for _, tk := range findByXY(w, h) {
+ log.Log(GOCUI, fmt.Sprintf("findByXY() mouseUp() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
+ }
+ */
dropdownUnclicked(w, h)
diff --git a/junk1.go b/junk1.go
deleted file mode 100644
index 3f833e2..0000000
--- a/junk1.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
- "fmt"
-
- "github.com/awesome-gocui/gocui"
-
- "go.wit.com/log"
-)
-
-func OLDdefaultKeybindings(g *gocui.Gui) error {
- if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
- return err
- }
- // setup ctrl+z
- keyForced, modForced := gocui.MustParse("ctrl+z")
- if err := g.SetKeybinding("", keyForced, modForced, handle_ctrl_z); err != nil {
- log.Error(err)
- }
- for _, n := range []string{"but1", "but2", "help", "but3"} {
- if err := g.SetKeybinding(n, gocui.MouseLeft, gocui.ModNone, showMsg); err != nil {
- return err
- }
- }
- if err := g.SetKeybinding("", gocui.MouseRelease, gocui.ModNone, mouseUp); err != nil {
- return err
- }
- // mouseDown() runs whenever you click on an unknown view (?)
- if err := g.SetKeybinding("", gocui.MouseLeft, gocui.ModNone, mouseDown); err != nil {
- return err
- }
- if err := g.SetKeybinding("", gocui.MouseLeft, gocui.ModMouseCtrl, ctrlDown); err != nil {
- return err
- }
- // if err := g.SetKeybinding(w.v.Name(), gocui.MouseLeft, gocui.ModNone, click); err != nil {
- // return err
- // }
- /*
- if err := g.SetKeybinding("", gocui.MouseLeft, gocui.ModNone, globalDown); err != nil {
- return err
- }
- */
- if err := g.SetKeybinding("msg", gocui.MouseLeft, gocui.ModNone, msgDown); err != nil {
- return err
- }
- addDebugKeys(g)
- return nil
-}
-
-func addDebugKeys(g *gocui.Gui) {
- // show debugging buttons
- g.SetKeybinding("", 'd', gocui.ModNone, theLetterD)
-
- // display the help menu
- g.SetKeybinding("", '?', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- if showHelp {
- helplayout()
- showHelp = false
- if me.dropdownV == nil {
- me.dropdownV = makeDropdownView("addWidget() ddview")
- }
- me.dropdownV.Show()
- } else {
- me.baseGui.DeleteView("help")
- showHelp = true
- me.dropdownV.Hide()
- }
- return nil
- })
-
- // redraw all the widgets
- g.SetKeybinding("", 'r', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- var w *guiWidget
- w = me.treeRoot.TK.(*guiWidget)
- if redoWidgets {
- wRoot := me.treeRoot.TK.(*guiWidget)
- wRoot.redoWindows(0, 0)
- redoWidgets = false
- } else {
- w.hideWidgets()
- redoWidgets = true
- }
- return nil
- })
-
- // find under mouse
- g.SetKeybinding("", 'f', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- w, h := g.MousePosition()
- for _, tk := range findByXY(w, h) {
- log.Log(GOCUI, fmt.Sprintf("findByXY() 'f' key %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String()))
- }
- return nil
- })
- // hide all widgets
- g.SetKeybinding("", 'h', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- var w *guiWidget
- w = me.treeRoot.TK.(*guiWidget)
- w.hideWidgets()
- return nil
- })
-
- // show all widgets
- g.SetKeybinding("", 's', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- var w *guiWidget
- w = me.treeRoot.TK.(*guiWidget)
- w.showWidgets()
- return nil
- })
-
- // list all widgets
- g.SetKeybinding("", 'L', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- me.treeRoot.ListWidgets()
-
- tk := me.logStdout.TK.(*guiWidget)
- // msg := fmt.Sprintf("test out kb %d\n", ecount)
- // tk.Write([]byte(msg))
- if tk == nil {
- log.Log(ERROR, "tk = nil")
- }
- if tk.v == nil {
- log.Log(ERROR, "tk.v = nil")
- } else {
- log.Log(ERROR, "setting log.CaptureMode(tk.v)")
- log.Log(ERROR, "setting log.CaptureMode(tk.v)")
- log.CaptureMode(tk)
- }
- return nil
- })
-
- // list all widgets with positions
- g.SetKeybinding("", 'M', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- w := me.treeRoot.TK.(*guiWidget)
- w.dumpTree("MM")
- return nil
- })
-
- // redo windows
- g.SetKeybinding("", 'w', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- wRoot := me.treeRoot.TK.(*guiWidget)
- wRoot.redoWindows(0, 0)
- return nil
- })
-
- // log to output window
- g.SetKeybinding("", 'o', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- log.Log(ERROR, "TODO: trying re-implement this")
- tk := me.logStdout.TK.(*guiWidget)
- if tk == nil {
- log.Log(ERROR, "tk = nil")
- }
- if tk.v == nil {
- log.Log(ERROR, "tk.v = nil")
- }
- if tk.Visible() {
- log.Log(ERROR, "setting visible to false")
- tk.SetVisible(false)
- // setOutput(os.Stdout)
- } else {
- log.Log(ERROR, "setting visible to true")
- tk.SetVisible(true)
- // setOutput(me.logStdout.tk)
- }
- return nil
- })
-
- // exit
- g.SetKeybinding("", 'q', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- standardExit()
- return nil
- })
- g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- standardExit()
- return nil
- })
- g.SetKeybinding("", gocui.KeyCtrlD, gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- if showDebug {
- me.myTree.SendEnableDebugger()
- }
- return nil
- })
- g.SetKeybinding("", gocui.KeyCtrlV, gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- return nil
- })
-
- // panic
- g.SetKeybinding("", 'p', gocui.ModNone,
- func(g *gocui.Gui, v *gocui.View) error {
- standardClose()
- panic("forced panic in gocui")
- return nil
- })
-}