author | ar <ar> | 2004-05-03 21:35:18 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-03 21:35:18 (UTC) |
commit | 412619441fab46fc79c695a23ccf9e38135bdfad (patch) (unidiff) | |
tree | 19d9b8af14cf6c345ef532bb32368b9c7b43c50f /noncore/apps/opie-reader/plucker_base.cpp | |
parent | d1095d71394779557f446e2a67ba55bc62eec859 (diff) | |
download | opie-412619441fab46fc79c695a23ccf9e38135bdfad.zip opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.gz opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'noncore/apps/opie-reader/plucker_base.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 1402 |
1 files changed, 705 insertions, 697 deletions
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index caa945d..b523a54 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp | |||
@@ -1,24 +1,32 @@ | |||
1 | |||
2 | |||
1 | #include "useqpe.h" | 3 | #include "useqpe.h" |
2 | #include <stdio.h> | 4 | #include "plucker_base.h" |
3 | #include <string.h> | 5 | #include "Aportis.h" |
6 | #include "Palm2QImage.h" | ||
7 | |||
8 | /* OPIE */ | ||
9 | #include <opie2/odebug.h> | ||
4 | #ifdef USEQPE | 10 | #ifdef USEQPE |
5 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
6 | #endif /* USEQPE */ | ||
7 | #ifdef LOCALPICTURES | ||
8 | #include <qscrollview.h> | ||
9 | #endif | ||
10 | #ifdef USEQPE | ||
11 | #include <qpe/global.h> | 12 | #include <qpe/global.h> |
12 | #endif /* USEQPE */ | 13 | #endif /* USEQPE */ |
14 | |||
13 | #ifndef USEQPE | 15 | #ifndef USEQPE |
14 | #include <qapplication.h> | 16 | #include <qapplication.h> |
15 | #else /* USEQPE */ | 17 | #else /* USEQPE */ |
16 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
17 | #endif /* USEQPE */ | 19 | #endif /* USEQPE */ |
18 | 20 | ||
19 | #include "plucker_base.h" | 21 | /* QT */ |
20 | #include "Aportis.h" | 22 | #ifdef LOCALPICTURES |
21 | #include "Palm2QImage.h" | 23 | #include <qscrollview.h> |
24 | #endif | ||
25 | |||
26 | /* STD */ | ||
27 | #include <stdio.h> | ||
28 | #include <string.h> | ||
29 | |||
22 | 30 | ||
23 | CPlucker_base::CPlucker_base() : | 31 | CPlucker_base::CPlucker_base() : |
24 | #ifdef LOCALPICTURES | 32 | #ifdef LOCALPICTURES |
@@ -35,36 +43,36 @@ void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buff | |||
35 | { | 43 | { |
36 | if (type%2 == 0) | 44 | if (type%2 == 0) |
37 | { | 45 | { |
38 | fread(buffer, reclen, sizeof(char), fin); | 46 | fread(buffer, reclen, sizeof(char), fin); |
39 | } | 47 | } |
40 | else | 48 | else |
41 | { | 49 | { |
42 | UInt8* readbuffer = NULL; | 50 | UInt8* readbuffer = NULL; |
43 | if (reclen > compressedbuffersize) | 51 | if (reclen > compressedbuffersize) |
44 | { | 52 | { |
45 | readbuffer = new UInt8[reclen]; | 53 | readbuffer = new UInt8[reclen]; |
46 | } | 54 | } |
47 | else | 55 | else |
48 | { | 56 | { |
49 | readbuffer = compressedtextbuffer; | 57 | readbuffer = compressedtextbuffer; |
50 | } | 58 | } |
51 | if (readbuffer != NULL) | 59 | if (readbuffer != NULL) |
52 | { | 60 | { |
53 | fread(readbuffer, reclen, sizeof(char), fin); | 61 | fread(readbuffer, reclen, sizeof(char), fin); |
54 | switch (ntohs(hdr0.version)) | 62 | switch (ntohs(hdr0.version)) |
55 | { | 63 | { |
56 | case 2: | 64 | case 2: |
57 | UnZip(readbuffer, reclen, buffer, buffersize); | 65 | UnZip(readbuffer, reclen, buffer, buffersize); |
58 | break; | 66 | break; |
59 | case 1: | 67 | case 1: |
60 | UnDoc(readbuffer, reclen, buffer, buffersize); | 68 | UnDoc(readbuffer, reclen, buffer, buffersize); |
61 | break; | 69 | break; |
62 | } | 70 | } |
63 | if (reclen > compressedbuffersize) | 71 | if (reclen > compressedbuffersize) |
64 | { | 72 | { |
65 | delete [] readbuffer; | 73 | delete [] readbuffer; |
66 | } | 74 | } |
67 | } | 75 | } |
68 | } | 76 | } |
69 | } | 77 | } |
70 | 78 | ||
@@ -73,15 +81,15 @@ void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text) | |||
73 | _file = file_length; | 81 | _file = file_length; |
74 | if (textlength == 0) | 82 | if (textlength == 0) |
75 | { | 83 | { |
76 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 84 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
77 | { | 85 | { |
78 | gotorecordnumber(recptr); | 86 | gotorecordnumber(recptr); |
79 | UInt16 thishdr_uid, thishdr_nParagraphs; | 87 | UInt16 thishdr_uid, thishdr_nParagraphs; |
80 | UInt32 thishdr_size; | 88 | UInt32 thishdr_size; |
81 | UInt8 thishdr_type, thishdr_reserved; | 89 | UInt8 thishdr_type, thishdr_reserved; |
82 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 90 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
83 | if (thishdr_type < 2) textlength += thishdr_size; | 91 | if (thishdr_type < 2) textlength += thishdr_size; |
84 | } | 92 | } |
85 | } | 93 | } |
86 | _text = textlength; | 94 | _text = textlength; |
87 | //ntohl(hdr0.size); | 95 | //ntohl(hdr0.size); |
@@ -93,85 +101,85 @@ char* CPlucker_base::geturl(UInt16 tgt) | |||
93 | gotorecordnumber(0); | 101 | gotorecordnumber(0); |
94 | fread(&hdr0, 1, 6, fin); | 102 | fread(&hdr0, 1, 6, fin); |
95 | unsigned int nrecs = ntohs(hdr0.nRecords); | 103 | unsigned int nrecs = ntohs(hdr0.nRecords); |
96 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); | 104 | //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl; |
97 | UInt16 urlid = 0; | 105 | UInt16 urlid = 0; |
98 | bool urlsfound = false; | 106 | bool urlsfound = false; |
99 | char* urls = NULL; | 107 | char* urls = NULL; |
100 | size_t urlsize = 0; | 108 | size_t urlsize = 0; |
101 | for (unsigned int i = 0; i < nrecs; i++) | 109 | for (unsigned int i = 0; i < nrecs; i++) |
102 | { | 110 | { |
103 | UInt16 id, name; | 111 | UInt16 id, name; |
104 | fread(&name, 1, sizeof(name), fin); | 112 | fread(&name, 1, sizeof(name), fin); |
105 | fread(&id, 1, sizeof(id), fin); | 113 | fread(&id, 1, sizeof(id), fin); |
106 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | 114 | //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl; |
107 | if (ntohs(name) == 2) | 115 | if (ntohs(name) == 2) |
108 | { | 116 | { |
109 | urlsfound = true; | 117 | urlsfound = true; |
110 | urlid = id; | 118 | urlid = id; |
111 | //qDebug("Found url index:%d", ntohs(urlid)); | 119 | //odebug << "Found url index:" << ntohs(urlid) << "" << oendl; |
112 | } | 120 | } |
113 | ////qDebug("%x", id); | 121 | // //odebug << "" << id << "" << oendl; |
114 | } | 122 | } |
115 | if (urlsfound) | 123 | if (urlsfound) |
116 | { | 124 | { |
117 | unsigned short recptr = finduid(ntohs(urlid)); | 125 | unsigned short recptr = finduid(ntohs(urlid)); |
118 | if (recptr != 0) | 126 | if (recptr != 0) |
119 | { | 127 | { |
120 | gotorecordnumber(recptr); | 128 | gotorecordnumber(recptr); |
121 | UInt16 thishdr_uid, thishdr_nParagraphs; | 129 | UInt16 thishdr_uid, thishdr_nParagraphs; |
122 | UInt32 thishdr_size; | 130 | UInt32 thishdr_size; |
123 | UInt8 thishdr_type, thishdr_reserved; | 131 | UInt8 thishdr_type, thishdr_reserved; |
124 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 132 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
125 | UInt16 urlctr = 0; | 133 | UInt16 urlctr = 0; |
126 | while (1) | 134 | while (1) |
127 | { | 135 | { |
128 | UInt16 tctr; | 136 | UInt16 tctr; |
129 | fread(&tctr, 1, sizeof(tctr), fin); | 137 | fread(&tctr, 1, sizeof(tctr), fin); |
130 | fread(&urlid, 1, sizeof(urlid), fin); | 138 | fread(&urlid, 1, sizeof(urlid), fin); |
131 | tctr = ntohs(tctr); | 139 | tctr = ntohs(tctr); |
132 | //qDebug("tgt:%u urlctr:%u tctr:%u", tgt, urlctr, tctr); | 140 | //odebug << "tgt:" << tgt << " urlctr:" << urlctr << " tctr:" << tctr << "" << oendl; |
133 | if (tctr >= tgt) | 141 | if (tctr >= tgt) |
134 | { | 142 | { |
135 | break; | 143 | break; |
136 | } | 144 | } |
137 | urlctr = tctr; | 145 | urlctr = tctr; |
138 | } | 146 | } |
139 | //qDebug("urls are in %d", ntohs(urlid)); | 147 | //odebug << "urls are in " << ntohs(urlid) << "" << oendl; |
140 | recptr = finduid(ntohs(urlid)); | 148 | recptr = finduid(ntohs(urlid)); |
141 | if (recptr != 0) | 149 | if (recptr != 0) |
142 | { | 150 | { |
143 | UInt32 reclen = recordlength(recptr) - HeaderSize(); | 151 | UInt32 reclen = recordlength(recptr) - HeaderSize(); |
144 | gotorecordnumber(recptr); | 152 | gotorecordnumber(recptr); |
145 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 153 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
146 | //qDebug("Found urls:%x",thishdr_type); | 154 | //odebug << "Found urls:" << thishdr_type << "" << oendl; |
147 | urlsize = thishdr_size; | 155 | urlsize = thishdr_size; |
148 | urls = new char[urlsize]; | 156 | urls = new char[urlsize]; |
149 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); | 157 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); |
150 | char* ptr = urls; | 158 | char* ptr = urls; |
151 | int rn = urlctr+1; | 159 | int rn = urlctr+1; |
152 | while (ptr - urls < urlsize) | 160 | while (ptr - urls < urlsize) |
153 | { | 161 | { |
154 | if (rn == tgt) | 162 | if (rn == tgt) |
155 | { | 163 | { |
156 | //qDebug("URL:%s", ptr); | 164 | //odebug << "URL:" << ptr << "" << oendl; |
157 | int len = strlen(ptr)+1; | 165 | int len = strlen(ptr)+1; |
158 | pRet = new char[len]; | 166 | pRet = new char[len]; |
159 | memcpy(pRet, ptr, len); | 167 | memcpy(pRet, ptr, len); |
160 | break; | 168 | break; |
161 | } | 169 | } |
162 | ptr += strlen(ptr)+1; | 170 | ptr += strlen(ptr)+1; |
163 | rn++; | 171 | rn++; |
164 | } | 172 | } |
165 | delete [] urls; | 173 | delete [] urls; |
166 | } | 174 | } |
167 | } | 175 | } |
168 | } | 176 | } |
169 | else | 177 | else |
170 | { | 178 | { |
171 | QMessageBox::information(NULL, | 179 | QMessageBox::information(NULL, |
172 | QString(PROGNAME), | 180 | QString(PROGNAME), |
173 | QString("No external links\nin this pluck") | 181 | QString("No external links\nin this pluck") |
174 | ); | 182 | ); |
175 | } | 183 | } |
176 | return pRet; | 184 | return pRet; |
177 | } | 185 | } |
@@ -206,9 +214,9 @@ unsigned int CPlucker_base::locate() | |||
206 | while (thisrec < bufferrec) | 214 | while (thisrec < bufferrec) |
207 | { | 215 | { |
208 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 216 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
209 | if (thishdr_type < 2) locpos += thishdr_size; | 217 | if (thishdr_type < 2) locpos += thishdr_size; |
210 | thisrec++; | 218 | thisrec++; |
211 | gotorecordnumber(thisrec); | 219 | gotorecordnumber(thisrec); |
212 | } | 220 | } |
213 | return locpos+bufferpos; | 221 | return locpos+bufferpos; |
214 | */ | 222 | */ |
@@ -222,60 +230,60 @@ void CPlucker_base::locate(unsigned int n) | |||
222 | UInt16 recptr = bufferrec; | 230 | UInt16 recptr = bufferrec; |
223 | if (n < textlength/2) | 231 | if (n < textlength/2) |
224 | { | 232 | { |
225 | textlength = 0; | 233 | textlength = 0; |
226 | UInt16 thishdr_uid, thishdr_nParagraphs; | 234 | UInt16 thishdr_uid, thishdr_nParagraphs; |
227 | UInt32 thishdr_size = buffercontent; | 235 | UInt32 thishdr_size = buffercontent; |
228 | UInt8 thishdr_type, thishdr_reserved; | 236 | UInt8 thishdr_type, thishdr_reserved; |
229 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 237 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
230 | { | 238 | { |
231 | gotorecordnumber(recptr); | 239 | gotorecordnumber(recptr); |
232 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 240 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
233 | if (thishdr_type < 2) | 241 | if (thishdr_type < 2) |
234 | { | 242 | { |
235 | textlength += thishdr_size; | 243 | textlength += thishdr_size; |
236 | if (textlength > n) | 244 | if (textlength > n) |
237 | { | 245 | { |
238 | textlength -= thishdr_size; | 246 | textlength -= thishdr_size; |
239 | break; | 247 | break; |
240 | } | 248 | } |
241 | } | 249 | } |
242 | } | 250 | } |
243 | } | 251 | } |
244 | else if (n < textlength) | 252 | else if (n < textlength) |
245 | { | 253 | { |
246 | UInt16 thishdr_uid, thishdr_nParagraphs; | 254 | UInt16 thishdr_uid, thishdr_nParagraphs; |
247 | UInt32 thishdr_size; | 255 | UInt32 thishdr_size; |
248 | UInt8 thishdr_type, thishdr_reserved; | 256 | UInt8 thishdr_type, thishdr_reserved; |
249 | while (n < textlength && recptr > 1) | 257 | while (n < textlength && recptr > 1) |
250 | { | 258 | { |
251 | recptr--; | 259 | recptr--; |
252 | gotorecordnumber(recptr); | 260 | gotorecordnumber(recptr); |
253 | //qDebug("recptr:%u", recptr); | 261 | //odebug << "recptr:" << recptr << "" << oendl; |
254 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 262 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
255 | if (thishdr_type < 2) | 263 | if (thishdr_type < 2) |
256 | { | 264 | { |
257 | textlength -= thishdr_size; | 265 | textlength -= thishdr_size; |
258 | } | 266 | } |
259 | } | 267 | } |
260 | } | 268 | } |
261 | else | 269 | else |
262 | { | 270 | { |
263 | UInt16 thishdr_uid, thishdr_nParagraphs; | 271 | UInt16 thishdr_uid, thishdr_nParagraphs; |
264 | UInt32 thishdr_size = buffercontent; | 272 | UInt32 thishdr_size = buffercontent; |
265 | UInt8 thishdr_type, thishdr_reserved; | 273 | UInt8 thishdr_type, thishdr_reserved; |
266 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) | 274 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) |
267 | { | 275 | { |
268 | textlength += thishdr_size; | 276 | textlength += thishdr_size; |
269 | recptr++; | 277 | recptr++; |
270 | gotorecordnumber(recptr); | 278 | gotorecordnumber(recptr); |
271 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 279 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
272 | if (!(thishdr_type < 2)) | 280 | if (!(thishdr_type < 2)) |
273 | { | 281 | { |
274 | thishdr_size = 0; | 282 | thishdr_size = 0; |
275 | } | 283 | } |
276 | } | 284 | } |
277 | } | 285 | } |
278 | // qDebug("Time(1): %u", clock()-start); | 286 | // odebug << "Time(1): " << clock()-start << "" << oendl; |
279 | /* | 287 | /* |
280 | expand(recptr); | 288 | expand(recptr); |
281 | mystyle.unset(); | 289 | mystyle.unset(); |
@@ -283,16 +291,16 @@ void CPlucker_base::locate(unsigned int n) | |||
283 | currentpos = n; | 291 | currentpos = n; |
284 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 292 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
285 | { | 293 | { |
286 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 294 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
287 | m_nextParaIndex++; | 295 | m_nextParaIndex++; |
288 | if (m_nextParaIndex == m_nParas) | 296 | if (m_nextParaIndex == m_nParas) |
289 | { | 297 | { |
290 | m_nextPara = -1; | 298 | m_nextPara = -1; |
291 | } | 299 | } |
292 | else | 300 | else |
293 | { | 301 | { |
294 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 302 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
295 | } | 303 | } |
296 | } | 304 | } |
297 | 305 | ||
298 | return; | 306 | return; |
@@ -307,34 +315,34 @@ void CPlucker_base::locate(unsigned int n) | |||
307 | UInt8 thishdr_type, thishdr_reserved; | 315 | UInt8 thishdr_type, thishdr_reserved; |
308 | do | 316 | do |
309 | { | 317 | { |
310 | thisrec++; | 318 | thisrec++; |
311 | locpos += bs; | 319 | locpos += bs; |
312 | gotorecordnumber(thisrec); | 320 | gotorecordnumber(thisrec); |
313 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 321 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
314 | if (thishdr_type < 2) | 322 | if (thishdr_type < 2) |
315 | { | 323 | { |
316 | bs = thishdr_size; | 324 | bs = thishdr_size; |
317 | } | 325 | } |
318 | else | 326 | else |
319 | { | 327 | { |
320 | bs = 0; | 328 | bs = 0; |
321 | } | 329 | } |
322 | } while (locpos + bs <= n); | 330 | } while (locpos + bs <= n); |
323 | 331 | ||
324 | // qDebug("Time(2): %u", clock()-start); | 332 | // odebug << "Time(2): " << clock()-start << "" << oendl; |
325 | if (recptr != thisrec) | 333 | if (recptr != thisrec) |
326 | { | 334 | { |
327 | qDebug("Disaster:recptr:%u thisrec:%u", recptr, thisrec); | 335 | odebug << "Disaster:recptr:" << recptr << " thisrec:" << thisrec << "" << oendl; |
328 | UInt16 thishdr_uid, thishdr_nParagraphs; | 336 | UInt16 thishdr_uid, thishdr_nParagraphs; |
329 | UInt32 thishdr_size = buffercontent; | 337 | UInt32 thishdr_size = buffercontent; |
330 | UInt8 thishdr_type, thishdr_reserved; | 338 | UInt8 thishdr_type, thishdr_reserved; |
331 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 339 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
332 | { | 340 | { |
333 | gotorecordnumber(recptr); | 341 | gotorecordnumber(recptr); |
334 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 342 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
335 | // qDebug("UID:%u Paras:%u Size:%u Type:%u Reserved:%u", thishdr_uid, thishdr_nParagraphs, thishdr_size, (unsigned int)thishdr_type, (unsigned int)thishdr_reserved); | 343 | // odebug << "UID:" << thishdr_uid << " Paras:" << thishdr_nParagraphs << " Size:" << thishdr_size << " Type:" << (unsigned int)thishdr_type << " Reserved:" << (unsigned int)thishdr_reserved << "" << oendl; |
336 | } | 344 | } |
337 | //QApplication::exit ( 100 ); | 345 | // QApplication::exit ( 100 ); |
338 | } | 346 | } |
339 | 347 | ||
340 | currentpos = locpos; | 348 | currentpos = locpos; |
@@ -346,16 +354,16 @@ void CPlucker_base::locate(unsigned int n) | |||
346 | currentpos = n; | 354 | currentpos = n; |
347 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 355 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
348 | { | 356 | { |
349 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 357 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
350 | m_nextParaIndex++; | 358 | m_nextParaIndex++; |
351 | if (m_nextParaIndex == m_nParas) | 359 | if (m_nextParaIndex == m_nParas) |
352 | { | 360 | { |
353 | m_nextPara = -1; | 361 | m_nextPara = -1; |
354 | } | 362 | } |
355 | else | 363 | else |
356 | { | 364 | { |
357 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 365 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
358 | } | 366 | } |
359 | } | 367 | } |
360 | */ | 368 | */ |
361 | } | 369 | } |
@@ -370,38 +378,38 @@ bool CPlucker_base::expand(int thisrec) | |||
370 | UInt8 thishdr_type, thishdr_reserved; | 378 | UInt8 thishdr_type, thishdr_reserved; |
371 | while (1) | 379 | while (1) |
372 | { | 380 | { |
373 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 381 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
374 | //qDebug("This (%d) type is %d, uid is %u", thisrec, thishdr_type, thishdr_uid); | 382 | //odebug << "This (" << thisrec << ") type is " << thishdr_type << ", uid is " << thishdr_uid << "" << oendl; |
375 | if (thishdr_type < 2) break; | 383 | if (thishdr_type < 2) break; |
376 | //qDebug("Skipping paragraph of type %d", thishdr_type); | 384 | //odebug << "Skipping paragraph of type " << thishdr_type << "" << oendl; |
377 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; | 385 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; |
378 | reclen = recordlength(thisrec); | 386 | reclen = recordlength(thisrec); |
379 | gotorecordnumber(thisrec); | 387 | gotorecordnumber(thisrec); |
380 | } | 388 | } |
381 | m_nParas = thishdr_nParagraphs; | 389 | m_nParas = thishdr_nParagraphs; |
382 | m_bufferisreserved = (thishdr_reserved != 0); | 390 | m_bufferisreserved = (thishdr_reserved != 0); |
383 | //qDebug("It has %u paragraphs and is %u bytes", thishdr_nParagraphs, thishdr_size); | 391 | //odebug << "It has " << thishdr_nParagraphs << " paragraphs and is " << thishdr_size << " bytes" << oendl; |
384 | uid = thishdr_uid; | 392 | uid = thishdr_uid; |
385 | // gotorecordnumber(thisrec); | 393 | // gotorecordnumber(thisrec); |
386 | // fread(expandedtextbuffer,1,10,fin); | 394 | // fread(expandedtextbuffer,1,10,fin); |
387 | for (int i = 0; i < m_nParas; i++) | 395 | for (int i = 0; i < m_nParas; i++) |
388 | { | 396 | { |
389 | UInt16 ubytes, attrs; | 397 | UInt16 ubytes, attrs; |
390 | fread(&ubytes, 1, sizeof(ubytes), fin); | 398 | fread(&ubytes, 1, sizeof(ubytes), fin); |
391 | fread(&attrs, 1, sizeof(attrs), fin); | 399 | fread(&attrs, 1, sizeof(attrs), fin); |
392 | m_ParaOffsets[i] = ntohs(ubytes); | 400 | m_ParaOffsets[i] = ntohs(ubytes); |
393 | m_ParaAttrs[i] = ntohs(attrs); | 401 | m_ParaAttrs[i] = ntohs(attrs); |
394 | ////qDebug("Bytes %u, Attr %x", ntohs(ubytes), ntohs(attrs)); | 402 | // //odebug << "Bytes " << ntohs(ubytes) << ", Attr " << ntohs(attrs) << "" << oendl; |
395 | } | 403 | } |
396 | if (m_nParas > 0) | 404 | if (m_nParas > 0) |
397 | { | 405 | { |
398 | m_nextPara = m_ParaOffsets[0]; | 406 | m_nextPara = m_ParaOffsets[0]; |
399 | //qDebug("First offset = %u", m_nextPara); | 407 | //odebug << "First offset = " << m_nextPara << "" << oendl; |
400 | m_nextParaIndex = 0; | 408 | m_nextParaIndex = 0; |
401 | } | 409 | } |
402 | else | 410 | else |
403 | { | 411 | { |
404 | m_nextPara = -1; | 412 | m_nextPara = -1; |
405 | } | 413 | } |
406 | 414 | ||
407 | reclen -= HeaderSize()+4*m_nParas; | 415 | reclen -= HeaderSize()+4*m_nParas; |
@@ -410,15 +418,15 @@ bool CPlucker_base::expand(int thisrec) | |||
410 | 418 | ||
411 | if (thishdr_size > buffersize) | 419 | if (thishdr_size > buffersize) |
412 | { | 420 | { |
413 | delete [] expandedtextbuffer; | 421 | delete [] expandedtextbuffer; |
414 | buffersize = thishdr_size; | 422 | buffersize = thishdr_size; |
415 | expandedtextbuffer = new UInt8[buffersize]; | 423 | expandedtextbuffer = new UInt8[buffersize]; |
416 | } | 424 | } |
417 | 425 | ||
418 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); | 426 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); |
419 | bufferpos = 0; | 427 | bufferpos = 0; |
420 | bufferrec = thisrec; | 428 | bufferrec = thisrec; |
421 | //qDebug("BC:%u, HS:%u", buffercontent, thishdr_size); | 429 | //odebug << "BC:" << buffercontent << ", HS:" << thishdr_size << "" << oendl; |
422 | return true; | 430 | return true; |
423 | } | 431 | } |
424 | 432 | ||
@@ -436,9 +444,9 @@ void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuff | |||
436 | zstream.zalloc = Z_NULL; | 444 | zstream.zalloc = Z_NULL; |
437 | zstream.zfree = Z_NULL; | 445 | zstream.zfree = Z_NULL; |
438 | zstream.opaque = Z_NULL; | 446 | zstream.opaque = Z_NULL; |
439 | 447 | ||
440 | // printf("Initialising\n"); | 448 | // printf("Initialising\n"); |
441 | 449 | ||
442 | inflateInit(&zstream); | 450 | inflateInit(&zstream); |
443 | int err = 0; | 451 | int err = 0; |
444 | do { | 452 | do { |
@@ -452,7 +460,7 @@ void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuff | |||
452 | 460 | ||
453 | err = inflate( &zstream, Z_SYNC_FLUSH ); | 461 | err = inflate( &zstream, Z_SYNC_FLUSH ); |
454 | 462 | ||
455 | ////qDebug("err:%d - %u", err, zstream.avail_in); | 463 | // //odebug << "err:" << err << " - " << zstream.avail_in << "" << oendl; |
456 | 464 | ||
457 | } while ( err == Z_OK ); | 465 | } while ( err == Z_OK ); |
458 | 466 | ||
@@ -527,16 +535,16 @@ CList<Bkmk>* CPlucker_base::getbkmklist() | |||
527 | 535 | ||
528 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) | 536 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) |
529 | { | 537 | { |
530 | gotorecordnumber(i); | 538 | gotorecordnumber(i); |
531 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 539 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
532 | if (thishdr_type == 8) | 540 | if (thishdr_type == 8) |
533 | { | 541 | { |
534 | UInt16 n; | 542 | UInt16 n; |
535 | fread(&n, 1, sizeof(n), fin); | 543 | fread(&n, 1, sizeof(n), fin); |
536 | n = ntohs(n); | 544 | n = ntohs(n); |
537 | //qDebug("Found %u bookmarks", n); | 545 | //odebug << "Found " << n << " bookmarks" << oendl; |
538 | } | 546 | } |
539 | //qDebug("Found:%d, %u", i , thishdr_type); | 547 | //odebug << "Found:" << i << ", " << thishdr_type << "" << oendl; |
540 | } | 548 | } |
541 | */ | 549 | */ |
542 | return NULL; | 550 | return NULL; |
@@ -550,18 +558,18 @@ QImage* CPlucker_base::expandimg(UInt16 tgt, bool border) | |||
550 | if (qimage == NULL) return NULL; | 558 | if (qimage == NULL) return NULL; |
551 | if (border) | 559 | if (border) |
552 | { | 560 | { |
553 | QPixmap* image = new QPixmap(0,0); | 561 | QPixmap* image = new QPixmap(0,0); |
554 | image->convertFromImage(*qimage); | 562 | image->convertFromImage(*qimage); |
555 | delete qimage; | 563 | delete qimage; |
556 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); | 564 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); |
557 | pret->fill(Qt::red); | 565 | pret->fill(Qt::red); |
558 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); | 566 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); |
559 | delete image; | 567 | delete image; |
560 | ret = new QImage(pret->convertToImage()); | 568 | ret = new QImage(pret->convertToImage()); |
561 | } | 569 | } |
562 | else | 570 | else |
563 | { | 571 | { |
564 | ret = qimage; | 572 | ret = qimage; |
565 | } | 573 | } |
566 | return ret; | 574 | return ret; |
567 | } | 575 | } |
@@ -577,11 +585,11 @@ QImage* CPlucker_base::getPicture(unsigned long tgt) | |||
577 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); | 585 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); |
578 | if (t == pix.end()) | 586 | if (t == pix.end()) |
579 | { | 587 | { |
580 | pix[tgt] = *expandimg(tgt); | 588 | pix[tgt] = *expandimg(tgt); |
581 | return &pix[tgt]; | 589 | return &pix[tgt]; |
582 | } | 590 | } |
583 | else | 591 | else |
584 | return &(t.data()); | 592 | return &(t.data()); |
585 | #else | 593 | #else |
586 | return expandimg(tgt >> 16); | 594 | return expandimg(tgt >> 16); |
587 | #endif | 595 | #endif |
@@ -592,7 +600,7 @@ QImage* CPlucker_base::getPicture(unsigned long tgt) | |||
592 | #include <qpe/global.h> | 600 | #include <qpe/global.h> |
593 | void CPlucker_base::showimg(UInt16 tgt) | 601 | void CPlucker_base::showimg(UInt16 tgt) |
594 | { | 602 | { |
595 | //qDebug("Crassssssh!"); | 603 | //odebug << "Crassssssh!" << oendl; |
596 | QPixmap* qimage = expandimg(tgt); | 604 | QPixmap* qimage = expandimg(tgt); |
597 | m_picture->setFixedSize(qimage->size()); | 605 | m_picture->setFixedSize(qimage->size()); |
598 | m_picture->setBackgroundPixmap(*qimage); | 606 | m_picture->setBackgroundPixmap(*qimage); |
@@ -603,18 +611,18 @@ void CPlucker_base::showimg(UInt16 tgt) | |||
603 | char tmp[] = "uqtreader.XXXXXX"; | 611 | char tmp[] = "uqtreader.XXXXXX"; |
604 | QImage* qimage = getimg(tgt); | 612 | QImage* qimage = getimg(tgt); |
605 | QPixmap* image = new QPixmap(0,0); | 613 | QPixmap* image = new QPixmap(0,0); |
606 | // //qDebug("New image"); | 614 | // //odebug << "New image" << oendl; |
607 | image->convertFromImage(*qimage); | 615 | image->convertFromImage(*qimage); |
608 | delete qimage; | 616 | delete qimage; |
609 | char tmpfile[sizeof(tmp)+1]; | 617 | char tmpfile[sizeof(tmp)+1]; |
610 | strcpy(tmpfile,tmp); | 618 | strcpy(tmpfile,tmp); |
611 | int f = mkstemp(tmpfile); | 619 | int f = mkstemp(tmpfile); |
612 | close(f); | 620 | close(f); |
613 | //qDebug("TMPFILE:%s", tmpfile); | 621 | //odebug << "TMPFILE:" << tmpfile << "" << oendl; |
614 | if (image->save(tmpfile,"PNG")) | 622 | if (image->save(tmpfile,"PNG")) |
615 | { | 623 | { |
616 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); | 624 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); |
617 | e << QString(tmpfile); | 625 | e << QString(tmpfile); |
618 | } | 626 | } |
619 | Global::statusMessage("Opening image"); | 627 | Global::statusMessage("Opening image"); |
620 | sleep(5); | 628 | sleep(5); |
@@ -627,31 +635,31 @@ void CPlucker_base::showimg(UInt16 tgt) | |||
627 | 635 | ||
628 | unsigned short CPlucker_base::finduid(unsigned short urlid) | 636 | unsigned short CPlucker_base::finduid(unsigned short urlid) |
629 | { | 637 | { |
630 | // //qDebug("Finding %u", urlid); | 638 | // //odebug << "Finding " << urlid << "" << oendl; |
631 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); | 639 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); |
632 | unsigned short jmid = (jmin+jmax) >> 1; | 640 | unsigned short jmid = (jmin+jmax) >> 1; |
633 | while (jmax - jmin > 1) | 641 | while (jmax - jmin > 1) |
634 | { | 642 | { |
635 | gotorecordnumber(jmid); | 643 | gotorecordnumber(jmid); |
636 | UInt16 thishdr_uid, thishdr_nParagraphs; | 644 | UInt16 thishdr_uid, thishdr_nParagraphs; |
637 | UInt32 thishdr_size; | 645 | UInt32 thishdr_size; |
638 | UInt8 thishdr_type, thishdr_reserved; | 646 | UInt8 thishdr_type, thishdr_reserved; |
639 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 647 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
640 | unsigned short luid = thishdr_uid; | 648 | unsigned short luid = thishdr_uid; |
641 | ////qDebug("%u %u %u : %u", jmin, jmid, jmax, urlid); | 649 | // //odebug << "" << jmin << " " << jmid << " " << jmax << " : " << urlid << "" << oendl; |
642 | if (luid == urlid) | 650 | if (luid == urlid) |
643 | { | 651 | { |
644 | return jmid; | 652 | return jmid; |
645 | } | 653 | } |
646 | if (luid < urlid) | 654 | if (luid < urlid) |
647 | { | 655 | { |
648 | jmin = jmid; | 656 | jmin = jmid; |
649 | } | 657 | } |
650 | else | 658 | else |
651 | { | 659 | { |
652 | jmax = jmid; | 660 | jmax = jmid; |
653 | } | 661 | } |
654 | jmid = (jmin+jmax) >> 1; | 662 | jmid = (jmin+jmax) >> 1; |
655 | } | 663 | } |
656 | gotorecordnumber(jmin); | 664 | gotorecordnumber(jmin); |
657 | UInt16 thishdr_uid, thishdr_nParagraphs; | 665 | UInt16 thishdr_uid, thishdr_nParagraphs; |
@@ -659,20 +667,20 @@ unsigned short CPlucker_base::finduid(unsigned short urlid) | |||
659 | UInt8 thishdr_type, thishdr_reserved; | 667 | UInt8 thishdr_type, thishdr_reserved; |
660 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 668 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
661 | unsigned short luid = thishdr_uid; | 669 | unsigned short luid = thishdr_uid; |
662 | //qDebug("jmin at end:%u,%u", jmin, luid); | 670 | //odebug << "jmin at end:" << jmin << "," << luid << "" << oendl; |
663 | if (luid == urlid) | 671 | if (luid == urlid) |
664 | { | 672 | { |
665 | return jmin; | 673 | return jmin; |
666 | } | 674 | } |
667 | gotorecordnumber(jmax); | 675 | gotorecordnumber(jmax); |
668 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 676 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
669 | luid = thishdr_uid; | 677 | luid = thishdr_uid; |
670 | //qDebug("jmax at end:%u,%u", jmax, luid); | 678 | //odebug << "jmax at end:" << jmax << "," << luid << "" << oendl; |
671 | if (luid == urlid) | 679 | if (luid == urlid) |
672 | { | 680 | { |
673 | return jmax; | 681 | return jmax; |
674 | } | 682 | } |
675 | //qDebug("Couldn't find %u", urlid); | 683 | //odebug << "Couldn't find " << urlid << "" << oendl; |
676 | return 0; // Not found! | 684 | return 0; // Not found! |
677 | } | 685 | } |
678 | 686 | ||
@@ -682,7 +690,7 @@ void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsig | |||
682 | unsigned short sz = 0; | 690 | unsigned short sz = 0; |
683 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 691 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
684 | { | 692 | { |
685 | sz++; | 693 | sz++; |
686 | } | 694 | } |
687 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); | 695 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); |
688 | unsigned char* newdata = new unsigned char[newlen]; | 696 | unsigned char* newdata = new unsigned char[newlen]; |
@@ -697,10 +705,10 @@ void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsig | |||
697 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 705 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
698 | #endif | 706 | #endif |
699 | { | 707 | { |
700 | unsigned long t = *it; | 708 | unsigned long t = *it; |
701 | //qDebug("[%u]", t); | 709 | // odebug << "[" << t << "]" << oendl; |
702 | memcpy(newdata, &t, sizeof(t)); | 710 | memcpy(newdata, &t, sizeof(t)); |
703 | newdata += sizeof(t); | 711 | newdata += sizeof(t); |
704 | } | 712 | } |
705 | m_nav.setSaveData(data, len, pdata, newlen); | 713 | m_nav.setSaveData(data, len, pdata, newlen); |
706 | delete [] pdata; | 714 | delete [] pdata; |
@@ -711,26 +719,26 @@ void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) | |||
711 | unsigned short sz; | 719 | unsigned short sz; |
712 | if (srclen >= sizeof(sz)) | 720 | if (srclen >= sizeof(sz)) |
713 | { | 721 | { |
714 | memcpy(&sz, src, sizeof(sz)); | 722 | memcpy(&sz, src, sizeof(sz)); |
715 | src += sizeof(sz); | 723 | src += sizeof(sz); |
716 | srclen -= sizeof(sz); | 724 | srclen -= sizeof(sz); |
717 | } | 725 | } |
718 | for (int i = 0; i < sz; i++) | 726 | for (int i = 0; i < sz; i++) |
719 | { | 727 | { |
720 | unsigned long t; | 728 | unsigned long t; |
721 | if (srclen >= sizeof(t)) | 729 | if (srclen >= sizeof(t)) |
722 | { | 730 | { |
723 | memcpy(&t, src, sizeof(t)); | 731 | memcpy(&t, src, sizeof(t)); |
724 | // qDebug("[%u]", t); | 732 | // odebug << "[" << t << "]" << oendl; |
725 | visited.push_front(t); | 733 | visited.push_front(t); |
726 | src += sizeof(t); | 734 | src += sizeof(t); |
727 | srclen -= sizeof(t); | 735 | srclen -= sizeof(t); |
728 | } | 736 | } |
729 | else | 737 | else |
730 | { | 738 | { |
731 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); | 739 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); |
732 | break; | 740 | break; |
733 | } | 741 | } |
734 | } | 742 | } |
735 | m_nav.putSaveData(src, srclen); | 743 | m_nav.putSaveData(src, srclen); |
736 | } | 744 | } |
@@ -740,7 +748,7 @@ int CPlucker_base::OpenFile(const char *src) | |||
740 | m_lastBreak = 0; | 748 | m_lastBreak = 0; |
741 | if (!Cpdb::openfile(src)) | 749 | if (!Cpdb::openfile(src)) |
742 | { | 750 | { |
743 | return -1; | 751 | return -1; |
744 | } | 752 | } |
745 | 753 | ||
746 | if (!CorrectDecoder()) return -1; | 754 | if (!CorrectDecoder()) return -1; |
@@ -751,43 +759,43 @@ int CPlucker_base::OpenFile(const char *src) | |||
751 | compressedtextbuffer = new UInt8[compressedbuffersize]; | 759 | compressedtextbuffer = new UInt8[compressedbuffersize]; |
752 | expandedtextbuffer = new UInt8[buffersize]; | 760 | expandedtextbuffer = new UInt8[buffersize]; |
753 | 761 | ||
754 | //qDebug("Total number of records:%u", ntohs(head.recordList.numRecords)); | 762 | //odebug << "Total number of records:" << ntohs(head.recordList.numRecords) << "" << oendl; |
755 | 763 | ||
756 | unsigned int nrecs = ntohs(hdr0.nRecords); | 764 | unsigned int nrecs = ntohs(hdr0.nRecords); |
757 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); | 765 | //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl; |
758 | UInt16 homerecid = 1; | 766 | UInt16 homerecid = 1; |
759 | for (unsigned int i = 0; i < nrecs; i++) | 767 | for (unsigned int i = 0; i < nrecs; i++) |
760 | { | 768 | { |
761 | UInt16 id, name; | 769 | UInt16 id, name; |
762 | fread(&name, 1, sizeof(name), fin); | 770 | fread(&name, 1, sizeof(name), fin); |
763 | fread(&id, 1, sizeof(id), fin); | 771 | fread(&id, 1, sizeof(id), fin); |
764 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | 772 | //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl; |
765 | if (ntohs(name) == 0) homerecid = ntohs(id); | 773 | if (ntohs(name) == 0) homerecid = ntohs(id); |
766 | } | 774 | } |
767 | 775 | ||
768 | textlength = 0; | 776 | textlength = 0; |
769 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 777 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
770 | { | 778 | { |
771 | gotorecordnumber(recptr); | 779 | gotorecordnumber(recptr); |
772 | UInt16 thishdr_uid, thishdr_nParagraphs; | 780 | UInt16 thishdr_uid, thishdr_nParagraphs; |
773 | UInt32 thishdr_size; | 781 | UInt32 thishdr_size; |
774 | UInt8 thishdr_type, thishdr_reserved; | 782 | UInt8 thishdr_type, thishdr_reserved; |
775 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 783 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
776 | if (thishdr_uid == homerecid) | 784 | if (thishdr_uid == homerecid) |
777 | { | 785 | { |
778 | m_homepos = textlength; | 786 | m_homepos = textlength; |
779 | break; | 787 | break; |
780 | } | 788 | } |
781 | if (thishdr_type < 2) textlength += thishdr_size; | 789 | if (thishdr_type < 2) textlength += thishdr_size; |
782 | } | 790 | } |
783 | textlength = 0; | 791 | textlength = 0; |
784 | home(); | 792 | home(); |
785 | #ifdef LOCALPICTURES | 793 | #ifdef LOCALPICTURES |
786 | if (m_viewer == NULL) | 794 | if (m_viewer == NULL) |
787 | { | 795 | { |
788 | m_viewer = new QScrollView(NULL); | 796 | m_viewer = new QScrollView(NULL); |
789 | m_picture = new QWidget(m_viewer->viewport()); | 797 | m_picture = new QWidget(m_viewer->viewport()); |
790 | m_viewer->addChild(m_picture); | 798 | m_viewer->addChild(m_picture); |
791 | } | 799 | } |
792 | #endif | 800 | #endif |
793 | return 0; | 801 | return 0; |
@@ -808,7 +816,7 @@ QImage* CPlucker_base::getimg(UInt16 tgt) | |||
808 | 816 | ||
809 | UInt32 imgsize = thishdr_size; | 817 | UInt32 imgsize = thishdr_size; |
810 | UInt8* imgbuffer = new UInt8[imgsize]; | 818 | UInt8* imgbuffer = new UInt8[imgsize]; |
811 | 819 | ||
812 | Expand(reclen, thishdr_type, imgbuffer, imgsize); | 820 | Expand(reclen, thishdr_type, imgbuffer, imgsize); |
813 | 821 | ||
814 | return imagefromdata(imgbuffer, imgsize); | 822 | return imagefromdata(imgbuffer, imgsize); |
@@ -819,7 +827,7 @@ linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd) | |||
819 | visited.push_front(n); | 827 | visited.push_front(n); |
820 | UInt16 tuid = (n >> 16); | 828 | UInt16 tuid = (n >> 16); |
821 | n &= 0xffff; | 829 | n &= 0xffff; |
822 | // //qDebug("Hyper:<%u,%u>", tuid, n); | 830 | // //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl; |
823 | UInt16 thisrec = 1; | 831 | UInt16 thisrec = 1; |
824 | currentpos = 0; | 832 | currentpos = 0; |
825 | gotorecordnumber(thisrec); | 833 | gotorecordnumber(thisrec); |
@@ -828,123 +836,123 @@ linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd) | |||
828 | UInt8 thishdr_type, thishdr_reserved; | 836 | UInt8 thishdr_type, thishdr_reserved; |
829 | while (1) | 837 | while (1) |
830 | { | 838 | { |
831 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 839 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
832 | if (tuid == thishdr_uid) break; | 840 | if (tuid == thishdr_uid) break; |
833 | if (thishdr_type < 2) currentpos += thishdr_size; | 841 | if (thishdr_type < 2) currentpos += thishdr_size; |
834 | ////qDebug("hyper-cp:%u", currentpos); | 842 | // //odebug << "hyper-cp:" << currentpos << "" << oendl; |
835 | thisrec++; | 843 | thisrec++; |
836 | if (thisrec >= ntohs(head.recordList.numRecords)) | 844 | if (thisrec >= ntohs(head.recordList.numRecords)) |
837 | { | 845 | { |
838 | char *turl = geturl(tuid); | 846 | char *turl = geturl(tuid); |
839 | if (turl == NULL) | 847 | if (turl == NULL) |
840 | { | 848 | { |
841 | QMessageBox::information(NULL, | 849 | QMessageBox::information(NULL, |
842 | QString(PROGNAME), | 850 | QString(PROGNAME), |
843 | QString("Couldn't find link") | 851 | QString("Couldn't find link") |
844 | ); | 852 | ); |
845 | } | 853 | } |
846 | else | 854 | else |
847 | { | 855 | { |
848 | wrd = turl; | 856 | wrd = turl; |
849 | #ifdef USEQPE | 857 | #ifdef USEQPE |
850 | if (wrd.length() > 10) | 858 | if (wrd.length() > 10) |
851 | { | 859 | { |
852 | Global::statusMessage(wrd.left(8) + ".."); | 860 | Global::statusMessage(wrd.left(8) + ".."); |
853 | } | 861 | } |
854 | else | 862 | else |
855 | { | 863 | { |
856 | Global::statusMessage(wrd); | 864 | Global::statusMessage(wrd); |
857 | } | 865 | } |
858 | #else | 866 | #else |
859 | #endif /* USEQPE */ | 867 | #endif /* USEQPE */ |
860 | //qDebug("Link:%s", (const char*)wrd); | 868 | //odebug << "Link:" << wrd << "" << oendl; |
861 | // setlink(fn, wrd); | 869 | // setlink(fn, wrd); |
862 | delete [] turl; | 870 | delete [] turl; |
863 | } | 871 | } |
864 | return eNone; | 872 | return eNone; |
865 | } | 873 | } |
866 | gotorecordnumber(thisrec); | 874 | gotorecordnumber(thisrec); |
867 | } | 875 | } |
868 | if (thishdr_type > 1) | 876 | if (thishdr_type > 1) |
869 | { | 877 | { |
870 | if (thishdr_type == 4) | 878 | if (thishdr_type == 4) |
871 | { | 879 | { |
872 | QMessageBox::information(NULL, | 880 | QMessageBox::information(NULL, |
873 | QString(PROGNAME), | 881 | QString(PROGNAME), |
874 | QString("Mailto links\nnot yet supported (2)")); | 882 | QString("Mailto links\nnot yet supported (2)")); |
875 | } | 883 | } |
876 | else | 884 | else |
877 | { | 885 | { |
878 | if (thishdr_type > 3) | 886 | if (thishdr_type > 3) |
879 | { | 887 | { |
880 | QMessageBox::information(NULL, | 888 | QMessageBox::information(NULL, |
881 | QString(PROGNAME), | 889 | QString(PROGNAME), |
882 | QString("External links\nnot yet supported (2)") | 890 | QString("External links\nnot yet supported (2)") |
883 | ); | 891 | ); |
884 | return eNone; | 892 | return eNone; |
885 | } | 893 | } |
886 | else | 894 | else |
887 | { | 895 | { |
888 | #ifdef LOCALPICTURES | 896 | #ifdef LOCALPICTURES |
889 | showimg(tuid); | 897 | showimg(tuid); |
890 | #else | 898 | #else |
891 | return ePicture; | 899 | return ePicture; |
892 | #endif | 900 | #endif |
893 | } | 901 | } |
894 | } | 902 | } |
895 | return eNone; | 903 | return eNone; |
896 | } | 904 | } |
897 | /* | 905 | /* |
898 | if (thishdr_type == 2 || thishdr_type == 3) | 906 | if (thishdr_type == 2 || thishdr_type == 3) |
899 | { | 907 | { |
900 | expandimg(thisrec); | 908 | expandimg(thisrec); |
901 | 909 | ||
902 | } | 910 | } |
903 | */ | 911 | */ |
904 | else | 912 | else |
905 | { | 913 | { |
906 | expand(thisrec); | 914 | expand(thisrec); |
907 | if (n != 0) | 915 | if (n != 0) |
908 | { | 916 | { |
909 | if (n >= m_nParas) | 917 | if (n >= m_nParas) |
910 | { | 918 | { |
911 | QMessageBox::information(NULL, | 919 | QMessageBox::information(NULL, |
912 | QString(PROGNAME), | 920 | QString(PROGNAME), |
913 | QString("Error in link\nPara # too big") | 921 | QString("Error in link\nPara # too big") |
914 | ); | 922 | ); |
915 | return eNone; | 923 | return eNone; |
916 | } | 924 | } |
917 | unsigned int noff = 0; | 925 | unsigned int noff = 0; |
918 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; | 926 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; |
919 | n = noff; | 927 | n = noff; |
920 | } | 928 | } |
921 | if (n > thishdr_size) | 929 | if (n > thishdr_size) |
922 | { | 930 | { |
923 | QMessageBox::information(NULL, | 931 | QMessageBox::information(NULL, |
924 | QString(PROGNAME), | 932 | QString(PROGNAME), |
925 | QString("Error in link\nOffset too big") | 933 | QString("Error in link\nOffset too big") |
926 | ); | 934 | ); |
927 | return eNone; | 935 | return eNone; |
928 | } | 936 | } |
929 | //qDebug("Hyper:<%u,%u>", tuid, n); | 937 | //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl; |
930 | while (bufferpos < n && bufferpos < buffercontent) getch_base(true); | 938 | while (bufferpos < n && bufferpos < buffercontent) getch_base(true); |
931 | /* // This is faster but the alignment doesn't get set | 939 | /* // This is faster but the alignment doesn't get set |
932 | mystyle.unset(); | 940 | mystyle.unset(); |
933 | bufferpos = n; | 941 | bufferpos = n; |
934 | currentpos += n; | 942 | currentpos += n; |
935 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 943 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
936 | { | 944 | { |
937 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 945 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
938 | m_nextParaIndex++; | 946 | m_nextParaIndex++; |
939 | if (m_nextParaIndex == m_nParas) | 947 | if (m_nextParaIndex == m_nParas) |
940 | { | 948 | { |
941 | m_nextPara = -1; | 949 | m_nextPara = -1; |
942 | } | 950 | } |
943 | else | 951 | else |
944 | { | 952 | { |
945 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 953 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
946 | } | 954 | } |
947 | } | 955 | } |
948 | */ | 956 | */ |
949 | } | 957 | } |
950 | return eLink; | 958 | return eLink; |
@@ -955,278 +963,278 @@ tchar CPlucker_base::getch_base(bool fast) | |||
955 | int ch = bgetch(); | 963 | int ch = bgetch(); |
956 | while (ch == 0) | 964 | while (ch == 0) |
957 | { | 965 | { |
958 | ch = bgetch(); | 966 | ch = bgetch(); |
959 | ////qDebug("Function:%x", ch); | 967 | // //odebug << "Function:" << ch << "" << oendl; |
960 | switch (ch) | 968 | switch (ch) |
961 | { | 969 | { |
962 | case 0x38: | 970 | case 0x38: |
963 | // //qDebug("Break:%u", locate()); | 971 | // //odebug << "Break:" << locate() << "" << oendl; |
964 | if (m_lastBreak == locate()) | 972 | if (m_lastBreak == locate()) |
965 | { | 973 | { |
966 | ch = bgetch(); | 974 | ch = bgetch(); |
967 | } | 975 | } |
968 | else | 976 | else |
969 | { | 977 | { |
970 | ch = 10; | 978 | ch = 10; |
971 | } | 979 | } |
972 | m_lastBreak = locate(); | 980 | m_lastBreak = locate(); |
973 | break; | 981 | break; |
974 | case 0x0a: | 982 | case 0x0a: |
975 | case 0x0c: | 983 | case 0x0c: |
976 | { | 984 | { |
977 | unsigned long ln = 0; | 985 | unsigned long ln = 0; |
978 | int skip = ch & 7; | 986 | int skip = ch & 7; |
979 | for (int i = 0; i < 2; i++) | 987 | for (int i = 0; i < 2; i++) |
980 | { | 988 | { |
981 | int ch = bgetch(); | 989 | int ch = bgetch(); |
982 | ln = (ln << 8) + ch; | 990 | ln = (ln << 8) + ch; |
983 | // //qDebug("ch:%d, ln:%u", ch, ln); | 991 | // //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl; |
984 | } | 992 | } |
985 | if (skip == 2) | 993 | if (skip == 2) |
986 | { | 994 | { |
987 | ln <<= 16; | 995 | ln <<= 16; |
988 | } | 996 | } |
989 | else | 997 | else |
990 | { | 998 | { |
991 | for (int i = 0; i < 2; i++) | 999 | for (int i = 0; i < 2; i++) |
992 | { | 1000 | { |
993 | int ch = bgetch(); | 1001 | int ch = bgetch(); |
994 | ln = (ln << 8) + ch; | 1002 | ln = (ln << 8) + ch; |
995 | // //qDebug("ch:%d, ln:%u", ch, ln); | 1003 | // //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl; |
996 | } | 1004 | } |
997 | } | 1005 | } |
998 | // //qDebug("ln:%u", ln); | 1006 | // //odebug << "ln:" << ln << "" << oendl; |
999 | mystyle.setLink(true); | 1007 | mystyle.setLink(true); |
1000 | mystyle.setData(ln); | 1008 | mystyle.setData(ln); |
1001 | // mystyle.setColour(255, 0, 0); | 1009 | // mystyle.setColour(255, 0, 0); |
1002 | bool hasseen = false; | 1010 | bool hasseen = false; |
1003 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 1011 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
1004 | { | 1012 | { |
1005 | if (*it == ln) | 1013 | if (*it == ln) |
1006 | { | 1014 | { |
1007 | hasseen = true; | 1015 | hasseen = true; |
1008 | break; | 1016 | break; |
1009 | } | 1017 | } |
1010 | } | 1018 | } |
1011 | if (hasseen) | 1019 | if (hasseen) |
1012 | { | 1020 | { |
1013 | mystyle.setStrikethru(); | 1021 | mystyle.setStrikethru(); |
1014 | } | 1022 | } |
1015 | else | 1023 | else |
1016 | { | 1024 | { |
1017 | mystyle.setUnderline(); | 1025 | mystyle.setUnderline(); |
1018 | } | 1026 | } |
1019 | ch = bgetch(); | 1027 | ch = bgetch(); |
1020 | } | 1028 | } |
1021 | break; | 1029 | break; |
1022 | case 0x08: | 1030 | case 0x08: |
1023 | ch = bgetch(); | 1031 | ch = bgetch(); |
1024 | // mystyle.setColour(0, 0, 0); | 1032 | // mystyle.setColour(0, 0, 0); |
1025 | mystyle.unsetUnderline(); | 1033 | mystyle.unsetUnderline(); |
1026 | mystyle.unsetStrikethru(); | 1034 | mystyle.unsetStrikethru(); |
1027 | mystyle.setLink(false); | 1035 | mystyle.setLink(false); |
1028 | mystyle.setData(0); | 1036 | mystyle.setData(0); |
1029 | break; | 1037 | break; |
1030 | case 0x40: | 1038 | case 0x40: |
1031 | mystyle.setItalic(); | 1039 | mystyle.setItalic(); |
1032 | ch = bgetch(); | 1040 | ch = bgetch(); |
1033 | break; | 1041 | break; |
1034 | case 0x48: | 1042 | case 0x48: |
1035 | mystyle.unsetItalic(); | 1043 | mystyle.unsetItalic(); |
1036 | ch = bgetch(); | 1044 | ch = bgetch(); |
1037 | break; | 1045 | break; |
1038 | case 0x11: | 1046 | case 0x11: |
1039 | { | 1047 | { |
1040 | ch = bgetch(); | 1048 | ch = bgetch(); |
1041 | // //qDebug("Font:%d",ch); | 1049 | // //odebug << "Font:" << ch << "" << oendl; |
1042 | mystyle.setVOffset(0); | 1050 | mystyle.setVOffset(0); |
1043 | mystyle.unsetMono(); | 1051 | mystyle.unsetMono(); |
1044 | mystyle.unsetBold(); | 1052 | mystyle.unsetBold(); |
1045 | mystyle.setFontSize(0); | 1053 | mystyle.setFontSize(0); |
1046 | switch (ch) | 1054 | switch (ch) |
1047 | { | 1055 | { |
1048 | case 0: | 1056 | case 0: |
1049 | break; | 1057 | break; |
1050 | case 1: | 1058 | case 1: |
1051 | mystyle.setBold(); | 1059 | mystyle.setBold(); |
1052 | mystyle.setFontSize(3); | 1060 | mystyle.setFontSize(3); |
1053 | break; | 1061 | break; |
1054 | case 2: | 1062 | case 2: |
1055 | mystyle.setBold(); | 1063 | mystyle.setBold(); |
1056 | mystyle.setFontSize(2); | 1064 | mystyle.setFontSize(2); |
1057 | break; | 1065 | break; |
1058 | case 3: | 1066 | case 3: |
1059 | mystyle.setBold(); | 1067 | mystyle.setBold(); |
1060 | mystyle.setFontSize(1); | 1068 | mystyle.setFontSize(1); |
1061 | break; | 1069 | break; |
1062 | case 4: | 1070 | case 4: |
1063 | mystyle.setBold(); | 1071 | mystyle.setBold(); |
1064 | break; | 1072 | break; |
1065 | case 5: | 1073 | case 5: |
1066 | mystyle.setBold(); | 1074 | mystyle.setBold(); |
1067 | break; | 1075 | break; |
1068 | case 6: | 1076 | case 6: |
1069 | mystyle.setBold(); | 1077 | mystyle.setBold(); |
1070 | break; | 1078 | break; |
1071 | case 7: | 1079 | case 7: |
1072 | mystyle.setBold(); | 1080 | mystyle.setBold(); |
1073 | break; | 1081 | break; |
1074 | case 8: // should be fixed width | 1082 | case 8: // should be fixed width |
1075 | //qDebug("Trying fixed width"); | 1083 | //odebug << "Trying fixed width" << oendl; |
1076 | mystyle.setMono(); | 1084 | mystyle.setMono(); |
1077 | break; | 1085 | break; |
1078 | case 9: | 1086 | case 9: |
1079 | mystyle.setFontSize(-1); | 1087 | mystyle.setFontSize(-1); |
1080 | break; | 1088 | break; |
1081 | case 10: | 1089 | case 10: |
1082 | mystyle.setFontSize(-2); | 1090 | mystyle.setFontSize(-2); |
1083 | mystyle.setVOffset(1); | 1091 | mystyle.setVOffset(1); |
1084 | break; | 1092 | break; |
1085 | case 11: | 1093 | case 11: |
1086 | mystyle.setFontSize(-2); | 1094 | mystyle.setFontSize(-2); |
1087 | mystyle.setVOffset(-1); | 1095 | mystyle.setVOffset(-1); |
1088 | break; | 1096 | break; |
1089 | default: | 1097 | default: |
1090 | qDebug("Unrecognised font"); | 1098 | odebug << "Unrecognised font" << oendl; |
1091 | break; | 1099 | break; |
1092 | } | 1100 | } |
1093 | ch = bgetch(); | 1101 | ch = bgetch(); |
1094 | } | 1102 | } |
1095 | break; | 1103 | break; |
1096 | case 0x29: | 1104 | case 0x29: |
1097 | ch = bgetch(); | 1105 | ch = bgetch(); |
1098 | switch (ch) | 1106 | switch (ch) |
1099 | { | 1107 | { |
1100 | case 0: | 1108 | case 0: |
1101 | mystyle.setLeftJustify(); | 1109 | mystyle.setLeftJustify(); |
1102 | // //qDebug("left"); | 1110 | // //odebug << "left" << oendl; |
1103 | break; | 1111 | break; |
1104 | case 1: | 1112 | case 1: |
1105 | mystyle.setRightJustify(); | 1113 | mystyle.setRightJustify(); |
1106 | // //qDebug("right"); | 1114 | // //odebug << "right" << oendl; |
1107 | break; | 1115 | break; |
1108 | case 2: | 1116 | case 2: |
1109 | mystyle.setCentreJustify(); | 1117 | mystyle.setCentreJustify(); |
1110 | // //qDebug("centre"); | 1118 | // //odebug << "centre" << oendl; |
1111 | break; | 1119 | break; |
1112 | case 3: | 1120 | case 3: |
1113 | mystyle.setFullJustify(); | 1121 | mystyle.setFullJustify(); |
1114 | // //qDebug("full"); | 1122 | // //odebug << "full" << oendl; |
1115 | break; | 1123 | break; |
1116 | 1124 | ||
1117 | } | 1125 | } |
1118 | ch = bgetch(); | 1126 | ch = bgetch(); |
1119 | break; | 1127 | break; |
1120 | case 0x53: | 1128 | case 0x53: |
1121 | { | 1129 | { |
1122 | int r = bgetch(); | 1130 | int r = bgetch(); |
1123 | int g = bgetch(); | 1131 | int g = bgetch(); |
1124 | int b = bgetch(); | 1132 | int b = bgetch(); |
1125 | mystyle.setColour(r,g,b); | 1133 | mystyle.setColour(r,g,b); |
1126 | ch = bgetch(); | 1134 | ch = bgetch(); |
1127 | } | 1135 | } |
1128 | break; | 1136 | break; |
1129 | case 0x1a: | 1137 | case 0x1a: |
1130 | case 0x5c: | 1138 | case 0x5c: |
1131 | { | 1139 | { |
1132 | bool hasalternate = (ch == 0x5c); | 1140 | bool hasalternate = (ch == 0x5c); |
1133 | UInt16 ir = bgetch(); | 1141 | UInt16 ir = bgetch(); |
1134 | ir = (ir << 8) + bgetch(); | 1142 | ir = (ir << 8) + bgetch(); |
1135 | if (hasalternate) | 1143 | if (hasalternate) |
1136 | { | 1144 | { |
1137 | //qDebug("Alternate image:%x", ir); | 1145 | //odebug << "Alternate image:" << ir << "" << oendl; |
1138 | UInt16 ir2 = bgetch(); | 1146 | UInt16 ir2 = bgetch(); |
1139 | ir2 = (ir2 << 8) + bgetch(); | 1147 | ir2 = (ir2 << 8) + bgetch(); |
1140 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); | 1148 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); |
1141 | #ifdef LOCALPICTURES | 1149 | #ifdef LOCALPICTURES |
1142 | UInt32 ln = ir; | 1150 | UInt32 ln = ir; |
1143 | ln <<= 16; | 1151 | ln <<= 16; |
1144 | mystyle.setLink(true); | 1152 | mystyle.setLink(true); |
1145 | mystyle.setData(ln); | 1153 | mystyle.setData(ln); |
1146 | #endif | 1154 | #endif |
1147 | } | 1155 | } |
1148 | else | 1156 | else |
1149 | { | 1157 | { |
1150 | if (!fast) mystyle.setPicture(true, expandimg(ir)); | 1158 | if (!fast) mystyle.setPicture(true, expandimg(ir)); |
1151 | } | 1159 | } |
1152 | // if (mystyle.getLink()) qDebug("Picture link!"); | 1160 | // if (mystyle.getLink()) odebug << "Picture link!" << oendl; |
1153 | ch = '#'; | 1161 | ch = '#'; |
1154 | } | 1162 | } |
1155 | // ch = bgetch(); | 1163 | // ch = bgetch(); |
1156 | break; | 1164 | break; |
1157 | case 0x33: | 1165 | case 0x33: |
1158 | { | 1166 | { |
1159 | UInt8 h = bgetch(); | 1167 | UInt8 h = bgetch(); |
1160 | UInt8 wc = bgetch(); | 1168 | UInt8 wc = bgetch(); |
1161 | UInt8 pc = bgetch(); | 1169 | UInt8 pc = bgetch(); |
1162 | UInt16 w = wc; | 1170 | UInt16 w = wc; |
1163 | // //qDebug("h,w,pc [%u, %u, %u]", h, w, pc); | 1171 | // //odebug << "h,w,pc [" << h << ", " << w << ", " << pc << "]" << oendl; |
1164 | if (w == 0) | 1172 | if (w == 0) |
1165 | { | 1173 | { |
1166 | w = (m_scrWidth*(unsigned long)pc)/100; | 1174 | w = (m_scrWidth*(unsigned long)pc)/100; |
1167 | } | 1175 | } |
1168 | if (w == 0) w = m_scrWidth; | 1176 | if (w == 0) w = m_scrWidth; |
1169 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); | 1177 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); |
1170 | // if (mystyle.getLink()) //qDebug("hRule link!"); | 1178 | // if (mystyle.getLink()) //odebug << "hRule link!" << oendl; |
1171 | ch = '#'; | 1179 | ch = '#'; |
1172 | } | 1180 | } |
1173 | break; | 1181 | break; |
1174 | case 0x60: | 1182 | case 0x60: |
1175 | mystyle.setUnderline(); | 1183 | mystyle.setUnderline(); |
1176 | ch = bgetch(); | 1184 | ch = bgetch(); |
1177 | break; | 1185 | break; |
1178 | case 0x68: | 1186 | case 0x68: |
1179 | mystyle.unsetUnderline(); | 1187 | mystyle.unsetUnderline(); |
1180 | ch = bgetch(); | 1188 | ch = bgetch(); |
1181 | break; | 1189 | break; |
1182 | case 0x22: | 1190 | case 0x22: |
1183 | ch = bgetch(); | 1191 | ch = bgetch(); |
1184 | mystyle.setLeftMargin(ch); | 1192 | mystyle.setLeftMargin(ch); |
1185 | // //qDebug("Left margin:%d", ch); | 1193 | // //odebug << "Left margin:" << ch << "" << oendl; |
1186 | ch = bgetch(); | 1194 | ch = bgetch(); |
1187 | mystyle.setRightMargin(ch); | 1195 | mystyle.setRightMargin(ch); |
1188 | // //qDebug("Right margin:%d", ch); | 1196 | // //odebug << "Right margin:" << ch << "" << oendl; |
1189 | ch = bgetch(); | 1197 | ch = bgetch(); |
1190 | break; | 1198 | break; |
1191 | case 0x70: | 1199 | case 0x70: |
1192 | mystyle.setStrikethru(); | 1200 | mystyle.setStrikethru(); |
1193 | ch = bgetch(); | 1201 | ch = bgetch(); |
1194 | break; | 1202 | break; |
1195 | case 0x78: | 1203 | case 0x78: |
1196 | mystyle.unsetStrikethru(); | 1204 | mystyle.unsetStrikethru(); |
1197 | ch = bgetch(); | 1205 | ch = bgetch(); |
1198 | break; | 1206 | break; |
1199 | case 0x83: | 1207 | case 0x83: |
1200 | { | 1208 | { |
1201 | int tlen = bgetch(); | 1209 | int tlen = bgetch(); |
1202 | ch = bgetch(); | 1210 | ch = bgetch(); |
1203 | ch <<= 8; | 1211 | ch <<= 8; |
1204 | ch |= (tchar)bgetch(); | 1212 | ch |= (tchar)bgetch(); |
1205 | for (int i = 0; i < tlen; i++) bgetch(); | 1213 | for (int i = 0; i < tlen; i++) bgetch(); |
1206 | //qDebug("Function 83"); | 1214 | //odebug << "Function 83" << oendl; |
1207 | } | 1215 | } |
1208 | break; | 1216 | break; |
1209 | case 0x85: | 1217 | case 0x85: |
1210 | default: | 1218 | default: |
1211 | qDebug("Function:%x NOT IMPLEMENTED", ch); | 1219 | odebug << "Function:" << ch << " NOT IMPLEMENTED" << oendl; |
1212 | { | 1220 | { |
1213 | int skip = ch & 7; | 1221 | int skip = ch & 7; |
1214 | for (int i = 0; i < skip; i++) | 1222 | for (int i = 0; i < skip; i++) |
1215 | { | 1223 | { |
1216 | ch = bgetch(); | 1224 | ch = bgetch(); |
1217 | //qDebug("Arg %d, %d", i, ch); | 1225 | //odebug << "Arg " << i << ", " << ch << "" << oendl; |
1218 | } | 1226 | } |
1219 | ch = bgetch(); | 1227 | ch = bgetch(); |
1220 | } | 1228 | } |
1221 | } | 1229 | } |
1222 | } | 1230 | } |
1223 | 1231 | ||
1224 | if (m_lastIsBreak && !mystyle.isMono()) | 1232 | if (m_lastIsBreak && !mystyle.isMono()) |
1225 | { | 1233 | { |
1226 | while (ch == ' ') | 1234 | while (ch == ' ') |
1227 | { | 1235 | { |
1228 | ch = getch(false); | 1236 | ch = getch(false); |
1229 | } | 1237 | } |
1230 | } | 1238 | } |
1231 | 1239 | ||
1232 | m_lastIsBreak = (ch == 10); | 1240 | m_lastIsBreak = (ch == 10); |