move to fixing grids in andlabs
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
c077a3d4e1
commit
48575ec782
59
plugin.go
59
plugin.go
|
@ -20,31 +20,27 @@ type aplug struct {
|
||||||
name string
|
name string
|
||||||
filename string
|
filename string
|
||||||
plug *plugin.Plugin
|
plug *plugin.Plugin
|
||||||
// sym *plugin.Symbol
|
|
||||||
InitOk bool
|
|
||||||
|
|
||||||
// startup whatever might need to be setup in the plugin
|
// this tells the toolkit plugin how to send events
|
||||||
// Init func()
|
// back here
|
||||||
|
//
|
||||||
// This passes the go channel to the plugin
|
// This is how we are passed information like a user clicking a button
|
||||||
// the plugin then passes actions back to
|
|
||||||
// here where they are processed. If you wit/gui this is how
|
|
||||||
// you are passed information like a user clicking a button
|
|
||||||
// or a user changing a dropdown menu or a checkbox
|
// or a user changing a dropdown menu or a checkbox
|
||||||
//
|
//
|
||||||
// from this channel, the information is then passed into your
|
// From this channel, the information is then passed into the main program
|
||||||
// Custom() function
|
// Custom() function
|
||||||
//
|
//
|
||||||
// the custom functions are run from inside of your own goroutine
|
|
||||||
// where you initialize the gui
|
|
||||||
Callback func(chan toolkit.Action)
|
Callback func(chan toolkit.Action)
|
||||||
|
|
||||||
// This is how actions are sent to the plugin
|
// This is how actions are sent to the toolkit.
|
||||||
|
// For example:
|
||||||
|
// If a program is using GTK, when a program tries to make a new button
|
||||||
|
// "Open GIMP", then it would pass an action via this channel into the toolkit
|
||||||
|
// plugin and the toolkit plugin would add a button to the parent widget
|
||||||
//
|
//
|
||||||
// for example, when you you create a new button, it sends
|
|
||||||
// a structure to the goroutine that is handling the gui
|
|
||||||
// each toolkit has it's own goroutine and each one is sent this
|
// each toolkit has it's own goroutine and each one is sent this
|
||||||
// add button request
|
// add button request
|
||||||
|
//
|
||||||
pluginChan chan toolkit.Action
|
pluginChan chan toolkit.Action
|
||||||
PluginChannel func() chan toolkit.Action
|
PluginChannel func() chan toolkit.Action
|
||||||
}
|
}
|
||||||
|
@ -173,7 +169,6 @@ func initToolkit(name string, filename string) *aplug {
|
||||||
|
|
||||||
var newPlug *aplug
|
var newPlug *aplug
|
||||||
newPlug = new(aplug)
|
newPlug = new(aplug)
|
||||||
newPlug.InitOk = false
|
|
||||||
newPlug.name = name
|
newPlug.name = name
|
||||||
newPlug.filename = filename
|
newPlug.filename = filename
|
||||||
newPlug.plug = plug
|
newPlug.plug = plug
|
||||||
|
@ -197,7 +192,6 @@ func initToolkit(name string, filename string) *aplug {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
newPlug.Callback(me.guiChan)
|
newPlug.Callback(me.guiChan)
|
||||||
newPlug.InitOk = true
|
|
||||||
|
|
||||||
log(debugPlugin, "initToolkit() END", newPlug.name, filename)
|
log(debugPlugin, "initToolkit() END", newPlug.name, filename)
|
||||||
return newPlug
|
return newPlug
|
||||||
|
@ -248,37 +242,6 @@ func sendAction(a *toolkit.Action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func newaction(a *toolkit.Action, n *Node, where *Node) {
|
|
||||||
// remove this
|
|
||||||
if (n != nil) {
|
|
||||||
a.WidgetId = n.id
|
|
||||||
a.WidgetType = n.WidgetType
|
|
||||||
a.ActionType = a.ActionType
|
|
||||||
}
|
|
||||||
// end remove
|
|
||||||
if (where != nil) {
|
|
||||||
a.ParentId = where.id
|
|
||||||
if (where.WidgetType == toolkit.Grid) {
|
|
||||||
n.gridIncrement()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, aplug := range allPlugins {
|
|
||||||
log(debugPlugin, "Action() aplug =", aplug.name, "Action type=", a.ActionType)
|
|
||||||
if (aplug.pluginChan == nil) {
|
|
||||||
log(logInfo, "Action() retrieving the aplug.PluginChannel()", aplug.name)
|
|
||||||
aplug.pluginChan = aplug.PluginChannel()
|
|
||||||
log(logInfo, "Action() retrieved", aplug.pluginChan)
|
|
||||||
}
|
|
||||||
log(logInfo, "Action() SEND to pluginChan", aplug.name)
|
|
||||||
aplug.pluginChan <- *a
|
|
||||||
// added during debugging. might be a good idea in general for a tactile experience
|
|
||||||
sleep(.02)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func (n *Node) InitEmbed(resFS embed.FS) *Node {
|
func (n *Node) InitEmbed(resFS embed.FS) *Node {
|
||||||
me.resFS = resFS
|
me.resFS = resFS
|
||||||
return n
|
return n
|
||||||
|
|
|
@ -49,10 +49,10 @@ func (w *cuiWidget) showWidgets() {
|
||||||
// don't display by default
|
// don't display by default
|
||||||
} else {
|
} else {
|
||||||
if w.IsCurrent() {
|
if w.IsCurrent() {
|
||||||
w.showWidgetPlacement(logNow, "current:")
|
w.showWidgetPlacement(logInfo, "current:")
|
||||||
w.showView()
|
w.showView()
|
||||||
} else {
|
} else {
|
||||||
w.showWidgetPlacement(logNow, "not:")
|
w.showWidgetPlacement(logInfo, "not:")
|
||||||
// w.drawView()
|
// w.drawView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue