forked from KolibriOS/kolibrios
WebView 1.84:
- deny more than 2 empty line breaks - h1 is now bolder than h2, propper align of list items, show buttons, distinct images in text - add hotkeys - improve proceed of urls git-svn-id: svn://kolibrios.org@7742 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1db21b9e5d
commit
ce732ebdd3
@ -4,12 +4,14 @@ scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0
|
|||||||
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
|
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
|
||||||
|
|
||||||
struct _style {
|
struct _style {
|
||||||
byte
|
bool
|
||||||
b, u, s, h,
|
b, u, s, h,
|
||||||
pre,
|
pre,
|
||||||
blq,
|
blq,
|
||||||
li,
|
li,
|
||||||
li_tab,
|
li_tab,
|
||||||
|
button,
|
||||||
|
image,
|
||||||
align;
|
align;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -30,7 +32,7 @@ struct TWebBrowser {
|
|||||||
} WB1;
|
} WB1;
|
||||||
|
|
||||||
|
|
||||||
byte
|
bool
|
||||||
link,
|
link,
|
||||||
ignor_text,
|
ignor_text,
|
||||||
cur_encoding,
|
cur_encoding,
|
||||||
@ -91,6 +93,14 @@ void TWebBrowser::DrawStyle()
|
|||||||
stolbec_len = strlen(#line) * zoom;
|
stolbec_len = strlen(#line) * zoom;
|
||||||
line_length = stolbec_len * list.font_w;
|
line_length = stolbec_len * list.font_w;
|
||||||
|
|
||||||
|
if (style.image) {
|
||||||
|
DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, 0xF9DBCB);
|
||||||
|
}
|
||||||
|
if (style.button) {
|
||||||
|
DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h - calc(zoom*2), 0xCCCccc);
|
||||||
|
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999);
|
||||||
|
}
|
||||||
|
|
||||||
DrawBuf.WriteText(start_x, draw_y, list.font_type, text_colors[text_color_index], #line);
|
DrawBuf.WriteText(start_x, draw_y, list.font_type, text_colors[text_color_index], #line);
|
||||||
if (style.b) DrawBuf.WriteText(start_x+1, draw_y, list.font_type, text_colors[text_color_index], #line);
|
if (style.b) DrawBuf.WriteText(start_x+1, draw_y, list.font_type, text_colors[text_color_index], #line);
|
||||||
if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
||||||
@ -239,7 +249,10 @@ void TWebBrowser::Perenos()
|
|||||||
char new_line_text[4096];
|
char new_line_text[4096];
|
||||||
if (strlen(#line)*zoom + stolbec < list.column_max) return;
|
if (strlen(#line)*zoom + stolbec < list.column_max) return;
|
||||||
perenos_num = strrchr(#line, ' ');
|
perenos_num = strrchr(#line, ' ');
|
||||||
if (!perenos_num) && (strlen(#line)*zoom>list.column_max) perenos_num=list.column_max/zoom;
|
if (!perenos_num) && (strlen(#line)*zoom>list.column_max) {
|
||||||
|
perenos_num=list.column_max/zoom;
|
||||||
|
if (!stolbec)&&(style.pre) draw_y-=list.item_h; //hack to fix https://prnt.sc/rk3kyt
|
||||||
|
}
|
||||||
strcpy(#new_line_text, #line + perenos_num);
|
strcpy(#new_line_text, #line + perenos_num);
|
||||||
line[perenos_num] = 0x00;
|
line[perenos_num] = 0x00;
|
||||||
DrawStyle();
|
DrawStyle();
|
||||||
@ -248,9 +261,10 @@ void TWebBrowser::Perenos()
|
|||||||
}
|
}
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
void TWebBrowser::SetStyle() {
|
void TWebBrowser::SetStyle() {
|
||||||
|
char img_path[4096];
|
||||||
int left1 = body_magrin + list.x;
|
int left1 = body_magrin + list.x;
|
||||||
byte opened;
|
bool opened;
|
||||||
byte meta_encoding;
|
int meta_encoding;
|
||||||
if (tag[0] == '/')
|
if (tag[0] == '/')
|
||||||
{
|
{
|
||||||
opened = 0;
|
opened = 0;
|
||||||
@ -291,8 +305,9 @@ void TWebBrowser::SetStyle() {
|
|||||||
}
|
}
|
||||||
} while(GetNextParam());
|
} while(GetNextParam());
|
||||||
if (opened) && (cur_encoding==CH_NULL) {
|
if (opened) && (cur_encoding==CH_NULL) {
|
||||||
cur_encoding = CH_UTF8;
|
cur_encoding = CH_CP866;
|
||||||
debugln("Document has no information about encoding, UTF will be used");
|
//BufEncode(CH_UTF8);
|
||||||
|
debugln("Document has no information about encoding!");
|
||||||
}
|
}
|
||||||
if (opened) {
|
if (opened) {
|
||||||
if (strcmp(#header, #version) != 0) {
|
if (strcmp(#header, #version) != 0) {
|
||||||
@ -349,12 +364,33 @@ 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("button")) { style.button = opened; stolbec++; 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, draw_y, WB1.list.w); return; }
|
if (istag("img")) {
|
||||||
|
do{
|
||||||
|
if (isattr("src=")) strcpy(#img_path, #val);
|
||||||
|
if (isattr("alt=")) sprintf(#line, "[%s]", #val);
|
||||||
|
} while(GetNextParam());
|
||||||
|
style.image = true;
|
||||||
|
text_color_index++;
|
||||||
|
text_colors[text_color_index] = 0x9A6F29;
|
||||||
|
if (!line) {
|
||||||
|
if (!strncmp(#img_path, "data:", 5)) img_path=0;
|
||||||
|
sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/'));
|
||||||
|
line[50]= NULL;
|
||||||
|
}
|
||||||
|
if (strlen(#line) + stolbec > list.column_max) Perenos();
|
||||||
|
DrawStyle();
|
||||||
|
line=0;
|
||||||
|
text_color_index--;
|
||||||
|
style.image = false;
|
||||||
|
//ImgCache.Images( left1, draw_y, WB1.list.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("caption")) {
|
if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("caption")) {
|
||||||
style.h = opened;
|
style.h = opened;
|
||||||
if (opened)
|
if (opened)
|
||||||
@ -366,9 +402,11 @@ void TWebBrowser::SetStyle() {
|
|||||||
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;
|
||||||
list.item_h = basic_line_h * 2;
|
list.item_h = basic_line_h * 2;
|
||||||
|
if (istag("h1")) style.b = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (istag("h1")) style.b = false;
|
||||||
NewLine();
|
NewLine();
|
||||||
WB1.zoom=1;
|
WB1.zoom=1;
|
||||||
WB1.list.font_type = 10011000b;
|
WB1.list.font_type = 10011000b;
|
||||||
@ -388,7 +426,8 @@ void TWebBrowser::SetStyle() {
|
|||||||
if (opened)
|
if (opened)
|
||||||
{
|
{
|
||||||
NewLine();
|
NewLine();
|
||||||
strcpy(#line, "\31 \0");
|
strcpy(#line, "\31 ");
|
||||||
|
stolbec-=2;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -441,8 +480,8 @@ void TWebBrowser::BufEncode(dword set_new_encoding)
|
|||||||
{
|
{
|
||||||
strcpy(bufpointer, o_bufpointer);
|
strcpy(bufpointer, o_bufpointer);
|
||||||
}
|
}
|
||||||
debugval("cur_encoding ", cur_encoding);
|
//debugval("cur_encoding ", cur_encoding);
|
||||||
debugval("set_new_encoding", set_new_encoding);
|
//debugval("set_new_encoding", set_new_encoding);
|
||||||
cur_encoding = set_new_encoding;
|
cur_encoding = set_new_encoding;
|
||||||
bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);
|
bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);
|
||||||
}
|
}
|
||||||
@ -462,9 +501,17 @@ void TWebBrowser::DrawScroller()
|
|||||||
void TWebBrowser::NewLine()
|
void TWebBrowser::NewLine()
|
||||||
{
|
{
|
||||||
dword onleft, ontop;
|
dword onleft, ontop;
|
||||||
|
static int empty_line=0;
|
||||||
|
|
||||||
if (!stolbec) && (draw_y==body_magrin) return;
|
if (!stolbec) && (draw_y==body_magrin) return;
|
||||||
|
|
||||||
|
if (!stolbec) {
|
||||||
|
if (empty_line<1) empty_line++;
|
||||||
|
else return;
|
||||||
|
} else {
|
||||||
|
empty_line=0;
|
||||||
|
}
|
||||||
|
|
||||||
onleft = list.x + body_magrin;
|
onleft = list.x + body_magrin;
|
||||||
ontop = draw_y + list.y;
|
ontop = draw_y + list.y;
|
||||||
if (t_html) && (!t_body) return;
|
if (t_html) && (!t_body) return;
|
||||||
|
@ -12,7 +12,7 @@ void GetAbsoluteURL(dword in_URL)
|
|||||||
|
|
||||||
if (check_is_the_url_absolute(in_URL)) return;
|
if (check_is_the_url_absolute(in_URL)) return;
|
||||||
|
|
||||||
IF (!strcmpn(in_URL,"//", 2))
|
IF (!strncmp(in_URL,"//", 2))
|
||||||
{
|
{
|
||||||
//strcpy(#newurl, "http:");
|
//strcpy(#newurl, "http:");
|
||||||
//strcat(#newurl, in_URL);
|
//strcat(#newurl, in_URL);
|
||||||
@ -21,7 +21,7 @@ void GetAbsoluteURL(dword in_URL)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF (!strcmpn(in_URL,"./", 2)) in_URL+=2;
|
IF (!strncmp(in_URL,"./", 2)) in_URL+=2;
|
||||||
if (!http.transfer)
|
if (!http.transfer)
|
||||||
{
|
{
|
||||||
strcpy(#newurl, history.current());
|
strcpy(#newurl, history.current());
|
||||||
|
@ -37,28 +37,13 @@ int ImageCache::GetImage(dword i_path)
|
|||||||
void ImageCache::Images(dword left1, top1, width1)
|
void ImageCache::Images(dword left1, top1, width1)
|
||||||
{
|
{
|
||||||
dword image;
|
dword image;
|
||||||
char img_path[4096], alt[4096]=0;
|
|
||||||
dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
|
dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
|
||||||
|
|
||||||
do{
|
//GetAbsoluteURL(#img_path);
|
||||||
if (isattr("src="))
|
//cur_pic = GetImage(#img_path);
|
||||||
{
|
|
||||||
strcpy(#img_path, #val);
|
|
||||||
GetAbsoluteURL(#img_path);
|
|
||||||
cur_pic = GetImage(#img_path);
|
|
||||||
}
|
|
||||||
if (isattr("alt="))
|
|
||||||
{
|
|
||||||
strcpy(#alt, "[");
|
|
||||||
strcat(#alt, #val);
|
|
||||||
strcat(#alt, "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
} while(GetNextParam());
|
|
||||||
|
|
||||||
if (!pics[cur_pic].image)
|
if (!pics[cur_pic].image)
|
||||||
{
|
{
|
||||||
if (alt) strcat(#line, #alt);
|
|
||||||
//cur_pic = GetImage("/sys/network/noimg.png");
|
//cur_pic = GetImage("/sys/network/noimg.png");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,7 +52,7 @@ void ImageCache::Images(dword 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;
|
||||||
|
|
||||||
draw_y += imgh + 5;
|
//draw_y += imgh + 5; TEMPORARY TURN OFF!!!
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -75,12 +75,12 @@ bool LinksArray::HoverAndProceed(dword mx, my)
|
|||||||
}
|
}
|
||||||
if (mouse.mkm) && (mouse.up) {
|
if (mouse.mkm) && (mouse.up) {
|
||||||
open_in_a_new_window = true;
|
open_in_a_new_window = true;
|
||||||
ClickLink();
|
EventClickLink();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mouse.lkm) && (mouse.up) {
|
if (mouse.lkm) && (mouse.up) {
|
||||||
CursorPointer.Restore();
|
CursorPointer.Restore();
|
||||||
ClickLink();
|
EventClickLink();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mouse.pkm) && (mouse.up) {
|
if (mouse.pkm) && (mouse.up) {
|
||||||
|
@ -33,6 +33,7 @@ char *unicode_tags[]={
|
|||||||
|
|
||||||
"rsquo", "'",
|
"rsquo", "'",
|
||||||
"#39", "'",
|
"#39", "'",
|
||||||
|
"#039", "'",
|
||||||
"#96", "'",
|
"#96", "'",
|
||||||
"#8217", "'",
|
"#8217", "'",
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0};
|
|||||||
char homepage[] = FROM "html\\homepage.htm""\0";
|
char homepage[] = FROM "html\\homepage.htm""\0";
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.83";
|
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.84";
|
||||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||||
@ -46,7 +46,7 @@ char link_menu[] =
|
|||||||
"Š®¯¨à®¢ âì áá뫪ã
|
"Š®¯¨à®¢ âì áá뫪ã
|
||||||
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
||||||
#else
|
#else
|
||||||
char version[]="Text-based Browser 1.83";
|
char version[]="Text-based Browser 1.84";
|
||||||
?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>";
|
||||||
@ -162,9 +162,20 @@ void main()
|
|||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
GetKeys();
|
GetKeys();
|
||||||
|
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
|
||||||
|
if (key_scancode == SCAN_CODE_KEY_H) ProcessEvent(VIEW_HISTORY);
|
||||||
|
if (key_scancode == SCAN_CODE_KEY_U) ProcessEvent(VIEW_SOURCE);
|
||||||
|
if (key_scancode == SCAN_CODE_KEY_T)
|
||||||
|
|| (key_scancode == SCAN_CODE_KEY_N) RunProgram(#program_path, NULL);
|
||||||
|
if (key_scancode == SCAN_CODE_KEY_W) ExitProcess();
|
||||||
|
if (key_scancode == SCAN_CODE_KEY_J) ProcessEvent(DOWNLOAD_MANAGER);
|
||||||
|
}
|
||||||
if (address_box.flags & ed_focus)
|
if (address_box.flags & ed_focus)
|
||||||
{
|
{
|
||||||
if (key_ascii == ASCII_KEY_ENTER) ProcessEvent(key_scancode); else {
|
if (key_scancode == SCAN_CODE_ENTER) {
|
||||||
|
ProcessEvent(key_scancode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
EAX = key_editbox;
|
EAX = key_editbox;
|
||||||
edit_box_key stdcall(#address_box);
|
edit_box_key stdcall(#address_box);
|
||||||
}
|
}
|
||||||
@ -215,6 +226,7 @@ void main()
|
|||||||
strcpy(#editURL, #URL);
|
strcpy(#editURL, #URL);
|
||||||
DrawEditBoxWebView();
|
DrawEditBoxWebView();
|
||||||
OpenPage();
|
OpenPage();
|
||||||
|
//ProcessLink(history.current());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -297,20 +309,7 @@ void ProcessEvent(dword id__)
|
|||||||
return;
|
return;
|
||||||
case GOTOURL_BUTTON:
|
case GOTOURL_BUTTON:
|
||||||
case SCAN_CODE_ENTER:
|
case SCAN_CODE_ENTER:
|
||||||
if (!editURL[0]) {
|
EventSubmitOmnibox();
|
||||||
strcpy(#URL, URL_SERVICE_HOME);
|
|
||||||
}
|
|
||||||
else if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
|
|
||||||
|| (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
|
|
||||||
{
|
|
||||||
strcpy(#URL, #editURL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strlcpy(#URL,"http://",7);
|
|
||||||
strcat(#URL, #editURL);
|
|
||||||
}
|
|
||||||
OpenPage();
|
|
||||||
return;
|
return;
|
||||||
case REFRESH_BUTTON:
|
case REFRESH_BUTTON:
|
||||||
if (http.transfer > 0)
|
if (http.transfer > 0)
|
||||||
@ -467,92 +466,77 @@ void OpenPage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawEditBoxWebView()
|
void ProcessAnchor()
|
||||||
{
|
{
|
||||||
int skin_x_offset;
|
char anchor[256];
|
||||||
DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
|
int anchor_pos;
|
||||||
DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
|
|
||||||
//address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
|
anchor_pos = strrchr(#URL, '#')-1;
|
||||||
//address_box.offset = 0;
|
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor));
|
||||||
EditBox_UpdateText(#address_box, address_box.flags);
|
URL[anchor_pos] = 0x00;
|
||||||
edit_box_draw stdcall(#address_box);
|
|
||||||
if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
|
//#1
|
||||||
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
|
if (URL[0] == NULL)
|
||||||
|
{
|
||||||
|
if (anchor[1] == NULL) {
|
||||||
|
WB1.list.first = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (anchors.get_anchor_pos(#anchor+1)!=-1) WB1.list.first = anchors.get_anchor_pos(#anchor+1);
|
||||||
|
}
|
||||||
|
strcpy(#URL, history.current());
|
||||||
|
}
|
||||||
|
//liner.ru#1
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetAbsoluteURL(#URL);
|
||||||
|
OpenPage();
|
||||||
|
if (anchors.get_anchor_pos(#anchor+1)!=-1) WB1.list.first = anchors.get_anchor_pos(#anchor+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
WB1.DrawPage();
|
||||||
|
strcpy(#editURL, #URL);
|
||||||
|
strcat(#editURL, #anchor);
|
||||||
|
DrawEditBoxWebView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventSubmitOmnibox()
|
||||||
void ShowPage()
|
|
||||||
{
|
{
|
||||||
DrawEditBoxWebView();
|
if (!editURL[0]) return;
|
||||||
if (!bufsize)
|
if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
|
||||||
|
|| (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
|
||||||
{
|
{
|
||||||
if (http.transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
|
strcpy(#URL, #editURL);
|
||||||
else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WB1.Prepare();
|
strlcpy(#URL,"http://",7);
|
||||||
|
strcat(#URL, #editURL);
|
||||||
}
|
}
|
||||||
|
ProcessLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
byte UrlExtIs(dword ext)
|
void EventClickLink()
|
||||||
{
|
{
|
||||||
if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
|
strcpy(#URL, PageLinks.GetURL(PageLinks.active));
|
||||||
return false;
|
GetAbsoluteURL(#URL);
|
||||||
|
ProcessLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawProgress()
|
void ProcessLink()
|
||||||
{
|
|
||||||
dword persent;
|
|
||||||
if (http.transfer == 0) return;
|
|
||||||
if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10;
|
|
||||||
DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, wv_progress_bar.progress_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ClickLink()
|
|
||||||
char anchor[256];
|
|
||||||
int anchor_pos;
|
|
||||||
{
|
{
|
||||||
if (http.transfer > 0)
|
if (http.transfer > 0)
|
||||||
{
|
{
|
||||||
StopLoading();
|
StopLoading();
|
||||||
history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
strcpy(#URL, PageLinks.GetURL(PageLinks.active));
|
|
||||||
ReplaceSpaceInUrl();
|
if (strrchr(#URL, '#')!=0) {
|
||||||
//#1
|
ProcessAnchor();
|
||||||
if (URL[0] == '#')
|
|
||||||
{
|
|
||||||
if (URL[1] == NULL) {
|
|
||||||
WB1.list.first = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (anchors.get_anchor_pos(#URL+1)!=-1) WB1.list.first = anchors.get_anchor_pos(#URL+1);
|
|
||||||
}
|
|
||||||
strlcpy(#anchor, #URL, sizeof(anchor));
|
|
||||||
strcpy(#URL, history.current());
|
|
||||||
strcpy(#editURL, #URL);
|
|
||||||
strcat(#editURL, #anchor);
|
|
||||||
DrawEditBoxWebView();
|
|
||||||
WB1.DrawPage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//liner.ru#1
|
|
||||||
else if (strrchr(#URL, '#')!=0)
|
|
||||||
{
|
|
||||||
anchor_pos = strrchr(#URL, '#')-1;
|
|
||||||
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor));
|
|
||||||
URL[anchor_pos] = 0x00;
|
|
||||||
OpenPage();
|
|
||||||
strcat(#editURL, #anchor);
|
|
||||||
DrawEditBoxWebView();
|
|
||||||
if (anchors.get_anchor_pos(#anchor+1)!=-1) WB1.list.first = anchors.get_anchor_pos(#anchor+1);
|
|
||||||
WB1.DrawPage();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncmp(#URL,"mailto:", 7))
|
if (!strncmp(#URL,"mailto:", 7)) || (!strncmp(#URL,"tel:", 4))
|
||||||
{
|
{
|
||||||
notify(#URL);
|
notify(#URL);
|
||||||
strcpy(#editURL, history.current());
|
strcpy(#editURL, history.current());
|
||||||
@ -560,7 +544,10 @@ int anchor_pos;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetAbsoluteURL(#URL);
|
if (!strncmp(#URL,"WebView:",8)) {
|
||||||
|
OpenPage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0)
|
if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0)
|
||||||
{
|
{
|
||||||
@ -606,6 +593,48 @@ int anchor_pos;
|
|||||||
open_in_a_new_window = false;
|
open_in_a_new_window = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawEditBoxWebView()
|
||||||
|
{
|
||||||
|
int skin_x_offset;
|
||||||
|
DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
|
||||||
|
DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
|
||||||
|
//address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
|
||||||
|
//address_box.offset = 0;
|
||||||
|
EditBox_UpdateText(#address_box, address_box.flags);
|
||||||
|
edit_box_draw stdcall(#address_box);
|
||||||
|
if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
|
||||||
|
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ShowPage()
|
||||||
|
{
|
||||||
|
DrawEditBoxWebView();
|
||||||
|
if (!bufsize)
|
||||||
|
{
|
||||||
|
if (http.transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
|
||||||
|
else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WB1.Prepare();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte UrlExtIs(dword ext)
|
||||||
|
{
|
||||||
|
if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawProgress()
|
||||||
|
{
|
||||||
|
dword persent;
|
||||||
|
if (http.transfer == 0) return;
|
||||||
|
if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10;
|
||||||
|
DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, wv_progress_bar.progress_color);
|
||||||
|
}
|
||||||
|
|
||||||
void EventShowPageMenu(dword _left, _top)
|
void EventShowPageMenu(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);
|
||||||
@ -626,7 +655,7 @@ void EventUpdateProgressBar()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawStatusBar(dword _status_text)
|
void DrawStatusBar(dword _status_text)
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
@ -10,19 +10,26 @@ ShowHistory()
|
|||||||
strcat(history_pointer, "<br><b>Visited pages</b><br>");
|
strcat(history_pointer, "<br><b>Visited pages</b><br>");
|
||||||
for (i=0; i<history.items.count; i++)
|
for (i=0; i<history.items.count; i++)
|
||||||
{
|
{
|
||||||
strcat(history_pointer, " <a href='");
|
strcat(history_pointer, "<a href='");
|
||||||
strcat(history_pointer, history.items.get(i));
|
strcat(history_pointer, history.items.get(i));
|
||||||
strcat(history_pointer, "'>");
|
strcat(history_pointer, "'>");
|
||||||
strcat(history_pointer, history.items.get(i));
|
strcat(history_pointer, history.items.get(i));
|
||||||
strcat(history_pointer, "</a><br>");
|
strcat(history_pointer, "</a><br>");
|
||||||
}
|
}
|
||||||
strcat(history_pointer, "<br><b>Cached images</b>");
|
strcat(history_pointer, "<br><b>Cached images</b><br>");
|
||||||
for (i=1; i<ImgCache.pics_count; i++)
|
for (i=1; i<ImgCache.pics_count; i++)
|
||||||
{
|
{
|
||||||
|
strcat(history_pointer, "<a href='");
|
||||||
|
strcat(history_pointer, #pics[i].path);
|
||||||
|
strcat(history_pointer, "'>");
|
||||||
|
strcat(history_pointer, #pics[i].path);
|
||||||
|
strcat(history_pointer, "</a><br>");
|
||||||
|
/*
|
||||||
strcat(history_pointer, "<img src='");
|
strcat(history_pointer, "<img src='");
|
||||||
strcat(history_pointer, #pics[i].path);
|
strcat(history_pointer, #pics[i].path);
|
||||||
strcat(history_pointer, "'><br>");
|
strcat(history_pointer, "'><br>");
|
||||||
strcat(history_pointer, #pics[i].path);
|
strcat(history_pointer, #pics[i].path);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
strcat(history_pointer, "</body></html>");
|
strcat(history_pointer, "</body></html>");
|
||||||
WB1.LoadInternalPage(history_pointer, strlen(history_pointer));
|
WB1.LoadInternalPage(history_pointer, strlen(history_pointer));
|
||||||
|
@ -242,7 +242,7 @@ void ShowPage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawStatusBar() {return;};
|
void DrawStatusBar() {return;};
|
||||||
void ClickLink() {return;};
|
void EventClickLink() {return;};
|
||||||
void EventShowLinkMenu() {return;};
|
void EventShowLinkMenu() {return;};
|
||||||
|
|
||||||
char anchor[256];
|
char anchor[256];
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
#define SCAN_CODE_KEY_D 032
|
#define SCAN_CODE_KEY_D 032
|
||||||
#define SCAN_CODE_KEY_E 018
|
#define SCAN_CODE_KEY_E 018
|
||||||
#define SCAN_CODE_KEY_F 033
|
#define SCAN_CODE_KEY_F 033
|
||||||
|
#define SCAN_CODE_KEY_J 036
|
||||||
#define SCAN_CODE_KEY_H 035
|
#define SCAN_CODE_KEY_H 035
|
||||||
#define SCAN_CODE_KEY_I 023
|
#define SCAN_CODE_KEY_I 023
|
||||||
#define SCAN_CODE_KEY_L 038
|
#define SCAN_CODE_KEY_L 038
|
||||||
@ -88,6 +89,7 @@
|
|||||||
#define SCAN_CODE_KEY_T 020
|
#define SCAN_CODE_KEY_T 020
|
||||||
#define SCAN_CODE_KEY_U 022
|
#define SCAN_CODE_KEY_U 022
|
||||||
#define SCAN_CODE_KEY_V 047
|
#define SCAN_CODE_KEY_V 047
|
||||||
|
#define SCAN_CODE_KEY_W 017
|
||||||
#define SCAN_CODE_KEY_X 045
|
#define SCAN_CODE_KEY_X 045
|
||||||
#define SCAN_CODE_KEY_Y 021
|
#define SCAN_CODE_KEY_Y 021
|
||||||
#define SCAN_CODE_KEY_Z 044
|
#define SCAN_CODE_KEY_Z 044
|
||||||
|
@ -174,6 +174,8 @@ int check_is_the_url_absolute(dword _in)
|
|||||||
if(!strncmp(_in,"http:",5)) return true;
|
if(!strncmp(_in,"http:",5)) return true;
|
||||||
if(!strncmp(_in,"https:",6)) return true;
|
if(!strncmp(_in,"https:",6)) return true;
|
||||||
if(!strncmp(_in,"mailto:",7)) return true;
|
if(!strncmp(_in,"mailto:",7)) return true;
|
||||||
|
if(!strncmp(_in,"tel:",4)) return true;
|
||||||
|
if(!strncmp(_in,"#",1)) return true;
|
||||||
if(check_is_the_adress_local(_in)) return true;
|
if(check_is_the_adress_local(_in)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -936,9 +936,4 @@ inline signed strcoll(dword text1,text2)
|
|||||||
ESBYTE[in_str+length]=0;
|
ESBYTE[in_str+length]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define strnmov strmovn
|
|
||||||
#define stricmp strcmpi
|
|
||||||
#define strcmpn strncmp
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -416,6 +416,6 @@ int GetLetterSize_(int number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClickLink() {
|
void EventClickLink() {
|
||||||
RunProgram("/sys/network/WebView", PageLinks.GetURL(PageLinks.active));
|
RunProgram("/sys/network/WebView", PageLinks.GetURL(PageLinks.active));
|
||||||
}
|
}
|
@ -76,8 +76,8 @@ enum {
|
|||||||
int player_run_id;
|
int player_run_id;
|
||||||
int notify_run_id;
|
int notify_run_id;
|
||||||
|
|
||||||
bool repeat;
|
bool repeat=false;
|
||||||
bool shuffle;
|
bool shuffle=false;
|
||||||
|
|
||||||
int current_playing_file_n=0;
|
int current_playing_file_n=0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user