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 | |||
@@ -2,14 +2,18 @@ | |||
2 | #define __CExpander_h | 2 | #define __CExpander_h |
3 | 3 | ||
4 | #ifndef _WINDOWS | ||
4 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #endif | ||
5 | #include <stdio.h> | 7 | #include <stdio.h> |
6 | #include <time.h> | 8 | #include <time.h> |
7 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | #include "useqpe.h" | ||
8 | #include "config.h" | 11 | #include "config.h" |
9 | #include "StyleConsts.h" | 12 | #include "StyleConsts.h" |
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; |
15 | 19 | ||
@@ -21,4 +25,5 @@ class CCharacterSource | |||
21 | public: | 25 | public: |
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 | }; |
24 | 29 | ||
@@ -32,9 +37,13 @@ class CExpander | |||
32 | size_t suspos; | 37 | size_t suspos; |
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; }; |
40 | int openfile(const char *src) | 49 | int openfile(const char *src) |
@@ -50,33 +59,49 @@ class CExpander | |||
50 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; | 59 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; |
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(); |
56 | } | 66 | } |
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 | } |
63 | virtual MarkupType PreferredMarkup() = 0; | 73 | virtual MarkupType PreferredMarkup() = 0; |
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) |
82 | { | 107 | { |
@@ -108,4 +133,5 @@ class CExpander | |||
108 | } | 133 | } |
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) |
111 | { | 137 | { |
@@ -121,4 +147,5 @@ class CExpander | |||
121 | } | 147 | } |
122 | } | 148 | } |
149 | void setwidth(int w) { m_scrWidth = w; } | ||
123 | }; | 150 | }; |
124 | #endif | 151 | #endif |