diff options
Diffstat (limited to 'toolkit')
| -rw-r--r-- | toolkit/andlabs/action.go | 10 | ||||
| -rw-r--r-- | toolkit/andlabs/add.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/debug.go | 20 | ||||
| -rw-r--r-- | toolkit/andlabs/log.go | 4 | ||||
| -rw-r--r-- | toolkit/andlabs/main.go | 10 | ||||
| -rw-r--r-- | toolkit/gocui/click.go | 2 | ||||
| -rw-r--r-- | toolkit/gocui/common.go | 2 | ||||
| -rw-r--r-- | toolkit/gocui/place.go | 2 | ||||
| -rw-r--r-- | toolkit/gocui/structs.go | 10 |
9 files changed, 46 insertions, 22 deletions
diff --git a/toolkit/andlabs/action.go b/toolkit/andlabs/action.go index 49a3465..c792a09 100644 --- a/toolkit/andlabs/action.go +++ b/toolkit/andlabs/action.go @@ -171,8 +171,8 @@ func (n *node) Delete() { } func rawAction(a toolkit.Action) { - log(logNow, "rawAction() START a.ActionType =", a.ActionType) - log(logNow, "rawAction() START a.S =", a.S) + log(logInfo, "rawAction() START a.ActionType =", a.ActionType) + log(logInfo, "rawAction() START a.S =", a.S) if (a.ActionType == toolkit.InitToolkit) { // TODO: make sure to only do this once @@ -184,7 +184,7 @@ func rawAction(a toolkit.Action) { return } - log(logNow, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) + log(logInfo, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) switch a.WidgetType { case toolkit.Flag: flag(&a) @@ -198,7 +198,7 @@ func rawAction(a toolkit.Action) { ui.QueueMain(func() { add(a) }) - sleep(.1) + sleep(.05) case toolkit.Show: n.show(true) case toolkit.Hide: @@ -237,5 +237,5 @@ func rawAction(a toolkit.Action) { default: log(debugError, "rawAction() Unknown =", a.ActionType, a.WidgetType) } - log(debugAction, "rawAction() END =", a.ActionType, a.WidgetType) + log(logInfo, "rawAction() END =", a.ActionType, a.WidgetType) } diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go index c25603d..fcdc56b 100644 --- a/toolkit/andlabs/add.go +++ b/toolkit/andlabs/add.go @@ -107,19 +107,19 @@ func (p *node) place(n *node) bool { log(logInfo, "place() switch", p.WidgetType) switch p.WidgetType { case toolkit.Grid: - log(debugGrid, "place() Grid try at Parent X,Y =", n.X, n.Y) + log(logInfo, "place() Grid try at Parent X,Y =", n.X, n.Y) n.tk.gridX = n.AtW - 1 n.tk.gridY = n.AtH - 1 - log(debugGrid, "place() Grid try at gridX,gridY", n.tk.gridX, n.tk.gridY) + log(logInfo, "place() Grid try at gridX,gridY", n.tk.gridX, n.tk.gridY) // at the very end, subtract 1 from X & Y since andlabs/ui starts counting at zero p.tk.uiGrid.Append(n.tk.uiControl, - n.tk.gridY, n.tk.gridX, 1, 1, + n.tk.gridX, n.tk.gridY, 1, 1, false, ui.AlignFill, false, ui.AlignFill) return true case toolkit.Group: if (p.tk.uiBox == nil) { p.tk.uiGroup.SetChild(n.tk.uiControl) - log(debugGrid, "place() hack Group to use this as the box?", n.Name, n.WidgetType) + log(logInfo, "place() hack Group to use this as the box?", n.Name, n.WidgetType) p.tk.uiBox = n.tk.uiBox } else { p.tk.uiBox.Append(n.tk.uiControl, stretchy) diff --git a/toolkit/andlabs/debug.go b/toolkit/andlabs/debug.go index cc32b71..7abd2d1 100644 --- a/toolkit/andlabs/debug.go +++ b/toolkit/andlabs/debug.go @@ -92,6 +92,24 @@ func GetDebugToolkit () bool { func flag(a *toolkit.Action) { // should set the checkbox to this value switch a.S { + case "Quiet": + logInfo = a.B + logVerbose = a.B + logWarn = a.B + logError = a.B + case "Error": + logError = a.B + case "Info": + logInfo = a.B + case "Verbose": + logInfo = a.B + logVerbose = a.B + logWarn = a.B + logError = a.B + debugToolkit = a.B + debugChange = a.B + debugPlugin = a.B + debugFlags = a.B case "Toolkit": debugToolkit = a.B case "Change": @@ -100,8 +118,6 @@ func flag(a *toolkit.Action) { debugPlugin = a.B case "Flags": debugFlags = a.B - case "Error": - debugError = a.B case "Now": debugNow = a.B case "Show": diff --git a/toolkit/andlabs/log.go b/toolkit/andlabs/log.go index 1a36188..5dbb914 100644 --- a/toolkit/andlabs/log.go +++ b/toolkit/andlabs/log.go @@ -8,8 +8,8 @@ import ( var logNow bool = true // useful for active development var logError bool = true var logWarn bool = true -var logInfo bool = true -var logVerbose bool = true +var logInfo bool = false +var logVerbose bool = false func log(a ...any) { witlog.Where = "wit/gui/andlabs" diff --git a/toolkit/andlabs/main.go b/toolkit/andlabs/main.go index 92f75d0..f66849d 100644 --- a/toolkit/andlabs/main.go +++ b/toolkit/andlabs/main.go @@ -20,19 +20,19 @@ var uiMain sync.Once var muAction sync.Mutex func catchActionChannel() { - log(logNow, "catchActionChannel() START") + log(logInfo, "catchActionChannel() START") for { - log(logNow, "catchActionChannel() for loop") + log(logInfo, "catchActionChannel() for loop") select { case a := <-pluginChan: - log(logNow, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name) - log(logNow, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType) + log(logInfo, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name) + log(logInfo, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType) muAction.Lock() // TODO ui.QueueMain(f) // TODO ui.QueueMain( func() {rawAction(a)} ) rawAction(a) muAction.Unlock() - log(logNow, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType) + log(logInfo, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType) } } } diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go index a4246a6..8802674 100644 --- a/toolkit/gocui/click.go +++ b/toolkit/gocui/click.go @@ -260,7 +260,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error { if (found == nil) { found = me.rootNode } - found.setRealSize() + // ? TODO: found.setRealSize() me.ctrlDown.gocuiSize.w0 = found.startW me.ctrlDown.gocuiSize.h0 = found.startH me.ctrlDown.gocuiSize.w1 = me.ctrlDown.gocuiSize.w0 + found.realWidth diff --git a/toolkit/gocui/common.go b/toolkit/gocui/common.go index 94b63b1..325a556 100644 --- a/toolkit/gocui/common.go +++ b/toolkit/gocui/common.go @@ -15,10 +15,10 @@ func makeWidget(a *toolkit.Action) *cuiWidget { w.b = a.B w.i = a.I w.s = a.S + w.X = a.X w.Y = a.Y - t := len(w.text) w.gocuiSize.w1 = w.gocuiSize.w0 + t + me.PadW w.gocuiSize.h1 = w.gocuiSize.h0 + me.DefaultHeight + me.PadH diff --git a/toolkit/gocui/place.go b/toolkit/gocui/place.go index bcb273b..0919308 100644 --- a/toolkit/gocui/place.go +++ b/toolkit/gocui/place.go @@ -257,5 +257,7 @@ func (w *cuiWidget) placeGrid() { w.showWidgetPlacement(logNow, "grid3:") } +/* func (w *cuiWidget) setRealSize() { } +*/ diff --git a/toolkit/gocui/structs.go b/toolkit/gocui/structs.go index b2a8b20..1fa6692 100644 --- a/toolkit/gocui/structs.go +++ b/toolkit/gocui/structs.go @@ -93,7 +93,7 @@ var ( // this is the standard binary tree structure for toolkits type node struct { - parent *node + parent *node children []*node WidgetId int // widget ID @@ -115,6 +115,12 @@ type node struct { X int Y int + // This is for the grid size & widget position + W int + H int + AtW int + AtH int + // the internal plugin toolkit structure tk *cuiWidget } @@ -199,7 +205,7 @@ type cuiWidget struct { v *gocui.View frame bool - parent *cuiWidget + parent *cuiWidget children []*cuiWidget } |
