HTMLv: 2 fixes for previous revision

git-svn-id: svn://kolibrios.org@4674 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2014-03-21 21:21:11 +00:00
parent 9d6deb9047
commit d476acc544
4 changed files with 43 additions and 20 deletions

View File

@ -633,7 +633,7 @@ void TWebBrowser::SetTextStyle(int left1, top1) {
} }
if (isTag("img")) if (isTag("img"))
{ {
ImgCache.Images( left1, top1); ImgCache.Images( left1, top1, WB1.list.w);
return; return;
} }
if (isTag("meta")) || (isTag("?xml")) if (isTag("meta")) || (isTag("?xml"))
@ -656,7 +656,7 @@ void TWebBrowser::SetTextStyle(int left1, top1) {
} }
} }
void TWebBrowser::DrawScroller() //не оптимальная отрисовка, но зато в одном месте void TWebBrowser::DrawScroller()
{ {
scroll_wv.max_area = list.count; scroll_wv.max_area = list.count;
scroll_wv.cur_area = list.visible; scroll_wv.cur_area = list.visible;
@ -673,12 +673,13 @@ void TWebBrowser::DrawScroller() //
void TWebBrowser::NewLine(int left1, top1) void TWebBrowser::NewLine(int left1, top1)
{ {
if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color); //закрашиваем фон над первой строкой if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color);
if (t_html) && (!t_body) return; if (t_html) && (!t_body) return;
if (top1>=list.y) && ( top1 < list.h+list.y-10) && (!anchor) if (top1>=list.y) && ( top1 < list.h+list.y-10) && (!anchor)
{ {
if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(left1,top1,list.w,list.line_h,stolbec * 6); if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(left1,top1,list.w,list.line_h,stolbec * 6);
if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(left1,top1,list.w,list.line_h,stolbec * 6); if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(left1,top1,list.w,list.line_h,stolbec * 6);
DrawBuf.bufy = top1;
DrawBuf.Show(); DrawBuf.Show();
DrawBuf.Fill(bg_color); DrawBuf.Fill(bg_color);
} }

View File

@ -38,7 +38,7 @@ void ImageCache::Images(int left1, top1, width1)
{ {
dword image; dword image;
char img_path[4096], alt[4096]; char img_path[4096], alt[4096];
int w=0, h=0, img_lines_first=0, cur_pic=0; int imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
do{ do{
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl() if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
@ -73,32 +73,32 @@ void ImageCache::Images(int left1, top1, width1)
return; return;
} }
w = DSWORD[pics[cur_pic].image+4]; imgw = DSWORD[pics[cur_pic].image+4];
h = DSWORD[pics[cur_pic].image+8]; imgh = DSWORD[pics[cur_pic].image+8];
if (w > width1) w = width1; if (imgw > width1) imgw = width1;
if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó
stroka += h/10; stroka += imgh/10;
if (top1+h<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ if (top1+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
if (top1<WB1.list.y) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó if (top1<WB1.list.y) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
{ {
img_lines_first=WB1.list.y-top1; img_lines_first=WB1.list.y-top1;
h=h-img_lines_first; imgh=imgh-img_lines_first;
top1=WB1.list.y; top1=WB1.list.y;
} }
if (top1>WB1.list.y+WB1.list.h-h-5) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó if (top1>WB1.list.y+WB1.list.h-imgh-5) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó
{ {
h=WB1.list.y+WB1.list.h-top1-5; imgh=WB1.list.y+WB1.list.h-top1-5;
} }
if (h<=0) return; if (imgh<=0) return;
if (anchor) return; if (anchor) return;
img_draw stdcall (pics[cur_pic].image, left1-5, top1, w, h,0,img_lines_first); img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
DrawBar(left1+w - 5, top1, WB1.list.w-w, h, bg_color); DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color);
IF (link) IF (link)
{ {
UnsafeDefineButton(left1 - 5, top1, w, h-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
PageLinks.AddText(0, w, h-1, NOLINE); PageLinks.AddText(0, imgw, imgh-1, NOLINE);
// WB1.DrawPage(); // WB1.DrawPage();
} }
} }

View File

@ -30,14 +30,14 @@
#include "img\URLgoto.txt"; #include "img\URLgoto.txt";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.75"; char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.76";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
unsigned char page_not_found[] = FROM "html\page_not_found_ru.htm"; unsigned char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n"; char accept_language[]= "Accept-Language: ru\n";
#else #else
char version[]=" Text-based Browser 0.99.75"; char version[]=" Text-based Browser 0.99.76";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -227,7 +227,7 @@ void SetElementSizes()
WB1.list.SetSizes(0, 44, Form.width - 10 - scroll_wv.size_x, Form.cheight - 44, 0, 10); WB1.list.SetSizes(0, 44, Form.width - 10 - scroll_wv.size_x, Form.cheight - 44, 0, 10);
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6; WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6;
WB1.list.visible = WB1.list.h - 3 / WB1.list.line_h - 2; WB1.list.visible = WB1.list.h - 3 / WB1.list.line_h - 2;
WB1.DrawBuf.Init(WB1.list.x, WB1.list.line_h, WB1.list.w, WB1.list.h); WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h);
} }

View File

@ -17,6 +17,10 @@ dword version_scrollbar = #aVersion_scrollbar;
dword PathShow_prepare = #aPathShow_prepare; dword PathShow_prepare = #aPathShow_prepare;
dword PathShow_draw = #aPathShow_draw; dword PathShow_draw = #aPathShow_draw;
dword progressbar_draw = #aProgressbar_draw;
dword progressbar_progress = #aProgressbar_progress;
$DD 2 dup 0 $DD 2 dup 0
char aEdit_box_draw [9] = "edit_box\0"; char aEdit_box_draw [9] = "edit_box\0";
@ -42,6 +46,9 @@ char aVersion_op [11] = "version_op\0" ;
char aPathShow_prepare [17] = "PathShow_prepare\0"; char aPathShow_prepare [17] = "PathShow_prepare\0";
char aPathShow_draw [14] = "PathShow_draw\0"; char aPathShow_draw [14] = "PathShow_draw\0";
char aProgressbar_draw [17] = "progressbar_draw\0";
char aProgressbar_progress[21] = "progressbar_progress\0";
struct PathShow_data struct PathShow_data
{ {
@ -100,4 +107,19 @@ position2,// equ [edi+72]
work_size,// equ [edi+76] work_size,// equ [edi+76]
all_redraw,// equ [edi+80] all_redraw,// equ [edi+80]
ar_offset;// equ [edi+84] ar_offset;// equ [edi+84]
};
struct pb //progressbar
{
dword value,
left,
top,
width,
height,
style,
min,
max,
back_color,
progress_color,
frame_color;
}; };