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 Кб
|
||||
- улучшен и оптимизирован код обработки юникодовских тегов (&), исправлен
|
||||
|
@ -35,7 +35,7 @@ struct TWebBrowser {
|
||||
|
||||
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],
|
||||
@ -74,9 +74,11 @@ void TWebBrowser::Scan(dword id) {
|
||||
IF(count < max_kolvo_strok) SWITCH(id) {
|
||||
CASE 183: CASE 184: CASE 180: CASE 181: return;
|
||||
} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
|
||||
switch (id) {
|
||||
case 011:
|
||||
switch (id)
|
||||
{
|
||||
case 011: //Ctrk+K
|
||||
ReadHtml();
|
||||
koitodos(buf);
|
||||
break;
|
||||
case BACK:
|
||||
BrowserHistory.GoBack();
|
||||
@ -141,7 +143,6 @@ void TWebBrowser::Scan(dword id) {
|
||||
default:
|
||||
RETURN;
|
||||
}
|
||||
IF(id == 11) koitodos(buf);
|
||||
ParseHTML(buf, filesize);
|
||||
}
|
||||
|
||||
@ -190,29 +191,36 @@ void GetNewUrl(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReadHtml(byte DO_LOAD)
|
||||
{
|
||||
|
||||
if (!strcmp(get_URL_part(5),"http:")))
|
||||
{
|
||||
IF (DO_LOAD) && (!WindowRePaint)
|
||||
void HttpLoad()
|
||||
{
|
||||
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);
|
||||
RETURN;
|
||||
}
|
||||
|
||||
/* if (!strcmp(get_URL_part(5),"http:")))
|
||||
{
|
||||
IF (DO_LOAD) && (!WindowRePaint)
|
||||
{
|
||||
HttpLoad();
|
||||
//RETURN;
|
||||
}
|
||||
file_size stdcall (#download_path);
|
||||
}
|
||||
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;
|
||||
IF (!filesize) return; //Lee 22.09
|
||||
if (!filesize) /*{Pause(200); ReadHtml();}*/ return; //Lee 22.09
|
||||
mem_Free(buf);
|
||||
buf = mem_Alloc(filesize);
|
||||
ReadFile(0, filesize, buf, #URL);
|
||||
@ -269,7 +277,7 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
stroka = -za_kadrom;
|
||||
stolbec = 0;
|
||||
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; //îáíóëÿåì òåãè
|
||||
link_color = 0x0000FF;
|
||||
blink = 400;
|
||||
@ -400,15 +408,13 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
}
|
||||
|
||||
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];
|
||||
copystr(#bukva, #line + strlen(#line));
|
||||
break;
|
||||
bukva = unicode_chars[rez];
|
||||
GOTO DEFAULT_MARK; //îáðàáàòûâàåì áóêâó
|
||||
}
|
||||
|
||||
WriteDebug("Unknown tag");
|
||||
WriteDebug(#tag);
|
||||
WriteDebug(#tag); //òýã íå íàéäåí - âûâîäèì íà äîñêó îòëàäêè
|
||||
copystr(#tag, #line + strlen(#line)); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò
|
||||
break;
|
||||
default:
|
||||
@ -416,7 +422,7 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
IF(ignor_text) break;
|
||||
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); //ïåðåíîñ ïî ñëîâàì
|
||||
line[find_symbol(#line, ' ')] = 0x00;
|
||||
@ -506,19 +512,12 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
|
||||
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(" -", #header + strlen(#header));
|
||||
copystr(#version, #header + strlen(#header));
|
||||
IF(stroka == 0) || (WindowRePaint == 1) DrawTitle(#header);
|
||||
//äà, çíàþ, 2 ðàçà âûõîäèò, íî, åñëè áîëüøàÿ ñòðàíèöà, òî òðóú
|
||||
DrawTitle(#header);
|
||||
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==179) ESBYTE[ESI] = 105; //i
|
||||
|
Loading…
Reference in New Issue
Block a user