2014-01-21 00:42:18 +01:00
|
|
|
CustomCursor CursorPointer;
|
|
|
|
dword CursorFile = FROM "../TWB/pointer.cur";
|
|
|
|
|
2014-01-30 19:28:50 +01:00
|
|
|
#define NOLINE 0
|
|
|
|
#define UNDERLINE 1
|
|
|
|
|
|
|
|
|
2014-01-19 23:46:58 +01:00
|
|
|
struct array_link {
|
|
|
|
dword link, text;
|
|
|
|
int x,y,w,h;
|
2014-01-30 19:28:50 +01:00
|
|
|
int underline;
|
2014-01-19 23:46:58 +01:00
|
|
|
};
|
2014-01-19 21:06:42 +01:00
|
|
|
|
|
|
|
struct LinksArray
|
|
|
|
{
|
2014-01-20 00:48:36 +01:00
|
|
|
array_link links[200];
|
|
|
|
char page_links[64000];
|
2014-01-19 23:46:58 +01:00
|
|
|
dword buflen;
|
|
|
|
int count, active;
|
|
|
|
|
|
|
|
void Hover();
|
|
|
|
void AddLink();
|
|
|
|
void AddText();
|
2014-01-19 21:06:42 +01:00
|
|
|
dword GetURL();
|
|
|
|
void Clear();
|
2014-03-23 18:12:21 +01:00
|
|
|
void GetAbsoluteURL();
|
2014-01-19 23:46:58 +01:00
|
|
|
};
|
2014-01-19 21:06:42 +01:00
|
|
|
|
2014-01-19 23:46:58 +01:00
|
|
|
void LinksArray::AddLink(dword new_link, int link_x, link_y)
|
2014-01-19 21:06:42 +01:00
|
|
|
{
|
2014-01-19 23:46:58 +01:00
|
|
|
links[count].x = link_x;
|
|
|
|
links[count].y = link_y;
|
|
|
|
|
|
|
|
links[count].link = buflen;
|
|
|
|
strcpy(buflen, new_link);
|
|
|
|
buflen += strlen(new_link)+1;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
2014-01-30 19:28:50 +01:00
|
|
|
void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline)
|
2014-01-19 23:46:58 +01:00
|
|
|
{
|
|
|
|
if (count<1) return;
|
|
|
|
links[count-1].w = link_w;
|
|
|
|
links[count-1].h = link_h;
|
2014-01-30 19:28:50 +01:00
|
|
|
links[count-1].underline = link_underline;
|
2014-01-19 23:46:58 +01:00
|
|
|
|
|
|
|
links[count-1].text = buflen;
|
|
|
|
strcpy(buflen, new_text);
|
|
|
|
buflen += strlen(new_text)+1;
|
2014-01-19 21:06:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dword LinksArray::GetURL(int id)
|
|
|
|
{
|
2014-01-19 23:46:58 +01:00
|
|
|
return links[id].link;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LinksArray::Clear()
|
|
|
|
{
|
2014-01-20 00:48:36 +01:00
|
|
|
int i;
|
|
|
|
for (i=0; i<=count; i++) DeleteButton(i+400);
|
2014-01-19 23:46:58 +01:00
|
|
|
buflen = #page_links;
|
|
|
|
count = 0;
|
|
|
|
active = -1;
|
2014-01-21 00:42:18 +01:00
|
|
|
CursorPointer.Restore();
|
2014-01-19 23:46:58 +01:00
|
|
|
}
|
|
|
|
|
2014-03-23 18:12:21 +01:00
|
|
|
char temp[sizeof(URL)];
|
2014-03-22 11:29:29 +01:00
|
|
|
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
|
2014-01-21 00:42:18 +01:00
|
|
|
|
2014-01-19 23:55:57 +01:00
|
|
|
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
|
2014-01-19 23:46:58 +01:00
|
|
|
{
|
|
|
|
int 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)
|
2014-01-19 21:06:42 +01:00
|
|
|
{
|
2014-01-21 00:42:18 +01:00
|
|
|
if (active==i) return;
|
|
|
|
CursorPointer.Set();
|
2015-03-16 15:20:32 +01:00
|
|
|
if (links[active].underline) DrawBar(links[active].x, WB1.list.line_h - WB1.DrawBuf.zoomf * WB1.DrawBuf.zoomf + links[active].y,links[active].w, WB1.DrawBuf.zoomf, link_col_in);
|
|
|
|
if (links[i].underline) DrawBar(links[i].x, WB1.list.line_h - WB1.DrawBuf.zoomf * WB1.DrawBuf.zoomf + links[i].y,links[i].w, WB1.DrawBuf.zoomf, bg_col);
|
2014-01-19 23:46:58 +01:00
|
|
|
active = i;
|
2015-03-16 15:20:32 +01:00
|
|
|
status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
|
|
|
|
status_text.start_y = Form.cheight - STATUSBAR_H + 3;
|
2014-03-30 13:57:13 +02:00
|
|
|
status_text.area_size_x = Form.cwidth - status_text.start_x -3;
|
|
|
|
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
|
2014-03-22 11:29:29 +01:00
|
|
|
status_text.text_pointer = links[active].link;
|
|
|
|
PathShow_prepare stdcall(#status_text);
|
|
|
|
PathShow_draw stdcall(#status_text);
|
2014-01-19 23:46:58 +01:00
|
|
|
return;
|
2014-01-19 21:06:42 +01:00
|
|
|
}
|
|
|
|
}
|
2014-01-21 00:42:18 +01:00
|
|
|
if (active!=-1)
|
|
|
|
{
|
|
|
|
CursorPointer.Restore();
|
2015-03-16 15:20:32 +01:00
|
|
|
if (links[active].underline) DrawBar(links[active].x, WB1.list.line_h - WB1.DrawBuf.zoomf * WB1.DrawBuf.zoomf + links[active].y,links[active].w, WB1.DrawBuf.zoomf, link_col_in);
|
2014-03-30 13:57:13 +02:00
|
|
|
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
|
2014-01-21 00:42:18 +01:00
|
|
|
active = -1;
|
|
|
|
}
|
2014-01-19 21:06:42 +01:00
|
|
|
}
|
|
|
|
|
2014-03-23 18:12:21 +01:00
|
|
|
char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/",
|
|
|
|
"/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", "WebView:", 0};
|
|
|
|
void LinksArray::GetAbsoluteURL(dword in_URL){
|
|
|
|
int i, len;
|
|
|
|
dword orig_URL = in_URL;
|
|
|
|
char newurl[sizeof(URL)];
|
|
|
|
|
|
|
|
for (i=0; ABSOLUTE_LINKS[i]; i++)
|
|
|
|
{
|
|
|
|
len=strlen(ABSOLUTE_LINKS[i]);
|
|
|
|
if (!strcmpn(in_URL, ABSOLUTE_LINKS[i], len)) return;
|
|
|
|
}
|
|
|
|
IF (!strcmpn(in_URL,"./", 2)) in_URL+=2;
|
|
|
|
strcpy(#newurl, BrowserHistory.CurrentUrl());
|
|
|
|
|
2015-07-29 22:06:46 +02:00
|
|
|
if (ESBYTE[in_URL] == '/') //remove everything after site domain name
|
2014-03-23 18:12:21 +01:00
|
|
|
{
|
|
|
|
i = strchr(#newurl+8, '/');
|
2015-07-29 22:06:46 +02:00
|
|
|
if (i) ESBYTE[i]=0;
|
2014-03-23 18:12:21 +01:00
|
|
|
in_URL+=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
_CUT_ST_LEVEL_MARK:
|
|
|
|
|
|
|
|
if (newurl[strrchr(#newurl, '/')-2]<>'/')
|
|
|
|
{
|
|
|
|
newurl[strrchr(#newurl, '/')] = 0x00;
|
|
|
|
}
|
|
|
|
|
|
|
|
IF (!strncmp(in_URL,"../",3))
|
|
|
|
{
|
|
|
|
in_URL+=3;
|
|
|
|
newurl[strrchr(#newurl, '/')-1] = 0x00;
|
|
|
|
goto _CUT_ST_LEVEL_MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
|
|
|
|
|
|
|
|
strcat(#newurl, in_URL);
|
|
|
|
strcpy(orig_URL, #newurl);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-19 23:46:58 +01:00
|
|
|
|
2014-01-20 00:48:36 +01:00
|
|
|
LinksArray PageLinks;
|