2014-01-21 03:42:18 +04:00
|
|
|
CustomCursor CursorPointer;
|
|
|
|
dword CursorFile = FROM "../TWB/pointer.cur";
|
2016-11-22 17:04:10 +03:00
|
|
|
#include "..\lib\collection.h"
|
2014-01-21 03:42:18 +04:00
|
|
|
|
2014-01-30 22:28:50 +04:00
|
|
|
#define NOLINE 0
|
|
|
|
#define UNDERLINE 1
|
|
|
|
|
2016-11-22 17:04:10 +03:00
|
|
|
#define MAXLINKS 400
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
struct array_link {
|
2016-12-14 01:08:14 +03:00
|
|
|
dword link;
|
2014-01-20 02:46:58 +04:00
|
|
|
int x,y,w,h;
|
2016-12-12 01:58:11 +03:00
|
|
|
int underline, underline_h;
|
2014-01-20 02:46:58 +04:00
|
|
|
};
|
2014-01-20 00:06:42 +04:00
|
|
|
|
2015-08-26 22:22:20 +03:00
|
|
|
struct LinksArray {
|
2016-11-22 17:04:10 +03:00
|
|
|
array_link links[MAXLINKS];
|
|
|
|
collection page_links;
|
2016-12-14 01:08:14 +03:00
|
|
|
int count;
|
|
|
|
int active;
|
|
|
|
bool HoverAndProceed();
|
2014-01-20 02:46:58 +04:00
|
|
|
void AddLink();
|
|
|
|
void AddText();
|
2014-01-20 00:06:42 +04:00
|
|
|
dword GetURL();
|
|
|
|
void Clear();
|
2015-08-13 15:23:35 +03:00
|
|
|
} PageLinks;
|
2014-01-20 00:06:42 +04:00
|
|
|
|
2016-12-14 01:08:14 +03:00
|
|
|
void LinksArray::AddLink(dword lpath)
|
2014-01-20 00:06:42 +04:00
|
|
|
{
|
2016-11-22 17:04:10 +03:00
|
|
|
if (count>= MAXLINKS) return;
|
|
|
|
page_links.add(lpath);
|
2014-01-20 02:46:58 +04:00
|
|
|
}
|
|
|
|
|
2016-12-14 01:08:14 +03:00
|
|
|
void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h)
|
2014-01-20 02:46:58 +04:00
|
|
|
{
|
2016-12-14 01:08:14 +03:00
|
|
|
if (count>= MAXLINKS) return;
|
|
|
|
links[count].x = _x;
|
|
|
|
links[count].y = _y;
|
|
|
|
links[count].w = _w;
|
|
|
|
links[count].h = _h;
|
|
|
|
links[count].underline = _link_underline;
|
|
|
|
links[count].underline_h = _underline_h;
|
|
|
|
links[count].link = page_links.get(page_links.count-1);
|
|
|
|
count++;
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
dword LinksArray::GetURL(int id)
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
return links[id].link;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LinksArray::Clear()
|
|
|
|
{
|
2016-11-22 17:04:10 +03:00
|
|
|
page_links.drop();
|
|
|
|
page_links.realloc_size = 4096 * 32;
|
2014-01-20 02:46:58 +04:00
|
|
|
count = 0;
|
|
|
|
active = -1;
|
2014-01-21 03:42:18 +04:00
|
|
|
CursorPointer.Restore();
|
2014-01-20 02:46:58 +04:00
|
|
|
}
|
|
|
|
|
2014-03-23 21:12:21 +04:00
|
|
|
char temp[sizeof(URL)];
|
2014-03-22 14:29:29 +04:00
|
|
|
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
|
2014-01-21 03:42:18 +04:00
|
|
|
|
2016-12-14 01:08:14 +03:00
|
|
|
bool LinksArray::HoverAndProceed(dword mx, my)
|
2014-01-20 02:46:58 +04: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-20 00:06:42 +04:00
|
|
|
{
|
2016-12-14 01:08:14 +03:00
|
|
|
if (mouse.lkm) && (mouse.down) {
|
|
|
|
DrawRectangle(links[active].x, -WB1.list.first + links[active].y,
|
2016-12-12 01:58:11 +03:00
|
|
|
links[active].w, links[active].h, 0);
|
2016-12-14 01:08:14 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (mouse.mkm) && (mouse.up) {
|
2017-07-05 13:33:54 +03:00
|
|
|
open_in_a_new_window = true;
|
|
|
|
ClickLink();
|
2016-12-14 01:08:14 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (mouse.lkm) && (mouse.up) {
|
|
|
|
CursorPointer.Restore();
|
|
|
|
ClickLink();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (mouse.pkm) && (mouse.up) {
|
2017-10-01 14:57:00 +03:00
|
|
|
EventShowLinkMenu(mouse.x, mouse.y);
|
2016-12-14 01:08:14 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (active==i) return false;
|
2018-05-20 16:40:58 +03:00
|
|
|
CursorPointer.Load(#CursorFile);
|
2014-01-21 03:42:18 +04:00
|
|
|
CursorPointer.Set();
|
2016-12-12 01:58:11 +03:00
|
|
|
if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y
|
2016-12-14 01:08:14 +03:00
|
|
|
+ links[active].h, links[active].w, links[active].underline_h, link_color_inactive);
|
2016-12-12 01:58:11 +03:00
|
|
|
if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y
|
2016-12-14 01:08:14 +03:00
|
|
|
+ links[i].h, links[i].w, links[i].underline_h, bg_color);
|
2014-01-20 02:46:58 +04:00
|
|
|
active = i;
|
2016-12-14 01:08:14 +03:00
|
|
|
DrawStatusBar(links[active].link);
|
|
|
|
return true;
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
|
|
|
}
|
2014-01-21 03:42:18 +04:00
|
|
|
if (active!=-1)
|
|
|
|
{
|
|
|
|
CursorPointer.Restore();
|
2016-12-14 01:08:14 +03:00
|
|
|
if (links[active].underline) {
|
|
|
|
DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h,links[active].w,
|
|
|
|
links[active].underline_h, link_color_inactive);
|
|
|
|
}
|
2014-03-30 15:57:13 +04:00
|
|
|
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
|
2014-01-21 03:42:18 +04:00
|
|
|
active = -1;
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
2016-12-14 01:08:14 +03:00
|
|
|
|
|
|
|
|