From b29c5d9e539b13fb508cb0c3a79a7e8feed170c9 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Fri, 12 Apr 2013 16:34:24 +0000 Subject: [PATCH] HTMLv 0.99.01: fixes, speedup git-svn-id: svn://kolibrios.org@3468 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/HTMLv.c | 3 +- programs/cmm/browser/History.txt | 6 +++ programs/cmm/browser/TWB.h | 58 +++++++++++------------- programs/cmm/browser/include/img_cache.h | 6 +-- programs/cmm/browser/include/menu_rmb.h | 6 +-- 5 files changed, 39 insertions(+), 40 deletions(-) diff --git a/programs/cmm/browser/HTMLv.c b/programs/cmm/browser/HTMLv.c index 463dd9d19e..43ffc57bf0 100644 --- a/programs/cmm/browser/HTMLv.c +++ b/programs/cmm/browser/HTMLv.c @@ -61,7 +61,7 @@ void main() if (load_dll2(boxlib, #box_lib_init,0)!=0) {notify("System Error: library doesn't exists /rd/1/lib/box_lib.obj"); ExitProcess();} if (load_dll2(libio, #libio_init,1)!=0) debug("Error: library doesn't exists - libio"w); if (load_dll2(libimg, #libimg_init,1)!=0) debug("Error: library doesn't exists - libimg"w); - if (load_dll2(libtruetype, #truetype,0)!=0) {debug("Error: library doesn't exists - TrueType"w); use_truetype = 2; } + if (load_dll2(libtruetype, #truetype,0)!=0) {debug("Warning: library doesn't exists - TrueType"w); use_truetype = 2; } else init_font(#fontlol); if (!URL) strcpy(#URL, "/sys/home.htm"); @@ -181,6 +181,7 @@ void SetElementSizes() WB1.line_h = 10; lines.column_max = WB1.width - 30 / 6; lines.visible = WB1.height - 3 / WB1.line_h - 2; + DrawBufInit(); } diff --git a/programs/cmm/browser/History.txt b/programs/cmm/browser/History.txt index 30b231c5f1..45b8972278 100644 --- a/programs/cmm/browser/History.txt +++ b/programs/cmm/browser/History.txt @@ -1,3 +1,9 @@ +12.04.13 - 0.99.01 +- исправлено падение при очистке кэша изображений +- исправлена работа пункта меню "включить разрывы строк" +- ускорение при прокрутке страницы +- ускорение обработки quotted printable + 12.04.13 - 0.99 - отрисовка в буфер; - исправление ошибок и обновление кода. diff --git a/programs/cmm/browser/TWB.h b/programs/cmm/browser/TWB.h index 51ccf2af34..137b2cb8eb 100644 --- a/programs/cmm/browser/TWB.h +++ b/programs/cmm/browser/TWB.h @@ -8,7 +8,7 @@ dword char download_path[]="/rd/1/.download"; char search_path[]="http://nigma.ru/index.php?s="; -char version[]=" Text-based Browser 0.99"; +char version[]=" Text-based Browser 0.99.01"; struct TWebBrowser { @@ -60,7 +60,6 @@ void DrawBufInit() drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck ESDWORD[drawbuf] = WB1.width; ESDWORD[drawbuf+4] = WB1.line_h; - DrawBufFill(); } void DrawBufFill() { @@ -202,12 +201,12 @@ void TWebBrowser::Scan(int id) case 004: //Ctrl+D ReadHtml(_DOS); break; - case 001: - if (!pre_text) pre_text=2; - else pre_text=0; - break; case 002: //free img cache FreeImgCache(); + break; + case 003: + if (!pre_text) pre_text=2; + else pre_text=0; break; case 005: //truetype if (use_truetype == 2) @@ -225,9 +224,9 @@ void TWebBrowser::Scan(int id) if (!BrowserHistory.GoForward()) return; OpenPage(); return; - //case 255: //F12 - // RunProgram("/rd/1/HTMLv_old", #URL); - // return; + case 255: //F12 + RunProgram("/rd/1/HTMLv_old", #URL); + 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; @@ -426,20 +425,17 @@ void TWebBrowser::ParseHTML(dword bword){ byte ignor_param; char temp[768]; - stroka = -lines.first; - stolbec = 0; - - for (j = 400; j < blink + 1; j++;) DeleteButton(j); - blink = 400; - + 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; //обнуляем теги link_color = 0x0000FF; bg_color = 0xFFFFFF; + DrawBufFill(); line = NULL; strcpy(#page_links,"|"); strcpy(#header, #version); - DrawBufInit(); + stroka = -lines.first; + stolbec = 0; if (pre_text<>2) { @@ -466,24 +462,21 @@ void TWebBrowser::ParseHTML(dword bword){ tab_len=strlen(#line)/8; tab_len=tab_len*8; tab_len=8+tab_len-strlen(#line); - for (j=0; j0) goto DEFAULT_MARK; - bword++; - bukva=ESBYTE[bword]; - strcpy(#temp,#bukva); - bword++; - bukva=ESBYTE[bword]; - strcat(#temp,#bukva); - - bukva=Hex2Symb(#temp); - if (bukva) goto DEFAULT_MARK; + temp[0] = ESBYTE[bword+1]; + temp[1] = ESBYTE[bword+2]; + temp[2] = '\0'; + if (bukva = Hex2Symb(#temp)) + { + bword+=2; + goto DEFAULT_MARK; + } break; case '&': //  and so on @@ -492,7 +485,7 @@ void TWebBrowser::ParseHTML(dword bword){ for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;) { bukva = ESBYTE[bword]; - strcat(#tag, #bukva); + chrcat(#tag, bukva); } bukva = GetUnicodeSymbol(); @@ -559,6 +552,7 @@ void TWebBrowser::ParseHTML(dword bword){ break; default: DEFAULT_MARK: + if (bukva<=15) bukva=' '; if (!pre_text) && (bukva == ' ') { if (line[strlen(#line)-1]==' ') break; //убрать 2 пробела подряд diff --git a/programs/cmm/browser/include/img_cache.h b/programs/cmm/browser/include/img_cache.h index 86163ddce7..cef9593abf 100644 --- a/programs/cmm/browser/include/img_cache.h +++ b/programs/cmm/browser/include/img_cache.h @@ -19,13 +19,11 @@ int GetOrSetPicNum(dword i_path) void FreeImgCache() { - int i; - for (i=0; i<=num_of_pics; i++) + for ( ; num_of_pics>0; num_of_pics--) { - img_destroy stdcall (pics[num_of_pics].image); + if (pics[num_of_pics].image) img_destroy stdcall (pics[num_of_pics].image); pics[num_of_pics].path = NULL; } - num_of_pics=0; } diff --git a/programs/cmm/browser/include/menu_rmb.h b/programs/cmm/browser/include/menu_rmb.h index 35bd86dd75..64fefd3d51 100644 --- a/programs/cmm/browser/include/menu_rmb.h +++ b/programs/cmm/browser/include/menu_rmb.h @@ -10,9 +10,9 @@ char *ITEMS_LIST[]={ "DOS Ctrl+D",04, "KOI Ctrl+K",11, "UTF Ctrl+U",21, -"Line breaks ON" ,01, +"Line breaks ON" ,03, "Free image cache" ,02, -"TrueType fonts" ,05, +//"TrueType fonts" ,05, 0}; @@ -86,7 +86,7 @@ void menu_rmb() if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE; DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX); WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2]); - if (ITEMS_LIST[i*2+1]==1) && (pre_text==2) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444); + if (ITEMS_LIST[i*2+1]==3) && (pre_text==2) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444); if (ITEMS_LIST[i*2+1]==5) && (use_truetype==1) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444); } DrawBar(33, cur_encoding+1*ITEM_HEIGHT+8, 4, 4, 0x444444); //показывает выбраную кодировку