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
|
||||
}
|
||||
log.Info("got keypress 2. now what? dark =", me.dark)
|
||||
// findBG()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
// this is run every time the user moves the mouse over the terminal window
|
||||
func mouseMove(g *gocui.Gui) {
|
||||
w, h := g.MousePosition()
|
||||
me.ok = true // this tells init() it's okay to work with gocui
|
||||
|
||||
if me.supermouse {
|
||||
for _, tk := range findByXY(w, h) {
|
||||
|
|
6
find.go
6
find.go
|
@ -99,8 +99,10 @@ func (tk *guiWidget) findWindows() []*guiWidget {
|
|||
// gocui seems to not return mouse events unless there is something there
|
||||
func (tk *guiWidget) findBG() *guiWidget {
|
||||
if tk.node.WidgetType == widget.Stdout {
|
||||
tk.isBG = true
|
||||
return tk
|
||||
if tk.node.WidgetId != me.stdout.wId {
|
||||
tk.isBG = true
|
||||
return tk
|
||||
}
|
||||
}
|
||||
|
||||
for _, child := range tk.children {
|
||||
|
|
6
init.go
6
init.go
|
@ -47,6 +47,7 @@ func init() {
|
|||
// just make up unique values for these
|
||||
me.dropdown.wId = -77
|
||||
me.textbox.wId = -55
|
||||
me.stdout.wId = -4
|
||||
|
||||
// Set(&me, "dense")
|
||||
|
||||
|
@ -66,9 +67,9 @@ func init() {
|
|||
go newWindowTrigger()
|
||||
|
||||
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()
|
||||
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() {
|
||||
|
@ -207,6 +208,7 @@ func newWindowTrigger() {
|
|||
case tk := <-me.newWindowTrigger:
|
||||
// log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
waitOK()
|
||||
redoWindows(1, -1)
|
||||
if !me.stdout.init {
|
||||
me.stdout.init = true
|
||||
|
|
|
@ -80,6 +80,12 @@ func newAddText(n *tree.Node, s string) {
|
|||
|
||||
func newaction(n *tree.Node, atype widget.ActionType) {
|
||||
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 {
|
||||
log.Warn("Tree Error: Add() sent n == nil")
|
||||
return
|
||||
|
|
|
@ -45,7 +45,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
a := new(widget.Action)
|
||||
a.ProgName = "2stdout2"
|
||||
a.WidgetType = widget.Stdout
|
||||
a.WidgetId = -3
|
||||
a.WidgetId = me.stdout.wId
|
||||
a.ParentId = 0
|
||||
// n := addNode(a)
|
||||
n := me.myTree.AddNode(a)
|
||||
|
|
|
@ -31,8 +31,9 @@ type config struct {
|
|||
baseGui *gocui.Gui // the main gocui handle
|
||||
treeRoot *tree.Node // the base of the binary tree. it should have id == 0
|
||||
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
|
||||
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 // ?
|
||||
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
|
||||
|
@ -77,6 +78,7 @@ type config struct {
|
|||
// settings for the stdout window
|
||||
type stdout struct {
|
||||
tk *guiWidget // where to show STDOUT
|
||||
wId int // the widget id
|
||||
w int // the width
|
||||
h int // the height
|
||||
outputOnTop bool // is the STDOUT window on top?
|
||||
|
|
17
treeAdd.go
17
treeAdd.go
|
@ -4,6 +4,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
log "go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
"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
|
||||
// func (n *node) 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
|
||||
tk = n.TK.(*guiWidget)
|
||||
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.String())
|
||||
|
|
Loading…
Reference in New Issue