kolibrios-gitea/programs/cmm/eolite/include/history.h
Kirill Lipatov (Leency) 9c68973677 Eolite: use collections for history.h, better code
git-svn-id: svn://kolibrios.org@5974 a494cfbc-eb01-0410-851d-a64ba20cac60
2015-12-16 16:13:34 +00:00

35 lines
687 B
C

struct _FoldersHistory {
collection history;
int history_current;
int add();
int back();
int forward();
} FoldersHistory;
int _FoldersHistory::add()
{
if (!strcmp(#path, history.get(history_current-1))) return 0;
history.count = history_current;
history.add(#path);
history_current++;
return 1;
}
int _FoldersHistory::back()
{
if (history_current==1) return 0;
history_current--;
strcpy(#path, history.get(history_current-1));
debugln(#path);
return 1;
}
int _FoldersHistory::forward()
{
if (history_current==history.count) return 0;
history_current++;
strcpy(#path, history.get(history_current-1));
debugln(#path);
return 1;
}