summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/BuffDoc.h116
-rw-r--r--noncore/apps/opie-reader/CEncoding.h16
-rw-r--r--noncore/apps/opie-reader/CExpander.h140
-rw-r--r--noncore/apps/opie-reader/Filedata.h56
-rw-r--r--noncore/apps/opie-reader/FontControl.h178
-rw-r--r--noncore/apps/opie-reader/Palm2QImage.cpp125
-rw-r--r--noncore/apps/opie-reader/QTReader.h124
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.h112
8 files changed, 439 insertions, 428 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h
index 29d0329..61531c0 100644
--- a/noncore/apps/opie-reader/BuffDoc.h
+++ b/noncore/apps/opie-reader/BuffDoc.h
@@ -23,20 +23,20 @@ class BuffDoc
23 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) 23 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
24 { 24 {
25 if (exp == NULL) 25 if (exp == NULL)
26 { 26 {
27 data = NULL; 27 data = NULL;
28 len = 0; 28 len = 0;
29 } 29 }
30 else 30 else
31 { 31 {
32 exp->setSaveData(data, len, src, srclen); 32 exp->setSaveData(data, len, src, srclen);
33 } 33 }
34 } 34 }
35 void putSaveData(unsigned char*& src, unsigned short& srclen) 35 void putSaveData(unsigned char*& src, unsigned short& srclen)
36 { 36 {
37 if (exp != NULL) 37 if (exp != NULL)
38 { 38 {
39 exp->putSaveData(src, srclen); 39 exp->putSaveData(src, srclen);
40 } 40 }
41 } 41 }
42#ifdef USEQPE 42#ifdef USEQPE
@@ -49,20 +49,20 @@ class BuffDoc
49 ~BuffDoc() 49 ~BuffDoc()
50 { 50 {
51 delete filt; 51 delete filt;
52 delete exp; 52 delete exp;
53 } 53 }
54 BuffDoc() 54 BuffDoc()
55 { 55 {
56 exp = NULL; 56 exp = NULL;
57 filt = NULL; 57 filt = NULL;
58 lastword.empty(); 58 lastword.empty();
59 // // qDebug("Buffdoc created"); 59 // odebug << "Buffdoc created" << oendl;
60 } 60 }
61 bool empty() { return (exp == NULL); } 61 bool empty() { return (exp == NULL); }
62 void setfilter(CFilterChain* _f) 62 void setfilter(CFilterChain* _f)
63 { 63 {
64 if (filt != NULL) delete filt; 64 if (filt != NULL) delete filt;
65 filt = _f; 65 filt = _f;
66 filt->setsource(exp); 66 filt->setsource(exp);
67 } 67 }
68 CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } 68 CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); }
@@ -72,20 +72,20 @@ class BuffDoc
72 tchar getch() 72 tchar getch()
73 { 73 {
74 tchar ch = UEOF; 74 tchar ch = UEOF;
75 CStyle sty; 75 CStyle sty;
76 if (exp != NULL) 76 if (exp != NULL)
77 { 77 {
78 filt->getch(ch, sty); 78 filt->getch(ch, sty);
79 } 79 }
80 return ch; 80 return ch;
81 } 81 }
82 void getch(tchar& ch, CStyle& sty) 82 void getch(tchar& ch, CStyle& sty)
83 { 83 {
84 if (exp != NULL) 84 if (exp != NULL)
85 { 85 {
86 filt->getch(ch, sty); 86 filt->getch(ch, sty);
87 } 87 }
88 else 88 else
89 ch = UEOF; 89 ch = UEOF;
90 } 90 }
91 void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } 91 void setwidth(int w) { if (exp != NULL) exp->setwidth(w); }
@@ -105,11 +105,11 @@ class BuffDoc
105 int getpara(CBuffer& buff) 105 int getpara(CBuffer& buff)
106 { 106 {
107 tchar ch; 107 tchar ch;
108 int i = 0; 108 int i = 0;
109 while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; 109 while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch;
110 buff[i] = '\0'; 110 buff[i] = '\0';
111 if (i == 0 && ch == UEOF) i = -1; 111 if (i == 0 && ch == UEOF) i = -1;
112 laststartline = exp->locate(); 112 laststartline = exp->locate();
113 return i; 113 return i;
114 } 114 }
115 void saveposn(size_t posn) { exp->saveposn(posn); } 115 void saveposn(size_t posn) { exp->saveposn(posn); }
diff --git a/noncore/apps/opie-reader/CEncoding.h b/noncore/apps/opie-reader/CEncoding.h
index 463fba9..df0104a 100644
--- a/noncore/apps/opie-reader/CEncoding.h
+++ b/noncore/apps/opie-reader/CEncoding.h
@@ -62,11 +62,11 @@ class CGeneral8Bit : public CEncoding
62 CGeneral8Bit(int _i) : m_index(_i) 62 CGeneral8Bit(int _i) : m_index(_i)
63 { 63 {
64 // qDebug("8Bit:%d", _i); 64// odebug << "8Bit: " << _i << oendl;
65 // qDebug("%s", unicodetable::iterator(_i)->mime); 65// odebug << unicodetable::iterator(_i)->mime << oendl;
66 } 66 }
67 void getch(tchar& ch, CStyle& sty) 67 void getch(tchar& ch, CStyle& sty)
68 { 68 {
69 parent->getch(ch, sty); 69 parent->getch(ch, sty);
70 ch = unicodetable::unicodevalue(m_index, ch); 70 ch = unicodetable::unicodevalue(m_index, ch);
71 } 71 }
72}; 72};
diff --git a/noncore/apps/opie-reader/CExpander.h b/noncore/apps/opie-reader/CExpander.h
index 7b21d3e..9fae245 100644
--- a/noncore/apps/opie-reader/CExpander.h
+++ b/noncore/apps/opie-reader/CExpander.h
@@ -42,3 +42,3 @@ class CExpander
42#ifdef USEQPE 42#ifdef USEQPE
43 virtual void suspend() = 0; 43 virtual void suspend() = 0;
44 virtual void unsuspend() = 0; 44 virtual void unsuspend() = 0;
@@ -49,7 +49,7 @@ class CExpander
49 int openfile(const char *src) 49 int openfile(const char *src)
50 { 50 {
51 bSuspended = false; 51 bSuspended = false;
52 fname = strdup(src); 52 fname = strdup(src);
53 return OpenFile(src); 53 return OpenFile(src);
54 } 54 }
55 virtual int OpenFile(const char *src) = 0; 55 virtual int OpenFile(const char *src) = 0;
@@ -61,13 +61,13 @@ class CExpander
61 virtual void getch(tchar& ch, CStyle& sty) 61 virtual void getch(tchar& ch, CStyle& sty)
62 { 62 {
63 int ich = getch(); 63 int ich = getch();
64 ch = (ich == EOF) ? UEOF : ich; 64 ch = (ich == EOF) ? UEOF : ich;
65 sty.unset(); 65 sty.unset();
66 } 66 }
67 virtual int getch() = 0; 67 virtual int getch() = 0;
68 virtual linkType hyperlink(unsigned int n, QString& wrd) 68 virtual linkType hyperlink(unsigned int n, QString& wrd)
69 { 69 {
70 locate(n); 70 locate(n);
71 return eLink; 71 return eLink;
72 } 72 }
73 virtual MarkupType PreferredMarkup() = 0; 73 virtual MarkupType PreferredMarkup() = 0;
@@ -79,25 +79,25 @@ class CExpander
79 unsigned long startSection() 79 unsigned long startSection()
80 { 80 {
81 unsigned long current = locate(); 81 unsigned long current = locate();
82 if (m_currentstart > current || current > m_currentend) 82 if (m_currentstart > current || current > m_currentend)
83 { 83 {
84 start2endSection(); 84 start2endSection();
85 } 85 }
86 return m_currentstart; 86 return m_currentstart;
87 } 87 }
88 unsigned long endSection() 88 unsigned long endSection()
89 { 89 {
90 unsigned long current = locate(); 90 unsigned long current = locate();
91 if (m_currentstart > current || current > m_currentend) 91 if (m_currentstart > current || current > m_currentend)
92 { 92 {
93 start2endSection(); 93 start2endSection();
94 } 94 }
95 return m_currentend; 95 return m_currentend;
96 } 96 }
97 virtual void start2endSection() 97 virtual void start2endSection()
98 { 98 {
99 m_currentstart = 0; 99 m_currentstart = 0;
100 unsigned long file; 100 unsigned long file;
101 sizes(file, m_currentend); 101 sizes(file, m_currentend);
102 } 102 }
103 virtual QImage* getPicture(unsigned long tgt) { return NULL; } 103 virtual QImage* getPicture(unsigned long tgt) { return NULL; }
@@ -107,7 +107,7 @@ class CExpander
107 { 107 {
108 bSuspended = true; 108 bSuspended = true;
109 suspos = ftell(fin); 109 suspos = ftell(fin);
110 fclose(fin); 110 fclose(fin);
111 fin = NULL; 111 fin = NULL;
112 sustime = time(NULL); 112 sustime = time(NULL);
113 } 113 }
@@ -115,20 +115,20 @@ class CExpander
115 { 115 {
116 if (bSuspended) 116 if (bSuspended)
117 { 117 {
118 bSuspended = false; 118 bSuspended = false;
119 int delay = time(NULL) - sustime; 119 int delay = time(NULL) - sustime;
120 if (delay < 10) sleep(10-delay); 120 if (delay < 10) sleep(10-delay);
121 fin = fopen(fname, "rb"); 121 fin = fopen(fname, "rb");
122 for (int i = 0; fin == NULL && i < 5; i++) 122 for (int i = 0; fin == NULL && i < 5; i++)
123 { 123 {
124 sleep(5); 124 sleep(5);
125 fin = fopen(fname, "rb"); 125 fin = fopen(fname, "rb");
126 } 126 }
127 if (fin == NULL) 127 if (fin == NULL)
128 { 128 {
129 QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); 129 QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
130 exit(0); 130 exit(0);
131 } 131 }
132 suspos = fseek(fin, suspos, SEEK_SET); 132 suspos = fseek(fin, suspos, SEEK_SET);
133 } 133 }
134 } 134 }
@@ -136,14 +136,14 @@ class CExpander
136 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)
137 { 137 {
138 len = srclen; 138 len = srclen;
139 data = new unsigned char[len]; 139 data = new unsigned char[len];
140 memcpy(data, src, len); 140 memcpy(data, src, len);
141 } 141 }
142 virtual void putSaveData(unsigned char*& src, unsigned short& srclen) 142 virtual void putSaveData(unsigned char*& src, unsigned short& srclen)
143 { 143 {
144 if (srclen != 0) 144 if (srclen != 0)
145 { 145 {
146 qDebug("Don't know what to do with non-zero save data"); 146 qDebug("Don't know what to do with non-zero save data");
147 } 147 }
148 } 148 }
149 void setwidth(int w) { m_scrWidth = w; } 149 void setwidth(int w) { m_scrWidth = w; }
diff --git a/noncore/apps/opie-reader/Filedata.h b/noncore/apps/opie-reader/Filedata.h
index 096dd31..1b85b71 100644
--- a/noncore/apps/opie-reader/Filedata.h
+++ b/noncore/apps/opie-reader/Filedata.h
@@ -11,26 +11,26 @@ class CFiledata
11 CFiledata(tchar* d) 11 CFiledata(tchar* d)
12 { 12 {
13 data = (unsigned char*)d; 13 data = (unsigned char*)d;
14 m_own = false; 14 m_own = false;
15 } 15 }
16 CFiledata(time_t dt, tchar* nm) 16 CFiledata(time_t dt, tchar* nm)
17 { 17 {
18 int nlen = ustrlen(nm)+1; 18 int nlen = ustrlen(nm)+1;
19 data = new unsigned char[sizeof(time_t)+sizeof(tchar)*nlen]; 19 data = new unsigned char[sizeof(time_t)+sizeof(tchar)*nlen];
20 *((time_t *)data) = dt; 20 *((time_t *)data) = dt;
21 memcpy(data+sizeof(time_t), nm, sizeof(tchar)*nlen); 21 memcpy(data+sizeof(time_t), nm, sizeof(tchar)*nlen);
22 m_own = true; 22 m_own = true;
23 } 23 }
24 ~CFiledata() 24 ~CFiledata()
25 { 25 {
26 if (m_own && data != NULL) 26 if (m_own && data != NULL)
27 { 27 {
28 delete [] data; 28 delete [] data;
29 // qDebug("~Filedata: deleting"); 29// odebug << "~Filedata: deleting" << oendl;
30 } 30 }
31 else 31 else
32 { 32 {
33 // qDebug("~Filedata: not deleting"); 33// odebug << "~Filedata: not deleting" << oendl;
34 } 34 }
35 } 35 }
36 tchar* name() const { return (tchar*)(data+sizeof(time_t)); } 36 tchar* name() const { return (tchar*)(data+sizeof(time_t)); }
@@ -41,9 +41,9 @@ class CFiledata
41 bool operator==(const CFiledata& rhs) 41 bool operator==(const CFiledata& rhs)
42 { 42 {
43 return ((length() == rhs.length()) && (memcmp(data, rhs.data, length()) == 0)); 43 return ((length() == rhs.length()) && (memcmp(data, rhs.data, length()) == 0));
44 } 44 }
45 bool samename(const CFiledata& rhs) 45 bool samename(const CFiledata& rhs)
46 { 46 {
47 return (ustrcmp((tchar *)(data+sizeof(time_t)),(tchar *)(rhs.data+sizeof(time_t))) == 0); 47 return (ustrcmp((tchar *)(data+sizeof(time_t)),(tchar *)(rhs.data+sizeof(time_t))) == 0);
48 } 48 }
49}; 49};
diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h
index 5681496..e56b619 100644
--- a/noncore/apps/opie-reader/FontControl.h
+++ b/noncore/apps/opie-reader/FontControl.h
@@ -22,16 +22,16 @@ class FontControl
22 FontControl(QString n = "helvetica", int size = 10) 22 FontControl(QString n = "helvetica", int size = 10)
23 : 23 :
24 m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) 24 m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0)
25 { 25 {
26 ChangeFont(n, size); 26 ChangeFont(n, size);
27 } 27 }
28 ~FontControl() 28 ~FontControl()
29 { 29 {
30 if (m_fontsizes != NULL) delete [] m_fontsizes; 30 if (m_fontsizes != NULL) delete [] m_fontsizes;
31 } 31 }
32 void hasCourier(bool _b, const QString& _nm) 32 void hasCourier(bool _b, const QString& _nm)
33 { 33 {
34 m_hasCourier = _b; 34 m_hasCourier = _b;
35 m_fixedfontname = _nm; 35 m_fixedfontname = _nm;
36 } 36 }
37 QString& fixedfontname() { return m_fixedfontname; } 37 QString& fixedfontname() { return m_fixedfontname; }
@@ -41,19 +41,19 @@ class FontControl
41 int getsize(const CStyle& size) 41 int getsize(const CStyle& size)
42 { 42 {
43 int tgt = m_size+size.getFontSize(); 43 int tgt = m_size+size.getFontSize();
44 if (tgt < 0) 44 if (tgt < 0)
45 { 45 {
46 tgt = 0; 46 tgt = 0;
47 } 47 }
48 if (tgt >= m_maxsize) 48 if (tgt >= m_maxsize)
49 { 49 {
50 tgt = m_maxsize - 1; 50 tgt = m_maxsize - 1;
51 } 51 }
52 return m_fontsizes[tgt]; 52 return m_fontsizes[tgt];
53 } 53 }
54 int ascent() 54 int ascent()
55 { 55 {
56 QFont f(name(), currentsize()); 56 QFont f(name(), currentsize());
57 QFontMetrics fm(f); 57 QFontMetrics fm(f);
58 return fm.ascent(); 58 return fm.ascent();
59 } 59 }
@@ -61,5 +61,5 @@ class FontControl
61 { 61 {
62 QFont f(name(), getsize(ch)); 62 QFont f(name(), getsize(ch));
63 QFontMetrics fm(f); 63 QFontMetrics fm(f);
64 return fm.ascent(); 64 return fm.ascent();
65 } 65 }
@@ -67,5 +67,5 @@ class FontControl
67 { 67 {
68 QFont f(name(), currentsize()); 68 QFont f(name(), currentsize());
69 QFontMetrics fm(f); 69 QFontMetrics fm(f);
70 return fm.descent(); 70 return fm.descent();
71 } 71 }
@@ -73,5 +73,5 @@ class FontControl
73 { 73 {
74 QFont f(name(), getsize(ch)); 74 QFont f(name(), getsize(ch));
75 QFontMetrics fm(f); 75 QFontMetrics fm(f);
76 return fm.descent(); 76 return fm.descent();
77 } 77 }
@@ -79,5 +79,5 @@ class FontControl
79 { 79 {
80 QFont f(name(), currentsize()); 80 QFont f(name(), currentsize());
81 QFontMetrics fm(f); 81 QFontMetrics fm(f);
82 return fm.lineSpacing(); 82 return fm.lineSpacing();
83 } 83 }
@@ -85,67 +85,67 @@ class FontControl
85 { 85 {
86 QFont f(name(), getsize(ch)); 86 QFont f(name(), getsize(ch));
87 QFontMetrics fm(f); 87 QFontMetrics fm(f);
88 return fm.lineSpacing(); 88 return fm.lineSpacing();
89 } 89 }
90 bool decreasesize() 90 bool decreasesize()
91 { 91 {
92/* 92/*
93 if (--m_size < 0) 93 if (--m_size < 0)
94 { 94 {
95 m_size = 0; 95 m_size = 0;
96 return false; 96 return false;
97 } 97 }
98 else return true; 98 else return true;
99*/ 99*/
100 if (g_size-- == m_size) 100 if (g_size-- == m_size)
101 { 101 {
102 if (--m_size < 0) 102 if (--m_size < 0)
103 { 103 {
104 m_size = 0; 104 m_size = 0;
105 } 105 }
106 } 106 }
107 // qDebug("Font:%d Graphics:%d", m_size, g_size); 107// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
108 return true; 108 return true;
109 } 109 }
110 bool increasesize() 110 bool increasesize()
111 { 111 {
112/* 112/*
113 if (++m_size >= m_maxsize) 113 if (++m_size >= m_maxsize)
114 { 114 {
115 m_size = m_maxsize - 1; 115 m_size = m_maxsize - 1;
116 return false; 116 return false;
117 } 117 }
118 else return true; 118 else return true;
119*/ 119*/
120 if (g_size++ == m_size) 120 if (g_size++ == m_size)
121 { 121 {
122 if (++m_size >= m_maxsize) 122 if (++m_size >= m_maxsize)
123 { 123 {
124 m_size = m_maxsize - 1; 124 m_size = m_maxsize - 1;
125 } 125 }
126 } 126 }
127 // qDebug("Font:%d Graphics:%d", m_size, g_size); 127// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
128 return true; 128 return true;
129 } 129 }
130 bool ChangeFont(QString& n) 130 bool ChangeFont(QString& n)
131 { 131 {
132 return ChangeFont(n, currentsize()); 132 return ChangeFont(n, currentsize());
133 } 133 }
134 bool ChangeFont(QString& n, int tgt); 134 bool ChangeFont(QString& n, int tgt);
135 void setlead(int _lead) 135 void setlead(int _lead)
136 { 136 {
137 m_leading = _lead; 137 m_leading = _lead;
138 } 138 }
139 int getlead() 139 int getlead()
140 { 140 {
141 return m_leading; 141 return m_leading;
142 } 142 }
143 void setextraspace(int _lead) 143 void setextraspace(int _lead)
144 { 144 {
145 m_extraspace = _lead; 145 m_extraspace = _lead;
146 } 146 }
147 int getextraspace() 147 int getextraspace()
148 { 148 {
149 return m_extraspace; 149 return m_extraspace;
150 } 150 }
151}; 151};
diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp
index 9339595..b0d4e00 100644
--- a/noncore/apps/opie-reader/Palm2QImage.cpp
+++ b/noncore/apps/opie-reader/Palm2QImage.cpp
@@ -1,2 +1,10 @@
1/* -*- mode: c; indent-tabs-mode: nil; -*- */ 1/* -*- mode: c; indent-tabs-mode: nil; -*- */
2
3/* OPIE */
4#include <opie2/odebug.h>
5
6/* QT */
7#include <qimage.h>
8
9/* STD */
2#include <stdio.h> 10#include <stdio.h>
@@ -11,3 +19,2 @@
11 19
12#include <qimage.h>
13 20
@@ -44,6 +51,6 @@ typedef struct {
44static ColorMapEntry Palm8BitColormap[] = { 51static ColorMapEntry Palm8BitColormap[] = {
45 { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, 52 { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 },
46 { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, 53 { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 },
47 { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, 54 { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 },
48 { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, 55 { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 },
49 { 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 }, 56 { 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 },
@@ -141,5 +148,7 @@ QImage* Palm2QImage
141 /* bytes 14 and 15 are reserved by Palm and always 0 */ 148 /* bytes 14 and 15 are reserved by Palm and always 0 */
142 149
143#if 0 150#if 0
144// qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); 151// odebug << "Palm image is " << width << "x" << height
152// << ", " << bits_per_pixel << " bpp, version " << version
153// << ", flags 0x" << flags << ", compression " << compression_type << oendl;
145#endif 154#endif
@@ -147,3 +156,3 @@ QImage* Palm2QImage
147 if (compression_type == PALM_COMPRESSION_PACKBITS) { 156 if (compression_type == PALM_COMPRESSION_PACKBITS) {
148// qDebug ("Image uses packbits compression; not yet supported"); 157// odebug << "Image uses packbits compression; not yet supported" << oendl;
149 return NULL; 158 return NULL;
@@ -152,3 +161,3 @@ QImage* Palm2QImage
152 (compression_type != PALM_COMPRESSION_SCANLINE)) { 161 (compression_type != PALM_COMPRESSION_SCANLINE)) {
153// qDebug ("Image uses unknown compression, code 0x%x", compression_type); 162// odebug << "Image uses unknown compression, code 0x" << compression_type << oendl;
154 return NULL; 163 return NULL;
@@ -157,3 +166,3 @@ QImage* Palm2QImage
157 /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: 166 /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps:
158 167
159 1, 2, or 4 bit grayscale 168 1, 2, or 4 bit grayscale
@@ -162,6 +171,6 @@ QImage* Palm2QImage
162 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue 171 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue
163 172
164 Each of these can be compressed with one of four compression schemes, 173 Each of these can be compressed with one of four compression schemes,
165 "RLE", "Scanline", "PackBits", or none. 174 "RLE", "Scanline", "PackBits", or none.
166 175
167 We begin by constructing the colormap. 176 We begin by constructing the colormap.
@@ -170,3 +179,3 @@ QImage* Palm2QImage
170 if (flags & PALM_HAS_COLORMAP_FLAG) { 179 if (flags & PALM_HAS_COLORMAP_FLAG) {
171// qDebug("Palm images with custom colormaps are not currently supported.\n"); 180// odebug << "Palm images with custom colormaps are not currently supported." << oendl;
172 return NULL; 181 return NULL;
@@ -189,5 +198,6 @@ QImage* Palm2QImage
189 palm_blue_bits = palmimage[18]; 198 palm_blue_bits = palmimage[18];
190// qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); 199// odebug << "Bits:" << palm_red_bits << ", " << palm_green_bits << ", " << palm_blue_bits << oendl;
191 if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { 200 if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) {
192// qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); 201// odebug << "Can't handle this format DirectColor image -- too wide in some color ("
202// << palm_red_bits << ":" << palm_green_bits << ":" << palm_blue_bits << oendl;
193 return NULL; 203 return NULL;
@@ -195,3 +205,4 @@ QImage* Palm2QImage
195 if (bits_per_pixel > (8 * sizeof(unsigned long))) { 205 if (bits_per_pixel > (8 * sizeof(unsigned long))) {
196// qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); 206// odebug << "Can't handle this format DirectColor image -- too many bits per pixel ("
207// << bits_per_pixel << ")" << oendl;
197 return NULL; 208 return NULL;
@@ -200,3 +211,3 @@ QImage* Palm2QImage
200 } else { 211 } else {
201// qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); 212// odebug << "Unknown bits-per-pixel of " << bits_per_pixel << " encountered" << oendl;
202 return NULL; 213 return NULL;
@@ -215,3 +226,4 @@ QImage* Palm2QImage
215 for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { 226 for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) {
216// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); 227// odebug << "inval:" << inval << " palm_ptr:" << palm_ptr << " x_ptr:" << x_ptr
228// << " bpr:" << bytes_per_row << oendl;
217 229
@@ -220,6 +232,6 @@ QImage* Palm2QImage
220 for (j = 0; j < bytes_per_row; ) { 232 for (j = 0; j < bytes_per_row; ) {
221 incount = *palm_ptr++; 233 incount = *palm_ptr++;
222 inval = *palm_ptr++; 234 inval = *palm_ptr++;
223 memset(rowbuf + j, inval, incount); 235 memset(rowbuf + j, inval, incount);
224 j += incount; 236 j += incount;
225 } 237 }
@@ -227,10 +239,10 @@ QImage* Palm2QImage
227 for (j = 0; j < bytes_per_row; j += 8) { 239 for (j = 0; j < bytes_per_row; j += 8) {
228 incount = *palm_ptr++; 240 incount = *palm_ptr++;
229 inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; 241 inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8;
230 for (inbit = 0; inbit < inval; inbit += 1) { 242 for (inbit = 0; inbit < inval; inbit += 1) {
231 if (incount & (1 << (7 - inbit))) 243 if (incount & (1 << (7 - inbit)))
232 rowbuf[j + inbit] = *palm_ptr++; 244 rowbuf[j + inbit] = *palm_ptr++;
233 else 245 else
234 rowbuf[j + inbit] = lastrow[j + inbit]; 246 rowbuf[j + inbit] = lastrow[j + inbit];
235 } 247 }
236 } 248 }
@@ -245,8 +257,8 @@ QImage* Palm2QImage
245 else { 257 else {
246 qDebug("Case 4"); 258 odebug << "Case 4" << oendl;
247 qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); 259 odebug << "Is compressed:" << (((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true") << oendl;
248 qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); 260 odebug << "Has colourmap:" << (((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true") << oendl;
249 qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); 261 odebug << "Has transparency:" << (((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true") << oendl;
250 qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); 262 odebug << "Direct colour:" << (((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true") << oendl;
251 qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); 263 odebug << "four byte field:" << (((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true") << oendl;
252 memcpy (rowbuf, palm_ptr, bytes_per_row); 264 memcpy (rowbuf, palm_ptr, bytes_per_row);
@@ -258,14 +270,14 @@ QImage* Palm2QImage
258 for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { 270 for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) {
259 inval = ((*inbyte) & (mask << inbit)) >> inbit; 271 inval = ((*inbyte) & (mask << inbit)) >> inbit;
260 /* correct for oddity of the 8-bit color Palm pixmap... */ 272 /* correct for oddity of the 8-bit color Palm pixmap... */
261 if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; 273 if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231;
262 /* now lookup the correct color and set the pixel in the GTK bitmap */ 274 /* now lookup the correct color and set the pixel in the GTK bitmap */
263 QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); 275 QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue);
264 qimage->setPixel(j, i, colour); 276 qimage->setPixel(j, i, colour);
265 if (!inbit) { 277 if (!inbit) {
266 ++inbyte; 278 ++inbyte;
267 inbit = 8 - bits_per_pixel; 279 inbit = 8 - bits_per_pixel;
268 } else { 280 } else {
269 inbit -= bits_per_pixel; 281 inbit -= bits_per_pixel;
270 } 282 }
271 } 283 }
@@ -274,13 +286,12 @@ QImage* Palm2QImage
274 for (inbyte = rowbuf, j = 0; j < width; ++j) { 286 for (inbyte = rowbuf, j = 0; j < width; ++j) {
275 inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1]; 287 inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1];
276 288
277/* 289/*
278 qDebug ("pixel is %d,%d (%d:%d:%d)", 290 odebug << "pixel is " << j << "," << i << " ("
279 j, i, 291 << (((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits)) << ":"
280 ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), 292 << (((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits)) << ":"
281 ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), 293 << (((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)) << ")" << oendl;
282 ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits));
283*/ 294*/
284 QRgb colour = qRgb( 295 QRgb colour = qRgb(
285 ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), 296 ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits),
286 ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), 297 ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits),
@@ -288,3 +299,3 @@ QImage* Palm2QImage
288 qimage->setPixel(j, i, colour); 299 qimage->setPixel(j, i, colour);
289 inbyte += 2; 300 inbyte += 2;
290 } 301 }
@@ -301,3 +312,3 @@ QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b)
301{ 312{
302//// qDebug("hrule [%d, %d]", w, h); 313// odebug << "hrule [" << w << ", " << h << "]" << oendl;
303 QPixmap* qimage = new QPixmap(w, h); 314 QPixmap* qimage = new QPixmap(w, h);
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h
index dfbdfb9..f89de63 100644
--- a/noncore/apps/opie-reader/QTReader.h
+++ b/noncore/apps/opie-reader/QTReader.h
@@ -23,4 +23,4 @@ class QTReader : public QWidget
23 23
24 static tchar pluckernextpart[]; 24 static tchar pluckernextpart[];
25 static tchar jplucknextpart[]; 25 static tchar jplucknextpart[];
26 friend class QTReaderApp; 26 friend class QTReaderApp;
@@ -61,9 +61,9 @@ public:
61 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) 61 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
62 { 62 {
63 buffdoc.setSaveData(data, len, src, srclen); 63 buffdoc.setSaveData(data, len, src, srclen);
64 } 64 }
65 void putSaveData(unsigned char*& src, unsigned short& srclen) 65 void putSaveData(unsigned char*& src, unsigned short& srclen)
66 { 66 {
67 buffdoc.putSaveData(src, srclen); 67 buffdoc.putSaveData(src, srclen);
68 } 68 }
69 bool empty(); 69 bool empty();
@@ -77,3 +77,3 @@ public:
77 size_t nd = locate(); 77 size_t nd = locate();
78 jumpto(m_mark); 78 jumpto(m_mark);
79 QString text; 79 QString text;
@@ -93,11 +93,11 @@ public:
93 { 93 {
94 if (oldfile) 94 if (oldfile)
95 { 95 {
96 m_string = m_lastfile; 96 m_string = m_lastfile;
97 load_file((const tchar*)m_string); 97 load_file((const tchar*)m_string);
98 } 98 }
99 else 99 else
100 { 100 {
101 m_string = QString::null; 101 m_string = QString::null;
102 } 102 }
103 }; 103 };
@@ -105,20 +105,20 @@ public:
105 void setlead(int _lead) 105 void setlead(int _lead)
106 { 106 {
107 m_fontControl.setlead(_lead); 107 m_fontControl.setlead(_lead);
108 } 108 }
109 int getlead() 109 int getlead()
110 { 110 {
111 return m_fontControl.getlead(); 111 return m_fontControl.getlead();
112 } 112 }
113 void setextraspace(int _lead) 113 void setextraspace(int _lead)
114 { 114 {
115 m_fontControl.setextraspace(_lead); 115 m_fontControl.setextraspace(_lead);
116 } 116 }
117 int getextraspace() 117 int getextraspace()
118 { 118 {
119 return m_fontControl.getextraspace(); 119 return m_fontControl.getextraspace();
120 } 120 }
121 void setpagemode(bool _b) 121 void setpagemode(bool _b)
122 { 122 {
123 m_bpagemode = _b; 123 m_bpagemode = _b;
124 } 124 }
@@ -126,36 +126,36 @@ public:
126 { 126 {
127 m_bMonoSpaced = _b; 127 m_bMonoSpaced = _b;
128 ChangeFont(m_fontControl.currentsize()); 128 ChangeFont(m_fontControl.currentsize());
129 locate(pagelocate()); 129 locate(pagelocate());
130 } 130 }
131 void setencoding(int _f) 131 void setencoding(int _f)
132 { 132 {
133 m_encd = _f; 133 m_encd = _f;
134 setfilter(getfilter()); 134 setfilter(getfilter());
135 } 135 }
136 MarkupType PreferredMarkup(); 136 MarkupType PreferredMarkup();
137 CEncoding* getencoding() 137 CEncoding* getencoding()
138 { 138 {
139 // qDebug("m_encd:%d", m_encd); 139// odebug << "m_encd:" << m_encd << oendl;
140 switch (m_encd) 140 switch (m_encd)
141 { 141 {
142 case 4: 142 case 4:
143 // qDebug("palm"); 143// odebug << "palm" << oendl;
144 return new CPalm; 144 return new CPalm;
145 case 1: 145 case 1:
146 // qDebug("utf8"); 146// odebug << "utf8" << oendl;
147 return new CUtf8; 147 return new CUtf8;
148 case 2: 148 case 2:
149 // qDebug("ucs16be"); 149// odebug << "ucs16be" << oendl;
150 return new CUcs16be; 150 return new CUcs16be;
151 case 3: 151 case 3:
152 // qDebug("ucs16le"); 152// odebug << "ucs16le" << oendl;
153 return new CUcs16le; 153 return new CUcs16le;
154 case 0: 154 case 0:
155 // qDebug("ascii"); 155// odebug << "ascii" << oendl;
156 return new CAscii; 156 return new CAscii;
157 default: 157 default:
158 return new CGeneral8Bit(m_encd-MAX_ENCODING+1); 158 return new CGeneral8Bit(m_encd-MAX_ENCODING+1);
159 } 159 }
160 } 160 }
161 CFilterChain* getfilter() 161 CFilterChain* getfilter()
@@ -191,3 +191,3 @@ private slots:
191 void goForward(); 191 void goForward();
192 void doscroll(); 192 void doscroll();
193 void drawIt( QPainter * ); 193 void drawIt( QPainter * );
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h
index ab6f60e..fe3eebf 100644
--- a/noncore/apps/opie-reader/QTReaderApp.h
+++ b/noncore/apps/opie-reader/QTReaderApp.h
@@ -45,5 +45,5 @@ class QPopupMenu;
45class QToolBar; 45class QToolBar;
46#ifdef USEQPE 46#ifdef USEQPE
47class QToolBar; 47class QToolBar;
48class QMenuBar; 48class QMenuBar;
49#endif 49#endif
@@ -142,3 +142,3 @@ class QTReaderApp : public QMainWindow
142 142
143 unsigned long m_savedpos; 143 unsigned long m_savedpos;
144 int m_debounce; 144 int m_debounce;
@@ -151,3 +151,3 @@ class QTReaderApp : public QMainWindow
151 151
152 public: 152 public:
153 QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 153 QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
@@ -157,5 +157,5 @@ class QTReaderApp : public QMainWindow
157 void hideEvent(QHideEvent*) 157 void hideEvent(QHideEvent*)
158 { 158 {
159 suspend(); 159 suspend();
160 } 160 }
161 161
@@ -173,13 +173,13 @@ class QTReaderApp : public QMainWindow
173 void closeEvent( QCloseEvent *e ); 173 void closeEvent( QCloseEvent *e );
174 void readbkmks(); 174 void readbkmks();
175 void do_mono(const QString&); 175 void do_mono(const QString&);
176 void do_jump(const QString&); 176 void do_jump(const QString&);
177 void do_settarget(const QString&); 177 void do_settarget(const QString&);
178#ifdef _SCROLLPIPE 178#ifdef _SCROLLPIPE
179 //void do_setpipetarget(const QString&); 179// void do_setpipetarget(const QString&);
180#endif 180#endif
181 void do_saveconfig(const QString&, bool); 181 void do_saveconfig(const QString&, bool);
182 bool readconfig(const QString&, bool); 182 bool readconfig(const QString&, bool);
183 bool PopulateConfig(const char*); 183 bool PopulateConfig(const char*);
184 ActionTypes ActNameToInt(const QString&); 184 ActionTypes ActNameToInt(const QString&);
185 bool m_doAnnotation; 185 bool m_doAnnotation;
@@ -190,3 +190,3 @@ class QTReaderApp : public QMainWindow
190 public: 190 public:
191 void saveprefs(); 191 void saveprefs();
192public slots: 192public slots:
@@ -209,13 +209,13 @@ private slots:
209 void OnAnnotation(bool _b) 209 void OnAnnotation(bool _b)
210 { 210 {
211 m_doAnnotation = _b; 211 m_doAnnotation = _b;
212 } 212 }
213 void OnDictionary(bool _b) 213 void OnDictionary(bool _b)
214 { 214 {
215 m_doDictionary = _b; 215 m_doDictionary = _b;
216 } 216 }
217 void OnClipboard(bool _b) 217 void OnClipboard(bool _b)
218 { 218 {
219 m_doClipboard = _b; 219 m_doClipboard = _b;
220 } 220 }
221 void OnWordSelected(const QString&, size_t, const QString&); 221 void OnWordSelected(const QString&, size_t, const QString&);
@@ -228,26 +228,26 @@ private slots:
228 void do_setencoding(int i); 228 void do_setencoding(int i);
229 void do_setfont(const QString&); 229 void do_setfont(const QString&);
230 void buttonActionSelected(QAction*); 230 void buttonActionSelected(QAction*);
231 //void msgHandler(const QCString&, const QByteArray&); 231// void msgHandler(const QCString&, const QByteArray&);
232 void monospace(bool); 232 void monospace(bool);
233 void jump(); 233 void jump();
234 void settarget(); 234 void settarget();
235#ifdef _SCROLLPIPE 235#ifdef _SCROLLPIPE
236 //void setpipetarget(); 236// void setpipetarget();
237 //void setpause(bool); 237// void setpause(bool);
238#endif 238#endif
239 //void setspacing(); 239// void setspacing();
240 void setfont(); 240 void setfont();
241 void clearBkmkList(); 241 void clearBkmkList();
242 void listBkmkFiles(); 242 void listBkmkFiles();
243 void editMark(); 243 void editMark();
244 void autoScroll(bool); 244 void autoScroll(bool);
245 void addbkmk(); 245 void addbkmk();
246 void savebkmks(); 246 void savebkmks();
247 //void importFiles(); 247// void importFiles();
248 void showprefs(); 248 void showprefs();
249 void showtoolbarprefs(); 249 void showtoolbarprefs();
250 void infoClose(); 250 void infoClose();
251 // void oldFile(); 251 // void oldFile();
252 void showinfo(); 252 void showinfo();
253 253
@@ -369,3 +369,3 @@ private slots:
369 ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget, 369 ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget,
370 m_upTarget, m_downTarget; 370 m_upTarget, m_downTarget;
371 bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll; 371 bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll;
@@ -384,7 +384,7 @@ private slots:
384 QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar; 384 QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar;
385#ifdef USEQPE 385#ifdef USEQPE
386 QMenuBar *mb; 386 QMenuBar *mb;
387#else 387#else
388 QMenuBar *mb; 388 QMenuBar *mb;
389#endif 389#endif
390 QFloatBar *searchBar, *regBar/*, *m_fontBar*/; 390 QFloatBar *searchBar, *regBar/*, *m_fontBar*/;
@@ -401,4 +401,4 @@ private slots:
401 { 401 {
402// qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); 402// odebug << "resize:(" << r->oldSize().width() << "," << r->oldSize().height() << ")" << oendl;
403// qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); 403// odebug << "resize:(" << r->size().width() << "," << r->size().height() << ")" << oendl;
404 // bgroup->move( width()-bgroup->width(), 0 ); 404 // bgroup->move( width()-bgroup->width(), 0 );