diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 125a121454..6c2080fef5 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -224,8 +224,8 @@ void TWebBrowser::Prepare(){ } DrawStyle(); NewLine(); - DrawPage(); if (list.first == 0) list.count = stroka; + DrawPage(); if (anchor) { anchor=NULL; diff --git a/programs/cmm/TWB/links.h b/programs/cmm/TWB/links.h index dbbf6ccff3..e7dbbf014a 100644 --- a/programs/cmm/TWB/links.h +++ b/programs/cmm/TWB/links.h @@ -1,9 +1,12 @@ CustomCursor CursorPointer; dword CursorFile = FROM "../TWB/pointer.cur"; +#include "..\lib\collection.h" #define NOLINE 0 #define UNDERLINE 1 +#define MAXLINKS 400 + struct array_link { dword link, text; int x,y,w,h; @@ -11,8 +14,8 @@ struct array_link { }; struct LinksArray { - array_link links[400]; - char page_links[64000]; + array_link links[MAXLINKS]; + collection page_links; dword buflen; int count, active; void Hover(); @@ -24,25 +27,24 @@ struct LinksArray { void LinksArray::AddLink(dword lpath, int link_x, link_y) { + if (count>= MAXLINKS) return; links[count].x = link_x; links[count].y = link_y; - links[count].link = buflen; - strcpy(buflen, lpath); - buflen += strlen(lpath)+1; + page_links.add(lpath); + links[count].link = page_links.get(page_links.count-1); count++; } 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].h = link_h; links[count-1].underline = link_underline; - links[count-1].text = buflen; - strcpy(buflen, new_text); - buflen += strlen(new_text)+1; + page_links.add(new_text); + links[count-1].text = page_links.get(page_links.count-1); } dword LinksArray::GetURL(int id) @@ -52,9 +54,8 @@ dword LinksArray::GetURL(int id) void LinksArray::Clear() { - int i; - for (i=0; i<=count; i++) DeleteButton(i+400); - buflen = #page_links; + page_links.drop(); + page_links.realloc_size = 4096 * 32; count = 0; active = -1; CursorPointer.Restore(); diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 70d46b1ad7..1ac9f5e331 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -8,7 +8,7 @@ #endif //libraries -#define MEMSIZE 4096 * 256 +#define MEMSIZE 4096 * 200 #include "..\lib\gui.h" #include "..\lib\draw_buf.h" #include "..\lib\list_box.h" @@ -30,7 +30,7 @@ char homepage[] = FROM "html\\homepage.htm""\0"; #ifdef LANG_RUS -char version[]="Текстовый браузер 1.53"; +char version[]="Текстовый браузер 1.55"; ?define IMAGES_CACHE_CLEARED "Кэш картинок очищен" ?define T_LAST_SLIDE "Это последний слайд" char loading[] = "Загрузка страницы...
"; @@ -43,7 +43,7 @@ char rmb_menu[] = Очистить кэш картинок Менеджер загрузок"; #else -char version[]="Text-based Browser 1.53"; +char version[]="Text-based Browser 1.55"; ?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define T_LAST_SLIDE "This slide is the last" char loading[] = "Loading...
"; @@ -212,10 +212,11 @@ void main() $stosb; } while (AL != 0) && (AL != 13) && (AL != 10); DSBYTE[EDI-1]='\0'; - if (!strcmp(#URL,"https://")) + if (!strncmp(#URL,"https://",8)) { notify("HTTPS protocol is not supported yet"); - StopLoading(); + StopLoading(); + break; } } } @@ -403,7 +404,8 @@ void SetPageDefaults() cur_encoding = CH_NULL; if (o_bufpointer) o_bufpointer = free(o_bufpointer); anchor_line_num=WB1.list.first; - anchor[0]='|'; + //anchor[0]='|'; + anchor=NULL; } void OpenPage() diff --git a/programs/cmm/browser/download_manager.h b/programs/cmm/browser/download_manager.h index f9e99c5207..be153bb59e 100644 --- a/programs/cmm/browser/download_manager.h +++ b/programs/cmm/browser/download_manager.h @@ -38,6 +38,8 @@ void Downloader() downloader_opened = 1; SetEventMask(0x27); + filepath[0] = NULL; + downloader.Stop(); if (downloader_edit[0]) StartDownloading(); else strcpy(#downloader_edit, "http://"); 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==302) StopDownloading(); 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() diff --git a/programs/cmm/lib/collection.h b/programs/cmm/lib/collection.h index be6da96313..c786a3588b 100644 --- a/programs/cmm/lib/collection.h +++ b/programs/cmm/lib/collection.h @@ -63,7 +63,7 @@ void collection::drop() { = = ========================================================*/ -struct collection_int +:struct collection_int { int count; dword element[4096*3]; @@ -72,19 +72,19 @@ struct collection_int void drop(); }; -int collection_int::add(dword in) { +:int collection_int::add(dword in) { if (count >= 4096*3) return 0; element[count] = in; count++; return 1; } -dword collection_int::get(dword pos) { +:dword collection_int::get(dword pos) { if (pos<0) || (pos>=count) return 0; return element[pos]; } -void collection_int::drop() { +:void collection_int::drop() { element[0] = count = 0; } diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index f3bd13873a..fc9c974298 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -518,10 +518,10 @@ inline fastcall dword GetStartTime() :struct obj { 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; y=_y;