From b29e77e550690f0263fcda7c04e9ca95b8a28738 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 30 Jan 2014 18:28:50 +0000 Subject: [PATCH] HTMLv: several fixes git-svn-id: svn://kolibrios.org@4550 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 19 +++--- programs/cmm/TWB/img_cache.h | 9 ++- programs/cmm/TWB/links.h | 14 +++-- programs/cmm/browser/HTMLv.c | 61 ++++++++----------- .../cmm/browser/html/page_not_found_ru.htm | 2 +- programs/cmm/lib/strings.h | 1 - 6 files changed, 55 insertions(+), 51 deletions(-) diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index c995cff8ef..d7abbee82d 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -17,7 +17,7 @@ struct TWebBrowser { DrawBufer DrawBuf; void GetNewUrl(); void ReadHtml(); - void ParseHTML(); + void Parse(); void WhatTextStyle(); void DrawPage(); void DrawScroller(); @@ -90,7 +90,7 @@ void TWebBrowser::DrawPage() IF (link) { UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); - PageLinks.AddText(#line, line_length, list.line_h); + PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); } stolbec += strlen(#line); } @@ -166,12 +166,13 @@ void TWebBrowser::ReadHtml(byte encoding) } -void TWebBrowser::ParseHTML(dword bufpos){ +void TWebBrowser::Parse(dword bufpos, in_filesize){ word bukva[2]; int j, perenos_num; byte ignor_param; char temp[768]; - dword bufstart = bufpos; + bufsize = in_filesize; + bufpointer = bufpos; b_text = i_text = u_text = s_text = blq_text = li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = @@ -195,7 +196,7 @@ void TWebBrowser::ParseHTML(dword bufpos){ if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; } - for ( ; bufstart+bufsize > bufpos; bufpos++;) + for ( ; bufpointer+bufsize > bufpos; bufpos++;) { bukva = ESBYTE[bufpos]; if (ignor_text) && (bukva!='<') continue; @@ -253,7 +254,7 @@ void TWebBrowser::ParseHTML(dword bufpos){ do { bufpos++; - if (bufstart + bufsize <= bufpos) break 2; + if (bufpointer + bufsize <= bufpos) break 2; } while (ESBYTE[bufpos] <>'-'); @@ -261,7 +262,7 @@ void TWebBrowser::ParseHTML(dword bufpos){ if (ESBYTE[bufpos] <>'-') goto HH_; } } - while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + bufsize) //яюыєўрхь Єху ш хую ярЁрьхЄЁ√ + while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //яюыєўрхь Єху ш хую ярЁрьхЄЁ√ { bukva = ESBYTE[bufpos]; if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; @@ -299,8 +300,8 @@ void TWebBrowser::ParseHTML(dword bufpos){ } DrawPage(); - if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //юсЁрсюЄър Єхуют line=NULL; + if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //юсЁрсюЄър Єхуют tag = parametr = tagparam = ignor_param = NULL; break; @@ -341,7 +342,7 @@ void TWebBrowser::ParseHTML(dword bufpos){ { anchor=NULL; list.first=anchor_line_num; - ParseHTML(bufstart); + Parse(bufpointer, bufsize); } DrawScroller(); } diff --git a/programs/cmm/TWB/img_cache.h b/programs/cmm/TWB/img_cache.h index 4fe4c86ee9..08bc16cba8 100644 --- a/programs/cmm/TWB/img_cache.h +++ b/programs/cmm/TWB/img_cache.h @@ -25,7 +25,7 @@ void ImageCache::Free() int ImageCache::GetImageNumber(dword i_path) { int i; - for (i=0; iWB1.list.y) PageLinks.Hover(m.x, m.y, link_color_inactive, link_color_active, bg_color); if (m.y>WB1.list.y) && (m.yWB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible; - if (btn<>WB1.list.first) WB1.ParseHTML(bufpointer); + if (btn<>WB1.list.first) WB1.Parse(bufpointer, bufsize); } break; @@ -185,7 +185,7 @@ void main() //bufsize = ESI.http_msg.content_received; bufsize = strlen(bufpointer)-2; debugi(bufsize); - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); $pop EAX if (EAX == 0) { http_free stdcall (http_transfer); @@ -259,28 +259,28 @@ void Scan(int id) { case 011: //Ctrk+K WB1.ReadHtml(_KOI); - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 021: //Ctrl+U WB1.ReadHtml(_UTF); - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 004: //Ctrl+D WB1.ReadHtml(_DOS); - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 005: //Win encoding WB1.ReadHtml(_WIN); - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 009: //free img cache ImgCache.Free(); notify(IMAGES_CACHE_CLEARED); - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 003: //history @@ -301,7 +301,7 @@ void Scan(int id) else RunProgram("/rd/1/tinypad", #download_path); return; case 054: //F5 - IF(address_box.flags & 0b10) WB1.ParseHTML(bufpointer); + IF(address_box.flags & 0b10) WB1.Parse(bufpointer, bufsize); return; case REFRESH: @@ -342,7 +342,7 @@ void Scan(int id) IF(WB1.list.first == WB1.list.count - WB1.list.visible) return; WB1.list.first += WB1.list.visible + 2; IF(WB1.list.visible + WB1.list.first > WB1.list.count) WB1.list.first = WB1.list.count - WB1.list.visible; - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 184: //PgUp @@ -350,30 +350,30 @@ void Scan(int id) IF(WB1.list.first == 0) return; WB1.list.first -= WB1.list.visible - 2; IF(WB1.list.first < 0) WB1.list.first = 0; - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 178: case BTN_UP: if (WB1.list.first <= 0) return; WB1.list.first--; - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 177: case BTN_DOWN: if (WB1.list.visible + WB1.list.first >= WB1.list.count) return; WB1.list.first++; - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); return; case 180: //home - if (WB1.list.KeyHome()) WB1.ParseHTML(bufpointer); + if (WB1.list.KeyHome()) WB1.Parse(bufpointer, bufsize); return; case 181: //end if (WB1.list.count < WB1.list.visible) return; - if (WB1.list.KeyEnd()) WB1.ParseHTML(bufpointer); + if (WB1.list.KeyEnd()) WB1.Parse(bufpointer, bufsize); return; } } @@ -467,20 +467,13 @@ void ShowPage() if (!bufsize) { PageLinks.Clear(); - if (GetProcessSlot(downloader_id)<>0) - { - bufsize = sizeof(loading); - WB1.ParseHTML(#loading); - } + if (GetProcessSlot(downloader_id)<>0) + WB1.Parse(#loading, sizeof(loading)); else - { - bufsize = sizeof(page_not_found); - WB1.ParseHTML(#page_not_found); - } - bufsize = 0; + WB1.Parse(#page_not_found, sizeof(page_not_found)); } else - WB1.ParseHTML(bufpointer); + WB1.Parse(bufpointer, bufsize); if (!header) strcpy(#header, #version); if (!strcmp(#version, #header)) DrawTitle(#header); @@ -493,7 +486,7 @@ ShowHistory() free(history_pointer); history_pointer = malloc(64000); - strcat(history_pointer, "

History

"); + strcat(history_pointer, " History

History

"); strcat(history_pointer, "

Visited pages


"); for (i=1; i
"); + strcat(history_pointer, #pics[i].path); } - bufsize = strlen(history_pointer); bufpointer = history_pointer; - WB1.ParseHTML(history_pointer); + WB1.Parse(history_pointer, strlen(history_pointer)); } diff --git a/programs/cmm/browser/html/page_not_found_ru.htm b/programs/cmm/browser/html/page_not_found_ru.htm index a538a239fe..6a4a479a08 100644 --- a/programs/cmm/browser/html/page_not_found_ru.htm +++ b/programs/cmm/browser/html/page_not_found_ru.htm @@ -5,7 +5,7 @@

Веб-страница недоступна

-

Что делать:

+

Что можно сделать:

  • Убедитесь, что есть подключение к сети Интернет.
    diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index 9e8c61ae48..4d7db1b72c 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -421,7 +421,6 @@ void debugi(dword d_int) } - #define strncpy strcpyn #define strnmov strmovn #define stricmp strcmpi