WebView 1.57: change draw Y coordinate from lines to pixels, several fixes

git-svn-id: svn://kolibrios.org@6794 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-12-11 22:58:11 +00:00
parent 8ac6d6b04c
commit b0a295dfce
7 changed files with 76 additions and 77 deletions

View File

@ -1,12 +1,11 @@
scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT}; enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
struct _style { struct _style {
byte byte
b, i, u, s, h, b, u, s, h,
pre, pre,
blq, blq,
li, li,
@ -47,10 +46,13 @@ dword link_color_inactive;
dword link_color_active; dword link_color_active;
dword bg_color; dword bg_color;
int stroka; int draw_y;
int stolbec; int stolbec;
int tab_len; int tab_len;
int anchor_line_num; int anchor_y;
int body_magrin=5;
int basic_line_h=22;
char URL[10000]; char URL[10000];
char header[2048]; char header[2048];
@ -73,14 +75,12 @@ char anchor[256]=0;
//============================================================================================ //============================================================================================
void TWebBrowser::DrawStyle() void TWebBrowser::DrawStyle()
{ {
int start_x, start_y, line_length, stolbec_len, body_magrin=5; int start_x, line_length, stolbec_len;
if (!header) if (!header)
{ {
ChangeCharset("UTF-8", "CP866", #line); ChangeCharset("UTF-8", "CP866", #line);
strcpy(#header, #line); sprintf(#header, "%s - %s", #line, #version);
strcat(#header, " - ");
strcat(#header, #version);
line = 0; line = 0;
return; return;
} }
@ -88,20 +88,17 @@ void TWebBrowser::DrawStyle()
if (line) && (!anchor) if (line) && (!anchor)
{ {
start_x = stolbec * list.font_w + body_magrin * DrawBuf.zoom + list.x; start_x = stolbec * list.font_w + body_magrin + list.x;
start_y = stroka * list.item_h + body_magrin;
stolbec_len = strlen(#line) * DrawBuf.zoom; stolbec_len = strlen(#line) * DrawBuf.zoom;
line_length = stolbec_len * list.font_w; line_length = stolbec_len * list.font_w;
if (style.h) stroka++; WriteBufText(start_x, draw_y, list.font_type, text_colors[text_color_index], #line, buf_data);
WriteBufText(start_x, start_y, list.font_type, text_colors[text_color_index], #line, buf_data); if (style.b) WriteBufText(start_x+1, draw_y, list.font_type, text_colors[text_color_index], #line, buf_data);
if (style.b) WriteBufText(start_x+1, start_y, list.font_type, text_colors[text_color_index], #line, buf_data); if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - DrawBuf.zoom + draw_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
if (style.i) { stolbec++; DrawBuf.Skew(start_x, start_y, line_length, list.item_h); } // bug with zoom>1 if (style.u) DrawBuf.DrawBar(start_x, list.item_h - DrawBuf.zoom - DrawBuf.zoom + draw_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
if (style.u) DrawBuf.DrawBar(start_x, list.item_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
if (link) { if (link) {
DrawBuf.DrawBar(start_x, list.item_h*style.h + list.item_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); DrawBuf.DrawBar(start_x, draw_y + list.item_h - 2, line_length, DrawBuf.zoom, text_colors[text_color_index]);
PageLinks.AddText(#line, line_length, list.item_h*style.h + list.item_h, UNDERLINE); PageLinks.AddText(line_length, list.item_h - 2, UNDERLINE, 1, #line); //TODO: set bigger underline_h for style.h
} }
stolbec += stolbec_len; stolbec += stolbec_len;
} }
@ -119,7 +116,7 @@ void TWebBrowser::Prepare(){
byte ignor_param; byte ignor_param;
dword bufpos; dword bufpos;
int line_len; int line_len;
style.b = style.i = style.u = style.s = style.h = style.blq = t_html = t_body = style.b = style.u = style.s = style.h = style.blq = t_html = t_body =
style.li = link = ignor_text = text_color_index = text_colors[0] = style.li_tab = 0; style.li = link = ignor_text = text_color_index = text_colors[0] = style.li_tab = 0;
style.align = ALIGN_LEFT; style.align = ALIGN_LEFT;
link_color_inactive = 0x0000FF; link_color_inactive = 0x0000FF;
@ -128,7 +125,7 @@ void TWebBrowser::Prepare(){
DrawBuf.Fill(bg_color); DrawBuf.Fill(bg_color);
PageLinks.Clear(); PageLinks.Clear();
strcpy(#header, #version); strcpy(#header, #version);
stroka = -list.first; draw_y = body_magrin;
stolbec = 0; stolbec = 0;
line = 0; line = 0;
//for plaint text use CP866 for other UTF //for plaint text use CP866 for other UTF
@ -227,12 +224,12 @@ void TWebBrowser::Prepare(){
} }
DrawStyle(); DrawStyle();
NewLine(); NewLine();
if (list.first == 0) list.count = stroka; if (list.first == 0) list.count = draw_y;
DrawPage(); DrawPage();
if (anchor) if (anchor)
{ {
anchor=NULL; anchor=NULL;
list.first=anchor_line_num; list.first = anchor_y;
Prepare(); Prepare();
} }
} }
@ -252,8 +249,7 @@ void TWebBrowser::Perenos()
} }
//============================================================================================ //============================================================================================
void TWebBrowser::SetStyle() { void TWebBrowser::SetStyle() {
int left1 = 5 + list.x; int left1 = body_magrin + list.x;
int top1 = stroka * list.item_h + list.y + 5;
byte opened; byte opened;
byte meta_encoding; byte meta_encoding;
if (tag[0] == '/') if (tag[0] == '/')
@ -270,7 +266,7 @@ void TWebBrowser::SetStyle() {
if (istag("form")) if (!opened) ignor_text = false; if (istag("form")) if (!opened) ignor_text = false;
if(istag("title")) { if(istag("title")) {
if (opened) header=NULL; if (opened) header=NULL;
else if (!stroka) DrawTitle(#header); else DrawTitle(#header);
return; return;
} }
if (ignor_text) return; if (ignor_text) return;
@ -282,7 +278,7 @@ void TWebBrowser::SetStyle() {
return; return;
} }
if (anchor) if (isattr("id=")) || (isattr("name=")) { //very bad: if the tag is not the last it wound work if (anchor) if (isattr("id=")) || (isattr("name=")) { //very bad: if the tag is not the last it wound work
if (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka; if (!strcmp(#anchor, #val)) anchor_y=draw_y;
} }
if (istag("body")) { if (istag("body")) {
t_body = opened; t_body = opened;
@ -310,7 +306,7 @@ void TWebBrowser::SetStyle() {
text_colors[text_color_index] = text_colors[text_color_index-1]; text_colors[text_color_index] = text_colors[text_color_index-1];
link = 1; link = 1;
text_colors[text_color_index] = link_color_inactive; text_colors[text_color_index] = link_color_inactive;
PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, draw_y + list.y);
} }
} while(GetNextParam()); } while(GetNextParam());
} }
@ -345,29 +341,31 @@ void TWebBrowser::SetStyle() {
if (istag("br")) { NewLine(); return; } if (istag("br")) { NewLine(); return; }
if (istag("tr")) { if (opened) NewLine(); return; } if (istag("tr")) { if (opened) NewLine(); return; }
if (istag("b")) || (istag("strong")) || (istag("big")) { style.b = opened; return; } if (istag("b")) || (istag("strong")) || (istag("big")) { style.b = opened; return; }
if (istag("i")) || (istag("em")) || (istag("subtitle")) { style.i=opened; return; }
if (istag("u")) || (istag("ins")) { style.u=opened; return;} if (istag("u")) || (istag("ins")) { style.u=opened; return;}
if (istag("s")) || (istag("strike")) || (istag("del")) { style.s=opened; return; } if (istag("s")) || (istag("strike")) || (istag("del")) { style.s=opened; return; }
if (istag("dd")) { stolbec += 5; return; } if (istag("dd")) { stolbec += 5; return; }
if (istag("blockquote")) { style.blq = opened; return; } if (istag("blockquote")) { style.blq = opened; return; }
if (istag("pre")) || (istag("code")) { style.pre = opened; return; } if (istag("pre")) || (istag("code")) { style.pre = opened; return; }
if (istag("img")) { ImgCache.Images( left1, top1, WB1.list.w); return; } if (istag("img")) { ImgCache.Images( left1, draw_y, WB1.list.w); return; }
if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) || (istag("caption")) { if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) || (istag("caption")) {
style.h = opened; style.h = opened;
NewLine();
if (opened) if (opened)
{ {
NewLine();
draw_y += 10;
WB1.DrawBuf.zoom=2; WB1.DrawBuf.zoom=2;
WB1.list.font_type |= 10011001b; WB1.list.font_type |= 10011001b;
if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER;
if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT;
if (stroka>1) NewLine(); list.item_h = basic_line_h * 2;
} }
else else
{ {
NewLine();
WB1.DrawBuf.zoom=1; WB1.DrawBuf.zoom=1;
WB1.list.font_type = 10011000b; WB1.list.font_type = 10011000b;
style.align = ALIGN_LEFT; style.align = ALIGN_LEFT;
list.item_h = basic_line_h;
} }
return; return;
} }
@ -382,8 +380,8 @@ void TWebBrowser::SetStyle() {
if (opened) if (opened)
{ {
NewLine(); NewLine();
DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, stroka +1 * list.item_h - 3 DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x,
- DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x454545); list.item_h - calc(DrawBuf.zoom*2) /2 + draw_y, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x454545);
} }
return; return;
} }
@ -401,7 +399,7 @@ void TWebBrowser::SetStyle() {
$push edi; $push edi;
NewLine(); NewLine();
$pop edi; $pop edi;
DrawBuf.DrawBar(5, list.item_h*stroka+4, list.w-10, 1, EDI); DrawBuf.DrawBar(5, draw_y - 1, list.w-10, 1, EDI);
NewLine(); NewLine();
return; return;
} }
@ -448,14 +446,11 @@ 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;
scroll_wv.position = list.first; scroll_wv.position = list.first;
scroll_wv.all_redraw = 0; scroll_wv.all_redraw = 0;
scroll_wv.start_x = list.x + list.w; scroll_wv.start_x = list.x + list.w;
scroll_wv.start_y = list.y; scroll_wv.start_y = list.y;
scroll_wv.size_y = list.h; scroll_wv.size_y = list.h;
scroll_wv.start_x = list.w * DrawBuf.zoom + list.x; scroll_wv.start_x = list.w + list.x;
scrollbar_v_draw(#scroll_wv); scrollbar_v_draw(#scroll_wv);
} }
//============================================================================================ //============================================================================================
@ -463,15 +458,12 @@ void TWebBrowser::NewLine()
{ {
int onleft, ontop; int onleft, ontop;
onleft = list.x + 5; if (!stolbec) && (draw_y==body_magrin) return;
ontop = stroka * list.item_h + list.y + 5;
onleft = list.x + body_magrin;
ontop = draw_y + list.y;
if (t_html) && (!t_body) return; if (t_html) && (!t_body) return;
if (stroka * list.item_h + 5 >= 0) && ( stroka + 1 * list.item_h + 5 < list.h) && (!anchor) draw_y += list.item_h;
{
if (style.align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.item_h,stolbec * list.font_w);
if (style.align == ALIGN_RIGHT) && (DrawBuf.zoom==1) DrawBuf.AlignRight(onleft,ontop,list.w,list.item_h,stolbec * list.font_w);
}
stroka++;
if (style.blq) stolbec = 6; else stolbec = 0; if (style.blq) stolbec = 6; else stolbec = 0;
if (style.li) stolbec = style.li_tab * 5; if (style.li) stolbec = style.li_tab * 5;
} }
@ -482,6 +474,6 @@ int isval(dword text) { if (!strcmp(#val,text)) return true; else return false;
//============================================================================================ //============================================================================================
void TWebBrowser::DrawPage() void TWebBrowser::DrawPage()
{ {
PutPaletteImage(list.first * list.item_h * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
DrawScroller(); DrawScroller();
} }

View File

@ -67,9 +67,7 @@ void ImageCache::Images(int left1, top1, width1)
imgh = DSWORD[pics[cur_pic].image+8]; imgh = DSWORD[pics[cur_pic].image+8];
if (imgw > width1) imgw = width1; if (imgw > width1) imgw = width1;
if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //fill first line draw_y += imgh + 5;
stroka += imgh / WB1.list.item_h;
if (imgh % WB1.list.item_h) stroka++;
if (top1+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //if all image is out of visible area if (top1+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //if all image is out of visible area
if (top1<WB1.list.y) //if image partly visible (at the top) if (top1<WB1.list.y) //if image partly visible (at the top)
{ {
@ -88,8 +86,8 @@ void ImageCache::Images(int left1, top1, width1)
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, bg_color); DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, bg_color);
if (link) if (link)
{ {
UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); //UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
PageLinks.AddText(0, imgw, imgh-1, NOLINE); //PageLinks.AddText(0, imgw, imgh-1, NOLINE, 1);
//WB1.DrawPage(); //WB1.DrawPage();
} }
} }

View File

@ -10,7 +10,7 @@ dword CursorFile = FROM "../TWB/pointer.cur";
struct array_link { struct array_link {
dword link, text; dword link, text;
int x,y,w,h; int x,y,w,h;
int underline; int underline, underline_h;
}; };
struct LinksArray { struct LinksArray {
@ -36,12 +36,13 @@ void LinksArray::AddLink(dword lpath, int link_x, link_y)
count++; count++;
} }
void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline) void LinksArray::AddText(dword link_w, link_h, link_underline, _underline_h, new_text)
{ {
if (count>= MAXLINKS) || (!count) return; if (count>= MAXLINKS) || (!count) return;
links[count-1].w = link_w; links[count-1].w = link_w;
links[count-1].h = link_h; links[count-1].h = link_h;
links[count-1].underline = link_underline; links[count-1].underline = link_underline;
links[count-1].underline_h = _underline_h;
page_links.add(new_text); page_links.add(new_text);
links[count-1].text = page_links.get(page_links.count-1); links[count-1].text = page_links.get(page_links.count-1);
@ -67,17 +68,19 @@ PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col) void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
{ {
int i; int i;
signed int WBY = -WB1.list.first*WB1.list.item_h - WB1.DrawBuf.zoom;
for (i=0; i<count; i++) for (i=0; i<count; i++)
{ {
if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h) if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h)
{ {
if (mouse.down) DrawRectangle(links[active].x, -WB1.list.first*WB1.list.item_h + links[active].y, links[active].w, links[active].h, 0); if (mouse.down) DrawRectangle(links[active].x, -WB1.list.first + links[active].y,
links[active].w, links[active].h, 0);
if (mouse.up) ClickLink(); if (mouse.up) ClickLink();
if (active==i) return; if (active==i) return;
CursorPointer.Set(); CursorPointer.Set();
if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y
if (links[i].underline) DrawBar(links[i].x, WBY + links[i].y + links[i].h,links[i].w, WB1.DrawBuf.zoom, bg_col); + links[active].h, links[active].w, links[i].underline_h, link_col_in);
if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y
+ links[i].h, links[i].w, links[i].underline_h, bg_col);
active = i; active = i;
status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
status_text.start_y = Form.cheight - STATUSBAR_H + 3; status_text.start_y = Form.cheight - STATUSBAR_H + 3;
@ -92,7 +95,7 @@ void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
if (active!=-1) if (active!=-1)
{ {
CursorPointer.Restore(); CursorPointer.Restore();
if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in);
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
active = -1; active = -1;
} }

View File

@ -30,7 +30,7 @@
char homepage[] = FROM "html\\homepage.htm""\0"; char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.56"; char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.57";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -43,7 +43,7 @@ char rmb_menu[] =
Žç¨áâ¨âì ªíè ª à⨭®ª Žç¨áâ¨âì ªíè ª à⨭®ª
Œ¥­¥¤¦¥à § £à㧮ª"; Œ¥­¥¤¦¥à § £à㧮ª";
#else #else
char version[]="Text-based Browser 1.56"; char version[]="Text-based Browser 1.57";
?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>";
@ -134,7 +134,7 @@ void main()
mouse.get(); mouse.get();
if (WB1.list.MouseOver(mouse.x, mouse.y)) if (WB1.list.MouseOver(mouse.x, mouse.y))
{ {
PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color); PageLinks.Hover(mouse.x, WB1.list.first + mouse.y, link_color_inactive, link_color_active, bg_color);
if (bufsize) && (mouse.pkm) && (mouse.up) { if (bufsize) && (mouse.pkm) && (mouse.up) {
EventShowMenu(mouse.x, mouse.y); EventShowMenu(mouse.x, mouse.y);
break; break;
@ -214,7 +214,7 @@ void main()
DSBYTE[EDI-1]='\0'; DSBYTE[EDI-1]='\0';
if (!strncmp(#URL,"https://",8)) if (!strncmp(#URL,"https://",8))
{ {
notify("HTTPS protocol is not supported yet"); ShowErrorMessageThatHttpsIsNotSupportedYet();
StopLoading(); StopLoading();
break; break;
} }
@ -262,12 +262,13 @@ void main()
void SetElementSizes() void SetElementSizes()
{ {
address_box.top = TOOLBAR_H/2-10; address_box.top = TOOLBAR_H/2-10;
basic_line_h = calc(WB1.list.font_h * 130) / 100;
address_box.width = Form.cwidth - address_box.left - 50; address_box.width = Form.cwidth - address_box.left - 50;
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom, WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom); Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
WB1.list.wheel_size = 7; WB1.list.wheel_size = 7 * basic_line_h;
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w; WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h; WB1.list.visible = WB1.list.h;
if (WB1.list.w!=WB1.DrawBuf.bufw) { if (WB1.list.w!=WB1.DrawBuf.bufw) {
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 2048 * WB1.list.item_h); WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 2048 * WB1.list.item_h);
ProcessEvent(REFRESH_BUTTON); ProcessEvent(REFRESH_BUTTON);
@ -398,10 +399,9 @@ void SetPageDefaults()
{ {
strcpy(#header, #version); strcpy(#header, #version);
WB1.list.count = WB1.list.first = 0; WB1.list.count = WB1.list.first = 0;
stroka = 0;
cur_encoding = CH_NULL; cur_encoding = CH_NULL;
if (o_bufpointer) o_bufpointer = free(o_bufpointer); if (o_bufpointer) o_bufpointer = free(o_bufpointer);
anchor_line_num=WB1.list.first; anchor_y = WB1.list.first;
//anchor[0]='|'; //anchor[0]='|';
anchor=NULL; anchor=NULL;
} }
@ -474,7 +474,6 @@ void ShowPage()
{ {
WB1.Prepare(); WB1.Prepare();
} }
if (!strcmp(#version, #header)) DrawTitle(#header);
} }
byte UrlExtIs(dword ext) byte UrlExtIs(dword ext)
@ -545,7 +544,7 @@ void ClickLink()
if (!strncmp(#URL,"https://",8)) if (!strncmp(#URL,"https://",8))
{ {
notify("'HTTPS protocol is not supported yet' -E"); ShowErrorMessageThatHttpsIsNotSupportedYet();
} }
GetAbsoluteURL(#URL); GetAbsoluteURL(#URL);
@ -563,8 +562,8 @@ void ClickLink()
else else
{ {
if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true) if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true)
|| (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true)
|| (UrlExtIs(".7z")==true) || (UrlExtIs("netcfg")==true) { || (UrlExtIs(".7z")==true) {
strcpy(#downloader_edit, #URL); strcpy(#downloader_edit, #URL);
CreateThread(#Downloader,#downloader_stak+4092); CreateThread(#Downloader,#downloader_stak+4092);
strcpy(#editURL, history.current()); strcpy(#editURL, history.current());
@ -580,4 +579,9 @@ void EventShowMenu(dword _left, _top)
menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE); menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE);
} }
void ShowErrorMessageThatHttpsIsNotSupportedYet()
{
notify("'HTTPS protocol is not supported yet' -E");
}
stop: stop:

View File

@ -11,7 +11,8 @@ dword ShowSource()
new_buf = malloc(bufsize*5); new_buf = malloc(bufsize*5);
new_buf_start = new_buf; new_buf_start = new_buf;
header[strrchr(#header, '-')-2]=0; header[strrchr(#header, '-')-2]=0;
new_buf += sprintf(new_buf,"<html><head><title>Source: %s</title><body><pre>",#header); sprintf(new_buf,"<html><head><title>Source: %s</title><body><pre>",#header);
new_buf += strlen(new_buf);
for (i=bufpointer; i<bufpointer+bufsize; i++) for (i=bufpointer; i<bufpointer+bufsize; i++)
{ {
ww = ESBYTE[i]; ww = ESBYTE[i];

View File

@ -362,10 +362,13 @@ inline fastcall void DrawTitle( ECX)
$int 0x40; $int 0x40;
} }
// @EDX is a procewss id, -1 for self // @EDX is a process id, -1 for self
// @ESI is a new LayerBehaviour // @ESI is a new LayerBehaviour
// @RETURN: EAX, 0 is fail, 1 is success // @RETURN: EAX, 0 is fail, 1 is success
#define WINDOW_LAYER_ALWAYS_ON_TOP 1 #define ZPOS_DESKTOP -2
#define ZPOS_ALWAYS_BACK -1
#define ZPOS_NORMAL 0
#define ZPOS_ALWAYS_TOP 1
inline fastcall dword SetWindowLayerBehaviour(EDX, ESI) inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
{ {
EAX = 18; EAX = 18;

View File

@ -58,9 +58,7 @@ void main()
byte btn; byte btn;
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
SetEventMask(10000000000000000000000001100111b); SetEventMask(10000000000000000000000001100111b);
debugi(3);
GetCpuFrequency(); GetCpuFrequency();
debugi(4);
loop() loop()
{ {
WaitEventTimeout(50); WaitEventTimeout(50);