summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Navigation.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/Navigation.cpp b/noncore/apps/opie-reader/Navigation.cpp
index 7b392ba..4f11887 100644
--- a/noncore/apps/opie-reader/Navigation.cpp
+++ b/noncore/apps/opie-reader/Navigation.cpp
@@ -1,50 +1,52 @@
#include "Navigation.h"
+#include <string.h>
+
void CNavigation::saveposn(size_t posn)
{
// qDebug("Saved:%u [%u,%u,%u]", posn, historystart, historycurrent, historyend);
historycurrent = historyend = (historycurrent+1)%NAVIGATION_HISTORY_SIZE;
history[historycurrent] = posn;
if (historystart == historyend) historystart = (historystart+1)%NAVIGATION_HISTORY_SIZE;
// qDebug("Saved:%u [%u,%u,%u]", posn, historystart, historycurrent, historyend);
}
bool CNavigation::forward(size_t& loc)
{
if (historycurrent != historyend)
{
historycurrent = (historycurrent + 1)%NAVIGATION_HISTORY_SIZE;
loc = history[historycurrent];
// qDebug("Forward:%u [%u,%u,%u]", loc, historystart, historycurrent, historyend);
return true;
}
else
{
return false;
}
}
bool CNavigation::back(size_t& loc)
{
if (historyend != historystart)
{
// qDebug("Back:%u [%u,%u,%u]", loc, historystart, historycurrent, historyend);
if (historycurrent == historyend && history[historycurrent] != loc)
{
historyend = (historyend+1) % NAVIGATION_HISTORY_SIZE;
history[historyend] = loc;
}
else
{
size_t sv = historycurrent;
historycurrent = (historycurrent + NAVIGATION_HISTORY_SIZE - 1) % NAVIGATION_HISTORY_SIZE;
if (historycurrent == historystart)
{
historycurrent = sv;
return false;
}
}
loc = history[historycurrent];
// qDebug("Back:%u [%u,%u,%u]", loc, historystart, historycurrent, historyend);
return true;
}