Rev 6931 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6931 | Rev 7037 | ||
---|---|---|---|
1 | CustomCursor CursorPointer; |
1 | CustomCursor CursorPointer; |
2 | dword CursorFile = FROM "../TWB/pointer.cur"; |
2 | dword CursorFile = FROM "../TWB/pointer.cur"; |
3 | #include "..\lib\collection.h" |
3 | #include "..\lib\collection.h" |
4 | 4 | ||
5 | #define NOLINE 0 |
5 | #define NOLINE 0 |
6 | #define UNDERLINE 1 |
6 | #define UNDERLINE 1 |
7 | 7 | ||
8 | #define MAXLINKS 400 |
8 | #define MAXLINKS 400 |
9 | 9 | ||
10 | struct array_link { |
10 | struct array_link { |
11 | dword link; |
11 | dword link; |
12 | int x,y,w,h; |
12 | int x,y,w,h; |
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 | int count; |
19 | int count; |
20 | int active; |
20 | int active; |
21 | bool HoverAndProceed(); |
21 | bool HoverAndProceed(); |
22 | void AddLink(); |
22 | void AddLink(); |
23 | void AddText(); |
23 | void AddText(); |
24 | dword GetURL(); |
24 | dword GetURL(); |
25 | void Clear(); |
25 | void Clear(); |
26 | } PageLinks; |
26 | } PageLinks; |
27 | 27 | ||
28 | void LinksArray::AddLink(dword lpath) |
28 | void LinksArray::AddLink(dword lpath) |
29 | { |
29 | { |
30 | if (count>= MAXLINKS) return; |
30 | if (count>= MAXLINKS) return; |
31 | page_links.add(lpath); |
31 | page_links.add(lpath); |
32 | } |
32 | } |
33 | 33 | ||
34 | void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h) |
34 | void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h) |
35 | { |
35 | { |
36 | if (count>= MAXLINKS) return; |
36 | if (count>= MAXLINKS) return; |
37 | links[count].x = _x; |
37 | links[count].x = _x; |
38 | links[count].y = _y; |
38 | links[count].y = _y; |
39 | links[count].w = _w; |
39 | links[count].w = _w; |
40 | links[count].h = _h; |
40 | links[count].h = _h; |
41 | links[count].underline = _link_underline; |
41 | links[count].underline = _link_underline; |
42 | links[count].underline_h = _underline_h; |
42 | links[count].underline_h = _underline_h; |
43 | links[count].link = page_links.get(page_links.count-1); |
43 | links[count].link = page_links.get(page_links.count-1); |
44 | count++; |
44 | count++; |
45 | } |
45 | } |
46 | 46 | ||
47 | dword LinksArray::GetURL(int id) |
47 | dword LinksArray::GetURL(int id) |
48 | { |
48 | { |
49 | return links[id].link; |
49 | return links[id].link; |
50 | } |
50 | } |
51 | 51 | ||
52 | void LinksArray::Clear() |
52 | void LinksArray::Clear() |
53 | { |
53 | { |
54 | page_links.drop(); |
54 | page_links.drop(); |
55 | page_links.realloc_size = 4096 * 32; |
55 | page_links.realloc_size = 4096 * 32; |
56 | count = 0; |
56 | count = 0; |
57 | active = -1; |
57 | active = -1; |
58 | CursorPointer.Restore(); |
58 | CursorPointer.Restore(); |
59 | } |
59 | } |
60 | 60 | ||
61 | char temp[sizeof(URL)]; |
61 | char temp[sizeof(URL)]; |
62 | 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}; |
63 | 63 | ||
64 | bool LinksArray::HoverAndProceed(dword mx, my) |
64 | bool LinksArray::HoverAndProceed(dword mx, my) |
65 | { |
65 | { |
66 | int i; |
66 | int i; |
67 | for (i=0; i |
67 | for (i=0; i |
68 | { |
68 | { |
69 | if (mx>links[i].x) && (my>links[i].y) && (mx |
69 | if (mx>links[i].x) && (my>links[i].y) && (mx |
70 | { |
70 | { |
71 | if (mouse.lkm) && (mouse.down) { |
71 | if (mouse.lkm) && (mouse.down) { |
72 | DrawRectangle(links[active].x, -WB1.list.first + links[active].y, |
72 | DrawRectangle(links[active].x, -WB1.list.first + links[active].y, |
73 | links[active].w, links[active].h, 0); |
73 | links[active].w, links[active].h, 0); |
74 | return false; |
74 | return false; |
75 | } |
75 | } |
76 | if (mouse.mkm) && (mouse.up) { |
76 | if (mouse.mkm) && (mouse.up) { |
77 | open_in_a_new_window = true; |
77 | open_in_a_new_window = true; |
78 | ClickLink(); |
78 | ClickLink(); |
79 | return false; |
79 | return false; |
80 | } |
80 | } |
81 | if (mouse.lkm) && (mouse.up) { |
81 | if (mouse.lkm) && (mouse.up) { |
82 | CursorPointer.Restore(); |
82 | CursorPointer.Restore(); |
83 | ClickLink(); |
83 | ClickLink(); |
84 | return false; |
84 | return false; |
85 | } |
85 | } |
86 | if (mouse.pkm) && (mouse.up) { |
86 | if (mouse.pkm) && (mouse.up) { |
87 | // EventShowLinkMenu(mouse.x, mouse.y); |
87 | EventShowLinkMenu(mouse.x, mouse.y); |
88 | return false; |
88 | return false; |
89 | } |
89 | } |
90 | if (active==i) return false; |
90 | if (active==i) return false; |
91 | CursorPointer.Set(); |
91 | CursorPointer.Set(); |
92 | if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y |
92 | if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y |
93 | + links[active].h, links[active].w, links[active].underline_h, link_color_inactive); |
93 | + links[active].h, links[active].w, links[active].underline_h, link_color_inactive); |
94 | if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y |
94 | if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y |
95 | + links[i].h, links[i].w, links[i].underline_h, bg_color); |
95 | + links[i].h, links[i].w, links[i].underline_h, bg_color); |
96 | active = i; |
96 | active = i; |
97 | DrawStatusBar(links[active].link); |
97 | DrawStatusBar(links[active].link); |
98 | return true; |
98 | return true; |
99 | } |
99 | } |
100 | } |
100 | } |
101 | if (active!=-1) |
101 | if (active!=-1) |
102 | { |
102 | { |
103 | CursorPointer.Restore(); |
103 | CursorPointer.Restore(); |
104 | if (links[active].underline) { |
104 | if (links[active].underline) { |
105 | DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h,links[active].w, |
105 | DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h,links[active].w, |
106 | links[active].underline_h, link_color_inactive); |
106 | links[active].underline_h, link_color_inactive); |
107 | } |
107 | } |
108 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
108 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
109 | active = -1; |
109 | active = -1; |
110 | } |
110 | } |
111 | } |
111 | } |
112 | > |
112 | > |