diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 6b416a573c..25c093b5c1 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -400,7 +400,15 @@ void TWebBrowser::SetStyle() { if (tag.is("button")) { style.button = tag.opened; stolbec++; return; } if (tag.is("u")) || (tag.is("ins")) { style.u=tag.opened; return;} if (tag.is("s")) || (tag.is("strike")) || (tag.is("del")) { style.s=tag.opened; return; } - //if (tag.is("dd")) { stolbec += 5; return; } //stolbec overflow! + if (tag.is("dl")) { + if (tag.opened) NewLine(); + return; + } + if (tag.is("dd")) { + //NewLine(); + //if (tag.opened) stolbec += 5; //stolbec overflow! + return; + } if (tag.is("blockquote")) { style.blq = tag.opened; return; } if (tag.is("code")) { if (tag.opened) style.bg_color = 0xe4ffcb; else style.bg_color = page_bg; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 7e1c173628..0f53bab2e3 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -36,6 +36,7 @@ _history history; bool debug_mode = false; #include "..\TWB\TWB.c" //HTML Parser, a core component #include "texts.h" +#include "cache.h" TWebBrowser WB1; @@ -117,7 +118,7 @@ void main() int i, btn, redirect_count=0; LoadLibraries(); CreateDir("/tmp0/1/Downloads"); - CreateDir("/tmp0/1/WebView_Cache"); + //CreateDir("/tmp0/1/WebView_Cache"); Libimg_LoadImage(#skin, "/sys/toolbar.png"); HandleParam(); skin.h = 26; @@ -231,6 +232,7 @@ void main() // Loading the page is complete, free resources redirect_count = 0; http.free(); + pages_cache.add(history.current(), http.content_pointer, http.content_received); LoadInternalPage(http.content_pointer, http.content_received); } } @@ -450,15 +452,17 @@ void OpenPage(dword _open_URL) history.add(#new_url); - //if (pages_cache.have(#new_url)) { - // LoadInternalPage(pages_cache.current_page_buf, pages_cache.pages_cache.current_page_size); - //} else - if (!strncmp(#new_url,"WebView:",8)) { + if (pages_cache.has(#new_url)) { + //CACHED PAGE + LoadInternalPage(pages_cache.current_page_buf, pages_cache.current_page_size); + + } else if (!strncmp(#new_url,"WebView:",8)) { //INTERNAL PAGE if (!strcmp(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#homepage, sizeof(homepage)); else if (!strcmp(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help)); else if (!strcmp(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); else LoadInternalPage(#page_not_found, sizeof(page_not_found)); + } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { //WEB PAGE if (ReplaceSpaceInUrl(#new_url, URL_SIZE)) { diff --git a/programs/cmm/browser/cache.h b/programs/cmm/browser/cache.h new file mode 100644 index 0000000000..ffe27fff1a --- /dev/null +++ b/programs/cmm/browser/cache.h @@ -0,0 +1,34 @@ + +struct PAGES_CACHE +{ + dword current_page_buf; + dword current_page_size; + collection url; + collection data; //it has to be int + collection size; //it has to be int + void add(); + bool has(); +} pages_cache; + +void PAGES_CACHE::add(dword _url, _data, _size) +{ + dword data_pointer; + data_pointer = malloc(_size); + memmov(data_pointer, _data, _size); + data.add(itoa(data_pointer)); + + url.add(_url); + size.add(itoa(_size)); +} + +bool PAGES_CACHE::has(dword _link) +{ + int pos; + pos = url.get_pos_by_name(_link); + if (pos != -1) { + current_page_buf = atoi(data.get(pos)); + current_page_size = atoi(size.get(pos)); + return true; + } + return false; +} \ No newline at end of file diff --git a/programs/cmm/browser/texts.h b/programs/cmm/browser/texts.h index b681ba5b05..f2faaf36a4 100644 --- a/programs/cmm/browser/texts.h +++ b/programs/cmm/browser/texts.h @@ -1,4 +1,4 @@ -char version[]="WebView 2.15"; +char version[]="WebView 2.2"; #ifdef LANG_RUS char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; diff --git a/programs/cmm/lib/draw_buf.h b/programs/cmm/lib/draw_buf.h index 7afea06780..62064ca305 100644 --- a/programs/cmm/lib/draw_buf.h +++ b/programs/cmm/lib/draw_buf.h @@ -49,9 +49,8 @@ void DrawBufer::Fill(dword start_pointer, i_fill_color) { dword i; dword max_i = bufw * bufh * 4 + buf_data + 8; - EDI = fill_color = i_fill_color; - for (ESI=buf_data+start_pointer+8; ESI= bufh) IncreaseBufSize(); diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index 0aab99a995..833417d86c 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -917,6 +917,15 @@ inline signed strcoll(dword text1,text2) return 0; } +// void * memset( ptr, value, num ); +// fills the memory with a dword +// example: memset(str,'-', sizeof(str)); +inline void MEMSETD(EDI,ECX,EAX) +{ + $REP + $STOSD +} + :replace_char(dword in_str, char from_char, to_char, int length) { int i; for (i=0; i