Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
2413 leency 1
struct UrlsHistory {
2605 leency 2
	dword CurrentUrl();
2413 leency 3
	void AddUrl();
2739 leency 4
	byte GoBack();
5
	byte GoForward();
2413 leency 6
};
7
 
8
UrlsHistory BrowserHistory;
9
 
2605 leency 10
struct path_string {
11
char Item[4096];
12
};
13
 
14
#define MAX_HISTORY_NUM 40
15
path_string history_list[MAX_HISTORY_NUM];
16
int history_num;
17
int history_current;
18
 
19
dword UrlsHistory::CurrentUrl()
2413 leency 20
{
2605 leency 21
	return #history_list[history_current].Item;
2413 leency 22
}
23
 
2605 leency 24
void UrlsHistory::AddUrl() //тут нужен вводимый элемент - для универсальности
2413 leency 25
{
2839 leency 26
	int i;
2605 leency 27
	if (history_num>0) && (strcmp(#URL,#history_list[history_current].Item)==0) return;
2725 leency 28
 
2605 leency 29
	if (history_current>=MAX_HISTORY_NUM-1)
30
	{
31
		history_current/=2;
32
		for (i=0; i
33
		{
2810 leency 34
			strcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item);
2605 leency 35
		}
36
	}
37
	history_current++;
2810 leency 38
	strcpy(#history_list[history_current].Item, #URL);
2605 leency 39
	history_num=history_current;
2413 leency 40
}
41
 
2605 leency 42
 
2739 leency 43
byte UrlsHistory::GoBack()
2413 leency 44
{
2739 leency 45
	if (history_current<=1) return 0;
46
 
2605 leency 47
	history_current--;
2810 leency 48
	strcpy(#URL, #history_list[history_current].Item);
3058 leency 49
	return 1;
2413 leency 50
}
2605 leency 51
 
52
 
2739 leency 53
byte UrlsHistory::GoForward()
2605 leency 54
{
2739 leency 55
	if (history_current==history_num) return 0;
2605 leency 56
	history_current++;
2810 leency 57
	strcpy(#URL, #history_list[history_current].Item);
2739 leency 58
	return 1;
2605 leency 59
}