Subversion Repositories Kolibri OS

Rev

Rev 5713 | 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;
5825 leency 11
	int cur_y;
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();
5713 leency 18
} BrowserHistory;
4416 leency 19
 
4544 leency 20
dword UrlsHistory::CurrentUrl() {
5825 leency 21
	return #history_list[cur_y].Item;
4544 leency 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;
5825 leency 34
	if (links_count>0) && (!strcmp(#URL,#history_list[cur_y].Item)) return;
4416 leency 35
 
5825 leency 36
	if (cur_y>=MAX_HISTORY_NUM-1)
4416 leency 37
	{
5825 leency 38
		cur_y/=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
	}
5825 leency 44
	cur_y++;
4718 leency 45
	// history_list[i].was_first = WB1.list.first;
5825 leency 46
	strlcpy(#history_list[cur_y].Item, #URL, sizeof(URL));
47
	links_count=cur_y;
4416 leency 48
}
49
 
50
 
4544 leency 51
byte UrlsHistory::GoBack() {
5825 leency 52
	if (cur_y<=1) return 0;
53
	cur_y--;
54
	strlcpy(#URL, #history_list[cur_y].Item, sizeof(URL));
55
	// stroka = history_list[cur_y].was_first;
4416 leency 56
	return 1;
57
}
58
 
59
 
4544 leency 60
byte UrlsHistory::GoForward() {
5825 leency 61
	if (cur_y==links_count) return 0;
62
	cur_y++;
63
	strlcpy(#URL, #history_list[cur_y].Item, sizeof(URL));
4416 leency 64
	return 1;
4544 leency 65
}