Subversion Repositories Kolibri OS

Rev

Rev 1978 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1978 Rev 2085
1
//http://jsbeautifier.org/
1
//http://jsbeautifier.org/
2
//Web-component, Leency & Veliant 2007-2009
2
//Web-component, Leency & Veliant 2007-2009
3
//lev
3
//lev
4
//èäåÿ - ëåâûå ôàéëû îòêðûâàòü ñîîòâåòñòâóþùèìè ïðîãàìè
-
 
5
 
-
 
-
 
4
 
-
 
5
 
6
//	wintodos(buf); -> â ïàðñå õòìë êàê è âñå êîäèðîâêè
6
//èäåÿ - ëåâûå ôàéëû îòêðûâàòü ñîîòâåòñòâóþùèìè ïðîãàìè
7
 
-
 
8
//ol - öèôåðêè
-
 
9
 
7
//wintodos(buf); -> â ïàðñå õòìë êàê è âñå êîäèðîâêè
10
//óñêîðåíà çàãðóçêà ñòðàíèöû, ñîäåðæàùåé èçîáðàæåíèÿ
8
//ol - öèôåðêè
11
//óìåíüøåíî êîëè÷åñòâî ïåðåðèñîâîê çàãîëîâêà îêíà ïðè çàãðóçêå ñòðàíèöû
9
 
12
 
10
 
13
dword j,
11
dword j,
14
	buf,
12
	buf,
15
	filesize,
13
	filesize,
16
	blink = 400;
14
	blink = 400;
17
 int i;
15
 int i;
18
 
16
 
19
 char download_path[]="/rd/1/.download";
17
 char download_path[]="/rd/1/.download";
20
//char search_path[]="http://nova.rambler.ru/search?words=";
18
//char search_path[]="http://nova.rambler.ru/search?words=";
21
 char search_path[]="http://nigma.ru/index.php?s=";
19
 char search_path[]="http://nigma.ru/index.php?s=";
22
 char version[]=" HTML Viewer v0.63";
20
 char version[]=" Text-based Browser 23.67";
23
 
21
 
24
 
22
 
25
struct TWebBrowser {
23
struct TWebBrowser {
26
	dword left,
24
	int left,
27
	top,
25
	top,
28
	width,
26
	width,
29
	height;
27
	height;
30
	void DrawScroller();
28
	void DrawScroller();
31
	void Load();
29
	void Load();
32
	void ParseHTML(dword, dword);
30
	void ParseHTML(dword, dword);
33
	void Scan(dword);
31
	void Scan(dword);
34
	void WhatTextStyle(int left1, top1, width1);
32
	void WhatTextStyle(int left1, top1, width1);
35
};
33
};
36
 
34
 
37
TWebBrowser WB1;
35
TWebBrowser WB1;
38
 
36
 
39
#include "include\history.h--"
37
#include "include\history.h--"
40
#include "include\colors.h--"
38
#include "include\colors.h--"
41
 
39
 
