diff options
| author | Jeff Carr <[email protected]> | 2024-01-17 23:39:03 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-17 23:39:03 -0600 |
| commit | a0baba0821441d9cf38f0b33fe12fb96925c6236 (patch) | |
| tree | 2aece2a890c66c36b08524e117753817078ee58c /andlabs | |
| parent | bee272651ad38453aef27f098513f7be652c39bf (diff) | |
new paths
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'andlabs')
| -rw-r--r-- | andlabs/action.go | 56 | ||||
| -rw-r--r-- | andlabs/add.go | 16 | ||||
| -rw-r--r-- | andlabs/addText.go | 6 | ||||
| -rw-r--r-- | andlabs/box.go | 8 | ||||
| -rw-r--r-- | andlabs/button.go | 6 | ||||
| -rw-r--r-- | andlabs/checkbox.go | 6 | ||||
| -rw-r--r-- | andlabs/combobox.go | 18 | ||||
| -rw-r--r-- | andlabs/common.go | 30 | ||||
| -rw-r--r-- | andlabs/debug.go | 40 | ||||
| -rw-r--r-- | andlabs/delete.go | 8 | ||||
| -rw-r--r-- | andlabs/dropdown.go | 29 | ||||
| -rw-r--r-- | andlabs/grid.go | 6 | ||||
| -rw-r--r-- | andlabs/group.go | 6 | ||||
| -rw-r--r-- | andlabs/icon.go | 46 | ||||
| -rw-r--r-- | andlabs/image.go | 1 | ||||
| -rw-r--r-- | andlabs/label.go | 6 | ||||
| -rw-r--r-- | andlabs/log.go | 6 | ||||
| -rw-r--r-- | andlabs/main.go | 8 | ||||
| -rw-r--r-- | andlabs/place.go | 19 | ||||
| -rw-r--r-- | andlabs/setText.go | 18 | ||||
| -rw-r--r-- | andlabs/slider.go | 6 | ||||
| -rw-r--r-- | andlabs/spinner.go | 8 | ||||
| -rw-r--r-- | andlabs/structs.go | 42 | ||||
| -rw-r--r-- | andlabs/tab.go | 42 | ||||
| -rw-r--r-- | andlabs/textbox.go | 8 | ||||
| -rw-r--r-- | andlabs/tree.go | 2 | ||||
| -rw-r--r-- | andlabs/widget.go | 4 | ||||
| -rw-r--r-- | andlabs/window.go | 8 |
28 files changed, 248 insertions, 211 deletions
diff --git a/andlabs/action.go b/andlabs/action.go index 28c78d5..c089078 100644 --- a/andlabs/action.go +++ b/andlabs/action.go @@ -3,9 +3,9 @@ package main import ( "errors" + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) // this will check to make sure that the node @@ -55,8 +55,12 @@ func ready(n *tree.Node) bool { return true } func (n *node) ready() bool { - if n == nil { return false } - if n.tk == nil { return false } + if n == nil { + return false + } + if n.tk == nil { + return false + } return true } @@ -71,7 +75,7 @@ func show(n *tree.Node, b bool) { if tk.uiControl == nil { return } - if (b) { + if b { tk.uiControl.Show() } else { tk.uiControl.Hide() @@ -90,7 +94,7 @@ func enable(n *tree.Node, b bool) { if tk.uiControl == nil { return } - if (b) { + if b { tk.uiControl.Enable() } else { tk.uiControl.Disable() @@ -101,7 +105,7 @@ func (n *node) pad(b bool) { log.Warn("pad() on WidgetId =", n.WidgetId) t := n.tk - if (t == nil) { + if t == nil { log.Log(ERROR, "pad() toolkit struct == nil. for", n.WidgetId) return } @@ -139,7 +143,7 @@ func (n *node) move(newParent *node) { log.Log(INFO, "TODO: move() for widget =", n.WidgetId) stretchy = true - if (p.tk.uiBox != nil) { + if p.tk.uiBox != nil { p.tk.uiBox.Append(n.tk.uiControl, stretchy) } default: @@ -184,7 +188,7 @@ func (n *node) Delete() { case widget.Box: log.Log(NOW, "tWidget.boxC =", p.progname) log.Log(NOW, "is there a tParent parent? =", p.parent) - if (p.tk.boxC < 1) { + if p.tk.boxC < 1 { log.Log(NOW, "Can not delete from Box. already empty. tWidget.boxC =", p.tk.boxC) return } @@ -204,7 +208,7 @@ func (n *node) Delete() { func rawAction(a *widget.Action) { log.Log(INFO, "rawAction() START a.ActionType =", a.ActionType, "a.Value", a.Value) - if (a.ActionType == widget.ToolkitInit) { + if a.ActionType == widget.ToolkitInit { Init() return } @@ -228,23 +232,23 @@ func rawAction(a *widget.Action) { n := me.treeRoot.FindWidgetId(a.WidgetId) - if (a.ActionType == widget.Add) { + if a.ActionType == widget.Add { me.treeRoot.ListWidgets() // ui.QueueMain(func() { - add(a) + add(a) // }) // TODO: remove this artificial delay // sleep(.001) return } - if (a.ActionType == widget.Dump) { + if a.ActionType == widget.Dump { log.Log(NOW, "rawAction() Dump =", a.ActionType, a.WidgetType, n.State.ProgName) // me.rootNode.listChildren(true) return } - if (n == nil) { + if n == nil { log.Error(errors.New("andlabs rawAction() ERROR findWidgetId found nil"), a.ActionType, a.WidgetType) log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId) log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType) @@ -286,18 +290,18 @@ func rawAction(a *widget.Action) { addText(n, a) // n.addText(a) /* - case widget.Margin: - n.pad(true) - case widget.Unmargin: - n.pad(false) - case widget.Pad: - n.pad(true) - case widget.Unpad: - n.pad(false) - case widget.Delete: - n.Delete() - case widget.Move: - log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) + case widget.Margin: + n.pad(true) + case widget.Unmargin: + n.pad(false) + case widget.Pad: + n.pad(true) + case widget.Unpad: + n.pad(false) + case widget.Delete: + n.Delete() + case widget.Move: + log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) */ default: log.Log(ERROR, "rawAction() Unknown =", a.ActionType, a.WidgetType) diff --git a/andlabs/add.go b/andlabs/add.go index a47d697..c948b88 100644 --- a/andlabs/add.go +++ b/andlabs/add.go @@ -1,13 +1,13 @@ package main import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" ) func add(a *widget.Action) { log.Warn("andlabs add()", a.WidgetId, a.State.ProgName) - if (a.WidgetType == widget.Root) { + if a.WidgetType == widget.Root { if me.treeRoot == nil { me.treeRoot = me.myTree.AddNode(a) } @@ -33,9 +33,9 @@ func add(a *widget.Action) { newBox(n) return /* - case widget.Tab: - newTab(n) - return + case widget.Tab: + newTab(n) + return */ case widget.Label: newLabel(p, n) @@ -62,9 +62,9 @@ func add(a *widget.Action) { newTextbox(p, n) return /* - case widget.Image: - newImage(p, n) - return + case widget.Image: + newImage(p, n) + return */ default: log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.State.ProgName) diff --git a/andlabs/addText.go b/andlabs/addText.go index d335be2..e5c1483 100644 --- a/andlabs/addText.go +++ b/andlabs/addText.go @@ -1,9 +1,9 @@ package main import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) func compareStrings(n *tree.Node, ss []string) { @@ -14,7 +14,7 @@ func addText(n *tree.Node, a *widget.Action) { var tk *guiWidget tk = n.TK.(*guiWidget) log.Warn("andlabs addText() START with a.Value =", a.Value) - if (tk == nil) { + if tk == nil { log.Log(ERROR, "addText error. tk == nil", n.State.ProgName, n.WidgetId) return } diff --git a/andlabs/box.go b/andlabs/box.go index df4cfba..f2277f4 100644 --- a/andlabs/box.go +++ b/andlabs/box.go @@ -1,8 +1,8 @@ package main import ( - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/lib/widget" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" @@ -10,7 +10,9 @@ import ( // make new Box here func newBox(n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) var box *ui.Box diff --git a/andlabs/button.go b/andlabs/button.go index 4bbc8f2..20a6541 100644 --- a/andlabs/button.go +++ b/andlabs/button.go @@ -1,7 +1,7 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" @@ -9,7 +9,9 @@ import ( // func (p *node) newButton(n *node) { func newButton(p *tree.Node, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } var ptk *guiWidget ptk = p.TK.(*guiWidget) newt := new(guiWidget) diff --git a/andlabs/checkbox.go b/andlabs/checkbox.go index d447baf..221edb4 100644 --- a/andlabs/checkbox.go +++ b/andlabs/checkbox.go @@ -1,14 +1,16 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) func newCheckbox(p *tree.Node, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) newt.uiCheckbox = ui.NewCheckbox(n.GetLabel()) diff --git a/andlabs/combobox.go b/andlabs/combobox.go index adfea36..a2cf4c9 100644 --- a/andlabs/combobox.go +++ b/andlabs/combobox.go @@ -5,11 +5,13 @@ import ( _ "go.wit.com/dev/andlabs/ui/winmanifest" "go.wit.com/log" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) func newCombobox(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) cb := ui.NewEditableCombobox() @@ -43,20 +45,22 @@ func newCombobox(p, n *tree.Node) { } func addComboboxName(n *tree.Node, s string) { - if ! ready(n) { return } + if !ready(n) { + return + } var tk *guiWidget tk = n.TK.(*guiWidget) log.Log(INFO, "addComboboxName()", n.WidgetId, "add:", s) tk.uiEditableCombobox.Append(s) - if (tk.val == nil) { + if tk.val == nil { log.Log(INFO, "make map didn't work") return } tk.val[tk.c] = s // If this is the first menu added, set the dropdown to it - if (tk.c == 0) { + if tk.c == 0 { log.Log(INFO, "THIS IS THE FIRST combobox", s) tk.uiEditableCombobox.SetText(s) } @@ -64,7 +68,9 @@ func addComboboxName(n *tree.Node, s string) { } func setComboboxName(n *tree.Node, s string) bool { - if ! ready(n) { return false} + if !ready(n) { + return false + } var tk *guiWidget tk = n.TK.(*guiWidget) log.Log(INFO, "SetComboboxName()", n.WidgetId, ",", s) diff --git a/andlabs/common.go b/andlabs/common.go index 1cfac84..ea981a9 100644 --- a/andlabs/common.go +++ b/andlabs/common.go @@ -1,24 +1,24 @@ package main import ( - "go.wit.com/gui/widget" + "go.wit.com/lib/widget" ) type node struct { - parent *node + parent *node children []*node - WidgetId int // widget ID - WidgetType widget.WidgetType - ParentId int // parent ID + WidgetId int // widget ID + WidgetType widget.WidgetType + ParentId int // parent ID - state widget.State + state widget.State // a reference name for programming and debuggign. Must be unique - progname string + progname string // the text used for button labesl, window titles, checkbox names, etc - label string + label string // horizontal means layout widgets like books on a bookshelf // vertical means layout widgets like books in a stack @@ -32,20 +32,20 @@ type node struct { strings []string // This is used for things like a slider(0,100) - X int - Y int + X int + Y int // This is for the grid size & widget position - W int - H int - AtW int - AtH int + W int + H int + AtW int + AtH int vals []string // dropdown menu items // horizontal bool `default:false` - hasTabs bool // does the window have tabs? + hasTabs bool // does the window have tabs? currentTab bool // the visible tab // the internal plugin toolkit structure diff --git a/andlabs/debug.go b/andlabs/debug.go index 51048d5..f974783 100644 --- a/andlabs/debug.go +++ b/andlabs/debug.go @@ -8,11 +8,11 @@ import ( var defaultBehavior bool = true var bookshelf bool // do you want things arranged in the box like a bookshelf or a stack? -var canvas bool // if set to true, the windows are a raw canvas -var menubar bool // for windows -var stretchy bool // expand things like buttons to the maximum size -var padded bool // add space between things like buttons -var margin bool // add space around the frames of windows +var canvas bool // if set to true, the windows are a raw canvas +var menubar bool // for windows +var stretchy bool // expand things like buttons to the maximum size +var padded bool // add space between things like buttons +var margin bool // add space around the frames of windows var debugToolkit bool = false var debugChange bool = false @@ -26,7 +26,7 @@ var debugError bool = true // This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc func setDefaultBehavior(s bool) { defaultBehavior = s - if (defaultBehavior) { + if defaultBehavior { log.Log(NOW, "Setting this toolkit to use the default behavior.") log.Log(NOW, "This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.") stretchy = false @@ -41,38 +41,38 @@ func setDefaultBehavior(s bool) { } func (t *guiWidget) Dump(b bool) { - if ! b { + if !b { return } log.Log(NOW, "Name = ", t.Width, t.Height) - if (t.uiBox != nil) { + if t.uiBox != nil { log.Log(NOW, "uiBox =", t.uiBox) } - if (t.uiButton != nil) { + if t.uiButton != nil { log.Log(NOW, "uiButton =", t.uiButton) } - if (t.uiCombobox != nil) { + if t.uiCombobox != nil { log.Log(NOW, "uiCombobox =", t.uiCombobox) } - if (t.uiWindow != nil) { + if t.uiWindow != nil { log.Log(NOW, "uiWindow =", t.uiWindow) } - if (t.uiTab != nil) { + if t.uiTab != nil { log.Log(NOW, "uiTab =", t.uiTab) } - if (t.uiGroup != nil) { + if t.uiGroup != nil { log.Log(NOW, "uiGroup =", t.uiGroup) } - if (t.uiEntry != nil) { + if t.uiEntry != nil { log.Log(NOW, "uiEntry =", t.uiEntry) } - if (t.uiMultilineEntry != nil) { + if t.uiMultilineEntry != nil { log.Log(NOW, "uiMultilineEntry =", t.uiMultilineEntry) } - if (t.uiSlider != nil) { + if t.uiSlider != nil { log.Log(NOW, "uiSlider =", t.uiSlider) } - if (t.uiCheckbox != nil) { + if t.uiCheckbox != nil { log.Log(NOW, "uiCheckbox =", t.uiCheckbox) } } @@ -86,7 +86,7 @@ func GetDebugToolkit () bool { func (n *node) dumpWidget(b bool) { var info, d string - if (n == nil) { + if n == nil { log.Log(ERROR, "dumpWidget() node == nil") return } @@ -98,14 +98,14 @@ func (n *node) dumpWidget(b bool) { for i := 0; i < listChildrenDepth; i++ { tabs = tabs + defaultPadding } - log.Log(NOW, tabs + d) + log.Log(NOW, tabs+d) } var defaultPadding string = " " var listChildrenDepth int = 0 func (n *node) listChildren(dump bool) { - if (n == nil) { + if n == nil { return } diff --git a/andlabs/delete.go b/andlabs/delete.go index d528b66..7d29bf2 100644 --- a/andlabs/delete.go +++ b/andlabs/delete.go @@ -3,8 +3,8 @@ package main // if you include more than just this import // then your plugin might be doing something un-ideal (just a guess from 2023/02/27) import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" ) // delete the child widget from the parent @@ -16,7 +16,7 @@ func (n *node) destroy() { pt := n.parent.tk ct := n.tk - if (ct == nil) { + if ct == nil { log.Log(NOW, "delete FAILED (ct = mapToolkit[c] == nil) for c", pId, cId) // this pukes out a whole universe of shit // listMap() @@ -30,7 +30,7 @@ func (n *node) destroy() { pt.Dump(true) log.Log(NOW, "Child:") ct.Dump(true) - if (pt.uiBox == nil) { + if pt.uiBox == nil { log.Log(NOW, "Don't know how to destroy this") } else { log.Log(NOW, "Fuck it, destroy the whole box", n.parent.progname) @@ -46,7 +46,7 @@ func (n *node) destroy() { log.Log(NOW, "Should delete Window here:", n.progname) default: log.Log(NOW, "Fuckit, let's destroy a button") - if (ct.uiButton != nil) { + if ct.uiButton != nil { pt.uiBox.Delete(4) ct.uiButton.Destroy() } diff --git a/andlabs/dropdown.go b/andlabs/dropdown.go index 6a1bd64..cda0026 100644 --- a/andlabs/dropdown.go +++ b/andlabs/dropdown.go @@ -5,11 +5,13 @@ import ( _ "go.wit.com/dev/andlabs/ui/winmanifest" "go.wit.com/log" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) func newDropdown(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) log.Log(INFO, "gui.Toolbox.newDropdown() START", n.GetProgName()) @@ -23,7 +25,7 @@ func newDropdown(p, n *tree.Node) { cb.OnSelected(func(spin *ui.Combobox) { i := spin.Selected() - if (newt.val == nil) { + if newt.val == nil { log.Log(ERROR, "make map didn't work") n.SetValue("map did not work. ui.Combobox error") } else { @@ -32,14 +34,15 @@ func newDropdown(p, n *tree.Node) { me.myTree.DoUserEvent(n) }) - n.TK = newt place(p, n) log.Warn("add dropdown entries on create:", n.State.Strings) log.Warn("add dropdown entries on create:", n.State.Strings) log.Warn("add dropdown entries on create:", n.State.Strings) - if n.State.Strings == nil {return} + if n.State.Strings == nil { + return + } // add the initial dropdown entries for i, s := range n.State.Strings { log.Warn("add dropdown: add entries on create", n.GetProgName(), i, s) @@ -51,27 +54,31 @@ func newDropdown(p, n *tree.Node) { } func setDropdownInt(n *tree.Node, i int) { - if ! ready(n) { return } + if !ready(n) { + return + } var tk *guiWidget tk = n.TK.(*guiWidget) tk.uiCombobox.SetSelected(i) } func addDropdownName(n *tree.Node, s string) { - if ! ready(n) { return } + if !ready(n) { + return + } var tk *guiWidget tk = n.TK.(*guiWidget) log.Log(INFO, "addDropdownName()", n.WidgetId, "add:", s) tk.uiCombobox.Append(s) - if (tk.val == nil) { + if tk.val == nil { log.Log(INFO, "make map didn't work") return } tk.val[tk.c] = s // If this is the first menu added, set the dropdown to it - if (tk.c == 0) { + if tk.c == 0 { log.Log(INFO, "THIS IS THE FIRST Dropdown", s) tk.uiCombobox.SetSelected(0) } @@ -79,7 +86,9 @@ func addDropdownName(n *tree.Node, s string) { } func setDropdownName(n *tree.Node, s string) bool { - if ! ready(n) { return false} + if !ready(n) { + return false + } var tk *guiWidget tk = n.TK.(*guiWidget) log.Log(INFO, "SetDropdownName()", n.WidgetId, ",", s) diff --git a/andlabs/grid.go b/andlabs/grid.go index bbb2c8b..603854c 100644 --- a/andlabs/grid.go +++ b/andlabs/grid.go @@ -1,7 +1,7 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" @@ -13,7 +13,9 @@ import ( // -- (1,2) -- (2,1) -- (3,1) -- // ----------------------------- func newGrid(n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } var newt *guiWidget newt = new(guiWidget) diff --git a/andlabs/group.go b/andlabs/group.go index efbabd9..0c2274a 100644 --- a/andlabs/group.go +++ b/andlabs/group.go @@ -2,14 +2,16 @@ package main import ( // "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) func newGroup(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) g := ui.NewGroup(n.GetLabel()) diff --git a/andlabs/icon.go b/andlabs/icon.go index 00c25f6..f56d1db 100644 --- a/andlabs/icon.go +++ b/andlabs/icon.go @@ -1,27 +1,27 @@ package main var rawImage = []byte{ - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, - 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, - 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, - 0x00, 0xca, 0x49, 0x44, 0x41, 0x54, 0x38, 0x11, 0xa5, 0x93, 0xb1, 0x0d, - 0xc2, 0x40, 0x0c, 0x45, 0x1d, 0xc4, 0x14, 0x0c, 0x12, 0x41, 0x0f, 0x62, - 0x12, 0x46, 0x80, 0x8a, 0x2e, 0x15, 0x30, 0x02, 0x93, 0x20, 0x68, 0x11, - 0x51, 0x06, 0x61, 0x0d, 0x88, 0x2d, 0x7f, 0xdb, 0x07, 0x87, 0x08, 0xdc, - 0x49, 0x91, 0x7d, 0xf6, 0xf7, 0xf3, 0x4f, 0xa4, 0x54, 0xbb, 0xeb, 0xf6, - 0x41, 0x05, 0x67, 0xcc, 0xb3, 0x9b, 0xfa, 0xf6, 0x17, 0x62, 0xdf, 0xcd, - 0x48, 0x00, 0x32, 0xbd, 0xa8, 0x1d, 0x72, 0xee, 0x3c, 0x47, 0x16, 0xfb, - 0x5c, 0x53, 0x8d, 0x03, 0x30, 0x14, 0x84, 0xf7, 0xd5, 0x89, 0x26, 0xc7, - 0x25, 0x10, 0x36, 0xe4, 0x05, 0xa2, 0x51, 0xbc, 0xc4, 0x1c, 0xc3, 0x1c, - 0xed, 0x30, 0x1c, 0x8f, 0x16, 0x3f, 0x02, 0x78, 0x33, 0x20, 0x06, 0x60, - 0x97, 0x70, 0xaa, 0x45, 0x7f, 0x85, 0x60, 0x5d, 0xb6, 0xf4, 0xc2, 0xc4, - 0x3e, 0x0f, 0x44, 0xcd, 0x1b, 0x20, 0x90, 0x0f, 0xed, 0x85, 0xa8, 0x55, - 0x05, 0x42, 0x43, 0xb4, 0x9e, 0xce, 0x71, 0xb3, 0xe8, 0x0e, 0xb4, 0xc4, - 0xc3, 0x39, 0x21, 0xb7, 0x73, 0xbd, 0xe4, 0x1b, 0xe4, 0x04, 0xb6, 0xaa, - 0x4f, 0x18, 0x2c, 0xee, 0x42, 0x31, 0x01, 0x84, 0xfa, 0xe0, 0xd4, 0x00, - 0xdf, 0xb6, 0x83, 0xf8, 0xea, 0xc2, 0x00, 0x10, 0xfc, 0x1a, 0x05, 0x30, - 0x74, 0x3b, 0xe0, 0xd1, 0x45, 0xb1, 0x83, 0xaa, 0xf4, 0x77, 0x7e, 0x02, - 0x87, 0x1f, 0x42, 0x7f, 0x9e, 0x2b, 0xe8, 0xdf, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, + 0x00, 0xca, 0x49, 0x44, 0x41, 0x54, 0x38, 0x11, 0xa5, 0x93, 0xb1, 0x0d, + 0xc2, 0x40, 0x0c, 0x45, 0x1d, 0xc4, 0x14, 0x0c, 0x12, 0x41, 0x0f, 0x62, + 0x12, 0x46, 0x80, 0x8a, 0x2e, 0x15, 0x30, 0x02, 0x93, 0x20, 0x68, 0x11, + 0x51, 0x06, 0x61, 0x0d, 0x88, 0x2d, 0x7f, 0xdb, 0x07, 0x87, 0x08, 0xdc, + 0x49, 0x91, 0x7d, 0xf6, 0xf7, 0xf3, 0x4f, 0xa4, 0x54, 0xbb, 0xeb, 0xf6, + 0x41, 0x05, 0x67, 0xcc, 0xb3, 0x9b, 0xfa, 0xf6, 0x17, 0x62, 0xdf, 0xcd, + 0x48, 0x00, 0x32, 0xbd, 0xa8, 0x1d, 0x72, 0xee, 0x3c, 0x47, 0x16, 0xfb, + 0x5c, 0x53, 0x8d, 0x03, 0x30, 0x14, 0x84, 0xf7, 0xd5, 0x89, 0x26, 0xc7, + 0x25, 0x10, 0x36, 0xe4, 0x05, 0xa2, 0x51, 0xbc, 0xc4, 0x1c, 0xc3, 0x1c, + 0xed, 0x30, 0x1c, 0x8f, 0x16, 0x3f, 0x02, 0x78, 0x33, 0x20, 0x06, 0x60, + 0x97, 0x70, 0xaa, 0x45, 0x7f, 0x85, 0x60, 0x5d, 0xb6, 0xf4, 0xc2, 0xc4, + 0x3e, 0x0f, 0x44, 0xcd, 0x1b, 0x20, 0x90, 0x0f, 0xed, 0x85, 0xa8, 0x55, + 0x05, 0x42, 0x43, 0xb4, 0x9e, 0xce, 0x71, 0xb3, 0xe8, 0x0e, 0xb4, 0xc4, + 0xc3, 0x39, 0x21, 0xb7, 0x73, 0xbd, 0xe4, 0x1b, 0xe4, 0x04, 0xb6, 0xaa, + 0x4f, 0x18, 0x2c, 0xee, 0x42, 0x31, 0x01, 0x84, 0xfa, 0xe0, 0xd4, 0x00, + 0xdf, 0xb6, 0x83, 0xf8, 0xea, 0xc2, 0x00, 0x10, 0xfc, 0x1a, 0x05, 0x30, + 0x74, 0x3b, 0xe0, 0xd1, 0x45, 0xb1, 0x83, 0xaa, 0xf4, 0x77, 0x7e, 0x02, + 0x87, 0x1f, 0x42, 0x7f, 0x9e, 0x2b, 0xe8, 0xdf, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, } diff --git a/andlabs/image.go b/andlabs/image.go index badd8b4..752ae99 100644 --- a/andlabs/image.go +++ b/andlabs/image.go @@ -18,6 +18,7 @@ func (p *node) newImage(n *node) { n.tk = newt // p.place(n) } + /* if (a.Name == "image") { log(true, "NewTextbox() trying to add a new image") diff --git a/andlabs/label.go b/andlabs/label.go index 12bc9c1..bbde03d 100644 --- a/andlabs/label.go +++ b/andlabs/label.go @@ -1,14 +1,16 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) func newLabel(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) c := ui.NewLabel(n.GetLabel()) newt.uiLabel = c diff --git a/andlabs/log.go b/andlabs/log.go index c6a8b48..e7f4163 100644 --- a/andlabs/log.go +++ b/andlabs/log.go @@ -4,7 +4,7 @@ package main this enables command line options from other packages like 'gui' and 'log' */ -import ( +import ( log "go.wit.com/log" ) @@ -22,10 +22,10 @@ func init() { full := "toolkit/nocui" short := "nocui" - NOW = log.NewFlag( "NOW", true, full, short, "temp debugging stuff") + NOW = log.NewFlag("NOW", true, full, short, "temp debugging stuff") INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff") - WARN = log.NewFlag("WARN", true, full, short, "bad things") + WARN = log.NewFlag("WARN", true, full, short, "bad things") SPEW = log.NewFlag("SPEW", false, full, short, "spew stuff") ERROR = log.NewFlag("ERROR", false, full, short, "toolkit errors") diff --git a/andlabs/main.go b/andlabs/main.go index b1e0e47..c543f6e 100644 --- a/andlabs/main.go +++ b/andlabs/main.go @@ -1,12 +1,12 @@ package main import ( - "sync" "runtime/debug" + "sync" + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" // the _ means we only need this for the init() @@ -27,7 +27,7 @@ func queueMain(currentA widget.Action) { me.myTree.DoToolkitPanic() } }() - ui.QueueMain( func() { + ui.QueueMain(func() { rawAction(¤tA) }) } diff --git a/andlabs/place.go b/andlabs/place.go index 25672e7..9ca11c6 100644 --- a/andlabs/place.go +++ b/andlabs/place.go @@ -5,11 +5,10 @@ import ( "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" - + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) // This routine is very specific to this toolkit @@ -31,7 +30,7 @@ import ( // ----------------------------- // internally for andlabs/ui -// (x&y flipped and start at zero) +// (x&y flipped and start at zero) // ----------------------------- // -- (0,0) -- (1,0) -- (1,0) -- // -- (0,1) -- (1,1) -- (1,1) -- @@ -41,7 +40,7 @@ func place(p *tree.Node, n *tree.Node) bool { log.Warn("SPEEDY newplace() 1 START", n.WidgetId, n.GetProgName(), n.GetLabel(), n.String()) log.Warn("SPEEDY newplace() n.State.Strings =", n.State.Strings) log.Log(INFO, "place() 1 START", n.WidgetType, n.GetProgName(), n.GetLabel()) - if ! ready(n) { + if !ready(n) { log.Warn("place() 1 START not ready()") return false } @@ -51,7 +50,7 @@ func place(p *tree.Node, n *tree.Node) bool { ptk = p.TK.(*guiWidget) log.Warn("SPEEDY newplace() 2 START", n.WidgetId, n.GetProgName(), n.GetLabel()) - if (ptk == nil) { + if ptk == nil { log.Log(ERROR, "ptk == nil", p.GetProgName(), p.ParentId, p.WidgetType, ptk) log.Log(ERROR, "n = ", n.GetProgName(), n.ParentId, n.WidgetType, tk) log.Warn("SPEEDY ptk == nil", n.WidgetId, n.GetProgName()) @@ -71,19 +70,19 @@ func place(p *tree.Node, n *tree.Node) bool { false, ui.AlignFill, false, ui.AlignFill) return true case widget.Group: - if (ptk.uiBox == nil) { + if ptk.uiBox == nil { log.Log(WARN, "place() andlabs hack group to use add a box", n.GetProgName(), n.WidgetType) - ptk.uiBox = rawBox(n) + ptk.uiBox = rawBox(n) ptk.uiGroup.SetChild(ptk.uiBox) } ptk.uiBox.Append(tk.uiControl, stretchy) return true case widget.Tab: - if (ptk.uiTab == nil) { + if ptk.uiTab == nil { log.Log(ERROR, "ptk.uiTab == nil for n.WidgetId =", n.WidgetId, "ptk =", ptk) panic("ptk.uiTab == nil") } - if (tk.uiControl == nil) { + if tk.uiControl == nil { log.Log(ERROR, "tk.uiControl == nil for n.WidgetId =", n.WidgetId, "tk =", tk) panic("tk.uiControl == nil") } diff --git a/andlabs/setText.go b/andlabs/setText.go index c5453db..2e4b97b 100644 --- a/andlabs/setText.go +++ b/andlabs/setText.go @@ -1,9 +1,9 @@ package main import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) // func (n *node) setText(a *widget.Action) { @@ -13,7 +13,7 @@ func setText(n *tree.Node, a *widget.Action) { tk = n.TK.(*guiWidget) log.Log(CHANGE, "setText() START with text =", name) - if (tk == nil) { + if tk == nil { log.Log(ERROR, "setText error. tk == nil", n.GetProgName(), n.WidgetId) return } @@ -29,10 +29,10 @@ func setText(n *tree.Node, a *widget.Action) { case widget.Checkbox: tk.uiCheckbox.SetText(name) case widget.Textbox: - if (tk.uiEntry != nil) { + if tk.uiEntry != nil { tk.uiEntry.SetText(name) } - if (tk.uiMultilineEntry != nil) { + if tk.uiMultilineEntry != nil { tk.uiMultilineEntry.SetText(name) } case widget.Label: @@ -52,7 +52,7 @@ func setText(n *tree.Node, a *widget.Action) { // try to find the string for i, s = range tk.val { log.Log(CHANGE, "i, s", i, s) - if (name == s) { + if name == s { tk.uiCombobox.SetSelected(i) log.Log(CHANGE, "setText() Dropdown worked.", name) return @@ -60,11 +60,11 @@ func setText(n *tree.Node, a *widget.Action) { } log.Log(ERROR, "setText() Dropdown did not find:", name) // if i == -1, then there are not any things in the menu to select - if (i == -1) { + if i == -1 { return } // if the string was never set, then set the dropdown to the last thing added to the menu - if (orig == -1) { + if orig == -1 { tk.uiCombobox.SetSelected(i) } case widget.Combobox: @@ -72,5 +72,5 @@ func setText(n *tree.Node, a *widget.Action) { default: log.Log(ERROR, "plugin Send() Don't know how to setText on", n.WidgetType, "yet", a.ActionType) } - log.Log(CHANGE, "setText() END with name =", ) + log.Log(CHANGE, "setText() END with name =") } diff --git a/andlabs/slider.go b/andlabs/slider.go index 5ce393a..ec82afe 100644 --- a/andlabs/slider.go +++ b/andlabs/slider.go @@ -1,14 +1,16 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) func newSlider(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) var x, y int diff --git a/andlabs/spinner.go b/andlabs/spinner.go index 65bd7db..a029edf 100644 --- a/andlabs/spinner.go +++ b/andlabs/spinner.go @@ -1,17 +1,19 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) func newSpinner(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) - s := ui.NewSpinbox(n.State.Range.Low,n.State.Range.High) + s := ui.NewSpinbox(n.State.Range.Low, n.State.Range.High) newt.uiSpinbox = s newt.uiControl = s diff --git a/andlabs/structs.go b/andlabs/structs.go index e39cbe7..4e1c056 100644 --- a/andlabs/structs.go +++ b/andlabs/structs.go @@ -1,7 +1,7 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" @@ -17,7 +17,7 @@ var me config type config struct { rootNode *tree.Node // the base of the binary tree. it should have id == 0 treeRoot *tree.Node // the base of the binary tree. it should have id == 0 - myTree *tree.TreeInfo + myTree *tree.TreeInfo } // stores the raw toolkit internals @@ -26,7 +26,7 @@ type guiWidget struct { Height int // tw *toolkit.Widget - parent *guiWidget + parent *guiWidget children []*guiWidget // used to track if a tab has a child widget yet @@ -34,31 +34,31 @@ type guiWidget struct { uiControl ui.Control - uiBox *ui.Box - uiButton *ui.Button - uiCombobox *ui.Combobox - uiCheckbox *ui.Checkbox - uiEntry *ui.Entry - uiGroup *ui.Group - uiLabel *ui.Label - uiSlider *ui.Slider - uiSpinbox *ui.Spinbox - uiTab *ui.Tab - uiWindow *ui.Window + uiBox *ui.Box + uiButton *ui.Button + uiCombobox *ui.Combobox + uiCheckbox *ui.Checkbox + uiEntry *ui.Entry + uiGroup *ui.Group + uiLabel *ui.Label + uiSlider *ui.Slider + uiSpinbox *ui.Spinbox + uiTab *ui.Tab + uiWindow *ui.Window uiMultilineEntry *ui.MultilineEntry - uiEditableCombobox *ui.EditableCombobox - uiImage *ui.Image + uiEditableCombobox *ui.EditableCombobox + uiImage *ui.Image - uiGrid *ui.Grid - gridX int - gridY int + uiGrid *ui.Grid + gridX int + gridY int // used as a counter to work around limitations of widgets like combobox // this is probably fucked up and in many ways wrong because of unsafe goroutine threading // but it's working for now due to the need for need for a correct interaction layer betten toolkits - c int + c int val map[int]string // andlabs/ui only accesses widget id numbers - boxC int // how many things on in a box or how many tabs + boxC int // how many things on in a box or how many tabs } diff --git a/andlabs/tab.go b/andlabs/tab.go index 2bccf5b..2307e6b 100644 --- a/andlabs/tab.go +++ b/andlabs/tab.go @@ -1,32 +1,32 @@ package main import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) /* - This adds a tab +This adds a tab - andlabs/ui is goofy in the sense that you have to determine - if the ui.Window already has a tab in it. If it does, then - you need to add this tab and not run SetChild() on the window - or instead it replaces the existing tab with the new one +andlabs/ui is goofy in the sense that you have to determine +if the ui.Window already has a tab in it. If it does, then +you need to add this tab and not run SetChild() on the window +or instead it replaces the existing tab with the new one - I work around this by always sending a Toolkit that is a tab - once there is one. If you send a Window here, it will replace - any existing tabs rather than adding a new one +I work around this by always sending a Toolkit that is a tab +once there is one. If you send a Window here, it will replace +any existing tabs rather than adding a new one */ func (p *node) newTab(n *node) { var newt *guiWidget - if (p == nil) { + if p == nil { log.Log(ERROR, "newTab() p == nil. how the fuck does this happen?", n.WidgetId, n.ParentId) } - if (p.WidgetType != widget.Window) { + if p.WidgetType != widget.Window { log.Log(ERROR, "newTab() uiWindow == nil. I can't add a toolbar without window", n.WidgetId, n.ParentId) return } @@ -34,15 +34,15 @@ func (p *node) newTab(n *node) { log.Log(TOOLKIT, "newTab() START", n.WidgetId, n.ParentId) - if (t.uiTab == nil) { + if t.uiTab == nil { // this means you have to make a new tab - log.Log(TOOLKIT, "newTab() GOOD. This should be the first tab:", n.WidgetId, n.ParentId) + log.Log(TOOLKIT, "newTab() GOOD. This should be the first tab:", n.WidgetId, n.ParentId) newt = rawTab(t.uiWindow, widget.GetString(n.value)) t.uiTab = newt.uiTab } else { // this means you have to append a tab - log.Log(TOOLKIT, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId) - if (n.WidgetType == widget.Tab) { + log.Log(TOOLKIT, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId) + if n.WidgetType == widget.Tab { // andlabs doesn't have multiple tab widgets so make a fake one? // this makes a guiWidget internal structure with the parent values newt = new(guiWidget) @@ -62,16 +62,16 @@ func (p *node) newTab(n *node) { func tabSetMargined(tab *ui.Tab, b bool) { c := tab.NumPages() for i := 0; i < c; i++ { - log.Log(TOOLKIT, "SetMargined", i, b) + log.Log(TOOLKIT, "SetMargined", i, b) tab.SetMargined(i, b) } } func rawTab(w *ui.Window, name string) *guiWidget { var newt guiWidget - log.Log(TOOLKIT, "rawTab() START", name) + log.Log(TOOLKIT, "rawTab() START", name) - if (w == nil) { + if w == nil { log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window") log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window") log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window") @@ -91,17 +91,17 @@ func (t *guiWidget) appendTab(name string) *guiWidget { var newT guiWidget log.Log(TOOLKIT, "appendTab() ADD", name) - if (t.uiTab == nil) { + if t.uiTab == nil { log.Log(TOOLKIT, "UiWindow == nil. I can't add a widget without a place to put it") panic("should never have happened. wit/gui/toolkit has ui.Tab == nil") } log.Log(TOOLKIT, "appendTab() START name =", name) var hbox *ui.Box - if (defaultBehavior) { + if defaultBehavior { hbox = ui.NewHorizontalBox() } else { - if (bookshelf) { + if bookshelf { hbox = ui.NewHorizontalBox() } else { hbox = ui.NewVerticalBox() diff --git a/andlabs/textbox.go b/andlabs/textbox.go index 3748a14..1e90dd3 100644 --- a/andlabs/textbox.go +++ b/andlabs/textbox.go @@ -1,17 +1,19 @@ package main import ( - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) func newTextbox(p, n *tree.Node) { - if notNew(n) { return } + if notNew(n) { + return + } newt := new(guiWidget) - if (n.State.Range.Low == 1) { + if n.State.Range.Low == 1 { e := ui.NewEntry() newt.uiEntry = e newt.uiControl = e diff --git a/andlabs/tree.go b/andlabs/tree.go index 400bee4..b39857c 100644 --- a/andlabs/tree.go +++ b/andlabs/tree.go @@ -12,7 +12,7 @@ package main */ import ( - "go.wit.com/gui/widget" + "go.wit.com/lib/widget" ) // Other goroutines must use this to access the GUI diff --git a/andlabs/widget.go b/andlabs/widget.go index d6d89ba..6600fa6 100644 --- a/andlabs/widget.go +++ b/andlabs/widget.go @@ -1,8 +1,8 @@ package main import ( - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/lib/widget" + "go.wit.com/toolkits/tree" ) func initWidget(n *tree.Node) *guiWidget { diff --git a/andlabs/window.go b/andlabs/window.go index d517f86..734654e 100644 --- a/andlabs/window.go +++ b/andlabs/window.go @@ -4,9 +4,9 @@ import ( "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) func (t *guiWidget) MessageWindow(msg1 string, msg2 string) { @@ -22,7 +22,7 @@ func newWindow(p, n *tree.Node) { newt = new(guiWidget) // menubar bool is if the OS defined border on the window should be used - win := ui.NewWindow(n.GetProgName(), 640, 480, menubar) + win := ui.NewWindow(n.GetProgName(), 640, 480, menubar) win.SetBorderless(canvas) win.SetMargined(margin) win.OnClosing(func(*ui.Window) bool { @@ -42,7 +42,7 @@ func newWindow(p, n *tree.Node) { func (n *node) SetWindowTitle(title string) { log.Log(CHANGE, "toolkit NewWindow", widget.GetString(n.value), "title", title) win := n.tk.uiWindow - if (win == nil) { + if win == nil { log.Log(ERROR, "Error: no window", n.WidgetId) } else { win.SetTitle(title) |
