forked from daPhie79/ProgressODoom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFruityLoopsProgressPainter.cs
169 lines (152 loc) · 6.1 KB
/
FruityLoopsProgressPainter.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
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace ProgressODoom {
/// <summary></summary>
[ToolboxBitmapAttribute(typeof(ProgressODoom.FruityLoopsProgressPainter), "Icons.FruityLoopsProgressPainter.ico")]
public class FruityLoopsProgressPainter : AbstractProgressPainter, IProgressPainter, IDisposable {
private FruityLoopsProgressType type;
private Color OnLit = Color.FromArgb(148, 170, 173);
private Pen pOnLit; // = new Pen(new SolidBrush(OnLit),1f);
private Color OnLitTop = Color.FromArgb(206, 227, 231);
private Pen pOnLitTop; // = new Pen(new SolidBrush(OnLitTop),1f);
private Color OnLitBot = Color.FromArgb(90, 117, 123);
private Pen pOnLitBot; // = new Pen(new SolidBrush(OnLitBot),1f);
private Color OnMid = Color.FromArgb(107, 130, 132);
private Pen pOnMid; // = new Pen(new SolidBrush(OnMid),1f);
private Color OnMidTop = Color.FromArgb(140, 154, 156);
private Pen pOnMidTop; // = new Pen(new SolidBrush(OnMidTop),1f);
private Color OnMidBot = Color.FromArgb(57, 85, 82);
private Pen pOnMidBot; // = new Pen(new SolidBrush(OnMidBot),1f);
private Color OnDrk = Color.FromArgb(57, 85, 82);
private Pen pOnDrk; // = new Pen(new SolidBrush(OnDrk),1f);
private Color OnDrkTop = Color.FromArgb(107, 125, 123);
private Pen pOnDrkTop; // = new Pen(new SolidBrush(OnDrkTop),1f);
private Color OnDrkBot = Color.FromArgb(33, 60, 66);
private Pen pOnDrkBot; // = new Pen(new SolidBrush(OnDrkBot),1f);
/// <summary></summary>
[Category("Appearance"), Description("Gets or sets the type of FruityLoops progress style"), Browsable(true)]
public FruityLoopsProgressType FruityType {
get { return type; }
set {
type = value;
if (type == FruityLoopsProgressType.DoubleLayer) {
OnLit = Color.FromArgb(148, 170, 173);
pOnLit = new Pen(new SolidBrush(OnLit), 1f);
OnLitTop = Color.FromArgb(206, 227, 231);
pOnLitTop = new Pen(new SolidBrush(OnLitTop), 1f);
OnLitBot = Color.FromArgb(90, 113, 115);
pOnLitBot = new Pen(new SolidBrush(OnLitBot), 1f);
OnDrk = Color.FromArgb(115, 142, 148);
pOnDrk = new Pen(new SolidBrush(OnDrk), 1f);
OnDrkTop = Color.FromArgb(181, 199, 198);
pOnDrkTop = new Pen(new SolidBrush(OnDrkTop), 1f);
OnDrkBot = Color.FromArgb(66, 89, 90);
pOnDrkBot = new Pen(new SolidBrush(OnDrkBot), 1f);
} else if (type == FruityLoopsProgressType.TripleLayer) {
OnLit = Color.FromArgb(148, 170, 173);
pOnLit = new Pen(new SolidBrush(OnLit), 1f);
OnLitTop = Color.FromArgb(206, 227, 231);
pOnLitTop = new Pen(new SolidBrush(OnLitTop), 1f);
OnLitBot = Color.FromArgb(90, 117, 123);
pOnLitBot = new Pen(new SolidBrush(OnLitBot), 1f);
OnMid = Color.FromArgb(107, 130, 132);
pOnMid = new Pen(new SolidBrush(OnMid), 1f);
OnMidTop = Color.FromArgb(140, 154, 156);
pOnMidTop = new Pen(new SolidBrush(OnMidTop), 1f);
OnMidBot = Color.FromArgb(57, 85, 82);
pOnMidBot = new Pen(new SolidBrush(OnMidBot), 1f);
OnDrk = Color.FromArgb(57, 85, 82);
pOnDrk = new Pen(new SolidBrush(OnDrk), 1f);
OnDrkTop = Color.FromArgb(107, 125, 123);
pOnDrkTop = new Pen(new SolidBrush(OnDrkTop), 1f);
OnDrkBot = Color.FromArgb(33, 60, 66);
pOnDrkBot = new Pen(new SolidBrush(OnDrkBot), 1f);
}
FireChange();
}
}
/// <summary></summary>
/// <param name="box"></param>
/// <param name="g"></param>
protected override void PaintThisProgress(Rectangle box, Graphics g) {
try {
box.Height -= 1;
} catch { }
if (box.Width <= 1) { return; }
if (type == FruityLoopsProgressType.DoubleLayer) {
PaintDouble(box, g);
} else if (type == FruityLoopsProgressType.TripleLayer) {
PaintTriple(box, g);
}
if (gloss != null) {
gloss.PaintGloss(box, g);
}
}
private void PaintDouble(Rectangle r, Graphics g) {
bool lite = true;
Brush b = new SolidBrush(pOnLit.Color);
g.FillRectangle(b, r);
g.DrawLine(pOnLitTop, r.X, r.Y, r.Right - 1, r.Y);
g.DrawLine(pOnLitBot, r.X, r.Bottom, r.Right - 1, r.Bottom);
for (int i = r.X; i < r.Right; i++) {
if (lite) {
//g.DrawLine(off ? pOffLitTop : pOnLitTop, i, r.Y, i, r.Y + 1);
//g.DrawLine(off ? pOffLitBot : pOnLitBot, i, r.Height, i, r.Height - 1);
//g.DrawLine(off ? pOffLit : pOnLit, i, r.Y + 1, i, r.Height - 1);
} else {
g.DrawLine(pOnDrkTop, i, r.Y, i, r.Y + 1);
g.DrawLine(pOnDrkBot, i, r.Bottom, i, r.Bottom - 1);
g.DrawLine(pOnDrk, i, r.Y + 1, i, r.Bottom - 1);
}
lite = !lite;
}
}
private void PaintTriple(Rectangle r, Graphics g) {
int lite = 1;
Brush b = new SolidBrush(pOnMid.Color);
g.FillRectangle(b, r);
g.DrawLine(pOnMidTop, r.X, r.Y, r.Right - 1, r.Y);
g.DrawLine(pOnMidBot, r.X, r.Bottom, r.Right - 1, r.Bottom);
for (int i = r.X; i < r.Right; i++) {
if (lite == 2) {
g.DrawLine(pOnLitTop, i, r.Y, i, r.Y + 1);
g.DrawLine(pOnLitBot, i, r.Bottom, i, r.Bottom - 1);
g.DrawLine(pOnLit, i, r.Y + 1, i, r.Bottom - 1);
lite = 0;
} else if (lite == 1) {
//g.DrawLine(pOnMidTop, i, r.Y, i, r.Y + 1);
//g.DrawLine(pOnMidBot, i, r.Height, i, r.Height - 1);
//g.DrawLine(pOnMid, i, r.Y + 1, i, r.Height - 1);
lite = 2;
} else if (lite == 0) {
g.DrawLine(pOnDrkTop, i, r.Y, i, r.Y + 1);
g.DrawLine(pOnDrkBot, i, r.Bottom, i, r.Bottom - 1);
g.DrawLine(pOnDrk, i, r.Y + 1, i, r.Bottom - 1);
lite = 1;
}
}
}
/// <summary></summary>
protected override void DisposeThis(bool disposing) {
if (pOnLit != null) { pOnLit.Dispose(); }
if (pOnLitTop != null) { pOnLitTop.Dispose(); }
if (pOnLitBot != null) { pOnLitBot.Dispose(); }
if (pOnMid != null) { pOnMid.Dispose(); }
if (pOnMidTop != null) { pOnMidTop.Dispose(); }
if (pOnMidBot != null) { pOnMidBot.Dispose(); }
if (pOnDrk != null) { pOnDrk.Dispose(); }
if (pOnDrkTop != null) { pOnDrkTop.Dispose(); }
if (pOnDrkBot != null) { pOnDrkBot.Dispose(); }
}
/// <summary></summary>
public enum FruityLoopsProgressType {
/// <summary></summary>
DoubleLayer,
/// <summary></summary>
TripleLayer
}
}
}