-
Notifications
You must be signed in to change notification settings - Fork 9
/
CBEOptionPageControl.cs
135 lines (115 loc) · 4.77 KB
/
CBEOptionPageControl.cs
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
using System;
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.Internal.VisualStudio.Shell.Interop;
namespace CodeBlockEndTag
{
public partial class CBEOptionPageControl : UserControl
{
private const string DonateUrl = "https://www.paypal.com/donate?hosted_button_id=37PBGZPHXY8EC";
private const string GitHubUrl = "https://github.com/KhaosCoders/VSCodeBlockEndTag";
public CBEOptionPageControl()
{
InitializeComponent();
}
internal CBEOptionPage optionsPage;
public void Initialize()
{
chkCBETaggerEnabled.Checked = optionsPage.CBETaggerEnabled;
rdbAlways.Checked = optionsPage.CBEVisibilityMode == (int)CBEOptionPage.VisibilityModes.Always;
rdbHeaderInvisible.Checked = optionsPage.CBEVisibilityMode == (int)CBEOptionPage.VisibilityModes.HeaderNotVisible;
rdbSingleClick.Checked = optionsPage.CBEClickMode == (int)CBEOptionPage.ClickMode.SingleClick;
rdbDoubleClick.Checked = optionsPage.CBEClickMode == (int)CBEOptionPage.ClickMode.DoubleClick;
rdbCtrlClick.Checked = optionsPage.CBEClickMode == (int)CBEOptionPage.ClickMode.CtrlClick;
rdbIconAndText.Checked = optionsPage.CBEDisplayMode == (int)CBEOptionPage.DisplayModes.IconAndText;
rdbIconOnly.Checked = optionsPage.CBEDisplayMode == (int)CBEOptionPage.DisplayModes.Icon;
rdbTextOnly.Checked = optionsPage.CBEDisplayMode == (int)CBEOptionPage.DisplayModes.Text;
lviLanguages.Items.Clear();
string[] langs = optionsPage.SupportedLangDisplayNames;
for (int i = 0; i < langs.Length; i++)
{
lviLanguages.Items.Add(langs[i]);
if (optionsPage.SupportedLangActive[i])
{
lviLanguages.SetItemChecked(i, true);
}
}
}
private void LblLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(new ProcessStartInfo(DonateUrl));
}
private void LnkGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(new ProcessStartInfo(GitHubUrl));
}
private void ChkCBETaggerEnabled_CheckedChanged(object sender, EventArgs e)
{
optionsPage.CBETaggerEnabled = chkCBETaggerEnabled.Checked;
}
private void RdbAlways_CheckedChanged(object sender, EventArgs e)
{
if (rdbAlways.Checked)
{
optionsPage.CBEVisibilityMode = (int)CBEOptionPage.VisibilityModes.Always;
}
}
private void RdbHeaderInvisible_CheckedChanged(object sender, EventArgs e)
{
if (rdbHeaderInvisible.Checked)
{
optionsPage.CBEVisibilityMode = (int)CBEOptionPage.VisibilityModes.HeaderNotVisible;
}
}
private void RdbSingleClick_CheckedChanged(object sender, EventArgs e)
{
if (rdbSingleClick.Checked)
{
optionsPage.CBEClickMode = (int)CBEOptionPage.ClickMode.SingleClick;
}
}
private void RdbDoubleClick_CheckedChanged(object sender, EventArgs e)
{
if (rdbDoubleClick.Checked)
{
optionsPage.CBEClickMode = (int)CBEOptionPage.ClickMode.DoubleClick;
}
}
private void RdbCtrlClick_CheckedChanged(object sender, EventArgs e)
{
if (rdbCtrlClick.Checked)
{
optionsPage.CBEClickMode = (int)CBEOptionPage.ClickMode.CtrlClick;
}
}
private void RdbIconAndText_CheckedChanged(object sender, EventArgs e)
{
if (rdbIconAndText.Checked)
{
optionsPage.CBEDisplayMode = (int)CBEOptionPage.DisplayModes.IconAndText;
}
}
private void RdbIconOnly_CheckedChanged(object sender, EventArgs e)
{
if (rdbIconOnly.Checked)
{
optionsPage.CBEDisplayMode = (int)CBEOptionPage.DisplayModes.Icon;
}
}
private void RdbTextOnly_CheckedChanged(object sender, EventArgs e)
{
if (rdbTextOnly.Checked)
{
optionsPage.CBEDisplayMode = (int)CBEOptionPage.DisplayModes.Text;
}
}
private void LviLanguages_ItemCheck(object sender, ItemCheckEventArgs e)
{
optionsPage.SetSupportedLangActive(e.Index, e.NewValue == CheckState.Checked);
}
private void lblFont_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
CBETagPackage.Instance.ShowOptionPage(typeof(FontAndColorsOptionPageDummy));
}
}
}