HTMLv 0.69: image improvements, GetNextParam() optimizations

git-svn-id: svn://kolibrios.org@2182 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2011-09-13 18:45:17 +00:00
parent 0e33fe59a3
commit 536efe1968
2 changed files with 27 additions and 36 deletions

View File

@ -1,3 +1,7 @@
13.09.11 -- v0.69 -- 11.2 Кб
- нормальная прокрутка изображений;
- оптимизация процедуры парсинга тега с параметрами.
05.09.11 -- v0.68 -- 11.2 Кб
- устранён вылет программы при неправильном параметре color тега <font> - алсо
иногда действительно полезно читать маны;

View File

@ -18,7 +18,7 @@ dword j,
char download_path[]="/rd/1/.download";
//char search_path[]="http://nova.rambler.ru/search?words=";
char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 23.68";
char version[]=" Text-based Browser 23.69";
struct TWebBrowser {
@ -421,48 +421,42 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
}
void GetNextParam() {
dword kavichki = false,
i = strlen(#tagparam) - 1;
WHILE((i > 0) && (tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/'))
void GetNextParam()
{
byte kavichki = false;
int i = strlen(#tagparam) - 1;
WHILE((i > 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/')))
{
IF (tagparam[i] == '"') kavichki=1;
IF (tagparam[i] == '\'') kavichki=2;
IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i];
tagparam[i] = 0x00;
i--;
}
IF (kavichki==1) // "
IF (kavichki)
{
i=find_symbol(#tagparam, '"');
i=find_symbol(#tagparam, kavichki);
copystr(#tagparam + i, #options);
}
ELSE IF (kavichki==2) // '
{
i=find_symbol(#tagparam, '\'');
copystr(#tagparam + i, #options);
}
ELSE
{
//i=find_symbol(#tagparam, '=');
WHILE((i > 0) && (tagparam[i] <>'=')) i--;
i+=1;
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=find_symbol(#tagparam, '=')+1;
i++;
copystr(#tagparam + i, #options); //êîïèðóåì îïöèþ
WHILE (options[0] == ' ') copystr(#options + 1, #options);
}
tagparam[i] = 0x00;
//
WHILE((tagparam[i] <>' ') && (i > 0)) {
IF(tagparam[i] == '=') //äåğçêàÿ çàãëóøêà
FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--)
{
IF (tagparam[i] == '=') //äåğçêàÿ çàãëóøêà
{
//copystr(#tagparam+i+2,#options);
tagparam[i + 1] = 0x00;
}
i--;
}
copystr(#tagparam + i + 1, #parametr); //êîïèðóåì ïàðàìåòð
tagparam[i] = 0x00;
}
@ -474,8 +468,8 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
dword hr_color;
dword image=0;
char temp[1024];
int w, h;
char temp[4096];
int w, h, img_za_kadrom=0;
IF(tag[0] == '/') {
rez = 0;
@ -665,29 +659,22 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
if (top1+h<WB1.top) || (top1>WB1.top+WB1.height-10) //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
return;
if (top1<WB1.top) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
{
h=h-WB1.top+top1;
img_za_kadrom=WB1.top-top1;
h=h-img_za_kadrom;
top1=WB1.top-5;
}
if (top1>WB1.top+WB1.height-h-10) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó IF (stroka - 2 < max_kolvo_strok)
{
//WriteDebug(IntToStr(top1));
//WriteDebug(IntToStr(WB1.top));
//WriteDebug(IntToStr(h));
h=WB1.top+WB1.height-top1-10;
}
//WriteDebug(IntToStr(h));
//Pause(10);
IF (h<=0) return;
img_draw stdcall (image,left1-5,top1+10,w, h,0,0);
//WriteDebug("Good");
img_draw stdcall (image,left1-5,top1+10,w, h,0,img_za_kadrom);
DrawBar(left1+w - 5, top1 + 10, width1-w + 5, h, 0xFFFFFF);
}
return;