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