getting pretty clean at this point
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
6b55526fee
commit
c077a3d4e1
|
@ -123,7 +123,7 @@ Creates a window helpful for debugging this package
|
||||||
|
|
||||||
`func ExampleCatcher(f func())`
|
`func ExampleCatcher(f func())`
|
||||||
|
|
||||||
### func [Indent](/debug.go#L127)
|
### func [Indent](/debug.go#L124)
|
||||||
|
|
||||||
`func Indent(b bool, a ...interface{})`
|
`func Indent(b bool, a ...interface{})`
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ Creates a window helpful for debugging this package
|
||||||
|
|
||||||
`func SetFlag(s string, b bool)`
|
`func SetFlag(s string, b bool)`
|
||||||
|
|
||||||
### func [ShowDebugValues](/debug.go#L85)
|
### func [ShowDebugValues](/debug.go#L82)
|
||||||
|
|
||||||
`func ShowDebugValues()`
|
`func ShowDebugValues()`
|
||||||
|
|
||||||
|
|
75
common.go
75
common.go
|
@ -10,60 +10,56 @@ import (
|
||||||
// functions for handling text related GUI elements
|
// functions for handling text related GUI elements
|
||||||
|
|
||||||
func (n *Node) Show() *Node {
|
func (n *Node) Show() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Show)
|
||||||
a.ActionType = toolkit.Show
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Hide() *Node {
|
func (n *Node) Hide() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Hide)
|
||||||
a.ActionType = toolkit.Hide
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Enable() *Node {
|
func (n *Node) Enable() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Enable)
|
||||||
a.ActionType = toolkit.Enable
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Disable() *Node {
|
func (n *Node) Disable() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Disable)
|
||||||
a.ActionType = toolkit.Disable
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Add(str string) {
|
func (n *Node) Add(str string) {
|
||||||
log(debugGui, "gui.Add() value =", str)
|
log(debugGui, "gui.Add() value =", str)
|
||||||
|
|
||||||
var a toolkit.Action
|
n.S = str
|
||||||
a.ActionType = toolkit.Add
|
|
||||||
a.S = str
|
a := newAction(n, toolkit.Add)
|
||||||
newaction(&a, n, nil)
|
sendAction(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) AddText(str string) {
|
func (n *Node) AddText(str string) {
|
||||||
log(debugChange, "AddText() value =", str)
|
log(debugChange, "AddText() value =", str)
|
||||||
|
|
||||||
n.Text = str
|
n.Text = str
|
||||||
var a toolkit.Action
|
n.S = str
|
||||||
a.ActionType = toolkit.AddText
|
|
||||||
a.S = str
|
a := newAction(n, toolkit.AddText)
|
||||||
newaction(&a, n, nil)
|
sendAction(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) SetText(text string) *Node{
|
func (n *Node) SetText(text string) *Node {
|
||||||
log(debugChange, "SetText() value =", text)
|
log(debugChange, "SetText() value =", text)
|
||||||
|
|
||||||
n.Text = text
|
n.Text = text
|
||||||
var a toolkit.Action
|
n.S = text
|
||||||
a.ActionType = toolkit.SetText
|
|
||||||
a.S = text
|
a := newAction(n, toolkit.SetText)
|
||||||
newaction(&a, n, nil)
|
sendAction(a)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,13 +89,12 @@ func (n *Node) Set(val any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) AppendText(str string) {
|
func (n *Node) AppendText(str string) {
|
||||||
var a toolkit.Action
|
|
||||||
a.ActionType = toolkit.SetText
|
|
||||||
tmp := n.S + str
|
tmp := n.S + str
|
||||||
log(debugChange, "AppendText() value =", tmp)
|
|
||||||
a.S = tmp
|
|
||||||
n.Text = tmp
|
n.Text = tmp
|
||||||
newaction(&a, n, nil)
|
n.S = tmp
|
||||||
|
|
||||||
|
a := newAction(n, toolkit.SetText)
|
||||||
|
sendAction(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) GetText() string {
|
func (n *Node) GetText() string {
|
||||||
|
@ -152,30 +147,26 @@ func commonCallback(n *Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Margin() *Node {
|
func (n *Node) Margin() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Margin)
|
||||||
a.ActionType = toolkit.Margin
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Unmargin() *Node {
|
func (n *Node) Unmargin() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Unmargin)
|
||||||
a.ActionType = toolkit.Unmargin
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Pad() *Node {
|
func (n *Node) Pad() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Pad)
|
||||||
a.ActionType = toolkit.Pad
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Unpad() *Node {
|
func (n *Node) Unpad() *Node {
|
||||||
var a toolkit.Action
|
a := newAction(n, toolkit.Unpad)
|
||||||
a.ActionType = toolkit.Unpad
|
sendAction(a)
|
||||||
newaction(&a, n, nil)
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
debug.go
11
debug.go
|
@ -71,15 +71,12 @@ func SetFlag (s string, b bool) {
|
||||||
log(debugGui, "Can't set unknown flag", s)
|
log(debugGui, "Can't set unknown flag", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
var a toolkit.Action
|
a := new(toolkit.Action)
|
||||||
a.ActionType = toolkit.Set
|
a.ActionType = toolkit.Set
|
||||||
a.WidgetType = toolkit.Flag
|
a.WidgetType = toolkit.Flag
|
||||||
a.S = s
|
a.S = s
|
||||||
a.B = b
|
a.B = b
|
||||||
// a.Widget = &newNode.widget
|
sendAction(a)
|
||||||
// a.Where = &n.widget
|
|
||||||
// action(&a)
|
|
||||||
newaction(&a, nil, nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowDebugValues() {
|
func ShowDebugValues() {
|
||||||
|
@ -118,10 +115,10 @@ func (n *Node) Dump() {
|
||||||
}
|
}
|
||||||
Indent(b, "NODE DUMP END")
|
Indent(b, "NODE DUMP END")
|
||||||
|
|
||||||
var a toolkit.Action
|
a := new(toolkit.Action)
|
||||||
a.ActionType = toolkit.Dump
|
a.ActionType = toolkit.Dump
|
||||||
a.WidgetId = n.id
|
a.WidgetId = n.id
|
||||||
newaction(&a, activeWidget, nil)
|
sendAction(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Indent(b bool, a ...interface{}) {
|
func Indent(b bool, a ...interface{}) {
|
||||||
|
|
|
@ -115,46 +115,38 @@ func DebugWidgetWindow(w *Node) {
|
||||||
|
|
||||||
g = bugWidget.NewGroup("change things")
|
g = bugWidget.NewGroup("change things")
|
||||||
g.NewButton("AddText()", func () {
|
g.NewButton("AddText()", func () {
|
||||||
var a toolkit.Action
|
activeWidget.S = activeLabelNewName.S
|
||||||
a.ActionType = toolkit.AddText
|
a := newAction(activeWidget, toolkit.AddText)
|
||||||
a.S = activeLabelNewName.S
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, nil)
|
|
||||||
})
|
})
|
||||||
g.NewButton("SetText()", func () {
|
g.NewButton("SetText()", func () {
|
||||||
var a toolkit.Action
|
activeWidget.S = activeLabelNewName.S
|
||||||
a.ActionType = toolkit.SetText
|
a := newAction(activeWidget, toolkit.SetText)
|
||||||
a.S = activeLabelNewName.S
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, nil)
|
|
||||||
})
|
})
|
||||||
g.NewButton("Margin()", func () {
|
g.NewButton("Margin()", func () {
|
||||||
var a toolkit.Action
|
a := newAction(activeWidget, toolkit.Margin)
|
||||||
a.ActionType = toolkit.Margin
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, nil)
|
|
||||||
})
|
})
|
||||||
g.NewButton("Unmargin()", func () {
|
g.NewButton("Unmargin()", func () {
|
||||||
var a toolkit.Action
|
a := newAction(activeWidget, toolkit.Unmargin)
|
||||||
a.ActionType = toolkit.Unmargin
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, nil)
|
|
||||||
})
|
})
|
||||||
g.NewButton("Pad()", func () {
|
g.NewButton("Pad()", func () {
|
||||||
var a toolkit.Action
|
a := newAction(activeWidget, toolkit.Pad)
|
||||||
a.ActionType = toolkit.Pad
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, nil)
|
|
||||||
})
|
})
|
||||||
g.NewButton("Unpad()", func () {
|
g.NewButton("Unpad()", func () {
|
||||||
var a toolkit.Action
|
a := newAction(activeWidget, toolkit.Unpad)
|
||||||
a.ActionType = toolkit.Unpad
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, nil)
|
|
||||||
})
|
})
|
||||||
g.NewButton("Move(junk)", func () {
|
g.NewButton("Move(junk)", func () {
|
||||||
var a toolkit.Action
|
a := newAction(activeWidget, toolkit.Move)
|
||||||
a.ActionType = toolkit.Move
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, activeJunk)
|
|
||||||
})
|
})
|
||||||
g.NewButton("Delete()", func () {
|
g.NewButton("Delete()", func () {
|
||||||
var a toolkit.Action
|
a := newAction(activeWidget, toolkit.Delete)
|
||||||
a.ActionType = toolkit.Delete
|
sendAction(a)
|
||||||
newaction(&a, activeWidget, activeJunk)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
g = bugWidget.NewGroup("not working?")
|
g = bugWidget.NewGroup("not working?")
|
||||||
|
|
|
@ -203,6 +203,8 @@ func initToolkit(name string, filename string) *aplug {
|
||||||
return newPlug
|
return newPlug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2023/05/09 pretty clean
|
||||||
|
// 2023/04/06 Queue() is also being used and channels are being used. memcopy() only
|
||||||
func newAction(n *Node, atype toolkit.ActionType) *toolkit.Action {
|
func newAction(n *Node, atype toolkit.ActionType) *toolkit.Action {
|
||||||
var a toolkit.Action
|
var a toolkit.Action
|
||||||
a.ActionType = atype
|
a.ActionType = atype
|
||||||
|
@ -246,7 +248,7 @@ func sendAction(a *toolkit.Action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2023/04/06 Queue() is also being used and channels are being used. memcopy() only
|
/*
|
||||||
func newaction(a *toolkit.Action, n *Node, where *Node) {
|
func newaction(a *toolkit.Action, n *Node, where *Node) {
|
||||||
// remove this
|
// remove this
|
||||||
if (n != nil) {
|
if (n != nil) {
|
||||||
|
@ -275,6 +277,7 @@ func newaction(a *toolkit.Action, n *Node, where *Node) {
|
||||||
sleep(.02)
|
sleep(.02)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (n *Node) InitEmbed(resFS embed.FS) *Node {
|
func (n *Node) InitEmbed(resFS embed.FS) *Node {
|
||||||
me.resFS = resFS
|
me.resFS = resFS
|
||||||
|
|
Loading…
Reference in New Issue