Rev 4026 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3067 | leency | 1 | |
2 | |||
3 | |||
4 | buf, |
||
5 | filesize, |
||
6 | blink; |
||
7 | |||
8 | |||
9 | char search_path[]="http://nigma.ru/index.php?s="; |
||
10 | |||
11 | |||
12 | |||
13 | int left, top, width, height, line_h; |
||
3464 | leency | 14 | void Scan(int); |
3067 | leency | 15 | void GetNewUrl(); |
16 | void OpenPage(); |
||
17 | void ReadHtml(byte); |
||
18 | void ShowPage(); |
||
19 | void ParseHTML(dword); |
||
20 | void WhatTextStyle(int left1, top1, width1); |
||
21 | void DrawPage(); |
||
22 | void DrawScroller(); |
||
23 | }; |
||
3466 | leency | 24 | TWebBrowser WB1; |
25 | |||
3067 | leency | 26 | |
3128 | leency | 27 | link, ignor_text, li_tab, cur_encoding; |
3466 | leency | 28 | |
3067 | leency | 29 | |
30 | text_color_index, |
||
31 | link_color, |
||
32 | bg_color; |
||
33 | |||
34 | |||
35 | stolbec, |
||
36 | tab_len, |
||
3466 | leency | 37 | anchor_line_num; |
38 | |||
3067 | leency | 39 | |
40 | tag[100], |
||
41 | tagparam[10000], |
||
42 | parametr[1200], |
||
43 | options[4096], |
||
3466 | leency | 44 | anchor[256]; |
45 | |||
3067 | leency | 46 | |
47 | #include "include\colors.h" |
||
48 | #include "include\unicode_tags.h" |
||
49 | #include "include\img_cache.h" |
||
3466 | leency | 50 | #include "include\some_code.h" |
3067 | leency | 51 | #include "include\parce_tag.h" |
52 | #include "DrawBuf.h" |
||
4074 | leency | 53 | |
3067 | leency | 54 | |
3466 | leency | 55 | |
3067 | leency | 56 | |
3466 | leency | 57 | |
58 | { |
||
59 | int start_x, start_y, line_length, magrin_left=5; |
||
60 | |||
61 | |||
62 | { |
||
63 | strcpy(#header, #line); |
||
64 | strcat(#header, " -"); |
||
65 | strcat(#header, #version); |
||
66 | line = 0; |
||
67 | return; |
||
68 | } |
||
69 | |||
70 | |||
71 | { |
||
72 | start_x = stolbec * 6 + left + magrin_left; |
||
73 | start_y = stroka * 10 + top + magrin_left; |
||
74 | line_length = strlen(#line) * 6; |
||
75 | |||
76 | |||
4026 | leency | 77 | IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf); |
3466 | leency | 78 | IF (i_text) DrawBufSkew(start_x, 0, line_length, line_h); |
79 | IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
||
80 | IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
||
81 | IF (link) { |
||
82 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9); |
||
83 | DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
||
84 | } |
||
85 | stolbec += strlen(#line); |
||
86 | } |
||
87 | } |
||
88 | //======================================================================= |
||
89 | |||
90 | |||
3067 | leency | 91 | { |
92 | if (id >= 400) |
||
93 | { |
||
94 | GetURLfromPageLinks(id); |
||
95 | |||
96 | |||
97 | if (URL[0] == '#') |
||
98 | { |
||
99 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
||
100 | |||
101 | |||
102 | |||
103 | |||
104 | ShowPage(); |
||
105 | return; |
||
106 | } |
||
107 | //liner.ru#1 |
||
108 | if (strrchr(#URL, '#')<>-1) |
||
109 | { |
||
110 | strcpy(#anchor, #URL+strrchr(#URL, '#')); |
||
111 | URL[strrchr(#URL, '#')-1] = 0x00; //заглушка |
||
112 | } |
||
113 | |||
114 | |||
115 | |||
116 | |||
117 | { |
||
118 | //if (strstr(#URL,"http:")) |
||
119 | RunProgram("/sys/media/kiv", #URL); |
||
120 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
||
121 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
||
122 | return; |
||
123 | } |
||
124 | if (!strcmpn(#URL,"mailto:", 7)) |
||
125 | { |
||
126 | RunProgram("@notify", #URL); |
||
127 | strcpy(#editURL, BrowserHistory.CurrentUrl()); |
||
128 | strcpy(#URL, BrowserHistory.CurrentUrl()); |
||
129 | return; |
||
130 | } |
||
131 | |||
132 | |||
133 | return; |
||
134 | } |
||
135 | |||
136 | |||
137 | { CASE 183: CASE 184: CASE 180: CASE 181: return; } |
||
138 | |||
139 | |||
140 | { |
||
141 | case 011: //Ctrk+K |
||
142 | ReadHtml(_KOI); |
||
143 | break; |
||
144 | case 021: //Ctrl+U |
||
145 | ReadHtml(_UTF); |
||
146 | break; |
||
147 | case 004: //Ctrl+D |
||
148 | ReadHtml(_DOS); |
||
149 | break; |
||
150 | case 002: //free img cache |
||
3468 | leency | 151 | FreeImgCache(); |
152 | break; |
||
3067 | leency | 153 | case BACK: |
154 | if (!BrowserHistory.GoBack()) return; |
||
155 | OpenPage(); |
||
156 | return; |
||
157 | case FORWARD: |
||
158 | if (!BrowserHistory.GoForward()) return; |
||
159 | OpenPage(); |
||
160 | return; |
||
161 | case 052: //F3 |
||
3466 | leency | 162 | if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); |
3067 | leency | 163 | return; |
164 | case 054: //F5 |
||
165 | IF(address_box.flags & 0b10) break; |
||
3466 | leency | 166 | case REFRESH: |
3067 | leency | 167 | if (GetProcessSlot(downloader_id)<>0) |
168 | { |
||
169 | KillProcess(downloader_id); |
||
170 | pause(20); |
||
3078 | leency | 171 | Draw_Window(); |
3067 | leency | 172 | return; |
173 | } |
||
174 | anchor_line_num=lines.first; //весёлый костыль :Р |
||
175 | anchor[0]='|'; |
||
176 | OpenPage(); |
||
177 | return; |
||
178 | case 014: //Ctrl+N новое окно |
||
179 | case 020: //Ctrl+T новая вкладка |
||
180 | case NEWTAB: |
||
181 | MoveSize(190,80,OLD,OLD); |
||
182 | RunProgram(#program_path, #URL); |
||
183 | return; |
||
184 | |||
185 | |||
186 | strcpy(#editURL, "http://kolibrios.org/en/index.htm"); |
||
3987 | leency | 187 | case GOTOURL: |
3067 | leency | 188 | case 0x0D: //enter |
189 | //почему ttp://? Господа, отличный вопрос. Дело в том, что это хак. |
||
3986 | leency | 190 | //strstr() если не нашло возвращает 0 и в случае успеха возвращает 0. Так что это хак. |
191 | if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0; |
||
192 | strcat(#URL, #editURL); |
||
193 | OpenPage(); |
||
3067 | leency | 194 | return; |
195 | case SEARCHWEB: |
||
196 | strcpy(#URL, #search_path); |
||
197 | strcat(#URL, #editURL); |
||
198 | OpenPage(); |
||
199 | return; |
||
200 | |||
201 | |||
202 | IF(lines.first <= 0) return; |
||
203 | lines.first--; |
||
204 | break; |
||
205 | case ID2: //мотаем вниз |
||
206 | IF(lines.visible + lines.first >= lines.all) return; |
||
207 | lines.first++; |
||
208 | break; |
||
209 | case 183: //PgDown |
||
210 | IF(lines.first == lines.all - lines.visible) return; |
||
211 | lines.first += lines.visible + 2; |
||
212 | IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; |
||
213 | break; |
||
214 | case 184: //PgUp |
||
215 | IF(lines.first == 0) return; |
||
216 | lines.first -= lines.visible - 2; |
||
217 | IF(lines.first < 0) lines.first = 0; |
||
218 | break; |
||
219 | case 180: //home |
||
220 | IF(lines.first == 0) return; |
||
221 | lines.first = 0; |
||
222 | break; |
||
223 | case 181: //end |
||
224 | IF (lines.first == lines.all - lines.visible) return; |
||
225 | lines.first = lines.all - lines.visible; |
||
226 | break; |
||
227 | default: |
||
228 | return; |
||
229 | } |
||
230 | ParseHTML(buf); |
||
231 | } |
||
232 | |||
233 | |||
234 | |||
3990 | leency | 235 | //dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){ |
3067 | leency | 236 | void TWebBrowser::GetNewUrl(){ |
237 | int i, len; |
||
238 | |||
239 | |||
240 | { |
||
241 | len=strlen(ABSOLUTE_LINKS[i]); |
||
242 | if (!strcmpn(#URL, ABSOLUTE_LINKS[i], len)) return; |
||
243 | } |
||
244 | |||
245 | |||
246 | strcpy(#editURL, BrowserHistory.CurrentUrl()); //достаём адрес текущей страницы |
||
3987 | leency | 247 | |
3067 | leency | 248 | |
3987 | leency | 249 | { |
250 | i = strchr(#editURL+8, '/'); |
||
251 | editURL[i+7]=0; |
||
252 | strcpy(#URL, #URL+1); |
||
253 | } |
||
254 | |||
3067 | leency | 255 | |
256 | |||
257 | |||
258 | { |
||
259 | editURL[strrchr(#editURL, '/')] = 0x00; //обрезаем её урл до последнего / |
||
260 | } |
||
261 | |||
262 | |||
263 | { |
||
264 | strcpy(#URL,#URL+3); |
||
265 | editURL[strrchr(#editURL, '/')-1] = 0x00; //обрезаем её урл до последнего / |
||
266 | goto _CUT_ST_LEVEL_MARK; |
||
267 | } |
||
268 | |||
269 | |||
270 | |||
271 | |||
272 | strcpy(#URL, #editURL); |
||
273 | } |
||
274 | |||
275 | |||
276 | |||
277 | |||
278 | { |
||
279 | if (!strcmp(get_URL_part(5),"http:"))) |
||
280 | file_size stdcall (#download_path); |
||
281 | else |
||
282 | file_size stdcall (#URL); |
||
283 | |||
284 | |||
285 | if (!filesize) return; |
||
286 | |||
287 | |||
288 | buf = mem_Alloc(filesize); |
||
289 | if (!strcmp(get_URL_part(5),"http:"))) |
||
290 | ReadFile(0, filesize, buf, #download_path); |
||
291 | else |
||
292 | ReadFile(0, filesize, buf, #URL); |
||
293 | |||
294 | |||
295 | if (encoding==_WIN) wintodos(buf); |
||
296 | if (encoding==_UTF) utf8rutodos(buf); |
||
297 | if (encoding==_KOI) koitodos(buf); |
||
298 | } |
||
299 | |||
300 | |||
301 | |||
302 | { |
||
303 | if (GetProcessSlot(downloader_id)<>0) PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal); |
||
304 | KillProcess(downloader_id); |
||
305 | strcpy(#editURL, #URL); |
||
306 | BrowserHistory.AddUrl(); |
||
307 | strcpy(#header, #version); |
||
308 | pre_text =0; |
||
309 | if (!strcmp(get_URL_part(5),"http:"))) |
||
310 | { |
||
311 | KillProcess(downloader_id); //убиваем старый процесс |
||
312 | DeleteFile(#download_path); |
||
313 | IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL; |
||
314 | downloader_id = RunProgram("/sys/network/downloader", #URL); |
||
315 | //Browser Hack v2.0 |
||
316 | /* |
||
3649 | leency | 317 | pause(60); |
3079 | leency | 318 | if (GetProcessSlot(downloader_id)<>0) |
3067 | leency | 319 | { |
320 | debug("Browser Hack v2.0: Killing downloader and trying to run it one more!"); |
||
321 | KillProcess(downloader_id); //убиваем старый процесс |
||
322 | downloader_id = RunProgram("/sys/network/downloader", #URL); |
||
323 | } |
||
324 | */ |
||
3649 | leency | 325 | IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable."); |
3067 | leency | 326 | Draw_Window(); |
327 | return; |
||
328 | } |
||
329 | lines.first = lines.all =0; |
||
330 | ReadHtml(_WIN); |
||
331 | WB1.ShowPage(); |
||
332 | } |
||
333 | |||
334 | |||
335 | |||
336 | { |
||
337 | address_box.size = address_box.pos = strlen(#editURL); |
||
3466 | leency | 338 | address_box.offset=0; |
339 | edit_box_draw stdcall(#address_box); |
||
340 | |||
3128 | leency | 341 | |
3067 | leency | 342 | { |
343 | DrawBar(left, top, width+scroll1.size_x+1, height, 0xFFFFFF); //fill all |
||
3466 | leency | 344 | if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading..."); |
3107 | leency | 345 | else |
3067 | leency | 346 | { |
347 | WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors."); |
||
3107 | leency | 348 | if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration."); |
349 | } |
||
3067 | leency | 350 | //return; |
351 | } |
||
352 | else |
||
353 | ParseHTML(buf); |
||
354 | |||
355 | |||
356 | if (!strcmp(#version, #header)) DrawTitle(#header); |
||
357 | } |
||
358 | |||
359 | |||
360 | |||
361 | |||
362 | word bukva[2]; |
||
363 | int j, perenos_num; |
||
364 | byte ignor_param; |
||
365 | char temp[768]; |
||
366 | |||
367 | |||
3468 | leency | 368 | b_text = i_text = u_text = s_text = blq_text = |
3466 | leency | 369 | li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //обнуляем теги |
3067 | leency | 370 | link_color = 0x0000FF; |
371 | bg_color = 0xFFFFFF; |
||
372 | DrawBufFill(); |
||
3468 | leency | 373 | strcpy(#page_links,"|"); |
3067 | leency | 374 | strcpy(#header, #version); |
375 | stroka = -lines.first; |
||
3468 | leency | 376 | stolbec = 0; |
377 | line = 0; |
||
4026 | leency | 378 | |
3067 | leency | 379 | |
380 | { |
||
381 | pre_text=0; |
||
382 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
||
383 | if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
||
384 | } |
||
385 | |||
386 | |||
387 | { |
||
388 | bukva = ESBYTE[bword]; |
||
389 | if (ignor_text) && (bukva<>'<') continue; |
||
390 | switch (bukva) |
||
391 | { |
||
392 | case 0x0a: |
||
393 | if (pre_text) |
||
394 | { |
||
395 | bukva = temp = NULL; |
||
396 | goto NEXT_MARK; |
||
397 | } |
||
398 | case '\9': |
||
399 | if (pre_text) //иначе идём на 0x0d |
||
400 | { |
||
401 | tab_len=strlen(#line)/8; |
||
402 | tab_len=tab_len*8; |
||
403 | tab_len=8+tab_len-strlen(#line); |
||
404 | for (j=0; j |
||
3468 | leency | 405 | break; |
3067 | leency | 406 | } |
3468 | leency | 407 | goto DEFAULT_MARK; |
408 | case '=': //quoted printable |
||
409 | if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; |
||
3067 | leency | 410 | |
411 | |||
3468 | leency | 412 | temp[1] = ESBYTE[bword+2]; |
413 | temp[2] = '\0'; |
||
414 | if (bukva = Hex2Symb(#temp)) |
||
415 | { |
||
416 | bword+=2; |
||
417 | goto DEFAULT_MARK; |
||
418 | } |
||
419 | break; |
||
3067 | leency | 420 | |
421 | |||
422 | bword++; |
||
423 | tag=0; |
||
424 | for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;) |
||
425 | { |
||
426 | bukva = ESBYTE[bword]; |
||
427 | chrcat(#tag, bukva); |
||
3468 | leency | 428 | } |
3067 | leency | 429 | |
430 | |||
431 | if (bukva) goto DEFAULT_MARK; |
||
432 | break; |
||
433 | case '<': |
||
434 | bword++; //промотаем символ < |
||
435 | tag = parametr = tagparam = ignor_param = NULL; |
||
436 | if (ESBYTE[bword] == '!') //фильтрация внутри , дерзко |
||
437 | { |
||
438 | bword++; |
||
439 | if (ESBYTE[bword] == '-') |
||
440 | { |
||
441 | HH_: |
||
442 | do |
||
443 | { |
||
444 | bword++; |
||
445 | if (buf + filesize <= bword) break 2; |
||
446 | } |
||
447 | while (ESBYTE[bword] <>'-'); |
||
448 | |||
449 | |||
450 | if (ESBYTE[bword] <>'-') goto HH_; |
||
451 | } |
||
452 | } |
||
453 | while (ESBYTE[bword] !='>') && (bword < buf + filesize) //получаем тег и его параметры |
||
454 | { |
||
455 | bukva = ESBYTE[bword]; |
||
456 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
||
457 | if (!ignor_param) && (bukva <>' ') |
||
458 | { |
||
459 | if (strlen(#tag) |
||
460 | } |
||
461 | else |
||
462 | { |
||
463 | ignor_param = true; |
||
464 | if (!ignor_text) && (strlen(#tagparam)+1 |
||
465 | } |
||
466 | bword++; |
||
467 | } |
||
468 | strlwr(#tag); |
||
469 | strlwr(#tagparam); |
||
470 | |||
471 | |||
472 | if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam(); |
||
473 | |||
474 | |||
3466 | leency | 475 | { |
3067 | leency | 476 | perenos_num = strrchr(#line, ' '); |
477 | if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; |
||
478 | strcpy(#temp, #line + perenos_num); //перенос по словам |
||
479 | line[perenos_num] = 0x00; |
||
480 | if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //уходим... |
||
3466 | leency | 481 | DrawPage(); |
3067 | leency | 482 | strcpy(#line, #temp); |
3466 | leency | 483 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку |
3067 | leency | 484 | } |
485 | DrawPage(); |
||
486 | line=NULL; |
||
487 | |||
488 | |||
489 | |||
490 | |||
491 | break; |
||
492 | default: |
||
493 | DEFAULT_MARK: |
||
494 | if (bukva<=15) bukva=' '; |
||
3468 | leency | 495 | if (!pre_text) && (bukva == ' ') |
3067 | leency | 496 | { |
497 | if (line[strlen(#line)-1]==' ') break; //убрать 2 пробела подряд |
||
498 | if (!stolbec) && (!line) break; //строка не может начинаться с пробела |
||
499 | } |
||
500 | if (strlen(#line) |
||
3363 | leency | 501 | |
3067 | leency | 502 | |
503 | { |
||
504 | NEXT_MARK: |
||
505 | perenos_num = strrchr(#line, ' '); |
||
506 | if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max; |
||
507 | strcpy(#temp, #line + perenos_num); //перенос по словам |
||
508 | line[perenos_num] = 0x00; |
||
509 | if (stroka-1 > lines.visible) && (lines.first <>0) break 1; //уходим... |
||
3466 | leency | 510 | DrawPage(); |
3067 | leency | 511 | strcpy(#line, #temp); |
3466 | leency | 512 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку |
3067 | leency | 513 | } |
514 | } |
||
515 | } |
||
516 | |||
517 | |||
518 | TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //закрашиваем следущую строку |
||
3466 | leency | 519 | |
520 | |||
3067 | leency | 521 | DrawBar(left, lines.visible * 10 + top + 25, width, -lines.visible * 10 + height - 25, bg_color); |
3466 | leency | 522 | if (stroka * 10 + 5 <= height) |
523 | DrawBar(left, stroka * 10 + top + 5, width, -stroka * 10 + height - 5, bg_color); //закрашиваем всё до конца |
||
524 | if (lines.first == 0) lines.all = stroka; |
||
3067 | leency | 525 | if (anchor) //если посреди текста появится новый якорь - будет бесконечный цикл |
526 | { |
||
527 | anchor=NULL; |
||
528 | lines.first=anchor_line_num; |
||
529 | ParseHTML(buf); |
||
530 | } |
||
531 | DrawScroller(); |
||
532 | } |
||
533 | |||
534 | |||
3464 | leency | 535 | |
536 | |||
3067 | leency | 537 | void TWebBrowser::WhatTextStyle(int left1, top1, width1) { |
538 | dword hr_color; |
||
539 | |||
540 | |||
541 | if (tag[0] == '/') |
||
542 | { |
||
543 | rez = 0; |
||
544 | strcpy(#tag, #tag+1); |
||
545 | } |
||
546 | else rez = 1; |
||
547 | |||
548 | |||
549 | { |
||
550 | IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0; |
||
551 | return; |
||
552 | } |
||
553 | |||
554 | |||
555 | |||
556 | |||
557 | { |
||
558 | if (rez) header=NULL; |
||
559 | else if (!stroka) DrawTitle(#header); //тег закрылся - вывели строку |
||
560 | return; |
||
561 | } |
||
562 | |||
563 | |||
564 | |||
565 | |||
566 | |||
567 | |||
568 | |||
569 | |||
570 | { |
||
571 | if (!strcmp(#anchor, #options)) anchor_line_num=lines.first+stroka; |
||
572 | } |
||
573 | |||
574 | |||
575 | { |
||
576 | do{ |
||
577 | if (!strcmp(#parametr, "link=")) link_color = GetColor(#options); |
||
578 | if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); |
||
579 | if (!strcmp(#parametr, "bgcolor=")) |
||
3466 | leency | 580 | { |
581 | bg_color=GetColor(#options); |
||
582 | DrawBufFill(); |
||
583 | } |
||
584 | } while(GetNextParam()); |
||
3067 | leency | 585 | return; |
586 | } |
||
587 | |||
588 | |||
589 | { |
||
590 | if (rez) |
||
591 | { |
||
592 | if (link) IF(text_color_index > 0) text_color_index--; //если предыдущий тег а не был закрыт |
||
593 | |||
594 | |||
595 | if (!strcmp(#parametr, "href=")) |
||
596 | { |
||
597 | if (stroka - 1 > lines.visible) || (stroka < -2) return; |
||
598 | |||
599 | |||
600 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
||
601 | |||
602 | |||
603 | blink++; |
||
604 | text_colors[text_color_index] = link_color; |
||
605 | strcat(#page_links, #options); |
||
606 | strcat(#page_links, "|"); |
||
607 | } |
||
608 | if (anchor) && (!strcmp(#parametr, "name=")) |
||
609 | { |
||
610 | if (!strcmp(#anchor, #options)) |
||
611 | { |
||
612 | anchor_line_num=lines.first+stroka; |
||
613 | } |
||
614 | } |
||
615 | } while(GetNextParam()); |
||
616 | } |
||
617 | else { |
||
618 | link = 0; |
||
619 | IF(text_color_index > 0) text_color_index--; |
||
620 | } |
||
621 | return; |
||
622 | } |
||
623 | |||
624 | |||
625 | { |
||
626 | if (rez) |
||
627 | { |
||
628 | text_color_index++; |
||
629 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
||
630 | |||
631 | |||
632 | if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') |
||
633 | { |
||
634 | text_colors[text_color_index] = GetColor(#options); |
||
635 | } |
||
636 | } while(GetNextParam()); |
||
637 | } |
||
638 | else |
||
639 | if (text_color_index > 0) text_color_index--; |
||
640 | return; |
||
641 | } |
||
642 | if(!chTag("tr")) || (!chTag("br")) { |
||
643 | TextGoDown(left1, top1, width1); |
||
644 | return; |
||
645 | } |
||
646 | if (!chTag("div")) { |
||
647 | IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1); |
||
648 | return; |
||
649 | } |
||
650 | if (!chTag("p")) { |
||
651 | IF(oldtag[0] == 'h') return; |
||
652 | TextGoDown(left1, top1, width1); |
||
653 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
||
654 | return; |
||
655 | } |
||
656 | if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) { |
||
657 | TextGoDown(left1, top1, width1); |
||
658 | IF(rez) TextGoDown(left1, top1 + 10, width1); |
||
659 | b_text = rez; |
||
660 | strcpy(#oldtag, #tag); |
||
661 | return; |
||
662 | } |
||
663 | else |
||
664 | oldtag=NULL; |
||
665 | |||
666 | |||
667 | b_text = rez; |
||
668 | return; |
||
669 | } |
||
670 | if(!chTag("i")) || (!chTag("em")) || (!chTag("subtitle")) { |
||
671 | i_text = rez; |
||
672 | return; |
||
673 | } |
||
674 | if (!chTag("dt")) |
||
675 | { |
||
676 | li_text = rez; |
||
677 | IF(rez == 0) return; |
||
678 | TextGoDown(left1, top1, width1); |
||
679 | return; |
||
680 | } |
||
681 | if(!chTag("li")) || (!chTag("dt")) //надо сделать вложенные списки |
||
682 | { |
||
683 | li_text = rez; |
||
684 | if (rez) |
||
3466 | leency | 685 | { |
686 | TextGoDown(left1, top1, width1); |
||
687 | if (stroka > -1) && (stroka - 2 < lines.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, line_h/2-3, 2, 2, 0x555555); |
||
688 | } |
||
689 | return; |
||
3067 | leency | 690 | } |
691 | if (!chTag("u")) || (!chTag("ins")) u_text = rez; |
||
692 | if (!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez; |
||
693 | if (!chTag("ul")) || (!chTag("ol")) IF(!rez) |
||
694 | { |
||
695 | li_text = rez; |
||
696 | li_tab--; |
||
697 | TextGoDown(left1, top1, width1); |
||
698 | } ELSE li_tab++; |
||
699 | if (!chTag("dd")) stolbec += 5; |
||
700 | if (!chTag("blockquote")) blq_text = rez; |
||
701 | if (!chTag("pre")) pre_text = rez; |
||
702 | if (!chTag("hr")) |
||
703 | { |
||
704 | if (anchor) || (stroka < -1) |
||
3466 | leency | 705 | { |
706 | stroka+=2; |
||
707 | return; |
||
708 | } |
||
709 | if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999; |
||
710 | TextGoDown(left1, top1, width1); |
||
3067 | leency | 711 | DrawBufBar(5, WB1.line_h/2, WB1.width-10, 1, hr_color); |
3466 | leency | 712 | TextGoDown(left1, top1+WB1.line_h, width1); |
713 | } |
||
3067 | leency | 714 | if (!chTag("img")) |
715 | { |
||
716 | Images( left1, top1, width1); |
||
717 | return; |
||
718 | } |
||
719 | if (!chTag("meta")) || (!chTag("?xml")) |
||
720 | { |
||
721 | do{ |
||
722 | if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding=")) |
||
723 | { |
||
724 | strcpy(#options, #options[strrchr(#options, '=')]); //поиск в content= |
||
725 | if (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) ReadHtml(_UTF); |
||
726 | if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) ReadHtml(_KOI); |
||
727 | if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) ReadHtml(_DOS); |
||
728 | } |
||
729 | } while(GetNextParam()); |
||
730 | return; |
||
731 | } |
||
732 | } |
||
733 | |||
734 | |||
735 | |||
736 | |||
737 | { |
||
738 | scroll1.max_area = lines.all; |
||
739 | scroll1.cur_area = lines.visible; |
||
740 | scroll1.position = lines.first; |
||
741 | |||
742 | |||
743 | scroll1.start_x = WB1.left + WB1.width; |
||
3466 | leency | 744 | scroll1.size_y=WB1.height; |
3067 | leency | 745 | |
746 | |||
747 | }>>>>=>=>>=15)>>>>>>>=>!--> |
||
748 | >': |
||
3466 | leency | 749 |