summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eventBindings.go2
-rw-r--r--eventMouseMove.go7
-rw-r--r--stdoutShow.go13
-rw-r--r--structs.go8
4 files changed, 14 insertions, 16 deletions
diff --git a/eventBindings.go b/eventBindings.go
index 04cdd77..93663b6 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -105,7 +105,7 @@ func doPanic(g *gocui.Gui, v *gocui.View) error {
func dumpWidgets(g *gocui.Gui, v *gocui.View) error {
me.treeRoot.ListWidgets()
- tk := me.logStdout.TK.(*guiWidget)
+ tk := me.logStdout
// msg := fmt.Sprintf("test out kb %d\n", ecount)
// tk.Write([]byte(msg))
if tk == nil {
diff --git a/eventMouseMove.go b/eventMouseMove.go
index b42f324..165c865 100644
--- a/eventMouseMove.go
+++ b/eventMouseMove.go
@@ -63,13 +63,14 @@ func (tk *guiWidget) moveNew(g *gocui.Gui) {
if !me.movingMsg && (mx != initialMouseX || my != initialMouseY) {
me.movingMsg = true
}
- // tk.MoveToOffset(mx-xOffset, my-yOffset)
+ // tk.DrawAt(mx-xOffset, my-yOffset)
g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH+me.FramePadH, 0)
me.startOutputW = mx - xOffset
me.startOutputH = my - yOffset
g.SetViewOnBottom("msg")
}
+/*
// this is how the window gets dragged around
func moveMsg(g *gocui.Gui) {
mx, my := g.MousePosition()
@@ -81,14 +82,14 @@ func moveMsg(g *gocui.Gui) {
me.startOutputH = my - yOffset
g.SetViewOnBottom("msg")
}
+*/
func createStdout(g *gocui.Gui) bool {
if widgetView, _ := g.View("msg"); widgetView == nil {
makeOutputWidget(g, "this is a create before a mouse click")
if me.logStdout != nil {
- w := me.logStdout.TK.(*guiWidget)
msg := fmt.Sprintf("test out gocuiEvent() %d\n", me.ecount)
- w.Write([]byte(msg))
+ me.logStdout.Write([]byte(msg))
log.Log(NOW, "logStdout test out")
}
return true
diff --git a/stdoutShow.go b/stdoutShow.go
index 4ae6247..2b374e5 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -52,11 +52,9 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
a.ParentId = 0
// n := addNode(a)
n := me.myTree.AddNode(a)
- n.TK = initWidget(n)
- me.logStdout = n
+ me.logStdout = initWidget(n)
- var tk *guiWidget
- tk = me.logStdout.TK.(*guiWidget)
+ tk := me.logStdout
// tk.gocuiSize.w0 = maxX - 32
// tk.gocuiSize.h0 = maxY / 2
tk.gocuiSize.w0 = me.startOutputW
@@ -75,7 +73,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
// v, err = g.SetView("msg", 3, 3, 30, 30, 0)
if me.startOutputW == 0 {
- me.startOutputW = maxX - 32
+ me.startOutputW = maxX - 132
}
if me.startOutputW == 0 {
me.startOutputH = maxY / 2
@@ -96,9 +94,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
log.Log(NOW, "makeoutputwindow() msg == nil. WTF now? err =", err)
return nil
} else {
- var tk *guiWidget
- tk = me.logStdout.TK.(*guiWidget)
- tk.v = v
+ me.logStdout.v = v
}
v.Clear()
@@ -107,5 +103,6 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
fmt.Fprintln(v, "figure out how to capture STDOUT to here\n"+stringFromMouseClick)
g.SetViewOnBottom("msg")
// g.SetViewOnBottom(v.Name())
+ me.logStdout.DrawAt(50, 50)
return v
}
diff --git a/structs.go b/structs.go
index c6d8c69..902c3fc 100644
--- a/structs.go
+++ b/structs.go
@@ -35,7 +35,7 @@ type config struct {
myTree *tree.TreeInfo // ?
ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed
currentWindow *guiWidget // this is the current tab or window to show
- logStdout *tree.Node // where to show STDOUT
+ logStdout *guiWidget // where to show STDOUT
startOutputW int // ?
startOutputH int // ?
helpLabel *gocui.View // ?
@@ -63,7 +63,7 @@ type config struct {
menubar bool // for windows
stretchy bool // expand things like buttons to the maximum size
margin bool // add space around the frames of windows
- writeMutex sync.Mutex // TODO: writeMutex protects locks the write process
+ writeMutex sync.Mutex // writeMutex protects writes to *guiWidget (it's global right now maybe)
fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
dtoggle bool // is a dropdown or combobox currently active?
showHelp bool // toggle boolean for the help menu (deprecate?)
@@ -131,8 +131,8 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
w.tainted = true
me.writeMutex.Lock()
defer me.writeMutex.Unlock()
- var tk *guiWidget
- tk = me.logStdout.TK.(*guiWidget)
+
+ tk := me.logStdout
if tk.v == nil {
// optionally write the output to /tmp
s := fmt.Sprint(string(p))