Subversion Repositories Kolibri OS

Rev

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

Rev 5519 Rev 5678
Line 8... Line 8...
8
 
8
 
Line 9... Line 9...
9
char header[2048];
9
char header[2048];
10
 
10
 
11
struct TWebBrowser {
11
struct TWebBrowser {
12
	llist list;
12
	llist list;
13
	dword draw_line_height, draw_line_width, draw_list_height;
13
	dword draw_line_width;
14
	DrawBufer DrawBuf;
14
	DrawBufer DrawBuf;
15
	void Prepare();
15
	void Prepare();
16
	void Parse();
16
	void Parse();
Line 60... Line 60...
60
//=======================================================================
60
//=======================================================================
Line 61... Line 61...
61
 
61
 
62
 
62
 
63
void TWebBrowser::DrawPage()
63
void TWebBrowser::DrawPage()
-
 
64
{
Line 64... Line 65...
64
{
65
	int start_x, start_y, line_length, stolbec_len, magrin_left=5;
65
	int start_x, start_y, zstart_x, zstart_y, line_length, zline_length, stolbec_len, magrin_left=5;
66
	dword font_type;
66
	
67
	
67
	if (!header)
68
	if (!header)
Line 74... Line 75...
74
	}
75
	}
75
	if (t_html) && (!t_body) return;
76
	if (t_html) && (!t_body) return;
Line 76... Line 77...
76
	
77
	
77
	if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor)
78
	if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor)
78
	{
-
 
79
		start_x = stolbec * 6 + list.x + magrin_left;
-
 
80
		start_y = stroka * list.line_h + list.y + magrin_left;
79
	{
81
		zstart_x = stolbec * 6 + magrin_left * DrawBuf.zoomf + list.x;
80
		start_x = stolbec * 6 + magrin_left * DrawBuf.zoom + list.x;
82
		zstart_y = stroka * list.line_h * DrawBuf.zoomf + magrin_left + list.y;
81
		start_y = stroka * list.line_h + magrin_left + list.y;
83
		stolbec_len = strlen(#line);
-
 
84
		line_length = stolbec_len * 6;
82
		stolbec_len = strlen(#line);
Line -... Line 83...
-
 
83
		line_length = stolbec_len * 6 * DrawBuf.zoom;
-
 
84
 
85
		zline_length = stolbec_len * 6 * DrawBuf.zoomf;
85
		if (DrawBuf.zoom==1) font_type = 0x88; else font_type = 0x89;
86
 
86
 
87
		WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data);
87
		WriteBufText(start_x, 0, font_type, text_colors[text_color_index], #line, buf_data);
88
		if (b_text)	WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data);
88
		if (b_text)	WriteBufText(start_x+1, 0, font_type, text_colors[text_color_index], #line, buf_data);
89
		if (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); }
89
		if (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); } // bug with zoom>1
90
		if (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
90
		if (s_text) DrawBuf.DrawBar(start_x, list.line_h / 2 - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]);
91
		if (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
91
		if (u_text) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]);
92
		if (link) {
92
		if (link) {
93
			DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
93
			DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]);
94
			UnsafeDefineButton(zstart_x-2, zstart_y-1, zline_length + 3, DrawBuf.zoomf * 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
94
			UnsafeDefineButton(start_x-2, start_y-1, line_length + 3, DrawBuf.zoom * 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
95
			PageLinks.AddText(#line, zline_length, draw_line_height, UNDERLINE);
95
			PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE);
96
		}
96
		}
97
		stolbec += stolbec_len;
97
		stolbec += stolbec_len;
98
	}
98
	}
