removing old crappy code finally
This commit is contained in:
parent
3faacd6c43
commit
88e9594b93
|
@ -100,11 +100,11 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
|
||||
func theStdout(g *gocui.Gui, v *gocui.View) error {
|
||||
if me.outputOnTop {
|
||||
me.outputOnTop = false
|
||||
if me.stdout.outputOnTop {
|
||||
me.stdout.outputOnTop = false
|
||||
me.baseGui.SetViewOnBottom("msg")
|
||||
} else {
|
||||
me.outputOnTop = true
|
||||
me.stdout.outputOnTop = true
|
||||
me.baseGui.SetViewOnTop("msg")
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -140,8 +140,8 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
|
|||
|
||||
vx, vy, _, _, err := g.ViewPosition("msg")
|
||||
if err == nil {
|
||||
xOffset = initialMouseX - vx
|
||||
yOffset = initialMouseY - vy
|
||||
me.stdout.offsetW = initialMouseX - vx
|
||||
me.stdout.offsetH = initialMouseY - vy
|
||||
}
|
||||
log.Info("setting mousedown to true")
|
||||
// msgMouseDown = true
|
||||
|
|
|
@ -110,16 +110,14 @@ func (tk *guiWidget) moveNew() {
|
|||
} else {
|
||||
// log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
|
||||
// tk.dumpWidget("moveNew() MSG" + tk.cuiName)
|
||||
outputW := 180
|
||||
outputH := 40
|
||||
w0 := w - xOffset
|
||||
h0 := h - yOffset
|
||||
w1 := w - xOffset + outputW
|
||||
h1 := h - yOffset + outputH + me.FramePadH
|
||||
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 - xOffset
|
||||
me.startOutputH = h - yOffset
|
||||
// me.startOutputW = w - me.stdout.offsetW
|
||||
// me.startOutputH = h - me.stdout.offsetH
|
||||
me.baseGui.SetViewOnBottom("msg")
|
||||
|
||||
tk.gocuiSize.w0 = w0
|
||||
|
|
2
help.go
2
help.go
|
@ -102,7 +102,7 @@ func setThingsOnTop() {
|
|||
}
|
||||
me.baseGui.SetViewOnTop("help")
|
||||
|
||||
if me.outputOnTop {
|
||||
if me.stdout.outputOnTop {
|
||||
me.baseGui.SetViewOnTop("msg")
|
||||
} else {
|
||||
me.baseGui.SetViewOnBottom("msg")
|
||||
|
|
3
init.go
3
init.go
|
@ -38,6 +38,9 @@ func init() {
|
|||
// init the config struct default values
|
||||
Set(&me, "default")
|
||||
|
||||
me.stdout.w = 180
|
||||
me.stdout.h = 40
|
||||
|
||||
// Set(&me, "dense")
|
||||
|
||||
me.myTree = tree.New()
|
||||
|
|
|
@ -34,10 +34,7 @@ func showMsg(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
|
||||
func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
||||
maxX, maxY := g.Size()
|
||||
|
||||
var outputW int = 180
|
||||
var outputH int = 40
|
||||
// maxX, maxY := g.Size()
|
||||
|
||||
if me.treeRoot == nil {
|
||||
// keep skipping this until the binary tree is initialized
|
||||
|
@ -57,11 +54,13 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
tk := me.logStdout
|
||||
// tk.gocuiSize.w0 = maxX - 32
|
||||
// tk.gocuiSize.h0 = maxY / 2
|
||||
tk.gocuiSize.w0 = me.startOutputW
|
||||
tk.gocuiSize.h0 = me.startOutputH
|
||||
tk.gocuiSize.w1 = tk.gocuiSize.w0 + outputW
|
||||
tk.gocuiSize.h1 = tk.gocuiSize.h0 + outputH
|
||||
tk.gocuiSize.w0 = 30
|
||||
tk.gocuiSize.h0 = 10
|
||||
tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
|
||||
tk.gocuiSize.h1 = tk.gocuiSize.h0 + me.stdout.h
|
||||
|
||||
}
|
||||
|
||||
v, err := g.View("msg")
|
||||
if v == nil {
|
||||
log.Log(NOW, "makeoutputwindow() this is supposed to happen. v == nil", err)
|
||||
|
@ -69,14 +68,21 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
log.Log(NOW, "makeoutputwindow() msg != nil. WTF now? err =", err)
|
||||
}
|
||||
|
||||
if me.startOutputW == 0 {
|
||||
me.startOutputW = maxX - 132
|
||||
}
|
||||
if me.startOutputW == 0 {
|
||||
me.startOutputH = maxY / 2
|
||||
}
|
||||
/*
|
||||
if me.startOutputW == 0 {
|
||||
me.startOutputW = maxX - 132
|
||||
}
|
||||
if me.startOutputW == 0 {
|
||||
me.startOutputH = maxY / 2
|
||||
}
|
||||
*/
|
||||
|
||||
v, err = g.SetView("msg", me.startOutputW, me.startOutputH, maxX/2+outputW, maxY/2+outputH, 0)
|
||||
a := me.logStdout.gocuiSize.w0
|
||||
b := me.logStdout.gocuiSize.h0
|
||||
c := me.logStdout.gocuiSize.w1
|
||||
d := me.logStdout.gocuiSize.h1
|
||||
v, err = g.SetView("msg", a, b, c, d, 0)
|
||||
// v, err = g.SetView("msg", me.startOutputW, me.startOutputH, maxX/2+me.stdout.w, maxY/2+me.stdout.h, 0)
|
||||
if errors.Is(err, gocui.ErrUnknownView) {
|
||||
log.Log(NOW, "makeoutputwindow() this is supposed to happen?", err)
|
||||
}
|
||||
|
|
85
structs.go
85
structs.go
|
@ -36,47 +36,58 @@ type config struct {
|
|||
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 *guiWidget // where to show STDOUT
|
||||
startOutputW int // ?
|
||||
startOutputH int // ?
|
||||
helpLabel *gocui.View // ?
|
||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||
outputOnTop bool // is the STDOUT window on top?
|
||||
// dropdownV *guiWidget // this is a floating widget that we show whenever the user clicks on a
|
||||
dropdownW *guiWidget // grab the dropdown choices from this widget
|
||||
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||
FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||
PadW int `default:"1" dense:"0"` // pad spacing
|
||||
PadH int `default:"1" dense:"0"` // pad spacing
|
||||
WindowW int `default:"8" dense:"0"` // how far down to start Window or Tab headings
|
||||
WindowH int `default:"-1"` // how far down to start Window or Tab headings
|
||||
TabW int `default:"5" dense:"0"` // how far down to start Window or Tab headings
|
||||
TabH int `default:"1" dense:"0"` // how far down to start Window or Tab headings
|
||||
WindowPadW int `default:"8" dense:"0"` // additional amount of space to put between window & tab widgets
|
||||
TabPadW int `default:"4" dense:"0"` // additional amount of space to put between window & tab widgets
|
||||
GroupPadW int `default:"2" dense:"1"` // additional amount of space to indent on a group
|
||||
BoxPadW int `default:"2" dense:"1"` // additional amount of space to indent on a box
|
||||
GridPadW int `default:"2" dense:"1"` // additional amount of space to indent on a grid
|
||||
RawW int `default:"1"` // the raw beginning of each window (or tab)
|
||||
RawH int `default:"5"` // the raw beginning of each window (or tab)
|
||||
FakeW int `default:"20"` // offset for the hidden widgets
|
||||
padded bool // add space between things like buttons
|
||||
bookshelf bool // do you want things arranged in the box like a bookshelf or a stack?
|
||||
canvas bool // if set to true, the windows are a raw canvas
|
||||
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 // writeMutex protects writes to *guiWidget (it's global right now maybe)
|
||||
dtoggle bool // is a dropdown or combobox currently active?
|
||||
ecount int // counts how many mouse and keyboard events have occurred
|
||||
supermouse bool // prints out every widget found while you move the mouse around
|
||||
depth int // used for listWidgets() debugging
|
||||
globalMouseDown bool // yep, mouse is pressed
|
||||
newWindowTrigger chan bool // work around hack to redraw windows a bit after NewWindow()
|
||||
// startOutputW int // ?
|
||||
// startOutputH int // ?
|
||||
helpLabel *gocui.View // ?
|
||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||
dropdownW *guiWidget // grab the dropdown choices from this widget
|
||||
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||
FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||
PadW int `default:"1" dense:"0"` // pad spacing
|
||||
PadH int `default:"1" dense:"0"` // pad spacing
|
||||
WindowW int `default:"8" dense:"0"` // how far down to start Window or Tab headings
|
||||
WindowH int `default:"-1"` // how far down to start Window or Tab headings
|
||||
TabW int `default:"5" dense:"0"` // how far down to start Window or Tab headings
|
||||
TabH int `default:"1" dense:"0"` // how far down to start Window or Tab headings
|
||||
WindowPadW int `default:"8" dense:"0"` // additional amount of space to put between window & tab widgets
|
||||
TabPadW int `default:"4" dense:"0"` // additional amount of space to put between window & tab widgets
|
||||
GroupPadW int `default:"2" dense:"1"` // additional amount of space to indent on a group
|
||||
BoxPadW int `default:"2" dense:"1"` // additional amount of space to indent on a box
|
||||
GridPadW int `default:"2" dense:"1"` // additional amount of space to indent on a grid
|
||||
RawW int `default:"1"` // the raw beginning of each window (or tab)
|
||||
RawH int `default:"5"` // the raw beginning of each window (or tab)
|
||||
FakeW int `default:"20"` // offset for the hidden widgets
|
||||
padded bool // add space between things like buttons
|
||||
bookshelf bool // do you want things arranged in the box like a bookshelf or a stack?
|
||||
canvas bool // if set to true, the windows are a raw canvas
|
||||
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 // writeMutex protects writes to *guiWidget (it's global right now maybe)
|
||||
dtoggle bool // is a dropdown or combobox currently active?
|
||||
ecount int // counts how many mouse and keyboard events have occurred
|
||||
supermouse bool // prints out every widget found while you move the mouse around
|
||||
depth int // used for listWidgets() debugging
|
||||
globalMouseDown bool // yep, mouse is pressed
|
||||
newWindowTrigger chan bool // work around hack to redraw windows a bit after NewWindow()
|
||||
stdout stdout // information for the STDOUT window
|
||||
}
|
||||
|
||||
// settings for the stdout window
|
||||
type stdout struct {
|
||||
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
|
||||
}
|
||||
|
||||
// deprecate these
|
||||
var (
|
||||
initialMouseX, initialMouseY, xOffset, yOffset int
|
||||
initialMouseX, initialMouseY int
|
||||
// initialMouseX, initialMouseY, xOffset, yOffset int
|
||||
// msgMouseDown bool
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue