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;
|
|
|
|
int current;
|
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();
|
|
|
|
};
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
dword UrlsHistory::CurrentUrl() {
|
|
|
|
return #history_list[current].Item;
|
|
|
|
}
|
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;
|
2014-01-29 01:14:09 +01:00
|
|
|
if (links_count>0) && (!strcmp(#URL,#history_list[current].Item)) return;
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
if (current>=MAX_HISTORY_NUM-1)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2014-01-29 01:14:09 +01:00
|
|
|
current/=2;
|
|
|
|
for (i=0; i<current; 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
|
|
|
}
|
|
|
|
}
|
2014-01-29 01:14:09 +01:00
|
|
|
current++;
|
2014-03-30 13:57:13 +02:00
|
|
|
// history_list[i].was_first = WB1.list.first;
|
|
|
|
strlcpy(#history_list[current].Item, #URL, sizeof(URL));
|
2014-01-29 01:14:09 +01:00
|
|
|
links_count=current;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
byte UrlsHistory::GoBack() {
|
|
|
|
if (current<=1) return 0;
|
|
|
|
current--;
|
|
|
|
strlcpy(#URL, #history_list[current].Item, sizeof(URL));
|
2014-03-30 13:57:13 +02:00
|
|
|
// stroka = history_list[current].was_first;
|
2013-12-27 00:36:17 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
byte UrlsHistory::GoForward() {
|
|
|
|
if (current==links_count) return 0;
|
|
|
|
current++;
|
|
|
|
strlcpy(#URL, #history_list[current].Item, sizeof(URL));
|
2013-12-27 00:36:17 +01:00
|
|
|
return 1;
|
2014-01-29 01:14:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
UrlsHistory BrowserHistory;
|