Rev 9341 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8439 | leency | 1 | void TWebBrowser::SetStyle() |
2 | { |
||
8444 | leency | 3 | if (tag.get_value_of("name")) || (tag.get_value_of("id")) { |
8439 | leency | 4 | anchors.add(tag.value, draw_y); |
5 | if (anchors.current) && (streq(tag.value, #anchors.current+1)) { |
||
6 | list.first = draw_y; |
||
7 | anchors.current = NULL; |
||
8 | } |
||
9 | } |
||
10 | if (tag.is("a")) { tag_a(); return; } |
||
11 | if (tag.is("p")) { tag_p(); return; } |
||
12 | if (tag.is("img")) { tag_img(); return; } |
||
13 | if (tag.is("div")) { tag_div(); return; } |
||
8500 | leency | 14 | if (tag.is("br")) { /*draw_x++;*/NewLine(); return; } |
9302 | leency | 15 | if (tag.is("nav")) { style.nav = tag.opened; return; } |
8439 | leency | 16 | if (tag.is("header")) { NewLine(); return; } |
17 | if (tag.is("article")) { NewLine(); return; } |
||
18 | if (tag.is("footer")) { NewLine(); return; } |
||
19 | if (tag.is("figure")) { NewLine(); return; } |
||
20 | if (tag.is("w:p")) { NewLine(); return; } |
||
8462 | leency | 21 | if (tag.is("b")) { style.b = tag.opened; return; } |
22 | if (tag.is("strong")) { style.b = tag.opened; return; } |
||
23 | if (tag.is("big")) { style.b = tag.opened; return; } |
||
24 | if (tag.is("w:b")) { style.b = tag.opened; return; } |
||
25 | if (tag.is("u")) { style.u = tag.opened; return; } |
||
26 | if (tag.is("ins")) { style.u = tag.opened; return; } |
||
27 | if (tag.is("s")) { style.s = tag.opened; return; } |
||
28 | if (tag.is("strike")) { style.s = tag.opened; return; } |
||
29 | if (tag.is("del")) { style.s = tag.opened; return; } |
||
30 | if (tag.is("pre")) { style.pre = tag.opened; return; } |
||
31 | if (tag.is("blockquote")) { style.blq = tag.opened; return; } |
||
32 | if (tag.is("button")) { style.button = tag.opened; return; } |
||
8439 | leency | 33 | if (tag.is("dl")) { if (tag.opened) NewLine(); return; } |
34 | if (tag.is("w:r")) { if (!tag.opened) style.b = false; return; } |
||
35 | if (tag.is("h1")) { tag_h1234_caption(); return; } |
||
36 | if (tag.is("h2")) { tag_h1234_caption(); return; } |
||
37 | if (tag.is("h3")) { tag_h1234_caption(); return; } |
||
38 | if (tag.is("h4")) { tag_h1234_caption(); return; } |
||
39 | if (tag.is("font")) { tag_font(); return; } |
||
40 | if (tag.is("dt")) { tag_ol_ul_dt(); return; } |
||
9263 | leency | 41 | if (tag.is("dd")) { tag_ol_ul_dt(); return; } |
8439 | leency | 42 | if (tag.is("ul")) { tag_ol_ul_dt(); return; } |
43 | if (tag.is("ol")) { tag_ol_ul_dt(); return; } |
||
44 | if (tag.is("li")) { tag_li(); return; } |
||
45 | if (tag.is("q")) { tag_q(); return; } |
||
46 | if (tag.is("hr")) { tag_hr(); return; } |
||
47 | if (tag.is("meta")) { tag_meta_xml(); return; } |
||
48 | if (tag.is("?xml")) { tag_meta_xml(); return; } |
||
49 | if (tag.is("code")) { tag_code(); return; } |
||
50 | if (tag.is("iframe")) { tag_iframe(); return; } |
||
51 | if (tag.is("caption")) { tag_h1234_caption(); return; } |
||
52 | if (tag.is("title")) { tag_title(); return; } |
||
53 | if (tag.is("body")) { tag_body(); return; } |
||
54 | if (tag.is("html")) { t_html = tag.opened; return; } |
||
9294 | leency | 55 | if (tag.is("table")) { tag_table(); return; } |
56 | if (tag.is("tr")) { tag_table(); return; } |
||
57 | if (tag.is("th")) { tag_table(); return; } |
||
58 | if (tag.is("td")) { tag_table(); return; } |
||
9350 | pavelyakov | 59 | |
60 | if (application_mode) { |
||
61 | if (tag.is("exit")) { ExitProcess(); return; } |
||
62 | } |
||
8439 | leency | 63 | } |
64 | |||
65 | void TWebBrowser::tag_p() |
||
66 | { |
||
67 | IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return; |
||
68 | NewLine(); |
||
69 | } |
||
70 | |||
71 | void TWebBrowser::tag_title() |
||
72 | { |
||
73 | style.title = tag.opened; |
||
74 | if (!tag.opened) DrawTitle(#header); |
||
75 | } |
||
76 | |||
77 | void TWebBrowser::tag_font() |
||
78 | { |
||
79 | style.font = tag.opened; |
||
80 | if (tag.opened) |
||
81 | { |
||
8451 | leency | 82 | if (tag.get_value_of("bg")) { |
83 | bg_colors.add(GetColor(tag.value)); |
||
84 | } else { |
||
85 | bg_colors.add(bg_colors.get_last()); |
||
86 | } |
||
8444 | leency | 87 | if (tag.get_value_of("color")) { |
8439 | leency | 88 | text_colors.add(GetColor(tag.value)); |
89 | } else { |
||
90 | text_colors.add(text_colors.get_last()); |
||
91 | } |
||
92 | } |
||
8451 | leency | 93 | else { |
9341 | leency | 94 | if (bg_colors.count>1) text_colors.pop(); |
8499 | leency | 95 | if (bg_colors.count>1) bg_colors.pop(); //never pop the last color |
8451 | leency | 96 | } |
8439 | leency | 97 | } |
98 | |||
99 | void TWebBrowser::tag_div() |
||
100 | { |
||
8499 | leency | 101 | //if (streq(#tag.prior,"div")) && (tag.opened) return; |
8490 | leency | 102 | if (streq(#tag.prior,"td")) return; |
8499 | leency | 103 | if (streq(#tag.prior,"div")) return; |
8439 | leency | 104 | if (!tag.opened) && (style.font) text_colors.pop(); |
105 | NewLine(); |
||
106 | } |
||
107 | |||
108 | void TWebBrowser::tag_iframe() |
||
109 | { |
||
8444 | leency | 110 | if (tag.get_value_of("src")) { |
8439 | leency | 111 | NewLine(); |
8492 | leency | 112 | strcpy(#linebuf, "IFRAME: "); |
8491 | leency | 113 | RenderTextbuf(); |
8439 | leency | 114 | link=true; |
115 | links.add_link(tag.value); |
||
8492 | leency | 116 | strncpy(#linebuf, tag.value, sizeof(TWebBrowser.linebuf)-1); |
8491 | leency | 117 | RenderTextbuf(); |
8439 | leency | 118 | link=false; |
119 | NewLine(); |
||
120 | } |
||
121 | } |
||
122 | |||
123 | void TWebBrowser::tag_a() |
||
124 | { |
||
125 | if (tag.opened) |
||
126 | { |
||
8444 | leency | 127 | if (tag.get_value_of("href")) && (!strstr(tag.value,"javascript:")) |
8439 | leency | 128 | { |
129 | link = true; |
||
130 | links.add_link(tag.value); |
||
131 | } |
||
132 | } else { |
||
133 | link = false; |
||
134 | } |
||
135 | } |
||
136 | |||
137 | void TWebBrowser::tag_meta_xml() |
||
138 | { |
||
8444 | leency | 139 | if (custom_encoding == -1) if (tag.get_value_of("charset")) |
140 | || (tag.get_value_of("content")) || (tag.get_value_of("encoding")) |
||
8439 | leency | 141 | { |
142 | EDX = strrchr(tag.value, '=') + tag.value; //search in content= |
||
143 | if (ESBYTE[EDX] == '"') EDX++; |
||
144 | strlwr(EDX); |
||
8492 | leency | 145 | EAX = get_encoding_type_by_name(EDX); |
146 | if (EAX!=-1) ChangeEncoding(EAX); |
||
8439 | leency | 147 | } |
8444 | leency | 148 | if (streq(tag.get_value_of("http-equiv"), "refresh")) && (tag.get_value_of("content")) { |
149 | if (tag.value = strstri(tag.value, "url")) strcpy(#redirect, tag.value); |
||
8439 | leency | 150 | } |
9350 | pavelyakov | 151 | if (streq(tag.get_value_of("name"), "application")) { |
152 | if (application_mode) { |
||
153 | if (tag.get_value_of("left")) { |
||
154 | MoveSize(atoi(tag.value),-1,-1,-1); |
||
155 | } |
||
156 | if (tag.get_value_of("top")) { |
||
157 | MoveSize(-1,atoi(tag.value),-1,-1); |
||
158 | } |
||
159 | if (tag.get_value_of("width")) { |
||
160 | MoveSize(-1,-1,atoi(tag.value),-1); |
||
161 | } |
||
162 | if (tag.get_value_of("height")) { |
||
163 | MoveSize(-1,-1,-1,atoi(tag.value)); |
||
164 | } |
||
165 | } |
||
166 | } |
||
8439 | leency | 167 | } |
168 | |||
8492 | leency | 169 | signed int get_encoding_type_by_name(dword name) |
170 | { |
||
171 | EDX = name; |
||
172 | if (streqrp(EDX,"utf-8")) || (streqrp(EDX,"utf8")) return CH_UTF8; |
||
173 | else if (streqrp(EDX,"windows-1251")) || (streqrp(EDX,"windows1251")) return CH_CP1251; |
||
174 | else if (streqrp(EDX,"dos")) || (streqrp(EDX,"cp-866")) return CH_CP866; |
||
175 | else if (streqrp(EDX,"iso-8859-5")) || (streqrp(EDX,"iso8859-5")) return CH_ISO8859_5; |
||
176 | else if (streqrp(EDX,"koi8-r")) || (streqrp(EDX,"koi8-u")) return CH_KOI8; |
||
177 | return -1; |
||
178 | } |
||
179 | |||
8439 | leency | 180 | void TWebBrowser::tag_code() |
181 | { |
||
182 | if (style.pre = tag.opened) { |
||
8451 | leency | 183 | bg_colors.add(0xe4ffcb); |
8439 | leency | 184 | } else { |
8499 | leency | 185 | if (bg_colors.count>1) bg_colors.pop(); //never pop the last color |
8439 | leency | 186 | } |
187 | } |
||
188 | |||
189 | void TWebBrowser::tag_ol_ul_dt() |
||
190 | { |
||
191 | char type = ESBYTE[#tag.name]; |
||
192 | switch(type) |
||
193 | { |
||
194 | case 'd': |
||
9263 | leency | 195 | if (ESBYTE[#tag.name+1]=='d') style.tag_list.upd_level(tag.opened, type); |
196 | if (ESBYTE[#tag.name+1]=='t') style.tag_list.upd_level(false, 'd'); |
||
8439 | leency | 197 | if (tag.opened) NewLine(); |
198 | break; |
||
199 | case 'u': |
||
200 | case 'o': |
||
9302 | leency | 201 | if (style.nav) && (style.tag_list.level) NewLine(); |
9263 | leency | 202 | style.tag_list.upd_level(tag.opened, type); |
8439 | leency | 203 | if (!tag.opened) && (!style.pre) NewLine(); |
204 | } |
||
205 | } |
||
206 | |||
207 | void TWebBrowser::tag_li() |
||
208 | { |
||
9302 | leency | 209 | if (style.nav) return; |
8439 | leency | 210 | if (tag.opened) { |
211 | if (!style.tag_list.level) style.tag_list.upd_level(1, 'u'); |
||
212 | if (!style.pre) NewLine(); |
||
213 | if (style.tag_list.order_type() == 'u') { |
||
8492 | leency | 214 | strcpy(#linebuf, "\31 "); |
8462 | leency | 215 | draw_x = style.tag_list.level * 5 - 2 * list.font_w + left_gap; |
8439 | leency | 216 | } |
217 | if (style.tag_list.order_type() == 'o') { |
||
8492 | leency | 218 | sprintf(#linebuf, "%i. ", style.tag_list.inc_counter()); |
219 | draw_x = style.tag_list.level * 5 - 1 - strlen(#linebuf) * list.font_w + left_gap; |
||
8439 | leency | 220 | } |
221 | } |
||
222 | } |
||
223 | |||
224 | void TWebBrowser::tag_hr() |
||
225 | { |
||
9103 | leency | 226 | dword hrcol = 0x00777777; |
8491 | leency | 227 | if (tag.get_value_of("color")) hrcol = GetColor(tag.value); |
228 | if (draw_x != left_gap) NewLine(); |
||
9293 | leency | 229 | if (secondrun) canvas.DrawBar(5+left_gap, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol); |
8500 | leency | 230 | draw_x++; |
8439 | leency | 231 | NewLine(); |
232 | return; |
||
233 | } |
||
234 | |||
235 | void TWebBrowser::tag_body() |
||
236 | { |
||
237 | t_body = tag.opened; |
||
8444 | leency | 238 | if (tag.get_value_of("link")) link_color_default = GetColor(tag.value); |
239 | if (tag.get_value_of("alink")) link_color_active = GetColor(tag.value); |
||
240 | if (tag.get_value_of("text")) text_colors.set(0, GetColor(tag.value)); |
||
241 | if (tag.get_value_of("bgcolor")) { |
||
8451 | leency | 242 | bg_colors.set(0, GetColor(tag.value)); |
243 | canvas.Fill(0, bg_colors.get(0)); |
||
8439 | leency | 244 | } |
245 | // Autodetecting encoding if no encoding was set |
||
246 | if (tag.opened) && (custom_encoding==-1) && (cur_encoding == CH_CP866) { |
||
247 | if (strstr(bufpointer, "\208\190")) ChangeEncoding(CH_UTF8); |
||
248 | else if (chrnum(bufpointer, '\246')>5) ChangeEncoding(CH_CP1251); |
||
249 | } |
||
250 | } |
||
251 | |||
252 | void TWebBrowser::tag_q() |
||
253 | { |
||
8492 | leency | 254 | chrncat(#linebuf, '\"', sizeof(TWebBrowser.linebuf)); |
8439 | leency | 255 | } |
256 | |||
257 | void TWebBrowser::tag_h1234_caption() |
||
258 | { |
||
259 | if (ESBYTE[#tag.name+1]=='4') { |
||
260 | NewLine(); |
||
261 | NewLine(); |
||
262 | style.h = tag.opened; |
||
263 | style.b = tag.opened; |
||
264 | } else { |
||
265 | style.h = tag.opened; |
||
266 | if (tag.opened) { |
||
267 | if (!style.pre) NewLine(); |
||
268 | draw_y += 10; |
||
8457 | leency | 269 | list.SetFont(BASIC_CHAR_W*2, 14*2, 10011001b); |
8439 | leency | 270 | list.item_h = BASIC_LINE_H * 2 - 2; |
271 | if (tag.is("h1")) style.b = true; |
||
272 | } else { |
||
273 | if (tag.is("h1")) style.b = false; |
||
274 | NewLine(); |
||
8457 | leency | 275 | list.SetFont(BASIC_CHAR_W, 14, 10011000b); |
8451 | leency | 276 | style.cur_line_h = list.item_h = BASIC_LINE_H; |
8439 | leency | 277 | } |
278 | } |
||
279 | } |
||
280 | |||
281 | |||
282 | void TWebBrowser::tag_img() |
||
283 | { |
||
284 | char img_path[4096]=0; |
||
8462 | leency | 285 | dword base64img; |
8439 | leency | 286 | |
8454 | leency | 287 | if (!tag.get_value_of("data-large-image")) |
288 | if (!tag.get_value_of("data-src")) |
||
289 | if (!tag.get_value_of("src")) return; |
||
8439 | leency | 290 | |
291 | if (streqrp(tag.value, "data:")) { |
||
292 | if (!strstr(tag.value, "base64,")) goto NOIMG; |
||
293 | EDX = EAX+7; |
||
294 | if (ESBYTE[EDX]==' ') EDX++; |
||
8462 | leency | 295 | base64img = malloc(strlen(EDX)); |
296 | base64_decode stdcall (EDX, base64img, strlen(EDX)); |
||
297 | img_decode stdcall (base64img, EAX, 0); |
||
8439 | leency | 298 | $push eax |
8462 | leency | 299 | free(base64img); |
8439 | leency | 300 | $pop eax |
301 | if (EAX) goto IMGOK; else goto NOIMG; |
||
302 | } |
||
303 | |||
304 | if (!strcmp(tag.value + strrchr(tag.value, '.'), "svg")) goto NOIMG; |
||
8454 | leency | 305 | if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG; |
306 | |||
8439 | leency | 307 | strlcpy(#img_path, tag.value, sizeof(img_path)-1); |
8490 | leency | 308 | replace_char(#img_path, ' ', '\0', sizeof(img_path)); |
8439 | leency | 309 | get_absolute_url(#img_path, history.current()); |
310 | |||
311 | if (check_is_the_adress_local(#img_path)) { |
||
312 | img_from_file stdcall(#img_path); |
||
313 | if (EAX) goto IMGOK; else goto NOIMG; |
||
314 | } |
||
315 | |||
316 | if (cache.has(#img_path)) { |
||
317 | img_decode stdcall (cache.current_buf, cache.current_size, 0); |
||
318 | if (EAX) goto IMGOK; else goto NOIMG; |
||
319 | } else { |
||
320 | img_url.add(#img_path); |
||
321 | goto NOIMG; |
||
322 | } |
||
323 | |||
324 | IMGOK: |
||
8462 | leency | 325 | if (RenderImage(EAX)) return; |
8439 | leency | 326 | |
327 | NOIMG: |
||
8444 | leency | 328 | if (tag.get_value_of("title")) || (tag.get_value_of("alt")) { |
8492 | leency | 329 | strncpy(#img_path, tag.value, sizeof(TWebBrowser.linebuf)-3); |
330 | sprintf(#linebuf, "[%s]", #img_path); |
||
8439 | leency | 331 | } else { |
332 | if (streqrp(#img_path, "data:")) img_path=0; |
||
333 | replace_char(#img_path, '?', NULL, strlen(#img_path)); |
||
8492 | leency | 334 | img_path[sizeof(TWebBrowser.linebuf)-3] = '\0'; //prevent overflow in sprintf |
335 | sprintf(#linebuf, "[%s]", #img_path+strrchr(#img_path, '/')); |
||
336 | linebuf[50]= NULL; |
||
8439 | leency | 337 | } |
338 | text_colors.add(0x9A6F29); |
||
339 | style.image = true; |
||
8491 | leency | 340 | RenderTextbuf(); |
8439 | leency | 341 | style.image = false; |
342 | text_colors.pop(); |
||
8462 | leency | 343 | } |
344 | |||
345 | |||
346 | |||
347 | |||
9103 | leency | 348 | |
9263 | leency | 349 | struct TABLE { |
9294 | leency | 350 | int count; |
9263 | leency | 351 | int depth; |
9309 | leency | 352 | int margin; |
9263 | leency | 353 | collection_int cols; |
9309 | leency | 354 | collection_int width; |
9263 | leency | 355 | } table; |
9103 | leency | 356 | |
357 | |||
358 | int tr_pos, td_pos; |
||
359 | int row_start_y; |
||
360 | int colcount; |
||
361 | dword tallest_cell_in_row; |
||
8492 | leency | 362 | |
363 | void TWebBrowser::tag_table_reset() |
||
364 | { |
||
9263 | leency | 365 | table.depth = 0; |
9294 | leency | 366 | table.count = 0; |
9103 | leency | 367 | colcount = 0; |
368 | tr_pos = 0; |
||
369 | td_pos = 0; |
||
8492 | leency | 370 | } |
371 | |||
8462 | leency | 372 | void TWebBrowser::tag_table() |
373 | { |
||
9293 | leency | 374 | if (!tag.opened) { |
375 | if (style.font) tag_font(); |
||
376 | if (link) tag_a(); |
||
377 | style.b = false; |
||
378 | } |
||
9103 | leency | 379 | if (tag.is("table")) { |
380 | if(tag.opened) { |
||
9263 | leency | 381 | table.depth++; |
382 | if (table.depth==1) { |
||
9294 | leency | 383 | table.count++; |
9263 | leency | 384 | colcount = 0; |
9318 | leency | 385 | td_pos = 0; |
386 | row_start_y = draw_y; |
||
9309 | leency | 387 | if (tag.get_number_of("width")) { |
388 | if (strchr(tag.value, '%')) tag.number = list.w * tag.number / 100; |
||
389 | table.width.set(table.count, math.min(tag.number,list.w)); |
||
390 | } else { |
||
391 | table.width.set(table.count, list.w); |
||
392 | } |
||
9263 | leency | 393 | } |
9103 | leency | 394 | } else { |
9263 | leency | 395 | if (table.depth>0) { |
396 | table.depth--; |
||
397 | } |
||
398 | if (table.depth==0) { |
||
9103 | leency | 399 | draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN; |
400 | draw_w = list.w; |
||
9318 | leency | 401 | if (td_pos) draw_y = math.max(draw_y, tallest_cell_in_row); |
9103 | leency | 402 | draw_y = math.max(draw_y+style.cur_line_h, tallest_cell_in_row); |
9318 | leency | 403 | row_start_y = tallest_cell_in_row = draw_y; |
9103 | leency | 404 | style.cur_line_h = list.item_h; |
405 | } |
||
8492 | leency | 406 | } |
9103 | leency | 407 | } |
9263 | leency | 408 | if (table.depth>1) { |
9103 | leency | 409 | if (tag.is("tr")) && (tag.opened) NewLine(); |
410 | return; |
||
411 | } |
||
412 | |||
413 | if (!secondrun) { |
||
414 | if (tag.is("tr")) { |
||
415 | if (tag.opened) { |
||
9263 | leency | 416 | table.cols.add(1); |
9103 | leency | 417 | } |
9104 | leency | 418 | colcount = 0; |
8492 | leency | 419 | } |
9294 | leency | 420 | if (tag.opened) if (tag.is("td")) || (tag.is("th")) { |
421 | if (!table.cols.count) { table.cols.add(1); colcount = 0;} |
||
9103 | leency | 422 | colcount++; |
9263 | leency | 423 | if (colcount) table.cols.set(table.cols.count-1, colcount); |
9103 | leency | 424 | //if (tag.get_number_of("colspan")) colcount += tag.number-1; |
9294 | leency | 425 | } |
9103 | leency | 426 | } else { |
427 | if (tag.is("tr")) { |
||
428 | if (tag.opened) { |
||
9318 | leency | 429 | if (td_pos) draw_y = math.max(draw_y, tallest_cell_in_row); |
9294 | leency | 430 | _TR_FIX: |
9103 | leency | 431 | if (draw_x==left_gap) && (draw_y==BODY_MARGIN) { |
432 | row_start_y = tallest_cell_in_row = draw_y; |
||
433 | } else { |
||
434 | row_start_y = tallest_cell_in_row = draw_y = draw_y + style.cur_line_h; |
||
435 | } |
||
436 | style.cur_line_h = list.item_h; |
||
437 | tr_pos++; |
||
438 | td_pos = 0; |
||
8500 | leency | 439 | } else { |
9104 | leency | 440 | draw_y = math.max(draw_y, tallest_cell_in_row); |
9318 | leency | 441 | td_pos = 0; |
8500 | leency | 442 | } |
9104 | leency | 443 | draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN; |
444 | draw_w = list.w; |
||
8492 | leency | 445 | } |
9294 | leency | 446 | if (tag.is("td")) || (tag.is("th")) { |
447 | |||
448 | if (!tr_pos) goto _TR_FIX; |
||
449 | |||
450 | /* |
||
451 | if (tag.opened) { |
||
452 | if (tag.get_value_of("bgcolor")) { |
||
453 | bg_colors.add(GetColor(tag.value)); |
||
454 | } else { |
||
455 | bg_colors.add(bg_colors.get(0)); |
||
456 | } |
||
457 | } */ |
||
458 | |||
9103 | leency | 459 | tallest_cell_in_row = math.max(draw_y+style.cur_line_h-list.item_h, tallest_cell_in_row); |
460 | style.cur_line_h = list.item_h; |
||
461 | if (tag.opened) { |
||
9294 | leency | 462 | |
463 | if (!td_pos) { |
||
9309 | leency | 464 | table.margin = list.w - table.width.get(table.count) / 2 + BODY_MARGIN; |
465 | draw_x = left_gap = table.margin; |
||
466 | draw_w = table.width.get(table.count) - BODY_MARGIN; |
||
9294 | leency | 467 | } else { |
468 | draw_x = left_gap = left_gap + draw_w; |
||
9318 | leency | 469 | draw_w = table.width.get(table.count) - left_gap + table.margin - BODY_MARGIN; |
9294 | leency | 470 | } |
471 | |||
9318 | leency | 472 | if (EAX = table.cols.get(tr_pos-1)-td_pos) { |
473 | draw_w /= EAX; |
||
474 | } else { |
||
9294 | leency | 475 | draw_y = row_start_y; |
9309 | leency | 476 | draw_x = left_gap = table.margin; |
9294 | leency | 477 | } |
478 | if (table.cols.get(tr_pos-1)-td_pos>1) && (tag.get_number_of("width")) { |
||
479 | if (strchr(tag.value, '%')) { |
||
9309 | leency | 480 | tag.number = table.width.get(table.count) - table.margin - 23 - left_gap * tag.number / 100; |
9294 | leency | 481 | } |
482 | if (tag.number < draw_w) draw_w = tag.number; |
||
483 | } |
||
9103 | leency | 484 | draw_y = row_start_y; |
485 | //canvas.WriteText(draw_x, draw_y, 10001001b, 0x0000FE, itoa(draw_x), NULL); |
||
9318 | leency | 486 | //canvas.WriteText(draw_x, draw_y+20, 10001001b, 0xFF0000, itoa(draw_w), NULL); |
487 | td_pos++; |
||
9103 | leency | 488 | } |
8500 | leency | 489 | } |
9103 | leency | 490 | } |
9309 | leency | 491 | if (draw_x > table.width.get(table.count)) { |
492 | draw_x = left_gap = table.margin; |
||
493 | draw_w = table.width.get(table.count) - table.margin - 23 - left_gap; |
||
9294 | leency | 494 | table.depth = 0; |
495 | NewLine(); |
||
496 | if (debug_mode) { |
||
497 | debugln("anomaly draw_x"); |
||
498 | canvas.DrawBar(0, draw_y, 20, 20, 0xFF0000); |
||
499 | } |
||
500 | } |
||
9318 | leency | 501 | /* |
502 | if (left_gap + draw_w > list.w) { |
||
503 | draw_w = list.w - left_gap; |
||
504 | if (debug_mode) debugln("anomaly draw_W"); |
||
505 | } |
||
506 | */ |
||
9103 | leency | 507 | }> |
8500 | leency | 508 |