gocui: closer to working layout
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d8a1c53757
commit
132efe17fe
|
@ -31,18 +31,10 @@ func (n *Node) redo(plug *aplug) {
|
||||||
a.WidgetType = n.WidgetType
|
a.WidgetType = n.WidgetType
|
||||||
a.WidgetId = n.id
|
a.WidgetId = n.id
|
||||||
|
|
||||||
// used for new Windows
|
|
||||||
// a.Width = n.Width
|
|
||||||
// a.Height = n.Height
|
|
||||||
|
|
||||||
// used for anything that needs a range
|
// used for anything that needs a range
|
||||||
a.X = n.X
|
a.X = n.X
|
||||||
a.Y = n.Y
|
a.Y = n.Y
|
||||||
|
|
||||||
// implement here for grids and tables ?
|
|
||||||
// a.NextX = n.NextX
|
|
||||||
// a.NextY = n.NextY
|
|
||||||
|
|
||||||
// used for values
|
// used for values
|
||||||
a.I = n.I
|
a.I = n.I
|
||||||
a.S = n.S
|
a.S = n.S
|
||||||
|
|
|
@ -6,28 +6,27 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: make these defaults in config struct definition
|
// TODO: make these defaults in config struct definition
|
||||||
var fakeStartWidth int = 40
|
var fakeStartWidth int = me.DevelOffsetW
|
||||||
var fakeStartHeight int = 3
|
var fakeStartHeight int = me.TabH + me.FramePadH
|
||||||
func (w *cuiWidget) setFake() {
|
func (w *cuiWidget) setFake() {
|
||||||
w.isFake = true
|
w.isFake = true
|
||||||
t := len(w.name)
|
t := len(w.name)
|
||||||
// setup fake labels for non-visable things off screen
|
// setup fake labels for non-visable things off screen
|
||||||
|
|
||||||
w.gocuiSize.width = t + me.PadW
|
|
||||||
w.gocuiSize.height = me.DefaultHeight + me.PadH
|
|
||||||
w.gocuiSize.w0 = fakeStartWidth
|
w.gocuiSize.w0 = fakeStartWidth
|
||||||
w.gocuiSize.h0 = fakeStartHeight
|
w.gocuiSize.h0 = fakeStartHeight
|
||||||
|
w.gocuiSize.w1 = w.gocuiSize.w0 + t + me.PadW
|
||||||
|
w.gocuiSize.h1 = w.gocuiSize.h0 + me.DefaultHeight + me.PadH
|
||||||
|
|
||||||
w.realWidth = w.gocuiSize.width + me.FramePadW
|
w.realWidth = w.gocuiSize.Width() + me.FramePadW
|
||||||
w.realHeight = w.gocuiSize.height + me.FramePadH
|
w.realHeight = w.gocuiSize.Height() + me.FramePadH
|
||||||
|
|
||||||
fakeStartHeight += w.realHeight
|
fakeStartHeight += w.realHeight
|
||||||
// TODO: use the actual max hight of the terminal window
|
// TODO: use the actual max hight of the terminal window
|
||||||
if (fakeStartHeight > 24) {
|
if (fakeStartHeight > 24) {
|
||||||
fakeStartHeight = 3
|
fakeStartHeight = me.TabH + me.FramePadH
|
||||||
fakeStartWidth += 20
|
fakeStartWidth += me.DevelOffsetW
|
||||||
}
|
}
|
||||||
w.setWH()
|
|
||||||
if (logInfo) {
|
if (logInfo) {
|
||||||
w.drawView()
|
w.drawView()
|
||||||
}
|
}
|
||||||
|
@ -70,8 +69,8 @@ func (w *cuiWidget) addWidget() {
|
||||||
w.startH = w.parent.startH + me.DefaultHeight + me.FramePadH
|
w.startH = w.parent.startH + me.DefaultHeight + me.FramePadH
|
||||||
|
|
||||||
t := len(w.text)
|
t := len(w.text)
|
||||||
w.gocuiSize.width = t + me.FramePadW
|
w.gocuiSize.w1 = w.gocuiSize.w0 + t + me.FramePadW
|
||||||
w.gocuiSize.height = me.DefaultHeight + me.FramePadH
|
w.gocuiSize.h1 = w.gocuiSize.h0 + me.DefaultHeight + me.FramePadH
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
w.startW = w.parent.startW
|
w.startW = w.parent.startW
|
||||||
|
|
|
@ -17,10 +17,16 @@ func (w *cuiWidget) setCheckbox(b bool) {
|
||||||
w.text = " " + w.name
|
w.text = " " + w.name
|
||||||
}
|
}
|
||||||
t := len(w.text) + 1
|
t := len(w.text) + 1
|
||||||
w.realWidth = t
|
w.gocuiSize.w1 = w.gocuiSize.w0 + t
|
||||||
w.gocuiSize.width = t
|
|
||||||
|
w.realWidth = w.gocuiSize.Width() + me.PadW
|
||||||
|
w.realHeight = w.gocuiSize.Height() + me.PadH
|
||||||
|
|
||||||
|
if w.frame {
|
||||||
|
w.realWidth += me.FramePadW
|
||||||
|
w.realHeight += me.FramePadH
|
||||||
|
}
|
||||||
|
|
||||||
w.setWH()
|
|
||||||
w.deleteView()
|
w.deleteView()
|
||||||
w.drawView()
|
w.drawView()
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,12 +182,10 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
found = me.rootNode
|
found = me.rootNode
|
||||||
}
|
}
|
||||||
found.setRealSize()
|
found.setRealSize()
|
||||||
me.ctrlDown.gocuiSize.width = found.realWidth
|
|
||||||
me.ctrlDown.gocuiSize.height = found.realHeight
|
|
||||||
me.ctrlDown.gocuiSize.w0 = found.startW
|
me.ctrlDown.gocuiSize.w0 = found.startW
|
||||||
me.ctrlDown.gocuiSize.h0 = found.startH
|
me.ctrlDown.gocuiSize.h0 = found.startH
|
||||||
me.ctrlDown.setWH()
|
me.ctrlDown.gocuiSize.w1 = me.ctrlDown.gocuiSize.w0 + found.realWidth
|
||||||
|
me.ctrlDown.gocuiSize.h1 = me.ctrlDown.gocuiSize.h0 + found.realHeight
|
||||||
if (me.ctrlDown.v == nil) {
|
if (me.ctrlDown.v == nil) {
|
||||||
me.ctrlDown.text = found.text
|
me.ctrlDown.text = found.text
|
||||||
me.ctrlDown.showWidgetPlacement(logNow, "ctrlDown:")
|
me.ctrlDown.showWidgetPlacement(logNow, "ctrlDown:")
|
||||||
|
|
|
@ -20,11 +20,11 @@ func makeWidget(a *toolkit.Action) *cuiWidget {
|
||||||
|
|
||||||
|
|
||||||
t := len(w.text)
|
t := len(w.text)
|
||||||
w.gocuiSize.width = t + me.PadW
|
w.gocuiSize.w1 = w.gocuiSize.w0 + t + me.PadW
|
||||||
w.gocuiSize.height = me.DefaultHeight + me.PadH
|
w.gocuiSize.h1 = w.gocuiSize.h0 + me.DefaultHeight + me.PadH
|
||||||
|
|
||||||
w.realWidth = w.gocuiSize.width
|
w.realWidth = w.gocuiSize.Width()
|
||||||
w.realHeight = w.gocuiSize.height
|
w.realHeight = w.gocuiSize.Height()
|
||||||
|
|
||||||
// set the gocui view.Frame = true by default
|
// set the gocui view.Frame = true by default
|
||||||
w.frame = true
|
w.frame = true
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
|
||||||
s1 += fmt.Sprintf("s/n (%2d,%2d) (%2d,%2d) ", w.startW, w.startH, w.nextW, w.nextH)
|
s1 += fmt.Sprintf("s/n (%2d,%2d) (%2d,%2d) ", w.startW, w.startH, w.nextW, w.nextH)
|
||||||
s1 += fmt.Sprintf("size (%2d,%2d) ", w.realWidth, w.realHeight)
|
s1 += fmt.Sprintf("size (%2d,%2d) ", w.realWidth, w.realHeight)
|
||||||
s1 += fmt.Sprintf("gocui=(%2d,%2d)(%2d,%2d,%2d,%2d)",
|
s1 += fmt.Sprintf("gocui=(%2d,%2d)(%2d,%2d,%2d,%2d)",
|
||||||
w.gocuiSize.width, w.gocuiSize.height,
|
w.gocuiSize.Width(), w.gocuiSize.Height(),
|
||||||
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
||||||
log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
|
log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,10 @@ func addDebugKeys(g *gocui.Gui) {
|
||||||
g.SetKeybinding("", 'd', gocui.ModNone,
|
g.SetKeybinding("", 'd', gocui.ModNone,
|
||||||
func(g *gocui.Gui, v *gocui.View) error {
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
log(logNow, "gocui.SetKeyBinding() dumpTree() START")
|
log(logNow, "gocui.SetKeyBinding() dumpTree() START")
|
||||||
me.rootNode.dumpTree(true)
|
// me.rootNode.dumpTree(true)
|
||||||
if (showDebug) {
|
if (showDebug) {
|
||||||
|
fakeStartWidth = me.DevelOffsetW
|
||||||
|
fakeStartHeight = me.TabH + me.FramePadH
|
||||||
me.rootNode.showFake()
|
me.rootNode.showFake()
|
||||||
showDebug = false
|
showDebug = false
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,19 +13,10 @@ import (
|
||||||
// to this toolkit from the wit/gui golang package
|
// to this toolkit from the wit/gui golang package
|
||||||
func init() {
|
func init() {
|
||||||
log(logInfo, "Init() of awesome-gocui")
|
log(logInfo, "Init() of awesome-gocui")
|
||||||
|
|
||||||
|
// init the config struct default values
|
||||||
Set(&me, "default")
|
Set(&me, "default")
|
||||||
|
|
||||||
// me.groupPadding = 4
|
|
||||||
// me.buttonPadding = 3
|
|
||||||
|
|
||||||
// todo, remove all of these
|
|
||||||
// me.defaultWidth = 10
|
|
||||||
// me.defaultHeight = 2 // this means by default one line of text in a button
|
|
||||||
|
|
||||||
// me.horizontalPadding = 20
|
|
||||||
// me.horizontalPadding = 20
|
|
||||||
// todo, remove all of these
|
|
||||||
|
|
||||||
me.pluginChan = make(chan toolkit.Action)
|
me.pluginChan = make(chan toolkit.Action)
|
||||||
|
|
||||||
log(logNow, "Init() start pluginChan")
|
log(logNow, "Init() start pluginChan")
|
||||||
|
|
|
@ -48,31 +48,6 @@ func (w *cuiWidget) placeBox() {
|
||||||
w.showWidgetPlacement(logNow, "boxE()")
|
w.showWidgetPlacement(logNow, "boxE()")
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func (w *cuiWidget) getGroupWH() {
|
|
||||||
p := w.parent // the parent must be a group widget
|
|
||||||
|
|
||||||
// update parent gocuiSize
|
|
||||||
// p.realWidth =
|
|
||||||
// p.realHeight += me.DefaultHeight + me.PadH + me.FramePadH
|
|
||||||
for _, child := range p.children {
|
|
||||||
p.realWidth += child.realWidth
|
|
||||||
p.realHeight += child.realHeight
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute child offset
|
|
||||||
w.startW = p.startW
|
|
||||||
w.startH = p.startH
|
|
||||||
for _, child := range p.children {
|
|
||||||
w.startH += child.realHeight
|
|
||||||
if child == w {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func (w *cuiWidget) placeWidgets() {
|
func (w *cuiWidget) placeWidgets() {
|
||||||
if (w == nil) {
|
if (w == nil) {
|
||||||
return
|
return
|
||||||
|
@ -120,29 +95,31 @@ func (w *cuiWidget) placeWidgets() {
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "place()")
|
||||||
}
|
}
|
||||||
case toolkit.Grid:
|
case toolkit.Grid:
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "placeGrid() START")
|
||||||
w.placeGrid()
|
w.placeGrid()
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "placeGrid() END")
|
||||||
case toolkit.Box:
|
case toolkit.Box:
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "placeBox() START")
|
||||||
w.placeBox()
|
w.placeBox()
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "placeBox() END")
|
||||||
case toolkit.Group:
|
case toolkit.Group:
|
||||||
|
// move the group to the parent's next location
|
||||||
w.startW = p.nextW
|
w.startW = p.nextW
|
||||||
w.startH = p.nextH
|
w.startH = p.nextH
|
||||||
w.nextW = p.nextW
|
w.nextW = p.nextW
|
||||||
w.nextH = p.nextH
|
w.nextH = p.nextH
|
||||||
|
|
||||||
w.moveTo(p.nextW, p.nextH)
|
w.moveTo(p.nextW, p.nextH)
|
||||||
|
|
||||||
// set real width at the beginning
|
// initialize the real width to just the group gocui view
|
||||||
w.realWidth = w.gocuiSize.width
|
w.realWidth = w.gocuiSize.Width() + me.FramePadW
|
||||||
w.realHeight = w.gocuiSize.height
|
w.realHeight = w.gocuiSize.Height() + me.FramePadH
|
||||||
|
|
||||||
// indent the widgets for a group
|
// indent the widgets for a group
|
||||||
w.nextW = p.nextW + 4
|
w.nextW = p.nextW + me.GroupPadW
|
||||||
w.nextH = p.nextH + 3
|
w.nextH = p.nextH + w.realHeight
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "place()")
|
||||||
|
|
||||||
|
// mow move all the children aka: run place() on them
|
||||||
var maxW int
|
var maxW int
|
||||||
for _, child := range w.children {
|
for _, child := range w.children {
|
||||||
child.showWidgetPlacement(logNow, "place()")
|
child.showWidgetPlacement(logNow, "place()")
|
||||||
|
@ -167,33 +144,42 @@ func (w *cuiWidget) placeWidgets() {
|
||||||
w.startH = p.nextH
|
w.startH = p.nextH
|
||||||
w.nextW = p.nextW
|
w.nextW = p.nextW
|
||||||
w.nextH = p.nextH
|
w.nextH = p.nextH
|
||||||
|
newW := w.gocuiSize.Width()
|
||||||
|
newH := w.gocuiSize.Height()
|
||||||
w.gocuiSize.w0 = w.startW
|
w.gocuiSize.w0 = w.startW
|
||||||
w.gocuiSize.h0 = w.startH
|
w.gocuiSize.h0 = w.startH
|
||||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.gocuiSize.width
|
w.gocuiSize.w1 = w.gocuiSize.w0 + newW
|
||||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.gocuiSize.height
|
w.gocuiSize.h1 = w.gocuiSize.h0 + newH
|
||||||
if (w.realWidth < w.gocuiSize.width) {
|
|
||||||
w.realWidth = w.gocuiSize.width
|
// the realSize should not be smaller than the gocui view (?)
|
||||||
|
// this might not be a needed check? Maybe there are legit exceptions?
|
||||||
|
if (w.realWidth < newW) {
|
||||||
|
w.realWidth = newW
|
||||||
}
|
}
|
||||||
if (w.realHeight < w.gocuiSize.height) {
|
if (w.realHeight < newH) {
|
||||||
w.realHeight = w.gocuiSize.height
|
w.realHeight = newH
|
||||||
}
|
}
|
||||||
w.showWidgetPlacement(logNow, "place()")
|
w.showWidgetPlacement(logNow, "place()")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (w *cuiWidget) setWH() {
|
func (w *cuiWidget) setWH() {
|
||||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.gocuiSize.width
|
w.gocuiSize.w1 = w.gocuiSize.w0 + w.gocuiSize.width
|
||||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.gocuiSize.height
|
w.gocuiSize.h1 = w.gocuiSize.h0 + w.gocuiSize.height
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (w *cuiWidget) moveTo(leftW int, topH int) {
|
func (w *cuiWidget) moveTo(leftW int, topH int) {
|
||||||
if (w.isFake) {
|
if (w.isFake) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
newW := w.gocuiSize.Width()
|
||||||
|
newH := w.gocuiSize.Height()
|
||||||
w.gocuiSize.w0 = leftW
|
w.gocuiSize.w0 = leftW
|
||||||
w.gocuiSize.h0 = topH
|
w.gocuiSize.h0 = topH
|
||||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.gocuiSize.width
|
w.gocuiSize.w1 = w.gocuiSize.w0 + newW
|
||||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.gocuiSize.height
|
w.gocuiSize.h1 = w.gocuiSize.h0 + newH
|
||||||
w.showWidgetPlacement(logInfo, "moveTo()")
|
w.showWidgetPlacement(logInfo, "moveTo()")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,10 @@ type config struct {
|
||||||
// additional amount of space to put between window & tab widgets
|
// additional amount of space to put between window & tab widgets
|
||||||
TabPadW int `default:"2" dense:"0"`
|
TabPadW int `default:"2" dense:"0"`
|
||||||
|
|
||||||
|
// how far down to start Window or Tab headings
|
||||||
|
WindowH int `default:"1" dense:"0"`
|
||||||
|
TabH int `default:"2" dense:"0"`
|
||||||
|
|
||||||
// additional amount of space to indent on a group
|
// additional amount of space to indent on a group
|
||||||
GroupPadW int `default:"6" dense:"2"`
|
GroupPadW int `default:"6" dense:"2"`
|
||||||
|
|
||||||
|
@ -60,16 +64,15 @@ type config struct {
|
||||||
RawW int `default:"7"`
|
RawW int `default:"7"`
|
||||||
RawH int `default:"3"`
|
RawH int `default:"3"`
|
||||||
|
|
||||||
|
// offset for the hidden widgets
|
||||||
|
DevelOffsetW int `default:"20"`
|
||||||
|
|
||||||
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
|
||||||
padded bool // add space between things like buttons
|
padded bool // add space between things like buttons
|
||||||
margin bool // add space around the frames of windows
|
margin bool // add space around the frames of windows
|
||||||
|
|
||||||
// horizontalPadding int
|
|
||||||
// groupPadding int `default:"6" dense:"2"` // this is supposed to be how far to indent to the left
|
|
||||||
// buttonPadding int `default:"4" dense:"3"` // if 3, buttons slightly overlap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -85,14 +88,22 @@ type rectType struct {
|
||||||
// startW int
|
// startW int
|
||||||
// startH int
|
// startH int
|
||||||
|
|
||||||
// the actual size
|
// the is a shortcut to access
|
||||||
width int
|
// width int // this is always w1 - w0
|
||||||
height int
|
height int // this is always h1 - h0
|
||||||
|
|
||||||
// this is the gocui way
|
// this is the gocui way
|
||||||
w0, h0, w1, h1 int // left top right bottom
|
w0, h0, w1, h1 int // left top right bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *rectType) Width() int {
|
||||||
|
return r.w1 - r.w0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rectType) Height() int {
|
||||||
|
return r.h1 - r.h0
|
||||||
|
}
|
||||||
|
|
||||||
type cuiWidget struct {
|
type cuiWidget struct {
|
||||||
id int // widget ID
|
id int // widget ID
|
||||||
// parentId int
|
// parentId int
|
||||||
|
|
|
@ -34,6 +34,8 @@ func (w *cuiWidget) hideFake() {
|
||||||
|
|
||||||
func (w *cuiWidget) showFake() {
|
func (w *cuiWidget) showFake() {
|
||||||
if (w.isFake) {
|
if (w.isFake) {
|
||||||
|
w.setFake()
|
||||||
|
w.showWidgetPlacement(logNow, "showFake:")
|
||||||
w.drawView()
|
w.drawView()
|
||||||
}
|
}
|
||||||
for _, child := range w.children {
|
for _, child := range w.children {
|
||||||
|
@ -55,20 +57,22 @@ func (w *cuiWidget) showWidgets() {
|
||||||
func (w *cuiWidget) setTabWH() {
|
func (w *cuiWidget) setTabWH() {
|
||||||
// set the start and size of the tab gocui button
|
// set the start and size of the tab gocui button
|
||||||
t := len(w.text)
|
t := len(w.text)
|
||||||
w.gocuiSize.width = t + me.PadW
|
|
||||||
w.gocuiSize.height = me.DefaultHeight + me.PadH
|
|
||||||
w.gocuiSize.w0 = me.rootNode.nextW
|
w.gocuiSize.w0 = me.rootNode.nextW
|
||||||
w.gocuiSize.h0 = me.rootNode.nextH
|
w.gocuiSize.h0 = me.rootNode.nextH
|
||||||
|
w.gocuiSize.w1 = w.gocuiSize.w1 + t + me.PadW
|
||||||
|
w.gocuiSize.h1 = w.gocuiSize.h1 + me.DefaultHeight + me.PadH
|
||||||
|
|
||||||
|
w.realWidth = w.gocuiSize.Width()
|
||||||
|
w.realHeight = w.gocuiSize.Height()
|
||||||
|
|
||||||
if w.frame {
|
if w.frame {
|
||||||
w.realWidth = w.gocuiSize.width + me.FramePadW
|
w.realWidth += me.FramePadW
|
||||||
w.realHeight = w.gocuiSize.height + me.FramePadH
|
w.realHeight += me.FramePadH
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the rootNode width over for the next window or tab
|
// move the rootNode width over for the next window or tab
|
||||||
me.rootNode.nextW += w.gocuiSize.width + me.TabPadW
|
me.rootNode.nextW += w.realWidth + me.TabPadW
|
||||||
|
|
||||||
w.setWH()
|
|
||||||
w.showWidgetPlacement(logNow, "setTabWH:")
|
w.showWidgetPlacement(logNow, "setTabWH:")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,8 @@ func (w *cuiWidget) textResize() {
|
||||||
}
|
}
|
||||||
height = i
|
height = i
|
||||||
}
|
}
|
||||||
w.gocuiSize.width = width + me.FramePadW
|
w.gocuiSize.w1 = w.gocuiSize.w0 + width + me.FramePadW
|
||||||
w.gocuiSize.height = height + me.FramePadH
|
w.gocuiSize.h1 = w.gocuiSize.h0 + height + me.FramePadH
|
||||||
w.setWH()
|
|
||||||
w.showWidgetPlacement(logNow, "textResize()")
|
w.showWidgetPlacement(logNow, "textResize()")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,6 @@ type Action struct {
|
||||||
X int
|
X int
|
||||||
Y int
|
Y int
|
||||||
|
|
||||||
// This GUI is intended for simple things
|
|
||||||
// Is having an option like 640x480 really a good idea?
|
|
||||||
// TODO: remove Width & Height measured in pixels?
|
|
||||||
// Width int
|
|
||||||
// Height int
|
|
||||||
|
|
||||||
// Put space around elements to improve look & feel
|
// Put space around elements to improve look & feel
|
||||||
Margin bool
|
Margin bool
|
||||||
|
|
||||||
|
|
44
window.go
44
window.go
|
@ -5,7 +5,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// This routine creates a blank window with a Title and size (W x H)
|
// This routine creates a blank window with a Title and size (W x H)
|
||||||
//
|
|
||||||
|
|
||||||
func (n *Node) NewWindow(title string) *Node {
|
func (n *Node) NewWindow(title string) *Node {
|
||||||
var newNode *Node
|
var newNode *Node
|
||||||
|
@ -25,46 +24,3 @@ func (n *Node) NewWindow(title string) *Node {
|
||||||
|
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// This routine can not have any arguements due to the nature of how
|
|
||||||
// it can be passed via the 'andlabs/ui' queue which, because it is
|
|
||||||
// cross platform, must pass UI changes into the OS threads (that is
|
|
||||||
// my guess).
|
|
||||||
func NewWindow() *Node {
|
|
||||||
var newNode *Node
|
|
||||||
var custom func()
|
|
||||||
|
|
||||||
// If the user didn't set a custom Exit() use the standard exit() function
|
|
||||||
// This makes sure the GUI properly closes everything (GTK, QT, console ui, etc exit)
|
|
||||||
if (Config.Exit != nil) {
|
|
||||||
log(debugGui, "setting a custom exit")
|
|
||||||
custom = func() {
|
|
||||||
log(debugChange, "Running a custom exit()", Config.Exit)
|
|
||||||
log(debugChange, "Running a custom exit() Config.Title =", Config.Title)
|
|
||||||
log(debugChange, "Running a custom exit() Config.Width =", Config.Width)
|
|
||||||
Config.Exit(newNode)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log(debugGui, "setting the standard exit")
|
|
||||||
custom = func () {
|
|
||||||
log(debugChange, "Running StandardExit()")
|
|
||||||
StandardExit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Windows are created off of the master node of the Binary Tree
|
|
||||||
newNode = Config.rootNode.newNode(Config.Title, toolkit.Window, custom)
|
|
||||||
|
|
||||||
log(logInfo, "NewWindow()", Config.Title)
|
|
||||||
|
|
||||||
var a toolkit.Action
|
|
||||||
a.ActionType = toolkit.Add
|
|
||||||
a.Width = Config.Width
|
|
||||||
a.Height = Config.Height
|
|
||||||
a.Name = Config.Title
|
|
||||||
a.Text = Config.Title
|
|
||||||
newaction(&a, newNode, Config.rootNode)
|
|
||||||
|
|
||||||
return newNode
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue