kinda don't believe it, but maybe new mouseMove()
This commit is contained in:
parent
2062060dac
commit
9a3f9d0991
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue