Subversion Repositories Kolibri OS

Rev

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

Rev 7756 Rev 7757
Line 1... Line 1...
1
#include "..\TWB\colors.h"
1
#include "..\TWB\colors.h"
2
#include "..\TWB\anchors.h"
2
#include "..\TWB\anchors.h"
3
#include "..\TWB\parce_tag.h"
3
#include "..\TWB\parce_tag.h"
4
#include "..\TWB\absolute_url.h"
4
#include "..\TWB\absolute_url.h"
5
char line[500];
-
 
6
#include "..\TWB\unicode_tags.h"
5
#include "..\TWB\unicode_tags.h"
-
 
6
#include "..\TWB\img_cache.h"
-
 
7
dword page_bg;
-
 
8
dword link_color_inactive;
-
 
9
dword link_color_active;
-
 
10
#include "..\TWB\links.h"
Line 7... Line 11...
7
 
11
 
Line 8... Line 12...
8
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
12
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
9
 
13
 
Line 37... Line 41...
37
	void NewLine();
41
	void NewLine();
38
	bool CheckForLineBreak();
42
	bool CheckForLineBreak();
39
	void BufEncode();
43
	void BufEncode();
40
} WB1;
44
} WB1;
Line 41... Line 45...
41
 
45
 
42
dword page_bg;
-
 
43
#include "..\TWB\img_cache.h"
-
 
44
 
-
 
45
dword link_color_inactive;
-
 
Line 46... Line 46...
46
dword link_color_active;
46
char line[500];
Line 47... Line -...
47
 
-
 
Line 48... Line 47...
48
bool link, cur_encoding, t_html, t_body;
47
 
49
 
48
bool link, cur_encoding, t_html, t_body;
Line 50... Line 49...
50
#include "..\TWB\links.h"
49
 
Line 51... Line 50...
51
 
50
 
52
dword bufpointer=0;
51
dword bufpointer=0;
Line 53... Line 52...
53
dword bufsize=0;
52
dword bufsize=0;
Line 54... Line 53...
54
 
53
 
55
char header[150];
54
char header[150];
56
 
55
 
57
int body_magrin=6;
56
int body_magrin=6;
Line 126... Line 125...
126
	cur_encoding = CH_NULL;
125
	cur_encoding = CH_NULL;
127
	draw_y = body_magrin;
126
	draw_y = body_magrin;
128
	stolbec = 0;
127
	stolbec = 0;
129
	line = 0;
128
	line = 0;
130
	zoom = 1;
129
	zoom = 1;
-
 
130
	//hold original buffer
131
	if (o_bufpointer) free(o_bufpointer);
131
	if (o_bufpointer) o_bufpointer=free(o_bufpointer);
132
	o_bufpointer = 0;
132
	o_bufpointer = malloc(bufsize);
-
 
133
	memmov(o_bufpointer, bufpointer, bufsize);
133
}
134
}
134
//============================================================================================
135
//============================================================================================
135
void TWebBrowser::AddCharToTheLine(unsigned char _char)
136
void TWebBrowser::AddCharToTheLine(unsigned char _char)
136
{
137
{
137
	dword line_len;
138
	dword line_len;
Line 185... Line 186...
185
			for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (j<8); j++)
186
			for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (j<8); j++)
