no more dropdownV

This commit is contained in:
Jeff Carr 2025-02-01 18:48:08 -06:00
parent 666d5ca52d
commit eccec3ef1a
6 changed files with 78 additions and 70 deletions

View File

@ -81,26 +81,26 @@ func addDropdown() *tree.Node {
}
func (tk *guiWidget) showDropdown() {
var ddItems string
// todo: fix this after switching to protobuf
// var items []string
// items = tk.node.State.Strings
//for i, s := range items {
/*
for i, s := range tk.node.Strings() {
// log.Log(GOCUI, "showDropdown()", tk.String(), i, s)
ddItems += s + "\n"
}
var ddItems string
for i, s := range tk.node.Strings() {
// log.Log(GOCUI, "showDropdown()", tk.String(), i, s)
ddItems += s + "\n"
}
*/
// log.Log(GOCUI, "new dropdown items should be set to:", ddItems)
// sizeW, sizeH := tk.Size()
// log.Log(GOCUI, "showDropdown() size W,H=", sizeW, sizeH)
startW, startH := tk.Position()
// log.Log(GOCUI, "showDropdown() location W,H=", startW, startH)
me.dropdownV.MoveToOffset(startW+3, startH+2)
me.dropdownV.labelN = ddItems
me.dropdownV.Show()
log.Log(GOCUI, "showDropdown() IS BROKEN W,H=", startW, startH)
// me.dropdownV.MoveToOffset(startW+3, startH+2)
// me.dropdownV.labelN = ddItems
// me.dropdownV.Show()
}
/*
@ -169,10 +169,12 @@ var doffset int = 5 // how many spaces over the dropdown menu should be fro
func dropdownUnclicked(w, h int) {
var d *guiWidget
if me.dropdownV == nil {
log.Log(GOCUI, "mouseUp() dropdownV = nil")
return
}
/*
if me.dropdownV == nil {
log.Log(GOCUI, "mouseUp() dropdownV = nil")
return
}
*/
// examine everything under X & Y on the screen)
for _, tk := range findByXY(w, h) {
@ -186,18 +188,20 @@ func dropdownUnclicked(w, h int) {
return
}
// log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV")
dtext := strings.Join(d.node.Strings(), "\n")
tk := me.dropdownV
if dtoggle {
// log.Log(GOCUI, "dropdownUnclicked() set visible=false")
tk.Hide()
dtoggle = false
tk.SetText("goodbye")
} else {
// log.Log(GOCUI, "dropdownUnclicked() set visible=true")
tk.MoveToOffset(w+doffset, h)
tk.SetText(dtext)
tk.Show()
dtoggle = true
}
/*
dtext := strings.Join(d.node.Strings(), "\n")
tk := me.dropdownV
if dtoggle {
// log.Log(GOCUI, "dropdownUnclicked() set visible=false")
tk.Hide()
dtoggle = false
tk.SetText("goodbye")
} else {
// log.Log(GOCUI, "dropdownUnclicked() set visible=true")
tk.MoveToOffset(w+doffset, h)
tk.SetText(dtext)
tk.Show()
dtoggle = true
}
*/
}

View File

@ -190,10 +190,12 @@ func theHelp(g *gocui.Gui, v *gocui.View) error {
if me.showHelp {
helplayout()
me.showHelp = false
if me.dropdownV == nil {
log.Info("FIXME: MADE me.dropdownV AGAIN")
me.dropdownV = makeDropdownView("addWidget() ddview help")
}
/*
if me.dropdownV == nil {
log.Info("FIXME: MADE me.dropdownV AGAIN")
me.dropdownV = makeDropdownView("addWidget() ddview help")
}
*/
// me.dropdownV.Show()
} else {
me.baseGui.DeleteView("help")

View File

@ -24,7 +24,7 @@ import (
var helpText []string = []string{"KEYBINDINGS",
"",
"?: toggle zhelp",
"?: toggle help",
"S: super mouse",
"M: list all widgets positions",
"L: list all widgets in tree form",

View File

@ -39,37 +39,37 @@ type config struct {
startOutputW int // ?
startOutputH int // ?
helpLabel *gocui.View // ?
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)
fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
dtoggle bool // is a dropdown or combobox currently active?
showHelp bool // toggle boolean for the help menu (deprecate?)
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
// 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)
fakefile *FakeFile // JUNK? used to attempt to write to the stdout window
dtoggle bool // is a dropdown or combobox currently active?
showHelp bool // toggle boolean for the help menu (deprecate?)
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
}
// deprecate these

View File

@ -52,9 +52,9 @@ func addWidget(n *tree.Node) {
wRoot.redoWindows(0, 0)
// TODO: record the first window here?
// do initial setup of helper widgets here:
if me.dropdownV == nil {
// me.dropdownV = makeDropdownView("addWidget() ddview2")
}
// if me.dropdownV == nil {
// me.dropdownV = makeDropdownView("addWidget() ddview2")
// }
return
case widget.Tab:
nw.color = &colorTab

View File

@ -105,10 +105,12 @@ func (tk *guiWidget) Visible() bool {
func (w *guiWidget) Show() {
// always should the dropdown widget
if w == me.dropdownV {
me.dropdownV.drawView()
return
}
/*
if w == me.dropdownV {
me.dropdownV.drawView()
return
}
*/
// don't display fake widgets
if w.isFake {