Rev 7738 | Rev 7743 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4411 | leency | 1 | |
4677 | leency | 2 | |
4416 | leency | 3 | |
5746 | leency | 4 | |
4416 | leency | 5 | |
5746 | leency | 6 | bool |
7742 | leency | 7 | b, u, s, h, |
6794 | leency | 8 | pre, |
5746 | leency | 9 | blq, |
10 | li, |
||
11 | li_tab, |
||
12 | button, |
||
7742 | leency | 13 | image, |
14 | align; |
||
5746 | leency | 15 | }; |
16 | |||
17 | |||
4411 | leency | 18 | llist list; |
4540 | leency | 19 | _style style; |
5746 | leency | 20 | DrawBufer DrawBuf; |
4475 | leency | 21 | int zoom; |
6803 | leency | 22 | void Prepare(); |
5766 | leency | 23 | void SetStyle(); |
24 | void DrawStyle(); |
||
25 | void DrawPage(); |
||
4411 | leency | 26 | void DrawScroller(); |
27 | void LoadInternalPage(); |
||
5747 | leency | 28 | void NewLine(); |
4650 | leency | 29 | void Perenos(); |
4718 | leency | 30 | void BufEncode(); |
5749 | leency | 31 | } WB1; |
4686 | leency | 32 | |
4486 | leency | 33 | |
5746 | leency | 34 | |
7742 | leency | 35 | link, |
5746 | leency | 36 | ignor_text, |
37 | cur_encoding, |
||
38 | t_html, |
||
39 | t_body; |
||
40 | |||
41 | |||
5781 | leency | 42 | dword o_bufpointer=0; |
43 | dword bufsize=0; |
||
44 | |||
4411 | leency | 45 | |
4417 | leency | 46 | dword text_color_index; |
47 | dword link_color_inactive; |
||
4491 | leency | 48 | dword link_color_active; |
49 | dword bg_color; |
||
4417 | leency | 50 | |
4411 | leency | 51 | |
6794 | leency | 52 | int stolbec; |
4417 | leency | 53 | int tab_len; |
54 | |||
4636 | leency | 55 | |
6794 | leency | 56 | int basic_line_h=22; |
57 | |||
58 | |||
5746 | leency | 59 | char header[2048]; |
60 | char line[500]; |
||
4417 | leency | 61 | char tagparam[10000]; |
5746 | leency | 62 | char tag[100]; |
4417 | leency | 63 | char oldtag[100]; |
5768 | leency | 64 | char attr[1200]; |
5746 | leency | 65 | char val[4096]; |
66 | |||
4411 | leency | 67 | |
5990 | leency | 68 | #include "..\TWB\links.h" |
4686 | leency | 69 | #include "..\TWB\anchors.h" |
7738 | leency | 70 | #include "..\TWB\colors.h" |
4411 | leency | 71 | #include "..\TWB\unicode_tags.h" |
72 | #include "..\TWB\img_cache.h" |
||
73 | #include "..\TWB\parce_tag.h" |
||
74 | |||
75 | |||
4475 | leency | 76 | |
5747 | leency | 77 | void TWebBrowser::DrawStyle() |
5766 | leency | 78 | { |
4411 | leency | 79 | dword start_x, line_length, stolbec_len; |
6803 | leency | 80 | |
4411 | leency | 81 | |
82 | { |
||
83 | strcpy(#header, #line); |
||
7032 | leency | 84 | line = 0; |
4411 | leency | 85 | return; |
86 | } |
||
87 | if (t_html) && (!t_body) return; |
||
4637 | leency | 88 | |
4411 | leency | 89 | |
6803 | leency | 90 | { |
4411 | leency | 91 | start_x = stolbec * list.font_w + body_magrin + list.x; |
6794 | leency | 92 | stolbec_len = strlen(#line) * zoom; |
6803 | leency | 93 | line_length = stolbec_len * list.font_w; |
5768 | leency | 94 | |
4411 | leency | 95 | |
7742 | leency | 96 | DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, 0xF9DBCB); |
97 | } |
||
98 | if (style.button) { |
||
99 | DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h - calc(zoom*2), 0xCCCccc); |
||
100 | DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999); |
||
101 | } |
||
102 | |||
103 | |||
7738 | leency | 104 | if (style.b) DrawBuf.WriteText(start_x+1, draw_y, list.font_type, text_colors[text_color_index], #line); |
105 | if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]); |
||
6803 | leency | 106 | if (style.u) DrawBuf.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_colors[text_color_index]); |
107 | if (link) { |
||
5519 | leency | 108 | DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, text_colors[text_color_index]); |
6803 | leency | 109 | PageLinks.AddText(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2), UNDERLINE, zoom); //TODO: set bigger underline_h for style.h |
110 | } |
||
4411 | leency | 111 | stolbec += stolbec_len; |
4718 | leency | 112 | } |
4411 | leency | 113 | } |
114 | //============================================================================================ |
||
5747 | leency | 115 | void TWebBrowser::LoadInternalPage(dword bufpos, in_filesize){ |
116 | bufsize = in_filesize; |
||
117 | bufpointer = bufpos; |
||
118 | Prepare(); |
||
5766 | leency | 119 | } |
5747 | leency | 120 | //============================================================================================ |
121 | void TWebBrowser::Prepare(){ |
||
5766 | leency | 122 | word bukva[2]; |
4411 | leency | 123 | dword j; |
6803 | leency | 124 | byte ignor_param; |
4411 | leency | 125 | dword bufpos; |
5773 | leency | 126 | dword line_len; |
6803 | leency | 127 | style.b = style.u = style.s = style.h = style.blq = t_html = t_body = |
6794 | leency | 128 | style.li = link = ignor_text = text_color_index = text_colors[0] = style.li_tab = 0; |
5749 | leency | 129 | style.align = ALIGN_LEFT; |
5746 | leency | 130 | link_color_inactive = 0x0000FF; |
4491 | leency | 131 | link_color_active = 0xFF0000; |
132 | bg_color = 0xFFFFFF; |
||
6783 | leency | 133 | DrawBuf.Fill(0, bg_color); |
7738 | leency | 134 | PageLinks.Clear(); |
4504 | leency | 135 | strcpy(#header, #version); |
4411 | leency | 136 | draw_y = body_magrin; |
6794 | leency | 137 | stolbec = 0; |
4411 | leency | 138 | line = 0; |
139 | zoom = 1; |
||
6803 | leency | 140 | //for plaint text use CP866 for other UTF |
5749 | leency | 141 | if (strstri(bufpointer, "html")!=-1) |
6783 | leency | 142 | { |
5749 | leency | 143 | debugln(" found"); |
6783 | leency | 144 | style.pre = false; |
145 | cur_encoding = CH_NULL; |
||
6045 | leency | 146 | } |
5749 | leency | 147 | else |
148 | { |
||
149 | debugln("no "); |
||
6783 | leency | 150 | style.pre = true; |
151 | cur_encoding = CH_NULL; |
||
6045 | leency | 152 | } |
5749 | leency | 153 | for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;) |
5773 | leency | 154 | { |
4411 | leency | 155 | if (ignor_text) && (ESBYTE[bufpos]!='<') continue; |
5773 | leency | 156 | bukva = ESBYTE[bufpos]; |
4508 | leency | 157 | switch (bukva) |
4411 | leency | 158 | { |
159 | case 0x0a: |
||
160 | if (style.pre) |
||
5746 | leency | 161 | { |
4411 | leency | 162 | DrawStyle(); |
5781 | leency | 163 | line = NULL; |
6783 | leency | 164 | NewLine(); |
5781 | leency | 165 | break; |
4726 | leency | 166 | } |
4411 | leency | 167 | goto DEFAULT_MARK; |
6783 | leency | 168 | case '\9': |
4411 | leency | 169 | if (style.pre) //otherwise go to 0x0d |
6735 | leency | 170 | { |
4411 | leency | 171 | tab_len = strlen(#line) % 4; |
4725 | leency | 172 | if (!tab_len) tab_len = 4; |
173 | for (j=0; j |
||
4411 | leency | 174 | break; |
175 | } |
||
176 | goto DEFAULT_MARK; |
||
6783 | leency | 177 | case '&': // and so on |
4411 | leency | 178 | bufpos++; |
4508 | leency | 179 | tag=0; |
4411 | leency | 180 | for (j=0; (ESBYTE[bufpos]<>';') && (j<7); j++, bufpos++;) |
4508 | leency | 181 | { |
4411 | leency | 182 | bukva = ESBYTE[bufpos]; |
4508 | leency | 183 | chrcat(#tag, bukva); |
4411 | leency | 184 | } |
185 | if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; |
||
4417 | leency | 186 | break; |
4411 | leency | 187 | case '<': |
188 | bufpos++; |
||
5749 | leency | 189 | if (!strncmp(bufpos,"!--",3)) |
5768 | leency | 190 | { |
4411 | leency | 191 | bufpos+=3; |
6986 | leency | 192 | while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufpointer + bufsize) |
193 | { |
||
194 | bufpos++; |
||
195 | } |
||
196 | bufpos+=3; |
||
197 | break; |
||
198 | } |
||
4411 | leency | 199 | tag = attr = tagparam = ignor_param = NULL; |
5768 | leency | 200 | while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷à åì òåã è åãî ïà ðà ìåòðû |
6735 | leency | 201 | { |
4411 | leency | 202 | bukva = ESBYTE[bufpos]; |
4508 | leency | 203 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
4411 | leency | 204 | if (!ignor_param) && (bukva <>' ') |
205 | { |
||
206 | if (strlen(#tag)+1 |
||
6686 | leency | 207 | } |
4411 | leency | 208 | else |
209 | { |
||
210 | ignor_param = true; |
||
211 | if (!ignor_text) && (strlen(#tagparam)+1 |
||
212 | } |
||
213 | bufpos++; |
||
4508 | leency | 214 | } |
4411 | leency | 215 | strlwr(#tag); |
216 | |||
217 | |||
218 | if (tagparam) GetNextParam(); |
||
4726 | leency | 219 | Perenos(); |
5768 | leency | 220 | DrawStyle(); |
5766 | leency | 221 | line = NULL; |
4677 | leency | 222 | if (tag) SetStyle(); |
6735 | leency | 223 | strlcpy(#oldtag, #tag, sizeof(oldtag)); |
6686 | leency | 224 | tag = attr = tagparam = ignor_param = NULL; |
5746 | leency | 225 | break; |
4411 | leency | 226 | default: |
227 | DEFAULT_MARK: |
||
228 | if (bukva<=15) bukva=' '; |
||
229 | line_len = strlen(#line); |
||
6021 | leency | 230 | if (!style.pre) && (bukva == ' ') |
5746 | leency | 231 | { |
4411 | leency | 232 | if (line[line_len-1]==' ') break; //no double spaces |
4726 | leency | 233 | if (!stolbec) && (!line) break; //no paces at the beginning of the line |
234 | } |
||
4411 | leency | 235 | if (line_len < sizeof(line)) chrcat(#line, bukva); |
4726 | leency | 236 | Perenos(); |
5768 | leency | 237 | } |
4411 | leency | 238 | } |
239 | DrawStyle(); |
||
5766 | leency | 240 | NewLine(); |
241 | if (list.first == 0) list.count = draw_y; |
||
6794 | leency | 242 | DrawPage(); |
4692 | leency | 243 | } |
4411 | leency | 244 | //============================================================================================ |
5747 | leency | 245 | void TWebBrowser::Perenos() |
4718 | leency | 246 | { |
247 | int perenos_num; |
||
248 | char new_line_text[4096]; |
||
249 | if (strlen(#line)*zoom + stolbec < list.column_max) return; |
||
6803 | leency | 250 | perenos_num = strrchr(#line, ' '); |
4718 | leency | 251 | if (!perenos_num) && (strlen(#line)*zoom>list.column_max) { |
7742 | leency | 252 | perenos_num=list.column_max/zoom; |
253 | if (!stolbec)&&(style.pre) draw_y-=list.item_h; //hack to fix https://prnt.sc/rk3kyt |
||
254 | } |
||
255 | strcpy(#new_line_text, #line + perenos_num); |
||
4718 | leency | 256 | line[perenos_num] = 0x00; |
257 | DrawStyle(); |
||
5766 | leency | 258 | strcpy(#line, #new_line_text); |
4718 | leency | 259 | NewLine(); |
260 | } |
||
261 | //============================================================================================ |
||
5747 | leency | 262 | void TWebBrowser::SetStyle() { |
5773 | leency | 263 | char img_path[4096]; |
7742 | leency | 264 | int left1 = body_magrin + list.x; |
6794 | leency | 265 | bool opened; |
7742 | leency | 266 | int meta_encoding; |
267 | if (tag[0] == '/') |
||
4411 | leency | 268 | { |
269 | opened = 0; |
||
4491 | leency | 270 | strcpy(#tag, #tag+1); |
4411 | leency | 271 | } |
272 | else opened = 1; |
||
4491 | leency | 273 | if (istag("html")) { |
5749 | leency | 274 | t_html = opened; |
4637 | leency | 275 | return; |
4411 | leency | 276 | } |
277 | if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) { ignor_text = opened; return; } |
||
5749 | leency | 278 | if (istag("form")) if (!opened) ignor_text = false; |
5746 | leency | 279 | if(istag("title")) { |
5749 | leency | 280 | if (opened) header=NULL; |
4491 | leency | 281 | return; |
4411 | leency | 282 | } |
283 | if (ignor_text) return; |
||
284 | |||
285 | |||
5746 | leency | 286 | { |
4491 | leency | 287 | if (opened) strcat(#line, " \""); |
5746 | leency | 288 | if (!opened) strcat(#line, "\" "); |
289 | return; |
||
5749 | leency | 290 | } |
4491 | leency | 291 | if (isattr("id=")) || (isattr("name=")) { // TO FIX: works only if the param is the last |
7738 | leency | 292 | anchors.add(#val, draw_y); |
293 | } |
||
294 | if (istag("body")) { |
||
5749 | leency | 295 | t_body = opened; |
4637 | leency | 296 | do{ |
4411 | leency | 297 | if (isattr("link=")) link_color_inactive = GetColor(#val); |
5746 | leency | 298 | if (isattr("alink=")) link_color_active = GetColor(#val); |
299 | if (isattr("text=")) text_colors[0]=GetColor(#val); |
||
300 | if (isattr("bgcolor=")) |
||
301 | { |
||
4411 | leency | 302 | bg_color = GetColor(#val); |
6783 | leency | 303 | DrawBuf.Fill(0, bg_color); |
7738 | leency | 304 | } |
4411 | leency | 305 | } while(GetNextParam()); |
306 | if (opened) && (cur_encoding==CH_NULL) { |
||
7032 | leency | 307 | cur_encoding = CH_CP866; |
7742 | leency | 308 | //BufEncode(CH_UTF8); |
309 | debugln("Document has no information about encoding!"); |
||
310 | } |
||
7032 | leency | 311 | if (opened) { |
312 | if (strcmp(#header, #version) != 0) { |
||
7208 | leency | 313 | ChangeCharset(charsets[cur_encoding], "CP866", #header); |
7056 | leency | 314 | sprintf(#header, "%s - %s", #header, #version); |
315 | } |
||
316 | DrawTitle(#header); |
||
7032 | leency | 317 | } |
318 | return; |
||
4411 | leency | 319 | } |
320 | if (istag("a")) { |
||
5749 | leency | 321 | if (opened) |
4491 | leency | 322 | { |
4411 | leency | 323 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à ÃÃ¥ áûë çà êðûò |
6735 | leency | 324 | do{ |
4411 | leency | 325 | if (isattr("href=")) && (!strstr(#val,"javascript:")) |
6001 | leency | 326 | { |
4411 | leency | 327 | text_color_index++; |
328 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
||
329 | link = 1; |
||
330 | text_colors[text_color_index] = link_color_inactive; |
||
4491 | leency | 331 | PageLinks.AddLink(#val); |
6795 | leency | 332 | } |
4411 | leency | 333 | } while(GetNextParam()); |
334 | } |
||
335 | else { |
||
336 | link = 0; |
||
337 | IF(text_color_index > 0) text_color_index--; |
||
338 | } |
||
339 | return; |
||
340 | } |
||
341 | if (istag("font")) { |
||
5749 | leency | 342 | if (opened) |
4491 | leency | 343 | { |
4411 | leency | 344 | text_color_index++; |
345 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
||
346 | do{ |
||
347 | if (isattr("color=")) text_colors[text_color_index] = GetColor(#val); |
||
5749 | leency | 348 | } while(GetNextParam()); |
4411 | leency | 349 | } |
350 | else if (text_color_index > 0) text_color_index--; |
||
5749 | leency | 351 | return; |
4411 | leency | 352 | } |
353 | if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) { |
||
5746 | leency | 354 | IF(oldtag[0] != 'h') NewLine(); |
5749 | leency | 355 | return; |
4411 | leency | 356 | } |
357 | if (istag("p")) { |
||
5746 | leency | 358 | IF(oldtag[0] == 'h') return; |
4411 | leency | 359 | NewLine(); |
4692 | leency | 360 | IF(opened) NewLine(); |
361 | return; |
||
4411 | leency | 362 | } |
363 | if (istag("br")) { NewLine(); return; } |
||
5749 | leency | 364 | if (istag("tr")) { if (opened) NewLine(); return; } |
5990 | leency | 365 | if (istag("b")) || (istag("strong")) || (istag("big")) { style.b = opened; return; } |
5749 | leency | 366 | if (istag("button")) { style.button = opened; stolbec++; return; } |
7742 | leency | 367 | if (istag("u")) || (istag("ins")) { style.u=opened; return;} |
5749 | leency | 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")) { |
||
7742 | leency | 373 | do{ |
374 | if (isattr("src=")) strcpy(#img_path, #val); |
||
375 | if (isattr("alt=")) sprintf(#line, "[%s]", #val); |
||
376 | } while(GetNextParam()); |
||
377 | style.image = true; |
||
378 | text_color_index++; |
||
379 | text_colors[text_color_index] = 0x9A6F29; |
||
380 | if (!line) { |
||
381 | if (!strncmp(#img_path, "data:", 5)) img_path=0; |
||
382 | sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/')); |
||
383 | line[50]= NULL; |
||
384 | } |
||
385 | if (strlen(#line) + stolbec > list.column_max) Perenos(); |
||
386 | DrawStyle(); |
||
387 | line=0; |
||
388 | text_color_index--; |
||
389 | style.image = false; |
||
390 | //ImgCache.Images( left1, draw_y, WB1.list.w); |
||
391 | return; |
||
392 | } |
||
393 | if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("caption")) { |
||
7208 | leency | 394 | style.h = opened; |
5768 | leency | 395 | if (opened) |
4491 | leency | 396 | { |
4411 | leency | 397 | NewLine(); |
6794 | leency | 398 | draw_y += 10; |
399 | WB1.zoom=2; |
||
6803 | leency | 400 | WB1.list.font_type |= 10011001b; |
6045 | leency | 401 | if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; |
5746 | leency | 402 | if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; |
403 | list.item_h = basic_line_h * 2; |
||
6794 | leency | 404 | if (istag("h1")) style.b = true; |
7742 | leency | 405 | } |
4411 | leency | 406 | else |
5768 | leency | 407 | { |
4411 | leency | 408 | if (istag("h1")) style.b = false; |
7742 | leency | 409 | NewLine(); |
6794 | leency | 410 | WB1.zoom=1; |
6803 | leency | 411 | WB1.list.font_type = 10011000b; |
6045 | leency | 412 | style.align = ALIGN_LEFT; |
5746 | leency | 413 | list.item_h = basic_line_h; |
6794 | leency | 414 | } |
4411 | leency | 415 | return; |
416 | } |
||
417 | if (istag("dt")) { |
||
5749 | leency | 418 | style.li = opened; |
5746 | leency | 419 | if (opened) NewLine(); |
5749 | leency | 420 | return; |
4411 | leency | 421 | } |
422 | if (istag("li")) || (istag("dt")) |
||
5773 | leency | 423 | { |
4411 | leency | 424 | style.li = opened; |
5746 | leency | 425 | if (opened) |
4491 | leency | 426 | { |
4411 | leency | 427 | NewLine(); |
4692 | leency | 428 | strcpy(#line, "\31 "); |
7742 | leency | 429 | stolbec-=2; |
430 | } |
||
4411 | leency | 431 | return; |
432 | } |
||
433 | if (istag("ul")) || (istag("ol")) { |
||
5749 | leency | 434 | if (!opened) |
435 | { |
||
436 | style.li = opened; |
||
437 | style.li_tab--; |
||
438 | NewLine(); |
||
439 | } |
||
440 | else style.li_tab++; |
||
441 | } |
||
442 | if (istag("hr")) { |
||
443 | if (isattr("color=")) EDI = GetColor(#val); else EDI = 0x999999; |
||
5773 | leency | 444 | $push edi; |
445 | NewLine(); |
||
4692 | leency | 446 | $pop edi; |
5773 | leency | 447 | DrawBuf.DrawBar(5, draw_y - 1, list.w-10, 1, EDI); |
6794 | leency | 448 | NewLine(); |
4692 | leency | 449 | return; |
5773 | leency | 450 | } |
4411 | leency | 451 | if (istag("meta")) || (istag("?xml")) { |
5749 | leency | 452 | meta_encoding = CH_NULL; |
6045 | leency | 453 | do{ |
4411 | leency | 454 | if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) |
5746 | leency | 455 | { |
4411 | leency | 456 | strcpy(#val, #val[strrchr(#val, '=')]); //search in content= |
6735 | leency | 457 | strlwr(#val); |
5746 | leency | 458 | if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; |
5749 | leency | 459 | else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; |
5746 | leency | 460 | else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251; |
461 | else if (isval("iso-8859-5")) || (isval("iso8859-5")) meta_encoding = CH_ISO8859_5; |
||
462 | else if (isval("dos")) || (isval("cp-866")) meta_encoding = CH_CP866; |
||
463 | } |
||
4411 | leency | 464 | } while(GetNextParam()); |
465 | if (meta_encoding!=CH_NULL) BufEncode(meta_encoding); |
||
6045 | leency | 466 | return; |
4411 | leency | 467 | } |
468 | } |
||
469 | |||
470 | |||
6803 | leency | 471 | { |
5704 | leency | 472 | if (cur_encoding == set_new_encoding) return; |
7032 | leency | 473 | if (o_bufpointer==0) |
5704 | leency | 474 | { |
475 | o_bufpointer = malloc(bufsize); |
||
476 | strcpy(o_bufpointer, bufpointer); |
||
477 | } |
||
478 | else |
||
479 | { |
||
480 | strcpy(bufpointer, o_bufpointer); |
||
481 | } |
||
482 | //debugval("cur_encoding ", cur_encoding); |
||
7742 | leency | 483 | //debugval("set_new_encoding", set_new_encoding); |
484 | cur_encoding = set_new_encoding; |
||
7032 | leency | 485 | bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer); |
486 | } |
||
5704 | leency | 487 | //============================================================================================ |
5747 | leency | 488 | void TWebBrowser::DrawScroller() |
4674 | leency | 489 | { |
4411 | leency | 490 | scroll_wv.max_area = list.count; |
4416 | leency | 491 | scroll_wv.cur_area = list.visible; |
492 | scroll_wv.position = list.first; |
||
493 | scroll_wv.all_redraw = 0; |
||
5519 | leency | 494 | scroll_wv.start_x = list.x + list.w; |
4486 | leency | 495 | scroll_wv.start_y = list.y; |
4508 | leency | 496 | scroll_wv.size_y = list.h; |
5678 | leency | 497 | scrollbar_v_draw(#scroll_wv); |
4416 | leency | 498 | } |
4411 | leency | 499 | //============================================================================================ |
5747 | leency | 500 | void TWebBrowser::NewLine() |
4692 | leency | 501 | { |
4475 | leency | 502 | dword onleft, ontop; |
6803 | leency | 503 | static int empty_line=0; |
7742 | leency | 504 | |
4692 | leency | 505 | |
6794 | leency | 506 | |
7742 | leency | 507 | |
508 | if (empty_line<1) empty_line++; |
||
509 | else return; |
||
510 | } else { |
||
511 | empty_line=0; |
||
512 | } |
||
513 | |||
6794 | leency | 514 | |
515 | ontop = draw_y + list.y; |
||
516 | if (t_html) && (!t_body) return; |
||
4637 | leency | 517 | draw_y += list.item_h; |
6794 | leency | 518 | if (style.blq) stolbec = 6; else stolbec = 0; |
5746 | leency | 519 | if (style.li) stolbec = style.li_tab * 5; |
520 | } |
||
4488 | leency | 521 | //============================================================================================ |
5747 | leency | 522 | bool istag(dword text) { if (!strcmp(#tag,text)) return true; else return false; } |
6803 | leency | 523 | bool isattr(dword text) { if (!strcmp(#attr,text)) return true; else return false; } |
524 | bool isval(dword text) { if (!strcmp(#val,text)) return true; else return false; } |
||
525 | //============================================================================================ |
||
5766 | leency | 526 | void TWebBrowser::DrawPage() |
527 | { |
||
528 | PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); |
||
6794 | leency | 529 | DrawScroller(); |
5766 | leency | 530 | }1)>>>=15)>>>>': |
531 | >7);>>')>> |