186
			{
187
			{
187
				bukva = ESBYTE[bufpos+j];
188
				bukva = ESBYTE[bufpos+j];
188
				chrcat(#unicode_symbol, bukva);
189
				chrcat(#unicode_symbol, bukva);
189
			}
190
			}
190
			if (bukva = GetUnicodeSymbol(#unicode_symbol)) {
191
			if (GetUnicodeSymbol(#line, #unicode_symbol, sizeof(line)-1)) {
191
				bufpos += j;
192
				bufpos += j;
192
				CheckForLineBreak();
193
				CheckForLineBreak();
193
			} else {
194
			} else {
194
				AddCharToTheLine('&');
195
				AddCharToTheLine('&');
195
			}
196
			}
Line 240... Line 241...
240
			}
241
			}
Line 241... Line 242...
241
 
242
 
242
			if (tag.name[strlen(#tag.name)-1]=='/') tag.name[strlen(#tag.name)-1]=NULL; //for br/ !!!!!!!!
243
			if (tag.name[strlen(#tag.name)-1]=='/') tag.name[strlen(#tag.name)-1]=NULL; //for br/ !!!!!!!!
Line 243... Line 244...
243
			if (tag.params) tag.parse_params();
244
			if (tag.params) tag.parse_params();
244
 
245
 
245
			if (tag.name) && (!tag.is("i")) && (!tag.is("svg")) {
246
			if (tag.name) {
246
				CheckForLineBreak();
247
				CheckForLineBreak();
247
				DrawStyle();
248
				DrawStyle();
248
				if (tag.name) SetStyle();
249
				if (tag.name) SetStyle();
Line 303... Line 304...
303
	if(tag.is("title")) {
304
	if (tag.is("title")) {
304
		if (tag.opened) header=NULL;
305
		if (tag.opened) header=NULL;
305
		return;
306
		return;
306
	}
307
	}
Line 307... Line 308...
307
	
308
	
308
	IF(tag.is("q"))
309
	if (tag.is("q"))
309
	{
310
	{
310
		if (tag.opened)	{
311
		if (tag.opened)	{
311
			meta_encoding = strlen(#line);
312
			meta_encoding = strlen(#line);
312
			if (line[meta_encoding-1] != ' ') chrcat(#line, ' ');
313
			if (line[meta_encoding-1] != ' ') chrcat(#line, ' ');
Line 382... Line 383...
382
		IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return;
383
		IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return;
383
		NewLine();
384
		NewLine();
384
		return;
385
		return;
385
	}
386
	}
386
	if (tag.is("br")) { NewLine(); return; }
387
	if (tag.is("br")) { NewLine(); return; }
-
 
388
	if (tag.is("td")) { if (tag.opened) AddCharToTheLine(' '); return; }
387
	if (tag.is("tr")) { if (tag.opened) NewLine(); return; }
389
	if (tag.is("tr")) { if (tag.opened) NewLine(); return; }
388
	if (tag.is("b")) || (tag.is("strong")) || (tag.is("big")) { style.b = tag.opened; return; }
390
	if (tag.is("b")) || (tag.is("strong")) || (tag.is("big")) { style.b = tag.opened; return; }
389
	if (tag.is("button")) { style.button = tag.opened; stolbec++; return; }
391
	if (tag.is("button")) { style.button = tag.opened; stolbec++; return; }
390
	if (tag.is("u")) || (tag.is("ins")) { style.u=tag.opened; return;}
392
	if (tag.is("u")) || (tag.is("ins")) { style.u=tag.opened; return;}
391
	if (tag.is("s")) || (tag.is("strike")) || (tag.is("del")) { style.s=tag.opened; return; }
393
	if (tag.is("s")) || (tag.is("strike")) || (tag.is("del")) { style.s=tag.opened; return; }
Line 457... Line 459...
457
		return;
459
		return;
458
	}
460
	}
459
	if (tag.is("ul")) || (tag.is("ol")) {
461
	if (tag.is("ul")) || (tag.is("ol")) {
460
		if (!tag.opened)
462
		if (!tag.opened)
461
		{
463
		{
462
			style.li = tag.opened;
464
			style.li = false;
463
			style.li_tab--;
465
			style.li_tab--;
464
			NewLine();
466
			NewLine();
465
		} 
467
		} 
466
		else style.li_tab++;
468
		else style.li_tab++;
467
	}
469
	}
Line 493... Line 495...
493
	}
495
	}
494
}
496
}
495
//============================================================================================
497
//============================================================================================
496
void TWebBrowser::BufEncode(dword set_new_encoding)
498
void TWebBrowser::BufEncode(dword set_new_encoding)
497
{
499
{
498
	if (cur_encoding == set_new_encoding) return;
500
	if (cur_encoding != set_new_encoding) {
499
	if (o_bufpointer==0) {
-
 
500
		o_bufpointer = malloc(bufsize);
-
 
501
		strcpy(o_bufpointer, bufpointer);
-
 
502
	} else {
-
 
503
		strcpy(bufpointer, o_bufpointer);
-
 
504
	}
-
 
505
	//debugval("cur_encoding    ", cur_encoding);
-
 
506
	//debugval("set_new_encoding", set_new_encoding);
-
 
507
	cur_encoding = set_new_encoding;
501
		cur_encoding = set_new_encoding;
508
	bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);
502
		bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);		
509
}
503
	}
-
 
504
}
510
//============================================================================================
505
//============================================================================================
511
void TWebBrowser::DrawScroller()
506
void TWebBrowser::DrawScroller()
512
{
507
{
513
	scroll_wv.max_area = list.count;
508
	scroll_wv.max_area = list.count;
514
	scroll_wv.cur_area = list.visible;
509
	scroll_wv.cur_area = list.visible;