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