mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
ui: rename block to macro
It is a more precise name. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-5
@@ -24,7 +24,7 @@ type Flex struct {
|
||||
}
|
||||
|
||||
type FlexChild struct {
|
||||
block ui.BlockOp
|
||||
macro ui.MacroOp
|
||||
dims Dimens
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ func (f *Flex) begin(mode flexMode) {
|
||||
panic("must End before adding a child")
|
||||
}
|
||||
f.mode = mode
|
||||
f.ops.Begin()
|
||||
f.ops.Record()
|
||||
}
|
||||
|
||||
func (f *Flex) Rigid() Constraints {
|
||||
@@ -107,7 +107,7 @@ func (f *Flex) End(dims Dimens) FlexChild {
|
||||
if f.mode <= modeBegun {
|
||||
panic("End called without an active child")
|
||||
}
|
||||
block := f.ops.End()
|
||||
macro := f.ops.Stop()
|
||||
sz := axisMain(f.Axis, dims.Size)
|
||||
f.size += sz
|
||||
if f.mode == modeRigid {
|
||||
@@ -120,7 +120,7 @@ func (f *Flex) End(dims Dimens) FlexChild {
|
||||
if b := dims.Baseline; b > f.maxBaseline {
|
||||
f.maxBaseline = b
|
||||
}
|
||||
return FlexChild{block, dims}
|
||||
return FlexChild{macro, dims}
|
||||
}
|
||||
|
||||
func (f *Flex) Layout(children ...FlexChild) Dimens {
|
||||
@@ -160,7 +160,7 @@ func (f *Flex) Layout(children ...FlexChild) Dimens {
|
||||
ui.TransformOp{
|
||||
Transform: ui.Offset(toPointF(axisPoint(f.Axis, mainSize, cross))),
|
||||
}.Add(f.ops)
|
||||
child.block.Add(f.ops)
|
||||
child.macro.Add(f.ops)
|
||||
ui.PopOp{}.Add(f.ops)
|
||||
mainSize += axisMain(f.Axis, dims.Size)
|
||||
if i < len(children)-1 {
|
||||
|
||||
+3
-3
@@ -129,7 +129,7 @@ func (a *Align) Begin(ops *ui.Ops, cs Constraints) Constraints {
|
||||
a.begun = true
|
||||
a.ops = ops
|
||||
a.cs = cs
|
||||
ops.Begin()
|
||||
ops.Record()
|
||||
cs.Width.Min = 0
|
||||
cs.Height.Min = 0
|
||||
return cs
|
||||
@@ -141,7 +141,7 @@ func (a *Align) End(dims Dimens) Dimens {
|
||||
}
|
||||
a.begun = false
|
||||
ops := a.ops
|
||||
block := ops.End()
|
||||
macro := ops.Stop()
|
||||
sz := dims.Size
|
||||
if sz.X < a.cs.Width.Min {
|
||||
sz.X = a.cs.Width.Min
|
||||
@@ -164,7 +164,7 @@ func (a *Align) End(dims Dimens) Dimens {
|
||||
}
|
||||
ui.PushOp{}.Add(ops)
|
||||
ui.TransformOp{Transform: ui.Offset(toPointF(p))}.Add(ops)
|
||||
block.Add(ops)
|
||||
macro.Add(ops)
|
||||
ui.PopOp{}.Add(ops)
|
||||
return Dimens{
|
||||
Size: sz,
|
||||
|
||||
+8
-8
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
type scrollChild struct {
|
||||
size image.Point
|
||||
block ui.BlockOp
|
||||
macro ui.MacroOp
|
||||
}
|
||||
|
||||
type List struct {
|
||||
@@ -70,7 +70,7 @@ func (l *List) Init(ops *ui.Ops, cs Constraints, len int) {
|
||||
if l.first > len {
|
||||
l.first = len
|
||||
}
|
||||
ops.Begin()
|
||||
ops.Record()
|
||||
l.Next()
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func (l *List) Next() {
|
||||
i = l.len - 1 - i
|
||||
}
|
||||
l.index = i
|
||||
l.ops.Begin()
|
||||
l.ops.Record()
|
||||
}
|
||||
|
||||
// Index is the current element index.
|
||||
@@ -146,8 +146,8 @@ func (l *List) next() (int, bool) {
|
||||
|
||||
// Elem completes an element.
|
||||
func (l *List) Elem(dims Dimens) {
|
||||
block := l.ops.End()
|
||||
child := scrollChild{dims.Size, block}
|
||||
macro := l.ops.Stop()
|
||||
child := scrollChild{dims.Size, macro}
|
||||
switch l.dir {
|
||||
case iterateForward:
|
||||
mainSize := axisMain(l.Axis, child.size)
|
||||
@@ -227,7 +227,7 @@ func (l *List) Layout() Dimens {
|
||||
ui.TransformOp{
|
||||
Transform: ui.Offset(toPointF(axisPoint(l.Axis, transPos, cross))),
|
||||
}.Add(ops)
|
||||
child.block.Add(ops)
|
||||
child.macro.Add(ops)
|
||||
ui.PopOp{}.Add(ops)
|
||||
pos += childSize
|
||||
}
|
||||
@@ -237,9 +237,9 @@ func (l *List) Layout() Dimens {
|
||||
l.scroll.Stop()
|
||||
}
|
||||
dims := axisPoint(l.Axis, mainc.Constrain(pos), maxCross)
|
||||
block := ops.End()
|
||||
macro := ops.Stop()
|
||||
pointer.RectAreaOp{Size: dims}.Add(ops)
|
||||
l.scroll.Add(ops)
|
||||
block.Add(ops)
|
||||
macro.Add(ops)
|
||||
return Dimens{Size: dims}
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@ type Stack struct {
|
||||
}
|
||||
|
||||
type StackChild struct {
|
||||
block ui.BlockOp
|
||||
macro ui.MacroOp
|
||||
dims Dimens
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func (s *Stack) begin() {
|
||||
panic("must End before adding a child")
|
||||
}
|
||||
s.begun = true
|
||||
s.ops.Begin()
|
||||
s.ops.Record()
|
||||
}
|
||||
|
||||
func (s *Stack) Rigid() Constraints {
|
||||
@@ -71,7 +71,7 @@ func (s *Stack) Expand() Constraints {
|
||||
}
|
||||
|
||||
func (s *Stack) End(dims Dimens) StackChild {
|
||||
b := s.ops.End()
|
||||
b := s.ops.Stop()
|
||||
s.begun = false
|
||||
if w := dims.Size.X; w > s.maxSZ.X {
|
||||
s.maxSZ.X = w
|
||||
@@ -105,7 +105,7 @@ func (s *Stack) Layout(children ...StackChild) Dimens {
|
||||
}
|
||||
ui.PushOp{}.Add(s.ops)
|
||||
ui.TransformOp{Transform: ui.Offset(toPointF(p))}.Add(s.ops)
|
||||
ch.block.Add(s.ops)
|
||||
ch.macro.Add(s.ops)
|
||||
ui.PopOp{}.Add(s.ops)
|
||||
}
|
||||
b := s.baseline
|
||||
|
||||
Reference in New Issue
Block a user