Subversion Repositories Kolibri OS

Rev

Rev 8499 | Rev 9104 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8499 Rev 8500
Line 9... Line 9...
9
	}
9
	}
10
	if (tag.is("a"))          { tag_a();                   return; }
10
	if (tag.is("a"))          { tag_a();                   return; }
11
	if (tag.is("p"))          { tag_p();                   return; } 
11
	if (tag.is("p"))          { tag_p();                   return; } 
12
	if (tag.is("img"))        { tag_img();                 return; }
12
	if (tag.is("img"))        { tag_img();                 return; }
13
	if (tag.is("div"))        { tag_div();                 return; }
13
	if (tag.is("div"))        { tag_div();                 return; }
14
	if (tag.is("br"))         { NewLine();                 return; }
14
	if (tag.is("br"))         { /*draw_x++;*/NewLine();    return; }
15
	if (tag.is("header"))     { NewLine();                 return; }
15
	if (tag.is("header"))     { NewLine();                 return; }
16
	if (tag.is("article"))    { NewLine();                 return; }
16
	if (tag.is("article"))    { NewLine();                 return; }
17
	if (tag.is("footer"))     { NewLine();                 return; } 
17
	if (tag.is("footer"))     { NewLine();                 return; } 
18
	if (tag.is("figure"))     { NewLine();                 return; }
18
	if (tag.is("figure"))     { NewLine();                 return; }
19
	if (tag.is("w:p"))        { NewLine();                 return; }
19
	if (tag.is("w:p"))        { NewLine();                 return; }
Line 200... Line 200...
200
{
200
{
201
	dword hrcol = 0x777777;
201
	dword hrcol = 0x777777;
202
	if (tag.get_value_of("color")) hrcol = GetColor(tag.value);
202
	if (tag.get_value_of("color")) hrcol = GetColor(tag.value);
203
	if (draw_x != left_gap) NewLine();
203
	if (draw_x != left_gap) NewLine();
204
	canvas.DrawBar(5, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol);
204
	canvas.DrawBar(5, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol);
-
 
205
	draw_x++;
205
	NewLine();
206
	NewLine();
206
	return;
207
	return;
207
}
208
}
Line 208... Line 209...
208
 
209
 
Line 317... Line 318...
317
}
318
}
Line -... Line 319...
-
 
319
 
318
 
320
 
Line 319... Line 321...
319
 
321
 
320
 
322
 
321
 
323
int tdepth;
322
 
324
int col_n;
323
 
325
 
-
 
326
struct TABLE {
324
struct TABLE {
327
	collection_int col_w;
Line 325... Line 328...
325
	int count;
328
	collection_int col_span;
326
	int col;
329
	collection_int row_h;
-
 
330
	int row_y, next_row_y;
327
	collection_int cx;
331
	int colcount;
-
 
332
} t[5];
328
	int row_y, next_row_y;
333
 
-
 
334
void TWebBrowser::tag_table_reset()
-
 
335
{
329
} table;
336
	int i;
330
 
337
	tdepth = 0;
-
 
338
	for (i=0; i<5; i++) {
331
void TWebBrowser::tag_table_reset()
339
		t[i].col_w.drop();
Line 332... Line 340...
332
{
340
		t[i].row_h.drop();
333
	table.count = 0;
341
		t[i].col_span.drop();
334
	table.cx.drop();
342
		t[i].row_y = 0;
335
	table.row_y = 0;
343
		t[i].next_row_y = 0;
336
	table.next_row_y = 0;
344
	}
337
}
345
}
338
 
346
 
