diff options
| author | Jeff Carr <[email protected]> | 2025-01-31 09:02:35 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-31 13:47:45 -0600 |
| commit | 9f38585892d08690dde1b67b9a01006af308a949 (patch) | |
| tree | 6f1d57dbee43651a85f7104fbfe9b08bb22afab0 /gocui.go | |
| parent | 1a1881aa4e39e256126972c0cbe7f0db93ee20ec (diff) | |
I'm trying to make this clearer to understand
Diffstat (limited to 'gocui.go')
| -rw-r--r-- | gocui.go | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/gocui.go b/gocui.go deleted file mode 100644 index c7f4011..0000000 --- a/gocui.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2017-2025 WIT.COM Inc. All rights reserved. -// Use of this source code is (now) governed by the GPL 3.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 ( - "errors" - "fmt" - - "github.com/awesome-gocui/gocui" - - "go.wit.com/log" -) - -// Thanks to the gocui developers -- your package kicks ass -// This function is called on every event. It is a callback function from the gocui package -// which has an excellent implementation. While gocui handles things like text highlighting -// and the layout of the text areas -- also things like handling SIGWINCH and lots of really -// complicated console handling, it sends events here in a clean way. -// This is equivalent to the linux command xev (apt install x11-utils) -func gocuiEvent(g *gocui.Gui) error { - me.ecount += 1 - maxX, maxY := g.Size() - mx, my := g.MousePosition() - log.Verbose("handleEvent() START", maxX, maxY, mx, my, msgMouseDown) - if _, err := g.View("msg"); msgMouseDown && err == nil { - moveMsg(g) - } - if widgetView, _ := g.View("msg"); widgetView == nil { - log.Log(NOW, "handleEvent() create output widget now", maxX, maxY, mx, my) - makeOutputWidget(g, "this is a create before a mouse click") - if me.logStdout != nil { - // setOutput(me.logStdout) - // me.logStdout.Write("test out") - w := me.logStdout.TK.(*guiWidget) - msg := fmt.Sprintf("test out gocuiEvent() %d\n", me.ecount) - w.Write([]byte(msg)) - // log.CaptureMode(w) - log.Log(NOW, "logStdout test out") - } - } else { - log.Verbose("output widget already exists", maxX, maxY, mx, my) - } - mouseMove(g) - log.Verbose("handleEvent() END ", maxX, maxY, mx, my, msgMouseDown) - return nil -} - -func dragOutputWindow() { -} - -// turns off the frame on the global window -func setFrame(b bool) { - // TODO: figure out what this might be useful for - // what is this do? I made it just 2 lines for now. Is this useful for something? - v := SetView("global", 5, 10, 5, 10, 0) // x0, x1, y1, y2, overlap - if v == nil { - log.Log(ERROR, "setFrame() global failed") - } - v.Frame = b -} - -func quit(g *gocui.Gui, v *gocui.View) error { - return gocui.ErrQuit -} - -func SetView(name string, x0, y0, x1, y1 int, overlaps byte) *gocui.View { - if me.baseGui == nil { - log.Log(ERROR, "SetView() ERROR: me.baseGui == nil") - return nil - } - - v, err := me.baseGui.SetView(name, x0, y0, x1, y1, overlaps) - if err != nil { - if !errors.Is(err, gocui.ErrUnknownView) { - log.Log(ERROR, "SetView() global failed on name =", name) - } - return nil - } - return v -} |
