start working on movingMsg
This commit is contained in:
parent
3d5ee3f89b
commit
4dad234532
|
@ -50,8 +50,8 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
|
||||||
if msgMouseDown {
|
if msgMouseDown {
|
||||||
msgMouseDown = false
|
msgMouseDown = false
|
||||||
if movingMsg {
|
if me.movingMsg {
|
||||||
movingMsg = false
|
me.movingMsg = false
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
g.DeleteView("msg")
|
g.DeleteView("msg")
|
||||||
|
|
|
@ -44,17 +44,24 @@ func mouseMove(g *gocui.Gui) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// this is how the window gets dragged around
|
||||||
func dragOutputWindow() {
|
func moveMsg(g *gocui.Gui) {
|
||||||
log.Log(GOCUI, "todo: make dragOutputWindow")
|
mx, my := g.MousePosition()
|
||||||
|
if !me.movingMsg && (mx != initialMouseX || my != initialMouseY) {
|
||||||
|
me.movingMsg = true
|
||||||
|
}
|
||||||
|
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 somehow is letting me drag around the stdout window
|
||||||
func mouseMoveOld(g *gocui.Gui) bool {
|
func mouseMoveOld(g *gocui.Gui) bool {
|
||||||
me.ecount += 1
|
me.ecount += 1
|
||||||
maxX, maxY := g.Size()
|
maxX, maxY := g.Size()
|
||||||
mx, my := g.MousePosition()
|
mx, my := g.MousePosition()
|
||||||
log.Log(NOW, "handleEvent() START", maxX, maxY, mx, my, msgMouseDown)
|
// log.Log(NOW, "handleEvent() START", maxX, maxY, mx, my, msgMouseDown)
|
||||||
if _, err := g.View("msg"); msgMouseDown && err == nil {
|
if _, err := g.View("msg"); msgMouseDown && err == nil {
|
||||||
moveMsg(g)
|
moveMsg(g)
|
||||||
return true
|
return true
|
||||||
|
@ -75,6 +82,6 @@ func mouseMoveOld(g *gocui.Gui) bool {
|
||||||
} else {
|
} else {
|
||||||
log.Log(NOW, "output widget already exists", maxX, maxY, mx, my)
|
log.Log(NOW, "output widget already exists", maxX, maxY, mx, my)
|
||||||
}
|
}
|
||||||
log.Log(NOW, "handleEvent() END ", maxX, maxY, mx, my, msgMouseDown)
|
// log.Log(NOW, "handleEvent() END ", maxX, maxY, mx, my, msgMouseDown)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,17 +16,6 @@ import (
|
||||||
var outputW int = 180
|
var outputW int = 180
|
||||||
var outputH int = 40
|
var outputH int = 40
|
||||||
|
|
||||||
func moveMsg(g *gocui.Gui) {
|
|
||||||
mx, my := g.MousePosition()
|
|
||||||
if !movingMsg && (mx != initialMouseX || my != initialMouseY) {
|
|
||||||
movingMsg = true
|
|
||||||
}
|
|
||||||
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")
|
|
||||||
}
|
|
||||||
|
|
||||||
func showMsg(g *gocui.Gui, v *gocui.View) error {
|
func showMsg(g *gocui.Gui, v *gocui.View) error {
|
||||||
var l string
|
var l string
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -70,12 +70,13 @@ type config struct {
|
||||||
ecount int // counts how many mouse and keyboard events have occurred
|
ecount int // counts how many mouse and keyboard events have occurred
|
||||||
supermouse bool // prints out every widget found while you move the mouse around
|
supermouse bool // prints out every widget found while you move the mouse around
|
||||||
depth int // used for listWidgets() debugging
|
depth int // used for listWidgets() debugging
|
||||||
|
movingMsg bool // means the user id dragging something around with the mouse
|
||||||
}
|
}
|
||||||
|
|
||||||
// deprecate these
|
// deprecate these
|
||||||
var (
|
var (
|
||||||
initialMouseX, initialMouseY, xOffset, yOffset int
|
initialMouseX, initialMouseY, xOffset, yOffset int
|
||||||
globalMouseDown, msgMouseDown, movingMsg bool
|
globalMouseDown, msgMouseDown bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// this is the gocui way
|
// this is the gocui way
|
||||||
|
|
Loading…
Reference in New Issue