simple cleanups
This commit is contained in:
parent
1918dcbbde
commit
bc15e6c879
9
init.go
9
init.go
|
@ -58,7 +58,7 @@ func init() {
|
||||||
me.myTree.SetChecked = queueSetChecked
|
me.myTree.SetChecked = queueSetChecked
|
||||||
me.myTree.ToolkitClose = queueToolkitClose
|
me.myTree.ToolkitClose = queueToolkitClose
|
||||||
|
|
||||||
me.newWindowTrigger = make(chan bool, 1)
|
me.newWindowTrigger = make(chan *guiWidget, 1)
|
||||||
go newWindowTrigger()
|
go newWindowTrigger()
|
||||||
|
|
||||||
log.Log(NOW, "Init() start pluginChan")
|
log.Log(NOW, "Init() start pluginChan")
|
||||||
|
@ -200,14 +200,17 @@ func newWindowTrigger() {
|
||||||
for {
|
for {
|
||||||
log.Log(NOW, "newWindowTrigger() for loop")
|
log.Log(NOW, "newWindowTrigger() for loop")
|
||||||
select {
|
select {
|
||||||
case a := <-me.newWindowTrigger:
|
case tk := <-me.newWindowTrigger:
|
||||||
log.Log(NOW, "newWindowTrigger() got new window", a)
|
log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
redoWindows(1, -1)
|
redoWindows(1, -1)
|
||||||
if !me.stdout.init {
|
if !me.stdout.init {
|
||||||
me.stdout.init = true
|
me.stdout.init = true
|
||||||
relocateStdoutOffscreen()
|
relocateStdoutOffscreen()
|
||||||
}
|
}
|
||||||
|
tk.makeWindowActive()
|
||||||
|
tk.doWidgetClick(tk.gocuiSize.w0, tk.gocuiSize.h0)
|
||||||
|
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
|
||||||
log.Log(NOW, "newWindowTrigger() after sleep")
|
log.Log(NOW, "newWindowTrigger() after sleep")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
70
structs.go
70
structs.go
|
@ -37,41 +37,41 @@ type config struct {
|
||||||
helpLabel *gocui.View // ?
|
helpLabel *gocui.View // ?
|
||||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||||
// dropdownW *guiWidget // grab the dropdown choices from this widget
|
// dropdownW *guiWidget // grab the dropdown choices from this widget
|
||||||
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
|
||||||
FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||||
PadW int `default:"1" dense:"0"` // pad spacing
|
PadW int `default:"1" dense:"0"` // pad spacing
|
||||||
PadH int `default:"1" dense:"0"` // pad spacing
|
PadH int `default:"1" dense:"0"` // pad spacing
|
||||||
WindowW int `default:"8" dense:"0"` // how far down to start Window or Tab headings
|
WindowW int `default:"8" dense:"0"` // how far down to start Window or Tab headings
|
||||||
WindowH int `default:"-1"` // how far down to start Window or Tab headings
|
WindowH int `default:"-1"` // how far down to start Window or Tab headings
|
||||||
TabW int `default:"5" dense:"0"` // how far down to start Window or Tab headings
|
TabW int `default:"5" dense:"0"` // how far down to start Window or Tab headings
|
||||||
TabH int `default:"1" dense:"0"` // how far down to start Window or Tab headings
|
TabH int `default:"1" dense:"0"` // how far down to start Window or Tab headings
|
||||||
WindowPadW int `default:"8" dense:"0"` // additional amount of space to put between window & tab widgets
|
WindowPadW int `default:"8" dense:"0"` // additional amount of space to put between window & tab widgets
|
||||||
TabPadW int `default:"4" dense:"0"` // additional amount of space to put between window & tab widgets
|
TabPadW int `default:"4" dense:"0"` // additional amount of space to put between window & tab widgets
|
||||||
GroupPadW int `default:"2" dense:"1"` // additional amount of space to indent on a group
|
GroupPadW int `default:"2" dense:"1"` // additional amount of space to indent on a group
|
||||||
BoxPadW int `default:"2" dense:"1"` // additional amount of space to indent on a box
|
BoxPadW int `default:"2" dense:"1"` // additional amount of space to indent on a box
|
||||||
GridPadW int `default:"2" dense:"1"` // additional amount of space to indent on a grid
|
GridPadW int `default:"2" dense:"1"` // additional amount of space to indent on a grid
|
||||||
RawW int `default:"1"` // the raw beginning of each window (or tab)
|
RawW int `default:"1"` // the raw beginning of each window (or tab)
|
||||||
RawH int `default:"5"` // the raw beginning of each window (or tab)
|
RawH int `default:"5"` // the raw beginning of each window (or tab)
|
||||||
FakeW int `default:"20"` // offset for the hidden widgets
|
FakeW int `default:"20"` // offset for the hidden widgets
|
||||||
padded bool // add space between things like buttons
|
padded bool // add space between things like buttons
|
||||||
bookshelf bool // do you want things arranged in the box like a bookshelf or a stack?
|
bookshelf bool // do you want things arranged in the box like a bookshelf or a stack?
|
||||||
canvas bool // if set to true, the windows are a raw canvas
|
canvas bool // if set to true, the windows are a raw canvas
|
||||||
menubar bool // for windows
|
menubar bool // for windows
|
||||||
stretchy bool // expand things like buttons to the maximum size
|
stretchy bool // expand things like buttons to the maximum size
|
||||||
margin bool // add space around the frames of windows
|
margin bool // add space around the frames of windows
|
||||||
writeMutex sync.Mutex // writeMutex protects writes to *guiWidget (it's global right now maybe)
|
writeMutex sync.Mutex // writeMutex protects writes to *guiWidget (it's global right now maybe)
|
||||||
ecount int // counts how many mouse and keyboard events have occurred
|
ecount int // counts how many mouse and keyboard events have occurred
|
||||||
supermouse bool // prints out every widget found while you move the mouse around
|
supermouse bool // prints out every widget found while you move the mouse around
|
||||||
depth int // used for listWidgets() debugging
|
depth int // used for listWidgets() debugging
|
||||||
globalMouseDown bool // yep, mouse is pressed
|
globalMouseDown bool // yep, mouse is pressed
|
||||||
newWindowTrigger chan bool // work around hack to redraw windows a bit after NewWindow()
|
newWindowTrigger chan *guiWidget // work around hack to redraw windows a bit after NewWindow()
|
||||||
stdout stdout // information for the STDOUT window
|
stdout stdout // information for the STDOUT window
|
||||||
showDebug bool // todo: move this into config struct
|
showDebug bool // todo: move this into config struct
|
||||||
dropdown dropdown // the dropdown menu
|
dropdown dropdown // the dropdown menu
|
||||||
allwin []*guiWidget // for tracking which window is next
|
allwin []*guiWidget // for tracking which window is next
|
||||||
downW int // where the mouse was pressed down
|
downW int // where the mouse was pressed down
|
||||||
downH int // where the mouse was pressed down
|
downH int // where the mouse was pressed down
|
||||||
currentDrag *guiWidget // what widget is currently being moved around
|
currentDrag *guiWidget // what widget is currently being moved around
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
52
treeAdd.go
52
treeAdd.go
|
@ -31,71 +31,71 @@ func setFake(n *tree.Node) {
|
||||||
// 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) {
|
||||||
var nw *guiWidget
|
var tk *guiWidget
|
||||||
nw = 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())
|
||||||
switch n.WidgetType {
|
switch n.WidgetType {
|
||||||
case widget.Root:
|
case widget.Root:
|
||||||
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
||||||
nw.color = &colorRoot
|
tk.color = &colorRoot
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Flag:
|
case widget.Flag:
|
||||||
nw.color = &colorFlag
|
tk.color = &colorFlag
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Window:
|
case widget.Window:
|
||||||
nw.frame = false
|
tk.frame = false
|
||||||
// nw.color = &colorWindow
|
// tk.color = &colorWindow
|
||||||
nw.setColor(&colorWindow)
|
tk.setColor(&colorWindow)
|
||||||
me.newWindowTrigger <- true
|
me.newWindowTrigger <- tk
|
||||||
redoWindows(0, 0)
|
redoWindows(0, 0)
|
||||||
hideHelp()
|
hideHelp()
|
||||||
showHelp()
|
showHelp()
|
||||||
return
|
return
|
||||||
case widget.Stdout:
|
case widget.Stdout:
|
||||||
nw.labelN = "moreSTDOUT"
|
tk.labelN = "moreSTDOUT"
|
||||||
n.State.ProgName = "moreSTDOUT"
|
n.State.ProgName = "moreSTDOUT"
|
||||||
n.State.Label = "moreSTDOUT"
|
n.State.Label = "moreSTDOUT"
|
||||||
return
|
return
|
||||||
case widget.Tab:
|
case widget.Tab:
|
||||||
nw.color = &colorTab
|
tk.color = &colorTab
|
||||||
return
|
return
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
nw.color = &colorButton
|
tk.color = &colorButton
|
||||||
return
|
return
|
||||||
case widget.Checkbox:
|
case widget.Checkbox:
|
||||||
nw.color = &colorCheckbox
|
tk.color = &colorCheckbox
|
||||||
nw.labelN = "X " + n.State.Label
|
tk.labelN = "X " + n.State.Label
|
||||||
return
|
return
|
||||||
case widget.Dropdown:
|
case widget.Dropdown:
|
||||||
nw.color = &colorDropdown
|
tk.color = &colorDropdown
|
||||||
return
|
return
|
||||||
case widget.Textbox:
|
case widget.Textbox:
|
||||||
n.State.Label = "TEXTBOX"
|
n.State.Label = "TEXTBOX"
|
||||||
nw.labelN = " " + n.State.Label
|
tk.labelN = " " + n.State.Label
|
||||||
nw.color = &colorDropdown
|
tk.color = &colorDropdown
|
||||||
return
|
return
|
||||||
case widget.Combobox:
|
case widget.Combobox:
|
||||||
nw.color = &colorCombobox
|
tk.color = &colorCombobox
|
||||||
return
|
return
|
||||||
case widget.Box:
|
case widget.Box:
|
||||||
nw.color = &colorBox
|
tk.color = &colorBox
|
||||||
nw.isFake = true
|
tk.isFake = true
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Grid:
|
case widget.Grid:
|
||||||
nw.color = &colorGrid
|
tk.color = &colorGrid
|
||||||
nw.isFake = true
|
tk.isFake = true
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Group:
|
case widget.Group:
|
||||||
nw.color = &colorGroup
|
tk.color = &colorGroup
|
||||||
nw.frame = false
|
tk.frame = false
|
||||||
return
|
return
|
||||||
case widget.Label:
|
case widget.Label:
|
||||||
nw.color = &colorLabel
|
tk.color = &colorLabel
|
||||||
nw.frame = false
|
tk.frame = false
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
|
@ -104,5 +104,5 @@ func addWidget(n *tree.Node) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
nw.dumpWidget("in addWidget()")
|
tk.dumpWidget("addWidget()unknown")
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
log "go.wit.com/log"
|
||||||
"go.wit.com/toolkits/tree"
|
"go.wit.com/toolkits/tree"
|
||||||
"go.wit.com/widget"
|
"go.wit.com/widget"
|
||||||
)
|
)
|
||||||
|
@ -37,7 +38,13 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
||||||
tk.full.h0 = tk.force.h0
|
tk.full.h0 = tk.force.h0
|
||||||
|
|
||||||
tk.setFullSize()
|
tk.setFullSize()
|
||||||
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
v, err := me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("crap. got an err", err)
|
||||||
|
}
|
||||||
|
if tk.v != v {
|
||||||
|
log.Info("crap. got another problem v != tk.v")
|
||||||
|
}
|
||||||
tk.Show()
|
tk.Show()
|
||||||
tk.v.Clear()
|
tk.v.Clear()
|
||||||
fmt.Fprint(tk.v, "ZZZ"+tk.GetText())
|
fmt.Fprint(tk.v, "ZZZ"+tk.GetText())
|
||||||
|
|
Loading…
Reference in New Issue