Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5703 → Rev 5704

/programs/cmm/TWB/TWB.c
26,8 → 26,6
link, ignor_text, cur_encoding, text_align, t_html, t_body;
byte condition_text_active, condition_text_val, condition_href, condition_max;
 
enum { _WIN, _DOS, _KOI, _UTF, _DEFAULT };
 
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
 
dword text_colors[300];
100,24 → 98,6
//=======================================================================
 
 
void BufEncode(int set_new_encoding)
{
int bufpointer_realsize;
cur_encoding = set_new_encoding;
if (o_bufpointer==0)
{
o_bufpointer = malloc(bufsize);
strcpy(o_bufpointer, bufpointer);
}
else
{
strcpy(bufpointer, o_bufpointer);
}
if (set_new_encoding==_WIN) bufpointer = ChangeCharset("CP1251", "CP866", bufpointer);
if (set_new_encoding==_UTF) bufpointer = ChangeCharset("UTF-8", "CP866", bufpointer);
if (set_new_encoding==_KOI) bufpointer = ChangeCharset("KOI8-RU", "CP866", bufpointer);
}
 
void TWebBrowser::Prepare(dword bufpos, in_filesize){
bufsize = in_filesize;
bufpointer = bufpos;
155,7 → 135,6
{
pre_text=0;
if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1;
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
}
for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;)
183,19 → 162,7
break;
}
goto DEFAULT_MARK;
case '=': //quoted printable
if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
 
