maybe stable?
This commit is contained in:
parent
b6b5df6a18
commit
d8353f9b1a
|
@ -77,6 +77,7 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
||||||
me.dark = true
|
me.dark = true
|
||||||
}
|
}
|
||||||
log.Info("got keypress 2. now what? dark =", me.dark)
|
log.Info("got keypress 2. now what? dark =", me.dark)
|
||||||
|
// findBG()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
// this is run every time the user moves the mouse over the terminal window
|
// this is run every time the user moves the mouse over the terminal window
|
||||||
func mouseMove(g *gocui.Gui) {
|
func mouseMove(g *gocui.Gui) {
|
||||||
w, h := g.MousePosition()
|
w, h := g.MousePosition()
|
||||||
|
me.ok = true // this tells init() it's okay to work with gocui
|
||||||
|
|
||||||
if me.supermouse {
|
if me.supermouse {
|
||||||
for _, tk := range findByXY(w, h) {
|
for _, tk := range findByXY(w, h) {
|
||||||
|
|
2
find.go
2
find.go
|
@ -99,9 +99,11 @@ func (tk *guiWidget) findWindows() []*guiWidget {
|
||||||
// gocui seems to not return mouse events unless there is something there
|
// gocui seems to not return mouse events unless there is something there
|
||||||
func (tk *guiWidget) findBG() *guiWidget {
|
func (tk *guiWidget) findBG() *guiWidget {
|
||||||
if tk.node.WidgetType == widget.Stdout {
|
if tk.node.WidgetType == widget.Stdout {
|
||||||
|
if tk.node.WidgetId != me.stdout.wId {
|
||||||
tk.isBG = true
|
tk.isBG = true
|
||||||
return tk
|
return tk
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, child := range tk.children {
|
for _, child := range tk.children {
|
||||||
if found := child.findBG(); found != nil {
|
if found := child.findBG(); found != nil {
|
||||||
|
|
6
init.go
6
init.go
|
@ -47,6 +47,7 @@ func init() {
|
||||||
// just make up unique values for these
|
// just make up unique values for these
|
||||||
me.dropdown.wId = -77
|
me.dropdown.wId = -77
|
||||||
me.textbox.wId = -55
|
me.textbox.wId = -55
|
||||||
|
me.stdout.wId = -4
|
||||||
|
|
||||||
// Set(&me, "dense")
|
// Set(&me, "dense")
|
||||||
|
|
||||||
|
@ -66,9 +67,9 @@ func init() {
|
||||||
go newWindowTrigger()
|
go newWindowTrigger()
|
||||||
|
|
||||||
log.Log(NOW, "Init() start pluginChan")
|
log.Log(NOW, "Init() start pluginChan")
|
||||||
log.Sleep(.1) // probably not needed, but in here for now under development
|
// log.Sleep(.1) // probably not needed, but in here for now under development
|
||||||
go mainGogui()
|
go mainGogui()
|
||||||
log.Sleep(.1) // probably not needed, but in here for now under development
|
// log.Sleep(.1) // probably not needed, but in here for now under development
|
||||||
}
|
}
|
||||||
|
|
||||||
func standardExit() {
|
func standardExit() {
|
||||||
|
@ -207,6 +208,7 @@ func newWindowTrigger() {
|
||||||
case tk := <-me.newWindowTrigger:
|
case tk := <-me.newWindowTrigger:
|
||||||
// log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
|
// log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
waitOK()
|
||||||
redoWindows(1, -1)
|
redoWindows(1, -1)
|
||||||
if !me.stdout.init {
|
if !me.stdout.init {
|
||||||
me.stdout.init = true
|
me.stdout.init = true
|
||||||
|
|
|
@ -80,6 +80,12 @@ func newAddText(n *tree.Node, s string) {
|
||||||
|
|
||||||
func newaction(n *tree.Node, atype widget.ActionType) {
|
func newaction(n *tree.Node, atype widget.ActionType) {
|
||||||
log.Log(INFO, "newaction() START", atype)
|
log.Log(INFO, "newaction() START", atype)
|
||||||
|
if !me.ok {
|
||||||
|
log.Log(INFO, "newaction() START NOT OKAY", atype)
|
||||||
|
log.Log(INFO, "newaction() START NOT OKAY", atype)
|
||||||
|
log.Log(INFO, "newaction() START NOT OKAY", atype)
|
||||||
|
waitOK()
|
||||||
|
}
|
||||||
if n == nil {
|
if n == nil {
|
||||||
log.Warn("Tree Error: Add() sent n == nil")
|
log.Warn("Tree Error: Add() sent n == nil")
|
||||||
return
|
return
|
||||||
|
|
|
@ -45,7 +45,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
||||||
a := new(widget.Action)
|
a := new(widget.Action)
|
||||||
a.ProgName = "2stdout2"
|
a.ProgName = "2stdout2"
|
||||||
a.WidgetType = widget.Stdout
|
a.WidgetType = widget.Stdout
|
||||||
a.WidgetId = -3
|
a.WidgetId = me.stdout.wId
|
||||||
a.ParentId = 0
|
a.ParentId = 0
|
||||||
// n := addNode(a)
|
// n := addNode(a)
|
||||||
n := me.myTree.AddNode(a)
|
n := me.myTree.AddNode(a)
|
||||||
|
|
|
@ -31,8 +31,9 @@ type config struct {
|
||||||
baseGui *gocui.Gui // the main gocui handle
|
baseGui *gocui.Gui // the main gocui handle
|
||||||
treeRoot *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 // ?
|
||||||
ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed
|
|
||||||
currentWindow *guiWidget // this is the current tab or window to show
|
currentWindow *guiWidget // this is the current tab or window to show
|
||||||
|
ok bool // if the user doesn't hit a key or move the mouse, gocui doesn't really start
|
||||||
|
ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed
|
||||||
helpLabel *gocui.View // ?
|
helpLabel *gocui.View // ?
|
||||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||||
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||||
|
@ -77,6 +78,7 @@ type config struct {
|
||||||
// settings for the stdout window
|
// settings for the stdout window
|
||||||
type stdout struct {
|
type stdout struct {
|
||||||
tk *guiWidget // where to show STDOUT
|
tk *guiWidget // where to show STDOUT
|
||||||
|
wId int // the widget id
|
||||||
w int // the width
|
w int // the width
|
||||||
h int // the height
|
h int // the height
|
||||||
outputOnTop bool // is the STDOUT window on top?
|
outputOnTop bool // is the STDOUT window on top?
|
||||||
|
|
17
treeAdd.go
17
treeAdd.go
|
@ -4,6 +4,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
log "go.wit.com/log"
|
log "go.wit.com/log"
|
||||||
"go.wit.com/toolkits/tree"
|
"go.wit.com/toolkits/tree"
|
||||||
"go.wit.com/widget"
|
"go.wit.com/widget"
|
||||||
|
@ -28,9 +30,24 @@ func setFake(n *tree.Node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func waitOK() {
|
||||||
|
for {
|
||||||
|
if me.ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set the widget start width & height
|
// set the widget start width & height
|
||||||
// func (n *node) addWidget(n *tree.Node) {
|
// func (n *node) addWidget(n *tree.Node) {
|
||||||
func addWidget(n *tree.Node) {
|
func addWidget(n *tree.Node) {
|
||||||
|
if !me.ok {
|
||||||
|
log.Log(INFO, "addWidget() START NOT OKAY")
|
||||||
|
log.Log(INFO, "addWidget() START NOT OKAY")
|
||||||
|
log.Log(INFO, "addWidget() START NOT OKAY")
|
||||||
|
waitOK()
|
||||||
|
}
|
||||||
var tk *guiWidget
|
var tk *guiWidget
|
||||||
tk = n.TK.(*guiWidget)
|
tk = n.TK.(*guiWidget)
|
||||||
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.String())
|
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.String())
|
||||||
|
|
Loading…
Reference in New Issue