summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CExpander.h
authorgroucho <groucho>2003-05-07 09:01:39 (UTC)
committer groucho <groucho>2003-05-07 09:01:39 (UTC)
commit118d03d815a7615b9c53363218a7ac45b3f4c514 (patch) (side-by-side diff)
tree356953e2413cddcec0f35bd47bb6439767da7051 /noncore/apps/opie-reader/CExpander.h
parent00894537decf01c5a5cdc565b2740b5e67a2e90f (diff)
downloadopie-118d03d815a7615b9c53363218a7ac45b3f4c514.zip
opie-118d03d815a7615b9c53363218a7ac45b3f4c514.tar.gz
opie-118d03d815a7615b9c53363218a7ac45b3f4c514.tar.bz2
Incorporated TimWs current source tree and make it compile
Diffstat (limited to 'noncore/apps/opie-reader/CExpander.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CExpander.h61
1 files changed, 44 insertions, 17 deletions
diff --git a/noncore/apps/opie-reader/CExpander.h b/noncore/apps/opie-reader/CExpander.h
index c281398..7b21d3e 100644
--- a/noncore/apps/opie-reader/CExpander.h
+++ b/noncore/apps/opie-reader/CExpander.h
@@ -3,3 +3,5 @@
+#ifndef _WINDOWS
#include <unistd.h>
+#endif
#include <stdio.h>
@@ -7,2 +9,3 @@
#include <qmessagebox.h>
+#include "useqpe.h"
#include "config.h"
@@ -10,5 +13,6 @@
#include "Markups.h"
-#include "name.h"
+#include "names.h"
+#include "linktype.h"
-class QPixmap;
+class QImage;
class Bkmk;
@@ -22,2 +26,3 @@ class CCharacterSource
virtual void getch(tchar&, CStyle&) = 0;
+ virtual linkType hyperlink(unsigned int n, QString&) = 0;
};
@@ -33,7 +38,11 @@ class CExpander
time_t sustime;
+ int m_scrWidth;
+ unsigned long m_currentstart, m_currentend;
public:
+#ifdef USEQPE
virtual void suspend() = 0;
virtual void unsuspend() = 0;
+#endif
size_t getHome() { return m_homepos; }
- CExpander() : m_homepos(0), fname(NULL) {};
+ CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {};
virtual ~CExpander() { if (fname != NULL) delete [] fname; };
@@ -51,5 +60,6 @@ class CExpander
virtual CList<Bkmk>* getbkmklist() { return NULL; }
- virtual void getch(int& ch, CStyle& sty)
+ virtual void getch(tchar& ch, CStyle& sty)
{
- ch = getch();
+ int ich = getch();
+ ch = (ich == EOF) ? UEOF : ich;
sty.unset();
@@ -57,6 +67,6 @@ class CExpander
virtual int getch() = 0;
- virtual bool hyperlink(unsigned int n)
+ virtual linkType hyperlink(unsigned int n, QString& wrd)
{
locate(n);
- return true;
+ return eLink;
}
@@ -64,18 +74,33 @@ class CExpander
virtual void saveposn(size_t posn) {}
- virtual bool forward(size_t& loc) {}
- virtual bool back(size_t& loc) {}
+ virtual void writeposn(size_t posn) {}
+ virtual bool forward(size_t& loc) { return false; }
+ virtual bool back(size_t& loc) { return false; }
virtual bool hasnavigation() { return false; }
- virtual unsigned long startSection()
+ unsigned long startSection()
+ {
+ unsigned long current = locate();
+ if (m_currentstart > current || current > m_currentend)
+ {
+ start2endSection();
+ }
+ return m_currentstart;
+ }
+ unsigned long endSection()
+ {
+ unsigned long current = locate();
+ if (m_currentstart > current || current > m_currentend)
{
- return 0;
+ start2endSection();
+ }
+ return m_currentend;
}
- virtual unsigned long endSection()
+ virtual void start2endSection()
{
- unsigned long file, text;
- sizes(file, text);
- return text;
+ m_currentstart = 0;
+ unsigned long file;
+ sizes(file, m_currentend);
}
- virtual QPixmap* getPicture(unsigned long tgt) { return NULL; }
+ virtual QImage* getPicture(unsigned long tgt) { return NULL; }
void setContinuous(bool _b) { m_continuous = _b; }
-
+#ifdef USEQPE
virtual void suspend(FILE*& fin)
@@ -109,2 +134,3 @@ class CExpander
}
+#endif
virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
@@ -122,2 +148,3 @@ class CExpander
}
+ void setwidth(int w) { m_scrWidth = w; }
};