blob: 2d15ad6acb50b961eabc92e18c078a03a58a4a00 (
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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
using grapher.Models.Serialized;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher.Models.Options
{
public class AccelOptionSet
{
public AccelOptionSet(
Label titleLabel,
AccelTypeOptions accelTypeOptions,
Option acceleration,
CapOptions cap,
Option weight,
Option offset,
Option limitOrExp,
Option midpoint)
{
TitleLabel = titleLabel;
AccelTypeOptions = accelTypeOptions;
Acceleration = acceleration;
Cap = cap;
Weight = weight;
Offset = offset;
LimitOrExponent = limitOrExp;
Midpoint = midpoint;
AccelTypeOptions.ShowFullText();
TitleLabel.Top = TopAnchor;
}
public int TopAnchor { get; }
public Label TitleLabel { get; }
public AccelTypeOptions AccelTypeOptions { get; }
public Option Acceleration { get; }
public CapOptions Cap { get; }
public Option Weight { get; }
public Option Offset { get; }
public Option LimitOrExponent { get; }
public Option Midpoint { get; }
public bool IsTitleMode { get; private set; }
public void SetRegularMode()
{
if (IsTitleMode)
{
IsTitleMode = false;
HideTitle();
AccelTypeOptions.Left = Acceleration.Left;
AccelTypeOptions.Width = Acceleration.Width;
AccelTypeOptions.ShowFullText();
}
}
public void SetTitleMode()
{
if (!IsTitleMode)
{
IsTitleMode = true;
AccelTypeOptions.Left = Acceleration.Field.Left;
AccelTypeOptions.Width = Acceleration.Field.Width;
AccelTypeOptions.ShowFullText();
DisplayTitle();
}
}
public void Hide()
{
TitleLabel.Hide();
AccelTypeOptions.Hide();
Acceleration.Hide();
Cap.Hide();
Weight.Hide();
Offset.Hide();
LimitOrExponent.Hide();
Midpoint.Hide();
}
public void Show()
{
if (IsTitleMode)
{
TitleLabel.Show();
}
AccelTypeOptions.Show();
Acceleration.Show();
Cap.Show();
Weight.Show();
Offset.Show();
LimitOrExponent.Show();
Midpoint.Show();
}
public void DisplayTitle()
{
TitleLabel.Show();
SetOptionsTop(TitleLabel.Top + TitleLabel.Height + Constants.OptionVerticalSeperation);
}
public void HideTitle()
{
TitleLabel.Hide();
SetOptionsTop(TopAnchor);
}
public void SetArgs(AccelArgs args)
{
args.accel = Acceleration.Field.Data;
args.rate = Acceleration.Field.Data;
args.powerScale = Acceleration.Field.Data;
args.gainCap = Cap.VelocityGainCap;
args.scaleCap = Cap.SensitivityCap;
args.limit = LimitOrExponent.Field.Data;
args.exponent = LimitOrExponent.Field.Data;
args.powerExponent = LimitOrExponent.Field.Data;
args.offset = Offset.Field.Data;
args.midpoint = Midpoint.Field.Data;
args.weight = Weight.Field.Data;
}
public AccelArgs GenerateArgs()
{
AccelArgs args = new AccelArgs();
SetArgs(args);
return args;
}
public void SetActiveValues(int mode, AccelArgs args)
{
AccelTypeOptions.SetActiveValue(mode);
Weight.SetActiveValue(args.weight);
Cap.SetActiveValues(args.gainCap, args.scaleCap, args.gainCap > 0);
Offset.SetActiveValue(args.offset);
Acceleration.SetActiveValue(args.accel);
LimitOrExponent.SetActiveValue(args.exponent);
Midpoint.SetActiveValue(args.midpoint);
}
private void SetOptionsTop(int top)
{
AccelTypeOptions.Top = top;
Acceleration.Top = AccelTypeOptions.Top+ AccelTypeOptions.Height + Constants.OptionVerticalSeperation;
Cap.SnapTo(Acceleration);
Weight.SnapTo(Cap);
Offset.SnapTo(Weight);
LimitOrExponent.SnapTo(Offset);
Midpoint.SnapTo(LimitOrExponent);
}
}
}
|