Subversion Repositories Kolibri OS

Rev

Rev 4416 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4544 leency 1
struct path_string {
2
char Item[4096];
3
};
4
 
5
#define MAX_HISTORY_NUM 40
6
path_string history_list[MAX_HISTORY_NUM];
7
 
4416 leency 8
struct UrlsHistory {
4544 leency 9
	int links_count;
10
	int current;
4416 leency 11
	dword CurrentUrl();
4544 leency 12
	dword GetUrl();
4416 leency 13
	void AddUrl();
14
	byte GoBack();
15
	byte GoForward();
16
};
17
 
4544 leency 18
dword UrlsHistory::CurrentUrl() {
19
	return #history_list[current].Item;
20
}
4416 leency 21
 
4544 leency 22
dword UrlsHistory::GetUrl(int id) {
23
	return #history_list[id].Item;
4416 leency 24
}
25
 
4544 leency 26
void UrlsHistory::AddUrl() {
4416 leency 27
	int i;
4544 leency 28
	if (links_count>0) && (!strcmp(#URL,#history_list[current].Item)) return;
4416 leency 29
 
4544 leency 30
	if (current>=MAX_HISTORY_NUM-1)
4416 leency 31
	{
4544 leency 32
		current/=2;
33
		for (i=0; i
4416 leency 34
		{
35
			strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(history_list[0].Item));
36
		}
37
	}
4544 leency 38
	current++;
39
	strlcpy(#history_list[current].Item, #URL, sizeof(history_list[0].Item));
40
	links_count=current;
4416 leency 41
}
42
 
43
 
4544 leency 44
byte UrlsHistory::GoBack() {
45
	if (current<=1) return 0;
46
	current--;
47
	strlcpy(#URL, #history_list[current].Item, sizeof(URL));
4416 leency 48
	return 1;
49
}
50
 
51
 
4544 leency 52
byte UrlsHistory::GoForward() {
53
	if (current==links_count) return 0;
54
	current++;
55
	strlcpy(#URL, #history_list[current].Item, sizeof(URL));
4416 leency 56
	return 1;
4544 leency 57
}
58
 
59
UrlsHistory BrowserHistory;