42
void TWebBrowser::Scan(dword id) {
40
void TWebBrowser::Scan(dword id) {
43
	IF (id > 399) {
41
	IF (id > 399) {
44
		j = 0;
42
		j = 0;
45
		FOR(i = 0; i <= id - 401; i++) {
43
		FOR(i = 0; i <= id - 401; i++) {
46
			do j++;
44
			do j++;
47
			while (page_links[j] <>'|');
45
			while (page_links[j] <>'|');
48
		}
46
		}
49
		page_links[j] = 0x00;
47
		page_links[j] = 0x00;
50
		copystr(#page_links[find_symbol(#page_links, '|')], #URL);
48
		copystr(#page_links[find_symbol(#page_links, '|')], #URL);
51
		Load(#URL);
49
		Load(#URL);
52
		Draw_Window();
50
		Draw_Window();
53
		return;
51
		return;
54
	}
52
	}
55
	//edit1.flags=64;
53
	//edit1.flags=64;
56
	IF(kolichestvo < max_kolvo_strok) SWITCH(id) {
54
	IF(kolichestvo < max_kolvo_strok) SWITCH(id) {
57
		CASE 183: CASE 184: CASE 180: CASE 181: return;
55
		CASE 183: CASE 184: CASE 180: CASE 181: return;
58
	} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
56
	} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
59
	switch (id) {
57
	switch (id) {
60
	case 011:
58
	case 011:
61
	case 004:
59
	case 004:
62
		ReadHtml();
60
		ReadHtml();
63
		break;
61
		break;
64
	case BACK:
62
	case BACK:
65
		BrowserHistory.GoBack();
63
		BrowserHistory.GoBack();
66
		return;
64
		return;
67
	/*case FORWARD:
65
	case FORWARD:
68
		WriteDebug(#UrlHistory);
66
		//RunProgram("@notify", "Forward button is not realized yet");
69
		return;*/
67
		return;
70
	case 054: //F5
68
	case 054: //F5
71
		IF(edit1.flags == 66) break;
69
		IF(edit1.flags == 66) break;
72
  case REFRESH:
70
  case REFRESH:
73
		copystr(#URL, #editURL);
71
		copystr(#URL, #editURL);
74
		Draw_Window();
72
		Draw_Window();
75
		return;
73
		return;
-
 
74
	case 014: //Ctrl+N íîâîå îêíî
-
 
75
	case 020: //Ctrl+T íîâàÿ âêëàäêà
-
 
76
	case NEWTAB:
-
 
77
		MoveSize(190,80,OLD,OLD);
-
 
78
		RunProgram(#program_path, #URL);
-
 
79
		return;
76
	case HOME:
80
	case HOME:
77
		copystr("/sys/index.htm", #editURL);
81
		copystr("/sys/index.htm", #editURL);
78
	case GOTOURL:
82
	case GOTOURL:
79
	case 0x0D: //enter
83
	case 0x0D: //enter
80
		copystr(#editURL, #URL);
84
		copystr(#editURL, #URL);
81
		Load(#URL);
85
		Load(#URL);
82
		return;
86
		return;
83
	case 052:  //Íàæàòà F3
87
	case 052:  //Íàæàòà F3
84
		IF(edit1.flags <> 66) 
88
		IF(edit1.flags <> 66) 
85
		IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
89
		IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
86
		break;
90
		break;
87
	case 173:	//ctrl+enter
91
	case 173:	//ctrl+enter
88
	case SEARCHWEB:
92
	case SEARCHWEB:
89
		copystr(#search_path, #URL);
93
		copystr(#search_path, #URL);
90
		copystr(#editURL, #URL + strlen(#URL));
94
		copystr(#editURL, #URL + strlen(#URL));
91
		Load(#URL);
95
		Load(#URL);
92
		return;
96
		return;
93
	case ID1: //ìîòàåì ââåðõ
97
	case ID1: //ìîòàåì ââåðõ
94
		IF(za_kadrom > 0) za_kadrom--;
98
		IF(za_kadrom > 0) za_kadrom--;
95
		ELSE return;
99
		ELSE return;
96
		break; 
100
		break; 
97
	case ID2: //ìîòàåì âíèç
101
	case ID2: //ìîòàåì âíèç
98
		IF(max_kolvo_strok + za_kadrom >= kolichestvo) return;
102
		IF(max_kolvo_strok + za_kadrom >= kolichestvo) return;
99
		za_kadrom++;
103
		za_kadrom++;
100
		break; 
104
		break; 
101
	case 183: //PgDown
105
	case 183: //PgDown
102
		IF(za_kadrom == kolichestvo - max_kolvo_strok) return;
106
		IF(za_kadrom == kolichestvo - max_kolvo_strok) return;
103
		za_kadrom = za_kadrom + max_kolvo_strok + 2;
107
		za_kadrom = za_kadrom + max_kolvo_strok + 2;
104
		IF(max_kolvo_strok + za_kadrom > kolichestvo) za_kadrom = kolichestvo - max_kolvo_strok;
108
		IF(max_kolvo_strok + za_kadrom > kolichestvo) za_kadrom = kolichestvo - max_kolvo_strok;
105
		BREAK;
109
		BREAK;
106
	case 184: //PgUp
110
	case 184: //PgUp
107
		IF(za_kadrom == 0) RETURN;
111
		IF(za_kadrom == 0) RETURN;
108
    za_kadrom = za_kadrom - max_kolvo_strok - 2;
112
    za_kadrom = za_kadrom - max_kolvo_strok - 2;
109
		IF(za_kadrom < 0) za_kadrom = 0;
113
		IF(za_kadrom < 0) za_kadrom = 0;
110
		BREAK;
114
		BREAK;
111
	case 180: //home
115
	case 180: //home
112
		IF (za_kadrom <>0) za_kadrom = 0;
116
		IF (za_kadrom <>0) za_kadrom = 0;
113
		ELSE RETURN;
117
		ELSE RETURN;
114
		BREAK; 
118
		BREAK; 
115
	case 181: //end
119
	case 181: //end
116
		za_kadrom = kolichestvo - max_kolvo_strok;
120
		za_kadrom = kolichestvo - max_kolvo_strok;
117
		BREAK; 
121
		BREAK; 
118
	default:
122
	default:
119
		RETURN;
123
		RETURN;
120
	}
124
	}
121
	IF(id == 11) koitodos(buf);
125
	IF(id == 11) koitodos(buf);
122
	ParseHTML(buf, filesize);
126
	ParseHTML(buf, filesize);
123
}
127
}
124
 
128
 
125
//ñêðîëë
129
//ñêðîëë
126
void TWebBrowser::DrawScroller() {
130
void TWebBrowser::DrawScroller() {
127
	dword on_y;
131
	dword on_y;
128
	DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè 
132
	DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè 
129
	DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
133
	DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
130
	DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
134
	DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
131
 
135
 
132
	IF(kolichestvo <= max_kolvo_strok) {
136
	IF(kolichestvo <= max_kolvo_strok) {
133
		DrawBar(left + width - 14, top + 17, 16, height - 34, 0xCED0D0);
137
		DrawBar(left + width - 14, top + 17, 16, height - 34, 0xCED0D0);
134
		return;
138
		return;
135
	}
139
	}
136
 
140
 
137
	razm_scrl = height - 16 * max_kolvo_strok / kolichestvo - 3;
141
	razm_scrl = height - 16 * max_kolvo_strok / kolichestvo - 3;
138
	IF(razm_scrl < 10) razm_scrl = 10;
142
	IF(razm_scrl < 10) razm_scrl = 10;
139
	IF(za_kadrom + max_kolvo_strok >= kolichestvo) on_y = height - razm_scrl + top - 17;
143
	IF(za_kadrom + max_kolvo_strok >= kolichestvo) on_y = height - razm_scrl + top - 17;
140
	ELSE on_y = height - 32 * za_kadrom / kolichestvo + top + 16;
144
	ELSE on_y = height - 32 * za_kadrom / kolichestvo + top + 16;
141
	DrawFlatButton(left + width - 15, on_y, 16, razm_scrl, 0, 0xE4DFE1, ""); //ïîëçóíîê
145
	DrawFlatButton(left + width - 15, on_y, 16, razm_scrl, 0, 0xE4DFE1, ""); //ïîëçóíîê
142
  IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
146
  IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
143
	IF(height - razm_scrl + top - 17 > on_y)
147
	IF(height - razm_scrl + top - 17 > on_y)
144
		DrawBar(left + width - 14, on_y + razm_scrl + 1, 16, height - razm_scrl - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
148
		DrawBar(left + width - 14, on_y + razm_scrl + 1, 16, height - razm_scrl - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
145
}
149
}
146
 
150
 
147
 
151
 
148
void GetNewUrl(){
152
void GetNewUrl(){
149
  IF (!strcmp(get_URL_part(2),"./")) copystr(#URL+1,#URL);
153
  IF (!strcmp(get_URL_part(2),"./")) copystr(#URL+1,#URL);
150
	//IF (!strcmp(get_URL_part(3),"../"))
154
	//IF (!strcmp(get_URL_part(3),"../"))
151
	//{
155
	//{
152
 	//	//DrawTitle(#URL+7);
156
 	//	//DrawTitle(#URL+7);
153
	//}
157
	//}
154
 	if (strcmp(get_URL_part(3),"/rd")<>0) && (strcmp(get_URL_part(5),"/sys/")<>0) && (strcmp(get_URL_part(3),"/hd")<>0)
158
 	if (strcmp(get_URL_part(3),"/rd")<>0) && (strcmp(get_URL_part(5),"/sys/")<>0) && (strcmp(get_URL_part(3),"/hd")<>0)
155
	&& (strcmp(get_URL_part(3),"/bd")<>0) && (strcmp(get_URL_part(3),"/fd")<>0) && (strcmp(get_URL_part(3),"/cd")<>0)
159
	&& (strcmp(get_URL_part(3),"/bd")<>0) && (strcmp(get_URL_part(3),"/fd")<>0) && (strcmp(get_URL_part(3),"/cd")<>0)
156
	&& (strcmp(get_URL_part(5),"http:")<>0)	&& (strcmp(get_URL_part(5),"mailt")<>0)	&& (strcmp(get_URL_part(5),"ftp:/")<>0) 
160
	&& (strcmp(get_URL_part(5),"http:")<>0)	&& (strcmp(get_URL_part(5),"mailt")<>0)	&& (strcmp(get_URL_part(5),"ftp:/")<>0) 
157
	{
161
	{
158
		copystr(BrowserHistory.CurrentUrl(), #editURL); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
162
		copystr(BrowserHistory.CurrentUrl(), #editURL); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
159
		
163
		
160
		IF (editURL[find_symbol(#editURL, '/')-2]<>'/')  // åñëè íå http://test.ua
164
		IF (editURL[find_symbol(#editURL, '/')-2]<>'/')  // åñëè íå http://test.ua
161
		{
165
		{
162
			editURL[find_symbol(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
166
			editURL[find_symbol(#editURL, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
163
			IF (URL[0]=='/') copystr(#URL+1,#URL);
167
			IF (URL[0]=='/') copystr(#URL+1,#URL);
164
		}
168
		}
165
		copystr(#URL, #editURL + strlen(#editURL)); //êëåèì íîâûé àäðåñ
169
		copystr(#URL, #editURL + strlen(#editURL)); //êëåèì íîâûé àäðåñ
166
		copystr(#editURL, #URL);
170
		copystr(#editURL, #URL);
167
	}
171
	}
168
}
172
}
169
 
173
 
170
 
174
 
171
 
175
 
172
void ReadHtml(byte DO_LOAD) {
176
void ReadHtml(byte DO_LOAD) {
173
	IF(buf) free(buf);
177
	IF(buf) free(buf);
174
	buf = malloc(1048576);
178
	buf = malloc(1048576);
175
 
179
 
176
	IF (!strcmp(get_URL_part(5),"http:"))) 
180
	IF (!strcmp(get_URL_part(5),"http:"))) 
177
	{
181
	{
178
		IF (DO_LOAD) && (!WindowRePaint)
182
		IF (DO_LOAD) && (!WindowRePaint)
179
		{
183
		{
180
			DeleteFile(#download_path);
184
			DeleteFile(#download_path);
181
			IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
185
			IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
182
			RunProgram("/sys/downloader", #URL);
186
			RunProgram("/sys/downloader", #URL);
183
			RETURN;
187
			RETURN;
184
		}
188
		}
185
		ReadFile(0, 1048576, buf, #download_path);
189
		ReadFile(0, 1048576, buf, #download_path);
186
	} 
190
	} 
187
	ELSE ReadFile(0, 1048576, buf, #URL);
191
	ELSE ReadFile(0, 1048576, buf, #URL);
188
 
192
 
189
	filesize = EBX;
193
	filesize = EBX;
190
}
194
}
191
 
195
 
192
 
196
 
193
 
197
 
194
void TWebBrowser::Load(dword adress) {
198
void TWebBrowser::Load(dword adress) {
195
	IF (URL[0] == '#') {  //ìû íå óìååì ïåðåõîäèòü ïî ññûëêå âíóòðè äîêóìåíòà. Ïîêà ÷òî...
199
	IF (URL[0] == '#') {  //ìû íå óìååì ïåðåõîäèòü ïî ññûëêå âíóòðè äîêóìåíòà. Ïîêà ÷òî...
196
		copystr(#editURL, #URL);
200
		copystr(#editURL, #URL);
197
		return;
201
		return;
198
	}
202
	}
199
 
203
 
200
	URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà, ëó÷øå, ÷åì íè÷åãî (õàáð, íàïðèìåð, áóäåò ðàáîòàòü)
204
	URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà, ëó÷øå, ÷åì íè÷åãî (õàáð, íàïðèìåð, áóäåò ðàáîòàòü)
201
 
205
 
202
	GetNewUrl();
206
	GetNewUrl();
203
 
207
 
204
	max_kolvo_stolbcov = width - 30 / 6;
208
	max_kolvo_stolbcov = width - 30 / 6;
205
	max_kolvo_strok = height - 3 / 10 - 2;
209
	max_kolvo_strok = height - 3 / 10 - 2;
206
	copystr(#version, #header);
210
	copystr(#version, #header);
207
	IF (!WindowRePaint) {
211
	IF (!WindowRePaint) {
208
		za_kadrom = 0;
212
		za_kadrom = 0;
209
		copystr(#URL, #editURL);
213
		copystr(#URL, #editURL);
210
		BrowserHistory.AddUrl();
214
		BrowserHistory.AddUrl();
211
	}
215
	}
212
	edit1.size = edit1.pos = strlen(#editURL);
216
	edit1.size = edit1.pos = strlen(#editURL);
213
	edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
217
	edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
214
 
218
 
215
	ReadHtml(LETS_LOAD);
219
	ReadHtml(LETS_LOAD);
216
	wintodos(buf);
220
	wintodos(buf);
217
	ParseHTML(buf, filesize);
221
	ParseHTML(buf, filesize);
218
	IF(!strlen(buf)) {
222
	IF(!strlen(buf)) {
219
		IF (strcmp(get_URL_part(5),"http:")==0)
223
		IF (strcmp(get_URL_part(5),"http:")==0)
220
		{
224
		{
221
			PutImage(#stop_btn, 24, 24, 88, 10);
225
			PutImage(#stop_btn, 24, 24, 88, 10);
222
			WriteText(left + 10, top + 18, 0x80, 0, "Loading...", 0);
226
			WriteText(left + 10, top + 18, 0x80, 0, "Loading...", 0);
223
		}
227
		}
224
		ELSE
228
		ELSE
225
			WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors.", 0);
229
			WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors.", 0);
226
	}
230
	}
227
 
231
 
228
	IF (!strcmp(#version, #header)) DrawTitle(#header);
232
	IF (!strcmp(#version, #header)) DrawTitle(#header);
229
}
233
}
230
 
234
 
231
 
235
 
232
 
236
 
233
byte rez, b_text, i_text, u_text, s_text, w_title, pre_text, blq_text, li_text, link, ignor_text, li_tab;
237
byte rez, b_text, i_text, u_text, s_text, w_title, pre_text, blq_text, li_text, link, ignor_text, li_tab;
234
dword text_colors[10],
238
dword text_colors[10],
235
	text_color_index = 0,
239
	text_color_index = 0,
236
	link_color;
240
	link_color;
237
int stroka,
241
int stroka,
238
	stolbec;
242
	stolbec,
-
 
243
	tab_len;
239
	byte line[330],
244
	byte line[330],
240
	tag[100],
245
	tag[100],
241
	tagparam[10000],
246
	tagparam[10000],
242
	parametr[1200],
247
	parametr[1200],
243
	options[1000];
248
	options[1000];
244
 
249
 
245
	byte ignor_param = 0;
250
	byte ignor_param = 0;
246
	
251
	
247
	byte rtf_text;
252
	byte rtf_text;
248
 
253
 
249
void TWebBrowser::ParseHTML(dword bword, fsize){
254
void TWebBrowser::ParseHTML(dword bword, fsize){
250
	word bukva[1];
255
	word bukva[1];
251
	char temp[768];
256
	char temp[768];
252
	stroka = -za_kadrom;
257
	stroka = -za_kadrom;
253
	stolbec = 0;
258
	stolbec = 0;
254
	FOR(j = 400; j < blink + 1; j++;) DeleteButton(j);
259
	FOR(j = 400; j < blink + 1; j++;) DeleteButton(j);
255
	b_text = i_text = u_text = s_text = w_title = pre_text = blq_text = 
260
	b_text = i_text = u_text = s_text = w_title = pre_text = blq_text = 
256
	li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè
261
	li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè
257
	link_color = 0x0000FF;
262
	link_color = 0x0000FF;
258
	blink = 400;
263
	blink = 400;
259
	line = '';
264
	line = '';
260
	copystr("|", #page_links);
265
	copystr("|", #page_links);
261
	IF(!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; //çà÷¸òíîå îòîáðàæåíèå òåêñòà 
266
	IF(!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; //çà÷¸òíîå îòîáðàæåíèå òåêñòà 
262
	IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
267
	IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
263
	IF(za_kadrom == 0) || (WindowRePaint) DrawBar(left, top, width - 15, 15, 0xFFFFFF); //çàêðàøèâàåì ïåðâóþ ñòðîêó
268
	IF(za_kadrom == 0) || (WindowRePaint) DrawBar(left, top, width - 15, 15, 0xFFFFFF); //çàêðàøèâàåì ïåðâóþ ñòðîêó
264
	for (; buf + fsize > bword; bword++;) {
269
	for (; buf + fsize > bword; bword++;) {
265
	  bukva = ESBYTE[bword];
270
	  bukva = ESBYTE[bword];
266
	  switch (bukva) {
271
	  switch (bukva) {
267
		case 0x0a:
272
		case 0x0a:
268
			IF(pre_text == 1) {
273
			IF(pre_text == 1) {
269
				bukva = '';
274
				bukva = '';
270
				temp = '';
275
				temp = '';
271
				goto NEXT_MARK;
276
				goto NEXT_MARK;
272
			}
277
			}
273
		CASE '\9':
278
		CASE '\9':
-
 
279
			if (pre_text == 1) //èíà÷å èä¸ì íà 0x0d	
274
		CASE 0x0d:
280
			{
-
 
281
				tab_len=strlen(#line)/8;
-
 
282
				tab_len=tab_len*8;
-
 
283
				tab_len=8+tab_len-strlen(#line);
275
			//IF(pre_text == 1) {copystr("   ", #line + strlen(#line)); break;} ELSE
284
				for (i=0; i
-
 
285
				break;
-
 
286
			}		
-
 
287
		case 0x0d:
276
			bukva = ' ';
288
			bukva = ' ';
277
			goto DEFAULT_MARK;
289
			goto DEFAULT_MARK;
278
		CASE '<':
290
		case '<':
279
			bword++; //ïðîìîòàåì ñèìâîë <
291
			bword++; //ïðîìîòàåì ñèìâîë <
280
			IF(ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî
292
			IF(ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî
281
			{
293
			{
282
				bword++;
294
				bword++;
283
				IF(ESBYTE[bword] == '-') {
295
				IF(ESBYTE[bword] == '-') {
284
					HH_: do {
296
					HH_: do {
285
						bword++;
297
						bword++;
286
						IF(bword >= buf + fsize) break 1;
298
						IF(bword >= buf + fsize) break 1;
287
					} while (ESBYTE[bword] <>'-');
299
					} while (ESBYTE[bword] <>'-');
288
					bword++;
300
					bword++;
289
					IF(ESBYTE[bword] <>'-') GOTO HH_;
301
					IF(ESBYTE[bword] <>'-') GOTO HH_;
290
				}
302
				}
291
			}
303
			}
292
			WHILE (ESBYTE[bword] <>'>') && (bword < buf + fsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
304
			WHILE (ESBYTE[bword] <>'>') && (bword < buf + fsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
293
			{
305
			{
294
				bukva = ESBYTE[bword];
306
				bukva = ESBYTE[bword];
295
				IF(bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
307
				IF(bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
296
				IF(!ignor_param) && (bukva <>' ') copystr(#bukva, #tag + strlen(#tag));
308
				IF(!ignor_param) && (bukva <>' ') copystr(#bukva, #tag + strlen(#tag));
297
				ELSE {
309
				ELSE {
298
					ignor_param = true;
310
					ignor_param = true;
299
					copystr(#bukva, #tagparam + strlen(#tagparam));
311
					copystr(#bukva, #tagparam + strlen(#tagparam));
300
				}
312
				}
301
				bword++;
313
				bword++;
302
			}
314
			}
303
			lowcase(#tag);
315
			lowcase(#tag);
304
			lowcase(#tagparam);
316
			lowcase(#tagparam);
305
			//WriteDebug(#tagparam);
317
			//WriteDebug(#tagparam);
306
			//WriteDebug(#tag); Pause(50);
318
			//WriteDebug(#tag); Pause(50);
307
			//
319
			//
308
			IF (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=''; //íåáîëüøîé ôèêñ äëÿ ðàáîòû ñ XHTML-òåãàìè òèïà br/
320
			IF (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=''; //íåáîëüøîé ôèêñ äëÿ ðàáîòû ñ XHTML-òåãàìè òèïà br/
309
			IF(strlen(#tagparam) > 0) && (strlen(#tagparam) < 4000) GetNextParam();
321
			IF(strlen(#tagparam) > 0) && (strlen(#tagparam) < 4000) GetNextParam();
310
			WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ
322
			WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ
311
 
323
 
312
			line = tag = parametr = tagparam = ignor_param = 0; //âñ¸ îáíóëÿåì
324
			line = tag = parametr = tagparam = ignor_param = 0; //âñ¸ îáíóëÿåì
313
			break;
325
			break;
314
		case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7
326
		case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7
315
			IF(strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
327
			IF(strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
316
 
328
 
317
			bword++;
329
			bword++;
318
			bukva=ESBYTE[bword];
330
			bukva=ESBYTE[bword];
319
			copystr(#bukva, #temp);
331
			copystr(#bukva, #temp);
320
 
332
 
321
			bword++;
333
			bword++;
322
			bukva=ESBYTE[bword];
334
			bukva=ESBYTE[bword];
323
			copystr(#bukva, #temp + strlen(#temp));
335
			copystr(#bukva, #temp + strlen(#temp));
324
			
336
			
325
			bukva=Hex2Symb(#temp);
337
			bukva=Hex2Symb(#temp);
326
			IF (bukva) goto DEFAULT_MARK;
338
			IF (bukva) goto DEFAULT_MARK;
327
			break; 
339
			break; 
328
		/*case '\\': //ïîääåðæêà RTF, http://dev.rembish.ru/rtf.phps
-
 
329
			IF(strcmp(#URL + strlen(#URL) - 4, ".rtf")<>0) goto DEFAULT_MARK;
-
 
330
			rtf_text='';
-
 
331
			
-
 
332
			//
-
 
333
               bword++;
-
 
334
			j = 0;
-
 
335
 
-
 
336
			IF (ESBYTE[bword]=='\'')
-
 
337
			{
-
 
338
				bword++;
-
 
339
				bukva=ESBYTE[bword];
-
 
340
				copystr(#bukva, #rtf_text);
-
 
341
	
-
 
342
				bword++;
-
 
343
				bukva=ESBYTE[bword];
-
 
344
				copystr(#bukva, #rtf_text + strlen(#rtf_text));
-
 
345
 
-
 
346
				bukva=Hex2Symb(#rtf_text);
-
 
347
				IF (bukva) goto DEFAULT_MARK;
-
 
348
			}
-
 
349
 
-
 
350
			WHILE ((ESBYTE[bword] <>' ') && (j < 25) && (ESBYTE[bword] <>'\\') && (ESBYTE[bword] <>0x0d)) {
-
 
351
				bukva = ESBYTE[bword];
-
 
352
				copystr(#bukva, #rtf_text + strlen(#rtf_text));
-
 
353
				bword++;
-
 
354
				j++;
-
 
355
			}
-
 
356
			
-
 
357
			IF (strcmp(#rtf_text,"par")==0) goto NEXT_MARK;
-
 
358
			break;*/						
-
 
359
		case '&':
340
		case '&':
360
			IF(ignor_text) break;
341
			IF(ignor_text) break;
361
			bword++;
342
			bword++;
362
			j = 0;
343
			j = 0;
363
			WHILE(ESBYTE[bword] <>';') && (j < 7) {
344
			WHILE(ESBYTE[bword] <>';') && (j < 7) {
364
				bukva = ESBYTE[bword];
345
				bukva = ESBYTE[bword];
365
				copystr(#bukva, #tag + strlen(#tag));
346
				copystr(#bukva, #tag + strlen(#tag));
366
				bword++;
347
				bword++;
367
				j++;
348
				j++;
368
			}
349
			}
369
			bukva = ''; //âñþ ýòó õðåíü íàäî çàëàáàòü ÷åðåç ìàñèâ
350
			bukva = ''; //âñþ ýòó õðåíü íàäî çàëàáàòü ÷åðåç ìàñèâ
370
			IF(!strcmp("nbsp", #tag)) copystr(" ", #line + strlen(#line));
351
			IF(!strcmp("nbsp", #tag)) copystr(" ", #line + strlen(#line));
371
			IF(!strcmp("copy", #tag)) || (!strcmp("#169", #tag)) copystr("(c)", #line + strlen(#line));
352
			IF(!strcmp("copy", #tag)) || (!strcmp("#169", #tag)) copystr("(c)", #line + strlen(#line));
372
			IF(!strcmp("reg", #tag)) || (!strcmp("#174", #tag)) copystr("(r)", #line + strlen(#line));
353
			IF(!strcmp("reg", #tag)) || (!strcmp("#174", #tag)) copystr("(r)", #line + strlen(#line));
373
			rez = StrToInt(#tag + 1) - 1040;
354
			rez = StrToInt(#tag + 1) - 1040;
374
			IF(tag[1] == '1') && (strlen(#tag) == 5) bukva = utf100tmmv_mas[rez];
355
			IF(tag[1] == '1') && (strlen(#tag) == 5) bukva = utf100tmmv_mas[rez];
375
			IF(!strcmp("bdquo", #tag)) copystr(",,", #line + strlen(#line));
356
			IF(!strcmp("bdquo", #tag)) copystr(",,", #line + strlen(#line));
376
			IF(!strcmp("amp", #tag)) || (!strcmp("#38", #tag)) bukva = '&';
357
			IF(!strcmp("amp", #tag)) || (!strcmp("#38", #tag)) bukva = '&';
377
			IF(!strcmp("lt", #tag)) || (!strcmp("#60", #tag)) bukva = '<';
358
			IF(!strcmp("lt", #tag)) || (!strcmp("#60", #tag)) bukva = '<';
378
			IF(!strcmp("gt", #tag)) || (!strcmp("#62", #tag)) bukva = '>';
359
			IF(!strcmp("gt", #tag)) || (!strcmp("#62", #tag)) bukva = '>';
379
			IF(!strcmp("minus", #tag)) || (!strcmp("#8722", #tag)) bukva = '-';
360
			IF(!strcmp("minus", #tag)) || (!strcmp("#8722", #tag)) bukva = '-';
380
			IF(!strcmp("#151", #tag)) || (!strcmp("#149", #tag)) || (!strcmp("ndash", #tag)) bukva = '-';
361
			IF(!strcmp("#151", #tag)) || (!strcmp("#149", #tag)) || (!strcmp("ndash", #tag)) bukva = '-';
381
			IF(!strcmp("#39", #tag)) || (!strcmp("#96", #tag)) bukva = '\'';
362
			IF(!strcmp("#39", #tag)) || (!strcmp("#96", #tag)) bukva = '\'';
382
			IF(!strcmp("quot", #tag)) || (!strcmp("#34", #tag)) || (!strcmp("ldquo", #tag)) || (!strcmp("rdquo", #tag)) bukva = '"';
363
			IF(!strcmp("quot", #tag)) || (!strcmp("#34", #tag)) || (!strcmp("ldquo", #tag)) || (!strcmp("rdquo", #tag)) bukva = '"';
383
			tag = '';
364
			tag = '';
384
			//break;
365
			//break;
385
		default:
366
		default:
386
			DEFAULT_MARK:
367
			DEFAULT_MARK:
387
			IF(ignor_text) break;
368
			IF(ignor_text) break;
388
			IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue;
369
			IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue;
389
			//
370
			//
390
			if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0) {
371
			if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0) {
391
				copystr(#line + find_symbol(#line, ' '), #temp); //ïåðåíîñ ïî ñëîâàì
372
				copystr(#line + find_symbol(#line, ' '), #temp); //ïåðåíîñ ïî ñëîâàì
392
				line[find_symbol(#line, ' ')] = 0x00;
373
				line[find_symbol(#line, ' ')] = 0x00;
393
				NEXT_MARK: IF(stroka - 1 > max_kolvo_strok) && (za_kadrom <>0) break 1; //óõîäèì...
374
				NEXT_MARK: IF(stroka - 1 > max_kolvo_strok) && (za_kadrom <>0) break 1; //óõîäèì...
394
				WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //âûâîä ñòðîêè
375
				WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //âûâîä ñòðîêè
395
				TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñòðîêó âêîíöå
376
				TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñòðîêó âêîíöå
396
				copystr(#temp, #line);
377
				copystr(#temp, #line);
397
			}
378
			}
398
			IF(pre_text == 0) && (bukva == ' ') && (stolbec == 0) && (strlen(#line) == 0) CONTINUE;
379
			IF(pre_text == 0) && (bukva == ' ') && (stolbec == 0) && (strlen(#line) == 0) CONTINUE;
399
			copystr(#bukva, #line + strlen(#line));
380
			copystr(#bukva, #line + strlen(#line));
400
	  }
381
	  }
401
	}
382
	}
402
	IF(max_kolvo_strok * 10 + 25 <= height)
383
	IF(max_kolvo_strok * 10 + 25 <= height)
403
		DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, 0xFFFFFF);
384
		DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, 0xFFFFFF);
404
	IF(stroka * 10 + 15 <= height)
385
	IF(stroka * 10 + 15 <= height)
405
		DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, 0xFFFFFF); //çàêðàøèâàåì âñ¸ äî êîíöà
386
		DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, 0xFFFFFF); //çàêðàøèâàåì âñ¸ äî êîíöà
406
	IF(za_kadrom == 0) kolichestvo = stroka;
387
	IF(za_kadrom == 0) kolichestvo = stroka;
407
	DrawScroller(); //ðèñóåì ñêðîëë
388
	DrawScroller(); //ðèñóåì ñêðîëë
408
}
389
}
409
 
390
 
410
 
391
 
411
void GetNextParam() {
392
void GetNextParam() {
412
	dword	kavichki = false,
393
	dword	kavichki = false,
413
			i = strlen(#tagparam) - 1;
394
			i = strlen(#tagparam) - 1;
414
 
395
 
415
	WHILE((i > 0) && (tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/'))
396
	WHILE((i > 0) && (tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/'))
416
	{
397
	{
417
		IF (tagparam[i] == '"') kavichki=1;
398
		IF (tagparam[i] == '"') kavichki=1;
418
		IF (tagparam[i] == '\'') kavichki=2;
399
		IF (tagparam[i] == '\'') kavichki=2;
419
		tagparam[i] = 0x00;
400
		tagparam[i] = 0x00;
420
		i--;
401
		i--;
421
	}
402
	}
422
 
403
 
423
	IF (kavichki==1)  // "
404
	IF (kavichki==1)  // "
424
	{
405
	{
425
		i=find_symbol(#tagparam, '"');
406
		i=find_symbol(#tagparam, '"');
426
		copystr(#tagparam + i, #options);
407
		copystr(#tagparam + i, #options);
427
	}
408
	}
428
	ELSE IF (kavichki==2) // '
409
	ELSE IF (kavichki==2) // '
429
	{
410
	{
430
		i=find_symbol(#tagparam, '\'');
411
		i=find_symbol(#tagparam, '\'');
431
		copystr(#tagparam + i, #options);
412
		copystr(#tagparam + i, #options);
432
	}
413
	}
433
 
414
 
434
	ELSE
415
	ELSE
435
	{
416
	{
436
		//i=find_symbol(#tagparam, '=');
417
		//i=find_symbol(#tagparam, '=');
437
		WHILE((i > 0) && (tagparam[i] <>'=')) i--;
418
		WHILE((i > 0) && (tagparam[i] <>'=')) i--;
438
		i+=1;
419
		i+=1;
439
		copystr(#tagparam + i, #options); //êîïèðóåì îïöèþ
420
		copystr(#tagparam + i, #options); //êîïèðóåì îïöèþ
440
		WHILE (options[0] == ' ') copystr(#options + 1, #options);
421
		WHILE (options[0] == ' ') copystr(#options + 1, #options);
441
	}
422
	}
442
	tagparam[i] = 0x00;
423
	tagparam[i] = 0x00;
443
 
424
 
444
	//
425
	//
445
	WHILE((tagparam[i] <>' ') && (i > 0)) {
426
	WHILE((tagparam[i] <>' ') && (i > 0)) {
446
		IF(tagparam[i] == '=') //äåðçêàÿ çàãëóøêà
427
		IF(tagparam[i] == '=') //äåðçêàÿ çàãëóøêà
447
		{
428
		{
448
			//copystr(#tagparam+i+2,#options);
429
			//copystr(#tagparam+i+2,#options);
449
			tagparam[i + 1] = 0x00;
430
			tagparam[i + 1] = 0x00;
450
		}
431
		}
451
		i--;
432
		i--;
452
	}
433
	}
453
	copystr(#tagparam + i + 1, #parametr); //êîïèðóåì ïàðàìåòð
434
	copystr(#tagparam + i + 1, #parametr); //êîïèðóåì ïàðàìåòð
454
	tagparam[i] = 0x00;
435
	tagparam[i] = 0x00;
455
}
436
}
456
 
437
 
457
 
438
 
458
 
439
 
459
char oldtag[100];
440
char oldtag[100];
460
void TWebBrowser::WhatTextStyle(word left1, top1, width1) {
441
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
461
	dword hr_color;
442
	dword hr_color;
462
 
443
 
463
    dword image=0;
444
    dword image=0;
464
    char temp[1024];
445
    char temp[1024];
465
    int w, h;
446
    int w, h;
466
 
447
 
467
	IF(tag[0] == '/') {
448
	IF(tag[0] == '/') {
468
		rez = 0;
449
		rez = 0;
469
		copystr(#tag + 1, #tag);
450
		copystr(#tag + 1, #tag);
470
	} ELSE rez = 1;
451
	} ELSE rez = 1;
471
	//
452
	//
472
	IF(!chTag("html")) {
453
	IF(!chTag("html")) {
473
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
454
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
474
		return;
455
		return;
475
	}
456
	}
476
	IF(!chTag("script")) || (!chTag("style")) ignor_text = rez;
457
	IF(!chTag("script")) || (!chTag("style")) ignor_text = rez;
477
	IF (ignor_text == 1) return;
458
	IF (ignor_text == 1) return;
478
	//
459
	//
479
 
460
 
480
	if(!chTag("title")) IF(w_title == 0) {
461
	if(!chTag("title")) IF(w_title == 0) {
481
		copystr(" ", #line);
462
		copystr(" ", #line);
482
		w_title = 1;
463
		w_title = 1;
483
	}
464
	}
484
	ELSE {
465
	ELSE {
485
		w_title = 0;
466
		w_title = 0;
486
		stolbec = 0;
467
		stolbec = 0;
487
		copystr(#line, #header);
468
		copystr(#line, #header);
488
		copystr(" -", #header + strlen(#header));
469
		copystr(" -", #header + strlen(#header));
489
		copystr(#version, #header + strlen(#header));
470
		copystr(#version, #header + strlen(#header));
490
		IF(stroka == 0) || (WindowRePaint == 1) DrawTitle(#header);
471
		IF(stroka == 0) || (WindowRePaint == 1) DrawTitle(#header);
491
		//äà, çíàþ, 2 ðàçà âûõîäèò, íî, åñëè áîëüøàÿ ñòðàíèöà, òî òðóú
472
		//äà, çíàþ, 2 ðàçà âûõîäèò, íî, åñëè áîëüøàÿ ñòðàíèöà, òî òðóú
492
		return;
473
		return;
493
	}
474
	}
494
	//
475
	//
495
	IF(!chTag("q")) copystr("\"", #line + strlen(#line));
476
	IF(!chTag("q")) copystr("\"", #line + strlen(#line));
496
	if (stroka > -1) && (stroka - 2 < max_kolvo_strok) && (line) {
477
	if (stroka > -1) && (stroka - 2 < max_kolvo_strok) && (line) {
497
		WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0);
478
		WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0);
498
		IF(b_text) WriteText(stolbec * 6 + left1 + 1, top1, 0x80, text_colors[text_color_index], #line, 0);
479
		IF(b_text) WriteText(stolbec * 6 + left1 + 1, top1, 0x80, text_colors[text_color_index], #line, 0);
499
		IF(i_text) Skew(stolbec * 6 + left1, top1, strlen(#line)+1*6, 10);
480
		IF(i_text) Skew(stolbec * 6 + left1, top1, strlen(#line)+1*6, 10);
500
		IF(s_text) DrawBar(stolbec * 6 + left1, top1 + 4, strlen(#line) * 6, 1, text_colors[text_color_index]); //çà÷¸ðêíóòûé
481
		IF(s_text) DrawBar(stolbec * 6 + left1, top1 + 4, strlen(#line) * 6, 1, text_colors[text_color_index]); //çà÷¸ðêíóòûé
501
		IF(u_text) DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]); //ïîä÷¸ðêíóòûé
482
		IF(u_text) DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]); //ïîä÷¸ðêíóòûé
502
		IF(link) {
483
		IF(link) {
503
			DefineButton(stolbec * 6 + left1 - 2, top1, strlen(#line) * 6 + 3, 9, blink + BT_HIDE, 0xB5BFC9); //
484
			DefineButton(stolbec * 6 + left1 - 2, top1, strlen(#line) * 6 + 3, 9, blink + BT_HIDE, 0xB5BFC9); //
504
			DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]);
485
			DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]);
505
		}
486
		}
506
	}
487
	}
507
	//
488
	//
508
	IF(!tag) return;
489
	IF(!tag) return;
509
	stolbec += strlen(#line);
490
	stolbec += strlen(#line);
510
	//////////////////////////
491
	//////////////////////////
511
	if (!chTag("a")) {
492
	if (!chTag("a")) {
512
		IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return;
493
		IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return;
513
		if (rez) {
494
		if (rez) {
514
			HREF: IF(strcmp(#parametr, "href=") == 0) {
495
			HREF: IF(strcmp(#parametr, "href=") == 0) {
515
				IF(link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã
496
				IF(link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã
516
				link = 1;
497
				link = 1;
517
				blink++;
498
				blink++;
518
				text_color_index++;
499
				text_color_index++;
519
				text_colors[text_color_index] = link_color;
500
				text_colors[text_color_index] = link_color;
520
				copystr(#options, #page_links + strlen(#page_links));
501
				copystr(#options, #page_links + strlen(#page_links));
521
				copystr("|", #page_links + strlen(#page_links));
502
				copystr("|", #page_links + strlen(#page_links));
522
			}
503
			}
523
			IF(tagparam) {
504
			IF(tagparam) {
524
				GetNextParam();
505
				GetNextParam();
525
				GOTO HREF;
506
				GOTO HREF;
526
			}
507
			}
527
		}
508
		}
528
		ELSE {
509
		ELSE {
529
			link = 0;
510
			link = 0;
530
			IF(text_color_index > 0) text_color_index--;
511
			IF(text_color_index > 0) text_color_index--;
531
		}
512
		}
532
		return;
513
		return;
533
	}
514
	}
534
	/////////////////////////
515
	/////////////////////////
535
	if (!chTag("font")) {
516
	if (!chTag("font")) {
536
		IF(stroka <= 0) && (stroka - 1 > max_kolvo_strok) return;
517
		IF(stroka <= 0) && (stroka - 1 > max_kolvo_strok) return;
537
		COL_MARK: IF(strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
518
		COL_MARK: IF(strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
538
		{
519
		{
539
      text_color_index++;
520
      text_color_index++;
540
      IF (options[0] == '#'){
521
      IF (options[0] == '#'){
541
        text_colors[text_color_index] = StrToCol(#options);
522
        text_colors[text_color_index] = StrToCol(#options);
542
			}
523
			}
543
			ELSE {
524
			ELSE {
544
             FOR (i=0;color_names[i]!=0;i++){
525
             FOR (i=0;color_names[i]!=0;i++){
545
              IF(!strcmp(#options, color_names[i])) {text_colors[text_color_index] = colors[i]; BREAK;}
526
              IF(!strcmp(#options, color_names[i])) {text_colors[text_color_index] = colors[i]; BREAK;}
546
            }
527
            }
547
          }
528
          }
548
			
529
			
549
		}
530
		}
550
		IF(tagparam[0] <>'') {
531
		IF(tagparam[0] <>'') {
551
			GetNextParam();
532
			GetNextParam();
552
			GOTO COL_MARK;
533
			GOTO COL_MARK;
553
		}
534
		}
554
		IF(!rez) && (text_color_index > 0) text_color_index--;
535
		IF(!rez) && (text_color_index > 0) text_color_index--;
555
		return;
536
		return;
556
	}
537
	}
557
	//////////////////////////
538
	//////////////////////////
558
	IF(!chTag("tr")) || (!chTag("br")) {
539
	IF(!chTag("tr")) || (!chTag("br")) {
559
		TextGoDown(left1, top1, width1);
540
		TextGoDown(left1, top1, width1);
560
		return;
541
		return;
561
	}
542
	}
562
	IF(!chTag("div")) {
543
	IF(!chTag("div")) {
563
		IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
544
		IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
564
		return;
545
		return;
565
	}
546
	}
566
	IF(!chTag("p")) {
547
	IF(!chTag("p")) {
567
		IF(oldtag[0] == 'h') return;
548
		IF(oldtag[0] == 'h') return;
568
		TextGoDown(left1, top1, width1);
549
		TextGoDown(left1, top1, width1);
569
		IF(rez) TextGoDown(left1, top1 + 10, width1);
550
		IF(rez) TextGoDown(left1, top1 + 10, width1);
570
		return;
551
		return;
571
	}
552
	}
572
	////////////////////////////
553
	////////////////////////////
573
	IF(!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
554
	IF(!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
574
		TextGoDown(left1, top1, width1);
555
		TextGoDown(left1, top1, width1);
575
		IF(rez) TextGoDown(left1, top1 + 10, width1);
556
		IF(rez) TextGoDown(left1, top1 + 10, width1);
576
		b_text = rez;
557
		b_text = rez;
577
		copystr(#tag, #oldtag);
558
		copystr(#tag, #oldtag);
578
		return;
559
		return;
579
	} ELSE copystr("", #oldtag);
560
	} ELSE copystr("", #oldtag);
580
	IF(!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
561
	IF(!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
581
		b_text = rez;
562
		b_text = rez;
582
		return;
563
		return;
583
	}
564
	}
584
	////////////////////////////
565
	////////////////////////////
585
	IF(!chTag("i")) || (!chTag("em")) {
566
	IF(!chTag("i")) || (!chTag("em")) {
586
		i_text = rez;
567
		i_text = rez;
587
		return;
568
		return;
588
	}	
569
	}	
589
	////////////////////////////
570
	////////////////////////////
590
	if(!chTag("li")) || (!chTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
571
	if(!chTag("li")) || (!chTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè
591
	{
572
	{
592
		li_text = rez;
573
		li_text = rez;
593
		IF(rez == 0) return;
574
		IF(rez == 0) return;
594
		TextGoDown(left1, top1, width1);
575
		TextGoDown(left1, top1, width1);
595
		IF(stroka > -1) && (stroka - 2 < max_kolvo_strok) IF(!chTag("li")) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0);
576
		IF(stroka > -1) && (stroka - 2 < max_kolvo_strok) IF(!chTag("li")) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0);
596
		return;
577
		return;
597
	}
578
	}
598
	////////////////////////////
579
	////////////////////////////
599
	IF(!chTag("u")) || (!chTag("ins")) u_text = rez;
580
	IF(!chTag("u")) || (!chTag("ins")) u_text = rez;
600
	IF(!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
581
	IF(!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
601
	IF(!chTag("ul")) || (!chTag("ol")) IF(!rez) {
582
	IF(!chTag("ul")) || (!chTag("ol")) IF(!rez) {
602
		li_text = rez;
583
		li_text = rez;
603
		li_tab--;
584
		li_tab--;
604
		TextGoDown(left1, top1, width1);
585
		TextGoDown(left1, top1, width1);
605
	} ELSE li_tab++;
586
	} ELSE li_tab++;
606
	IF(!chTag("dd")) stolbec += 5;
587
	IF(!chTag("dd")) stolbec += 5;
607
	IF(!chTag("blockquote")) blq_text = rez;
588
	IF(!chTag("blockquote")) blq_text = rez;
608
	IF(!chTag("body")) IF(strcmp(#parametr, "link=") == 0) link_color = StrToCol(#options);
589
	IF(!chTag("body")) IF(strcmp(#parametr, "link=") == 0) link_color = StrToCol(#options);
609
	IF(!chTag("pre")) pre_text = rez; 
590
	IF(!chTag("pre")) pre_text = rez; 
610
	IF(!chTag("hr")) {
591
	IF(!chTag("hr")) {
611
		TextGoDown(left1, top1, width1);
592
		TextGoDown(left1, top1, width1);
612
		TextGoDown(left1, top1 + 10, width1);
593
		TextGoDown(left1, top1 + 10, width1);
613
		IF(strcmp(#parametr, "color=") == 0) hr_color = StrToCol(#options);
594
		IF(strcmp(#parametr, "color=") == 0) hr_color = StrToCol(#options);
614
		ELSE hr_color = 0x999999;
595
		ELSE hr_color = 0x999999;
615
		IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color);
596
		IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color);
616
	}
597
	}
617
 
598
 
618
	if (!chTag("img"))
599
	if (!chTag("img"))
619
	{
600
	{
620
		//IF (GetFileInfo(#libimg)<>0) return;  //åñëè áèáëèîòåêè íåò
601
		//IF (GetFileInfo(#libimg)<>0) return;  //åñëè áèáëèîòåêè íåò
621
		IMG_TAG:
602
		IMG_TAG:
622
			IF (strcmp(#parametr,"src=")==0)   //íàäî îáúåäèíèòü ñ GetNewUrl()
603
			IF (strcmp(#parametr,"src=")==0)   //íàäî îáúåäèíèòü ñ GetNewUrl()
623
	          {
604
	          {
624
				copystr(BrowserHistory.CurrentUrl(), #temp); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
605
				copystr(BrowserHistory.CurrentUrl(), #temp); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
625
				temp[find_symbol(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
606
				temp[find_symbol(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
626
				copystr(#options,#temp+strlen(#temp));
607
				copystr(#options,#temp+strlen(#temp));
627
				image=load_image(#temp);
608
				image=load_image(#temp);
628
	
609
	
629
	                w=DSWORD[image+4];
610
	                w=DSWORD[image+4];
630
	                h=DSWORD[image+8]; 
611
	                h=DSWORD[image+8]; 
631
	          }
612
	          }
632
		IF(tagparam) {
613
		IF(tagparam) {
633
			GetNextParam();
614
			GetNextParam();
634
			GOTO IMG_TAG;
615
			GOTO IMG_TAG;
635
		}
616
		}
636
 
617
 
637
        if (image)
618
        if (image)
638
        {
619
        {
-
 
620
			stroka+=h/10;
-
 
621
			
-
 
622
			if (top1+hWB1.top+WB1.height-10) //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
-
 
623
				return;
-
 
624
			
-
 
625
			if (top1
-
 
626
			{
639
			IF (width1
627
				h=h-WB1.top+top1;
-
 
628
				top1=WB1.top-5;
-
 
629
			}
-
 
630
			
-
 
631
			if (top1>WB1.top+WB1.height-h-10) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó     IF (stroka - 2 < max_kolvo_strok)
-
 
632
			{
-
 
633
				//WriteDebug(IntToStr(top1));
640
			IF (WB1.height
634
				//WriteDebug(IntToStr(WB1.top));
-
 
635
				//WriteDebug(IntToStr(h));
641
		IF (top1
636
				h=WB1.top+WB1.height-top1-10;
-
 
637
			}			 
-
 
638
			
642
		TextGoDown2(left1+w,top1,width1-w,h);
639
			img_draw stdcall (image,left1-5,top1+10,w, h,0,0);
643
        IF (stroka - 2 < max_kolvo_strok) img_draw stdcall (image,left1-5,top1+10,w,-stroka * 10 + WB1.height -15 + h,0,0);
640
			DrawBar(left1+w - 5, top1 + 10, width1-w + 5, h, 0xFFFFFF);
644
        }
641
        }
645
        //else WriteDebug(#options);
-
 
646
	}
642
	}
647
 
643
 
648
	if (!chTag("meta")) {
644
	if (!chTag("meta")) {
649
		META:
645
		META:
650
		if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content="))
646
		if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content="))
651
		{
647
		{
652
			copystr(#options[find_symbol(#options, '=')],#options); //ïîèñê â content=
648
			copystr(#options[find_symbol(#options, '=')],#options); //ïîèñê â content=
653
 
649
 
654
      IF (!strcmp(#options,"utf-8"))
650
      IF (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8"))
655
			{
651
			{
656
				ReadHtml(DONT_LOAD);
652
				ReadHtml(DONT_LOAD);
657
   	    utf8rutodos(buf);
653
   	    utf8rutodos(buf);
658
			}
654
			}
659
			IF(!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))
655
			IF(!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))
660
			{
656
			{
661
				ReadHtml(DONT_LOAD);
657
				ReadHtml(DONT_LOAD);
662
				koitodos(buf);
658
				koitodos(buf);
663
			}
659
			}
664
			IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866"))
660
			IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866"))
665
			{
661
			{
666
				ReadHtml(DONT_LOAD);
662
				ReadHtml(DONT_LOAD);
667
			}
663
			}
668
		}
664
		}
669
		IF(tagparam[0] <>'') {
665
		IF(tagparam[0] <>'') {
670
			GetNextParam();
666
			GetNextParam();
671
			goto META;
667
			goto META;
672
		}
668
		}
673
	}
669
	}
674
}
670
}
675
 
671
 
676
 
672
 
677
void TextGoDown(int left1, top1, width1) {
673
void TextGoDown(int left1, top1, width1) {
678
	stroka++;
674
	stroka++;
679
	IF(blq_text == 1) stolbec = 8;
675
	IF(blq_text == 1) stolbec = 8;
680
	ELSE stolbec = 0;
676
	ELSE stolbec = 0;
681
	IF(li_text == 1) stolbec = li_tab * 5;
677
	IF(li_text == 1) stolbec = li_tab * 5;
682
	IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, 0xFFFFFF);
678
	IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, 0xFFFFFF);
683
}
679
}
684
 
-
 
685
void TextGoDown2(int left1,top1,width1,height1)//ASPER: Íàäî çàìåíèòü ýòó ôóíêöèþ áîëåå ïðàâèëüíîé.
-
 
686
{
-
 
687
  stroka+=height1/10;
-
 
688
  IF (blq_text==1) stolbec=8; ELSE stolbec=0;
-
 
689
  IF (li_text==1) stolbec=5;
-
 
690
  IF (stroka>=0) && (stroka-2
-
 
691
}
-
 
692
>
680
>
693
>
681
>
694
>
682
>