temp[0] = ESBYTE[bufpos+1];
temp[1] = ESBYTE[bufpos+2];
temp[2] = '\0';
if (bukva = Hex2Symb(#temp))
{
bufpos+=2;
goto DEFAULT_MARK;
}
break;
case '&': //&nbsp; and so on
bufpos++;
tag=0;
313,7 → 280,6
if (isTag("html"))
{
IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (opened==0) ignor_text = 1; ELSE ignor_text = 0;
t_html = opened;
return;
}
362,10 → 328,10
DrawBuf.Fill(bg_color);
}
} while(GetNextParam());
if (opened) && (cur_encoding==_DEFAULT)
if (opened) && (cur_encoding==CH_NULL)
{
debugln("Document has no information about encoding, UTF will be used");
BufEncode(_UTF);
//BufEncode(CH_UTF8);
}
return;
}
594,12 → 560,14
{
strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content=
strlwr(#options);
meta_encoding = _DEFAULT;
if (!strcmp(#options, "utf-8")) || (!strcmp(#options,"utf8")) meta_encoding = _UTF;
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) meta_encoding = _KOI;
if (!strcmp(#options, "windows-1251")) || (!strcmp(#options, "windows1251")) meta_encoding = _WIN;
if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) meta_encoding = _DOS;
if (cur_encoding==_DEFAULT) BufEncode(meta_encoding);
meta_encoding = CH_NULL;
if (!strcmp(#options, "utf-8")) || (!strcmp(#options,"utf8")) meta_encoding = CH_UTF8;
else if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) meta_encoding = CH_KOI8;
else if (!strcmp(#options, "windows-1251")) || (!strcmp(#options, "windows1251")) meta_encoding = CH_CP1251;
else if (!strcmp(#options, "windows-1252")) || (!strcmp(#options, "windows1252")) meta_encoding = CH_CP1252;
else if (!strcmp(#options, "iso-8859-5")) || (!strcmp(#options, "iso8859-5")) meta_encoding = CH_ISO8859_5;
else if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) meta_encoding = CH_CP866;
if (cur_encoding==CH_NULL) BufEncode(meta_encoding);
return;
}
} while(GetNextParam());
607,6 → 575,24
}
}
 
void BufEncode(int set_new_encoding)
{
int bufpointer_realsize;
cur_encoding = set_new_encoding;
if (o_bufpointer==0)
{
o_bufpointer = malloc(bufsize);
strcpy(o_bufpointer, bufpointer);
}
else
{
strcpy(bufpointer, o_bufpointer);
}
debugln(charsets[set_new_encoding]);
bufpointer = ChangeCharset(charsets[set_new_encoding], "CP866", bufpointer);
}
 
 
void TWebBrowser::DrawScroller()
{
scroll_wv.max_area = list.count;
652,20 → 638,3
if (!strcmp(#tag,text)) return 1; else return 0;
}
 
 
:dword Hex2Symb(char* htmlcolor)
{
dword j=0, symbol=0;
char ch=0x00;
for (;j<2;j++)
{
ch=ESBYTE[htmlcolor+j];
if (ch==0x0d) || (ch=='\9') RETURN 0;
if ((ch>='0') && (ch<='9')) ch -= '0';
if ((ch>='A') && (ch<='F')) ch -= 'A'-10;
if ((ch>='a') && (ch<='f')) ch -= 'a'-10;
symbol = symbol*0x10 + ch;
}
AL=symbol;
}
 
/programs/cmm/TWB/acid_0.1.htm
5,9 → 5,9
<title>Òåñò Acid 0.1</title>
</head>
<body bgcolor="#000000" link="#0066FF" text="#FFFFFF">
<h1 align=center>Ýòî òåñòîâàÿ ñòðàíèöà äëÿ ïðîâåðêè HTML Viewer</h1>
<h1 align=center>Ýòî òåñòîâàÿ ñòðàíèöà äëÿ ïðîâåðêè WebViewer</h1>
<br />
<p>HTMLv ÿâëÿåòñÿ òåêñòîâûì áðàóçåðîì è ïîääåðæèâàåò âñå ïîïóëÿðíûå êîäèðîâêè (cp1251, koi-8, cp866, unicode)
<p>WebViewer ÿâëÿåòñÿ òåêñòîâûì áðàóçåðîì è ïîääåðæèâàåò âñå ïîïóëÿðíûå êîäèðîâêè (cp1251, koi-8, cp866, unicode)
è íåêîòîðûå òåãè. Ïîääåðæêà òàáëèèö (&lt;table&gt;), CSS, Javascript'a è Êîíòàêòèêà ïîêà íå ðåàëèçîâàíà :)
</p>
<br />
55,7 → 55,7
 
<br>
 
<a href="logo.png"><img id="2.1.4" src="logo.png" alt="logo"><br>Îòêðûòü</a><br>
<a href="http://kolibrios.org/i/logo.png"><img id="2.1.4" src="http://kolibrios.org/i/logo.png" alt="logo"><br>Îòêðûòü</a><br>
 
<br>
<br>
/programs/cmm/browser/WebView.c
333,12 → 333,6
}
 
 
void ChangeCharset1(byte new_charset)
{
BufEncode(new_charset);
WB1.Parse();
}
 
void Scan(int id)
{
action_buf=0;
350,32 → 344,30
switch (id)
{
case 011: //Ctrk+K
ChangeCharset1(_KOI);
BufEncode(CH_KOI8);
WB1.Parse();
return;
 
case 021: //Ctrl+U
ChangeCharset1(_UTF);
BufEncode(CH_UTF8);
WB1.Parse();
return;
 
case 004: //Ctrl+D
ChangeCharset1(_DOS);
BufEncode(CH_CP866);
WB1.Parse();
return;
 
case 005: //Win encoding
ChangeCharset1(_WIN);
BufEncode(CH_CP1251);
WB1.Parse();
return;
 
case 009: //free img cache
ImgCache.Free();
notify(IMAGES_CACHE_CLEARED);
WB1.Parse();
return;
 
case 003: //history
strcpy(#URL, URL_SERVICE_HISTORY);
OpenPage();
return;
 
case 006: //download manager
if (!downloader_opened) {
strncpy(#DL_URL, "http://",7);
382,7 → 374,6
CreateThread(#Downloader,#downloader_stak+4092);
}
return;
 
case ASCII_KEY_BS:
case BACK:
if (!BrowserHistory.GoBack()) return;
576,7 → 567,7
pre_text = 0;
WB1.list.count = WB1.list.first = 0;
stroka = 0;
cur_encoding = _DEFAULT;
cur_encoding = CH_NULL;
if (o_bufpointer) o_bufpointer = free(o_bufpointer);
anchor_line_num=WB1.list.first;
anchor[0]='|';
/programs/cmm/browser/menu_rmb.h
80,10 → 80,10
}
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
}
if (cur_encoding!=_DEFAULT)
if (cur_encoding!=CH_NULL)
WriteText(5, cur_encoding*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
else
WriteText(5, _DOS*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
WriteText(5, CH_CP866*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
 
if (WB1.DrawBuf.zoom == 2) DrawBar(6, 4*menu.line_h+8, 6, 6, 0x777777);
}
/programs/cmm/lib/obj/iconv.h
57,16 → 57,8
}
 
 
:int cur_charset;
:char *charsets[] = { " ", "UTF-8", "KOI8-RU", "CP1251", "CP1252", "ISO8859-5", "CP866"};
:int cur_charset;
enum {
CH_NULL,
CH_UTF8,
CH_KOI8,
CH_CP1251,
CH_CP1252,
CH_ISO8859_5,
CH_CP866
};
enum { CH_NULL, CH_UTF8, CH_KOI8, CH_CP1251, CH_CP1252, CH_ISO8859_5, CH_CP866 };
 
#endif