-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.h | 116 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CEncoding.h | 16 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CExpander.h | 140 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Filedata.h | 56 | ||||
-rw-r--r-- | noncore/apps/opie-reader/FontControl.h | 178 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Palm2QImage.cpp | 125 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 124 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.h | 112 |
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 | |||
@@ -21,24 +21,24 @@ class BuffDoc | |||
21 | CFilterChain* filt; | 21 | CFilterChain* filt; |
22 | public: | 22 | public: |
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 |
43 | void suspend() { if (exp != NULL) exp->suspend(); } | 43 | void suspend() { if (exp != NULL) exp->suspend(); } |
44 | void unsuspend() { if (exp != NULL) exp->unsuspend(); } | 44 | void unsuspend() { if (exp != NULL) exp->unsuspend(); } |
@@ -47,47 +47,47 @@ class BuffDoc | |||
47 | void unsuspend() {} | 47 | void unsuspend() {} |
48 | #endif | 48 | #endif |
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(); } |
69 | bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } | 69 | bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } |
70 | bool iseol() { return (lastword[0] == '\0'); } | 70 | bool iseol() { return (lastword[0] == '\0'); } |
71 | int openfile(QWidget* _parent, const char *src); | 71 | int openfile(QWidget* _parent, const char *src); |
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); } |
92 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } | 92 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } |
93 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } | 93 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } |
@@ -103,15 +103,15 @@ class BuffDoc | |||
103 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); | 103 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); |
104 | void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } | 104 | void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } |
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); } |
116 | void writeposn(size_t posn) { exp->writeposn(posn); } | 116 | void writeposn(size_t posn) { exp->writeposn(posn); } |
117 | bool forward(size_t& loc) { return exp->forward(loc); } | 117 | bool forward(size_t& loc) { return exp->forward(loc); } |
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 | |||
@@ -60,15 +60,15 @@ class CGeneral8Bit : public CEncoding | |||
60 | int m_index; | 60 | int m_index; |
61 | public: | 61 | public: |
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 | }; |
73 | 73 | ||
74 | #endif | 74 | #endif |
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 | |||
@@ -40,18 +40,18 @@ class CExpander | |||
40 | unsigned long m_currentstart, m_currentend; | 40 | unsigned long m_currentstart, m_currentend; |
41 | public: | 41 | public: |
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; |
45 | #endif | 45 | #endif |
46 | size_t getHome() { return m_homepos; } | 46 | size_t getHome() { return m_homepos; } |
47 | CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; | 47 | CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; |
48 | virtual ~CExpander() { if (fname != NULL) delete [] fname; }; | 48 | virtual ~CExpander() { if (fname != NULL) delete [] fname; }; |
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; |
56 | virtual unsigned int locate() = 0; | 56 | virtual unsigned int locate() = 0; |
57 | virtual void locate(unsigned int n) = 0; | 57 | virtual void locate(unsigned int n) = 0; |
@@ -59,17 +59,17 @@ class CExpander | |||
59 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; | 59 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; |
60 | virtual CList<Bkmk>* getbkmklist() { return NULL; } | 60 | virtual CList<Bkmk>* getbkmklist() { return NULL; } |
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; |
74 | virtual void saveposn(size_t posn) {} | 74 | virtual void saveposn(size_t posn) {} |
75 | virtual void writeposn(size_t posn) {} | 75 | virtual void writeposn(size_t posn) {} |
@@ -77,75 +77,75 @@ class CExpander | |||
77 | virtual bool back(size_t& loc) { return false; } | 77 | virtual bool back(size_t& loc) { return false; } |
78 | virtual bool hasnavigation() { return false; } | 78 | virtual bool hasnavigation() { return false; } |
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; } |
104 | void setContinuous(bool _b) { m_continuous = _b; } | 104 | void setContinuous(bool _b) { m_continuous = _b; } |
105 | #ifdef USEQPE | 105 | #ifdef USEQPE |
106 | virtual void suspend(FILE*& fin) | 106 | virtual void suspend(FILE*& fin) |
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 | } |
114 | virtual void unsuspend(FILE*& fin) | 114 | virtual void unsuspend(FILE*& fin) |
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 | } |
135 | #endif | 135 | #endif |
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; } |
150 | }; | 150 | }; |
151 | #endif | 151 | #endif |
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 | |||
@@ -9,43 +9,43 @@ class CFiledata | |||
9 | bool m_own; | 9 | bool m_own; |
10 | public: | 10 | public: |
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)); } |
37 | time_t date() { return *((time_t *)data); } | 37 | time_t date() { return *((time_t *)data); } |
38 | void setdate(time_t _t) { *((time_t *)data) = _t; } | 38 | void setdate(time_t _t) { *((time_t *)data) = _t; } |
39 | unsigned char* content() { return data; } | 39 | unsigned char* content() { return data; } |
40 | size_t length() const { return sizeof(time_t)+sizeof(tchar)*(ustrlen(name())+1); } | 40 | size_t length() const { return sizeof(time_t)+sizeof(tchar)*(ustrlen(name())+1); } |
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 | }; |
50 | 50 | ||
51 | #endif | 51 | #endif |
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 | |||
@@ -20,134 +20,134 @@ class FontControl | |||
20 | unsigned char getBaseSize() { return m_basesize; } | 20 | unsigned char getBaseSize() { return m_basesize; } |
21 | int gzoom(); | 21 | int gzoom(); |
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; } |
38 | bool hasCourier() { return m_hasCourier; } | 38 | bool hasCourier() { return m_hasCourier; } |
39 | QString name() { return m_fontname; } | 39 | QString name() { return m_fontname; } |
40 | int currentsize() { return m_fontsizes[m_size]; } | 40 | int currentsize() { return m_fontsizes[m_size]; } |
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 | } |
60 | int ascent(const CStyle& ch) | 60 | int ascent(const CStyle& ch) |
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 | } |
66 | int descent() | 66 | int descent() |
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 | } |
72 | int descent(const CStyle& ch) | 72 | int descent(const CStyle& ch) |
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 | } |
78 | int lineSpacing() | 78 | int lineSpacing() |
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 | } |
84 | int lineSpacing(const CStyle& ch) | 84 | int lineSpacing(const CStyle& ch) |
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 | }; |
152 | 152 | ||
153 | #endif | 153 | #endif |
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,4 +1,12 @@ | |||
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> |
3 | #include <stdlib.h> | 11 | #include <stdlib.h> |
4 | #include <string.h> | 12 | #include <string.h> |
@@ -9,7 +17,6 @@ | |||
9 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
10 | #include <stdarg.h> | 18 | #include <stdarg.h> |
11 | 19 | ||
12 | #include <qimage.h> | ||
13 | 20 | ||
14 | /***********************************************************************/ | 21 | /***********************************************************************/ |
15 | /***********************************************************************/ | 22 | /***********************************************************************/ |
@@ -42,10 +49,10 @@ typedef struct { | |||
42 | } ColorMapEntry; | 49 | } ColorMapEntry; |
43 | 50 | ||
44 | static ColorMapEntry Palm8BitColormap[] = { | 51 | static 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 }, |
50 | { 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 }, | 57 | { 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 }, |
51 | { 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 }, | 58 | { 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 }, |
@@ -139,36 +146,38 @@ QImage* Palm2QImage | |||
139 | transparent_index = palmimage[12]; | 146 | transparent_index = palmimage[12]; |
140 | compression_type = palmimage[13]; | 147 | compression_type = palmimage[13]; |
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 |
146 | 155 | ||
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; |
150 | } else if ((compression_type != PALM_COMPRESSION_NONE) && | 159 | } else if ((compression_type != PALM_COMPRESSION_NONE) && |
151 | (compression_type != PALM_COMPRESSION_RLE) && | 160 | (compression_type != PALM_COMPRESSION_RLE) && |
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; |
155 | } | 164 | } |
156 | 165 | ||
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 |
160 | 8-bit StaticColor using the Palm standard colormap | 169 | 8-bit StaticColor using the Palm standard colormap |
161 | 8-bit PseudoColor using a user-specified colormap | 170 | 8-bit PseudoColor using a user-specified colormap |
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. |
168 | */ | 177 | */ |
169 | 178 | ||
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; |
173 | } else if (bits_per_pixel == 1) { | 182 | } else if (bits_per_pixel == 1) { |
174 | colormap = Palm1BitColormap; | 183 | colormap = Palm1BitColormap; |
@@ -187,18 +196,20 @@ QImage* Palm2QImage | |||
187 | palm_red_bits = palmimage[16]; | 196 | palm_red_bits = palmimage[16]; |
188 | palm_green_bits = palmimage[17]; | 197 | palm_green_bits = palmimage[17]; |
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; |
194 | } | 204 | } |
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; |
198 | } | 209 | } |
199 | imagedatastart = palmimage + 24; | 210 | imagedatastart = palmimage + 24; |
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; |
203 | } | 214 | } |
204 | 215 | ||
@@ -213,26 +224,27 @@ QImage* Palm2QImage | |||
213 | lastrow = new unsigned char[bytes_per_row * width]; | 224 | lastrow = new unsigned char[bytes_per_row * width]; |
214 | 225 | ||
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 | ||
218 | /* first, uncompress the Palm image */ | 230 | /* first, uncompress the Palm image */ |
219 | if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { | 231 | if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { |
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 | } |
226 | } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { | 238 | } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { |
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 | } |
237 | memcpy (lastrow, rowbuf, bytes_per_row); | 249 | memcpy (lastrow, rowbuf, bytes_per_row); |
238 | } else if (((flags & PALM_IS_COMPRESSED_FLAG) && | 250 | } else if (((flags & PALM_IS_COMPRESSED_FLAG) && |
@@ -243,12 +255,12 @@ QImage* Palm2QImage | |||
243 | palm_ptr += bytes_per_row; | 255 | palm_ptr += bytes_per_row; |
244 | } | 256 | } |
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); |
253 | palm_ptr += bytes_per_row; | 265 | palm_ptr += bytes_per_row; |
254 | } | 266 | } |
@@ -256,37 +268,36 @@ QImage* Palm2QImage | |||
256 | if (colormap) { | 268 | if (colormap) { |
257 | mask = (1 << bits_per_pixel) - 1; | 269 | mask = (1 << bits_per_pixel) - 1; |
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 | } |
272 | } else if (!colormap && | 284 | } else if (!colormap && |
273 | bits_per_pixel == 16) { | 285 | bits_per_pixel == 16) { |
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), |
287 | ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); | 298 | ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); |
288 | qimage->setPixel(j, i, colour); | 299 | qimage->setPixel(j, i, colour); |
289 | inbyte += 2; | 300 | inbyte += 2; |
290 | } | 301 | } |
291 | } | 302 | } |
292 | } | 303 | } |
@@ -299,7 +310,7 @@ QImage* Palm2QImage | |||
299 | 310 | ||
300 | QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b) | 311 | 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); |
304 | qimage->fill(QColor(r,g,b)); | 315 | qimage->fill(QColor(r,g,b)); |
305 | QImage* ret = new QImage(qimage->convertToImage()); | 316 | QImage* ret = new QImage(qimage->convertToImage()); |
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 | |||
@@ -21,8 +21,8 @@ class QTReader : public QWidget | |||
21 | { | 21 | { |
22 | Q_OBJECT | 22 | Q_OBJECT |
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; |
27 | void suspend(); | 27 | void suspend(); |
28 | void increaseScroll(); | 28 | void increaseScroll(); |
@@ -59,13 +59,13 @@ public: | |||
59 | void zoomin(); | 59 | void zoomin(); |
60 | void zoomout(); | 60 | void zoomout(); |
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(); |
70 | void setContinuous(bool _b); | 70 | void setContinuous(bool _b); |
71 | void toggle_autoscroll(); | 71 | void toggle_autoscroll(); |
@@ -75,7 +75,7 @@ public: | |||
75 | { | 75 | { |
76 | /* | 76 | /* |
77 | size_t nd = locate(); | 77 | size_t nd = locate(); |
78 | jumpto(m_mark); | 78 | jumpto(m_mark); |
79 | QString text; | 79 | QString text; |
80 | while (m_mark < nd) | 80 | while (m_mark < nd) |
81 | { | 81 | { |
@@ -91,73 +91,73 @@ public: | |||
91 | /* | 91 | /* |
92 | void setText(bool oldfile) | 92 | void setText(bool oldfile) |
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 | }; |
104 | */ | 104 | */ |
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 | } |
125 | void setmono(bool _b) | 125 | void setmono(bool _b) |
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() |
162 | { | 162 | { |
163 | CFilterChain * filt = new CFilterChain(getencoding()); | 163 | CFilterChain * filt = new CFilterChain(getencoding()); |
@@ -189,7 +189,7 @@ private slots: | |||
189 | void goHome(); | 189 | void goHome(); |
190 | void goBack(); | 190 | void goBack(); |
191 | void goForward(); | 191 | void goForward(); |
192 | void doscroll(); | 192 | void doscroll(); |
193 | void drawIt( QPainter * ); | 193 | void drawIt( QPainter * ); |
194 | void paintEvent( QPaintEvent * ); | 194 | void paintEvent( QPaintEvent * ); |
195 | // void resizeEvent( QResizeEvent * p ) { update(); } | 195 | // void resizeEvent( QResizeEvent * p ) { update(); } |
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 | |||
@@ -43,9 +43,9 @@ class QWidgetStack; | |||
43 | class QToolButton; | 43 | class QToolButton; |
44 | class QPopupMenu; | 44 | class QPopupMenu; |
45 | class QToolBar; | 45 | class QToolBar; |
46 | #ifdef USEQPE | 46 | #ifdef USEQPE |
47 | class QToolBar; | 47 | class QToolBar; |
48 | class QMenuBar; | 48 | class QMenuBar; |
49 | #endif | 49 | #endif |
50 | class CBkmkSelector; | 50 | class CBkmkSelector; |
51 | class QProgressBar; | 51 | class QProgressBar; |
@@ -140,7 +140,7 @@ class QTReaderApp : public QMainWindow | |||
140 | { | 140 | { |
141 | Q_OBJECT | 141 | Q_OBJECT |
142 | 142 | ||
143 | unsigned long m_savedpos; | 143 | unsigned long m_savedpos; |
144 | int m_debounce; | 144 | int m_debounce; |
145 | timeb m_lastkeytime; | 145 | timeb m_lastkeytime; |
146 | bool m_annoIsEditing; | 146 | bool m_annoIsEditing; |
@@ -149,15 +149,15 @@ class QTReaderApp : public QMainWindow | |||
149 | fontselector_action m_fontAction; | 149 | fontselector_action m_fontAction; |
150 | void doAction(ActionTypes a, QKeyEvent* e); | 150 | void doAction(ActionTypes a, QKeyEvent* e); |
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 ); |
154 | ~QTReaderApp(); | 154 | ~QTReaderApp(); |
155 | 155 | ||
156 | void handlekey(QKeyEvent* e); | 156 | void handlekey(QKeyEvent* e); |
157 | void hideEvent(QHideEvent*) | 157 | void hideEvent(QHideEvent*) |
158 | { | 158 | { |
159 | suspend(); | 159 | suspend(); |
160 | } | 160 | } |
161 | 161 | ||
162 | void suspend(); | 162 | void suspend(); |
163 | void openFile( const QString & ); | 163 | void openFile( const QString & ); |
@@ -171,24 +171,24 @@ class QTReaderApp : public QMainWindow | |||
171 | Bkmk* m_anno; | 171 | Bkmk* m_anno; |
172 | // void resizeEvent(QResizeEvent* e); | 172 | // void resizeEvent(QResizeEvent* e); |
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; |
186 | bool m_doDictionary; | 186 | bool m_doDictionary; |
187 | bool m_doClipboard; | 187 | bool m_doClipboard; |
188 | bool m_fullscreen; | 188 | bool m_fullscreen; |
189 | bool m_loadedconfig; | 189 | bool m_loadedconfig; |
190 | public: | 190 | public: |
191 | void saveprefs(); | 191 | void saveprefs(); |
192 | public slots: | 192 | public slots: |
193 | void setDocument(const QString&); | 193 | void setDocument(const QString&); |
194 | private slots: | 194 | private slots: |
@@ -207,17 +207,17 @@ private slots: | |||
207 | void setTwoTouch(bool _b); | 207 | void setTwoTouch(bool _b); |
208 | void restoreFocus(); | 208 | void restoreFocus(); |
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&); |
222 | void OnURLSelected(const QString& href); | 222 | void OnURLSelected(const QString& href); |
223 | void showgraphic(QImage&); | 223 | void showgraphic(QImage&); |
@@ -226,30 +226,30 @@ private slots: | |||
226 | void addanno(); | 226 | void addanno(); |
227 | void showAnnotation(); | 227 | void showAnnotation(); |
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 | ||
254 | // void indentplus(); | 254 | // void indentplus(); |
255 | // void indentminus(); | 255 | // void indentminus(); |
@@ -367,7 +367,7 @@ private slots: | |||
367 | CBkmkSelector* bkmkselector; | 367 | CBkmkSelector* bkmkselector; |
368 | 368 | ||
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; |
372 | bool m_bcloseDisabled, m_disableesckey; | 372 | bool m_bcloseDisabled, m_disableesckey; |
373 | size_t searchStart; | 373 | size_t searchStart; |
@@ -382,11 +382,11 @@ private slots: | |||
382 | QComboBox* m_fontSelector; | 382 | QComboBox* m_fontSelector; |
383 | // QToolBar /* *menu,*/ *fileBar; | 383 | // QToolBar /* *menu,*/ *fileBar; |
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*/; |
391 | QToolBar /* *searchBar, *regBar,*/ *m_fontBar; | 391 | QToolBar /* *searchBar, *regBar,*/ *m_fontBar; |
392 | QLineEdit *searchEdit, *regEdit; | 392 | QLineEdit *searchEdit, *regEdit; |
@@ -399,8 +399,8 @@ private slots: | |||
399 | /* | 399 | /* |
400 | void resizeEvent( QResizeEvent * r) | 400 | void resizeEvent( QResizeEvent * r) |
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 ); |
405 | } | 405 | } |
406 | */ | 406 | */ |