Rev 8320 | Rev 8336 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8320 | Rev 8330 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "..\TWB\colors.h" |
1 | #include "TWB\colors.h" |
2 | #include "..\TWB\anchors.h" |
2 | #include "TWB\anchors.h" |
3 | #include "..\TWB\parse_tag.h" |
3 | #include "TWB\parse_tag.h" |
4 | #include "..\TWB\special.h" |
4 | #include "TWB\special.h" |
5 | #include "..\TWB\img.h" |
5 | #include "TWB\img.h" |
6 | #include "..\TWB\tag_list.h" |
6 | #include "TWB\tag_list.h" |
7 | dword page_bg; |
7 | dword page_bg; |
8 | dword link_color_default; |
8 | dword link_color_default; |
9 | dword link_color_active; |
9 | dword link_color_active; |
10 | #include "..\TWB\links.h" |
10 | #include "TWB\links.h" |
Line 11... | Line 11... | ||
11 | 11 | ||
12 | #define BODY_MARGIN 6 |
12 | #define BODY_MARGIN 6 |
Line 13... | Line 13... | ||
13 | #define BASIC_LINE_H 18 |
13 | #define BASIC_LINE_H 18 |
Line 187... | Line 187... | ||
187 | is_html = false; |
187 | is_html = false; |
188 | } |
188 | } |
189 | } |
189 | } |
190 | for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;) |
190 | for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;) |
191 | { |
191 | { |
192 | bukva = ESBYTE[bufpos]; |
192 | //bukva = ESBYTE[bufpos]; |
193 | switch (bukva) |
193 | switch (ESBYTE[bufpos]) |
194 | { |
194 | { |
195 | case 0x0a: |
195 | case 0x0a: |
196 | if (style.pre) { |
196 | if (style.pre) { |
197 | Paint(); |
197 | Paint(); |
198 | NewLine(); |
198 | NewLine(); |
Line 221... | Line 221... | ||
221 | } else { |
221 | } else { |
222 | AddCharToTheLine('&'); |
222 | AddCharToTheLine('&'); |
223 | } |
223 | } |
224 | break; |
224 | break; |
225 | case '<': |
225 | case '<': |
226 | if (!is_html) goto _default; |
226 | if (!is_html) goto _DEFAULT; |
227 | bufpos++; |
227 | bufpos++; |
- | 228 | switch (ESBYTE[bufpos]) { |
|
- | 229 | case '!': |
|
- | 230 | case '/': |
|
- | 231 | case 'a'...'z': |
|
- | 232 | case 'A'...'Z': |
|
- | 233 | goto _TAG; |
|
- | 234 | default: |
|
- | 235 | goto _DEFAULT; |
|
- | 236 | } |
|
- | 237 | _TAG: |
|
228 | if (!strncmp(bufpos,"!--",3)) |
238 | if (!strncmp(bufpos,"!--",3)) |
229 | { |
239 | { |
230 | bufpos+=3; |
240 | bufpos+=3; |
- | 241 | //STRSTR |
|
231 | while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufpointer + bufsize) |
242 | while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufpointer + bufsize) |
232 | { |
243 | { |
233 | bufpos++; |
244 | bufpos++; |
234 | } |
245 | } |
235 | bufpos+=2; |
246 | bufpos+=2; |
Line 243... | Line 254... | ||
243 | 254 | ||
244 | ignor_param=false; |
255 | ignor_param=false; |
245 | while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
256 | while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
246 | { |
257 | { |
247 | bukva = ESBYTE[bufpos]; |
258 | bukva = ESBYTE[bufpos]; |
248 | if (bukva == '\x9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
259 | if (__isWhite(bukva)) bukva = ' '; |
249 | if (!ignor_param) && (bukva <>' ') |
- | |
250 | { |
260 | if (!ignor_param) && (bukva <>' ') { |
251 | if (strlen(#tag.name)+1 |
- | |
252 | } |
261 | if (strlen(#tag.name)+1 |
253 | else |
- | |
254 | { |
262 | } else { |
255 | ignor_param = true; |
263 | ignor_param = true; |
256 | if (strlen(#tag.params)+1 |
264 | if (strlen(#tag.params)+1 |
257 | //chrncat(#tag.params, bukva, sizeof(tag.params)-1); |
265 | //chrncat(#tag.params, bukva, sizeof(tag.params)-1); |
258 | } |
266 | } |
Line 275... | Line 283... | ||
275 | Paint(); |
283 | Paint(); |
276 | if (tag.name) SetStyle(); |
284 | if (tag.name) SetStyle(); |
277 | } |
285 | } |
278 | break; |
286 | break; |
279 | default: |
287 | default: |
280 | _default: |
288 | _DEFAULT: |
281 | AddCharToTheLine(ESBYTE[bufpos]); |
289 | AddCharToTheLine(ESBYTE[bufpos]); |
282 | } |
290 | } |
283 | } |
291 | } |
284 | Paint(); |
292 | Paint(); |
285 | NewLine(); |
293 | NewLine(); |
Line 439... | Line 447... | ||
439 | if (tag.is("code")) { |
447 | if (tag.is("code")) { |
440 | if (tag.opened) style.bg_color = 0xe4ffcb; else style.bg_color = page_bg; |
448 | if (tag.opened) style.bg_color = 0xe4ffcb; else style.bg_color = page_bg; |
441 | style.pre = tag.opened; return; |
449 | style.pre = tag.opened; return; |
442 | } |
450 | } |
443 | if (tag.is("img")) { |
451 | if (tag.is("img")) { |
444 | if (value = tag.get_value_of("src=")) strlcpy(#img_path, value, sizeof(img_path)-1); |
452 | value = tag.get_value_of("src="); |
- | 453 | ||
- | 454 | /* |
|
- | 455 | if (streqrp(value, "data:")) { |
|
- | 456 | EAX = strstr(value, "base64,"); |
|
- | 457 | if (value == EAX) return; |
|
- | 458 | value = EAX; |
|
445 | if (value = tag.get_value_of("title=")) && (strlen(value) |
459 | //cache.add(history.current(), http.content_pointer, http.content_received, PAGE); |
446 | if (value = tag.get_value_of("alt=")) && (strlen(value) |
460 | base64_decode stdcall (#pass_b64, value, strlen(value)); |
- | 461 | } else |
|
- | 462 | */ |
|
- | 463 | strlcpy(#img_path, value, sizeof(img_path)-1); |
|
- | 464 | ||
447 | if (!img_path) { line=0; return; } |
465 | if (!img_path) { line=0; return; } |
- | 466 | ||
- | 467 | value = page_img.add_pos(#img_path, stolbec+1*list.font_w+3, draw_y); |
|
- | 468 | ||
- | 469 | if (cache.has(value)) { |
|
- | 470 | if (page_img.set_size(page_img.url.count-1, cache.current_buf, cache.current_size)) { |
|
- | 471 | ||
- | 472 | if (link) links.add_text( |
|
- | 473 | stolbec * list.font_w + BODY_MARGIN + list.x, |
|
448 | style.image = true; |
474 | draw_y + list.y, |
- | 475 | page_img.xywh.get(page_img.url.count-1*4+2), |
|
- | 476 | page_img.xywh.get(page_img.url.count-1*4+3), |
|
- | 477 | 0); |
|
- | 478 | ||
449 | page_img.add_pos(#img_path, stolbec+1*list.font_w+3, draw_y); |
479 | stolbec += page_img.xywh.get(page_img.url.count-1*4+2) / 6 + 1; |
450 | text_colors.add(0x9A6F29); |
480 | //if (stolbec > list.column_max) NewLine(); |
- | 481 | value = page_img.xywh.get(page_img.url.count-1*4+3); |
|
- | 482 | if (value > list.item_h) {draw_y += value - list.item_h; NewLine();} |
|
- | 483 | ||
- | 484 | return; |
|
- | 485 | } |
|
- | 486 | } |
|
- | 487 | ||
- | 488 | if (value = tag.get_value_of("title=")) && (strlen(value) |
|
- | 489 | if (value = tag.get_value_of("alt=")) && (strlen(value) |
|
451 | if (!line) { |
490 | if (!line) { |
452 | if (!strncmp(#img_path, "data:", 5)) img_path=0; |
491 | if (!strncmp(#img_path, "data:", 5)) img_path=0; |
453 | replace_char(#img_path, '?', NULL, strlen(#img_path)); |
492 | replace_char(#img_path, '?', NULL, strlen(#img_path)); |
454 | sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/')); |
493 | sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/')); |
455 | line[50]= NULL; |
494 | line[50]= NULL; |
456 | } |
495 | } |
457 | while (CheckForLineBreak()) {}; |
496 | while (CheckForLineBreak()) {}; |
- | 497 | ||
- | 498 | text_colors.add(0x9A6F29); |
|
- | 499 | style.image = true; |
|
458 | Paint(); |
500 | Paint(); |
459 | text_colors.pop(); |
- | |
460 | style.image = false; |
501 | style.image = false; |
- | 502 | text_colors.pop(); |
|
461 | return; |
503 | return; |
462 | } |
504 | } |
463 | if (tag.is("h4")) { |
505 | if (tag.is("h4")) { |
464 | NewLine(); |
506 | NewLine(); |
465 | NewLine(); |
507 | NewLine(); |
Line 605... | Line 647... | ||
605 | } |
647 | } |
606 | //============================================================================================ |
648 | //============================================================================================ |
607 | void TWebBrowser::DrawPage() |
649 | void TWebBrowser::DrawPage() |
608 | { |
650 | { |
609 | PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); |
651 | PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); |
610 | page_img.draw_all(list.x, list.y, list.first, list.h); |
652 | page_img.draw_all(list.x, list.y, list.w, list.h, list.first); |
611 | DrawScroller(); |
653 | DrawScroller(); |
612 | }1)>1)>>>>>': |
654 | }1)>1)>>>>>': |
613 | >8);>>>?xml"))> |