Subversion Repositories Kolibri OS

Rev

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

Rev 4648 Rev 4650
Line 14... Line 14...
14
	llist list;
14
	llist list;
15
	DrawBufer DrawBuf;
15
	DrawBufer DrawBuf;
16
	void GetNewUrl();
16
	void GetNewUrl();
17
	void Prepare();
17
	void Prepare();
18
	void Parse();
18
	void Parse();
19
	void WhatTextStyle();
19
	void SetTextStyle();
20
	void DrawPage();
20
	void DrawPage();
21
	void DrawScroller();
21
	void DrawScroller();
22
	void TextGoDown();
22
	void NewLine();
23
};
23
};
Line 24... Line 24...
24
 
24
 
Line 25... Line 25...
25
TWebBrowser WB1;
25
TWebBrowser WB1;
Line 300... Line 300...
300
				strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
300
				strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
301
				line[perenos_num] = 0x00;
301
				line[perenos_num] = 0x00;
302
				if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
302
				if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
303
				DrawPage();
303
				DrawPage();
304
				strcpy(#line, #temp);				
304
				strcpy(#line, #temp);				
305
				TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
305
				NewLine(list.x + 5, stroka * 10 + list.y + 5); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
306
			}
306
			}
307
			DrawPage();
307
			DrawPage();
308
			line=NULL;	
308
			line=NULL;	
309
			if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ
309
			if (tag) SetTextStyle(list.x + 5, stroka * 10 + list.y + 5); //îáðàáîòêà òåãîâ
310
			tag = parametr = tagparam = ignor_param = NULL;
310
			tag = parametr = tagparam = ignor_param = NULL;
311
			break;
311
			break;
312
		default:
312
		default:
313
			DEFAULT_MARK:
313
			DEFAULT_MARK:
314
			if (bukva<=15) bukva=' ';
314
			if (bukva<=15) bukva=' ';
Line 327... Line 327...
327
				strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
327
				strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
328
				line[perenos_num] = 0x00;
328
				line[perenos_num] = 0x00;
329
				if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
329
				if (stroka-1 > list.visible) && (list.first <>0) break 1; //óõîäèì...
330
				DrawPage();
330
				DrawPage();
331
				strcpy(#line, #temp);			
331
				strcpy(#line, #temp);			
332
				TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
332
				NewLine(list.x + 5, stroka * 10 + list.y + 5); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
333
			}
333
			}
334
		}
334
		}
335
	}
335
	}
Line 336... Line 336...
336
 
336
 
337
	DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
337
	DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
Line 338... Line 338...
338
	TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
338
	NewLine(list.x + 5, stroka * 10 + list.y + 5); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
339
 
339
 
340
	if (list.visible * 10 + 25 <= list.h)
340
	if (list.visible * 10 + 25 <= list.h)
341
		DrawBar(list.x, list.visible * 10 + list.y + 25, list.w, -list.visible * 10 + list.h - 25, bg_color);
341
		DrawBar(list.x, list.visible * 10 + list.y + 25, list.w, -list.visible * 10 + list.h - 25, bg_color);
Line 352... Line 352...
352
}
352
}
Line 353... Line 353...
353
 
353
 
354
 
354
 
355
 
355
 
