diff --git a/gocui/add.go b/gocui/add.go index 35718b7..92a512c 100644 --- a/gocui/add.go +++ b/gocui/add.go @@ -1,7 +1,7 @@ package main import ( - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) var fakeStartWidth int = me.FakeW @@ -29,41 +29,41 @@ func (n *node) addWidget() { nw := n.tk log(logInfo, "setStartWH() w.id =", n.WidgetId, "n.name", n.Name) switch n.WidgetType { - case toolkit.Root: + case widget.Root: log(logInfo, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.Name) nw.color = &colorRoot n.setFake() return - case toolkit.Flag: + case widget.Flag: nw.color = &colorFlag n.setFake() return - case toolkit.Window: + case widget.Window: nw.frame = false nw.color = &colorWindow // redoWindows(0,0) return - case toolkit.Tab: + case widget.Tab: nw.color = &colorTab // redoWindows(0,0) return - case toolkit.Button: + case widget.Button: nw.color = &colorButton - case toolkit.Box: + case widget.Box: nw.color = &colorBox nw.isFake = true n.setFake() return - case toolkit.Grid: + case widget.Grid: nw.color = &colorGrid nw.isFake = true n.setFake() return - case toolkit.Group: + case widget.Group: nw.color = &colorGroup nw.frame = false return - case toolkit.Label: + case widget.Label: nw.color = &colorLabel nw.frame = false return diff --git a/gocui/checkbox.go b/gocui/checkbox.go index 102d1e0..8d350ab 100644 --- a/gocui/checkbox.go +++ b/gocui/checkbox.go @@ -2,12 +2,12 @@ package main import ( // "github.com/awesome-gocui/gocui" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func (n *node) setCheckbox(b bool) { w := n.tk - if (n.WidgetType != toolkit.Checkbox) { + if (n.WidgetType != widget.Checkbox) { return } if (b) { diff --git a/gocui/click.go b/gocui/click.go index fe7f672..826ca6b 100644 --- a/gocui/click.go +++ b/gocui/click.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/awesome-gocui/gocui" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) // set isCurrent = false everywhere @@ -11,7 +11,7 @@ func unsetCurrent(n *node) { w := n.tk w.isCurrent = false - if n.WidgetType == toolkit.Tab { + if n.WidgetType == widget.Tab { // n.tk.color = &colorTab // n.setColor() } @@ -26,7 +26,7 @@ func unsetCurrent(n *node) { // to be in current display func (n *node) updateCurrent() { log(true, "updateCurrent()", n.Name) - if n.WidgetType == toolkit.Tab { + if n.WidgetType == widget.Tab { if n.IsCurrent() { // n.tk.color = &colorActiveT n.setColor(&colorActiveT) @@ -39,13 +39,13 @@ func (n *node) updateCurrent() { } return } - if n.WidgetType == toolkit.Window { + if n.WidgetType == widget.Window { if n.IsCurrent() { // setCurrentWindow(n) } return } - if n.WidgetType == toolkit.Root { + if n.WidgetType == widget.Root { return } n.parent.updateCurrent() @@ -57,7 +57,7 @@ func setCurrentWindow(n *node) { return } w := n.tk - if n.WidgetType != toolkit.Window { + if n.WidgetType != widget.Window { return } unsetCurrent(me.rootNode) @@ -76,7 +76,7 @@ func setCurrentWindow(n *node) { // shows the widgets in a tab func setCurrentTab(n *node) { w := n.tk - if n.WidgetType != toolkit.Tab { + if n.WidgetType != widget.Tab { return } unsetCurrent(me.rootNode) @@ -88,14 +88,14 @@ func setCurrentTab(n *node) { func (n *node) doWidgetClick() { switch n.WidgetType { - case toolkit.Root: + case widget.Root: // THIS IS THE BEGINING OF THE LAYOUT log(true, "doWidgetClick()", n.Name) redoWindows(0,0) - case toolkit.Flag: + case widget.Flag: log(true, "doWidgetClick() FLAG widget name =", n.Name) log(true, "doWidgetClick() if this is the dropdown menu, handle it here?") - case toolkit.Window: + case widget.Window: if (me.currentWindow == n) { return } @@ -122,7 +122,7 @@ func (n *node) doWidgetClick() { if ! n.hasTabs { } */ - case toolkit.Tab: + case widget.Tab: if (n.IsCurrent()) { return // do nothing if you reclick on the already selected tab } @@ -133,7 +133,7 @@ func (n *node) doWidgetClick() { p.redoTabs(me.TabW, me.TabH) unsetCurrent(p) for _, child := range p.children { - if child.WidgetType == toolkit.Tab { + if child.WidgetType == widget.Tab { child.setColor(&colorTab) n.currentTab = false } @@ -144,17 +144,17 @@ func (n *node) doWidgetClick() { setCurrentTab(n) n.placeWidgets(me.RawW, me.RawH) n.showWidgets() - case toolkit.Group: + case widget.Group: // n.placeWidgets(p.tk.startH, newH) n.toggleTree() - case toolkit.Checkbox: + case widget.Checkbox: if (n.B) { n.setCheckbox(false) } else { n.setCheckbox(true) } n.doUserEvent() - case toolkit.Grid: + case widget.Grid: newR := n.realGocuiSize() // w,h := n.logicalSize() @@ -163,7 +163,7 @@ func (n *node) doWidgetClick() { n.placeGrid(newR.w0, newR.h0) n.showWidgets() - case toolkit.Box: + case widget.Box: // w.showWidgetPlacement(logNow, "drawTree()") if (n.horizontal) { log(true, "BOX IS HORIZONTAL", n.Name) @@ -172,9 +172,9 @@ func (n *node) doWidgetClick() { } // n.placeWidgets() n.toggleTree() - case toolkit.Button: + case widget.Button: n.doUserEvent() - case toolkit.Dropdown: + case widget.Dropdown: log(true, "do the dropdown here") if (me.ddview == nil) { me.ddview = addDropdown() diff --git a/gocui/debug.go b/gocui/debug.go index 3d66f57..9d41d90 100644 --- a/gocui/debug.go +++ b/gocui/debug.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func (n *node) dumpTree(draw bool) { @@ -41,7 +41,7 @@ func (n *node) showWidgetPlacement(b bool, s string) { s1 += fmt.Sprintf(" ") } if (n.parent != nil) { - if (n.parent.WidgetType == toolkit.Grid) { + if (n.parent.WidgetType == widget.Grid) { s1 += fmt.Sprintf("At(%2d,%2d) ", n.AtW, n.AtH) } } diff --git a/gocui/keybindings.go b/gocui/keybindings.go index be05336..3e6f1a1 100644 --- a/gocui/keybindings.go +++ b/gocui/keybindings.go @@ -7,7 +7,7 @@ package main import ( "os" "github.com/awesome-gocui/gocui" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func defaultKeybindings(g *gocui.Gui) error { @@ -141,9 +141,9 @@ func addDebugKeys(g *gocui.Gui) { g.SetKeybinding("", gocui.KeyCtrlD, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error { if (showDebug) { - var a toolkit.Action + var a widget.Action a.B = true - a.ActionType = toolkit.EnableDebug + a.ActionType = widget.EnableDebug callback <- a logInfo = true logVerbose = true diff --git a/gocui/main.go b/gocui/main.go index f8270d5..5157ecd 100644 --- a/gocui/main.go +++ b/gocui/main.go @@ -6,7 +6,7 @@ package main import ( "os" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) // sets defaults and establishes communication @@ -17,7 +17,7 @@ func init() { // init the config struct default values Set(&me, "default") - pluginChan = make(chan toolkit.Action) + pluginChan = make(chan widget.Action) log(logNow, "Init() start pluginChan") go catchActionChannel() @@ -71,8 +71,8 @@ func standardExit() { } func sendBackQuit() { // send 'Quit' back to the program (?) - var a toolkit.Action - a.ActionType = toolkit.UserQuit + var a widget.Action + a.ActionType = widget.UserQuit callback <- a } diff --git a/gocui/place.go b/gocui/place.go index 8c6499d..f4b5edd 100644 --- a/gocui/place.go +++ b/gocui/place.go @@ -2,11 +2,11 @@ package main import ( "strings" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func (n *node) placeBox(startW int, startH int) { - if (n.WidgetType != toolkit.Box) { + if (n.WidgetType != widget.Box) { return } n.showWidgetPlacement(logNow, "boxS()") @@ -45,21 +45,21 @@ func (n *node) placeWidgets(startW int, startH int) { } switch n.WidgetType { - case toolkit.Window: + case widget.Window: for _, child := range n.children { child.placeWidgets(me.RawW, me.RawH) return } - case toolkit.Tab: + case widget.Tab: for _, child := range n.children { child.placeWidgets(me.RawW, me.RawH) return } - case toolkit.Grid: + case widget.Grid: n.placeGrid(startW, startH) - case toolkit.Box: + case widget.Box: n.placeBox(startW, startH) - case toolkit.Group: + case widget.Group: // move the group to the parent's next location n.gocuiSetWH(startW, startH) n.showWidgetPlacement(logNow, "group()") @@ -85,7 +85,7 @@ func (n *node) placeWidgets(startW int, startH int) { func (n *node) placeGrid(startW int, startH int) { w := n.tk n.showWidgetPlacement(logInfo, "grid0:") - if (n.WidgetType != toolkit.Grid) { + if (n.WidgetType != widget.Grid) { return } diff --git a/gocui/plugin.go b/gocui/plugin.go index 0ce00b8..3ba2fbb 100644 --- a/gocui/plugin.go +++ b/gocui/plugin.go @@ -3,10 +3,10 @@ package main import ( // if you include more than just this import // then your plugin might be doing something un-ideal (just a guess from 2023/02/27) - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) -func action(a *toolkit.Action) { +func action(a *widget.Action) { log(logInfo, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.Name) n := me.rootNode.findWidgetId(a.WidgetId) var w *guiWidget @@ -14,7 +14,7 @@ func action(a *toolkit.Action) { w = n.tk } switch a.ActionType { - case toolkit.Add: + case widget.Add: if (w == nil) { n := addNode(a) // w = n.tk @@ -25,14 +25,14 @@ func action(a *toolkit.Action) { log(logError, "action() Add ignored for already defined widget", a.WidgetId, a.ActionType, a.WidgetType, a.Name) } - case toolkit.Show: + case widget.Show: if (a.B) { n.showView() } else { n.hideWidgets() } - case toolkit.Set: - if a.WidgetType == toolkit.Flag { + case widget.Set: + if a.WidgetType == widget.Flag { log(logNow, "TODO: set flag here", a.ActionType, a.WidgetType, a.Name) log(logNow, "TODO: n.WidgetType =", n.WidgetType, "n.Name =", a.Name) } else { @@ -42,23 +42,23 @@ func action(a *toolkit.Action) { n.Set(a.A) } } - case toolkit.SetText: + case widget.SetText: n.SetText(a.S) - case toolkit.AddText: + case widget.AddText: n.AddText(a.S) - case toolkit.Move: + case widget.Move: log(logNow, "attempt to move() =", a.ActionType, a.WidgetType, a.Name) - case toolkit.CloseToolkit: + case widget.CloseToolkit: log(logNow, "attempting to close the plugin and release stdout and stderr") standardExit() - case toolkit.Enable: + case widget.Enable: if n.Visible() { // widget was already shown } else { log(logInfo, "Setting Visable to true", a.Name) n.SetVisible(true) } - case toolkit.Disable: + case widget.Disable: if n.Visible() { log(logInfo, "Setting Visable to false", a.Name) n.SetVisible(false) diff --git a/gocui/showStdout.go b/gocui/showStdout.go index 6c4ab85..5887527 100644 --- a/gocui/showStdout.go +++ b/gocui/showStdout.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/awesome-gocui/gocui" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) var outputW int = 180 @@ -47,10 +47,10 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View { } if (me.logStdout == nil) { - a := new(toolkit.Action) + a := new(widget.Action) a.Name = "stdout" a.Text = "stdout" - a.WidgetType = toolkit.Stdout + a.WidgetType = widget.Stdout a.WidgetId = -3 a.ParentId = 0 n := addNode(a) diff --git a/gocui/tab.go b/gocui/tab.go index d1b869b..382438c 100644 --- a/gocui/tab.go +++ b/gocui/tab.go @@ -4,7 +4,7 @@ package main import ( "strings" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func (w *guiWidget) Width() int { @@ -50,13 +50,13 @@ func (n *node) gocuiSetWH(sizeW, sizeH int) { func redoWindows(nextW int, nextH int) { for _, n := range me.rootNode.children { - if n.WidgetType != toolkit.Window { + if n.WidgetType != widget.Window { continue } w := n.tk var tabs bool for _, child := range n.children { - if (child.WidgetType == toolkit.Tab) { + if (child.WidgetType == widget.Tab) { tabs = true } } @@ -86,7 +86,7 @@ func redoWindows(nextW int, nextH int) { func (p *node) redoTabs(nextW int, nextH int) { for _, n := range p.children { - if n.WidgetType != toolkit.Tab { + if n.WidgetType != widget.Tab { continue } w := n.tk diff --git a/gocui/view.go b/gocui/view.go index 74c1309..a93ac28 100644 --- a/gocui/view.go +++ b/gocui/view.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/awesome-gocui/gocui" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func splitLines(s string) []string { @@ -183,11 +183,11 @@ func (n *node) hideWidgets() { w := n.tk w.isCurrent = false switch n.WidgetType { - case toolkit.Root: - case toolkit.Flag: - case toolkit.Window: - case toolkit.Box: - case toolkit.Grid: + case widget.Root: + case widget.Flag: + case widget.Window: + case widget.Box: + case widget.Grid: default: n.hideView() } diff --git a/gocui/widget.go b/gocui/widget.go index f48ed78..2690881 100644 --- a/gocui/widget.go +++ b/gocui/widget.go @@ -2,7 +2,7 @@ package main import ( "strconv" - "go.wit.com/gui/toolkits" + "go.wit.com/gui/widget" ) func initWidget(n *node) *guiWidget { @@ -15,14 +15,14 @@ func initWidget(n *node) *guiWidget { // set the name used by gocui to the id w.cuiName = strconv.Itoa(n.WidgetId) - if n.WidgetType == toolkit.Root { + if n.WidgetType == widget.Root { log(logInfo, "setupWidget() FOUND ROOT w.id =", n.WidgetId) n.WidgetId = 0 me.rootNode = n return w } - if (n.WidgetType == toolkit.Box) { + if (n.WidgetType == widget.Box) { if (n.B) { n.horizontal = true } else { @@ -30,7 +30,7 @@ func initWidget(n *node) *guiWidget { } } - if (n.WidgetType == toolkit.Grid) { + if (n.WidgetType == widget.Grid) { w.widths = make(map[int]int) // how tall each row in the grid is w.heights = make(map[int]int) // how wide each column in the grid is } @@ -39,9 +39,9 @@ func initWidget(n *node) *guiWidget { } func setupCtrlDownWidget() { - a := new(toolkit.Action) + a := new(widget.Action) a.Name = "ctrlDown" - a.WidgetType = toolkit.Dialog + a.WidgetType = widget.Dialog a.WidgetId = -1 a.ParentId = 0 n := addNode(a) @@ -81,13 +81,13 @@ func (n *node) findWidgetName(name string) *node { func (n *node) IsCurrent() bool { w := n.tk - if (n.WidgetType == toolkit.Tab) { + if (n.WidgetType == widget.Tab) { return w.isCurrent } - if (n.WidgetType == toolkit.Window) { + if (n.WidgetType == widget.Window) { return w.isCurrent } - if (n.WidgetType == toolkit.Root) { + if (n.WidgetType == widget.Root) { return false } return n.parent.IsCurrent() @@ -121,7 +121,7 @@ func (n *node) SetVisible(b bool) { func addDropdown() *node { n := new(node) - n.WidgetType = toolkit.Flag + n.WidgetType = widget.Flag n.WidgetId = -2 n.ParentId = 0