diff --git a/eventBindings.go b/eventBindings.go index 93663b6..5eda90b 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -61,9 +61,33 @@ func setSuperMouse(g *gocui.Gui, v *gocui.View) error { return nil } +var wtf bool + // use this to test code ideas func theNotsure(g *gocui.Gui, v *gocui.View) error { log.Info("got keypress 2. now what?") + // closes anything under your mouse + w, h := g.MousePosition() + for _, tk := range findByXY(w, h) { + if tk.node.WidgetType == widget.Stdout { + tk.dumpWidget("theNotsure() DrawAt STDOUT") + tk.DrawAt(10, 10) + if wtf { + log.Log(GOCUI, "set visible false") + tk.deleteView() + // tk.SetVisible(false) + wtf = false + } else { + log.Log(GOCUI, "set visible true") + tk.drawView() + // tk.SetVisible(true) + wtf = true + } + continue + } + } + + /* closes anything under your mouse w, h := g.MousePosition() for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Stdout { @@ -73,6 +97,7 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error { tk.dumpWidget("theNotsure() HIDDING") tk.Hide() } + */ return nil } diff --git a/eventMouseMove.go b/eventMouseMove.go index 165c865..d67c3c3 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -38,7 +38,6 @@ func mouseMove(g *gocui.Gui) { // don't move this code out of here for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Stdout { - // moveMsg(g) tk.moveNew(g) return } diff --git a/place.go b/place.go index 35b045a..e0c3097 100644 --- a/place.go +++ b/place.go @@ -97,6 +97,9 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) { case widget.Box: tk.placeBox(startW, startH) return 0, 0 + case widget.Stdout: + tk.setStdoutWH(startW, startH) + return tk.gocuiSize.Width(), tk.gocuiSize.Height() case widget.Group: // move the group to the parent's next location tk.gocuiSetWH(startW, startH) @@ -265,3 +268,13 @@ func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) { tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + 1 } } + +func (tk *guiWidget) setStdoutWH(sizeW, sizeH int) { + w := 120 + h := 40 + + tk.gocuiSize.w0 = sizeW + tk.gocuiSize.h0 = sizeH + tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + tk.gocuiSize.h1 = tk.gocuiSize.h0 + h +}