From c455cae71eb766f38a28be6e226107ec04293444 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 16 Dec 2015 22:44:42 +0000 Subject: [PATCH] WebView: use /lib/patterts/history.h instead own realization git-svn-id: svn://kolibrios.org@5978 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 1 - programs/cmm/TWB/history.h | 65 ---------------------------------- programs/cmm/TWB/links.h | 4 +-- programs/cmm/browser/WebView.c | 33 +++++++++-------- programs/cmm/browser/history.h | 10 +++--- 5 files changed, 25 insertions(+), 88 deletions(-) delete mode 100644 programs/cmm/TWB/history.h diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 0a766eb8e4..d7d2e93fba 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -62,7 +62,6 @@ char attr[1200]; char val[4096]; char anchor[256]=0; -#include "..\TWB\history.h" #include "..\TWB\links.h" #include "..\TWB\colors.h" #include "..\TWB\unicode_tags.h" diff --git a/programs/cmm/TWB/history.h b/programs/cmm/TWB/history.h deleted file mode 100644 index f71399b741..0000000000 --- a/programs/cmm/TWB/history.h +++ /dev/null @@ -1,65 +0,0 @@ -struct path_string { - char Item[sizeof(URL)]; - int was_first; -}; - -#define MAX_HISTORY_NUM 40 -path_string history_list[MAX_HISTORY_NUM]; - -struct UrlsHistory { - int links_count; - int cur_y; - dword CurrentUrl(); - dword GetUrl(); - dword GetFirstLine(); - void AddUrl(); - byte GoBack(); - byte GoForward(); -} BrowserHistory; - -dword UrlsHistory::CurrentUrl() { - return #history_list[cur_y].Item; -} - -dword UrlsHistory::GetUrl(int id) { - return #history_list[id].Item; -} - -dword UrlsHistory::GetFirstLine(int id) { - return history_list[id].was_first; -} - -void UrlsHistory::AddUrl() { - int i; - if (links_count>0) && (!strcmp(#URL,#history_list[cur_y].Item)) return; - - if (cur_y>=MAX_HISTORY_NUM-1) - { - cur_y/=2; - for (i=0; i 0) { StopLoading(); - BrowserHistory.cur_y--; + History.back(); } strcpy(#URL, PageLinks.GetURL(PageLinks.active)); @@ -494,7 +499,7 @@ void ClickLink() if (URL[0] == '#') { strcpy(#anchor, #URL+strrchr(#URL, '#')); - strcpy(#URL, BrowserHistory.CurrentUrl()); + strcpy(#URL, History.current()); WB1.list.first=WB1.list.count-WB1.list.visible; ShowPage(); return; @@ -518,15 +523,15 @@ void ClickLink() CreateThread(#Downloader,#downloader_stak+4092); } else RunProgram("@open", #URL); - strcpy(#editURL, BrowserHistory.CurrentUrl()); - strcpy(#URL, BrowserHistory.CurrentUrl()); + strcpy(#editURL, History.current()); + strcpy(#URL, History.current()); return; } if (!strncmp(#URL,"mailto:", 7)) { notify(#URL); - strcpy(#editURL, BrowserHistory.CurrentUrl()); - strcpy(#URL, BrowserHistory.CurrentUrl()); + strcpy(#editURL, History.current()); + strcpy(#URL, History.current()); return; } OpenPage(); diff --git a/programs/cmm/browser/history.h b/programs/cmm/browser/history.h index dceebedc58..8ec66bbf81 100644 --- a/programs/cmm/browser/history.h +++ b/programs/cmm/browser/history.h @@ -5,17 +5,15 @@ ShowHistory() int t; free(history_pointer); - history_pointer = malloc(64000); + history_pointer = malloc(History.items.data_size+256); strcat(history_pointer, "History

History

"); strcat(history_pointer, "

Visited pages


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

Cached images

");