356
char oldtag[100];
356
char oldtag[100];
357
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
357
void TWebBrowser::SetTextStyle(int left1, top1) {
358
	dword hr_color;
358
	dword hr_color;
359
	byte opened;
359
	byte opened;
Line 386... Line 386...
386
	
386
	
387
	IF(isTag("q"))
387
	IF(isTag("q"))
388
	{
388
	{
389
		if (opened)
389
		if (opened)
390
		{
390
		{
391
			TextGoDown(left1, top1, width1);
391
			NewLine(left1, top1);
392
			strcat(#line, ' \"');
392
			strcat(#line, ' \"');
393
		}
393
		}
394
		if (!opened)
394
		if (!opened)
395
		{
395
		{
396
			chrcat(#line, '\"');
396
			chrcat(#line, '\"');
397
			TextGoDown(left1, top1, width1);
397
			NewLine(left1, top1);
398
		} 
398
		} 
Line 399... Line 399...
399
	}
399
	}
400
 
400
 
Line 476... Line 476...
476
		else
476
		else
477
			if (text_color_index > 0) text_color_index--;
477
			if (text_color_index > 0) text_color_index--;
478
		return;
478
		return;
479
	}
479
	}
480
	if (isTag("br")) {
480
	if (isTag("br")) {
481
		TextGoDown(left1, top1, width1);
481
		NewLine(left1, top1);
482
		return;
482
		return;
483
	}
483
	}
484
	if (isTag("div")) || (isTag("header")) || (isTag("footer")) {
484
	if (isTag("div")) || (isTag("header")) || (isTag("footer")) {
485
		IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
485
		IF(oldtag[0] <>'h') NewLine(left1, top1);
486
		return;
486
		return;
487
	}
487
	}
488
	if (isTag("p")) {
488
	if (isTag("p")) {
489
		IF(oldtag[0] == 'h') return;
489
		IF(oldtag[0] == 'h') return;
490
		TextGoDown(left1, top1, width1);
490
		NewLine(left1, top1);
491
		IF(opened) TextGoDown(left1, top1 + 10, width1);
491
		IF(opened) NewLine(left1, top1 + 10);
492
		return;
492
		return;
493
	}
493
	}
Line 494... Line -...
494
 
-
 
495
 
494
 
496
	if(isTag("table")) {
-
 
497
		if (opened)
-
 
498
		{
495
	if(isTag("table")) {
499
			table.active = true;
496
		table.active = opened;
500
			TextGoDown(left1, top1, width1);
497
		NewLine(left1, top1);
501
			table.NewTable();
-
 
502
		}
-
 
503
		else
-
 
504
		{
-
 
505
			table.active = false;
-
 
506
			TextGoDown(left1, top1, width1);
-
 
507
		}
498
		if (opened)	table.NewTable();
-
 
499
	}
508
	}
500
 
509
	if(isTag("td")) {
501
	if(isTag("td")) {
510
		if (opened)
502
		if (opened)
-
 
503
		{
-
 
504
			table.cur_col++;
-
 
505
			table.row_h = 0;
-
 
506
			do {
511
		{
507
				if (!strcmp(#parametr, "width="))
-
 
508
				{
-
 
509
					table.col_w[table.cur_col] = atoi(#options);
-
 
510
					// NewLine(left1, top1);
-
 
511
					// strcpy(#line, #options);
-
 
512
					// NewLine(left1, top1);
-
 
513
				}
512
			//
514
			} while(GetNextParam());
513
		}
515
		}
514
		else
516
		else
515
		{
-
 
-
 
517
		{
516
			//
518
			if (table.row_h > table.row_max_h) table.row_max_h = table.row_h;
517
		}
519
		}
-
 
520
	}
518
	}
521
 
519
	if(isTag("tr")) {
522
	if(isTag("tr")) {
520
		if (opened)
523
		if (opened)
521
		{
524
		{
-
 
525
			table.cur_col = 0;
-
 
526
			table.row_max_h = 0;
522
			//
527
			table.row_start = stroka;
523
		}
528
		}
524
		else
529
		else
525
		{
530
		{
526
			TextGoDown(left1, top1, width1);
531
			NewLine(left1, top1);
527
			if (table.cur_row == 0) table.max_cols = table.cur_col;
532
			if (table.cur_row == 0) table.max_cols = table.cur_col;
-
 
533
			table.cur_row++;
528
			table.cur_row++;
534
			table.max_cols = table.cur_col;
529
		}
535
		}
-
 
536
	}
530
	}
537
 
531
	/*
538
	/*
532
	if (isTag("center"))
539
	if (isTag("center"))
533
	{
540
	{
534
		if (opened) text_align = ALIGN_CENTER;
541
		if (opened) text_align = ALIGN_CENTER;
535
		if (!opened)
542
		if (!opened)
536
		{
543
		{
537
			TextGoDown(left1, top1, width1);
544
			NewLine(left1, top1);
538
			text_align = ALIGN_LEFT;
545
			text_align = ALIGN_LEFT;
539
		}
546
		}
540
		return;
547
		return;
541
	}
548
	}
542
	if (isTag("right"))
549
	if (isTag("right"))
543
	{
550
	{
544
		if (opened) text_align = ALIGN_RIGHT;
551
		if (opened) text_align = ALIGN_RIGHT;
545
		if (!opened)
552
		if (!opened)
546
		{
553
		{
547
			TextGoDown(left1, top1, width1);
554
			NewLine(left1, top1);
548
			text_align = ALIGN_LEFT;
555
			text_align = ALIGN_LEFT;
549
		}
556
		}
550
		return;
557
		return;
551
	}
558
	}
552
	*/
559
	*/
553
	if (isTag("h1")) || (isTag("h2")) || (isTag("h3")) || (isTag("h4")) {
560
	if (isTag("h1")) || (isTag("h2")) || (isTag("h3")) || (isTag("h4")) {
554
		TextGoDown(left1, top1, width1);
561
		NewLine(left1, top1);
555
		if (opened) && (stroka>1) TextGoDown(left1, top1 + 10, width1);
562
		if (opened) && (stroka>1) NewLine(left1, top1 + 10);
556
		strcpy(#oldtag, #tag);
563
		strcpy(#oldtag, #tag);
557
		if (opened)
564
		if (opened)
558
		{
565
		{
559
			if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
566
			if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER;
Line 580... Line 587...
580
	}	
587
	}	
581
	if (isTag("dt"))
588
	if (isTag("dt"))
582
	{
589
	{
583
		li_text = opened;
590
		li_text = opened;
584
		IF(opened == 0) return;
591
		IF(opened == 0) return;
585
		TextGoDown(left1, top1, width1);
592
		NewLine(left1, top1);
586
		return;
593
		return;
587
	}
594
	}
588
	if (isTag("condition"))
595
	if (isTag("condition"))
589
	{
596
	{
590
		condition_text_active = opened;
597
		condition_text_active = opened;
Line 594... Line 601...
594
	if (isTag("li")) || (isTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
601
	if (isTag("li")) || (isTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
595
	{
602
	{
596
		li_text = opened;
603
		li_text = opened;
597
		if (opened)
604
		if (opened)
598
		{
605
		{
599
			TextGoDown(left1, top1, width1);
606
			NewLine(left1, top1);
600
			if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
607
			if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
601
		}
608
		}
602
		return;
609
		return;
603
	}
610
	}
604
	if (isTag("u")) || (isTag("ins")) u_text = opened;
611
	if (isTag("u")) || (isTag("ins")) u_text = opened;
605
	if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
612
	if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
606
	if (isTag("ul")) || (isTag("ol")) IF(!opened)
613
	if (isTag("ul")) || (isTag("ol")) IF(!opened)
607
	{
614
	{
608
		li_text = opened;
615
		li_text = opened;
609
		li_tab--;
616
		li_tab--;
610
		TextGoDown(left1, top1, width1);
617
		NewLine(left1, top1);
611
	} ELSE li_tab++;
618
	} ELSE li_tab++;
612
	if (isTag("dd")) stolbec += 5;
619
	if (isTag("dd")) stolbec += 5;
613
	if (isTag("blockquote")) blq_text = opened;
620
	if (isTag("blockquote")) blq_text = opened;
614
	if (isTag("pre")) || (isTag("code")) pre_text = opened; 
621
	if (isTag("pre")) || (isTag("code")) pre_text = opened; 
615
	if (isTag("hr"))
622
	if (isTag("hr"))
Line 618... Line 625...
618
		{
625
		{
619
			stroka+=2;
626
			stroka+=2;
620
			return;
627
			return;
621
		}
628
		}
622
		if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
629
		if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
623
		TextGoDown(left1, top1, width1);
630
		NewLine(left1, top1);
624
		DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color);
631
		DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color);
625
		TextGoDown(left1, top1+list.line_h, width1);
632
		NewLine(left1, top1+list.line_h);
626
	}
633
	}
627
	if (isTag("img"))
634
	if (isTag("img"))
628
	{
635
	{
629
		ImgCache.Images( left1, top1, width1);
636
		ImgCache.Images( left1, top1);
630
		return;
637
		return;
631
	}
638
	}
632
	if (isTag("meta")) || (isTag("?xml"))
639
	if (isTag("meta")) || (isTag("?xml"))
633
	{
640
	{
634
		do{
641
		do{
Line 662... Line 669...
662
 
669
 
663
	scrollbar_v_draw(#scroll_wv);
670
	scrollbar_v_draw(#scroll_wv);
Line 664... Line 671...
664
}
671
}
665
 
672
 
666
 
673
 
667
void TWebBrowser::TextGoDown(int left1, top1, width1)
674
void TWebBrowser::NewLine(int left1, top1)
668
{
675
{
669
	if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
676
	if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé