HTMLv 0.99.01: fixes, speedup

git-svn-id: svn://kolibrios.org@3468 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-04-12 16:34:24 +00:00
parent 102d7cd4b6
commit b29c5d9e53
5 changed files with 39 additions and 40 deletions

View File

@ -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(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(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(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); else init_font(#fontlol);
if (!URL) strcpy(#URL, "/sys/home.htm"); if (!URL) strcpy(#URL, "/sys/home.htm");
@ -181,6 +181,7 @@ void SetElementSizes()
WB1.line_h = 10; WB1.line_h = 10;
lines.column_max = WB1.width - 30 / 6; lines.column_max = WB1.width - 30 / 6;
lines.visible = WB1.height - 3 / WB1.line_h - 2; lines.visible = WB1.height - 3 / WB1.line_h - 2;
DrawBufInit();
} }

View File

@ -1,3 +1,9 @@
12.04.13 - 0.99.01
- исправлено падение при очистке кэша изображений
- исправлена работа пункта меню "включить разрывы строк"
- ускорение при прокрутке страницы
- ускорение обработки quotted printable
12.04.13 - 0.99 12.04.13 - 0.99
- отрисовка в буфер; - отрисовка в буфер;
- исправление ошибок и обновление кода. - исправление ошибок и обновление кода.

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.99"; char version[]=" Text-based Browser 0.99.01";
struct TWebBrowser { struct TWebBrowser {
@ -60,7 +60,6 @@ void DrawBufInit()
drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck
ESDWORD[drawbuf] = WB1.width; ESDWORD[drawbuf] = WB1.width;
ESDWORD[drawbuf+4] = WB1.line_h; ESDWORD[drawbuf+4] = WB1.line_h;
DrawBufFill();
} }
void DrawBufFill() void DrawBufFill()
{ {
@ -202,13 +201,13 @@ void TWebBrowser::Scan(int id)
case 004: //Ctrl+D case 004: //Ctrl+D
ReadHtml(_DOS); ReadHtml(_DOS);
break; break;
case 001:
if (!pre_text) pre_text=2;
else pre_text=0;
break;
case 002: //free img cache case 002: //free img cache
FreeImgCache(); FreeImgCache();
break; break;
case 003:
if (!pre_text) pre_text=2;
else pre_text=0;
break;
case 005: //truetype case 005: //truetype
if (use_truetype == 2) if (use_truetype == 2)
{ {
@ -225,9 +224,9 @@ void TWebBrowser::Scan(int id)
if (!BrowserHistory.GoForward()) return; if (!BrowserHistory.GoForward()) return;
OpenPage(); OpenPage();
return; return;
//case 255: //F12 case 255: //F12
// RunProgram("/rd/1/HTMLv_old", #URL); RunProgram("/rd/1/HTMLv_old", #URL);
// return; return;
case 052: //F3 case 052: //F3
if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path);
return; return;
@ -426,20 +425,17 @@ void TWebBrowser::ParseHTML(dword bword){
byte ignor_param; byte ignor_param;
char temp[768]; char temp[768];
stroka = -lines.first; if (blink<400) blink=400; else for ( ; blink>400; blink--;) DeleteButton(blink);
stolbec = 0;
for (j = 400; j < blink + 1; j++;) DeleteButton(j);
blink = 400;
b_text = i_text = u_text = s_text = blq_text = b_text = i_text = u_text = s_text = blq_text =
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè
link_color = 0x0000FF; link_color = 0x0000FF;
bg_color = 0xFFFFFF; bg_color = 0xFFFFFF;
DrawBufFill();
line = NULL; line = NULL;
strcpy(#page_links,"|"); strcpy(#page_links,"|");
strcpy(#header, #version); strcpy(#header, #version);
DrawBufInit(); stroka = -lines.first;
stolbec = 0;
if (pre_text<>2) if (pre_text<>2)
{ {
@ -466,24 +462,21 @@ void TWebBrowser::ParseHTML(dword bword){
tab_len=strlen(#line)/8; tab_len=strlen(#line)/8;
tab_len=tab_len*8; tab_len=tab_len*8;
tab_len=8+tab_len-strlen(#line); tab_len=8+tab_len-strlen(#line);
for (j=0; j<tab_len; j++;) strcat(#line," "); for (j=0; j<tab_len; j++;) chrcat(#line,' ');
break; break;
} }
case 0x0d:
bukva = ' ';
goto DEFAULT_MARK; goto DEFAULT_MARK;
case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 case '=': //quoted printable
if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
bword++; temp[0] = ESBYTE[bword+1];
bukva=ESBYTE[bword]; temp[1] = ESBYTE[bword+2];
strcpy(#temp,#bukva); temp[2] = '\0';
bword++; if (bukva = Hex2Symb(#temp))
bukva=ESBYTE[bword]; {
strcat(#temp,#bukva); bword+=2;
goto DEFAULT_MARK;
bukva=Hex2Symb(#temp); }
if (bukva) goto DEFAULT_MARK;
break; break;
case '&': //&nbsp; and so on case '&': //&nbsp; and so on
@ -492,7 +485,7 @@ void TWebBrowser::ParseHTML(dword bword){
for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;) for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;)
{ {
bukva = ESBYTE[bword]; bukva = ESBYTE[bword];
strcat(#tag, #bukva); chrcat(#tag, bukva);
} }
bukva = GetUnicodeSymbol(); bukva = GetUnicodeSymbol();
@ -559,6 +552,7 @@ void TWebBrowser::ParseHTML(dword bword){
break; break;
default: default:
DEFAULT_MARK: DEFAULT_MARK:
if (bukva<=15) bukva=' ';
if (!pre_text) && (bukva == ' ') if (!pre_text) && (bukva == ' ')
{ {
if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä

View File

@ -19,13 +19,11 @@ int GetOrSetPicNum(dword i_path)
void FreeImgCache() void FreeImgCache()
{ {
int i; for ( ; num_of_pics>0; num_of_pics--)
for (i=0; i<=num_of_pics; i++)
{ {
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; pics[num_of_pics].path = NULL;
} }
num_of_pics=0;
} }

View File

@ -10,9 +10,9 @@ char *ITEMS_LIST[]={
"DOS Ctrl+D",04, "DOS Ctrl+D",04,
"KOI Ctrl+K",11, "KOI Ctrl+K",11,
"UTF Ctrl+U",21, "UTF Ctrl+U",21,
"Line breaks ON" ,01, "Line breaks ON" ,03,
"Free image cache" ,02, "Free image cache" ,02,
"TrueType fonts" ,05, //"TrueType fonts" ,05,
0}; 0};
@ -86,7 +86,7 @@ void menu_rmb()
if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE; if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE;
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX); DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX);
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2]); 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); 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); //ďîęŕçűâŕĺň âűáđŕíóţ ęîäčđîâęó DrawBar(33, cur_encoding+1*ITEM_HEIGHT+8, 4, 4, 0x444444); //ďîęŕçűâŕĺň âűáđŕíóţ ęîäčđîâęó