aboutsummaryrefslogtreecommitdiffstats
path: root/ui.go
blob: 67f31ca0b6e97b6f5bea38a5abbc116f9a1ec0ea (plain) (blame)
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
package main

import g "github.com/AllenDang/giu"

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"),
	)
}