rename to drawView()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-05 03:19:08 -06:00
parent a907a4418a
commit a15aea03ea
5 changed files with 20 additions and 21 deletions

View File

@ -131,7 +131,7 @@ func (tk *guiWidget) setColor(newColor *colorT) {
tk.color = &colorNone
}
log.Log(NOW, "Set the node to color =", tk.color.name)
tk.recreateView()
tk.Show()
}
func (w *guiWidget) disableColor() {

22
draw.go
View File

@ -47,22 +47,20 @@ func (w *guiWidget) drawTree(draw bool) {
}
// display's the text of the widget in gocui
// create or recreate the gocui widget visible
// will create a new gocui view if there isn't one or if it has been moved
// deletes the old view if it exists and recreates it
func (w *guiWidget) recreateView() {
func (w *guiWidget) drawView() {
var err error
log.Log(INFO, "recreateView() START", w.WidgetType, w.String())
log.Log(INFO, "drawView() START", w.WidgetType, w.String())
if me.baseGui == nil {
log.Log(ERROR, "recreateView() ERROR: me.baseGui == nil", w)
log.Log(ERROR, "drawView() ERROR: me.baseGui == nil", w)
return
}
if w.cuiName == "" {
log.Log(ERROR, "recreateView() w.cuiName was not set for widget", w)
log.Log(ERROR, "drawView() w.cuiName was not set for widget", w)
w.cuiName = strconv.Itoa(w.node.WidgetId) + " TK"
}
log.Log(INFO, "recreateView() labelN =", w.labelN)
log.Log(INFO, "drawView() labelN =", w.labelN)
// this deletes the button from gocui
me.baseGui.DeleteView(w.cuiName)
@ -76,13 +74,13 @@ func (w *guiWidget) recreateView() {
w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0)
if err == nil {
w.showWidgetPlacement("recreateView()")
log.Log(ERROR, "recreateView() internal plugin error err = nil")
w.showWidgetPlacement("drawView()")
log.Log(ERROR, "drawView() internal plugin error err = nil")
return
}
if !errors.Is(err, gocui.ErrUnknownView) {
w.showWidgetPlacement("recreateView()")
log.Log(ERROR, "recreateView() internal plugin error error.IS()", err)
w.showWidgetPlacement("drawView()")
log.Log(ERROR, "drawView() internal plugin error error.IS()", err)
return
}
@ -110,5 +108,5 @@ func (w *guiWidget) recreateView() {
w.v.SelFgColor = w.color.selFg
w.v.SelBgColor = w.color.selBg
}
log.Log(INFO, "recreateView() END")
log.Log(INFO, "drawView() END")
}

View File

@ -83,9 +83,11 @@ func (w *guiWidget) hideFake() {
}
}
// shows the 'fake' widgets for widgets that
// are not normally displayed (like a grid widget)
func (w *guiWidget) showFake() {
if w.isFake {
w.recreateView()
w.drawView()
w.showWidgetPlacement("showFake:")
}
for _, child := range w.children {

View File

@ -104,7 +104,7 @@ func (tk *guiWidget) Visible() bool {
func (w *guiWidget) Show() {
// always should the dropdown widget
if w == me.dropdownV {
me.dropdownV.recreateView()
me.dropdownV.drawView()
return
}
@ -116,13 +116,13 @@ func (w *guiWidget) Show() {
// if this isn't in the binary tree
// it's some internal widget so always display those
if w.node == nil {
w.recreateView()
w.drawView()
return
}
// always show window titles
if w.node.WidgetType != widget.Window {
w.recreateView()
w.drawView()
return
}
@ -143,7 +143,7 @@ func (w *guiWidget) Show() {
}
// okay, if you made it this far, then display the widget
w.recreateView()
w.drawView()
}
func (tk *guiWidget) Hide() {

View File

@ -4,6 +4,7 @@ import (
"go.wit.com/widget"
)
// re-draws the buttons for each of the windows
func (w *guiWidget) redoWindows(nextW int, nextH int) {
var startW int = nextW
var startH int = nextH
@ -19,9 +20,7 @@ func (w *guiWidget) redoWindows(nextW int, nextH int) {
child.gocuiSetWH(nextW, nextH)
child.Hide()
// use the direct method recreateView() to
// bypass sanity checks here (fix this?)
child.recreateView()
child.drawView()
sizeW := child.gocuiSize.Width()
nextW += sizeW + 4
child.redoWindows(startW+3, startH+2)