From 6f91f5e080e06cdc0f34b13d23e5fd16ea37259a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 24 Mar 2023 20:14:18 -0500 Subject: starting to try safe chan and goroutines fix tab title's right before attempting to add chan goroutines removed "where" widget pointer box added to tab experiement with log as it's own repo Signed-off-by: Jeff Carr --- plugin.go | 52 ++++++++++------------------------------------------ 1 file changed, 10 insertions(+), 42 deletions(-) (limited to 'plugin.go') diff --git a/plugin.go b/plugin.go index 28bb324..d378672 100644 --- a/plugin.go +++ b/plugin.go @@ -79,11 +79,6 @@ func LoadToolkit(name string) bool { // unload the plugin and restore state newPlug.Quit = loadFuncE(&newPlug, "Quit") - // Sends a widget (button, checkbox, etc) and it's parent widget - // This includes instructions like "Add", "Delete", "Disable", etc -// newPlug.Send = loadFunc2(&newPlug, "Send") - - // This should replace Send() // Sends instructions like "Add", "Delete", "Disable", etc // Sends a widget (button, checkbox, etc) and it's parent widget newPlug.Action = loadFuncA(&newPlug, "Action") @@ -230,36 +225,6 @@ func loadfile(filename string) *plugin.Plugin { return plug } -/* -// Sends a widget and what to do with it to the plugin -// parent = n, child = c -func send(p *Node, c *Node) { - for _, aplug := range allPlugins { - log(debugPlugin, "Send() aplug =", aplug.name, "type=", c.widget.Type, "action=", c.widget.Action, "name=", c.widget.Name) - if (aplug.Send == nil) { - log(debugPlugin, "Failed. Send() == nil for", aplug.name) - continue - } - aplug.Send(&c.parent.widget, &c.widget) - } -} -*/ - -// Sends a widget and what to do with it to the plugin -// parent = n, child = c -/* -func action(a *toolkit.Action) { - for _, aplug := range allPlugins { - log(debugPlugin, "Action() aplug =", aplug.name, "Action type=", a.Type) - if (aplug.Action == nil) { - log(debugPlugin, "Failed Action() == nil for", aplug.name) - continue - } - aplug.Action(a) - } -} -*/ - // Sends a widget and what to do with it to the plugin // parent = n, child = c @@ -268,16 +233,19 @@ func action(a *toolkit.Action) { func newaction(a *toolkit.Action, n *Node, where *Node) { if (n != nil) { a.Widget = &n.widget + a.WidgetId = n.id + a.WidgetT = n.widget.Type } // action(&a, newNode, n) // newaction(&a, newNode, n) if (where != nil) { log(debugGui, "Action() START on where X,Y, Next X,Y =", where.Name, where.X, where.Y, where.NextX, where.NextY) - a.Where = &where.widget + // a.Where = &where.widget + a.WhereId = where.id switch where.widget.Type { case toolkit.Grid: - where.Dump(true) + // where.Dump(true) log(debugGui, "Action() START on Grid (X,Y)", where.X, where.Y, "put next thing at (X,Y) =", where.NextX, where.NextY) // // fix values here if they are invalid. Index starts at 1 @@ -288,8 +256,8 @@ func newaction(a *toolkit.Action, n *Node, where *Node) { where.NextY = 1 } // - a.Where.X = where.NextX - a.Where.Y = where.NextY + a.X = where.NextX + a.Y = where.NextY log(debugGui, "Action() END on Grid (X,Y)", where.X, where.Y, "put next thing at (X,Y) =", where.NextX, where.NextY) default: } @@ -307,19 +275,19 @@ func newaction(a *toolkit.Action, n *Node, where *Node) { if (where != nil) { switch where.widget.Type { case toolkit.Grid: - log(debugNow, "Action() START size (X,Y)", where.X, where.Y, "put next thing at (X,Y) =", where.NextX, where.NextY) + log(logInfo, "Action() START size (X,Y)", where.X, where.Y, "put next thing at (X,Y) =", where.NextX, where.NextY) where.NextY += 1 if (where.NextY > where.Y) { where.NextX += 1 where.NextY = 1 } - log(debugNow, "Action() END size (X,Y)", where.X, where.Y, "put next thing at (X,Y) =", where.NextX, where.NextY) + log(logInfo, "Action() END size (X,Y)", where.X, where.Y, "put next thing at (X,Y) =", where.NextX, where.NextY) where.Name = "jwc gridlaksdfjkl" where.Width = 320 where.Height = 240 // where.NextX = 5 // where.NextY = 7 - where.Dump(true) + // where.Dump(logInfo) default: } } -- cgit v1.2.3