Rev 5990 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5990 | Rev 6731 | ||
---|---|---|---|
1 | CustomCursor CursorPointer; |
1 | CustomCursor CursorPointer; |
2 | dword CursorFile = FROM "../TWB/pointer.cur"; |
2 | dword CursorFile = FROM "../TWB/pointer.cur"; |
3 | 3 | ||
4 | #define NOLINE 0 |
4 | #define NOLINE 0 |
5 | #define UNDERLINE 1 |
5 | #define UNDERLINE 1 |
6 | 6 | ||
7 | struct array_link { |
7 | struct array_link { |
8 | dword link, text; |
8 | dword link, text; |
9 | int x,y,w,h; |
9 | int x,y,w,h; |
10 | int underline; |
10 | int underline; |
11 | }; |
11 | }; |
12 | 12 | ||
13 | struct LinksArray { |
13 | struct LinksArray { |
14 | array_link links[400]; |
14 | array_link links[400]; |
15 | char page_links[64000]; |
15 | char page_links[64000]; |
16 | dword buflen; |
16 | dword buflen; |
17 | int count, active; |
17 | int count, active; |
18 | void Hover(); |
18 | void Hover(); |
19 | void AddLink(); |
19 | void AddLink(); |
20 | void AddText(); |
20 | void AddText(); |
21 | dword GetURL(); |
21 | dword GetURL(); |
22 | void Clear(); |
22 | void Clear(); |
23 | } PageLinks; |
23 | } PageLinks; |
24 | 24 | ||
25 | void LinksArray::AddLink(dword lpath, int link_x, link_y) |
25 | void LinksArray::AddLink(dword lpath, int link_x, link_y) |
26 | { |
26 | { |
27 | links[count].x = link_x; |
27 | links[count].x = link_x; |
28 | links[count].y = link_y; |
28 | links[count].y = link_y; |
29 | 29 | ||
30 | links[count].link = buflen; |
30 | links[count].link = buflen; |
31 | strcpy(buflen, lpath); |
31 | strcpy(buflen, lpath); |
32 | buflen += strlen(lpath)+1; |
32 | buflen += strlen(lpath)+1; |
33 | count++; |
33 | count++; |
34 | } |
34 | } |
35 | 35 | ||
36 | void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline) |
36 | void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline) |
37 | { |
37 | { |
38 | if (count<1) return; |
38 | if (count<1) return; |
39 | links[count-1].w = link_w; |
39 | links[count-1].w = link_w; |
40 | links[count-1].h = link_h; |
40 | links[count-1].h = link_h; |
41 | links[count-1].underline = link_underline; |
41 | links[count-1].underline = link_underline; |
42 | 42 | ||
43 | links[count-1].text = buflen; |
43 | links[count-1].text = buflen; |
44 | strcpy(buflen, new_text); |
44 | strcpy(buflen, new_text); |
45 | buflen += strlen(new_text)+1; |
45 | buflen += strlen(new_text)+1; |
46 | } |
46 | } |
47 | 47 | ||
48 | dword LinksArray::GetURL(int id) |
48 | dword LinksArray::GetURL(int id) |
49 | { |
49 | { |
50 | return links[id].link; |
50 | return links[id].link; |
51 | } |
51 | } |
52 | 52 | ||
53 | void LinksArray::Clear() |
53 | void LinksArray::Clear() |
54 | { |
54 | { |
55 | int i; |
55 | int i; |
56 | for (i=0; i<=count; i++) DeleteButton(i+400); |
56 | for (i=0; i<=count; i++) DeleteButton(i+400); |
57 | buflen = #page_links; |
57 | buflen = #page_links; |
58 | count = 0; |
58 | count = 0; |
59 | active = -1; |
59 | active = -1; |
60 | CursorPointer.Restore(); |
60 | CursorPointer.Restore(); |
61 | } |
61 | } |
62 | 62 | ||
63 | char temp[sizeof(URL)]; |
63 | char temp[sizeof(URL)]; |
64 | PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0}; |
64 | PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0}; |
65 | 65 | ||
66 | void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col) |
66 | void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col) |
67 | { |
67 | { |
68 | int i; |
68 | int i; |
69 | signed int WBY = -WB1.list.first*WB1.list.item_h - WB1.DrawBuf.zoom; |
69 | signed int WBY = -WB1.list.first*WB1.list.item_h - WB1.DrawBuf.zoom; |
70 | for (i=0; i |
70 | for (i=0; i |
71 | { |
71 | { |
72 | if (mx>links[i].x) && (my>links[i].y) && (mx |
72 | if (mx>links[i].x) && (my>links[i].y) && (mx |
73 | { |
73 | { |
74 | if (mouse.down) DrawRectangle(links[active].x, links[active].y, links[active].w, links[active].h, 0); |
74 | if (mouse.down) DrawRectangle(links[active].x, -WB1.list.first*WB1.list.item_h + links[active].y, links[active].w, links[active].h, 0); |
75 | if (mouse.up) ClickLink(); |
75 | if (mouse.up) ClickLink(); |
76 | if (active==i) return; |
76 | if (active==i) return; |
77 | CursorPointer.Set(); |
77 | CursorPointer.Set(); |
78 | if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); |
78 | if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); |
79 | if (links[i].underline) DrawBar(links[i].x, WBY + links[i].y + links[i].h,links[i].w, WB1.DrawBuf.zoom, bg_col); |
79 | if (links[i].underline) DrawBar(links[i].x, WBY + links[i].y + links[i].h,links[i].w, WB1.DrawBuf.zoom, bg_col); |
80 | active = i; |
80 | active = i; |
81 | status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; |
81 | status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; |
82 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
82 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
83 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
83 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
84 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
84 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
85 | status_text.text_pointer = links[active].link; |
85 | status_text.text_pointer = links[active].link; |
86 | PathShow_prepare stdcall(#status_text); |
86 | PathShow_prepare stdcall(#status_text); |
87 | PathShow_draw stdcall(#status_text); |
87 | PathShow_draw stdcall(#status_text); |
88 | return; |
88 | return; |
89 | } |
89 | } |
90 | } |
90 | } |
91 | if (active!=-1) |
91 | if (active!=-1) |
92 | { |
92 | { |
93 | CursorPointer.Restore(); |
93 | CursorPointer.Restore(); |
94 | if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); |
94 | if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); |
95 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
95 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
96 | active = -1; |
96 | active = -1; |
97 | } |
97 | } |
98 | } |
98 | } |
99 | >=count;>1)> |
99 | >=count;>1)> |