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