From e3a51a20f1a35f91a53b243d3d7d79b9e1ae082a Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Fri, 27 Dec 2013 00:33:12 +0000 Subject: [PATCH] HTMLv code refactoring git-svn-id: svn://kolibrios.org@4413 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 147 +--- programs/cmm/browser/DrawBuf.h | 78 -- programs/cmm/browser/HTMLv.c | 160 +++- programs/cmm/browser/TWB.h | 773 -------------------- programs/cmm/{TWB => browser}/history.h | 0 programs/cmm/browser/include/acid_0.1.htm | 88 --- programs/cmm/browser/include/colors.h | 193 ----- programs/cmm/browser/include/history.h | 59 -- programs/cmm/browser/include/img_cache.h | 94 --- programs/cmm/browser/include/menu_rmb.h | 77 -- programs/cmm/browser/include/parce_tag.h | 38 - programs/cmm/browser/include/some_code.h | 34 - programs/cmm/browser/include/unicode_tags.h | 89 --- 13 files changed, 156 insertions(+), 1674 deletions(-) delete mode 100644 programs/cmm/browser/DrawBuf.h delete mode 100644 programs/cmm/browser/TWB.h rename programs/cmm/{TWB => browser}/history.h (100%) delete mode 100644 programs/cmm/browser/include/acid_0.1.htm delete mode 100644 programs/cmm/browser/include/colors.h delete mode 100644 programs/cmm/browser/include/history.h delete mode 100644 programs/cmm/browser/include/img_cache.h delete mode 100644 programs/cmm/browser/include/menu_rmb.h delete mode 100644 programs/cmm/browser/include/parce_tag.h delete mode 100644 programs/cmm/browser/include/some_code.h delete mode 100644 programs/cmm/browser/include/unicode_tags.h diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index ffc5f0ce16..3f7d68c085 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -1,3 +1,5 @@ +#include "..\lib\list_box.h" + int downloader_id; @@ -12,7 +14,7 @@ char search_path[]="http://nigma.ru/index.php?s="; struct TWebBrowser { int left, top, width, height, line_h; - void Scan(int); + llist list; void GetNewUrl(); void OpenPage(); void ReadHtml(byte); @@ -46,7 +48,6 @@ char line[500], options[4096], anchor[256]; -#include "..\TWB\history.h" #include "..\TWB\colors.h" #include "..\TWB\unicode_tags.h" #include "..\TWB\img_cache.h" @@ -90,148 +91,6 @@ void TWebBrowser::DrawPage() } //======================================================================= -void TWebBrowser::Scan(int id) -{ - if (id >= 400) - { - GetURLfromPageLinks(id); - - //#1 - if (URL[0] == '#') - { - strcpy(#anchor, #URL+strrchr(#URL, '#')); - - strcpy(#URL, BrowserHistory.CurrentUrl()); - - lines.first=lines.all-lines.visible; - ShowPage(); - return; - } - //liner.ru#1 - if (strrchr(#URL, '#')<>-1) - { - strcpy(#anchor, #URL+strrchr(#URL, '#')); - URL[strrchr(#URL, '#')-1] = 0x00; // - } - - GetNewUrl(); - - if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) - { - //if (strstr(#URL,"http:")) - RunProgram("/sys/media/kiv", #URL); - strcpy(#editURL, BrowserHistory.CurrentUrl()); - strcpy(#URL, BrowserHistory.CurrentUrl()); - return; - } - if (!strcmpn(#URL,"mailto:", 7)) - { - RunProgram("@notify", #URL); - strcpy(#editURL, BrowserHistory.CurrentUrl()); - strcpy(#URL, BrowserHistory.CurrentUrl()); - return; - } - - OpenPage(); - return; - } - - IF(lines.all < lines.visible) SWITCH(id) // - { CASE 183: CASE 184: CASE 180: CASE 181: return; } - - switch (id) - { - case 011: //Ctrk+K - ReadHtml(_KOI); - break; - case 021: //Ctrl+U - ReadHtml(_UTF); - break; - case 004: //Ctrl+D - ReadHtml(_DOS); - break; - case 002: //free img cache - FreeImgCache(); - break; - case BACK: - if (!BrowserHistory.GoBack()) return; - OpenPage(); - return; - case FORWARD: - if (!BrowserHistory.GoForward()) return; - OpenPage(); - return; - case 052: //F3 - if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); - return; - case 054: //F5 - IF(address_box.flags & 0b10) break; - case REFRESH: - if (GetProcessSlot(downloader_id)<>0) - { - KillProcess(downloader_id); - pause(20); - Draw_Window(); - return; - } - anchor_line_num=lines.first; // : - anchor[0]='|'; - OpenPage(); - return; - case 014: //Ctrl+N - case 020: //Ctrl+T - case NEWTAB: - MoveSize(190,80,OLD,OLD); - RunProgram(#program_path, #URL); - return; - - case HOME: - strcpy(#editURL, "http://kolibrios.org/en/index.htm"); - case GOTOURL: - case 0x0D: //enter - // ttp://? , . , . - //strstr() 0 0. . - if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0; - strcat(#URL, #editURL); - OpenPage(); - return; - case SEARCHWEB: - strcpy(#URL, #search_path); - strcat(#URL, #editURL); - OpenPage(); - return; - - case ID1: // - IF(lines.first <= 0) return; - lines.first--; - break; - case ID2: // - IF(lines.visible + lines.first >= lines.all) return; - lines.first++; - break; - case 183: //PgDown - IF(lines.first == lines.all - lines.visible) return; - lines.first += lines.visible + 2; - IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; - break; - case 184: //PgUp - IF(lines.first == 0) return; - lines.first -= lines.visible - 2; - IF(lines.first < 0) lines.first = 0; - break; - case 180: //home - IF(lines.first == 0) return; - lines.first = 0; - break; - case 181: //end - IF (lines.first == lines.all - lines.visible) return; - lines.first = lines.all - lines.visible; - break; - default: - return; - } - ParseHTML(buf); -} char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", 0}; diff --git a/programs/cmm/browser/DrawBuf.h b/programs/cmm/browser/DrawBuf.h deleted file mode 100644 index 9c8aaf08f3..0000000000 --- a/programs/cmm/browser/DrawBuf.h +++ /dev/null @@ -1,78 +0,0 @@ -dword drawbuf; -void DrawBufInit() -{ - free(drawbuf); - drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck - ESDWORD[drawbuf] = WB1.width; - ESDWORD[drawbuf+4] = WB1.line_h; -} -void DrawBufFill() -{ - int i; - for (i=0; iy+j*WB1.width+x+h-12*4 ; i-=4) - ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8]; - } -} - -void DrawBufAlignRight(dword x,y,w,h) -{ - int i, j, l; - int content_width = stolbec * 6; - int content_left = w - content_width / 2; - for (j=0; j=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4) - { - ESDWORD[drawbuf+8+i] >< ESDWORD[drawbuf+8+l]; - } - } -} - - -void DrawBufAlignCenter(dword x,y,w,h) -{ - int i, j, l; - int content_width = stolbec * 6; - int content_left = w - content_width / 2; - for (j=0; j=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4) - { - ESDWORD[drawbuf+8+i] >< ESDWORD[drawbuf+8+l]; - } - } -} - - -void TextGoDown(int left1, top1, width1) -{ - if (!stroka) DrawBar(WB1.left, WB1.top, WB1.width, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé - if (top1>=WB1.top) && ( top1 < WB1.height+WB1.top-10) && (!anchor) - { - if (text_align == ALIGN_CENTER) DrawBufAlignCenter(left1,top1,WB1.width,WB1.line_h); - if (text_align == ALIGN_RIGHT) DrawBufAlignRight(left1,top1,WB1.width,WB1.line_h); - PutPaletteImage(drawbuf+8, WB1.width, WB1.line_h, left1-5, top1, 32,0); - DrawBufFill(); - } - stroka++; - if (blq_text) stolbec = 8; else stolbec = 0; - if (li_text) stolbec = li_tab * 5; -} \ No newline at end of file diff --git a/programs/cmm/browser/HTMLv.c b/programs/cmm/browser/HTMLv.c index 1fd596b7b2..bc29dfae08 100644 --- a/programs/cmm/browser/HTMLv.c +++ b/programs/cmm/browser/HTMLv.c @@ -20,7 +20,6 @@ #include "..\lib\lib.obj\box_lib.h" #include "..\lib\lib.obj\libio_lib.h" #include "..\lib\lib.obj\libimg_lib.h" -#include "..\lib\list_box.h" //images #include "img\toolbar_icons.c" #include "img\URLgoto.txt"; @@ -60,6 +59,7 @@ mouse m; int action_buf; +#include "history.h" #include "..\TWB\TWB.c" #include "menu_rmb.h" @@ -123,16 +123,16 @@ void main() { if (lines.first==0) break; if (lines.first>3) lines.first-=2; ELSE lines.first=1; - WB1.Scan(ID1); + Scan(ID1); break; } if (m.vert==1) { - if(lines.visible+lines.first+3>=lines.all) WB1.Scan(181); + if(lines.visible+lines.first+3>=lines.all) Scan(181); else { lines.first+=2; - WB1.Scan(ID2); + Scan(ID2); } break; } @@ -165,7 +165,7 @@ void main() } ELSE { - WB1.Scan(btn); + Scan(btn); } break; case evKey: @@ -174,13 +174,13 @@ void main() if (address_box.flags & 0b10) SWITCH(key) // { CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; } - WB1.Scan(key); + Scan(key); _EDIT_MARK: if (key<>0x0d) && (key<>183) && (key<>184) {EAX=key<<8; edit_box_key stdcall(#address_box);} // break; case evReDraw: - if (action_buf) { WB1.Scan(action_buf); action_buf=0;} + if (action_buf) { Scan(action_buf); action_buf=0;} Draw_Window(); break; default: @@ -244,4 +244,150 @@ void Draw_Window() } +void Scan(int id) +{ + if (id >= 400) + { + GetURLfromPageLinks(id); + + //#1 + if (URL[0] == '#') + { + strcpy(#anchor, #URL+strrchr(#URL, '#')); + + strcpy(#URL, BrowserHistory.CurrentUrl()); + + lines.first=lines.all-lines.visible; + WB1.ShowPage(); + return; + } + //liner.ru#1 + if (strrchr(#URL, '#')<>-1) + { + strcpy(#anchor, #URL+strrchr(#URL, '#')); + URL[strrchr(#URL, '#')-1] = 0x00; // + } + + WB1.GetNewUrl(); + + if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) + { + //if (strstr(#URL,"http:")) + RunProgram("/sys/media/kiv", #URL); + strcpy(#editURL, BrowserHistory.CurrentUrl()); + strcpy(#URL, BrowserHistory.CurrentUrl()); + return; + } + if (!strcmpn(#URL,"mailto:", 7)) + { + RunProgram("@notify", #URL); + strcpy(#editURL, BrowserHistory.CurrentUrl()); + strcpy(#URL, BrowserHistory.CurrentUrl()); + return; + } + + WB1.OpenPage(); + return; + } + + IF(lines.all < lines.visible) SWITCH(id) // + { CASE 183: CASE 184: CASE 180: CASE 181: return; } + + switch (id) + { + case 011: //Ctrk+K + WB1.ReadHtml(_KOI); + break; + case 021: //Ctrl+U + WB1.ReadHtml(_UTF); + break; + case 004: //Ctrl+D + WB1.ReadHtml(_DOS); + break; + case 002: //free img cache + FreeImgCache(); + break; + case BACK: + if (!BrowserHistory.GoBack()) return; + WB1.OpenPage(); + return; + case FORWARD: + if (!BrowserHistory.GoForward()) return; + WB1.OpenPage(); + return; + case 052: //F3 + if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); + return; + case 054: //F5 + IF(address_box.flags & 0b10) break; + case REFRESH: + if (GetProcessSlot(downloader_id)<>0) + { + KillProcess(downloader_id); + pause(20); + Draw_Window(); + return; + } + anchor_line_num=lines.first; // : + anchor[0]='|'; + WB1.OpenPage(); + return; + case 014: //Ctrl+N + case 020: //Ctrl+T + case NEWTAB: + MoveSize(190,80,OLD,OLD); + RunProgram(#program_path, #URL); + return; + + case HOME: + strcpy(#editURL, "http://kolibrios.org/en/index.htm"); + case GOTOURL: + case 0x0D: //enter + // ttp://? , . , . + //strstr() 0 0. . + if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0; + strcat(#URL, #editURL); + WB1.OpenPage(); + return; + case SEARCHWEB: + strcpy(#URL, #search_path); + strcat(#URL, #editURL); + WB1.OpenPage(); + return; + + case ID1: // + IF(lines.first <= 0) return; + lines.first--; + break; + case ID2: // + IF(lines.visible + lines.first >= lines.all) return; + lines.first++; + break; + case 183: //PgDown + IF(lines.first == lines.all - lines.visible) return; + lines.first += lines.visible + 2; + IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; + break; + case 184: //PgUp + IF(lines.first == 0) return; + lines.first -= lines.visible - 2; + IF(lines.first < 0) lines.first = 0; + break; + case 180: //home + IF(lines.first == 0) return; + lines.first = 0; + break; + case 181: //end + IF (lines.first == lines.all - lines.visible) return; + lines.first = lines.all - lines.visible; + break; + default: + return; + } + WB1.ParseHTML(buf); +} + + + + stop: diff --git a/programs/cmm/browser/TWB.h b/programs/cmm/browser/TWB.h deleted file mode 100644 index c1c5b5429d..0000000000 --- a/programs/cmm/browser/TWB.h +++ /dev/null @@ -1,773 +0,0 @@ - -int downloader_id; - -dword - buf, - filesize, - blink; - -char download_path[]="/rd/1/.download"; -char search_path[]="http://nigma.ru/index.php?s="; - - -struct TWebBrowser { - int left, top, width, height, line_h; - void Scan(int); - void GetNewUrl(); - void OpenPage(); - void ReadHtml(byte); - void ShowPage(); - void ParseHTML(dword); - void WhatTextStyle(int left1, top1, width1); - void DrawPage(); - void DrawScroller(); -}; -TWebBrowser WB1; - -byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, - link, ignor_text, li_tab, cur_encoding, text_align; - -enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT}; - -dword text_colors[300], - text_color_index, - link_color, - bg_color; - -int stroka, - stolbec, - tab_len, - anchor_line_num; - -char line[500], - tag[100], - tagparam[10000], - parametr[1200], - options[4096], - anchor[256]; - -#include "include\history.h" -#include "include\colors.h" -#include "include\unicode_tags.h" -#include "include\img_cache.h" -#include "include\some_code.h" -#include "include\parce_tag.h" -#include "DrawBuf.h" - -//======================================================================= - - -void TWebBrowser::DrawPage() -{ - int start_x, start_y, line_length, magrin_left=5; - - if (!header) - { - strcpy(#header, #line); - strcat(#header, " -"); - strcat(#header, #version); - line = 0; - return; - } - - if (stroka >= 0) && (stroka - 2 < lines.visible) && (line) && (!anchor) - { - start_x = stolbec * 6 + left + magrin_left; - start_y = stroka * 10 + top + magrin_left; - line_length = strlen(#line) * 6; - - WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf); - IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf); - IF (i_text) DrawBufSkew(start_x, 0, line_length, line_h); - IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]); - IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]); - IF (link) { - UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9); - DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]); - } - stolbec += strlen(#line); - } -} -//======================================================================= - -void TWebBrowser::Scan(int id) -{ - if (id >= 400) - { - GetURLfromPageLinks(id); - - //#1 - if (URL[0] == '#') - { - strcpy(#anchor, #URL+strrchr(#URL, '#')); - - strcpy(#URL, BrowserHistory.CurrentUrl()); - - lines.first=lines.all-lines.visible; - ShowPage(); - return; - } - //liner.ru#1 - if (strrchr(#URL, '#')<>-1) - { - strcpy(#anchor, #URL+strrchr(#URL, '#')); - URL[strrchr(#URL, '#')-1] = 0x00; // - } - - GetNewUrl(); - - if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) - { - //if (strstr(#URL,"http:")) - RunProgram("/sys/media/kiv", #URL); - strcpy(#editURL, BrowserHistory.CurrentUrl()); - strcpy(#URL, BrowserHistory.CurrentUrl()); - return; - } - if (!strcmpn(#URL,"mailto:", 7)) - { - RunProgram("@notify", #URL); - strcpy(#editURL, BrowserHistory.CurrentUrl()); - strcpy(#URL, BrowserHistory.CurrentUrl()); - return; - } - - OpenPage(); - return; - } - - IF(lines.all < lines.visible) SWITCH(id) // - { CASE 183: CASE 184: CASE 180: CASE 181: return; } - - switch (id) - { - case 011: //Ctrk+K - ReadHtml(_KOI); - break; - case 021: //Ctrl+U - ReadHtml(_UTF); - break; - case 004: //Ctrl+D - ReadHtml(_DOS); - break; - case 002: //free img cache - FreeImgCache(); - break; - case BACK: - if (!BrowserHistory.GoBack()) return; - OpenPage(); - return; - case FORWARD: - if (!BrowserHistory.GoForward()) return; - OpenPage(); - return; - case 052: //F3 - if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); - return; - case 054: //F5 - IF(address_box.flags & 0b10) break; - case REFRESH: - if (GetProcessSlot(downloader_id)<>0) - { - KillProcess(downloader_id); - pause(20); - Draw_Window(); - return; - } - anchor_line_num=lines.first; // : - anchor[0]='|'; - OpenPage(); - return; - case 014: //Ctrl+N - case 020: //Ctrl+T - case NEWTAB: - MoveSize(190,80,OLD,OLD); - RunProgram(#program_path, #URL); - return; - - case HOME: - strcpy(#editURL, "http://kolibrios.org/en/index.htm"); - case GOTOURL: - case 0x0D: //enter - // ttp://? , . , . - //strstr() 0 0. . - if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0; - strcat(#URL, #editURL); - OpenPage(); - return; - case SEARCHWEB: - strcpy(#URL, #search_path); - strcat(#URL, #editURL); - OpenPage(); - return; - - case ID1: // - IF(lines.first <= 0) return; - lines.first--; - break; - case ID2: // - IF(lines.visible + lines.first >= lines.all) return; - lines.first++; - break; - case 183: //PgDown - IF(lines.first == lines.all - lines.visible) return; - lines.first += lines.visible + 2; - IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; - break; - case 184: //PgUp - IF(lines.first == 0) return; - lines.first -= lines.visible - 2; - IF(lines.first < 0) lines.first = 0; - break; - case 180: //home - IF(lines.first == 0) return; - lines.first = 0; - break; - case 181: //end - IF (lines.first == lines.all - lines.visible) return; - lines.first = lines.all - lines.visible; - break; - default: - return; - } - ParseHTML(buf); -} - - -char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", 0}; -//dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){ -void TWebBrowser::GetNewUrl(){ - int i, len; - - for (i=0; ABSOLUTE_LINKS[i]; i++) - { - len=strlen(ABSOLUTE_LINKS[i]); - if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return; - } - - IF (!strcmpn(#URL,"./", 2)) strcpy(#URL, #URL+2); // :) - strcpy(#editURL, BrowserHistory.CurrentUrl()); // - - if (URL[0] == '/') - { - i = strchr(#editURL+8, '/'); - editURL[i+7]=0; - strcpy(#URL, #URL+1); - } - - _CUT_ST_LEVEL_MARK: - - if (editURL[strrchr(#editURL, '/')-2]<>'/') // http:// - { - editURL[strrchr(#editURL, '/')] = 0x00; // / - } - - IF (!strcmp(get_URL_part(3),"../")) // - { - strcpy(#URL,#URL+3); - editURL[strrchr(#editURL, '/')-1] = 0x00; // / - goto _CUT_ST_LEVEL_MARK; - } - - if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/"); - - strcat(#editURL, #URL); // - strcpy(#URL, #editURL); -} - - - -void TWebBrowser::ReadHtml(byte encoding) -{ - if (!strcmp(get_URL_part(5),"http:"))) - file_size stdcall (#download_path); - else - file_size stdcall (#URL); - - filesize = EBX; - if (!filesize) return; - - mem_Free(buf); - buf = mem_Alloc(filesize); - if (!strcmp(get_URL_part(5),"http:"))) - ReadFile(0, filesize, buf, #download_path); - else - ReadFile(0, filesize, buf, #URL); - - cur_encoding = encoding; - if (encoding==_WIN) wintodos(buf); - if (encoding==_UTF) utf8rutodos(buf); - if (encoding==_KOI) koitodos(buf); -} - - -void TWebBrowser::OpenPage() -{ - if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal); - KillProcess(downloader_id); - strcpy(#editURL, #URL); - BrowserHistory.AddUrl(); - strcpy(#header, #version); - pre_text =0; - if (!strcmp(get_URL_part(5),"http:"))) - { - KillProcess(downloader_id); // - DeleteFile(#download_path); - IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL; - downloader_id = RunProgram("/sys/network/downloader", #URL); - //Browser Hack v2.0 - /* - pause(60); - if (GetProcessSlot(downloader_id)<>0) - { - debug("Browser Hack v2.0: Killing downloader and trying to run it one more!"); - KillProcess(downloader_id); // - downloader_id = RunProgram("/sys/network/downloader", #URL); - } - */ - IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable."); - Draw_Window(); - return; - } - lines.first = lines.all =0; - ReadHtml(_WIN); - WB1.ShowPage(); -} - - -void TWebBrowser::ShowPage() -{ - address_box.size = address_box.pos = strlen(#editURL); - address_box.offset=0; - edit_box_draw stdcall(#address_box); - - if (!filesize) - { - DrawBar(left, top, width+scroll1.size_x+1, height, 0xFFFFFF); //fill all - if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading..."); - else - { - WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors."); - if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration."); - } - //return; - } - else - ParseHTML(buf); - - if (!header) strcpy(#header, #version); - if (!strcmp(#version, #header)) DrawTitle(#header); -} - - - -void TWebBrowser::ParseHTML(dword bword){ - word bukva[2]; - int j, perenos_num; - byte ignor_param; - char temp[768]; - - if (blink<400) blink=400; else for ( ; blink>400; blink--;) DeleteButton(blink); - b_text = i_text = u_text = s_text = blq_text = - li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; // - text_align = ALIGN_LEFT; - link_color = 0x0000FF; - bg_color = 0xFFFFFF; - DrawBufFill(); - strcpy(#page_links,"|"); - strcpy(#header, #version); - stroka = -lines.first; - stolbec = 0; - line = 0; - - if (pre_text<>2) - { - pre_text=0; - if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; - if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; - } - - for ( ; buf+filesize > bword; bword++;) - { - bukva = ESBYTE[bword]; - if (ignor_text) && (bukva<>'<') continue; - switch (bukva) - { - case 0x0a: - if (pre_text) - { - bukva = temp = NULL; - goto NEXT_MARK; - } - case '\9': - if (pre_text) // 0x0d - { - tab_len=strlen(#line)/8; - tab_len=tab_len*8; - tab_len=8+tab_len-strlen(#line); - for (j=0; j';') && (j<7); j++, bword++;) - { - bukva = ESBYTE[bword]; - chrcat(#tag, bukva); - } - bukva = GetUnicodeSymbol(); - if (bukva) goto DEFAULT_MARK; - break; - case '<': - bword++; // < - tag = parametr = tagparam = ignor_param = NULL; - if (ESBYTE[bword] == '!') // , - { - bword++; - if (ESBYTE[bword] == '-') - { - HH_: - do - { - bword++; - if (buf + filesize <= bword) break 2; - } - while (ESBYTE[bword] <>'-'); - - bword++; - if (ESBYTE[bword] <>'-') goto HH_; - } - } - while (ESBYTE[bword] !='>') && (bword < buf + filesize) // - { - bukva = ESBYTE[bword]; - if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; - if (!ignor_param) && (bukva <>' ') - { - if (strlen(#tag) lines.column_max) //============the same as NEXT_MARK - { - perenos_num = strrchr(#line, ' '); - if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; - strcpy(#temp, #line + perenos_num); // - line[perenos_num] = 0x00; - if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //... - DrawPage(); - strcpy(#line, #temp); - TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); // - } - DrawPage(); - line=NULL; - - if (tag) WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); // - - tag = parametr = tagparam = ignor_param = NULL; - break; - default: - DEFAULT_MARK: - if (bukva<=15) bukva=' '; - if (!pre_text) && (bukva == ' ') - { - if (line[strlen(#line)-1]==' ') break; // 2 - if (!stolbec) && (!line) break; // - } - if (strlen(#line) lines.column_max) - { - NEXT_MARK: - perenos_num = strrchr(#line, ' '); - if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; - strcpy(#temp, #line + perenos_num); // - line[perenos_num] = 0x00; - if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //... - DrawPage(); - strcpy(#line, #temp); - TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); // - } - } - } - - DrawPage(); // , , - TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); // - - if (lines.visible * 10 + 25 <= height) - DrawBar(left, lines.visible * 10 + top + 25, width, -lines.visible * 10 + height - 25, bg_color); - if (stroka * 10 + 5 <= height) - DrawBar(left, stroka * 10 + top + 5, width, -stroka * 10 + height - 5, bg_color); // - if (lines.first == 0) lines.all = stroka; - if (anchor) // - - { - anchor=NULL; - lines.first=anchor_line_num; - ParseHTML(buf); - } - DrawScroller(); -} - - - -char oldtag[100]; -void TWebBrowser::WhatTextStyle(int left1, top1, width1) { - dword hr_color; - - // - if (tag[0] == '/') - { - rez = 0; - strcpy(#tag, #tag+1); - } - else rez = 1; - - if (!chTag("html")) - { - IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0; - return; - } - - if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez; - - if(!chTag("title")) - { - if (rez) header=NULL; - else if (!stroka) DrawTitle(#header); // - - return; - } - - if (ignor_text) return; - - - - IF(!chTag("q")) chrcat(#line, '\"'); - - if (anchor) && (!strcmp(#parametr, "id=")) // !!! , - { - if (!strcmp(#anchor, #options)) anchor_line_num=lines.first+stroka; - } - - if (!chTag("body")) - { - do{ - if (!strcmp(#parametr, "link=")) link_color = GetColor(#options); - if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); - if (!strcmp(#parametr, "bgcolor=")) - { - bg_color=GetColor(#options); - DrawBufFill(); - } - } while(GetNextParam()); - return; - } - - if (!chTag("a")) - { - if (rez) - { - if (link) IF(text_color_index > 0) text_color_index--; // - - do{ - if (!strcmp(#parametr, "href=")) - { - if (stroka - 1 > lines.visible) || (stroka < -2) return; - - text_color_index++; - text_colors[text_color_index] = text_colors[text_color_index-1]; - - link = 1; - blink++; - text_colors[text_color_index] = link_color; - strcat(#page_links, #options); - strcat(#page_links, "|"); - } - if (anchor) && (!strcmp(#parametr, "name=")) - { - if (!strcmp(#anchor, #options)) - { - anchor_line_num=lines.first+stroka; - } - } - } while(GetNextParam()); - } - else { - link = 0; - IF(text_color_index > 0) text_color_index--; - } - return; - } - - if (!chTag("font")) - { - if (rez) - { - text_color_index++; - text_colors[text_color_index] = text_colors[text_color_index-1]; - - do{ - if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') - { - text_colors[text_color_index] = GetColor(#options); - } - } while(GetNextParam()); - } - else - if (text_color_index > 0) text_color_index--; - return; - } - if(!chTag("tr")) || (!chTag("br")) { - TextGoDown(left1, top1, width1); - return; - } - if (!chTag("div")) { - IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1); - return; - } - if (!chTag("p")) { - IF(oldtag[0] == 'h') return; - TextGoDown(left1, top1, width1); - IF(rez) TextGoDown(left1, top1 + 10, width1); - return; - } - if (!chTag("center")) - { - if (rez) text_align = ALIGN_CENTER; - if (!rez) text_align = ALIGN_LEFT; - return; - } - if (!chTag("right")) - { - if (rez) text_align = ALIGN_RIGHT; - if (!rez) text_align = ALIGN_LEFT; - return; - } - if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) { - TextGoDown(left1, top1, width1); - IF(rez) TextGoDown(left1, top1 + 10, width1); - strcpy(#oldtag, #tag); - if (rez) - { - if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER; - if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT; - b_text = 1; - } - if (!rez) - { - text_align = ALIGN_LEFT; - b_text = 0; - } - return; - } - else - oldtag=NULL; - - if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) { - b_text = rez; - return; - } - if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) { - i_text = rez; - return; - } - if (!chTag("dt")) - { - li_text = rez; - IF(rez == 0) return; - TextGoDown(left1, top1, width1); - return; - } - if(!chTag("li")) || (!chTag("dt")) // - { - li_text = rez; - if (rez) - { - TextGoDown(left1, top1, width1); - if (stroka > -1) && (stroka - 2 < lines.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, line_h/2-3, 2, 2, 0x555555); - } - return; - } - if (!chTag("u")) || (!chTag("ins")) u_text = rez; - if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez; - if (!chTag("ul")) || (!chTag("ol")) IF(!rez) - { - li_text = rez; - li_tab--; - TextGoDown(left1, top1, width1); - } ELSE li_tab++; - if (!chTag("dd")) stolbec += 5; - if (!chTag("blockquote")) blq_text = rez; - if (!chTag("pre")) pre_text = rez; - if (!chTag("hr")) - { - if (anchor) || (stroka < -1) - { - stroka+=2; - return; - } - if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999; - TextGoDown(left1, top1, width1); - DrawBufBar(5, WB1.line_h/2, WB1.width-10, 1, hr_color); - TextGoDown(left1, top1+WB1.line_h, width1); - } - if (!chTag("img")) - { - Images( left1, top1, width1); - return; - } - if (!chTag("meta")) || (!chTag("?xml")) - { - do{ - if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding=")) - { - strcpy(#options, #options[strrchr(#options, '=')]); // content= - if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF); - if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI); - if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) ReadHtml(_DOS); - } - } while(GetNextParam()); - return; - } -} - - - -void TWebBrowser::DrawScroller() // , -{ - scroll1.max_area = lines.all; - scroll1.cur_area = lines.visible; - scroll1.position = lines.first; - - scroll1.all_redraw=1; - scroll1.start_x = WB1.left + WB1.width; - scroll1.size_y=WB1.height; - - scrollbar_v_draw(#scroll1); -} - diff --git a/programs/cmm/TWB/history.h b/programs/cmm/browser/history.h similarity index 100% rename from programs/cmm/TWB/history.h rename to programs/cmm/browser/history.h diff --git a/programs/cmm/browser/include/acid_0.1.htm b/programs/cmm/browser/include/acid_0.1.htm deleted file mode 100644 index 53d30e850b..0000000000 --- a/programs/cmm/browser/include/acid_0.1.htm +++ /dev/null @@ -1,88 +0,0 @@ - - - - - Acid 0.1 - - -

