Rev 5768 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4411 | leency | 1 | |
5749 | leency | 2 | |
4677 | leency | 3 | enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT}; |
4416 | leency | 4 | |
5746 | leency | 5 | struct _style { |
4416 | leency | 6 | |
5746 | leency | 7 | b, i, u, s, h, |
8 | pre, |
||
5768 | leency | 9 | blq, |
5746 | leency | 10 | li, |
11 | li_tab, |
||
12 | align; |
||
13 | }; |
||
14 | |||
15 | struct TWebBrowser { |
||
16 | |||
4411 | leency | 17 | _style style; |
4540 | leency | 18 | DrawBufer DrawBuf; |
5746 | leency | 19 | void Prepare(); |
4475 | leency | 20 | void SetStyle(); |
5766 | leency | 21 | void DrawStyle(); |
22 | void DrawPage(); |
||
23 | void DrawScroller(); |
||
4411 | leency | 24 | void LoadInternalPage(); |
25 | void NewLine(); |
||
5747 | leency | 26 | void Perenos(); |
4650 | leency | 27 | void BufEncode(); |
4718 | leency | 28 | } WB1; |
5749 | leency | 29 | |
4686 | leency | 30 | |
4486 | leency | 31 | |
5746 | leency | 32 | |
33 | |||
34 | ignor_text, |
||
35 | cur_encoding, |
||
36 | t_html, |
||
37 | t_body; |
||
38 | |||
39 | dword bufpointer; |
||
40 | |||
5749 | leency | 41 | dword bufsize; |
42 | |||
43 | dword text_colors[300]; |
||
4411 | leency | 44 | |
4417 | leency | 45 | dword link_color_inactive; |
46 | dword link_color_active; |
||
4491 | leency | 47 | dword bg_color; |
48 | |||
4417 | leency | 49 | int stroka; |
4411 | leency | 50 | |
4417 | leency | 51 | int tab_len; |
52 | int anchor_line_num; |
||
53 | |||
54 | char URL[10000]; |
||
4636 | leency | 55 | |
5746 | leency | 56 | char line[500]; |
57 | char tagparam[10000]; |
||
4417 | leency | 58 | char tag[100]; |
5746 | leency | 59 | char oldtag[100]; |
4417 | leency | 60 | char attr[1200]; |
5768 | leency | 61 | char val[4096]; |
5746 | leency | 62 | char anchor[256]=0; |
63 | |||
5768 | leency | 64 | #include "..\TWB\history.h" |
4411 | leency | 65 | |
4416 | leency | 66 | #include "..\TWB\colors.h" |
4686 | leency | 67 | #include "..\TWB\unicode_tags.h" |
4411 | leency | 68 | #include "..\TWB\img_cache.h" |
69 | #include "..\TWB\parce_tag.h" |
||
70 | |||
71 | |||
72 | |||
4475 | leency | 73 | |
5747 | leency | 74 | { |
5766 | leency | 75 | int start_x, start_y, line_length, stolbec_len, body_magrin=5; |
4411 | leency | 76 | |
5766 | leency | 77 | if (!header) |
4411 | leency | 78 | |
79 | ChangeCharset("UTF-8", "CP866", #line); |
||
80 | strcpy(#header, #line); |
||
5718 | leency | 81 | strcat(#header, " -"); |
4411 | leency | 82 | strcat(#header, #version); |
83 | line = 0; |
||
84 | return; |
||
85 | } |
||
86 | if (t_html) && (!t_body) return; |
||
87 | |||
4637 | leency | 88 | if (line) && (!anchor) |
4411 | leency | 89 | |
5766 | leency | 90 | start_x = stolbec * list.font_w + body_magrin * DrawBuf.zoom + list.x; |
4411 | leency | 91 | start_y = stroka * list.line_h + body_magrin; |
5766 | leency | 92 | stolbec_len = utf8_strlen(#line) * DrawBuf.zoom; |
93 | line_length = stolbec_len * list.font_w; |
||
5768 | leency | 94 | |
95 | if (style.h) stroka++; |
||
4411 | leency | 96 | |
5768 | leency | 97 | if (style.b) WriteBufText(start_x+1, start_y, list.font_type, text_colors[text_color_index], #line, buf_data); |
5766 | leency | 98 | if (style.i) { stolbec++; DrawBuf.Skew(start_x, start_y, line_length, list.line_h); } // bug with zoom>1 |
99 | if (style.s) DrawBuf.DrawBar(start_x, list.line_h / 2 - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
||
100 | if (style.u) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
||
101 | if (link) { |
||
102 | DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
||
5519 | leency | 103 | PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
5766 | leency | 104 | } |
5678 | leency | 105 | stolbec += stolbec_len; |
4411 | leency | 106 | } |
4718 | leency | 107 | } |
4411 | leency | 108 | //============================================================================================ |
109 | void TWebBrowser::LoadInternalPage(dword bufpos, in_filesize){ |
||
5747 | leency | 110 | bufsize = in_filesize; |
111 | bufpointer = bufpos; |
||
112 | Prepare(); |
||
113 | } |
||
5766 | leency | 114 | //============================================================================================ |
5747 | leency | 115 | void TWebBrowser::Prepare(){ |
116 | word bukva[2]; |
||
5766 | leency | 117 | int j; |
4411 | leency | 118 | byte ignor_param; |
4718 | leency | 119 | char temp[768]; |
4411 | leency | 120 | dword bufpos = bufpointer; |
121 | int line_len; |
||
4636 | leency | 122 | |
4726 | leency | 123 | style.b = style.i = style.u = style.s = style.h = style.blq = t_html = t_body = |
4411 | leency | 124 | |
5768 | leency | 125 | style.align = ALIGN_LEFT; |
5749 | leency | 126 | link_color_inactive = 0x0000FF; |
5746 | leency | 127 | link_color_active = 0xFF0000; |
4491 | leency | 128 | bg_color = 0xFFFFFF; |
129 | DrawBuf.Fill(bg_color); |
||
4411 | leency | 130 | PageLinks.Clear(); |
4475 | leency | 131 | strcpy(#header, #version); |
4504 | leency | 132 | stroka = -list.first; |
4411 | leency | 133 | stolbec = 0; |
4415 | leency | 134 | line = 0; |
4411 | leency | 135 | |
136 | //for plaint text use CP866 for other UTF |
||
137 | |||
5749 | leency | 138 | { |
139 | style.pre = 0; |
||
140 | cur_encoding = CH_CP866; |
||
141 | } |
||
142 | else |
||
143 | { |
||
144 | style.pre = 1; |
||
145 | cur_encoding = CH_UTF8; |
||
146 | } |
||
147 | |||
148 | for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;) |
||
5768 | leency | 149 | |
4718 | leency | 150 | bukva = ESBYTE[bufpos]; |
4411 | leency | 151 | if (ignor_text) && (bukva!='<') continue; |
4508 | leency | 152 | switch (bukva) |
4417 | leency | 153 | { |
4411 | leency | 154 | case 0x0a: |
155 | if (style.pre) |
||
156 | { |
||
5746 | leency | 157 | chrcat(#line, ' '); |
4411 | leency | 158 | bukva = temp = NULL; |
4686 | leency | 159 | Perenos(); |
4411 | leency | 160 | break; |
4718 | leency | 161 | } |
4726 | leency | 162 | case '\9': |
4411 | leency | 163 | if (style.pre) //иначе идём на 0x0d |
164 | { |
||
5746 | leency | 165 | tab_len = strlen(#line) % 4; |
4411 | leency | 166 | if (!tab_len) tab_len = 4; |
4725 | leency | 167 | for (j=0; j |
168 | break; |
||
4411 | leency | 169 | } |
170 | goto DEFAULT_MARK; |
||
171 | |||
172 | case '&': // and so on |
||
173 | |||
174 | tag=0; |
||
4508 | leency | 175 | for (j=0; (ESBYTE[bufpos]<>';') && (j<7); j++, bufpos++;) |
4411 | leency | 176 | { |
4508 | leency | 177 | bukva = ESBYTE[bufpos]; |
4411 | leency | 178 | chrcat(#tag, bukva); |
4508 | leency | 179 | } |
4411 | leency | 180 | if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; |
181 | break; |
||
4417 | leency | 182 | case '<': |
4411 | leency | 183 | bufpos++; |
184 | if (!strncmp(bufpos,"!--",3)) |
||
5749 | leency | 185 | { |
5768 | leency | 186 | if (!strncmp(bufpos,"-->",3)) || (bufpointer + bufsize <= bufpos) break; |
4411 | leency | 187 | bufpos++; |
5768 | leency | 188 | } |
4508 | leency | 189 | tag = attr = tagparam = ignor_param = NULL; |
4411 | leency | 190 | while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //получаем тег и его параметры |
5768 | leency | 191 | { |
4550 | leency | 192 | bukva = ESBYTE[bufpos]; |
4411 | leency | 193 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
4508 | leency | 194 | if (!ignor_param) && (bukva <>' ') |
4411 | leency | 195 | { |
196 | if (strlen(#tag) |
||
197 | } |
||
4726 | leency | 198 | else |
4411 | leency | 199 | { |
200 | ignor_param = true; |
||
201 | if (!ignor_text) && (strlen(#tagparam)+1 |
||
202 | } |
||
203 | bufpos++; |
||
204 | } |
||
4508 | leency | 205 | strlwr(#tag); |
4411 | leency | 206 | |
207 | if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/ |
||
208 | |||
209 | |||
4726 | leency | 210 | Perenos(); |
4411 | leency | 211 | |
5768 | leency | 212 | line = NULL; |
5766 | leency | 213 | if (tag) SetStyle(WB1.DrawBuf.zoom * 5 + list.x, stroka * list.line_h + list.y + 5); //обработка тегов |
4677 | leency | 214 | strcpy(#oldtag, #tag); |
5766 | leency | 215 | tag = attr = tagparam = ignor_param = NULL; |
5768 | leency | 216 | break; |
5746 | leency | 217 | default: |
4411 | leency | 218 | DEFAULT_MARK: |
219 | if (bukva<=15) bukva=' '; |
||
220 | line_len = utf8_strlen(#line); |
||
221 | if (!style.pre) && (bukva == ' ') |
||
5712 | leency | 222 | { |
5746 | leency | 223 | if (line[line_len-1]==' ') break; //no double spaces |
4411 | leency | 224 | if (!stolbec) && (!line) break; //no paces at the beginning of the line |
4726 | leency | 225 | } |
226 | if (line_len < sizeof(line)) chrcat(#line, bukva); |
||
4411 | leency | 227 | Perenos(); |
4726 | leency | 228 | } |
5768 | leency | 229 | } |
4411 | leency | 230 | DrawStyle(); |
231 | NewLine(); |
||
5766 | leency | 232 | DrawPage(); |
233 | if (list.first == 0) list.count = stroka; |
||
4692 | leency | 234 | if (anchor) //если посреди текста появится новый якорь - будет бесконечный цикл |
4415 | leency | 235 | { |
4411 | leency | 236 | anchor=NULL; |
237 | list.first=anchor_line_num; |
||
238 | Prepare(); |
||
4415 | leency | 239 | } |
5766 | leency | 240 | } |
4411 | leency | 241 | //============================================================================================ |
242 | void TWebBrowser::Perenos() |
||
5747 | leency | 243 | { |
4718 | leency | 244 | int perenos_num; |
245 | char new_line_text[4096]; |
||
246 | if (stolbec + utf8_strlen(#line) < list.column_max) return; |
||
247 | perenos_num = strrchr(#line, ' '); |
||
5768 | leency | 248 | if (!perenos_num) && (utf8_strlen(#line)>list.column_max) perenos_num=list.column_max; |
4718 | leency | 249 | strcpy(#new_line_text, #line + perenos_num); |
5712 | leency | 250 | line[perenos_num] = 0x00; |
4718 | leency | 251 | DrawStyle(); |
252 | strcpy(#line, #new_line_text); |
||
5766 | leency | 253 | NewLine(); |
4718 | leency | 254 | } |
255 | //============================================================================================ |
||
256 | void TWebBrowser::SetStyle(int left1, top1) { |
||
5747 | leency | 257 | dword hr_color; |
5766 | leency | 258 | byte opened; |
4411 | leency | 259 | byte meta_encoding; |
4491 | leency | 260 | //проверяем тег открывается или закрывается |
4636 | leency | 261 | if (tag[0] == '/') |
4411 | leency | 262 | { |
263 | opened = 0; |
||
264 | strcpy(#tag, #tag+1); |
||
4491 | leency | 265 | } |
4411 | leency | 266 | else opened = 1; |
267 | |||
4491 | leency | 268 | if (istag("html")) { |
5749 | leency | 269 | |
270 | return; |
||
4637 | leency | 271 | } |
4411 | leency | 272 | if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) { ignor_text = opened; return; } |
273 | if (istag("form")) if (!opened) ignor_text = false; |
||
5749 | leency | 274 | if(istag("title")) { |
5746 | leency | 275 | if (opened) header=NULL; |
5749 | leency | 276 | else if (!stroka) DrawTitle(#header); //тег закрылся - вывели строку |
4491 | leency | 277 | return; |
4411 | leency | 278 | } |
279 | if (ignor_text) return; |
||
280 | |||
281 | IF(istag("q")) |
||
282 | |||
5746 | leency | 283 | if (opened) strcat(#line, " \""); |
4491 | leency | 284 | if (!opened) strcat(#line, "\" "); |
5746 | leency | 285 | return; |
286 | } |
||
5749 | leency | 287 | if (anchor) && (isattr("id=")) { //очень плохо!!! потому что если не последний тег, работать не будет |
4491 | leency | 288 | if (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka; |
5749 | leency | 289 | } |
5746 | leency | 290 | if (istag("body")) { |
5749 | leency | 291 | t_body = opened; |
292 | do{ |
||
4637 | leency | 293 | if (isattr("link=")) link_color_inactive = GetColor(#val); |
4411 | leency | 294 | if (isattr("alink=")) link_color_active = GetColor(#val); |
5746 | leency | 295 | if (isattr("text=")) text_colors[0]=GetColor(#val); |
296 | if (isattr("bgcolor=")) |
||
297 | { |
||
298 | bg_color=GetColor(#val); |
||
4411 | leency | 299 | DrawBuf.Fill(bg_color); |
5746 | leency | 300 | } |
4475 | leency | 301 | } while(GetNextParam()); |
4411 | leency | 302 | if (opened) && (cur_encoding==CH_NULL) debugln("Document has no information about encoding, UTF will be used"); |
303 | return; |
||
5749 | leency | 304 | } |
4411 | leency | 305 | if (istag("a")) { |
306 | if (opened) |
||
5749 | leency | 307 | { |
4491 | leency | 308 | if (link) IF(text_color_index > 0) text_color_index--; //если предыдущий тег а не был закрыт |
4411 | leency | 309 | do{ |
310 | if (isattr("href=")) |
||
311 | { |
||
5746 | leency | 312 | text_color_index++; |
4411 | leency | 313 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
314 | link = 1; |
||
315 | text_colors[text_color_index] = link_color_inactive; |
||
316 | PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); |
||
4491 | leency | 317 | } |
5746 | leency | 318 | if (anchor) && (isattr("name=")) |
4411 | leency | 319 | { |
5746 | leency | 320 | if (!strcmp(#anchor, #val)) |
4411 | leency | 321 | { |
5746 | leency | 322 | anchor_line_num=list.first+stroka; |
4411 | leency | 323 | } |
4415 | leency | 324 | } |
4411 | leency | 325 | } while(GetNextParam()); |
326 | } |
||
327 | else { |
||
328 | link = 0; |
||
329 | IF(text_color_index > 0) text_color_index--; |
||
330 | } |
||
331 | return; |
||
332 | } |
||
333 | if (istag("font")) { |
||
334 | if (opened) |
||
5749 | leency | 335 | { |
4491 | leency | 336 | text_color_index++; |
4411 | leency | 337 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
338 | do{ |
||
339 | if (isattr("color=")) text_colors[text_color_index] = GetColor(#val); |
||
340 | } while(GetNextParam()); |
||
5749 | leency | 341 | } |
4411 | leency | 342 | else if (text_color_index > 0) text_color_index--; |
343 | return; |
||
5749 | leency | 344 | } |
4411 | leency | 345 | if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) { |
346 | IF(oldtag[0] != 'h') NewLine(); |
||
5746 | leency | 347 | if (isattr("bgcolor=")) |
5749 | leency | 348 | { |
5746 | leency | 349 | bg_color=GetColor(#val); |
5493 | leency | 350 | DrawBuf.Fill(bg_color); |
5746 | leency | 351 | } |
5493 | leency | 352 | return; |
353 | } |
||
4411 | leency | 354 | if (istag("p")) { |
355 | IF(oldtag[0] == 'h') return; |
||
5746 | leency | 356 | NewLine(); |
4411 | leency | 357 | IF(opened) NewLine(); |
4692 | leency | 358 | return; |
359 | } |
||
4411 | leency | 360 | if (istag("br")) { NewLine(); return; } |
361 | if (istag("tr")) { if (opened) { NewLine(); strcat(#line, "| "); } return; } |
||
5749 | leency | 362 | if (istag("td")) || (istag("th")) { if (!opened) strcat(#line, " | "); return; } |
363 | if (istag("b")) || (istag("strong")) || (istag("big")) { style.b = opened; return; } |
||
364 | if (istag("i")) || (istag("em")) || (istag("subtitle")) { style.i=opened; return; } |
||
365 | if (istag("u")) || (istag("ins")) { style.u=opened; return;} |
||
366 | if (istag("s")) || (istag("strike")) || (istag("del")) { style.s=opened; return; } |
||
367 | if (istag("dd")) { stolbec += 5; return; } |
||
368 | if (istag("blockquote")) { style.blq = opened; return; } |
||
369 | if (istag("pre")) || (istag("code")) { style.pre = opened; return; } |
||
370 | if (istag("img")) { ImgCache.Images( left1, top1, WB1.list.w); return; } |
||
371 | if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) || (istag("caption")) { |
||
372 | style.h = opened; |
||
373 | NewLine(); |
||
5768 | leency | 374 | if (opened) |
4692 | leency | 375 | { |
4491 | leency | 376 | WB1.DrawBuf.zoom=2; |
4411 | leency | 377 | WB1.list.SetFont(8, 14, 10111001b); |
5768 | leency | 378 | if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; |
379 | if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; |
||
5746 | leency | 380 | if (stroka>1) NewLine(); |
381 | } |
||
5768 | leency | 382 | else |
4411 | leency | 383 | { |
5768 | leency | 384 | WB1.DrawBuf.zoom=1; |
4411 | leency | 385 | WB1.list.SetFont(8, 14, 10111000b); |
5768 | leency | 386 | style.align = ALIGN_LEFT; |
387 | } |
||
5746 | leency | 388 | return; |
4411 | leency | 389 | } |
390 | if (istag("dt")) { |
||
391 | style.li = opened; |
||
5749 | leency | 392 | if (opened) NewLine(); |
5746 | leency | 393 | return; |
5749 | leency | 394 | } |
4411 | leency | 395 | if (istag("li")) || (istag("dt")) //надо сделать вложенные списки |
396 | { |
||
5746 | leency | 397 | style.li = opened; |
4411 | leency | 398 | if (opened) |
5746 | leency | 399 | { |
4491 | leency | 400 | NewLine(); |
4411 | leency | 401 | if (stroka > -1) && (stroka - 2 < list.visible) |
4692 | leency | 402 | DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, list.line_h |
5678 | leency | 403 | / 2 - DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x555555); |
5747 | leency | 404 | } |
405 | return; |
||
4411 | leency | 406 | } |
407 | if (istag("ul")) || (istag("ol")) { |
||
408 | if (!opened) |
||
5749 | leency | 409 | { |
410 | style.li = opened; |
||
411 | style.li_tab--; |
||
412 | NewLine(); |
||
413 | } |
||
414 | else style.li_tab++; |
||
415 | } |
||
416 | if (istag("hr")) { |
||
417 | if (anchor) || (stroka < -1) |
||
418 | { |
||
4411 | leency | 419 | stroka+=2; |
420 | return; |
||
421 | } |
||
422 | if (strcmp(#attr, "color=") == 0) hr_color = GetColor(#val); else hr_color = 0x999999; |
||
423 | NewLine(); |
||
5746 | leency | 424 | DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color); |
4692 | leency | 425 | NewLine(); |
4486 | leency | 426 | } |
4692 | leency | 427 | if (istag("meta")) || (istag("?xml")) { |
4411 | leency | 428 | do{ |
5749 | leency | 429 | if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) |
4411 | leency | 430 | { |
5746 | leency | 431 | strcpy(#val, #val[strrchr(#val, '=')]); //поиск в content= |
4411 | leency | 432 | strlwr(#val); |
5746 | leency | 433 | if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; |
434 | else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; |
||
5749 | leency | 435 | else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251; |
5746 | leency | 436 | else if (isval("iso-8859-5")) || (isval("iso8859-5")) meta_encoding = CH_ISO8859_5; |
437 | else if (isval("dos")) || (isval("cp-866")) meta_encoding = CH_CP866; |
||
438 | if (cur_encoding!=meta_encoding) BufEncode(meta_encoding); |
||
439 | return; |
||
5749 | leency | 440 | } |
4636 | leency | 441 | } while(GetNextParam()); |
4411 | leency | 442 | return; |
443 | } |
||
444 | } |
||
445 | |||
446 | void TWebBrowser::BufEncode(int set_new_encoding) |
||
447 | |||
5749 | leency | 448 | int bufpointer_realsize; |
5704 | leency | 449 | cur_encoding = set_new_encoding; |
450 | if (o_bufpointer==0) |
||
451 | { |
||
452 | o_bufpointer = malloc(bufsize); |
||
453 | strcpy(o_bufpointer, bufpointer); |
||
454 | } |
||
455 | else |
||
456 | { |
||
457 | strcpy(bufpointer, o_bufpointer); |
||
458 | } |
||
459 | } |
||
460 | //============================================================================================ |
||
461 | void TWebBrowser::DrawScroller() |
||
5747 | leency | 462 | { |
4674 | leency | 463 | scroll_wv.max_area = list.count; |
4411 | leency | 464 | scroll_wv.cur_area = list.visible; |
4416 | leency | 465 | scroll_wv.position = list.first; |
466 | |||
467 | scroll_wv.all_redraw = 0; |
||
4411 | leency | 468 | |
5519 | leency | 469 | scroll_wv.start_y = list.y; |
4486 | leency | 470 | |
4508 | leency | 471 | scroll_wv.size_y = list.h; |
4411 | leency | 472 | |
5678 | leency | 473 | |
474 | scrollbar_v_draw(#scroll_wv); |
||
5519 | leency | 475 | |
4416 | leency | 476 | //============================================================================================ |
4411 | leency | 477 | void TWebBrowser::NewLine() |
5747 | leency | 478 | { |
4692 | leency | 479 | int onleft, ontop; |
4475 | leency | 480 | |
5678 | leency | 481 | onleft = list.x + 5; |
4692 | leency | 482 | |
483 | if (t_html) && (!t_body) return; |
||
484 | if (stroka * list.line_h + 5 >= 0) && ( stroka + 1 * list.line_h + 5 < list.h) && (!anchor) |
||
4637 | leency | 485 | { |
5678 | leency | 486 | if (style.align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); |
4475 | leency | 487 | if (style.align == ALIGN_RIGHT) && (DrawBuf.zoom==1) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); |
5746 | leency | 488 | } |
489 | stroka++; |
||
4475 | leency | 490 | if (style.blq) stolbec = 6; else stolbec = 0; |
491 | if (style.li) stolbec = style.li_tab * 5; |
||
5746 | leency | 492 | } |
493 | //============================================================================================ |
||
4488 | leency | 494 | int istag(dword text) { if (!strcmp(#tag,text)) return 1; else return 0; } |
5747 | leency | 495 | int isattr(dword text) { if (!strcmp(#attr,text)) return 1; else return 0; } |
5746 | leency | 496 | int isval(dword text) { if (!strcmp(#val,text)) return 1; else return 0; } |
497 | //============================================================================================ |
||
498 | void TWebBrowser::DrawPage() |
||
5766 | leency | 499 | { |
500 | PutPaletteImage(list.first * list.line_h * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); |
||
501 | DrawScroller(); |
||
502 | }>>>>>=15)>>>=>': |
||
503 | >7);>>')> |
||
504 |