Rev 5747 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5747 | Rev 5749 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | dword bufpointer; |
- | |
2 | dword o_bufpointer; |
- | |
3 | dword bufsize; |
1 | scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
Line 4... | Line 2... | ||
4 | 2 | ||
Line 5... | Line 3... | ||
5 | scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
3 | enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT}; |
Line 26... | Line 24... | ||
26 | void DrawPage(); |
24 | void LoadInternalPage(); |
27 | void DrawScroller(); |
25 | void NewLine(); |
28 | void LoadInternalPage(); |
26 | void Perenos(); |
29 | void NewLine(); |
27 | void BufEncode(); |
30 | void Perenos(); |
28 | byte end_parsing; |
- | 29 | } WB1; |
|
31 | byte end_parsing; |
30 | |
32 | } WB1; |
31 | |
Line 37... | Line 36... | ||
37 | link, |
36 | cur_encoding, |
38 | ignor_text, |
37 | t_html, |
39 | cur_encoding, |
38 | t_body; |
40 | t_html, |
39 | |
41 | t_body; |
40 | dword bufpointer; |
42 | /* |
- | |
43 | struct _condition { |
- | |
44 | byte |
- | |
45 | text_active, |
- | |
46 | text_val, |
- | |
47 | href, |
- | |
48 | max |
- | |
49 | } condition; |
- | |
50 | */ |
- | |
51 | - | ||
52 | byte condition_text_active, condition_text_val, condition_href, condition_max; |
- | |
Line -... | Line 41... | ||
- | 41 | dword o_bufpointer; |
|
- | 42 | dword bufsize; |
|
- | 43 | ||
Line 53... | Line 44... | ||
53 | 44 | dword text_colors[300]; |
|
54 | 45 | dword text_color_index; |
|
55 | dword text_colors[300]; |
46 | dword link_color_inactive; |
56 | dword text_color_index; |
47 | dword link_color_active; |
Line 76... | Line 67... | ||
76 | #include "..\TWB\links.h" |
67 | #include "..\TWB\unicode_tags.h" |
77 | #include "..\TWB\colors.h" |
68 | #include "..\TWB\img_cache.h" |
78 | #include "..\TWB\unicode_tags.h" |
69 | #include "..\TWB\parce_tag.h" |
79 | #include "..\TWB\img_cache.h" |
70 | |
80 | #include "..\TWB\parce_tag.h" |
71 | |
81 | #include "..\TWB\table.h" |
- | |
Line 82... | Line 72... | ||
82 | 72 | //============================================================================================ |
|
83 | 73 | void TWebBrowser::DrawPage() |
|
84 | //============================================================================================ |
74 | { |
Line 131... | Line 121... | ||
131 | char temp[768]; |
121 | int line_len; |
132 | dword bufpos = bufpointer; |
122 | |
133 | int line_len; |
123 | style.b = style.i = style.u = style.s = style.blq = t_html = t_body = |
Line 134... | Line 124... | ||
134 | 124 | style.li = link = ignor_text = text_color_index = text_colors[0] = style.li_tab = 0; |
|
135 | style.b = style.i = style.u = style.s = style.blq = t_html = t_body = |
125 | end_parsing = false; |
136 | style.li = link = ignor_text = text_color_index = text_colors[0] = |
- | |
137 | style.li_tab = condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè |
126 | style.align = ALIGN_LEFT; |
138 | end_parsing = false; |
- | |
139 | condition_max = 255; |
127 | link_color_inactive = 0x0000FF; |
140 | style.align = ALIGN_LEFT; |
128 | link_color_active = 0xFF0000; |
141 | link_color_inactive = 0x0000FF; |
129 | bg_color = 0xFFFFFF; |
142 | link_color_active = 0xFF0000; |
130 | DrawBuf.Fill(bg_color); |
143 | bg_color = 0xFFFFFF; |
131 | PageLinks.Clear(); |
Line 148... | Line 136... | ||
148 | stolbec = 0; |
136 | |
149 | line = 0; |
137 | draw_line_width = list.w * DrawBuf.zoom; |
Line 150... | Line 138... | ||
150 | 138 | ||
Line -... | Line 139... | ||
- | 139 | //for plaint text use CP866 for other UTF |
|
- | 140 | if (strstri(bufpointer, "html")) |
|
- | 141 | { |
|
- | 142 | style.pre = 0; |
|
- | 143 | cur_encoding = CH_CP866; |
|
- | 144 | //WB1.list.SetFont(8, 14, 10111000b); |
|
- | 145 | //list.line_h = list.font_h + 4; |
|
- | 146 | } |
|
- | 147 | else |
|
- | 148 | { |
|
151 | draw_line_width = list.w * DrawBuf.zoom; |
149 | style.pre = 1; |
- | 150 | cur_encoding = CH_UTF8; |
|
- | 151 | //WB1.list.SetFont(8, 14, 10001000b); |
|
152 | 152 | //list.line_h = list.font_h + 4; |
|
- | 153 | } |
|
Line 153... | Line 154... | ||
153 | style.pre = 1; |
154 | |
154 | if (strstri(bufpointer, "html")) style.pre = 0; |
155 | for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;) |
155 | 156 | { |
|
156 | for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;) |
157 | if (end_parsing) break; |
157 | { |
158 | bukva = ESBYTE[bufpos]; |
158 | if (end_parsing) break; |
- | |
159 | bukva = ESBYTE[bufpos]; |
159 | if (ignor_text) && (bukva!='<') continue; |
160 | if (ignor_text) && (bukva!='<') continue; |
160 | switch (bukva) |
161 | if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue; |
161 | { |
162 | switch (bukva) |
162 | case 0x0a: |
163 | { |
163 | if (style.pre) |
Line 188... | Line 188... | ||
188 | chrcat(#tag, bukva); |
188 | if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; |
189 | } |
189 | break; |
190 | if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; |
190 | case '<': |
191 | break; |
191 | bufpos++; |
192 | case '<': |
192 | tag = attr = tagparam = ignor_param = NULL; |
193 | bufpos++; //ïðîìîòàåì ñèìâîë < |
193 | if (ESBYTE[bufpos] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî |
194 | tag = attr = tagparam = ignor_param = NULL; |
194 | { |
195 | if (ESBYTE[bufpos] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî |
195 | bufpos++; |
196 | { |
196 | if (ESBYTE[bufpos] == '-') |
197 | bufpos++; |
197 | { |
198 | if (ESBYTE[bufpos] == '-') |
198 | HH_: |
Line 224... | Line 224... | ||
224 | } |
224 | } |
225 | bufpos++; |
225 | strlwr(#tag); |
226 | } |
226 | |
227 | strlwr(#tag); |
227 | if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/ |
Line 228... | Line -... | ||
228 | - | ||
229 | if (condition_text_active) && (condition_text_val != condition_href) |
- | |
230 | { |
- | |
231 | if (strcmp(#tag, "/condition")!=0) break; |
- | |
232 | } |
228 | if (tagparam) GetNextParam(); |
233 | if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/ |
229 | |
Line 234... | Line 230... | ||
234 | if (tagparam) GetNextParam(); |
230 | if (stolbec + utf8_strlen(#line) > list.column_max) Perenos(); |
235 | 231 | DrawPage(); |
|
Line 291... | Line 287... | ||
291 | opened = 0; |
287 | } |
292 | strcpy(#tag, #tag+1); |
288 | else opened = 1; |
293 | } |
289 | |
294 | else opened = 1; |
290 | if (istag("html")) { |
Line 295... | Line 291... | ||
295 | 291 | t_html = opened; |
|
296 | if (istag("html")) |
- | |
297 | { |
292 | return; |
298 | t_html = opened; |
293 | } |
299 | return; |
294 | if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) { ignor_text = opened; return; } |
300 | } |
- | |
301 | 295 | if (istag("form")) if (!opened) ignor_text = false; |
|
302 | if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) ignor_text = opened; |
296 | if(istag("title")) { |
303 | if (istag("form")) if (!opened) ignor_text = false; |
- | |
304 | 297 | if (opened) header=NULL; |
|
305 | if(istag("title")) |
- | |
306 | { |
298 | else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó |
307 | if (opened) header=NULL; |
299 | return; |
308 | else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó |
300 | } |
309 | return; |
301 | if (ignor_text) return; |
310 | } |
- | |
311 | 302 | ||
Line 312... | Line 303... | ||
312 | if (ignor_text) return; |
303 | IF(istag("q")) |
313 | 304 | { |
|
314 | IF(istag("q")) |
305 | if (opened) strcat(#line, " \""); |
315 | { |
306 | if (!opened) strcat(#line, "\" "); |
- | 307 | return; |
|
316 | if (opened) strcat(#line, " \""); |
308 | } |
317 | if (!opened) strcat(#line, "\" "); |
- | |
318 | } |
309 | if (anchor) && (isattr("id=")) { //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
319 | - | ||
320 | if (anchor) && (isattr("id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
310 | if (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka; |
321 | { |
311 | } |
322 | if (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka; |
- | |
323 | } |
312 | if (istag("body")) { |
324 | - | ||
325 | if (istag("body")) |
313 | t_body = opened; |
326 | { |
314 | do{ |
327 | t_body = opened; |
- | |
328 | do{ |
315 | if (isattr("link=")) link_color_inactive = GetColor(#val); |
329 | if (isattr("condition_max=")) condition_max = atoi(#val); |
316 | if (isattr("alink=")) link_color_active = GetColor(#val); |
330 | if (isattr("link=")) link_color_inactive = GetColor(#val); |
317 | if (isattr("text=")) text_colors[0]=GetColor(#val); |
331 | if (isattr("alink=")) link_color_active = GetColor(#val); |
318 | if (isattr("bgcolor=")) |
332 | if (isattr("text=")) text_colors[0]=GetColor(#val); |
319 | { |
333 | if (isattr("bgcolor=")) |
320 | bg_color=GetColor(#val); |
334 | { |
321 | DrawBuf.Fill(bg_color); |
335 | bg_color=GetColor(#val); |
322 | } |
336 | DrawBuf.Fill(bg_color); |
323 | } while(GetNextParam()); |
337 | } |
- | |
338 | } while(GetNextParam()); |
- | |
339 | if (opened) && (cur_encoding==CH_NULL) |
324 | if (opened) && (cur_encoding==CH_NULL) debugln("Document has no information about encoding, UTF will be used"); |
340 | { |
- | |
341 | debugln("Document has no information about encoding, UTF will be used"); |
- | |
342 | //BufEncode(CH_UTF8); |
325 | return; |
343 | } |
326 | } |
344 | return; |
- | |
345 | } |
327 | if (istag("a")) { |
346 | - | ||
347 | if (istag("a")) |
328 | if (opened) |
348 | { |
329 | { |
349 | if (opened) |
330 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò |
350 | { |
- | |
351 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò |
331 | do{ |
352 | 332 | if (isattr("href=")) |
|
353 | do{ |
333 | { |
354 | if (isattr("href=")) |
334 | if (stroka - 1 > list.visible) || (stroka < -2) return; |
355 | { |
- | |
356 | if (stroka - 1 > list.visible) || (stroka < -2) return; |
335 | text_color_index++; |
357 | 336 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
|
358 | text_color_index++; |
- | |
359 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
337 | link = 1; |
360 | 338 | text_colors[text_color_index] = link_color_inactive; |
|
361 | link = 1; |
339 | PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); |
362 | text_colors[text_color_index] = link_color_inactive; |
340 | } |
363 | PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); |
341 | if (anchor) && (isattr("name=")) |
Line 375... | Line 353... | ||
375 | link = 0; |
353 | } |
376 | IF(text_color_index > 0) text_color_index--; |
354 | return; |
377 | } |
355 | } |
378 | return; |
356 | if (istag("font")) { |
379 | } |
357 | if (opened) |
380 | - | ||
381 | if (istag("font")) |
358 | { |
382 | { |
- | |
383 | if (opened) |
359 | text_color_index++; |
384 | { |
360 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
385 | text_color_index++; |
361 | do{ |
386 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
362 | if (isattr("color=")) text_colors[text_color_index] = GetColor(#val); |
387 | - | ||
388 | do{ |
363 | } while(GetNextParam()); |
389 | if (strcmp(#attr, "color=") == 0) //&& (attr[1] == '#') |
- | |
390 | { |
- | |
391 | text_colors[text_color_index] = GetColor(#val); |
364 | } |
392 | } |
- | |
393 | } while(GetNextParam()); |
365 | else if (text_color_index > 0) text_color_index--; |
394 | } |
366 | return; |
395 | else |
- | |
396 | if (text_color_index > 0) text_color_index--; |
367 | } |
397 | return; |
- | |
398 | } |
- | |
399 | if (istag("br")) { |
- | |
400 | NewLine(); |
- | |
401 | return; |
368 | if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) { |
402 | } |
369 | IF(oldtag[0] != 'h') NewLine(); |
403 | if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) { |
370 | if (isattr("bgcolor=")) |
404 | IF(oldtag[0] <>'h') NewLine(); |
371 | { |
405 | if (isattr("bgcolor=")) |
372 | bg_color=GetColor(#val); |
406 | { |
373 | DrawBuf.Fill(bg_color); |
407 | bg_color=GetColor(#val); |
374 | } |
408 | DrawBuf.Fill(bg_color); |
375 | return; |
409 | } |
376 | } |
Line 413... | Line 380... | ||
413 | IF(oldtag[0] == 'h') return; |
380 | IF(opened) NewLine(); |
414 | NewLine(); |
381 | return; |
415 | IF(opened) NewLine(); |
382 | } |
416 | return; |
383 | if (istag("br")) { NewLine(); return; } |
417 | } |
384 | if (istag("tr")) { if (opened) { NewLine(); strcat(#line, "| "); } return; } |
418 | - | ||
419 | if(istag("table")) { |
385 | if (istag("td")) || (istag("th")) { if (!opened) strcat(#line, " | "); return; } |
420 | table.active = opened; |
- | |
421 | NewLine(); |
- | |
422 | if (opened) table.NewTable(); |
386 | if (istag("b")) || (istag("strong")) || (istag("big")) { style.b = opened; return; } |
423 | } |
- | |
424 | - | ||
425 | if(istag("td")) { |
387 | if (istag("i")) || (istag("em")) || (istag("subtitle")) { style.i=opened; return; } |
426 | if (opened) |
- | |
427 | { |
- | |
428 | table.cur_col++; |
- | |
429 | table.row_h = 0; |
- | |
430 | do { |
- | |
431 | if (isattr("width=")) |
388 | if (istag("u")) || (istag("ins")) { style.u=opened; return;} |
432 | { |
- | |
433 | table.col_w[table.cur_col] = atoi(#val); |
389 | if (istag("s")) || (istag("strike")) || (istag("del")) { style.s=opened; return; } |
434 | // NewLine(); |
- | |
435 | // strcpy(#line, #val); |
390 | if (istag("dd")) { stolbec += 5; return; } |
436 | // NewLine(); |
- | |
437 | } |
- | |
438 | } while(GetNextParam()); |
- | |
439 | } |
- | |
440 | else |
- | |
441 | { |
- | |
442 | if (table.row_h > table.row_max_h) table.row_max_h = table.row_h; |
391 | if (istag("blockquote")) { style.blq = opened; return; } |
443 | } |
- | |
444 | } |
- | |
445 | - | ||
446 | if(istag("tr")) { |
392 | if (istag("pre")) || (istag("code")) { style.pre = opened; return; } |
447 | if (opened) |
- | |
448 | { |
- | |
449 | table.cur_col = 0; |
- | |
450 | table.row_max_h = 0; |
- | |
451 | table.row_start = stroka; |
393 | if (istag("img")) { ImgCache.Images( left1, top1, WB1.list.w); return; } |
452 | } |
- | |
453 | else |
- | |
454 | { |
- | |
455 | NewLine(); |
- | |
456 | if (table.cur_row == 0) table.max_cols = table.cur_col; |
394 | /* |
457 | table.cur_row++; |
- | |
458 | table.max_cols = table.cur_col; |
395 | if (istag("center")) |
459 | } |
- | |
460 | } |
- | |
461 | - | ||
462 | /* |
396 | { |
463 | if (istag("center")) |
397 | if (opened) style.align = ALIGN_CENTER; |
464 | { |
398 | if (!opened) |
465 | if (opened) style.align = ALIGN_CENTER; |
399 | { |
466 | if (!opened) |
400 | NewLine(); |
Line 479... | Line 413... | ||
479 | style.align = ALIGN_LEFT; |
413 | return; |
480 | } |
414 | } |
481 | return; |
415 | */ |
482 | } |
416 | if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) || (istag("caption")) { |
483 | */ |
417 | NewLine(); |
484 | if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) { |
418 | if (opened) && (stroka>1) NewLine(); |
485 | NewLine(); |
419 | strcpy(#oldtag, #tag); |
486 | if (opened) && (stroka>1) NewLine(); |
420 | if (opened) |
487 | strcpy(#oldtag, #tag); |
421 | { |
488 | if (opened) |
422 | if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; |
489 | { |
423 | if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; |
Line 498... | Line 432... | ||
498 | } |
432 | } |
499 | return; |
433 | else |
500 | } |
434 | oldtag=NULL; |
501 | else |
435 | if (istag("dt")) { |
502 | oldtag=NULL; |
436 | style.li = opened; |
503 | - | ||
504 | if (istag("b")) || (istag("strong")) || (istag("big")) { |
- | |
505 | style.b = opened; |
- | |
506 | return; |
- | |
507 | } |
- | |
508 | if(istag("i")) || (istag("em")) || (istag("subtitle")) { |
- | |
509 | style.i = opened; |
- | |
510 | return; |
- | |
511 | } |
- | |
512 | if (istag("dt")) |
437 | if (opened) NewLine(); |
513 | { |
- | |
514 | style.li = opened; |
438 | return; |
515 | IF(opened == 0) return; |
439 | } |
516 | NewLine(); |
- | |
517 | return; |
- | |
518 | } |
- | |
519 | if (istag("condition")) |
- | |
520 | { |
- | |
521 | condition_text_active = opened; |
- | |
522 | if (opened) && (isattr("show_if=")) condition_text_val = atoi(#val); |
- | |
523 | return; |
440 | if (istag("li")) || (istag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè |
524 | } |
441 | { |
525 | if (istag("li")) || (istag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè |
442 | style.li = opened; |
526 | { |
443 | if (opened) |
527 | style.li = opened; |
444 | { |
Line 532... | Line 449... | ||
532 | DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, list.line_h |
449 | } |
533 | / 2 - DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x555555); |
450 | return; |
534 | } |
451 | } |
535 | return; |
452 | if (istag("ul")) || (istag("ol")) { |
536 | } |
453 | if (!opened) |
537 | if (istag("u")) || (istag("ins")) style.u = opened; |
454 | { |
538 | if (istag("s")) || (istag("strike")) || (istag("del")) style.s = opened; |
- | |
539 | if (istag("ul")) || (istag("ol")) IF(!opened) |
455 | style.li = opened; |
540 | { |
456 | style.li_tab--; |
541 | style.li = opened; |
457 | NewLine(); |
542 | style.li_tab--; |
458 | } |
543 | NewLine(); |
459 | else style.li_tab++; |
- | 460 | } |
|
544 | } ELSE style.li_tab++; |
461 | if (istag("hr")) { |
545 | if (istag("dd")) stolbec += 5; |
- | |
546 | if (istag("blockquote")) style.blq = opened; |
- | |
547 | if (istag("pre")) || (istag("code")) style.pre = opened; |
- | |
- | 462 | if (anchor) || (stroka < -1) |
|
548 | if (istag("hr")) |
463 | { |
549 | { |
- | |
550 | if (anchor) || (stroka < -1) |
464 | stroka+=2; |
551 | { |
465 | return; |
552 | stroka+=2; |
466 | } |
553 | return; |
467 | if (strcmp(#attr, "color=") == 0) hr_color = GetColor(#val); else hr_color = 0x999999; |
554 | } |
468 | NewLine(); |
555 | if (strcmp(#attr, "color=") == 0) hr_color = GetColor(#val); else hr_color = 0x999999; |
469 | DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color); |
556 | NewLine(); |
470 | NewLine(); |
557 | DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color); |
471 | } |
558 | NewLine(); |
472 | if (istag("meta")) || (istag("?xml")) { |
559 | } |
473 | do{ |
560 | if (istag("img")) |
- | |
561 | { |
- | |
562 | ImgCache.Images( left1, top1, WB1.list.w); |
- | |
563 | return; |
- | |
564 | } |
- | |
565 | if (istag("meta")) || (istag("?xml")) |
474 | if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) |
566 | { |
- | |
567 | do{ |
475 | { |
568 | if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) |
476 | strcpy(#val, #val[strrchr(#val, '=')]); //ïîèñê â content= |
569 | { |
477 | strlwr(#val); |
570 | strcpy(#val, #val[strrchr(#val, '=')]); //ïîèñê â content= |
478 | if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; |
571 | strlwr(#val); |
479 | else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; |
572 | meta_encoding = CH_NULL; |
- | |
573 | if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; |
480 | else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251; |
574 | else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; |
481 | else if (isval("iso-8859-5")) || (isval("iso8859-5")) meta_encoding = CH_ISO8859_5; |
575 | else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251; |
482 | else if (isval("dos")) || (isval("cp-866")) meta_encoding = CH_CP866; |
576 | else if (isval("windows-1252")) || (isval("windows1252")) meta_encoding = CH_CP1252; |
- | |
577 | else if (isval("iso-8859-5")) || (isval("iso8859-5")) meta_encoding = CH_ISO8859_5; |
483 | if (cur_encoding!=meta_encoding) BufEncode(meta_encoding); |
578 | else if (isval("dos")) || (isval("cp-866")) meta_encoding = CH_CP866; |
484 | return; |
579 | if (cur_encoding==CH_NULL) BufEncode(meta_encoding); |
485 | } |
580 | return; |
486 | } while(GetNextParam()); |
581 | } |
487 | return; |
582 | } while(GetNextParam()); |
488 | } |
583 | return; |
489 | } |
584 | } |
490 | |
585 | } |
491 | void TWebBrowser::BufEncode(int set_new_encoding) |
Line 586... | Line 492... | ||
586 | 492 | { |
|
587 | void BufEncode(int set_new_encoding) |
493 | int bufpointer_realsize; |
588 | { |
494 | cur_encoding = set_new_encoding; |
589 | int bufpointer_realsize; |
495 | if (o_bufpointer==0) |
590 | cur_encoding = set_new_encoding; |
496 | { |
591 | if (o_bufpointer==0) |
497 | o_bufpointer = malloc(bufsize); |
Line 595... | Line 501... | ||
595 | } |
501 | { |
596 | else |
502 | strcpy(bufpointer, o_bufpointer); |
597 | { |
503 | } |
598 | strcpy(bufpointer, o_bufpointer); |
504 | } |
599 | } |
505 | //============================================================================================ |
600 | if (set_new_encoding == CH_CP1251) |
- | |
601 | { |
- | |
602 | bufpointer = ChangeCharset("CP1251", "UTF-8", bufpointer); |
- | |
603 | } |
- | |
604 | } |
506 | void TWebBrowser::DrawScroller() |
605 | //============================================================================================ |
507 | { |
606 | void TWebBrowser::DrawScroller() |
508 | scroll_wv.max_area = list.count; |
607 | { |
509 | scroll_wv.cur_area = list.visible; |
608 | scroll_wv.max_area = list.count; |
510 | scroll_wv.position = list.first; |