mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-24 17:59:38 +03:00
WebView 1.0 Beta 5.5: View Source fixes & optimizations (thanks 0CodErr)
git-svn-id: svn://kolibrios.org@4725 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fe79d0bc25
commit
caaecffc19
@ -169,9 +169,8 @@ void TWebBrowser::Parse(){
|
||||
case '\9':
|
||||
if (pre_text) //èíà÷å èä¸ì íà 0x0d
|
||||
{
|
||||
tab_len=strlen(#line)/8;
|
||||
tab_len=tab_len*8;
|
||||
tab_len=8+tab_len-strlen(#line);
|
||||
tab_len = strlen(#line) % 4;
|
||||
if (!tab_len) tab_len = 4;
|
||||
for (j=0; j<tab_len; j++;) chrcat(#line,' ');
|
||||
break;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
char homepage[] = FROM "html\homepage.htm";
|
||||
|
||||
#ifdef LANG_RUS
|
||||
char version[]=" ’¥ªáâ®¢ë© ¡à 㧥à 1.0 Beta 5";
|
||||
char version[]=" ’¥ªáâ®¢ë© ¡à 㧥à 1.0 Beta 5.5";
|
||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||
@ -210,6 +210,11 @@ void main()
|
||||
break;
|
||||
case evReDraw:
|
||||
if (action_buf) Scan(action_buf);
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,col_bg,0,0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window>2) { DrawTitle(#header); return; }
|
||||
if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
|
||||
if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
|
||||
Draw_Window();
|
||||
break;
|
||||
|
||||
@ -293,11 +298,6 @@ void SetElementSizes()
|
||||
void Draw_Window()
|
||||
{
|
||||
int img_off;
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,col_bg,0,0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window>2) { DrawTitle(#header); return; }
|
||||
if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
|
||||
if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
|
||||
// tab {
|
||||
if (TAB_H)
|
||||
{
|
||||
@ -389,6 +389,7 @@ void Scan(int id)
|
||||
OpenPage();
|
||||
return;
|
||||
case 052: //F3
|
||||
WB1.list.first = 0;
|
||||
ShowSource();
|
||||
WB1.Parse();
|
||||
break;
|
||||
|
@ -8,45 +8,49 @@ dword ShowSource()
|
||||
|
||||
if (souce_mode) return;
|
||||
souce_mode = true;
|
||||
new_buf_start = new_buf = malloc(bufsize*5);
|
||||
strcat(new_buf, "<pre>");
|
||||
new_buf = malloc(bufsize*5);
|
||||
new_buf_start = new_buf;
|
||||
strcpy(new_buf, "<html><head><title>");
|
||||
if (strlen(#header)-strlen(#version)>0) header[strlen(#header)-strlen(#version)-2] = 0; else strcpy(#header, "Source");
|
||||
strcat(new_buf, #header);
|
||||
strcat(new_buf, "</title><body><pre>");
|
||||
new_buf += strlen(new_buf);
|
||||
for (i=bufpointer; i<bufpointer+bufsize; i++)
|
||||
{
|
||||
ww = ESBYTE[i];
|
||||
new_buf++;
|
||||
switch (ww)
|
||||
{
|
||||
case '<':
|
||||
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-')
|
||||
{
|
||||
strcat(new_buf, "<font color=#ccc><");
|
||||
new_buf+=20;
|
||||
strcpy(new_buf, "<font color=#ccc><");
|
||||
new_buf+=21;
|
||||
mode = COMMENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(new_buf, "<font color=#00f><");
|
||||
new_buf+=20;
|
||||
strcpy(new_buf, "<font color=#00f><");
|
||||
new_buf+=21;
|
||||
mode = TAG;
|
||||
}
|
||||
break;
|
||||
case '>':
|
||||
if (mode == OPTION_VALUE) //fix non-closed quote in TAG
|
||||
{
|
||||
strcat(new_buf, ""</font>");
|
||||
new_buf+=12;
|
||||
strcpy(new_buf, ""</font>");
|
||||
new_buf+=13;
|
||||
mode = TAG;
|
||||
}
|
||||
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
|
||||
{
|
||||
strcat(new_buf, "></font>");
|
||||
new_buf+=10;
|
||||
strcpy(new_buf, "></font>");
|
||||
new_buf+=11;
|
||||
mode = TEXT;
|
||||
}
|
||||
if (mode == TAG)
|
||||
{
|
||||
strcat(new_buf, "></font>");
|
||||
new_buf+=10;
|
||||
strcpy(new_buf, "></font>");
|
||||
new_buf+=11;
|
||||
mode = TEXT;
|
||||
}
|
||||
break;
|
||||
@ -54,23 +58,25 @@ dword ShowSource()
|
||||
case '\'':
|
||||
if (mode == TAG)
|
||||
{
|
||||
strcat(new_buf, "<font color=#f0f>"");
|
||||
strcpy(new_buf, "<font color=#f0f>'");
|
||||
new_buf+=22;
|
||||
mode = OPTION_VALUE;
|
||||
break;
|
||||
}
|
||||
if (mode == OPTION_VALUE)
|
||||
{
|
||||
strcat(new_buf, ""</font>");
|
||||
strcpy(new_buf, "'</font>");
|
||||
new_buf+=12;
|
||||
mode = TAG;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
chrcat(new_buf, ww);
|
||||
ESBYTE[new_buf] = ww;
|
||||
new_buf++;
|
||||
}
|
||||
}
|
||||
bufsize = new_buf;
|
||||
ESBYTE[new_buf] = 0;
|
||||
bufsize = new_buf - new_buf_start;
|
||||
free(bufpointer);
|
||||
bufpointer = new_buf_start;
|
||||
}
|
Loading…
Reference in New Issue
Block a user