1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
package main
import g "github.com/AllenDang/giu"
func engineDisplacementRow() *g.RowWidget {
return g.Row(
g.Label("Engine Displacement"),
g.InputFloat(&displacement.val).Format("%.2f"),
g.Combo(
"",
volumeUnitStrings()[selectedVolumeUnit],
volumeUnitStrings(),
&selectedVolumeUnit,
).
OnChange(func() {
s := volumeUnitStrings()[selectedVolumeUnit]
u, err := volumeUnitFromString(s)
check(err)
displacement = volume{
displacement.asUnit(u),
u,
}
}),
)
}
func engineSpeedRow() *g.TableRowWidget {
return g.TableRow(
g.Label("Engine Speed"),
g.Label("rpm"),
g.InputInt(&engineSpeed[0]),
g.InputInt(&engineSpeed[1]),
g.InputInt(&engineSpeed[2]),
g.InputInt(&engineSpeed[3]),
g.InputInt(&engineSpeed[4]),
g.InputInt(&engineSpeed[5]),
)
}
func volumetricEfficiencyRow() *g.TableRowWidget {
return g.TableRow(
g.Label("Volumetric Efficiency"),
g.Label("%"),
g.InputInt(&volumetricEfficiency[0]),
g.InputInt(&volumetricEfficiency[1]),
g.InputInt(&volumetricEfficiency[2]),
g.InputInt(&volumetricEfficiency[3]),
g.InputInt(&volumetricEfficiency[4]),
g.InputInt(&volumetricEfficiency[5]),
)
}
func manifoldPressureRow() *g.TableRowWidget {
return g.TableRow(
g.Label("Manifold Absolute Pressure"),
g.Combo(
"",
pressureUnitStrings()[selectedPressureUnit],
pressureUnitStrings(),
&selectedPressureUnit,
).
OnChange(func() {
s := pressureUnitStrings()[selectedPressureUnit]
u, err := pressureUnitFromString(s)
check(err)
for i := range manifoldPressure {
manifoldPressure[i] = pressure{
manifoldPressure[i].asUnit(u),
u,
}
}
}),
g.InputFloat(&manifoldPressure[0].val).Format("%.2f"),
g.InputFloat(&manifoldPressure[1].val).Format("%.2f"),
g.InputFloat(&manifoldPressure[2].val).Format("%.2f"),
g.InputFloat(&manifoldPressure[3].val).Format("%.2f"),
g.InputFloat(&manifoldPressure[4].val).Format("%.2f"),
g.InputFloat(&manifoldPressure[5].val).Format("%.2f"),
)
}
|