Diffstat (limited to 'noncore/apps/opie-reader/CExpander.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CExpander.h | 63 |
1 files changed, 45 insertions, 18 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 @@ | |||
3 | 3 | ||
4 | #ifndef _WINDOWS | ||
4 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #endif | ||
5 | #include <stdio.h> | 7 | #include <stdio.h> |
@@ -7,2 +9,3 @@ | |||
7 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | #include "useqpe.h" | ||
8 | #include "config.h" | 11 | #include "config.h" |
@@ -10,5 +13,6 @@ | |||
10 | #include "Markups.h" | 13 | #include "Markups.h" |
11 | #include "name.h" | 14 | #include "names.h" |
15 | #include "linktype.h" | ||
12 | 16 | ||
13 | class QPixmap; | 17 | class QImage; |
14 | class Bkmk; | 18 | class Bkmk; |
@@ -22,2 +26,3 @@ class CCharacterSource | |||
22 | virtual void getch(tchar&, CStyle&) = 0; | 26 | virtual void getch(tchar&, CStyle&) = 0; |
27 | virtual linkType hyperlink(unsigned int n, QString&) = 0; | ||
23 | }; | 28 | }; |
@@ -33,7 +38,11 @@ class CExpander | |||
33 | time_t sustime; | 38 | time_t sustime; |
39 | int m_scrWidth; | ||
40 | unsigned long m_currentstart, m_currentend; | ||
34 | public: | 41 | public: |
35 | virtual void suspend() = 0; | 42 | #ifdef USEQPE |
43 | virtual void suspend() = 0; | ||
36 | virtual void unsuspend() = 0; | 44 | virtual void unsuspend() = 0; |
45 | #endif | ||
37 | size_t getHome() { return m_homepos; } | 46 | size_t getHome() { return m_homepos; } |
38 | CExpander() : m_homepos(0), fname(NULL) {}; | 47 | CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; |
39 | virtual ~CExpander() { if (fname != NULL) delete [] fname; }; | 48 | virtual ~CExpander() { if (fname != NULL) delete [] fname; }; |
@@ -51,5 +60,6 @@ class CExpander | |||
51 | virtual CList<Bkmk>* getbkmklist() { return NULL; } | 60 | virtual CList<Bkmk>* getbkmklist() { return NULL; } |
52 | virtual void getch(int& ch, CStyle& sty) | 61 | virtual void getch(tchar& ch, CStyle& sty) |
53 | { | 62 | { |
54 | ch = getch(); | 63 | int ich = getch(); |
64 | ch = (ich == EOF) ? UEOF : ich; | ||
55 | sty.unset(); | 65 | sty.unset(); |
@@ -57,6 +67,6 @@ class CExpander | |||
57 | virtual int getch() = 0; | 67 | virtual int getch() = 0; |
58 | virtual bool hyperlink(unsigned int n) | 68 | virtual linkType hyperlink(unsigned int n, QString& wrd) |
59 | { | 69 | { |
60 | locate(n); | 70 | locate(n); |
61 | return true; | 71 | return eLink; |
62 | } | 72 | } |
@@ -64,18 +74,33 @@ class CExpander | |||
64 | virtual void saveposn(size_t posn) {} | 74 | virtual void saveposn(size_t posn) {} |
65 | virtual bool forward(size_t& loc) {} | 75 | virtual void writeposn(size_t posn) {} |
66 | virtual bool back(size_t& loc) {} | 76 | virtual bool forward(size_t& loc) { return false; } |
77 | virtual bool back(size_t& loc) { return false; } | ||
67 | virtual bool hasnavigation() { return false; } | 78 | virtual bool hasnavigation() { return false; } |
68 | virtual unsigned long startSection() | 79 | unsigned long startSection() |
80 | { | ||
81 | unsigned long current = locate(); | ||
82 | if (m_currentstart > current || current > m_currentend) | ||
83 | { | ||
84 | start2endSection(); | ||
85 | } | ||
86 | return m_currentstart; | ||
87 | } | ||
88 | unsigned long endSection() | ||
69 | { | 89 | { |
70 | return 0; | 90 | unsigned long current = locate(); |
91 | if (m_currentstart > current || current > m_currentend) | ||
92 | { | ||
93 | start2endSection(); | ||
94 | } | ||
95 | return m_currentend; | ||
71 | } | 96 | } |
72 | virtual unsigned long endSection() | 97 | virtual void start2endSection() |
73 | { | 98 | { |
74 | unsigned long file, text; | 99 | m_currentstart = 0; |
75 | sizes(file, text); | 100 | unsigned long file; |
76 | return text; | 101 | sizes(file, m_currentend); |
77 | } | 102 | } |
78 | virtual QPixmap* getPicture(unsigned long tgt) { return NULL; } | 103 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } |
79 | void setContinuous(bool _b) { m_continuous = _b; } | 104 | void setContinuous(bool _b) { m_continuous = _b; } |
80 | 105 | #ifdef USEQPE | |
81 | virtual void suspend(FILE*& fin) | 106 | virtual void suspend(FILE*& fin) |
@@ -109,2 +134,3 @@ class CExpander | |||
109 | } | 134 | } |
135 | #endif | ||
110 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 136 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
@@ -122,2 +148,3 @@ class CExpander | |||
122 | } | 148 | } |
149 | void setwidth(int w) { m_scrWidth = w; } | ||
123 | }; | 150 | }; |