forked from KolibriOS/kolibrios
HTMLv 0.70c
git-svn-id: svn://kolibrios.org@2240 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
be325e41ec
commit
2d014eec26
@ -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 Кб
|
||||||
- улучшен и оптимизирован код обработки юникодовских тегов (&), исправлен
|
- улучшен и оптимизирован код обработки юникодовских тегов (&), исправлен
|
||||||
|
@ -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,74 +74,75 @@ 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:
|
{
|
||||||
ReadHtml();
|
case 011: //Ctrk+K
|
||||||
break;
|
ReadHtml();
|
||||||
case BACK:
|
koitodos(buf);
|
||||||
BrowserHistory.GoBack();
|
break;
|
||||||
return;
|
case BACK:
|
||||||
case FORWARD:
|
BrowserHistory.GoBack();
|
||||||
//RunProgram("@notify", "Forward button is not realized yet");
|
return;
|
||||||
return;
|
case FORWARD:
|
||||||
case 054: //F5
|
//RunProgram("@notify", "Forward button is not realized yet");
|
||||||
IF(edit1.flags == 66) break;
|
return;
|
||||||
case REFRESH:
|
case 054: //F5
|
||||||
copystr(#URL, #editURL);
|
IF(edit1.flags == 66) break;
|
||||||
Draw_Window();
|
case REFRESH:
|
||||||
return;
|
copystr(#URL, #editURL);
|
||||||
case 014: //Ctrl+N íîâîå îêíî
|
Draw_Window();
|
||||||
case 020: //Ctrl+T íîâàÿ âêëàäêà
|
return;
|
||||||
case NEWTAB:
|
case 014: //Ctrl+N íîâîå îêíî
|
||||||
MoveSize(190,80,OLD,OLD);
|
case 020: //Ctrl+T íîâàÿ âêëàäêà
|
||||||
RunProgram(#program_path, #URL);
|
case NEWTAB:
|
||||||
return;
|
MoveSize(190,80,OLD,OLD);
|
||||||
case HOME:
|
RunProgram(#program_path, #URL);
|
||||||
copystr("/sys/index.htm", #editURL);
|
return;
|
||||||
case GOTOURL:
|
case HOME:
|
||||||
case 0x0D: //enter
|
copystr("/sys/index.htm", #editURL);
|
||||||
copystr(#editURL, #URL);
|
case GOTOURL:
|
||||||
Load(#URL);
|
case 0x0D: //enter
|
||||||
return;
|
copystr(#editURL, #URL);
|
||||||
case 052: //Íàæàòà F3
|
Load(#URL);
|
||||||
IF(edit1.flags <> 66)
|
return;
|
||||||
IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
|
case 052: //Íàæàòà F3
|
||||||
break;
|
IF(edit1.flags <> 66)
|
||||||
case 173: //ctrl+enter
|
IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
|
||||||
case SEARCHWEB:
|
break;
|
||||||
copystr(#search_path, #URL);
|
case 173: //ctrl+enter
|
||||||
copystr(#editURL, #URL + strlen(#URL));
|
case SEARCHWEB:
|
||||||
Load(#URL);
|
copystr(#search_path, #URL);
|
||||||
return;
|
copystr(#editURL, #URL + strlen(#URL));
|
||||||
case ID1: //ìîòàåì ââåðõ
|
Load(#URL);
|
||||||
IF(za_kadrom > 0) za_kadrom--;
|
return;
|
||||||
ELSE return;
|
case ID1: //ìîòàåì ââåðõ
|
||||||
break;
|
IF(za_kadrom > 0) za_kadrom--;
|
||||||
case ID2: //ìîòàåì âíèç
|
ELSE return;
|
||||||
IF(max_kolvo_strok + za_kadrom >= count) return;
|
break;
|
||||||
za_kadrom++;
|
case ID2: //ìîòàåì âíèç
|
||||||
break;
|
IF(max_kolvo_strok + za_kadrom >= count) return;
|
||||||
case 183: //PgDown
|
za_kadrom++;
|
||||||
IF(za_kadrom == count - max_kolvo_strok) return;
|
break;
|
||||||
za_kadrom = za_kadrom + max_kolvo_strok + 2;
|
case 183: //PgDown
|
||||||
IF(max_kolvo_strok + za_kadrom > count) za_kadrom = count - max_kolvo_strok;
|
IF(za_kadrom == count - max_kolvo_strok) return;
|
||||||
BREAK;
|
za_kadrom = za_kadrom + max_kolvo_strok + 2;
|
||||||
case 184: //PgUp
|
IF(max_kolvo_strok + za_kadrom > count) za_kadrom = count - max_kolvo_strok;
|
||||||
IF(za_kadrom == 0) RETURN;
|
BREAK;
|
||||||
za_kadrom = za_kadrom - max_kolvo_strok - 2;
|
case 184: //PgUp
|
||||||
IF(za_kadrom < 0) za_kadrom = 0;
|
IF(za_kadrom == 0) RETURN;
|
||||||
BREAK;
|
za_kadrom = za_kadrom - max_kolvo_strok - 2;
|
||||||
case 180: //home
|
IF(za_kadrom < 0) za_kadrom = 0;
|
||||||
IF (za_kadrom <>0) za_kadrom = 0;
|
BREAK;
|
||||||
ELSE RETURN;
|
case 180: //home
|
||||||
BREAK;
|
IF (za_kadrom <>0) za_kadrom = 0;
|
||||||
case 181: //end
|
ELSE RETURN;
|
||||||
za_kadrom = count - max_kolvo_strok;
|
BREAK;
|
||||||
BREAK;
|
case 181: //end
|
||||||
default:
|
za_kadrom = count - max_kolvo_strok;
|
||||||
RETURN;
|
BREAK;
|
||||||
|
default:
|
||||||
|
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)
|
|
||||||
{
|
{
|
||||||
|
DeleteFile(#download_path);
|
||||||
|
IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
|
||||||
|
downloader_id = RunProgram("/sys/network/downloader", #URL);
|
||||||
|
IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
|
||||||
|
RunProgram("/sys/network/downloader", #URL);
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(get_URL_part(5),"http:")))
|
/* if (!strcmp(get_URL_part(5),"http:")))
|
||||||
{
|
{
|
||||||
IF (DO_LOAD) && (!WindowRePaint)
|
IF (DO_LOAD) && (!WindowRePaint)
|
||||||
{
|
{
|
||||||
DeleteFile(#download_path);
|
HttpLoad();
|
||||||
IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
|
//RETURN;
|
||||||
downloader_id = RunProgram("/sys/network/downloader", #URL);
|
|
||||||
IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
|
|
||||||
RunProgram("/sys/network/downloader", #URL);
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user