stub in code to page large windows
This commit is contained in:
parent
c5d9522c0b
commit
87d31a3d94
|
@ -67,6 +67,14 @@ func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
|
||||
func stdoutPgdn(g *gocui.Gui, v *gocui.View) error {
|
||||
win := findWindowUnderMouse()
|
||||
if win != nil {
|
||||
if win.full.Height() > 50 {
|
||||
log.Info("paging through really large window pager =", win.window.pager)
|
||||
win.window.pager += 10
|
||||
return nil
|
||||
}
|
||||
}
|
||||
me.stdout.pager += 10
|
||||
|
||||
tk := me.stdout.tk
|
||||
|
|
|
@ -163,7 +163,9 @@ type window struct {
|
|||
order int // what level the window is on
|
||||
// resize bool // only set the title once
|
||||
collapsed bool // only show the window title bar
|
||||
dense bool // true if the window is huge
|
||||
dense bool // true if the window is dense
|
||||
large bool // true if the window is huge
|
||||
pager int // allows the user to page through the window
|
||||
}
|
||||
|
||||
type colorT struct {
|
||||
|
|
54
treeDraw.go
54
treeDraw.go
|
@ -41,6 +41,41 @@ func (tk *guiWidget) doNotDraw() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// page widgets in the window
|
||||
func (tk *guiWidget) pageWidget() *rectType {
|
||||
r := new(rectType)
|
||||
|
||||
var check bool
|
||||
switch tk.node.WidgetType {
|
||||
case widget.Button:
|
||||
check = true
|
||||
case widget.Label:
|
||||
check = true
|
||||
default:
|
||||
}
|
||||
if !check {
|
||||
return nil
|
||||
}
|
||||
win := tk.findParentWindow()
|
||||
if win == nil {
|
||||
// don't draw anything if you can't find the parent window
|
||||
return nil
|
||||
}
|
||||
|
||||
r.w0 = tk.gocuiSize.w0
|
||||
r.h0 = tk.gocuiSize.h0
|
||||
r.w1 = tk.gocuiSize.w1
|
||||
r.h1 = tk.gocuiSize.h1
|
||||
|
||||
// r.h0 = tk.gocuiSize.h0 - win.gocuiSize.h0
|
||||
|
||||
if r.h0 > 20 {
|
||||
return r
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// display's the text of the widget in gocui
|
||||
// deletes the old view if it exists and recreates it
|
||||
func (tk *guiWidget) drawView() {
|
||||
|
@ -70,9 +105,23 @@ func (tk *guiWidget) drawView() {
|
|||
c := tk.gocuiSize.w1
|
||||
d := tk.gocuiSize.h1
|
||||
|
||||
if r := tk.pageWidget(); r == nil {
|
||||
// if nil, draw whatever it is anyway
|
||||
} else {
|
||||
if r.Width() == 0 && r.Height() == 0 {
|
||||
// don't draw empty stuff
|
||||
return
|
||||
}
|
||||
a = r.w0
|
||||
b = r.h0
|
||||
c = r.w1
|
||||
d = r.h1
|
||||
}
|
||||
|
||||
if tk.node.WidgetType == widget.Window || tk.node.WidgetType == widget.Flag {
|
||||
if tk.gocuiSize.Height() > 30 {
|
||||
tk.gocuiSize.h1 = tk.gocuiSize.h0 + 30
|
||||
if tk.gocuiSize.Height() > 40 {
|
||||
tk.window.large = true
|
||||
tk.gocuiSize.h1 = tk.gocuiSize.h0 + 40
|
||||
d = tk.gocuiSize.h1
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +147,6 @@ func (tk *guiWidget) drawView() {
|
|||
b = tk.gocuiSize.h0
|
||||
c = tk.gocuiSize.w1
|
||||
d = tk.gocuiSize.h1
|
||||
|
||||
}
|
||||
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName, a, b, c, d, 0)
|
||||
|
|
Loading…
Reference in New Issue