HTML Viewer

-
-

: -cp1251, koi-8, cp866, unicode.

-
- -C -r -e -a -t -e -d -b -y -L -e -e -n -c -y
-
- 2008-2013 - -

- :

    -
  1. -
  2. -
  3. -
  4. -
  5. -
-

-
- -
-
-!
-    !
-        !
-
-              .
-
-
-
- - -
-
- -
-
- -background - - - -./index.htm
- - index.htm
-
kernel.mnt
-#2.1.4
-http://bash.im
-Mail to leency
-
-
-
- -
- , - . . - . - : " & < > • -   © ® „ “ — . ' . -
- - - diff --git a/programs/cmm/browser/include/colors.h b/programs/cmm/browser/include/colors.h deleted file mode 100644 index 79ac17875e..0000000000 --- a/programs/cmm/browser/include/colors.h +++ /dev/null @@ -1,193 +0,0 @@ -// " " , - -// , - -struct color_spec { - char *name; - int rgb; -}; - -struct color_spec color_specs[] = { - "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, - "lightgoldenrodyellow", 0xFAFAD2, - "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 StrToCol(char* htmlcolor) -{ - dword j=1, - color=0, - textlen=0; - char ch=0x00; - - if (ESBYTE[htmlcolor]<>'#') return text_colors[0]; - - textlen = strlen(htmlcolor); - - if (textlen==7) || (textlen==4) - { - FOR (; j='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) -{ - int ii; - - if (ESBYTE[color_str] == '#') - return StrToCol(color_str); - else - for (ii=0; color_specs[ii].name!=0; ii++) - { - if (!strcmp(color_str, color_specs[ii].name)) return color_specs[ii].rgb; - } - - return text_colors[0]; -} diff --git a/programs/cmm/browser/include/history.h b/programs/cmm/browser/include/history.h deleted file mode 100644 index e8620ccaf2..0000000000 --- a/programs/cmm/browser/include/history.h +++ /dev/null @@ -1,59 +0,0 @@ -struct UrlsHistory { - dword CurrentUrl(); - void AddUrl(); - byte GoBack(); - byte GoForward(); -}; - -UrlsHistory BrowserHistory; - -struct path_string { -char Item[4096]; -}; - -#define MAX_HISTORY_NUM 40 -path_string history_list[MAX_HISTORY_NUM]; -int history_num; -int history_current; - -dword UrlsHistory::CurrentUrl() -{ - return #history_list[history_current].Item; -} - -void UrlsHistory::AddUrl() // - -{ - int i; - if (history_num>0) && (!strcmp(#URL,#history_list[history_current].Item)) return; - - if (history_current>=MAX_HISTORY_NUM-1) - { - history_current/=2; - for (i=0; i0; num_of_pics--) - { - if (pics[num_of_pics].image) img_destroy stdcall (pics[num_of_pics].image); - pics[num_of_pics].path = NULL; - } - notify(IMAGES_CACHE_CLEARED); -} - - -void Images(int left1, top1, width1) -{ - dword image; - char img_path[4096], alt[4096]; - int w=0, h=0, img_lines_first=0, cur_pic=0; - - do{ - if (!strcmp(#parametr,"src=")) // GetNewUrl() - { - if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item); - else strcpy(#img_path, BrowserHistory.CurrentUrl()); // - - if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0) - { - img_path[strrchr(#img_path, '/')] = '\0'; // / - strcat(#img_path, #options); - - cur_pic=GetOrSetPicNum(#img_path); - if (!pics[cur_pic].path) - { - pics[cur_pic].image=load_image(#img_path); - strcpy(#pics[cur_pic].path, #img_path); - } - } - } - if (!strcmp(#parametr,"alt=")) - { - strcpy(#alt, "["); - strcat(#alt, #options); - strcat(#alt, "]"); - } - - } while(GetNextParam()); - - if (!pics[cur_pic].image) - { - if (alt) && (link) strcat(#line, #alt); - return; - } - - w = DSWORD[pics[cur_pic].image+4]; - h = DSWORD[pics[cur_pic].image+8]; - if (w > width1) w = width1; - - if (stroka==0) DrawBar(WB1.left, WB1.top, WB1.width-15, 5, bg_color); // - stroka+=h/10; - if (top1+hWB1.top+WB1.height-10) return; // Ѩ - if (top1WB1.top+WB1.height-h-5) // - { - h=WB1.top+WB1.height-top1-5; - } - if (h<=0) return; - if (anchor) return; - - img_draw stdcall (pics[cur_pic].image, left1-5, top1, w, h,0,img_lines_first); - DrawBar(left1+w - 5, top1, WB1.width-w, h, bg_color); - IF (link) UnsafeDefineButton(left1 - 5, top1, w, h-1, blink + BT_HIDE, 0xB5BFC9); -} \ No newline at end of file diff --git a/programs/cmm/browser/include/menu_rmb.h b/programs/cmm/browser/include/menu_rmb.h deleted file mode 100644 index cf6e2da3b1..0000000000 --- a/programs/cmm/browser/include/menu_rmb.h +++ /dev/null @@ -1,77 +0,0 @@ -//Leency - 2012-2013 - -char *ITEMS_LIST[]={ -"WIN F5",54, -"DOS Ctrl+D",04, -"KOI Ctrl+K",11, -"UTF Ctrl+U",21, -#ifdef LANG_RUS -"室 ࠭ F3",52, -" ⨭" ,02, -#else -"View source F3",52, -"Free image cache" ,02, -#endif -0}; - -llist menu; -dword col_work = 0xE4DFE1; -dword col_border = 0x9098B0; - -void menu_rmb() -{ - mouse mm; - proc_info MenuForm; - int key; - - menu.first = menu.current = 0; - while (ITEMS_LIST[menu.count*2]) menu.count++; - menu.SetSizes(2,2,165,menu.count*19,0,19); - SetEventMask(100111b); - - loop() switch(WaitEvent()) - { - case evMouse: - GetProcessInfo(#MenuForm, SelfInfo); - if (!CheckActiveProcess(MenuForm.ID)) ExitProcess(); - - mm.get(); - if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList(); - if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); } - break; - - case evKey: - key = GetKey(); - if (key==27) ExitProcess(); - if (menu.ProcessKey(key)) DrawMenuList(); - if (key==13) - { - action_buf = ITEMS_LIST[menu.current*2+1]; - ExitProcess(); - } - break; - - case evReDraw: - DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF); - DrawPopup(0,0,menu.w,menu.h+3,0, col_work,col_border); - DrawMenuList(); - } -} - -void DrawMenuList() -{ - int N; - - for (N=0; N 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/'))) - { - IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i]; - tagparam[i] = 0x00; - i--; - } - - if (kavichki) - { - i=strrchr(#tagparam, kavichki); - strlcpy(#options, #tagparam + i, sizeof(options)); - } - else - { - WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1; - i++; - strlcpy(#options, #tagparam + i, sizeof(options)); - - WHILE (options[0] == ' ') strcpy(#options, #options+1); - } - tagparam[i] = 0x00; - - FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--) - { - IF (tagparam[i] == '=') // - tagparam[i + 1] = 0x00; - } - strlcpy(#parametr, #tagparam + i + 1, sizeof(parametr)); - tagparam[i] = 0x00; - return 1; -} \ No newline at end of file diff --git a/programs/cmm/browser/include/some_code.h b/programs/cmm/browser/include/some_code.h deleted file mode 100644 index aa252583b3..0000000000 --- a/programs/cmm/browser/include/some_code.h +++ /dev/null @@ -1,34 +0,0 @@ - -enum { BACK=300, FORWARD, REFRESH, HOME, NEWTAB, GOTOURL, SEARCHWEB, INPUT_CH, INPUT_BT }; -enum { _WIN, _DOS, _KOI, _UTF }; - -#define ID1 178 -#define ID2 177 - - - -dword get_URL_part(int len) { - char temp1[sizeof(URL)]; - strcpy(#temp1, #URL); - temp1[len] = 0x00; - return #temp1; -} - -inline byte chTag(dword text) {return strcmp(#tag,text);} - - -void GetURLfromPageLinks(int id) -{ - int i, j = 0; - for (i = 0; i <= id - 401; i++) - { - do - { - j++; - if (j>=strlen(#page_links)) return; - } - while (page_links[j] <>'|'); - } - page_links[j] = 0x00; - strcpy(#URL, #page_links+strrchr(#page_links, '|')); -} \ No newline at end of file diff --git a/programs/cmm/browser/include/unicode_tags.h b/programs/cmm/browser/include/unicode_tags.h deleted file mode 100644 index 73b8723cd1..0000000000 --- a/programs/cmm/browser/include/unicode_tags.h +++ /dev/null @@ -1,89 +0,0 @@ -char *unicode_tags[]={ -"nbsp", " ", -"#38", " ", -"#160", " ", - -"copy", "(c)", -"#169", "(c)", - -"trade", "[TM]", - -"reg", "(r)", -"#174", "(r)", - -"bdquo", ",,", - -"amp", "&", -"#38", "&", - -"lt", "<", -"#60", "<", - -"gt", ">", -"#62", ">", - -"minus", "-", -"ndash", "-", -"mdash", "-", //-- -"#8722", "-", -"#8211", "-", -"#151", "-", -"#149", "-", - -"rsquo", "'", -"#39", "'", -"#96", "'", -"#8217", "'", - -"quot", "\"", -"#34", "\"", -"ldquo", "\"", -"rdquo", "\"", -"#8222", "\"", -"#8221", "\"", - -"laquo", "<<", -"#171", "<<", -"raquo", ">>", -"#187", ">>", - -"uarr", "\24", -"darr", "\25", -"rarr", "\26", -"larr", "\27", - -"#1028", "\242", -"#1030", "I", -"#1031", "\244", - -"#8470", "N", -"bull", "-", // -"percnt","%", - -0}; - - -byte unicode_chars[] = "h\243i\105\244\0"; - -unsigned char GetUnicodeSymbol() -{ - int j; - - for (j=0; unicode_tags[j]!=0; j+=2;) - { - if (!strcmp(#tag, unicode_tags[j])) - { - strcat(#line, unicode_tags[j+1]); - return NULL; - } - } - - j = atoi(#tag + 1) - 1040; - if (tag[1] == '1') && (j>=0) && (j<=72) && (strlen(#tag) == 5) - { - return unicode_chars[j]; - } - - strcat(#line,#tag); // , - - return NULL; -}