WebView 1.83:

- hack to show all text on the page, even if Y>32000
- open urls with #tag in the end
- fix page open for some cases

git-svn-id: svn://kolibrios.org@7739 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-03-20 01:28:59 +00:00
parent e1d611df85
commit 0cee7aa77a
3 changed files with 43 additions and 18 deletions

View File

@ -1,5 +1,5 @@
//HTML Viewer in C--
//Copyright 2007-2019 by Veliant & Leency
//Copyright 2007-2020 by Veliant & Leency
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
#ifndef AUTOBUILD
@ -31,7 +31,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0};
char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.82";
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.83";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -46,7 +46,7 @@ char link_menu[] =
"Š®¯¨à®¢ âì áá뫪ã
ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
#else
char version[]="Text-based Browser 1.82";
char version[]="Text-based Browser 1.83";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>";
@ -426,6 +426,7 @@ void OpenPage()
SetPageDefaults();
if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
else {bufsize=0; ShowPage();} //page not found
DrawEditBoxWebView();
return;
}
@ -454,9 +455,9 @@ void OpenPage()
else
{
file_size stdcall (#URL);
bufsize = EBX;
if (bufsize)
if (EBX)
{
bufsize = EBX;
free(bufpointer);
bufpointer = malloc(bufsize);
SetPageDefaults();
@ -509,8 +510,9 @@ void DrawProgress()
}
char anchor[256];
void ClickLink()
char anchor[256];
int anchor_pos;
{
if (http.transfer > 0)
{
@ -537,10 +539,17 @@ void ClickLink()
return;
}
//liner.ru#1
if (strrchr(#URL, '#')!=0)
else if (strrchr(#URL, '#')!=0)
{
strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
URL[strrchr(#URL, '#')-1] = 0x00;
anchor_pos = strrchr(#URL, '#')-1;
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor));
URL[anchor_pos] = 0x00;
OpenPage();
strcat(#editURL, #anchor);
DrawEditBoxWebView();
if (anchors.get_anchor_pos(#anchor+1)!=-1) WB1.list.first = anchors.get_anchor_pos(#anchor+1);
WB1.DrawPage();
return;
}
if (!strncmp(#URL,"mailto:", 7))

View File

@ -7,16 +7,16 @@ ShowHistory()
free(history_pointer);
history_pointer = malloc(history.items.data_size+256);
strcat(history_pointer, "<html><head><title>History</title></head><body><h1>History</h1>");
strcat(history_pointer, "<h2>Visited pages</h2><blockquote><br>");
strcat(history_pointer, "<br><b>Visited pages</b><br>");
for (i=0; i<history.items.count; i++)
{
strcat(history_pointer, " <a href='");
strcat(history_pointer, "&nbsp; <a href='");
strcat(history_pointer, history.items.get(i));
strcat(history_pointer, "'>");
strcat(history_pointer, history.items.get(i));
strcat(history_pointer, "</a><br>");
}
strcat(history_pointer, "</blockquote><h2>Cached images</h2>");
strcat(history_pointer, "<br><b>Cached images</b>");
for (i=1; i<ImgCache.pics_count; i++)
{
strcat(history_pointer, "<img src='");

View File

@ -65,15 +65,31 @@ void DrawBufer::DrawBar(dword x, y, w, h, color)
}
}
void DrawBuf_WriteText(dword x, y, byte fontType, dword color, str_offset)
{
EDI = buf_data;
WriteText(x, y, fontType, color, str_offset);
}
void DrawBufer::WriteText(dword x, y, byte fontType, dword color, str_offset)
{
#define BUGFIX_32000 32000
int ydiv=0;
dword reserve_data_1, reserve_data_2;
dword new_buf_offset;
if (y + 30 >= bufh) IncreaseBufSize();
DrawBuf_WriteText(x, y, fontType, color, str_offset);
if (y < BUGFIX_32000) {
WriteBufText(x, y, fontType, color, str_offset, buf_data);
}
else {
ydiv = y / BUGFIX_32000 * BUGFIX_32000;
y -= ydiv;
new_buf_offset = ydiv * bufw * 4 + buf_data;
reserve_data_1 = ESDWORD[new_buf_offset];
reserve_data_2 = ESDWORD[new_buf_offset+4];
ESDWORD[new_buf_offset] = bufw;
ESDWORD[new_buf_offset+4] = bufh - y;
WriteBufText(x, y, fontType, color, str_offset, new_buf_offset);
ESDWORD[new_buf_offset] = reserve_data_1;
ESDWORD[new_buf_offset+4] = reserve_data_2;
}
}
void DrawBufer::PutPixel(dword x, y, color)