blob: 2fe44b06f5a5c0c09d0703e66962b62fe71a3ef5 (
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static grapher.Models.Options.Cap.CapTypeOptions;
namespace grapher.Models.Options.Cap
{
public class CapOptions : OptionBase
{
public CapOptions(
CapTypeOptions capTypeOptions,
Option capIn,
Option capOut,
Option slope)
{
CapTypeOptions = capTypeOptions;
In = capIn;
Out = capOut;
Slope = slope;
}
public CapTypeOptions CapTypeOptions { get; }
public Option In { get; }
public Option Out { get; }
public Option Slope { get; }
public override int Left
{
get => In.Left;
set
{
In.Left = value;
Out.Left = value;
Slope.Left = value;
}
}
public override int Top
{
get => CapTypeOptions.Top;
set
{
CapTypeOptions.Top = value;
Layout();
}
}
public override int Height
{
get => BottomElement.Top + BottomElement.Height - CapTypeOptions.Top;
}
public override int Width
{
get => CapTypeOptions.Width;
set
{
CapTypeOptions.Width = value;
In.Width = value;
Out.Width = value;
Slope.Width = value;
}
}
public override bool Visible
{
get => CapTypeOptions.Visible;
}
private Option BottomElement { get; set; }
public void Layout()
{
Layout(CapTypeOptions.Top + CapTypeOptions.Height + Constants.OptionVerticalSeperation);
}
private void Layout(int top)
{
switch (CapTypeOptions.SelectedCapType)
{
case CapType.Input:
Slope.Show();
In.Show();
Out.Hide();
Slope.Top = top;
In.SnapTo(Slope);
BottomElement = In;
break;
case CapType.Output:
Slope.Show();
In.Hide();
Out.Show();
Slope.Top = top;
In.SnapTo(Slope);
BottomElement = In;
break;
case CapType.Both:
Slope.Hide();
In.Show();
Out.Show();
In.Top = top;
Out.SnapTo(In);
BottomElement = Out;
break;
}
}
private void OnCapTypeDropdownSelectedItemChanged(object sender, EventArgs e)
{
Layout();
}
private void SetupCapTypeDropdown(ComboBox capTypeDropDown)
{
capTypeDropDown.Items.Clear();
capTypeDropDown.DataSource = Enum.GetValues(typeof(CapType));
}
}
}
|