diff options
Diffstat (limited to 'gocui/mouse.go')
| -rw-r--r-- | gocui/mouse.go | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/gocui/mouse.go b/gocui/mouse.go index 50c2834..9b1096d 100644 --- a/gocui/mouse.go +++ b/gocui/mouse.go @@ -8,6 +8,8 @@ import ( "errors" "fmt" "github.com/awesome-gocui/gocui" + + "go.wit.com/log" ) // this function uses the mouse position to highlight & unhighlight things @@ -24,7 +26,7 @@ func mouseMove(g *gocui.Gui) { func msgDown(g *gocui.Gui, v *gocui.View) error { initialMouseX, initialMouseY = g.MousePosition() - log(true, "msgDown() X,Y", initialMouseX, initialMouseY) + log.Log(NOW, "msgDown() X,Y", initialMouseX, initialMouseY) if vx, vy, _, _, err := g.ViewPosition("msg"); err == nil { xOffset = initialMouseX - vx yOffset = initialMouseY - vy @@ -35,7 +37,7 @@ func msgDown(g *gocui.Gui, v *gocui.View) error { func hideDDview() error { w, h := me.baseGui.MousePosition() - log(true, "hide dropdown menu() view msgMouseDown (w,h) =", w, h) + log.Log(NOW, "hide dropdown menu() view msgMouseDown (w,h) =", w, h) if (me.ddview == nil) { return gocui.ErrUnknownView } @@ -48,7 +50,7 @@ func hideDDview() error { func showDDview() error { w, h := me.baseGui.MousePosition() - log(true, "show dropdown menu() view msgMouseDown (w,h) =", w, h) + log.Log(NOW, "show dropdown menu() view msgMouseDown (w,h) =", w, h) if (me.ddview == nil) { return gocui.ErrUnknownView } @@ -61,23 +63,23 @@ func showDDview() error { func mouseUp(g *gocui.Gui, v *gocui.View) error { w, h := g.MousePosition() - log(true, "mouseUp() view msgMouseDown (check here for dropdown menu click) (w,h) =", w, h) + log.Log(NOW, "mouseUp() view msgMouseDown (check here for dropdown menu click) (w,h) =", w, h) if (me.ddClicked) { me.ddClicked = false - log(true, "mouseUp() ddview is the thing that was clicked", w, h) - log(true, "mouseUp() find out what the string is here", w, h, me.ddview.tk.gocuiSize.h1) + log.Log(NOW, "mouseUp() ddview is the thing that was clicked", w, h) + log.Log(NOW, "mouseUp() find out what the string is here", w, h, me.ddview.tk.gocuiSize.h1) var newZone string = "" if (me.ddNode != nil) { value := h - me.ddview.tk.gocuiSize.h0 - 1 - log(true, "mouseUp() me.ddview.tk.gocuiSize.h1 =", me.ddview.tk.gocuiSize.h1) - log(true, "mouseUp() me.ddNode.vals =", me.ddNode.vals) + log.Log(NOW, "mouseUp() me.ddview.tk.gocuiSize.h1 =", me.ddview.tk.gocuiSize.h1) + log.Log(NOW, "mouseUp() me.ddNode.vals =", me.ddNode.vals) valsLen := len(me.ddNode.vals) - log(true, "mouseUp() value =", value, "valsLen =", valsLen) - log(true, "mouseUp() me.ddNode.vals =", me.ddNode.vals) + log.Log(NOW, "mouseUp() value =", value, "valsLen =", valsLen) + log.Log(NOW, "mouseUp() me.ddNode.vals =", me.ddNode.vals) if ((value >= 0) && (value < valsLen)) { newZone = me.ddNode.vals[value] - log(true, "mouseUp() value =", value, "newZone =", newZone) + log.Log(NOW, "mouseUp() value =", value, "newZone =", newZone) } } hideDDview() @@ -124,10 +126,10 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error { msg := fmt.Sprintf("Mouse really down at: %d,%d", mx, my) + "foobar" if (test == me.ddview) { if (me.ddview.Visible()) { - log(true, "hide DDview() Mouse really down at:", mx, my) + log.Log(NOW, "hide DDview() Mouse really down at:", mx, my) hideDDview() } else { - log(true, "show DDview() Mouse really down at:", mx, my) + log.Log(NOW, "show DDview() Mouse really down at:", mx, my) showDDview() } return nil @@ -138,7 +140,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error { } else if x+len(msg)+1 > maxX-1 { x = maxX - 1 - len(msg) - 1 } - log(true, "mouseDown() about to write out message to 'globalDown' view. msg =", msg) + log.Log(NOW, "mouseDown() about to write out message to 'globalDown' view. msg =", msg) if v, err := g.SetView("globalDown", x, my-1, x+len(msg)+1, my+1, 0); err != nil { if !errors.Is(err, gocui.ErrUnknownView) { return err |
