diff --git a/.gitignore b/.gitignore
index 9589cfe..8c7d19f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
# CI build output collected by build.sh
/dist/
+.vm/
diff --git a/browser/TWB/TWB.c b/browser/TWB/TWB.c
deleted file mode 100644
index 15402e7..0000000
--- a/browser/TWB/TWB.c
+++ /dev/null
@@ -1,285 +0,0 @@
-#include "TWB\colors.h"
-#include "TWB\anchors.h"
-#include "TWB\parse_tag.h"
-#include "TWB\special.h"
-#include "TWB\tag_list.h"
-#define DEFAULT_BG_COL 0xffFBE5E4; //- peach; 0xffEBE8E9 - more grey
-dword link_color_default;
-dword link_color_active;
-#include "TWB\links.h"
-
-#define BODY_MARGIN 6
-#define BASIC_CHAR_W 8
-#define BASIC_LINE_H 18
-
-struct STYLE {
- bool
- b, u, s, h,
- font,
- pre,
- blq,
- button,
- image,
- nav, header;
- LIST tag_list;
- dword title;
- dword cur_line_h;
- void reset();
-};
-
-void STYLE::reset()
-{
- b = u = s = h = font = pre = blq =
- title = button = image = nav = header = false;
- cur_line_h = NULL;
- tag_list.reset();
-}
-
-struct TWebBrowser {
- llist list;
- STYLE style;
- dword draw_y, draw_x, draw_w, left_gap;
- dword o_bufpointer;
- int cur_encoding, custom_encoding;
- bool link, t_html, t_body;
- dword bufpointer;
- dword bufsize;
- dword is_html;
- collection img_url;
- char header[150];
- char linebuf[500];
- char redirect[URL_SIZE];
-
- bool secondrun;
-
- void SetStyle();
- void RenderTextbuf();
- void RenderLine();
- bool RenderImage();
-
- void SetPageDefaults();
- void ParseHtml();
- void Reparse();
- void NewLine();
- void ChangeEncoding();
- void AddCharToTheLine();
- void DrawPage();
-
- void tag_a();
- void tag_p();
- void tag_img();
- void tag_kosicon();
- void tag_div();
- void tag_h1234_caption();
- void tag_ol_ul_dt();
- void tag_li();
- void tag_q();
- void tag_hr();
- void tag_code();
- void tag_meta_xml();
- void tag_body();
- void tag_iframe();
- void tag_title();
- void tag_font();
- void tag_table_reset();
- void tag_table();
- void tag_td();
- void tag_tr();
- void reset_font_style();
-};
-
-#include "TWB\render.h"
-#include "TWB\set_style.h"
-//============================================================================================
-void TWebBrowser::SetPageDefaults()
-{
- t_html = t_body = link = false;
- style.reset();
- reset_font_style();
- link_color_default = 0x0000FF;
- link_color_active = 0xFF0000;
- links.clear();
- anchors.clear();
- img_url.drop();
- text_colors.drop();
- text_colors.add(0);
- if (secondrun) {
- canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count)+200);
- canvas.Fill(0, bg_colors.get(0));
- }
- bg_colors.drop();
- bg_colors.add(DEFAULT_BG_COL);
- header = NULL;
- draw_y = BODY_MARGIN;
- draw_x = left_gap = BODY_MARGIN;
- draw_w = list.w - BODY_MARGIN - BODY_MARGIN;
- linebuf = 0;
- redirect = '\0';
- tag_table_reset();
- is_html = true;
- if (!strstri(bufpointer, "
"); }
- $push cur_encoding
- SetStyle();
- $pop eax
- // The thing is that UTF if longer than other encodings.
- // So if encoding was changed from UTF to DOS than $bufpos position got wrong,
- // and we have to start parse from the very beginning
- if (EAX != cur_encoding) && (cur_encoding == CH_UTF8) {
- ParseHtml(bufpointer, strlen(bufpointer));
- return;
- }
- }
- continue;
- }
- }
- AddCharToTheLine(ESBYTE[bufpos]);
- }
-
- RenderTextbuf();
- list.count = draw_y + style.cur_line_h;
- list.CheckDoesValuesOkey();
- anchors.current = NULL;
-
- if (!secondrun) {
- secondrun = true;
- goto _PARSE_START_;
- }
- if (!header) {
- strncpy(#header, #version, sizeof(TWebBrowser.header)-1);
- DrawTitle(#header);
- }
-}
-//============================================================================================
-void TWebBrowser::AddCharToTheLine(unsigned char _char)
-{
- dword line_len = strlen(#linebuf);
- if (_char<=15) _char=' ';
- if (!style.pre) && (_char == ' ')
- {
- if (linebuf[line_len-1]==' ') return; //no double spaces
- if (draw_x==left_gap) && (!linebuf) return; //no paces at the beginning of the line
- if (link) && (line_len==0) return;
- }
- if (line_len < sizeof(TWebBrowser.linebuf)) {
- chrcat(#linebuf+line_len, _char);
- } else {
- RenderTextbuf();
- }
-}
-//============================================================================================
-void TWebBrowser::ChangeEncoding(int _new_encoding)
-{
- if (cur_encoding == _new_encoding) return;
- cur_encoding = _new_encoding;
- bufpointer = ChangeCharset(cur_encoding, CH_CP866, bufpointer);
- if (header) {
- ChangeCharset(cur_encoding, CH_CP866, #header);
- DrawTitle(#header);
- }
-}
-//============================================================================================
-scroll_bar scroll_wv = { 15,NULL,NULL,NULL,
- 0,2,NULL,0,0,0xeeeeee,0xBBBbbb,0xeeeeee};
-
-void TWebBrowser::DrawPage()
-{
- if (list.w!=canvas.bufw) Reparse();
- canvas.Show(list.first, list.h);
-
- scroll_wv.max_area = list.count;
- scroll_wv.cur_area = list.visible;
- scroll_wv.position = list.first;
- scroll_wv.all_redraw = 0;
- scroll_wv.start_x = list.x + list.w;
- scroll_wv.start_y = list.y;
- scroll_wv.size_y = list.h;
-
- if (list.count <= list.visible) {
- DrawBar(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x,
- scroll_wv.size_y, bg_colors.get(0) & 0x00FFFFFF);
- } else {
- scrollbar_v_draw(#scroll_wv);
- }
-}
\ No newline at end of file
diff --git a/browser/TWB/anchors.h b/browser/TWB/anchors.h
deleted file mode 100644
index 819e6cb..0000000
--- a/browser/TWB/anchors.h
+++ /dev/null
@@ -1,43 +0,0 @@
-
-struct _anchors {
- char current[256];
- collection anchor_name;
- collection anchor_position;
- void add();
- int get_pos_by_name();
- void clear();
- void take_anchor_from();
-} anchors=0;
-
-void _anchors::add(dword _name, _pos)
-{
- anchor_name.add(_name);
- anchor_position.add(itoa(_pos));
-}
-
-int _anchors::get_pos_by_name(dword _get_name)
-{
- dword pos_name = anchor_name.get_pos_by_name(_get_name);
- if (ESBYTE[_get_name]==NULL) return 0;
- if (pos_name==-1) {
- return -1;
- } else {
- return atoi(anchor_position.get(pos_name));
- }
-}
-
-void _anchors::clear()
-{
- anchor_name.drop();
- anchor_position.drop();
-}
-
-void _anchors::take_anchor_from(dword _URL)
-{
- int anchor_pos;
- if (!current) && (_URL) && (anchor_pos = strrchr(_URL, '#')) {
- strncpy(#current, _URL+anchor_pos-1, sizeof(_anchors.current)-1);
- ESBYTE[_URL+anchor_pos-1] = '\0';
- }
-}
-
diff --git a/browser/TWB/colors.h b/browser/TWB/colors.h
deleted file mode 100644
index 073862d..0000000
--- a/browser/TWB/colors.h
+++ /dev/null
@@ -1,75 +0,0 @@
-collection_int text_colors;
-collection_int bg_colors;
-
-struct WEB_COLORS {
- char *name;
- dword rgb;
-} web_colors[] = {
- "aliceblue", 0xF0F8FF, "antiquewhite", 0xFAEBD7, "aqua", 0x00FFFF, "aquamarine", 0x7FFFD4,
- "azure", 0xF0FFFF, "beige", 0xF5F5DC, "bisque", 0xFFE4C4, "black", 0x000000,
- "blanchedalmond", 0xFFEBCD, "blue", 0x0000FF, "blueviolet", 0x8A2BE2, "brown", 0xA52A2A,
- "burlywood", 0xDEB887, "cadetblue", 0x5F9EA0, "chartreuse", 0x7FFF00, "chocolate", 0xD2691E,
- "coral", 0xFF7F50, "cornflowerblue", 0x6495ED, "cornsilk", 0xFFF8DC, "crimson", 0xDC143C,
- "cyan", 0x00FFFF, "darkblue", 0x00008B, "darkcyan", 0x008B8B, "darkgoldenrod", 0xB8860B,
- "darkgray", 0xA9A9A9, "darkgreen", 0x006400, "darkkhaki", 0xBDB76B, "darkmagenta", 0x8B008B,
- "darkolivegreen", 0x556B2F, "darkorange", 0xFF8C00, "darkorchid", 0x9932CC, "darkred", 0x8B0000,
- "darksalmon", 0xE9967A, "darkseagreen", 0x8FBC8F, "darkslateblue", 0x483D8B, "darkslategray", 0x2F4F4F,
- "darkturquoise", 0x00CED1, "darkviolet", 0x9400D3, "deeppink", 0xFF1493, "deepskyblue", 0x00BFFF,
- "dimgray", 0x696969, "dodgerblue", 0x1E90FF, "firebrick", 0xB22222, "floralwhite", 0xFFFAF0,
- "forestgreen", 0x228B22, "fuchsia", 0xFF00FF, "gainsboro", 0xDCDCDC, "ghostwhite", 0xF8F8FF,
- "gold", 0xFFD700, "goldenrod", 0xDAA520, "gray", 0x808080, "green", 0x008000,
- "greenyellow", 0xADFF2F, "honeydew", 0xF0FFF0, "hotpink", 0xFF69B4, "indianred", 0xCD5C5C,
- "indigo", 0x4B0082, "ivory", 0xFFFFF0, "khaki", 0xF0E68C, "lavender", 0xE6E6FA,
- "lavenderblush", 0xFFF0F5, "lawngreen", 0x7CFC00, "lemonchiffon", 0xFFFACD, "lightblue", 0xADD8E6,
- "lightcoral", 0xF08080, "lightcyan", 0xE0FFFF, "lightgreen", 0x90EE90, "lightgrey", 0xD3D3D3,
- "lightpink", 0xFFB6C1, "lightsalmon", 0xFFA07A, "lightseagreen", 0x20B2AA, "lightskyblue", 0x87CEFA,
- "lightslategray", 0x778899, "lightsteelblue", 0xB0C4DE, "lightyellow", 0xFFFFE0, "lime", 0x00FF00,
- "limegreen", 0x32CD32, "linen", 0xFAF0E6, "magenta", 0xFF00FF, "maroon", 0x800000,
- "mediumaquamarine", 0x66CDAA, "mediumblue", 0x0000CD, "mediumorchid", 0xBA55D3, "mediumpurple", 0x9370DB,
- "mediumseagreen", 0x3CB371, "mediumslateblue", 0x7B68EE, "mediumspringgreen",0x00FA9A, "mediumturquoise", 0x48D1CC,
- "mediumvioletred", 0xC71585, "midnightblue", 0x191970, "mintcream", 0xF5FFFA, "mistyrose", 0xFFE4E1,
- "moccasin", 0xFFE4B5, "navajowhite", 0xFFDEAD, "navy", 0x000080, "oldlace", 0xFDF5E6,
- "olive", 0x808000, "olivedrab", 0x6B8E23, "orange", 0xFFA500, "orangered", 0xFF4500,
- "orchid", 0xDA70D6, "palegoldenrod", 0xEEE8AA, "palegreen", 0x98FB98, "paleturquoise", 0xAFEEEE,
- "palevioletred", 0xDB7093, "papayawhip", 0xFFEFD5, "peachpuff", 0xFFDAB9, "peru", 0xCD853F,
- "pink", 0xFFC0CB, "plum", 0xDDA0DD, "powderblue", 0xB0E0E6, "purple", 0x800080,
- "red", 0xFF0000, "rosybrown", 0xBC8F8F, "royalblue", 0x4169E1, "saddlebrown", 0x8B4513,
- "salmon", 0xFA8072, "sandybrown", 0xF4A460, "seagreen", 0x2E8B57, "seashell", 0xFFF5EE,
- "sienna", 0xA0522D, "silver", 0xC0C0C0, "skyblue", 0x87CEEB, "slateblue", 0x6A5ACD,
- "slategray", 0x708090, "snow", 0xFFFAFA, "springgreen", 0x00FF7F, "steelblue", 0x4682B4,
- "tan", 0xD2B48C, "teal", 0x008080, "thistle", 0xD8BFD8, "tomato", 0xFF6347,
- "turquoise", 0x40E0D0, "violet", 0xEE82EE, "wheat", 0xF5DEB3, "white", 0xFFFFFF,
- "whitesmoke", 0xF5F5F5, "yellow", 0xFFFF00, "yellowgreen", 0x9ACD32, 0};
-
-dword GetColor(char* color_str)
-{
- int ii;
- dword textlen=0;
- dword color=0;
-
- strlwr(color_str);
- if (ESBYTE[color_str] == '#') {
- color_str++;
- } else {
- for (ii=0; web_colors[ii].name!=0; ii++)
- {
- if (streq(color_str, web_colors[ii].name)) return web_colors[ii].rgb;
- }
- }
-
- textlen = strlen(color_str);
- if (textlen==6) || (textlen==3)
- {
- FOR (ii=0; ii='0') && (BL<='9')) BL -= '0';
- //IF ((BL>='A') && (BL<='F')) BL -= 'A'-10;
- IF ((BL>='a') && (BL<='f')) BL -= 'a'-10;
- color = color*0x10 + BL;
- if (textlen==3) color = color*0x10 + BL; //#abc ->> #aabbcc
- }
- return color;
- }
- return text_colors.get(0);
-}
diff --git a/browser/TWB/links.h b/browser/TWB/links.h
deleted file mode 100644
index 21b4d2b..0000000
--- a/browser/TWB/links.h
+++ /dev/null
@@ -1,113 +0,0 @@
-CustomCursor CursorPointer;
-dword CursorFile = FROM "TWB/pointer.cur";
-#include "..\lib\collection.h"
-
-struct PAGE_LINKS {
- collection unic_links;
- collection element_links;
-
- collection_int x;
- collection_int y;
- collection_int w;
- collection_int h;
- collection_int id;
- collection_int underline_h;
-
- signed int active;
- dword active_url;
- bool hover();
- void add_link();
- void add_text();
- void clear();
- void draw_underline();
-} links;
-
-void PAGE_LINKS::add_link(dword lpath)
-{
- unic_links.add(lpath);
-}
-
-void PAGE_LINKS::add_text(dword _x, _y, _w, _h, _underline_h)
-{
- x.add(_x);
- y.add(_y);
- w.add(_w);
- h.add(_h);
- underline_h.add(_underline_h);
- element_links.add(unic_links.get_last());
- id.add(unic_links.count);
-}
-
-void PAGE_LINKS::clear()
-{
- x.drop();
- y.drop();
- w.drop();
- h.drop();
- underline_h.drop();
- id.drop();
-
- element_links.drop();
- unic_links.drop();
-
- active = -1;
- active_url = 0;
- CursorPointer.Restore();
-}
-
-void PAGE_LINKS::draw_underline(signed _id, dword list_first, list_y, color)
-{
- int i;
- if (_id == -1) return;
- for (i=0; i list_y) {
- DrawBar(x.get(i), y.get(i) + h.get(i) - list_first,
- w.get(i), underline_h.get(i), color);
- }
- }
-}
-
-bool PAGE_LINKS::hover(dword list_y, list_first)
-{
- int i;
- int mx = mouse.x;
- int my = mouse.y + list_first;
- if (!id.count) return false;
-
- //Here we check is any link hovered
- for (i=0; ix.get(i)) && (my>y.get(i))
- && (mxlist_y+list_first)
- {
- if (active!=i) {
- CursorPointer.Load(#CursorFile);
- CursorPointer.Set();
-
- draw_underline(active, list_first, list_y, link_color_default);
- draw_underline(i, list_first, list_y, DEFAULT_BG_COL);
-
- active_url = element_links.get(i);
- active = i;
- DrawStatusBar(active_url);
- }
- if (mouse.lkm) && (mouse.down) {
- DrawRectangle(x.get(active), -list_first + y.get(active),
- w.get(active), h.get(active), 0);
- }
- return true;
- }
- }
- if (active_url) {
- CursorPointer.Restore();
- draw_underline(active, list_first, list_y, link_color_default);
- active_url = 0;
- active = -1;
- DrawStatusBar(NULL);
- }
- return false;
-}
-
diff --git a/browser/TWB/parse_tag.h b/browser/TWB/parse_tag.h
deleted file mode 100644
index 1efb575..0000000
--- a/browser/TWB/parse_tag.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
-struct _DOM {
- collection tag;
- collection tagparam;
- collection_int parent;
-} dom;
-*/
-
-struct _tag
-{
- char name[32];
- char prior[32];
- bool opened;
- collection attributes;
- collection values;
- dword value;
- dword number;
- bool is();
- bool parse();
- dword get_next_param();
- dword get_value_of();
- signed get_number_of();
-} tag=0;
-
-bool _tag::is(dword _text)
-{
- return streq(#name, _text);
-}
-
-bool _tag::parse(dword _bufpos, bufend)
-{
- bool retok = true;
- dword bufpos = ESDWORD[_bufpos];
- dword params, paramsend;
-
- dword closepos;
- dword whitepos;
- dword openpos;
-
- if (name) strcpy(#prior, #name); else prior = '\0';
- name = '\0';
- attributes.drop();
- values.drop();
-
- if (!strncmp(bufpos,"!--",3))
- {
- bufpos+=3;
- //STRSTR
- while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufend)
- {
- bufpos++;
- }
- bufpos+=2;
- retok = false;
- goto _RET;
- }
-
- if (ESBYTE[bufpos] == '/') {
- opened = false;
- bufpos++;
- } else {
- opened = true;
- }
-
- closepos = strchr(bufpos, '>');
- whitepos = strchrw(bufpos, bufend-bufpos);
-
- if (!whitepos) || (whitepos > closepos) {
- //no param
- strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name)-1));
- bufpos = closepos;
- } else {
- //we have param
- while (chrlnum(whitepos, '\"', closepos - whitepos)%2) { //alt="Next>>"
- if (!openpos = strchr(closepos+1, '<')) break;
- if (openpos < strchr(closepos+1, '>')) break;
- if (!closepos = EAX) {closepos = bufend;break;}
- }
- strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name)-1));
- bufpos = closepos;
-
- params = malloc(closepos - whitepos + 1);
- strncpy(params, whitepos, closepos - whitepos);
- paramsend = params + closepos - whitepos;
- while (paramsend = get_next_param(params, paramsend-1));
- free(params);
- }
-
- if (name) {
- strlwr(#name);
- // ignore text inside the next tags
- if (is("script")) || (is("style")) || (is("binary")) || (is("select")) {
- strcpy(#prior, #name);
- sprintf(#name, "%s>", #prior);
- if (strstri(bufpos, #name)) bufpos = EAX-1;
- retok = false;
- } else {
- if (name[strlen(#name)-1]=='/') name[strlen(#name)-1]=NULL; //for
- }
- } else {
- retok = false;
- }
-
-_RET:
- ESDWORD[_bufpos] = bufpos;
- return retok;
-}
-
-dword _tag::get_next_param(dword ps, pe)
-{
- // "ps" - param start
- // "pe" - param end
- // "q" - quote char
- char q = NULL;
- dword initial_pe = pe;
- dword fixeq;
- dword val;
- dword attr;
-
- if (ESBYTE[pe] == '/') pe--;
- while (pe>ps) && (__isWhite(ESBYTE[pe])) pe--;
-
- if (ESBYTE[pe] == '"') || (ESBYTE[pe] == '\'')
- {
- //remove quote
- q = ESBYTE[pe];
- ESBYTE[pe] = '\0';
- pe--;
-
- //find VAL start and copy
- pe = strrchr(ps, q) + ps;
- val = pe;
- if (pe>ps) pe--;
- ESBYTE[pe] = '\0';
-
- //find ATTR end
- while (pe > ps) && (ESBYTE[pe] != '=') pe--;
- ESBYTE[pe] = '\0';
- }
- else
- {
- //find VAL start and copy
- while (pe > ps) && (ESBYTE[pe] != '=') pe--;
- val = pe+1;
- ESBYTE[pe] = '\0';
- //already have ATTR end
- }
-
- if (pe > ps) pe--;
-
- //Fix case: "src ="
- while (pe>ps) && (__isWhite(ESBYTE[pe])) {
- ESBYTE[pe] = '\0';
- pe--;
- }
-
- //find ATTR start and copy
- while (pe>ps) && (!__isWhite(ESBYTE[pe])) pe--;
- attr = pe + 1;
- ESBYTE[pe] = '\0';
-
- // Fix case: src=./images/logo?sid=e8ece8b38b
- // Exchange '=' and '\0' position.
- // attr: src=./images/logo?sid => src
- // val: e8ece8b38b => ./images/logo?sid=e8ece8b38b
- fixeq = strchr(attr,'=');
- if (!q) && (fixeq) {
- ESBYTE[val-1] >< ESBYTE[fixeq];
- val = fixeq+1;
- }
- strlwr(attr);
- strrtrim(val);
- //Fix case: " img.png"
- while(__isWhite(ESBYTE[val])) && (val draw_w + BODY_MARGIN) {
- debugln("anomaly");
- debugln(_line);
- }
-
- if (debug_mode) {
- canvas.DrawBar(draw_x, draw_y, pw, list.item_h, 0xCCCccc);
- debugln(_line);
- }
-
- style.cur_line_h = math.max(style.cur_line_h, list.item_h);
-
- if (!secondrun) goto _SKIP_DRAW;
- if (bg_colors.get_last() - bg_colors.get(0)) {
- canvas.DrawBar(draw_x, draw_y, pw, list.item_h, bg_colors.get_last());
- }
-
- if (style.image) {
- canvas.DrawBar(draw_x, draw_y, pw, list.item_h-1, 0xF9DBCB);
- }
- if (style.button) {
- canvas.DrawBar(draw_x, draw_y, pw, list.item_h - calc(zoom*2), 0xCCCccc);
- canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2), pw, zoom, 0x999999);
- }
-
- pc = text_colors.get_last();
- if (link) && (pc == text_colors.get(0)) pc = link_color_default;
-
- canvas.WriteText(draw_x, draw_y+1, list.font_type, pc, _line, NULL);
- if (style.b) canvas.WriteText(draw_x+1, draw_y+1, list.font_type, pc, _line, NULL);
- if (style.s) canvas.DrawBar(draw_x, list.item_h / 2 - zoom + draw_y, pw, zoom, pc);
- if (style.u) canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, pc);
- if (link) {
- if (ESBYTE[_line]==' ') && (ESBYTE[_line+1]==NULL) {} else {
- canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, link_color_default);
- links.add_text(draw_x, draw_y + list.y, pw, list.font_h, zoom);
- }
- }
- _SKIP_DRAW:
- draw_x += pw;
- }
- ESBYTE[_line] = NULL;
-}
-
-void TWebBrowser::RenderTextbuf()
-{
- dword lbp = #linebuf;
- int br; //break position
- char nul = '\0';
- unsigned int len;
-
- //Do we need a line break?
-
- if (!linebuf[0]) return;
-
- while (len = strlen(lbp)) && (len * list.font_w + draw_x - left_gap >= draw_w) {
- //Yes, we do. Lets calculate where...
- br = len;
-
- //Is a new line fits in the maximum line width?
- if (br * list.font_w + draw_x - left_gap >= draw_w) {
- br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
- if (br < 0) br = 0;
- while(br) {
- if (ESBYTE[lbp + br]==' ') || (ESBYTE[lbp + br]=='-') {
- if (br < len) br++;
- break;
- }
- br--;
- }
- }
- //Maybe a new line is too big for the whole new line? Then we have to split it
- if (!br) && (len * list.font_w >= draw_w) {
- br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
- if (br < 0) {
- NewLine();
- br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
- }
- }
-
- if (br) {
- ESBYTE[lbp + br] >< nul;
- RenderLine(lbp);
- ESBYTE[lbp + br] >< nul;
- lbp += br;
- while (ESBYTE[lbp]==' ') && (ESBYTE[lbp]) lbp++;
- if (ESBYTE[lbp]) NewLine();
- } else {
- NewLine();
- }
- }
- RenderLine(lbp);
-}
-
-void TWebBrowser::NewLine()
-{
- static bool empty_line = true;
-
- if (draw_x==left_gap) && (draw_y==BODY_MARGIN) return;
- if (t_html) && (!t_body) return;
-
- if (draw_x == style.tag_list.level * 5 * list.font_w + left_gap) {
- if (!empty_line) {
- empty_line=true;
- } else {
- return;
- }
- } else {
- empty_line = false;
- }
-
- draw_y += style.cur_line_h;
- style.cur_line_h = list.item_h;
- if (style.blq) draw_x = 6 * list.font_w; else draw_x = 0; //left_gap += style.tag_list.level * 5 * list.font_w ???
- draw_x += style.tag_list.level * 5 * list.font_w + left_gap;
-}
-
-bool TWebBrowser::RenderImage(dword cur_img)
-{
- int img_x, img_y, img_w, img_h;
- dword imgbuf[44];
-
- if (!cur_img) || (!buf_data) return false;
-
- img_h = ESDWORD[cur_img+8];
- img_w = ESDWORD[cur_img+4];
-
- if (img_w + draw_x - left_gap >= draw_w) NewLine();
- img_y = draw_y;
- if (img_h < list.item_h) img_y += list.item_h - img_h / 2 - 1; else img_y -= 2;
- style.cur_line_h = math.max(style.cur_line_h, img_h);
-
- img_w = math.min(img_w, canvas.bufw - draw_x);
-
- if (link) links.add_text(draw_x + list.x, img_y + list.y, img_w, img_h, 0);
-
- if (img_y + img_h >= canvas.bufh) canvas.IncreaseBufSize();
-
- if (secondrun)
- {
- if (ESDWORD[cur_img+20] != IMAGE_BPP32) {
- img_convert stdcall(cur_img, 0, IMAGE_BPP32, 0, 0);
- $push eax
- img_destroy stdcall(cur_img);
- $pop eax
- cur_img = EAX;
- if (!EAX) return false;
- }
- imgbuf[04] = canvas.bufw;
- imgbuf[08] = canvas.bufh;
- imgbuf[20] = IMAGE_BPP32;
- imgbuf[24] = buf_data+8;
- img_blend stdcall(#imgbuf, cur_img, draw_x, img_y, 0, 0, img_w, img_h);
- img_destroy stdcall(cur_img);
- }
-
- draw_x += img_w;
- if (draw_x - left_gap >= draw_w) NewLine();
- return true;
-}
\ No newline at end of file
diff --git a/browser/TWB/set_style.h b/browser/TWB/set_style.h
deleted file mode 100644
index d34b4b5..0000000
--- a/browser/TWB/set_style.h
+++ /dev/null
@@ -1,513 +0,0 @@
-void TWebBrowser::SetStyle()
-{
- if (tag.get_value_of("name")) || (tag.get_value_of("id")) {
- anchors.add(tag.value, draw_y);
- if (anchors.current) && (streq(tag.value, #anchors.current+1)) {
- list.first = draw_y;
- anchors.current = NULL;
- }
- }
- if (tag.is("a")) { tag_a(); return; }
- if (tag.is("p")) { tag_p(); return; }
- if (tag.is("img")) { tag_img(); return; }
- if (tag.is("kosicon")) { tag_kosicon(); return; }
- if (tag.is("div")) { tag_div(); return; }
- if (tag.is("br")) { /*draw_x++;*/NewLine(); return; }
- if (tag.is("nav")) { style.nav = tag.opened; return; }
- if (tag.is("header")) { NewLine(); return; }
- if (tag.is("article")) { NewLine(); return; }
- if (tag.is("footer")) { NewLine(); return; }
- if (tag.is("figure")) { NewLine(); return; }
- if (tag.is("w:p")) { NewLine(); return; }
- if (tag.is("b")) { style.b = tag.opened; return; }
- if (tag.is("strong")) { style.b = tag.opened; return; }
- if (tag.is("big")) { style.b = tag.opened; return; }
- if (tag.is("w:b")) { style.b = tag.opened; return; }
- if (tag.is("u")) { style.u = tag.opened; return; }
- if (tag.is("ins")) { style.u = tag.opened; return; }
- if (tag.is("s")) { style.s = tag.opened; return; }
- if (tag.is("strike")) { style.s = tag.opened; return; }
- if (tag.is("del")) { style.s = tag.opened; return; }
- if (tag.is("pre")) { style.pre = tag.opened; return; }
- if (tag.is("blockquote")) { style.blq = tag.opened; return; }
- if (tag.is("button")) { style.button = tag.opened; return; }
- if (tag.is("dl")) { if (tag.opened) NewLine(); return; }
- if (tag.is("w:r")) { if (!tag.opened) style.b = false; return; }
- if (tag.is("h1")) { tag_h1234_caption(); return; }
- if (tag.is("h2")) { tag_h1234_caption(); return; }
- if (tag.is("h3")) { tag_h1234_caption(); return; }
- if (tag.is("h4")) { tag_h1234_caption(); return; }
- if (tag.is("font")) { tag_font(); return; }
- if (tag.is("dt")) { tag_ol_ul_dt(); return; }
- if (tag.is("dd")) { tag_ol_ul_dt(); return; }
- if (tag.is("ul")) { tag_ol_ul_dt(); return; }
- if (tag.is("ol")) { tag_ol_ul_dt(); return; }
- if (tag.is("li")) { tag_li(); return; }
- if (tag.is("q")) { tag_q(); return; }
- if (tag.is("hr")) { tag_hr(); return; }
- if (tag.is("meta")) { tag_meta_xml(); return; }
- if (tag.is("?xml")) { tag_meta_xml(); return; }
- if (tag.is("code")) { tag_code(); return; }
- if (tag.is("iframe")) { tag_iframe(); return; }
- if (tag.is("caption")) { tag_h1234_caption(); return; }
- if (tag.is("title")) { tag_title(); return; }
- if (tag.is("body")) { tag_body(); return; }
- if (tag.is("html")) { t_html = tag.opened; return; }
- if (tag.is("table")) { tag_table(); return; }
- if (tag.is("tr")) { tag_table(); return; }
- if (tag.is("th")) { tag_table(); return; }
- if (tag.is("td")) { tag_table(); return; }
-}
-
-void TWebBrowser::tag_p()
-{
- IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) return;
- IF (!tag.opened) && (streq(#tag.prior,"p")) return;
- NewLine();
-}
-
-void TWebBrowser::tag_title()
-{
- style.title = tag.opened;
- if (!tag.opened) DrawTitle(#header);
-}
-
-void TWebBrowser::tag_font()
-{
- style.font = tag.opened;
- if (tag.opened)
- {
- if (tag.get_value_of("bg")) {
- bg_colors.add(GetColor(tag.value));
- } else {
- bg_colors.add(bg_colors.get_last());
- }
- if (tag.get_value_of("color")) {
- text_colors.add(GetColor(tag.value));
- } else {
- text_colors.add(text_colors.get_last());
- }
- }
- else {
- if (text_colors.count>1) text_colors.pop();
- if (bg_colors.count>1) bg_colors.pop(); //never pop the last color
- }
-}
-
-void TWebBrowser::tag_div()
-{
- //if (streq(#tag.prior,"div")) && (tag.opened) return;
- if (streq(#tag.prior,"td")) return;
- if (streq(#tag.prior,"div")) return;
- if (!tag.opened) && (style.font) text_colors.pop();
- NewLine();
-}
-
-void TWebBrowser::tag_iframe()
-{
- if (tag.get_value_of("src")) {
- NewLine();
- strcpy(#linebuf, "IFRAME: ");
- RenderTextbuf();
- link=true;
- links.add_link(tag.value);
- strncpy(#linebuf, tag.value, sizeof(TWebBrowser.linebuf)-1);
- RenderTextbuf();
- link=false;
- NewLine();
- }
-}
-
-void TWebBrowser::tag_a()
-{
- if (!secondrun) return;
- if (tag.opened)
- {
- if (tag.get_value_of("href")) && (!strstr(tag.value,"javascript:"))
- {
- link = true;
- links.add_link(tag.value);
- }
- } else {
- link = false;
- }
-}
-
-void TWebBrowser::tag_meta_xml()
-{
- if (secondrun) return;
- if (custom_encoding == -1) if (tag.get_value_of("charset"))
- || (tag.get_value_of("content")) || (tag.get_value_of("encoding"))
- {
- EDX = strrchr(tag.value, '=') + tag.value; //search in content=
- if (ESBYTE[EDX] == '"') EDX++;
- strlwr(EDX);
- EAX = get_encoding_type_by_name(EDX);
- if (EAX!=-1) ChangeEncoding(EAX);
- }
- if (streq(tag.get_value_of("http-equiv"), "refresh")) && (tag.get_value_of("content")) {
- if (tag.value = strstri(tag.value, "url")) strcpy(#redirect, tag.value);
- }
-}
-
-signed int get_encoding_type_by_name(dword name)
-{
- EDX = name;
- if (streqrp(EDX,"utf-8")) || (streqrp(EDX,"utf8")) return CH_UTF8;
- else if (streqrp(EDX,"windows-1251")) || (streqrp(EDX,"windows1251")) return CH_CP1251;
- else if (streqrp(EDX,"dos")) || (streqrp(EDX,"cp-866")) return CH_CP866;
- else if (streqrp(EDX,"iso-8859-5")) || (streqrp(EDX,"iso8859-5")) return CH_ISO8859_5;
- else if (streqrp(EDX,"koi8-r")) || (streqrp(EDX,"koi8-u")) return CH_KOI8;
- return -1;
-}
-
-void TWebBrowser::tag_code()
-{
- if (style.pre = tag.opened) {
- bg_colors.add(0xe4ffcb);
- } else {
- if (bg_colors.count>1) bg_colors.pop(); //never pop the last color
- }
-}
-
-void TWebBrowser::tag_ol_ul_dt()
-{
- char type = ESBYTE[#tag.name];
- switch(type)
- {
- case 'd':
- if (ESBYTE[#tag.name+1]=='d') style.tag_list.upd_level(tag.opened, type);
- if (ESBYTE[#tag.name+1]=='t') style.tag_list.upd_level(false, 'd');
- if (tag.opened) NewLine();
- break;
- case 'u':
- case 'o':
- if (style.nav) && (style.tag_list.level) NewLine();
- style.tag_list.upd_level(tag.opened, type);
- if (!tag.opened) && (!style.pre) NewLine();
- }
-}
-
-void TWebBrowser::tag_li()
-{
- if (style.nav) {
- chrncat(#linebuf, ' ', sizeof(TWebBrowser.linebuf));
- } else if (tag.opened) {
- if (!style.tag_list.level) style.tag_list.upd_level(1, 'u');
- if (!style.pre) NewLine();
- if (style.tag_list.order_type() == 'u') {
- strcpy(#linebuf, "\31 ");
- draw_x = style.tag_list.level * 5 - 2 * list.font_w + left_gap;
- }
- if (style.tag_list.order_type() == 'o') {
- sprintf(#linebuf, "%i. ", style.tag_list.inc_counter());
- draw_x = style.tag_list.level * 5 - 1 - strlen(#linebuf) * list.font_w + left_gap;
- }
- }
-}
-
-void TWebBrowser::tag_hr()
-{
- dword hrcol = 0x00777777;
- dword hr_width = draw_w-BODY_MARGIN-BODY_MARGIN;
- dword hr_size = 1;
- if (tag.get_value_of("color")) {
- hrcol = GetColor(tag.value);
- }
- if (tag.get_value_of("width")) && (!strchr(tag.value, '%')) {
- hr_width = math.min(hr_width, tag.get_number_of("width"));
- }
- if (tag.get_number_of("size")) {
- hr_size = math.min(500, tag.number);
- }
- if (draw_x != left_gap) NewLine();
- if (secondrun) canvas.DrawBar(left_gap, style.cur_line_h / 2 + draw_y - 1, hr_width, hr_size, hrcol);
- draw_y += hr_size - 3;
- draw_x++;
- NewLine();
- return;
-}
-
-void TWebBrowser::tag_body()
-{
- t_body = tag.opened;
- if (tag.get_value_of("link")) link_color_default = GetColor(tag.value);
- if (tag.get_value_of("alink")) link_color_active = GetColor(tag.value);
- if (tag.get_value_of("text")) text_colors.set(0, GetColor(tag.value));
- if (tag.get_value_of("bgcolor")) bg_colors.set(0, GetColor(tag.value));
- // Autodetecting encoding if no encoding was set
- if (tag.opened) && (custom_encoding==-1) && (cur_encoding == CH_CP866) {
- if (strstr(bufpointer, "\208\190")) ChangeEncoding(CH_UTF8);
- else if (chrnum(bufpointer, '\246')>5) ChangeEncoding(CH_CP1251);
- }
-}
-
-void TWebBrowser::tag_q()
-{
- chrncat(#linebuf, '\"', sizeof(TWebBrowser.linebuf));
-}
-
-void TWebBrowser::reset_font_style()
-{
- list.SetFont(BASIC_CHAR_W, 14, 10011000b);
- style.cur_line_h = list.item_h = list.font_h + 5;
-}
-
-void TWebBrowser::tag_h1234_caption()
-{
- if (ESBYTE[#tag.name+1]=='4') {
- NewLine();
- NewLine();
- style.h = tag.opened;
- style.b = tag.opened;
- } else {
- style.h = tag.opened;
- if (tag.opened) {
- if (!style.pre) {
- NewLine();
- NewLine();
- }
- if (tag.is("h1")) {
- list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
- style.b = true;
- } else if (tag.is("h2")) {
- list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
- } else {
- list.SetFont(6*2, 9+8, 10001001b);
- }
- style.cur_line_h = list.item_h = list.font_h + 3;
- } else {
- if (tag.is("h1")) style.b = false;
- NewLine();
- reset_font_style();
- }
- }
-}
-
-void TWebBrowser::tag_kosicon()
-{
- dword imgbuf[44];
- dword maxicon;
- dword shared_i18 = memopen("ICONS18", NULL, SHM_READ);
- maxicon = EDX / 18 / 18 / 4;
- if (shared_i18) && (tag.get_number_of("n")) {
- if (tag.number < maxicon) {
- if (draw_x + 18 > canvas.bufw) NewLine();
- canvas.DrawImage(draw_x, draw_y-1, 18, 18, 18*18*4*tag.number+shared_i18);
- draw_x += 22;
- }
- }
-
-}
-
-void TWebBrowser::tag_img()
-{
- char img_path[4096]=0;
- dword base64img;
-
- if (!tag.get_value_of("data-large-image"))
- if (!tag.get_value_of("data-src"))
- if (!tag.get_value_of("src")) return;
-
- if (streqrp(tag.value, "data:")) {
- if (!strstr(tag.value, "base64,")) goto NOIMG;
- EDX = EAX+7;
- if (ESBYTE[EDX]==' ') EDX++;
- base64img = malloc(strlen(EDX));
- base64_decode stdcall (EDX, base64img, strlen(EDX));
- img_decode stdcall (base64img, EAX, 0);
- $push eax
- free(base64img);
- $pop eax
- if (EAX) goto IMGOK; else goto NOIMG;
- }
-
- if (!strcmp(tag.value + strrchr(tag.value, '.'), "svg")) goto NOIMG;
- if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG;
-
- strlcpy(#img_path, tag.value, sizeof(img_path)-1);
- replace_char(#img_path, ' ', '\0', sizeof(img_path)-1);
- get_absolute_url(#img_path, history.current());
-
- if (check_is_the_adress_local(#img_path)) {
- img_from_file stdcall(#img_path);
- if (EAX) goto IMGOK; else goto NOIMG;
- }
-
- if (cache.has(#img_path)) {
- img_decode stdcall (cache.current_buf, cache.current_size, 0);
- if (EAX) goto IMGOK; else goto NOIMG;
- } else {
- if (img_url.get_pos_by_name(#img_path)==-1) img_url.add(#img_path);
- goto NOIMG;
- }
-
-IMGOK:
- if (RenderImage(EAX)) return;
-
-NOIMG:
- if (tag.get_value_of("title")) || (tag.get_value_of("alt")) {
- strncpy(#img_path, tag.value, sizeof(TWebBrowser.linebuf)-3);
- sprintf(#linebuf, "[%s]", #img_path);
- } else {
- if (streqrp(#img_path, "data:")) img_path=0;
- replace_char(#img_path, '?', NULL, strlen(#img_path));
- img_path[sizeof(TWebBrowser.linebuf)-3] = '\0'; //prevent overflow in sprintf
- sprintf(#linebuf, "[%s]", #img_path+strrchr(#img_path, '/'));
- linebuf[50]= NULL;
- }
- text_colors.add(0x9A6F29);
- style.image = true;
- RenderTextbuf();
- style.image = false;
- text_colors.pop();
-}
-
-struct TABLE {
- int depth;
- int margin;
- collection_int cols;
-} table;
-
-unsigned table_id;
-unsigned colcount;
-unsigned tr_pos;
-unsigned td_pos;
-unsigned row_start_y;
-unsigned tallest_cell_in_row;
-unsigned cur_cell_w;
-
-void TWebBrowser::tag_table_reset()
-{
- table_id = 0;
- colcount = 0;
- tr_pos = 0;
- td_pos = 0;
- table.depth = 0;
- cur_cell_w = 0;
-}
-
-void TWebBrowser::tag_table()
-{
- if (!tag.opened) {
- if (style.font) tag_font();
- if (link) tag_a();
- style.b = false;
- }
- if (tag.is("table")) {
- if(tag.opened) {
- table.depth++;
- if (table.depth==1) {
- table_id++;
- colcount = 0;
- td_pos = 0;
- row_start_y = draw_y;
- if (tag.get_number_of("width")) {
- if (strchr(tag.value, '%')) tag.number = list.w * tag.number / 100;
- cur_cell_w = math.min(tag.number,list.w);
- } else {
- cur_cell_w = list.w;
- }
- }
- } else {
- if (table.depth>0) {
- table.depth--;
- }
- if (table.depth==0) {
- draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
- draw_w = list.w;
- if (td_pos) draw_y = math.max(draw_y, tallest_cell_in_row);
- draw_y = math.max(draw_y+style.cur_line_h, tallest_cell_in_row);
- row_start_y = tallest_cell_in_row = draw_y;
- style.cur_line_h = list.item_h;
- }
- }
- }
- if (table.depth>1) {
- if (tag.is("tr")) && (tag.opened) NewLine();
- return;
- }
-
- if (!secondrun) {
- if (tag.is("tr")) {
- if (tag.opened) {
- table.cols.add(1);
- }
- colcount = 0;
- }
- if (tag.opened) if (tag.is("td")) || (tag.is("th")) {
- if (!table.cols.count) { table.cols.add(1); colcount = 0;}
- colcount++;
- if (colcount) table.cols.set(table.cols.count-1, colcount);
- //if (tag.get_number_of("colspan")) colcount += tag.number-1;
- }
- } else {
- if (tag.is("tr")) {
- if (tag.opened) {
- if (td_pos) draw_y = math.max(draw_y, tallest_cell_in_row);
- _TR_FIX:
- if (draw_x==left_gap) && (draw_y==BODY_MARGIN) {
- row_start_y = tallest_cell_in_row = draw_y;
- } else {
- row_start_y = tallest_cell_in_row = draw_y = draw_y + style.cur_line_h;
- }
- style.cur_line_h = list.item_h;
- tr_pos++;
- td_pos = 0;
- } else {
- draw_y = math.max(draw_y, tallest_cell_in_row);
- td_pos = 0;
- }
- draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
- draw_w = list.w;
- }
- if (tag.is("td")) || (tag.is("th")) {
-
- if (!tr_pos) goto _TR_FIX;
-
- tallest_cell_in_row = math.max(draw_y+style.cur_line_h-list.item_h+1, tallest_cell_in_row);
- style.cur_line_h = list.item_h;
- if (tag.opened)
- {
- if (!td_pos) {
- table.margin = list.w - cur_cell_w / 2 + BODY_MARGIN;
- draw_x = left_gap = table.margin;
- draw_w = cur_cell_w - BODY_MARGIN;
- } else {
- draw_x = left_gap = left_gap + draw_w;
- draw_w = cur_cell_w - left_gap + table.margin - BODY_MARGIN;
- }
-
- if (EAX = table.cols.get(tr_pos-1)-td_pos) {
- draw_w /= EAX;
- } else {
- draw_y = row_start_y;
- draw_x = left_gap = table.margin;
- }
- if (table.cols.get(tr_pos-1)-td_pos>1) && (tag.get_number_of("width")) {
- if (strchr(tag.value, '%')) {
- tag.number = cur_cell_w * tag.number / 100; //
- }
- if (tag.number < list.w - table.margin - left_gap) draw_w = tag.number;
-
- }
- draw_y = row_start_y;
- td_pos++;
- }
- }
- }
- if (draw_x > cur_cell_w) {
- draw_x = left_gap = table.margin;
- draw_w = cur_cell_w - table.margin - 23 - left_gap;
- table.depth = 0;
- NewLine();
- if (debug_mode) {
- debugln("anomaly draw_x");
- canvas.DrawBar(0, draw_y, 20, 20, 0xFF0000);
- }
- }
- //if (left_gap + draw_w > list.w) {
- // draw_w = list.w - left_gap;
- // if (debug_mode) debugln("anomaly draw_W");
- //}
-}
\ No newline at end of file
diff --git a/browser/TWB/special.h b/browser/TWB/special.h
deleted file mode 100644
index 9dae661..0000000
--- a/browser/TWB/special.h
+++ /dev/null
@@ -1,117 +0,0 @@
-char *unicode_symbols[]={
-"quot","\"",
-"amp", "&",
-"lt", "<",
-"gt", ">",
-"#183","\31", "middot", "\31",
-"#149","-",
-"#151","-",
-"#160"," ", "nbsp", "\t", "emsp", " ",
-"#169","(c)", "copy", "(c)",
-"#171","<<", "laquo","<<",
-"#174","(r)", "reg", "(r)",
-"#187",">>", "raquo",">>",
-"hellip", "...",
-
-"trade", "[TM]",
-"bdquo", ",,",
-
-"minus", "-",
-"ndash", "-",
-"mdash", "-", //--
-
-"rsquo", "'", "apos", "'",
-"sect", "#",
-
-"ensp", " ",
-"emsp13", " ",
-"emsp14", " ",
-"numsp", " ",
-"puncsp", " ",
-"thinsp", " ",
-
-"#1028", "\242",
-"#1030", "I",
-"#1031", "\244",
-
-"#8211", "-",
-"#8212", "-",
-"#8217", "'",
-"#8220", "\"",
-"#8222", "\"", "ldquo", "\"",
-"#8221", "\"", "rdquo", "\"",
-"#8470", "N",
-"#8722", "-",
-"#9642", "-", //square in the middle of the line
-"#9658", ">",
-"#9660", "v",
-"#10094", "<",
-"#10095", ">",
-"#65122", "+",
-
-"#8594", "->",
-"#8627", "->",
-
-"uarr", "^",
-"darr", "v",
-"rarr", "->",
-"larr", "<-",
-
-"bull", "\31",
-"percnt","%",
-
-"#xfeff", "",
-
-"times", "x",
-"lowast","*",
-
-"#128154","<3",
-"#128545",":(",
-
-0};
-
-
-unsigned char unicode_chars[] = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяЁёhг\243i\105\244\0";
-
-bool GetUnicodeSymbol(dword _line, line_size, bufpos, buf_end)
-{
- int i;
- int code;
- char special_code[10];
- bool white_end = false;
- dword bufstart = bufpos;
-
- for (i=0; i<9; i++, bufpos++)
- {
- if (__isWhite(ESBYTE[bufpos])) {bufpos--; break;}
- if (ESBYTE[bufpos] == ';') || (bufpos >= buf_end) break;
- if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#", ESBYTE[bufpos])) {bufpos--; break;}
- special_code[i] = ESBYTE[bufpos];
- }
- special_code[i] = '\0';
-
- for (i=0; unicode_symbols[i]!=0; i+=2;)
- {
- if (!strcmp(#special_code, unicode_symbols[i]))
- {
- strncat(_line, unicode_symbols[i+1], line_size);
- return bufpos;
- }
- }
-
- if (special_code[0]=='#')
- {
- code = atoi(#special_code + 1);
- if (code>=0) && (code<=255) {
- chrncat(_line, code, line_size); //NOT ALL ASCII CODES IN KOLIBRI ARE COMPATABLE WITH STANDARDS
- return bufpos;
- }
- if (code>=1040) && (code<=1040+72) {
- chrncat(_line, unicode_chars[code-1040], line_size);
- return bufpos;
- }
- }
-
- chrncat(_line, '&', line_size);
- return bufstart;
-}
diff --git a/browser/TWB/tag_list.h b/browser/TWB/tag_list.h
deleted file mode 100644
index a8b3a00..0000000
--- a/browser/TWB/tag_list.h
+++ /dev/null
@@ -1,38 +0,0 @@
-struct LIST
-{
- int level;
- char ordered[5];
- int counter[5];
- void reset();
- void upd_level();
- int inc_counter();
- char order_type();
-};
-
-void LIST::reset()
-{
- level = 0;
-}
-
-void LIST::upd_level(int direction, char type)
-{
- if (direction == 1) && (level<5) {
- level++;
- counter[level] = 0;
- ordered[level] = type;
- }
- if (direction == 0) && (level>0) {
- level--;
- }
-}
-
-int LIST::inc_counter()
-{
- counter[level]++;
- return counter[level];
-}
-
-char LIST::order_type()
-{
- return ordered[level];
-}
diff --git a/browser/WebView.c b/browser/WebView.c
index 4e1641a..a0e3b11 100644
--- a/browser/WebView.c
+++ b/browser/WebView.c
@@ -11,7 +11,10 @@
// //
//===================================================//
-#define MEMSIZE 1024 * 160
+// code + data + globals take ~320 KB, the rest is the stack: keep ~90 KB of it for
+// the nested char[URL_SIZE+1] locals of @import and chains
+#define MEMSIZE 1024 * 416
+#define PAGE_FAR 0x3FFFFFFF // page_scroll() to an end of the page
#include "..\lib\gui.h"
#include "..\lib\draw_buf.h"
@@ -36,6 +39,7 @@
#include "const.h"
#include "cache.h"
+#include "cookies.h"
#include "show_src.h"
//===================================================//
@@ -43,30 +47,28 @@
// DATA //
// //
//===================================================//
-bool debug_mode = false;
bool show_images = true;
-bool source_mode = false;
+bool show_css = true; // false:
+
+
pinned right
+
header of the box
+
sidebar out of the flow, it must not push the main column down
+
main column, shifted right by a margin. It has to sit beside the sidebar and wrap inside its own 400 pixels.
+
this block is pulled up 30px by a negative top margin
+
file-one.zip8.21M
+
another-file-with-a-longer-name.rar640K
+
+text after the box, in the normal flow
+