summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eventMouse.go4
-rw-r--r--eventMouseMove.go64
-rw-r--r--init.go4
-rw-r--r--stdoutShow.go6
-rw-r--r--structs.go19
5 files changed, 64 insertions, 33 deletions
diff --git a/eventMouse.go b/eventMouse.go
index 31bf2d3..35372e8 100644
--- a/eventMouse.go
+++ b/eventMouse.go
@@ -137,8 +137,8 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
vx, vy, _, _, err := g.ViewPosition("msg")
if err == nil {
- me.stdout.offsetW = w - vx
- me.stdout.offsetH = h - vy
+ me.stdout.mouseOffsetW = w - vx
+ me.stdout.mouseOffsetH = h - vy
}
log.Info("setting mousedown to true")
// msgMouseDown = true
diff --git a/eventMouseMove.go b/eventMouseMove.go
index 7b637ec..ff08b01 100644
--- a/eventMouseMove.go
+++ b/eventMouseMove.go
@@ -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
func (tk *guiWidget) moveNew() {
w, h := me.baseGui.MousePosition()
@@ -108,27 +131,32 @@ func (tk *guiWidget) moveNew() {
tk.dumpWidget(s)
return
} else {
- // log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
- // tk.dumpWidget("moveNew() MSG" + tk.cuiName)
- 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)
+ newW := w - me.stdout.mouseOffsetW
+ newH := h - me.stdout.mouseOffsetH
+ tk.relocateStdout(newW, newH)
+ /*
+ // log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
+ // tk.dumpWidget("moveNew() MSG" + tk.cuiName)
+ 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.startOutputH = h - me.stdout.offsetH
- me.baseGui.SetViewOnBottom("msg")
+ // me.startOutputW = w - me.stdout.offsetW
+ // me.startOutputH = h - me.stdout.offsetH
+ me.baseGui.SetViewOnBottom("msg")
- tk.gocuiSize.w0 = w0
- tk.gocuiSize.w1 = w1
- tk.gocuiSize.h0 = h0
- tk.gocuiSize.h1 = h1
+ 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
+ tk.full.w0 = w0
+ tk.full.w1 = w1
+ tk.full.h0 = h0
+ tk.full.h1 = h1
+ */
}
// always place the help menu on top
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
diff --git a/init.go b/init.go
index ca01107..03409c3 100644
--- a/init.go
+++ b/init.go
@@ -41,8 +41,8 @@ func init() {
// initial stdout window settings
me.stdout.w = 180
me.stdout.h = 40
- me.stdout.offsetW = 30
- me.stdout.offsetH = 10
+ me.stdout.lastW = 30
+ me.stdout.lastH = 10
// Set(&me, "dense")
diff --git a/stdoutShow.go b/stdoutShow.go
index 43e6fd3..6316aed 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -50,8 +50,8 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
me.stdout.tk = initWidget(n)
tk := me.stdout.tk
- tk.gocuiSize.w0 = me.stdout.offsetW
- tk.gocuiSize.h0 = me.stdout.offsetH
+ tk.gocuiSize.w0 = me.stdout.lastW
+ tk.gocuiSize.h0 = me.stdout.lastH
tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
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")
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
}
diff --git a/structs.go b/structs.go
index 2a406be..6cd9b30 100644
--- a/structs.go
+++ b/structs.go
@@ -72,14 +72,17 @@ type config struct {
// settings for the stdout window
type stdout struct {
- tk *guiWidget // where to show STDOUT
- w int // the width
- h int // the width
- outputOnTop bool // is the STDOUT window on top?
- offscreenW int // where to place the window offscreen
- offscreenH int // where to place the window offscreen
- offsetW int // the current 'w' offset
- offsetH int // the current 'h' offset
+ tk *guiWidget // where to show STDOUT
+ w int // the width
+ h int // the width
+ outputOnTop bool // is the STDOUT window on top?
+ outputOffscreen bool // is the STDOUT window offscreen?
+ // offscreenW int // where to place the window offscreen
+ // offscreenH int // where to place the window offscreen
+ 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