removing old crappy code finally

This commit is contained in:
Jeff Carr 2025-02-06 02:40:44 -06:00
parent 3faacd6c43
commit 88e9594b93
7 changed files with 84 additions and 66 deletions

View File

@ -100,11 +100,11 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
} }
func theStdout(g *gocui.Gui, v *gocui.View) error { func theStdout(g *gocui.Gui, v *gocui.View) error {
if me.outputOnTop { if me.stdout.outputOnTop {
me.outputOnTop = false me.stdout.outputOnTop = false
me.baseGui.SetViewOnBottom("msg") me.baseGui.SetViewOnBottom("msg")
} else { } else {
me.outputOnTop = true me.stdout.outputOnTop = true
me.baseGui.SetViewOnTop("msg") me.baseGui.SetViewOnTop("msg")
} }
return nil return nil

View File

@ -140,8 +140,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 {
xOffset = initialMouseX - vx me.stdout.offsetW = initialMouseX - vx
yOffset = initialMouseY - vy me.stdout.offsetH = initialMouseY - vy
} }
log.Info("setting mousedown to true") log.Info("setting mousedown to true")
// msgMouseDown = true // msgMouseDown = true

View File

@ -110,16 +110,14 @@ func (tk *guiWidget) moveNew() {
} else { } else {
// log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType) // log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
// tk.dumpWidget("moveNew() MSG" + tk.cuiName) // tk.dumpWidget("moveNew() MSG" + tk.cuiName)
outputW := 180 w0 := w - me.stdout.offsetW
outputH := 40 h0 := h - me.stdout.offsetH
w0 := w - xOffset w1 := w - me.stdout.offsetW + me.stdout.w
h0 := h - yOffset h1 := h - me.stdout.offsetH + me.stdout.h
w1 := w - xOffset + outputW
h1 := h - yOffset + outputH + me.FramePadH
me.baseGui.SetView("msg", w0, h0, w1, h1, 0) me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
me.startOutputW = w - xOffset // me.startOutputW = w - me.stdout.offsetW
me.startOutputH = h - yOffset // me.startOutputH = h - me.stdout.offsetH
me.baseGui.SetViewOnBottom("msg") me.baseGui.SetViewOnBottom("msg")
tk.gocuiSize.w0 = w0 tk.gocuiSize.w0 = w0

View File

@ -102,7 +102,7 @@ func setThingsOnTop() {
} }
me.baseGui.SetViewOnTop("help") me.baseGui.SetViewOnTop("help")
if me.outputOnTop { if me.stdout.outputOnTop {
me.baseGui.SetViewOnTop("msg") me.baseGui.SetViewOnTop("msg")
} else { } else {
me.baseGui.SetViewOnBottom("msg") me.baseGui.SetViewOnBottom("msg")

View File

@ -38,6 +38,9 @@ func init() {
// init the config struct default values // init the config struct default values
Set(&me, "default") Set(&me, "default")
me.stdout.w = 180
me.stdout.h = 40
// Set(&me, "dense") // Set(&me, "dense")
me.myTree = tree.New() me.myTree = tree.New()

View File

@ -34,10 +34,7 @@ func showMsg(g *gocui.Gui, v *gocui.View) error {
} }
func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View { func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
maxX, maxY := g.Size() // maxX, maxY := g.Size()
var outputW int = 180
var outputH int = 40
if me.treeRoot == nil { if me.treeRoot == nil {
// keep skipping this until the binary tree is initialized // 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 := me.logStdout
// tk.gocuiSize.w0 = maxX - 32 // tk.gocuiSize.w0 = maxX - 32
// tk.gocuiSize.h0 = maxY / 2 // tk.gocuiSize.h0 = maxY / 2
tk.gocuiSize.w0 = me.startOutputW tk.gocuiSize.w0 = 30
tk.gocuiSize.h0 = me.startOutputH tk.gocuiSize.h0 = 10
tk.gocuiSize.w1 = tk.gocuiSize.w0 + outputW tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
tk.gocuiSize.h1 = tk.gocuiSize.h0 + outputH tk.gocuiSize.h1 = tk.gocuiSize.h0 + me.stdout.h
} }
v, err := g.View("msg") v, err := g.View("msg")
if v == nil { if v == nil {
log.Log(NOW, "makeoutputwindow() this is supposed to happen. v == nil", err) 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) log.Log(NOW, "makeoutputwindow() msg != nil. WTF now? err =", err)
} }
/*
if me.startOutputW == 0 { if me.startOutputW == 0 {
me.startOutputW = maxX - 132 me.startOutputW = maxX - 132
} }
if me.startOutputW == 0 { if me.startOutputW == 0 {
me.startOutputH = maxY / 2 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) { if errors.Is(err, gocui.ErrUnknownView) {
log.Log(NOW, "makeoutputwindow() this is supposed to happen?", err) log.Log(NOW, "makeoutputwindow() this is supposed to happen?", err)
} }

View File

@ -36,12 +36,10 @@ type config struct {
ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed 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 currentWindow *guiWidget // this is the current tab or window to show
logStdout *guiWidget // where to show STDOUT logStdout *guiWidget // where to show STDOUT
startOutputW int // ? // startOutputW int // ?
startOutputH int // ? // startOutputH int // ?
helpLabel *gocui.View // ? helpLabel *gocui.View // ?
showHelp bool // toggle boolean for the help menu (deprecate?) 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 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 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 FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
@ -72,11 +70,24 @@ type config struct {
depth int // used for listWidgets() debugging depth int // used for listWidgets() debugging
globalMouseDown bool // yep, mouse is pressed globalMouseDown bool // yep, mouse is pressed
newWindowTrigger chan bool // work around hack to redraw windows a bit after NewWindow() 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 // deprecate these
var ( var (
initialMouseX, initialMouseY, xOffset, yOffset int initialMouseX, initialMouseY int
// initialMouseX, initialMouseY, xOffset, yOffset int
// msgMouseDown bool // msgMouseDown bool
) )