Rev 3363 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3363 | Rev 3449 | ||
---|---|---|---|
1 | int downloader_id; |
1 | int downloader_id; |
2 | 2 | ||
3 | dword |
3 | dword |
4 | buf, |
4 | buf, |
5 | filesize, |
5 | filesize, |
6 | blink; |
6 | blink; |
7 | 7 | ||
8 | char download_path[]="/rd/1/.download"; |
8 | char download_path[]="/rd/1/.download"; |
9 | char search_path[]="http://nigma.ru/index.php?s="; |
9 | char search_path[]="http://nigma.ru/index.php?s="; |
10 | char version[]=" Text-based Browser 0.98.2"; |
10 | char version[]=" Text-based Browser 0.98.2"; |
11 | 11 | ||
12 | 12 | ||
13 | struct TWebBrowser { |
13 | struct TWebBrowser { |
14 | int left, top, width, height; |
14 | int left, top, width, height; |
15 | void Scan(int); |
15 | void Scan(int); |
16 | void GetNewUrl(); |
16 | void GetNewUrl(); |
17 | void OpenPage(); |
17 | void OpenPage(); |
18 | void ReadHtml(byte); |
18 | void ReadHtml(byte); |
19 | void ShowPage(); |
19 | void ShowPage(); |
20 | void ParseHTML(dword); |
20 | void ParseHTML(dword); |
21 | void WhatTextStyle(int left1, top1, width1); |
21 | void WhatTextStyle(int left1, top1, width1); |
22 | void DrawPage(); |
22 | void DrawPage(); |
23 | void DrawScroller(); |
23 | void DrawScroller(); |
24 | }; |
24 | }; |
25 | 25 | ||
26 | byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, |
26 | byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, |
27 | link, ignor_text, li_tab, first_line_drawed, cur_encoding; |
27 | link, ignor_text, li_tab, first_line_drawed, cur_encoding; |
28 | 28 | ||
29 | TWebBrowser WB1; |
29 | TWebBrowser WB1; |
30 | 30 | ||
31 | 31 | ||
32 | dword text_colors[300], |
32 | dword text_colors[300], |
33 | text_color_index, |
33 | text_color_index, |
34 | link_color, |
34 | link_color, |
35 | bg_color; |
35 | bg_color; |
36 | 36 | ||
37 | int stroka, |
37 | int stroka, |
38 | stolbec, |
38 | stolbec, |
39 | tab_len; |
39 | tab_len; |
40 | 40 | ||
41 | char anchor[256]; |
41 | char anchor[256]; |
42 | int anchor_line_num; |
42 | int anchor_line_num; |
43 | 43 | ||
44 | char line[500], |
44 | char line[500], |
45 | tag[100], |
45 | tag[100], |
46 | tagparam[10000], |
46 | tagparam[10000], |
47 | parametr[1200], |
47 | parametr[1200], |
48 | options[4096]; |
48 | options[4096]; |
49 | 49 | ||
50 | #include "include\history.h" |
50 | #include "include\history.h" |
51 | #include "include\colors.h" |
51 | #include "include\colors.h" |
52 | #include "include\unicode_tags.h" |
52 | #include "include\unicode_tags.h" |
53 | #include "include\some_code.h" |
53 | #include "include\some_code.h" |
54 | #include "include\parce_tag.h" |
54 | #include "include\parce_tag.h" |
55 | 55 | ||
56 | 56 | ||
57 | void TWebBrowser::Scan(int id) |
57 | void TWebBrowser::Scan(int id) |
58 | { |
58 | { |
59 | if (id >= 400) |
59 | if (id >= 400) |
60 | { |
60 | { |
61 | GetURLfromPageLinks(id); |
61 | GetURLfromPageLinks(id); |
62 | 62 | ||
63 | //#1 |
63 | //#1 |
64 | if (URL[0] == '#') |
64 | if (URL[0] == '#') |
65 | { |
65 | { |
66 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
66 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
67 | 67 | ||
68 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
68 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
69 | 69 | ||
70 | lines.first=lines.all-lines.visible; |
70 | lines.first=lines.all-lines.visible; |
71 | ShowPage(); |
71 | ShowPage(); |
72 | return; |
72 | return; |
73 | } |
73 | } |
74 | //liner.ru#1 |
74 | //liner.ru#1 |
75 | if (strrchr(#URL, '#')<>-1) |
75 | if (strrchr(#URL, '#')<>-1) |
76 | { |
76 | { |
77 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
77 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
78 | URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
78 | URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
79 | } |
79 | } |
80 | 80 | ||
81 | GetNewUrl(); |
81 | GetNewUrl(); |
82 | 82 | ||
83 | if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) |
83 | if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) |
84 | { |
84 | { |
85 | //if (strstr(#URL,"http:")) |
85 | //if (strstr(#URL,"http:")) |
86 | RunProgram("/sys/media/kiv", #URL); |
86 | RunProgram("/sys/media/kiv", #URL); |
87 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
87 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
88 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
88 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
89 | return; |
89 | return; |
90 | } |
90 | } |
91 | if (!strcmpn(#URL,"mailto:", 7)) |
91 | if (!strcmpn(#URL,"mailto:", 7)) |
92 | { |
92 | { |
93 | RunProgram("@notify", #URL); |
93 | RunProgram("@notify", #URL); |
94 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
94 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
95 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
95 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
96 | return; |
96 | return; |
97 | } |
97 | } |
98 | 98 | ||
99 | OpenPage(); |
99 | OpenPage(); |
100 | return; |
100 | return; |
101 | } |
101 | } |
102 | 102 | ||
103 | IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
103 | IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
104 | { CASE 183: CASE 184: CASE 180: CASE 181: return; } |
104 | { CASE 183: CASE 184: CASE 180: CASE 181: return; } |
105 | 105 | ||
106 | switch (id) |
106 | switch (id) |
107 | { |
107 | { |
108 | case 011: //Ctrk+K |
108 | case 011: //Ctrk+K |
109 | ReadHtml(_KOI); |
109 | ReadHtml(_KOI); |
110 | break; |
110 | break; |
111 | case 021: //Ctrl+U |
111 | case 021: //Ctrl+U |
112 | ReadHtml(_UTF); |
112 | ReadHtml(_UTF); |
113 | break; |
113 | break; |
114 | case 004: //Ctrl+D |
114 | case 004: //Ctrl+D |
115 | ReadHtml(_DOS); |
115 | ReadHtml(_DOS); |
116 | break; |
116 | break; |
117 | case 001: |
117 | case 001: |
118 | if (!pre_text) pre_text=2; |
118 | if (!pre_text) pre_text=2; |
119 | else pre_text=0; |
119 | else pre_text=0; |
120 | break; |
120 | break; |
121 | case 002: //free img cache |
121 | case 002: //free img cache |
122 | FreeImgCache(); |
122 | FreeImgCache(); |
123 | break; |
123 | break; |
124 | case 005: //truetype |
124 | case 005: //truetype |
125 | if (use_truetype == 2) |
125 | if (use_truetype == 2) |
126 | { |
126 | { |
127 | RunProgram("@notify", "Library does not exists /rd/1/lib/truetype.obj"w); |
127 | RunProgram("@notify", "Library does not exists /rd/1/lib/truetype.obj"w); |
128 | return; |
128 | return; |
129 | } |
129 | } |
130 | if (use_truetype == 1) use_truetype=0; else use_truetype=1; |
130 | if (use_truetype == 1) use_truetype=0; else use_truetype=1; |
131 | break; |
131 | break; |
132 | case BACK: |
132 | case BACK: |
133 | if (!BrowserHistory.GoBack()) return; |
133 | if (!BrowserHistory.GoBack()) return; |
134 | OpenPage(); |
134 | OpenPage(); |
135 | return; |
135 | return; |
136 | case FORWARD: |
136 | case FORWARD: |
137 | if (!BrowserHistory.GoForward()) return; |
137 | if (!BrowserHistory.GoForward()) return; |
138 | OpenPage(); |
138 | OpenPage(); |
139 | return; |
139 | return; |
140 | case 052: //Íàæàòà F3 |
140 | case 052: //Íàæàòà F3 |
141 | if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); |
141 | if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); |
142 | return; |
142 | return; |
143 | case 054: //F5 |
143 | case 054: //F5 |
144 | IF(edit1.flags & 0b10) break; |
144 | IF(edit1.flags & 0b10) break; |
145 | case REFRESH: |
145 | case REFRESH: |
146 | if (GetProcessSlot(downloader_id)<>0) |
146 | if (GetProcessSlot(downloader_id)<>0) |
147 | { |
147 | { |
148 | KillProcess(downloader_id); |
148 | KillProcess(downloader_id); |
149 | pause(20); |
149 | pause(20); |
150 | Draw_Window(); |
150 | Draw_Window(); |
151 | return; |
151 | return; |
152 | } |
152 | } |
153 | anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
153 | anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
154 | anchor[0]='|'; |
154 | anchor[0]='|'; |
155 | OpenPage(); |
155 | OpenPage(); |
156 | return; |
156 | return; |
157 | case 014: //Ctrl+N íîâîå îêíî |
157 | case 014: //Ctrl+N íîâîå îêíî |
158 | case 020: //Ctrl+T íîâàÿ âêëàäêà |
158 | case 020: //Ctrl+T íîâàÿ âêëàäêà |
159 | case NEWTAB: |
159 | case NEWTAB: |
160 | MoveSize(190,80,OLD,OLD); |
160 | MoveSize(190,80,OLD,OLD); |
161 | RunProgram(#program_path, #URL); |
161 | RunProgram(#program_path, #URL); |
162 | return; |
162 | return; |
163 | 163 | ||
164 | case HOME: |
164 | case HOME: |
165 | strcpy(#editURL, "http://kolibri-os.narod.ru"); |
165 | strcpy(#editURL, "http://kolibri-n.org/index.php"); |
166 | case GOTOURL: |
166 | case GOTOURL: |
167 | case 0x0D: //enter |
167 | case 0x0D: //enter |
168 | strcpy(#URL, #editURL); |
168 | strcpy(#URL, #editURL); |
169 | OpenPage(); |
169 | OpenPage(); |
170 | return; |
170 | return; |
171 | case 173: //ctrl+enter |
171 | case 173: //ctrl+enter |
172 | case SEARCHWEB: |
172 | case SEARCHWEB: |
173 | strcpy(#URL, #search_path); |
173 | strcpy(#URL, #search_path); |
174 | strcat(#URL, #editURL); |
174 | strcat(#URL, #editURL); |
175 | OpenPage(); |
175 | OpenPage(); |
176 | return; |
176 | return; |
177 | 177 | ||
178 | case ID1: //ìîòàåì ââåðõ |
178 | case ID1: //ìîòàåì ââåðõ |
179 | IF(lines.first <= 0) return; |
179 | IF(lines.first <= 0) return; |
180 | lines.first--; |
180 | lines.first--; |
181 | break; |
181 | break; |
182 | case ID2: //ìîòàåì âíèç |
182 | case ID2: //ìîòàåì âíèç |
183 | IF(lines.visible + lines.first >= lines.all) return; |
183 | IF(lines.visible + lines.first >= lines.all) return; |
184 | lines.first++; |
184 | lines.first++; |
185 | break; |
185 | break; |
186 | case 183: //PgDown |
186 | case 183: //PgDown |
187 | IF(lines.first == lines.all - lines.visible) return; |
187 | IF(lines.first == lines.all - lines.visible) return; |
188 | lines.first += lines.visible + 2; |
188 | lines.first += lines.visible + 2; |
189 | IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; |
189 | IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; |
190 | break; |
190 | break; |
191 | case 184: //PgUp |
191 | case 184: //PgUp |
192 | IF(lines.first == 0) return; |
192 | IF(lines.first == 0) return; |
193 | lines.first -= lines.visible - 2; |
193 | lines.first -= lines.visible - 2; |
194 | IF(lines.first < 0) lines.first = 0; |
194 | IF(lines.first < 0) lines.first = 0; |
195 | break; |
195 | break; |
196 | case 180: //home |
196 | case 180: //home |
197 | IF(lines.first == 0) return; |
197 | IF(lines.first == 0) return; |
198 | lines.first = 0; |
198 | lines.first = 0; |
199 | break; |
199 | break; |
200 | case 181: //end |
200 | case 181: //end |
201 | IF (lines.first == lines.all - lines.visible) return; |
201 | IF (lines.first == lines.all - lines.visible) return; |
202 | lines.first = lines.all - lines.visible; |
202 | lines.first = lines.all - lines.visible; |
203 | break; |
203 | break; |
204 | default: |
204 | default: |
205 | return; |
205 | return; |
206 | } |
206 | } |
207 | ParseHTML(buf); |
207 | ParseHTML(buf); |
208 | } |
208 | } |
209 | 209 | ||
210 | 210 | ||
211 | char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/rd/", "/fd/", "/bd/", "/hd/", "/cd/", "/tmp/", 0}; |
211 | char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/rd/", "/fd/", "/bd/", "/hd/", "/cd/", "/tmp/", 0}; |
212 | 212 | ||
213 | //dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){ |
213 | //dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){ |
214 | void TWebBrowser::GetNewUrl(){ |
214 | void TWebBrowser::GetNewUrl(){ |
215 | int i, len; |
215 | int i, len; |
216 | 216 | ||
217 | for (i=0; ABSOLUTE_LINKS[i]; i++) |
217 | for (i=0; ABSOLUTE_LINKS[i]; i++) |
218 | { |
218 | { |
219 | len=strlen(ABSOLUTE_LINKS[i]); |
219 | len=strlen(ABSOLUTE_LINKS[i]); |
220 | if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return; |
220 | if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return; |
221 | } |
221 | } |
222 | 222 | ||
223 | IF (!strcmpn(#URL,"./", 2)) strcpy(#URL, #URL+2); //èãíîðèì :) |
223 | IF (!strcmpn(#URL,"./", 2)) strcpy(#URL, #URL+2); //èãíîðèì :) |
224 | if (URL[0] == '/') strcpy(#URL, #URL+1); |
224 | if (URL[0] == '/') strcpy(#URL, #URL+1); |
225 | 225 | ||
226 | strcpy(#editURL, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû |
226 | strcpy(#editURL, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû |
227 | 227 | ||
228 | _CUT_ST_LEVEL_MARK: |
228 | _CUT_ST_LEVEL_MARK: |
229 | 229 | ||
230 | if (editURL[strrchr(#editURL, '/')-2]<>'/') // åñëè íå http:// |
230 | if (editURL[strrchr(#editURL, '/')-2]<>'/') // åñëè íå http:// |
231 | { |
231 | { |
232 | editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
232 | editURL[strrchr(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
233 | } |
233 | } |
234 | 234 | ||
235 | IF (!strcmp(get_URL_part(3),"../")) //íà óðîâåíü ââåðõ |
235 | IF (!strcmp(get_URL_part(3),"../")) //íà óðîâåíü ââåðõ |
236 | { |
236 | { |
237 | strcpy(#URL,#URL+3); |
237 | strcpy(#URL,#URL+3); |
238 | editURL[strrchr(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
238 | editURL[strrchr(#editURL, '/')-1] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
239 | goto _CUT_ST_LEVEL_MARK; |
239 | goto _CUT_ST_LEVEL_MARK; |
240 | } |
240 | } |
241 | 241 | ||
242 | if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/"); |
242 | if (editURL[strlen(#editURL)-1]<>'/') strcat(#editURL, "/"); |
243 | 243 | ||
244 | strcat(#editURL, #URL); //êëåèì íîâûé àäðåñ |
244 | strcat(#editURL, #URL); //êëåèì íîâûé àäðåñ |
245 | strcpy(#URL, #editURL); |
245 | strcpy(#URL, #editURL); |
246 | } |
246 | } |
247 | 247 | ||
248 | 248 | ||
249 | 249 | ||
250 | void TWebBrowser::ReadHtml(byte encoding) |
250 | void TWebBrowser::ReadHtml(byte encoding) |
251 | { |
251 | { |
252 | if (!strcmp(get_URL_part(5),"http:"))) |
252 | if (!strcmp(get_URL_part(5),"http:"))) |
253 | file_size stdcall (#download_path); |
253 | file_size stdcall (#download_path); |
254 | else |
254 | else |
255 | file_size stdcall (#URL); |
255 | file_size stdcall (#URL); |
256 | 256 | ||
257 | filesize = EBX; |
257 | filesize = EBX; |
258 | if (!filesize) return; |
258 | if (!filesize) return; |
259 | 259 | ||
260 | mem_Free(buf); |
260 | mem_Free(buf); |
261 | buf = mem_Alloc(filesize); |
261 | buf = mem_Alloc(filesize); |
262 | if (!strcmp(get_URL_part(5),"http:"))) |
262 | if (!strcmp(get_URL_part(5),"http:"))) |
263 | ReadFile(0, filesize, buf, #download_path); |
263 | ReadFile(0, filesize, buf, #download_path); |
264 | else |
264 | else |
265 | ReadFile(0, filesize, buf, #URL); |
265 | ReadFile(0, filesize, buf, #URL); |
266 | 266 | ||
267 | cur_encoding = encoding; |
267 | cur_encoding = encoding; |
268 | if (encoding==_WIN) wintodos(buf); |
268 | if (encoding==_WIN) wintodos(buf); |
269 | if (encoding==_UTF) utf8rutodos(buf); |
269 | if (encoding==_UTF) utf8rutodos(buf); |
270 | if (encoding==_KOI) koitodos(buf); |
270 | if (encoding==_KOI) koitodos(buf); |
271 | } |
271 | } |
272 | 272 | ||
273 | 273 | ||
274 | void TWebBrowser::OpenPage() |
274 | void TWebBrowser::OpenPage() |
275 | { |
275 | { |
276 | if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal); |
276 | if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal); |
277 | KillProcess(downloader_id); |
277 | KillProcess(downloader_id); |
278 | strcpy(#editURL, #URL); |
278 | strcpy(#editURL, #URL); |
279 | BrowserHistory.AddUrl(); |
279 | BrowserHistory.AddUrl(); |
280 | strcpy(#header, #version); |
280 | strcpy(#header, #version); |
281 | pre_text =0; |
281 | pre_text =0; |
282 | if (!strcmp(get_URL_part(5),"http:"))) |
282 | if (!strcmp(get_URL_part(5),"http:"))) |
283 | { |
283 | { |
284 | KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ |
284 | KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ |
285 | DeleteFile(#download_path); |
285 | DeleteFile(#download_path); |
286 | IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL; |
286 | IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL; |
287 | downloader_id = RunProgram("/sys/network/downloader", #URL); |
287 | downloader_id = RunProgram("/sys/network/downloader", #URL); |
288 | //Browser Hack v2.0 |
288 | //Browser Hack v2.0 |
289 | pause(60); |
289 | pause(60); |
290 | if (GetProcessSlot(downloader_id)<>0) |
290 | if (GetProcessSlot(downloader_id)<>0) |
291 | { |
291 | { |
292 | debug("Browser Hack v2.0: Killing downloader and trying to run it one more!"); |
292 | debug("Browser Hack v2.0: Killing downloader and trying to run it one more!"); |
293 | KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ |
293 | KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ |
294 | downloader_id = RunProgram("/sys/network/downloader", #URL); |
294 | downloader_id = RunProgram("/sys/network/downloader", #URL); |
295 | } |
295 | } |
296 | // |
296 | // |
297 | IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable."); |
297 | IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable."); |
298 | Draw_Window(); |
298 | Draw_Window(); |
299 | return; |
299 | return; |
300 | } |
300 | } |
301 | lines.first = lines.all =0; |
301 | lines.first = lines.all =0; |
302 | ReadHtml(_WIN); |
302 | ReadHtml(_WIN); |
303 | WB1.ShowPage(); |
303 | WB1.ShowPage(); |
304 | } |
304 | } |
305 | 305 | ||
306 | 306 | ||
307 | void TWebBrowser::ShowPage() |
307 | void TWebBrowser::ShowPage() |
308 | { |
308 | { |
309 | edit1.size = edit1.pos = strlen(#editURL); |
309 | edit1.size = edit1.pos = strlen(#editURL); |
310 | edit1.offset=0; |
310 | edit1.offset=0; |
311 | edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà |
311 | edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà |
312 | 312 | ||
313 | if (!filesize) |
313 | if (!filesize) |
314 | { |
314 | { |
315 | DrawBar(left, top, width+4, height, 0xFFFFFF); //çàêðàøèâàåì âñ¸ äîíèçó |
315 | DrawBar(left, top, width+4, height, 0xFFFFFF); //çàêðàøèâàåì âñ¸ äîíèçó |
316 | if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading..."); |
316 | if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading..."); |
317 | else |
317 | else |
318 | { |
318 | { |
319 | WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors."); |
319 | WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors."); |
320 | if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration."); |
320 | if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration."); |
321 | } |
321 | } |
322 | //return; |
322 | //return; |
323 | } |
323 | } |
324 | else |
324 | else |
325 | ParseHTML(buf); |
325 | ParseHTML(buf); |
326 | 326 | ||
327 | if (!header) strcpy(#header, #version); |
327 | if (!header) strcpy(#header, #version); |
328 | if (!strcmp(#version, #header)) DrawTitle(#header); |
328 | if (!strcmp(#version, #header)) DrawTitle(#header); |
329 | } |
329 | } |
330 | 330 | ||
331 | 331 | ||
332 | 332 | ||
333 | void TWebBrowser::ParseHTML(dword bword){ |
333 | void TWebBrowser::ParseHTML(dword bword){ |
334 | word bukva[2]; |
334 | word bukva[2]; |
335 | int j, perenos_num; |
335 | int j, perenos_num; |
336 | byte ignor_param; |
336 | byte ignor_param; |
337 | char temp[768]; |
337 | char temp[768]; |
338 | 338 | ||
339 | stroka = -lines.first; |
339 | stroka = -lines.first; |
340 | stolbec = 0; |
340 | stolbec = 0; |
341 | 341 | ||
342 | for (j = 400; j < blink + 1; j++;) DeleteButton(j); |
342 | for (j = 400; j < blink + 1; j++;) DeleteButton(j); |
343 | blink = 400; |
343 | blink = 400; |
344 | 344 | ||
345 | b_text = i_text = u_text = s_text = blq_text = first_line_drawed = |
345 | b_text = i_text = u_text = s_text = blq_text = first_line_drawed = |
346 | li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè |
346 | li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè |
347 | link_color = 0x0000FF; |
347 | link_color = 0x0000FF; |
348 | bg_color = 0xFFFFFF; |
348 | bg_color = 0xFFFFFF; |
349 | line = NULL; |
349 | line = NULL; |
350 | strcpy(#page_links,"|"); |
350 | strcpy(#page_links,"|"); |
351 | strcpy(#header, #version); |
351 | strcpy(#header, #version); |
352 | 352 | ||
353 | if (pre_text<>2) |
353 | if (pre_text<>2) |
354 | { |
354 | { |
355 | pre_text=0; |
355 | pre_text=0; |
356 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
356 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
357 | if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
357 | if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
358 | } |
358 | } |
359 | 359 | ||
360 | for ( ; buf+filesize > bword; bword++;) |
360 | for ( ; buf+filesize > bword; bword++;) |
361 | { |
361 | { |
362 | bukva = ESBYTE[bword]; |
362 | bukva = ESBYTE[bword]; |
363 | if (ignor_text) && (bukva<>'<') continue; |
363 | if (ignor_text) && (bukva<>'<') continue; |
364 | switch (bukva) |
364 | switch (bukva) |
365 | { |
365 | { |
366 | case 0x0a: |
366 | case 0x0a: |
367 | if (pre_text) |
367 | if (pre_text) |
368 | { |
368 | { |
369 | bukva = temp = NULL; |
369 | bukva = temp = NULL; |
370 | goto NEXT_MARK; |
370 | goto NEXT_MARK; |
371 | } |
371 | } |
372 | case '\9': |
372 | case '\9': |
373 | if (pre_text) //èíà÷å èä¸ì íà 0x0d |
373 | if (pre_text) //èíà÷å èä¸ì íà 0x0d |
374 | { |
374 | { |
375 | tab_len=strlen(#line)/8; |
375 | tab_len=strlen(#line)/8; |
376 | tab_len=tab_len*8; |
376 | tab_len=tab_len*8; |
377 | tab_len=8+tab_len-strlen(#line); |
377 | tab_len=8+tab_len-strlen(#line); |
378 | for (j=0; j |
378 | for (j=0; j |
379 | break; |
379 | break; |
380 | } |
380 | } |
381 | case 0x0d: |
381 | case 0x0d: |
382 | bukva = ' '; |
382 | bukva = ' '; |
383 | goto DEFAULT_MARK; |
383 | goto DEFAULT_MARK; |
384 | case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 |
384 | case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 |
385 | if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; |
385 | if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; |
386 | 386 | ||
387 | bword++; |
387 | bword++; |
388 | bukva=ESBYTE[bword]; |
388 | bukva=ESBYTE[bword]; |
389 | strcpy(#temp,#bukva); |
389 | strcpy(#temp,#bukva); |
390 | bword++; |
390 | bword++; |
391 | bukva=ESBYTE[bword]; |
391 | bukva=ESBYTE[bword]; |
392 | strcat(#temp,#bukva); |
392 | strcat(#temp,#bukva); |
393 | 393 | ||
394 | bukva=Hex2Symb(#temp); |
394 | bukva=Hex2Symb(#temp); |
395 | if (bukva) goto DEFAULT_MARK; |
395 | if (bukva) goto DEFAULT_MARK; |
396 | break; |
396 | break; |
397 | 397 | ||
398 | case '&': // and so on |
398 | case '&': // and so on |
399 | bword++; |
399 | bword++; |
400 | tag=0; |
400 | tag=0; |
401 | for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;) |
401 | for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;) |
402 | { |
402 | { |
403 | bukva = ESBYTE[bword]; |
403 | bukva = ESBYTE[bword]; |
404 | strcat(#tag, #bukva); |
404 | strcat(#tag, #bukva); |
405 | } |
405 | } |
406 | 406 | ||
407 | bukva = GetUnicodeSymbol(); |
407 | bukva = GetUnicodeSymbol(); |
408 | if (bukva) goto DEFAULT_MARK; |
408 | if (bukva) goto DEFAULT_MARK; |
409 | break; |
409 | break; |
410 | case '<': |
410 | case '<': |
411 | bword++; //ïðîìîòàåì ñèìâîë < |
411 | bword++; //ïðîìîòàåì ñèìâîë < |
412 | tag = parametr = tagparam = ignor_param = NULL; |
412 | tag = parametr = tagparam = ignor_param = NULL; |
413 | if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî |
413 | if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî |
414 | { |
414 | { |
415 | bword++; |
415 | bword++; |
416 | if (ESBYTE[bword] == '-') |
416 | if (ESBYTE[bword] == '-') |
417 | { |
417 | { |
418 | HH_: |
418 | HH_: |
419 | do |
419 | do |
420 | { |
420 | { |
421 | bword++; |
421 | bword++; |
422 | if (buf + filesize <= bword) break 2; |
422 | if (buf + filesize <= bword) break 2; |
423 | } |
423 | } |
424 | while (ESBYTE[bword] <>'-'); |
424 | while (ESBYTE[bword] <>'-'); |
425 | 425 | ||
426 | bword++; |
426 | bword++; |
427 | if (ESBYTE[bword] <>'-') goto HH_; |
427 | if (ESBYTE[bword] <>'-') goto HH_; |
428 | } |
428 | } |
429 | } |
429 | } |
430 | while (ESBYTE[bword] !='>') && (bword < buf + filesize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
430 | while (ESBYTE[bword] !='>') && (bword < buf + filesize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
431 | { |
431 | { |
432 | bukva = ESBYTE[bword]; |
432 | bukva = ESBYTE[bword]; |
433 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
433 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
434 | if (!ignor_param) && (bukva <>' ') |
434 | if (!ignor_param) && (bukva <>' ') |
435 | { |
435 | { |
436 | if (strlen(#tag) |
436 | if (strlen(#tag) |
437 | } |
437 | } |
438 | else |
438 | else |
439 | { |
439 | { |
440 | ignor_param = true; |
440 | ignor_param = true; |
441 | if (!ignor_text) && (strlen(#tagparam)+1 |
441 | if (!ignor_text) && (strlen(#tagparam)+1 |
442 | } |
442 | } |
443 | bword++; |
443 | bword++; |
444 | } |
444 | } |
445 | strlwr(#tag); |
445 | strlwr(#tag); |
446 | strlwr(#tagparam); |
446 | strlwr(#tagparam); |
447 | 447 | ||
448 | if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/ |
448 | if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/ |
449 | if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam(); |
449 | if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam(); |
450 | 450 | ||
451 | if (stolbec + strlen(#line) > lines.column_max) |
451 | if (stolbec + strlen(#line) > lines.column_max) |
452 | { |
452 | { |
453 | perenos_num = strrchr(#line, ' '); |
453 | perenos_num = strrchr(#line, ' '); |
454 | if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; |
454 | if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; |
455 | strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì |
455 | strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì |
456 | line[perenos_num] = 0x00; |
456 | line[perenos_num] = 0x00; |
457 | if (stroka >= lines.visible) && (lines.first <>0) break 1; //óõîäèì... |
457 | if (stroka >= lines.visible) && (lines.first <>0) break 1; //óõîäèì... |
458 | DrawPage(); |
458 | DrawPage(); |
459 | strcpy(#line, #temp); |
459 | strcpy(#line, #temp); |
460 | 460 | ||
461 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
461 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
462 | } |
462 | } |
463 | DrawPage(); |
463 | DrawPage(); |
464 | line=NULL; |
464 | line=NULL; |
465 | 465 | ||
466 | if (tag) WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ |
466 | if (tag) WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ |
467 | 467 | ||
468 | tag = parametr = tagparam = ignor_param = NULL; |
468 | tag = parametr = tagparam = ignor_param = NULL; |
469 | break; |
469 | break; |
470 | default: |
470 | default: |
471 | DEFAULT_MARK: |
471 | DEFAULT_MARK: |
472 | if (!pre_text) && (bukva == ' ') |
472 | if (!pre_text) && (bukva == ' ') |
473 | { |
473 | { |
474 | if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä |
474 | if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä |
475 | if (!stolbec) && (!line) break; //ñòðîêà íå ìîæåò íà÷èíàòüñÿ ñ ïðîáåëà |
475 | if (!stolbec) && (!line) break; //ñòðîêà íå ìîæåò íà÷èíàòüñÿ ñ ïðîáåëà |
476 | } |
476 | } |
477 | if (strlen(#line) |
477 | if (strlen(#line) |
478 | 478 | ||
479 | if (stolbec + strlen(#line) > lines.column_max) |
479 | if (stolbec + strlen(#line) > lines.column_max) |
480 | { |
480 | { |
481 | NEXT_MARK: |
481 | NEXT_MARK: |
482 | perenos_num = strrchr(#line, ' '); |
482 | perenos_num = strrchr(#line, ' '); |
483 | if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; |
483 | if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; |
484 | strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì |
484 | strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì |
485 | line[perenos_num] = 0x00; |
485 | line[perenos_num] = 0x00; |
486 | if (stroka >= lines.visible) && (lines.first <>0) break 1; //óõîäèì... |
486 | if (stroka >= lines.visible) && (lines.first <>0) break 1; //óõîäèì... |
487 | DrawPage(); |
487 | DrawPage(); |
488 | strcpy(#line, #temp); |
488 | strcpy(#line, #temp); |
489 | 489 | ||
490 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
490 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
491 | } |
491 | } |
492 | } |
492 | } |
493 | } |
493 | } |
494 | 494 | ||
495 | DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä |
495 | DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä |
496 | if (lines.visible * 10 + 25 <= height) |
496 | if (lines.visible * 10 + 25 <= height) |
497 | DrawBar(left, lines.visible * 10 + top + 25, width - 15, -lines.visible * 10 + height - 25, bg_color); |
497 | DrawBar(left, lines.visible * 10 + top + 25, width - 15, -lines.visible * 10 + height - 25, bg_color); |
498 | if (stroka * 10 + 15 <= height) |
498 | if (stroka * 10 + 15 <= height) |
499 | DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà |
499 | DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà |
500 | if (lines.first == 0) lines.all = stroka; |
500 | if (lines.first == 0) lines.all = stroka; |
501 | if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
501 | if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
502 | { |
502 | { |
503 | anchor=NULL; |
503 | anchor=NULL; |
504 | lines.first=anchor_line_num; |
504 | lines.first=anchor_line_num; |
505 | ParseHTML(buf); |
505 | ParseHTML(buf); |
506 | } |
506 | } |
507 | DrawScroller(); |
507 | DrawScroller(); |
508 | } |
508 | } |
509 | 509 | ||
510 | void TWebBrowser::DrawPage() //ðåçàòü çäåñü!!1! |
510 | void TWebBrowser::DrawPage() //ðåçàòü çäåñü!!1! |
511 | { |
511 | { |
512 | int start_x, start_y, line_length; |
512 | int start_x, start_y, line_length; |
513 | char temp[sizeof(line)]; |
513 | char temp[sizeof(line)]; |
514 | 514 | ||
515 | if (!header) //&& (tag) |
515 | if (!header) //&& (tag) |
516 | { |
516 | { |
517 | if (strlen(#version)+strlen(#line)+2>sizeof(header)) |
517 | if (strlen(#version)+strlen(#line)+2>sizeof(header)) |
518 | { |
518 | { |
519 | strcpy(#temp, #line); |
519 | strcpy(#temp, #line); |
520 | temp[sizeof(header)-strlen(#version)-2]=0; |
520 | temp[sizeof(header)-strlen(#version)-2]=0; |
521 | strcpy(#header, #temp); |
521 | strcpy(#header, #temp); |
522 | strcpy(#line, #line+strlen(#temp)); |
522 | strcpy(#line, #line+strlen(#temp)); |
523 | } |
523 | } |
524 | else |
524 | else |
525 | { |
525 | { |
526 | strcpy(#header, #line); |
526 | strcpy(#header, #line); |
527 | line=0; |
527 | line=0; |
528 | } |
528 | } |
529 | strcat(#header, " -"); |
529 | strcat(#header, " -"); |
530 | strcat(#header, #version); |
530 | strcat(#header, #version); |
531 | return; |
531 | return; |
532 | } |
532 | } |
533 | 533 | ||
534 | if (stroka >= 0) && (stroka - 2 < lines.visible) && (line) && (!anchor) |
534 | if (stroka >= 0) && (stroka - 2 < lines.visible) && (line) && (!anchor) |
535 | { |
535 | { |
536 | if (!stroka) && (!stolbec) |
536 | if (!stroka) && (!stolbec) |
537 | { |
537 | { |
538 | DrawBar(left, top, width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
538 | DrawBar(left, top, width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
539 | first_line_drawed=1; |
539 | first_line_drawed=1; |
540 | } |
540 | } |
541 | 541 | ||
542 | start_x=stolbec * 6 + left+5; |
542 | start_x=stolbec * 6 + left+5; |
543 | start_y=stroka * 10 + top + 5; |
543 | start_y=stroka * 10 + top + 5; |
544 | line_length=strlen(#line)*6; |
544 | line_length=strlen(#line)*6; |
545 | 545 | ||
546 | if (use_truetype == 1) |
546 | if (use_truetype == 1) |
547 | { |
547 | { |
548 | //line_length = get_length stdcall (#line,-1,16,line_length); |
548 | //line_length = get_length stdcall (#line,-1,16,line_length); |
549 | text_out stdcall (#line, #fontlol, 17, text_colors[text_color_index], start_x, start_y-3); |
549 | text_out stdcall (#line, #fontlol, 17, text_colors[text_color_index], start_x, start_y-3); |
550 | } |
550 | } |
551 | else |
551 | else |
552 | { |
552 | { |
553 | WriteText(start_x, start_y, 0x80, text_colors[text_color_index], #line); |
553 | WriteText(start_x, start_y, 0x80, text_colors[text_color_index], #line); |
554 | IF (b_text) { $add ebx, 1<<16 $int 0x40 } |
554 | IF (b_text) { $add ebx, 1<<16 $int 0x40 } |
555 | } |
555 | } |
556 | IF (i_text) Skew(start_x, start_y, line_length+6, 10); |
556 | IF (i_text) Skew(start_x, start_y, line_length+6, 10); |
557 | IF (s_text) DrawBar(start_x, start_y + 4, line_length, 1, text_colors[text_color_index]); |
557 | IF (s_text) DrawBar(start_x, start_y + 4, line_length, 1, text_colors[text_color_index]); |
558 | IF (u_text) DrawBar(start_x, start_y + 8, line_length, 1, text_colors[text_color_index]); |
558 | IF (u_text) DrawBar(start_x, start_y + 8, line_length, 1, text_colors[text_color_index]); |
559 | IF (link) { |
559 | IF (link) { |
560 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9); |
560 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9); |
561 | DrawBar(start_x, start_y + 8, line_length, 1, text_colors[text_color_index]); |
561 | DrawBar(start_x, start_y + 8, line_length, 1, text_colors[text_color_index]); |
562 | } |
562 | } |
563 | stolbec += strlen(#line); |
563 | stolbec += strlen(#line); |
564 | } |
564 | } |
565 | } |
565 | } |
566 | 566 | ||
567 | 567 | ||
568 | char oldtag[100]; |
568 | char oldtag[100]; |
569 | void TWebBrowser::WhatTextStyle(int left1, top1, width1) { |
569 | void TWebBrowser::WhatTextStyle(int left1, top1, width1) { |
570 | dword hr_color; |
570 | dword hr_color; |
571 | 571 | ||
572 | //ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ |
572 | //ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ |
573 | if (tag[0] == '/') |
573 | if (tag[0] == '/') |
574 | { |
574 | { |
575 | rez = 0; |
575 | rez = 0; |
576 | strcpy(#tag, #tag+1); |
576 | strcpy(#tag, #tag+1); |
577 | } |
577 | } |
578 | else rez = 1; |
578 | else rez = 1; |
579 | 579 | ||
580 | if (!chTag("html")) |
580 | if (!chTag("html")) |
581 | { |
581 | { |
582 | IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0; |
582 | IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0; |
583 | return; |
583 | return; |
584 | } |
584 | } |
585 | 585 | ||
586 | if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez; |
586 | if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez; |
587 | 587 | ||
588 | if(!chTag("title")) |
588 | if(!chTag("title")) |
589 | { |
589 | { |
590 | if (rez) header=NULL; |
590 | if (rez) header=NULL; |
591 | else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó |
591 | else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó |
592 | return; |
592 | return; |
593 | } |
593 | } |
594 | 594 | ||
595 | if (ignor_text) return; |
595 | if (ignor_text) return; |
596 | 596 | ||
597 | 597 | ||
598 | 598 | ||
599 | IF(!chTag("q")) strcat(#line, "\""); |
599 | IF(!chTag("q")) strcat(#line, "\""); |
600 | 600 | ||
601 | if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
601 | if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
602 | { |
602 | { |
603 | if (!strcmp(#anchor, #options)) anchor_line_num=lines.first+stroka; |
603 | if (!strcmp(#anchor, #options)) anchor_line_num=lines.first+stroka; |
604 | } |
604 | } |
605 | 605 | ||
606 | if (!chTag("body")) |
606 | if (!chTag("body")) |
607 | { |
607 | { |
608 | do{ |
608 | do{ |
609 | if (!strcmp(#parametr, "link=")) link_color = GetColor(#options); |
609 | if (!strcmp(#parametr, "link=")) link_color = GetColor(#options); |
610 | if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); |
610 | if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); |
611 | if (!strcmp(#parametr, "bgcolor=")) bg_color=GetColor(#options); |
611 | if (!strcmp(#parametr, "bgcolor=")) bg_color=GetColor(#options); |
612 | } while(GetNextParam()); |
612 | } while(GetNextParam()); |
613 | return; |
613 | return; |
614 | } |
614 | } |
615 | 615 | ||
616 | if (!chTag("a")) |
616 | if (!chTag("a")) |
617 | { |
617 | { |
618 | if (rez) |
618 | if (rez) |
619 | { |
619 | { |
620 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò |
620 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò |
621 | 621 | ||
622 | do{ |
622 | do{ |
623 | if (!strcmp(#parametr, "href=")) |
623 | if (!strcmp(#parametr, "href=")) |
624 | { |
624 | { |
625 | if (stroka - 1 > lines.visible) || (stroka < -2) return; |
625 | if (stroka - 1 > lines.visible) || (stroka < -2) return; |
626 | 626 | ||
627 | text_color_index++; |
627 | text_color_index++; |
628 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
628 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
629 | 629 | ||
630 | link = 1; |
630 | link = 1; |
631 | blink++; |
631 | blink++; |
632 | text_colors[text_color_index] = link_color; |
632 | text_colors[text_color_index] = link_color; |
633 | strcat(#page_links, #options); |
633 | strcat(#page_links, #options); |
634 | strcat(#page_links, "|"); |
634 | strcat(#page_links, "|"); |
635 | } |
635 | } |
636 | if (anchor) && (!strcmp(#parametr, "name=")) |
636 | if (anchor) && (!strcmp(#parametr, "name=")) |
637 | { |
637 | { |
638 | if (!strcmp(#anchor, #options)) |
638 | if (!strcmp(#anchor, #options)) |
639 | { |
639 | { |
640 | anchor_line_num=lines.first+stroka; |
640 | anchor_line_num=lines.first+stroka; |
641 | } |
641 | } |
642 | } |
642 | } |
643 | } while(GetNextParam()); |
643 | } while(GetNextParam()); |
644 | } |
644 | } |
645 | else { |
645 | else { |
646 | link = 0; |
646 | link = 0; |
647 | IF(text_color_index > 0) text_color_index--; |
647 | IF(text_color_index > 0) text_color_index--; |
648 | } |
648 | } |
649 | return; |
649 | return; |
650 | } |
650 | } |
651 | 651 | ||
652 | if (!chTag("font")) |
652 | if (!chTag("font")) |
653 | { |
653 | { |
654 | if (rez) |
654 | if (rez) |
655 | { |
655 | { |
656 | text_color_index++; |
656 | text_color_index++; |
657 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
657 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
658 | 658 | ||
659 | do{ |
659 | do{ |
660 | if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') |
660 | if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') |
661 | { |
661 | { |
662 | text_colors[text_color_index] = GetColor(#options); |
662 | text_colors[text_color_index] = GetColor(#options); |
663 | } |
663 | } |
664 | } while(GetNextParam()); |
664 | } while(GetNextParam()); |
665 | } |
665 | } |
666 | else |
666 | else |
667 | if (text_color_index > 0) text_color_index--; |
667 | if (text_color_index > 0) text_color_index--; |
668 | return; |
668 | return; |
669 | } |
669 | } |
670 | if(!chTag("tr")) || (!chTag("br")) { |
670 | if(!chTag("tr")) || (!chTag("br")) { |
671 | TextGoDown(left1, top1, width1); |
671 | TextGoDown(left1, top1, width1); |
672 | return; |
672 | return; |
673 | } |
673 | } |
674 | if (!chTag("div")) { |
674 | if (!chTag("div")) { |
675 | IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1); |
675 | IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1); |
676 | return; |
676 | return; |
677 | } |
677 | } |
678 | if (!chTag("p")) { |
678 | if (!chTag("p")) { |
679 | IF(oldtag[0] == 'h') return; |
679 | IF(oldtag[0] == 'h') return; |
680 | TextGoDown(left1, top1, width1); |
680 | TextGoDown(left1, top1, width1); |
681 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
681 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
682 | return; |
682 | return; |
683 | } |
683 | } |
684 | if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) { |
684 | if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) { |
685 | TextGoDown(left1, top1, width1); |
685 | TextGoDown(left1, top1, width1); |
686 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
686 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
687 | b_text = rez; |
687 | b_text = rez; |
688 | strcpy(#oldtag, #tag); |
688 | strcpy(#oldtag, #tag); |
689 | return; |
689 | return; |
690 | } |
690 | } |
691 | else |
691 | else |
692 | oldtag=NULL; |
692 | oldtag=NULL; |
693 | 693 | ||
694 | if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) { |
694 | if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) { |
695 | b_text = rez; |
695 | b_text = rez; |
696 | return; |
696 | return; |
697 | } |
697 | } |
698 | if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) { |
698 | if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) { |
699 | i_text = rez; |
699 | i_text = rez; |
700 | return; |
700 | return; |
701 | } |
701 | } |
702 | if (!chTag("dt")) |
702 | if (!chTag("dt")) |
703 | { |
703 | { |
704 | li_text = rez; |
704 | li_text = rez; |
705 | IF(rez == 0) return; |
705 | IF(rez == 0) return; |
706 | TextGoDown(left1, top1, width1); |
706 | TextGoDown(left1, top1, width1); |
707 | return; |
707 | return; |
708 | } |
708 | } |
709 | if(!chTag("li")) || (!chTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè |
709 | if(!chTag("li")) || (!chTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè |
710 | { |
710 | { |
711 | li_text = rez; |
711 | li_text = rez; |
712 | IF(rez == 0) return; |
712 | IF(rez == 0) return; |
713 | TextGoDown(left1, top1, width1); |
713 | TextGoDown(left1, top1, width1); |
714 | IF(stroka > -1) && (stroka - 2 < lines.visible) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0); |
714 | IF(stroka > -1) && (stroka - 2 < lines.visible) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0); |
715 | return; |
715 | return; |
716 | } |
716 | } |
717 | if (!chTag("u")) || (!chTag("ins")) u_text = rez; |
717 | if (!chTag("u")) || (!chTag("ins")) u_text = rez; |
718 | if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez; |
718 | if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez; |
719 | if (!chTag("ul")) || (!chTag("ol")) IF(!rez) |
719 | if (!chTag("ul")) || (!chTag("ol")) IF(!rez) |
720 | { |
720 | { |
721 | li_text = rez; |
721 | li_text = rez; |
722 | li_tab--; |
722 | li_tab--; |
723 | TextGoDown(left1, top1, width1); |
723 | TextGoDown(left1, top1, width1); |
724 | } ELSE li_tab++; |
724 | } ELSE li_tab++; |
725 | if (!chTag("dd")) stolbec += 5; |
725 | if (!chTag("dd")) stolbec += 5; |
726 | if (!chTag("blockquote")) blq_text = rez; |
726 | if (!chTag("blockquote")) blq_text = rez; |
727 | if (!chTag("pre")) pre_text = rez; |
727 | if (!chTag("pre")) pre_text = rez; |
728 | if (!chTag("hr")) |
728 | if (!chTag("hr")) |
729 | { |
729 | { |
730 | TextGoDown(left1, top1, width1); |
730 | TextGoDown(left1, top1, width1); |
731 | TextGoDown(left1, top1 + 10, width1); |
731 | TextGoDown(left1, top1 + 10, width1); |
732 | if (anchor) return; |
732 | if (anchor) return; |
733 | IF(strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); |
733 | IF(strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); |
734 | ELSE hr_color = 0x999999; |
734 | ELSE hr_color = 0x999999; |
735 | IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color); |
735 | IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color); |
736 | } |
736 | } |
737 | if (!chTag("input")) |
737 | if (!chTag("input")) |
738 | { |
738 | { |
739 | do{ |
739 | do{ |
740 | if (!strcmp(#parametr, "type=")) if ((!strcmp(#options, "radio")) || (!strcmp(#options, "checkbox"))) |
740 | if (!strcmp(#parametr, "type=")) if ((!strcmp(#options, "radio")) || (!strcmp(#options, "checkbox"))) |
741 | { |
741 | { |
742 | if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,10,10, 0, "\0", 0x888888, text_colors[text_color_index], 0); |
742 | if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,10,10, 0, "\0", 0x888888, text_colors[text_color_index], 0); |
743 | stolbec+=2; |
743 | stolbec+=2; |
744 | } |
744 | } |
745 | if (!strcmp(#parametr, "type=")) if ((!strcmp(#options, "text")) || (!strcmp(#options, "password"))) |
745 | if (!strcmp(#parametr, "type=")) if ((!strcmp(#options, "text")) || (!strcmp(#options, "password"))) |
746 | { |
746 | { |
747 | if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,90,10, 0, "\0", 0x555555, 0, 0); |
747 | if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,90,10, 0, "\0", 0x555555, 0, 0); |
748 | stolbec+=16; |
748 | stolbec+=16; |
749 | } |
749 | } |
750 | if (!strcmp(#parametr, "type=")) if ((!strcmp(#options, "button")) || (!strcmp(#options, "file")) || (!strcmp(#options, "submit"))) |
750 | if (!strcmp(#parametr, "type=")) if ((!strcmp(#options, "button")) || (!strcmp(#options, "file")) || (!strcmp(#options, "submit"))) |
751 | { |
751 | { |
752 | if (!anchor) && (stroka > 0) DrawCaptButton(stolbec*6 + left1,top1-2,60,10, 0, 0xCCCccc, 0, "Button"); |
752 | if (!anchor) && (stroka > 0) DrawCaptButton(stolbec*6 + left1,top1-2,60,10, 0, 0xCCCccc, 0, "Button"); |
753 | stolbec+=21; |
753 | stolbec+=21; |
754 | } |
754 | } |
755 | } while(GetNextParam()); |
755 | } while(GetNextParam()); |
756 | } |
756 | } |
757 | if (!chTag("img")) |
757 | if (!chTag("img")) |
758 | { |
758 | { |
759 | Images( left1, top1, width1); |
759 | Images( left1, top1, width1); |
760 | return; |
760 | return; |
761 | } |
761 | } |
762 | if (!chTag("meta")) || (!chTag("?xml")) |
762 | if (!chTag("meta")) || (!chTag("?xml")) |
763 | { |
763 | { |
764 | do{ |
764 | do{ |
765 | if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding=")) |
765 | if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding=")) |
766 | { |
766 | { |
767 | strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content= |
767 | strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content= |
768 | if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF); |
768 | if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF); |
769 | if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI); |
769 | if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI); |
770 | if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) ReadHtml(_DOS); |
770 | if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) ReadHtml(_DOS); |
771 | } |
771 | } |
772 | } while(GetNextParam()); |
772 | } while(GetNextParam()); |
773 | return; |
773 | return; |
774 | } |
774 | } |
775 | } |
775 | } |
776 | 776 | ||
777 | 777 | ||
778 | void TextGoDown(int left1, top1, width1) |
778 | void TextGoDown(int left1, top1, width1) |
779 | { |
779 | { |
780 | if (!stroka) && (!stolbec) && (!first_line_drawed) |
780 | if (!stroka) && (!stolbec) && (!first_line_drawed) |
781 | { |
781 | { |
782 | DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
782 | DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
783 | first_line_drawed=1; |
783 | first_line_drawed=1; |
784 | } |
784 | } |
785 | stroka++; |
785 | stroka++; |
786 | if (blq_text) stolbec = 8; |
786 | if (blq_text) stolbec = 8; |
787 | ELSE stolbec = 0; |
787 | ELSE stolbec = 0; |
788 | if (li_text) stolbec = li_tab * 5; |
788 | if (li_text) stolbec = li_tab * 5; |
789 | IF(stroka >= 0) && (stroka - 2 < lines.visible) && (!anchor) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color); |
789 | IF(stroka >= 0) && (stroka - 2 < lines.visible) && (!anchor) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color); |
790 | } |
790 | } |
791 | 791 | ||
792 | 792 | ||
793 | struct s_image |
793 | struct s_image |
794 | { |
794 | { |
795 | dword *image; |
795 | dword *image; |
796 | char path[4096]; |
796 | char path[4096]; |
797 | }; |
797 | }; |
798 | s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) ); |
798 | s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) ); |
799 | int num_of_pics; |
799 | int num_of_pics; |
800 | 800 | ||
801 | int GetOrSetPicNum(dword i_path) |
801 | int GetOrSetPicNum(dword i_path) |
802 | { |
802 | { |
803 | int i; |
803 | int i; |
804 | for (i=0; i |
804 | for (i=0; i |
805 | { |
805 | { |
806 | if (!strcmp(#pics[i].path, i_path)) return i; |
806 | if (!strcmp(#pics[i].path, i_path)) return i; |
807 | } |
807 | } |
808 | num_of_pics++; |
808 | num_of_pics++; |
809 | return num_of_pics; |
809 | return num_of_pics; |
810 | } |
810 | } |
811 | 811 | ||
812 | void FreeImgCache() |
812 | void FreeImgCache() |
813 | { |
813 | { |
814 | int i; |
814 | int i; |
815 | for (i=0; i<=num_of_pics; i++) |
815 | for (i=0; i<=num_of_pics; i++) |
816 | { |
816 | { |
817 | img_destroy stdcall (pics[num_of_pics].image); |
817 | img_destroy stdcall (pics[num_of_pics].image); |
818 | pics[num_of_pics].path = NULL; |
818 | pics[num_of_pics].path = NULL; |
819 | } |
819 | } |
820 | num_of_pics=0; |
820 | num_of_pics=0; |
821 | } |
821 | } |
822 | 822 | ||
823 | 823 | ||
824 | void Images(int left1, top1, width1) |
824 | void Images(int left1, top1, width1) |
825 | { |
825 | { |
826 | dword image; |
826 | dword image; |
827 | char img_path[4096], alt[4096]; |
827 | char img_path[4096], alt[4096]; |
828 | int w=0, h=0, img_lines_first=0, cur_pic=0; |
828 | int w=0, h=0, img_lines_first=0, cur_pic=0; |
829 | 829 | ||
830 | do{ |
830 | do{ |
831 | if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl() |
831 | if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl() |
832 | { |
832 | { |
833 | if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item); |
833 | if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item); |
834 | else strcpy(#img_path, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû |
834 | else strcpy(#img_path, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû |
835 | 835 | ||
836 | if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0) |
836 | if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0) |
837 | { |
837 | { |
838 | img_path[strrchr(#img_path, '/')] = '\0'; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
838 | img_path[strrchr(#img_path, '/')] = '\0'; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî / |
839 | strcat(#img_path, #options); |
839 | strcat(#img_path, #options); |
840 | 840 | ||
841 | cur_pic=GetOrSetPicNum(#img_path); |
841 | cur_pic=GetOrSetPicNum(#img_path); |
842 | if (!pics[cur_pic].path) |
842 | if (!pics[cur_pic].path) |
843 | { |
843 | { |
844 | pics[cur_pic].image=load_image(#img_path); |
844 | pics[cur_pic].image=load_image(#img_path); |
845 | strcpy(#pics[cur_pic].path, #img_path); |
845 | strcpy(#pics[cur_pic].path, #img_path); |
846 | } |
846 | } |
847 | } |
847 | } |
848 | } |
848 | } |
849 | if (!strcmp(#parametr,"alt=")) |
849 | if (!strcmp(#parametr,"alt=")) |
850 | { |
850 | { |
851 | strcpy(#alt, "["); |
851 | strcpy(#alt, "["); |
852 | strcat(#alt, #options); |
852 | strcat(#alt, #options); |
853 | strcat(#alt, "]"); |
853 | strcat(#alt, "]"); |
854 | } |
854 | } |
855 | 855 | ||
856 | } while(GetNextParam()); |
856 | } while(GetNextParam()); |
857 | 857 | ||
858 | if (!pics[cur_pic].image) |
858 | if (!pics[cur_pic].image) |
859 | { |
859 | { |
860 | if (alt) && (link) strcat(#line, #alt); |
860 | if (alt) && (link) strcat(#line, #alt); |
861 | return; |
861 | return; |
862 | } |
862 | } |
863 | 863 | ||
864 | w=DSWORD[pics[cur_pic].image+4]; |
864 | w=DSWORD[pics[cur_pic].image+4]; |
865 | h=DSWORD[pics[cur_pic].image+8]; |
865 | h=DSWORD[pics[cur_pic].image+8]; |
866 | if (w>width1) w=width1; |
866 | if (w>width1) w=width1; |
867 | 867 | ||
868 | if (stroka==0) DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
868 | if (stroka==0) DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
869 | stroka+=h/10; |
869 | stroka+=h/10; |
870 | if (top1+h |
870 | if (top1+h |
871 | if (top1 |
871 | if (top1 |
872 | { |
872 | { |
873 | DrawBar(WB1.left, WB1.top, WB1.width-15, 10, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
873 | DrawBar(WB1.left, WB1.top, WB1.width-15, 10, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó |
874 | img_lines_first=WB1.top-top1; |
874 | img_lines_first=WB1.top-top1; |
875 | h=h-img_lines_first; |
875 | h=h-img_lines_first; |
876 | top1=WB1.top; |
876 | top1=WB1.top; |
877 | } |
877 | } |
878 | if (top1>WB1.top+WB1.height-h-15) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó |
878 | if (top1>WB1.top+WB1.height-h-15) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó |
879 | { |
879 | { |
880 | h=WB1.top+WB1.height-top1-15; |
880 | h=WB1.top+WB1.height-top1-15; |
881 | } |
881 | } |
882 | if (h<=0) return; |
882 | if (h<=0) return; |
883 | if (anchor) return; |
883 | if (anchor) return; |
884 | 884 | ||
885 | img_draw stdcall (pics[cur_pic].image,left1-5,top1+10,w, h,0,img_lines_first); |
885 | img_draw stdcall (pics[cur_pic].image,left1-5,top1+10,w, h,0,img_lines_first); |
886 | DrawBar(left1+w - 5, top1 + 10, width1-w + 5, h, bg_color); |
886 | DrawBar(left1+w - 5, top1 + 10, width1-w + 5, h, bg_color); |
887 | IF (link) DefineButton(left1 - 5, top1+10, w, h, blink + BT_HIDE, 0xB5BFC9); |
887 | IF (link) DefineButton(left1 - 5, top1+10, w, h, blink + BT_HIDE, 0xB5BFC9); |
888 | } |
888 | } |
889 | 889 | ||
890 | 890 | ||
891 | //ñêðîëë |
891 | //ñêðîëë |
892 | void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå |
892 | void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå |
893 | { |
893 | { |
894 | scroll1.max_area = lines.all; |
894 | scroll1.max_area = lines.all; |
895 | scroll1.cur_area = lines.visible; |
895 | scroll1.cur_area = lines.visible; |
896 | scroll1.position = lines.first; |
896 | scroll1.position = lines.first; |
897 | 897 | ||
898 | scroll1.all_redraw=1; |
898 | scroll1.all_redraw=1; |
899 | scroll1.start_x=Form.width-28; //left + width - 15 |
899 | scroll1.start_x=Form.width-28; //left + width - 15 |
900 | scroll1.size_y=WB1.height; |
900 | scroll1.size_y=WB1.height; |
901 | 901 | ||
902 | scrollbar_v_draw(#scroll1); |
902 | scrollbar_v_draw(#scroll1); |
903 | }=0)>=num_of_pics;>>>>>16><16>>=>=>>>>>>>>=>!--> |
903 | }=0)>=num_of_pics;>>>>>16><16>>=>=>>>>>>>>=>!--> |
904 | >': |
904 | >': |
905 | >7);>>>')>>>>>0)>>>>>>=>>>>> |
905 | >7);>>>')>>>>>0)>>>>>>=>>>>> |