From 09e3fcd9cb86f712ce4004c445609e09152c0955 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 10 Jun 2014 11:12:32 -0400 Subject: More go fmt. --- stack.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'stack.go') diff --git a/stack.go b/stack.go index fc9d600..bbc78ec 100644 --- a/stack.go +++ b/stack.go @@ -11,7 +11,7 @@ type orientation bool const ( horizontal orientation = false - vertical orientation = true + vertical orientation = true ) // A Stack stacks controls horizontally or vertically within the Stack's parent. @@ -20,21 +20,21 @@ const ( // Any extra space at the end of a Stack is left blank. // Some controls may be marked as "stretchy": when the Window they are in changes size, stretchy controls resize to take up the remaining space after non-stretchy controls are laid out. If multiple controls are marked stretchy, they are alloted equal distribution of the remaining space. type Stack struct { - lock sync.Mutex - created bool - orientation orientation - controls []Control - stretchy []bool - width, height []int // caches to avoid reallocating these each time + lock sync.Mutex + created bool + orientation orientation + controls []Control + stretchy []bool + width, height []int // caches to avoid reallocating these each time } func newStack(o orientation, controls ...Control) *Stack { return &Stack{ - orientation: o, - controls: controls, - stretchy: make([]bool, len(controls)), - width: make([]int, len(controls)), - height: make([]int, len(controls)), + orientation: o, + controls: controls, + stretchy: make([]bool, len(controls)), + width: make([]int, len(controls)), + height: make([]int, len(controls)), } } @@ -80,7 +80,7 @@ func (s *Stack) make(window *sysData) error { func (s *Stack) setRect(x int, y int, width int, height int, rr *[]resizerequest) { var stretchywid, stretchyht int - if len(s.controls) == 0 { // do nothing if there's nothing to do + if len(s.controls) == 0 { // do nothing if there's nothing to do return } // 1) get height and width of non-stretchy controls; figure out how much space is alloted to stretchy controls @@ -93,11 +93,11 @@ func (s *Stack) setRect(x int, y int, width int, height int, rr *[]resizerequest continue } w, h := c.preferredSize() - if s.orientation == horizontal { // all controls have same height + if s.orientation == horizontal { // all controls have same height s.width[i] = w s.height[i] = height stretchywid -= w - } else { // all controls have same width + } else { // all controls have same width s.width[i] = width s.height[i] = h stretchyht -= h @@ -105,9 +105,9 @@ func (s *Stack) setRect(x int, y int, width int, height int, rr *[]resizerequest } // 2) figure out size of stretchy controls if nStretchy != 0 { - if s.orientation == horizontal { // split rest of width + if s.orientation == horizontal { // split rest of width stretchywid /= nStretchy - } else { // split rest of height + } else { // split rest of height stretchyht /= nStretchy } } @@ -142,7 +142,7 @@ func (s *Stack) preferredSize() (width int, height int) { var nStretchy int var maxswid, maxsht int - if len(s.controls) == 0 { // no controls, so return emptiness + if len(s.controls) == 0 { // no controls, so return emptiness return 0, 0 } for i, c := range s.controls { @@ -152,7 +152,7 @@ func (s *Stack) preferredSize() (width int, height int) { maxswid = max(maxswid, w) maxsht = max(maxsht, h) } - if s.orientation == horizontal { // max vertical size + if s.orientation == horizontal { // max vertical size if !s.stretchy[i] { width += w } -- cgit v1.2.3