Rev 5979 | Rev 7757 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5979 | Rev 6021 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "..\lib\collection.h" |
1 | #include "..\lib\collection.h" |
Line 2... | Line 2... | ||
2 | 2 | ||
3 | struct _History { |
3 | struct _history { |
4 | collection items; |
4 | collection items; |
5 | int active; |
5 | int active; |
6 | int add(); |
6 | int add(); |
7 | int back(); |
7 | int back(); |
8 | int forward(); |
8 | int forward(); |
9 | dword current(); |
9 | dword current(); |
Line 10... | Line 10... | ||
10 | } History; |
10 | } history; |
11 | 11 | ||
12 | int _History::add(dword in) |
12 | int _history::add(dword in) |
13 | { |
13 | { |
14 | if (!strcmp(in, items.get(active-1))) return 0; |
14 | if (!strcmp(in, items.get(active-1))) return 0; |
15 | items.count = active; |
15 | items.count = active; |
16 | items.add(in); |
16 | items.add(in); |
17 | active++; |
17 | active++; |
Line 18... | Line 18... | ||
18 | return 1; |
18 | return 1; |
19 | } |
19 | } |
20 | 20 | ||
21 | int _History::back() |
21 | int _history::back() |
22 | { |
22 | { |
23 | if (active==1) return 0; |
23 | if (active==1) return 0; |
Line 24... | Line 24... | ||
24 | active--; |
24 | active--; |
25 | return 1; |
25 | return 1; |
26 | } |
26 | } |
27 | 27 | ||
28 | int _History::forward() |
28 | int _history::forward() |
29 | { |
29 | { |
Line 30... | Line 30... | ||
30 | if (active==items.count) return 0; |
30 | if (active==items.count) return 0; |
31 | active++; |
31 | active++; |
32 | return 1; |
32 | return 1; |
33 | } |
33 | } |
34 | 34 |