forked from joejulian/gio
op: rename StackOp/Push/Pop to StateOp/Save/Load
The semantics were relaxed in a previous commit; this change renames to operations accordingly. API change. Use gofmt to adjust your code accordingly: gofmt -r 'op.Push(a).Pop() -> op.Save(a).Load()' gofmt -r 'op.Push(a) -> op.Save(a)' gofmt -r 'v.Pop() -> v.Load()' gofmt -r 'op.StackOp -> op.StateOp' Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-2
@@ -181,10 +181,10 @@ func (f Flex) Layout(gtx Context, children ...FlexChild) Dimensions {
|
||||
cross = maxBaseline - b
|
||||
}
|
||||
}
|
||||
stack := op.Push(gtx.Ops)
|
||||
stack := op.Save(gtx.Ops)
|
||||
op.Offset(FPt(f.Axis.point(mainSize, cross))).Add(gtx.Ops)
|
||||
child.call.Add(gtx.Ops)
|
||||
stack.Pop()
|
||||
stack.Load()
|
||||
mainSize += f.Axis.Main(dims.Size)
|
||||
if i < len(children)-1 {
|
||||
switch f.Spacing {
|
||||
|
||||
+4
-4
@@ -141,11 +141,11 @@ func (in Inset) Layout(gtx Context, w Widget) Dimensions {
|
||||
if mcs.Min.Y > mcs.Max.Y {
|
||||
mcs.Min.Y = mcs.Max.Y
|
||||
}
|
||||
stack := op.Push(gtx.Ops)
|
||||
stack := op.Save(gtx.Ops)
|
||||
op.Offset(FPt(image.Point{X: left, Y: top})).Add(gtx.Ops)
|
||||
gtx.Constraints = mcs
|
||||
dims := w(gtx)
|
||||
stack.Pop()
|
||||
stack.Load()
|
||||
return Dimensions{
|
||||
Size: dims.Size.Add(image.Point{X: right + left, Y: top + bottom}),
|
||||
Baseline: dims.Baseline + bottom,
|
||||
@@ -186,10 +186,10 @@ func (d Direction) Layout(gtx Context, w Widget) Dimensions {
|
||||
case SW, S, SE:
|
||||
p.Y = sz.Y - dims.Size.Y
|
||||
}
|
||||
stack := op.Push(gtx.Ops)
|
||||
stack := op.Save(gtx.Ops)
|
||||
op.Offset(FPt(p)).Add(gtx.Ops)
|
||||
call.Add(gtx.Ops)
|
||||
stack.Pop()
|
||||
stack.Load()
|
||||
return Dimensions{
|
||||
Size: sz,
|
||||
Baseline: dims.Baseline + sz.Y - dims.Size.Y - p.Y,
|
||||
|
||||
+3
-3
@@ -253,11 +253,11 @@ func (l *List) layout(ops *op.Ops, macro op.MacroOp) Dimensions {
|
||||
Min: l.Axis.point(min, -inf),
|
||||
Max: l.Axis.point(max, inf),
|
||||
}
|
||||
stack := op.Push(ops)
|
||||
stack := op.Save(ops)
|
||||
clip.Rect(r).Add(ops)
|
||||
op.Offset(FPt(l.Axis.point(pos, cross))).Add(ops)
|
||||
child.call.Add(ops)
|
||||
stack.Pop()
|
||||
stack.Load()
|
||||
pos += childSize
|
||||
}
|
||||
atStart := l.Position.First == 0 && l.Position.Offset <= 0
|
||||
@@ -274,7 +274,7 @@ func (l *List) layout(ops *op.Ops, macro op.MacroOp) Dimensions {
|
||||
}
|
||||
dims := l.Axis.point(pos, maxCross)
|
||||
call := macro.Stop()
|
||||
defer op.Push(ops).Pop()
|
||||
defer op.Save(ops).Load()
|
||||
pointer.Rect(image.Rectangle{Max: dims}).Add(ops)
|
||||
l.scroll.Add(ops)
|
||||
call.Add(ops)
|
||||
|
||||
+2
-2
@@ -104,10 +104,10 @@ func (s Stack) Layout(gtx Context, children ...StackChild) Dimensions {
|
||||
case SW, S, SE:
|
||||
p.Y = maxSZ.Y - sz.Y
|
||||
}
|
||||
stack := op.Push(gtx.Ops)
|
||||
stack := op.Save(gtx.Ops)
|
||||
op.Offset(FPt(p)).Add(gtx.Ops)
|
||||
ch.call.Add(gtx.Ops)
|
||||
stack.Pop()
|
||||
stack.Load()
|
||||
if baseline == 0 {
|
||||
if b := ch.dims.Baseline; b != 0 {
|
||||
baseline = b + maxSZ.Y - sz.Y - p.Y
|
||||
|
||||
Reference in New Issue
Block a user