Subversion Repositories Kolibri OS

Rev

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