Subversion Repositories Kolibri OS

Rev

Rev 2739 | 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
{
2605 leency 26
	if (history_num>0) && (strcmp(#URL,#history_list[history_current].Item)==0) return;
2725 leency 27
 
2605 leency 28
	if (history_current>=MAX_HISTORY_NUM-1)
29
	{
30
		history_current/=2;
31
		for (i=0; i
32
		{
2810 leency 33
			strcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item);
2605 leency 34
		}
35
	}
36
	history_current++;
2810 leency 37
	strcpy(#history_list[history_current].Item, #URL);
2605 leency 38
	history_num=history_current;
2413 leency 39
}
40
 
2605 leency 41
 
2739 leency 42
byte UrlsHistory::GoBack()
2413 leency 43
{
2739 leency 44
	if (history_current<=1) return 0;
45
 
2605 leency 46
	history_current--;
2810 leency 47
	strcpy(#URL, #history_list[history_current].Item);
2739 leency 48
	 return 1;
2413 leency 49
}
2605 leency 50
 
51
 
2739 leency 52
byte UrlsHistory::GoForward()
2605 leency 53
{
2739 leency 54
	if (history_current==history_num) return 0;
2605 leency 55
	history_current++;
2810 leency 56
	strcpy(#URL, #history_list[history_current].Item);
2739 leency 57
	return 1;
2605 leency 58
}