summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dropdown.go7
-rw-r--r--eventMouse.go12
-rw-r--r--eventMouseMove.go6
-rw-r--r--treeDraw.go2
4 files changed, 21 insertions, 6 deletions
diff --git a/dropdown.go b/dropdown.go
index 0d61b74..1523f35 100644
--- a/dropdown.go
+++ b/dropdown.go
@@ -7,7 +7,6 @@ import (
"fmt"
"strings"
- "github.com/awesome-gocui/gocui"
log "go.wit.com/log"
"go.wit.com/toolkits/tree"
"go.wit.com/widget"
@@ -104,9 +103,10 @@ func (tk *guiWidget) showDropdown() {
me.dropdownV.Show()
}
+/*
func hideDDview() error {
w, h := me.baseGui.MousePosition()
- log.Log(GOCUI, "hide dropdown menu() view msgMouseDown (w,h) =", w, h)
+ log.Log(GOCUI, "hide dropdown menu() view (w,h) =", w, h)
if me.dropdownV == nil {
return gocui.ErrUnknownView
}
@@ -119,7 +119,7 @@ func hideDDview() error {
func showDDview() error {
w, h := me.baseGui.MousePosition()
- log.Log(GOCUI, "show dropdown menu() view msgMouseDown (w,h) =", w, h)
+ log.Log(GOCUI, "show dropdown menu() view (w,h) =", w, h)
if me.dropdownV == nil {
return gocui.ErrUnknownView
}
@@ -129,6 +129,7 @@ func showDDview() error {
me.dropdownV.SetVisible(true)
return nil
}
+*/
// if there is a drop down view active, treat it like a dialog box and close it
func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string {
diff --git a/eventMouse.go b/eventMouse.go
index 63e0165..881ad6a 100644
--- a/eventMouse.go
+++ b/eventMouse.go
@@ -10,6 +10,7 @@ import (
"github.com/awesome-gocui/gocui"
"go.wit.com/log"
+ "go.wit.com/widget"
)
// event triggers when you push down on a mouse button
@@ -20,15 +21,16 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
h := initialMouseY
for _, tk := range findByXY(w, h) {
- tk.dumpWidget("mouseDown()")
+ tk.dumpWidget("msgDown()")
}
vx, vy, _, _, err := g.ViewPosition("msg")
if err == nil {
xOffset = initialMouseX - vx
yOffset = initialMouseY - vy
- msgMouseDown = true
}
+ log.Info("setting mousedown to true")
+ msgMouseDown = true
return nil
}
@@ -45,6 +47,7 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
dropdownUnclicked(w, h)
if msgMouseDown {
+ log.Info("setting mousedown to false")
msgMouseDown = false
} else if globalMouseDown {
globalMouseDown = false
@@ -62,6 +65,11 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
var found bool = false
for _, tk := range findByXY(mx, my) {
tk.dumpWidget("mouseDown()")
+ if tk.node.WidgetType == widget.Window {
+ log.Info("SENDING CLICK TO WINDOW")
+ tk.doWidgetClick(mx, my)
+ return nil
+ }
found = true
}
if !found {
diff --git a/eventMouseMove.go b/eventMouseMove.go
index a88f64c..b9b34fd 100644
--- a/eventMouseMove.go
+++ b/eventMouseMove.go
@@ -34,6 +34,7 @@ func mouseMove(g *gocui.Gui) {
}
if msgMouseDown {
+ log.Info("msgMouseDown == true")
// plugin will segfault if you don't keep this inside a check for msgMouseDown
// don't move this code out of here
for _, tk := range findByXY(w, h) {
@@ -41,6 +42,10 @@ func mouseMove(g *gocui.Gui) {
tk.moveNew(g)
return
}
+ if tk.node.WidgetType == widget.Label {
+ tk.moveNew(g)
+ return
+ }
}
}
@@ -59,6 +64,7 @@ func mouseMove(g *gocui.Gui) {
// this is how the window gets dragged around
func (tk *guiWidget) moveNew(g *gocui.Gui) {
mx, my := g.MousePosition()
+ tk.dumpWidget("moveNew() on " + tk.cuiName)
g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH+me.FramePadH, 0)
me.startOutputW = mx - xOffset
me.startOutputH = my - yOffset
diff --git a/treeDraw.go b/treeDraw.go
index 6f4501f..6a171e1 100644
--- a/treeDraw.go
+++ b/treeDraw.go
@@ -95,7 +95,7 @@ func (w *guiWidget) drawView() {
// set the binding for this gocui view now that it has been created
// gocui handles overlaps of views so it will run on the view that is clicked on
- me.baseGui.SetKeybinding(w.v.Name(), gocui.MouseLeft, gocui.ModNone, click)
+ // me.baseGui.SetKeybinding(w.v.Name(), gocui.MouseLeft, gocui.ModNone, click)
// this actually sends the text to display to gocui
w.v.Wrap = true