From 1db99aa26a124d3a5ecf68300ef7bfdde9c6de26 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 29 Jan 2014 00:14:09 +0000 Subject: [PATCH] HTMLv: History or URLs & cached images (available from menu), Page not found custom git-svn-id: svn://kolibrios.org@4544 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 2 +- programs/cmm/TWB/history.h | 72 +++++++++++++-------------- programs/cmm/TWB/img_cache.h | 6 +-- programs/cmm/appearance/appearance.c | 2 +- programs/cmm/browser/HTMLv.c | 73 +++++++++++++++++++--------- programs/cmm/browser/History.txt | 12 ++++- programs/cmm/browser/menu_rmb.h | 2 + 7 files changed, 103 insertions(+), 66 deletions(-) diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 71b3e14d7f..c995cff8ef 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -632,7 +632,7 @@ void TWebBrowser::TextGoDown(int left1, top1, width1) DrawBuf.Fill(bg_color); } stroka++; - if (blq_text) stolbec = 8; else stolbec = 0; + if (blq_text) stolbec = 6; else stolbec = 0; if (li_text) stolbec = li_tab * 5; } diff --git a/programs/cmm/TWB/history.h b/programs/cmm/TWB/history.h index e8620ccaf2..aa23cde5eb 100644 --- a/programs/cmm/TWB/history.h +++ b/programs/cmm/TWB/history.h @@ -1,59 +1,59 @@ -struct UrlsHistory { - dword CurrentUrl(); - void AddUrl(); - byte GoBack(); - byte GoForward(); -}; - -UrlsHistory BrowserHistory; - struct path_string { char Item[4096]; }; #define MAX_HISTORY_NUM 40 path_string history_list[MAX_HISTORY_NUM]; -int history_num; -int history_current; -dword UrlsHistory::CurrentUrl() -{ - return #history_list[history_current].Item; +struct UrlsHistory { + int links_count; + int current; + dword CurrentUrl(); + dword GetUrl(); + void AddUrl(); + byte GoBack(); + byte GoForward(); +}; + +dword UrlsHistory::CurrentUrl() { + return #history_list[current].Item; } -void UrlsHistory::AddUrl() //ЄєЄ эєцхэ ттюфшь√щ ¤ыхьхэЄ - фы  єэштхЁёры№эюёЄш -{ - int i; - if (history_num>0) && (!strcmp(#URL,#history_list[history_current].Item)) return; +dword UrlsHistory::GetUrl(int id) { + return #history_list[id].Item; +} - if (history_current>=MAX_HISTORY_NUM-1) +void UrlsHistory::AddUrl() { + int i; + if (links_count>0) && (!strcmp(#URL,#history_list[current].Item)) return; + + if (current>=MAX_HISTORY_NUM-1) { - history_current/=2; - for (i=0; i= WB1.list.count) return; WB1.list.first++; WB1.ParseHTML(bufpointer); @@ -378,8 +382,7 @@ void Scan(int id) void ProcessLinks(int id) { - strcpy(#URL, PageLinks.GetURL(id-401)); - + strcpy(#URL, PageLinks.GetURL(id-401)); //$1 - Condition Script if (URL[0] == '$') { @@ -460,28 +463,21 @@ void ShowPage() address_box.offset=0; edit_box_draw stdcall(#address_box); + if (strcmp(#URL, URL_HISTORY)==0) ShowHistory(); else if (!bufsize) { PageLinks.Clear(); if (GetProcessSlot(downloader_id)<>0) { - bufsize = sizeof(loading); - WB1.ParseHTML(#loading); + bufsize = sizeof(loading); + WB1.ParseHTML(#loading); } else { - if (strncmp(#URL,"http:",5)==0) - { - bufsize = sizeof(page_not_found_no_internet); - WB1.ParseHTML(#page_not_found_no_internet); - } - else - { - bufsize = sizeof(page_not_found); - WB1.ParseHTML(#page_not_found); - } + bufsize = sizeof(page_not_found); + WB1.ParseHTML(#page_not_found); } - //return; + bufsize = 0; } else WB1.ParseHTML(bufpointer); @@ -490,5 +486,34 @@ void ShowPage() if (!strcmp(#version, #header)) DrawTitle(#header); } +ShowHistory() +{ + int i; + static int history_pointer; + + free(history_pointer); + history_pointer = malloc(64000); + strcat(history_pointer, "

History

"); + strcat(history_pointer, "

Visited pages


"); + for (i=1; i"); + strcat(history_pointer, BrowserHistory.GetUrl(i)); + strcat(history_pointer, "
"); + } + strcat(history_pointer, "

Cached images


"); + for (i=1; i
"); + } + bufsize = strlen(history_pointer); + bufpointer = history_pointer; + WB1.ParseHTML(history_pointer); +} + stop: diff --git a/programs/cmm/browser/History.txt b/programs/cmm/browser/History.txt index 2ba92a7a4f..cc945ef06d 100644 --- a/programs/cmm/browser/History.txt +++ b/programs/cmm/browser/History.txt @@ -1,4 +1,14 @@ -15.10.13 - 0.99.08 +20.11.2013 - 0.99.6 +- яхЁхфхырэ√ ёё√ыъш, ъєЁёюЁ яЁхтЁр∙рхЄё  т Ёєъє яЁш эртхфхэшш + +29.12.2013 - 0.99.5 +- Condition Script + +27.12.2013 - 0.99.4 +- юЄфхыхэшх TWB ъюьяюэхэЄр юЄ сЁрєчхЁр + +15.10.13 - 0.99.1 +- яюффхЁцър Єхуют
, ш ярЁрьхЄЁр align="center/right" фы  Єхуют h1..h4 - єыєў°хээюх ьхэ■ - ьєы№Єш ч√ўэюёЄ№ diff --git a/programs/cmm/browser/menu_rmb.h b/programs/cmm/browser/menu_rmb.h index 16fe4f52a1..bb17b26fc6 100644 --- a/programs/cmm/browser/menu_rmb.h +++ b/programs/cmm/browser/menu_rmb.h @@ -8,9 +8,11 @@ char *ITEMS_LIST[]={ #ifdef LANG_RUS "Исходник страницы F3",52, "Очистить кэш картинок" ,02, +"История" ,08, #else "View source F3",52, "Free image cache" ,09, +"History" ,08, #endif 0};