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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
using grapher.Models.Options;
using System.Windows.Forms;
namespace grapher.Layouts
{
public abstract class LayoutBase
{
public const string Acceleration = "Acceleration";
public const string Scale = "Scale";
public const string Exponent = "Exponent";
public const string Limit = "Limit";
public const string Midpoint = "Midpoint";
public const string Offset = "Offset";
public const string Cap = "Cap";
public const string Weight = "Weight";
public LayoutBase()
{
AccelLayout = new OptionLayout(false, string.Empty);
CapLayout = new OptionLayout(false, string.Empty);
WeightLayout = new OptionLayout(false, string.Empty);
OffsetLayout = new OptionLayout(false, string.Empty);
LimExpLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
ButtonEnabled = true;
}
/// <summary>
/// Gets or sets mapping from acceleration type to identifying integer.
/// Must match accel_mode defined in rawaccel-settings.h
/// </summary>
public int Index { get; internal set; }
public string Name { get; internal set; }
protected bool ButtonEnabled { get; set; }
protected OptionLayout AccelLayout { get; set; }
protected OptionLayout CapLayout { get; set; }
protected OptionLayout WeightLayout { get; set; }
protected OptionLayout OffsetLayout { get; set; }
protected OptionLayout LimExpLayout { get; set; }
protected OptionLayout MidpointLayout { get; set; }
public void Layout(
IOption accelOption,
IOption capOption,
IOption weightOption,
IOption offsetOption,
IOption limExpOption,
IOption midpointOption,
Button button,
int top)
{
AccelLayout.Layout(accelOption);
CapLayout.Layout(capOption);
WeightLayout.Layout(weightOption);
OffsetLayout.Layout(offsetOption);
LimExpLayout.Layout(limExpOption);
MidpointLayout.Layout(midpointOption);
button.Enabled = ButtonEnabled;
IOption previous = null;
foreach (var option in new IOption[] { accelOption, capOption, weightOption, offsetOption, limExpOption, midpointOption})
{
if (option.Visible)
{
if (previous != null)
{
option.SnapTo(previous);
}
else
{
option.Top = top;
}
previous = option;
}
}
}
public void Layout(
IOption accelOption,
IOption capOption,
IOption weightOption,
IOption offsetOption,
IOption limExpOption,
IOption midpointOption,
Button button)
{
Layout(accelOption,
capOption,
weightOption,
offsetOption,
limExpOption,
midpointOption,
button,
accelOption.Top);
}
}
}
|