Rev 5493 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5493 | Rev 5519 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | 8 | ||
Line 9... | Line 9... | ||
9 | char header[2048]; |
9 | char header[2048]; |
10 | 10 | ||
- | 11 | struct TWebBrowser { |
|
11 | struct TWebBrowser { |
12 | llist list; |
12 | llist list; |
13 | dword draw_line_height, draw_line_width, draw_list_height; |
13 | DrawBufer DrawBuf; |
14 | DrawBufer DrawBuf; |
14 | void Prepare(); |
15 | void Prepare(); |
15 | void Parse(); |
16 | void Parse(); |
Line 59... | Line 60... | ||
59 | //======================================================================= |
60 | //======================================================================= |
Line 60... | Line 61... | ||
60 | 61 | ||
61 | 62 | ||
62 | void TWebBrowser::DrawPage() |
63 | void TWebBrowser::DrawPage() |
Line 63... | Line 64... | ||
63 | { |
64 | { |
64 | int start_x, start_y, line_length, stolbec_len, magrin_left=5; |
65 | int start_x, start_y, zstart_x, zstart_y, line_length, zline_length, stolbec_len, magrin_left=5; |
65 | 66 | ||
66 | if (!header) |
67 | if (!header) |
Line 75... | Line 76... | ||
75 | 76 | ||
76 | if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor) |
77 | if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor) |
77 | { |
78 | { |
78 | start_x = stolbec * 6 + list.x + magrin_left; |
79 | start_x = stolbec * 6 + list.x + magrin_left; |
- | 80 | start_y = stroka * list.line_h + list.y + magrin_left; |
|
- | 81 | zstart_x = stolbec * 6 + magrin_left * DrawBuf.zoomf + list.x; |
|
79 | start_y = stroka * list.line_h + list.y + magrin_left; |
82 | zstart_y = stroka * list.line_h * DrawBuf.zoomf + magrin_left + list.y; |
80 | stolbec_len = strlen(#line); |
83 | stolbec_len = strlen(#line); |
- | 84 | line_length = stolbec_len * 6; |
|
Line 81... | Line 85... | ||
81 | line_length = stolbec_len * 6; |
85 | zline_length = stolbec_len * 6 * DrawBuf.zoomf; |
82 | 86 | ||
83 | WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data); |
87 | WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data); |
84 | IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data); |
88 | if (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data); |
85 | IF (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); } |
89 | if (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); } |
86 | IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
90 | if (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
87 | IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
- | |
88 | IF (link) { |
91 | if (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
- | 92 | if (link) { |
|
89 | UnsafeDefineButton(start_x-2, start_y-1, line_length + 3, 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
93 | DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
90 | DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
94 | UnsafeDefineButton(zstart_x-2, zstart_y-1, zline_length + 3, DrawBuf.zoomf * 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
91 | PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
95 | PageLinks.AddText(#line, zline_length, draw_line_height, UNDERLINE); |
92 | } |
96 | } |
93 | stolbec += stolbec_len; |
97 | stolbec += stolbec_len; |
94 | } |
98 | } |
Line 143... | Line 147... | ||
143 | strcpy(#header, #version); |
147 | strcpy(#header, #version); |
144 | stroka = -list.first; |
148 | stroka = -list.first; |
145 | stolbec = 0; |
149 | stolbec = 0; |
146 | line = 0; |
150 | line = 0; |
Line -... | Line 151... | ||
- | 151 | ||
- | 152 | draw_line_height = list.line_h * DrawBuf.zoomf; |
|
- | 153 | draw_line_width = list.w * DrawBuf.zoomf; |
|
- | 154 | draw_list_height = list.h * DrawBuf.zoomf; |
|
147 | 155 | ||
148 | if (pre_text<>2) |
156 | if (pre_text<>2) |
149 | { |
157 | { |
150 | pre_text=0; |
158 | pre_text=0; |
151 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
159 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
Line 245... | Line 253... | ||
245 | if (tagparam) GetNextParam(); |
253 | if (tagparam) GetNextParam(); |
Line 246... | Line 254... | ||
246 | 254 | ||
247 | if (stolbec + strlen(#line) > list.column_max) Perenos(); |
255 | if (stolbec + strlen(#line) > list.column_max) Perenos(); |
248 | DrawPage(); |
256 | DrawPage(); |
249 | line = NULL; |
257 | line = NULL; |
250 | if (tag) SetTextStyle(list.x + 5, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ |
258 | if (tag) SetTextStyle(WB1.DrawBuf.zoomf * 5 + list.x, stroka * draw_line_height + list.y + 5); //îáðàáîòêà òåãîâ |
251 | tag = parametr = tagparam = ignor_param = NULL; |
259 | tag = parametr = tagparam = ignor_param = NULL; |
252 | break; |
260 | break; |
253 | default: |
261 | default: |
254 | DEFAULT_MARK: |
262 | DEFAULT_MARK: |
Line 263... | Line 271... | ||
263 | if (stolbec + line_len > list.column_max) Perenos(); |
271 | if (stolbec + line_len > list.column_max) Perenos(); |
264 | } |
272 | } |
265 | } |
273 | } |
266 | DrawPage(); |
274 | DrawPage(); |
267 | NewLine(); |
275 | NewLine(); |
268 | DrawBar(list.x, stroka * list.line_h + list.y + 5, list.w, -stroka * list.line_h + list.h - 5, bg_color); |
276 | DrawBar(list.x, stroka * draw_line_height + list.y + 5, draw_line_width, -stroka * draw_line_height + draw_list_height - 5, bg_color); |
269 | DrawBar(list.x, list.visible * list.line_h + list.y + 4, list.w, -list.visible * list.line_h + list.h - 4, bg_color); |
277 | DrawBar(list.x, list.visible * draw_line_height + list.y + 4, draw_line_width, -list.visible * draw_line_height + draw_list_height - 4, bg_color); |
270 | if (list.first == 0) list.count = stroka; |
278 | if (list.first == 0) list.count = stroka; |
271 | if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
279 | if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
272 | { |
280 | { |
273 | anchor=NULL; |
281 | anchor=NULL; |
274 | list.first=anchor_line_num; |
282 | list.first=anchor_line_num; |
Line 378... | Line 386... | ||
378 | text_color_index++; |
386 | text_color_index++; |
379 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
387 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
Line 380... | Line 388... | ||
380 | 388 | ||
381 | link = 1; |
389 | link = 1; |
382 | text_colors[text_color_index] = link_color_inactive; |
390 | text_colors[text_color_index] = link_color_inactive; |
383 | PageLinks.AddLink(#options, stolbec*6+left1, top1-2); |
391 | PageLinks.AddLink(#options, DrawBuf.zoomf * stolbec*6+left1, top1-2); |
384 | } |
392 | } |
385 | if (anchor) && (!strcmp(#parametr, "name=")) |
393 | if (anchor) && (!strcmp(#parametr, "name=")) |
386 | { |
394 | { |
387 | if (!strcmp(#anchor, #options)) |
395 | if (!strcmp(#anchor, #options)) |
Line 546... | Line 554... | ||
546 | { |
554 | { |
547 | li_text = opened; |
555 | li_text = opened; |
548 | if (opened) |
556 | if (opened) |
549 | { |
557 | { |
550 | NewLine(); |
558 | NewLine(); |
551 | if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-2, 2, 2, 0x555555); |
559 | if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + list.x, list.line_h/2-2, 2, 2, 0x555555); |
552 | } |
560 | } |
553 | return; |
561 | return; |
554 | } |
562 | } |
555 | if (isTag("u")) || (isTag("ins")) u_text = opened; |
563 | if (isTag("u")) || (isTag("ins")) u_text = opened; |
556 | if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened; |
564 | if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened; |
Line 607... | Line 615... | ||
607 | scroll_wv.position = list.first; |
615 | scroll_wv.position = list.first; |
Line 608... | Line 616... | ||
608 | 616 | ||
609 | scroll_wv.all_redraw=0; |
617 | scroll_wv.all_redraw = 0; |
610 | scroll_wv.start_x = list.x + list.w; |
618 | scroll_wv.start_x = list.x + list.w; |
- | 619 | scroll_wv.start_y = list.y; |
|
611 | scroll_wv.start_y = list.y; |
620 | |
- | 621 | scroll_wv.size_y = list.h * DrawBuf.zoomf; |
|
Line 612... | Line 622... | ||
612 | scroll_wv.size_y=list.h; |
622 | scroll_wv.start_x = list.w * DrawBuf.zoomf + list.x; |
613 | 623 | ||
Line 614... | Line 624... | ||
614 | scrollbar_v_draw(#scroll_wv); |
624 | scrollbar_v_draw(#scroll_wv); |
615 | } |
625 | } |
616 | 626 | ||
617 | - | ||
Line 618... | Line 627... | ||
618 | void TWebBrowser::NewLine() |
627 | |
619 | { |
628 | void TWebBrowser::NewLine() |
- | 629 | { |
|
620 | int onleft; |
630 | int onleft, ontop, zontop; |
621 | int ontop; |
631 | |
622 | 632 | onleft = list.x + 5; |
|
623 | onleft = list.x + 5; |
633 | ontop = stroka * list.line_h + list.y + 5; |
624 | ontop = stroka * list.line_h + list.y + 5; |
634 | zontop = stroka * list.line_h * DrawBuf.zoomf + list.y + 5; |
625 | if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color); |
635 | if (!stroka) DrawBar(list.x, list.y, draw_line_width, 5, bg_color); |
626 | if (t_html) && (!t_body) return; |
636 | if (t_html) && (!t_body) return; |
- | 637 | if (ontop>=list.y) && ( ontop < list.h+list.y-10) && (!anchor) |
|
627 | if (ontop>=list.y) && ( ontop < list.h+list.y-10) && (!anchor) |
638 | { |
628 | { |
639 | if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * 6); |
629 | if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * 6); |
640 | if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * 6); |
630 | if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * 6); |
641 | DrawBuf.bufy = ontop; |
631 | DrawBuf.bufy = ontop; |
642 | DrawBuf.zbufy = zontop; |