Subversion Repositories Kolibri OS

Rev

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

Rev 4688 Rev 4692
Line 246... Line 246...
246
				strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
246
				strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
247
				line[perenos_num] = 0x00;
247
				line[perenos_num] = 0x00;
248
				if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
248
				if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
249
				DrawPage();
249
				DrawPage();
250
				strcpy(#line, #temp);				
250
				strcpy(#line, #temp);
251
				NewLine(list.x + 5, stroka * 10 + list.y + 5); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
251
				NewLine(); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
252
			}
252
			}
253
			DrawPage();
253
			DrawPage();
254
			line = NULL;
254
			line = NULL;
255
			if (tag) SetTextStyle(list.x + 5, stroka * 10 + list.y + 5); //îáðàáîòêà òåãîâ
255
			if (tag) SetTextStyle(list.x + 5, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ
256
			tag = parametr = tagparam = ignor_param = NULL;
256
			tag = parametr = tagparam = ignor_param = NULL;
257
			break;
257
			break;
258
		default:
258
		default:
259
			DEFAULT_MARK:
259
			DEFAULT_MARK:
260
			if (bukva<=15) bukva=' ';
260
			if (bukva<=15) bukva=' ';
Line 273... Line 273...
273
				strcpy(#temp, #line + perenos_num);
273
				strcpy(#temp, #line + perenos_num);
274
				line[perenos_num] = 0x00;
274
				line[perenos_num] = 0x00;
275
				if (stroka-1 > list.visible) && (list.first <>0) break 1;
275
				if (stroka-1 > list.visible) && (list.first <>0) break 1;
276
				DrawPage();
276
				DrawPage();
277
				strcpy(#line, #temp);
277
				strcpy(#line, #temp);
278
				NewLine(list.x + 5, stroka * 10 + list.y + 5);
278
				NewLine();
279
			}
279
			}
280
		}
280
		}
281
	}
281
	}
Line 282... Line -...
282
 
-
 
283
	DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
-
 
284
	NewLine(list.x + 5, stroka * 10 + list.y + 5); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
282
 
285
 
283
	DrawPage();
286
	if (list.visible * 10 + 25 <= list.h)
284
	NewLine();
287
		DrawBar(list.x, list.visible * 10 + list.y + 25, list.w, -list.visible * 10 + list.h - 25, bg_color);
-
 
288
	if (stroka * 10 + 5 <= list.h)
285
	DrawBar(list.x, stroka * list.line_h + list.y + 5, list.w, -stroka * list.line_h + list.h - 5, bg_color);
