more work on stdout settings
This commit is contained in:
parent
d0e35bb98f
commit
d2c3db7b58
|
@ -137,8 +137,8 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
|
||||||
vx, vy, _, _, err := g.ViewPosition("msg")
|
vx, vy, _, _, err := g.ViewPosition("msg")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
me.stdout.offsetW = w - vx
|
me.stdout.mouseOffsetW = w - vx
|
||||||
me.stdout.offsetH = h - vy
|
me.stdout.mouseOffsetH = h - vy
|
||||||
}
|
}
|
||||||
log.Info("setting mousedown to true")
|
log.Info("setting mousedown to true")
|
||||||
// msgMouseDown = true
|
// msgMouseDown = true
|
||||||
|
|
|
@ -93,6 +93,29 @@ func mouseMove(g *gocui.Gui) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tk *guiWidget) relocateStdout(w int, h int) {
|
||||||
|
me.stdout.lastW = w
|
||||||
|
me.stdout.lastH = h
|
||||||
|
|
||||||
|
w0 := w
|
||||||
|
h0 := h
|
||||||
|
w1 := w + me.stdout.w
|
||||||
|
h1 := h + me.stdout.h
|
||||||
|
|
||||||
|
tk.gocuiSize.w0 = w0
|
||||||
|
tk.gocuiSize.w1 = w1
|
||||||
|
tk.gocuiSize.h0 = h0
|
||||||
|
tk.gocuiSize.h1 = h1
|
||||||
|
|
||||||
|
tk.full.w0 = w0
|
||||||
|
tk.full.w1 = w1
|
||||||
|
tk.full.h0 = h0
|
||||||
|
tk.full.h1 = h1
|
||||||
|
|
||||||
|
me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
|
||||||
|
me.baseGui.SetViewOnBottom("msg")
|
||||||
|
}
|
||||||
|
|
||||||
// this is how the window gets dragged around
|
// this is how the window gets dragged around
|
||||||
func (tk *guiWidget) moveNew() {
|
func (tk *guiWidget) moveNew() {
|
||||||
w, h := me.baseGui.MousePosition()
|
w, h := me.baseGui.MousePosition()
|
||||||
|
@ -108,27 +131,32 @@ func (tk *guiWidget) moveNew() {
|
||||||
tk.dumpWidget(s)
|
tk.dumpWidget(s)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
// log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
|
newW := w - me.stdout.mouseOffsetW
|
||||||
// tk.dumpWidget("moveNew() MSG" + tk.cuiName)
|
newH := h - me.stdout.mouseOffsetH
|
||||||
w0 := w - me.stdout.offsetW
|
tk.relocateStdout(newW, newH)
|
||||||
h0 := h - me.stdout.offsetH
|
/*
|
||||||
w1 := w - me.stdout.offsetW + me.stdout.w
|
// log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
|
||||||
h1 := h - me.stdout.offsetH + me.stdout.h
|
// tk.dumpWidget("moveNew() MSG" + tk.cuiName)
|
||||||
me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
|
w0 := w - me.stdout.offsetW
|
||||||
|
h0 := h - me.stdout.offsetH
|
||||||
|
w1 := w - me.stdout.offsetW + me.stdout.w
|
||||||
|
h1 := h - me.stdout.offsetH + me.stdout.h
|
||||||
|
me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
|
||||||
|
|
||||||
// me.startOutputW = w - me.stdout.offsetW
|
// me.startOutputW = w - me.stdout.offsetW
|
||||||
// me.startOutputH = h - me.stdout.offsetH
|
// me.startOutputH = h - me.stdout.offsetH
|
||||||
me.baseGui.SetViewOnBottom("msg")
|
me.baseGui.SetViewOnBottom("msg")
|
||||||
|
|
||||||
tk.gocuiSize.w0 = w0
|
tk.gocuiSize.w0 = w0
|
||||||
tk.gocuiSize.w1 = w1
|
tk.gocuiSize.w1 = w1
|
||||||
tk.gocuiSize.h0 = h0
|
tk.gocuiSize.h0 = h0
|
||||||
tk.gocuiSize.h1 = h1
|
tk.gocuiSize.h1 = h1
|
||||||
|
|
||||||
tk.full.w0 = w0
|
tk.full.w0 = w0
|
||||||
tk.full.w1 = w1
|
tk.full.w1 = w1
|
||||||
tk.full.h0 = h0
|
tk.full.h0 = h0
|
||||||
tk.full.h1 = h1
|
tk.full.h1 = h1
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
// always place the help menu on top
|
// always place the help menu on top
|
||||||
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
|
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
|
||||||
|
|
4
init.go
4
init.go
|
@ -41,8 +41,8 @@ func init() {
|
||||||
// initial stdout window settings
|
// initial stdout window settings
|
||||||
me.stdout.w = 180
|
me.stdout.w = 180
|
||||||
me.stdout.h = 40
|
me.stdout.h = 40
|
||||||
me.stdout.offsetW = 30
|
me.stdout.lastW = 30
|
||||||
me.stdout.offsetH = 10
|
me.stdout.lastH = 10
|
||||||
|
|
||||||
// Set(&me, "dense")
|
// Set(&me, "dense")
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
||||||
me.stdout.tk = initWidget(n)
|
me.stdout.tk = initWidget(n)
|
||||||
|
|
||||||
tk := me.stdout.tk
|
tk := me.stdout.tk
|
||||||
tk.gocuiSize.w0 = me.stdout.offsetW
|
tk.gocuiSize.w0 = me.stdout.lastW
|
||||||
tk.gocuiSize.h0 = me.stdout.offsetH
|
tk.gocuiSize.h0 = me.stdout.lastH
|
||||||
tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
|
tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
|
||||||
tk.gocuiSize.h1 = tk.gocuiSize.h0 + me.stdout.h
|
tk.gocuiSize.h1 = tk.gocuiSize.h0 + me.stdout.h
|
||||||
|
|
||||||
|
@ -90,6 +90,6 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
||||||
g.SetViewOnBottom("msg")
|
g.SetViewOnBottom("msg")
|
||||||
|
|
||||||
me.stdout.tk.v = v
|
me.stdout.tk.v = v
|
||||||
me.stdout.tk.DrawAt(me.stdout.offsetW, me.stdout.offsetH)
|
me.stdout.tk.DrawAt(me.stdout.lastW, me.stdout.lastH)
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
19
structs.go
19
structs.go
|
@ -72,14 +72,17 @@ type config struct {
|
||||||
|
|
||||||
// settings for the stdout window
|
// settings for the stdout window
|
||||||
type stdout struct {
|
type stdout struct {
|
||||||
tk *guiWidget // where to show STDOUT
|
tk *guiWidget // where to show STDOUT
|
||||||
w int // the width
|
w int // the width
|
||||||
h int // the width
|
h int // the width
|
||||||
outputOnTop bool // is the STDOUT window on top?
|
outputOnTop bool // is the STDOUT window on top?
|
||||||
offscreenW int // where to place the window offscreen
|
outputOffscreen bool // is the STDOUT window offscreen?
|
||||||
offscreenH int // where to place the window offscreen
|
// offscreenW int // where to place the window offscreen
|
||||||
offsetW int // the current 'w' offset
|
// offscreenH int // where to place the window offscreen
|
||||||
offsetH int // the current 'h' offset
|
lastW int // the last 'w' location (used to move from offscreen to onscreen)
|
||||||
|
lastH int // the last 'h' location (used to move from offscreen to onscreen)
|
||||||
|
mouseOffsetW int // the current 'w' offset
|
||||||
|
mouseOffsetH int // the current 'h' offset
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the gocui way
|
// this is the gocui way
|
||||||
|
|
Loading…
Reference in New Issue