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