289
		DrawBar(list.x, stroka * 10 + list.y + 5, list.w, -stroka * 10 + list.h - 5, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà
286
	DrawBar(list.x, list.visible * list.line_h + list.y + 4, list.w, -list.visible * list.line_h + list.h - 4, bg_color);
290
	if (list.first == 0) list.count = stroka;
287
	if (list.first == 0) list.count = stroka;
291
	if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
288
	if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
292
	{
289
	{
293
		anchor=NULL;
290
		anchor=NULL;
Line 332... Line 329...
332
	
329
	
333
	IF(isTag("q"))
330
	IF(isTag("q"))
334
	{
331
	{
335
		if (opened)
332
		if (opened)
336
		{
333
		{
337
			NewLine(left1, top1);
334
			NewLine();
338
			strcat(#line, ' \"');
335
			strcat(#line, ' \"');
339
		}
336
		}
340
		if (!opened)
337
		if (!opened)
341
		{
338
		{
342
			chrcat(#line, '\"');
339
			chrcat(#line, '\"');
343
			NewLine(left1, top1);
340
			NewLine();
344
		} 
341
		} 
Line 345... Line 342...
345
	}
342
	}
346
 
343
 
Line 422... Line 419...
422
		else
419
		else
423
			if (text_color_index > 0) text_color_index--;
420
			if (text_color_index > 0) text_color_index--;
424
		return;
421
		return;
425
	}
422
	}
426
	if (isTag("br")) {
423
	if (isTag("br")) {
427
		NewLine(left1, top1);
424
		NewLine();
428
		return;
425
		return;
429
	}
426
	}
430
	if (isTag("div")) || (isTag("header")) || (isTag("article")) || (isTag("footer")) {
427
	if (isTag("div")) || (isTag("header")) || (isTag("article")) || (isTag("footer")) {
431
		IF(oldtag[0] <>'h') NewLine(left1, top1);
428
		IF(oldtag[0] <>'h') NewLine();
432
		return;
429
		return;
433
	}
430
	}
434
	if (isTag("p")) {
431
	if (isTag("p")) {
435
		IF(oldtag[0] == 'h') return;
432
		IF(oldtag[0] == 'h') return;
436
		NewLine(left1, top1);
433
		NewLine();
437
		IF(opened) NewLine(left1, top1 + 10);
434
		IF(opened) NewLine();
438
		return;
435
		return;
439
	}
436
	}
Line 440... Line 437...
440
 
437
 
441
	if(isTag("table")) {
438
	if(isTag("table")) {
442
		table.active = opened;
439
		table.active = opened;
443
		NewLine(left1, top1);
440
		NewLine();
444
		if (opened)	table.NewTable();
441
		if (opened)	table.NewTable();
Line 445... Line 442...
445
	}
442
	}
446
 
443
 
Line 451... Line 448...
451
			table.row_h = 0;
448
			table.row_h = 0;
452
			do {
449
			do {
453
				if (!strcmp(#parametr, "width="))
450
				if (!strcmp(#parametr, "width="))
454
				{
451
				{
455
					table.col_w[table.cur_col] = atoi(#options);
452
					table.col_w[table.cur_col] = atoi(#options);
456
					// NewLine(left1, top1);
453
					// NewLine();
457
					// strcpy(#line, #options);
454
					// strcpy(#line, #options);
458
					// NewLine(left1, top1);
455
					// NewLine();
459
				}
456
				}
460
			} while(GetNextParam());
457
			} while(GetNextParam());
461
		}
458
		}
462
		else
459
		else
463
		{
460
		{
Line 472... Line 469...
472
			table.row_max_h = 0;
469
			table.row_max_h = 0;
473
			table.row_start = stroka;
470
			table.row_start = stroka;
474
		}
471
		}
475
		else
472
		else
476
		{
473
		{
477
			NewLine(left1, top1);
474
			NewLine();
478
			if (table.cur_row == 0) table.max_cols = table.cur_col;
475
			if (table.cur_row == 0) table.max_cols = table.cur_col;
479
			table.cur_row++;
476
			table.cur_row++;
480
			table.max_cols = table.cur_col;
477
			table.max_cols = table.cur_col;
481
		}
478
		}
482
	}
479
	}
Line 485... Line 482...
485
	if (isTag("center"))
482
	if (isTag("center"))
486
	{
483
	{
487
		if (opened) text_align = ALIGN_CENTER;
484
		if (opened) text_align = ALIGN_CENTER;
488
		if (!opened)
485
		if (!opened)
489
		{
486
		{
490
			NewLine(left1, top1);
487
			NewLine();
491
			text_align = ALIGN_LEFT;
488
			text_align = ALIGN_LEFT;
492
		}
489
		}
493
		return;
490
		return;
494
	}
491
	}
495
	if (isTag("right"))
492
	if (isTag("right"))
496
	{
493
	{
497
		if (opened) text_align = ALIGN_RIGHT;
494
		if (opened) text_align = ALIGN_RIGHT;
498
		if (!opened)
495
		if (!opened)
499
		{
496
		{
500
			NewLine(left1, top1);
497
			NewLine();
501
			text_align = ALIGN_LEFT;
498
			text_align = ALIGN_LEFT;
502
		}
499
		}
503
		return;
500
		return;
504
	}
501
	}
505
	*/
502
	*/
506
	if (isTag("h1")) || (isTag("h2")) || (isTag("h3")) || (isTag("h4")) {
503
	if (isTag("h1")) || (isTag("h2")) || (isTag("h3")) || (isTag("h4")) {
507
		NewLine(left1, top1);
504
		NewLine();
508
		if (opened) && (stroka>1) NewLine(left1, top1 + 10);
505
		if (opened) && (stroka>1) NewLine();
509
		strcpy(#oldtag, #tag);
506
		strcpy(#oldtag, #tag);
510
		if (opened)
507
		if (opened)
511
		{
508
		{
512
			if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
509
			if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
513
			if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT;
510
			if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT;
Line 533... Line 530...
533
	}	
530
	}	
534
	if (isTag("dt"))
531
	if (isTag("dt"))
535
	{
532
	{
536
		li_text = opened;
533
		li_text = opened;
537
		IF(opened == 0) return;
534
		IF(opened == 0) return;
538
		NewLine(left1, top1);
535
		NewLine();
539
		return;
536
		return;
540
	}
537
	}
541
	if (isTag("condition"))
538
	if (isTag("condition"))
542
	{
539
	{
543
		condition_text_active = opened;
540
		condition_text_active = opened;
Line 547... Line 544...
547
	if (isTag("li")) || (isTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
544
	if (isTag("li")) || (isTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
548
	{
545
	{
549
		li_text = opened;
546
		li_text = opened;
550
		if (opened)
547
		if (opened)
551
		{
548
		{
552
			NewLine(left1, top1);
549
			NewLine();
553
			if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
550
			if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
554
		}
551
		}
555
		return;
552
		return;
556
	}
553
	}
557
	if (isTag("u")) || (isTag("ins")) u_text = opened;
554
	if (isTag("u")) || (isTag("ins")) u_text = opened;
558
	if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
555
	if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
559
	if (isTag("ul")) || (isTag("ol")) IF(!opened)
556
	if (isTag("ul")) || (isTag("ol")) IF(!opened)
560
	{
557
	{
561
		li_text = opened;
558
		li_text = opened;
562
		li_tab--;
559
		li_tab--;
563
		NewLine(left1, top1);
560
		NewLine();
564
	} ELSE li_tab++;
561
	} ELSE li_tab++;
565
	if (isTag("dd")) stolbec += 5;
562
	if (isTag("dd")) stolbec += 5;
566
	if (isTag("blockquote")) blq_text = opened;
563
	if (isTag("blockquote")) blq_text = opened;
567
	if (isTag("pre")) || (isTag("code")) pre_text = opened; 
564
	if (isTag("pre")) || (isTag("code")) pre_text = opened; 
568
	if (isTag("hr"))
565
	if (isTag("hr"))
Line 571... Line 568...
571
		{
568
		{
572
			stroka+=2;
569
			stroka+=2;
573
			return;
570
			return;
574
		}
571
		}
575
		if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
572
		if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
576
		NewLine(left1, top1);
573
		NewLine();
577
		DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color);
574
		DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color);
578
		NewLine(left1, top1+list.line_h);
575
		NewLine();
579
	}
576
	}
580
	if (isTag("img"))
577
	if (isTag("img"))
581
	{
578
	{
582
		ImgCache.Images( left1, top1, WB1.list.w);
579
		ImgCache.Images( left1, top1, WB1.list.w);
583
		return;
580
		return;
Line 615... Line 612...
615
 
612
 
616
	scrollbar_v_draw(#scroll_wv);
613
	scrollbar_v_draw(#scroll_wv);
Line 617... Line 614...
617
}
614
}
618
 
615
 
-
 
616
 
-
 
617
void TWebBrowser::NewLine()
-
 
618
{
-
 
619
	int onleft;
-
 
620
	int ontop;
619
 
621
 
620
void TWebBrowser::NewLine(int left1, top1)
622
	onleft = list.x + 5;
621
{
623
	ontop = stroka * list.line_h + list.y + 5;
622
	if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color);
624
	if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color);
623
	if (t_html) && (!t_body) return;
625
	if (t_html) && (!t_body) return;
624
	if (top1>=list.y) && ( top1 < list.h+list.y-10)  && (!anchor)
626
	if (ontop>=list.y) && ( ontop < list.h+list.y-10)  && (!anchor)
625
	{
627
	{
626
		if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(left1,top1,list.w,list.line_h,stolbec * 6);
628
		if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * 6);
627
		if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(left1,top1,list.w,list.line_h,stolbec * 6);
629
		if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * 6);
628
		DrawBuf.bufy = top1;
630
		DrawBuf.bufy = ontop;
629
		DrawBuf.Show();
631
		DrawBuf.Show();
630
		DrawBuf.Fill(bg_color);
632
		DrawBuf.Fill(bg_color);