ui: rename ops to have Op suffixed, not prefixed

Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-21 16:59:26 +02:00
parent b981ccf9ed
commit 7aa7bb3be4
21 changed files with 122 additions and 122 deletions
+5 -5
View File
@@ -25,7 +25,7 @@ type Flex struct {
}
type FlexChild struct {
block ui.OpBlock
block ui.BlockOp
dims Dimens
}
@@ -79,7 +79,7 @@ func (f *Flex) begin() {
}
f.begun = true
f.ops.Begin()
ui.OpLayer{}.Add(f.ops)
ui.LayerOp{}.Add(f.ops)
}
func (f *Flex) Rigid() Constraints {
@@ -159,12 +159,12 @@ func (f *Flex) Layout(children ...FlexChild) Dimens {
cross = f.maxBaseline - b
}
}
ui.OpPush{}.Add(f.ops)
ui.OpTransform{
ui.PushOp{}.Add(f.ops)
ui.TransformOp{
Transform: ui.Offset(toPointF(axisPoint(f.Axis, mainSize, cross))),
}.Add(f.ops)
child.block.Add(f.ops)
ui.OpPop{}.Add(f.ops)
ui.PopOp{}.Add(f.ops)
mainSize += axisMain(f.Axis, dims.Size)
switch f.MainAxisAlignment {
case SpaceEvenly:
+6 -6
View File
@@ -104,8 +104,8 @@ func (in *Insets) Begin(ops *ui.Ops, cs Constraints) Constraints {
mcs.Height.Max = mcs.Height.Min
}
}
ui.OpPush{}.Add(ops)
ui.OpTransform{Transform: ui.Offset(toPointF(image.Point{X: l, Y: t}))}.Add(ops)
ui.PushOp{}.Add(ops)
ui.TransformOp{Transform: ui.Offset(toPointF(image.Point{X: l, Y: t}))}.Add(ops)
return mcs
}
@@ -115,7 +115,7 @@ func (in *Insets) End(dims Dimens) Dimens {
}
in.begun = false
ops := in.ops
ui.OpPop{}.Add(ops)
ui.PopOp{}.Add(ops)
t, r, b, l := int(math.Round(float64(in.Top))), int(math.Round(float64(in.Right))), int(math.Round(float64(in.Bottom))), int(math.Round(float64(in.Left)))
return Dimens{
Size: in.cs.Constrain(dims.Size.Add(image.Point{X: r + l, Y: t + b})),
@@ -201,10 +201,10 @@ func (a *Align) End(dims Dimens) Dimens {
case SW, S, SE:
p.Y = sz.Y - dims.Size.Y
}
ui.OpPush{}.Add(ops)
ui.OpTransform{Transform: ui.Offset(toPointF(p))}.Add(ops)
ui.PushOp{}.Add(ops)
ui.TransformOp{Transform: ui.Offset(toPointF(p))}.Add(ops)
block.Add(ops)
ui.OpPop{}.Add(ops)
ui.PopOp{}.Add(ops)
return Dimens{
Size: sz,
Baseline: dims.Baseline,
+5 -5
View File
@@ -14,7 +14,7 @@ import (
type scrollChild struct {
size image.Point
block ui.OpBlock
block ui.BlockOp
}
type List struct {
@@ -91,7 +91,7 @@ func (l *List) Next() (int, Constraints, bool) {
if ok {
cs = axisConstraints(l.Axis, Constraint{Max: ui.Inf}, l.crossConstraintChild(l.cs))
l.ops.Begin()
ui.OpLayer{}.Add(l.ops)
ui.LayerOp{}.Add(l.ops)
}
return i, cs, ok
}
@@ -194,13 +194,13 @@ func (l *List) Layout() Dimens {
Min: axisPoint(l.Axis, min, -ui.Inf),
Max: axisPoint(l.Axis, max, ui.Inf),
}
ui.OpPush{}.Add(ops)
ui.PushOp{}.Add(ops)
draw.RectClip(r).Add(ops)
ui.OpTransform{
ui.TransformOp{
Transform: ui.Offset(toPointF(axisPoint(l.Axis, transPos, cross))),
}.Add(ops)
child.block.Add(ops)
ui.OpPop{}.Add(ops)
ui.PopOp{}.Add(ops)
pos += childSize
}
atStart := l.first == 0 && l.offset <= 0
+5 -5
View File
@@ -20,7 +20,7 @@ type Stack struct {
}
type StackChild struct {
block ui.OpBlock
block ui.BlockOp
dims Dimens
}
@@ -54,7 +54,7 @@ func (s *Stack) begin() {
}
s.begun = true
s.ops.Begin()
ui.OpLayer{}.Add(s.ops)
ui.LayerOp{}.Add(s.ops)
}
func (s *Stack) Rigid() Constraints {
@@ -103,10 +103,10 @@ func (s *Stack) Layout(children ...StackChild) Dimens {
case SW, S, SE:
p.Y = s.maxSZ.Y - sz.Y
}
ui.OpPush{}.Add(s.ops)
ui.OpTransform{Transform: ui.Offset(toPointF(p))}.Add(s.ops)
ui.PushOp{}.Add(s.ops)
ui.TransformOp{Transform: ui.Offset(toPointF(p))}.Add(s.ops)
ch.block.Add(s.ops)
ui.OpPop{}.Add(s.ops)
ui.PopOp{}.Add(s.ops)
}
b := s.baseline
if b == 0 {