Subversion Repositories Kolibri OS

Rev

Rev 2228 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2228 Rev 2238
Line 33... Line 33...
33
	void WhatTextStyle(int left1, top1, width1);
33
	void WhatTextStyle(int left1, top1, width1);
34
};
34
};
Line 35... Line 35...
35
 
35
 
Line -... Line 36...
-
 
36
TWebBrowser WB1;
-
 
37
 
-
 
38
byte rez, b_text, i_text, u_text, s_text, w_title, pre_text, blq_text, li_text, link, ignor_text, li_tab;
-
 
39
 
-
 
40
 
-
 
41
dword text_colors[10],
-
 
42
	text_color_index = 0,
-
 
43
	link_color;
-
 
44
 
-
 
45
int stroka,
-
 
46
	stolbec,
-
 
47
	tab_len;
-
 
48
	
-
 
49
char line[330],
-
 
50
	tag[100],
-
 
51
	tagparam[10000],
-
 
52
	parametr[1200],
-
 
53
	options[1000];
36
TWebBrowser WB1;
54
 
37
 
55
 
38
#include "include\history.h--"
56
#include "include\history.h--"
Line 39... Line 57...
39
#include "include\colors.h--"
57
#include "include\colors.h--"
Line 51... Line 69...
51
		Load(#URL);
69
		Load(#URL);
52
		Draw_Window();
70
		Draw_Window();
53
		return;
71
		return;
54
	}
72
	}
55
	//edit1.flags=64;
73
	//edit1.flags=64;
56
	IF(kolichestvo < max_kolvo_strok) SWITCH(id) {
74
	IF(count < max_kolvo_strok) SWITCH(id) {
57
		CASE 183: CASE 184: CASE 180: CASE 181: return;
75
		CASE 183: CASE 184: CASE 180: CASE 181: return;
58
	} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
76
	} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
59
	switch (id) {
77
	switch (id) {
60
	case 011:
78
	case 011:
61
		ReadHtml();
79
		ReadHtml();
Line 98... Line 116...
98
	case ID1: //ìîòàåì ââåðõ
116
	case ID1: //ìîòàåì ââåðõ
99
		IF(za_kadrom > 0) za_kadrom--;
117
		IF(za_kadrom > 0) za_kadrom--;
100
		ELSE return;
118
		ELSE return;
101
		break; 
119
		break; 
102
	case ID2: //ìîòàåì âíèç
120
	case ID2: //ìîòàåì âíèç
103
		IF(max_kolvo_strok + za_kadrom >= kolichestvo) return;
121
		IF(max_kolvo_strok + za_kadrom >= count) return;
104
		za_kadrom++;
122
		za_kadrom++;
105
		break; 
123
		break; 
106
	case 183: //PgDown
124
	case 183: //PgDown
107
		IF(za_kadrom == kolichestvo - max_kolvo_strok) return;
125
		IF(za_kadrom == count - max_kolvo_strok) return;
108
		za_kadrom = za_kadrom + max_kolvo_strok + 2;
126
		za_kadrom = za_kadrom + max_kolvo_strok + 2;
109
		IF(max_kolvo_strok + za_kadrom > kolichestvo) za_kadrom = kolichestvo - max_kolvo_strok;
127
		IF(max_kolvo_strok + za_kadrom > count) za_kadrom = count - max_kolvo_strok;
110
		BREAK;
128
		BREAK;
111
	case 184: //PgUp
129
	case 184: //PgUp
112
		IF(za_kadrom == 0) RETURN;
130
		IF(za_kadrom == 0) RETURN;
113
    za_kadrom = za_kadrom - max_kolvo_strok - 2;
131
    za_kadrom = za_kadrom - max_kolvo_strok - 2;
114
		IF(za_kadrom < 0) za_kadrom = 0;
132
		IF(za_kadrom < 0) za_kadrom = 0;
Line 116... Line 134...
116
	case 180: //home
134
	case 180: //home
117
		IF (za_kadrom <>0) za_kadrom = 0;
135
		IF (za_kadrom <>0) za_kadrom = 0;
118
		ELSE RETURN;
136
		ELSE RETURN;
119
		BREAK; 
137
		BREAK; 
120
	case 181: //end
138
	case 181: //end
121
		za_kadrom = kolichestvo - max_kolvo_strok;
139
		za_kadrom = count - max_kolvo_strok;
122
		BREAK; 
140
		BREAK; 
123
	default:
141
	default:
124
		RETURN;
142
		RETURN;
125
	}
143
	}
