Subversion Repositories Kolibri OS

Rev

Rev 4411 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4411 Rev 5499
1
//Íàäî áóäåò ïåðåäåëàòü íà "äåðåâî ïîèñêà" èëè, ÷òî-òî ïîäîáíîå
1
//Íàäî áóäåò ïåðåäåëàòü íà "äåðåâî ïîèñêà" èëè, ÷òî-òî ïîäîáíîå
2
//áóäåò íå÷èòàáåëüíî, çàòî ìåíüøå è áûñòåå
2
//áóäåò íå÷èòàáåëüíî, çàòî ìåíüøå è áûñòåå
3
 
3
 
4
struct color_spec {
4
struct color_spec {
5
	char *name;
5
	char *name;
6
	int rgb;
6
	int rgb;
7
};
7
};
8
 
8
 
9
struct color_spec color_specs[] = {
9
struct color_spec color_specs[] = {
10
	"aliceblue",     0xF0F8FF,
10
	"aliceblue",	 0xF0F8FF,
11
	"antiquewhite",  0xFAEBD7,
11
	"antiquewhite",  0xFAEBD7,
12
	"aqua",	         0x00FFFF,
12
	"aqua", 	 0x00FFFF,
13
	"aquamarine",    0x7FFFD4,
13
	"aquamarine",	 0x7FFFD4,
14
	"azure",		 0xF0FFFF,
14
	"azure",		 0xF0FFFF,
15
	"beige",		 0xF5F5DC,
15
	"beige",		 0xF5F5DC,
16
	"bisque",		 0xFFE4C4,
16
	"bisque",		 0xFFE4C4,
17
	"black",		 0x000000,
17
	"black",		 0x000000,
18
	"blanchedalmond",0xFFEBCD,
18
	"blanchedalmond",0xFFEBCD,
19
	"blue",          0x0000FF,
19
	"blue", 	 0x0000FF,
20
	"blueviolet",    0x8A2BE2,
20
	"blueviolet",	 0x8A2BE2,
21
	"brown",		 0xA52A2A,
21
	"brown",		 0xA52A2A,
22
	"burlywood",     0xDEB887,
22
	"burlywood",	 0xDEB887,
23
	"cadetblue",     0x5F9EA0,
23
	"cadetblue",	 0x5F9EA0,
24
	"chartreuse",    0x7FFF00,
24
	"chartreuse",	 0x7FFF00,
25
	"chocolate",     0xD2691E,
25
	"chocolate",	 0xD2691E,
26
	"coral",         0xFF7F50,
26
	"coral",	 0xFF7F50,
27
	"cornflowerblue",0x6495ED,
27
	"cornflowerblue",0x6495ED,
28
	"cornsilk",		 0xFFF8DC,
28
	"cornsilk",		 0xFFF8DC,
29
	"crimson",		 0xDC143C,
29
	"crimson",		 0xDC143C,
30
	"cyan",          0x00FFFF,
30
	"cyan", 	 0x00FFFF,
31
	"darkblue",	     0x00008B,
31
	"darkblue",	     0x00008B,
32
	"darkcyan",	     0x008B8B,
32
	"darkcyan",	     0x008B8B,
33
	"darkgoldenrod", 0xB8860B,
33
	"darkgoldenrod", 0xB8860B,
34
	"darkgray",	     0xA9A9A9,
34
	"darkgray",	     0xA9A9A9,
35
	"darkgreen",     0x006400,
35
	"darkgreen",	 0x006400,
36
	"darkkhaki",     0xBDB76B,
36
	"darkkhaki",	 0xBDB76B,
37
	"darkmagenta",   0x8B008B,
37
	"darkmagenta",	 0x8B008B,
38
	"darkolivegreen",0x556B2F,
38
	"darkolivegreen",0x556B2F,
39
	"darkorange",    0xFF8C00,
39
	"darkorange",	 0xFF8C00,
40
	"darkorchid",    0x9932CC,
40
	"darkorchid",	 0x9932CC,
41
	"darkred",		 0x8B0000,
41
	"darkred",		 0x8B0000,
42
	"darksalmon",    0xE9967A,
42
	"darksalmon",	 0xE9967A,
43
	"darkseagreen",  0x8FBC8F,
43
	"darkseagreen",  0x8FBC8F,
44
	"darkslateblue", 0x483D8B,
44
	"darkslateblue", 0x483D8B,
45
	"darkslategray", 0x2F4F4F,
45
	"darkslategray", 0x2F4F4F,
46
	"darkturquoise", 0x00CED1,
46
	"darkturquoise", 0x00CED1,
47
	"darkviolet",    0x9400D3,
47
	"darkviolet",	 0x9400D3,
48
	"deeppink",      0xFF1493,
48
	"deeppink",	 0xFF1493,
49
	"deepskyblue",   0x00BFFF,
49
	"deepskyblue",	 0x00BFFF,
50
	"dimgray",       0x696969,
50
	"dimgray",	 0x696969,
51
	"dodgerblue",    0x1E90FF,
51
	"dodgerblue",	 0x1E90FF,
52
	"firebrick",     0xB22222,
52
	"firebrick",	 0xB22222,
53
	"floralwhite",   0xFFFAF0,
53
	"floralwhite",	 0xFFFAF0,
54
	"forestgreen",   0x228B22,
54
	"forestgreen",	 0x228B22,
55
	"fuchsia",       0xFF00FF,
55
	"fuchsia",	 0xFF00FF,
56
	"gainsboro",     0xDCDCDC,
56
	"gainsboro",	 0xDCDCDC,
57
	"ghostwhite",    0xF8F8FF,
57
	"ghostwhite",	 0xF8F8FF,
58
	"gold",          0xFFD700,
58
	"gold", 	 0xFFD700,
59
	"goldenrod",     0xDAA520,
59
	"goldenrod",	 0xDAA520,
60
	"gray",          0x808080,
60
	"gray", 	 0x808080,
61
	"green",         0x008000,
61
	"green",	 0x008000,
62
	"greenyellow",   0xADFF2F,
62
	"greenyellow",	 0xADFF2F,
63
	"honeydew",      0xF0FFF0,
63
	"honeydew",	 0xF0FFF0,
64
	"hotpink",       0xFF69B4,
64
	"hotpink",	 0xFF69B4,
65
	"indianred",     0xCD5C5C,
65
	"indianred",	 0xCD5C5C,
66
	"indigo",        0x4B0082,
66
	"indigo",	 0x4B0082,
67
	"ivory",         0xFFFFF0,
67
	"ivory",	 0xFFFFF0,
68
	"khaki",         0xF0E68C,
68
	"khaki",	 0xF0E68C,
69
	"lavender",      0xE6E6FA,
69
	"lavender",	 0xE6E6FA,
70
	"lavenderblush", 0xFFF0F5,
70
	"lavenderblush", 0xFFF0F5,
71
	"lawngreen",     0x7CFC00,
71
	"lawngreen",	 0x7CFC00,
72
	"lemonchiffon",  0xFFFACD,
72
	"lemonchiffon",  0xFFFACD,
73
	"lightblue",     0xADD8E6,
73
	"lightblue",	 0xADD8E6,
74
	"lightcoral",    0xF08080,
74
	"lightcoral",	 0xF08080,
75
	"lightcyan",     0xE0FFFF,
75
	"lightcyan",	 0xE0FFFF,
76
	"lightgoldenrodyellow",	0xFAFAD2,
76
	"lightgoldenrodyellow", 0xFAFAD2,
77
	"lightgreen",    0x90EE90,
77
	"lightgreen",	 0x90EE90,
78
	"lightgrey",     0xD3D3D3,
78
	"lightgrey",	 0xD3D3D3,
79
	"lightpink",     0xFFB6C1,
79
	"lightpink",	 0xFFB6C1,
80
	"lightsalmon",   0xFFA07A,
80
	"lightsalmon",	 0xFFA07A,
81
	"lightseagreen", 0x20B2AA,
81
	"lightseagreen", 0x20B2AA,
82
	"lightskyblue",  0x87CEFA,
82
	"lightskyblue",  0x87CEFA,
83
	"lightslategray",0x778899,
83
	"lightslategray",0x778899,
84
	"lightsteelblue",0xB0C4DE,
84
	"lightsteelblue",0xB0C4DE,
85
	"lightyellow",   0xFFFFE0,
85
	"lightyellow",	 0xFFFFE0,
86
	"lime",          0x00FF00,
86
	"lime", 	 0x00FF00,
87
	"limegreen",     0x32CD32,
87
	"limegreen",	 0x32CD32,
88
	"linen",         0xFAF0E6,
88
	"linen",	 0xFAF0E6,
89
	"magenta",       0xFF00FF,
89
	"magenta",	 0xFF00FF,
90
	"maroon",        0x800000,
90
	"maroon",	 0x800000,
91
	"mediumaquamarine",0x66CDAA,
91
	"mediumaquamarine",0x66CDAA,
92
	"mediumblue",    0x0000CD,
92
	"mediumblue",	 0x0000CD,
93
	"mediumorchid",  0xBA55D3,
93
	"mediumorchid",  0xBA55D3,
94
	"mediumpurple",  0x9370DB,
94
	"mediumpurple",  0x9370DB,
95
	"mediumseagreen",0x3CB371,
95
	"mediumseagreen",0x3CB371,
96
	"mediumslateblue",0x7B68EE,
96
	"mediumslateblue",0x7B68EE,
97
	"mediumspringgreen",0x00FA9A,
97
	"mediumspringgreen",0x00FA9A,
98
	"mediumturquoise",0x48D1CC,
98
	"mediumturquoise",0x48D1CC,
99
	"mediumvioletred",0xC71585,
99
	"mediumvioletred",0xC71585,
100
	"midnightblue",  0x191970,
100
	"midnightblue",  0x191970,
101
	"mintcream",     0xF5FFFA,
101
	"mintcream",	 0xF5FFFA,
102
	"mistyrose",     0xFFE4E1,
102
	"mistyrose",	 0xFFE4E1,
103
	"moccasin",	     0xFFE4B5,
103
	"moccasin",	     0xFFE4B5,
104
	"navajowhite",   0xFFDEAD,
104
	"navajowhite",	 0xFFDEAD,
105
	"navy",          0x000080,
105
	"navy", 	 0x000080,
106
	"oldlace",       0xFDF5E6,
106
	"oldlace",	 0xFDF5E6,
107
	"olive",         0x808000,
107
	"olive",	 0x808000,
108
	"olivedrab",     0x6B8E23,
108
	"olivedrab",	 0x6B8E23,
109
	"orange",        0xFFA500,
109
	"orange",	 0xFFA500,
110
	"orangered",     0xFF4500,
110
	"orangered",	 0xFF4500,
111
	"orchid",        0xDA70D6,
111
	"orchid",	 0xDA70D6,
112
	"palegoldenrod", 0xEEE8AA,
112
	"palegoldenrod", 0xEEE8AA,
113
	"palegreen",     0x98FB98,
113
	"palegreen",	 0x98FB98,
114
	"paleturquoise", 0xAFEEEE,
114
	"paleturquoise", 0xAFEEEE,
115
	"palevioletred", 0xDB7093,
115
	"palevioletred", 0xDB7093,
116
	"papayawhip",    0xFFEFD5,
116
	"papayawhip",	 0xFFEFD5,
117
	"peachpuff",     0xFFDAB9,
117
	"peachpuff",	 0xFFDAB9,
118
	"peru",          0xCD853F,
118
	"peru", 	 0xCD853F,
119
	"pink",          0xFFC0CB,
119
	"pink", 	 0xFFC0CB,
120
	"plum",          0xDDA0DD,
120
	"plum", 	 0xDDA0DD,
121
	"powderblue",    0xB0E0E6,
121
	"powderblue",	 0xB0E0E6,
122
	"purple",        0x800080,
122
	"purple",	 0x800080,
123
	"red",           0xFF0000,
123
	"red",		 0xFF0000,
124
	"rosybrown",     0xBC8F8F,
124
	"rosybrown",	 0xBC8F8F,
125
	"royalblue",     0x4169E1,
125
	"royalblue",	 0x4169E1,
126
	"saddlebrown",   0x8B4513,
126
	"saddlebrown",	 0x8B4513,
127
	"salmon",        0xFA8072,
127
	"salmon",	 0xFA8072,
128
	"sandybrown",    0xF4A460,
128
	"sandybrown",	 0xF4A460,
129
	"seagreen",      0x2E8B57,
129
	"seagreen",	 0x2E8B57,
130
	"seashell",      0xFFF5EE,
130
	"seashell",	 0xFFF5EE,
131
	"sienna",        0xA0522D,
131
	"sienna",	 0xA0522D,
132
	"silver",        0xC0C0C0,
132
	"silver",	 0xC0C0C0,
133
	"skyblue",       0x87CEEB,
133
	"skyblue",	 0x87CEEB,
134
	"slateblue",     0x6A5ACD,
134
	"slateblue",	 0x6A5ACD,
135
	"slategray",     0x708090,
135
	"slategray",	 0x708090,
136
	"snow",          0xFFFAFA,
136
	"snow", 	 0xFFFAFA,
137
	"springgreen",   0x00FF7F,
137
	"springgreen",	 0x00FF7F,
138
	"steelblue",     0x4682B4,
138
	"steelblue",	 0x4682B4,
139
	"tan",           0xD2B48C,
139
	"tan",		 0xD2B48C,
140
	"teal",          0x008080,
140
	"teal", 	 0x008080,
141
	"thistle",       0xD8BFD8,
141
	"thistle",	 0xD8BFD8,
142
	"tomato",        0xFF6347,
142
	"tomato",	 0xFF6347,
143
	"turquoise",     0x40E0D0,
143
	"turquoise",	 0x40E0D0,
144
	"violet",        0xEE82EE,
144
	"violet",	 0xEE82EE,
145
	"wheat",         0xF5DEB3,
145
	"wheat",	 0xF5DEB3,
146
	"white",         0xFFFFFF,
146
	"white",	 0xFFFFFF,
147
	"whitesmoke",    0xF5F5F5,
147
	"whitesmoke",	 0xF5F5F5,
148
	"yellow",        0xFFFF00,
148
	"yellow",	 0xFFFF00,
149
	"yellowgreen",   0x9ACD32,
149
	"yellowgreen",	 0x9ACD32,
150
0};
150
0};
151
 
