Rev 3363 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3363 | Rev 5974 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | //06.04.2012 |
- | |
Line 2... | Line 1... | ||
2 | 1 | struct _FoldersHistory { |
|
3 | path_string history_list[40]; |
2 | collection history; |
4 | int history_num; |
3 | int history_current; |
5 | int history_current; |
- | |
6 | - | ||
7 | #define ADD_NEW_PATH 1 |
4 | int add(); |
8 | #define GO_BACK 2 |
5 | int back(); |
9 | #define GO_FORWARD 3 |
- | |
10 | - | ||
11 | dword GetCurrentFolder() |
- | |
12 | { |
6 | int forward(); |
13 | char cur_fol[4096]; |
- | |
14 | strcpy(#cur_fol, #path); |
- | |
15 | cur_fol[strlen(#cur_fol)-1]=0x00; //îáðåçàåì ïîñëåäíèé / |
- | |
16 | strcpy(#cur_fol, #cur_fol+strrchr(#cur_fol,'/')); |
7 | } FoldersHistory; |
17 | return #cur_fol; |
- | |
18 | } |
8 | |
19 | 9 | int _FoldersHistory::add() |
|
20 | int HistoryPath(byte action) |
10 | { |
21 | { |
- | |
22 | int MAX_HISTORY_NUM; |
- | |
23 | - | ||
24 | if (action==ADD_NEW_PATH) |
- | |
25 | { |
11 | if (!strcmp(#path, history.get(history_current-1))) return 0; |
26 | if (history_num>0) && (!strcmp(#path,#history_list[history_current].Item)) return; |
- | |
27 | - | ||
28 | MAX_HISTORY_NUM = sizeof(history_list)/sizeof(path_string); |
12 | history.count = history_current; |
29 | if (history_current>=MAX_HISTORY_NUM-1) |
- | |
30 | { |
13 | history.add(#path); |
31 | history_current/=2; |
- | |
32 | for (i=0; i |
- | |
33 | { |
- | |
34 | strcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item); |
- | |
35 | } |
- | |
36 | } |
14 | history_current++; |
37 | history_current++; |
- | |
38 | strcpy(#history_list[history_current].Item, #path); |
15 | return 1; |
39 | history_num=history_current; |
16 | } |
Line 40... | Line 17... | ||
40 | } |
17 | |
41 | 18 | int _FoldersHistory::back() |
|
42 | if (action==GO_BACK) |
19 | { |
43 | { |
20 | if (history_current==1) return 0; |
44 | if (history_current<=2) return 0; |
21 | history_current--; |
- | 22 | strcpy(#path, history.get(history_current-1)); |
|
45 | history_current--; |
23 | debugln(#path); |
46 | strcpy(#path, #history_list[history_current].Item); |
24 | return 1; |
Line 47... | Line 25... | ||
47 | return 1; |
25 | } |
48 | } |
26 | |
49 | 27 | int _FoldersHistory::forward() |
|
50 | if (action==GO_FORWARD) |
28 | { |
51 | { |
29 | if (history_current==history.count) return 0; |
- | 30 | history_current++; |
|
52 | if (history_current==history_num) return 0; |
31 | strcpy(#path, history.get(history_current-1)); |
53 | history_current++; |
32 | debugln(#path); |
54 | strcpy(#path, #history_list[history_current].Item); |
- | |
55 | return 1; |
33 | return 1; |