-
Notifications
You must be signed in to change notification settings - Fork 1
/
SettingsForm.cs
176 lines (154 loc) · 6.28 KB
/
SettingsForm.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
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
170
171
172
173
174
175
176
//********************************************************************************************
//Author: Sergey Stoyan, CliverSoft.com
// http://cliversoft.com
// stoyan@cliversoft.com
// sergey.stoyan@gmail.com
// 17 February 2008
//Copyright: (C) 2008, Sergey Stoyan
//********************************************************************************************
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Cliver.DataSifter
{
internal partial class SettingsForm : Form
{
internal SettingsForm()
{
InitializeComponent();
Icon = Win.AssemblyRoutines.GetAppIcon();
flagPrintParseLabels.Checked = Settings.Appearance.PrintCaptureLabels;
flagHighlightHtmlTags.Checked = Settings.Appearance.HighlightHtmlTags;
flagStripParsedTextInStatusBarFromHtmlTags.Checked = Settings.Appearance.StripParsedTextInStatusBarFromHtmlTags;
bHtmlTagsColor.ForeColor = Settings.Appearance.HtmlTagsColor;
bHtmlCommentColor.ForeColor = Settings.Appearance.HtmlCommentColor;
bHtmlJavascriptColor.ForeColor = Settings.Appearance.HtmlJavascriptColor;
flagCopySelectionToClipboard.Checked = Settings.General.CopySelectionToClipboard;
//HelpFileUri.Text = Settings.Default.HelpFileUri;
label_colors = new List<Color>(Settings.Appearance.FilterBackColors);
fill_color_list();
}
void fill_color_list()
{
listBoxLabelColors.Items.Clear();
int i = 0;
foreach (Color c in label_colors)
{
listBoxLabelColors.Items.Add("level " + i.ToString());
i++;
}
}
List<Color> label_colors = new List<Color>();
private void OK_Click(object sender, EventArgs e)
{
Settings.Appearance.PrintCaptureLabels = flagPrintParseLabels.Checked;
Settings.Appearance.HighlightHtmlTags = flagHighlightHtmlTags.Checked;
Settings.Appearance.FilterBackColors = label_colors;
Settings.Appearance.HtmlTagsColor = bHtmlTagsColor.ForeColor;
Settings.Appearance.HtmlCommentColor = bHtmlCommentColor.ForeColor;
Settings.Appearance.HtmlJavascriptColor = bHtmlJavascriptColor.ForeColor;
Settings.Appearance.StripParsedTextInStatusBarFromHtmlTags = flagStripParsedTextInStatusBarFromHtmlTags.Checked;
Settings.General.CopySelectionToClipboard = flagCopySelectionToClipboard.Checked;
//Settings.Default.HelpFileUri = HelpFileUri.Text;
Settings.Appearance.Save();
Settings.General.Save();
this.Close();
}
private void Cancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void Reset_Click(object sender, EventArgs e)
{
if (!Message.YesNo("After resetting you cannot return back to your previous settings. Proceed?"))
return;
Settings.General.Reset();
Settings.Appearance.Reload();
}
private void flagPrintParseLabels_CheckedChanged(object sender, EventArgs e)
{
Settings.Appearance.PrintCaptureLabels = flagPrintParseLabels.Checked;
}
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
{
this.Dispose();
}
private void About_Click(object sender, EventArgs e)
{
AboutForm a = new AboutForm();
a.ShowDialog();
}
private void StripParsedTextInStatucFromHtmlTags_CheckedChanged(object sender, EventArgs e)
{
Settings.Appearance.StripParsedTextInStatusBarFromHtmlTags = flagStripParsedTextInStatusBarFromHtmlTags.Checked;
}
void listBoxLabelColors_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index < 0)
return;
using (Brush brush = new SolidBrush((Color)label_colors[e.Index]))
{
e.Graphics.FillRectangle(brush, e.Bounds);
}
using (Brush brush = new SolidBrush(e.ForeColor))
{
e.Graphics.DrawString((string)((ListBox)sender).Items[e.Index], e.Font, brush, e.Bounds);
}
e.DrawFocusRectangle();
}
private void bAddColor_Click(object sender, EventArgs e)
{
int i = listBoxLabelColors.SelectedIndex;
if (i < 0)
i = listBoxLabelColors.Items.Count - 1;
label_colors.Insert(i + 1, Color.Empty);
fill_color_list();
}
private void bRemoveColor_Click(object sender, EventArgs e)
{
int i = listBoxLabelColors.SelectedIndex;
if (i < 0)
return;
label_colors.RemoveAt(i);
fill_color_list();
}
private void bEditColor_Click(object sender, EventArgs e)
{
int i = listBoxLabelColors.SelectedIndex;
if (i < 0)
return;
ColorDialog d = new ColorDialog();
d.Color = (Color)label_colors[i];
if (d.ShowDialog(this) != DialogResult.OK)
return;
label_colors[i] = d.Color;
fill_color_list();
}
private void listBoxLabelColors_DoubleClick(object sender, EventArgs e)
{
bEditColor_Click(null, null);
}
private void bHtmlTagsColor_Click(object sender, EventArgs e)
{
ColorDialog d = new ColorDialog();
if (d.ShowDialog(this) != DialogResult.OK)
return;
bHtmlTagsColor.ForeColor = d.Color;
}
private void bHtmlCommentColor_Click(object sender, EventArgs e)
{
ColorDialog d = new ColorDialog();
if (d.ShowDialog(this) != DialogResult.OK)
return;
bHtmlCommentColor.ForeColor = d.Color;
}
private void bHtmlJavascriptColor_Click(object sender, EventArgs e)
{
ColorDialog d = new ColorDialog();
if (d.ShowDialog(this) != DialogResult.OK)
return;
bHtmlJavascriptColor.ForeColor = d.Color;
}
}
}