HTMLv 0.70c

git-svn-id: svn://kolibrios.org@2240 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2011-09-26 14:09:58 +00:00
parent be325e41ec
commit 2d014eec26
3 changed files with 101 additions and 100 deletions

View File

@ -1,5 +1,7 @@
26.09.11 -- v0.70b -- 11.4 Кб 26.09.11 -- v0.70с -- 11.4 Кб
- универсальная обработка цветов. - универсальная обработка цветов;
- улучшения в обработке title;
- исправлена обработка станиц в кодировке iso-8859-1.
22.09.11 -- v0.70 -- 11.3 Кб 22.09.11 -- v0.70 -- 11.3 Кб
- улучшен и оптимизирован код обработки юникодовских тегов (&), исправлен - улучшен и оптимизирован код обработки юникодовских тегов (&), исправлен

View File

@ -35,7 +35,7 @@ struct TWebBrowser {
TWebBrowser WB1; TWebBrowser WB1;
byte rez, b_text, i_text, u_text, s_text, w_title, pre_text, blq_text, li_text, link, ignor_text, li_tab; byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, link, ignor_text, li_tab;
dword text_colors[10], dword text_colors[10],
@ -74,9 +74,11 @@ void TWebBrowser::Scan(dword id) {
IF(count < max_kolvo_strok) SWITCH(id) { IF(count < max_kolvo_strok) SWITCH(id) {
CASE 183: CASE 184: CASE 180: CASE 181: return; CASE 183: CASE 184: CASE 180: CASE 181: return;
} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè } //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
switch (id) { switch (id)
case 011: {
case 011: //Ctrk+K
ReadHtml(); ReadHtml();
koitodos(buf);
break; break;
case BACK: case BACK:
BrowserHistory.GoBack(); BrowserHistory.GoBack();
@ -141,7 +143,6 @@ void TWebBrowser::Scan(dword id) {
default: default:
RETURN; RETURN;
} }
IF(id == 11) koitodos(buf);
ParseHTML(buf, filesize); ParseHTML(buf, filesize);
} }
@ -190,29 +191,36 @@ void GetNewUrl(){
} }
} }
void HttpLoad()
void ReadHtml(byte DO_LOAD)
{
if (!strcmp(get_URL_part(5),"http:")))
{
IF (DO_LOAD) && (!WindowRePaint)
{ {
DeleteFile(#download_path); DeleteFile(#download_path);
IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=''; IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
downloader_id = RunProgram("/sys/network/downloader", #URL); downloader_id = RunProgram("/sys/network/downloader", #URL);
IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable."); IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
RunProgram("/sys/network/downloader", #URL); RunProgram("/sys/network/downloader", #URL);
RETURN; }
/* if (!strcmp(get_URL_part(5),"http:")))
{
IF (DO_LOAD) && (!WindowRePaint)
{
HttpLoad();
//RETURN;
} }
file_size stdcall (#download_path); file_size stdcall (#download_path);
} }
ELSE file_size stdcall (#URL); ELSE file_size stdcall (#URL);
*/
void ReadHtml(byte DO_LOAD)
{
if (!strcmp(get_URL_part(5),"http:")))
file_size stdcall (#download_path);
else
file_size stdcall (#URL);
filesize = EBX; filesize = EBX;
IF (!filesize) return; //Lee 22.09 if (!filesize) /*{Pause(200); ReadHtml();}*/ return; //Lee 22.09
mem_Free(buf); mem_Free(buf);
buf = mem_Alloc(filesize); buf = mem_Alloc(filesize);
ReadFile(0, filesize, buf, #URL); ReadFile(0, filesize, buf, #URL);
@ -269,7 +277,7 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
stroka = -za_kadrom; stroka = -za_kadrom;
stolbec = 0; stolbec = 0;
FOR(j = 400; j < blink + 1; j++;) DeleteButton(j); FOR(j = 400; j < blink + 1; j++;) DeleteButton(j);
b_text = i_text = u_text = s_text = w_title = pre_text = blq_text = b_text = i_text = u_text = s_text = pre_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;
blink = 400; blink = 400;
@ -400,15 +408,13 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
} }
rez = StrToInt(#tag + 1) - 1040; rez = StrToInt(#tag + 1) - 1040;
IF(tag[1] == '1') && (rez>1040) && (rez<1118) && (strlen(#tag) == 5) IF(tag[1] == '1') && (rez>=0) && (rez<=72) && (strlen(#tag) == 5)
{ {
bukva = utf100tmmv_mas[rez]; bukva = unicode_chars[rez];
copystr(#bukva, #line + strlen(#line)); GOTO DEFAULT_MARK; //îáðàáàòûâàåì áóêâó
break;
} }
WriteDebug("Unknown tag"); WriteDebug(#tag); //òýã íå íàéäåí - âûâîäèì íà äîñêó îòëàäêè
WriteDebug(#tag);
copystr(#tag, #line + strlen(#line)); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò copystr(#tag, #line + strlen(#line)); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò
break; break;
default: default:
@ -416,7 +422,7 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
IF(ignor_text) break; IF(ignor_text) break;
IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue; IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue;
// //
if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0) if (stolbec + strlen(#line) > max_kolvo_stolbcov)
{ {
copystr(#line + find_symbol(#line, ' '), #temp); //ïåðåíîñ ïî ñëîâàì copystr(#line + find_symbol(#line, ' '), #temp); //ïåðåíîñ ïî ñëîâàì
line[find_symbol(#line, ' ')] = 0x00; line[find_symbol(#line, ' ')] = 0x00;
@ -506,19 +512,12 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
IF (ignor_text == 1) return; IF (ignor_text == 1) return;
// //
if(!chTag("title")) IF(w_title == 0) if(!chTag("title")) && (!rez) && (stroka == 0)
{ {
copystr(" ", #line);
w_title = 1;
}
ELSE {
w_title = 0;
stolbec = 0;
copystr(#line, #header); copystr(#line, #header);
copystr(" -", #header + strlen(#header)); copystr(" -", #header + strlen(#header));
copystr(#version, #header + strlen(#header)); copystr(#version, #header + strlen(#header));
IF(stroka == 0) || (WindowRePaint == 1) DrawTitle(#header); DrawTitle(#header);
//äà, çíàþ, 2 ðàçà âûõîäèò, íî, åñëè áîëüøàÿ ñòðàíèöà, òî òðóú
return; return;
} }

View File

@ -1,6 +1,6 @@
byte utf100tmmv_mas[77] = "€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<D096><E29486><EFBFBD>徕沅彐玷殛腱眍镳駂<E995B3>243i\105\244\0"; byte unicode_chars[] = "€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<D096><E29486><EFBFBD>徕沅彐玷殛腱眍镳駂<E995B3>243i\105\244\0";
/* IF (BL==178) ESBYTE[ESI] = 73; //I /* IF (BL==178) ESBYTE[ESI] = 73; //I
IF (BL==179) ESBYTE[ESI] = 105; //i IF (BL==179) ESBYTE[ESI] = 105; //i