Rev 7757 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7757 | Rev 7758 | ||
---|---|---|---|
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 2000 |
8 | #define MAXLINKS 2000 |
9 | 9 | ||
10 | struct array_link { |
10 | struct array_link { |
11 | dword link; |
11 | dword link; |
12 | unsigned int x,y,w,h; |
12 | unsigned int x,y,w,h; |
13 | unsigned int unic_id; |
13 | unsigned int unic_id; |
14 | int underline, underline_h; |
14 | int underline, underline_h; |
15 | }; |
15 | }; |
16 | 16 | ||
17 | struct LinksArray { |
17 | struct LinksArray { |
18 | array_link links[MAXLINKS]; |
18 | array_link links[MAXLINKS]; |
19 | collection page_links; |
19 | collection page_links; |
20 | unsigned int count; |
20 | unsigned int count; |
21 | unsigned int unic_count; |
21 | unsigned int unic_count; |
22 | unsigned int active; |
22 | unsigned int active; |
23 | bool HoverAndProceed(); |
23 | bool HoverAndProceed(); |
24 | void AddLink(); |
24 | void AddLink(); |
25 | void AddText(); |
25 | void AddText(); |
26 | dword GetURL(); |
26 | dword GetURL(); |
27 | void Clear(); |
27 | void Clear(); |
28 | void DrawUnderline(); |
28 | void DrawUnderline(); |
29 | } PageLinks; |
29 | } PageLinks; |
30 | 30 | ||
31 | void LinksArray::AddLink(dword lpath) |
31 | void LinksArray::AddLink(dword lpath) |
32 | { |
32 | { |
33 | if (count>= MAXLINKS) return; |
33 | if (count>= MAXLINKS) return; |
34 | page_links.add(lpath); |
34 | page_links.add(lpath); |
35 | unic_count++; |
35 | unic_count++; |
36 | } |
36 | } |
37 | 37 | ||
38 | void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h) |
38 | void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h) |
39 | { |
39 | { |
40 | if (count>= MAXLINKS) return; |
40 | if (count>= MAXLINKS) return; |
41 | links[count].x = _x; |
41 | links[count].x = _x; |
42 | links[count].y = _y; |
42 | links[count].y = _y; |
43 | links[count].w = _w; |
43 | links[count].w = _w; |
44 | links[count].h = _h; |
44 | links[count].h = _h; |
45 | links[count].underline = _link_underline; |
45 | links[count].underline = _link_underline; |
46 | links[count].underline_h = _underline_h; |
46 | links[count].underline_h = _underline_h; |
47 | links[count].link = page_links.get(page_links.count-1); |
47 | links[count].link = page_links.get(page_links.count-1); |
48 | links[count].unic_id = unic_count; |
48 | links[count].unic_id = unic_count; |
49 | count++; |
49 | count++; |
50 | } |
50 | } |
51 | 51 | ||
52 | dword LinksArray::GetURL(int id) |
52 | dword LinksArray::GetURL(int id) |
53 | { |
53 | { |
54 | return links[id].link; |
54 | return links[id].link; |
55 | } |
55 | } |
- | 56 | ||
56 | 57 | bool open_new_window=false; |
|
57 | void LinksArray::Clear() |
58 | void LinksArray::Clear() |
58 | { |
59 | { |
59 | page_links.drop(); |
60 | page_links.drop(); |
60 | page_links.realloc_size = 4096 * 32; |
61 | page_links.realloc_size = 4096 * 32; |
61 | count = 0; |
62 | count = 0; |
62 | active = -1; |
63 | active = -1; |
63 | unic_count = 0; |
64 | unic_count = 0; |
64 | CursorPointer.Restore(); |
65 | CursorPointer.Restore(); |
- | 66 | open_new_window = false; |
|
65 | } |
67 | } |
66 | 68 | ||
67 | void LinksArray::DrawUnderline(dword und_id, list_first, list_y, color) |
69 | void LinksArray::DrawUnderline(dword und_id, list_first, list_y, color) |
68 | { |
70 | { |
69 | int i; |
71 | int i; |
70 | for (i=0; i |
72 | for (i=0; i |
71 | { |
73 | { |
72 | if (links[i].unic_id==links[und_id].unic_id) && (links[i].y + links[i].h - list_first > list_y) { |
74 | if (links[i].unic_id==links[und_id].unic_id) && (links[i].y + links[i].h - list_first > list_y) { |
73 | DrawBar(links[i].x, links[i].y + links[i].h - list_first, links[i].w, links[i].underline_h, color); |
75 | DrawBar(links[i].x, links[i].y + links[i].h - list_first, links[i].w, links[i].underline_h, color); |
74 | } |
76 | } |
75 | } |
77 | } |
76 | } |
78 | } |
77 | 79 | ||
78 | PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, NULL, 0}; |
80 | PathShow_data status_text = {0, 17,250, 6, 250}; |
79 | 81 | ||
80 | bool LinksArray::HoverAndProceed(dword mx, my, list_y, list_first) |
82 | bool LinksArray::HoverAndProceed(dword mx, my, list_y, list_first) |
81 | { |
83 | { |
82 | int i; |
84 | int i; |
83 | if (!count) return true; |
85 | if (!count) return true; |
84 | for (i=0; i |
86 | for (i=0; i |
85 | { |
87 | { |
86 | if (mx>links[i].x) && (my>links[i].y) |
88 | if (mx>links[i].x) && (my>links[i].y) |
87 | && (mx |
89 | && (mx |
88 | && (my>list_y+list_first) |
90 | && (my>list_y+list_first) |
89 | { |
91 | { |
90 | if (mouse.lkm) && (mouse.down) { |
92 | if (mouse.lkm) && (mouse.down) { |
91 | DrawRectangle(links[active].x, -list_first + links[active].y, |
93 | DrawRectangle(links[active].x, -list_first + links[active].y, |
92 | links[active].w, links[active].h, 0); |
94 | links[active].w, links[active].h, 0); |
93 | return false; |
95 | return false; |
94 | } |
96 | } |
95 | if (mouse.mkm) && (mouse.up) { |
97 | if (mouse.mkm) && (mouse.up) { |
- | 98 | open_new_window = true; |
|
96 | RunProgram(#program_path, PageLinks.GetURL(PageLinks.active)); |
99 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
- | 100 | open_new_window = false; |
|
97 | return false; |
101 | return false; |
98 | } |
102 | } |
99 | if (mouse.lkm) && (mouse.up) { |
103 | if (mouse.lkm) && (mouse.up) { |
100 | CursorPointer.Restore(); |
104 | CursorPointer.Restore(); |
101 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
105 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
102 | return false; |
106 | return false; |
103 | } |
107 | } |
104 | if (mouse.pkm) && (mouse.up) { |
108 | if (mouse.pkm) && (mouse.up) { |
105 | EventShowLinkMenu(mouse.x, mouse.y); |
109 | EventShowLinkMenu(mouse.x, mouse.y); |
106 | return false; |
110 | return false; |
107 | } |
111 | } |
108 | if (active==i) return false; |
112 | if (active==i) return false; |
109 | CursorPointer.Load(#CursorFile); |
113 | CursorPointer.Load(#CursorFile); |
110 | CursorPointer.Set(); |
114 | CursorPointer.Set(); |
111 | 115 | ||
112 | if (links[active].underline) { |
116 | if (links[active].underline) { |
113 | DrawUnderline(active, list_first, list_y, link_color_inactive); |
117 | DrawUnderline(active, list_first, list_y, link_color_inactive); |
114 | } |
118 | } |
115 | 119 | ||
116 | if (links[i].underline) { |
120 | if (links[i].underline) { |
117 | DrawUnderline(i, list_first, list_y, page_bg); |
121 | DrawUnderline(i, list_first, list_y, page_bg); |
118 | } |
122 | } |
119 | 123 | ||
120 | active = i; |
124 | active = i; |
121 | DrawStatusBar(links[active].link); |
125 | DrawStatusBar(links[active].link); |
122 | return true; |
126 | return true; |
123 | } |
127 | } |
124 | } |
128 | } |
125 | if (active!=-1) |
129 | if (active!=-1) |
126 | { |
130 | { |
127 | CursorPointer.Restore(); |
131 | CursorPointer.Restore(); |
128 | if (links[active].underline) { |
132 | if (links[active].underline) { |
129 | DrawUnderline(active, list_first, list_y, link_color_inactive); |
133 | DrawUnderline(active, list_first, list_y, link_color_inactive); |
130 | } |
134 | } |
131 | DrawStatusBar(NULL); |
135 | DrawStatusBar(NULL); |
132 | active = -1; |
136 | active = -1; |
133 | } |
137 | } |
134 | } |
138 | } |
135 | > |
139 | > |