126
	IF(id == 11) koitodos(buf);
144
	IF(id == 11) koitodos(buf);
Line 132... Line 150...
132
	dword on_y;
150
	dword on_y;
133
	DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè 
151
	DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè 
134
	DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
152
	DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
135
	DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
153
	DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
Line 136... Line 154...
136
 
154
 
137
	IF(kolichestvo <= max_kolvo_strok) {
155
	IF(count <= max_kolvo_strok) {
138
		DrawBar(left + width - 14, top + 17, 16, height - 34, 0xCED0D0);
156
		DrawBar(left + width - 14, top + 17, 16, height - 34, 0xCED0D0);
139
		return;
157
		return;
Line 140... Line 158...
140
	}
158
	}
141
 
159
 
142
	razm_scrl = height - 16 * max_kolvo_strok / kolichestvo - 3;
160
	scroll_size = height - 16 * max_kolvo_strok / count - 3;
143
	IF(razm_scrl < 10) razm_scrl = 10;
161
	IF(scroll_size < 10) scroll_size = 10;
144
	IF(za_kadrom + max_kolvo_strok >= kolichestvo) on_y = height - razm_scrl + top - 17;
162
	IF(za_kadrom + max_kolvo_strok >= count) on_y = height - scroll_size + top - 17;
145
	ELSE on_y = height - 32 * za_kadrom / kolichestvo + top + 16;
163
	ELSE on_y = height - 32 * za_kadrom / count + top + 16;
146
	DrawFlatButton(left + width - 15, on_y, 16, razm_scrl, 0, 0xE4DFE1, ""); //ïîëçóíîê
164
	DrawFlatButton(left + width - 15, on_y, 16, scroll_size, 0, 0xE4DFE1, ""); //ïîëçóíîê
147
  IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
165
  IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
148
	IF(height - razm_scrl + top - 17 > on_y)
166
	IF(height - scroll_size + top - 17 > on_y)
Line 149... Line 167...
149
		DrawBar(left + width - 14, on_y + razm_scrl + 1, 16, height - razm_scrl - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
167
		DrawBar(left + width - 14, on_y + scroll_size + 1, 16, height - scroll_size - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
150
}
168
}
Line 160... Line 178...
160
	&& (strcmp(get_URL_part(3),"/bd")<>0) && (strcmp(get_URL_part(3),"/fd")<>0) && (strcmp(get_URL_part(3),"/cd")<>0)
178
	&& (strcmp(get_URL_part(3),"/bd")<>0) && (strcmp(get_URL_part(3),"/fd")<>0) && (strcmp(get_URL_part(3),"/cd")<>0)
161
	&& (strcmp(get_URL_part(5),"http:")<>0)	&& (strcmp(get_URL_part(5),"mailt")<>0)	&& (strcmp(get_URL_part(5),"ftp:/")<>0) 
179
	&& (strcmp(get_URL_part(5),"http:")<>0)	&& (strcmp(get_URL_part(5),"mailt")<>0)	&& (strcmp(get_URL_part(5),"ftp:/")<>0) 