339
void TWebBrowser::tag_table()
347
void TWebBrowser::tag_table()
340
{
348
{
341
	if (tag.opened) {
349
	if (tag.opened) {
342
		if (!table.count) {
350
		if (tdepth==0) {
343
			table.next_row_y = table.row_y = draw_y;
351
			t[0].next_row_y = t[0].row_y = draw_y;
-
 
352
		}
344
		}
353
		tdepth++;
345
		table.count++;
354
	} else {
346
	} else {
355
		tdepth--;
Line 347... Line 356...
347
		table.count--;
356
		if (tdepth==0) {
348
		if (!table.count) {
357
			draw_y = math.max(draw_y + style.cur_line_h, t[0].next_row_y);
349
			draw_y = math.max(draw_y + style.cur_line_h, table.next_row_y);
358
			left_gap = BODY_MARGIN;
350
			left_gap = BODY_MARGIN;
359
			draw_w = list.w - BODY_MARGIN;
351
		}
360
		}
352
	} 
361
	} 
-
 
362
}
353
}
363
 
354
 
364
:void TWebBrowser::tag_tr()
355
void TWebBrowser::tag_tr()
365
{
356
{
366
	if (tag.opened) {
357
	if (tag.opened) {
367
		if (tdepth>1) {
358
		if (table.count>1) {
368
			NewLine();
359
			NewLine();
369
		} else {
Line 360... Line 370...
360
		} else {
370
			t[0].colcount = math.max(t[0].colcount, col_n);
361
			table.col = 0;
371
			col_n = 0;
362
			table.row_y = math.max(draw_y + style.cur_line_h, table.next_row_y);
372
			t[0].row_y = math.max(draw_y + style.cur_line_h, t[0].next_row_y);
363
			left_gap = BODY_MARGIN;
373
			left_gap = BODY_MARGIN;
-
 
374
			NewLine();	
364
			NewLine();	
375
		}		
365
		}		
376
	}
366
	}
377
}
367
}
378
 
-
 
379
:void TWebBrowser::tag_td()
368
 
380
{
369
void TWebBrowser::tag_td()
381
	if (tdepth>1) return;
-
 
382
	if (tag.opened) {
370
{
383
 
-
 
384
		t[0].next_row_y = math.max(draw_y + style.cur_line_h, t[0].next_row_y);
-
 
385
		style.cur_line_h = list.item_h;
371
	if (table.count>1) return;
386
		t[0].col_w.set(col_n, math.max(draw_x,t[0].col_w.get(col_n)) );
372
	if (tag.opened) {
387
		draw_x = left_gap = t[0].col_w.get(col_n);
-
 
388
		draw_w = list.w - left_gap;
373
		table.next_row_y = math.max(draw_y + style.cur_line_h, table.next_row_y);
389
		draw_y = t[0].row_y;
374
		draw_y = table.row_y;
-
 
375
		table.cx.set(table.col, math.max(draw_x,table.cx.get(table.col)) );
390
		if (tag.get_number_of("width")) {
-
 
391
			if (!strchr(tag.value, '%')) {
-
 
392
				draw_w = tag.number;
Line 376... Line 393...
376
		draw_x = left_gap = table.cx.get(table.col);
393
			} else {
377
		table.col++;
394
				if (tag.number < 100) {
378
		if (tag.get_value_of("width")) {
395
					draw_w = draw_w - left_gap * tag.number / 100;
379
			draw_w = EAX;
396
					if (draw_w > list.w - left_gap) draw_w = list.w - left_gap;
380
			//debugval("draw_w", atoi(tag.value));
-
 
381
			table.cx.set(table.col, draw_x + atoi(tag.value));
397
				}
-
 
398
			}
382
		}
399
		}
Line 383... Line 400...
383
		//if (tag.get_value_of("height")) table.next_row_y = draw_y + atoi(tag.value);
400
		col_n++;
384
	} 
401
		t[0].col_w.set(col_n, draw_x + draw_w);
385
 
402
 
386
	if (left_gap >= list.w - list.font_w - 10) {
403
		if (left_gap >= list.w - list.font_w - 10) {
387
		debugln("left_gap overflow");
404
			debugln("left_gap overflow");
-
 
405
			draw_x = left_gap = BODY_MARGIN;
388
		draw_x = left_gap = BODY_MARGIN;
406
			t[0].col_w.drop();
389
		table.cx.drop();
407
			NewLine();
-
 
408
			canvas.WriteText(draw_x, draw_y, 10011001b, 0xFE0000, "lgo", NULL);
-
 
409
		}