Subversion Repositories Kolibri OS

Rev

Rev 6794 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6794 Rev 6795
Line 6... Line 6...
6
#define UNDERLINE 1
6
#define UNDERLINE 1
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
#define MAXLINKS 400
8
#define MAXLINKS 400
9
 
9
 
10
struct array_link {
10
struct array_link {
11
	dword link, text;
11
	dword link;
12
	int x,y,w,h;
12
	int x,y,w,h;
Line 13... Line 13...
13
	int underline, underline_h;
13
	int underline, underline_h;
14
};
14
};
15
 
15
 
16
struct LinksArray {
16
struct LinksArray {
17
	array_link links[MAXLINKS];
17
	array_link links[MAXLINKS];
18
	collection page_links;
18
	collection page_links;
19
	dword buflen;
19
	int count;
20
	int count, active;
20
	int active;
21
	void Hover();
21
	bool HoverAndProceed();
22
	void AddLink();
22
	void AddLink();
23
	void AddText();
23
	void AddText();
Line 24... Line 24...
24
	dword GetURL();
24
	dword GetURL();
25
	void Clear();
25
	void Clear();
26
} PageLinks;
26
} PageLinks;
27
 
-
 
28
void LinksArray::AddLink(dword lpath, int link_x, link_y)
-
 
29
{
-
 
30
	if (count>= MAXLINKS) return;
27
 
31
	links[count].x = link_x;
-
 
32
	links[count].y = link_y;
-
 
33
 
28
void LinksArray::AddLink(dword lpath)
Line 34... Line 29...
34
	page_links.add(lpath);
29
{
35
	links[count].link = page_links.get(page_links.count-1);
30
	if (count>= MAXLINKS) return;
36
	count++;
31
	page_links.add(lpath);
-
 
32
}
-
 
33
 
37
}
34
void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h)
38
 
35
{
39
void LinksArray::AddText(dword link_w, link_h, link_underline, _underline_h, new_text)
36
	if (count>= MAXLINKS) return;
40
{
37
	links[count].x = _x;
41
	if (count>= MAXLINKS) || (!count) return;
-
 
42
	links[count-1].w = link_w;
-
 
43
	links[count-1].h = link_h;
38
	links[count].y = _y;
-
 
39
	links[count].w = _w;
44
	links[count-1].underline = link_underline;
40
	links[count].h = _h;
Line 45... Line 41...
45
	links[count-1].underline_h = _underline_h;
41
	links[count].underline = _link_underline;
46
 
42
	links[count].underline_h = _underline_h;
47
	page_links.add(new_text);
43
	links[count].link = page_links.get(page_links.count-1);
Line 63... Line 59...
63
}
59
}
Line 64... Line 60...
64
 
60
 
65
char temp[sizeof(URL)];
61
char temp[sizeof(URL)];
Line 66... Line 62...
66
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
62
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
67
 
63
 
68
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
64
bool LinksArray::HoverAndProceed(dword mx, my)
69
{
65
{
70
	int i;
66
	int i;
71
	for (i=0; i
67
	for (i=0; i
72
	{
68
	{
-
 
69
		if (mx>links[i].x) && (my>links[i].y) && (mx
73
		if (mx>links[i].x) && (my>links[i].y) && (mx
70
		{
74
		{
71
			if (mouse.lkm) && (mouse.down) {
-
 
72
				DrawRectangle(links[active].x, -WB1.list.first + links[active].y, 
-
 
73
				links[active].w, links[active].h, 0);
75
			if (mouse.down) DrawRectangle(links[active].x, -WB1.list.first + links[active].y, 
74
				return false;
-
 
75
			}
-
 
76
			if (mouse.mkm) && (mouse.up) {
-
 
77
			//	strcpy(#URL_temp, links[active].link);
-
 
78
			//	GetAbsoluteUrl(#URL_temp);
-
 
79
			//	RunProgram(#program_path, #URL_temp);
-
 
80
				return false;
-
 
81
			}
-
 
82
			if (mouse.lkm) && (mouse.up) { 
-
 
83
				CursorPointer.Restore();
-
 
84
				ClickLink();
-
 
85
				return false;
-
 
86
			}
-
 
87
			if (mouse.pkm) && (mouse.up) { 
-
 
88
			//	EventShowLinkMenu(mouse.x, mouse.y);
76
				links[active].w, links[active].h, 0);
89
				return false;
77
			if (mouse.up) ClickLink();
90
			}
78
			if (active==i) return;
91
			if (active==i) return false;
79
			CursorPointer.Set();
92
			CursorPointer.Set();
80
			if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y
93
			if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y
81
				+ links[active].h, links[active].w, links[i].underline_h, link_col_in);
94
				+ links[active].h, links[active].w, links[active].underline_h, link_color_inactive);
82
			if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y
95
			if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y
83
				+ links[i].h, links[i].w, links[i].underline_h, bg_col);
-
 
84
			active = i;
-
 
85
			status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
-
 
86
			status_text.start_y = Form.cheight - STATUSBAR_H + 3;
-
 
87
			status_text.area_size_x = Form.cwidth - status_text.start_x -3;
96
				+ links[i].h, links[i].w, links[i].underline_h, bg_color);
88
			DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
-
 
89
			status_text.text_pointer = links[active].link;
-
 
90
			PathShow_prepare stdcall(#status_text);
97
			active = i;
91
			PathShow_draw stdcall(#status_text);
98
			DrawStatusBar(links[active].link);
92
			return;
99
			return true;
93
		}
100
		}
94
	}
101
	}
95
	if (active!=-1)
102
	if (active!=-1)
-
 
103
	{
96
	{
104
		CursorPointer.Restore();
-
 
105
		if (links[active].underline) {
-
 
106
			DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h,links[active].w, 
97
		CursorPointer.Restore();
107
				links[active].underline_h, link_color_inactive);
98
		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);
108
		}
99
		DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
109
		DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
100
		active = -1;
110
		active = -1;
-
 
111
	}
-
 
112
}