HTMLv 0.96d

git-svn-id: svn://kolibrios.org@2884 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-07-20 13:18:10 +00:00
parent 7a6facbbcf
commit 49e86ce233
3 changed files with 179 additions and 308 deletions

View File

@ -1,6 +1,7 @@
16.07.12 - 0.96b 16.07.12 - 0.96d
- небольшие улучшения в обработке ссылок и изображений; - небольшие улучшения в обработке ссылок и изображений;
- включение обработки разрывов строк через меню. - включение обработки разрывов строк через меню;
- поддержка цветов вида #abc, улучшения в обработке цветов.
14.07.12 - 0.96 14.07.12 - 0.96
- исправлен баг со строкой адреса - исправлен баг со строкой адреса

View File

@ -8,7 +8,7 @@ dword
char download_path[]="/rd/1/.download"; char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s="; char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 0.96b"; char version[]=" Text-based Browser 0.96d";
struct TWebBrowser { struct TWebBrowser {

View File

@ -1,323 +1,193 @@
//Надо будет переделать на "дерево поиска" или, что-то подобное //Надо будет переделать на "дерево поиска" или, что-то подобное
//будет нечитабельно, зато меньше и быстее //будет нечитабельно, зато меньше и быстее
//Èìåíà web öâåòîâ struct color_spec {
char *color_names[]={ char *name;
"aliceblue", int rgb;
"antiquewhite", };
"aqua",
"aquamarine",
"azure",
"beige",
"bisque",
"black",
"blanchedalmond",
"blue",
"blueviolet",
"brown",
"burlywood",
"cadetblue",
"chartreuse",
"chocolate",
"coral",
"cornflowerblue",
"cornsilk",
"crimson",
"cyan",
"darkblue",
"darkcyan",
"darkgoldenrod",
"darkgray",
"darkgreen",
"darkkhaki",
"darkmagenta",
"darkolivegreen",
"darkorange",
"darkorchid",
"darkred",
"darksalmon",
"darkseagreen",
"darkslateblue",
"darkslategray",
"darkturquoise",
"darkviolet",
"deeppink",
"deepskyblue",
"dimgray",
"dodgerblue",
"firebrick",
"floralwhite",
"forestgreen",
"fuchsia",
"gainsboro",
"ghostwhite",
"gold",
"goldenrod",
"gray",
"green",
"greenyellow",
"honeydew",
"hotpink",
"indianred",
"indigo",
"ivory",
"khaki",
"lavender",
"lavenderblush",
"lawngreen",
"lemonchiffon",
"lightblue",
"lightcoral",
"lightcyan",
"lightgoldenrodyellow",
"lightgray",
"lightgreen",
"lightpink",
"lightsalmon",
"lightseagreen",
"lightskyblue",
"lightslategray",
"lightsteelblue",
"lightyellow",
"lime",
"limegreen",
"linen",
"magenta",
"maroon",
"mediumaquamarine",
"mediumblue",
"mediumorchid",
"mediumpurple",
"mediumseagreen",
"mediumslateblue",
"mediumspringgreen",
"mediumturquoise",
"mediumvioletred",
"midnightblue",
"mintcream",
"mistyrose",
"moccasin",
"navajowhite",
"navy",
"navyblue",
"oldlace",
"olive",
"olivedrab",
"orange",
"orangered",
"orchid",
"palegoldenrod",
"paleturquoise",
"palevioletred",
"papayawhip",
"peachpuff",
"peru",
"pink",
"plum",
"powderblue",
"purple",
"red",
"rosybrown",
"royalblue",
"saddlebrown",
"salmon",
"sandybrown",
"seagreen",
"seashell",
"sienna",
"silver",
"skyblue",
"slateblue",
"slategray",
"snow",
"springgreen",
"steelblue",
"tan",
"teal",
"thistle",
"tomato",
"turquoise",
"violet",
"wheat",
"white",
"whitesmoke",
"yellow",
"yellowgreen",
0};
//ñîîòâåòñòâóþùèå èì çíà÷åíèÿ struct color_spec color_specs[] = {
dword *colors[]={ "aliceblue", 0xF0F8FF,
0xf0f8ff, "antiquewhite", 0xFAEBD7,
0xfaebd7, "aqua", 0x00FFFF,
0x00ffff, "aquamarine", 0x7FFFD4,
0x7fffd4, "azure", 0xF0FFFF,
0xf0ffff, "beige", 0xF5F5DC,
0xf5f5dc, "bisque", 0xFFE4C4,
0xffe4c4, "black", 0x000000,
0x000000, "blanchedalmond", 0xFFEBCD,
0xffebcd, "blue", 0x0000FF,
0x0000ff, "blueviolet", 0x8A2BE2,
0x8a2be2, "brown", 0xA52A2A,
0xa52a2a, "burlywood", 0xDEB887,
0xdeb887, "cadetblue", 0x5F9EA0,
0x5f9ea0, "chartreuse", 0x7FFF00,
0x7fff00, "chocolate", 0xD2691E,
0xd2691e, "coral", 0xFF7F50,
0xff7f50, "cornflowerblue", 0x6495ED,
0x6495ed, "cornsilk", 0xFFF8DC,
0xfff8dc, "crimson", 0xDC143C,
0xdc143c, "cyan", 0x00FFFF,
0x00ffff, "darkblue", 0x00008B,
0x00008b, "darkcyan", 0x008B8B,
0x008b8b, "darkgoldenrod", 0xB8860B,
0xb8860b, "darkgray", 0xA9A9A9,
0xa9a9a9, "darkgreen", 0x006400,
0x006400, "darkkhaki", 0xBDB76B,
0xbdb76b, "darkmagenta", 0x8B008B,
0x8b008b, "darkolivegreen", 0x556B2F,
0x556b2f, "darkorange", 0xFF8C00,
0xff8c00, "darkorchid", 0x9932CC,
0x9932cc, "darkred", 0x8B0000,
0x8b0000, "darksalmon", 0xE9967A,
0xe9967a, "darkseagreen", 0x8FBC8F,
0x8fbc8f, "darkslateblue", 0x483D8B,
0x483d8b, "darkslategray", 0x2F4F4F,
0x2f4f4f, "darkturquoise", 0x00CED1,
0x00ced1, "darkviolet", 0x9400D3,
0x9400d3, "deeppink", 0xFF1493,
0xff1493, "deepskyblue", 0x00BFFF,
0x00bfff, "dimgray", 0x696969,
0x696969, "dodgerblue", 0x1E90FF,
0x1e90ff, "firebrick", 0xB22222,
0xb22222, "floralwhite", 0xFFFAF0,
0xfffaf0, "forestgreen", 0x228B22,
0x228b22, "fuchsia", 0xFF00FF,
0xff00ff, "gainsboro", 0xDCDCDC,
0xdcdcdc, "ghostwhite", 0xF8F8FF,
0xf8f8ff, "gold", 0xFFD700,
0xffd700, "goldenrod", 0xDAA520,
0xdaa520, "gray", 0x808080,
0x808080, "green", 0x008000,
0x008000, "greenyellow", 0xADFF2F,
0xadff2f, "honeydew", 0xF0FFF0,
0xf0fff0, "hotpink", 0xFF69B4,
0xff69b4, "indianred", 0xCD5C5C,
0xcd5c5c, "indigo", 0x4B0082,
0x4b0082, "ivory", 0xFFFFF0,
0xfffff0, "khaki", 0xF0E68C,
0xf0e68c, "lavender", 0xE6E6FA,
0xe6e6fa, "lavenderblush", 0xFFF0F5,
0xfff0f5, "lawngreen", 0x7CFC00,
0x7cfc00, "lemonchiffon", 0xFFFACD,
0xfffacd, "lightblue", 0xADD8E6,
0xadd8e6, "lightcoral", 0xF08080,
0xf08080, "lightcyan", 0xE0FFFF,
0xe0ffff, "lightgoldenrodyellow", 0xFAFAD2,
0xfafad2, "lightgreen", 0x90EE90,
0xd3d3d3, "lightgrey", 0xD3D3D3,
0x90ee90, "lightpink", 0xFFB6C1,
0xffb6c1, "lightsalmon", 0xFFA07A,
0xffa07a, "lightseagreen", 0x20B2AA,
0x20b2aa, "lightskyblue", 0x87CEFA,
0x87cefa, "lightslategray", 0x778899,
0x778899, "lightsteelblue", 0xB0C4DE,
0xb0c4de, "lightyellow", 0xFFFFE0,
0xffffe0, "lime", 0x00FF00,
0x00ff00, "limegreen", 0x32CD32,
0x32cd32, "linen", 0xFAF0E6,
0xfaf0e6, "magenta", 0xFF00FF,
0xff00ff, "maroon", 0x800000,
0x800000, "mediumaquamarine", 0x66CDAA,
0x66cdaa, "mediumblue", 0x0000CD,
0x0000cd, "mediumorchid", 0xBA55D3,
0xba55d3, "mediumpurple", 0x9370DB,
0x9370db, "mediumseagreen", 0x3CB371,
0x3cb371, "mediumslateblue", 0x7B68EE,
0x7b68ee, "mediumspringgreen", 0x00FA9A,
0x00fa9a, "mediumturquoise", 0x48D1CC,
0x48d1cc, "mediumvioletred", 0xC71585,
0xc71585, "midnightblue", 0x191970,
0x191970, "mintcream", 0xF5FFFA,
0xf5fffa, "mistyrose", 0xFFE4E1,
0xffe4e1, "moccasin", 0xFFE4B5,
0xffe4b5, "navajowhite", 0xFFDEAD,
0xffdead, "navy", 0x000080,
0x000080, "oldlace", 0xFDF5E6,
0x9fafdf, "olive", 0x808000,
0xfdf5e6, "olivedrab", 0x6B8E23,
0x808000, "orange", 0xFFA500,
0x6b8e23, "orangered", 0xFF4500,
0xffa500, "orchid", 0xDA70D6,
0xff4500, "palegoldenrod", 0xEEE8AA,
0xda70d6, "palegreen", 0x98FB98,
0xeee8aa, "paleturquoise", 0xAFEEEE,
0xafeeee, "palevioletred", 0xDB7093,
0xd87093, "papayawhip", 0xFFEFD5,
0xffefd5, "peachpuff", 0xFFDAB9,
0xffdab9, "peru", 0xCD853F,
0xcd853f, "pink", 0xFFC0CB,
0xffc0cb, "plum", 0xDDA0DD,
0xdda0dd, "powderblue", 0xB0E0E6,
0xb0e0e6, "purple", 0x800080,
0x800080, "red", 0xFF0000,
0xff0000, "rosybrown", 0xBC8F8F,
0xbc8f8f, "royalblue", 0x4169E1,
0x4169e1, "saddlebrown", 0x8B4513,
0x8b4513, "salmon", 0xFA8072,
0xfa8072, "sandybrown", 0xF4A460,
0xf4a460, "seagreen", 0x2E8B57,
0x2e8b57, "seashell", 0xFFF5EE,
0xfff5ee, "sienna", 0xA0522D,
0xa0522d, "silver", 0xC0C0C0,
0xc0c0c0, "skyblue", 0x87CEEB,
0x87ceeb, "slateblue", 0x6A5ACD,
0x6a5acd, "slategray", 0x708090,
0x708090, "snow", 0xFFFAFA,
0xfffafa, "springgreen", 0x00FF7F,
0x00ff7f, "steelblue", 0x4682B4,
0x4682b4, "tan", 0xD2B48C,
0xd2b48c, "teal", 0x008080,
0x008080, "thistle", 0xD8BFD8,
0xd8bfd8, "tomato", 0xFF6347,
0xff6347, "turquoise", 0x40E0D0,
0x40e0d0, "violet", 0xEE82EE,
0xee82ee, "wheat", 0xF5DEB3,
0xf5deb3, "white", 0xFFFFFF,
0xffffff, "whitesmoke", 0xF5F5F5,
0xf5f5f5, "yellow", 0xFFFF00,
0xffff00, "yellowgreen", 0x9ACD32,
0x9acd32}; 0};
dword StrToCol(char* htmlcolor) dword StrToCol(char* htmlcolor)
{ {
dword j=1, color=0; dword j=1,
char ch=0x00; color=0,
textlen=0;
IF (ESBYTE[htmlcolor]<>'#') RETURN; char ch=0x00;
FOR (;j<7;j++) if (ESBYTE[htmlcolor]<>'#') return;
{
ch=ESBYTE[htmlcolor+j]; textlen= strlen(htmlcolor);
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; if (textlen==7) || (textlen==4)
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; {
color = color*0x10 + ch; FOR (; j<textlen; j++)
} {
ch=ESBYTE[htmlcolor+j];
return color; IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
color = color*0x10 + ch;
if (textlen==4) color = color*0x10 + ch; //#abc ->> #aabbcc (ñëàâà âèêèïåäèè!!1)
}
return color;
}
return text_colors[0];
} }
dword GetColor(char* color_str) dword GetColor(char* color_str)
{ {
int ii; int ii;
IF (ESBYTE[color_str] == '#') if (ESBYTE[color_str] == '#')
return StrToCol(color_str); return StrToCol(color_str);
else
ELSE for (ii=0; color_specs[ii].name!=0; ii++)
FOR (ii=0; color_names[ii]!=0; ii++)
{ {
IF(!strcmp(color_str, color_names[ii])) return colors[ii]; if (!strcmp(color_str, color_specs[ii].name)) return color_specs[ii].rgb;
} }
return text_colors[0]; return text_colors[0];
} }