162
	{
180
	{
163
		copystr(BrowserHistory.CurrentUrl(), #editURL); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
181
		copystr(BrowserHistory.CurrentUrl(), #editURL); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
Line 164... Line 182...
164
		
182
		
165
		IF (editURL[find_symbol(#editURL, '/')-2]<>'/')  // åñëè íå http://test.ua
183
		IF (editURL[find_symbol(#editURL, '/')-2]<>'/')  // åñëè íå http://pagename.ua
166
		{
184
		{
167
			editURL[find_symbol(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
185
			editURL[find_symbol(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
168
			IF (URL[0]=='/') copystr(#URL+1,#URL);
186
			IF (URL[0]=='/') copystr(#URL+1,#URL);
169
		}
187
		}
Line 190... Line 208...
190
		}
208
		}
191
		file_size stdcall (#download_path);
209
		file_size stdcall (#download_path);
192
	} 
210
	} 
193
	ELSE file_size stdcall (#URL);
211
	ELSE file_size stdcall (#URL);
Line -... Line 212...
-
 
212
	
194
	
213
		
195
	filesize = EBX;
214
	filesize = EBX;
196
	IF (!filesize) return; //Lee 22.09
215
	IF (!filesize) return; //Lee 22.09
197
	mem_Free(buf);
216
	mem_Free(buf);
198
	buf = mem_Alloc(filesize);
217
	buf = mem_Alloc(filesize);
Line 241... Line 260...
241
	IF (!strcmp(#version, #header)) DrawTitle(#header);
260
	IF (!strcmp(#version, #header)) DrawTitle(#header);
242
}
261
}
Line 243... Line -...
243
 
-
 
244
 
-
 
245
 
-
 
246
byte rez, b_text, i_text, u_text, s_text, w_title, pre_text, blq_text, li_text, link, ignor_text, li_tab;
-
 
247
dword text_colors[10],
-
 
248
	text_color_index = 0,
-
 
249
	link_color;
-
 
250
int stroka,
-
 
251
	stolbec,
-
 
252
	tab_len;
-
 
253
	byte line[330],
-
 
254
	tag[100],
-
 
255
	tagparam[10000],
-
 
256
	parametr[1200],
-
 
257
	options[1000];
-
 
258
 
262
 
259
	byte ignor_param = 0;
263
 
-
 
264
 
260
	
265
void TWebBrowser::ParseHTML(dword bword, fsize){
261
void TWebBrowser::ParseHTML(dword bword, fsize){
266
	word bukva[1];
262
	word bukva[1];
267
	byte ignor_param = 0;
263
	char temp[768];
268
	char temp[768];
264
	stroka = -za_kadrom;
269
	stroka = -za_kadrom;
Line 426... Line 431...
426
	}
431
	}
427
	IF(max_kolvo_strok * 10 + 25 <= height)
432
	IF(max_kolvo_strok * 10 + 25 <= height)
428
		DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, 0xFFFFFF);
433
		DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, 0xFFFFFF);
429
	IF(stroka * 10 + 15 <= height)
434
	IF(stroka * 10 + 15 <= height)
430
		DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, 0xFFFFFF); //çàêðàøèâàåì âñ¸ äî êîíöà
435
		DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, 0xFFFFFF); //çàêðàøèâàåì âñ¸ äî êîíöà
431
	IF(za_kadrom == 0) kolichestvo = stroka;
436
	IF(za_kadrom == 0) count = stroka;
432
	DrawScroller(); //ðèñóåì ñêðîëë
437
	DrawScroller(); //ðèñóåì ñêðîëë
433
}
438
}
Line 434... Line 439...
434
 
439
 
Line 481... Line 486...
481
 
486
 
482
    dword image=0;
487
    dword image=0;
483
    char temp[4096];
488
    char temp[4096];
Line -... Line 489...
-
 
489
    int w, h, img_za_kadrom=0;
484
    int w, h, img_za_kadrom=0;
490
 
-
 
491
	//ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ
485
 
492
	IF(tag[0] == '/') 
486
	IF(tag[0] == '/') {
493
	{
-
 
494
		rez = 0;
-
 
495
		copystr(#tag + 1, #tag);
487
		rez = 0;
496
	}
-
 
497
	ELSE
488
		copystr(#tag + 1, #tag);
498
		rez = 1;
489
	} ELSE rez = 1;
499
 
490
	//
500
	//
491
	IF(!chTag("html")) {
501
	IF(!chTag("html")) {
492
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
502
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
493
		return;
503
		return;
494
	}
504
	}
495
	IF(!chTag("script")) || (!chTag("style")) ignor_text = rez;
505
	IF(!chTag("script")) || (!chTag("style")) ignor_text = rez;
Line 496... Line 506...
496
	IF (ignor_text == 1) return;
506
	IF (ignor_text == 1) return;
-
 
507
	//
497
	//
508
 
498
 
509
	if(!chTag("title")) IF(w_title == 0)
499
	if(!chTag("title")) IF(w_title == 0) {
510
	{
500
		copystr(" ", #line);
511
		copystr(" ", #line);
501
		w_title = 1;
512
		w_title = 1;
Line 508... Line 519...
508
		copystr(#version, #header + strlen(#header));
519
		copystr(#version, #header + strlen(#header));
509
		IF(stroka == 0) || (WindowRePaint == 1) DrawTitle(#header);
520
		IF(stroka == 0) || (WindowRePaint == 1) DrawTitle(#header);
510
		//äà, çíàþ, 2 ðàçà âûõîäèò, íî, åñëè áîëüøàÿ ñòðàíèöà, òî òðóú
521
		//äà, çíàþ, 2 ðàçà âûõîäèò, íî, åñëè áîëüøàÿ ñòðàíèöà, òî òðóú
511
		return;
522
		return;
512
	}
523
	}
-
 
524
	
513
	//
525
	//
514
	IF(!chTag("q")) copystr("\"", #line + strlen(#line));
526
	IF(!chTag("q")) copystr("\"", #line + strlen(#line));
-
 
527
	
-
 
528
	//âûâîä íà ýêðàí
515
	if (stroka > -1) && (stroka - 2 < max_kolvo_strok) && (line) {
529
	if (stroka >= 0) && (stroka - 2 < max_kolvo_strok) && (line) 
-
 
530
	{
516
		WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0);
531
		WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0);
517
		IF(b_text) WriteText(stolbec * 6 + left1 + 1, top1, 0x80, text_colors[text_color_index], #line, 0);
532
		IF (b_text) WriteText(stolbec * 6 + left1 + 1, top1, 0x80, text_colors[text_color_index], #line, 0);
518
		IF(i_text) Skew(stolbec * 6 + left1, top1, strlen(#line)+1*6, 10);
533
		IF (i_text) Skew(stolbec * 6 + left1, top1, strlen(#line)+1*6, 10); //íàêëîííûé òåêñò
519
		IF(s_text) DrawBar(stolbec * 6 + left1, top1 + 4, strlen(#line) * 6, 1, text_colors[text_color_index]); //çà÷¸ðêíóòûé
534
		IF (s_text) DrawBar(stolbec * 6 + left1, top1 + 4, strlen(#line) * 6, 1, text_colors[text_color_index]); //çà÷¸ðêíóòûé
520
		IF(u_text) DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]); //ïîä÷¸ðêíóòûé
535
		IF (u_text) DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]); //ïîä÷¸ðêíóòûé
521
		IF(link) {
536
		IF (link) {
522
			DefineButton(stolbec * 6 + left1 - 2, top1, strlen(#line) * 6 + 3, 9, blink + BT_HIDE, 0xB5BFC9); //
537
			DefineButton(stolbec * 6 + left1 - 2, top1, strlen(#line) * 6 + 3, 9, blink + BT_HIDE, 0xB5BFC9); //
523
			DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]);
538
			DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]);
524
		}
539
		}
525
	}
540
	}
526
	//
541
	//
527
	IF(!tag) return;
542
	IF(!tag) return;
528
	stolbec += strlen(#line);
543
	stolbec += strlen(#line);
-
 
544
	////////////////////////// 
-
 
545
	if (!chTag("body"))
-
 
546
	{
-
 
547
		BODY_MARK:
-
 
548
		
-
 
549
		if (strcmp(#parametr, "link=") == 0)
-
 
550
			link_color = GetColor(#options);
-
 
551
		
-
 
552
		/*if (strcmp(#parametr, "text=") == 0)
-
 
553
		{
-
 
554
			text_colors[0]=GetColor(#options);
-
 
555
		}
-
 
556
		
-
 
557
		if (strcmp(#parametr, "bgcolor=") == 0)
-
 
558
		{
-
 
559
			//text_colors[0]=GetColor(#options);
-
 
560
			WriteDebug("bgcolor=");
-
 
561
			WriteDebug(#options);
-
 
562
		}*/
-
 
563
		
-
 
564
		IF(tagparam) {
-
 
565
			GetNextParam();
-
 
566
			GOTO BODY_MARK;
-
 
567
		}		
-
 
568
	}
529
	//////////////////////////
569
	//////////////////////////
530
	if (!chTag("a")) {
570
	if (!chTag("a")) {
531
		IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return;
571
		IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return;
532
		if (rez) {
572
		if (rez) {
533
			HREF: IF(strcmp(#parametr, "href=") == 0) {
573
			HREF: IF(strcmp(#parametr, "href=") == 0) {
Line 556... Line 596...
556
		IF(stroka < 0) || (stroka - 1 > max_kolvo_strok) return;
596
		IF(stroka < 0) || (stroka - 1 > max_kolvo_strok) return;
557
		COL_MARK:
597
		COL_MARK:
558
		if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
598
		if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
559
		{
599
		{
560
			text_color_index++;
600
			text_color_index++;
561
			IF (options[0] == '#')
-
 
562
			{
-
 
563
				text_colors[text_color_index] = StrToCol(#options);
601
			text_colors[text_color_index] = GetColor(#options);
564
			}
-
 
565
			ELSE
-
 
566
			{
-
 
567
				FOR (i=0; color_names[i]!=0; i++)
-
 
568
				{
-
 
569
					IF(!strcmp(#options, color_names[i]))
-
 
570
					{
-
 
571
						text_colors[text_color_index] = colors[i];
-
 
572
						BREAK;
-
 
573
					}
-
 
574
					text_colors[text_color_index] = text_colors[0];
-
 
575
				}
602
		}
576
			}
-
 
577
			
-
 
578
		}
-
 
579
		IF(tagparam[0] <>'') {
603
		IF(tagparam) {
580
			GetNextParam();
604
			GetNextParam();
581
			GOTO COL_MARK;
605
			GOTO COL_MARK;
582
		}
606
		}
583
		IF(!rez) && (text_color_index > 0) text_color_index--;
607
		IF(!rez) && (text_color_index > 0) text_color_index--;
584
		return;
608
		return;
Line 632... Line 656...
632
		li_tab--;
656
		li_tab--;
633
		TextGoDown(left1, top1, width1);
657
		TextGoDown(left1, top1, width1);
634
	} ELSE li_tab++;
658
	} ELSE li_tab++;
635
	IF(!chTag("dd")) stolbec += 5;
659
	IF(!chTag("dd")) stolbec += 5;
636
	IF(!chTag("blockquote")) blq_text = rez;
660
	IF(!chTag("blockquote")) blq_text = rez;
637
	IF(!chTag("body")) IF(strcmp(#parametr, "link=") == 0) link_color = StrToCol(#options);
-
 
638
	IF(!chTag("pre")) pre_text = rez; 
661
	IF(!chTag("pre")) pre_text = rez; 
639
	IF(!chTag("hr")) {
662
	IF(!chTag("hr")) {
640
		TextGoDown(left1, top1, width1);
663
		TextGoDown(left1, top1, width1);
641
		TextGoDown(left1, top1 + 10, width1);
664
		TextGoDown(left1, top1 + 10, width1);
642
		IF(strcmp(#parametr, "color=") == 0) hr_color = StrToCol(#options);
665
		IF(strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options);
643
		ELSE hr_color = 0x999999;
666
		ELSE hr_color = 0x999999;
644
		IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color);
667
		IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color);
645
	}
668
	}
Line 646... Line 669...
646
 
669
 
Line 712... Line 735...
712
			IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866"))
735
			IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866"))
713
			{
736
			{
714
				ReadHtml(DONT_LOAD);
737
				ReadHtml(DONT_LOAD);
715
			}
738
			}
716
		}
739
		}
717
		IF(tagparam[0] <>'')
740
		IF(tagparam)
718
		{
741
		{
719
			GetNextParam();
742
			GetNextParam();
720
			goto META;
743
			goto META;
721
		}
744
		}
722
		return;
745
		return;