151
 
152
dword StrToCol(char* htmlcolor)
152
dword StrToCol(char* htmlcolor)
153
{
153
{
154
	dword j=1,
154
	dword j=1,
155
		color=0,
155
		color=0,
156
		textlen=0;
156
		textlen=0;
157
	char ch=0x00;
157
	char ch=0x00;
158
 
158
 
159
	if (ESBYTE[htmlcolor]<>'#') return text_colors[0];
159
	if (ESBYTE[htmlcolor]<>'#') return text_colors[0];
160
 
160
 
161
	textlen = strlen(htmlcolor);
161
	textlen = strlen(htmlcolor);
162
 
162
 
163
	if (textlen==7) || (textlen==4)
163
	if (textlen==7) || (textlen==4)
164
	{
164
	{
165
		FOR (;  j
165
		FOR (;  j
166
		{
166
		{
167
			ch=ESBYTE[htmlcolor+j];
167
			ch=ESBYTE[htmlcolor+j];
168
			IF ((ch>='0') && (ch<='9')) ch -= '0';
168
			IF ((ch>='0') && (ch<='9')) ch -= '0';
169
			IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
169
			IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
170
			IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
170
			IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
171
			color = color*0x10 + ch;
171
			color = color*0x10 + ch;
172
			if (textlen==4) color = color*0x10 + ch; //#abc ->> #aabbcc (ñëàâà âèêèïåäèè!!1)
172
			if (textlen==4) color = color*0x10 + ch; //#abc ->> #aabbcc (ñëàâà âèêèïåäèè!!1)
173
		}
173
		}
174
		return color;
174
		return color;
175
	}
175
	}
176
	
176
 
177
	return text_colors[0];
177
	return text_colors[0];
178
}
178
}
179
 
179
 
180
dword GetColor(char* color_str)
180
dword GetColor(char* color_str)
181
{
181
{
182
	int ii;
182
	int ii;
183
 
183
 
184
	if (ESBYTE[color_str] == '#')
184
	if (ESBYTE[color_str] == '#')
185
		return StrToCol(color_str);
185
		return StrToCol(color_str);
186
	else
186
	else
187
		for (ii=0; color_specs[ii].name!=0; ii++)
187
		for (ii=0; color_specs[ii].name!=0; ii++)
188
		{
188
		{
189
			if (!strcmp(color_str, color_specs[ii].name)) return color_specs[ii].rgb;
189
			if (!strcmpi(color_str, color_specs[ii].name)) return color_specs[ii].rgb;
190
		}
190
		}
191
 
191
 
192
	return text_colors[0];
192
	return text_colors[0];
193
}
193
}