Diffstat (limited to 'noncore/apps/opie-reader/plucker.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/plucker.h | 125 |
1 files changed, 19 insertions, 106 deletions
diff --git a/noncore/apps/opie-reader/plucker.h b/noncore/apps/opie-reader/plucker.h index 083eac6..6d62195 100644 --- a/noncore/apps/opie-reader/plucker.h +++ b/noncore/apps/opie-reader/plucker.h | |||
@@ -1,123 +1,36 @@ | |||
1 | #ifndef __plucker_h | 1 | #ifndef __plucker_h |
2 | #define __plucker_h | 2 | #define __plucker_h |
3 | 3 | ||
4 | #include "CExpander.h" | 4 | #include "plucker_base.h" |
5 | #include "zlib/zlib.h" | ||
6 | #include "ztxt.h" | ||
7 | #include "pdb.h" | ||
8 | #include "CBuffer.h" | ||
9 | #include "Navigation.h" | ||
10 | #include "my_list.h" | ||
11 | 5 | ||
12 | #ifdef LOCALPICTURES | 6 | #ifdef LOCALPICTURES |
13 | class QScrollView; | 7 | class QScrollView; |
14 | class QWidget; | 8 | class QWidget; |
15 | #endif | 9 | #endif |
16 | 10 | ||
17 | struct CPlucker_dataRecord | 11 | class CPlucker : public CPlucker_base |
18 | { | 12 | { |
19 | UInt16 uid; | 13 | void start2endSection() |
20 | UInt16 nParagraphs; | 14 | { |
21 | UInt16 size; | 15 | m_currentstart = currentpos-bufferpos; |
22 | UInt8 type; | 16 | m_currentend = m_currentstart+buffercontent; |
23 | UInt8 reserved; | 17 | } |
24 | }; | 18 | void setbuffersize() |
25 | 19 | { | |
26 | struct CPlucker_record0 | 20 | compressedbuffersize = buffersize = 32*1024; |
27 | { | 21 | } |
28 | UInt16 uid; | 22 | int HeaderSize(); |
29 | UInt16 version; | 23 | void GetHeader(UInt16& uid, UInt16& nParagraphs, UInt32& size, UInt8& type, UInt8& reserved); |
30 | UInt16 nRecords; | 24 | int bgetch(); |
31 | }; | 25 | tchar getch(bool fast); |
26 | UInt8 EOPPhase; | ||
32 | 27 | ||
33 | struct CPluckerbkmk | ||
34 | { | ||
35 | UInt32 offset; | ||
36 | tchar title[MAX_BMRK_LENGTH]; | ||
37 | }; | ||
38 | 28 | ||
39 | const UInt32 CPLUCKER_ID = 0x5458547a; | ||
40 | 29 | ||
41 | class CPlucker : public CExpander, Cpdb | 30 | bool CorrectDecoder(); // Virtual |
42 | { | 31 | void setlink(QString&, const QString&); // Virtual |
43 | unsigned short finduid(unsigned short); | 32 | QImage* imagefromdata(UInt8*, UInt32); // virtual |
44 | char* geturl(UInt16); | ||
45 | void Expand(UInt16, UInt8, UInt8*, UInt16); | ||
46 | CList<unsigned long> visited; | ||
47 | bool m_lastIsBreak; | ||
48 | #ifdef LOCALPICTURES | ||
49 | QScrollView* m_viewer; | ||
50 | QWidget* m_picture; | ||
51 | #endif | ||
52 | size_t textlength, m_lastBreak; | ||
53 | UInt16 uid; | ||
54 | UInt8 EOPPhase; | ||
55 | int m_nextPara, m_nextParaIndex; | ||
56 | CBufferFace<UInt16> m_ParaOffsets; | ||
57 | CBufferFace<UInt16> m_ParaAttrs; | ||
58 | UInt16 m_nParas; | ||
59 | CStyle mystyle; | ||
60 | // bool bInit; | ||
61 | UInt32 buffersize; | ||
62 | UInt32 buffercontent; | ||
63 | UInt8* expandedtextbuffer; | ||
64 | UInt8* compressedtextbuffer; | ||
65 | char* urls; | ||
66 | size_t urlsize; | ||
67 | size_t bufferpos; | ||
68 | UInt16 bufferrec; | ||
69 | CPlucker_record0 hdr0; | ||
70 | size_t currentpos; | ||
71 | bool expand(int); | ||
72 | void UnZip(size_t, UInt8*, UInt16); | ||
73 | void UnDoc(size_t, UInt8*, UInt16); | ||
74 | #ifdef LOCALPICTURES | ||
75 | void showimg(UInt16 tgt); | ||
76 | #endif | ||
77 | QImage* getimg(UInt16 tgt); | ||
78 | QPixmap* expandimg(UInt16 tgt, bool border=false); | ||
79 | void home(); | ||
80 | int bgetch(); | ||
81 | CNavigation m_nav; | ||
82 | public: | 33 | public: |
83 | virtual void suspend() | ||
84 | { | ||
85 | CExpander::suspend(fin); | ||
86 | } | ||
87 | virtual void unsuspend() | ||
88 | { | ||
89 | CExpander::unsuspend(fin); | ||
90 | } | ||
91 | virtual QPixmap* getPicture(unsigned long tgt); | ||
92 | virtual void sizes(unsigned long& _file, unsigned long& _text); | ||
93 | virtual bool hasrandomaccess() { return true; } | ||
94 | virtual ~CPlucker(); | ||
95 | CPlucker(); | 34 | CPlucker(); |
96 | virtual int OpenFile(const char *src); | ||
97 | virtual int getch(); | ||
98 | virtual void getch(int&, CStyle&); | ||
99 | virtual unsigned int locate(); | ||
100 | virtual void locate(unsigned int n); | ||
101 | virtual CList<Bkmk>* getbkmklist(); | ||
102 | virtual bool hyperlink(unsigned int n); | ||
103 | virtual MarkupType PreferredMarkup() | ||
104 | { | ||
105 | return cNONE; | ||
106 | } | ||
107 | void saveposn(size_t posn) { m_nav.saveposn(posn); } | ||
108 | bool forward(size_t& loc) { return m_nav.forward(loc); } | ||
109 | bool back(size_t& loc) { return m_nav.back(loc); } | ||
110 | bool hasnavigation() { return true; } | ||
111 | unsigned long startSection() | ||
112 | { | ||
113 | return currentpos-bufferpos; | ||
114 | } | ||
115 | unsigned long endSection() | ||
116 | { | ||
117 | return startSection()+buffercontent; | ||
118 | } | ||
119 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | ||
120 | void putSaveData(unsigned char*& src, unsigned short& srclen); | ||
121 | }; | 35 | }; |
122 | |||
123 | #endif | 36 | #endif |