From 9a3e73b46001219177bb13a381420007217dfecf Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 25 Jun 2014 23:05:29 -0400 Subject: [PATCH] Finished the Windows conversion to the new sizing system. Untested. --- controlsize.go | 7 + controlsize_sys.go | 4 +- prefsize_windows.go => controlsize_windows.go | 138 ++++++++++++------ grid.go | 11 +- stack.go | 9 +- 5 files changed, 119 insertions(+), 50 deletions(-) rename prefsize_windows.go => controlsize_windows.go (77%) diff --git a/controlsize.go b/controlsize.go index 7a608d2..ff0973b 100644 --- a/controlsize.go +++ b/controlsize.go @@ -11,6 +11,13 @@ type allocation struct { neighbor Control } +type cSysSizeData struct { + xmargin int + ymargin int + xpadding int + ypadding int +} + // for verification; see sysdata.go type sysDataSizeFuncs interface { beginResize() *sysSizeData diff --git a/controlsize_sys.go b/controlsize_sys.go index c520a30..153ed69 100644 --- a/controlsize_sys.go +++ b/controlsize_sys.go @@ -1,4 +1,6 @@ -// b { return a @@ -135,9 +135,12 @@ func (g *Grid) setRect(x int, y int, width int, height int, d *sysSizeData) (all var current *allocation // for neighboring // before we do anything, steal the margin so nested Stacks/Grids don't double down - margin := d.margin - d.margin = 0 -_=margin + xmargin := d.xmargin + ymargin := d.ymargin + d.xmargin = 0 + d.ymargin = 0 +_=xmargin +_=ymargin // 1) clear data structures for i := range g.rowheights { g.rowheights[i] = 0 diff --git a/stack.go b/stack.go index a0c3104..4311b37 100644 --- a/stack.go +++ b/stack.go @@ -85,9 +85,12 @@ func (s *Stack) allocate(x int, y int, width int, height int, d *sysSizeData) (a return nil } // before we do anything, steal the margin so nested Stacks/Grids don't double down - margin := d.margin - d.margin = 0 -_=margin + xmargin := d.xmargin + ymargin := d.ymargin + d.xmargin = 0 + d.ymargin = 0 +_=xmargin +_=ymargin // 1) get height and width of non-stretchy controls; figure out how much space is alloted to stretchy controls stretchywid = width stretchyht = height