2014-01-29 01:14:09 +01:00
|
|
|
struct path_string {
|
2014-03-30 13:57:13 +02:00
|
|
|
char Item[sizeof(URL)];
|
|
|
|
int was_first;
|
2014-01-29 01:14:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_HISTORY_NUM 40
|
|
|
|
path_string history_list[MAX_HISTORY_NUM];
|
|
|
|
|
2013-12-27 00:36:17 +01:00
|
|
|
struct UrlsHistory {
|
2014-01-29 01:14:09 +01:00
|
|
|
int links_count;
|
2015-09-09 16:24:42 +02:00
|
|
|
int cur_y;
|
2013-12-27 00:36:17 +01:00
|
|
|
dword CurrentUrl();
|
2014-01-29 01:14:09 +01:00
|
|
|
dword GetUrl();
|
2014-03-30 13:57:13 +02:00
|
|
|
dword GetFirstLine();
|
2013-12-27 00:36:17 +01:00
|
|
|
void AddUrl();
|
|
|
|
byte GoBack();
|
|
|
|
byte GoForward();
|
2015-08-10 17:59:20 +02:00
|
|
|
} BrowserHistory;
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
dword UrlsHistory::CurrentUrl() {
|
2015-09-09 16:24:42 +02:00
|
|
|
return #history_list[cur_y].Item;
|
2014-01-29 01:14:09 +01:00
|
|
|
}
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
dword UrlsHistory::GetUrl(int id) {
|
|
|
|
return #history_list[id].Item;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
|
2014-03-30 13:57:13 +02:00
|
|
|
dword UrlsHistory::GetFirstLine(int id) {
|
|
|
|
return history_list[id].was_first;
|
|
|
|
}
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
void UrlsHistory::AddUrl() {
|
2013-12-27 00:36:17 +01:00
|
|
|
int i;
|
2015-09-09 16:24:42 +02:00
|
|
|
if (links_count>0) && (!strcmp(#URL,#history_list[cur_y].Item)) return;
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2015-09-09 16:24:42 +02:00
|
|
|
if (cur_y>=MAX_HISTORY_NUM-1)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2015-09-09 16:24:42 +02:00
|
|
|
cur_y/=2;
|
|
|
|
for (i=0; i<cur_y; i++;)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2014-03-30 13:57:13 +02:00
|
|
|
strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(URL));
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
}
|
2015-09-09 16:24:42 +02:00
|
|
|
cur_y++;
|
2014-03-30 13:57:13 +02:00
|
|
|
// history_list[i].was_first = WB1.list.first;
|
2015-09-09 16:24:42 +02:00
|
|
|
strlcpy(#history_list[cur_y].Item, #URL, sizeof(URL));
|
|
|
|
links_count=cur_y;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
byte UrlsHistory::GoBack() {
|
2015-09-09 16:24:42 +02:00
|
|
|
if (cur_y<=1) return 0;
|
|
|
|
cur_y--;
|
|
|
|
strlcpy(#URL, #history_list[cur_y].Item, sizeof(URL));
|
|
|
|
// stroka = history_list[cur_y].was_first;
|
2013-12-27 00:36:17 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
byte UrlsHistory::GoForward() {
|
2015-09-09 16:24:42 +02:00
|
|
|
if (cur_y==links_count) return 0;
|
|
|
|
cur_y++;
|
|
|
|
strlcpy(#URL, #history_list[cur_y].Item, sizeof(URL));
|
2013-12-27 00:36:17 +01:00
|
|
|
return 1;
|
2014-01-29 01:14:09 +01:00
|
|
|
}
|