Subversion Repositories Kolibri OS

Rev

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

Rev 6730 Rev 6735
Line 155... Line 155...
155
				break;
155
				break;
156
			}
156
			}
157
		case '\9':
157
		case '\9':
158
			if (style.pre) //èíà÷å èä¸ì íà 0x0d	
158
			if (style.pre) //otherwise go to 0x0d	
159
			{
159
			{
160
				tab_len = strlen(#line) % 4;
160
				tab_len = strlen(#line) % 4;
161
				if (!tab_len) tab_len = 4;
161
				if (!tab_len) tab_len = 4;
162
				for (j=0; j
162
				for (j=0; j
163
				break;
163
				break;
164
			}
164
			}
165
			goto DEFAULT_MARK;		
165
			goto DEFAULT_MARK;		
Line 181... Line 181...
181
				bufpos++;
181
				bufpos++;
182
			}
182
			}
183
			tag = attr = tagparam = ignor_param = NULL;
183
			tag = attr = tagparam = ignor_param = NULL;
184
			while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
184
			while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
185
			{
185
			{
186
				bukva = ESBYTE[bufpos];
186
				bukva = ESBYTE[bufpos];
187
				if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
187
				if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
188
				if (!ignor_param) && (bukva <>' ')
188
				if (!ignor_param) && (bukva <>' ')
189
				{
189
				{
190
					if (strlen(#tag)+1
190
					if (strlen(#tag)+1
191
				}
191
				}
Line 203... Line 203...
203
			Perenos();
203
			Perenos();
204
			DrawStyle();
204
			DrawStyle();
205
			line = NULL;
205
			line = NULL;
206
			if (tag) SetStyle(); //îáðàáîòêà òåãîâ
206
			if (tag) SetStyle();
207
			strlcpy(#oldtag, #tag, sizeof(oldtag));
207
			strlcpy(#oldtag, #tag, sizeof(oldtag));
208
			tag = attr = tagparam = ignor_param = NULL;
208
			tag = attr = tagparam = ignor_param = NULL;
209
			break;
209
			break;
210
		default:
210
		default:
211
			DEFAULT_MARK:
211
			DEFAULT_MARK:
212
			if (bukva<=15) bukva=' ';
212
			if (bukva<=15) bukva=' ';
213
			line_len = strlen(#line);
213
			line_len = strlen(#line);
Line 224... Line 224...
224
	NewLine();
224
	NewLine();
225
	DrawPage();
225
	DrawPage();
226
	if (list.first == 0) list.count = stroka;
226
	if (list.first == 0) list.count = stroka;
227
	if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
227
	if (anchor)
228
	{
228
	{
229
		anchor=NULL;
-
 
-
 
229
		anchor=NULL;
230
		list.first=anchor_line_num;
230
		list.first=anchor_line_num;
231
		Prepare();
231
		Prepare();
232
	}
232
	}
233
}
233
}
234
//============================================================================================
234
//============================================================================================
Line 251... Line 251...
251
	int top1 = stroka * list.item_h + list.y + 5;
251
	int top1 = stroka * list.item_h + list.y + 5;
252
	byte opened;
252
	byte opened;
253
	byte meta_encoding;
253
	byte meta_encoding;
254
	//ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ
254
	if (tag[0] == '/') 
255
	if (tag[0] == '/') 
255
	{
256
	{
-
 
257
		 opened = 0;
256
		 opened = 0;
258
		 strcpy(#tag, #tag+1);
257
		 strcpy(#tag, #tag+1);
259
	}
258
	}
260
	else opened = 1;
259
	else opened = 1;
261
	if (istag("html")) {
260
	if (istag("html")) {
Line 266... Line 265...
266
	if (istag("form")) if (!opened) ignor_text = false;
265
	if (istag("form")) if (!opened) ignor_text = false;
267
	if(istag("title")) {
266
	if(istag("title")) {
268
		if (opened) header=NULL;
267
		if (opened) header=NULL;
269
		else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó
268
		else if (!stroka) DrawTitle(#header);
270
		return;
269
		return;
271
	}
270
	}
272
	if (ignor_text) return;
271
	if (ignor_text) return;
273
	
272
	
274
	IF(istag("q"))
273
	IF(istag("q"))
Line 275... Line 274...
275
	{
274
	{
276
		if (opened)	strcat(#line, " \"");
275
		if (opened)	strcat(#line, " \"");
277
		if (!opened) strcat(#line, "\" ");
276
		if (!opened) strcat(#line, "\" ");
278
		return;
277
		return;
279
	}
278
	}
280
	if (anchor) && (isattr("id=")) { //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò
279
	if (anchor) if (isattr("id=")) || (isattr("name=")) { //very bad: if the tag is not the last it wound work
281
		if (!strcmp(#anchor, #val))	anchor_line_num=list.first+stroka;
280
		if (!strcmp(#anchor, #val))	anchor_line_num=list.first+stroka;
282
	}	
281
	}	
283
	if (istag("body")) {
282
	if (istag("body")) {
284
		t_body = opened;
283
		t_body = opened;
285
		do{
284
		do{
286
			if (isattr("link=")) link_color_inactive = GetColor(#val);
285
			if (isattr("link=")) link_color_inactive = GetColor(#val);
Line 298... Line 297...
298
	if (istag("a")) {
297
	if (istag("a")) {
299
		if (opened)
298
		if (opened)
300
		{
299
		{
301
			if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
300
			if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
302
			do{
301
			do{
303
				if (isattr("href=")) && (!strstr(#val,"javascript:"))
302
				if (isattr("href=")) && (!strstr(#val,"javascript:"))
304
				{
303
				{
305
					text_color_index++;
304
					text_color_index++;
306
					text_colors[text_color_index] = text_colors[text_color_index-1];
305
					text_colors[text_color_index] = text_colors[text_color_index-1];
307
					link = 1;
306
					link = 1;
308
					text_colors[text_color_index] = link_color_inactive;
307
					text_colors[text_color_index] = link_color_inactive;
309
					PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom);
308
					PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom);
310
				}
309
				}
311
				if (anchor) && (isattr("name="))
310
			} while(GetNextParam());
312
				{
311
		}
313
					if (!strcmp(#anchor, #val))
-
 
314
					{
-
 
315
						anchor_line_num=list.first+stroka;
-
 
316
					}
-
 
317
				}
-
 
318
			} while(GetNextParam());
-
 
319
		}
-
 
320
		else {
312
		else {
321
			link = 0;
313
			link = 0;
322
			IF(text_color_index > 0) text_color_index--;
314
			IF(text_color_index > 0) text_color_index--;
323
		}
315
		}
324
		return;
316
		return;
Line 417... Line 409...
417
		do{
409
		do{
418
			if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding="))
410
			if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding="))
419
			{
411
			{
420
				strcpy(#val, #val[strrchr(#val, '=')]); //ïîèñê â content=
412
				strcpy(#val, #val[strrchr(#val, '=')]); //search in content=
421
				strlwr(#val);
413
				strlwr(#val);
422
				if      (isval("utf-8"))        || (isval("utf8"))        meta_encoding = CH_UTF8;
414
				if      (isval("utf-8"))        || (isval("utf8"))        meta_encoding = CH_UTF8;
423
				else if (isval("koi8-r"))       || (isval("koi8-u"))      meta_encoding = CH_KOI8;
415
				else if (isval("koi8-r"))       || (isval("koi8-u"))      meta_encoding = CH_KOI8;
424
				else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251;
416
				else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251;
425
				else if (isval("iso-8859-5"))   || (isval("iso8859-5"))   meta_encoding = CH_ISO8859_5;
417
				else if (isval("iso-8859-5"))   || (isval("iso8859-5"))   meta_encoding = CH_ISO8859_5;
426
				else if (isval("dos"))          || (isval("cp-866"))      meta_encoding = CH_CP866;
418
				else if (isval("dos"))          || (isval("cp-866"))      meta_encoding = CH_CP866;
427
			}
419
			}