Line 147... Line 147...
147
	strcpy(#header, #version);
147
	strcpy(#header, #version);
148
	stroka = -list.first;
148
	stroka = -list.first;
149
	stolbec = 0;
149
	stolbec = 0;
150
	line = 0;
150
	line = 0;
Line 151... Line -...
151
 
-
 
152
	draw_line_height = list.line_h * DrawBuf.zoomf;
151
 
153
	draw_line_width = list.w * DrawBuf.zoomf;
-
 
Line 154... Line 152...
154
	draw_list_height = list.h * DrawBuf.zoomf;
152
	draw_line_width = list.w * DrawBuf.zoom;
155
 
153
 
156
	if (pre_text<>2)
154
	if (pre_text<>2)
157
	{
155
	{
Line 253... Line 251...
253
			if (tagparam) GetNextParam();
251
			if (tagparam) GetNextParam();
Line 254... Line 252...
254
 
252
 
255
			if (stolbec + strlen(#line) > list.column_max) Perenos();
253
			if (stolbec + strlen(#line) > list.column_max) Perenos();
256
			DrawPage();
254
			DrawPage();
257
			line = NULL;
255
			line = NULL;
258
			if (tag) SetTextStyle(WB1.DrawBuf.zoomf * 5 + list.x, stroka * draw_line_height + list.y + 5); //îáðàáîòêà òåãîâ
256
			if (tag) SetTextStyle(WB1.DrawBuf.zoom * 5 + list.x, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ
259
			tag = parametr = tagparam = ignor_param = NULL;
257
			tag = parametr = tagparam = ignor_param = NULL;
260
			break;
258
			break;
261
		default:
259
		default:
262
			DEFAULT_MARK:
260
			DEFAULT_MARK:
Line 271... Line 269...
271
			if (stolbec + line_len > list.column_max) Perenos();
269
			if (stolbec + line_len > list.column_max) Perenos();
272
		}
270
		}
273
	}
271
	}
274
	DrawPage();
272
	DrawPage();
275
	NewLine();
273
	NewLine();
276
	DrawBar(list.x, stroka * draw_line_height + list.y + 5, draw_line_width, -stroka * draw_line_height + draw_list_height - 5, bg_color);
274
	DrawBar(list.x, stroka * list.line_h + list.y + 5, draw_line_width, -stroka * list.line_h + list.h - 5, bg_color);
277
	DrawBar(list.x, list.visible * draw_line_height + list.y + 4, draw_line_width, -list.visible * draw_line_height + draw_list_height - 4, bg_color);
275
	DrawBar(list.x, list.visible * list.line_h + list.y + 4, draw_line_width, -list.visible * list.line_h + list.h - 4, bg_color);
278
	if (list.first == 0) list.count = stroka;
276
	if (list.first == 0) list.count = stroka;
279
	if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
277
	if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
280
	{
278
	{
281
		anchor=NULL;
279
		anchor=NULL;
282
		list.first=anchor_line_num;
280
		list.first=anchor_line_num;
Line 386... Line 384...
386
					text_color_index++;
384
					text_color_index++;
387
					text_colors[text_color_index] = text_colors[text_color_index-1];
385
					text_colors[text_color_index] = text_colors[text_color_index-1];
Line 388... Line 386...
388
					
386
					
389
					link = 1;
387
					link = 1;
390
					text_colors[text_color_index] = link_color_inactive;
388
					text_colors[text_color_index] = link_color_inactive;
391
					PageLinks.AddLink(#options, DrawBuf.zoomf * stolbec*6+left1, top1-2);
389
					PageLinks.AddLink(#options, DrawBuf.zoom * stolbec*6+left1, top1-DrawBuf.zoom);
392
				}
390
				}
393
				if (anchor) && (!strcmp(#parametr, "name="))
391
				if (anchor) && (!strcmp(#parametr, "name="))
394
				{
392
				{
395
					if (!strcmp(#anchor, #options))
393
					if (!strcmp(#anchor, #options))
Line 554... Line 552...
554
	{
552
	{
555
		li_text = opened;
553
		li_text = opened;
556
		if (opened)
554
		if (opened)
557
		{
555
		{
558
			NewLine();
556
			NewLine();
-
 
557
			if (stroka > -1) && (stroka - 2 < list.visible) 
559
			if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + list.x, list.line_h/2-2, 2, 2, 0x555555);
558
				DrawBuf.DrawBar(li_tab * 5 * 6 * DrawBuf.zoom + list.x, list.line_h / 2 - DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x555555);
560
		}
559
		}
561
		return;
560
		return;
562
	}
561
	}
563
	if (isTag("u")) || (isTag("ins")) u_text = opened;
562
	if (isTag("u")) || (isTag("ins")) u_text = opened;
564
	if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
563
	if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened;
Line 616... Line 615...
616
 
615
 
617
	scroll_wv.all_redraw = 0;
616
	scroll_wv.all_redraw = 0;
618
	scroll_wv.start_x = list.x + list.w;
617
	scroll_wv.start_x = list.x + list.w;
Line 619... Line 618...
619
	scroll_wv.start_y = list.y;
618
	scroll_wv.start_y = list.y;
620
 
619
 
Line 621... Line 620...
621
	scroll_wv.size_y = list.h * DrawBuf.zoomf;
620
	scroll_wv.size_y = list.h;
622
	scroll_wv.start_x = list.w * DrawBuf.zoomf + list.x;
621
	scroll_wv.start_x = list.w * DrawBuf.zoom + list.x;
Line 623... Line 622...
623
 
622
 
624
	scrollbar_v_draw(#scroll_wv);
623
	scrollbar_v_draw(#scroll_wv);
625
}
624
}
Line 626... Line 625...
626
 
625
 
627
 
626
 
628
void TWebBrowser::NewLine()
-
 
629
{
627
void TWebBrowser::NewLine()
630
	int onleft, ontop, zontop;
628
{
631
 
629
	int onleft, ontop;
632
	onleft = list.x + 5;
630
 
633
	ontop = stroka * list.line_h + list.y + 5;
631
	onleft = list.x + 5;
634
	zontop = stroka * list.line_h * DrawBuf.zoomf + list.y + 5;
632
	ontop = stroka * list.line_h + list.y + 5;
635
	if (!stroka) DrawBar(list.x, list.y, draw_line_width, 5, bg_color);
633
	if (!stroka) DrawBar(list.x, list.y, draw_line_width, 5, bg_color);
636
	if (t_html) && (!t_body) return;
-
 
637
	if (ontop>=list.y) && ( ontop < list.h+list.y-10)  && (!anchor)
634
	if (t_html) && (!t_body) return;
638
	{
635
	if (stroka * list.line_h + 5 >= 0) && ( stroka + 1 * list.line_h + 5 < list.h) && (!anchor)
639
		if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * 6);
636
	{
640
		if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * 6);
637
		if (text_align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * 6);
641
		DrawBuf.bufy = ontop;
638
		if (text_align == ALIGN_RIGHT) && (DrawBuf.zoom==1)  DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * 6);