WebView 1.55: fixed about 4 bugs, twice faster; this is really good version

git-svn-id: svn://kolibrios.org@6738 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-11-22 14:04:10 +00:00
parent f26b88fc9a
commit 04cd34689f
6 changed files with 31 additions and 26 deletions

View File

@ -224,8 +224,8 @@ void TWebBrowser::Prepare(){
} }
DrawStyle(); DrawStyle();
NewLine(); NewLine();
DrawPage();
if (list.first == 0) list.count = stroka; if (list.first == 0) list.count = stroka;
DrawPage();
if (anchor) if (anchor)
{ {
anchor=NULL; anchor=NULL;

View File

@ -1,9 +1,12 @@
CustomCursor CursorPointer; CustomCursor CursorPointer;
dword CursorFile = FROM "../TWB/pointer.cur"; dword CursorFile = FROM "../TWB/pointer.cur";
#include "..\lib\collection.h"
#define NOLINE 0 #define NOLINE 0
#define UNDERLINE 1 #define UNDERLINE 1
#define MAXLINKS 400
struct array_link { struct array_link {
dword link, text; dword link, text;
int x,y,w,h; int x,y,w,h;
@ -11,8 +14,8 @@ struct array_link {
}; };
struct LinksArray { struct LinksArray {
array_link links[400]; array_link links[MAXLINKS];
char page_links[64000]; collection page_links;
dword buflen; dword buflen;
int count, active; int count, active;
void Hover(); void Hover();
@ -24,25 +27,24 @@ struct LinksArray {
void LinksArray::AddLink(dword lpath, int link_x, link_y) void LinksArray::AddLink(dword lpath, int link_x, link_y)
{ {
if (count>= MAXLINKS) return;
links[count].x = link_x; links[count].x = link_x;
links[count].y = link_y; links[count].y = link_y;
links[count].link = buflen; page_links.add(lpath);
strcpy(buflen, lpath); links[count].link = page_links.get(page_links.count-1);
buflen += strlen(lpath)+1;
count++; count++;
} }
void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline) void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline)
{ {
if (count<1) return; if (count>= MAXLINKS) || (!count) return;
links[count-1].w = link_w; links[count-1].w = link_w;
links[count-1].h = link_h; links[count-1].h = link_h;
links[count-1].underline = link_underline; links[count-1].underline = link_underline;
links[count-1].text = buflen; page_links.add(new_text);
strcpy(buflen, new_text); links[count-1].text = page_links.get(page_links.count-1);
buflen += strlen(new_text)+1;
} }
dword LinksArray::GetURL(int id) dword LinksArray::GetURL(int id)
@ -52,9 +54,8 @@ dword LinksArray::GetURL(int id)
void LinksArray::Clear() void LinksArray::Clear()
{ {
int i; page_links.drop();
for (i=0; i<=count; i++) DeleteButton(i+400); page_links.realloc_size = 4096 * 32;
buflen = #page_links;
count = 0; count = 0;
active = -1; active = -1;
CursorPointer.Restore(); CursorPointer.Restore();

View File

@ -8,7 +8,7 @@
#endif #endif
//libraries //libraries
#define MEMSIZE 4096 * 256 #define MEMSIZE 4096 * 200
#include "..\lib\gui.h" #include "..\lib\gui.h"
#include "..\lib\draw_buf.h" #include "..\lib\draw_buf.h"
#include "..\lib\list_box.h" #include "..\lib\list_box.h"
@ -30,7 +30,7 @@
char homepage[] = FROM "html\\homepage.htm""\0"; char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.53"; char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.55";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -43,7 +43,7 @@ char rmb_menu[] =
Žç¨áâ¨âì ªíè ª à⨭®ª Žç¨áâ¨âì ªíè ª à⨭®ª
Œ¥­¥¤¦¥à § £à㧮ª"; Œ¥­¥¤¦¥à § £à㧮ª";
#else #else
char version[]="Text-based Browser 1.53"; char version[]="Text-based Browser 1.55";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -212,10 +212,11 @@ void main()
$stosb; $stosb;
} while (AL != 0) && (AL != 13) && (AL != 10); } while (AL != 0) && (AL != 13) && (AL != 10);
DSBYTE[EDI-1]='\0'; DSBYTE[EDI-1]='\0';
if (!strcmp(#URL,"https://")) if (!strncmp(#URL,"https://",8))
{ {
notify("HTTPS protocol is not supported yet"); notify("HTTPS protocol is not supported yet");
StopLoading(); StopLoading();
break;
} }
} }
} }
@ -403,7 +404,8 @@ void SetPageDefaults()
cur_encoding = CH_NULL; cur_encoding = CH_NULL;
if (o_bufpointer) o_bufpointer = free(o_bufpointer); if (o_bufpointer) o_bufpointer = free(o_bufpointer);
anchor_line_num=WB1.list.first; anchor_line_num=WB1.list.first;
anchor[0]='|'; //anchor[0]='|';
anchor=NULL;
} }
void OpenPage() void OpenPage()

View File

@ -38,6 +38,8 @@ void Downloader()
downloader_opened = 1; downloader_opened = 1;
SetEventMask(0x27); SetEventMask(0x27);
filepath[0] = NULL;
downloader.Stop(); downloader.Stop();
if (downloader_edit[0]) StartDownloading(); else strcpy(#downloader_edit, "http://"); if (downloader_edit[0]) StartDownloading(); else strcpy(#downloader_edit, "http://");
ed.size = ed.pos = ed.shift = ed.shift_old = strlen(#downloader_edit); ed.size = ed.pos = ed.shift = ed.shift_old = strlen(#downloader_edit);
@ -116,7 +118,7 @@ void Key_Scan(int id)
if (id==301) && (downloader.http_transfer <= 0) StartDownloading(); if (id==301) && (downloader.http_transfer <= 0) StartDownloading();
if (id==302) StopDownloading(); if (id==302) StopDownloading();
if (id==305) RunProgram("/sys/File managers/Eolite", #save_to); if (id==305) RunProgram("/sys/File managers/Eolite", #save_to);
if (id==306) RunProgram("@open", #filepath); if (id==306) RunProgram("/sys/@open", #filepath);
} }
void DL_Draw_Window() void DL_Draw_Window()

View File

@ -63,7 +63,7 @@ void collection::drop() {
= = = =
========================================================*/ ========================================================*/
struct collection_int :struct collection_int
{ {
int count; int count;
dword element[4096*3]; dword element[4096*3];
@ -72,19 +72,19 @@ struct collection_int
void drop(); void drop();
}; };
int collection_int::add(dword in) { :int collection_int::add(dword in) {
if (count >= 4096*3) return 0; if (count >= 4096*3) return 0;
element[count] = in; element[count] = in;
count++; count++;
return 1; return 1;
} }
dword collection_int::get(dword pos) { :dword collection_int::get(dword pos) {
if (pos<0) || (pos>=count) return 0; if (pos<0) || (pos>=count) return 0;
return element[pos]; return element[pos];
} }
void collection_int::drop() { :void collection_int::drop() {
element[0] = element[0] =
count = 0; count = 0;
} }

View File

@ -518,10 +518,10 @@ inline fastcall dword GetStartTime()
:struct obj :struct obj
{ {
dword x,y,w,h; dword x,y,w,h;
void size(); void set_size();
}; };
:void obj::size(dword _x, _y, _w, _h) :void obj::set_size(dword _x, _y, _w, _h)
{ {
x=_x; x=_x;
y=_y; y=_y;