197 files changed, 30327 insertions, 8712 deletions
diff --git a/noncore/apps/opie-reader/Aportis.cpp b/noncore/apps/opie-reader/Aportis.cpp index 06f44a4..7528e78 100644 --- a/noncore/apps/opie-reader/Aportis.cpp +++ b/noncore/apps/opie-reader/Aportis.cpp | |||
@@ -2,8 +2,9 @@ | |||
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include "Aportis.h" | 3 | #include "Aportis.h" |
4 | #include "my_list.h" | 4 | #include "my_list.h" |
5 | #include "Bkmks.h" | 5 | #include "Bkmks.h" |
6 | #include "static.h" | ||
6 | 7 | ||
7 | Aportis::Aportis() : peanutfile(false) { /*printf("constructing:%x\n",fin);*/ } | 8 | Aportis::Aportis() : peanutfile(false) { /*printf("constructing:%x\n",fin);*/ } |
8 | 9 | ||
9 | void Aportis::dePeanut(int& ch) | 10 | void Aportis::dePeanut(int& ch) |
@@ -27,16 +28,16 @@ CList<Bkmk>* Aportis::getbkmklist() | |||
27 | for (int i = nRecs; i < nRecs2; i++) | 28 | for (int i = nRecs; i < nRecs2; i++) |
28 | { | 29 | { |
29 | char name[17]; | 30 | char name[17]; |
30 | name[16] = '\0'; | 31 | name[16] = '\0'; |
31 | // odebug << "Record:" << i << ", Length:" << recordlength(i) << "" << oendl; | 32 | // qDebug("Record:%d, Length:%u",i,recordlength(i)); |
32 | gotorecordnumber(i); | 33 | gotorecordnumber(i); |
33 | fread(name,1,16,fin); | 34 | fread(name,1,16,fin); |
34 | unsigned long lcn; | 35 | unsigned long lcn; |
35 | fread(&lcn,sizeof(lcn),1,fin); | 36 | fread(&lcn,sizeof(lcn),1,fin); |
36 | lcn ^= 0xa5a5a5a5; | 37 | lcn ^= 0xa5a5a5a5; |
37 | lcn = SwapLong(lcn); | 38 | lcn = SwapLong(lcn); |
38 | // odebug << "Bookmark:" << name << ":" << lcn << "" << oendl; | 39 | // qDebug("Bookmark:%s:%u", name,lcn); |
39 | tchar tname[17]; | 40 | tchar tname[17]; |
40 | memset(tname, 0, sizeof(tname)); | 41 | memset(tname, 0, sizeof(tname)); |
41 | for (int i = 0; name[i] != 0; i++) | 42 | for (int i = 0; name[i] != 0; i++) |
42 | { | 43 | { |
@@ -93,36 +94,55 @@ CList<Bkmk>* Aportis::getbkmklist() | |||
93 | int Aportis::OpenFile(const char *src) | 94 | int Aportis::OpenFile(const char *src) |
94 | { | 95 | { |
95 | // printf("In openfile\n"); | 96 | // printf("In openfile\n"); |
96 | int ret = 0; | 97 | int ret = 0; |
98 | html = false; | ||
99 | mobiimagerec = 0; | ||
100 | if (!Cpdb::openpdbfile(src)) return -1; | ||
97 | 101 | ||
98 | if (!Cpdb::openfile(src)) return -1; | 102 | if (head.creator == 0x64414552 // 'dAER' |
99 | 103 | || head.type == 0x74584554) // 'tXET') | |
100 | if (head.creator != 0x64414552 // 'dAER' | ||
101 | || head.type != 0x74584554) // 'tXET') | ||
102 | { | 104 | { |
103 | 105 | } | |
104 | if (memcmp(&head.creator, "PPrs", 4) == 0 && memcmp(&head.type, "PNRd", 4) == 0) | 106 | else if (memcmp(&head.creator, "PPrs", 4) == 0 && memcmp(&head.type, "PNRd", 4) == 0) |
105 | { | 107 | { |
106 | peanutfile = true; | 108 | peanutfile = true; |
107 | } | 109 | } |
108 | else | 110 | else if (memcmp(&head.creator, "MOBI", 4) == 0 && memcmp(&head.type, "BOOK", 4) == 0) |
109 | { | 111 | { |
110 | return -2; | 112 | html = true; |
111 | } | 113 | unsigned char vsn; |
114 | fseek(fin, recordpos(0)+39, SEEK_SET); | ||
115 | fread(&vsn, 1, sizeof(vsn), fin); | ||
116 | qDebug("Mobi version:%x", vsn); | ||
117 | if (vsn > 2) | ||
118 | { | ||
119 | fseek(fin, recordpos(0)+110, SEEK_SET); | ||
120 | fread(&mobiimagerec, 1, sizeof(mobiimagerec), fin); | ||
121 | mobiimagerec = ntohs(mobiimagerec)-1; | ||
122 | } | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | return -2; | ||
112 | } | 127 | } |
113 | 128 | ||
114 | nRecs2 = nRecs = SwapWord(head.recordList.numRecords) - 1; | 129 | nRecs2 = nRecs = SwapWord(head.recordList.numRecords) - 1; |
115 | fseek(fin,0,SEEK_END); | 130 | |
116 | dwLen = ftell(fin); | 131 | struct stat _stat; |
132 | stat(src,&_stat); | ||
133 | dwLen = _stat.st_size; | ||
134 | |||
135 | //fseek(fin,0,SEEK_END); | ||
136 | //dwLen = ftell(fin); | ||
117 | 137 | ||
118 | if (peanutfile) | 138 | if (peanutfile) |
119 | { | 139 | { |
120 | 140 | ||
121 | PeanutHeader hdr0; | 141 | PeanutHeader hdr0; |
122 | gotorecordnumber(0); | 142 | gotorecordnumber(0); |
123 | fread(&hdr0, sizeof(hdr0), 1, fin); | 143 | fread(&hdr0, sizeof(hdr0), 1, fin); |
124 | // odebug << "Version:" << ntohs(hdr0.Version) << "" << oendl; | 144 | // qDebug("Version:%x", ntohs(hdr0.Version)); |
125 | if (hdr0.Version && 0x0200) | 145 | if (hdr0.Version && 0x0200) |
126 | { | 146 | { |
127 | bCompressed = 2; | 147 | bCompressed = 2; |
128 | } | 148 | } |
@@ -140,9 +160,10 @@ int Aportis::OpenFile(const char *src) | |||
140 | tDocRecord0 hdr0; | 160 | tDocRecord0 hdr0; |
141 | fread(&hdr0, sizeof(hdr0), 1, fin); | 161 | fread(&hdr0, sizeof(hdr0), 1, fin); |
142 | bCompressed = SwapWord(hdr0.wVersion); | 162 | bCompressed = SwapWord(hdr0.wVersion); |
143 | if (bCompressed!=1 && bCompressed!=2 && bCompressed != 4) { | 163 | if (bCompressed!=1 && bCompressed!=2 && bCompressed != 4) { |
144 | ret = bCompressed; | 164 | qDebug("ERROR:Unrecognised compression type in Aportis:%u", bCompressed); |
165 | ret = bCompressed; | ||
145 | bCompressed = 2; | 166 | bCompressed = 2; |
146 | } | 167 | } |
147 | switch (bCompressed) | 168 | switch (bCompressed) |
148 | { | 169 | { |
@@ -163,8 +184,9 @@ int Aportis::OpenFile(const char *src) | |||
163 | case 1: | 184 | case 1: |
164 | case 2: | 185 | case 2: |
165 | default: | 186 | default: |
166 | nRecs = SwapWord(hdr0.wNumRecs); | 187 | nRecs = SwapWord(hdr0.wNumRecs); |
188 | if (mobiimagerec == 0 || mobiimagerec > nRecs2) mobiimagerec = nRecs; | ||
167 | dwTLen = SwapLong(hdr0.dwStoryLen); | 189 | dwTLen = SwapLong(hdr0.dwStoryLen); |
168 | BlockSize = SwapWord(hdr0.wRecSize); | 190 | BlockSize = SwapWord(hdr0.wRecSize); |
169 | if (BlockSize == 0) | 191 | if (BlockSize == 0) |
170 | { | 192 | { |
@@ -172,18 +194,50 @@ int Aportis::OpenFile(const char *src) | |||
172 | printf("WARNING: Blocksize not set in source file\n"); | 194 | printf("WARNING: Blocksize not set in source file\n"); |
173 | } | 195 | } |
174 | } | 196 | } |
175 | } | 197 | } |
176 | 198 | ||
177 | 199 | qDebug("Mobi image rec:%u", mobiimagerec); | |
178 | 200 | ||
179 | // this is the main record buffer | 201 | // this is the main record buffer |
180 | // it knows how to stretch to accomodate the decompress | 202 | // it knows how to stretch to accomodate the decompress |
181 | currentrec = 0; | 203 | currentrec = 0; |
182 | cbptr = 0; | 204 | cbptr = 0; |
183 | outptr = 0; | 205 | outptr = 0; |
184 | refreshbuffer(); | 206 | refreshbuffer(); |
185 | // odebug << "Number of records:[" << nRecs << "," << nRecs2 << "]" << oendl; | 207 | if (!html) |
208 | { | ||
209 | int c; | ||
210 | char htmltag[] = "<HTML>"; | ||
211 | char *p = htmltag; | ||
212 | while (1) | ||
213 | { | ||
214 | c = getch(); | ||
215 | char ch = *p++; | ||
216 | if (ch == 0) | ||
217 | { | ||
218 | html = true; | ||
219 | break; | ||
220 | } | ||
221 | if (c != ch) | ||
222 | { | ||
223 | html = false; | ||
224 | break; | ||
225 | } | ||
226 | } | ||
227 | currentrec = 0; | ||
228 | cbptr = 0; | ||
229 | outptr = 0; | ||
230 | refreshbuffer(); | ||
231 | } | ||
232 | /* | ||
233 | for (int i = 0; i < nRecs2; i++) | ||
234 | { | ||
235 | qDebug("Record:%u - %u bytes at position %x", i, recordlength(i), recordpos(i)); | ||
236 | } | ||
237 | */ | ||
238 | |||
239 | qDebug("Number of records:[%u,%u]", nRecs, nRecs2); | ||
186 | return ret; | 240 | return ret; |
187 | } | 241 | } |
188 | 242 | ||
189 | int Aportis::getch() | 243 | int Aportis::getch() |
@@ -371,4 +425,31 @@ bool Aportis::refreshbuffer() | |||
371 | else { | 425 | else { |
372 | return false; | 426 | return false; |
373 | } | 427 | } |
374 | } | 428 | } |
429 | |||
430 | #include <qimage.h> | ||
431 | |||
432 | QImage* Aportis::getPicture(unsigned long tgt) | ||
433 | { | ||
434 | unsigned short tgtrec = tgt+mobiimagerec; | ||
435 | if (tgtrec > nRecs2) return NULL; | ||
436 | size_t cur = ftell(fin); | ||
437 | unsigned short reclen = recordlength(tgtrec); | ||
438 | gotorecordnumber(tgtrec); | ||
439 | UInt8* imgbuffer = new UInt8[reclen]; | ||
440 | fread(imgbuffer, 1, reclen, fin); | ||
441 | QByteArray arr; | ||
442 | arr.assign((const char*)imgbuffer, reclen); | ||
443 | |||
444 | QImage* qimage = new QImage(arr); | ||
445 | fseek(fin, cur, SEEK_SET); | ||
446 | |||
447 | return qimage; | ||
448 | } | ||
449 | |||
450 | #ifndef __STATIC | ||
451 | extern "C" | ||
452 | { | ||
453 | CExpander* newcodec() { return new Aportis; } | ||
454 | } | ||
455 | #endif | ||
diff --git a/noncore/apps/opie-reader/Aportis.h b/noncore/apps/opie-reader/Aportis.h index 202a36f..5e9d1da 100644 --- a/noncore/apps/opie-reader/Aportis.h +++ b/noncore/apps/opie-reader/Aportis.h | |||
@@ -3,9 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef __Aportis_h | 5 | #ifndef __Aportis_h |
6 | #define __Aportis_h | 6 | #define __Aportis_h |
7 | #include "useqpe.h" | ||
8 | #include "CExpander.h" | 7 | #include "CExpander.h" |
9 | #include "pdb.h" | 8 | #include "pdb.h" |
10 | 9 | ||
11 | typedef UInt32 DWORD; | 10 | typedef UInt32 DWORD; |
@@ -59,35 +58,27 @@ inline DWORD SwapLong(DWORD r) | |||
59 | { | 58 | { |
60 | return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000); | 59 | return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000); |
61 | } | 60 | } |
62 | 61 | ||
63 | class Aportis : public CExpander, Cpdb { | 62 | class Aportis : public Cpdb { |
64 | bool peanutfile; | 63 | bool peanutfile, html; |
65 | void dePeanut(int&); | 64 | void dePeanut(int&); |
66 | DWORD dwLen; | 65 | DWORD dwLen; |
67 | WORD nRecs2; | 66 | WORD nRecs2; |
68 | DWORD dwTLen; | 67 | DWORD dwTLen; |
69 | WORD nRecs; | 68 | WORD nRecs; |
70 | WORD BlockSize; | 69 | WORD BlockSize; |
71 | DWORD dwRecLen; | 70 | DWORD dwRecLen; |
71 | WORD mobiimagerec; | ||
72 | int currentrec, currentpos; | 72 | int currentrec, currentpos; |
73 | unsigned int cbptr; | 73 | unsigned int cbptr; |
74 | unsigned int outptr; | 74 | unsigned int outptr; |
75 | unsigned char circbuf[2048]; | 75 | unsigned char circbuf[2048]; |
76 | char bCompressed; | 76 | char bCompressed; |
77 | public: | 77 | public: |
78 | #ifdef USEQPE | ||
79 | void suspend() | ||
80 | { | ||
81 | CExpander::suspend(fin); | ||
82 | } | ||
83 | void unsuspend() | ||
84 | { | ||
85 | CExpander::unsuspend(fin); | ||
86 | } | ||
87 | #endif | ||
88 | void sizes(unsigned long& _file, unsigned long& _text) | 78 | void sizes(unsigned long& _file, unsigned long& _text) |
89 | { | 79 | { |
80 | qDebug("Calling aportis sizes:(%u,%u,%u)", dwTLen, nRecs, BlockSize); | ||
90 | _file = dwLen; | 81 | _file = dwLen; |
91 | _text = dwTLen; | 82 | _text = dwTLen; |
92 | } | 83 | } |
93 | bool hasrandomaccess() { return true; } | 84 | bool hasrandomaccess() { return true; } |
@@ -99,10 +90,12 @@ public: | |||
99 | void locate(unsigned int n); | 90 | void locate(unsigned int n); |
100 | CList<Bkmk>* getbkmklist(); | 91 | CList<Bkmk>* getbkmklist(); |
101 | MarkupType PreferredMarkup() | 92 | MarkupType PreferredMarkup() |
102 | { | 93 | { |
103 | return (peanutfile) ? cPML : cTEXT; | 94 | return (peanutfile) ? cPML : ((html) ? cHTML : cTEXT); |
104 | } | 95 | } |
96 | QImage* getPicture(unsigned long); | ||
97 | QString about() { return QString("AportisDoc codec (c) Tim Wentford"); } | ||
105 | private: | 98 | private: |
106 | bool refreshbuffer(); | 99 | bool refreshbuffer(); |
107 | unsigned int GetBS(unsigned int bn); | 100 | unsigned int GetBS(unsigned int bn); |
108 | }; | 101 | }; |
diff --git a/noncore/apps/opie-reader/AportisCodec.mak b/noncore/apps/opie-reader/AportisCodec.mak new file mode 100644 index 0000000..89bf57d --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec.mak | |||
@@ -0,0 +1,166 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libAportis.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:36:46 2004 | ||
4 | # Project: AportisCodec.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o AportisCodec.mak AportisCodec.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libAportis.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = Aportis.h | ||
47 | SOURCES = Aportis.cpp | ||
48 | OBJECTS = QREADEROBJS/Aportis.o | ||
49 | FORMS = | ||
50 | UICDECLS = | ||
51 | UICIMPLS = | ||
52 | SRCMOC = | ||
53 | OBJMOC = | ||
54 | DIST = AportisCodec.pro | ||
55 | QMAKE_TARGET = Aportis | ||
56 | DESTDIR = $(READERDIR)/codecs/ | ||
57 | TARGET = libAportis.so.1.0.0 | ||
58 | TARGETA= $(READERDIR)/codecs/libAportis.a | ||
59 | TARGETD= libAportis.so.1.0.0 | ||
60 | TARGET0= libAportis.so | ||
61 | TARGET1= libAportis.so.1 | ||
62 | TARGET2= libAportis.so.1.0 | ||
63 | |||
64 | first: all | ||
65 | ####### Implicit rules | ||
66 | |||
67 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
68 | |||
69 | .cpp.o: | ||
70 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
71 | |||
72 | .cc.o: | ||
73 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
74 | |||
75 | .cxx.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .C.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .c.o: | ||
82 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | ####### Build rules | ||
85 | |||
86 | all: AportisCodec.mak $(READERDIR)/codecs/$(TARGET) | ||
87 | |||
88 | $(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
89 | test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/ | ||
90 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
91 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
92 | -ln -s $(TARGET) $(TARGET0) | ||
93 | -ln -s $(TARGET) $(TARGET1) | ||
94 | -ln -s $(TARGET) $(TARGET2) | ||
95 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) | ||
96 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) | ||
97 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1) | ||
98 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2) | ||
99 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/ | ||
100 | |||
101 | |||
102 | |||
103 | staticlib: $(TARGETA) | ||
104 | |||
105 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
106 | -$(DEL_FILE) $(TARGETA) | ||
107 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
108 | |||
109 | mocables: $(SRCMOC) | ||
110 | uicables: $(UICDECLS) $(UICIMPLS) | ||
111 | |||
112 | $(MOC): | ||
113 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
114 | |||
115 | AportisCodec.mak: AportisCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
116 | $(QMAKE) -o AportisCodec.mak AportisCodec.pro | ||
117 | qmake: | ||
118 | @$(QMAKE) -o AportisCodec.mak AportisCodec.pro | ||
119 | |||
120 | dist: | ||
121 | @mkdir -p QREADEROBJS/Aportis && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/Aportis/ && ( cd `dirname QREADEROBJS/Aportis` && $(TAR) Aportis.tar Aportis && $(GZIP) Aportis.tar ) && $(MOVE) `dirname QREADEROBJS/Aportis`/Aportis.tar.gz . && $(DEL_FILE) -r QREADEROBJS/Aportis | ||
122 | |||
123 | mocclean: | ||
124 | |||
125 | uiclean: | ||
126 | |||
127 | yaccclean: | ||
128 | lexclean: | ||
129 | clean: | ||
130 | -$(DEL_FILE) $(OBJECTS) | ||
131 | -$(DEL_FILE) *~ core *.core | ||
132 | |||
133 | |||
134 | ####### Sub-libraries | ||
135 | |||
136 | distclean: clean | ||
137 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET) | ||
138 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA) | ||
139 | |||
140 | |||
141 | FORCE: | ||
142 | |||
143 | ####### Compile | ||
144 | |||
145 | QREADEROBJS/Aportis.o: Aportis.cpp Aportis.h \ | ||
146 | my_list.h \ | ||
147 | Bkmks.h \ | ||
148 | QREADERINC/static.h \ | ||
149 | CExpander.h \ | ||
150 | pdb.h \ | ||
151 | QREADERINC/useqpe.h \ | ||
152 | config.h \ | ||
153 | StyleConsts.h \ | ||
154 | Markups.h \ | ||
155 | names.h \ | ||
156 | linktype.h \ | ||
157 | ustring.h \ | ||
158 | Filedata.h | ||
159 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Aportis.o Aportis.cpp | ||
160 | |||
161 | ####### Install | ||
162 | |||
163 | install: all | ||
164 | |||
165 | uninstall: | ||
166 | |||
diff --git a/noncore/apps/opie-reader/AportisCodec.omak b/noncore/apps/opie-reader/AportisCodec.omak new file mode 100644 index 0000000..2de7cd6 --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec.omak | |||
@@ -0,0 +1,139 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libAportis.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: AportisCodec.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libAportis.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =Aportis.h \ | ||
29 | CExpander.h \ | ||
30 | OREADERINC/useqpe.h \ | ||
31 | config.h \ | ||
32 | ustring.h \ | ||
33 | StyleConsts.h \ | ||
34 | Markups.h \ | ||
35 | names.h \ | ||
36 | linktype.h \ | ||
37 | pdb.h \ | ||
38 | my_list.h \ | ||
39 | Bkmks.h \ | ||
40 | Filedata.h | ||
41 | SOURCES =Aportis.cpp | ||
42 | OBJECTS =OREADEROBJS/Aportis.o | ||
43 | INTERFACES = | ||
44 | UICDECLS = | ||
45 | UICIMPLS = | ||
46 | SRCMOC = | ||
47 | OBJMOC = | ||
48 | DIST = | ||
49 | TARGET =libAportis.so.1.0.0 | ||
50 | TARGETA =$(QTDIR)/plugins/reader/codecs/libAportis.a | ||
51 | TARGETD =libAportis.so.1.0.0 | ||
52 | TARGET0 =libAportis.so | ||
53 | TARGET1 =libAportis.so.1 | ||
54 | TARGET2 =libAportis.so.1.0 | ||
55 | INTERFACE_DECL_PATH = . | ||
56 | |||
57 | ####### Implicit rules | ||
58 | |||
59 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
60 | |||
61 | .cpp.o: | ||
62 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | .cxx.o: | ||
65 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
66 | |||
67 | .cc.o: | ||
68 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
69 | |||
70 | .C.o: | ||
71 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
72 | |||
73 | .c.o: | ||
74 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
75 | |||
76 | ####### Build rules | ||
77 | |||
78 | |||
79 | all: $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0 | ||
80 | |||
81 | $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
82 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
83 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
84 | -ln -s $(TARGET) $(TARGET0) | ||
85 | -ln -s $(TARGET) $(TARGET1) | ||
86 | -ln -s $(TARGET) $(TARGET2) | ||
87 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
88 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
89 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
90 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
91 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
92 | |||
93 | staticlib: $(TARGETA) | ||
94 | |||
95 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
96 | -rm -f $(TARGETA) | ||
97 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
98 | |||
99 | moc: $(SRCMOC) | ||
100 | |||
101 | tmake: AportisCodec.omak | ||
102 | |||
103 | AportisCodec.omak: AportisCodec.opro | ||
104 | tmake AportisCodec.opro -o AportisCodec.omak | ||
105 | |||
106 | dist: | ||
107 | $(TAR) AportisCodec.opro.tar AportisCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
108 | $(GZIP) AportisCodec.opro.tar | ||
109 | |||
110 | clean: | ||
111 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
112 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
113 | -rm -f *~ core | ||
114 | |||
115 | ####### Sub-libraries | ||
116 | |||
117 | |||
118 | ###### Combined headers | ||
119 | |||
120 | |||
121 | ####### Compile | ||
122 | |||
123 | OREADEROBJS/Aportis.o: Aportis.cpp \ | ||
124 | Aportis.h \ | ||
125 | CExpander.h \ | ||
126 | OREADERINC/useqpe.h \ | ||
127 | config.h \ | ||
128 | ustring.h \ | ||
129 | StyleConsts.h \ | ||
130 | Markups.h \ | ||
131 | names.h \ | ||
132 | linktype.h \ | ||
133 | pdb.h \ | ||
134 | my_list.h \ | ||
135 | Bkmks.h \ | ||
136 | Filedata.h \ | ||
137 | OREADERINC/static.h | ||
138 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Aportis.o Aportis.cpp | ||
139 | |||
diff --git a/noncore/apps/opie-reader/AportisCodec.wmak b/noncore/apps/opie-reader/AportisCodec.wmak new file mode 100644 index 0000000..02c9ef0 --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec.wmak | |||
@@ -0,0 +1,127 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libAportis.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: AportisCodec.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libAportis.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =Aportis.h | ||
29 | SOURCES =Aportis.cpp | ||
30 | OBJECTS =WSREADEROBJS/Aportis.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libAportis.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libAportis.a | ||
39 | TARGETD =libAportis.so.1.0.0 | ||
40 | TARGET0 =libAportis.so | ||
41 | TARGET1 =libAportis.so.1 | ||
42 | TARGET2 =libAportis.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: AportisCodec.wmak | ||
90 | |||
91 | AportisCodec.wmak: AportisCodec.wpro | ||
92 | tmake AportisCodec.wpro -o AportisCodec.wmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) AportisCodec.wpro.tar AportisCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) AportisCodec.wpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | WSREADEROBJS/Aportis.o: Aportis.cpp \ | ||
112 | Aportis.h \ | ||
113 | CExpander.h \ | ||
114 | WSREADERINC/useqpe.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h \ | ||
121 | pdb.h \ | ||
122 | my_list.h \ | ||
123 | Bkmks.h \ | ||
124 | Filedata.h \ | ||
125 | WSREADERINC/static.h | ||
126 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Aportis.o Aportis.cpp | ||
127 | |||
diff --git a/noncore/apps/opie-reader/AportisCodec.wpro b/noncore/apps/opie-reader/AportisCodec.wpro new file mode 100644 index 0000000..b21f2cb --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec.wpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = Aportis.h | ||
4 | |||
5 | SOURCES = Aportis.cpp | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = Aportis | ||
11 | LIBS += -lreader_pdb -lreader_codec | ||
12 | |||
13 | |||
14 | OBJECTS_DIR = WSREADEROBJS | ||
15 | MOC_DIR = WSREADERMOCS | ||
16 | INCLUDEPATH+= WSREADERINC | ||
17 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/AportisCodec.zmak b/noncore/apps/opie-reader/AportisCodec.zmak new file mode 100644 index 0000000..6fb0444 --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec.zmak | |||
@@ -0,0 +1,127 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libAportis.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: AportisCodec.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libAportis.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =Aportis.h | ||
29 | SOURCES =Aportis.cpp | ||
30 | OBJECTS =ZREADEROBJS/Aportis.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libAportis.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libAportis.a | ||
39 | TARGETD =libAportis.so.1.0.0 | ||
40 | TARGET0 =libAportis.so | ||
41 | TARGET1 =libAportis.so.1 | ||
42 | TARGET2 =libAportis.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: AportisCodec.zmak | ||
90 | |||
91 | AportisCodec.zmak: AportisCodec.zpro | ||
92 | tmake AportisCodec.zpro -o AportisCodec.zmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) AportisCodec.zpro.tar AportisCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) AportisCodec.zpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | ZREADEROBJS/Aportis.o: Aportis.cpp \ | ||
112 | Aportis.h \ | ||
113 | CExpander.h \ | ||
114 | ZREADERINC/useqpe.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h \ | ||
121 | pdb.h \ | ||
122 | my_list.h \ | ||
123 | Bkmks.h \ | ||
124 | Filedata.h \ | ||
125 | ZREADERINC/static.h | ||
126 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Aportis.o Aportis.cpp | ||
127 | |||
diff --git a/noncore/apps/opie-reader/AportisCodec.zpro b/noncore/apps/opie-reader/AportisCodec.zpro new file mode 100644 index 0000000..8e4b26c --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec.zpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = Aportis.h | ||
4 | |||
5 | SOURCES = Aportis.cpp | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = Aportis | ||
11 | LIBS += -lreader_pdb -lreader_codec | ||
12 | |||
13 | |||
14 | OBJECTS_DIR = ZREADEROBJS | ||
15 | MOC_DIR = ZREADERMOCS | ||
16 | INCLUDEPATH+= ZREADERINC | ||
17 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/AportisCodec/.cvsignore b/noncore/apps/opie-reader/AportisCodec/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/AportisCodec/AportisCodec.pro b/noncore/apps/opie-reader/AportisCodec/AportisCodec.pro new file mode 100644 index 0000000..4b61a7a --- a/dev/null +++ b/noncore/apps/opie-reader/AportisCodec/AportisCodec.pro | |||
@@ -0,0 +1,30 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = Aportis.h \ | ||
6 | CExpander.h \ | ||
7 | ../OREADERINC/useqpe.h \ | ||
8 | config.h \ | ||
9 | ustring.h \ | ||
10 | StyleConsts.h \ | ||
11 | Markups.h \ | ||
12 | names.h \ | ||
13 | linktype.h \ | ||
14 | pdb.h \ | ||
15 | my_list.h \ | ||
16 | Bkmks.h \ | ||
17 | Filedata.h | ||
18 | |||
19 | SOURCES = Aportis.cpp | ||
20 | |||
21 | |||
22 | INTERFACES= | ||
23 | DESTDIR = $(OPIEDIR)/plugins/reader/codecs | ||
24 | TARGET = Aportis | ||
25 | LIBS += -lreader_pdb -lreader_codec | ||
26 | |||
27 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
28 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
29 | |||
30 | include ( $(OPIEDIR)/include.pro ) \ No newline at end of file | ||
diff --git a/noncore/apps/opie-reader/BGType.h b/noncore/apps/opie-reader/BGType.h new file mode 100644 index 0000000..58d81d8 --- a/dev/null +++ b/noncore/apps/opie-reader/BGType.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __BGTYPE_H | ||
2 | #define __BGTYPE_H | ||
3 | enum bground | ||
4 | { | ||
5 | bgCentred, | ||
6 | bgTiled, | ||
7 | bgStretched | ||
8 | }; | ||
9 | #endif | ||
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp index 480c240..440d8be 100644 --- a/noncore/apps/opie-reader/Bkmks.cpp +++ b/noncore/apps/opie-reader/Bkmks.cpp | |||
@@ -1,15 +1,17 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | 2 | ||
3 | #include "Bkmks.h" | 3 | #include "Bkmks.h" |
4 | 4 | ||
5 | #include "StyleConsts.h" | ||
6 | #include "Markups.h" | ||
5 | #include "my_list.h" | 7 | #include "my_list.h" |
6 | #include "version.h" | 8 | #include "version.h" |
7 | #include "names.h" | 9 | #include "names.h" |
8 | 10 | ||
9 | const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE); | 11 | const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE); |
10 | 12 | ||
11 | Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p) : m_position(_p) | 13 | Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p) |
12 | { | 14 | { |
13 | init(_nm, _nmlen, _anno, _annolen, _p); | 15 | init(_nm, _nmlen, _anno, _annolen, _p); |
14 | } | 16 | } |
15 | 17 | ||
@@ -19,9 +21,21 @@ Bkmk::Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short annolen, | |||
19 | } | 21 | } |
20 | 22 | ||
21 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p) | 23 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p) |
22 | { | 24 | { |
25 | if (_anno == NULL) | ||
26 | { | ||
27 | tchar t = 0; | ||
28 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); | ||
29 | } | ||
30 | else | ||
31 | { | ||
32 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); | ||
33 | } | ||
34 | } | ||
23 | 35 | ||
36 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2) : m_position(_p) | ||
37 | { | ||
24 | if (_anno == NULL) | 38 | if (_anno == NULL) |
25 | { | 39 | { |
26 | tchar t = 0; | 40 | tchar t = 0; |
27 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); | 41 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); |
@@ -29,8 +43,10 @@ Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_ | |||
29 | else | 43 | else |
30 | { | 44 | { |
31 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); | 45 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); |
32 | } | 46 | } |
47 | m_position2 = _p2; | ||
48 | m_red = m_green = m_blue = 127; | ||
33 | } | 49 | } |
34 | 50 | ||
35 | void Bkmk::init(const void* _nm, unsigned short _nmlen, const void* _anno, unsigned short _annolen, unsigned int _p) | 51 | void Bkmk::init(const void* _nm, unsigned short _nmlen, const void* _anno, unsigned short _annolen, unsigned int _p) |
36 | { | 52 | { |
@@ -55,8 +71,11 @@ void Bkmk::init(const void* _nm, unsigned short _nmlen, const void* _anno, unsig | |||
55 | { | 71 | { |
56 | m_anno = NULL; | 72 | m_anno = NULL; |
57 | } | 73 | } |
58 | m_position = _p; | 74 | m_position = _p; |
75 | m_position2 = _p; | ||
76 | m_red = m_green = m_blue = 255; | ||
77 | m_level = 0; | ||
59 | } | 78 | } |
60 | 79 | ||
61 | Bkmk::~Bkmk() | 80 | Bkmk::~Bkmk() |
62 | { | 81 | { |
@@ -94,14 +113,19 @@ Bkmk& Bkmk::operator=(const Bkmk& rhs) | |||
94 | } | 113 | } |
95 | else | 114 | else |
96 | m_anno = NULL; | 115 | m_anno = NULL; |
97 | m_position = rhs.m_position; | 116 | m_position = rhs.m_position; |
117 | m_position2 = rhs.m_position2; | ||
118 | m_red = rhs.m_red; | ||
119 | m_green = rhs.m_green; | ||
120 | m_blue = rhs.m_blue; | ||
121 | m_level = rhs.m_level; | ||
98 | return *this; | 122 | return *this; |
99 | } | 123 | } |
100 | 124 | ||
101 | bool Bkmk::operator==(const Bkmk& rhs) | 125 | bool Bkmk::operator==(const Bkmk& rhs) |
102 | { | 126 | { |
103 | return (m_position == rhs.m_position && (rhs.m_namelen == m_namelen) && memcmp(m_name,rhs.m_name,m_namelen) == 0); | 127 | return ((m_position == rhs.m_position) && (m_position2 == rhs.m_position2) && (rhs.m_namelen == m_namelen) && memcmp(m_name,rhs.m_name,m_namelen) == 0); |
104 | } | 128 | } |
105 | 129 | ||
106 | void Bkmk::setAnno(unsigned char* t, unsigned short len) | 130 | void Bkmk::setAnno(unsigned char* t, unsigned short len) |
107 | { | 131 | { |
@@ -145,11 +169,11 @@ void Bkmk::setAnno(tchar* t) | |||
145 | *((tchar*)m_anno) = 0; | 169 | *((tchar*)m_anno) = 0; |
146 | } | 170 | } |
147 | } | 171 | } |
148 | 172 | ||
149 | BkmkFile::BkmkFile(const char *fnm, bool w) | 173 | BkmkFile::BkmkFile(const char *fnm, bool w, bool _x) |
150 | : | 174 | : |
151 | wt(w), isUpgraded(false) | 175 | wt(w), isUpgraded(false), m_extras(_x) |
152 | { | 176 | { |
153 | if (w) | 177 | if (w) |
154 | { | 178 | { |
155 | f = fopen(fnm, "wb"); | 179 | f = fopen(fnm, "wb"); |
@@ -173,8 +197,16 @@ void BkmkFile::write(const Bkmk& b) | |||
173 | fwrite(b.m_name,1,b.m_namelen,f); | 197 | fwrite(b.m_name,1,b.m_namelen,f); |
174 | fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f); | 198 | fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f); |
175 | fwrite(b.m_anno,1,b.m_annolen,f); | 199 | fwrite(b.m_anno,1,b.m_annolen,f); |
176 | fwrite(&b.m_position,sizeof(b.m_position),1,f); | 200 | fwrite(&b.m_position,sizeof(b.m_position),1,f); |
201 | if (m_extras) | ||
202 | { | ||
203 | fwrite(&b.m_position2,sizeof(b.m_position2),1,f); | ||
204 | fwrite(&b.m_red,sizeof(b.m_red),1,f); | ||
205 | fwrite(&b.m_green,sizeof(b.m_green),1,f); | ||
206 | fwrite(&b.m_blue,sizeof(b.m_blue),1,f); | ||
207 | fwrite(&b.m_level,sizeof(b.m_level),1,f); | ||
208 | } | ||
177 | } | 209 | } |
178 | } | 210 | } |
179 | 211 | ||
180 | void BkmkFile::write(CList<Bkmk>& bl) | 212 | void BkmkFile::write(CList<Bkmk>& bl) |
@@ -213,42 +245,47 @@ CList<Bkmk>* BkmkFile::readall() | |||
213 | else | 245 | else |
214 | { | 246 | { |
215 | switch(newmagic & 0xff) | 247 | switch(newmagic & 0xff) |
216 | { | 248 | { |
217 | case 6: | 249 | case 7: |
218 | isUpgraded = false; | 250 | isUpgraded = false; |
251 | bl = readall00(read07); | ||
252 | // qDebug("Correct version!"); | ||
253 | break; | ||
254 | case 6: | ||
255 | isUpgraded = true; | ||
219 | bl = readall00(read06); | 256 | bl = readall00(read06); |
220 | // odebug << "Correct version!" << oendl; | 257 | // qDebug("Correct version!"); |
221 | break; | 258 | break; |
222 | case 5: | 259 | case 5: |
223 | isUpgraded = true; | 260 | isUpgraded = true; |
224 | bl = readall00(read05); | 261 | bl = readall00(read05); |
225 | // odebug << "Known version!" << oendl; | 262 | // qDebug("Known version!"); |
226 | break; | 263 | break; |
227 | default: | 264 | default: |
228 | // odebug << "Unknown version!" << oendl; | 265 | // qDebug("Unknown version!"); |
229 | isUpgraded = true; | 266 | isUpgraded = true; |
230 | bl = readall00(read05); | 267 | bl = readall00(read05); |
231 | } | 268 | } |
232 | } | 269 | } |
233 | } | 270 | } |
234 | return bl; | 271 | return bl; |
235 | } | 272 | } |
236 | 273 | ||
237 | CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(FILE*)) | 274 | CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(BkmkFile*, FILE*)) |
238 | { | 275 | { |
239 | CList<Bkmk>* bl = new CList<Bkmk>; | 276 | CList<Bkmk>* bl = new CList<Bkmk>; |
240 | while (1) | 277 | while (1) |
241 | { | 278 | { |
242 | Bkmk* b = (*readfn)(f); | 279 | Bkmk* b = (*readfn)(this, f); |
243 | if (b == NULL) break; | 280 | if (b == NULL) break; |
244 | bl->push_back(*b); | 281 | bl->push_back(*b); |
245 | delete b; | 282 | delete b; |
246 | } | 283 | } |
247 | return bl; | 284 | return bl; |
248 | } | 285 | } |
249 | 286 | ||
250 | Bkmk* BkmkFile::read03(FILE* f) | 287 | Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f) |
251 | { | 288 | { |
252 | Bkmk* b = NULL; | 289 | Bkmk* b = NULL; |
253 | if (f != NULL) | 290 | if (f != NULL) |
254 | { | 291 | { |
@@ -270,9 +307,9 @@ Bkmk* BkmkFile::read03(FILE* f) | |||
270 | } | 307 | } |
271 | return b; | 308 | return b; |
272 | } | 309 | } |
273 | 310 | ||
274 | Bkmk* BkmkFile::read05(FILE* f) | 311 | Bkmk* BkmkFile::read05(BkmkFile* /*_this*/, FILE* f) |
275 | { | 312 | { |
276 | Bkmk* b = NULL; | 313 | Bkmk* b = NULL; |
277 | if (f != NULL) | 314 | if (f != NULL) |
278 | { | 315 | { |
@@ -293,9 +330,9 @@ Bkmk* BkmkFile::read05(FILE* f) | |||
293 | } | 330 | } |
294 | return b; | 331 | return b; |
295 | } | 332 | } |
296 | 333 | ||
297 | Bkmk* BkmkFile::read06(FILE* f) | 334 | Bkmk* BkmkFile::read06(BkmkFile* /*_this*/, FILE* f) |
298 | { | 335 | { |
299 | Bkmk* b = NULL; | 336 | Bkmk* b = NULL; |
300 | if (f != NULL) | 337 | if (f != NULL) |
301 | { | 338 | { |
@@ -313,8 +350,50 @@ Bkmk* BkmkFile::read06(FILE* f) | |||
313 | b->m_anno = new unsigned char[b->m_annolen]; | 350 | b->m_anno = new unsigned char[b->m_annolen]; |
314 | fread(b->m_anno,1,b->m_annolen,f); | 351 | fread(b->m_anno,1,b->m_annolen,f); |
315 | } | 352 | } |
316 | fread(&(b->m_position),sizeof(b->m_position),1,f); | 353 | fread(&(b->m_position),sizeof(b->m_position),1,f); |
354 | b->m_position2 = b->m_position+b->m_namelen-1; | ||
355 | b->m_red = b->m_green = b->m_blue = 127; | ||
356 | b->m_level = 0; | ||
317 | } | 357 | } |
318 | } | 358 | } |
319 | return b; | 359 | return b; |
320 | } | 360 | } |
361 | |||
362 | Bkmk* BkmkFile::read07(BkmkFile* _this, FILE* f) | ||
363 | { | ||
364 | Bkmk* b = NULL; | ||
365 | if (f != NULL) | ||
366 | { | ||
367 | unsigned short ln; | ||
368 | if (fread(&ln,sizeof(ln),1,f) == 1) | ||
369 | { | ||
370 | b = new Bkmk; | ||
371 | b->m_namelen = ln; | ||
372 | b->m_name = new unsigned char[b->m_namelen]; | ||
373 | fread(b->m_name,1,b->m_namelen,f); | ||
374 | |||
375 | fread(&(b->m_annolen),sizeof(b->m_annolen),1,f); | ||
376 | if (b->m_annolen > 0) | ||
377 | { | ||
378 | b->m_anno = new unsigned char[b->m_annolen]; | ||
379 | fread(b->m_anno,1,b->m_annolen,f); | ||
380 | } | ||
381 | fread(&(b->m_position),sizeof(b->m_position),1,f); | ||
382 | if (_this->m_extras) | ||
383 | { | ||
384 | fread(&(b->m_position2),sizeof(b->m_position2),1,f); | ||
385 | fread(&(b->m_red),sizeof(b->m_red),1,f); | ||
386 | fread(&(b->m_green),sizeof(b->m_green),1,f); | ||
387 | fread(&(b->m_blue),sizeof(b->m_blue),1,f); | ||
388 | fread(&(b->m_level),sizeof(b->m_level),1,f); | ||
389 | } | ||
390 | else | ||
391 | { | ||
392 | b->m_position2 = b->m_position; | ||
393 | b->m_red = b->m_green = b->m_blue = 255; | ||
394 | b->m_level = 0; | ||
395 | } | ||
396 | } | ||
397 | } | ||
398 | return b; | ||
399 | } | ||
diff --git a/noncore/apps/opie-reader/Bkmks.h b/noncore/apps/opie-reader/Bkmks.h index ee528e4..c2275e2 100644 --- a/noncore/apps/opie-reader/Bkmks.h +++ b/noncore/apps/opie-reader/Bkmks.h | |||
@@ -15,21 +15,34 @@ class Bkmk | |||
15 | unsigned short m_namelen; | 15 | unsigned short m_namelen; |
16 | unsigned char* m_anno; | 16 | unsigned char* m_anno; |
17 | unsigned short m_annolen; | 17 | unsigned short m_annolen; |
18 | unsigned int m_position; | 18 | unsigned int m_position; |
19 | unsigned int m_position2; | ||
20 | unsigned char m_red,m_green,m_blue, m_level; | ||
19 | void init(const void*, unsigned short, const void*, unsigned short, unsigned int); | 21 | void init(const void*, unsigned short, const void*, unsigned short, unsigned int); |
20 | public: | 22 | public: |
21 | Bkmk() : m_name(NULL), m_namelen(0), m_anno(NULL), m_annolen(0), m_position(0) {}; | 23 | Bkmk() : m_name(NULL), m_namelen(0), m_anno(NULL), m_annolen(0), m_position(0) {}; |
22 | Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); | 24 | Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); |
23 | Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); | 25 | Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); |
24 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); | 26 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); |
27 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2); | ||
25 | Bkmk(const Bkmk& rhs) : m_name(NULL), m_anno(NULL) | 28 | Bkmk(const Bkmk& rhs) : m_name(NULL), m_anno(NULL) |
26 | { | 29 | { |
27 | *this = rhs; | 30 | *this = rhs; |
28 | } | 31 | } |
29 | ~Bkmk(); | 32 | ~Bkmk(); |
30 | unsigned int value() const { return m_position; } | 33 | unsigned int value() const { return m_position; } |
31 | void value(unsigned int _v) { m_position = _v; } | 34 | void value(unsigned int _v) { m_position = _v; } |
35 | unsigned int value2() const { return m_position2; } | ||
36 | void value2(unsigned int _v) { m_position2 = _v; } | ||
37 | unsigned char red() { return m_red; } | ||
38 | unsigned char green() { return m_green; } | ||
39 | unsigned char blue() { return m_blue; } | ||
40 | void red(unsigned char _v) { m_red = _v; } | ||
41 | void green(unsigned char _v) { m_green = _v; } | ||
42 | void blue(unsigned char _v) { m_blue = _v; } | ||
43 | unsigned char level() { return m_level; } | ||
44 | void level(unsigned char _v) { m_level = _v; } | ||
32 | tchar *name() const { return (tchar*)m_name; } | 45 | tchar *name() const { return (tchar*)m_name; } |
33 | tchar *anno() const { return (tchar*)m_anno; } | 46 | tchar *anno() const { return (tchar*)m_anno; } |
34 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } | 47 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } |
35 | Bkmk& operator=(const Bkmk& rhs); | 48 | Bkmk& operator=(const Bkmk& rhs); |
@@ -51,19 +64,20 @@ class Bkmk | |||
51 | class BkmkFile | 64 | class BkmkFile |
52 | { | 65 | { |
53 | FILE* f; | 66 | FILE* f; |
54 | bool wt; | 67 | bool wt; |
55 | bool isUpgraded; | 68 | bool isUpgraded, m_extras; |
56 | static const unsigned long magic; | 69 | static const unsigned long magic; |
57 | private: | 70 | private: |
58 | static Bkmk* read06(FILE*); | 71 | static Bkmk* read07(BkmkFile*, FILE*); |
59 | static Bkmk* read05(FILE*); | 72 | static Bkmk* read06(BkmkFile*, FILE*); |
60 | static Bkmk* read03(FILE*); | 73 | static Bkmk* read05(BkmkFile*, FILE*); |
61 | CList<Bkmk>* readall00(Bkmk*(*fn)(FILE*)); | 74 | static Bkmk* read03(BkmkFile*, FILE*); |
75 | CList<Bkmk>* readall00(Bkmk*(*fn)(BkmkFile*, FILE*)); | ||
62 | void write(const Bkmk& b); | 76 | void write(const Bkmk& b); |
63 | public: | 77 | public: |
64 | bool upgraded() { return isUpgraded; } | 78 | bool upgraded() { return isUpgraded; } |
65 | BkmkFile(const char *fnm, bool w = false); | 79 | BkmkFile(const char *fnm, bool w, bool _x); |
66 | ~BkmkFile(); | 80 | ~BkmkFile(); |
67 | void write(CList<Bkmk>& bl); | 81 | void write(CList<Bkmk>& bl); |
68 | CList<Bkmk>* readall(); | 82 | CList<Bkmk>* readall(); |
69 | }; | 83 | }; |
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp index 68391b8..22934f9 100644 --- a/noncore/apps/opie-reader/BuffDoc.cpp +++ b/noncore/apps/opie-reader/BuffDoc.cpp | |||
@@ -1,27 +1,44 @@ | |||
1 | #include "static.h" | ||
2 | #include "names.h" | ||
1 | 3 | ||
2 | #define NEWLINEBREAK | 4 | #define NEWLINEBREAK |
5 | #define INCREMENTALWIDTH | ||
3 | 6 | ||
7 | #include "useqpe.h" | ||
8 | #include "usenef.h" | ||
4 | #include "BuffDoc.h" | 9 | #include "BuffDoc.h" |
5 | //#include <FL/fl_draw.h> | 10 | #include "config.h" |
11 | #include "CDrawBuffer.h" | ||
12 | #include "ZText.h" | ||
13 | #include "ebookcodec.h" | ||
14 | |||
15 | #ifdef __STATIC | ||
16 | #include "Aportis.h" | ||
17 | #include "CHM.h" | ||
18 | #include "ppm_expander.h" | ||
19 | #include "ztxt.h" | ||
6 | #include "plucker.h" | 20 | #include "plucker.h" |
7 | #ifdef USENEF | 21 | #ifdef USENEF |
8 | #include "nef.h" | 22 | #include "nef.h" |
9 | #include "arrierego.h" | 23 | #include "arrierego.h" |
10 | #endif | 24 | #endif |
25 | #include "iSilo.h" | ||
26 | #endif | ||
27 | |||
11 | 28 | ||
12 | linkType BuffDoc::hyperlink(unsigned int n, QString& wrd) | 29 | linkType BuffDoc::hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) |
13 | { | 30 | { |
14 | linkType bRet = eNone; | 31 | linkType bRet = eNone; |
15 | if (exp != NULL) | 32 | if (exp != NULL) |
16 | { | 33 | { |
17 | bRet = exp->hyperlink(n, wrd); | 34 | bRet = filt->hyperlink(n, noff, wrd, nm); |
18 | if (bRet == eLink) | 35 | if ((bRet & eLink) != 0) |
19 | { | 36 | { |
20 | lastword.empty(); | 37 | lastword.empty(); |
21 | lastsizes[0] = laststartline = n; | 38 | lastsizes[0] = laststartline = n; |
22 | #ifdef NEWLINEBREAK | 39 | #ifdef NEWLINEBREAK |
23 | lastispara = true; | 40 | lastispara = false; |
24 | #else | 41 | #else |
25 | lastispara = false; | 42 | lastispara = false; |
26 | #endif | 43 | #endif |
27 | lastsizes[0] = laststartline = exp->locate(); | 44 | lastsizes[0] = laststartline = exp->locate(); |
@@ -31,27 +48,109 @@ linkType BuffDoc::hyperlink(unsigned int n, QString& wrd) | |||
31 | } | 48 | } |
32 | 49 | ||
33 | void BuffDoc::locate(unsigned int n) | 50 | void BuffDoc::locate(unsigned int n) |
34 | { | 51 | { |
35 | // //odebug << "BuffDoc:locating:" << n << "" << oendl; | 52 | // //qDebug("BuffDoc:locating:%u",n); |
36 | lastword.empty(); | 53 | lastword.empty(); |
37 | lastsizes[0] = laststartline = n; | 54 | lastsizes[0] = laststartline = n; |
38 | #ifdef NEWLINEBREAK | 55 | #ifdef NEWLINEBREAK |
39 | lastispara = true; | 56 | lastispara = false; |
40 | #else | 57 | #else |
41 | lastispara = false; | 58 | lastispara = false; |
42 | #endif | 59 | #endif |
43 | // tchar linebuf[1024]; | 60 | // tchar linebuf[1024]; |
44 | if (exp != NULL) exp->locate(n); | 61 | if (exp != NULL) filt->locate(n); |
45 | // //odebug << "BuffDoc:Located" << oendl; | 62 | // //qDebug("BuffDoc:Located"); |
63 | } | ||
64 | |||
65 | static bool isletter(unsigned short c) | ||
66 | { | ||
67 | if ('a' <= c && c <= 'z') return true; | ||
68 | if ('A' <= c && c <= 'Z') return true; | ||
69 | // Cyrillic letters | ||
70 | if (0x400 <= c && c <= 0x52F) return true; | ||
71 | return false; | ||
72 | } | ||
73 | |||
74 | static bool isvowel(unsigned short c) // Only want lower case vowels | ||
75 | { | ||
76 | switch (c) | ||
77 | { | ||
78 | case 'a': | ||
79 | case 'e': | ||
80 | case 'i': | ||
81 | case 'o': | ||
82 | case 'u': | ||
83 | // Cyrillic vowels | ||
84 | case 0x430: | ||
85 | case 0x435: | ||
86 | case 0x438: | ||
87 | case 0x43E: | ||
88 | case 0x443: | ||
89 | case 0x44B: | ||
90 | case 0x44D: | ||
91 | case 0x44E: | ||
92 | case 0x44F: | ||
93 | case 0x451: | ||
94 | |||
95 | case 0x450: | ||
96 | case 0x454: | ||
97 | case 0x456: | ||
98 | case 0x457: | ||
99 | case 0x45D: | ||
100 | |||
101 | case 0x463: | ||
102 | |||
103 | case 0x4AF: | ||
104 | case 0x4B1: | ||
105 | case 0x4D1: | ||
106 | case 0x4D3: | ||
107 | |||
108 | case 0x4D5: | ||
109 | case 0x4D7: | ||
110 | case 0x4E3: | ||
111 | case 0x4E5: | ||
112 | case 0x4E7: | ||
113 | case 0x4E9: | ||
114 | case 0x4EB: | ||
115 | case 0x4ED: | ||
116 | case 0x4EF: | ||
117 | case 0x4F1: | ||
118 | case 0x4F3: | ||
119 | case 0x4F9: | ||
120 | return true; | ||
121 | default: | ||
122 | return ((0xe0 <= c) && (c <= 0xfc) && (c != 0xf1) && (c != 0xf7) && (c != 0xe7)); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | inline bool isconsonant(unsigned short c) | ||
127 | { | ||
128 | switch( c ) | ||
129 | { | ||
130 | // Some cyrillic letters are neither vowels, nor consonants, or otherwise | ||
131 | // the letters no word can start from. | ||
132 | case 0x439: | ||
133 | case 0x44A: | ||
134 | case 0x44C: | ||
135 | |||
136 | case 0x45E: | ||
137 | |||
138 | return false; | ||
139 | |||
140 | default: | ||
141 | return (isletter(c) && !isvowel(c)); | ||
142 | } | ||
143 | return (isletter(c) && !isvowel(c)); | ||
46 | } | 144 | } |
47 | 145 | ||
48 | #ifdef NEWLINEBREAK | 146 | #ifdef NEWLINEBREAK |
49 | bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | 147 | bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht) |
50 | { | 148 | { |
51 | bool moreleft = true; | 149 | bool moreleft = true; |
52 | bool margindone = false; | 150 | bool margindone = false; |
53 | int w = wth-2*_border; | 151 | int isCentred = -1; |
152 | int w = wth-(_lborder+_rborder); | ||
54 | tchar ch = 32; | 153 | tchar ch = 32; |
55 | CStyle cs; | 154 | CStyle cs; |
56 | buff->empty(); | 155 | buff->empty(); |
57 | if (exp == NULL) | 156 | if (exp == NULL) |
@@ -62,29 +161,38 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
62 | } | 161 | } |
63 | int len = 0; | 162 | int len = 0; |
64 | if (lastword.length() > 0) | 163 | if (lastword.length() > 0) |
65 | { | 164 | { |
165 | if (isCentred < 0) | ||
166 | { | ||
167 | isCentred = (lastword.firststyle().getJustify() == m_AlignCentre) ? 1 : 0; | ||
168 | } | ||
66 | *buff = lastword; | 169 | *buff = lastword; |
67 | cs = lastword.laststyle(); | 170 | cs = lastword.laststyle(); |
68 | w -= buff->leftMargin() + buff->rightMargin(); | 171 | w -= buff->leftMargin() + buff->rightMargin(); |
69 | margindone = true; | 172 | margindone = true; |
70 | len = lastword.length(); | 173 | len = lastword.length(); |
71 | } | 174 | } |
72 | else buff->empty(); | 175 | else buff->empty(); |
73 | lastword.empty(); | 176 | lastword.empty(); |
74 | unsigned int slen = buff->width(len); | 177 | unsigned int slen = buff->width(availht, len); |
75 | if (lastispara) buff->setstartpara(); | 178 | if (lastispara) buff->setstartpara(); |
179 | int nospaces = 0; | ||
76 | while (1) | 180 | while (1) |
77 | { | 181 | { |
78 | lastsizes[len] = exp->locate(); | 182 | getch(ch, cs, lastsizes[len]); |
79 | getch(ch, cs); | 183 | if (isCentred < 0) |
184 | { | ||
185 | isCentred = (cs.getJustify() == m_AlignCentre) ? 1 : 0; | ||
186 | } | ||
80 | if (ch == 10 && len == 0 && !lastispara) | 187 | if (ch == 10 && len == 0 && !lastispara) |
81 | { | 188 | { |
82 | lastsizes[len] = exp->locate(); | 189 | getch(ch, cs, lastsizes[len]); |
83 | getch(ch, cs); | 190 | buff->setstartpara(); |
84 | } | 191 | } |
85 | if (ch == UEOF) | 192 | if (ch == UEOF) |
86 | { | 193 | { |
194 | buff->setendpara(cs); | ||
87 | if (len == 0) | 195 | if (len == 0) |
88 | { | 196 | { |
89 | buff->setEof(); | 197 | buff->setEof(); |
90 | moreleft = false; | 198 | moreleft = false; |
@@ -93,22 +201,38 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
93 | break; | 201 | break; |
94 | } | 202 | } |
95 | if (ch == 10) | 203 | if (ch == 10) |
96 | { | 204 | { |
97 | buff->setendpara(); | 205 | buff->setendpara(cs); |
206 | lastispara = true; | ||
207 | laststartline = exp->locate(); | ||
208 | break; | ||
209 | } | ||
210 | if (ch == 6) | ||
211 | { | ||
212 | buff->setendpara(cs); | ||
213 | buff->setBop(); | ||
98 | lastispara = true; | 214 | lastispara = true; |
99 | laststartline = exp->locate(); | 215 | laststartline = exp->locate(); |
100 | break; | 216 | break; |
101 | } | 217 | } |
102 | lastispara = false; | 218 | lastispara = false; |
103 | buff->addch(ch, cs); | 219 | buff->addch(ch, cs); |
220 | if (ch == ' ') | ||
221 | { | ||
222 | nospaces++; | ||
223 | } | ||
104 | len++; | 224 | len++; |
105 | if (!margindone) | 225 | if (!margindone) |
106 | { | 226 | { |
107 | w -= buff->leftMargin() + buff->rightMargin(); | 227 | w -= buff->leftMargin() + buff->rightMargin(); |
108 | margindone = true; | 228 | margindone = true; |
109 | } | 229 | } |
110 | if ((slen = buff->width(len)) > w) | 230 | #ifdef INCREMENTALWIDTH |
231 | if ((slen += buff->charwidth(len-1, cs)) > w) | ||
232 | #else | ||
233 | if ((slen = buff->width(availht, len)) > w) | ||
234 | #endif | ||
111 | { | 235 | { |
112 | if (ch == ' ' || len == 1) | 236 | if (ch == ' ' || len == 1) |
113 | { | 237 | { |
114 | if (ch == ' ') buff->truncate(len-1); | 238 | if (ch == ' ') buff->truncate(len-1); |
@@ -116,32 +240,151 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
116 | break; | 240 | break; |
117 | } | 241 | } |
118 | else // should do a backward search for spaces, first. | 242 | else // should do a backward search for spaces, first. |
119 | { | 243 | { |
244 | int lastk = len-4; | ||
120 | for (int i = len-2; i > 0; i--) | 245 | for (int i = len-2; i > 0; i--) |
121 | { | 246 | { |
122 | if ((*buff)[i] == ' ') | 247 | if ( |
248 | (((*buff)[i] == 0x2014) && isletter((*buff)[i+1])) | ||
249 | || | ||
250 | ((*buff)[i] == '-') | ||
251 | // ((*buff)[i] == '-' && !(((*buff)[i-1] == '-') || ((*buff)[i+1] == '-'))) | ||
252 | ) | ||
123 | { | 253 | { |
124 | (*buff)[len] = 0; | 254 | (*buff)[len] = 0; |
125 | lastword.setright(*buff, i+1); | 255 | lastword.setright(*buff, i+1); |
126 | buff->truncate(i); | 256 | buff->truncate(i+1); |
127 | (*buff)[i] = '\0'; | 257 | (*buff)[i+1] = '\0'; |
128 | laststartline = lastsizes[i+1]; | 258 | laststartline = lastsizes[i+1]; |
129 | buff->resize(); | 259 | // buff->resize(); |
130 | for (int j = 0; j < lastword.length(); j++) | 260 | for (int j = 0; j < lastword.length(); j++) |
131 | { | 261 | { |
132 | lastsizes[j] = lastsizes[j+i+1]; | 262 | lastsizes[j] = lastsizes[j+i+1]; |
133 | } | 263 | } |
134 | return true; | 264 | return true; |
135 | } | 265 | } |
136 | if ((*buff)[i] == '-' && !(((*buff)[i-1] == '-') || ((*buff)[i+1] == '-'))) | 266 | |
267 | //if (hyphenate && (m_hyphenthreshold+1)*i < m_hyphenthreshold*len) | ||
268 | // We end up with i+1 characters instead of len-1 | ||
269 | // Thus we are removing len - 1 - (i + 1) = len-i-2 | ||
270 | // The space characters will be stretched to cover | ||
271 | // nospaces to nospaces + len - i - 2 | ||
272 | // The stretch factor is hence | ||
273 | // (nospaces+len-i-2)/nospaces | ||
274 | if (hyphenate && !isCentred && ( 100*(nospaces+len-i-2) > (100+m_hyphenthreshold)*nospaces )) | ||
275 | { | ||
276 | /* | ||
277 | if (m_customhyphen) | ||
278 | { | ||
279 | for (int k = lastk; k >= i && k >= 2; k--) | ||
280 | { | ||
281 | if ( | ||
282 | isletter((*buff)[k+3]) | ||
283 | && | ||
284 | isletter((*buff)[k+2]) | ||
285 | && | ||
286 | isvowel((*buff)[k+1]) | ||
287 | && | ||
288 | isconsonant((*buff)[k]) | ||
289 | && | ||
290 | isletter((*buff)[k-1]) | ||
291 | && | ||
292 | isletter((*buff)[k-2]) | ||
293 | ) | ||
294 | { | ||
295 | (*buff)[len] = 0; | ||
296 | lastword.setright(*buff, k+1); | ||
297 | buff->truncate(k+2); | ||
298 | (*buff)[k+1] = '-'; | ||
299 | (*buff)[k+2] = '\0'; | ||
300 | laststartline = lastsizes[k+1]; | ||
301 | buff->resize(); | ||
302 | for (int j = 0; j < lastword.length(); j++) | ||
303 | { | ||
304 | lastsizes[j] = lastsizes[j+k+1]; | ||
305 | } | ||
306 | return true; | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | else | ||
311 | */ | ||
312 | { | ||
313 | for (int k = lastk; k >= i && k >= 1; k--) | ||
314 | { | ||
315 | if ( | ||
316 | /* | ||
317 | ( | ||
318 | k < len-3 | ||
319 | && | ||
320 | k >= 1 | ||
321 | && | ||
322 | isletter((*buff)[k+3]) | ||
323 | && | ||
324 | isletter((*buff)[k+2]) | ||
325 | && | ||
326 | isconsonant((*buff)[k+1]) | ||
327 | && | ||
328 | ((*buff)[k+1] != 'y') | ||
329 | && | ||
330 | ((*buff)[k+1] != 'h') | ||
331 | && | ||
332 | isconsonant((*buff)[k]) | ||
333 | && | ||
334 | ((*buff)[k] != 'h') | ||
335 | && | ||
336 | isletter((*buff)[k-1]) | ||
337 | ) | ||
338 | || | ||
339 | */ | ||
340 | ( | ||
341 | isletter((*buff)[k+3]) | ||
342 | && | ||
343 | isletter((*buff)[k+2]) | ||
344 | && | ||
345 | isconsonant((*buff)[k+1]) | ||
346 | && | ||
347 | ((*buff)[k+1] != 'y') | ||
348 | && | ||
349 | isletter((*buff)[k]) | ||
350 | && | ||
351 | ((*buff)[k] != 'h') | ||
352 | && | ||
353 | isletter((*buff)[k-1]) | ||
354 | && // Do not hyphenate when the first part ends with a vowel, | ||
355 | // and the second starts with the two consonants. | ||
356 | // Examples: "co-nsona-nts" -> "con-sonants", | ||
357 | // "hy-phenation" -> "hyp-henation" etc. | ||
358 | !( isvowel( (*buff)[k] ) && isconsonant( (*buff)[k+2] ) ) | ||
359 | ) | ||
360 | ) | ||
361 | { | ||
362 | (*buff)[len] = 0; | ||
363 | lastword.setright(*buff, k+1); | ||
364 | buff->truncate(k+2); | ||
365 | (*buff)[k+1] = '-'; | ||
366 | (*buff)[k+2] = '\0'; | ||
367 | laststartline = lastsizes[k+1]; | ||
368 | // buff->resize(); | ||
369 | for (int j = 0; j < lastword.length(); j++) | ||
370 | { | ||
371 | lastsizes[j] = lastsizes[j+k+1]; | ||
372 | } | ||
373 | return true; | ||
374 | } | ||
375 | } | ||
376 | } | ||
377 | lastk = i; | ||
378 | } | ||
379 | if ((*buff)[i] == ' ') | ||
137 | { | 380 | { |
138 | (*buff)[len] = 0; | 381 | (*buff)[len] = 0; |
139 | lastword.setright(*buff, i+1); | 382 | lastword.setright(*buff, i+1); |
140 | buff->truncate(i+1); | 383 | buff->truncate(i); |
141 | (*buff)[i+1] = '\0'; | 384 | (*buff)[i] = '\0'; |
142 | laststartline = lastsizes[i+1]; | 385 | laststartline = lastsizes[i+1]; |
143 | buff->resize(); | 386 | // buff->resize(); |
144 | for (int j = 0; j < lastword.length(); j++) | 387 | for (int j = 0; j < lastword.length(); j++) |
145 | { | 388 | { |
146 | lastsizes[j] = lastsizes[j+i+1]; | 389 | lastsizes[j] = lastsizes[j+i+1]; |
147 | } | 390 | } |
@@ -161,16 +404,16 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
161 | } | 404 | } |
162 | } | 405 | } |
163 | } | 406 | } |
164 | (*buff)[len] = '\0'; | 407 | (*buff)[len] = '\0'; |
165 | buff->resize(); | 408 | // buff->resize(); |
166 | return moreleft; | 409 | return moreleft; |
167 | } | 410 | } |
168 | #else | 411 | #else |
169 | bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | 412 | bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned short _lborder, unsigned short _rborder) |
170 | { | 413 | { |
171 | bool margindone = false; | 414 | bool margindone = false; |
172 | int w = wth-2*_border; | 415 | int w = wth-(_lborder+_rborder); |
173 | tchar ch = 32; | 416 | tchar ch = 32; |
174 | CStyle cs; | 417 | CStyle cs; |
175 | buff->empty(); | 418 | buff->empty(); |
176 | if (exp == NULL) | 419 | if (exp == NULL) |
@@ -187,16 +430,16 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
187 | w -= buff->leftMargin() + buff->rightMargin(); | 430 | w -= buff->leftMargin() + buff->rightMargin(); |
188 | margindone = true; | 431 | margindone = true; |
189 | } | 432 | } |
190 | else buff->empty(); | 433 | else buff->empty(); |
191 | // //odebug << "Buff:" << toQString(buff->data()) << " Lastword:" << toQString(lastword.data()) << "" << oendl; | 434 | // //qDebug("Buff:%s Lastword:%s", (const char*)toQString(buff->data()), (const char*)toQString(lastword.data())); |
192 | lastcheck = len = buff->length(); | 435 | lastcheck = len = buff->length(); |
193 | unsigned int slen = buff->width(len); | 436 | unsigned int slen = buff->width(availht, len); |
194 | if (slen > w) | 437 | if (slen > w) |
195 | { | 438 | { |
196 | for ( ; len > 1; len--) | 439 | for ( ; len > 1; len--) |
197 | { | 440 | { |
198 | if (buff->width(len) < w) break; | 441 | if (buff->width(availht, len) < w) break; |
199 | } | 442 | } |
200 | // lastword = buff->data() + len - 1; | 443 | // lastword = buff->data() + len - 1; |
201 | laststartline = lastsizes[len-1]; | 444 | laststartline = lastsizes[len-1]; |
202 | for (int i = 0; i < buff->length(); i++) lastsizes[i] = lastsizes[i+len-1]; | 445 | for (int i = 0; i < buff->length(); i++) lastsizes[i] = lastsizes[i+len-1]; |
@@ -213,40 +456,38 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
213 | { | 456 | { |
214 | lastword.empty(); | 457 | lastword.empty(); |
215 | (*buff)[len] = '\0'; | 458 | (*buff)[len] = '\0'; |
216 | } | 459 | } |
217 | buff->resize(); | 460 | // buff->resize(); |
218 | return true; | 461 | return true; |
219 | } | 462 | } |
220 | if (lastispara) | 463 | if (lastispara) |
221 | { | 464 | { |
222 | lastispara = false; | 465 | lastispara = false; |
223 | // lastword[0] = '\0'; | 466 | // lastword[0] = '\0'; |
224 | lastword.empty(); | 467 | lastword.empty(); |
225 | len = buff->length(); | 468 | len = buff->length(); |
226 | while (buff->width(len) > w) len--; | 469 | while (buff->width(availht, len) > w) len--; |
227 | // (*buff)[len] = '\0'; | 470 | // (*buff)[len] = '\0'; |
228 | buff->truncate(len); | 471 | buff->truncate(len); |
229 | laststartline = exp->locate(); | 472 | laststartline = exp->locate(); |
230 | buff->resize(); | 473 | // buff->resize(); |
231 | return true; | 474 | return true; |
232 | } | 475 | } |
233 | lastispara = false; | 476 | lastispara = false; |
234 | for (int i = 0; i < len; i++) allsizes[i] = lastsizes[i]; | 477 | for (int i = 0; i < len; i++) allsizes[i] = lastsizes[i]; |
235 | while (slen < w) | 478 | while (slen < w) |
236 | { | 479 | { |
237 | lastcheck = len; | 480 | lastcheck = len; |
238 | allsizes[len] = exp->locate(); | 481 | getch(ch, cs, allsizes[len]); |
239 | getch(ch, cs); | ||
240 | while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128) | 482 | while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128) |
241 | { | 483 | { |
242 | len++; | 484 | len++; |
243 | buff->addch(ch,cs); | 485 | buff->addch(ch,cs); |
244 | allsizes[len] = exp->locate(); | 486 | getch(ch, cs, allsizes[len]); |
245 | getch(ch, cs); | ||
246 | } | 487 | } |
247 | (*buff)[len] = 0; | 488 | (*buff)[len] = 0; |
248 | slen = buff->width(len); | 489 | slen = buff->width(availht, len); |
249 | len++; | 490 | len++; |
250 | buff->addch(' ', cs); | 491 | buff->addch(' ', cs); |
251 | if (!margindone) | 492 | if (!margindone) |
252 | { | 493 | { |
@@ -285,9 +526,9 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
285 | // (*buff)[lastcheck] = '\0'; | 526 | // (*buff)[lastcheck] = '\0'; |
286 | buff->truncate(lastcheck); | 527 | buff->truncate(lastcheck); |
287 | } | 528 | } |
288 | // buff->frig(); | 529 | // buff->frig(); |
289 | buff->resize(); | 530 | // buff->resize(); |
290 | if (ch == UEOF && buff->length() == 0) | 531 | if (ch == UEOF && buff->length() == 0) |
291 | { | 532 | { |
292 | buff->setEof(); | 533 | buff->setEof(); |
293 | return false; | 534 | return false; |
@@ -295,49 +536,40 @@ bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border) | |||
295 | return true; | 536 | return true; |
296 | } | 537 | } |
297 | #endif | 538 | #endif |
298 | 539 | ||
299 | bool BuffDoc::getline(CDrawBuffer* buff, int wth, int cw, unsigned char _border) | 540 | bool BuffDoc::getline(CDrawBuffer* buff, int wth, int cw, unsigned short _lborder, unsigned short _rborder, int availht) |
300 | { | 541 | { |
301 | int w = wth-2*_border; | 542 | int w = wth-(_lborder+_rborder); |
302 | buff->empty(); | 543 | buff->empty(); |
303 | if (exp == NULL) | 544 | if (exp == NULL) |
304 | { | 545 | { |
305 | return false; | 546 | return false; |
306 | } | 547 | } |
307 | tchar ch; | 548 | tchar ch; |
308 | CStyle cs; | 549 | CStyle cs; |
309 | int i = 1; | 550 | int i = 1; |
310 | while (i*cw < w-buff->offset(w,0)) | 551 | int offset = buff->offset(w,0,0,availht); |
552 | while (i*cw < w-offset) | ||
311 | { | 553 | { |
312 | getch(ch, cs); | 554 | unsigned long dummy; |
555 | getch(ch, cs, dummy); | ||
313 | if (ch == '\12' || ch == UEOF) break; | 556 | if (ch == '\12' || ch == UEOF) break; |
314 | buff->addch(ch,cs); | 557 | buff->addch(ch,cs); |
315 | i++; | 558 | i++; |
316 | } | 559 | } |
317 | buff->truncate(i); | 560 | buff->truncate(i); |
318 | laststartline = exp->locate(); | 561 | laststartline = exp->locate(); |
319 | buff->resize(); | 562 | // buff->resize(); |
320 | return (ch != UEOF); | 563 | return (ch != UEOF); |
321 | } | 564 | } |
322 | 565 | ||
323 | int BuffDoc::openfile(QWidget* _parent, const char *src) | 566 | int BuffDoc::openfile(QWidget* _parent, const char *src) |
324 | { | 567 | { |
325 | // //odebug << "BuffDoc:Openfile:" << src << "" << oendl; | 568 | if (exp != NULL) delete exp; |
326 | // //odebug << "Trying aportis " << exp << "" << oendl; | 569 | exp = NULL; |
327 | if (exp != NULL) delete exp; | ||
328 | lastword.empty(); | ||
329 | lastsizes[0] = laststartline = 0; | ||
330 | #ifdef NEWLINEBREAK | ||
331 | lastispara = true; | ||
332 | #else | ||
333 | lastispara = false; | ||
334 | #endif | ||
335 | /* | ||
336 | exp = new Text; | ||
337 | int ret = exp->openfile(src); | ||
338 | */ | ||
339 | 570 | ||
571 | #ifdef __STATIC | ||
340 | exp = new Aportis; | 572 | exp = new Aportis; |
341 | int ret = exp->openfile(src); | 573 | int ret = exp->openfile(src); |
342 | if (ret == -1) | 574 | if (ret == -1) |
343 | { | 575 | { |
@@ -351,22 +583,34 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
351 | delete exp; | 583 | delete exp; |
352 | exp = new ztxt; | 584 | exp = new ztxt; |
353 | ret = exp->openfile(src); | 585 | ret = exp->openfile(src); |
354 | } | 586 | } |
587 | /* | ||
588 | } | ||
589 | if (ret != 0) | ||
590 | { | ||
591 | delete exp; | ||
592 | exp = new ebookcodec("Aportis"); | ||
593 | ret = exp->openfile(src); | ||
594 | if (ret == 0) qDebug("Aportis format"); | ||
595 | } | ||
596 | */ | ||
355 | #ifdef USENEF | 597 | #ifdef USENEF |
356 | if (ret != 0) | 598 | if (ret != 0) |
357 | { | 599 | { |
358 | 600 | ||
359 | delete exp; | 601 | delete exp; |
360 | exp = new CArriere; | 602 | exp = new CArriere; |
361 | ret = exp->openfile(src); | 603 | ret = exp->openfile(src); |
604 | if (ret == 0) qDebug("Arriere format"); | ||
362 | } | 605 | } |
363 | if (ret != 0) | 606 | if (ret != 0) |
364 | { | 607 | { |
365 | 608 | ||
366 | delete exp; | 609 | delete exp; |
367 | exp = new CNEF; | 610 | exp = new CNEF; |
368 | ret = exp->openfile(src); | 611 | ret = exp->openfile(src); |
612 | if (ret == 0) qDebug("NEF format"); | ||
369 | } | 613 | } |
370 | #endif | 614 | #endif |
371 | if (ret != 0) | 615 | if (ret != 0) |
372 | { | 616 | { |
@@ -376,37 +620,91 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) | |||
376 | ret = exp->openfile(src); | 620 | ret = exp->openfile(src); |
377 | } | 621 | } |
378 | if (ret != 0) | 622 | if (ret != 0) |
379 | { | 623 | { |
624 | |||
380 | delete exp; | 625 | delete exp; |
381 | //odebug << "Trying ppms" << oendl; | 626 | exp = new CHM; |
627 | ret = exp->openfile(src); | ||
628 | } | ||
629 | if (ret != 0) | ||
630 | { | ||
631 | |||
632 | delete exp; | ||
633 | exp = new iSilo; | ||
634 | ret = exp->openfile(src); | ||
635 | } | ||
636 | if (ret != 0) | ||
637 | { | ||
638 | delete exp; | ||
639 | //qDebug("Trying ppms"); | ||
382 | exp = new ppm_expander; | 640 | exp = new ppm_expander; |
383 | ret = exp->openfile(src); | 641 | ret = exp->openfile(src); |
384 | } | 642 | } |
385 | if (ret != 0) | 643 | if (ret != 0) |
386 | { | 644 | { |
387 | delete exp; | 645 | delete exp; |
388 | exp = new Text; | 646 | exp = new Text; |
389 | // //odebug << "Trying text" << oendl; | 647 | // //qDebug("Trying text"); |
390 | ret = exp->openfile(src); | 648 | ret = exp->openfile(src); |
649 | if (ret == 0) qDebug("Text format"); | ||
391 | } | 650 | } |
392 | 651 | ||
393 | if (ret != 0) | 652 | if (ret != 0) |
394 | { | 653 | { |
395 | delete exp; | 654 | delete exp; |
396 | QMessageBox::information(_parent, PROGNAME, "Unknown file compression type","Try another file"); | 655 | QMessageBox::information(_parent, PROGNAME, "Unknown file compression type","Try another file"); |
397 | return ret; | 656 | return ret; |
398 | } | 657 | } |
399 | // //odebug << "Doing final open:" << exp << ":" << filt << "" << oendl; | 658 | // //qDebug("Doing final open:%x:%x",exp,filt); |
659 | #else | ||
660 | QString codecpath(QTReaderUtil::getPluginPath()); | ||
661 | QDir d(codecpath, "*.so"); | ||
400 | 662 | ||
401 | lastword.empty(); | 663 | if (d.exists()) |
402 | lastsizes[0] = laststartline = 0; | 664 | { |
665 | |||
666 | const QFileInfoList *list = d.entryInfoList(); | ||
667 | QFileInfoListIterator it( *list ); // create list iterator | ||
668 | QFileInfo *fi; // pointer for traversing | ||
669 | |||
670 | int ret = -1; | ||
671 | while ( ret != 0 && (fi=it.current()) ) | ||
672 | { // for each file... | ||
673 | if (exp != NULL) delete exp; | ||
674 | qDebug("Trying %s", (const char*)fi->fileName()); | ||
675 | exp = new ebookcodec(fi->fileName()); | ||
676 | ret = exp->openfile(src); | ||
677 | ++it; | ||
678 | } | ||
679 | qDebug("Buffdoc:Finished opening"); | ||
680 | if (ret != 0) | ||
681 | { | ||
682 | if (exp != NULL) delete exp; | ||
683 | exp = new Text; | ||
684 | ret = exp->openfile(src); | ||
685 | } | ||
686 | } | ||
687 | else | ||
688 | { | ||
689 | if (exp != NULL) delete exp; | ||
690 | exp = new Text; | ||
691 | exp->openfile(src); | ||
692 | } | ||
693 | #endif | ||
694 | lastword.empty(); | ||
695 | lastsizes[0] = laststartline = 0; | ||
403 | #ifdef NEWLINEBREAK | 696 | #ifdef NEWLINEBREAK |
404 | lastispara = true; | 697 | lastispara = false; |
405 | #else | 698 | #else |
406 | lastispara = false; | 699 | lastispara = false; |
407 | #endif | 700 | #endif |
408 | exp->locate(0); | 701 | exp->locate(exp->getHome()); |
409 | filt->setsource(exp); | 702 | filt->setsource(exp); |
410 | // //odebug << "BuffDoc:file opened" << oendl; | 703 | qDebug("BuffDoc:file opened"); |
411 | return 0; | 704 | return 0; |
705 | } | ||
706 | |||
707 | QString BuffDoc::about() | ||
708 | { | ||
709 | return QString("Buffered Decompressor (c) Tim Wentford\nHyphenation algorithm (c) Tim Wentford\n (Cyrillic support by Konstantin Isakov\n")+filt->about(); | ||
412 | } | 710 | } |
diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h index 61531c0..a7dd7bf 100644 --- a/noncore/apps/opie-reader/BuffDoc.h +++ b/noncore/apps/opie-reader/BuffDoc.h | |||
@@ -1,14 +1,11 @@ | |||
1 | #ifndef __BuffDoc_h | 1 | #ifndef __BuffDoc_h |
2 | #define __BuffDoc_h | 2 | #define __BuffDoc_h |
3 | 3 | ||
4 | #include "useqpe.h" | 4 | #include "useqpe.h" |
5 | #include "ZText.h" | ||
6 | #include "Aportis.h" | ||
7 | #include "ztxt.h" | ||
8 | #include "ppm_expander.h" | ||
9 | #include "CDrawBuffer.h" | 5 | #include "CDrawBuffer.h" |
10 | #include "CFilter.h" | 6 | #include "CFilter.h" |
7 | #include "CExpander.h" | ||
11 | #include <qfontmetrics.h> | 8 | #include <qfontmetrics.h> |
12 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
13 | 10 | ||
14 | class BuffDoc | 11 | class BuffDoc |
@@ -16,107 +13,132 @@ class BuffDoc | |||
16 | CDrawBuffer lastword; | 13 | CDrawBuffer lastword; |
17 | CSizeBuffer lastsizes, allsizes; | 14 | CSizeBuffer lastsizes, allsizes; |
18 | size_t laststartline; | 15 | size_t laststartline; |
19 | bool lastispara; | 16 | bool lastispara; |
20 | CExpander* exp; | 17 | CExpander_Interface* exp; |
21 | CFilterChain* filt; | 18 | CFilterChain* filt; |
19 | int m_hyphenthreshold; | ||
20 | // bool m_customhyphen; | ||
22 | public: | 21 | public: |
22 | QString about(); | ||
23 | bool findanchor(const QString& nm) | ||
24 | { | ||
25 | return filt->findanchor(nm); | ||
26 | } | ||
27 | // void setCustomHyphen(bool _v) { m_customhyphen = _v; } | ||
28 | // bool getCustomHyphen() { return m_customhyphen; } | ||
29 | void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; } | ||
23 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 30 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
24 | { | 31 | { |
25 | if (exp == NULL) | 32 | if (exp == NULL) |
26 | { | 33 | { |
27 | data = NULL; | 34 | data = NULL; |
28 | len = 0; | 35 | len = 0; |
29 | } | 36 | } |
30 | else | 37 | else |
31 | { | 38 | { |
32 | exp->setSaveData(data, len, src, srclen); | 39 | exp->setSaveData(data, len, src, srclen); |
33 | } | 40 | } |
34 | } | 41 | } |
35 | void putSaveData(unsigned char*& src, unsigned short& srclen) | 42 | void putSaveData(unsigned char*& src, unsigned short& srclen) |
36 | { | 43 | { |
37 | if (exp != NULL) | 44 | if (exp != NULL) |
38 | { | 45 | { |
39 | exp->putSaveData(src, srclen); | 46 | exp->putSaveData(src, srclen); |
40 | } | 47 | } |
41 | } | 48 | } |
42 | #ifdef USEQPE | 49 | #ifdef USEQPE |
43 | void suspend() { if (exp != NULL) exp->suspend(); } | 50 | void suspend() { if (exp != NULL) exp->suspend(); } |
44 | void unsuspend() { if (exp != NULL) exp->unsuspend(); } | 51 | void unsuspend() { if (exp != NULL) exp->unsuspend(); } |
45 | #else | 52 | #else |
46 | void suspend() {} | 53 | void suspend() {} |
47 | void unsuspend() {} | 54 | void unsuspend() {} |
48 | #endif | 55 | #endif |
49 | ~BuffDoc() | 56 | ~BuffDoc() |
50 | { | 57 | { |
51 | delete filt; | 58 | delete filt; |
52 | delete exp; | 59 | delete exp; |
53 | } | 60 | } |
54 | BuffDoc() | 61 | BuffDoc() |
55 | { | 62 | { |
56 | exp = NULL; | 63 | exp = NULL; |
57 | filt = NULL; | 64 | filt = NULL; |
58 | lastword.empty(); | 65 | lastword.empty(); |
59 | // odebug << "Buffdoc created" << oendl; | 66 | // // qDebug("Buffdoc created"); |
60 | } | 67 | } |
61 | bool empty() { return (exp == NULL); } | 68 | bool empty() { return (exp == NULL); } |
62 | void setfilter(CFilterChain* _f) | 69 | void setfilter(CFilterChain* _f) |
63 | { | 70 | { |
64 | if (filt != NULL) delete filt; | 71 | if (filt != NULL) delete filt; |
65 | filt = _f; | 72 | filt = _f; |
66 | filt->setsource(exp); | 73 | filt->setsource(exp); |
67 | } | 74 | } |
68 | CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } | 75 | CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } |
69 | bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } | 76 | bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } |
70 | bool iseol() { return (lastword[0] == '\0'); } | 77 | bool iseol() { return (lastword[0] == '\0'); } |
71 | int openfile(QWidget* _parent, const char *src); | 78 | int openfile(QWidget* _parent, const char *src); |
72 | tchar getch() | 79 | tchar getch() |
73 | { | 80 | { |
74 | tchar ch = UEOF; | 81 | tchar ch = UEOF; |
75 | CStyle sty; | 82 | CStyle sty; |
76 | if (exp != NULL) | 83 | if (exp != NULL) |
77 | { | 84 | { |
78 | filt->getch(ch, sty); | 85 | unsigned long dummy; |
79 | } | 86 | filt->getch(ch, sty, dummy); |
80 | return ch; | 87 | } |
81 | } | 88 | return ch; |
82 | void getch(tchar& ch, CStyle& sty) | 89 | } |
83 | { | 90 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
84 | if (exp != NULL) | 91 | { |
85 | { | 92 | if (exp != NULL) |
86 | filt->getch(ch, sty); | 93 | { |
87 | } | 94 | filt->getch(ch, sty, pos); |
88 | else | 95 | } |
89 | ch = UEOF; | 96 | else |
90 | } | 97 | ch = UEOF; |
98 | } | ||
91 | void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } | 99 | void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } |
92 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } | 100 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } |
93 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } | 101 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } |
94 | unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); } | 102 | unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); } |
95 | unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } | 103 | unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } |
96 | unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } | 104 | unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } |
97 | void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } | 105 | void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } |
98 | MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } | 106 | MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } |
99 | linkType hyperlink(unsigned int n, QString& wrd); | 107 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); |
100 | size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } | 108 | size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } |
101 | void locate(unsigned int n); | 109 | void locate(unsigned int n); |
102 | bool getline(CDrawBuffer* buff, int w, unsigned char _border); | 110 | bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht); |
103 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); | 111 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht); |
104 | void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } | 112 | void sizes(unsigned long& fs, unsigned long& ts) |
113 | { | ||
114 | if (exp != NULL) | ||
115 | { | ||
116 | exp->sizes(fs,ts); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | fs = ts = 0; | ||
121 | } | ||
122 | } | ||
105 | int getpara(CBuffer& buff) | 123 | int getpara(CBuffer& buff) |
106 | { | 124 | { |
107 | tchar ch; | 125 | tchar ch; |
108 | int i = 0; | 126 | int i = 0; |
109 | while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; | 127 | while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; |
110 | buff[i] = '\0'; | 128 | buff[i] = '\0'; |
111 | if (i == 0 && ch == UEOF) i = -1; | 129 | if (i == 0 && ch == UEOF) i = -1; |
112 | laststartline = exp->locate(); | 130 | laststartline = exp->locate(); |
113 | return i; | 131 | return i; |
114 | } | 132 | } |
115 | void saveposn(size_t posn) { exp->saveposn(posn); } | 133 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } |
116 | void writeposn(size_t posn) { exp->writeposn(posn); } | 134 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } |
117 | bool forward(size_t& loc) { return exp->forward(loc); } | 135 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } |
118 | bool back(size_t& loc) { return exp->back(loc); } | 136 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } |
119 | bool hasnavigation() { return exp->hasnavigation(); } | 137 | bool hasnavigation() { return filt->hasnavigation(); } |
138 | bool getFile(QString href) | ||
139 | { | ||
140 | return (exp == NULL) ? false : exp->getFile(href); | ||
141 | } | ||
120 | }; | 142 | }; |
121 | 143 | ||
122 | #endif | 144 | #endif |
diff --git a/noncore/apps/opie-reader/ButtonPrefs.cpp b/noncore/apps/opie-reader/ButtonPrefs.cpp new file mode 100644 index 0000000..50365a8 --- a/dev/null +++ b/noncore/apps/opie-reader/ButtonPrefs.cpp | |||
@@ -0,0 +1,181 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:35 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "ButtonPrefs.h" | ||
10 | |||
11 | #include <qcheckbox.h> | ||
12 | #include <qlabel.h> | ||
13 | #include <qpushbutton.h> | ||
14 | #include <qspinbox.h> | ||
15 | #include <qlayout.h> | ||
16 | #include <qvariant.h> | ||
17 | #include <qtooltip.h> | ||
18 | #include <qwhatsthis.h> | ||
19 | #include <qbuttongroup.h> | ||
20 | #include <qmultilineedit.h> | ||
21 | #ifdef USECOMBO | ||
22 | #include <qcombobox.h> | ||
23 | #else | ||
24 | #include <qpe/menubutton.h> | ||
25 | #endif | ||
26 | #include <qfontdatabase.h> | ||
27 | |||
28 | #include <qlistview.h> | ||
29 | |||
30 | class MyQListViewItem : public QListViewItem | ||
31 | { | ||
32 | orKey o; | ||
33 | public: | ||
34 | MyQListViewItem(const orKey& _o, QListView* p, const QString& c1, const QString& c2, const QString& c3) : QListViewItem(p, c1, c2, c3), o(_o) { } | ||
35 | orKey getKey() { return o; } | ||
36 | }; | ||
37 | |||
38 | void CButtonPrefs::mapkey(Qt::ButtonState st, int _key) | ||
39 | { | ||
40 | mapkey(st, _key, action->currentItem()); | ||
41 | } | ||
42 | |||
43 | void CButtonPrefs::mapkey(Qt::ButtonState st, int _key, int act) | ||
44 | { | ||
45 | orKey key(st, _key, ((act == cesScrollMore) || (act == cesScrollLess))); | ||
46 | QMap<orKey,QListViewItem*>::Iterator iter = listmap.find(key); | ||
47 | if (iter != listmap.end()) | ||
48 | { | ||
49 | lb->takeItem(iter.data()); | ||
50 | } | ||
51 | (*kmap)[key] = act; | ||
52 | listmap[key] = new MyQListViewItem(key, lb, key.text(), action->text(act), (key.isScroll()) ? "*":""); | ||
53 | } | ||
54 | |||
55 | void CButtonPrefs::keyPressEvent(QKeyEvent* e) | ||
56 | { | ||
57 | switch (e->key()) | ||
58 | { | ||
59 | case Key_Shift: | ||
60 | case Key_Control: | ||
61 | case Key_Meta: | ||
62 | case Key_Alt: | ||
63 | case Key_CapsLock: | ||
64 | case Key_NumLock: | ||
65 | case Key_ScrollLock: | ||
66 | e->ignore(); | ||
67 | break; | ||
68 | default: | ||
69 | mapkey(e->state(), e->key()); | ||
70 | e->accept(); | ||
71 | break; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | #ifdef USECOMBO | ||
76 | void CButtonPrefs::populate(QComboBox *mb) | ||
77 | #else | ||
78 | void CButtonPrefs::populate(MenuButton *mb) | ||
79 | #endif | ||
80 | { | ||
81 | mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
82 | mb->insertItem( tr("Open file") ); | ||
83 | mb->insertItem( tr("Autoscroll") ); | ||
84 | mb->insertItem( tr("Bookmark") ); | ||
85 | mb->insertItem( tr("Annotate") ); | ||
86 | mb->insertItem( tr("Fullscreen") ); | ||
87 | |||
88 | mb->insertItem( tr("Zoom in") ); | ||
89 | mb->insertItem( tr("Zoom out") ); | ||
90 | mb->insertItem( tr("Back") ); | ||
91 | mb->insertItem( tr("Forward") ); | ||
92 | mb->insertItem( tr("Home") ); | ||
93 | mb->insertItem( tr("Page up") ); | ||
94 | mb->insertItem( tr("Page down") ); | ||
95 | mb->insertItem( tr("Line up") ); | ||
96 | mb->insertItem( tr("Line down") ); | ||
97 | mb->insertItem( tr("Beginning") ); | ||
98 | mb->insertItem( tr("End") ); | ||
99 | mb->insertItem( tr("Rotate") ); | ||
100 | mb->insertItem( tr("Scroll faster") ); | ||
101 | mb->insertItem( tr("Scroll slower") ); | ||
102 | mb->insertItem( tr("Invert colours") ); | ||
103 | mb->insertItem( tr("Toggle tools") ); | ||
104 | mb->insertItem( tr("Toggle scrollbar") ); | ||
105 | mb->insertItem( tr("Toggle statusbar") ); | ||
106 | mb->insertItem( tr("Next link") ); | ||
107 | mb->insertItem( tr("Goto link") ); | ||
108 | } | ||
109 | |||
110 | CButtonPrefs::CButtonPrefs( QMap<orKey, int>* _kmap, QWidget* parent, const char* name, WFlags fl ) | ||
111 | : QWidget( parent, name, fl ), kmap(_kmap) | ||
112 | { | ||
113 | QVBoxLayout* vo = new QVBoxLayout(this); | ||
114 | QHBoxLayout* lo = new QHBoxLayout(); | ||
115 | setFocusPolicy(QWidget::StrongFocus); | ||
116 | #ifdef USECOMBO | ||
117 | action = new QComboBox( this ); | ||
118 | #else | ||
119 | action = new MenuButton( this ); | ||
120 | #endif | ||
121 | populate(action); | ||
122 | action->setFocusProxy(this); | ||
123 | |||
124 | |||
125 | |||
126 | QMultiLineEdit* TextLabel1 = new QMultiLineEdit( this ); | ||
127 | TextLabel1->setText( tr( "Press the key(s) you want assigned to the highlighted function.\n\nPress the delete button to unmap the key.\n\nUse the \"Close\" button (not the [x]) to finish." ) ); | ||
128 | TextLabel1->setReadOnly(true); | ||
129 | TextLabel1->setWordWrap(QMultiLineEdit::WidgetWidth); | ||
130 | |||
131 | // lo->addWidget(TextLabel, 0, Qt::AlignTop); | ||
132 | // lo->addWidget(action, 0, Qt::AlignTop); | ||
133 | lo->addWidget(TextLabel1); | ||
134 | lo->addWidget(action); | ||
135 | vo->addLayout(lo); | ||
136 | lb = new QListView(this); | ||
137 | lb->addColumn( tr( "Key" ) ); | ||
138 | lb->addColumn( tr( "Function" ) ); | ||
139 | lb->addColumn( tr( "Scroll" ) ); | ||
140 | lb->setFocusProxy(this); | ||
141 | vo->addWidget(lb,1); | ||
142 | for (QMap<orKey,int>::Iterator i = kmap->begin(); i != kmap->end(); i++) | ||
143 | { | ||
144 | listmap[i.key()] = new MyQListViewItem(i.key(), lb, i.key().text(), action->text(i.data()), (i.key().isScroll()) ? "*":""); | ||
145 | } | ||
146 | |||
147 | lo = new QHBoxLayout(); | ||
148 | QLabel* TextLabel = new QLabel( this, "TextLabel1" ); | ||
149 | TextLabel->setText( tr( "Debounce" ) ); | ||
150 | lo->addWidget(TextLabel); | ||
151 | |||
152 | debounce = new QSpinBox( this, "Debounce" ); | ||
153 | debounce->setRange(0,1000); | ||
154 | lo->addWidget(debounce); | ||
155 | lo->addStretch(1); | ||
156 | QPushButton* delButton = new QPushButton("Delete", this); | ||
157 | connect(delButton, SIGNAL( clicked() ), this, SLOT( erasemapping() )); | ||
158 | lo->addWidget(delButton); | ||
159 | QPushButton* exitButton = new QPushButton("Close", this); | ||
160 | connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotClosed() ) ); | ||
161 | lo->addWidget(exitButton); | ||
162 | vo->addLayout(lo); | ||
163 | } | ||
164 | |||
165 | void CButtonPrefs::erasemapping() | ||
166 | { | ||
167 | MyQListViewItem* li = (MyQListViewItem*)lb->selectedItem(); | ||
168 | if (li != NULL) | ||
169 | { | ||
170 | orKey key(li->getKey()); | ||
171 | qDebug("Tapped %s", (const char*)key.text()); | ||
172 | kmap->remove(key); | ||
173 | lb->takeItem(listmap[key]); | ||
174 | listmap.remove(key); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | CButtonPrefs::~CButtonPrefs() | ||
179 | { | ||
180 | // no need to delete child widgets, Qt does it all for us | ||
181 | } | ||
diff --git a/noncore/apps/opie-reader/ButtonPrefs.h b/noncore/apps/opie-reader/ButtonPrefs.h new file mode 100644 index 0000000..9af04e1 --- a/dev/null +++ b/noncore/apps/opie-reader/ButtonPrefs.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:32 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef __BUTTON_PREFS_H | ||
10 | #define __BUTTON_PREFS_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qwidget.h> | ||
14 | #include <qtabdialog.h> | ||
15 | #include <qtabwidget.h> | ||
16 | #include <qspinbox.h> | ||
17 | #include <qcheckbox.h> | ||
18 | #include <qlineedit.h> | ||
19 | |||
20 | #define USECOMBO | ||
21 | |||
22 | #ifdef USECOMBO | ||
23 | #include <qcombobox.h> | ||
24 | #else | ||
25 | #include <qpe/menubutton.h> | ||
26 | #endif | ||
27 | |||
28 | #include "orkey.h" | ||
29 | |||
30 | class QVBoxLayout; | ||
31 | class QHBoxLayout; | ||
32 | class QGridLayout; | ||
33 | //class QCheckBox; | ||
34 | class QLabel; | ||
35 | //class QSpinBox; | ||
36 | class QListViewItem; | ||
37 | |||
38 | class QListView; | ||
39 | class QListViewItem; | ||
40 | |||
41 | class CButtonPrefs : public QWidget | ||
42 | { | ||
43 | Q_OBJECT | ||
44 | |||
45 | QMap<orKey, int> *kmap; | ||
46 | QMap<orKey, QListViewItem*> listmap; | ||
47 | QListView* lb; | ||
48 | void keyPressEvent(QKeyEvent* e); | ||
49 | #ifdef USECOMBO | ||
50 | void populate(QComboBox*); | ||
51 | #else | ||
52 | void populate(MenuButton*); | ||
53 | #endif | ||
54 | |||
55 | #ifdef USECOMBO | ||
56 | QComboBox *action; | ||
57 | #else | ||
58 | MenuButton *action; | ||
59 | #endif | ||
60 | QSpinBox* debounce; | ||
61 | signals: | ||
62 | void Closed(); | ||
63 | private slots: | ||
64 | void slotClosed() { emit Closed(); } | ||
65 | |||
66 | public: | ||
67 | |||
68 | CButtonPrefs( QMap<orKey, int>*, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
69 | ~CButtonPrefs(); | ||
70 | int Debounce() { return debounce->value(); } | ||
71 | void Debounce(int v) { debounce->setValue(v); } | ||
72 | void mapkey(Qt::ButtonState st, int key); | ||
73 | void mapkey(Qt::ButtonState st, int key, int _fn); | ||
74 | private slots: | ||
75 | void erasemapping(); | ||
76 | }; | ||
77 | #endif // CPREFS_H | ||
diff --git a/noncore/apps/opie-reader/CAnnoEdit.cpp b/noncore/apps/opie-reader/CAnnoEdit.cpp new file mode 100644 index 0000000..35821ed --- a/dev/null +++ b/noncore/apps/opie-reader/CAnnoEdit.cpp | |||
@@ -0,0 +1,121 @@ | |||
1 | #include "CAnnoEdit.h" | ||
2 | |||
3 | QColor CAnnoEdit::getColor() | ||
4 | { | ||
5 | switch (colorbox->currentItem()) | ||
6 | { | ||
7 | case 0: | ||
8 | default: | ||
9 | return white; | ||
10 | case 1: | ||
11 | return darkGray; | ||
12 | case 2: | ||
13 | return gray; | ||
14 | case 3: | ||
15 | return lightGray; | ||
16 | case 4: | ||
17 | return red; | ||
18 | case 5: | ||
19 | return green; | ||
20 | case 6: | ||
21 | return blue; | ||
22 | case 7: | ||
23 | return cyan; | ||
24 | case 8: | ||
25 | return magenta; | ||
26 | case 9: | ||
27 | return yellow; | ||
28 | case 10: | ||
29 | return darkRed; | ||
30 | case 11: | ||
31 | return darkGreen; | ||
32 | case 12: | ||
33 | return darkBlue; | ||
34 | case 13: | ||
35 | return darkCyan; | ||
36 | case 14: | ||
37 | return darkMagenta; | ||
38 | case 15: | ||
39 | return darkYellow; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | void CAnnoEdit::setColor(QColor v) | ||
44 | { | ||
45 | if (v == white) | ||
46 | colorbox->setCurrentItem(0); | ||
47 | else if (v == darkGray) | ||
48 | colorbox->setCurrentItem(1); | ||
49 | else if (v == gray) | ||
50 | colorbox->setCurrentItem(2); | ||
51 | else if (v == lightGray) | ||
52 | colorbox->setCurrentItem(3); | ||
53 | else if (v == red) | ||
54 | colorbox->setCurrentItem(4); | ||
55 | else if (v == green) | ||
56 | colorbox->setCurrentItem(5); | ||
57 | else if (v == blue) | ||
58 | colorbox->setCurrentItem(6); | ||
59 | else if (v == cyan) | ||
60 | colorbox->setCurrentItem(7); | ||
61 | else if (v == magenta) | ||
62 | colorbox->setCurrentItem(8); | ||
63 | else if (v == yellow) | ||
64 | colorbox->setCurrentItem(9); | ||
65 | else if (v == darkRed) | ||
66 | colorbox->setCurrentItem(10); | ||
67 | else if (v == darkGreen) | ||
68 | colorbox->setCurrentItem(11); | ||
69 | else if (v == darkBlue) | ||
70 | colorbox->setCurrentItem(12); | ||
71 | else if (v == darkCyan) | ||
72 | colorbox->setCurrentItem(13); | ||
73 | else if (v == darkMagenta) | ||
74 | colorbox->setCurrentItem(14); | ||
75 | else if (v == darkYellow) | ||
76 | colorbox->setCurrentItem(15); | ||
77 | else | ||
78 | colorbox->setCurrentItem(0); | ||
79 | } | ||
80 | |||
81 | CAnnoEdit::CAnnoEdit(QWidget *parent, const char *name, WFlags f) : | ||
82 | QWidget(parent, name, f) | ||
83 | { | ||
84 | QVBoxLayout* grid = new QVBoxLayout(this); | ||
85 | m_name = new QLineEdit(this, "Name"); | ||
86 | m_anno = new QMultiLineEdit(this, "Annotation"); | ||
87 | m_anno->setWordWrap(QMultiLineEdit::WidgetWidth); | ||
88 | QPushButton* exitButton = new QPushButton("Okay", this); | ||
89 | connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotOkay() ) ); | ||
90 | QPushButton* cancelButton = new QPushButton("Cancel", this); | ||
91 | connect(cancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); | ||
92 | QLabel *l = new QLabel("Text",this); | ||
93 | grid->addWidget(l); | ||
94 | grid->addWidget(m_name); | ||
95 | l = new QLabel("Annotation",this); | ||
96 | grid->addWidget(l); | ||
97 | grid->addWidget(m_anno,1); | ||
98 | |||
99 | colorbox = new QComboBox( this ); | ||
100 | |||
101 | colorbox->insertItem("None"); | ||
102 | colorbox->insertItem("Dark Gray"); | ||
103 | colorbox->insertItem("Gray"); | ||
104 | colorbox->insertItem("Light Gray"); | ||
105 | colorbox->insertItem("Red"); | ||
106 | colorbox->insertItem("Green"); | ||
107 | colorbox->insertItem("Blue"); | ||
108 | colorbox->insertItem("Cyan"); | ||
109 | colorbox->insertItem("Magenta"); | ||
110 | colorbox->insertItem("Yellow"); | ||
111 | colorbox->insertItem("Dark Red"); | ||
112 | colorbox->insertItem("Dark Green"); | ||
113 | colorbox->insertItem("Dark Blue"); | ||
114 | colorbox->insertItem("Dark Cyan"); | ||
115 | colorbox->insertItem("Dark Magenta"); | ||
116 | colorbox->insertItem("Dark Yellow"); | ||
117 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | ||
118 | hgrid->addWidget(colorbox); | ||
119 | hgrid->addWidget(cancelButton); | ||
120 | hgrid->addWidget(exitButton); | ||
121 | } | ||
diff --git a/noncore/apps/opie-reader/CAnnoEdit.h b/noncore/apps/opie-reader/CAnnoEdit.h index f320061..78d3eeb 100644 --- a/noncore/apps/opie-reader/CAnnoEdit.h +++ b/noncore/apps/opie-reader/CAnnoEdit.h | |||
@@ -4,19 +4,25 @@ | |||
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qlineedit.h> | 6 | #include <qlineedit.h> |
7 | #include <qmultilineedit.h> | 7 | #include <qmultilineedit.h> |
8 | #include <qcombobox.h> | ||
8 | 9 | ||
9 | class CAnnoEdit : public QWidget | 10 | class CAnnoEdit : public QWidget |
10 | { | 11 | { |
11 | Q_OBJECT | 12 | Q_OBJECT |
12 | 13 | ||
13 | QLineEdit* m_name; | 14 | QLineEdit* m_name; |
14 | QMultiLineEdit* m_anno; | 15 | QMultiLineEdit* m_anno; |
15 | size_t m_posn; | 16 | size_t m_posn, m_posn2; |
17 | QComboBox* colorbox; | ||
16 | public: | 18 | public: |
17 | void setPosn(size_t p) { m_posn = p; } | 19 | void setPosn(size_t p) { m_posn = p; } |
20 | void setPosn2(size_t p) { m_posn2 = p; } | ||
18 | size_t getPosn() { return m_posn; } | 21 | size_t getPosn() { return m_posn; } |
22 | size_t getPosn2() { return m_posn2; } | ||
23 | QColor getColor(); | ||
24 | void setColor(QColor); | ||
19 | void setName(const QString& name) | 25 | void setName(const QString& name) |
20 | { | 26 | { |
21 | m_name->setText(name); | 27 | m_name->setText(name); |
22 | } | 28 | } |
@@ -25,31 +31,14 @@ class CAnnoEdit : public QWidget | |||
25 | m_anno->setText(name); | 31 | m_anno->setText(name); |
26 | m_anno->setEdited(false); | 32 | m_anno->setEdited(false); |
27 | } | 33 | } |
28 | bool edited() { return m_anno->edited(); } | 34 | bool edited() { return m_anno->edited(); } |
29 | CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0) : | 35 | CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0); |
30 | QWidget(parent, name, f) | ||
31 | { | ||
32 | QVBoxLayout* grid = new QVBoxLayout(this); | ||
33 | m_name = new QLineEdit(this, "Name"); | ||
34 | m_anno = new QMultiLineEdit(this, "Annotation"); | ||
35 | m_anno->setWordWrap(QMultiLineEdit::WidgetWidth); | ||
36 | QPushButton* exitButton = new QPushButton("Okay", this); | ||
37 | connect(exitButton, SIGNAL( released() ), this, SLOT( slotOkay() ) ); | ||
38 | QPushButton* cancelButton = new QPushButton("Cancel", this); | ||
39 | connect(cancelButton, SIGNAL( released() ), this, SLOT( slotCancel() ) ); | ||
40 | QLabel *l = new QLabel("Text",this); | ||
41 | grid->addWidget(l); | ||
42 | grid->addWidget(m_name); | ||
43 | l = new QLabel("Annotation",this); | ||
44 | grid->addWidget(l); | ||
45 | grid->addWidget(m_anno,1); | ||
46 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | ||
47 | hgrid->addWidget(cancelButton); | ||
48 | hgrid->addWidget(exitButton); | ||
49 | } | ||
50 | private slots: | 36 | private slots: |
51 | void slotOkay() { emit finished(m_name->text(), m_anno->text()); } | 37 | void slotOkay() |
38 | { | ||
39 | emit finished(m_name->text(), m_anno->text()); | ||
40 | } | ||
52 | void slotCancel() { emit cancelled(); } | 41 | void slotCancel() { emit cancelled(); } |
53 | public: | 42 | public: |
54 | signals: | 43 | signals: |
55 | void finished(const QString&, const QString&); | 44 | void finished(const QString&, const QString&); |
diff --git a/noncore/apps/opie-reader/CBuffer.h b/noncore/apps/opie-reader/CBuffer.h index 252f3ac..7070499 100644 --- a/noncore/apps/opie-reader/CBuffer.h +++ b/noncore/apps/opie-reader/CBuffer.h | |||
@@ -49,7 +49,7 @@ class CBufferFace | |||
49 | } | 49 | } |
50 | }; | 50 | }; |
51 | 51 | ||
52 | typedef CBufferFace<tchar> CBuffer; | 52 | typedef CBufferFace<tchar> CBuffer; |
53 | typedef CBufferFace<size_t> CSizeBuffer; | 53 | typedef CBufferFace<unsigned long> CSizeBuffer; |
54 | 54 | ||
55 | #endif | 55 | #endif |
diff --git a/noncore/apps/opie-reader/CDrawBuffer.cpp b/noncore/apps/opie-reader/CDrawBuffer.cpp index b137ac3..cd79fec 100644 --- a/noncore/apps/opie-reader/CDrawBuffer.cpp +++ b/noncore/apps/opie-reader/CDrawBuffer.cpp | |||
@@ -1,8 +1,12 @@ | |||
1 | #include "CDrawBuffer.h" | 1 | #include "CDrawBuffer.h" |
2 | #include "FontControl.h" | 2 | #include "FontControl.h" |
3 | #include <qfontmetrics.h> | ||
3 | #include <qpainter.h> | 4 | #include <qpainter.h> |
5 | #include <qpixmap.h> | ||
4 | #include <qimage.h> | 6 | #include <qimage.h> |
7 | #include "useqpe.h" | ||
8 | #include "opie.h" | ||
5 | 9 | ||
6 | CDrawBuffer::~CDrawBuffer() | 10 | CDrawBuffer::~CDrawBuffer() |
7 | { | 11 | { |
8 | while (!segs.isEmpty()) segs.erase(0); | 12 | while (!segs.isEmpty()) segs.erase(0); |
@@ -12,9 +16,9 @@ void CDrawBuffer::setright(CDrawBuffer& rhs, int f) | |||
12 | { | 16 | { |
13 | int i; | 17 | int i; |
14 | len = rhs.len; | 18 | len = rhs.len; |
15 | fc = rhs.fc; | 19 | fc = rhs.fc; |
16 | m_maxstyle = m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; | 20 | m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; |
17 | while (!segs.isEmpty()) | 21 | while (!segs.isEmpty()) |
18 | { | 22 | { |
19 | segs.erase(0); | 23 | segs.erase(0); |
20 | } | 24 | } |
@@ -27,9 +31,8 @@ void CDrawBuffer::setright(CDrawBuffer& rhs, int f) | |||
27 | int st = next->start-f; | 31 | int st = next->start-f; |
28 | if (st < 0) st = 0; | 32 | if (st < 0) st = 0; |
29 | 33 | ||
30 | CStyle _style = next->style; | 34 | CStyle _style = next->style; |
31 | |||
32 | segs.push_back(textsegment(st,next->style)); | 35 | segs.push_back(textsegment(st,next->style)); |
33 | } | 36 | } |
34 | } | 37 | } |
35 | for (i = f; rhs[i] != '\0'; i++) (*this)[i-f] = rhs[i]; | 38 | for (i = f; rhs[i] != '\0'; i++) (*this)[i-f] = rhs[i]; |
@@ -39,15 +42,15 @@ void CDrawBuffer::setright(CDrawBuffer& rhs, int f) | |||
39 | 42 | ||
40 | CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) | 43 | CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) |
41 | { | 44 | { |
42 | int i; | 45 | int i; |
43 | // //odebug << "Trying 2" << oendl; | 46 | // //qDebug("Trying 2"); |
44 | len = rhs.len; | 47 | len = rhs.len; |
45 | m_maxstyle = rhs.m_maxstyle; | ||
46 | m_ascent = rhs.m_ascent; | 48 | m_ascent = rhs.m_ascent; |
47 | m_descent = rhs.m_descent; | 49 | m_descent = rhs.m_descent; |
48 | m_lineSpacing = rhs.m_lineSpacing; | 50 | m_lineSpacing = rhs.m_lineSpacing; |
49 | m_lineExtraSpacing = rhs.m_lineExtraSpacing; | 51 | m_lineExtraSpacing = rhs.m_lineExtraSpacing; |
52 | m_showPartial = rhs.m_showPartial; | ||
50 | while (!segs.isEmpty()) | 53 | while (!segs.isEmpty()) |
51 | { | 54 | { |
52 | segs.erase(0); | 55 | segs.erase(0); |
53 | } | 56 | } |
@@ -57,9 +60,9 @@ CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) | |||
57 | } | 60 | } |
58 | for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i]; | 61 | for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i]; |
59 | (*this)[i] = '\0'; | 62 | (*this)[i] = '\0'; |
60 | len = i; | 63 | len = i; |
61 | // //odebug << "Tried 2" << oendl; | 64 | // //qDebug("Tried 2"); |
62 | return *this; | 65 | return *this; |
63 | } | 66 | } |
64 | 67 | ||
65 | CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp) | 68 | CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp) |
@@ -79,19 +82,30 @@ CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp) | |||
79 | void CDrawBuffer::empty() | 82 | void CDrawBuffer::empty() |
80 | { | 83 | { |
81 | m_bSop = false; | 84 | m_bSop = false; |
82 | m_bEop = false; | 85 | m_bEop = false; |
86 | m_bBop = false; | ||
83 | len = 0; | 87 | len = 0; |
84 | (*this)[0] = 0; | 88 | (*this)[0] = 0; |
85 | while (!segs.isEmpty()) | 89 | while (!segs.isEmpty()) |
86 | { | 90 | { |
87 | segs.erase(0); | 91 | segs.erase(0); |
88 | } | 92 | } |
89 | segs.push_back(textsegment(0,CStyle())); | 93 | segs.push_back(textsegment(0,CStyle())); |
90 | m_maxstyle = m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; | 94 | m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; |
91 | m_bEof = false; | 95 | m_bEof = false; |
92 | } | 96 | } |
93 | 97 | ||
98 | void CDrawBuffer::setendpara(const CStyle& _style/* = ucFontBase*/) | ||
99 | { | ||
100 | m_bEop = true; | ||
101 | if (len == 0) | ||
102 | { | ||
103 | segs.first().start = 0; | ||
104 | segs.first().style = _style; | ||
105 | } | ||
106 | } | ||
107 | |||
94 | void CDrawBuffer::addch(tchar ch, CStyle _style/* = ucFontBase*/) | 108 | void CDrawBuffer::addch(tchar ch, CStyle _style/* = ucFontBase*/) |
95 | { | 109 | { |
96 | if (len == 0) | 110 | if (len == 0) |
97 | { | 111 | { |
@@ -110,9 +124,9 @@ void CDrawBuffer::truncate(int n) | |||
110 | len = n; | 124 | len = n; |
111 | (*this)[n] = 0; | 125 | (*this)[n] = 0; |
112 | } | 126 | } |
113 | 127 | ||
114 | int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _border) | 128 | int CDrawBuffer::width(int availht, int numchars, bool onscreen, int scwidth, unsigned short _lborder, unsigned short _rborder) |
115 | { | 129 | { |
116 | int gzoom = fc->gzoom(); | 130 | int gzoom = fc->gzoom(); |
117 | int currentx = 0, end = 0; | 131 | int currentx = 0, end = 0; |
118 | QString text = (numchars < 0) ? toQString(data()) : toQString(data(), numchars); | 132 | QString text = (numchars < 0) ? toQString(data()) : toQString(data(), numchars); |
@@ -149,9 +163,9 @@ int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _ | |||
149 | just = false; | 163 | just = false; |
150 | } | 164 | } |
151 | else | 165 | else |
152 | { | 166 | { |
153 | extraspace = (scwidth - 2*_border - rightMargin() - leftMargin() - width()); | 167 | extraspace = (scwidth - (_lborder+_rborder) - rightMargin() - leftMargin() - width(availht)); |
154 | if (extraspace == 0) just = false; | 168 | if (extraspace == 0) just = false; |
155 | } | 169 | } |
156 | } | 170 | } |
157 | CList<textsegment>::iterator textend = textstart; | 171 | CList<textsegment>::iterator textend = textstart; |
@@ -167,9 +181,15 @@ int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _ | |||
167 | if (currentstyle.isPicture()) | 181 | if (currentstyle.isPicture()) |
168 | { | 182 | { |
169 | if (currentstyle.canScale()) | 183 | if (currentstyle.canScale()) |
170 | { | 184 | { |
171 | currentx += (gzoom*currentstyle.getPicture()->width())/100; | 185 | int ht = (gzoom*currentstyle.getPicture()->height())/100; |
186 | int wt = (gzoom*currentstyle.getPicture()->width())/100; | ||
187 | if (ht > availht) | ||
188 | { | ||
189 | wt = (wt*availht)/ht; | ||
190 | } | ||
191 | currentx += wt; | ||
172 | } | 192 | } |
173 | else | 193 | else |
174 | { | 194 | { |
175 | currentx += currentstyle.getPicture()->width(); | 195 | currentx += currentstyle.getPicture()->width(); |
@@ -207,9 +227,9 @@ int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _ | |||
207 | } | 227 | } |
208 | else | 228 | else |
209 | { | 229 | { |
210 | QString nstr = str.mid(lastspace+1, nsp-lastspace); | 230 | QString nstr = str.mid(lastspace+1, nsp-lastspace); |
211 | // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl; | 231 | // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); |
212 | int lw = fm.width(nstr); | 232 | int lw = fm.width(nstr); |
213 | cx += lw; | 233 | cx += lw; |
214 | lastspace = nsp; | 234 | lastspace = nsp; |
215 | } | 235 | } |
@@ -229,8 +249,94 @@ int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _ | |||
229 | while (textend != segs.end() && end != numchars && textstart->start < len); | 249 | while (textend != segs.end() && end != numchars && textstart->start < len); |
230 | return currentx; | 250 | return currentx; |
231 | } | 251 | } |
232 | 252 | ||
253 | int CDrawBuffer::charwidth(int numchars, CStyle& currentstyle) | ||
254 | { | ||
255 | if (currentstyle.isPicture()) | ||
256 | { | ||
257 | int gzoom = fc->gzoom(); | ||
258 | if (currentstyle.canScale()) | ||
259 | { | ||
260 | return (gzoom*currentstyle.getPicture()->width())/100; | ||
261 | } | ||
262 | else | ||
263 | { | ||
264 | return currentstyle.getPicture()->width(); | ||
265 | } | ||
266 | } | ||
267 | else | ||
268 | { | ||
269 | if (currentstyle.isMono() && !fc->hasCourier()) | ||
270 | { | ||
271 | return (7*fc->getsize(currentstyle))/10; | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | QString text = QChar((data())[numchars]); | ||
276 | QFont f(currentstyle.isMono() ? QString(fc->fixedfontname()) : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); | ||
277 | // f.setUnderline(currentstyle.isUnderline()); | ||
278 | QFontMetrics fm(f); | ||
279 | return fm.width(text); | ||
280 | } | ||
281 | } | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | int CDrawBuffer::charwidth(int numchars) | ||
286 | { | ||
287 | int gzoom = fc->gzoom(); | ||
288 | int end = 0; | ||
289 | QString text = QChar((data())[numchars]); | ||
290 | CList<textsegment>::iterator textstart = segs.begin(); | ||
291 | CList<textsegment>::iterator textend = textstart; | ||
292 | do | ||
293 | { | ||
294 | textend++; | ||
295 | end = (textend != segs.end()) ? textend->start : len; | ||
296 | if (end <= numchars) | ||
297 | { | ||
298 | textstart = textend; | ||
299 | continue; | ||
300 | } | ||
301 | if (numchars >= 0 && end > numchars) | ||
302 | { | ||
303 | end = numchars; | ||
304 | } | ||
305 | CStyle currentstyle = textstart->style; | ||
306 | if (currentstyle.isPicture()) | ||
307 | { | ||
308 | if (currentstyle.canScale()) | ||
309 | { | ||
310 | return (gzoom*currentstyle.getPicture()->width())/100; | ||
311 | } | ||
312 | else | ||
313 | { | ||
314 | return currentstyle.getPicture()->width(); | ||
315 | } | ||
316 | } | ||
317 | else | ||
318 | { | ||
319 | if (currentstyle.isMono() && !fc->hasCourier()) | ||
320 | { | ||
321 | return (7*fc->getsize(currentstyle))/10; | ||
322 | } | ||
323 | else | ||
324 | { | ||
325 | QFont f(currentstyle.isMono() ? QString(fc->fixedfontname()) : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); | ||
326 | // f.setUnderline(currentstyle.isUnderline()); | ||
327 | QFontMetrics fm(f); | ||
328 | return fm.width(text); | ||
329 | } | ||
330 | } | ||
331 | textstart = textend; | ||
332 | } | ||
333 | while (textend != segs.end() /* && end != numchars*/ && textstart->start < len); | ||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | |||
338 | |||
233 | int CDrawBuffer::leftMargin() | 339 | int CDrawBuffer::leftMargin() |
234 | { | 340 | { |
235 | return (segs.begin()->style.getLeftMargin()*fc->getsize(segs.begin()->style)+3)/6; | 341 | return (segs.begin()->style.getLeftMargin()*fc->getsize(segs.begin()->style)+3)/6; |
236 | } | 342 | } |
@@ -239,40 +345,81 @@ int CDrawBuffer::rightMargin() | |||
239 | { | 345 | { |
240 | return (segs.begin()->style.getRightMargin()*fc->getsize(segs.begin()->style)+3)/6; | 346 | return (segs.begin()->style.getRightMargin()*fc->getsize(segs.begin()->style)+3)/6; |
241 | } | 347 | } |
242 | 348 | ||
243 | int CDrawBuffer::offset(int scwidth, unsigned char _border) | 349 | int CDrawBuffer::offset(int scwidth, unsigned short _lborder, unsigned short _rborder, int availht) |
244 | { | 350 | { |
245 | int currentx = _border; | 351 | int currentx = _lborder; |
246 | switch(segs.begin()->style.getJustify()) | 352 | switch(segs.begin()->style.getJustify()) |
247 | { | 353 | { |
248 | case m_AlignRight: | 354 | case m_AlignRight: |
249 | { | 355 | { |
250 | currentx = scwidth - _border - rightMargin() - width(); | 356 | currentx = scwidth - _rborder - rightMargin() - width(availht); |
251 | } | 357 | } |
252 | break; | 358 | break; |
253 | case m_AlignCentre: | 359 | case m_AlignCentre: |
254 | { | 360 | { |
255 | currentx = ( | 361 | currentx = ( |
256 | scwidth + | 362 | scwidth - _lborder -_rborder + |
257 | leftMargin() - rightMargin() | 363 | leftMargin() - rightMargin() |
258 | - width())/2; | 364 | - width(availht))/2 + _lborder; |
259 | } | 365 | } |
260 | break; | 366 | break; |
261 | case m_AlignJustify: | 367 | case m_AlignJustify: |
262 | case m_AlignLeft: | 368 | case m_AlignLeft: |
263 | currentx = _border + leftMargin(); | 369 | currentx = _lborder + leftMargin(); |
264 | break; | 370 | break; |
265 | } | 371 | } |
266 | return currentx; | 372 | return currentx; |
267 | } | 373 | } |
268 | 374 | ||
269 | void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scwidth, unsigned char _border) | 375 | void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scwidth, unsigned short _lborder, unsigned short _rborder, const QColor& _bg, int availht) |
270 | { | 376 | { |
377 | CList<textsegment>::iterator textstart = segs.begin(); | ||
378 | QColor paperColour = QColor(qRgb(textstart->style.pRed(), | ||
379 | textstart->style.pGreen(), | ||
380 | textstart->style.pBlue())); | ||
381 | |||
382 | Highlight(_p, !(paperColour == _bg), _lborder, _y, scwidth-(_lborder+_rborder), paperColour); | ||
383 | // Highlight(_p, true, _lborder, _y, scwidth-(_lborder+_rborder), paperColour); | ||
271 | int gzoom = fc->gzoom(); | 384 | int gzoom = fc->gzoom(); |
272 | int currentx = offset(scwidth, _border); | 385 | int currentx = offset(scwidth, _lborder, _rborder, availht); |
386 | if (!m_hastext) | ||
387 | { | ||
388 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); iter++) | ||
389 | { | ||
390 | CStyle currentstyle = iter->style; | ||
391 | if (currentstyle.isPicture()) | ||
392 | { | ||
393 | CStyle currentstyle = segs.begin()->style; | ||
394 | int ht = (gzoom*currentstyle.getPicture()->height())/100; | ||
395 | int wt = (gzoom*currentstyle.getPicture()->width())/100; | ||
396 | bool willscale = false; | ||
397 | if (ht > availht) | ||
398 | { | ||
399 | wt = (wt*availht)/ht; | ||
400 | ht = availht; | ||
401 | willscale = true; | ||
402 | } | ||
403 | |||
404 | QPixmap pc; | ||
405 | if ((willscale || gzoom != 100) && currentstyle.canScale()) | ||
406 | { | ||
407 | QImage im = currentstyle.getPicture()->smoothScale(wt,ht); | ||
408 | pc.convertFromImage(im); | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | pc.convertFromImage(*currentstyle.getPicture()); | ||
413 | } | ||
414 | int yoffset = pc.height()/2; | ||
415 | _p->drawPixmap( currentx, _y-yoffset, pc ); | ||
416 | currentx += pc.width(); | ||
417 | } | ||
418 | } | ||
419 | return; | ||
420 | } | ||
273 | QString text = toQString(data()); | 421 | QString text = toQString(data()); |
274 | CList<textsegment>::iterator textstart = segs.begin(); | ||
275 | int extraspace = 0; | 422 | int extraspace = 0; |
276 | bool just = (!m_bEop && textstart->style.getJustify() == m_AlignJustify); | 423 | bool just = (!m_bEop && textstart->style.getJustify() == m_AlignJustify); |
277 | int spaces = 0; | 424 | int spaces = 0; |
278 | int spacesofar = 0; | 425 | int spacesofar = 0; |
@@ -304,31 +451,52 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
304 | just = false; | 451 | just = false; |
305 | } | 452 | } |
306 | else | 453 | else |
307 | { | 454 | { |
308 | extraspace = (scwidth - 2*_border - rightMargin() - leftMargin() - width()); | 455 | extraspace = (scwidth - (_lborder+_rborder) - rightMargin() - leftMargin() - width(availht)); |
309 | if (extraspace == 0) just = false; | 456 | if (extraspace == 0) just = false; |
310 | } | 457 | } |
311 | } | 458 | } |
312 | CList<textsegment>::iterator textend = textstart; | 459 | CList<textsegment>::iterator textend = textstart; |
460 | |||
461 | bool drawBackground = false; | ||
313 | do | 462 | do |
314 | { | 463 | { |
315 | textend++; | 464 | textend++; |
316 | int end = (textend != segs.end()) ? textend->start : len; | 465 | int end = (textend != segs.end()) ? textend->start : len; |
317 | CStyle currentstyle = textstart->style; | 466 | CStyle currentstyle = textstart->style; |
467 | /* | ||
468 | bool drawBackground = ( | ||
469 | currentstyle.bRed() != 255 | ||
470 | || | ||
471 | currentstyle.bGreen() != 255 | ||
472 | || | ||
473 | currentstyle.bBlue() != 255 | ||
474 | ); | ||
475 | */ | ||
476 | QColor bgColour = QColor(qRgb(currentstyle.bRed(), | ||
477 | currentstyle.bGreen(), | ||
478 | currentstyle.bBlue())); | ||
479 | drawBackground = !(bgColour == _bg); | ||
480 | |||
481 | // if (drawBackground) qDebug("Drawing background"); | ||
482 | |||
318 | QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); | 483 | QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); |
319 | //f.setUnderline(currentstyle.isUnderline()); | 484 | //f.setUnderline(currentstyle.isUnderline()); |
320 | //if (currentstyle.isUnderline()) odebug << "UNDERLINE" << oendl; | 485 | //if (currentstyle.isUnderline()) qDebug("UNDERLINE"); |
321 | _p->setFont(f); | 486 | _p->setFont(f); |
322 | QString str = text.mid(textstart->start, end-textstart->start); | 487 | QString str = text.mid(textstart->start, end-textstart->start); |
323 | #if defined(OPIE) || !defined(USEQPE) | 488 | #if defined(OPIE) || !defined(USEQPE) |
324 | _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/100)); | 489 | _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/100)); |
325 | #else | 490 | #else |
326 | _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/10)); | 491 | _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/10)); |
327 | #endif | 492 | #endif |
328 | int voffset = currentstyle.getVOffset()*fc->getsize(currentstyle)/2; | 493 | int voffset = currentstyle.getVOffset()*fc->getsize(currentstyle)/2; |
494 | |||
329 | if (_bMono) | 495 | if (_bMono) |
330 | { | 496 | { |
497 | |||
498 | Highlight(_p, drawBackground, currentx, _y, str.length()*_charWidth, bgColour); | ||
331 | if (currentstyle.isUnderline()) | 499 | if (currentstyle.isUnderline()) |
332 | { | 500 | { |
333 | _p->drawLine( currentx, _y+voffset, currentx + str.length()*_charWidth, _y+voffset); | 501 | _p->drawLine( currentx, _y+voffset, currentx + str.length()*_charWidth, _y+voffset); |
334 | } | 502 | } |
@@ -348,13 +516,20 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
348 | if (currentstyle.isPicture()) | 516 | if (currentstyle.isPicture()) |
349 | { | 517 | { |
350 | int ht = (gzoom*currentstyle.getPicture()->height())/100; | 518 | int ht = (gzoom*currentstyle.getPicture()->height())/100; |
351 | int wt = (gzoom*currentstyle.getPicture()->width())/100; | 519 | int wt = (gzoom*currentstyle.getPicture()->width())/100; |
520 | bool willscale = false; | ||
521 | if (ht > availht) | ||
522 | { | ||
523 | wt = (wt*availht)/ht; | ||
524 | ht = availht; | ||
525 | willscale = true; | ||
526 | } | ||
352 | int ascent = fc->ascent(currentstyle)/2; | 527 | int ascent = fc->ascent(currentstyle)/2; |
353 | int yoffset = ht/2 + ascent; | 528 | int yoffset = ht/2 + ascent; |
354 | 529 | ||
355 | QPixmap pc; | 530 | QPixmap pc; |
356 | if (gzoom != 100 && currentstyle.canScale()) | 531 | if ((willscale || gzoom != 100) && currentstyle.canScale()) |
357 | { | 532 | { |
358 | QImage im = currentstyle.getPicture()->smoothScale(wt,ht); | 533 | QImage im = currentstyle.getPicture()->smoothScale(wt,ht); |
359 | pc.convertFromImage(im); | 534 | pc.convertFromImage(im); |
360 | } | 535 | } |
@@ -370,8 +545,9 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
370 | if (currentstyle.isMono() && !fc->hasCourier()) | 545 | if (currentstyle.isMono() && !fc->hasCourier()) |
371 | { | 546 | { |
372 | int cw = (7*fc->getsize(currentstyle))/10; | 547 | int cw = (7*fc->getsize(currentstyle))/10; |
373 | int w = cw*(end-textstart->start); | 548 | int w = cw*(end-textstart->start); |
549 | Highlight(_p, drawBackground, currentx, _y, w, bgColour); | ||
374 | if (currentstyle.isUnderline()) | 550 | if (currentstyle.isUnderline()) |
375 | { | 551 | { |
376 | _p->drawLine( currentx, _y+voffset, currentx + w, _y+voffset); | 552 | _p->drawLine( currentx, _y+voffset, currentx + w, _y+voffset); |
377 | } | 553 | } |
@@ -407,34 +583,41 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
407 | { | 583 | { |
408 | spacenumber++; | 584 | spacenumber++; |
409 | int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar; | 585 | int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar; |
410 | QString nstr = str.mid(lastspace+1, nsp-lastspace); | 586 | QString nstr = str.mid(lastspace+1, nsp-lastspace); |
411 | // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl; | 587 | // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); |
412 | int lw = fm.width(nstr); | 588 | int lw = fm.width(nstr); |
589 | Highlight(_p, drawBackground, cx, _y, lw, bgColour); | ||
413 | _p->drawText( cx, _y+voffset, nstr); | 590 | _p->drawText( cx, _y+voffset, nstr); |
591 | Highlight(_p, drawBackground, cx+lw, _y, nexttoadd, bgColour); | ||
414 | cx += lw+nexttoadd; | 592 | cx += lw+nexttoadd; |
415 | spacesofar += nexttoadd; | 593 | spacesofar += nexttoadd; |
416 | lastspace = nsp; | 594 | lastspace = nsp; |
417 | } | 595 | } |
418 | else | 596 | else |
419 | { | 597 | { |
420 | QString nstr = str.mid(lastspace+1, nsp-lastspace); | 598 | QString nstr = str.mid(lastspace+1, nsp-lastspace); |
421 | // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl; | 599 | // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); |
422 | int lw = fm.width(nstr); | 600 | int lw = fm.width(nstr); |
601 | Highlight(_p, drawBackground, cx, _y, lw, bgColour); | ||
423 | _p->drawText( cx, _y+voffset, nstr); | 602 | _p->drawText( cx, _y+voffset, nstr); |
424 | cx += lw; | 603 | cx += lw; |
425 | lastspace = nsp; | 604 | lastspace = nsp; |
426 | } | 605 | } |
427 | } | 606 | } |
428 | QString nstr = str.right(str.length()-1-lastspace); | 607 | QString nstr = str.right(str.length()-1-lastspace); |
608 | int lw = fm.width(nstr); | ||
609 | Highlight(_p, drawBackground, cx, _y, lw, bgColour); | ||
429 | _p->drawText( cx, _y+voffset, nstr); | 610 | _p->drawText( cx, _y+voffset, nstr); |
430 | cx += fm.width(nstr); | 611 | cx += lw; |
431 | w = cx - currentx; | 612 | w = cx - currentx; |
432 | } | 613 | } |
433 | else | 614 | else |
434 | { | 615 | { |
616 | int lw = fm.width(str); | ||
617 | Highlight(_p, drawBackground, currentx, _y, lw, bgColour); | ||
435 | _p->drawText( currentx, _y+voffset, str); | 618 | _p->drawText( currentx, _y+voffset, str); |
436 | w = fm.width(str); | 619 | w = lw; |
437 | } | 620 | } |
438 | if (currentstyle.isUnderline()) | 621 | if (currentstyle.isUnderline()) |
439 | { | 622 | { |
440 | _p->drawLine( currentx, _y+voffset, currentx + w, _y+voffset); | 623 | _p->drawLine( currentx, _y+voffset, currentx + w, _y+voffset); |
@@ -450,17 +633,37 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int | |||
450 | } | 633 | } |
451 | textstart = textend; | 634 | textstart = textend; |
452 | } | 635 | } |
453 | while (textend != segs.end() && textstart->start < len); | 636 | while (textend != segs.end() && textstart->start < len); |
637 | /* | ||
638 | if (firstColour == bgColour) | ||
639 | { | ||
640 | Highlight(_p, drawBackground, currentx, _y, scwidth - (currentx + _lborder + _rborder), bgColour); | ||
641 | } | ||
642 | */ | ||
643 | } | ||
644 | |||
645 | void CDrawBuffer::Highlight(QPainter* _p, bool drawBackground, int _x, int _y, int w, QColor bgColour) | ||
646 | { | ||
647 | if (drawBackground) | ||
648 | { | ||
649 | _p->fillRect(_x, _y-m_ascent, w, m_lineSpacing, bgColour); | ||
650 | } | ||
454 | } | 651 | } |
455 | 652 | ||
456 | CStyle CDrawBuffer::laststyle() | 653 | CStyle CDrawBuffer::laststyle() |
457 | { | 654 | { |
458 | return segs.last().style; | 655 | return segs.last().style; |
459 | } | 656 | } |
460 | 657 | ||
461 | linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt) | 658 | CStyle CDrawBuffer::firststyle() |
659 | { | ||
660 | return segs.first().style; | ||
661 | } | ||
662 | |||
663 | linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*& img) | ||
462 | { | 664 | { |
665 | linkType ret = eNone; | ||
463 | int end = 0; | 666 | int end = 0; |
464 | CStyle currentstyle; | 667 | CStyle currentstyle; |
465 | CList<textsegment>::iterator textstart = segs.begin(); | 668 | CList<textsegment>::iterator textstart = segs.begin(); |
466 | CList<textsegment>::iterator textend = textstart; | 669 | CList<textsegment>::iterator textend = textstart; |
@@ -469,78 +672,193 @@ linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt) | |||
469 | textend++; | 672 | textend++; |
470 | end = (textend != segs.end()) ? textend->start : len; | 673 | end = (textend != segs.end()) ? textend->start : len; |
471 | currentstyle = textstart->style; | 674 | currentstyle = textstart->style; |
472 | /* | 675 | /* |
473 | if (currentstyle.isPicture()) odebug << "Passed thru picture" << oendl; | 676 | if (currentstyle.isPicture()) qDebug("Passed thru picture"); |
474 | if (currentstyle.getLink()) odebug << "Passed thru link" << oendl; | 677 | if (currentstyle.getLink()) qDebug("Passed thru link"); |
475 | //odebug << "islink:" << numchars << " - " << end << "" << oendl; | 678 | //qDebug("islink:%d - %d", numchars, end); |
476 | */ | 679 | */ |
477 | textstart = textend; | 680 | textstart = textend; |
478 | } | 681 | } |
479 | while (textend != segs.end() && end <= numchars); | 682 | while (textend != segs.end() && end <= numchars); |
480 | // if (currentstyle.isPicture()) odebug << "Clicked on picture" << oendl; | 683 | img = currentstyle.getPicture(); |
481 | if (currentstyle.getPictureLink()) | 684 | if (currentstyle.getPictureLink()) |
482 | { | 685 | { |
483 | tgt = currentstyle.getPictureLinkData(); | 686 | pictgt = currentstyle.getPictureLinkData(); |
484 | return ePicture; | 687 | ret |= ePicture; |
485 | } | 688 | } |
486 | if (currentstyle.getLink()) | 689 | if (currentstyle.getLink()) |
487 | { | 690 | { |
488 | tgt = currentstyle.getData(); | 691 | tgt = currentstyle.getData(); |
489 | return eLink; | 692 | offset = currentstyle.getOffset(); |
693 | ret |= eLink; | ||
490 | } | 694 | } |
491 | return eNone; | 695 | return ret; |
492 | } | 696 | } |
493 | 697 | ||
494 | void CDrawBuffer::resize() | 698 | void CDrawBuffer::resize(int availht) |
495 | { | 699 | { |
496 | int gzoom = fc->gzoom(); | 700 | int gzoom = fc->gzoom(); |
497 | m_maxstyle = m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; | 701 | m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; |
702 | /* | ||
703 | int t_ascent = 0; | ||
704 | int t_descent = 0; | ||
705 | int t_lineExtraSpacing = 0; | ||
706 | */ | ||
707 | int t_lineSpacing = 0; | ||
708 | m_hastext = false; | ||
498 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end() && iter->start <= len; ) | 709 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end() && iter->start <= len; ) |
499 | { | 710 | { |
500 | CList<textsegment>::iterator next = iter; | 711 | CStyle _style = iter->style; |
501 | iter++; | 712 | if (!_style.isPicture()) |
502 | int st = next->start; | 713 | { |
503 | if (st < 0) st = 0; | 714 | m_hastext = true; |
715 | break; | ||
716 | } | ||
717 | iter++; | ||
718 | } | ||
719 | if (m_hastext) | ||
720 | { | ||
721 | |||
722 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end() && iter->start <= len; ) | ||
723 | { | ||
724 | CList<textsegment>::iterator next = iter; | ||
725 | iter++; | ||
726 | int st = next->start; | ||
727 | if (st < 0) st = 0; | ||
728 | |||
729 | CStyle _style = next->style; | ||
730 | |||
731 | int linespacing, ascent, descent, extra; | ||
732 | |||
733 | ascent = fc->ascent(_style); | ||
734 | descent = fc->descent(_style); | ||
735 | linespacing = fc->lineSpacing(_style); | ||
736 | extra = linespacing - ascent - descent; | ||
737 | /* | ||
738 | if (ascent > t_ascent) t_ascent = ascent; | ||
739 | if (descent > t_descent) t_descent = descent; | ||
740 | if (extra > t_lineExtraSpacing) t_lineExtraSpacing = extra; | ||
741 | t_lineSpacing = t_ascent+t_descent+t_lineExtraSpacing; | ||
742 | */ | ||
743 | if (linespacing > t_lineSpacing) t_lineSpacing = linespacing; | ||
744 | if (_style.isPicture()) | ||
745 | { | ||
746 | int ht = (gzoom*_style.getPicture()->height())/100; | ||
747 | int wt = (gzoom*_style.getPicture()->width())/100; | ||
504 | 748 | ||
505 | CStyle _style = next->style; | 749 | bool willscale = false; |
750 | if (ht > availht) | ||
751 | { | ||
752 | wt = (wt*availht)/ht; | ||
753 | ht = availht; | ||
754 | willscale = true; | ||
755 | } | ||
756 | if (willscale || _style.canScale()) | ||
757 | { | ||
758 | descent = ((gzoom*_style.getPicture()->height())/100-ascent)/2; | ||
759 | ascent = ((gzoom*_style.getPicture()->height())/100+ascent)/2; | ||
760 | } | ||
761 | } | ||
762 | |||
763 | /* | ||
764 | else if (fc != NULL) | ||
765 | { | ||
766 | ascent = fc->ascent(_style); | ||
767 | descent = fc->descent(_style); | ||
768 | linespacing = fc->lineSpacing(_style); | ||
769 | extra = linespacing - ascent - descent; | ||
770 | } | ||
771 | */ | ||
772 | if (ascent > m_ascent) m_ascent = ascent; | ||
773 | if (descent > m_descent) m_descent = descent; | ||
774 | if (extra > m_lineExtraSpacing) m_lineExtraSpacing = extra; | ||
775 | m_lineSpacing = m_ascent+m_descent+m_lineExtraSpacing; | ||
776 | } | ||
777 | m_showPartial = (m_lineSpacing > t_lineSpacing); | ||
778 | int lead = fc->getlead(); | ||
779 | if (lead != 0) | ||
780 | { | ||
781 | int xt = (lead*t_lineSpacing+5)/10; | ||
782 | m_lineExtraSpacing += xt; | ||
783 | m_lineSpacing += xt; | ||
784 | } | ||
785 | if (m_bSop) | ||
786 | { | ||
787 | int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10; | ||
788 | //qDebug("ExtraSpace:%d", xt); | ||
789 | m_ascent += xt; | ||
790 | m_lineSpacing += xt; | ||
791 | } | ||
792 | } | ||
793 | else | ||
794 | { | ||
795 | m_showPartial = true; | ||
796 | int maxheight = 0; | ||
797 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); iter++) | ||
798 | { | ||
799 | CStyle _style = iter->style; | ||
800 | if (_style.isPicture()) | ||
801 | { | ||
802 | int ht = 0; | ||
803 | if (_style.canScale()) | ||
804 | { | ||
805 | ht = ((gzoom*_style.getPicture()->height())/100); | ||
806 | } | ||
807 | else | ||
808 | { | ||
809 | ht = _style.getPicture()->height(); | ||
810 | } | ||
811 | if (ht > availht) | ||
812 | { | ||
813 | ht = availht; | ||
814 | } | ||
815 | if (ht > maxheight) maxheight = ht; | ||
816 | } | ||
817 | } | ||
818 | m_ascent = maxheight/2; | ||
819 | m_descent = maxheight-m_ascent; | ||
820 | m_lineExtraSpacing = 0; | ||
821 | m_lineSpacing = m_ascent+m_descent; | ||
822 | } | ||
823 | } | ||
506 | 824 | ||
507 | int linespacing, ascent, descent, extra; | 825 | CStyle* CDrawBuffer::getNextLink(int& offset) |
826 | { | ||
827 | CStyle* ret = NULL; | ||
828 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); ++iter) | ||
829 | { | ||
830 | if (offset < iter->start && iter->style.getLink()) | ||
831 | { | ||
832 | ret = &(iter->style); | ||
833 | offset = iter->start; | ||
834 | qDebug("Found a link at offset %d!", offset); | ||
835 | break; | ||
836 | } | ||
837 | } | ||
838 | return ret; | ||
839 | } | ||
508 | 840 | ||
509 | ascent = fc->ascent(_style); | 841 | int CDrawBuffer::invertLink(int offset) |
510 | descent = fc->descent(_style); | 842 | { |
511 | linespacing = fc->lineSpacing(_style); | 843 | for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); ++iter) |
512 | extra = linespacing - ascent - descent; | 844 | { |
513 | if (_style.isPicture() && _style.canScale()) | 845 | if (offset <= iter->start && iter->style.getLink()) |
514 | { | 846 | { |
515 | descent = ((gzoom*_style.getPicture()->height())/100-ascent)/2; | 847 | iter->style.invert(); |
516 | ascent = ((gzoom*_style.getPicture()->height())/100+ascent)/2; | 848 | unsigned long currentvalue = iter->style.getData(); |
517 | } | 849 | qDebug("Link data %u", currentvalue); |
518 | /* | 850 | CList<textsegment>::iterator next = iter; |
519 | else if (fc != NULL) | 851 | ++next; |
520 | { | 852 | while (next != segs.end() && (currentvalue == next->style.getData()) && next->style.getLink()) |
521 | ascent = fc->ascent(_style); | 853 | { |
522 | descent = fc->descent(_style); | 854 | next->style.invert(); |
523 | linespacing = fc->lineSpacing(_style); | 855 | offset = next->start; |
524 | extra = linespacing - ascent - descent; | 856 | iter++; |
525 | } | 857 | next++; |
526 | */ | 858 | } |
527 | if (ascent > m_ascent) m_ascent = ascent; | 859 | return offset; |
528 | if (descent > m_descent) m_descent = descent; | 860 | } |
529 | if (extra > m_lineExtraSpacing) m_lineExtraSpacing = extra; | 861 | } |
530 | m_lineSpacing = m_ascent+m_descent+m_lineExtraSpacing; | 862 | qDebug("Failed to invert"); |
531 | } | 863 | return offset; |
532 | int lead = fc->getlead(); | ||
533 | if (lead != 0) | ||
534 | { | ||
535 | int xt = (lead*m_lineSpacing+5)/10; | ||
536 | m_descent += xt; | ||
537 | m_lineSpacing += xt; | ||
538 | } | ||
539 | if (m_bSop) | ||
540 | { | ||
541 | int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10; | ||
542 | //odebug << "ExtraSpace:" << xt << "" << oendl; | ||
543 | m_ascent += xt; | ||
544 | m_lineSpacing += xt; | ||
545 | } | ||
546 | } | 864 | } |
diff --git a/noncore/apps/opie-reader/CDrawBuffer.h b/noncore/apps/opie-reader/CDrawBuffer.h index 9ec0ed9..2625a72 100644 --- a/noncore/apps/opie-reader/CDrawBuffer.h +++ b/noncore/apps/opie-reader/CDrawBuffer.h | |||
@@ -1,13 +1,15 @@ | |||
1 | #ifndef __CDRAWBUFFER_H | 1 | #ifndef __CDRAWBUFFER_H |
2 | #define __CDRAWBUFFER_H | 2 | #define __CDRAWBUFFER_H |
3 | 3 | ||
4 | #include <qcolor.h> | ||
4 | #include "StyleConsts.h" | 5 | #include "StyleConsts.h" |
5 | #include "CBuffer.h" | 6 | #include "CBuffer.h" |
6 | #include "my_list.h" | 7 | #include "my_list.h" |
7 | #include "linktype.h" | 8 | #include "linktype.h" |
8 | 9 | ||
9 | class QPainter; | 10 | class QPainter; |
11 | class QImage; | ||
10 | 12 | ||
11 | struct textsegment | 13 | struct textsegment |
12 | { | 14 | { |
13 | int start; | 15 | int start; |
@@ -21,19 +23,25 @@ struct textsegment | |||
21 | class FontControl; | 23 | class FontControl; |
22 | 24 | ||
23 | class CDrawBuffer : public CBuffer | 25 | class CDrawBuffer : public CBuffer |
24 | { | 26 | { |
27 | bool m_hastext; | ||
25 | CList<textsegment> segs; | 28 | CList<textsegment> segs; |
26 | int len; | 29 | int len; |
27 | FontControl* fc; | 30 | FontControl* fc; |
28 | int m_maxstyle, m_ascent, m_descent, m_lineSpacing, m_lineExtraSpacing; | 31 | int m_ascent, m_descent, m_lineSpacing, m_lineExtraSpacing; |
29 | bool m_bEof; | 32 | bool m_bEof, m_bBop; |
30 | bool m_bSop, m_bEop; | 33 | bool m_bSop, m_bEop; |
34 | bool m_showPartial; | ||
31 | CDrawBuffer(const CDrawBuffer&); | 35 | CDrawBuffer(const CDrawBuffer&); |
32 | CDrawBuffer& operator=(const tchar*sztmp); | 36 | CDrawBuffer& operator=(const tchar*sztmp); |
37 | void Highlight(QPainter*_p, bool drawBackground, int _x, int _y, int w, QColor bgColour); | ||
33 | public: | 38 | public: |
34 | void setstartpara() { m_bSop = true; } | 39 | void setstartpara() { m_bSop = true; } |
40 | void setBop() { m_bBop = true; } | ||
41 | bool isBop() { return m_bBop; } | ||
35 | void setendpara() { m_bEop = true; } | 42 | void setendpara() { m_bEop = true; } |
43 | void setendpara(const CStyle& cs); | ||
36 | int leftMargin(); | 44 | int leftMargin(); |
37 | int rightMargin(); | 45 | int rightMargin(); |
38 | void setEof() { m_bEof = true; } | 46 | void setEof() { m_bEof = true; } |
39 | bool eof() { return m_bEof; } | 47 | bool eof() { return m_bEof; } |
@@ -52,22 +60,28 @@ class CDrawBuffer : public CBuffer | |||
52 | { | 60 | { |
53 | empty(); | 61 | empty(); |
54 | } | 62 | } |
55 | */ | 63 | */ |
56 | int width(int numchars = -1, bool onscreen = false, int scwidth = 0, unsigned char _border = 0); | 64 | int charwidth(int numchars, CStyle& currentstyle); |
57 | int offset(int, unsigned char); | 65 | int charwidth(int numchars); |
58 | void render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scw, unsigned char); | 66 | int width(int availht, int numchars = -1, bool onscreen = false, int scwidth = 0, unsigned short _lborder = 0, unsigned short _rborder = 0); |
67 | int offset(int, unsigned short, unsigned short, int); | ||
68 | void render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scw, unsigned short, unsigned short, const QColor&, int availht); | ||
59 | void empty(); | 69 | void empty(); |
60 | void addch(tchar ch, CStyle _style); | 70 | void addch(tchar ch, CStyle _style); |
61 | void truncate(int); | 71 | void truncate(int); |
62 | void setright(CDrawBuffer&, int); | 72 | void setright(CDrawBuffer&, int); |
73 | CStyle firststyle(); | ||
63 | CStyle laststyle(); | 74 | CStyle laststyle(); |
64 | int ascent() { return m_ascent; } | 75 | int ascent() { return m_ascent; } |
65 | int descent() { return m_descent; } | 76 | int descent() { return m_descent; } |
66 | int lineSpacing() { return m_lineSpacing; } | 77 | int lineSpacing() { return m_lineSpacing; } |
67 | int lineExtraSpacing() { return m_lineExtraSpacing; } | 78 | int lineExtraSpacing() { return m_lineExtraSpacing; } |
68 | 79 | ||
69 | // void frig(); | 80 | // void frig(); |
70 | linkType getLinkType(int numchars, size_t& tgt); | 81 | linkType getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*&); |
71 | void resize(); | 82 | void resize(int); |
83 | bool showPartial() { return m_showPartial; } | ||
84 | CStyle* getNextLink(int&); | ||
85 | int invertLink(int); | ||
72 | }; | 86 | }; |
73 | #endif | 87 | #endif |
diff --git a/noncore/apps/opie-reader/CEncoding.cpp b/noncore/apps/opie-reader/CEncoding.cpp index 60a1057..cf2e01b 100644 --- a/noncore/apps/opie-reader/CEncoding.cpp +++ b/noncore/apps/opie-reader/CEncoding.cpp | |||
@@ -1,11 +1,11 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include "CEncoding.h" | 2 | #include "CEncoding.h" |
3 | 3 | ||
4 | void CUtf8::getch(tchar& ch, CStyle& sty) | 4 | void CUtf8::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
5 | { | 5 | { |
6 | tchar ret; | 6 | tchar ret; |
7 | parent->getch(ret, sty); | 7 | parent->getch(ret, sty, pos); |
8 | if (ret == UEOF) | 8 | if (ret == UEOF) |
9 | { | 9 | { |
10 | ch = UEOF; | 10 | ch = UEOF; |
11 | return; | 11 | return; |
@@ -17,9 +17,9 @@ void CUtf8::getch(tchar& ch, CStyle& sty) | |||
17 | while ((flags & (1 << 7)) != 0) | 17 | while ((flags & (1 << 7)) != 0) |
18 | { | 18 | { |
19 | ret <<= 6; | 19 | ret <<= 6; |
20 | tchar iret; | 20 | tchar iret; |
21 | parent->getch(iret, sty); | 21 | parent->getch(iret, sty, pos); |
22 | ret += iret & 0x3f; | 22 | ret += iret & 0x3f; |
23 | flags <<= 1; | 23 | flags <<= 1; |
24 | count++; | 24 | count++; |
25 | } | 25 | } |
@@ -42,40 +42,40 @@ void CUtf8::getch(tchar& ch, CStyle& sty) | |||
42 | ch = ret; | 42 | ch = ret; |
43 | return; | 43 | return; |
44 | } | 44 | } |
45 | 45 | ||
46 | void CUcs16be::getch(tchar& ch, CStyle& sty) | 46 | void CUcs16be::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
47 | { | 47 | { |
48 | tchar iret; | 48 | tchar iret; |
49 | parent->getch(iret, sty); | 49 | parent->getch(iret, sty, pos); |
50 | if (iret == UEOF) | 50 | if (iret == UEOF) |
51 | { | 51 | { |
52 | ch = UEOF; | 52 | ch = UEOF; |
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | tchar ret = iret; | 55 | tchar ret = iret; |
56 | parent->getch(iret, sty); | 56 | parent->getch(iret, sty, pos); |
57 | ch = (ret << 8) + iret; | 57 | ch = (ret << 8) + iret; |
58 | } | 58 | } |
59 | 59 | ||
60 | void CUcs16le::getch(tchar& ch, CStyle& sty) | 60 | void CUcs16le::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
61 | { | 61 | { |
62 | tchar iret; | 62 | tchar iret; |
63 | parent->getch(iret, sty); | 63 | parent->getch(iret, sty, pos); |
64 | if (iret == UEOF) | 64 | if (iret == UEOF) |
65 | { | 65 | { |
66 | ch = UEOF; | 66 | ch = UEOF; |
67 | return; | 67 | return; |
68 | } | 68 | } |
69 | tchar ret = iret; | 69 | tchar ret = iret; |
70 | parent->getch(iret, sty); | 70 | parent->getch(iret, sty, pos); |
71 | ch = ret + (iret << 8); | 71 | ch = ret + (iret << 8); |
72 | } | 72 | } |
73 | 73 | ||
74 | void Ccp1252::getch(tchar& ch, CStyle& sty) | 74 | void Ccp1252::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
75 | { | 75 | { |
76 | tchar iret; | 76 | tchar iret; |
77 | parent->getch(iret, sty); | 77 | parent->getch(iret, sty, pos); |
78 | ch = iret; | 78 | ch = iret; |
79 | switch (ch) | 79 | switch (ch) |
80 | { | 80 | { |
81 | case UEOF: | 81 | case UEOF: |
@@ -166,11 +166,11 @@ void Ccp1252::getch(tchar& ch, CStyle& sty) | |||
166 | break; | 166 | break; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | void CPalm::getch(tchar& ch, CStyle& sty) | 170 | void CPalm::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
171 | { | 171 | { |
172 | Ccp1252::getch(ch, sty); | 172 | Ccp1252::getch(ch, sty, pos); |
173 | switch (ch) | 173 | switch (ch) |
174 | { | 174 | { |
175 | case 0x18: | 175 | case 0x18: |
176 | ch = 0x2026; | 176 | ch = 0x2026; |
@@ -194,12 +194,12 @@ void CPalm::getch(tchar& ch, CStyle& sty) | |||
194 | break; | 194 | break; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | void CAscii::getch(tchar& ch, CStyle& sty) | 198 | void CAscii::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
199 | { | 199 | { |
200 | tchar iret; | 200 | tchar iret; |
201 | parent->getch(iret, sty); | 201 | parent->getch(iret, sty, pos); |
202 | if (iret == UEOF) | 202 | if (iret == UEOF) |
203 | { | 203 | { |
204 | ch = UEOF; | 204 | ch = UEOF; |
205 | } | 205 | } |
diff --git a/noncore/apps/opie-reader/CEncoding.h b/noncore/apps/opie-reader/CEncoding.h index df0104a..1dfd74d 100644 --- a/noncore/apps/opie-reader/CEncoding.h +++ b/noncore/apps/opie-reader/CEncoding.h | |||
@@ -8,50 +8,69 @@ | |||
8 | class CEncoding : public CCharacterSource | 8 | class CEncoding : public CCharacterSource |
9 | { | 9 | { |
10 | friend class CFilterChain; | 10 | friend class CFilterChain; |
11 | protected: | 11 | protected: |
12 | CExpander* parent; | 12 | CExpander_Interface* parent; |
13 | linkType hyperlink(unsigned int n, QString& t) { return parent->hyperlink(n,t); } | 13 | linkType hyperlink(unsigned int n, unsigned int noff, QString& t, QString& nm) { return parent->hyperlink(n, noff, t, nm); } |
14 | public: | 14 | public: |
15 | CEncoding() : parent(NULL) {} | 15 | CEncoding() : parent(NULL) {} |
16 | void setparent(CExpander* p) { parent = p; } | 16 | void setparent(CExpander_Interface* p) { parent = p; } |
17 | virtual ~CEncoding() {}; | 17 | virtual ~CEncoding() {}; |
18 | void locate(unsigned int n) { parent->locate(n); } | ||
19 | bool findanchor(const QString& nm) { return false; } | ||
20 | void saveposn(const QString& f, size_t posn) { parent->saveposn(posn); } | ||
21 | void writeposn(const QString& f, size_t posn) { parent->writeposn(posn); } | ||
22 | linkType forward(QString& f, size_t& loc) { return parent->forward(loc); } | ||
23 | linkType back(QString& f, size_t& loc) { return parent->back(loc); } | ||
24 | bool hasnavigation() { return parent->hasnavigation(); } | ||
25 | virtual int getwidth() { return parent->getwidth(); } | ||
26 | QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); } | ||
27 | QImage* getPicture(const QString& href) { return parent->getPicture(href); } | ||
28 | bool getFile(const QString& href) { qDebug("Encoding Get File"); return parent->getFile(href);} | ||
29 | |||
30 | |||
18 | }; | 31 | }; |
19 | 32 | ||
20 | class CUtf8 : public CEncoding | 33 | class CUtf8 : public CEncoding |
21 | { | 34 | { |
22 | public: | 35 | public: |
23 | void getch(tchar& ch, CStyle& sty); | 36 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
37 | QString about() { return QString("UTF8 decoder (c) Tim Wentford\n")+parent->about(); } | ||
24 | }; | 38 | }; |
25 | 39 | ||
26 | class CUcs16be : public CEncoding | 40 | class CUcs16be : public CEncoding |
27 | { | 41 | { |
28 | public: | 42 | public: |
29 | void getch(tchar& ch, CStyle& sty); | 43 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
44 | QString about() { return QString("UCS16 decoder (c) Tim Wentford\n")+parent->about(); } | ||
30 | }; | 45 | }; |
31 | 46 | ||
32 | class CUcs16le : public CEncoding | 47 | class CUcs16le : public CEncoding |
33 | { | 48 | { |
34 | public: | 49 | public: |
35 | void getch(tchar& ch, CStyle& sty); | 50 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
51 | QString about() { return QString("UCS16 decoder (c) Tim Wentford\n")+parent->about(); } | ||
36 | }; | 52 | }; |
37 | 53 | ||
38 | class Ccp1252 : public CEncoding | 54 | class Ccp1252 : public CEncoding |
39 | { | 55 | { |
40 | public: | 56 | public: |
41 | void getch(tchar& ch, CStyle& sty); | 57 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
58 | QString about() { return QString("Codepage 1252 decoder (c) Tim Wentford\n")+parent->about(); } | ||
42 | }; | 59 | }; |
43 | 60 | ||
44 | class CPalm : public Ccp1252 | 61 | class CPalm : public Ccp1252 |
45 | { | 62 | { |
46 | public: | 63 | public: |
47 | void getch(tchar& ch, CStyle& sty); | 64 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
65 | QString about() { return QString("Palm decoder (c) Tim Wentford\n")+parent->about(); } | ||
48 | }; | 66 | }; |
49 | 67 | ||
50 | class CAscii : public CEncoding | 68 | class CAscii : public CEncoding |
51 | { | 69 | { |
52 | public: | 70 | public: |
53 | void getch(tchar& ch, CStyle& sty); | 71 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
72 | QString about() { return QString("Vanilla Ascii decoder (c) Tim Wentford\n")+parent->about(); } | ||
54 | }; | 73 | }; |
55 | 74 | ||
56 | #include "CEncoding_tables.h" | 75 | #include "CEncoding_tables.h" |
57 | 76 | ||
@@ -59,16 +78,17 @@ class CGeneral8Bit : public CEncoding | |||
59 | { | 78 | { |
60 | int m_index; | 79 | int m_index; |
61 | public: | 80 | public: |
62 | CGeneral8Bit(int _i) : m_index(_i) | 81 | CGeneral8Bit(int _i) : m_index(_i) |
63 | { | 82 | { |
64 | // odebug << "8Bit: " << _i << oendl; | 83 | // qDebug("8Bit:%d", _i); |
65 | // odebug << unicodetable::iterator(_i)->mime << oendl; | 84 | // qDebug("%s", unicodetable::iterator(_i)->mime); |
66 | } | 85 | } |
67 | void getch(tchar& ch, CStyle& sty) | 86 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
68 | { | 87 | { |
69 | parent->getch(ch, sty); | 88 | parent->getch(ch, sty, pos); |
70 | ch = unicodetable::unicodevalue(m_index, ch); | 89 | ch = unicodetable::unicodevalue(m_index, ch); |
71 | } | 90 | } |
91 | QString about() { return QString("8-bit decoder (c) Tim Wentford - based on QT code\n")+parent->about(); } | ||
72 | }; | 92 | }; |
73 | 93 | ||
74 | #endif | 94 | #endif |
diff --git a/noncore/apps/opie-reader/CEncoding_tables.cpp b/noncore/apps/opie-reader/CEncoding_tables.cpp index e335819..667bda0 100644 --- a/noncore/apps/opie-reader/CEncoding_tables.cpp +++ b/noncore/apps/opie-reader/CEncoding_tables.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "CEncoding_tables.h" | 1 | #include "CEncoding_tables.h" |
2 | #include "config.h" | ||
2 | 3 | ||
3 | static const unicodetable unicodevalues[] = { | 4 | static const unicodetable unicodevalues[] = { |
4 | // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt | 5 | // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt |
5 | { "KOI8-R", "KOI8-R", 2084, | 6 | { "KOI8-R", "KOI8-R", 2084, |
diff --git a/noncore/apps/opie-reader/CExpander.cpp b/noncore/apps/opie-reader/CExpander.cpp new file mode 100644 index 0000000..e398d86 --- a/dev/null +++ b/noncore/apps/opie-reader/CExpander.cpp | |||
@@ -0,0 +1,103 @@ | |||
1 | #include "CExpander.h" | ||
2 | |||
3 | size_t CExpander::getHome() { return m_homepos; } | ||
4 | |||
5 | CExpander::CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; | ||
6 | |||
7 | CExpander::~CExpander() { if (fname != NULL) delete [] fname; }; | ||
8 | |||
9 | int CExpander::openfile(const char *src) | ||
10 | { | ||
11 | bSuspended = false; | ||
12 | fname = strdup(src); | ||
13 | return OpenFile(src); | ||
14 | } | ||
15 | |||
16 | void CExpander::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
17 | { | ||
18 | pos = locate(); | ||
19 | int ich = getch(); | ||
20 | ch = (ich == EOF) ? UEOF : ich; | ||
21 | // sty.unset(); | ||
22 | } | ||
23 | |||
24 | linkType CExpander::hyperlink(unsigned int n, unsigned int, QString& wrd, QString& nm) | ||
25 | { | ||
26 | locate(n); | ||
27 | return eLink; | ||
28 | } | ||
29 | |||
30 | unsigned long CExpander::startSection() | ||
31 | { | ||
32 | unsigned long current = locate(); | ||
33 | if (m_currentstart > current || current > m_currentend) | ||
34 | { | ||
35 | start2endSection(); | ||
36 | } | ||
37 | return m_currentstart; | ||
38 | } | ||
39 | |||
40 | unsigned long CExpander::endSection() | ||
41 | { | ||
42 | unsigned long current = locate(); | ||
43 | if (m_currentstart > current || current > m_currentend) | ||
44 | { | ||
45 | start2endSection(); | ||
46 | } | ||
47 | return m_currentend; | ||
48 | } | ||
49 | |||
50 | void CExpander::start2endSection() | ||
51 | { | ||
52 | m_currentstart = 0; | ||
53 | unsigned long file; | ||
54 | sizes(file, m_currentend); | ||
55 | } | ||
56 | |||
57 | #ifdef USEQPE | ||
58 | void CExpander::suspend(FILE*& fin) | ||
59 | { | ||
60 | bSuspended = true; | ||
61 | suspos = ftell(fin); | ||
62 | fclose(fin); | ||
63 | fin = NULL; | ||
64 | sustime = time(NULL); | ||
65 | } | ||
66 | |||
67 | void CExpander::unsuspend(FILE*& fin) | ||
68 | { | ||
69 | if (bSuspended) | ||
70 | { | ||
71 | bSuspended = false; | ||
72 | int delay = time(NULL) - sustime; | ||
73 | if (delay < 10) sleep(10-delay); | ||
74 | fin = fopen(fname, "rb"); | ||
75 | for (int i = 0; fin == NULL && i < 5; i++) | ||
76 | { | ||
77 | sleep(5); | ||
78 | fin = fopen(fname, "rb"); | ||
79 | } | ||
80 | if (fin == NULL) | ||
81 | { | ||
82 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); | ||
83 | exit(0); | ||
84 | } | ||
85 | suspos = fseek(fin, suspos, SEEK_SET); | ||
86 | } | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | void CExpander::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | ||
91 | { | ||
92 | len = srclen; | ||
93 | data = new unsigned char[len]; | ||
94 | memcpy(data, src, len); | ||
95 | } | ||
96 | |||
97 | void CExpander::putSaveData(unsigned char*& src, unsigned short& srclen) | ||
98 | { | ||
99 | if (srclen != 0) | ||
100 | { | ||
101 | qDebug("Don't know what to do with non-zero save data"); | ||
102 | } | ||
103 | } | ||
diff --git a/noncore/apps/opie-reader/CExpander.h b/noncore/apps/opie-reader/CExpander.h index 553069c..e9aaf79 100644 --- a/noncore/apps/opie-reader/CExpander.h +++ b/noncore/apps/opie-reader/CExpander.h | |||
@@ -1,41 +1,94 @@ | |||
1 | #ifndef __CExpander_h | 1 | #ifndef __CExpander_h |
2 | #define __CExpander_h | 2 | #define __CExpander_h |
3 | 3 | ||
4 | #ifndef _WINDOWS | ||
5 | #include <unistd.h> | ||
6 | #endif | ||
7 | #include <stdio.h> | ||
8 | #include <time.h> | ||
9 | #include <sys/stat.h> | ||
10 | #include <qmessagebox.h> | ||
4 | #include "useqpe.h" | 11 | #include "useqpe.h" |
5 | #include "config.h" | 12 | #include "config.h" |
6 | #include "StyleConsts.h" | 13 | #include "StyleConsts.h" |
7 | #include "Markups.h" | 14 | #include "Markups.h" |
8 | #include "names.h" | 15 | #include "names.h" |
9 | #include "linktype.h" | 16 | #include "linktype.h" |
10 | 17 | ||
11 | /* OPIE */ | ||
12 | #include <opie2/odebug.h> | ||
13 | |||
14 | /* QT */ | ||
15 | #include <qmessagebox.h> | ||
16 | |||
17 | /* STD */ | ||
18 | #ifndef _WINDOWS | ||
19 | #include <unistd.h> | ||
20 | #endif | ||
21 | #include <stdio.h> | ||
22 | #include <time.h> | ||
23 | |||
24 | class QImage; | 18 | class QImage; |
25 | class Bkmk; | 19 | class Bkmk; |
20 | class QString; | ||
26 | 21 | ||
27 | template<class T> | 22 | template<class T> |
28 | class CList; | 23 | class CList; |
29 | 24 | ||
30 | class CCharacterSource | 25 | class CCharacterSource |
31 | { | 26 | { |
32 | public: | 27 | public: |
33 | virtual void getch(tchar&, CStyle&) = 0; | 28 | virtual void getch(tchar&, CStyle&, unsigned long&) = 0; |
34 | virtual linkType hyperlink(unsigned int n, QString&) = 0; | 29 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString&, QString& nm) = 0; |
30 | virtual void locate(unsigned int n) = 0; | ||
31 | virtual bool findanchor(const QString& nm) = 0; | ||
32 | virtual void saveposn(const QString& f, size_t posn) = 0; | ||
33 | virtual void writeposn(const QString& f, size_t posn) = 0; | ||
34 | virtual linkType forward(QString& f, size_t& loc) = 0; | ||
35 | virtual linkType back(QString& f, size_t& loc) = 0; | ||
36 | virtual bool hasnavigation() = 0; | ||
37 | virtual int getwidth() = 0; | ||
38 | virtual QImage* getPicture(unsigned long) = 0; | ||
39 | virtual QImage* getPicture(const QString& href) = 0; | ||
40 | virtual bool getFile(const QString& href) = 0; | ||
41 | virtual QString about() = 0; | ||
42 | }; | ||
43 | |||
44 | class CExpander_Interface | ||
45 | { | ||
46 | public: | ||
47 | #ifdef USEQPE | ||
48 | virtual void suspend() = 0; | ||
49 | virtual void unsuspend() = 0; | ||
50 | #endif | ||
51 | virtual QString about() = 0; | ||
52 | virtual size_t getHome() = 0; | ||
53 | //CExpander_Interface(); | ||
54 | //virtual ~CExpander_Interface(); | ||
55 | virtual int openfile(const char *src) = 0; | ||
56 | //virtual int OpenFile(const char *src) = 0; | ||
57 | virtual unsigned int locate() = 0; | ||
58 | virtual void locate(unsigned int n) = 0; | ||
59 | virtual bool hasrandomaccess() = 0; | ||
60 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; | ||
61 | virtual CList<Bkmk>* getbkmklist() { return NULL; } | ||
62 | virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos) = 0; | ||
63 | virtual int getch() = 0; | ||
64 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) = 0; | ||
65 | virtual MarkupType PreferredMarkup() = 0; | ||
66 | virtual void saveposn(size_t posn) {} | ||
67 | virtual void writeposn(size_t posn) {} | ||
68 | virtual linkType forward(size_t& loc) { return eNone; } | ||
69 | virtual linkType back(size_t& loc) { return eNone; } | ||
70 | virtual bool hasnavigation() { return false; } | ||
71 | virtual unsigned long startSection() = 0; | ||
72 | virtual unsigned long endSection() = 0; | ||
73 | virtual void start2endSection() = 0; | ||
74 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } | ||
75 | virtual void setContinuous(bool _b) = 0; | ||
76 | #ifdef USEQPE | ||
77 | virtual void suspend(FILE*& fin) = 0; | ||
78 | virtual void unsuspend(FILE*& fin) = 0; | ||
79 | #endif | ||
80 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) = 0; | ||
81 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen) = 0; | ||
82 | virtual void setwidth(int w) = 0; | ||
83 | // bool findstring(const QString& info); | ||
84 | // int getpara(CBuffer& buff); | ||
85 | virtual int getwidth() = 0; | ||
86 | virtual QImage* getPicture(const QString& href) = 0; | ||
87 | virtual bool getFile(const QString& href) = 0; | ||
35 | }; | 88 | }; |
36 | 89 | ||
37 | class CExpander | 90 | class CExpander : public CExpander_Interface |
38 | { | 91 | { |
39 | protected: | 92 | protected: |
40 | size_t m_homepos; | 93 | size_t m_homepos; |
41 | bool m_continuous; | 94 | bool m_continuous; |
@@ -46,113 +99,51 @@ class CExpander | |||
46 | int m_scrWidth; | 99 | int m_scrWidth; |
47 | unsigned long m_currentstart, m_currentend; | 100 | unsigned long m_currentstart, m_currentend; |
48 | public: | 101 | public: |
49 | #ifdef USEQPE | 102 | #ifdef USEQPE |
50 | virtual void suspend() = 0; | 103 | virtual void suspend() = 0; |
51 | virtual void unsuspend() = 0; | 104 | virtual void unsuspend() = 0; |
52 | #endif | 105 | #endif |
53 | size_t getHome() { return m_homepos; } | 106 | size_t getHome(); |
54 | CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; | 107 | CExpander(); |
55 | virtual ~CExpander() { if (fname != NULL) delete [] fname; }; | 108 | virtual ~CExpander(); |
56 | int openfile(const char *src) | 109 | int openfile(const char *src); |
57 | { | ||
58 | bSuspended = false; | ||
59 | fname = strdup(src); | ||
60 | return OpenFile(src); | ||
61 | } | ||
62 | virtual int OpenFile(const char *src) = 0; | 110 | virtual int OpenFile(const char *src) = 0; |
63 | virtual unsigned int locate() = 0; | 111 | virtual unsigned int locate() = 0; |
64 | virtual void locate(unsigned int n) = 0; | 112 | virtual void locate(unsigned int n) = 0; |
65 | virtual bool hasrandomaccess() = 0; | 113 | virtual bool hasrandomaccess() = 0; |
66 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; | 114 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; |
67 | virtual CList<Bkmk>* getbkmklist() { return NULL; } | 115 | virtual CList<Bkmk>* getbkmklist() { return NULL; } |
68 | virtual void getch(tchar& ch, CStyle& sty) | 116 | virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
69 | { | ||
70 | int ich = getch(); | ||
71 | ch = (ich == EOF) ? UEOF : ich; | ||
72 | sty.unset(); | ||
73 | } | ||
74 | virtual int getch() = 0; | 117 | virtual int getch() = 0; |
75 | virtual linkType hyperlink(unsigned int n, QString& wrd) | 118 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); |
76 | { | ||
77 | locate(n); | ||
78 | return eLink; | ||
79 | } | ||
80 | virtual MarkupType PreferredMarkup() = 0; | 119 | virtual MarkupType PreferredMarkup() = 0; |
81 | virtual void saveposn(size_t posn) {} | 120 | virtual void saveposn(size_t posn) {} |
82 | virtual void writeposn(size_t posn) {} | 121 | virtual void writeposn(size_t posn) {} |
83 | virtual bool forward(size_t& loc) { return false; } | 122 | virtual linkType forward(size_t& loc) { return eNone; } |
84 | virtual bool back(size_t& loc) { return false; } | 123 | virtual linkType back(size_t& loc) { return eNone; } |
85 | virtual bool hasnavigation() { return false; } | 124 | virtual bool hasnavigation() { return false; } |
86 | unsigned long startSection() | 125 | unsigned long startSection(); |
87 | { | 126 | unsigned long endSection(); |
88 | unsigned long current = locate(); | 127 | virtual void start2endSection(); |
89 | if (m_currentstart > current || current > m_currentend) | ||
90 | { | ||
91 | start2endSection(); | ||
92 | } | ||
93 | return m_currentstart; | ||
94 | } | ||
95 | unsigned long endSection() | ||
96 | { | ||
97 | unsigned long current = locate(); | ||
98 | if (m_currentstart > current || current > m_currentend) | ||
99 | { | ||
100 | start2endSection(); | ||
101 | } | ||
102 | return m_currentend; | ||
103 | } | ||
104 | virtual void start2endSection() | ||
105 | { | ||
106 | m_currentstart = 0; | ||
107 | unsigned long file; | ||
108 | sizes(file, m_currentend); | ||
109 | } | ||
110 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } | 128 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } |
111 | void setContinuous(bool _b) { m_continuous = _b; } | 129 | void setContinuous(bool _b) { m_continuous = _b; } |
112 | #ifdef USEQPE | 130 | #ifdef USEQPE |
113 | virtual void suspend(FILE*& fin) | 131 | virtual void suspend(FILE*& fin); |
132 | virtual void unsuspend(FILE*& fin); | ||
133 | #endif | ||
134 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | ||
135 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen); | ||
136 | void setwidth(int w) | ||
114 | { | 137 | { |
115 | bSuspended = true; | 138 | m_scrWidth = w; |
116 | suspos = ftell(fin); | ||
117 | fclose(fin); | ||
118 | fin = NULL; | ||
119 | sustime = time(NULL); | ||
120 | } | 139 | } |
121 | virtual void unsuspend(FILE*& fin) | 140 | int getwidth() |
122 | { | ||
123 | if (bSuspended) | ||
124 | { | 141 | { |
125 | bSuspended = false; | 142 | return m_scrWidth; |
126 | int delay = time(NULL) - sustime; | ||
127 | if (delay < 10) sleep(10-delay); | ||
128 | fin = fopen(fname, "rb"); | ||
129 | for (int i = 0; fin == NULL && i < 5; i++) | ||
130 | { | ||
131 | sleep(5); | ||
132 | fin = fopen(fname, "rb"); | ||
133 | } | ||
134 | if (fin == NULL) | ||
135 | { | ||
136 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); | ||
137 | exit(0); | ||
138 | } | ||
139 | suspos = fseek(fin, suspos, SEEK_SET); | ||
140 | } | 143 | } |
141 | } | 144 | // bool findstring(const QString& info); |
142 | #endif | 145 | // int getpara(CBuffer& buff); |
143 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 146 | virtual QImage* getPicture(const QString& href) { return NULL; } |
144 | { | 147 | virtual bool getFile(const QString& href) { return false; } |
145 | len = srclen; | ||
146 | data = new unsigned char[len]; | ||
147 | memcpy(data, src, len); | ||
148 | } | ||
149 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen) | ||
150 | { | ||
151 | if (srclen != 0) | ||
152 | { | ||
153 | odebug << "Don't know what to do with non-zero save data" << oendl; | ||
154 | } | ||
155 | } | ||
156 | void setwidth(int w) { m_scrWidth = w; } | ||
157 | }; | 148 | }; |
158 | #endif | 149 | #endif |
diff --git a/noncore/apps/opie-reader/CFilter.cpp b/noncore/apps/opie-reader/CFilter.cpp index 0422ba6..6f76e9a 100644 --- a/noncore/apps/opie-reader/CFilter.cpp +++ b/noncore/apps/opie-reader/CFilter.cpp | |||
@@ -1,247 +1,39 @@ | |||
1 | #include <qmap.h> | ||
2 | #include <qfileinfo.h> | ||
3 | #include <qtextstream.h> | ||
4 | #include <qdir.h> | ||
5 | #include "useqpe.h" | ||
6 | #ifdef USEQPE | ||
7 | #include <qpe/global.h> | ||
8 | #endif | ||
9 | #include "CDrawBuffer.h" | ||
1 | #include "CFilter.h" | 10 | #include "CFilter.h" |
11 | #include "hrule.h" | ||
12 | #include "util.h" | ||
2 | 13 | ||
3 | unsigned short striphtml::skip_ws() | 14 | #include <qregexp.h> |
4 | { | 15 | #include <qimage.h> |
5 | tchar ch; | 16 | #include <qpixmap.h> |
6 | CStyle sty; | 17 | //#include <qprogressdialog.h> |
7 | do | 18 | //#include <qapplication.h> |
8 | { | ||
9 | parent->getch(ch, sty); | ||
10 | } | ||
11 | while (ch < 33); | ||
12 | return ch; | ||
13 | } | ||
14 | |||
15 | unsigned short striphtml::skip_ws_end() | ||
16 | { | ||
17 | tchar ch; | ||
18 | CStyle sty; | ||
19 | parent->getch(ch, sty); | ||
20 | if (ch == ' ') | ||
21 | { | ||
22 | do | ||
23 | { | ||
24 | parent->getch(ch, sty); | ||
25 | } | ||
26 | while (ch != '>'); | ||
27 | } | ||
28 | return ch; | ||
29 | } | ||
30 | |||
31 | unsigned short striphtml::parse_m() | ||
32 | { | ||
33 | tchar ch; | ||
34 | CStyle sty; | ||
35 | parent->getch(ch, sty); | ||
36 | if (ch == 'm' || ch == 'M') | ||
37 | { | ||
38 | ch = skip_ws_end(); | ||
39 | if (ch == '>') | ||
40 | { | ||
41 | return 0; | ||
42 | } | ||
43 | } | ||
44 | return ch; | ||
45 | } | ||
46 | |||
47 | void striphtml::mygetch(tchar& ch, CStyle& sty) | ||
48 | { | ||
49 | parent->getch(ch, sty); | ||
50 | if (ch == 10) ch = ' '; | ||
51 | } | ||
52 | |||
53 | void striphtml::getch(tchar& ch, CStyle& sty) | ||
54 | { | ||
55 | CStyle dummy; | ||
56 | mygetch(ch, dummy); | ||
57 | if (ch == 10) ch = ' '; | ||
58 | while (ch == '<') | ||
59 | { | ||
60 | ch = skip_ws(); | ||
61 | |||
62 | switch (ch) | ||
63 | { | ||
64 | case 'p': | ||
65 | case 'P': | ||
66 | ch = skip_ws_end(); | ||
67 | if (ch == '>') | ||
68 | { | ||
69 | ch = 10; | ||
70 | continue; | ||
71 | } | ||
72 | break; | ||
73 | case 'b': | ||
74 | case 'B': | ||
75 | ch = skip_ws_end(); | ||
76 | if (ch == '>') | ||
77 | { | ||
78 | currentstyle.setBold(); | ||
79 | mygetch(ch, dummy); | ||
80 | continue; | ||
81 | } | ||
82 | else if (ch == 'r' || ch == 'R') | ||
83 | { | ||
84 | ch = skip_ws_end(); | ||
85 | if (ch == '>') | ||
86 | { | ||
87 | ch = 10; | ||
88 | continue; | ||
89 | } | ||
90 | } | ||
91 | break; | ||
92 | case 'i': | ||
93 | case 'I': | ||
94 | ch = skip_ws_end(); | ||
95 | if (ch == '>') | ||
96 | { | ||
97 | currentstyle.setItalic(); | ||
98 | mygetch(ch, dummy); | ||
99 | continue; | ||
100 | } | ||
101 | break; | ||
102 | case 'e': | ||
103 | case 'E': | ||
104 | if ((ch = parse_m()) == 0) | ||
105 | { | ||
106 | currentstyle.setItalic(); | ||
107 | mygetch(ch, dummy); | ||
108 | continue; | ||
109 | } | ||
110 | break; | ||
111 | case 'h': | ||
112 | case 'H': | ||
113 | mygetch(ch, dummy); | ||
114 | if ('0' < ch && ch <= '9') | ||
115 | { | ||
116 | tchar hs = ch; | ||
117 | ch = skip_ws_end(); | ||
118 | if (ch == '>') | ||
119 | { | ||
120 | switch (hs) | ||
121 | { | ||
122 | case '1': | ||
123 | // currentstyle = ucBold | ucFontBase+2 | (ucAlignCentre << ucAlignShift); | ||
124 | currentstyle.unset(); | ||
125 | currentstyle.setFontSize(2); | ||
126 | currentstyle.setBold(); | ||
127 | currentstyle.setCentreJustify(); | ||
128 | break; | ||
129 | case '2': | ||
130 | // currentstyle = ucBold | ucFontBase+1; | ||
131 | currentstyle.unset(); | ||
132 | currentstyle.setFontSize(1); | ||
133 | currentstyle.setBold(); | ||
134 | break; | ||
135 | default: | ||
136 | // currentstyle = ucBold | ucFontBase; | ||
137 | currentstyle.unset(); | ||
138 | currentstyle.setBold(); | ||
139 | } | ||
140 | ch = 10; | ||
141 | // mygetch(ch, dummy); | ||
142 | continue; | ||
143 | } | ||
144 | } | ||
145 | break; | ||
146 | case '/': | ||
147 | mygetch(ch, dummy); | ||
148 | switch (ch) | ||
149 | { | ||
150 | case 'b': | ||
151 | case 'B': | ||
152 | ch = skip_ws_end(); | ||
153 | if (ch == '>') | ||
154 | { | ||
155 | currentstyle.unsetBold(); | ||
156 | mygetch(ch, dummy); | ||
157 | continue; | ||
158 | } | ||
159 | break; | ||
160 | case 'i': | ||
161 | case 'I': | ||
162 | ch = skip_ws_end(); | ||
163 | if (ch == '>') | ||
164 | { | ||
165 | currentstyle.unsetItalic(); | ||
166 | mygetch(ch, dummy); | ||
167 | continue; | ||
168 | } | ||
169 | break; | ||
170 | case 'e': | ||
171 | case 'E': | ||
172 | if ((ch = parse_m()) == 0) | ||
173 | { | ||
174 | currentstyle.unsetItalic(); | ||
175 | mygetch(ch, dummy); | ||
176 | continue; | ||
177 | } | ||
178 | break; | ||
179 | case 'h': | ||
180 | case 'H': | ||
181 | mygetch(ch, dummy); | ||
182 | if ('0' < ch && ch <= '9') | ||
183 | { | ||
184 | ch = skip_ws_end(); | ||
185 | if (ch == '>') | ||
186 | { | ||
187 | currentstyle.unset(); | ||
188 | //mygetch(ch, dummy); | ||
189 | ch = 10; | ||
190 | continue; | ||
191 | } | ||
192 | } | ||
193 | break; | ||
194 | default: | ||
195 | break; | ||
196 | } | ||
197 | break; | ||
198 | default: | ||
199 | break; | ||
200 | } | ||
201 | while (ch != '>' && ch != UEOF) | ||
202 | { | ||
203 | mygetch(ch, dummy); | ||
204 | } | ||
205 | mygetch(ch, dummy); | ||
206 | } | ||
207 | if (ch == '&') | ||
208 | { | ||
209 | mygetch(ch, dummy); | ||
210 | if (ch == '#') | ||
211 | { | ||
212 | int id = 0; | ||
213 | mygetch(ch, dummy); | ||
214 | while (ch != ';' && ch != UEOF) | ||
215 | { | ||
216 | id = 10*id+ch-'0'; | ||
217 | mygetch(ch, dummy); | ||
218 | } | ||
219 | ch = id; | ||
220 | } | ||
221 | } | ||
222 | // sty = (dummy == ucFontBase) ? currentstyle : dummy; | ||
223 | sty = currentstyle; | ||
224 | return; | ||
225 | } | ||
226 | |||
227 | 19 | ||
228 | void textfmt::mygetch(tchar& ch, CStyle& sty) | 20 | void textfmt::mygetch(tchar& ch, CStyle& sty, unsigned long& pos) |
229 | { | 21 | { |
230 | if (uselast) | 22 | if (uselast) |
231 | { | 23 | { |
232 | ch = lastchar; | 24 | ch = lastchar; |
233 | uselast = false; | 25 | uselast = false; |
234 | } | 26 | } |
235 | else | 27 | else |
236 | { | 28 | { |
237 | parent->getch(ch, sty); | 29 | parent->getch(ch, sty, pos); |
238 | } | 30 | } |
239 | } | 31 | } |
240 | 32 | ||
241 | void textfmt::getch(tchar& ch, CStyle& sty) | 33 | void textfmt::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
242 | { | 34 | { |
243 | mygetch(ch, sty); | 35 | mygetch(ch, sty, pos); |
244 | do | 36 | do |
245 | { | 37 | { |
246 | sty = currentstyle; | 38 | sty = currentstyle; |
247 | switch (ch) | 39 | switch (ch) |
@@ -252,9 +44,9 @@ void textfmt::getch(tchar& ch, CStyle& sty) | |||
252 | break; | 44 | break; |
253 | // Use this if you want to replace -- by em-dash | 45 | // Use this if you want to replace -- by em-dash |
254 | case '-': | 46 | case '-': |
255 | // parent->getch(ch, sty); | 47 | // parent->getch(ch, sty); |
256 | mygetch(ch, sty); | 48 | mygetch(ch, sty, pos); |
257 | if (ch == '-') | 49 | if (ch == '-') |
258 | { | 50 | { |
259 | ch = 0x2014; | 51 | ch = 0x2014; |
260 | } | 52 | } |
@@ -276,17 +68,17 @@ void textfmt::getch(tchar& ch, CStyle& sty) | |||
276 | { | 68 | { |
277 | currentstyle.unsetBold(); | 69 | currentstyle.unsetBold(); |
278 | CStyle dummy; | 70 | CStyle dummy; |
279 | // parent->getch(ch, dummy); | 71 | // parent->getch(ch, dummy); |
280 | mygetch(ch, dummy); | 72 | mygetch(ch, dummy, pos); |
281 | } | 73 | } |
282 | } | 74 | } |
283 | else | 75 | else |
284 | { | 76 | { |
285 | // not bold - time to turn it on? | 77 | // not bold - time to turn it on? |
286 | CStyle dummy; | 78 | CStyle dummy; |
287 | // parent->getch(ch, dummy); | 79 | // parent->getch(ch, dummy); |
288 | mygetch(ch, dummy); | 80 | mygetch(ch, dummy, pos); |
289 | QChar c(ch); | 81 | QChar c(ch); |
290 | if ((ch != '*') && (c.isPunct() || c.isLetterOrNumber())) | 82 | if ((ch != '*') && (c.isPunct() || c.isLetterOrNumber())) |
291 | { | 83 | { |
292 | currentstyle.setBold(); | 84 | currentstyle.setBold(); |
@@ -311,17 +103,17 @@ void textfmt::getch(tchar& ch, CStyle& sty) | |||
311 | { | 103 | { |
312 | currentstyle.unsetItalic(); | 104 | currentstyle.unsetItalic(); |
313 | CStyle dummy; | 105 | CStyle dummy; |
314 | // parent->getch(ch, dummy); | 106 | // parent->getch(ch, dummy); |
315 | mygetch(ch, dummy); | 107 | mygetch(ch, dummy, pos); |
316 | } | 108 | } |
317 | } | 109 | } |
318 | else | 110 | else |
319 | { | 111 | { |
320 | // not bold - time to turn it on? | 112 | // not bold - time to turn it on? |
321 | CStyle dummy; | 113 | CStyle dummy; |
322 | // parent->getch(ch, dummy); | 114 | // parent->getch(ch, dummy); |
323 | mygetch(ch, dummy); | 115 | mygetch(ch, dummy, pos); |
324 | QChar c(ch); | 116 | QChar c(ch); |
325 | if ((ch != '_') && (c.isPunct() || c.isLetterOrNumber())) | 117 | if ((ch != '_') && (c.isPunct() || c.isLetterOrNumber())) |
326 | { | 118 | { |
327 | currentstyle.setItalic(); | 119 | currentstyle.setItalic(); |
@@ -341,17 +133,17 @@ void textfmt::getch(tchar& ch, CStyle& sty) | |||
341 | if (!uselast) lastchar = ch; | 133 | if (!uselast) lastchar = ch; |
342 | return; | 134 | return; |
343 | } | 135 | } |
344 | 136 | ||
345 | void remap::getch(tchar& ch, CStyle& sty) | 137 | void remap::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
346 | { | 138 | { |
347 | if (q[offset] != 0) | 139 | if (q[offset] != 0) |
348 | { | 140 | { |
349 | q[offset++]; | 141 | q[offset++]; |
350 | sty = currentstyle; | 142 | sty = currentstyle; |
351 | return; | 143 | return; |
352 | } | 144 | } |
353 | parent->getch(ch, sty); | 145 | parent->getch(ch, sty, pos); |
354 | switch (ch) | 146 | switch (ch) |
355 | { | 147 | { |
356 | case 0x201a: | 148 | case 0x201a: |
357 | ch = '\''; | 149 | ch = '\''; |
@@ -422,8 +214,16 @@ void remap::getch(tchar& ch, CStyle& sty) | |||
422 | q[0] = 'e'; | 214 | q[0] = 'e'; |
423 | q[1] = 0; | 215 | q[1] = 0; |
424 | ch = 'o';// should be oe | 216 | ch = 'o';// should be oe |
425 | break; | 217 | break; |
218 | /* | ||
219 | case 0x0009: // tab | ||
220 | offset = 0; | ||
221 | q[0] = ' '; | ||
222 | q[1] = 0; | ||
223 | ch = ' '; | ||
224 | break; | ||
225 | */ | ||
426 | case 0x017e: | 226 | case 0x017e: |
427 | ch = 'z'; | 227 | ch = 'z'; |
428 | break; | 228 | break; |
429 | case 0x0178: | 229 | case 0x0178: |
@@ -432,25 +232,25 @@ void remap::getch(tchar& ch, CStyle& sty) | |||
432 | } | 232 | } |
433 | currentstyle = sty; | 233 | currentstyle = sty; |
434 | } | 234 | } |
435 | 235 | ||
436 | void PeanutFormatter::getch(tchar& ch, CStyle& sty) | 236 | void PeanutFormatter::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
437 | { | 237 | { |
438 | CStyle dummy; | 238 | CStyle dummy; |
439 | currentstyle.setColour(0,0,0); | 239 | currentstyle.setColour(0,0,0); |
440 | parent->getch(ch, dummy); | 240 | parent->getch(ch, dummy, pos); |
441 | while (ch == '\\') | 241 | while (ch == '\\') |
442 | { | 242 | { |
443 | parent->getch(ch, dummy); | 243 | parent->getch(ch, dummy, pos); |
444 | if (ch == '\\') break; | 244 | if (ch == '\\') break; |
445 | switch(ch) | 245 | switch(ch) |
446 | { | 246 | { |
447 | case 'a': | 247 | case 'a': |
448 | { | 248 | { |
449 | int code = 0; | 249 | int code = 0; |
450 | for (int i = 0; i < 3; i++) | 250 | for (int i = 0; i < 3; i++) |
451 | { | 251 | { |
452 | parent->getch(ch, dummy); | 252 | parent->getch(ch, dummy, pos); |
453 | code = 10*code + ch - '0'; | 253 | code = 10*code + ch - '0'; |
454 | } | 254 | } |
455 | ch = code; | 255 | ch = code; |
456 | } | 256 | } |
@@ -458,15 +258,15 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
458 | case 'v': | 258 | case 'v': |
459 | { | 259 | { |
460 | while (1) | 260 | while (1) |
461 | { | 261 | { |
462 | parent->getch(ch, dummy); | 262 | parent->getch(ch, dummy, pos); |
463 | if (ch == '\\') | 263 | if (ch == '\\') |
464 | { | 264 | { |
465 | parent->getch(ch, dummy); | 265 | parent->getch(ch, dummy, pos); |
466 | if (ch == 'v') | 266 | if (ch == 'v') |
467 | { | 267 | { |
468 | parent->getch(ch, dummy); | 268 | parent->getch(ch, dummy, pos); |
469 | break; | 269 | break; |
470 | } | 270 | } |
471 | } | 271 | } |
472 | } | 272 | } |
@@ -474,9 +274,9 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
474 | break; | 274 | break; |
475 | case 's': | 275 | case 's': |
476 | case 'n': | 276 | case 'n': |
477 | currentstyle.setFontSize(0); | 277 | currentstyle.setFontSize(0); |
478 | parent->getch(ch,dummy); | 278 | parent->getch(ch,dummy, pos); |
479 | break; | 279 | break; |
480 | case 'p': | 280 | case 'p': |
481 | currentstyle.unset(); | 281 | currentstyle.unset(); |
482 | // parent->getch(ch,dummy); | 282 | // parent->getch(ch,dummy); |
@@ -490,9 +290,9 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
490 | else | 290 | else |
491 | { | 291 | { |
492 | currentstyle.setFontSize(1); | 292 | currentstyle.setFontSize(1); |
493 | } | 293 | } |
494 | parent->getch(ch, dummy); | 294 | parent->getch(ch, dummy, pos); |
495 | break; | 295 | break; |
496 | case 'x': | 296 | case 'x': |
497 | if (currentstyle.getFontSize() == 0) | 297 | if (currentstyle.getFontSize() == 0) |
498 | { | 298 | { |
@@ -515,9 +315,9 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
515 | else | 315 | else |
516 | { | 316 | { |
517 | currentstyle.setItalic(); | 317 | currentstyle.setItalic(); |
518 | } | 318 | } |
519 | parent->getch(ch, dummy); | 319 | parent->getch(ch, dummy, pos); |
520 | break; | 320 | break; |
521 | case 'b': | 321 | case 'b': |
522 | case 'B': | 322 | case 'B': |
523 | if (currentstyle.isBold()) | 323 | if (currentstyle.isBold()) |
@@ -527,9 +327,9 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
527 | else | 327 | else |
528 | { | 328 | { |
529 | currentstyle.setBold(); | 329 | currentstyle.setBold(); |
530 | } | 330 | } |
531 | parent->getch(ch, dummy); | 331 | parent->getch(ch, dummy, pos); |
532 | break; | 332 | break; |
533 | case 'c': | 333 | case 'c': |
534 | if (currentstyle.getJustify() == m_AlignCentre) | 334 | if (currentstyle.getJustify() == m_AlignCentre) |
535 | { | 335 | { |
@@ -538,9 +338,9 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
538 | else | 338 | else |
539 | { | 339 | { |
540 | currentstyle.setCentreJustify(); | 340 | currentstyle.setCentreJustify(); |
541 | } | 341 | } |
542 | parent->getch(ch, dummy); | 342 | parent->getch(ch, dummy, pos); |
543 | break; | 343 | break; |
544 | case 'r': | 344 | case 'r': |
545 | if (currentstyle.getJustify() == m_AlignRight) | 345 | if (currentstyle.getJustify() == m_AlignRight) |
546 | { | 346 | { |
@@ -549,31 +349,30 @@ void PeanutFormatter::getch(tchar& ch, CStyle& sty) | |||
549 | else | 349 | else |
550 | { | 350 | { |
551 | currentstyle.setRightJustify(); | 351 | currentstyle.setRightJustify(); |
552 | } | 352 | } |
553 | parent->getch(ch, dummy); | 353 | parent->getch(ch, dummy, pos); |
554 | break; | 354 | break; |
555 | default: | 355 | default: |
556 | currentstyle.setColour(255,0,0); | 356 | currentstyle.setColour(255,0,0); |
557 | } | 357 | } |
558 | } | 358 | } |
559 | sty = currentstyle; | 359 | sty = currentstyle; |
560 | } | 360 | } |
561 | 361 | ||
562 | void OnePara::getch(tchar& ch, CStyle& sty) | 362 | void OnePara::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
563 | { | 363 | { |
564 | parent->getch(ch, sty); | 364 | parent->getch(ch, sty, pos); |
565 | if (m_lastchar == 10) | 365 | if (m_lastchar == 10) |
566 | { | 366 | { |
567 | while (ch == 10) parent->getch(ch, sty); | 367 | while (ch == 10) parent->getch(ch, sty, pos); |
568 | } | 368 | } |
569 | m_lastchar = ch; | 369 | m_lastchar = ch; |
570 | } | 370 | } |
571 | 371 | ||
572 | #ifdef REPALM | 372 | void repalm::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
573 | void repalm::getch(tchar& ch, CStyle& sty) | ||
574 | { | 373 | { |
575 | parent->getch(ch, sty); | 374 | parent->getch(ch, sty, pos); |
576 | switch (ch) | 375 | switch (ch) |
577 | { | 376 | { |
578 | case 0x80: | 377 | case 0x80: |
579 | ch = 0x20ac; | 378 | ch = 0x20ac; |
@@ -679,14 +478,13 @@ void repalm::getch(tchar& ch, CStyle& sty) | |||
679 | default: | 478 | default: |
680 | break; | 479 | break; |
681 | } | 480 | } |
682 | } | 481 | } |
683 | #endif | ||
684 | 482 | ||
685 | //static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; | 483 | //static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; |
686 | //static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 }; | 484 | //static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 }; |
687 | 485 | ||
688 | void DePluck::getch(tchar& ch, CStyle& sty) | 486 | void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
689 | { | 487 | { |
690 | if (m_buffed > 0) | 488 | if (m_buffed > 0) |
691 | { | 489 | { |
692 | sty = m_laststyle; | 490 | sty = m_laststyle; |
@@ -703,28 +501,32 @@ void DePluck::getch(tchar& ch, CStyle& sty) | |||
703 | ch = m_buffer; | 501 | ch = m_buffer; |
704 | m_buffer = 0; | 502 | m_buffer = 0; |
705 | return; | 503 | return; |
706 | } | 504 | } |
707 | unsigned long lnk; | 505 | unsigned long lnk, lnkoff; |
708 | do | 506 | do |
709 | { | 507 | { |
710 | if (nextpart[m_buffed] == 0) break; | 508 | if (nextpart[m_buffed] == 0) break; |
711 | parent->getch(ch, sty); | 509 | parent->getch(ch, sty, pos); |
712 | m_laststyle = sty; | 510 | m_laststyle = sty; |
713 | if (sty.getLink()) lnk = sty.getData(); | 511 | if (sty.getLink()) |
512 | { | ||
513 | lnk = sty.getData(); | ||
514 | lnkoff = sty.getOffset(); | ||
515 | } | ||
714 | } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); | 516 | } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); |
715 | m_current = 0; | 517 | m_current = 0; |
716 | if (nextpart[m_buffed] == 0) | 518 | if (nextpart[m_buffed] == 0) |
717 | { | 519 | { |
718 | m_buffed = 0; | 520 | m_buffed = 0; |
719 | QString dmy; | 521 | QString dmy, dmy2; |
720 | parent->hyperlink(lnk, dmy); | 522 | parent->hyperlink(lnk, lnkoff, dmy, dmy2); |
721 | do | 523 | do |
722 | { | 524 | { |
723 | parent->getch(ch, sty); | 525 | parent->getch(ch, sty, pos); |
724 | } | 526 | } |
725 | while (ch != 10); | 527 | while (ch != 10); |
726 | parent->getch(ch, sty); | 528 | parent->getch(ch, sty, pos); |
727 | } | 529 | } |
728 | else if (m_buffed > 0) | 530 | else if (m_buffed > 0) |
729 | { | 531 | { |
730 | m_buffer = ch; | 532 | m_buffer = ch; |
@@ -738,4 +540,276 @@ void DePluck::getch(tchar& ch, CStyle& sty) | |||
738 | } | 540 | } |
739 | 541 | ||
740 | return; | 542 | return; |
741 | } | 543 | } |
544 | |||
545 | HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255) | ||
546 | { | ||
547 | } | ||
548 | |||
549 | #include "Bkmks.h" | ||
550 | #include "QTReader.h" | ||
551 | |||
552 | void HighlightFilter::refresh(unsigned long pos) | ||
553 | { | ||
554 | bkmks = pReader->Bkmklist(); | ||
555 | |||
556 | red = green = blue = 255; | ||
557 | |||
558 | if (bkmks == NULL) | ||
559 | { | ||
560 | lastpos = 0; | ||
561 | nextpos = 0xffffffff; | ||
562 | } | ||
563 | else | ||
564 | { | ||
565 | lastpos = 0; | ||
566 | nextpos = 0xffffffff; | ||
567 | for (CList<Bkmk>::iterator i = bkmks->begin(); i != bkmks->end(); i++) | ||
568 | { | ||
569 | if ((*i).value() <= pos && pos < (*i).value2()) | ||
570 | { | ||
571 | red = i->red(); | ||
572 | green = i->green(); | ||
573 | blue = i->blue(); | ||
574 | lastpos = (*i).value(); | ||
575 | nextpos = (*i).value2(); | ||
576 | break; | ||
577 | } | ||
578 | if ((*i).value() > pos) | ||
579 | { | ||
580 | nextpos = (*i).value(); | ||
581 | break; | ||
582 | } | ||
583 | lastpos = (*i).value(); | ||
584 | } | ||
585 | } | ||
586 | } | ||
587 | |||
588 | void HighlightFilter::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
589 | { | ||
590 | parent->getch(ch, sty, pos); | ||
591 | if (bkmks != pReader->Bkmklist() || pos <= lastpos || pos >= nextpos) | ||
592 | { | ||
593 | // qDebug("Recalc <%lu, %lu, %lu>", lastpos, pos, nextpos); | ||
594 | refresh(pos); | ||
595 | // qDebug("Recalc(2) <%lu, %lu, %lu>", lastpos, pos, nextpos); | ||
596 | } | ||
597 | int r = sty.bRed(), g = sty.bGreen(), b = sty.bBlue(); | ||
598 | if (r == 255 && g == 255 && b == 255) | ||
599 | { | ||
600 | sty.setBackground(red, green, blue); | ||
601 | } | ||
602 | } | ||
603 | |||
604 | void kern::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
605 | { | ||
606 | if (uselast) | ||
607 | { | ||
608 | ch = lastchar; | ||
609 | sty = laststy; | ||
610 | uselast = false; | ||
611 | return; | ||
612 | } | ||
613 | else | ||
614 | { | ||
615 | parent->getch(ch, sty, pos); | ||
616 | } | ||
617 | switch (ch) | ||
618 | { | ||
619 | case 'f': | ||
620 | { | ||
621 | tchar savedchar = 'f'; | ||
622 | parent->getch(ch, sty, pos); | ||
623 | switch (ch) | ||
624 | { | ||
625 | case 'i': | ||
626 | ch = (251 << 8) + 1; | ||
627 | break; | ||
628 | case 'l': | ||
629 | ch = (251 << 8) + 2; | ||
630 | break; | ||
631 | default: | ||
632 | lastchar = ch; | ||
633 | uselast = true; | ||
634 | laststy = sty; | ||
635 | ch = savedchar; | ||
636 | } | ||
637 | } | ||
638 | break; | ||
639 | default: | ||
640 | break; | ||
641 | } | ||
642 | } | ||
643 | |||
644 | class ErrorFilter : public CFilter | ||
645 | { | ||
646 | QString error; | ||
647 | int currentpos; | ||
648 | public: | ||
649 | ErrorFilter(const QString& _s) : error(_s), currentpos(0) {} | ||
650 | ~ErrorFilter() {} | ||
651 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
652 | { | ||
653 | if (currentpos == error.length()) | ||
654 | { | ||
655 | ch = UEOF; | ||
656 | currentpos = 0; | ||
657 | } | ||
658 | else | ||
659 | { | ||
660 | ch = error[currentpos++].unicode(); | ||
661 | } | ||
662 | } | ||
663 | QString about() { return parent->about(); } | ||
664 | }; | ||
665 | |||
666 | #ifndef __STATIC | ||
667 | ExternFilter::ExternFilter(const QString& nm, const QString& optional) : filt(NULL), handle(NULL) | ||
668 | { | ||
669 | QString filterpath(QTReaderUtil::getPluginPath("filters/lib")); | ||
670 | filterpath += nm; | ||
671 | filterpath += ".so"; | ||
672 | if (QFile::exists(filterpath)) | ||
673 | { | ||
674 | qDebug("Filter:%s", (const char*)filterpath); | ||
675 | handle = dlopen(filterpath, RTLD_LAZY); | ||
676 | if (handle == 0) | ||
677 | { | ||
678 | qDebug("Can't find filter:%s", dlerror()); | ||
679 | // status = -10; | ||
680 | filt = new ErrorFilter(QString("Can't find plugin:")+nm); | ||
681 | return; | ||
682 | } | ||
683 | CFilter* (*newfilter)(const QString&); | ||
684 | newfilter = (CFilter* (*)(const QString&))dlsym(handle, "newfilter"); | ||
685 | if (newfilter == NULL) | ||
686 | { | ||
687 | qDebug("Can't find newfilter"); | ||
688 | filt = new ErrorFilter(QString("Can't find entry point in plugin:")+nm); | ||
689 | return; | ||
690 | } | ||
691 | filt = (*newfilter)(optional); | ||
692 | } | ||
693 | else | ||
694 | { | ||
695 | qDebug("No filter path"); | ||
696 | filt = new ErrorFilter(QString("No filter plugins installed:")+nm); | ||
697 | } | ||
698 | if (filt == NULL) | ||
699 | { | ||
700 | qDebug("Can't do newfilter"); | ||
701 | filt = new ErrorFilter(QString("Filter creation failed:")+nm); | ||
702 | return; | ||
703 | } | ||
704 | } | ||
705 | #endif | ||
706 | |||
707 | void makeInverse::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
708 | { | ||
709 | parent->getch(ch, sty, pos); | ||
710 | int r,g,b; | ||
711 | r = 255 - sty.Red(), g = 255 - sty.Green(), b = 255 - sty.Blue(); | ||
712 | sty.setColour(r,g,b); | ||
713 | r = 255 - sty.bRed(), g = 255 - sty.bGreen(), b = 255 - sty.bBlue(); | ||
714 | sty.setBackground(r,g,b); | ||
715 | r = 255 - sty.pRed(), g = 255 - sty.pGreen(), b = 255 - sty.pBlue(); | ||
716 | sty.setPaper(r,g,b); | ||
717 | } | ||
718 | /* | ||
719 | void makeNegative::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
720 | { | ||
721 | parent->getch(ch, sty, pos); | ||
722 | QColor fg(sty.Red(), sty.Green(), sty.Blue()); | ||
723 | int h,s,v; | ||
724 | fg.hsv(&h,&s,&v); | ||
725 | fg.setHsv(h,s,255-v); | ||
726 | int r,g,b; | ||
727 | fg.rgb(&r,&g,&b); | ||
728 | sty.setColour(r,g,b); | ||
729 | |||
730 | fg = QColor(sty.bRed(), sty.bGreen(), sty.bBlue()); | ||
731 | fg.hsv(&h,&s,&v); | ||
732 | fg.setHsv(h,s,255-v); | ||
733 | fg.rgb(&r,&g,&b); | ||
734 | sty.setBackground(r,g,b); | ||
735 | } | ||
736 | */ | ||
737 | void setbg::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
738 | { | ||
739 | parent->getch(ch, sty, pos); | ||
740 | int r = sty.pRed(), g = sty.pGreen(), b = sty.pBlue(); | ||
741 | if (r == 255 && g == 255 && b == 255) | ||
742 | { | ||
743 | sty.setPaper(m_r,m_g,m_b); | ||
744 | } | ||
745 | else | ||
746 | { | ||
747 | qDebug("We have background [%x%x%x]", r, g, b); | ||
748 | } | ||
749 | r = sty.bRed(), g = sty.bGreen(), b = sty.bBlue(); | ||
750 | if (r == 255 && g == 255 && b == 255) | ||
751 | { | ||
752 | sty.setBackground(m_r,m_g,m_b); | ||
753 | } | ||
754 | else | ||
755 | { | ||
756 | qDebug("We have background [%x%x%x]", r, g, b); | ||
757 | } | ||
758 | } | ||
759 | |||
760 | void setfg::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
761 | { | ||
762 | parent->getch(ch, sty, pos); | ||
763 | int r = sty.Red(), g = sty.Green(), b = sty.Blue(); | ||
764 | if (r == 0 && g == 0 && b == 0) | ||
765 | { | ||
766 | sty.setColour(m_r,m_g,m_b); | ||
767 | } | ||
768 | } | ||
769 | |||
770 | #include "CRegExp.h" | ||
771 | |||
772 | repara::repara(const QString& pat) : tch(0) | ||
773 | { | ||
774 | // QString pat("{\\n[A-Z\"]}"); | ||
775 | flt = new CRegExpFilt(pat, false); | ||
776 | qDebug("Construction done"); | ||
777 | } | ||
778 | |||
779 | repara::~repara() | ||
780 | { | ||
781 | delete flt; | ||
782 | } | ||
783 | |||
784 | void repara::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
785 | { | ||
786 | if (flt->empty()) | ||
787 | { | ||
788 | while (flt->empty()) | ||
789 | { | ||
790 | parent->getch(ch, sty, pos); | ||
791 | flt->addch(ch); | ||
792 | } | ||
793 | } | ||
794 | ch = flt->pop(); | ||
795 | /* | ||
796 | parent->getch(ch, sty, pos); | ||
797 | if (ch == 10 || ch == ' ') | ||
798 | { | ||
799 | if (tch == 10) | ||
800 | { | ||
801 | tch = ch; | ||
802 | ch = 10; | ||
803 | return; | ||
804 | } | ||
805 | else | ||
806 | { | ||
807 | tch = ch; | ||
808 | ch = ' '; | ||
809 | return; | ||
810 | } | ||
811 | } | ||
812 | tch = ch; | ||
813 | */ | ||
814 | return; | ||
815 | } | ||
diff --git a/noncore/apps/opie-reader/CFilter.h b/noncore/apps/opie-reader/CFilter.h index 0a03b3e..cec9618 100644 --- a/noncore/apps/opie-reader/CFilter.h +++ b/noncore/apps/opie-reader/CFilter.h | |||
@@ -3,47 +3,89 @@ | |||
3 | 3 | ||
4 | #include "CExpander.h" | 4 | #include "CExpander.h" |
5 | #include "CEncoding.h" | 5 | #include "CEncoding.h" |
6 | 6 | ||
7 | class CFilter : public CCharacterSource | 7 | class CFilter_IFace : public CCharacterSource |
8 | { | ||
9 | public: | ||
10 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) = 0; | ||
11 | virtual void setparent(CCharacterSource* p) = 0; | ||
12 | virtual ~CFilter_IFace() {}; | ||
13 | virtual void locate(unsigned int n) = 0; | ||
14 | virtual bool findanchor(const QString& nm) = 0; | ||
15 | virtual void saveposn(const QString& f, size_t posn) = 0; | ||
16 | virtual void writeposn(const QString& f, size_t posn) = 0; | ||
17 | virtual linkType forward(QString& f, size_t& loc) = 0; | ||
18 | virtual linkType back(QString& f, size_t& loc) = 0; | ||
19 | virtual bool hasnavigation() = 0; | ||
20 | virtual int getwidth() = 0; | ||
21 | virtual CCharacterSource* getparent() = 0; | ||
22 | }; | ||
23 | |||
24 | class CFilter : public CFilter_IFace | ||
8 | { | 25 | { |
9 | friend class CFilterChain; | ||
10 | protected: | 26 | protected: |
11 | CCharacterSource* parent; | 27 | CCharacterSource* parent; |
12 | linkType hyperlink(unsigned int n, QString& w) | 28 | public: |
29 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) | ||
13 | { | 30 | { |
14 | return parent->hyperlink(n,w); | 31 | return parent->hyperlink(n,noff,w,nm); |
15 | } | 32 | } |
16 | public: | ||
17 | CFilter() : parent(NULL) {} | 33 | CFilter() : parent(NULL) {} |
18 | void setparent(CCharacterSource* p) { parent = p; } | 34 | void setparent(CCharacterSource* p) { parent = p; } |
35 | CCharacterSource* getparent() { return parent; } | ||
19 | virtual ~CFilter() {}; | 36 | virtual ~CFilter() {}; |
37 | virtual void locate(unsigned int n) | ||
38 | { | ||
39 | parent->locate(n); | ||
40 | } | ||
41 | virtual bool findanchor(const QString& nm) | ||
42 | { | ||
43 | return parent->findanchor(nm); | ||
44 | } | ||
45 | virtual void saveposn(const QString& f, size_t posn) { parent->saveposn(f, posn); } | ||
46 | virtual void writeposn(const QString& f, size_t posn) { parent->writeposn(f, posn); } | ||
47 | virtual linkType forward(QString& f, size_t& loc) { return parent->forward(f, loc); } | ||
48 | virtual linkType back(QString& f, size_t& loc) { return parent->back(f, loc); } | ||
49 | virtual bool hasnavigation() { return parent->hasnavigation(); } | ||
50 | virtual int getwidth() { return parent->getwidth(); } | ||
51 | QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); } | ||
52 | QImage* getPicture(const QString& href) { return parent->getPicture(href); } | ||
53 | bool getFile(const QString& href) { return parent->getFile(href); } | ||
20 | }; | 54 | }; |
21 | 55 | ||
22 | class CFilterChain | 56 | class CFilterChain |
23 | { | 57 | { |
24 | CExpander* expander; | 58 | CExpander_Interface* expander; |
25 | CEncoding* encoder; | 59 | CEncoding* encoder; |
26 | CFilter* first; | 60 | CFilter_IFace* first; |
27 | CCharacterSource* front; | 61 | CCharacterSource* front; |
28 | public: | 62 | public: |
29 | CFilterChain(CEncoding* _e) : encoder(_e), first(NULL), front(_e) {}; | 63 | CFilterChain(CEncoding* _e) : encoder(_e), first(NULL), front(_e) {}; |
30 | ~CFilterChain() | 64 | ~CFilterChain() |
31 | { | 65 | { |
32 | CCharacterSource* p = front; | 66 | CCharacterSource* p = front; |
33 | while (p != encoder) | 67 | while (p != encoder) |
34 | { | 68 | { |
35 | CFilter* pnext = (CFilter*)p; | 69 | CFilter_IFace* pnext = (CFilter_IFace*)p; |
36 | p = ((CFilter*)p)->parent; | 70 | p = ((CFilter_IFace*)p)->getparent(); |
37 | delete pnext; | 71 | delete pnext; |
38 | } | 72 | } |
39 | delete encoder; | 73 | delete encoder; |
40 | } | 74 | } |
41 | void getch(tchar& ch, CStyle& sty) | 75 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) |
76 | { | ||
77 | return front->hyperlink(n, noff, wrd, nm); | ||
78 | } | ||
79 | void locate(unsigned int n) | ||
80 | { | ||
81 | front->locate(n); | ||
82 | } | ||
83 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
42 | { | 84 | { |
43 | front->getch(ch, sty); | 85 | front->getch(ch, sty, pos); |
44 | } | 86 | } |
45 | void addfilter(CFilter* p) | 87 | void addfilter(CFilter_IFace* p) |
46 | { | 88 | { |
47 | if (first == NULL) | 89 | if (first == NULL) |
48 | { | 90 | { |
49 | front = first = p; | 91 | front = first = p; |
@@ -54,35 +96,46 @@ class CFilterChain | |||
54 | p->setparent(front); | 96 | p->setparent(front); |
55 | front = p; | 97 | front = p; |
56 | } | 98 | } |
57 | } | 99 | } |
58 | void setsource(CExpander* p) | 100 | void setsource(CExpander_Interface* p) |
59 | { | 101 | { |
60 | expander = p; | 102 | expander = p; |
61 | encoder->setparent(p); | 103 | encoder->setparent(p); |
62 | } | 104 | } |
63 | void setencoder(CEncoding* p) | 105 | void setencoder(CEncoding* p) |
64 | { | 106 | { |
65 | delete encoder; | 107 | delete encoder; |
66 | encoder = p; | 108 | encoder = p; |
67 | first->setparent(p); | 109 | first->setparent(p); |
68 | encoder->setparent(expander); | 110 | encoder->setparent(expander); |
69 | } | 111 | } |
112 | bool findanchor(const QString& nm) | ||
113 | { | ||
114 | return front->findanchor(nm); | ||
115 | } | ||
116 | void saveposn(const QString& f, size_t posn) { front->saveposn(f, posn); } | ||
117 | void writeposn(const QString& f, size_t posn) { front->writeposn(f, posn); } | ||
118 | linkType forward(QString& f, size_t& loc) { return front->forward(f, loc); } | ||
119 | linkType back(QString& f, size_t& loc) { return front->back(f, loc); } | ||
120 | bool hasnavigation() { return front->hasnavigation(); } | ||
121 | QString about() { return QString("Filter chain (c) Tim Wentford\n")+front->about(); } | ||
70 | }; | 122 | }; |
71 | 123 | ||
72 | class stripcr : public CFilter | 124 | class stripcr : public CFilter |
73 | { | 125 | { |
74 | public: | 126 | public: |
75 | stripcr() {} | 127 | stripcr() {} |
76 | ~stripcr() {} | 128 | ~stripcr() {} |
77 | void getch(tchar& ch, CStyle& sty) | 129 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
78 | { | 130 | { |
79 | do | 131 | do |
80 | { | 132 | { |
81 | parent->getch(ch, sty); | 133 | parent->getch(ch, sty, pos); |
82 | } | 134 | } |
83 | while (ch == 13); | 135 | while (ch == 13); |
84 | } | 136 | } |
137 | QString about() { return QString("StripCR filter (c) Tim Wentford\n")+parent->about(); } | ||
85 | }; | 138 | }; |
86 | 139 | ||
87 | class dehyphen : public CFilter | 140 | class dehyphen : public CFilter |
88 | { | 141 | { |
@@ -91,90 +144,79 @@ class dehyphen : public CFilter | |||
91 | CStyle m_nextSty; | 144 | CStyle m_nextSty; |
92 | public: | 145 | public: |
93 | dehyphen() : m_bCharWaiting(false) {} | 146 | dehyphen() : m_bCharWaiting(false) {} |
94 | ~dehyphen() {} | 147 | ~dehyphen() {} |
95 | void getch(tchar& ch, CStyle& sty) | 148 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
96 | { | 149 | { |
97 | if (m_bCharWaiting) | 150 | if (m_bCharWaiting) |
98 | { | 151 | { |
99 | m_bCharWaiting = false; | 152 | m_bCharWaiting = false; |
100 | ch = m_nextChar; | 153 | ch = m_nextChar; |
101 | sty = m_nextSty; | 154 | sty = m_nextSty; |
102 | return; | 155 | return; |
103 | } | 156 | } |
104 | parent->getch(ch, sty); | 157 | parent->getch(ch, sty, pos); |
105 | if (ch != '-') return; | 158 | if (ch != '-') return; |
106 | parent->getch(m_nextChar, m_nextSty); | 159 | parent->getch(m_nextChar, m_nextSty, pos); |
107 | if (m_nextChar != 10) | 160 | if (m_nextChar != 10) |
108 | { | 161 | { |
109 | m_bCharWaiting = true; | 162 | m_bCharWaiting = true; |
110 | ch = '-'; | 163 | ch = '-'; |
111 | return; | 164 | return; |
112 | } | 165 | } |
113 | parent->getch(ch, sty); | 166 | parent->getch(ch, sty, pos); |
114 | } | 167 | } |
168 | QString about() { return QString("Hyphenation filter (c) Tim Wentford\n")+parent->about(); } | ||
115 | }; | 169 | }; |
116 | 170 | ||
117 | class striphtml : public CFilter | 171 | template<class A, class B>class QMap; |
172 | |||
173 | const int m_cmaxdepth = 8; | ||
174 | |||
175 | class htmlmark | ||
118 | { | 176 | { |
119 | CStyle currentstyle; | 177 | QString file; |
120 | unsigned short skip_ws(); | 178 | size_t pos; |
121 | unsigned short skip_ws_end(); | ||
122 | unsigned short parse_m(); | ||
123 | void mygetch(tchar& ch, CStyle& sty); | ||
124 | public: | 179 | public: |
125 | striphtml() {} | 180 | htmlmark() : file(), pos(0) {} |
126 | ~striphtml() {} | 181 | htmlmark(const QString& _f, size_t _p) : file(_f), pos(_p) {} |
127 | void getch(tchar& ch, CStyle& sty); | 182 | QString filename() { return file; } |
183 | size_t posn() { return pos; } | ||
128 | }; | 184 | }; |
129 | 185 | ||
130 | class unindent : public CFilter | 186 | class unindent : public CFilter |
131 | { | 187 | { |
132 | tchar lc; | 188 | tchar lc; |
133 | public: | 189 | public: |
134 | unindent() : lc(0) {} | 190 | unindent() : lc(0) {} |
135 | ~unindent() {} | 191 | ~unindent() {} |
136 | void getch(tchar& ch, CStyle& sty) | 192 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
137 | { | 193 | { |
138 | if (lc == 10) | 194 | if (lc == 10) |
139 | { | 195 | { |
140 | do | 196 | do |
141 | { | 197 | { |
142 | parent->getch(ch, sty); | 198 | parent->getch(ch, sty, pos); |
143 | } | 199 | } |
144 | while (ch == ' '); | 200 | while (ch == ' '); |
145 | } | 201 | } |
146 | else parent->getch(ch, sty); | 202 | else parent->getch(ch, sty, pos); |
147 | lc = ch; | 203 | lc = ch; |
148 | return; | 204 | return; |
149 | } | 205 | } |
206 | QString about() { return QString("Unindent filter (c) Tim Wentford\n")+parent->about(); } | ||
150 | }; | 207 | }; |
151 | 208 | ||
209 | class CRegExpFilt; | ||
152 | class repara : public CFilter | 210 | class repara : public CFilter |
153 | { | 211 | { |
154 | tchar tch; | 212 | tchar tch; |
213 | CRegExpFilt* flt; | ||
155 | public: | 214 | public: |
156 | repara() : tch(0) {} | 215 | repara(const QString&); |
157 | ~repara() {} | 216 | ~repara(); |
158 | void getch(tchar& ch, CStyle& sty) | 217 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
159 | { | 218 | QString about() { return QString("Reparagraph filter (c) Tim Wentford\n")+parent->about(); } |
160 | parent->getch(ch, sty); | ||
161 | if (ch == 10) | ||
162 | { | ||
163 | if (tch == 10) | ||
164 | { | ||
165 | return; | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | tch = ch; | ||
170 | ch = ' '; | ||
171 | return; | ||
172 | } | ||
173 | } | ||
174 | tch = ch; | ||
175 | return; | ||
176 | } | ||
177 | }; | 219 | }; |
178 | 220 | ||
179 | class indenter : public CFilter | 221 | class indenter : public CFilter |
180 | { | 222 | { |
@@ -183,25 +225,26 @@ class indenter : public CFilter | |||
183 | CStyle lsty; | 225 | CStyle lsty; |
184 | public: | 226 | public: |
185 | indenter(int _a=5) : amnt(_a), indent(0) {} | 227 | indenter(int _a=5) : amnt(_a), indent(0) {} |
186 | ~indenter() {} | 228 | ~indenter() {} |
187 | void getch(tchar& ch, CStyle& sty) | 229 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
188 | { | 230 | { |
189 | if (indent > 0) | 231 | if (indent > 0) |
190 | { | 232 | { |
191 | indent--; | 233 | indent--; |
192 | ch = ' '; | 234 | ch = ' '; |
193 | sty = lsty; | 235 | sty = lsty; |
194 | return; | 236 | return; |
195 | } | 237 | } |
196 | parent->getch(ch, sty); | 238 | parent->getch(ch, sty, pos); |
197 | if (ch == 10) | 239 | if (ch == 10) |
198 | { | 240 | { |
199 | indent = amnt; | 241 | indent = amnt; |
200 | lsty = sty; | 242 | lsty = sty; |
201 | } | 243 | } |
202 | return; | 244 | return; |
203 | } | 245 | } |
246 | QString about() { return QString("Indentation filter (c) Tim Wentford\n")+parent->about(); } | ||
204 | }; | 247 | }; |
205 | 248 | ||
206 | class dblspce : public CFilter | 249 | class dblspce : public CFilter |
207 | { | 250 | { |
@@ -209,48 +252,51 @@ class dblspce : public CFilter | |||
209 | CStyle lsty; | 252 | CStyle lsty; |
210 | public: | 253 | public: |
211 | dblspce() : lastlf(false) {} | 254 | dblspce() : lastlf(false) {} |
212 | ~dblspce() {} | 255 | ~dblspce() {} |
213 | void getch(tchar& ch, CStyle& sty) | 256 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
214 | { | 257 | { |
215 | if (lastlf) | 258 | if (lastlf) |
216 | { | 259 | { |
217 | lastlf = false; | 260 | lastlf = false; |
218 | ch = 10; | 261 | ch = 10; |
219 | sty = lsty; | 262 | sty = lsty; |
220 | return; | 263 | return; |
221 | } | 264 | } |
222 | parent->getch(ch, sty); | 265 | parent->getch(ch, sty, pos); |
223 | if (lastlf = (ch == 10)) | 266 | if (lastlf = (ch == 10)) |
224 | { | 267 | { |
225 | lsty = sty; | 268 | lsty = sty; |
226 | } | 269 | } |
227 | return; | 270 | return; |
228 | } | 271 | } |
272 | QString about() { return QString("Double space (c) Tim Wentford\n")+parent->about(); } | ||
229 | }; | 273 | }; |
230 | 274 | ||
231 | class textfmt : public CFilter | 275 | class textfmt : public CFilter |
232 | { | 276 | { |
233 | CStyle currentstyle; | 277 | CStyle currentstyle; |
234 | tchar lastchar; | 278 | tchar lastchar; |
235 | bool uselast; | 279 | bool uselast; |
236 | void mygetch(tchar&, CStyle&); | 280 | void mygetch(tchar&, CStyle&, unsigned long& pos); |
237 | public: | 281 | public: |
238 | textfmt() : lastchar(0), uselast(false) {} | 282 | textfmt() : lastchar(0), uselast(false) {} |
239 | ~textfmt() {} | 283 | ~textfmt() {} |
240 | void getch(tchar& ch, CStyle& sty); | 284 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
285 | QString about() { return QString("Text formatting filter (c) Tim Wentford\n")+parent->about(); } | ||
241 | }; | 286 | }; |
242 | 287 | ||
243 | class embolden : public CFilter | 288 | class embolden : public CFilter |
244 | { | 289 | { |
245 | public: | 290 | public: |
246 | embolden() {} | 291 | embolden() {} |
247 | ~embolden() {} | 292 | ~embolden() {} |
248 | void getch(tchar& ch, CStyle& sty) | 293 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
249 | { | 294 | { |
250 | parent->getch(ch, sty); | 295 | parent->getch(ch, sty, pos); |
251 | sty.setBold(); | 296 | sty.setBold(); |
252 | } | 297 | } |
298 | QString about() { return QString("Emboldening filter (c) Tim Wentford\n")+parent->about(); } | ||
253 | }; | 299 | }; |
254 | 300 | ||
255 | class remap : public CFilter | 301 | class remap : public CFilter |
256 | { | 302 | { |
@@ -259,26 +305,29 @@ class remap : public CFilter | |||
259 | CStyle currentstyle; | 305 | CStyle currentstyle; |
260 | public: | 306 | public: |
261 | remap() : offset(0) { q[0] = 0; } | 307 | remap() : offset(0) { q[0] = 0; } |
262 | ~remap() {} | 308 | ~remap() {} |
263 | void getch(tchar& ch, CStyle& sty); | 309 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
310 | QString about() { return QString("Character remapping filter (c) Tim Wentford\n")+parent->about(); } | ||
264 | }; | 311 | }; |
265 | 312 | ||
266 | class PeanutFormatter : public CFilter | 313 | class PeanutFormatter : public CFilter |
267 | { | 314 | { |
268 | CStyle currentstyle; | 315 | CStyle currentstyle; |
269 | public: | 316 | public: |
270 | ~PeanutFormatter() {} | 317 | ~PeanutFormatter() {} |
271 | void getch(tchar& ch, CStyle& sty); | 318 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
319 | QString about() { return QString("PML filter (c) Tim Wentford\n")+parent->about(); } | ||
272 | }; | 320 | }; |
273 | 321 | ||
274 | class OnePara : public CFilter | 322 | class OnePara : public CFilter |
275 | { | 323 | { |
276 | tchar m_lastchar; | 324 | tchar m_lastchar; |
277 | public: | 325 | public: |
278 | OnePara() : m_lastchar(0) {} | 326 | OnePara() : m_lastchar(0) {} |
279 | ~OnePara() {} | 327 | ~OnePara() {} |
280 | void getch(tchar& ch, CStyle& sty); | 328 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
329 | QString about() { return QString("Single space filter (c) Tim Wentford\n")+parent->about(); } | ||
281 | }; | 330 | }; |
282 | 331 | ||
283 | class DePluck : public CFilter | 332 | class DePluck : public CFilter |
284 | { | 333 | { |
@@ -290,39 +339,137 @@ class DePluck : public CFilter | |||
290 | CStyle m_laststyle; | 339 | CStyle m_laststyle; |
291 | public: | 340 | public: |
292 | DePluck(tchar* t) : nextpart(t), m_buffer(0), m_buffed(0), m_current(0), m_debuff(false) {} | 341 | DePluck(tchar* t) : nextpart(t), m_buffer(0), m_buffed(0), m_current(0), m_debuff(false) {} |
293 | ~DePluck() {} | 342 | ~DePluck() {} |
294 | void getch(tchar& ch, CStyle& sty); | 343 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
344 | QString about() { return QString("Depluck filter (c) Tim Wentford\n")+parent->about(); } | ||
295 | }; | 345 | }; |
296 | 346 | ||
297 | #ifdef REPALM | ||
298 | class repalm : public CFilter | 347 | class repalm : public CFilter |
299 | { | 348 | { |
300 | public: | 349 | public: |
301 | ~repalm() {} | 350 | ~repalm() {} |
302 | void getch(tchar& ch, CStyle& sty); | 351 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
352 | QString about() { return QString("Repalm filter (c) Tim Wentford\n")+parent->about(); } | ||
303 | }; | 353 | }; |
304 | #endif | ||
305 | 354 | ||
306 | class FullJust : public CFilter | 355 | class FullJust : public CFilter |
307 | { | 356 | { |
308 | public: | 357 | public: |
309 | void getch(tchar& ch, CStyle& sty) | 358 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
310 | { | 359 | { |
311 | parent->getch(ch, sty); | 360 | parent->getch(ch, sty, pos); |
312 | if (sty.getJustify() == m_AlignLeft) sty.setFullJustify(); | 361 | if (sty.getJustify() == m_AlignLeft) sty.setFullJustify(); |
313 | } | 362 | } |
363 | QString about() { return QString("Full justification filter (c) Tim Wentford\n")+parent->about(); } | ||
314 | }; | 364 | }; |
315 | /* | 365 | /* |
316 | class AddSpace : public CFilter | 366 | class AddSpace : public CFilter |
317 | { | 367 | { |
318 | unsigned char m_espc; | 368 | unsigned char m_espc; |
319 | public: | 369 | public: |
320 | AddSpace(unsigned char s) : m_espc(s) {} | 370 | AddSpace(unsigned char s) : m_espc(s) {} |
321 | void getch(tchar& ch, CStyle& sty) | 371 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
322 | { | 372 | { |
323 | parent->getch(ch, sty); | 373 | parent->getch(ch, sty, pos); |
324 | sty.setExtraSpace(m_espc); | 374 | sty.setExtraSpace(m_espc); |
325 | } | 375 | } |
326 | }; | 376 | }; |
327 | */ | 377 | */ |
378 | |||
379 | class QTReader; | ||
380 | |||
381 | class HighlightFilter : public CFilter | ||
382 | { | ||
383 | QTReader* pReader; | ||
384 | unsigned long lastpos, nextpos; | ||
385 | unsigned char red, green, blue; | ||
386 | CList<Bkmk>* bkmks; | ||
387 | public: | ||
388 | HighlightFilter(QTReader*); | ||
389 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
390 | void refresh(unsigned long); | ||
391 | QString about() { return QString("High-lighting filter (c) Tim Wentford\n")+parent->about(); } | ||
392 | }; | ||
393 | |||
394 | #include "static.h" | ||
395 | #ifndef __STATIC | ||
396 | #include <dlfcn.h> | ||
397 | |||
398 | class ExternFilter : public CFilter_IFace | ||
399 | { | ||
400 | CFilter* filt; | ||
401 | void *handle; | ||
402 | public: | ||
403 | linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) | ||
404 | { | ||
405 | return filt->hyperlink(n, noff, w, nm); | ||
406 | } | ||
407 | void setparent(CCharacterSource* p) { filt->setparent(p); } | ||
408 | ExternFilter(const QString& nm, const QString& optional); | ||
409 | ~ExternFilter() | ||
410 | { | ||
411 | if (filt != NULL) delete filt; | ||
412 | if (handle != NULL) dlclose(handle); | ||
413 | } | ||
414 | void locate(unsigned int n) { filt->locate(n); } | ||
415 | bool findanchor(const QString& nm) { return filt->findanchor(nm); } | ||
416 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } | ||
417 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } | ||
418 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } | ||
419 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } | ||
420 | bool hasnavigation() { return filt->hasnavigation(); } | ||
421 | int getwidth() { return filt->getwidth(); } | ||
422 | CCharacterSource* getparent() { return filt->getparent(); } | ||
423 | void getch(tchar& c, CStyle& s, unsigned long& l) { filt->getch(c, s, l); } | ||
424 | QImage* getPicture(unsigned long tgt) { return filt->getPicture(tgt); } | ||
425 | CFilter* filter() { return filt; } | ||
426 | QImage* getPicture(const QString& href) { return filt->getPicture(href); } | ||
427 | bool getFile(const QString& href) { return filt->getFile(href); } | ||
428 | QString about() { return QString("Filter plug-in (c) Tim Wentford\n")+filt->about(); } | ||
429 | }; | ||
430 | #endif | ||
431 | |||
432 | class kern : public CFilter | ||
433 | { | ||
434 | tchar lastchar; | ||
435 | bool uselast; | ||
436 | CStyle laststy; | ||
437 | public: | ||
438 | kern() : lastchar(0), uselast(false) {} | ||
439 | ~kern() {} | ||
440 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
441 | QString about() { return QString("Kerning filter (c) Tim Wentford\n")+parent->about(); } | ||
442 | }; | ||
443 | |||
444 | class makeInverse : public CFilter | ||
445 | { | ||
446 | public: | ||
447 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
448 | QString about() { return QString("Colourmap inversion filter (c) Tim Wentford\n")+parent->about(); } | ||
449 | }; | ||
450 | /* | ||
451 | class makeNegative : public CFilter | ||
452 | { | ||
453 | public: | ||
454 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
455 | }; | ||
456 | */ | ||
457 | class setbg : public CFilter | ||
458 | { | ||
459 | int m_r, m_g, m_b; | ||
460 | public: | ||
461 | setbg(int _r, int _g, int _b) : m_r(_r), m_g(_g), m_b(_b) {} | ||
462 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
463 | QString about() { return QString("Background colour filter (c) Tim Wentford\n")+parent->about(); } | ||
464 | }; | ||
465 | |||
466 | class setfg : public CFilter | ||
467 | { | ||
468 | int m_r, m_g, m_b; | ||
469 | public: | ||
470 | setfg(int _r, int _g, int _b) : m_r(_r), m_g(_g), m_b(_b) {} | ||
471 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
472 | QString about() { return QString("Foreground colour filter (c) Tim Wentford\n")+parent->about(); } | ||
473 | }; | ||
474 | |||
328 | #endif | 475 | #endif |
diff --git a/noncore/apps/opie-reader/CHM.cpp b/noncore/apps/opie-reader/CHM.cpp new file mode 100644 index 0000000..9d1eb87 --- a/dev/null +++ b/noncore/apps/opie-reader/CHM.cpp | |||
@@ -0,0 +1,380 @@ | |||
1 | #include "CHM.h" | ||
2 | #include "chm_lib.h" | ||
3 | #include "static.h" | ||
4 | #include <qstring.h> | ||
5 | #include <qstringlist.h> | ||
6 | #include <stdio.h> | ||
7 | #include <qimage.h> | ||
8 | #include <qpixmap.h> | ||
9 | |||
10 | #ifndef __STATIC | ||
11 | extern "C" | ||
12 | { | ||
13 | CExpander* newcodec() { return new CHM; } | ||
14 | } | ||
15 | #endif | ||
16 | |||
17 | static int _print_ui_index(struct chmFile *h, struct chmUnitInfo *ui, | ||
18 | void *context) | ||
19 | { | ||
20 | CHM *chm = (CHM *)context; | ||
21 | QString temp = "<tr>"; | ||
22 | char buff[1024]; | ||
23 | sprintf( buff,"<td align=right>%8d\n</td><td><a href=\"%s\">%s</a></td></tr>",(int)ui->length, ui->path, ui->path); | ||
24 | temp += buff; | ||
25 | chm->addContent(temp); | ||
26 | return CHM_ENUMERATOR_CONTINUE; | ||
27 | } | ||
28 | |||
29 | static int _get_hhc (struct chmFile *h, struct chmUnitInfo *ui, | ||
30 | void *context) | ||
31 | { | ||
32 | CHM *chm = (CHM *)context; | ||
33 | QString PathName = ui->path; | ||
34 | if (PathName.find(".hhc") > -1) { | ||
35 | chm->setPath(PathName); | ||
36 | } | ||
37 | return CHM_ENUMERATOR_CONTINUE; | ||
38 | } | ||
39 | |||
40 | CHM::CHM() { | ||
41 | chmFile = NULL; | ||
42 | chmPath = ""; | ||
43 | chmHHCPath = ""; | ||
44 | chmBuffer = ""; | ||
45 | bufpos = 0; | ||
46 | } | ||
47 | |||
48 | CHM::~CHM() { | ||
49 | if (chmFile != NULL) | ||
50 | chm_close(chmFile); | ||
51 | } | ||
52 | |||
53 | void CHM::suspend() { | ||
54 | #ifdef USEQPE | ||
55 | bSuspended = true; | ||
56 | //suspos = gztell(file); | ||
57 | chm_close(chmFile); | ||
58 | chmFile = NULL; | ||
59 | sustime = time(NULL); | ||
60 | #endif | ||
61 | } | ||
62 | |||
63 | void CHM::unsuspend() { | ||
64 | #ifdef USEQPE | ||
65 | if (bSuspended) | ||
66 | { | ||
67 | bSuspended = false; | ||
68 | int delay = time(NULL) - sustime; | ||
69 | if (delay < 10) | ||
70 | sleep(10-delay); | ||
71 | chmFile = chm_open(fname); | ||
72 | for (int i = 0; chmFile == NULL && i < 5; i++) { | ||
73 | sleep(5); | ||
74 | chmFile = chm_open(fname); | ||
75 | } | ||
76 | if (chmFile == NULL) { | ||
77 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); | ||
78 | exit(0); | ||
79 | } | ||
80 | //suspos = gzseek(file, suspos, SEEK_SET); | ||
81 | } | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | void CHM::addContent(QString content) { | ||
86 | chmBuffer += content; | ||
87 | } | ||
88 | |||
89 | void CHM::FillHomeContent() { | ||
90 | if (chmHHCPath != "") { | ||
91 | const char *ext; | ||
92 | char buffer[65536]; | ||
93 | unsigned int swath, offset; | ||
94 | QString tmp=""; | ||
95 | QString HTML=""; | ||
96 | /* try to find the file */ | ||
97 | const char *filename = (const char *)chmHHCPath; | ||
98 | if (chm_resolve_object(chmFile, filename, &m_ui) != CHM_RESOLVE_SUCCESS) | ||
99 | { | ||
100 | chmBuffer = "HELP"; | ||
101 | fsize = chmBuffer.length(); | ||
102 | return; | ||
103 | } | ||
104 | m_homestart = m_ui.start; | ||
105 | m_homeend = m_homestart + m_ui.length; | ||
106 | swath = 65536; | ||
107 | offset = 0; | ||
108 | fsize = m_ui.length; | ||
109 | while (offset < m_ui.length) | ||
110 | { | ||
111 | if ((m_ui.length - offset) < 65536) | ||
112 | swath = m_ui.length - offset; | ||
113 | else | ||
114 | swath = 65536; | ||
115 | swath = (int)chm_retrieve_object(chmFile, &m_ui, (unsigned char *) buffer, offset, swath); | ||
116 | tmp += buffer; | ||
117 | offset += swath; | ||
118 | } | ||
119 | HTML +="<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN>\r\n"; | ||
120 | HTML +="<HTML>\r\n"; | ||
121 | HTML +="<BODY>\r\n"; | ||
122 | HTML +="<h2>Home Page</h2>\r\n"; | ||
123 | HTML +="<h3>\r\n"; | ||
124 | QStringList qsl = QStringList::split("\r\n",tmp); | ||
125 | QString NameFind ="<param name=\"Name\" value=\""; | ||
126 | QString LocalFind = "<param name=\"Local\" value=\""; | ||
127 | QString ULOpenFind = "<UL>"; | ||
128 | QString LIOpenFind = "<LI>"; | ||
129 | QString ULCloseFind = "</UL>"; | ||
130 | QString Name = ""; | ||
131 | QString Local = ""; | ||
132 | for ( QStringList::Iterator it = qsl.begin(); it != qsl.end(); ++it ) { | ||
133 | QString Line = (*it); | ||
134 | int NamePos = Line.find( NameFind); | ||
135 | int LocalPos = Line.find( LocalFind); | ||
136 | if (NamePos > -1) { | ||
137 | Name = Line.mid(NamePos+NameFind.length(),Line.length()); | ||
138 | Name = Name.left(Name.length() - 2); | ||
139 | } | ||
140 | if (LocalPos > -1) { | ||
141 | Local = Line.mid(LocalPos+LocalFind.length(),Line.length()); | ||
142 | Local = Local.left(Local.length() - 2); | ||
143 | if (Name != "") { | ||
144 | HTML += "<br>\r\n<a href="; | ||
145 | HTML += Local; | ||
146 | HTML += ">"; | ||
147 | HTML += Name; | ||
148 | HTML += "</a>\r\n"; | ||
149 | Name = ""; | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | HTML +="</h3>"; | ||
154 | HTML +="</BODY>\r\n"; | ||
155 | HTML +="</HTML>\r\n"; | ||
156 | chmHomeBuffer = HTML; | ||
157 | chmBuffer = HTML; | ||
158 | fsize = chmBuffer.length(); | ||
159 | m_currentstart = m_ui.start; | ||
160 | m_currentend = m_currentstart+chmBuffer.length(); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | bool CHM::FillBuffer() | ||
165 | { | ||
166 | bool bRetVal = false; | ||
167 | char buffer[65536]; | ||
168 | int swath, offset; | ||
169 | chmBuffer = ""; | ||
170 | swath = 65536; | ||
171 | offset = 0; | ||
172 | fsize = m_ui.length; | ||
173 | while (offset < m_ui.length) | ||
174 | { | ||
175 | if ((m_ui.length - offset) < 65536) | ||
176 | swath = m_ui.length - offset; | ||
177 | else | ||
178 | swath = 65536; | ||
179 | swath = (int)chm_retrieve_object(chmFile, &m_ui, (unsigned char *) buffer, offset, swath); | ||
180 | chmBuffer += buffer; | ||
181 | offset += swath; | ||
182 | } | ||
183 | //There seems to be a ton of gobbledygook at the end that is reminiscent of the hhc file - remove it | ||
184 | QString temp = chmBuffer.lower(); | ||
185 | int lpos = temp.find("</html"); | ||
186 | if (lpos > -1) { | ||
187 | chmBuffer.truncate(lpos); | ||
188 | chmBuffer = chmBuffer+"</HTML>"; | ||
189 | } | ||
190 | fsize = chmBuffer.length(); | ||
191 | |||
192 | bufpos = 0; | ||
193 | bRetVal = true; | ||
194 | m_currentstart = m_ui.start; | ||
195 | m_currentend = m_currentstart+chmBuffer.length(); | ||
196 | return bRetVal; | ||
197 | } | ||
198 | |||
199 | bool CHM::FillContent() { | ||
200 | bool bRetVal = false; | ||
201 | if (chmPath != "") { | ||
202 | /* try to find the file */ | ||
203 | const char *filename = (const char *)chmPath; | ||
204 | if (chm_resolve_object(chmFile, filename, &m_ui) != CHM_RESOLVE_SUCCESS) | ||
205 | { | ||
206 | fsize = chmBuffer.length(); | ||
207 | return bRetVal; | ||
208 | } | ||
209 | |||
210 | char buffer[65536]; | ||
211 | int swath, offset; | ||
212 | chmBuffer = ""; | ||
213 | swath = 65536; | ||
214 | offset = 0; | ||
215 | fsize = m_ui.length; | ||
216 | while (offset < m_ui.length) | ||
217 | { | ||
218 | if ((m_ui.length - offset) < 65536) | ||
219 | swath = m_ui.length - offset; | ||
220 | else | ||
221 | swath = 65536; | ||
222 | swath = (int)chm_retrieve_object(chmFile, &m_ui, (unsigned char *) buffer, offset, swath); | ||
223 | chmBuffer += buffer; | ||
224 | offset += swath; | ||
225 | } | ||
226 | //There seems to be a ton of gobbledygook at the end that is reminiscent of the hhc file - remove it | ||
227 | QString temp = chmBuffer.lower(); | ||
228 | int lpos = temp.find("</html"); | ||
229 | if (lpos > -1) { | ||
230 | chmBuffer.truncate(lpos); | ||
231 | chmBuffer = chmBuffer+"</HTML>"; | ||
232 | } | ||
233 | fsize = chmBuffer.length(); | ||
234 | |||
235 | bufpos = 0; | ||
236 | m_currentstart = m_ui.start; | ||
237 | m_currentend = m_currentstart+chmBuffer.length(); | ||
238 | bRetVal = true; | ||
239 | } | ||
240 | return bRetVal; | ||
241 | } | ||
242 | |||
243 | bool CHM::getFile(const QString& href) { | ||
244 | qDebug("Got:%s", (const char*)href); | ||
245 | bool bRetVal = false; | ||
246 | QString temp = chmPath; | ||
247 | chmPath = href; | ||
248 | if (FillContent()) { | ||
249 | qDebug("Got it"); | ||
250 | bRetVal = true; | ||
251 | } else { | ||
252 | qDebug("Missed"); | ||
253 | chmPath = temp; | ||
254 | FillContent(); | ||
255 | } | ||
256 | return bRetVal; | ||
257 | } | ||
258 | |||
259 | QImage *CHM::getPicture(const QString& href) { | ||
260 | QImage *img = NULL; | ||
261 | QString PicRef = "/"+href; | ||
262 | struct chmUnitInfo ui; | ||
263 | const char *ext; | ||
264 | /* try to find the file */ | ||
265 | const char *filename = (const char *)PicRef; | ||
266 | if (chm_resolve_object(chmFile, filename, &ui) != CHM_RESOLVE_SUCCESS) | ||
267 | { | ||
268 | qDebug ("Could not resolve image"); | ||
269 | return img; | ||
270 | } | ||
271 | if (ui.length > 0) { | ||
272 | char *temp = new char[ui.length]; | ||
273 | char buffer[65536]; | ||
274 | int swath, offset; | ||
275 | swath = 65536; | ||
276 | offset = 0; | ||
277 | |||
278 | while (offset < ui.length) | ||
279 | { | ||
280 | if ((ui.length - offset) < 65536) | ||
281 | swath = ui.length - offset; | ||
282 | else | ||
283 | swath = 65536; | ||
284 | swath = (int)chm_retrieve_object(chmFile, &ui, (unsigned char *) buffer, offset, swath); | ||
285 | memcpy( (void *) (temp + offset), (void *)&buffer, swath ); | ||
286 | offset += swath; | ||
287 | } | ||
288 | QByteArray qba; | ||
289 | qba.setRawData( (const char *)temp, ui.length); | ||
290 | QPixmap qpm(qba); | ||
291 | img = new QImage(qpm.convertToImage()); | ||
292 | qba.resetRawData((const char *)temp, ui.length); | ||
293 | delete[] temp; | ||
294 | } | ||
295 | |||
296 | return img; | ||
297 | } | ||
298 | |||
299 | int CHM::OpenFile(const char *src) { | ||
300 | if (chmFile != NULL) chm_close(chmFile); | ||
301 | struct stat _stat; | ||
302 | stat(src,&_stat); | ||
303 | fsize = _stat.st_size; | ||
304 | chmFile = chm_open(src); | ||
305 | if (chmFile != NULL) { | ||
306 | chm_enumerate(chmFile, | ||
307 | CHM_ENUMERATE_ALL, | ||
308 | _get_hhc, | ||
309 | (void *)this); | ||
310 | if ( chmPath != "") { | ||
311 | setHomePath(chmPath); | ||
312 | FillHomeContent(); | ||
313 | } | ||
314 | } | ||
315 | m_homepos = locate(); | ||
316 | qDebug("Home:%u", m_homepos); | ||
317 | return (chmFile==NULL); | ||
318 | } | ||
319 | |||
320 | int CHM::getch() { | ||
321 | if ( (bufpos+1) >= chmBuffer.length() ) | ||
322 | return EOF; | ||
323 | #ifdef _WINDOWS | ||
324 | QChar letter = chmBuffer.at(bufpos++); | ||
325 | #else | ||
326 | QChar letter = chmBuffer[bufpos++]; | ||
327 | #endif | ||
328 | return (int)(char)letter; | ||
329 | } | ||
330 | |||
331 | void CHM::getch(tchar& ch, CStyle& sty) | ||
332 | { | ||
333 | int ich = getch(); | ||
334 | ch = (ich == EOF) ? UEOF : ich; | ||
335 | } | ||
336 | |||
337 | void CHM::start2endSection() | ||
338 | { | ||
339 | m_currentstart = m_ui.start; | ||
340 | m_currentend = m_currentstart+chmBuffer.length(); | ||
341 | } | ||
342 | |||
343 | unsigned int CHM::locate() { | ||
344 | return m_currentstart+bufpos; | ||
345 | } | ||
346 | |||
347 | void CHM::locate(unsigned int n) { | ||
348 | if (n == 0) n = m_homepos; | ||
349 | if (n >= m_homestart && n < m_homeend) | ||
350 | { | ||
351 | FillHomeContent(); | ||
352 | bufpos = n - m_homestart; | ||
353 | start2endSection(); | ||
354 | qDebug("Home:%u:<%u, %u, %u>", m_ui.start, m_currentstart, n, m_currentend); | ||
355 | } | ||
356 | else if (n >= m_currentstart && n < m_currentend) | ||
357 | { | ||
358 | bufpos = n - m_currentstart; | ||
359 | } | ||
360 | else if (CHM_RESOLVE_FAILURE == chm_resolve_location(chmFile, n/4, &m_ui)) | ||
361 | { | ||
362 | qDebug("Resolve failure"); | ||
363 | FillHomeContent(); | ||
364 | bufpos = 0; | ||
365 | start2endSection(); | ||
366 | qDebug("Home:%u:<%u, %u, %u>", m_ui.start, m_currentstart, n, m_currentend); | ||
367 | } | ||
368 | else | ||
369 | { | ||
370 | qDebug("Resolve success"); | ||
371 | FillBuffer(); | ||
372 | start2endSection(); | ||
373 | bufpos=n-m_currentstart; | ||
374 | qDebug("Not Home:%u:<%u, %u, %u>", m_ui.start, m_currentstart, n, m_currentend); | ||
375 | } | ||
376 | } | ||
377 | |||
378 | void CHM::sizes(unsigned long& _file, unsigned long& _text) { | ||
379 | _text = _file = fsize; | ||
380 | } | ||
diff --git a/noncore/apps/opie-reader/CHM.h b/noncore/apps/opie-reader/CHM.h new file mode 100644 index 0000000..7dac46f --- a/dev/null +++ b/noncore/apps/opie-reader/CHM.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef __CHM_h | ||
2 | #define __CHM_h | ||
3 | #include <stdio.h> | ||
4 | #include <sys/stat.h> | ||
5 | #include "useqpe.h" | ||
6 | #include "CExpander.h" | ||
7 | #include "chm_lib.h" | ||
8 | #include "my_list.h" | ||
9 | #include "CExpander.h" | ||
10 | |||
11 | struct Ref { | ||
12 | QString RefName; | ||
13 | QString RefLoc; | ||
14 | int beginpos; | ||
15 | int endpos; | ||
16 | }; | ||
17 | |||
18 | struct Pic { | ||
19 | QString RefName; | ||
20 | QString RefLoc; | ||
21 | int beginpos; | ||
22 | int endpos; | ||
23 | }; | ||
24 | |||
25 | class CHM : public CExpander | ||
26 | { | ||
27 | void start2endSection(); | ||
28 | struct chmUnitInfo m_ui; | ||
29 | struct chmFile *chmFile; | ||
30 | chmUnitInfo chmui; | ||
31 | //alloc a meg to buffer | ||
32 | QString chmHomeBuffer; | ||
33 | QString chmBuffer; | ||
34 | QString chmPath; | ||
35 | QString chmHHCPath; | ||
36 | unsigned int bufpos; | ||
37 | unsigned long fsize; | ||
38 | unsigned long m_homestart, m_homeend; | ||
39 | public: | ||
40 | void suspend(); | ||
41 | void unsuspend(); | ||
42 | bool hasnavigation() { return true; } | ||
43 | |||
44 | CHM(); | ||
45 | virtual ~CHM(); | ||
46 | int OpenFile(const char *src); | ||
47 | int getch(); | ||
48 | unsigned int locate(); | ||
49 | void locate(unsigned int n); | ||
50 | bool hasrandomaccess() { return true; } | ||
51 | void sizes(unsigned long& _file, unsigned long& _text); | ||
52 | void addContent(QString content); | ||
53 | void getch(tchar& ch, CStyle& sty); | ||
54 | void setPath(QString PathName) {chmPath = PathName;}; | ||
55 | void setHomePath(QString PathName) {chmHHCPath = PathName;}; | ||
56 | |||
57 | MarkupType PreferredMarkup() { | ||
58 | return cCHM; | ||
59 | } | ||
60 | bool getFile(const QString& href); | ||
61 | QImage *getPicture(const QString& href); | ||
62 | QString about() { return QString("CHM codec (c) Bob Griffin\nchm_lib (c) Jed Wing\nLZX code (c) Stuart Cale"); } | ||
63 | private : | ||
64 | bool FillBuffer(); | ||
65 | bool FillContent(); | ||
66 | void FillHomeContent(); | ||
67 | }; | ||
68 | #endif | ||
diff --git a/noncore/apps/opie-reader/CHM.mak b/noncore/apps/opie-reader/CHM.mak new file mode 100644 index 0000000..e14db5b --- a/dev/null +++ b/noncore/apps/opie-reader/CHM.mak | |||
@@ -0,0 +1,177 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libCHM.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:37:00 2004 | ||
4 | # Project: CHM.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o CHM.mak CHM.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -w -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -w -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libCHM.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = CHM.h \ | ||
47 | chm_lib.h \ | ||
48 | lzx.h | ||
49 | SOURCES = CHM.cpp \ | ||
50 | chm_lib.c \ | ||
51 | lzx.c | ||
52 | OBJECTS = QREADEROBJS/CHM.o \ | ||
53 | QREADEROBJS/chm_lib.o \ | ||
54 | QREADEROBJS/lzx.o | ||
55 | FORMS = | ||
56 | UICDECLS = | ||
57 | UICIMPLS = | ||
58 | SRCMOC = | ||
59 | OBJMOC = | ||
60 | DIST = CHM.pro | ||
61 | QMAKE_TARGET = CHM | ||
62 | DESTDIR = $(READERDIR)/codecs/ | ||
63 | TARGET = libCHM.so.1.0.0 | ||
64 | TARGETA= $(READERDIR)/codecs/libCHM.a | ||
65 | TARGETD= libCHM.so.1.0.0 | ||
66 | TARGET0= libCHM.so | ||
67 | TARGET1= libCHM.so.1 | ||
68 | TARGET2= libCHM.so.1.0 | ||
69 | |||
70 | first: all | ||
71 | ####### Implicit rules | ||
72 | |||
73 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
74 | |||
75 | .cpp.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .cc.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .cxx.o: | ||
82 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | .C.o: | ||
85 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
86 | |||
87 | .c.o: | ||
88 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
89 | |||
90 | ####### Build rules | ||
91 | |||
92 | all: CHM.mak $(READERDIR)/codecs/$(TARGET) | ||
93 | |||
94 | $(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
95 | test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/ | ||
96 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
97 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
98 | -ln -s $(TARGET) $(TARGET0) | ||
99 | -ln -s $(TARGET) $(TARGET1) | ||
100 | -ln -s $(TARGET) $(TARGET2) | ||
101 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) | ||
102 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) | ||
103 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1) | ||
104 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2) | ||
105 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/ | ||
106 | |||
107 | |||
108 | |||
109 | staticlib: $(TARGETA) | ||
110 | |||
111 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
112 | -$(DEL_FILE) $(TARGETA) | ||
113 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
114 | |||
115 | mocables: $(SRCMOC) | ||
116 | uicables: $(UICDECLS) $(UICIMPLS) | ||
117 | |||
118 | $(MOC): | ||
119 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
120 | |||
121 | CHM.mak: CHM.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
122 | $(QMAKE) -o CHM.mak CHM.pro | ||
123 | qmake: | ||
124 | @$(QMAKE) -o CHM.mak CHM.pro | ||
125 | |||
126 | dist: | ||
127 | @mkdir -p QREADEROBJS/CHM && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/CHM/ && ( cd `dirname QREADEROBJS/CHM` && $(TAR) CHM.tar CHM && $(GZIP) CHM.tar ) && $(MOVE) `dirname QREADEROBJS/CHM`/CHM.tar.gz . && $(DEL_FILE) -r QREADEROBJS/CHM | ||
128 | |||
129 | mocclean: | ||
130 | |||
131 | uiclean: | ||
132 | |||
133 | yaccclean: | ||
134 | lexclean: | ||
135 | clean: | ||
136 | -$(DEL_FILE) $(OBJECTS) | ||
137 | -$(DEL_FILE) *~ core *.core | ||
138 | |||
139 | |||
140 | ####### Sub-libraries | ||
141 | |||
142 | distclean: clean | ||
143 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET) | ||
144 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA) | ||
145 | |||
146 | |||
147 | FORCE: | ||
148 | |||
149 | ####### Compile | ||
150 | |||
151 | QREADEROBJS/CHM.o: CHM.cpp CHM.h \ | ||
152 | chm_lib.h \ | ||
153 | QREADERINC/static.h \ | ||
154 | QREADERINC/useqpe.h \ | ||
155 | CExpander.h \ | ||
156 | my_list.h \ | ||
157 | config.h \ | ||
158 | StyleConsts.h \ | ||
159 | Markups.h \ | ||
160 | names.h \ | ||
161 | linktype.h \ | ||
162 | ustring.h | ||
163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CHM.o CHM.cpp | ||
164 | |||
165 | QREADEROBJS/chm_lib.o: chm_lib.c chm_lib.h \ | ||
166 | lzx.h | ||
167 | $(CC) -c $(CFLAGS) $(INCPATH) -o QREADEROBJS/chm_lib.o chm_lib.c | ||
168 | |||
169 | QREADEROBJS/lzx.o: lzx.c lzx.h | ||
170 | $(CC) -c $(CFLAGS) $(INCPATH) -o QREADEROBJS/lzx.o lzx.c | ||
171 | |||
172 | ####### Install | ||
173 | |||
174 | install: all | ||
175 | |||
176 | uninstall: | ||
177 | |||
diff --git a/noncore/apps/opie-reader/CHM.omak b/noncore/apps/opie-reader/CHM.omak new file mode 100644 index 0000000..4cdfbe2 --- a/dev/null +++ b/noncore/apps/opie-reader/CHM.omak | |||
@@ -0,0 +1,140 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libCHM.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: CHM.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libCHM.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =CHM.h \ | ||
29 | chm_lib.h \ | ||
30 | lzx.h | ||
31 | SOURCES =CHM.cpp \ | ||
32 | chm_lib.c \ | ||
33 | lzx.c | ||
34 | OBJECTS =OREADEROBJS/CHM.o \ | ||
35 | OREADEROBJS/chm_lib.o \ | ||
36 | OREADEROBJS/lzx.o | ||
37 | INTERFACES = | ||
38 | UICDECLS = | ||
39 | UICIMPLS = | ||
40 | SRCMOC = | ||
41 | OBJMOC = | ||
42 | DIST = | ||
43 | TARGET =libCHM.so.1.0.0 | ||
44 | TARGETA =$(QTDIR)/plugins/reader/codecs/libCHM.a | ||
45 | TARGETD =libCHM.so.1.0.0 | ||
46 | TARGET0 =libCHM.so | ||
47 | TARGET1 =libCHM.so.1 | ||
48 | TARGET2 =libCHM.so.1.0 | ||
49 | INTERFACE_DECL_PATH = . | ||
50 | |||
51 | ####### Implicit rules | ||
52 | |||
53 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
54 | |||
55 | .cpp.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .cxx.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .cc.o: | ||
62 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | .C.o: | ||
65 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
66 | |||
67 | .c.o: | ||
68 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
69 | |||
70 | ####### Build rules | ||
71 | |||
72 | |||
73 | all: $(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0 | ||
74 | |||
75 | $(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
76 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
77 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
78 | -ln -s $(TARGET) $(TARGET0) | ||
79 | -ln -s $(TARGET) $(TARGET1) | ||
80 | -ln -s $(TARGET) $(TARGET2) | ||
81 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
82 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
83 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
84 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
85 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
86 | |||
87 | staticlib: $(TARGETA) | ||
88 | |||
89 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
90 | -rm -f $(TARGETA) | ||
91 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
92 | |||
93 | moc: $(SRCMOC) | ||
94 | |||
95 | tmake: CHM.omak | ||
96 | |||
97 | CHM.omak: CHM.opro | ||
98 | tmake CHM.opro -o CHM.omak | ||
99 | |||
100 | dist: | ||
101 | $(TAR) CHM.opro.tar CHM.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
102 | $(GZIP) CHM.opro.tar | ||
103 | |||
104 | clean: | ||
105 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
106 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
107 | -rm -f *~ core | ||
108 | |||
109 | ####### Sub-libraries | ||
110 | |||
111 | |||
112 | ###### Combined headers | ||
113 | |||
114 | |||
115 | ####### Compile | ||
116 | |||
117 | OREADEROBJS/CHM.o: CHM.cpp \ | ||
118 | CHM.h \ | ||
119 | OREADERINC/useqpe.h \ | ||
120 | CExpander.h \ | ||
121 | config.h \ | ||
122 | ustring.h \ | ||
123 | StyleConsts.h \ | ||
124 | Markups.h \ | ||
125 | names.h \ | ||
126 | linktype.h \ | ||
127 | chm_lib.h \ | ||
128 | my_list.h \ | ||
129 | OREADERINC/static.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CHM.o CHM.cpp | ||
131 | |||
132 | OREADEROBJS/chm_lib.o: chm_lib.c \ | ||
133 | chm_lib.h \ | ||
134 | lzx.h | ||
135 | $(CC) -c $(CFLAGS) $(INCPATH) -o OREADEROBJS/chm_lib.o chm_lib.c | ||
136 | |||
137 | OREADEROBJS/lzx.o: lzx.c \ | ||
138 | lzx.h | ||
139 | $(CC) -c $(CFLAGS) $(INCPATH) -o OREADEROBJS/lzx.o lzx.c | ||
140 | |||
diff --git a/noncore/apps/opie-reader/CHM.zmak b/noncore/apps/opie-reader/CHM.zmak new file mode 100644 index 0000000..6cde457 --- a/dev/null +++ b/noncore/apps/opie-reader/CHM.zmak | |||
@@ -0,0 +1,140 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libCHM.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: CHM.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libCHM.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =CHM.h \ | ||
29 | chm_lib.h \ | ||
30 | lzx.h | ||
31 | SOURCES =CHM.cpp \ | ||
32 | chm_lib.c \ | ||
33 | lzx.c | ||
34 | OBJECTS =ZREADEROBJS/CHM.o \ | ||
35 | ZREADEROBJS/chm_lib.o \ | ||
36 | ZREADEROBJS/lzx.o | ||
37 | INTERFACES = | ||
38 | UICDECLS = | ||
39 | UICIMPLS = | ||
40 | SRCMOC = | ||
41 | OBJMOC = | ||
42 | DIST = | ||
43 | TARGET =libCHM.so.1.0.0 | ||
44 | TARGETA =$(QTDIR)/plugins/reader/codecs/libCHM.a | ||
45 | TARGETD =libCHM.so.1.0.0 | ||
46 | TARGET0 =libCHM.so | ||
47 | TARGET1 =libCHM.so.1 | ||
48 | TARGET2 =libCHM.so.1.0 | ||
49 | INTERFACE_DECL_PATH = . | ||
50 | |||
51 | ####### Implicit rules | ||
52 | |||
53 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
54 | |||
55 | .cpp.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .cxx.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .cc.o: | ||
62 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | .C.o: | ||
65 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
66 | |||
67 | .c.o: | ||
68 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
69 | |||
70 | ####### Build rules | ||
71 | |||
72 | |||
73 | all: $(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0 | ||
74 | |||
75 | $(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
76 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
77 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
78 | -ln -s $(TARGET) $(TARGET0) | ||
79 | -ln -s $(TARGET) $(TARGET1) | ||
80 | -ln -s $(TARGET) $(TARGET2) | ||
81 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
82 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
83 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
84 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
85 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
86 | |||
87 | staticlib: $(TARGETA) | ||
88 | |||
89 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
90 | -rm -f $(TARGETA) | ||
91 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
92 | |||
93 | moc: $(SRCMOC) | ||
94 | |||
95 | tmake: CHM.zmak | ||
96 | |||
97 | CHM.zmak: CHM.zpro | ||
98 | tmake CHM.zpro -o CHM.zmak | ||
99 | |||
100 | dist: | ||
101 | $(TAR) CHM.zpro.tar CHM.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
102 | $(GZIP) CHM.zpro.tar | ||
103 | |||
104 | clean: | ||
105 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
106 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
107 | -rm -f *~ core | ||
108 | |||
109 | ####### Sub-libraries | ||
110 | |||
111 | |||
112 | ###### Combined headers | ||
113 | |||
114 | |||
115 | ####### Compile | ||
116 | |||
117 | ZREADEROBJS/CHM.o: CHM.cpp \ | ||
118 | CHM.h \ | ||
119 | ZREADERINC/useqpe.h \ | ||
120 | CExpander.h \ | ||
121 | config.h \ | ||
122 | ustring.h \ | ||
123 | StyleConsts.h \ | ||
124 | Markups.h \ | ||
125 | names.h \ | ||
126 | linktype.h \ | ||
127 | chm_lib.h \ | ||
128 | my_list.h \ | ||
129 | ZREADERINC/static.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CHM.o CHM.cpp | ||
131 | |||
132 | ZREADEROBJS/chm_lib.o: chm_lib.c \ | ||
133 | chm_lib.h \ | ||
134 | lzx.h | ||
135 | $(CC) -c $(CFLAGS) $(INCPATH) -o ZREADEROBJS/chm_lib.o chm_lib.c | ||
136 | |||
137 | ZREADEROBJS/lzx.o: lzx.c \ | ||
138 | lzx.h | ||
139 | $(CC) -c $(CFLAGS) $(INCPATH) -o ZREADEROBJS/lzx.o lzx.c | ||
140 | |||
diff --git a/noncore/apps/opie-reader/CHM.zpro b/noncore/apps/opie-reader/CHM.zpro new file mode 100644 index 0000000..1f2464a --- a/dev/null +++ b/noncore/apps/opie-reader/CHM.zpro | |||
@@ -0,0 +1,16 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = CHM.h chm_lib.h lzx.h | ||
4 | |||
5 | SOURCES = CHM.cpp chm_lib.c lzx.c | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = CHM | ||
11 | LIBS += -lreader_codec | ||
12 | |||
13 | OBJECTS_DIR = ZREADEROBJS | ||
14 | MOC_DIR = ZREADERMOCS | ||
15 | INCLUDEPATH+= ZREADERINC | ||
16 | DEPENDPATH += ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/CHM/.cvsignore b/noncore/apps/opie-reader/CHM/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/CHM/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/CHM/CHM.pro b/noncore/apps/opie-reader/CHM/CHM.pro new file mode 100644 index 0000000..6ed86f6 --- a/dev/null +++ b/noncore/apps/opie-reader/CHM/CHM.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = CHM.h chm_lib.h lzx.h | ||
6 | |||
7 | SOURCES = CHM.cpp chm_lib.c lzx.c | ||
8 | |||
9 | |||
10 | INTERFACES= | ||
11 | DESTDIR = $(OPIEDIR)/plugins/reader/codecs | ||
12 | TARGET = CHM | ||
13 | LIBS += -lreader_codec | ||
14 | |||
15 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
16 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) \ No newline at end of file | ||
diff --git a/noncore/apps/opie-reader/CRegExp.cpp b/noncore/apps/opie-reader/CRegExp.cpp new file mode 100644 index 0000000..77dc2dc --- a/dev/null +++ b/noncore/apps/opie-reader/CRegExp.cpp | |||
@@ -0,0 +1,599 @@ | |||
1 | #include "CRegExp.h" | ||
2 | |||
3 | //#include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | //#include <string.h> | ||
6 | |||
7 | |||
8 | tchar CRegExpFilt::escapedchar(tchar c) | ||
9 | { | ||
10 | switch (c) | ||
11 | { | ||
12 | case '\\': | ||
13 | return '\\'; | ||
14 | break; | ||
15 | case '"': | ||
16 | return '\"'; | ||
17 | break; | ||
18 | case 'a': | ||
19 | return '\a'; | ||
20 | break; | ||
21 | case 'b': | ||
22 | return '\b'; | ||
23 | break; | ||
24 | case 'f': | ||
25 | return '\f'; | ||
26 | break; | ||
27 | case 'n': | ||
28 | return '\n'; | ||
29 | break; | ||
30 | case 'r': | ||
31 | return '\r'; | ||
32 | break; | ||
33 | case 't': | ||
34 | return '\t'; | ||
35 | break; | ||
36 | case 'v': | ||
37 | return '\v'; | ||
38 | break; | ||
39 | default: | ||
40 | return c; | ||
41 | break; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | void CRegExpFilt::regchar(tchar c, bool insens) | ||
46 | { | ||
47 | if (insens) | ||
48 | { | ||
49 | tchar t = upper(c); | ||
50 | CV[t] = 0; | ||
51 | t = lower(c); | ||
52 | CV[t] = 0; | ||
53 | } | ||
54 | else | ||
55 | { | ||
56 | CV[c] = 0; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | void CRegExpFilt::prepreprocessing(const QString& pat, bool insens) | ||
61 | { | ||
62 | for (unsigned int p = 0; p < pat.length(); p++) | ||
63 | { | ||
64 | #ifdef _WINDOWS | ||
65 | switch (pat.at(p).unicode()) | ||
66 | #else | ||
67 | switch (pat[p].unicode()) | ||
68 | #endif | ||
69 | { | ||
70 | case '{': | ||
71 | { | ||
72 | break; | ||
73 | } | ||
74 | case '}': | ||
75 | { | ||
76 | break; | ||
77 | } | ||
78 | case '^': | ||
79 | { | ||
80 | break; | ||
81 | } | ||
82 | case '.' : | ||
83 | { | ||
84 | break; | ||
85 | } | ||
86 | case '#': | ||
87 | { | ||
88 | p++; | ||
89 | #ifdef _WINDOWS | ||
90 | while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') | ||
91 | #else | ||
92 | while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') | ||
93 | #endif | ||
94 | { | ||
95 | } | ||
96 | p--; | ||
97 | break; | ||
98 | } | ||
99 | case '\\' : | ||
100 | { | ||
101 | #ifdef _WINDOWS | ||
102 | tchar c = escapedchar(pat.at(++p).unicode()); | ||
103 | #else | ||
104 | tchar c = escapedchar(pat[++p].unicode()); | ||
105 | #endif | ||
106 | regchar(c, insens); | ||
107 | break; | ||
108 | } | ||
109 | |||
110 | case '[' : | ||
111 | { | ||
112 | tchar clast; | ||
113 | bool invert = false; | ||
114 | tchar c; | ||
115 | #ifdef _WINDOWS | ||
116 | if (pat.at(p+1).unicode() == '^') | ||
117 | #else | ||
118 | if (pat[p+1].unicode() == '^') | ||
119 | #endif | ||
120 | { | ||
121 | p++; | ||
122 | invert = true; | ||
123 | } | ||
124 | #ifdef _WINDOWS | ||
125 | while ((c = pat.at(++p).unicode()) != ']') | ||
126 | #else | ||
127 | while ((c = pat[++p].unicode()) != ']') | ||
128 | #endif | ||
129 | { | ||
130 | if (c == '\\') | ||
131 | { | ||
132 | #ifdef _WINDOWS | ||
133 | c = escapedchar(pat.at(++p).unicode()); | ||
134 | #else | ||
135 | c = escapedchar(pat[++p].unicode()); | ||
136 | #endif | ||
137 | if (c == ']') break; | ||
138 | } | ||
139 | if (c == '-') | ||
140 | { | ||
141 | #ifdef _WINDOWS | ||
142 | c = pat.at(++p).unicode(); | ||
143 | #else | ||
144 | c = pat[++p].unicode(); | ||
145 | #endif | ||
146 | for (tchar j = clast; j <= c; j++) | ||
147 | { | ||
148 | regchar(j, insens); | ||
149 | } | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | regchar(c, insens); | ||
154 | } | ||
155 | clast = c; | ||
156 | } | ||
157 | break; | ||
158 | } | ||
159 | default : | ||
160 | { | ||
161 | #ifdef _WINDOWS | ||
162 | regchar(pat.at(p).unicode(), insens); | ||
163 | #else | ||
164 | regchar(pat[p].unicode(), insens); | ||
165 | #endif | ||
166 | break; | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | /* | ||
171 | for (iter i = CV.begin(); i != CV.end(); ++i) | ||
172 | { | ||
173 | printf("Pre: [%u]\n", i.first()); | ||
174 | } | ||
175 | */ | ||
176 | CV[0] = 0; | ||
177 | } | ||
178 | |||
179 | unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens) | ||
180 | { | ||
181 | prepreprocessing(pat, insens); | ||
182 | qDebug("PrePreProcessing done"); | ||
183 | unsigned int p, m; | ||
184 | bool inkeep = false; | ||
185 | keep = 0; | ||
186 | replace = 0; | ||
187 | for (unsigned int j = 0; j < WORD_SIZE; j++) | ||
188 | { | ||
189 | bit[j] = (1 << (WORD_SIZE -j -1)); | ||
190 | lfcnt[j] = 0; | ||
191 | } | ||
192 | |||
193 | for (p = 0, m = 0; p < pat.length(); p++) | ||
194 | { | ||
195 | qDebug("m is %u", m); | ||
196 | if (inkeep) keep |= bit[m]; | ||
197 | #ifdef _WINDOWS | ||
198 | switch (pat.at(p).unicode()) | ||
199 | #else | ||
200 | switch (pat[p].unicode()) | ||
201 | #endif | ||
202 | { | ||
203 | case '{': | ||
204 | { | ||
205 | inkeep = true; | ||
206 | break; | ||
207 | } | ||
208 | case '}': | ||
209 | { | ||
210 | keep ^= bit[m]; | ||
211 | inkeep = false; | ||
212 | break; | ||
213 | } | ||
214 | case '^': | ||
215 | { | ||
216 | replace |= bit[m]; | ||
217 | lfcnt[m]++; | ||
218 | break; | ||
219 | } | ||
220 | case '.' : | ||
221 | { | ||
222 | for (iter j = CV.begin(); j != CV.end(); ++j) CV[j.first()] |= bit[m]; | ||
223 | m++; | ||
224 | break; | ||
225 | } | ||
226 | case '#': | ||
227 | { | ||
228 | if (m > 0) | ||
229 | { | ||
230 | p++; | ||
231 | int count = 0; | ||
232 | #ifdef _WINDOWS | ||
233 | while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') | ||
234 | #else | ||
235 | while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') | ||
236 | #endif | ||
237 | { | ||
238 | #ifdef _WINDOWS | ||
239 | count = 10*count + pat.at(p++).unicode() - '0'; | ||
240 | #else | ||
241 | count = 10*count + pat[p++].unicode() - '0'; | ||
242 | #endif | ||
243 | } | ||
244 | p--; | ||
245 | count = count-1; | ||
246 | unsigned int mask = 0; | ||
247 | for (unsigned int i = m; i < m+count; i++) | ||
248 | { | ||
249 | mask |= bit[i]; | ||
250 | } | ||
251 | |||
252 | for (iter it = CV.begin(); it != CV.end(); ++it) | ||
253 | { | ||
254 | if (CV[it.first()] & bit[m-1]) | ||
255 | { | ||
256 | CV[it.first()] |= mask; | ||
257 | } | ||
258 | } | ||
259 | if (keep & bit[m-1]) keep |= mask; | ||
260 | m += count; | ||
261 | } | ||
262 | else | ||
263 | { | ||
264 | p++; | ||
265 | } | ||
266 | break; | ||
267 | } | ||
268 | case '\\' : | ||
269 | { | ||
270 | #ifdef _WINDOWS | ||
271 | tchar c = escapedchar(pat.at(++p).unicode()); | ||
272 | #else | ||
273 | tchar c = escapedchar(pat[++p].unicode()); | ||
274 | #endif | ||
275 | if (insens) | ||
276 | { | ||
277 | CV[upper(c)] |= bit[m]; | ||
278 | CV[lower(c)] |= bit[m]; | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | CV[c] |= bit[m]; | ||
283 | } | ||
284 | m++; | ||
285 | break; | ||
286 | } | ||
287 | |||
288 | case '[' : | ||
289 | { | ||
290 | tchar c, clast; | ||
291 | bool invert = false; | ||
292 | #ifdef _WINDOWS | ||
293 | if (pat.at(p+1).unicode() == '^') | ||
294 | #else | ||
295 | if (pat[p+1].unicode() == '^') | ||
296 | #endif | ||
297 | { | ||
298 | p++; | ||
299 | invert = true; | ||
300 | } | ||
301 | #ifdef _WINDOWS | ||
302 | while ((c = pat.at(++p).unicode()) != ']') | ||
303 | #else | ||
304 | while ((c = pat[++p].unicode()) != ']') | ||
305 | #endif | ||
306 | { | ||
307 | if (c == '\\') | ||
308 | { | ||
309 | #ifdef _WINDOWS | ||
310 | c = escapedchar(pat.at(++p).unicode()); | ||
311 | #else | ||
312 | c = escapedchar(pat[++p].unicode()); | ||
313 | #endif | ||
314 | if (c == ']') break; | ||
315 | } | ||
316 | if (c == '-') | ||
317 | { | ||
318 | #ifdef _WINDOWS | ||
319 | c = pat.at(++p).unicode(); | ||
320 | #else | ||
321 | c = pat[++p].unicode(); | ||
322 | #endif | ||
323 | for (tchar j = clast; j <= c; j++) | ||
324 | { | ||
325 | if (insens) | ||
326 | { | ||
327 | iter it; | ||
328 | if ((it = CV.find(upper(j))) != CV.end()) | ||
329 | CV[it] |= bit[m]; | ||
330 | else | ||
331 | CV[0] |= bit[m]; | ||
332 | if ((it = CV.find(lower(j))) != CV.end()) | ||
333 | CV[it] |= bit[m]; | ||
334 | else | ||
335 | CV[0] |= bit[m]; | ||
336 | } | ||
337 | else | ||
338 | { | ||
339 | iter it; | ||
340 | if ((it = CV.find(j)) != CV.end()) | ||
341 | CV[it] |= bit[m]; | ||
342 | else | ||
343 | { | ||
344 | CV[0] |= bit[m]; | ||
345 | } | ||
346 | } | ||
347 | } | ||
348 | } | ||
349 | else | ||
350 | { | ||
351 | if (insens) | ||
352 | { | ||
353 | iter it; | ||
354 | if ((it = CV.find(upper(c))) != CV.end()) | ||
355 | CV[it] |= bit[m]; | ||
356 | else | ||
357 | CV[0] |= bit[m]; | ||
358 | if ((it = CV.find(lower(c))) != CV.end()) | ||
359 | CV[it] |= bit[m]; | ||
360 | else | ||
361 | CV[0] |= bit[m]; | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | iter it; | ||
366 | if ((it = CV.find(c)) != CV.end()) | ||
367 | CV[it] |= bit[m]; | ||
368 | else | ||
369 | CV[0] |= bit[m]; | ||
370 | } | ||
371 | } | ||
372 | clast = c; | ||
373 | } | ||
374 | if (invert) | ||
375 | { | ||
376 | for (iter i = CV.begin(); i != CV.end(); ++i) | ||
377 | { | ||
378 | CV[i.first()] ^= bit[m]; | ||
379 | } | ||
380 | } | ||
381 | m++; | ||
382 | break; | ||
383 | } | ||
384 | default : | ||
385 | { | ||
386 | #ifdef _WINDOWS | ||
387 | tchar c = pat.at(p).unicode(); | ||
388 | #else | ||
389 | tchar c = pat[p].unicode(); | ||
390 | #endif | ||
391 | if (insens) | ||
392 | { | ||
393 | CV[upper(c)] |= bit[m]; | ||
394 | CV[lower(c)] |= bit[m]; | ||
395 | } | ||
396 | else CV[c] |= bit[m]; | ||
397 | m++; | ||
398 | break; | ||
399 | } | ||
400 | } | ||
401 | } | ||
402 | qDebug("Returning:%u",m); | ||
403 | return m; | ||
404 | } | ||
405 | |||
406 | bool CRegExpFilt::empty() | ||
407 | { | ||
408 | return m_outQueue.empty(); | ||
409 | } | ||
410 | |||
411 | tchar CRegExpFilt::pop() | ||
412 | { | ||
413 | return m_outQueue.pop(); | ||
414 | } | ||
415 | |||
416 | bool CRegExpFilt::addch(tchar ch) | ||
417 | { | ||
418 | word[cur] = ch; | ||
419 | cur = (cur+1)%patlength; | ||
420 | if (len < patlength) len++; | ||
421 | |||
422 | unsigned int cv = 0; | ||
423 | iter it; | ||
424 | if ((it = CV.find(ch)) == CV.end()) | ||
425 | { | ||
426 | cv = CV[0]; | ||
427 | } | ||
428 | else | ||
429 | { | ||
430 | cv = CV[it]; | ||
431 | } | ||
432 | |||
433 | R = ((R >> 1) | bit_0) & cv; /* Exact matches */ | ||
434 | if (R & endpos) | ||
435 | { | ||
436 | for (unsigned int i = 0; i < patlength; i++) | ||
437 | { | ||
438 | if (replace & bit[i]) | ||
439 | { | ||
440 | for (unsigned int j = 0; j < lfcnt[i]; j++) | ||
441 | { | ||
442 | m_outQueue.push(10); | ||
443 | } | ||
444 | } | ||
445 | if (keep & bit[i]) | ||
446 | { | ||
447 | m_outQueue.push(word[(cur+i)%patlength]); | ||
448 | // putchar('*'); | ||
449 | // putchar(i + '0'); | ||
450 | } | ||
451 | len = 0; | ||
452 | } | ||
453 | return true; | ||
454 | } | ||
455 | else | ||
456 | { | ||
457 | if (len == patlength) | ||
458 | { | ||
459 | tchar ch = word[cur]; | ||
460 | if (ch == 10) ch = ' '; | ||
461 | m_outQueue.push(ch); | ||
462 | } | ||
463 | return false; | ||
464 | } | ||
465 | } | ||
466 | |||
467 | void CRegExpFilt::restart() | ||
468 | { | ||
469 | R = 0; | ||
470 | len = 0; | ||
471 | } | ||
472 | |||
473 | CRegExpFilt::CRegExpFilt(const QString& pat, bool insensflag) : CV(300) | ||
474 | { | ||
475 | cur = 0; | ||
476 | patlength = preprocessing(pat, insensflag); | ||
477 | qDebug("Preprocesing done:%u", patlength); | ||
478 | endpos = bit[patlength-1]; | ||
479 | bit_0 = bit[0]; | ||
480 | |||
481 | restart(); | ||
482 | |||
483 | qDebug("Pattern: %s:%u", (const char*)pat, patlength); | ||
484 | |||
485 | } | ||
486 | |||
487 | |||
488 | CRegExpFilt::~CRegExpFilt() | ||
489 | { | ||
490 | } | ||
491 | |||
492 | #ifdef NOWAYISTHISDEFINED | ||
493 | void reportmatch(tchar *line, /*tchar *text,*/ unsigned int mtype, unsigned int lino) | ||
494 | { | ||
495 | /* | ||
496 | tchar *text = line + strlen(line); | ||
497 | |||
498 | tchar *ptr = line; | ||
499 | if (mtype == 0) | ||
500 | printf("Exact match at line number %u.\n", lino); | ||
501 | else | ||
502 | printf("%u error match at line number %u.\n", mtype, lino); | ||
503 | while (ptr < text) putchar(*ptr++); | ||
504 | printf("%c[4m^%c[24m%s\n", 27, 27, ptr); | ||
505 | */ | ||
506 | } | ||
507 | |||
508 | |||
509 | void usage(void) | ||
510 | { | ||
511 | printf("Usage: CRegExpFilt [-i] pattern/a file\n"); | ||
512 | } | ||
513 | |||
514 | int getline(tchar *s,int lim,FILE *f) | ||
515 | { | ||
516 | int c, i; | ||
517 | |||
518 | for (i = 0; i < lim-1 && (c = getc(f)) != EOF && c != '\n'; ) | ||
519 | { | ||
520 | s[i++] = (tchar)c; | ||
521 | } | ||
522 | s[i] = '\0'; | ||
523 | return ((c == EOF && i == 0) ? -1 : i); | ||
524 | } | ||
525 | |||
526 | #define BUF_SIZE256 | ||
527 | |||
528 | int main(int argc, char **argv) | ||
529 | { | ||
530 | unsigned int lino = 0; | ||
531 | unsigned int blino = 0; | ||
532 | bool insens = false; | ||
533 | int len; | ||
534 | tchar line[BUF_SIZE]; | ||
535 | FILE *inf; | ||
536 | |||
537 | /* Error checking of cmd ln args! */ | ||
538 | if (argc < 3) | ||
539 | {usage(); return 10; } | ||
540 | /* Corresponds to requiring a minimum of 3 matches */ | ||
541 | for (len = 1; len < argc-2; len++) | ||
542 | { | ||
543 | if (argv[len][0] != '-') | ||
544 | {usage(); return 10; } | ||
545 | else switch (argv[len][1]) | ||
546 | { | ||
547 | case 'i' : | ||
548 | { | ||
549 | insens = true; | ||
550 | break; | ||
551 | } | ||
552 | default : | ||
553 | {usage(); return 10;} | ||
554 | } | ||
555 | } | ||
556 | |||
557 | tchar* pattern = new tchar[strlen(argv[argc-2])+1]; | ||
558 | |||
559 | for (int i = 0; (pattern[i] = argv[argc-2][i]) != 0; i++); | ||
560 | |||
561 | |||
562 | |||
563 | CRegExpFilt test(pattern, insens); | ||
564 | |||
565 | delete [] pattern; | ||
566 | |||
567 | inf = fopen(argv[argc-1], "r"); | ||
568 | if (!inf) | ||
569 | { | ||
570 | printf("file not found\n"); | ||
571 | return 10; | ||
572 | } | ||
573 | |||
574 | while ((len = getline(line, BUF_SIZE, inf)) >= 0) | ||
575 | { | ||
576 | lino++; | ||
577 | bool ret = false; | ||
578 | |||
579 | { | ||
580 | tchar *textend = line+len; | ||
581 | tchar *text = line; | ||
582 | while (text < textend) | ||
583 | { | ||
584 | ret |= test.addch(*text++); | ||
585 | } | ||
586 | ret |= test.addch('\n'); | ||
587 | while (!test.empty()) | ||
588 | { | ||
589 | putchar(test.pop()); | ||
590 | } | ||
591 | } | ||
592 | // inswt = test.addch(line, len); | ||
593 | if (ret) reportmatch(line, 0, lino); | ||
594 | } | ||
595 | fclose(inf); | ||
596 | //CloseSTDLIB(); | ||
597 | return 0; | ||
598 | } | ||
599 | #endif | ||
diff --git a/noncore/apps/opie-reader/CRegExp.h b/noncore/apps/opie-reader/CRegExp.h new file mode 100644 index 0000000..661e300 --- a/dev/null +++ b/noncore/apps/opie-reader/CRegExp.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #include "config.h" | ||
2 | #include "hash.h" | ||
3 | #include "Queue.h" | ||
4 | #include <qstring.h> | ||
5 | |||
6 | typedef hashtable<tchar,unsigned int>::iterator iter; | ||
7 | |||
8 | #define WORD_SIZE32 | ||
9 | |||
10 | class CRegExpFilt | ||
11 | { | ||
12 | CQueue<tchar> m_outQueue; | ||
13 | hashtable<tchar,unsigned int> CV; | ||
14 | unsigned int bit[WORD_SIZE]; | ||
15 | unsigned int R; | ||
16 | unsigned int bit_0, endpos; | ||
17 | unsigned int patlength; | ||
18 | unsigned int keep, len; | ||
19 | unsigned int replace, cur; | ||
20 | void regchar(tchar, bool); | ||
21 | void prepreprocessing(const QString& pat, bool insens); | ||
22 | unsigned int preprocessing(const QString& pat, bool insens); | ||
23 | tchar word[WORD_SIZE]; | ||
24 | unsigned int lfcnt[WORD_SIZE]; | ||
25 | tchar escapedchar(tchar c); | ||
26 | int islower(tchar c) | ||
27 | { | ||
28 | return (('a' <= c) && (c <= 'z')); | ||
29 | } | ||
30 | tchar upper(tchar c) | ||
31 | { | ||
32 | return (tchar)(islower(c) ? (c - 'a' + 'A') : c); | ||
33 | } | ||
34 | int isupper(tchar c) | ||
35 | { | ||
36 | return (('A' <= c) && (c <= 'Z')); | ||
37 | } | ||
38 | tchar lower(tchar c) | ||
39 | { | ||
40 | return (tchar)(isupper(c) ? (c + 'a' - 'A') : c); | ||
41 | } | ||
42 | public: | ||
43 | CRegExpFilt(const QString& pat, bool insens); | ||
44 | ~CRegExpFilt(); | ||
45 | bool addch(tchar); | ||
46 | void restart(); | ||
47 | unsigned int matchlength() | ||
48 | { return patlength; } | ||
49 | bool empty(); | ||
50 | tchar pop(); | ||
51 | }; | ||
diff --git a/noncore/apps/opie-reader/CloseDialog.cpp b/noncore/apps/opie-reader/CloseDialog.cpp index d7c2652..741fa67 100644 --- a/noncore/apps/opie-reader/CloseDialog.cpp +++ b/noncore/apps/opie-reader/CloseDialog.cpp | |||
@@ -1,9 +1,7 @@ | |||
1 | #include "CloseDialog.h" | 1 | #include "CloseDialog.h" |
2 | #include "qlayout.h" | 2 | #include "qlayout.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | ||
5 | |||
6 | CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) | 4 | CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) |
7 | { | 5 | { |
8 | setCaption(tr("Tidy-up")); | 6 | setCaption(tr("Tidy-up")); |
9 | QVBoxLayout *tmp = new QVBoxLayout(this); | 7 | QVBoxLayout *tmp = new QVBoxLayout(this); |
@@ -15,7 +13,6 @@ CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const | |||
15 | config = new QCheckBox(tr("Delete Configuration"), vb); | 13 | config = new QCheckBox(tr("Delete Configuration"), vb); |
16 | file->setChecked(false); | 14 | file->setChecked(false); |
17 | marks->setChecked(true); | 15 | marks->setChecked(true); |
18 | config->setChecked(true); | 16 | config->setChecked(true); |
19 | if (fs) | 17 | if (fs) showMaximized(); |
20 | QPEApplication::showDialog( this ); | ||
21 | } | 18 | } |
diff --git a/noncore/apps/opie-reader/Filedata.h b/noncore/apps/opie-reader/Filedata.h index 1b85b71..096dd31 100644 --- a/noncore/apps/opie-reader/Filedata.h +++ b/noncore/apps/opie-reader/Filedata.h | |||
@@ -8,44 +8,44 @@ class CFiledata | |||
8 | unsigned char* data; | 8 | unsigned char* data; |
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 | // odebug << "~Filedata: deleting" << oendl; | 29 | // qDebug("~Filedata: deleting"); |
30 | } | 30 | } |
31 | else | 31 | else |
32 | { | 32 | { |
33 | // odebug << "~Filedata: not deleting" << oendl; | 33 | // qDebug("~Filedata: not deleting"); |
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.cpp b/noncore/apps/opie-reader/FontControl.cpp index cfa8534..d082898 100644 --- a/noncore/apps/opie-reader/FontControl.cpp +++ b/noncore/apps/opie-reader/FontControl.cpp | |||
@@ -1,26 +1,36 @@ | |||
1 | #include <qfontdatabase.h> | ||
2 | #include "opie.h" | ||
3 | #include "useqpe.h" | ||
1 | #include "FontControl.h" | 4 | #include "FontControl.h" |
2 | 5 | ||
3 | int FontControl::gzoom() | 6 | int FontControl::gzoom() |
4 | { | 7 | { |
5 | int ret; | 8 | if (m_fixgraphics) |
6 | if (m_size == g_size) | ||
7 | { | 9 | { |
8 | ret = m_fontsizes[m_size]*m_basesize; | 10 | return 100; |
9 | } | 11 | } |
10 | else if (g_size < 0) | 12 | else |
11 | { | 13 | { |
12 | int f = -g_size; | 14 | int ret; |
13 | ret = (m_fontsizes[0]*m_basesize) >> (f/2); | 15 | if (m_size == g_size) |
14 | if (f%2) ret = (2*ret/3); | 16 | { |
15 | } | 17 | ret = m_fontsizes[m_size]*m_basesize; |
16 | else | 18 | } |
17 | { | 19 | else if (g_size < 0) |
18 | int f = g_size - m_maxsize + 1; | 20 | { |
19 | ret = (m_fontsizes[m_maxsize-1]*m_basesize) << (f/2); | 21 | int f = -g_size; |
20 | if (f%2) ret = (3*ret/2); | 22 | ret = (m_fontsizes[0]*m_basesize) >> (f/2); |
23 | if (f%2) ret = (2*ret/3); | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | int f = g_size - m_maxsize + 1; | ||
28 | ret = (m_fontsizes[m_maxsize-1]*m_basesize) << (f/2); | ||
29 | if (f%2) ret = (3*ret/2); | ||
30 | } | ||
31 | return ret; | ||
21 | } | 32 | } |
22 | return ret; | ||
23 | } | 33 | } |
24 | 34 | ||
25 | bool FontControl::ChangeFont(QString& n, int tgt) | 35 | bool FontControl::ChangeFont(QString& n, int tgt) |
26 | { | 36 | { |
diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h index e56b619..90d39b2 100644 --- a/noncore/apps/opie-reader/FontControl.h +++ b/noncore/apps/opie-reader/FontControl.h | |||
@@ -1,8 +1,7 @@ | |||
1 | #ifndef __FONTCONTROL_H | 1 | #ifndef __FONTCONTROL_H |
2 | #define __FONTCONTROL_H | 2 | #define __FONTCONTROL_H |
3 | 3 | ||
4 | #include <qfontdatabase.h> | ||
5 | #include <qfontmetrics.h> | 4 | #include <qfontmetrics.h> |
6 | #include "StyleConsts.h" | 5 | #include "StyleConsts.h" |
7 | 6 | ||
8 | class FontControl | 7 | class FontControl |
@@ -14,140 +13,160 @@ class FontControl | |||
14 | int m_maxsize; | 13 | int m_maxsize; |
15 | bool m_hasCourier; | 14 | bool m_hasCourier; |
16 | int m_leading, m_extraspace; | 15 | int m_leading, m_extraspace; |
17 | unsigned char m_basesize; | 16 | unsigned char m_basesize; |
17 | bool m_fixgraphics; | ||
18 | public: | 18 | public: |
19 | void FixGraphics(bool _b) | ||
20 | { | ||
21 | m_fixgraphics = _b; | ||
22 | } | ||
23 | bool FixGraphics() | ||
24 | { | ||
25 | return m_fixgraphics; | ||
26 | } | ||
19 | void setBaseSize(unsigned char _s) { m_basesize = _s; } | 27 | void setBaseSize(unsigned char _s) { m_basesize = _s; } |
20 | unsigned char getBaseSize() { return m_basesize; } | 28 | unsigned char getBaseSize() { return m_basesize; } |
21 | int gzoom(); | 29 | int gzoom(); |
22 | FontControl(QString n = "helvetica", int size = 10) | 30 | FontControl(QString n = "helvetica", int size = 10) |
23 | : | 31 | : |
24 | m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) | 32 | m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0), m_fixgraphics(true) |
25 | { | 33 | { |
26 | ChangeFont(n, size); | 34 | ChangeFont(n, size); |
27 | } | 35 | } |
28 | ~FontControl() | 36 | ~FontControl() |
29 | { | 37 | { |
30 | if (m_fontsizes != NULL) delete [] m_fontsizes; | 38 | if (m_fontsizes != NULL) delete [] m_fontsizes; |
31 | } | 39 | } |
32 | void hasCourier(bool _b, const QString& _nm) | 40 | void hasCourier(bool _b, const QString& _nm) |
33 | { | 41 | { |
34 | m_hasCourier = _b; | 42 | m_hasCourier = _b; |
35 | m_fixedfontname = _nm; | 43 | m_fixedfontname = _nm; |
36 | } | 44 | } |
37 | QString& fixedfontname() { return m_fixedfontname; } | 45 | QString& fixedfontname() { return m_fixedfontname; } |
38 | bool hasCourier() { return m_hasCourier; } | 46 | bool hasCourier() { return m_hasCourier; } |
39 | QString name() { return m_fontname; } | 47 | QString name() { return m_fontname; } |
40 | int currentsize() { return m_fontsizes[m_size]; } | 48 | int currentsize() { return (m_fontsizes == NULL) ? 0 : m_fontsizes[m_size]; } |
41 | int getsize(const CStyle& size) | 49 | int getsize(const CStyle& size) |
42 | { | 50 | { |
43 | int tgt = m_size+size.getFontSize(); | 51 | return getsize(size.getFontSize()); |
44 | if (tgt < 0) | 52 | } |
45 | { | 53 | int getsize(int _offset) |
46 | tgt = 0; | 54 | { |
47 | } | 55 | int tgt = m_size+_offset; |
48 | if (tgt >= m_maxsize) | 56 | if (tgt < 0) |
49 | { | 57 | { |
50 | tgt = m_maxsize - 1; | 58 | tgt = 0; |
51 | } | 59 | } |
52 | return m_fontsizes[tgt]; | 60 | if (tgt >= m_maxsize) |
53 | } | 61 | { |
62 | tgt = m_maxsize - 1; | ||
63 | } | ||
64 | return m_fontsizes[tgt]; | ||
65 | } | ||
54 | int ascent() | 66 | int ascent() |
55 | { | 67 | { |
56 | QFont f(name(), currentsize()); | 68 | QFont f(name(), currentsize()); |
57 | QFontMetrics fm(f); | 69 | QFontMetrics fm(f); |
58 | return fm.ascent(); | 70 | return fm.ascent(); |
59 | } | 71 | } |
60 | int ascent(const CStyle& ch) | 72 | int ascent(const CStyle& ch) |
61 | { | 73 | { |
62 | QFont f(name(), getsize(ch)); | 74 | QFont f(name(), getsize(ch)); |
63 | QFontMetrics fm(f); | 75 | QFontMetrics fm(f); |
64 | return fm.ascent(); | 76 | return fm.ascent(); |
65 | } | 77 | } |
66 | int descent() | 78 | int descent() |
67 | { | 79 | { |
68 | QFont f(name(), currentsize()); | 80 | QFont f(name(), currentsize()); |
69 | QFontMetrics fm(f); | 81 | QFontMetrics fm(f); |
70 | return fm.descent(); | 82 | return fm.descent(); |
71 | } | 83 | } |
72 | int descent(const CStyle& ch) | 84 | int descent(const CStyle& ch) |
73 | { | 85 | { |
74 | QFont f(name(), getsize(ch)); | 86 | QFont f(name(), getsize(ch)); |
75 | QFontMetrics fm(f); | 87 | QFontMetrics fm(f); |
76 | return fm.descent(); | 88 | return fm.descent(); |
77 | } | 89 | } |
78 | int lineSpacing() | 90 | int lineSpacing() |
79 | { | 91 | { |
80 | QFont f(name(), currentsize()); | 92 | QFont f(name(), currentsize()); |
81 | QFontMetrics fm(f); | 93 | QFontMetrics fm(f); |
82 | return fm.lineSpacing(); | 94 | return fm.lineSpacing(); |
83 | } | 95 | } |
84 | int lineSpacing(const CStyle& ch) | 96 | int lineSpacing(const CStyle& ch) |
85 | { | 97 | { |
86 | QFont f(name(), getsize(ch)); | 98 | QFont f(name(), getsize(ch)); |
87 | QFontMetrics fm(f); | 99 | QFontMetrics fm(f); |
88 | return fm.lineSpacing(); | 100 | return fm.lineSpacing(); |
89 | } | 101 | } |
90 | bool decreasesize() | 102 | bool decreasesize() |
91 | { | 103 | { |
92 | /* | 104 | if (m_fixgraphics) |
93 | if (--m_size < 0) | 105 | { |
94 | { | 106 | if (--m_size < 0) |
95 | m_size = 0; | 107 | { |
96 | return false; | 108 | m_size = 0; |
97 | } | 109 | return false; |
98 | else return true; | 110 | } |
99 | */ | 111 | g_size = m_size; |
100 | if (g_size-- == m_size) | 112 | } |
101 | { | 113 | else |
102 | if (--m_size < 0) | 114 | { |
103 | { | 115 | if (g_size-- == m_size) |
104 | m_size = 0; | 116 | { |
105 | } | 117 | if (--m_size < 0) |
106 | } | 118 | { |
107 | // odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; | 119 | m_size = 0; |
108 | return true; | 120 | } |
109 | } | 121 | } |
122 | } | ||
123 | // qDebug("Font:%d Graphics:%d", m_size, g_size); | ||
124 | return true; | ||
125 | } | ||
110 | bool increasesize() | 126 | bool increasesize() |
111 | { | 127 | { |
112 | /* | 128 | if (m_fixgraphics) |
113 | if (++m_size >= m_maxsize) | 129 | { |
114 | { | 130 | if (++m_size >= m_maxsize) |
115 | m_size = m_maxsize - 1; | 131 | { |
116 | return false; | 132 | m_size = m_maxsize - 1; |
117 | } | 133 | return false; |
118 | else return true; | 134 | } |
119 | */ | 135 | g_size = m_size; |
120 | if (g_size++ == m_size) | 136 | } |
121 | { | 137 | else |
122 | if (++m_size >= m_maxsize) | 138 | { |
123 | { | 139 | if (g_size++ == m_size) |
124 | m_size = m_maxsize - 1; | 140 | { |
125 | } | 141 | if (++m_size >= m_maxsize) |
126 | } | 142 | { |
127 | // odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; | 143 | m_size = m_maxsize - 1; |
128 | return true; | 144 | } |
129 | } | 145 | } |
146 | } | ||
147 | return true; | ||
148 | } | ||
130 | bool ChangeFont(QString& n) | 149 | bool ChangeFont(QString& n) |
131 | { | 150 | { |
132 | return ChangeFont(n, currentsize()); | 151 | return ChangeFont(n, currentsize()); |
133 | } | 152 | } |
134 | bool ChangeFont(QString& n, int tgt); | 153 | bool ChangeFont(QString& n, int tgt); |
135 | void setlead(int _lead) | 154 | void setlead(int _lead) |
136 | { | 155 | { |
137 | m_leading = _lead; | 156 | m_leading = _lead; |
138 | } | 157 | } |
139 | int getlead() | 158 | int getlead() |
140 | { | 159 | { |
141 | return m_leading; | 160 | return m_leading; |
142 | } | 161 | } |
143 | void setextraspace(int _lead) | 162 | void setextraspace(int _lead) |
144 | { | 163 | { |
145 | m_extraspace = _lead; | 164 | m_extraspace = _lead; |
146 | } | 165 | } |
147 | int getextraspace() | 166 | int getextraspace() |
148 | { | 167 | { |
149 | return m_extraspace; | 168 | return m_extraspace; |
150 | } | 169 | } |
151 | }; | 170 | }; |
152 | 171 | ||
153 | #endif | 172 | #endif |
diff --git a/noncore/apps/opie-reader/GraphicWin.cpp b/noncore/apps/opie-reader/GraphicWin.cpp new file mode 100644 index 0000000..df069c4 --- a/dev/null +++ b/noncore/apps/opie-reader/GraphicWin.cpp | |||
@@ -0,0 +1,122 @@ | |||
1 | |||
2 | #include "GraphicWin.h" | ||
3 | |||
4 | GraphicWin::GraphicWin( QWidget *parent, const char *name, WFlags f) | ||
5 | : QWidget(parent, name, f), m_isFitted(false), m_isRotated(false) | ||
6 | { | ||
7 | QVBoxLayout* grid = new QVBoxLayout(this); | ||
8 | m_scroll = new GraphicScroll(this); | ||
9 | grid->addWidget(m_scroll,1); | ||
10 | QHBoxLayout* b = new QHBoxLayout(grid); | ||
11 | |||
12 | QPushButton* fitButton = new QPushButton("Rotated", this); | ||
13 | connect(fitButton, SIGNAL( clicked() ), this, SLOT( slotRotate() ) ); | ||
14 | b->addWidget(fitButton); | ||
15 | |||
16 | fitButton = new QPushButton("Fitted", this); | ||
17 | connect(fitButton, SIGNAL( clicked() ), this, SLOT( slotFit() ) ); | ||
18 | b->addWidget(fitButton); | ||
19 | |||
20 | fitButton = new QPushButton("Close", this); | ||
21 | connect(fitButton, SIGNAL( clicked() ), this, SLOT( slotClosed() ) ); | ||
22 | b->addWidget(fitButton); | ||
23 | } | ||
24 | |||
25 | void GraphicWin::setImage(QImage& im) | ||
26 | { | ||
27 | m_isRotated = m_isFitted = false; | ||
28 | m_im = im; | ||
29 | resetpm(); | ||
30 | } | ||
31 | |||
32 | QImage GraphicWin::resizeimage(int w, int h) | ||
33 | { | ||
34 | if (w*m_im.height() < h*m_im.width()) | ||
35 | { | ||
36 | h = (m_im.height()*w + m_im.width()/2)/m_im.width(); | ||
37 | } | ||
38 | else | ||
39 | { | ||
40 | w = (m_im.width()*h + m_im.height()/2)/m_im.height(); | ||
41 | } | ||
42 | return m_im.smoothScale(w,h); | ||
43 | } | ||
44 | |||
45 | void GraphicWin::slotFit() | ||
46 | { | ||
47 | m_isFitted = !m_isFitted; | ||
48 | resetpm(); | ||
49 | } | ||
50 | |||
51 | void GraphicWin::slotRotate() | ||
52 | { | ||
53 | m_isRotated = !m_isRotated; | ||
54 | resetpm(); | ||
55 | } | ||
56 | |||
57 | void GraphicWin::resetpm() | ||
58 | { | ||
59 | QImage im; | ||
60 | if (m_isFitted) | ||
61 | { | ||
62 | int w, h; | ||
63 | if (m_isRotated) | ||
64 | { | ||
65 | w = m_scroll->height()-5; | ||
66 | h = m_scroll->width()-5; | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | w = m_scroll->width()-5; | ||
71 | h = m_scroll->height()-5; | ||
72 | } | ||
73 | im = resizeimage(w, h); | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | im = m_im; | ||
78 | } | ||
79 | QPixmap pc; | ||
80 | if (m_isRotated) | ||
81 | { | ||
82 | QWMatrix m; | ||
83 | m.rotate(90); | ||
84 | QPixmap pc1; | ||
85 | pc1.convertFromImage(im); | ||
86 | pc = pc1.xForm(m); | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | pc.convertFromImage(im); | ||
91 | } | ||
92 | m_scroll->setPixmap(pc); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | Something like this should work...but doesn't quite | ||
97 | smoothscale is better anyway. | ||
98 | |||
99 | void GraphicWin::resetpm() | ||
100 | { | ||
101 | QWMatrix m; | ||
102 | if (m_isRotated) | ||
103 | { | ||
104 | m.rotate(90); | ||
105 | } | ||
106 | if (m_isFitted) | ||
107 | { | ||
108 | double sw = (width()-5.0)/(m_isRotated ? m_im.height() : m_im.width()); | ||
109 | double sh = (height()-5.0)/(m_isRotated ? m_im.width() : m_im.height()); | ||
110 | if (sw < sh) | ||
111 | { | ||
112 | m.scale(sw, sw); | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | m.scale(sh, sh); | ||
117 | } | ||
118 | } | ||
119 | QPixmap pc = m_im.xForm(m); | ||
120 | m_scroll->setPixmap(pc); | ||
121 | } | ||
122 | */ | ||
diff --git a/noncore/apps/opie-reader/GraphicWin.h b/noncore/apps/opie-reader/GraphicWin.h index 31811d2..70d5f7e 100644 --- a/noncore/apps/opie-reader/GraphicWin.h +++ b/noncore/apps/opie-reader/GraphicWin.h | |||
@@ -2,64 +2,55 @@ | |||
2 | #define __GRAPHICWIN_H | 2 | #define __GRAPHICWIN_H |
3 | 3 | ||
4 | #include <qscrollview.h> | 4 | #include <qscrollview.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qimage.h> | ||
6 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
7 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qwmatrix.h> | ||
8 | 10 | ||
9 | class GraphicScroll : public QScrollView | 11 | class GraphicScroll : public QScrollView |
10 | { | 12 | { |
11 | Q_OBJECT | 13 | Q_OBJECT |
12 | QWidget* m_picture; | 14 | QWidget* m_picture; |
13 | protected: | 15 | protected: |
14 | void hideEvent( QHideEvent * p) | 16 | void hideEvent( QHideEvent * p) |
15 | { | 17 | { |
16 | m_picture->setFixedSize(1,1); | 18 | m_picture->setFixedSize(1,1); |
17 | } | 19 | } |
18 | public: | 20 | public: |
19 | GraphicScroll( QWidget *parent=0, const char *name=0, WFlags f = 0) | 21 | GraphicScroll( QWidget *parent=0, const char *name=0, WFlags f = 0) |
20 | : QScrollView(parent, name, f) | 22 | : QScrollView(parent, name, f) |
21 | { | 23 | { |
22 | m_picture = new QWidget(viewport()); | 24 | m_picture = new QWidget(viewport()); |
23 | addChild(m_picture); | 25 | addChild(m_picture); |
24 | } | 26 | } |
25 | void setPixmap(QPixmap& pm) | 27 | void setPixmap(QPixmap& pm) |
26 | { | 28 | { |
27 | m_picture->setFixedSize(pm.size()); | 29 | m_picture->setFixedSize(pm.size()); |
28 | m_picture->setBackgroundPixmap(pm); | 30 | m_picture->setBackgroundPixmap(pm); |
29 | } | 31 | } |
30 | /* | ||
31 | private slots: | ||
32 | void graphicClose() { emit Close(); } | ||
33 | signals: | ||
34 | void Close(); | ||
35 | */ | ||
36 | |||
37 | }; | 32 | }; |
38 | 33 | ||
39 | 34 | ||
40 | class GraphicWin : public QWidget | 35 | class GraphicWin : public QWidget |
41 | { | 36 | { |
42 | Q_OBJECT | 37 | Q_OBJECT |
43 | 38 | ||
44 | GraphicScroll* m_scroll; | 39 | GraphicScroll* m_scroll; |
45 | signals: | 40 | QImage m_im; |
46 | void Closed(); | 41 | QImage resizeimage(int w, int h); |
47 | private slots: | 42 | void resetpm(); |
48 | void slotClosed() { emit Closed(); } | 43 | bool m_isFitted, m_isRotated; |
49 | 44 | signals: | |
50 | public: | 45 | void Closed(); |
51 | 46 | private slots: | |
52 | void setPixmap(QPixmap& pm) { m_scroll->setPixmap(pm); } | 47 | void slotClosed() { emit Closed(); } |
53 | GraphicWin( QWidget *parent=0, const char *name=0, WFlags f = 0) | 48 | void slotFit(); |
54 | : QWidget(parent, name, f) | 49 | void slotRotate(); |
55 | { | 50 | public: |
56 | QVBoxLayout* grid = new QVBoxLayout(this); | 51 | void setPixmap(QPixmap& pm) { m_scroll->setPixmap(pm); } |
57 | m_scroll = new GraphicScroll(this); | 52 | void setImage(QImage& im); |
58 | QPushButton* exitButton = new QPushButton("Close", this); | 53 | GraphicWin( QWidget *parent=0, const char *name=0, WFlags f = 0); |
59 | connect(exitButton, SIGNAL( released() ), this, SLOT( slotClosed() ) ); | ||
60 | grid->addWidget(m_scroll,1); | ||
61 | grid->addWidget(exitButton); | ||
62 | } | ||
63 | }; | 54 | }; |
64 | 55 | ||
65 | #endif | 56 | #endif |
diff --git a/noncore/apps/opie-reader/HTMLFilter.mak b/noncore/apps/opie-reader/HTMLFilter.mak new file mode 100644 index 0000000..e1a2125 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter.mak | |||
@@ -0,0 +1,170 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libHTMLfilter.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:38:47 2004 | ||
4 | # Project: HTMLFilter.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o HTMLFilter.mak HTMLFilter.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libHTMLfilter.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = CFilter.h | ||
47 | SOURCES = striphtml.cpp | ||
48 | OBJECTS = QREADEROBJS/striphtml.o | ||
49 | FORMS = | ||
50 | UICDECLS = | ||
51 | UICIMPLS = | ||
52 | SRCMOC = | ||
53 | OBJMOC = | ||
54 | DIST = HTMLFilter.pro | ||
55 | QMAKE_TARGET = HTMLfilter | ||
56 | DESTDIR = $(READERDIR)/filters/ | ||
57 | TARGET = libHTMLfilter.so.1.0.0 | ||
58 | TARGETA= $(READERDIR)/filters/libHTMLfilter.a | ||
59 | TARGETD= libHTMLfilter.so.1.0.0 | ||
60 | TARGET0= libHTMLfilter.so | ||
61 | TARGET1= libHTMLfilter.so.1 | ||
62 | TARGET2= libHTMLfilter.so.1.0 | ||
63 | |||
64 | first: all | ||
65 | ####### Implicit rules | ||
66 | |||
67 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
68 | |||
69 | .cpp.o: | ||
70 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
71 | |||
72 | .cc.o: | ||
73 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
74 | |||
75 | .cxx.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .C.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .c.o: | ||
82 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | ####### Build rules | ||
85 | |||
86 | all: HTMLFilter.mak $(READERDIR)/filters/$(TARGET) | ||
87 | |||
88 | $(READERDIR)/filters/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
89 | test -d $(READERDIR)/filters/ || mkdir -p $(READERDIR)/filters/ | ||
90 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
91 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
92 | -ln -s $(TARGET) $(TARGET0) | ||
93 | -ln -s $(TARGET) $(TARGET1) | ||
94 | -ln -s $(TARGET) $(TARGET2) | ||
95 | -$(DEL_FILE) $(READERDIR)/filters/$(TARGET) | ||
96 | -$(DEL_FILE) $(READERDIR)/filters/$(TARGET0) | ||
97 | -$(DEL_FILE) $(READERDIR)/filters/$(TARGET1) | ||
98 | -$(DEL_FILE) $(READERDIR)/filters/$(TARGET2) | ||
99 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/filters/ | ||
100 | |||
101 | |||
102 | |||
103 | staticlib: $(TARGETA) | ||
104 | |||
105 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
106 | -$(DEL_FILE) $(TARGETA) | ||
107 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
108 | |||
109 | mocables: $(SRCMOC) | ||
110 | uicables: $(UICDECLS) $(UICIMPLS) | ||
111 | |||
112 | $(MOC): | ||
113 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
114 | |||
115 | HTMLFilter.mak: HTMLFilter.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
116 | $(QMAKE) -o HTMLFilter.mak HTMLFilter.pro | ||
117 | qmake: | ||
118 | @$(QMAKE) -o HTMLFilter.mak HTMLFilter.pro | ||
119 | |||
120 | dist: | ||
121 | @mkdir -p QREADEROBJS/HTMLfilter && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/HTMLfilter/ && ( cd `dirname QREADEROBJS/HTMLfilter` && $(TAR) HTMLfilter.tar HTMLfilter && $(GZIP) HTMLfilter.tar ) && $(MOVE) `dirname QREADEROBJS/HTMLfilter`/HTMLfilter.tar.gz . && $(DEL_FILE) -r QREADEROBJS/HTMLfilter | ||
122 | |||
123 | mocclean: | ||
124 | |||
125 | uiclean: | ||
126 | |||
127 | yaccclean: | ||
128 | lexclean: | ||
129 | clean: | ||
130 | -$(DEL_FILE) $(OBJECTS) | ||
131 | -$(DEL_FILE) *~ core *.core | ||
132 | |||
133 | |||
134 | ####### Sub-libraries | ||
135 | |||
136 | distclean: clean | ||
137 | -$(DEL_FILE) $(READERDIR)/filters/$(TARGET) $(TARGET) | ||
138 | -$(DEL_FILE) $(READERDIR)/filters/$(TARGET0) $(READERDIR)/filters/$(TARGET1) $(READERDIR)/filters/$(TARGET2) $(TARGETA) | ||
139 | |||
140 | |||
141 | FORCE: | ||
142 | |||
143 | ####### Compile | ||
144 | |||
145 | QREADEROBJS/striphtml.o: striphtml.cpp QREADERINC/useqpe.h \ | ||
146 | CDrawBuffer.h \ | ||
147 | striphtml.h \ | ||
148 | hrule.h \ | ||
149 | StyleConsts.h \ | ||
150 | CBuffer.h \ | ||
151 | my_list.h \ | ||
152 | linktype.h \ | ||
153 | config.h \ | ||
154 | ustring.h \ | ||
155 | CFilter.h \ | ||
156 | Navigation.h \ | ||
157 | CExpander.h \ | ||
158 | CEncoding.h \ | ||
159 | QREADERINC/static.h \ | ||
160 | Markups.h \ | ||
161 | names.h \ | ||
162 | CEncoding_tables.h | ||
163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/striphtml.o striphtml.cpp | ||
164 | |||
165 | ####### Install | ||
166 | |||
167 | install: all | ||
168 | |||
169 | uninstall: | ||
170 | |||
diff --git a/noncore/apps/opie-reader/HTMLFilter.omak b/noncore/apps/opie-reader/HTMLFilter.omak new file mode 100644 index 0000000..1ab671f --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter.omak | |||
@@ -0,0 +1,131 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libHTMLfilter.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: HTMLFilter.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libHTMLfilter.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =CFilter.h | ||
29 | SOURCES =striphtml.cpp | ||
30 | OBJECTS =OREADEROBJS/striphtml.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libHTMLfilter.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/filters/libHTMLfilter.a | ||
39 | TARGETD =libHTMLfilter.so.1.0.0 | ||
40 | TARGET0 =libHTMLfilter.so | ||
41 | TARGET1 =libHTMLfilter.so.1 | ||
42 | TARGET2 =libHTMLfilter.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/filters/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: HTMLFilter.omak | ||
90 | |||
91 | HTMLFilter.omak: HTMLFilter.opro | ||
92 | tmake HTMLFilter.opro -o HTMLFilter.omak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) HTMLFilter.opro.tar HTMLFilter.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) HTMLFilter.opro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | OREADEROBJS/striphtml.o: striphtml.cpp \ | ||
112 | OREADERINC/useqpe.h \ | ||
113 | CDrawBuffer.h \ | ||
114 | StyleConsts.h \ | ||
115 | CBuffer.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | my_list.h \ | ||
119 | linktype.h \ | ||
120 | striphtml.h \ | ||
121 | CFilter.h \ | ||
122 | CExpander.h \ | ||
123 | Markups.h \ | ||
124 | names.h \ | ||
125 | CEncoding.h \ | ||
126 | CEncoding_tables.h \ | ||
127 | OREADERINC/static.h \ | ||
128 | Navigation.h \ | ||
129 | hrule.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/striphtml.o striphtml.cpp | ||
131 | |||
diff --git a/noncore/apps/opie-reader/HTMLFilter.wmak b/noncore/apps/opie-reader/HTMLFilter.wmak new file mode 100644 index 0000000..485bb21 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter.wmak | |||
@@ -0,0 +1,131 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libHTMLfilter.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: HTMLFilter.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libHTMLfilter.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =CFilter.h | ||
29 | SOURCES =striphtml.cpp | ||
30 | OBJECTS =WSREADEROBJS/striphtml.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libHTMLfilter.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/filters/libHTMLfilter.a | ||
39 | TARGETD =libHTMLfilter.so.1.0.0 | ||
40 | TARGET0 =libHTMLfilter.so | ||
41 | TARGET1 =libHTMLfilter.so.1 | ||
42 | TARGET2 =libHTMLfilter.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/filters/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: HTMLFilter.wmak | ||
90 | |||
91 | HTMLFilter.wmak: HTMLFilter.wpro | ||
92 | tmake HTMLFilter.wpro -o HTMLFilter.wmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) HTMLFilter.wpro.tar HTMLFilter.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) HTMLFilter.wpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | WSREADEROBJS/striphtml.o: striphtml.cpp \ | ||
112 | WSREADERINC/useqpe.h \ | ||
113 | CDrawBuffer.h \ | ||
114 | StyleConsts.h \ | ||
115 | CBuffer.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | my_list.h \ | ||
119 | linktype.h \ | ||
120 | striphtml.h \ | ||
121 | CFilter.h \ | ||
122 | CExpander.h \ | ||
123 | Markups.h \ | ||
124 | names.h \ | ||
125 | CEncoding.h \ | ||
126 | CEncoding_tables.h \ | ||
127 | WSREADERINC/static.h \ | ||
128 | Navigation.h \ | ||
129 | hrule.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/striphtml.o striphtml.cpp | ||
131 | |||
diff --git a/noncore/apps/opie-reader/HTMLFilter.wpro b/noncore/apps/opie-reader/HTMLFilter.wpro new file mode 100644 index 0000000..e0425b4 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter.wpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = CFilter.h | ||
4 | |||
5 | SOURCES = striphtml.cpp | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/filters | ||
10 | TARGET = HTMLfilter | ||
11 | |||
12 | |||
13 | |||
14 | OBJECTS_DIR = WSREADEROBJS | ||
15 | MOC_DIR = WSREADERMOCS | ||
16 | INCLUDEPATH+= WSREADERINC | ||
17 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/HTMLFilter.zmak b/noncore/apps/opie-reader/HTMLFilter.zmak new file mode 100644 index 0000000..d1af765 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter.zmak | |||
@@ -0,0 +1,131 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libHTMLfilter.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: HTMLFilter.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libHTMLfilter.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =CFilter.h | ||
29 | SOURCES =striphtml.cpp | ||
30 | OBJECTS =ZREADEROBJS/striphtml.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libHTMLfilter.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/filters/libHTMLfilter.a | ||
39 | TARGETD =libHTMLfilter.so.1.0.0 | ||
40 | TARGET0 =libHTMLfilter.so | ||
41 | TARGET1 =libHTMLfilter.so.1 | ||
42 | TARGET2 =libHTMLfilter.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/filters/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: HTMLFilter.zmak | ||
90 | |||
91 | HTMLFilter.zmak: HTMLFilter.zpro | ||
92 | tmake HTMLFilter.zpro -o HTMLFilter.zmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) HTMLFilter.zpro.tar HTMLFilter.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) HTMLFilter.zpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | ZREADEROBJS/striphtml.o: striphtml.cpp \ | ||
112 | ZREADERINC/useqpe.h \ | ||
113 | CDrawBuffer.h \ | ||
114 | StyleConsts.h \ | ||
115 | CBuffer.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | my_list.h \ | ||
119 | linktype.h \ | ||
120 | striphtml.h \ | ||
121 | CFilter.h \ | ||
122 | CExpander.h \ | ||
123 | Markups.h \ | ||
124 | names.h \ | ||
125 | CEncoding.h \ | ||
126 | CEncoding_tables.h \ | ||
127 | ZREADERINC/static.h \ | ||
128 | Navigation.h \ | ||
129 | hrule.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/striphtml.o striphtml.cpp | ||
131 | |||
diff --git a/noncore/apps/opie-reader/HTMLFilter.zpro b/noncore/apps/opie-reader/HTMLFilter.zpro new file mode 100644 index 0000000..ba570b1 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter.zpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = CFilter.h | ||
4 | |||
5 | SOURCES = striphtml.cpp | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/filters | ||
10 | TARGET = HTMLfilter | ||
11 | |||
12 | |||
13 | |||
14 | OBJECTS_DIR = ZREADEROBJS | ||
15 | MOC_DIR = ZREADERMOCS | ||
16 | INCLUDEPATH+= ZREADERINC | ||
17 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/HTMLFilter/.cvsignore b/noncore/apps/opie-reader/HTMLFilter/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/HTMLFilter/HTMLFilter.pro b/noncore/apps/opie-reader/HTMLFilter/HTMLFilter.pro new file mode 100644 index 0000000..cc049a9 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLFilter/HTMLFilter.pro | |||
@@ -0,0 +1,20 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = CFilter.h \ | ||
6 | util.h | ||
7 | |||
8 | SOURCES = striphtml.cpp | ||
9 | |||
10 | # copy data file to install directory | ||
11 | QMAKE_PRE_LINK = mkdir -p $(OPIEDIR)/plugins/reader/data && cp ../HTMLentities $(OPIEDIR)/plugins/reader/data/HTMLentities | ||
12 | |||
13 | INTERFACES= | ||
14 | DESTDIR = $(OPIEDIR)/plugins/reader/filters | ||
15 | TARGET = HTMLfilter | ||
16 | |||
17 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
18 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
19 | |||
20 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/HTMLentities b/noncore/apps/opie-reader/HTMLentities new file mode 100644 index 0000000..f1a95a1 --- a/dev/null +++ b/noncore/apps/opie-reader/HTMLentities | |||
@@ -0,0 +1,252 @@ | |||
1 | nbsp:160 | ||
2 | iexcl:161 | ||
3 | cent:162 | ||
4 | pound:163 | ||
5 | curren:164 | ||
6 | yen:165 | ||
7 | brvbar:166 | ||
8 | sect:167 | ||
9 | uml:168 | ||
10 | copy:169 | ||
11 | ordf:170 | ||
12 | laquo:171 | ||
13 | not:172 | ||
14 | shy:173 | ||
15 | reg:174 | ||
16 | macr:175 | ||
17 | deg:176 | ||
18 | plusmn:177 | ||
19 | sup2:178 | ||
20 | sup3:179 | ||
21 | acute:180 | ||
22 | micro:181 | ||
23 | para:182 | ||
24 | middot:183 | ||
25 | cedil:184 | ||
26 | sup1:185 | ||
27 | ordm:186 | ||
28 | raquo:187 | ||
29 | frac14:188 | ||
30 | frac12:189 | ||
31 | frac34:190 | ||
32 | iquest:191 | ||
33 | Agrave:192 | ||
34 | Aacute:193 | ||
35 | Acirc:194 | ||
36 | Atilde:195 | ||
37 | Auml:196 | ||
38 | Aring:197 | ||
39 | AElig:198 | ||
40 | Ccedil:199 | ||
41 | Egrave:200 | ||
42 | Eacute:201 | ||
43 | Ecirc:202 | ||
44 | Euml:203 | ||
45 | Igrave:204 | ||
46 | Iacute:205 | ||
47 | Icirc:206 | ||
48 | Iuml:207 | ||
49 | ETH:208 | ||
50 | Ntilde:209 | ||
51 | Ograve:210 | ||
52 | Oacute:211 | ||
53 | Ocirc:212 | ||
54 | Otilde:213 | ||
55 | Ouml:214 | ||
56 | times:215 | ||
57 | Oslash:216 | ||
58 | Ugrave:217 | ||
59 | Uacute:218 | ||
60 | Ucirc:219 | ||
61 | Uuml:220 | ||
62 | Yacute:221 | ||
63 | THORN:222 | ||
64 | szlig:223 | ||
65 | agrave:224 | ||
66 | aacute:225 | ||
67 | acirc:226 | ||
68 | atilde:227 | ||
69 | auml:228 | ||
70 | aring:229 | ||
71 | aelig:230 | ||
72 | ccedil:231 | ||
73 | egrave:232 | ||
74 | eacute:233 | ||
75 | ecirc:234 | ||
76 | euml:235 | ||
77 | igrave:236 | ||
78 | iacute:237 | ||
79 | icirc:238 | ||
80 | iuml:239 | ||
81 | eth:240 | ||
82 | ntilde:241 | ||
83 | ograve:242 | ||
84 | oacute:243 | ||
85 | ocirc:244 | ||
86 | otilde:245 | ||
87 | ouml:246 | ||
88 | divide:247 | ||
89 | oslash:248 | ||
90 | ugrave:249 | ||
91 | uacute:250 | ||
92 | ucirc:251 | ||
93 | uuml:252 | ||
94 | yacute:253 | ||
95 | thorn:254 | ||
96 | yuml:255 | ||
97 | fnof:402 | ||
98 | Alpha:913 | ||
99 | Beta:914 | ||
100 | Gamma:915 | ||
101 | Delta:916 | ||
102 | Epsilon:917 | ||
103 | Zeta:918 | ||
104 | Eta:919 | ||
105 | Theta:920 | ||
106 | Iota:921 | ||
107 | Kappa:922 | ||
108 | Lambda:923 | ||
109 | Mu:924 | ||
110 | Nu:925 | ||
111 | Xi:926 | ||
112 | Omicron:927 | ||
113 | Pi:928 | ||
114 | Rho:929 | ||
115 | Sigma:931 | ||
116 | Tau:932 | ||
117 | Upsilon:933 | ||
118 | Phi:934 | ||
119 | Chi:935 | ||
120 | Psi:936 | ||
121 | Omega:937 | ||
122 | alpha:945 | ||
123 | beta:946 | ||
124 | gamma:947 | ||
125 | delta:948 | ||
126 | epsilon:949 | ||
127 | zeta:950 | ||
128 | eta:951 | ||
129 | theta:952 | ||
130 | iota:953 | ||
131 | kappa:954 | ||
132 | lambda:955 | ||
133 | mu:956 | ||
134 | nu:957 | ||
135 | xi:958 | ||
136 | omicron:959 | ||
137 | pi:960 | ||
138 | rho:961 | ||
139 | sigmaf:962 | ||
140 | sigma:963 | ||
141 | tau:964 | ||
142 | upsilon:965 | ||
143 | phi:966 | ||
144 | chi:967 | ||
145 | psi:968 | ||
146 | omega:969 | ||
147 | thetasym:977 | ||
148 | upsih:978 | ||
149 | piv:982 | ||
150 | bull:8226 | ||
151 | hellip:8230 | ||
152 | prime:8242 | ||
153 | Prime:8243 | ||
154 | oline:8254 | ||
155 | frasl:8260 | ||
156 | weierp:8472 | ||
157 | image:8465 | ||
158 | real:8476 | ||
159 | trade:8482 | ||
160 | alefsym:8501 | ||
161 | larr:8592 | ||
162 | uarr:8593 | ||
163 | rarr:8594 | ||
164 | darr:8595 | ||
165 | harr:8596 | ||
166 | crarr:8629 | ||
167 | lArr:8656 | ||
168 | uArr:8657 | ||
169 | rArr:8658 | ||
170 | dArr:8659 | ||
171 | hArr:8660 | ||
172 | forall:8704 | ||
173 | part:8706 | ||
174 | exist:8707 | ||
175 | empty:8709 | ||
176 | nabla:8711 | ||
177 | isin:8712 | ||
178 | notin:8713 | ||
179 | ni:8715 | ||
180 | prod:8719 | ||
181 | sum:8721 | ||
182 | minus:8722 | ||
183 | lowast:8727 | ||
184 | radic:8730 | ||
185 | prop:8733 | ||
186 | infin:8734 | ||
187 | ang:8736 | ||
188 | and:8743 | ||
189 | or:8744 | ||
190 | cap:8745 | ||
191 | cup:8746 | ||
192 | int:8747 | ||
193 | there4:8756 | ||
194 | sim:8764 | ||
195 | cong:8773 | ||
196 | asymp:8776 | ||
197 | ne:8800 | ||
198 | equiv:8801 | ||
199 | le:8804 | ||
200 | ge:8805 | ||
201 | sub:8834 | ||
202 | sup:8835 | ||
203 | nsub:8836 | ||
204 | sube:8838 | ||
205 | supe:8839 | ||
206 | oplus:8853 | ||
207 | otimes:8855 | ||
208 | perp:8869 | ||
209 | sdot:8901 | ||
210 | lceil:8968 | ||
211 | rceil:8969 | ||
212 | lfloor:8970 | ||
213 | rfloor:8971 | ||
214 | lang:9001 | ||
215 | rang:9002 | ||
216 | loz:9674 | ||
217 | spades:9824 | ||
218 | clubs:9827 | ||
219 | hearts:9829 | ||
220 | diams:9830 | ||
221 | %:34 | ||
222 | amp:38 | ||
223 | lt:60 | ||
224 | gt:62 | ||
225 | OElig:338 | ||
226 | oelig:339 | ||
227 | Scaron:352 | ||
228 | scaron:353 | ||
229 | Yuml:376 | ||
230 | circ:710 | ||
231 | tilde:732 | ||
232 | ensp:8194 | ||
233 | emsp:8195 | ||
234 | thinsp:8201 | ||
235 | zwnj:8204 | ||
236 | zwj:8205 | ||
237 | lrm:8206 | ||
238 | rlm:8207 | ||
239 | ndash:8211 | ||
240 | mdash:8212 | ||
241 | lsquo:8216 | ||
242 | rsquo:8217 | ||
243 | sbquo:8218 | ||
244 | ldquo:8220 | ||
245 | rdquo:8221 | ||
246 | bdquo:8222 | ||
247 | dagger:8224 | ||
248 | Dagger:8225 | ||
249 | permil:8240 | ||
250 | lsaquo:8249 | ||
251 | rsaquo:8250 | ||
252 | euro:8364 | ||
diff --git a/noncore/apps/opie-reader/Markups.h b/noncore/apps/opie-reader/Markups.h index 960489f..a0845b3 100644 --- a/noncore/apps/opie-reader/Markups.h +++ b/noncore/apps/opie-reader/Markups.h | |||
@@ -2,6 +2,7 @@ enum MarkupType | |||
2 | { | 2 | { |
3 | cNONE, | 3 | cNONE, |
4 | cTEXT, | 4 | cTEXT, |
5 | cHTML, | 5 | cHTML, |
6 | cPML | 6 | cPML, |
7 | cCHM | ||
7 | }; | 8 | }; |
diff --git a/noncore/apps/opie-reader/Navigation.cpp b/noncore/apps/opie-reader/Navigation.cpp index 36e33b4..a886d88 100644 --- a/noncore/apps/opie-reader/Navigation.cpp +++ b/noncore/apps/opie-reader/Navigation.cpp | |||
@@ -1,81 +1,8 @@ | |||
1 | #ifdef _WINDOWS | 1 | #ifdef _WINDOWS |
2 | #include <string.h> | 2 | #include <string.h> |
3 | #endif | 3 | #endif |
4 | #include "Navigation.h" | 4 | #include "Navigation.h" |
5 | //#include <stdio.h> | ||
6 | |||
7 | /* | ||
8 | void saveposn(size_t posn) | ||
9 | save/push position to history buffer for future use of back() function | ||
10 | */ | ||
11 | void CNavigation::saveposn(size_t posn) | ||
12 | { | ||
13 | //printf("saving position %u, depth %u\n",posn,historycurrent); | ||
14 | history[historycurrent] = posn; | ||
15 | historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE; | ||
16 | if (historycurrent==historystart) | ||
17 | // circular buffer full, forget oldest record | ||
18 | historystart=(historystart+1)%NAVIGATION_HISTORY_SIZE; | ||
19 | // no forward possible after saveposn | ||
20 | historyend = historycurrent; | ||
21 | } | ||
22 | |||
23 | /* | ||
24 | void writeposn(size_t posn) | ||
25 | overwrite current (unused) position | ||
26 | useful for saving current position before using back button | ||
27 | */ | ||
28 | void CNavigation::writeposn(size_t posn) | ||
29 | { | ||
30 | //printf("witing position %u, depth %u\n",posn,historycurrent); | ||
31 | history[historycurrent] = posn; | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | bool back(size_t& posn) | ||
36 | go back in history | ||
37 | restore last position saved with saveposn() and return true | ||
38 | return false if there is nothing saved in history | ||
39 | */ | ||
40 | bool CNavigation::back(size_t& posn) | ||
41 | { | ||
42 | if (historycurrent!=historystart) { | ||
43 | // buffer is not empty | ||
44 | if (historycurrent==0) | ||
45 | historycurrent=NAVIGATION_HISTORY_SIZE-1; | ||
46 | else | ||
47 | historycurrent--; | ||
48 | posn=history[historycurrent]; | ||
49 | //printf("back(): going back to %u depth %u\n",posn,historycurrent); | ||
50 | return true; | ||
51 | |||
52 | } else { | ||
53 | // circular buffer empty | ||
54 | //printf("back(): empty history\n"); | ||
55 | return false; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | bool forward(size_t& posn) | ||
61 | go forward in history, if possible | ||
62 | undo calling of back() | ||
63 | */ | ||
64 | bool CNavigation::forward(size_t& posn) | ||
65 | { | ||
66 | if (historycurrent!=historyend) { | ||
67 | // [historycurrent] = current position | ||
68 | // [historycurrent+1] = position we need | ||
69 | historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE; | ||
70 | posn = history[historycurrent]; | ||
71 | //printf("forward(): going to position %d\n",posn); | ||
72 | return true; | ||
73 | } else { | ||
74 | //printf("forward(): there is no future :)\n"); | ||
75 | return false; | ||
76 | } | ||
77 | } | ||
78 | 5 | ||
79 | void CNavigation::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 6 | void CNavigation::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
80 | { | 7 | { |
81 | len = srclen+sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE); | 8 | len = srclen+sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE); |
@@ -89,14 +16,8 @@ void CNavigation::setSaveData(unsigned char*& data, unsigned short& len, unsigne | |||
89 | p += sizeof(size_t); | 16 | p += sizeof(size_t); |
90 | memcpy(p, &historycurrent, sizeof(size_t)); | 17 | memcpy(p, &historycurrent, sizeof(size_t)); |
91 | p += sizeof(size_t); | 18 | p += sizeof(size_t); |
92 | memcpy(p, history, sizeof(size_t)*NAVIGATION_HISTORY_SIZE); | 19 | memcpy(p, history, sizeof(size_t)*NAVIGATION_HISTORY_SIZE); |
93 | /* | ||
94 | printf("<%u,%u,%u>\n", historystart, historyend, historycurrent); | ||
95 | for (int i = historystart; i <= historyend; i++) | ||
96 | printf("<%u> ", history[i]); | ||
97 | printf("\n"); | ||
98 | */ | ||
99 | } | 20 | } |
100 | 21 | ||
101 | void CNavigation::putSaveData(unsigned char*& src, unsigned short& srclen) | 22 | void CNavigation::putSaveData(unsigned char*& src, unsigned short& srclen) |
102 | { | 23 | { |
diff --git a/noncore/apps/opie-reader/Navigation.h b/noncore/apps/opie-reader/Navigation.h index 19d7f81..d88443b 100644 --- a/noncore/apps/opie-reader/Navigation.h +++ b/noncore/apps/opie-reader/Navigation.h | |||
@@ -1,18 +1,87 @@ | |||
1 | #ifndef __NAVIGATION_H | ||
2 | #define __NAVIGATION_H | ||
3 | |||
1 | #include <string.h> | 4 | #include <string.h> |
2 | #include <stdlib.h> | 5 | #include <stdlib.h> |
3 | 6 | ||
4 | const size_t NAVIGATION_HISTORY_SIZE = 32; | 7 | const size_t NAVIGATION_HISTORY_SIZE = 32; |
5 | 8 | ||
6 | class CNavigation | 9 | template<class T> |
10 | class CNavigation_base | ||
7 | { | 11 | { |
8 | size_t history[NAVIGATION_HISTORY_SIZE]; | 12 | protected: |
13 | T history[NAVIGATION_HISTORY_SIZE]; | ||
9 | size_t historystart, historyend, historycurrent; | 14 | size_t historystart, historyend, historycurrent; |
10 | public: | 15 | public: |
11 | CNavigation() : historystart(0),historyend(0),historycurrent(0) {} | 16 | CNavigation_base() : historystart(0),historyend(0),historycurrent(0) {} |
12 | void saveposn(size_t posn); | 17 | void saveposn(T posn); |
13 | void writeposn(size_t posn); | 18 | void writeposn(T posn); |
14 | bool forward(size_t& loc); | 19 | bool forward(T& loc); |
15 | bool back(size_t& loc); | 20 | bool back(T& loc); |
21 | }; | ||
22 | |||
23 | class CNavigation : public CNavigation_base<size_t> | ||
24 | { | ||
25 | public: | ||
16 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | 26 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); |
17 | void putSaveData(unsigned char*& src, unsigned short& srclen); | 27 | void putSaveData(unsigned char*& src, unsigned short& srclen); |
18 | }; | 28 | }; |
29 | |||
30 | template<class T> | ||
31 | inline void CNavigation_base<T>::saveposn(T posn) | ||
32 | { | ||
33 | history[historycurrent] = posn; | ||
34 | historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE; | ||
35 | if (historycurrent==historystart) | ||
36 | { | ||
37 | historystart=(historystart+1)%NAVIGATION_HISTORY_SIZE; | ||
38 | } | ||
39 | historyend = historycurrent; | ||
40 | } | ||
41 | |||
42 | template<class T> | ||
43 | inline void CNavigation_base<T>::writeposn(T posn) | ||
44 | { | ||
45 | history[historycurrent] = posn; | ||
46 | } | ||
47 | |||
48 | template<class T> | ||
49 | inline bool CNavigation_base<T>::back(T& posn) | ||
50 | { | ||
51 | if (historycurrent!=historystart) | ||
52 | { | ||
53 | // buffer is not empty | ||
54 | if (historycurrent==0) | ||
55 | { | ||
56 | historycurrent=NAVIGATION_HISTORY_SIZE-1; | ||
57 | } | ||
58 | else | ||
59 | { | ||
60 | historycurrent--; | ||
61 | } | ||
62 | posn=history[historycurrent]; | ||
63 | return true; | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | // circular buffer empty | ||
68 | return false; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | template<class T> | ||
73 | inline bool CNavigation_base<T>::forward(T& posn) | ||
74 | { | ||
75 | if (historycurrent!=historyend) | ||
76 | { | ||
77 | historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE; | ||
78 | posn = history[historycurrent]; | ||
79 | return true; | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | return false; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | #endif | ||
diff --git a/noncore/apps/opie-reader/PPMd.h b/noncore/apps/opie-reader/PPMd.h new file mode 100644 index 0000000..43d9ab4 --- a/dev/null +++ b/noncore/apps/opie-reader/PPMd.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #include "CSource.h" | ||
2 | /**************************************************************************** | ||
3 | * This file is part of PPMd project * | ||
4 | * Written and distributed to public domain by Dmitry Shkarin 1997, * | ||
5 | * 1999-2001 * | ||
6 | * Contents: interface to encoding/decoding routines * | ||
7 | * Comments: this file can be used as an interface to PPMd module * | ||
8 | * (consisting of Model.cpp) from external program * | ||
9 | ****************************************************************************/ | ||
10 | #if !defined(_PPMD_H_) | ||
11 | #define _PPMD_H_ | ||
12 | |||
13 | #include "PPMdType.h" | ||
14 | |||
15 | #ifdef __cplusplus | ||
16 | extern "C" { | ||
17 | #endif | ||
18 | |||
19 | BOOL _STDCALL StartSubAllocator(UINT SubAllocatorSize); | ||
20 | void _STDCALL StopSubAllocator(); /* it can be called once */ | ||
21 | DWORD _STDCALL GetUsedMemory(); /* for information only */ | ||
22 | |||
23 | /**************************************************************************** | ||
24 | * Method of model restoration at memory insufficiency: * | ||
25 | * MRM_RESTART - restart model from scratch (default) * | ||
26 | * MRM_CUT_OFF - cut off model (nearly twice slower) * | ||
27 | * MRM_FREEZE - freeze context tree (dangerous) */ | ||
28 | enum MR_METHOD { MRM_RESTART, MRM_CUT_OFF, MRM_FREEZE }; | ||
29 | |||
30 | /**************************************************************************** | ||
31 | * (MaxOrder == 1) parameter value has special meaning, it does not restart * | ||
32 | * model and can be used for solid mode archives; * | ||
33 | * Call sequence: * | ||
34 | * StartSubAllocator(SubAllocatorSize); * | ||
35 | * EncodeFile(SolidArcFile,File1,MaxOrder,MRM_RESTART); * | ||
36 | * EncodeFile(SolidArcFile,File2, 1,MRM_RESTART); * | ||
37 | * ... * | ||
38 | * EncodeFile(SolidArcFile,FileN, 1,MRM_RESTART); * | ||
39 | * StopSubAllocator(); * | ||
40 | ****************************************************************************/ | ||
41 | void _STDCALL EncodeFile(CSink* EncodedFile,CSource* DecodedFile, | ||
42 | int MaxOrder,MR_METHOD MRMethod=MRM_RESTART); | ||
43 | void _STDCALL DecodeFile(CSink* DecodedFile,CSource* EncodedFile, | ||
44 | int MaxOrder,MR_METHOD MRMethod=MRM_RESTART); | ||
45 | |||
46 | /* imported function */ | ||
47 | void _STDCALL PrintInfo(CInfo* DecodedFile, CInfo* EncodedFile); | ||
48 | |||
49 | #ifdef __cplusplus | ||
50 | } | ||
51 | #endif | ||
52 | |||
53 | #endif /* !defined(_PPMD_H_) */ | ||
diff --git a/noncore/apps/opie-reader/PPMdType.h b/noncore/apps/opie-reader/PPMdType.h new file mode 100644 index 0000000..eca7473 --- a/dev/null +++ b/noncore/apps/opie-reader/PPMdType.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /**************************************************************************** | ||
2 | * This file is part of PPMd project * | ||
3 | * Written and distributed to public domain by Dmitry Shkarin 1997, * | ||
4 | * 1999-2001 * | ||
5 | * Contents: compilation parameters and miscelaneous definitions * | ||
6 | * Comments: system & compiler dependent file * | ||
7 | ****************************************************************************/ | ||
8 | #if !defined(_PPMDTYPE_H_) | ||
9 | #define _PPMDTYPE_H_ | ||
10 | |||
11 | #include <stdio.h> | ||
12 | |||
13 | //#define _WIN32_ENVIRONMENT_ | ||
14 | //#define _DOS32_ENVIRONMENT_ | ||
15 | #define _POSIX_ENVIRONMENT_ | ||
16 | //#define _UNKNOWN_ENVIRONMENT_ | ||
17 | #if defined(_WIN32_ENVIRONMENT_)+defined(_DOS32_ENVIRONMENT_)+defined(_POSIX_ENVIRONMENT_)+defined(_UNKNOWN_ENVIRONMENT_) != 1 | ||
18 | #error Only one environment must be defined | ||
19 | #endif /* defined(_WIN32_ENVIRONMENT_)+defined(_DOS32_ENVIRONMENT_)+defined(_POSIX_ENVIRONMENT_)+defined(_UNKNOWN_ENVIRONMENT_) != 1 */ | ||
20 | |||
21 | #if defined(_WIN32_ENVIRONMENT_) | ||
22 | #include <windows.h> | ||
23 | #else /* _DOS32_ENVIRONMENT_ || _POSIX_ENVIRONMENT_ || _UNKNOWN_ENVIRONMENT_ */ | ||
24 | typedef int BOOL; | ||
25 | #define FALSE 0 | ||
26 | #define TRUE 1 | ||
27 | typedef unsigned char BYTE; | ||
28 | typedef unsigned short WORD; | ||
29 | typedef unsigned long DWORD; | ||
30 | typedef unsigned int UINT; | ||
31 | #endif /* defined(_WIN32_ENVIRONMENT_) */ | ||
32 | |||
33 | const DWORD PPMdSignature=0x84ACAF8F, Variant='I'; | ||
34 | const int MAX_O=16; /* maximum allowed model order */ | ||
35 | |||
36 | #define _USE_PREFETCHING /* for puzzling mainly */ | ||
37 | |||
38 | #if !defined(_UNKNOWN_ENVIRONMENT_) && !defined(__GNUC__) | ||
39 | #define _FASTCALL __fastcall | ||
40 | #define _STDCALL __stdcall | ||
41 | #else | ||
42 | #define _FASTCALL | ||
43 | #define _STDCALL | ||
44 | #endif /* !defined(_UNKNOWN_ENVIRONMENT_) && !defined(__GNUC__) */ | ||
45 | |||
46 | #if defined(__GNUC__) | ||
47 | #define _PACK_ATTR __attribute__ ((packed)) | ||
48 | #else /* "#pragma pack" is used for other compilers */ | ||
49 | #define _PACK_ATTR | ||
50 | #endif /* defined(__GNUC__) */ | ||
51 | |||
52 | /* PPMd module works with file streams via ...GETC/...PUTC macros only */ | ||
53 | typedef FILE _PPMD_FILE; | ||
54 | #define _PPMD_E_GETC(pps) (pps)->get() | ||
55 | #define _PPMD_E_PUTC(c,pps) (pps)->put(c) | ||
56 | #define _PPMD_D_GETC(pps) (pps)->get() | ||
57 | #define _PPMD_D_PUTC(c,pps) (pps)->put(c) | ||
58 | /****************** Example of C++ buffered stream ************************ | ||
59 | class PRIME_STREAM { | ||
60 | public: | ||
61 | enum { BUF_SIZE=64*1024 }; | ||
62 | PRIME_STREAM(): Error(0), StrPos(0), Count(0), p(Buf) {} | ||
63 | int get( ) { return (--Count >= 0)?(*p++ ):( fill( )); } | ||
64 | int put(int c) { return (--Count >= 0)?(*p++ = c):(flush(c)); } | ||
65 | int getErr() const { return Error; } | ||
66 | int tell() const { return StrPos+(p-Buf); } | ||
67 | BOOL atEOS() const { return (Count < 0); } | ||
68 | protected: | ||
69 | int Error, StrPos, Count; | ||
70 | BYTE* p, Buf[BUF_SIZE]; | ||
71 | virtual int fill( ) = 0; // it must fill Buf[] | ||
72 | virtual int flush(int c) = 0; // it must remove (p-Buf) bytes | ||
73 | }; | ||
74 | typedef PRIME_STREAM _PPMD_FILE; | ||
75 | #define _PPMD_E_GETC(pps) (pps)->get() | ||
76 | #define _PPMD_E_PUTC(c,pps) (pps)->put(c) | ||
77 | #define _PPMD_D_GETC(pps) (pps)->get() | ||
78 | #define _PPMD_D_PUTC(c,pps) (pps)->put(c) | ||
79 | ************************** End of example *********************************/ | ||
80 | |||
81 | #endif /* !defined(_PPMDTYPE_H_) */ | ||
diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp index b0d4e00..c1b7b7a 100644 --- a/noncore/apps/opie-reader/Palm2QImage.cpp +++ b/noncore/apps/opie-reader/Palm2QImage.cpp | |||
@@ -1,13 +1,6 @@ | |||
1 | /* -*- mode: c; indent-tabs-mode: nil; -*- */ | 1 | /* -*- mode: c; indent-tabs-mode: nil; -*- */ |
2 | 2 | #include "useqpe.h" | |
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | |||
6 | /* QT */ | ||
7 | #include <qimage.h> | ||
8 | |||
9 | /* STD */ | ||
10 | #include <stdio.h> | 3 | #include <stdio.h> |
11 | #include <stdlib.h> | 4 | #include <stdlib.h> |
12 | #include <string.h> | 5 | #include <string.h> |
13 | #ifndef _WINDOWS | 6 | #ifndef _WINDOWS |
@@ -16,8 +9,9 @@ | |||
16 | #include <sys/types.h> | 9 | #include <sys/types.h> |
17 | #include <sys/stat.h> | 10 | #include <sys/stat.h> |
18 | #include <stdarg.h> | 11 | #include <stdarg.h> |
19 | 12 | ||
13 | #include <qimage.h> | ||
20 | 14 | ||
21 | /***********************************************************************/ | 15 | /***********************************************************************/ |
22 | /***********************************************************************/ | 16 | /***********************************************************************/ |
23 | /***** *****/ | 17 | /***** *****/ |
@@ -48,12 +42,12 @@ typedef struct { | |||
48 | unsigned char blue; | 42 | unsigned char blue; |
49 | } ColorMapEntry; | 43 | } ColorMapEntry; |
50 | 44 | ||
51 | static ColorMapEntry Palm8BitColormap[] = { | 45 | static ColorMapEntry Palm8BitColormap[] = { |
52 | { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, | 46 | { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, |
53 | { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, | 47 | { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, |
54 | { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, | 48 | { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, |
55 | { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, | 49 | { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, |
56 | { 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 }, | 50 | { 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 }, |
57 | { 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 }, | 51 | { 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 }, |
58 | { 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 }, | 52 | { 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 }, |
59 | { 204, 51, 204 }, { 204, 0, 204 }, { 204, 255, 153 }, { 204, 204, 153 }, | 53 | { 204, 51, 204 }, { 204, 0, 204 }, { 204, 255, 153 }, { 204, 204, 153 }, |
@@ -145,40 +139,38 @@ QImage* Palm2QImage | |||
145 | next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); | 139 | next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); |
146 | transparent_index = palmimage[12]; | 140 | transparent_index = palmimage[12]; |
147 | compression_type = palmimage[13]; | 141 | compression_type = palmimage[13]; |
148 | /* bytes 14 and 15 are reserved by Palm and always 0 */ | 142 | /* bytes 14 and 15 are reserved by Palm and always 0 */ |
149 | 143 | ||
150 | #if 0 | 144 | #if 0 |
151 | // odebug << "Palm image is " << width << "x" << height | 145 | // qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); |
152 | // << ", " << bits_per_pixel << " bpp, version " << version | ||
153 | // << ", flags 0x" << flags << ", compression " << compression_type << oendl; | ||
154 | #endif | 146 | #endif |
155 | 147 | ||
156 | if (compression_type == PALM_COMPRESSION_PACKBITS) { | 148 | if (compression_type == PALM_COMPRESSION_PACKBITS) { |
157 | // odebug << "Image uses packbits compression; not yet supported" << oendl; | 149 | // qDebug ("Image uses packbits compression; not yet supported"); |
158 | return NULL; | 150 | return NULL; |
159 | } else if ((compression_type != PALM_COMPRESSION_NONE) && | 151 | } else if ((compression_type != PALM_COMPRESSION_NONE) && |
160 | (compression_type != PALM_COMPRESSION_RLE) && | 152 | (compression_type != PALM_COMPRESSION_RLE) && |
161 | (compression_type != PALM_COMPRESSION_SCANLINE)) { | 153 | (compression_type != PALM_COMPRESSION_SCANLINE)) { |
162 | // odebug << "Image uses unknown compression, code 0x" << compression_type << oendl; | 154 | // qDebug ("Image uses unknown compression, code 0x%x", compression_type); |
163 | return NULL; | 155 | return NULL; |
164 | } | 156 | } |
165 | 157 | ||
166 | /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: | 158 | /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: |
167 | 159 | ||
168 | 1, 2, or 4 bit grayscale | 160 | 1, 2, or 4 bit grayscale |
169 | 8-bit StaticColor using the Palm standard colormap | 161 | 8-bit StaticColor using the Palm standard colormap |
170 | 8-bit PseudoColor using a user-specified colormap | 162 | 8-bit PseudoColor using a user-specified colormap |
171 | 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue | 163 | 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue |
172 | 164 | ||
173 | Each of these can be compressed with one of four compression schemes, | 165 | Each of these can be compressed with one of four compression schemes, |
174 | "RLE", "Scanline", "PackBits", or none. | 166 | "RLE", "Scanline", "PackBits", or none. |
175 | 167 | ||
176 | We begin by constructing the colormap. | 168 | We begin by constructing the colormap. |
177 | */ | 169 | */ |
178 | 170 | ||
179 | if (flags & PALM_HAS_COLORMAP_FLAG) { | 171 | if (flags & PALM_HAS_COLORMAP_FLAG) { |
180 | // odebug << "Palm images with custom colormaps are not currently supported." << oendl; | 172 | // qDebug("Palm images with custom colormaps are not currently supported.\n"); |
181 | return NULL; | 173 | return NULL; |
182 | } else if (bits_per_pixel == 1) { | 174 | } else if (bits_per_pixel == 1) { |
183 | colormap = Palm1BitColormap; | 175 | colormap = Palm1BitColormap; |
184 | imagedatastart = palmimage + 16; | 176 | imagedatastart = palmimage + 16; |
@@ -195,22 +187,20 @@ QImage* Palm2QImage | |||
195 | colormap = NULL; | 187 | colormap = NULL; |
196 | palm_red_bits = palmimage[16]; | 188 | palm_red_bits = palmimage[16]; |
197 | palm_green_bits = palmimage[17]; | 189 | palm_green_bits = palmimage[17]; |
198 | palm_blue_bits = palmimage[18]; | 190 | palm_blue_bits = palmimage[18]; |
199 | // odebug << "Bits:" << palm_red_bits << ", " << palm_green_bits << ", " << palm_blue_bits << oendl; | 191 | // qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); |
200 | if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { | 192 | if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { |
201 | // odebug << "Can't handle this format DirectColor image -- too wide in some color (" | 193 | // 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); |
202 | // << palm_red_bits << ":" << palm_green_bits << ":" << palm_blue_bits << oendl; | ||
203 | return NULL; | 194 | return NULL; |
204 | } | 195 | } |
205 | if (bits_per_pixel > (8 * sizeof(unsigned long))) { | 196 | if (bits_per_pixel > (8 * sizeof(unsigned long))) { |
206 | // odebug << "Can't handle this format DirectColor image -- too many bits per pixel (" | 197 | // qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); |
207 | // << bits_per_pixel << ")" << oendl; | ||
208 | return NULL; | 198 | return NULL; |
209 | } | 199 | } |
210 | imagedatastart = palmimage + 24; | 200 | imagedatastart = palmimage + 24; |
211 | } else { | 201 | } else { |
212 | // odebug << "Unknown bits-per-pixel of " << bits_per_pixel << " encountered" << oendl; | 202 | // qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); |
213 | return NULL; | 203 | return NULL; |
214 | } | 204 | } |
215 | 205 | ||
216 | #ifndef USEQPE | 206 | #ifndef USEQPE |
@@ -223,29 +213,28 @@ QImage* Palm2QImage | |||
223 | rowbuf = new unsigned char[bytes_per_row * width]; | 213 | rowbuf = new unsigned char[bytes_per_row * width]; |
224 | lastrow = new unsigned char[bytes_per_row * width]; | 214 | lastrow = new unsigned char[bytes_per_row * width]; |
225 | 215 | ||
226 | for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { | 216 | for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { |
227 | // odebug << "inval:" << inval << " palm_ptr:" << palm_ptr << " x_ptr:" << x_ptr | 217 | // qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); |
228 | // << " bpr:" << bytes_per_row << oendl; | ||
229 | 218 | ||
230 | /* first, uncompress the Palm image */ | 219 | /* first, uncompress the Palm image */ |
231 | if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { | 220 | if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { |
232 | for (j = 0; j < bytes_per_row; ) { | 221 | for (j = 0; j < bytes_per_row; ) { |
233 | incount = *palm_ptr++; | 222 | incount = *palm_ptr++; |
234 | inval = *palm_ptr++; | 223 | inval = *palm_ptr++; |
235 | memset(rowbuf + j, inval, incount); | 224 | memset(rowbuf + j, inval, incount); |
236 | j += incount; | 225 | j += incount; |
237 | } | 226 | } |
238 | } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { | 227 | } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { |
239 | for (j = 0; j < bytes_per_row; j += 8) { | 228 | for (j = 0; j < bytes_per_row; j += 8) { |
240 | incount = *palm_ptr++; | 229 | incount = *palm_ptr++; |
241 | inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; | 230 | inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; |
242 | for (inbit = 0; inbit < inval; inbit += 1) { | 231 | for (inbit = 0; inbit < inval; inbit += 1) { |
243 | if (incount & (1 << (7 - inbit))) | 232 | if (incount & (1 << (7 - inbit))) |
244 | rowbuf[j + inbit] = *palm_ptr++; | 233 | rowbuf[j + inbit] = *palm_ptr++; |
245 | else | 234 | else |
246 | rowbuf[j + inbit] = lastrow[j + inbit]; | 235 | rowbuf[j + inbit] = lastrow[j + inbit]; |
247 | } | 236 | } |
248 | } | 237 | } |
249 | memcpy (lastrow, rowbuf, bytes_per_row); | 238 | memcpy (lastrow, rowbuf, bytes_per_row); |
250 | } else if (((flags & PALM_IS_COMPRESSED_FLAG) && | 239 | } else if (((flags & PALM_IS_COMPRESSED_FLAG) && |
251 | (compression_type == PALM_COMPRESSION_NONE)) || | 240 | (compression_type == PALM_COMPRESSION_NONE)) || |
@@ -254,51 +243,52 @@ QImage* Palm2QImage | |||
254 | memcpy (rowbuf, palm_ptr, bytes_per_row); | 243 | memcpy (rowbuf, palm_ptr, bytes_per_row); |
255 | palm_ptr += bytes_per_row; | 244 | palm_ptr += bytes_per_row; |
256 | } | 245 | } |
257 | else { | 246 | else { |
258 | odebug << "Case 4" << oendl; | 247 | qDebug("Case 4"); |
259 | odebug << "Is compressed:" << (((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true") << oendl; | 248 | qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); |
260 | odebug << "Has colourmap:" << (((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true") << oendl; | 249 | qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); |
261 | odebug << "Has transparency:" << (((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true") << oendl; | 250 | qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); |
262 | odebug << "Direct colour:" << (((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true") << oendl; | 251 | qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); |
263 | odebug << "four byte field:" << (((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true") << oendl; | 252 | qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); |
264 | memcpy (rowbuf, palm_ptr, bytes_per_row); | 253 | memcpy (rowbuf, palm_ptr, bytes_per_row); |
265 | palm_ptr += bytes_per_row; | 254 | palm_ptr += bytes_per_row; |
266 | } | 255 | } |
267 | /* next, write it to the GDK bitmap */ | 256 | /* next, write it to the GDK bitmap */ |
268 | if (colormap) { | 257 | if (colormap) { |
269 | mask = (1 << bits_per_pixel) - 1; | 258 | mask = (1 << bits_per_pixel) - 1; |
270 | for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { | 259 | for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { |
271 | inval = ((*inbyte) & (mask << inbit)) >> inbit; | 260 | inval = ((*inbyte) & (mask << inbit)) >> inbit; |
272 | /* correct for oddity of the 8-bit color Palm pixmap... */ | 261 | /* correct for oddity of the 8-bit color Palm pixmap... */ |
273 | if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; | 262 | if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; |
274 | /* now lookup the correct color and set the pixel in the GTK bitmap */ | 263 | /* now lookup the correct color and set the pixel in the GTK bitmap */ |
275 | QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); | 264 | QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); |
276 | qimage->setPixel(j, i, colour); | 265 | qimage->setPixel(j, i, colour); |
277 | if (!inbit) { | 266 | if (!inbit) { |
278 | ++inbyte; | 267 | ++inbyte; |
279 | inbit = 8 - bits_per_pixel; | 268 | inbit = 8 - bits_per_pixel; |
280 | } else { | 269 | } else { |
281 | inbit -= bits_per_pixel; | 270 | inbit -= bits_per_pixel; |
282 | } | 271 | } |
283 | } | 272 | } |
284 | } else if (!colormap && | 273 | } else if (!colormap && |
285 | bits_per_pixel == 16) { | 274 | bits_per_pixel == 16) { |
286 | for (inbyte = rowbuf, j = 0; j < width; ++j) { | 275 | for (inbyte = rowbuf, j = 0; j < width; ++j) { |
287 | inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1]; | 276 | inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1]; |
288 | 277 | ||
289 | /* | 278 | /* |
290 | odebug << "pixel is " << j << "," << i << " (" | 279 | qDebug ("pixel is %d,%d (%d:%d:%d)", |
291 | << (((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits)) << ":" | 280 | j, i, |
292 | << (((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits)) << ":" | 281 | ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), |
293 | << (((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)) << ")" << oendl; | 282 | ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), |
283 | ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); | ||
294 | */ | 284 | */ |
295 | QRgb colour = qRgb( | 285 | QRgb colour = qRgb( |
296 | ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), | 286 | ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), |
297 | ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), | 287 | ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), |
298 | ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); | 288 | ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); |
299 | qimage->setPixel(j, i, colour); | 289 | qimage->setPixel(j, i, colour); |
300 | inbyte += 2; | 290 | inbyte += 2; |
301 | } | 291 | } |
302 | } | 292 | } |
303 | } | 293 | } |
304 | 294 | ||
@@ -306,14 +296,4 @@ QImage* Palm2QImage | |||
306 | delete [] lastrow; | 296 | delete [] lastrow; |
307 | 297 | ||
308 | return qimage; | 298 | return qimage; |
309 | } | 299 | } |
310 | |||
311 | QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b) | ||
312 | { | ||
313 | // odebug << "hrule [" << w << ", " << h << "]" << oendl; | ||
314 | QPixmap* qimage = new QPixmap(w, h); | ||
315 | qimage->fill(QColor(r,g,b)); | ||
316 | QImage* ret = new QImage(qimage->convertToImage()); | ||
317 | delete qimage; | ||
318 | return ret; | ||
319 | } | ||
diff --git a/noncore/apps/opie-reader/Palm2QImage.h b/noncore/apps/opie-reader/Palm2QImage.h index 5d327c5..a09b537 100644 --- a/noncore/apps/opie-reader/Palm2QImage.h +++ b/noncore/apps/opie-reader/Palm2QImage.h | |||
@@ -2,6 +2,4 @@ | |||
2 | #include <qpixmap.h> | 2 | #include <qpixmap.h> |
3 | 3 | ||
4 | QImage* Palm2QImage | 4 | QImage* Palm2QImage |
5 | (unsigned char *image_bytes_in, int byte_count_in); | 5 | (unsigned char *image_bytes_in, int byte_count_in); |
6 | |||
7 | QImage* hRule(int w, int h, unsigned char r=0, unsigned char g=0, unsigned char b=0); | ||
diff --git a/noncore/apps/opie-reader/PluckerCodec.mak b/noncore/apps/opie-reader/PluckerCodec.mak new file mode 100644 index 0000000..ffd6ba8 --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec.mak | |||
@@ -0,0 +1,176 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libPlucker.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:40:46 2004 | ||
4 | # Project: PluckerCodec.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o PluckerCodec.mak PluckerCodec.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libPlucker.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = plucker.h | ||
47 | SOURCES = plucker.cpp \ | ||
48 | Palm2QImage.cpp | ||
49 | OBJECTS = QREADEROBJS/plucker.o \ | ||
50 | QREADEROBJS/Palm2QImage.o | ||
51 | FORMS = | ||
52 | UICDECLS = | ||
53 | UICIMPLS = | ||
54 | SRCMOC = | ||
55 | OBJMOC = | ||
56 | DIST = PluckerCodec.pro | ||
57 | QMAKE_TARGET = Plucker | ||
58 | DESTDIR = $(READERDIR)/codecs/ | ||
59 | TARGET = libPlucker.so.1.0.0 | ||
60 | TARGETA= $(READERDIR)/codecs/libPlucker.a | ||
61 | TARGETD= libPlucker.so.1.0.0 | ||
62 | TARGET0= libPlucker.so | ||
63 | TARGET1= libPlucker.so.1 | ||
64 | TARGET2= libPlucker.so.1.0 | ||
65 | |||
66 | first: all | ||
67 | ####### Implicit rules | ||
68 | |||
69 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
70 | |||
71 | .cpp.o: | ||
72 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
73 | |||
74 | .cc.o: | ||
75 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
76 | |||
77 | .cxx.o: | ||
78 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
79 | |||
80 | .C.o: | ||
81 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
82 | |||
83 | .c.o: | ||
84 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
85 | |||
86 | ####### Build rules | ||
87 | |||
88 | all: PluckerCodec.mak $(READERDIR)/codecs/$(TARGET) | ||
89 | |||
90 | $(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
91 | test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/ | ||
92 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
93 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
94 | -ln -s $(TARGET) $(TARGET0) | ||
95 | -ln -s $(TARGET) $(TARGET1) | ||
96 | -ln -s $(TARGET) $(TARGET2) | ||
97 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) | ||
98 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) | ||
99 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1) | ||
100 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2) | ||
101 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/ | ||
102 | |||
103 | |||
104 | |||
105 | staticlib: $(TARGETA) | ||
106 | |||
107 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
108 | -$(DEL_FILE) $(TARGETA) | ||
109 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
110 | |||
111 | mocables: $(SRCMOC) | ||
112 | uicables: $(UICDECLS) $(UICIMPLS) | ||
113 | |||
114 | $(MOC): | ||
115 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
116 | |||
117 | PluckerCodec.mak: PluckerCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
118 | $(QMAKE) -o PluckerCodec.mak PluckerCodec.pro | ||
119 | qmake: | ||
120 | @$(QMAKE) -o PluckerCodec.mak PluckerCodec.pro | ||
121 | |||
122 | dist: | ||
123 | @mkdir -p QREADEROBJS/Plucker && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/Plucker/ && ( cd `dirname QREADEROBJS/Plucker` && $(TAR) Plucker.tar Plucker && $(GZIP) Plucker.tar ) && $(MOVE) `dirname QREADEROBJS/Plucker`/Plucker.tar.gz . && $(DEL_FILE) -r QREADEROBJS/Plucker | ||
124 | |||
125 | mocclean: | ||
126 | |||
127 | uiclean: | ||
128 | |||
129 | yaccclean: | ||
130 | lexclean: | ||
131 | clean: | ||
132 | -$(DEL_FILE) $(OBJECTS) | ||
133 | -$(DEL_FILE) *~ core *.core | ||
134 | |||
135 | |||
136 | ####### Sub-libraries | ||
137 | |||
138 | distclean: clean | ||
139 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET) | ||
140 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA) | ||
141 | |||
142 | |||
143 | FORCE: | ||
144 | |||
145 | ####### Compile | ||
146 | |||
147 | QREADEROBJS/plucker.o: plucker.cpp QREADERINC/useqpe.h \ | ||
148 | plucker.h \ | ||
149 | Aportis.h \ | ||
150 | Palm2QImage.h \ | ||
151 | QREADERINC/static.h \ | ||
152 | plucker_base.h \ | ||
153 | CExpander.h \ | ||
154 | ztxt.h \ | ||
155 | pdb.h \ | ||
156 | CBuffer.h \ | ||
157 | my_list.h \ | ||
158 | Navigation.h \ | ||
159 | hrule.h \ | ||
160 | config.h \ | ||
161 | StyleConsts.h \ | ||
162 | Markups.h \ | ||
163 | names.h \ | ||
164 | linktype.h \ | ||
165 | ustring.h | ||
166 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/plucker.o plucker.cpp | ||
167 | |||
168 | QREADEROBJS/Palm2QImage.o: Palm2QImage.cpp QREADERINC/useqpe.h | ||
169 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Palm2QImage.o Palm2QImage.cpp | ||
170 | |||
171 | ####### Install | ||
172 | |||
173 | install: all | ||
174 | |||
175 | uninstall: | ||
176 | |||
diff --git a/noncore/apps/opie-reader/PluckerCodec.omak b/noncore/apps/opie-reader/PluckerCodec.omak new file mode 100644 index 0000000..27a5c93 --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec.omak | |||
@@ -0,0 +1,138 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libPlucker.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: PluckerCodec.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libPlucker.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =plucker.h | ||
29 | SOURCES =plucker.cpp \ | ||
30 | Palm2QImage.cpp | ||
31 | OBJECTS =OREADEROBJS/plucker.o \ | ||
32 | OREADEROBJS/Palm2QImage.o | ||
33 | INTERFACES = | ||
34 | UICDECLS = | ||
35 | UICIMPLS = | ||
36 | SRCMOC = | ||
37 | OBJMOC = | ||
38 | DIST = | ||
39 | TARGET =libPlucker.so.1.0.0 | ||
40 | TARGETA =$(QTDIR)/plugins/reader/codecs/libPlucker.a | ||
41 | TARGETD =libPlucker.so.1.0.0 | ||
42 | TARGET0 =libPlucker.so | ||
43 | TARGET1 =libPlucker.so.1 | ||
44 | TARGET2 =libPlucker.so.1.0 | ||
45 | INTERFACE_DECL_PATH = . | ||
46 | |||
47 | ####### Implicit rules | ||
48 | |||
49 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
50 | |||
51 | .cpp.o: | ||
52 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
53 | |||
54 | .cxx.o: | ||
55 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
56 | |||
57 | .cc.o: | ||
58 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
59 | |||
60 | .C.o: | ||
61 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
62 | |||
63 | .c.o: | ||
64 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
65 | |||
66 | ####### Build rules | ||
67 | |||
68 | |||
69 | all: $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0 | ||
70 | |||
71 | $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
72 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
73 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
74 | -ln -s $(TARGET) $(TARGET0) | ||
75 | -ln -s $(TARGET) $(TARGET1) | ||
76 | -ln -s $(TARGET) $(TARGET2) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
79 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
80 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
81 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
82 | |||
83 | staticlib: $(TARGETA) | ||
84 | |||
85 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
86 | -rm -f $(TARGETA) | ||
87 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
88 | |||
89 | moc: $(SRCMOC) | ||
90 | |||
91 | tmake: PluckerCodec.omak | ||
92 | |||
93 | PluckerCodec.omak: PluckerCodec.opro | ||
94 | tmake PluckerCodec.opro -o PluckerCodec.omak | ||
95 | |||
96 | dist: | ||
97 | $(TAR) PluckerCodec.opro.tar PluckerCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
98 | $(GZIP) PluckerCodec.opro.tar | ||
99 | |||
100 | clean: | ||
101 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
102 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
103 | -rm -f *~ core | ||
104 | |||
105 | ####### Sub-libraries | ||
106 | |||
107 | |||
108 | ###### Combined headers | ||
109 | |||
110 | |||
111 | ####### Compile | ||
112 | |||
113 | OREADEROBJS/plucker.o: plucker.cpp \ | ||
114 | OREADERINC/useqpe.h \ | ||
115 | plucker.h \ | ||
116 | plucker_base.h \ | ||
117 | CExpander.h \ | ||
118 | config.h \ | ||
119 | ustring.h \ | ||
120 | StyleConsts.h \ | ||
121 | Markups.h \ | ||
122 | names.h \ | ||
123 | linktype.h \ | ||
124 | ztxt.h \ | ||
125 | pdb.h \ | ||
126 | CBuffer.h \ | ||
127 | my_list.h \ | ||
128 | Navigation.h \ | ||
129 | hrule.h \ | ||
130 | Aportis.h \ | ||
131 | Palm2QImage.h \ | ||
132 | OREADERINC/static.h | ||
133 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/plucker.o plucker.cpp | ||
134 | |||
135 | OREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \ | ||
136 | OREADERINC/useqpe.h | ||
137 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Palm2QImage.o Palm2QImage.cpp | ||
138 | |||
diff --git a/noncore/apps/opie-reader/PluckerCodec.wmak b/noncore/apps/opie-reader/PluckerCodec.wmak new file mode 100644 index 0000000..6c1f37a --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec.wmak | |||
@@ -0,0 +1,138 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libPlucker.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: PluckerCodec.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libPlucker.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =plucker.h | ||
29 | SOURCES =plucker.cpp \ | ||
30 | Palm2QImage.cpp | ||
31 | OBJECTS =WSREADEROBJS/plucker.o \ | ||
32 | WSREADEROBJS/Palm2QImage.o | ||
33 | INTERFACES = | ||
34 | UICDECLS = | ||
35 | UICIMPLS = | ||
36 | SRCMOC = | ||
37 | OBJMOC = | ||
38 | DIST = | ||
39 | TARGET =libPlucker.so.1.0.0 | ||
40 | TARGETA =$(QTDIR)/plugins/reader/codecs/libPlucker.a | ||
41 | TARGETD =libPlucker.so.1.0.0 | ||
42 | TARGET0 =libPlucker.so | ||
43 | TARGET1 =libPlucker.so.1 | ||
44 | TARGET2 =libPlucker.so.1.0 | ||
45 | INTERFACE_DECL_PATH = . | ||
46 | |||
47 | ####### Implicit rules | ||
48 | |||
49 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
50 | |||
51 | .cpp.o: | ||
52 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
53 | |||
54 | .cxx.o: | ||
55 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
56 | |||
57 | .cc.o: | ||
58 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
59 | |||
60 | .C.o: | ||
61 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
62 | |||
63 | .c.o: | ||
64 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
65 | |||
66 | ####### Build rules | ||
67 | |||
68 | |||
69 | all: $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0 | ||
70 | |||
71 | $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
72 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
73 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
74 | -ln -s $(TARGET) $(TARGET0) | ||
75 | -ln -s $(TARGET) $(TARGET1) | ||
76 | -ln -s $(TARGET) $(TARGET2) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
79 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
80 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
81 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
82 | |||
83 | staticlib: $(TARGETA) | ||
84 | |||
85 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
86 | -rm -f $(TARGETA) | ||
87 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
88 | |||
89 | moc: $(SRCMOC) | ||
90 | |||
91 | tmake: PluckerCodec.wmak | ||
92 | |||
93 | PluckerCodec.wmak: PluckerCodec.wpro | ||
94 | tmake PluckerCodec.wpro -o PluckerCodec.wmak | ||
95 | |||
96 | dist: | ||
97 | $(TAR) PluckerCodec.wpro.tar PluckerCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
98 | $(GZIP) PluckerCodec.wpro.tar | ||
99 | |||
100 | clean: | ||
101 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
102 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
103 | -rm -f *~ core | ||
104 | |||
105 | ####### Sub-libraries | ||
106 | |||
107 | |||
108 | ###### Combined headers | ||
109 | |||
110 | |||
111 | ####### Compile | ||
112 | |||
113 | WSREADEROBJS/plucker.o: plucker.cpp \ | ||
114 | WSREADERINC/useqpe.h \ | ||
115 | plucker.h \ | ||
116 | plucker_base.h \ | ||
117 | CExpander.h \ | ||
118 | config.h \ | ||
119 | ustring.h \ | ||
120 | StyleConsts.h \ | ||
121 | Markups.h \ | ||
122 | names.h \ | ||
123 | linktype.h \ | ||
124 | ztxt.h \ | ||
125 | pdb.h \ | ||
126 | CBuffer.h \ | ||
127 | my_list.h \ | ||
128 | Navigation.h \ | ||
129 | hrule.h \ | ||
130 | Aportis.h \ | ||
131 | Palm2QImage.h \ | ||
132 | WSREADERINC/static.h | ||
133 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/plucker.o plucker.cpp | ||
134 | |||
135 | WSREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \ | ||
136 | WSREADERINC/useqpe.h | ||
137 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Palm2QImage.o Palm2QImage.cpp | ||
138 | |||
diff --git a/noncore/apps/opie-reader/PluckerCodec.wpro b/noncore/apps/opie-reader/PluckerCodec.wpro new file mode 100644 index 0000000..8f80a8b --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec.wpro | |||
@@ -0,0 +1,16 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = plucker.h | ||
4 | |||
5 | SOURCES = plucker.cpp \ | ||
6 | Palm2QImage.cpp | ||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = Plucker | ||
11 | LIBS += -lreader_pdb -lreader_pluckerbase -lreader_codec | ||
12 | |||
13 | OBJECTS_DIR = WSREADEROBJS | ||
14 | MOC_DIR = WSREADERMOCS | ||
15 | INCLUDEPATH+= WSREADERINC | ||
16 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/PluckerCodec.zmak b/noncore/apps/opie-reader/PluckerCodec.zmak new file mode 100644 index 0000000..9aa5e39 --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec.zmak | |||
@@ -0,0 +1,138 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libPlucker.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: PluckerCodec.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libPlucker.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =plucker.h | ||
29 | SOURCES =plucker.cpp \ | ||
30 | Palm2QImage.cpp | ||
31 | OBJECTS =ZREADEROBJS/plucker.o \ | ||
32 | ZREADEROBJS/Palm2QImage.o | ||
33 | INTERFACES = | ||
34 | UICDECLS = | ||
35 | UICIMPLS = | ||
36 | SRCMOC = | ||
37 | OBJMOC = | ||
38 | DIST = | ||
39 | TARGET =libPlucker.so.1.0.0 | ||
40 | TARGETA =$(QTDIR)/plugins/reader/codecs/libPlucker.a | ||
41 | TARGETD =libPlucker.so.1.0.0 | ||
42 | TARGET0 =libPlucker.so | ||
43 | TARGET1 =libPlucker.so.1 | ||
44 | TARGET2 =libPlucker.so.1.0 | ||
45 | INTERFACE_DECL_PATH = . | ||
46 | |||
47 | ####### Implicit rules | ||
48 | |||
49 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
50 | |||
51 | .cpp.o: | ||
52 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
53 | |||
54 | .cxx.o: | ||
55 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
56 | |||
57 | .cc.o: | ||
58 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
59 | |||
60 | .C.o: | ||
61 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
62 | |||
63 | .c.o: | ||
64 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
65 | |||
66 | ####### Build rules | ||
67 | |||
68 | |||
69 | all: $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0 | ||
70 | |||
71 | $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
72 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
73 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
74 | -ln -s $(TARGET) $(TARGET0) | ||
75 | -ln -s $(TARGET) $(TARGET1) | ||
76 | -ln -s $(TARGET) $(TARGET2) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
79 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
80 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
81 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
82 | |||
83 | staticlib: $(TARGETA) | ||
84 | |||
85 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
86 | -rm -f $(TARGETA) | ||
87 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
88 | |||
89 | moc: $(SRCMOC) | ||
90 | |||
91 | tmake: PluckerCodec.zmak | ||
92 | |||
93 | PluckerCodec.zmak: PluckerCodec.zpro | ||
94 | tmake PluckerCodec.zpro -o PluckerCodec.zmak | ||
95 | |||
96 | dist: | ||
97 | $(TAR) PluckerCodec.zpro.tar PluckerCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
98 | $(GZIP) PluckerCodec.zpro.tar | ||
99 | |||
100 | clean: | ||
101 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
102 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
103 | -rm -f *~ core | ||
104 | |||
105 | ####### Sub-libraries | ||
106 | |||
107 | |||
108 | ###### Combined headers | ||
109 | |||
110 | |||
111 | ####### Compile | ||
112 | |||
113 | ZREADEROBJS/plucker.o: plucker.cpp \ | ||
114 | ZREADERINC/useqpe.h \ | ||
115 | plucker.h \ | ||
116 | plucker_base.h \ | ||
117 | CExpander.h \ | ||
118 | config.h \ | ||
119 | ustring.h \ | ||
120 | StyleConsts.h \ | ||
121 | Markups.h \ | ||
122 | names.h \ | ||
123 | linktype.h \ | ||
124 | ztxt.h \ | ||
125 | pdb.h \ | ||
126 | CBuffer.h \ | ||
127 | my_list.h \ | ||
128 | Navigation.h \ | ||
129 | hrule.h \ | ||
130 | Aportis.h \ | ||
131 | Palm2QImage.h \ | ||
132 | ZREADERINC/static.h | ||
133 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/plucker.o plucker.cpp | ||
134 | |||
135 | ZREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \ | ||
136 | ZREADERINC/useqpe.h | ||
137 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Palm2QImage.o Palm2QImage.cpp | ||
138 | |||
diff --git a/noncore/apps/opie-reader/PluckerCodec.zpro b/noncore/apps/opie-reader/PluckerCodec.zpro new file mode 100644 index 0000000..e462d96 --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec.zpro | |||
@@ -0,0 +1,16 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = plucker.h | ||
4 | |||
5 | SOURCES = plucker.cpp \ | ||
6 | Palm2QImage.cpp | ||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = Plucker | ||
11 | LIBS += -lreader_pdb -lreader_pluckerbase -lreader_codec | ||
12 | |||
13 | OBJECTS_DIR = ZREADEROBJS | ||
14 | MOC_DIR = ZREADERMOCS | ||
15 | INCLUDEPATH+= ZREADERINC | ||
16 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/PluckerCodec/.cvsignore b/noncore/apps/opie-reader/PluckerCodec/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/PluckerCodec/PluckerCodec.pro b/noncore/apps/opie-reader/PluckerCodec/PluckerCodec.pro new file mode 100644 index 0000000..6ed4032 --- a/dev/null +++ b/noncore/apps/opie-reader/PluckerCodec/PluckerCodec.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = plucker.h | ||
6 | |||
7 | SOURCES = plucker.cpp \ | ||
8 | Palm2QImage.cpp | ||
9 | |||
10 | INTERFACES= | ||
11 | DESTDIR = $(OPIEDIR)/plugins/reader/codecs | ||
12 | TARGET = Plucker | ||
13 | LIBS += -lreader_pdb -lreader_pluckerbase -lreader_codec | ||
14 | |||
15 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
16 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/Prefs.cpp b/noncore/apps/opie-reader/Prefs.cpp index 72eefba..2733faa 100644 --- a/noncore/apps/opie-reader/Prefs.cpp +++ b/noncore/apps/opie-reader/Prefs.cpp | |||
@@ -7,25 +7,56 @@ | |||
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #include "Prefs.h" | 9 | #include "Prefs.h" |
10 | 10 | ||
11 | #include <qcheckbox.h> | ||
11 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | #include <qpushbutton.h> | ||
14 | #include <qspinbox.h> | ||
12 | #include <qlayout.h> | 15 | #include <qlayout.h> |
16 | #include <qvariant.h> | ||
17 | #include <qtooltip.h> | ||
18 | #include <qwhatsthis.h> | ||
13 | #include <qbuttongroup.h> | 19 | #include <qbuttongroup.h> |
14 | #ifdef USEQPE | 20 | #include <qlineedit.h> |
15 | #include <qpe/menubutton.h> | 21 | #ifdef USECOMBO |
16 | #include <qpe/fontdatabase.h> | 22 | #include <qcombobox.h> |
17 | #else | 23 | #else |
18 | #include <qfontdatabase.h> | 24 | #include <qpe/menubutton.h> |
19 | #endif | 25 | #endif |
26 | #include <qfontdatabase.h> | ||
20 | 27 | ||
21 | #include <qpe/qpeapplication.h> | 28 | #ifdef USECOMBO |
29 | void populate_colours(QComboBox *mb) | ||
30 | #else | ||
31 | void populate_colours(MenuButton *mb) | ||
32 | #endif | ||
33 | { | ||
34 | mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
35 | mb->insertItem("White"); | ||
36 | mb->insertItem("Black"); | ||
37 | mb->insertItem("Dark Gray"); | ||
38 | mb->insertItem("Gray"); | ||
39 | mb->insertItem("Light Gray"); | ||
40 | mb->insertItem("Red"); | ||
41 | mb->insertItem("Green"); | ||
42 | mb->insertItem("Blue"); | ||
43 | mb->insertItem("Cyan"); | ||
44 | mb->insertItem("Magenta"); | ||
45 | mb->insertItem("Yellow"); | ||
46 | mb->insertItem("Dark Red"); | ||
47 | mb->insertItem("Dark Green"); | ||
48 | mb->insertItem("Dark Blue"); | ||
49 | mb->insertItem("Dark Cyan"); | ||
50 | mb->insertItem("Dark Magenta"); | ||
51 | mb->insertItem("Dark Yellow"); | ||
52 | } | ||
22 | 53 | ||
23 | CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl ) | 54 | CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl ) |
24 | : QWidget( parent, name, fl ) | 55 | : QWidget( parent, name, fl ) |
25 | { | 56 | { |
26 | QHBoxLayout* hb = new QHBoxLayout(this); | 57 | QHBoxLayout* hb = new QHBoxLayout(this); |
27 | QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, tr("Text"), this); | 58 | QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Text", this); |
28 | hb->addWidget(bg); | 59 | hb->addWidget(bg); |
29 | 60 | ||
30 | StripCR = new QCheckBox( bg ); | 61 | StripCR = new QCheckBox( bg ); |
31 | StripCR->setText( tr( "Strip CR" ) ); | 62 | StripCR->setText( tr( "Strip CR" ) ); |
@@ -53,8 +84,32 @@ CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
53 | 84 | ||
54 | FullJustify = new QCheckBox( bg ); | 85 | FullJustify = new QCheckBox( bg ); |
55 | FullJustify->setText( tr( "Full Justify" ) ); | 86 | FullJustify->setText( tr( "Full Justify" ) ); |
56 | 87 | ||
88 | FixGraphics = new QCheckBox( bg ); | ||
89 | FixGraphics->setText( tr( "Fix Graphic Size" ) ); | ||
90 | |||
91 | hyphenate = new QCheckBox( bg ); | ||
92 | hyphenate->setText( tr( "Hyphenate" ) ); | ||
93 | |||
94 | /* | ||
95 | customhyphen = new QCheckBox( bg ); | ||
96 | customhyphen->setText( tr( "Custom Hyphen'n" ) ); | ||
97 | */ | ||
98 | |||
99 | prepalm = new QCheckBox( bg ); | ||
100 | prepalm->setText( tr( "Repalm(Baen)" ) ); | ||
101 | |||
102 | pkern = new QCheckBox( bg ); | ||
103 | pkern->setText( tr( "Kern" ) ); | ||
104 | |||
105 | /* | ||
106 | Negative = new QCheckBox( bg ); | ||
107 | Negative->setText( tr( "Negative" ) ); | ||
108 | */ | ||
109 | |||
110 | // Inverse = new QCheckBox( bg ); | ||
111 | // Inverse->setText( tr( "Inverse" ) ); | ||
57 | } | 112 | } |
58 | 113 | ||
59 | /* | 114 | /* |
60 | * Destroys the object and frees any allocated resources | 115 | * Destroys the object and frees any allocated resources |
@@ -65,9 +120,151 @@ CLayoutPrefs::~CLayoutPrefs() | |||
65 | } | 120 | } |
66 | 121 | ||
67 | 122 | ||
68 | 123 | ||
69 | CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) | 124 | CLayoutPrefs2::CLayoutPrefs2( int w, QWidget* parent, const char* name, WFlags fl ) |
125 | : QWidget( parent, name, fl ) | ||
126 | { | ||
127 | |||
128 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
129 | QGridLayout* gl = new QGridLayout(vb, 4, 5); | ||
130 | |||
131 | QLabel *TextLabel; | ||
132 | |||
133 | TextLabel = new QLabel( this ); | ||
134 | TextLabel->setText( tr( "Page\nOverlap" ) ); | ||
135 | gl->addWidget(TextLabel, 0, 0); | ||
136 | pageoverlap = new QSpinBox( this ); | ||
137 | pageoverlap->setRange(0,20); | ||
138 | gl->addWidget(pageoverlap, 0, 1); | ||
139 | |||
140 | TextLabel = new QLabel( this, "TextLabel1" ); | ||
141 | TextLabel->setText( tr( "Indent" ) ); | ||
142 | gl->addWidget(TextLabel, 1, 0); | ||
143 | Indent = new QSpinBox( this, "Indent" ); | ||
144 | Indent->setRange(0,20); | ||
145 | gl->addWidget(Indent, 1, 1); | ||
146 | |||
147 | |||
148 | |||
149 | TextLabel = new QLabel( this ); | ||
150 | TextLabel->setText( tr( "Graphics\nZoom" ) ); | ||
151 | gl->addWidget(TextLabel, 1, 2); | ||
152 | gfxzoom = new QSpinBox( this ); | ||
153 | gfxzoom->setRange(0,2000); | ||
154 | gfxzoom->setLineStep(10); | ||
155 | gfxzoom->setSuffix("%"); | ||
156 | gl->addWidget(gfxzoom, 1, 3); | ||
157 | |||
158 | TextLabel = new QLabel( this, "TextLabel4" ); | ||
159 | TextLabel->setText( tr( "Top\nMargin" ) ); | ||
160 | gl->addWidget(TextLabel, 2, 0); | ||
161 | TopMargin = new QSpinBox( this, "TMargin" ); | ||
162 | TopMargin->setRange(0, 1000); | ||
163 | gl->addWidget(TopMargin, 2, 1); | ||
164 | |||
165 | TextLabel = new QLabel( this ); | ||
166 | TextLabel->setText( tr( "Bottom\nMargin" ) ); | ||
167 | gl->addWidget(TextLabel, 2, 2); | ||
168 | BottomMargin = new QSpinBox( this, "BMargin" ); | ||
169 | BottomMargin->setRange(0, 1000); | ||
170 | gl->addWidget(BottomMargin, 2, 3); | ||
171 | |||
172 | TextLabel = new QLabel( this, "TextLabel4" ); | ||
173 | TextLabel->setText( tr( "Left\nMargin" ) ); | ||
174 | gl->addWidget(TextLabel, 3, 0); | ||
175 | LeftMargin = new QSpinBox( this, "LMargin" ); | ||
176 | LeftMargin->setRange(0, 1000); | ||
177 | gl->addWidget(LeftMargin, 3, 1); | ||
178 | |||
179 | TextLabel = new QLabel( this ); | ||
180 | TextLabel->setText( tr( "Right\nMargin" ) ); | ||
181 | gl->addWidget(TextLabel, 3, 2); | ||
182 | RightMargin = new QSpinBox( this, "RMargin" ); | ||
183 | RightMargin->setRange(0, 1000); | ||
184 | gl->addWidget(RightMargin, 3, 3); | ||
185 | |||
186 | TextLabel = new QLabel( this ); | ||
187 | TextLabel->setText( tr( "Paragraph\nLeading" ) ); | ||
188 | gl->addWidget(TextLabel, 4, 0); | ||
189 | ParaLead = new QSpinBox( this ); | ||
190 | ParaLead->setRange(-5, 50); | ||
191 | gl->addWidget(ParaLead, 4, 1); | ||
192 | |||
193 | TextLabel = new QLabel( this ); | ||
194 | TextLabel->setText( tr( "Line\nLeading" ) ); | ||
195 | gl->addWidget(TextLabel, 4, 2); | ||
196 | LineLead = new QSpinBox( this ); | ||
197 | LineLead->setRange(-5, 50); | ||
198 | gl->addWidget(LineLead, 4, 3); | ||
199 | |||
200 | gl = new QGridLayout(vb, 2, 2); | ||
201 | |||
202 | TextLabel = new QLabel( this); | ||
203 | TextLabel->setText( tr( "Markup" ) ); | ||
204 | gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom); | ||
205 | TextLabel = new QLabel( this); | ||
206 | TextLabel->setText( tr( "Font" ) ); | ||
207 | gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom); | ||
208 | |||
209 | |||
210 | #ifdef USECOMBO | ||
211 | Markup = new QComboBox( this); | ||
212 | #else | ||
213 | Markup = new MenuButton( this); | ||
214 | #endif | ||
215 | Markup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
216 | Markup->insertItem("Auto"); | ||
217 | Markup->insertItem("None"); | ||
218 | Markup->insertItem("Text"); | ||
219 | Markup->insertItem("HTML"); | ||
220 | Markup->insertItem("PML"); | ||
221 | gl->addWidget(Markup, 1, 0, Qt::AlignTop); | ||
222 | |||
223 | #ifdef USECOMBO | ||
224 | fontselector = new QComboBox( this); | ||
225 | #else | ||
226 | fontselector = new MenuButton( this); | ||
227 | #endif | ||
228 | fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
229 | { | ||
230 | QFontDatabase f; | ||
231 | QStringList flist = f.families(); | ||
232 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | ||
233 | { | ||
234 | fontselector->insertItem(*nm); | ||
235 | } | ||
236 | } // delete the FontDatabase!!! | ||
237 | gl->addWidget(fontselector, 1, 1, Qt::AlignTop); | ||
238 | |||
239 | #ifdef USECOMBO | ||
240 | bgsel = new QComboBox( this ); | ||
241 | #else | ||
242 | bgsel = new MenuButton( this ); | ||
243 | #endif | ||
244 | populate_colours(bgsel); | ||
245 | |||
246 | #ifdef USECOMBO | ||
247 | fgsel = new QComboBox( this ); | ||
248 | #else | ||
249 | fgsel = new MenuButton( this ); | ||
250 | #endif | ||
251 | populate_colours(fgsel); | ||
252 | gl = new QGridLayout(vb, 2, 2); | ||
253 | |||
254 | TextLabel = new QLabel( this); | ||
255 | TextLabel->setText( tr( "Background" ) ); | ||
256 | gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom); | ||
257 | TextLabel = new QLabel( this); | ||
258 | TextLabel->setText( tr( "Foreground" ) ); | ||
259 | gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom); | ||
260 | |||
261 | gl->addWidget(bgsel, 1, 0, Qt::AlignTop); | ||
262 | gl->addWidget(fgsel, 1, 1, Qt::AlignTop); | ||
263 | |||
264 | } | ||
265 | /* | ||
266 | CLayoutPrefs2::CLayoutPrefs2( int w, QWidget* parent, const char* name, WFlags fl ) | ||
70 | : QWidget( parent, name, fl ) | 267 | : QWidget( parent, name, fl ) |
71 | { | 268 | { |
72 | 269 | ||
73 | QVBoxLayout* vb = new QVBoxLayout(this); | 270 | QVBoxLayout* vb = new QVBoxLayout(this); |
@@ -112,9 +309,9 @@ CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) | |||
112 | TextLabel->setText( tr( "Line\nLeading" ) ); | 309 | TextLabel->setText( tr( "Line\nLeading" ) ); |
113 | gl->addWidget(TextLabel, 2, 2); | 310 | gl->addWidget(TextLabel, 2, 2); |
114 | 311 | ||
115 | Margin = new QSpinBox( this, "Margin" ); | 312 | Margin = new QSpinBox( this, "Margin" ); |
116 | Margin->setRange(0, 100); | 313 | Margin->setRange(0, w/2); |
117 | gl->addWidget(Margin, 3, 0); | 314 | gl->addWidget(Margin, 3, 0); |
118 | 315 | ||
119 | ParaLead = new QSpinBox( this ); | 316 | ParaLead = new QSpinBox( this ); |
120 | ParaLead->setRange(-5, 50); | 317 | ParaLead->setRange(-5, 50); |
@@ -153,21 +350,44 @@ CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) | |||
153 | fontselector = new MenuButton( this); | 350 | fontselector = new MenuButton( this); |
154 | #endif | 351 | #endif |
155 | fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | 352 | fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); |
156 | { | 353 | { |
157 | #ifdef USEQPE | ||
158 | FontDatabase f; | ||
159 | #else | ||
160 | QFontDatabase f; | 354 | QFontDatabase f; |
161 | #endif | ||
162 | QStringList flist = f.families(); | 355 | QStringList flist = f.families(); |
163 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | 356 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) |
164 | { | 357 | { |
165 | fontselector->insertItem(*nm); | 358 | fontselector->insertItem(*nm); |
166 | } | 359 | } |
167 | } // delete the FontDatabase!!! | 360 | } // delete the FontDatabase!!! |
168 | gl->addWidget(fontselector, 1, 1, Qt::AlignTop); | 361 | gl->addWidget(fontselector, 1, 1, Qt::AlignTop); |
362 | |||
363 | #ifdef USECOMBO | ||
364 | bgsel = new QComboBox( this ); | ||
365 | #else | ||
366 | bgsel = new MenuButton( this ); | ||
367 | #endif | ||
368 | populate_colours(bgsel); | ||
369 | |||
370 | #ifdef USECOMBO | ||
371 | fgsel = new QComboBox( this ); | ||
372 | #else | ||
373 | fgsel = new MenuButton( this ); | ||
374 | #endif | ||
375 | populate_colours(fgsel); | ||
376 | gl = new QGridLayout(vb, 2, 2); | ||
377 | |||
378 | TextLabel = new QLabel( this); | ||
379 | TextLabel->setText( tr( "Background" ) ); | ||
380 | gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom); | ||
381 | TextLabel = new QLabel( this); | ||
382 | TextLabel->setText( tr( "Foreground" ) ); | ||
383 | gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom); | ||
384 | |||
385 | gl->addWidget(bgsel, 1, 0, Qt::AlignTop); | ||
386 | gl->addWidget(fgsel, 1, 1, Qt::AlignTop); | ||
387 | |||
169 | } | 388 | } |
389 | */ | ||
170 | /* | 390 | /* |
171 | CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) | 391 | CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) |
172 | : QWidget( parent, name, fl ) | 392 | : QWidget( parent, name, fl ) |
173 | { | 393 | { |
@@ -353,14 +573,17 @@ CMiscPrefs::~CMiscPrefs() | |||
353 | CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) | 573 | CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) |
354 | : QWidget( parent, name, fl ) | 574 | : QWidget( parent, name, fl ) |
355 | { | 575 | { |
356 | 576 | ||
357 | QGridLayout* hl = new QGridLayout(this,1,2); | 577 | QVBoxLayout* vl = new QVBoxLayout(this); |
578 | QHBoxLayout* hl = new QHBoxLayout; | ||
579 | vl->addLayout(hl); | ||
358 | 580 | ||
581 | vl->setMargin( 0 ); | ||
359 | hl->setMargin( 0 ); | 582 | hl->setMargin( 0 ); |
360 | 583 | ||
361 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("Select Action"), this); | 584 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Select Action", this); |
362 | hl->addWidget( gb, 0, 0 ); | 585 | hl->addWidget( gb ); |
363 | 586 | ||
364 | annotation = new QCheckBox( gb ); | 587 | annotation = new QCheckBox( gb ); |
365 | annotation->setText( tr( "Annotation" ) ); | 588 | annotation->setText( tr( "Annotation" ) ); |
366 | 589 | ||
@@ -369,10 +592,10 @@ CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
369 | 592 | ||
370 | clipboard = new QCheckBox( gb ); | 593 | clipboard = new QCheckBox( gb ); |
371 | clipboard->setText( tr( "Clipboard" ) ); | 594 | clipboard->setText( tr( "Clipboard" ) ); |
372 | 595 | ||
373 | QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, tr("Plucker"), this); | 596 | QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Plucker", this); |
374 | hl->addWidget( bg, 0 , 1 ); | 597 | hl->addWidget( bg ); |
375 | 598 | ||
376 | Depluck = new QCheckBox( bg ); | 599 | Depluck = new QCheckBox( bg ); |
377 | Depluck->setText( tr( "Depluck" ) ); | 600 | Depluck->setText( tr( "Depluck" ) ); |
378 | 601 | ||
@@ -381,48 +604,93 @@ CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
381 | 604 | ||
382 | Continuous = new QCheckBox( bg ); | 605 | Continuous = new QCheckBox( bg ); |
383 | Continuous->setText( tr( "Continuous" ) ); | 606 | Continuous->setText( tr( "Continuous" ) ); |
384 | 607 | ||
608 | bg = new QButtonGroup(2, Qt::Horizontal, "Scroll", this); | ||
609 | vl->addWidget( bg ); | ||
385 | 610 | ||
386 | /* | 611 | // scrollinplace = new QCheckBox( bg ); |
612 | // scrollinplace->setText( tr( "In Place" ) ); | ||
613 | #ifdef USECOMBO | ||
614 | scrolltype = new QComboBox( bg ); | ||
615 | #else | ||
616 | scrolltype = new MenuButton( this); | ||
617 | #endif | ||
618 | scrolltype->insertItem("In Place"); | ||
619 | scrolltype->insertItem("Rolling (moving bg)"); | ||
620 | scrolltype->insertItem("Rolling (window)"); | ||
621 | scrolltype->insertItem("Rolling (static bg)"); | ||
622 | scrolltype->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
387 | 623 | ||
388 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Navigation", this); | 624 | |
389 | TextLabel = new QLabel( gb ); | 625 | #ifdef USECOMBO |
390 | TextLabel->setText( tr( "Overlap" ) ); | 626 | scrollcolor = new QComboBox( bg ); |
391 | QSpinBox* sb = new QSpinBox( gb ); | 627 | #else |
392 | 628 | scrollcolor = new MenuButton( this); | |
393 | Internationalisation | 629 | #endif |
394 | Ideogram/Word | 630 | populate_colours(scrollcolor); |
395 | Set Width | 631 | scrollcolor->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); |
396 | Set Encoding | 632 | |
397 | Set Font | 633 | |
398 | */ | 634 | QLabel* TextLabel = new QLabel( bg ); |
635 | TextLabel->setText( tr( "Scroll step" ) ); | ||
636 | // gl->addWidget(TextLabel, 2, 0); | ||
637 | scrollstep = new QSpinBox( bg ); | ||
638 | scrollstep->setRange(1, 10); | ||
639 | scrollstep->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
640 | |||
641 | TextLabel = new QLabel( bg ); | ||
642 | TextLabel->setText( tr( "Minibar Colour" ) ); | ||
643 | #ifdef USECOMBO | ||
644 | minibarcol = new QComboBox( bg ); | ||
645 | #else | ||
646 | minibarcol = new MenuButton( this); | ||
647 | #endif | ||
648 | populate_colours(minibarcol); | ||
649 | minibarcol->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
650 | |||
651 | |||
652 | bg = new QButtonGroup(2, Qt::Vertical, "Background", this); | ||
653 | vl->addWidget( bg ); | ||
654 | |||
655 | // QLabel* TextLabel = new QLabel( bg ); | ||
656 | // TextLabel->setText( tr( "Copy an image to \"background\" in\n~/Applications/uqtreader/Theme/" ) ); | ||
657 | |||
658 | #ifdef USECOMBO | ||
659 | bgtype = new QComboBox( bg ); | ||
660 | #else | ||
661 | bgtype = new MenuButton( this); | ||
662 | #endif | ||
663 | bgtype->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
664 | |||
665 | bgtype->insertItem( tr("Centred") ); | ||
666 | bgtype->insertItem( tr("Tiled") ); | ||
667 | bgtype->insertItem( tr("Fitted") ); | ||
399 | } | 668 | } |
400 | 669 | ||
401 | CMiscPrefs::~CMiscPrefs() | 670 | CMiscPrefs::~CMiscPrefs() |
402 | { | 671 | { |
403 | // no need to delete child widgets, Qt does it all for us | 672 | // no need to delete child widgets, Qt does it all for us |
404 | } | 673 | } |
405 | 674 | ||
406 | CPrefs::CPrefs(bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) | 675 | CPrefs::CPrefs( int w, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) |
407 | { | 676 | { |
408 | setCaption(tr( "OpieReader Settings" ) ); | 677 | setCaption(tr( "OpieReader Settings" ) ); |
409 | QTabWidget* td = new QTabWidget(this); | 678 | QTabWidget* td = new QTabWidget(this); |
410 | layout = new CLayoutPrefs(this); | 679 | layout = new CLayoutPrefs(this); |
411 | layout2 = new CLayoutPrefs2(this); | 680 | layout2 = new CLayoutPrefs2(w, this); |
412 | misc = new CMiscPrefs(this); | 681 | misc = new CMiscPrefs(this); |
413 | button = new CButtonPrefs(this); | 682 | // button = new CButtonPrefs(kmap, this); |
414 | inter = new CInterPrefs(this); | 683 | inter = new CInterPrefs(this); |
415 | td->addTab(layout, tr("Layout")); | 684 | td->addTab(layout, tr("Layout")); |
416 | td->addTab(layout2, tr("Layout(2)")); | 685 | td->addTab(layout2, tr("Layout(2)")); |
417 | td->addTab(inter, tr("Locale")); | 686 | td->addTab(inter, tr("Locale")); |
418 | td->addTab(misc, tr("Misc")); | 687 | td->addTab(misc, tr("Misc")); |
419 | td->addTab(button, tr("Buttons")); | 688 | // td->addTab(button, tr("Buttons")); |
420 | QVBoxLayout* v = new QVBoxLayout(this); | 689 | QVBoxLayout* v = new QVBoxLayout(this); |
421 | v->addWidget(td); | 690 | v->addWidget(td); |
422 | 691 | ||
423 | if (fs) | 692 | if (fs) showMaximized(); |
424 | QPEApplication::showDialog( this ); | ||
425 | } | 693 | } |
426 | 694 | ||
427 | 695 | ||
428 | /* | 696 | /* |
@@ -477,9 +745,9 @@ CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
477 | } | 745 | } |
478 | 746 | ||
479 | QVBoxLayout* vb = new QVBoxLayout; | 747 | QVBoxLayout* vb = new QVBoxLayout; |
480 | 748 | ||
481 | gb = new QGroupBox(1, Qt::Horizontal, tr("Dictionary"), this); | 749 | gb = new QGroupBox(1, Qt::Horizontal, "Dictionary", this); |
482 | 750 | ||
483 | TextLabel = new QLabel( gb ); | 751 | TextLabel = new QLabel( gb ); |
484 | TextLabel->setText( tr( "Application" ) ); | 752 | TextLabel->setText( tr( "Application" ) ); |
485 | application = new QLineEdit(gb); | 753 | application = new QLineEdit(gb); |
@@ -493,9 +761,9 @@ CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
493 | twotouch = new QCheckBox( gb ); | 761 | twotouch = new QCheckBox( gb ); |
494 | twotouch->setText( tr( "Two/One\nTouch" ) ); | 762 | twotouch->setText( tr( "Two/One\nTouch" ) ); |
495 | 763 | ||
496 | SwapMouse = new QCheckBox( gb ); | 764 | SwapMouse = new QCheckBox( gb ); |
497 | SwapMouse->setText(tr("Swap Tap\nActions") ); | 765 | SwapMouse->setText("Swap Tap\nActions"); |
498 | 766 | ||
499 | 767 | ||
500 | vb->addWidget(gb); | 768 | vb->addWidget(gb); |
501 | 769 | ||
@@ -506,125 +774,4 @@ CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
506 | CInterPrefs::~CInterPrefs() | 774 | CInterPrefs::~CInterPrefs() |
507 | { | 775 | { |
508 | // no need to delete child widgets, Qt does it all for us | 776 | // no need to delete child widgets, Qt does it all for us |
509 | } | 777 | } |
510 | |||
511 | |||
512 | |||
513 | #ifdef USECOMBO | ||
514 | void CButtonPrefs::populate(QComboBox *mb) | ||
515 | #else | ||
516 | void CButtonPrefs::populate(MenuButton *mb) | ||
517 | #endif | ||
518 | { | ||
519 | mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
520 | mb->insertItem(tr("<Nothing>") ); | ||
521 | mb->insertItem(tr("Open file") ); | ||
522 | mb->insertItem(tr("Autoscroll") ); | ||
523 | mb->insertItem(tr("Bookmark") ); | ||
524 | mb->insertItem(tr("Annotate") ); | ||
525 | mb->insertItem(tr("Fullscreen") ); | ||
526 | |||
527 | mb->insertItem(tr("Zoom in") ); | ||
528 | mb->insertItem(tr("Zoom out") ); | ||
529 | mb->insertItem(tr("Back") ); | ||
530 | mb->insertItem(tr("Forward") ); | ||
531 | mb->insertItem(tr("Home") ); | ||
532 | mb->insertItem(tr("Page up") ); | ||
533 | mb->insertItem(tr("Page down") ); | ||
534 | mb->insertItem(tr("Line up") ); | ||
535 | mb->insertItem(tr("Line down") ); | ||
536 | mb->insertItem(tr("Beginning") ); | ||
537 | mb->insertItem(tr("End") ); | ||
538 | } | ||
539 | |||
540 | CButtonPrefs::CButtonPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
541 | : QWidget( parent, name, fl ) | ||
542 | { | ||
543 | |||
544 | QGridLayout* hl = new QGridLayout(this,10,2); | ||
545 | |||
546 | hl->setMargin( 0 ); | ||
547 | |||
548 | QLabel* ql = new QLabel(tr("Escape Button"), this); | ||
549 | hl->addWidget(ql, 0, 0, Qt::AlignBottom); | ||
550 | #ifdef USECOMBO | ||
551 | escapeAction = new QComboBox( this ); | ||
552 | #else | ||
553 | escapeAction = new MenuButton( this ); | ||
554 | #endif | ||
555 | populate(escapeAction); | ||
556 | hl->addWidget(escapeAction, 1, 0, Qt::AlignTop | Qt::AlignLeft); | ||
557 | |||
558 | ql = new QLabel(tr("Space Button"), this); | ||
559 | hl->addWidget(ql, 2, 0, Qt::AlignBottom); | ||
560 | #ifdef USECOMBO | ||
561 | spaceAction = new QComboBox( this ); | ||
562 | #else | ||
563 | spaceAction = new MenuButton( this ); | ||
564 | #endif | ||
565 | populate(spaceAction); | ||
566 | hl->addWidget(spaceAction, 3, 0, Qt::AlignTop | Qt::AlignLeft); | ||
567 | |||
568 | ql = new QLabel(tr("Return Button"), this); | ||
569 | hl->addWidget(ql, 2, 1, Qt::AlignBottom); | ||
570 | #ifdef USECOMBO | ||
571 | returnAction = new QComboBox( this ); | ||
572 | #else | ||
573 | returnAction = new MenuButton( this ); | ||
574 | #endif | ||
575 | populate(returnAction); | ||
576 | hl->addWidget(returnAction, 3, 1, Qt::AlignTop | Qt::AlignLeft); | ||
577 | |||
578 | ql = new QLabel(tr("Left Arrow"), this); | ||
579 | hl->addWidget(ql, 4, 0, Qt::AlignBottom); | ||
580 | #ifdef USECOMBO | ||
581 | leftAction = new QComboBox( this ); | ||
582 | #else | ||
583 | leftAction = new MenuButton( this ); | ||
584 | #endif | ||
585 | populate(leftAction); | ||
586 | hl->addWidget(leftAction, 5, 0, Qt::AlignTop | Qt::AlignLeft); | ||
587 | leftScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
588 | hl->addWidget(leftScroll, 6, 0, Qt::AlignTop | Qt::AlignLeft); | ||
589 | |||
590 | ql = new QLabel(tr("Right Arrow"), this); | ||
591 | hl->addWidget(ql, 4, 1, Qt::AlignBottom); | ||
592 | #ifdef USECOMBO | ||
593 | rightAction = new QComboBox( this ); | ||
594 | #else | ||
595 | rightAction = new MenuButton( this ); | ||
596 | #endif | ||
597 | populate(rightAction); | ||
598 | hl->addWidget(rightAction, 5, 1, Qt::AlignTop | Qt::AlignLeft); | ||
599 | rightScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
600 | hl->addWidget(rightScroll, 6, 1, Qt::AlignTop | Qt::AlignLeft); | ||
601 | |||
602 | ql = new QLabel(tr("Down Arrow"), this); | ||
603 | hl->addWidget(ql, 7, 0, Qt::AlignBottom); | ||
604 | #ifdef USECOMBO | ||
605 | downAction = new QComboBox( this ); | ||
606 | #else | ||
607 | downAction = new MenuButton( this ); | ||
608 | #endif | ||
609 | populate(downAction); | ||
610 | hl->addWidget(downAction, 8, 0, Qt::AlignTop | Qt::AlignLeft); | ||
611 | downScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
612 | hl->addWidget(downScroll, 9, 0, Qt::AlignTop | Qt::AlignLeft); | ||
613 | |||
614 | ql = new QLabel(tr("Up Arrow"), this); | ||
615 | hl->addWidget(ql, 7, 1, Qt::AlignBottom); | ||
616 | #ifdef USECOMBO | ||
617 | upAction = new QComboBox( this ); | ||
618 | #else | ||
619 | upAction = new MenuButton( this ); | ||
620 | #endif | ||
621 | populate(upAction); | ||
622 | hl->addWidget(upAction, 8, 1, Qt::AlignTop | Qt::AlignLeft); | ||
623 | upScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
624 | hl->addWidget(upScroll, 9, 1, Qt::AlignTop | Qt::AlignLeft); | ||
625 | } | ||
626 | |||
627 | CButtonPrefs::~CButtonPrefs() | ||
628 | { | ||
629 | // no need to delete child widgets, Qt does it all for us | ||
630 | } | ||
diff --git a/noncore/apps/opie-reader/Prefs.h b/noncore/apps/opie-reader/Prefs.h index 8fef2f5..cf12b70 100644 --- a/noncore/apps/opie-reader/Prefs.h +++ b/noncore/apps/opie-reader/Prefs.h | |||
@@ -7,36 +7,38 @@ | |||
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #ifndef CPREFS_H | 9 | #ifndef CPREFS_H |
10 | #define CPREFS_H | 10 | #define CPREFS_H |
11 | #include "useqpe.h" | 11 | |
12 | #include <qvariant.h> | 12 | #include <qvariant.h> |
13 | #include <qwidget.h> | 13 | #include <qwidget.h> |
14 | #include <qtabdialog.h> | 14 | #include <qtabdialog.h> |
15 | #include <qtabwidget.h> | 15 | #include <qtabwidget.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qcombobox.h> | ||
19 | #include <qlineedit.h> | 18 | #include <qlineedit.h> |
20 | #ifdef USEQPE | ||
21 | #include <qpe/menubutton.h> | ||
22 | #endif | ||
23 | //#include "opie.h" | ||
24 | 19 | ||
25 | //#ifdef OPIE | ||
26 | #define USECOMBO | 20 | #define USECOMBO |
27 | //#endif | 21 | |
22 | #ifdef USECOMBO | ||
23 | #include <qcombobox.h> | ||
24 | #else | ||
25 | #include <qpe/menubutton.h> | ||
26 | #endif | ||
27 | |||
28 | #include "orkey.h" | ||
28 | 29 | ||
29 | class QVBoxLayout; | 30 | class QVBoxLayout; |
30 | class QHBoxLayout; | 31 | class QHBoxLayout; |
31 | class QGridLayout; | 32 | class QGridLayout; |
32 | //class QCheckBox; | 33 | //class QCheckBox; |
33 | class QLabel; | 34 | class QLabel; |
34 | //class QSpinBox; | 35 | //class QSpinBox; |
36 | class QListViewItem; | ||
35 | 37 | ||
36 | class CLayoutPrefs : public QWidget | 38 | class CLayoutPrefs : public QWidget |
37 | { | 39 | { |
38 | Q_OBJECT | 40 | |
39 | public: | 41 | public: |
40 | 42 | ||
41 | friend class CPrefs; | 43 | friend class CPrefs; |
42 | 44 | ||
@@ -51,28 +53,35 @@ public: | |||
51 | QCheckBox* DoubleSpace; | 53 | QCheckBox* DoubleSpace; |
52 | QCheckBox* Remap; | 54 | QCheckBox* Remap; |
53 | QCheckBox* Embolden; | 55 | QCheckBox* Embolden; |
54 | QCheckBox* FullJustify; | 56 | QCheckBox* FullJustify; |
57 | QCheckBox* FixGraphics; | ||
58 | QCheckBox* hyphenate; | ||
59 | // QCheckBox* customhyphen; | ||
60 | QCheckBox* prepalm; | ||
61 | QCheckBox* pkern; | ||
62 | // QCheckBox* Inverse; | ||
63 | // QCheckBox* Negative; | ||
55 | }; | 64 | }; |
56 | 65 | ||
57 | class CLayoutPrefs2 : public QWidget | 66 | class CLayoutPrefs2 : public QWidget |
58 | { | 67 | { |
59 | Q_OBJECT | 68 | |
60 | public: | 69 | public: |
61 | 70 | ||
62 | friend class CPrefs; | 71 | friend class CPrefs; |
63 | 72 | ||
64 | CLayoutPrefs2( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 73 | CLayoutPrefs2( int w, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
65 | ~CLayoutPrefs2(); | 74 | ~CLayoutPrefs2(); |
66 | 75 | ||
67 | QSpinBox* ParaLead; | 76 | QSpinBox* ParaLead; |
68 | QSpinBox* LineLead; | 77 | QSpinBox* LineLead; |
69 | QSpinBox* Indent; | 78 | QSpinBox* Indent; |
70 | QSpinBox* Margin, *gfxzoom, *pageoverlap; | 79 | QSpinBox *TopMargin, *BottomMargin, *LeftMargin, *RightMargin, *gfxzoom, *pageoverlap; |
71 | #ifdef USECOMBO | 80 | #ifdef USECOMBO |
72 | QComboBox *Markup, *fontselector; | 81 | QComboBox *Markup, *fontselector, *fgsel, *bgsel; |
73 | #else | 82 | #else |
74 | MenuButton *Markup, *fontselector; | 83 | MenuButton *Markup, *fontselector, *fgsel, *bgsel; |
75 | #endif | 84 | #endif |
76 | }; | 85 | }; |
77 | 86 | ||
78 | /* | 87 | /* |
@@ -98,9 +107,9 @@ protected: | |||
98 | }; | 107 | }; |
99 | */ | 108 | */ |
100 | class CMiscPrefs : public QWidget | 109 | class CMiscPrefs : public QWidget |
101 | { | 110 | { |
102 | Q_OBJECT | 111 | |
103 | public: | 112 | public: |
104 | 113 | ||
105 | friend class CPrefs; | 114 | friend class CPrefs; |
106 | 115 | ||
@@ -108,13 +117,28 @@ public: | |||
108 | ~CMiscPrefs(); | 117 | ~CMiscPrefs(); |
109 | 118 | ||
110 | QCheckBox *annotation, *dictionary, *clipboard; | 119 | QCheckBox *annotation, *dictionary, *clipboard; |
111 | QCheckBox *Depluck, *Dejpluck, *Continuous; | 120 | QCheckBox *Depluck, *Dejpluck, *Continuous; |
121 | |||
122 | QSpinBox *scrollstep; | ||
123 | |||
124 | #ifdef USECOMBO | ||
125 | QComboBox *scrollcolor, *bgtype, *scrolltype, *minibarcol; | ||
126 | #else | ||
127 | MenuButton *scrollcolor, *bgtype, *scrolltype, *minibarcol; | ||
128 | #endif | ||
112 | }; | 129 | }; |
130 | /* | ||
131 | class QListView; | ||
132 | class QListViewItem; | ||
113 | 133 | ||
114 | class CButtonPrefs : public QWidget | 134 | class CButtonPrefs : public QWidget |
115 | { | 135 | { |
116 | Q_OBJECT | 136 | Q_OBJECT |
137 | QMap<orKey, int> *kmap; | ||
138 | QMap<orKey, QListViewItem*> listmap; | ||
139 | QListView* lb; | ||
140 | void keyPressEvent(QKeyEvent* e); | ||
117 | #ifdef USECOMBO | 141 | #ifdef USECOMBO |
118 | void populate(QComboBox*); | 142 | void populate(QComboBox*); |
119 | #else | 143 | #else |
120 | void populate(MenuButton*); | 144 | void populate(MenuButton*); |
@@ -122,22 +146,26 @@ class CButtonPrefs : public QWidget | |||
122 | public: | 146 | public: |
123 | 147 | ||
124 | friend class CPrefs; | 148 | friend class CPrefs; |
125 | 149 | ||
126 | CButtonPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 150 | CButtonPrefs( QMap<orKey, int>*, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
127 | ~CButtonPrefs(); | 151 | ~CButtonPrefs(); |
128 | 152 | ||
129 | #ifdef USECOMBO | 153 | #ifdef USECOMBO |
130 | QComboBox *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction; | 154 | QComboBox *action; |
131 | #else | 155 | #else |
132 | MenuButton *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction; | 156 | MenuButton *action; |
133 | #endif | 157 | #endif |
134 | QCheckBox *leftScroll, *rightScroll, *upScroll, *downScroll; | 158 | QSpinBox* debounce; |
135 | }; | ||
136 | 159 | ||
160 | // QCheckBox *leftScroll, *rightScroll, *upScroll, *downScroll; | ||
161 | private slots: | ||
162 | void erasemapping(QListViewItem*); | ||
163 | }; | ||
164 | */ | ||
137 | class CInterPrefs : public QWidget | 165 | class CInterPrefs : public QWidget |
138 | { | 166 | { |
139 | Q_OBJECT | 167 | |
140 | public: | 168 | public: |
141 | 169 | ||
142 | friend class CPrefs; | 170 | friend class CPrefs; |
143 | 171 | ||
@@ -160,9 +188,9 @@ class CPrefs : public QDialog | |||
160 | Q_OBJECT | 188 | Q_OBJECT |
161 | CLayoutPrefs* layout; | 189 | CLayoutPrefs* layout; |
162 | CLayoutPrefs2* layout2; | 190 | CLayoutPrefs2* layout2; |
163 | CMiscPrefs* misc; | 191 | CMiscPrefs* misc; |
164 | CButtonPrefs* button; | 192 | // CButtonPrefs* button; |
165 | CInterPrefs* inter; | 193 | CInterPrefs* inter; |
166 | 194 | ||
167 | void keyPressEvent(QKeyEvent* e) | 195 | void keyPressEvent(QKeyEvent* e) |
168 | { | 196 | { |
@@ -181,48 +209,100 @@ Q_OBJECT | |||
181 | QWidget::keyPressEvent(e); | 209 | QWidget::keyPressEvent(e); |
182 | } | 210 | } |
183 | } | 211 | } |
184 | public: | 212 | public: |
185 | CPrefs(bool fs = true, QWidget* parent = 0, const char* name = 0); | 213 | CPrefs(int w, bool fs = true, QWidget* parent = 0, const char* name = 0); |
186 | ~CPrefs() | 214 | ~CPrefs() |
187 | { | 215 | { |
188 | } | 216 | } |
217 | bool hyphenate() { return layout->hyphenate->isChecked(); } | ||
218 | void hyphenate(bool _v) { layout->hyphenate->setChecked(_v); } | ||
219 | /* | ||
220 | bool customhyphen() { return layout->customhyphen->isChecked(); } | ||
221 | void customhyphen(bool _v) { layout->customhyphen->setChecked(_v); } | ||
222 | */ | ||
189 | bool StripCR() { return layout->StripCR->isChecked(); } | 223 | bool StripCR() { return layout->StripCR->isChecked(); } |
224 | bool repalm() { return layout->prepalm->isChecked(); } | ||
225 | bool kern() { return layout->pkern->isChecked(); } | ||
190 | bool Dehyphen() { return layout->Dehyphen->isChecked(); } | 226 | bool Dehyphen() { return layout->Dehyphen->isChecked(); } |
191 | bool SingleSpace() { return layout->SingleSpace->isChecked(); } | 227 | bool SingleSpace() { return layout->SingleSpace->isChecked(); } |
192 | bool Unindent() { return layout->Unindent->isChecked(); } | 228 | bool Unindent() { return layout->Unindent->isChecked(); } |
193 | bool Reparagraph() { return layout->Reparagraph->isChecked(); } | 229 | bool Reparagraph() { return layout->Reparagraph->isChecked(); } |
194 | bool DoubleSpace() { return layout->DoubleSpace->isChecked(); } | 230 | bool DoubleSpace() { return layout->DoubleSpace->isChecked(); } |
195 | bool Remap() { return layout->Remap->isChecked(); } | 231 | bool Remap() { return layout->Remap->isChecked(); } |
196 | bool Embolden() { return layout->Embolden->isChecked(); } | 232 | bool Embolden() { return layout->Embolden->isChecked(); } |
197 | bool FullJustify() { return layout->FullJustify->isChecked(); } | 233 | bool FullJustify() { return layout->FullJustify->isChecked(); } |
234 | // bool Inverse() { return layout->Inverse->isChecked(); } | ||
235 | // bool Negative() { return layout->Negative->isChecked(); } | ||
236 | bool FixGraphics() { return layout->FixGraphics->isChecked(); } | ||
198 | int ParaLead() { return layout2->ParaLead->value(); } | 237 | int ParaLead() { return layout2->ParaLead->value(); } |
199 | int LineLead() { return layout2->LineLead->value(); } | 238 | int LineLead() { return layout2->LineLead->value(); } |
200 | int Margin() { return layout2->Margin->value(); } | 239 | int TopMargin() { return layout2->TopMargin->value(); } |
240 | int BottomMargin() { return layout2->BottomMargin->value(); } | ||
241 | int LeftMargin() { return layout2->LeftMargin->value(); } | ||
242 | int RightMargin() { return layout2->RightMargin->value(); } | ||
201 | int Indent() { return layout2->Indent->value(); } | 243 | int Indent() { return layout2->Indent->value(); } |
202 | int Markup() { return layout2->Markup->currentItem(); } | 244 | int Markup() { return layout2->Markup->currentItem(); } |
203 | QString Font() { return layout2->fontselector->currentText(); } | 245 | QString Font() { return layout2->fontselector->currentText(); } |
204 | 246 | ||
205 | 247 | ||
206 | void StripCR(bool v) { layout->StripCR->setChecked(v); } | 248 | void StripCR(bool v) { layout->StripCR->setChecked(v); } |
249 | void repalm(bool v) { layout->prepalm->setChecked(v); } | ||
250 | void kern(bool v) { layout->pkern->setChecked(v); } | ||
207 | void Dehyphen(bool v) { layout->Dehyphen->setChecked(v); } | 251 | void Dehyphen(bool v) { layout->Dehyphen->setChecked(v); } |
208 | void SingleSpace(bool v) { layout->SingleSpace->setChecked(v); } | 252 | void SingleSpace(bool v) { layout->SingleSpace->setChecked(v); } |
209 | void Unindent(bool v) { layout->Unindent->setChecked(v); } | 253 | void Unindent(bool v) { layout->Unindent->setChecked(v); } |
210 | void Reparagraph(bool v) { layout->Reparagraph->setChecked(v); } | 254 | void Reparagraph(bool v) { layout->Reparagraph->setChecked(v); } |
211 | void DoubleSpace(bool v) { layout->DoubleSpace->setChecked(v); } | 255 | void DoubleSpace(bool v) { layout->DoubleSpace->setChecked(v); } |
212 | void Remap(bool v) { layout->Remap->setChecked(v); } | 256 | void Remap(bool v) { layout->Remap->setChecked(v); } |
213 | void Embolden(bool v) { layout->Embolden->setChecked(v); } | 257 | void Embolden(bool v) { layout->Embolden->setChecked(v); } |
214 | void FullJustify(bool v) { layout->FullJustify->setChecked(v); } | 258 | void FullJustify(bool v) { layout->FullJustify->setChecked(v); } |
259 | // void Negative(bool v) { layout->Negative->setChecked(v); } | ||
260 | // void Inverse(bool v) { layout->Inverse->setChecked(v); } | ||
261 | void FixGraphics(bool v) { layout->FixGraphics->setChecked(v); } | ||
215 | void ParaLead(int v) { layout2->ParaLead->setValue(v); } | 262 | void ParaLead(int v) { layout2->ParaLead->setValue(v); } |
216 | void LineLead(int v) { layout2->LineLead->setValue(v); } | 263 | void LineLead(int v) { layout2->LineLead->setValue(v); } |
217 | void Margin(int v) { layout2->Margin->setValue(v); } | 264 | void TopMargin(int v) { layout2->TopMargin->setValue(v); } |
265 | void BottomMargin(int v) { layout2->BottomMargin->setValue(v); } | ||
266 | void LeftMargin(int v) { layout2->LeftMargin->setValue(v); } | ||
267 | void RightMargin(int v) { layout2->RightMargin->setValue(v); } | ||
218 | void Indent(int v) { layout2->Indent->setValue(v); } | 268 | void Indent(int v) { layout2->Indent->setValue(v); } |
219 | #ifdef USECOMBO | 269 | #ifdef USECOMBO |
220 | void Markup(int v) { layout2->Markup->setCurrentItem(v); } | 270 | void Markup(int v) { layout2->Markup->setCurrentItem(v); } |
221 | #else | 271 | #else |
222 | void Markup(int v) { layout2->Markup->select(v); } | 272 | void Markup(int v) { layout2->Markup->select(v); } |
223 | #endif | 273 | #endif |
224 | #ifdef USECOMBO | 274 | #ifdef USECOMBO |
275 | void bgtype(int v) { misc->bgtype->setCurrentItem(v); } | ||
276 | void scrollcolor(int v) { misc->scrollcolor->setCurrentItem(v); } | ||
277 | void minibarcol(int v) { misc->minibarcol->setCurrentItem(v); } | ||
278 | #else | ||
279 | void bgtype(int v) { misc->bgtype->select(v); } | ||
280 | void scrollcolor(int v) { misc->scrollcolor->select(v); } | ||
281 | void minibarcol(int v) { misc->minibarcol->select(v); } | ||
282 | #endif | ||
283 | int bgtype() { return misc->bgtype->currentItem(); } | ||
284 | int scrollcolor() { return misc->scrollcolor->currentItem(); } | ||
285 | int minibarcol() { return misc->minibarcol->currentItem(); } | ||
286 | |||
287 | |||
288 | #ifdef USECOMBO | ||
289 | void foreground(int v) { layout2->fgsel->setCurrentItem(v); } | ||
290 | #else | ||
291 | void foreground(int v) { layout2->fgsel->select(v); } | ||
292 | #endif | ||
293 | int foreground() { return layout2->fgsel->currentItem(); } | ||
294 | |||
295 | #ifdef USECOMBO | ||
296 | void background(int v) { layout2->bgsel->setCurrentItem(v); } | ||
297 | #else | ||
298 | void background(int v) { layout2->bgsel->select(v); } | ||
299 | #endif | ||
300 | int background() { return layout2->bgsel->currentItem(); } | ||
301 | |||
302 | |||
303 | |||
304 | #ifdef USECOMBO | ||
225 | void Font(QString& s) | 305 | void Font(QString& s) |
226 | { | 306 | { |
227 | for (int i = 1; i <= layout2->fontselector->count(); i++) | 307 | for (int i = 1; i <= layout2->fontselector->count(); i++) |
228 | { | 308 | { |
@@ -257,63 +337,25 @@ Q_OBJECT | |||
257 | void miscclipboard(bool v) { misc->clipboard->setChecked(v); } | 337 | void miscclipboard(bool v) { misc->clipboard->setChecked(v); } |
258 | bool miscannotation() { return misc->annotation->isChecked(); } | 338 | bool miscannotation() { return misc->annotation->isChecked(); } |
259 | bool miscdictionary() { return misc->dictionary->isChecked(); } | 339 | bool miscdictionary() { return misc->dictionary->isChecked(); } |
260 | bool miscclipboard() { return misc->clipboard->isChecked(); } | 340 | bool miscclipboard() { return misc->clipboard->isChecked(); } |
261 | 341 | /* | |
262 | int spaceAction() { return button->spaceAction->currentItem(); } | 342 | int Debounce() { return button->debounce->value(); } |
263 | #ifdef USECOMBO | 343 | void Debounce(int v) { button->debounce->setValue(v); } |
264 | void spaceAction(int v) { button->spaceAction->setCurrentItem(v); } | 344 | */ |
265 | #else | 345 | /* |
266 | void spaceAction(int v) { button->spaceAction->select(v); } | ||
267 | #endif | ||
268 | int escapeAction() { return button->escapeAction->currentItem(); } | ||
269 | #ifdef USECOMBO | ||
270 | void escapeAction(int v) { button->escapeAction->setCurrentItem(v); } | ||
271 | #else | ||
272 | void escapeAction(int v) { button->escapeAction->select(v); } | ||
273 | #endif | ||
274 | int returnAction() { return button->returnAction->currentItem(); } | ||
275 | #ifdef USECOMBO | ||
276 | void returnAction(int v) { button->returnAction->setCurrentItem(v); } | ||
277 | #else | ||
278 | void returnAction(int v) { button->returnAction->select(v); } | ||
279 | #endif | ||
280 | int leftAction() { return button->leftAction->currentItem(); } | ||
281 | #ifdef USECOMBO | ||
282 | void leftAction(int v) { button->leftAction->setCurrentItem(v); } | ||
283 | #else | ||
284 | void leftAction(int v) { button->leftAction->select(v); } | ||
285 | #endif | ||
286 | int rightAction() { return button->rightAction->currentItem(); } | ||
287 | #ifdef USECOMBO | ||
288 | void rightAction(int v) { button->rightAction->setCurrentItem(v); } | ||
289 | #else | ||
290 | void rightAction(int v) { button->rightAction->select(v); } | ||
291 | #endif | ||
292 | int upAction() { return button->upAction->currentItem(); } | ||
293 | #ifdef USECOMBO | ||
294 | void upAction(int v) { button->upAction->setCurrentItem(v); } | ||
295 | #else | ||
296 | void upAction(int v) { button->upAction->select(v); } | ||
297 | #endif | ||
298 | int downAction() { return button->downAction->currentItem(); } | ||
299 | #ifdef USECOMBO | ||
300 | void downAction(int v) { button->downAction->setCurrentItem(v); } | ||
301 | #else | ||
302 | void downAction(int v) { button->downAction->select(v); } | ||
303 | #endif | ||
304 | bool leftScroll() { return button->leftScroll->isChecked(); } | 346 | bool leftScroll() { return button->leftScroll->isChecked(); } |
305 | void leftScroll(bool v) { button->leftScroll->setChecked(v); } | 347 | void leftScroll(bool v) { button->leftScroll->setChecked(v); } |
306 | bool rightScroll() { return button->rightScroll->isChecked(); } | 348 | bool rightScroll() { return button->rightScroll->isChecked(); } |
307 | void rightScroll(bool v) { button->rightScroll->setChecked(v); } | 349 | void rightScroll(bool v) { button->rightScroll->setChecked(v); } |
308 | bool upScroll() { return button->upScroll->isChecked(); } | 350 | bool upScroll() { return button->upScroll->isChecked(); } |
309 | void upScroll(bool v) { button->upScroll->setChecked(v); } | 351 | void upScroll(bool v) { button->upScroll->setChecked(v); } |
310 | bool downScroll() { return button->downScroll->isChecked(); } | 352 | bool downScroll() { return button->downScroll->isChecked(); } |
311 | void downScroll(bool v) { button->downScroll->setChecked(v); } | 353 | void downScroll(bool v) { button->downScroll->setChecked(v); } |
354 | */ | ||
312 | 355 | ||
313 | 356 | int gfxsize() { return layout2->gfxzoom->value()/10; } | |
314 | int gfxsize() { return layout2->gfxzoom->value(); } | 357 | void gfxsize(int v) { layout2->gfxzoom->setValue(10*v); } |
315 | void gfxsize(int v) { layout2->gfxzoom->setValue(v); } | ||
316 | int pageoverlap() { return layout2->pageoverlap->value(); } | 358 | int pageoverlap() { return layout2->pageoverlap->value(); } |
317 | void pageoverlap(int v) { layout2->pageoverlap->setValue(v); } | 359 | void pageoverlap(int v) { layout2->pageoverlap->setValue(v); } |
318 | 360 | ||
319 | bool twotouch() { return inter->twotouch->isChecked(); } | 361 | bool twotouch() { return inter->twotouch->isChecked(); } |
@@ -328,14 +370,16 @@ Q_OBJECT | |||
328 | bool propfontchange() { return inter->propfontchange->isChecked(); } | 370 | bool propfontchange() { return inter->propfontchange->isChecked(); } |
329 | void propfontchange(bool v) { inter->propfontchange->setChecked(v); } | 371 | void propfontchange(bool v) { inter->propfontchange->setChecked(v); } |
330 | 372 | ||
331 | int encoding() { return inter->encoding->currentItem(); } | 373 | int encoding() { return inter->encoding->currentItem(); } |
374 | int scrolltype() { return misc->scrolltype->currentItem(); } | ||
332 | #ifdef USECOMBO | 375 | #ifdef USECOMBO |
333 | void encoding(int v) { inter->encoding->setCurrentItem(v); } | 376 | void encoding(int v) { inter->encoding->setCurrentItem(v); } |
377 | void scrolltype(int v) { misc->scrolltype->setCurrentItem(v); } | ||
334 | #else | 378 | #else |
335 | void encoding(int v) { inter->encoding->select(v); } | 379 | void encoding(int v) { inter->encoding->select(v); } |
380 | void scrolltype(int v) { misc->scrolltype->select(v); } | ||
336 | #endif | 381 | #endif |
337 | 382 | void scrollstep(int v) { misc->scrollstep->setValue(v); } | |
338 | 383 | int scrollstep() { return misc->scrollstep->value(); } | |
339 | |||
340 | }; | 384 | }; |
341 | #endif // CPREFS_H | 385 | #endif // CPREFS_H |
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index b356ba5..dfdba28 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp | |||
@@ -7,10 +7,19 @@ | |||
7 | ** program may be used, distributed and modified without limitation. | 7 | ** program may be used, distributed and modified without limitation. |
8 | ** | 8 | ** |
9 | *****************************************************************************/ | 9 | *****************************************************************************/ |
10 | 10 | ||
11 | const int _SBARHEIGHT = 3; | ||
12 | |||
13 | #include "useqpe.h" | ||
14 | #include <qpainter.h> | ||
15 | //#include <qdirectpainter_qws.h> | ||
16 | #include <qimage.h> | ||
17 | #include <qtimer.h> | ||
18 | #include "config.h" | ||
11 | #include "QTReader.h" | 19 | #include "QTReader.h" |
12 | #include "QTReaderApp.h" | 20 | //#include "QTReaderApp.h" |
21 | #include "CDrawBuffer.h" | ||
13 | #ifdef USEQPE | 22 | #ifdef USEQPE |
14 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
15 | #endif | 24 | #endif |
16 | #include <math.h> | 25 | #include <math.h> |
@@ -21,8 +30,10 @@ | |||
21 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
22 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
23 | #include <qpe/qcopenvelope_qws.h> | 32 | #include <qpe/qcopenvelope_qws.h> |
24 | #endif | 33 | #endif |
34 | #include <qfileinfo.h> | ||
35 | #include <qdir.h> | ||
25 | 36 | ||
26 | #ifdef _UNICODE | 37 | #ifdef _UNICODE |
27 | const char *QTReader::fonts[] = { "unifont", "Courier", "Times", 0 }; | 38 | const char *QTReader::fonts[] = { "unifont", "Courier", "Times", 0 }; |
28 | #else | 39 | #else |
@@ -38,13 +49,18 @@ const char *QTReader::fonts[] = { "Helvetica", "Courier", "Times", 0 }; | |||
38 | tchar QTReader::pluckernextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; | 49 | tchar QTReader::pluckernextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; |
39 | tchar QTReader::jplucknextpart[] = { 'N','e','x','t',' ','P','a','r','t',' ','>','>',0 }; | 50 | tchar QTReader::jplucknextpart[] = { 'N','e','x','t',' ','P','a','r','t',' ','>','>',0 }; |
40 | //tchar QTReader::jplucknextpart[] = { 10,'#',10,'N','e','x','t',' ','P','a','r','t',' ','>','>',0 }; | 51 | //tchar QTReader::jplucknextpart[] = { 10,'#',10,'N','e','x','t',' ','P','a','r','t',' ','>','>',0 }; |
41 | 52 | ||
53 | |||
42 | QTReader::QTReader( QWidget *parent, const char *name, WFlags f) : | 54 | QTReader::QTReader( QWidget *parent, const char *name, WFlags f) : |
43 | QWidget(parent, name, f), | 55 | QWidget(parent, name, f), |
56 | m_default_fg(0,0,0), | ||
57 | m_default_bg(255,255,255), | ||
58 | m_bg(255,255,255), | ||
44 | m_delay(100), | 59 | m_delay(100), |
45 | m_scrolldy1(0), | 60 | m_scrolldy1(0), |
46 | m_scrolldy2(0), | 61 | m_scrolldy2(0), |
62 | m_totalscroll(0), | ||
47 | m_autoScroll(false), | 63 | m_autoScroll(false), |
48 | //textarray(NULL), | 64 | //textarray(NULL), |
49 | //locnarray(NULL), | 65 | //locnarray(NULL), |
50 | numlines(0), | 66 | numlines(0), |
@@ -56,13 +72,35 @@ QTReader::QTReader( QWidget *parent, const char *name, WFlags f) : | |||
56 | bDoUpdates(false), | 72 | bDoUpdates(false), |
57 | #ifdef _SCROLLPIPE | 73 | #ifdef _SCROLLPIPE |
58 | m_pipeout(NULL), | 74 | m_pipeout(NULL), |
59 | #endif | 75 | #endif |
60 | m_border(2) | 76 | m_left_border(2), |
77 | m_right_border(2), | ||
78 | m_rotated(true), | ||
79 | pBkmklist(NULL), | ||
80 | m_scrollpos(0), | ||
81 | // bNegative(false), | ||
82 | bInverse(false), | ||
83 | m_highlightfilter(NULL), | ||
84 | m_bgIsScaled(false), | ||
85 | m_scrollstep(2), | ||
86 | m_topmargin(5), | ||
87 | m_bottommargin(5), | ||
88 | m_reparastring("{\\n[\\n ]}"), | ||
89 | m_currentlinkstyle(NULL), | ||
90 | m_currentlinkoffset(-1), | ||
91 | m_currentlink(-1) | ||
61 | { | 92 | { |
62 | m_overlap = 1; | 93 | m_overlap = 1; |
63 | setKeyCompression ( true ); | 94 | setKeyCompression ( true ); |
95 | #ifdef DOUBLEBUFFER | ||
96 | dbuff = new QPixmap(); | ||
97 | dbp = new QPainter(); | ||
98 | // if (painter->isActive()) painter->end(); | ||
99 | // painter->begin(frame); | ||
100 | #endif | ||
64 | // init(); | 101 | // init(); |
102 | |||
65 | } | 103 | } |
66 | 104 | ||
67 | /* | 105 | /* |
68 | QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) : | 106 | QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) : |
@@ -79,9 +117,9 @@ QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *nam | |||
79 | bindenter(0), | 117 | bindenter(0), |
80 | m_fm(NULL) | 118 | m_fm(NULL) |
81 | { | 119 | { |
82 | init(); | 120 | init(); |
83 | // // odebug << "Load_file(1)" << oendl; | 121 | // // qDebug("Load_file(1)"); |
84 | load_file((const tchar*)filename); | 122 | load_file((const tchar*)filename); |
85 | } | 123 | } |
86 | */ | 124 | */ |
87 | 125 | ||
@@ -90,33 +128,51 @@ void QTReader::mouseMoveEvent(QMouseEvent* _e) | |||
90 | { | 128 | { |
91 | 129 | ||
92 | mouseUpOn = !(_e->pos().x() == -1); | 130 | mouseUpOn = !(_e->pos().x() == -1); |
93 | 131 | ||
94 | odebug << "MouseMove:[" << _e->pos().x() << ", " << _e->pos().y() << "]" << oendl; | 132 | qDebug("MouseMove:[%d, %d]", _e->pos().x(), _e->pos().y()); |
95 | } | 133 | } |
96 | */ | 134 | */ |
97 | long QTReader::real_delay() | 135 | long QTReader::real_delay() |
98 | { | 136 | { |
99 | return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing ); | 137 | return m_scrollstep*( 8976 + m_delay ) / ( m_linespacing * m_linespacing ); |
100 | } | 138 | } |
101 | 139 | ||
102 | void QTReader::mousePressEvent( QMouseEvent* _e ) | 140 | void QTReader::mousePressEvent( QMouseEvent* _e ) |
103 | { | 141 | { |
104 | buffdoc.unsuspend(); | 142 | buffdoc.unsuspend(); |
143 | int x, y, ht, wh; | ||
144 | if (m_rotated) | ||
145 | { | ||
146 | x = _e->y(); | ||
147 | y = width()-_e->x(); | ||
148 | ht = width(); | ||
149 | wh = height(); | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | x = _e->x(); | ||
154 | y = _e->y(); | ||
155 | ht = height(); | ||
156 | wh = width(); | ||
157 | } | ||
105 | if (_e->button() == RightButton) | 158 | if (_e->button() == RightButton) |
106 | { | 159 | { |
107 | //odebug << "MousePress" << oendl; | 160 | //qDebug("MousePress"); |
108 | mouseUpOn = false; | 161 | mouseUpOn = false; |
109 | if (m_swapmouse) | 162 | if (m_swapmouse) |
110 | { | 163 | { |
111 | int lineno = 0; | 164 | int lineno = 0; |
112 | int ht = textarray[0]->lineSpacing(); | 165 | /* |
113 | while ((ht < _e->y()) && (lineno < numlines)) | 166 | int hgt = textarray[0]->lineSpacing(); |
167 | while ((hgt < y) && (lineno < numlines)) | ||
114 | { | 168 | { |
115 | ht += textarray[++lineno]->lineSpacing(); | 169 | hgt += textarray[++lineno]->lineSpacing(); |
116 | } | 170 | } |
117 | size_t startpos, startoffset, tgt; | 171 | */ |
118 | getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt); | 172 | size_t startpos, startoffset, tgt, tgtoffset, pictgt; |
173 | QImage* img; | ||
174 | getcurrentpos(x, y, wh, ht, lineno, startpos, startoffset, tgt, tgtoffset, pictgt, img); | ||
119 | processmousewordevent(startpos, startoffset, _e, lineno); | 175 | processmousewordevent(startpos, startoffset, _e, lineno); |
120 | } | 176 | } |
121 | else | 177 | else |
122 | processmousepositionevent(_e); | 178 | processmousepositionevent(_e); |
@@ -124,25 +180,40 @@ void QTReader::mousePressEvent( QMouseEvent* _e ) | |||
124 | } | 180 | } |
125 | 181 | ||
126 | void QTReader::processmousepositionevent( QMouseEvent* _e ) | 182 | void QTReader::processmousepositionevent( QMouseEvent* _e ) |
127 | { | 183 | { |
184 | int x, y, ht, wh; | ||
185 | if (m_rotated) | ||
186 | { | ||
187 | x = _e->y(); | ||
188 | y = width()-_e->x(); | ||
189 | ht = width(); | ||
190 | wh = height(); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | x = _e->x(); | ||
195 | y = _e->y(); | ||
196 | ht = height(); | ||
197 | wh = width(); | ||
198 | } | ||
128 | if (buffdoc.hasnavigation()) | 199 | if (buffdoc.hasnavigation()) |
129 | { | 200 | { |
130 | if (_e->y() > (2*height())/3) | 201 | if (y > (2*ht)/3) |
131 | { | 202 | { |
132 | goDown(); | 203 | goDown(); |
133 | } | 204 | } |
134 | else if (_e->y() < height()/3) | 205 | else if (y < ht/3) |
135 | { | 206 | { |
136 | goUp(); | 207 | goUp(); |
137 | } | 208 | } |
138 | else | 209 | else |
139 | { | 210 | { |
140 | if (_e->x() < width()/3) | 211 | if (x < wh/3) |
141 | { | 212 | { |
142 | goBack(); | 213 | goBack(); |
143 | } | 214 | } |
144 | else if (_e->x() > (2*width())/3) | 215 | else if (x > (2*wh)/3) |
145 | { | 216 | { |
146 | goForward(); | 217 | goForward(); |
147 | } | 218 | } |
148 | else | 219 | else |
@@ -152,9 +223,9 @@ void QTReader::processmousepositionevent( QMouseEvent* _e ) | |||
152 | } | 223 | } |
153 | } | 224 | } |
154 | else | 225 | else |
155 | { | 226 | { |
156 | if (_e->y() > height()/2) | 227 | if (y > ht/2) |
157 | { | 228 | { |
158 | goDown(); | 229 | goDown(); |
159 | } | 230 | } |
160 | else | 231 | else |
@@ -171,75 +242,123 @@ void QTReader::goHome() | |||
171 | size_t current=pagelocate(); | 242 | size_t current=pagelocate(); |
172 | size_t home=buffdoc.getHome(); | 243 | size_t home=buffdoc.getHome(); |
173 | if (current!=home) | 244 | if (current!=home) |
174 | { | 245 | { |
175 | buffdoc.saveposn(current); | 246 | buffdoc.saveposn(m_lastfile, current); |
176 | locate(home); | 247 | locate(home); |
177 | } | 248 | } |
178 | } | 249 | } |
250 | else | ||
251 | locate(0); | ||
179 | } | 252 | } |
180 | 253 | ||
181 | void QTReader::goBack() | 254 | void QTReader::goBack() |
182 | { | 255 | { |
183 | if (buffdoc.hasnavigation()) | 256 | if (buffdoc.hasnavigation()) |
184 | { | 257 | { |
185 | size_t target = pagelocate(); | 258 | size_t target = pagelocate(); |
186 | buffdoc.writeposn(target); | 259 | QString nxt = m_lastfile; |
187 | if (buffdoc.back(target)) | 260 | buffdoc.writeposn(m_lastfile, target); |
261 | linkType lt = buffdoc.back(nxt, target); | ||
262 | if ((lt & eFile) != 0) | ||
188 | { | 263 | { |
189 | locate(target); | 264 | if (nxt != m_lastfile) |
265 | { | ||
266 | emit NewFileRequest(nxt); | ||
267 | } | ||
268 | locate(target); | ||
269 | } | ||
270 | else if ((lt & eLink) != 0) | ||
271 | { | ||
272 | locate(target); | ||
190 | } | 273 | } |
191 | } | 274 | } |
192 | } | 275 | } |
193 | 276 | ||
194 | void QTReader::goForward() | 277 | void QTReader::goForward() |
195 | { | 278 | { |
196 | if (buffdoc.hasnavigation()) | 279 | if (buffdoc.hasnavigation()) |
197 | { | 280 | { |
198 | size_t target = pagelocate(); | 281 | size_t target = pagelocate(); |
199 | if (buffdoc.forward(target)) | 282 | QString nxt = m_lastfile; |
283 | linkType lt = buffdoc.forward(nxt, target); | ||
284 | if ((lt & eFile) != 0) | ||
200 | { | 285 | { |
201 | locate(target); | 286 | if (nxt != m_lastfile) |
287 | { | ||
288 | emit NewFileRequest(nxt); | ||
289 | } | ||
290 | locate(target); | ||
291 | } | ||
292 | else if ((lt & eLink) != 0) | ||
293 | { | ||
294 | locate(target); | ||
202 | } | 295 | } |
203 | } | 296 | } |
204 | } | 297 | } |
205 | 298 | ||
206 | linkType QTReader::getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt) | 299 | linkType QTReader::getcurrentpos(int x, int y, int w, int h, int& lineno, size_t& start, size_t& offset, size_t& tgt, size_t& tgtoffset, size_t& pictgt, QImage*& img) |
207 | { | 300 | { |
208 | int lineno = 0; | 301 | int ht; |
209 | int ht = textarray[0]->lineSpacing(); | 302 | if (m_scrolldy == m_topmargin) |
210 | while ((ht < y) && (lineno < numlines)) | ||
211 | { | 303 | { |
212 | ht += textarray[++lineno]->lineSpacing(); | 304 | lineno = 0; |
305 | ht = textarray[0]->lineSpacing()-m_scrolldy1 + m_topmargin; | ||
213 | } | 306 | } |
214 | start = locnarray[lineno]; | 307 | else |
215 | if (m_bMonoSpaced) | 308 | { |
309 | if (y >= m_scrolldy) | ||
310 | { | ||
311 | lineno = 0; | ||
312 | ht = textarray[0]->lineSpacing()-m_scrolldy1+m_scrolldy + m_topmargin; | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | lineno = 0; | ||
317 | ht = textarray[0]->lineSpacing()-m_scrolldy1+m_scrolldy+m_topmargin; | ||
318 | while ((ht < h) && (lineno < numlines-1)) | ||
319 | { | ||
320 | ht += textarray[++lineno]->lineSpacing(); | ||
321 | } | ||
322 | ht = textarray[lineno]->lineSpacing(); | ||
323 | } | ||
324 | } | ||
325 | while ((ht < y) && (lineno < numlines-1)) | ||
216 | { | 326 | { |
217 | offset = (x - textarray[lineno]->offset(width(), m_border))/m_charWidth; | 327 | ht += textarray[++lineno]->lineSpacing(); |
218 | } | 328 | } |
219 | else | 329 | if (ht < y && textarray[numlines]->showPartial()) lineno = numlines; |
330 | start = locnarray[lineno]; | ||
331 | int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; | ||
332 | if (m_bMonoSpaced) | ||
220 | { | 333 | { |
221 | int i; | 334 | offset = (x - textarray[lineno]->offset(w, m_left_border, m_right_border, availht))/m_charWidth; |
222 | CDrawBuffer* t = textarray[lineno]; | ||
223 | x = x - t->offset(width(), m_border); | ||
224 | for (i = t->length(); i >= 0 && t->width(i, true, width(), m_border) > x; i--); | ||
225 | offset = i; | ||
226 | } | 335 | } |
227 | return textarray[lineno]->getLinkType(offset, tgt); | 336 | else |
337 | { | ||
338 | int i; | ||
339 | CDrawBuffer* t = textarray[lineno]; | ||
340 | x = x - t->offset(width(), m_left_border, m_right_border, availht); | ||
341 | for (i = t->length(); i > 0 && t->width(availht, i, true, w, m_left_border, m_right_border) > x; i--); | ||
342 | offset = i; | ||
343 | } | ||
344 | return textarray[lineno]->getLinkType(offset, tgt, tgtoffset, pictgt, img); | ||
228 | } | 345 | } |
229 | 346 | ||
230 | void QTReader::suspend() | 347 | void QTReader::suspend() |
231 | { | 348 | { |
232 | #ifdef OPIE | 349 | buffdoc.suspend(); |
350 | /*#ifdef OPIE | ||
233 | if (memcmp("/mnt/", m_lastfile.latin1(), 5) == 0) buffdoc.suspend(); | 351 | if (memcmp("/mnt/", m_lastfile.latin1(), 5) == 0) buffdoc.suspend(); |
234 | #else | 352 | #else |
235 | if (memcmp("/usr/mnt.rom/", m_lastfile.latin1(), 13) == 0) buffdoc.suspend(); | 353 | if (memcmp("/usr/mnt.rom/", m_lastfile.latin1(), 13) == 0) buffdoc.suspend(); |
236 | #endif | 354 | #endif |
355 | */ | ||
237 | } | 356 | } |
238 | 357 | ||
239 | void QTReader::setTwoTouch(bool _b) | 358 | void QTReader::setTwoTouch(bool _b) |
240 | { | 359 | { |
241 | setBackgroundColor( white ); | 360 | setBackgroundColor( m_bg ); |
242 | m_twotouch = m_touchone = _b; | 361 | m_twotouch = m_touchone = _b; |
243 | } | 362 | } |
244 | 363 | ||
245 | void QTReader::setContinuous(bool _b) | 364 | void QTReader::setContinuous(bool _b) |
@@ -249,9 +368,11 @@ void QTReader::setContinuous(bool _b) | |||
249 | } | 368 | } |
250 | 369 | ||
251 | void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) | 370 | void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) |
252 | { | 371 | { |
372 | unsigned long wrdstart, wrdend; | ||
253 | QString wrd; | 373 | QString wrd; |
374 | int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; | ||
254 | if (m_twotouch) | 375 | if (m_twotouch) |
255 | { | 376 | { |
256 | if (m_touchone) | 377 | if (m_touchone) |
257 | { | 378 | { |
@@ -262,9 +383,9 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
262 | } | 383 | } |
263 | else | 384 | else |
264 | { | 385 | { |
265 | m_touchone = true; | 386 | m_touchone = true; |
266 | setBackgroundColor( white ); | 387 | setBackgroundColor( m_bg ); |
267 | size_t endpos, endoffset; | 388 | size_t endpos, endoffset; |
268 | endpos = startpos; | 389 | endpos = startpos; |
269 | endoffset = startoffset; | 390 | endoffset = startoffset; |
270 | size_t currentpos = locate(); | 391 | size_t currentpos = locate(); |
@@ -274,8 +395,9 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
274 | for (int i = 0; i < m_startoffset; i++) | 395 | for (int i = 0; i < m_startoffset; i++) |
275 | { | 396 | { |
276 | getch(); | 397 | getch(); |
277 | } | 398 | } |
399 | wrdstart = buffdoc.explocate(); | ||
278 | if (m_startpos == endpos) | 400 | if (m_startpos == endpos) |
279 | { | 401 | { |
280 | for (int i = m_startoffset; i <= endoffset; i++) | 402 | for (int i = m_startoffset; i <= endoffset; i++) |
281 | { | 403 | { |
@@ -292,15 +414,19 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
292 | { | 414 | { |
293 | wrd += QChar(getch()); | 415 | wrd += QChar(getch()); |
294 | } | 416 | } |
295 | } | 417 | } |
418 | wrdend = buffdoc.explocate(); | ||
296 | jumpto(currentpos); | 419 | jumpto(currentpos); |
297 | } | 420 | } |
298 | } | 421 | } |
299 | } | 422 | } |
300 | else if (m_bMonoSpaced) | 423 | else if (m_bMonoSpaced) |
301 | { | 424 | { |
302 | int chno = (_e->x()-textarray[lineno]->offset(width(), m_border))/m_charWidth; | 425 | int chno = (m_rotated) ? |
426 | (_e->y()-textarray[lineno]->offset(height(), m_left_border, m_right_border, availht))/m_charWidth | ||
427 | : | ||
428 | (_e->x()-textarray[lineno]->offset(width(), m_left_border, m_right_border, availht))/m_charWidth; | ||
303 | if (chno < ustrlen(textarray[lineno]->data())) | 429 | if (chno < ustrlen(textarray[lineno]->data())) |
304 | { | 430 | { |
305 | wrd[0] = textarray[lineno]->data()[chno]; | 431 | wrd[0] = textarray[lineno]->data()[chno]; |
306 | } | 432 | } |
@@ -308,17 +434,20 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
308 | else | 434 | else |
309 | { | 435 | { |
310 | CDrawBuffer* t = textarray[lineno]; | 436 | CDrawBuffer* t = textarray[lineno]; |
311 | int first = 0; | 437 | int first = 0; |
312 | int tgt = _e->x() - t->offset(width(), m_border); | 438 | int tgt = (m_rotated) ? |
439 | _e->y() - t->offset(height(), m_left_border, m_right_border, availht) : | ||
440 | _e->x() - t->offset(width(), m_left_border, m_right_border, availht); | ||
313 | while (1) | 441 | while (1) |
314 | { | 442 | { |
315 | int i = first+1; | 443 | int i = first+1; |
444 | int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; | ||
316 | while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; | 445 | while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; |
317 | if (t->width(i, true, width(), m_border) > tgt) | 446 | if (t->width(availht, i, true, (m_rotated) ? height() : width(), m_left_border, m_right_border) > tgt) |
318 | { | 447 | { |
319 | wrd = toQString(t->data()+first, i - first); | 448 | wrd = toQString(t->data()+first, i - first); |
320 | // odebug << "Got " << (const char *)wrd << "" << oendl; | 449 | // qDebug("Got %s", (const char *)wrd); |
321 | break; | 450 | break; |
322 | } | 451 | } |
323 | while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; | 452 | while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; |
324 | if ((*t)[i] == 0) break; | 453 | if ((*t)[i] == 0) break; |
@@ -326,94 +455,210 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
326 | } | 455 | } |
327 | } | 456 | } |
328 | if (!wrd.isEmpty()) | 457 | if (!wrd.isEmpty()) |
329 | { | 458 | { |
330 | //odebug << "Selected:" << wrd << "" << oendl; | 459 | qDebug("Selecteed:%s", (const char*)wrd); |
331 | emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data())); | 460 | if (m_twotouch) |
461 | { | ||
462 | emit OnWordSelected(wrd, wrdstart, wrdend, wrd); | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | QString line = toQString(textarray[lineno]->data()); | ||
467 | emit OnWordSelected(wrd, locnarray[lineno], locnarray[lineno]+line.length(), line); | ||
468 | } | ||
332 | } | 469 | } |
333 | } | 470 | } |
334 | 471 | ||
335 | void QTReader::mouseReleaseEvent( QMouseEvent* _e ) | 472 | void QTReader::mouseReleaseEvent( QMouseEvent* _e ) |
336 | { | 473 | { |
337 | buffdoc.unsuspend(); | 474 | buffdoc.unsuspend(); |
475 | int x, y, ht, wh; | ||
476 | if (m_rotated) | ||
477 | { | ||
478 | x = _e->y(); | ||
479 | y = width()-_e->x(); | ||
480 | ht = width(); | ||
481 | wh = height(); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | x = _e->x(); | ||
486 | y = _e->y(); | ||
487 | ht = height(); | ||
488 | wh = width(); | ||
489 | } | ||
338 | if (_e->button() == LeftButton) | 490 | if (_e->button() == LeftButton) |
339 | { | 491 | { |
340 | if (mouseUpOn) | 492 | if (mouseUpOn) |
341 | { | 493 | { |
342 | // odebug << "MouseRelease" << oendl; | 494 | // qDebug("MouseRelease"); |
343 | if (_e->x() > width() - m_border) | 495 | switch(m_scrollpos) |
344 | { | 496 | { |
345 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height()); | 497 | case 1: // Bottom |
346 | return; | 498 | if (y > ht - 5) |
499 | { | ||
500 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*x+wh/2)/wh); | ||
501 | return; | ||
502 | } | ||
503 | break; | ||
504 | case 2: // right | ||
505 | if (x > wh - m_right_border) | ||
506 | { | ||
507 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*y+ht/2)/ht); | ||
508 | return; | ||
509 | } | ||
510 | break; | ||
511 | case 3: // left | ||
512 | if (x < m_left_border) | ||
513 | { | ||
514 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*y+ht/2)/ht); | ||
515 | return; | ||
516 | } | ||
517 | break; | ||
518 | case 0: | ||
519 | default: | ||
520 | break; | ||
347 | } | 521 | } |
348 | if (textarray[0] != NULL) | 522 | if (textarray[0] != NULL) |
349 | { | 523 | { |
350 | QString line; | 524 | QString line; |
351 | // int lineno = _e->y()/m_linespacing; | 525 | // int lineno = _e->y()/m_linespacing; |
352 | int lineno = 0; | 526 | int lineno = 0; |
527 | /* | ||
353 | int ht = textarray[0]->lineSpacing(); | 528 | int ht = textarray[0]->lineSpacing(); |
354 | while ((ht < _e->y()) && (lineno < numlines)) | 529 | while ((ht < y) && (lineno < numlines)) |
355 | { | 530 | { |
356 | ht += textarray[++lineno]->lineSpacing(); | 531 | ht += textarray[++lineno]->lineSpacing(); |
357 | } | 532 | } |
358 | size_t startpos, startoffset, tgt; | 533 | */ |
359 | switch (getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt)) | 534 | size_t startpos, startoffset, tgt, tgtoffset, pictgt; |
360 | { | 535 | QImage* img; |
361 | case eLink: | 536 | if (m_currentlinkstyle != NULL) |
362 | { | 537 | { |
363 | size_t saveposn = pagelocate(); | 538 | textarray[m_currentlink]->invertLink(m_currentlinkoffset); |
364 | QString href; | 539 | m_currentlinkstyle = NULL; |
365 | linkType lt = buffdoc.hyperlink(tgt, href); | 540 | m_currentlink = -1; |
366 | if (lt == eLink) | 541 | m_currentlinkoffset = -1; |
542 | } | ||
543 | linkType glt = getcurrentpos(x, y, wh, ht, lineno, startpos, startoffset, tgt, tgtoffset, pictgt, img); | ||
544 | if ((glt & eLink) != 0) | ||
545 | { | ||
546 | if ((glt & ePicture) != 0) | ||
547 | { | ||
548 | qDebug("Big Picture:%x", pictgt); | ||
549 | if (QMessageBox::warning(this, PROGNAME, "Show picture or goto link?", "Show", "Goto Link") == 0) | ||
550 | { | ||
551 | QImage* pm = buffdoc.getPicture(pictgt); | ||
552 | if (pm != NULL) | ||
553 | { | ||
554 | emit OnShowPicture(*pm); | ||
555 | delete pm; | ||
556 | return; | ||
557 | } | ||
558 | } | ||
559 | } | ||
560 | else if (img != NULL) | ||
561 | { | ||
562 | if (QMessageBox::warning(this, PROGNAME, "Show picture or goto link?", "Show", "Goto Link") == 0) | ||
563 | { | ||
564 | emit OnShowPicture(*img); | ||
565 | return; | ||
566 | } | ||
567 | } | ||
568 | size_t saveposn = pagelocate(); | ||
569 | QString href, nm; | ||
570 | linkType lt = buffdoc.hyperlink(tgt, tgtoffset, href, nm); | ||
571 | qDebug("URL(1):%s", (const char*)href); | ||
572 | if ((lt & eFile) != 0) | ||
573 | { | ||
574 | buffdoc.saveposn(m_lastfile, saveposn); | ||
575 | #ifdef USEQPE | ||
367 | { | 576 | { |
368 | buffdoc.saveposn(saveposn); | 577 | QCopEnvelope e("QPE/System", "busy()"); |
369 | fillbuffer(); | ||
370 | update(); | ||
371 | } | 578 | } |
372 | else | 579 | #endif |
373 | { | 580 | ResetScroll(); |
374 | if (lt == ePicture) | 581 | if (!href.isEmpty()) |
375 | { | 582 | { |
376 | QImage* pm = buffdoc.getPicture(tgt); | 583 | if (!buffdoc.getFile(href)) |
377 | if (pm != NULL) | 584 | { |
378 | { | 585 | emit NewFileRequest(href); |
379 | emit OnShowPicture(*pm); | 586 | } |
380 | delete pm; | ||
381 | } | ||
382 | } | ||
383 | else | 587 | else |
384 | { | 588 | { |
385 | // QString anchortext = textarray[lineno]->getanchortext(startoffset); | 589 | ResetScroll(); |
386 | if (!href.isEmpty()) | 590 | fillbuffer(); |
387 | { | 591 | update(); |
388 | emit OnURLSelected(href); | 592 | } |
389 | } | 593 | } |
390 | } | 594 | if (!nm.isEmpty()) |
391 | locate(pagelocate()); | 595 | { |
392 | } | 596 | qDebug("QTReader:Finding %s", (const char*)nm); |
393 | return; | 597 | if (buffdoc.findanchor(nm)) |
394 | } | 598 | { |
395 | case ePicture: | 599 | fillbuffer(); |
396 | { | 600 | update(); |
397 | // odebug << "Picture:" << tgt << "" << oendl; | 601 | } |
398 | QImage* pm = buffdoc.getPicture(tgt); | 602 | } |
399 | if (pm != NULL) | 603 | //fillbuffer(); |
604 | //update(); | ||
605 | #ifdef USEQPE | ||
400 | { | 606 | { |
401 | emit OnShowPicture(*pm); | 607 | QCopEnvelope e("QPE/System", "notBusy()"); |
402 | delete pm; | ||
403 | } | 608 | } |
609 | #endif | ||
610 | } | ||
611 | else if ((lt & eLink) != 0) | ||
612 | { | ||
613 | buffdoc.saveposn(m_lastfile, saveposn); | ||
614 | ResetScroll(); | ||
615 | fillbuffer(); | ||
616 | update(); | ||
617 | } | ||
618 | else | ||
619 | { | ||
620 | if ((lt & ePicture) != 0) | ||
621 | { | ||
622 | QImage* pm = buffdoc.getPicture(tgt); | ||
623 | if (pm != NULL) | ||
624 | { | ||
625 | emit OnShowPicture(*pm); | ||
626 | delete pm; | ||
627 | } | ||
628 | } | ||
404 | else | 629 | else |
405 | { | 630 | { |
406 | locate(pagelocate()); | 631 | // QString anchortext = textarray[lineno]->getanchortext(startoffset); |
407 | } | 632 | if (!href.isEmpty()) |
408 | return; | 633 | { |
409 | } | 634 | emit OnURLSelected(href, tgt); |
410 | case eNone: | 635 | } |
411 | break; | 636 | } |
412 | default: | 637 | locate(pagelocate()); |
413 | // odebug << "Unknown linktype" << oendl; | 638 | } |
414 | return; | 639 | return; |
415 | } | 640 | } |
641 | else if ((glt & ePicture) != 0) | ||
642 | { | ||
643 | qDebug("Big Picture:%x", pictgt); | ||
644 | QImage* pm = buffdoc.getPicture(pictgt); | ||
645 | if (pm != NULL) | ||
646 | { | ||
647 | emit OnShowPicture(*pm); | ||
648 | delete pm; | ||
649 | } | ||
650 | else | ||
651 | { | ||
652 | locate(pagelocate()); | ||
653 | } | ||
654 | return; | ||
655 | } | ||
656 | else if (img != NULL) | ||
657 | { | ||
658 | emit OnShowPicture(*img); | ||
659 | return; | ||
660 | } | ||
416 | if (m_swapmouse) | 661 | if (m_swapmouse) |
417 | processmousepositionevent(_e); | 662 | processmousepositionevent(_e); |
418 | else | 663 | else |
419 | processmousewordevent(startpos, startoffset, _e, lineno); | 664 | processmousewordevent(startpos, startoffset, _e, lineno); |
@@ -440,8 +685,10 @@ void QTReader::focusOutEvent(QFocusEvent* e) | |||
440 | //m_scrolldy1 = m_scrolldy2 = 0; | 685 | //m_scrolldy1 = m_scrolldy2 = 0; |
441 | } | 686 | } |
442 | } | 687 | } |
443 | 688 | ||
689 | #include <qapplication.h> | ||
690 | #include <qdrawutil.h> | ||
444 | #ifndef _WINDOWS | 691 | #ifndef _WINDOWS |
445 | #include <unistd.h> | 692 | #include <unistd.h> |
446 | #endif | 693 | #endif |
447 | 694 | ||
@@ -513,28 +760,26 @@ void QTReader::zoomin() | |||
513 | { | 760 | { |
514 | if (m_fontControl.increasesize()) | 761 | if (m_fontControl.increasesize()) |
515 | { | 762 | { |
516 | bool sc = m_autoScroll; | 763 | bool sc = m_autoScroll; |
764 | setautoscroll(false); | ||
517 | setfont(); | 765 | setfont(); |
518 | m_autoScroll = false; | ||
519 | locate(pagelocate()); | 766 | locate(pagelocate()); |
520 | update(); | 767 | repaint(); |
521 | m_autoScroll = sc; | 768 | setautoscroll(sc); |
522 | if (m_autoScroll) autoscroll(); | ||
523 | } | 769 | } |
524 | } | 770 | } |
525 | 771 | ||
526 | void QTReader::zoomout() | 772 | void QTReader::zoomout() |
527 | { | 773 | { |
528 | if (m_fontControl.decreasesize()) | 774 | if (m_fontControl.decreasesize()) |
529 | { | 775 | { |
530 | bool sc = m_autoScroll; | 776 | bool sc = m_autoScroll; |
531 | m_autoScroll = false; | 777 | setautoscroll(false); |
532 | setfont(); | 778 | setfont(); |
533 | locate(pagelocate()); | 779 | locate(pagelocate()); |
534 | update(); | 780 | repaint(); |
535 | m_autoScroll = sc; | 781 | setautoscroll(sc); |
536 | if (m_autoScroll) autoscroll(); | ||
537 | } | 782 | } |
538 | } | 783 | } |
539 | 784 | ||
540 | void QTReader::reduceScroll() | 785 | void QTReader::reduceScroll() |
@@ -551,23 +796,25 @@ void QTReader::reduceScroll() | |||
551 | } | 796 | } |
552 | 797 | ||
553 | void QTReader::increaseScroll() | 798 | void QTReader::increaseScroll() |
554 | { | 799 | { |
555 | if (m_delay > 1024) | 800 | if (m_delay > 454) |
556 | { | 801 | { |
557 | m_delay = (2*m_delay)/3; | 802 | m_delay = (2*m_delay)/3; |
558 | timer->changeInterval(real_delay()); | 803 | timer->changeInterval(real_delay()); |
559 | } | 804 | } |
560 | else | 805 | else |
561 | { | 806 | { |
562 | m_delay = 1024; | 807 | m_delay = 454; |
563 | } | 808 | } |
564 | } | 809 | } |
565 | 810 | ||
566 | void QTReader::keyPressEvent(QKeyEvent* e) | 811 | void QTReader::keyPressEvent(QKeyEvent* e) |
567 | { | 812 | { |
568 | buffdoc.unsuspend(); | 813 | buffdoc.unsuspend(); |
569 | ((QTReaderApp*)parent()->parent())->handlekey(e); | 814 | |
815 | //((QTReaderApp*)parent()->parent())->handlekey(e); | ||
816 | emit HandleKeyRequest(e); | ||
570 | // e->ignore(); | 817 | // e->ignore(); |
571 | return; | 818 | return; |
572 | #ifdef _SCROLLPIPE | 819 | #ifdef _SCROLLPIPE |
573 | if (m_isPaused) | 820 | if (m_isPaused) |
@@ -580,9 +827,10 @@ void QTReader::keyPressEvent(QKeyEvent* e) | |||
580 | { | 827 | { |
581 | pclose(m_pipeout); | 828 | pclose(m_pipeout); |
582 | m_pipeout = NULL; | 829 | m_pipeout = NULL; |
583 | } | 830 | } |
584 | ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); | 831 | //((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); |
832 | emit SetScrollState(m_autoScroll); | ||
585 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 833 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
586 | } | 834 | } |
587 | else | 835 | else |
588 | { | 836 | { |
@@ -591,85 +839,71 @@ void QTReader::keyPressEvent(QKeyEvent* e) | |||
591 | e->accept(); | 839 | e->accept(); |
592 | return; | 840 | return; |
593 | } | 841 | } |
594 | #endif | 842 | #endif |
595 | /* | 843 | } |
596 | switch (e->key()) | 844 | |
845 | void QTReader::CalculateScrollParameters() | ||
846 | { | ||
847 | int bmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0); | ||
848 | if (bmargin < m_bottommargin) bmargin = m_bottommargin; | ||
849 | switch (m_scrolltype) | ||
597 | { | 850 | { |
598 | case Key_Down: | 851 | case 0: |
599 | { | 852 | { |
600 | e->accept(); | 853 | if (m_scrolldy == m_topmargin) |
601 | if (m_autoScroll) | ||
602 | { | 854 | { |
603 | if (m_delay < 59049) | 855 | m_scrolldy1 = 0; |
604 | { | 856 | m_scrolldy2 = 0; |
605 | m_delay = (3*m_delay)/2; | 857 | m_totalscroll = 0; |
606 | timer->changeInterval(real_delay()); | 858 | return; |
607 | } | ||
608 | else | ||
609 | { | ||
610 | m_delay = 59049; | ||
611 | } | ||
612 | } | 859 | } |
613 | else | 860 | if (m_scrolldy < textarray[0]->lineSpacing()) |
614 | { | 861 | { |
615 | goDown(); | 862 | m_scrolldy2 = m_scrolldy; |
863 | return; | ||
616 | } | 864 | } |
617 | } | 865 | int ht = m_scrolldy - m_scrolldy1; |
618 | break; | 866 | int i; |
619 | case Key_Up: | 867 | for (i = 0; (ht < ((m_rotated) ? width() : height())-bmargin) && (i < numlines); i++) |
620 | { | ||
621 | e->accept(); | ||
622 | if (m_autoScroll) | ||
623 | { | 868 | { |
624 | if (m_delay > 1024) | 869 | ht += textarray[i]->lineSpacing(); |
625 | { | ||
626 | m_delay = (2*m_delay)/3; | ||
627 | timer->changeInterval(real_delay()); | ||
628 | } | ||
629 | else | ||
630 | { | ||
631 | m_delay = 1024; | ||
632 | } | ||
633 | } | 870 | } |
634 | else | 871 | ht = 0; |
872 | int j; | ||
873 | i--; | ||
874 | for (j = i; j < numlines; j++) | ||
635 | { | 875 | { |
636 | goUp(); | 876 | ht += textarray[j]->lineSpacing(); |
637 | } | 877 | } |
638 | } | 878 | ht -= ( |
879 | textarray[i]->lineExtraSpacing() | ||
880 | + | ||
881 | (i != 0) ? textarray[numlines-1]->lineExtraSpacing() : 0 | ||
882 | )/2-2; | ||
883 | |||
884 | m_scrolldy2 = m_scrolldy-ht; | ||
885 | } | ||
886 | break; | ||
887 | case 1: | ||
888 | case 2: | ||
889 | case 3: | ||
890 | { | ||
891 | int ypos = m_topmargin; | ||
892 | for (int i = 0; i < numlines; i++) | ||
893 | { | ||
894 | ypos += textarray[i]->lineSpacing(); | ||
895 | } | ||
896 | ypos -= ( | ||
897 | textarray[0]->lineExtraSpacing() | ||
898 | + | ||
899 | ((numlines > 1) ? textarray[numlines-1]->lineExtraSpacing() : 0) | ||
900 | )/2 + | ||
901 | m_scrolldy1 - 2; | ||
902 | m_scrolldy2 = ((m_rotated) ? width() : height()) - ypos - bmargin; | ||
903 | } | ||
639 | break; | 904 | break; |
640 | case Key_Right: | ||
641 | { | ||
642 | e->accept(); | ||
643 | if (m_navkeys && buffdoc.hasnavigation()) | ||
644 | { | ||
645 | size_t target = pagelocate(); | ||
646 | if (buffdoc.forward(target)) | ||
647 | { | ||
648 | locate(target); | ||
649 | } | ||
650 | } | ||
651 | else zoomin(); | ||
652 | } | ||
653 | break; | ||
654 | case Key_Left: | ||
655 | { | ||
656 | e->accept(); | ||
657 | if (m_navkeys && buffdoc.hasnavigation()) | ||
658 | { | ||
659 | size_t target = pagelocate(); | ||
660 | if (buffdoc.back(target)) | ||
661 | { | ||
662 | locate(target); | ||
663 | } | ||
664 | } | ||
665 | else zoomout(); | ||
666 | } | ||
667 | break; | ||
668 | default: | ||
669 | e->ignore(); | ||
670 | } | 905 | } |
671 | */ | ||
672 | } | 906 | } |
673 | 907 | ||
674 | void QTReader::setautoscroll(bool _sc) | 908 | void QTReader::setautoscroll(bool _sc) |
675 | { | 909 | { |
@@ -686,18 +920,22 @@ void QTReader::setautoscroll(bool _sc) | |||
686 | pclose(m_pipeout); | 920 | pclose(m_pipeout); |
687 | m_pipeout = NULL; | 921 | m_pipeout = NULL; |
688 | } | 922 | } |
689 | #endif | 923 | #endif |
924 | //m_scrolldy1 = 0; | ||
925 | //refresh(); | ||
690 | } | 926 | } |
691 | else | 927 | else |
692 | { | 928 | { |
693 | CDrawBuffer* reusebuffer = textarray[numlines]; | 929 | CDrawBuffer* reusebuffer = textarray[numlines]; |
694 | if (reusebuffer == NULL || reusebuffer->eof()) return; | 930 | if (reusebuffer == NULL || reusebuffer->eof()) return; |
695 | m_autoScroll = true; | 931 | m_autoScroll = true; |
932 | CalculateScrollParameters(); | ||
933 | |||
696 | #ifdef _SCROLLPIPE | 934 | #ifdef _SCROLLPIPE |
697 | if (!m_pipetarget.isEmpty()) | 935 | if (!m_pipetarget.isEmpty()) |
698 | { | 936 | { |
699 | // odebug << "Opening pipe to " << m_pipetarget << "" << oendl; | 937 | // qDebug("Opening pipe to %s", (const char*)m_pipetarget); |
700 | m_pipeout = popen((const char*)m_pipetarget, "w"); | 938 | m_pipeout = popen((const char*)m_pipetarget, "w"); |
701 | m_isPaused = false; | 939 | m_isPaused = false; |
702 | } | 940 | } |
703 | #endif | 941 | #endif |
@@ -710,16 +948,20 @@ void QTReader::setautoscroll(bool _sc) | |||
710 | 948 | ||
711 | bool QTReader::getline(CDrawBuffer *buff) | 949 | bool QTReader::getline(CDrawBuffer *buff) |
712 | { | 950 | { |
713 | buffdoc.unsuspend(); | 951 | buffdoc.unsuspend(); |
952 | bool bRet; | ||
953 | int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; | ||
714 | if (m_bMonoSpaced) | 954 | if (m_bMonoSpaced) |
715 | { | 955 | { |
716 | return buffdoc.getline(buff ,width(), m_charWidth, m_border); | 956 | bRet = buffdoc.getline(buff ,(m_rotated) ? height() : width(), m_charWidth, m_left_border, m_right_border, availht); |
717 | } | 957 | } |
718 | else | 958 | else |
719 | { | 959 | { |
720 | return buffdoc.getline(buff, width(), m_border); | 960 | bRet = buffdoc.getline(buff, (m_rotated) ? height() : width(), m_left_border, m_right_border, hyphenate, availht); |
721 | } | 961 | } |
962 | buff->resize(availht); | ||
963 | return bRet; | ||
722 | } | 964 | } |
723 | 965 | ||
724 | void QTReader::doscroll() | 966 | void QTReader::doscroll() |
725 | { | 967 | { |
@@ -727,16 +969,250 @@ void QTReader::doscroll() | |||
727 | { | 969 | { |
728 | timer->stop(); | 970 | timer->stop(); |
729 | return; | 971 | return; |
730 | } | 972 | } |
731 | // timer->changeInterval(real_delay()); | 973 | switch (m_scrolltype) |
974 | { | ||
975 | case 0: | ||
976 | doinplacescroll(); | ||
977 | break; | ||
978 | case 1: | ||
979 | dorollingscroll(false); | ||
980 | break; | ||
981 | case 2: | ||
982 | dorollingscroll(true); | ||
983 | break; | ||
984 | case 3: | ||
985 | dostaticscroll(); | ||
986 | break; | ||
987 | } | ||
988 | } | ||
989 | |||
990 | void QTReader::doinplacescroll() | ||
991 | { | ||
992 | QPainter p( this ); | ||
993 | // p.setBackgroundMode(OpaqueMode); | ||
994 | int wh, ht; | ||
995 | int bmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0); | ||
996 | if (bmargin < m_bottommargin) bmargin = m_bottommargin; | ||
997 | if (m_rotated) | ||
998 | { | ||
999 | ht = width()-bmargin; | ||
1000 | wh = height(); | ||
1001 | } | ||
1002 | else | ||
1003 | { | ||
1004 | ht = height()-bmargin; | ||
1005 | wh = width(); | ||
1006 | } | ||
1007 | int lastdy = m_scrolldy; | ||
1008 | m_scrolldy += m_scrollstep; | ||
1009 | if ((m_scrolldy1 = m_scrolldy1+m_scrollstep) >= textarray[0]->lineSpacing()) | ||
1010 | { | ||
1011 | int ht = textarray[0]->lineSpacing(); | ||
1012 | #ifdef _SCROLLPIPE | ||
1013 | if (m_pipeout != NULL) | ||
1014 | { | ||
1015 | QString outstr = toQString(textarray[0]->data()); | ||
1016 | if (!outstr.isEmpty()) | ||
1017 | { | ||
1018 | fprintf(m_pipeout, "%s\n", (const char*)outstr); | ||
1019 | fflush(m_pipeout); | ||
1020 | } | ||
1021 | else if (m_pauseAfterEachPara) | ||
1022 | { | ||
1023 | m_isPaused = true; | ||
1024 | timer->stop(); | ||
1025 | } | ||
1026 | } | ||
1027 | #endif | ||
1028 | CDrawBuffer* buff = textarray[0]; | ||
1029 | for (int i = 1; i <= numlines; i++) | ||
1030 | { | ||
1031 | textarray[i-1] = textarray[i]; | ||
1032 | locnarray[i-1] = locnarray[i]; | ||
1033 | } | ||
1034 | textarray[numlines] = buff; | ||
1035 | --numlines; | ||
1036 | m_scrolldy1 -= ht; | ||
1037 | } | ||
1038 | if ((m_scrolldy2 = m_scrolldy2+m_scrollstep) >= textarray[numlines]->lineSpacing()) | ||
1039 | { | ||
1040 | m_scrolldy2 -= textarray[numlines]->lineSpacing(); | ||
1041 | numlines++; | ||
1042 | |||
1043 | if (textarray[numlines] == NULL) | ||
1044 | { | ||
1045 | textarray[numlines] = new CDrawBuffer(&m_fontControl); | ||
1046 | } | ||
1047 | locnarray[numlines] = locate(); | ||
1048 | int ch = getline(textarray[numlines]); | ||
1049 | if (m_rotated) | ||
1050 | { | ||
1051 | blitRot(width()-m_scrolldy, 0, height(), -1, textarray[numlines-1]); | ||
1052 | } | ||
1053 | else | ||
1054 | { | ||
1055 | if (m_bgpm.isNull()) | ||
1056 | { | ||
1057 | p.fillRect(m_left_border,m_scrolldy-textarray[numlines-1]->lineSpacing(),width()-(m_left_border+m_right_border),textarray[numlines-1]->lineSpacing(),m_bg); | ||
1058 | } | ||
1059 | else | ||
1060 | { | ||
1061 | int h_tmp = textarray[numlines-1]->lineSpacing(); | ||
1062 | bitBlt(this, m_left_border, m_scrolldy-h_tmp, dbuff, m_left_border, m_scrolldy-h_tmp, width()-(m_left_border+m_right_border), h_tmp); | ||
1063 | } | ||
1064 | textarray[numlines-1]->render(&p, m_scrolldy -textarray[numlines-1]->lineSpacing()+ textarray[numlines-1]->ascent(), m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); | ||
1065 | } | ||
1066 | mylastpos = locate(); | ||
1067 | if (!ch) | ||
1068 | { | ||
1069 | /* | ||
1070 | if (m_rotated) | ||
1071 | { | ||
1072 | blitRot2(0,0,height(),width()-m_scrolldy,NULL); | ||
1073 | // blitRot2(0,0,0,height(),width()-m_scrolldy,NULL); | ||
1074 | } | ||
1075 | else | ||
1076 | { | ||
1077 | if (m_bgpm.isNull()) | ||
1078 | { | ||
1079 | p.fillRect(0,m_scrolldy,width(),height()-m_scrolldy,m_bg); | ||
1080 | } | ||
1081 | else | ||
1082 | { | ||
1083 | bitBlt(this, 0, m_scrolldy, dbuff, 0, m_scrolldy, width(), height()-m_scrolldy); | ||
1084 | } | ||
1085 | } | ||
1086 | */ | ||
1087 | m_scrolldy = m_topmargin; | ||
1088 | m_autoScroll = false; | ||
1089 | #ifdef _SCROLLPIPE | ||
1090 | for (int i = 0; i < numlines; i++) | ||
1091 | { | ||
1092 | if (m_pipeout != NULL) | ||
1093 | { | ||
1094 | QString outstr = toQString(textarray[i]->data()); | ||
1095 | if (!outstr.isEmpty()) | ||
1096 | { | ||
1097 | fprintf(m_pipeout, "%s\n", (const char*)outstr); | ||
1098 | fflush(m_pipeout); | ||
1099 | } | ||
1100 | } | ||
1101 | } | ||
1102 | #endif | ||
1103 | //((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); | ||
1104 | emit SetScrollState(m_autoScroll); | ||
1105 | #ifdef USEQPE | ||
1106 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
1107 | #endif | ||
1108 | } | ||
1109 | if (m_scrolldy > ht-textarray[numlines]->lineSpacing()) | ||
1110 | { | ||
1111 | if (m_rotated) | ||
1112 | { | ||
1113 | if (m_bgpm.isNull()) | ||
1114 | { | ||
1115 | p.fillRect(bmargin, m_left_border, ht-m_scrolldy, wh-(m_left_border+m_right_border), m_bg); | ||
1116 | } | ||
1117 | else | ||
1118 | { | ||
1119 | blitRot(bmargin, 0,height(), ht-m_scrolldy, NULL); | ||
1120 | } | ||
1121 | } | ||
1122 | else | ||
1123 | if (m_bgpm.isNull()) | ||
1124 | { | ||
1125 | p.fillRect(m_left_border,m_scrolldy,width()-(m_left_border+m_right_border),height()-m_scrolldy,m_bg); | ||
1126 | } | ||
1127 | else | ||
1128 | { | ||
1129 | bitBlt(this,m_left_border,m_scrolldy,dbuff,m_left_border,m_scrolldy,width()-(m_left_border+m_right_border), height()-m_scrolldy); | ||
1130 | } | ||
1131 | m_scrolldy = m_topmargin; | ||
1132 | m_scrolldy2 = 0; | ||
1133 | } | ||
1134 | redrawScroll(&p); | ||
1135 | emitRedraw(); | ||
1136 | lastdy = -1; | ||
1137 | } | ||
1138 | // else | ||
1139 | { | ||
1140 | if (m_rotated) | ||
1141 | { | ||
1142 | if (lastdy >= 0) | ||
1143 | { | ||
1144 | if (m_bgpm.isNull()) | ||
1145 | { | ||
1146 | p.fillRect(width()-lastdy, m_left_border, m_scrollstep, wh-(m_left_border+m_right_border),m_bg); | ||
1147 | } | ||
1148 | else | ||
1149 | { | ||
1150 | blitRot(width()-lastdy,m_left_border,wh-(m_left_border+m_right_border), m_scrollstep, NULL); | ||
1151 | } | ||
1152 | } | ||
1153 | p.fillRect(width()-m_scrolldy, m_left_border, 1,wh-(m_left_border+m_right_border),m_scrollcolor); | ||
1154 | } | ||
1155 | else | ||
1156 | { | ||
1157 | if (lastdy >= 0) | ||
1158 | { | ||
1159 | if (m_bgpm.isNull()) | ||
1160 | { | ||
1161 | p.fillRect(m_left_border,lastdy,width()-(m_left_border+m_right_border),m_scrollstep,m_bg); | ||
1162 | } | ||
1163 | else | ||
1164 | { | ||
1165 | bitBlt(this, m_left_border, lastdy, dbuff, m_left_border, lastdy, width()-(m_left_border+m_right_border), m_scrollstep); | ||
1166 | } | ||
1167 | } | ||
1168 | p.fillRect(m_left_border,m_scrolldy,width()-(m_left_border+m_right_border),1,m_scrollcolor); | ||
1169 | } | ||
1170 | } | ||
1171 | } | ||
1172 | |||
1173 | void QTReader::dorollingscroll(bool _statbord) | ||
1174 | { | ||
1175 | bool bredrawscroll = false; | ||
732 | QPainter p( this ); | 1176 | QPainter p( this ); |
733 | QBrush b( white); | 1177 | // 2 = right, 3 = left |
734 | bitBlt(this,0,0,this,0,1,width(),-1); | 1178 | int tmargin = (_statbord) ? m_topmargin : 0; |
735 | qDrawPlainRect(&p,0,height() - 2,width(),2,white,1,&b); | 1179 | int lmargin = (m_scrollpos == 3 || _statbord) ? m_left_border : 0; |
1180 | int rmargin = (m_scrollpos == 2 || _statbord) ? m_right_border : 0; | ||
1181 | int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0); | ||
1182 | if (hmargin < m_bottommargin) hmargin = m_bottommargin; | ||
1183 | if (m_rotated) | ||
1184 | { | ||
1185 | m_totalscroll = (m_totalscroll+m_scrollstep) % width(); | ||
1186 | bitBlt(this, m_scrollstep+hmargin, lmargin, this, hmargin, lmargin, width()-tmargin-hmargin, height()-(lmargin+rmargin)); | ||
1187 | if (!m_bgpm.isNull()) | ||
1188 | { | ||
1189 | blitRot(hmargin, tmargin, height(), m_scrollstep, NULL); | ||
1190 | } | ||
1191 | else | ||
1192 | { | ||
1193 | p.fillRect(hmargin, rmargin, m_scrollstep, height()-lmargin-rmargin, m_bg); | ||
1194 | } | ||
1195 | } | ||
1196 | else | ||
1197 | { | ||
1198 | m_totalscroll = (m_totalscroll+m_scrollstep) % height(); | ||
1199 | bitBlt(this,lmargin,tmargin,this,lmargin,tmargin+m_scrollstep,width()-(lmargin+rmargin),height() - tmargin - hmargin - m_scrollstep); | ||
1200 | if (m_bgpm.isNull()) | ||
1201 | { | ||
1202 | p.fillRect(0, height() - (m_scrollstep+1) - hmargin, width(), (m_scrollstep+1), m_bg); | ||
1203 | } | ||
1204 | else | ||
1205 | { | ||
1206 | int loff = (_statbord) ? 0 : m_totalscroll; | ||
1207 | bitBlt(this,0,height() - (m_scrollstep+1) - hmargin, dbuff, 0, (loff+height() - (m_scrollstep+1) - hmargin) % height(), width(), (m_scrollstep+1)); | ||
1208 | } | ||
1209 | } | ||
736 | 1210 | ||
737 | if (++m_scrolldy1 == textarray[0]->lineSpacing()) | 1211 | if ((m_scrolldy1 = m_scrolldy1+m_scrollstep) >= textarray[0]->lineSpacing()) |
738 | { | 1212 | { |
1213 | int ht = textarray[0]->lineSpacing(); | ||
1214 | bredrawscroll = true; | ||
739 | #ifdef _SCROLLPIPE | 1215 | #ifdef _SCROLLPIPE |
740 | if (m_pipeout != NULL) | 1216 | if (m_pipeout != NULL) |
741 | { | 1217 | { |
742 | QString outstr = toQString(textarray[0]->data()); | 1218 | QString outstr = toQString(textarray[0]->data()); |
@@ -749,11 +1225,8 @@ void QTReader::doscroll() | |||
749 | { | 1225 | { |
750 | m_isPaused = true; | 1226 | m_isPaused = true; |
751 | timer->stop(); | 1227 | timer->stop(); |
752 | } | 1228 | } |
753 | // write(m_pipeout, (const char*)outstr, outstr.length()); | ||
754 | // write(m_pipeout, "\n", 1); | ||
755 | // fputc(10, m_pipeout); | ||
756 | } | 1229 | } |
757 | #endif | 1230 | #endif |
758 | CDrawBuffer* buff = textarray[0]; | 1231 | CDrawBuffer* buff = textarray[0]; |
759 | for (int i = 1; i <= numlines; i++) | 1232 | for (int i = 1; i <= numlines; i++) |
@@ -762,25 +1235,37 @@ void QTReader::doscroll() | |||
762 | locnarray[i-1] = locnarray[i]; | 1235 | locnarray[i-1] = locnarray[i]; |
763 | } | 1236 | } |
764 | textarray[numlines] = buff; | 1237 | textarray[numlines] = buff; |
765 | --numlines; | 1238 | --numlines; |
766 | m_scrolldy1 = 0; | 1239 | m_scrolldy1 -= ht; |
767 | } | 1240 | } |
768 | if (++m_scrolldy2 == textarray[numlines]->lineSpacing()) | 1241 | if ((m_scrolldy2 = m_scrolldy2+m_scrollstep) >= textarray[numlines]->lineSpacing()) |
769 | { | 1242 | { |
770 | m_scrolldy2 = 0; | 1243 | bredrawscroll = true; |
1244 | m_scrolldy2 -= textarray[numlines]->lineSpacing(); | ||
771 | numlines++; | 1245 | numlines++; |
772 | 1246 | ||
773 | if (textarray[numlines] == NULL) | 1247 | if (textarray[numlines] == NULL) |
774 | { | 1248 | { |
775 | textarray[numlines] = new CDrawBuffer(&m_fontControl); | 1249 | textarray[numlines] = new CDrawBuffer(&m_fontControl); |
776 | } | 1250 | } |
777 | locnarray[numlines] = locate(); | 1251 | locnarray[numlines] = locate(); |
778 | int ch = getline(textarray[numlines]); | 1252 | int ch = getline(textarray[numlines]); |
779 | textarray[numlines-1]->render(&p, height() - textarray[numlines-1]->descent() - 2, m_bMonoSpaced, m_charWidth, width(), m_border); | 1253 | if (m_rotated) |
1254 | { | ||
1255 | blitRot(hmargin, 0, height(), -1, textarray[numlines-1]); | ||
1256 | } | ||
1257 | else | ||
1258 | { | ||
1259 | // textarray[numlines-1]->render(&p, height() - textarray[numlines-1]->descent() - 2 - hmargin, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg); | ||
1260 | textarray[numlines-1]->render(&p, height() - textarray[numlines-1]->descent() - textarray[numlines-1]->lineExtraSpacing() - 1 - hmargin, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); | ||
1261 | |||
1262 | } | ||
780 | mylastpos = locate(); | 1263 | mylastpos = locate(); |
781 | if (!ch) | 1264 | if (!ch) |
782 | { | 1265 | { |
1266 | redrawScroll(&p); | ||
1267 | emitRedraw(); | ||
783 | m_autoScroll = false; | 1268 | m_autoScroll = false; |
784 | #ifdef _SCROLLPIPE | 1269 | #ifdef _SCROLLPIPE |
785 | for (int i = 0; i < numlines; i++) | 1270 | for (int i = 0; i < numlines; i++) |
786 | { | 1271 | { |
@@ -794,20 +1279,226 @@ void QTReader::doscroll() | |||
794 | } | 1279 | } |
795 | } | 1280 | } |
796 | } | 1281 | } |
797 | #endif | 1282 | #endif |
798 | ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); | 1283 | emit SetScrollState(m_autoScroll); |
799 | #ifdef USEQPE | 1284 | #ifdef USEQPE |
800 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 1285 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
801 | #endif | 1286 | #endif |
1287 | return; | ||
802 | } | 1288 | } |
803 | emit OnRedraw(); | ||
804 | } | 1289 | } |
1290 | if (!bredrawscroll && ((m_scrolldy2/m_scrollstep) % 10 == 5) && textarray[numlines]->showPartial()) | ||
1291 | { | ||
1292 | if (m_rotated) | ||
1293 | { | ||
1294 | blitRot(hmargin + m_scrolldy2 - textarray[numlines]->lineSpacing(), 0, height(), -1, textarray[numlines]); | ||
1295 | } | ||
1296 | else | ||
1297 | { | ||
1298 | textarray[numlines]->render( &p, height() + textarray[numlines]->lineSpacing() - textarray[numlines]->descent() - 2 - hmargin-m_scrolldy2, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); | ||
1299 | } | ||
1300 | } | ||
1301 | if (m_scrollpos != 0) | ||
1302 | { | ||
1303 | redrawScroll(&p); | ||
1304 | } | ||
1305 | if (bredrawscroll) emitRedraw(); | ||
1306 | } | ||
1307 | |||
1308 | void QTReader::dostaticscroll() | ||
1309 | { | ||
1310 | redrawall(); | ||
1311 | bool bredraw = false; | ||
1312 | if ((m_scrolldy1 = m_scrolldy1+m_scrollstep) >= textarray[0]->lineSpacing()) | ||
1313 | { | ||
1314 | int ht = textarray[0]->lineSpacing(); | ||
1315 | bredraw = true; | ||
1316 | #ifdef _SCROLLPIPE | ||
1317 | if (m_pipeout != NULL) | ||
1318 | { | ||
1319 | QString outstr = toQString(textarray[0]->data()); | ||
1320 | if (!outstr.isEmpty()) | ||
1321 | { | ||
1322 | fprintf(m_pipeout, "%s\n", (const char*)outstr); | ||
1323 | fflush(m_pipeout); | ||
1324 | } | ||
1325 | else if (m_pauseAfterEachPara) | ||
1326 | { | ||
1327 | m_isPaused = true; | ||
1328 | timer->stop(); | ||
1329 | } | ||
1330 | } | ||
1331 | #endif | ||
1332 | CDrawBuffer* buff = textarray[0]; | ||
1333 | for (int i = 1; i <= numlines; i++) | ||
1334 | { | ||
1335 | textarray[i-1] = textarray[i]; | ||
1336 | locnarray[i-1] = locnarray[i]; | ||
1337 | } | ||
1338 | textarray[numlines] = buff; | ||
1339 | --numlines; | ||
1340 | m_scrolldy1 -= ht; | ||
1341 | } | ||
1342 | if ((m_scrolldy2 = m_scrolldy2 + m_scrollstep) >= textarray[numlines]->lineSpacing()) | ||
1343 | { | ||
1344 | bredraw = true; | ||
1345 | m_scrolldy2 -= textarray[numlines]->lineSpacing(); | ||
1346 | numlines++; | ||
1347 | |||
1348 | if (textarray[numlines] == NULL) | ||
1349 | { | ||
1350 | textarray[numlines] = new CDrawBuffer(&m_fontControl); | ||
1351 | } | ||
1352 | locnarray[numlines] = locate(); | ||
1353 | int ch = getline(textarray[numlines]); | ||
1354 | mylastpos = locate(); | ||
1355 | if (!ch) | ||
1356 | { | ||
1357 | redrawall(); | ||
1358 | emitRedraw(); | ||
1359 | m_autoScroll = false; | ||
1360 | #ifdef _SCROLLPIPE | ||
1361 | for (int i = 0; i < numlines; i++) | ||
1362 | { | ||
1363 | if (m_pipeout != NULL) | ||
1364 | { | ||
1365 | QString outstr = toQString(textarray[i]->data()); | ||
1366 | if (!outstr.isEmpty()) | ||
1367 | { | ||
1368 | fprintf(m_pipeout, "%s\n", (const char*)outstr); | ||
1369 | fflush(m_pipeout); | ||
1370 | } | ||
1371 | } | ||
1372 | } | ||
1373 | #endif | ||
1374 | emit SetScrollState(m_autoScroll); | ||
1375 | #ifdef USEQPE | ||
1376 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
1377 | #endif | ||
1378 | return; | ||
1379 | } | ||
1380 | } | ||
1381 | if (bredraw) emitRedraw(); | ||
1382 | } | ||
1383 | |||
1384 | void QTReader::redrawScroll(QPainter* p) | ||
1385 | { | ||
1386 | int offset = (m_scrolltype == 1) ? m_totalscroll : 0; | ||
1387 | switch (m_scrollpos) | ||
1388 | { | ||
1389 | case 1: | ||
1390 | { | ||
1391 | int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0); | ||
1392 | if (hmargin < m_bottommargin) hmargin = m_bottommargin; | ||
1393 | if (m_rotated) | ||
1394 | { | ||
1395 | if (m_bgpm.isNull()) | ||
1396 | { | ||
1397 | p->fillRect(0,0,hmargin,height(),m_bg); | ||
1398 | } | ||
1399 | else | ||
1400 | { | ||
1401 | blitRot(0,0, height(), hmargin, NULL); | ||
1402 | } | ||
1403 | } | ||
1404 | else | ||
1405 | { | ||
1406 | if (m_bgpm.isNull()) | ||
1407 | { | ||
1408 | p->fillRect(0,height() - hmargin,width(),hmargin,m_bg); | ||
1409 | } | ||
1410 | else | ||
1411 | { | ||
1412 | int toffset = (offset+height()-hmargin) % height(); | ||
1413 | if (toffset+hmargin > height()) | ||
1414 | { | ||
1415 | int fp = height()-toffset; | ||
1416 | bitBlt(this, | ||
1417 | 0,height() - hmargin, | ||
1418 | dbuff, | ||
1419 | 0, toffset, width(), fp); | ||
1420 | bitBlt(this, | ||
1421 | 0,height()-hmargin+fp, | ||
1422 | dbuff, | ||
1423 | 0, 0, width(), hmargin-fp); | ||
1424 | } | ||
1425 | else | ||
1426 | { | ||
1427 | bitBlt(this, | ||
1428 | 0,height() - hmargin, | ||
1429 | dbuff, | ||
1430 | 0, toffset, width(), hmargin); | ||
1431 | } | ||
1432 | } | ||
1433 | } | ||
1434 | } | ||
1435 | break; | ||
1436 | case 2: //right | ||
1437 | if (m_rotated) | ||
1438 | { | ||
1439 | if (m_bgpm.isNull()) | ||
1440 | { | ||
1441 | p->fillRect(0,height()-m_right_border,width(),m_right_border,m_bg); | ||
1442 | } | ||
1443 | else | ||
1444 | { | ||
1445 | blitRot(0,height()-m_right_border, m_right_border, width(), NULL); | ||
1446 | } | ||
1447 | } | ||
1448 | else | ||
1449 | { | ||
1450 | if (m_bgpm.isNull()) | ||
1451 | { | ||
1452 | p->fillRect(width()-m_right_border,0,m_right_border,height(),m_bg); | ||
1453 | } | ||
1454 | else | ||
1455 | { | ||
1456 | int x = width() - m_right_border; | ||
1457 | int fp = height()-offset; | ||
1458 | bitBlt(this, x, 0, dbuff, x, offset, m_right_border, fp); | ||
1459 | bitBlt(this, x, fp, dbuff, x, 0, m_right_border, height()-fp); | ||
1460 | } | ||
1461 | } | ||
1462 | break; | ||
1463 | case 3: //left | ||
1464 | if (m_rotated) | ||
1465 | { | ||
1466 | if (m_bgpm.isNull()) | ||
1467 | { | ||
1468 | p->fillRect(0,0,width(),m_left_border,m_bg); | ||
1469 | } | ||
1470 | else | ||
1471 | { | ||
1472 | blitRot(0,0, m_left_border, width(), NULL); | ||
1473 | } | ||
1474 | } | ||
1475 | else | ||
1476 | { | ||
1477 | if (m_bgpm.isNull()) | ||
1478 | { | ||
1479 | p->fillRect(0,0,m_left_border,height(),m_bg); | ||
1480 | } | ||
1481 | else | ||
1482 | { | ||
1483 | int fp = height()-offset; | ||
1484 | bitBlt(this, 0, 0, dbuff, 0, offset, m_left_border, fp); | ||
1485 | bitBlt(this, 0, fp, dbuff, 0, 0, m_left_border, height()-fp); | ||
1486 | } | ||
1487 | } | ||
1488 | break; | ||
1489 | case 0: | ||
1490 | default: | ||
1491 | break; | ||
1492 | } | ||
1493 | if (m_scrollpos != 0) DrawScroll(p, width(), height()); | ||
805 | } | 1494 | } |
806 | 1495 | ||
807 | void QTReader::autoscroll() | 1496 | void QTReader::autoscroll() |
808 | { | 1497 | { |
809 | timer->start(real_delay(), false); | 1498 | drawBackground(); |
1499 | dbp->end(); | ||
1500 | timer->start(real_delay(), false); | ||
810 | } | 1501 | } |
811 | 1502 | ||
812 | void QTReader::setfont() | 1503 | void QTReader::setfont() |
813 | { | 1504 | { |
@@ -818,91 +1509,388 @@ void QTReader::setfont() | |||
818 | m_descent = m_fontControl.descent(); | 1509 | m_descent = m_fontControl.descent(); |
819 | m_linespacing = m_fontControl.lineSpacing(); | 1510 | m_linespacing = m_fontControl.lineSpacing(); |
820 | } | 1511 | } |
821 | 1512 | ||
822 | void QTReader::drawFonts( QPainter *p ) | 1513 | void QTReader::DrawStraight(QPainter* p, int w, int h) |
1514 | { | ||
1515 | if (m_scrolldy == m_topmargin) | ||
1516 | { | ||
1517 | int ypos = textarray[0]->ascent()-m_scrolldy1+m_topmargin; | ||
1518 | textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin); | ||
1519 | int i; | ||
1520 | for (i = 1; i < numlines; i++) | ||
1521 | { | ||
1522 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ | ||
1523 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; | ||
1524 | textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin); | ||
1525 | } | ||
1526 | if (textarray[i]->showPartial()) | ||
1527 | { | ||
1528 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ | ||
1529 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; | ||
1530 | textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin); | ||
1531 | } | ||
1532 | } | ||
1533 | else | ||
1534 | { | ||
1535 | int ypos = textarray[0]->ascent()-m_scrolldy1+m_scrolldy+m_topmargin; | ||
1536 | textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin); | ||
1537 | // p->fillRect(m_border, 0, w-2*m_border, m_scrolldy, m_bg); | ||
1538 | for (int i = 1; i < numlines; i++) | ||
1539 | { | ||
1540 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ | ||
1541 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; | ||
1542 | if (ypos+textarray[i]->descent() > h) | ||
1543 | { | ||
1544 | ypos = textarray[i]->ascent(); | ||
1545 | } | ||
1546 | textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin); | ||
1547 | } | ||
1548 | p->fillRect(m_left_border,m_scrolldy,w-(m_left_border+m_right_border),1,m_scrollcolor); | ||
1549 | } | ||
1550 | bool wasrotated = m_rotated; | ||
1551 | m_rotated = false; | ||
1552 | DrawScroll(p, w, h); | ||
1553 | m_rotated = wasrotated; | ||
1554 | |||
1555 | } | ||
1556 | |||
1557 | void QTReader::redrawall() | ||
1558 | { | ||
1559 | if (m_rotated) | ||
1560 | { | ||
1561 | #ifdef DOUBLEBUFFER | ||
1562 | drawBackground(); | ||
1563 | DrawStraight(dbp, height(), width()); | ||
1564 | dbp->end(); | ||
1565 | |||
1566 | QWMatrix m; | ||
1567 | m.rotate(90); | ||
1568 | QPixmap rp = dbuff->xForm(m); | ||
1569 | bitBlt(this, 0,0,&rp,0,0,-1,-1); | ||
1570 | #else | ||
1571 | QPixmap dbuff(height(), width()); | ||
1572 | QPainter dbp(&dbuff); | ||
1573 | // dbp.setBackgroundMode(OpaqueMode); | ||
1574 | dbp.fillRect(dbuff.rect(), m_bg); | ||
1575 | |||
1576 | DrawStraight(&dbp, height(), width()); | ||
1577 | |||
1578 | QWMatrix m; | ||
1579 | m.rotate(90); | ||
1580 | QPixmap rp = dbuff.xForm(m); | ||
1581 | bitBlt(this, 0,0,&rp,0,0,-1,-1); | ||
1582 | #endif | ||
1583 | } | ||
1584 | else | ||
1585 | { | ||
1586 | #ifdef DOUBLEBUFFER | ||
1587 | drawBackground(); | ||
1588 | DrawStraight(dbp, width(), height()); | ||
1589 | dbp->end(); | ||
1590 | bitBlt(this, 0,0,dbuff,0,0,-1,-1); | ||
1591 | #else | ||
1592 | DrawStraight(p, width(), height()); | ||
1593 | #endif | ||
1594 | } | ||
1595 | } | ||
1596 | |||
1597 | void QTReader::drawFonts() | ||
823 | { | 1598 | { |
824 | if (bDoUpdates) | 1599 | if (bDoUpdates) |
825 | { | 1600 | { |
826 | //odebug << "How refreshing..." << oendl; | 1601 | int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0); |
1602 | if (hmargin < m_bottommargin) hmargin = m_bottommargin; | ||
1603 | //qDebug("How refreshing..."); | ||
827 | if (buffdoc.empty()) return; | 1604 | if (buffdoc.empty()) return; |
828 | setfont(); | 1605 | setfont(); |
1606 | //if (!m_autoScroll) m_scrolldy1 = 0; | ||
1607 | #ifdef ROTATION_ENABLED | ||
1608 | if (m_lastwidth != ((m_rotated) ? height() : width())) | ||
1609 | { | ||
1610 | m_scrolldy = m_topmargin; | ||
1611 | // qDebug("Not Optimised %d", m_lastwidth); | ||
1612 | m_lastwidth = ((m_rotated) ? height() : width()); | ||
1613 | m_lastheight = ((m_rotated) ? width() : height()); | ||
1614 | buffdoc.setwidth(m_lastwidth-(m_left_border+m_right_border)); | ||
1615 | locate(pagelocate()); | ||
1616 | // qDebug("Not Optimised %d", m_lastwidth); | ||
1617 | } | ||
1618 | else | ||
1619 | { | ||
1620 | int newht = ((m_rotated) ? width() : height()); | ||
1621 | if (m_lastheight > newht) | ||
1622 | { | ||
1623 | // qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht); | ||
1624 | m_scrolldy = m_topmargin; | ||
1625 | int ypos = m_scrolldy1+m_topmargin; | ||
1626 | for (int i = 0; i < numlines; i++) | ||
1627 | { | ||
1628 | if ((ypos += textarray[i]->lineSpacing()) > newht - hmargin) | ||
1629 | { | ||
1630 | numlines = i; | ||
1631 | jumpto(mylastpos = locnarray[i+1]); | ||
1632 | break; | ||
1633 | } | ||
1634 | } | ||
1635 | // qDebug("Optimised < %d", numlines); | ||
1636 | m_lastheight = newht; | ||
1637 | } | ||
1638 | else if (m_lastheight < newht) | ||
1639 | { | ||
1640 | m_scrolldy = m_topmargin; | ||
1641 | // qDebug("Optimised > %d", numlines); | ||
1642 | int ypos = m_scrolldy1+m_topmargin; | ||
1643 | for (int i = 0; i <= numlines; i++) | ||
1644 | { | ||
1645 | ypos += textarray[i]->lineSpacing(); | ||
1646 | } | ||
1647 | fillbuffer(numlines+1, ypos, newht); | ||
1648 | // qDebug("Optimised > %d", numlines); | ||
1649 | } | ||
1650 | if (numlines > 0) | ||
1651 | { | ||
1652 | redrawall(); | ||
1653 | } | ||
1654 | } | ||
1655 | #else | ||
829 | if (m_lastwidth != width()) | 1656 | if (m_lastwidth != width()) |
830 | { | 1657 | { |
831 | // odebug << "Not Optimised " << m_lastwidth << "" << oendl; | 1658 | // qDebug("Not Optimised %d", m_lastwidth); |
832 | m_lastwidth = width(); | 1659 | m_lastwidth = width(); |
833 | m_lastheight = height(); | 1660 | m_lastheight = height(); |
834 | buffdoc.setwidth(m_lastwidth-2*m_border); | 1661 | buffdoc.setwidth(m_lastwidth-(m_left_border+m_right_border)); |
835 | locate(pagelocate()); | 1662 | locate(pagelocate()); |
836 | // odebug << "Not Optimised " << m_lastwidth << "" << oendl; | 1663 | // qDebug("Not Optimised %d", m_lastwidth); |
837 | } | 1664 | } |
838 | else | 1665 | else |
839 | { | 1666 | { |
840 | int newht = height(); | 1667 | int newht = height(); |
841 | if (m_lastheight > newht) | 1668 | if (m_lastheight > newht) |
842 | { | 1669 | { |
843 | // odebug << "Optimised < " << numlines << " " << m_lastheight << " " << newht << "" << oendl; | 1670 | // qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht); |
844 | int ypos = 0; | 1671 | int ypos = m_topmargin; |
845 | for (int i = 0; i < numlines; i++) | 1672 | for (int i = 0; i < numlines; i++) |
846 | { | 1673 | { |
847 | if ((ypos += textarray[i]->lineSpacing()) > newht) | 1674 | if ((ypos += textarray[i]->lineSpacing()) > newht - hmargin) |
848 | { | 1675 | { |
849 | numlines = i; | 1676 | numlines = i; |
850 | jumpto(mylastpos = locnarray[i+1]); | 1677 | jumpto(mylastpos = locnarray[i+1]); |
851 | break; | 1678 | break; |
852 | } | 1679 | } |
853 | } | 1680 | } |
854 | // odebug << "Optimised < " << numlines << "" << oendl; | 1681 | // qDebug("Optimised < %d", numlines); |
855 | m_lastheight = newht; | 1682 | m_lastheight = newht; |
856 | } | 1683 | } |
857 | else if (m_lastheight < newht) | 1684 | else if (m_lastheight < newht) |
858 | { | 1685 | { |
859 | // odebug << "Optimised > " << numlines << "" << oendl; | 1686 | // qDebug("Optimised > %d", numlines); |
860 | int ypos = 0; | 1687 | int ypos = m_topmargin; |
861 | for (int i = 0; i <= numlines; i++) | 1688 | for (int i = 0; i <= numlines; i++) |
862 | { | 1689 | { |
863 | ypos += textarray[i]->lineSpacing(); | 1690 | ypos += textarray[i]->lineSpacing(); |
864 | } | 1691 | } |
865 | fillbuffer(numlines+1, ypos, newht); | 1692 | fillbuffer(numlines+1, ypos, newht); |
866 | // odebug << "Optimised > " << numlines << "" << oendl; | 1693 | // qDebug("Optimised > %d", numlines); |
867 | } | 1694 | } |
868 | if (numlines > 0) | 1695 | if (numlines > 0) |
869 | { | 1696 | { |
870 | int ypos = textarray[0]->ascent(); | 1697 | int ypos = textarray[0]->ascent()+m_topmargin; |
871 | textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border); | 1698 | textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); |
872 | // int last = (m_showlast) ? numlines : numlines-1; | 1699 | // int last = (m_showlast) ? numlines : numlines-1; |
873 | // for (int i = 1; i <= last; i++) | 1700 | // for (int i = 1; i <= last; i++) |
874 | for (int i = 1; i < numlines; i++) | 1701 | for (int i = 1; i < numlines; i++) |
875 | { | 1702 | { |
876 | // ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2; | 1703 | // ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2; |
877 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ | 1704 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ |
878 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; | 1705 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; |
879 | textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border); | 1706 | textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); |
880 | } | 1707 | } |
881 | // mylastpos = locate(); | 1708 | // mylastpos = locate(); |
882 | } | 1709 | } |
883 | } | 1710 | } |
1711 | #endif | ||
1712 | emitRedraw(); | ||
1713 | } | ||
1714 | /* | ||
1715 | else | ||
1716 | { | ||
1717 | qDebug("Not so refreshing..."); | ||
1718 | } | ||
1719 | */ | ||
1720 | } | ||
884 | 1721 | ||
885 | m_scrolldy1 = m_scrolldy2 = m_scrollpart; | 1722 | void QTReader::DrawScroll( QPainter *p, int _w, int _h ) |
886 | if (m_border > 5 && !buffdoc.empty()) | 1723 | { |
1724 | if (!buffdoc.empty()) | ||
1725 | { | ||
1726 | QBrush checkered = QBrush( Dense4Pattern ); | ||
1727 | checkered.setColor(m_scrollbarcolor); | ||
1728 | switch (m_scrollpos) | ||
1729 | { | ||
1730 | case 1: | ||
1731 | if (m_rotated) | ||
1732 | { | ||
1733 | p->fillRect(0, 0, 2, _h, checkered); | ||
1734 | } | ||
1735 | else | ||
1736 | { | ||
1737 | p->fillRect(0, _h-2, _w, 2, checkered); | ||
1738 | } | ||
1739 | break; | ||
1740 | case 2: | ||
1741 | if (m_rotated) | ||
1742 | { | ||
1743 | p->fillRect(0, _h-2, _w, 2, checkered); | ||
1744 | } | ||
1745 | else | ||
1746 | { | ||
1747 | p->fillRect(_w-2, 0, 2, _h, checkered); | ||
1748 | } | ||
1749 | break; | ||
1750 | case 3: | ||
1751 | if (m_rotated) | ||
1752 | { | ||
1753 | p->fillRect(0, 0, _w, 2, checkered); | ||
1754 | } | ||
1755 | else | ||
1756 | { | ||
1757 | p->fillRect(0, 0, 2, _h, checkered); | ||
1758 | } | ||
1759 | break; | ||
1760 | case 0: | ||
1761 | default: | ||
1762 | break; | ||
1763 | } | ||
1764 | switch (m_scrollpos) | ||
887 | { | 1765 | { |
888 | p->fillRect(width()-2, 0, 2, height(), cyan); | 1766 | case 1: |
1767 | { | ||
1768 | int ht; | ||
1769 | if (m_rotated) | ||
1770 | { | ||
1771 | ht = _h; | ||
1772 | } | ||
1773 | else | ||
1774 | { | ||
1775 | ht = _w; | ||
1776 | } | ||
1777 | int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); | ||
1778 | int mid = (ht*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); | ||
1779 | int sliderheight = ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize; | ||
1780 | int sliderpos; | ||
1781 | if (sliderheight < 10) | ||
1782 | { | ||
1783 | sliderheight = 10; | ||
1784 | sliderpos = mid-5; | ||
1785 | } | ||
1786 | else | ||
1787 | { | ||
1788 | sliderpos = (ht*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize; | ||
1789 | } | ||
1790 | if (m_rotated) | ||
1791 | { | ||
1792 | p->fillRect(0, sliderpos, 3, sliderheight, m_scrollbarcolor); | ||
1793 | } | ||
1794 | else | ||
1795 | { | ||
1796 | p->fillRect(sliderpos, _h-3, sliderheight, 3, m_scrollbarcolor); | ||
1797 | } | ||
1798 | } | ||
1799 | break; | ||
1800 | case 2: | ||
1801 | case 3: | ||
1802 | { | ||
1803 | int ht; | ||
1804 | if (m_rotated) | ||
1805 | { | ||
1806 | ht = _w; | ||
1807 | } | ||
1808 | else | ||
1809 | { | ||
1810 | ht = _h; | ||
1811 | } | ||
889 | int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); | 1812 | int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); |
890 | int mid = (height()*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); | 1813 | int mid = (ht*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); |
891 | p->fillRect(width()-2, mid-5, 2, 10, yellow); | 1814 | int sliderheight = ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize; |
892 | p->fillRect(width()-2, (height()*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*height()+sectionsize/2)/sectionsize, magenta); | 1815 | int sliderpos; |
1816 | if (sliderheight < 10) | ||
1817 | { | ||
1818 | sliderheight = 10; | ||
1819 | sliderpos = mid-5; | ||
1820 | } | ||
1821 | else | ||
1822 | { | ||
1823 | sliderpos = (ht*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize; | ||
1824 | } | ||
1825 | if (m_rotated) | ||
1826 | { | ||
1827 | int hoff; | ||
1828 | if (m_scrollpos == 2) //right | ||
1829 | { | ||
1830 | hoff = _h-3; | ||
1831 | } | ||
1832 | else | ||
1833 | { | ||
1834 | hoff = 0; | ||
1835 | } | ||
1836 | p->fillRect(ht-sliderpos-sliderheight, hoff, sliderheight, 3, m_scrollbarcolor); | ||
1837 | } | ||
1838 | else | ||
1839 | { | ||
1840 | int hoff; | ||
1841 | if (m_scrollpos == 2) //right | ||
1842 | { | ||
1843 | hoff = _w-3; | ||
1844 | } | ||
1845 | else | ||
1846 | { | ||
1847 | hoff = 0; | ||
1848 | } | ||
1849 | p->fillRect(hoff, sliderpos, 3, sliderheight, m_scrollbarcolor); | ||
1850 | } | ||
1851 | } | ||
1852 | break; | ||
1853 | case 0: | ||
1854 | default: | ||
1855 | break; | ||
893 | } | 1856 | } |
894 | |||
895 | emit OnRedraw(); | ||
896 | } | 1857 | } |
1858 | } | ||
1859 | |||
897 | /* | 1860 | /* |
898 | else | 1861 | void QTReader::DrawScroll( QPainter *p ) |
1862 | { | ||
1863 | if (m_border > 5 && !buffdoc.empty()) | ||
899 | { | 1864 | { |
900 | odebug << "Not so refreshing..." << oendl; | 1865 | int ht, wh; |
1866 | if (m_rotated) | ||
1867 | { | ||
1868 | ht = width(); | ||
1869 | wh = height()g; | ||
1870 | p->fillRect(0, wh-2, ht, 2, cyan); | ||
1871 | } | ||
1872 | else | ||
1873 | { | ||
1874 | ht = height(); | ||
1875 | wh = width(); | ||
1876 | p->fillRect(wh-2, 0, 2, ht, cyan); | ||
1877 | } | ||
1878 | int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); | ||
1879 | int mid = (ht*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); | ||
1880 | if (m_rotated) | ||
1881 | { | ||
1882 | p->fillRect(ht-mid-5, wh-2, 10, 2, yellow); | ||
1883 | p->fillRect(ht-(ht*(locnarray[numlines]-buffdoc.startSection())+sectionsize/2)/sectionsize, wh-2, ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize, 2, magenta); | ||
1884 | } | ||
1885 | else | ||
1886 | { | ||
1887 | p->fillRect(wh-2, mid-5, 2, 10, yellow); | ||
1888 | p->fillRect(wh-2, (ht*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize, magenta); | ||
1889 | } | ||
901 | } | 1890 | } |
902 | */ | ||
903 | } | 1891 | } |
904 | 1892 | */ | |
905 | QString QTReader::firstword() | 1893 | QString QTReader::firstword() |
906 | { | 1894 | { |
907 | if (m_bMonoSpaced) | 1895 | if (m_bMonoSpaced) |
908 | { | 1896 | { |
@@ -940,38 +1928,28 @@ bool QTReader::ChangeFont(int tgt) | |||
940 | } | 1928 | } |
941 | 1929 | ||
942 | void QTReader::init() | 1930 | void QTReader::init() |
943 | { | 1931 | { |
944 | // m_showlast = true; | 1932 | buffdoc.unsuspend(); |
945 | // setCaption( "Qt Draw Demo Application" ); | 1933 | setBackgroundColor( m_bg ); |
946 | |||
947 | buffdoc.unsuspend(); | ||
948 | setBackgroundColor( white ); | ||
949 | // QPainter p(this); | ||
950 | // p.setBackgroundMode( Qt::OpaqueMode ); | ||
951 | buffdoc.setfilter(getfilter()); | 1934 | buffdoc.setfilter(getfilter()); |
952 | ChangeFont(m_textsize); | 1935 | ChangeFont(m_textsize); |
953 | setFocusPolicy(QWidget::StrongFocus); | 1936 | setFocusPolicy(QWidget::StrongFocus); |
954 | // resize( 240, 320 ); | 1937 | timer = new QTimer(this); |
955 | //setFocus(); | 1938 | connect(timer, SIGNAL(timeout()), this, SLOT(doscroll())); |
956 | timer = new QTimer(this); | 1939 | // QMessageBox::information(this, "init", m_lastfile, 1); |
957 | connect(timer, SIGNAL(timeout()), this, SLOT(doscroll())); | 1940 | setfont(); |
958 | // QMessageBox::information(this, "init", m_lastfile, 1); | ||
959 | setfont(); | ||
960 | /* | ||
961 | if (!m_lastfile.isEmpty()) | ||
962 | { | ||
963 | m_string = DocLnk(m_lastfile).name(); | ||
964 | load_file(m_lastfile); | ||
965 | } | ||
966 | */ | ||
967 | } | 1941 | } |
968 | 1942 | ||
969 | // | 1943 | // |
970 | // Clean up | 1944 | // Clean up |
971 | // | 1945 | // |
972 | QTReader::~QTReader() | 1946 | QTReader::~QTReader() |
973 | { | 1947 | { |
1948 | #ifdef DOUBLEBUFFER | ||
1949 | delete dbuff; | ||
1950 | delete dbp; | ||
1951 | #endif | ||
974 | #ifdef USEQPE | 1952 | #ifdef USEQPE |
975 | if (m_autoScroll) | 1953 | if (m_autoScroll) |
976 | { | 1954 | { |
977 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 1955 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
@@ -985,17 +1963,8 @@ QTReader::~QTReader() | |||
985 | #endif | 1963 | #endif |
986 | } | 1964 | } |
987 | 1965 | ||
988 | // | 1966 | // |
989 | // Calls the drawing function as specified by the radio buttons. | ||
990 | // | ||
991 | |||
992 | void QTReader::drawIt( QPainter *p ) | ||
993 | { | ||
994 | drawFonts(p); | ||
995 | } | ||
996 | |||
997 | // | ||
998 | // Called when the print button is clicked. | 1967 | // Called when the print button is clicked. |
999 | // | 1968 | // |
1000 | /* | 1969 | /* |
1001 | void QTReader::printIt() | 1970 | void QTReader::printIt() |
@@ -1015,10 +1984,9 @@ void QTReader::printIt() | |||
1015 | // | 1984 | // |
1016 | 1985 | ||
1017 | void QTReader::paintEvent( QPaintEvent * ) | 1986 | void QTReader::paintEvent( QPaintEvent * ) |
1018 | { | 1987 | { |
1019 | QPainter paint( this ); | 1988 | drawFonts(); |
1020 | drawIt( &paint ); | ||
1021 | } | 1989 | } |
1022 | 1990 | ||
1023 | // | 1991 | // |
1024 | // Called when the widget has been resized. | 1992 | // Called when the widget has been resized. |
@@ -1027,9 +1995,9 @@ void QTReader::paintEvent( QPaintEvent * ) | |||
1027 | 1995 | ||
1028 | /* | 1996 | /* |
1029 | void QTReader::resizeEvent( QResizeEvent * ) | 1997 | void QTReader::resizeEvent( QResizeEvent * ) |
1030 | { | 1998 | { |
1031 | // // odebug << "resize:(" << width() << "," << height() << ")" << oendl; | 1999 | // // qDebug("resize:(%u,%u)", width(), height()); |
1032 | // bgroup->move( width()-bgroup->width(), 0 ); | 2000 | // bgroup->move( width()-bgroup->width(), 0 ); |
1033 | } | 2001 | } |
1034 | */ | 2002 | */ |
1035 | 2003 | ||
@@ -1052,13 +2020,15 @@ int main( int argc, tchar **argv ) | |||
1052 | bool QTReader::locate(unsigned long n) { | 2020 | bool QTReader::locate(unsigned long n) { |
1053 | //printf("Locate\n"); | 2021 | //printf("Locate\n"); |
1054 | buffdoc.unsuspend(); | 2022 | buffdoc.unsuspend(); |
1055 | buffdoc.locate(n); | 2023 | buffdoc.locate(n); |
1056 | // // odebug << "&buffdoc.located" << oendl; | 2024 | // // qDebug("&buffdoc.located"); |
2025 | ResetScroll(); | ||
1057 | fillbuffer(); | 2026 | fillbuffer(); |
1058 | // // odebug << "&Buffer filled" << oendl; | 2027 | // // qDebug("&Buffer filled"); |
1059 | update(); | 2028 | update(); |
1060 | // // odebug << "&Located" << oendl; | 2029 | // // qDebug("&Located"); |
2030 | emitRedraw(); | ||
1061 | return true; | 2031 | return true; |
1062 | } | 2032 | } |
1063 | 2033 | ||
1064 | unsigned int QTReader::screenlines() | 2034 | unsigned int QTReader::screenlines() |
@@ -1070,19 +2040,22 @@ unsigned int QTReader::screenlines() | |||
1070 | 2040 | ||
1071 | bool QTReader::fillbuffer(int reuse, int ht, int newht) | 2041 | bool QTReader::fillbuffer(int reuse, int ht, int newht) |
1072 | { | 2042 | { |
1073 | buffdoc.unsuspend(); | 2043 | buffdoc.unsuspend(); |
2044 | int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0); | ||
2045 | if (hmargin < m_bottommargin) hmargin = m_bottommargin; | ||
2046 | if (ht < 0) ht = m_topmargin; | ||
1074 | if (buffdoc.empty()) return false; | 2047 | if (buffdoc.empty()) return false; |
1075 | if (newht < 0) | 2048 | if (newht < 0) |
1076 | m_lastheight = height(); | 2049 | m_lastheight = (m_rotated) ? width() : height(); |
1077 | else | 2050 | else |
1078 | m_lastheight = newht; | 2051 | m_lastheight = newht; |
1079 | int ch; | 2052 | int ch; |
1080 | bool ret = false; | 2053 | bool ret = false; |
1081 | unsigned int oldpagepos = locnarray[reuse]; | 2054 | unsigned int oldpagepos = locnarray[reuse]; |
1082 | int lastypos = ht, ypos = ht; | 2055 | int lastypos = ht, ypos = ht; |
1083 | numlines = reuse; | 2056 | numlines = reuse; |
1084 | while (ypos < m_lastheight || numlines < 2) | 2057 | while (ypos < m_lastheight - hmargin || numlines < 2) |
1085 | { | 2058 | { |
1086 | lastypos = ypos; | 2059 | lastypos = ypos; |
1087 | if (textarray[numlines] == NULL) | 2060 | if (textarray[numlines] == NULL) |
1088 | { | 2061 | { |
@@ -1095,41 +2068,52 @@ bool QTReader::fillbuffer(int reuse, int ht, int newht) | |||
1095 | if (!ch) | 2068 | if (!ch) |
1096 | { | 2069 | { |
1097 | if (numlines - reuse == 1 /*&& locnarray[numlines] == buffdoc.locate()*/) | 2070 | if (numlines - reuse == 1 /*&& locnarray[numlines] == buffdoc.locate()*/) |
1098 | { | 2071 | { |
2072 | qDebug("FALSE"); | ||
1099 | locate(oldpagepos); | 2073 | locate(oldpagepos); |
1100 | return false; | 2074 | return false; |
1101 | } | 2075 | } |
1102 | else | 2076 | else |
1103 | { | 2077 | { |
2078 | qDebug("TRUE"); | ||
1104 | --numlines; | 2079 | --numlines; |
1105 | mylastpos = locate(); | 2080 | mylastpos = locate(); |
1106 | return true; | 2081 | return true; |
1107 | } | 2082 | } |
1108 | } | 2083 | } |
2084 | if (numlines > 1 && textarray[numlines-2]->isBop()) | ||
2085 | { | ||
2086 | --numlines; | ||
2087 | mylastpos = locate(); | ||
2088 | return true; | ||
2089 | } | ||
1109 | } | 2090 | } |
1110 | 2091 | ||
1111 | --numlines; | 2092 | --numlines; |
1112 | mylastpos = locate(); | 2093 | mylastpos = locate(); |
1113 | m_scrolldy1 = m_scrolldy2 = m_scrollpart = m_lastheight - lastypos; | 2094 | m_scrollpart = m_lastheight - lastypos - hmargin; |
1114 | 2095 | if (m_autoScroll) | |
2096 | { | ||
2097 | CalculateScrollParameters(); | ||
2098 | } | ||
1115 | return true; | 2099 | return true; |
1116 | } | 2100 | } |
1117 | 2101 | ||
1118 | void QTReader::dopagedn() | 2102 | void QTReader::dopagedn() |
1119 | { | 2103 | { |
1120 | // odebug << "HEIGHT(2):" << m_lastheight << "" << oendl; | 2104 | // qDebug("HEIGHT(2):%d", m_lastheight); |
1121 | buffdoc.unsuspend(); | 2105 | buffdoc.unsuspend(); |
1122 | int skip = 0, ypos = 0; | 2106 | ResetScroll(); |
2107 | int skip = 0, ypos = m_topmargin; | ||
1123 | if (locate() != mylastpos) | 2108 | if (locate() != mylastpos) |
1124 | { | 2109 | { |
1125 | ////odebug << "Jumping to " << mylastpos << "" << oendl; | ||
1126 | jumpto(mylastpos); | 2110 | jumpto(mylastpos); |
1127 | } | 2111 | } |
1128 | CDrawBuffer* reusebuffer = textarray[numlines]; | 2112 | CDrawBuffer* reusebuffer = textarray[numlines]; |
1129 | if (reusebuffer != NULL && reusebuffer->eof()) return; | ||
1130 | if (reusebuffer != NULL) | 2113 | if (reusebuffer != NULL) |
1131 | { | 2114 | { |
2115 | if (reusebuffer->eof()) return; | ||
1132 | for (int i = 0; i <= m_overlap; i++) | 2116 | for (int i = 0; i <= m_overlap; i++) |
1133 | { | 2117 | { |
1134 | int offset = numlines - m_overlap + i; | 2118 | int offset = numlines - m_overlap + i; |
1135 | reusebuffer = textarray[offset]; | 2119 | reusebuffer = textarray[offset]; |
@@ -1142,17 +2126,22 @@ void QTReader::dopagedn() | |||
1142 | ypos += textarray[i]->lineSpacing(); | 2126 | ypos += textarray[i]->lineSpacing(); |
1143 | skip++; | 2127 | skip++; |
1144 | } | 2128 | } |
1145 | } | 2129 | } |
2130 | if (numlines <= 1) | ||
2131 | { | ||
2132 | skip = 0; | ||
2133 | ypos = 0; | ||
2134 | qDebug("Doing extra skip"); | ||
2135 | } | ||
1146 | if (fillbuffer(skip, ypos)) | 2136 | if (fillbuffer(skip, ypos)) |
1147 | { | 2137 | { |
1148 | update(); | 2138 | drawFonts(); |
1149 | } | 2139 | } |
1150 | } | 2140 | } |
1151 | 2141 | ||
1152 | void QTReader::dopageup() | 2142 | void QTReader::dopageup() |
1153 | { | 2143 | { |
1154 | buffdoc.unsuspend(); | ||
1155 | dopageup(locnarray[(m_overlap < numlines) ? m_overlap : numlines/2]); | 2144 | dopageup(locnarray[(m_overlap < numlines) ? m_overlap : numlines/2]); |
1156 | } | 2145 | } |
1157 | 2146 | ||
1158 | bool QTReader::synch(size_t start, size_t end) | 2147 | bool QTReader::synch(size_t start, size_t end) |
@@ -1162,24 +2151,28 @@ bool QTReader::synch(size_t start, size_t end) | |||
1162 | { | 2151 | { |
1163 | tchar ch = getch(); | 2152 | tchar ch = getch(); |
1164 | if (ch == 10) return true; | 2153 | if (ch == 10) return true; |
1165 | if (ch == UEOF) return false; | 2154 | if (ch == UEOF) return false; |
2155 | if (ch == 6) return false; | ||
1166 | } | 2156 | } |
1167 | return false; | 2157 | return false; |
1168 | } | 2158 | } |
1169 | 2159 | ||
1170 | void QTReader::dopageup(unsigned int target) | 2160 | void QTReader::dopageup(unsigned int target) |
1171 | { | 2161 | { |
1172 | buffdoc.unsuspend(); | 2162 | buffdoc.unsuspend(); |
2163 | ResetScroll(); | ||
1173 | CBufferFace<CDrawBuffer*> buff; | 2164 | CBufferFace<CDrawBuffer*> buff; |
1174 | CBufferFace<size_t> loc; | 2165 | CBufferFace<size_t> loc; |
1175 | 2166 | ||
1176 | size_t delta, guess = 2*(locate()-pagelocate()), lastdelta = 0; | 2167 | size_t delta, guess = 2*(locate()-pagelocate()), lastdelta = 0; |
1177 | bool ch = true; | 2168 | bool ch = true; |
1178 | int nbfl, ypos = 0; | 2169 | int nbfl, ypos = m_topmargin; |
1179 | if (guess < 128) guess = 128; | 2170 | if (guess < 128) guess = 128; |
1180 | while (1) | 2171 | while (1) |
1181 | { | 2172 | { |
2173 | // qDebug("Guess:%u", guess); | ||
2174 | |||
1182 | ch = true; | 2175 | ch = true; |
1183 | if (target < guess) | 2176 | if (target < guess) |
1184 | { | 2177 | { |
1185 | delta = 0; // 0 is a flag to say don't guess any more | 2178 | delta = 0; // 0 is a flag to say don't guess any more |
@@ -1208,9 +2201,9 @@ void QTReader::dopageup(unsigned int target) | |||
1208 | } | 2201 | } |
1209 | } | 2202 | } |
1210 | 2203 | ||
1211 | nbfl = 0; | 2204 | nbfl = 0; |
1212 | ypos = 0; | 2205 | ypos = m_topmargin; |
1213 | 2206 | ||
1214 | while (locate() < target) | 2207 | while (locate() < target) |
1215 | { | 2208 | { |
1216 | if (buff[nbfl] == NULL) buff[nbfl] = new CDrawBuffer(&m_fontControl); | 2209 | if (buff[nbfl] == NULL) buff[nbfl] = new CDrawBuffer(&m_fontControl); |
@@ -1219,9 +2212,9 @@ void QTReader::dopageup(unsigned int target) | |||
1219 | ypos += buff[nbfl]->lineSpacing(); | 2212 | ypos += buff[nbfl]->lineSpacing(); |
1220 | nbfl++; | 2213 | nbfl++; |
1221 | if (!ch) break; | 2214 | if (!ch) break; |
1222 | } | 2215 | } |
1223 | if (guess < 4000 && ypos < height() && (delta != 0)) | 2216 | if (guess < 4000 && ypos < ((m_rotated) ? width() : height())-(m_bottommargin) && (delta != 0)) |
1224 | { | 2217 | { |
1225 | for (int i = 0; i < nbfl; i++) | 2218 | for (int i = 0; i < nbfl; i++) |
1226 | { | 2219 | { |
1227 | delete buff[i]; | 2220 | delete buff[i]; |
@@ -1249,11 +2242,11 @@ void QTReader::dopageup(unsigned int target) | |||
1249 | } | 2242 | } |
1250 | --numlines; | 2243 | --numlines; |
1251 | */ | 2244 | */ |
1252 | 2245 | ||
1253 | ypos = 0; | 2246 | ypos = m_topmargin; |
1254 | numlines = 0; | 2247 | numlines = 0; |
1255 | while (ypos < height() && numlines+2 <= nbfl) | 2248 | while (ypos < ((m_rotated) ? width() : height())-m_bottommargin && numlines+2 <= nbfl) |
1256 | { | 2249 | { |
1257 | ypos += buff[nbfl - numlines - 2]->lineSpacing(); | 2250 | ypos += buff[nbfl - numlines - 2]->lineSpacing(); |
1258 | numlines++; | 2251 | numlines++; |
1259 | } | 2252 | } |
@@ -1261,9 +2254,9 @@ void QTReader::dopageup(unsigned int target) | |||
1261 | if (numlines == 0 && nbfl > 1) numlines = 1; | 2254 | if (numlines == 0 && nbfl > 1) numlines = 1; |
1262 | 2255 | ||
1263 | int offset = nbfl-1; | 2256 | int offset = nbfl-1; |
1264 | offset -= numlines; | 2257 | offset -= numlines; |
1265 | ypos = 0; | 2258 | ypos = m_topmargin; |
1266 | for (int i = 0; i <= numlines; i++) | 2259 | for (int i = 0; i <= numlines; i++) |
1267 | { | 2260 | { |
1268 | delete textarray[i]; | 2261 | delete textarray[i]; |
1269 | textarray[i] = buff[offset+i]; | 2262 | textarray[i] = buff[offset+i]; |
@@ -1278,9 +2271,9 @@ void QTReader::dopageup(unsigned int target) | |||
1278 | { | 2271 | { |
1279 | delete buff[i]; | 2272 | delete buff[i]; |
1280 | } | 2273 | } |
1281 | 2274 | ||
1282 | while (ypos < height()) | 2275 | while (ypos < ((m_rotated) ? width() : height())-m_bottommargin) |
1283 | { | 2276 | { |
1284 | numlines++; | 2277 | numlines++; |
1285 | locnarray[numlines] = locate(); | 2278 | locnarray[numlines] = locate(); |
1286 | if (textarray[numlines] == NULL) textarray[numlines] = new CDrawBuffer(&m_fontControl); | 2279 | if (textarray[numlines] == NULL) textarray[numlines] = new CDrawBuffer(&m_fontControl); |
@@ -1288,50 +2281,60 @@ void QTReader::dopageup(unsigned int target) | |||
1288 | ypos += textarray[numlines]->lineSpacing(); | 2281 | ypos += textarray[numlines]->lineSpacing(); |
1289 | } | 2282 | } |
1290 | 2283 | ||
1291 | mylastpos = locate(); | 2284 | mylastpos = locate(); |
1292 | 2285 | CalculateScrollParameters(); | |
1293 | update(); | 2286 | drawFonts(); |
2287 | // repaint(); | ||
1294 | } | 2288 | } |
1295 | 2289 | ||
1296 | bool QTReader::load_file(const char *newfile, unsigned int _lcn) | 2290 | bool QTReader::load_file(const char *newfile, unsigned int _lcn) |
1297 | { | 2291 | { |
1298 | // QMessageBox::information(this, "Name", name, 1); | 2292 | // QMessageBox::information(this, "Name", name, 1); |
1299 | // QMessageBox::information(this, "load_file", newfile, 1); | 2293 | // QMessageBox::information(this, "load_file", newfile, 1); |
1300 | 2294 | int prog = 0; | |
1301 | bool bRC = false; | 2295 | bool bRC = false; |
1302 | unsigned int lcn = _lcn; | 2296 | unsigned int lcn = _lcn; |
2297 | ResetScroll(); | ||
1303 | if (m_lastfile == newfile) | 2298 | if (m_lastfile == newfile) |
1304 | { | 2299 | { |
1305 | lcn = m_lastposn; | 2300 | lcn = m_lastposn; |
1306 | } | 2301 | } |
1307 | // QMessageBox::information(0, "Opening...", newfile); | 2302 | // QMessageBox::information(0, "Opening...", newfile); |
1308 | m_lastwidth = width(); | 2303 | if (m_rotated) |
1309 | m_lastheight = height(); | 2304 | { |
2305 | m_lastwidth = height(); | ||
2306 | m_lastheight = width(); | ||
2307 | } | ||
2308 | else | ||
2309 | { | ||
2310 | m_lastwidth = width(); | ||
2311 | m_lastheight = height(); | ||
2312 | } | ||
1310 | if (buffdoc.openfile(this,newfile) == 0) | 2313 | if (buffdoc.openfile(this,newfile) == 0) |
1311 | { | 2314 | { |
1312 | m_lastfile = newfile; | 2315 | m_lastfile = newfile; |
1313 | buffdoc.setwidth(m_lastwidth-2*m_border); | 2316 | buffdoc.setwidth(m_lastwidth-(m_left_border+m_right_border)); |
1314 | bRC = true; | 2317 | bRC = true; |
1315 | buffdoc.setContinuous(m_continuousDocument); | 2318 | buffdoc.setContinuous(m_continuousDocument); |
1316 | // // odebug << "buffdoc.openfile done" << oendl; | 2319 | qDebug("buffdoc.openfile done"); |
1317 | locate(lcn); | 2320 | locate(lcn); |
1318 | // // odebug << "buffdoc.locate done" << oendl; | 2321 | qDebug("buffdoc.locate done"); |
1319 | } | 2322 | } |
1320 | setfilter(getfilter()); | 2323 | setfilter(getfilter()); |
1321 | update(); | 2324 | qDebug("Updated"); |
1322 | // // odebug << "Updated" << oendl; | ||
1323 | return bRC; | 2325 | return bRC; |
1324 | } | 2326 | } |
1325 | 2327 | ||
1326 | void QTReader::lineDown() | 2328 | void QTReader::lineDown() |
1327 | { | 2329 | { |
1328 | int ypos = 0; | 2330 | int ypos = m_topmargin; |
2331 | ResetScroll(); | ||
1329 | int offset = numlines; | 2332 | int offset = numlines; |
1330 | 2333 | ||
1331 | for (int i = 0; i <= numlines; i++) | 2334 | for (int i = 0; i <= numlines; i++) |
1332 | { | 2335 | { |
1333 | if ((ypos += textarray[numlines-i]->lineSpacing()) > height()) | 2336 | if ((ypos += textarray[numlines-i]->lineSpacing()) > ((m_rotated) ? width() : height())) |
1334 | { | 2337 | { |
1335 | offset = i-1; | 2338 | offset = i-1; |
1336 | break; | 2339 | break; |
1337 | } | 2340 | } |
@@ -1440,11 +2443,28 @@ void QTReader::lineUp() | |||
1440 | mylastpos = locate(); | 2443 | mylastpos = locate(); |
1441 | update(); | 2444 | update(); |
1442 | } | 2445 | } |
1443 | */ | 2446 | */ |
2447 | |||
2448 | void QTReader::ResetScroll() | ||
2449 | { | ||
2450 | m_totalscroll = 0; | ||
2451 | m_scrolldy1 = 0; | ||
2452 | m_scrolldy = m_topmargin; | ||
2453 | if (m_autoScroll && ((m_scrolltype == 0) || !m_bgpm.isNull())) | ||
2454 | { | ||
2455 | setautoscroll(false); | ||
2456 | } | ||
2457 | } | ||
2458 | |||
1444 | void QTReader::lineUp() | 2459 | void QTReader::lineUp() |
1445 | { | 2460 | { |
1446 | buffdoc.unsuspend(); | 2461 | dopageup(locnarray[numlines-1]); |
2462 | |||
2463 | /* | ||
2464 | buffdoc.unsuspend(); | ||
2465 | ResetScroll(); | ||
2466 | |||
1447 | CDrawBuffer* buff = textarray[numlines]; | 2467 | CDrawBuffer* buff = textarray[numlines]; |
1448 | unsigned int loc; | 2468 | unsigned int loc; |
1449 | unsigned int end = locnarray[numlines]; | 2469 | unsigned int end = locnarray[numlines]; |
1450 | int cbptr = 0; | 2470 | int cbptr = 0; |
@@ -1509,26 +2529,27 @@ void QTReader::lineUp() | |||
1509 | } | 2529 | } |
1510 | textarray[0] = buff; | 2530 | textarray[0] = buff; |
1511 | locnarray[0] = loc; | 2531 | locnarray[0] = loc; |
1512 | int start = numlines; | 2532 | int start = numlines; |
1513 | int ypos = 0; | 2533 | int ypos = m_topmargin; |
1514 | #ifdef _WINDOWS | 2534 | #ifdef _WINDOWS |
1515 | for (i = 0; i <= numlines; i++) | 2535 | for (i = 0; i <= numlines; i++) |
1516 | #else | 2536 | #else |
1517 | for (int i = 0; i <= numlines; i++) | 2537 | for (int i = 0; i <= numlines; i++) |
1518 | #endif | 2538 | #endif |
1519 | { | 2539 | { |
1520 | ypos += textarray[i]->lineSpacing(); | 2540 | ypos += textarray[i]->lineSpacing(); |
1521 | if (ypos > height()) | 2541 | if (ypos > ((m_rotated) ? width() : height())) |
1522 | { | 2542 | { |
1523 | start = i; | 2543 | start = i; |
1524 | ypos -= textarray[i]->lineSpacing(); | 2544 | ypos -= textarray[i]->lineSpacing(); |
1525 | break; | 2545 | break; |
1526 | } | 2546 | } |
1527 | } | 2547 | } |
1528 | jumpto(locnarray[start]); | 2548 | jumpto(locnarray[start]); |
1529 | fillbuffer(start, ypos); | 2549 | fillbuffer(start, ypos); |
1530 | update(); | 2550 | repaint(); |
2551 | */ | ||
1531 | } | 2552 | } |
1532 | 2553 | ||
1533 | bool QTReader::empty() | 2554 | bool QTReader::empty() |
1534 | { | 2555 | { |
@@ -1551,4 +2572,415 @@ MarkupType QTReader::PreferredMarkup() | |||
1551 | } | 2572 | } |
1552 | } | 2573 | } |
1553 | return m; | 2574 | return m; |
1554 | } | 2575 | } |
2576 | #ifdef DOUBLEBUFFER | ||
2577 | void QTReader::resizeEvent( QResizeEvent * p ) | ||
2578 | { | ||
2579 | if (m_rotated) | ||
2580 | { | ||
2581 | dbuff->resize(p->size().height(),p->size().width()); | ||
2582 | } | ||
2583 | else | ||
2584 | { | ||
2585 | dbuff->resize(p->size()); | ||
2586 | } | ||
2587 | m_bgIsScaled = false; | ||
2588 | if (m_bgtype == bgStretched) | ||
2589 | { | ||
2590 | emit RefreshBitmap(); | ||
2591 | } | ||
2592 | |||
2593 | { | ||
2594 | int h, w; | ||
2595 | if (m_rotated) | ||
2596 | { | ||
2597 | h = p->size().width(); | ||
2598 | w = p->size().height(); | ||
2599 | } | ||
2600 | else | ||
2601 | { | ||
2602 | w = p->size().width(); | ||
2603 | h = p->size().height(); | ||
2604 | } | ||
2605 | m_topmargin = (h*m_abstopmargin+500)/1000; | ||
2606 | m_bottommargin = (h*m_absbottommargin+500)/1000; | ||
2607 | m_left_border = (w*m_absleft_border+500)/1000; | ||
2608 | m_right_border = (w*m_absright_border+500)/1000; | ||
2609 | |||
2610 | qDebug("Top margin:%u", m_topmargin ); | ||
2611 | qDebug("Bottom margin:%u", m_bottommargin ); | ||
2612 | qDebug("Left margin:%u", m_left_border ); | ||
2613 | qDebug("Right margin:%u", m_right_border ); | ||
2614 | } | ||
2615 | } | ||
2616 | #endif | ||
2617 | |||
2618 | void QTReader::setrotated(bool sfs) | ||
2619 | { | ||
2620 | m_rotated = sfs; | ||
2621 | #ifdef DOUBLEBUFFER | ||
2622 | if (m_rotated) | ||
2623 | { | ||
2624 | dbuff->resize(height(), width()); | ||
2625 | } | ||
2626 | else | ||
2627 | { | ||
2628 | dbuff->resize(width(), height()); | ||
2629 | } | ||
2630 | m_bgIsScaled = false; | ||
2631 | #endif | ||
2632 | int h, w; | ||
2633 | if (m_rotated) | ||
2634 | { | ||
2635 | h = width(); | ||
2636 | w = height(); | ||
2637 | } | ||
2638 | else | ||
2639 | { | ||
2640 | w = width(); | ||
2641 | h = height(); | ||
2642 | } | ||
2643 | m_topmargin = (h*m_abstopmargin+500)/1000; | ||
2644 | m_bottommargin = (h*m_absbottommargin+500)/1000; | ||
2645 | m_left_border = (w*m_absleft_border+500)/1000; | ||
2646 | m_right_border = (w*m_absright_border+500)/1000; | ||
2647 | |||
2648 | qDebug("Top margin:%u", m_topmargin ); | ||
2649 | qDebug("Bottom margin:%u", m_bottommargin ); | ||
2650 | qDebug("Left margin:%u", m_left_border ); | ||
2651 | qDebug("Right margin:%u", m_right_border ); | ||
2652 | } | ||
2653 | |||
2654 | void QTReader::drawBackground() | ||
2655 | { | ||
2656 | dbp->begin(dbuff); | ||
2657 | // dbp->setBackgroundMode(OpaqueMode); | ||
2658 | dbp->setBackgroundColor(m_bg); | ||
2659 | dbp->eraseRect(dbuff->rect()); | ||
2660 | if (!m_bgpm.isNull()) | ||
2661 | { | ||
2662 | // dbp->setBackgroundMode(TransparentMode); | ||
2663 | switch (m_bgtype) | ||
2664 | { | ||
2665 | case bgCentred: | ||
2666 | { | ||
2667 | int w = (dbuff->rect().width()-m_bgpm.width())/2; | ||
2668 | int h = (dbuff->rect().height()-m_bgpm.height())/2; | ||
2669 | dbp->drawPixmap(w,h,m_bgpm); | ||
2670 | } | ||
2671 | break; | ||
2672 | case bgTiled: | ||
2673 | { | ||
2674 | dbp->drawTiledPixmap(0,0,dbuff->rect().width(),dbuff->rect().height(),m_bgpm); | ||
2675 | /* | ||
2676 | for (int h = 0; h < dbuff->rect().height(); h += m_bgpm.height()) | ||
2677 | { | ||
2678 | for (int w = 0; w < dbuff->rect().width(); w += m_bgpm.width()) | ||
2679 | { | ||
2680 | dbp->drawPixmap(w,h,m_bgpm); | ||
2681 | } | ||
2682 | } | ||
2683 | */ | ||
2684 | } | ||
2685 | break; | ||
2686 | case bgStretched: | ||
2687 | { | ||
2688 | if (!m_bgIsScaled) | ||
2689 | { | ||
2690 | m_bgIsScaled = true; | ||
2691 | QImage im = m_bgpm.convertToImage(); | ||
2692 | m_bgpm.convertFromImage(im.smoothScale(dbuff->rect().width(), dbuff->rect().height())); | ||
2693 | } | ||
2694 | dbp->drawPixmap(0,0,m_bgpm); | ||
2695 | } | ||
2696 | break; | ||
2697 | default: | ||
2698 | qDebug("Unknown background type"); | ||
2699 | } | ||
2700 | // dbp->setBackgroundMode(OpaqueMode); | ||
2701 | } | ||
2702 | } | ||
2703 | |||
2704 | void QTReader::blitRot(int dx, int dy, int sw, int sh, CDrawBuffer* txt) | ||
2705 | { | ||
2706 | if (txt != NULL) | ||
2707 | { | ||
2708 | sh = txt->lineSpacing(); | ||
2709 | } | ||
2710 | int sy = width()-dx-sh; | ||
2711 | if (m_autoScroll && !(m_scrolltype == 0)) | ||
2712 | { | ||
2713 | sy = (sy+m_totalscroll+1)%width(); | ||
2714 | } | ||
2715 | |||
2716 | QPixmap pm(sw, sh); | ||
2717 | |||
2718 | QPainter pd(&pm, this); | ||
2719 | if (m_bgpm.isNull()) | ||
2720 | { | ||
2721 | pd.eraseRect(pm.rect()); | ||
2722 | } | ||
2723 | else | ||
2724 | { | ||
2725 | if (sy+pm.height() > dbuff->height()) | ||
2726 | { | ||
2727 | // pd.eraseRect(pm.rect()); | ||
2728 | int fh = dbuff->height() - sy; | ||
2729 | if (sy+fh > dbuff->height()) | ||
2730 | { | ||
2731 | qDebug("Oh no!"); | ||
2732 | } | ||
2733 | |||
2734 | if (fh > pm.height()) | ||
2735 | { | ||
2736 | qDebug("Oh no! - 2"); | ||
2737 | } | ||
2738 | |||
2739 | bitBlt(&pm,0,0,dbuff,dy,sy,pm.width(),fh); | ||
2740 | bitBlt(&pm,0,fh,dbuff,dy,0,pm.width(),pm.height()-fh); | ||
2741 | } | ||
2742 | else | ||
2743 | { | ||
2744 | bitBlt(&pm,0,0,dbuff,dy,sy,pm.width(),pm.height()); | ||
2745 | } | ||
2746 | } | ||
2747 | if (txt != NULL) | ||
2748 | { | ||
2749 | // txt->render(&pd, txt->lineSpacing() - txt->descent() - txt->lineExtraSpacing(), m_bMonoSpaced, m_charWidth, sw, m_left_border, m_right_border, m_bg); | ||
2750 | txt->render(&pd, txt->lineSpacing() - txt->descent() - txt->lineExtraSpacing(), m_bMonoSpaced, m_charWidth, sw, m_left_border, m_right_border, m_bg, width()-m_topmargin-m_bottommargin); | ||
2751 | } | ||
2752 | QWMatrix m; | ||
2753 | m.rotate(90); | ||
2754 | QPixmap rp = pm.xForm(m); | ||
2755 | /* | ||
2756 | p.drawPixmap(QPoint(dx, dy), rp); | ||
2757 | */ | ||
2758 | bitBlt(this, dx, dy, &rp, 0, 0, -1, -1, CopyROP); | ||
2759 | } | ||
2760 | |||
2761 | QString QTReader::about() | ||
2762 | { | ||
2763 | return QString("QTReader widget (c) Tim Wentford\n")+buffdoc.about() + "\nMini-scrollbar by Markus Gritsch\nNavigation History fixes by Frantisek Dufka"; | ||
2764 | } | ||
2765 | |||
2766 | void QTReader::getNextLink() | ||
2767 | { | ||
2768 | if (m_scrolldy != 0) | ||
2769 | { | ||
2770 | setautoscroll(false); | ||
2771 | ResetScroll(); | ||
2772 | redrawall(); | ||
2773 | } | ||
2774 | bool redraw = false; | ||
2775 | bool found = false; | ||
2776 | if (m_currentlink >= 0) | ||
2777 | { | ||
2778 | m_currentlinkoffset = textarray[m_currentlink]->invertLink(m_currentlinkoffset); | ||
2779 | if ((m_currentlinkstyle = textarray[m_currentlink]->getNextLink(m_currentlinkoffset)) != NULL) | ||
2780 | { | ||
2781 | qDebug("Found a link at %u", m_currentlinkoffset); | ||
2782 | int offset = textarray[m_currentlink]->invertLink(m_currentlinkoffset); | ||
2783 | qDebug("Finishes at %u", offset); | ||
2784 | found = true; | ||
2785 | } | ||
2786 | redraw = true; | ||
2787 | drawSingleLine(m_currentlink); | ||
2788 | // if (found) return; | ||
2789 | } | ||
2790 | if (!found) | ||
2791 | { | ||
2792 | m_currentlinkoffset = -1; | ||
2793 | for (int i = m_currentlink+1; i < numlines; ++i) | ||
2794 | { | ||
2795 | if ((m_currentlinkstyle = textarray[i]->getNextLink(m_currentlinkoffset)) != NULL) | ||
2796 | { | ||
2797 | m_currentlink = i; | ||
2798 | qDebug("Found a link at %u", m_currentlinkoffset); | ||
2799 | int offset = textarray[m_currentlink]->invertLink(m_currentlinkoffset); | ||
2800 | qDebug("Finishes at %u", offset); | ||
2801 | //drawSingleLine(i); | ||
2802 | redraw = true; | ||
2803 | found = true; | ||
2804 | drawSingleLine(m_currentlink); | ||
2805 | break; | ||
2806 | } | ||
2807 | } | ||
2808 | } | ||
2809 | if (redraw) | ||
2810 | { | ||
2811 | // redrawall(); | ||
2812 | } | ||
2813 | if (!found) | ||
2814 | { | ||
2815 | m_currentlink = -1; | ||
2816 | m_currentlinkstyle = NULL; | ||
2817 | m_currentlinkoffset = -1; | ||
2818 | dopagedn(); | ||
2819 | } | ||
2820 | } | ||
2821 | |||
2822 | void QTReader::emitRedraw() | ||
2823 | { | ||
2824 | m_currentlinkstyle = NULL; | ||
2825 | m_currentlink = -1; | ||
2826 | m_currentlinkoffset = -1; | ||
2827 | emit OnRedraw(); | ||
2828 | }; | ||
2829 | |||
2830 | void QTReader::drawSingleLine(int lineno) | ||
2831 | { | ||
2832 | QPainter p( this ); | ||
2833 | int ypos = textarray[0]->ascent()+m_topmargin; | ||
2834 | if (lineno == 0) | ||
2835 | { | ||
2836 | if (m_rotated) | ||
2837 | { | ||
2838 | blitRot(width()-(ypos+textarray[lineno]->descent()+textarray[lineno]->lineExtraSpacing()), 0, height(), -1, textarray[lineno]); | ||
2839 | } | ||
2840 | else | ||
2841 | { | ||
2842 | if (m_bgpm.isNull()) | ||
2843 | { | ||
2844 | p.fillRect(m_left_border,ypos-textarray[lineno]->ascent(),width()-(m_left_border+m_right_border),textarray[lineno]->lineSpacing(),m_bg); | ||
2845 | } | ||
2846 | else | ||
2847 | { | ||
2848 | bitBlt(this, m_left_border, ypos-textarray[lineno]->ascent(), dbuff, m_left_border, ypos-textarray[lineno]->ascent(), width()-(m_left_border+m_right_border), textarray[lineno]->lineSpacing()); | ||
2849 | } | ||
2850 | textarray[lineno]->render( &p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); | ||
2851 | } | ||
2852 | } | ||
2853 | for (int i = 1; i < numlines; i++) | ||
2854 | { | ||
2855 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ | ||
2856 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; | ||
2857 | if (i == lineno) | ||
2858 | { | ||
2859 | if (m_rotated) | ||
2860 | { | ||
2861 | blitRot(width()-(ypos+textarray[i]->descent()+textarray[i]->lineExtraSpacing()), 0, height(), -1, textarray[i]); | ||
2862 | } | ||
2863 | else | ||
2864 | { | ||
2865 | if (m_bgpm.isNull()) | ||
2866 | { | ||
2867 | p.fillRect(m_left_border,ypos-textarray[lineno]->ascent(),width()-(m_left_border+m_right_border),textarray[lineno]->lineSpacing(),m_bg); | ||
2868 | } | ||
2869 | else | ||
2870 | { | ||
2871 | bitBlt(this, m_left_border, ypos-textarray[lineno]->ascent(), dbuff, m_left_border, ypos-textarray[lineno]->ascent(), width()-(m_left_border+m_right_border), textarray[lineno]->lineSpacing()); | ||
2872 | } | ||
2873 | textarray[i]->render( &p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin); | ||
2874 | } | ||
2875 | } | ||
2876 | } | ||
2877 | } | ||
2878 | |||
2879 | |||
2880 | void QTReader::gotoLink() | ||
2881 | { | ||
2882 | if (m_currentlinkstyle == NULL) return; | ||
2883 | textarray[m_currentlink]->invertLink(m_currentlinkoffset); | ||
2884 | size_t saveposn = pagelocate(); | ||
2885 | QString href, nm; | ||
2886 | unsigned long tgt = m_currentlinkstyle->getData(); | ||
2887 | unsigned long tgtoffset = m_currentlinkstyle->getOffset(); | ||
2888 | linkType lt = buffdoc.hyperlink(tgt, tgtoffset, href, nm); | ||
2889 | qDebug("URL(1):%s", (const char*)href); | ||
2890 | if ((lt & eFile) != 0) | ||
2891 | { | ||
2892 | buffdoc.saveposn(m_lastfile, saveposn); | ||
2893 | #ifdef USEQPE | ||
2894 | { | ||
2895 | QCopEnvelope e("QPE/System", "busy()"); | ||
2896 | } | ||
2897 | #endif | ||
2898 | ResetScroll(); | ||
2899 | if (!href.isEmpty()) | ||
2900 | { | ||
2901 | if (!buffdoc.getFile(href)) | ||
2902 | { | ||
2903 | emit NewFileRequest(href); | ||
2904 | } | ||
2905 | else | ||
2906 | { | ||
2907 | ResetScroll(); | ||
2908 | fillbuffer(); | ||
2909 | update(); | ||
2910 | } | ||
2911 | } | ||
2912 | if (!nm.isEmpty()) | ||
2913 | { | ||
2914 | qDebug("QTReader:Finding %s", (const char*)nm); | ||
2915 | if (buffdoc.findanchor(nm)) | ||
2916 | { | ||
2917 | fillbuffer(); | ||
2918 | update(); | ||
2919 | } | ||
2920 | } | ||
2921 | //fillbuffer(); | ||
2922 | //update(); | ||
2923 | #ifdef USEQPE | ||
2924 | { | ||
2925 | QCopEnvelope e("QPE/System", "notBusy()"); | ||
2926 | } | ||
2927 | #endif | ||
2928 | } | ||
2929 | else if ((lt & eLink) != 0) | ||
2930 | { | ||
2931 | buffdoc.saveposn(m_lastfile, saveposn); | ||
2932 | ResetScroll(); | ||
2933 | fillbuffer(); | ||
2934 | update(); | ||
2935 | } | ||
2936 | else | ||
2937 | { | ||
2938 | if ((lt & ePicture) != 0) | ||
2939 | { | ||
2940 | QImage* pm = buffdoc.getPicture(tgt); | ||
2941 | if (pm != NULL) | ||
2942 | { | ||
2943 | emit OnShowPicture(*pm); | ||
2944 | delete pm; | ||
2945 | } | ||
2946 | } | ||
2947 | else | ||
2948 | { | ||
2949 | // QString anchortext = textarray[lineno]->getanchortext(startoffset); | ||
2950 | if (!href.isEmpty()) | ||
2951 | { | ||
2952 | emit OnURLSelected(href, tgt); | ||
2953 | } | ||
2954 | } | ||
2955 | locate(pagelocate()); | ||
2956 | } | ||
2957 | m_currentlinkstyle = NULL; | ||
2958 | m_currentlink = -1; | ||
2959 | m_currentlinkoffset = -1; | ||
2960 | } | ||
2961 | |||
2962 | void QTReader::refresh(bool full) | ||
2963 | { | ||
2964 | int h, w; | ||
2965 | if (m_rotated) | ||
2966 | { | ||
2967 | h = width(); | ||
2968 | w = height(); | ||
2969 | } | ||
2970 | else | ||
2971 | { | ||
2972 | w = width(); | ||
2973 | h = height(); | ||
2974 | } | ||
2975 | m_topmargin = (h*m_abstopmargin+500)/1000; | ||
2976 | m_bottommargin = (h*m_absbottommargin+500)/1000; | ||
2977 | m_left_border = (w*m_absleft_border+500)/1000; | ||
2978 | m_right_border = (w*m_absright_border+500)/1000; | ||
2979 | |||
2980 | qDebug("Top margin:%u", m_topmargin ); | ||
2981 | qDebug("Bottom margin:%u", m_bottommargin ); | ||
2982 | qDebug("Left margin:%u", m_left_border ); | ||
2983 | qDebug("Right margin:%u", m_right_border ); | ||
2984 | if (full && m_highlightfilter) m_highlightfilter->refresh(pagelocate()); | ||
2985 | locate(pagelocate()); | ||
2986 | } | ||
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index f89de63..7b0ebc8 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef __QTREADER_H | 1 | #ifndef __QTREADER_H |
2 | #define __QTREADER_H | 2 | #define __QTREADER_H |
3 | 3 | ||
4 | //#define _SCROLLPIPE | 4 | //#define _SCROLLPIPE |
5 | 5 | #include "static.h" | |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | //#include <qpainter.h> | 7 | //#include <qpainter.h> |
8 | #include "my_list.h" | 8 | #include "my_list.h" |
9 | #include "BuffDoc.h" | 9 | #include "BuffDoc.h" |
@@ -12,38 +12,88 @@ | |||
12 | //#include <qtimer.h> | 12 | //#include <qtimer.h> |
13 | 13 | ||
14 | class CDrawBuffer; | 14 | class CDrawBuffer; |
15 | //class CBuffer; | 15 | //class CBuffer; |
16 | #include <qpixmap.h> | ||
16 | class QPainter; | 17 | class QPainter; |
17 | class QTimer; | 18 | class QTimer; |
18 | class QPixmap; | 19 | class QImage; |
20 | |||
21 | #include "BGType.h" | ||
22 | #include "striphtml.h" | ||
23 | |||
24 | #define ROTATION_ENABLED | ||
25 | #define SPECIALSCROLL | ||
26 | #define DOUBLEBUFFER | ||
27 | #ifdef DOUBLEBUFFER | ||
28 | class QPainter; | ||
29 | #endif | ||
30 | |||
31 | class CStyle; | ||
19 | 32 | ||
20 | class QTReader : public QWidget | 33 | class QTReader : public QWidget |
21 | { | 34 | { |
22 | Q_OBJECT | 35 | Q_OBJECT |
23 | |||
24 | static tchar pluckernextpart[]; | ||
25 | static tchar jplucknextpart[]; | ||
26 | friend class QTReaderApp; | 36 | friend class QTReaderApp; |
27 | void suspend(); | 37 | #ifdef DOUBLEBUFFER |
38 | QPixmap *dbuff; | ||
39 | QPainter* dbp; | ||
40 | #endif | ||
41 | void drawSingleLine(int lineno); | ||
42 | void gotoLink(); | ||
43 | void emitRedraw(); | ||
44 | CStyle* m_currentlinkstyle; | ||
45 | int m_currentlink; | ||
46 | int m_currentlinkoffset; | ||
47 | QPixmap m_bgpm; | ||
48 | bool m_bgIsScaled; | ||
49 | bground m_bgtype; | ||
50 | int m_scrollpos; | ||
51 | unsigned short m_scrollstep; | ||
52 | void blitRot(int dx, int sx, int sw, int sh, CDrawBuffer* txt); | ||
53 | void setBackgroundBitmap(const QPixmap& _pm, bground bg) | ||
54 | { | ||
55 | m_bgpm = _pm; | ||
56 | m_bgtype = bg; | ||
57 | m_bgIsScaled = false; | ||
58 | } | ||
59 | |||
60 | QColor m_bg, m_default_bg, m_default_fg, m_negative_fg; | ||
61 | static tchar pluckernextpart[]; | ||
62 | static tchar jplucknextpart[]; | ||
63 | CList<Bkmk>* pBkmklist; | ||
64 | void setHyphenThreshold(int _v) { buffdoc.setHyphenThreshold(_v); } | ||
65 | void ResetScroll(); | ||
28 | void increaseScroll(); | 66 | void increaseScroll(); |
29 | void reduceScroll(); | 67 | void reduceScroll(); |
30 | void drawText(QPainter& p, int x, int y, tchar* text); | 68 | void drawText(QPainter& p, int x, int y, tchar* text); |
31 | int m_delay; | 69 | void DrawScroll( QPainter *p, int w, int h ); |
70 | void dorollingscroll(bool); | ||
71 | void doinplacescroll(); | ||
72 | void dostaticscroll(); | ||
73 | void suspend(); | ||
74 | void redrawScroll(QPainter* p); | ||
75 | int m_delay, m_scrolltype; | ||
32 | unsigned int m_overlap; | 76 | unsigned int m_overlap; |
33 | bool m_autoScroll, m_swapmouse; | 77 | bool m_autoScroll, m_swapmouse; |
78 | void drawBackground(); | ||
79 | #ifdef ROTATION_ENABLED | ||
80 | bool m_rotated; | ||
81 | void setrotated(bool); | ||
82 | #endif | ||
34 | void autoscroll(); | 83 | void autoscroll(); |
35 | QTimer* timer; | 84 | QTimer* timer; |
36 | int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart; | 85 | int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart, m_totalscroll; |
37 | void focusInEvent(QFocusEvent*); | 86 | void focusInEvent(QFocusEvent*); |
38 | void focusOutEvent(QFocusEvent*); | 87 | void focusOutEvent(QFocusEvent*); |
39 | void processmousepositionevent( QMouseEvent* _e ); | 88 | void processmousepositionevent( QMouseEvent* _e ); |
40 | void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno); | 89 | void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno); |
41 | bool ChangeFont(int); | 90 | bool ChangeFont(int); |
42 | bool getline(CDrawBuffer*); | 91 | bool getline(CDrawBuffer*); |
43 | int m_charWidth; | 92 | int m_charWidth; |
44 | int m_charpc; | 93 | int m_charpc; |
45 | unsigned char m_border; | 94 | unsigned short m_absleft_border, m_absright_border; |
95 | unsigned short m_left_border, m_right_border; | ||
46 | FontControl m_fontControl; | 96 | FontControl m_fontControl; |
47 | void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } | 97 | void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } |
48 | unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } | 98 | unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } |
49 | #ifdef _SCROLLPIPE | 99 | #ifdef _SCROLLPIPE |
@@ -55,18 +105,35 @@ class QTReader : public QWidget | |||
55 | public: | 105 | public: |
56 | QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0); | 106 | QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0); |
57 | // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0); | 107 | // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0); |
58 | ~QTReader(); | 108 | ~QTReader(); |
109 | QString about(); | ||
110 | CList<Bkmk>* Bkmklist() { return pBkmklist; } | ||
111 | void setBackground(const QColor& _c) | ||
112 | { | ||
113 | m_default_bg = _c; | ||
114 | reset_bg(); | ||
115 | } | ||
116 | void setForeground(const QColor& _c) | ||
117 | { | ||
118 | m_default_fg = _c; | ||
119 | int r,g,b; | ||
120 | m_default_fg.rgb(&r, &g, &b); | ||
121 | r = 255-r; | ||
122 | g = 255-g; | ||
123 | b = 255-b; | ||
124 | m_negative_fg.setRgb(r,g,b); | ||
125 | } | ||
59 | void zoomin(); | 126 | void zoomin(); |
60 | void zoomout(); | 127 | void zoomout(); |
61 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 128 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
62 | { | 129 | { |
63 | buffdoc.setSaveData(data, len, src, srclen); | 130 | buffdoc.setSaveData(data, len, src, srclen); |
64 | } | 131 | } |
65 | void putSaveData(unsigned char*& src, unsigned short& srclen) | 132 | void putSaveData(unsigned char*& src, unsigned short& srclen) |
66 | { | 133 | { |
67 | buffdoc.putSaveData(src, srclen); | 134 | buffdoc.putSaveData(src, srclen); |
68 | } | 135 | } |
69 | bool empty(); | 136 | bool empty(); |
70 | void setContinuous(bool _b); | 137 | void setContinuous(bool _b); |
71 | void toggle_autoscroll(); | 138 | void toggle_autoscroll(); |
72 | void setautoscroll(bool); | 139 | void setautoscroll(bool); |
@@ -74,9 +141,9 @@ public: | |||
74 | void copy() | 141 | void copy() |
75 | { | 142 | { |
76 | /* | 143 | /* |
77 | size_t nd = locate(); | 144 | size_t nd = locate(); |
78 | jumpto(m_mark); | 145 | jumpto(m_mark); |
79 | QString text; | 146 | QString text; |
80 | while (m_mark < nd) | 147 | while (m_mark < nd) |
81 | { | 148 | { |
82 | text += buffdoc.getch(); | 149 | text += buffdoc.getch(); |
@@ -90,148 +157,183 @@ public: | |||
90 | void setText(const QString& n, const QString& s) { m_string = n; load_file((const char*)s); }; | 157 | void setText(const QString& n, const QString& s) { m_string = n; load_file((const char*)s); }; |
91 | /* | 158 | /* |
92 | void setText(bool oldfile) | 159 | void setText(bool oldfile) |
93 | { | 160 | { |
94 | if (oldfile) | 161 | if (oldfile) |
95 | { | 162 | { |
96 | m_string = m_lastfile; | 163 | m_string = m_lastfile; |
97 | load_file((const tchar*)m_string); | 164 | load_file((const tchar*)m_string); |
98 | } | 165 | } |
99 | else | 166 | else |
100 | { | 167 | { |
101 | m_string = QString::null; | 168 | m_string = QString::null; |
102 | } | 169 | } |
103 | }; | 170 | }; |
104 | */ | 171 | */ |
105 | void setlead(int _lead) | 172 | void setlead(int _lead) |
106 | { | 173 | { |
107 | m_fontControl.setlead(_lead); | 174 | m_fontControl.setlead(_lead); |
108 | } | 175 | } |
109 | int getlead() | 176 | int getlead() |
110 | { | 177 | { |
111 | return m_fontControl.getlead(); | 178 | return m_fontControl.getlead(); |
112 | } | 179 | } |
113 | void setextraspace(int _lead) | 180 | void setextraspace(int _lead) |
114 | { | 181 | { |
115 | m_fontControl.setextraspace(_lead); | 182 | m_fontControl.setextraspace(_lead); |
116 | } | 183 | } |
117 | int getextraspace() | 184 | int getextraspace() |
118 | { | 185 | { |
119 | return m_fontControl.getextraspace(); | 186 | return m_fontControl.getextraspace(); |
120 | } | 187 | } |
121 | void setpagemode(bool _b) | 188 | void setpagemode(bool _b) |
122 | { | 189 | { |
123 | m_bpagemode = _b; | 190 | m_bpagemode = _b; |
124 | } | 191 | } |
125 | void setmono(bool _b) | 192 | void setmono(bool _b) |
126 | { | 193 | { |
127 | m_bMonoSpaced = _b; | 194 | m_bMonoSpaced = _b; |
128 | ChangeFont(m_fontControl.currentsize()); | 195 | ChangeFont(m_fontControl.currentsize()); |
129 | locate(pagelocate()); | 196 | locate(pagelocate()); |
130 | } | 197 | } |
131 | void setencoding(int _f) | 198 | void setencoding(int _f) |
132 | { | 199 | { |
133 | m_encd = _f; | 200 | m_encd = _f; |
134 | setfilter(getfilter()); | 201 | setfilter(getfilter()); |
135 | } | 202 | } |
136 | MarkupType PreferredMarkup(); | 203 | MarkupType PreferredMarkup(); |
137 | CEncoding* getencoding() | 204 | CEncoding* getencoding() |
138 | { | 205 | { |
139 | // odebug << "m_encd:" << m_encd << oendl; | 206 | // qDebug("m_encd:%d", m_encd); |
140 | switch (m_encd) | 207 | switch (m_encd) |
141 | { | 208 | { |
142 | case 4: | 209 | case 4: |
143 | // odebug << "palm" << oendl; | 210 | // qDebug("palm"); |
144 | return new CPalm; | 211 | return new CPalm; |
145 | case 1: | 212 | case 1: |
146 | // odebug << "utf8" << oendl; | 213 | // qDebug("utf8"); |
147 | return new CUtf8; | 214 | return new CUtf8; |
148 | case 2: | 215 | case 2: |
149 | // odebug << "ucs16be" << oendl; | 216 | // qDebug("ucs16be"); |
150 | return new CUcs16be; | 217 | return new CUcs16be; |
151 | case 3: | 218 | case 3: |
152 | // odebug << "ucs16le" << oendl; | 219 | // qDebug("ucs16le"); |
153 | return new CUcs16le; | 220 | return new CUcs16le; |
154 | case 0: | 221 | case 0: |
155 | // odebug << "ascii" << oendl; | 222 | // qDebug("ascii"); |
156 | return new CAscii; | 223 | return new CAscii; |
157 | default: | 224 | default: |
158 | return new CGeneral8Bit(m_encd-MAX_ENCODING+1); | 225 | return new CGeneral8Bit(m_encd-MAX_ENCODING+1); |
159 | } | 226 | } |
160 | } | 227 | } |
228 | HighlightFilter* m_highlightfilter; | ||
161 | CFilterChain* getfilter() | 229 | CFilterChain* getfilter() |
162 | { | 230 | { |
163 | CFilterChain * filt = new CFilterChain(getencoding()); | 231 | CFilterChain * filt = new CFilterChain(getencoding()); |
164 | if (bstripcr) filt->addfilter(new stripcr); | 232 | if (bstripcr) filt->addfilter(new stripcr); |
165 | 233 | ||
166 | if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); | 234 | if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); |
167 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); | 235 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); |
168 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml); | 236 | // if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile)); |
237 | |||
238 | #ifdef __STATIC | ||
239 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile)); | ||
240 | if (bautofmt && (PreferredMarkup() == cCHM)) | ||
241 | { | ||
242 | filt->addfilter(new striphtml(m_lastfile)); | ||
243 | } | ||
244 | #else | ||
245 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new ExternFilter("HTMLfilter", m_lastfile)); | ||
246 | if (bautofmt && (PreferredMarkup() == cCHM)) | ||
247 | { | ||
248 | ExternFilter* f = new ExternFilter("HTMLfilter",m_lastfile); | ||
249 | ((striphtml*)f->filter())->setchm(true); | ||
250 | filt->addfilter(f); | ||
251 | } | ||
252 | #endif | ||
253 | m_highlightfilter = new HighlightFilter(this); | ||
254 | filt->addfilter(m_highlightfilter); | ||
169 | 255 | ||
170 | if (bdehyphen) filt->addfilter(new dehyphen); | 256 | if (bdehyphen) filt->addfilter(new dehyphen); |
171 | if (bunindent) filt->addfilter(new unindent); | 257 | if (bunindent) filt->addfilter(new unindent); |
172 | if (brepara) filt->addfilter(new repara); | 258 | if (brepara) filt->addfilter(new repara(m_reparastring)); |
173 | if (bonespace) filt->addfilter(new OnePara); | 259 | if (bonespace) filt->addfilter(new OnePara); |
174 | if (bindenter) filt->addfilter(new indenter(bindenter)); | 260 | if (bindenter) filt->addfilter(new indenter(bindenter)); |
175 | if (bdblspce) filt->addfilter(new dblspce); | 261 | if (bdblspce) filt->addfilter(new dblspce); |
176 | #ifdef REPALM | ||
177 | if (brepalm) filt->addfilter(new repalm); | ||
178 | #endif | ||
179 | if (bremap) filt->addfilter(new remap); | ||
180 | if (bdepluck) filt->addfilter(new DePluck(pluckernextpart)); | 262 | if (bdepluck) filt->addfilter(new DePluck(pluckernextpart)); |
181 | if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart)); | 263 | if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart)); |
264 | if (brepalm) filt->addfilter(new repalm); | ||
265 | if (bkern) filt->addfilter(new kern); | ||
266 | if (bremap) filt->addfilter(new remap); | ||
182 | if (bmakebold) filt->addfilter(new embolden); | 267 | if (bmakebold) filt->addfilter(new embolden); |
183 | if (bfulljust) filt->addfilter(new FullJust); | 268 | if (bfulljust) filt->addfilter(new FullJust); |
269 | int r,g,b; | ||
270 | m_default_bg.rgb(&r, &g, &b); | ||
271 | if (r != 255 || g != 255 || b != 255) | ||
272 | filt->addfilter(new setbg(r,g,b)); | ||
273 | m_default_fg.rgb(&r, &g, &b); | ||
274 | if (r != 0 || g != 0 || b != 0) | ||
275 | filt->addfilter(new setfg(r,g,b)); | ||
276 | // if (bNegative) filt->addfilter(new makeNegative); | ||
277 | if (bInverse) filt->addfilter(new makeInverse); | ||
184 | return filt; | 278 | return filt; |
185 | } | 279 | } |
186 | 280 | ||
187 | 281 | ||
188 | private slots: | 282 | private slots: |
283 | void dopageup(); | ||
284 | void lineDown(); | ||
285 | void lineUp(); | ||
286 | void dopagedn(); | ||
189 | void goHome(); | 287 | void goHome(); |
190 | void goBack(); | 288 | void goBack(); |
191 | void goForward(); | 289 | void goForward(); |
192 | void doscroll(); | 290 | void doscroll(); |
193 | void drawIt( QPainter * ); | ||
194 | void paintEvent( QPaintEvent * ); | 291 | void paintEvent( QPaintEvent * ); |
195 | // void resizeEvent( QResizeEvent * p ) { update(); } | 292 | #ifdef DOUBLEBUFFER |
293 | void resizeEvent( QResizeEvent * p ); | ||
294 | #endif | ||
196 | void keyPressEvent(QKeyEvent*); | 295 | void keyPressEvent(QKeyEvent*); |
197 | void drawFonts(QPainter*); | ||
198 | private: | 296 | private: |
297 | // void drawIt( QPainter * ); | ||
298 | void redrawall(); | ||
299 | void drawFonts(); | ||
300 | void DrawStraight(QPainter* p, int w, int h); | ||
301 | QColor m_scrollcolor, m_scrollbarcolor; | ||
199 | void setTwoTouch(bool _b); | 302 | void setTwoTouch(bool _b); |
200 | void init(); | 303 | void init(); |
201 | void mousePressEvent( QMouseEvent* ); | 304 | void mousePressEvent( QMouseEvent* ); |
202 | void mouseReleaseEvent( QMouseEvent* ); | 305 | void mouseReleaseEvent( QMouseEvent* ); |
203 | // void mouseDoubleClickEvent( QMouseEvent* ); | 306 | // void mouseDoubleClickEvent( QMouseEvent* ); |
204 | QString m_string, m_fontname; | 307 | QString m_string, m_fontname, m_reparastring; |
205 | void setfont(); | 308 | void setfont(); |
206 | //myoutput stuff | 309 | //myoutput stuff |
207 | private: | 310 | private: |
311 | #ifdef SPECIALSCROLL | ||
312 | int m_scrolldy; | ||
313 | #endif | ||
208 | bool mouseUpOn; | 314 | bool mouseUpOn; |
209 | linkType getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt); | 315 | linkType getcurrentpos(int x, int y, int w, int h, int& lineno, size_t& start, size_t& offset, size_t& tgt, size_t& tgtoffset, size_t& pictgt, QImage*&); |
210 | bool m_twotouch, m_touchone; | 316 | bool m_twotouch, m_touchone; |
211 | size_t m_startpos, m_startoffset; | 317 | size_t m_startpos, m_startoffset; |
212 | void dopageup(unsigned int); | 318 | void dopageup(unsigned int); |
213 | void dopageup(); | ||
214 | void lineDown(); | ||
215 | void lineUp(); | ||
216 | void dopagedn(); | ||
217 | long real_delay(); | 319 | long real_delay(); |
218 | int m_textsize; | 320 | int m_textsize; |
219 | int m_lastwidth, m_lastheight; | 321 | int m_lastwidth, m_lastheight; |
220 | CBufferFace<CDrawBuffer*> textarray; | 322 | CBufferFace<CDrawBuffer*> textarray; |
221 | CBufferFace<size_t> locnarray; | 323 | CBufferFace<size_t> locnarray; |
222 | unsigned int numlines; | 324 | unsigned int numlines; |
223 | // bool m_showlast; | 325 | // bool m_showlast; |
224 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust; | 326 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust, /*bNegative,*/ bInverse; |
225 | #ifdef REPALM | 327 | bool bkern, brepalm; |
226 | bool brepalm; | ||
227 | #endif | ||
228 | bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; | 328 | bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; |
229 | unsigned char bindenter; | 329 | unsigned char bindenter; |
230 | QString m_lastfile; | 330 | QString m_lastfile; |
231 | size_t m_lastposn; | 331 | size_t m_lastposn; |
232 | public: | ||
233 | bool bDoUpdates; | 332 | bool bDoUpdates; |
333 | public: | ||
334 | void setDoUpdates(bool b) { bDoUpdates = b; } | ||
335 | void setStripCR(bool b) { bstripcr = b; } | ||
234 | void NavUp(); | 336 | void NavUp(); |
235 | void NavDown(); | 337 | void NavDown(); |
236 | tchar getch() { return buffdoc.getch(); } | 338 | tchar getch() { return buffdoc.getch(); } |
237 | bool synch(size_t, size_t); | 339 | bool synch(size_t, size_t); |
@@ -239,34 +341,76 @@ private slots: | |||
239 | bool load_file(const char *newfile, unsigned int lcn=0); | 341 | bool load_file(const char *newfile, unsigned int lcn=0); |
240 | BuffDoc buffdoc; | 342 | BuffDoc buffdoc; |
241 | CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); } | 343 | CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); } |
242 | bool locate(unsigned long n); | 344 | bool locate(unsigned long n); |
243 | void jumpto(unsigned long n) { buffdoc.unsuspend(); buffdoc.locate(n); } | 345 | void jumpto(unsigned long n) { buffdoc.locate(n); } |
244 | unsigned long locate() { buffdoc.unsuspend(); return buffdoc.locate(); } | 346 | unsigned long locate() { return buffdoc.locate(); } |
245 | unsigned long explocate() { buffdoc.unsuspend(); return buffdoc.explocate(); } | 347 | unsigned long explocate() { return buffdoc.explocate(); } |
246 | unsigned long pagelocate() { return locnarray[0]; } | 348 | unsigned long pagelocate() { return locnarray[0]; } |
247 | unsigned long mylastpos; | 349 | unsigned long mylastpos; |
248 | void setfilter(CFilterChain *f) { buffdoc.unsuspend(); buffdoc.setfilter(f); locate(pagelocate()); } | 350 | void getNextLink(); |
351 | void setfilter(CFilterChain *f) { buffdoc.setfilter(f); if (bDoUpdates) locate(pagelocate()); } | ||
249 | void restore() { jumpto(mylastpos); } | 352 | void restore() { jumpto(mylastpos); } |
250 | void goUp(); | 353 | void goUp(); |
251 | void refresh() { locate(pagelocate()); } | 354 | void refresh(bool full = false); |
252 | void goDown(); | 355 | void goDown(); |
253 | // bool bold; | 356 | // bool bold; |
254 | int textsize() { return m_textsize; } | 357 | int textsize() { return m_textsize; } |
255 | void textsize(int ts) { m_textsize = ts; } | 358 | void textsize(int ts) { m_textsize = ts; } |
256 | bool fillbuffer(int ru = 0, int ht = 0, int newht = -1); | 359 | bool fillbuffer(int ru = 0, int ht = -1, int newht = -1); |
360 | void CalculateScrollParameters(); | ||
257 | unsigned int screenlines(); | 361 | unsigned int screenlines(); |
258 | void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.unsuspend(); buffdoc.sizes(fs,ts); } | 362 | void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.sizes(fs,ts); } |
259 | static const char *fonts[]; | 363 | static const char *fonts[]; |
260 | // unsigned int *fontsizes; | 364 | // unsigned int *fontsizes; |
261 | int m_ascent, m_descent, m_linespacing; | 365 | int m_ascent, m_descent, m_linespacing; |
366 | int m_topmargin, m_bottommargin; | ||
367 | int m_abstopmargin, m_absbottommargin; | ||
262 | QFontMetrics* m_fm; | 368 | QFontMetrics* m_fm; |
263 | QString firstword(); | 369 | QString firstword(); |
264 | 370 | bool hyphenate; | |
371 | void reset_bg() | ||
372 | { | ||
373 | int r,g,b; | ||
374 | m_default_bg.rgb(&r, &g, &b); | ||
375 | if (bInverse) | ||
376 | { | ||
377 | r = 255-r; | ||
378 | g = 255-g; | ||
379 | b = 255-b; | ||
380 | } | ||
381 | m_bg.setRgb(r,g,b); | ||
382 | /* | ||
383 | int h,s,v; | ||
384 | m_bg.hsv(&h, &s, &v); | ||
385 | if (bNegative) | ||
386 | { | ||
387 | v = 255-v; | ||
388 | m_bg.setHsv(h,s,v); | ||
389 | } | ||
390 | */ | ||
391 | setBackgroundColor( m_bg ); | ||
392 | } | ||
393 | void setInverse(bool b) | ||
394 | { | ||
395 | bInverse = b; | ||
396 | reset_bg(); | ||
397 | } | ||
398 | /* | ||
399 | void setNegative() | ||
400 | { | ||
401 | bNegative = !bNegative; | ||
402 | reset_bg(); | ||
403 | } | ||
404 | */ | ||
265 | signals: | 405 | signals: |
266 | void OnRedraw(); | 406 | void OnRedraw(); |
267 | void OnWordSelected(const QString&, size_t, const QString&); | 407 | void OnWordSelected(const QString&, size_t, size_t, const QString&); |
268 | void OnShowPicture(QImage&); | 408 | void OnShowPicture(QImage&); |
269 | void OnURLSelected(const QString&); | 409 | void OnURLSelected(const QString&, const size_t); |
410 | void NewFileRequest(const QString&); | ||
411 | void HandleKeyRequest(QKeyEvent*); | ||
412 | void SetScrollState(bool); | ||
413 | void RefreshBitmap(); | ||
270 | }; | 414 | }; |
271 | 415 | ||
272 | #endif | 416 | #endif |
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index f18cb59..63d1fb0 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -1,4222 +1,4966 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. Allrights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. Allrights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | #include "useqpe.h" | |
21 | #include "useqpe.h" | 21 | #include <qregexp.h> |
22 | #include "QTReader.h" | 22 | #include <qclipboard.h> |
23 | #include "GraphicWin.h" | 23 | #include <qwidgetstack.h> |
24 | #include "Bkmks.h" | 24 | #ifdef USEQPE |
25 | #include "cbkmkselector.h" | 25 | #include <qpe/qpemenubar.h> |
26 | #include "infowin.h" | 26 | #include <qpe/qpetoolbar.h> |
27 | #include "ToolbarPrefs.h" | 27 | #endif |
28 | #include "Prefs.h" | 28 | #include <qmenubar.h> |
29 | #include "CAnnoEdit.h" | 29 | #include <qtoolbar.h> |
30 | #include "QFloatBar.h" | 30 | #ifdef USEQPE |
31 | #include "FixedFont.h" | 31 | #include <qpe/menubutton.h> |
32 | #include "URLDialog.h" | 32 | #endif |
33 | #include "QTReaderApp.h" | 33 | #include <qcombobox.h> |
34 | #include "CDrawBuffer.h" | 34 | #include <qpopupmenu.h> |
35 | #include "Filedata.h" | 35 | #include <qaction.h> |
36 | #include "opie.h" | 36 | #include <qapplication.h> |
37 | #include "names.h" | 37 | #include <qlineedit.h> |
38 | #include "CEncoding_tables.h" | 38 | #include <qtoolbutton.h> |
39 | #include "CloseDialog.h" | 39 | #include <qspinbox.h> |
40 | 40 | #include <qobjectlist.h> | |
41 | /* OPIE */ | 41 | #include <qstatusbar.h> |
42 | #include <opie2/odebug.h> | 42 | #ifdef USEQPE |
43 | #ifdef USEQPE | 43 | #include <qpe/global.h> |
44 | #include <qpe/menubutton.h> | 44 | #include <qpe/applnk.h> |
45 | #include <qpe/fontdatabase.h> | 45 | #endif |
46 | #include <qpe/global.h> | 46 | #include <qfileinfo.h> |
47 | #include <qpe/applnk.h> | 47 | #include <stdlib.h> //getenv |
48 | #include <qpe/config.h> | 48 | #include <qprogressbar.h> |
49 | #include <qpe/qcopenvelope_qws.h> | 49 | #ifdef USEQPE |
50 | #endif | 50 | #include <qpe/config.h> |
51 | 51 | #endif | |
52 | /* QT */ | 52 | #include <qbuttongroup.h> |
53 | #ifdef USEQPE | 53 | #include <qradiobutton.h> |
54 | #include <qmenubar.h> | 54 | #ifdef USEQPE |
55 | #include <qtoolbar.h> | 55 | #include <qpe/qcopenvelope_qws.h> |
56 | #endif | 56 | #endif |
57 | #include <qregexp.h> | 57 | #include "QTReader.h" |
58 | #include <qclipboard.h> | 58 | #include "GraphicWin.h" |
59 | #include <qwidgetstack.h> | 59 | #include "Bkmks.h" |
60 | #include <qmenubar.h> | 60 | #include "cbkmkselector.h" |
61 | #include <qtoolbar.h> | 61 | #include "infowin.h" |
62 | #include <qcombobox.h> | 62 | #include "ToolbarPrefs.h" |
63 | #include <qpopupmenu.h> | 63 | #include "Prefs.h" |
64 | #include <qaction.h> | 64 | #include "CAnnoEdit.h" |
65 | #include <qapplication.h> | 65 | #include "QFloatBar.h" |
66 | #include <qlineedit.h> | 66 | #include "FixedFont.h" |
67 | #include <qtoolbutton.h> | 67 | #include "URLDialog.h" |
68 | #include <qspinbox.h> | 68 | #include "util.h" |
69 | #include <qobjectlist.h> | 69 | #include <qfontdatabase.h> |
70 | #include <qfileinfo.h> | 70 | #include "opie.h" |
71 | #include <qprogressbar.h> | 71 | #ifdef USEQPE |
72 | #include <qbuttongroup.h> | 72 | #include <qpe/resource.h> |
73 | #include <qradiobutton.h> | 73 | #ifdef OPIE |
74 | 74 | //#include <qpe/applnk.h> | |
75 | /* STD */ | 75 | #include <opie2/ofiledialog.h> |
76 | #include <stdlib.h> //getenv | 76 | using namespace Opie::Ui; |
77 | 77 | #else | |
78 | 78 | #include "fileBrowser.h" | |
79 | #ifdef USEQPE | 79 | #endif |
80 | #include <qpe/resource.h> | 80 | #else |
81 | #include <qpe/qpeapplication.h> | 81 | #include "qfiledialog.h" |
82 | #include "fileBrowser.h" | 82 | #endif |
83 | #else | 83 | |
84 | #include "qfiledialog.h" | 84 | #include "QTReaderApp.h" |
85 | #endif | 85 | #include "CDrawBuffer.h" |
86 | 86 | #include "Filedata.h" | |
87 | bool CheckVersion(int&, int&, char&); | 87 | #include "useqpe.h" |
88 | 88 | #include "names.h" | |
89 | #ifdef _WINDOWS | 89 | #include "CEncoding_tables.h" |
90 | #define PICDIR "c:\\uqtreader\\pics\\" | 90 | #include "CloseDialog.h" |
91 | #else | 91 | |
92 | #ifdef USEQPE | 92 | #include "ButtonPrefs.h" |
93 | #define PICDIR "opie-reader/" | 93 | |
94 | #else | 94 | bool CheckVersion(int&, int&, char&); |
95 | #define PICDIR "/home/tim/uqtreader/pics/" | 95 | |
96 | #endif | 96 | #ifdef _WINDOWS |
97 | #endif | 97 | #define PICDIR "c:\\uqtreader\\pics\\" |
98 | 98 | #else | |
99 | unsigned long QTReaderApp::m_uid = 0; | 99 | #ifdef USEQPE |
100 | 100 | #define USEMSGS | |
101 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } | 101 | #define PICDIR "opie-reader/" |
102 | 102 | #else | |
103 | #ifdef USEQPE | 103 | //#define PICDIR "/home/tim/uqtreader/pics/" |
104 | #define geticon(iconname) Resource::loadPixmap( iconname ) | 104 | QString picdir() |
105 | #define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) | 105 | { |
106 | #else | 106 | QString hd(getenv("READERDIR")); |
107 | #define geticon(iconname) QPixmap(PICDIR iconname ".png") | 107 | return hd + "/pics"; |
108 | #define getmyicon(iconname) geticon(iconname) | 108 | } |
109 | //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) | 109 | #define PICDIR picdir() |
110 | #endif | 110 | #endif |
111 | 111 | #endif | |
112 | #ifndef _WINDOWS | 112 | |
113 | #include <unistd.h> | 113 | unsigned long QTReaderApp::m_uid = 0; |
114 | #endif | 114 | |
115 | #include <stddef.h> | 115 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } |
116 | #ifndef _WINDOWS | 116 | |
117 | #include <dirent.h> | 117 | #ifdef USEQPE |
118 | #endif | 118 | #define geticon(iconname) Resource::loadPixmap( iconname ) |
119 | 119 | #define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) | |
120 | void QTReaderApp::listBkmkFiles() | 120 | #else |
121 | { | 121 | //#define geticon(iconname) QPixmap(PICDIR iconname ".png") |
122 | bkmkselector->clear(); | 122 | #define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png") |
123 | bkmkselector->setText("Cancel"); | 123 | #define getmyicon(iconname) geticon(iconname) |
124 | #ifndef USEQPE | 124 | //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) |
125 | int cnt = 0; | 125 | #endif |
126 | 126 | ||
127 | QDir d = QDir::home(); // "/" | 127 | #ifndef _WINDOWS |
128 | if ( !d.cd(APPDIR) ) { // "/tmp" | 128 | #include <unistd.h> |
129 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; | 129 | #endif |
130 | d = QDir::home(); | 130 | #include <stddef.h> |
131 | d.mkdir(APPDIR); | 131 | #ifndef _WINDOWS |
132 | d.cd(APPDIR); | 132 | #include <dirent.h> |
133 | } | 133 | #endif |
134 | 134 | ||
135 | 135 | void QTReaderApp::listBkmkFiles() | |
136 | 136 | { | |
137 | 137 | bkmkselector->clear(); | |
138 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 138 | bkmkselector->setText("Cancel"); |
139 | // d.setSorting( QDir::Size | QDir::Reversed ); | 139 | #ifndef USEQPE |
140 | 140 | int cnt = 0; | |
141 | const QFileInfoList *list = d.entryInfoList(); | 141 | |
142 | QFileInfoListIterator it( *list ); // create list iterator | 142 | QDir d = QDir::home(); // "/" |
143 | QFileInfo *fi; // pointer for traversing | 143 | if ( !d.cd(APPDIR) ) { // "/tmp" |
144 | 144 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | |
145 | while ( (fi=it.current()) ) { // for each file... | 145 | d = QDir::home(); |
146 | 146 | d.mkdir(APPDIR); | |
147 | bkmkselector->insertItem(fi->fileName()); | 147 | d.cd(APPDIR); |
148 | cnt++; | 148 | } |
149 | 149 | ||
150 | //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl; | 150 | |
151 | ++it; // goto next list element | 151 | |
152 | } | 152 | |
153 | 153 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | |
154 | #else /* USEQPE */ | 154 | // d.setSorting( QDir::Size | QDir::Reversed ); |
155 | int cnt = 0; | 155 | |
156 | DIR *d; | 156 | const QFileInfoList *list = d.entryInfoList(); |
157 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); | 157 | QFileInfoListIterator it( *list ); // create list iterator |
158 | 158 | QFileInfo *fi; // pointer for traversing | |
159 | while(1) | 159 | |
160 | { | 160 | while ( (fi=it.current()) ) { // for each file... |
161 | struct dirent* de; | 161 | |
162 | struct stat buf; | 162 | bkmkselector->insertItem(fi->fileName()); |
163 | de = readdir(d); | 163 | cnt++; |
164 | if (de == NULL) break; | 164 | |
165 | 165 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | |
166 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 166 | ++it; // goto next list element |
167 | { | 167 | } |
168 | bkmkselector->insertItem(de->d_name); | 168 | |
169 | cnt++; | 169 | #else /* USEQPE */ |
170 | } | 170 | int cnt = 0; |
171 | } | 171 | DIR *d; |
172 | 172 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); | |
173 | closedir(d); | 173 | |
174 | #endif | 174 | while(1) |
175 | if (cnt > 0) | 175 | { |
176 | { | 176 | struct dirent* de; |
177 | //tjw menu->hide(); | 177 | struct stat buf; |
178 | editorStack->raiseWidget( bkmkselector ); | 178 | de = readdir(d); |
179 | hidetoolbars(); | 179 | if (de == NULL) break; |
180 | m_nBkmkAction = cRmBkmkFile; | 180 | |
181 | } | 181 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) |
182 | else | 182 | { |
183 | QMessageBox::information(this, PROGNAME, "No bookmark files"); | 183 | bkmkselector->insertItem(de->d_name); |
184 | } | 184 | cnt++; |
185 | 185 | } | |
186 | void QTReaderApp::hidetoolbars() | 186 | } |
187 | { | 187 | |
188 | menubar->hide(); | 188 | closedir(d); |
189 | if (fileBar != NULL) fileBar->hide(); | 189 | #endif |
190 | if (viewBar != NULL) viewBar->hide(); | 190 | if (cnt > 0) |
191 | if (navBar != NULL) navBar->hide(); | 191 | { |
192 | if (markBar != NULL) markBar->hide(); | 192 | //tjw menu->hide(); |
193 | if (m_fontVisible) m_fontBar->hide(); | 193 | |
194 | if (regVisible) | 194 | |
195 | { | 195 | editorStack->raiseWidget( bkmkselector ); |
196 | #ifdef USEQPE | 196 | hidetoolbars(); |
197 | Global::hideInputMethod(); | 197 | m_nBkmkAction = cRmBkmkFile; |
198 | #endif | 198 | } |
199 | regBar->hide(); | 199 | else |
200 | } | 200 | QMessageBox::information(this, PROGNAME, "No bookmark files"); |
201 | if (searchVisible) | 201 | } |
202 | { | 202 | |
203 | #ifdef USEQPE | 203 | void QTReaderApp::hidetoolbars() |
204 | Global::hideInputMethod(); | 204 | { |
205 | #endif | 205 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
206 | searchBar->hide(); | 206 | if (m_prog != NULL) m_prog->hide(); |
207 | } | 207 | |
208 | } | 208 | #ifdef USEQPE |
209 | 209 | menubar->hide(); | |
210 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | 210 | #endif |
211 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), | 211 | |
212 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) | 212 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
213 | { | 213 | |
214 | m_url_clipboard = false; | 214 | if (fileBar != NULL) fileBar->hide(); |
215 | m_url_localfile = false; | 215 | if (viewBar != NULL) viewBar->hide(); |
216 | m_url_globalfile = false; | 216 | if (navBar != NULL) navBar->hide(); |
217 | ftime(&m_lastkeytime); | 217 | if (markBar != NULL) markBar->hide(); |
218 | //// odebug << "Application directory = " << (const tchar *)QPEApplication::documentDir() << "" << oendl; | 218 | if (m_fontVisible) m_fontBar->hide(); |
219 | //// odebug << "Application directory = " << (const tchar *)Global::applicationFileName("uqtreader" << "" << oendl; | 219 | if (regVisible) |
220 | 220 | { | |
221 | m_bcloseDisabled = true; | 221 | #ifdef USEQPE |
222 | m_disableesckey = false; | 222 | Global::hideInputMethod(); |
223 | pBkmklist = NULL; | 223 | #endif |
224 | pOpenlist = NULL; | 224 | regBar->hide(); |
225 | // doc = 0; | 225 | } |
226 | 226 | if (searchVisible) | |
227 | m_fBkmksChanged = false; | 227 | { |
228 | 228 | #ifdef USEQPE | |
229 | QString lang = getenv( "LANG" ); | 229 | Global::hideInputMethod(); |
230 | QString rot = getenv( "QWS_DISPLAY" ); | 230 | #endif |
231 | 231 | searchBar->hide(); | |
232 | /* | 232 | } |
233 | int m_rot = 0; | 233 | } |
234 | if (rot.contains("Rot90")) | 234 | |
235 | { | 235 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) |
236 | m_rot = 90; | 236 | : QMainWindow( parent, name, f ), m_dontSave(false), |
237 | } | 237 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false) |
238 | else if (rot.contains("Rot180")) | 238 | { |
239 | { | 239 | { |
240 | m_rot = 180; | 240 | setKeyCompression ( true ); |
241 | } | 241 | #ifndef USEQPE |
242 | else if (rot.contains("Rot270")) | 242 | QDir d = QDir::home(); // "/" |
243 | { | 243 | d.cd(APPDIR); |
244 | m_rot = 270; | 244 | QFileInfo fi(d, ".keymap"); |
245 | } | 245 | FILE* f = fopen((const char *)fi.absFilePath(), "r"); |
246 | 246 | #else /* USEQPE */ | |
247 | // odebug << "Initial Rotation(" << m_rot << "):" << rot << "" << oendl; | 247 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r"); |
248 | */ | 248 | #endif /* USEQPE */ |
249 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 249 | if (f != NULL) |
250 | 250 | { | |
251 | #ifdef USEQPE | 251 | uint cnt; |
252 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); | 252 | if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION)) |
253 | #else | 253 | { |
254 | setIcon( QPixmap (PICDIR "uqtreader.png") ); | 254 | if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0; |
255 | #endif /* USEQPE */ | 255 | for (uint i = 0; i != cnt; i++) |
256 | 256 | { | |
257 | // QToolBar *bar = new QToolBar( this ); | 257 | orKey key; |
258 | // menubar = new QToolBar( this ); | 258 | int data; |
259 | #ifdef USEQPE | 259 | fread(&key, sizeof(key), 1, f); |
260 | Config config( APPDIR ); | 260 | fread(&data, sizeof(data), 1, f); |
261 | #else | 261 | kmap[key] = data; |
262 | QDir d = QDir::home(); // "/" | 262 | } |
263 | if ( !d.cd(APPDIR) ) { // "/tmp" | 263 | } |
264 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; | 264 | fclose(f); |
265 | d = QDir::home(); | 265 | } |
266 | d.mkdir(APPDIR); | 266 | } |
267 | d.cd(APPDIR); | 267 | |
268 | } | 268 | m_url_clipboard = false; |
269 | QFileInfo fi(d, INIFILE); | 269 | m_url_localfile = false; |
270 | // odebug << "Path:" << fi.absFilePath() << "" << oendl; | 270 | m_url_globalfile = false; |
271 | Config config(fi.absFilePath()); | 271 | ftime(&m_lastkeytime); |
272 | #endif | 272 | //// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); |
273 | config.setGroup("Toolbar"); | 273 | //// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); |
274 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 274 | |
275 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 275 | m_bcloseDisabled = true; |
276 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 276 | m_disableesckey = false; |
277 | menubar = new QToolBar("Menus", this, m_tbposition); | 277 | pBkmklist = NULL; |
278 | 278 | pOpenlist = NULL; | |
279 | // fileBar = new QToolBar("File", this); | 279 | // doc = 0; |
280 | // QToolBar* viewBar = new QToolBar("File", this); | 280 | |
281 | // QToolBar* navBar = new QToolBar("File", this); | 281 | m_fBkmksChanged = false; |
282 | // QToolBar* markBar = new QToolBar("File", this); | 282 | |
283 | 283 | QString lang = getenv( "LANG" ); | |
284 | #ifdef USEQPE | 284 | QString rot = getenv( "QWS_DISPLAY" ); |
285 | mb = new QMenuBar( menubar ); | 285 | |
286 | #else | 286 | /* |
287 | mb = new QMenuBar( menubar ); | 287 | int m_rot = 0; |
288 | #endif | 288 | if (rot.contains("Rot90")) |
289 | 289 | { | |
290 | //#ifdef USEQPE | 290 | m_rot = 90; |
291 | QPopupMenu* tmp = new QPopupMenu(mb); | 291 | } |
292 | mb->insertItem( geticon( "AppsIcon" ), tmp ); | 292 | else if (rot.contains("Rot180")) |
293 | //#else | 293 | { |
294 | // QMenuBar* tmp = mb; | 294 | m_rot = 180; |
295 | //#endif | 295 | } |
296 | 296 | else if (rot.contains("Rot270")) | |
297 | QPopupMenu *file = new QPopupMenu( mb ); | 297 | { |
298 | tmp->insertItem( tr( "File" ), file ); | 298 | m_rot = 270; |
299 | 299 | } | |
300 | QPopupMenu *navigation = new QPopupMenu(mb); | 300 | |
301 | tmp->insertItem( tr( "Navigation" ), navigation ); | 301 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); |
302 | 302 | */ | |
303 | QPopupMenu *view = new QPopupMenu( mb ); | 303 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
304 | tmp->insertItem( tr( "View" ), view ); | 304 | |
305 | 305 | #ifdef USEQPE | |
306 | QPopupMenu *marks = new QPopupMenu( this ); | 306 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); |
307 | tmp->insertItem( tr( "Marks" ), marks ); | 307 | #else |
308 | 308 | setIcon( QPixmap (PICDIR + "/uqtreader.png") ); | |
309 | QPopupMenu *settings = new QPopupMenu( this ); | 309 | #endif /* USEQPE */ |
310 | tmp->insertItem( tr( "Settings" ), settings ); | 310 | |
311 | 311 | // QPEToolBar *bar = new QPEToolBar( this ); | |
312 | // addToolBar(menubar, "Menus",QMainWindow::Top); | 312 | // menubar = new QPEToolBar( this ); |
313 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); | 313 | #ifdef USEQPE |
314 | 314 | Config config( APPDIR ); | |
315 | // QPopupMenu *edit = new QPopupMenu( this ); | 315 | #else |
316 | 316 | QDir d = QDir::home(); // "/" | |
317 | /* | 317 | if ( !d.cd(APPDIR) ) { // "/tmp" |
318 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 318 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
319 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 319 | d = QDir::home(); |
320 | a->addTo( bar ); | 320 | d.mkdir(APPDIR); |
321 | a->addTo( file ); | 321 | d.cd(APPDIR); |
322 | */ | 322 | } |
323 | 323 | QFileInfo fi(d, INIFILE); | |
324 | editorStack = new QWidgetStack( this ); | 324 | // qDebug("Path:%s", (const char*)fi.absFilePath()); |
325 | setCentralWidget( editorStack ); | 325 | Config config(fi.absFilePath()); |
326 | 326 | #endif | |
327 | searchVisible = FALSE; | 327 | config.setGroup("Toolbar"); |
328 | regVisible = FALSE; | 328 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); |
329 | m_fontVisible = false; | 329 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); |
330 | 330 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | |
331 | m_annoWin = new CAnnoEdit(editorStack); | 331 | m_qtscroll = config.readNumEntry("QTScrollBar", false); |
332 | editorStack->addWidget(m_annoWin, get_unique_id()); | 332 | m_localscroll = config.readNumEntry("LocalScrollBar", false); |
333 | connect( m_annoWin, SIGNAL( finished(const QString&,const QString&) ), this, SLOT( addAnno(const QString&,const QString&) ) ); | 333 | |
334 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); | 334 | // fileBar = new QToolBar("File", this); |
335 | 335 | // QToolBar* viewBar = new QToolBar("File", this); | |
336 | m_infoWin = new infowin(editorStack); | 336 | // QToolBar* navBar = new QToolBar("File", this); |
337 | editorStack->addWidget(m_infoWin, get_unique_id()); | 337 | // QToolBar* markBar = new QToolBar("File", this); |
338 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); | 338 | |
339 | 339 | #ifdef USEQPE | |
340 | m_graphicwin = new GraphicWin(editorStack); | 340 | menubar = new QToolBar("Menus", this, m_tbposition); |
341 | editorStack->addWidget(m_graphicwin, get_unique_id()); | 341 | mb = new QPEMenuBar( menubar ); |
342 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); | 342 | #else |
343 | 343 | mb = new QMenuBar( this ); | |
344 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); | 344 | #endif |
345 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); | 345 | |
346 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); | 346 | #ifdef USEQPE |
347 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); | 347 | QPopupMenu* tmp = new QPopupMenu(mb); |
348 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); | 348 | mb->insertItem( geticon( "AppsIcon" ), tmp ); |
349 | editorStack->addWidget( bkmkselector, get_unique_id() ); | 349 | #else |
350 | 350 | QMenuBar* tmp = mb; | |
351 | /* | 351 | #endif |
352 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); | 352 | |
353 | connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) ); | 353 | QPopupMenu *file = new QPopupMenu( mb ); |
354 | 354 | tmp->insertItem( tr( "File" ), file ); | |
355 | editorStack->addWidget( importSelector, get_unique_id() ); | 355 | |
356 | 356 | QPopupMenu *navigation = new QPopupMenu(mb); | |
357 | // don't need the close visible, it is redundant... | 357 | tmp->insertItem( tr( "Navigation" ), navigation ); |
358 | importSelector->setCloseVisible( FALSE ); | 358 | |
359 | */ | 359 | QPopupMenu *view = new QPopupMenu( mb ); |
360 | // odebug << "Reading file list" << oendl; | 360 | tmp->insertItem( tr( "View" ), view ); |
361 | readfilelist(); | 361 | |
362 | 362 | QPopupMenu *marks = new QPopupMenu( this ); | |
363 | reader = new QTReader( editorStack ); | 363 | tmp->insertItem( tr( "Marks" ), marks ); |
364 | 364 | ||
365 | reader->bDoUpdates = false; | 365 | QPopupMenu *settings = new QPopupMenu( this ); |
366 | 366 | tmp->insertItem( tr( "Settings" ), settings ); | |
367 | #ifdef USEQPE | 367 | |
368 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | 368 | // addToolBar(menubar, "Menus",QMainWindow::Top); |
369 | #endif | 369 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); |
370 | 370 | ||
371 | // odebug << "Reading config" << oendl; | 371 | // QPopupMenu *edit = new QPopupMenu( this ); |
372 | // Config config( APPDIR ); | 372 | |
373 | config.setGroup( "View" ); | 373 | /* |
374 | m_debounce = config.readNumEntry("Debounce", 0); | 374 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
375 | #ifdef USEQPE | 375 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
376 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 376 | a->addTo( bar ); |
377 | #else | 377 | a->addTo( file ); |
378 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); | 378 | */ |
379 | #endif | 379 | QWidget* widge = new QWidget(this); |
380 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); | 380 | setCentralWidget( widge ); |
381 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | 381 | QVBoxLayout* vlayout = new QVBoxLayout(widge); |
382 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); | 382 | m_layout = new QBoxLayout(QBoxLayout::LeftToRight); |
383 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 383 | m_prog = new QLabel(widge); |
384 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | 384 | vlayout->addLayout(m_layout, 1); |
385 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | 385 | vlayout->addWidget(m_prog); |
386 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 386 | |
387 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | 387 | editorStack = new QWidgetStack( widge ); |
388 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 388 | // setCentralWidget( editorStack ); |
389 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | 389 | |
390 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); | 390 | searchVisible = FALSE; |
391 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); | 391 | regVisible = FALSE; |
392 | reader->bunindent = config.readBoolEntry( "Unindent", false ); | 392 | m_fontVisible = false; |
393 | reader->brepara = config.readBoolEntry( "Repara", false ); | 393 | |
394 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); | 394 | m_buttonprefs = new CButtonPrefs(&kmap, this); |
395 | reader->bindenter = config.readNumEntry( "Indent", 0 ); | 395 | editorStack->addWidget(m_buttonprefs, get_unique_id()); |
396 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 396 | connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
397 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 397 | |
398 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 398 | |
399 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 399 | m_annoWin = new CAnnoEdit(editorStack); |
400 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 400 | editorStack->addWidget(m_annoWin, get_unique_id()); |
401 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | 401 | connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); |
402 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); | 402 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); |
403 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); | 403 | |
404 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); | 404 | m_infoWin = new infowin(editorStack); |
405 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); | 405 | editorStack->addWidget(m_infoWin, get_unique_id()); |
406 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | 406 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); |
407 | reader->m_border = config.readNumEntry( "Margin", 6 ); | 407 | |
408 | #ifdef REPALM | 408 | m_graphicwin = new GraphicWin(editorStack); |
409 | reader->brepalm = config.readBoolEntry( "Repalm", true ); | 409 | editorStack->addWidget(m_graphicwin, get_unique_id()); |
410 | #endif | 410 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
411 | reader->bremap = config.readBoolEntry( "Remap", true ); | 411 | |
412 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); | 412 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); |
413 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); | 413 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); |
414 | m_targetapp = config.readEntry( "TargetApp", QString::null ); | 414 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); |
415 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 415 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); |
416 | #ifdef _SCROLLPIPE | 416 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); |
417 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); | 417 | editorStack->addWidget( bkmkselector, get_unique_id() ); |
418 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); | 418 | |
419 | #endif | 419 | /* |
420 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | 420 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); |
421 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | 421 | connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); |
422 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | 422 | |
423 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | 423 | editorStack->addWidget( importSelector, get_unique_id() ); |
424 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | 424 | |
425 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | 425 | // don't need the close visible, it is redundant... |
426 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); | 426 | importSelector->setCloseVisible( FALSE ); |
427 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); | 427 | */ |
428 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); | 428 | // qDebug("Reading file list"); |
429 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); | 429 | readfilelist(); |
430 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); | 430 | |
431 | 431 | reader = new QTReader( editorStack ); | |
432 | m_leftScroll = config.readBoolEntry("LeftScroll", false); | 432 | |
433 | m_rightScroll = config.readBoolEntry("RightScroll", false); | 433 | reader->setDoUpdates(false); |
434 | m_upScroll = config.readBoolEntry("UpScroll", true); | 434 | |
435 | m_downScroll = config.readBoolEntry("DownScroll", true); | 435 | #ifdef USEQPE |
436 | 436 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | |
437 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); | 437 | #endif |
438 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | 438 | |
439 | 439 | // qDebug("Reading config"); | |
440 | #ifndef USEQPE | 440 | // Config config( APPDIR ); |
441 | config.setGroup( "Geometry" ); | 441 | config.setGroup( "View" ); |
442 | setGeometry(0,0, | 442 | m_debounce = config.readNumEntry("Debounce", 0); |
443 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), | 443 | m_buttonprefs->Debounce(m_debounce); |
444 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); | 444 | #ifdef USEQPE |
445 | move( | 445 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
446 | config.readNumEntry( "x", 20 ), | 446 | #else |
447 | config.readNumEntry( "y", 20 )); | 447 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); |
448 | #endif | 448 | #endif |
449 | 449 | reader->setStripCR(config.readBoolEntry( "StripCr", true )); | |
450 | 450 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | |
451 | 451 | /* | |
452 | setTwoTouch(m_twoTouch); | 452 | bool btmp = config.readBoolEntry("Negative", false); |
453 | 453 | if (btmp) reader->setNegative(); | |
454 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); | 454 | */ |
455 | 455 | reader->bInverse = config.readBoolEntry("Inverse", false); | |
456 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); | 456 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false )); |
457 | connect( reader, SIGNAL( OnWordSelected(const QString&,size_t,const QString&) ), this, SLOT( OnWordSelected(const QString&,size_t,const QString&) ) ); | 457 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); |
458 | connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) ); | 458 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); |
459 | editorStack->addWidget( reader, get_unique_id() ); | 459 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); |
460 | 460 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | |
461 | m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); | 461 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); |
462 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); | 462 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); |
463 | m_preferences_action->addTo( settings ); | 463 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); |
464 | 464 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | |
465 | m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); | 465 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); |
466 | connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); | 466 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); |
467 | m_saveconfig_action->addTo( settings ); | 467 | reader->bunindent = config.readBoolEntry( "Unindent", false ); |
468 | 468 | reader->brepara = config.readBoolEntry( "Repara", false ); | |
469 | m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); | 469 | reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}"); |
470 | connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); | 470 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 ); |
471 | m_loadconfig_action->addTo( settings ); | 471 | m_themename = config.readEntry("Theme", QString::null ); |
472 | 472 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); | |
473 | m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); | 473 | reader->bindenter = config.readNumEntry( "Indent", 0 ); |
474 | connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); | 474 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); |
475 | m_tidyconfig_action->addTo( settings ); | 475 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
476 | 476 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); | |
477 | settings->insertSeparator(); | 477 | |
478 | m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); | 478 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); |
479 | connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); | 479 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); |
480 | m_toolbarprefs_action->addTo( settings ); | 480 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); |
481 | 481 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | |
482 | m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); | 482 | reader->m_rotated = config.readBoolEntry( "IsRotated", false ); |
483 | connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); | 483 | reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 ); |
484 | m_open_action->addTo( file ); | 484 | m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%"); |
485 | 485 | m_statusishidden = config.readBoolEntry("StatusHidden", false); | |
486 | m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); | 486 | m_background = config.readNumEntry( "Background", 0 ); |
487 | connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); | 487 | reader->setBackground(getcolour(m_background)); |
488 | m_close_action->addTo( file ); | 488 | m_foreground = config.readNumEntry( "Foreground", 1 ); |
489 | 489 | reader->setForeground(getcolour(m_foreground)); | |
490 | #ifdef _SCRIPT | 490 | m_scrollcolor = config.readNumEntry( "ScrollColour", 5 ); |
491 | a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); | 491 | setscrollcolour(); |
492 | connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); | 492 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 ); |
493 | a->addTo( file ); | 493 | setscrollbarcolour(); |
494 | #endif | 494 | reader->hyphenate = config.readBoolEntry( "Hyphenate", false ); |
495 | /* | 495 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); |
496 | a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); | 496 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); |
497 | connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); | 497 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); |
498 | a->addTo( file ); | 498 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); |
499 | 499 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | |
500 | a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); | 500 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 ); |
501 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); | 501 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 ); |
502 | a->addTo( filebar() ); | 502 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); |
503 | a->addTo( edit ); | 503 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); |
504 | */ | 504 | |
505 | 505 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); | |
506 | m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); | 506 | |
507 | connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); | 507 | reader->brepalm = config.readBoolEntry( "Repalm", false ); |
508 | m_info_action->addTo( file ); | 508 | reader->bkern = config.readBoolEntry( "Kern", false ); |
509 | 509 | reader->bremap = config.readBoolEntry( "Remap", true ); | |
510 | m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); | 510 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); |
511 | connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); | 511 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); |
512 | m_touch_action->setOn(m_twoTouch); | 512 | m_targetapp = config.readEntry( "TargetApp", QString::null ); |
513 | m_touch_action->addTo( file ); | 513 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); |
514 | 514 | #ifdef _SCROLLPIPE | |
515 | m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); | 515 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); |
516 | connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 516 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); |
517 | file->insertSeparator(); | 517 | #endif |
518 | // a->addTo( bar ); | 518 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); |
519 | m_find_action->addTo( file ); | 519 | m_doAnnotation = config.readBoolEntry( "Annotation", false); |
520 | 520 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | |
521 | m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); | 521 | m_doClipboard = config.readBoolEntry( "Clipboard", false); |
522 | connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); | 522 | /* |
523 | m_exportlinks_action->addTo( file ); | 523 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); |
524 | 524 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | |
525 | m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); | 525 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); |
526 | connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); | 526 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); |
527 | m_scrollButton->addTo(navigation); | 527 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); |
528 | m_scrollButton->setOn(false); | 528 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); |
529 | 529 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); | |
530 | m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); | 530 | |
531 | connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); | 531 | m_leftScroll = config.readBoolEntry("LeftScroll", false); |
532 | m_start_action->addTo(navigation); | 532 | m_rightScroll = config.readBoolEntry("RightScroll", false); |
533 | 533 | m_upScroll = config.readBoolEntry("UpScroll", true); | |
534 | m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); | 534 | m_downScroll = config.readBoolEntry("DownScroll", true); |
535 | connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); | 535 | */ |
536 | m_end_action->addTo(navigation); | 536 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); |
537 | 537 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | |
538 | m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); | 538 | reader->setHyphenThreshold(config.readNumEntry( "HyphenThreshold", 50 )); |
539 | connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); | 539 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); |
540 | m_jump_action->addTo(navigation); | 540 | #ifndef USEQPE |
541 | 541 | config.setGroup( "Geometry" ); | |
542 | m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); | 542 | setGeometry(0,0, |
543 | connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); | 543 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), |
544 | m_pageline_action->addTo(navigation); | 544 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); |
545 | m_pageline_action->setOn(reader->m_bpagemode); | 545 | move( |
546 | 546 | config.readNumEntry( "x", 20 ), | |
547 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); | 547 | config.readNumEntry( "y", 20 )); |
548 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); | 548 | #else |
549 | m_pageup_action->addTo( navigation ); | 549 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", false); |
550 | 550 | #endif | |
551 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); | 551 | |
552 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 552 | |
553 | m_pagedn_action->addTo( navigation ); | 553 | |
554 | 554 | setTwoTouch(m_twoTouch); | |
555 | m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 ); | 555 | |
556 | connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) ); | 556 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); |
557 | m_back_action->addTo( navigation ); | 557 | |
558 | 558 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); | |
559 | m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 ); | 559 | connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, size_t, const QString&) ) ); |
560 | connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) ); | 560 | connect( reader, SIGNAL( OnURLSelected(const QString&, const size_t) ), this, SLOT( OnURLSelected(const QString&, const size_t) ) ); |
561 | m_home_action->addTo( navigation ); | 561 | connect( reader, SIGNAL( NewFileRequest(const QString&) ), this, SLOT( forceopen(const QString&) ) ); |
562 | 562 | connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) ); | |
563 | m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 ); | 563 | connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) ); |
564 | connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) ); | 564 | connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap())); |
565 | m_forward_action->addTo( navigation ); | 565 | editorStack->addWidget( reader, get_unique_id() ); |
566 | 566 | ||
567 | /* | 567 | m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); |
568 | a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); | 568 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); |
569 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 569 | m_preferences_action->addTo( settings ); |
570 | a->addTo( file ); | 570 | |
571 | 571 | m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); | |
572 | a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true ); | 572 | connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); |
573 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 573 | m_saveconfig_action->addTo( settings ); |
574 | a->addTo( file ); | 574 | |
575 | */ | 575 | m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); |
576 | 576 | connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); | |
577 | // file->insertSeparator(); | 577 | m_loadconfig_action->addTo( settings ); |
578 | 578 | ||
579 | #ifdef _SCROLLPIPE | 579 | m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); |
580 | 580 | connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); | |
581 | QActionGroup* ag = new QActionGroup(this); | 581 | m_tidyconfig_action->addTo( settings ); |
582 | ag->setExclusive(false); | 582 | |
583 | spacemenu = new QPopupMenu(this); | 583 | settings->insertSeparator(); |
584 | file->insertItem( tr( "Scrolling" ), spacemenu ); | 584 | m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); |
585 | 585 | connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); | |
586 | a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL); | 586 | m_toolbarprefs_action->addTo( settings ); |
587 | connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) ); | 587 | |
588 | 588 | m_buttonprefs_action = new QAction( tr( "Buttons" ), QString::null, 0, this, NULL); | |
589 | a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true ); | 589 | connect( m_buttonprefs_action, SIGNAL( activated() ), this, SLOT( showbuttonprefs() ) ); |
590 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) ); | 590 | m_buttonprefs_action->addTo( settings ); |
591 | a->setOn(reader->m_pauseAfterEachPara); | 591 | |
592 | 592 | m_loadtheme_action = new QAction( tr( "Load Theme" ), QString::null, 0, this, NULL); | |
593 | ag->addTo(spacemenu); | 593 | connect( m_loadtheme_action, SIGNAL( activated() ), this, SLOT( LoadTheme() ) ); |
594 | // file->insertSeparator(); | 594 | m_loadtheme_action->addTo( settings ); |
595 | 595 | ||
596 | #endif | 596 | m_repara_action = new QAction( tr( "EOP Marker" ), QString::null, 0, this, NULL); |
597 | 597 | connect( m_repara_action, SIGNAL( activated() ), this, SLOT( reparastring() ) ); | |
598 | /* | 598 | m_repara_action->addTo(settings); |
599 | a = new QAction( tr( "Import" ), QString::null, 0, this, NULL ); | 599 | |
600 | connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) ); | 600 | #ifdef USEQPE |
601 | a->addTo( file ); | 601 | m_grab_action = new QAction( tr( "Grab Buttons" ), QString::null, 0, this, NULL, true ); |
602 | */ | 602 | connect( m_grab_action, SIGNAL( toggled(bool) ), this, SLOT( setgrab(bool) ) ); |
603 | 603 | m_grab_action->setOn(m_grabkeyboard); | |
604 | /* | 604 | m_grab_action->addTo( settings ); |
605 | a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 ); | 605 | #endif |
606 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 606 | |
607 | a->addTo( fileBar ); | 607 | m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); |
608 | a->addTo( edit ); | 608 | connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); |
609 | */ | 609 | m_open_action->addTo( file ); |
610 | 610 | ||
611 | // a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 ); | 611 | m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); |
612 | 612 | connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); | |
613 | m_fullscreen = false; | 613 | m_close_action->addTo( file ); |
614 | m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true ); | 614 | |
615 | connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) ); | 615 | #ifdef _SCRIPT |
616 | m_actFullscreen->setOn(m_fullscreen); | 616 | a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); |
617 | m_actFullscreen->addTo( view ); | 617 | connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); |
618 | 618 | a->addTo( file ); | |
619 | view->insertSeparator(); | 619 | #endif |
620 | 620 | /* | |
621 | m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this); | 621 | a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); |
622 | connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) ); | 622 | connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); |
623 | m_zoomin_action->addTo( view ); | 623 | a->addTo( file ); |
624 | 624 | ||
625 | m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this); | 625 | a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); |
626 | connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) ); | 626 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); |
627 | m_zoomout_action->addTo( view ); | 627 | a->addTo( filebar() ); |
628 | 628 | a->addTo( edit ); | |
629 | view->insertSeparator(); | 629 | */ |
630 | m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this); | 630 | |
631 | connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) ); | 631 | m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); |
632 | m_setfont_action->addTo( view ); | 632 | connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); |
633 | 633 | m_info_action->addTo( file ); | |
634 | view->insertSeparator(); | 634 | |
635 | m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); | 635 | m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); |
636 | connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); | 636 | connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); |
637 | m_setenc_action->addTo( view ); | 637 | m_touch_action->setOn(m_twoTouch); |
638 | 638 | m_touch_action->addTo( file ); | |
639 | m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); | 639 | |
640 | connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); | 640 | m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); |
641 | m_setmono_action->addTo( view ); | 641 | connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
642 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 642 | file->insertSeparator(); |
643 | 643 | // a->addTo( bar ); | |
644 | 644 | m_find_action->addTo( file ); | |
645 | // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); | 645 | |
646 | // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); | 646 | m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); |
647 | 647 | connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); | |
648 | 648 | m_exportlinks_action->addTo( file ); | |
649 | 649 | ||
650 | // a->addTo( filebar() ); | 650 | m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); |
651 | // view->insertSeparator(); | 651 | connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); |
652 | 652 | m_scrollButton->addTo(navigation); | |
653 | /* | 653 | m_scrollButton->setOn(false); |
654 | a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); | 654 | |
655 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); | 655 | m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); |
656 | a->setOn(reader->m_bMonoSpaced); | 656 | connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); |
657 | a->addTo( view ); | 657 | m_start_action->addTo(navigation); |
658 | */ | 658 | |
659 | /* | 659 | m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); |
660 | a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); | 660 | connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); |
661 | connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); | 661 | m_end_action->addTo(navigation); |
662 | a->addTo( view ); | 662 | |
663 | */ | 663 | m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); |
664 | 664 | connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); | |
665 | m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); | 665 | m_jump_action->addTo(navigation); |
666 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); | 666 | |
667 | m_mark_action->addTo( marks ); | 667 | m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); |
668 | 668 | connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); | |
669 | m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); | 669 | m_pageline_action->addTo(navigation); |
670 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); | 670 | m_pageline_action->setOn(reader->m_bpagemode); |
671 | m_annotate_action->addTo( marks ); | 671 | |
672 | 672 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); | |
673 | m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); | 673 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); |
674 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); | 674 | m_pageup_action->addTo( navigation ); |
675 | m_goto_action->addTo( marks ); | 675 | |
676 | 676 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); | |
677 | m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); | 677 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
678 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); | 678 | m_pagedn_action->addTo( navigation ); |
679 | m_delete_action->addTo( marks ); | 679 | |
680 | 680 | m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 ); | |
681 | m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); | 681 | connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) ); |
682 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); | 682 | m_back_action->addTo( navigation ); |
683 | marks->insertSeparator(); | 683 | |
684 | m_autogen_action->addTo( marks ); | 684 | m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 ); |
685 | 685 | connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) ); | |
686 | m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); | 686 | m_home_action->addTo( navigation ); |
687 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); | 687 | |
688 | m_clear_action->addTo( marks ); | 688 | m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 ); |
689 | 689 | connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) ); | |
690 | m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); | 690 | m_forward_action->addTo( navigation ); |
691 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); | 691 | |
692 | m_save_action->addTo( marks ); | 692 | /* |
693 | 693 | a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); | |
694 | m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); | 694 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
695 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); | 695 | a->addTo( file ); |
696 | marks->insertSeparator(); | 696 | |
697 | m_tidy_action->addTo( marks ); | 697 | a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true ); |
698 | 698 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | |
699 | m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); | 699 | a->addTo( file ); |
700 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); | 700 | */ |
701 | marks->insertSeparator(); | 701 | |
702 | m_startBlock_action->addTo( marks ); | 702 | // file->insertSeparator(); |
703 | 703 | ||
704 | m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); | 704 | #ifdef _SCROLLPIPE |
705 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 705 | |
706 | m_endBlock_action->addTo( marks ); | 706 | QActionGroup* ag = new QActionGroup(this); |
707 | 707 | ag->setExclusive(false); | |
708 | m_bkmkAvail = NULL; | 708 | spacemenu = new QPopupMenu(this); |
709 | 709 | file->insertItem( tr( "Scrolling" ), spacemenu ); | |
710 | 710 | ||
711 | setToolBarsMovable(m_tbmove); | 711 | a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL); |
712 | addtoolbars(&config); | 712 | connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) ); |
713 | 713 | ||
714 | pbar = new QProgressBar(this); | 714 | a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true ); |
715 | pbar->hide(); | 715 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) ); |
716 | 716 | a->setOn(reader->m_pauseAfterEachPara); | |
717 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 717 | |
718 | 718 | ag->addTo(spacemenu); | |
719 | searchBar->setHorizontalStretchable( TRUE ); | 719 | // file->insertSeparator(); |
720 | 720 | ||
721 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 721 | #endif |
722 | 722 | ||
723 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 723 | /* |
724 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 724 | a = new QAction( tr( "Import" ), QString::null, 0, this, NULL ); |
725 | // searchEdit->setFont( f ); | 725 | connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) ); |
726 | searchBar->setStretchableWidget( searchEdit ); | 726 | a->addTo( file ); |
727 | 727 | */ | |
728 | 728 | ||
729 | #ifdef __ISEARCH | 729 | /* |
730 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), | 730 | a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 ); |
731 | this, SLOT( search(const QString&) ) ); | 731 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
732 | #else | 732 | a->addTo( fileBar ); |
733 | connect( searchEdit, SIGNAL( returnPressed() ), | 733 | a->addTo( edit ); |
734 | this, SLOT( search() ) ); | 734 | */ |
735 | #endif | 735 | |
736 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); | 736 | // a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 ); |
737 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 737 | |
738 | a->addTo( searchBar ); | 738 | m_fullscreen = false; |
739 | 739 | m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true ); | |
740 | a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); | 740 | connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) ); |
741 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 741 | m_actFullscreen->setOn(m_fullscreen); |
742 | a->addTo( searchBar ); | 742 | m_actFullscreen->addTo( view ); |
743 | 743 | ||
744 | searchBar->hide(); | 744 | m_rotate_action = new QAction( tr( "Rotate" ), geticon( "repeat" ), QString::null, 0, this, NULL, true ); |
745 | 745 | connect( m_rotate_action, SIGNAL( toggled(bool) ), this, SLOT( setrotated(bool) ) ); | |
746 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); | 746 | m_rotate_action->setOn(reader->m_rotated); |
747 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 747 | m_rotate_action->addTo( view ); |
748 | 748 | ||
749 | regBar->setHorizontalStretchable( TRUE ); | 749 | m_inverse_action = new QAction( tr( "Invert" ), getmyicon( "invert" ), QString::null, 0, this, NULL, true ); |
750 | 750 | connect( m_inverse_action, SIGNAL( toggled(bool) ), this, SLOT( setinverted(bool) ) ); | |
751 | regEdit = new QLineEdit( regBar, "regEdit" ); | 751 | m_inverse_action->setOn(reader->bInverse); |
752 | // regEdit->setFont( f ); | 752 | m_inverse_action->addTo( view ); |
753 | 753 | ||
754 | regBar->setStretchableWidget( regEdit ); | 754 | view->insertSeparator(); |
755 | 755 | ||
756 | connect( regEdit, SIGNAL( returnPressed() ), | 756 | m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this); |
757 | this, SLOT( do_regaction() ) ); | 757 | connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) ); |
758 | 758 | m_zoomin_action->addTo( view ); | |
759 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); | 759 | |
760 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); | 760 | m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this); |
761 | a->addTo( regBar ); | 761 | connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) ); |
762 | 762 | m_zoomout_action->addTo( view ); | |
763 | a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); | 763 | |
764 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); | 764 | view->insertSeparator(); |
765 | a->addTo( regBar ); | 765 | m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this); |
766 | 766 | connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) ); | |
767 | regBar->hide(); | 767 | m_setfont_action->addTo( view ); |
768 | 768 | ||
769 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 769 | view->insertSeparator(); |
770 | 770 | m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); | |
771 | m_fontBar->setHorizontalStretchable( TRUE ); | 771 | connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); |
772 | 772 | m_setenc_action->addTo( view ); | |
773 | // odebug << "Font selector" << oendl; | 773 | |
774 | m_fontSelector = new QComboBox(false, m_fontBar); | 774 | m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); |
775 | m_fontBar->setStretchableWidget( m_fontSelector ); | 775 | connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); |
776 | { | 776 | m_setmono_action->addTo( view ); |
777 | #ifndef USEQPE | 777 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
778 | QFontDatabase f; | 778 | |
779 | #else | 779 | |
780 | FontDatabase f; | 780 | // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); |
781 | #endif | 781 | // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); |
782 | QStringList flist = f.families(); | 782 | |
783 | bool realfont = false; | 783 | |
784 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | 784 | |
785 | { | 785 | // a->addTo( filebar() ); |
786 | if (reader->m_fontname == *nm) | 786 | // view->insertSeparator(); |
787 | { | 787 | |
788 | realfont = true; | 788 | /* |
789 | } | 789 | a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); |
790 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); | 790 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); |
791 | } | 791 | a->setOn(reader->m_bMonoSpaced); |
792 | if (!realfont) reader->m_fontname = flist[0]; | 792 | a->addTo( view ); |
793 | } // delete the FontDatabase!!! | 793 | */ |
794 | connect( m_fontSelector, SIGNAL( activated(const QString&) ), | 794 | /* |
795 | this, SLOT( do_setfont(const QString&) ) ); | 795 | a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); |
796 | connect( m_fontSelector, SIGNAL( activated(int) ), | 796 | connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); |
797 | this, SLOT( do_setencoding(int) ) ); | 797 | a->addTo( view ); |
798 | 798 | */ | |
799 | m_fontBar->hide(); | 799 | |
800 | m_fontVisible = false; | 800 | m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); |
801 | #ifdef USEMSGS | 801 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); |
802 | connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 802 | m_mark_action->addTo( marks ); |
803 | this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); | 803 | |
804 | #endif | 804 | m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); |
805 | // odebug << "Initing" << oendl; | 805 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); |
806 | reader->init(); | 806 | m_annotate_action->addTo( marks ); |
807 | // odebug << "Inited" << oendl; | 807 | |
808 | // m_buttonAction[m_spaceTarget]->setOn(true); | 808 | m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); |
809 | // odebug << "fonting" << oendl; | 809 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); |
810 | do_setfont(reader->m_fontname); | 810 | m_goto_action->addTo( marks ); |
811 | if (!reader->m_lastfile.isEmpty()) | 811 | |
812 | { | 812 | m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); |
813 | // odebug << "doclnk" << oendl; | 813 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); |
814 | // doc = new DocLnk(reader->m_lastfile); | 814 | m_delete_action->addTo( marks ); |
815 | // odebug << "doclnk done" << oendl; | 815 | |
816 | if (pOpenlist != NULL) | 816 | m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); |
817 | { | 817 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); |
818 | 818 | marks->insertSeparator(); | |
819 | /* | 819 | m_autogen_action->addTo( marks ); |
820 | int ind = 0; | 820 | |
821 | Bkmk* p = (*pOpenlist)[ind]; | 821 | m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); |
822 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 822 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); |
823 | { | 823 | m_clear_action->addTo( marks ); |
824 | p = (*pOpenlist)[++ind]; | 824 | |
825 | } | 825 | m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); |
826 | */ | 826 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); |
827 | Bkmk* p = NULL; | 827 | m_save_action->addTo( marks ); |
828 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 828 | |
829 | { | 829 | m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); |
830 | p = iter.pContent(); | 830 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); |
831 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 831 | marks->insertSeparator(); |
832 | { | 832 | m_tidy_action->addTo( marks ); |
833 | break; | 833 | |
834 | } | 834 | m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); |
835 | // odebug << "Item:" << toQString(CFiledata(p->anno()).name()) << "" << oendl; | 835 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); |
836 | p = NULL; | 836 | marks->insertSeparator(); |
837 | } | 837 | m_startBlock_action->addTo( marks ); |
838 | if (p != NULL) | 838 | |
839 | { | 839 | m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); |
840 | // odebug << "openfrombkmk" << oendl; | 840 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
841 | if (!openfrombkmk(p)) | 841 | m_endBlock_action->addTo( marks ); |
842 | showEditTools(); | 842 | |
843 | } | 843 | m_bkmkAvail = NULL; |
844 | else | 844 | |
845 | { | 845 | |
846 | // odebug << "openfile" << oendl; | 846 | setToolBarsMovable(m_tbmove); |
847 | openFile( reader->m_lastfile ); | 847 | addtoolbars(&config); |
848 | } | 848 | |
849 | } | 849 | pbar = new QProgressBar(this); |
850 | else | 850 | pbar->hide(); |
851 | { | 851 | |
852 | // odebug << "Openfile 2" << oendl; | 852 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
853 | if (!reader->m_lastfile.isEmpty()) | 853 | |
854 | openFile( reader->m_lastfile ); | 854 | searchBar->setHorizontalStretchable( TRUE ); |
855 | } | 855 | |
856 | } | 856 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
857 | else | 857 | |
858 | { | 858 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
859 | showEditTools(); | 859 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
860 | } | 860 | // searchEdit->setFont( f ); |
861 | // qApp->processEvents(); | 861 | searchBar->setStretchableWidget( searchEdit ); |
862 | reader->bDoUpdates = true; | 862 | |
863 | reader->update(); | 863 | |
864 | config.setGroup("Version"); | 864 | #ifdef __ISEARCH |
865 | int major = config.readNumEntry("Major", 0); | 865 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
866 | int bkmktype = config.readNumEntry("BkmkType", 0); | 866 | this, SLOT( search( const QString& ) ) ); |
867 | char minor = config.readNumEntry("Minor", 0); | 867 | #else |
868 | if (CheckVersion(major, bkmktype, minor)) | 868 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
869 | { | 869 | this, SLOT( search( ) ) ); |
870 | config.writeEntry("Major", major); | 870 | #endif |
871 | config.writeEntry("BkmkType", bkmktype); | 871 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); |
872 | config.writeEntry("Minor", (int)minor); | 872 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
873 | } | 873 | a->addTo( searchBar ); |
874 | // odebug << "finished update" << oendl; | 874 | |
875 | } | 875 | a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); |
876 | 876 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | |
877 | void QTReaderApp::addtoolbars(Config* config) | 877 | a->addTo( searchBar ); |
878 | { | 878 | |
879 | config->setGroup("Toolbar"); | 879 | searchBar->hide(); |
880 | 880 | ||
881 | if (fileBar != NULL) | 881 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); |
882 | { | 882 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
883 | if (fileBar != menubar) | 883 | |
884 | { | 884 | regBar->setHorizontalStretchable( TRUE ); |
885 | fileBar->clear(); | 885 | |
886 | } | 886 | regEdit = new QLineEdit( regBar, "regEdit" ); |
887 | else | 887 | // regEdit->setFont( f ); |
888 | { | 888 | |
889 | m_preferences_action->removeFrom( filebar() ); | 889 | regBar->setStretchableWidget( regEdit ); |
890 | m_open_action->removeFrom( filebar() ); | 890 | |
891 | m_close_action->removeFrom( filebar() ); | 891 | connect( regEdit, SIGNAL( returnPressed( ) ), |
892 | m_info_action->removeFrom( filebar() ); | 892 | this, SLOT( do_regaction() ) ); |
893 | m_touch_action->removeFrom( filebar() ); | 893 | |
894 | m_find_action->removeFrom( filebar() ); | 894 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); |
895 | } | 895 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); |
896 | } | 896 | a->addTo( regBar ); |
897 | 897 | ||
898 | m_preferences_action->addTo( filebar() ); | 898 | a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); |
899 | addfilebar(config, "Open", m_open_action); | 899 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); |
900 | addfilebar(config, "Close", m_close_action); | 900 | a->addTo( regBar ); |
901 | addfilebar(config, "Info", m_info_action); | 901 | |
902 | addfilebar(config, "Two/One Touch", m_touch_action); | 902 | regBar->hide(); |
903 | addfilebar(config, "Find", m_find_action); | 903 | |
904 | 904 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | |
905 | if (navBar != NULL) | 905 | |
906 | { | 906 | m_fontBar->setHorizontalStretchable( TRUE ); |
907 | if ((navBar == fileBar) && (fileBar == menubar)) | 907 | |
908 | { | 908 | // qDebug("Font selector"); |
909 | m_scrollButton->removeFrom( navbar() ); | 909 | m_fontSelector = new QComboBox(false, m_fontBar); |
910 | m_start_action->removeFrom( navbar() ); | 910 | m_fontBar->setStretchableWidget( m_fontSelector ); |
911 | m_end_action->removeFrom( navbar() ); | 911 | { |
912 | m_jump_action->removeFrom( navbar() ); | 912 | QFontDatabase f; |
913 | m_pageline_action->removeFrom( navbar() ); | 913 | QStringList flist = f.families(); |
914 | m_pageup_action->removeFrom( navbar() ); | 914 | bool realfont = false; |
915 | m_pagedn_action->removeFrom( navbar() ); | 915 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) |
916 | m_back_action->removeFrom( navbar() ); | 916 | { |
917 | m_home_action->removeFrom( navbar() ); | 917 | if (reader->m_fontname == *nm) |
918 | m_forward_action->removeFrom( navbar() ); | 918 | { |
919 | } | 919 | realfont = true; |
920 | else if (navBar != fileBar) | 920 | } |
921 | { | 921 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); |
922 | navBar->clear(); | 922 | } |
923 | } | 923 | if (!realfont) reader->m_fontname = flist[0]; |
924 | } | 924 | } // delete the FontDatabase!!! |
925 | 925 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), | |
926 | addnavbar(config, "Scroll", m_scrollButton); | 926 | this, SLOT( do_setfont(const QString&) ) ); |
927 | addnavbar(config, "Goto Start", m_start_action); | 927 | connect( m_fontSelector, SIGNAL( activated(int ) ), |
928 | addnavbar(config, "Goto End", m_end_action); | 928 | this, SLOT( do_setencoding(int) ) ); |
929 | 929 | ||
930 | addnavbar(config, "Jump", m_jump_action); | 930 | m_fontBar->hide(); |
931 | addnavbar(config, "Page/Line Scroll", m_pageline_action); | 931 | m_fontVisible = false; |
932 | 932 | #ifdef USEMSGS | |
933 | addnavbar(config, "Page Up", m_pageup_action); | 933 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), |
934 | addnavbar(config, "Page Down", m_pagedn_action); | 934 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); |
935 | 935 | #endif | |
936 | addnavbar(config, "Back", m_back_action); | 936 | // qDebug("Initing"); |
937 | addnavbar(config, "Home", m_home_action); | 937 | |
938 | addnavbar(config, "Forward", m_forward_action); | 938 | m_layout->addWidget(editorStack); |
939 | 939 | if (m_qtscroll != 0) | |
940 | if (viewBar != NULL) | 940 | { |
941 | { | 941 | /* |
942 | if ((viewBar == fileBar) && (fileBar == menubar)) | 942 | m_scrollbar = new QToolBar( "Autogen", this, (m_localscrollbar) ? QMainWindow::Left : QMainWindow::Right, TRUE ); |
943 | { | 943 | |
944 | m_actFullscreen->removeFrom( filebar() ); | 944 | m_scrollbar->setVerticalStretchable( TRUE ); |
945 | m_zoomin_action->removeFrom( viewbar() ); | 945 | */ |
946 | m_zoomout_action->removeFrom( viewbar() ); | 946 | scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge); |
947 | m_setfont_action->removeFrom( viewbar() ); | 947 | m_layout->addWidget(scrollbar); |
948 | m_setenc_action->removeFrom( viewbar() ); | 948 | scrollbar->setTracking(false); |
949 | m_setmono_action->removeFrom( viewbar() ); | 949 | //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
950 | } | 950 | //m_scrollbar->setStretchableWidget( scrollbar ); |
951 | else if (viewBar != fileBar) | 951 | if (m_scrollishidden) |
952 | { | 952 | { |
953 | viewBar->clear(); | 953 | m_scrollbar->hide(); |
954 | } | 954 | } |
955 | } | 955 | else |
956 | 956 | { | |
957 | addviewbar(config, "Fullscreen", m_actFullscreen); | 957 | m_scrollbar->show(); |
958 | addviewbar(config, "Zoom In", m_zoomin_action); | 958 | } |
959 | addviewbar(config, "Zoom Out", m_zoomout_action); | 959 | |
960 | addviewbar(config, "Set Font", m_setfont_action); | 960 | setrotated(reader->m_rotated); |
961 | addviewbar(config, "Encoding Select", m_setenc_action); | 961 | } |
962 | addviewbar(config, "Ideogram Mode", m_setmono_action); | 962 | else |
963 | 963 | { | |
964 | if (markBar != NULL) | 964 | m_scrollbar = NULL; |
965 | { | 965 | } |
966 | if ((markBar == fileBar) && (fileBar == menubar)) | 966 | setBackgroundBitmap(); |
967 | { | 967 | m_inverse_action->setOn(reader->bInverse); |
968 | m_mark_action->removeFrom( markbar() ); | 968 | reader->init(); |
969 | m_annotate_action->removeFrom( markbar()); | 969 | |
970 | m_goto_action->removeFrom( markbar() ); | 970 | // qDebug("Inited"); |
971 | m_delete_action->removeFrom( markbar() ); | 971 | // m_buttonAction[m_spaceTarget]->setOn(true); |
972 | m_autogen_action->removeFrom( markbar() ); | 972 | // qDebug("fonting"); |
973 | m_clear_action->removeFrom( markbar() ); | 973 | do_setfont(reader->m_fontname); |
974 | m_save_action->removeFrom( markbar() ); | 974 | // qDebug("fonted"); |
975 | m_tidy_action->removeFrom( markbar() ); | 975 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); |
976 | m_startBlock_action->removeFrom( markbar() ); | 976 | m_prog->setFont( progfont ); |
977 | m_endBlock_action->removeFrom( markbar() ); | 977 | if (m_statusishidden) m_prog->hide(); |
978 | } | 978 | if (!reader->m_lastfile.isEmpty()) |
979 | else if (markBar != fileBar) | 979 | { |
980 | { | 980 | //qDebug("doclnk"); |
981 | markBar->clear(); | 981 | //doc = new DocLnk(reader->m_lastfile); |
982 | } | 982 | //qDebug("doclnk done"); |
983 | } | 983 | if (pOpenlist != NULL) |
984 | addmarkbar(config, "Mark", m_mark_action); | 984 | { |
985 | addmarkbar(config, "Annotate", m_annotate_action); | 985 | |
986 | addmarkbar(config, "Goto", m_goto_action); | 986 | /* |
987 | addmarkbar(config, "Delete", m_delete_action); | 987 | int ind = 0; |
988 | addmarkbar(config, "Autogen", m_autogen_action); | 988 | Bkmk* p = (*pOpenlist)[ind]; |
989 | addmarkbar(config, "Clear", m_clear_action); | 989 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
990 | addmarkbar(config, "Save", m_save_action); | 990 | { |
991 | addmarkbar(config, "Tidy", m_tidy_action); | 991 | p = (*pOpenlist)[++ind]; |
992 | addmarkbar(config, "Start Block", m_startBlock_action); | 992 | } |
993 | addmarkbar(config, "Copy Block", m_endBlock_action); | 993 | */ |
994 | if (checkbar(config, "Annotation indicator")) | 994 | Bkmk* p = NULL; |
995 | { | 995 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
996 | if (m_bkmkAvail == NULL) | 996 | { |
997 | { | 997 | p = iter.pContent(); |
998 | m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); | 998 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
999 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); | 999 | { |
1000 | 1000 | break; | |
1001 | m_bkmkAvail->setEnabled(false); | 1001 | } |
1002 | } | 1002 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); |
1003 | QLabel *spacer = new QLabel(markBar, ""); | 1003 | p = NULL; |
1004 | markbar()->setStretchableWidget(spacer); | 1004 | } |
1005 | m_bkmkAvail->removeFrom( markbar() ); | 1005 | if (p != NULL) |
1006 | m_bkmkAvail->addTo( markbar() ); | 1006 | { |
1007 | } | 1007 | if (!openfrombkmk(p)) |
1008 | else | 1008 | { |
1009 | { | 1009 | showEditTools(); |
1010 | if (m_bkmkAvail != NULL) | 1010 | } |
1011 | { | 1011 | } |
1012 | m_bkmkAvail->removeFrom( markbar() ); | 1012 | else |
1013 | delete m_bkmkAvail; | 1013 | { |
1014 | m_bkmkAvail = NULL; | 1014 | openFile( reader->m_lastfile ); |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
1017 | } | 1017 | else |
1018 | 1018 | { | |
1019 | bool QTReaderApp::checkbar(Config* _config, const QString& key) | 1019 | if (!reader->m_lastfile.isEmpty()) |
1020 | { | 1020 | { |
1021 | return _config->readBoolEntry(key, false); | 1021 | openFile( reader->m_lastfile ); |
1022 | } | 1022 | } |
1023 | 1023 | } | |
1024 | 1024 | } | |
1025 | QToolBar* QTReaderApp::filebar() | 1025 | else |
1026 | { | 1026 | { |
1027 | if (fileBar == NULL) | 1027 | showEditTools(); |
1028 | { | 1028 | } |
1029 | switch (m_tbpol) | 1029 | // qApp->processEvents(); |
1030 | { | 1030 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
1031 | case cesSingle: | 1031 | { |
1032 | // odebug << "Setting filebar to menubar" << oendl; | 1032 | reader->m_scrollpos = m_localscroll; |
1033 | fileBar = menubar; | 1033 | } |
1034 | break; | 1034 | else |
1035 | default: | 1035 | { |
1036 | odebug << "Incorrect toolbar policy set" << oendl; | 1036 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
1037 | case cesMenuTool: | 1037 | } |
1038 | case cesMultiple: | 1038 | reader->bDoUpdates = true; |
1039 | // odebug << "Creating new file bar" << oendl; | 1039 | reader->update(); |
1040 | fileBar = new QToolBar("File", this, m_tbposition); | 1040 | config.setGroup("Version"); |
1041 | break; | 1041 | int major = config.readNumEntry("Major", 0); |
1042 | } | 1042 | int bkmktype = config.readNumEntry("BkmkType", 0); |
1043 | // fileBar->setHorizontalStretchable( true ); | 1043 | char minor = config.readNumEntry("Minor", 0); |
1044 | } | 1044 | if (CheckVersion(major, bkmktype, minor)) |
1045 | return fileBar; | 1045 | { |
1046 | } | 1046 | config.writeEntry("Major", major); |
1047 | QToolBar* QTReaderApp::viewbar() | 1047 | config.writeEntry("BkmkType", bkmktype); |
1048 | { | 1048 | config.writeEntry("Minor", (int)minor); |
1049 | if (viewBar == NULL) | 1049 | } |
1050 | { | 1050 | // qDebug("finished update"); |
1051 | switch (m_tbpol) | 1051 | if (kmap.isEmpty()) |
1052 | { | 1052 | { |
1053 | case cesMultiple: | 1053 | QMessageBox::warning(this, PROGNAME, "You haven't mapped any keys yet!\n\nYou will be taken to the key\nmapping dialog.\nA few defaults are provided\nbut you can change then to\nsuit yourself.\n\nYou can change the key\nmapping at any time by\nselecting the Settings/Button\noption on the menu."); |
1054 | viewBar = new QToolBar("View", this, m_tbposition); | 1054 | |
1055 | break; | 1055 | m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp); |
1056 | default: | 1056 | m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown); |
1057 | odebug << "Incorrect toolbar policy set" << oendl; | 1057 | |
1058 | case cesSingle: | 1058 | m_buttonprefs->mapkey(Qt::NoButton, Key_Right, cesZoomIn); |
1059 | case cesMenuTool: | 1059 | m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut); |
1060 | viewBar = fileBar; | 1060 | |
1061 | break; | 1061 | showbuttonprefs(); |
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | return viewBar; | 1064 | |
1065 | } | 1065 | void QTReaderApp::addtoolbars(Config* config) |
1066 | QToolBar* QTReaderApp::navbar() | 1066 | { |
1067 | { | 1067 | config->setGroup("Toolbar"); |
1068 | if (navBar == NULL) | 1068 | |
1069 | { | 1069 | if (fileBar != NULL) |
1070 | switch (m_tbpol) | 1070 | { |
1071 | { | 1071 | #ifdef USEQPE |
1072 | case cesMultiple: | 1072 | if (fileBar != menubar) |
1073 | // odebug << "Creating new nav bar" << oendl; | 1073 | { |
1074 | navBar = new QToolBar("Navigation", this, m_tbposition); | 1074 | fileBar->clear(); |
1075 | break; | 1075 | } |
1076 | default: | 1076 | else |
1077 | odebug << "Incorrect toolbar policy set" << oendl; | 1077 | { |
1078 | case cesSingle: | 1078 | m_preferences_action->removeFrom( filebar() ); |
1079 | case cesMenuTool: | 1079 | m_open_action->removeFrom( filebar() ); |
1080 | navBar = fileBar; | 1080 | m_close_action->removeFrom( filebar() ); |
1081 | // odebug << "Setting navbar to filebar" << oendl; | 1081 | m_info_action->removeFrom( filebar() ); |
1082 | break; | 1082 | m_touch_action->removeFrom( filebar() ); |
1083 | } | 1083 | m_find_action->removeFrom( filebar() ); |
1084 | } | 1084 | } |
1085 | return navBar; | 1085 | #else |
1086 | } | 1086 | fileBar->clear(); |
1087 | QToolBar* QTReaderApp::markbar() | 1087 | #endif |
1088 | { | 1088 | } |
1089 | if (markBar == NULL) | 1089 | |
1090 | { | 1090 | m_preferences_action->addTo( filebar() ); |
1091 | switch (m_tbpol) | 1091 | addfilebar(config, "Open", m_open_action); |
1092 | { | 1092 | addfilebar(config, "Close", m_close_action); |
1093 | case cesMultiple: | 1093 | addfilebar(config, "Info", m_info_action); |
1094 | markBar = new QToolBar("Marks", this, m_tbposition); | 1094 | addfilebar(config, "Two/One Touch", m_touch_action); |
1095 | break; | 1095 | addfilebar(config, "Find", m_find_action); |
1096 | default: | 1096 | |
1097 | odebug << "Incorrect toolbar policy set" << oendl; | 1097 | if (navBar != NULL) |
1098 | case cesSingle: | 1098 | { |
1099 | case cesMenuTool: | 1099 | #ifdef USEQPE |
1100 | markBar = fileBar; | 1100 | if ((navBar == fileBar) && (fileBar == menubar)) |
1101 | break; | 1101 | #else |
1102 | } | 1102 | if (navBar == fileBar) |
1103 | } | 1103 | #endif |
1104 | return markBar; | 1104 | { |
1105 | } | 1105 | m_scrollButton->removeFrom( navbar() ); |
1106 | 1106 | m_start_action->removeFrom( navbar() ); | |
1107 | void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) | 1107 | m_end_action->removeFrom( navbar() ); |
1108 | { | 1108 | m_jump_action->removeFrom( navbar() ); |
1109 | if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); | 1109 | m_pageline_action->removeFrom( navbar() ); |
1110 | } | 1110 | m_pageup_action->removeFrom( navbar() ); |
1111 | void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a) | 1111 | m_pagedn_action->removeFrom( navbar() ); |
1112 | { | 1112 | m_back_action->removeFrom( navbar() ); |
1113 | if (_config->readBoolEntry(key, false)) a->addTo( navbar() ); | 1113 | m_home_action->removeFrom( navbar() ); |
1114 | } | 1114 | m_forward_action->removeFrom( navbar() ); |
1115 | void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a) | 1115 | } |
1116 | { | 1116 | else if (navBar != fileBar) |
1117 | if (_config->readBoolEntry(key, false)) a->addTo( markbar() ); | 1117 | { |
1118 | } | 1118 | navBar->clear(); |
1119 | void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) | 1119 | } |
1120 | { | 1120 | } |
1121 | if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); | 1121 | |
1122 | } | 1122 | addnavbar(config, "Scroll", m_scrollButton); |
1123 | 1123 | addnavbar(config, "Goto Start", m_start_action); | |
1124 | void QTReaderApp::suspend() { reader->suspend(); } | 1124 | addnavbar(config, "Goto End", m_end_action); |
1125 | 1125 | ||
1126 | #ifdef USEMSGS | 1126 | addnavbar(config, "Jump", m_jump_action); |
1127 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | 1127 | addnavbar(config, "Page/Line Scroll", m_pageline_action); |
1128 | { | 1128 | |
1129 | QString msg = QString::fromUtf8(_msg); | 1129 | addnavbar(config, "Page Up", m_pageup_action); |
1130 | 1130 | addnavbar(config, "Page Down", m_pagedn_action); | |
1131 | //// odebug << "Received:" << msg << "" << oendl; | 1131 | |
1132 | 1132 | addnavbar(config, "Back", m_back_action); | |
1133 | QDataStream stream( _data, IO_ReadOnly ); | 1133 | addnavbar(config, "Home", m_home_action); |
1134 | if ( msg == "info(QString)" ) | 1134 | addnavbar(config, "Forward", m_forward_action); |
1135 | { | 1135 | |
1136 | QString info; | 1136 | if (viewBar != NULL) |
1137 | stream >> info; | 1137 | { |
1138 | QMessageBox::information(this, PROGNAME, info); | 1138 | #ifdef USEQPE |
1139 | } | 1139 | if ((viewBar == fileBar) && (fileBar == menubar)) |
1140 | else if ( msg == "Update(int)" ) | 1140 | #else |
1141 | { | 1141 | if (viewBar == fileBar) |
1142 | int info; | 1142 | #endif |
1143 | stream >> info; | 1143 | { |
1144 | if (info) | 1144 | m_actFullscreen->removeFrom( filebar() ); |
1145 | { | 1145 | m_rotate_action->removeFrom( viewbar() ); |
1146 | reader->bDoUpdates = true; | 1146 | m_inverse_action->removeFrom( viewbar() ); |
1147 | reader->refresh(); | 1147 | m_zoomin_action->removeFrom( viewbar() ); |
1148 | } | 1148 | m_zoomout_action->removeFrom( viewbar() ); |
1149 | else | 1149 | m_setfont_action->removeFrom( viewbar() ); |
1150 | { | 1150 | m_setenc_action->removeFrom( viewbar() ); |
1151 | reader->bDoUpdates = false; | 1151 | m_setmono_action->removeFrom( viewbar() ); |
1152 | } | 1152 | } |
1153 | } | 1153 | else if (viewBar != fileBar) |
1154 | else if ( msg == "warn(QString)" ) | 1154 | { |
1155 | { | 1155 | viewBar->clear(); |
1156 | QString info; | 1156 | } |
1157 | stream >> info; | 1157 | } |
1158 | QMessageBox::warning(this, PROGNAME, info); | 1158 | |
1159 | } | 1159 | addviewbar(config, "Fullscreen", m_actFullscreen); |
1160 | else if ( msg == "exit()" ) | 1160 | addviewbar(config, "Rotate", m_rotate_action); |
1161 | { | 1161 | addviewbar(config, "Invert Action", m_inverse_action); |
1162 | m_dontSave = true; | 1162 | addviewbar(config, "Zoom In", m_zoomin_action); |
1163 | close(); | 1163 | addviewbar(config, "Zoom Out", m_zoomout_action); |
1164 | } | 1164 | addviewbar(config, "Set Font", m_setfont_action); |
1165 | else if ( msg == "pageDown()" ) | 1165 | addviewbar(config, "Encoding Select", m_setenc_action); |
1166 | { | 1166 | addviewbar(config, "Ideogram Mode", m_setmono_action); |
1167 | reader->dopagedn(); | 1167 | |
1168 | } | 1168 | if (markBar != NULL) |
1169 | else if ( msg == "pageUp()" ) | 1169 | { |
1170 | { | 1170 | #ifdef USEQPE |
1171 | reader->dopageup(); | 1171 | if ((markBar == fileBar) && (fileBar == menubar)) |
1172 | } | 1172 | #else |
1173 | else if ( msg == "lineDown()" ) | 1173 | if (markBar == fileBar) |
1174 | { | 1174 | #endif |
1175 | reader->lineDown(); | 1175 | { |
1176 | } | 1176 | m_mark_action->removeFrom( markbar() ); |
1177 | else if ( msg == "lineUp()" ) | 1177 | m_annotate_action->removeFrom( markbar()); |
1178 | { | 1178 | m_goto_action->removeFrom( markbar() ); |
1179 | reader->lineUp(); | 1179 | m_delete_action->removeFrom( markbar() ); |
1180 | } | 1180 | m_autogen_action->removeFrom( markbar() ); |
1181 | else if ( msg == "showText()" ) | 1181 | m_clear_action->removeFrom( markbar() ); |
1182 | { | 1182 | m_save_action->removeFrom( markbar() ); |
1183 | showEditTools(); | 1183 | m_tidy_action->removeFrom( markbar() ); |
1184 | } | 1184 | m_startBlock_action->removeFrom( markbar() ); |
1185 | else if ( msg == "home()" ) | 1185 | m_endBlock_action->removeFrom( markbar() ); |
1186 | { | 1186 | } |
1187 | reader->goHome(); | 1187 | else if (markBar != fileBar) |
1188 | } | 1188 | { |
1189 | else if ( msg == "back()" ) | 1189 | markBar->clear(); |
1190 | { | 1190 | } |
1191 | reader->goBack(); | 1191 | } |
1192 | } | 1192 | addmarkbar(config, "Mark", m_mark_action); |
1193 | else if ( msg == "forward()" ) | 1193 | addmarkbar(config, "Annotate", m_annotate_action); |
1194 | { | 1194 | addmarkbar(config, "Goto", m_goto_action); |
1195 | reader->goForward(); | 1195 | addmarkbar(config, "Delete", m_delete_action); |
1196 | } | 1196 | addmarkbar(config, "Autogen", m_autogen_action); |
1197 | else if ( msg == "File/Open(QString)" ) | 1197 | addmarkbar(config, "Clear", m_clear_action); |
1198 | { | 1198 | addmarkbar(config, "Save", m_save_action); |
1199 | QString info; | 1199 | addmarkbar(config, "Tidy", m_tidy_action); |
1200 | stream >> info; | 1200 | addmarkbar(config, "Start Block", m_startBlock_action); |
1201 | openFile( info ); | 1201 | addmarkbar(config, "Copy Block", m_endBlock_action); |
1202 | } | 1202 | if (checkbar(config, "Annotation indicator")) |
1203 | else if ( msg == "File/Info()" ) | 1203 | { |
1204 | { | 1204 | if (m_bkmkAvail == NULL) |
1205 | showinfo(); | 1205 | { |
1206 | } | 1206 | m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); |
1207 | else if ( msg == "File/Action(QString)" ) | 1207 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); |
1208 | { | 1208 | |
1209 | QString info; | 1209 | m_bkmkAvail->setEnabled(false); |
1210 | stream >> info; | 1210 | } |
1211 | m_spaceTarget = ActNameToInt(info); | 1211 | QLabel *spacer = new QLabel(markBar, ""); |
1212 | } | 1212 | markbar()->setStretchableWidget(spacer); |
1213 | else if ( msg == "Navigation/Scroll(int)" ) | 1213 | m_bkmkAvail->removeFrom( markbar() ); |
1214 | { | 1214 | m_bkmkAvail->addTo( markbar() ); |
1215 | int info; | 1215 | } |
1216 | stream >> info; | 1216 | else |
1217 | autoScroll(info); | 1217 | { |
1218 | } | 1218 | if (m_bkmkAvail != NULL) |
1219 | 1219 | { | |
1220 | else if ( msg == "Navigation/GotoStart()" ) | 1220 | m_bkmkAvail->removeFrom( markbar() ); |
1221 | { | 1221 | delete m_bkmkAvail; |
1222 | gotoStart(); | 1222 | m_bkmkAvail = NULL; |
1223 | } | 1223 | } |
1224 | else if ( msg == "Navigation/GotoEnd()" ) | 1224 | } |
1225 | { | 1225 | } |
1226 | gotoEnd(); | 1226 | |
1227 | } | 1227 | bool QTReaderApp::checkbar(Config* _config, const QString& key) |
1228 | else if ( msg == "Navigation/Jump(int)" ) | 1228 | { |
1229 | { | 1229 | return _config->readBoolEntry(key, false); |
1230 | int info; | 1230 | } |
1231 | stream >> info; | 1231 | |
1232 | reader->locate(info); | 1232 | |
1233 | } | 1233 | QToolBar* QTReaderApp::filebar() |
1234 | else if ( msg == "Navigation/Page/LineScroll(int)" ) | 1234 | { |
1235 | { | 1235 | if (fileBar == NULL) |
1236 | int info; | 1236 | { |
1237 | stream >> info; | 1237 | switch (m_tbpol) |
1238 | pagemode(info); | 1238 | { |
1239 | } | 1239 | #ifdef USEQPE |
1240 | else if ( msg == "Navigation/SetOverlap(int)" ) | 1240 | case cesSingle: |
1241 | { | 1241 | // qDebug("Setting filebar to menubar"); |
1242 | int info; | 1242 | fileBar = menubar; |
1243 | stream >> info; | 1243 | break; |
1244 | reader->m_overlap = info; | 1244 | #endif |
1245 | } | 1245 | default: |
1246 | else if ( msg == "Navigation/SetMargin(int)" ) | 1246 | qDebug("Incorrect toolbar policy set"); |
1247 | { | 1247 | case cesMenuTool: |
1248 | int info; | 1248 | case cesMultiple: |
1249 | stream >> info; | 1249 | // qDebug("Creating new file bar"); |
1250 | do_margin(info); | 1250 | fileBar = new QToolBar("File", this, m_tbposition); |
1251 | } | 1251 | break; |
1252 | else if ( msg == "File/SetDictionary(QString)" ) | 1252 | } |
1253 | { | 1253 | //fileBar->setHorizontalStretchable( true ); |
1254 | QString info; | 1254 | } |
1255 | stream >> info; | 1255 | return fileBar; |
1256 | do_settarget(info); | 1256 | } |
1257 | } | 1257 | QToolBar* QTReaderApp::viewbar() |
1258 | #ifdef _SCROLLPIPE | 1258 | { |
1259 | else if ( msg == "File/SetScrollTarget(QString)" ) | 1259 | if (viewBar == NULL) |
1260 | { | 1260 | { |
1261 | QString info; | 1261 | switch (m_tbpol) |
1262 | stream >> info; | 1262 | { |
1263 | reader->m_pipetarget = info; | 1263 | case cesMultiple: |
1264 | } | 1264 | viewBar = new QToolBar("View", this, m_tbposition); |
1265 | #endif | 1265 | break; |
1266 | else if ( msg == "File/Two/OneTouch(int)" ) | 1266 | default: |
1267 | { | 1267 | qDebug("Incorrect toolbar policy set"); |
1268 | int info; | 1268 | #ifdef USEQPE |
1269 | stream >> info; | 1269 | case cesSingle: |
1270 | setTwoTouch(info); | 1270 | #endif |
1271 | } | 1271 | case cesMenuTool: |
1272 | else if ( msg == "Target/Annotation(int)" ) | 1272 | viewBar = fileBar; |
1273 | { | 1273 | break; |
1274 | int info; | 1274 | } |
1275 | stream >> info; | 1275 | } |
1276 | OnAnnotation(info); | 1276 | return viewBar; |
1277 | } | 1277 | } |
1278 | else if ( msg == "Target/Dictionary(int)" ) | 1278 | QToolBar* QTReaderApp::navbar() |
1279 | { | 1279 | { |
1280 | int info; | 1280 | if (navBar == NULL) |
1281 | stream >> info; | 1281 | { |
1282 | OnDictionary(info); | 1282 | switch (m_tbpol) |
1283 | } | 1283 | { |
1284 | else if ( msg == "Target/Clipboard(int)" ) | 1284 | case cesMultiple: |
1285 | { | 1285 | // qDebug("Creating new nav bar"); |
1286 | int info; | 1286 | navBar = new QToolBar("Navigation", this, m_tbposition); |
1287 | stream >> info; | 1287 | break; |
1288 | OnClipboard(info); | 1288 | default: |
1289 | } | 1289 | qDebug("Incorrect toolbar policy set"); |
1290 | else if ( msg == "File/Find(QString)" ) | 1290 | #ifdef USEQPE |
1291 | { | 1291 | case cesSingle: |
1292 | QString info; | 1292 | #endif |
1293 | stream >> info; | 1293 | case cesMenuTool: |
1294 | QRegExp arg(info); | 1294 | navBar = fileBar; |
1295 | size_t pos = reader->pagelocate(); | 1295 | // qDebug("Setting navbar to filebar"); |
1296 | size_t start = pos; | 1296 | break; |
1297 | CDrawBuffer test(&(reader->m_fontControl)); | 1297 | } |
1298 | reader->getline(&test); | 1298 | } |
1299 | while (arg.match(toQString(test.data())) == -1) | 1299 | return navBar; |
1300 | { | 1300 | } |
1301 | pos = reader->locate(); | 1301 | QToolBar* QTReaderApp::markbar() |
1302 | if (!reader->getline(&test)) | 1302 | { |
1303 | { | 1303 | if (markBar == NULL) |
1304 | QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); | 1304 | { |
1305 | pos = start; | 1305 | switch (m_tbpol) |
1306 | break; | 1306 | { |
1307 | } | 1307 | case cesMultiple: |
1308 | } | 1308 | markBar = new QToolBar("Marks", this, m_tbposition); |
1309 | reader->locate(pos); | 1309 | break; |
1310 | } | 1310 | default: |
1311 | else if ( msg == "File/Fullscreen(int)" ) | 1311 | qDebug("Incorrect toolbar policy set"); |
1312 | { | 1312 | #ifdef USEQPE |
1313 | int info; | 1313 | case cesSingle: |
1314 | stream >> info; | 1314 | #endif |
1315 | setfullscreen(info); | 1315 | case cesMenuTool: |
1316 | } | 1316 | markBar = fileBar; |
1317 | else if ( msg == "File/Continuous(int)" ) | 1317 | break; |
1318 | { | 1318 | } |
1319 | int info; | 1319 | } |
1320 | stream >> info; | 1320 | return markBar; |
1321 | setcontinuous(info); | 1321 | } |
1322 | } | 1322 | |
1323 | else if ( msg == "Markup(QString)" ) | 1323 | void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) |
1324 | { | 1324 | { |
1325 | QString info; | 1325 | if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); |
1326 | stream >> info; | 1326 | } |
1327 | if (info == "Auto") | 1327 | void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a) |
1328 | { | 1328 | { |
1329 | autofmt(true); | 1329 | if (_config->readBoolEntry(key, false)) a->addTo( navbar() ); |
1330 | } | 1330 | } |
1331 | if (info == "None") | 1331 | void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a) |
1332 | { | 1332 | { |
1333 | autofmt(false); | 1333 | if (_config->readBoolEntry(key, false)) a->addTo( markbar() ); |
1334 | textfmt(false); | 1334 | } |
1335 | striphtml(false); | 1335 | void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) |
1336 | peanut(false); | 1336 | { |
1337 | } | 1337 | if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); |
1338 | if (info == "Text") | 1338 | } |
1339 | { | 1339 | |
1340 | textfmt(true); | 1340 | void QTReaderApp::suspend() { reader->suspend(); } |
1341 | } | 1341 | |
1342 | if (info == "HTML") | 1342 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) |
1343 | { | 1343 | { |
1344 | striphtml(true); | 1344 | #ifndef USEMSGS |
1345 | } | 1345 | return; |
1346 | if (info == "Peanut/PML") | 1346 | #else |
1347 | { | 1347 | QString msg = QString::fromUtf8(_msg); |
1348 | peanut(true); | 1348 | |
1349 | } | 1349 | qDebug("Received:%s", (const char*)msg); |
1350 | } | 1350 | QDataStream stream( _data, IO_ReadOnly ); |
1351 | else if ( msg == "Layout/StripCR(int)" ) | 1351 | if ( msg == "suspend()" ) |
1352 | { | 1352 | { |
1353 | int info; | 1353 | qDebug("Suspending"); |
1354 | stream >> info; | 1354 | suspend(); |
1355 | stripcr(info); | 1355 | qDebug("Suspendedb"); |
1356 | } | 1356 | } |
1357 | else if ( msg == "Layout/Dehyphen(int)" ) | 1357 | return; |
1358 | { | 1358 | /* |
1359 | int info; | 1359 | QDataStream stream( _data, IO_ReadOnly ); |
1360 | stream >> info; | 1360 | if ( msg == "info(QString)" ) |
1361 | dehyphen(info); | 1361 | { |
1362 | } | 1362 | QString info; |
1363 | else if ( msg == "Layout/Depluck(int)" ) | 1363 | stream >> info; |
1364 | { | 1364 | QMessageBox::information(this, PROGNAME, info); |
1365 | int info; | 1365 | } |
1366 | stream >> info; | 1366 | else if ( msg == "Update(int)" ) |
1367 | depluck(info); | 1367 | { |
1368 | } | 1368 | int info; |
1369 | else if ( msg == "Layout/Dejpluck(int)" ) | 1369 | stream >> info; |
1370 | { | 1370 | if (info) |
1371 | int info; | 1371 | { |
1372 | stream >> info; | 1372 | reader->bDoUpdates = true; |
1373 | dejpluck(info); | 1373 | reader->refresh(); |
1374 | } | 1374 | } |
1375 | else if ( msg == "Layout/SingleSpace(int)" ) | 1375 | else |
1376 | { | 1376 | { |
1377 | int info; | 1377 | reader->bDoUpdates = false; |
1378 | stream >> info; | 1378 | } |
1379 | onespace(info); | 1379 | } |
1380 | } | 1380 | else if ( msg == "warn(QString)" ) |
1381 | #ifdef REPALM | 1381 | { |
1382 | else if ( msg == "Layout/Repalm(int)" ) | 1382 | QString info; |
1383 | { | 1383 | stream >> info; |
1384 | int info; | 1384 | QMessageBox::warning(this, PROGNAME, info); |
1385 | stream >> info; | 1385 | } |
1386 | repalm(info); | 1386 | else if ( msg == "exit()" ) |
1387 | } | 1387 | { |
1388 | #endif | 1388 | m_dontSave = true; |
1389 | else if ( msg == "Layout/Unindent(int)" ) | 1389 | close(); |
1390 | { | 1390 | } |
1391 | int info; | 1391 | else if ( msg == "pageDown()" ) |
1392 | stream >> info; | 1392 | { |
1393 | unindent(info); | 1393 | reader->dopagedn(); |
1394 | } | 1394 | } |
1395 | else if ( msg == "Layout/Re-paragraph(int)" ) | 1395 | else if ( msg == "pageUp()" ) |
1396 | { | 1396 | { |
1397 | int info; | 1397 | reader->dopageup(); |
1398 | stream >> info; | 1398 | } |
1399 | repara(info); | 1399 | else if ( msg == "lineDown()" ) |
1400 | } | 1400 | { |
1401 | else if ( msg == "Layout/DoubleSpace(int)" ) | 1401 | reader->lineDown(); |
1402 | { | 1402 | } |
1403 | int info; | 1403 | else if ( msg == "lineUp()" ) |
1404 | stream >> info; | 1404 | { |
1405 | dblspce(info); | 1405 | reader->lineUp(); |
1406 | } | 1406 | } |
1407 | else if ( msg == "Layout/Indent(int)" ) | 1407 | else if ( msg == "showText()" ) |
1408 | { | 1408 | { |
1409 | int info; | 1409 | showEditTools(); |
1410 | stream >> info; | 1410 | } |
1411 | reader->bindenter = info; | 1411 | else if ( msg == "home()" ) |
1412 | reader->setfilter(reader->getfilter()); | 1412 | { |
1413 | } | 1413 | reader->goHome(); |
1414 | else if ( msg == "Layout/Remap(int)" ) | 1414 | } |
1415 | { | 1415 | else if ( msg == "back()" ) |
1416 | int info; | 1416 | { |
1417 | stream >> info; | 1417 | reader->goBack(); |
1418 | remap(info); | 1418 | } |
1419 | } | 1419 | else if ( msg == "forward()" ) |
1420 | else if ( msg == "Layout/Embolden(int)" ) | 1420 | { |
1421 | { | 1421 | reader->goForward(); |
1422 | int info; | 1422 | } |
1423 | stream >> info; | 1423 | else if ( msg == "File/Open(QString)" ) |
1424 | embolden(info); | 1424 | { |
1425 | } | 1425 | QString info; |
1426 | else if ( msg == "Format/Ideogram/Word(int)" ) | 1426 | stream >> info; |
1427 | { | 1427 | openFile( info ); |
1428 | int info; | 1428 | } |
1429 | stream >> info; | 1429 | else if ( msg == "File/Info()" ) |
1430 | monospace(info); | 1430 | { |
1431 | } | 1431 | showinfo(); |
1432 | else if ( msg == "Format/SetWidth(int)" ) | 1432 | } |
1433 | { | 1433 | else if ( msg == "File/Action(QString)" ) |
1434 | int info; | 1434 | { |
1435 | stream >> info; | 1435 | QString info; |
1436 | reader->m_charpc = info; | 1436 | stream >> info; |
1437 | reader->setfont(); | 1437 | m_spaceTarget = ActNameToInt(info); |
1438 | reader->refresh(); | 1438 | } |
1439 | } | 1439 | else if ( msg == "Navigation/Scroll(int)" ) |
1440 | else if ( msg == "Format/SetFont(QString,int)" ) | 1440 | { |
1441 | { | 1441 | int info; |
1442 | QString fontname; | 1442 | stream >> info; |
1443 | int size; | 1443 | autoScroll(info); |
1444 | stream >> fontname; | 1444 | } |
1445 | stream >> size; | 1445 | |
1446 | setfontHelper(fontname, size); | 1446 | else if ( msg == "Navigation/GotoStart()" ) |
1447 | } | 1447 | { |
1448 | else if ( msg == "Marks/Autogen(QString)" ) | 1448 | gotoStart(); |
1449 | { | 1449 | } |
1450 | QString info; | 1450 | else if ( msg == "Navigation/GotoEnd()" ) |
1451 | stream >> info; | 1451 | { |
1452 | do_autogen(info); | 1452 | gotoEnd(); |
1453 | } | 1453 | } |
1454 | else if ( msg == "File/StartBlock()" ) | 1454 | else if ( msg == "Navigation/Jump(int)" ) |
1455 | { | 1455 | { |
1456 | editMark(); | 1456 | int info; |
1457 | } | 1457 | stream >> info; |
1458 | else if ( msg == "File/CopyBlock()" ) | 1458 | reader->locate(info); |
1459 | { | 1459 | } |
1460 | editCopy(); | 1460 | else if ( msg == "Navigation/Page/LineScroll(int)" ) |
1461 | } | 1461 | { |
1462 | } | 1462 | int info; |
1463 | #endif | 1463 | stream >> info; |
1464 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | 1464 | pagemode(info); |
1465 | { | 1465 | } |
1466 | for (int i = 0; i < MAX_ACTIONS; i++) | 1466 | else if ( msg == "Navigation/SetOverlap(int)" ) |
1467 | { | 1467 | { |
1468 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; | 1468 | int info; |
1469 | } | 1469 | stream >> info; |
1470 | return cesAutoScroll; | 1470 | reader->m_overlap = info; |
1471 | } | 1471 | } |
1472 | 1472 | else if ( msg == "Navigation/SetMargin(int)" ) | |
1473 | void QTReaderApp::setfullscreen(bool sfs) | 1473 | { |
1474 | { | 1474 | int info; |
1475 | reader->bDoUpdates = false; | 1475 | stream >> info; |
1476 | m_fullscreen = sfs; | 1476 | do_margin(info); |
1477 | showEditTools(); | 1477 | } |
1478 | // qApp->processEvents(); | 1478 | else if ( msg == "File/SetDictionary(QString)" ) |
1479 | reader->bDoUpdates = true; | 1479 | { |
1480 | reader->update(); | 1480 | QString info; |
1481 | } | 1481 | stream >> info; |
1482 | 1482 | do_settarget(info); | |
1483 | void QTReaderApp::buttonActionSelected(QAction* _a) | 1483 | } |
1484 | { | 1484 | #ifdef _SCROLLPIPE |
1485 | //// odebug << "es:" << _a << " : " << (const char *)(_a->text()) << " (" << ActNameToInt(_a->text()) << ")" << oendl; | 1485 | else if ( msg == "File/SetScrollTarget(QString)" ) |
1486 | m_spaceTarget = ActNameToInt(_a->text()); | 1486 | { |
1487 | } | 1487 | QString info; |
1488 | 1488 | stream >> info; | |
1489 | QTReaderApp::~QTReaderApp() | 1489 | reader->m_pipetarget = info; |
1490 | { | 1490 | } |
1491 | } | 1491 | #endif |
1492 | 1492 | else if ( msg == "File/Two/OneTouch(int)" ) | |
1493 | void QTReaderApp::autoScroll(bool _b) | 1493 | { |
1494 | { | 1494 | int info; |
1495 | reader->setautoscroll(_b); | 1495 | stream >> info; |
1496 | setScrollState(reader->m_autoScroll); | 1496 | setTwoTouch(info); |
1497 | } | 1497 | } |
1498 | 1498 | else if ( msg == "Target/Annotation(int)" ) | |
1499 | void QTReaderApp::zoomin() | 1499 | { |
1500 | { | 1500 | int info; |
1501 | reader->zoomin(); | 1501 | stream >> info; |
1502 | } | 1502 | OnAnnotation(info); |
1503 | 1503 | } | |
1504 | void QTReaderApp::zoomout() | 1504 | else if ( msg == "Target/Dictionary(int)" ) |
1505 | { | 1505 | { |
1506 | reader->zoomout(); | 1506 | int info; |
1507 | } | 1507 | stream >> info; |
1508 | 1508 | OnDictionary(info); | |
1509 | void QTReaderApp::clearBkmkList() | 1509 | } |
1510 | { | 1510 | else if ( msg == "Target/Clipboard(int)" ) |
1511 | delete pBkmklist; | 1511 | { |
1512 | pBkmklist = NULL; | 1512 | int info; |
1513 | m_fBkmksChanged = false; | 1513 | stream >> info; |
1514 | } | 1514 | OnClipboard(info); |
1515 | 1515 | } | |
1516 | void QTReaderApp::fileClose() | 1516 | else if ( msg == "File/Find(QString)" ) |
1517 | { | 1517 | { |
1518 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); | 1518 | QString info; |
1519 | if (cd->exec()) | 1519 | stream >> info; |
1520 | { | 1520 | QRegExp arg(info); |
1521 | if (pOpenlist != NULL) | 1521 | size_t pos = reader->pagelocate(); |
1522 | { | 1522 | size_t start = pos; |
1523 | int ind = 0; | 1523 | CDrawBuffer test(&(reader->m_fontControl)); |
1524 | Bkmk* p = (*pOpenlist)[ind]; | 1524 | reader->getline(&test); |
1525 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 1525 | while (arg.match(toQString(test.data())) == -1) |
1526 | { | 1526 | { |
1527 | p = (*pOpenlist)[++ind]; | 1527 | pos = reader->locate(); |
1528 | } | 1528 | if (!reader->getline(&test)) |
1529 | if (p != NULL) pOpenlist->erase(ind); | 1529 | { |
1530 | if (cd->delFile()) | 1530 | QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); |
1531 | { | 1531 | pos = start; |
1532 | unlink((const char*)reader->m_lastfile); | 1532 | break; |
1533 | } | 1533 | } |
1534 | if (cd->delMarks()) | 1534 | } |
1535 | { | 1535 | reader->locate(pos); |
1536 | #ifndef USEQPE | 1536 | } |
1537 | QDir d = QDir::home(); // "/" | 1537 | else if ( msg == "File/Fullscreen(int)" ) |
1538 | d.cd(APPDIR); | 1538 | { |
1539 | d.remove(reader->m_string); | 1539 | int info; |
1540 | #else /* USEQPE */ | 1540 | stream >> info; |
1541 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 1541 | setfullscreen(info); |
1542 | #endif /* USEQPE */ | 1542 | } |
1543 | } | 1543 | else if ( msg == "File/Continuous(int)" ) |
1544 | if (cd->delConfig()) | 1544 | { |
1545 | { | 1545 | int info; |
1546 | #ifndef USEQPE | 1546 | stream >> info; |
1547 | QDir d = QDir::home(); // "/" | 1547 | setcontinuous(info); |
1548 | d.cd(APPDIR "/configs"); | 1548 | } |
1549 | d.remove(reader->m_string); | 1549 | else if ( msg == "Markup(QString)" ) |
1550 | #else /* USEQPE */ | 1550 | { |
1551 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); | 1551 | QString info; |
1552 | #endif /* USEQPE */ | 1552 | stream >> info; |
1553 | } | 1553 | if (info == "Auto") |
1554 | } | 1554 | { |
1555 | 1555 | autofmt(true); | |
1556 | fileOpen2(); | 1556 | } |
1557 | } | 1557 | if (info == "None") |
1558 | delete cd; | 1558 | { |
1559 | } | 1559 | autofmt(false); |
1560 | 1560 | textfmt(false); | |
1561 | void QTReaderApp::updatefileinfo() | 1561 | striphtml(false); |
1562 | { | 1562 | peanut(false); |
1563 | if (reader->m_string.isEmpty()) return; | 1563 | } |
1564 | if (reader->m_lastfile.isEmpty()) return; | 1564 | if (info == "Text") |
1565 | tchar* nm = fromQString(reader->m_string); | 1565 | { |
1566 | tchar* fl = fromQString(reader->m_lastfile); | 1566 | textfmt(true); |
1567 | // odebug << "Lastfile:" << fl << "" << oendl; | 1567 | } |
1568 | bool notadded = true; | 1568 | if (info == "HTML") |
1569 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; | 1569 | { |
1570 | else | 1570 | striphtml(true); |
1571 | { | 1571 | } |
1572 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1572 | if (info == "Peanut/PML") |
1573 | { | 1573 | { |
1574 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) | 1574 | peanut(true); |
1575 | { | 1575 | } |
1576 | iter->value(reader->pagelocate()); | 1576 | } |
1577 | unsigned short dlen; | 1577 | else if ( msg == "Layout/StripCR(int)" ) |
1578 | unsigned char* data; | 1578 | { |
1579 | CFiledata fd(iter->anno()); | 1579 | int info; |
1580 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1580 | stream >> info; |
1581 | // odebug << "Filedata(1):" << fd.length() << ", " << dlen << "" << oendl; | 1581 | stripcr(info); |
1582 | // getstate(data, dlen); | 1582 | } |
1583 | iter->setAnno(data, dlen); | 1583 | else if ( msg == "Layout/Dehyphen(int)" ) |
1584 | notadded = false; | 1584 | { |
1585 | delete [] data; | 1585 | int info; |
1586 | break; | 1586 | stream >> info; |
1587 | } | 1587 | dehyphen(info); |
1588 | } | 1588 | } |
1589 | } | 1589 | else if ( msg == "Layout/Depluck(int)" ) |
1590 | // odebug << "Added?:" << notadded << "" << oendl; | 1590 | { |
1591 | if (notadded) | 1591 | int info; |
1592 | { | 1592 | stream >> info; |
1593 | struct stat fnstat; | 1593 | depluck(info); |
1594 | stat((const char *)reader->m_lastfile, &fnstat); | 1594 | } |
1595 | CFiledata fd(fnstat.st_mtime, fl); | 1595 | else if ( msg == "Layout/Dejpluck(int)" ) |
1596 | unsigned short dlen; | 1596 | { |
1597 | unsigned char* data; | 1597 | int info; |
1598 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1598 | stream >> info; |
1599 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); | 1599 | dejpluck(info); |
1600 | // odebug << "Filedata(2):" << fd.length() << ", " << dlen << "" << oendl; | 1600 | } |
1601 | delete [] data; | 1601 | else if ( msg == "Layout/SingleSpace(int)" ) |
1602 | } | 1602 | { |
1603 | delete [] nm; | 1603 | int info; |
1604 | delete [] fl; | 1604 | stream >> info; |
1605 | } | 1605 | onespace(info); |
1606 | 1606 | } | |
1607 | void QTReaderApp::fileOpen() | 1607 | else if ( msg == "Layout/Repalm(int)" ) |
1608 | { | 1608 | { |
1609 | /* | 1609 | int info; |
1610 | menu->hide(); | 1610 | stream >> info; |
1611 | fileBar->hide(); | 1611 | repalm(info); |
1612 | if (regVisible) regBar->hide(); | 1612 | } |
1613 | if (searchVisible) searchBar->hide(); | 1613 | else if ( msg == "Layout/Unindent(int)" ) |
1614 | */ | 1614 | { |
1615 | // odebug << "fileOpen" << oendl; | 1615 | int info; |
1616 | // if (!reader->m_lastfile.isEmpty()) | 1616 | stream >> info; |
1617 | updatefileinfo(); | 1617 | unindent(info); |
1618 | fileOpen2(); | 1618 | } |
1619 | } | 1619 | else if ( msg == "Layout/Re-paragraph(int)" ) |
1620 | 1620 | { | |
1621 | void QTReaderApp::fileOpen2() | 1621 | int info; |
1622 | { | 1622 | stream >> info; |
1623 | if (pBkmklist != NULL) | 1623 | repara(info); |
1624 | { | 1624 | } |
1625 | if (m_fBkmksChanged) | 1625 | else if ( msg == "Layout/DoubleSpace(int)" ) |
1626 | { | 1626 | { |
1627 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 1627 | int info; |
1628 | savebkmks(); | 1628 | stream >> info; |
1629 | } | 1629 | dblspce(info); |
1630 | delete pBkmklist; | 1630 | } |
1631 | pBkmklist = NULL; | 1631 | else if ( msg == "Layout/Indent(int)" ) |
1632 | m_fBkmksChanged = false; | 1632 | { |
1633 | } | 1633 | int info; |
1634 | reader->disableAutoscroll(); | 1634 | stream >> info; |
1635 | /* | 1635 | reader->bindenter = info; |
1636 | editorStack->raiseWidget( fileSelector ); | 1636 | reader->setfilter(reader->getfilter()); |
1637 | fileSelector->reread(); | 1637 | } |
1638 | */ | 1638 | else if ( msg == "Layout/Remap(int)" ) |
1639 | bool usebrowser = true; | 1639 | { |
1640 | if (pOpenlist != NULL) | 1640 | int info; |
1641 | { | 1641 | stream >> info; |
1642 | m_nBkmkAction = cOpenFile; | 1642 | remap(info); |
1643 | if (listbkmk(pOpenlist, "Browse")) usebrowser = false; | 1643 | } |
1644 | } | 1644 | else if ( msg == "Layout/Embolden(int)" ) |
1645 | if (usebrowser) | 1645 | { |
1646 | { | 1646 | int info; |
1647 | QString fn = usefilebrowser(); | 1647 | stream >> info; |
1648 | // qApp->processEvents(); | 1648 | embolden(info); |
1649 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 1649 | } |
1650 | { | 1650 | else if ( msg == "Format/Ideogram/Word(int)" ) |
1651 | openFile(fn); | 1651 | { |
1652 | } | 1652 | int info; |
1653 | reader->setFocus(); | 1653 | stream >> info; |
1654 | } | 1654 | monospace(info); |
1655 | // reader->refresh(); | 1655 | } |
1656 | // odebug << "HEIGHT:" << reader->m_lastheight << "" << oendl; | 1656 | else if ( msg == "Format/SetWidth(int)" ) |
1657 | } | 1657 | { |
1658 | 1658 | int info; | |
1659 | QString QTReaderApp::usefilebrowser() | 1659 | stream >> info; |
1660 | { | 1660 | reader->m_charpc = info; |
1661 | #ifndef USEQPE | 1661 | reader->setfont(); |
1662 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); | 1662 | reader->refresh(); |
1663 | return s; | 1663 | } |
1664 | #else | 1664 | else if ( msg == "Format/SetFont(QString,int)" ) |
1665 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, | 1665 | { |
1666 | 0, | 1666 | QString fontname; |
1667 | // WStyle_Customize | WStyle_NoBorderEx, | 1667 | int size; |
1668 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 1668 | stream >> fontname; |
1669 | 1669 | stream >> size; | |
1670 | 1670 | setfontHelper(fontname, size); | |
1671 | QString fn; | 1671 | } |
1672 | if (fb->exec()) | 1672 | else if ( msg == "Marks/Autogen(QString)" ) |
1673 | { | 1673 | { |
1674 | fn = fb->getCurrentFile(); | 1674 | QString info; |
1675 | } | 1675 | stream >> info; |
1676 | // odebug << "Selected " << fn << "" << oendl; | 1676 | do_autogen(info); |
1677 | delete fb; | 1677 | } |
1678 | showEditTools(); | 1678 | else if ( msg == "File/StartBlock()" ) |
1679 | return fn; | 1679 | { |
1680 | #endif | 1680 | editMark(); |
1681 | } | 1681 | } |
1682 | 1682 | else if ( msg == "File/CopyBlock()" ) | |
1683 | void QTReaderApp::showgraphic(QImage& pm) | 1683 | { |
1684 | { | 1684 | editCopy(); |
1685 | QPixmap pc; | 1685 | } |
1686 | pc.convertFromImage(pm); | 1686 | */ |
1687 | m_graphicwin->setPixmap(pc); | 1687 | #endif |
1688 | editorStack->raiseWidget( m_graphicwin ); | 1688 | } |
1689 | m_graphicwin->setFocus(); | 1689 | |
1690 | } | 1690 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) |
1691 | 1691 | { | |
1692 | 1692 | for (int i = 0; i < MAX_ACTIONS; i++) | |
1693 | void QTReaderApp::showprefs() | 1693 | { |
1694 | { | 1694 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; |
1695 | CPrefs* prefwin = new CPrefs(!m_bFloatingDialog, this); | 1695 | } |
1696 | 1696 | return cesAutoScroll; | |
1697 | prefwin->twotouch(m_twoTouch); | 1697 | } |
1698 | prefwin->propfontchange(m_propogatefontchange); | 1698 | |
1699 | prefwin->StripCR(reader->bstripcr); | 1699 | void QTReaderApp::setinverted(bool sfs) |
1700 | prefwin->Dehyphen(reader->bdehyphen); | 1700 | { |
1701 | prefwin->SingleSpace(reader->bonespace); | 1701 | reader->setInverse(sfs); |
1702 | prefwin->Unindent(reader->bunindent); | 1702 | reader->setfilter(reader->getfilter()); |
1703 | prefwin->Reparagraph(reader->brepara); | 1703 | reader->refresh(); |
1704 | prefwin->DoubleSpace(reader->bdblspce); | 1704 | } |
1705 | prefwin->Remap(reader->bremap); | 1705 | |
1706 | prefwin->Embolden(reader->bmakebold); | 1706 | void QTReaderApp::setrotated(bool sfs) |
1707 | prefwin->FullJustify(reader->bfulljust); | 1707 | { |
1708 | prefwin->ParaLead(reader->getextraspace()); | 1708 | reader->setrotated(sfs); |
1709 | prefwin->LineLead(reader->getlead()); | 1709 | if (sfs) |
1710 | prefwin->Margin(reader->m_border); | 1710 | { |
1711 | prefwin->Indent(reader->bindenter); | 1711 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); |
1712 | if (reader->bautofmt) | 1712 | if (m_scrollbar != NULL) |
1713 | { | 1713 | { |
1714 | prefwin->Markup(0); | 1714 | scrollbar->disconnect(); |
1715 | } | 1715 | m_scrollbar->setOrientation(Qt::Horizontal); |
1716 | else if (reader->btextfmt) | 1716 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); |
1717 | { | 1717 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); |
1718 | prefwin->Markup(2); | 1718 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); |
1719 | } | 1719 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); |
1720 | else if (reader->bstriphtml) | 1720 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1721 | { | 1721 | } |
1722 | prefwin->Markup(3); | 1722 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); |
1723 | } | 1723 | reader->repaint(); |
1724 | else if (reader->bpeanut) | 1724 | } |
1725 | { | 1725 | else |
1726 | prefwin->Markup(4); | 1726 | { |
1727 | } | 1727 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); |
1728 | else | 1728 | if (m_scrollbar != NULL) |
1729 | { | 1729 | { |
1730 | prefwin->Markup(1); | 1730 | scrollbar->disconnect(); |
1731 | } | 1731 | m_scrollbar->setOrientation(Qt::Vertical); |
1732 | prefwin->Depluck(reader->bdepluck); | 1732 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); |
1733 | prefwin->Dejpluck(reader->bdejpluck); | 1733 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); |
1734 | prefwin->Continuous(reader->m_continuousDocument); | 1734 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); |
1735 | 1735 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); | |
1736 | prefwin->dictApplication(m_targetapp); | 1736 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1737 | prefwin->dictMessage(m_targetmsg); | 1737 | } |
1738 | 1738 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); | |
1739 | prefwin->spaceAction(m_spaceTarget); | 1739 | reader->repaint(); |
1740 | prefwin->escapeAction(m_escapeTarget); | 1740 | } |
1741 | prefwin->returnAction(m_returnTarget); | 1741 | // reader->update(); |
1742 | prefwin->leftAction(m_leftTarget); | 1742 | } |
1743 | prefwin->rightAction(m_rightTarget); | 1743 | |
1744 | prefwin->upAction(m_upTarget); | 1744 | void QTReaderApp::setgrab(bool sfs) |
1745 | prefwin->downAction(m_downTarget); | 1745 | { |
1746 | 1746 | #ifdef USEQPE | |
1747 | prefwin->leftScroll(m_leftScroll); | 1747 | m_grabkeyboard = sfs; |
1748 | prefwin->rightScroll(m_rightScroll); | 1748 | if (m_grabkeyboard) |
1749 | prefwin->upScroll(m_upScroll); | 1749 | { |
1750 | prefwin->downScroll(m_downScroll); | 1750 | ((QPEApplication*)qApp)->grabKeyboard(); |
1751 | 1751 | } | |
1752 | prefwin->miscannotation(m_doAnnotation); | 1752 | else |
1753 | prefwin->miscdictionary(m_doDictionary); | 1753 | { |
1754 | prefwin->miscclipboard(m_doClipboard); | 1754 | ((QPEApplication*)qApp)->ungrabKeyboard(); |
1755 | 1755 | } | |
1756 | prefwin->SwapMouse(reader->m_swapmouse); | 1756 | #endif |
1757 | 1757 | } | |
1758 | prefwin->Font(reader->m_fontname); | 1758 | |
1759 | 1759 | void QTReaderApp::setfullscreen(bool sfs) | |
1760 | prefwin->gfxsize(reader->getBaseSize()); | 1760 | { |
1761 | 1761 | reader->bDoUpdates = false; | |
1762 | prefwin->pageoverlap(reader->m_overlap); | 1762 | m_fullscreen = sfs; |
1763 | 1763 | showEditTools(); | |
1764 | prefwin->ideogram(reader->m_bMonoSpaced); | 1764 | // qApp->processEvents(); |
1765 | 1765 | reader->bDoUpdates = true; | |
1766 | prefwin->encoding(reader->m_encd); | 1766 | reader->update(); |
1767 | 1767 | } | |
1768 | prefwin->ideogramwidth(reader->m_charpc); | 1768 | /* |
1769 | 1769 | void QTReaderApp::buttonActionSelected(QAction* _a) | |
1770 | if (prefwin->exec()) | 1770 | { |
1771 | { | 1771 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); |
1772 | m_twoTouch = prefwin->twotouch(); | 1772 | m_spaceTarget = ActNameToInt(_a->text()); |
1773 | reader->setTwoTouch(m_twoTouch); | 1773 | } |
1774 | m_touch_action->setOn(m_twoTouch); | 1774 | */ |
1775 | 1775 | QTReaderApp::~QTReaderApp() | |
1776 | reader->bstripcr = prefwin->StripCR(); | 1776 | { |
1777 | reader->bdehyphen = prefwin->Dehyphen(); | 1777 | } |
1778 | reader->bonespace = prefwin->SingleSpace(); | 1778 | |
1779 | reader->bunindent = prefwin->Unindent(); | 1779 | void QTReaderApp::autoScroll(bool _b) |
1780 | reader->brepara = prefwin->Reparagraph(); | 1780 | { |
1781 | reader->bdblspce = prefwin->DoubleSpace(); | 1781 | reader->setautoscroll(_b); |
1782 | reader->bremap = prefwin->Remap(); | 1782 | setScrollState(reader->m_autoScroll); |
1783 | reader->bmakebold = prefwin->Embolden(); | 1783 | } |
1784 | reader->bfulljust = prefwin->FullJustify(); | 1784 | |
1785 | reader->setextraspace(prefwin->ParaLead()); | 1785 | void QTReaderApp::zoomin() |
1786 | reader->setlead(prefwin->LineLead()); | 1786 | { |
1787 | reader->m_border = prefwin->Margin(); | 1787 | reader->zoomin(); |
1788 | reader->bindenter = prefwin->Indent(); | 1788 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1789 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; | 1789 | m_prog->setFont( f ); |
1790 | switch (prefwin->Markup()) | 1790 | } |
1791 | { | 1791 | |
1792 | case 0: | 1792 | void QTReaderApp::zoomout() |
1793 | reader->bautofmt = true; | 1793 | { |
1794 | break; | 1794 | reader->zoomout(); |
1795 | case 1: | 1795 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1796 | break; | 1796 | m_prog->setFont( f ); |
1797 | case 2: | 1797 | } |
1798 | reader->btextfmt = true; | 1798 | |
1799 | break; | 1799 | void QTReaderApp::clearBkmkList() |
1800 | case 3: | 1800 | { |
1801 | reader->bstriphtml = true; | 1801 | delete pBkmklist; |
1802 | break; | 1802 | reader->pBkmklist = pBkmklist = NULL; |
1803 | case 4: | 1803 | m_fBkmksChanged = false; |
1804 | reader->bpeanut = true; | 1804 | reader->refresh(true); |
1805 | break; | 1805 | } |
1806 | default: | 1806 | |
1807 | odebug << "Format out of range" << oendl; | 1807 | void QTReaderApp::fileClose() |
1808 | } | 1808 | { |
1809 | reader->bdepluck = prefwin->Depluck(); | 1809 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); |
1810 | reader->bdejpluck = prefwin->Dejpluck(); | 1810 | if (cd->exec()) |
1811 | reader->setContinuous(prefwin->Continuous()); | 1811 | { |
1812 | 1812 | if (pOpenlist != NULL) | |
1813 | m_spaceTarget = (ActionTypes)prefwin->spaceAction(); | 1813 | { |
1814 | m_escapeTarget = (ActionTypes)prefwin->escapeAction(); | 1814 | int ind = 0; |
1815 | m_returnTarget = (ActionTypes)prefwin->returnAction(); | 1815 | Bkmk* p = (*pOpenlist)[ind]; |
1816 | m_leftTarget = (ActionTypes)prefwin->leftAction(); | 1816 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
1817 | m_rightTarget = (ActionTypes)prefwin->rightAction(); | 1817 | { |
1818 | m_upTarget = (ActionTypes)prefwin->upAction(); | 1818 | p = (*pOpenlist)[++ind]; |
1819 | m_downTarget = (ActionTypes)prefwin->downAction(); | 1819 | } |
1820 | m_leftScroll = prefwin->leftScroll(); | 1820 | if (p != NULL) pOpenlist->erase(ind); |
1821 | m_rightScroll = prefwin->rightScroll(); | 1821 | if (cd->delFile()) |
1822 | m_upScroll = prefwin->upScroll(); | 1822 | { |
1823 | m_downScroll = prefwin->downScroll(); | 1823 | unlink((const char*)reader->m_lastfile); |
1824 | 1824 | } | |
1825 | m_targetapp = prefwin->dictApplication(); | 1825 | if (cd->delMarks()) |
1826 | m_targetmsg = prefwin->dictMessage(); | 1826 | { |
1827 | 1827 | #ifndef USEQPE | |
1828 | m_doAnnotation = prefwin->miscannotation(); | 1828 | QDir d = QDir::home(); // "/" |
1829 | m_doDictionary = prefwin->miscdictionary(); | 1829 | d.cd(APPDIR); |
1830 | m_doClipboard = prefwin->miscclipboard(); | 1830 | d.remove(reader->m_string); |
1831 | reader->m_swapmouse = prefwin->SwapMouse(); | 1831 | #else /* USEQPE */ |
1832 | reader->setBaseSize(prefwin->gfxsize()); | 1832 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
1833 | reader->m_overlap = prefwin->pageoverlap(); | 1833 | #endif /* USEQPE */ |
1834 | reader->m_bMonoSpaced = prefwin->ideogram(); | 1834 | } |
1835 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 1835 | if (cd->delConfig()) |
1836 | reader->m_encd = prefwin->encoding(); | 1836 | { |
1837 | reader->m_charpc = prefwin->ideogramwidth(); | 1837 | #ifndef USEQPE |
1838 | 1838 | QDir d = QDir::home(); // "/" | |
1839 | if ( | 1839 | d.cd(APPDIR "/configs"); |
1840 | reader->m_fontname != prefwin->Font() | 1840 | d.remove(reader->m_string); |
1841 | || | 1841 | #else /* USEQPE */ |
1842 | m_propogatefontchange != prefwin->propfontchange()) | 1842 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); |
1843 | { | 1843 | #endif /* USEQPE */ |
1844 | m_propogatefontchange = prefwin->propfontchange(); | 1844 | } |
1845 | setfontHelper(prefwin->Font()); | 1845 | } |
1846 | } | 1846 | |
1847 | delete prefwin; | 1847 | fileOpen2(); |
1848 | reader->setfilter(reader->getfilter()); | 1848 | } |
1849 | reader->refresh(); | 1849 | delete cd; |
1850 | 1850 | } | |
1851 | } | 1851 | |
1852 | else | 1852 | void QTReaderApp::updatefileinfo() |
1853 | { | 1853 | { |
1854 | delete prefwin; | 1854 | if (reader->m_string.isEmpty()) return; |
1855 | } | 1855 | if (reader->m_lastfile.isEmpty()) return; |
1856 | } | 1856 | tchar* nm = fromQString(reader->m_string); |
1857 | 1857 | tchar* fl = fromQString(reader->m_lastfile); | |
1858 | void QTReaderApp::showtoolbarprefs() | 1858 | // qDebug("Lastfile:%x", fl); |
1859 | { | 1859 | bool notadded = true; |
1860 | #ifdef USEQPE | 1860 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; |
1861 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); | 1861 | else |
1862 | #else | 1862 | { |
1863 | QFileInfo fi; | 1863 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
1864 | QDir d = QDir::home(); // "/" | 1864 | { |
1865 | if ( !d.cd(APPDIR) ) | 1865 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) |
1866 | { // "/tmp" | 1866 | { |
1867 | owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl; | 1867 | iter->value(reader->pagelocate()); |
1868 | d = QDir::home(); | 1868 | unsigned short dlen; |
1869 | d.mkdir(APPDIR); | 1869 | unsigned char* data; |
1870 | d.cd(APPDIR); | 1870 | CFiledata fd(iter->anno()); |
1871 | } | 1871 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1872 | fi.setFile(d, INIFILE); | 1872 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); |
1873 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); | 1873 | // getstate(data, dlen); |
1874 | #endif | 1874 | iter->setAnno(data, dlen); |
1875 | prefwin->tbpolicy(m_tbpolsave); | 1875 | notadded = false; |
1876 | prefwin->tbposition(m_tbposition-2); | 1876 | delete [] data; |
1877 | prefwin->tbmovable(m_tbmovesave); | 1877 | break; |
1878 | prefwin->floating(m_bFloatingDialog); | 1878 | } |
1879 | if (prefwin->exec()) | 1879 | } |
1880 | { | 1880 | } |
1881 | m_bFloatingDialog = prefwin->floating(); | 1881 | // qDebug("Added?:%x", notadded); |
1882 | if ( | 1882 | if (notadded) |
1883 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() | 1883 | { |
1884 | || | 1884 | struct stat fnstat; |
1885 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) | 1885 | stat((const char *)reader->m_lastfile, &fnstat); |
1886 | || | 1886 | CFiledata fd(fnstat.st_mtime, fl); |
1887 | m_tbmovesave != prefwin->tbmovable() | 1887 | unsigned short dlen; |
1888 | ) | 1888 | unsigned char* data; |
1889 | { | 1889 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1890 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); | 1890 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); |
1891 | } | 1891 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); |
1892 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); | 1892 | delete [] data; |
1893 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); | 1893 | } |
1894 | m_tbmovesave = prefwin->tbmovable(); | 1894 | delete [] nm; |
1895 | bool isChanged = prefwin->isChanged(); | 1895 | delete [] fl; |
1896 | delete prefwin; | 1896 | } |
1897 | #ifdef USEQPE | 1897 | |
1898 | Config config( APPDIR ); | 1898 | void QTReaderApp::fileOpen() |
1899 | #else | 1899 | { |
1900 | QFileInfo fi; | 1900 | /* |
1901 | QDir d = QDir::home(); // "/" | 1901 | menu->hide(); |
1902 | if ( !d.cd(APPDIR) ) | 1902 | fileBar->hide(); |
1903 | { // "/tmp" | 1903 | if (regVisible) regBar->hide(); |
1904 | owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl; | 1904 | if (searchVisible) searchBar->hide(); |
1905 | d = QDir::home(); | 1905 | */ |
1906 | d.mkdir(APPDIR); | 1906 | // qDebug("fileOpen"); |
1907 | d.cd(APPDIR); | 1907 | // if (!reader->m_lastfile.isEmpty()) |
1908 | } | 1908 | updatefileinfo(); |
1909 | fi.setFile(d, INIFILE); | 1909 | fileOpen2(); |
1910 | Config config( fi.absFilePath() ); | 1910 | } |
1911 | #endif | 1911 | |
1912 | if (isChanged) addtoolbars(&config); | 1912 | void QTReaderApp::fileOpen2() |
1913 | } | 1913 | { |
1914 | else | 1914 | if (pBkmklist != NULL) |
1915 | { | 1915 | { |
1916 | delete prefwin; | 1916 | if (m_fBkmksChanged) |
1917 | } | 1917 | { |
1918 | } | 1918 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
1919 | 1919 | savebkmks(); | |
1920 | void QTReaderApp::showinfo() | 1920 | } |
1921 | { | 1921 | delete pBkmklist; |
1922 | unsigned long fs, ts, pl; | 1922 | reader->pBkmklist = pBkmklist = NULL; |
1923 | if (reader->empty()) | 1923 | m_fBkmksChanged = false; |
1924 | { | 1924 | } |
1925 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 1925 | reader->disableAutoscroll(); |
1926 | } | 1926 | /* |
1927 | else | 1927 | editorStack->raiseWidget( fileSelector ); |
1928 | { | 1928 | fileSelector->reread(); |
1929 | reader->sizes(fs,ts); | 1929 | */ |
1930 | pl = reader->pagelocate(); | 1930 | bool usebrowser = true; |
1931 | m_infoWin->setFileSize(fs); | 1931 | if (pOpenlist != NULL) |
1932 | m_infoWin->setTextSize(ts); | 1932 | { |
1933 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 1933 | m_nBkmkAction = cOpenFile; |
1934 | m_infoWin->setLocation(pl); | 1934 | if (listbkmk(pOpenlist, "Browse")) usebrowser = false; |
1935 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 1935 | } |
1936 | editorStack->raiseWidget( m_infoWin ); | 1936 | if (usebrowser) |
1937 | m_infoWin->setFocus(); | 1937 | { |
1938 | } | 1938 | QString fn = usefilebrowser(); |
1939 | } | 1939 | //qApp->processEvents(); |
1940 | 1940 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | |
1941 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn) | 1941 | { |
1942 | { | 1942 | openFile(fn); |
1943 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; | 1943 | } |
1944 | #ifdef _UNICODE | 1944 | reader->setFocus(); |
1945 | CBuffer buff(name.length()+1); | 1945 | } |
1946 | int i; | 1946 | // reader->refresh(); |
1947 | for (i = 0; i < name.length(); i++) | 1947 | // qDebug("HEIGHT:%d", reader->m_lastheight); |
1948 | { | 1948 | } |
1949 | buff[i] = name[i].unicode(); | 1949 | |
1950 | } | 1950 | QString QTReaderApp::usefilebrowser() |
1951 | buff[i] = 0; | 1951 | { |
1952 | CBuffer buff2(text.length()+1); | 1952 | #ifndef USEQPE |
1953 | for (i = 0; i < text.length(); i++) | 1953 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); |
1954 | { | 1954 | return s; |
1955 | buff2[i] = text[i].unicode(); | 1955 | #else |
1956 | } | 1956 | QString fn; |
1957 | buff2[i] = 0; | 1957 | #ifdef OPIE |
1958 | pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn)); | 1958 | QMap<QString, QStringList> mimeTypes; |
1959 | #else | 1959 | QStringList etypes; |
1960 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); | 1960 | etypes << "etext/*"; |
1961 | #endif | 1961 | mimeTypes.insert( tr("eText"), etypes ); |
1962 | m_fBkmksChanged = true; | 1962 | QStringList types; |
1963 | pBkmklist->sort(); | 1963 | types << "text/*"; |
1964 | } | 1964 | mimeTypes.insert( tr("Text"), types ); |
1965 | 1965 | mimeTypes.insert( tr("All"), "*/*" ); | |
1966 | void QTReaderApp::addAnno(const QString& name, const QString& text) | 1966 | fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader"); |
1967 | { | 1967 | #else |
1968 | if (m_annoIsEditing) | 1968 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, |
1969 | { | 1969 | 0, |
1970 | if (name.isEmpty()) | 1970 | // WStyle_Customize | WStyle_NoBorderEx, |
1971 | { | 1971 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
1972 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); | 1972 | |
1973 | } | 1973 | |
1974 | else | 1974 | if (fb->exec()) |
1975 | { | 1975 | { |
1976 | addAnno(name, text, m_annoWin->getPosn()); | 1976 | fn = fb->getCurrentFile(); |
1977 | } | 1977 | } |
1978 | showEditTools(); | 1978 | // qDebug("Selected %s", (const char*)fn); |
1979 | } | 1979 | delete fb; |
1980 | else | 1980 | #endif |
1981 | { | 1981 | showEditTools(); |
1982 | if (m_annoWin->edited()) | 1982 | return fn; |
1983 | { | 1983 | #endif |
1984 | CBuffer buff(text.length()+1); | 1984 | } |
1985 | int i; | 1985 | |
1986 | for (i = 0; i < text.length(); i++) | 1986 | void QTReaderApp::showgraphic(QImage& pm) |
1987 | { | 1987 | { |
1988 | buff[i] = text[i].unicode(); | 1988 | m_graphicwin->setImage(pm); |
1989 | } | 1989 | editorStack->raiseWidget( m_graphicwin ); |
1990 | buff[i] = 0; | 1990 | hidetoolbars(); |
1991 | m_fBkmksChanged = true; | 1991 | m_graphicwin->setFocus(); |
1992 | m_anno->setAnno(buff.data()); | 1992 | } |
1993 | } | 1993 | |
1994 | bool found = findNextBookmark(m_anno->value()+1); | 1994 | void QTReaderApp::showbuttonprefs() |
1995 | if (found) | 1995 | { |
1996 | { | 1996 | editorStack->raiseWidget( m_buttonprefs ); |
1997 | m_annoWin->setName(toQString(m_anno->name())); | 1997 | hidetoolbars(); |
1998 | m_annoWin->setAnno(toQString(m_anno->anno())); | 1998 | m_buttonprefs->setFocus(); |
1999 | } | 1999 | m_kmapchanged = true; |
2000 | else | 2000 | } |
2001 | { | 2001 | |
2002 | showEditTools(); | 2002 | void QTReaderApp::showprefs() |
2003 | } | 2003 | { |
2004 | } | 2004 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); |
2005 | } | 2005 | |
2006 | 2006 | // prefwin->Debounce(m_debounce); | |
2007 | bool QTReaderApp::findNextBookmark(size_t start) | 2007 | prefwin->bgtype(m_bgtype); |
2008 | { | 2008 | prefwin->repalm(reader->brepalm); |
2009 | bool found = false; | 2009 | prefwin->kern(reader->bkern); |
2010 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) | 2010 | prefwin->hyphenate(reader->hyphenate); |
2011 | { | 2011 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); |
2012 | if (iter->value() >= start) | 2012 | prefwin->scrolltype(reader->m_scrolltype); |
2013 | { | 2013 | prefwin->scrollstep(reader->m_scrollstep); |
2014 | if (iter->value() < reader->locate()) | 2014 | prefwin->scrollcolor(m_scrollcolor); |
2015 | { | 2015 | prefwin->minibarcol(m_scrollbarcolor); |
2016 | found = true; | 2016 | prefwin->foreground(m_foreground); |
2017 | m_anno = iter.pContent(); | 2017 | prefwin->background(m_background); |
2018 | } | 2018 | prefwin->twotouch(m_twoTouch); |
2019 | break; | 2019 | prefwin->propfontchange(m_propogatefontchange); |
2020 | } | 2020 | prefwin->StripCR(reader->bstripcr); |
2021 | } | 2021 | prefwin->Dehyphen(reader->bdehyphen); |
2022 | return found; | 2022 | prefwin->SingleSpace(reader->bonespace); |
2023 | } | 2023 | prefwin->Unindent(reader->bunindent); |
2024 | 2024 | prefwin->Reparagraph(reader->brepara); | |
2025 | void QTReaderApp::addanno() | 2025 | prefwin->DoubleSpace(reader->bdblspce); |
2026 | { | 2026 | prefwin->Remap(reader->bremap); |
2027 | if (reader->empty()) | 2027 | prefwin->Embolden(reader->bmakebold); |
2028 | { | 2028 | prefwin->FullJustify(reader->bfulljust); |
2029 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2029 | // prefwin->Inverse(reader->bInverse); |
2030 | } | 2030 | // prefwin->Negative(reader->bNegative); |
2031 | else | 2031 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); |
2032 | { | 2032 | prefwin->ParaLead(reader->getextraspace()); |
2033 | m_annoWin->setName(""); | 2033 | prefwin->LineLead(reader->getlead()); |
2034 | m_annoWin->setAnno(""); | 2034 | prefwin->TopMargin(reader->m_abstopmargin); |
2035 | m_annoWin->setPosn(reader->pagelocate()); | 2035 | prefwin->BottomMargin(reader->m_absbottommargin); |
2036 | m_annoIsEditing = true; | 2036 | prefwin->LeftMargin(reader->m_absleft_border); |
2037 | editorStack->raiseWidget( m_annoWin ); | 2037 | prefwin->RightMargin(reader->m_absright_border); |
2038 | #ifdef USEQPE | 2038 | prefwin->Indent(reader->bindenter); |
2039 | Global::showInputMethod(); | 2039 | if (reader->bautofmt) |
2040 | #endif | 2040 | { |
2041 | m_annoWin->setFocus(); | 2041 | prefwin->Markup(0); |
2042 | } | 2042 | } |
2043 | } | 2043 | else if (reader->btextfmt) |
2044 | 2044 | { | |
2045 | void QTReaderApp::infoClose() | 2045 | prefwin->Markup(2); |
2046 | { | 2046 | } |
2047 | showEditTools(); | 2047 | else if (reader->bstriphtml) |
2048 | } | 2048 | { |
2049 | 2049 | prefwin->Markup(3); | |
2050 | /* | 2050 | } |
2051 | void QTReaderApp::fileRevert() | 2051 | else if (reader->bpeanut) |
2052 | { | 2052 | { |
2053 | clear(); | 2053 | prefwin->Markup(4); |
2054 | fileOpen(); | 2054 | } |
2055 | } | 2055 | else |
2056 | 2056 | { | |
2057 | void QTReaderApp::editCut() | 2057 | prefwin->Markup(1); |
2058 | { | 2058 | } |
2059 | #ifndef QT_NO_CLIPBOARD | 2059 | prefwin->Depluck(reader->bdepluck); |
2060 | editor->cut(); | 2060 | prefwin->Dejpluck(reader->bdejpluck); |
2061 | #endif | 2061 | prefwin->Continuous(reader->m_continuousDocument); |
2062 | } | 2062 | |
2063 | */ | 2063 | prefwin->dictApplication(m_targetapp); |
2064 | void QTReaderApp::editMark() | 2064 | prefwin->dictMessage(m_targetmsg); |
2065 | { | 2065 | |
2066 | m_savedpos = reader->pagelocate(); | 2066 | /* |
2067 | } | 2067 | prefwin->leftScroll(m_leftScroll); |
2068 | 2068 | prefwin->rightScroll(m_rightScroll); | |
2069 | void QTReaderApp::editCopy() | 2069 | prefwin->upScroll(m_upScroll); |
2070 | { | 2070 | prefwin->downScroll(m_downScroll); |
2071 | QClipboard* cb = QApplication::clipboard(); | 2071 | */ |
2072 | QString text; | 2072 | |
2073 | int ch; | 2073 | prefwin->miscannotation(m_doAnnotation); |
2074 | unsigned long currentpos = reader->pagelocate(); | 2074 | prefwin->miscdictionary(m_doDictionary); |
2075 | unsigned long endpos = reader->locate(); | 2075 | prefwin->miscclipboard(m_doClipboard); |
2076 | if (m_savedpos == 0xffffffff) | 2076 | |
2077 | { | 2077 | prefwin->SwapMouse(reader->m_swapmouse); |
2078 | m_savedpos = currentpos; | 2078 | |
2079 | } | 2079 | prefwin->Font(reader->m_fontname); |
2080 | reader->jumpto(m_savedpos); | 2080 | |
2081 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) | 2081 | prefwin->gfxsize(reader->getBaseSize()); |
2082 | { | 2082 | |
2083 | text += ch; | 2083 | prefwin->pageoverlap(reader->m_overlap); |
2084 | } | 2084 | |
2085 | cb->setText(text); | 2085 | prefwin->ideogram(reader->m_bMonoSpaced); |
2086 | reader->locate(currentpos); | 2086 | |
2087 | m_savedpos = 0xffffffff; | 2087 | prefwin->encoding(reader->m_encd); |
2088 | } | 2088 | |
2089 | 2089 | prefwin->ideogramwidth(reader->m_charpc); | |
2090 | void QTReaderApp::gotoStart() | 2090 | |
2091 | { | 2091 | if (prefwin->exec()) |
2092 | reader->locate(reader->buffdoc.startSection()); | 2092 | { |
2093 | } | 2093 | // m_debounce = prefwin->Debounce(); |
2094 | 2094 | reader->brepalm = prefwin->repalm(); | |
2095 | void QTReaderApp::gotoEnd() | 2095 | reader->bkern = prefwin->kern(); |
2096 | { | 2096 | reader->hyphenate = prefwin->hyphenate(); |
2097 | reader->dopageup(reader->buffdoc.endSection()); | 2097 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); |
2098 | } | 2098 | reader->m_scrolltype = prefwin->scrolltype(); |
2099 | 2099 | reader->m_scrollstep = prefwin->scrollstep(); | |
2100 | void QTReaderApp::pageup() | 2100 | m_scrollcolor = prefwin->scrollcolor(); |
2101 | { | 2101 | setscrollcolour(); |
2102 | reader->NavUp(); | 2102 | m_scrollbarcolor = prefwin->minibarcol(); |
2103 | } | 2103 | setscrollbarcolour(); |
2104 | 2104 | m_foreground = prefwin->foreground(); | |
2105 | void QTReaderApp::pagedn() | 2105 | reader->setForeground(getcolour(m_foreground)); |
2106 | { | 2106 | m_background = prefwin->background(); |
2107 | reader->NavDown(); | 2107 | reader->setBackground(getcolour(m_background)); |
2108 | } | 2108 | m_twoTouch = prefwin->twotouch(); |
2109 | 2109 | reader->setTwoTouch(m_twoTouch); | |
2110 | void QTReaderApp::pagemode(bool _b) | 2110 | m_touch_action->setOn(m_twoTouch); |
2111 | { | 2111 | |
2112 | reader->setpagemode(_b); | 2112 | reader->bstripcr = prefwin->StripCR(); |
2113 | } | 2113 | reader->bdehyphen = prefwin->Dehyphen(); |
2114 | 2114 | reader->bonespace = prefwin->SingleSpace(); | |
2115 | /* | 2115 | reader->bunindent = prefwin->Unindent(); |
2116 | void QTReaderApp::setspacing() | 2116 | reader->brepara = prefwin->Reparagraph(); |
2117 | { | 2117 | reader->bdblspce = prefwin->DoubleSpace(); |
2118 | m_nRegAction = cMonoSpace; | 2118 | reader->bremap = prefwin->Remap(); |
2119 | char lcn[20]; | 2119 | reader->bmakebold = prefwin->Embolden(); |
2120 | sprintf(lcn, "%lu", reader->m_charpc); | 2120 | reader->bfulljust = prefwin->FullJustify(); |
2121 | regEdit->setText(lcn); | 2121 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); |
2122 | do_regedit(); | 2122 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); |
2123 | } | 2123 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); |
2124 | */ | 2124 | |
2125 | void QTReaderApp::settarget() | 2125 | reader->setextraspace(prefwin->ParaLead()); |
2126 | { | 2126 | reader->setlead(prefwin->LineLead()); |
2127 | m_nRegAction = cSetTarget; | 2127 | reader->m_abstopmargin = prefwin->TopMargin(); |
2128 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) | 2128 | reader->m_absbottommargin = prefwin->BottomMargin(); |
2129 | + "/" | 2129 | reader->m_absleft_border = prefwin->LeftMargin(); |
2130 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); | 2130 | reader->m_absright_border = prefwin->RightMargin(); |
2131 | regEdit->setText(text); | 2131 | reader->bindenter = prefwin->Indent(); |
2132 | do_regedit(); | 2132 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; |
2133 | } | 2133 | switch (prefwin->Markup()) |
2134 | 2134 | { | |
2135 | /* | 2135 | case 0: |
2136 | void QTReaderApp::do_mono(const QString& lcn) | 2136 | reader->bautofmt = true; |
2137 | { | 2137 | break; |
2138 | bool ok; | 2138 | case 1: |
2139 | unsigned long ulcn = lcn.toULong(&ok); | 2139 | break; |
2140 | if (ok) | 2140 | case 2: |
2141 | { | 2141 | reader->btextfmt = true; |
2142 | reader->m_charpc = ulcn; | 2142 | break; |
2143 | reader->setfont(); | 2143 | case 3: |
2144 | reader->refresh(); | 2144 | reader->bstriphtml = true; |
2145 | // reader->setmono(true); | 2145 | break; |
2146 | } | 2146 | case 4: |
2147 | else | 2147 | reader->bpeanut = true; |
2148 | QMessageBox::information(this, PROGNAME, "Must be a number"); | 2148 | break; |
2149 | } | 2149 | default: |
2150 | */ | 2150 | qDebug("Format out of range"); |
2151 | /* | 2151 | } |
2152 | void QTReaderApp::editPaste() | 2152 | reader->bdepluck = prefwin->Depluck(); |
2153 | { | 2153 | reader->bdejpluck = prefwin->Dejpluck(); |
2154 | #ifndef QT_NO_CLIPBOARD | 2154 | reader->setContinuous(prefwin->Continuous()); |
2155 | editor->paste(); | 2155 | |
2156 | #endif | 2156 | /* |
2157 | } | 2157 | m_leftScroll = prefwin->leftScroll(); |
2158 | */ | 2158 | m_rightScroll = prefwin->rightScroll(); |
2159 | 2159 | m_upScroll = prefwin->upScroll(); | |
2160 | void QTReaderApp::editFind() | 2160 | m_downScroll = prefwin->downScroll(); |
2161 | { | 2161 | */ |
2162 | searchStart = reader->pagelocate(); | 2162 | m_targetapp = prefwin->dictApplication(); |
2163 | #ifdef __ISEARCH | 2163 | m_targetmsg = prefwin->dictMessage(); |
2164 | searchStack = new QStack<searchrecord>; | 2164 | |
2165 | #endif | 2165 | m_doAnnotation = prefwin->miscannotation(); |
2166 | #ifdef USEQPE | 2166 | m_doDictionary = prefwin->miscdictionary(); |
2167 | Global::showInputMethod(); | 2167 | m_doClipboard = prefwin->miscclipboard(); |
2168 | #endif | 2168 | reader->m_swapmouse = prefwin->SwapMouse(); |
2169 | searchBar->show(); | 2169 | reader->setBaseSize(prefwin->gfxsize()); |
2170 | searchVisible = TRUE; | 2170 | reader->m_overlap = prefwin->pageoverlap(); |
2171 | searchEdit->setFocus(); | 2171 | reader->m_bMonoSpaced = prefwin->ideogram(); |
2172 | #ifdef __ISEARCH | 2172 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
2173 | searchStack->push(new searchrecord("",reader->pagelocate())); | 2173 | reader->m_encd = prefwin->encoding(); |
2174 | #endif | 2174 | reader->m_charpc = prefwin->ideogramwidth(); |
2175 | } | 2175 | |
2176 | 2176 | if ( | |
2177 | void QTReaderApp::findNext() | 2177 | reader->m_fontname != prefwin->Font() |
2178 | { | 2178 | || |
2179 | // // odebug << "findNext called\n" << oendl; | 2179 | m_propogatefontchange != prefwin->propfontchange()) |
2180 | #ifdef __ISEARCH | 2180 | { |
2181 | QString arg = searchEdit->text(); | 2181 | m_propogatefontchange = prefwin->propfontchange(); |
2182 | #else | 2182 | setfontHelper(prefwin->Font()); |
2183 | QRegExp arg = searchEdit->text(); | 2183 | } |
2184 | #endif | 2184 | if (m_bgtype != (bground)prefwin->bgtype()) |
2185 | CDrawBuffer test(&(reader->m_fontControl)); | 2185 | { |
2186 | size_t start = reader->pagelocate(); | 2186 | m_bgtype = (bground)prefwin->bgtype(); |
2187 | reader->jumpto(start); | 2187 | setBackgroundBitmap(); |
2188 | reader->getline(&test); | 2188 | } |
2189 | dosearch(start, test, arg); | 2189 | delete prefwin; |
2190 | } | 2190 | reader->setfilter(reader->getfilter()); |
2191 | 2191 | reader->refresh(); | |
2192 | void QTReaderApp::findClose() | 2192 | } |
2193 | { | 2193 | else |
2194 | searchVisible = FALSE; | 2194 | { |
2195 | searchEdit->setText(""); | 2195 | delete prefwin; |
2196 | #ifdef USEQPE | 2196 | } |
2197 | Global::hideInputMethod(); | 2197 | } |
2198 | #endif | 2198 | |
2199 | searchBar->hide(); | 2199 | void QTReaderApp::showtoolbarprefs() |
2200 | #ifdef __ISEARCH | 2200 | { |
2201 | // searchStack = new QStack<searchrecord>; | 2201 | #ifdef USEQPE |
2202 | while (!searchStack->isEmpty()) | 2202 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); |
2203 | { | 2203 | #else |
2204 | delete searchStack->pop(); | 2204 | QFileInfo fi; |
2205 | } | 2205 | QDir d = QDir::home(); // "/" |
2206 | delete searchStack; | 2206 | if ( !d.cd(APPDIR) ) |
2207 | #endif | 2207 | { // "/tmp" |
2208 | reader->setFocus(); | 2208 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2209 | } | 2209 | d = QDir::home(); |
2210 | 2210 | d.mkdir(APPDIR); | |
2211 | void QTReaderApp::regClose() | 2211 | d.cd(APPDIR); |
2212 | { | 2212 | } |
2213 | regVisible = FALSE; | 2213 | fi.setFile(d, INIFILE); |
2214 | regEdit->setText(""); | 2214 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); |
2215 | regBar->hide(); | 2215 | #endif |
2216 | #ifdef USEQPE | 2216 | prefwin->tbpolicy(m_tbpolsave); |
2217 | Global::hideInputMethod(); | 2217 | prefwin->tbposition(m_tbposition-2); |
2218 | #endif | 2218 | prefwin->tbmovable(m_tbmovesave); |
2219 | reader->setFocus(); | 2219 | prefwin->floating(m_bFloatingDialog); |
2220 | } | 2220 | prefwin->qtscroll(m_qtscroll); |
2221 | 2221 | prefwin->localscroll(m_localscroll); | |
2222 | #ifdef __ISEARCH | 2222 | if (prefwin->exec()) |
2223 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) | 2223 | { |
2224 | #else | 2224 | m_bFloatingDialog = prefwin->floating(); |
2225 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | 2225 | if ( |
2226 | #endif | 2226 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() |
2227 | { | 2227 | || |
2228 | bool ret = true; | 2228 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) |
2229 | unsigned long fs, ts; | 2229 | || |
2230 | reader->sizes(fs,ts); | 2230 | m_tbmovesave != prefwin->tbmovable() |
2231 | size_t pos = reader->locate(); | 2231 | || |
2232 | pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); | 2232 | m_qtscroll != prefwin->qtscroll() |
2233 | pbar->show(); | 2233 | // || |
2234 | pbar->raise(); | 2234 | // m_localscrollbar != prefwin->scrollonleft() |
2235 | pbar->reset(); | 2235 | ) |
2236 | int offset; | 2236 | { |
2237 | int lastpc = (100*pos)/ts; | 2237 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); |
2238 | pbar->setProgress(lastpc); | 2238 | } |
2239 | // qApp->processEvents(); | 2239 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); |
2240 | if (reader->buffdoc.getpara(test) >= 0) | 2240 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); |
2241 | { | 2241 | m_tbmovesave = prefwin->tbmovable(); |
2242 | reader->setFocus(); | 2242 | reader->m_scrollpos = m_localscroll = prefwin->localscroll(); |
2243 | #ifdef __ISEARCH | 2243 | if (m_qtscroll != prefwin->qtscroll()) |
2244 | while (strstr(test.data(),(const tchar*)arg) == NULL) | 2244 | { |
2245 | #else | 2245 | m_qtscroll = prefwin->qtscroll(); |
2246 | #ifdef _UNICODE | 2246 | setrotated(reader->m_rotated); |
2247 | while ((offset = arg.match(toQString(test.data()))) == -1) | 2247 | } |
2248 | #else | 2248 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
2249 | while (arg.match(test.data()) == -1) | 2249 | { |
2250 | #endif | 2250 | reader->m_scrollpos = m_localscroll; |
2251 | #endif | 2251 | } |
2252 | { | 2252 | else |
2253 | pos = reader->locate(); | 2253 | { |
2254 | int pc = (100*pos)/ts; | 2254 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
2255 | if (pc != lastpc) | 2255 | } |
2256 | { | 2256 | bool isChanged = prefwin->isChanged(); |
2257 | pbar->setProgress(pc); | 2257 | delete prefwin; |
2258 | qApp->processEvents(); | 2258 | #ifdef USEQPE |
2259 | reader->setFocus(); | 2259 | Config config( APPDIR ); |
2260 | lastpc = pc; | 2260 | #else |
2261 | } | 2261 | QFileInfo fi; |
2262 | 2262 | QDir d = QDir::home(); // "/" | |
2263 | if (reader->buffdoc.getpara(test) < 0) | 2263 | if ( !d.cd(APPDIR) ) |
2264 | { | 2264 | { // "/tmp" |
2265 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2265 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2266 | pos = searchStart; | 2266 | d = QDir::home(); |
2267 | else | 2267 | d.mkdir(APPDIR); |
2268 | pos = start; | 2268 | d.cd(APPDIR); |
2269 | findClose(); | 2269 | } |
2270 | pbar->hide(); | 2270 | fi.setFile(d, INIFILE); |
2271 | reader->locate(pos); | 2271 | Config config( fi.absFilePath() ); |
2272 | return false; | 2272 | #endif |
2273 | } | 2273 | if (isChanged) addtoolbars(&config); |
2274 | } | 2274 | } |
2275 | // odebug << "Found it at " << pos << ":" << offset << "" << oendl; | 2275 | else |
2276 | pbar->hide(); | 2276 | { |
2277 | // odebug << "Hid" << oendl; | 2277 | delete prefwin; |
2278 | reader->locate(pos+offset); | 2278 | } |
2279 | // odebug << "Loacted" << oendl; | 2279 | } |
2280 | // odebug << "page up" << oendl; | 2280 | |
2281 | ret = true; | 2281 | void QTReaderApp::showinfo() |
2282 | } | 2282 | { |
2283 | else | 2283 | unsigned long ds, fs, ts, pl, dl; |
2284 | { | 2284 | if (reader->empty()) |
2285 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2285 | { |
2286 | pos = searchStart; | 2286 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2287 | else | 2287 | } |
2288 | pos = start; | 2288 | else |
2289 | ret = false; | 2289 | { |
2290 | findClose(); | 2290 | reader->sizes(fs,ts); |
2291 | } | 2291 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); |
2292 | return ret; | 2292 | pl = reader->pagelocate(); |
2293 | } | 2293 | dl = pl - reader->buffdoc.startSection(); |
2294 | 2294 | m_infoWin->setFileSize(fs); | |
2295 | #ifdef __ISEARCH | 2295 | m_infoWin->setTextSize(ts); |
2296 | void QTReaderApp::search(const QString & arg) | 2296 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); |
2297 | { | 2297 | m_infoWin->setLocation(pl); |
2298 | searchrecord* ss = searchStack->top(); | 2298 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); |
2299 | CBuffer test; | 2299 | m_infoWin->setDocSize(ds); |
2300 | size_t start = reader->pagelocate(); | 2300 | m_infoWin->setDocLocation(dl); |
2301 | bool haspopped = false; | 2301 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); |
2302 | while (arg.left(ss->s.length()) != ss->s) | 2302 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); |
2303 | { | 2303 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); |
2304 | haspopped = true; | 2304 | editorStack->raiseWidget( m_infoWin ); |
2305 | start = ss->pos; | 2305 | hidetoolbars(); |
2306 | // reader->locate(start); | 2306 | m_infoWin->setFocus(); |
2307 | searchStack->pop(); | 2307 | } |
2308 | delete ss; | 2308 | } |
2309 | } | 2309 | |
2310 | if (haspopped) reader->locate(start); | 2310 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2) |
2311 | /* | 2311 | { |
2312 | if (arg.length() < ss->len) | 2312 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
2313 | { | 2313 | #ifdef _UNICODE |
2314 | start = ss->pos; | 2314 | CBuffer buff(name.length()+1); |
2315 | reader->locate(start); | 2315 | int i; |
2316 | searchStack->pop(); | 2316 | for (i = 0; i < name.length(); i++) |
2317 | delete ss; | 2317 | { |
2318 | } | 2318 | buff[i] = name[i].unicode(); |
2319 | */ | 2319 | } |
2320 | else | 2320 | buff[i] = 0; |
2321 | { | 2321 | CBuffer buff2(text.length()+1); |
2322 | start = reader->pagelocate(); | 2322 | for (i = 0; i < text.length(); i++) |
2323 | reader->jumpto(start); | 2323 | { |
2324 | searchStack->push(new searchrecord(arg,start)); | 2324 | buff2[i] = text[i].unicode(); |
2325 | } | 2325 | } |
2326 | dosearch(start, test, arg); | 2326 | buff2[i] = 0; |
2327 | } | 2327 | Bkmk b(buff.data(), buff2.data(), posn, posn2); |
2328 | #else | 2328 | QColor c = m_annoWin->getColor(); |
2329 | void QTReaderApp::search() | 2329 | int red,green,blue; |
2330 | { | 2330 | c.rgb(&red, &green, &blue); |
2331 | findNext(); | 2331 | b.red(red); |
2332 | } | 2332 | b.green(green); |
2333 | #endif | 2333 | b.blue(blue); |
2334 | 2334 | pBkmklist->push_front(b); | |
2335 | void QTReaderApp::openFile( const QString &f ) | 2335 | #else |
2336 | { | 2336 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); |
2337 | // odebug << "File:" << f << "" << oendl; | 2337 | #endif |
2338 | // openFile(DocLnk(f)); | 2338 | m_fBkmksChanged = true; |
2339 | //} | 2339 | pBkmklist->sort(); |
2340 | // | 2340 | } |
2341 | //void QTReaderApp::openFile( const DocLnk &f ) | 2341 | |
2342 | //{ | 2342 | void QTReaderApp::addAnno(const QString& name, const QString& text) |
2343 | clear(); | 2343 | { |
2344 | QFileInfo fm(f); | 2344 | if (m_annoIsEditing) |
2345 | if ( fm.exists() ) | 2345 | { |
2346 | { | 2346 | if (name.isEmpty()) |
2347 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 2347 | { |
2348 | #ifdef USEQPE | 2348 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); |
2349 | if (fm.extension( FALSE ) == "desktop") | 2349 | } |
2350 | { | 2350 | else |
2351 | DocLnk d(f); | 2351 | { |
2352 | QFileInfo fnew(d.file()); | 2352 | addAnno(name, text, m_annoWin->getPosn(), m_annoWin->getPosn2()); |
2353 | fm = fnew; | 2353 | } |
2354 | if (!fm.exists()) return; | 2354 | showEditTools(); |
2355 | } | 2355 | } |
2356 | #endif | 2356 | else |
2357 | clear(); | 2357 | { |
2358 | 2358 | if (m_annoWin->edited()) | |
2359 | reader->setText(fm.baseName(), fm.absFilePath()); | 2359 | { |
2360 | m_loadedconfig = readconfig(reader->m_string, false); | 2360 | CBuffer buff(text.length()+1); |
2361 | showEditTools(); | 2361 | int i; |
2362 | readbkmks(); | 2362 | for (i = 0; i < text.length(); i++) |
2363 | m_savedpos = 0xffffffff; | 2363 | { |
2364 | } | 2364 | buff[i] = text[i].unicode(); |
2365 | else | 2365 | } |
2366 | { | 2366 | buff[i] = 0; |
2367 | QMessageBox::information(this, PROGNAME, "File does not exist"); | 2367 | m_fBkmksChanged = true; |
2368 | reader->m_lastfile = QString::null; | 2368 | m_anno->setAnno(buff.data()); |
2369 | } | 2369 | } |
2370 | 2370 | QColor c = m_annoWin->getColor(); | |
2371 | } | 2371 | int red,green,blue; |
2372 | /* | 2372 | c.rgb(&red, &green, &blue); |
2373 | void QTReaderApp::resizeEvent(QResizeEvent* e) | 2373 | m_anno->red(red); |
2374 | { | 2374 | m_anno->green(green); |
2375 | if (m_fullscreen) | 2375 | m_anno->blue(blue); |
2376 | { | 2376 | bool found = findNextBookmark(m_anno->value()+1); |
2377 | showNormal(); | 2377 | if (found) |
2378 | showFullScreen(); | 2378 | { |
2379 | } | 2379 | m_annoWin->setName(toQString(m_anno->name())); |
2380 | } | 2380 | m_annoWin->setAnno(toQString(m_anno->anno())); |
2381 | */ | 2381 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
2382 | void QTReaderApp::handlekey(QKeyEvent* e) | 2382 | } |
2383 | { | 2383 | else |
2384 | // odebug << "Keypress event" << oendl; | 2384 | { |
2385 | timeb now; | 2385 | showEditTools(); |
2386 | ftime(&now); | 2386 | } |
2387 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; | 2387 | } |
2388 | if (etime < m_debounce) | 2388 | } |
2389 | { | 2389 | |
2390 | return; | 2390 | bool QTReaderApp::findNextBookmark(size_t start) |
2391 | } | 2391 | { |
2392 | m_lastkeytime = now; | 2392 | bool found = false; |
2393 | switch(e->key()) | 2393 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) |
2394 | { | 2394 | { |
2395 | case Key_Escape: | 2395 | if (iter->value() >= start) |
2396 | // odebug << "escape event" << oendl; | 2396 | { |
2397 | if (m_disableesckey) | 2397 | if (iter->value() < reader->locate()) |
2398 | { | 2398 | { |
2399 | m_disableesckey = false; | 2399 | found = true; |
2400 | } | 2400 | m_anno = iter.pContent(); |
2401 | else | 2401 | } |
2402 | { | 2402 | break; |
2403 | m_bcloseDisabled = true; | 2403 | } |
2404 | if (m_fullscreen) | 2404 | } |
2405 | { | 2405 | return found; |
2406 | m_actFullscreen->setOn(false); | 2406 | } |
2407 | e->accept(); | 2407 | |
2408 | } | 2408 | void QTReaderApp::addanno() |
2409 | else | 2409 | { |
2410 | { | 2410 | if (reader->empty()) |
2411 | // odebug << "escape action" << oendl; | 2411 | { |
2412 | doAction(m_escapeTarget, e); | 2412 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2413 | } | 2413 | } |
2414 | } | 2414 | else |
2415 | break; | 2415 | { |
2416 | case Key_Space: | 2416 | m_annoWin->setName(""); |
2417 | { | 2417 | m_annoWin->setAnno(""); |
2418 | doAction(m_spaceTarget, e); | 2418 | m_annoWin->setPosn(reader->pagelocate()); |
2419 | } | 2419 | m_annoIsEditing = true; |
2420 | break; | 2420 | editorStack->raiseWidget( m_annoWin ); |
2421 | case Key_Return: | 2421 | hidetoolbars(); |
2422 | { | 2422 | #ifdef USEQPE |
2423 | doAction(m_returnTarget, e); | 2423 | Global::showInputMethod(); |
2424 | } | 2424 | #endif |
2425 | break; | 2425 | m_annoWin->setFocus(); |
2426 | case Key_Left: | 2426 | } |
2427 | { | 2427 | } |
2428 | if (reader->m_autoScroll && m_leftScroll) | 2428 | |
2429 | { | 2429 | void QTReaderApp::infoClose() |
2430 | reader->reduceScroll(); | 2430 | { |
2431 | } | 2431 | m_debounce = m_buttonprefs->Debounce(); |
2432 | else | 2432 | if (m_kmapchanged) |
2433 | { | 2433 | { |
2434 | doAction(m_leftTarget, e); | 2434 | m_kmapchanged = false; |
2435 | } | 2435 | #ifndef USEQPE |
2436 | } | 2436 | QDir d = QDir::home(); // "/" |
2437 | break; | 2437 | d.cd(APPDIR); |
2438 | case Key_Right: | 2438 | QFileInfo fi(d, ".keymap"); |
2439 | { | 2439 | FILE* f = fopen((const char *)fi.absFilePath(), "w"); |
2440 | if (reader->m_autoScroll && m_rightScroll) | 2440 | #else /* USEQPE */ |
2441 | { | 2441 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "w"); |
2442 | reader->increaseScroll(); | 2442 | #endif /* USEQPE */ |
2443 | } | 2443 | if (f != NULL) |
2444 | else | 2444 | { |
2445 | { | 2445 | uint cnt = KEYMAPVERSION; |
2446 | doAction(m_rightTarget, e); | 2446 | fwrite(&cnt, sizeof(cnt), 1, f); |
2447 | } | 2447 | cnt = kmap.count(); |
2448 | } | 2448 | fwrite(&cnt, sizeof(cnt), 1, f); |
2449 | break; | 2449 | for (QMap<orKey,int>::Iterator i = kmap.begin(); i != kmap.end(); i++) |
2450 | case Key_Up: | 2450 | { |
2451 | { | 2451 | orKey key = i.key(); |
2452 | if (reader->m_autoScroll && m_upScroll) | 2452 | int data = i.data(); |
2453 | { | 2453 | fwrite(&key, sizeof(key), 1, f); |
2454 | reader->increaseScroll(); | 2454 | fwrite(&data, sizeof(data), 1, f); |
2455 | } | 2455 | qDebug("Saved %s as %u", (const char*)key.text(), data); |
2456 | else | 2456 | } |
2457 | { | 2457 | fclose(f); |
2458 | doAction(m_upTarget, e); | 2458 | } |
2459 | } | 2459 | } |
2460 | } | 2460 | showEditTools(); |
2461 | break; | 2461 | } |
2462 | case Key_Down: | 2462 | |
2463 | { | 2463 | /* |
2464 | if (reader->m_autoScroll && m_downScroll) | 2464 | void QTReaderApp::fileRevert() |
2465 | { | 2465 | { |
2466 | reader->reduceScroll(); | 2466 | clear(); |
2467 | } | 2467 | fileOpen(); |
2468 | else | 2468 | } |
2469 | { | 2469 | |
2470 | doAction(m_downTarget, e); | 2470 | void QTReaderApp::editCut() |
2471 | } | 2471 | { |
2472 | } | 2472 | #ifndef QT_NO_CLIPBOARD |
2473 | break; | 2473 | editor->cut(); |
2474 | default: | 2474 | #endif |
2475 | { | 2475 | } |
2476 | e->ignore(); | 2476 | */ |
2477 | } | 2477 | void QTReaderApp::editMark() |
2478 | 2478 | { | |
2479 | /* | 2479 | m_savedpos = reader->pagelocate(); |
2480 | QString msg("Key press was:"); | 2480 | } |
2481 | QString key; | 2481 | |
2482 | msg += key.setNum(e->key()); | 2482 | void QTReaderApp::editCopy() |
2483 | QMessageBox::information(this, PROGNAME, msg); | 2483 | { |
2484 | */ | 2484 | QClipboard* cb = QApplication::clipboard(); |
2485 | } | 2485 | QString text; |
2486 | } | 2486 | int ch; |
2487 | 2487 | unsigned long currentpos = reader->pagelocate(); | |
2488 | void QTReaderApp::showEditTools() | 2488 | unsigned long endpos = reader->locate(); |
2489 | { | 2489 | if (m_savedpos == 0xffffffff) |
2490 | // if ( !doc ) | 2490 | { |
2491 | // close(); | 2491 | m_savedpos = currentpos; |
2492 | if (m_fullscreen) | 2492 | } |
2493 | { | 2493 | reader->jumpto(m_savedpos); |
2494 | if (menubar != NULL) menubar->hide(); | 2494 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) |
2495 | if (fileBar != NULL) fileBar->hide(); | 2495 | { |
2496 | if (viewBar != NULL) viewBar->hide(); | 2496 | text += ch; |
2497 | if (navBar != NULL) navBar->hide(); | 2497 | } |
2498 | if (markBar != NULL) markBar->hide(); | 2498 | cb->setText(text); |
2499 | searchBar->hide(); | 2499 | reader->locate(currentpos); |
2500 | regBar->hide(); | 2500 | m_savedpos = 0xffffffff; |
2501 | #ifdef USEQPE | 2501 | } |
2502 | Global::hideInputMethod(); | 2502 | |
2503 | #endif | 2503 | void QTReaderApp::gotoStart() |
2504 | m_fontBar->hide(); | 2504 | { |
2505 | // showNormal(); | 2505 | reader->locate(reader->buffdoc.startSection()); |
2506 | showFullScreen(); | 2506 | } |
2507 | } | 2507 | |
2508 | else | 2508 | void QTReaderApp::gotoEnd() |
2509 | { | 2509 | { |
2510 | // odebug << "him" << oendl; | 2510 | reader->dopageup(reader->buffdoc.endSection()); |
2511 | #ifdef USEQPE | 2511 | } |
2512 | Global::hideInputMethod(); | 2512 | |
2513 | #endif | 2513 | void QTReaderApp::pageup() |
2514 | // odebug << "eb" << oendl; | 2514 | { |
2515 | menubar->show(); | 2515 | reader->NavUp(); |
2516 | if (fileBar != NULL) fileBar->show(); | 2516 | } |
2517 | if (viewBar != NULL) viewBar->show(); | 2517 | |
2518 | if (navBar != NULL) navBar->show(); | 2518 | void QTReaderApp::pagedn() |
2519 | if (markBar != NULL) markBar->show(); | 2519 | { |
2520 | mb->show(); | 2520 | reader->NavDown(); |
2521 | if ( searchVisible ) | 2521 | } |
2522 | { | 2522 | |
2523 | #ifdef USEQPE | 2523 | void QTReaderApp::pagemode(bool _b) |
2524 | Global::showInputMethod(); | 2524 | { |
2525 | #endif | 2525 | reader->setpagemode(_b); |
2526 | searchBar->show(); | 2526 | } |
2527 | } | 2527 | |
2528 | if ( regVisible ) | 2528 | /* |
2529 | { | 2529 | void QTReaderApp::setspacing() |
2530 | #ifdef USEQPE | 2530 | { |
2531 | Global::showInputMethod(); | 2531 | m_nRegAction = cMonoSpace; |
2532 | #endif | 2532 | char lcn[20]; |
2533 | regBar->show(); | 2533 | sprintf(lcn, "%lu", reader->m_charpc); |
2534 | } | 2534 | regEdit->setText(lcn); |
2535 | if (m_fontVisible) m_fontBar->show(); | 2535 | do_regedit(); |
2536 | // odebug << "sn" << oendl; | 2536 | } |
2537 | showNormal(); | 2537 | */ |
2538 | // odebug << "sm" << oendl; | 2538 | void QTReaderApp::settarget() |
2539 | #ifdef USEQPE | 2539 | { |
2540 | showMaximized(); | 2540 | m_nRegAction = cSetTarget; |
2541 | #endif | 2541 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) |
2542 | // setCentralWidget(reader); | 2542 | + "/" |
2543 | } | 2543 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); |
2544 | 2544 | regEdit->setText(text); | |
2545 | // odebug << "uc" << oendl; | 2545 | do_regedit(); |
2546 | updateCaption(); | 2546 | } |
2547 | // odebug << "rw" << oendl; | 2547 | |
2548 | editorStack->raiseWidget( reader ); | 2548 | /* |
2549 | // odebug << "sf" << oendl; | 2549 | void QTReaderApp::do_mono(const QString& lcn) |
2550 | reader->setFocus(); | 2550 | { |
2551 | reader->refresh(); | 2551 | bool ok; |
2552 | } | 2552 | unsigned long ulcn = lcn.toULong(&ok); |
2553 | /* | 2553 | if (ok) |
2554 | void QTReaderApp::save() | 2554 | { |
2555 | { | 2555 | reader->m_charpc = ulcn; |
2556 | if ( !doc ) | 2556 | reader->setfont(); |
2557 | return; | 2557 | reader->refresh(); |
2558 | if ( !editor->edited() ) | 2558 | //reader->setmono(true); |
2559 | return; | 2559 | } |
2560 | 2560 | else | |
2561 | QString rt = editor->text(); | 2561 | QMessageBox::information(this, PROGNAME, "Must be a number"); |
2562 | QString pt = rt; | 2562 | } |
2563 | 2563 | */ | |
2564 | if ( doc->name().isEmpty() ) { | 2564 | /* |
2565 | unsigned ispace = pt.find( ' ' ); | 2565 | void QTReaderApp::editPaste() |
2566 | unsigned ienter = pt.find( '\n' ); | 2566 | { |
2567 | int i = (ispace < ienter) ? ispace : ienter; | 2567 | #ifndef QT_NO_CLIPBOARD |
2568 | QString docname; | 2568 | editor->paste(); |
2569 | if ( i == -1 ) { | 2569 | #endif |
2570 | if ( pt.isEmpty() ) | 2570 | } |
2571 | docname = "Empty Text"; | 2571 | */ |
2572 | else | 2572 | |
2573 | docname = pt; | 2573 | void QTReaderApp::editFind() |
2574 | } else { | 2574 | { |
2575 | docname = pt.left( i ); | 2575 | searchStart = reader->pagelocate(); |
2576 | } | 2576 | #ifdef __ISEARCH |
2577 | doc->setName(docname); | 2577 | searchStack = new QStack<searchrecord>; |
2578 | } | 2578 | #endif |
2579 | FileManager fm; | 2579 | #ifdef USEQPE |
2580 | fm.saveFile( *doc, rt ); | 2580 | Global::showInputMethod(); |
2581 | } | 2581 | #endif |
2582 | */ | 2582 | searchBar->show(); |
2583 | 2583 | searchVisible = TRUE; | |
2584 | void QTReaderApp::clear() | 2584 | searchEdit->setFocus(); |
2585 | { | 2585 | #ifdef __ISEARCH |
2586 | // if (doc != 0) | 2586 | searchStack->push(new searchrecord("",reader->pagelocate())); |
2587 | // { | 2587 | #endif |
2588 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); | 2588 | } |
2589 | // delete doc; | 2589 | |
2590 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); | 2590 | void QTReaderApp::findNext() |
2591 | // doc = 0; | 2591 | { |
2592 | // } | 2592 | // // qDebug("findNext called\n"); |
2593 | reader->clear(); | 2593 | #ifdef __ISEARCH |
2594 | } | 2594 | QString arg = searchEdit->text(); |
2595 | 2595 | #else | |
2596 | void QTReaderApp::updateCaption() | 2596 | QRegExp arg = searchEdit->text(); |
2597 | { | 2597 | #endif |
2598 | // if ( !doc ) | 2598 | CDrawBuffer test(&(reader->m_fontControl)); |
2599 | // setCaption( tr("QTReader") ); | 2599 | size_t start = reader->pagelocate(); |
2600 | // else { | 2600 | reader->jumpto(start); |
2601 | // QString s = doc->name(); | 2601 | reader->getline(&test); |
2602 | // if ( s.isEmpty() ) | 2602 | dosearch(start, test, arg); |
2603 | // s = tr( "Unnamed" ); | 2603 | } |
2604 | setCaption( reader->m_string + " - " + tr("Reader") ); | 2604 | |
2605 | // } | 2605 | void QTReaderApp::findClose() |
2606 | } | 2606 | { |
2607 | 2607 | searchVisible = FALSE; | |
2608 | void QTReaderApp::setDocument(const QString& fileref) | 2608 | searchEdit->setText(""); |
2609 | { | 2609 | #ifdef USEQPE |
2610 | bFromDocView = TRUE; | 2610 | Global::hideInputMethod(); |
2611 | //QMessageBox::information(0, "setDocument", fileref); | 2611 | #endif |
2612 | openFile(fileref); | 2612 | searchBar->hide(); |
2613 | // showEditTools(); | 2613 | #ifdef __ISEARCH |
2614 | } | 2614 | // searchStack = new QStack<searchrecord>; |
2615 | 2615 | while (!searchStack->isEmpty()) | |
2616 | void QTReaderApp::closeEvent( QCloseEvent *e ) | 2616 | { |
2617 | { | 2617 | delete searchStack->pop(); |
2618 | // odebug << "Close event" << oendl; | 2618 | } |
2619 | if (m_fullscreen) | 2619 | delete searchStack; |
2620 | { | 2620 | #endif |
2621 | m_fullscreen = false; | 2621 | reader->setFocus(); |
2622 | showEditTools(); | 2622 | } |
2623 | e->accept(); | 2623 | |
2624 | } | 2624 | void QTReaderApp::regClose() |
2625 | else if (m_dontSave) | 2625 | { |
2626 | { | 2626 | regVisible = FALSE; |
2627 | e->accept(); | 2627 | regEdit->setText(""); |
2628 | } | 2628 | regBar->hide(); |
2629 | else | 2629 | #ifdef USEQPE |
2630 | { | 2630 | Global::hideInputMethod(); |
2631 | if (editorStack->visibleWidget() == reader) | 2631 | #endif |
2632 | { | 2632 | reader->setFocus(); |
2633 | if ((m_escapeTarget != cesNone) && m_bcloseDisabled) | 2633 | } |
2634 | { | 2634 | |
2635 | // odebug << "Close disabled" << oendl; | 2635 | #ifdef __ISEARCH |
2636 | m_bcloseDisabled = false; | 2636 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) |
2637 | e->ignore(); | 2637 | #else |
2638 | } | 2638 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) |
2639 | else | 2639 | #endif |
2640 | { | 2640 | { |
2641 | if (m_fontVisible) | 2641 | bool ret = true; |
2642 | { | 2642 | unsigned long fs, ts; |
2643 | m_fontBar->hide(); | 2643 | reader->sizes(fs,ts); |
2644 | m_fontVisible = false; | 2644 | size_t pos = reader->locate(); |
2645 | } | 2645 | pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); |
2646 | if (regVisible) | 2646 | pbar->show(); |
2647 | { | 2647 | pbar->raise(); |
2648 | regBar->hide(); | 2648 | pbar->reset(); |
2649 | #ifdef USEQPE | 2649 | int offset; |
2650 | Global::hideInputMethod(); | 2650 | int lastpc = (100*pos)/ts; |
2651 | #endif | 2651 | pbar->setProgress(lastpc); |
2652 | regVisible = false; | 2652 | // qApp->processEvents(); |
2653 | return; | 2653 | if (reader->buffdoc.getpara(test) >= 0) |
2654 | } | 2654 | { |
2655 | if (searchVisible) | 2655 | reader->setFocus(); |
2656 | { | 2656 | #ifdef __ISEARCH |
2657 | searchBar->hide(); | 2657 | while (strstr(test.data(),(const tchar*)arg) == NULL) |
2658 | #ifdef USEQPE | 2658 | #else |
2659 | Global::hideInputMethod(); | 2659 | #ifdef _UNICODE |
2660 | #endif | 2660 | while ((offset = arg.match(toQString(test.data()))) == -1) |
2661 | searchVisible = false; | 2661 | #else |
2662 | return; | 2662 | while (arg.match(test.data()) == -1) |
2663 | } | 2663 | #endif |
2664 | if (m_fBkmksChanged && pBkmklist != NULL) | 2664 | #endif |
2665 | { | 2665 | { |
2666 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 2666 | pos = reader->locate(); |
2667 | savebkmks(); | 2667 | int pc = (100*pos)/ts; |
2668 | delete pBkmklist; | 2668 | if (pc != lastpc) |
2669 | pBkmklist = NULL; | 2669 | { |
2670 | m_fBkmksChanged = false; | 2670 | pbar->setProgress(pc); |
2671 | } | 2671 | qApp->processEvents(); |
2672 | bFromDocView = FALSE; | 2672 | reader->setFocus(); |
2673 | updatefileinfo(); | 2673 | lastpc = pc; |
2674 | saveprefs(); | 2674 | } |
2675 | e->accept(); | 2675 | |
2676 | } | 2676 | if (reader->buffdoc.getpara(test) < 0) |
2677 | } | 2677 | { |
2678 | else | 2678 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2679 | { | 2679 | pos = searchStart; |
2680 | showEditTools(); | 2680 | else |
2681 | m_disableesckey = true; | 2681 | pos = start; |
2682 | } | 2682 | findClose(); |
2683 | } | 2683 | pbar->hide(); |
2684 | } | 2684 | reader->locate(pos); |
2685 | 2685 | return false; | |
2686 | void QTReaderApp::do_gotomark() | 2686 | } |
2687 | { | 2687 | } |
2688 | m_nBkmkAction = cGotoBkmk; | 2688 | // qDebug("Found it at %u:%u", pos, offset); |
2689 | if (!listbkmk(pBkmklist)) | 2689 | pbar->hide(); |
2690 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 2690 | // qDebug("Hid"); |
2691 | } | 2691 | reader->locate(pos+offset); |
2692 | 2692 | // qDebug("Loacted"); | |
2693 | void QTReaderApp::do_delmark() | 2693 | // qDebug("page up"); |
2694 | { | 2694 | ret = true; |
2695 | m_nBkmkAction = cDelBkmk; | 2695 | } |
2696 | if (!listbkmk(pBkmklist)) | 2696 | else |
2697 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 2697 | { |
2698 | } | 2698 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2699 | 2699 | pos = searchStart; | |
2700 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) | 2700 | else |
2701 | { | 2701 | pos = start; |
2702 | bkmkselector->clear(); | 2702 | ret = false; |
2703 | if (_lab.isEmpty()) | 2703 | findClose(); |
2704 | bkmkselector->setText("Cancel"); | 2704 | } |
2705 | else | 2705 | return ret; |
2706 | bkmkselector->setText(_lab); | 2706 | } |
2707 | int cnt = 0; | 2707 | |
2708 | if (plist != NULL) | 2708 | #ifdef __ISEARCH |
2709 | { | 2709 | void QTReaderApp::search(const QString & arg) |
2710 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 2710 | { |
2711 | { | 2711 | searchrecord* ss = searchStack->top(); |
2712 | #ifdef _UNICODE | 2712 | CBuffer test; |
2713 | // odebug << "Item:" << toQString(i->name()) << "" << oendl; | 2713 | size_t start = reader->pagelocate(); |
2714 | bkmkselector->insertItem(toQString(i->name())); | 2714 | bool haspopped = false; |
2715 | #else | 2715 | while (arg.left(ss->s.length()) != ss->s) |
2716 | bkmkselector->insertItem(i->name()); | 2716 | { |
2717 | #endif | 2717 | haspopped = true; |
2718 | cnt++; | 2718 | start = ss->pos; |
2719 | } | 2719 | // reader->locate(start); |
2720 | } | 2720 | searchStack->pop(); |
2721 | if (cnt > 0) | 2721 | delete ss; |
2722 | { | 2722 | } |
2723 | hidetoolbars(); | 2723 | if (haspopped) reader->locate(start); |
2724 | editorStack->raiseWidget( bkmkselector ); | 2724 | /* |
2725 | return true; | 2725 | if (arg.length() < ss->len) |
2726 | } | 2726 | { |
2727 | else | 2727 | start = ss->pos; |
2728 | return false; | 2728 | reader->locate(start); |
2729 | } | 2729 | searchStack->pop(); |
2730 | 2730 | delete ss; | |
2731 | void QTReaderApp::do_autogen() | 2731 | } |
2732 | { | 2732 | */ |
2733 | m_nRegAction = cAutoGen; | 2733 | else |
2734 | regEdit->setText(m_autogenstr); | 2734 | { |
2735 | do_regedit(); | 2735 | start = reader->pagelocate(); |
2736 | } | 2736 | reader->jumpto(start); |
2737 | 2737 | searchStack->push(new searchrecord(arg,start)); | |
2738 | void QTReaderApp::do_regedit() | 2738 | } |
2739 | { | 2739 | dosearch(start, test, arg); |
2740 | // fileBar->hide(); | 2740 | } |
2741 | reader->bDoUpdates = false; | 2741 | #else |
2742 | // odebug << "Showing regbar" << oendl; | 2742 | void QTReaderApp::search() |
2743 | regBar->show(); | 2743 | { |
2744 | // odebug << "Showing kbd" << oendl; | 2744 | findNext(); |
2745 | #ifdef USEQPE | 2745 | } |
2746 | Global::showInputMethod(); | 2746 | #endif |
2747 | #endif | 2747 | |
2748 | regVisible = true; | 2748 | void QTReaderApp::openFile( const QString &f ) |
2749 | regEdit->setFocus(); | 2749 | { |
2750 | // qApp->processEvents(); | 2750 | // qDebug("File:%s", (const char*)f); |
2751 | reader->bDoUpdates = true; | 2751 | // openFile(DocLnk(f)); |
2752 | reader->update(); | 2752 | //} |
2753 | } | 2753 | // |
2754 | 2754 | //void QTReaderApp::openFile( const DocLnk &f ) | |
2755 | bool QTReaderApp::openfrombkmk(Bkmk* bk) | 2755 | //{ |
2756 | { | 2756 | clear(); |
2757 | QString fn = toQString( | 2757 | QFileInfo fm(f); |
2758 | CFiledata(bk->anno()).name() | 2758 | if ( fm.exists() ) |
2759 | ); | 2759 | { |
2760 | // odebug << "fileinfo" << oendl; | 2760 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
2761 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 2761 | #ifdef USEQPE |
2762 | { | 2762 | if (fm.extension( FALSE ) == "desktop") |
2763 | // odebug << "Opening" << oendl; | 2763 | { |
2764 | openFile(fn); | 2764 | DocLnk d(f); |
2765 | struct stat fnstat; | 2765 | QFileInfo fnew(d.file()); |
2766 | stat((const char *)reader->m_lastfile, &fnstat); | 2766 | fm = fnew; |
2767 | 2767 | if (!fm.exists()) return; | |
2768 | if (CFiledata(bk->anno()).date() | 2768 | } |
2769 | != fnstat.st_mtime) | 2769 | #endif |
2770 | { | 2770 | clear(); |
2771 | CFiledata fd(bk->anno()); | 2771 | reader->setText(fm.baseName(), fm.absFilePath()); |
2772 | fd.setdate(fnstat.st_mtime); | 2772 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); |
2773 | bk->value(0); | 2773 | qDebug("Showing tools"); |
2774 | } | 2774 | showEditTools(); |
2775 | else | 2775 | qDebug("Shown tools"); |
2776 | { | 2776 | readbkmks(); |
2777 | unsigned short svlen = bk->filedatalen(); | 2777 | qDebug("read markss"); |
2778 | unsigned char* svdata = bk->filedata(); | 2778 | m_savedpos = 0xffffffff; |
2779 | reader->putSaveData(svdata, svlen); | 2779 | } |
2780 | // setstate(svdata, svlen); | 2780 | else |
2781 | if (svlen != 0) | 2781 | { |
2782 | { | 2782 | QString msg = f; |
2783 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | 2783 | msg += "\nFile does not exist"; |
2784 | } | 2784 | QMessageBox::information(this, PROGNAME, msg); |
2785 | // odebug << "updating" << oendl; | 2785 | reader->m_lastfile = QString::null; |
2786 | // showEditTools(); | 2786 | } |
2787 | reader->locate(bk->value()); | 2787 | |
2788 | } | 2788 | } |
2789 | return true; | 2789 | /* |
2790 | } | 2790 | void QTReaderApp::resizeEvent(QResizeEvent* e) |
2791 | else | 2791 | { |
2792 | { | 2792 | if (m_fullscreen) |
2793 | return false; | 2793 | { |
2794 | } | 2794 | showNormal(); |
2795 | } | 2795 | showFullScreen(); |
2796 | 2796 | } | |
2797 | void QTReaderApp::gotobkmk(int ind) | 2797 | } |
2798 | { | 2798 | */ |
2799 | showEditTools(); | 2799 | void QTReaderApp::handlekey(QKeyEvent* e) |
2800 | switch (m_nBkmkAction) | 2800 | { |
2801 | { | 2801 | // qDebug("Keypress event"); |
2802 | case cOpenFile: | 2802 | timeb now; |
2803 | { | 2803 | ftime(&now); |
2804 | // qApp->processEvents(); | 2804 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; |
2805 | if (!openfrombkmk((*pOpenlist)[ind])) | 2805 | if (etime < m_debounce) |
2806 | { | 2806 | { |
2807 | pOpenlist->erase(ind); | 2807 | return; |
2808 | QMessageBox::information(this, PROGNAME, "Can't find file"); | 2808 | } |
2809 | } | 2809 | switch(e->key()) |
2810 | } | 2810 | { |
2811 | break; | 2811 | case Key_Escape: |
2812 | case cGotoBkmk: | 2812 | // qDebug("escape event"); |
2813 | reader->locate((*pBkmklist)[ind]->value()); | 2813 | if (m_disableesckey) |
2814 | break; | 2814 | { |
2815 | case cDelBkmk: | 2815 | m_disableesckey = false; |
2816 | //// odebug << "Deleting:" << (*pBkmklist)[ind]->name() << "\n" << oendl; | 2816 | } |
2817 | pBkmklist->erase(ind); | 2817 | else |
2818 | m_fBkmksChanged = true; | 2818 | { |
2819 | // pBkmklist->sort(); | 2819 | m_bcloseDisabled = true; |
2820 | break; | 2820 | if (m_fullscreen) |
2821 | case cRmBkmkFile: | 2821 | { |
2822 | { | 2822 | m_actFullscreen->setOn(false); |
2823 | #ifndef USEQPE | 2823 | e->accept(); |
2824 | QDir d = QDir::home(); // "/" | 2824 | } |
2825 | d.cd(APPDIR); | 2825 | else |
2826 | d.remove(bkmkselector->text(ind)); | 2826 | { |
2827 | #else /* USEQPE */ | 2827 | // qDebug("escape action"); |
2828 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | 2828 | doAction(e); |
2829 | #endif /* USEQPE */ | 2829 | } |
2830 | } | 2830 | } |
2831 | break; | 2831 | break; |
2832 | case cLdConfig: | 2832 | /* |
2833 | readconfig(bkmkselector->text(ind), false); | 2833 | case Key_Left: |
2834 | break; | 2834 | { |
2835 | case cRmConfig: | 2835 | if (reader->m_autoScroll) |
2836 | { | 2836 | { |
2837 | #ifndef USEQPE | 2837 | reader->reduceScroll(); |
2838 | QDir d = QDir::home(); // "/" | 2838 | } |
2839 | d.cd(APPDIR "/configs"); | 2839 | else |
2840 | d.remove(bkmkselector->text(ind)); | 2840 | { |
2841 | #else /* USEQPE */ | 2841 | doAction(e); |
2842 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); | 2842 | } |
2843 | #endif /* USEQPE */ | 2843 | } |
2844 | } | 2844 | break; |
2845 | break; | 2845 | case Key_Right: |
2846 | case cExportLinks: | 2846 | { |
2847 | { | 2847 | if (reader->m_autoScroll) |
2848 | #ifndef USEQPE | 2848 | { |
2849 | QDir d = QDir::home(); // "/" | 2849 | reader->increaseScroll(); |
2850 | d.cd(APPDIR "/urls"); | 2850 | } |
2851 | QFileInfo fi(d, bkmkselector->text(ind)); | 2851 | else |
2852 | if (fi.exists()) | 2852 | { |
2853 | { | 2853 | doAction(e); |
2854 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); | 2854 | } |
2855 | if (!outfile.isEmpty()) | 2855 | } |
2856 | { | 2856 | break; |
2857 | FILE* fout = fopen((const char *)outfile, "w"); | 2857 | case Key_Up: |
2858 | if (fout != NULL) | 2858 | { |
2859 | { | 2859 | if (reader->m_autoScroll) |
2860 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); | 2860 | { |
2861 | if (fin != NULL) | 2861 | reader->increaseScroll(); |
2862 | { | 2862 | } |
2863 | fprintf(fout, "<html><body>\n"); | 2863 | else |
2864 | int ch = 0; | 2864 | { |
2865 | while ((ch = fgetc(fin)) != EOF) | 2865 | doAction(e); |
2866 | { | 2866 | } |
2867 | fputc(ch, fout); | 2867 | } |
2868 | } | 2868 | break; |
2869 | fclose(fin); | 2869 | case Key_Down: |
2870 | fprintf(fout, "</html></body>\n"); | 2870 | { |
2871 | d.remove(bkmkselector->text(ind)); | 2871 | if (reader->m_autoScroll) |
2872 | } | 2872 | { |
2873 | fclose(fout); | 2873 | reader->reduceScroll(); |
2874 | } | 2874 | } |
2875 | else | 2875 | else |
2876 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 2876 | { |
2877 | } | 2877 | doAction(e); |
2878 | } | 2878 | } |
2879 | #else /* USEQPE */ | 2879 | } |
2880 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 2880 | break; |
2881 | if (fin != NULL) | 2881 | */ |
2882 | { | 2882 | default: |
2883 | bool allok = false; | 2883 | { |
2884 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); | 2884 | doAction(e); |
2885 | if (fb->exec()) | 2885 | } |
2886 | { | 2886 | |
2887 | QString outfile = fb->getCurrentFile(); | 2887 | /* |
2888 | FILE* fout = fopen((const char *)outfile, "w"); | 2888 | QString msg("Key press was:"); |
2889 | if (fout != NULL) | 2889 | QString key; |
2890 | { | 2890 | msg += key.setNum(e->key()); |
2891 | fprintf(fout, "<html><body>\n"); | 2891 | QMessageBox::information(this, PROGNAME, msg); |
2892 | int ch = 0; | 2892 | */ |
2893 | while ((ch = fgetc(fin)) != EOF) | 2893 | } |
2894 | { | 2894 | ftime(&m_lastkeytime); |
2895 | fputc(ch, fout); | 2895 | } |
2896 | } | 2896 | |
2897 | fprintf(fout, "</html></body>\n"); | 2897 | #ifdef NEWFULLSCREEN |
2898 | fclose(fout); | 2898 | void QTReaderApp::enableFullscreen() |
2899 | allok = true; | 2899 | { |
2900 | } | 2900 | setFixedSize(qApp->desktop()->size()); |
2901 | else | 2901 | showNormal(); |
2902 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 2902 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
2903 | } | 2903 | showFullScreen(); |
2904 | delete fb; | 2904 | } |
2905 | fclose(fin); | 2905 | |
2906 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 2906 | void QTReaderApp::resizeEvent(QResizeEvent *) |
2907 | } | 2907 | { |
2908 | else | 2908 | if (m_fullscreen && (size() != qApp->desktop()->size())) |
2909 | { | 2909 | { |
2910 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); | 2910 | enableFullscreen(); |
2911 | } | 2911 | } |
2912 | 2912 | } | |
2913 | /* | 2913 | |
2914 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); | 2914 | void QTReaderApp::focusInEvent(QFocusEvent*) |
2915 | int ret = f->exec(); | 2915 | { |
2916 | odebug << "Return:" << ret << "" << oendl; | 2916 | if (m_fullscreen) |
2917 | DocLnk* doc = f->getDoc(); | 2917 | { |
2918 | if (doc != NULL) | 2918 | enableFullscreen(); |
2919 | { | 2919 | raise(); |
2920 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 2920 | } |
2921 | QString rt; | 2921 | } |
2922 | rt = "<html><body>\n"; | 2922 | #endif |
2923 | int ch = 0; | 2923 | |
2924 | while ((ch = fgetc(fin)) != EOF) | 2924 | void QTReaderApp::showEditTools() |
2925 | { | 2925 | { |
2926 | rt += (char)ch; | 2926 | // if ( !doc ) |
2927 | } | 2927 | //close(); |
2928 | fclose(fin); | 2928 | if (m_fullscreen) |
2929 | rt += "</html></body>\n"; | 2929 | { |
2930 | if ( doc->name().isEmpty() ) | 2930 | #ifdef USEQPE |
2931 | { | 2931 | if (menubar != NULL) menubar->hide(); |
2932 | doc->setName(bkmkselector->text(ind)); | 2932 | #endif |
2933 | } | 2933 | if (fileBar != NULL) fileBar->hide(); |
2934 | FileManager fm; | 2934 | if (viewBar != NULL) viewBar->hide(); |
2935 | fm.saveFile( *doc, rt ); | 2935 | if (navBar != NULL) navBar->hide(); |
2936 | odebug << "YES" << oendl; | 2936 | if (markBar != NULL) markBar->hide(); |
2937 | } | 2937 | if (m_prog != NULL) |
2938 | else | 2938 | { |
2939 | { | 2939 | // qDebug("Hiding status"); |
2940 | odebug << "NO" << oendl; | 2940 | m_prog->hide(); |
2941 | } | 2941 | } |
2942 | delete f; | 2942 | searchBar->hide(); |
2943 | */ | 2943 | regBar->hide(); |
2944 | 2944 | #ifdef USEQPE | |
2945 | #endif /* USEQPE */ | 2945 | Global::hideInputMethod(); |
2946 | } | 2946 | #endif |
2947 | break; | 2947 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
2948 | } | 2948 | m_fontBar->hide(); |
2949 | } | 2949 | //showNormal(); |
2950 | 2950 | #ifdef NEWFULLSCREEN | |
2951 | void QTReaderApp::cancelbkmk() | 2951 | enableFullscreen(); |
2952 | { | 2952 | #else |
2953 | if (m_nBkmkAction == cOpenFile) | 2953 | showFullScreen(); |
2954 | { | 2954 | #endif |
2955 | QString fn = usefilebrowser(); | 2955 | } |
2956 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); | 2956 | else |
2957 | } | 2957 | { |
2958 | showEditTools(); | 2958 | //qDebug("him"); |
2959 | } | 2959 | #ifdef USEQPE |
2960 | 2960 | Global::hideInputMethod(); | |
2961 | void QTReaderApp::jump() | 2961 | #endif |
2962 | { | 2962 | //qDebug("eb"); |
2963 | m_nRegAction = cJump; | 2963 | if (m_scrollbar != NULL) |
2964 | char lcn[20]; | 2964 | { |
2965 | sprintf(lcn, "%lu", reader->pagelocate()); | 2965 | if (m_scrollishidden) |
2966 | regEdit->setText(lcn); | 2966 | { |
2967 | do_regedit(); | 2967 | m_scrollbar->hide(); |
2968 | } | 2968 | } |
2969 | 2969 | else | |
2970 | void QTReaderApp::do_jump(const QString& lcn) | 2970 | { |
2971 | { | 2971 | m_scrollbar->show(); |
2972 | bool ok; | 2972 | } |
2973 | unsigned long ulcn = lcn.toULong(&ok); | 2973 | } |
2974 | if (ok) | 2974 | if (!m_hidebars) |
2975 | reader->locate(ulcn); | 2975 | { |
2976 | else | 2976 | #ifdef USEQPE |
2977 | QMessageBox::information(this, PROGNAME, "Must be a number"); | 2977 | menubar->show(); |
2978 | } | 2978 | #endif |
2979 | 2979 | if (fileBar != NULL) fileBar->show(); | |
2980 | void QTReaderApp::do_regaction() | 2980 | if (viewBar != NULL) viewBar->show(); |
2981 | { | 2981 | if (navBar != NULL) navBar->show(); |
2982 | reader->bDoUpdates = false; | 2982 | if (markBar != NULL) markBar->show(); |
2983 | regBar->hide(); | 2983 | if (m_prog != NULL && !m_statusishidden) |
2984 | #ifdef USEQPE | 2984 | { |
2985 | Global::hideInputMethod(); | 2985 | // qDebug("Showing status"); |
2986 | #endif | 2986 | m_prog->show(); |
2987 | regVisible = false; | 2987 | // qDebug("Shown status"); |
2988 | switch(m_nRegAction) | 2988 | } |
2989 | { | 2989 | // qDebug("Showing mb"); |
2990 | case cAutoGen: | 2990 | mb->show(); |
2991 | do_autogen(regEdit->text()); | 2991 | } |
2992 | break; | 2992 | if ( searchVisible ) |
2993 | case cAddBkmk: | 2993 | { |
2994 | do_addbkmk(regEdit->text()); | 2994 | #ifdef USEQPE |
2995 | break; | 2995 | Global::showInputMethod(); |
2996 | case cJump: | 2996 | #endif |
2997 | do_jump(regEdit->text()); | 2997 | searchBar->show(); |
2998 | break; | 2998 | } |
2999 | /* | 2999 | if ( regVisible ) |
3000 | case cMonoSpace: | 3000 | { |
3001 | do_mono(regEdit->text()); | 3001 | #ifdef USEQPE |
3002 | break; | 3002 | Global::showInputMethod(); |
3003 | */ | 3003 | #endif |
3004 | case cSetTarget: | 3004 | regBar->show(); |
3005 | do_settarget(regEdit->text()); | 3005 | } |
3006 | break; | 3006 | if (m_fontVisible) m_fontBar->show(); |
3007 | #ifdef _SCROLLPIPE | 3007 | //qDebug("sn"); |
3008 | case cSetPipeTarget: | 3008 | showNormal(); |
3009 | do_setpipetarget(regEdit->text()); | 3009 | //qDebug("sm"); |
3010 | break; | 3010 | #ifdef USEQPE |
3011 | #endif | 3011 | showMaximized(); |
3012 | case cSetConfigName: | 3012 | #endif |
3013 | // odebug << "Saving config" << oendl; | 3013 | //setCentralWidget(reader); |
3014 | do_saveconfig(regEdit->text(), false); | 3014 | } |
3015 | break; | 3015 | |
3016 | } | 3016 | // qDebug("uc"); |
3017 | // reader->restore(); | 3017 | updateCaption(); |
3018 | // fileBar->show(); | 3018 | // qDebug("rw"); |
3019 | reader->setFocus(); | 3019 | editorStack->raiseWidget( reader ); |
3020 | // qApp->processEvents(); | 3020 | // qDebug("sf"); |
3021 | reader->bDoUpdates = true; | 3021 | reader->setFocus(); |
3022 | reader->update(); | 3022 | // qDebug("ref"); |
3023 | } | 3023 | reader->refresh(true); |
3024 | 3024 | // qDebug("done"); | |
3025 | void QTReaderApp::do_settarget(const QString& _txt) | 3025 | } |
3026 | { | 3026 | /* |
3027 | int ind = _txt.find('/'); | 3027 | void QTReaderApp::save() |
3028 | if (ind == -1) | 3028 | { |
3029 | { | 3029 | if ( !doc ) |
3030 | m_targetapp = ""; | 3030 | return; |
3031 | m_targetmsg = ""; | 3031 | if ( !editor->edited() ) |
3032 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); | 3032 | return; |
3033 | } | 3033 | |
3034 | else | 3034 | QString rt = editor->text(); |
3035 | { | 3035 | QString pt = rt; |
3036 | m_targetapp = _txt.left(ind); | 3036 | |
3037 | m_targetmsg = _txt.right(_txt.length()-ind-1); | 3037 | if ( doc->name().isEmpty() ) { |
3038 | } | 3038 | unsigned ispace = pt.find( ' ' ); |
3039 | } | 3039 | unsigned ienter = pt.find( '\n' ); |
3040 | 3040 | int i = (ispace < ienter) ? ispace : ienter; | |
3041 | void QTReaderApp::chooseencoding() | 3041 | QString docname; |
3042 | { | 3042 | if ( i == -1 ) { |
3043 | m_fontSelector->clear(); | 3043 | if ( pt.isEmpty() ) |
3044 | m_fontSelector->insertItem("Ascii"); | 3044 | docname = "Empty Text"; |
3045 | m_fontSelector->insertItem("UTF-8"); | 3045 | else |
3046 | m_fontSelector->insertItem("UCS-2(BE)"); | 3046 | docname = pt; |
3047 | m_fontSelector->insertItem("USC-2(LE)"); | 3047 | } else { |
3048 | m_fontSelector->insertItem("Palm"); | 3048 | docname = pt.left( i ); |
3049 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) | 3049 | } |
3050 | { | 3050 | doc->setName(docname); |
3051 | m_fontSelector->insertItem(iter->mime); | 3051 | } |
3052 | } // delete the FontDatabase!!! | 3052 | FileManager fm; |
3053 | m_fontSelector->setCurrentItem (reader->m_encd); | 3053 | fm.saveFile( *doc, rt ); |
3054 | m_fontAction = cChooseEncoding; | 3054 | } |
3055 | m_fontBar->show(); | 3055 | */ |
3056 | m_fontVisible = true; | 3056 | |
3057 | } | 3057 | void QTReaderApp::clear() |
3058 | 3058 | { | |
3059 | void QTReaderApp::setfont() | 3059 | // if (doc != 0) |
3060 | { | 3060 | // { |
3061 | m_fontSelector->clear(); | 3061 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); |
3062 | { | 3062 | //delete doc; |
3063 | #ifdef USEQPE | 3063 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); |
3064 | FontDatabase f; | 3064 | //doc = 0; |
3065 | #else | 3065 | // } |
3066 | QFontDatabase f; | 3066 | reader->clear(); |
3067 | #endif | 3067 | } |
3068 | QStringList flist = f.families(); | 3068 | |
3069 | m_fontSelector->insertStringList(flist); | 3069 | void QTReaderApp::updateCaption() |
3070 | } // delete the FontDatabase!!! | 3070 | { |
3071 | 3071 | // if ( !doc ) | |
3072 | for (int i = 1; i <= m_fontSelector->count(); i++) | 3072 | //setCaption( tr("QTReader") ); |
3073 | { | 3073 | // else { |
3074 | if (m_fontSelector->text(i) == reader->m_fontname) | 3074 | //QString s = doc->name(); |
3075 | { | 3075 | //if ( s.isEmpty() ) |
3076 | m_fontSelector->setCurrentItem(i); | 3076 | // s = tr( "Unnamed" ); |
3077 | break; | 3077 | setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) ); |
3078 | } | 3078 | // } |
3079 | } | 3079 | } |
3080 | m_fontAction = cChooseFont; | 3080 | |
3081 | m_fontBar->show(); | 3081 | void QTReaderApp::setDocument(const QString& fileref) |
3082 | m_fontVisible = true; | 3082 | { |
3083 | } | 3083 | //QMessageBox::information(0, "setDocument", fileref); |
3084 | 3084 | openFile(fileref); | |
3085 | void QTReaderApp::setfontHelper(const QString& lcn, int size) | 3085 | // showEditTools(); |
3086 | { | 3086 | } |
3087 | if (size == 0) size = reader->m_fontControl.currentsize(); | 3087 | |
3088 | if (m_propogatefontchange) | 3088 | void QTReaderApp::closeEvent( QCloseEvent *e ) |
3089 | { | 3089 | { |
3090 | QFont f(lcn, 10); | 3090 | // qDebug("Close event"); |
3091 | bkmkselector->setFont( f ); | 3091 | if (m_fullscreen) |
3092 | regEdit->setFont( f ); | 3092 | { |
3093 | searchEdit->setFont( f ); | 3093 | m_fullscreen = false; |
3094 | m_annoWin->setFont( f ); | 3094 | showEditTools(); |
3095 | } | 3095 | e->ignore(); |
3096 | reader->m_fontname = lcn; | 3096 | } |
3097 | if (!reader->ChangeFont(size)) | 3097 | else if (editorStack->visibleWidget() == m_buttonprefs) |
3098 | { | 3098 | { |
3099 | reader->ChangeFont(size); | 3099 | m_buttonprefs->mapkey(Qt::NoButton, Key_Escape); |
3100 | } | 3100 | e->ignore(); |
3101 | } | 3101 | } |
3102 | 3102 | else if (m_dontSave) | |
3103 | void QTReaderApp::do_setencoding(int i) | 3103 | { |
3104 | { | 3104 | e->accept(); |
3105 | // odebug << "setencoding:" << i << "" << oendl; | 3105 | } |
3106 | if (m_fontAction == cChooseEncoding) | 3106 | else |
3107 | { | 3107 | { |
3108 | reader->setencoding(i); | 3108 | if (editorStack->visibleWidget() == reader) |
3109 | } | 3109 | { |
3110 | reader->refresh(); | 3110 | if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled) |
3111 | m_fontBar->hide(); | 3111 | { |
3112 | m_fontVisible = false; | 3112 | //qDebug("Close disabled"); |
3113 | // odebug << "showedit" << oendl; | 3113 | m_bcloseDisabled = false; |
3114 | if (reader->isVisible()) showEditTools(); | 3114 | e->ignore(); |
3115 | // odebug << "showeditdone" << oendl; | 3115 | } |
3116 | } | 3116 | else |
3117 | 3117 | { | |
3118 | void QTReaderApp::do_setfont(const QString& lcn) | 3118 | if (m_fontVisible) |
3119 | { | 3119 | { |
3120 | if (m_fontAction == cChooseFont) | 3120 | m_fontBar->hide(); |
3121 | { | 3121 | m_fontVisible = false; |
3122 | setfontHelper(lcn); | 3122 | e->ignore(); |
3123 | } | 3123 | return; |
3124 | reader->refresh(); | 3124 | } |
3125 | m_fontBar->hide(); | 3125 | if (regVisible) |
3126 | m_fontVisible = false; | 3126 | { |
3127 | // odebug << "showedit" << oendl; | 3127 | regBar->hide(); |
3128 | //if (reader->isVisible()) | 3128 | #ifdef USEQPE |
3129 | showEditTools(); | 3129 | Global::hideInputMethod(); |
3130 | // odebug << "showeditdone" << oendl; | 3130 | #endif |
3131 | } | 3131 | regVisible = false; |
3132 | 3132 | e->ignore(); | |
3133 | void QTReaderApp::do_autogen(const QString& regText) | 3133 | return; |
3134 | { | 3134 | } |
3135 | unsigned long fs, ts; | 3135 | if (searchVisible) |
3136 | reader->sizes(fs,ts); | 3136 | { |
3137 | // // odebug << "Reg:" << (const tchar*)(regEdit->text()) << "\n" << oendl; | 3137 | searchBar->hide(); |
3138 | m_autogenstr = regText; | 3138 | #ifdef USEQPE |
3139 | QRegExp re(regText); | 3139 | Global::hideInputMethod(); |
3140 | CBuffer buff; | 3140 | #endif |
3141 | if (pBkmklist != NULL) delete pBkmklist; | 3141 | searchVisible = false; |
3142 | pBkmklist = new CList<Bkmk>; | 3142 | e->ignore(); |
3143 | m_fBkmksChanged = true; | 3143 | return; |
3144 | 3144 | } | |
3145 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); | 3145 | if (m_fBkmksChanged && pBkmklist != NULL) |
3146 | pbar->show(); | 3146 | { |
3147 | pbar->raise(); | 3147 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
3148 | pbar->reset(); | 3148 | savebkmks(); |
3149 | reader->update(); | 3149 | delete pBkmklist; |
3150 | qApp->processEvents(); | 3150 | reader->pBkmklist = pBkmklist = NULL; |
3151 | reader->setFocus(); | 3151 | m_fBkmksChanged = false; |
3152 | reader->jumpto(0); | 3152 | } |
3153 | int lastpc = 0; | 3153 | updatefileinfo(); |
3154 | int i = 0; | 3154 | saveprefs(); |
3155 | while (i >= 0) | 3155 | e->accept(); |
3156 | { | 3156 | } |
3157 | unsigned int lcn = reader->locate(); | 3157 | } |
3158 | int pc = (100*lcn)/ts; | 3158 | else |
3159 | if (pc != lastpc) | 3159 | { |
3160 | { | 3160 | showEditTools(); |
3161 | pbar->setProgress(pc); | 3161 | m_disableesckey = true; |
3162 | qApp->processEvents(); | 3162 | } |
3163 | if (reader->locate() != lcn) reader->jumpto(lcn); | 3163 | } |
3164 | reader->setFocus(); | 3164 | } |
3165 | lastpc = pc; | 3165 | |
3166 | } | 3166 | void QTReaderApp::do_gotomark() |
3167 | i = reader->buffdoc.getpara(buff); | 3167 | { |
3168 | #ifdef _UNICODE | 3168 | m_nBkmkAction = cGotoBkmk; |
3169 | if (re.match(toQString(buff.data())) != -1) | 3169 | if (!listbkmk(pBkmklist)) |
3170 | #else | 3170 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3171 | if (re.match(buff.data()) != -1) | 3171 | } |
3172 | #endif | 3172 | |
3173 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3173 | void QTReaderApp::do_delmark() |
3174 | } | 3174 | { |
3175 | pBkmklist->sort(); | 3175 | m_nBkmkAction = cDelBkmk; |
3176 | pbar->setProgress(100); | 3176 | if (!listbkmk(pBkmklist)) |
3177 | qApp->processEvents(); | 3177 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3178 | pbar->hide(); | 3178 | } |
3179 | reader->refresh(); | 3179 | |
3180 | } | 3180 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) |
3181 | 3181 | { | |
3182 | void QTReaderApp::saveprefs() | 3182 | bkmkselector->clear(); |
3183 | { | 3183 | if (_lab.isEmpty()) |
3184 | // odebug << "saveprefs" << oendl; | 3184 | bkmkselector->setText("Cancel"); |
3185 | // reader->saveprefs("uqtreader"); | 3185 | else |
3186 | // if (!m_loadedconfig) | 3186 | bkmkselector->setText(_lab); |
3187 | do_saveconfig( APPDIR, true ); | 3187 | int cnt = 0; |
3188 | 3188 | if (plist != NULL) | |
3189 | /* | 3189 | { |
3190 | Config config( APPDIR ); | 3190 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
3191 | config.setGroup( "View" ); | 3191 | { |
3192 | 3192 | #ifdef _UNICODE | |
3193 | reader->m_lastposn = reader->pagelocate(); | 3193 | // qDebug("Item:%s", (const char*)toQString(i->name())); |
3194 | 3194 | bkmkselector->insertItem(toQString(i->name())); | |
3195 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 3195 | #else |
3196 | config.writeEntry( "StripCr", reader->bstripcr ); | 3196 | bkmkselector->insertItem(i->name()); |
3197 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 3197 | #endif |
3198 | config.writeEntry( "TextFmt", reader->btextfmt ); | 3198 | cnt++; |
3199 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 3199 | } |
3200 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 3200 | } |
3201 | config.writeEntry( "Depluck", reader->bdepluck ); | 3201 | if (cnt > 0) |
3202 | config.writeEntry( "Dejpluck", reader->bdejpluck ); | 3202 | { |
3203 | config.writeEntry( "OneSpace", reader->bonespace ); | 3203 | hidetoolbars(); |
3204 | config.writeEntry( "Unindent", reader->bunindent ); | 3204 | editorStack->raiseWidget( bkmkselector ); |
3205 | config.writeEntry( "Repara", reader->brepara ); | 3205 | return true; |
3206 | config.writeEntry( "DoubleSpace", reader->bdblspce ); | 3206 | } |
3207 | config.writeEntry( "Indent", reader->bindenter ); | 3207 | else |
3208 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); | 3208 | return false; |
3209 | config.writeEntry( "ScrollDelay", reader->m_delay); | 3209 | } |
3210 | config.writeEntry( "LastFile", reader->m_lastfile ); | 3210 | |
3211 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | 3211 | void QTReaderApp::do_autogen() |
3212 | config.writeEntry( "PageMode", reader->m_bpagemode ); | 3212 | { |
3213 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | 3213 | m_nRegAction = cAutoGen; |
3214 | config.writeEntry( "SwapMouse", reader->m_swapmouse); | 3214 | regEdit->setText(m_autogenstr); |
3215 | config.writeEntry( "Fontname", reader->m_fontname ); | 3215 | do_regedit(); |
3216 | config.writeEntry( "Encoding", reader->m_encd ); | 3216 | } |
3217 | config.writeEntry( "CharSpacing", reader->m_charpc ); | 3217 | |
3218 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); | 3218 | void QTReaderApp::do_regedit() |
3219 | config.writeEntry( "Margin", (int)reader->m_border ); | 3219 | { |
3220 | config.writeEntry( "TargetApp", m_targetapp ); | 3220 | // fileBar->hide(); |
3221 | config.writeEntry( "TargetMsg", m_targetmsg ); | 3221 | reader->bDoUpdates = false; |
3222 | #ifdef _SCROLLPIPE | 3222 | // qDebug("Showing regbar"); |
3223 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); | 3223 | regBar->show(); |
3224 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | 3224 | // qDebug("Showing kbd"); |
3225 | #endif | 3225 | #ifdef USEQPE |
3226 | config.writeEntry( "TwoTouch", m_twoTouch ); | 3226 | Global::showInputMethod(); |
3227 | config.writeEntry( "Annotation", m_doAnnotation); | 3227 | #endif |
3228 | config.writeEntry( "Dictionary", m_doDictionary); | 3228 | regVisible = true; |
3229 | config.writeEntry( "Clipboard", m_doClipboard); | 3229 | regEdit->setFocus(); |
3230 | config.writeEntry( "SpaceTarget", m_spaceTarget); | 3230 | // qApp->processEvents(); |
3231 | config.writeEntry( "EscapeTarget", m_escapeTarget); | 3231 | reader->bDoUpdates = true; |
3232 | config.writeEntry( "ReturnTarget", m_returnTarget); | 3232 | reader->update(); |
3233 | config.writeEntry( "LeftTarget", m_leftTarget); | 3233 | } |
3234 | config.writeEntry( "RightTarget", m_rightTarget); | 3234 | |
3235 | config.writeEntry( "UpTarget", m_upTarget); | 3235 | bool QTReaderApp::openfrombkmk(Bkmk* bk) |
3236 | config.writeEntry( "DownTarget", m_downTarget); | 3236 | { |
3237 | config.writeEntry("LeftScroll", m_leftScroll); | 3237 | QString fn = toQString( |
3238 | config.writeEntry("RightScroll", m_rightScroll); | 3238 | CFiledata(bk->anno()).name() |
3239 | config.writeEntry("UpScroll", m_upScroll); | 3239 | ); |
3240 | config.writeEntry("DownScroll", m_downScroll); | 3240 | //qDebug("fileinfo"); |
3241 | #ifdef REPALM | 3241 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
3242 | config.writeEntry( "Repalm", reader->brepalm ); | 3242 | { |
3243 | #endif | 3243 | //qDebug("Opening"); |
3244 | config.writeEntry( "Remap", reader->bremap ); | 3244 | openFile(fn); |
3245 | config.writeEntry( "Peanut", reader->bpeanut ); | 3245 | struct stat fnstat; |
3246 | config.writeEntry( "MakeBold", reader->bmakebold ); | 3246 | stat((const char *)reader->m_lastfile, &fnstat); |
3247 | config.writeEntry( "Continuous", reader->m_continuousDocument ); | 3247 | |
3248 | config.writeEntry( "FullJust", reader->bfulljust ); | 3248 | if (CFiledata(bk->anno()).date() |
3249 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); | 3249 | != fnstat.st_mtime) |
3250 | config.writeEntry( "ExtraLead", reader->getlead() ); | 3250 | { |
3251 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); | 3251 | CFiledata fd(bk->anno()); |
3252 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); | 3252 | fd.setdate(fnstat.st_mtime); |
3253 | 3253 | bk->value(0); | |
3254 | config.setGroup( "Toolbar" ); | 3254 | } |
3255 | config.writeEntry("Movable", m_tbmovesave); | 3255 | else |
3256 | config.writeEntry("Policy", m_tbpolsave); | 3256 | { |
3257 | config.writeEntry("Position", m_tbposition); | 3257 | unsigned short svlen = bk->filedatalen(); |
3258 | */ | 3258 | unsigned char* svdata = bk->filedata(); |
3259 | savefilelist(); | 3259 | reader->putSaveData(svdata, svlen); |
3260 | } | 3260 | // setstate(svdata, svlen); |
3261 | 3261 | if (svlen != 0) | |
3262 | /* | 3262 | { |
3263 | void QTReaderApp::oldFile() | 3263 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); |
3264 | { | 3264 | } |
3265 | // odebug << "oldFile called" << oendl; | 3265 | // qDebug("updating"); |
3266 | reader->setText(true); | 3266 | // showEditTools(); |
3267 | // odebug << "settext called" << oendl; | 3267 | reader->locate(bk->value()); |
3268 | showEditTools(); | 3268 | } |
3269 | // odebug << "showedit called" << oendl; | 3269 | return true; |
3270 | } | 3270 | } |
3271 | */ | 3271 | else |
3272 | 3272 | { | |
3273 | /* | 3273 | return false; |
3274 | void info_cb(Fl_Widget* o, void* _data) | 3274 | } |
3275 | { | 3275 | } |
3276 | 3276 | ||
3277 | if (infowin == NULL) | 3277 | void QTReaderApp::gotobkmk(int ind) |
3278 | { | 3278 | { |
3279 | 3279 | qDebug("gbkmk"); | |
3280 | infowin = new Fl_Window(160,240); | 3280 | showEditTools(); |
3281 | filename = new Fl_Output(45,5,110,14,"Filename"); | 3281 | switch (m_nBkmkAction) |
3282 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | 3282 | { |
3283 | textsize = new Fl_Output(45,45,110,14,"Textsize"); | 3283 | case cOpenFile: |
3284 | comprat = new CBar(45,65,110,14,"Ratio %"); | 3284 | { |
3285 | posn = new Fl_Output(45,85,110,14,"Location"); | 3285 | // qApp->processEvents(); |
3286 | frcn = new CBar(45,105,110,14,"% Read"); | 3286 | if (!openfrombkmk((*pOpenlist)[ind])) |
3287 | about = new Fl_Multiline_Output(5,125,150,90); | 3287 | { |
3288 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); | 3288 | pOpenlist->erase(ind); |
3289 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); | 3289 | QMessageBox::information(this, PROGNAME, "Can't find file"); |
3290 | infowin->set_modal(); | 3290 | } |
3291 | } | 3291 | } |
3292 | if (((reader_ui *)_data)->g_filename[0] != '\0') | 3292 | break; |
3293 | { | 3293 | case cGotoBkmk: |
3294 | unsigned long fs,ts; | 3294 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); |
3295 | tchar sz[20]; | 3295 | reader->locate((*pBkmklist)[ind]->value()); |
3296 | ((reader_ui *)_data)->input->sizes(fs,ts); | 3296 | break; |
3297 | unsigned long pl = ((reader_ui *)_data)->input->locate(); | 3297 | case cDelBkmk: |
3298 | 3298 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | |
3299 | filename->value(((reader_ui *)_data)->g_filename); | 3299 | pBkmklist->erase(ind); |
3300 | 3300 | m_fBkmksChanged = true; | |
3301 | sprintf(sz,"%u",fs); | 3301 | reader->refresh(true); |
3302 | filesize->value(sz); | 3302 | // pBkmklist->sort(); |
3303 | 3303 | break; | |
3304 | sprintf(sz,"%u",ts); | 3304 | case cRmBkmkFile: |
3305 | textsize->value(sz); | 3305 | { |
3306 | 3306 | #ifndef USEQPE | |
3307 | comprat->value(100-(100*fs + (ts >> 1))/ts); | 3307 | QDir d = QDir::home(); // "/" |
3308 | 3308 | d.cd(APPDIR); | |
3309 | sprintf(sz,"%u",pl); | 3309 | d.remove(bkmkselector->text(ind)); |
3310 | posn->value(sz); | 3310 | #else /* USEQPE */ |
3311 | 3311 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | |
3312 | frcn->value((100*pl + (ts >> 1))/ts); | 3312 | #endif /* USEQPE */ |
3313 | } | 3313 | } |
3314 | infowin->show(); | 3314 | break; |
3315 | } | 3315 | case cLdConfig: |
3316 | */ | 3316 | readconfig(APPDIR "/configs", bkmkselector->text(ind), false); |
3317 | 3317 | break; | |
3318 | void QTReaderApp::savebkmks() | 3318 | case cLdTheme: |
3319 | { | 3319 | m_themename = bkmkselector->text(ind); |
3320 | if (pBkmklist != NULL) | 3320 | readconfig(QString(APPDIR "/Themes/")+m_themename , "config", false); |
3321 | { | 3321 | setBackgroundBitmap(); |
3322 | #ifndef USEQPE | 3322 | break; |
3323 | QDir d = QDir::home(); // "/" | 3323 | case cRmConfig: |
3324 | d.cd(APPDIR); | 3324 | { |
3325 | QFileInfo fi(d, reader->m_string); | 3325 | #ifndef USEQPE |
3326 | BkmkFile bf((const char *)fi.absFilePath(), true); | 3326 | QDir d = QDir::home(); // "/" |
3327 | #else /* USEQPE */ | 3327 | d.cd(APPDIR "/configs"); |
3328 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true); | 3328 | d.remove(bkmkselector->text(ind)); |
3329 | #endif /* USEQPE */ | 3329 | #else /* USEQPE */ |
3330 | bf.write(*pBkmklist); | 3330 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); |
3331 | } | 3331 | #endif /* USEQPE */ |
3332 | m_fBkmksChanged = false; | 3332 | } |
3333 | } | 3333 | break; |
3334 | 3334 | case cExportLinks: | |
3335 | void QTReaderApp::readfilelist() | 3335 | { |
3336 | { | 3336 | #ifndef USEQPE |
3337 | #ifndef USEQPE | 3337 | QDir d = QDir::home(); // "/" |
3338 | QDir d = QDir::home(); // "/" | 3338 | d.cd(APPDIR "/urls"); |
3339 | d.cd(APPDIR); | 3339 | QFileInfo fi(d, bkmkselector->text(ind)); |
3340 | QFileInfo fi(d, ".openfiles"); | 3340 | if (fi.exists()) |
3341 | BkmkFile bf((const char *)fi.absFilePath()); | 3341 | { |
3342 | #else /* USEQPE */ | 3342 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); |
3343 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles")); | 3343 | if (!outfile.isEmpty()) |
3344 | #endif /* USEQPE */ | 3344 | { |
3345 | // odebug << "Reading open files" << oendl; | 3345 | FILE* fout = fopen((const char *)outfile, "w"); |
3346 | pOpenlist = bf.readall(); | 3346 | if (fout != NULL) |
3347 | // if (pOpenlist != NULL) odebug << "...with success" << oendl; | 3347 | { |
3348 | // else odebug << "...without success!" << oendl; | 3348 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); |
3349 | } | 3349 | if (fin != NULL) |
3350 | 3350 | { | |
3351 | void QTReaderApp::savefilelist() | 3351 | fprintf(fout, "<html><body>\n"); |
3352 | { | 3352 | int ch = 0; |
3353 | if (pOpenlist != NULL) | 3353 | while ((ch = fgetc(fin)) != EOF) |
3354 | { | 3354 | { |
3355 | #ifndef USEQPE | 3355 | fputc(ch, fout); |
3356 | QDir d = QDir::home(); // "/" | 3356 | } |
3357 | d.cd(APPDIR); | 3357 | fclose(fin); |
3358 | QFileInfo fi(d, ".openfiles"); | 3358 | fprintf(fout, "</html></body>\n"); |
3359 | BkmkFile bf((const char *)fi.absFilePath(), true); | 3359 | d.remove(bkmkselector->text(ind)); |
3360 | #else /* USEQPE */ | 3360 | } |
3361 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true); | 3361 | fclose(fout); |
3362 | #endif /* USEQPE */ | 3362 | } |
3363 | // odebug << "Writing open files" << oendl; | 3363 | else |
3364 | bf.write(*pOpenlist); | 3364 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3365 | } | 3365 | } |
3366 | } | 3366 | } |
3367 | 3367 | #else /* USEQPE */ | |
3368 | void QTReaderApp::readbkmks() | 3368 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3369 | { | 3369 | if (fin != NULL) |
3370 | if (pBkmklist != NULL) | 3370 | { |
3371 | { | 3371 | bool allok = false; |
3372 | delete pBkmklist; | 3372 | #ifdef OPIE |
3373 | } | 3373 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); |
3374 | struct stat fnstat; | 3374 | if (!outfile.isEmpty()) |
3375 | struct stat bkstat; | 3375 | { |
3376 | #ifndef USEQPE | 3376 | FILE* fout = fopen((const char *)outfile, "w"); |
3377 | QDir d = QDir::home(); // "/" | 3377 | if (fout != NULL) |
3378 | d.cd(APPDIR); | 3378 | { |
3379 | QFileInfo fi(d, reader->m_string); | 3379 | fprintf(fout, "<html><body>\n"); |
3380 | #endif /* ! USEQPE */ | 3380 | int ch = 0; |
3381 | if ( | 3381 | while ((ch = fgetc(fin)) != EOF) |
3382 | stat((const char *)reader->m_lastfile, &fnstat) == 0 | 3382 | { |
3383 | && | 3383 | fputc(ch, fout); |
3384 | #ifndef USEQPE | 3384 | } |
3385 | stat((const char *)fi.absFilePath(), &bkstat) == 0 | 3385 | fprintf(fout, "</html></body>\n"); |
3386 | #else /* USEQPE */ | 3386 | fclose(fout); |
3387 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 | 3387 | allok = true; |
3388 | #endif /* USEQPE */ | 3388 | } |
3389 | ) | 3389 | else |
3390 | { | 3390 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3391 | if (bkstat.st_mtime < fnstat.st_mtime) | 3391 | } |
3392 | { | 3392 | fclose(fin); |
3393 | #ifndef USEQPE | 3393 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3394 | unlink((const char *)fi.absFilePath()); | 3394 | #else |
3395 | #else /* USEQPE */ | 3395 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); |
3396 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 3396 | if (fb->exec()) |
3397 | #endif /* USEQPE */ | 3397 | { |
3398 | } | 3398 | QString outfile = fb->getCurrentFile(); |
3399 | } | 3399 | FILE* fout = fopen((const char *)outfile, "w"); |
3400 | 3400 | if (fout != NULL) | |
3401 | #ifndef USEQPE | 3401 | { |
3402 | BkmkFile bf((const char *)fi.absFilePath()); | 3402 | fprintf(fout, "<html><body>\n"); |
3403 | #else /* USEQPE */ | 3403 | int ch = 0; |
3404 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 3404 | while ((ch = fgetc(fin)) != EOF) |
3405 | #endif /* USEQPE */ | 3405 | { |
3406 | 3406 | fputc(ch, fout); | |
3407 | pBkmklist = bf.readall(); | 3407 | } |
3408 | m_fBkmksChanged = bf.upgraded(); | 3408 | fprintf(fout, "</html></body>\n"); |
3409 | if (pBkmklist == NULL) | 3409 | fclose(fout); |
3410 | { | 3410 | allok = true; |
3411 | pBkmklist = reader->getbkmklist(); | 3411 | } |
3412 | } | 3412 | else |
3413 | if (pBkmklist != NULL) | 3413 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3414 | pBkmklist->sort(); | 3414 | } |
3415 | } | 3415 | delete fb; |
3416 | 3416 | fclose(fin); | |
3417 | void QTReaderApp::addbkmk() | 3417 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3418 | { | 3418 | #endif |
3419 | m_nRegAction = cAddBkmk; | 3419 | } |
3420 | regEdit->setText(reader->firstword()); | 3420 | else |
3421 | do_regedit(); | 3421 | { |
3422 | } | 3422 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); |
3423 | 3423 | } | |
3424 | void QTReaderApp::do_addbkmk(const QString& text) | 3424 | |
3425 | { | 3425 | /* |
3426 | if (text.isEmpty()) | 3426 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); |
3427 | { | 3427 | int ret = f->exec(); |
3428 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); | 3428 | qDebug("Return:%d", ret); |
3429 | } | 3429 | DocLnk* doc = f->getDoc(); |
3430 | else | 3430 | if (doc != NULL) |
3431 | { | 3431 | { |
3432 | if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; | 3432 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3433 | #ifdef _UNICODE | 3433 | QString rt; |
3434 | CBuffer buff; | 3434 | rt = "<html><body>\n"; |
3435 | int i = 0; | 3435 | int ch = 0; |
3436 | for (i = 0; i < text.length(); i++) | 3436 | while ((ch = fgetc(fin)) != EOF) |
3437 | { | 3437 | { |
3438 | buff[i] = text[i].unicode(); | 3438 | rt += (char)ch; |
3439 | } | 3439 | } |
3440 | buff[i] = 0; | 3440 | fclose(fin); |
3441 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); | 3441 | rt += "</html></body>\n"; |
3442 | #else | 3442 | if ( doc->name().isEmpty() ) |
3443 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); | 3443 | { |
3444 | #endif | 3444 | doc->setName(bkmkselector->text(ind)); |
3445 | m_fBkmksChanged = true; | 3445 | } |
3446 | pBkmklist->sort(); | 3446 | FileManager fm; |
3447 | } | 3447 | fm.saveFile( *doc, rt ); |
3448 | } | 3448 | qDebug("YES"); |
3449 | 3449 | } | |
3450 | void QTReaderApp::OnRedraw() | 3450 | else |
3451 | { | 3451 | { |
3452 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) | 3452 | qDebug("NO"); |
3453 | { | 3453 | } |
3454 | bool found = findNextBookmark(reader->pagelocate()); | 3454 | delete f; |
3455 | m_bkmkAvail->setEnabled(found); | 3455 | */ |
3456 | } | 3456 | |
3457 | } | 3457 | #endif /* USEQPE */ |
3458 | 3458 | } | |
3459 | void QTReaderApp::showAnnotation() | 3459 | break; |
3460 | { | 3460 | } |
3461 | m_annoWin->setName(toQString(m_anno->name())); | 3461 | } |
3462 | m_annoWin->setAnno(toQString(m_anno->anno())); | 3462 | |
3463 | m_annoIsEditing = false; | 3463 | void QTReaderApp::cancelbkmk() |
3464 | #ifdef USEQPE | 3464 | { |
3465 | Global::showInputMethod(); | 3465 | if (m_nBkmkAction == cOpenFile) |
3466 | #endif | 3466 | { |
3467 | editorStack->raiseWidget( m_annoWin ); | 3467 | QString fn = usefilebrowser(); |
3468 | m_annoWin->setFocus(); | 3468 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); |
3469 | } | 3469 | } |
3470 | 3470 | showEditTools(); | |
3471 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) | 3471 | } |
3472 | { | 3472 | |
3473 | //// odebug << "OnWordSelected(" << posn << "):" << wrd << "" << oendl; | 3473 | void QTReaderApp::reparastring() |
3474 | 3474 | { | |
3475 | if (m_doClipboard) | 3475 | m_nRegAction = cRepara; |
3476 | { | 3476 | regEdit->setText(reader->m_reparastring); |
3477 | QClipboard* cb = QApplication::clipboard(); | 3477 | do_regedit(); |
3478 | cb->setText(wrd); | 3478 | } |
3479 | #ifdef USEQPE | 3479 | |
3480 | if (wrd.length() > 10) | 3480 | void QTReaderApp::do_reparastring(const QString& _lcn) |
3481 | { | 3481 | { |
3482 | Global::statusMessage(wrd.left(8) + ".."); | 3482 | reader->m_reparastring = _lcn; |
3483 | } | 3483 | if (reader->brepara) |
3484 | else | 3484 | { |
3485 | { | 3485 | reader->bDoUpdates = true; |
3486 | Global::statusMessage(wrd); | 3486 | reader->setfilter(reader->getfilter()); |
3487 | } | 3487 | } |
3488 | #endif | 3488 | } |
3489 | } | 3489 | |
3490 | if (m_doAnnotation) | 3490 | void QTReaderApp::jump() |
3491 | { | 3491 | { |
3492 | // addAnno(wrd, "Need to be able to edit this", posn); | 3492 | m_nRegAction = cJump; |
3493 | m_annoWin->setName(line); | 3493 | char lcn[20]; |
3494 | m_annoWin->setAnno(""); | 3494 | sprintf(lcn, "%lu", reader->pagelocate()); |
3495 | m_annoWin->setPosn(posn); | 3495 | regEdit->setText(lcn); |
3496 | m_annoIsEditing = true; | 3496 | do_regedit(); |
3497 | #ifdef USEQPE | 3497 | } |
3498 | Global::showInputMethod(); | 3498 | |
3499 | #endif | 3499 | void QTReaderApp::do_jump(const QString& _lcn) |
3500 | editorStack->raiseWidget( m_annoWin ); | 3500 | { |
3501 | } | 3501 | bool ok; |
3502 | #ifdef USEQPE | 3502 | QString lcn = _lcn.stripWhiteSpace(); |
3503 | if (m_doDictionary) | 3503 | unsigned long ulcn = lcn.toULong(&ok); |
3504 | { | 3504 | if (!ok) |
3505 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) | 3505 | { |
3506 | { | 3506 | double pc = 0.0; |
3507 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); | 3507 | #ifdef _WINDOWS |
3508 | e << wrd; | 3508 | if (lcn.at(lcn.length()-1) == '%') |
3509 | } | 3509 | #else |
3510 | } | 3510 | if (lcn[lcn.length()-1] == '%') |
3511 | #endif | 3511 | #endif |
3512 | } | 3512 | { |
3513 | 3513 | lcn = lcn.left(lcn.length()-1); | |
3514 | void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) | 3514 | pc = lcn.toDouble(&ok); |
3515 | { | 3515 | } |
3516 | if (a == 0) | 3516 | else |
3517 | { | 3517 | { |
3518 | e->ignore(); | 3518 | pc = lcn.toDouble(&ok); |
3519 | } | 3519 | } |
3520 | else | 3520 | if (ok && 0 <= pc && pc <= 100) |
3521 | { | 3521 | { |
3522 | e->accept(); | 3522 | ulcn = (pc*(reader->buffdoc.endSection()-reader->buffdoc.startSection()))/100 + reader->buffdoc.startSection(); |
3523 | // odebug << "Accepted" << oendl; | 3523 | } |
3524 | switch (a) | 3524 | else |
3525 | { | 3525 | { |
3526 | case cesOpenFile: | 3526 | ok = false; |
3527 | { | 3527 | } |
3528 | fileOpen(); | 3528 | } |
3529 | } | 3529 | if (ok) |
3530 | break; | 3530 | reader->locate(ulcn); |
3531 | case cesAutoScroll: | 3531 | else |
3532 | { | 3532 | QMessageBox::information(this, PROGNAME, "Must be a number\nor a percentage"); |
3533 | reader->setautoscroll(!reader->m_autoScroll); | 3533 | } |
3534 | setScrollState(reader->m_autoScroll); | 3534 | |
3535 | } | 3535 | void QTReaderApp::do_regaction() |
3536 | break; | 3536 | { |
3537 | case cesActionMark: | 3537 | reader->bDoUpdates = false; |
3538 | { | 3538 | regBar->hide(); |
3539 | addbkmk(); | 3539 | #ifdef USEQPE |
3540 | } | 3540 | Global::hideInputMethod(); |
3541 | break; | 3541 | #endif |
3542 | case cesFullScreen: | 3542 | regVisible = false; |
3543 | { | 3543 | switch(m_nRegAction) |
3544 | m_actFullscreen->setOn(!m_fullscreen); | 3544 | { |
3545 | } | 3545 | case cAutoGen: |
3546 | break; | 3546 | do_autogen(regEdit->text()); |
3547 | case cesActionAnno: | 3547 | break; |
3548 | { | 3548 | case cAddBkmk: |
3549 | addanno(); | 3549 | do_addbkmk(regEdit->text()); |
3550 | } | 3550 | break; |
3551 | break; | 3551 | case cRepara: |
3552 | case cesZoomIn: | 3552 | do_reparastring(regEdit->text()); |
3553 | zoomin(); | 3553 | break; |
3554 | break; | 3554 | case cJump: |
3555 | case cesZoomOut: | 3555 | do_jump(regEdit->text()); |
3556 | zoomout(); | 3556 | break; |
3557 | break; | 3557 | /* |
3558 | case cesBack: | 3558 | case cMonoSpace: |
3559 | reader->goBack(); | 3559 | do_mono(regEdit->text()); |
3560 | break; | 3560 | break; |
3561 | case cesForward: | 3561 | */ |
3562 | reader->goForward(); | 3562 | case cSetTarget: |
3563 | break; | 3563 | do_settarget(regEdit->text()); |
3564 | case cesHome: | 3564 | break; |
3565 | reader->goHome(); | 3565 | #ifdef _SCROLLPIPE |
3566 | break; | 3566 | case cSetPipeTarget: |
3567 | case cesPageUp: | 3567 | do_setpipetarget(regEdit->text()); |
3568 | reader->dopageup(); | 3568 | break; |
3569 | break; | 3569 | #endif |
3570 | case cesPageDown: | 3570 | case cSetConfigName: |
3571 | reader->dopagedn(); | 3571 | // qDebug("Saving config"); |
3572 | break; | 3572 | do_saveconfig(regEdit->text(), false); |
3573 | case cesLineUp: | 3573 | break; |
3574 | reader->lineUp(); | 3574 | } |
3575 | break; | 3575 | // reader->restore(); |
3576 | case cesLineDown: | 3576 | // fileBar->show(); |
3577 | reader->lineDown(); | 3577 | reader->setFocus(); |
3578 | break; | 3578 | // qApp->processEvents(); |
3579 | case cesStartDoc: | 3579 | reader->bDoUpdates = true; |
3580 | gotoStart(); | 3580 | reader->update(); |
3581 | break; | 3581 | } |
3582 | case cesEndDoc: | 3582 | |
3583 | gotoEnd(); | 3583 | void QTReaderApp::do_settarget(const QString& _txt) |
3584 | break; | 3584 | { |
3585 | default: | 3585 | int ind = _txt.find('/'); |
3586 | odebug << "Unknown ActionType:" << a << "" << oendl; | 3586 | if (ind == -1) |
3587 | break; | 3587 | { |
3588 | } | 3588 | m_targetapp = ""; |
3589 | } | 3589 | m_targetmsg = ""; |
3590 | } | 3590 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); |
3591 | 3591 | } | |
3592 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | 3592 | else |
3593 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | 3593 | { |
3594 | 3594 | m_targetapp = _txt.left(ind); | |
3595 | void QTReaderApp::SaveConfig() | 3595 | m_targetmsg = _txt.right(_txt.length()-ind-1); |
3596 | { | 3596 | } |
3597 | m_nRegAction = cSetConfigName; | 3597 | } |
3598 | regEdit->setText(reader->m_string); | 3598 | |
3599 | do_regedit(); | 3599 | void QTReaderApp::chooseencoding() |
3600 | } | 3600 | { |
3601 | 3601 | m_fontSelector->clear(); | |
3602 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | 3602 | m_fontSelector->insertItem("Ascii"); |
3603 | { | 3603 | m_fontSelector->insertItem("UTF-8"); |
3604 | // odebug << "do_saveconfig:" << _txt << "" << oendl; | 3604 | m_fontSelector->insertItem("UCS-2(BE)"); |
3605 | #ifdef USEQPE | 3605 | m_fontSelector->insertItem("USC-2(LE)"); |
3606 | QString configname; | 3606 | m_fontSelector->insertItem("Palm"); |
3607 | Config::Domain dom; | 3607 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) |
3608 | 3608 | { | |
3609 | if (full) | 3609 | m_fontSelector->insertItem(iter->mime); |
3610 | { | 3610 | } // delete the FontDatabase!!! |
3611 | configname = _txt; | 3611 | m_fontSelector->setCurrentItem (reader->m_encd); |
3612 | dom = Config::User; | 3612 | m_fontAction = cChooseEncoding; |
3613 | } | 3613 | m_fontBar->show(); |
3614 | else | 3614 | m_fontVisible = true; |
3615 | { | 3615 | } |
3616 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 3616 | |
3617 | dom = Config::File; | 3617 | void QTReaderApp::setfont() |
3618 | } | 3618 | { |
3619 | 3619 | m_fontSelector->clear(); | |
3620 | Config config(configname, dom); | 3620 | { |
3621 | config.setGroup( "View" ); | 3621 | QFontDatabase f; |
3622 | 3622 | QStringList flist = f.families(); | |
3623 | #else | 3623 | m_fontSelector->insertStringList(flist); |
3624 | QFileInfo fi; | 3624 | } // delete the FontDatabase!!! |
3625 | if (full) | 3625 | |
3626 | { | 3626 | for (int i = 1; i <= m_fontSelector->count(); i++) |
3627 | // odebug << "full:" << _txt << "" << oendl; | 3627 | { |
3628 | QDir d = QDir::home(); // "/" | 3628 | if (m_fontSelector->text(i) == reader->m_fontname) |
3629 | if ( !d.cd(_txt) ) | 3629 | { |
3630 | { // "/tmp" | 3630 | m_fontSelector->setCurrentItem(i); |
3631 | owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl; | 3631 | break; |
3632 | d = QDir::home(); | 3632 | } |
3633 | d.mkdir(_txt); | 3633 | } |
3634 | d.cd(_txt); | 3634 | m_fontAction = cChooseFont; |
3635 | } | 3635 | m_fontBar->show(); |
3636 | fi.setFile(d, INIFILE); | 3636 | m_fontVisible = true; |
3637 | } | 3637 | } |
3638 | else | 3638 | |
3639 | { | 3639 | void QTReaderApp::setfontHelper(const QString& lcn, int size) |
3640 | QDir d = QDir::home(); // "/" | 3640 | { |
3641 | if ( !d.cd(APPDIR) ) | 3641 | if (size == 0) size = reader->m_fontControl.currentsize(); |
3642 | { // "/tmp" | 3642 | if (m_propogatefontchange) |
3643 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; | 3643 | { |
3644 | d = QDir::home(); | 3644 | QFont f(lcn, 10); |
3645 | d.mkdir(APPDIR); | 3645 | bkmkselector->setFont( f ); |
3646 | d.cd(APPDIR); | 3646 | regEdit->setFont( f ); |
3647 | } | 3647 | searchEdit->setFont( f ); |
3648 | if ( !d.cd("configs") ) | 3648 | m_annoWin->setFont( f ); |
3649 | { // "/tmp" | 3649 | } |
3650 | owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl; | 3650 | reader->m_fontname = lcn; |
3651 | d = QDir::home(); | 3651 | if (!reader->ChangeFont(size)) |
3652 | d.cd(APPDIR); | 3652 | { |
3653 | d.mkdir("configs"); | 3653 | reader->ChangeFont(size); |
3654 | d.cd("configs"); | 3654 | } |
3655 | } | 3655 | } |
3656 | fi.setFile(d, _txt); | 3656 | |
3657 | } | 3657 | void QTReaderApp::do_setencoding(int i) |
3658 | // odebug << "Path:" << fi.absFilePath() << "" << oendl; | 3658 | { |
3659 | Config config(fi.absFilePath()); | 3659 | qDebug("setencoding:%d", i); |
3660 | #endif | 3660 | if (m_fontAction == cChooseEncoding) |
3661 | 3661 | { | |
3662 | 3662 | reader->setencoding(i); | |
3663 | config.writeEntry( "StripCr", reader->bstripcr ); | 3663 | } |
3664 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 3664 | reader->refresh(); |
3665 | config.writeEntry( "TextFmt", reader->btextfmt ); | 3665 | m_fontBar->hide(); |
3666 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 3666 | m_fontVisible = false; |
3667 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 3667 | // qDebug("showedit"); |
3668 | config.writeEntry( "Depluck", reader->bdepluck ); | 3668 | if (reader->isVisible()) showEditTools(); |
3669 | config.writeEntry( "Dejpluck", reader->bdejpluck ); | 3669 | // qDebug("showeditdone"); |
3670 | config.writeEntry( "OneSpace", reader->bonespace ); | 3670 | } |
3671 | config.writeEntry( "Unindent", reader->bunindent ); | 3671 | |
3672 | config.writeEntry( "Repara", reader->brepara ); | 3672 | void QTReaderApp::do_setfont(const QString& lcn) |
3673 | config.writeEntry( "DoubleSpace", reader->bdblspce ); | 3673 | { |
3674 | config.writeEntry( "Indent", reader->bindenter ); | 3674 | if (m_fontAction == cChooseFont) |
3675 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); | 3675 | { |
3676 | config.writeEntry( "ScrollDelay", reader->m_delay); | 3676 | setfontHelper(lcn); |
3677 | if (full) | 3677 | } |
3678 | { | 3678 | reader->refresh(); |
3679 | config.writeEntry("Debounce", m_debounce); | 3679 | m_fontBar->hide(); |
3680 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 3680 | m_fontVisible = false; |
3681 | reader->m_lastposn = reader->pagelocate(); | 3681 | // qDebug("setfont"); |
3682 | config.writeEntry( "LastFile", reader->m_lastfile ); | 3682 | //if (reader->isVisible()) |
3683 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | 3683 | showEditTools(); |
3684 | } | 3684 | // qDebug("showeditdone"); |
3685 | config.writeEntry( "PageMode", reader->m_bpagemode ); | 3685 | } |
3686 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | 3686 | |
3687 | config.writeEntry( "SwapMouse", reader->m_swapmouse); | 3687 | void QTReaderApp::do_autogen(const QString& regText) |
3688 | config.writeEntry( "Fontname", reader->m_fontname ); | 3688 | { |
3689 | config.writeEntry( "Encoding", reader->m_encd ); | 3689 | unsigned long fs, ts; |
3690 | config.writeEntry( "CharSpacing", reader->m_charpc ); | 3690 | reader->sizes(fs,ts); |
3691 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); | 3691 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); |
3692 | config.writeEntry( "Margin", (int)reader->m_border ); | 3692 | m_autogenstr = regText; |
3693 | config.writeEntry( "TargetApp", m_targetapp ); | 3693 | QRegExp re(regText); |
3694 | config.writeEntry( "TargetMsg", m_targetmsg ); | 3694 | CBuffer buff; |
3695 | #ifdef _SCROLLPIPE | 3695 | if (pBkmklist != NULL) delete pBkmklist; |
3696 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); | 3696 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
3697 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | 3697 | m_fBkmksChanged = true; |
3698 | #endif | 3698 | |
3699 | config.writeEntry( "TwoTouch", m_twoTouch ); | 3699 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); |
3700 | config.writeEntry( "Annotation", m_doAnnotation); | 3700 | pbar->show(); |
3701 | config.writeEntry( "Dictionary", m_doDictionary); | 3701 | pbar->raise(); |
3702 | config.writeEntry( "Clipboard", m_doClipboard); | 3702 | pbar->reset(); |
3703 | config.writeEntry( "SpaceTarget", m_spaceTarget); | 3703 | reader->update(); |
3704 | config.writeEntry( "EscapeTarget", m_escapeTarget); | 3704 | qApp->processEvents(); |
3705 | config.writeEntry( "ReturnTarget", m_returnTarget); | 3705 | reader->setFocus(); |
3706 | config.writeEntry( "LeftTarget", m_leftTarget); | 3706 | reader->jumpto(0); |
3707 | config.writeEntry( "RightTarget", m_rightTarget); | 3707 | int lastpc = 0; |
3708 | config.writeEntry( "UpTarget", m_upTarget); | 3708 | int i = 0; |
3709 | config.writeEntry( "DownTarget", m_downTarget); | 3709 | while (i >= 0) |
3710 | config.writeEntry("LeftScroll", m_leftScroll); | 3710 | { |
3711 | config.writeEntry("RightScroll", m_rightScroll); | 3711 | unsigned int lcn = reader->locate(); |
3712 | config.writeEntry("UpScroll", m_upScroll); | 3712 | int pc = (100*lcn)/ts; |
3713 | config.writeEntry("DownScroll", m_downScroll); | 3713 | if (pc != lastpc) |
3714 | #ifdef REPALM | 3714 | { |
3715 | config.writeEntry( "Repalm", reader->brepalm ); | 3715 | pbar->setProgress(pc); |
3716 | #endif | 3716 | qApp->processEvents(); |
3717 | config.writeEntry( "Remap", reader->bremap ); | 3717 | if (reader->locate() != lcn) reader->jumpto(lcn); |
3718 | config.writeEntry( "Peanut", reader->bpeanut ); | 3718 | reader->setFocus(); |
3719 | config.writeEntry( "MakeBold", reader->bmakebold ); | 3719 | lastpc = pc; |
3720 | config.writeEntry( "Continuous", reader->m_continuousDocument ); | 3720 | } |
3721 | config.writeEntry( "FullJust", reader->bfulljust ); | 3721 | i = reader->buffdoc.getpara(buff); |
3722 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); | 3722 | #ifdef _UNICODE |
3723 | config.writeEntry( "ExtraLead", reader->getlead() ); | 3723 | if (re.match(toQString(buff.data())) != -1) |
3724 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); | 3724 | #else |
3725 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); | 3725 | if (re.match(buff.data()) != -1) |
3726 | if (full) | 3726 | #endif |
3727 | { | 3727 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3728 | config.setGroup( "Toolbar" ); | 3728 | } |
3729 | config.writeEntry("Movable", m_tbmovesave); | 3729 | pBkmklist->sort(); |
3730 | config.writeEntry("Policy", m_tbpolsave); | 3730 | pbar->setProgress(100); |
3731 | config.writeEntry("Position", m_tbposition); | 3731 | qApp->processEvents(); |
3732 | #ifndef USEQPE | 3732 | pbar->hide(); |
3733 | config.setGroup( "Geometry" ); | 3733 | reader->refresh(); |
3734 | config.writeEntry( "x", x() ); | 3734 | } |
3735 | config.writeEntry( "y", y() ); | 3735 | |
3736 | config.writeEntry( "width", width() ); | 3736 | void QTReaderApp::saveprefs() |
3737 | config.writeEntry( "height", height() ); | 3737 | { |
3738 | #endif | 3738 | do_saveconfig( APPDIR, true ); |
3739 | } | 3739 | savefilelist(); |
3740 | } | 3740 | } |
3741 | 3741 | ||
3742 | /* | 3742 | /* |
3743 | void QTReaderApp::setstate(unsigned char* _sd, unsigned short _sdlen) | 3743 | void QTReaderApp::oldFile() |
3744 | { | 3744 | { |
3745 | unsigned short sdlen; | 3745 | // qDebug("oldFile called"); |
3746 | memcpy(&sdlen, _sd, sizeof(sdlen)); | 3746 | reader->setText(true); |
3747 | sdlen -= sizeof(sdlen); | 3747 | // qDebug("settext called"); |
3748 | _sd += sizeof(sdlen); | 3748 | showEditTools(); |
3749 | statedata* sd; | 3749 | // qDebug("showedit called"); |
3750 | char* data; | 3750 | } |
3751 | if (sdlen < sizeof(statedata)+1) | 3751 | */ |
3752 | { | 3752 | |
3753 | sdlen = sizeof(statedata)+1; | 3753 | /* |
3754 | } | 3754 | void info_cb(Fl_Widget* o, void* _data) |
3755 | data = new char[sdlen]; | 3755 | { |
3756 | sd = (statedata*)data; | 3756 | |
3757 | memcpy(sd, _sd, sdlen); | 3757 | if (infowin == NULL) |
3758 | data[sdlen] = 0; | 3758 | { |
3759 | reader->setstate(*sd); | 3759 | |
3760 | delete [] data; | 3760 | infowin = new Fl_Window(160,240); |
3761 | } | 3761 | filename = new Fl_Output(45,5,110,14,"Filename"); |
3762 | 3762 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | |
3763 | void QTReaderApp::getstate(unsigned char*& data, unsigned short& len) | 3763 | textsize = new Fl_Output(45,45,110,14,"Textsize"); |
3764 | { | 3764 | comprat = new CBar(45,65,110,14,"Ratio %"); |
3765 | unsigned char* olddata = data; | 3765 | posn = new Fl_Output(45,85,110,14,"Location"); |
3766 | unsigned short oldlen = len; | 3766 | frcn = new CBar(45,105,110,14,"% Read"); |
3767 | len = oldlen+sizeof(unsigned short)+sizeof(statedata)+reader->m_fontname.length(); | 3767 | about = new Fl_Multiline_Output(5,125,150,90); |
3768 | data = new unsigned char[len]; | 3768 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); |
3769 | memcpy(data, olddata, oldlen); | 3769 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); |
3770 | delete [] olddata; | 3770 | infowin->set_modal(); |
3771 | memcpy(data+oldlen, &len, sizeof(len)); | 3771 | } |
3772 | statedata* sd = (statedata*)(data+oldlen+sizeof(unsigned short)); | 3772 | if (((reader_ui *)_data)->g_filename[0] != '\0') |
3773 | 3773 | { | |
3774 | sd->bstripcr = reader->bstripcr; | 3774 | unsigned long fs,ts; |
3775 | sd->btextfmt = reader->btextfmt; | 3775 | tchar sz[20]; |
3776 | sd->bautofmt = reader->bautofmt; | 3776 | ((reader_ui *)_data)->input->sizes(fs,ts); |
3777 | sd->bstriphtml = reader->bstriphtml; | 3777 | unsigned long pl = ((reader_ui *)_data)->input->locate(); |
3778 | sd->bpeanut = reader->bpeanut; | 3778 | |
3779 | sd->bdehyphen = reader->bdehyphen; | 3779 | filename->value(((reader_ui *)_data)->g_filename); |
3780 | sd->bdepluck = reader->bdepluck; | 3780 | |
3781 | sd->bdejpluck = reader->bdejpluck; | 3781 | sprintf(sz,"%u",fs); |
3782 | sd->bonespace = reader->bonespace; | 3782 | filesize->value(sz); |
3783 | sd->bunindent = reader->bunindent; | 3783 | |
3784 | sd->brepara = reader->brepara; | 3784 | sprintf(sz,"%u",ts); |
3785 | sd->bdblspce = reader->bdblspce; | 3785 | textsize->value(sz); |
3786 | sd->m_bpagemode = reader->m_bpagemode; | 3786 | |
3787 | sd->m_bMonoSpaced = reader->m_bMonoSpaced; | 3787 | comprat->value(100-(100*fs + (ts >> 1))/ts); |
3788 | sd->bremap = reader->bremap; | 3788 | |
3789 | sd->bmakebold = reader->bmakebold; | 3789 | sprintf(sz,"%u",pl); |
3790 | sd->Continuous = reader->m_continuousDocument; | 3790 | posn->value(sz); |
3791 | #ifdef REPALM | 3791 | |
3792 | sd->brepalm = reader->brepalm; | 3792 | frcn->value((100*pl + (ts >> 1))/ts); |
3793 | #endif | 3793 | } |
3794 | sd->bindenter = reader->bindenter; | 3794 | infowin->show(); |
3795 | sd->m_textsize = reader->m_textsize; //reader->m_fontControl.currentsize() | 3795 | } |
3796 | sd->m_encd = reader->m_encd; | 3796 | */ |
3797 | sd->m_charpc = reader->m_charpc; | 3797 | |
3798 | strcpy(sd->m_fontname, reader->m_fontname.latin1()); | 3798 | void QTReaderApp::savebkmks() |
3799 | } | 3799 | { |
3800 | */ | 3800 | if (pBkmklist != NULL) |
3801 | #ifdef _SCRIPT | 3801 | { |
3802 | void QTReaderApp::RunScript() | 3802 | #ifndef USEQPE |
3803 | { | 3803 | QDir d = QDir::home(); // "/" |
3804 | fileBrowser* fb = new fileBrowser(this,"OpieReader",!m_bFloatingDialog, | 3804 | d.cd(APPDIR); |
3805 | 0, | 3805 | QFileInfo fi(d, reader->m_string); |
3806 | // WStyle_Customize | WStyle_NoBorderEx, | 3806 | BkmkFile bf((const char *)fi.absFilePath(), true, true); |
3807 | "*", Global::applicationFileName(APPDIR "/scripts", "")); | 3807 | #else /* USEQPE */ |
3808 | 3808 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true, true); | |
3809 | QString fn; | 3809 | #endif /* USEQPE */ |
3810 | if (fb->exec()) | 3810 | bf.write(*pBkmklist); |
3811 | { | 3811 | } |
3812 | fn = fb->fileList[0]; | 3812 | m_fBkmksChanged = false; |
3813 | } | 3813 | } |
3814 | delete fb; | 3814 | |
3815 | if ( !fn.isEmpty() && fork() == 0 ) | 3815 | void QTReaderApp::readfilelist() |
3816 | { | 3816 | { |
3817 | execlp((const char *)fn,(const char *)fn,NULL); | 3817 | #ifndef USEQPE |
3818 | } | 3818 | QDir d = QDir::home(); // "/" |
3819 | } | 3819 | d.cd(APPDIR); |
3820 | 3820 | QFileInfo fi(d, ".openfiles"); | |
3821 | void QTReaderApp::SaveScript(const char* sname) | 3821 | BkmkFile bf((const char *)fi.absFilePath(), false, false); |
3822 | { | 3822 | #else /* USEQPE */ |
3823 | FILE* f = fopen(sname,"w"); | 3823 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), false, false); |
3824 | if (f != NULL) | 3824 | #endif /* USEQPE */ |
3825 | { | 3825 | // qDebug("Reading open files"); |
3826 | #ifdef OPIE | 3826 | pOpenlist = bf.readall(); |
3827 | fprintf(f, "#!/bin/sh\nmsg() {\n\tqcop QPE/Application/reader \"$1\" \"$2\" \"$3\"\n}\n"); | 3827 | // if (pOpenlist != NULL) qDebug("...with success"); |
3828 | #else | 3828 | // else qDebug("...without success!"); |
3829 | fprintf(f, "#!/bin/bash\nmsg() {\n\tqcop QPE/Application/uqtreader \"$1\" \"$2\" \"$3\"\n}\n"); | 3829 | } |
3830 | #endif | 3830 | |
3831 | fprintf(f, "msg \"Update(int)\" 0\n"); | 3831 | void QTReaderApp::savefilelist() |
3832 | fprintf(f, "msg \"Layout/StripCR(int)\" %d\n", (reader->bstripcr) ? 1:0); | 3832 | { |
3833 | if (reader->btextfmt) fprintf(f, "msg \"Markup(QString)\" \"Text\"\n"); | 3833 | if (pOpenlist != NULL) |
3834 | else if (reader->bautofmt) fprintf(f, "msg \"Markup(QString)\" \"Auto\"\n"); | 3834 | { |
3835 | else if (reader->bstriphtml) fprintf(f, "msg \"Markup(QString)\" \"HTML\"\n"); | 3835 | #ifndef USEQPE |
3836 | else if (reader->bpeanut) fprintf(f, "msg \"Markup(QString)\" \"Peanut/PML\"\n"); | 3836 | QDir d = QDir::home(); // "/" |
3837 | else fprintf(f, "msg \"Markup(QString)\" \"None\"\n"); | 3837 | d.cd(APPDIR); |
3838 | fprintf(f, "msg \"Layout/Dehyphen(int)\" %d\n", (reader->bdehyphen) ? 1:0); | 3838 | QFileInfo fi(d, ".openfiles"); |
3839 | fprintf(f, "msg \"Layout/Depluck(int)\" %d\n", (reader->bdepluck) ? 1:0); | 3839 | BkmkFile bf((const char *)fi.absFilePath(), true, false); |
3840 | fprintf(f, "msg \"Layout/Dejpluck(int)\" %d\n", (reader->bdejpluck) ? 1:0); | 3840 | #else /* USEQPE */ |
3841 | fprintf(f, "msg \"Layout/SingleSpace(int)\" %d\n", (reader->bonespace) ? 1:0); | 3841 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true, false); |
3842 | fprintf(f, "msg \"Layout/Unindent(int)\" %d\n", (reader->bunindent) ? 1:0); | 3842 | #endif /* USEQPE */ |
3843 | fprintf(f, "msg \"Layout/Re-paragraph(int)\" %d\n", (reader->brepara) ? 1:0); | 3843 | //qDebug("Writing open files"); |
3844 | fprintf(f, "msg \"Layout/DoubleSpace(int)\" %d\n", (reader->bdblspce) ? 1:0); | 3844 | bf.write(*pOpenlist); |
3845 | fprintf(f, "msg \"Layout/Indent(int)\" %d\n", reader->bindenter); | 3845 | } |
3846 | fprintf(f, "msg \"Format/SetFont(QString,int)\" \"%s\" %d\n", (const char*)reader->m_fontname, reader->m_textsize); | 3846 | } |
3847 | fprintf(f, "msg \"Navigation/Page/LineScroll(int)\" %d\n", (reader->m_bpagemode) ? 1:0); | 3847 | |
3848 | fprintf(f, "msg \"Format/Ideogram/Word(int)\" %d\n", (reader->m_bMonoSpaced) ? 1:0); | 3848 | void QTReaderApp::readbkmks() |
3849 | fprintf(f, "msg \"Format/Encoding(QString)\" \"%s\"\n", (const char*)m_EncodingAction[reader->m_encd]->text()); | 3849 | { |
3850 | fprintf(f, "msg \"Format/SetWidth(int)\" %d\n", reader->m_charpc); | 3850 | if (pBkmklist != NULL) |
3851 | fprintf(f, "msg \"Navigation/SetOverlap(int)\" %d\n", reader->m_overlap); | 3851 | { |
3852 | fprintf(f, "msg \"Layout/Remap(int)\" %d\n", (reader->bremap) ? 1:0); | 3852 | delete pBkmklist; |
3853 | fprintf(f, "msg \"Layout/Embolden(int)\" %d\n", (reader->bmakebold) ? 1:0); | 3853 | } |
3854 | fprintf(f, "msg \"File/Continuous(int)\" %d\n", (reader->m_continuousDocument) ? 1:0); | 3854 | struct stat fnstat; |
3855 | fprintf(f, "msg \"File/SetDictionary(QString)\" \"%s/%s\"\n", (const char *)m_targetapp, (const char *)m_targetmsg); | 3855 | struct stat bkstat; |
3856 | #ifdef _SCROLLPIPE | 3856 | #ifndef USEQPE |
3857 | fprintf(f, "msg \"File/SetScrollTarget(QString)\" \"%s\"\n", (const char *)reader->m_pipetarget); | 3857 | QDir d = QDir::home(); // "/" |
3858 | #endif | 3858 | d.cd(APPDIR); |
3859 | fprintf(f, "msg \"File/Two/OneTouch(int)\" %d\n", (m_twoTouch) ? 1:0); | 3859 | QFileInfo fi(d, reader->m_string); |
3860 | fprintf(f, "msg \"Target/Annotation(int)\" %d\n", (m_doAnnotation) ? 1:0); | 3860 | #endif /* ! USEQPE */ |
3861 | fprintf(f, "msg \"Target/Dictionary(int)\" %d\n", (m_doDictionary) ? 1:0); | 3861 | if ( |
3862 | fprintf(f, "msg \"Target/Clipboard(int)\" %d\n", (m_doClipboard) ? 1:0); | 3862 | stat((const char *)reader->m_lastfile, &fnstat) == 0 |
3863 | fprintf(f, "msg \"File/Action(QString)\" \"%s\"\n", (const char *)m_buttonAction[m_spaceTarget]->text()); | 3863 | && |
3864 | fprintf(f, "msg \"Update(int)\" 1\n"); | 3864 | #ifndef USEQPE |
3865 | fprintf(f, "msg \"info(QString)\" \"All Done\"\n"); | 3865 | stat((const char *)fi.absFilePath(), &bkstat) == 0 |
3866 | fclose(f); | 3866 | #else /* USEQPE */ |
3867 | chmod(sname, S_IXUSR | S_IXGRP | S_IXOTH); | 3867 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 |
3868 | } | 3868 | #endif /* USEQPE */ |
3869 | } | 3869 | ) |
3870 | 3870 | { | |
3871 | void QTReaderApp::SaveConfig() | 3871 | if (bkstat.st_mtime < fnstat.st_mtime) |
3872 | { | 3872 | { |
3873 | m_nRegAction = cSetConfigName; | 3873 | #ifndef USEQPE |
3874 | regEdit->setText(""); | 3874 | unlink((const char *)fi.absFilePath()); |
3875 | do_regedit(); | 3875 | #else /* USEQPE */ |
3876 | } | 3876 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
3877 | 3877 | #endif /* USEQPE */ | |
3878 | void QTReaderApp::do_saveconfig(const QString& _txt) | 3878 | } |
3879 | { | 3879 | } |
3880 | SaveScript(Global::applicationFileName(APPDIR "/scripts", _txt)); | 3880 | |
3881 | } | 3881 | #ifndef USEQPE |
3882 | #endif | 3882 | BkmkFile bf((const char *)fi.absFilePath(), false, true); |
3883 | 3883 | #else /* USEQPE */ | |
3884 | #ifdef _SCROLLPIPE | 3884 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), false, true); |
3885 | void QTReaderApp::setpipetarget() | 3885 | #endif /* USEQPE */ |
3886 | { | 3886 | |
3887 | m_nRegAction = cSetPipeTarget; | 3887 | reader->pBkmklist = pBkmklist = bf.readall(); |
3888 | QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; | 3888 | m_fBkmksChanged = bf.upgraded(); |
3889 | regEdit->setText(text); | 3889 | if (pBkmklist == NULL) |
3890 | do_regedit(); | 3890 | { |
3891 | } | 3891 | reader->pBkmklist = pBkmklist = reader->getbkmklist(); |
3892 | 3892 | } | |
3893 | void QTReaderApp::do_setpipetarget(const QString& _txt) | 3893 | if (pBkmklist != NULL) |
3894 | { | 3894 | pBkmklist->sort(); |
3895 | reader->m_pipetarget = _txt; | 3895 | } |
3896 | } | 3896 | |
3897 | 3897 | void QTReaderApp::addbkmk() | |
3898 | void QTReaderApp::setpause(bool sfs) | 3898 | { |
3899 | { | 3899 | m_nRegAction = cAddBkmk; |
3900 | reader->m_pauseAfterEachPara = sfs; | 3900 | regEdit->setText(reader->firstword()); |
3901 | } | 3901 | do_regedit(); |
3902 | #endif | 3902 | } |
3903 | 3903 | ||
3904 | void QTReaderApp::monospace(bool _b) | 3904 | void QTReaderApp::do_addbkmk(const QString& text) |
3905 | { | 3905 | { |
3906 | reader->setmono(_b); | 3906 | if (text.isEmpty()) |
3907 | } | 3907 | { |
3908 | 3908 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); | |
3909 | bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | 3909 | } |
3910 | { | 3910 | else |
3911 | #ifdef USEQPE | 3911 | { |
3912 | QString configname; | 3912 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
3913 | Config::Domain dom; | 3913 | #ifdef _UNICODE |
3914 | 3914 | CBuffer buff; | |
3915 | if (full) | 3915 | int i = 0; |
3916 | { | 3916 | for (i = 0; i < text.length(); i++) |
3917 | configname = _txt; | 3917 | { |
3918 | dom = Config::User; | 3918 | buff[i] = text[i].unicode(); |
3919 | } | 3919 | } |
3920 | else | 3920 | buff[i] = 0; |
3921 | { | 3921 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); |
3922 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 3922 | #else |
3923 | QFileInfo fm(configname); | 3923 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); |
3924 | if ( !fm.exists() ) return false; | 3924 | #endif |
3925 | dom = Config::File; | 3925 | m_fBkmksChanged = true; |
3926 | } | 3926 | pBkmklist->sort(); |
3927 | 3927 | reader->refresh(true); | |
3928 | Config config(configname, dom); | 3928 | } |
3929 | config.setGroup( "View" ); | 3929 | } |
3930 | 3930 | ||
3931 | #else | 3931 | void QTReaderApp::UpdateStatus() |
3932 | QFileInfo fi; | 3932 | { |
3933 | if (full) | 3933 | QString status; |
3934 | { | 3934 | for (int i = 0; i < m_statusstring.length(); i++) |
3935 | QDir d = QDir::home(); // "/" | 3935 | { |
3936 | if ( !d.cd(_txt) ) | 3936 | if (m_statusstring[i].unicode() == '%') |
3937 | { // "/tmp" | 3937 | { |
3938 | owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl; | 3938 | i++; |
3939 | d = QDir::home(); | 3939 | if (i < m_statusstring.length()) |
3940 | d.mkdir(_txt); | 3940 | { |
3941 | d.cd(_txt); | 3941 | switch (m_statusstring[i].unicode()) |
3942 | } | 3942 | { |
3943 | fi.setFile(d, INIFILE); | 3943 | case 'F': |
3944 | } | 3944 | { |
3945 | else | 3945 | unsigned long fs,ts; |
3946 | { | 3946 | reader->sizes(fs,ts); |
3947 | QDir d = QDir::home(); // "/" | 3947 | status += filesize(ts); |
3948 | if ( !d.cd(APPDIR) ) | 3948 | } |
3949 | { // "/tmp" | 3949 | break; |
3950 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; | 3950 | case 'f': |
3951 | d = QDir::home(); | 3951 | { |
3952 | d.mkdir(APPDIR); | 3952 | status += filesize(reader->pagelocate()); |
3953 | d.cd(APPDIR); | 3953 | } |
3954 | } | 3954 | break; |
3955 | if ( !d.cd("configs") ) | 3955 | case 'D': |
3956 | { // "/tmp" | 3956 | { |
3957 | owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl; | 3957 | status += filesize(reader->buffdoc.endSection()-reader->buffdoc.startSection()); |
3958 | d = QDir::home(); | 3958 | } |
3959 | d.mkdir("configs"); | 3959 | break; |
3960 | d.cd("configs"); | 3960 | case 'd': |
3961 | } | 3961 | { |
3962 | fi.setFile(d, _txt); | 3962 | status += filesize(reader->pagelocate()-reader->buffdoc.startSection()); |
3963 | } | 3963 | } |
3964 | #ifdef _WINDOWS | 3964 | break; |
3965 | struct stat fnstat; | 3965 | case 'P': |
3966 | if (stat((const char *)reader->m_lastfile, &fnstat) == 0) return false; // get round fileinfo bug on windows | 3966 | { |
3967 | #else | 3967 | unsigned long fs,ts; |
3968 | if (!fi.exists()) return false; | 3968 | reader->sizes(fs,ts); |
3969 | #endif | 3969 | status += percent(reader->pagelocate(),ts); |
3970 | Config config(fi.absFilePath()); | 3970 | } |
3971 | #endif | 3971 | break; |
3972 | if (full) | 3972 | case 'p': |
3973 | { | 3973 | { |
3974 | config.setGroup("Toolbar"); | 3974 | status += percent(reader->pagelocate()-reader->buffdoc.startSection(),reader->buffdoc.endSection()-reader->buffdoc.startSection()); |
3975 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 3975 | } |
3976 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 3976 | break; |
3977 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 3977 | case 'z': |
3978 | } | 3978 | { |
3979 | config.setGroup( "View" ); | 3979 | // qDebug("case d"); |
3980 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 3980 | status += QString().setNum(reader->m_fontControl.currentsize()*10); |
3981 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); | 3981 | } |
3982 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | 3982 | break; |
3983 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); | 3983 | default: |
3984 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 3984 | status += m_statusstring[i]; |
3985 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | 3985 | } |
3986 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | 3986 | } |
3987 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 3987 | } |
3988 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | 3988 | else |
3989 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 3989 | { |
3990 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | 3990 | status += m_statusstring[i]; |
3991 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); | 3991 | } |
3992 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); | 3992 | } |
3993 | reader->bunindent = config.readBoolEntry( "Unindent", false ); | 3993 | m_prog->setText(status); |
3994 | reader->brepara = config.readBoolEntry( "Repara", false ); | 3994 | } |
3995 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); | 3995 | |
3996 | reader->bindenter = config.readNumEntry( "Indent", 0 ); | 3996 | void QTReaderApp::OnRedraw() |
3997 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 3997 | { |
3998 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 3998 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) |
3999 | if (full) | 3999 | { |
4000 | { | 4000 | bool found = findNextBookmark(reader->pagelocate()); |
4001 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 4001 | m_bkmkAvail->setEnabled(found); |
4002 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 4002 | } |
4003 | } | 4003 | if (m_scrollbar != NULL) |
4004 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 4004 | { |
4005 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | 4005 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); |
4006 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); | 4006 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); |
4007 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); | 4007 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); |
4008 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); | 4008 | scrollbar->setValue((reader->m_rotated) ? |
4009 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); | 4009 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : |
4010 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | 4010 | reader->pagelocate()); |
4011 | reader->m_border = config.readNumEntry( "Margin", 6 ); | 4011 | } |
4012 | #ifdef REPALM | 4012 | if (m_prog->isVisible()) |
4013 | reader->brepalm = config.readBoolEntry( "Repalm", true ); | 4013 | { |
4014 | #endif | 4014 | // qDebug("updating status"); |
4015 | reader->bremap = config.readBoolEntry( "Remap", true ); | 4015 | UpdateStatus(); |
4016 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); | 4016 | // qDebug("updated status"); |
4017 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); | 4017 | } |
4018 | m_targetapp = config.readEntry( "TargetApp", QString::null ); | 4018 | } |
4019 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 4019 | |
4020 | #ifdef _SCROLLPIPE | 4020 | void QTReaderApp::showAnnotation() |
4021 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); | 4021 | { |
4022 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); | 4022 | m_annoWin->setName(toQString(m_anno->name())); |
4023 | #endif | 4023 | m_annoWin->setAnno(toQString(m_anno->anno())); |
4024 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | 4024 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
4025 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | 4025 | m_annoIsEditing = false; |
4026 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | 4026 | #ifdef USEQPE |
4027 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | 4027 | Global::showInputMethod(); |
4028 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | 4028 | #endif |
4029 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | 4029 | editorStack->raiseWidget( m_annoWin ); |
4030 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); | 4030 | hidetoolbars(); |
4031 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); | 4031 | m_annoWin->setFocus(); |
4032 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); | 4032 | } |
4033 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); | 4033 | |
4034 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); | 4034 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) |
4035 | 4035 | { | |
4036 | m_leftScroll = config.readBoolEntry("LeftScroll", false); | 4036 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); |
4037 | m_rightScroll = config.readBoolEntry("RightScroll", false); | 4037 | |
4038 | m_upScroll = config.readBoolEntry("UpScroll", true); | 4038 | if (m_doClipboard) |
4039 | m_downScroll = config.readBoolEntry("DownScroll", true); | 4039 | { |
4040 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); | 4040 | QClipboard* cb = QApplication::clipboard(); |
4041 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | 4041 | cb->setText(wrd); |
4042 | reader->setTwoTouch(m_twoTouch); | 4042 | #ifdef USEQPE |
4043 | 4043 | if (wrd.length() > 10) | |
4044 | m_touch_action->setOn(m_twoTouch); | 4044 | { |
4045 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 4045 | Global::statusMessage(wrd.left(8) + ".."); |
4046 | setfontHelper(reader->m_fontname); | 4046 | } |
4047 | if (full) | 4047 | else |
4048 | { | 4048 | { |
4049 | addtoolbars(&config); | 4049 | Global::statusMessage(wrd); |
4050 | } | 4050 | } |
4051 | reader->setfilter(reader->getfilter()); | 4051 | #endif |
4052 | reader->refresh(); | 4052 | } |
4053 | return true; | 4053 | if (m_doAnnotation) |
4054 | } | 4054 | { |
4055 | 4055 | //addAnno(wrd, "Need to be able to edit this", posn); | |
4056 | bool QTReaderApp::PopulateConfig(const char* tgtdir) | 4056 | m_annoWin->setName(line); |
4057 | { | 4057 | m_annoWin->setAnno(""); |
4058 | bkmkselector->clear(); | 4058 | m_annoWin->setPosn(posn); |
4059 | bkmkselector->setText("Cancel"); | 4059 | m_annoWin->setPosn2(posn2); |
4060 | #ifndef USEQPE | 4060 | m_annoIsEditing = true; |
4061 | int cnt = 0; | 4061 | #ifdef USEQPE |
4062 | 4062 | Global::showInputMethod(); | |
4063 | QDir d = QDir::home(); // "/" | 4063 | #endif |
4064 | if ( !d.cd(APPDIR) ) { // "/tmp" | 4064 | editorStack->raiseWidget( m_annoWin ); |
4065 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; | 4065 | hidetoolbars(); |
4066 | d = QDir::home(); | 4066 | } |
4067 | d.mkdir(APPDIR); | 4067 | #ifdef USEQPE |
4068 | d.cd(APPDIR); | 4068 | if (m_doDictionary) |
4069 | } | 4069 | { |
4070 | if ( !d.cd(tgtdir) ) { // "/tmp" | 4070 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) |
4071 | owarn << "Cannot find the \"~/" APPDIR "/" << tgtdir << "\" directory" << oendl; | 4071 | { |
4072 | d = QDir::home(); | 4072 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); |
4073 | d.mkdir(tgtdir); | 4073 | e << wrd; |
4074 | d.cd(tgtdir); | 4074 | } |
4075 | } | 4075 | } |
4076 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 4076 | #endif |
4077 | // d.setSorting( QDir::Size | QDir::Reversed ); | 4077 | } |
4078 | 4078 | ||
4079 | const QFileInfoList *list = d.entryInfoList(); | 4079 | void QTReaderApp::doAction(QKeyEvent* e) |
4080 | QFileInfoListIterator it( *list ); // create list iterator | 4080 | { |
4081 | QFileInfo *fi; // pointer for traversing | 4081 | QMap<orKey,int>::Iterator f = kmap.end(); |
4082 | 4082 | ||
4083 | while ( (fi=it.current()) ) { // for each file... | 4083 | if (reader->m_autoScroll) |
4084 | 4084 | { | |
4085 | bkmkselector->insertItem(fi->fileName()); | 4085 | f = kmap.find(orKey(e->state(), e->key(), true)); |
4086 | cnt++; | 4086 | } |
4087 | 4087 | if (f == kmap.end()) | |
4088 | //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl; | 4088 | { |
4089 | ++it; // goto next list element | 4089 | f = kmap.find(orKey(e->state(), e->key(), false)); |
4090 | } | 4090 | } |
4091 | 4091 | ||
4092 | #else /* USEQPE */ | 4092 | if (f == kmap.end()) |
4093 | int cnt = 0; | 4093 | { |
4094 | DIR *d; | 4094 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); |
4095 | char* finaldir; | 4095 | e->ignore(); |
4096 | finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; | 4096 | } |
4097 | strcpy(finaldir, APPDIR); | 4097 | else |
4098 | strcat(finaldir, "/"); | 4098 | { |
4099 | strcat(finaldir, tgtdir); | 4099 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); |
4100 | d = opendir((const char *)Global::applicationFileName(finaldir,"")); | 4100 | ActionTypes a = (ActionTypes)f.data(); |
4101 | 4101 | e->accept(); | |
4102 | while(1) | 4102 | //qDebug("Accepted"); |
4103 | { | 4103 | switch (a) |
4104 | struct dirent* de; | 4104 | { |
4105 | struct stat buf; | 4105 | case cesGotoLink: |
4106 | de = readdir(d); | 4106 | { |
4107 | if (de == NULL) break; | 4107 | reader->gotoLink(); |
4108 | 4108 | } | |
4109 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 4109 | break; |
4110 | { | 4110 | case cesNextLink: |
4111 | bkmkselector->insertItem(de->d_name); | 4111 | { |
4112 | cnt++; | 4112 | reader->getNextLink(); |
4113 | } | 4113 | } |
4114 | } | 4114 | break; |
4115 | delete [] finaldir; | 4115 | case cesInvertColours: |
4116 | closedir(d); | 4116 | m_inverse_action->setOn(!reader->bInverse); |
4117 | #endif | 4117 | break; |
4118 | return (cnt > 0); | 4118 | case cesToggleBars: |
4119 | } | 4119 | m_hidebars = !m_hidebars; |
4120 | 4120 | if (m_hidebars) | |
4121 | void QTReaderApp::LoadConfig() | 4121 | { |
4122 | { | 4122 | #ifdef USEQPE |
4123 | if (PopulateConfig("configs")) | 4123 | menubar->hide(); |
4124 | { | 4124 | #endif |
4125 | editorStack->raiseWidget( bkmkselector ); | 4125 | if (fileBar != NULL) fileBar->hide(); |
4126 | hidetoolbars(); | 4126 | if (viewBar != NULL) viewBar->hide(); |
4127 | m_nBkmkAction = cLdConfig; | 4127 | if (navBar != NULL) navBar->hide(); |
4128 | } | 4128 | if (markBar != NULL) markBar->hide(); |
4129 | else | 4129 | mb->hide(); |
4130 | QMessageBox::information(this, PROGNAME, "No config files"); | 4130 | } |
4131 | } | 4131 | else |
4132 | 4132 | { | |
4133 | void QTReaderApp::TidyConfig() | 4133 | #ifdef USEQPE |
4134 | { | 4134 | menubar->show(); |
4135 | if (PopulateConfig("configs")) | 4135 | #endif |
4136 | { | 4136 | if (fileBar != NULL) fileBar->show(); |
4137 | editorStack->raiseWidget( bkmkselector ); | 4137 | if (viewBar != NULL) viewBar->show(); |
4138 | hidetoolbars(); | 4138 | if (navBar != NULL) navBar->show(); |
4139 | m_nBkmkAction = cRmConfig; | 4139 | if (markBar != NULL) markBar->show(); |
4140 | } | 4140 | mb->show(); |
4141 | else | 4141 | } |
4142 | QMessageBox::information(this, PROGNAME, "No config files"); | 4142 | break; |
4143 | } | 4143 | case cesToggleScrollBar: |
4144 | 4144 | if (m_scrollbar != NULL) | |
4145 | void QTReaderApp::ExportLinks() | 4145 | { |
4146 | { | 4146 | if (m_scrollbar->isHidden()) |
4147 | if (PopulateConfig("urls")) | 4147 | { |
4148 | { | 4148 | m_scrollishidden = false; |
4149 | editorStack->raiseWidget( bkmkselector ); | 4149 | m_scrollbar->show(); |
4150 | hidetoolbars(); | 4150 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
4151 | m_nBkmkAction = cExportLinks; | 4151 | } |
4152 | } | 4152 | else |
4153 | else | 4153 | { |
4154 | QMessageBox::information(this, PROGNAME, "No url files"); | 4154 | m_scrollishidden = true; |
4155 | } | 4155 | m_scrollbar->hide(); |
4156 | 4156 | reader->m_scrollpos = m_localscroll; | |
4157 | void QTReaderApp::OnURLSelected(const QString& href) | 4157 | } |
4158 | { | 4158 | } |
4159 | CURLDialog* urld = new CURLDialog(href, false, this); | 4159 | break; |
4160 | urld->clipboard(m_url_clipboard); | 4160 | case cesToggleStatusBar: |
4161 | urld->localfile(m_url_localfile); | 4161 | if (m_prog != NULL) |
4162 | urld->globalfile(m_url_globalfile); | 4162 | { |
4163 | if (urld->exec()) | 4163 | if (m_prog->isHidden()) |
4164 | { | 4164 | { |
4165 | m_url_clipboard = urld->clipboard(); | 4165 | m_statusishidden = false; |
4166 | m_url_localfile = urld->localfile(); | 4166 | m_prog->show(); |
4167 | m_url_globalfile = urld->globalfile(); | 4167 | } |
4168 | if (m_url_clipboard) | 4168 | else |
4169 | { | 4169 | { |
4170 | QClipboard* cb = QApplication::clipboard(); | 4170 | m_statusishidden = true; |
4171 | cb->setText(href); | 4171 | m_prog->hide(); |
4172 | odebug << "<a href=\"" << href << "\">" << href << "</a>" << oendl; | 4172 | } |
4173 | } | 4173 | } |
4174 | if (m_url_localfile) | 4174 | break; |
4175 | { | 4175 | case cesOpenFile: |
4176 | writeUrl(reader->m_string, href); | 4176 | { |
4177 | } | 4177 | qDebug("Open file"); |
4178 | if (m_url_globalfile) | 4178 | fileOpen(); |
4179 | { | 4179 | } |
4180 | writeUrl("GlobalURLFile", href); | 4180 | break; |
4181 | } | 4181 | case cesAutoScroll: |
4182 | } | 4182 | { |
4183 | delete urld; | 4183 | reader->setautoscroll(!reader->m_autoScroll); |
4184 | } | 4184 | setScrollState(reader->m_autoScroll); |
4185 | 4185 | } | |
4186 | void QTReaderApp::writeUrl(const QString& file, const QString& href) | 4186 | break; |
4187 | { | 4187 | case cesActionMark: |
4188 | QString filename; | 4188 | { |
4189 | #ifdef USEQPE | 4189 | addbkmk(); |
4190 | filename = Global::applicationFileName(APPDIR "/urls", file); | 4190 | } |
4191 | #else | 4191 | break; |
4192 | QFileInfo fi; | 4192 | case cesFullScreen: |
4193 | QDir d = QDir::home(); // "/" | 4193 | { |
4194 | if ( !d.cd(APPDIR) ) | 4194 | m_actFullscreen->setOn(!m_fullscreen); |
4195 | { // "/tmp" | 4195 | } |
4196 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; | 4196 | break; |
4197 | d = QDir::home(); | 4197 | case cesRotate: |
4198 | d.mkdir(APPDIR); | 4198 | { |
4199 | d.cd(APPDIR); | 4199 | m_rotate_action->setOn(!reader->m_rotated); |
4200 | } | 4200 | } |
4201 | if ( !d.cd("urls") ) | 4201 | break; |
4202 | { // "/tmp" | 4202 | case cesActionAnno: |
4203 | owarn << "Cannot find the \"~/" APPDIR "/urls\" directory" << oendl; | 4203 | { |
4204 | d = QDir::home(); | 4204 | addanno(); |
4205 | d.cd(APPDIR); | 4205 | } |
4206 | d.mkdir("urls"); | 4206 | break; |
4207 | d.cd("urls"); | 4207 | case cesZoomIn: |
4208 | } | 4208 | zoomin(); |
4209 | fi.setFile(d, file); | 4209 | break; |
4210 | filename = fi.absFilePath(); | 4210 | case cesZoomOut: |
4211 | #endif | 4211 | zoomout(); |
4212 | FILE* fout = fopen(filename, "a"); | 4212 | break; |
4213 | if (fout != NULL) | 4213 | case cesBack: |
4214 | { | 4214 | reader->goBack(); |
4215 | fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href); | 4215 | break; |
4216 | fclose(fout); | 4216 | case cesForward: |
4217 | } | 4217 | reader->goForward(); |
4218 | else | 4218 | break; |
4219 | { | 4219 | case cesHome: |
4220 | QMessageBox::warning(this, PROGNAME, "Problem with writing URL"); | 4220 | reader->goHome(); |
4221 | } | 4221 | break; |
4222 | } | 4222 | case cesPageUp: |
4223 | reader->dopageup(); | ||
4224 | /* | ||
4225 | ftime(&m_lastkeytime); | ||
4226 | m_fndelay = m_debounce; | ||
4227 | // | ||
4228 | { | ||
4229 | timeb now; | ||
4230 | ftime(&now); | ||
4231 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+100; | ||
4232 | } | ||
4233 | */ | ||
4234 | break; | ||
4235 | case cesPageDown: | ||
4236 | reader->dopagedn(); | ||
4237 | /* | ||
4238 | ftime(&m_lastkeytime); | ||
4239 | m_fndelay = m_debounce; | ||
4240 | // | ||
4241 | if (m_debounce != 0) | ||
4242 | { | ||
4243 | timeb now; | ||
4244 | ftime(&now); | ||
4245 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+10; | ||
4246 | } | ||
4247 | */ | ||
4248 | break; | ||
4249 | case cesLineUp: | ||
4250 | reader->lineUp(); | ||
4251 | break; | ||
4252 | case cesLineDown: | ||
4253 | reader->lineDown(); | ||
4254 | break; | ||
4255 | case cesStartDoc: | ||
4256 | gotoStart(); | ||
4257 | break; | ||
4258 | case cesEndDoc: | ||
4259 | gotoEnd(); | ||
4260 | break; | ||
4261 | case cesScrollMore: | ||
4262 | reader->increaseScroll(); | ||
4263 | break; | ||
4264 | case cesScrollLess: | ||
4265 | reader->reduceScroll(); | ||
4266 | break; | ||
4267 | default: | ||
4268 | qDebug("Unknown ActionType:%u", a); | ||
4269 | break; | ||
4270 | } | ||
4271 | } | ||
4272 | } | ||
4273 | |||
4274 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | ||
4275 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | ||
4276 | |||
4277 | void QTReaderApp::SaveConfig() | ||
4278 | { | ||
4279 | m_nRegAction = cSetConfigName; | ||
4280 | regEdit->setText(reader->m_string); | ||
4281 | do_regedit(); | ||
4282 | } | ||
4283 | |||
4284 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | ||
4285 | { | ||
4286 | // qDebug("do_saveconfig:%s", (const char*)_txt); | ||
4287 | #ifdef USEQPE | ||
4288 | QString configname; | ||
4289 | Config::Domain dom; | ||
4290 | |||
4291 | if (full) | ||
4292 | { | ||
4293 | configname = _txt; | ||
4294 | dom = Config::User; | ||
4295 | } | ||
4296 | else | ||
4297 | { | ||
4298 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | ||
4299 | dom = Config::File; | ||
4300 | } | ||
4301 | |||
4302 | Config config(configname, dom); | ||
4303 | config.setGroup( "View" ); | ||
4304 | |||
4305 | #else | ||
4306 | QFileInfo fi; | ||
4307 | if (full) | ||
4308 | { | ||
4309 | // qDebug("full:%s", (const char*)_txt); | ||
4310 | QDir d = QDir::home(); // "/" | ||
4311 | if ( !d.cd(_txt) ) | ||
4312 | { // "/tmp" | ||
4313 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | ||
4314 | d = QDir::home(); | ||
4315 | d.mkdir(_txt); | ||
4316 | d.cd(_txt); | ||
4317 | } | ||
4318 | fi.setFile(d, INIFILE); | ||
4319 | } | ||
4320 | else | ||
4321 | { | ||
4322 | QDir d = QDir::home(); // "/" | ||
4323 | if ( !d.cd(APPDIR) ) | ||
4324 | { // "/tmp" | ||
4325 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | ||
4326 | d = QDir::home(); | ||
4327 | d.mkdir(APPDIR); | ||
4328 | d.cd(APPDIR); | ||
4329 | } | ||
4330 | if ( !d.cd("configs") ) | ||
4331 | { // "/tmp" | ||
4332 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | ||
4333 | d = QDir::home(); | ||
4334 | d.cd(APPDIR); | ||
4335 | d.mkdir("configs"); | ||
4336 | d.cd("configs"); | ||
4337 | } | ||
4338 | fi.setFile(d, _txt); | ||
4339 | } | ||
4340 | //qDebug("Path:%s", (const char*)fi.absFilePath()); | ||
4341 | Config config(fi.absFilePath()); | ||
4342 | #endif | ||
4343 | |||
4344 | |||
4345 | config.writeEntry( "StripCr", reader->bstripcr ); | ||
4346 | config.writeEntry( "AutoFmt", reader->bautofmt ); | ||
4347 | config.writeEntry( "TextFmt", reader->btextfmt ); | ||
4348 | config.writeEntry( "StripHtml", reader->bstriphtml ); | ||
4349 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | ||
4350 | config.writeEntry( "Depluck", reader->bdepluck ); | ||
4351 | config.writeEntry( "Dejpluck", reader->bdejpluck ); | ||
4352 | config.writeEntry( "OneSpace", reader->bonespace ); | ||
4353 | config.writeEntry( "Unindent", reader->bunindent ); | ||
4354 | config.writeEntry( "Repara", reader->brepara ); | ||
4355 | config.writeEntry( "ReparaString", reader->m_reparastring); | ||
4356 | config.writeEntry( "BackgroundType" , (int)m_bgtype ); | ||
4357 | config.writeEntry( "Theme", m_themename ); | ||
4358 | config.writeEntry( "DoubleSpace", reader->bdblspce ); | ||
4359 | config.writeEntry( "Indent", reader->bindenter ); | ||
4360 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); | ||
4361 | config.writeEntry( "ScrollDelay", reader->m_delay); | ||
4362 | config.writeEntry( "ScrollStep", reader->m_scrollstep); | ||
4363 | config.writeEntry( "ScrollType", reader->m_scrolltype ); | ||
4364 | if (full) | ||
4365 | { | ||
4366 | config.writeEntry("Debounce", m_debounce); | ||
4367 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | ||
4368 | reader->m_lastposn = reader->pagelocate(); | ||
4369 | config.writeEntry( "LastFile", reader->m_lastfile ); | ||
4370 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | ||
4371 | } | ||
4372 | config.writeEntry( "PageMode", reader->m_bpagemode ); | ||
4373 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | ||
4374 | config.writeEntry( "SwapMouse", reader->m_swapmouse); | ||
4375 | config.writeEntry( "IsRotated", reader->m_rotated ); | ||
4376 | config.writeEntry("StatusContent", m_statusstring); | ||
4377 | config.writeEntry("StatusHidden", m_statusishidden); | ||
4378 | config.writeEntry( "Background", m_background ); | ||
4379 | config.writeEntry( "Foreground", m_foreground ); | ||
4380 | config.writeEntry( "ScrollColour", m_scrollcolor ); | ||
4381 | config.writeEntry( "ScrollBarColour", m_scrollbarcolor ); | ||
4382 | config.writeEntry( "Hyphenate", reader->hyphenate ); | ||
4383 | // config.writeEntry( "CustomHyphen", reader->buffdoc.getCustomHyphen() ); | ||
4384 | config.writeEntry( "Fontname", reader->m_fontname ); | ||
4385 | config.writeEntry( "Encoding", reader->m_encd ); | ||
4386 | config.writeEntry( "CharSpacing", reader->m_charpc ); | ||
4387 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); | ||
4388 | config.writeEntry( "Top Margin", (int)reader->m_abstopmargin ); | ||
4389 | config.writeEntry( "Bottom Margin", (int)reader->m_absbottommargin ); | ||
4390 | config.writeEntry( "Left Margin", (int)reader->m_absleft_border ); | ||
4391 | config.writeEntry( "Right Margin", (int)reader->m_absright_border ); | ||
4392 | config.writeEntry( "TargetApp", m_targetapp ); | ||
4393 | config.writeEntry( "TargetMsg", m_targetmsg ); | ||
4394 | #ifdef _SCROLLPIPE | ||
4395 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); | ||
4396 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | ||
4397 | #endif | ||
4398 | config.writeEntry( "TwoTouch", m_twoTouch ); | ||
4399 | config.writeEntry( "Annotation", m_doAnnotation); | ||
4400 | config.writeEntry( "Dictionary", m_doDictionary); | ||
4401 | config.writeEntry( "Clipboard", m_doClipboard); | ||
4402 | /* | ||
4403 | config.writeEntry( "SpaceTarget", m_spaceTarget); | ||
4404 | config.writeEntry( "EscapeTarget", m_escapeTarget); | ||
4405 | config.writeEntry( "ReturnTarget", m_returnTarget); | ||
4406 | config.writeEntry( "LeftTarget", m_leftTarget); | ||
4407 | config.writeEntry( "RightTarget", m_rightTarget); | ||
4408 | config.writeEntry( "UpTarget", m_upTarget); | ||
4409 | config.writeEntry( "DownTarget", m_downTarget); | ||
4410 | config.writeEntry("LeftScroll", m_leftScroll); | ||
4411 | config.writeEntry("RightScroll", m_rightScroll); | ||
4412 | config.writeEntry("UpScroll", m_upScroll); | ||
4413 | config.writeEntry("DownScroll", m_downScroll); | ||
4414 | */ | ||
4415 | config.writeEntry( "Repalm", reader->brepalm ); | ||
4416 | config.writeEntry( "HideScrollBar", m_scrollishidden ); | ||
4417 | config.writeEntry( "Kern", reader->bkern ); | ||
4418 | config.writeEntry( "Remap", reader->bremap ); | ||
4419 | config.writeEntry( "Peanut", reader->bpeanut ); | ||
4420 | config.writeEntry( "MakeBold", reader->bmakebold ); | ||
4421 | config.writeEntry( "Continuous", reader->m_continuousDocument ); | ||
4422 | config.writeEntry( "FullJust", reader->bfulljust ); | ||
4423 | // config.writeEntry( "Negative", reader->bNegative ); | ||
4424 | config.writeEntry( "Inverse", reader->bInverse ); | ||
4425 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); | ||
4426 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); | ||
4427 | config.writeEntry( "ExtraLead", reader->getlead() ); | ||
4428 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); | ||
4429 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); | ||
4430 | #ifdef USEQPE | ||
4431 | config.writeEntry( "GrabKeyboard", m_grabkeyboard ); | ||
4432 | #endif | ||
4433 | if (full) | ||
4434 | { | ||
4435 | config.setGroup( "Toolbar" ); | ||
4436 | config.writeEntry("QTScrollBar", m_qtscroll); | ||
4437 | config.writeEntry("LocalScrollBar", m_localscroll); | ||
4438 | config.writeEntry("Movable", m_tbmovesave); | ||
4439 | config.writeEntry("Policy", m_tbpolsave); | ||
4440 | config.writeEntry("Position", m_tbposition); | ||
4441 | #ifndef USEQPE | ||
4442 | if (!isMaximized() && !isMinimized()) | ||
4443 | { | ||
4444 | config.setGroup( "Geometry" ); | ||
4445 | config.writeEntry( "x", x() ); | ||
4446 | config.writeEntry( "y", y() ); | ||
4447 | config.writeEntry( "width", width() ); | ||
4448 | config.writeEntry( "height", height() ); | ||
4449 | } | ||
4450 | #endif | ||
4451 | } | ||
4452 | } | ||
4453 | |||
4454 | #ifdef _SCROLLPIPE | ||
4455 | void QTReaderApp::setpipetarget() | ||
4456 | { | ||
4457 | m_nRegAction = cSetPipeTarget; | ||
4458 | QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; | ||
4459 | regEdit->setText(text); | ||
4460 | do_regedit(); | ||
4461 | } | ||
4462 | |||
4463 | void QTReaderApp::do_setpipetarget(const QString& _txt) | ||
4464 | { | ||
4465 | reader->m_pipetarget = _txt; | ||
4466 | } | ||
4467 | |||
4468 | void QTReaderApp::setpause(bool sfs) | ||
4469 | { | ||
4470 | reader->m_pauseAfterEachPara = sfs; | ||
4471 | } | ||
4472 | #endif | ||
4473 | |||
4474 | void QTReaderApp::monospace(bool _b) | ||
4475 | { | ||
4476 | reader->setmono(_b); | ||
4477 | } | ||
4478 | |||
4479 | bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool full=false) | ||
4480 | { | ||
4481 | #ifdef USEQPE | ||
4482 | QString configname; | ||
4483 | Config::Domain dom; | ||
4484 | |||
4485 | if (full) | ||
4486 | { | ||
4487 | configname = _txt; | ||
4488 | dom = Config::User; | ||
4489 | } | ||
4490 | else | ||
4491 | { | ||
4492 | configname = Global::applicationFileName(dirname, _txt); | ||
4493 | QFileInfo fm(configname); | ||
4494 | if ( !fm.exists() ) return false; | ||
4495 | dom = Config::File; | ||
4496 | } | ||
4497 | |||
4498 | Config config(configname, dom); | ||
4499 | config.setGroup( "View" ); | ||
4500 | |||
4501 | #else | ||
4502 | QString fullname; | ||
4503 | if (full) | ||
4504 | { | ||
4505 | fullname = QDir::homeDirPath() + "/" + _txt + "/" + INIFILE; | ||
4506 | } | ||
4507 | else | ||
4508 | { | ||
4509 | fullname = QDir::homeDirPath() + "/" + dirname + "/" + _txt; | ||
4510 | } | ||
4511 | if (!QFile::exists(fullname)) return false; | ||
4512 | |||
4513 | Config config(fullname); | ||
4514 | #endif | ||
4515 | if (full) | ||
4516 | { | ||
4517 | config.setGroup("Toolbar"); | ||
4518 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave); | ||
4519 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave); | ||
4520 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition); | ||
4521 | } | ||
4522 | config.setGroup( "View" ); | ||
4523 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); | ||
4524 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); | ||
4525 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); | ||
4526 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); | ||
4527 | // reader->bNegative = config.readBoolEntry( "Negative", false ); | ||
4528 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); | ||
4529 | reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() )); | ||
4530 | reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() )); | ||
4531 | reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt ); | ||
4532 | reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt ); | ||
4533 | reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml ); | ||
4534 | reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut ); | ||
4535 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen ); | ||
4536 | reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck ); | ||
4537 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", reader->bdejpluck ); | ||
4538 | reader->bonespace = config.readBoolEntry( "OneSpace", reader->bonespace ); | ||
4539 | reader->bunindent = config.readBoolEntry( "Unindent", reader->bunindent ); | ||
4540 | reader->brepara = config.readBoolEntry( "Repara", reader->brepara ); | ||
4541 | reader->m_reparastring = config.readEntry( "ReparaString", reader->m_reparastring); | ||
4542 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , m_bgtype ); | ||
4543 | m_themename = config.readEntry("Theme", m_themename ); | ||
4544 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", reader->bdblspce ); | ||
4545 | reader->bindenter = config.readNumEntry( "Indent", reader->bindenter ); | ||
4546 | reader->m_textsize = config.readNumEntry( "FontSize", reader->m_textsize ); | ||
4547 | reader->m_delay = config.readNumEntry( "ScrollDelay", reader->m_delay); | ||
4548 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", reader->m_scrollstep); | ||
4549 | reader->m_scrolltype = config.readNumEntry( "ScrollType", reader->m_scrolltype); | ||
4550 | if (full) | ||
4551 | { | ||
4552 | reader->m_lastfile = config.readEntry( "LastFile", reader->m_lastfile ); | ||
4553 | reader->m_lastposn = config.readNumEntry( "LastPosn", reader->m_lastposn ); | ||
4554 | } | ||
4555 | reader->m_bpagemode = config.readBoolEntry( "PageMode", reader->m_bpagemode ); | ||
4556 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", reader->m_bMonoSpaced); | ||
4557 | reader->m_rotated = config.readBoolEntry( "IsRotated", reader->m_rotated ); | ||
4558 | m_statusstring = config.readEntry("StatusContent", m_statusstring); | ||
4559 | m_statusishidden = config.readBoolEntry("StatusHidden", m_statusishidden); | ||
4560 | m_background = config.readNumEntry( "Background", m_background ); | ||
4561 | reader->setBackground(getcolour(m_background)); | ||
4562 | m_foreground = config.readNumEntry( "Foreground", m_foreground ); | ||
4563 | reader->setForeground(getcolour(m_foreground)); | ||
4564 | m_scrollcolor = config.readNumEntry( "ScrollColour", m_scrollcolor); | ||
4565 | setscrollcolour(); | ||
4566 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", m_scrollbarcolor); | ||
4567 | setscrollbarcolour(); | ||
4568 | reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate ); | ||
4569 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); | ||
4570 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse); | ||
4571 | reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname ); | ||
4572 | reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd ); | ||
4573 | reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc ); | ||
4574 | reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap ); | ||
4575 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin ); | ||
4576 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); | ||
4577 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); | ||
4578 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); | ||
4579 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); | ||
4580 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); | ||
4581 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); | ||
4582 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); | ||
4583 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); | ||
4584 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); | ||
4585 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); | ||
4586 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); | ||
4587 | #ifdef _SCROLLPIPE | ||
4588 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); | ||
4589 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | ||
4590 | #endif | ||
4591 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); | ||
4592 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); | ||
4593 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); | ||
4594 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); | ||
4595 | #ifdef USEQPE | ||
4596 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); | ||
4597 | #endif | ||
4598 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); | ||
4599 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); | ||
4600 | reader->setTwoTouch(m_twoTouch); | ||
4601 | |||
4602 | m_touch_action->setOn(m_twoTouch); | ||
4603 | m_setmono_action->setOn(reader->m_bMonoSpaced); | ||
4604 | setfontHelper(reader->m_fontname); | ||
4605 | if (full) | ||
4606 | { | ||
4607 | addtoolbars(&config); | ||
4608 | } | ||
4609 | reader->setfilter(reader->getfilter()); | ||
4610 | reader->refresh(); | ||
4611 | return true; | ||
4612 | } | ||
4613 | |||
4614 | bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) | ||
4615 | { | ||
4616 | bkmkselector->clear(); | ||
4617 | bkmkselector->setText("Cancel"); | ||
4618 | #ifndef USEQPE | ||
4619 | int cnt = 0; | ||
4620 | |||
4621 | QDir d = QDir::home(); // "/" | ||
4622 | if ( !d.cd(APPDIR) ) { // "/tmp" | ||
4623 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | ||
4624 | d = QDir::home(); | ||
4625 | d.mkdir(APPDIR); | ||
4626 | d.cd(APPDIR); | ||
4627 | } | ||
4628 | if ( !d.cd(tgtdir) ) { // "/tmp" | ||
4629 | qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir ); | ||
4630 | d = QDir::home(); | ||
4631 | d.mkdir(tgtdir); | ||
4632 | d.cd(tgtdir); | ||
4633 | } | ||
4634 | d.setFilter( ((usedirs) ? QDir::Dirs : QDir::Files) | QDir::NoSymLinks ); | ||
4635 | // d.setSorting( QDir::Size | QDir::Reversed ); | ||
4636 | |||
4637 | const QFileInfoList *list = d.entryInfoList(); | ||
4638 | QFileInfoListIterator it( *list ); // create list iterator | ||
4639 | QFileInfo *fi; // pointer for traversing | ||
4640 | |||
4641 | while ( (fi=it.current()) ) { // for each file... | ||
4642 | |||
4643 | bkmkselector->insertItem(fi->fileName()); | ||
4644 | cnt++; | ||
4645 | |||
4646 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | ||
4647 | ++it; // goto next list element | ||
4648 | } | ||
4649 | |||
4650 | #else /* USEQPE */ | ||
4651 | int cnt = 0; | ||
4652 | DIR *d; | ||
4653 | char* finaldir; | ||
4654 | finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; | ||
4655 | strcpy(finaldir, APPDIR); | ||
4656 | strcat(finaldir, "/"); | ||
4657 | strcat(finaldir, tgtdir); | ||
4658 | d = opendir((const char *)Global::applicationFileName(finaldir,"")); | ||
4659 | |||
4660 | while(1) | ||
4661 | { | ||
4662 | struct dirent* de; | ||
4663 | struct stat buf; | ||
4664 | de = readdir(d); | ||
4665 | if (de == NULL) break; | ||
4666 | |||
4667 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode)))) | ||
4668 | { | ||
4669 | bkmkselector->insertItem(de->d_name); | ||
4670 | cnt++; | ||
4671 | } | ||
4672 | } | ||
4673 | delete [] finaldir; | ||
4674 | closedir(d); | ||
4675 | #endif | ||
4676 | return (cnt > 0); | ||
4677 | } | ||
4678 | |||
4679 | void QTReaderApp::LoadTheme() | ||
4680 | { | ||
4681 | if (PopulateConfig("Themes", true)) | ||
4682 | { | ||
4683 | editorStack->raiseWidget( bkmkselector ); | ||
4684 | hidetoolbars(); | ||
4685 | m_nBkmkAction = cLdTheme; | ||
4686 | } | ||
4687 | else | ||
4688 | QMessageBox::information(this, PROGNAME, "No config files"); | ||
4689 | } | ||
4690 | |||
4691 | void QTReaderApp::LoadConfig() | ||
4692 | { | ||
4693 | if (PopulateConfig("configs")) | ||
4694 | { | ||
4695 | editorStack->raiseWidget( bkmkselector ); | ||
4696 | hidetoolbars(); | ||
4697 | m_nBkmkAction = cLdConfig; | ||
4698 | } | ||
4699 | else | ||
4700 | QMessageBox::information(this, PROGNAME, "No config files"); | ||
4701 | } | ||
4702 | |||
4703 | void QTReaderApp::TidyConfig() | ||
4704 | { | ||
4705 | if (PopulateConfig("configs")) | ||
4706 | { | ||
4707 | editorStack->raiseWidget( bkmkselector ); | ||
4708 | hidetoolbars(); | ||
4709 | m_nBkmkAction = cRmConfig; | ||
4710 | } | ||
4711 | else | ||
4712 | QMessageBox::information(this, PROGNAME, "No config files"); | ||
4713 | } | ||
4714 | |||
4715 | void QTReaderApp::ExportLinks() | ||
4716 | { | ||
4717 | if (PopulateConfig("urls")) | ||
4718 | { | ||
4719 | editorStack->raiseWidget( bkmkselector ); | ||
4720 | hidetoolbars(); | ||
4721 | m_nBkmkAction = cExportLinks; | ||
4722 | } | ||
4723 | else | ||
4724 | QMessageBox::information(this, PROGNAME, "No url files"); | ||
4725 | } | ||
4726 | |||
4727 | void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt) | ||
4728 | { | ||
4729 | #ifndef USEQPE | ||
4730 | qDebug("URL:%s", (const char*)href); | ||
4731 | int col = href.find(':'); | ||
4732 | if (col > 0) | ||
4733 | { | ||
4734 | QString type = href.left(col); | ||
4735 | qDebug("Type:%s", (const char*)type); | ||
4736 | } | ||
4737 | else | ||
4738 | { | ||
4739 | qDebug("No type"); | ||
4740 | } | ||
4741 | #else | ||
4742 | if (href.isEmpty()) | ||
4743 | { | ||
4744 | QMessageBox::information(this, PROGNAME, "No URL information supplied"); | ||
4745 | } | ||
4746 | else | ||
4747 | { | ||
4748 | CURLDialog* urld = new CURLDialog(href, false, this); | ||
4749 | urld->clipboard(m_url_clipboard); | ||
4750 | urld->localfile(m_url_localfile); | ||
4751 | urld->globalfile(m_url_globalfile); | ||
4752 | if (urld->exec()) | ||
4753 | { | ||
4754 | m_url_clipboard = urld->clipboard(); | ||
4755 | m_url_localfile = urld->localfile(); | ||
4756 | m_url_globalfile = urld->globalfile(); | ||
4757 | if (m_url_clipboard) | ||
4758 | { | ||
4759 | QClipboard* cb = QApplication::clipboard(); | ||
4760 | cb->setText(href); | ||
4761 | qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href); | ||
4762 | } | ||
4763 | if (m_url_localfile) | ||
4764 | { | ||
4765 | writeUrl(reader->m_string, href); | ||
4766 | } | ||
4767 | if (m_url_globalfile) | ||
4768 | { | ||
4769 | writeUrl("GlobalURLFile", href); | ||
4770 | } | ||
4771 | } | ||
4772 | delete urld; | ||
4773 | } | ||
4774 | #endif | ||
4775 | } | ||
4776 | |||
4777 | void QTReaderApp::writeUrl(const QString& file, const QString& href) | ||
4778 | { | ||
4779 | QString filename; | ||
4780 | #ifdef USEQPE | ||
4781 | filename = Global::applicationFileName(APPDIR "/urls", file); | ||
4782 | #else | ||
4783 | QFileInfo fi; | ||
4784 | QDir d = QDir::home(); // "/" | ||
4785 | if ( !d.cd(APPDIR) ) | ||
4786 | { // "/tmp" | ||
4787 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | ||
4788 | d = QDir::home(); | ||
4789 | d.mkdir(APPDIR); | ||
4790 | d.cd(APPDIR); | ||
4791 | } | ||
4792 | if ( !d.cd("urls") ) | ||
4793 | { // "/tmp" | ||
4794 | qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" ); | ||
4795 | d = QDir::home(); | ||
4796 | d.cd(APPDIR); | ||
4797 | d.mkdir("urls"); | ||
4798 | d.cd("urls"); | ||
4799 | } | ||
4800 | fi.setFile(d, file); | ||
4801 | filename = fi.absFilePath(); | ||
4802 | #endif | ||
4803 | FILE* fout = fopen(filename, "a"); | ||
4804 | if (fout != NULL) | ||
4805 | { | ||
4806 | fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href); | ||
4807 | fclose(fout); | ||
4808 | } | ||
4809 | else | ||
4810 | { | ||
4811 | QMessageBox::warning(this, PROGNAME, "Problem with writing URL"); | ||
4812 | } | ||
4813 | } | ||
4814 | |||
4815 | QColor QTReaderApp::getcolour(int _c) | ||
4816 | { | ||
4817 | QColor c = white; | ||
4818 | switch (_c) | ||
4819 | { | ||
4820 | case 0: | ||
4821 | c = white; | ||
4822 | break; | ||
4823 | case 1: | ||
4824 | c = black; | ||
4825 | break; | ||
4826 | case 2: | ||
4827 | c = darkGray; | ||
4828 | break; | ||
4829 | case 3: | ||
4830 | c = gray; | ||
4831 | break; | ||
4832 | case 4: | ||
4833 | c = lightGray; | ||
4834 | break; | ||
4835 | case 5: | ||
4836 | c = red; | ||
4837 | break; | ||
4838 | case 6: | ||
4839 | c = green; | ||
4840 | break; | ||
4841 | case 7: | ||
4842 | c = blue; | ||
4843 | break; | ||
4844 | case 8: | ||
4845 | c = cyan; | ||
4846 | break; | ||
4847 | case 9: | ||
4848 | c = magenta; | ||
4849 | break; | ||
4850 | case 10: | ||
4851 | c = yellow; | ||
4852 | break; | ||
4853 | case 11: | ||
4854 | c = darkRed; | ||
4855 | break; | ||
4856 | case 12: | ||
4857 | c = darkGreen; | ||
4858 | break; | ||
4859 | case 13: | ||
4860 | c = darkBlue; | ||
4861 | break; | ||
4862 | case 14: | ||
4863 | c = darkCyan; | ||
4864 | break; | ||
4865 | case 15: | ||
4866 | c = darkMagenta; | ||
4867 | break; | ||
4868 | case 16: | ||
4869 | c = darkYellow; | ||
4870 | break; | ||
4871 | default: | ||
4872 | c = lightGray; | ||
4873 | break; | ||
4874 | } | ||
4875 | return c; | ||
4876 | } | ||
4877 | |||
4878 | void QTReaderApp::setscrollcolour() | ||
4879 | { | ||
4880 | /* | ||
4881 | QColor xc = getcolour(m_scrollcolor); | ||
4882 | int r,g,b; | ||
4883 | xc.rgb(&r,&g,&b); | ||
4884 | reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b); | ||
4885 | */ | ||
4886 | reader->m_scrollcolor = getcolour(m_scrollcolor); | ||
4887 | } | ||
4888 | |||
4889 | void QTReaderApp::setscrollbarcolour() | ||
4890 | { | ||
4891 | /* | ||
4892 | QColor xc = getcolour(m_scrollcolor); | ||
4893 | int r,g,b; | ||
4894 | xc.rgb(&r,&g,&b); | ||
4895 | reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b); | ||
4896 | */ | ||
4897 | reader->m_scrollbarcolor = getcolour(m_scrollbarcolor); | ||
4898 | } | ||
4899 | |||
4900 | void QTReaderApp::forceopen(const QString& filename) | ||
4901 | { | ||
4902 | /* | ||
4903 | QFileInfo fi(reader->m_lastfile); | ||
4904 | fi = QFileInfo(filename); | ||
4905 | QString flnm = fi.absFilePath(); | ||
4906 | */ | ||
4907 | if (!filename.isEmpty()) | ||
4908 | { | ||
4909 | updatefileinfo(); | ||
4910 | if (pBkmklist != NULL) | ||
4911 | { | ||
4912 | if (m_fBkmksChanged) | ||
4913 | { | ||
4914 | savebkmks(); | ||
4915 | } | ||
4916 | delete pBkmklist; | ||
4917 | pBkmklist = NULL; | ||
4918 | m_fBkmksChanged = false; | ||
4919 | } | ||
4920 | reader->disableAutoscroll(); | ||
4921 | openFile(filename); | ||
4922 | reader->setFocus(); | ||
4923 | } | ||
4924 | } | ||
4925 | |||
4926 | void QTReaderApp::actionscroll(int v) | ||
4927 | { | ||
4928 | if (reader->m_rotated) | ||
4929 | { | ||
4930 | reader->dopageup(reader->buffdoc.startSection()+reader->buffdoc.endSection()-v); | ||
4931 | } | ||
4932 | else | ||
4933 | { | ||
4934 | /* | ||
4935 | if (reader->pagelocate() < v) | ||
4936 | { | ||
4937 | while (reader->pagelocate() < v) reader->lineDown(); | ||
4938 | } | ||
4939 | else | ||
4940 | */ | ||
4941 | reader->locate(v); | ||
4942 | } | ||
4943 | } | ||
4944 | |||
4945 | void QTReaderApp::setBackgroundBitmap() | ||
4946 | { | ||
4947 | #ifdef USEQPE | ||
4948 | QString file = APPDIR "/Themes/"; | ||
4949 | file += m_themename; | ||
4950 | QString tgt = Global::applicationFileName(file,"background"); | ||
4951 | #else | ||
4952 | QString tgt(QDir::homeDirPath()); | ||
4953 | tgt += QString("/" APPDIR "/Themes/") + m_themename + "/background"; | ||
4954 | #endif | ||
4955 | qDebug("Trying to load %s", (const char *)tgt); | ||
4956 | QPixmap pm(tgt); | ||
4957 | reader->setBackgroundBitmap(pm, m_bgtype); | ||
4958 | } | ||
4959 | |||
4960 | /* | ||
4961 | |||
4962 | myChannel = new QCopChannel( "QPE/FooBar", this ); | ||
4963 | connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), | ||
4964 | this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); | ||
4965 | |||
4966 | */ | ||
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h index fe3eebf..5ecc42d 100644 --- a/noncore/apps/opie-reader/QTReaderApp.h +++ b/noncore/apps/opie-reader/QTReaderApp.h | |||
@@ -36,18 +36,25 @@ | |||
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qstack.h> | 38 | #include <qstack.h> |
39 | #include <qlistbox.h> | 39 | #include <qlistbox.h> |
40 | #ifdef USEQPE | ||
41 | #include <qpe/qpeapplication.h> | ||
42 | #endif | ||
43 | #include "orkey.h" | ||
40 | //#include "Queue.h" | 44 | //#include "Queue.h" |
45 | #include "BGType.h" | ||
41 | 46 | ||
47 | class QBoxLayout; | ||
42 | class QWidgetStack; | 48 | class QWidgetStack; |
43 | class QToolButton; | 49 | class QToolButton; |
44 | class QPopupMenu; | 50 | class QPopupMenu; |
45 | class QToolBar; | 51 | class QToolBar; |
46 | #ifdef USEQPE | 52 | #ifdef USEQPE |
47 | class QToolBar; | 53 | class QPEToolBar; |
48 | class QMenuBar; | 54 | class QPEMenuBar; |
49 | #endif | 55 | #endif |
56 | class QScrollBar; | ||
50 | class CBkmkSelector; | 57 | class CBkmkSelector; |
51 | class QProgressBar; | 58 | class QProgressBar; |
52 | class QAction; | 59 | class QAction; |
53 | class CAnnoEdit; | 60 | class CAnnoEdit; |
@@ -55,42 +62,24 @@ class QFloatBar; | |||
55 | class CDrawBuffer; | 62 | class CDrawBuffer; |
56 | class QTReader; | 63 | class QTReader; |
57 | class QImage; | 64 | class QImage; |
58 | class Config; | 65 | class Config; |
66 | class CButtonPrefs; | ||
59 | 67 | ||
60 | enum ActionTypes | 68 | #ifdef USEQPE |
61 | { | ||
62 | cesNone = 0, | ||
63 | cesOpenFile, | ||
64 | cesAutoScroll, | ||
65 | cesActionMark, | ||
66 | cesActionAnno, | ||
67 | cesFullScreen, | ||
68 | cesZoomIn, | ||
69 | cesZoomOut, | ||
70 | cesBack, | ||
71 | cesForward, | ||
72 | cesHome, | ||
73 | cesPageUp, | ||
74 | cesPageDown, | ||
75 | cesLineUp, | ||
76 | cesLineDown, | ||
77 | cesStartDoc, | ||
78 | cesEndDoc | ||
79 | }; | ||
80 | /* | ||
81 | *m_preferences_action, *m_close_action *m_info_action, *m_touch_action, | ||
82 | *m_find_action, *m_jump_action, *m_setfont_action *m_goto_action, | ||
83 | *m_delete_action; *m_autogen_action, *m_clear_action, *m_save_action; | ||
84 | *m_tidy_action, *m_startBlock_action, *m_endBlock_action; | ||
85 | *m_setenc_action, *m_setmono_action; | ||
86 | */ | ||
87 | enum ToolbarPolicy | 69 | enum ToolbarPolicy |
88 | { | 70 | { |
89 | cesSingle = 0, | 71 | cesSingle = 0, |
90 | cesMenuTool, | 72 | cesMenuTool, |
91 | cesMultiple | 73 | cesMultiple |
92 | }; | 74 | }; |
75 | #else | ||
76 | enum ToolbarPolicy | ||
77 | { | ||
78 | cesMenuTool = 0, | ||
79 | cesMultiple | ||
80 | }; | ||
81 | #endif | ||
93 | 82 | ||
94 | enum regedit_type | 83 | enum regedit_type |
95 | { | 84 | { |
96 | cAutoGen, | 85 | cAutoGen, |
@@ -103,9 +92,10 @@ enum regedit_type | |||
103 | #endif | 92 | #endif |
104 | cSetConfigName, | 93 | cSetConfigName, |
105 | cMargin, | 94 | cMargin, |
106 | cExtraSpace, | 95 | cExtraSpace, |
107 | cExtraLead | 96 | cExtraLead, |
97 | cRepara | ||
108 | }; | 98 | }; |
109 | 99 | ||
110 | enum bkmk_action | 100 | enum bkmk_action |
111 | { | 101 | { |
@@ -114,9 +104,10 @@ enum bkmk_action | |||
114 | cDelBkmk, | 104 | cDelBkmk, |
115 | cRmBkmkFile, | 105 | cRmBkmkFile, |
116 | cLdConfig, | 106 | cLdConfig, |
117 | cRmConfig, | 107 | cRmConfig, |
118 | cExportLinks | 108 | cExportLinks, |
109 | cLdTheme | ||
119 | }; | 110 | }; |
120 | 111 | ||
121 | enum fontselector_action | 112 | enum fontselector_action |
122 | { | 113 | { |
@@ -139,118 +130,164 @@ class GraphicWin; | |||
139 | class QTReaderApp : public QMainWindow | 130 | class QTReaderApp : public QMainWindow |
140 | { | 131 | { |
141 | Q_OBJECT | 132 | Q_OBJECT |
142 | 133 | ||
134 | QColor getcolour(int c); | ||
135 | |||
136 | QMap<orKey, int> kmap; | ||
143 | unsigned long m_savedpos; | 137 | unsigned long m_savedpos; |
144 | int m_debounce; | 138 | int m_debounce; |
139 | bool m_kmapchanged; | ||
140 | bground m_bgtype; | ||
145 | timeb m_lastkeytime; | 141 | timeb m_lastkeytime; |
142 | QScrollBar* m_scrollbar; | ||
143 | QScrollBar* scrollbar; | ||
144 | int m_qtscroll, m_localscroll; | ||
145 | bool m_hidebars, m_scrollishidden, m_statusishidden; | ||
146 | QBoxLayout *m_layout; | ||
147 | QLabel* m_prog; | ||
146 | bool m_annoIsEditing; | 148 | bool m_annoIsEditing; |
147 | bool m_propogatefontchange, m_bFloatingDialog; | 149 | bool m_propogatefontchange, m_bFloatingDialog; |
148 | bool m_url_clipboard, m_url_localfile, m_url_globalfile; | 150 | bool m_url_clipboard, m_url_localfile, m_url_globalfile; |
151 | CButtonPrefs* m_buttonprefs; | ||
149 | fontselector_action m_fontAction; | 152 | fontselector_action m_fontAction; |
150 | void doAction(ActionTypes a, QKeyEvent* e); | 153 | void doAction(QKeyEvent* e); |
151 | 154 | ||
152 | public: | 155 | public: |
153 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 156 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
154 | ~QTReaderApp(); | 157 | ~QTReaderApp(); |
155 | 158 | ||
156 | void handlekey(QKeyEvent* e); | ||
157 | void hideEvent(QHideEvent*) | 159 | void hideEvent(QHideEvent*) |
158 | { | 160 | { |
159 | suspend(); | 161 | #ifdef USEQPE |
160 | } | 162 | if (m_grabkeyboard) |
161 | 163 | { | |
164 | ((QPEApplication*)qApp)->ungrabKeyboard(); | ||
165 | } | ||
166 | #endif | ||
167 | suspend(); | ||
168 | } | ||
169 | #ifdef USEQPE | ||
170 | void showEvent(QShowEvent*) | ||
171 | { | ||
172 | if (m_grabkeyboard) | ||
173 | { | ||
174 | ((QPEApplication*)qApp)->grabKeyboard(); | ||
175 | } | ||
176 | } | ||
177 | #endif | ||
162 | void suspend(); | 178 | void suspend(); |
163 | void openFile( const QString & ); | 179 | void openFile( const QString & ); |
164 | 180 | ||
165 | void setScrollState(bool _b); | ||
166 | 181 | ||
167 | protected: | 182 | protected: |
168 | void setfontHelper(const QString& lcn, int size = 0); | 183 | void setfontHelper(const QString& lcn, int size = 0); |
169 | QAction* m_bkmkAvail, *m_actFullscreen; | 184 | QAction* m_bkmkAvail, *m_actFullscreen; |
170 | CAnnoEdit* m_annoWin; | 185 | CAnnoEdit* m_annoWin; |
171 | Bkmk* m_anno; | 186 | Bkmk* m_anno; |
187 | int m_scrollcolor, m_scrollbarcolor, m_background, m_foreground; | ||
172 | // void resizeEvent(QResizeEvent* e); | 188 | // void resizeEvent(QResizeEvent* e); |
173 | void closeEvent( QCloseEvent *e ); | 189 | void closeEvent( QCloseEvent *e ); |
174 | void readbkmks(); | 190 | #ifdef NEWFULLSCREEN |
175 | void do_mono(const QString&); | 191 | void resizeEvent(QResizeEvent *); |
176 | void do_jump(const QString&); | 192 | void focusInEvent(QFocusEvent*); |
177 | void do_settarget(const QString&); | 193 | void enableFullscreen(); |
194 | #endif | ||
195 | void readbkmks(); | ||
196 | void do_mono(const QString&); | ||
197 | void do_jump(const QString&); | ||
198 | void do_reparastring(const QString&); | ||
199 | void do_settarget(const QString&); | ||
178 | #ifdef _SCROLLPIPE | 200 | #ifdef _SCROLLPIPE |
179 | // void do_setpipetarget(const QString&); | 201 | //void do_setpipetarget(const QString&); |
202 | #endif | ||
203 | void do_saveconfig(const QString&, bool); | ||
204 | bool readconfig(const QString&, const QString&, bool); | ||
205 | bool PopulateConfig(const char*, bool usedirs = false); | ||
206 | ActionTypes ActNameToInt(const QString&); | ||
207 | #ifdef USEQPE | ||
208 | bool m_grabkeyboard; | ||
180 | #endif | 209 | #endif |
181 | void do_saveconfig(const QString&, bool); | ||
182 | bool readconfig(const QString&, bool); | ||
183 | bool PopulateConfig(const char*); | ||
184 | ActionTypes ActNameToInt(const QString&); | ||
185 | bool m_doAnnotation; | 210 | bool m_doAnnotation; |
186 | bool m_doDictionary; | 211 | bool m_doDictionary; |
187 | bool m_doClipboard; | 212 | bool m_doClipboard; |
188 | bool m_fullscreen; | 213 | bool m_fullscreen; |
189 | bool m_loadedconfig; | 214 | bool m_loadedconfig; |
190 | public: | 215 | public: |
191 | void saveprefs(); | 216 | void saveprefs(); |
192 | public slots: | 217 | public slots: |
218 | void setBackgroundBitmap(); | ||
219 | void UpdateStatus(); | ||
220 | void setScrollState(bool _b); | ||
221 | void handlekey(QKeyEvent* e); | ||
222 | void forceopen(const QString& filename); | ||
193 | void setDocument(const QString&); | 223 | void setDocument(const QString&); |
194 | private slots: | 224 | private slots: |
195 | #ifdef _SCRIPT | 225 | #ifdef _SCRIPT |
196 | // void RunScript(); | 226 | // void RunScript(); |
197 | #endif | 227 | #endif |
228 | void actionscroll(int v); | ||
198 | void SaveConfig(); | 229 | void SaveConfig(); |
230 | void LoadTheme(); | ||
199 | void LoadConfig(); | 231 | void LoadConfig(); |
200 | void TidyConfig(); | 232 | void TidyConfig(); |
201 | void ExportLinks(); | 233 | void ExportLinks(); |
202 | void zoomin(); | 234 | void zoomin(); |
203 | void zoomout(); | 235 | void zoomout(); |
204 | void chooseencoding(); | 236 | void chooseencoding(); |
205 | void setfullscreen(bool sfs); | 237 | void setfullscreen(bool sfs); |
238 | void setrotated(bool sfs); | ||
239 | void setinverted(bool sfs); | ||
240 | void setgrab(bool sfs); | ||
206 | // void setcontinuous(bool sfs); | 241 | // void setcontinuous(bool sfs); |
207 | void setTwoTouch(bool _b); | 242 | void setTwoTouch(bool _b); |
208 | void restoreFocus(); | 243 | void restoreFocus(); |
209 | void OnAnnotation(bool _b) | 244 | void OnAnnotation(bool _b) |
210 | { | 245 | { |
211 | m_doAnnotation = _b; | 246 | m_doAnnotation = _b; |
212 | } | 247 | } |
213 | void OnDictionary(bool _b) | 248 | void OnDictionary(bool _b) |
214 | { | 249 | { |
215 | m_doDictionary = _b; | 250 | m_doDictionary = _b; |
216 | } | 251 | } |
217 | void OnClipboard(bool _b) | 252 | void OnClipboard(bool _b) |
218 | { | 253 | { |
219 | m_doClipboard = _b; | 254 | m_doClipboard = _b; |
220 | } | 255 | } |
221 | void OnWordSelected(const QString&, size_t, const QString&); | 256 | void OnWordSelected(const QString&, size_t, size_t, const QString&); |
222 | void OnURLSelected(const QString& href); | 257 | void OnURLSelected(const QString& href, const size_t tgt); |
223 | void showgraphic(QImage&); | 258 | void showgraphic(QImage&); |
224 | void addAnno(const QString&, const QString&, size_t); | 259 | void addAnno(const QString&, const QString&, size_t, size_t); |
225 | void addAnno(const QString&, const QString&); | 260 | void addAnno(const QString&, const QString&); |
226 | void addanno(); | 261 | void addanno(); |
227 | void showAnnotation(); | 262 | void showAnnotation(); |
228 | void do_setencoding(int i); | 263 | void do_setencoding(int i); |
229 | void do_setfont(const QString&); | 264 | void do_setfont(const QString&); |
230 | void buttonActionSelected(QAction*); | 265 | //void buttonActionSelected(QAction*); |
231 | // void msgHandler(const QCString&, const QByteArray&); | 266 | void msgHandler(const QCString&, const QByteArray&); |
232 | void monospace(bool); | 267 | void monospace(bool); |
233 | void jump(); | 268 | void jump(); |
234 | void settarget(); | 269 | void reparastring(); |
270 | void settarget(); | ||
235 | #ifdef _SCROLLPIPE | 271 | #ifdef _SCROLLPIPE |
236 | // void setpipetarget(); | 272 | //void setpipetarget(); |
237 | // void setpause(bool); | 273 | //void setpause(bool); |
238 | #endif | 274 | #endif |
239 | // void setspacing(); | 275 | //void setspacing(); |
240 | void setfont(); | 276 | void setfont(); |
241 | void clearBkmkList(); | 277 | void clearBkmkList(); |
242 | void listBkmkFiles(); | 278 | void listBkmkFiles(); |
243 | void editMark(); | 279 | void editMark(); |
244 | void autoScroll(bool); | 280 | void autoScroll(bool); |
245 | void addbkmk(); | 281 | void addbkmk(); |
246 | void savebkmks(); | 282 | void savebkmks(); |
247 | // void importFiles(); | 283 | //void importFiles(); |
248 | void showprefs(); | 284 | void showprefs(); |
249 | void showtoolbarprefs(); | 285 | void showtoolbarprefs(); |
250 | void infoClose(); | 286 | void showbuttonprefs(); |
251 | // void oldFile(); | 287 | void infoClose(); |
252 | void showinfo(); | 288 | // void oldFile(); |
289 | void showinfo(); | ||
253 | 290 | ||
254 | // void indentplus(); | 291 | // void indentplus(); |
255 | // void indentminus(); | 292 | // void indentminus(); |
256 | 293 | ||
@@ -281,11 +318,9 @@ private slots: | |||
281 | 318 | ||
282 | // void stripcr(bool); | 319 | // void stripcr(bool); |
283 | // void setfulljust(bool); | 320 | // void setfulljust(bool); |
284 | // void onespace(bool); | 321 | // void onespace(bool); |
285 | #ifdef REPALM | ||
286 | // void repalm(bool); | 322 | // void repalm(bool); |
287 | #endif | ||
288 | // void peanut(bool _b); | 323 | // void peanut(bool _b); |
289 | // void remap(bool); | 324 | // void remap(bool); |
290 | // void embolden(bool); | 325 | // void embolden(bool); |
291 | // void autofmt(bool); | 326 | // void autofmt(bool); |
@@ -307,8 +342,10 @@ private slots: | |||
307 | void do_regaction(); | 342 | void do_regaction(); |
308 | void OnRedraw(); | 343 | void OnRedraw(); |
309 | 344 | ||
310 | private: | 345 | private: |
346 | void setscrollcolour(); | ||
347 | void setscrollbarcolour(); | ||
311 | void writeUrl(const QString& file, const QString& href); | 348 | void writeUrl(const QString& file, const QString& href); |
312 | QAction *m_preferences_action, *m_open_action, *m_close_action; | 349 | QAction *m_preferences_action, *m_open_action, *m_close_action; |
313 | QAction *m_info_action, *m_touch_action, *m_find_action, *m_start_action; | 350 | QAction *m_info_action, *m_touch_action, *m_find_action, *m_start_action; |
314 | QAction *m_end_action, *m_jump_action, *m_pageline_action; | 351 | QAction *m_end_action, *m_jump_action, *m_pageline_action; |
@@ -318,10 +355,14 @@ private slots: | |||
318 | QAction *m_annotate_action, *m_goto_action, *m_delete_action; | 355 | QAction *m_annotate_action, *m_goto_action, *m_delete_action; |
319 | QAction *m_autogen_action, *m_clear_action, *m_save_action; | 356 | QAction *m_autogen_action, *m_clear_action, *m_save_action; |
320 | QAction *m_tidy_action, *m_startBlock_action, *m_endBlock_action; | 357 | QAction *m_tidy_action, *m_startBlock_action, *m_endBlock_action; |
321 | QAction *m_setenc_action, *m_setmono_action, *m_saveconfig_action; | 358 | QAction *m_setenc_action, *m_setmono_action, *m_saveconfig_action; |
322 | QAction *m_loadconfig_action, *m_toolbarprefs_action, *m_tidyconfig_action; | 359 | QAction *m_loadconfig_action, *m_loadtheme_action, *m_toolbarprefs_action, *m_tidyconfig_action; |
323 | QAction *m_exportlinks_action; | 360 | QAction *m_exportlinks_action, *m_rotate_action, *m_buttonprefs_action, *m_inverse_action; |
361 | QAction *m_repara_action; | ||
362 | #ifdef USEQPE | ||
363 | QAction *m_grab_action; | ||
364 | #endif | ||
324 | void addtoolbars(Config* config); | 365 | void addtoolbars(Config* config); |
325 | ToolbarPolicy m_tbpol, m_tbpolsave; | 366 | ToolbarPolicy m_tbpol, m_tbpolsave; |
326 | ToolBarDock m_tbposition; | 367 | ToolBarDock m_tbposition; |
327 | bool m_tbmove, m_tbmovesave; | 368 | bool m_tbmove, m_tbmovesave; |
@@ -346,9 +387,9 @@ private slots: | |||
346 | void readfilelist(); | 387 | void readfilelist(); |
347 | void savefilelist(); | 388 | void savefilelist(); |
348 | void updatefileinfo(); | 389 | void updatefileinfo(); |
349 | bool openfrombkmk(Bkmk*); | 390 | bool openfrombkmk(Bkmk*); |
350 | QString m_targetapp, m_targetmsg; | 391 | QString m_targetapp, m_targetmsg, m_statusstring, m_themename; |
351 | bool listbkmk(CList<Bkmk>*, const QString& _lab = QString::null); | 392 | bool listbkmk(CList<Bkmk>*, const QString& _lab = QString::null); |
352 | QString usefilebrowser(); | 393 | QString usefilebrowser(); |
353 | void do_regedit(); | 394 | void do_regedit(); |
354 | void colorChanged( const QColor &c ); | 395 | void colorChanged( const QColor &c ); |
@@ -365,11 +406,11 @@ private slots: | |||
365 | QAction* m_buttonAction[MAX_ACTIONS]; | 406 | QAction* m_buttonAction[MAX_ACTIONS]; |
366 | 407 | ||
367 | CBkmkSelector* bkmkselector; | 408 | CBkmkSelector* bkmkselector; |
368 | 409 | ||
369 | ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget, | 410 | // ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget, |
370 | m_upTarget, m_downTarget; | 411 | //m_upTarget, m_downTarget; |
371 | bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll; | 412 | //bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll; |
372 | bool m_bcloseDisabled, m_disableesckey; | 413 | bool m_bcloseDisabled, m_disableesckey; |
373 | size_t searchStart; | 414 | size_t searchStart; |
374 | #ifdef __ISEARCH | 415 | #ifdef __ISEARCH |
375 | QStack<searchrecord>* searchStack; | 416 | QStack<searchrecord>* searchStack; |
@@ -379,12 +420,15 @@ private slots: | |||
379 | #endif | 420 | #endif |
380 | QWidgetStack *editorStack; | 421 | QWidgetStack *editorStack; |
381 | QTReader* reader; | 422 | QTReader* reader; |
382 | QComboBox* m_fontSelector; | 423 | QComboBox* m_fontSelector; |
383 | // QToolBar /* *menu,*/ *fileBar; | 424 | // QPEToolBar /* *menu,*/ *fileBar; |
384 | QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar; | ||
385 | #ifdef USEQPE | 425 | #ifdef USEQPE |
386 | QMenuBar *mb; | 426 | QToolBar *menubar; |
427 | #endif | ||
428 | QToolBar *fileBar, *navBar, *viewBar, *markBar; | ||
429 | #ifdef USEQPE | ||
430 | QPEMenuBar *mb; | ||
387 | #else | 431 | #else |
388 | QMenuBar *mb; | 432 | QMenuBar *mb; |
389 | #endif | 433 | #endif |
390 | QFloatBar *searchBar, *regBar/*, *m_fontBar*/; | 434 | QFloatBar *searchBar, *regBar/*, *m_fontBar*/; |
@@ -392,16 +436,15 @@ private slots: | |||
392 | QLineEdit *searchEdit, *regEdit; | 436 | QLineEdit *searchEdit, *regEdit; |
393 | bool searchVisible; | 437 | bool searchVisible; |
394 | bool regVisible; | 438 | bool regVisible; |
395 | bool m_fontVisible, m_twoTouch; | 439 | bool m_fontVisible, m_twoTouch; |
396 | bool bFromDocView; | ||
397 | static unsigned long m_uid; | 440 | static unsigned long m_uid; |
398 | long unsigned get_unique_id() { return m_uid++; } | 441 | long unsigned get_unique_id() { return m_uid++; } |
399 | /* | 442 | /* |
400 | void resizeEvent( QResizeEvent * r) | 443 | void resizeEvent( QResizeEvent * r) |
401 | { | 444 | { |
402 | // odebug << "resize:(" << r->oldSize().width() << "," << r->oldSize().height() << ")" << oendl; | 445 | // qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); |
403 | // odebug << "resize:(" << r->size().width() << "," << r->size().height() << ")" << oendl; | 446 | // qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); |
404 | // bgroup->move( width()-bgroup->width(), 0 ); | 447 | // bgroup->move( width()-bgroup->width(), 0 ); |
405 | } | 448 | } |
406 | */ | 449 | */ |
407 | CList<Bkmk>* pBkmklist; | 450 | CList<Bkmk>* pBkmklist; |
diff --git a/noncore/apps/opie-reader/Queue.h b/noncore/apps/opie-reader/Queue.h index f1bd4b4..321042e 100644 --- a/noncore/apps/opie-reader/Queue.h +++ b/noncore/apps/opie-reader/Queue.h | |||
@@ -6,16 +6,8 @@ | |||
6 | template<class T> | 6 | template<class T> |
7 | class CQueue : public CList<T> | 7 | class CQueue : public CList<T> |
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | bool empty() { return (front == NULL); } | 10 | bool empty() { return (CList<T>::front == NULL); } |
11 | void push(const T& t) { push_back(t); } | 11 | void push(const T& t) { push_back(t); } |
12 | T pop() | ||
13 | { | ||
14 | T data = front->data; | ||
15 | node* n = front; | ||
16 | front = front->next; | ||
17 | delete n; | ||
18 | return data; | ||
19 | } | ||
20 | }; | 12 | }; |
21 | #endif | 13 | #endif |
diff --git a/noncore/apps/opie-reader/StateData.h b/noncore/apps/opie-reader/StateData.h deleted file mode 100644 index e3be778..0000000 --- a/noncore/apps/opie-reader/StateData.h +++ b/dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #ifndef __STATEDATA_H | ||
2 | #define __STATEDATA_H | ||
3 | |||
4 | struct statedata | ||
5 | { | ||
6 | bool bstripcr/*:1*/; | ||
7 | bool btextfmt/*:1*/; | ||
8 | bool bautofmt/*:1*/; | ||
9 | bool bstriphtml/*:1*/; | ||
10 | bool bpeanut/*:1*/; | ||
11 | bool bdehyphen/*:1*/; | ||
12 | bool bdepluck/*:1*/; | ||
13 | bool bonespace/*:1*/; | ||
14 | bool bunindent/*:1*/; | ||
15 | bool brepara/*:1*/; | ||
16 | bool bdblspce/*:1*/; | ||
17 | bool m_bpagemode/*:1*/; | ||
18 | bool m_navkeys/*:1*/; | ||
19 | bool m_bMonoSpaced/*:1*/; | ||
20 | bool bremap/*:1*/; | ||
21 | bool bmakebold/*:1*/; | ||
22 | bool Continuous/*:1*/; | ||
23 | #ifdef REPALM | ||
24 | bool brepalm/*:1*/; | ||
25 | #endif | ||
26 | int bindenter; | ||
27 | int m_textsize; | ||
28 | int m_encd; | ||
29 | int m_charpc; | ||
30 | char m_fontname[1]; | ||
31 | }; | ||
32 | |||
33 | #endif | ||
diff --git a/noncore/apps/opie-reader/StyleConsts.cpp b/noncore/apps/opie-reader/StyleConsts.cpp index f47acee..77c9d3b 100644 --- a/noncore/apps/opie-reader/StyleConsts.cpp +++ b/noncore/apps/opie-reader/StyleConsts.cpp | |||
@@ -5,9 +5,9 @@ | |||
5 | GraphicLink::~GraphicLink() { delete graphic; } | 5 | GraphicLink::~GraphicLink() { delete graphic; } |
6 | 6 | ||
7 | pmstore::~pmstore() | 7 | pmstore::~pmstore() |
8 | { | 8 | { |
9 | //// odebug << "Deleting image" << oendl; | 9 | //// qDebug("Deleting image"); |
10 | delete graphic; | 10 | delete graphic; |
11 | } | 11 | } |
12 | 12 | ||
13 | CStyle::~CStyle() | 13 | CStyle::~CStyle() |
@@ -91,4 +91,18 @@ void CStyle::setPicture(bool canScale, QImage* _g, bool il, unsigned long tgt) | |||
91 | graphic = NULL; | 91 | graphic = NULL; |
92 | } | 92 | } |
93 | if (_g != NULL) graphic = new pmstore(canScale, _g, il, tgt); | 93 | if (_g != NULL) graphic = new pmstore(canScale, _g, il, tgt); |
94 | } | 94 | } |
95 | |||
96 | void CStyle::invert() | ||
97 | { | ||
98 | qDebug("Before:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue); | ||
99 | qDebug("Before:<%02x%02x%02x>", sty.red, sty.green, sty.blue); | ||
100 | sty.bred = 255-sty.bred; | ||
101 | sty.bgreen = 255-sty.bgreen; | ||
102 | sty.bblue = 255-sty.bblue; | ||
103 | sty.red = 255-sty.red; | ||
104 | sty.green = 255-sty.green; | ||
105 | sty.blue = 255-sty.blue; | ||
106 | qDebug("After:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue); | ||
107 | qDebug("After:<%02x%02x%02x>", sty.red, sty.green, sty.blue); | ||
108 | } | ||
diff --git a/noncore/apps/opie-reader/StyleConsts.h b/noncore/apps/opie-reader/StyleConsts.h index 5817b54..8e23c6f 100644 --- a/noncore/apps/opie-reader/StyleConsts.h +++ b/noncore/apps/opie-reader/StyleConsts.h | |||
@@ -2,8 +2,11 @@ | |||
2 | #define __STYLECONSTS_H | 2 | #define __STYLECONSTS_H |
3 | 3 | ||
4 | typedef unsigned short StyleType; | 4 | typedef unsigned short StyleType; |
5 | 5 | ||
6 | #ifdef _WINDOWS | ||
7 | #include <string.h> | ||
8 | #endif | ||
6 | #include <string.h> | 9 | #include <string.h> |
7 | #include <stdlib.h> | 10 | #include <stdlib.h> |
8 | #include <qglobal.h> | 11 | #include <qglobal.h> |
9 | class QImage; | 12 | class QImage; |
@@ -41,14 +44,18 @@ enum EalignmentType | |||
41 | class CBasicStyle | 44 | class CBasicStyle |
42 | { | 45 | { |
43 | friend class CStyle; | 46 | friend class CStyle; |
44 | bool m_bold, | 47 | bool m_bold, |
45 | m_italic; | 48 | m_italic; |
46 | int m_fontsize; | 49 | int m_fontsize; |
47 | EalignmentType m_align; | 50 | EalignmentType m_align; |
48 | unsigned char red, green, blue; | 51 | unsigned char red, green, blue; |
52 | unsigned char bred, bgreen, bblue; | ||
53 | unsigned char pred, pgreen, pblue; | ||
49 | unsigned long data; | 54 | unsigned long data; |
55 | unsigned long offset; | ||
50 | bool isLink; | 56 | bool isLink; |
57 | // bool isVisited; | ||
51 | bool m_underline; | 58 | bool m_underline; |
52 | bool m_strikethru; | 59 | bool m_strikethru; |
53 | bool m_monospaced; | 60 | bool m_monospaced; |
54 | unsigned char m_leftmargin, m_rightmargin; | 61 | unsigned char m_leftmargin, m_rightmargin; |
@@ -68,10 +75,14 @@ class CBasicStyle | |||
68 | m_italic = false; | 75 | m_italic = false; |
69 | m_fontsize = 0; | 76 | m_fontsize = 0; |
70 | m_align = m_AlignLeft; | 77 | m_align = m_AlignLeft; |
71 | red = green = blue = 0; | 78 | red = green = blue = 0; |
79 | bred = bgreen = bblue = 255; | ||
80 | pred = pgreen = pblue = 255; | ||
72 | data = 0; | 81 | data = 0; |
82 | offset = 0; | ||
73 | isLink = false; | 83 | isLink = false; |
84 | // isVisited = false; | ||
74 | m_underline = false; | 85 | m_underline = false; |
75 | m_strikethru = false; | 86 | m_strikethru = false; |
76 | m_leftmargin = 0; | 87 | m_leftmargin = 0; |
77 | m_rightmargin = 0; | 88 | m_rightmargin = 0; |
@@ -110,16 +121,34 @@ class CStyle | |||
110 | sty.red = r; | 121 | sty.red = r; |
111 | sty.green = g; | 122 | sty.green = g; |
112 | sty.blue = b; | 123 | sty.blue = b; |
113 | } | 124 | } |
125 | unsigned char bRed() { return sty.bred; } | ||
126 | unsigned char bGreen() { return sty.bgreen; } | ||
127 | unsigned char bBlue() { return sty.bblue; } | ||
128 | unsigned char pRed() { return sty.pred; } | ||
129 | unsigned char pGreen() { return sty.pgreen; } | ||
130 | unsigned char pBlue() { return sty.pblue; } | ||
131 | void setPaper(unsigned char r, unsigned char g, unsigned char b) | ||
132 | { | ||
133 | sty.pred = r; | ||
134 | sty.pgreen = g; | ||
135 | sty.pblue = b; | ||
136 | } | ||
137 | void setBackground(unsigned char r, unsigned char g, unsigned char b) | ||
138 | { | ||
139 | sty.bred = r; | ||
140 | sty.bgreen = g; | ||
141 | sty.bblue = b; | ||
142 | } | ||
114 | CStyle() : graphic(NULL) {} | 143 | CStyle() : graphic(NULL) {} |
115 | ~CStyle(); | 144 | ~CStyle(); |
116 | // CStyle(CStyle&); | 145 | // CStyle(CStyle&); |
117 | CStyle(const CStyle&); | 146 | CStyle(const CStyle&); |
118 | CStyle& operator=(const CStyle&); | 147 | CStyle& operator=(const CStyle&); |
119 | void unset(); | 148 | void unset(); |
120 | bool isPicture() { return (graphic != NULL); } | 149 | bool isPicture() const { return (graphic != NULL); } |
121 | bool canScale() { return graphic->m_isScaleable; } | 150 | bool canScale() const { return graphic->m_isScaleable; } |
122 | void clearPicture(); | 151 | void clearPicture(); |
123 | void setPicture(bool canScale, QImage* _g, bool il=false, unsigned long tgt=0); | 152 | void setPicture(bool canScale, QImage* _g, bool il=false, unsigned long tgt=0); |
124 | QImage* getPicture() | 153 | QImage* getPicture() |
125 | { | 154 | { |
@@ -180,9 +209,14 @@ class CStyle | |||
180 | ); | 209 | ); |
181 | } | 210 | } |
182 | void setLink(bool _l) { sty.isLink = _l; } | 211 | void setLink(bool _l) { sty.isLink = _l; } |
183 | bool getLink() { return sty.isLink; } | 212 | bool getLink() { return sty.isLink; } |
213 | // void setVisited(bool _l) { sty.isVisited = _l; } | ||
214 | // bool getVisited() { return sty.isVisited; } | ||
184 | void setData(unsigned long _d) { sty.data = _d; } | 215 | void setData(unsigned long _d) { sty.data = _d; } |
185 | unsigned long getData() { return sty.data; } | 216 | unsigned long getData() { return sty.data; } |
217 | void setOffset(unsigned long _d) { sty.offset = _d; } | ||
218 | unsigned long getOffset() { return sty.offset; } | ||
219 | void invert(); | ||
186 | }; | 220 | }; |
187 | 221 | ||
188 | #endif | 222 | #endif |
diff --git a/noncore/apps/opie-reader/ToolbarPrefs.cpp b/noncore/apps/opie-reader/ToolbarPrefs.cpp index 0347736..5cf220a 100644 --- a/noncore/apps/opie-reader/ToolbarPrefs.cpp +++ b/noncore/apps/opie-reader/ToolbarPrefs.cpp | |||
@@ -5,16 +5,25 @@ | |||
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #include "useqpe.h" | ||
9 | #include "ToolbarPrefs.h" | 10 | #include "ToolbarPrefs.h" |
10 | 11 | ||
12 | #include <qcheckbox.h> | ||
13 | #include <qlabel.h> | ||
14 | #include <qpushbutton.h> | ||
15 | #include <qspinbox.h> | ||
11 | #include <qlayout.h> | 16 | #include <qlayout.h> |
17 | #include <qvariant.h> | ||
18 | #include <qtooltip.h> | ||
19 | #include <qwhatsthis.h> | ||
20 | #include <qcombobox.h> | ||
12 | #include <qbuttongroup.h> | 21 | #include <qbuttongroup.h> |
22 | #include <qlineedit.h> | ||
13 | #ifdef USEQPE | 23 | #ifdef USEQPE |
14 | #include <qpe/menubutton.h> | 24 | #include <qpe/menubutton.h> |
15 | #endif | 25 | #endif |
16 | #include <qpe/qpeapplication.h> | ||
17 | 26 | ||
18 | CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir ) | 27 | CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir ) |
19 | { | 28 | { |
20 | setCaption(tr( "Toolbar Settings" ) ); | 29 | setCaption(tr( "Toolbar Settings" ) ); |
@@ -33,10 +42,9 @@ CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char | |||
33 | td->addTab(misc, tr("Policy")); | 42 | td->addTab(misc, tr("Policy")); |
34 | QVBoxLayout* v = new QVBoxLayout(this); | 43 | QVBoxLayout* v = new QVBoxLayout(this); |
35 | v->addWidget(td); | 44 | v->addWidget(td); |
36 | 45 | ||
37 | if (fs) | 46 | if (fs) showMaximized(); |
38 | QPEApplication::showDialog( this ); | ||
39 | } | 47 | } |
40 | 48 | ||
41 | /* | 49 | /* |
42 | CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl ) | 50 | CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl ) |
@@ -120,8 +128,16 @@ CBarPrefs2::CBarPrefs2( Config& _config, QWidget* parent, const char* name, WFl | |||
120 | 128 | ||
121 | fullscreen = new QCheckBox( tr("Fullscreen"), bg ); | 129 | fullscreen = new QCheckBox( tr("Fullscreen"), bg ); |
122 | fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false )); | 130 | fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false )); |
123 | connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | 131 | connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); |
132 | rotate = new QCheckBox( tr("Rotate"), bg ); | ||
133 | rotate->setChecked(config.readBoolEntry( "Rotate", false )); | ||
134 | connect(rotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
135 | |||
136 | invert = new QCheckBox( tr("Invert"), bg ); | ||
137 | invert->setChecked(config.readBoolEntry( "Invert Action", false )); | ||
138 | connect(invert, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
139 | |||
124 | zoom = new QCheckBox( tr("Zoom"), bg ); | 140 | zoom = new QCheckBox( tr("Zoom"), bg ); |
125 | zoom->setChecked(config.readBoolEntry( "Zoom In/Out", false )); | 141 | zoom->setChecked(config.readBoolEntry( "Zoom In/Out", false )); |
126 | connect(zoom, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | 142 | connect(zoom, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); |
127 | setfont = new QCheckBox( tr("Set Font"), bg ); | 143 | setfont = new QCheckBox( tr("Set Font"), bg ); |
@@ -176,8 +192,10 @@ CBarPrefs2::CBarPrefs2( Config& _config, QWidget* parent, const char* name, WFl | |||
176 | void CBarPrefs2::saveall() | 192 | void CBarPrefs2::saveall() |
177 | { | 193 | { |
178 | config.setGroup( "Toolbar" ); | 194 | config.setGroup( "Toolbar" ); |
179 | config.writeEntry( "Fullscreen", fullscreen->isChecked()); | 195 | config.writeEntry( "Fullscreen", fullscreen->isChecked()); |
196 | config.writeEntry( "Rotate", rotate->isChecked()); | ||
197 | config.writeEntry( "Invert Action", invert->isChecked()); | ||
180 | config.writeEntry( "Zoom In/Out", zoom->isChecked()); | 198 | config.writeEntry( "Zoom In/Out", zoom->isChecked()); |
181 | config.writeEntry( "Set Font", setfont->isChecked()); | 199 | config.writeEntry( "Set Font", setfont->isChecked()); |
182 | config.writeEntry("Encoding Select", encoding->isChecked()); | 200 | config.writeEntry("Encoding Select", encoding->isChecked()); |
183 | config.writeEntry("Ideogram Mode", ideogram->isChecked()); | 201 | config.writeEntry("Ideogram Mode", ideogram->isChecked()); |
@@ -314,8 +332,16 @@ CViewBarPrefs::CViewBarPrefs( Config& _config, QWidget* parent, const char* nam | |||
314 | 332 | ||
315 | fullscreen = new QCheckBox( tr("Fullscreen"), bg ); | 333 | fullscreen = new QCheckBox( tr("Fullscreen"), bg ); |
316 | fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false )); | 334 | fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false )); |
317 | connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | 335 | connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); |
336 | rotate = new QCheckBox( tr("Rotate"), bg ); | ||
337 | rotate->setChecked(config.readBoolEntry( "Rotate", false )); | ||
338 | connect(rotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
339 | |||
340 | invert = new QCheckBox( tr("Invert"), bg ); | ||
341 | invert->setChecked(config.readBoolEntry( "Invert Action", false )); | ||
342 | connect(invert, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
343 | |||
318 | zoomin = new QCheckBox( tr("Zoom In"), bg ); | 344 | zoomin = new QCheckBox( tr("Zoom In"), bg ); |
319 | zoomin->setChecked(config.readBoolEntry( "Zoom In", false )); | 345 | zoomin->setChecked(config.readBoolEntry( "Zoom In", false )); |
320 | connect(zoomin, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | 346 | connect(zoomin, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); |
321 | zoomout = new QCheckBox( tr("Zoom Out"), bg ); | 347 | zoomout = new QCheckBox( tr("Zoom Out"), bg ); |
@@ -337,8 +363,10 @@ CViewBarPrefs::CViewBarPrefs( Config& _config, QWidget* parent, const char* nam | |||
337 | void CViewBarPrefs::saveall() | 363 | void CViewBarPrefs::saveall() |
338 | { | 364 | { |
339 | config.setGroup( "Toolbar" ); | 365 | config.setGroup( "Toolbar" ); |
340 | config.writeEntry( "Fullscreen", fullscreen->isChecked()); | 366 | config.writeEntry( "Fullscreen", fullscreen->isChecked()); |
367 | config.writeEntry( "Rotate", rotate->isChecked()); | ||
368 | config.writeEntry( "Invert Action", invert->isChecked()); | ||
341 | config.writeEntry( "Zoom In", zoomin->isChecked()); | 369 | config.writeEntry( "Zoom In", zoomin->isChecked()); |
342 | config.writeEntry( "Zoom Out", zoomout->isChecked()); | 370 | config.writeEntry( "Zoom Out", zoomout->isChecked()); |
343 | config.writeEntry( "Set Font", setfont->isChecked()); | 371 | config.writeEntry( "Set Font", setfont->isChecked()); |
344 | config.writeEntry("Encoding Select", encoding->isChecked()); | 372 | config.writeEntry("Encoding Select", encoding->isChecked()); |
@@ -411,20 +439,15 @@ CMarkBarPrefs::~CMarkBarPrefs() | |||
411 | CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl ) | 439 | CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl ) |
412 | : QWidget( parent, name, fl ) | 440 | : QWidget( parent, name, fl ) |
413 | { | 441 | { |
414 | 442 | ||
415 | QGridLayout* hl = new QGridLayout(this,1,2); | 443 | QGridLayout* hl = new QGridLayout(this,2,2); |
416 | 444 | ||
417 | hl->setMargin( 0 ); | 445 | hl->setMargin( 0 ); |
418 | 446 | ||
419 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Dialogs", this); | 447 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Dialogs", this); |
420 | floating = new QCheckBox(gb); | 448 | floating = new QCheckBox(gb); |
421 | floating->setText(tr("Floating")); | 449 | floating->setText(tr("Floating")); |
422 | |||
423 | // QLabel* TextLabel = new QLabel( gb ); | ||
424 | // TextLabel->setText( tr( "Select Button" ) ); | ||
425 | |||
426 | |||
427 | hl->addWidget( gb, 0, 0 ); | 450 | hl->addWidget( gb, 0, 0 ); |
428 | 451 | ||
429 | 452 | ||
430 | gb = new QGroupBox(1, Qt::Horizontal, "Bars (Restart)", this); | 453 | gb = new QGroupBox(1, Qt::Horizontal, "Bars (Restart)", this); |
@@ -438,11 +461,16 @@ CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
438 | #else | 461 | #else |
439 | tbpolicy = new MenuButton(gb); | 462 | tbpolicy = new MenuButton(gb); |
440 | #endif | 463 | #endif |
441 | tbpolicy->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | 464 | tbpolicy->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); |
465 | #ifdef USEQPE | ||
442 | tbpolicy->insertItem(tr("Single bar")); | 466 | tbpolicy->insertItem(tr("Single bar")); |
443 | tbpolicy->insertItem(tr("Menu/tool bar")); | 467 | tbpolicy->insertItem(tr("Menu/tool bar")); |
444 | tbpolicy->insertItem(tr("Multiple bars")); | 468 | tbpolicy->insertItem(tr("Multiple bars")); |
469 | #else | ||
470 | tbpolicy->insertItem(tr("Single bar")); | ||
471 | tbpolicy->insertItem(tr("Multiple bars")); | ||
472 | #endif | ||
445 | 473 | ||
446 | #ifdef USECOMBO | 474 | #ifdef USECOMBO |
447 | tbposition = new QComboBox(gb); | 475 | tbposition = new QComboBox(gb); |
448 | #else | 476 | #else |
@@ -454,12 +482,40 @@ CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl ) | |||
454 | tbposition->insertItem(tr("Left")); | 482 | tbposition->insertItem(tr("Left")); |
455 | tbposition->insertItem(tr("Minimised")); | 483 | tbposition->insertItem(tr("Minimised")); |
456 | 484 | ||
457 | tbmovable = new QCheckBox( tr("Movable"), gb ); | 485 | tbmovable = new QCheckBox( tr("Movable"), gb ); |
458 | // ch->setChecked(config.readBoolEntry( "Movable", false )); | ||
459 | 486 | ||
460 | hl->addWidget(gb, 0, 1); | 487 | hl->addWidget(gb, 0, 1); |
461 | 488 | ||
489 | gb = new QGroupBox(1, Qt::Horizontal, "QT Scroll Bar", this); | ||
490 | |||
491 | #ifdef USECOMBO | ||
492 | qtscroll = new QComboBox(gb); | ||
493 | #else | ||
494 | qtscroll = new MenuButton(gb); | ||
495 | #endif | ||
496 | qtscroll->insertItem(tr("None")); | ||
497 | qtscroll->insertItem(tr("Right")); | ||
498 | qtscroll->insertItem(tr("Left")); | ||
499 | |||
500 | hl->addWidget(gb, 1, 0); | ||
501 | gb = new QGroupBox(1, Qt::Horizontal, "Miniscroll", this); | ||
502 | |||
503 | #ifdef USECOMBO | ||
504 | localscroll = new QComboBox(gb); | ||
505 | #else | ||
506 | localscroll = new MenuButton(gb); | ||
507 | #endif | ||
508 | localscroll->insertItem(tr("None")); | ||
509 | localscroll->insertItem(tr("Bottom")); | ||
510 | localscroll->insertItem(tr("Right")); | ||
511 | localscroll->insertItem(tr("Left")); | ||
512 | |||
513 | //scrollonleft = new QCheckBox( tr("... on Left"), gb ); | ||
514 | // ch->setChecked(config.readBoolEntry( "Movable", false )); | ||
515 | |||
516 | hl->addWidget(gb, 1, 1); | ||
517 | |||
462 | } | 518 | } |
463 | 519 | ||
464 | CMiscBarPrefs::~CMiscBarPrefs() | 520 | CMiscBarPrefs::~CMiscBarPrefs() |
465 | { | 521 | { |
diff --git a/noncore/apps/opie-reader/ToolbarPrefs.h b/noncore/apps/opie-reader/ToolbarPrefs.h index 9571c28..a2686e5 100644 --- a/noncore/apps/opie-reader/ToolbarPrefs.h +++ b/noncore/apps/opie-reader/ToolbarPrefs.h | |||
@@ -115,9 +115,9 @@ class CBarPrefs2 : public QWidget | |||
115 | class CViewBarPrefs : public QWidget | 115 | class CViewBarPrefs : public QWidget |
116 | { | 116 | { |
117 | Q_OBJECT | 117 | Q_OBJECT |
118 | Config& config; | 118 | Config& config; |
119 | QCheckBox *fullscreen, *zoomin, *zoomout, *setfont, *encoding, *ideogram; | 119 | QCheckBox *fullscreen, *rotate, *zoomin, *zoomout, *setfont, *encoding, *ideogram, *invert; |
120 | 120 | ||
121 | bool m_isChanged; | 121 | bool m_isChanged; |
122 | 122 | ||
123 | private slots: | 123 | private slots: |
@@ -170,18 +170,18 @@ class CIndBarPrefs : public QWidget | |||
170 | }; | 170 | }; |
171 | 171 | ||
172 | class CMiscBarPrefs : public QWidget | 172 | class CMiscBarPrefs : public QWidget |
173 | { | 173 | { |
174 | Q_OBJECT | 174 | |
175 | public: | 175 | public: |
176 | 176 | ||
177 | CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 177 | CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
178 | ~CMiscBarPrefs(); | 178 | ~CMiscBarPrefs(); |
179 | 179 | ||
180 | #ifdef USECOMBO | 180 | #ifdef USECOMBO |
181 | QComboBox *tbpolicy, *tbposition; | 181 | QComboBox *tbpolicy, *tbposition, *qtscroll, *localscroll; |
182 | #else | 182 | #else |
183 | MenuButton *tbpolicy, *tbposition; | 183 | MenuButton *tbpolicy, *tbposition, *qtscroll, *localscroll; |
184 | #endif | 184 | #endif |
185 | QCheckBox *tbmovable, *floating; | 185 | QCheckBox *tbmovable, *floating; |
186 | }; | 186 | }; |
187 | 187 | ||
@@ -244,12 +244,18 @@ class CBarPrefs : public QDialog | |||
244 | } | 244 | } |
245 | bool floating() { return misc->floating->isChecked(); } | 245 | bool floating() { return misc->floating->isChecked(); } |
246 | void floating(bool v) { misc->floating->setChecked(v); } | 246 | void floating(bool v) { misc->floating->setChecked(v); } |
247 | int tbpolicy() { return misc->tbpolicy->currentItem(); } | 247 | int tbpolicy() { return misc->tbpolicy->currentItem(); } |
248 | int qtscroll() { return misc->qtscroll->currentItem(); } | ||
249 | int localscroll() { return misc->localscroll->currentItem(); } | ||
248 | #ifdef USECOMBO | 250 | #ifdef USECOMBO |
249 | void tbpolicy(int v) { misc->tbpolicy->setCurrentItem(v); } | 251 | void tbpolicy(int v) { misc->tbpolicy->setCurrentItem(v); } |
252 | void qtscroll(int v) { misc->qtscroll->setCurrentItem(v); } | ||
253 | void localscroll(int v) { misc->localscroll->setCurrentItem(v); } | ||
250 | #else | 254 | #else |
251 | void tbpolicy(int v) { misc->tbpolicy->select(v); } | 255 | void tbpolicy(int v) { misc->tbpolicy->select(v); } |
256 | void qtscroll(int v) { misc->qtscroll->select(v); } | ||
257 | void localscroll(int v) { misc->localscroll->select(v); } | ||
252 | #endif | 258 | #endif |
253 | bool tbmovable() { return misc->tbmovable->isChecked(); } | 259 | bool tbmovable() { return misc->tbmovable->isChecked(); } |
254 | void tbmovable(bool v) { misc->tbmovable->setChecked(v); } | 260 | void tbmovable(bool v) { misc->tbmovable->setChecked(v); } |
255 | int tbposition() { return misc->tbposition->currentItem(); } | 261 | int tbposition() { return misc->tbposition->currentItem(); } |
diff --git a/noncore/apps/opie-reader/URLDialog.cpp b/noncore/apps/opie-reader/URLDialog.cpp index e572c80..dd4568b 100644 --- a/noncore/apps/opie-reader/URLDialog.cpp +++ b/noncore/apps/opie-reader/URLDialog.cpp | |||
@@ -1,17 +1,14 @@ | |||
1 | #include "URLDialog.h" | 1 | #include "URLDialog.h" |
2 | #include "qlayout.h" | 2 | #include "qlayout.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | 4 | CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) |
5 | 5 | { | |
6 | CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) | 6 | setCaption(tr("Save URL")); |
7 | { | 7 | QVBoxLayout *tmp = new QVBoxLayout(this); |
8 | setCaption(tr("Save URL")); | 8 | QVButtonGroup* vb = new QVButtonGroup(fname, this); |
9 | QVBoxLayout *tmp = new QVBoxLayout(this); | 9 | tmp->addWidget(vb); |
10 | QVButtonGroup* vb = new QVButtonGroup(fname, this); | 10 | m_clipboard = new QCheckBox(tr("Clipboard"), vb); |
11 | tmp->addWidget(vb); | 11 | m_localfile = new QCheckBox(tr("Local file"), vb); |
12 | m_clipboard = new QCheckBox(tr("Clipboard"), vb); | 12 | m_globalfile = new QCheckBox(tr("Global file"), vb); |
13 | m_localfile = new QCheckBox(tr("Local file"), vb); | 13 | if (fs) showMaximized(); |
14 | m_globalfile = new QCheckBox(tr("Global file"), vb); | 14 | } |
15 | if (fs) | ||
16 | QPEApplication::showDialog( this ); | ||
17 | } | ||
diff --git a/noncore/apps/opie-reader/WeaselCodec.mak b/noncore/apps/opie-reader/WeaselCodec.mak new file mode 100644 index 0000000..3bac5b9 --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec.mak | |||
@@ -0,0 +1,166 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libWeasel.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:43:37 2004 | ||
4 | # Project: WeaselCodec.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o WeaselCodec.mak WeaselCodec.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libWeasel.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = ztxt.h | ||
47 | SOURCES = ztxt.cpp | ||
48 | OBJECTS = QREADEROBJS/ztxt.o | ||
49 | FORMS = | ||
50 | UICDECLS = | ||
51 | UICIMPLS = | ||
52 | SRCMOC = | ||
53 | OBJMOC = | ||
54 | DIST = WeaselCodec.pro | ||
55 | QMAKE_TARGET = Weasel | ||
56 | DESTDIR = $(READERDIR)/codecs/ | ||
57 | TARGET = libWeasel.so.1.0.0 | ||
58 | TARGETA= $(READERDIR)/codecs/libWeasel.a | ||
59 | TARGETD= libWeasel.so.1.0.0 | ||
60 | TARGET0= libWeasel.so | ||
61 | TARGET1= libWeasel.so.1 | ||
62 | TARGET2= libWeasel.so.1.0 | ||
63 | |||
64 | first: all | ||
65 | ####### Implicit rules | ||
66 | |||
67 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
68 | |||
69 | .cpp.o: | ||
70 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
71 | |||
72 | .cc.o: | ||
73 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
74 | |||
75 | .cxx.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .C.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .c.o: | ||
82 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | ####### Build rules | ||
85 | |||
86 | all: WeaselCodec.mak $(READERDIR)/codecs/$(TARGET) | ||
87 | |||
88 | $(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
89 | test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/ | ||
90 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
91 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
92 | -ln -s $(TARGET) $(TARGET0) | ||
93 | -ln -s $(TARGET) $(TARGET1) | ||
94 | -ln -s $(TARGET) $(TARGET2) | ||
95 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) | ||
96 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) | ||
97 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1) | ||
98 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2) | ||
99 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/ | ||
100 | |||
101 | |||
102 | |||
103 | staticlib: $(TARGETA) | ||
104 | |||
105 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
106 | -$(DEL_FILE) $(TARGETA) | ||
107 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
108 | |||
109 | mocables: $(SRCMOC) | ||
110 | uicables: $(UICDECLS) $(UICIMPLS) | ||
111 | |||
112 | $(MOC): | ||
113 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
114 | |||
115 | WeaselCodec.mak: WeaselCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
116 | $(QMAKE) -o WeaselCodec.mak WeaselCodec.pro | ||
117 | qmake: | ||
118 | @$(QMAKE) -o WeaselCodec.mak WeaselCodec.pro | ||
119 | |||
120 | dist: | ||
121 | @mkdir -p QREADEROBJS/Weasel && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/Weasel/ && ( cd `dirname QREADEROBJS/Weasel` && $(TAR) Weasel.tar Weasel && $(GZIP) Weasel.tar ) && $(MOVE) `dirname QREADEROBJS/Weasel`/Weasel.tar.gz . && $(DEL_FILE) -r QREADEROBJS/Weasel | ||
122 | |||
123 | mocclean: | ||
124 | |||
125 | uiclean: | ||
126 | |||
127 | yaccclean: | ||
128 | lexclean: | ||
129 | clean: | ||
130 | -$(DEL_FILE) $(OBJECTS) | ||
131 | -$(DEL_FILE) *~ core *.core | ||
132 | |||
133 | |||
134 | ####### Sub-libraries | ||
135 | |||
136 | distclean: clean | ||
137 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET) | ||
138 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA) | ||
139 | |||
140 | |||
141 | FORCE: | ||
142 | |||
143 | ####### Compile | ||
144 | |||
145 | QREADEROBJS/ztxt.o: ztxt.cpp ztxt.h \ | ||
146 | my_list.h \ | ||
147 | Bkmks.h \ | ||
148 | QREADERINC/static.h \ | ||
149 | CExpander.h \ | ||
150 | pdb.h \ | ||
151 | QREADERINC/useqpe.h \ | ||
152 | config.h \ | ||
153 | StyleConsts.h \ | ||
154 | Markups.h \ | ||
155 | names.h \ | ||
156 | linktype.h \ | ||
157 | ustring.h \ | ||
158 | Filedata.h | ||
159 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ztxt.o ztxt.cpp | ||
160 | |||
161 | ####### Install | ||
162 | |||
163 | install: all | ||
164 | |||
165 | uninstall: | ||
166 | |||
diff --git a/noncore/apps/opie-reader/WeaselCodec.omak b/noncore/apps/opie-reader/WeaselCodec.omak new file mode 100644 index 0000000..c3976c7 --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec.omak | |||
@@ -0,0 +1,127 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libWeasel.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: WeaselCodec.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libWeasel.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =ztxt.h | ||
29 | SOURCES =ztxt.cpp | ||
30 | OBJECTS =OREADEROBJS/ztxt.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libWeasel.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libWeasel.a | ||
39 | TARGETD =libWeasel.so.1.0.0 | ||
40 | TARGET0 =libWeasel.so | ||
41 | TARGET1 =libWeasel.so.1 | ||
42 | TARGET2 =libWeasel.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: WeaselCodec.omak | ||
90 | |||
91 | WeaselCodec.omak: WeaselCodec.opro | ||
92 | tmake WeaselCodec.opro -o WeaselCodec.omak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) WeaselCodec.opro.tar WeaselCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) WeaselCodec.opro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | OREADEROBJS/ztxt.o: ztxt.cpp \ | ||
112 | ztxt.h \ | ||
113 | CExpander.h \ | ||
114 | OREADERINC/useqpe.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h \ | ||
121 | pdb.h \ | ||
122 | my_list.h \ | ||
123 | Bkmks.h \ | ||
124 | Filedata.h \ | ||
125 | OREADERINC/static.h | ||
126 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ztxt.o ztxt.cpp | ||
127 | |||
diff --git a/noncore/apps/opie-reader/WeaselCodec.wmak b/noncore/apps/opie-reader/WeaselCodec.wmak new file mode 100644 index 0000000..fd41b8a --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec.wmak | |||
@@ -0,0 +1,127 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libWeasel.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: WeaselCodec.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libWeasel.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =ztxt.h | ||
29 | SOURCES =ztxt.cpp | ||
30 | OBJECTS =WSREADEROBJS/ztxt.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libWeasel.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libWeasel.a | ||
39 | TARGETD =libWeasel.so.1.0.0 | ||
40 | TARGET0 =libWeasel.so | ||
41 | TARGET1 =libWeasel.so.1 | ||
42 | TARGET2 =libWeasel.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: WeaselCodec.wmak | ||
90 | |||
91 | WeaselCodec.wmak: WeaselCodec.wpro | ||
92 | tmake WeaselCodec.wpro -o WeaselCodec.wmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) WeaselCodec.wpro.tar WeaselCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) WeaselCodec.wpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | WSREADEROBJS/ztxt.o: ztxt.cpp \ | ||
112 | ztxt.h \ | ||
113 | CExpander.h \ | ||
114 | WSREADERINC/useqpe.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h \ | ||
121 | pdb.h \ | ||
122 | my_list.h \ | ||
123 | Bkmks.h \ | ||
124 | Filedata.h \ | ||
125 | WSREADERINC/static.h | ||
126 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ztxt.o ztxt.cpp | ||
127 | |||
diff --git a/noncore/apps/opie-reader/WeaselCodec.wpro b/noncore/apps/opie-reader/WeaselCodec.wpro new file mode 100644 index 0000000..b71eefb --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec.wpro | |||
@@ -0,0 +1,15 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = ztxt.h | ||
4 | |||
5 | SOURCES = ztxt.cpp | ||
6 | |||
7 | INTERFACES= | ||
8 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
9 | TARGET = Weasel | ||
10 | LIBS += -lreader_pdb -lreader_codec | ||
11 | |||
12 | OBJECTS_DIR = WSREADEROBJS | ||
13 | MOC_DIR = WSREADERMOCS | ||
14 | INCLUDEPATH+= WSREADERINC | ||
15 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/WeaselCodec.zmak b/noncore/apps/opie-reader/WeaselCodec.zmak new file mode 100644 index 0000000..50a54f7 --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec.zmak | |||
@@ -0,0 +1,127 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libWeasel.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: WeaselCodec.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libWeasel.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =ztxt.h | ||
29 | SOURCES =ztxt.cpp | ||
30 | OBJECTS =ZREADEROBJS/ztxt.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libWeasel.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libWeasel.a | ||
39 | TARGETD =libWeasel.so.1.0.0 | ||
40 | TARGET0 =libWeasel.so | ||
41 | TARGET1 =libWeasel.so.1 | ||
42 | TARGET2 =libWeasel.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: WeaselCodec.zmak | ||
90 | |||
91 | WeaselCodec.zmak: WeaselCodec.zpro | ||
92 | tmake WeaselCodec.zpro -o WeaselCodec.zmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) WeaselCodec.zpro.tar WeaselCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) WeaselCodec.zpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | ZREADEROBJS/ztxt.o: ztxt.cpp \ | ||
112 | ztxt.h \ | ||
113 | CExpander.h \ | ||
114 | ZREADERINC/useqpe.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h \ | ||
121 | pdb.h \ | ||
122 | my_list.h \ | ||
123 | Bkmks.h \ | ||
124 | Filedata.h \ | ||
125 | ZREADERINC/static.h | ||
126 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ztxt.o ztxt.cpp | ||
127 | |||
diff --git a/noncore/apps/opie-reader/WeaselCodec.zpro b/noncore/apps/opie-reader/WeaselCodec.zpro new file mode 100644 index 0000000..1ab1553 --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec.zpro | |||
@@ -0,0 +1,15 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = ztxt.h | ||
4 | |||
5 | SOURCES = ztxt.cpp | ||
6 | |||
7 | INTERFACES= | ||
8 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
9 | TARGET = Weasel | ||
10 | LIBS += -lreader_pdb -lreader_codec | ||
11 | |||
12 | OBJECTS_DIR = ZREADEROBJS | ||
13 | MOC_DIR = ZREADERMOCS | ||
14 | INCLUDEPATH+= ZREADERINC | ||
15 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/WeaselCodec/.cvsignore b/noncore/apps/opie-reader/WeaselCodec/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/WeaselCodec/WeaselCodec.pro b/noncore/apps/opie-reader/WeaselCodec/WeaselCodec.pro new file mode 100644 index 0000000..61e7dc9 --- a/dev/null +++ b/noncore/apps/opie-reader/WeaselCodec/WeaselCodec.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = ztxt.h | ||
6 | |||
7 | SOURCES = ztxt.cpp | ||
8 | |||
9 | INTERFACES= | ||
10 | DESTDIR = $(OPIEDIR)/plugins/reader/codecs | ||
11 | TARGET = Weasel | ||
12 | LIBS += -lreader_pdb -lreader_codec | ||
13 | |||
14 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
15 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
16 | |||
17 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h index ab81a5e..06e3bf8 100644 --- a/noncore/apps/opie-reader/ZText.h +++ b/noncore/apps/opie-reader/ZText.h | |||
@@ -10,25 +10,31 @@ class Text: public CExpander { | |||
10 | gzFile file; | 10 | gzFile file; |
11 | unsigned long fsize; | 11 | unsigned long fsize; |
12 | public: | 12 | public: |
13 | void suspend() | 13 | void suspend() |
14 | { | 14 | { |
15 | #ifdef USEQPE | 15 | #ifdef USEQPE |
16 | bSuspended = true; | 16 | if (!bSuspended) |
17 | suspos = gztell(file); | 17 | { |
18 | gzclose(file); | 18 | bSuspended = true; |
19 | file = NULL; | 19 | suspos = gztell(file); |
20 | sustime = time(NULL); | 20 | gzclose(file); |
21 | file = NULL; | ||
22 | sustime = time(NULL); | ||
23 | } | ||
21 | #endif | 24 | #endif |
22 | } | 25 | } |
23 | void unsuspend() | 26 | void unsuspend() |
24 | { | 27 | { |
25 | #ifdef USEQPE | 28 | #ifdef USEQPE |
26 | if (bSuspended) | 29 | if (bSuspended) |
27 | { | 30 | { |
28 | bSuspended = false; | 31 | bSuspended = false; |
29 | int delay = time(NULL) - sustime; | 32 | if (sustime != ((time_t)-1)) |
30 | if (delay < 10) sleep(10-delay); | 33 | { |
34 | int delay = time(NULL) - sustime; | ||
35 | if (delay < 10) sleep(10-delay); | ||
36 | } | ||
31 | file = gzopen(fname, "rb"); | 37 | file = gzopen(fname, "rb"); |
32 | for (int i = 0; file == NULL && i < 5; i++) | 38 | for (int i = 0; file == NULL && i < 5; i++) |
33 | { | 39 | { |
34 | sleep(5); | 40 | sleep(5); |
@@ -39,15 +45,21 @@ public: | |||
39 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); | 45 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); |
40 | exit(0); | 46 | exit(0); |
41 | } | 47 | } |
42 | suspos = gzseek(file, suspos, SEEK_SET); | 48 | suspos = gzseek(file, suspos, SEEK_SET); |
43 | } | 49 | } |
44 | #endif | 50 | #endif |
45 | } | 51 | } |
46 | Text() : file(NULL) {}; | 52 | Text() : file(NULL) {}; |
47 | virtual ~Text() | 53 | virtual ~Text() |
48 | { | 54 | { |
49 | if (file != NULL) gzclose(file); | 55 | if (file != NULL) |
56 | { | ||
57 | #ifdef USEQPE | ||
58 | unsuspend(); | ||
59 | #endif | ||
60 | gzclose(file); | ||
61 | } | ||
50 | } | 62 | } |
51 | int OpenFile(const char *src) | 63 | int OpenFile(const char *src) |
52 | { | 64 | { |
53 | if (file != NULL) gzclose(file); | 65 | if (file != NULL) gzclose(file); |
@@ -55,11 +67,29 @@ public: | |||
55 | stat(src,&_stat); | 67 | stat(src,&_stat); |
56 | fsize = _stat.st_size; | 68 | fsize = _stat.st_size; |
57 | return ((file = gzopen(src,"rb")) == NULL); | 69 | return ((file = gzopen(src,"rb")) == NULL); |
58 | } | 70 | } |
59 | int getch() { return gzgetc(file); } | 71 | int getch() |
60 | unsigned int locate() { return gztell(file); } | 72 | { |
61 | void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } | 73 | #ifdef USEQPE |
74 | unsuspend(); | ||
75 | #endif | ||
76 | return gzgetc(file); | ||
77 | } | ||
78 | unsigned int locate() | ||
79 | { | ||
80 | #ifdef USEQPE | ||
81 | unsuspend(); | ||
82 | #endif | ||
83 | return gztell(file); | ||
84 | } | ||
85 | void locate(unsigned int n) | ||
86 | { | ||
87 | #ifdef USEQPE | ||
88 | unsuspend(); | ||
89 | #endif | ||
90 | gzseek(file,n,SEEK_SET); | ||
91 | } | ||
62 | bool hasrandomaccess() { return true; } | 92 | bool hasrandomaccess() { return true; } |
63 | void sizes(unsigned long& _file, unsigned long& _text) | 93 | void sizes(unsigned long& _file, unsigned long& _text) |
64 | { | 94 | { |
65 | _text = _file = fsize; | 95 | _text = _file = fsize; |
@@ -68,9 +98,9 @@ public: | |||
68 | { | 98 | { |
69 | unsigned char mn[2]; | 99 | unsigned char mn[2]; |
70 | fread(mn, 1, 2, f); | 100 | fread(mn, 1, 2, f); |
71 | if ((mn[0] == 31) && (mn[1] == 139)) | 101 | if ((mn[0] == 31) && (mn[1] == 139)) |
72 | { | 102 | { |
73 | int tmp = sizeof(_text); | 103 | int tmp = sizeof(_text); |
74 | fseek(f,-tmp,SEEK_END); | 104 | fseek(f,-tmp,SEEK_END); |
75 | fread(&_text, sizeof(_text), 1, f); | 105 | fread(&_text, sizeof(_text), 1, f); |
76 | } | 106 | } |
@@ -80,6 +110,7 @@ public: | |||
80 | MarkupType PreferredMarkup() | 110 | MarkupType PreferredMarkup() |
81 | { | 111 | { |
82 | return cTEXT; | 112 | return cTEXT; |
83 | } | 113 | } |
114 | QString about() { return QString("Text/gzipped text codec (c) Tim Wentford"); } | ||
84 | }; | 115 | }; |
85 | #endif | 116 | #endif |
diff --git a/noncore/apps/opie-reader/cbkmkselector.h b/noncore/apps/opie-reader/cbkmkselector.h index 1a70048..42951e5 100644 --- a/noncore/apps/opie-reader/cbkmkselector.h +++ b/noncore/apps/opie-reader/cbkmkselector.h | |||
@@ -30,9 +30,9 @@ public: | |||
30 | bkmkselector = new QListBox(this, "Bookmarks"); | 30 | bkmkselector = new QListBox(this, "Bookmarks"); |
31 | exitButton = new QPushButton("Cancel", this); | 31 | exitButton = new QPushButton("Cancel", this); |
32 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) ); | 32 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) ); |
33 | connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) ); | 33 | connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) ); |
34 | connect(exitButton, SIGNAL( released() ), this, SLOT( slotCancel() ) ); | 34 | connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); |
35 | grid->addWidget(bkmkselector,1); | 35 | grid->addWidget(bkmkselector,1); |
36 | grid->addWidget(exitButton); | 36 | grid->addWidget(exitButton); |
37 | } | 37 | } |
38 | void clear() { bkmkselector->clear(); } | 38 | void clear() { bkmkselector->clear(); } |
diff --git a/noncore/apps/opie-reader/chm_lib.c b/noncore/apps/opie-reader/chm_lib.c new file mode 100644 index 0000000..ecf8278 --- a/dev/null +++ b/noncore/apps/opie-reader/chm_lib.c | |||
@@ -0,0 +1,1876 @@ | |||
1 | /* $Id$ */ | ||
2 | /*************************************************************************** | ||
3 | * chm_lib.c - CHM archive manipulation routines * | ||
4 | * ------------------- * | ||
5 | * * | ||
6 | * author: Jed Wing <jedwin@ugcs.caltech.edu> * | ||
7 | * version: 0.3 * | ||
8 | * notes: These routines are meant for the manipulation of microsoft * | ||
9 | * .chm (compiled html help) files, but may likely be used * | ||
10 | * for the manipulation of any ITSS archive, if ever ITSS * | ||
11 | * archives are used for any other purpose. * | ||
12 | * * | ||
13 | * Note also that the section names are statically handled. * | ||
14 | * To be entirely correct, the section names should be read * | ||
15 | * from the section names meta-file, and then the various * | ||
16 | * content sections and the "transforms" to apply to the data * | ||
17 | * they contain should be inferred from the section name and * | ||
18 | * the meta-files referenced using that name; however, all of * | ||
19 | * the files I've been able to get my hands on appear to have * | ||
20 | * only two sections: Uncompressed and MSCompressed. * | ||
21 | * Additionally, the ITSS.DLL file included with Windows does * | ||
22 | * not appear to handle any different transforms than the * | ||
23 | * simple LZX-transform. Furthermore, the list of transforms * | ||
24 | * to apply is broken, in that only half the required space * | ||
25 | * is allocated for the list. (It appears as though the * | ||
26 | * space is allocated for ASCII strings, but the strings are * | ||
27 | * written as unicode. As a result, only the first half of * | ||
28 | * the string appears.) So this is probably not too big of * | ||
29 | * a deal, at least until CHM v4 (MS .lit files), which also * | ||
30 | * incorporate encryption, of some description. * | ||
31 | * * | ||
32 | * switches: CHM_MT: compile library with thread-safety * | ||
33 | * * | ||
34 | * switches (Linux only): * | ||
35 | * CHM_USE_PREAD: compile library to use pread instead of * | ||
36 | * lseek/read * | ||
37 | * CHM_USE_IO64: compile library to support full 64-bit I/O * | ||
38 | * as is needed to properly deal with the * | ||
39 | * 64-bit file offsets. * | ||
40 | ***************************************************************************/ | ||
41 | |||
42 | /*************************************************************************** | ||
43 | * * | ||
44 | * This program is free software; you can redistribute it and/or modify * | ||
45 | * it under the terms of the GNU Lesser General Public License as * | ||
46 | * published by the Free Software Foundation; either version 2.1 of the * | ||
47 | * License, or (at your option) any later version. * | ||
48 | * * | ||
49 | ***************************************************************************/ | ||
50 | |||
51 | #include "chm_lib.h" | ||
52 | |||
53 | #ifdef CHM_MT | ||
54 | #define _REENTRANT | ||
55 | #endif | ||
56 | |||
57 | #include "lzx.h" | ||
58 | |||
59 | #include <stdlib.h> | ||
60 | #include <string.h> | ||
61 | |||
62 | #if __sun || __sgi | ||
63 | #include <strings.h> | ||
64 | #endif | ||
65 | |||
66 | #ifdef WIN32 | ||
67 | #include <windows.h> | ||
68 | #include <malloc.h> | ||
69 | #else | ||
70 | /* basic Linux system includes */ | ||
71 | #define _XOPEN_SOURCE 500 | ||
72 | #include <unistd.h> | ||
73 | #include <sys/types.h> | ||
74 | #include <sys/stat.h> | ||
75 | #include <fcntl.h> | ||
76 | #include <malloc.h> | ||
77 | #endif | ||
78 | |||
79 | /* includes/defines for threading, if using them */ | ||
80 | #ifdef CHM_MT | ||
81 | #ifdef WIN32 | ||
82 | #define CHM_ACQUIRE_LOCK(a) do { \ | ||
83 | EnterCriticalSection(&(a)); \ | ||
84 | } while(0) | ||
85 | #define CHM_RELEASE_LOCK(a) do { \ | ||
86 | EnterCriticalSection(&(a)); \ | ||
87 | } while(0) | ||
88 | |||
89 | #else | ||
90 | #include <pthread.h> | ||
91 | |||
92 | #define CHM_ACQUIRE_LOCK(a) do { \ | ||
93 | pthread_mutex_lock(&(a)); \ | ||
94 | } while(0) | ||
95 | #define CHM_RELEASE_LOCK(a) do { \ | ||
96 | pthread_mutex_unlock(&(a)); \ | ||
97 | } while(0) | ||
98 | |||
99 | #endif | ||
100 | #else | ||
101 | #define CHM_ACQUIRE_LOCK(a) /* do nothing */ | ||
102 | #define CHM_RELEASE_LOCK(a) /* do nothing */ | ||
103 | #endif | ||
104 | |||
105 | #ifdef WIN32 | ||
106 | #define CHM_NULL_FD (INVALID_HANDLE_VALUE) | ||
107 | #define CHM_USE_WIN32IO 1 | ||
108 | #define CHM_CLOSE_FILE(fd) CloseHandle((fd)) | ||
109 | #else | ||
110 | #define CHM_NULL_FD (-1) | ||
111 | #define CHM_CLOSE_FILE(fd) close((fd)) | ||
112 | #endif | ||
113 | |||
114 | /* | ||
115 | * defines related to tuning | ||
116 | */ | ||
117 | #ifndef CHM_MAX_BLOCKS_CACHED | ||
118 | #define CHM_MAX_BLOCKS_CACHED 5 | ||
119 | #endif | ||
120 | |||
121 | /* | ||
122 | * architecture specific defines | ||
123 | * | ||
124 | * Note: as soon as C99 is more widespread, the below defines should | ||
125 | * probably just use the C99 sized-int types. | ||
126 | * | ||
127 | * The following settings will probably work for many platforms. The sizes | ||
128 | * don't have to be exactly correct, but the types must accommodate at least as | ||
129 | * many bits as they specify. | ||
130 | */ | ||
131 | |||
132 | /* i386, 32-bit, Windows */ | ||
133 | #ifdef WIN32 | ||
134 | typedef unsigned char UChar; | ||
135 | typedef __int16 Int16; | ||
136 | typedef unsigned __int16 UInt16; | ||
137 | typedef __int32 Int32; | ||
138 | typedef unsigned __int32 UInt32; | ||
139 | typedef __int64 Int64; | ||
140 | typedef unsigned __int64 UInt64; | ||
141 | |||
142 | /* I386, 32-bit, non-Windows */ | ||
143 | /* Sparc */ | ||
144 | /* MIPS */ | ||
145 | #else | ||
146 | typedef unsigned char UChar; | ||
147 | typedef short Int16; | ||
148 | typedef unsigned short UInt16; | ||
149 | typedef long Int32; | ||
150 | typedef unsigned long UInt32; | ||
151 | typedef long long Int64; | ||
152 | typedef unsigned long long UInt64; | ||
153 | #endif | ||
154 | |||
155 | /* GCC */ | ||
156 | #ifdef __GNUC__ | ||
157 | #define memcmp __builtin_memcmp | ||
158 | #define memcpy __builtin_memcpy | ||
159 | #define strlen __builtin_strlen | ||
160 | |||
161 | #elif defined(WIN32) | ||
162 | static int ffs(unsigned int val) | ||
163 | { | ||
164 | int bit=1, idx=1; | ||
165 | while (bit != 0 && (val & bit) == 0) | ||
166 | { | ||
167 | bit <<= 1; | ||
168 | ++idx; | ||
169 | } | ||
170 | if (bit == 0) | ||
171 | return 0; | ||
172 | else | ||
173 | return idx; | ||
174 | } | ||
175 | |||
176 | #endif | ||
177 | |||
178 | /* utilities for unmarshalling data */ | ||
179 | static int _unmarshal_char_array(unsigned char **pData, | ||
180 | unsigned long *pLenRemain, | ||
181 | char *dest, | ||
182 | int count) | ||
183 | { | ||
184 | if (count <= 0 || (unsigned int)count > *pLenRemain) | ||
185 | return 0; | ||
186 | memcpy(dest, (*pData), count); | ||
187 | *pData += count; | ||
188 | *pLenRemain -= count; | ||
189 | return 1; | ||
190 | } | ||
191 | |||
192 | static int _unmarshal_uchar_array(unsigned char **pData, | ||
193 | unsigned long *pLenRemain, | ||
194 | unsigned char *dest, | ||
195 | int count) | ||
196 | { | ||
197 | if (count <= 0 || (unsigned int)count > *pLenRemain) | ||
198 | return 0; | ||
199 | memcpy(dest, (*pData), count); | ||
200 | *pData += count; | ||
201 | *pLenRemain -= count; | ||
202 | return 1; | ||
203 | } | ||
204 | |||
205 | static int _unmarshal_int16(unsigned char **pData, | ||
206 | unsigned long *pLenRemain, | ||
207 | Int16 *dest) | ||
208 | { | ||
209 | if (2 > *pLenRemain) | ||
210 | return 0; | ||
211 | *dest = (*pData)[0] | (*pData)[1]<<8; | ||
212 | *pData += 2; | ||
213 | *pLenRemain -= 2; | ||
214 | return 1; | ||
215 | } | ||
216 | |||
217 | static int _unmarshal_uint16(unsigned char **pData, | ||
218 | unsigned long *pLenRemain, | ||
219 | UInt16 *dest) | ||
220 | { | ||
221 | if (2 > *pLenRemain) | ||
222 | return 0; | ||
223 | *dest = (*pData)[0] | (*pData)[1]<<8; | ||
224 | *pData += 2; | ||
225 | *pLenRemain -= 2; | ||
226 | return 1; | ||
227 | } | ||
228 | |||
229 | static int _unmarshal_int32(unsigned char **pData, | ||
230 | unsigned long *pLenRemain, | ||
231 | Int32 *dest) | ||
232 | { | ||
233 | if (4 > *pLenRemain) | ||
234 | return 0; | ||
235 | *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24; | ||
236 | *pData += 4; | ||
237 | *pLenRemain -= 4; | ||
238 | return 1; | ||
239 | } | ||
240 | |||
241 | static int _unmarshal_uint32(unsigned char **pData, | ||
242 | unsigned long *pLenRemain, | ||
243 | UInt32 *dest) | ||
244 | { | ||
245 | if (4 > *pLenRemain) | ||
246 | return 0; | ||
247 | *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24; | ||
248 | *pData += 4; | ||
249 | *pLenRemain -= 4; | ||
250 | return 1; | ||
251 | } | ||
252 | |||
253 | static int _unmarshal_int64(unsigned char **pData, | ||
254 | unsigned long *pLenRemain, | ||
255 | Int64 *dest) | ||
256 | { | ||
257 | Int64 temp; | ||
258 | int i; | ||
259 | if (8 > *pLenRemain) | ||
260 | return 0; | ||
261 | temp=0; | ||
262 | for(i=8; i>0; i--) | ||
263 | { | ||
264 | temp <<= 8; | ||
265 | temp |= (*pData)[i-1]; | ||
266 | } | ||
267 | *dest = temp; | ||
268 | *pData += 8; | ||
269 | *pLenRemain -= 8; | ||
270 | return 1; | ||
271 | } | ||
272 | |||
273 | static int _unmarshal_uint64(unsigned char **pData, | ||
274 | unsigned long *pLenRemain, | ||
275 | UInt64 *dest) | ||
276 | { | ||
277 | UInt64 temp; | ||
278 | int i; | ||
279 | if (8 > *pLenRemain) | ||
280 | return 0; | ||
281 | temp=0; | ||
282 | for(i=8; i>0; i--) | ||
283 | { | ||
284 | temp <<= 8; | ||
285 | temp |= (*pData)[i-1]; | ||
286 | } | ||
287 | *dest = temp; | ||
288 | *pData += 8; | ||
289 | *pLenRemain -= 8; | ||
290 | return 1; | ||
291 | } | ||
292 | |||
293 | static int _unmarshal_uuid(unsigned char **pData, | ||
294 | unsigned long *pDataLen, | ||
295 | unsigned char *dest) | ||
296 | { | ||
297 | return _unmarshal_uchar_array(pData, pDataLen, dest, 16); | ||
298 | } | ||
299 | |||
300 | /* names of sections essential to decompression */ | ||
301 | static const char _CHMU_RESET_TABLE[] = | ||
302 | "::DataSpace/Storage/MSCompressed/Transform/" | ||
303 | "{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/" | ||
304 | "InstanceData/ResetTable"; | ||
305 | static const char _CHMU_LZXC_CONTROLDATA[] = | ||
306 | "::DataSpace/Storage/MSCompressed/ControlData"; | ||
307 | static const char _CHMU_CONTENT[] = | ||
308 | "::DataSpace/Storage/MSCompressed/Content"; | ||
309 | static const char _CHMU_SPANINFO[] = | ||
310 | "::DataSpace/Storage/MSCompressed/SpanInfo"; | ||
311 | |||
312 | /* | ||
313 | * structures local to this module | ||
314 | */ | ||
315 | |||
316 | /* structure of ITSF headers */ | ||
317 | #define _CHM_ITSF_V2_LEN (0x58) | ||
318 | #define _CHM_ITSF_V3_LEN (0x60) | ||
319 | struct chmItsfHeader | ||
320 | { | ||
321 | char signature[4]; /* 0 (ITSF) */ | ||
322 | Int32 version; /* 4 */ | ||
323 | Int32 header_len; /* 8 */ | ||
324 | Int32 unknown_000c; /* c */ | ||
325 | UInt32 last_modified; /* 10 */ | ||
326 | UInt32 lang_id; /* 14 */ | ||
327 | UChar dir_uuid[16]; /* 18 */ | ||
328 | UChar stream_uuid[16]; /* 28 */ | ||
329 | UInt64 unknown_offset; /* 38 */ | ||
330 | UInt64 unknown_len; /* 40 */ | ||
331 | UInt64 dir_offset; /* 48 */ | ||
332 | UInt64 dir_len; /* 50 */ | ||
333 | UInt64 data_offset; /* 58 (Not present before V3) */ | ||
334 | }; /* __attribute__ ((aligned (1))); */ | ||
335 | |||
336 | static int _unmarshal_itsf_header(unsigned char **pData, | ||
337 | unsigned long *pDataLen, | ||
338 | struct chmItsfHeader *dest) | ||
339 | { | ||
340 | /* we only know how to deal with the 0x58 and 0x60 byte structures */ | ||
341 | if (*pDataLen != _CHM_ITSF_V2_LEN && *pDataLen != _CHM_ITSF_V3_LEN) | ||
342 | return 0; | ||
343 | |||
344 | /* unmarshal common fields */ | ||
345 | _unmarshal_char_array(pData, pDataLen, dest->signature, 4); | ||
346 | _unmarshal_int32 (pData, pDataLen, &dest->version); | ||
347 | _unmarshal_int32 (pData, pDataLen, &dest->header_len); | ||
348 | _unmarshal_int32 (pData, pDataLen, &dest->unknown_000c); | ||
349 | _unmarshal_uint32 (pData, pDataLen, &dest->last_modified); | ||
350 | _unmarshal_uint32 (pData, pDataLen, &dest->lang_id); | ||
351 | _unmarshal_uuid (pData, pDataLen, dest->dir_uuid); | ||
352 | _unmarshal_uuid (pData, pDataLen, dest->stream_uuid); | ||
353 | _unmarshal_uint64 (pData, pDataLen, &dest->unknown_offset); | ||
354 | _unmarshal_uint64 (pData, pDataLen, &dest->unknown_len); | ||
355 | _unmarshal_uint64 (pData, pDataLen, &dest->dir_offset); | ||
356 | _unmarshal_uint64 (pData, pDataLen, &dest->dir_len); | ||
357 | |||
358 | /* error check the data */ | ||
359 | /* XXX: should also check UUIDs, probably, though with a version 3 file, | ||
360 | * current MS tools do not seem to use them. | ||
361 | */ | ||
362 | if (memcmp(dest->signature, "ITSF", 4) != 0) | ||
363 | return 0; | ||
364 | if (dest->version == 2) | ||
365 | { | ||
366 | if (dest->header_len < _CHM_ITSF_V2_LEN) | ||
367 | return 0; | ||
368 | } | ||
369 | else if (dest->version == 3) | ||
370 | { | ||
371 | if (dest->header_len < _CHM_ITSF_V3_LEN) | ||
372 | return 0; | ||
373 | } | ||
374 | else | ||
375 | return 0; | ||
376 | |||
377 | /* now, if we have a V3 structure, unmarshal the rest. | ||
378 | * otherwise, compute it | ||
379 | */ | ||
380 | if (dest->version == 3) | ||
381 | { | ||
382 | if (*pDataLen != 0) | ||
383 | _unmarshal_uint64(pData, pDataLen, &dest->data_offset); | ||
384 | else | ||
385 | return 0; | ||
386 | } | ||
387 | else | ||
388 | dest->data_offset = dest->dir_offset + dest->dir_len; | ||
389 | |||
390 | return 1; | ||
391 | } | ||
392 | |||
393 | /* structure of ITSP headers */ | ||
394 | #define _CHM_ITSP_V1_LEN (0x54) | ||
395 | struct chmItspHeader | ||
396 | { | ||
397 | char signature[4]; /* 0 (ITSP) */ | ||
398 | Int32 version; /* 4 */ | ||
399 | Int32 header_len; /* 8 */ | ||
400 | Int32 unknown_000c; /* c */ | ||
401 | UInt32 block_len; /* 10 */ | ||
402 | Int32 blockidx_intvl; /* 14 */ | ||
403 | Int32 index_depth; /* 18 */ | ||
404 | Int32 index_root; /* 1c */ | ||
405 | Int32 index_head; /* 20 */ | ||
406 | Int32 unknown_0024; /* 24 */ | ||
407 | UInt32 num_blocks; /* 28 */ | ||
408 | Int32 unknown_002c; /* 2c */ | ||
409 | UInt32 lang_id; /* 30 */ | ||
410 | UChar system_uuid[16]; /* 34 */ | ||
411 | UChar unknown_0044[16]; /* 44 */ | ||
412 | }; /* __attribute__ ((aligned (1))); */ | ||
413 | |||
414 | static int _unmarshal_itsp_header(unsigned char **pData, | ||
415 | unsigned long *pDataLen, | ||
416 | struct chmItspHeader *dest) | ||
417 | { | ||
418 | /* we only know how to deal with a 0x54 byte structures */ | ||
419 | if (*pDataLen != _CHM_ITSP_V1_LEN) | ||
420 | return 0; | ||
421 | |||
422 | /* unmarshal fields */ | ||
423 | _unmarshal_char_array(pData, pDataLen, dest->signature, 4); | ||
424 | _unmarshal_int32 (pData, pDataLen, &dest->version); | ||
425 | _unmarshal_int32 (pData, pDataLen, &dest->header_len); | ||
426 | _unmarshal_int32 (pData, pDataLen, &dest->unknown_000c); | ||
427 | _unmarshal_uint32 (pData, pDataLen, &dest->block_len); | ||
428 | _unmarshal_int32 (pData, pDataLen, &dest->blockidx_intvl); | ||
429 | _unmarshal_int32 (pData, pDataLen, &dest->index_depth); | ||
430 | _unmarshal_int32 (pData, pDataLen, &dest->index_root); | ||
431 | _unmarshal_int32 (pData, pDataLen, &dest->index_head); | ||
432 | _unmarshal_int32 (pData, pDataLen, &dest->unknown_0024); | ||
433 | _unmarshal_uint32 (pData, pDataLen, &dest->num_blocks); | ||
434 | _unmarshal_int32 (pData, pDataLen, &dest->unknown_002c); | ||
435 | _unmarshal_uint32 (pData, pDataLen, &dest->lang_id); | ||
436 | _unmarshal_uuid (pData, pDataLen, dest->system_uuid); | ||
437 | _unmarshal_uchar_array(pData, pDataLen, dest->unknown_0044, 16); | ||
438 | |||
439 | /* error check the data */ | ||
440 | if (memcmp(dest->signature, "ITSP", 4) != 0) | ||
441 | return 0; | ||
442 | if (dest->version != 1) | ||
443 | return 0; | ||
444 | if (dest->header_len != _CHM_ITSP_V1_LEN) | ||
445 | return 0; | ||
446 | |||
447 | return 1; | ||
448 | } | ||
449 | |||
450 | /* structure of PMGL headers */ | ||
451 | static const char _chm_pmgl_marker[4] = "PMGL"; | ||
452 | #define _CHM_PMGL_LEN (0x14) | ||
453 | struct chmPmglHeader | ||
454 | { | ||
455 | char signature[4]; /* 0 (PMGL) */ | ||
456 | UInt32 free_space; /* 4 */ | ||
457 | UInt32 unknown_0008; /* 8 */ | ||
458 | Int32 block_prev; /* c */ | ||
459 | Int32 block_next; /* 10 */ | ||
460 | }; /* __attribute__ ((aligned (1))); */ | ||
461 | |||
462 | static int _unmarshal_pmgl_header(unsigned char **pData, | ||
463 | unsigned long *pDataLen, | ||
464 | struct chmPmglHeader *dest) | ||
465 | { | ||
466 | /* we only know how to deal with a 0x14 byte structures */ | ||
467 | if (*pDataLen != _CHM_PMGL_LEN) | ||
468 | return 0; | ||
469 | |||
470 | /* unmarshal fields */ | ||
471 | _unmarshal_char_array(pData, pDataLen, dest->signature, 4); | ||
472 | _unmarshal_uint32 (pData, pDataLen, &dest->free_space); | ||
473 | _unmarshal_uint32 (pData, pDataLen, &dest->unknown_0008); | ||
474 | _unmarshal_int32 (pData, pDataLen, &dest->block_prev); | ||
475 | _unmarshal_int32 (pData, pDataLen, &dest->block_next); | ||
476 | |||
477 | /* check structure */ | ||
478 | if (memcmp(dest->signature, _chm_pmgl_marker, 4) != 0) | ||
479 | return 0; | ||
480 | |||
481 | return 1; | ||
482 | } | ||
483 | |||
484 | /* structure of PMGI headers */ | ||
485 | static const char _chm_pmgi_marker[4] = "PMGI"; | ||
486 | #define _CHM_PMGI_LEN (0x08) | ||
487 | struct chmPmgiHeader | ||
488 | { | ||
489 | char signature[4]; /* 0 (PMGI) */ | ||
490 | UInt32 free_space; /* 4 */ | ||
491 | }; /* __attribute__ ((aligned (1))); */ | ||
492 | |||
493 | static int _unmarshal_pmgi_header(unsigned char **pData, | ||
494 | unsigned long *pDataLen, | ||
495 | struct chmPmgiHeader *dest) | ||
496 | { | ||
497 | /* we only know how to deal with a 0x8 byte structures */ | ||
498 | if (*pDataLen != _CHM_PMGI_LEN) | ||
499 | return 0; | ||
500 | |||
501 | /* unmarshal fields */ | ||
502 | _unmarshal_char_array(pData, pDataLen, dest->signature, 4); | ||
503 | _unmarshal_uint32 (pData, pDataLen, &dest->free_space); | ||
504 | |||
505 | /* check structure */ | ||
506 | if (memcmp(dest->signature, _chm_pmgi_marker, 4) != 0) | ||
507 | return 0; | ||
508 | |||
509 | return 1; | ||
510 | } | ||
511 | |||
512 | /* structure of LZXC reset table */ | ||
513 | #define _CHM_LZXC_RESETTABLE_V1_LEN (0x28) | ||
514 | struct chmLzxcResetTable | ||
515 | { | ||
516 | UInt32 version; | ||
517 | UInt32 block_count; | ||
518 | UInt32 unknown; | ||
519 | UInt32 table_offset; | ||
520 | UInt64 uncompressed_len; | ||
521 | UInt64 compressed_len; | ||
522 | UInt64 block_len; | ||
523 | }; /* __attribute__ ((aligned (1))); */ | ||
524 | |||
525 | static int _unmarshal_lzxc_reset_table(unsigned char **pData, | ||
526 | unsigned long *pDataLen, | ||
527 | struct chmLzxcResetTable *dest) | ||
528 | { | ||
529 | /* we only know how to deal with a 0x28 byte structures */ | ||
530 | if (*pDataLen != _CHM_LZXC_RESETTABLE_V1_LEN) | ||
531 | return 0; | ||
532 | |||
533 | /* unmarshal fields */ | ||
534 | _unmarshal_uint32 (pData, pDataLen, &dest->version); | ||
535 | _unmarshal_uint32 (pData, pDataLen, &dest->block_count); | ||
536 | _unmarshal_uint32 (pData, pDataLen, &dest->unknown); | ||
537 | _unmarshal_uint32 (pData, pDataLen, &dest->table_offset); | ||
538 | _unmarshal_uint64 (pData, pDataLen, &dest->uncompressed_len); | ||
539 | _unmarshal_uint64 (pData, pDataLen, &dest->compressed_len); | ||
540 | _unmarshal_uint64 (pData, pDataLen, &dest->block_len); | ||
541 | |||
542 | /* check structure */ | ||
543 | if (dest->version != 2) | ||
544 | return 0; | ||
545 | |||
546 | return 1; | ||
547 | } | ||
548 | |||
549 | /* structure of LZXC control data block */ | ||
550 | #define _CHM_LZXC_MIN_LEN (0x18) | ||
551 | #define _CHM_LZXC_V2_LEN (0x1c) | ||
552 | struct chmLzxcControlData | ||
553 | { | ||
554 | UInt32 size; /* 0 */ | ||
555 | char signature[4]; /* 4 (LZXC) */ | ||
556 | UInt32 version; /* 8 */ | ||
557 | UInt32 resetInterval; /* c */ | ||
558 | UInt32 windowSize; /* 10 */ | ||
559 | UInt32 unknown_14; /* 14 */ | ||
560 | UInt32 unknown_18; /* 18 */ | ||
561 | }; | ||
562 | |||
563 | static int _unmarshal_lzxc_control_data(unsigned char **pData, | ||
564 | unsigned long *pDataLen, | ||
565 | struct chmLzxcControlData *dest) | ||
566 | { | ||
567 | /* we want at least 0x18 bytes */ | ||
568 | if (*pDataLen < _CHM_LZXC_MIN_LEN) | ||
569 | return 0; | ||
570 | |||
571 | /* unmarshal fields */ | ||
572 | _unmarshal_uint32 (pData, pDataLen, &dest->size); | ||
573 | _unmarshal_char_array(pData, pDataLen, dest->signature, 4); | ||
574 | _unmarshal_uint32 (pData, pDataLen, &dest->version); | ||
575 | _unmarshal_uint32 (pData, pDataLen, &dest->resetInterval); | ||
576 | _unmarshal_uint32 (pData, pDataLen, &dest->windowSize); | ||
577 | _unmarshal_uint32 (pData, pDataLen, &dest->unknown_14); | ||
578 | |||
579 | if (*pDataLen >= _CHM_LZXC_V2_LEN) | ||
580 | _unmarshal_uint32 (pData, pDataLen, &dest->unknown_18); | ||
581 | else | ||
582 | dest->unknown_18 = 0; | ||
583 | |||
584 | if (dest->version == 2) | ||
585 | { | ||
586 | dest->resetInterval *= 0x8000; | ||
587 | dest->windowSize *= 0x8000; | ||
588 | dest->unknown_14 *= 0x8000; | ||
589 | } | ||
590 | if (dest->windowSize == 0 || dest->resetInterval == 0) | ||
591 | return 0; | ||
592 | |||
593 | /* for now, only support resetInterval a multiple of windowSize/2 */ | ||
594 | if (dest->windowSize == 1) | ||
595 | return 0; | ||
596 | if ((dest->resetInterval % (dest->windowSize/2)) != 0) | ||
597 | return 0; | ||
598 | |||
599 | /* check structure */ | ||
600 | if (memcmp(dest->signature, "LZXC", 4) != 0) | ||
601 | return 0; | ||
602 | |||
603 | return 1; | ||
604 | } | ||
605 | |||
606 | /* the structure used for chm file handles */ | ||
607 | struct chmFile | ||
608 | { | ||
609 | #ifdef WIN32 | ||
610 | HANDLE fd; | ||
611 | #else | ||
612 | int fd; | ||
613 | #endif | ||
614 | |||
615 | #ifdef CHM_MT | ||
616 | #ifdef WIN32 | ||
617 | CRITICAL_SECTION mutex; | ||
618 | CRITICAL_SECTION lzx_mutex; | ||
619 | CRITICAL_SECTION cache_mutex; | ||
620 | #else | ||
621 | pthread_mutex_t mutex; | ||
622 | pthread_mutex_t lzx_mutex; | ||
623 | pthread_mutex_t cache_mutex; | ||
624 | #endif | ||
625 | #endif | ||
626 | |||
627 | UInt64 dir_offset; | ||
628 | UInt64 dir_len; | ||
629 | UInt64 data_offset; | ||
630 | Int32 index_root; | ||
631 | Int32 index_head; | ||
632 | UInt32 block_len; | ||
633 | |||
634 | UInt64 span; | ||
635 | struct chmUnitInfo rt_unit; | ||
636 | struct chmUnitInfo cn_unit; | ||
637 | struct chmLzxcResetTable reset_table; | ||
638 | |||
639 | /* LZX control data */ | ||
640 | UInt32 window_size; | ||
641 | UInt32 reset_interval; | ||
642 | UInt32 reset_blkcount; | ||
643 | |||
644 | /* decompressor state */ | ||
645 | struct LZXstate *lzx_state; | ||
646 | int lzx_last_block; | ||
647 | |||
648 | /* cache for decompressed blocks */ | ||
649 | UChar **cache_blocks; | ||
650 | Int64 *cache_block_indices; | ||
651 | Int32 cache_num_blocks; | ||
652 | }; | ||
653 | |||
654 | /* | ||
655 | * utility functions local to this module | ||
656 | */ | ||
657 | |||
658 | /* utility function to handle differences between {pread,read}(64)? */ | ||
659 | static Int64 _chm_fetch_bytes(struct chmFile *h, | ||
660 | UChar *buf, | ||
661 | UInt64 os, | ||
662 | Int64 len) | ||
663 | { | ||
664 | Int64 readLen=0, oldOs=0; | ||
665 | if (h->fd == CHM_NULL_FD) | ||
666 | return readLen; | ||
667 | |||
668 | CHM_ACQUIRE_LOCK(h->mutex); | ||
669 | #ifdef CHM_USE_WIN32IO | ||
670 | /* NOTE: this might be better done with CreateFileMapping, et cetera... */ | ||
671 | { | ||
672 | DWORD origOffsetLo=0, origOffsetHi=0; | ||
673 | DWORD offsetLo, offsetHi; | ||
674 | DWORD actualLen=0; | ||
675 | |||
676 | /* awkward Win32 Seek/Tell */ | ||
677 | offsetLo = (unsigned long)(os & 0xffffffffL); | ||
678 | offsetHi = (unsigned long)((os >> 32) & 0xffffffffL); | ||
679 | origOffsetLo = SetFilePointer(h->fd, 0, &origOffsetHi, FILE_CURRENT); | ||
680 | offsetLo = SetFilePointer(h->fd, offsetLo, &offsetHi, FILE_BEGIN); | ||
681 | |||
682 | /* read the data */ | ||
683 | if (ReadFile(h->fd, | ||
684 | buf, | ||
685 | (DWORD)len, | ||
686 | &actualLen, | ||
687 | NULL) == TRUE) | ||
688 | readLen = actualLen; | ||
689 | else | ||
690 | readLen = 0; | ||
691 | |||
692 | /* restore original position */ | ||
693 | SetFilePointer(h->fd, origOffsetLo, &origOffsetHi, FILE_BEGIN); | ||
694 | } | ||
695 | #else | ||
696 | #ifdef CHM_USE_PREAD | ||
697 | #ifdef CHM_USE_IO64 | ||
698 | readLen = pread64(h->fd, buf, (long)len, os); | ||
699 | #else | ||
700 | readLen = pread(h->fd, buf, (long)len, (unsigned long)os); | ||
701 | #endif | ||
702 | #else | ||
703 | #ifdef CHM_USE_IO64 | ||
704 | oldOs = lseek64(h->fd, 0, SEEK_CUR); | ||
705 | lseek64(h->fd, os, SEEK_SET); | ||
706 | readLen = read(h->fd, buf, len); | ||
707 | lseek64(h->fd, oldOs, SEEK_SET); | ||
708 | #else | ||
709 | oldOs = lseek(h->fd, 0, SEEK_CUR); | ||
710 | lseek(h->fd, (long)os, SEEK_SET); | ||
711 | readLen = read(h->fd, buf, len); | ||
712 | lseek(h->fd, (long)oldOs, SEEK_SET); | ||
713 | #endif | ||
714 | #endif | ||
715 | #endif | ||
716 | CHM_RELEASE_LOCK(h->mutex); | ||
717 | return readLen; | ||
718 | } | ||
719 | |||
720 | /* open an ITS archive */ | ||
721 | struct chmFile *chm_open(const char *filename) | ||
722 | { | ||
723 | unsigned char sbuffer[256]; | ||
724 | unsigned long sremain; | ||
725 | unsigned char *sbufpos; | ||
726 | struct chmFile *newHandle=NULL; | ||
727 | struct chmItsfHeader itsfHeader; | ||
728 | struct chmItspHeader itspHeader; | ||
729 | struct chmUnitInfo uiSpan; | ||
730 | struct chmUnitInfo uiLzxc; | ||
731 | struct chmLzxcControlData ctlData; | ||
732 | |||
733 | /* allocate handle */ | ||
734 | newHandle = (struct chmFile *)malloc(sizeof(struct chmFile)); | ||
735 | newHandle->fd = CHM_NULL_FD; | ||
736 | newHandle->lzx_state = NULL; | ||
737 | newHandle->cache_blocks = NULL; | ||
738 | newHandle->cache_block_indices = NULL; | ||
739 | newHandle->cache_num_blocks = 0; | ||
740 | |||
741 | /* open file */ | ||
742 | #ifdef WIN32 | ||
743 | if ((newHandle->fd=CreateFileA(filename, | ||
744 | GENERIC_READ, | ||
745 | 0, | ||
746 | NULL, | ||
747 | OPEN_EXISTING, | ||
748 | FILE_ATTRIBUTE_NORMAL, | ||
749 | NULL)) == CHM_NULL_FD) | ||
750 | { | ||
751 | free(newHandle); | ||
752 | return NULL; | ||
753 | } | ||
754 | #else | ||
755 | if ((newHandle->fd=open(filename, O_RDONLY)) == CHM_NULL_FD) | ||
756 | { | ||
757 | free(newHandle); | ||
758 | return NULL; | ||
759 | } | ||
760 | #endif | ||
761 | |||
762 | /* initialize mutexes, if needed */ | ||
763 | #ifdef CHM_MT | ||
764 | #ifdef WIN32 | ||
765 | InitializeCriticalSection(&newHandle->mutex); | ||
766 | InitializeCriticalSection(&newHandle->lzx_mutex); | ||
767 | InitializeCriticalSection(&newHandle->cache_mutex); | ||
768 | #else | ||
769 | pthread_mutex_init(&newHandle->mutex, NULL); | ||
770 | pthread_mutex_init(&newHandle->lzx_mutex, NULL); | ||
771 | pthread_mutex_init(&newHandle->cache_mutex, NULL); | ||
772 | #endif | ||
773 | #endif | ||
774 | |||
775 | /* read and verify header */ | ||
776 | sremain = _CHM_ITSF_V3_LEN; | ||
777 | sbufpos = sbuffer; | ||
778 | if (_chm_fetch_bytes(newHandle, sbuffer, (UInt64)0, sremain) != sremain || | ||
779 | !_unmarshal_itsf_header(&sbufpos, &sremain, &itsfHeader)) | ||
780 | { | ||
781 | chm_close(newHandle); | ||
782 | return NULL; | ||
783 | } | ||
784 | |||
785 | /* stash important values from header */ | ||
786 | newHandle->dir_offset = itsfHeader.dir_offset; | ||
787 | newHandle->dir_len = itsfHeader.dir_len; | ||
788 | newHandle->data_offset = itsfHeader.data_offset; | ||
789 | |||
790 | /* now, read and verify the directory header chunk */ | ||
791 | sremain = _CHM_ITSP_V1_LEN; | ||
792 | sbufpos = sbuffer; | ||
793 | if (_chm_fetch_bytes(newHandle, sbuffer, | ||
794 | (UInt64)itsfHeader.dir_offset, sremain) != sremain || | ||
795 | !_unmarshal_itsp_header(&sbufpos, &sremain, &itspHeader)) | ||
796 | { | ||
797 | chm_close(newHandle); | ||
798 | return NULL; | ||
799 | } | ||
800 | |||
801 | /* grab essential information from ITSP header */ | ||
802 | newHandle->dir_offset += itspHeader.header_len; | ||
803 | newHandle->dir_len -= itspHeader.header_len; | ||
804 | newHandle->index_root = itspHeader.index_root; | ||
805 | newHandle->index_head = itspHeader.index_head; | ||
806 | newHandle->block_len = itspHeader.block_len; | ||
807 | |||
808 | /* if the index root is -1, this means we don't have any PMGI blocks. | ||
809 | * as a result, we must use the sole PMGL block as the index root | ||
810 | */ | ||
811 | if (newHandle->index_root == -1) | ||
812 | newHandle->index_root = newHandle->index_head; | ||
813 | |||
814 | /* prefetch most commonly needed unit infos */ | ||
815 | if (CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle, | ||
816 | _CHMU_SPANINFO, | ||
817 | &uiSpan) || | ||
818 | uiSpan.space == CHM_COMPRESSED || | ||
819 | CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle, | ||
820 | _CHMU_RESET_TABLE, | ||
821 | &newHandle->rt_unit) || | ||
822 | newHandle->rt_unit.space == CHM_COMPRESSED || | ||
823 | CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle, | ||
824 | _CHMU_CONTENT, | ||
825 | &newHandle->cn_unit) || | ||
826 | newHandle->cn_unit.space == CHM_COMPRESSED || | ||
827 | CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle, | ||
828 | _CHMU_LZXC_CONTROLDATA, | ||
829 | &uiLzxc) || | ||
830 | uiLzxc.space == CHM_COMPRESSED) | ||
831 | { | ||
832 | chm_close(newHandle); | ||
833 | return NULL; | ||
834 | } | ||
835 | |||
836 | /* try to read span */ | ||
837 | /* N.B.: we've already checked that uiSpan is in the uncompressed section, | ||
838 | * so this should not require attempting to decompress, which may | ||
839 | * rely on having a valid "span" | ||
840 | */ | ||
841 | sremain = 8; | ||
842 | sbufpos = sbuffer; | ||
843 | if (chm_retrieve_object(newHandle, &uiSpan, sbuffer, | ||
844 | 0, sremain) != sremain || | ||
845 | !_unmarshal_uint64(&sbufpos, &sremain, &newHandle->span)) | ||
846 | { | ||
847 | chm_close(newHandle); | ||
848 | return NULL; | ||
849 | } | ||
850 | |||
851 | /* read reset table info */ | ||
852 | sremain = _CHM_LZXC_RESETTABLE_V1_LEN; | ||
853 | sbufpos = sbuffer; | ||
854 | if (chm_retrieve_object(newHandle, &newHandle->rt_unit, sbuffer, | ||
855 | 0, sremain) != sremain || | ||
856 | !_unmarshal_lzxc_reset_table(&sbufpos, &sremain, | ||
857 | &newHandle->reset_table)) | ||
858 | { | ||
859 | chm_close(newHandle); | ||
860 | return NULL; | ||
861 | } | ||
862 | |||
863 | /* read control data */ | ||
864 | sremain = (unsigned long)uiLzxc.length; | ||
865 | sbufpos = sbuffer; | ||
866 | if (chm_retrieve_object(newHandle, &uiLzxc, sbuffer, | ||
867 | 0, sremain) != sremain || | ||
868 | !_unmarshal_lzxc_control_data(&sbufpos, &sremain, | ||
869 | &ctlData)) | ||
870 | { | ||
871 | chm_close(newHandle); | ||
872 | return NULL; | ||
873 | } | ||
874 | newHandle->window_size = ctlData.windowSize; | ||
875 | newHandle->reset_interval = ctlData.resetInterval; | ||
876 | newHandle->reset_blkcount = newHandle->reset_interval / | ||
877 | (newHandle->window_size / 2); | ||
878 | |||
879 | /* initialize cache */ | ||
880 | chm_set_param(newHandle, CHM_PARAM_MAX_BLOCKS_CACHED, | ||
881 | CHM_MAX_BLOCKS_CACHED); | ||
882 | |||
883 | return newHandle; | ||
884 | } | ||
885 | |||
886 | /* close an ITS archive */ | ||
887 | void chm_close(struct chmFile *h) | ||
888 | { | ||
889 | if (h != NULL) | ||
890 | { | ||
891 | if (h->fd != CHM_NULL_FD) | ||
892 | CHM_CLOSE_FILE(h->fd); | ||
893 | h->fd = CHM_NULL_FD; | ||
894 | |||
895 | #ifdef CHM_MT | ||
896 | #ifdef WIN32 | ||
897 | DeleteCriticalSection(&h->mutex); | ||
898 | DeleteCriticalSection(&h->lzx_mutex); | ||
899 | DeleteCriticalSection(&h->cache_mutex); | ||
900 | #else | ||
901 | pthread_mutex_destroy(&h->mutex); | ||
902 | pthread_mutex_destroy(&h->lzx_mutex); | ||
903 | pthread_mutex_destroy(&h->cache_mutex); | ||
904 | #endif | ||
905 | #endif | ||
906 | |||
907 | if (h->lzx_state) | ||
908 | LZXteardown(h->lzx_state); | ||
909 | h->lzx_state = NULL; | ||
910 | |||
911 | if (h->cache_blocks) | ||
912 | { | ||
913 | int i; | ||
914 | for (i=0; i<h->cache_num_blocks; i++) | ||
915 | { | ||
916 | if (h->cache_blocks[i]) | ||
917 | free(h->cache_blocks[i]); | ||
918 | } | ||
919 | free(h->cache_blocks); | ||
920 | h->cache_blocks = NULL; | ||
921 | } | ||
922 | |||
923 | if (h->cache_block_indices) | ||
924 | free(h->cache_block_indices); | ||
925 | h->cache_block_indices = NULL; | ||
926 | |||
927 | free(h); | ||
928 | } | ||
929 | } | ||
930 | |||
931 | /* | ||
932 | * set a parameter on the file handle. | ||
933 | * valid parameter types: | ||
934 | * CHM_PARAM_MAX_BLOCKS_CACHED: | ||
935 | * how many decompressed blocks should be cached? A simple | ||
936 | * caching scheme is used, wherein the index of the block is | ||
937 | * used as a hash value, and hash collision results in the | ||
938 | * invalidation of the previously cached block. | ||
939 | */ | ||
940 | void chm_set_param(struct chmFile *h, | ||
941 | int paramType, | ||
942 | int paramVal) | ||
943 | { | ||
944 | switch (paramType) | ||
945 | { | ||
946 | case CHM_PARAM_MAX_BLOCKS_CACHED: | ||
947 | CHM_ACQUIRE_LOCK(h->cache_mutex); | ||
948 | if (paramVal != h->cache_num_blocks) | ||
949 | { | ||
950 | UChar **newBlocks; | ||
951 | UInt64 *newIndices; | ||
952 | int i; | ||
953 | |||
954 | /* allocate new cached blocks */ | ||
955 | newBlocks = (UChar **)malloc(paramVal * sizeof (UChar *)); | ||
956 | newIndices = (UInt64 *)malloc(paramVal * sizeof (UInt64)); | ||
957 | for (i=0; i<paramVal; i++) | ||
958 | { | ||
959 | newBlocks[i] = NULL; | ||
960 | newIndices[i] = 0; | ||
961 | } | ||
962 | |||
963 | /* re-distribute old cached blocks */ | ||
964 | if (h->cache_blocks) | ||
965 | { | ||
966 | for (i=0; i<h->cache_num_blocks; i++) | ||
967 | { | ||
968 | int newSlot = (int)(h->cache_block_indices[i] % paramVal); | ||
969 | |||
970 | if (h->cache_blocks[i]) | ||
971 | { | ||
972 | /* in case of collision, destroy newcomer */ | ||
973 | if (newBlocks[newSlot]) | ||
974 | { | ||
975 | free(h->cache_blocks[i]); | ||
976 | h->cache_blocks[i] = NULL; | ||
977 | } | ||
978 | else | ||
979 | { | ||
980 | newBlocks[newSlot] = h->cache_blocks[i]; | ||
981 | newIndices[newSlot] = | ||
982 | h->cache_block_indices[i]; | ||
983 | } | ||
984 | } | ||
985 | } | ||
986 | |||
987 | free(h->cache_blocks); | ||
988 | free(h->cache_block_indices); | ||
989 | } | ||
990 | |||
991 | /* now, set new values */ | ||
992 | h->cache_blocks = newBlocks; | ||
993 | h->cache_block_indices = newIndices; | ||
994 | h->cache_num_blocks = paramVal; | ||
995 | } | ||
996 | CHM_RELEASE_LOCK(h->cache_mutex); | ||
997 | break; | ||
998 | |||
999 | default: | ||
1000 | break; | ||
1001 | } | ||
1002 | } | ||
1003 | |||
1004 | /* | ||
1005 | * helper methods for chm_resolve_object | ||
1006 | */ | ||
1007 | |||
1008 | /* skip a compressed dword */ | ||
1009 | static void _chm_skip_cword(UChar **pEntry) | ||
1010 | { | ||
1011 | while (*(*pEntry)++ >= 0x80) | ||
1012 | ; | ||
1013 | } | ||
1014 | |||
1015 | /* skip the data from a PMGL entry */ | ||
1016 | static void _chm_skip_PMGL_entry_data(UChar **pEntry) | ||
1017 | { | ||
1018 | _chm_skip_cword(pEntry); | ||
1019 | _chm_skip_cword(pEntry); | ||
1020 | _chm_skip_cword(pEntry); | ||
1021 | } | ||
1022 | |||
1023 | /* parse a compressed dword */ | ||
1024 | static UInt64 _chm_parse_cword(UChar **pEntry) | ||
1025 | { | ||
1026 | UInt64 accum = 0; | ||
1027 | UChar temp; | ||
1028 | while ((temp=*(*pEntry)++) >= 0x80) | ||
1029 | { | ||
1030 | accum <<= 7; | ||
1031 | accum += temp & 0x7f; | ||
1032 | } | ||
1033 | |||
1034 | return (accum << 7) + temp; | ||
1035 | } | ||
1036 | |||
1037 | /* parse a utf-8 string into an ASCII char buffer */ | ||
1038 | static int _chm_parse_UTF8(UChar **pEntry, UInt64 count, char *path) | ||
1039 | { | ||
1040 | /* XXX: implement UTF-8 support, including a real mapping onto | ||
1041 | * ISO-8859-1? probably there is a library to do this? As is | ||
1042 | * immediately apparent from the below code, I'm only handling files | ||
1043 | * in which none of the strings contain UTF-8 multi-byte characters. | ||
1044 | */ | ||
1045 | while (count != 0) | ||
1046 | { | ||
1047 | if (*(*pEntry) > 0x7f) | ||
1048 | return 0; | ||
1049 | |||
1050 | *path++ = (char)(*(*pEntry)++); | ||
1051 | --count; | ||
1052 | } | ||
1053 | |||
1054 | *path = '\0'; | ||
1055 | return 1; | ||
1056 | } | ||
1057 | |||
1058 | /* parse a PMGL entry into a chmUnitInfo struct; return 1 on success. */ | ||
1059 | static int _chm_parse_PMGL_entry(UChar **pEntry, struct chmUnitInfo *ui) | ||
1060 | { | ||
1061 | UInt64 strLen; | ||
1062 | |||
1063 | /* parse str len */ | ||
1064 | strLen = _chm_parse_cword(pEntry); | ||
1065 | if (strLen > CHM_MAX_PATHLEN) | ||
1066 | return 0; | ||
1067 | |||
1068 | /* parse path */ | ||
1069 | if (! _chm_parse_UTF8(pEntry, strLen, ui->path)) | ||
1070 | return 0; | ||
1071 | |||
1072 | /* parse info */ | ||
1073 | ui->space = (int)_chm_parse_cword(pEntry); | ||
1074 | ui->start = _chm_parse_cword(pEntry); | ||
1075 | ui->length = _chm_parse_cword(pEntry); | ||
1076 | return 1; | ||
1077 | } | ||
1078 | |||
1079 | /* find an exact entry in PMGL; return NULL if we fail */ | ||
1080 | static UChar *_chm_find_in_PMGL(UChar *page_buf, | ||
1081 | UInt32 block_len, | ||
1082 | const char *objPath) | ||
1083 | { | ||
1084 | /* XXX: modify this to do a binary search using the nice index structure | ||
1085 | * that is provided for us. | ||
1086 | */ | ||
1087 | struct chmPmglHeader header; | ||
1088 | UInt32 hremain; | ||
1089 | UChar *end; | ||
1090 | UChar *cur; | ||
1091 | UChar *temp; | ||
1092 | UInt64 strLen; | ||
1093 | char buffer[CHM_MAX_PATHLEN+1]; | ||
1094 | |||
1095 | /* figure out where to start and end */ | ||
1096 | cur = page_buf; | ||
1097 | hremain = _CHM_PMGL_LEN; | ||
1098 | if (! _unmarshal_pmgl_header(&cur, &hremain, &header)) | ||
1099 | return NULL; | ||
1100 | end = page_buf + block_len - (header.free_space); | ||
1101 | |||
1102 | /* now, scan progressively */ | ||
1103 | while (cur < end) | ||
1104 | { | ||
1105 | /* grab the name */ | ||
1106 | temp = cur; | ||
1107 | strLen = _chm_parse_cword(&cur); | ||
1108 | if (! _chm_parse_UTF8(&cur, strLen, buffer)) | ||
1109 | return NULL; | ||
1110 | |||
1111 | /* check if it is the right name */ | ||
1112 | #ifdef WIN32 | ||
1113 | if (! stricmp(buffer, objPath)) | ||
1114 | return temp; | ||
1115 | #else | ||
1116 | if (! strcasecmp(buffer, objPath)) | ||
1117 | return temp; | ||
1118 | #endif | ||
1119 | |||
1120 | _chm_skip_PMGL_entry_data(&cur); | ||
1121 | } | ||
1122 | |||
1123 | return NULL; | ||
1124 | } | ||
1125 | |||
1126 | /* find which block should be searched next for the entry; -1 if no block */ | ||
1127 | static Int32 _chm_find_in_PMGI(UChar *page_buf, | ||
1128 | UInt32 block_len, | ||
1129 | const char *objPath) | ||
1130 | { | ||
1131 | /* XXX: modify this to do a binary search using the nice index structure | ||
1132 | * that is provided for us | ||
1133 | */ | ||
1134 | struct chmPmgiHeader header; | ||
1135 | UInt32 hremain; | ||
1136 | int page=-1; | ||
1137 | UChar *end; | ||
1138 | UChar *cur; | ||
1139 | UInt64 strLen; | ||
1140 | char buffer[CHM_MAX_PATHLEN+1]; | ||
1141 | |||
1142 | /* figure out where to start and end */ | ||
1143 | cur = page_buf; | ||
1144 | hremain = _CHM_PMGI_LEN; | ||
1145 | if (! _unmarshal_pmgi_header(&cur, &hremain, &header)) | ||
1146 | return -1; | ||
1147 | end = page_buf + block_len - (header.free_space); | ||
1148 | |||
1149 | /* now, scan progressively */ | ||
1150 | while (cur < end) | ||
1151 | { | ||
1152 | /* grab the name */ | ||
1153 | strLen = _chm_parse_cword(&cur); | ||
1154 | if (! _chm_parse_UTF8(&cur, strLen, buffer)) | ||
1155 | return -1; | ||
1156 | |||
1157 | /* check if it is the right name */ | ||
1158 | #ifdef WIN32 | ||
1159 | if (stricmp(buffer, objPath) > 0) | ||
1160 | return page; | ||
1161 | #else | ||
1162 | if (strcasecmp(buffer, objPath) > 0) | ||
1163 | return page; | ||
1164 | #endif | ||
1165 | |||
1166 | /* load next value for path */ | ||
1167 | page = (int)_chm_parse_cword(&cur); | ||
1168 | } | ||
1169 | |||
1170 | return page; | ||
1171 | } | ||
1172 | |||
1173 | /* resolve a particular object from the archive */ | ||
1174 | int chm_resolve_object(struct chmFile *h, | ||
1175 | const char *objPath, | ||
1176 | struct chmUnitInfo *ui) | ||
1177 | { | ||
1178 | /* | ||
1179 | * XXX: implement caching scheme for dir pages | ||
1180 | */ | ||
1181 | |||
1182 | Int32 curPage; | ||
1183 | |||
1184 | /* buffer to hold whatever page we're looking at */ | ||
1185 | #ifdef WIN32 | ||
1186 | UChar *page_buf = alloca(h->block_len); | ||
1187 | #else | ||
1188 | UChar page_buf[h->block_len]; | ||
1189 | #endif | ||
1190 | |||
1191 | /* starting page */ | ||
1192 | curPage = h->index_root; | ||
1193 | |||
1194 | /* until we have either returned or given up */ | ||
1195 | while (curPage != -1) | ||
1196 | { | ||
1197 | |||
1198 | /* try to fetch the index page */ | ||
1199 | if (_chm_fetch_bytes(h, page_buf, | ||
1200 | (UInt64)h->dir_offset + (UInt64)curPage*h->block_len, | ||
1201 | h->block_len) != h->block_len) | ||
1202 | return CHM_RESOLVE_FAILURE; | ||
1203 | |||
1204 | /* now, if it is a leaf node: */ | ||
1205 | if (memcmp(page_buf, _chm_pmgl_marker, 4) == 0) | ||
1206 | { | ||
1207 | /* scan block */ | ||
1208 | UChar *pEntry = _chm_find_in_PMGL(page_buf, | ||
1209 | h->block_len, | ||
1210 | objPath); | ||
1211 | if (pEntry == NULL) | ||
1212 | return CHM_RESOLVE_FAILURE; | ||
1213 | |||
1214 | /* parse entry and return */ | ||
1215 | _chm_parse_PMGL_entry(&pEntry, ui); | ||
1216 | return CHM_RESOLVE_SUCCESS; | ||
1217 | } | ||
1218 | |||
1219 | /* else, if it is a branch node: */ | ||
1220 | else if (memcmp(page_buf, _chm_pmgi_marker, 4) == 0) | ||
1221 | curPage = _chm_find_in_PMGI(page_buf, h->block_len, objPath); | ||
1222 | |||
1223 | /* else, we are confused. give up. */ | ||
1224 | else | ||
1225 | return CHM_RESOLVE_FAILURE; | ||
1226 | } | ||
1227 | |||
1228 | /* didn't find anything. fail. */ | ||
1229 | return CHM_RESOLVE_FAILURE; | ||
1230 | } | ||
1231 | |||
1232 | /* | ||
1233 | * utility methods for dealing with compressed data | ||
1234 | */ | ||
1235 | |||
1236 | /* get the bounds of a compressed block. return 0 on failure */ | ||
1237 | static int _chm_get_cmpblock_bounds(struct chmFile *h, | ||
1238 | UInt64 block, | ||
1239 | UInt64 *start, | ||
1240 | Int64 *len) | ||
1241 | { | ||
1242 | UChar buffer[8], *dummy; | ||
1243 | UInt32 remain; | ||
1244 | |||
1245 | /* for all but the last block, use the reset table */ | ||
1246 | if (block < h->reset_table.block_count-1) | ||
1247 | { | ||
1248 | /* unpack the start address */ | ||
1249 | dummy = buffer; | ||
1250 | remain = 8; | ||
1251 | if (_chm_fetch_bytes(h, buffer, | ||
1252 | (UInt64)h->data_offset | ||
1253 | + (UInt64)h->rt_unit.start | ||
1254 | + (UInt64)h->reset_table.table_offset | ||
1255 | + (UInt64)block*8, | ||
1256 | remain) != remain || | ||
1257 | !_unmarshal_uint64(&dummy, &remain, start)) | ||
1258 | return 0; | ||
1259 | |||
1260 | /* unpack the end address */ | ||
1261 | dummy = buffer; | ||
1262 | remain = 8; | ||
1263 | if (_chm_fetch_bytes(h, buffer, | ||
1264 | (UInt64)h->data_offset | ||
1265 | + (UInt64)h->rt_unit.start | ||
1266 | + (UInt64)h->reset_table.table_offset | ||
1267 | + (UInt64)block*8 + 8, | ||
1268 | remain) != remain || | ||
1269 | !_unmarshal_int64(&dummy, &remain, len)) | ||
1270 | return 0; | ||
1271 | } | ||
1272 | |||
1273 | /* for the last block, use the span in addition to the reset table */ | ||
1274 | else | ||
1275 | { | ||
1276 | /* unpack the start address */ | ||
1277 | dummy = buffer; | ||
1278 | remain = 8; | ||
1279 | if (_chm_fetch_bytes(h, buffer, | ||
1280 | (UInt64)h->data_offset | ||
1281 | + (UInt64)h->rt_unit.start | ||
1282 | + (UInt64)h->reset_table.table_offset | ||
1283 | + (UInt64)block*8, | ||
1284 | remain) != remain || | ||
1285 | !_unmarshal_uint64(&dummy, &remain, start)) | ||
1286 | return 0; | ||
1287 | |||
1288 | *len = h->reset_table.compressed_len; | ||
1289 | } | ||
1290 | |||
1291 | /* compute the length and absolute start address */ | ||
1292 | *len -= *start; | ||
1293 | *start += h->data_offset + h->cn_unit.start; | ||
1294 | |||
1295 | return 1; | ||
1296 | } | ||
1297 | |||
1298 | /* decompress the block. must have lzx_mutex. */ | ||
1299 | static Int64 _chm_decompress_block(struct chmFile *h, | ||
1300 | UInt64 block, | ||
1301 | UChar **ubuffer) | ||
1302 | { | ||
1303 | #ifdef WIN32 | ||
1304 | UChar *cbuffer = alloca(((unsigned int)h->reset_table.block_len + 6144)); | ||
1305 | #else | ||
1306 | UChar cbuffer[h->reset_table.block_len + 6144]; /* compressed buffer */ | ||
1307 | #endif | ||
1308 | UInt64 cmpStart; /* compressed start */ | ||
1309 | Int64 cmpLen; /* compressed len */ | ||
1310 | int indexSlot; /* cache index slot */ | ||
1311 | UChar *lbuffer; /* local buffer ptr */ | ||
1312 | UInt32 blockAlign = (UInt32)(block % h->reset_blkcount); /* reset intvl. aln. */ | ||
1313 | UInt32 i; /* local loop index */ | ||
1314 | |||
1315 | /* check if we need previous blocks */ | ||
1316 | if (blockAlign != 0) | ||
1317 | { | ||
1318 | /* fetch all required previous blocks since last reset */ | ||
1319 | for (i = h->reset_blkcount - blockAlign; i > 0; i--) | ||
1320 | { | ||
1321 | |||
1322 | /* check if we most recently decompressed the previous block */ | ||
1323 | if (h->lzx_last_block != block-i) | ||
1324 | { | ||
1325 | indexSlot = (int)((block-i) % h->cache_num_blocks); | ||
1326 | h->cache_block_indices[indexSlot] = block-i; | ||
1327 | if (! h->cache_blocks[indexSlot]) | ||
1328 | h->cache_blocks[indexSlot] = (UChar *)malloc( | ||
1329 | (unsigned int)(h->reset_table.block_len)); | ||
1330 | lbuffer = h->cache_blocks[indexSlot]; | ||
1331 | |||
1332 | /* decompress the previous block */ | ||
1333 | LZXreset(h->lzx_state); | ||
1334 | if (!_chm_get_cmpblock_bounds(h, block-i, &cmpStart, &cmpLen) || | ||
1335 | _chm_fetch_bytes(h, cbuffer, cmpStart, cmpLen) != cmpLen || | ||
1336 | LZXdecompress(h->lzx_state, cbuffer, lbuffer, (int)cmpLen, | ||
1337 | (int)h->reset_table.block_len) != DECR_OK) | ||
1338 | return (Int64)0; | ||
1339 | } | ||
1340 | |||
1341 | h->lzx_last_block = (int)(block - i); | ||
1342 | } | ||
1343 | } | ||
1344 | else | ||
1345 | LZXreset(h->lzx_state); | ||
1346 | |||
1347 | /* allocate slot in cache */ | ||
1348 | indexSlot = (int)(block % h->cache_num_blocks); | ||
1349 | h->cache_block_indices[indexSlot] = block; | ||
1350 | if (! h->cache_blocks[indexSlot]) | ||
1351 | h->cache_blocks[indexSlot] = (UChar *)malloc( | ||
1352 | ((unsigned int)h->reset_table.block_len)); | ||
1353 | lbuffer = h->cache_blocks[indexSlot]; | ||
1354 | *ubuffer = lbuffer; | ||
1355 | |||
1356 | /* decompress the block we actually want */ | ||
1357 | if (! _chm_get_cmpblock_bounds(h, block, &cmpStart, &cmpLen) || | ||
1358 | _chm_fetch_bytes(h, cbuffer, cmpStart, cmpLen) != cmpLen || | ||
1359 | LZXdecompress(h->lzx_state, cbuffer, lbuffer, (int)cmpLen, | ||
1360 | (int)h->reset_table.block_len) != DECR_OK) | ||
1361 | return (Int64)0; | ||
1362 | h->lzx_last_block = (int)block; | ||
1363 | |||
1364 | /* XXX: modify LZX routines to return the length of the data they | ||
1365 | * decompressed and return that instead, for an extra sanity check. | ||
1366 | */ | ||
1367 | return h->reset_table.block_len; | ||
1368 | } | ||
1369 | |||
1370 | /* grab a region from a compressed block */ | ||
1371 | static Int64 _chm_decompress_region(struct chmFile *h, | ||
1372 | UChar *buf, | ||
1373 | UInt64 start, | ||
1374 | Int64 len) | ||
1375 | { | ||
1376 | UInt64 nBlock, nOffset; | ||
1377 | UInt64 nLen; | ||
1378 | UInt64 gotLen; | ||
1379 | UChar *ubuffer; | ||
1380 | |||
1381 | if (len <= 0) | ||
1382 | return (Int64)0; | ||
1383 | |||
1384 | /* figure out what we need to read */ | ||
1385 | nBlock = start / h->reset_table.block_len; | ||
1386 | nOffset = start % h->reset_table.block_len; | ||
1387 | nLen = len; | ||
1388 | if (nLen > (h->reset_table.block_len - nOffset)) | ||
1389 | nLen = h->reset_table.block_len - nOffset; | ||
1390 | |||
1391 | /* if block is cached, return data from it. */ | ||
1392 | CHM_ACQUIRE_LOCK(h->lzx_mutex); | ||
1393 | CHM_ACQUIRE_LOCK(h->cache_mutex); | ||
1394 | if (h->cache_block_indices[nBlock % h->cache_num_blocks] == nBlock && | ||
1395 | h->cache_blocks[nBlock % h->cache_num_blocks] != NULL) | ||
1396 | { | ||
1397 | memcpy(buf, | ||
1398 | h->cache_blocks[nBlock % h->cache_num_blocks] + nOffset, | ||
1399 | (unsigned int)nLen); | ||
1400 | CHM_RELEASE_LOCK(h->cache_mutex); | ||
1401 | CHM_RELEASE_LOCK(h->lzx_mutex); | ||
1402 | return nLen; | ||
1403 | } | ||
1404 | CHM_RELEASE_LOCK(h->cache_mutex); | ||
1405 | |||
1406 | /* data request not satisfied, so... start up the decompressor machine */ | ||
1407 | if (! h->lzx_state) | ||
1408 | { | ||
1409 | int window_size = ffs(h->window_size) - 1; | ||
1410 | h->lzx_last_block = -1; | ||
1411 | h->lzx_state = LZXinit(window_size); | ||
1412 | } | ||
1413 | |||
1414 | /* decompress some data */ | ||
1415 | gotLen = _chm_decompress_block(h, nBlock, &ubuffer); | ||
1416 | if (gotLen < nLen) | ||
1417 | nLen = gotLen; | ||
1418 | memcpy(buf, ubuffer+nOffset, (unsigned int)nLen); | ||
1419 | CHM_RELEASE_LOCK(h->lzx_mutex); | ||
1420 | return nLen; | ||
1421 | } | ||
1422 | |||
1423 | /* retrieve (part of) an object */ | ||
1424 | LONGINT64 chm_retrieve_object(struct chmFile *h, | ||
1425 | struct chmUnitInfo *ui, | ||
1426 | unsigned char *buf, | ||
1427 | LONGUINT64 addr, | ||
1428 | LONGINT64 len) | ||
1429 | { | ||
1430 | /* must be valid file handle */ | ||
1431 | if (h == NULL) | ||
1432 | return (Int64)0; | ||
1433 | |||
1434 | /* starting address must be in correct range */ | ||
1435 | if (addr < 0 || addr >= ui->length) | ||
1436 | return (Int64)0; | ||
1437 | |||
1438 | /* clip length */ | ||
1439 | if (addr + len > ui->length) | ||
1440 | len = ui->length - addr; | ||
1441 | |||
1442 | /* if the file is uncompressed, it's simple */ | ||
1443 | if (ui->space == CHM_UNCOMPRESSED) | ||
1444 | { | ||
1445 | /* read data */ | ||
1446 | return _chm_fetch_bytes(h, | ||
1447 | buf, | ||
1448 | (UInt64)h->data_offset + (UInt64)ui->start + (UInt64)addr, | ||
1449 | len); | ||
1450 | } | ||
1451 | |||
1452 | /* else if the file is compressed, it's a little trickier */ | ||
1453 | else /* ui->space == CHM_COMPRESSED */ | ||
1454 | { | ||
1455 | Int64 swath=0, total=0; | ||
1456 | do { | ||
1457 | |||
1458 | /* swill another mouthful */ | ||
1459 | swath = _chm_decompress_region(h, buf, ui->start + addr, len); | ||
1460 | |||
1461 | /* if we didn't get any... */ | ||
1462 | if (swath == 0) | ||
1463 | return total; | ||
1464 | |||
1465 | /* update stats */ | ||
1466 | total += swath; | ||
1467 | len -= swath; | ||
1468 | addr += swath; | ||
1469 | buf += swath; | ||
1470 | |||
1471 | } while (len != 0); | ||
1472 | |||
1473 | return total; | ||
1474 | } | ||
1475 | } | ||
1476 | |||
1477 | /* enumerate the objects in the .chm archive */ | ||
1478 | int chm_enumerate(struct chmFile *h, | ||
1479 | int what, | ||
1480 | CHM_ENUMERATOR e, | ||
1481 | void *context) | ||
1482 | { | ||
1483 | Int32 curPage; | ||
1484 | |||
1485 | /* buffer to hold whatever page we're looking at */ | ||
1486 | #ifdef WIN32 | ||
1487 | UChar *page_buf = alloca((unsigned int)h->block_len); | ||
1488 | #else | ||
1489 | UChar page_buf[h->block_len]; | ||
1490 | #endif | ||
1491 | struct chmPmglHeader header; | ||
1492 | UChar *end; | ||
1493 | UChar *cur; | ||
1494 | unsigned long lenRemain; | ||
1495 | |||
1496 | /* the current ui */ | ||
1497 | struct chmUnitInfo ui; | ||
1498 | int flag; | ||
1499 | |||
1500 | /* starting page */ | ||
1501 | curPage = h->index_head; | ||
1502 | |||
1503 | /* until we have either returned or given up */ | ||
1504 | while (curPage != -1) | ||
1505 | { | ||
1506 | |||
1507 | /* try to fetch the index page */ | ||
1508 | if (_chm_fetch_bytes(h, | ||
1509 | page_buf, | ||
1510 | (UInt64)h->dir_offset + (UInt64)curPage*h->block_len, | ||
1511 | h->block_len) != h->block_len) | ||
1512 | return 0; | ||
1513 | |||
1514 | /* figure out start and end for this page */ | ||
1515 | cur = page_buf; | ||
1516 | lenRemain = _CHM_PMGL_LEN; | ||
1517 | if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header)) | ||
1518 | return 0; | ||
1519 | end = page_buf + h->block_len - (header.free_space); | ||
1520 | |||
1521 | /* loop over this page */ | ||
1522 | while (cur < end) | ||
1523 | { | ||
1524 | if (! _chm_parse_PMGL_entry(&cur, &ui)) | ||
1525 | return 0; | ||
1526 | |||
1527 | /* check for DIRS */ | ||
1528 | if (ui.length == 0 && !(what & CHM_ENUMERATE_DIRS)) | ||
1529 | continue; | ||
1530 | |||
1531 | /* check for FILES */ | ||
1532 | if (ui.length != 0 && !(what & CHM_ENUMERATE_FILES)) | ||
1533 | continue; | ||
1534 | |||
1535 | /* check for NORMAL vs. META */ | ||
1536 | if (ui.path[0] == '/') | ||
1537 | { | ||
1538 | |||
1539 | /* check for NORMAL vs. SPECIAL */ | ||
1540 | if (ui.path[1] == '#' || ui.path[1] == '$') | ||
1541 | flag = CHM_ENUMERATE_SPECIAL; | ||
1542 | else | ||
1543 | flag = CHM_ENUMERATE_NORMAL; | ||
1544 | } | ||
1545 | else | ||
1546 | flag = CHM_ENUMERATE_META; | ||
1547 | if (! (what & flag)) | ||
1548 | continue; | ||
1549 | |||
1550 | /* call the enumerator */ | ||
1551 | { | ||
1552 | int status = (*e)(h, &ui, context); | ||
1553 | switch (status) | ||
1554 | { | ||
1555 | case CHM_ENUMERATOR_FAILURE: return 0; | ||
1556 | case CHM_ENUMERATOR_CONTINUE: break; | ||
1557 | case CHM_ENUMERATOR_SUCCESS: return 1; | ||
1558 | default: break; | ||
1559 | } | ||
1560 | } | ||
1561 | } | ||
1562 | |||
1563 | /* advance to next page */ | ||
1564 | curPage = header.block_next; | ||
1565 | } | ||
1566 | |||
1567 | return 1; | ||
1568 | } | ||
1569 | |||
1570 | int chm_enumerate_dir(struct chmFile *h, | ||
1571 | const char *prefix, | ||
1572 | int what, | ||
1573 | CHM_ENUMERATOR e, | ||
1574 | void *context) | ||
1575 | { | ||
1576 | /* | ||
1577 | * XXX: do this efficiently (i.e. using the tree index) | ||
1578 | */ | ||
1579 | |||
1580 | Int32 curPage; | ||
1581 | |||
1582 | /* buffer to hold whatever page we're looking at */ | ||
1583 | #ifdef WIN32 | ||
1584 | UChar *page_buf = alloca((unsigned int)h->block_len); | ||
1585 | #else | ||
1586 | UChar page_buf[h->block_len]; | ||
1587 | #endif | ||
1588 | struct chmPmglHeader header; | ||
1589 | UChar *end; | ||
1590 | UChar *cur; | ||
1591 | unsigned long lenRemain; | ||
1592 | |||
1593 | /* set to 1 once we've started */ | ||
1594 | int it_has_begun=0; | ||
1595 | |||
1596 | /* the current ui */ | ||
1597 | struct chmUnitInfo ui; | ||
1598 | int flag; | ||
1599 | |||
1600 | /* the length of the prefix */ | ||
1601 | char prefixRectified[CHM_MAX_PATHLEN+1]; | ||
1602 | int prefixLen; | ||
1603 | char lastPath[CHM_MAX_PATHLEN]; | ||
1604 | int lastPathLen; | ||
1605 | |||
1606 | /* starting page */ | ||
1607 | curPage = h->index_head; | ||
1608 | |||
1609 | /* initialize pathname state */ | ||
1610 | strncpy(prefixRectified, prefix, CHM_MAX_PATHLEN); | ||
1611 | prefixLen = strlen(prefixRectified); | ||
1612 | if (prefixLen != 0) | ||
1613 | { | ||
1614 | if (prefixRectified[prefixLen-1] != '/') | ||
1615 | { | ||
1616 | prefixRectified[prefixLen] = '/'; | ||
1617 | prefixRectified[prefixLen+1] = '\0'; | ||
1618 | ++prefixLen; | ||
1619 | } | ||
1620 | } | ||
1621 | lastPath[0] = '\0'; | ||
1622 | lastPathLen = -1; | ||
1623 | |||
1624 | /* until we have either returned or given up */ | ||
1625 | while (curPage != -1) | ||
1626 | { | ||
1627 | |||
1628 | /* try to fetch the index page */ | ||
1629 | if (_chm_fetch_bytes(h, | ||
1630 | page_buf, | ||
1631 | (UInt64)h->dir_offset + (UInt64)curPage*h->block_len, | ||
1632 | h->block_len) != h->block_len) | ||
1633 | return 0; | ||
1634 | |||
1635 | /* figure out start and end for this page */ | ||
1636 | cur = page_buf; | ||
1637 | lenRemain = _CHM_PMGL_LEN; | ||
1638 | if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header)) | ||
1639 | return 0; | ||
1640 | end = page_buf + h->block_len - (header.free_space); | ||
1641 | |||
1642 | /* loop over this page */ | ||
1643 | while (cur < end) | ||
1644 | { | ||
1645 | if (! _chm_parse_PMGL_entry(&cur, &ui)) | ||
1646 | return 0; | ||
1647 | |||
1648 | /* check if we should start */ | ||
1649 | if (! it_has_begun) | ||
1650 | { | ||
1651 | if (ui.length == 0 && strncmp(ui.path, prefixRectified, prefixLen) == 0) | ||
1652 | it_has_begun = 1; | ||
1653 | else | ||
1654 | continue; | ||
1655 | |||
1656 | if (ui.path[prefixLen] == '\0') | ||
1657 | continue; | ||
1658 | } | ||
1659 | |||
1660 | /* check if we should stop */ | ||
1661 | else | ||
1662 | { | ||
1663 | if (strncmp(ui.path, prefixRectified, prefixLen) != 0) | ||
1664 | return 1; | ||
1665 | } | ||
1666 | |||
1667 | /* check if we should include this path */ | ||
1668 | if (lastPathLen != -1) | ||
1669 | { | ||
1670 | if (strncmp(ui.path, lastPath, lastPathLen) == 0) | ||
1671 | continue; | ||
1672 | } | ||
1673 | strcpy(lastPath, ui.path); | ||
1674 | lastPathLen = strlen(lastPath); | ||
1675 | |||
1676 | /* check for DIRS */ | ||
1677 | if (ui.length == 0 && !(what & CHM_ENUMERATE_DIRS)) | ||
1678 | continue; | ||
1679 | |||
1680 | /* check for FILES */ | ||
1681 | if (ui.length != 0 && !(what & CHM_ENUMERATE_FILES)) | ||
1682 | continue; | ||
1683 | |||
1684 | /* check for NORMAL vs. META */ | ||
1685 | if (ui.path[0] == '/') | ||
1686 | { | ||
1687 | |||
1688 | /* check for NORMAL vs. SPECIAL */ | ||
1689 | if (ui.path[1] == '#' || ui.path[1] == '$') | ||
1690 | flag = CHM_ENUMERATE_SPECIAL; | ||
1691 | else | ||
1692 | flag = CHM_ENUMERATE_NORMAL; | ||
1693 | } | ||
1694 | else | ||
1695 | flag = CHM_ENUMERATE_META; | ||
1696 | if (! (what & flag)) | ||
1697 | continue; | ||
1698 | |||
1699 | /* call the enumerator */ | ||
1700 | { | ||
1701 | int status = (*e)(h, &ui, context); | ||
1702 | switch (status) | ||
1703 | { | ||
1704 | case CHM_ENUMERATOR_FAILURE: return 0; | ||
1705 | case CHM_ENUMERATOR_CONTINUE: break; | ||
1706 | case CHM_ENUMERATOR_SUCCESS: return 1; | ||
1707 | default: break; | ||
1708 | } | ||
1709 | } | ||
1710 | } | ||
1711 | |||
1712 | /* advance to next page */ | ||
1713 | curPage = header.block_next; | ||
1714 | } | ||
1715 | |||
1716 | return 1; | ||
1717 | } | ||
1718 | |||
1719 | /* resolve a particular object from the archive */ | ||
1720 | int chm_resolve_location(struct chmFile *h, | ||
1721 | unsigned long pos, | ||
1722 | struct chmUnitInfo *ui) | ||
1723 | { | ||
1724 | /* | ||
1725 | * XXX: implement caching scheme for dir pages | ||
1726 | */ | ||
1727 | |||
1728 | Int32 curPage; | ||
1729 | |||
1730 | /* buffer to hold whatever page we're looking at */ | ||
1731 | #ifdef WIN32 | ||
1732 | UChar *page_buf = alloca(h->block_len); | ||
1733 | #else | ||
1734 | UChar page_buf[h->block_len]; | ||
1735 | #endif | ||
1736 | |||
1737 | /* starting page */ | ||
1738 | curPage = h->index_root; | ||
1739 | |||
1740 | /* until we have either returned or given up */ | ||
1741 | while (curPage != -1) | ||
1742 | { | ||
1743 | |||
1744 | /* try to fetch the index page */ | ||
1745 | if (_chm_fetch_bytes(h, page_buf, | ||
1746 | (UInt64)h->dir_offset + (UInt64)curPage*h->block_len, | ||
1747 | h->block_len) != h->block_len) | ||
1748 | return CHM_RESOLVE_FAILURE; | ||
1749 | |||
1750 | /* now, if it is a leaf node: */ | ||
1751 | if (memcmp(page_buf, _chm_pmgl_marker, 4) == 0) | ||
1752 | { | ||
1753 | /* scan block */ | ||
1754 | /* UChar *pEntry = _chm_find_in_PMGL(page_buf, h->block_len, objPath);*/ | ||
1755 | { | ||
1756 | /* XXX: modify this to do a binary search using the nice index structure | ||
1757 | * that is provided for us. | ||
1758 | */ | ||
1759 | struct chmPmglHeader header; | ||
1760 | UInt32 hremain; | ||
1761 | UChar *end; | ||
1762 | UChar *cur; | ||
1763 | UChar *temp; | ||
1764 | /* | ||
1765 | UInt64 strLen; | ||
1766 | char buffer[CHM_MAX_PATHLEN+1]; | ||
1767 | */ | ||
1768 | /* figure out where to start and end */ | ||
1769 | cur = page_buf; | ||
1770 | hremain = _CHM_PMGL_LEN; | ||
1771 | if (! _unmarshal_pmgl_header(&cur, &hremain, &header)) | ||
1772 | return CHM_RESOLVE_FAILURE; | ||
1773 | end = page_buf + h->block_len - (header.free_space); | ||
1774 | |||
1775 | /* now, scan progressively */ | ||
1776 | while (cur < end) | ||
1777 | { | ||
1778 | UInt32 st = 0; | ||
1779 | UInt32 nd = 0; | ||
1780 | /* grab the name */ | ||
1781 | temp = cur; | ||
1782 | |||
1783 | if (_chm_parse_PMGL_entry(&cur, ui) == 0) | ||
1784 | { | ||
1785 | return CHM_RESOLVE_FAILURE; | ||
1786 | } | ||
1787 | st = ui->start; | ||
1788 | nd = ui->start+ui->length; | ||
1789 | if ((st <= pos) && (pos < nd)) | ||
1790 | { | ||
1791 | printf("Resolve:[%u,%u,%u]\n", st, pos, nd); | ||
1792 | return CHM_RESOLVE_SUCCESS; | ||
1793 | } | ||
1794 | } | ||
1795 | |||
1796 | return CHM_RESOLVE_FAILURE; | ||
1797 | } | ||
1798 | |||
1799 | } | ||
1800 | |||
1801 | /* else, if it is a branch node: */ | ||
1802 | else if (memcmp(page_buf, _chm_pmgi_marker, 4) == 0) | ||
1803 | { | ||
1804 | /* curPage = _chm_find_in_PMGI(page_buf, h->block_len, objPath);*/ | ||
1805 | return CHM_RESOLVE_FAILURE; | ||
1806 | if (0) | ||
1807 | { | ||
1808 | /* XXX: modify this to do a binary search using the nice index structure | ||
1809 | * that is provided for us | ||
1810 | */ | ||
1811 | struct chmPmgiHeader header; | ||
1812 | UInt32 hremain; | ||
1813 | int page=-1; | ||
1814 | UChar *end; | ||
1815 | UChar *cur; | ||
1816 | UInt64 strLen; | ||
1817 | char buffer[CHM_MAX_PATHLEN+1]; | ||
1818 | |||
1819 | /* figure out where to start and end */ | ||
1820 | cur = page_buf; | ||
1821 | hremain = _CHM_PMGI_LEN; | ||
1822 | if (! _unmarshal_pmgi_header(&cur, &hremain, &header)) | ||
1823 | return -1; | ||
1824 | end = page_buf + h->block_len - (header.free_space); | ||
1825 | |||
1826 | /* now, scan progressively */ | ||
1827 | while (cur < end) | ||
1828 | { | ||
1829 | |||
1830 | |||
1831 | |||
1832 | if (_chm_parse_PMGL_entry(&cur, ui) == 0) | ||
1833 | { | ||
1834 | return CHM_RESOLVE_FAILURE; | ||
1835 | } | ||
1836 | |||
1837 | if (ui->start <= pos && pos < ui->start + ui->length) | ||
1838 | { | ||
1839 | return CHM_RESOLVE_SUCCESS; | ||
1840 | } | ||
1841 | |||
1842 | |||
1843 | |||
1844 | |||
1845 | |||
1846 | /* grab the name */ | ||
1847 | strLen = _chm_parse_cword(&cur); | ||
1848 | if (! _chm_parse_UTF8(&cur, strLen, buffer)) | ||
1849 | return -1; | ||
1850 | |||
1851 | /* check if it is the right name */ | ||
1852 | /* | ||
1853 | #ifdef WIN32 | ||
1854 | if (stricmp(buffer, objPath) > 0) | ||
1855 | return page; | ||
1856 | #else | ||
1857 | if (strcasecmp(buffer, objPath) > 0) | ||
1858 | return page; | ||
1859 | #endif | ||
1860 | */ | ||
1861 | /* load next value for path */ | ||
1862 | page = (int)_chm_parse_cword(&cur); | ||
1863 | } | ||
1864 | |||
1865 | curPage = page; | ||
1866 | } | ||
1867 | } | ||
1868 | /* else, we are confused. give up. */ | ||
1869 | else | ||
1870 | return CHM_RESOLVE_FAILURE; | ||
1871 | } | ||
1872 | |||
1873 | /* didn't find anything. fail. */ | ||
1874 | return CHM_RESOLVE_FAILURE; | ||
1875 | |||
1876 | } | ||
diff --git a/noncore/apps/opie-reader/chm_lib.h b/noncore/apps/opie-reader/chm_lib.h new file mode 100644 index 0000000..5f9b567 --- a/dev/null +++ b/noncore/apps/opie-reader/chm_lib.h | |||
@@ -0,0 +1,134 @@ | |||
1 | /* $Id$ */ | ||
2 | /*************************************************************************** | ||
3 | * chm_lib.h - CHM archive manipulation routines * | ||
4 | * ------------------- * | ||
5 | * * | ||
6 | * author: Jed Wing <jedwin@ugcs.caltech.edu> * | ||
7 | * version: 0.3 * | ||
8 | * notes: These routines are meant for the manipulation of microsoft * | ||
9 | * .chm (compiled html help) files, but may likely be used * | ||
10 | * for the manipulation of any ITSS archive, if ever ITSS * | ||
11 | * archives are used for any other purpose. * | ||
12 | * * | ||
13 | * Note also that the section names are statically handled. * | ||
14 | * To be entirely correct, the section names should be read * | ||
15 | * from the section names meta-file, and then the various * | ||
16 | * content sections and the "transforms" to apply to the data * | ||
17 | * they contain should be inferred from the section name and * | ||
18 | * the meta-files referenced using that name; however, all of * | ||
19 | * the files I've been able to get my hands on appear to have * | ||
20 | * only two sections: Uncompressed and MSCompressed. * | ||
21 | * Additionally, the ITSS.DLL file included with Windows does * | ||
22 | * not appear to handle any different transforms than the * | ||
23 | * simple LZX-transform. Furthermore, the list of transforms * | ||
24 | * to apply is broken, in that only half the required space * | ||
25 | * is allocated for the list. (It appears as though the * | ||
26 | * space is allocated for ASCII strings, but the strings are * | ||
27 | * written as unicode. As a result, only the first half of * | ||
28 | * the string appears.) So this is probably not too big of * | ||
29 | * a deal, at least until CHM v4 (MS .lit files), which also * | ||
30 | * incorporate encryption, of some description. * | ||
31 | ***************************************************************************/ | ||
32 | |||
33 | /*************************************************************************** | ||
34 | * * | ||
35 | * This program is free software; you can redistribute it and/or modify * | ||
36 | * it under the terms of the GNU Lesser General Public License as * | ||
37 | * published by the Free Software Foundation; either version 2.1 of the * | ||
38 | * License, or (at your option) any later version. * | ||
39 | * * | ||
40 | ***************************************************************************/ | ||
41 | |||
42 | #ifndef INCLUDED_CHMLIB_H | ||
43 | #define INCLUDED_CHMLIB_H | ||
44 | |||
45 | #ifdef __cplusplus | ||
46 | extern "C" { | ||
47 | #endif | ||
48 | |||
49 | #ifdef WIN32 | ||
50 | typedef unsigned __int64 LONGUINT64; | ||
51 | typedef __int64 LONGINT64; | ||
52 | #else | ||
53 | typedef unsigned long long LONGUINT64; | ||
54 | typedef long long LONGINT64; | ||
55 | #endif | ||
56 | |||
57 | /* the two available spaces in a CHM file */ | ||
58 | /* N.B.: The format supports arbitrarily many spaces, but only */ | ||
59 | /* two appear to be used at present. */ | ||
60 | #define CHM_UNCOMPRESSED (0) | ||
61 | #define CHM_COMPRESSED (1) | ||
62 | |||
63 | /* structure representing an ITS (CHM) file stream */ | ||
64 | struct chmFile; | ||
65 | |||
66 | /* structure representing an element from an ITS file stream */ | ||
67 | #define CHM_MAX_PATHLEN (256) | ||
68 | struct chmUnitInfo | ||
69 | { | ||
70 | LONGUINT64 start; | ||
71 | LONGUINT64 length; | ||
72 | int space; | ||
73 | char path[CHM_MAX_PATHLEN+1]; | ||
74 | }; | ||
75 | |||
76 | /* open an ITS archive */ | ||
77 | struct chmFile* chm_open(const char *filename); | ||
78 | |||
79 | /* close an ITS archive */ | ||
80 | void chm_close(struct chmFile *h); | ||
81 | |||
82 | /* methods for ssetting tuning parameters for particular file */ | ||
83 | #define CHM_PARAM_MAX_BLOCKS_CACHED 0 | ||
84 | void chm_set_param(struct chmFile *h, | ||
85 | int paramType, | ||
86 | int paramVal); | ||
87 | |||
88 | /* resolve a particular object from the archive */ | ||
89 | #define CHM_RESOLVE_SUCCESS (0) | ||
90 | #define CHM_RESOLVE_FAILURE (1) | ||
91 | int chm_resolve_object(struct chmFile *h, | ||
92 | const char *objPath, | ||
93 | struct chmUnitInfo *ui); | ||
94 | |||
95 | /* retrieve part of an object from the archive */ | ||
96 | LONGINT64 chm_retrieve_object(struct chmFile *h, | ||
97 | struct chmUnitInfo *ui, | ||
98 | unsigned char *buf, | ||
99 | LONGUINT64 addr, | ||
100 | LONGINT64 len); | ||
101 | |||
102 | /* enumerate the objects in the .chm archive */ | ||
103 | typedef int (*CHM_ENUMERATOR)(struct chmFile *h, | ||
104 | struct chmUnitInfo *ui, | ||
105 | void *context); | ||
106 | #define CHM_ENUMERATE_NORMAL (1) | ||
107 | #define CHM_ENUMERATE_META (2) | ||
108 | #define CHM_ENUMERATE_SPECIAL (4) | ||
109 | #define CHM_ENUMERATE_FILES (8) | ||
110 | #define CHM_ENUMERATE_DIRS (16) | ||
111 | #define CHM_ENUMERATE_ALL (31) | ||
112 | #define CHM_ENUMERATOR_FAILURE (0) | ||
113 | #define CHM_ENUMERATOR_CONTINUE (1) | ||
114 | #define CHM_ENUMERATOR_SUCCESS (2) | ||
115 | int chm_enumerate(struct chmFile *h, | ||
116 | int what, | ||
117 | CHM_ENUMERATOR e, | ||
118 | void *context); | ||
119 | |||
120 | int chm_enumerate_dir(struct chmFile *h, | ||
121 | const char *prefix, | ||
122 | int what, | ||
123 | CHM_ENUMERATOR e, | ||
124 | void *context); | ||
125 | |||
126 | int chm_resolve_location(struct chmFile *h, | ||
127 | unsigned long pos, | ||
128 | struct chmUnitInfo *ui); | ||
129 | |||
130 | #ifdef __cplusplus | ||
131 | } | ||
132 | #endif | ||
133 | |||
134 | #endif /* INCLUDED_CHMLIB_H */ | ||
diff --git a/noncore/apps/opie-reader/codeclib.mak b/noncore/apps/opie-reader/codeclib.mak new file mode 100644 index 0000000..bfdd7bb --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib.mak | |||
@@ -0,0 +1,195 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libreader_codec.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:37:45 2004 | ||
4 | # Project: codeclib.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o codeclib.mak codeclib.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libreader_codec.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = pdb.h | ||
47 | SOURCES = CExpander.cpp \ | ||
48 | CBuffer.cpp \ | ||
49 | StyleConsts.cpp \ | ||
50 | hrule.cpp \ | ||
51 | Navigation.cpp \ | ||
52 | Bkmks.cpp | ||
53 | OBJECTS = QREADEROBJS/CExpander.o \ | ||
54 | QREADEROBJS/CBuffer.o \ | ||
55 | QREADEROBJS/StyleConsts.o \ | ||
56 | QREADEROBJS/hrule.o \ | ||
57 | QREADEROBJS/Navigation.o \ | ||
58 | QREADEROBJS/Bkmks.o | ||
59 | FORMS = | ||
60 | UICDECLS = | ||
61 | UICIMPLS = | ||
62 | SRCMOC = | ||
63 | OBJMOC = | ||
64 | DIST = codeclib.pro | ||
65 | QMAKE_TARGET = reader_codec | ||
66 | DESTDIR = $(READERDIR)/lib/ | ||
67 | TARGET = libreader_codec.so.1.0.0 | ||
68 | TARGETA= $(READERDIR)/lib/libreader_codec.a | ||
69 | TARGETD= libreader_codec.so.1.0.0 | ||
70 | TARGET0= libreader_codec.so | ||
71 | TARGET1= libreader_codec.so.1 | ||
72 | TARGET2= libreader_codec.so.1.0 | ||
73 | |||
74 | first: all | ||
75 | ####### Implicit rules | ||
76 | |||
77 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
78 | |||
79 | .cpp.o: | ||
80 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
81 | |||
82 | .cc.o: | ||
83 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
84 | |||
85 | .cxx.o: | ||
86 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
87 | |||
88 | .C.o: | ||
89 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
90 | |||
91 | .c.o: | ||
92 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
93 | |||
94 | ####### Build rules | ||
95 | |||
96 | all: codeclib.mak $(READERDIR)/lib/$(TARGET) | ||
97 | |||
98 | $(READERDIR)/lib/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
99 | test -d $(READERDIR)/lib/ || mkdir -p $(READERDIR)/lib/ | ||
100 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
101 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
102 | -ln -s $(TARGET) $(TARGET0) | ||
103 | -ln -s $(TARGET) $(TARGET1) | ||
104 | -ln -s $(TARGET) $(TARGET2) | ||
105 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) | ||
106 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) | ||
107 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET1) | ||
108 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET2) | ||
109 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/lib/ | ||
110 | |||
111 | |||
112 | |||
113 | staticlib: $(TARGETA) | ||
114 | |||
115 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
116 | -$(DEL_FILE) $(TARGETA) | ||
117 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
118 | |||
119 | mocables: $(SRCMOC) | ||
120 | uicables: $(UICDECLS) $(UICIMPLS) | ||
121 | |||
122 | $(MOC): | ||
123 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
124 | |||
125 | codeclib.mak: codeclib.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
126 | $(QMAKE) -o codeclib.mak codeclib.pro | ||
127 | qmake: | ||
128 | @$(QMAKE) -o codeclib.mak codeclib.pro | ||
129 | |||
130 | dist: | ||
131 | @mkdir -p QREADEROBJS/reader_codec && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/reader_codec/ && ( cd `dirname QREADEROBJS/reader_codec` && $(TAR) reader_codec.tar reader_codec && $(GZIP) reader_codec.tar ) && $(MOVE) `dirname QREADEROBJS/reader_codec`/reader_codec.tar.gz . && $(DEL_FILE) -r QREADEROBJS/reader_codec | ||
132 | |||
133 | mocclean: | ||
134 | |||
135 | uiclean: | ||
136 | |||
137 | yaccclean: | ||
138 | lexclean: | ||
139 | clean: | ||
140 | -$(DEL_FILE) $(OBJECTS) | ||
141 | -$(DEL_FILE) *~ core *.core | ||
142 | |||
143 | |||
144 | ####### Sub-libraries | ||
145 | |||
146 | distclean: clean | ||
147 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) $(TARGET) | ||
148 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) $(READERDIR)/lib/$(TARGET1) $(READERDIR)/lib/$(TARGET2) $(TARGETA) | ||
149 | |||
150 | |||
151 | FORCE: | ||
152 | |||
153 | ####### Compile | ||
154 | |||
155 | QREADEROBJS/CExpander.o: CExpander.cpp CExpander.h \ | ||
156 | QREADERINC/useqpe.h \ | ||
157 | config.h \ | ||
158 | StyleConsts.h \ | ||
159 | Markups.h \ | ||
160 | names.h \ | ||
161 | linktype.h \ | ||
162 | ustring.h | ||
163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CExpander.o CExpander.cpp | ||
164 | |||
165 | QREADEROBJS/CBuffer.o: CBuffer.cpp CBuffer.h \ | ||
166 | config.h \ | ||
167 | ustring.h | ||
168 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CBuffer.o CBuffer.cpp | ||
169 | |||
170 | QREADEROBJS/StyleConsts.o: StyleConsts.cpp StyleConsts.h | ||
171 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/StyleConsts.o StyleConsts.cpp | ||
172 | |||
173 | QREADEROBJS/hrule.o: hrule.cpp | ||
174 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/hrule.o hrule.cpp | ||
175 | |||
176 | QREADEROBJS/Navigation.o: Navigation.cpp Navigation.h | ||
177 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Navigation.o Navigation.cpp | ||
178 | |||
179 | QREADEROBJS/Bkmks.o: Bkmks.cpp Bkmks.h \ | ||
180 | StyleConsts.h \ | ||
181 | Markups.h \ | ||
182 | my_list.h \ | ||
183 | version.h \ | ||
184 | names.h \ | ||
185 | config.h \ | ||
186 | Filedata.h \ | ||
187 | ustring.h | ||
188 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Bkmks.o Bkmks.cpp | ||
189 | |||
190 | ####### Install | ||
191 | |||
192 | install: all | ||
193 | |||
194 | uninstall: | ||
195 | |||
diff --git a/noncore/apps/opie-reader/codeclib.omak b/noncore/apps/opie-reader/codeclib.omak new file mode 100644 index 0000000..1ea5fbc --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib.omak | |||
@@ -0,0 +1,160 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_codec.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: codeclib.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_codec.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =CExpander.cpp \ | ||
30 | CBuffer.cpp \ | ||
31 | StyleConsts.cpp \ | ||
32 | hrule.cpp \ | ||
33 | Navigation.cpp \ | ||
34 | Bkmks.cpp | ||
35 | OBJECTS =OREADEROBJS/CExpander.o \ | ||
36 | OREADEROBJS/CBuffer.o \ | ||
37 | OREADEROBJS/StyleConsts.o \ | ||
38 | OREADEROBJS/hrule.o \ | ||
39 | OREADEROBJS/Navigation.o \ | ||
40 | OREADEROBJS/Bkmks.o | ||
41 | INTERFACES = | ||
42 | UICDECLS = | ||
43 | UICIMPLS = | ||
44 | SRCMOC = | ||
45 | OBJMOC = | ||
46 | DIST = | ||
47 | TARGET =libreader_codec.so.1.0.0 | ||
48 | TARGETA =$(QTDIR)/lib/libreader_codec.a | ||
49 | TARGETD =libreader_codec.so.1.0.0 | ||
50 | TARGET0 =libreader_codec.so | ||
51 | TARGET1 =libreader_codec.so.1 | ||
52 | TARGET2 =libreader_codec.so.1.0 | ||
53 | INTERFACE_DECL_PATH = . | ||
54 | |||
55 | ####### Implicit rules | ||
56 | |||
57 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
58 | |||
59 | .cpp.o: | ||
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
61 | |||
62 | .cxx.o: | ||
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
64 | |||
65 | .cc.o: | ||
66 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
67 | |||
68 | .C.o: | ||
69 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
70 | |||
71 | .c.o: | ||
72 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
73 | |||
74 | ####### Build rules | ||
75 | |||
76 | |||
77 | all: $(QTDIR)/lib/libreader_codec.so.1.0.0 | ||
78 | |||
79 | $(QTDIR)/lib/libreader_codec.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
80 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
81 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
82 | -ln -s $(TARGET) $(TARGET0) | ||
83 | -ln -s $(TARGET) $(TARGET1) | ||
84 | -ln -s $(TARGET) $(TARGET2) | ||
85 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
86 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
87 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
88 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
89 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
90 | |||
91 | staticlib: $(TARGETA) | ||
92 | |||
93 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
94 | -rm -f $(TARGETA) | ||
95 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
96 | |||
97 | moc: $(SRCMOC) | ||
98 | |||
99 | tmake: codeclib.omak | ||
100 | |||
101 | codeclib.omak: codeclib.opro | ||
102 | tmake codeclib.opro -o codeclib.omak | ||
103 | |||
104 | dist: | ||
105 | $(TAR) codeclib.opro.tar codeclib.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
106 | $(GZIP) codeclib.opro.tar | ||
107 | |||
108 | clean: | ||
109 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
110 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
111 | -rm -f *~ core | ||
112 | |||
113 | ####### Sub-libraries | ||
114 | |||
115 | |||
116 | ###### Combined headers | ||
117 | |||
118 | |||
119 | ####### Compile | ||
120 | |||
121 | OREADEROBJS/CExpander.o: CExpander.cpp \ | ||
122 | CExpander.h \ | ||
123 | OREADERINC/useqpe.h \ | ||
124 | config.h \ | ||
125 | ustring.h \ | ||
126 | StyleConsts.h \ | ||
127 | Markups.h \ | ||
128 | names.h \ | ||
129 | linktype.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CExpander.o CExpander.cpp | ||
131 | |||
132 | OREADEROBJS/CBuffer.o: CBuffer.cpp \ | ||
133 | CBuffer.h \ | ||
134 | config.h \ | ||
135 | ustring.h | ||
136 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CBuffer.o CBuffer.cpp | ||
137 | |||
138 | OREADEROBJS/StyleConsts.o: StyleConsts.cpp \ | ||
139 | StyleConsts.h | ||
140 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/StyleConsts.o StyleConsts.cpp | ||
141 | |||
142 | OREADEROBJS/hrule.o: hrule.cpp | ||
143 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/hrule.o hrule.cpp | ||
144 | |||
145 | OREADEROBJS/Navigation.o: Navigation.cpp \ | ||
146 | Navigation.h | ||
147 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Navigation.o Navigation.cpp | ||
148 | |||
149 | OREADEROBJS/Bkmks.o: Bkmks.cpp \ | ||
150 | Bkmks.h \ | ||
151 | config.h \ | ||
152 | ustring.h \ | ||
153 | Filedata.h \ | ||
154 | StyleConsts.h \ | ||
155 | Markups.h \ | ||
156 | my_list.h \ | ||
157 | version.h \ | ||
158 | names.h | ||
159 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Bkmks.o Bkmks.cpp | ||
160 | |||
diff --git a/noncore/apps/opie-reader/codeclib.wmak b/noncore/apps/opie-reader/codeclib.wmak new file mode 100644 index 0000000..ea09e49 --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib.wmak | |||
@@ -0,0 +1,160 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_codec.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: codeclib.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_codec.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =CExpander.cpp \ | ||
30 | CBuffer.cpp \ | ||
31 | StyleConsts.cpp \ | ||
32 | hrule.cpp \ | ||
33 | Navigation.cpp \ | ||
34 | Bkmks.cpp | ||
35 | OBJECTS =WSREADEROBJS/CExpander.o \ | ||
36 | WSREADEROBJS/CBuffer.o \ | ||
37 | WSREADEROBJS/StyleConsts.o \ | ||
38 | WSREADEROBJS/hrule.o \ | ||
39 | WSREADEROBJS/Navigation.o \ | ||
40 | WSREADEROBJS/Bkmks.o | ||
41 | INTERFACES = | ||
42 | UICDECLS = | ||
43 | UICIMPLS = | ||
44 | SRCMOC = | ||
45 | OBJMOC = | ||
46 | DIST = | ||
47 | TARGET =libreader_codec.so.1.0.0 | ||
48 | TARGETA =$(QTDIR)/lib/libreader_codec.a | ||
49 | TARGETD =libreader_codec.so.1.0.0 | ||
50 | TARGET0 =libreader_codec.so | ||
51 | TARGET1 =libreader_codec.so.1 | ||
52 | TARGET2 =libreader_codec.so.1.0 | ||
53 | INTERFACE_DECL_PATH = . | ||
54 | |||
55 | ####### Implicit rules | ||
56 | |||
57 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
58 | |||
59 | .cpp.o: | ||
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
61 | |||
62 | .cxx.o: | ||
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
64 | |||
65 | .cc.o: | ||
66 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
67 | |||
68 | .C.o: | ||
69 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
70 | |||
71 | .c.o: | ||
72 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
73 | |||
74 | ####### Build rules | ||
75 | |||
76 | |||
77 | all: $(QTDIR)/lib/libreader_codec.so.1.0.0 | ||
78 | |||
79 | $(QTDIR)/lib/libreader_codec.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
80 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
81 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
82 | -ln -s $(TARGET) $(TARGET0) | ||
83 | -ln -s $(TARGET) $(TARGET1) | ||
84 | -ln -s $(TARGET) $(TARGET2) | ||
85 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
86 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
87 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
88 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
89 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
90 | |||
91 | staticlib: $(TARGETA) | ||
92 | |||
93 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
94 | -rm -f $(TARGETA) | ||
95 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
96 | |||
97 | moc: $(SRCMOC) | ||
98 | |||
99 | tmake: codeclib.wmak | ||
100 | |||
101 | codeclib.wmak: codeclib.wpro | ||
102 | tmake codeclib.wpro -o codeclib.wmak | ||
103 | |||
104 | dist: | ||
105 | $(TAR) codeclib.wpro.tar codeclib.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
106 | $(GZIP) codeclib.wpro.tar | ||
107 | |||
108 | clean: | ||
109 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
110 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
111 | -rm -f *~ core | ||
112 | |||
113 | ####### Sub-libraries | ||
114 | |||
115 | |||
116 | ###### Combined headers | ||
117 | |||
118 | |||
119 | ####### Compile | ||
120 | |||
121 | WSREADEROBJS/CExpander.o: CExpander.cpp \ | ||
122 | CExpander.h \ | ||
123 | WSREADERINC/useqpe.h \ | ||
124 | config.h \ | ||
125 | ustring.h \ | ||
126 | StyleConsts.h \ | ||
127 | Markups.h \ | ||
128 | names.h \ | ||
129 | linktype.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CExpander.o CExpander.cpp | ||
131 | |||
132 | WSREADEROBJS/CBuffer.o: CBuffer.cpp \ | ||
133 | CBuffer.h \ | ||
134 | config.h \ | ||
135 | ustring.h | ||
136 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CBuffer.o CBuffer.cpp | ||
137 | |||
138 | WSREADEROBJS/StyleConsts.o: StyleConsts.cpp \ | ||
139 | StyleConsts.h | ||
140 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/StyleConsts.o StyleConsts.cpp | ||
141 | |||
142 | WSREADEROBJS/hrule.o: hrule.cpp | ||
143 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/hrule.o hrule.cpp | ||
144 | |||
145 | WSREADEROBJS/Navigation.o: Navigation.cpp \ | ||
146 | Navigation.h | ||
147 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Navigation.o Navigation.cpp | ||
148 | |||
149 | WSREADEROBJS/Bkmks.o: Bkmks.cpp \ | ||
150 | Bkmks.h \ | ||
151 | config.h \ | ||
152 | ustring.h \ | ||
153 | Filedata.h \ | ||
154 | StyleConsts.h \ | ||
155 | Markups.h \ | ||
156 | my_list.h \ | ||
157 | version.h \ | ||
158 | names.h | ||
159 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Bkmks.o Bkmks.cpp | ||
160 | |||
diff --git a/noncore/apps/opie-reader/codeclib.wpro b/noncore/apps/opie-reader/codeclib.wpro new file mode 100644 index 0000000..f4a467a --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib.wpro | |||
@@ -0,0 +1,15 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = pdb.h | ||
4 | |||
5 | SOURCES = CExpander.cpp CBuffer.cpp StyleConsts.cpp \ | ||
6 | hrule.cpp Navigation.cpp Bkmks.cpp | ||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/lib | ||
10 | TARGET = reader_codec | ||
11 | |||
12 | OBJECTS_DIR = WSREADEROBJS | ||
13 | MOC_DIR = WSREADERMOCS | ||
14 | INCLUDEPATH+= WSREADERINC | ||
15 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/codeclib.zmak b/noncore/apps/opie-reader/codeclib.zmak new file mode 100644 index 0000000..d81d347 --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib.zmak | |||
@@ -0,0 +1,160 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_codec.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: codeclib.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_codec.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =CExpander.cpp \ | ||
30 | CBuffer.cpp \ | ||
31 | StyleConsts.cpp \ | ||
32 | hrule.cpp \ | ||
33 | Navigation.cpp \ | ||
34 | Bkmks.cpp | ||
35 | OBJECTS =ZREADEROBJS/CExpander.o \ | ||
36 | ZREADEROBJS/CBuffer.o \ | ||
37 | ZREADEROBJS/StyleConsts.o \ | ||
38 | ZREADEROBJS/hrule.o \ | ||
39 | ZREADEROBJS/Navigation.o \ | ||
40 | ZREADEROBJS/Bkmks.o | ||
41 | INTERFACES = | ||
42 | UICDECLS = | ||
43 | UICIMPLS = | ||
44 | SRCMOC = | ||
45 | OBJMOC = | ||
46 | DIST = | ||
47 | TARGET =libreader_codec.so.1.0.0 | ||
48 | TARGETA =$(QTDIR)/lib/libreader_codec.a | ||
49 | TARGETD =libreader_codec.so.1.0.0 | ||
50 | TARGET0 =libreader_codec.so | ||
51 | TARGET1 =libreader_codec.so.1 | ||
52 | TARGET2 =libreader_codec.so.1.0 | ||
53 | INTERFACE_DECL_PATH = . | ||
54 | |||
55 | ####### Implicit rules | ||
56 | |||
57 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
58 | |||
59 | .cpp.o: | ||
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
61 | |||
62 | .cxx.o: | ||
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
64 | |||
65 | .cc.o: | ||
66 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
67 | |||
68 | .C.o: | ||
69 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
70 | |||
71 | .c.o: | ||
72 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
73 | |||
74 | ####### Build rules | ||
75 | |||
76 | |||
77 | all: $(QTDIR)/lib/libreader_codec.so.1.0.0 | ||
78 | |||
79 | $(QTDIR)/lib/libreader_codec.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
80 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
81 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
82 | -ln -s $(TARGET) $(TARGET0) | ||
83 | -ln -s $(TARGET) $(TARGET1) | ||
84 | -ln -s $(TARGET) $(TARGET2) | ||
85 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
86 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
87 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
88 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
89 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
90 | |||
91 | staticlib: $(TARGETA) | ||
92 | |||
93 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
94 | -rm -f $(TARGETA) | ||
95 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
96 | |||
97 | moc: $(SRCMOC) | ||
98 | |||
99 | tmake: codeclib.zmak | ||
100 | |||
101 | codeclib.zmak: codeclib.zpro | ||
102 | tmake codeclib.zpro -o codeclib.zmak | ||
103 | |||
104 | dist: | ||
105 | $(TAR) codeclib.zpro.tar codeclib.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
106 | $(GZIP) codeclib.zpro.tar | ||
107 | |||
108 | clean: | ||
109 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
110 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
111 | -rm -f *~ core | ||
112 | |||
113 | ####### Sub-libraries | ||
114 | |||
115 | |||
116 | ###### Combined headers | ||
117 | |||
118 | |||
119 | ####### Compile | ||
120 | |||
121 | ZREADEROBJS/CExpander.o: CExpander.cpp \ | ||
122 | CExpander.h \ | ||
123 | ZREADERINC/useqpe.h \ | ||
124 | config.h \ | ||
125 | ustring.h \ | ||
126 | StyleConsts.h \ | ||
127 | Markups.h \ | ||
128 | names.h \ | ||
129 | linktype.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CExpander.o CExpander.cpp | ||
131 | |||
132 | ZREADEROBJS/CBuffer.o: CBuffer.cpp \ | ||
133 | CBuffer.h \ | ||
134 | config.h \ | ||
135 | ustring.h | ||
136 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CBuffer.o CBuffer.cpp | ||
137 | |||
138 | ZREADEROBJS/StyleConsts.o: StyleConsts.cpp \ | ||
139 | StyleConsts.h | ||
140 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/StyleConsts.o StyleConsts.cpp | ||
141 | |||
142 | ZREADEROBJS/hrule.o: hrule.cpp | ||
143 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/hrule.o hrule.cpp | ||
144 | |||
145 | ZREADEROBJS/Navigation.o: Navigation.cpp \ | ||
146 | Navigation.h | ||
147 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Navigation.o Navigation.cpp | ||
148 | |||
149 | ZREADEROBJS/Bkmks.o: Bkmks.cpp \ | ||
150 | Bkmks.h \ | ||
151 | config.h \ | ||
152 | ustring.h \ | ||
153 | Filedata.h \ | ||
154 | StyleConsts.h \ | ||
155 | Markups.h \ | ||
156 | my_list.h \ | ||
157 | version.h \ | ||
158 | names.h | ||
159 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Bkmks.o Bkmks.cpp | ||
160 | |||
diff --git a/noncore/apps/opie-reader/codeclib.zpro b/noncore/apps/opie-reader/codeclib.zpro new file mode 100644 index 0000000..93908c6 --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib.zpro | |||
@@ -0,0 +1,15 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = pdb.h | ||
4 | |||
5 | SOURCES = CExpander.cpp CBuffer.cpp StyleConsts.cpp \ | ||
6 | hrule.cpp Navigation.cpp Bkmks.cpp | ||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/lib | ||
10 | TARGET = reader_codec | ||
11 | |||
12 | OBJECTS_DIR = ZREADEROBJS | ||
13 | MOC_DIR = ZREADERMOCS | ||
14 | INCLUDEPATH+= ZREADERINC | ||
15 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/codeclib/.cvsignore b/noncore/apps/opie-reader/codeclib/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/codeclib/codeclib.pro b/noncore/apps/opie-reader/codeclib/codeclib.pro new file mode 100644 index 0000000..6adcda8 --- a/dev/null +++ b/noncore/apps/opie-reader/codeclib/codeclib.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = pdb.h | ||
6 | |||
7 | SOURCES = CExpander.cpp CBuffer.cpp StyleConsts.cpp \ | ||
8 | hrule.cpp Navigation.cpp Bkmks.cpp | ||
9 | |||
10 | INTERFACES= | ||
11 | DESTDIR = $(OPIEDIR)/lib | ||
12 | TARGET = reader_codec | ||
13 | |||
14 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
15 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
16 | |||
17 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/ebookcodec.h b/noncore/apps/opie-reader/ebookcodec.h new file mode 100644 index 0000000..b341e55 --- a/dev/null +++ b/noncore/apps/opie-reader/ebookcodec.h | |||
@@ -0,0 +1,120 @@ | |||
1 | #include "CExpander.h" | ||
2 | |||
3 | #include <qfileinfo.h> | ||
4 | #include <qdir.h> | ||
5 | |||
6 | #include "useqpe.h" | ||
7 | #ifdef USEQPE | ||
8 | #include <qpe/global.h> | ||
9 | #endif | ||
10 | |||
11 | #include "util.h" | ||
12 | |||
13 | #include "static.h" | ||
14 | #ifndef __STATIC | ||
15 | #include <dlfcn.h> | ||
16 | class ebookcodec : public CExpander_Interface | ||
17 | { | ||
18 | CExpander *codec; | ||
19 | void *handle; | ||
20 | int status; | ||
21 | public: | ||
22 | QString about() | ||
23 | { | ||
24 | return QString("Plug-in ebook codec interface (c) Tim Wentford\n")+codec->about(); | ||
25 | } | ||
26 | ebookcodec(const QString& _s) : codec(NULL), handle(NULL), status(0) | ||
27 | { | ||
28 | QString codecpath(QTReaderUtil::getPluginPath()); | ||
29 | codecpath += _s; | ||
30 | if (QFile::exists(codecpath)) | ||
31 | { | ||
32 | qDebug("Codec:%s", (const char*)codecpath); | ||
33 | handle = dlopen(codecpath, RTLD_LAZY); | ||
34 | if (handle == 0) | ||
35 | { | ||
36 | /* | ||
37 | QString wrn(dlerror()); | ||
38 | QString fmt; | ||
39 | while (wrn.length() > 10) | ||
40 | { | ||
41 | fmt += wrn.left(10); | ||
42 | fmt += '\n'; | ||
43 | wrn = wrn.right(wrn.length()-10); | ||
44 | } | ||
45 | fmt += wrn; | ||
46 | QMessageBox::warning(NULL, PROGNAME, fmt); | ||
47 | */ | ||
48 | qDebug("Can't find codec:%s", dlerror()); | ||
49 | status = -10; | ||
50 | return; | ||
51 | } | ||
52 | CExpander* (*newcodec)(); | ||
53 | newcodec = (CExpander* (*)())dlsym(handle, "newcodec"); | ||
54 | if (newcodec == NULL) | ||
55 | { | ||
56 | qDebug("Can't find newcodec"); | ||
57 | status = -20; | ||
58 | return; | ||
59 | } | ||
60 | codec = (*newcodec)(); | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | qDebug("Can't find codec"); | ||
65 | } | ||
66 | if (codec == NULL) | ||
67 | { | ||
68 | qDebug("Can't do newcodec"); | ||
69 | status = -30; | ||
70 | return; | ||
71 | } | ||
72 | } | ||
73 | virtual ~ebookcodec() | ||
74 | { | ||
75 | if (codec != NULL) delete codec; | ||
76 | if (handle != NULL) dlclose(handle); | ||
77 | } | ||
78 | size_t getHome() { return codec->getHome(); } | ||
79 | #ifdef USEQPE | ||
80 | void suspend() { codec->suspend(); } | ||
81 | void unsuspend() { codec->unsuspend(); } | ||
82 | void suspend(FILE*& fin) { codec->suspend(fin); } | ||
83 | void unsuspend(FILE*& fin) { codec->unsuspend(fin); } | ||
84 | #endif | ||
85 | unsigned int locate() { return codec->locate(); } | ||
86 | void locate(unsigned int n) { codec->locate(n); } | ||
87 | bool hasrandomaccess() { return codec->hasrandomaccess(); } | ||
88 | void sizes(unsigned long& file, unsigned long& text) | ||
89 | { | ||
90 | codec->sizes(file, text); | ||
91 | //qDebug("Codec sizes:(%u, %u)", file, text); | ||
92 | } | ||
93 | CList<Bkmk>* getbkmklist() { return codec->getbkmklist(); } | ||
94 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) { codec->getch(ch, sty, pos); } | ||
95 | int getch() { return codec->getch(); } | ||
96 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) { return codec->hyperlink(n, noff, wrd, nm); } | ||
97 | MarkupType PreferredMarkup() { return codec->PreferredMarkup(); } | ||
98 | void saveposn(size_t posn) { codec->saveposn(posn); } | ||
99 | void writeposn(size_t posn) { codec->writeposn(posn); } | ||
100 | linkType forward(size_t& loc) { return codec->forward(loc); } | ||
101 | linkType back(size_t& loc) { return codec->back(loc); } | ||
102 | bool hasnavigation() { return codec->hasnavigation(); } | ||
103 | void start2endSection() { codec->start2endSection(); } | ||
104 | QImage* getPicture(unsigned long tgt) { return codec->getPicture(tgt); } | ||
105 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) { return codec->setSaveData(data, len, src, srclen); } | ||
106 | void putSaveData(unsigned char*& src, unsigned short& srclen) { codec->putSaveData(src, srclen); } | ||
107 | void setContinuous(bool _b) { codec->setContinuous(_b); } | ||
108 | void setwidth(int w) { codec->setwidth(w); } | ||
109 | unsigned long startSection() { return codec->startSection(); } | ||
110 | unsigned long endSection() { return codec->endSection(); } | ||
111 | int openfile(const char *src) | ||
112 | { | ||
113 | //qDebug("ebook openfile:%s", src); | ||
114 | return (status != 0) ? status : codec->openfile(src); | ||
115 | } | ||
116 | int getwidth() { return codec->getwidth(); } | ||
117 | QImage* getPicture(const QString& href) { return codec->getPicture(href); } | ||
118 | bool getFile(const QString& href) { return codec->getFile(href); } | ||
119 | }; | ||
120 | #endif | ||
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index 72a1222..2291c85 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp | |||
@@ -11,44 +11,31 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode | |||
11 | 11 | ||
12 | #include "QtrListView.h" | 12 | #include "QtrListView.h" |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qfile.h> | ||
16 | #include <qmessagebox.h> | ||
15 | #ifndef _WINDOWS | 17 | #ifndef _WINDOWS |
16 | #include <unistd.h> | 18 | #include <unistd.h> |
17 | #endif | 19 | #endif |
18 | #include <qlayout.h> | 20 | #include <qlayout.h> |
19 | #ifdef _WINDOWS | 21 | #ifdef _WINDOWS |
20 | #include <direct.h> | 22 | #include <direct.h> |
21 | #endif | 23 | #endif |
22 | 24 | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
25 | |||
26 | fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) | 25 | fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) |
27 | : QDialog( parent, name, true, | 26 | : QDialog( parent, name, true, |
28 | fl/* | WStyle_Customize | WStyle_Tool*/), | 27 | fl/* | WStyle_Customize | WStyle_Tool*/), |
29 | filterspec(QDir::All) | 28 | filterspec(QDir::All) |
30 | { | 29 | { |
31 | // showMaximized(); | 30 | // showMaximized(); |
32 | if ( !name ) | 31 | if ( !name ) |
33 | setName( "fileBrowser" ); | 32 | setName( "fileBrowser" ); |
34 | /* | ||
35 | if (parent != NULL) | ||
36 | { | ||
37 | #ifdef OPIE | ||
38 | move(0,0); | ||
39 | resize( parent->width(), parent->height() ); | ||
40 | #else | ||
41 | setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); | ||
42 | #endif | ||
43 | } | ||
44 | */ | ||
45 | // showFullScreen(); | ||
46 | setCaption(tr( "Browse for file" ) ); | 33 | setCaption(tr( "Browse for file" ) ); |
47 | filterStr=filter; | 34 | filterStr=filter; |
48 | 35 | ||
49 | buttonOk = new QPushButton( this, "buttonOk" ); | 36 | buttonOk = new QPushButton( this, "buttonOk" ); |
50 | buttonOk->setFixedSize( 25, 25 ); | 37 | // buttonOk->setFixedSize( 25, 25 ); |
51 | buttonOk->setAutoDefault( false ); | 38 | buttonOk->setAutoDefault( false ); |
52 | buttonOk->setText( tr( "/" ) ); | 39 | buttonOk->setText( tr( "/" ) ); |
53 | 40 | ||
54 | buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); | 41 | buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); |
@@ -73,19 +60,35 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo | |||
73 | 60 | ||
74 | // signals and slots connections | 61 | // signals and slots connections |
75 | connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); | 62 | connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); |
76 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); | 63 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); |
77 | connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) ); | 64 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
78 | connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); | 65 | connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
79 | connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); | 66 | connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
80 | connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); | 67 | connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
81 | connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); | 68 | connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); |
82 | 69 | ||
83 | QVBoxLayout* grid = new QVBoxLayout(this); | 70 | QVBoxLayout* grid = new QVBoxLayout(this); |
71 | grid->addWidget(dirLabel); | ||
84 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | 72 | QHBoxLayout* hgrid = new QHBoxLayout(grid); |
85 | hgrid->addWidget(dirLabel,1); | 73 | |
86 | hgrid->addWidget(buttonShowHidden); | 74 | QPushButton* bt = new QPushButton( this ); |
75 | bt->setText( tr( "SD" ) ); | ||
76 | connect( bt, SIGNAL( clicked() ), this, SLOT( onSD() ) ); | ||
77 | hgrid->addWidget(bt); | ||
78 | |||
79 | bt = new QPushButton( this ); | ||
80 | bt->setText( tr( "CF" ) ); | ||
81 | connect( bt, SIGNAL( clicked() ), this, SLOT( onCF() ) ); | ||
82 | hgrid->addWidget(bt); | ||
83 | |||
84 | bt = new QPushButton( this ); | ||
85 | bt->setText( tr( "Home" ) ); | ||
86 | connect( bt, SIGNAL( clicked() ), this, SLOT( onHome() ) ); | ||
87 | hgrid->addWidget(bt); | ||
88 | |||
87 | hgrid->addWidget(buttonOk); | 89 | hgrid->addWidget(buttonOk); |
90 | hgrid->addWidget(buttonShowHidden); | ||
88 | grid->addWidget(ListView,1); | 91 | grid->addWidget(ListView,1); |
89 | if (allownew) | 92 | if (allownew) |
90 | { | 93 | { |
91 | m_filename = new QLineEdit(this); | 94 | m_filename = new QLineEdit(this); |
@@ -113,10 +116,9 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo | |||
113 | } | 116 | } |
114 | 117 | ||
115 | populateList(); | 118 | populateList(); |
116 | 119 | ||
117 | if (modal) | 120 | if (modal) showMaximized(); |
118 | QPEApplication::showDialog( this ); | ||
119 | } | 121 | } |
120 | 122 | ||
121 | void fileBrowser::resizeEvent(QResizeEvent* e) | 123 | void fileBrowser::resizeEvent(QResizeEvent* e) |
122 | { | 124 | { |
@@ -131,9 +133,9 @@ fileBrowser::~fileBrowser() | |||
131 | 133 | ||
132 | void fileBrowser::populateList() | 134 | void fileBrowser::populateList() |
133 | { | 135 | { |
134 | ListView->clear(); | 136 | ListView->clear(); |
135 | ////odebug << currentDir.canonicalPath() << oendl; | 137 | ////qDebug(currentDir.canonicalPath()); |
136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); | 138 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); |
137 | currentDir.setFilter( filterspec ); | 139 | currentDir.setFilter( filterspec ); |
138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 140 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
139 | currentDir.setMatchAllDirs(TRUE); | 141 | currentDir.setMatchAllDirs(TRUE); |
@@ -155,9 +157,9 @@ void fileBrowser::populateList() | |||
155 | fileL+="/"; | 157 | fileL+="/"; |
156 | } | 158 | } |
157 | else | 159 | else |
158 | { | 160 | { |
159 | //// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; | 161 | //// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
160 | } | 162 | } |
161 | new QListViewItem( ListView,fileL,fileS ); | 163 | new QListViewItem( ListView,fileL,fileS ); |
162 | } | 164 | } |
163 | ++it; | 165 | ++it; |
@@ -168,17 +170,17 @@ void fileBrowser::populateList() | |||
168 | } | 170 | } |
169 | 171 | ||
170 | void fileBrowser::upDir() | 172 | void fileBrowser::upDir() |
171 | { | 173 | { |
172 | //// odebug << currentDir.canonicalPath() << oendl; | 174 | //// qDebug(currentDir.canonicalPath()); |
173 | } | 175 | } |
174 | 176 | ||
175 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 177 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
176 | { | 178 | { |
177 | if (selectedItem == NULL) return; | 179 | if (selectedItem == NULL) return; |
178 | QString strItem=selectedItem->text(0); | 180 | QString strItem=selectedItem->text(0); |
179 | 181 | ||
180 | //// odebug << "" << strItem << "" << oendl; | 182 | //// qDebug("%s", (const char*)strItem); |
181 | 183 | ||
182 | 184 | ||
183 | QString strSize=selectedItem->text(1); | 185 | QString strSize=selectedItem->text(1); |
184 | 186 | ||
@@ -231,11 +233,9 @@ void fileBrowser::OnOK() | |||
231 | } | 233 | } |
232 | 234 | ||
233 | void fileBrowser::OnRoot() | 235 | void fileBrowser::OnRoot() |
234 | { | 236 | { |
235 | currentDir.cd("/", TRUE); | 237 | setdir("/"); |
236 | populateList(); | ||
237 | chdir("/"); | ||
238 | } | 238 | } |
239 | 239 | ||
240 | void fileBrowser::OnCancel() | 240 | void fileBrowser::OnCancel() |
241 | { | 241 | { |
@@ -263,4 +263,26 @@ void fileBrowser::onReturn() | |||
263 | filename = QDir::cleanDirPath(currentDir.canonicalPath()+"/"+m_filename->text()); | 263 | filename = QDir::cleanDirPath(currentDir.canonicalPath()+"/"+m_filename->text()); |
264 | } | 264 | } |
265 | OnOK(); | 265 | OnOK(); |
266 | } | 266 | } |
267 | |||
268 | void fileBrowser::onCF() | ||
269 | { | ||
270 | setdir("/mnt/cf"); | ||
271 | } | ||
272 | |||
273 | void fileBrowser::onSD() | ||
274 | { | ||
275 | setdir("/mnt/card"); | ||
276 | } | ||
277 | |||
278 | void fileBrowser::onHome() | ||
279 | { | ||
280 | setdir(QDir::homeDirPath()); | ||
281 | } | ||
282 | |||
283 | void fileBrowser::setdir(const QString& s) | ||
284 | { | ||
285 | currentDir.cd(s, TRUE); | ||
286 | populateList(); | ||
287 | chdir(s); | ||
288 | } | ||
diff --git a/noncore/apps/opie-reader/fileBrowser.h b/noncore/apps/opie-reader/fileBrowser.h index a5274f8..c536e96 100644 --- a/noncore/apps/opie-reader/fileBrowser.h +++ b/noncore/apps/opie-reader/fileBrowser.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | Derived from the file browser published by ljp@llornkcor.com but extensively | 2 | Derived from the file browser published by ljp@llornkcor.com but extensively |
3 | modified to work in rotated views on the Zaurus | 3 | modified to work in rotated views on the Zaurus |
4 | */ | 4 | */ |
5 | 5 | ||
6 | /**************************************************************************** | 6 | /**************************************************************************** |
7 | ** Form interface generated from reading ui file 'fileBrowzer.ui' | 7 | ** Form interface generated from reading ui file 'fileBrowzer.ui' |
8 | ** | 8 | ** |
9 | ** Created: Fri Dec 14 08:16:02 2001 | 9 | ** Created: Fri Dec 14 08:16:02 2001 |
10 | ** by: The User Interface Compiler (uic) | 10 | ** by: The User Interface Compiler (uic) |
11 | ** | 11 | ** |
12 | ** WARNING! All changes made in this file will be lost! | 12 | ** WARNING! All changes made in this file will be lost! |
13 | blah,blah,blah | 13 | blah,blah,blah |
14 | ****************************************************************************/ | 14 | ****************************************************************************/ |
15 | #ifndef FILEBROWSER_H | 15 | #ifndef FILEBROWSER_H |
16 | #define FILEBROWSER_H | 16 | #define FILEBROWSER_H |
@@ -32,46 +32,50 @@ class QPushButton; | |||
32 | class QLineEdit; | 32 | class QLineEdit; |
33 | 33 | ||
34 | class fileBrowser : public QDialog | 34 | class fileBrowser : public QDialog |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | void populateList(); | 39 | void populateList(); |
40 | fileBrowser( bool allownew, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0, const QString iPath=0); | 40 | fileBrowser( bool allownew, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0, const QString iPath=0); |
41 | ~fileBrowser(); | 41 | ~fileBrowser(); |
42 | 42 | ||
43 | QPushButton* buttonOk; | 43 | QPushButton* buttonOk; |
44 | QPushButton* buttonShowHidden; | 44 | QPushButton* buttonShowHidden; |
45 | QtrListView* ListView; | 45 | QtrListView* ListView; |
46 | QPushButton* buttonCancel; | 46 | QPushButton* buttonCancel; |
47 | QLabel *dirLabel; | 47 | QLabel *dirLabel; |
48 | QString selectedFileName, filterStr; | 48 | QString selectedFileName, filterStr; |
49 | QDir currentDir; | 49 | QDir currentDir; |
50 | QFile file; | 50 | QFile file; |
51 | QString getCurrentFile(); | 51 | QString getCurrentFile(); |
52 | QLineEdit* m_filename; | 52 | QLineEdit* m_filename; |
53 | int filterspec; | 53 | int filterspec; |
54 | // QDir::FilterSpec filterspec; | 54 | // QDir::FilterSpec filterspec; |
55 | 55 | ||
56 | //QListViewItem * item; | 56 | //QListViewItem * item; |
57 | public slots: | 57 | public slots: |
58 | 58 | ||
59 | private: | 59 | private: |
60 | QString filename; | 60 | QString filename; |
61 | private slots: | 61 | private slots: |
62 | void upDir(); | 62 | void upDir(); |
63 | void listDoubleClicked(QListViewItem *); | 63 | void listDoubleClicked(QListViewItem *); |
64 | void listClicked(QListViewItem *); | 64 | void listClicked(QListViewItem *); |
65 | void OnRoot(); | 65 | void OnRoot(); |
66 | void OnCancel(); | 66 | void OnCancel(); |
67 | void setHidden(bool); | 67 | void setHidden(bool); |
68 | void onReturn(); | 68 | void onReturn(); |
69 | void onCF(); | ||
70 | void onSD(); | ||
71 | void onHome(); | ||
69 | 72 | ||
70 | protected slots: | 73 | protected slots: |
71 | 74 | ||
72 | protected: | 75 | protected: |
73 | void OnOK(); | 76 | void OnOK(); |
74 | virtual void resizeEvent(QResizeEvent* e); | 77 | virtual void resizeEvent(QResizeEvent* e); |
78 | void setdir(const QString& s); | ||
75 | }; | 79 | }; |
76 | 80 | ||
77 | #endif // FILEBROWSER_H | 81 | #endif // FILEBROWSER_H |
diff --git a/noncore/apps/opie-reader/hash.h b/noncore/apps/opie-reader/hash.h new file mode 100755 index 0000000..4fe526a --- a/dev/null +++ b/noncore/apps/opie-reader/hash.h | |||
@@ -0,0 +1,201 @@ | |||
1 | #ifndef __HASH_H | ||
2 | #define __HASH_H | ||
3 | |||
4 | #include <stdlib.h> | ||
5 | /* Primes | ||
6 | 1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
7 | 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 | ||
8 | 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 | ||
9 | 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 | ||
10 | 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 | ||
11 | 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 | ||
12 | 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 | ||
13 | 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 | ||
14 | 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947 | ||
15 | 953 967 971 977 983 991 997 | ||
16 | */ | ||
17 | |||
18 | inline size_t hashfn(unsigned long l) | ||
19 | { | ||
20 | return l*0x33f3; | ||
21 | } | ||
22 | |||
23 | inline size_t hash2fn(unsigned long l) | ||
24 | { | ||
25 | return l & 7; | ||
26 | } | ||
27 | /*/ | ||
28 | template<class K>size_t hashfn(const K& l) | ||
29 | { | ||
30 | size_t s = 0; | ||
31 | unsigned char* p = (unsigned char*)&l; | ||
32 | for (int i = 0; i < sizeof(K)-1; i++) | ||
33 | { | ||
34 | s = 3*s+(255-p[i]); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | template<class K>size_t hash2fn(const K& l) | ||
39 | { | ||
40 | unsigned char* p = (unsigned char*)&l; | ||
41 | return 255-p[sizeof(K)-1]; | ||
42 | } | ||
43 | */ | ||
44 | template<class K, class D> | ||
45 | class hashtable | ||
46 | { | ||
47 | public: | ||
48 | class iterator; | ||
49 | friend class hashtable::iterator; | ||
50 | #ifndef _WINDOWS | ||
51 | private: | ||
52 | #endif | ||
53 | struct keydata | ||
54 | { | ||
55 | K key; | ||
56 | D data; | ||
57 | bool inuse; | ||
58 | keydata() : inuse(false) {} | ||
59 | keydata(K k, D d) : key(k), data(d), inuse(true) {} | ||
60 | }; | ||
61 | keydata* table; | ||
62 | size_t hshsz; | ||
63 | bool notprime(size_t p) | ||
64 | { | ||
65 | size_t d; | ||
66 | if (p % 2 == 0) return true; | ||
67 | d = 3; | ||
68 | while (d*d <= p) | ||
69 | { | ||
70 | if (p % d == 0) | ||
71 | { | ||
72 | return true; | ||
73 | } | ||
74 | d += 2; | ||
75 | } | ||
76 | return false; | ||
77 | } | ||
78 | void resize() | ||
79 | { | ||
80 | size_t oldsz = hshsz; | ||
81 | hshsz = (3*hshsz)/2; | ||
82 | while (notprime(hshsz)) | ||
83 | { | ||
84 | hshsz++; | ||
85 | } | ||
86 | //printf("Size:%u\n", hshsz); | ||
87 | keydata* oldtable = table; | ||
88 | table = new keydata[hshsz]; | ||
89 | for (size_t i = 0; i < oldsz; i++) | ||
90 | { | ||
91 | if (oldtable[i].inuse) | ||
92 | { | ||
93 | //printf("Setting %u to %u\n", oldtable[i].key, oldtable[i].data); | ||
94 | (*this)[oldtable[i].key] = oldtable[i].data; | ||
95 | //printf("Now %u is %u\n", oldtable[i].key, (*this)[oldtable[i].key]); | ||
96 | } | ||
97 | } | ||
98 | delete [] oldtable; | ||
99 | } | ||
100 | size_t findkey(const K& key) // returns -1 if can't find it | ||
101 | { | ||
102 | size_t hash2 = hash2fn(key)%(hshsz-1)+1; | ||
103 | size_t hash = hashfn(key) % hshsz; | ||
104 | size_t i = hash; | ||
105 | //printf("Key:%u, hash:%u, hash2:%u\n", key, hash, hash2); | ||
106 | while (table[i].inuse) // !empty | ||
107 | { | ||
108 | if (table[i].key == key) | ||
109 | { | ||
110 | //printf("Key %u present at %u\n", key, i); | ||
111 | return i; // but its the correct one & present | ||
112 | } | ||
113 | i = (i+hash2) % hshsz; | ||
114 | if (i == hash) // Table full | ||
115 | { | ||
116 | resize(); | ||
117 | hash2 = hash2fn(key)%(hshsz-1)+1; | ||
118 | hash = hashfn(key) % hshsz; | ||
119 | i = hash; | ||
120 | //printf("(R)Key:%u, hash:%u, hash2:%u\n", key, hash, hash2); | ||
121 | } | ||
122 | } | ||
123 | //printf("Key %u absent at %u\n", key, i); | ||
124 | return i; // found & absent | ||
125 | } | ||
126 | public: | ||
127 | hashtable(int sz) : hshsz(sz) | ||
128 | { | ||
129 | while (notprime(hshsz)) | ||
130 | { | ||
131 | hshsz++; | ||
132 | } | ||
133 | //printf("Size:%u\n", hshsz); | ||
134 | table = new keydata[hshsz]; | ||
135 | } | ||
136 | ~hashtable() | ||
137 | { | ||
138 | delete [] table; | ||
139 | } | ||
140 | D& operator[](K k) | ||
141 | { | ||
142 | int i = findkey(k); | ||
143 | table[i].key = k; | ||
144 | table[i].inuse = true; | ||
145 | return table[i].data; | ||
146 | } | ||
147 | class iterator | ||
148 | { | ||
149 | friend class hashtable; | ||
150 | #ifdef _WINDOWS | ||
151 | public: | ||
152 | #endif | ||
153 | unsigned int ptr; | ||
154 | hashtable* tab; | ||
155 | iterator(int t, hashtable* _tab) : ptr(t), tab(_tab) | ||
156 | { | ||
157 | while (!tab->table[ptr].inuse && ptr < tab->hshsz) | ||
158 | { | ||
159 | ptr++; | ||
160 | } | ||
161 | } | ||
162 | public: | ||
163 | iterator() : tab(NULL) {} | ||
164 | iterator operator++() | ||
165 | { | ||
166 | while (++ptr < tab->hshsz) | ||
167 | { | ||
168 | if (tab->table[ptr].inuse) return *this; | ||
169 | } | ||
170 | return *this; | ||
171 | } | ||
172 | iterator& operator=(const iterator& r) | ||
173 | { | ||
174 | ptr = r.ptr; | ||
175 | tab = r.tab; | ||
176 | return *this; | ||
177 | } | ||
178 | bool operator!=(const iterator& r) | ||
179 | { | ||
180 | return !((ptr == r.ptr) && (tab == r.tab)); | ||
181 | } | ||
182 | bool operator==(const iterator& r) | ||
183 | { | ||
184 | return ((ptr == r.ptr) && (tab == r.tab)); | ||
185 | } | ||
186 | K first() { return tab->table[ptr].key; } | ||
187 | D second() { return tab->table[ptr].data; } | ||
188 | }; | ||
189 | iterator find(K k) | ||
190 | { | ||
191 | size_t i = findkey(k); | ||
192 | return (table[i].inuse) ? iterator(i,this) : end(); | ||
193 | } | ||
194 | D& operator[](const iterator& i) // Never call with an invalid iterator! | ||
195 | { | ||
196 | return table[i.ptr].data; | ||
197 | } | ||
198 | iterator begin() { return iterator(0, this); } | ||
199 | iterator end() { return iterator(hshsz, this); } | ||
200 | }; | ||
201 | #endif | ||
diff --git a/noncore/apps/opie-reader/hrule.cpp b/noncore/apps/opie-reader/hrule.cpp new file mode 100644 index 0000000..d697acb --- a/dev/null +++ b/noncore/apps/opie-reader/hrule.cpp | |||
@@ -0,0 +1,11 @@ | |||
1 | #include <qimage.h> | ||
2 | |||
3 | QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b) | ||
4 | { | ||
5 | //// qDebug("hrule [%d, %d]", w, h); | ||
6 | QPixmap* qimage = new QPixmap(w, h); | ||
7 | qimage->fill(QColor(r,g,b)); | ||
8 | QImage* ret = new QImage(qimage->convertToImage()); | ||
9 | delete qimage; | ||
10 | return ret; | ||
11 | } | ||
diff --git a/noncore/apps/opie-reader/hrule.h b/noncore/apps/opie-reader/hrule.h new file mode 100644 index 0000000..709eebd --- a/dev/null +++ b/noncore/apps/opie-reader/hrule.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __HRULE_H | ||
2 | #define __HRULE_H | ||
3 | |||
4 | class QImage; | ||
5 | |||
6 | QImage* hRule(int w, int h, unsigned char r=0, unsigned char g=0, unsigned char b=0); | ||
7 | |||
8 | #endif | ||
diff --git a/noncore/apps/opie-reader/iSilo.cpp b/noncore/apps/opie-reader/iSilo.cpp new file mode 100644 index 0000000..5f14b96 --- a/dev/null +++ b/noncore/apps/opie-reader/iSilo.cpp | |||
@@ -0,0 +1,638 @@ | |||
1 | #include "iSilo.h" | ||
2 | #ifdef _WINDOWS | ||
3 | #include <winsock.h> | ||
4 | #endif | ||
5 | u_int8_t *rodata = (u_int8_t *) | ||
6 | "\x10\x11\x12\x00\x08\x07\x09\x06\x0a\x05\x0b\x04\x0c\x03\x0d\x02\x0e\x01\x0f"; | ||
7 | |||
8 | u_int16_t *rsize_min = (u_int16_t *) | ||
9 | "\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0d" | ||
10 | "\x00\x0f\x00\x11\x00\x13\x00\x17\x00\x1b\x00\x1f\x00\x23\x00\x2b\x00\x33\x00" | ||
11 | "\x3b\x00\x43\x00\x53\x00\x63\x00\x73\x00\x83\x00\xa3\x00\xc3\x00\xe3\x00\x02" | ||
12 | "\x01"; | ||
13 | |||
14 | u_int8_t *rsize_delta = (u_int8_t *) | ||
15 | "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x02\x02\x02\x02\x03\x03\x03" | ||
16 | "\x03\x04\x04\x04\x04\x05\x05\x05\x05\x00"; | ||
17 | |||
18 | u_int16_t *rpos_min = (u_int16_t *) | ||
19 | "\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x07\x00\x09\x00\x0d\x00\x11\x00\x19" | ||
20 | "\x00\x21\x00\x31\x00\x41\x00\x61\x00\x81\x00\xc1\x00\x01\x01\x81\x01\x01\x02" | ||
21 | "\x01\x03\x01\x04\x01\x06\x01\x08\x01\x0c\x01\x10\x01\x18\x01\x20\x01\x30\x01" | ||
22 | "\x40\x01\x60"; | ||
23 | |||
24 | u_int8_t *rpos_delta = (u_int8_t *) | ||
25 | "\x00\x00\x00\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06\x07\x07" | ||
26 | "\x08\x08\x09\x09\x0a\x0a\x0b\x0b\x0c\x0c\x0d\x0d"; | ||
27 | |||
28 | void iSilo::init_tables(void) | ||
29 | { | ||
30 | int i; | ||
31 | u_int16_t j; | ||
32 | return; | ||
33 | for (i = 0; i < 3; i++) | ||
34 | rodata[i] = 0x10 + i; | ||
35 | rodata[3] = 0; | ||
36 | for (i = 4; i < 19; i = i + 2) | ||
37 | rodata[i] = 8 + (i-4)/2; | ||
38 | for (i = 5; i < 19; i = i + 2) | ||
39 | rodata[i] = 7 - (i-5)/2; | ||
40 | |||
41 | memset(rsize_delta, 0, 29); | ||
42 | for (i = 4; i < 29; i++) { | ||
43 | rsize_delta[i] = (i - 4) >> 2; | ||
44 | } | ||
45 | memset(rpos_delta, 0, 30); | ||
46 | for (i = 2; i < 30; i++) { | ||
47 | rpos_delta[i] = (i - 2) >> 1; | ||
48 | } | ||
49 | j = 3; | ||
50 | for (i = 0; i < 29; i++) { | ||
51 | rsize_min[i] = j; | ||
52 | j += 1 << rsize_delta[i]; | ||
53 | } | ||
54 | j = 1; | ||
55 | for (i = 0; i < 30; i++) { | ||
56 | rpos_min[i] = j; | ||
57 | j += 1 << rpos_delta[i]; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /* read num bits from the file descriptor */ | ||
62 | |||
63 | int iSilo::code2tree(struct s_huffman *h) { | ||
64 | struct s_tree *t, *tmp; | ||
65 | u_int32_t i; | ||
66 | int j, b; | ||
67 | |||
68 | t = new s_tree(); | ||
69 | h->tree = t; | ||
70 | if (t == NULL) return -1; | ||
71 | memset(t, 0, sizeof(struct s_tree)); | ||
72 | t->value = (u_int32_t)-1; | ||
73 | for (i = 0; i < h->num; i++) { | ||
74 | tmp = t; | ||
75 | for (j = 0; j < h->size[i]; j++) { | ||
76 | b = (h->code[i] >> j) & 1; | ||
77 | if (tmp->branch[b] == NULL) { | ||
78 | tmp->branch[b] =new s_tree(); | ||
79 | if (tmp->branch[b] == NULL) return(-1); | ||
80 | memset(tmp->branch[b], 0, sizeof(struct s_tree)); | ||
81 | tmp->value = (u_int32_t)-1; | ||
82 | } | ||
83 | tmp = tmp->branch[b]; | ||
84 | } | ||
85 | if (h->size[i] > 0) tmp->value = i; | ||
86 | } | ||
87 | return (0); | ||
88 | } | ||
89 | |||
90 | u_int32_t iSilo::swap_bits(u_int32_t n, int num) { | ||
91 | n = ((n >> 1) & 0x55555555) | ((n << 1) & 0xaaaaaaaa); | ||
92 | n = ((n >> 2) & 0x33333333) | ((n << 2) & 0xcccccccc); | ||
93 | n = ((n >> 4) & 0x0f0f0f0f) | ((n << 4) & 0xf0f0f0f0); | ||
94 | n = ((n >> 8) & 0x00ff00ff) | ((n << 8) & 0xff00ff00); | ||
95 | n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000); | ||
96 | n >>= (32 - num); | ||
97 | return(n); | ||
98 | } | ||
99 | |||
100 | |||
101 | u_int32_t *iSilo::huffman_get(struct s_huffman *h) | ||
102 | { | ||
103 | int b; | ||
104 | struct s_tree *t = h->tree; | ||
105 | |||
106 | while (t->value == -1) { | ||
107 | b = get_bits(1); | ||
108 | if (t->branch[b] == NULL) { | ||
109 | return(NULL); | ||
110 | } | ||
111 | t = t->branch[b]; | ||
112 | } | ||
113 | return (&t->value); | ||
114 | } | ||
115 | |||
116 | int iSilo::size2code(struct s_huffman *h) { | ||
117 | u_int8_t i, sk, max = 0; | ||
118 | u_int16_t sc, c; | ||
119 | u_int32_t j, k, l; | ||
120 | int skip; | ||
121 | |||
122 | for (l = 0; l < h->num; l++) { | ||
123 | if (h->size[l] > max) max = h->size[l]; | ||
124 | } | ||
125 | |||
126 | for (i = 1; i <= max; i++) { | ||
127 | sc = 0; | ||
128 | c = 0; | ||
129 | for (j = 0; j < h->num; j++) { | ||
130 | if (h->size[j] == i) { | ||
131 | do { | ||
132 | skip = 0; | ||
133 | for (k = 0; k < h->num; k++) { | ||
134 | sk = h->size[k]; | ||
135 | |||
136 | if ((sk < i) && (sk != 0) && !((h->code[k] ^ c) & ((1 << sk)-1))) { | ||
137 | if ((c + 1) == (1 << i)) { | ||
138 | return -1; | ||
139 | } | ||
140 | sc += 1 << (i-sk); | ||
141 | c = swap_bits(sc, i); | ||
142 | skip = 1; | ||
143 | break; | ||
144 | } | ||
145 | } | ||
146 | } while (skip); | ||
147 | h->code[j] = c; | ||
148 | sc++; | ||
149 | c = swap_bits(sc, i); | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | return(0); | ||
154 | } | ||
155 | |||
156 | |||
157 | struct s_huffman *iSilo::huffman_create(u_int32_t num) { | ||
158 | struct s_huffman *h; | ||
159 | h = new s_huffman(); | ||
160 | h->tree = new s_tree(); | ||
161 | memset(h->tree, 0, sizeof(struct s_tree)); | ||
162 | h->tree->value = (u_int32_t)-1; | ||
163 | h->num = num; | ||
164 | h->code = new u_int16_t[num]; | ||
165 | h->size = new u_int8_t[num]; | ||
166 | memset(h->size, 0, num); | ||
167 | memset(h->code, 0, num*2); | ||
168 | return (h); | ||
169 | } | ||
170 | |||
171 | void iSilo::kill_tree(struct s_tree *tree) { | ||
172 | if (tree == NULL) { | ||
173 | return; | ||
174 | } | ||
175 | kill_tree(tree->branch[0]); | ||
176 | kill_tree(tree->branch[1]); | ||
177 | delete tree; | ||
178 | } | ||
179 | |||
180 | void iSilo::kill_huffman(struct s_huffman *h) { | ||
181 | if (h == NULL) { | ||
182 | return; | ||
183 | } | ||
184 | kill_tree(h->tree); | ||
185 | delete h->code; | ||
186 | delete h->size; | ||
187 | delete h; | ||
188 | } | ||
189 | |||
190 | int iSilo::read_size(struct s_huffman *prev, struct s_huffman *h) { | ||
191 | u_int32_t *j; | ||
192 | u_int32_t i, n; | ||
193 | int s_ok = 0, ls = 0; | ||
194 | |||
195 | for (i = 0;i < h->num;) { | ||
196 | j = huffman_get(prev); | ||
197 | if (j == NULL) | ||
198 | return(-1); | ||
199 | switch(*j) { | ||
200 | case HM_MEDIUM: | ||
201 | n = get_swapped(3) + 3; /* n bytes of 0 */ | ||
202 | memset(h->size + i, 0, n); | ||
203 | i += n; | ||
204 | break; | ||
205 | case HM_LONG: | ||
206 | n = get_swapped(7) + 11; /* n bytes of 0 */ | ||
207 | memset(h->size + i, 0, n); | ||
208 | i += n; | ||
209 | break; | ||
210 | case HM_SHORT: | ||
211 | if (!s_ok) { | ||
212 | return(-1); | ||
213 | } | ||
214 | n = get_swapped(2) + 3; /* n+1 bytes of ls */ | ||
215 | memset(h->size + i, ls, n); | ||
216 | i += n; | ||
217 | break; | ||
218 | default: | ||
219 | h->size[i] = *j; | ||
220 | ls = *j; | ||
221 | i++; | ||
222 | break; | ||
223 | } | ||
224 | if ((*j == HM_LONG) || (*j == HM_MEDIUM)) { | ||
225 | s_ok = 0; | ||
226 | } else { | ||
227 | s_ok = 1; | ||
228 | } | ||
229 | } | ||
230 | return(0); | ||
231 | } | ||
232 | |||
233 | void iSilo::mymemcpy(u_int8_t *dst, u_int8_t *src, u_int32_t num) { | ||
234 | u_int32_t i; | ||
235 | for (i = 0; i < num; i++) { | ||
236 | dst[i] = src[i]; | ||
237 | } | ||
238 | } | ||
239 | /* return size or -1 for error */ | ||
240 | |||
241 | int iSilo::read_tree(struct s_huffman *prev, struct s_huffman *curr) { | ||
242 | if (read_size(prev, curr) == -1) | ||
243 | return(-1); | ||
244 | if (size2code(curr) == -1) | ||
245 | return(-1); | ||
246 | if (code2tree(curr) == -1) | ||
247 | return(-1); | ||
248 | return(0); | ||
249 | } | ||
250 | bool iSilo::reset_trees() | ||
251 | { | ||
252 | get_bits(0); /* flush buffer */ | ||
253 | /* This is a Table record so we reload the tables */ | ||
254 | kill_huffman(lz); | ||
255 | kill_huffman(text); | ||
256 | kill_huffman(master); | ||
257 | |||
258 | master = huffman_create(19); | ||
259 | text = huffman_create(get_swapped(5) + 257); | ||
260 | lz = huffman_create(get_swapped(5) + 1); | ||
261 | int rdmax = get_swapped(4) + 4; | ||
262 | |||
263 | for (int i = 0; i < rdmax; i++) | ||
264 | { | ||
265 | master->size[rodata[i]] = get_swapped(3); | ||
266 | } | ||
267 | |||
268 | if (size2code(master) == -1) { | ||
269 | qDebug("size2code(master) error: size-table is incompatible"); | ||
270 | return false; | ||
271 | } | ||
272 | |||
273 | code2tree(master); | ||
274 | |||
275 | if (read_tree(master, text) == -1) { | ||
276 | qDebug("read_tree() failed (format incorrect?)"); | ||
277 | return false; | ||
278 | } | ||
279 | |||
280 | if (read_tree(master, lz) == -1) { | ||
281 | qDebug("read_tree() failed (format incorrect?)"); | ||
282 | return false;; | ||
283 | } | ||
284 | return true; | ||
285 | } | ||
286 | u_int32_t iSilo::get_bits(int num) { | ||
287 | int i, r; | ||
288 | u_int32_t result = 0; | ||
289 | |||
290 | if (num == 0) { | ||
291 | pos = 0; | ||
292 | return(0); | ||
293 | } | ||
294 | |||
295 | for (i = 0; i < num; i++) { | ||
296 | if (pos == 0) { | ||
297 | r = fread(buf, sizeof(u_int32_t), 256, fin); | ||
298 | if (r <= 0) { | ||
299 | qDebug("ERROR: Unexpected end of file"); | ||
300 | exit(-1); /* FIXME */ | ||
301 | } | ||
302 | pos = 32*256; | ||
303 | } | ||
304 | |||
305 | pos--; | ||
306 | result <<= 1; | ||
307 | result |= (ntohl(buf[255 - (pos/32)]) >> (31-(pos % 32))) & 1; | ||
308 | } | ||
309 | return(result); | ||
310 | } | ||
311 | u_int32_t iSilo::get_swapped(int num) { | ||
312 | return(swap_bits(get_bits(num),num)); | ||
313 | } | ||
314 | int iSilo::read_text() { | ||
315 | u_int32_t *j; | ||
316 | u_int32_t k, l, bp, idx; | ||
317 | for (bp = 0; bp < buffer_size;) { | ||
318 | j = huffman_get(text); | ||
319 | if (j == NULL) | ||
320 | return(-1); | ||
321 | if (*j == 256) { | ||
322 | break; | ||
323 | } | ||
324 | if (*j >= 257) { | ||
325 | idx = *j - 257; | ||
326 | k = rsize_min[idx]; | ||
327 | if (rsize_delta[idx] != 0) { | ||
328 | k += get_swapped(rsize_delta[idx]); | ||
329 | } | ||
330 | j = huffman_get(lz); | ||
331 | if (j == NULL) | ||
332 | return(-1); | ||
333 | l = rpos_min[*j]; | ||
334 | if (rpos_delta[*j] != 0) { | ||
335 | l += get_swapped(rpos_delta[*j]); | ||
336 | } | ||
337 | if (k <= l) { | ||
338 | memcpy(buffer + bp, buffer + bp - l, k); | ||
339 | } else { | ||
340 | mymemcpy(buffer + bp, buffer + bp - l, k); | ||
341 | } | ||
342 | bp += k; | ||
343 | } else { | ||
344 | buffer[bp] = *j; | ||
345 | bp++; | ||
346 | } | ||
347 | } | ||
348 | return(bp); | ||
349 | } | ||
350 | u_int32_t iSilo::getreccode() | ||
351 | { | ||
352 | u_int32_t offset, rec_code; | ||
353 | gotorecordnumber(cur_rec); | ||
354 | if (fread(&rec_code, sizeof(rec_code), 1, fin) != 1) | ||
355 | { | ||
356 | qDebug("short read"); | ||
357 | return 0xff; | ||
358 | } | ||
359 | return rec_code; | ||
360 | } | ||
361 | bool iSilo::process_record() | ||
362 | { | ||
363 | u_int32_t rec_code = getreccode(); | ||
364 | if (((rec_code & 0xFF) == 0) && (cur_rec != 0)) | ||
365 | { | ||
366 | return false; | ||
367 | } | ||
368 | else | ||
369 | { | ||
370 | /* process text */ | ||
371 | if ((cur_rec % 9) == 1) | ||
372 | { | ||
373 | bsize = 0; | ||
374 | if (!reset_trees()) return false; | ||
375 | cur_rec++; | ||
376 | rec_code = getreccode(); | ||
377 | if (((rec_code & 0xFF) == 0) && (cur_rec != 0)) | ||
378 | { | ||
379 | return false; | ||
380 | } | ||
381 | } | ||
382 | if (cur_rec != 0) | ||
383 | { | ||
384 | /* This is a Data record so we decode text using the table */ | ||
385 | get_bits(0); | ||
386 | bsize = read_text(); | ||
387 | } /* end of text processing */ | ||
388 | } | ||
389 | return true; | ||
390 | } | ||
391 | iSilo::~iSilo() | ||
392 | { | ||
393 | kill_huffman(master); | ||
394 | kill_huffman(lz); | ||
395 | kill_huffman(text); | ||
396 | if (attr != NULL) | ||
397 | { | ||
398 | delete [] attr; | ||
399 | attr = NULL; | ||
400 | } | ||
401 | } | ||
402 | int iSilo::getch() | ||
403 | { | ||
404 | if (filepos >= textsize) | ||
405 | { | ||
406 | // qDebug("File end at record %u", cur_rec); | ||
407 | return EOF; | ||
408 | } | ||
409 | if (current_pos >= bsize) | ||
410 | { | ||
411 | cur_rec++; | ||
412 | if (!process_record()) return EOF; | ||
413 | current_pos = 0; | ||
414 | } | ||
415 | filepos++; | ||
416 | while (attr != NULL && filepos > attr[current_attr].offset) | ||
417 | { | ||
418 | mystyle.unset(); | ||
419 | u_int16_t a = attr[current_attr].value; | ||
420 | // qDebug("Handling attr:%x at pos:%u", a, filepos); | ||
421 | if ((a & 0x1) != 0) | ||
422 | { | ||
423 | mystyle.setBold(); | ||
424 | } | ||
425 | if ((a & 0xe) != 0) | ||
426 | { | ||
427 | qDebug("Unknown attribute:%x (%x)", a & 0xe, a); | ||
428 | } | ||
429 | if ((a & 0x10) != 0) | ||
430 | { | ||
431 | mystyle.setCentreJustify(); | ||
432 | } | ||
433 | else if ((a & 0x20) != 0) | ||
434 | { | ||
435 | mystyle.setRightJustify(); | ||
436 | } | ||
437 | else | ||
438 | { | ||
439 | mystyle.setLeftJustify(); | ||
440 | } | ||
441 | if ((a & 0x40) != 0) | ||
442 | { | ||
443 | qDebug("Unknown attribute:%x (%x)", a & 0x40, a); | ||
444 | } | ||
445 | if ((a & 0x80) != 0) | ||
446 | { | ||
447 | mystyle.setLeftMargin(10); | ||
448 | mystyle.setRightMargin(10); | ||
449 | } | ||
450 | switch (a & 0xf00) | ||
451 | { | ||
452 | case 0x300: | ||
453 | mystyle.setFontSize(0); | ||
454 | break; | ||
455 | case 0xd00: | ||
456 | mystyle.setFontSize(1); | ||
457 | break; | ||
458 | case 0xe00: | ||
459 | mystyle.setFontSize(2); | ||
460 | break; | ||
461 | case 0xf00: | ||
462 | mystyle.setFontSize(3); | ||
463 | break; | ||
464 | default: | ||
465 | mystyle.setFontSize(0); | ||
466 | qDebug("Not sure of font size:%x (%x)", a & 0xf00, a); | ||
467 | break; | ||
468 | } | ||
469 | if ((a & 0x1000) != 0) | ||
470 | { | ||
471 | mystyle.setMono(); | ||
472 | } | ||
473 | if ((a & 0x2000) != 0) | ||
474 | { | ||
475 | mystyle.setItalic(); | ||
476 | } | ||
477 | if ((a & 0x4000) != 0) | ||
478 | { | ||
479 | qDebug("Unknown attribute:%x (%x)", a & 0x4000, a); | ||
480 | } | ||
481 | if ((a & 0x8000) != 0) | ||
482 | { | ||
483 | mystyle.setUnderline(); | ||
484 | } | ||
485 | current_attr++; | ||
486 | if (current_attr >= attr_num) | ||
487 | { | ||
488 | attr_rec++; | ||
489 | read_attr(); | ||
490 | } | ||
491 | } | ||
492 | return buffer[current_pos++]; | ||
493 | } | ||
494 | |||
495 | void iSilo::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
496 | { | ||
497 | pos = filepos; | ||
498 | ch = getch(); | ||
499 | sty = mystyle; | ||
500 | } | ||
501 | |||
502 | int iSilo::OpenFile(const char* src) | ||
503 | { | ||
504 | struct stat _stat; | ||
505 | stat(src,&_stat); | ||
506 | filesize = _stat.st_size; | ||
507 | pos = 0; | ||
508 | cur_rec = 0; | ||
509 | buffer_size = 4096; | ||
510 | current_pos = 0; | ||
511 | bsize = 0; | ||
512 | filepos = 0; | ||
513 | |||
514 | if (!Cpdb::openpdbfile(src)) | ||
515 | { | ||
516 | return -1; | ||
517 | } | ||
518 | if (head.creator != 0x6F476F54 // 'ToGo' | ||
519 | || head.type != 0x6F476F54) // 'ToGo') | ||
520 | { | ||
521 | return -1; | ||
522 | } | ||
523 | qDebug("There is %u records in this PDB file", ntohs(head.recordList.numRecords)); | ||
524 | init_tables(); | ||
525 | gotorecordnumber(0); | ||
526 | fread(buffer,1,12,fin); | ||
527 | fread(&textsize, sizeof(textsize), 1, fin); | ||
528 | textsize = ntohl(textsize); | ||
529 | fread(buffer,1,4,fin); | ||
530 | fread(&attr_start,sizeof(attr_start),1,fin); | ||
531 | attr_start = ntohs(attr_start); | ||
532 | fread(buffer,1,2,fin); | ||
533 | fread(&attr_end,sizeof(attr_end),1,fin); | ||
534 | attr_end = ntohs(attr_end); | ||
535 | attr_rec = attr_start; | ||
536 | attr = NULL; | ||
537 | pos_hi = 0xffff; | ||
538 | last_pos = 0xffff; | ||
539 | last_value = 0xffff; | ||
540 | read_attr(); | ||
541 | return 0; | ||
542 | } | ||
543 | |||
544 | void iSilo::read_attr() | ||
545 | { | ||
546 | // qDebug("read_attr:<%u, %u, %u>", attr_rec, attr_start, attr_end); | ||
547 | current_attr = 0; | ||
548 | if (attr != NULL) | ||
549 | { | ||
550 | delete [] attr; | ||
551 | attr = NULL; | ||
552 | } | ||
553 | if (attr_rec >= attr_start && attr_rec < attr_end) | ||
554 | { | ||
555 | gotorecordnumber(attr_rec); | ||
556 | fread(buffer, 1, 4, fin); | ||
557 | fread(&attr_num, sizeof(attr_num), 1, fin); | ||
558 | attr_num = ntohs(attr_num)+1; | ||
559 | attr = new s_attrib[attr_num]; | ||
560 | for (int j = 0; j < attr_num; j++) | ||
561 | { | ||
562 | fread(&attr[j].offset, 2, 1, fin); | ||
563 | attr[j].offset = htons(attr[j].offset); | ||
564 | } | ||
565 | #ifdef _WINDOWS | ||
566 | for (j = 0; j < attr_num; j++) | ||
567 | #else | ||
568 | for (int j = 0; j < attr_num; j++) | ||
569 | #endif | ||
570 | { | ||
571 | fread(&attr[j].value, 2, 1, fin); | ||
572 | if (attr[j].offset < last_pos) | ||
573 | { | ||
574 | pos_hi++; | ||
575 | } | ||
576 | |||
577 | if ((attr[j].offset == last_pos) && (attr[j].value == last_value)) | ||
578 | { | ||
579 | pos_hi++; | ||
580 | } | ||
581 | |||
582 | last_pos = attr[j].offset; | ||
583 | attr[j].offset |= ((u_int32_t)pos_hi) << 16; | ||
584 | last_value = attr[j].value; | ||
585 | } | ||
586 | current_attr = 0; | ||
587 | // last_value = attr[attr_num-1].value; | ||
588 | // qDebug("Next attr:%u (%u)", attr[current_attr].offset, filepos); | ||
589 | // qDebug("Next attr:%x (%x)", attr[current_attr].offset, filepos); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | void iSilo::locate(unsigned int n) | ||
594 | { | ||
595 | // qDebug("Locating %u", n); | ||
596 | if (n >= textsize) n = 0; | ||
597 | pos = 0; | ||
598 | buffer_size = 4096; | ||
599 | current_pos = 0; | ||
600 | bsize = 0; | ||
601 | /* Brute force | ||
602 | cur_rec = 0; | ||
603 | filepos = 0; | ||
604 | */ // Fast | ||
605 | filepos = n - n % (8*buffer_size); | ||
606 | cur_rec = 9*(n/(8*buffer_size)); | ||
607 | // End of fast | ||
608 | pos_hi = 0xffff; | ||
609 | last_pos = 0xffff; | ||
610 | last_value = 0xffff; | ||
611 | attr_rec = attr_start; | ||
612 | read_attr(); | ||
613 | // While loop added for fast locate | ||
614 | while (attr != NULL && attr[attr_num-1].offset < filepos) | ||
615 | { | ||
616 | attr_rec++; | ||
617 | read_attr(); | ||
618 | } | ||
619 | |||
620 | while (filepos < n) | ||
621 | { | ||
622 | getch(); | ||
623 | } | ||
624 | } | ||
625 | /* | ||
626 | if (!process_record()) return EOF; | ||
627 | current_pos = 0; | ||
628 | */ | ||
629 | |||
630 | QString iSilo::about() | ||
631 | { | ||
632 | return QString("iSilo codec (c) Tim Wentford, based on code supplied by an anonymous donor"); | ||
633 | } | ||
634 | |||
635 | extern "C" | ||
636 | { | ||
637 | CExpander* newcodec() { return new iSilo; } | ||
638 | } | ||
diff --git a/noncore/apps/opie-reader/iSilo.h b/noncore/apps/opie-reader/iSilo.h new file mode 100755 index 0000000..9ef6a7f --- a/dev/null +++ b/noncore/apps/opie-reader/iSilo.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #include <sys/types.h> | ||
2 | #include <sys/stat.h> | ||
3 | #ifndef _WINDOWS | ||
4 | #include <netinet/in.h> | ||
5 | #include <unistd.h> | ||
6 | #include <stdlib.h> | ||
7 | #else | ||
8 | typedef unsigned char u_int8_t; | ||
9 | typedef unsigned short u_int16_t; | ||
10 | typedef unsigned long u_int32_t; | ||
11 | #endif | ||
12 | #include <fcntl.h> | ||
13 | #include <stdio.h> | ||
14 | #include <string.h> | ||
15 | |||
16 | #include "pdb.h" | ||
17 | |||
18 | #define VERSION "deSilo version 0.4a by Clement" | ||
19 | |||
20 | |||
21 | struct s_tree { | ||
22 | struct s_tree *branch[2]; | ||
23 | u_int32_t value; | ||
24 | }; | ||
25 | |||
26 | struct s_attrib { | ||
27 | u_int32_t offset; | ||
28 | u_int16_t value; | ||
29 | }; | ||
30 | |||
31 | struct s_huffman { | ||
32 | struct s_tree *tree; | ||
33 | u_int8_t *size; | ||
34 | u_int16_t *code; | ||
35 | u_int32_t num; | ||
36 | }; | ||
37 | |||
38 | #define HM_SHORT 0x10 | ||
39 | #define HM_MEDIUM 0x11 | ||
40 | #define HM_LONG 0x12 | ||
41 | |||
42 | class iSilo : public Cpdb | ||
43 | { | ||
44 | CStyle mystyle; | ||
45 | u_int16_t BlockSize; | ||
46 | int pos; | ||
47 | u_int32_t buf[256]; | ||
48 | struct s_huffman *master, *lz, *text; | ||
49 | u_int32_t cur_rec; | ||
50 | u_int8_t buffer[4096]; | ||
51 | u_int32_t buffer_size; | ||
52 | u_int16_t current_pos, bsize; | ||
53 | u_int32_t filepos, filesize, textsize; | ||
54 | u_int16_t attr_start, attr_end, attr_num, current_attr, attr_rec; | ||
55 | u_int16_t pos_hi; | ||
56 | u_int16_t last_pos, last_value; | ||
57 | |||
58 | |||
59 | s_attrib* attr; | ||
60 | |||
61 | |||
62 | void init_tables(void); | ||
63 | int code2tree(struct s_huffman *h); | ||
64 | u_int32_t swap_bits(u_int32_t n, int num); | ||
65 | u_int32_t *huffman_get(struct s_huffman *h); | ||
66 | int size2code(struct s_huffman *h); | ||
67 | void read_attr(); | ||
68 | struct s_huffman *huffman_create(u_int32_t num); | ||
69 | void kill_tree(struct s_tree *tree); | ||
70 | void kill_huffman(struct s_huffman *h); | ||
71 | int read_size(struct s_huffman *prev, struct s_huffman *h); | ||
72 | void mymemcpy(u_int8_t *dst, u_int8_t *src, u_int32_t num); | ||
73 | int read_tree(struct s_huffman *prev, struct s_huffman *curr); | ||
74 | bool reset_trees(); | ||
75 | u_int32_t get_bits(int num); | ||
76 | u_int32_t get_swapped(int num); | ||
77 | int read_text(); | ||
78 | u_int32_t getreccode(); | ||
79 | bool process_record(); | ||
80 | public: | ||
81 | iSilo() : pos(0), master(NULL), lz(NULL), text(NULL), cur_rec(0), buffer_size(4096), current_pos(0), bsize(0), BlockSize(4096) | ||
82 | { | ||
83 | } | ||
84 | ~iSilo(); | ||
85 | int getch(); | ||
86 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
87 | MarkupType PreferredMarkup() | ||
88 | { | ||
89 | return cNONE; | ||
90 | } | ||
91 | void sizes(unsigned long& _file, unsigned long& _text) | ||
92 | { | ||
93 | _file = filesize; | ||
94 | _text = textsize; | ||
95 | } | ||
96 | bool hasrandomaccess() { return false; } | ||
97 | int OpenFile(const char* src); | ||
98 | unsigned int locate() | ||
99 | { | ||
100 | return filepos; | ||
101 | } | ||
102 | void locate(unsigned int n); | ||
103 | QString about(); | ||
104 | }; | ||
diff --git a/noncore/apps/opie-reader/iSiloCodec.mak b/noncore/apps/opie-reader/iSiloCodec.mak new file mode 100644 index 0000000..d0ef46e --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec.mak | |||
@@ -0,0 +1,162 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libiSilo.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:39:31 2004 | ||
4 | # Project: iSiloCodec.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o iSiloCodec.mak iSiloCodec.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libiSilo.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = | ||
47 | SOURCES = iSilo.cpp | ||
48 | OBJECTS = QREADEROBJS/iSilo.o | ||
49 | FORMS = | ||
50 | UICDECLS = | ||
51 | UICIMPLS = | ||
52 | SRCMOC = | ||
53 | OBJMOC = | ||
54 | DIST = iSiloCodec.pro | ||
55 | QMAKE_TARGET = iSilo | ||
56 | DESTDIR = $(READERDIR)/codecs/ | ||
57 | TARGET = libiSilo.so.1.0.0 | ||
58 | TARGETA= $(READERDIR)/codecs/libiSilo.a | ||
59 | TARGETD= libiSilo.so.1.0.0 | ||
60 | TARGET0= libiSilo.so | ||
61 | TARGET1= libiSilo.so.1 | ||
62 | TARGET2= libiSilo.so.1.0 | ||
63 | |||
64 | first: all | ||
65 | ####### Implicit rules | ||
66 | |||
67 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
68 | |||
69 | .cpp.o: | ||
70 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
71 | |||
72 | .cc.o: | ||
73 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
74 | |||
75 | .cxx.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .C.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .c.o: | ||
82 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | ####### Build rules | ||
85 | |||
86 | all: iSiloCodec.mak $(READERDIR)/codecs/$(TARGET) | ||
87 | |||
88 | $(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
89 | test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/ | ||
90 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
91 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
92 | -ln -s $(TARGET) $(TARGET0) | ||
93 | -ln -s $(TARGET) $(TARGET1) | ||
94 | -ln -s $(TARGET) $(TARGET2) | ||
95 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) | ||
96 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) | ||
97 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1) | ||
98 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2) | ||
99 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/ | ||
100 | |||
101 | |||
102 | |||
103 | staticlib: $(TARGETA) | ||
104 | |||
105 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
106 | -$(DEL_FILE) $(TARGETA) | ||
107 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
108 | |||
109 | mocables: $(SRCMOC) | ||
110 | uicables: $(UICDECLS) $(UICIMPLS) | ||
111 | |||
112 | $(MOC): | ||
113 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
114 | |||
115 | iSiloCodec.mak: iSiloCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
116 | $(QMAKE) -o iSiloCodec.mak iSiloCodec.pro | ||
117 | qmake: | ||
118 | @$(QMAKE) -o iSiloCodec.mak iSiloCodec.pro | ||
119 | |||
120 | dist: | ||
121 | @mkdir -p QREADEROBJS/iSilo && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/iSilo/ && ( cd `dirname QREADEROBJS/iSilo` && $(TAR) iSilo.tar iSilo && $(GZIP) iSilo.tar ) && $(MOVE) `dirname QREADEROBJS/iSilo`/iSilo.tar.gz . && $(DEL_FILE) -r QREADEROBJS/iSilo | ||
122 | |||
123 | mocclean: | ||
124 | |||
125 | uiclean: | ||
126 | |||
127 | yaccclean: | ||
128 | lexclean: | ||
129 | clean: | ||
130 | -$(DEL_FILE) $(OBJECTS) | ||
131 | -$(DEL_FILE) *~ core *.core | ||
132 | |||
133 | |||
134 | ####### Sub-libraries | ||
135 | |||
136 | distclean: clean | ||
137 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET) | ||
138 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA) | ||
139 | |||
140 | |||
141 | FORCE: | ||
142 | |||
143 | ####### Compile | ||
144 | |||
145 | QREADEROBJS/iSilo.o: iSilo.cpp iSilo.h \ | ||
146 | pdb.h \ | ||
147 | QREADERINC/useqpe.h \ | ||
148 | CExpander.h \ | ||
149 | config.h \ | ||
150 | StyleConsts.h \ | ||
151 | Markups.h \ | ||
152 | names.h \ | ||
153 | linktype.h \ | ||
154 | ustring.h | ||
155 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/iSilo.o iSilo.cpp | ||
156 | |||
157 | ####### Install | ||
158 | |||
159 | install: all | ||
160 | |||
161 | uninstall: | ||
162 | |||
diff --git a/noncore/apps/opie-reader/iSiloCodec.omak b/noncore/apps/opie-reader/iSiloCodec.omak new file mode 100644 index 0000000..a3f1d90 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec.omak | |||
@@ -0,0 +1,123 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libiSilo.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: iSiloCodec.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libiSilo.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS = | ||
29 | SOURCES =iSilo.cpp | ||
30 | OBJECTS =OREADEROBJS/iSilo.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libiSilo.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libiSilo.a | ||
39 | TARGETD =libiSilo.so.1.0.0 | ||
40 | TARGET0 =libiSilo.so | ||
41 | TARGET1 =libiSilo.so.1 | ||
42 | TARGET2 =libiSilo.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: iSiloCodec.omak | ||
90 | |||
91 | iSiloCodec.omak: iSiloCodec.opro | ||
92 | tmake iSiloCodec.opro -o iSiloCodec.omak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) iSiloCodec.opro.tar iSiloCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) iSiloCodec.opro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | OREADEROBJS/iSilo.o: iSilo.cpp \ | ||
112 | iSilo.h \ | ||
113 | pdb.h \ | ||
114 | OREADERINC/useqpe.h \ | ||
115 | CExpander.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | StyleConsts.h \ | ||
119 | Markups.h \ | ||
120 | names.h \ | ||
121 | linktype.h | ||
122 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/iSilo.o iSilo.cpp | ||
123 | |||
diff --git a/noncore/apps/opie-reader/iSiloCodec.wmak b/noncore/apps/opie-reader/iSiloCodec.wmak new file mode 100644 index 0000000..452b220 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec.wmak | |||
@@ -0,0 +1,123 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libiSilo.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: iSiloCodec.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libiSilo.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS = | ||
29 | SOURCES =iSilo.cpp | ||
30 | OBJECTS =WSREADEROBJS/iSilo.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libiSilo.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libiSilo.a | ||
39 | TARGETD =libiSilo.so.1.0.0 | ||
40 | TARGET0 =libiSilo.so | ||
41 | TARGET1 =libiSilo.so.1 | ||
42 | TARGET2 =libiSilo.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: iSiloCodec.wmak | ||
90 | |||
91 | iSiloCodec.wmak: iSiloCodec.wpro | ||
92 | tmake iSiloCodec.wpro -o iSiloCodec.wmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) iSiloCodec.wpro.tar iSiloCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) iSiloCodec.wpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | WSREADEROBJS/iSilo.o: iSilo.cpp \ | ||
112 | iSilo.h \ | ||
113 | pdb.h \ | ||
114 | WSREADERINC/useqpe.h \ | ||
115 | CExpander.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | StyleConsts.h \ | ||
119 | Markups.h \ | ||
120 | names.h \ | ||
121 | linktype.h | ||
122 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/iSilo.o iSilo.cpp | ||
123 | |||
diff --git a/noncore/apps/opie-reader/iSiloCodec.wpro b/noncore/apps/opie-reader/iSiloCodec.wpro new file mode 100644 index 0000000..4967689 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec.wpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | #HEADERS = Aportis.h | ||
4 | |||
5 | SOURCES = iSilo.cpp | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = iSilo | ||
11 | LIBS += -lreader_pdb -lreader_codec | ||
12 | |||
13 | |||
14 | OBJECTS_DIR = WSREADEROBJS | ||
15 | MOC_DIR = WSREADERMOCS | ||
16 | INCLUDEPATH+= WSREADERINC | ||
17 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/iSiloCodec.zmak b/noncore/apps/opie-reader/iSiloCodec.zmak new file mode 100644 index 0000000..c6c9ed6 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec.zmak | |||
@@ -0,0 +1,123 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libiSilo.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: iSiloCodec.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libiSilo.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS = | ||
29 | SOURCES =iSilo.cpp | ||
30 | OBJECTS =ZREADEROBJS/iSilo.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libiSilo.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/plugins/reader/codecs/libiSilo.a | ||
39 | TARGETD =libiSilo.so.1.0.0 | ||
40 | TARGET0 =libiSilo.so | ||
41 | TARGET1 =libiSilo.so.1 | ||
42 | TARGET2 =libiSilo.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
76 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: iSiloCodec.zmak | ||
90 | |||
91 | iSiloCodec.zmak: iSiloCodec.zpro | ||
92 | tmake iSiloCodec.zpro -o iSiloCodec.zmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) iSiloCodec.zpro.tar iSiloCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) iSiloCodec.zpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | ZREADEROBJS/iSilo.o: iSilo.cpp \ | ||
112 | iSilo.h \ | ||
113 | pdb.h \ | ||
114 | ZREADERINC/useqpe.h \ | ||
115 | CExpander.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | StyleConsts.h \ | ||
119 | Markups.h \ | ||
120 | names.h \ | ||
121 | linktype.h | ||
122 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/iSilo.o iSilo.cpp | ||
123 | |||
diff --git a/noncore/apps/opie-reader/iSiloCodec.zpro b/noncore/apps/opie-reader/iSiloCodec.zpro new file mode 100644 index 0000000..525b044 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec.zpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | #HEADERS = Aportis.h | ||
4 | |||
5 | SOURCES = iSilo.cpp | ||
6 | |||
7 | |||
8 | INTERFACES= | ||
9 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
10 | TARGET = iSilo | ||
11 | LIBS += -lreader_pdb -lreader_codec | ||
12 | |||
13 | |||
14 | OBJECTS_DIR = ZREADEROBJS | ||
15 | MOC_DIR = ZREADERMOCS | ||
16 | INCLUDEPATH+= ZREADERINC | ||
17 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/iSiloCodec/.cvsignore b/noncore/apps/opie-reader/iSiloCodec/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/iSiloCodec/iSiloCodec.pro b/noncore/apps/opie-reader/iSiloCodec/iSiloCodec.pro new file mode 100644 index 0000000..78d5a49 --- a/dev/null +++ b/noncore/apps/opie-reader/iSiloCodec/iSiloCodec.pro | |||
@@ -0,0 +1,19 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | #HEADERS = Aportis.h | ||
6 | |||
7 | SOURCES = iSilo.cpp | ||
8 | |||
9 | |||
10 | INTERFACES= | ||
11 | DESTDIR = $(OPIEDIR)/plugins/reader/codecs | ||
12 | TARGET = iSilo | ||
13 | LIBS += -lreader_pdb -lreader_codec | ||
14 | |||
15 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
16 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) | ||
19 | |||
diff --git a/noncore/apps/opie-reader/infowin.cpp b/noncore/apps/opie-reader/infowin.cpp index c52a1f0..816a09f 100644 --- a/noncore/apps/opie-reader/infowin.cpp +++ b/noncore/apps/opie-reader/infowin.cpp | |||
@@ -1,13 +1,32 @@ | |||
1 | #include "infowin.h" | 1 | #include "infowin.h" |
2 | #include "version.h" | 2 | #include "version.h" |
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <qmultilineedit.h> | ||
5 | #include <qlayout.h> | ||
6 | #include <qpushbutton.h> | ||
4 | #include "names.h" | 7 | #include "names.h" |
5 | 8 | ||
9 | void infowin::setAbout(const QString& _s) | ||
10 | { | ||
11 | char vstr[128]; | ||
12 | sprintf(vstr, PROGNAME " v%u.%u%c (%s) - A small e-text reader\n%s %s", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE, __DATE__, __TIME__); | ||
13 | // l = new QLabel(vstr, this); | ||
14 | QString c = vstr; | ||
15 | c += _s; | ||
16 | aboutbox->setText(c); | ||
17 | } | ||
18 | |||
6 | infowin::infowin( QWidget *parent, const char *name, WFlags f) : | 19 | infowin::infowin( QWidget *parent, const char *name, WFlags f) : |
7 | QWidget(parent, name, f) | 20 | QWidget(parent, name, f) |
8 | { | 21 | { |
9 | grid = new QGridLayout(this, 6, 2); | 22 | QVBoxLayout* vl = new QVBoxLayout(this); |
23 | aboutbox = new QMultiLineEdit(this); | ||
24 | aboutbox->setReadOnly(true); | ||
25 | aboutbox->setWordWrap(QMultiLineEdit::WidgetWidth); | ||
26 | //grid->addWidget(l, 5, 0); | ||
27 | vl->addWidget(aboutbox); | ||
28 | QGridLayout* grid = new QGridLayout(vl, 10, 2); | ||
10 | QLabel* l; | 29 | QLabel* l; |
11 | l = new QLabel("Compressed file size", this); | 30 | l = new QLabel("Compressed file size", this); |
12 | grid->addWidget(l, 0, 0); | 31 | grid->addWidget(l, 0, 0); |
13 | fileSize = new QLabel("0", this); | 32 | fileSize = new QLabel("0", this); |
@@ -27,17 +46,38 @@ infowin::infowin( QWidget *parent, const char *name, WFlags f) : | |||
27 | grid->addWidget(l, 3, 0); | 46 | grid->addWidget(l, 3, 0); |
28 | location = new QLabel("0", this); | 47 | location = new QLabel("0", this); |
29 | location->setAlignment( AlignVCenter | AlignRight ); | 48 | location->setAlignment( AlignVCenter | AlignRight ); |
30 | grid->addWidget(location, 3, 1); | 49 | grid->addWidget(location, 3, 1); |
31 | l = new QLabel("Per centage read", this); | 50 | l = new QLabel("Per centage read (file)", this); |
32 | grid->addWidget(l, 4, 0); | 51 | grid->addWidget(l, 4, 0); |
33 | read = new QLabel("0", this); | 52 | read = new QLabel("0", this); |
34 | read->setAlignment( AlignVCenter | AlignRight ); | 53 | read->setAlignment( AlignVCenter | AlignRight ); |
35 | grid->addWidget(read, 4, 1); | 54 | grid->addWidget(read, 4, 1); |
36 | char vstr[128]; | 55 | |
37 | sprintf(vstr, PROGNAME " v%u.%u%c (%s)\nA small e-text reader", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE); | 56 | l = new QLabel("Document Size", this); |
38 | l = new QLabel(vstr, this); | ||
39 | grid->addWidget(l, 5, 0); | 57 | grid->addWidget(l, 5, 0); |
58 | docSize = new QLabel("0", this); | ||
59 | docSize->setAlignment( AlignVCenter | AlignRight ); | ||
60 | grid->addWidget(docSize, 5, 1); | ||
61 | |||
62 | l = new QLabel("Document Location", this); | ||
63 | grid->addWidget(l, 6, 0); | ||
64 | docLocation = new QLabel("0", this); | ||
65 | docLocation->setAlignment( AlignVCenter | AlignRight ); | ||
66 | grid->addWidget(docLocation, 6, 1); | ||
67 | |||
68 | l = new QLabel("Per centage read (doc)", this); | ||
69 | grid->addWidget(l, 7, 0); | ||
70 | docread = new QLabel("0", this); | ||
71 | docread->setAlignment( AlignVCenter | AlignRight ); | ||
72 | grid->addWidget(docread, 7, 1); | ||
73 | |||
74 | |||
75 | l = new QLabel("Zoom", this); | ||
76 | grid->addWidget(l, 8, 0); | ||
77 | zoom = new QLabel("0", this); | ||
78 | zoom->setAlignment( AlignVCenter | AlignRight ); | ||
79 | grid->addWidget(zoom, 8, 1); | ||
40 | QPushButton* exitbutton = new QPushButton("Cancel", this); | 80 | QPushButton* exitbutton = new QPushButton("Cancel", this); |
41 | connect( exitbutton, SIGNAL( released() ), this, SLOT( infoClose() ) ); | 81 | connect( exitbutton, SIGNAL( clicked() ), this, SLOT( infoClose() ) ); |
42 | grid->addWidget(exitbutton, 5, 1); | 82 | grid->addWidget(exitbutton, 9, 1); |
43 | } | 83 | } |
diff --git a/noncore/apps/opie-reader/infowin.h b/noncore/apps/opie-reader/infowin.h index 9ddce36..6f0fb99 100644 --- a/noncore/apps/opie-reader/infowin.h +++ b/noncore/apps/opie-reader/infowin.h | |||
@@ -1,11 +1,10 @@ | |||
1 | #ifndef __INFOWIN_H | 1 | #ifndef __INFOWIN_H |
2 | #define __INFOWIN_H | 2 | #define __INFOWIN_H |
3 | 3 | ||
4 | #include <qlayout.h> | ||
5 | #include <qpushbutton.h> | ||
6 | #include <qgrid.h> | ||
7 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | class QString; | ||
6 | class QMultiLineEdit; | ||
8 | 7 | ||
9 | class infowin : public QWidget | 8 | class infowin : public QWidget |
10 | { | 9 | { |
11 | Q_OBJECT | 10 | Q_OBJECT |
@@ -13,37 +12,25 @@ Q_OBJECT | |||
13 | QLabel* textSize; | 12 | QLabel* textSize; |
14 | QLabel* ratio; | 13 | QLabel* ratio; |
15 | QLabel* location; | 14 | QLabel* location; |
16 | QLabel* read; | 15 | QLabel* read; |
17 | QGridLayout* grid; | 16 | QLabel* docread; |
17 | QLabel* docSize; | ||
18 | QLabel* docLocation; | ||
19 | QLabel* zoom; | ||
20 | QMultiLineEdit* aboutbox; | ||
18 | public: | 21 | public: |
19 | infowin::infowin( QWidget *parent=0, const char *name=0, WFlags f = 0); | 22 | infowin::infowin( QWidget *parent=0, const char *name=0, WFlags f = 0); |
20 | /* | ||
21 | void addcancel(QPushButton* exitbutton) | ||
22 | { | ||
23 | grid->addWidget(exitbutton, 5, 1); | ||
24 | } | ||
25 | */ | ||
26 | void setFileSize(int sz) { fileSize->setNum(sz); } | 23 | void setFileSize(int sz) { fileSize->setNum(sz); } |
27 | void setTextSize(int sz) { textSize->setNum(sz); } | 24 | void setTextSize(int sz) { textSize->setNum(sz); } |
28 | void setRatio(int sz) { ratio->setText(QString().setNum(sz)+"%"); } | 25 | void setRatio(int sz) { ratio->setText(QString().setNum(sz)+"%"); } |
29 | void setLocation(int sz) { location->setNum(sz); } | 26 | void setLocation(int sz) { location->setNum(sz); } |
30 | void setRead(int sz) { read->setText(QString().setNum(sz)+"%"); } | 27 | void setRead(int sz) { read->setText(QString().setNum(sz)+"%"); } |
31 | /* | 28 | void setDocRead(int sz) { docread->setText(QString().setNum(sz)+"%"); } |
32 | virtual void keyPressEvent(QKeyEvent* e) | 29 | void setZoom(int sz) { zoom->setText(QString().setNum(sz)+"%"); } |
33 | { | 30 | void setDocSize(int sz) { docSize->setNum(sz); } |
34 | printf("Received:%d\n", e->key()); | 31 | void setDocLocation(int sz) { docLocation->setNum(sz); } |
35 | switch (e->key()) | 32 | void setAbout(const QString& s); |
36 | { | ||
37 | case Key_Escape: | ||
38 | e->accept(); | ||
39 | emit Close(); | ||
40 | break; | ||
41 | default: | ||
42 | e->ignore(); | ||
43 | } | ||
44 | } | ||
45 | */ | ||
46 | private slots: | 33 | private slots: |
47 | void infoClose() { emit Close(); } | 34 | void infoClose() { emit Close(); } |
48 | signals: | 35 | signals: |
49 | void Close(); | 36 | void Close(); |
diff --git a/noncore/apps/opie-reader/linktype.h b/noncore/apps/opie-reader/linktype.h index fa22b2f..23c24ac 100644 --- a/noncore/apps/opie-reader/linktype.h +++ b/noncore/apps/opie-reader/linktype.h | |||
@@ -1,11 +1,7 @@ | |||
1 | #ifndef __LINKTYPE_H | 1 | #ifndef __LINKTYPE_H |
2 | #define __LINKTYPE_H | 2 | #define __LINKTYPE_H |
3 | 3 | ||
4 | enum linkType | 4 | typedef unsigned int linkType; |
5 | { | 5 | const linkType eNone = 0, eLink = 1, ePicture = 2, eFile = 4; |
6 | eNone, | ||
7 | eLink, | ||
8 | ePicture | ||
9 | }; | ||
10 | 6 | ||
11 | #endif | 7 | #endif |
diff --git a/noncore/apps/opie-reader/lzx.c b/noncore/apps/opie-reader/lzx.c new file mode 100644 index 0000000..860077d --- a/dev/null +++ b/noncore/apps/opie-reader/lzx.c | |||
@@ -0,0 +1,811 @@ | |||
1 | /* $Id$ */ | ||
2 | /*************************************************************************** | ||
3 | * lzx.c - LZX decompression routines * | ||
4 | * ------------------- * | ||
5 | * * | ||
6 | * maintainer: Jed Wing <jedwin@ugcs.caltech.edu> * | ||
7 | * source: modified lzx.c from cabextract v0.5 * | ||
8 | * notes: This file was taken from cabextract v0.5, which was, * | ||
9 | * itself, a modified version of the lzx decompression code * | ||
10 | * from unlzx. * | ||
11 | * * | ||
12 | * platforms: In its current incarnation, this file has been tested on * | ||
13 | * two different Linux platforms (one, redhat-based, with a * | ||
14 | * 2.1.2 glibc and gcc 2.95.x, and the other, Debian, with * | ||
15 | * 2.2.4 glibc and both gcc 2.95.4 and gcc 3.0.2). Both were * | ||
16 | * Intel x86 compatible machines. * | ||
17 | ***************************************************************************/ | ||
18 | |||
19 | /*************************************************************************** | ||
20 | * * | ||
21 | * This program is free software; you can redistribute it and/or modify * | ||
22 | * it under the terms of the GNU General Public License as published by * | ||
23 | * the Free Software Foundation; either version 2 of the License, or * | ||
24 | * (at your option) any later version. Note that an exemption to this * | ||
25 | * license has been granted by Stuart Caie for the purposes of * | ||
26 | * distribution with chmlib. This does not, to the best of my * | ||
27 | * knowledge, constitute a change in the license of this (the LZX) code * | ||
28 | * in general. * | ||
29 | * * | ||
30 | ***************************************************************************/ | ||
31 | |||
32 | #include "lzx.h" | ||
33 | #include <stdio.h> | ||
34 | #include <stdlib.h> | ||
35 | #include <string.h> | ||
36 | #include <malloc.h> | ||
37 | |||
38 | #ifdef __GNUC__ | ||
39 | #define memcpy __builtin_memcpy | ||
40 | #endif | ||
41 | |||
42 | /* sized types */ | ||
43 | typedef unsigned char UBYTE; /* 8 bits exactly */ | ||
44 | typedef unsigned short UWORD; /* 16 bits (or more) */ | ||
45 | typedef unsigned int ULONG; /* 32 bits (or more) */ | ||
46 | typedef signed int LONG; /* 32 bits (or more) */ | ||
47 | |||
48 | /* some constants defined by the LZX specification */ | ||
49 | #define LZX_MIN_MATCH (2) | ||
50 | #define LZX_MAX_MATCH (257) | ||
51 | #define LZX_NUM_CHARS (256) | ||
52 | #define LZX_BLOCKTYPE_INVALID (0) /* also blocktypes 4-7 invalid */ | ||
53 | #define LZX_BLOCKTYPE_VERBATIM (1) | ||
54 | #define LZX_BLOCKTYPE_ALIGNED (2) | ||
55 | #define LZX_BLOCKTYPE_UNCOMPRESSED (3) | ||
56 | #define LZX_PRETREE_NUM_ELEMENTS (20) | ||
57 | #define LZX_ALIGNED_NUM_ELEMENTS (8) /* aligned offset tree #elements */ | ||
58 | #define LZX_NUM_PRIMARY_LENGTHS (7) /* this one missing from spec! */ | ||
59 | #define LZX_NUM_SECONDARY_LENGTHS (249) /* length tree #elements */ | ||
60 | |||
61 | /* LZX huffman defines: tweak tablebits as desired */ | ||
62 | #define LZX_PRETREE_MAXSYMBOLS (LZX_PRETREE_NUM_ELEMENTS) | ||
63 | #define LZX_PRETREE_TABLEBITS (6) | ||
64 | #define LZX_MAINTREE_MAXSYMBOLS (LZX_NUM_CHARS + 50*8) | ||
65 | #define LZX_MAINTREE_TABLEBITS (12) | ||
66 | #define LZX_LENGTH_MAXSYMBOLS (LZX_NUM_SECONDARY_LENGTHS+1) | ||
67 | #define LZX_LENGTH_TABLEBITS (12) | ||
68 | #define LZX_ALIGNED_MAXSYMBOLS (LZX_ALIGNED_NUM_ELEMENTS) | ||
69 | #define LZX_ALIGNED_TABLEBITS (7) | ||
70 | |||
71 | #define LZX_LENTABLE_SAFETY (64) /* we allow length table decoding overruns */ | ||
72 | |||
73 | #define LZX_DECLARE_TABLE(tbl) \ | ||
74 | UWORD tbl##_table[(1<<LZX_##tbl##_TABLEBITS) + (LZX_##tbl##_MAXSYMBOLS<<1)];\ | ||
75 | UBYTE tbl##_len [LZX_##tbl##_MAXSYMBOLS + LZX_LENTABLE_SAFETY] | ||
76 | |||
77 | struct LZXstate | ||
78 | { | ||
79 | UBYTE *window; /* the actual decoding window */ | ||
80 | ULONG window_size; /* window size (32Kb through 2Mb) */ | ||
81 | ULONG actual_size; /* window size when it was first allocated */ | ||
82 | ULONG window_posn; /* current offset within the window */ | ||
83 | ULONG R0, R1, R2; /* for the LRU offset system */ | ||
84 | UWORD main_elements; /* number of main tree elements */ | ||
85 | int header_read; /* have we started decoding at all yet? */ | ||
86 | UWORD block_type; /* type of this block */ | ||
87 | ULONG block_length; /* uncompressed length of this block */ | ||
88 | ULONG block_remaining; /* uncompressed bytes still left to decode */ | ||
89 | ULONG frames_read; /* the number of CFDATA blocks processed */ | ||
90 | LONG intel_filesize; /* magic header value used for transform */ | ||
91 | LONG intel_curpos; /* current offset in transform space */ | ||
92 | int intel_started; /* have we seen any translatable data yet? */ | ||
93 | |||
94 | LZX_DECLARE_TABLE(PRETREE); | ||
95 | LZX_DECLARE_TABLE(MAINTREE); | ||
96 | LZX_DECLARE_TABLE(LENGTH); | ||
97 | LZX_DECLARE_TABLE(ALIGNED); | ||
98 | }; | ||
99 | |||
100 | /* LZX decruncher */ | ||
101 | |||
102 | /* Microsoft's LZX document and their implementation of the | ||
103 | * com.ms.util.cab Java package do not concur. | ||
104 | * | ||
105 | * In the LZX document, there is a table showing the correlation between | ||
106 | * window size and the number of position slots. It states that the 1MB | ||
107 | * window = 40 slots and the 2MB window = 42 slots. In the implementation, | ||
108 | * 1MB = 42 slots, 2MB = 50 slots. The actual calculation is 'find the | ||
109 | * first slot whose position base is equal to or more than the required | ||
110 | * window size'. This would explain why other tables in the document refer | ||
111 | * to 50 slots rather than 42. | ||
112 | * | ||
113 | * The constant NUM_PRIMARY_LENGTHS used in the decompression pseudocode | ||
114 | * is not defined in the specification. | ||
115 | * | ||
116 | * The LZX document does not state the uncompressed block has an | ||
117 | * uncompressed length field. Where does this length field come from, so | ||
118 | * we can know how large the block is? The implementation has it as the 24 | ||
119 | * bits following after the 3 blocktype bits, before the alignment | ||
120 | * padding. | ||
121 | * | ||
122 | * The LZX document states that aligned offset blocks have their aligned | ||
123 | * offset huffman tree AFTER the main and length trees. The implementation | ||
124 | * suggests that the aligned offset tree is BEFORE the main and length | ||
125 | * trees. | ||
126 | * | ||
127 | * The LZX document decoding algorithm states that, in an aligned offset | ||
128 | * block, if an extra_bits value is 1, 2 or 3, then that number of bits | ||
129 | * should be read and the result added to the match offset. This is | ||
130 | * correct for 1 and 2, but not 3, where just a huffman symbol (using the | ||
131 | * aligned tree) should be read. | ||
132 | * | ||
133 | * Regarding the E8 preprocessing, the LZX document states 'No translation | ||
134 | * may be performed on the last 6 bytes of the input block'. This is | ||
135 | * correct. However, the pseudocode provided checks for the *E8 leader* | ||
136 | * up to the last 6 bytes. If the leader appears between -10 and -7 bytes | ||
137 | * from the end, this would cause the next four bytes to be modified, at | ||
138 | * least one of which would be in the last 6 bytes, which is not allowed | ||
139 | * according to the spec. | ||
140 | * | ||
141 | * The specification states that the huffman trees must always contain at | ||
142 | * least one element. However, many CAB files contain blocks where the | ||
143 | * length tree is completely empty (because there are no matches), and | ||
144 | * this is expected to succeed. | ||
145 | */ | ||
146 | |||
147 | |||
148 | /* LZX uses what it calls 'position slots' to represent match offsets. | ||
149 | * What this means is that a small 'position slot' number and a small | ||
150 | * offset from that slot are encoded instead of one large offset for | ||
151 | * every match. | ||
152 | * - position_base is an index to the position slot bases | ||
153 | * - extra_bits states how many bits of offset-from-base data is needed. | ||
154 | */ | ||
155 | static const UBYTE extra_bits[51] = { | ||
156 | 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, | ||
157 | 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, | ||
158 | 15, 15, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, | ||
159 | 17, 17, 17 | ||
160 | }; | ||
161 | |||
162 | static const ULONG position_base[51] = { | ||
163 | 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, | ||
164 | 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, | ||
165 | 65536, 98304, 131072, 196608, 262144, 393216, 524288, 655360, 786432, 917504, 1048576, 1179648, 1310720, 1441792, 1572864, 1703936, | ||
166 | 1835008, 1966080, 2097152 | ||
167 | }; | ||
168 | |||
169 | struct LZXstate *LZXinit(int window) | ||
170 | { | ||
171 | struct LZXstate *pState=NULL; | ||
172 | ULONG wndsize = 1 << window; | ||
173 | int i, posn_slots; | ||
174 | |||
175 | /* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */ | ||
176 | /* if a previously allocated window is big enough, keep it */ | ||
177 | if (window < 15 || window > 21) return NULL; | ||
178 | |||
179 | /* allocate state and associated window */ | ||
180 | pState = (struct LZXstate *)malloc(sizeof(struct LZXstate)); | ||
181 | if (!(pState->window = (UBYTE *)malloc(wndsize))) | ||
182 | { | ||
183 | free(pState); | ||
184 | return NULL; | ||
185 | } | ||
186 | pState->actual_size = wndsize; | ||
187 | pState->window_size = wndsize; | ||
188 | |||
189 | /* calculate required position slots */ | ||
190 | if (window == 20) posn_slots = 42; | ||
191 | else if (window == 21) posn_slots = 50; | ||
192 | else posn_slots = window << 1; | ||
193 | |||
194 | /** alternatively **/ | ||
195 | /* posn_slots=i=0; while (i < wndsize) i += 1 << extra_bits[posn_slots++]; */ | ||
196 | |||
197 | /* initialize other state */ | ||
198 | pState->R0 = pState->R1 = pState->R2 = 1; | ||
199 | pState->main_elements = LZX_NUM_CHARS + (posn_slots << 3); | ||
200 | pState->header_read = 0; | ||
201 | pState->frames_read = 0; | ||
202 | pState->block_remaining = 0; | ||
203 | pState->block_type = LZX_BLOCKTYPE_INVALID; | ||
204 | pState->intel_curpos = 0; | ||
205 | pState->intel_started = 0; | ||
206 | pState->window_posn = 0; | ||
207 | |||
208 | /* initialise tables to 0 (because deltas will be applied to them) */ | ||
209 | for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) pState->MAINTREE_len[i] = 0; | ||
210 | for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) pState->LENGTH_len[i] = 0; | ||
211 | |||
212 | return pState; | ||
213 | } | ||
214 | |||
215 | void LZXteardown(struct LZXstate *pState) | ||
216 | { | ||
217 | if (pState) | ||
218 | { | ||
219 | if (pState->window) | ||
220 | free(pState->window); | ||
221 | free(pState); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | int LZXreset(struct LZXstate *pState) | ||
226 | { | ||
227 | int i; | ||
228 | |||
229 | pState->R0 = pState->R1 = pState->R2 = 1; | ||
230 | pState->header_read = 0; | ||
231 | pState->frames_read = 0; | ||
232 | pState->block_remaining = 0; | ||
233 | pState->block_type = LZX_BLOCKTYPE_INVALID; | ||
234 | pState->intel_curpos = 0; | ||
235 | pState->intel_started = 0; | ||
236 | pState->window_posn = 0; | ||
237 | |||
238 | for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS + LZX_LENTABLE_SAFETY; i++) pState->MAINTREE_len[i] = 0; | ||
239 | for (i = 0; i < LZX_LENGTH_MAXSYMBOLS + LZX_LENTABLE_SAFETY; i++) pState->LENGTH_len[i] = 0; | ||
240 | |||
241 | return DECR_OK; | ||
242 | }; | ||
243 | |||
244 | |||
245 | /* Bitstream reading macros: | ||
246 | * | ||
247 | * INIT_BITSTREAM should be used first to set up the system | ||
248 | * READ_BITS(var,n) takes N bits from the buffer and puts them in var | ||
249 | * | ||
250 | * ENSURE_BITS(n) ensures there are at least N bits in the bit buffer | ||
251 | * PEEK_BITS(n) extracts (without removing) N bits from the bit buffer | ||
252 | * REMOVE_BITS(n) removes N bits from the bit buffer | ||
253 | * | ||
254 | * These bit access routines work by using the area beyond the MSB and the | ||
255 | * LSB as a free source of zeroes. This avoids having to mask any bits. | ||
256 | * So we have to know the bit width of the bitbuffer variable. This is | ||
257 | * sizeof(ULONG) * 8, also defined as ULONG_BITS | ||
258 | */ | ||
259 | |||
260 | /* number of bits in ULONG. Note: This must be at multiple of 16, and at | ||
261 | * least 32 for the bitbuffer code to work (ie, it must be able to ensure | ||
262 | * up to 17 bits - that's adding 16 bits when there's one bit left, or | ||
263 | * adding 32 bits when there are no bits left. The code should work fine | ||
264 | * for machines where ULONG >= 32 bits. | ||
265 | */ | ||
266 | #define ULONG_BITS (sizeof(ULONG)<<3) | ||
267 | |||
268 | #define INIT_BITSTREAM do { bitsleft = 0; bitbuf = 0; } while (0) | ||
269 | |||
270 | #define ENSURE_BITS(n) \ | ||
271 | while (bitsleft < (n)) { \ | ||
272 | bitbuf |= ((inpos[1]<<8)|inpos[0]) << (ULONG_BITS-16 - bitsleft);\ | ||
273 | bitsleft += 16; inpos+=2; \ | ||
274 | } | ||
275 | |||
276 | #define PEEK_BITS(n) (bitbuf >> (ULONG_BITS - (n))) | ||
277 | #define REMOVE_BITS(n) ((bitbuf <<= (n)), (bitsleft -= (n))) | ||
278 | |||
279 | #define READ_BITS(v,n) do { \ | ||
280 | ENSURE_BITS(n); \ | ||
281 | (v) = PEEK_BITS(n); \ | ||
282 | REMOVE_BITS(n); \ | ||
283 | } while (0) | ||
284 | |||
285 | |||
286 | /* Huffman macros */ | ||
287 | |||
288 | #define TABLEBITS(tbl) (LZX_##tbl##_TABLEBITS) | ||
289 | #define MAXSYMBOLS(tbl) (LZX_##tbl##_MAXSYMBOLS) | ||
290 | #define SYMTABLE(tbl) (pState->tbl##_table) | ||
291 | #define LENTABLE(tbl) (pState->tbl##_len) | ||
292 | |||
293 | /* BUILD_TABLE(tablename) builds a huffman lookup table from code lengths. | ||
294 | * In reality, it just calls make_decode_table() with the appropriate | ||
295 | * values - they're all fixed by some #defines anyway, so there's no point | ||
296 | * writing each call out in full by hand. | ||
297 | */ | ||
298 | #define BUILD_TABLE(tbl) \ | ||
299 | if (make_decode_table( \ | ||
300 | MAXSYMBOLS(tbl), TABLEBITS(tbl), LENTABLE(tbl), SYMTABLE(tbl)\ | ||
301 | )) { return DECR_ILLEGALDATA; } | ||
302 | |||
303 | |||
304 | /* READ_HUFFSYM(tablename, var) decodes one huffman symbol from the | ||
305 | * bitstream using the stated table and puts it in var. | ||
306 | */ | ||
307 | #define READ_HUFFSYM(tbl,var) do { \ | ||
308 | ENSURE_BITS(16); \ | ||
309 | hufftbl = SYMTABLE(tbl); \ | ||
310 | if ((i = hufftbl[PEEK_BITS(TABLEBITS(tbl))]) >= MAXSYMBOLS(tbl)) {\ | ||
311 | j = 1 << (ULONG_BITS - TABLEBITS(tbl)); \ | ||
312 | do { \ | ||
313 | j >>= 1; i <<= 1; i |= (bitbuf & j) ? 1 : 0; \ | ||
314 | if (!j) { return DECR_ILLEGALDATA; } \ | ||
315 | } while ((i = hufftbl[i]) >= MAXSYMBOLS(tbl)); \ | ||
316 | } \ | ||
317 | j = LENTABLE(tbl)[(var) = i]; \ | ||
318 | REMOVE_BITS(j); \ | ||
319 | } while (0) | ||
320 | |||
321 | |||
322 | /* READ_LENGTHS(tablename, first, last) reads in code lengths for symbols | ||
323 | * first to last in the given table. The code lengths are stored in their | ||
324 | * own special LZX way. | ||
325 | */ | ||
326 | #define READ_LENGTHS(tbl,first,last) do { \ | ||
327 | lb.bb = bitbuf; lb.bl = bitsleft; lb.ip = inpos; \ | ||
328 | if (lzx_read_lens(pState, LENTABLE(tbl),(first),(last),&lb)) { \ | ||
329 | return DECR_ILLEGALDATA; \ | ||
330 | } \ | ||
331 | bitbuf = lb.bb; bitsleft = lb.bl; inpos = lb.ip; \ | ||
332 | } while (0) | ||
333 | |||
334 | |||
335 | /* make_decode_table(nsyms, nbits, length[], table[]) | ||
336 | * | ||
337 | * This function was coded by David Tritscher. It builds a fast huffman | ||
338 | * decoding table out of just a canonical huffman code lengths table. | ||
339 | * | ||
340 | * nsyms = total number of symbols in this huffman tree. | ||
341 | * nbits = any symbols with a code length of nbits or less can be decoded | ||
342 | * in one lookup of the table. | ||
343 | * length = A table to get code lengths from [0 to syms-1] | ||
344 | * table = The table to fill up with decoded symbols and pointers. | ||
345 | * | ||
346 | * Returns 0 for OK or 1 for error | ||
347 | */ | ||
348 | |||
349 | static int make_decode_table(ULONG nsyms, ULONG nbits, UBYTE *length, UWORD *table) { | ||
350 | register UWORD sym; | ||
351 | register ULONG leaf; | ||
352 | register UBYTE bit_num = 1; | ||
353 | ULONG fill; | ||
354 | ULONG pos = 0; /* the current position in the decode table */ | ||
355 | ULONG table_mask = 1 << nbits; | ||
356 | ULONG bit_mask = table_mask >> 1; /* don't do 0 length codes */ | ||
357 | ULONG next_symbol = bit_mask; /* base of allocation for long codes */ | ||
358 | |||
359 | /* fill entries for codes short enough for a direct mapping */ | ||
360 | while (bit_num <= nbits) { | ||
361 | for (sym = 0; sym < nsyms; sym++) { | ||
362 | if (length[sym] == bit_num) { | ||
363 | leaf = pos; | ||
364 | |||
365 | if((pos += bit_mask) > table_mask) return 1; /* table overrun */ | ||
366 | |||
367 | /* fill all possible lookups of this symbol with the symbol itself */ | ||
368 | fill = bit_mask; | ||
369 | while (fill-- > 0) table[leaf++] = sym; | ||
370 | } | ||
371 | } | ||
372 | bit_mask >>= 1; | ||
373 | bit_num++; | ||
374 | } | ||
375 | |||
376 | /* if there are any codes longer than nbits */ | ||
377 | if (pos != table_mask) { | ||
378 | /* clear the remainder of the table */ | ||
379 | for (sym = pos; sym < table_mask; sym++) table[sym] = 0; | ||
380 | |||
381 | /* give ourselves room for codes to grow by up to 16 more bits */ | ||
382 | pos <<= 16; | ||
383 | table_mask <<= 16; | ||
384 | bit_mask = 1 << 15; | ||
385 | |||
386 | while (bit_num <= 16) { | ||
387 | for (sym = 0; sym < nsyms; sym++) { | ||
388 | if (length[sym] == bit_num) { | ||
389 | leaf = pos >> 16; | ||
390 | for (fill = 0; fill < bit_num - nbits; fill++) { | ||
391 | /* if this path hasn't been taken yet, 'allocate' two entries */ | ||
392 | if (table[leaf] == 0) { | ||
393 | table[(next_symbol << 1)] = 0; | ||
394 | table[(next_symbol << 1) + 1] = 0; | ||
395 | table[leaf] = next_symbol++; | ||
396 | } | ||
397 | /* follow the path and select either left or right for next bit */ | ||
398 | leaf = table[leaf] << 1; | ||
399 | if ((pos >> (15-fill)) & 1) leaf++; | ||
400 | } | ||
401 | table[leaf] = sym; | ||
402 | |||
403 | if ((pos += bit_mask) > table_mask) return 1; /* table overflow */ | ||
404 | } | ||
405 | } | ||
406 | bit_mask >>= 1; | ||
407 | bit_num++; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | /* full table? */ | ||
412 | if (pos == table_mask) return 0; | ||
413 | |||
414 | /* either erroneous table, or all elements are 0 - let's find out. */ | ||
415 | for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1; | ||
416 | return 0; | ||
417 | } | ||
418 | |||
419 | struct lzx_bits { | ||
420 | ULONG bb; | ||
421 | int bl; | ||
422 | UBYTE *ip; | ||
423 | }; | ||
424 | |||
425 | static int lzx_read_lens(struct LZXstate *pState, UBYTE *lens, ULONG first, ULONG last, struct lzx_bits *lb) { | ||
426 | ULONG i,j, x,y; | ||
427 | int z; | ||
428 | |||
429 | register ULONG bitbuf = lb->bb; | ||
430 | register int bitsleft = lb->bl; | ||
431 | UBYTE *inpos = lb->ip; | ||
432 | UWORD *hufftbl; | ||
433 | |||
434 | for (x = 0; x < 20; x++) { | ||
435 | READ_BITS(y, 4); | ||
436 | LENTABLE(PRETREE)[x] = y; | ||
437 | } | ||
438 | BUILD_TABLE(PRETREE); | ||
439 | |||
440 | for (x = first; x < last; ) { | ||
441 | READ_HUFFSYM(PRETREE, z); | ||
442 | if (z == 17) { | ||
443 | READ_BITS(y, 4); y += 4; | ||
444 | while (y--) lens[x++] = 0; | ||
445 | } | ||
446 | else if (z == 18) { | ||
447 | READ_BITS(y, 5); y += 20; | ||
448 | while (y--) lens[x++] = 0; | ||
449 | } | ||
450 | else if (z == 19) { | ||
451 | READ_BITS(y, 1); y += 4; | ||
452 | READ_HUFFSYM(PRETREE, z); | ||
453 | z = lens[x] - z; if (z < 0) z += 17; | ||
454 | while (y--) lens[x++] = z; | ||
455 | } | ||
456 | else { | ||
457 | z = lens[x] - z; if (z < 0) z += 17; | ||
458 | lens[x++] = z; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | lb->bb = bitbuf; | ||
463 | lb->bl = bitsleft; | ||
464 | lb->ip = inpos; | ||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | int LZXdecompress(struct LZXstate *pState, unsigned char *inpos, unsigned char *outpos, int inlen, int outlen) { | ||
469 | UBYTE *endinp = inpos + inlen; | ||
470 | UBYTE *window = pState->window; | ||
471 | UBYTE *runsrc, *rundest; | ||
472 | UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */ | ||
473 | |||
474 | ULONG window_posn = pState->window_posn; | ||
475 | ULONG window_size = pState->window_size; | ||
476 | ULONG R0 = pState->R0; | ||
477 | ULONG R1 = pState->R1; | ||
478 | ULONG R2 = pState->R2; | ||
479 | |||
480 | register ULONG bitbuf; | ||
481 | register int bitsleft; | ||
482 | ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */ | ||
483 | struct lzx_bits lb; /* used in READ_LENGTHS macro */ | ||
484 | |||
485 | int togo = outlen, this_run, main_element, aligned_bits; | ||
486 | int match_length, length_footer, extra, verbatim_bits; | ||
487 | |||
488 | INIT_BITSTREAM; | ||
489 | |||
490 | /* read header if necessary */ | ||
491 | if (!pState->header_read) { | ||
492 | i = j = 0; | ||
493 | READ_BITS(k, 1); if (k) { READ_BITS(i,16); READ_BITS(j,16); } | ||
494 | pState->intel_filesize = (i << 16) | j; /* or 0 if not encoded */ | ||
495 | pState->header_read = 1; | ||
496 | } | ||
497 | |||
498 | /* main decoding loop */ | ||
499 | while (togo > 0) { | ||
500 | /* last block finished, new block expected */ | ||
501 | if (pState->block_remaining == 0) { | ||
502 | if (pState->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) { | ||
503 | if (pState->block_length & 1) inpos++; /* realign bitstream to word */ | ||
504 | INIT_BITSTREAM; | ||
505 | } | ||
506 | |||
507 | READ_BITS(pState->block_type, 3); | ||
508 | READ_BITS(i, 16); | ||
509 | READ_BITS(j, 8); | ||
510 | pState->block_remaining = pState->block_length = (i << 8) | j; | ||
511 | |||
512 | switch (pState->block_type) { | ||
513 | case LZX_BLOCKTYPE_ALIGNED: | ||
514 | for (i = 0; i < 8; i++) { READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j; } | ||
515 | BUILD_TABLE(ALIGNED); | ||
516 | /* rest of aligned header is same as verbatim */ | ||
517 | |||
518 | case LZX_BLOCKTYPE_VERBATIM: | ||
519 | READ_LENGTHS(MAINTREE, 0, 256); | ||
520 | READ_LENGTHS(MAINTREE, 256, pState->main_elements); | ||
521 | BUILD_TABLE(MAINTREE); | ||
522 | if (LENTABLE(MAINTREE)[0xE8] != 0) pState->intel_started = 1; | ||
523 | |||
524 | READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS); | ||
525 | BUILD_TABLE(LENGTH); | ||
526 | break; | ||
527 | |||
528 | case LZX_BLOCKTYPE_UNCOMPRESSED: | ||
529 | pState->intel_started = 1; /* because we can't assume otherwise */ | ||
530 | ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */ | ||
531 | if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */ | ||
532 | R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4; | ||
533 | R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4; | ||
534 | R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4; | ||
535 | break; | ||
536 | |||
537 | default: | ||
538 | return DECR_ILLEGALDATA; | ||
539 | } | ||
540 | } | ||
541 | |||
542 | /* buffer exhaustion check */ | ||
543 | if (inpos > endinp) { | ||
544 | /* it's possible to have a file where the next run is less than | ||
545 | * 16 bits in size. In this case, the READ_HUFFSYM() macro used | ||
546 | * in building the tables will exhaust the buffer, so we should | ||
547 | * allow for this, but not allow those accidentally read bits to | ||
548 | * be used (so we check that there are at least 16 bits | ||
549 | * remaining - in this boundary case they aren't really part of | ||
550 | * the compressed data) | ||
551 | */ | ||
552 | if (inpos > (endinp+2) || bitsleft < 16) return DECR_ILLEGALDATA; | ||
553 | } | ||
554 | |||
555 | while ((this_run = pState->block_remaining) > 0 && togo > 0) { | ||
556 | if (this_run > togo) this_run = togo; | ||
557 | togo -= this_run; | ||
558 | pState->block_remaining -= this_run; | ||
559 | |||
560 | /* apply 2^x-1 mask */ | ||
561 | window_posn &= window_size - 1; | ||
562 | /* runs can't straddle the window wraparound */ | ||
563 | if ((window_posn + this_run) > window_size) | ||
564 | return DECR_DATAFORMAT; | ||
565 | |||
566 | switch (pState->block_type) { | ||
567 | |||
568 | case LZX_BLOCKTYPE_VERBATIM: | ||
569 | while (this_run > 0) { | ||
570 | READ_HUFFSYM(MAINTREE, main_element); | ||
571 | |||
572 | if (main_element < LZX_NUM_CHARS) { | ||
573 | /* literal: 0 to LZX_NUM_CHARS-1 */ | ||
574 | window[window_posn++] = main_element; | ||
575 | this_run--; | ||
576 | } | ||
577 | else { | ||
578 | /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ | ||
579 | main_element -= LZX_NUM_CHARS; | ||
580 | |||
581 | match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; | ||
582 | if (match_length == LZX_NUM_PRIMARY_LENGTHS) { | ||
583 | READ_HUFFSYM(LENGTH, length_footer); | ||
584 | match_length += length_footer; | ||
585 | } | ||
586 | match_length += LZX_MIN_MATCH; | ||
587 | |||
588 | match_offset = main_element >> 3; | ||
589 | |||
590 | if (match_offset > 2) { | ||
591 | /* not repeated offset */ | ||
592 | if (match_offset != 3) { | ||
593 | extra = extra_bits[match_offset]; | ||
594 | READ_BITS(verbatim_bits, extra); | ||
595 | match_offset = position_base[match_offset] - 2 + verbatim_bits; | ||
596 | } | ||
597 | else { | ||
598 | match_offset = 1; | ||
599 | } | ||
600 | |||
601 | /* update repeated offset LRU queue */ | ||
602 | R2 = R1; R1 = R0; R0 = match_offset; | ||
603 | } | ||
604 | else if (match_offset == 0) { | ||
605 | match_offset = R0; | ||
606 | } | ||
607 | else if (match_offset == 1) { | ||
608 | match_offset = R1; | ||
609 | R1 = R0; R0 = match_offset; | ||
610 | } | ||
611 | else /* match_offset == 2 */ { | ||
612 | match_offset = R2; | ||
613 | R2 = R0; R0 = match_offset; | ||
614 | } | ||
615 | |||
616 | rundest = window + window_posn; | ||
617 | runsrc = rundest - match_offset; | ||
618 | window_posn += match_length; | ||
619 | this_run -= match_length; | ||
620 | |||
621 | /* copy any wrapped around source data */ | ||
622 | while ((runsrc < window) && (match_length-- > 0)) { | ||
623 | *rundest++ = *(runsrc + window_size); runsrc++; | ||
624 | } | ||
625 | /* copy match data - no worries about destination wraps */ | ||
626 | while (match_length-- > 0) *rundest++ = *runsrc++; | ||
627 | |||
628 | } | ||
629 | } | ||
630 | break; | ||
631 | |||
632 | case LZX_BLOCKTYPE_ALIGNED: | ||
633 | while (this_run > 0) { | ||
634 | READ_HUFFSYM(MAINTREE, main_element); | ||
635 | |||
636 | if (main_element < LZX_NUM_CHARS) { | ||
637 | /* literal: 0 to LZX_NUM_CHARS-1 */ | ||
638 | window[window_posn++] = main_element; | ||
639 | this_run--; | ||
640 | } | ||
641 | else { | ||
642 | /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ | ||
643 | main_element -= LZX_NUM_CHARS; | ||
644 | |||
645 | match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; | ||
646 | if (match_length == LZX_NUM_PRIMARY_LENGTHS) { | ||
647 | READ_HUFFSYM(LENGTH, length_footer); | ||
648 | match_length += length_footer; | ||
649 | } | ||
650 | match_length += LZX_MIN_MATCH; | ||
651 | |||
652 | match_offset = main_element >> 3; | ||
653 | |||
654 | if (match_offset > 2) { | ||
655 | /* not repeated offset */ | ||
656 | extra = extra_bits[match_offset]; | ||
657 | match_offset = position_base[match_offset] - 2; | ||
658 | if (extra > 3) { | ||
659 | /* verbatim and aligned bits */ | ||
660 | extra -= 3; | ||
661 | READ_BITS(verbatim_bits, extra); | ||
662 | match_offset += (verbatim_bits << 3); | ||
663 | READ_HUFFSYM(ALIGNED, aligned_bits); | ||
664 | match_offset += aligned_bits; | ||
665 | } | ||
666 | else if (extra == 3) { | ||
667 | /* aligned bits only */ | ||
668 | READ_HUFFSYM(ALIGNED, aligned_bits); | ||
669 | match_offset += aligned_bits; | ||
670 | } | ||
671 | else if (extra > 0) { /* extra==1, extra==2 */ | ||
672 | /* verbatim bits only */ | ||
673 | READ_BITS(verbatim_bits, extra); | ||
674 | match_offset += verbatim_bits; | ||
675 | } | ||
676 | else /* extra == 0 */ { | ||
677 | /* ??? */ | ||
678 | match_offset = 1; | ||
679 | } | ||
680 | |||
681 | /* update repeated offset LRU queue */ | ||
682 | R2 = R1; R1 = R0; R0 = match_offset; | ||
683 | } | ||
684 | else if (match_offset == 0) { | ||
685 | match_offset = R0; | ||
686 | } | ||
687 | else if (match_offset == 1) { | ||
688 | match_offset = R1; | ||
689 | R1 = R0; R0 = match_offset; | ||
690 | } | ||
691 | else /* match_offset == 2 */ { | ||
692 | match_offset = R2; | ||
693 | R2 = R0; R0 = match_offset; | ||
694 | } | ||
695 | |||
696 | rundest = window + window_posn; | ||
697 | runsrc = rundest - match_offset; | ||
698 | window_posn += match_length; | ||
699 | this_run -= match_length; | ||
700 | |||
701 | /* copy any wrapped around source data */ | ||
702 | while ((runsrc < window) && (match_length-- > 0)) { | ||
703 | *rundest++ = *(runsrc + window_size); runsrc++; | ||
704 | } | ||
705 | /* copy match data - no worries about destination wraps */ | ||
706 | while (match_length-- > 0) *rundest++ = *runsrc++; | ||
707 | |||
708 | } | ||
709 | } | ||
710 | break; | ||
711 | |||
712 | case LZX_BLOCKTYPE_UNCOMPRESSED: | ||
713 | if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA; | ||
714 | memcpy(window + window_posn, inpos, (size_t) this_run); | ||
715 | inpos += this_run; window_posn += this_run; | ||
716 | break; | ||
717 | |||
718 | default: | ||
719 | return DECR_ILLEGALDATA; /* might as well */ | ||
720 | } | ||
721 | |||
722 | } | ||
723 | } | ||
724 | |||
725 | if (togo != 0) return DECR_ILLEGALDATA; | ||
726 | memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) - outlen, (size_t) outlen); | ||
727 | |||
728 | pState->window_posn = window_posn; | ||
729 | pState->R0 = R0; | ||
730 | pState->R1 = R1; | ||
731 | pState->R2 = R2; | ||
732 | |||
733 | /* intel E8 decoding */ | ||
734 | if ((pState->frames_read++ < 32768) && pState->intel_filesize != 0) { | ||
735 | if (outlen <= 6 || !pState->intel_started) { | ||
736 | pState->intel_curpos += outlen; | ||
737 | } | ||
738 | else { | ||
739 | UBYTE *data = outpos; | ||
740 | UBYTE *dataend = data + outlen - 10; | ||
741 | LONG curpos = pState->intel_curpos; | ||
742 | LONG filesize = pState->intel_filesize; | ||
743 | LONG abs_off, rel_off; | ||
744 | |||
745 | pState->intel_curpos = curpos + outlen; | ||
746 | |||
747 | while (data < dataend) { | ||
748 | if (*data++ != 0xE8) { curpos++; continue; } | ||
749 | abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24); | ||
750 | if ((abs_off >= -curpos) && (abs_off < filesize)) { | ||
751 | rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize; | ||
752 | data[0] = (UBYTE) rel_off; | ||
753 | data[1] = (UBYTE) (rel_off >> 8); | ||
754 | data[2] = (UBYTE) (rel_off >> 16); | ||
755 | data[3] = (UBYTE) (rel_off >> 24); | ||
756 | } | ||
757 | data += 4; | ||
758 | curpos += 5; | ||
759 | } | ||
760 | } | ||
761 | } | ||
762 | return DECR_OK; | ||
763 | } | ||
764 | |||
765 | #ifdef LZX_CHM_TESTDRIVER | ||
766 | int main(int c, char **v) | ||
767 | { | ||
768 | FILE *fin, *fout; | ||
769 | struct LZXstate state; | ||
770 | UBYTE ibuf[16384]; | ||
771 | UBYTE obuf[32768]; | ||
772 | int ilen, olen; | ||
773 | int status; | ||
774 | int i; | ||
775 | int count=0; | ||
776 | int w = atoi(v[1]); | ||
777 | LZXinit(&state, w); | ||
778 | fout = fopen(v[2], "wb"); | ||
779 | for (i=3; i<c; i++) | ||
780 | { | ||
781 | fin = fopen(v[i], "rb"); | ||
782 | ilen = fread(ibuf, 1, 16384, fin); | ||
783 | status = LZXdecompress(&state, ibuf, obuf, ilen, 32768); | ||
784 | switch (status) | ||
785 | { | ||
786 | case DECR_OK: | ||
787 | printf("ok\n"); | ||
788 | fwrite(obuf, 1, 32768, fout); | ||
789 | break; | ||
790 | case DECR_DATAFORMAT: | ||
791 | printf("bad format\n"); | ||
792 | break; | ||
793 | case DECR_ILLEGALDATA: | ||
794 | printf("illegal data\n"); | ||
795 | break; | ||
796 | case DECR_NOMEMORY: | ||
797 | printf("no memory\n"); | ||
798 | break; | ||
799 | default: | ||
800 | break; | ||
801 | } | ||
802 | fclose(fin); | ||
803 | if (++count == 2) | ||
804 | { | ||
805 | count = 0; | ||
806 | LZXreset(&state); | ||
807 | } | ||
808 | } | ||
809 | fclose(fout); | ||
810 | } | ||
811 | #endif | ||
diff --git a/noncore/apps/opie-reader/lzx.h b/noncore/apps/opie-reader/lzx.h new file mode 100644 index 0000000..4a3dd42 --- a/dev/null +++ b/noncore/apps/opie-reader/lzx.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* $Id$ */ | ||
2 | /*************************************************************************** | ||
3 | * lzx.h - LZX decompression routines * | ||
4 | * ------------------- * | ||
5 | * * | ||
6 | * maintainer: Jed Wing <jedwin@ugcs.caltech.edu> * | ||
7 | * source: modified lzx.c from cabextract v0.5 * | ||
8 | * notes: This file was taken from cabextract v0.5, which was, * | ||
9 | * itself, a modified version of the lzx decompression code * | ||
10 | * from unlzx. * | ||
11 | ***************************************************************************/ | ||
12 | |||
13 | /*************************************************************************** | ||
14 | * * | ||
15 | * This program is free software; you can redistribute it and/or modify * | ||
16 | * it under the terms of the GNU General Public License as published by * | ||
17 | * the Free Software Foundation; either version 2 of the License, or * | ||
18 | * (at your option) any later version. Note that an exemption to this * | ||
19 | * license has been granted by Stuart Caie for the purposes of * | ||
20 | * distribution with chmlib. This does not, to the best of my * | ||
21 | * knowledge, constitute a change in the license of this (the LZX) code * | ||
22 | * in general. * | ||
23 | * * | ||
24 | ***************************************************************************/ | ||
25 | |||
26 | #ifndef INCLUDED_LZX_H | ||
27 | #define INCLUDED_LZX_H | ||
28 | |||
29 | #ifdef __cplusplus | ||
30 | extern "C" { | ||
31 | #endif | ||
32 | |||
33 | /* return codes */ | ||
34 | #define DECR_OK (0) | ||
35 | #define DECR_DATAFORMAT (1) | ||
36 | #define DECR_ILLEGALDATA (2) | ||
37 | #define DECR_NOMEMORY (3) | ||
38 | |||
39 | /* opaque state structure */ | ||
40 | struct LZXstate; | ||
41 | |||
42 | /* create an lzx state object */ | ||
43 | struct LZXstate *LZXinit(int window); | ||
44 | |||
45 | /* destroy an lzx state object */ | ||
46 | void LZXteardown(struct LZXstate *pState); | ||
47 | |||
48 | /* reset an lzx stream */ | ||
49 | int LZXreset(struct LZXstate *pState); | ||
50 | |||
51 | /* decompress an LZX compressed block */ | ||
52 | int LZXdecompress(struct LZXstate *pState, | ||
53 | unsigned char *inpos, | ||
54 | unsigned char *outpos, | ||
55 | int inlen, | ||
56 | int outlen); | ||
57 | |||
58 | #ifdef __cplusplus | ||
59 | } | ||
60 | #endif | ||
61 | |||
62 | #endif /* INCLUDED_LZX_H */ | ||
diff --git a/noncore/apps/opie-reader/main.cpp b/noncore/apps/opie-reader/main.cpp index 6d706c4..3e1f5e7 100644 --- a/noncore/apps/opie-reader/main.cpp +++ b/noncore/apps/opie-reader/main.cpp | |||
@@ -6,8 +6,10 @@ | |||
6 | #endif | 6 | #endif |
7 | #include "QTReaderApp.h" | 7 | #include "QTReaderApp.h" |
8 | 8 | ||
9 | #include "signal.h" | 9 | #include "signal.h" |
10 | #include "stdio.h" | ||
11 | #include "time.h" | ||
10 | 12 | ||
11 | 13 | ||
12 | #ifdef USEQPE | 14 | #ifdef USEQPE |
13 | QTReaderApp* app = NULL; | 15 | QTReaderApp* app = NULL; |
diff --git a/noncore/apps/opie-reader/my_list.h b/noncore/apps/opie-reader/my_list.h index f180d3d..52e6472 100644 --- a/noncore/apps/opie-reader/my_list.h +++ b/noncore/apps/opie-reader/my_list.h | |||
@@ -1,7 +1,11 @@ | |||
1 | #ifndef __MY_LIST_H | 1 | #ifndef __MY_LIST_H |
2 | #define __MY_LIST_H | 2 | #define __MY_LIST_H |
3 | 3 | ||
4 | #ifndef NULL | ||
5 | #define NULL 0 | ||
6 | #endif | ||
7 | |||
4 | template<class T> | 8 | template<class T> |
5 | class CList | 9 | class CList |
6 | { | 10 | { |
7 | struct node | 11 | struct node |
@@ -29,8 +33,16 @@ class CList | |||
29 | } | 33 | } |
30 | } | 34 | } |
31 | T& first() { return front->data; } | 35 | T& first() { return front->data; } |
32 | T& last() { return back->data; } | 36 | T& last() { return back->data; } |
37 | T pop() | ||
38 | { | ||
39 | T data = front->data; | ||
40 | node* n = front; | ||
41 | front = front->next; | ||
42 | delete n; | ||
43 | return data; | ||
44 | } | ||
33 | T* operator[](int n) | 45 | T* operator[](int n) |
34 | { | 46 | { |
35 | node* current = front; | 47 | node* current = front; |
36 | while (n-- > 0) | 48 | while (n-- > 0) |
diff --git a/noncore/apps/opie-reader/name.h b/noncore/apps/opie-reader/name.h deleted file mode 100644 index d419005..0000000 --- a/noncore/apps/opie-reader/name.h +++ b/dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #ifndef __NAME_H | ||
2 | #define __NAME_H | ||
3 | |||
4 | #define PROGNAME "Opie-Reader" | ||
5 | #define SHORTPROGNAME "Reader" | ||
6 | #define APPDIR "uqtreader" | ||
7 | |||
8 | #endif | ||
diff --git a/noncore/apps/opie-reader/opie-reader.control b/noncore/apps/opie-reader/opie-reader.control index a79566e..60976b2 100644 --- a/noncore/apps/opie-reader/opie-reader.control +++ b/noncore/apps/opie-reader/opie-reader.control | |||
@@ -1,6 +1,6 @@ | |||
1 | Package: opie-reader | 1 | Package: opie-reader |
2 | Files: bin/reader bin/reader apps/Applications/opie-reader.desktop pics/opie-reader/* | 2 | Files: bin/reader lib/libreader* plugins/reader/* apps/Applications/opie-reader.desktop pics/opie-reader/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Tim Wentford <timwentford@hotmail.com> | 5 | Maintainer: Tim Wentford <timwentford@hotmail.com> |
6 | Architecture: arm | 6 | Architecture: arm |
diff --git a/noncore/apps/opie-reader/opie-reader.pro b/noncore/apps/opie-reader/opie-reader.pro index db3e37e..bf8e8f2 100644 --- a/noncore/apps/opie-reader/opie-reader.pro +++ b/noncore/apps/opie-reader/opie-reader.pro | |||
@@ -1,92 +1,16 @@ | |||
1 | CONFIG = qt warn_on | 1 | TEMPLATE = subdirs |
2 | HEADERS = Aportis.h \ | 2 | SUBDIRS = pluckerbaselib \ |
3 | Bkmks.h \ | 3 | codeclib \ |
4 | BuffDoc.h \ | 4 | PluckerCodec \ |
5 | CAnnoEdit.h \ | 5 | AportisCodec \ |
6 | CBuffer.h \ | 6 | CHM \ |
7 | CDrawBuffer.h \ | 7 | HTMLFilter \ |
8 | CEncoding.h \ | 8 | WeaselCodec \ |
9 | CEncoding_tables.h \ | 9 | iSiloCodec \ |
10 | CExpander.h \ | 10 | pdblib \ |
11 | CFilter.h \ | 11 | ppmsCodec \ |
12 | CloseDialog.h \ | 12 | reader |
13 | Filedata.h \ | ||
14 | FixedFont.h \ | ||
15 | FontControl.h \ | ||
16 | GraphicWin.h \ | ||
17 | Markups.h \ | ||
18 | Navigation.h \ | ||
19 | Palm2QImage.h \ | ||
20 | Prefs.h \ | ||
21 | QFloatBar.h \ | ||
22 | QTReader.h \ | ||
23 | QTReaderApp.h \ | ||
24 | QtrListView.h \ | ||
25 | Queue.h \ | ||
26 | StateData.h \ | ||
27 | StyleConsts.h \ | ||
28 | ToolbarPrefs.h \ | ||
29 | URLDialog.h \ | ||
30 | ZText.h \ | ||
31 | arith.h \ | ||
32 | cbkmkselector.h \ | ||
33 | config.h \ | ||
34 | fileBrowser.h \ | ||
35 | infowin.h \ | ||
36 | linktype.h \ | ||
37 | my_list.h \ | ||
38 | names.h \ | ||
39 | opie.h \ | ||
40 | pdb.h \ | ||
41 | plucker_base.h \ | ||
42 | plucker.h \ | ||
43 | ppm.h \ | ||
44 | ppm_expander.h \ | ||
45 | usenef.h \ | ||
46 | useqpe.h \ | ||
47 | ustring.h \ | ||
48 | utypes.h \ | ||
49 | version.h \ | ||
50 | ztxt.h | ||
51 | |||
52 | SOURCES = Aportis.cpp \ | ||
53 | Bkmks.cpp \ | ||
54 | BuffDoc.cpp \ | ||
55 | CBuffer.cpp \ | ||
56 | CDrawBuffer.cpp \ | ||
57 | CEncoding.cpp \ | ||
58 | CEncoding_tables.cpp \ | ||
59 | CFilter.cpp \ | ||
60 | CloseDialog.cpp \ | ||
61 | FontControl.cpp \ | ||
62 | Navigation.cpp \ | ||
63 | Palm2QImage.cpp \ | ||
64 | Prefs.cpp \ | ||
65 | QTReader.cpp \ | ||
66 | QTReaderApp.cpp \ | ||
67 | QtrListView.cpp \ | ||
68 | StyleConsts.cpp \ | ||
69 | ToolbarPrefs.cpp \ | ||
70 | URLDialog.cpp \ | ||
71 | arith_d.cpp \ | ||
72 | fileBrowser.cpp \ | ||
73 | infowin.cpp \ | ||
74 | main.cpp \ | ||
75 | pdb.cpp \ | ||
76 | plucker.cpp \ | ||
77 | plucker_base.cpp \ | ||
78 | ppm.cpp \ | ||
79 | ppm_expander.cpp \ | ||
80 | version.cpp \ | ||
81 | ztxt.cpp | ||
82 | |||
83 | DESTDIR = $(OPIEDIR)/bin | ||
84 | TARGET = opie-reader | ||
85 | |||
86 | INCLUDEPATH += $(OPIEDIR)/include | ||
87 | DEPENDPATH += $(OPIEDIR)/include | ||
88 | LIBS += -lqpe -lopiecore2 | ||
89 | 13 | ||
90 | include ( $(OPIEDIR)/include.pro ) | 14 | include ( $(OPIEDIR)/include.pro ) |
91 | 15 | ||
92 | 16 | ||
diff --git a/noncore/apps/opie-reader/opie.h b/noncore/apps/opie-reader/opie.h deleted file mode 100644 index e28c2ab..0000000 --- a/noncore/apps/opie-reader/opie.h +++ b/dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __OPIE_H | ||
2 | #define __OPIE_H | ||
3 | |||
4 | #define OPIE | ||
5 | |||
6 | #endif | ||
diff --git a/noncore/apps/opie-reader/orkey.cpp b/noncore/apps/opie-reader/orkey.cpp new file mode 100644 index 0000000..be8fed2 --- a/dev/null +++ b/noncore/apps/opie-reader/orkey.cpp | |||
@@ -0,0 +1,134 @@ | |||
1 | #include <qstring.h> | ||
2 | #include <qnamespace.h> | ||
3 | #include "orkey.h" | ||
4 | |||
5 | QString orKey::text() const | ||
6 | { | ||
7 | QString ks; | ||
8 | if ((m_st & Qt::ControlButton) != 0) | ||
9 | { | ||
10 | ks += "ctrl_"; | ||
11 | } | ||
12 | if ((m_st & Qt::AltButton) != 0) | ||
13 | { | ||
14 | ks += "alt_"; | ||
15 | } | ||
16 | if ((m_st & Qt::ShiftButton) != 0) | ||
17 | { | ||
18 | ks += "shift_"; | ||
19 | } | ||
20 | /* | ||
21 | if (m_st & meta_flag != 0) | ||
22 | { | ||
23 | ks += "meta_"; | ||
24 | } | ||
25 | if (m_st & capslock_flag != 0) | ||
26 | { | ||
27 | ks += "capslock_"; | ||
28 | } | ||
29 | if (m_st & scrolllock_flag != 0) | ||
30 | { | ||
31 | ks += "scrolllock_"; | ||
32 | } | ||
33 | */ | ||
34 | if (m_ky == 0x20) | ||
35 | { | ||
36 | ks += "' '"; | ||
37 | } | ||
38 | else if (0x21 <= m_ky && m_ky <= 0xff) | ||
39 | { | ||
40 | char st[2]; | ||
41 | st[0] = m_ky; | ||
42 | st[1] = 0; | ||
43 | ks += st; | ||
44 | } | ||
45 | else if (0x1030 <= m_ky && m_ky <= 0x1052) | ||
46 | { | ||
47 | ks += QString("f") + QChar(m_ky - 0x1030 + 1); | ||
48 | } | ||
49 | else | ||
50 | { | ||
51 | switch (m_ky) | ||
52 | { | ||
53 | case Qt::Key_Escape: | ||
54 | ks += "esc"; | ||
55 | break; | ||
56 | case Qt::Key_Tab: | ||
57 | ks += "Tab"; | ||
58 | break; | ||
59 | case Qt::Key_Backtab: | ||
60 | ks += "Backtab"; | ||
61 | break; | ||
62 | case Qt::Key_Backspace: | ||
63 | ks += "Backspace"; | ||
64 | break; | ||
65 | case Qt::Key_Return: | ||
66 | ks += "Return"; | ||
67 | break; | ||
68 | case Qt::Key_Enter: | ||
69 | ks += "Enter"; | ||
70 | break; | ||
71 | case Qt::Key_Insert: | ||
72 | ks += "Insert"; | ||
73 | break; | ||
74 | case Qt::Key_Delete: | ||
75 | ks += "Delete"; | ||
76 | break; | ||
77 | case Qt::Key_Pause: | ||
78 | ks += "Pause"; | ||
79 | break; | ||
80 | case Qt::Key_Print: | ||
81 | ks += "Print"; | ||
82 | break; | ||
83 | case Qt::Key_SysReq: | ||
84 | ks += "SysReq"; | ||
85 | break; | ||
86 | case Qt::Key_Home: | ||
87 | ks += "Home"; | ||
88 | break; | ||
89 | case Qt::Key_End: | ||
90 | ks += "End"; | ||
91 | break; | ||
92 | case Qt::Key_Left: | ||
93 | ks += "Left"; | ||
94 | break; | ||
95 | case Qt::Key_Up: | ||
96 | ks += "Up"; | ||
97 | break; | ||
98 | case Qt::Key_Right: | ||
99 | ks += "Right"; | ||
100 | break; | ||
101 | case Qt::Key_Down: | ||
102 | ks += "Down"; | ||
103 | break; | ||
104 | case Qt::Key_PageUp: | ||
105 | ks += "PageUp"; | ||
106 | break; | ||
107 | case Qt::Key_PageDown: | ||
108 | ks += "PageDown"; | ||
109 | break; | ||
110 | case Qt::Key_Super_L: | ||
111 | ks += "Super_L"; | ||
112 | break; | ||
113 | case Qt::Key_Super_R: | ||
114 | ks += "Super_R"; | ||
115 | break; | ||
116 | case Qt::Key_Menu: | ||
117 | ks += "Menu"; | ||
118 | break; | ||
119 | case Qt::Key_Hyper_L: | ||
120 | ks += "Hyper_L"; | ||
121 | break; | ||
122 | case Qt::Key_Hyper_R: | ||
123 | ks += "Hyper_R"; | ||
124 | break; | ||
125 | case Qt::Key_Help: | ||
126 | ks += "Help"; | ||
127 | break; | ||
128 | default: | ||
129 | ks += "???"; | ||
130 | break; | ||
131 | } | ||
132 | } | ||
133 | return ks; | ||
134 | } | ||
diff --git a/noncore/apps/opie-reader/orkey.h b/noncore/apps/opie-reader/orkey.h new file mode 100644 index 0000000..8258ef2 --- a/dev/null +++ b/noncore/apps/opie-reader/orkey.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef __ORKEY_H | ||
2 | #define __ORKEY_H | ||
3 | |||
4 | const uint KEYMAPVERSION = 0; | ||
5 | |||
6 | enum ActionTypes | ||
7 | { | ||
8 | cesOpenFile = 0, | ||
9 | cesAutoScroll, | ||
10 | cesActionMark, | ||
11 | cesActionAnno, | ||
12 | cesFullScreen, | ||
13 | cesZoomIn, | ||
14 | cesZoomOut, | ||
15 | cesBack, | ||
16 | cesForward, | ||
17 | cesHome, | ||
18 | cesPageUp, | ||
19 | cesPageDown, | ||
20 | cesLineUp, | ||
21 | cesLineDown, | ||
22 | cesStartDoc, | ||
23 | cesEndDoc, | ||
24 | cesRotate, | ||
25 | cesScrollMore, | ||
26 | cesScrollLess, | ||
27 | cesInvertColours, | ||
28 | cesToggleBars, | ||
29 | cesToggleScrollBar, | ||
30 | cesToggleStatusBar, | ||
31 | cesNextLink, | ||
32 | cesGotoLink | ||
33 | }; | ||
34 | |||
35 | class orKey | ||
36 | { | ||
37 | friend bool operator<(const orKey& lhs, const orKey& rhs); | ||
38 | Qt::ButtonState m_st; | ||
39 | int m_ky; | ||
40 | bool m_scroll; | ||
41 | public: | ||
42 | orKey(Qt::ButtonState _s = Qt::NoButton, int _k = 0, bool _sc = false) : m_st(_s), m_ky(_k), m_scroll(_sc) {} | ||
43 | QString text() const; | ||
44 | bool isScroll() const { return m_scroll; } | ||
45 | void toggleScroll() { m_scroll = !m_scroll; } | ||
46 | }; | ||
47 | |||
48 | inline bool operator<(const orKey& lhs, const orKey& rhs) | ||
49 | { | ||
50 | if (lhs.m_ky < rhs.m_ky) | ||
51 | { | ||
52 | return true; | ||
53 | } | ||
54 | if (lhs.m_ky > rhs.m_ky) | ||
55 | { | ||
56 | return false; | ||
57 | } | ||
58 | if (lhs.m_st < rhs.m_st) | ||
59 | { | ||
60 | return true; | ||
61 | } | ||
62 | if (lhs.m_st > rhs.m_st) | ||
63 | { | ||
64 | return false; | ||
65 | } | ||
66 | return (lhs.m_scroll < rhs.m_scroll); | ||
67 | } | ||
68 | #endif | ||
diff --git a/noncore/apps/opie-reader/pdb.cpp b/noncore/apps/opie-reader/pdb.cpp index dca67ff..39551cc 100644 --- a/noncore/apps/opie-reader/pdb.cpp +++ b/noncore/apps/opie-reader/pdb.cpp | |||
@@ -2,8 +2,32 @@ | |||
2 | #ifdef _WINDOWS | 2 | #ifdef _WINDOWS |
3 | #include <winsock2.h> | 3 | #include <winsock2.h> |
4 | #endif | 4 | #endif |
5 | 5 | ||
6 | #include "useqpe.h" | ||
7 | |||
8 | #ifdef USEQPE | ||
9 | void Cpdb::suspend() | ||
10 | { | ||
11 | CExpander::suspend(fin); | ||
12 | } | ||
13 | void Cpdb::unsuspend() | ||
14 | { | ||
15 | CExpander::unsuspend(fin); | ||
16 | } | ||
17 | #endif | ||
18 | |||
19 | Cpdb::~Cpdb() | ||
20 | { | ||
21 | if (fin != NULL) | ||
22 | { | ||
23 | #ifdef USEQPE | ||
24 | unsuspend(); | ||
25 | #endif | ||
26 | fclose(fin); | ||
27 | } | ||
28 | } | ||
29 | |||
6 | size_t Cpdb::recordpos(int n) | 30 | size_t Cpdb::recordpos(int n) |
7 | { | 31 | { |
8 | UInt16 mxn = ntohs(head.recordList.numRecords); | 32 | UInt16 mxn = ntohs(head.recordList.numRecords); |
9 | if (n >= mxn) | 33 | if (n >= mxn) |
@@ -31,13 +55,13 @@ void Cpdb::gotorecordnumber(int n) | |||
31 | { | 55 | { |
32 | fseek(fin, recordpos(n), SEEK_SET); | 56 | fseek(fin, recordpos(n), SEEK_SET); |
33 | } | 57 | } |
34 | 58 | ||
35 | bool Cpdb::openfile(const char *src) | 59 | bool Cpdb::openpdbfile(const char *src) |
36 | { | 60 | { |
61 | //qDebug("cpdb openfile:%s", src); | ||
37 | 62 | ||
38 | // printf("In openfile\n"); | 63 | // printf("In openfile\n"); |
39 | int ret = 0; | ||
40 | // printf("closing fin:%x\n",fin); | 64 | // printf("closing fin:%x\n",fin); |
41 | if (fin != NULL) fclose(fin); | 65 | if (fin != NULL) fclose(fin); |
42 | // printf("opening fin\n"); | 66 | // printf("opening fin\n"); |
43 | fin = fopen(src,"rb"); | 67 | fin = fopen(src,"rb"); |
@@ -48,13 +72,19 @@ bool Cpdb::openfile(const char *src) | |||
48 | } | 72 | } |
49 | 73 | ||
50 | // just holds the first few chars of the file | 74 | // just holds the first few chars of the file |
51 | //char buf[0x100]; | 75 | //char buf[0x100]; |
52 | fseek(fin,0,SEEK_END); | 76 | struct stat _stat; |
53 | file_length = ftell(fin); | 77 | stat(src,&_stat); |
78 | file_length = _stat.st_size; | ||
79 | // fseek(fin,0,SEEK_END); | ||
80 | // file_length = ftell(fin); | ||
54 | 81 | ||
55 | fseek(fin,0,SEEK_SET); | 82 | fseek(fin,0,SEEK_SET); |
56 | 83 | ||
57 | fread(&head, 1, sizeof(head), fin); | 84 | fread(&head, 1, sizeof(head), fin); |
58 | 85 | ||
86 | qDebug("Database name:%s", head.name); | ||
87 | qDebug("Total number of records:%u", ntohs(head.recordList.numRecords)); | ||
88 | |||
59 | return true; | 89 | return true; |
60 | } | 90 | } |
diff --git a/noncore/apps/opie-reader/pdb.h b/noncore/apps/opie-reader/pdb.h index eac3ae6..7a6580d 100644 --- a/noncore/apps/opie-reader/pdb.h +++ b/noncore/apps/opie-reader/pdb.h | |||
@@ -14,8 +14,10 @@ | |||
14 | #ifndef _WINDOWS | 14 | #ifndef _WINDOWS |
15 | #include <netinet/in.h> | 15 | #include <netinet/in.h> |
16 | #endif | 16 | #endif |
17 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | #include "useqpe.h" | ||
19 | #include "CExpander.h" | ||
18 | 20 | ||
19 | /* Normal Palm typedefs */ | 21 | /* Normal Palm typedefs */ |
20 | typedef unsigned char UInt8; | 22 | typedef unsigned char UInt8; |
21 | typedef unsigned short UInt16; | 23 | typedef unsigned short UInt16; |
@@ -75,19 +77,25 @@ typedef struct { | |||
75 | RecordListType recordList; // first record list | 77 | RecordListType recordList; // first record list |
76 | } DatabaseHdrType; | 78 | } DatabaseHdrType; |
77 | 79 | ||
78 | 80 | ||
79 | class Cpdb | 81 | class Cpdb : public CExpander |
80 | { | 82 | { |
81 | protected: | 83 | protected: |
82 | size_t file_length; | 84 | size_t file_length; |
83 | FILE* fin; | 85 | FILE* fin; |
84 | size_t recordpos(int); | 86 | size_t recordpos(int); |
85 | size_t recordlength(int); | 87 | size_t recordlength(int); |
86 | void gotorecordnumber(int); | 88 | void gotorecordnumber(int); |
87 | DatabaseHdrType head; | 89 | DatabaseHdrType head; |
88 | bool openfile(const char* src); | 90 | bool openpdbfile(const char* src); |
89 | Cpdb() : fin(NULL) {} | 91 | Cpdb() : fin(NULL) {} |
90 | ~Cpdb() { if (fin != NULL) fclose(fin); } | 92 | ~Cpdb(); |
93 | #ifdef USEQPE | ||
94 | void suspend(); | ||
95 | void unsuspend(); | ||
96 | #endif | ||
97 | public: | ||
98 | virtual void sizes(unsigned long& _file, unsigned long& _text) = 0; | ||
91 | }; | 99 | }; |
92 | #endif | 100 | #endif |
93 | 101 | ||
diff --git a/noncore/apps/opie-reader/pdblib.mak b/noncore/apps/opie-reader/pdblib.mak new file mode 100644 index 0000000..8174309 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib.mak | |||
@@ -0,0 +1,161 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libreader_pdb.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:39:56 2004 | ||
4 | # Project: pdblib.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o pdblib.mak pdblib.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libreader_pdb.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = pdb.h | ||
47 | SOURCES = pdb.cpp | ||
48 | OBJECTS = QREADEROBJS/pdb.o | ||
49 | FORMS = | ||
50 | UICDECLS = | ||
51 | UICIMPLS = | ||
52 | SRCMOC = | ||
53 | OBJMOC = | ||
54 | DIST = pdblib.pro | ||
55 | QMAKE_TARGET = reader_pdb | ||
56 | DESTDIR = $(READERDIR)/lib/ | ||
57 | TARGET = libreader_pdb.so.1.0.0 | ||
58 | TARGETA= $(READERDIR)/lib/libreader_pdb.a | ||
59 | TARGETD= libreader_pdb.so.1.0.0 | ||
60 | TARGET0= libreader_pdb.so | ||
61 | TARGET1= libreader_pdb.so.1 | ||
62 | TARGET2= libreader_pdb.so.1.0 | ||
63 | |||
64 | first: all | ||
65 | ####### Implicit rules | ||
66 | |||
67 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
68 | |||
69 | .cpp.o: | ||
70 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
71 | |||
72 | .cc.o: | ||
73 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
74 | |||
75 | .cxx.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .C.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .c.o: | ||
82 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | ####### Build rules | ||
85 | |||
86 | all: pdblib.mak $(READERDIR)/lib/$(TARGET) | ||
87 | |||
88 | $(READERDIR)/lib/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
89 | test -d $(READERDIR)/lib/ || mkdir -p $(READERDIR)/lib/ | ||
90 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
91 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
92 | -ln -s $(TARGET) $(TARGET0) | ||
93 | -ln -s $(TARGET) $(TARGET1) | ||
94 | -ln -s $(TARGET) $(TARGET2) | ||
95 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) | ||
96 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) | ||
97 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET1) | ||
98 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET2) | ||
99 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/lib/ | ||
100 | |||
101 | |||
102 | |||
103 | staticlib: $(TARGETA) | ||
104 | |||
105 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
106 | -$(DEL_FILE) $(TARGETA) | ||
107 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
108 | |||
109 | mocables: $(SRCMOC) | ||
110 | uicables: $(UICDECLS) $(UICIMPLS) | ||
111 | |||
112 | $(MOC): | ||
113 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
114 | |||
115 | pdblib.mak: pdblib.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
116 | $(QMAKE) -o pdblib.mak pdblib.pro | ||
117 | qmake: | ||
118 | @$(QMAKE) -o pdblib.mak pdblib.pro | ||
119 | |||
120 | dist: | ||
121 | @mkdir -p QREADEROBJS/reader_pdb && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/reader_pdb/ && ( cd `dirname QREADEROBJS/reader_pdb` && $(TAR) reader_pdb.tar reader_pdb && $(GZIP) reader_pdb.tar ) && $(MOVE) `dirname QREADEROBJS/reader_pdb`/reader_pdb.tar.gz . && $(DEL_FILE) -r QREADEROBJS/reader_pdb | ||
122 | |||
123 | mocclean: | ||
124 | |||
125 | uiclean: | ||
126 | |||
127 | yaccclean: | ||
128 | lexclean: | ||
129 | clean: | ||
130 | -$(DEL_FILE) $(OBJECTS) | ||
131 | -$(DEL_FILE) *~ core *.core | ||
132 | |||
133 | |||
134 | ####### Sub-libraries | ||
135 | |||
136 | distclean: clean | ||
137 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) $(TARGET) | ||
138 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) $(READERDIR)/lib/$(TARGET1) $(READERDIR)/lib/$(TARGET2) $(TARGETA) | ||
139 | |||
140 | |||
141 | FORCE: | ||
142 | |||
143 | ####### Compile | ||
144 | |||
145 | QREADEROBJS/pdb.o: pdb.cpp pdb.h \ | ||
146 | QREADERINC/useqpe.h \ | ||
147 | CExpander.h \ | ||
148 | config.h \ | ||
149 | StyleConsts.h \ | ||
150 | Markups.h \ | ||
151 | names.h \ | ||
152 | linktype.h \ | ||
153 | ustring.h | ||
154 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/pdb.o pdb.cpp | ||
155 | |||
156 | ####### Install | ||
157 | |||
158 | install: all | ||
159 | |||
160 | uninstall: | ||
161 | |||
diff --git a/noncore/apps/opie-reader/pdblib.omak b/noncore/apps/opie-reader/pdblib.omak new file mode 100644 index 0000000..b3a67c7 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib.omak | |||
@@ -0,0 +1,122 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_pdb.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: pdblib.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_pdb.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =pdb.cpp | ||
30 | OBJECTS =OREADEROBJS/pdb.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libreader_pdb.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/lib/libreader_pdb.a | ||
39 | TARGETD =libreader_pdb.so.1.0.0 | ||
40 | TARGET0 =libreader_pdb.so | ||
41 | TARGET1 =libreader_pdb.so.1 | ||
42 | TARGET2 =libreader_pdb.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/lib/libreader_pdb.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/lib/libreader_pdb.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
76 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: pdblib.omak | ||
90 | |||
91 | pdblib.omak: pdblib.opro | ||
92 | tmake pdblib.opro -o pdblib.omak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) pdblib.opro.tar pdblib.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) pdblib.opro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | OREADEROBJS/pdb.o: pdb.cpp \ | ||
112 | pdb.h \ | ||
113 | OREADERINC/useqpe.h \ | ||
114 | CExpander.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h | ||
121 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/pdb.o pdb.cpp | ||
122 | |||
diff --git a/noncore/apps/opie-reader/pdblib.wmak b/noncore/apps/opie-reader/pdblib.wmak new file mode 100644 index 0000000..f06f05ad --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib.wmak | |||
@@ -0,0 +1,122 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_pdb.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: pdblib.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_pdb.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =pdb.cpp | ||
30 | OBJECTS =WSREADEROBJS/pdb.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libreader_pdb.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/lib/libreader_pdb.a | ||
39 | TARGETD =libreader_pdb.so.1.0.0 | ||
40 | TARGET0 =libreader_pdb.so | ||
41 | TARGET1 =libreader_pdb.so.1 | ||
42 | TARGET2 =libreader_pdb.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/lib/libreader_pdb.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/lib/libreader_pdb.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
76 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: pdblib.wmak | ||
90 | |||
91 | pdblib.wmak: pdblib.wpro | ||
92 | tmake pdblib.wpro -o pdblib.wmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) pdblib.wpro.tar pdblib.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) pdblib.wpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | WSREADEROBJS/pdb.o: pdb.cpp \ | ||
112 | pdb.h \ | ||
113 | WSREADERINC/useqpe.h \ | ||
114 | CExpander.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h | ||
121 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/pdb.o pdb.cpp | ||
122 | |||
diff --git a/noncore/apps/opie-reader/pdblib.wpro b/noncore/apps/opie-reader/pdblib.wpro new file mode 100644 index 0000000..d78cc29 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib.wpro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = pdb.h | ||
4 | |||
5 | SOURCES = pdb.cpp | ||
6 | |||
7 | INTERFACES= | ||
8 | DESTDIR = $(QTDIR)/lib | ||
9 | TARGET = reader_pdb | ||
10 | |||
11 | OBJECTS_DIR = WSREADEROBJS | ||
12 | MOC_DIR = WSREADERMOCS | ||
13 | INCLUDEPATH+= WSREADERINC | ||
14 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/pdblib.zmak b/noncore/apps/opie-reader/pdblib.zmak new file mode 100644 index 0000000..2ee26d4 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib.zmak | |||
@@ -0,0 +1,122 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_pdb.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: pdblib.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_pdb.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =pdb.cpp | ||
30 | OBJECTS =ZREADEROBJS/pdb.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libreader_pdb.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/lib/libreader_pdb.a | ||
39 | TARGETD =libreader_pdb.so.1.0.0 | ||
40 | TARGET0 =libreader_pdb.so | ||
41 | TARGET1 =libreader_pdb.so.1 | ||
42 | TARGET2 =libreader_pdb.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/lib/libreader_pdb.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/lib/libreader_pdb.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
76 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: pdblib.zmak | ||
90 | |||
91 | pdblib.zmak: pdblib.zpro | ||
92 | tmake pdblib.zpro -o pdblib.zmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) pdblib.zpro.tar pdblib.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) pdblib.zpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | ZREADEROBJS/pdb.o: pdb.cpp \ | ||
112 | pdb.h \ | ||
113 | ZREADERINC/useqpe.h \ | ||
114 | CExpander.h \ | ||
115 | config.h \ | ||
116 | ustring.h \ | ||
117 | StyleConsts.h \ | ||
118 | Markups.h \ | ||
119 | names.h \ | ||
120 | linktype.h | ||
121 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/pdb.o pdb.cpp | ||
122 | |||
diff --git a/noncore/apps/opie-reader/pdblib.zpro b/noncore/apps/opie-reader/pdblib.zpro new file mode 100644 index 0000000..94d3910 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib.zpro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = pdb.h | ||
4 | |||
5 | SOURCES = pdb.cpp | ||
6 | |||
7 | INTERFACES= | ||
8 | DESTDIR = $(QTDIR)/lib | ||
9 | TARGET = reader_pdb | ||
10 | |||
11 | OBJECTS_DIR = ZREADEROBJS | ||
12 | MOC_DIR = ZREADERMOCS | ||
13 | INCLUDEPATH+= ZREADERINC | ||
14 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/pdblib/.cvsignore b/noncore/apps/opie-reader/pdblib/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/pdblib/pdblib.pro b/noncore/apps/opie-reader/pdblib/pdblib.pro new file mode 100644 index 0000000..cb861a8 --- a/dev/null +++ b/noncore/apps/opie-reader/pdblib/pdblib.pro | |||
@@ -0,0 +1,16 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = pdb.h | ||
6 | |||
7 | SOURCES = pdb.cpp | ||
8 | |||
9 | INTERFACES= | ||
10 | DESTDIR = $(OPIEDIR)/lib | ||
11 | TARGET = reader_pdb | ||
12 | |||
13 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
14 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
15 | |||
16 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/plucker.cpp b/noncore/apps/opie-reader/plucker.cpp index a8e688f..d1ccd6f 100644 --- a/noncore/apps/opie-reader/plucker.cpp +++ b/noncore/apps/opie-reader/plucker.cpp | |||
@@ -1,6 +1,9 @@ | |||
1 | #include "useqpe.h" | ||
1 | #include <stdio.h> | 2 | #include <stdio.h> |
2 | #include <string.h> | 3 | #include <string.h> |
4 | #include <qmessagebox.h> | ||
5 | #include <qpixmap.h> | ||
3 | #ifdef USEQPE | 6 | #ifdef USEQPE |
4 | #include <qpe/qcopenvelope_qws.h> | 7 | #include <qpe/qcopenvelope_qws.h> |
5 | #endif | 8 | #endif |
6 | #ifdef LOCALPICTURES | 9 | #ifdef LOCALPICTURES |
@@ -11,11 +14,14 @@ | |||
11 | #include <qpe/qpeapplication.h> | 14 | #include <qpe/qpeapplication.h> |
12 | #else | 15 | #else |
13 | #include <qapplication.h> | 16 | #include <qapplication.h> |
14 | #endif | 17 | #endif |
18 | #include <qclipboard.h> | ||
15 | 19 | ||
16 | #include "plucker.h" | 20 | #include "plucker.h" |
21 | #include "Aportis.h" | ||
17 | #include "Palm2QImage.h" | 22 | #include "Palm2QImage.h" |
23 | #include "static.h" | ||
18 | 24 | ||
19 | 25 | ||
20 | struct CPlucker_dataRecord | 26 | struct CPlucker_dataRecord |
21 | { | 27 | { |
@@ -42,9 +48,11 @@ void CPlucker::GetHeader(UInt16& uid, UInt16& nParagraphs, UInt32& size, UInt8& | |||
42 | reserved = thishdr.reserved; | 48 | reserved = thishdr.reserved; |
43 | } | 49 | } |
44 | 50 | ||
45 | CPlucker::CPlucker() | 51 | CPlucker::CPlucker() |
46 | { /*printf("constructing:%x\n",fin);*/ } | 52 | { /*printf("constructing:%x\n",fin);*/ |
53 | EOPPhase = 0; | ||
54 | } | ||
47 | 55 | ||
48 | bool CPlucker::CorrectDecoder() | 56 | bool CPlucker::CorrectDecoder() |
49 | { | 57 | { |
50 | return (memcmp(&head.type, "DataPlkr", 8) == 0); | 58 | return (memcmp(&head.type, "DataPlkr", 8) == 0); |
@@ -54,33 +62,41 @@ int CPlucker::bgetch() | |||
54 | { | 62 | { |
55 | int ch = EOF; | 63 | int ch = EOF; |
56 | if (bufferpos >= buffercontent) | 64 | if (bufferpos >= buffercontent) |
57 | { | 65 | { |
58 | if (!m_continuous) return EOF; | 66 | if (isEndOfSection(bufferrec)) |
59 | if (bufferrec >= ntohs(head.recordList.numRecords) - 1) return EOF; | 67 | { |
60 | ////odebug << "Passing through " << currentpos << "" << oendl; | 68 | if (!m_continuous) return EOF; |
61 | if (!expand(bufferrec+1)) return EOF; | 69 | } |
70 | if (bufferrec >= ntohs(head.recordList.numRecords) - 1) | ||
71 | { | ||
72 | return EOF; | ||
73 | } | ||
74 | if (!expand(bufferrec+1)) | ||
75 | { | ||
76 | return EOF; | ||
77 | } | ||
62 | mystyle.unset(); | 78 | mystyle.unset(); |
63 | if (m_ParaOffsets[m_nextParaIndex] == 0) | 79 | if (m_ParaOffsets[m_nextParaIndex] == 0) |
64 | { | 80 | { |
65 | while (m_ParaOffsets[m_nextParaIndex+1] == 0) | 81 | while (m_ParaOffsets[m_nextParaIndex+1] == 0) |
66 | { | 82 | { |
67 | // odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 83 | // qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
68 | m_nextParaIndex++; | 84 | m_nextParaIndex++; |
69 | } | 85 | } |
70 | } | 86 | } |
71 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); | 87 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); |
72 | //odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 88 | //qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
73 | ch = 10; | 89 | ch = 10; |
74 | EOPPhase = 4; | 90 | if (m_continuous) EOPPhase = 4; |
75 | } | 91 | } |
76 | else if (bufferpos == m_nextPara) | 92 | else if (bufferpos == m_nextPara) |
77 | { | 93 | { |
78 | while (bufferpos == m_nextPara) | 94 | while (bufferpos == m_nextPara) |
79 | { | 95 | { |
80 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 96 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
81 | m_nextParaIndex++; | 97 | m_nextParaIndex++; |
82 | // odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 98 | // qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
83 | if (m_nextParaIndex == m_nParas) | 99 | if (m_nextParaIndex == m_nParas) |
84 | { | 100 | { |
85 | m_nextPara = -1; | 101 | m_nextPara = -1; |
86 | } | 102 | } |
@@ -90,9 +106,9 @@ int CPlucker::bgetch() | |||
90 | } | 106 | } |
91 | } | 107 | } |
92 | mystyle.unset(); | 108 | mystyle.unset(); |
93 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); | 109 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); |
94 | //odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 110 | //qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
95 | if (m_lastBreak == locate()) | 111 | if (m_lastBreak == locate()) |
96 | { | 112 | { |
97 | currentpos++; | 113 | currentpos++; |
98 | ch = expandedtextbuffer[bufferpos++]; | 114 | ch = expandedtextbuffer[bufferpos++]; |
@@ -148,4 +164,68 @@ QImage* CPlucker::imagefromdata(UInt8* imgbuffer, UInt32 imgsize) | |||
148 | QImage* qimage = Palm2QImage(imgbuffer, imgsize); | 164 | QImage* qimage = Palm2QImage(imgbuffer, imgsize); |
149 | delete [] imgbuffer; | 165 | delete [] imgbuffer; |
150 | return qimage; | 166 | return qimage; |
151 | } | 167 | } |
168 | |||
169 | void CPlucker::start2endSection() // to plucker base | ||
170 | { | ||
171 | m_currentstart = NEFstartSection(); | ||
172 | m_currentend = NEFendSection(); | ||
173 | } | ||
174 | |||
175 | unsigned long CPlucker::NEFstartSection() // virtual in plucker base - differs only in obsoleted nef so move implementation | ||
176 | { | ||
177 | //inefficient - Should calc start/end of section on entry to section? | ||
178 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
179 | UInt32 thishdr_size; | ||
180 | UInt8 thishdr_type, thishdr_reserved; | ||
181 | unsigned long textlength = currentpos-bufferpos; | ||
182 | for (UInt16 recptr = bufferrec-1; recptr >= 1; recptr--) | ||
183 | { | ||
184 | gotorecordnumber(recptr); | ||
185 | //qDebug("recptr:%u", recptr); | ||
186 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
187 | if (thishdr_type < 2) | ||
188 | { | ||
189 | if ((thishdr_reserved && continuation_bit) == 0) break; | ||
190 | textlength -= thishdr_size; | ||
191 | //qDebug("Textlength:%u, reserved:%u, recptr:%u", textlength, thishdr_reserved, recptr); | ||
192 | } | ||
193 | } | ||
194 | return textlength; | ||
195 | } | ||
196 | |||
197 | unsigned long CPlucker::NEFendSection() // virtual in plucker base - differs only in obsoleted nef so move implementation | ||
198 | { | ||
199 | //inefficient - Should calc start/end of section on entry to section? | ||
200 | unsigned long textlength = currentpos-bufferpos+buffercontent; | ||
201 | gotorecordnumber(bufferrec); | ||
202 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
203 | UInt32 thishdr_size; | ||
204 | UInt8 thishdr_type, thishdr_reserved; | ||
205 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
206 | if ((thishdr_reserved && continuation_bit) != 0) | ||
207 | { | ||
208 | for (UInt16 recptr = bufferrec+1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
209 | { | ||
210 | gotorecordnumber(recptr); | ||
211 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
212 | UInt32 thishdr_size; | ||
213 | UInt8 thishdr_type, thishdr_reserved; | ||
214 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
215 | //qDebug("recptr %u bufferrec %u type %u m_reserved %u", recptr, bufferrec, typ | ||
216 | if (thishdr_type < 2) | ||
217 | { | ||
218 | textlength += thishdr_size; | ||
219 | if ((thishdr_reserved && continuation_bit) == 0) break; | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | return textlength; | ||
224 | } | ||
225 | |||
226 | #ifndef __STATIC | ||
227 | extern "C" | ||
228 | { | ||
229 | CExpander* newcodec() { return new CPlucker; } | ||
230 | } | ||
231 | #endif | ||
diff --git a/noncore/apps/opie-reader/plucker.h b/noncore/apps/opie-reader/plucker.h index 6d62195..53189a6 100644 --- a/noncore/apps/opie-reader/plucker.h +++ b/noncore/apps/opie-reader/plucker.h | |||
@@ -9,13 +9,15 @@ class QWidget; | |||
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | class CPlucker : public CPlucker_base | 11 | class CPlucker : public CPlucker_base |
12 | { | 12 | { |
13 | void start2endSection() | 13 | bool isEndOfSection(int thisrec) |
14 | { | 14 | { |
15 | m_currentstart = currentpos-bufferpos; | 15 | return !m_bufferisreserved; |
16 | m_currentend = m_currentstart+buffercontent; | 16 | } |
17 | } | 17 | unsigned long NEFstartSection(); |
18 | unsigned long NEFendSection(); | ||
19 | void start2endSection(); | ||
18 | void setbuffersize() | 20 | void setbuffersize() |
19 | { | 21 | { |
20 | compressedbuffersize = buffersize = 32*1024; | 22 | compressedbuffersize = buffersize = 32*1024; |
21 | } | 23 | } |
@@ -31,6 +33,7 @@ class CPlucker : public CPlucker_base | |||
31 | void setlink(QString&, const QString&); // Virtual | 33 | void setlink(QString&, const QString&); // Virtual |
32 | QImage* imagefromdata(UInt8*, UInt32); // virtual | 34 | QImage* imagefromdata(UInt8*, UInt32); // virtual |
33 | public: | 35 | public: |
34 | CPlucker(); | 36 | CPlucker(); |
37 | QString about() { return CPlucker_base::about()+QString("\nPlucker codec (c) Tim Wentford - Image reading code based on unpluck by Bill Janssen"); } | ||
35 | }; | 38 | }; |
36 | #endif | 39 | #endif |
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index b523a54..0b7fae8 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp | |||
@@ -1,578 +1,564 @@ | |||
1 | |||
2 | |||
3 | #include "useqpe.h" | 1 | #include "useqpe.h" |
4 | #include "plucker_base.h" | 2 | #include "usenef.h" |
5 | #include "Aportis.h" | 3 | #include <stdio.h> |
6 | #include "Palm2QImage.h" | 4 | #include <string.h> |
7 | 5 | #include <qmessagebox.h> | |
8 | /* OPIE */ | 6 | #include <qpixmap.h> |
9 | #include <opie2/odebug.h> | ||
10 | #ifdef USEQPE | 7 | #ifdef USEQPE |
11 | #include <qpe/qcopenvelope_qws.h> | 8 | #include <qpe/qcopenvelope_qws.h> |
9 | #endif /* USEQPE */ | ||
10 | #ifdef LOCALPICTURES | ||
11 | #include <qscrollview.h> | ||
12 | #endif | ||
13 | #ifdef USEQPE | ||
12 | #include <qpe/global.h> | 14 | #include <qpe/global.h> |
13 | #endif /* USEQPE */ | 15 | #endif /* USEQPE */ |
14 | 16 | #include <qclipboard.h> | |
15 | #ifndef USEQPE | 17 | #ifndef USEQPE |
16 | #include <qapplication.h> | 18 | #include <qapplication.h> |
17 | #else /* USEQPE */ | 19 | #else /* USEQPE */ |
18 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
19 | #endif /* USEQPE */ | 21 | #endif /* USEQPE */ |
22 | #include <qimage.h> | ||
20 | 23 | ||
21 | /* QT */ | 24 | #include "static.h" |
22 | #ifdef LOCALPICTURES | 25 | #include "plucker_base.h" |
23 | #include <qscrollview.h> | 26 | #include "Aportis.h" |
24 | #endif | 27 | #include "hrule.h" |
25 | 28 | #include "util.h" | |
26 | /* STD */ | ||
27 | #include <stdio.h> | ||
28 | #include <string.h> | ||
29 | 29 | ||
30 | const UInt8 CPlucker_base::continuation_bit = 1; | ||
30 | 31 | ||
31 | CPlucker_base::CPlucker_base() : | 32 | CPlucker_base::CPlucker_base() : |
32 | #ifdef LOCALPICTURES | 33 | #ifdef LOCALPICTURES |
33 | m_viewer(NULL), | 34 | m_viewer(NULL), |
34 | m_picture(NULL), | 35 | m_picture(NULL), |
35 | #endif | 36 | #endif |
36 | expandedtextbuffer(NULL), | 37 | expandedtextbuffer(NULL), |
37 | compressedtextbuffer(NULL) | 38 | compressedtextbuffer(NULL), |
38 | //, urls(NULL) | 39 | bufferrec(-1), |
39 | { /*printf("constructing:%x\n",fin);*/ } | 40 | m_offset(0) |
41 | //, urls(NULL) | ||
42 | { /*printf("constructing:%x\n",fin);*/ } | ||
40 | 43 | ||
41 | 44 | ||
42 | void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buffersize) | 45 | void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buffersize) |
43 | { | 46 | { |
44 | if (type%2 == 0) | 47 | if (type%2 == 0) |
45 | { | 48 | { |
46 | fread(buffer, reclen, sizeof(char), fin); | 49 | fread(buffer, reclen, sizeof(char), fin); |
47 | } | 50 | } |
48 | else | 51 | else |
49 | { | 52 | { |
50 | UInt8* readbuffer = NULL; | 53 | UInt8* readbuffer = NULL; |
51 | if (reclen > compressedbuffersize) | 54 | if (reclen > compressedbuffersize) |
52 | { | 55 | { |
53 | readbuffer = new UInt8[reclen]; | 56 | readbuffer = new UInt8[reclen]; |
54 | } | 57 | } |
55 | else | 58 | else |
56 | { | 59 | { |
57 | readbuffer = compressedtextbuffer; | 60 | readbuffer = compressedtextbuffer; |
58 | } | 61 | } |
59 | if (readbuffer != NULL) | 62 | if (readbuffer != NULL) |
60 | { | 63 | { |
61 | fread(readbuffer, reclen, sizeof(char), fin); | 64 | fread(readbuffer, reclen, sizeof(char), fin); |
62 | switch (ntohs(hdr0.version)) | 65 | (*m_decompress)(readbuffer, reclen, buffer, buffersize); |
63 | { | 66 | if (reclen > compressedbuffersize) |
64 | case 2: | 67 | { |
65 | UnZip(readbuffer, reclen, buffer, buffersize); | 68 | delete [] readbuffer; |
66 | break; | 69 | } |
67 | case 1: | 70 | } |
68 | UnDoc(readbuffer, reclen, buffer, buffersize); | ||
69 | break; | ||
70 | } | ||
71 | if (reclen > compressedbuffersize) | ||
72 | { | ||
73 | delete [] readbuffer; | ||
74 | } | ||
75 | } | ||
76 | } | 71 | } |
77 | } | 72 | } |
78 | 73 | ||
79 | void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text) | 74 | void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text) |
80 | { | 75 | { |
81 | _file = file_length; | 76 | _file = file_length; |
82 | if (textlength == 0) | 77 | if (textlength == 0) |
83 | { | 78 | { |
84 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 79 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
85 | { | 80 | { |
86 | gotorecordnumber(recptr); | 81 | gotorecordnumber(recptr); |
87 | UInt16 thishdr_uid, thishdr_nParagraphs; | 82 | UInt16 thishdr_uid, thishdr_nParagraphs; |
88 | UInt32 thishdr_size; | 83 | UInt32 thishdr_size; |
89 | UInt8 thishdr_type, thishdr_reserved; | 84 | UInt8 thishdr_type, thishdr_reserved; |
90 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 85 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
91 | if (thishdr_type < 2) textlength += thishdr_size; | 86 | if (thishdr_type < 2) textlength += thishdr_size; |
92 | } | 87 | } |
93 | } | 88 | } |
94 | _text = textlength; | 89 | _text = textlength; |
95 | //ntohl(hdr0.size); | 90 | //ntohl(hdr0.size); |
96 | } | 91 | } |
97 | 92 | ||
98 | char* CPlucker_base::geturl(UInt16 tgt) | 93 | char* CPlucker_base::geturl(UInt16 tgt) |
99 | { | 94 | { |
100 | char * pRet = NULL; | 95 | char * pRet = NULL; |
101 | gotorecordnumber(0); | 96 | gotorecordnumber(0); |
102 | fread(&hdr0, 1, 6, fin); | 97 | fread(&hdr0, 1, 6, fin); |
103 | unsigned int nrecs = ntohs(hdr0.nRecords); | 98 | unsigned int nrecs = ntohs(hdr0.nRecords); |
104 | //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl; | 99 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); |
105 | UInt16 urlid = 0; | 100 | UInt16 urlid = 0; |
106 | bool urlsfound = false; | 101 | bool urlsfound = false; |
107 | char* urls = NULL; | 102 | char* urls = NULL; |
108 | size_t urlsize = 0; | 103 | size_t urlsize = 0; |
109 | for (unsigned int i = 0; i < nrecs; i++) | 104 | for (unsigned int i = 0; i < nrecs; i++) |
110 | { | 105 | { |
111 | UInt16 id, name; | 106 | UInt16 id, name; |
112 | fread(&name, 1, sizeof(name), fin); | 107 | fread(&name, 1, sizeof(name), fin); |
113 | fread(&id, 1, sizeof(id), fin); | 108 | fread(&id, 1, sizeof(id), fin); |
114 | //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl; | 109 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); |
115 | if (ntohs(name) == 2) | 110 | if (ntohs(name) == 2) |
116 | { | 111 | { |
117 | urlsfound = true; | 112 | urlsfound = true; |
118 | urlid = id; | 113 | urlid = id; |
119 | //odebug << "Found url index:" << ntohs(urlid) << "" << oendl; | 114 | //qDebug("Found url index:%d", ntohs(urlid)); |
120 | } | 115 | } |
121 | // //odebug << "" << id << "" << oendl; | 116 | ////qDebug("%x", id); |
122 | } | 117 | } |
123 | if (urlsfound) | 118 | if (urlsfound) |
124 | { | 119 | { |
125 | unsigned short recptr = finduid(ntohs(urlid)); | 120 | unsigned short recptr = finduid(ntohs(urlid)); |
126 | if (recptr != 0) | 121 | if (recptr != 0) |
127 | { | 122 | { |
128 | gotorecordnumber(recptr); | 123 | gotorecordnumber(recptr); |
129 | UInt16 thishdr_uid, thishdr_nParagraphs; | 124 | UInt16 thishdr_uid, thishdr_nParagraphs; |
130 | UInt32 thishdr_size; | 125 | UInt32 thishdr_size; |
131 | UInt8 thishdr_type, thishdr_reserved; | 126 | UInt8 thishdr_type, thishdr_reserved; |
132 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 127 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
133 | UInt16 urlctr = 0; | 128 | UInt16 urlctr = 0; |
134 | while (1) | 129 | while (1) |
135 | { | 130 | { |
136 | UInt16 tctr; | 131 | UInt16 tctr; |
137 | fread(&tctr, 1, sizeof(tctr), fin); | 132 | fread(&tctr, 1, sizeof(tctr), fin); |
138 | fread(&urlid, 1, sizeof(urlid), fin); | 133 | fread(&urlid, 1, sizeof(urlid), fin); |
139 | tctr = ntohs(tctr); | 134 | tctr = ntohs(tctr); |
140 | //odebug << "tgt:" << tgt << " urlctr:" << urlctr << " tctr:" << tctr << "" << oendl; | 135 | //qDebug("tgt:%u urlctr:%u tctr:%u", tgt, urlctr, tctr); |
141 | if (tctr >= tgt) | 136 | if (tctr >= tgt) |
142 | { | 137 | { |
143 | break; | 138 | break; |
144 | } | 139 | } |
145 | urlctr = tctr; | 140 | urlctr = tctr; |
146 | } | 141 | } |
147 | //odebug << "urls are in " << ntohs(urlid) << "" << oendl; | 142 | //qDebug("urls are in %d", ntohs(urlid)); |
148 | recptr = finduid(ntohs(urlid)); | 143 | recptr = finduid(ntohs(urlid)); |
149 | if (recptr != 0) | 144 | if (recptr != 0) |
150 | { | 145 | { |
151 | UInt32 reclen = recordlength(recptr) - HeaderSize(); | 146 | UInt32 reclen = recordlength(recptr) - HeaderSize(); |
152 | gotorecordnumber(recptr); | 147 | gotorecordnumber(recptr); |
153 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 148 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
154 | //odebug << "Found urls:" << thishdr_type << "" << oendl; | 149 | //qDebug("Found urls:%x",thishdr_type); |
155 | urlsize = thishdr_size; | 150 | urlsize = thishdr_size; |
156 | urls = new char[urlsize]; | 151 | urls = new char[urlsize]; |
157 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); | 152 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); |
158 | char* ptr = urls; | 153 | char* ptr = urls; |
159 | int rn = urlctr+1; | 154 | int rn = urlctr+1; |
160 | while (ptr - urls < urlsize) | 155 | while (ptr - urls < urlsize) |
161 | { | 156 | { |
162 | if (rn == tgt) | 157 | if (rn == tgt) |
163 | { | 158 | { |
164 | //odebug << "URL:" << ptr << "" << oendl; | 159 | //qDebug("URL:%s", ptr); |
165 | int len = strlen(ptr)+1; | 160 | int len = strlen(ptr)+1; |
166 | pRet = new char[len]; | 161 | pRet = new char[len]; |
167 | memcpy(pRet, ptr, len); | 162 | memcpy(pRet, ptr, len); |
168 | break; | 163 | break; |
169 | } | 164 | } |
170 | ptr += strlen(ptr)+1; | 165 | ptr += strlen(ptr)+1; |
171 | rn++; | 166 | rn++; |
172 | } | 167 | } |
173 | delete [] urls; | 168 | delete [] urls; |
174 | } | 169 | } |
175 | } | 170 | } |
176 | } | 171 | } |
177 | else | 172 | else |
178 | { | 173 | { |
179 | QMessageBox::information(NULL, | 174 | pRet = NULL; |
180 | QString(PROGNAME), | 175 | } |
181 | QString("No external links\nin this pluck") | 176 | return pRet; |
182 | ); | ||
183 | } | ||
184 | return pRet; | ||
185 | } | 177 | } |
186 | 178 | ||
187 | CPlucker_base::~CPlucker_base() | 179 | CPlucker_base::~CPlucker_base() |
188 | { | 180 | { |
189 | if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; | 181 | if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; |
190 | if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; | 182 | if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; |
191 | #ifdef LOCALPICTURES | 183 | #ifdef LOCALPICTURES |
192 | if (m_viewer != NULL) delete m_viewer; | 184 | if (m_viewer != NULL) delete m_viewer; |
193 | #endif | 185 | #endif |
194 | } | 186 | } |
195 | 187 | ||
196 | int CPlucker_base::getch() { return getch(false); } | 188 | int CPlucker_base::getch() { return getch(false); } |
197 | 189 | ||
198 | void CPlucker_base::getch(tchar& ch, CStyle& sty) | 190 | void CPlucker_base::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
199 | { | 191 | { |
200 | ch = getch(false); | 192 | pos = locate(); |
201 | sty = mystyle; | 193 | ch = getch(false); |
194 | sty = mystyle; | ||
202 | } | 195 | } |
203 | 196 | ||
204 | unsigned int CPlucker_base::locate() | 197 | unsigned int CPlucker_base::locate() |
205 | { | 198 | { |
206 | return currentpos; | 199 | return currentpos; |
207 | /* | 200 | /* |
208 | UInt16 thisrec = 1; | 201 | UInt16 thisrec = 1; |
209 | unsigned long locpos = 0; | 202 | unsigned long locpos = 0; |
210 | gotorecordnumber(thisrec); | 203 | gotorecordnumber(thisrec); |
211 | UInt16 thishdr_uid, thishdr_nParagraphs; | 204 | UInt16 thishdr_uid, thishdr_nParagraphs; |
212 | UInt32 thishdr_size; | 205 | UInt32 thishdr_size; |
213 | UInt8 thishdr_type, thishdr_reserved; | 206 | UInt8 thishdr_type, thishdr_reserved; |
214 | while (thisrec < bufferrec) | 207 | while (thisrec < bufferrec) |
215 | { | 208 | { |
216 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 209 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
217 | if (thishdr_type < 2) locpos += thishdr_size; | 210 | if (thishdr_type < 2) locpos += thishdr_size; |
218 | thisrec++; | 211 | thisrec++; |
219 | gotorecordnumber(thisrec); | 212 | gotorecordnumber(thisrec); |
220 | } | 213 | } |
221 | return locpos+bufferpos; | 214 | return locpos+bufferpos; |
222 | */ | 215 | */ |
223 | } | 216 | } |
224 | 217 | ||
225 | void CPlucker_base::locate(unsigned int n) | 218 | void CPlucker_base::locate(unsigned int n) |
226 | { | 219 | { |
227 | 220 | ||
228 | // clock_t start = clock(); | 221 | // clock_t start = clock(); |
229 | UInt32 textlength = currentpos - bufferpos; | 222 | if (n >= currentpos-bufferpos && n < currentpos - bufferpos + buffercontent) |
230 | UInt16 recptr = bufferrec; | 223 | { |
231 | if (n < textlength/2) | 224 | currentpos -= bufferpos; |
232 | { | 225 | expand(bufferrec); |
233 | textlength = 0; | 226 | while (currentpos < n && bufferpos < buffercontent) getch_base(true); |
234 | UInt16 thishdr_uid, thishdr_nParagraphs; | 227 | return; |
235 | UInt32 thishdr_size = buffercontent; | 228 | } |
236 | UInt8 thishdr_type, thishdr_reserved; | 229 | /* |
237 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 230 | |
238 | { | 231 | UInt32 textlength = currentpos - bufferpos; |
239 | gotorecordnumber(recptr); | 232 | UInt16 recptr = bufferrec; |
240 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 233 | if (n < textlength/2) |
241 | if (thishdr_type < 2) | 234 | { |
242 | { | 235 | textlength = 0; |
243 | textlength += thishdr_size; | 236 | UInt16 thishdr_uid, thishdr_nParagraphs; |
244 | if (textlength > n) | 237 | UInt32 thishdr_size = buffercontent; |
245 | { | 238 | UInt8 thishdr_type, thishdr_reserved; |
246 | textlength -= thishdr_size; | 239 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
247 | break; | 240 | { |
248 | } | 241 | gotorecordnumber(recptr); |
249 | } | 242 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
250 | } | 243 | if (thishdr_type < 2) |
251 | } | 244 | { |
252 | else if (n < textlength) | 245 | textlength += thishdr_size; |
253 | { | 246 | if (textlength > n) |
254 | UInt16 thishdr_uid, thishdr_nParagraphs; | 247 | { |
255 | UInt32 thishdr_size; | 248 | textlength -= thishdr_size; |
256 | UInt8 thishdr_type, thishdr_reserved; | 249 | break; |
257 | while (n < textlength && recptr > 1) | 250 | } |
258 | { | 251 | } |
259 | recptr--; | 252 | } |
260 | gotorecordnumber(recptr); | 253 | } |
261 | //odebug << "recptr:" << recptr << "" << oendl; | 254 | else if (n < textlength) |
262 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 255 | { |
263 | if (thishdr_type < 2) | 256 | UInt16 thishdr_uid, thishdr_nParagraphs; |
264 | { | 257 | UInt32 thishdr_size; |
265 | textlength -= thishdr_size; | 258 | UInt8 thishdr_type, thishdr_reserved; |
266 | } | 259 | while (n < textlength && recptr > 1) |
267 | } | 260 | { |
268 | } | 261 | recptr--; |
269 | else | 262 | gotorecordnumber(recptr); |
270 | { | 263 | //qDebug("recptr:%u", recptr); |
271 | UInt16 thishdr_uid, thishdr_nParagraphs; | 264 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
272 | UInt32 thishdr_size = buffercontent; | 265 | if (thishdr_type < 2) |
273 | UInt8 thishdr_type, thishdr_reserved; | 266 | { |
274 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) | 267 | textlength -= thishdr_size; |
275 | { | 268 | } |
276 | textlength += thishdr_size; | 269 | } |
277 | recptr++; | 270 | } |
278 | gotorecordnumber(recptr); | 271 | else |
279 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 272 | { |
280 | if (!(thishdr_type < 2)) | 273 | UInt16 thishdr_uid, thishdr_nParagraphs; |
281 | { | 274 | UInt32 thishdr_size = buffercontent; |
282 | thishdr_size = 0; | 275 | UInt8 thishdr_type, thishdr_reserved; |
283 | } | 276 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) |
284 | } | 277 | { |
285 | } | 278 | textlength += thishdr_size; |
286 | // odebug << "Time(1): " << clock()-start << "" << oendl; | 279 | recptr++; |
287 | /* | 280 | gotorecordnumber(recptr); |
288 | expand(recptr); | 281 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
289 | mystyle.unset(); | 282 | if (!(thishdr_type < 2)) |
290 | bufferpos = n-textlength; | 283 | { |
291 | currentpos = n; | 284 | thishdr_size = 0; |
292 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 285 | } |
293 | { | 286 | } |
294 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 287 | } |
295 | m_nextParaIndex++; | 288 | |
296 | if (m_nextParaIndex == m_nParas) | 289 | */ |
297 | { | 290 | UInt16 thisrec = 0; |
298 | m_nextPara = -1; | 291 | unsigned long locpos = 0; |
299 | } | 292 | unsigned long bs = 0; |
300 | else | 293 | UInt16 thishdr_uid, thishdr_nParagraphs; |
301 | { | 294 | UInt32 thishdr_size; |
302 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 295 | UInt8 thishdr_type, thishdr_reserved; |
303 | } | 296 | do |
304 | } | 297 | { |
305 | 298 | thisrec++; | |
306 | return; | 299 | locpos += bs; |
307 | */ | 300 | gotorecordnumber(thisrec); |
308 | // start = clock(); | 301 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
309 | 302 | if (thishdr_type < 2) | |
310 | UInt16 thisrec = 0; | 303 | { |
311 | unsigned long locpos = 0; | 304 | bs = thishdr_size; |
312 | unsigned long bs = 0; | 305 | } |
313 | UInt16 thishdr_uid, thishdr_nParagraphs; | 306 | else |
314 | UInt32 thishdr_size; | 307 | { |
315 | UInt8 thishdr_type, thishdr_reserved; | 308 | bs = 0; |
316 | do | 309 | } |
317 | { | ||
318 | thisrec++; | ||
319 | locpos += bs; | ||
320 | gotorecordnumber(thisrec); | ||
321 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
322 | if (thishdr_type < 2) | ||
323 | { | ||
324 | bs = thishdr_size; | ||
325 | } | ||
326 | else | ||
327 | { | ||
328 | bs = 0; | ||
329 | } | ||
330 | } while (locpos + bs <= n); | 310 | } while (locpos + bs <= n); |
331 | 311 | ||
332 | // odebug << "Time(2): " << clock()-start << "" << oendl; | 312 | // qDebug("Time(2): %u", clock()-start); |
333 | if (recptr != thisrec) | 313 | /* |
334 | { | 314 | if (recptr != thisrec) |
335 | odebug << "Disaster:recptr:" << recptr << " thisrec:" << thisrec << "" << oendl; | 315 | { |
336 | UInt16 thishdr_uid, thishdr_nParagraphs; | 316 | qDebug("Disaster:recptr:%u thisrec:%u", recptr, thisrec); |
337 | UInt32 thishdr_size = buffercontent; | 317 | UInt16 thishdr_uid, thishdr_nParagraphs; |
338 | UInt8 thishdr_type, thishdr_reserved; | 318 | UInt32 thishdr_size = buffercontent; |
339 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 319 | UInt8 thishdr_type, thishdr_reserved; |
340 | { | 320 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) |
341 | gotorecordnumber(recptr); | 321 | { |
342 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 322 | gotorecordnumber(recptr); |
343 | // odebug << "UID:" << thishdr_uid << " Paras:" << thishdr_nParagraphs << " Size:" << thishdr_size << " Type:" << (unsigned int)thishdr_type << " Reserved:" << (unsigned int)thishdr_reserved << "" << oendl; | 323 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
344 | } | 324 | // 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); |
345 | // QApplication::exit ( 100 ); | 325 | } |
346 | } | 326 | //QApplication::exit ( 100 ); |
347 | 327 | } | |
348 | currentpos = locpos; | 328 | */ |
349 | expand(thisrec); | 329 | currentpos = locpos; |
350 | while (currentpos < n && bufferpos < buffercontent) getch_base(true); | 330 | expand(thisrec); |
351 | 331 | while (currentpos < n && bufferpos < buffercontent) getch_base(true); | |
352 | /* // This is faster but the alignment attribute doesn't get set 8^( | 332 | |
353 | bufferpos = n-locpos; | 333 | /* // This is faster but the alignment attribute doesn't get set 8^( |
354 | currentpos = n; | 334 | bufferpos = n-locpos; |
355 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 335 | currentpos = n; |
356 | { | 336 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
357 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 337 | { |
358 | m_nextParaIndex++; | 338 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
359 | if (m_nextParaIndex == m_nParas) | 339 | m_nextParaIndex++; |
360 | { | 340 | if (m_nextParaIndex == m_nParas) |
361 | m_nextPara = -1; | 341 | { |
362 | } | 342 | m_nextPara = -1; |
363 | else | 343 | } |
364 | { | 344 | else |
365 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 345 | { |
366 | } | 346 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
367 | } | 347 | } |
368 | */ | 348 | } |
349 | */ | ||
369 | } | 350 | } |
370 | 351 | ||
371 | bool CPlucker_base::expand(int thisrec) | 352 | bool CPlucker_base::expand(int thisrec) |
372 | { | 353 | { |
373 | mystyle.unset(); | 354 | mystyle.unset(); |
374 | size_t reclen = recordlength(thisrec); | 355 | if (bufferrec != thisrec) |
375 | gotorecordnumber(thisrec); | 356 | { |
376 | UInt16 thishdr_uid, thishdr_nParagraphs; | 357 | size_t reclen = recordlength(thisrec); |
377 | UInt32 thishdr_size; | 358 | gotorecordnumber(thisrec); |
378 | UInt8 thishdr_type, thishdr_reserved; | 359 | UInt16 thishdr_uid, thishdr_nParagraphs; |
379 | while (1) | 360 | UInt32 thishdr_size; |
380 | { | 361 | UInt8 thishdr_type, thishdr_reserved; |
381 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 362 | while (1) |
382 | //odebug << "This (" << thisrec << ") type is " << thishdr_type << ", uid is " << thishdr_uid << "" << oendl; | 363 | { |
383 | if (thishdr_type < 2) break; | 364 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
384 | //odebug << "Skipping paragraph of type " << thishdr_type << "" << oendl; | 365 | //qDebug("This (%d) type is %d, uid is %u", thisrec, thishdr_type, thishdr_uid); |
385 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; | 366 | if (thishdr_type < 2) break; |
386 | reclen = recordlength(thisrec); | 367 | //qDebug("Skipping paragraph of type %d", thishdr_type); |
387 | gotorecordnumber(thisrec); | 368 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; |
388 | } | 369 | reclen = recordlength(thisrec); |
389 | m_nParas = thishdr_nParagraphs; | 370 | gotorecordnumber(thisrec); |
390 | m_bufferisreserved = (thishdr_reserved != 0); | 371 | } |
391 | //odebug << "It has " << thishdr_nParagraphs << " paragraphs and is " << thishdr_size << " bytes" << oendl; | 372 | m_nParas = thishdr_nParagraphs; |
392 | uid = thishdr_uid; | 373 | m_bufferisreserved = (thishdr_reserved != 0); |
393 | // gotorecordnumber(thisrec); | 374 | //qDebug("It has %u paragraphs and is %u bytes", thishdr_nParagraphs, thishdr_size); |
394 | // fread(expandedtextbuffer,1,10,fin); | 375 | uid = thishdr_uid; |
395 | for (int i = 0; i < m_nParas; i++) | 376 | // gotorecordnumber(thisrec); |
396 | { | 377 | // fread(expandedtextbuffer,1,10,fin); |
397 | UInt16 ubytes, attrs; | 378 | for (int i = 0; i < m_nParas; i++) |
398 | fread(&ubytes, 1, sizeof(ubytes), fin); | 379 | { |
399 | fread(&attrs, 1, sizeof(attrs), fin); | 380 | UInt16 ubytes, attrs; |
400 | m_ParaOffsets[i] = ntohs(ubytes); | 381 | fread(&ubytes, 1, sizeof(ubytes), fin); |
401 | m_ParaAttrs[i] = ntohs(attrs); | 382 | fread(&attrs, 1, sizeof(attrs), fin); |
402 | // //odebug << "Bytes " << ntohs(ubytes) << ", Attr " << ntohs(attrs) << "" << oendl; | 383 | m_ParaOffsets[i] = ntohs(ubytes); |
403 | } | 384 | m_ParaAttrs[i] = ntohs(attrs); |
404 | if (m_nParas > 0) | 385 | ////qDebug("Bytes %u, Attr %x", ntohs(ubytes), ntohs(attrs)); |
405 | { | 386 | } |
406 | m_nextPara = m_ParaOffsets[0]; | 387 | |
407 | //odebug << "First offset = " << m_nextPara << "" << oendl; | 388 | reclen -= HeaderSize()+4*m_nParas; |
408 | m_nextParaIndex = 0; | 389 | |
409 | } | 390 | buffercontent = thishdr_size; |
410 | else | 391 | |
411 | { | 392 | if (thishdr_size > buffersize) |
412 | m_nextPara = -1; | 393 | { |
413 | } | 394 | delete [] expandedtextbuffer; |
414 | 395 | buffersize = thishdr_size; | |
415 | reclen -= HeaderSize()+4*m_nParas; | 396 | expandedtextbuffer = new UInt8[buffersize]; |
416 | 397 | } | |
417 | buffercontent = thishdr_size; | 398 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); |
418 | 399 | bufferrec = thisrec; | |
419 | if (thishdr_size > buffersize) | 400 | } |
420 | { | 401 | |
421 | delete [] expandedtextbuffer; | 402 | |
422 | buffersize = thishdr_size; | 403 | if (m_nParas > 0) |
423 | expandedtextbuffer = new UInt8[buffersize]; | 404 | { |
424 | } | 405 | m_nextPara = m_ParaOffsets[0]; |
425 | 406 | //qDebug("First offset = %u", m_nextPara); | |
426 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); | 407 | m_nextParaIndex = 0; |
427 | bufferpos = 0; | 408 | } |
428 | bufferrec = thisrec; | 409 | else |
429 | //odebug << "BC:" << buffercontent << ", HS:" << thishdr_size << "" << oendl; | 410 | { |
430 | return true; | 411 | m_nextPara = -1; |
412 | } | ||
413 | bufferpos = 0; | ||
414 | //qDebug("BC:%u, HS:%u", buffercontent, thishdr_size); | ||
415 | return true; | ||
431 | } | 416 | } |
432 | 417 | ||
433 | void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) | 418 | void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) |
434 | { | 419 | { |
435 | z_stream zstream; | 420 | z_stream zstream; |
436 | memset(&zstream,sizeof(zstream),0); | 421 | memset(&zstream,sizeof(zstream),0); |
437 | zstream.next_in = compressedbuffer; | 422 | zstream.next_in = compressedbuffer; |
438 | zstream.next_out = tgtbuffer; | 423 | zstream.next_out = tgtbuffer; |
424 | zstream.avail_out = bsize; | ||
425 | zstream.avail_in = reclen; | ||
426 | |||
427 | int keylen = 0; | ||
428 | |||
429 | zstream.zalloc = Z_NULL; | ||
430 | zstream.zfree = Z_NULL; | ||
431 | zstream.opaque = Z_NULL; | ||
432 | |||
433 | // printf("Initialising\n"); | ||
434 | |||
435 | inflateInit(&zstream); | ||
436 | int err = 0; | ||
437 | do { | ||
438 | if ( zstream.avail_in == 0 && 0 < keylen ) { | ||
439 | zstream.next_in = compressedbuffer + keylen; | ||
440 | zstream.avail_in = reclen - keylen; | ||
441 | keylen = 0; | ||
442 | } | ||
443 | zstream.next_out = tgtbuffer; | ||
439 | zstream.avail_out = bsize; | 444 | zstream.avail_out = bsize; |
440 | zstream.avail_in = reclen; | ||
441 | |||
442 | int keylen = 0; | ||
443 | |||
444 | zstream.zalloc = Z_NULL; | ||
445 | zstream.zfree = Z_NULL; | ||
446 | zstream.opaque = Z_NULL; | ||
447 | |||
448 | // printf("Initialising\n"); | ||
449 | 445 | ||
450 | inflateInit(&zstream); | 446 | err = inflate( &zstream, Z_SYNC_FLUSH ); |
451 | int err = 0; | ||
452 | do { | ||
453 | if ( zstream.avail_in == 0 && 0 < keylen ) { | ||
454 | zstream.next_in = compressedbuffer + keylen; | ||
455 | zstream.avail_in = reclen - keylen; | ||
456 | keylen = 0; | ||
457 | } | ||
458 | zstream.next_out = tgtbuffer; | ||
459 | zstream.avail_out = bsize; | ||
460 | 447 | ||
461 | err = inflate( &zstream, Z_SYNC_FLUSH ); | 448 | ////qDebug("err:%d - %u", err, zstream.avail_in); |
462 | 449 | ||
463 | // //odebug << "err:" << err << " - " << zstream.avail_in << "" << oendl; | 450 | } while ( err == Z_OK ); |
464 | 451 | ||
465 | } while ( err == Z_OK ); | 452 | inflateEnd(&zstream); |
466 | |||
467 | inflateEnd(&zstream); | ||
468 | } | 453 | } |
469 | 454 | ||
470 | void CPlucker_base::UnDoc(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) | 455 | void CPlucker_base::UnDoc(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) |
471 | { | 456 | { |
472 | // UInt16 headerSize; | 457 | // UInt16 headerSize; |
473 | UInt16 docSize; | 458 | UInt16 docSize; |
474 | UInt16 i; | 459 | UInt16 i; |
475 | UInt16 j; | 460 | UInt16 j; |
476 | UInt16 k; | 461 | UInt16 k; |
477 | 462 | ||
478 | UInt8 *inBuf = compressedbuffer; | 463 | UInt8 *inBuf = compressedbuffer; |
479 | UInt8 *outBuf = tgtbuffer; | 464 | UInt8 *outBuf = tgtbuffer; |
480 | 465 | ||
481 | // headerSize = sizeof( Header ) + record->paragraphs * sizeof( Paragraph ); | 466 | // headerSize = sizeof( Header ) + record->paragraphs * sizeof( Paragraph ); |
482 | docSize = reclen; | 467 | docSize = reclen; |
483 | 468 | ||
484 | j = 0; | 469 | j = 0; |
485 | k = 0; | 470 | k = 0; |
486 | while ( j < docSize ) { | 471 | while ( j < docSize ) { |
487 | i = 0; | 472 | i = 0; |
488 | while ( i < bsize && j < docSize ) { | 473 | while ( i < bsize && j < docSize ) { |
489 | UInt16 c; | 474 | UInt16 c; |
490 | 475 | ||
491 | c = (UInt16) inBuf[ j++ ]; | 476 | c = (UInt16) inBuf[ j++ ]; |
492 | if ( 0 < c && c < 9 ) { | 477 | if ( 0 < c && c < 9 ) { |
493 | while ( 0 < c-- ) | 478 | while ( 0 < c-- ) |
494 | outBuf[ i++ ] = inBuf[ j++ ]; | 479 | outBuf[ i++ ] = inBuf[ j++ ]; |
495 | } | 480 | } |
496 | else if ( c < 0x80 ) | 481 | else if ( c < 0x80 ) |
497 | outBuf[ i++ ] = c; | 482 | outBuf[ i++ ] = c; |
498 | else if ( 0xc0 <= c ) { | 483 | else if ( 0xc0 <= c ) { |
499 | outBuf[ i++ ] = ' '; | 484 | outBuf[ i++ ] = ' '; |
500 | outBuf[ i++ ] = c ^ 0x80; | 485 | outBuf[ i++ ] = c ^ 0x80; |
501 | } | 486 | } |
502 | else { | 487 | else { |
503 | Int16 m; | 488 | Int16 m; |
504 | Int16 n; | 489 | Int16 n; |
505 | 490 | ||
506 | c <<= 8; | 491 | c <<= 8; |
507 | c += inBuf[ j++ ]; | 492 | c += inBuf[ j++ ]; |
508 | 493 | ||
509 | m = ( c & 0x3fff ) >> COUNT_BITS; | 494 | m = ( c & 0x3fff ) >> COUNT_BITS; |
510 | n = c & ( ( 1 << COUNT_BITS ) - 1 ); | 495 | n = c & ( ( 1 << COUNT_BITS ) - 1 ); |
511 | n += 2; | 496 | n += 2; |
512 | 497 | ||
513 | do { | 498 | do { |
514 | outBuf[ i ] = outBuf[ i - m ]; | 499 | outBuf[ i ] = outBuf[ i - m ]; |
515 | i++; | 500 | i++; |
516 | } while ( 0 < n-- ); | 501 | } while ( 0 < n-- ); |
517 | } | 502 | } |
518 | } | 503 | } |
519 | k += bsize; | 504 | k += bsize; |
520 | } | 505 | } |
521 | } | 506 | } |
522 | 507 | ||
523 | void CPlucker_base::home() | 508 | void CPlucker_base::home() |
524 | { | 509 | { |
525 | currentpos = 0; | 510 | currentpos = 0; |
526 | expand(1); | 511 | expand(1); |
527 | } | 512 | } |
528 | 513 | ||
529 | CList<Bkmk>* CPlucker_base::getbkmklist() | 514 | CList<Bkmk>* CPlucker_base::getbkmklist() |
530 | { | 515 | { |
531 | /* | 516 | /* |
532 | UInt16 thishdr_uid, thishdr_nParagraphs; | 517 | UInt16 thishdr_uid, thishdr_nParagraphs; |
533 | UInt32 thishdr_size; | 518 | UInt32 thishdr_size; |
534 | UInt8 thishdr_type, thishdr_reserved; | 519 | UInt8 thishdr_type, thishdr_reserved; |
535 | 520 | ||
536 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) | 521 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) |
537 | { | 522 | { |
538 | gotorecordnumber(i); | 523 | gotorecordnumber(i); |
539 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 524 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
540 | if (thishdr_type == 8) | 525 | if (thishdr_type == 8) |
541 | { | 526 | { |
542 | UInt16 n; | 527 | UInt16 n; |
543 | fread(&n, 1, sizeof(n), fin); | 528 | fread(&n, 1, sizeof(n), fin); |
544 | n = ntohs(n); | 529 | n = ntohs(n); |
545 | //odebug << "Found " << n << " bookmarks" << oendl; | 530 | //qDebug("Found %u bookmarks", n); |
546 | } | 531 | } |
547 | //odebug << "Found:" << i << ", " << thishdr_type << "" << oendl; | 532 | //qDebug("Found:%d, %u", i , thishdr_type); |
548 | } | 533 | } |
549 | */ | 534 | */ |
550 | return NULL; | 535 | return NULL; |
551 | } | 536 | } |
552 | 537 | ||
538 | #include <qnamespace.h> | ||
553 | 539 | ||
554 | QImage* CPlucker_base::expandimg(UInt16 tgt, bool border) | 540 | QImage* CPlucker_base::expandimg(UInt16 tgt, bool border) |
555 | { | 541 | { |
556 | QImage* qimage = getimg(tgt); | 542 | QImage* qimage = getimg(tgt); |
557 | QImage* ret; | 543 | QImage* ret; |
558 | if (qimage == NULL) return NULL; | 544 | if (qimage == NULL) return NULL; |
559 | if (border) | 545 | if (border) |
560 | { | 546 | { |
561 | QPixmap* image = new QPixmap(0,0); | 547 | QPixmap* image = new QPixmap(0,0); |
562 | image->convertFromImage(*qimage); | 548 | image->convertFromImage(*qimage); |
563 | delete qimage; | 549 | delete qimage; |
564 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); | 550 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); |
565 | pret->fill(Qt::red); | 551 | pret->fill(Qt::red); |
566 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); | 552 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); |
567 | delete image; | 553 | delete image; |
568 | ret = new QImage(pret->convertToImage()); | 554 | ret = new QImage(pret->convertToImage()); |
569 | } | 555 | } |
570 | else | 556 | else |
571 | { | 557 | { |
572 | ret = qimage; | 558 | ret = qimage; |
573 | } | 559 | } |
574 | return ret; | 560 | return ret; |
575 | } | 561 | } |
576 | 562 | ||
577 | #ifdef _BUFFERPICS | 563 | #ifdef _BUFFERPICS |
578 | #include <qmap.h> | 564 | #include <qmap.h> |
@@ -580,46 +566,46 @@ QImage* CPlucker_base::expandimg(UInt16 tgt, bool border) | |||
580 | 566 | ||
581 | QImage* CPlucker_base::getPicture(unsigned long tgt) | 567 | QImage* CPlucker_base::getPicture(unsigned long tgt) |
582 | { | 568 | { |
583 | #ifdef _BUFFERPICS | 569 | #ifdef _BUFFERPICS |
584 | static QMap<unsigned long, QPixmap> pix; | 570 | static QMap<unsigned long, QPixmap> pix; |
585 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); | 571 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); |
586 | if (t == pix.end()) | 572 | if (t == pix.end()) |
587 | { | 573 | { |
588 | pix[tgt] = *expandimg(tgt); | 574 | pix[tgt] = *expandimg(tgt); |
589 | return &pix[tgt]; | 575 | return &pix[tgt]; |
590 | } | 576 | } |
591 | else | 577 | else |
592 | return &(t.data()); | 578 | return &(t.data()); |
593 | #else | 579 | #else |
594 | return expandimg(tgt >> 16); | 580 | return expandimg(tgt >> 16); |
595 | #endif | 581 | #endif |
596 | } | 582 | } |
597 | 583 | ||
598 | #ifdef LOCALPICTURES | 584 | #ifdef LOCALPICTURES |
599 | #include <unistd.h> | 585 | #include <unistd.h> |
600 | #include <qpe/global.h> | 586 | #include <qpe/global.h> |
601 | void CPlucker_base::showimg(UInt16 tgt) | 587 | void CPlucker_base::showimg(UInt16 tgt) |
602 | { | 588 | { |
603 | //odebug << "Crassssssh!" << oendl; | 589 | //qDebug("Crassssssh!"); |
604 | QPixmap* qimage = expandimg(tgt); | 590 | QPixmap* qimage = expandimg(tgt); |
605 | m_picture->setFixedSize(qimage->size()); | 591 | m_picture->setFixedSize(qimage->size()); |
606 | m_picture->setBackgroundPixmap(*qimage); | 592 | m_picture->setBackgroundPixmap(*qimage); |
607 | delete qimage; | 593 | delete qimage; |
608 | m_viewer->show(); | 594 | m_viewer->show(); |
609 | 595 | ||
610 | /* | 596 | /* |
611 | char tmp[] = "uqtreader.XXXXXX"; | 597 | char tmp[] = "uqtreader.XXXXXX"; |
612 | QImage* qimage = getimg(tgt); | 598 | QImage* qimage = getimg(tgt); |
613 | QPixmap* image = new QPixmap(0,0); | 599 | QPixmap* image = new QPixmap(0,0); |
614 | // //odebug << "New image" << oendl; | 600 | // //qDebug("New image"); |
615 | image->convertFromImage(*qimage); | 601 | image->convertFromImage(*qimage); |
616 | delete qimage; | 602 | delete qimage; |
617 | char tmpfile[sizeof(tmp)+1]; | 603 | char tmpfile[sizeof(tmp)+1]; |
618 | strcpy(tmpfile,tmp); | 604 | strcpy(tmpfile,tmp); |
619 | int f = mkstemp(tmpfile); | 605 | int f = mkstemp(tmpfile); |
620 | close(f); | 606 | close(f); |
621 | //odebug << "TMPFILE:" << tmpfile << "" << oendl; | 607 | //qDebug("TMPFILE:%s", tmpfile); |
622 | if (image->save(tmpfile,"PNG")) | 608 | if (image->save(tmpfile,"PNG")) |
623 | { | 609 | { |
624 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); | 610 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); |
625 | e << QString(tmpfile); | 611 | e << QString(tmpfile); |
@@ -627,617 +613,799 @@ void CPlucker_base::showimg(UInt16 tgt) | |||
627 | Global::statusMessage("Opening image"); | 613 | Global::statusMessage("Opening image"); |
628 | sleep(5); | 614 | sleep(5); |
629 | delete image; | 615 | delete image; |
630 | unlink(tmpfile); | 616 | unlink(tmpfile); |
631 | */ | 617 | */ |
632 | } | 618 | } |
633 | 619 | ||
634 | #endif | 620 | #endif |
635 | 621 | ||
636 | unsigned short CPlucker_base::finduid(unsigned short urlid) | 622 | unsigned short CPlucker_base::finduid(unsigned short urlid) |
637 | { | 623 | { |
638 | // //odebug << "Finding " << urlid << "" << oendl; | 624 | // //qDebug("Finding %u", urlid); |
639 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); | 625 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); |
640 | unsigned short jmid = (jmin+jmax) >> 1; | 626 | unsigned short jmid = (jmin+jmax) >> 1; |
641 | while (jmax - jmin > 1) | 627 | while (jmax - jmin > 1) |
642 | { | 628 | { |
643 | gotorecordnumber(jmid); | 629 | gotorecordnumber(jmid); |
644 | UInt16 thishdr_uid, thishdr_nParagraphs; | 630 | UInt16 thishdr_uid, thishdr_nParagraphs; |
645 | UInt32 thishdr_size; | 631 | UInt32 thishdr_size; |
646 | UInt8 thishdr_type, thishdr_reserved; | 632 | UInt8 thishdr_type, thishdr_reserved; |
647 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 633 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
648 | unsigned short luid = thishdr_uid; | 634 | unsigned short luid = thishdr_uid; |
649 | // //odebug << "" << jmin << " " << jmid << " " << jmax << " : " << urlid << "" << oendl; | 635 | ////qDebug("%u %u %u : %u", jmin, jmid, jmax, urlid); |
650 | if (luid == urlid) | 636 | if (luid == urlid) |
651 | { | 637 | { |
652 | return jmid; | 638 | return jmid; |
653 | } | 639 | } |
654 | if (luid < urlid) | 640 | if (luid < urlid) |
655 | { | 641 | { |
656 | jmin = jmid; | 642 | jmin = jmid; |
657 | } | 643 | } |
658 | else | 644 | else |
659 | { | 645 | { |
660 | jmax = jmid; | 646 | jmax = jmid; |
661 | } | 647 | } |
662 | jmid = (jmin+jmax) >> 1; | 648 | jmid = (jmin+jmax) >> 1; |
663 | } | 649 | } |
664 | gotorecordnumber(jmin); | 650 | gotorecordnumber(jmin); |
665 | UInt16 thishdr_uid, thishdr_nParagraphs; | 651 | UInt16 thishdr_uid, thishdr_nParagraphs; |
666 | UInt32 thishdr_size; | 652 | UInt32 thishdr_size; |
667 | UInt8 thishdr_type, thishdr_reserved; | 653 | UInt8 thishdr_type, thishdr_reserved; |
668 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 654 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
669 | unsigned short luid = thishdr_uid; | 655 | unsigned short luid = thishdr_uid; |
670 | //odebug << "jmin at end:" << jmin << "," << luid << "" << oendl; | 656 | //qDebug("jmin at end:%u,%u", jmin, luid); |
671 | if (luid == urlid) | 657 | if (luid == urlid) |
672 | { | 658 | { |
673 | return jmin; | 659 | return jmin; |
674 | } | 660 | } |
675 | gotorecordnumber(jmax); | 661 | gotorecordnumber(jmax); |
676 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 662 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
677 | luid = thishdr_uid; | 663 | luid = thishdr_uid; |
678 | //odebug << "jmax at end:" << jmax << "," << luid << "" << oendl; | 664 | //qDebug("jmax at end:%u,%u", jmax, luid); |
679 | if (luid == urlid) | 665 | if (luid == urlid) |
680 | { | 666 | { |
681 | return jmax; | 667 | return jmax; |
682 | } | 668 | } |
683 | //odebug << "Couldn't find " << urlid << "" << oendl; | 669 | //qDebug("Couldn't find %u", urlid); |
684 | return 0; // Not found! | 670 | return 0; // Not found! |
685 | } | 671 | } |
686 | 672 | ||
673 | #include <qnamespace.h> | ||
687 | 674 | ||
688 | void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 675 | void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
689 | { | 676 | { |
690 | unsigned short sz = 0; | 677 | unsigned short sz = 0; |
691 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 678 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
692 | { | 679 | { |
693 | sz++; | 680 | sz++; |
694 | } | 681 | } |
695 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); | 682 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); |
696 | unsigned char* newdata = new unsigned char[newlen]; | 683 | unsigned char* newdata = new unsigned char[newlen]; |
697 | unsigned char* pdata = newdata; | 684 | unsigned char* pdata = newdata; |
698 | memcpy(newdata, src, srclen); | 685 | memcpy(newdata, src, srclen); |
699 | newdata += srclen; | 686 | newdata += srclen; |
700 | memcpy(newdata, &sz, sizeof(sz)); | 687 | memcpy(newdata, &sz, sizeof(sz)); |
701 | newdata += sizeof(sz); | 688 | newdata += sizeof(sz); |
702 | #ifdef _WINDOWS | 689 | #ifdef _WINDOWS |
703 | for (it = visited.begin(); it != visited.end(); it++) | 690 | for (it = visited.begin(); it != visited.end(); it++) |
704 | #else | 691 | #else |
705 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 692 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
706 | #endif | 693 | #endif |
707 | { | 694 | { |
708 | unsigned long t = *it; | 695 | unsigned long t = *it; |
709 | // odebug << "[" << t << "]" << oendl; | 696 | //qDebug("[%u]", t); |
710 | memcpy(newdata, &t, sizeof(t)); | 697 | memcpy(newdata, &t, sizeof(t)); |
711 | newdata += sizeof(t); | 698 | newdata += sizeof(t); |
712 | } | 699 | } |
713 | m_nav.setSaveData(data, len, pdata, newlen); | 700 | m_nav.setSaveData(data, len, pdata, newlen); |
714 | delete [] pdata; | 701 | delete [] pdata; |
715 | } | 702 | } |
716 | 703 | ||
717 | void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) | 704 | void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) |
718 | { | 705 | { |
719 | unsigned short sz; | 706 | unsigned short sz; |
720 | if (srclen >= sizeof(sz)) | 707 | if (srclen >= sizeof(sz)) |
721 | { | 708 | { |
722 | memcpy(&sz, src, sizeof(sz)); | 709 | memcpy(&sz, src, sizeof(sz)); |
723 | src += sizeof(sz); | 710 | src += sizeof(sz); |
724 | srclen -= sizeof(sz); | 711 | srclen -= sizeof(sz); |
725 | } | 712 | } |
726 | for (int i = 0; i < sz; i++) | 713 | for (int i = 0; i < sz; i++) |
727 | { | 714 | { |
728 | unsigned long t; | 715 | unsigned long t; |
729 | if (srclen >= sizeof(t)) | 716 | if (srclen >= sizeof(t)) |
730 | { | 717 | { |
731 | memcpy(&t, src, sizeof(t)); | 718 | memcpy(&t, src, sizeof(t)); |
732 | // odebug << "[" << t << "]" << oendl; | 719 | // qDebug("[%u]", t); |
733 | visited.push_front(t); | 720 | visited.push_front(t); |
734 | src += sizeof(t); | 721 | src += sizeof(t); |
735 | srclen -= sizeof(t); | 722 | srclen -= sizeof(t); |
736 | } | 723 | } |
737 | else | 724 | else |
738 | { | 725 | { |
739 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); | 726 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); |
740 | break; | 727 | break; |
741 | } | 728 | } |
742 | } | 729 | } |
743 | m_nav.putSaveData(src, srclen); | 730 | m_nav.putSaveData(src, srclen); |
744 | } | 731 | } |
745 | 732 | ||
746 | int CPlucker_base::OpenFile(const char *src) | 733 | int CPlucker_base::OpenFile(const char *src) |
747 | { | 734 | { |
748 | m_lastBreak = 0; | 735 | qDebug("plucker openfile:%s", src); |
749 | if (!Cpdb::openfile(src)) | 736 | m_lastBreak = 0; |
750 | { | 737 | if (!Cpdb::openpdbfile(src)) |
751 | return -1; | 738 | { |
752 | } | 739 | return -1; |
753 | 740 | } | |
754 | if (!CorrectDecoder()) return -1; | 741 | |
755 | 742 | if (!CorrectDecoder()) return -1; | |
756 | gotorecordnumber(0); | 743 | |
757 | fread(&hdr0, 1, 6, fin); | 744 | gotorecordnumber(0); |
758 | setbuffersize(); | 745 | fread(&hdr0, 1, 6, fin); |
759 | compressedtextbuffer = new UInt8[compressedbuffersize]; | 746 | qDebug("Compression type:%u", ntohs(hdr0.version)); |
760 | expandedtextbuffer = new UInt8[buffersize]; | 747 | |
761 | 748 | ||
762 | //odebug << "Total number of records:" << ntohs(head.recordList.numRecords) << "" << oendl; | 749 | switch (ntohs(hdr0.version)) |
763 | 750 | { | |
764 | unsigned int nrecs = ntohs(hdr0.nRecords); | 751 | case 2: |
765 | //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl; | 752 | m_decompress = UnZip; |
766 | UInt16 homerecid = 1; | 753 | break; |
767 | for (unsigned int i = 0; i < nrecs; i++) | 754 | case 1: |
768 | { | 755 | m_decompress = UnDoc; |
769 | UInt16 id, name; | 756 | break; |
770 | fread(&name, 1, sizeof(name), fin); | 757 | #ifdef USENEF |
771 | fread(&id, 1, sizeof(id), fin); | 758 | case 3: |
772 | //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl; | 759 | m_decompress = getdecompressor("PluckerDecompress3"); |
773 | if (ntohs(name) == 0) homerecid = ntohs(id); | 760 | break; |
774 | } | 761 | case 4: |
775 | 762 | m_decompress = getdecompressor("PluckerDecompress4"); | |
776 | textlength = 0; | 763 | break; |
777 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | 764 | #endif |
778 | { | 765 | default: |
779 | gotorecordnumber(recptr); | 766 | m_decompress = NULL; |
780 | UInt16 thishdr_uid, thishdr_nParagraphs; | 767 | } |
781 | UInt32 thishdr_size; | 768 | if (m_decompress == NULL) return -1; |
782 | UInt8 thishdr_type, thishdr_reserved; | 769 | |
783 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 770 | setbuffersize(); |
784 | if (thishdr_uid == homerecid) | 771 | compressedtextbuffer = new UInt8[compressedbuffersize]; |
785 | { | 772 | expandedtextbuffer = new UInt8[buffersize]; |
786 | m_homepos = textlength; | 773 | |
787 | break; | 774 | unsigned int nrecs = ntohs(hdr0.nRecords); |
788 | } | 775 | qDebug("Version %u, no. reserved recs %u", ntohs(hdr0.version), nrecs); |
789 | if (thishdr_type < 2) textlength += thishdr_size; | 776 | textlength = ntohl(head.sortInfoID); |
790 | } | 777 | qDebug("Textlength at startup:%u", textlength); |
791 | textlength = 0; | 778 | UInt16 homerecid = 1; |
792 | home(); | 779 | for (unsigned int i = 0; i < nrecs; i++) |
780 | { | ||
781 | UInt16 id, name; | ||
782 | fread(&name, 1, sizeof(name), fin); | ||
783 | fread(&id, 1, sizeof(id), fin); | ||
784 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | ||
785 | if (ntohs(name) == 0) homerecid = ntohs(id); | ||
786 | } | ||
787 | |||
788 | textlength = 0; | ||
789 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
790 | { | ||
791 | gotorecordnumber(recptr); | ||
792 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
793 | UInt32 thishdr_size; | ||
794 | UInt8 thishdr_type, thishdr_reserved; | ||
795 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
796 | if (thishdr_uid == homerecid) | ||
797 | { | ||
798 | m_homepos = textlength; | ||
799 | break; | ||
800 | } | ||
801 | if (thishdr_type < 2) textlength += thishdr_size; | ||
802 | } | ||
803 | qDebug("Found home"); | ||
804 | textlength = 0; | ||
805 | home(); | ||
806 | qDebug("Gone home"); | ||
793 | #ifdef LOCALPICTURES | 807 | #ifdef LOCALPICTURES |
794 | if (m_viewer == NULL) | 808 | if (m_viewer == NULL) |
795 | { | 809 | { |
796 | m_viewer = new QScrollView(NULL); | 810 | m_viewer = new QScrollView(NULL); |
797 | m_picture = new QWidget(m_viewer->viewport()); | 811 | m_picture = new QWidget(m_viewer->viewport()); |
798 | m_viewer->addChild(m_picture); | 812 | m_viewer->addChild(m_picture); |
799 | } | 813 | } |
800 | #endif | 814 | #endif |
801 | return 0; | 815 | return 0; |
802 | 816 | ||
803 | } | 817 | } |
804 | 818 | ||
805 | QImage* CPlucker_base::getimg(UInt16 tgt) | 819 | QImage* CPlucker_base::getimg(UInt16 tgt) |
806 | { | 820 | { |
807 | size_t reclen; | 821 | size_t reclen; |
808 | UInt16 thisrec = finduid(tgt); | 822 | UInt16 thisrec = finduid(tgt); |
809 | reclen = recordlength(thisrec); | 823 | qDebug("getimg:Found %u from uid:%u", thisrec, tgt); |
810 | gotorecordnumber(thisrec); | 824 | reclen = recordlength(thisrec); |
811 | UInt16 thishdr_uid, thishdr_nParagraphs; | 825 | gotorecordnumber(thisrec); |
812 | UInt32 thishdr_size; | 826 | UInt16 thishdr_uid, thishdr_nParagraphs; |
813 | UInt8 thishdr_type, thishdr_reserved; | 827 | UInt32 thishdr_size; |
814 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 828 | UInt8 thishdr_type, thishdr_reserved; |
815 | reclen -= HeaderSize(); | 829 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
816 | 830 | if (thishdr_type == 15) | |
817 | UInt32 imgsize = thishdr_size; | 831 | { |
818 | UInt8* imgbuffer = new UInt8[imgsize]; | 832 | char *buffer = new char[thishdr_size]; |
833 | fread(buffer, thishdr_size, sizeof(char), fin); | ||
834 | unsigned short tmp; | ||
835 | memcpy(&tmp, buffer, sizeof(tmp)); | ||
836 | unsigned short cols = ntohs(tmp); | ||
837 | memcpy(&tmp, buffer+sizeof(tmp), sizeof(tmp)); | ||
838 | unsigned short rows = ntohs(tmp); | ||
839 | qDebug("Found a picture of type:%u [%u,%u]", thishdr_type, rows, cols); | ||
840 | QImage*** images; | ||
841 | images = new QImage**[rows]; | ||
842 | #ifdef _WINDOWS | ||
843 | int i; | ||
844 | for (i = 0; i < rows; i++) | ||
845 | #else | ||
846 | for (int i = 0; i < rows; i++) | ||
847 | #endif | ||
848 | { | ||
849 | images[i] = new QImage*[cols]; | ||
850 | } | ||
851 | int height = 0; | ||
852 | int width = 0; | ||
853 | #ifdef _WINDOWS | ||
854 | for (i = 0; i < rows; i++) | ||
855 | #else | ||
856 | for (int i = 0; i < rows; i++) | ||
857 | #endif | ||
858 | { | ||
859 | width = 0; | ||
860 | for (int j = 0; j < cols; j++) | ||
861 | { | ||
862 | memcpy(&tmp, buffer+(i*cols+j+2)*sizeof(tmp), sizeof(tmp)); | ||
863 | unsigned short uid = ntohs(tmp); | ||
864 | images[i][j] = getimg(uid); | ||
865 | width += images[i][j]->width(); | ||
866 | } | ||
867 | height += images[i][0]->height(); | ||
868 | } | ||
869 | delete [] buffer; | ||
870 | QPixmap pm(width, height); | ||
871 | int hoffset = 0; | ||
872 | #ifdef _WINDOWS | ||
873 | for (i = 0; i < rows; i++) | ||
874 | #else | ||
875 | for (int i = 0; i < rows; i++) | ||
876 | #endif | ||
877 | { | ||
878 | int woffset = 0; | ||
879 | int delht = images[i][0]->height(); | ||
880 | for (int j = 0; j < cols; j++) | ||
881 | { | ||
882 | QPixmap pm2; | ||
883 | pm2.convertFromImage(*(images[i][j])); | ||
884 | delete images[i][j]; | ||
885 | bitBlt(&pm, woffset, hoffset, &pm2, 0, 0, pm2.width(), pm2.height()); | ||
886 | woffset += pm2.width(); | ||
887 | } | ||
888 | hoffset += delht; | ||
889 | } | ||
890 | #ifdef _WINDOWS | ||
891 | for (i = 0; i < rows; i++) | ||
892 | #else | ||
893 | for (int i = 0; i < rows; i++) | ||
894 | #endif | ||
895 | { | ||
896 | delete [] images[i]; | ||
897 | } | ||
898 | delete [] images; | ||
899 | return new QImage(pm.convertToImage()); | ||
900 | } | ||
901 | else | ||
902 | { | ||
903 | qDebug("Found a picture of type:%u", thishdr_type); | ||
904 | reclen -= HeaderSize(); | ||
819 | 905 | ||
820 | Expand(reclen, thishdr_type, imgbuffer, imgsize); | 906 | UInt32 imgsize = thishdr_size; |
907 | UInt8* imgbuffer = new UInt8[imgsize]; | ||
908 | |||
909 | Expand(reclen, thishdr_type, imgbuffer, imgsize); | ||
821 | 910 | ||
822 | return imagefromdata(imgbuffer, imgsize); | 911 | return imagefromdata(imgbuffer, imgsize); |
912 | } | ||
823 | } | 913 | } |
824 | 914 | ||
825 | linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd) | 915 | linkType CPlucker_base::hyperlink(unsigned int n, unsigned int offset, QString& wrd, QString&) |
826 | { | 916 | { |
827 | visited.push_front(n); | 917 | visited.push_front(n); |
828 | UInt16 tuid = (n >> 16); | 918 | UInt16 tuid = (n >> 16); |
829 | n &= 0xffff; | 919 | n &= 0xffff; |
830 | // //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl; | 920 | char *turl = geturl(tuid); |
831 | UInt16 thisrec = 1; | 921 | if (turl != NULL) |
832 | currentpos = 0; | ||
833 | gotorecordnumber(thisrec); | ||
834 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
835 | UInt32 thishdr_size; | ||
836 | UInt8 thishdr_type, thishdr_reserved; | ||
837 | while (1) | ||
838 | { | 922 | { |
839 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 923 | qDebug("URL in PB:%s", turl); |
840 | if (tuid == thishdr_uid) break; | 924 | wrd = turl; |
841 | if (thishdr_type < 2) currentpos += thishdr_size; | 925 | delete [] turl; |
842 | // //odebug << "hyper-cp:" << currentpos << "" << oendl; | 926 | } |
843 | thisrec++; | 927 | else |
844 | if (thisrec >= ntohs(head.recordList.numRecords)) | ||
845 | { | 928 | { |
846 | char *turl = geturl(tuid); | 929 | wrd.truncate(0); |
847 | if (turl == NULL) | 930 | } |
848 | { | 931 | qDebug("Hyper: UID:%u, Para:%u, Offset:%u", tuid, n, offset); |
849 | QMessageBox::information(NULL, | 932 | UInt16 thisrec = 1; |
850 | QString(PROGNAME), | 933 | currentpos = 0; |
851 | QString("Couldn't find link") | 934 | gotorecordnumber(thisrec); |
852 | ); | 935 | UInt16 thishdr_uid, thishdr_nParagraphs; |
853 | } | 936 | UInt32 thishdr_size; |
854 | else | 937 | UInt8 thishdr_type, thishdr_reserved; |
855 | { | 938 | while (1) |
856 | wrd = turl; | 939 | { |
940 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
941 | if (tuid == thishdr_uid) break; | ||
942 | if (thishdr_type < 2) currentpos += thishdr_size; | ||
943 | ////qDebug("hyper-cp:%u", currentpos); | ||
944 | thisrec++; | ||
945 | if (thisrec >= ntohs(head.recordList.numRecords)) | ||
946 | { | ||
947 | if (wrd.isEmpty()) | ||
948 | { | ||
949 | QMessageBox::information(NULL, | ||
950 | QString(PROGNAME), | ||
951 | QString("Couldn't find link") | ||
952 | ); | ||
953 | } | ||
954 | else | ||
955 | { | ||
857 | #ifdef USEQPE | 956 | #ifdef USEQPE |
858 | if (wrd.length() > 10) | 957 | if (wrd.length() > 10) |
859 | { | 958 | { |
860 | Global::statusMessage(wrd.left(8) + ".."); | 959 | Global::statusMessage(wrd.left(8) + ".."); |
861 | } | 960 | } |
862 | else | 961 | else |
863 | { | 962 | { |
864 | Global::statusMessage(wrd); | 963 | Global::statusMessage(wrd); |
865 | } | 964 | } |
866 | #else | 965 | #else |
867 | #endif /* USEQPE */ | 966 | #endif /* USEQPE */ |
868 | //odebug << "Link:" << wrd << "" << oendl; | 967 | //qDebug("Link:%s", (const char*)wrd); |
869 | // setlink(fn, wrd); | 968 | // setlink(fn, wrd); |
870 | delete [] turl; | 969 | } |
871 | } | 970 | return eNone; |
872 | return eNone; | 971 | } |
873 | } | 972 | gotorecordnumber(thisrec); |
874 | gotorecordnumber(thisrec); | 973 | } |
875 | } | 974 | if (thishdr_type > 1) |
876 | if (thishdr_type > 1) | 975 | { |
877 | { | 976 | if (thishdr_type == 4) |
878 | if (thishdr_type == 4) | 977 | { |
879 | { | 978 | QMessageBox::information(NULL, |
880 | QMessageBox::information(NULL, | 979 | QString(PROGNAME), |
881 | QString(PROGNAME), | 980 | QString("Mailto links\nnot yet supported (2)")); |
882 | QString("Mailto links\nnot yet supported (2)")); | 981 | } |
883 | } | 982 | else |
884 | else | 983 | { |
885 | { | 984 | if (thishdr_type > 3 && thishdr_type != 15) |
886 | if (thishdr_type > 3) | 985 | { |
887 | { | 986 | QMessageBox::information(NULL, |
888 | QMessageBox::information(NULL, | 987 | QString(PROGNAME), |
889 | QString(PROGNAME), | 988 | QString("External links\nnot yet supported (2)") |
890 | QString("External links\nnot yet supported (2)") | 989 | ); |
891 | ); | 990 | return eNone; |
892 | return eNone; | 991 | } |
893 | } | 992 | else |
894 | else | 993 | { |
895 | { | ||
896 | #ifdef LOCALPICTURES | 994 | #ifdef LOCALPICTURES |
897 | showimg(tuid); | 995 | showimg(tuid); |
898 | #else | 996 | #else |
899 | return ePicture; | 997 | return ePicture; |
900 | #endif | 998 | #endif |
901 | } | 999 | } |
902 | } | 1000 | } |
903 | return eNone; | 1001 | return eNone; |
904 | } | 1002 | } |
905 | /* | 1003 | /* |
906 | if (thishdr_type == 2 || thishdr_type == 3) | 1004 | if (thishdr_type == 2 || thishdr_type == 3) |
907 | { | 1005 | { |
908 | expandimg(thisrec); | 1006 | expandimg(thisrec); |
909 | 1007 | ||
910 | } | 1008 | } |
911 | */ | 1009 | */ |
912 | else | 1010 | else |
913 | { | 1011 | { |
914 | expand(thisrec); | 1012 | expand(thisrec); |
915 | if (n != 0) | 1013 | unsigned int paraoffset = offset; |
916 | { | 1014 | // unsigned int noff = 0; |
917 | if (n >= m_nParas) | 1015 | if (n != 0) |
918 | { | 1016 | { |
919 | QMessageBox::information(NULL, | 1017 | if (n >= m_nParas) |
920 | QString(PROGNAME), | 1018 | { |
921 | QString("Error in link\nPara # too big") | 1019 | QMessageBox::information(NULL, |
922 | ); | 1020 | QString(PROGNAME), |
923 | return eNone; | 1021 | QString("Error in link\nPara # too big") |
924 | } | 1022 | ); |
925 | unsigned int noff = 0; | 1023 | return eNone; |
926 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; | 1024 | } |
927 | n = noff; | 1025 | unsigned int noff = 0; |
928 | } | 1026 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; |
929 | if (n > thishdr_size) | 1027 | |
930 | { | 1028 | paraoffset += noff; |
931 | QMessageBox::information(NULL, | 1029 | } |
932 | QString(PROGNAME), | 1030 | if (paraoffset > thishdr_size) |
933 | QString("Error in link\nOffset too big") | 1031 | { |
934 | ); | 1032 | QMessageBox::information(NULL, |
935 | return eNone; | 1033 | QString(PROGNAME), |
936 | } | 1034 | QString("Error in link\nOffset too big") |
937 | //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl; | 1035 | ); |
938 | while (bufferpos < n && bufferpos < buffercontent) getch_base(true); | 1036 | return eNone; |
939 | /* // This is faster but the alignment doesn't get set | 1037 | } |
940 | mystyle.unset(); | 1038 | while (bufferpos < paraoffset && bufferpos < buffercontent) getch_base(true); |
941 | bufferpos = n; | 1039 | //qDebug("Hyper:<%u,%u,%u>", paraoffset, bufferpos, currentpos); |
942 | currentpos += n; | 1040 | /* // This is faster but the alignment doesn't get set |
943 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | 1041 | mystyle.unset(); |
944 | { | 1042 | bufferpos = n; |
945 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | 1043 | currentpos += n; |
946 | m_nextParaIndex++; | 1044 | while (bufferpos >= m_nextPara && m_nextPara >= 0) |
947 | if (m_nextParaIndex == m_nParas) | 1045 | { |
948 | { | 1046 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; |
949 | m_nextPara = -1; | 1047 | m_nextParaIndex++; |
950 | } | 1048 | if (m_nextParaIndex == m_nParas) |
951 | else | 1049 | { |
952 | { | 1050 | m_nextPara = -1; |
953 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | 1051 | } |
954 | } | 1052 | else |
955 | } | 1053 | { |
956 | */ | 1054 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; |
957 | } | 1055 | } |
958 | return eLink; | 1056 | } |
1057 | */ | ||
1058 | } | ||
1059 | return eLink; | ||
959 | } | 1060 | } |
960 | 1061 | ||
961 | tchar CPlucker_base::getch_base(bool fast) | 1062 | tchar CPlucker_base::getch_base(bool fast) |
962 | { | 1063 | { |
963 | int ch = bgetch(); | 1064 | int ch = bgetch(); |
964 | while (ch == 0) | 1065 | while (ch == 0) |
965 | { | 1066 | { |
966 | ch = bgetch(); | 1067 | ch = bgetch(); |
967 | // //odebug << "Function:" << ch << "" << oendl; | 1068 | ////qDebug("Function:%x", ch); |
968 | switch (ch) | 1069 | switch (ch) |
969 | { | 1070 | { |
970 | case 0x38: | 1071 | case 0x38: |
971 | // //odebug << "Break:" << locate() << "" << oendl; | 1072 | // //qDebug("Break:%u", locate()); |
972 | if (m_lastBreak == locate()) | 1073 | if (m_lastBreak == locate()) |
973 | { | 1074 | { |
974 | ch = bgetch(); | 1075 | ch = bgetch(); |
975 | } | 1076 | } |
976 | else | 1077 | else |
977 | { | 1078 | { |
978 | ch = 10; | 1079 | ch = 10; |
979 | } | 1080 | } |
980 | m_lastBreak = locate(); | 1081 | m_lastBreak = locate(); |
981 | break; | 1082 | break; |
982 | case 0x0a: | 1083 | case 0x0a: |
983 | case 0x0c: | 1084 | case 0x0c: |
984 | { | 1085 | { |
985 | unsigned long ln = 0; | 1086 | unsigned long ln = 0; |
986 | int skip = ch & 7; | 1087 | int skip = ch & 7; |
987 | for (int i = 0; i < 2; i++) | 1088 | for (int i = 0; i < 2; i++) |
988 | { | 1089 | { |
989 | int ch = bgetch(); | 1090 | int ch = bgetch(); |
990 | ln = (ln << 8) + ch; | 1091 | ln = (ln << 8) + ch; |
991 | // //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl; | 1092 | // //qDebug("ch:%d, ln:%u", ch, ln); |
992 | } | 1093 | } |
993 | if (skip == 2) | 1094 | if (skip == 2) |
994 | { | 1095 | { |
995 | ln <<= 16; | 1096 | ln <<= 16; |
996 | } | 1097 | } |
997 | else | 1098 | else |
998 | { | 1099 | { |
999 | for (int i = 0; i < 2; i++) | 1100 | for (int i = 0; i < 2; i++) |
1000 | { | 1101 | { |
1001 | int ch = bgetch(); | 1102 | int ch = bgetch(); |
1002 | ln = (ln << 8) + ch; | 1103 | ln = (ln << 8) + ch; |
1003 | // //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl; | 1104 | // //qDebug("ch:%d, ln:%u", ch, ln); |
1004 | } | 1105 | } |
1005 | } | 1106 | } |
1006 | // //odebug << "ln:" << ln << "" << oendl; | 1107 | // //qDebug("ln:%u", ln); |
1007 | mystyle.setLink(true); | 1108 | mystyle.setLink(true); |
1008 | mystyle.setData(ln); | 1109 | mystyle.setData(ln); |
1009 | // mystyle.setColour(255, 0, 0); | 1110 | // mystyle.setColour(255, 0, 0); |
1010 | bool hasseen = false; | 1111 | bool hasseen = false; |
1011 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 1112 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
1012 | { | 1113 | { |
1013 | if (*it == ln) | 1114 | if (*it == ln) |
1014 | { | 1115 | { |
1015 | hasseen = true; | 1116 | hasseen = true; |
1016 | break; | 1117 | break; |
1017 | } | 1118 | } |
1018 | } | 1119 | } |
1019 | if (hasseen) | 1120 | if (hasseen) |
1020 | { | 1121 | { |
1021 | mystyle.setStrikethru(); | 1122 | mystyle.setStrikethru(); |
1022 | } | 1123 | } |
1023 | else | 1124 | else |
1024 | { | 1125 | { |
1025 | mystyle.setUnderline(); | 1126 | mystyle.setUnderline(); |
1026 | } | 1127 | } |
1027 | ch = bgetch(); | 1128 | mystyle.setOffset(m_offset); |
1028 | } | 1129 | m_offset = 0; |
1029 | break; | 1130 | ch = bgetch(); |
1030 | case 0x08: | 1131 | } |
1031 | ch = bgetch(); | 1132 | break; |
1032 | // mystyle.setColour(0, 0, 0); | 1133 | case 0x08: |
1033 | mystyle.unsetUnderline(); | 1134 | ch = bgetch(); |
1034 | mystyle.unsetStrikethru(); | 1135 | // mystyle.setColour(0, 0, 0); |
1035 | mystyle.setLink(false); | 1136 | mystyle.unsetUnderline(); |
1036 | mystyle.setData(0); | 1137 | mystyle.unsetStrikethru(); |
1037 | break; | 1138 | mystyle.setLink(false); |
1038 | case 0x40: | 1139 | mystyle.setData(0); |
1039 | mystyle.setItalic(); | 1140 | break; |
1040 | ch = bgetch(); | 1141 | case 0x40: |
1041 | break; | 1142 | mystyle.setItalic(); |
1042 | case 0x48: | 1143 | ch = bgetch(); |
1043 | mystyle.unsetItalic(); | 1144 | break; |
1044 | ch = bgetch(); | 1145 | case 0x48: |
1045 | break; | 1146 | mystyle.unsetItalic(); |
1046 | case 0x11: | 1147 | ch = bgetch(); |
1047 | { | 1148 | break; |
1048 | ch = bgetch(); | 1149 | case 0x11: |
1049 | // //odebug << "Font:" << ch << "" << oendl; | 1150 | { |
1050 | mystyle.setVOffset(0); | 1151 | ch = bgetch(); |
1051 | mystyle.unsetMono(); | 1152 | // //qDebug("Font:%d",ch); |
1052 | mystyle.unsetBold(); | 1153 | mystyle.setVOffset(0); |
1053 | mystyle.setFontSize(0); | 1154 | mystyle.unsetMono(); |
1054 | switch (ch) | 1155 | mystyle.unsetBold(); |
1055 | { | 1156 | switch (ch) |
1056 | case 0: | 1157 | { |
1057 | break; | 1158 | case 0: |
1058 | case 1: | 1159 | mystyle.setFontSize(0); |
1059 | mystyle.setBold(); | 1160 | break; |
1060 | mystyle.setFontSize(3); | 1161 | case 1: |
1061 | break; | 1162 | mystyle.setFontSize(3); |
1062 | case 2: | 1163 | mystyle.setBold(); |
1063 | mystyle.setBold(); | 1164 | break; |
1064 | mystyle.setFontSize(2); | 1165 | case 2: |
1065 | break; | 1166 | mystyle.setFontSize(2); |
1066 | case 3: | 1167 | mystyle.setBold(); |
1067 | mystyle.setBold(); | 1168 | break; |
1068 | mystyle.setFontSize(1); | 1169 | case 3: |
1069 | break; | 1170 | mystyle.setFontSize(1); |
1070 | case 4: | 1171 | mystyle.setBold(); |
1071 | mystyle.setBold(); | 1172 | break; |
1072 | break; | 1173 | case 4: |
1073 | case 5: | 1174 | mystyle.setFontSize(0); |
1074 | mystyle.setBold(); | 1175 | mystyle.setBold(); |
1075 | break; | 1176 | break; |
1076 | case 6: | 1177 | case 5: |
1077 | mystyle.setBold(); | 1178 | mystyle.setFontSize(0); |
1078 | break; | 1179 | mystyle.setBold(); |
1079 | case 7: | 1180 | break; |
1080 | mystyle.setBold(); | 1181 | case 6: |
1081 | break; | 1182 | mystyle.setFontSize(0); |
1082 | case 8: // should be fixed width | 1183 | mystyle.setBold(); |
1083 | //odebug << "Trying fixed width" << oendl; | 1184 | break; |
1084 | mystyle.setMono(); | 1185 | case 7: |
1085 | break; | 1186 | mystyle.setFontSize(0); |
1086 | case 9: | 1187 | mystyle.setBold(); |
1087 | mystyle.setFontSize(-1); | 1188 | break; |
1088 | break; | 1189 | case 8: // should be fixed width |
1089 | case 10: | 1190 | //qDebug("Trying fixed width"); |
1090 | mystyle.setFontSize(-2); | 1191 | mystyle.setFontSize(0); |
1091 | mystyle.setVOffset(1); | 1192 | mystyle.setMono(); |
1092 | break; | 1193 | break; |
1093 | case 11: | 1194 | case 9: |
1094 | mystyle.setFontSize(-2); | 1195 | // mystyle.setFontSize(mystyle.getFontSize()); |
1095 | mystyle.setVOffset(-1); | 1196 | mystyle.setFontSize(-1); |
1096 | break; | 1197 | break; |
1097 | default: | 1198 | case 10: |
1098 | odebug << "Unrecognised font" << oendl; | 1199 | mystyle.setFontSize(-2); |
1099 | break; | 1200 | mystyle.setVOffset(1); |
1100 | } | 1201 | break; |
1101 | ch = bgetch(); | 1202 | case 11: |
1102 | } | 1203 | mystyle.setFontSize(-2); |
1103 | break; | 1204 | mystyle.setVOffset(-1); |
1104 | case 0x29: | 1205 | break; |
1105 | ch = bgetch(); | 1206 | default: |
1106 | switch (ch) | 1207 | qDebug("Unrecognised font"); |
1107 | { | 1208 | break; |
1108 | case 0: | 1209 | } |
1109 | mystyle.setLeftJustify(); | 1210 | ch = bgetch(); |
1110 | // //odebug << "left" << oendl; | 1211 | } |
1111 | break; | 1212 | break; |
1112 | case 1: | 1213 | case 0x29: |
1113 | mystyle.setRightJustify(); | 1214 | ch = bgetch(); |
1114 | // //odebug << "right" << oendl; | 1215 | switch (ch) |
1115 | break; | 1216 | { |
1116 | case 2: | 1217 | case 0: |
1117 | mystyle.setCentreJustify(); | 1218 | mystyle.setLeftJustify(); |
1118 | // //odebug << "centre" << oendl; | 1219 | // //qDebug("left"); |
1119 | break; | 1220 | break; |
1120 | case 3: | 1221 | case 1: |
1121 | mystyle.setFullJustify(); | 1222 | mystyle.setRightJustify(); |
1122 | // //odebug << "full" << oendl; | 1223 | // //qDebug("right"); |
1123 | break; | 1224 | break; |
1124 | 1225 | case 2: | |
1125 | } | 1226 | mystyle.setCentreJustify(); |
1126 | ch = bgetch(); | 1227 | // //qDebug("centre"); |
1127 | break; | 1228 | break; |
1128 | case 0x53: | 1229 | case 3: |
1129 | { | 1230 | mystyle.setFullJustify(); |
1130 | int r = bgetch(); | 1231 | // //qDebug("full"); |
1131 | int g = bgetch(); | 1232 | break; |
1132 | int b = bgetch(); | 1233 | |
1133 | mystyle.setColour(r,g,b); | 1234 | } |
1134 | ch = bgetch(); | 1235 | ch = bgetch(); |
1135 | } | 1236 | break; |
1136 | break; | 1237 | case 0x53: |
1137 | case 0x1a: | 1238 | { |
1138 | case 0x5c: | 1239 | int r = bgetch(); |
1139 | { | 1240 | int g = bgetch(); |
1140 | bool hasalternate = (ch == 0x5c); | 1241 | int b = bgetch(); |
1141 | UInt16 ir = bgetch(); | 1242 | mystyle.setColour(r,g,b); |
1142 | ir = (ir << 8) + bgetch(); | 1243 | ch = bgetch(); |
1143 | if (hasalternate) | 1244 | } |
1144 | { | 1245 | break; |
1145 | //odebug << "Alternate image:" << ir << "" << oendl; | 1246 | case 0x1a: |
1146 | UInt16 ir2 = bgetch(); | 1247 | case 0x5c: |
1147 | ir2 = (ir2 << 8) + bgetch(); | 1248 | { |
1148 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); | 1249 | bool hasalternate = (ch == 0x5c); |
1250 | UInt16 ir = bgetch(); | ||
1251 | ir = (ir << 8) + bgetch(); | ||
1252 | if (hasalternate) | ||
1253 | { | ||
1254 | //qDebug("Alternate image:%x", ir); | ||
1255 | UInt16 ir2 = bgetch(); | ||
1256 | ir2 = (ir2 << 8) + bgetch(); | ||
1257 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); | ||
1149 | #ifdef LOCALPICTURES | 1258 | #ifdef LOCALPICTURES |
1150 | UInt32 ln = ir; | 1259 | UInt32 ln = ir; |
1151 | ln <<= 16; | 1260 | ln <<= 16; |
1152 | mystyle.setLink(true); | 1261 | mystyle.setLink(true); |
1153 | mystyle.setData(ln); | 1262 | mystyle.setData(ln); |
1154 | #endif | 1263 | #endif |
1155 | } | 1264 | } |
1156 | else | 1265 | else |
1157 | { | 1266 | { |
1158 | if (!fast) mystyle.setPicture(true, expandimg(ir)); | 1267 | if (!fast) mystyle.setPicture(true, expandimg(ir)); |
1159 | } | 1268 | } |
1160 | // if (mystyle.getLink()) odebug << "Picture link!" << oendl; | 1269 | // if (mystyle.getLink()) qDebug("Picture link!"); |
1161 | ch = '#'; | 1270 | ch = '#'; |
1162 | } | 1271 | } |
1163 | // ch = bgetch(); | 1272 | // ch = bgetch(); |
1164 | break; | 1273 | break; |
1165 | case 0x33: | 1274 | case 0x33: |
1166 | { | 1275 | { |
1167 | UInt8 h = bgetch(); | 1276 | UInt8 h = bgetch(); |
1168 | UInt8 wc = bgetch(); | 1277 | UInt8 wc = bgetch(); |
1169 | UInt8 pc = bgetch(); | 1278 | UInt8 pc = bgetch(); |
1170 | UInt16 w = wc; | 1279 | UInt16 w = wc; |
1171 | // //odebug << "h,w,pc [" << h << ", " << w << ", " << pc << "]" << oendl; | 1280 | // //qDebug("h,w,pc [%u, %u, %u]", h, w, pc); |
1172 | if (w == 0) | 1281 | if (w == 0) |
1173 | { | 1282 | { |
1174 | w = (m_scrWidth*(unsigned long)pc)/100; | 1283 | w = (m_scrWidth*(unsigned long)pc)/100; |
1175 | } | 1284 | } |
1176 | if (w == 0) w = m_scrWidth; | 1285 | if (w == 0) w = m_scrWidth; |
1177 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); | 1286 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); |
1178 | // if (mystyle.getLink()) //odebug << "hRule link!" << oendl; | 1287 | // if (mystyle.getLink()) //qDebug("hRule link!"); |
1179 | ch = '#'; | 1288 | ch = '#'; |
1180 | } | 1289 | } |
1181 | break; | 1290 | break; |
1182 | case 0x60: | 1291 | case 0x60: |
1183 | mystyle.setUnderline(); | 1292 | mystyle.setUnderline(); |
1184 | ch = bgetch(); | 1293 | ch = bgetch(); |
1185 | break; | 1294 | break; |
1186 | case 0x68: | 1295 | case 0x68: |
1187 | mystyle.unsetUnderline(); | 1296 | mystyle.unsetUnderline(); |
1188 | ch = bgetch(); | 1297 | ch = bgetch(); |
1189 | break; | 1298 | break; |
1190 | case 0x22: | 1299 | case 0x22: |
1191 | ch = bgetch(); | 1300 | ch = bgetch(); |
1192 | mystyle.setLeftMargin(ch); | 1301 | mystyle.setLeftMargin(ch); |
1193 | // //odebug << "Left margin:" << ch << "" << oendl; | 1302 | // //qDebug("Left margin:%d", ch); |
1194 | ch = bgetch(); | 1303 | ch = bgetch(); |
1195 | mystyle.setRightMargin(ch); | 1304 | mystyle.setRightMargin(ch); |
1196 | // //odebug << "Right margin:" << ch << "" << oendl; | 1305 | // //qDebug("Right margin:%d", ch); |
1197 | ch = bgetch(); | 1306 | ch = bgetch(); |
1198 | break; | 1307 | break; |
1199 | case 0x70: | 1308 | case 0x70: |
1200 | mystyle.setStrikethru(); | 1309 | mystyle.setStrikethru(); |
1201 | ch = bgetch(); | 1310 | ch = bgetch(); |
1202 | break; | 1311 | break; |
1203 | case 0x78: | 1312 | case 0x78: |
1204 | mystyle.unsetStrikethru(); | 1313 | mystyle.unsetStrikethru(); |
1205 | ch = bgetch(); | 1314 | ch = bgetch(); |
1206 | break; | 1315 | break; |
1207 | case 0x83: | 1316 | case 0x83: |
1208 | { | 1317 | { |
1209 | int tlen = bgetch(); | 1318 | int tlen = bgetch(); |
1210 | ch = bgetch(); | 1319 | ch = bgetch(); |
1211 | ch <<= 8; | 1320 | ch <<= 8; |
1212 | ch |= (tchar)bgetch(); | 1321 | ch |= (tchar)bgetch(); |
1213 | for (int i = 0; i < tlen; i++) bgetch(); | 1322 | for (int i = 0; i < tlen; i++) bgetch(); |
1214 | //odebug << "Function 83" << oendl; | 1323 | //qDebug("Function 83"); |
1215 | } | 1324 | } |
1216 | break; | 1325 | break; |
1217 | case 0x85: | 1326 | case 0x9a: |
1218 | default: | 1327 | { |
1219 | odebug << "Function:" << ch << " NOT IMPLEMENTED" << oendl; | 1328 | m_offset = 255*bgetch(); |
1220 | { | 1329 | m_offset += bgetch(); |
1221 | int skip = ch & 7; | 1330 | qDebug("Found offset:%u", m_offset); |
1222 | for (int i = 0; i < skip; i++) | 1331 | ch = bgetch(); |
1223 | { | 1332 | } |
1224 | ch = bgetch(); | 1333 | break; |
1225 | //odebug << "Arg " << i << ", " << ch << "" << oendl; | 1334 | case 0x85: |
1226 | } | 1335 | default: |
1227 | ch = bgetch(); | 1336 | qDebug("Function:%x NOT IMPLEMENTED", ch); |
1228 | } | 1337 | { |
1229 | } | 1338 | int skip = ch & 7; |
1230 | } | 1339 | for (int i = 0; i < skip; i++) |
1340 | { | ||
1341 | ch = bgetch(); | ||
1342 | //qDebug("Arg %d, %d", i, ch); | ||
1343 | } | ||
1344 | ch = bgetch(); | ||
1345 | } | ||
1346 | } | ||
1347 | } | ||
1348 | |||
1349 | if (m_lastIsBreak && !mystyle.isMono()) | ||
1350 | { | ||
1351 | while (ch == ' ') | ||
1352 | { | ||
1353 | ch = getch(false); | ||
1354 | } | ||
1355 | } | ||
1356 | |||
1357 | m_lastIsBreak = (ch == 10); | ||
1358 | |||
1359 | return (ch == EOF) ? UEOF : ch; | ||
1360 | } | ||
1231 | 1361 | ||
1232 | if (m_lastIsBreak && !mystyle.isMono()) | 1362 | #include "static.h" |
1233 | { | 1363 | #if defined(__STATIC) && defined(USENEF) |
1234 | while (ch == ' ') | 1364 | #include "Model.h" |
1235 | { | 1365 | void (*CPlucker_base::getdecompressor(const QString& _s))(UInt8*, size_t, UInt8*, size_t) |
1236 | ch = getch(false); | 1366 | { |
1237 | } | 1367 | if (_s == "PluckerDecompress3") |
1238 | } | 1368 | { |
1369 | return PluckerDecompress3; | ||
1370 | } | ||
1371 | if (_s == "PluckerDecompress4") | ||
1372 | { | ||
1373 | return PluckerDecompress4; | ||
1374 | } | ||
1375 | return NULL; | ||
1376 | } | ||
1377 | #else | ||
1239 | 1378 | ||
1240 | m_lastIsBreak = (ch == 10); | 1379 | #include "qfileinfo.h" |
1241 | 1380 | ||
1242 | return (ch == EOF) ? UEOF : ch; | 1381 | #include <dlfcn.h> |
1382 | |||
1383 | void (*CPlucker_base::getdecompressor(const QString& _s))(UInt8*, size_t, UInt8*, size_t) | ||
1384 | { | ||
1385 | QString codecpath(QTReaderUtil::getPluginPath("support")); | ||
1386 | codecpath += "/libpluckerdecompress.so"; | ||
1387 | qDebug("Codec:%s", (const char*)codecpath); | ||
1388 | if (QFile::exists(codecpath)) | ||
1389 | { | ||
1390 | qDebug("Codec:%s", (const char*)codecpath); | ||
1391 | void* handle = dlopen(codecpath, RTLD_LAZY); | ||
1392 | if (handle == 0) | ||
1393 | { | ||
1394 | qDebug("Can't find codec:%s", dlerror()); | ||
1395 | return NULL; | ||
1396 | } | ||
1397 | return (void (*)(UInt8*, size_t, UInt8*, size_t))dlsym(handle, _s); | ||
1398 | } | ||
1399 | return NULL; | ||
1400 | } | ||
1401 | #endif | ||
1402 | |||
1403 | QString CPlucker_base::about() | ||
1404 | { | ||
1405 | QString abt = "Plucker base codec (c) Tim Wentford"; | ||
1406 | if (m_decompress != UnDoc && m_decompress != UnZip) | ||
1407 | { | ||
1408 | abt += "\nSpecial decompression (c) Tim Wentford"; | ||
1409 | } | ||
1410 | return abt; | ||
1243 | } | 1411 | } |
diff --git a/noncore/apps/opie-reader/plucker_base.h b/noncore/apps/opie-reader/plucker_base.h index 131b999..8d74cc2 100644 --- a/noncore/apps/opie-reader/plucker_base.h +++ b/noncore/apps/opie-reader/plucker_base.h | |||
@@ -1,15 +1,15 @@ | |||
1 | #ifndef __PLUCKER_BASE_H | 1 | #ifndef __PLUCKER_BASE_H |
2 | #define __PLUCKER_BASE_H | 2 | #define __PLUCKER_BASE_H |
3 | 3 | ||
4 | #include "useqpe.h" | ||
5 | #include "CExpander.h" | 4 | #include "CExpander.h" |
6 | #include <zlib.h> | 5 | #include <zlib.h> |
7 | #include "ztxt.h" | 6 | #include "ztxt.h" |
8 | #include "pdb.h" | 7 | #include "pdb.h" |
9 | #include "CBuffer.h" | 8 | #include "CBuffer.h" |
10 | #include "my_list.h" | 9 | #include "my_list.h" |
11 | #include "Navigation.h" | 10 | #include "Navigation.h" |
11 | #include "hrule.h" | ||
12 | 12 | ||
13 | struct CPlucker_record0 | 13 | struct CPlucker_record0 |
14 | { | 14 | { |
15 | UInt16 uid; | 15 | UInt16 uid; |
@@ -26,12 +26,14 @@ struct CPluckerbkmk | |||
26 | #ifdef LOCALPICTURES | 26 | #ifdef LOCALPICTURES |
27 | class QScrollView; | 27 | class QScrollView; |
28 | class QWidget; | 28 | class QWidget; |
29 | #endif | 29 | #endif |
30 | class QString; | ||
30 | 31 | ||
31 | class CPlucker_base : public CExpander, public Cpdb | 32 | class CPlucker_base : public Cpdb |
32 | { | 33 | { |
33 | protected: | 34 | protected: |
35 | static const UInt8 continuation_bit; | ||
34 | virtual void setbuffersize() = 0; | 36 | virtual void setbuffersize() = 0; |
35 | virtual void GetHeader(UInt16&, UInt16&, UInt32&, UInt8&, UInt8&) = 0; | 37 | virtual void GetHeader(UInt16&, UInt16&, UInt32&, UInt8&, UInt8&) = 0; |
36 | virtual int HeaderSize() = 0; | 38 | virtual int HeaderSize() = 0; |
37 | unsigned short finduid(unsigned short); | 39 | unsigned short finduid(unsigned short); |
@@ -42,9 +44,9 @@ protected: | |||
42 | #ifdef LOCALPICTURES | 44 | #ifdef LOCALPICTURES |
43 | QScrollView* m_viewer; | 45 | QScrollView* m_viewer; |
44 | QWidget* m_picture; | 46 | QWidget* m_picture; |
45 | #endif | 47 | #endif |
46 | size_t textlength, m_lastBreak; | 48 | size_t textlength, m_lastBreak, m_offset; |
47 | UInt16 uid; | 49 | UInt16 uid; |
48 | int m_nextPara, m_nextParaIndex; | 50 | int m_nextPara, m_nextParaIndex; |
49 | CBufferFace<UInt16> m_ParaOffsets; | 51 | CBufferFace<UInt16> m_ParaOffsets; |
50 | CBufferFace<UInt16> m_ParaAttrs; | 52 | CBufferFace<UInt16> m_ParaAttrs; |
@@ -58,15 +60,18 @@ protected: | |||
58 | UInt8* compressedtextbuffer; | 60 | UInt8* compressedtextbuffer; |
59 | // char* urls; | 61 | // char* urls; |
60 | // size_t urlsize; | 62 | // size_t urlsize; |
61 | size_t bufferpos; | 63 | size_t bufferpos; |
62 | UInt16 bufferrec; | 64 | int bufferrec; |
63 | CPlucker_record0 hdr0; | 65 | CPlucker_record0 hdr0; |
64 | bool m_bufferisreserved; | 66 | bool m_bufferisreserved; |
65 | size_t currentpos; | 67 | size_t currentpos; |
66 | bool expand(int); | 68 | bool expand(int); |
67 | void UnZip(UInt8*, size_t, UInt8*, size_t); | 69 | static void UnZip(UInt8*, size_t, UInt8*, size_t); |
68 | void UnDoc(UInt8*, size_t, UInt8*, size_t); | 70 | static void UnDoc(UInt8*, size_t, UInt8*, size_t); |
71 | |||
72 | void (*m_decompress)(UInt8*, size_t, UInt8*, size_t); | ||
73 | void (*getdecompressor(const QString& _s))(UInt8*, size_t, UInt8*, size_t); | ||
69 | #ifdef LOCALPICTURES | 74 | #ifdef LOCALPICTURES |
70 | void showimg(UInt16 tgt); | 75 | void showimg(UInt16 tgt); |
71 | #endif | 76 | #endif |
72 | QImage* getimg(UInt16 tgt); | 77 | QImage* getimg(UInt16 tgt); |
@@ -74,18 +79,9 @@ protected: | |||
74 | void home(); | 79 | void home(); |
75 | virtual int bgetch() = 0; | 80 | virtual int bgetch() = 0; |
76 | CNavigation m_nav; | 81 | CNavigation m_nav; |
77 | public: | 82 | public: |
78 | #ifdef USEQPE | 83 | QString about(); |
79 | void suspend() | ||
80 | { | ||
81 | CExpander::suspend(fin); | ||
82 | } | ||
83 | void unsuspend() | ||
84 | { | ||
85 | CExpander::unsuspend(fin); | ||
86 | } | ||
87 | #endif | ||
88 | QImage* getPicture(unsigned long tgt); | 84 | QImage* getPicture(unsigned long tgt); |
89 | void sizes(unsigned long& _file, unsigned long& _text); | 85 | void sizes(unsigned long& _file, unsigned long& _text); |
90 | bool hasrandomaccess() { return true; } | 86 | bool hasrandomaccess() { return true; } |
91 | virtual ~CPlucker_base(); | 87 | virtual ~CPlucker_base(); |
@@ -93,21 +89,21 @@ protected: | |||
93 | int OpenFile(const char *src); | 89 | int OpenFile(const char *src); |
94 | virtual tchar getch(bool) = 0; | 90 | virtual tchar getch(bool) = 0; |
95 | tchar getch_base(bool); | 91 | tchar getch_base(bool); |
96 | int getch(); | 92 | int getch(); |
97 | void getch(tchar&, CStyle&); | 93 | void getch(tchar&, CStyle&, unsigned long& pos); |
98 | unsigned int locate(); | 94 | unsigned int locate(); |
99 | void locate(unsigned int n); | 95 | void locate(unsigned int n); |
100 | CList<Bkmk>* getbkmklist(); | 96 | CList<Bkmk>* getbkmklist(); |
101 | linkType hyperlink(unsigned int n, QString&); | 97 | linkType hyperlink(unsigned int, unsigned int, QString&, QString&); |
102 | MarkupType PreferredMarkup() | 98 | MarkupType PreferredMarkup() |
103 | { | 99 | { |
104 | return cNONE; | 100 | return cNONE; |
105 | } | 101 | } |
106 | void saveposn(size_t posn) { m_nav.saveposn(posn); } | 102 | void saveposn(size_t posn) { m_nav.saveposn(posn); } |
107 | void writeposn(size_t posn) { m_nav.writeposn(posn); } | 103 | void writeposn(size_t posn) { m_nav.writeposn(posn); } |
108 | bool forward(size_t& loc) { return m_nav.forward(loc); } | 104 | linkType forward(size_t& loc) { return (m_nav.forward(loc)) ? eLink : eNone; } |
109 | bool back(size_t& loc) { return m_nav.back(loc); } | 105 | linkType back(size_t& loc) { return (m_nav.back(loc)) ? eLink : eNone; } |
110 | bool hasnavigation() { return true; } | 106 | bool hasnavigation() { return true; } |
111 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | 107 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); |
112 | void putSaveData(unsigned char*& src, unsigned short& srclen); | 108 | void putSaveData(unsigned char*& src, unsigned short& srclen); |
113 | 109 | ||
diff --git a/noncore/apps/opie-reader/pluckerbaselib.mak b/noncore/apps/opie-reader/pluckerbaselib.mak new file mode 100644 index 0000000..325f3c3 --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib.mak | |||
@@ -0,0 +1,169 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libreader_pluckerbase.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:40:18 2004 | ||
4 | # Project: pluckerbaselib.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o pluckerbaselib.mak pluckerbaselib.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libreader_pluckerbase.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = pdb.h | ||
47 | SOURCES = plucker_base.cpp | ||
48 | OBJECTS = QREADEROBJS/plucker_base.o | ||
49 | FORMS = | ||
50 | UICDECLS = | ||
51 | UICIMPLS = | ||
52 | SRCMOC = | ||
53 | OBJMOC = | ||
54 | DIST = pluckerbaselib.pro | ||
55 | QMAKE_TARGET = reader_pluckerbase | ||
56 | DESTDIR = $(READERDIR)/lib/ | ||
57 | TARGET = libreader_pluckerbase.so.1.0.0 | ||
58 | TARGETA= $(READERDIR)/lib/libreader_pluckerbase.a | ||
59 | TARGETD= libreader_pluckerbase.so.1.0.0 | ||
60 | TARGET0= libreader_pluckerbase.so | ||
61 | TARGET1= libreader_pluckerbase.so.1 | ||
62 | TARGET2= libreader_pluckerbase.so.1.0 | ||
63 | |||
64 | first: all | ||
65 | ####### Implicit rules | ||
66 | |||
67 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
68 | |||
69 | .cpp.o: | ||
70 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
71 | |||
72 | .cc.o: | ||
73 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
74 | |||
75 | .cxx.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .C.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .c.o: | ||
82 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | ####### Build rules | ||
85 | |||
86 | all: pluckerbaselib.mak $(READERDIR)/lib/$(TARGET) | ||
87 | |||
88 | $(READERDIR)/lib/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
89 | test -d $(READERDIR)/lib/ || mkdir -p $(READERDIR)/lib/ | ||
90 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
91 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
92 | -ln -s $(TARGET) $(TARGET0) | ||
93 | -ln -s $(TARGET) $(TARGET1) | ||
94 | -ln -s $(TARGET) $(TARGET2) | ||
95 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) | ||
96 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) | ||
97 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET1) | ||
98 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET2) | ||
99 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/lib/ | ||
100 | |||
101 | |||
102 | |||
103 | staticlib: $(TARGETA) | ||
104 | |||
105 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
106 | -$(DEL_FILE) $(TARGETA) | ||
107 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
108 | |||
109 | mocables: $(SRCMOC) | ||
110 | uicables: $(UICDECLS) $(UICIMPLS) | ||
111 | |||
112 | $(MOC): | ||
113 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
114 | |||
115 | pluckerbaselib.mak: pluckerbaselib.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
116 | $(QMAKE) -o pluckerbaselib.mak pluckerbaselib.pro | ||
117 | qmake: | ||
118 | @$(QMAKE) -o pluckerbaselib.mak pluckerbaselib.pro | ||
119 | |||
120 | dist: | ||
121 | @mkdir -p QREADEROBJS/reader_pluckerbase && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/reader_pluckerbase/ && ( cd `dirname QREADEROBJS/reader_pluckerbase` && $(TAR) reader_pluckerbase.tar reader_pluckerbase && $(GZIP) reader_pluckerbase.tar ) && $(MOVE) `dirname QREADEROBJS/reader_pluckerbase`/reader_pluckerbase.tar.gz . && $(DEL_FILE) -r QREADEROBJS/reader_pluckerbase | ||
122 | |||
123 | mocclean: | ||
124 | |||
125 | uiclean: | ||
126 | |||
127 | yaccclean: | ||
128 | lexclean: | ||
129 | clean: | ||
130 | -$(DEL_FILE) $(OBJECTS) | ||
131 | -$(DEL_FILE) *~ core *.core | ||
132 | |||
133 | |||
134 | ####### Sub-libraries | ||
135 | |||
136 | distclean: clean | ||
137 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) $(TARGET) | ||
138 | -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) $(READERDIR)/lib/$(TARGET1) $(READERDIR)/lib/$(TARGET2) $(TARGETA) | ||
139 | |||
140 | |||
141 | FORCE: | ||
142 | |||
143 | ####### Compile | ||
144 | |||
145 | QREADEROBJS/plucker_base.o: plucker_base.cpp QREADERINC/useqpe.h \ | ||
146 | QREADERINC/static.h \ | ||
147 | plucker_base.h \ | ||
148 | Aportis.h \ | ||
149 | hrule.h \ | ||
150 | CExpander.h \ | ||
151 | ztxt.h \ | ||
152 | pdb.h \ | ||
153 | CBuffer.h \ | ||
154 | my_list.h \ | ||
155 | Navigation.h \ | ||
156 | config.h \ | ||
157 | StyleConsts.h \ | ||
158 | Markups.h \ | ||
159 | names.h \ | ||
160 | linktype.h \ | ||
161 | ustring.h | ||
162 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/plucker_base.o plucker_base.cpp | ||
163 | |||
164 | ####### Install | ||
165 | |||
166 | install: all | ||
167 | |||
168 | uninstall: | ||
169 | |||
diff --git a/noncore/apps/opie-reader/pluckerbaselib.omak b/noncore/apps/opie-reader/pluckerbaselib.omak new file mode 100644 index 0000000..605eabd --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib.omak | |||
@@ -0,0 +1,131 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_pluckerbase.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: pluckerbaselib.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_pluckerbase.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =plucker_base.cpp | ||
30 | OBJECTS =OREADEROBJS/plucker_base.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libreader_pluckerbase.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/lib/libreader_pluckerbase.a | ||
39 | TARGETD =libreader_pluckerbase.so.1.0.0 | ||
40 | TARGET0 =libreader_pluckerbase.so | ||
41 | TARGET1 =libreader_pluckerbase.so.1 | ||
42 | TARGET2 =libreader_pluckerbase.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
76 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: pluckerbaselib.omak | ||
90 | |||
91 | pluckerbaselib.omak: pluckerbaselib.opro | ||
92 | tmake pluckerbaselib.opro -o pluckerbaselib.omak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) pluckerbaselib.opro.tar pluckerbaselib.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) pluckerbaselib.opro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | OREADEROBJS/plucker_base.o: plucker_base.cpp \ | ||
112 | OREADERINC/useqpe.h \ | ||
113 | OREADERINC/static.h \ | ||
114 | plucker_base.h \ | ||
115 | CExpander.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | StyleConsts.h \ | ||
119 | Markups.h \ | ||
120 | names.h \ | ||
121 | linktype.h \ | ||
122 | ztxt.h \ | ||
123 | pdb.h \ | ||
124 | CBuffer.h \ | ||
125 | my_list.h \ | ||
126 | Navigation.h \ | ||
127 | hrule.h \ | ||
128 | Aportis.h \ | ||
129 | Model.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/plucker_base.o plucker_base.cpp | ||
131 | |||
diff --git a/noncore/apps/opie-reader/pluckerbaselib.wmak b/noncore/apps/opie-reader/pluckerbaselib.wmak new file mode 100644 index 0000000..3cc63a4 --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib.wmak | |||
@@ -0,0 +1,131 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_pluckerbase.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: pluckerbaselib.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_pluckerbase.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =plucker_base.cpp | ||
30 | OBJECTS =WSREADEROBJS/plucker_base.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libreader_pluckerbase.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/lib/libreader_pluckerbase.a | ||
39 | TARGETD =libreader_pluckerbase.so.1.0.0 | ||
40 | TARGET0 =libreader_pluckerbase.so | ||
41 | TARGET1 =libreader_pluckerbase.so.1 | ||
42 | TARGET2 =libreader_pluckerbase.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
76 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: pluckerbaselib.wmak | ||
90 | |||
91 | pluckerbaselib.wmak: pluckerbaselib.wpro | ||
92 | tmake pluckerbaselib.wpro -o pluckerbaselib.wmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) pluckerbaselib.wpro.tar pluckerbaselib.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) pluckerbaselib.wpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | WSREADEROBJS/plucker_base.o: plucker_base.cpp \ | ||
112 | WSREADERINC/useqpe.h \ | ||
113 | WSREADERINC/static.h \ | ||
114 | plucker_base.h \ | ||
115 | CExpander.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | StyleConsts.h \ | ||
119 | Markups.h \ | ||
120 | names.h \ | ||
121 | linktype.h \ | ||
122 | ztxt.h \ | ||
123 | pdb.h \ | ||
124 | CBuffer.h \ | ||
125 | my_list.h \ | ||
126 | Navigation.h \ | ||
127 | hrule.h \ | ||
128 | Aportis.h \ | ||
129 | Model.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/plucker_base.o plucker_base.cpp | ||
131 | |||
diff --git a/noncore/apps/opie-reader/pluckerbaselib.wpro b/noncore/apps/opie-reader/pluckerbaselib.wpro new file mode 100644 index 0000000..6798c0d --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib.wpro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = pdb.h | ||
4 | |||
5 | SOURCES = plucker_base.cpp | ||
6 | |||
7 | INTERFACES= | ||
8 | DESTDIR = $(QTDIR)/lib | ||
9 | TARGET = reader_pluckerbase | ||
10 | |||
11 | OBJECTS_DIR = WSREADEROBJS | ||
12 | MOC_DIR = WSREADERMOCS | ||
13 | INCLUDEPATH+= WSREADERINC | ||
14 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/pluckerbaselib.zmak b/noncore/apps/opie-reader/pluckerbaselib.zmak new file mode 100644 index 0000000..16dd6e4 --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib.zmak | |||
@@ -0,0 +1,131 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libreader_pluckerbase.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: pluckerbaselib.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libreader_pluckerbase.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =pdb.h | ||
29 | SOURCES =plucker_base.cpp | ||
30 | OBJECTS =ZREADEROBJS/plucker_base.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC = | ||
35 | OBJMOC = | ||
36 | DIST = | ||
37 | TARGET =libreader_pluckerbase.so.1.0.0 | ||
38 | TARGETA =$(QTDIR)/lib/libreader_pluckerbase.a | ||
39 | TARGETD =libreader_pluckerbase.so.1.0.0 | ||
40 | TARGET0 =libreader_pluckerbase.so | ||
41 | TARGET1 =libreader_pluckerbase.so.1 | ||
42 | TARGET2 =libreader_pluckerbase.so.1.0 | ||
43 | INTERFACE_DECL_PATH = . | ||
44 | |||
45 | ####### Implicit rules | ||
46 | |||
47 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
48 | |||
49 | .cpp.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .cxx.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .cc.o: | ||
56 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | .C.o: | ||
59 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
60 | |||
61 | .c.o: | ||
62 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
63 | |||
64 | ####### Build rules | ||
65 | |||
66 | |||
67 | all: $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0 | ||
68 | |||
69 | $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
70 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
71 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
72 | -ln -s $(TARGET) $(TARGET0) | ||
73 | -ln -s $(TARGET) $(TARGET1) | ||
74 | -ln -s $(TARGET) $(TARGET2) | ||
75 | -rm -f $(QTDIR)/lib/$(TARGET) | ||
76 | -rm -f $(QTDIR)/lib/$(TARGET0) | ||
77 | -rm -f $(QTDIR)/lib/$(TARGET1) | ||
78 | -rm -f $(QTDIR)/lib/$(TARGET2) | ||
79 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/ | ||
80 | |||
81 | staticlib: $(TARGETA) | ||
82 | |||
83 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
84 | -rm -f $(TARGETA) | ||
85 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
86 | |||
87 | moc: $(SRCMOC) | ||
88 | |||
89 | tmake: pluckerbaselib.zmak | ||
90 | |||
91 | pluckerbaselib.zmak: pluckerbaselib.zpro | ||
92 | tmake pluckerbaselib.zpro -o pluckerbaselib.zmak | ||
93 | |||
94 | dist: | ||
95 | $(TAR) pluckerbaselib.zpro.tar pluckerbaselib.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
96 | $(GZIP) pluckerbaselib.zpro.tar | ||
97 | |||
98 | clean: | ||
99 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
100 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
101 | -rm -f *~ core | ||
102 | |||
103 | ####### Sub-libraries | ||
104 | |||
105 | |||
106 | ###### Combined headers | ||
107 | |||
108 | |||
109 | ####### Compile | ||
110 | |||
111 | ZREADEROBJS/plucker_base.o: plucker_base.cpp \ | ||
112 | ZREADERINC/useqpe.h \ | ||
113 | ZREADERINC/static.h \ | ||
114 | plucker_base.h \ | ||
115 | CExpander.h \ | ||
116 | config.h \ | ||
117 | ustring.h \ | ||
118 | StyleConsts.h \ | ||
119 | Markups.h \ | ||
120 | names.h \ | ||
121 | linktype.h \ | ||
122 | ztxt.h \ | ||
123 | pdb.h \ | ||
124 | CBuffer.h \ | ||
125 | my_list.h \ | ||
126 | Navigation.h \ | ||
127 | hrule.h \ | ||
128 | Aportis.h \ | ||
129 | Model.h | ||
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/plucker_base.o plucker_base.cpp | ||
131 | |||
diff --git a/noncore/apps/opie-reader/pluckerbaselib.zpro b/noncore/apps/opie-reader/pluckerbaselib.zpro new file mode 100644 index 0000000..006aa07 --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib.zpro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = pdb.h | ||
4 | |||
5 | SOURCES = plucker_base.cpp | ||
6 | |||
7 | INTERFACES= | ||
8 | DESTDIR = $(QTDIR)/lib | ||
9 | TARGET = reader_pluckerbase | ||
10 | |||
11 | OBJECTS_DIR = ZREADEROBJS | ||
12 | MOC_DIR = ZREADERMOCS | ||
13 | INCLUDEPATH+= ZREADERINC | ||
14 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/pluckerbaselib/.cvsignore b/noncore/apps/opie-reader/pluckerbaselib/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/pluckerbaselib/pluckerbaselib.pro b/noncore/apps/opie-reader/pluckerbaselib/pluckerbaselib.pro new file mode 100644 index 0000000..bee1a2d --- a/dev/null +++ b/noncore/apps/opie-reader/pluckerbaselib/pluckerbaselib.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = pdb.h \ | ||
6 | util.h | ||
7 | |||
8 | SOURCES = plucker_base.cpp | ||
9 | |||
10 | INTERFACES= | ||
11 | DESTDIR = $(OPIEDIR)/lib | ||
12 | TARGET = reader_pluckerbase | ||
13 | LIBS += -ldl | ||
14 | |||
15 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
16 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
17 | |||
18 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/ppm.cpp b/noncore/apps/opie-reader/ppm.cpp index 1face46..e8bf110 100644 --- a/noncore/apps/opie-reader/ppm.cpp +++ b/noncore/apps/opie-reader/ppm.cpp | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include "arith.h" | ||
3 | #include "ppm.h" | 4 | #include "ppm.h" |
4 | 5 | ||
5 | /**************************************************************************** | 6 | /**************************************************************************** |
6 | * Gestion des noeuds | 7 | * Gestion des noeuds |
diff --git a/noncore/apps/opie-reader/ppm_expander.cpp b/noncore/apps/opie-reader/ppm_expander.cpp index fe2745c..ea5b955 100644 --- a/noncore/apps/opie-reader/ppm_expander.cpp +++ b/noncore/apps/opie-reader/ppm_expander.cpp | |||
@@ -7,8 +7,9 @@ | |||
7 | //#include <unistd.h> | 7 | //#include <unistd.h> |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <string.h> | 9 | #include <string.h> |
10 | #include <time.h> | 10 | #include <time.h> |
11 | #include "static.h" | ||
11 | 12 | ||
12 | /*************************************************************************** | 13 | /*************************************************************************** |
13 | * Interface avec les routines de compression | 14 | * Interface avec les routines de compression |
14 | */ | 15 | */ |
@@ -64,28 +65,28 @@ int ppm_expander::home() | |||
64 | if (fread(&maxnode,sizeof(maxnode),1,my_file_in) != 1) return 1; | 65 | if (fread(&maxnode,sizeof(maxnode),1,my_file_in) != 1) return 1; |
65 | if (fread(&blocksize,sizeof(blocksize),1,my_file_in) != 1) return 1; | 66 | if (fread(&blocksize,sizeof(blocksize),1,my_file_in) != 1) return 1; |
66 | if (fread(&numblocks,sizeof(numblocks),1,my_file_in) != 1) return 1; | 67 | if (fread(&numblocks,sizeof(numblocks),1,my_file_in) != 1) return 1; |
67 | //fprintf(stderr,"<%u,%u,%u>\n",maxnode,blocksize,numblocks); | 68 | //fprintf(stderr,"<%u,%u,%u>\n",maxnode,blocksize,numblocks); |
68 | int err = locate(0,0); | 69 | locate(0,0); |
69 | outbytes = 0; | 70 | outbytes = 0; |
70 | return err; | 71 | return 0; |
71 | } | 72 | } |
72 | 73 | ||
73 | void ppm_expander::locate(unsigned int n) { | 74 | void ppm_expander::locate(unsigned int n) { |
74 | locate(n/blocksize, n%blocksize); | 75 | locate(n/blocksize, n%blocksize); |
75 | outbytes = n; | 76 | outbytes = n; |
76 | } | 77 | } |
77 | 78 | ||
78 | int ppm_expander::locate(unsigned short block, unsigned int n) | 79 | void ppm_expander::locate(unsigned short block, unsigned int n) |
79 | { | 80 | { |
80 | if (needppmend) | 81 | if (needppmend) |
81 | { | 82 | { |
82 | ppm.PPM_End(); | 83 | ppm.PPM_End(); |
83 | needppmend = false; | 84 | needppmend = false; |
84 | } | 85 | } |
85 | size_t fpos; | 86 | size_t fpos; |
86 | fseek(my_file_in,STAT_MAGIC_SIZE+sizeof(maxnode)+sizeof(blocksize)+sizeof(numblocks)+block*sizeof(fpos),SEEK_SET); | 87 | fseek(my_file_in,STAT_MAGIC_SIZE+sizeof(maxnode)+sizeof(blocksize)+sizeof(numblocks)+block*sizeof(fpos),SEEK_SET); |
87 | if (fread(&fpos,sizeof(fpos),1,my_file_in) != 1) return 1; | 88 | fread(&fpos,sizeof(fpos),1,my_file_in); |
88 | fseek(my_file_in,fpos,SEEK_SET); | 89 | fseek(my_file_in,fpos,SEEK_SET); |
89 | 90 | ||
90 | ppm.arith.Arith_DecodeInit(my_read_buf,buf_in,bufsize); | 91 | ppm.arith.Arith_DecodeInit(my_read_buf,buf_in,bufsize); |
91 | int err=ppm.PPM_Init(maxnode); | 92 | int err=ppm.PPM_Init(maxnode); |
@@ -105,4 +106,11 @@ int ppm_expander::getch() { | |||
105 | } | 106 | } |
106 | outbytes++; | 107 | outbytes++; |
107 | return (c==SYM_EOF) ? EOF : c; | 108 | return (c==SYM_EOF) ? EOF : c; |
108 | } | 109 | } |
110 | |||
111 | #ifndef __STATIC | ||
112 | extern "C" | ||
113 | { | ||
114 | CExpander* newcodec() { return new ppm_expander; } | ||
115 | } | ||
116 | #endif | ||
diff --git a/noncore/apps/opie-reader/ppm_expander.h b/noncore/apps/opie-reader/ppm_expander.h index 002de86..a1a3b60 100644 --- a/noncore/apps/opie-reader/ppm_expander.h +++ b/noncore/apps/opie-reader/ppm_expander.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __ppm_expander_h | 1 | #ifndef __ppm_expander_h |
2 | #define __ppm_expander_h | 2 | #define __ppm_expander_h |
3 | 3 | ||
4 | #include "useqpe.h" | 4 | #include "useqpe.h" |
5 | #include "CExpander.h" | 5 | #include "CExpander.h" |
6 | #include <sys/stat.h> | 6 | #include <sys/stat.h> |
7 | 7 | ||
@@ -26,17 +26,18 @@ class ppm_expander : public CExpander { | |||
26 | FILE* my_file_in; | 26 | FILE* my_file_in; |
27 | PPM_ReadBuf* my_read_buf; | 27 | PPM_ReadBuf* my_read_buf; |
28 | ppm_worker ppm; | 28 | ppm_worker ppm; |
29 | public: | 29 | public: |
30 | #ifdef USEQPE | 30 | QString about() { return QString("ppms Codec (c) Tim Wentford\nCompression code (c) Fabrice Bellard"); } |
31 | #ifdef USEQPE | ||
31 | void suspend() | 32 | void suspend() |
32 | { | 33 | { |
33 | CExpander::suspend(my_file_in); | 34 | CExpander::suspend(my_file_in); |
34 | } | 35 | } |
35 | void unsuspend() | 36 | void unsuspend() |
36 | { | 37 | { |
37 | CExpander::unsuspend(my_file_in); | 38 | CExpander::unsuspend(my_file_in); |
38 | } | 39 | } |
39 | #endif | 40 | #endif |
40 | ppm_expander() : needppmend(false), my_file_in(NULL), my_read_buf(NULL) | 41 | ppm_expander() : needppmend(false), my_file_in(NULL), my_read_buf(NULL) |
41 | { | 42 | { |
42 | bufsize = 1024; | 43 | bufsize = 1024; |
@@ -45,9 +46,9 @@ public: | |||
45 | outbytes = 0; | 46 | outbytes = 0; |
46 | } | 47 | } |
47 | int OpenFile(const char* infile); | 48 | int OpenFile(const char* infile); |
48 | int getch(); | 49 | int getch(); |
49 | int locate(unsigned short block, unsigned int n); | 50 | void locate(unsigned short block, unsigned int n); |
50 | virtual ~ppm_expander(); | 51 | virtual ~ppm_expander(); |
51 | unsigned int locate() { return outbytes; } | 52 | unsigned int locate() { return outbytes; } |
52 | void locate(unsigned int n); | 53 | void locate(unsigned int n); |
53 | bool hasrandomaccess() { return (numblocks > 1); } | 54 | bool hasrandomaccess() { return (numblocks > 1); } |
diff --git a/noncore/apps/opie-reader/ppmsCodec.mak b/noncore/apps/opie-reader/ppmsCodec.mak new file mode 100644 index 0000000..19d3a2c --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec.mak | |||
@@ -0,0 +1,178 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libppms.so.1.0.0 | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:41:16 2004 | ||
4 | # Project: ppmsCodec.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o ppmsCodec.mak ppmsCodec.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = -shared -Wl,-soname,libppms.so.1 | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = Aportis.h | ||
47 | SOURCES = ppm_expander.cpp \ | ||
48 | ppm.cpp \ | ||
49 | arith_d.cpp | ||
50 | OBJECTS = QREADEROBJS/ppm_expander.o \ | ||
51 | QREADEROBJS/ppm.o \ | ||
52 | QREADEROBJS/arith_d.o | ||
53 | FORMS = | ||
54 | UICDECLS = | ||
55 | UICIMPLS = | ||
56 | SRCMOC = | ||
57 | OBJMOC = | ||
58 | DIST = ppmsCodec.pro | ||
59 | QMAKE_TARGET = ppms | ||
60 | DESTDIR = $(READERDIR)/codecs/ | ||
61 | TARGET = libppms.so.1.0.0 | ||
62 | TARGETA= $(READERDIR)/codecs/libppms.a | ||
63 | TARGETD= libppms.so.1.0.0 | ||
64 | TARGET0= libppms.so | ||
65 | TARGET1= libppms.so.1 | ||
66 | TARGET2= libppms.so.1.0 | ||
67 | |||
68 | first: all | ||
69 | ####### Implicit rules | ||
70 | |||
71 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
72 | |||
73 | .cpp.o: | ||
74 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
75 | |||
76 | .cc.o: | ||
77 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
78 | |||
79 | .cxx.o: | ||
80 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
81 | |||
82 | .C.o: | ||
83 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
84 | |||
85 | .c.o: | ||
86 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
87 | |||
88 | ####### Build rules | ||
89 | |||
90 | all: ppmsCodec.mak $(READERDIR)/codecs/$(TARGET) | ||
91 | |||
92 | $(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) | ||
93 | test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/ | ||
94 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
95 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
96 | -ln -s $(TARGET) $(TARGET0) | ||
97 | -ln -s $(TARGET) $(TARGET1) | ||
98 | -ln -s $(TARGET) $(TARGET2) | ||
99 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) | ||
100 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) | ||
101 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1) | ||
102 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2) | ||
103 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/ | ||
104 | |||
105 | |||
106 | |||
107 | staticlib: $(TARGETA) | ||
108 | |||
109 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) | ||
110 | -$(DEL_FILE) $(TARGETA) | ||
111 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
112 | |||
113 | mocables: $(SRCMOC) | ||
114 | uicables: $(UICDECLS) $(UICIMPLS) | ||
115 | |||
116 | $(MOC): | ||
117 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
118 | |||
119 | ppmsCodec.mak: ppmsCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
120 | $(QMAKE) -o ppmsCodec.mak ppmsCodec.pro | ||
121 | qmake: | ||
122 | @$(QMAKE) -o ppmsCodec.mak ppmsCodec.pro | ||
123 | |||
124 | dist: | ||
125 | @mkdir -p QREADEROBJS/ppms && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/ppms/ && ( cd `dirname QREADEROBJS/ppms` && $(TAR) ppms.tar ppms && $(GZIP) ppms.tar ) && $(MOVE) `dirname QREADEROBJS/ppms`/ppms.tar.gz . && $(DEL_FILE) -r QREADEROBJS/ppms | ||
126 | |||
127 | mocclean: | ||
128 | |||
129 | uiclean: | ||
130 | |||
131 | yaccclean: | ||
132 | lexclean: | ||
133 | clean: | ||
134 | -$(DEL_FILE) $(OBJECTS) | ||
135 | -$(DEL_FILE) *~ core *.core | ||
136 | |||
137 | |||
138 | ####### Sub-libraries | ||
139 | |||
140 | distclean: clean | ||
141 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET) | ||
142 | -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA) | ||
143 | |||
144 | |||
145 | FORCE: | ||
146 | |||
147 | ####### Compile | ||
148 | |||
149 | QREADEROBJS/ppm_expander.o: ppm_expander.cpp QREADERINC/static.h \ | ||
150 | ppm_expander.h \ | ||
151 | QREADERINC/useqpe.h \ | ||
152 | CExpander.h \ | ||
153 | utypes.h \ | ||
154 | ppm.h \ | ||
155 | arith.h \ | ||
156 | config.h \ | ||
157 | StyleConsts.h \ | ||
158 | Markups.h \ | ||
159 | names.h \ | ||
160 | linktype.h \ | ||
161 | ustring.h | ||
162 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ppm_expander.o ppm_expander.cpp | ||
163 | |||
164 | QREADEROBJS/ppm.o: ppm.cpp arith.h \ | ||
165 | ppm.h \ | ||
166 | utypes.h | ||
167 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ppm.o ppm.cpp | ||
168 | |||
169 | QREADEROBJS/arith_d.o: arith_d.cpp arith.h \ | ||
170 | utypes.h | ||
171 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/arith_d.o arith_d.cpp | ||
172 | |||
173 | ####### Install | ||
174 | |||
175 | install: all | ||
176 | |||
177 | uninstall: | ||
178 | |||
diff --git a/noncore/apps/opie-reader/ppmsCodec.omak b/noncore/apps/opie-reader/ppmsCodec.omak new file mode 100644 index 0000000..c974898 --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec.omak | |||
@@ -0,0 +1,141 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libppms.so.1.0.0 | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: ppmsCodec.opro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libppms.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =Aportis.h | ||
29 | SOURCES =ppm_expander.cpp \ | ||
30 | ppm.cpp \ | ||
31 | arith_d.cpp | ||
32 | OBJECTS =OREADEROBJS/ppm_expander.o \ | ||
33 | OREADEROBJS/ppm.o \ | ||
34 | OREADEROBJS/arith_d.o | ||
35 | INTERFACES = | ||
36 | UICDECLS = | ||
37 | UICIMPLS = | ||
38 | SRCMOC = | ||
39 | OBJMOC = | ||
40 | DIST = | ||
41 | TARGET =libppms.so.1.0.0 | ||
42 | TARGETA =$(QTDIR)/plugins/reader/codecs/libppms.a | ||
43 | TARGETD =libppms.so.1.0.0 | ||
44 | TARGET0 =libppms.so | ||
45 | TARGET1 =libppms.so.1 | ||
46 | TARGET2 =libppms.so.1.0 | ||
47 | INTERFACE_DECL_PATH = . | ||
48 | |||
49 | ####### Implicit rules | ||
50 | |||
51 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
52 | |||
53 | .cpp.o: | ||
54 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
55 | |||
56 | .cxx.o: | ||
57 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
58 | |||
59 | .cc.o: | ||
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
61 | |||
62 | .C.o: | ||
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
64 | |||
65 | .c.o: | ||
66 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
67 | |||
68 | ####### Build rules | ||
69 | |||
70 | |||
71 | all: $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0 | ||
72 | |||
73 | $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
74 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
75 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
76 | -ln -s $(TARGET) $(TARGET0) | ||
77 | -ln -s $(TARGET) $(TARGET1) | ||
78 | -ln -s $(TARGET) $(TARGET2) | ||
79 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
80 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
81 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
82 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
83 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
84 | |||
85 | staticlib: $(TARGETA) | ||
86 | |||
87 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
88 | -rm -f $(TARGETA) | ||
89 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
90 | |||
91 | moc: $(SRCMOC) | ||
92 | |||
93 | tmake: ppmsCodec.omak | ||
94 | |||
95 | ppmsCodec.omak: ppmsCodec.opro | ||
96 | tmake ppmsCodec.opro -o ppmsCodec.omak | ||
97 | |||
98 | dist: | ||
99 | $(TAR) ppmsCodec.opro.tar ppmsCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
100 | $(GZIP) ppmsCodec.opro.tar | ||
101 | |||
102 | clean: | ||
103 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
104 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
105 | -rm -f *~ core | ||
106 | |||
107 | ####### Sub-libraries | ||
108 | |||
109 | |||
110 | ###### Combined headers | ||
111 | |||
112 | |||
113 | ####### Compile | ||
114 | |||
115 | OREADEROBJS/ppm_expander.o: ppm_expander.cpp \ | ||
116 | OREADERINC/static.h \ | ||
117 | ppm_expander.h \ | ||
118 | OREADERINC/useqpe.h \ | ||
119 | CExpander.h \ | ||
120 | config.h \ | ||
121 | ustring.h \ | ||
122 | StyleConsts.h \ | ||
123 | Markups.h \ | ||
124 | names.h \ | ||
125 | linktype.h \ | ||
126 | utypes.h \ | ||
127 | ppm.h \ | ||
128 | arith.h | ||
129 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ppm_expander.o ppm_expander.cpp | ||
130 | |||
131 | OREADEROBJS/ppm.o: ppm.cpp \ | ||
132 | arith.h \ | ||
133 | utypes.h \ | ||
134 | ppm.h | ||
135 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ppm.o ppm.cpp | ||
136 | |||
137 | OREADEROBJS/arith_d.o: arith_d.cpp \ | ||
138 | arith.h \ | ||
139 | utypes.h | ||
140 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/arith_d.o arith_d.cpp | ||
141 | |||
diff --git a/noncore/apps/opie-reader/ppmsCodec.wmak b/noncore/apps/opie-reader/ppmsCodec.wmak new file mode 100644 index 0000000..5d8d4a7 --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec.wmak | |||
@@ -0,0 +1,141 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libppms.so.1.0.0 | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: ppmsCodec.wpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS =-shared -Wl,-soname,libppms.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte | ||
18 | AR =ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =Aportis.h | ||
29 | SOURCES =ppm_expander.cpp \ | ||
30 | ppm.cpp \ | ||
31 | arith_d.cpp | ||
32 | OBJECTS =WSREADEROBJS/ppm_expander.o \ | ||
33 | WSREADEROBJS/ppm.o \ | ||
34 | WSREADEROBJS/arith_d.o | ||
35 | INTERFACES = | ||
36 | UICDECLS = | ||
37 | UICIMPLS = | ||
38 | SRCMOC = | ||
39 | OBJMOC = | ||
40 | DIST = | ||
41 | TARGET =libppms.so.1.0.0 | ||
42 | TARGETA =$(QTDIR)/plugins/reader/codecs/libppms.a | ||
43 | TARGETD =libppms.so.1.0.0 | ||
44 | TARGET0 =libppms.so | ||
45 | TARGET1 =libppms.so.1 | ||
46 | TARGET2 =libppms.so.1.0 | ||
47 | INTERFACE_DECL_PATH = . | ||
48 | |||
49 | ####### Implicit rules | ||
50 | |||
51 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
52 | |||
53 | .cpp.o: | ||
54 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
55 | |||
56 | .cxx.o: | ||
57 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
58 | |||
59 | .cc.o: | ||
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
61 | |||
62 | .C.o: | ||
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
64 | |||
65 | .c.o: | ||
66 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
67 | |||
68 | ####### Build rules | ||
69 | |||
70 | |||
71 | all: $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0 | ||
72 | |||
73 | $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
74 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
75 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
76 | -ln -s $(TARGET) $(TARGET0) | ||
77 | -ln -s $(TARGET) $(TARGET1) | ||
78 | -ln -s $(TARGET) $(TARGET2) | ||
79 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
80 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
81 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
82 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
83 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
84 | |||
85 | staticlib: $(TARGETA) | ||
86 | |||
87 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
88 | -rm -f $(TARGETA) | ||
89 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
90 | |||
91 | moc: $(SRCMOC) | ||
92 | |||
93 | tmake: ppmsCodec.wmak | ||
94 | |||
95 | ppmsCodec.wmak: ppmsCodec.wpro | ||
96 | tmake ppmsCodec.wpro -o ppmsCodec.wmak | ||
97 | |||
98 | dist: | ||
99 | $(TAR) ppmsCodec.wpro.tar ppmsCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
100 | $(GZIP) ppmsCodec.wpro.tar | ||
101 | |||
102 | clean: | ||
103 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
104 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
105 | -rm -f *~ core | ||
106 | |||
107 | ####### Sub-libraries | ||
108 | |||
109 | |||
110 | ###### Combined headers | ||
111 | |||
112 | |||
113 | ####### Compile | ||
114 | |||
115 | WSREADEROBJS/ppm_expander.o: ppm_expander.cpp \ | ||
116 | WSREADERINC/static.h \ | ||
117 | ppm_expander.h \ | ||
118 | WSREADERINC/useqpe.h \ | ||
119 | CExpander.h \ | ||
120 | config.h \ | ||
121 | ustring.h \ | ||
122 | StyleConsts.h \ | ||
123 | Markups.h \ | ||
124 | names.h \ | ||
125 | linktype.h \ | ||
126 | utypes.h \ | ||
127 | ppm.h \ | ||
128 | arith.h | ||
129 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ppm_expander.o ppm_expander.cpp | ||
130 | |||
131 | WSREADEROBJS/ppm.o: ppm.cpp \ | ||
132 | arith.h \ | ||
133 | utypes.h \ | ||
134 | ppm.h | ||
135 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ppm.o ppm.cpp | ||
136 | |||
137 | WSREADEROBJS/arith_d.o: arith_d.cpp \ | ||
138 | arith.h \ | ||
139 | utypes.h | ||
140 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/arith_d.o arith_d.cpp | ||
141 | |||
diff --git a/noncore/apps/opie-reader/ppmsCodec.wpro b/noncore/apps/opie-reader/ppmsCodec.wpro new file mode 100644 index 0000000..f250d90 --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec.wpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = Aportis.h | ||
4 | |||
5 | SOURCES = ppm_expander.cpp \ | ||
6 | ppm.cpp \ | ||
7 | arith_d.cpp | ||
8 | |||
9 | INTERFACES= | ||
10 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
11 | TARGET = ppms | ||
12 | LIBS += -lreader_codec | ||
13 | |||
14 | OBJECTS_DIR = WSREADEROBJS | ||
15 | MOC_DIR = WSREADERMOCS | ||
16 | INCLUDEPATH+= WSREADERINC | ||
17 | DEPENDPATH+= WSREADERINC | ||
diff --git a/noncore/apps/opie-reader/ppmsCodec.zmak b/noncore/apps/opie-reader/ppmsCodec.zmak new file mode 100644 index 0000000..df92c50 --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec.zmak | |||
@@ -0,0 +1,141 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building libppms.so.1.0.0 | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: ppmsCodec.zpro | ||
5 | # Template: lib | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fPIC -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS =-shared -Wl,-soname,libppms.so.1 | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte | ||
18 | AR =arm-linux-ar cqs | ||
19 | RANLIB = | ||
20 | MOC =$(QTDIR)/bin/moc | ||
21 | UIC =$(QTDIR)/bin/uic | ||
22 | |||
23 | TAR =tar -cf | ||
24 | GZIP =gzip -9f | ||
25 | |||
26 | ####### Files | ||
27 | |||
28 | HEADERS =Aportis.h | ||
29 | SOURCES =ppm_expander.cpp \ | ||
30 | ppm.cpp \ | ||
31 | arith_d.cpp | ||
32 | OBJECTS =ZREADEROBJS/ppm_expander.o \ | ||
33 | ZREADEROBJS/ppm.o \ | ||
34 | ZREADEROBJS/arith_d.o | ||
35 | INTERFACES = | ||
36 | UICDECLS = | ||
37 | UICIMPLS = | ||
38 | SRCMOC = | ||
39 | OBJMOC = | ||
40 | DIST = | ||
41 | TARGET =libppms.so.1.0.0 | ||
42 | TARGETA =$(QTDIR)/plugins/reader/codecs/libppms.a | ||
43 | TARGETD =libppms.so.1.0.0 | ||
44 | TARGET0 =libppms.so | ||
45 | TARGET1 =libppms.so.1 | ||
46 | TARGET2 =libppms.so.1.0 | ||
47 | INTERFACE_DECL_PATH = . | ||
48 | |||
49 | ####### Implicit rules | ||
50 | |||
51 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
52 | |||
53 | .cpp.o: | ||
54 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
55 | |||
56 | .cxx.o: | ||
57 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
58 | |||
59 | .cc.o: | ||
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
61 | |||
62 | .C.o: | ||
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
64 | |||
65 | .c.o: | ||
66 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
67 | |||
68 | ####### Build rules | ||
69 | |||
70 | |||
71 | all: $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0 | ||
72 | |||
73 | $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
74 | -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
75 | $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
76 | -ln -s $(TARGET) $(TARGET0) | ||
77 | -ln -s $(TARGET) $(TARGET1) | ||
78 | -ln -s $(TARGET) $(TARGET2) | ||
79 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET) | ||
80 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0) | ||
81 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1) | ||
82 | -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2) | ||
83 | -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/ | ||
84 | |||
85 | staticlib: $(TARGETA) | ||
86 | |||
87 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
88 | -rm -f $(TARGETA) | ||
89 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
90 | |||
91 | moc: $(SRCMOC) | ||
92 | |||
93 | tmake: ppmsCodec.zmak | ||
94 | |||
95 | ppmsCodec.zmak: ppmsCodec.zpro | ||
96 | tmake ppmsCodec.zpro -o ppmsCodec.zmak | ||
97 | |||
98 | dist: | ||
99 | $(TAR) ppmsCodec.zpro.tar ppmsCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
100 | $(GZIP) ppmsCodec.zpro.tar | ||
101 | |||
102 | clean: | ||
103 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
104 | -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA) | ||
105 | -rm -f *~ core | ||
106 | |||
107 | ####### Sub-libraries | ||
108 | |||
109 | |||
110 | ###### Combined headers | ||
111 | |||
112 | |||
113 | ####### Compile | ||
114 | |||
115 | ZREADEROBJS/ppm_expander.o: ppm_expander.cpp \ | ||
116 | ZREADERINC/static.h \ | ||
117 | ppm_expander.h \ | ||
118 | ZREADERINC/useqpe.h \ | ||
119 | CExpander.h \ | ||
120 | config.h \ | ||
121 | ustring.h \ | ||
122 | StyleConsts.h \ | ||
123 | Markups.h \ | ||
124 | names.h \ | ||
125 | linktype.h \ | ||
126 | utypes.h \ | ||
127 | ppm.h \ | ||
128 | arith.h | ||
129 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ppm_expander.o ppm_expander.cpp | ||
130 | |||
131 | ZREADEROBJS/ppm.o: ppm.cpp \ | ||
132 | arith.h \ | ||
133 | utypes.h \ | ||
134 | ppm.h | ||
135 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ppm.o ppm.cpp | ||
136 | |||
137 | ZREADEROBJS/arith_d.o: arith_d.cpp \ | ||
138 | arith.h \ | ||
139 | utypes.h | ||
140 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/arith_d.o arith_d.cpp | ||
141 | |||
diff --git a/noncore/apps/opie-reader/ppmsCodec.zpro b/noncore/apps/opie-reader/ppmsCodec.zpro new file mode 100644 index 0000000..f758118 --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec.zpro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release dll | ||
3 | HEADERS = Aportis.h | ||
4 | |||
5 | SOURCES = ppm_expander.cpp \ | ||
6 | ppm.cpp \ | ||
7 | arith_d.cpp | ||
8 | |||
9 | INTERFACES= | ||
10 | DESTDIR = $(QTDIR)/plugins/reader/codecs | ||
11 | TARGET = ppms | ||
12 | LIBS += -lreader_codec | ||
13 | |||
14 | OBJECTS_DIR = ZREADEROBJS | ||
15 | MOC_DIR = ZREADERMOCS | ||
16 | INCLUDEPATH+= ZREADERINC | ||
17 | DEPENDPATH+= ZREADERINC | ||
diff --git a/noncore/apps/opie-reader/ppmsCodec/.cvsignore b/noncore/apps/opie-reader/ppmsCodec/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/ppmsCodec/ppmsCodec.pro b/noncore/apps/opie-reader/ppmsCodec/ppmsCodec.pro new file mode 100644 index 0000000..8699d3b --- a/dev/null +++ b/noncore/apps/opie-reader/ppmsCodec/ppmsCodec.pro | |||
@@ -0,0 +1,19 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= lib | ||
4 | CONFIG = qt warn_on release dll | ||
5 | HEADERS = Aportis.h | ||
6 | |||
7 | SOURCES = ppm_expander.cpp \ | ||
8 | ppm.cpp \ | ||
9 | arith_d.cpp | ||
10 | |||
11 | INTERFACES= | ||
12 | DESTDIR = $(OPIEDIR)/plugins/reader/codecs | ||
13 | TARGET = ppms | ||
14 | LIBS += -lreader_codec | ||
15 | |||
16 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
17 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
18 | |||
19 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/preferences.cpp b/noncore/apps/opie-reader/preferences.cpp new file mode 100755 index 0000000..b9397cf --- a/dev/null +++ b/noncore/apps/opie-reader/preferences.cpp | |||
@@ -0,0 +1,105 @@ | |||
1 | #include "useqpe.h" | ||
2 | #ifndef USEQPE | ||
3 | |||
4 | #include "preferences.h" | ||
5 | |||
6 | #include <qfile.h> | ||
7 | #include <qtextstream.h> | ||
8 | |||
9 | Config::Config(const QString& _fn) : fname(_fn) | ||
10 | { | ||
11 | // qDebug("Config::Config:%s", (const char*)fname); | ||
12 | QFile fl(fname); | ||
13 | if (fl.open(IO_ReadOnly)) | ||
14 | { | ||
15 | QTextStream t(&fl); | ||
16 | QString key, value; | ||
17 | while (!t.eof()) | ||
18 | { | ||
19 | QString data = t.readLine(); | ||
20 | int colon = data.find(':'); | ||
21 | if (colon > 0) | ||
22 | { | ||
23 | QString key = data.left(colon); | ||
24 | QString value = data.right(data.length()-colon-1); | ||
25 | values[key] = value; | ||
26 | } | ||
27 | } | ||
28 | fl.close(); | ||
29 | } | ||
30 | // read entries into values | ||
31 | } | ||
32 | Config::~Config() | ||
33 | { | ||
34 | // qDebug("Config::~Config:%s", (const char*)fname); | ||
35 | QFile fl(fname); | ||
36 | if (fl.open(IO_WriteOnly)) | ||
37 | { | ||
38 | QTextStream t(&fl); | ||
39 | for (QMap<QString,QString>::Iterator iter = values.begin(); | ||
40 | iter != values.end(); | ||
41 | iter++) | ||
42 | { | ||
43 | t << iter.key() << ':' << iter.data() << '\n'; | ||
44 | } | ||
45 | fl.close(); | ||
46 | } | ||
47 | } | ||
48 | QString Config::readEntry(const QString& key, const QString& deflt) | ||
49 | { | ||
50 | QMap<QString,QString>::Iterator iter = values.find(key); | ||
51 | if (iter != values.end()) | ||
52 | { | ||
53 | return iter.data(); | ||
54 | } | ||
55 | else | ||
56 | { | ||
57 | return deflt; | ||
58 | } | ||
59 | } | ||
60 | bool Config::readBoolEntry(const QString& key, const bool deflt) | ||
61 | { | ||
62 | bool ok; | ||
63 | QMap<QString,QString>::Iterator iter = values.find(key); | ||
64 | if (iter != values.end()) | ||
65 | { | ||
66 | int ret = iter.data().toInt(&ok); | ||
67 | return ((ok) ? !!ret : deflt); | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | return deflt; | ||
72 | } | ||
73 | } | ||
74 | int Config::readNumEntry(const QString& key, const int deflt) | ||
75 | { | ||
76 | bool ok; | ||
77 | QMap<QString,QString>::Iterator iter = values.find(key); | ||
78 | if (iter != values.end()) | ||
79 | { | ||
80 | int ret = iter.data().toInt(&ok); | ||
81 | return ((ok) ? ret : deflt); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | return deflt; | ||
86 | } | ||
87 | } | ||
88 | void Config::writeEntry(const QString& key, const QString& value) | ||
89 | { | ||
90 | values[key] = value; | ||
91 | } | ||
92 | |||
93 | void Config::writeEntry(const QString& key, const bool value) | ||
94 | { | ||
95 | values[key] = (value) ? "1" : "0"; | ||
96 | } | ||
97 | |||
98 | void Config::writeEntry(const QString& key, const int value) | ||
99 | { | ||
100 | QString rhs; | ||
101 | rhs.setNum(value); | ||
102 | values[key] = rhs; | ||
103 | } | ||
104 | |||
105 | #endif | ||
diff --git a/noncore/apps/opie-reader/preferences.h b/noncore/apps/opie-reader/preferences.h new file mode 100644 index 0000000..69d1774 --- a/dev/null +++ b/noncore/apps/opie-reader/preferences.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #include "useqpe.h" | ||
2 | #ifndef USEQPE | ||
3 | #ifndef __PREFERENCES_H | ||
4 | #define __PREFERENCES_H | ||
5 | |||
6 | #include <qstring.h> | ||
7 | #include <qmap.h> | ||
8 | |||
9 | class Config | ||
10 | { | ||
11 | QMap<QString, QString> values; | ||
12 | QString fname; | ||
13 | public: | ||
14 | Config(const QString& fname); | ||
15 | ~Config(); | ||
16 | void setGroup(const QString& s) { } | ||
17 | QString readEntry(const QString&, const QString&); | ||
18 | bool readBoolEntry(const QString&, const bool); | ||
19 | int readNumEntry(const QString&, const int); | ||
20 | |||
21 | void writeEntry(const QString&, const QString&); | ||
22 | void writeEntry(const QString&, const bool); | ||
23 | void writeEntry(const QString&, const int); | ||
24 | }; | ||
25 | |||
26 | #endif // PREFERENCES | ||
27 | #endif | ||
diff --git a/noncore/apps/opie-reader/reader.mak b/noncore/apps/opie-reader/reader.mak new file mode 100644 index 0000000..4bc2eec --- a/dev/null +++ b/noncore/apps/opie-reader/reader.mak | |||
@@ -0,0 +1,591 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: ../bin/uqtreader | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:41:42 2004 | ||
4 | # Project: reader.pro | ||
5 | # Template: app | ||
6 | # Command: $(QMAKE) -o reader.mak reader.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG | ||
16 | CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_codec -lqt-mt -lXext -lX11 -lm | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = Aportis.h \ | ||
47 | Bkmks.h \ | ||
48 | BuffDoc.h \ | ||
49 | ButtonPrefs.h \ | ||
50 | CAnnoEdit.h \ | ||
51 | CBuffer.h \ | ||
52 | CDrawBuffer.h \ | ||
53 | CEncoding.h \ | ||
54 | CEncoding_tables.h \ | ||
55 | CExpander.h \ | ||
56 | CFilter.h \ | ||
57 | CloseDialog.h \ | ||
58 | Filedata.h \ | ||
59 | FixedFont.h \ | ||
60 | FontControl.h \ | ||
61 | GraphicWin.h \ | ||
62 | Markups.h \ | ||
63 | Navigation.h \ | ||
64 | Palm2QImage.h \ | ||
65 | Prefs.h \ | ||
66 | QFloatBar.h \ | ||
67 | QTReader.h \ | ||
68 | QTReaderApp.h \ | ||
69 | QtrListView.h \ | ||
70 | Queue.h \ | ||
71 | StyleConsts.h \ | ||
72 | ToolbarPrefs.h \ | ||
73 | URLDialog.h \ | ||
74 | ZText.h \ | ||
75 | arith.h \ | ||
76 | cbkmkselector.h \ | ||
77 | config.h \ | ||
78 | infowin.h \ | ||
79 | linktype.h \ | ||
80 | my_list.h \ | ||
81 | names.h \ | ||
82 | QREADERINC/opie.h \ | ||
83 | pdb.h \ | ||
84 | plucker.h \ | ||
85 | plucker_base.h \ | ||
86 | ppm.h \ | ||
87 | ppm_expander.h \ | ||
88 | preferences.h \ | ||
89 | usenef.h \ | ||
90 | QREADERINC/useqpe.h \ | ||
91 | ustring.h \ | ||
92 | util.h \ | ||
93 | utypes.h \ | ||
94 | version.h \ | ||
95 | ztxt.h | ||
96 | SOURCES = BuffDoc.cpp \ | ||
97 | ButtonPrefs.cpp \ | ||
98 | CAnnoEdit.cpp \ | ||
99 | CDrawBuffer.cpp \ | ||
100 | CEncoding.cpp \ | ||
101 | CEncoding_tables.cpp \ | ||
102 | CFilter.cpp \ | ||
103 | CRegExp.cpp \ | ||
104 | CloseDialog.cpp \ | ||
105 | FontControl.cpp \ | ||
106 | GraphicWin.cpp \ | ||
107 | Prefs.cpp \ | ||
108 | QTReader.cpp \ | ||
109 | QTReaderApp.cpp \ | ||
110 | QtrListView.cpp \ | ||
111 | ToolbarPrefs.cpp \ | ||
112 | URLDialog.cpp \ | ||
113 | infowin.cpp \ | ||
114 | main.cpp \ | ||
115 | orkey.cpp \ | ||
116 | preferences.cpp \ | ||
117 | util.cpp \ | ||
118 | version.cpp | ||
119 | OBJECTS = QREADEROBJS/BuffDoc.o \ | ||
120 | QREADEROBJS/ButtonPrefs.o \ | ||
121 | QREADEROBJS/CAnnoEdit.o \ | ||
122 | QREADEROBJS/CDrawBuffer.o \ | ||
123 | QREADEROBJS/CEncoding.o \ | ||
124 | QREADEROBJS/CEncoding_tables.o \ | ||
125 | QREADEROBJS/CFilter.o \ | ||
126 | QREADEROBJS/CRegExp.o \ | ||
127 | QREADEROBJS/CloseDialog.o \ | ||
128 | QREADEROBJS/FontControl.o \ | ||
129 | QREADEROBJS/GraphicWin.o \ | ||
130 | QREADEROBJS/Prefs.o \ | ||
131 | QREADEROBJS/QTReader.o \ | ||
132 | QREADEROBJS/QTReaderApp.o \ | ||
133 | QREADEROBJS/QtrListView.o \ | ||
134 | QREADEROBJS/ToolbarPrefs.o \ | ||
135 | QREADEROBJS/URLDialog.o \ | ||
136 | QREADEROBJS/infowin.o \ | ||
137 | QREADEROBJS/main.o \ | ||
138 | QREADEROBJS/orkey.o \ | ||
139 | QREADEROBJS/preferences.o \ | ||
140 | QREADEROBJS/util.o \ | ||
141 | QREADEROBJS/version.o | ||
142 | FORMS = | ||
143 | UICDECLS = | ||
144 | UICIMPLS = | ||
145 | SRCMOC = QREADERMOCS/moc_ButtonPrefs.cpp \ | ||
146 | QREADERMOCS/moc_CAnnoEdit.cpp \ | ||
147 | QREADERMOCS/moc_CloseDialog.cpp \ | ||
148 | QREADERMOCS/moc_GraphicWin.cpp \ | ||
149 | QREADERMOCS/moc_Prefs.cpp \ | ||
150 | QREADERMOCS/moc_QFloatBar.cpp \ | ||
151 | QREADERMOCS/moc_QTReader.cpp \ | ||
152 | QREADERMOCS/moc_QTReaderApp.cpp \ | ||
153 | QREADERMOCS/moc_QtrListView.cpp \ | ||
154 | QREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
155 | QREADERMOCS/moc_URLDialog.cpp \ | ||
156 | QREADERMOCS/moc_cbkmkselector.cpp \ | ||
157 | QREADERMOCS/moc_infowin.cpp | ||
158 | OBJMOC = QREADEROBJS/moc_ButtonPrefs.o \ | ||
159 | QREADEROBJS/moc_CAnnoEdit.o \ | ||
160 | QREADEROBJS/moc_CloseDialog.o \ | ||
161 | QREADEROBJS/moc_GraphicWin.o \ | ||
162 | QREADEROBJS/moc_Prefs.o \ | ||
163 | QREADEROBJS/moc_QFloatBar.o \ | ||
164 | QREADEROBJS/moc_QTReader.o \ | ||
165 | QREADEROBJS/moc_QTReaderApp.o \ | ||
166 | QREADEROBJS/moc_QtrListView.o \ | ||
167 | QREADEROBJS/moc_ToolbarPrefs.o \ | ||
168 | QREADEROBJS/moc_URLDialog.o \ | ||
169 | QREADEROBJS/moc_cbkmkselector.o \ | ||
170 | QREADEROBJS/moc_infowin.o | ||
171 | DIST = reader.pro | ||
172 | QMAKE_TARGET = uqtreader | ||
173 | DESTDIR = ../bin/ | ||
174 | TARGET = ../bin/uqtreader | ||
175 | |||
176 | first: all | ||
177 | ####### Implicit rules | ||
178 | |||
179 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
180 | |||
181 | .cpp.o: | ||
182 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
183 | |||
184 | .cc.o: | ||
185 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
186 | |||
187 | .cxx.o: | ||
188 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
189 | |||
190 | .C.o: | ||
191 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
192 | |||
193 | .c.o: | ||
194 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
195 | |||
196 | ####### Build rules | ||
197 | |||
198 | all: reader.mak $(TARGET) | ||
199 | |||
200 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
201 | test -d ../bin/ || mkdir -p ../bin/ | ||
202 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
203 | |||
204 | mocables: $(SRCMOC) | ||
205 | uicables: $(UICDECLS) $(UICIMPLS) | ||
206 | |||
207 | $(MOC): | ||
208 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
209 | |||
210 | reader.mak: reader.pro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
211 | $(QMAKE) -o reader.mak reader.pro | ||
212 | qmake: | ||
213 | @$(QMAKE) -o reader.mak reader.pro | ||
214 | |||
215 | dist: | ||
216 | @mkdir -p QREADEROBJS/uqtreader && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QREADEROBJS/uqtreader/ && ( cd `dirname QREADEROBJS/uqtreader` && $(TAR) uqtreader.tar uqtreader && $(GZIP) uqtreader.tar ) && $(MOVE) `dirname QREADEROBJS/uqtreader`/uqtreader.tar.gz . && $(DEL_FILE) -r QREADEROBJS/uqtreader | ||
217 | |||
218 | mocclean: | ||
219 | -$(DEL_FILE) $(OBJMOC) | ||
220 | -$(DEL_FILE) $(SRCMOC) | ||
221 | |||
222 | uiclean: | ||
223 | |||
224 | yaccclean: | ||
225 | lexclean: | ||
226 | clean: mocclean | ||
227 | -$(DEL_FILE) $(OBJECTS) | ||
228 | -$(DEL_FILE) *~ core *.core | ||
229 | |||
230 | |||
231 | ####### Sub-libraries | ||
232 | |||
233 | distclean: clean | ||
234 | -$(DEL_FILE) ../bin/$(TARGET) $(TARGET) | ||
235 | |||
236 | |||
237 | FORCE: | ||
238 | |||
239 | ####### Compile | ||
240 | |||
241 | QREADEROBJS/BuffDoc.o: BuffDoc.cpp QREADERINC/static.h \ | ||
242 | names.h \ | ||
243 | BuffDoc.h \ | ||
244 | config.h \ | ||
245 | CDrawBuffer.h \ | ||
246 | ZText.h \ | ||
247 | ebookcodec.h \ | ||
248 | QREADERINC/useqpe.h \ | ||
249 | Aportis.h \ | ||
250 | CHM.h \ | ||
251 | ppm_expander.h \ | ||
252 | ztxt.h \ | ||
253 | plucker.h \ | ||
254 | iSilo.h \ | ||
255 | CFilter.h \ | ||
256 | CExpander.h \ | ||
257 | StyleConsts.h \ | ||
258 | CBuffer.h \ | ||
259 | my_list.h \ | ||
260 | linktype.h \ | ||
261 | ustring.h \ | ||
262 | CEncoding.h \ | ||
263 | Markups.h \ | ||
264 | CEncoding_tables.h \ | ||
265 | pdb.h \ | ||
266 | chm_lib.h \ | ||
267 | utypes.h \ | ||
268 | ppm.h \ | ||
269 | arith.h \ | ||
270 | plucker_base.h \ | ||
271 | Navigation.h \ | ||
272 | hrule.h | ||
273 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/BuffDoc.o BuffDoc.cpp | ||
274 | |||
275 | QREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp ButtonPrefs.h \ | ||
276 | orkey.h | ||
277 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp | ||
278 | |||
279 | QREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp CAnnoEdit.h | ||
280 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp | ||
281 | |||
282 | QREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp CDrawBuffer.h \ | ||
283 | FontControl.h \ | ||
284 | QREADERINC/useqpe.h \ | ||
285 | QREADERINC/opie.h \ | ||
286 | StyleConsts.h \ | ||
287 | CBuffer.h \ | ||
288 | my_list.h \ | ||
289 | linktype.h \ | ||
290 | config.h \ | ||
291 | ustring.h | ||
292 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp | ||
293 | |||
294 | QREADEROBJS/CEncoding.o: CEncoding.cpp CEncoding.h \ | ||
295 | CExpander.h \ | ||
296 | CEncoding_tables.h \ | ||
297 | QREADERINC/useqpe.h \ | ||
298 | config.h \ | ||
299 | StyleConsts.h \ | ||
300 | Markups.h \ | ||
301 | names.h \ | ||
302 | linktype.h \ | ||
303 | ustring.h | ||
304 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CEncoding.o CEncoding.cpp | ||
305 | |||
306 | QREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp CEncoding_tables.h \ | ||
307 | config.h \ | ||
308 | ustring.h | ||
309 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp | ||
310 | |||
311 | QREADEROBJS/CFilter.o: CFilter.cpp QREADERINC/useqpe.h \ | ||
312 | CDrawBuffer.h \ | ||
313 | CFilter.h \ | ||
314 | hrule.h \ | ||
315 | Bkmks.h \ | ||
316 | QTReader.h \ | ||
317 | CRegExp.h \ | ||
318 | StyleConsts.h \ | ||
319 | CBuffer.h \ | ||
320 | my_list.h \ | ||
321 | linktype.h \ | ||
322 | config.h \ | ||
323 | ustring.h \ | ||
324 | CExpander.h \ | ||
325 | CEncoding.h \ | ||
326 | QREADERINC/static.h \ | ||
327 | Markups.h \ | ||
328 | names.h \ | ||
329 | CEncoding_tables.h \ | ||
330 | Filedata.h \ | ||
331 | BuffDoc.h \ | ||
332 | FontControl.h \ | ||
333 | BGType.h \ | ||
334 | striphtml.h \ | ||
335 | Navigation.h \ | ||
336 | hash.h \ | ||
337 | Queue.h | ||
338 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CFilter.o CFilter.cpp | ||
339 | |||
340 | QREADEROBJS/CRegExp.o: CRegExp.cpp CRegExp.h \ | ||
341 | config.h \ | ||
342 | hash.h \ | ||
343 | Queue.h \ | ||
344 | ustring.h \ | ||
345 | my_list.h | ||
346 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CRegExp.o CRegExp.cpp | ||
347 | |||
348 | QREADEROBJS/CloseDialog.o: CloseDialog.cpp CloseDialog.h \ | ||
349 | QREADERINC/useqpe.h | ||
350 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CloseDialog.o CloseDialog.cpp | ||
351 | |||
352 | QREADEROBJS/FontControl.o: FontControl.cpp QREADERINC/opie.h \ | ||
353 | QREADERINC/useqpe.h \ | ||
354 | FontControl.h \ | ||
355 | StyleConsts.h | ||
356 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/FontControl.o FontControl.cpp | ||
357 | |||
358 | QREADEROBJS/GraphicWin.o: GraphicWin.cpp | ||
359 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/GraphicWin.o GraphicWin.cpp | ||
360 | |||
361 | QREADEROBJS/Prefs.o: Prefs.cpp Prefs.h \ | ||
362 | CEncoding_tables.h \ | ||
363 | orkey.h | ||
364 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Prefs.o Prefs.cpp | ||
365 | |||
366 | QREADEROBJS/QTReader.o: QTReader.cpp QREADERINC/useqpe.h \ | ||
367 | config.h \ | ||
368 | QTReader.h \ | ||
369 | CDrawBuffer.h \ | ||
370 | ustring.h \ | ||
371 | QREADERINC/static.h \ | ||
372 | my_list.h \ | ||
373 | BuffDoc.h \ | ||
374 | FontControl.h \ | ||
375 | BGType.h \ | ||
376 | striphtml.h \ | ||
377 | CFilter.h \ | ||
378 | CExpander.h \ | ||
379 | StyleConsts.h \ | ||
380 | CBuffer.h \ | ||
381 | linktype.h \ | ||
382 | CEncoding.h \ | ||
383 | Markups.h \ | ||
384 | names.h \ | ||
385 | CEncoding_tables.h \ | ||
386 | Navigation.h | ||
387 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/QTReader.o QTReader.cpp | ||
388 | |||
389 | QREADEROBJS/QTReaderApp.o: QTReaderApp.cpp QREADERINC/useqpe.h \ | ||
390 | QTReader.h \ | ||
391 | GraphicWin.h \ | ||
392 | Bkmks.h \ | ||
393 | cbkmkselector.h \ | ||
394 | infowin.h \ | ||
395 | ToolbarPrefs.h \ | ||
396 | Prefs.h \ | ||
397 | CAnnoEdit.h \ | ||
398 | QFloatBar.h \ | ||
399 | FixedFont.h \ | ||
400 | URLDialog.h \ | ||
401 | util.h \ | ||
402 | QREADERINC/opie.h \ | ||
403 | fileBrowser.h \ | ||
404 | QTReaderApp.h \ | ||
405 | CDrawBuffer.h \ | ||
406 | Filedata.h \ | ||
407 | names.h \ | ||
408 | CEncoding_tables.h \ | ||
409 | CloseDialog.h \ | ||
410 | ButtonPrefs.h \ | ||
411 | QREADERINC/static.h \ | ||
412 | my_list.h \ | ||
413 | BuffDoc.h \ | ||
414 | FontControl.h \ | ||
415 | BGType.h \ | ||
416 | striphtml.h \ | ||
417 | CFilter.h \ | ||
418 | CExpander.h \ | ||
419 | StyleConsts.h \ | ||
420 | CBuffer.h \ | ||
421 | linktype.h \ | ||
422 | config.h \ | ||
423 | ustring.h \ | ||
424 | CEncoding.h \ | ||
425 | Markups.h \ | ||
426 | Navigation.h \ | ||
427 | preferences.h \ | ||
428 | orkey.h | ||
429 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/QTReaderApp.o QTReaderApp.cpp | ||
430 | |||
431 | QREADEROBJS/QtrListView.o: QtrListView.cpp QtrListView.h | ||
432 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/QtrListView.o QtrListView.cpp | ||
433 | |||
434 | QREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp QREADERINC/useqpe.h \ | ||
435 | ToolbarPrefs.h \ | ||
436 | preferences.h | ||
437 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp | ||
438 | |||
439 | QREADEROBJS/URLDialog.o: URLDialog.cpp URLDialog.h \ | ||
440 | QREADERINC/useqpe.h | ||
441 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/URLDialog.o URLDialog.cpp | ||
442 | |||
443 | QREADEROBJS/infowin.o: infowin.cpp infowin.h \ | ||
444 | version.h \ | ||
445 | names.h | ||
446 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/infowin.o infowin.cpp | ||
447 | |||
448 | QREADEROBJS/main.o: main.cpp QREADERINC/useqpe.h \ | ||
449 | QTReaderApp.h \ | ||
450 | CExpander.h \ | ||
451 | CEncoding.h \ | ||
452 | orkey.h \ | ||
453 | BGType.h \ | ||
454 | config.h \ | ||
455 | StyleConsts.h \ | ||
456 | Markups.h \ | ||
457 | names.h \ | ||
458 | linktype.h \ | ||
459 | ustring.h \ | ||
460 | CEncoding_tables.h | ||
461 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/main.o main.cpp | ||
462 | |||
463 | QREADEROBJS/orkey.o: orkey.cpp orkey.h | ||
464 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/orkey.o orkey.cpp | ||
465 | |||
466 | QREADEROBJS/preferences.o: preferences.cpp QREADERINC/useqpe.h \ | ||
467 | preferences.h | ||
468 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/preferences.o preferences.cpp | ||
469 | |||
470 | QREADEROBJS/util.o: util.cpp util.h | ||
471 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/util.o util.cpp | ||
472 | |||
473 | QREADEROBJS/version.o: version.cpp version.h \ | ||
474 | names.h | ||
475 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/version.o version.cpp | ||
476 | |||
477 | QREADEROBJS/moc_ButtonPrefs.o: QREADERMOCS/moc_ButtonPrefs.cpp ButtonPrefs.h orkey.h | ||
478 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_ButtonPrefs.o QREADERMOCS/moc_ButtonPrefs.cpp | ||
479 | |||
480 | QREADEROBJS/moc_CAnnoEdit.o: QREADERMOCS/moc_CAnnoEdit.cpp CAnnoEdit.h | ||
481 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_CAnnoEdit.o QREADERMOCS/moc_CAnnoEdit.cpp | ||
482 | |||
483 | QREADEROBJS/moc_CloseDialog.o: QREADERMOCS/moc_CloseDialog.cpp CloseDialog.h QREADERINC/useqpe.h | ||
484 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_CloseDialog.o QREADERMOCS/moc_CloseDialog.cpp | ||
485 | |||
486 | QREADEROBJS/moc_GraphicWin.o: QREADERMOCS/moc_GraphicWin.cpp GraphicWin.h | ||
487 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_GraphicWin.o QREADERMOCS/moc_GraphicWin.cpp | ||
488 | |||
489 | QREADEROBJS/moc_Prefs.o: QREADERMOCS/moc_Prefs.cpp Prefs.h orkey.h | ||
490 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_Prefs.o QREADERMOCS/moc_Prefs.cpp | ||
491 | |||
492 | QREADEROBJS/moc_QFloatBar.o: QREADERMOCS/moc_QFloatBar.cpp QFloatBar.h | ||
493 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QFloatBar.o QREADERMOCS/moc_QFloatBar.cpp | ||
494 | |||
495 | QREADEROBJS/moc_QTReader.o: QREADERMOCS/moc_QTReader.cpp QTReader.h QREADERINC/static.h \ | ||
496 | my_list.h \ | ||
497 | BuffDoc.h \ | ||
498 | FontControl.h \ | ||
499 | BGType.h \ | ||
500 | striphtml.h \ | ||
501 | QREADERINC/useqpe.h \ | ||
502 | CDrawBuffer.h \ | ||
503 | CFilter.h \ | ||
504 | CExpander.h \ | ||
505 | StyleConsts.h \ | ||
506 | CBuffer.h \ | ||
507 | linktype.h \ | ||
508 | config.h \ | ||
509 | ustring.h \ | ||
510 | CEncoding.h \ | ||
511 | Markups.h \ | ||
512 | names.h \ | ||
513 | CEncoding_tables.h \ | ||
514 | Navigation.h | ||
515 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QTReader.o QREADERMOCS/moc_QTReader.cpp | ||
516 | |||
517 | QREADEROBJS/moc_QTReaderApp.o: QREADERMOCS/moc_QTReaderApp.cpp QTReaderApp.h QREADERINC/useqpe.h \ | ||
518 | CExpander.h \ | ||
519 | CEncoding.h \ | ||
520 | orkey.h \ | ||
521 | BGType.h \ | ||
522 | config.h \ | ||
523 | StyleConsts.h \ | ||
524 | Markups.h \ | ||
525 | names.h \ | ||
526 | linktype.h \ | ||
527 | ustring.h \ | ||
528 | CEncoding_tables.h | ||
529 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QTReaderApp.o QREADERMOCS/moc_QTReaderApp.cpp | ||
530 | |||
531 | QREADEROBJS/moc_QtrListView.o: QREADERMOCS/moc_QtrListView.cpp QtrListView.h | ||
532 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QtrListView.o QREADERMOCS/moc_QtrListView.cpp | ||
533 | |||
534 | QREADEROBJS/moc_ToolbarPrefs.o: QREADERMOCS/moc_ToolbarPrefs.cpp ToolbarPrefs.h QREADERINC/useqpe.h \ | ||
535 | preferences.h | ||
536 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_ToolbarPrefs.o QREADERMOCS/moc_ToolbarPrefs.cpp | ||
537 | |||
538 | QREADEROBJS/moc_URLDialog.o: QREADERMOCS/moc_URLDialog.cpp URLDialog.h QREADERINC/useqpe.h | ||
539 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_URLDialog.o QREADERMOCS/moc_URLDialog.cpp | ||
540 | |||
541 | QREADEROBJS/moc_cbkmkselector.o: QREADERMOCS/moc_cbkmkselector.cpp cbkmkselector.h | ||
542 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_cbkmkselector.o QREADERMOCS/moc_cbkmkselector.cpp | ||
543 | |||
544 | QREADEROBJS/moc_infowin.o: QREADERMOCS/moc_infowin.cpp infowin.h | ||
545 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_infowin.o QREADERMOCS/moc_infowin.cpp | ||
546 | |||
547 | QREADERMOCS/moc_ButtonPrefs.cpp: $(MOC) ButtonPrefs.h | ||
548 | $(MOC) ButtonPrefs.h -o QREADERMOCS/moc_ButtonPrefs.cpp | ||
549 | |||
550 | QREADERMOCS/moc_CAnnoEdit.cpp: $(MOC) CAnnoEdit.h | ||
551 | $(MOC) CAnnoEdit.h -o QREADERMOCS/moc_CAnnoEdit.cpp | ||
552 | |||
553 | QREADERMOCS/moc_CloseDialog.cpp: $(MOC) CloseDialog.h | ||
554 | $(MOC) CloseDialog.h -o QREADERMOCS/moc_CloseDialog.cpp | ||
555 | |||
556 | QREADERMOCS/moc_GraphicWin.cpp: $(MOC) GraphicWin.h | ||
557 | $(MOC) GraphicWin.h -o QREADERMOCS/moc_GraphicWin.cpp | ||
558 | |||
559 | QREADERMOCS/moc_Prefs.cpp: $(MOC) Prefs.h | ||
560 | $(MOC) Prefs.h -o QREADERMOCS/moc_Prefs.cpp | ||
561 | |||
562 | QREADERMOCS/moc_QFloatBar.cpp: $(MOC) QFloatBar.h | ||
563 | $(MOC) QFloatBar.h -o QREADERMOCS/moc_QFloatBar.cpp | ||
564 | |||
565 | QREADERMOCS/moc_QTReader.cpp: $(MOC) QTReader.h | ||
566 | $(MOC) QTReader.h -o QREADERMOCS/moc_QTReader.cpp | ||
567 | |||
568 | QREADERMOCS/moc_QTReaderApp.cpp: $(MOC) QTReaderApp.h | ||
569 | $(MOC) QTReaderApp.h -o QREADERMOCS/moc_QTReaderApp.cpp | ||
570 | |||
571 | QREADERMOCS/moc_QtrListView.cpp: $(MOC) QtrListView.h | ||
572 | $(MOC) QtrListView.h -o QREADERMOCS/moc_QtrListView.cpp | ||
573 | |||
574 | QREADERMOCS/moc_ToolbarPrefs.cpp: $(MOC) ToolbarPrefs.h | ||
575 | $(MOC) ToolbarPrefs.h -o QREADERMOCS/moc_ToolbarPrefs.cpp | ||
576 | |||
577 | QREADERMOCS/moc_URLDialog.cpp: $(MOC) URLDialog.h | ||
578 | $(MOC) URLDialog.h -o QREADERMOCS/moc_URLDialog.cpp | ||
579 | |||
580 | QREADERMOCS/moc_cbkmkselector.cpp: $(MOC) cbkmkselector.h | ||
581 | $(MOC) cbkmkselector.h -o QREADERMOCS/moc_cbkmkselector.cpp | ||
582 | |||
583 | QREADERMOCS/moc_infowin.cpp: $(MOC) infowin.h | ||
584 | $(MOC) infowin.h -o QREADERMOCS/moc_infowin.cpp | ||
585 | |||
586 | ####### Install | ||
587 | |||
588 | install: all | ||
589 | |||
590 | uninstall: | ||
591 | |||
diff --git a/noncore/apps/opie-reader/reader.omak b/noncore/apps/opie-reader/reader.omak new file mode 100644 index 0000000..e4553ee --- a/dev/null +++ b/noncore/apps/opie-reader/reader.omak | |||
@@ -0,0 +1,605 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building $(QPEDIR)/bin/reader | ||
3 | # Generated by tmake at 15:14, 2004/05/08 | ||
4 | # Project: reader.opro | ||
5 | # Template: app | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O3 -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -DNO_DEBUG | ||
14 | INCPATH =-IOREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS = | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqpe -lreader_codec -lpng12 -ljpeg -lz -lqte | ||
18 | MOC =$(QTDIR)/bin/moc | ||
19 | UIC =$(QTDIR)/bin/uic | ||
20 | |||
21 | TAR =tar -cf | ||
22 | GZIP =gzip -9f | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =Aportis.h \ | ||
27 | Bkmks.h \ | ||
28 | BuffDoc.h \ | ||
29 | ButtonPrefs.h \ | ||
30 | CAnnoEdit.h \ | ||
31 | CBuffer.h \ | ||
32 | CDrawBuffer.h \ | ||
33 | CEncoding.h \ | ||
34 | CEncoding_tables.h \ | ||
35 | CExpander.h \ | ||
36 | CFilter.h \ | ||
37 | CloseDialog.h \ | ||
38 | Coder.h \ | ||
39 | CSource.h \ | ||
40 | Filedata.h \ | ||
41 | FixedFont.h \ | ||
42 | FontControl.h \ | ||
43 | GraphicWin.h \ | ||
44 | Markups.h \ | ||
45 | Navigation.h \ | ||
46 | Palm2QImage.h \ | ||
47 | Prefs.h \ | ||
48 | PPMd.h \ | ||
49 | PPMdType.h \ | ||
50 | QFloatBar.h \ | ||
51 | QTReader.h \ | ||
52 | QTReaderApp.h \ | ||
53 | QtrListView.h \ | ||
54 | Queue.h \ | ||
55 | StateData.h \ | ||
56 | StyleConsts.h \ | ||
57 | SubAlloc.h \ | ||
58 | ToolbarPrefs.h \ | ||
59 | URLDialog.h \ | ||
60 | ZText.h \ | ||
61 | arith.h \ | ||
62 | arrierego.h \ | ||
63 | cbkmkselector.h \ | ||
64 | config.h \ | ||
65 | fileBrowser.h \ | ||
66 | infowin.h \ | ||
67 | linktype.h \ | ||
68 | my_list.h \ | ||
69 | names.h \ | ||
70 | nef.h \ | ||
71 | OREADERINC/opie.h \ | ||
72 | pdb.h \ | ||
73 | plucker.h \ | ||
74 | plucker_base.h \ | ||
75 | ppm.h \ | ||
76 | ppm_expander.h \ | ||
77 | usenef.h \ | ||
78 | OREADERINC/useqpe.h \ | ||
79 | ustring.h \ | ||
80 | util.h \ | ||
81 | utypes.h \ | ||
82 | version.h \ | ||
83 | ztxt.h | ||
84 | SOURCES =BuffDoc.cpp \ | ||
85 | ButtonPrefs.cpp \ | ||
86 | CAnnoEdit.cpp \ | ||
87 | CDrawBuffer.cpp \ | ||
88 | CEncoding.cpp \ | ||
89 | CEncoding_tables.cpp \ | ||
90 | CFilter.cpp \ | ||
91 | CRegExp.cpp \ | ||
92 | CloseDialog.cpp \ | ||
93 | FontControl.cpp \ | ||
94 | Prefs.cpp \ | ||
95 | QTReader.cpp \ | ||
96 | QTReaderApp.cpp \ | ||
97 | QtrListView.cpp \ | ||
98 | ToolbarPrefs.cpp \ | ||
99 | URLDialog.cpp \ | ||
100 | fileBrowser.cpp \ | ||
101 | infowin.cpp \ | ||
102 | main.cpp \ | ||
103 | orkey.cpp \ | ||
104 | util.cpp \ | ||
105 | version.cpp | ||
106 | OBJECTS =OREADEROBJS/BuffDoc.o \ | ||
107 | OREADEROBJS/ButtonPrefs.o \ | ||
108 | OREADEROBJS/CAnnoEdit.o \ | ||
109 | OREADEROBJS/CDrawBuffer.o \ | ||
110 | OREADEROBJS/CEncoding.o \ | ||
111 | OREADEROBJS/CEncoding_tables.o \ | ||
112 | OREADEROBJS/CFilter.o \ | ||
113 | OREADEROBJS/CRegExp.o \ | ||
114 | OREADEROBJS/CloseDialog.o \ | ||
115 | OREADEROBJS/FontControl.o \ | ||
116 | OREADEROBJS/Prefs.o \ | ||
117 | OREADEROBJS/QTReader.o \ | ||
118 | OREADEROBJS/QTReaderApp.o \ | ||
119 | OREADEROBJS/QtrListView.o \ | ||
120 | OREADEROBJS/ToolbarPrefs.o \ | ||
121 | OREADEROBJS/URLDialog.o \ | ||
122 | OREADEROBJS/fileBrowser.o \ | ||
123 | OREADEROBJS/infowin.o \ | ||
124 | OREADEROBJS/main.o \ | ||
125 | OREADEROBJS/orkey.o \ | ||
126 | OREADEROBJS/util.o \ | ||
127 | OREADEROBJS/version.o | ||
128 | INTERFACES = | ||
129 | UICDECLS = | ||
130 | UICIMPLS = | ||
131 | SRCMOC =OREADERMOCS/moc_ButtonPrefs.cpp \ | ||
132 | OREADERMOCS/moc_CAnnoEdit.cpp \ | ||
133 | OREADERMOCS/moc_CloseDialog.cpp \ | ||
134 | OREADERMOCS/moc_GraphicWin.cpp \ | ||
135 | OREADERMOCS/moc_Prefs.cpp \ | ||
136 | OREADERMOCS/moc_QFloatBar.cpp \ | ||
137 | OREADERMOCS/moc_QTReader.cpp \ | ||
138 | OREADERMOCS/moc_QTReaderApp.cpp \ | ||
139 | OREADERMOCS/moc_QtrListView.cpp \ | ||
140 | OREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
141 | OREADERMOCS/moc_URLDialog.cpp \ | ||
142 | OREADERMOCS/moc_cbkmkselector.cpp \ | ||
143 | OREADERMOCS/moc_fileBrowser.cpp \ | ||
144 | OREADERMOCS/moc_infowin.cpp | ||
145 | OBJMOC =OREADEROBJS/moc_ButtonPrefs.o \ | ||
146 | OREADEROBJS/moc_CAnnoEdit.o \ | ||
147 | OREADEROBJS/moc_CloseDialog.o \ | ||
148 | OREADEROBJS/moc_GraphicWin.o \ | ||
149 | OREADEROBJS/moc_Prefs.o \ | ||
150 | OREADEROBJS/moc_QFloatBar.o \ | ||
151 | OREADEROBJS/moc_QTReader.o \ | ||
152 | OREADEROBJS/moc_QTReaderApp.o \ | ||
153 | OREADEROBJS/moc_QtrListView.o \ | ||
154 | OREADEROBJS/moc_ToolbarPrefs.o \ | ||
155 | OREADEROBJS/moc_URLDialog.o \ | ||
156 | OREADEROBJS/moc_cbkmkselector.o \ | ||
157 | OREADEROBJS/moc_fileBrowser.o \ | ||
158 | OREADEROBJS/moc_infowin.o | ||
159 | DIST = | ||
160 | TARGET =$(QPEDIR)/bin/reader | ||
161 | INTERFACE_DECL_PATH = . | ||
162 | |||
163 | ####### Implicit rules | ||
164 | |||
165 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
166 | |||
167 | .cpp.o: | ||
168 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
169 | |||
170 | .cxx.o: | ||
171 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
172 | |||
173 | .cc.o: | ||
174 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
175 | |||
176 | .C.o: | ||
177 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
178 | |||
179 | .c.o: | ||
180 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
181 | |||
182 | ####### Build rules | ||
183 | |||
184 | |||
185 | all: $(TARGET) | ||
186 | |||
187 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
188 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
189 | |||
190 | moc: $(SRCMOC) | ||
191 | |||
192 | tmake: reader.omak | ||
193 | |||
194 | reader.omak: reader.opro | ||
195 | tmake reader.opro -o reader.omak | ||
196 | |||
197 | dist: | ||
198 | $(TAR) reader.opro.tar reader.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
199 | $(GZIP) reader.opro.tar | ||
200 | |||
201 | clean: | ||
202 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
203 | -rm -f *~ core | ||
204 | |||
205 | ####### Sub-libraries | ||
206 | |||
207 | |||
208 | ###### Combined headers | ||
209 | |||
210 | |||
211 | ####### Compile | ||
212 | |||
213 | OREADEROBJS/BuffDoc.o: BuffDoc.cpp \ | ||
214 | OREADERINC/static.h \ | ||
215 | names.h \ | ||
216 | BuffDoc.h \ | ||
217 | OREADERINC/useqpe.h \ | ||
218 | CDrawBuffer.h \ | ||
219 | StyleConsts.h \ | ||
220 | CBuffer.h \ | ||
221 | config.h \ | ||
222 | ustring.h \ | ||
223 | my_list.h \ | ||
224 | linktype.h \ | ||
225 | CFilter.h \ | ||
226 | CExpander.h \ | ||
227 | Markups.h \ | ||
228 | CEncoding.h \ | ||
229 | CEncoding_tables.h \ | ||
230 | ZText.h \ | ||
231 | ebookcodec.h \ | ||
232 | Aportis.h \ | ||
233 | pdb.h \ | ||
234 | CHM.h \ | ||
235 | chm_lib.h \ | ||
236 | ppm_expander.h \ | ||
237 | utypes.h \ | ||
238 | ppm.h \ | ||
239 | arith.h \ | ||
240 | ztxt.h \ | ||
241 | plucker.h \ | ||
242 | plucker_base.h \ | ||
243 | Navigation.h \ | ||
244 | hrule.h \ | ||
245 | nef.h \ | ||
246 | usenef.h \ | ||
247 | arrierego.h \ | ||
248 | iSilo.h | ||
249 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/BuffDoc.o BuffDoc.cpp | ||
250 | |||
251 | OREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \ | ||
252 | ButtonPrefs.h \ | ||
253 | orkey.h | ||
254 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp | ||
255 | |||
256 | OREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \ | ||
257 | CAnnoEdit.h | ||
258 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp | ||
259 | |||
260 | OREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \ | ||
261 | CDrawBuffer.h \ | ||
262 | StyleConsts.h \ | ||
263 | CBuffer.h \ | ||
264 | config.h \ | ||
265 | ustring.h \ | ||
266 | my_list.h \ | ||
267 | linktype.h \ | ||
268 | FontControl.h \ | ||
269 | OREADERINC/useqpe.h \ | ||
270 | OREADERINC/opie.h | ||
271 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp | ||
272 | |||
273 | OREADEROBJS/CEncoding.o: CEncoding.cpp \ | ||
274 | CEncoding.h \ | ||
275 | CExpander.h \ | ||
276 | OREADERINC/useqpe.h \ | ||
277 | config.h \ | ||
278 | ustring.h \ | ||
279 | StyleConsts.h \ | ||
280 | Markups.h \ | ||
281 | names.h \ | ||
282 | linktype.h \ | ||
283 | CEncoding_tables.h | ||
284 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CEncoding.o CEncoding.cpp | ||
285 | |||
286 | OREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \ | ||
287 | CEncoding_tables.h \ | ||
288 | config.h \ | ||
289 | ustring.h | ||
290 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp | ||
291 | |||
292 | OREADEROBJS/CFilter.o: CFilter.cpp \ | ||
293 | OREADERINC/useqpe.h \ | ||
294 | CDrawBuffer.h \ | ||
295 | StyleConsts.h \ | ||
296 | CBuffer.h \ | ||
297 | config.h \ | ||
298 | ustring.h \ | ||
299 | my_list.h \ | ||
300 | linktype.h \ | ||
301 | CFilter.h \ | ||
302 | CExpander.h \ | ||
303 | Markups.h \ | ||
304 | names.h \ | ||
305 | CEncoding.h \ | ||
306 | CEncoding_tables.h \ | ||
307 | OREADERINC/static.h \ | ||
308 | hrule.h \ | ||
309 | Bkmks.h \ | ||
310 | Filedata.h \ | ||
311 | QTReader.h \ | ||
312 | BuffDoc.h \ | ||
313 | FontControl.h \ | ||
314 | BGType.h \ | ||
315 | striphtml.h \ | ||
316 | Navigation.h \ | ||
317 | CRegExp.h \ | ||
318 | hash.h \ | ||
319 | Queue.h | ||
320 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CFilter.o CFilter.cpp | ||
321 | |||
322 | OREADEROBJS/CRegExp.o: CRegExp.cpp \ | ||
323 | CRegExp.h \ | ||
324 | config.h \ | ||
325 | ustring.h \ | ||
326 | hash.h \ | ||
327 | Queue.h \ | ||
328 | my_list.h | ||
329 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CRegExp.o CRegExp.cpp | ||
330 | |||
331 | OREADEROBJS/CloseDialog.o: CloseDialog.cpp \ | ||
332 | CloseDialog.h \ | ||
333 | OREADERINC/useqpe.h | ||
334 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CloseDialog.o CloseDialog.cpp | ||
335 | |||
336 | OREADEROBJS/FontControl.o: FontControl.cpp \ | ||
337 | OREADERINC/opie.h \ | ||
338 | OREADERINC/useqpe.h \ | ||
339 | FontControl.h \ | ||
340 | StyleConsts.h | ||
341 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/FontControl.o FontControl.cpp | ||
342 | |||
343 | OREADEROBJS/Prefs.o: Prefs.cpp \ | ||
344 | Prefs.h \ | ||
345 | orkey.h \ | ||
346 | CEncoding_tables.h | ||
347 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Prefs.o Prefs.cpp | ||
348 | |||
349 | OREADEROBJS/QTReader.o: QTReader.cpp \ | ||
350 | OREADERINC/useqpe.h \ | ||
351 | config.h \ | ||
352 | ustring.h \ | ||
353 | QTReader.h \ | ||
354 | OREADERINC/static.h \ | ||
355 | my_list.h \ | ||
356 | BuffDoc.h \ | ||
357 | CDrawBuffer.h \ | ||
358 | StyleConsts.h \ | ||
359 | CBuffer.h \ | ||
360 | linktype.h \ | ||
361 | CFilter.h \ | ||
362 | CExpander.h \ | ||
363 | Markups.h \ | ||
364 | names.h \ | ||
365 | CEncoding.h \ | ||
366 | CEncoding_tables.h \ | ||
367 | FontControl.h \ | ||
368 | BGType.h \ | ||
369 | striphtml.h \ | ||
370 | Navigation.h | ||
371 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/QTReader.o QTReader.cpp | ||
372 | |||
373 | OREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \ | ||
374 | OREADERINC/useqpe.h \ | ||
375 | QTReader.h \ | ||
376 | OREADERINC/static.h \ | ||
377 | my_list.h \ | ||
378 | BuffDoc.h \ | ||
379 | CDrawBuffer.h \ | ||
380 | StyleConsts.h \ | ||
381 | CBuffer.h \ | ||
382 | config.h \ | ||
383 | ustring.h \ | ||
384 | linktype.h \ | ||
385 | CFilter.h \ | ||
386 | CExpander.h \ | ||
387 | Markups.h \ | ||
388 | names.h \ | ||
389 | CEncoding.h \ | ||
390 | CEncoding_tables.h \ | ||
391 | FontControl.h \ | ||
392 | BGType.h \ | ||
393 | striphtml.h \ | ||
394 | Navigation.h \ | ||
395 | GraphicWin.h \ | ||
396 | Bkmks.h \ | ||
397 | Filedata.h \ | ||
398 | cbkmkselector.h \ | ||
399 | infowin.h \ | ||
400 | ToolbarPrefs.h \ | ||
401 | preferences.h \ | ||
402 | Prefs.h \ | ||
403 | orkey.h \ | ||
404 | CAnnoEdit.h \ | ||
405 | QFloatBar.h \ | ||
406 | FixedFont.h \ | ||
407 | URLDialog.h \ | ||
408 | util.h \ | ||
409 | fileBrowser.h \ | ||
410 | QTReaderApp.h \ | ||
411 | CloseDialog.h \ | ||
412 | ButtonPrefs.h | ||
413 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/QTReaderApp.o QTReaderApp.cpp | ||
414 | |||
415 | OREADEROBJS/QtrListView.o: QtrListView.cpp \ | ||
416 | QtrListView.h | ||
417 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/QtrListView.o QtrListView.cpp | ||
418 | |||
419 | OREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \ | ||
420 | OREADERINC/useqpe.h \ | ||
421 | ToolbarPrefs.h \ | ||
422 | preferences.h | ||
423 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp | ||
424 | |||
425 | OREADEROBJS/URLDialog.o: URLDialog.cpp \ | ||
426 | URLDialog.h \ | ||
427 | OREADERINC/useqpe.h | ||
428 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/URLDialog.o URLDialog.cpp | ||
429 | |||
430 | OREADEROBJS/fileBrowser.o: fileBrowser.cpp \ | ||
431 | fileBrowser.h \ | ||
432 | QtrListView.h | ||
433 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/fileBrowser.o fileBrowser.cpp | ||
434 | |||
435 | OREADEROBJS/infowin.o: infowin.cpp \ | ||
436 | infowin.h \ | ||
437 | version.h \ | ||
438 | names.h | ||
439 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/infowin.o infowin.cpp | ||
440 | |||
441 | OREADEROBJS/main.o: main.cpp \ | ||
442 | OREADERINC/useqpe.h \ | ||
443 | QTReaderApp.h \ | ||
444 | CExpander.h \ | ||
445 | config.h \ | ||
446 | ustring.h \ | ||
447 | StyleConsts.h \ | ||
448 | Markups.h \ | ||
449 | names.h \ | ||
450 | linktype.h \ | ||
451 | CEncoding.h \ | ||
452 | CEncoding_tables.h \ | ||
453 | orkey.h \ | ||
454 | BGType.h | ||
455 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/main.o main.cpp | ||
456 | |||
457 | OREADEROBJS/orkey.o: orkey.cpp \ | ||
458 | orkey.h | ||
459 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/orkey.o orkey.cpp | ||
460 | |||
461 | OREADEROBJS/util.o: util.cpp \ | ||
462 | util.h | ||
463 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/util.o util.cpp | ||
464 | |||
465 | OREADEROBJS/version.o: version.cpp \ | ||
466 | version.h \ | ||
467 | names.h | ||
468 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/version.o version.cpp | ||
469 | |||
470 | OREADEROBJS/moc_ButtonPrefs.o: OREADERMOCS/moc_ButtonPrefs.cpp \ | ||
471 | ButtonPrefs.h \ | ||
472 | orkey.h | ||
473 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_ButtonPrefs.o OREADERMOCS/moc_ButtonPrefs.cpp | ||
474 | |||
475 | OREADEROBJS/moc_CAnnoEdit.o: OREADERMOCS/moc_CAnnoEdit.cpp \ | ||
476 | CAnnoEdit.h | ||
477 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_CAnnoEdit.o OREADERMOCS/moc_CAnnoEdit.cpp | ||
478 | |||
479 | OREADEROBJS/moc_CloseDialog.o: OREADERMOCS/moc_CloseDialog.cpp \ | ||
480 | CloseDialog.h \ | ||
481 | OREADERINC/useqpe.h | ||
482 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_CloseDialog.o OREADERMOCS/moc_CloseDialog.cpp | ||
483 | |||
484 | OREADEROBJS/moc_GraphicWin.o: OREADERMOCS/moc_GraphicWin.cpp \ | ||
485 | GraphicWin.h | ||
486 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_GraphicWin.o OREADERMOCS/moc_GraphicWin.cpp | ||
487 | |||
488 | OREADEROBJS/moc_Prefs.o: OREADERMOCS/moc_Prefs.cpp \ | ||
489 | Prefs.h \ | ||
490 | orkey.h | ||
491 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_Prefs.o OREADERMOCS/moc_Prefs.cpp | ||
492 | |||
493 | OREADEROBJS/moc_QFloatBar.o: OREADERMOCS/moc_QFloatBar.cpp \ | ||
494 | QFloatBar.h | ||
495 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QFloatBar.o OREADERMOCS/moc_QFloatBar.cpp | ||
496 | |||
497 | OREADEROBJS/moc_QTReader.o: OREADERMOCS/moc_QTReader.cpp \ | ||
498 | QTReader.h \ | ||
499 | OREADERINC/static.h \ | ||
500 | my_list.h \ | ||
501 | BuffDoc.h \ | ||
502 | OREADERINC/useqpe.h \ | ||
503 | CDrawBuffer.h \ | ||
504 | StyleConsts.h \ | ||
505 | CBuffer.h \ | ||
506 | config.h \ | ||
507 | ustring.h \ | ||
508 | linktype.h \ | ||
509 | CFilter.h \ | ||
510 | CExpander.h \ | ||
511 | Markups.h \ | ||
512 | names.h \ | ||
513 | CEncoding.h \ | ||
514 | CEncoding_tables.h \ | ||
515 | FontControl.h \ | ||
516 | BGType.h \ | ||
517 | striphtml.h \ | ||
518 | Navigation.h | ||
519 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QTReader.o OREADERMOCS/moc_QTReader.cpp | ||
520 | |||
521 | OREADEROBJS/moc_QTReaderApp.o: OREADERMOCS/moc_QTReaderApp.cpp \ | ||
522 | QTReaderApp.h \ | ||
523 | OREADERINC/useqpe.h \ | ||
524 | CExpander.h \ | ||
525 | config.h \ | ||
526 | ustring.h \ | ||
527 | StyleConsts.h \ | ||
528 | Markups.h \ | ||
529 | names.h \ | ||
530 | linktype.h \ | ||
531 | CEncoding.h \ | ||
532 | CEncoding_tables.h \ | ||
533 | orkey.h \ | ||
534 | BGType.h | ||
535 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QTReaderApp.o OREADERMOCS/moc_QTReaderApp.cpp | ||
536 | |||
537 | OREADEROBJS/moc_QtrListView.o: OREADERMOCS/moc_QtrListView.cpp \ | ||
538 | QtrListView.h | ||
539 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QtrListView.o OREADERMOCS/moc_QtrListView.cpp | ||
540 | |||
541 | OREADEROBJS/moc_ToolbarPrefs.o: OREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
542 | ToolbarPrefs.h \ | ||
543 | OREADERINC/useqpe.h \ | ||
544 | preferences.h | ||
545 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_ToolbarPrefs.o OREADERMOCS/moc_ToolbarPrefs.cpp | ||
546 | |||
547 | OREADEROBJS/moc_URLDialog.o: OREADERMOCS/moc_URLDialog.cpp \ | ||
548 | URLDialog.h \ | ||
549 | OREADERINC/useqpe.h | ||
550 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_URLDialog.o OREADERMOCS/moc_URLDialog.cpp | ||
551 | |||
552 | OREADEROBJS/moc_cbkmkselector.o: OREADERMOCS/moc_cbkmkselector.cpp \ | ||
553 | cbkmkselector.h | ||
554 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_cbkmkselector.o OREADERMOCS/moc_cbkmkselector.cpp | ||
555 | |||
556 | OREADEROBJS/moc_fileBrowser.o: OREADERMOCS/moc_fileBrowser.cpp \ | ||
557 | fileBrowser.h | ||
558 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_fileBrowser.o OREADERMOCS/moc_fileBrowser.cpp | ||
559 | |||
560 | OREADEROBJS/moc_infowin.o: OREADERMOCS/moc_infowin.cpp \ | ||
561 | infowin.h | ||
562 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_infowin.o OREADERMOCS/moc_infowin.cpp | ||
563 | |||
564 | OREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h | ||
565 | $(MOC) ButtonPrefs.h -o OREADERMOCS/moc_ButtonPrefs.cpp | ||
566 | |||
567 | OREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h | ||
568 | $(MOC) CAnnoEdit.h -o OREADERMOCS/moc_CAnnoEdit.cpp | ||
569 | |||
570 | OREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h | ||
571 | $(MOC) CloseDialog.h -o OREADERMOCS/moc_CloseDialog.cpp | ||
572 | |||
573 | OREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h | ||
574 | $(MOC) GraphicWin.h -o OREADERMOCS/moc_GraphicWin.cpp | ||
575 | |||
576 | OREADERMOCS/moc_Prefs.cpp: Prefs.h | ||
577 | $(MOC) Prefs.h -o OREADERMOCS/moc_Prefs.cpp | ||
578 | |||
579 | OREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h | ||
580 | $(MOC) QFloatBar.h -o OREADERMOCS/moc_QFloatBar.cpp | ||
581 | |||
582 | OREADERMOCS/moc_QTReader.cpp: QTReader.h | ||
583 | $(MOC) QTReader.h -o OREADERMOCS/moc_QTReader.cpp | ||
584 | |||
585 | OREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h | ||
586 | $(MOC) QTReaderApp.h -o OREADERMOCS/moc_QTReaderApp.cpp | ||
587 | |||
588 | OREADERMOCS/moc_QtrListView.cpp: QtrListView.h | ||
589 | $(MOC) QtrListView.h -o OREADERMOCS/moc_QtrListView.cpp | ||
590 | |||
591 | OREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h | ||
592 | $(MOC) ToolbarPrefs.h -o OREADERMOCS/moc_ToolbarPrefs.cpp | ||
593 | |||
594 | OREADERMOCS/moc_URLDialog.cpp: URLDialog.h | ||
595 | $(MOC) URLDialog.h -o OREADERMOCS/moc_URLDialog.cpp | ||
596 | |||
597 | OREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h | ||
598 | $(MOC) cbkmkselector.h -o OREADERMOCS/moc_cbkmkselector.cpp | ||
599 | |||
600 | OREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h | ||
601 | $(MOC) fileBrowser.h -o OREADERMOCS/moc_fileBrowser.cpp | ||
602 | |||
603 | OREADERMOCS/moc_infowin.cpp: infowin.h | ||
604 | $(MOC) infowin.h -o OREADERMOCS/moc_infowin.cpp | ||
605 | |||
diff --git a/noncore/apps/opie-reader/reader.staticmak b/noncore/apps/opie-reader/reader.staticmak new file mode 100644 index 0000000..eab8857 --- a/dev/null +++ b/noncore/apps/opie-reader/reader.staticmak | |||
@@ -0,0 +1,846 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: QSTATICREADEROBJS/uqtreader | ||
3 | # Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 09:15:20 2004 | ||
4 | # Project: reader.staticpro | ||
5 | # Template: app | ||
6 | # Command: $(QMAKE) -o reader.staticmak reader.staticpro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = gcc | ||
12 | CXX = g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | CFLAGS = -pipe -w -g | ||
16 | CXXFLAGS = -pipe -w -g | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQSTATICREADERINC -I$(QTDIR)/include -IQSTATICREADERMOCS/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = | ||
22 | LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) | ||
32 | COPY_DIR = $(COPY) -r | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | CHK_DIR_EXISTS= test -d | ||
38 | MKDIR = mkdir -p | ||
39 | |||
40 | ####### Output directory | ||
41 | |||
42 | OBJECTS_DIR = QSTATICREADEROBJS/ | ||
43 | |||
44 | ####### Files | ||
45 | |||
46 | HEADERS = Aportis.h \ | ||
47 | Bkmks.h \ | ||
48 | BuffDoc.h \ | ||
49 | ButtonPrefs.h \ | ||
50 | CAnnoEdit.h \ | ||
51 | CBuffer.h \ | ||
52 | CDrawBuffer.h \ | ||
53 | CEncoding.h \ | ||
54 | CEncoding_tables.h \ | ||
55 | CExpander.h \ | ||
56 | CFilter.h \ | ||
57 | CloseDialog.h \ | ||
58 | Filedata.h \ | ||
59 | FixedFont.h \ | ||
60 | FontControl.h \ | ||
61 | GraphicWin.h \ | ||
62 | Markups.h \ | ||
63 | Navigation.h \ | ||
64 | Palm2QImage.h \ | ||
65 | Prefs.h \ | ||
66 | QFloatBar.h \ | ||
67 | QTReader.h \ | ||
68 | QTReaderApp.h \ | ||
69 | QtrListView.h \ | ||
70 | Queue.h \ | ||
71 | StyleConsts.h \ | ||
72 | ToolbarPrefs.h \ | ||
73 | URLDialog.h \ | ||
74 | ZText.h \ | ||
75 | arith.h \ | ||
76 | cbkmkselector.h \ | ||
77 | config.h \ | ||
78 | fileBrowser.h \ | ||
79 | infowin.h \ | ||
80 | linktype.h \ | ||
81 | my_list.h \ | ||
82 | names.h \ | ||
83 | QSTATICREADERINC/opie.h \ | ||
84 | pdb.h \ | ||
85 | plucker_base.h \ | ||
86 | plucker.h \ | ||
87 | ppm.h \ | ||
88 | ppm_expander.h \ | ||
89 | preferences.h \ | ||
90 | QSTATICREADERINC/static.h \ | ||
91 | usenef.h \ | ||
92 | QSTATICREADERINC/useqpe.h \ | ||
93 | ustring.h \ | ||
94 | utypes.h \ | ||
95 | version.h \ | ||
96 | ztxt.h | ||
97 | SOURCES = Aportis.cpp \ | ||
98 | Bkmks.cpp \ | ||
99 | BuffDoc.cpp \ | ||
100 | ButtonPrefs.cpp \ | ||
101 | CAnnoEdit.cpp \ | ||
102 | CBuffer.cpp \ | ||
103 | CDrawBuffer.cpp \ | ||
104 | CEncoding.cpp \ | ||
105 | CEncoding_tables.cpp \ | ||
106 | CExpander.cpp \ | ||
107 | CFilter.cpp \ | ||
108 | CHM.cpp \ | ||
109 | CRegExp.cpp \ | ||
110 | CloseDialog.cpp \ | ||
111 | FontControl.cpp \ | ||
112 | GraphicWin.cpp \ | ||
113 | Navigation.cpp \ | ||
114 | Palm2QImage.cpp \ | ||
115 | Prefs.cpp \ | ||
116 | QTReader.cpp \ | ||
117 | QTReaderApp.cpp \ | ||
118 | QtrListView.cpp \ | ||
119 | StyleConsts.cpp \ | ||
120 | ToolbarPrefs.cpp \ | ||
121 | URLDialog.cpp \ | ||
122 | arith_d.cpp \ | ||
123 | chm_lib.c \ | ||
124 | fileBrowser.cpp \ | ||
125 | hrule.cpp \ | ||
126 | infowin.cpp \ | ||
127 | iSilo.cpp \ | ||
128 | lzx.c \ | ||
129 | main.cpp \ | ||
130 | orkey.cpp \ | ||
131 | pdb.cpp \ | ||
132 | plucker.cpp \ | ||
133 | plucker_base.cpp \ | ||
134 | ppm.cpp \ | ||
135 | ppm_expander.cpp \ | ||
136 | preferences.cpp \ | ||
137 | striphtml.cpp \ | ||
138 | util.cpp \ | ||
139 | version.cpp \ | ||
140 | ztxt.cpp | ||
141 | OBJECTS = QSTATICREADEROBJS/Aportis.o \ | ||
142 | QSTATICREADEROBJS/Bkmks.o \ | ||
143 | QSTATICREADEROBJS/BuffDoc.o \ | ||
144 | QSTATICREADEROBJS/ButtonPrefs.o \ | ||
145 | QSTATICREADEROBJS/CAnnoEdit.o \ | ||
146 | QSTATICREADEROBJS/CBuffer.o \ | ||
147 | QSTATICREADEROBJS/CDrawBuffer.o \ | ||
148 | QSTATICREADEROBJS/CEncoding.o \ | ||
149 | QSTATICREADEROBJS/CEncoding_tables.o \ | ||
150 | QSTATICREADEROBJS/CExpander.o \ | ||
151 | QSTATICREADEROBJS/CFilter.o \ | ||
152 | QSTATICREADEROBJS/CHM.o \ | ||
153 | QSTATICREADEROBJS/CRegExp.o \ | ||
154 | QSTATICREADEROBJS/CloseDialog.o \ | ||
155 | QSTATICREADEROBJS/FontControl.o \ | ||
156 | QSTATICREADEROBJS/GraphicWin.o \ | ||
157 | QSTATICREADEROBJS/Navigation.o \ | ||
158 | QSTATICREADEROBJS/Palm2QImage.o \ | ||
159 | QSTATICREADEROBJS/Prefs.o \ | ||
160 | QSTATICREADEROBJS/QTReader.o \ | ||
161 | QSTATICREADEROBJS/QTReaderApp.o \ | ||
162 | QSTATICREADEROBJS/QtrListView.o \ | ||
163 | QSTATICREADEROBJS/StyleConsts.o \ | ||
164 | QSTATICREADEROBJS/ToolbarPrefs.o \ | ||
165 | QSTATICREADEROBJS/URLDialog.o \ | ||
166 | QSTATICREADEROBJS/arith_d.o \ | ||
167 | QSTATICREADEROBJS/chm_lib.o \ | ||
168 | QSTATICREADEROBJS/fileBrowser.o \ | ||
169 | QSTATICREADEROBJS/hrule.o \ | ||
170 | QSTATICREADEROBJS/infowin.o \ | ||
171 | QSTATICREADEROBJS/iSilo.o \ | ||
172 | QSTATICREADEROBJS/lzx.o \ | ||
173 | QSTATICREADEROBJS/main.o \ | ||
174 | QSTATICREADEROBJS/orkey.o \ | ||
175 | QSTATICREADEROBJS/pdb.o \ | ||
176 | QSTATICREADEROBJS/plucker.o \ | ||
177 | QSTATICREADEROBJS/plucker_base.o \ | ||
178 | QSTATICREADEROBJS/ppm.o \ | ||
179 | QSTATICREADEROBJS/ppm_expander.o \ | ||
180 | QSTATICREADEROBJS/preferences.o \ | ||
181 | QSTATICREADEROBJS/striphtml.o \ | ||
182 | QSTATICREADEROBJS/util.o \ | ||
183 | QSTATICREADEROBJS/version.o \ | ||
184 | QSTATICREADEROBJS/ztxt.o | ||
185 | FORMS = | ||
186 | UICDECLS = | ||
187 | UICIMPLS = | ||
188 | SRCMOC = QSTATICREADERMOCS/moc_ButtonPrefs.cpp \ | ||
189 | QSTATICREADERMOCS/moc_CAnnoEdit.cpp \ | ||
190 | QSTATICREADERMOCS/moc_CloseDialog.cpp \ | ||
191 | QSTATICREADERMOCS/moc_GraphicWin.cpp \ | ||
192 | QSTATICREADERMOCS/moc_Prefs.cpp \ | ||
193 | QSTATICREADERMOCS/moc_QFloatBar.cpp \ | ||
194 | QSTATICREADERMOCS/moc_QTReader.cpp \ | ||
195 | QSTATICREADERMOCS/moc_QTReaderApp.cpp \ | ||
196 | QSTATICREADERMOCS/moc_QtrListView.cpp \ | ||
197 | QSTATICREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
198 | QSTATICREADERMOCS/moc_URLDialog.cpp \ | ||
199 | QSTATICREADERMOCS/moc_cbkmkselector.cpp \ | ||
200 | QSTATICREADERMOCS/moc_fileBrowser.cpp \ | ||
201 | QSTATICREADERMOCS/moc_infowin.cpp | ||
202 | OBJMOC = QSTATICREADEROBJS/moc_ButtonPrefs.o \ | ||
203 | QSTATICREADEROBJS/moc_CAnnoEdit.o \ | ||
204 | QSTATICREADEROBJS/moc_CloseDialog.o \ | ||
205 | QSTATICREADEROBJS/moc_GraphicWin.o \ | ||
206 | QSTATICREADEROBJS/moc_Prefs.o \ | ||
207 | QSTATICREADEROBJS/moc_QFloatBar.o \ | ||
208 | QSTATICREADEROBJS/moc_QTReader.o \ | ||
209 | QSTATICREADEROBJS/moc_QTReaderApp.o \ | ||
210 | QSTATICREADEROBJS/moc_QtrListView.o \ | ||
211 | QSTATICREADEROBJS/moc_ToolbarPrefs.o \ | ||
212 | QSTATICREADEROBJS/moc_URLDialog.o \ | ||
213 | QSTATICREADEROBJS/moc_cbkmkselector.o \ | ||
214 | QSTATICREADEROBJS/moc_fileBrowser.o \ | ||
215 | QSTATICREADEROBJS/moc_infowin.o | ||
216 | DIST = reader.staticpro | ||
217 | QMAKE_TARGET = uqtreader | ||
218 | DESTDIR = QSTATICREADEROBJS/ | ||
219 | TARGET = QSTATICREADEROBJS/uqtreader | ||
220 | |||
221 | first: all | ||
222 | ####### Implicit rules | ||
223 | |||
224 | .SUFFIXES: .c .o .cpp .cc .cxx .C | ||
225 | |||
226 | .cpp.o: | ||
227 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
228 | |||
229 | .cc.o: | ||
230 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
231 | |||
232 | .cxx.o: | ||
233 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
234 | |||
235 | .C.o: | ||
236 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
237 | |||
238 | .c.o: | ||
239 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
240 | |||
241 | ####### Build rules | ||
242 | |||
243 | all: reader.staticmak $(TARGET) | ||
244 | |||
245 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
246 | test -d QSTATICREADEROBJS/ || mkdir -p QSTATICREADEROBJS/ | ||
247 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) | ||
248 | |||
249 | mocables: $(SRCMOC) | ||
250 | uicables: $(UICDECLS) $(UICIMPLS) | ||
251 | |||
252 | $(MOC): | ||
253 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
254 | |||
255 | reader.staticmak: reader.staticpro /usr/lib/qt3/mkspecs/default/qmake.conf | ||
256 | $(QMAKE) -o reader.staticmak reader.staticpro | ||
257 | qmake: | ||
258 | @$(QMAKE) -o reader.staticmak reader.staticpro | ||
259 | |||
260 | dist: | ||
261 | @mkdir -p QSTATICREADEROBJS/uqtreader && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) QSTATICREADEROBJS/uqtreader/ && ( cd `dirname QSTATICREADEROBJS/uqtreader` && $(TAR) uqtreader.tar uqtreader && $(GZIP) uqtreader.tar ) && $(MOVE) `dirname QSTATICREADEROBJS/uqtreader`/uqtreader.tar.gz . && $(DEL_FILE) -r QSTATICREADEROBJS/uqtreader | ||
262 | |||
263 | mocclean: | ||
264 | -$(DEL_FILE) $(OBJMOC) | ||
265 | -$(DEL_FILE) $(SRCMOC) | ||
266 | |||
267 | uiclean: | ||
268 | |||
269 | yaccclean: | ||
270 | lexclean: | ||
271 | clean: mocclean | ||
272 | -$(DEL_FILE) $(OBJECTS) | ||
273 | -$(DEL_FILE) *~ core *.core | ||
274 | |||
275 | |||
276 | ####### Sub-libraries | ||
277 | |||
278 | distclean: clean | ||
279 | -$(DEL_FILE) QSTATICREADEROBJS/$(TARGET) $(TARGET) | ||
280 | |||
281 | |||
282 | FORCE: | ||
283 | |||
284 | ####### Compile | ||
285 | |||
286 | QSTATICREADEROBJS/Aportis.o: Aportis.cpp Aportis.h \ | ||
287 | my_list.h \ | ||
288 | Bkmks.h \ | ||
289 | QSTATICREADERINC/static.h \ | ||
290 | CExpander.h \ | ||
291 | pdb.h \ | ||
292 | QSTATICREADERINC/useqpe.h \ | ||
293 | config.h \ | ||
294 | StyleConsts.h \ | ||
295 | Markups.h \ | ||
296 | names.h \ | ||
297 | linktype.h \ | ||
298 | ustring.h \ | ||
299 | Filedata.h | ||
300 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Aportis.o Aportis.cpp | ||
301 | |||
302 | QSTATICREADEROBJS/Bkmks.o: Bkmks.cpp Bkmks.h \ | ||
303 | StyleConsts.h \ | ||
304 | Markups.h \ | ||
305 | my_list.h \ | ||
306 | version.h \ | ||
307 | names.h \ | ||
308 | config.h \ | ||
309 | Filedata.h \ | ||
310 | ustring.h | ||
311 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Bkmks.o Bkmks.cpp | ||
312 | |||
313 | QSTATICREADEROBJS/BuffDoc.o: BuffDoc.cpp QSTATICREADERINC/static.h \ | ||
314 | names.h \ | ||
315 | QSTATICREADERINC/useqpe.h \ | ||
316 | usenef.h \ | ||
317 | BuffDoc.h \ | ||
318 | config.h \ | ||
319 | CDrawBuffer.h \ | ||
320 | ZText.h \ | ||
321 | ebookcodec.h \ | ||
322 | Aportis.h \ | ||
323 | CHM.h \ | ||
324 | ppm_expander.h \ | ||
325 | ztxt.h \ | ||
326 | plucker.h \ | ||
327 | iSilo.h \ | ||
328 | CFilter.h \ | ||
329 | CExpander.h \ | ||
330 | StyleConsts.h \ | ||
331 | CBuffer.h \ | ||
332 | my_list.h \ | ||
333 | linktype.h \ | ||
334 | ustring.h \ | ||
335 | CEncoding.h \ | ||
336 | Markups.h \ | ||
337 | CEncoding_tables.h \ | ||
338 | pdb.h \ | ||
339 | chm_lib.h \ | ||
340 | utypes.h \ | ||
341 | ppm.h \ | ||
342 | arith.h \ | ||
343 | plucker_base.h \ | ||
344 | Navigation.h \ | ||
345 | hrule.h | ||
346 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/BuffDoc.o BuffDoc.cpp | ||
347 | |||
348 | QSTATICREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp ButtonPrefs.h \ | ||
349 | orkey.h | ||
350 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp | ||
351 | |||
352 | QSTATICREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp CAnnoEdit.h | ||
353 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp | ||
354 | |||
355 | QSTATICREADEROBJS/CBuffer.o: CBuffer.cpp CBuffer.h \ | ||
356 | config.h \ | ||
357 | ustring.h | ||
358 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CBuffer.o CBuffer.cpp | ||
359 | |||
360 | QSTATICREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp CDrawBuffer.h \ | ||
361 | FontControl.h \ | ||
362 | QSTATICREADERINC/useqpe.h \ | ||
363 | QSTATICREADERINC/opie.h \ | ||
364 | StyleConsts.h \ | ||
365 | CBuffer.h \ | ||
366 | my_list.h \ | ||
367 | linktype.h \ | ||
368 | config.h \ | ||
369 | ustring.h | ||
370 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp | ||
371 | |||
372 | QSTATICREADEROBJS/CEncoding.o: CEncoding.cpp CEncoding.h \ | ||
373 | CExpander.h \ | ||
374 | CEncoding_tables.h \ | ||
375 | QSTATICREADERINC/useqpe.h \ | ||
376 | config.h \ | ||
377 | StyleConsts.h \ | ||
378 | Markups.h \ | ||
379 | names.h \ | ||
380 | linktype.h \ | ||
381 | ustring.h | ||
382 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CEncoding.o CEncoding.cpp | ||
383 | |||
384 | QSTATICREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp CEncoding_tables.h \ | ||
385 | config.h \ | ||
386 | ustring.h | ||
387 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp | ||
388 | |||
389 | QSTATICREADEROBJS/CExpander.o: CExpander.cpp CExpander.h \ | ||
390 | QSTATICREADERINC/useqpe.h \ | ||
391 | config.h \ | ||
392 | StyleConsts.h \ | ||
393 | Markups.h \ | ||
394 | names.h \ | ||
395 | linktype.h \ | ||
396 | ustring.h | ||
397 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CExpander.o CExpander.cpp | ||
398 | |||
399 | QSTATICREADEROBJS/CFilter.o: CFilter.cpp QSTATICREADERINC/useqpe.h \ | ||
400 | CDrawBuffer.h \ | ||
401 | CFilter.h \ | ||
402 | hrule.h \ | ||
403 | Bkmks.h \ | ||
404 | QTReader.h \ | ||
405 | CRegExp.h \ | ||
406 | StyleConsts.h \ | ||
407 | CBuffer.h \ | ||
408 | my_list.h \ | ||
409 | linktype.h \ | ||
410 | config.h \ | ||
411 | ustring.h \ | ||
412 | CExpander.h \ | ||
413 | CEncoding.h \ | ||
414 | QSTATICREADERINC/static.h \ | ||
415 | Markups.h \ | ||
416 | names.h \ | ||
417 | CEncoding_tables.h \ | ||
418 | Filedata.h \ | ||
419 | BuffDoc.h \ | ||
420 | FontControl.h \ | ||
421 | BGType.h \ | ||
422 | striphtml.h \ | ||
423 | Navigation.h \ | ||
424 | hash.h \ | ||
425 | Queue.h | ||
426 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CFilter.o CFilter.cpp | ||
427 | |||
428 | QSTATICREADEROBJS/CHM.o: CHM.cpp CHM.h \ | ||
429 | chm_lib.h \ | ||
430 | QSTATICREADERINC/static.h \ | ||
431 | QSTATICREADERINC/useqpe.h \ | ||
432 | CExpander.h \ | ||
433 | my_list.h \ | ||
434 | config.h \ | ||
435 | StyleConsts.h \ | ||
436 | Markups.h \ | ||
437 | names.h \ | ||
438 | linktype.h \ | ||
439 | ustring.h | ||
440 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CHM.o CHM.cpp | ||
441 | |||
442 | QSTATICREADEROBJS/CRegExp.o: CRegExp.cpp CRegExp.h \ | ||
443 | config.h \ | ||
444 | hash.h \ | ||
445 | Queue.h \ | ||
446 | ustring.h \ | ||
447 | my_list.h | ||
448 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CRegExp.o CRegExp.cpp | ||
449 | |||
450 | QSTATICREADEROBJS/CloseDialog.o: CloseDialog.cpp CloseDialog.h \ | ||
451 | QSTATICREADERINC/useqpe.h | ||
452 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CloseDialog.o CloseDialog.cpp | ||
453 | |||
454 | QSTATICREADEROBJS/FontControl.o: FontControl.cpp QSTATICREADERINC/opie.h \ | ||
455 | QSTATICREADERINC/useqpe.h \ | ||
456 | FontControl.h \ | ||
457 | StyleConsts.h | ||
458 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/FontControl.o FontControl.cpp | ||
459 | |||
460 | QSTATICREADEROBJS/GraphicWin.o: GraphicWin.cpp GraphicWin.h | ||
461 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/GraphicWin.o GraphicWin.cpp | ||
462 | |||
463 | QSTATICREADEROBJS/Navigation.o: Navigation.cpp Navigation.h | ||
464 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Navigation.o Navigation.cpp | ||
465 | |||
466 | QSTATICREADEROBJS/Palm2QImage.o: Palm2QImage.cpp QSTATICREADERINC/useqpe.h | ||
467 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Palm2QImage.o Palm2QImage.cpp | ||
468 | |||
469 | QSTATICREADEROBJS/Prefs.o: Prefs.cpp Prefs.h \ | ||
470 | CEncoding_tables.h \ | ||
471 | orkey.h | ||
472 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Prefs.o Prefs.cpp | ||
473 | |||
474 | QSTATICREADEROBJS/QTReader.o: QTReader.cpp QSTATICREADERINC/useqpe.h \ | ||
475 | config.h \ | ||
476 | QTReader.h \ | ||
477 | CDrawBuffer.h \ | ||
478 | ustring.h \ | ||
479 | QSTATICREADERINC/static.h \ | ||
480 | my_list.h \ | ||
481 | BuffDoc.h \ | ||
482 | FontControl.h \ | ||
483 | BGType.h \ | ||
484 | striphtml.h \ | ||
485 | CFilter.h \ | ||
486 | CExpander.h \ | ||
487 | StyleConsts.h \ | ||
488 | CBuffer.h \ | ||
489 | linktype.h \ | ||
490 | CEncoding.h \ | ||
491 | Markups.h \ | ||
492 | names.h \ | ||
493 | CEncoding_tables.h \ | ||
494 | Navigation.h | ||
495 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/QTReader.o QTReader.cpp | ||
496 | |||
497 | QSTATICREADEROBJS/QTReaderApp.o: QTReaderApp.cpp QSTATICREADERINC/useqpe.h \ | ||
498 | QTReader.h \ | ||
499 | GraphicWin.h \ | ||
500 | Bkmks.h \ | ||
501 | cbkmkselector.h \ | ||
502 | infowin.h \ | ||
503 | ToolbarPrefs.h \ | ||
504 | Prefs.h \ | ||
505 | CAnnoEdit.h \ | ||
506 | QFloatBar.h \ | ||
507 | FixedFont.h \ | ||
508 | URLDialog.h \ | ||
509 | util.h \ | ||
510 | QSTATICREADERINC/opie.h \ | ||
511 | fileBrowser.h \ | ||
512 | QTReaderApp.h \ | ||
513 | CDrawBuffer.h \ | ||
514 | Filedata.h \ | ||
515 | names.h \ | ||
516 | CEncoding_tables.h \ | ||
517 | CloseDialog.h \ | ||
518 | ButtonPrefs.h \ | ||
519 | QSTATICREADERINC/static.h \ | ||
520 | my_list.h \ | ||
521 | BuffDoc.h \ | ||
522 | FontControl.h \ | ||
523 | BGType.h \ | ||
524 | striphtml.h \ | ||
525 | CFilter.h \ | ||
526 | CExpander.h \ | ||
527 | StyleConsts.h \ | ||
528 | CBuffer.h \ | ||
529 | linktype.h \ | ||
530 | config.h \ | ||
531 | ustring.h \ | ||
532 | CEncoding.h \ | ||
533 | Markups.h \ | ||
534 | Navigation.h \ | ||
535 | preferences.h \ | ||
536 | orkey.h | ||
537 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/QTReaderApp.o QTReaderApp.cpp | ||
538 | |||
539 | QSTATICREADEROBJS/QtrListView.o: QtrListView.cpp QtrListView.h | ||
540 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/QtrListView.o QtrListView.cpp | ||
541 | |||
542 | QSTATICREADEROBJS/StyleConsts.o: StyleConsts.cpp StyleConsts.h | ||
543 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/StyleConsts.o StyleConsts.cpp | ||
544 | |||
545 | QSTATICREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp QSTATICREADERINC/useqpe.h \ | ||
546 | ToolbarPrefs.h \ | ||
547 | preferences.h | ||
548 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp | ||
549 | |||
550 | QSTATICREADEROBJS/URLDialog.o: URLDialog.cpp URLDialog.h \ | ||
551 | QSTATICREADERINC/useqpe.h | ||
552 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/URLDialog.o URLDialog.cpp | ||
553 | |||
554 | QSTATICREADEROBJS/arith_d.o: arith_d.cpp arith.h \ | ||
555 | utypes.h | ||
556 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/arith_d.o arith_d.cpp | ||
557 | |||
558 | QSTATICREADEROBJS/chm_lib.o: chm_lib.c chm_lib.h \ | ||
559 | lzx.h | ||
560 | $(CC) -c $(CFLAGS) $(INCPATH) -o QSTATICREADEROBJS/chm_lib.o chm_lib.c | ||
561 | |||
562 | QSTATICREADEROBJS/fileBrowser.o: fileBrowser.cpp fileBrowser.h \ | ||
563 | QtrListView.h | ||
564 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/fileBrowser.o fileBrowser.cpp | ||
565 | |||
566 | QSTATICREADEROBJS/hrule.o: hrule.cpp | ||
567 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/hrule.o hrule.cpp | ||
568 | |||
569 | QSTATICREADEROBJS/infowin.o: infowin.cpp infowin.h \ | ||
570 | version.h \ | ||
571 | names.h | ||
572 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/infowin.o infowin.cpp | ||
573 | |||
574 | QSTATICREADEROBJS/iSilo.o: iSilo.cpp iSilo.h \ | ||
575 | pdb.h \ | ||
576 | QSTATICREADERINC/useqpe.h \ | ||
577 | CExpander.h \ | ||
578 | config.h \ | ||
579 | StyleConsts.h \ | ||
580 | Markups.h \ | ||
581 | names.h \ | ||
582 | linktype.h \ | ||
583 | ustring.h | ||
584 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/iSilo.o iSilo.cpp | ||
585 | |||
586 | QSTATICREADEROBJS/lzx.o: lzx.c lzx.h | ||
587 | $(CC) -c $(CFLAGS) $(INCPATH) -o QSTATICREADEROBJS/lzx.o lzx.c | ||
588 | |||
589 | QSTATICREADEROBJS/main.o: main.cpp QSTATICREADERINC/useqpe.h \ | ||
590 | QTReaderApp.h \ | ||
591 | CExpander.h \ | ||
592 | CEncoding.h \ | ||
593 | orkey.h \ | ||
594 | BGType.h \ | ||
595 | config.h \ | ||
596 | StyleConsts.h \ | ||
597 | Markups.h \ | ||
598 | names.h \ | ||
599 | linktype.h \ | ||
600 | ustring.h \ | ||
601 | CEncoding_tables.h | ||
602 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/main.o main.cpp | ||
603 | |||
604 | QSTATICREADEROBJS/orkey.o: orkey.cpp orkey.h | ||
605 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/orkey.o orkey.cpp | ||
606 | |||
607 | QSTATICREADEROBJS/pdb.o: pdb.cpp pdb.h \ | ||
608 | QSTATICREADERINC/useqpe.h \ | ||
609 | CExpander.h \ | ||
610 | config.h \ | ||
611 | StyleConsts.h \ | ||
612 | Markups.h \ | ||
613 | names.h \ | ||
614 | linktype.h \ | ||
615 | ustring.h | ||
616 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/pdb.o pdb.cpp | ||
617 | |||
618 | QSTATICREADEROBJS/plucker.o: plucker.cpp QSTATICREADERINC/useqpe.h \ | ||
619 | plucker.h \ | ||
620 | Aportis.h \ | ||
621 | Palm2QImage.h \ | ||
622 | QSTATICREADERINC/static.h \ | ||
623 | plucker_base.h \ | ||
624 | CExpander.h \ | ||
625 | ztxt.h \ | ||
626 | pdb.h \ | ||
627 | CBuffer.h \ | ||
628 | my_list.h \ | ||
629 | Navigation.h \ | ||
630 | hrule.h \ | ||
631 | config.h \ | ||
632 | StyleConsts.h \ | ||
633 | Markups.h \ | ||
634 | names.h \ | ||
635 | linktype.h \ | ||
636 | ustring.h | ||
637 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/plucker.o plucker.cpp | ||
638 | |||
639 | QSTATICREADEROBJS/plucker_base.o: plucker_base.cpp QSTATICREADERINC/useqpe.h \ | ||
640 | usenef.h \ | ||
641 | QSTATICREADERINC/static.h \ | ||
642 | plucker_base.h \ | ||
643 | Aportis.h \ | ||
644 | hrule.h \ | ||
645 | CExpander.h \ | ||
646 | ztxt.h \ | ||
647 | pdb.h \ | ||
648 | CBuffer.h \ | ||
649 | my_list.h \ | ||
650 | Navigation.h \ | ||
651 | config.h \ | ||
652 | StyleConsts.h \ | ||
653 | Markups.h \ | ||
654 | names.h \ | ||
655 | linktype.h \ | ||
656 | ustring.h | ||
657 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/plucker_base.o plucker_base.cpp | ||
658 | |||
659 | QSTATICREADEROBJS/ppm.o: ppm.cpp arith.h \ | ||
660 | ppm.h \ | ||
661 | utypes.h | ||
662 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ppm.o ppm.cpp | ||
663 | |||
664 | QSTATICREADEROBJS/ppm_expander.o: ppm_expander.cpp QSTATICREADERINC/static.h \ | ||
665 | ppm_expander.h \ | ||
666 | QSTATICREADERINC/useqpe.h \ | ||
667 | CExpander.h \ | ||
668 | utypes.h \ | ||
669 | ppm.h \ | ||
670 | arith.h \ | ||
671 | config.h \ | ||
672 | StyleConsts.h \ | ||
673 | Markups.h \ | ||
674 | names.h \ | ||
675 | linktype.h \ | ||
676 | ustring.h | ||
677 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ppm_expander.o ppm_expander.cpp | ||
678 | |||
679 | QSTATICREADEROBJS/preferences.o: preferences.cpp QSTATICREADERINC/useqpe.h \ | ||
680 | preferences.h | ||
681 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/preferences.o preferences.cpp | ||
682 | |||
683 | QSTATICREADEROBJS/striphtml.o: striphtml.cpp QSTATICREADERINC/useqpe.h \ | ||
684 | CDrawBuffer.h \ | ||
685 | striphtml.h \ | ||
686 | hrule.h \ | ||
687 | StyleConsts.h \ | ||
688 | CBuffer.h \ | ||
689 | my_list.h \ | ||
690 | linktype.h \ | ||
691 | config.h \ | ||
692 | ustring.h \ | ||
693 | CFilter.h \ | ||
694 | Navigation.h \ | ||
695 | CExpander.h \ | ||
696 | CEncoding.h \ | ||
697 | QSTATICREADERINC/static.h \ | ||
698 | Markups.h \ | ||
699 | names.h \ | ||
700 | CEncoding_tables.h | ||
701 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/striphtml.o striphtml.cpp | ||
702 | |||
703 | QSTATICREADEROBJS/util.o: util.cpp util.h | ||
704 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/util.o util.cpp | ||
705 | |||
706 | QSTATICREADEROBJS/version.o: version.cpp version.h \ | ||
707 | names.h | ||
708 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/version.o version.cpp | ||
709 | |||
710 | QSTATICREADEROBJS/ztxt.o: ztxt.cpp ztxt.h \ | ||
711 | my_list.h \ | ||
712 | Bkmks.h \ | ||
713 | QSTATICREADERINC/static.h \ | ||
714 | CExpander.h \ | ||
715 | pdb.h \ | ||
716 | QSTATICREADERINC/useqpe.h \ | ||
717 | config.h \ | ||
718 | StyleConsts.h \ | ||
719 | Markups.h \ | ||
720 | names.h \ | ||
721 | linktype.h \ | ||
722 | ustring.h \ | ||
723 | Filedata.h | ||
724 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ztxt.o ztxt.cpp | ||
725 | |||
726 | QSTATICREADEROBJS/moc_ButtonPrefs.o: QSTATICREADERMOCS/moc_ButtonPrefs.cpp ButtonPrefs.h orkey.h | ||
727 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_ButtonPrefs.o QSTATICREADERMOCS/moc_ButtonPrefs.cpp | ||
728 | |||
729 | QSTATICREADEROBJS/moc_CAnnoEdit.o: QSTATICREADERMOCS/moc_CAnnoEdit.cpp CAnnoEdit.h | ||
730 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_CAnnoEdit.o QSTATICREADERMOCS/moc_CAnnoEdit.cpp | ||
731 | |||
732 | QSTATICREADEROBJS/moc_CloseDialog.o: QSTATICREADERMOCS/moc_CloseDialog.cpp CloseDialog.h QSTATICREADERINC/useqpe.h | ||
733 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_CloseDialog.o QSTATICREADERMOCS/moc_CloseDialog.cpp | ||
734 | |||
735 | QSTATICREADEROBJS/moc_GraphicWin.o: QSTATICREADERMOCS/moc_GraphicWin.cpp GraphicWin.h | ||
736 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_GraphicWin.o QSTATICREADERMOCS/moc_GraphicWin.cpp | ||
737 | |||
738 | QSTATICREADEROBJS/moc_Prefs.o: QSTATICREADERMOCS/moc_Prefs.cpp Prefs.h orkey.h | ||
739 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_Prefs.o QSTATICREADERMOCS/moc_Prefs.cpp | ||
740 | |||
741 | QSTATICREADEROBJS/moc_QFloatBar.o: QSTATICREADERMOCS/moc_QFloatBar.cpp QFloatBar.h | ||
742 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QFloatBar.o QSTATICREADERMOCS/moc_QFloatBar.cpp | ||
743 | |||
744 | QSTATICREADEROBJS/moc_QTReader.o: QSTATICREADERMOCS/moc_QTReader.cpp QTReader.h QSTATICREADERINC/static.h \ | ||
745 | my_list.h \ | ||
746 | BuffDoc.h \ | ||
747 | FontControl.h \ | ||
748 | BGType.h \ | ||
749 | striphtml.h \ | ||
750 | QSTATICREADERINC/useqpe.h \ | ||
751 | CDrawBuffer.h \ | ||
752 | CFilter.h \ | ||
753 | CExpander.h \ | ||
754 | StyleConsts.h \ | ||
755 | CBuffer.h \ | ||
756 | linktype.h \ | ||
757 | config.h \ | ||
758 | ustring.h \ | ||
759 | CEncoding.h \ | ||
760 | Markups.h \ | ||
761 | names.h \ | ||
762 | CEncoding_tables.h \ | ||
763 | Navigation.h | ||
764 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QTReader.o QSTATICREADERMOCS/moc_QTReader.cpp | ||
765 | |||
766 | QSTATICREADEROBJS/moc_QTReaderApp.o: QSTATICREADERMOCS/moc_QTReaderApp.cpp QTReaderApp.h QSTATICREADERINC/useqpe.h \ | ||
767 | CExpander.h \ | ||
768 | CEncoding.h \ | ||
769 | orkey.h \ | ||
770 | BGType.h \ | ||
771 | config.h \ | ||
772 | StyleConsts.h \ | ||
773 | Markups.h \ | ||
774 | names.h \ | ||
775 | linktype.h \ | ||
776 | ustring.h \ | ||
777 | CEncoding_tables.h | ||
778 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QTReaderApp.o QSTATICREADERMOCS/moc_QTReaderApp.cpp | ||
779 | |||
780 | QSTATICREADEROBJS/moc_QtrListView.o: QSTATICREADERMOCS/moc_QtrListView.cpp QtrListView.h | ||
781 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QtrListView.o QSTATICREADERMOCS/moc_QtrListView.cpp | ||
782 | |||
783 | QSTATICREADEROBJS/moc_ToolbarPrefs.o: QSTATICREADERMOCS/moc_ToolbarPrefs.cpp ToolbarPrefs.h QSTATICREADERINC/useqpe.h \ | ||
784 | preferences.h | ||
785 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_ToolbarPrefs.o QSTATICREADERMOCS/moc_ToolbarPrefs.cpp | ||
786 | |||
787 | QSTATICREADEROBJS/moc_URLDialog.o: QSTATICREADERMOCS/moc_URLDialog.cpp URLDialog.h QSTATICREADERINC/useqpe.h | ||
788 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_URLDialog.o QSTATICREADERMOCS/moc_URLDialog.cpp | ||
789 | |||
790 | QSTATICREADEROBJS/moc_cbkmkselector.o: QSTATICREADERMOCS/moc_cbkmkselector.cpp cbkmkselector.h | ||
791 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_cbkmkselector.o QSTATICREADERMOCS/moc_cbkmkselector.cpp | ||
792 | |||
793 | QSTATICREADEROBJS/moc_fileBrowser.o: QSTATICREADERMOCS/moc_fileBrowser.cpp fileBrowser.h | ||
794 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_fileBrowser.o QSTATICREADERMOCS/moc_fileBrowser.cpp | ||
795 | |||
796 | QSTATICREADEROBJS/moc_infowin.o: QSTATICREADERMOCS/moc_infowin.cpp infowin.h | ||
797 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_infowin.o QSTATICREADERMOCS/moc_infowin.cpp | ||
798 | |||
799 | QSTATICREADERMOCS/moc_ButtonPrefs.cpp: $(MOC) ButtonPrefs.h | ||
800 | $(MOC) ButtonPrefs.h -o QSTATICREADERMOCS/moc_ButtonPrefs.cpp | ||
801 | |||
802 | QSTATICREADERMOCS/moc_CAnnoEdit.cpp: $(MOC) CAnnoEdit.h | ||
803 | $(MOC) CAnnoEdit.h -o QSTATICREADERMOCS/moc_CAnnoEdit.cpp | ||
804 | |||
805 | QSTATICREADERMOCS/moc_CloseDialog.cpp: $(MOC) CloseDialog.h | ||
806 | $(MOC) CloseDialog.h -o QSTATICREADERMOCS/moc_CloseDialog.cpp | ||
807 | |||
808 | QSTATICREADERMOCS/moc_GraphicWin.cpp: $(MOC) GraphicWin.h | ||
809 | $(MOC) GraphicWin.h -o QSTATICREADERMOCS/moc_GraphicWin.cpp | ||
810 | |||
811 | QSTATICREADERMOCS/moc_Prefs.cpp: $(MOC) Prefs.h | ||
812 | $(MOC) Prefs.h -o QSTATICREADERMOCS/moc_Prefs.cpp | ||
813 | |||
814 | QSTATICREADERMOCS/moc_QFloatBar.cpp: $(MOC) QFloatBar.h | ||
815 | $(MOC) QFloatBar.h -o QSTATICREADERMOCS/moc_QFloatBar.cpp | ||
816 | |||
817 | QSTATICREADERMOCS/moc_QTReader.cpp: $(MOC) QTReader.h | ||
818 | $(MOC) QTReader.h -o QSTATICREADERMOCS/moc_QTReader.cpp | ||
819 | |||
820 | QSTATICREADERMOCS/moc_QTReaderApp.cpp: $(MOC) QTReaderApp.h | ||
821 | $(MOC) QTReaderApp.h -o QSTATICREADERMOCS/moc_QTReaderApp.cpp | ||
822 | |||
823 | QSTATICREADERMOCS/moc_QtrListView.cpp: $(MOC) QtrListView.h | ||
824 | $(MOC) QtrListView.h -o QSTATICREADERMOCS/moc_QtrListView.cpp | ||
825 | |||
826 | QSTATICREADERMOCS/moc_ToolbarPrefs.cpp: $(MOC) ToolbarPrefs.h | ||
827 | $(MOC) ToolbarPrefs.h -o QSTATICREADERMOCS/moc_ToolbarPrefs.cpp | ||
828 | |||
829 | QSTATICREADERMOCS/moc_URLDialog.cpp: $(MOC) URLDialog.h | ||
830 | $(MOC) URLDialog.h -o QSTATICREADERMOCS/moc_URLDialog.cpp | ||
831 | |||
832 | QSTATICREADERMOCS/moc_cbkmkselector.cpp: $(MOC) cbkmkselector.h | ||
833 | $(MOC) cbkmkselector.h -o QSTATICREADERMOCS/moc_cbkmkselector.cpp | ||
834 | |||
835 | QSTATICREADERMOCS/moc_fileBrowser.cpp: $(MOC) fileBrowser.h | ||
836 | $(MOC) fileBrowser.h -o QSTATICREADERMOCS/moc_fileBrowser.cpp | ||
837 | |||
838 | QSTATICREADERMOCS/moc_infowin.cpp: $(MOC) infowin.h | ||
839 | $(MOC) infowin.h -o QSTATICREADERMOCS/moc_infowin.cpp | ||
840 | |||
841 | ####### Install | ||
842 | |||
843 | install: all | ||
844 | |||
845 | uninstall: | ||
846 | |||
diff --git a/noncore/apps/opie-reader/reader.staticpro b/noncore/apps/opie-reader/reader.staticpro new file mode 100644 index 0000000..78ea8fb --- a/dev/null +++ b/noncore/apps/opie-reader/reader.staticpro | |||
@@ -0,0 +1,108 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_off debug | ||
3 | HEADERS = Aportis.h \ | ||
4 | Bkmks.h \ | ||
5 | BuffDoc.h \ | ||
6 | ButtonPrefs.h \ | ||
7 | CAnnoEdit.h \ | ||
8 | CBuffer.h \ | ||
9 | CDrawBuffer.h \ | ||
10 | CEncoding.h \ | ||
11 | CEncoding_tables.h \ | ||
12 | CExpander.h \ | ||
13 | CFilter.h \ | ||
14 | CloseDialog.h \ | ||
15 | Filedata.h \ | ||
16 | FixedFont.h \ | ||
17 | FontControl.h \ | ||
18 | GraphicWin.h \ | ||
19 | Markups.h \ | ||
20 | Navigation.h \ | ||
21 | Palm2QImage.h \ | ||
22 | Prefs.h \ | ||
23 | QFloatBar.h \ | ||
24 | QTReader.h \ | ||
25 | QTReaderApp.h \ | ||
26 | QtrListView.h \ | ||
27 | Queue.h \ | ||
28 | StyleConsts.h \ | ||
29 | ToolbarPrefs.h \ | ||
30 | URLDialog.h \ | ||
31 | ZText.h \ | ||
32 | arith.h \ | ||
33 | cbkmkselector.h \ | ||
34 | config.h \ | ||
35 | fileBrowser.h \ | ||
36 | infowin.h \ | ||
37 | linktype.h \ | ||
38 | my_list.h \ | ||
39 | names.h \ | ||
40 | QSTATICREADERINC/opie.h \ | ||
41 | pdb.h \ | ||
42 | plucker_base.h \ | ||
43 | plucker.h \ | ||
44 | ppm.h \ | ||
45 | ppm_expander.h \ | ||
46 | preferences.h \ | ||
47 | QSTATICREADERINC/static.h \ | ||
48 | usenef.h \ | ||
49 | QSTATICREADERINC/useqpe.h \ | ||
50 | ustring.h \ | ||
51 | utypes.h \ | ||
52 | version.h \ | ||
53 | ztxt.h | ||
54 | |||
55 | SOURCES = Aportis.cpp \ | ||
56 | Bkmks.cpp \ | ||
57 | BuffDoc.cpp \ | ||
58 | ButtonPrefs.cpp \ | ||
59 | CAnnoEdit.cpp \ | ||
60 | CBuffer.cpp \ | ||
61 | CDrawBuffer.cpp \ | ||
62 | CEncoding.cpp \ | ||
63 | CEncoding_tables.cpp \ | ||
64 | CExpander.cpp \ | ||
65 | CFilter.cpp \ | ||
66 | CHM.cpp \ | ||
67 | CRegExp.cpp \ | ||
68 | CloseDialog.cpp \ | ||
69 | FontControl.cpp \ | ||
70 | GraphicWin.cpp \ | ||
71 | Navigation.cpp \ | ||
72 | Palm2QImage.cpp \ | ||
73 | Prefs.cpp \ | ||
74 | QTReader.cpp \ | ||
75 | QTReaderApp.cpp \ | ||
76 | QtrListView.cpp \ | ||
77 | StyleConsts.cpp \ | ||
78 | ToolbarPrefs.cpp \ | ||
79 | URLDialog.cpp \ | ||
80 | arith_d.cpp \ | ||
81 | chm_lib.c \ | ||
82 | fileBrowser.cpp \ | ||
83 | hrule.cpp \ | ||
84 | infowin.cpp \ | ||
85 | iSilo.cpp \ | ||
86 | lzx.c \ | ||
87 | main.cpp \ | ||
88 | orkey.cpp \ | ||
89 | pdb.cpp \ | ||
90 | plucker.cpp \ | ||
91 | plucker_base.cpp \ | ||
92 | ppm.cpp \ | ||
93 | ppm_expander.cpp \ | ||
94 | preferences.cpp \ | ||
95 | striphtml.cpp \ | ||
96 | util.cpp \ | ||
97 | version.cpp \ | ||
98 | ztxt.cpp | ||
99 | |||
100 | INTERFACES= | ||
101 | DESTDIR = QSTATICREADEROBJS | ||
102 | INCLUDEPATH+= QSTATICREADERINC | ||
103 | DEPENDPATH+= QSTATICREADERINC | ||
104 | OBJECTS_DIR = QSTATICREADEROBJS | ||
105 | MOC_DIR = QSTATICREADERMOCS | ||
106 | TARGET = uqtreader | ||
107 | #LIBS += -lqpe | ||
108 | |||
diff --git a/noncore/apps/opie-reader/reader.staticzmak b/noncore/apps/opie-reader/reader.staticzmak new file mode 100644 index 0000000..f9315c1 --- a/dev/null +++ b/noncore/apps/opie-reader/reader.staticzmak | |||
@@ -0,0 +1,862 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building ZSTATICREADEROBJS/uqtreader | ||
3 | # Generated by tmake at 09:24, 2004/07/25 | ||
4 | # Project: reader.staticzpro | ||
5 | # Template: app | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG | ||
14 | INCPATH =-IZSTATICREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS = | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqpe -lqte | ||
18 | MOC =$(QTDIR)/bin/moc | ||
19 | UIC =$(QTDIR)/bin/uic | ||
20 | |||
21 | TAR =tar -cf | ||
22 | GZIP =gzip -9f | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =Aportis.h \ | ||
27 | Bkmks.h \ | ||
28 | BuffDoc.h \ | ||
29 | ButtonPrefs.h \ | ||
30 | CAnnoEdit.h \ | ||
31 | CBuffer.h \ | ||
32 | CDrawBuffer.h \ | ||
33 | CEncoding.h \ | ||
34 | CEncoding_tables.h \ | ||
35 | CExpander.h \ | ||
36 | CFilter.h \ | ||
37 | CloseDialog.h \ | ||
38 | Filedata.h \ | ||
39 | FixedFont.h \ | ||
40 | FontControl.h \ | ||
41 | GraphicWin.h \ | ||
42 | Markups.h \ | ||
43 | Navigation.h \ | ||
44 | Palm2QImage.h \ | ||
45 | Prefs.h \ | ||
46 | QFloatBar.h \ | ||
47 | QTReader.h \ | ||
48 | QTReaderApp.h \ | ||
49 | QtrListView.h \ | ||
50 | Queue.h \ | ||
51 | StateData.h \ | ||
52 | StyleConsts.h \ | ||
53 | ToolbarPrefs.h \ | ||
54 | URLDialog.h \ | ||
55 | ZText.h \ | ||
56 | arith.h \ | ||
57 | cbkmkselector.h \ | ||
58 | config.h \ | ||
59 | fileBrowser.h \ | ||
60 | infowin.h \ | ||
61 | linktype.h \ | ||
62 | my_list.h \ | ||
63 | names.h \ | ||
64 | ZSTATICREADERINC/opie.h \ | ||
65 | pdb.h \ | ||
66 | plucker_base.h \ | ||
67 | plucker.h \ | ||
68 | ppm.h \ | ||
69 | ppm_expander.h \ | ||
70 | preferences.h \ | ||
71 | ZSTATICREADERINC/static.h \ | ||
72 | usenef.h \ | ||
73 | ZSTATICREADERINC/useqpe.h \ | ||
74 | ustring.h \ | ||
75 | utypes.h \ | ||
76 | version.h \ | ||
77 | ztxt.h | ||
78 | SOURCES =Aportis.cpp \ | ||
79 | Bkmks.cpp \ | ||
80 | BuffDoc.cpp \ | ||
81 | ButtonPrefs.cpp \ | ||
82 | CAnnoEdit.cpp \ | ||
83 | CBuffer.cpp \ | ||
84 | CDrawBuffer.cpp \ | ||
85 | CEncoding.cpp \ | ||
86 | CEncoding_tables.cpp \ | ||
87 | CExpander.cpp \ | ||
88 | CFilter.cpp \ | ||
89 | CHM.cpp \ | ||
90 | CRegExp.cpp \ | ||
91 | CloseDialog.cpp \ | ||
92 | FontControl.cpp \ | ||
93 | GraphicWin.cpp \ | ||
94 | Navigation.cpp \ | ||
95 | Palm2QImage.cpp \ | ||
96 | Prefs.cpp \ | ||
97 | QTReader.cpp \ | ||
98 | QTReaderApp.cpp \ | ||
99 | QtrListView.cpp \ | ||
100 | StyleConsts.cpp \ | ||
101 | ToolbarPrefs.cpp \ | ||
102 | URLDialog.cpp \ | ||
103 | arith_d.cpp \ | ||
104 | chm_lib.c \ | ||
105 | fileBrowser.cpp \ | ||
106 | hrule.cpp \ | ||
107 | infowin.cpp \ | ||
108 | iSilo.cpp \ | ||
109 | lzx.c \ | ||
110 | main.cpp \ | ||
111 | orkey.cpp \ | ||
112 | pdb.cpp \ | ||
113 | plucker.cpp \ | ||
114 | plucker_base.cpp \ | ||
115 | ppm.cpp \ | ||
116 | ppm_expander.cpp \ | ||
117 | striphtml.cpp \ | ||
118 | util.cpp \ | ||
119 | version.cpp \ | ||
120 | ztxt.cpp | ||
121 | OBJECTS =ZSTATICREADEROBJS/Aportis.o \ | ||
122 | ZSTATICREADEROBJS/Bkmks.o \ | ||
123 | ZSTATICREADEROBJS/BuffDoc.o \ | ||
124 | ZSTATICREADEROBJS/ButtonPrefs.o \ | ||
125 | ZSTATICREADEROBJS/CAnnoEdit.o \ | ||
126 | ZSTATICREADEROBJS/CBuffer.o \ | ||
127 | ZSTATICREADEROBJS/CDrawBuffer.o \ | ||
128 | ZSTATICREADEROBJS/CEncoding.o \ | ||
129 | ZSTATICREADEROBJS/CEncoding_tables.o \ | ||
130 | ZSTATICREADEROBJS/CExpander.o \ | ||
131 | ZSTATICREADEROBJS/CFilter.o \ | ||
132 | ZSTATICREADEROBJS/CHM.o \ | ||
133 | ZSTATICREADEROBJS/CRegExp.o \ | ||
134 | ZSTATICREADEROBJS/CloseDialog.o \ | ||
135 | ZSTATICREADEROBJS/FontControl.o \ | ||
136 | ZSTATICREADEROBJS/GraphicWin.o \ | ||
137 | ZSTATICREADEROBJS/Navigation.o \ | ||
138 | ZSTATICREADEROBJS/Palm2QImage.o \ | ||
139 | ZSTATICREADEROBJS/Prefs.o \ | ||
140 | ZSTATICREADEROBJS/QTReader.o \ | ||
141 | ZSTATICREADEROBJS/QTReaderApp.o \ | ||
142 | ZSTATICREADEROBJS/QtrListView.o \ | ||
143 | ZSTATICREADEROBJS/StyleConsts.o \ | ||
144 | ZSTATICREADEROBJS/ToolbarPrefs.o \ | ||
145 | ZSTATICREADEROBJS/URLDialog.o \ | ||
146 | ZSTATICREADEROBJS/arith_d.o \ | ||
147 | ZSTATICREADEROBJS/chm_lib.o \ | ||
148 | ZSTATICREADEROBJS/fileBrowser.o \ | ||
149 | ZSTATICREADEROBJS/hrule.o \ | ||
150 | ZSTATICREADEROBJS/infowin.o \ | ||
151 | ZSTATICREADEROBJS/iSilo.o \ | ||
152 | ZSTATICREADEROBJS/lzx.o \ | ||
153 | ZSTATICREADEROBJS/main.o \ | ||
154 | ZSTATICREADEROBJS/orkey.o \ | ||
155 | ZSTATICREADEROBJS/pdb.o \ | ||
156 | ZSTATICREADEROBJS/plucker.o \ | ||
157 | ZSTATICREADEROBJS/plucker_base.o \ | ||
158 | ZSTATICREADEROBJS/ppm.o \ | ||
159 | ZSTATICREADEROBJS/ppm_expander.o \ | ||
160 | ZSTATICREADEROBJS/striphtml.o \ | ||
161 | ZSTATICREADEROBJS/util.o \ | ||
162 | ZSTATICREADEROBJS/version.o \ | ||
163 | ZSTATICREADEROBJS/ztxt.o | ||
164 | INTERFACES = | ||
165 | UICDECLS = | ||
166 | UICIMPLS = | ||
167 | SRCMOC =ZSTATICREADERMOCS/moc_ButtonPrefs.cpp \ | ||
168 | ZSTATICREADERMOCS/moc_CAnnoEdit.cpp \ | ||
169 | ZSTATICREADERMOCS/moc_CloseDialog.cpp \ | ||
170 | ZSTATICREADERMOCS/moc_GraphicWin.cpp \ | ||
171 | ZSTATICREADERMOCS/moc_Prefs.cpp \ | ||
172 | ZSTATICREADERMOCS/moc_QFloatBar.cpp \ | ||
173 | ZSTATICREADERMOCS/moc_QTReader.cpp \ | ||
174 | ZSTATICREADERMOCS/moc_QTReaderApp.cpp \ | ||
175 | ZSTATICREADERMOCS/moc_QtrListView.cpp \ | ||
176 | ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
177 | ZSTATICREADERMOCS/moc_URLDialog.cpp \ | ||
178 | ZSTATICREADERMOCS/moc_cbkmkselector.cpp \ | ||
179 | ZSTATICREADERMOCS/moc_fileBrowser.cpp \ | ||
180 | ZSTATICREADERMOCS/moc_infowin.cpp | ||
181 | OBJMOC =ZSTATICREADEROBJS/moc_ButtonPrefs.o \ | ||
182 | ZSTATICREADEROBJS/moc_CAnnoEdit.o \ | ||
183 | ZSTATICREADEROBJS/moc_CloseDialog.o \ | ||
184 | ZSTATICREADEROBJS/moc_GraphicWin.o \ | ||
185 | ZSTATICREADEROBJS/moc_Prefs.o \ | ||
186 | ZSTATICREADEROBJS/moc_QFloatBar.o \ | ||
187 | ZSTATICREADEROBJS/moc_QTReader.o \ | ||
188 | ZSTATICREADEROBJS/moc_QTReaderApp.o \ | ||
189 | ZSTATICREADEROBJS/moc_QtrListView.o \ | ||
190 | ZSTATICREADEROBJS/moc_ToolbarPrefs.o \ | ||
191 | ZSTATICREADEROBJS/moc_URLDialog.o \ | ||
192 | ZSTATICREADEROBJS/moc_cbkmkselector.o \ | ||
193 | ZSTATICREADEROBJS/moc_fileBrowser.o \ | ||
194 | ZSTATICREADEROBJS/moc_infowin.o | ||
195 | DIST = | ||
196 | TARGET =ZSTATICREADEROBJS/uqtreader | ||
197 | INTERFACE_DECL_PATH = . | ||
198 | |||
199 | ####### Implicit rules | ||
200 | |||
201 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
202 | |||
203 | .cpp.o: | ||
204 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
205 | |||
206 | .cxx.o: | ||
207 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
208 | |||
209 | .cc.o: | ||
210 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
211 | |||
212 | .C.o: | ||
213 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
214 | |||
215 | .c.o: | ||
216 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
217 | |||
218 | ####### Build rules | ||
219 | |||
220 | |||
221 | all: $(TARGET) | ||
222 | |||
223 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
224 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
225 | |||
226 | moc: $(SRCMOC) | ||
227 | |||
228 | tmake: reader.staticzmak | ||
229 | |||
230 | reader.staticzmak: reader.staticzpro | ||
231 | tmake reader.staticzpro -o reader.staticzmak | ||
232 | |||
233 | dist: | ||
234 | $(TAR) reader.staticzpro.tar reader.staticzpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
235 | $(GZIP) reader.staticzpro.tar | ||
236 | |||
237 | clean: | ||
238 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
239 | -rm -f *~ core | ||
240 | |||
241 | ####### Sub-libraries | ||
242 | |||
243 | |||
244 | ###### Combined headers | ||
245 | |||
246 | |||
247 | ####### Compile | ||
248 | |||
249 | ZSTATICREADEROBJS/Aportis.o: Aportis.cpp \ | ||
250 | Aportis.h \ | ||
251 | CExpander.h \ | ||
252 | ZSTATICREADERINC/useqpe.h \ | ||
253 | config.h \ | ||
254 | ustring.h \ | ||
255 | StyleConsts.h \ | ||
256 | Markups.h \ | ||
257 | names.h \ | ||
258 | linktype.h \ | ||
259 | pdb.h \ | ||
260 | my_list.h \ | ||
261 | Bkmks.h \ | ||
262 | Filedata.h \ | ||
263 | ZSTATICREADERINC/static.h | ||
264 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Aportis.o Aportis.cpp | ||
265 | |||
266 | ZSTATICREADEROBJS/Bkmks.o: Bkmks.cpp \ | ||
267 | Bkmks.h \ | ||
268 | config.h \ | ||
269 | ustring.h \ | ||
270 | Filedata.h \ | ||
271 | StyleConsts.h \ | ||
272 | Markups.h \ | ||
273 | my_list.h \ | ||
274 | version.h \ | ||
275 | names.h | ||
276 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Bkmks.o Bkmks.cpp | ||
277 | |||
278 | ZSTATICREADEROBJS/BuffDoc.o: BuffDoc.cpp \ | ||
279 | ZSTATICREADERINC/static.h \ | ||
280 | names.h \ | ||
281 | ZSTATICREADERINC/useqpe.h \ | ||
282 | usenef.h \ | ||
283 | BuffDoc.h \ | ||
284 | CDrawBuffer.h \ | ||
285 | StyleConsts.h \ | ||
286 | CBuffer.h \ | ||
287 | config.h \ | ||
288 | ustring.h \ | ||
289 | my_list.h \ | ||
290 | linktype.h \ | ||
291 | CFilter.h \ | ||
292 | CExpander.h \ | ||
293 | Markups.h \ | ||
294 | CEncoding.h \ | ||
295 | CEncoding_tables.h \ | ||
296 | ZText.h \ | ||
297 | ebookcodec.h \ | ||
298 | Aportis.h \ | ||
299 | pdb.h \ | ||
300 | CHM.h \ | ||
301 | chm_lib.h \ | ||
302 | ppm_expander.h \ | ||
303 | utypes.h \ | ||
304 | ppm.h \ | ||
305 | arith.h \ | ||
306 | ztxt.h \ | ||
307 | plucker.h \ | ||
308 | plucker_base.h \ | ||
309 | Navigation.h \ | ||
310 | hrule.h \ | ||
311 | iSilo.h | ||
312 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/BuffDoc.o BuffDoc.cpp | ||
313 | |||
314 | ZSTATICREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \ | ||
315 | ButtonPrefs.h \ | ||
316 | orkey.h | ||
317 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp | ||
318 | |||
319 | ZSTATICREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \ | ||
320 | CAnnoEdit.h | ||
321 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp | ||
322 | |||
323 | ZSTATICREADEROBJS/CBuffer.o: CBuffer.cpp \ | ||
324 | CBuffer.h \ | ||
325 | config.h \ | ||
326 | ustring.h | ||
327 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CBuffer.o CBuffer.cpp | ||
328 | |||
329 | ZSTATICREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \ | ||
330 | CDrawBuffer.h \ | ||
331 | StyleConsts.h \ | ||
332 | CBuffer.h \ | ||
333 | config.h \ | ||
334 | ustring.h \ | ||
335 | my_list.h \ | ||
336 | linktype.h \ | ||
337 | FontControl.h \ | ||
338 | ZSTATICREADERINC/useqpe.h \ | ||
339 | ZSTATICREADERINC/opie.h | ||
340 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp | ||
341 | |||
342 | ZSTATICREADEROBJS/CEncoding.o: CEncoding.cpp \ | ||
343 | CEncoding.h \ | ||
344 | CExpander.h \ | ||
345 | ZSTATICREADERINC/useqpe.h \ | ||
346 | config.h \ | ||
347 | ustring.h \ | ||
348 | StyleConsts.h \ | ||
349 | Markups.h \ | ||
350 | names.h \ | ||
351 | linktype.h \ | ||
352 | CEncoding_tables.h | ||
353 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CEncoding.o CEncoding.cpp | ||
354 | |||
355 | ZSTATICREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \ | ||
356 | CEncoding_tables.h \ | ||
357 | config.h \ | ||
358 | ustring.h | ||
359 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp | ||
360 | |||
361 | ZSTATICREADEROBJS/CExpander.o: CExpander.cpp \ | ||
362 | CExpander.h \ | ||
363 | ZSTATICREADERINC/useqpe.h \ | ||
364 | config.h \ | ||
365 | ustring.h \ | ||
366 | StyleConsts.h \ | ||
367 | Markups.h \ | ||
368 | names.h \ | ||
369 | linktype.h | ||
370 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CExpander.o CExpander.cpp | ||
371 | |||
372 | ZSTATICREADEROBJS/CFilter.o: CFilter.cpp \ | ||
373 | ZSTATICREADERINC/useqpe.h \ | ||
374 | CDrawBuffer.h \ | ||
375 | StyleConsts.h \ | ||
376 | CBuffer.h \ | ||
377 | config.h \ | ||
378 | ustring.h \ | ||
379 | my_list.h \ | ||
380 | linktype.h \ | ||
381 | CFilter.h \ | ||
382 | CExpander.h \ | ||
383 | Markups.h \ | ||
384 | names.h \ | ||
385 | CEncoding.h \ | ||
386 | CEncoding_tables.h \ | ||
387 | ZSTATICREADERINC/static.h \ | ||
388 | hrule.h \ | ||
389 | Bkmks.h \ | ||
390 | Filedata.h \ | ||
391 | QTReader.h \ | ||
392 | BuffDoc.h \ | ||
393 | FontControl.h \ | ||
394 | BGType.h \ | ||
395 | striphtml.h \ | ||
396 | Navigation.h \ | ||
397 | CRegExp.h \ | ||
398 | hash.h \ | ||
399 | Queue.h | ||
400 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CFilter.o CFilter.cpp | ||
401 | |||
402 | ZSTATICREADEROBJS/CHM.o: CHM.cpp \ | ||
403 | CHM.h \ | ||
404 | ZSTATICREADERINC/useqpe.h \ | ||
405 | CExpander.h \ | ||
406 | config.h \ | ||
407 | ustring.h \ | ||
408 | StyleConsts.h \ | ||
409 | Markups.h \ | ||
410 | names.h \ | ||
411 | linktype.h \ | ||
412 | chm_lib.h \ | ||
413 | my_list.h \ | ||
414 | ZSTATICREADERINC/static.h | ||
415 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CHM.o CHM.cpp | ||
416 | |||
417 | ZSTATICREADEROBJS/CRegExp.o: CRegExp.cpp \ | ||
418 | CRegExp.h \ | ||
419 | config.h \ | ||
420 | ustring.h \ | ||
421 | hash.h \ | ||
422 | Queue.h \ | ||
423 | my_list.h | ||
424 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CRegExp.o CRegExp.cpp | ||
425 | |||
426 | ZSTATICREADEROBJS/CloseDialog.o: CloseDialog.cpp \ | ||
427 | CloseDialog.h \ | ||
428 | ZSTATICREADERINC/useqpe.h | ||
429 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CloseDialog.o CloseDialog.cpp | ||
430 | |||
431 | ZSTATICREADEROBJS/FontControl.o: FontControl.cpp \ | ||
432 | ZSTATICREADERINC/opie.h \ | ||
433 | ZSTATICREADERINC/useqpe.h \ | ||
434 | FontControl.h \ | ||
435 | StyleConsts.h | ||
436 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/FontControl.o FontControl.cpp | ||
437 | |||
438 | ZSTATICREADEROBJS/GraphicWin.o: GraphicWin.cpp \ | ||
439 | GraphicWin.h | ||
440 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/GraphicWin.o GraphicWin.cpp | ||
441 | |||
442 | ZSTATICREADEROBJS/Navigation.o: Navigation.cpp \ | ||
443 | Navigation.h | ||
444 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Navigation.o Navigation.cpp | ||
445 | |||
446 | ZSTATICREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \ | ||
447 | ZSTATICREADERINC/useqpe.h | ||
448 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Palm2QImage.o Palm2QImage.cpp | ||
449 | |||
450 | ZSTATICREADEROBJS/Prefs.o: Prefs.cpp \ | ||
451 | Prefs.h \ | ||
452 | orkey.h \ | ||
453 | CEncoding_tables.h | ||
454 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Prefs.o Prefs.cpp | ||
455 | |||
456 | ZSTATICREADEROBJS/QTReader.o: QTReader.cpp \ | ||
457 | ZSTATICREADERINC/useqpe.h \ | ||
458 | config.h \ | ||
459 | ustring.h \ | ||
460 | QTReader.h \ | ||
461 | ZSTATICREADERINC/static.h \ | ||
462 | my_list.h \ | ||
463 | BuffDoc.h \ | ||
464 | CDrawBuffer.h \ | ||
465 | StyleConsts.h \ | ||
466 | CBuffer.h \ | ||
467 | linktype.h \ | ||
468 | CFilter.h \ | ||
469 | CExpander.h \ | ||
470 | Markups.h \ | ||
471 | names.h \ | ||
472 | CEncoding.h \ | ||
473 | CEncoding_tables.h \ | ||
474 | FontControl.h \ | ||
475 | BGType.h \ | ||
476 | striphtml.h \ | ||
477 | Navigation.h | ||
478 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/QTReader.o QTReader.cpp | ||
479 | |||
480 | ZSTATICREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \ | ||
481 | ZSTATICREADERINC/useqpe.h \ | ||
482 | QTReader.h \ | ||
483 | ZSTATICREADERINC/static.h \ | ||
484 | my_list.h \ | ||
485 | BuffDoc.h \ | ||
486 | CDrawBuffer.h \ | ||
487 | StyleConsts.h \ | ||
488 | CBuffer.h \ | ||
489 | config.h \ | ||
490 | ustring.h \ | ||
491 | linktype.h \ | ||
492 | CFilter.h \ | ||
493 | CExpander.h \ | ||
494 | Markups.h \ | ||
495 | names.h \ | ||
496 | CEncoding.h \ | ||
497 | CEncoding_tables.h \ | ||
498 | FontControl.h \ | ||
499 | BGType.h \ | ||
500 | striphtml.h \ | ||
501 | Navigation.h \ | ||
502 | GraphicWin.h \ | ||
503 | Bkmks.h \ | ||
504 | Filedata.h \ | ||
505 | cbkmkselector.h \ | ||
506 | infowin.h \ | ||
507 | ToolbarPrefs.h \ | ||
508 | preferences.h \ | ||
509 | Prefs.h \ | ||
510 | orkey.h \ | ||
511 | CAnnoEdit.h \ | ||
512 | QFloatBar.h \ | ||
513 | FixedFont.h \ | ||
514 | URLDialog.h \ | ||
515 | util.h \ | ||
516 | ZSTATICREADERINC/opie.h \ | ||
517 | fileBrowser.h \ | ||
518 | QTReaderApp.h \ | ||
519 | CloseDialog.h \ | ||
520 | ButtonPrefs.h | ||
521 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/QTReaderApp.o QTReaderApp.cpp | ||
522 | |||
523 | ZSTATICREADEROBJS/QtrListView.o: QtrListView.cpp \ | ||
524 | QtrListView.h | ||
525 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/QtrListView.o QtrListView.cpp | ||
526 | |||
527 | ZSTATICREADEROBJS/StyleConsts.o: StyleConsts.cpp \ | ||
528 | StyleConsts.h | ||
529 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/StyleConsts.o StyleConsts.cpp | ||
530 | |||
531 | ZSTATICREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \ | ||
532 | ZSTATICREADERINC/useqpe.h \ | ||
533 | ToolbarPrefs.h \ | ||
534 | preferences.h | ||
535 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp | ||
536 | |||
537 | ZSTATICREADEROBJS/URLDialog.o: URLDialog.cpp \ | ||
538 | URLDialog.h \ | ||
539 | ZSTATICREADERINC/useqpe.h | ||
540 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/URLDialog.o URLDialog.cpp | ||
541 | |||
542 | ZSTATICREADEROBJS/arith_d.o: arith_d.cpp \ | ||
543 | arith.h \ | ||
544 | utypes.h | ||
545 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/arith_d.o arith_d.cpp | ||
546 | |||
547 | ZSTATICREADEROBJS/chm_lib.o: chm_lib.c \ | ||
548 | chm_lib.h \ | ||
549 | lzx.h | ||
550 | $(CC) -c $(CFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/chm_lib.o chm_lib.c | ||
551 | |||
552 | ZSTATICREADEROBJS/fileBrowser.o: fileBrowser.cpp \ | ||
553 | fileBrowser.h \ | ||
554 | QtrListView.h | ||
555 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/fileBrowser.o fileBrowser.cpp | ||
556 | |||
557 | ZSTATICREADEROBJS/hrule.o: hrule.cpp | ||
558 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/hrule.o hrule.cpp | ||
559 | |||
560 | ZSTATICREADEROBJS/infowin.o: infowin.cpp \ | ||
561 | infowin.h \ | ||
562 | version.h \ | ||
563 | names.h | ||
564 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/infowin.o infowin.cpp | ||
565 | |||
566 | ZSTATICREADEROBJS/iSilo.o: iSilo.cpp \ | ||
567 | iSilo.h \ | ||
568 | pdb.h \ | ||
569 | ZSTATICREADERINC/useqpe.h \ | ||
570 | CExpander.h \ | ||
571 | config.h \ | ||
572 | ustring.h \ | ||
573 | StyleConsts.h \ | ||
574 | Markups.h \ | ||
575 | names.h \ | ||
576 | linktype.h | ||
577 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/iSilo.o iSilo.cpp | ||
578 | |||
579 | ZSTATICREADEROBJS/lzx.o: lzx.c \ | ||
580 | lzx.h | ||
581 | $(CC) -c $(CFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/lzx.o lzx.c | ||
582 | |||
583 | ZSTATICREADEROBJS/main.o: main.cpp \ | ||
584 | ZSTATICREADERINC/useqpe.h \ | ||
585 | QTReaderApp.h \ | ||
586 | CExpander.h \ | ||
587 | config.h \ | ||
588 | ustring.h \ | ||
589 | StyleConsts.h \ | ||
590 | Markups.h \ | ||
591 | names.h \ | ||
592 | linktype.h \ | ||
593 | CEncoding.h \ | ||
594 | CEncoding_tables.h \ | ||
595 | orkey.h \ | ||
596 | BGType.h | ||
597 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/main.o main.cpp | ||
598 | |||
599 | ZSTATICREADEROBJS/orkey.o: orkey.cpp \ | ||
600 | orkey.h | ||
601 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/orkey.o orkey.cpp | ||
602 | |||
603 | ZSTATICREADEROBJS/pdb.o: pdb.cpp \ | ||
604 | pdb.h \ | ||
605 | ZSTATICREADERINC/useqpe.h \ | ||
606 | CExpander.h \ | ||
607 | config.h \ | ||
608 | ustring.h \ | ||
609 | StyleConsts.h \ | ||
610 | Markups.h \ | ||
611 | names.h \ | ||
612 | linktype.h | ||
613 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/pdb.o pdb.cpp | ||
614 | |||
615 | ZSTATICREADEROBJS/plucker.o: plucker.cpp \ | ||
616 | ZSTATICREADERINC/useqpe.h \ | ||
617 | plucker.h \ | ||
618 | plucker_base.h \ | ||
619 | CExpander.h \ | ||
620 | config.h \ | ||
621 | ustring.h \ | ||
622 | StyleConsts.h \ | ||
623 | Markups.h \ | ||
624 | names.h \ | ||
625 | linktype.h \ | ||
626 | ztxt.h \ | ||
627 | pdb.h \ | ||
628 | CBuffer.h \ | ||
629 | my_list.h \ | ||
630 | Navigation.h \ | ||
631 | hrule.h \ | ||
632 | Aportis.h \ | ||
633 | Palm2QImage.h \ | ||
634 | ZSTATICREADERINC/static.h | ||
635 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/plucker.o plucker.cpp | ||
636 | |||
637 | ZSTATICREADEROBJS/plucker_base.o: plucker_base.cpp \ | ||
638 | ZSTATICREADERINC/useqpe.h \ | ||
639 | usenef.h \ | ||
640 | ZSTATICREADERINC/static.h \ | ||
641 | plucker_base.h \ | ||
642 | CExpander.h \ | ||
643 | config.h \ | ||
644 | ustring.h \ | ||
645 | StyleConsts.h \ | ||
646 | Markups.h \ | ||
647 | names.h \ | ||
648 | linktype.h \ | ||
649 | ztxt.h \ | ||
650 | pdb.h \ | ||
651 | CBuffer.h \ | ||
652 | my_list.h \ | ||
653 | Navigation.h \ | ||
654 | hrule.h \ | ||
655 | Aportis.h | ||
656 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/plucker_base.o plucker_base.cpp | ||
657 | |||
658 | ZSTATICREADEROBJS/ppm.o: ppm.cpp \ | ||
659 | arith.h \ | ||
660 | utypes.h \ | ||
661 | ppm.h | ||
662 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ppm.o ppm.cpp | ||
663 | |||
664 | ZSTATICREADEROBJS/ppm_expander.o: ppm_expander.cpp \ | ||
665 | ZSTATICREADERINC/static.h \ | ||
666 | ppm_expander.h \ | ||
667 | ZSTATICREADERINC/useqpe.h \ | ||
668 | CExpander.h \ | ||
669 | config.h \ | ||
670 | ustring.h \ | ||
671 | StyleConsts.h \ | ||
672 | Markups.h \ | ||
673 | names.h \ | ||
674 | linktype.h \ | ||
675 | utypes.h \ | ||
676 | ppm.h \ | ||
677 | arith.h | ||
678 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ppm_expander.o ppm_expander.cpp | ||
679 | |||
680 | ZSTATICREADEROBJS/striphtml.o: striphtml.cpp \ | ||
681 | ZSTATICREADERINC/useqpe.h \ | ||
682 | CDrawBuffer.h \ | ||
683 | StyleConsts.h \ | ||
684 | CBuffer.h \ | ||
685 | config.h \ | ||
686 | ustring.h \ | ||
687 | my_list.h \ | ||
688 | linktype.h \ | ||
689 | striphtml.h \ | ||
690 | CFilter.h \ | ||
691 | CExpander.h \ | ||
692 | Markups.h \ | ||
693 | names.h \ | ||
694 | CEncoding.h \ | ||
695 | CEncoding_tables.h \ | ||
696 | ZSTATICREADERINC/static.h \ | ||
697 | Navigation.h \ | ||
698 | hrule.h | ||
699 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/striphtml.o striphtml.cpp | ||
700 | |||
701 | ZSTATICREADEROBJS/util.o: util.cpp \ | ||
702 | util.h | ||
703 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/util.o util.cpp | ||
704 | |||
705 | ZSTATICREADEROBJS/version.o: version.cpp \ | ||
706 | version.h \ | ||
707 | names.h | ||
708 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/version.o version.cpp | ||
709 | |||
710 | ZSTATICREADEROBJS/ztxt.o: ztxt.cpp \ | ||
711 | ztxt.h \ | ||
712 | CExpander.h \ | ||
713 | ZSTATICREADERINC/useqpe.h \ | ||
714 | config.h \ | ||
715 | ustring.h \ | ||
716 | StyleConsts.h \ | ||
717 | Markups.h \ | ||
718 | names.h \ | ||
719 | linktype.h \ | ||
720 | pdb.h \ | ||
721 | my_list.h \ | ||
722 | Bkmks.h \ | ||
723 | Filedata.h \ | ||
724 | ZSTATICREADERINC/static.h | ||
725 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ztxt.o ztxt.cpp | ||
726 | |||
727 | ZSTATICREADEROBJS/moc_ButtonPrefs.o: ZSTATICREADERMOCS/moc_ButtonPrefs.cpp \ | ||
728 | ButtonPrefs.h \ | ||
729 | orkey.h | ||
730 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_ButtonPrefs.o ZSTATICREADERMOCS/moc_ButtonPrefs.cpp | ||
731 | |||
732 | ZSTATICREADEROBJS/moc_CAnnoEdit.o: ZSTATICREADERMOCS/moc_CAnnoEdit.cpp \ | ||
733 | CAnnoEdit.h | ||
734 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_CAnnoEdit.o ZSTATICREADERMOCS/moc_CAnnoEdit.cpp | ||
735 | |||
736 | ZSTATICREADEROBJS/moc_CloseDialog.o: ZSTATICREADERMOCS/moc_CloseDialog.cpp \ | ||
737 | CloseDialog.h \ | ||
738 | ZSTATICREADERINC/useqpe.h | ||
739 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_CloseDialog.o ZSTATICREADERMOCS/moc_CloseDialog.cpp | ||
740 | |||
741 | ZSTATICREADEROBJS/moc_GraphicWin.o: ZSTATICREADERMOCS/moc_GraphicWin.cpp \ | ||
742 | GraphicWin.h | ||
743 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_GraphicWin.o ZSTATICREADERMOCS/moc_GraphicWin.cpp | ||
744 | |||
745 | ZSTATICREADEROBJS/moc_Prefs.o: ZSTATICREADERMOCS/moc_Prefs.cpp \ | ||
746 | Prefs.h \ | ||
747 | orkey.h | ||
748 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_Prefs.o ZSTATICREADERMOCS/moc_Prefs.cpp | ||
749 | |||
750 | ZSTATICREADEROBJS/moc_QFloatBar.o: ZSTATICREADERMOCS/moc_QFloatBar.cpp \ | ||
751 | QFloatBar.h | ||
752 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QFloatBar.o ZSTATICREADERMOCS/moc_QFloatBar.cpp | ||
753 | |||
754 | ZSTATICREADEROBJS/moc_QTReader.o: ZSTATICREADERMOCS/moc_QTReader.cpp \ | ||
755 | QTReader.h \ | ||
756 | ZSTATICREADERINC/static.h \ | ||
757 | my_list.h \ | ||
758 | BuffDoc.h \ | ||
759 | ZSTATICREADERINC/useqpe.h \ | ||
760 | CDrawBuffer.h \ | ||
761 | StyleConsts.h \ | ||
762 | CBuffer.h \ | ||
763 | config.h \ | ||
764 | ustring.h \ | ||
765 | linktype.h \ | ||
766 | CFilter.h \ | ||
767 | CExpander.h \ | ||
768 | Markups.h \ | ||
769 | names.h \ | ||
770 | CEncoding.h \ | ||
771 | CEncoding_tables.h \ | ||
772 | FontControl.h \ | ||
773 | BGType.h \ | ||
774 | striphtml.h \ | ||
775 | Navigation.h | ||
776 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QTReader.o ZSTATICREADERMOCS/moc_QTReader.cpp | ||
777 | |||
778 | ZSTATICREADEROBJS/moc_QTReaderApp.o: ZSTATICREADERMOCS/moc_QTReaderApp.cpp \ | ||
779 | QTReaderApp.h \ | ||
780 | ZSTATICREADERINC/useqpe.h \ | ||
781 | CExpander.h \ | ||
782 | config.h \ | ||
783 | ustring.h \ | ||
784 | StyleConsts.h \ | ||
785 | Markups.h \ | ||
786 | names.h \ | ||
787 | linktype.h \ | ||
788 | CEncoding.h \ | ||
789 | CEncoding_tables.h \ | ||
790 | orkey.h \ | ||
791 | BGType.h | ||
792 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QTReaderApp.o ZSTATICREADERMOCS/moc_QTReaderApp.cpp | ||
793 | |||
794 | ZSTATICREADEROBJS/moc_QtrListView.o: ZSTATICREADERMOCS/moc_QtrListView.cpp \ | ||
795 | QtrListView.h | ||
796 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QtrListView.o ZSTATICREADERMOCS/moc_QtrListView.cpp | ||
797 | |||
798 | ZSTATICREADEROBJS/moc_ToolbarPrefs.o: ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
799 | ToolbarPrefs.h \ | ||
800 | ZSTATICREADERINC/useqpe.h \ | ||
801 | preferences.h | ||
802 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_ToolbarPrefs.o ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp | ||
803 | |||
804 | ZSTATICREADEROBJS/moc_URLDialog.o: ZSTATICREADERMOCS/moc_URLDialog.cpp \ | ||
805 | URLDialog.h \ | ||
806 | ZSTATICREADERINC/useqpe.h | ||
807 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_URLDialog.o ZSTATICREADERMOCS/moc_URLDialog.cpp | ||
808 | |||
809 | ZSTATICREADEROBJS/moc_cbkmkselector.o: ZSTATICREADERMOCS/moc_cbkmkselector.cpp \ | ||
810 | cbkmkselector.h | ||
811 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_cbkmkselector.o ZSTATICREADERMOCS/moc_cbkmkselector.cpp | ||
812 | |||
813 | ZSTATICREADEROBJS/moc_fileBrowser.o: ZSTATICREADERMOCS/moc_fileBrowser.cpp \ | ||
814 | fileBrowser.h | ||
815 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_fileBrowser.o ZSTATICREADERMOCS/moc_fileBrowser.cpp | ||
816 | |||
817 | ZSTATICREADEROBJS/moc_infowin.o: ZSTATICREADERMOCS/moc_infowin.cpp \ | ||
818 | infowin.h | ||
819 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_infowin.o ZSTATICREADERMOCS/moc_infowin.cpp | ||
820 | |||
821 | ZSTATICREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h | ||
822 | $(MOC) ButtonPrefs.h -o ZSTATICREADERMOCS/moc_ButtonPrefs.cpp | ||
823 | |||
824 | ZSTATICREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h | ||
825 | $(MOC) CAnnoEdit.h -o ZSTATICREADERMOCS/moc_CAnnoEdit.cpp | ||
826 | |||
827 | ZSTATICREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h | ||
828 | $(MOC) CloseDialog.h -o ZSTATICREADERMOCS/moc_CloseDialog.cpp | ||
829 | |||
830 | ZSTATICREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h | ||
831 | $(MOC) GraphicWin.h -o ZSTATICREADERMOCS/moc_GraphicWin.cpp | ||
832 | |||
833 | ZSTATICREADERMOCS/moc_Prefs.cpp: Prefs.h | ||
834 | $(MOC) Prefs.h -o ZSTATICREADERMOCS/moc_Prefs.cpp | ||
835 | |||
836 | ZSTATICREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h | ||
837 | $(MOC) QFloatBar.h -o ZSTATICREADERMOCS/moc_QFloatBar.cpp | ||
838 | |||
839 | ZSTATICREADERMOCS/moc_QTReader.cpp: QTReader.h | ||
840 | $(MOC) QTReader.h -o ZSTATICREADERMOCS/moc_QTReader.cpp | ||
841 | |||
842 | ZSTATICREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h | ||
843 | $(MOC) QTReaderApp.h -o ZSTATICREADERMOCS/moc_QTReaderApp.cpp | ||
844 | |||
845 | ZSTATICREADERMOCS/moc_QtrListView.cpp: QtrListView.h | ||
846 | $(MOC) QtrListView.h -o ZSTATICREADERMOCS/moc_QtrListView.cpp | ||
847 | |||
848 | ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h | ||
849 | $(MOC) ToolbarPrefs.h -o ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp | ||
850 | |||
851 | ZSTATICREADERMOCS/moc_URLDialog.cpp: URLDialog.h | ||
852 | $(MOC) URLDialog.h -o ZSTATICREADERMOCS/moc_URLDialog.cpp | ||
853 | |||
854 | ZSTATICREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h | ||
855 | $(MOC) cbkmkselector.h -o ZSTATICREADERMOCS/moc_cbkmkselector.cpp | ||
856 | |||
857 | ZSTATICREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h | ||
858 | $(MOC) fileBrowser.h -o ZSTATICREADERMOCS/moc_fileBrowser.cpp | ||
859 | |||
860 | ZSTATICREADERMOCS/moc_infowin.cpp: infowin.h | ||
861 | $(MOC) infowin.h -o ZSTATICREADERMOCS/moc_infowin.cpp | ||
862 | |||
diff --git a/noncore/apps/opie-reader/reader.staticzpro b/noncore/apps/opie-reader/reader.staticzpro new file mode 100644 index 0000000..861eb88 --- a/dev/null +++ b/noncore/apps/opie-reader/reader.staticzpro | |||
@@ -0,0 +1,108 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = Aportis.h \ | ||
4 | Bkmks.h \ | ||
5 | BuffDoc.h \ | ||
6 | ButtonPrefs.h \ | ||
7 | CAnnoEdit.h \ | ||
8 | CBuffer.h \ | ||
9 | CDrawBuffer.h \ | ||
10 | CEncoding.h \ | ||
11 | CEncoding_tables.h \ | ||
12 | CExpander.h \ | ||
13 | CFilter.h \ | ||
14 | CloseDialog.h \ | ||
15 | Filedata.h \ | ||
16 | FixedFont.h \ | ||
17 | FontControl.h \ | ||
18 | GraphicWin.h \ | ||
19 | Markups.h \ | ||
20 | Navigation.h \ | ||
21 | Palm2QImage.h \ | ||
22 | Prefs.h \ | ||
23 | QFloatBar.h \ | ||
24 | QTReader.h \ | ||
25 | QTReaderApp.h \ | ||
26 | QtrListView.h \ | ||
27 | Queue.h \ | ||
28 | StateData.h \ | ||
29 | StyleConsts.h \ | ||
30 | ToolbarPrefs.h \ | ||
31 | URLDialog.h \ | ||
32 | ZText.h \ | ||
33 | arith.h \ | ||
34 | cbkmkselector.h \ | ||
35 | config.h \ | ||
36 | fileBrowser.h \ | ||
37 | infowin.h \ | ||
38 | linktype.h \ | ||
39 | my_list.h \ | ||
40 | names.h \ | ||
41 | ZSTATICREADERINC/opie.h \ | ||
42 | pdb.h \ | ||
43 | plucker_base.h \ | ||
44 | plucker.h \ | ||
45 | ppm.h \ | ||
46 | ppm_expander.h \ | ||
47 | preferences.h \ | ||
48 | ZSTATICREADERINC/static.h \ | ||
49 | usenef.h \ | ||
50 | ZSTATICREADERINC/useqpe.h \ | ||
51 | ustring.h \ | ||
52 | utypes.h \ | ||
53 | version.h \ | ||
54 | ztxt.h | ||
55 | |||
56 | SOURCES = Aportis.cpp \ | ||
57 | Bkmks.cpp \ | ||
58 | BuffDoc.cpp \ | ||
59 | ButtonPrefs.cpp \ | ||
60 | CAnnoEdit.cpp \ | ||
61 | CBuffer.cpp \ | ||
62 | CDrawBuffer.cpp \ | ||
63 | CEncoding.cpp \ | ||
64 | CEncoding_tables.cpp \ | ||
65 | CExpander.cpp \ | ||
66 | CFilter.cpp \ | ||
67 | CHM.cpp \ | ||
68 | CRegExp.cpp \ | ||
69 | CloseDialog.cpp \ | ||
70 | FontControl.cpp \ | ||
71 | GraphicWin.cpp \ | ||
72 | Navigation.cpp \ | ||
73 | Palm2QImage.cpp \ | ||
74 | Prefs.cpp \ | ||
75 | QTReader.cpp \ | ||
76 | QTReaderApp.cpp \ | ||
77 | QtrListView.cpp \ | ||
78 | StyleConsts.cpp \ | ||
79 | ToolbarPrefs.cpp \ | ||
80 | URLDialog.cpp \ | ||
81 | arith_d.cpp \ | ||
82 | chm_lib.c \ | ||
83 | fileBrowser.cpp \ | ||
84 | hrule.cpp \ | ||
85 | infowin.cpp \ | ||
86 | iSilo.cpp \ | ||
87 | lzx.c \ | ||
88 | main.cpp \ | ||
89 | orkey.cpp \ | ||
90 | pdb.cpp \ | ||
91 | plucker.cpp \ | ||
92 | plucker_base.cpp \ | ||
93 | ppm.cpp \ | ||
94 | ppm_expander.cpp \ | ||
95 | striphtml.cpp \ | ||
96 | util.cpp \ | ||
97 | version.cpp \ | ||
98 | ztxt.cpp | ||
99 | |||
100 | INTERFACES= | ||
101 | DESTDIR = ZSTATICREADEROBJS | ||
102 | INCLUDEPATH+= ZSTATICREADERINC | ||
103 | DEPENDPATH+= ZSTATICREADERINC | ||
104 | OBJECTS_DIR = ZSTATICREADEROBJS | ||
105 | MOC_DIR = ZSTATICREADERMOCS | ||
106 | TARGET = uqtreader | ||
107 | LIBS += -lqpe | ||
108 | |||
diff --git a/noncore/apps/opie-reader/reader.wmak b/noncore/apps/opie-reader/reader.wmak new file mode 100644 index 0000000..dda01c1 --- a/dev/null +++ b/noncore/apps/opie-reader/reader.wmak | |||
@@ -0,0 +1,604 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building $(QPEDIR)/bin/uqtreader | ||
3 | # Generated by tmake at 23:23, 2004/03/09 | ||
4 | # Project: reader.wpro | ||
5 | # Template: app | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =gcc-2.96 | ||
11 | CXX =g++-2.96 | ||
12 | CFLAGS =-pipe -Wall -W -O2 -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG | ||
14 | INCPATH =-IWSREADERINC -I$(QTDIR)/include | ||
15 | LINK =g++-2.96 | ||
16 | LFLAGS = | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqpe -lreader_codec -lqte | ||
18 | MOC =$(QTDIR)/bin/moc | ||
19 | UIC =$(QTDIR)/bin/uic | ||
20 | |||
21 | TAR =tar -cf | ||
22 | GZIP =gzip -9f | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =Aportis.h \ | ||
27 | Bkmks.h \ | ||
28 | BuffDoc.h \ | ||
29 | ButtonPrefs.h \ | ||
30 | CAnnoEdit.h \ | ||
31 | CBuffer.h \ | ||
32 | CDrawBuffer.h \ | ||
33 | CEncoding.h \ | ||
34 | CEncoding_tables.h \ | ||
35 | CExpander.h \ | ||
36 | CFilter.h \ | ||
37 | CloseDialog.h \ | ||
38 | Coder.h \ | ||
39 | CSource.h \ | ||
40 | Filedata.h \ | ||
41 | FixedFont.h \ | ||
42 | FontControl.h \ | ||
43 | GraphicWin.h \ | ||
44 | Markups.h \ | ||
45 | Navigation.h \ | ||
46 | Palm2QImage.h \ | ||
47 | Prefs.h \ | ||
48 | PPMd.h \ | ||
49 | PPMdType.h \ | ||
50 | QFloatBar.h \ | ||
51 | QTReader.h \ | ||
52 | QTReaderApp.h \ | ||
53 | QtrListView.h \ | ||
54 | Queue.h \ | ||
55 | StateData.h \ | ||
56 | StyleConsts.h \ | ||
57 | SubAlloc.h \ | ||
58 | ToolbarPrefs.h \ | ||
59 | URLDialog.h \ | ||
60 | ZText.h \ | ||
61 | arith.h \ | ||
62 | arrierego.h \ | ||
63 | cbkmkselector.h \ | ||
64 | config.h \ | ||
65 | fileBrowser.h \ | ||
66 | infowin.h \ | ||
67 | linktype.h \ | ||
68 | my_list.h \ | ||
69 | names.h \ | ||
70 | nef.h \ | ||
71 | WSREADERINC/opie.h \ | ||
72 | pdb.h \ | ||
73 | plucker.h \ | ||
74 | plucker_base.h \ | ||
75 | ppm.h \ | ||
76 | ppm_expander.h \ | ||
77 | usenef.h \ | ||
78 | WSREADERINC/useqpe.h \ | ||
79 | ustring.h \ | ||
80 | utypes.h \ | ||
81 | version.h \ | ||
82 | ztxt.h | ||
83 | SOURCES =BuffDoc.cpp \ | ||
84 | ButtonPrefs.cpp \ | ||
85 | CAnnoEdit.cpp \ | ||
86 | CDrawBuffer.cpp \ | ||
87 | CEncoding.cpp \ | ||
88 | CEncoding_tables.cpp \ | ||
89 | CFilter.cpp \ | ||
90 | CRegExp.cpp \ | ||
91 | CloseDialog.cpp \ | ||
92 | FontControl.cpp \ | ||
93 | Prefs.cpp \ | ||
94 | QTReader.cpp \ | ||
95 | QTReaderApp.cpp \ | ||
96 | QtrListView.cpp \ | ||
97 | ToolbarPrefs.cpp \ | ||
98 | URLDialog.cpp \ | ||
99 | fileBrowser.cpp \ | ||
100 | infowin.cpp \ | ||
101 | main.cpp \ | ||
102 | orkey.cpp \ | ||
103 | util.cpp \ | ||
104 | version.cpp | ||
105 | OBJECTS =WSREADEROBJS/BuffDoc.o \ | ||
106 | WSREADEROBJS/ButtonPrefs.o \ | ||
107 | WSREADEROBJS/CAnnoEdit.o \ | ||
108 | WSREADEROBJS/CDrawBuffer.o \ | ||
109 | WSREADEROBJS/CEncoding.o \ | ||
110 | WSREADEROBJS/CEncoding_tables.o \ | ||
111 | WSREADEROBJS/CFilter.o \ | ||
112 | WSREADEROBJS/CRegExp.o \ | ||
113 | WSREADEROBJS/CloseDialog.o \ | ||
114 | WSREADEROBJS/FontControl.o \ | ||
115 | WSREADEROBJS/Prefs.o \ | ||
116 | WSREADEROBJS/QTReader.o \ | ||
117 | WSREADEROBJS/QTReaderApp.o \ | ||
118 | WSREADEROBJS/QtrListView.o \ | ||
119 | WSREADEROBJS/ToolbarPrefs.o \ | ||
120 | WSREADEROBJS/URLDialog.o \ | ||
121 | WSREADEROBJS/fileBrowser.o \ | ||
122 | WSREADEROBJS/infowin.o \ | ||
123 | WSREADEROBJS/main.o \ | ||
124 | WSREADEROBJS/orkey.o \ | ||
125 | WSREADEROBJS/util.o \ | ||
126 | WSREADEROBJS/version.o | ||
127 | INTERFACES = | ||
128 | UICDECLS = | ||
129 | UICIMPLS = | ||
130 | SRCMOC =WSREADERMOCS/moc_ButtonPrefs.cpp \ | ||
131 | WSREADERMOCS/moc_CAnnoEdit.cpp \ | ||
132 | WSREADERMOCS/moc_CloseDialog.cpp \ | ||
133 | WSREADERMOCS/moc_GraphicWin.cpp \ | ||
134 | WSREADERMOCS/moc_Prefs.cpp \ | ||
135 | WSREADERMOCS/moc_QFloatBar.cpp \ | ||
136 | WSREADERMOCS/moc_QTReader.cpp \ | ||
137 | WSREADERMOCS/moc_QTReaderApp.cpp \ | ||
138 | WSREADERMOCS/moc_QtrListView.cpp \ | ||
139 | WSREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
140 | WSREADERMOCS/moc_URLDialog.cpp \ | ||
141 | WSREADERMOCS/moc_cbkmkselector.cpp \ | ||
142 | WSREADERMOCS/moc_fileBrowser.cpp \ | ||
143 | WSREADERMOCS/moc_infowin.cpp | ||
144 | OBJMOC =WSREADEROBJS/moc_ButtonPrefs.o \ | ||
145 | WSREADEROBJS/moc_CAnnoEdit.o \ | ||
146 | WSREADEROBJS/moc_CloseDialog.o \ | ||
147 | WSREADEROBJS/moc_GraphicWin.o \ | ||
148 | WSREADEROBJS/moc_Prefs.o \ | ||
149 | WSREADEROBJS/moc_QFloatBar.o \ | ||
150 | WSREADEROBJS/moc_QTReader.o \ | ||
151 | WSREADEROBJS/moc_QTReaderApp.o \ | ||
152 | WSREADEROBJS/moc_QtrListView.o \ | ||
153 | WSREADEROBJS/moc_ToolbarPrefs.o \ | ||
154 | WSREADEROBJS/moc_URLDialog.o \ | ||
155 | WSREADEROBJS/moc_cbkmkselector.o \ | ||
156 | WSREADEROBJS/moc_fileBrowser.o \ | ||
157 | WSREADEROBJS/moc_infowin.o | ||
158 | DIST = | ||
159 | TARGET =$(QPEDIR)/bin/uqtreader | ||
160 | INTERFACE_DECL_PATH = . | ||
161 | |||
162 | ####### Implicit rules | ||
163 | |||
164 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
165 | |||
166 | .cpp.o: | ||
167 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
168 | |||
169 | .cxx.o: | ||
170 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
171 | |||
172 | .cc.o: | ||
173 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
174 | |||
175 | .C.o: | ||
176 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
177 | |||
178 | .c.o: | ||
179 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
180 | |||
181 | ####### Build rules | ||
182 | |||
183 | |||
184 | all: $(TARGET) | ||
185 | |||
186 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
187 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
188 | |||
189 | moc: $(SRCMOC) | ||
190 | |||
191 | tmake: reader.wmak | ||
192 | |||
193 | reader.wmak: reader.wpro | ||
194 | tmake reader.wpro -o reader.wmak | ||
195 | |||
196 | dist: | ||
197 | $(TAR) reader.wpro.tar reader.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
198 | $(GZIP) reader.wpro.tar | ||
199 | |||
200 | clean: | ||
201 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
202 | -rm -f *~ core | ||
203 | |||
204 | ####### Sub-libraries | ||
205 | |||
206 | |||
207 | ###### Combined headers | ||
208 | |||
209 | |||
210 | ####### Compile | ||
211 | |||
212 | WSREADEROBJS/BuffDoc.o: BuffDoc.cpp \ | ||
213 | WSREADERINC/static.h \ | ||
214 | names.h \ | ||
215 | BuffDoc.h \ | ||
216 | WSREADERINC/useqpe.h \ | ||
217 | CDrawBuffer.h \ | ||
218 | StyleConsts.h \ | ||
219 | CBuffer.h \ | ||
220 | config.h \ | ||
221 | ustring.h \ | ||
222 | my_list.h \ | ||
223 | linktype.h \ | ||
224 | CFilter.h \ | ||
225 | CExpander.h \ | ||
226 | Markups.h \ | ||
227 | CEncoding.h \ | ||
228 | CEncoding_tables.h \ | ||
229 | ZText.h \ | ||
230 | ebookcodec.h \ | ||
231 | Aportis.h \ | ||
232 | pdb.h \ | ||
233 | CHM.h \ | ||
234 | chm_lib.h \ | ||
235 | ppm_expander.h \ | ||
236 | utypes.h \ | ||
237 | ppm.h \ | ||
238 | arith.h \ | ||
239 | ztxt.h \ | ||
240 | plucker.h \ | ||
241 | plucker_base.h \ | ||
242 | Navigation.h \ | ||
243 | hrule.h \ | ||
244 | nef.h \ | ||
245 | usenef.h \ | ||
246 | arrierego.h \ | ||
247 | iSilo.h | ||
248 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/BuffDoc.o BuffDoc.cpp | ||
249 | |||
250 | WSREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \ | ||
251 | ButtonPrefs.h \ | ||
252 | orkey.h | ||
253 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp | ||
254 | |||
255 | WSREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \ | ||
256 | CAnnoEdit.h | ||
257 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp | ||
258 | |||
259 | WSREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \ | ||
260 | CDrawBuffer.h \ | ||
261 | StyleConsts.h \ | ||
262 | CBuffer.h \ | ||
263 | config.h \ | ||
264 | ustring.h \ | ||
265 | my_list.h \ | ||
266 | linktype.h \ | ||
267 | FontControl.h \ | ||
268 | WSREADERINC/useqpe.h \ | ||
269 | WSREADERINC/opie.h | ||
270 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp | ||
271 | |||
272 | WSREADEROBJS/CEncoding.o: CEncoding.cpp \ | ||
273 | CEncoding.h \ | ||
274 | CExpander.h \ | ||
275 | WSREADERINC/useqpe.h \ | ||
276 | config.h \ | ||
277 | ustring.h \ | ||
278 | StyleConsts.h \ | ||
279 | Markups.h \ | ||
280 | names.h \ | ||
281 | linktype.h \ | ||
282 | CEncoding_tables.h | ||
283 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CEncoding.o CEncoding.cpp | ||
284 | |||
285 | WSREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \ | ||
286 | CEncoding_tables.h \ | ||
287 | config.h \ | ||
288 | ustring.h | ||
289 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp | ||
290 | |||
291 | WSREADEROBJS/CFilter.o: CFilter.cpp \ | ||
292 | WSREADERINC/useqpe.h \ | ||
293 | CDrawBuffer.h \ | ||
294 | StyleConsts.h \ | ||
295 | CBuffer.h \ | ||
296 | config.h \ | ||
297 | ustring.h \ | ||
298 | my_list.h \ | ||
299 | linktype.h \ | ||
300 | CFilter.h \ | ||
301 | CExpander.h \ | ||
302 | Markups.h \ | ||
303 | names.h \ | ||
304 | CEncoding.h \ | ||
305 | CEncoding_tables.h \ | ||
306 | WSREADERINC/static.h \ | ||
307 | hrule.h \ | ||
308 | Bkmks.h \ | ||
309 | Filedata.h \ | ||
310 | QTReader.h \ | ||
311 | BuffDoc.h \ | ||
312 | FontControl.h \ | ||
313 | BGType.h \ | ||
314 | striphtml.h \ | ||
315 | Navigation.h \ | ||
316 | CRegExp.h \ | ||
317 | hash.h \ | ||
318 | Queue.h | ||
319 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CFilter.o CFilter.cpp | ||
320 | |||
321 | WSREADEROBJS/CRegExp.o: CRegExp.cpp \ | ||
322 | CRegExp.h \ | ||
323 | config.h \ | ||
324 | ustring.h \ | ||
325 | hash.h \ | ||
326 | Queue.h \ | ||
327 | my_list.h | ||
328 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CRegExp.o CRegExp.cpp | ||
329 | |||
330 | WSREADEROBJS/CloseDialog.o: CloseDialog.cpp \ | ||
331 | CloseDialog.h \ | ||
332 | WSREADERINC/useqpe.h | ||
333 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CloseDialog.o CloseDialog.cpp | ||
334 | |||
335 | WSREADEROBJS/FontControl.o: FontControl.cpp \ | ||
336 | WSREADERINC/opie.h \ | ||
337 | WSREADERINC/useqpe.h \ | ||
338 | FontControl.h \ | ||
339 | StyleConsts.h | ||
340 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/FontControl.o FontControl.cpp | ||
341 | |||
342 | WSREADEROBJS/Prefs.o: Prefs.cpp \ | ||
343 | Prefs.h \ | ||
344 | orkey.h \ | ||
345 | CEncoding_tables.h | ||
346 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Prefs.o Prefs.cpp | ||
347 | |||
348 | WSREADEROBJS/QTReader.o: QTReader.cpp \ | ||
349 | WSREADERINC/useqpe.h \ | ||
350 | config.h \ | ||
351 | ustring.h \ | ||
352 | QTReader.h \ | ||
353 | WSREADERINC/static.h \ | ||
354 | my_list.h \ | ||
355 | BuffDoc.h \ | ||
356 | CDrawBuffer.h \ | ||
357 | StyleConsts.h \ | ||
358 | CBuffer.h \ | ||
359 | linktype.h \ | ||
360 | CFilter.h \ | ||
361 | CExpander.h \ | ||
362 | Markups.h \ | ||
363 | names.h \ | ||
364 | CEncoding.h \ | ||
365 | CEncoding_tables.h \ | ||
366 | FontControl.h \ | ||
367 | BGType.h \ | ||
368 | striphtml.h \ | ||
369 | Navigation.h | ||
370 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/QTReader.o QTReader.cpp | ||
371 | |||
372 | WSREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \ | ||
373 | WSREADERINC/useqpe.h \ | ||
374 | QTReader.h \ | ||
375 | WSREADERINC/static.h \ | ||
376 | my_list.h \ | ||
377 | BuffDoc.h \ | ||
378 | CDrawBuffer.h \ | ||
379 | StyleConsts.h \ | ||
380 | CBuffer.h \ | ||
381 | config.h \ | ||
382 | ustring.h \ | ||
383 | linktype.h \ | ||
384 | CFilter.h \ | ||
385 | CExpander.h \ | ||
386 | Markups.h \ | ||
387 | names.h \ | ||
388 | CEncoding.h \ | ||
389 | CEncoding_tables.h \ | ||
390 | FontControl.h \ | ||
391 | BGType.h \ | ||
392 | striphtml.h \ | ||
393 | Navigation.h \ | ||
394 | GraphicWin.h \ | ||
395 | Bkmks.h \ | ||
396 | Filedata.h \ | ||
397 | cbkmkselector.h \ | ||
398 | infowin.h \ | ||
399 | ToolbarPrefs.h \ | ||
400 | preferences.h \ | ||
401 | Prefs.h \ | ||
402 | orkey.h \ | ||
403 | CAnnoEdit.h \ | ||
404 | QFloatBar.h \ | ||
405 | FixedFont.h \ | ||
406 | URLDialog.h \ | ||
407 | util.h \ | ||
408 | fileBrowser.h \ | ||
409 | QTReaderApp.h \ | ||
410 | CloseDialog.h \ | ||
411 | ButtonPrefs.h | ||
412 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/QTReaderApp.o QTReaderApp.cpp | ||
413 | |||
414 | WSREADEROBJS/QtrListView.o: QtrListView.cpp \ | ||
415 | QtrListView.h | ||
416 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/QtrListView.o QtrListView.cpp | ||
417 | |||
418 | WSREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \ | ||
419 | WSREADERINC/useqpe.h \ | ||
420 | ToolbarPrefs.h \ | ||
421 | preferences.h | ||
422 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp | ||
423 | |||
424 | WSREADEROBJS/URLDialog.o: URLDialog.cpp \ | ||
425 | URLDialog.h \ | ||
426 | WSREADERINC/useqpe.h | ||
427 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/URLDialog.o URLDialog.cpp | ||
428 | |||
429 | WSREADEROBJS/fileBrowser.o: fileBrowser.cpp \ | ||
430 | fileBrowser.h \ | ||
431 | QtrListView.h | ||
432 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/fileBrowser.o fileBrowser.cpp | ||
433 | |||
434 | WSREADEROBJS/infowin.o: infowin.cpp \ | ||
435 | infowin.h \ | ||
436 | version.h \ | ||
437 | names.h | ||
438 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/infowin.o infowin.cpp | ||
439 | |||
440 | WSREADEROBJS/main.o: main.cpp \ | ||
441 | WSREADERINC/useqpe.h \ | ||
442 | QTReaderApp.h \ | ||
443 | CExpander.h \ | ||
444 | config.h \ | ||
445 | ustring.h \ | ||
446 | StyleConsts.h \ | ||
447 | Markups.h \ | ||
448 | names.h \ | ||
449 | linktype.h \ | ||
450 | CEncoding.h \ | ||
451 | CEncoding_tables.h \ | ||
452 | orkey.h \ | ||
453 | BGType.h | ||
454 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/main.o main.cpp | ||
455 | |||
456 | WSREADEROBJS/orkey.o: orkey.cpp \ | ||
457 | orkey.h | ||
458 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/orkey.o orkey.cpp | ||
459 | |||
460 | WSREADEROBJS/util.o: util.cpp \ | ||
461 | util.h | ||
462 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/util.o util.cpp | ||
463 | |||
464 | WSREADEROBJS/version.o: version.cpp \ | ||
465 | version.h \ | ||
466 | names.h | ||
467 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/version.o version.cpp | ||
468 | |||
469 | WSREADEROBJS/moc_ButtonPrefs.o: WSREADERMOCS/moc_ButtonPrefs.cpp \ | ||
470 | ButtonPrefs.h \ | ||
471 | orkey.h | ||
472 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_ButtonPrefs.o WSREADERMOCS/moc_ButtonPrefs.cpp | ||
473 | |||
474 | WSREADEROBJS/moc_CAnnoEdit.o: WSREADERMOCS/moc_CAnnoEdit.cpp \ | ||
475 | CAnnoEdit.h | ||
476 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_CAnnoEdit.o WSREADERMOCS/moc_CAnnoEdit.cpp | ||
477 | |||
478 | WSREADEROBJS/moc_CloseDialog.o: WSREADERMOCS/moc_CloseDialog.cpp \ | ||
479 | CloseDialog.h \ | ||
480 | WSREADERINC/useqpe.h | ||
481 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_CloseDialog.o WSREADERMOCS/moc_CloseDialog.cpp | ||
482 | |||
483 | WSREADEROBJS/moc_GraphicWin.o: WSREADERMOCS/moc_GraphicWin.cpp \ | ||
484 | GraphicWin.h | ||
485 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_GraphicWin.o WSREADERMOCS/moc_GraphicWin.cpp | ||
486 | |||
487 | WSREADEROBJS/moc_Prefs.o: WSREADERMOCS/moc_Prefs.cpp \ | ||
488 | Prefs.h \ | ||
489 | orkey.h | ||
490 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_Prefs.o WSREADERMOCS/moc_Prefs.cpp | ||
491 | |||
492 | WSREADEROBJS/moc_QFloatBar.o: WSREADERMOCS/moc_QFloatBar.cpp \ | ||
493 | QFloatBar.h | ||
494 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QFloatBar.o WSREADERMOCS/moc_QFloatBar.cpp | ||
495 | |||
496 | WSREADEROBJS/moc_QTReader.o: WSREADERMOCS/moc_QTReader.cpp \ | ||
497 | QTReader.h \ | ||
498 | WSREADERINC/static.h \ | ||
499 | my_list.h \ | ||
500 | BuffDoc.h \ | ||
501 | WSREADERINC/useqpe.h \ | ||
502 | CDrawBuffer.h \ | ||
503 | StyleConsts.h \ | ||
504 | CBuffer.h \ | ||
505 | config.h \ | ||
506 | ustring.h \ | ||
507 | linktype.h \ | ||
508 | CFilter.h \ | ||
509 | CExpander.h \ | ||
510 | Markups.h \ | ||
511 | names.h \ | ||
512 | CEncoding.h \ | ||
513 | CEncoding_tables.h \ | ||
514 | FontControl.h \ | ||
515 | BGType.h \ | ||
516 | striphtml.h \ | ||
517 | Navigation.h | ||
518 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QTReader.o WSREADERMOCS/moc_QTReader.cpp | ||
519 | |||
520 | WSREADEROBJS/moc_QTReaderApp.o: WSREADERMOCS/moc_QTReaderApp.cpp \ | ||
521 | QTReaderApp.h \ | ||
522 | WSREADERINC/useqpe.h \ | ||
523 | CExpander.h \ | ||
524 | config.h \ | ||
525 | ustring.h \ | ||
526 | StyleConsts.h \ | ||
527 | Markups.h \ | ||
528 | names.h \ | ||
529 | linktype.h \ | ||
530 | CEncoding.h \ | ||
531 | CEncoding_tables.h \ | ||
532 | orkey.h \ | ||
533 | BGType.h | ||
534 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QTReaderApp.o WSREADERMOCS/moc_QTReaderApp.cpp | ||
535 | |||
536 | WSREADEROBJS/moc_QtrListView.o: WSREADERMOCS/moc_QtrListView.cpp \ | ||
537 | QtrListView.h | ||
538 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QtrListView.o WSREADERMOCS/moc_QtrListView.cpp | ||
539 | |||
540 | WSREADEROBJS/moc_ToolbarPrefs.o: WSREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
541 | ToolbarPrefs.h \ | ||
542 | WSREADERINC/useqpe.h \ | ||
543 | preferences.h | ||
544 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_ToolbarPrefs.o WSREADERMOCS/moc_ToolbarPrefs.cpp | ||
545 | |||
546 | WSREADEROBJS/moc_URLDialog.o: WSREADERMOCS/moc_URLDialog.cpp \ | ||
547 | URLDialog.h \ | ||
548 | WSREADERINC/useqpe.h | ||
549 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_URLDialog.o WSREADERMOCS/moc_URLDialog.cpp | ||
550 | |||
551 | WSREADEROBJS/moc_cbkmkselector.o: WSREADERMOCS/moc_cbkmkselector.cpp \ | ||
552 | cbkmkselector.h | ||
553 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_cbkmkselector.o WSREADERMOCS/moc_cbkmkselector.cpp | ||
554 | |||
555 | WSREADEROBJS/moc_fileBrowser.o: WSREADERMOCS/moc_fileBrowser.cpp \ | ||
556 | fileBrowser.h | ||
557 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_fileBrowser.o WSREADERMOCS/moc_fileBrowser.cpp | ||
558 | |||
559 | WSREADEROBJS/moc_infowin.o: WSREADERMOCS/moc_infowin.cpp \ | ||
560 | infowin.h | ||
561 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_infowin.o WSREADERMOCS/moc_infowin.cpp | ||
562 | |||
563 | WSREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h | ||
564 | $(MOC) ButtonPrefs.h -o WSREADERMOCS/moc_ButtonPrefs.cpp | ||
565 | |||
566 | WSREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h | ||
567 | $(MOC) CAnnoEdit.h -o WSREADERMOCS/moc_CAnnoEdit.cpp | ||
568 | |||
569 | WSREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h | ||
570 | $(MOC) CloseDialog.h -o WSREADERMOCS/moc_CloseDialog.cpp | ||
571 | |||
572 | WSREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h | ||
573 | $(MOC) GraphicWin.h -o WSREADERMOCS/moc_GraphicWin.cpp | ||
574 | |||
575 | WSREADERMOCS/moc_Prefs.cpp: Prefs.h | ||
576 | $(MOC) Prefs.h -o WSREADERMOCS/moc_Prefs.cpp | ||
577 | |||
578 | WSREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h | ||
579 | $(MOC) QFloatBar.h -o WSREADERMOCS/moc_QFloatBar.cpp | ||
580 | |||
581 | WSREADERMOCS/moc_QTReader.cpp: QTReader.h | ||
582 | $(MOC) QTReader.h -o WSREADERMOCS/moc_QTReader.cpp | ||
583 | |||
584 | WSREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h | ||
585 | $(MOC) QTReaderApp.h -o WSREADERMOCS/moc_QTReaderApp.cpp | ||
586 | |||
587 | WSREADERMOCS/moc_QtrListView.cpp: QtrListView.h | ||
588 | $(MOC) QtrListView.h -o WSREADERMOCS/moc_QtrListView.cpp | ||
589 | |||
590 | WSREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h | ||
591 | $(MOC) ToolbarPrefs.h -o WSREADERMOCS/moc_ToolbarPrefs.cpp | ||
592 | |||
593 | WSREADERMOCS/moc_URLDialog.cpp: URLDialog.h | ||
594 | $(MOC) URLDialog.h -o WSREADERMOCS/moc_URLDialog.cpp | ||
595 | |||
596 | WSREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h | ||
597 | $(MOC) cbkmkselector.h -o WSREADERMOCS/moc_cbkmkselector.cpp | ||
598 | |||
599 | WSREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h | ||
600 | $(MOC) fileBrowser.h -o WSREADERMOCS/moc_fileBrowser.cpp | ||
601 | |||
602 | WSREADERMOCS/moc_infowin.cpp: infowin.h | ||
603 | $(MOC) infowin.h -o WSREADERMOCS/moc_infowin.cpp | ||
604 | |||
diff --git a/noncore/apps/opie-reader/reader.wpro b/noncore/apps/opie-reader/reader.wpro new file mode 100644 index 0000000..3e4f345 --- a/dev/null +++ b/noncore/apps/opie-reader/reader.wpro | |||
@@ -0,0 +1,93 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = Aportis.h \ | ||
4 | Bkmks.h \ | ||
5 | BuffDoc.h \ | ||
6 | ButtonPrefs.h \ | ||
7 | CAnnoEdit.h \ | ||
8 | CBuffer.h \ | ||
9 | CDrawBuffer.h \ | ||
10 | CEncoding.h \ | ||
11 | CEncoding_tables.h \ | ||
12 | CExpander.h \ | ||
13 | CFilter.h \ | ||
14 | CloseDialog.h \ | ||
15 | Coder.h \ | ||
16 | CSource.h \ | ||
17 | Filedata.h \ | ||
18 | FixedFont.h \ | ||
19 | FontControl.h \ | ||
20 | GraphicWin.h \ | ||
21 | Markups.h \ | ||
22 | Navigation.h \ | ||
23 | Palm2QImage.h \ | ||
24 | Prefs.h \ | ||
25 | PPMd.h \ | ||
26 | PPMdType.h \ | ||
27 | QFloatBar.h \ | ||
28 | QTReader.h \ | ||
29 | QTReaderApp.h \ | ||
30 | QtrListView.h \ | ||
31 | Queue.h \ | ||
32 | StateData.h \ | ||
33 | StyleConsts.h \ | ||
34 | SubAlloc.h \ | ||
35 | ToolbarPrefs.h \ | ||
36 | URLDialog.h \ | ||
37 | ZText.h \ | ||
38 | arith.h \ | ||
39 | arrierego.h \ | ||
40 | cbkmkselector.h \ | ||
41 | config.h \ | ||
42 | fileBrowser.h \ | ||
43 | infowin.h \ | ||
44 | linktype.h \ | ||
45 | my_list.h \ | ||
46 | names.h \ | ||
47 | nef.h \ | ||
48 | WSREADERINC/opie.h \ | ||
49 | pdb.h \ | ||
50 | plucker.h \ | ||
51 | plucker_base.h \ | ||
52 | ppm.h \ | ||
53 | ppm_expander.h \ | ||
54 | usenef.h \ | ||
55 | WSREADERINC/useqpe.h \ | ||
56 | ustring.h \ | ||
57 | utypes.h \ | ||
58 | version.h \ | ||
59 | ztxt.h | ||
60 | |||
61 | SOURCES = BuffDoc.cpp \ | ||
62 | ButtonPrefs.cpp \ | ||
63 | CAnnoEdit.cpp \ | ||
64 | CDrawBuffer.cpp \ | ||
65 | CEncoding.cpp \ | ||
66 | CEncoding_tables.cpp \ | ||
67 | CFilter.cpp \ | ||
68 | CRegExp.cpp \ | ||
69 | CloseDialog.cpp \ | ||
70 | FontControl.cpp \ | ||
71 | Prefs.cpp \ | ||
72 | QTReader.cpp \ | ||
73 | QTReaderApp.cpp \ | ||
74 | QtrListView.cpp \ | ||
75 | ToolbarPrefs.cpp \ | ||
76 | URLDialog.cpp \ | ||
77 | fileBrowser.cpp \ | ||
78 | infowin.cpp \ | ||
79 | main.cpp \ | ||
80 | orkey.cpp \ | ||
81 | util.cpp \ | ||
82 | version.cpp | ||
83 | |||
84 | |||
85 | INTERFACES= | ||
86 | DESTDIR = $(QPEDIR)/bin | ||
87 | INCLUDEPATH+= WSREADERINC | ||
88 | DEPENDPATH+= WSREADERINC | ||
89 | TARGET = uqtreader | ||
90 | LIBS += -lqpe -lreader_codec | ||
91 | |||
92 | OBJECTS_DIR = WSREADEROBJS | ||
93 | MOC_DIR = WSREADERMOCS | ||
diff --git a/noncore/apps/opie-reader/reader.zmak b/noncore/apps/opie-reader/reader.zmak new file mode 100644 index 0000000..bb697f4 --- a/dev/null +++ b/noncore/apps/opie-reader/reader.zmak | |||
@@ -0,0 +1,605 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building $(QPEDIR)/bin/uqtreader | ||
3 | # Generated by tmake at 15:17, 2004/05/08 | ||
4 | # Project: reader.zpro | ||
5 | # Template: app | ||
6 | ############################################################################# | ||
7 | |||
8 | ####### Compiler, tools and options | ||
9 | |||
10 | CC =arm-linux-gcc | ||
11 | CXX =arm-linux-g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG | ||
14 | INCPATH =-IZREADERINC -I$(QTDIR)/include | ||
15 | LINK =arm-linux-gcc | ||
16 | LFLAGS = | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqpe -lreader_codec -lqte | ||
18 | MOC =$(QTDIR)/bin/moc | ||
19 | UIC =$(QTDIR)/bin/uic | ||
20 | |||
21 | TAR =tar -cf | ||
22 | GZIP =gzip -9f | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =Aportis.h \ | ||
27 | Bkmks.h \ | ||
28 | BuffDoc.h \ | ||
29 | ButtonPrefs.h \ | ||
30 | CAnnoEdit.h \ | ||
31 | CBuffer.h \ | ||
32 | CDrawBuffer.h \ | ||
33 | CEncoding.h \ | ||
34 | CEncoding_tables.h \ | ||
35 | CExpander.h \ | ||
36 | CFilter.h \ | ||
37 | CloseDialog.h \ | ||
38 | Coder.h \ | ||
39 | CSource.h \ | ||
40 | Filedata.h \ | ||
41 | FixedFont.h \ | ||
42 | FontControl.h \ | ||
43 | GraphicWin.h \ | ||
44 | Markups.h \ | ||
45 | Navigation.h \ | ||
46 | Palm2QImage.h \ | ||
47 | Prefs.h \ | ||
48 | PPMd.h \ | ||
49 | PPMdType.h \ | ||
50 | QFloatBar.h \ | ||
51 | QTReader.h \ | ||
52 | QTReaderApp.h \ | ||
53 | QtrListView.h \ | ||
54 | Queue.h \ | ||
55 | StateData.h \ | ||
56 | StyleConsts.h \ | ||
57 | SubAlloc.h \ | ||
58 | ToolbarPrefs.h \ | ||
59 | URLDialog.h \ | ||
60 | ZText.h \ | ||
61 | arith.h \ | ||
62 | arrierego.h \ | ||
63 | cbkmkselector.h \ | ||
64 | config.h \ | ||
65 | fileBrowser.h \ | ||
66 | infowin.h \ | ||
67 | linktype.h \ | ||
68 | my_list.h \ | ||
69 | names.h \ | ||
70 | nef.h \ | ||
71 | ZREADERINC/opie.h \ | ||
72 | pdb.h \ | ||
73 | plucker.h \ | ||
74 | plucker_base.h \ | ||
75 | ppm.h \ | ||
76 | ppm_expander.h \ | ||
77 | usenef.h \ | ||
78 | ZREADERINC/useqpe.h \ | ||
79 | ustring.h \ | ||
80 | util.h \ | ||
81 | utypes.h \ | ||
82 | version.h \ | ||
83 | ztxt.h | ||
84 | SOURCES =BuffDoc.cpp \ | ||
85 | ButtonPrefs.cpp \ | ||
86 | CAnnoEdit.cpp \ | ||
87 | CDrawBuffer.cpp \ | ||
88 | CEncoding.cpp \ | ||
89 | CEncoding_tables.cpp \ | ||
90 | CFilter.cpp \ | ||
91 | CRegExp.cpp \ | ||
92 | CloseDialog.cpp \ | ||
93 | FontControl.cpp \ | ||
94 | Prefs.cpp \ | ||
95 | QTReader.cpp \ | ||
96 | QTReaderApp.cpp \ | ||
97 | QtrListView.cpp \ | ||
98 | ToolbarPrefs.cpp \ | ||
99 | URLDialog.cpp \ | ||
100 | fileBrowser.cpp \ | ||
101 | infowin.cpp \ | ||
102 | main.cpp \ | ||
103 | orkey.cpp \ | ||
104 | util.cpp \ | ||
105 | version.cpp | ||
106 | OBJECTS =ZREADEROBJS/BuffDoc.o \ | ||
107 | ZREADEROBJS/ButtonPrefs.o \ | ||
108 | ZREADEROBJS/CAnnoEdit.o \ | ||
109 | ZREADEROBJS/CDrawBuffer.o \ | ||
110 | ZREADEROBJS/CEncoding.o \ | ||
111 | ZREADEROBJS/CEncoding_tables.o \ | ||
112 | ZREADEROBJS/CFilter.o \ | ||
113 | ZREADEROBJS/CRegExp.o \ | ||
114 | ZREADEROBJS/CloseDialog.o \ | ||
115 | ZREADEROBJS/FontControl.o \ | ||
116 | ZREADEROBJS/Prefs.o \ | ||
117 | ZREADEROBJS/QTReader.o \ | ||
118 | ZREADEROBJS/QTReaderApp.o \ | ||
119 | ZREADEROBJS/QtrListView.o \ | ||
120 | ZREADEROBJS/ToolbarPrefs.o \ | ||
121 | ZREADEROBJS/URLDialog.o \ | ||
122 | ZREADEROBJS/fileBrowser.o \ | ||
123 | ZREADEROBJS/infowin.o \ | ||
124 | ZREADEROBJS/main.o \ | ||
125 | ZREADEROBJS/orkey.o \ | ||
126 | ZREADEROBJS/util.o \ | ||
127 | ZREADEROBJS/version.o | ||
128 | INTERFACES = | ||
129 | UICDECLS = | ||
130 | UICIMPLS = | ||
131 | SRCMOC =ZREADERMOCS/moc_ButtonPrefs.cpp \ | ||
132 | ZREADERMOCS/moc_CAnnoEdit.cpp \ | ||
133 | ZREADERMOCS/moc_CloseDialog.cpp \ | ||
134 | ZREADERMOCS/moc_GraphicWin.cpp \ | ||
135 | ZREADERMOCS/moc_Prefs.cpp \ | ||
136 | ZREADERMOCS/moc_QFloatBar.cpp \ | ||
137 | ZREADERMOCS/moc_QTReader.cpp \ | ||
138 | ZREADERMOCS/moc_QTReaderApp.cpp \ | ||
139 | ZREADERMOCS/moc_QtrListView.cpp \ | ||
140 | ZREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
141 | ZREADERMOCS/moc_URLDialog.cpp \ | ||
142 | ZREADERMOCS/moc_cbkmkselector.cpp \ | ||
143 | ZREADERMOCS/moc_fileBrowser.cpp \ | ||
144 | ZREADERMOCS/moc_infowin.cpp | ||
145 | OBJMOC =ZREADEROBJS/moc_ButtonPrefs.o \ | ||
146 | ZREADEROBJS/moc_CAnnoEdit.o \ | ||
147 | ZREADEROBJS/moc_CloseDialog.o \ | ||
148 | ZREADEROBJS/moc_GraphicWin.o \ | ||
149 | ZREADEROBJS/moc_Prefs.o \ | ||
150 | ZREADEROBJS/moc_QFloatBar.o \ | ||
151 | ZREADEROBJS/moc_QTReader.o \ | ||
152 | ZREADEROBJS/moc_QTReaderApp.o \ | ||
153 | ZREADEROBJS/moc_QtrListView.o \ | ||
154 | ZREADEROBJS/moc_ToolbarPrefs.o \ | ||
155 | ZREADEROBJS/moc_URLDialog.o \ | ||
156 | ZREADEROBJS/moc_cbkmkselector.o \ | ||
157 | ZREADEROBJS/moc_fileBrowser.o \ | ||
158 | ZREADEROBJS/moc_infowin.o | ||
159 | DIST = | ||
160 | TARGET =$(QPEDIR)/bin/uqtreader | ||
161 | INTERFACE_DECL_PATH = . | ||
162 | |||
163 | ####### Implicit rules | ||
164 | |||
165 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
166 | |||
167 | .cpp.o: | ||
168 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
169 | |||
170 | .cxx.o: | ||
171 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
172 | |||
173 | .cc.o: | ||
174 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
175 | |||
176 | .C.o: | ||
177 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
178 | |||
179 | .c.o: | ||
180 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
181 | |||
182 | ####### Build rules | ||
183 | |||
184 | |||
185 | all: $(TARGET) | ||
186 | |||
187 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
188 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
189 | |||
190 | moc: $(SRCMOC) | ||
191 | |||
192 | tmake: reader.zmak | ||
193 | |||
194 | reader.zmak: reader.zpro | ||
195 | tmake reader.zpro -o reader.zmak | ||
196 | |||
197 | dist: | ||
198 | $(TAR) reader.zpro.tar reader.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
199 | $(GZIP) reader.zpro.tar | ||
200 | |||
201 | clean: | ||
202 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | ||
203 | -rm -f *~ core | ||
204 | |||
205 | ####### Sub-libraries | ||
206 | |||
207 | |||
208 | ###### Combined headers | ||
209 | |||
210 | |||
211 | ####### Compile | ||
212 | |||
213 | ZREADEROBJS/BuffDoc.o: BuffDoc.cpp \ | ||
214 | ZREADERINC/static.h \ | ||
215 | names.h \ | ||
216 | BuffDoc.h \ | ||
217 | ZREADERINC/useqpe.h \ | ||
218 | CDrawBuffer.h \ | ||
219 | StyleConsts.h \ | ||
220 | CBuffer.h \ | ||
221 | config.h \ | ||
222 | ustring.h \ | ||
223 | my_list.h \ | ||
224 | linktype.h \ | ||
225 | CFilter.h \ | ||
226 | CExpander.h \ | ||
227 | Markups.h \ | ||
228 | CEncoding.h \ | ||
229 | CEncoding_tables.h \ | ||
230 | ZText.h \ | ||
231 | ebookcodec.h \ | ||
232 | Aportis.h \ | ||
233 | pdb.h \ | ||
234 | CHM.h \ | ||
235 | chm_lib.h \ | ||
236 | ppm_expander.h \ | ||
237 | utypes.h \ | ||
238 | ppm.h \ | ||
239 | arith.h \ | ||
240 | ztxt.h \ | ||
241 | plucker.h \ | ||
242 | plucker_base.h \ | ||
243 | Navigation.h \ | ||
244 | hrule.h \ | ||
245 | nef.h \ | ||
246 | usenef.h \ | ||
247 | arrierego.h \ | ||
248 | iSilo.h | ||
249 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/BuffDoc.o BuffDoc.cpp | ||
250 | |||
251 | ZREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \ | ||
252 | ButtonPrefs.h \ | ||
253 | orkey.h | ||
254 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp | ||
255 | |||
256 | ZREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \ | ||
257 | CAnnoEdit.h | ||
258 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp | ||
259 | |||
260 | ZREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \ | ||
261 | CDrawBuffer.h \ | ||
262 | StyleConsts.h \ | ||
263 | CBuffer.h \ | ||
264 | config.h \ | ||
265 | ustring.h \ | ||
266 | my_list.h \ | ||
267 | linktype.h \ | ||
268 | FontControl.h \ | ||
269 | ZREADERINC/useqpe.h \ | ||
270 | ZREADERINC/opie.h | ||
271 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp | ||
272 | |||
273 | ZREADEROBJS/CEncoding.o: CEncoding.cpp \ | ||
274 | CEncoding.h \ | ||
275 | CExpander.h \ | ||
276 | ZREADERINC/useqpe.h \ | ||
277 | config.h \ | ||
278 | ustring.h \ | ||
279 | StyleConsts.h \ | ||
280 | Markups.h \ | ||
281 | names.h \ | ||
282 | linktype.h \ | ||
283 | CEncoding_tables.h | ||
284 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CEncoding.o CEncoding.cpp | ||
285 | |||
286 | ZREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \ | ||
287 | CEncoding_tables.h \ | ||
288 | config.h \ | ||
289 | ustring.h | ||
290 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp | ||
291 | |||
292 | ZREADEROBJS/CFilter.o: CFilter.cpp \ | ||
293 | ZREADERINC/useqpe.h \ | ||
294 | CDrawBuffer.h \ | ||
295 | StyleConsts.h \ | ||
296 | CBuffer.h \ | ||
297 | config.h \ | ||
298 | ustring.h \ | ||
299 | my_list.h \ | ||
300 | linktype.h \ | ||
301 | CFilter.h \ | ||
302 | CExpander.h \ | ||
303 | Markups.h \ | ||
304 | names.h \ | ||
305 | CEncoding.h \ | ||
306 | CEncoding_tables.h \ | ||
307 | ZREADERINC/static.h \ | ||
308 | hrule.h \ | ||
309 | Bkmks.h \ | ||
310 | Filedata.h \ | ||
311 | QTReader.h \ | ||
312 | BuffDoc.h \ | ||
313 | FontControl.h \ | ||
314 | BGType.h \ | ||
315 | striphtml.h \ | ||
316 | Navigation.h \ | ||
317 | CRegExp.h \ | ||
318 | hash.h \ | ||
319 | Queue.h | ||
320 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CFilter.o CFilter.cpp | ||
321 | |||
322 | ZREADEROBJS/CRegExp.o: CRegExp.cpp \ | ||
323 | CRegExp.h \ | ||
324 | config.h \ | ||
325 | ustring.h \ | ||
326 | hash.h \ | ||
327 | Queue.h \ | ||
328 | my_list.h | ||
329 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CRegExp.o CRegExp.cpp | ||
330 | |||
331 | ZREADEROBJS/CloseDialog.o: CloseDialog.cpp \ | ||
332 | CloseDialog.h \ | ||
333 | ZREADERINC/useqpe.h | ||
334 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CloseDialog.o CloseDialog.cpp | ||
335 | |||
336 | ZREADEROBJS/FontControl.o: FontControl.cpp \ | ||
337 | ZREADERINC/opie.h \ | ||
338 | ZREADERINC/useqpe.h \ | ||
339 | FontControl.h \ | ||
340 | StyleConsts.h | ||
341 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/FontControl.o FontControl.cpp | ||
342 | |||
343 | ZREADEROBJS/Prefs.o: Prefs.cpp \ | ||
344 | Prefs.h \ | ||
345 | orkey.h \ | ||
346 | CEncoding_tables.h | ||
347 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Prefs.o Prefs.cpp | ||
348 | |||
349 | ZREADEROBJS/QTReader.o: QTReader.cpp \ | ||
350 | ZREADERINC/useqpe.h \ | ||
351 | config.h \ | ||
352 | ustring.h \ | ||
353 | QTReader.h \ | ||
354 | ZREADERINC/static.h \ | ||
355 | my_list.h \ | ||
356 | BuffDoc.h \ | ||
357 | CDrawBuffer.h \ | ||
358 | StyleConsts.h \ | ||
359 | CBuffer.h \ | ||
360 | linktype.h \ | ||
361 | CFilter.h \ | ||
362 | CExpander.h \ | ||
363 | Markups.h \ | ||
364 | names.h \ | ||
365 | CEncoding.h \ | ||
366 | CEncoding_tables.h \ | ||
367 | FontControl.h \ | ||
368 | BGType.h \ | ||
369 | striphtml.h \ | ||
370 | Navigation.h | ||
371 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/QTReader.o QTReader.cpp | ||
372 | |||
373 | ZREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \ | ||
374 | ZREADERINC/useqpe.h \ | ||
375 | QTReader.h \ | ||
376 | ZREADERINC/static.h \ | ||
377 | my_list.h \ | ||
378 | BuffDoc.h \ | ||
379 | CDrawBuffer.h \ | ||
380 | StyleConsts.h \ | ||
381 | CBuffer.h \ | ||
382 | config.h \ | ||
383 | ustring.h \ | ||
384 | linktype.h \ | ||
385 | CFilter.h \ | ||
386 | CExpander.h \ | ||
387 | Markups.h \ | ||
388 | names.h \ | ||
389 | CEncoding.h \ | ||
390 | CEncoding_tables.h \ | ||
391 | FontControl.h \ | ||
392 | BGType.h \ | ||
393 | striphtml.h \ | ||
394 | Navigation.h \ | ||
395 | GraphicWin.h \ | ||
396 | Bkmks.h \ | ||
397 | Filedata.h \ | ||
398 | cbkmkselector.h \ | ||
399 | infowin.h \ | ||
400 | ToolbarPrefs.h \ | ||
401 | preferences.h \ | ||
402 | Prefs.h \ | ||
403 | orkey.h \ | ||
404 | CAnnoEdit.h \ | ||
405 | QFloatBar.h \ | ||
406 | FixedFont.h \ | ||
407 | URLDialog.h \ | ||
408 | util.h \ | ||
409 | fileBrowser.h \ | ||
410 | QTReaderApp.h \ | ||
411 | CloseDialog.h \ | ||
412 | ButtonPrefs.h | ||
413 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/QTReaderApp.o QTReaderApp.cpp | ||
414 | |||
415 | ZREADEROBJS/QtrListView.o: QtrListView.cpp \ | ||
416 | QtrListView.h | ||
417 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/QtrListView.o QtrListView.cpp | ||
418 | |||
419 | ZREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \ | ||
420 | ZREADERINC/useqpe.h \ | ||
421 | ToolbarPrefs.h \ | ||
422 | preferences.h | ||
423 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp | ||
424 | |||
425 | ZREADEROBJS/URLDialog.o: URLDialog.cpp \ | ||
426 | URLDialog.h \ | ||
427 | ZREADERINC/useqpe.h | ||
428 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/URLDialog.o URLDialog.cpp | ||
429 | |||
430 | ZREADEROBJS/fileBrowser.o: fileBrowser.cpp \ | ||
431 | fileBrowser.h \ | ||
432 | QtrListView.h | ||
433 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/fileBrowser.o fileBrowser.cpp | ||
434 | |||
435 | ZREADEROBJS/infowin.o: infowin.cpp \ | ||
436 | infowin.h \ | ||
437 | version.h \ | ||
438 | names.h | ||
439 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/infowin.o infowin.cpp | ||
440 | |||
441 | ZREADEROBJS/main.o: main.cpp \ | ||
442 | ZREADERINC/useqpe.h \ | ||
443 | QTReaderApp.h \ | ||
444 | CExpander.h \ | ||
445 | config.h \ | ||
446 | ustring.h \ | ||
447 | StyleConsts.h \ | ||
448 | Markups.h \ | ||
449 | names.h \ | ||
450 | linktype.h \ | ||
451 | CEncoding.h \ | ||
452 | CEncoding_tables.h \ | ||
453 | orkey.h \ | ||
454 | BGType.h | ||
455 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/main.o main.cpp | ||
456 | |||
457 | ZREADEROBJS/orkey.o: orkey.cpp \ | ||
458 | orkey.h | ||
459 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/orkey.o orkey.cpp | ||
460 | |||
461 | ZREADEROBJS/util.o: util.cpp \ | ||
462 | util.h | ||
463 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/util.o util.cpp | ||
464 | |||
465 | ZREADEROBJS/version.o: version.cpp \ | ||
466 | version.h \ | ||
467 | names.h | ||
468 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/version.o version.cpp | ||
469 | |||
470 | ZREADEROBJS/moc_ButtonPrefs.o: ZREADERMOCS/moc_ButtonPrefs.cpp \ | ||
471 | ButtonPrefs.h \ | ||
472 | orkey.h | ||
473 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_ButtonPrefs.o ZREADERMOCS/moc_ButtonPrefs.cpp | ||
474 | |||
475 | ZREADEROBJS/moc_CAnnoEdit.o: ZREADERMOCS/moc_CAnnoEdit.cpp \ | ||
476 | CAnnoEdit.h | ||
477 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_CAnnoEdit.o ZREADERMOCS/moc_CAnnoEdit.cpp | ||
478 | |||
479 | ZREADEROBJS/moc_CloseDialog.o: ZREADERMOCS/moc_CloseDialog.cpp \ | ||
480 | CloseDialog.h \ | ||
481 | ZREADERINC/useqpe.h | ||
482 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_CloseDialog.o ZREADERMOCS/moc_CloseDialog.cpp | ||
483 | |||
484 | ZREADEROBJS/moc_GraphicWin.o: ZREADERMOCS/moc_GraphicWin.cpp \ | ||
485 | GraphicWin.h | ||
486 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_GraphicWin.o ZREADERMOCS/moc_GraphicWin.cpp | ||
487 | |||
488 | ZREADEROBJS/moc_Prefs.o: ZREADERMOCS/moc_Prefs.cpp \ | ||
489 | Prefs.h \ | ||
490 | orkey.h | ||
491 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_Prefs.o ZREADERMOCS/moc_Prefs.cpp | ||
492 | |||
493 | ZREADEROBJS/moc_QFloatBar.o: ZREADERMOCS/moc_QFloatBar.cpp \ | ||
494 | QFloatBar.h | ||
495 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QFloatBar.o ZREADERMOCS/moc_QFloatBar.cpp | ||
496 | |||
497 | ZREADEROBJS/moc_QTReader.o: ZREADERMOCS/moc_QTReader.cpp \ | ||
498 | QTReader.h \ | ||
499 | ZREADERINC/static.h \ | ||
500 | my_list.h \ | ||
501 | BuffDoc.h \ | ||
502 | ZREADERINC/useqpe.h \ | ||
503 | CDrawBuffer.h \ | ||
504 | StyleConsts.h \ | ||
505 | CBuffer.h \ | ||
506 | config.h \ | ||
507 | ustring.h \ | ||
508 | linktype.h \ | ||
509 | CFilter.h \ | ||
510 | CExpander.h \ | ||
511 | Markups.h \ | ||
512 | names.h \ | ||
513 | CEncoding.h \ | ||
514 | CEncoding_tables.h \ | ||
515 | FontControl.h \ | ||
516 | BGType.h \ | ||
517 | striphtml.h \ | ||
518 | Navigation.h | ||
519 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QTReader.o ZREADERMOCS/moc_QTReader.cpp | ||
520 | |||
521 | ZREADEROBJS/moc_QTReaderApp.o: ZREADERMOCS/moc_QTReaderApp.cpp \ | ||
522 | QTReaderApp.h \ | ||
523 | ZREADERINC/useqpe.h \ | ||
524 | CExpander.h \ | ||
525 | config.h \ | ||
526 | ustring.h \ | ||
527 | StyleConsts.h \ | ||
528 | Markups.h \ | ||
529 | names.h \ | ||
530 | linktype.h \ | ||
531 | CEncoding.h \ | ||
532 | CEncoding_tables.h \ | ||
533 | orkey.h \ | ||
534 | BGType.h | ||
535 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QTReaderApp.o ZREADERMOCS/moc_QTReaderApp.cpp | ||
536 | |||
537 | ZREADEROBJS/moc_QtrListView.o: ZREADERMOCS/moc_QtrListView.cpp \ | ||
538 | QtrListView.h | ||
539 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QtrListView.o ZREADERMOCS/moc_QtrListView.cpp | ||
540 | |||
541 | ZREADEROBJS/moc_ToolbarPrefs.o: ZREADERMOCS/moc_ToolbarPrefs.cpp \ | ||
542 | ToolbarPrefs.h \ | ||
543 | ZREADERINC/useqpe.h \ | ||
544 | preferences.h | ||
545 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_ToolbarPrefs.o ZREADERMOCS/moc_ToolbarPrefs.cpp | ||
546 | |||
547 | ZREADEROBJS/moc_URLDialog.o: ZREADERMOCS/moc_URLDialog.cpp \ | ||
548 | URLDialog.h \ | ||
549 | ZREADERINC/useqpe.h | ||
550 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_URLDialog.o ZREADERMOCS/moc_URLDialog.cpp | ||
551 | |||
552 | ZREADEROBJS/moc_cbkmkselector.o: ZREADERMOCS/moc_cbkmkselector.cpp \ | ||
553 | cbkmkselector.h | ||
554 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_cbkmkselector.o ZREADERMOCS/moc_cbkmkselector.cpp | ||
555 | |||
556 | ZREADEROBJS/moc_fileBrowser.o: ZREADERMOCS/moc_fileBrowser.cpp \ | ||
557 | fileBrowser.h | ||
558 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_fileBrowser.o ZREADERMOCS/moc_fileBrowser.cpp | ||
559 | |||
560 | ZREADEROBJS/moc_infowin.o: ZREADERMOCS/moc_infowin.cpp \ | ||
561 | infowin.h | ||
562 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_infowin.o ZREADERMOCS/moc_infowin.cpp | ||
563 | |||
564 | ZREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h | ||
565 | $(MOC) ButtonPrefs.h -o ZREADERMOCS/moc_ButtonPrefs.cpp | ||
566 | |||
567 | ZREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h | ||
568 | $(MOC) CAnnoEdit.h -o ZREADERMOCS/moc_CAnnoEdit.cpp | ||
569 | |||
570 | ZREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h | ||
571 | $(MOC) CloseDialog.h -o ZREADERMOCS/moc_CloseDialog.cpp | ||
572 | |||
573 | ZREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h | ||
574 | $(MOC) GraphicWin.h -o ZREADERMOCS/moc_GraphicWin.cpp | ||
575 | |||
576 | ZREADERMOCS/moc_Prefs.cpp: Prefs.h | ||
577 | $(MOC) Prefs.h -o ZREADERMOCS/moc_Prefs.cpp | ||
578 | |||
579 | ZREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h | ||
580 | $(MOC) QFloatBar.h -o ZREADERMOCS/moc_QFloatBar.cpp | ||
581 | |||
582 | ZREADERMOCS/moc_QTReader.cpp: QTReader.h | ||
583 | $(MOC) QTReader.h -o ZREADERMOCS/moc_QTReader.cpp | ||
584 | |||
585 | ZREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h | ||
586 | $(MOC) QTReaderApp.h -o ZREADERMOCS/moc_QTReaderApp.cpp | ||
587 | |||
588 | ZREADERMOCS/moc_QtrListView.cpp: QtrListView.h | ||
589 | $(MOC) QtrListView.h -o ZREADERMOCS/moc_QtrListView.cpp | ||
590 | |||
591 | ZREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h | ||
592 | $(MOC) ToolbarPrefs.h -o ZREADERMOCS/moc_ToolbarPrefs.cpp | ||
593 | |||
594 | ZREADERMOCS/moc_URLDialog.cpp: URLDialog.h | ||
595 | $(MOC) URLDialog.h -o ZREADERMOCS/moc_URLDialog.cpp | ||
596 | |||
597 | ZREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h | ||
598 | $(MOC) cbkmkselector.h -o ZREADERMOCS/moc_cbkmkselector.cpp | ||
599 | |||
600 | ZREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h | ||
601 | $(MOC) fileBrowser.h -o ZREADERMOCS/moc_fileBrowser.cpp | ||
602 | |||
603 | ZREADERMOCS/moc_infowin.cpp: infowin.h | ||
604 | $(MOC) infowin.h -o ZREADERMOCS/moc_infowin.cpp | ||
605 | |||
diff --git a/noncore/apps/opie-reader/reader.zpro b/noncore/apps/opie-reader/reader.zpro new file mode 100644 index 0000000..32deb2b --- a/dev/null +++ b/noncore/apps/opie-reader/reader.zpro | |||
@@ -0,0 +1,95 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = Aportis.h \ | ||
4 | Bkmks.h \ | ||
5 | BuffDoc.h \ | ||
6 | ButtonPrefs.h \ | ||
7 | CAnnoEdit.h \ | ||
8 | CBuffer.h \ | ||
9 | CDrawBuffer.h \ | ||
10 | CEncoding.h \ | ||
11 | CEncoding_tables.h \ | ||
12 | CExpander.h \ | ||
13 | CFilter.h \ | ||
14 | CloseDialog.h \ | ||
15 | Coder.h \ | ||
16 | CSource.h \ | ||
17 | Filedata.h \ | ||
18 | FixedFont.h \ | ||
19 | FontControl.h \ | ||
20 | GraphicWin.h \ | ||
21 | Markups.h \ | ||
22 | Navigation.h \ | ||
23 | Palm2QImage.h \ | ||
24 | Prefs.h \ | ||
25 | PPMd.h \ | ||
26 | PPMdType.h \ | ||
27 | QFloatBar.h \ | ||
28 | QTReader.h \ | ||
29 | QTReaderApp.h \ | ||
30 | QtrListView.h \ | ||
31 | Queue.h \ | ||
32 | StateData.h \ | ||
33 | StyleConsts.h \ | ||
34 | SubAlloc.h \ | ||
35 | ToolbarPrefs.h \ | ||
36 | URLDialog.h \ | ||
37 | ZText.h \ | ||
38 | arith.h \ | ||
39 | arrierego.h \ | ||
40 | cbkmkselector.h \ | ||
41 | config.h \ | ||
42 | fileBrowser.h \ | ||
43 | infowin.h \ | ||
44 | linktype.h \ | ||
45 | my_list.h \ | ||
46 | names.h \ | ||
47 | nef.h \ | ||
48 | ZREADERINC/opie.h \ | ||
49 | pdb.h \ | ||
50 | plucker.h \ | ||
51 | plucker_base.h \ | ||
52 | ppm.h \ | ||
53 | ppm_expander.h \ | ||
54 | usenef.h \ | ||
55 | ZREADERINC/useqpe.h \ | ||
56 | ustring.h \ | ||
57 | util.h \ | ||
58 | utypes.h \ | ||
59 | version.h \ | ||
60 | ztxt.h | ||
61 | |||
62 | SOURCES = BuffDoc.cpp \ | ||
63 | ButtonPrefs.cpp \ | ||
64 | CAnnoEdit.cpp \ | ||
65 | CDrawBuffer.cpp \ | ||
66 | CEncoding.cpp \ | ||
67 | CEncoding_tables.cpp \ | ||
68 | CFilter.cpp \ | ||
69 | CRegExp.cpp \ | ||
70 | CloseDialog.cpp \ | ||
71 | FontControl.cpp \ | ||
72 | GraphicWin.cpp \ | ||
73 | Prefs.cpp \ | ||
74 | QTReader.cpp \ | ||
75 | QTReaderApp.cpp \ | ||
76 | QtrListView.cpp \ | ||
77 | ToolbarPrefs.cpp \ | ||
78 | URLDialog.cpp \ | ||
79 | fileBrowser.cpp \ | ||
80 | infowin.cpp \ | ||
81 | main.cpp \ | ||
82 | orkey.cpp \ | ||
83 | util.cpp \ | ||
84 | version.cpp | ||
85 | |||
86 | |||
87 | INTERFACES= | ||
88 | DESTDIR = $(QPEDIR)/bin | ||
89 | INCLUDEPATH+= ZREADERINC | ||
90 | DEPENDPATH+= ZREADERINC | ||
91 | TARGET = uqtreader | ||
92 | LIBS += -lqpe -lreader_codec | ||
93 | |||
94 | OBJECTS_DIR = ZREADEROBJS | ||
95 | MOC_DIR = ZREADERMOCS | ||
diff --git a/noncore/apps/opie-reader/reader/.cvsignore b/noncore/apps/opie-reader/reader/.cvsignore new file mode 100644 index 0000000..1810ee0 --- a/dev/null +++ b/noncore/apps/opie-reader/reader/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | Makefile | ||
2 | config.in | ||
3 | moc_* | ||
4 | .moc | ||
5 | .obj | ||
diff --git a/noncore/apps/opie-reader/reader/reader.pro b/noncore/apps/opie-reader/reader/reader.pro new file mode 100644 index 0000000..3f56da9 --- a/dev/null +++ b/noncore/apps/opie-reader/reader/reader.pro | |||
@@ -0,0 +1,91 @@ | |||
1 | DEFINES += OPIE USEQPE | ||
2 | VPATH = .. | ||
3 | TEMPLATE= app | ||
4 | CONFIG = qt warn_on release | ||
5 | HEADERS = Aportis.h \ | ||
6 | Bkmks.h \ | ||
7 | BuffDoc.h \ | ||
8 | ButtonPrefs.h \ | ||
9 | CAnnoEdit.h \ | ||
10 | CBuffer.h \ | ||
11 | CDrawBuffer.h \ | ||
12 | CEncoding.h \ | ||
13 | CEncoding_tables.h \ | ||
14 | CExpander.h \ | ||
15 | CFilter.h \ | ||
16 | CloseDialog.h \ | ||
17 | Filedata.h \ | ||
18 | FixedFont.h \ | ||
19 | FontControl.h \ | ||
20 | GraphicWin.h \ | ||
21 | Markups.h \ | ||
22 | Navigation.h \ | ||
23 | Palm2QImage.h \ | ||
24 | Prefs.h \ | ||
25 | PPMd.h \ | ||
26 | PPMdType.h \ | ||
27 | QFloatBar.h \ | ||
28 | QTReader.h \ | ||
29 | QTReaderApp.h \ | ||
30 | QtrListView.h \ | ||
31 | Queue.h \ | ||
32 | StyleConsts.h \ | ||
33 | ToolbarPrefs.h \ | ||
34 | URLDialog.h \ | ||
35 | ZText.h \ | ||
36 | arith.h \ | ||
37 | cbkmkselector.h \ | ||
38 | config.h \ | ||
39 | fileBrowser.h \ | ||
40 | infowin.h \ | ||
41 | linktype.h \ | ||
42 | my_list.h \ | ||
43 | names.h \ | ||
44 | ../OREADERINC/opie.h \ | ||
45 | pdb.h \ | ||
46 | plucker.h \ | ||
47 | plucker_base.h \ | ||
48 | ppm.h \ | ||
49 | ppm_expander.h \ | ||
50 | usenef.h \ | ||
51 | ../OREADERINC/useqpe.h \ | ||
52 | ustring.h \ | ||
53 | util.h \ | ||
54 | utypes.h \ | ||
55 | version.h \ | ||
56 | ztxt.h | ||
57 | |||
58 | SOURCES = BuffDoc.cpp \ | ||
59 | ButtonPrefs.cpp \ | ||
60 | CAnnoEdit.cpp \ | ||
61 | CDrawBuffer.cpp \ | ||
62 | CEncoding.cpp \ | ||
63 | CEncoding_tables.cpp \ | ||
64 | CFilter.cpp \ | ||
65 | CRegExp.cpp \ | ||
66 | CloseDialog.cpp \ | ||
67 | FontControl.cpp \ | ||
68 | GraphicWin.cpp \ | ||
69 | Prefs.cpp \ | ||
70 | QTReader.cpp \ | ||
71 | QTReaderApp.cpp \ | ||
72 | QtrListView.cpp \ | ||
73 | ToolbarPrefs.cpp \ | ||
74 | URLDialog.cpp \ | ||
75 | fileBrowser.cpp \ | ||
76 | infowin.cpp \ | ||
77 | main.cpp \ | ||
78 | orkey.cpp \ | ||
79 | util.cpp \ | ||
80 | version.cpp | ||
81 | |||
82 | INTERFACES= | ||
83 | DESTDIR = $(OPIEDIR)/bin | ||
84 | INCLUDEPATH+= ../OREADERINC $(OPIEDIR)/include | ||
85 | DEPENDPATH+= ../OREADERINC $(OPIEDIR)/include | ||
86 | TARGET = reader | ||
87 | LIBS += -lopieui2 -lqpe -lreader_codec | ||
88 | |||
89 | DEPENDPATH += ../OREADERINC | ||
90 | |||
91 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/opie-reader/setn.sh b/noncore/apps/opie-reader/setn.sh new file mode 100644 index 0000000..ad9409f --- a/dev/null +++ b/noncore/apps/opie-reader/setn.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | red='\e[0;31m' | ||
2 | RED='\e[1;31m' | ||
3 | blue='\e[0;34m' | ||
4 | BLUE='\e[1;34m' | ||
5 | cyan='\e[0;36m' | ||
6 | CYAN='\e[1;36m' | ||
7 | NC='\e[0m' # No Color | ||
8 | |||
9 | if test -z $OLDPATH; then | ||
10 | export OLDPATH=$PATH | ||
11 | fi | ||
12 | |||
13 | if test -z $OLD_LD_LIBRARY_PATH; then | ||
14 | export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH | ||
15 | fi | ||
16 | |||
17 | #export QPEDIR=/opt/Qtopia | ||
18 | export QTDIR=/home/tim/nevyos/qt-embedded-free-3.1.1 | ||
19 | export PATH=$QTDIR/bin:$OLDPATH | ||
20 | export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++ | ||
21 | export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH | ||
22 | |||
23 | #PS1="[${cyan}\T$NC][${RED}Laptop${NC}]\W> " | ||
24 | #PS1="[${RED}NevyOS${NC}]\W> " | ||
25 | PS1="[NevyOS]\W> " | ||
26 | |||
27 | echo -e \\n${RED}NevyOS${NC} environment configured\\n | ||
diff --git a/noncore/apps/opie-reader/seto.sh b/noncore/apps/opie-reader/seto.sh new file mode 100644 index 0000000..c1d1dd1 --- a/dev/null +++ b/noncore/apps/opie-reader/seto.sh | |||
@@ -0,0 +1,25 @@ | |||
1 | red='\e[0;31m' | ||
2 | RED='\e[1;31m' | ||
3 | blue='\e[0;34m' | ||
4 | BLUE='\e[1;34m' | ||
5 | cyan='\e[0;36m' | ||
6 | CYAN='\e[1;36m' | ||
7 | NC='\e[0m' # No Color | ||
8 | |||
9 | if test -z $OLDPATH; then | ||
10 | export OLDPATH=$PATH | ||
11 | fi | ||
12 | |||
13 | if test -z $OLD_LD_LIBRARY_PATH; then | ||
14 | export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH | ||
15 | fi | ||
16 | |||
17 | export QPEDIR=/opt/Qtopia/opie | ||
18 | export QTDIR=/opt/Qtopia/opie | ||
19 | export PATH=$QTDIR/bin:/usr/local/arm/3.3/bin:$OLDPATH | ||
20 | export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-opie-g++ | ||
21 | #export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH | ||
22 | |||
23 | PS1="[Opie]\W> " | ||
24 | |||
25 | echo -e \\n${RED}Opie${NC} environment configured\\n | ||
diff --git a/noncore/apps/opie-reader/setqt.sh b/noncore/apps/opie-reader/setqt.sh new file mode 100644 index 0000000..1b7e7b7 --- a/dev/null +++ b/noncore/apps/opie-reader/setqt.sh | |||
@@ -0,0 +1,30 @@ | |||
1 | red='\e[0;31m' | ||
2 | RED='\e[1;31m' | ||
3 | blue='\e[0;34m' | ||
4 | BLUE='\e[1;34m' | ||
5 | cyan='\e[0;36m' | ||
6 | CYAN='\e[1;36m' | ||
7 | NC='\e[0m' # No Color | ||
8 | |||
9 | if test -z $OLDPATH; then | ||
10 | export OLDPATH=$PATH | ||
11 | fi | ||
12 | |||
13 | if test -z $OLD_LD_LIBRARY_PATH; then | ||
14 | export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH | ||
15 | fi | ||
16 | |||
17 | #export QPEDIR=/opt/Qtopia | ||
18 | export QTDIR=/usr/lib/qt3 | ||
19 | export PATH=$QTDIR/bin:$OLDPATH | ||
20 | #export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++ | ||
21 | |||
22 | export READERDIR=/home/tim/uqtreader | ||
23 | export LD_LIBRARY_PATH=$READERDIR/lib:$OLD_LD_LIBRARY_PATH | ||
24 | |||
25 | |||
26 | #PS1="[${cyan}\T$NC][${RED}Laptop${NC}]\W> " | ||
27 | #PS1="[${RED}NevyOS${NC}]\W> " | ||
28 | PS1="[QT]\W> " | ||
29 | |||
30 | echo -e \\n${RED}QT${NC} environment configured\\n | ||
diff --git a/noncore/apps/opie-reader/setws.sh b/noncore/apps/opie-reader/setws.sh new file mode 100644 index 0000000..61aeccb --- a/dev/null +++ b/noncore/apps/opie-reader/setws.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | red='\e[0;31m' | ||
2 | RED='\e[1;31m' | ||
3 | blue='\e[0;34m' | ||
4 | BLUE='\e[1;34m' | ||
5 | cyan='\e[0;36m' | ||
6 | CYAN='\e[1;36m' | ||
7 | NC='\e[0m' # No Color | ||
8 | |||
9 | if test -z $OLDPATH; then | ||
10 | export OLDPATH=$PATH | ||
11 | fi | ||
12 | |||
13 | if test -z $OLD_LD_LIBRARY_PATH; then | ||
14 | export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH | ||
15 | fi | ||
16 | |||
17 | export QPEDIR=/opt/Qtopia | ||
18 | export QTDIR=/opt/Qtopia | ||
19 | export PATH=$QTDIR/bin:$OLDPATH | ||
20 | export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++ | ||
21 | export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH | ||
22 | |||
23 | #PS1="[${cyan}\T$NC][${RED}Laptop${NC}]\W> " | ||
24 | #PS1="[${RED}Laptop${NC}]\W> " | ||
25 | PS1="[Laptop]\W> " | ||
26 | |||
27 | echo -e \\n${RED}Laptop${NC} environment configured\\n | ||
diff --git a/noncore/apps/opie-reader/setz.sh b/noncore/apps/opie-reader/setz.sh new file mode 100644 index 0000000..e2fa4cd --- a/dev/null +++ b/noncore/apps/opie-reader/setz.sh | |||
@@ -0,0 +1,25 @@ | |||
1 | red='\e[0;31m' | ||
2 | RED='\e[1;31m' | ||
3 | blue='\e[0;34m' | ||
4 | BLUE='\e[1;34m' | ||
5 | cyan='\e[0;36m' | ||
6 | CYAN='\e[1;36m' | ||
7 | NC='\e[0m' # No Color | ||
8 | |||
9 | if test -z $OLDPATH; then | ||
10 | export OLDPATH=$PATH | ||
11 | fi | ||
12 | |||
13 | if test -z $OLD_LD_LIBRARY_PATH; then | ||
14 | export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH | ||
15 | fi | ||
16 | |||
17 | export QPEDIR=/opt/Qtopia/sharp | ||
18 | export QTDIR=/opt/Qtopia/sharp | ||
19 | export PATH=$QTDIR/bin:/usr/local/arm/bin:$OLDPATH | ||
20 | export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-sharp-g++ | ||
21 | export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH | ||
22 | |||
23 | PS1="[Zaurus]\W> " | ||
24 | |||
25 | echo -e \\n${RED}Zaurus${NC} environment configured\\n | ||
diff --git a/noncore/apps/opie-reader/striphtml.cpp b/noncore/apps/opie-reader/striphtml.cpp new file mode 100644 index 0000000..9cd6a0d --- a/dev/null +++ b/noncore/apps/opie-reader/striphtml.cpp | |||
@@ -0,0 +1,1249 @@ | |||
1 | #include <qmap.h> | ||
2 | #include <qfileinfo.h> | ||
3 | #include <qtextstream.h> | ||
4 | #include <qdir.h> | ||
5 | #include "useqpe.h" | ||
6 | #ifdef USEQPE | ||
7 | #include <qpe/global.h> | ||
8 | #endif | ||
9 | #include "CDrawBuffer.h" | ||
10 | #include "striphtml.h" | ||
11 | #include "hrule.h" | ||
12 | #include "util.h" | ||
13 | |||
14 | #include <qregexp.h> | ||
15 | #include <qimage.h> | ||
16 | #include <qpixmap.h> | ||
17 | //#include <qprogressdialog.h> | ||
18 | //#include <qapplication.h> | ||
19 | |||
20 | static unsigned char h2i(unsigned char c) | ||
21 | { | ||
22 | unsigned char ret = 0; | ||
23 | if ('0' <= c && c <= '9') | ||
24 | { | ||
25 | ret = c - '0'; | ||
26 | } | ||
27 | else if ('a' <= c && c <= 'f') | ||
28 | { | ||
29 | ret = c - 'a' + 10; | ||
30 | } | ||
31 | return ret; | ||
32 | } | ||
33 | |||
34 | static void parse_color(const QString& attr, unsigned char& r, unsigned char& g, unsigned char& b) | ||
35 | { | ||
36 | r = g = b = 0; | ||
37 | if (attr.length() >= 7 && attr[0] == '#') | ||
38 | { | ||
39 | r = h2i(attr[1].unicode()); | ||
40 | r = 16*r + h2i(attr[2].unicode()); | ||
41 | g = h2i(attr[3].unicode()); | ||
42 | g = 16*g + h2i(attr[4].unicode()); | ||
43 | b = h2i(attr[5].unicode()); | ||
44 | b = 16*b + h2i(attr[6].unicode()); | ||
45 | } | ||
46 | else if (attr == "red") | ||
47 | { | ||
48 | r = 255; | ||
49 | } | ||
50 | else if (attr == "green") | ||
51 | { | ||
52 | g = 255; | ||
53 | } | ||
54 | else if (attr == "blue") | ||
55 | { | ||
56 | b = 255; | ||
57 | } | ||
58 | else if (attr == "white") | ||
59 | { | ||
60 | r = g = b = 255; | ||
61 | } | ||
62 | else if (attr == "black") | ||
63 | { | ||
64 | r = g = b = 0; | ||
65 | } | ||
66 | else | ||
67 | { | ||
68 | qDebug("Don't understand colour \"%s\"", (const char*)attr); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | CNavigation_base<htmlmark> striphtml::m_nav; | ||
73 | |||
74 | void striphtml::skipblock(const QString& _ent) | ||
75 | { | ||
76 | tchar ch = '>'; | ||
77 | CStyle dummy; | ||
78 | QString ent; | ||
79 | unsigned long pos; | ||
80 | do | ||
81 | { | ||
82 | while (ch != '<' && ch != UEOF) | ||
83 | { | ||
84 | mygetch(ch, dummy, pos); | ||
85 | } | ||
86 | |||
87 | ch = skip_ws(); | ||
88 | |||
89 | ent = getname(ch, " >").lower(); | ||
90 | qDebug("Skipblock:%s", (const char*)ent); | ||
91 | } while (ent != _ent && ch != UEOF); | ||
92 | } | ||
93 | |||
94 | void striphtml::locate(unsigned int n) | ||
95 | { | ||
96 | m_inblock = false; | ||
97 | text_q = ""; | ||
98 | forcecentre = false; | ||
99 | ignorespace = false; | ||
100 | while (!stylestack.isEmpty()) stylestack.pop(); | ||
101 | currentstyle.unset(); | ||
102 | qDebug("striphtml:locating:%u", n); | ||
103 | parent->locate(n); | ||
104 | } | ||
105 | |||
106 | int striphtml::getpara(CBuffer& buff, unsigned long& startpos) | ||
107 | { | ||
108 | tchar ch; | ||
109 | CStyle sty; | ||
110 | unsigned long pos; | ||
111 | int i = 0; | ||
112 | parent->getch(ch, sty, startpos); | ||
113 | pos = startpos; | ||
114 | while (1) | ||
115 | { | ||
116 | if (ch == 10 && !isPre) | ||
117 | { | ||
118 | ch = ' '; | ||
119 | } | ||
120 | if (ch == UEOF) | ||
121 | { | ||
122 | // qDebug("EOF:%d:%u", i, pos); | ||
123 | buff[i] = 0; | ||
124 | if (i == 0) | ||
125 | { | ||
126 | i = -1; | ||
127 | } | ||
128 | return i; | ||
129 | } | ||
130 | else if (ch == '<') | ||
131 | { | ||
132 | tchar ch2 = skip_ws(); | ||
133 | QString ent = getname(ch2, " >"); | ||
134 | ent = ent.lower(); | ||
135 | // qDebug("ent:%s", (const char*)ent); | ||
136 | if (ent == "a") | ||
137 | { | ||
138 | buff[i++] = '<'; | ||
139 | buff[i++] = 'a'; | ||
140 | buff[i++] = ch2; | ||
141 | // buff[i] = 0; qDebug("ANCHOR:%s", (const char*)toQString(buff.data())); | ||
142 | } | ||
143 | else if (ent == "/a") | ||
144 | { | ||
145 | buff[i++] = '<'; | ||
146 | buff[i++] = '/'; | ||
147 | buff[i++] = 'a'; | ||
148 | buff[i++] = ch2; | ||
149 | // buff[i] = 0; qDebug("/ANCHOR:%s", (const char*)toQString(buff.data())); | ||
150 | } | ||
151 | else if (ent == "div") | ||
152 | { | ||
153 | // buff[i] = 0; qDebug("DIV:%s", (const char*)toQString(buff.data())); | ||
154 | if (i == 0) | ||
155 | { | ||
156 | buff[i++] = '<'; | ||
157 | buff[i++] = 'd'; | ||
158 | buff[i++] = 'i'; | ||
159 | buff[i++] = 'v'; | ||
160 | buff[i++] = ' '; | ||
161 | buff[i++] = ch2; | ||
162 | while (ch2 != '>' && ch2 != UEOF && i < 2048) | ||
163 | { | ||
164 | parent->getch(ch2, sty, pos); | ||
165 | buff[i++] = ch2; | ||
166 | } | ||
167 | } | ||
168 | else | ||
169 | { | ||
170 | locate(pos); | ||
171 | } | ||
172 | buff[i++] = 0; | ||
173 | // qDebug("DIV:%s", (const char*)toQString(buff.data())); | ||
174 | return i; | ||
175 | } | ||
176 | else if (ent == "p" || (ent[0] == 'h' && ent.length() == 2 && QString("123456789").find(ent[1]) != -1)) | ||
177 | { | ||
178 | buff[i++] = 0; | ||
179 | while (ch2 != '>' && ch2 != UEOF) | ||
180 | { | ||
181 | parent->getch(ch2, sty, pos); | ||
182 | } | ||
183 | return i; | ||
184 | } | ||
185 | else | ||
186 | { | ||
187 | while (ch2 != '>' && ch2 != UEOF) | ||
188 | { | ||
189 | parent->getch(ch2, sty, pos); | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | buff[i++] = ch; | ||
196 | } | ||
197 | parent->getch(ch, sty, pos); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | QString striphtml::dehtml(const QString& _info) | ||
202 | { | ||
203 | QString info; | ||
204 | for (int i = 0; i < _info.length(); i++) | ||
205 | { | ||
206 | tchar ch = _info[i]; | ||
207 | if (ch == '%') | ||
208 | { | ||
209 | ch = 0; | ||
210 | for (int j = 0; j < 2; j++) | ||
211 | { | ||
212 | ch <<= 4; | ||
213 | tchar ch1 = _info[++i]; | ||
214 | if ('0' <= ch1 && ch1 <= '9') | ||
215 | { | ||
216 | ch += ch1 - '0'; | ||
217 | } | ||
218 | else if ('a' <= ch1 && ch1 <= 'f') | ||
219 | { | ||
220 | ch += ch1 - 'a' + 10; | ||
221 | } | ||
222 | else if ('A' <= ch1 && ch1 <= 'F') | ||
223 | { | ||
224 | ch += ch1 - 'A' + 10; | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | info += ch; | ||
229 | } | ||
230 | return info; | ||
231 | } | ||
232 | |||
233 | bool striphtml::findanchor(const QString& _info) | ||
234 | { | ||
235 | // QProgressDialog dlg("Finding link...", QString::null, 0, NULL, "progress", true); | ||
236 | // QProgressBar dlg(0); | ||
237 | #if defined(USEQPE) || defined(_WINDOWS) | ||
238 | QString info; | ||
239 | for (int i = 0; i < _info.length(); i++) | ||
240 | { | ||
241 | tchar ch = _info[i]; | ||
242 | if (QString(".^$[]*+?").find(ch) != -1) | ||
243 | { | ||
244 | info += '\\'; | ||
245 | } | ||
246 | info += ch; | ||
247 | } | ||
248 | #else | ||
249 | QString info = QRegExp::escape(_info); | ||
250 | #endif | ||
251 | qDebug("Adjusted searchstring:%s", (const char*)info); | ||
252 | QString sname("<[Aa][^>]*[ \t]+[Nn][Aa][Mm][Ee][ \t]*=[ \t]*\"?"); | ||
253 | sname += info + "\"?[ \t>]"; | ||
254 | QString sid("<[A-Za-z][^>]*[ \t]+[Ii][Dd][ \t]*=[ \t]*\"?"); | ||
255 | sid += info+"\"?[ \t>]"; | ||
256 | #ifdef USEQPE | ||
257 | QRegExp name(sname); | ||
258 | QRegExp id(sid); | ||
259 | #else | ||
260 | QRegExp name(sname+"|"+sid); | ||
261 | #endif | ||
262 | bool ret = true; | ||
263 | locate(0); | ||
264 | unsigned long pos = 0; | ||
265 | unsigned long startpos = 0; | ||
266 | int offset; | ||
267 | CBuffer test; | ||
268 | qDebug("striphtml::findanchor"); | ||
269 | // dlg.show(); | ||
270 | if (getpara(test, pos) >= 0) | ||
271 | { | ||
272 | while (1) | ||
273 | { | ||
274 | // qApp->processEvents(); | ||
275 | if ((offset = name.match(toQString(test.data()))) != -1) break; | ||
276 | #ifdef USEQPE | ||
277 | if ((offset = id.match(toQString(test.data()))) != -1) break; | ||
278 | #endif | ||
279 | if (getpara(test, pos) < 0) | ||
280 | { | ||
281 | locate(startpos); | ||
282 | qDebug("Not found"); | ||
283 | return false; | ||
284 | } | ||
285 | } | ||
286 | locate(pos); | ||
287 | qDebug("Found"); | ||
288 | ret = true; | ||
289 | } | ||
290 | else | ||
291 | { | ||
292 | locate(startpos); | ||
293 | qDebug("Not found"); | ||
294 | ret = false; | ||
295 | } | ||
296 | return ret; | ||
297 | } | ||
298 | |||
299 | striphtml::striphtml(const QString& _s) : entmap(NULL), isPre(false), currentid(0), lastch(0), currentfile(_s), indent(0), forcecentre(false), m_inblock(false), m_bchm(false), ignorespace(false) | ||
300 | { | ||
301 | href2filepos = new QMap<QString, unsigned long>; | ||
302 | id2href = new QMap<unsigned long, QString>; | ||
303 | } | ||
304 | |||
305 | striphtml::~striphtml() | ||
306 | { | ||
307 | if (entmap != NULL) delete entmap; | ||
308 | delete href2filepos; | ||
309 | delete id2href; | ||
310 | } | ||
311 | |||
312 | void striphtml::initentmap() | ||
313 | { | ||
314 | entmap = new QMap<QString, tchar>; | ||
315 | QString fname(QTReaderUtil::getPluginPath("data")); | ||
316 | QFileInfo fi; | ||
317 | fi.setFile(fname, "HTMLentities"); | ||
318 | if (fi.exists()) | ||
319 | { | ||
320 | fname = fi.absFilePath(); | ||
321 | |||
322 | QFile fl(fname); | ||
323 | if (fl.open(IO_ReadOnly)) | ||
324 | { | ||
325 | QTextStream t(&fl); | ||
326 | QString key, value; | ||
327 | while (!t.eof()) | ||
328 | { | ||
329 | QString data = t.readLine(); | ||
330 | int colon = data.find(':'); | ||
331 | if (colon > 0) | ||
332 | { | ||
333 | QString key = data.left(colon); | ||
334 | QString value = data.right(data.length()-colon-1); | ||
335 | bool ok; | ||
336 | int ret = value.toInt(&ok); | ||
337 | if (ok) | ||
338 | { | ||
339 | (*entmap)[key] = ret; | ||
340 | } | ||
341 | } | ||
342 | } | ||
343 | fl.close(); | ||
344 | } | ||
345 | } | ||
346 | } | ||
347 | |||
348 | unsigned short striphtml::skip_ws() | ||
349 | { | ||
350 | tchar ch; | ||
351 | CStyle sty; | ||
352 | unsigned long dummy; | ||
353 | do | ||
354 | { | ||
355 | mygetch(ch, sty, dummy); | ||
356 | } | ||
357 | while (ch < 33 && ch != UEOF); | ||
358 | return ch; | ||
359 | } | ||
360 | |||
361 | unsigned short striphtml::skip_ws_end() | ||
362 | { | ||
363 | unsigned long dummy; | ||
364 | return skip_ws_end(dummy); | ||
365 | } | ||
366 | |||
367 | unsigned short striphtml::skip_ws_end(unsigned long& pos) | ||
368 | { | ||
369 | tchar ch; | ||
370 | CStyle sty; | ||
371 | do | ||
372 | { | ||
373 | mygetch(ch, sty, pos); | ||
374 | } | ||
375 | while (ch != '>' && ch != UEOF); | ||
376 | return ch; | ||
377 | } | ||
378 | |||
379 | QString striphtml::getname(tchar& ch, const QString& nd) | ||
380 | { | ||
381 | QString nm = ""; | ||
382 | // nm += ch; | ||
383 | CStyle sty; | ||
384 | unsigned long dummy; | ||
385 | while (1) | ||
386 | { | ||
387 | // if ( QChar(ch).isLetterOrNumber() ) | ||
388 | if (ch != UEOF && nd.find(ch, 0, false) == -1 && nm.length() < 2048) | ||
389 | { | ||
390 | nm += ch; | ||
391 | } | ||
392 | else | ||
393 | { | ||
394 | break; | ||
395 | } | ||
396 | mygetch(ch, sty, dummy); | ||
397 | } | ||
398 | return nm; | ||
399 | } | ||
400 | |||
401 | QString striphtml::getattr(tchar& ch) | ||
402 | { | ||
403 | QString ref; | ||
404 | CStyle sty; | ||
405 | unsigned long pos; | ||
406 | if (ch == ' ') ch = skip_ws(); | ||
407 | if (ch == '=') | ||
408 | { | ||
409 | ch = skip_ws(); | ||
410 | if (ch == '"') | ||
411 | { | ||
412 | mygetch(ch, sty, pos); | ||
413 | ref = getname(ch, "\""); | ||
414 | ch = skip_ws(); | ||
415 | } | ||
416 | else | ||
417 | { | ||
418 | ref = getname(ch, " >"); | ||
419 | if (ch == ' ') ch = skip_ws(); | ||
420 | } | ||
421 | } | ||
422 | return ref; | ||
423 | } | ||
424 | |||
425 | linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm) | ||
426 | { | ||
427 | #if defined(USEQPE) || defined(_WINDOWS) | ||
428 | QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n); | ||
429 | #else | ||
430 | QMap<unsigned long, QString>::iterator hrefit = id2href->find(n); | ||
431 | #endif | ||
432 | if (hrefit == id2href->end()) | ||
433 | { | ||
434 | return eNone; | ||
435 | } | ||
436 | QString href = *hrefit; | ||
437 | #if defined(USEQPE) || defined(_WINDOWS) | ||
438 | QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href); | ||
439 | #else | ||
440 | QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href); | ||
441 | #endif | ||
442 | if (fpit == href2filepos->end()) | ||
443 | { | ||
444 | if (href == "history.back()") | ||
445 | { | ||
446 | QString fc = currentfile; | ||
447 | unsigned long loc; | ||
448 | htmlmark m(fc, loc); | ||
449 | linkType ret = (m_nav.back(m)) ? eFile : eNone; | ||
450 | if (fc == m.filename()) | ||
451 | { | ||
452 | if ((ret & eFile) != 0) | ||
453 | { | ||
454 | locate(m.posn()); | ||
455 | return eLink; | ||
456 | } | ||
457 | } | ||
458 | return eNone; | ||
459 | } | ||
460 | qDebug("Searching for %s", (const char*)href); | ||
461 | |||
462 | |||
463 | QString file, name; | ||
464 | |||
465 | int colon = href.find('#'); | ||
466 | if (colon >= 0) | ||
467 | { | ||
468 | file = dehtml(href.left(colon)); | ||
469 | name = dehtml(href.right(href.length()-colon-1)); | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | file = dehtml(href); | ||
474 | } | ||
475 | |||
476 | qDebug("File:%s", (const char*)file); | ||
477 | qDebug("Name:%s", (const char*)name); | ||
478 | |||
479 | |||
480 | if (file.isEmpty()) | ||
481 | { | ||
482 | fpit = href2filepos->find(name); | ||
483 | if (fpit != href2filepos->end()) | ||
484 | { | ||
485 | locate(*fpit); | ||
486 | return eLink; | ||
487 | } | ||
488 | else | ||
489 | { | ||
490 | // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\""; | ||
491 | qDebug("Do a search for:%s", (const char*)name); | ||
492 | parent->locate(0); | ||
493 | findanchor(name); | ||
494 | return eLink; | ||
495 | } | ||
496 | } | ||
497 | else | ||
498 | // if (href.find('#') == -1) | ||
499 | { | ||
500 | if (m_bchm) | ||
501 | { | ||
502 | w = "/"+file; | ||
503 | nm = name; | ||
504 | return eFile; | ||
505 | } | ||
506 | else | ||
507 | { | ||
508 | QFileInfo f(currentfile); | ||
509 | QFileInfo f1(f.dir(true), file); | ||
510 | if (f1.exists()) | ||
511 | { | ||
512 | w = f1.absFilePath(); | ||
513 | nm = name; | ||
514 | } | ||
515 | else | ||
516 | { | ||
517 | w = file; | ||
518 | } | ||
519 | return (f1.exists() ? eFile : eNone); | ||
520 | } | ||
521 | } | ||
522 | return eNone; | ||
523 | } | ||
524 | locate(*fpit); | ||
525 | // parent->locate((*href2filepos)[(*id2href)[n]]); | ||
526 | return eLink; | ||
527 | } | ||
528 | /* | ||
529 | unsigned short striphtml::parse_m() | ||
530 | { | ||
531 | tchar ch; | ||
532 | CStyle sty; | ||
533 | unsigned long dummy; | ||
534 | mygetch(ch, sty, dummy); | ||
535 | if (ch == 'm' || ch == 'M') | ||
536 | { | ||
537 | ch = skip_ws_end(); | ||
538 | if (ch == '>') | ||
539 | { | ||
540 | return 0; | ||
541 | } | ||
542 | } | ||
543 | return ch; | ||
544 | } | ||
545 | */ | ||
546 | |||
547 | void striphtml::mygetch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
548 | { | ||
549 | if (!text_q.isEmpty() && !m_inblock) | ||
550 | { | ||
551 | ch = text_q[0].unicode(); | ||
552 | text_q = text_q.right(text_q.length()-1); | ||
553 | } | ||
554 | else | ||
555 | { | ||
556 | parent->getch(ch, sty, pos); | ||
557 | if (ch == '<') | ||
558 | { | ||
559 | m_inblock = true; | ||
560 | } | ||
561 | if (ch == '>') | ||
562 | { | ||
563 | m_inblock = false; | ||
564 | } | ||
565 | } | ||
566 | if (ch == 10 && !isPre) | ||
567 | { | ||
568 | ch = ' '; | ||
569 | } | ||
570 | } | ||
571 | |||
572 | void striphtml::parse_paragraph(CStyle& currentstyle, tchar& ch, unsigned long pos) | ||
573 | { | ||
574 | /* | ||
575 | int count = 0; | ||
576 | for (CList<CStyle>::iterator iter = stylestack.begin(); iter != stylestack.end(); ++iter) | ||
577 | { | ||
578 | count++; | ||
579 | } | ||
580 | qDebug("Currently have %u styles", count); | ||
581 | */ | ||
582 | if (stylestack.isEmpty()) | ||
583 | { | ||
584 | currentstyle.unset(); | ||
585 | } | ||
586 | else | ||
587 | { | ||
588 | qDebug("Using stack style"); | ||
589 | currentstyle = stylestack.first(); | ||
590 | } | ||
591 | if (forcecentre) | ||
592 | { | ||
593 | currentstyle.setCentreJustify(); | ||
594 | } | ||
595 | if (ch == ' ') ch = skip_ws(); | ||
596 | while (ch != '>' && ch != UEOF) | ||
597 | { | ||
598 | QString ent = getname(ch, " =>").lower(); | ||
599 | QString attr = getattr(ch).lower(); | ||
600 | //qDebug("(Paragraph)Entity:%s Attr:%s", (const char*)ent, (const char*)attr); | ||
601 | if (ent == "align") | ||
602 | { | ||
603 | if (attr == "center") | ||
604 | { | ||
605 | currentstyle.setCentreJustify(); | ||
606 | } | ||
607 | if (attr == "right") | ||
608 | { | ||
609 | currentstyle.setRightJustify(); | ||
610 | } | ||
611 | } | ||
612 | if (ent == "id") | ||
613 | { | ||
614 | (*href2filepos)[attr] = pos; | ||
615 | } | ||
616 | if (ent == "bgcolor") | ||
617 | { | ||
618 | qDebug("Got paper colour:%s", (const char*)attr); | ||
619 | unsigned char r,g,b; | ||
620 | parse_color(attr, r, g, b); | ||
621 | currentstyle.setPaper(r, g, b); | ||
622 | } | ||
623 | if (ent == "color") | ||
624 | { | ||
625 | qDebug("Got foreground colour:%s", (const char*)attr); | ||
626 | unsigned char r,g,b; | ||
627 | parse_color(attr, r, g, b); | ||
628 | currentstyle.setColour(r, g, b); | ||
629 | } | ||
630 | if (ch == ' ') ch = skip_ws(); | ||
631 | } | ||
632 | ch = 10; | ||
633 | } | ||
634 | |||
635 | void striphtml::getch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
636 | { | ||
637 | currentstyle.clearPicture(); | ||
638 | if (!q.isEmpty()) | ||
639 | { | ||
640 | ch = q[0].unicode(); | ||
641 | if (ch == '-') | ||
642 | { | ||
643 | tchar w = q[1].unicode(); | ||
644 | tchar h = q[2].unicode(); | ||
645 | unsigned char r = q[3].unicode(); | ||
646 | unsigned char g = q[4].unicode(); | ||
647 | unsigned char b = q[5].unicode(); | ||
648 | ch = '#'; | ||
649 | //qDebug("html:hrule<%u, %u>", w, h); | ||
650 | currentstyle.setPicture(false, hRule(w,h,r,g,b)); | ||
651 | q = q.right(q.length()-6); | ||
652 | } | ||
653 | else | ||
654 | { | ||
655 | q = q.right(q.length()-1); | ||
656 | } | ||
657 | sty = currentstyle; | ||
658 | return; | ||
659 | } | ||
660 | do | ||
661 | { | ||
662 | unsigned long npos; | ||
663 | CStyle dummy; | ||
664 | mygetch(ch, dummy, pos); | ||
665 | // if (ch == 10 && !isPre) ch = ' '; | ||
666 | while (ch == '<' && ch != UEOF) | ||
667 | { | ||
668 | ch = skip_ws(); | ||
669 | |||
670 | QString ent = getname(ch, " >").lower(); | ||
671 | |||
672 | // qDebug("Entity:%s", (const char*)ent); | ||
673 | |||
674 | if (ent == "a"/* || ent == "reference"*/) | ||
675 | { | ||
676 | if (ch == ' ') ch = skip_ws(); | ||
677 | bool fileposfound = false; | ||
678 | bool ishref = false; | ||
679 | unsigned int filepos = 0; | ||
680 | QString ref, name; | ||
681 | while (ch != '>' && ch != UEOF) | ||
682 | { | ||
683 | QString ent = getname(ch, " =>").lower(); | ||
684 | QString attr = getattr(ch); | ||
685 | qDebug("<A>Entity:%s Attr:%s", (const char*)ent, (const char*)attr); | ||
686 | if (ent == "name") | ||
687 | { | ||
688 | name = attr; | ||
689 | } | ||
690 | if (ent == "onclick") | ||
691 | { | ||
692 | int st = attr.find('\''); | ||
693 | int nd = attr.findRev('\''); | ||
694 | ref = attr.mid(st+1, nd-st-1); | ||
695 | ishref = true; | ||
696 | qDebug("Onclick:%s", (const char*)ref); | ||
697 | } | ||
698 | if (ent == "href") | ||
699 | { | ||
700 | ishref = true; | ||
701 | ref = attr; | ||
702 | } | ||
703 | if (ent == "filepos") | ||
704 | { | ||
705 | filepos = attr.toUInt(&fileposfound); | ||
706 | if (ref.isEmpty()) | ||
707 | { | ||
708 | ishref = true; | ||
709 | ref = attr; | ||
710 | } | ||
711 | } | ||
712 | if (ent == "title") | ||
713 | { | ||
714 | text_q = attr + "</a><p>"; | ||
715 | } | ||
716 | qDebug("<a %s=%s>", (const char*)ent, (const char*)ref); | ||
717 | } | ||
718 | if (ishref) | ||
719 | { | ||
720 | currentstyle.setColour(0,0,255); | ||
721 | currentstyle.setLink(true); | ||
722 | currentstyle.setData(currentid); | ||
723 | if (!text_q.isEmpty()) | ||
724 | { | ||
725 | currentstyle.setBold(); | ||
726 | currentstyle.setCentreJustify(); | ||
727 | } | ||
728 | (*id2href)[currentid] = ref; | ||
729 | currentid++; | ||
730 | |||
731 | |||
732 | if (fileposfound) | ||
733 | { | ||
734 | (*href2filepos)[ref] = filepos; | ||
735 | } | ||
736 | } | ||
737 | if (!name.isEmpty()) | ||
738 | { | ||
739 | (*href2filepos)[name] = pos; | ||
740 | } | ||
741 | } | ||
742 | else if (ent == "p") | ||
743 | { | ||
744 | parse_paragraph(currentstyle, ch, pos); | ||
745 | currentstyle.setExtraSpace(3); | ||
746 | continue; | ||
747 | } | ||
748 | else if (ent == "div") | ||
749 | { | ||
750 | parse_paragraph(currentstyle, ch, pos); | ||
751 | stylestack.push_front(currentstyle); | ||
752 | //indent = 0; | ||
753 | continue; | ||
754 | } | ||
755 | else if (ent == "sup") | ||
756 | { | ||
757 | currentstyle.setVOffset(-1); | ||
758 | } | ||
759 | else if (ent == "sup") | ||
760 | { | ||
761 | currentstyle.setVOffset(1); | ||
762 | } | ||
763 | else if (ent == "/sup" || ent == "/sub") | ||
764 | { | ||
765 | currentstyle.setVOffset(0); | ||
766 | } | ||
767 | else if (ent == "span") | ||
768 | { | ||
769 | if (ch == ' ') ch = skip_ws(); | ||
770 | while (ch != '>' && ch != UEOF) | ||
771 | { | ||
772 | QString ent = getname(ch, " =>").lower(); | ||
773 | QString attr = getattr(ch).lower(); | ||
774 | if (ent == "bgcolor") | ||
775 | { | ||
776 | qDebug("Got background colour:%s", (const char*)attr); | ||
777 | unsigned char r,g,b; | ||
778 | parse_color(attr, r, g, b); | ||
779 | currentstyle.setBackground(r, g, b); | ||
780 | } | ||
781 | if (ent == "color") | ||
782 | { | ||
783 | qDebug("Got foreground colour:%s", (const char*)attr); | ||
784 | unsigned char r,g,b; | ||
785 | parse_color(attr, r, g, b); | ||
786 | currentstyle.setColour(r, g, b); | ||
787 | } | ||
788 | } | ||
789 | stylestack.push_front(currentstyle); | ||
790 | } | ||
791 | else if (ent == "/span") | ||
792 | { | ||
793 | if (ch != '>') ch = skip_ws_end(); | ||
794 | currentstyle.setBackground(255, 255, 255); | ||
795 | currentstyle.setColour(0, 0, 0); | ||
796 | if (!stylestack.isEmpty()) | ||
797 | { | ||
798 | stylestack.pop(); | ||
799 | } | ||
800 | } | ||
801 | else if (ent == "pre") | ||
802 | { | ||
803 | isPre = true; | ||
804 | currentstyle.setMono(); | ||
805 | } | ||
806 | else if (ent == "tt") | ||
807 | { | ||
808 | currentstyle.setMono(); | ||
809 | } | ||
810 | else if (ent == "b" || ent == "strong") | ||
811 | { | ||
812 | currentstyle.setBold(); | ||
813 | } | ||
814 | else if (ent == "u") | ||
815 | { | ||
816 | currentstyle.setUnderline(); | ||
817 | } | ||
818 | else if (ent == "/u") | ||
819 | { | ||
820 | currentstyle.unsetUnderline(); | ||
821 | } | ||
822 | else if (ent == "blockquote") | ||
823 | { | ||
824 | if (ch != '>') ch = skip_ws_end(); | ||
825 | ch = 10; | ||
826 | currentstyle.setLeftMargin(30); | ||
827 | currentstyle.setRightMargin(30); | ||
828 | continue; | ||
829 | } | ||
830 | else if (ent == "br" || ent == "br/") | ||
831 | { | ||
832 | if (ch != '>') ch = skip_ws_end(); | ||
833 | ch = 10; | ||
834 | continue; | ||
835 | } | ||
836 | else if (ent == "mbp:pagebreak") | ||
837 | { | ||
838 | /* | ||
839 | if (ch != '>') ch = skip_ws_end(pos); | ||
840 | q += 10; | ||
841 | q += QChar(UEOF); | ||
842 | ch = 10; | ||
843 | continue; | ||
844 | */ | ||
845 | ch = 6; | ||
846 | // currentstyle.setTop(); | ||
847 | continue; | ||
848 | } | ||
849 | else if (ent == "center") | ||
850 | { | ||
851 | //forcecentre = true; | ||
852 | qDebug("setting centre"); | ||
853 | currentstyle.setCentreJustify(); | ||
854 | ch = 10; | ||
855 | continue; | ||
856 | } | ||
857 | else if (ent == "/center") | ||
858 | { | ||
859 | qDebug("unsetting centre"); | ||
860 | forcecentre = false; | ||
861 | } | ||
862 | else if (ent == "li") | ||
863 | { | ||
864 | if (ch != '>') ch = skip_ws_end(); | ||
865 | ch = 10; | ||
866 | if (m_listtype[indent % m_cmaxdepth] == 1) | ||
867 | { | ||
868 | q.setNum(m_ctr[indent % m_cmaxdepth]++); | ||
869 | } | ||
870 | else | ||
871 | { | ||
872 | q += QChar(8226); | ||
873 | } | ||
874 | q += ' '; | ||
875 | currentstyle.setLeftMargin(6*indent); | ||
876 | qDebug("Setting indent:%d", indent); | ||
877 | continue; | ||
878 | } | ||
879 | else if (ent == "ul") | ||
880 | { | ||
881 | indent++; | ||
882 | m_listtype[indent % m_cmaxdepth] = 0; | ||
883 | } | ||
884 | else if (ent == "/ul") | ||
885 | { | ||
886 | indent--; | ||
887 | } | ||
888 | else if (ent == "ol") | ||
889 | { | ||
890 | indent++; | ||
891 | m_listtype[indent % m_cmaxdepth] = 1; | ||
892 | m_ctr[indent % m_cmaxdepth] = 1; | ||
893 | } | ||
894 | else if (ent == "/ol") | ||
895 | { | ||
896 | indent--; | ||
897 | } | ||
898 | else if (ent == "i") | ||
899 | { | ||
900 | currentstyle.setItalic(); | ||
901 | } | ||
902 | else if (ent == "em") | ||
903 | { | ||
904 | currentstyle.setItalic(); | ||
905 | } | ||
906 | else if (ent == "small") | ||
907 | { | ||
908 | currentstyle.setFontSize(-2); | ||
909 | } | ||
910 | else if (ent == "/small") | ||
911 | { | ||
912 | currentstyle.setFontSize(0); | ||
913 | } | ||
914 | else if (ent == "big") | ||
915 | { | ||
916 | currentstyle.setFontSize(2); | ||
917 | } | ||
918 | else if (ent == "/big") | ||
919 | { | ||
920 | currentstyle.setFontSize(0); | ||
921 | } | ||
922 | else if (ent[0] == 'h' && ent.length() == 2 && QString("123456789").find(ent[1]) != -1) | ||
923 | { | ||
924 | indent = 0; | ||
925 | if (ent[1] == '1') | ||
926 | { | ||
927 | parse_paragraph(currentstyle, ch, pos); | ||
928 | currentstyle.setFontSize(3); | ||
929 | currentstyle.setExtraSpace(8); | ||
930 | currentstyle.setBold(); | ||
931 | // currentstyle.setExtraSpace(10); | ||
932 | continue; | ||
933 | } | ||
934 | else if (ent[1] == '2') | ||
935 | { | ||
936 | parse_paragraph(currentstyle, ch, pos); | ||
937 | currentstyle.setFontSize(2); | ||
938 | currentstyle.setExtraSpace(6); | ||
939 | currentstyle.setBold(); | ||
940 | // currentstyle.setExtraSpace(10); | ||
941 | continue; | ||
942 | } | ||
943 | else if (ent[1] == '3') | ||
944 | { | ||
945 | parse_paragraph(currentstyle, ch, pos); | ||
946 | currentstyle.setFontSize(1); | ||
947 | currentstyle.setExtraSpace(4); | ||
948 | currentstyle.setBold(); | ||
949 | // currentstyle.setExtraSpace(10); | ||
950 | continue; | ||
951 | } | ||
952 | else | ||
953 | { | ||
954 | parse_paragraph(currentstyle, ch, pos); | ||
955 | currentstyle.setExtraSpace(4); | ||
956 | currentstyle.setBold(); | ||
957 | // currentstyle.setExtraSpace(10); | ||
958 | continue; | ||
959 | } | ||
960 | } | ||
961 | |||
962 | |||
963 | else if (ent == "/a") | ||
964 | { | ||
965 | currentstyle.setColour(0,0,0); | ||
966 | currentstyle.setLink(false); | ||
967 | } | ||
968 | else if (ent == "/pre") | ||
969 | { | ||
970 | currentstyle.unsetMono(); | ||
971 | isPre = false; | ||
972 | } | ||
973 | else if (ent == "/tt") | ||
974 | { | ||
975 | currentstyle.unsetMono(); | ||
976 | } | ||
977 | else if (ent == "/b" || ent == "/strong") | ||
978 | { | ||
979 | currentstyle.unsetBold(); | ||
980 | } | ||
981 | else if (ent == "/i") | ||
982 | { | ||
983 | currentstyle.unsetItalic(); | ||
984 | } | ||
985 | else if (ent == "/em") | ||
986 | { | ||
987 | currentstyle.unsetItalic(); | ||
988 | } | ||
989 | else if (ent == "/div") | ||
990 | { | ||
991 | currentstyle.unset(); | ||
992 | if (ch != '>') ch = skip_ws_end(); | ||
993 | ch = 10; | ||
994 | if (!stylestack.isEmpty()) | ||
995 | { | ||
996 | stylestack.pop(); | ||
997 | } | ||
998 | continue; | ||
999 | } | ||
1000 | else if (ent == "tr") | ||
1001 | { | ||
1002 | if (ch != '>') ch = skip_ws_end(); | ||
1003 | ch = 10; | ||
1004 | q += '-'; | ||
1005 | q += QChar(parent->getwidth()); | ||
1006 | q += 2; | ||
1007 | q += '\0'; | ||
1008 | q += '\0'; | ||
1009 | q += '\0'; | ||
1010 | continue; | ||
1011 | } | ||
1012 | else if (ent == "td") | ||
1013 | { | ||
1014 | if (ch != '>') ch = skip_ws_end(); | ||
1015 | ignorespace = false; | ||
1016 | } | ||
1017 | else if (ent == "/td") | ||
1018 | { | ||
1019 | ignorespace = true; | ||
1020 | // parse_paragraph(currentstyle, ch, pos); | ||
1021 | //stylestack.push_front(currentstyle); | ||
1022 | if (ch != '>') ch = skip_ws_end(); | ||
1023 | // ch = '|'; | ||
1024 | //continue; | ||
1025 | ch = 10; | ||
1026 | q += '-'; | ||
1027 | q += QChar(parent->getwidth()); | ||
1028 | q += 1; | ||
1029 | q += '\0'; | ||
1030 | q += '\0'; | ||
1031 | q += '\0'; | ||
1032 | continue; | ||
1033 | } | ||
1034 | /* | ||
1035 | else if (ent == "/td") | ||
1036 | { | ||
1037 | currentstyle.unset(); | ||
1038 | if (ch != '>') ch = skip_ws_end(); | ||
1039 | if (!stylestack.isEmpty()) | ||
1040 | { | ||
1041 | stylestack.pop(); | ||
1042 | } | ||
1043 | // ch = 10; | ||
1044 | continue; | ||
1045 | } | ||
1046 | */ | ||
1047 | else if (ent[0] == '/' && ent.length() == 3 && ent[1] == 'h' && QString("123456789").find(ent[2]) != -1) | ||
1048 | { | ||
1049 | currentstyle.unset(); | ||
1050 | if (ch != '>') ch = skip_ws_end(); | ||
1051 | ch = 10; | ||
1052 | continue; | ||
1053 | } | ||
1054 | |||
1055 | |||
1056 | |||
1057 | else if (ent == "table" || ent == "/table") | ||
1058 | { | ||
1059 | currentstyle.unset(); | ||
1060 | ignorespace = (ent == "table"); | ||
1061 | if (ch == ' ') ch = skip_ws(); | ||
1062 | while (ch != '>' && ch != UEOF) | ||
1063 | { | ||
1064 | QString ent = getname(ch, " =>").lower(); | ||
1065 | QString attr = getattr(ch); | ||
1066 | qDebug("<table>Entity:%s Attr:%s", (const char*)ent, (const char*)attr); | ||
1067 | } | ||
1068 | if (ch != '>') ch = skip_ws_end(); | ||
1069 | |||
1070 | ch = 10; | ||
1071 | q += '-'; | ||
1072 | q += QChar(parent->getwidth()); | ||
1073 | q += 2; | ||
1074 | q += '\0'; | ||
1075 | q += '\0'; | ||
1076 | q += '\0'; | ||
1077 | continue; | ||
1078 | } | ||
1079 | else if (ent == "hr") | ||
1080 | { | ||
1081 | if (ch == ' ') ch = skip_ws(); | ||
1082 | // if (stylestack.isEmpty()) | ||
1083 | // { | ||
1084 | currentstyle.unset(); | ||
1085 | // } | ||
1086 | /* | ||
1087 | else | ||
1088 | { | ||
1089 | qDebug("Using stack style"); | ||
1090 | currentstyle = stylestack.first(); | ||
1091 | } | ||
1092 | */ | ||
1093 | unsigned char red = 0, green = 0, blue = 0; | ||
1094 | while (ch != '>' && ch != UEOF) | ||
1095 | { | ||
1096 | QString ent = getname(ch, " =>").lower(); | ||
1097 | QString attr = getattr(ch); | ||
1098 | if (ent == "color") | ||
1099 | { | ||
1100 | parse_color(attr, red, green, blue); | ||
1101 | } | ||
1102 | qDebug("<hr>Entity:%s Attr:%s", (const char*)ent, (const char*)attr); | ||
1103 | } | ||
1104 | if (ch != '>') ch = skip_ws_end(); | ||
1105 | ch = 10; | ||
1106 | q += '-'; | ||
1107 | q += QChar(parent->getwidth()); | ||
1108 | q += 3; | ||
1109 | q += red; | ||
1110 | q += green; | ||
1111 | q += blue; | ||
1112 | continue; | ||
1113 | } | ||
1114 | |||
1115 | |||
1116 | |||
1117 | else if (ent == "img") | ||
1118 | { | ||
1119 | if (ch == ' ') ch = skip_ws(); | ||
1120 | while (ch != '>' && ch != UEOF) | ||
1121 | { | ||
1122 | QString ent = getname(ch, " =>").lower(); | ||
1123 | QString attr = getattr(ch); | ||
1124 | qDebug("<img>Entity:%s Attr:%s", (const char*)ent, (const char*)attr); | ||
1125 | if (ent == "src") | ||
1126 | { | ||
1127 | if (m_bchm) | ||
1128 | { | ||
1129 | QImage* img = parent->getPicture(attr); | ||
1130 | if (img != NULL) | ||
1131 | { | ||
1132 | currentstyle.setPicture(true, img); | ||
1133 | } | ||
1134 | } | ||
1135 | else | ||
1136 | { | ||
1137 | QFileInfo f(currentfile); | ||
1138 | QFileInfo f1(f.dir(true), attr); | ||
1139 | QPixmap pm; | ||
1140 | if (pm.load(f1.absFilePath())) | ||
1141 | { | ||
1142 | QImage* img = new QImage(pm.convertToImage()); | ||
1143 | currentstyle.setPicture(true, img); | ||
1144 | } | ||
1145 | } | ||
1146 | } | ||
1147 | if (ent == "recindex") | ||
1148 | { | ||
1149 | bool ok; | ||
1150 | unsigned int picindex = attr.toUInt(&ok); | ||
1151 | qDebug("Looking for image at %u", picindex); | ||
1152 | QImage* img = parent->getPicture(picindex); | ||
1153 | if (img != NULL) | ||
1154 | { | ||
1155 | currentstyle.setPicture(true, img); | ||
1156 | } | ||
1157 | else | ||
1158 | { | ||
1159 | qDebug("No image found"); | ||
1160 | } | ||
1161 | } | ||
1162 | } | ||
1163 | if (ch != '>') ch = skip_ws_end(); | ||
1164 | ch = '#'; | ||
1165 | break; | ||
1166 | } | ||
1167 | else if (ent.left(2) == "dc") | ||
1168 | { | ||
1169 | QString nd("/"); | ||
1170 | skipblock(nd+ent); | ||
1171 | } | ||
1172 | else if (ent == "metadata") | ||
1173 | { | ||
1174 | // skipblock("/metadata"); | ||
1175 | } | ||
1176 | /* | ||
1177 | else if (ent == "metadata") | ||
1178 | { | ||
1179 | currentstyle.setFontSize(-2); | ||
1180 | } | ||
1181 | else if (ent == "/metadata") | ||
1182 | { | ||
1183 | currentstyle.unset(); | ||
1184 | ch = 10; | ||
1185 | continue; | ||
1186 | } | ||
1187 | */ | ||
1188 | else | ||
1189 | { | ||
1190 | if (ent[0] != '/') | ||
1191 | qDebug("Not handling:%s", (const char*)ent); | ||
1192 | } | ||
1193 | |||
1194 | if (ch != '>') ch = skip_ws_end(); | ||
1195 | mygetch(ch, dummy, npos); | ||
1196 | } | ||
1197 | if (ch == '&') | ||
1198 | { | ||
1199 | mygetch(ch, dummy, npos); | ||
1200 | if (ch == '#') | ||
1201 | { | ||
1202 | int id = 0; | ||
1203 | mygetch(ch, dummy, npos); | ||
1204 | while (ch != ';' && ch != UEOF) | ||
1205 | { | ||
1206 | id = 10*id+ch-'0'; | ||
1207 | mygetch(ch, dummy, npos); | ||
1208 | } | ||
1209 | ch = id; | ||
1210 | } | ||
1211 | else | ||
1212 | { | ||
1213 | QString en; | ||
1214 | en += ch; | ||
1215 | mygetch(ch, dummy, npos); | ||
1216 | while (ch != ';' && ch != UEOF) | ||
1217 | { | ||
1218 | en += ch; | ||
1219 | mygetch(ch, dummy, npos); | ||
1220 | } | ||
1221 | if (entmap == NULL) initentmap(); | ||
1222 | #if defined(USEQPE) || defined(_WINDOWS) | ||
1223 | QMap<QString, tchar>::Iterator it = entmap->find(en); | ||
1224 | #else | ||
1225 | QMap<QString, tchar>::iterator it = entmap->find(en); | ||
1226 | #endif | ||
1227 | if (it != entmap->end()) | ||
1228 | { | ||
1229 | ch = *it; | ||
1230 | } | ||
1231 | else | ||
1232 | { | ||
1233 | ch = '.'; | ||
1234 | } | ||
1235 | } | ||
1236 | } | ||
1237 | // sty = (dummy == ucFontBase) ? currentstyle : dummy; | ||
1238 | sty = currentstyle; | ||
1239 | } | ||
1240 | while (!isPre && (lastch == ' ' || lastch == 10 || ignorespace) && ch == ' '); | ||
1241 | // lastch = ch; | ||
1242 | lastch = ch; | ||
1243 | return; | ||
1244 | } | ||
1245 | |||
1246 | extern "C" | ||
1247 | { | ||
1248 | CFilter* newfilter(const QString& s) { return new striphtml(s); } | ||
1249 | } | ||
diff --git a/noncore/apps/opie-reader/striphtml.h b/noncore/apps/opie-reader/striphtml.h new file mode 100644 index 0000000..42e2b7e --- a/dev/null +++ b/noncore/apps/opie-reader/striphtml.h | |||
@@ -0,0 +1,93 @@ | |||
1 | #ifndef __STRIPHTML_H | ||
2 | #define __STRIPHTML_H | ||
3 | |||
4 | #include "CFilter.h" | ||
5 | #include "Navigation.h" | ||
6 | #include "CBuffer.h" | ||
7 | #include "CExpander.h" | ||
8 | #include "my_list.h" | ||
9 | |||
10 | class striphtml : public CFilter | ||
11 | { | ||
12 | bool ignorespace; | ||
13 | bool m_bchm; | ||
14 | CList<CStyle> stylestack; | ||
15 | static CNavigation_base<htmlmark> m_nav; | ||
16 | QMap<QString, tchar>* entmap; | ||
17 | CStyle currentstyle; | ||
18 | bool isPre; | ||
19 | unsigned short skip_ws(); | ||
20 | unsigned short skip_ws_end(); | ||
21 | unsigned short skip_ws_end(unsigned long&); | ||
22 | unsigned short parse_m(); | ||
23 | QMap<QString, unsigned long>* href2filepos; | ||
24 | QMap<unsigned long, QString>* id2href; | ||
25 | unsigned long currentid; | ||
26 | tchar lastch; | ||
27 | QString currentfile; | ||
28 | QString q; | ||
29 | bool forcecentre, m_inblock; | ||
30 | QString text_q; | ||
31 | int indent; | ||
32 | int m_listtype[m_cmaxdepth]; | ||
33 | int m_ctr[m_cmaxdepth]; | ||
34 | void mygetch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
35 | void initentmap(); | ||
36 | QString getname(tchar& ch, const QString& nd); | ||
37 | void skipblock(const QString&); | ||
38 | QString getattr(tchar&); | ||
39 | QString dehtml(const QString& _info); | ||
40 | void parse_paragraph(CStyle& currentstyle, tchar& ch, unsigned long); | ||
41 | int getpara(CBuffer&, unsigned long&); | ||
42 | public: | ||
43 | QString about() { return QString("HTML filter (c) Tim Wentford\n")+parent->about(); } | ||
44 | striphtml(const QString&); | ||
45 | ~striphtml(); | ||
46 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
47 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm); | ||
48 | bool findanchor(const QString&); | ||
49 | |||
50 | |||
51 | void saveposn(const QString& f, size_t posn) { m_nav.saveposn(htmlmark(f, posn)); } | ||
52 | void writeposn(const QString& f, size_t posn) { m_nav.writeposn(htmlmark(f, posn)); } | ||
53 | linkType forward(QString& f, size_t& loc) | ||
54 | { | ||
55 | htmlmark m(f, loc); | ||
56 | linkType ret = (m_nav.forward(m)) ? eFile : eNone; | ||
57 | if (f == m.filename()) | ||
58 | { | ||
59 | if (ret == eFile) | ||
60 | { | ||
61 | ret = eLink; | ||
62 | } | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | f = m.filename(); | ||
67 | } | ||
68 | loc = m.posn(); | ||
69 | return ret; | ||
70 | } | ||
71 | linkType back(QString& f, size_t& loc) | ||
72 | { | ||
73 | htmlmark m(f, loc); | ||
74 | linkType ret = (m_nav.back(m)) ? eFile : eNone; | ||
75 | if (f == m.filename()) | ||
76 | { | ||
77 | if (ret == eFile) | ||
78 | { | ||
79 | ret = eLink; | ||
80 | } | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | f = m.filename(); | ||
85 | } | ||
86 | loc = m.posn(); | ||
87 | return ret; | ||
88 | } | ||
89 | bool hasnavigation() { return true; } | ||
90 | virtual void locate(unsigned int n); | ||
91 | void setchm(bool _b) { m_bchm = _b; } | ||
92 | }; | ||
93 | #endif | ||
diff --git a/noncore/apps/opie-reader/update-gcc3.sh b/noncore/apps/opie-reader/update-gcc3.sh new file mode 100755 index 0000000..f604e42 --- a/dev/null +++ b/noncore/apps/opie-reader/update-gcc3.sh | |||
@@ -0,0 +1,47 @@ | |||
1 | #!/bin/bash | ||
2 | touch infowin.cpp | ||
3 | for f in *lib.omak; do make -f $f; done | ||
4 | for f in *.omak; do make -f $f; done | ||
5 | for f in *.omak; do make -f $f; done | ||
6 | cp /home/tim/codecreader/opie-reader.desktop $QTDIR/apps/Applications/ | ||
7 | cp /home/tim/codecreader/pics/* $QTDIR/pics/opie-reader/ | ||
8 | cp /home/tim/codecreader/opie-pics/* $QTDIR/pics/opie-reader/ | ||
9 | cp HTMLentities $QTDIR/plugins/reader/data/ | ||
10 | rm $QTDIR/help/html/*reader*.html | ||
11 | cp /home/tim/codecreader/help/*.html $QTDIR/help/html/ | ||
12 | rm $QTDIR/help/html/*reader*.html | ||
13 | cp /home/tim/codecreader/help/*.html $QTDIR/help/html/ | ||
14 | rm -f $QTDIR/lib/libreader*.so | ||
15 | rm -f $QTDIR/lib/libreader*.so.1 | ||
16 | for f in $QTDIR/lib/libreader*.1.0.0 ; do mv -f $f $QTDIR/lib/`basename $f .1.0.0`.1 ; done | ||
17 | rm -f $QTDIR/lib/libreader*.so.1.* | ||
18 | |||
19 | /home/tim/bin/zstrip.sh $QTDIR/bin/reader | ||
20 | for f in $QTDIR/lib/libreader* ; do /home/tim/bin/zstrip.sh $f; done | ||
21 | |||
22 | for SUBDIR in codecs support filters | ||
23 | do | ||
24 | CDIR=$QTDIR/plugins/reader/$SUBDIR | ||
25 | rm -f $CDIR/*.so | ||
26 | for f in $CDIR/*.1.0.0 ; do mv -f $f $CDIR/`basename $f .1.0.0` ; done | ||
27 | rm -f $CDIR/*.so.* | ||
28 | for f in $CDIR/*.so ; do /home/tim/bin/zstrip.sh $f ; done | ||
29 | done | ||
30 | rm -f opie-reader-gcc3_*.ipk | ||
31 | rm -f full/opie-reader-gcc3_*.ipk | ||
32 | rm -f partial/opie-reader-gcc3_*.ipk | ||
33 | mkipks opie-reader-gcc3.control | ||
34 | cp opie-reader-gcc3_*.ipk full/ | ||
35 | for f in opie-reader-gcc3_*.ipk | ||
36 | do | ||
37 | cp $f full/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk | ||
38 | done | ||
39 | rm $QTDIR/plugins/reader/support/libpluckerdecompress.so | ||
40 | rm $QTDIR/plugins/reader/codecs/libArriereGo.so | ||
41 | rm $QTDIR/plugins/reader/codecs/libNEF.so | ||
42 | mkipks opie-reader-gcc3.control | ||
43 | cp opie-reader-gcc3_*.ipk partial/ | ||
44 | for f in opie-reader-gcc3_*.ipk | ||
45 | do | ||
46 | cp $f partial/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk | ||
47 | done | ||
diff --git a/noncore/apps/opie-reader/update-opie.sh b/noncore/apps/opie-reader/update-opie.sh new file mode 100755 index 0000000..261ef46 --- a/dev/null +++ b/noncore/apps/opie-reader/update-opie.sh | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/bin/bash | ||
2 | touch infowin.cpp | ||
3 | for f in *lib.zmak; do make -f $f; done | ||
4 | for f in *.zmak; do make -f $f; done | ||
5 | for f in *.zmak; do make -f $f; done | ||
6 | cp /home/tim/codecreader/pics/* $QTDIR/pics/opie-reader/ | ||
7 | cp /home/tim/codecreader/opie-pics/* $QTDIR/pics/opie-reader/ | ||
8 | cp HTMLentities $QTDIR/plugins/reader/data/ | ||
9 | rm $QTDIR/help/html/*reader*.html | ||
10 | cp /home/tim/codecreader/help/*.html $QTDIR/help/html/ | ||
11 | rm -f $QTDIR/lib/libreader*.so | ||
12 | rm -f $QTDIR/lib/libreader*.so.1 | ||
13 | for f in $QTDIR/lib/libreader*.1.0.0 ; do mv -f $f $QTDIR/lib/`basename $f .1.0.0`.1 ; done | ||
14 | rm -f $QTDIR/lib/libreader*.so.1.* | ||
15 | |||
16 | /home/tim/bin/zstrip.sh $QTDIR/bin/uqtreader | ||
17 | rm -f $QTDIR/bin/reader | ||
18 | mv $QTDIR/bin/uqtreader $QTDIR/bin/reader | ||
19 | for f in $QTDIR/lib/libreader* ; do /home/tim/bin/zstrip.sh $f; done | ||
20 | for SUBDIR in codecs support filters | ||
21 | do | ||
22 | CDIR=$QTDIR/plugins/reader/$SUBDIR | ||
23 | rm -f $CDIR/*.so | ||
24 | for f in $CDIR/*.1.0.0 ; do mv -f $f $CDIR/`basename $f .1.0.0` ; done | ||
25 | rm -f $CDIR/*.so.* | ||
26 | for f in $CDIR/*.so ; do zstrip.sh $f ; done | ||
27 | done | ||
28 | rm -f opie-reader-opie_*.ipk | ||
29 | rm -f full/opie-reader-opie_*.ipk | ||
30 | rm -f partial/opie-reader-opie_*.ipk | ||
31 | mkipks opie-reader-opie.control | ||
32 | cp opie-reader-opie_*.ipk full/ | ||
33 | for f in opie-reader-opie_*.ipk | ||
34 | do | ||
35 | cp $f full/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk | ||
36 | done | ||
37 | rm $QTDIR/plugins/reader/support/libpluckerdecompress.so | ||
38 | rm $QTDIR/plugins/reader/codecs/libArriereGo.so | ||
39 | rm $QTDIR/plugins/reader/codecs/libNEF.so | ||
40 | mkipks opie-reader-opie.control | ||
41 | cp opie-reader-opie_*.ipk partial/ | ||
42 | for f in opie-reader-opie_*.ipk | ||
43 | do | ||
44 | cp $f partial/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk | ||
45 | done | ||
diff --git a/noncore/apps/opie-reader/update.sh b/noncore/apps/opie-reader/update.sh index 05dc175..61b8a5e 100755 --- a/noncore/apps/opie-reader/update.sh +++ b/noncore/apps/opie-reader/update.sh | |||
@@ -1,11 +1,47 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | cp /home/tim/uqtreader/uqtreader.desktop /opt/Qtopia/apps/Applications/ | 2 | touch infowin.cpp |
3 | cp /home/tim/bin/uqtreader /opt/Qtopia/bin/ | 3 | for f in *lib.zmak; do make -f $f; done |
4 | cp /home/tim/uqtreader/uqtreader.png /opt/Qtopia/pics/ | 4 | for f in *.zmak; do make -f $f; done |
5 | cp /home/tim/qtreader/panel-arrow-down.png /opt/Qtopia/pics/ | 5 | for f in *.zmak; do make -f $f; done |
6 | cp /home/tim/uqtreader/uqtreader.desktop /opt/Qtopia/sharp/apps/Applications/ | 6 | cp /home/tim/codecreader/uqtreader*.desktop /opt/Qtopia/apps/Applications/ |
7 | cp /home/tim/bin/uqtreader /opt/Qtopia/sharp/bin/ | 7 | cp /home/tim/codecreader/pics/* /opt/Qtopia/pics/opie-reader/ |
8 | cp /home/tim/uqtreader/uqtreader.png /opt/Qtopia/sharp/pics/ | 8 | cp /home/tim/codecreader/uqtreader*.desktop $QTDIR/apps/Applications/ |
9 | cp /home/tim/qtreader/panel-arrow-down.png /opt/Qtopia/sharp/pics/ | 9 | cp /home/tim/codecreader/opie-reader.desktop $QTDIR/apps/Applications/ |
10 | #source /home/tim/bin/setz.sh | 10 | cp /home/tim/codecreader/pics/* $QTDIR/pics/opie-reader/ |
11 | #mkipks qpe-qtreader.control | 11 | cp HTMLentities $QTDIR/plugins/reader/data/ |
12 | rm $QTDIR/help/html/*reader*.html | ||
13 | cp /home/tim/codecreader/help/*.html $QTDIR/help/html/ | ||
14 | rm -f $QTDIR/lib/libreader*.so | ||
15 | rm -f $QTDIR/lib/libreader*.so.1 | ||
16 | for f in $QTDIR/lib/libreader*.1.0.0 ; do mv -f $f $QTDIR/lib/`basename $f .1.0.0`.1 ; done | ||
17 | rm -f $QTDIR/lib/libreader*.so.1.* | ||
18 | |||
19 | /home/tim/bin/zstrip.sh $QTDIR/bin/uqtreader | ||
20 | for f in $QTDIR/lib/libreader* ; do /home/tim/bin/zstrip.sh $f; done | ||
21 | |||
22 | for SUBDIR in codecs support filters | ||
23 | do | ||
24 | CDIR=$QTDIR/plugins/reader/$SUBDIR | ||
25 | rm -f $CDIR/*.so | ||
26 | for f in $CDIR/*.1.0.0 ; do mv -f $f $CDIR/`basename $f .1.0.0` ; done | ||
27 | rm -f $CDIR/*.so.* | ||
28 | for f in $CDIR/*.so ; do /home/tim/bin/zstrip.sh $f ; done | ||
29 | done | ||
30 | rm -f opie-reader_*.ipk | ||
31 | rm -f full/opie-reader_*.ipk | ||
32 | rm -f partial/opie-reader_*.ipk | ||
33 | mkipks opie-reader.control | ||
34 | cp opie-reader_*.ipk full/ | ||
35 | for f in opie-reader_*.ipk | ||
36 | do | ||
37 | cp $f full/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk | ||
38 | done | ||
39 | rm $QTDIR/plugins/reader/support/libpluckerdecompress.so | ||
40 | rm $QTDIR/plugins/reader/codecs/libArriereGo.so | ||
41 | rm $QTDIR/plugins/reader/codecs/libNEF.so | ||
42 | mkipks opie-reader.control | ||
43 | cp opie-reader_*.ipk partial/ | ||
44 | for f in opie-reader_*.ipk | ||
45 | do | ||
46 | cp $f partial/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk | ||
47 | done | ||
diff --git a/noncore/apps/opie-reader/useqpe.h b/noncore/apps/opie-reader/useqpe.h deleted file mode 100644 index 1fc39de..0000000 --- a/noncore/apps/opie-reader/useqpe.h +++ b/dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #ifndef USEQPE | ||
2 | #define USEQPE | ||
3 | #endif | ||
diff --git a/noncore/apps/opie-reader/util.cpp b/noncore/apps/opie-reader/util.cpp new file mode 100644 index 0000000..a736f8b --- a/dev/null +++ b/noncore/apps/opie-reader/util.cpp | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "util.h" | ||
2 | |||
3 | QString filesize(unsigned long l) | ||
4 | { | ||
5 | char units[] = { 'K', 'M', 'G' }; | ||
6 | int iu = 0; | ||
7 | while (l > 999 && iu < sizeof(units)) | ||
8 | { | ||
9 | l = (l+512)/1024; | ||
10 | iu++; | ||
11 | } | ||
12 | QString ret = QString::number(l); | ||
13 | if (iu != 0) | ||
14 | { | ||
15 | ret += QChar(units[iu-1]); | ||
16 | } | ||
17 | return ret; | ||
18 | } | ||
19 | |||
20 | QString percent(unsigned long pos, unsigned long len) | ||
21 | { | ||
22 | unsigned long permil = 0; | ||
23 | if (len != 0) | ||
24 | { | ||
25 | permil = (1000*pos+len/2)/len; | ||
26 | } | ||
27 | unsigned long percen = permil/10; | ||
28 | unsigned long frac = permil - 10*percen; | ||
29 | return QString::number(percen) + "." + QString::number(frac); | ||
30 | } | ||
31 | |||
32 | QString fmt(unsigned long pos, unsigned long len) | ||
33 | { | ||
34 | QString ret = filesize(pos) + "/" + filesize(len) + " : " + percent(pos,len) +"%"; | ||
35 | return ret; | ||
36 | } | ||
diff --git a/noncore/apps/opie-reader/util.h b/noncore/apps/opie-reader/util.h new file mode 100644 index 0000000..f831ead --- a/dev/null +++ b/noncore/apps/opie-reader/util.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef __UTIL_H | ||
2 | #define __UTIL_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <qdir.h> | ||
6 | #include <stdlib.h> | ||
7 | |||
8 | QString filesize(unsigned long l); | ||
9 | QString percent(unsigned long pos, unsigned long len); | ||
10 | QString fmt(unsigned long pos, unsigned long len); | ||
11 | |||
12 | /** | ||
13 | * class with utility inline function(s) | ||
14 | * (in contrast to global functions they become available by just | ||
15 | * including util.h) | ||
16 | */ | ||
17 | class QTReaderUtil | ||
18 | { | ||
19 | public: | ||
20 | |||
21 | /** | ||
22 | * searches for a specific direcory inside OpieReader installation | ||
23 | * | ||
24 | * @param subdir name of sub directory inside installation directory which is needed | ||
25 | * @return full path name including that sub directory | ||
26 | * | ||
27 | * search order is (on all platforms): | ||
28 | * - OPIEDIR | ||
29 | * - QTDIR | ||
30 | * - READERDIR | ||
31 | */ | ||
32 | static QString getPluginPath( const char *subdir = "codecs/" ) | ||
33 | { | ||
34 | QString dirname; | ||
35 | dirname = getenv("OPIEDIR"); | ||
36 | dirname += "/plugins/reader/"; | ||
37 | dirname += subdir; | ||
38 | if (QDir(dirname).exists()) | ||
39 | return dirname; | ||
40 | |||
41 | dirname = getenv("QTDIR"); | ||
42 | dirname += "/plugins/reader/"; | ||
43 | dirname += subdir; | ||
44 | if (QDir(dirname).exists()) | ||
45 | return dirname; | ||
46 | |||
47 | dirname = getenv("READERDIR"); | ||
48 | dirname += "/"; | ||
49 | dirname += subdir; | ||
50 | if (QDir(dirname).exists()) | ||
51 | return dirname; | ||
52 | |||
53 | return ""; | ||
54 | } | ||
55 | }; | ||
56 | |||
57 | #endif | ||
diff --git a/noncore/apps/opie-reader/version.cpp b/noncore/apps/opie-reader/version.cpp index 864e4c1..9d92abe 100644 --- a/noncore/apps/opie-reader/version.cpp +++ b/noncore/apps/opie-reader/version.cpp | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "version.h" | 1 | #include "version.h" |
2 | #include "names.h" | ||
3 | #include <qmessagebox.h> | ||
2 | 4 | ||
3 | bool CheckVersion(int& major, int& bkmktype, char& minor) | 5 | bool CheckVersion(int& major, int& bkmktype, char& minor) |
4 | { | 6 | { |
5 | if ( | 7 | if ( |
@@ -12,23 +14,13 @@ bool CheckVersion(int& major, int& bkmktype, char& minor) | |||
12 | { | 14 | { |
13 | major = MAJOR; | 15 | major = MAJOR; |
14 | bkmktype = BKMKTYPE; | 16 | bkmktype = BKMKTYPE; |
15 | minor = MINOR; | 17 | minor = MINOR; |
16 | /* | 18 | |
17 | QMessageBox::warning(NULL, PROGNAME, | 19 | QMessageBox::warning(NULL, PROGNAME, |
18 | "This is the first time that you have\n" | 20 | "New Features in this version\n\n\n" |
19 | "run this version of OpieReader.\n\n" | 21 | "Relative margin settings\n" |
20 | "There are two new icons visible at\n" | 22 | "Cyrillic hyphenation"); |
21 | "the left end of the toolbar. The left\n" | ||
22 | "one brings up the menus, the next\n" | ||
23 | "one brings up the settings dialog.\n\n" | ||
24 | "Start by tapping the settings icon\n" | ||
25 | "and selecting the Buttons tab to\n" | ||
26 | "make sure that the buttons are\n" | ||
27 | "mapped as you expect\n\n" | ||
28 | "Next go to Settings/Toolbars via the\n" | ||
29 | "menu icon to set up your toolbars."); | ||
30 | */ | ||
31 | return true; | 23 | return true; |
32 | } | 24 | } |
33 | else | 25 | else |
34 | { | 26 | { |
diff --git a/noncore/apps/opie-reader/version.h b/noncore/apps/opie-reader/version.h index 85d35a4..dcf0692 100644 --- a/noncore/apps/opie-reader/version.h +++ b/noncore/apps/opie-reader/version.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef __VERSION_H | 1 | #ifndef __VERSION_H |
2 | #define __VERSION_H | 2 | #define __VERSION_H |
3 | 3 | ||
4 | #define MAJOR 0 | 4 | #define MAJOR 0 |
5 | #define BKMKTYPE 6 | 5 | #define BKMKTYPE 7 |
6 | #define MINOR 'j' | 6 | #define MINOR 'g' |
7 | #define RELEASE_TYPE "beta" | 7 | #define RELEASE_TYPE "beta" |
8 | 8 | ||
9 | #endif | 9 | #endif |
diff --git a/noncore/apps/opie-reader/zlib/zconf.h b/noncore/apps/opie-reader/zlib/zconf.h deleted file mode 100644 index 6d450fc..0000000 --- a/noncore/apps/opie-reader/zlib/zconf.h +++ b/dev/null | |||
@@ -1,279 +0,0 @@ | |||
1 | /* zconf.h -- configuration of the zlib compression library | ||
2 | * Copyright (C) 1995-1998 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #ifndef _ZCONF_H | ||
9 | #define _ZCONF_H | ||
10 | |||
11 | /* | ||
12 | * If you *really* need a unique prefix for all types and library functions, | ||
13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
14 | */ | ||
15 | #ifdef Z_PREFIX | ||
16 | # define deflateInit_z_deflateInit_ | ||
17 | # define deflatez_deflate | ||
18 | # define deflateEndz_deflateEnd | ||
19 | # define inflateInit_ z_inflateInit_ | ||
20 | # define inflatez_inflate | ||
21 | # define inflateEndz_inflateEnd | ||
22 | # define deflateInit2_z_deflateInit2_ | ||
23 | # define deflateSetDictionary z_deflateSetDictionary | ||
24 | # define deflateCopyz_deflateCopy | ||
25 | # define deflateResetz_deflateReset | ||
26 | # define deflateParamsz_deflateParams | ||
27 | # define inflateInit2_z_inflateInit2_ | ||
28 | # define inflateSetDictionary z_inflateSetDictionary | ||
29 | # define inflateSyncz_inflateSync | ||
30 | # define inflateSyncPoint z_inflateSyncPoint | ||
31 | # define inflateResetz_inflateReset | ||
32 | # define compressz_compress | ||
33 | # define compress2z_compress2 | ||
34 | # define uncompressz_uncompress | ||
35 | # define adler32z_adler32 | ||
36 | # define crc32 z_crc32 | ||
37 | # define get_crc_table z_get_crc_table | ||
38 | |||
39 | # define Byte z_Byte | ||
40 | # define uInt z_uInt | ||
41 | # define uLong z_uLong | ||
42 | # define Bytef z_Bytef | ||
43 | # define charf z_charf | ||
44 | # define intf z_intf | ||
45 | # define uIntf z_uIntf | ||
46 | # define uLongfz_uLongf | ||
47 | # define voidpfz_voidpf | ||
48 | # define voidp z_voidp | ||
49 | #endif | ||
50 | |||
51 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) | ||
52 | # define WIN32 | ||
53 | #endif | ||
54 | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) | ||
55 | # ifndef __32BIT__ | ||
56 | # define __32BIT__ | ||
57 | # endif | ||
58 | #endif | ||
59 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
60 | # define MSDOS | ||
61 | #endif | ||
62 | |||
63 | /* | ||
64 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
65 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
66 | */ | ||
67 | #if defined(MSDOS) && !defined(__32BIT__) | ||
68 | # define MAXSEG_64K | ||
69 | #endif | ||
70 | #ifdef MSDOS | ||
71 | # define UNALIGNED_OK | ||
72 | #endif | ||
73 | |||
74 | #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) | ||
75 | # define STDC | ||
76 | #endif | ||
77 | #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) | ||
78 | # ifndef STDC | ||
79 | # define STDC | ||
80 | # endif | ||
81 | #endif | ||
82 | |||
83 | #ifndef STDC | ||
84 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
85 | # define const | ||
86 | # endif | ||
87 | #endif | ||
88 | |||
89 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
90 | #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) | ||
91 | # define NO_DUMMY_DECL | ||
92 | #endif | ||
93 | |||
94 | /* Old Borland C incorrectly complains about missing returns: */ | ||
95 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) | ||
96 | # define NEED_DUMMY_RETURN | ||
97 | #endif | ||
98 | |||
99 | |||
100 | /* Maximum value for memLevel in deflateInit2 */ | ||
101 | #ifndef MAX_MEM_LEVEL | ||
102 | # ifdef MAXSEG_64K | ||
103 | # define MAX_MEM_LEVEL 8 | ||
104 | # else | ||
105 | # define MAX_MEM_LEVEL 9 | ||
106 | # endif | ||
107 | #endif | ||
108 | |||
109 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
110 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
111 | * created by gzip. (Files created by minigzip can still be extracted by | ||
112 | * gzip.) | ||
113 | */ | ||
114 | #ifndef MAX_WBITS | ||
115 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
116 | #endif | ||
117 | |||
118 | /* The memory requirements for deflate are (in bytes): | ||
119 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
120 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
121 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
122 | the default memory requirements from 256K to 128K, compile with | ||
123 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
124 | Of course this will generally degrade compression (there's no free lunch). | ||
125 | |||
126 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
127 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
128 | for small objects. | ||
129 | */ | ||
130 | |||
131 | /* Type declarations */ | ||
132 | |||
133 | #ifndef OF /* function prototypes */ | ||
134 | # ifdef STDC | ||
135 | # define OF(args) args | ||
136 | # else | ||
137 | # define OF(args) () | ||
138 | # endif | ||
139 | #endif | ||
140 | |||
141 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
142 | * model programming (small or medium model with some far allocations). | ||
143 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
144 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
145 | * just define FAR to be empty. | ||
146 | */ | ||
147 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) | ||
148 | /* MSC small or medium model */ | ||
149 | # define SMALL_MEDIUM | ||
150 | # ifdef _MSC_VER | ||
151 | # define FAR _far | ||
152 | # else | ||
153 | # define FAR far | ||
154 | # endif | ||
155 | #endif | ||
156 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) | ||
157 | # ifndef __32BIT__ | ||
158 | # define SMALL_MEDIUM | ||
159 | # define FAR _far | ||
160 | # endif | ||
161 | #endif | ||
162 | |||
163 | /* Compile with -DZLIB_DLL for Windows DLL support */ | ||
164 | #if defined(ZLIB_DLL) | ||
165 | # if defined(_WINDOWS) || defined(WINDOWS) | ||
166 | # ifdef FAR | ||
167 | # undef FAR | ||
168 | # endif | ||
169 | # include <windows.h> | ||
170 | # define ZEXPORT WINAPI | ||
171 | # ifdef WIN32 | ||
172 | # define ZEXPORTVA WINAPIV | ||
173 | # else | ||
174 | # define ZEXPORTVA FAR _cdecl _export | ||
175 | # endif | ||
176 | # endif | ||
177 | # if defined (__BORLANDC__) | ||
178 | # if (__BORLANDC__ >= 0x0500) && defined (WIN32) | ||
179 | # include <windows.h> | ||
180 | # define ZEXPORT __declspec(dllexport) WINAPI | ||
181 | # define ZEXPORTRVA __declspec(dllexport) WINAPIV | ||
182 | # else | ||
183 | # if defined (_Windows) && defined (__DLL__) | ||
184 | # define ZEXPORT _export | ||
185 | # define ZEXPORTVA _export | ||
186 | # endif | ||
187 | # endif | ||
188 | # endif | ||
189 | #endif | ||
190 | |||
191 | #if defined (__BEOS__) | ||
192 | # if defined (ZLIB_DLL) | ||
193 | # define ZEXTERN extern __declspec(dllexport) | ||
194 | # else | ||
195 | # define ZEXTERN extern __declspec(dllimport) | ||
196 | # endif | ||
197 | #endif | ||
198 | |||
199 | #ifndef ZEXPORT | ||
200 | # define ZEXPORT | ||
201 | #endif | ||
202 | #ifndef ZEXPORTVA | ||
203 | # define ZEXPORTVA | ||
204 | #endif | ||
205 | #ifndef ZEXTERN | ||
206 | # define ZEXTERN extern | ||
207 | #endif | ||
208 | |||
209 | #ifndef FAR | ||
210 | # define FAR | ||
211 | #endif | ||
212 | |||
213 | #if !defined(MACOS) && !defined(TARGET_OS_MAC) | ||
214 | typedef unsigned char Byte; /* 8 bits */ | ||
215 | #endif | ||
216 | typedef unsigned int uInt; /* 16 bits or more */ | ||
217 | typedef unsigned long uLong; /* 32 bits or more */ | ||
218 | |||
219 | #ifdef SMALL_MEDIUM | ||
220 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
221 | # define Bytef Byte FAR | ||
222 | #else | ||
223 | typedef Byte FAR Bytef; | ||
224 | #endif | ||
225 | typedef char FAR charf; | ||
226 | typedef int FAR intf; | ||
227 | typedef uInt FAR uIntf; | ||
228 | typedef uLong FAR uLongf; | ||
229 | |||
230 | #ifdef STDC | ||
231 | typedef void FAR *voidpf; | ||
232 | typedef void *voidp; | ||
233 | #else | ||
234 | typedef Byte FAR *voidpf; | ||
235 | typedef Byte *voidp; | ||
236 | #endif | ||
237 | |||
238 | #ifdef HAVE_UNISTD_H | ||
239 | # include <sys/types.h> /* for off_t */ | ||
240 | # include <unistd.h> /* for SEEK_* and off_t */ | ||
241 | # define z_off_t off_t | ||
242 | #endif | ||
243 | #ifndef SEEK_SET | ||
244 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
245 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
246 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
247 | #endif | ||
248 | #ifndef z_off_t | ||
249 | # define z_off_t long | ||
250 | #endif | ||
251 | |||
252 | /* MVS linker does not support external names larger than 8 bytes */ | ||
253 | #if defined(__MVS__) | ||
254 | # pragma map(deflateInit_,"DEIN") | ||
255 | # pragma map(deflateInit2_,"DEIN2") | ||
256 | # pragma map(deflateEnd,"DEEND") | ||
257 | # pragma map(inflateInit_,"ININ") | ||
258 | # pragma map(inflateInit2_,"ININ2") | ||
259 | # pragma map(inflateEnd,"INEND") | ||
260 | # pragma map(inflateSync,"INSY") | ||
261 | # pragma map(inflateSetDictionary,"INSEDI") | ||
262 | # pragma map(inflate_blocks,"INBL") | ||
263 | # pragma map(inflate_blocks_new,"INBLNE") | ||
264 | # pragma map(inflate_blocks_free,"INBLFR") | ||
265 | # pragma map(inflate_blocks_reset,"INBLRE") | ||
266 | # pragma map(inflate_codes_free,"INCOFR") | ||
267 | # pragma map(inflate_codes,"INCO") | ||
268 | # pragma map(inflate_fast,"INFA") | ||
269 | # pragma map(inflate_flush,"INFLU") | ||
270 | # pragma map(inflate_mask,"INMA") | ||
271 | # pragma map(inflate_set_dictionary,"INSEDI2") | ||
272 | # pragma map(inflate_copyright,"INCOPY") | ||
273 | # pragma map(inflate_trees_bits,"INTRBI") | ||
274 | # pragma map(inflate_trees_dynamic,"INTRDY") | ||
275 | # pragma map(inflate_trees_fixed,"INTRFI") | ||
276 | # pragma map(inflate_trees_free,"INTRFR") | ||
277 | #endif | ||
278 | |||
279 | #endif /* _ZCONF_H */ | ||
diff --git a/noncore/apps/opie-reader/zlib/zlib.h b/noncore/apps/opie-reader/zlib/zlib.h deleted file mode 100644 index 5ecf515..0000000 --- a/noncore/apps/opie-reader/zlib/zlib.h +++ b/dev/null | |||
@@ -1,904 +0,0 @@ | |||
1 | /* zlib.h -- interface of the 'zlib' general purpose compression library | ||
2 | version 1.1.3, July 9th, 1998 | ||
3 | |||
4 | Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler | ||
5 | |||
6 | This software is provided 'as-is', without any express or implied | ||
7 | warranty. In no event will the authors be held liable for any damages | ||
8 | arising from the use of this software. | ||
9 | |||
10 | Permission is granted to anyone to use this software for any purpose, | ||
11 | including commercial applications, and to alter it and redistribute it | ||
12 | freely, subject to the following restrictions: | ||
13 | |||
14 | 1. The origin of this software must not be misrepresented; you must not | ||
15 | claim that you wrote the original software. If you use this software | ||
16 | in a product, an acknowledgment in the product documentation would be | ||
17 | appreciated but is not required. | ||
18 | 2. Altered source versions must be plainly marked as such, and must not be | ||
19 | misrepresented as being the original software. | ||
20 | 3. This notice may not be removed or altered from any source distribution. | ||
21 | |||
22 | Jean-loup Gailly Mark Adler | ||
23 | jloup@gzip.org madler@alumni.caltech.edu | ||
24 | |||
25 | |||
26 | The data format used by the zlib library is described by RFCs (Request for | ||
27 | Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt | ||
28 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). | ||
29 | */ | ||
30 | |||
31 | #ifndef _ZLIB_H | ||
32 | #define _ZLIB_H | ||
33 | |||
34 | #include "zconf.h" | ||
35 | |||
36 | #ifdef __cplusplus | ||
37 | extern "C" { | ||
38 | #endif | ||
39 | |||
40 | #define ZLIB_VERSION "1.1.3" | ||
41 | |||
42 | #ifdef QT_MAKEDLL | ||
43 | #define Q_ZEXPORT __declspec(dllexport) | ||
44 | #else | ||
45 | #ifdef QT_DLL | ||
46 | #define Q_ZEXPORT __declspec(dllimport) | ||
47 | #else | ||
48 | #define Q_ZEXPORT ZEXPORT | ||
49 | #endif | ||
50 | #endif | ||
51 | |||
52 | |||
53 | /* | ||
54 | The 'zlib' compression library provides in-memory compression and | ||
55 | decompression functions, including integrity checks of the uncompressed | ||
56 | data. This version of the library supports only one compression method | ||
57 | (deflation) but other algorithms will be added later and will have the same | ||
58 | stream interface. | ||
59 | |||
60 | Compression can be done in a single step if the buffers are large | ||
61 | enough (for example if an input file is mmap'ed), or can be done by | ||
62 | repeated calls of the compression function. In the latter case, the | ||
63 | application must provide more input and/or consume the output | ||
64 | (providing more output space) before each call. | ||
65 | |||
66 | The library also supports reading and writing files in gzip (.gz) format | ||
67 | with an interface similar to that of stdio. | ||
68 | |||
69 | The library does not install any signal handler. The decoder checks | ||
70 | the consistency of the compressed data, so the library should never | ||
71 | crash even in case of corrupted input. | ||
72 | */ | ||
73 | |||
74 | typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | ||
75 | typedef void (*free_func) OF((voidpf opaque, voidpf address)); | ||
76 | |||
77 | struct internal_state; | ||
78 | |||
79 | typedef struct z_stream_s { | ||
80 | Bytef *next_in; /* next input byte */ | ||
81 | uInt avail_in; /* number of bytes available at next_in */ | ||
82 | uLong total_in; /* total nb of input bytes read so far */ | ||
83 | |||
84 | Bytef *next_out; /* next output byte should be put there */ | ||
85 | uInt avail_out; /* remaining free space at next_out */ | ||
86 | uLong total_out; /* total nb of bytes output so far */ | ||
87 | |||
88 | char *msg; /* last error message, NULL if no error */ | ||
89 | struct internal_state FAR *state; /* not visible by applications */ | ||
90 | |||
91 | alloc_func zalloc; /* used to allocate the internal state */ | ||
92 | free_func zfree; /* used to free the internal state */ | ||
93 | voidpf opaque; /* private data object passed to zalloc and zfree */ | ||
94 | |||
95 | int data_type; /* best guess about the data type: ascii or binary */ | ||
96 | uLong adler; /* adler32 value of the uncompressed data */ | ||
97 | uLong reserved; /* reserved for future use */ | ||
98 | } z_stream; | ||
99 | |||
100 | typedef z_stream FAR *z_streamp; | ||
101 | |||
102 | /* | ||
103 | The application must update next_in and avail_in when avail_in has | ||
104 | dropped to zero. It must update next_out and avail_out when avail_out | ||
105 | has dropped to zero. The application must initialize zalloc, zfree and | ||
106 | opaque before calling the init function. All other fields are set by the | ||
107 | compression library and must not be updated by the application. | ||
108 | |||
109 | The opaque value provided by the application will be passed as the first | ||
110 | parameter for calls of zalloc and zfree. This can be useful for custom | ||
111 | memory management. The compression library attaches no meaning to the | ||
112 | opaque value. | ||
113 | |||
114 | zalloc must return Z_NULL if there is not enough memory for the object. | ||
115 | If zlib is used in a multi-threaded application, zalloc and zfree must be | ||
116 | thread safe. | ||
117 | |||
118 | On 16-bit systems, the functions zalloc and zfree must be able to allocate | ||
119 | exactly 65536 bytes, but will not be required to allocate more than this | ||
120 | if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, | ||
121 | pointers returned by zalloc for objects of exactly 65536 bytes *must* | ||
122 | have their offset normalized to zero. The default allocation function | ||
123 | provided by this library ensures this (see zutil.c). To reduce memory | ||
124 | requirements and avoid any allocation of 64K objects, at the expense of | ||
125 | compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). | ||
126 | |||
127 | The fields total_in and total_out can be used for statistics or | ||
128 | progress reports. After compression, total_in holds the total size of | ||
129 | the uncompressed data and may be saved for use in the decompressor | ||
130 | (particularly if the decompressor wants to decompress everything in | ||
131 | a single step). | ||
132 | */ | ||
133 | |||
134 | /* constants */ | ||
135 | |||
136 | #define Z_NO_FLUSH 0 | ||
137 | #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ | ||
138 | #define Z_SYNC_FLUSH 2 | ||
139 | #define Z_FULL_FLUSH 3 | ||
140 | #define Z_FINISH 4 | ||
141 | /* Allowed flush values; see deflate() below for details */ | ||
142 | |||
143 | #define Z_OK 0 | ||
144 | #define Z_STREAM_END 1 | ||
145 | #define Z_NEED_DICT 2 | ||
146 | #define Z_ERRNO (-1) | ||
147 | #define Z_STREAM_ERROR (-2) | ||
148 | #define Z_DATA_ERROR (-3) | ||
149 | #define Z_MEM_ERROR (-4) | ||
150 | #define Z_BUF_ERROR (-5) | ||
151 | #define Z_VERSION_ERROR (-6) | ||
152 | /* Return codes for the compression/decompression functions. Negative | ||
153 | * values are errors, positive values are used for special but normal events. | ||
154 | */ | ||
155 | |||
156 | #define Z_NO_COMPRESSION 0 | ||
157 | #define Z_BEST_SPEED 1 | ||
158 | #define Z_BEST_COMPRESSION 9 | ||
159 | #define Z_DEFAULT_COMPRESSION (-1) | ||
160 | /* compression levels */ | ||
161 | |||
162 | #define Z_FILTERED 1 | ||
163 | #define Z_HUFFMAN_ONLY 2 | ||
164 | #define Z_DEFAULT_STRATEGY 0 | ||
165 | /* compression strategy; see deflateInit2() below for details */ | ||
166 | |||
167 | #define Z_BINARY 0 | ||
168 | #define Z_ASCII 1 | ||
169 | #define Z_UNKNOWN 2 | ||
170 | /* Possible values of the data_type field */ | ||
171 | |||
172 | #define Z_DEFLATED 8 | ||
173 | /* The deflate compression method (the only one supported in this version) */ | ||
174 | |||
175 | #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | ||
176 | |||
177 | #define zlib_version zlibVersion() | ||
178 | /* for compatibility with versions < 1.0.2 */ | ||
179 | |||
180 | /* basic functions */ | ||
181 | |||
182 | ZEXTERN const char * ZEXPORT zlibVersion OF((void)); | ||
183 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. | ||
184 | If the first character differs, the library code actually used is | ||
185 | not compatible with the zlib.h header file used by the application. | ||
186 | This check is automatically made by deflateInit and inflateInit. | ||
187 | */ | ||
188 | |||
189 | /* | ||
190 | ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); | ||
191 | |||
192 | Initializes the internal stream state for compression. The fields | ||
193 | zalloc, zfree and opaque must be initialized before by the caller. | ||
194 | If zalloc and zfree are set to Z_NULL, deflateInit updates them to | ||
195 | use default allocation functions. | ||
196 | |||
197 | The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | ||
198 | 1 gives best speed, 9 gives best compression, 0 gives no compression at | ||
199 | all (the input data is simply copied a block at a time). | ||
200 | Z_DEFAULT_COMPRESSION requests a default compromise between speed and | ||
201 | compression (currently equivalent to level 6). | ||
202 | |||
203 | deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not | ||
204 | enough memory, Z_STREAM_ERROR if level is not a valid compression level, | ||
205 | Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible | ||
206 | with the version assumed by the caller (ZLIB_VERSION). | ||
207 | msg is set to null if there is no error message. deflateInit does not | ||
208 | perform any compression: this will be done by deflate(). | ||
209 | */ | ||
210 | |||
211 | |||
212 | ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | ||
213 | /* | ||
214 | deflate compresses as much data as possible, and stops when the input | ||
215 | buffer becomes empty or the output buffer becomes full. It may introduce some | ||
216 | output latency (reading input without producing any output) except when | ||
217 | forced to flush. | ||
218 | |||
219 | The detailed semantics are as follows. deflate performs one or both of the | ||
220 | following actions: | ||
221 | |||
222 | - Compress more input starting at next_in and update next_in and avail_in | ||
223 | accordingly. If not all input can be processed (because there is not | ||
224 | enough room in the output buffer), next_in and avail_in are updated and | ||
225 | processing will resume at this point for the next call of deflate(). | ||
226 | |||
227 | - Provide more output starting at next_out and update next_out and avail_out | ||
228 | accordingly. This action is forced if the parameter flush is non zero. | ||
229 | Forcing flush frequently degrades the compression ratio, so this parameter | ||
230 | should be set only when necessary (in interactive applications). | ||
231 | Some output may be provided even if flush is not set. | ||
232 | |||
233 | Before the call of deflate(), the application should ensure that at least | ||
234 | one of the actions is possible, by providing more input and/or consuming | ||
235 | more output, and updating avail_in or avail_out accordingly; avail_out | ||
236 | should never be zero before the call. The application can consume the | ||
237 | compressed output when it wants, for example when the output buffer is full | ||
238 | (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK | ||
239 | and with zero avail_out, it must be called again after making room in the | ||
240 | output buffer because there might be more output pending. | ||
241 | |||
242 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is | ||
243 | flushed to the output buffer and the output is aligned on a byte boundary, so | ||
244 | that the decompressor can get all input data available so far. (In particular | ||
245 | avail_in is zero after the call if enough output space has been provided | ||
246 | before the call.) Flushing may degrade compression for some compression | ||
247 | algorithms and so it should be used only when necessary. | ||
248 | |||
249 | If flush is set to Z_FULL_FLUSH, all output is flushed as with | ||
250 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can | ||
251 | restart from this point if previous compressed data has been damaged or if | ||
252 | random access is desired. Using Z_FULL_FLUSH too often can seriously degrade | ||
253 | the compression. | ||
254 | |||
255 | If deflate returns with avail_out == 0, this function must be called again | ||
256 | with the same value of the flush parameter and more output space (updated | ||
257 | avail_out), until the flush is complete (deflate returns with non-zero | ||
258 | avail_out). | ||
259 | |||
260 | If the parameter flush is set to Z_FINISH, pending input is processed, | ||
261 | pending output is flushed and deflate returns with Z_STREAM_END if there | ||
262 | was enough output space; if deflate returns with Z_OK, this function must be | ||
263 | called again with Z_FINISH and more output space (updated avail_out) but no | ||
264 | more input data, until it returns with Z_STREAM_END or an error. After | ||
265 | deflate has returned Z_STREAM_END, the only possible operations on the | ||
266 | stream are deflateReset or deflateEnd. | ||
267 | |||
268 | Z_FINISH can be used immediately after deflateInit if all the compression | ||
269 | is to be done in a single step. In this case, avail_out must be at least | ||
270 | 0.1% larger than avail_in plus 12 bytes. If deflate does not return | ||
271 | Z_STREAM_END, then it must be called again as described above. | ||
272 | |||
273 | deflate() sets strm->adler to the adler32 checksum of all input read | ||
274 | so far (that is, total_in bytes). | ||
275 | |||
276 | deflate() may update data_type if it can make a good guess about | ||
277 | the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered | ||
278 | binary. This field is only for information purposes and does not affect | ||
279 | the compression algorithm in any manner. | ||
280 | |||
281 | deflate() returns Z_OK if some progress has been made (more input | ||
282 | processed or more output produced), Z_STREAM_END if all input has been | ||
283 | consumed and all output has been produced (only when flush is set to | ||
284 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example | ||
285 | if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible | ||
286 | (for example avail_in or avail_out was zero). | ||
287 | */ | ||
288 | |||
289 | |||
290 | ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); | ||
291 | /* | ||
292 | All dynamically allocated data structures for this stream are freed. | ||
293 | This function discards any unprocessed input and does not flush any | ||
294 | pending output. | ||
295 | |||
296 | deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the | ||
297 | stream state was inconsistent, Z_DATA_ERROR if the stream was freed | ||
298 | prematurely (some input or output was discarded). In the error case, | ||
299 | msg may be set but then points to a static string (which must not be | ||
300 | deallocated). | ||
301 | */ | ||
302 | |||
303 | |||
304 | /* | ||
305 | ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); | ||
306 | |||
307 | Initializes the internal stream state for decompression. The fields | ||
308 | next_in, avail_in, zalloc, zfree and opaque must be initialized before by | ||
309 | the caller. If next_in is not Z_NULL and avail_in is large enough (the exact | ||
310 | value depends on the compression method), inflateInit determines the | ||
311 | compression method from the zlib header and allocates all data structures | ||
312 | accordingly; otherwise the allocation will be deferred to the first call of | ||
313 | inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to | ||
314 | use default allocation functions. | ||
315 | |||
316 | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
317 | memory, Z_VERSION_ERROR if the zlib library version is incompatible with the | ||
318 | version assumed by the caller. msg is set to null if there is no error | ||
319 | message. inflateInit does not perform any decompression apart from reading | ||
320 | the zlib header if present: this will be done by inflate(). (So next_in and | ||
321 | avail_in may be modified, but next_out and avail_out are unchanged.) | ||
322 | */ | ||
323 | |||
324 | |||
325 | ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | ||
326 | /* | ||
327 | inflate decompresses as much data as possible, and stops when the input | ||
328 | buffer becomes empty or the output buffer becomes full. It may some | ||
329 | introduce some output latency (reading input without producing any output) | ||
330 | except when forced to flush. | ||
331 | |||
332 | The detailed semantics are as follows. inflate performs one or both of the | ||
333 | following actions: | ||
334 | |||
335 | - Decompress more input starting at next_in and update next_in and avail_in | ||
336 | accordingly. If not all input can be processed (because there is not | ||
337 | enough room in the output buffer), next_in is updated and processing | ||
338 | will resume at this point for the next call of inflate(). | ||
339 | |||
340 | - Provide more output starting at next_out and update next_out and avail_out | ||
341 | accordingly. inflate() provides as much output as possible, until there | ||
342 | is no more input data or no more space in the output buffer (see below | ||
343 | about the flush parameter). | ||
344 | |||
345 | Before the call of inflate(), the application should ensure that at least | ||
346 | one of the actions is possible, by providing more input and/or consuming | ||
347 | more output, and updating the next_* and avail_* values accordingly. | ||
348 | The application can consume the uncompressed output when it wants, for | ||
349 | example when the output buffer is full (avail_out == 0), or after each | ||
350 | call of inflate(). If inflate returns Z_OK and with zero avail_out, it | ||
351 | must be called again after making room in the output buffer because there | ||
352 | might be more output pending. | ||
353 | |||
354 | If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much | ||
355 | output as possible to the output buffer. The flushing behavior of inflate is | ||
356 | not specified for values of the flush parameter other than Z_SYNC_FLUSH | ||
357 | and Z_FINISH, but the current implementation actually flushes as much output | ||
358 | as possible anyway. | ||
359 | |||
360 | inflate() should normally be called until it returns Z_STREAM_END or an | ||
361 | error. However if all decompression is to be performed in a single step | ||
362 | (a single call of inflate), the parameter flush should be set to | ||
363 | Z_FINISH. In this case all pending input is processed and all pending | ||
364 | output is flushed; avail_out must be large enough to hold all the | ||
365 | uncompressed data. (The size of the uncompressed data may have been saved | ||
366 | by the compressor for this purpose.) The next operation on this stream must | ||
367 | be inflateEnd to deallocate the decompression state. The use of Z_FINISH | ||
368 | is never required, but can be used to inform inflate that a faster routine | ||
369 | may be used for the single inflate() call. | ||
370 | |||
371 | If a preset dictionary is needed at this point (see inflateSetDictionary | ||
372 | below), inflate sets strm-adler to the adler32 checksum of the | ||
373 | dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise | ||
374 | it sets strm->adler to the adler32 checksum of all output produced | ||
375 | so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or | ||
376 | an error code as described below. At the end of the stream, inflate() | ||
377 | checks that its computed adler32 checksum is equal to that saved by the | ||
378 | compressor and returns Z_STREAM_END only if the checksum is correct. | ||
379 | |||
380 | inflate() returns Z_OK if some progress has been made (more input processed | ||
381 | or more output produced), Z_STREAM_END if the end of the compressed data has | ||
382 | been reached and all uncompressed output has been produced, Z_NEED_DICT if a | ||
383 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | ||
384 | corrupted (input stream not conforming to the zlib format or incorrect | ||
385 | adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent | ||
386 | (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not | ||
387 | enough memory, Z_BUF_ERROR if no progress is possible or if there was not | ||
388 | enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR | ||
389 | case, the application may then call inflateSync to look for a good | ||
390 | compression block. | ||
391 | */ | ||
392 | |||
393 | |||
394 | ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); | ||
395 | /* | ||
396 | All dynamically allocated data structures for this stream are freed. | ||
397 | This function discards any unprocessed input and does not flush any | ||
398 | pending output. | ||
399 | |||
400 | inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state | ||
401 | was inconsistent. In the error case, msg may be set but then points to a | ||
402 | static string (which must not be deallocated). | ||
403 | */ | ||
404 | |||
405 | /* Advanced functions */ | ||
406 | |||
407 | /* | ||
408 | The following functions are needed only in some special applications. | ||
409 | */ | ||
410 | |||
411 | /* | ||
412 | ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | ||
413 | int level, | ||
414 | int method, | ||
415 | int windowBits, | ||
416 | int memLevel, | ||
417 | int strategy)); | ||
418 | |||
419 | This is another version of deflateInit with more compression options. The | ||
420 | fields next_in, zalloc, zfree and opaque must be initialized before by | ||
421 | the caller. | ||
422 | |||
423 | The method parameter is the compression method. It must be Z_DEFLATED in | ||
424 | this version of the library. | ||
425 | |||
426 | The windowBits parameter is the base two logarithm of the window size | ||
427 | (the size of the history buffer). It should be in the range 8..15 for this | ||
428 | version of the library. Larger values of this parameter result in better | ||
429 | compression at the expense of memory usage. The default value is 15 if | ||
430 | deflateInit is used instead. | ||
431 | |||
432 | The memLevel parameter specifies how much memory should be allocated | ||
433 | for the internal compression state. memLevel=1 uses minimum memory but | ||
434 | is slow and reduces compression ratio; memLevel=9 uses maximum memory | ||
435 | for optimal speed. The default value is 8. See zconf.h for total memory | ||
436 | usage as a function of windowBits and memLevel. | ||
437 | |||
438 | The strategy parameter is used to tune the compression algorithm. Use the | ||
439 | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a | ||
440 | filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no | ||
441 | string match). Filtered data consists mostly of small values with a | ||
442 | somewhat random distribution. In this case, the compression algorithm is | ||
443 | tuned to compress them better. The effect of Z_FILTERED is to force more | ||
444 | Huffman coding and less string matching; it is somewhat intermediate | ||
445 | between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects | ||
446 | the compression ratio but not the correctness of the compressed output even | ||
447 | if it is not set appropriately. | ||
448 | |||
449 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
450 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid | ||
451 | method). msg is set to null if there is no error message. deflateInit2 does | ||
452 | not perform any compression: this will be done by deflate(). | ||
453 | */ | ||
454 | |||
455 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | ||
456 | const Bytef *dictionary, | ||
457 | uInt dictLength)); | ||
458 | /* | ||
459 | Initializes the compression dictionary from the given byte sequence | ||
460 | without producing any compressed output. This function must be called | ||
461 | immediately after deflateInit, deflateInit2 or deflateReset, before any | ||
462 | call of deflate. The compressor and decompressor must use exactly the same | ||
463 | dictionary (see inflateSetDictionary). | ||
464 | |||
465 | The dictionary should consist of strings (byte sequences) that are likely | ||
466 | to be encountered later in the data to be compressed, with the most commonly | ||
467 | used strings preferably put towards the end of the dictionary. Using a | ||
468 | dictionary is most useful when the data to be compressed is short and can be | ||
469 | predicted with good accuracy; the data can then be compressed better than | ||
470 | with the default empty dictionary. | ||
471 | |||
472 | Depending on the size of the compression data structures selected by | ||
473 | deflateInit or deflateInit2, a part of the dictionary may in effect be | ||
474 | discarded, for example if the dictionary is larger than the window size in | ||
475 | deflate or deflate2. Thus the strings most likely to be useful should be | ||
476 | put at the end of the dictionary, not at the front. | ||
477 | |||
478 | Upon return of this function, strm->adler is set to the Adler32 value | ||
479 | of the dictionary; the decompressor may later use this value to determine | ||
480 | which dictionary has been used by the compressor. (The Adler32 value | ||
481 | applies to the whole dictionary even if only a subset of the dictionary is | ||
482 | actually used by the compressor.) | ||
483 | |||
484 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | ||
485 | parameter is invalid (such as NULL dictionary) or the stream state is | ||
486 | inconsistent (for example if deflate has already been called for this stream | ||
487 | or if the compression method is bsort). deflateSetDictionary does not | ||
488 | perform any compression: this will be done by deflate(). | ||
489 | */ | ||
490 | |||
491 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | ||
492 | z_streamp source)); | ||
493 | /* | ||
494 | Sets the destination stream as a complete copy of the source stream. | ||
495 | |||
496 | This function can be useful when several compression strategies will be | ||
497 | tried, for example when there are several ways of pre-processing the input | ||
498 | data with a filter. The streams that will be discarded should then be freed | ||
499 | by calling deflateEnd. Note that deflateCopy duplicates the internal | ||
500 | compression state which can be quite large, so this strategy is slow and | ||
501 | can consume lots of memory. | ||
502 | |||
503 | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | ||
504 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | ||
505 | (such as zalloc being NULL). msg is left unchanged in both source and | ||
506 | destination. | ||
507 | */ | ||
508 | |||
509 | ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); | ||
510 | /* | ||
511 | This function is equivalent to deflateEnd followed by deflateInit, | ||
512 | but does not free and reallocate all the internal compression state. | ||
513 | The stream will keep the same compression level and any other attributes | ||
514 | that may have been set by deflateInit2. | ||
515 | |||
516 | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
517 | stream state was inconsistent (such as zalloc or state being NULL). | ||
518 | */ | ||
519 | |||
520 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, | ||
521 | int level, | ||
522 | int strategy)); | ||
523 | /* | ||
524 | Dynamically update the compression level and compression strategy. The | ||
525 | interpretation of level and strategy is as in deflateInit2. This can be | ||
526 | used to switch between compression and straight copy of the input data, or | ||
527 | to switch to a different kind of input data requiring a different | ||
528 | strategy. If the compression level is changed, the input available so far | ||
529 | is compressed with the old level (and may be flushed); the new level will | ||
530 | take effect only at the next call of deflate(). | ||
531 | |||
532 | Before the call of deflateParams, the stream state must be set as for | ||
533 | a call of deflate(), since the currently available input may have to | ||
534 | be compressed and flushed. In particular, strm->avail_out must be non-zero. | ||
535 | |||
536 | deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source | ||
537 | stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR | ||
538 | if strm->avail_out was zero. | ||
539 | */ | ||
540 | |||
541 | /* | ||
542 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | ||
543 | int windowBits)); | ||
544 | |||
545 | This is another version of inflateInit with an extra parameter. The | ||
546 | fields next_in, avail_in, zalloc, zfree and opaque must be initialized | ||
547 | before by the caller. | ||
548 | |||
549 | The windowBits parameter is the base two logarithm of the maximum window | ||
550 | size (the size of the history buffer). It should be in the range 8..15 for | ||
551 | this version of the library. The default value is 15 if inflateInit is used | ||
552 | instead. If a compressed stream with a larger window size is given as | ||
553 | input, inflate() will return with the error code Z_DATA_ERROR instead of | ||
554 | trying to allocate a larger window. | ||
555 | |||
556 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
557 | memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative | ||
558 | memLevel). msg is set to null if there is no error message. inflateInit2 | ||
559 | does not perform any decompression apart from reading the zlib header if | ||
560 | present: this will be done by inflate(). (So next_in and avail_in may be | ||
561 | modified, but next_out and avail_out are unchanged.) | ||
562 | */ | ||
563 | |||
564 | ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | ||
565 | const Bytef *dictionary, | ||
566 | uInt dictLength)); | ||
567 | /* | ||
568 | Initializes the decompression dictionary from the given uncompressed byte | ||
569 | sequence. This function must be called immediately after a call of inflate | ||
570 | if this call returned Z_NEED_DICT. The dictionary chosen by the compressor | ||
571 | can be determined from the Adler32 value returned by this call of | ||
572 | inflate. The compressor and decompressor must use exactly the same | ||
573 | dictionary (see deflateSetDictionary). | ||
574 | |||
575 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | ||
576 | parameter is invalid (such as NULL dictionary) or the stream state is | ||
577 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | ||
578 | expected one (incorrect Adler32 value). inflateSetDictionary does not | ||
579 | perform any decompression: this will be done by subsequent calls of | ||
580 | inflate(). | ||
581 | */ | ||
582 | |||
583 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | ||
584 | /* | ||
585 | Skips invalid compressed data until a full flush point (see above the | ||
586 | description of deflate with Z_FULL_FLUSH) can be found, or until all | ||
587 | available input is skipped. No output is provided. | ||
588 | |||
589 | inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR | ||
590 | if no more input was provided, Z_DATA_ERROR if no flush point has been found, | ||
591 | or Z_STREAM_ERROR if the stream structure was inconsistent. In the success | ||
592 | case, the application may save the current current value of total_in which | ||
593 | indicates where valid compressed data was found. In the error case, the | ||
594 | application may repeatedly call inflateSync, providing more input each time, | ||
595 | until success or end of the input data. | ||
596 | */ | ||
597 | |||
598 | ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | ||
599 | /* | ||
600 | This function is equivalent to inflateEnd followed by inflateInit, | ||
601 | but does not free and reallocate all the internal decompression state. | ||
602 | The stream will keep attributes that may have been set by inflateInit2. | ||
603 | |||
604 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
605 | stream state was inconsistent (such as zalloc or state being NULL). | ||
606 | */ | ||
607 | |||
608 | |||
609 | /* utility functions */ | ||
610 | |||
611 | /* | ||
612 | The following utility functions are implemented on top of the | ||
613 | basic stream-oriented functions. To simplify the interface, some | ||
614 | default options are assumed (compression level and memory usage, | ||
615 | standard memory allocation functions). The source code of these | ||
616 | utility functions can easily be modified if you need special options. | ||
617 | */ | ||
618 | |||
619 | ZEXTERN int Q_ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | ||
620 | const Bytef *source, uLong sourceLen)); | ||
621 | /* | ||
622 | Compresses the source buffer into the destination buffer. sourceLen is | ||
623 | the byte length of the source buffer. Upon entry, destLen is the total | ||
624 | size of the destination buffer, which must be at least 0.1% larger than | ||
625 | sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the | ||
626 | compressed buffer. | ||
627 | This function can be used to compress a whole file at once if the | ||
628 | input file is mmap'ed. | ||
629 | compress returns Z_OK if success, Z_MEM_ERROR if there was not | ||
630 | enough memory, Z_BUF_ERROR if there was not enough room in the output | ||
631 | buffer. | ||
632 | */ | ||
633 | |||
634 | ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | ||
635 | const Bytef *source, uLong sourceLen, | ||
636 | int level)); | ||
637 | /* | ||
638 | Compresses the source buffer into the destination buffer. The level | ||
639 | parameter has the same meaning as in deflateInit. sourceLen is the byte | ||
640 | length of the source buffer. Upon entry, destLen is the total size of the | ||
641 | destination buffer, which must be at least 0.1% larger than sourceLen plus | ||
642 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. | ||
643 | |||
644 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | ||
645 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, | ||
646 | Z_STREAM_ERROR if the level parameter is invalid. | ||
647 | */ | ||
648 | |||
649 | ZEXTERN int Q_ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | ||
650 | const Bytef *source, uLong sourceLen)); | ||
651 | /* | ||
652 | Decompresses the source buffer into the destination buffer. sourceLen is | ||
653 | the byte length of the source buffer. Upon entry, destLen is the total | ||
654 | size of the destination buffer, which must be large enough to hold the | ||
655 | entire uncompressed data. (The size of the uncompressed data must have | ||
656 | been saved previously by the compressor and transmitted to the decompressor | ||
657 | by some mechanism outside the scope of this compression library.) | ||
658 | Upon exit, destLen is the actual size of the compressed buffer. | ||
659 | This function can be used to decompress a whole file at once if the | ||
660 | input file is mmap'ed. | ||
661 | |||
662 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | ||
663 | enough memory, Z_BUF_ERROR if there was not enough room in the output | ||
664 | buffer, or Z_DATA_ERROR if the input data was corrupted. | ||
665 | */ | ||
666 | |||
667 | |||
668 | typedef voidp gzFile; | ||
669 | |||
670 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | ||
671 | /* | ||
672 | Opens a gzip (.gz) file for reading or writing. The mode parameter | ||
673 | is as in fopen ("rb" or "wb") but can also include a compression level | ||
674 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for | ||
675 | Huffman only compression as in "wb1h". (See the description | ||
676 | of deflateInit2 for more information about the strategy parameter.) | ||
677 | |||
678 | gzopen can be used to read a file which is not in gzip format; in this | ||
679 | case gzread will directly read from the file without decompression. | ||
680 | |||
681 | gzopen returns NULL if the file could not be opened or if there was | ||
682 | insufficient memory to allocate the (de)compression state; errno | ||
683 | can be checked to distinguish the two cases (if errno is zero, the | ||
684 | zlib error is Z_MEM_ERROR). */ | ||
685 | |||
686 | ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | ||
687 | /* | ||
688 | gzdopen() associates a gzFile with the file descriptor fd. File | ||
689 | descriptors are obtained from calls like open, dup, creat, pipe or | ||
690 | fileno (in the file has been previously opened with fopen). | ||
691 | The mode parameter is as in gzopen. | ||
692 | The next call of gzclose on the returned gzFile will also close the | ||
693 | file descriptor fd, just like fclose(fdopen(fd), mode) closes the file | ||
694 | descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). | ||
695 | gzdopen returns NULL if there was insufficient memory to allocate | ||
696 | the (de)compression state. | ||
697 | */ | ||
698 | |||
699 | ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | ||
700 | /* | ||
701 | Dynamically update the compression level or strategy. See the description | ||
702 | of deflateInit2 for the meaning of these parameters. | ||
703 | gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not | ||
704 | opened for writing. | ||
705 | */ | ||
706 | |||
707 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | ||
708 | /* | ||
709 | Reads the given number of uncompressed bytes from the compressed file. | ||
710 | If the input file was not in gzip format, gzread copies the given number | ||
711 | of bytes into the buffer. | ||
712 | gzread returns the number of uncompressed bytes actually read (0 for | ||
713 | end of file, -1 for error). */ | ||
714 | |||
715 | ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | ||
716 | const voidp buf, unsigned len)); | ||
717 | /* | ||
718 | Writes the given number of uncompressed bytes into the compressed file. | ||
719 | gzwrite returns the number of uncompressed bytes actually written | ||
720 | (0 in case of error). | ||
721 | */ | ||
722 | |||
723 | ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); | ||
724 | /* | ||
725 | Converts, formats, and writes the args to the compressed file under | ||
726 | control of the format string, as in fprintf. gzprintf returns the number of | ||
727 | uncompressed bytes actually written (0 in case of error). | ||
728 | */ | ||
729 | |||
730 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | ||
731 | /* | ||
732 | Writes the given null-terminated string to the compressed file, excluding | ||
733 | the terminating null character. | ||
734 | gzputs returns the number of characters written, or -1 in case of error. | ||
735 | */ | ||
736 | |||
737 | ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | ||
738 | /* | ||
739 | Reads bytes from the compressed file until len-1 characters are read, or | ||
740 | a newline character is read and transferred to buf, or an end-of-file | ||
741 | condition is encountered. The string is then terminated with a null | ||
742 | character. | ||
743 | gzgets returns buf, or Z_NULL in case of error. | ||
744 | */ | ||
745 | |||
746 | ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); | ||
747 | /* | ||
748 | Writes c, converted to an unsigned char, into the compressed file. | ||
749 | gzputc returns the value that was written, or -1 in case of error. | ||
750 | */ | ||
751 | |||
752 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); | ||
753 | /* | ||
754 | Reads one byte from the compressed file. gzgetc returns this byte | ||
755 | or -1 in case of end of file or error. | ||
756 | */ | ||
757 | |||
758 | ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); | ||
759 | /* | ||
760 | Flushes all pending output into the compressed file. The parameter | ||
761 | flush is as in the deflate() function. The return value is the zlib | ||
762 | error number (see function gzerror below). gzflush returns Z_OK if | ||
763 | the flush parameter is Z_FINISH and all output could be flushed. | ||
764 | gzflush should be called only when strictly necessary because it can | ||
765 | degrade compression. | ||
766 | */ | ||
767 | |||
768 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, | ||
769 | z_off_t offset, int whence)); | ||
770 | /* | ||
771 | Sets the starting position for the next gzread or gzwrite on the | ||
772 | given compressed file. The offset represents a number of bytes in the | ||
773 | uncompressed data stream. The whence parameter is defined as in lseek(2); | ||
774 | the value SEEK_END is not supported. | ||
775 | If the file is opened for reading, this function is emulated but can be | ||
776 | extremely slow. If the file is opened for writing, only forward seeks are | ||
777 | supported; gzseek then compresses a sequence of zeroes up to the new | ||
778 | starting position. | ||
779 | |||
780 | gzseek returns the resulting offset location as measured in bytes from | ||
781 | the beginning of the uncompressed stream, or -1 in case of error, in | ||
782 | particular if the file is opened for writing and the new starting position | ||
783 | would be before the current position. | ||
784 | */ | ||
785 | |||
786 | ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); | ||
787 | /* | ||
788 | Rewinds the given file. This function is supported only for reading. | ||
789 | |||
790 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | ||
791 | */ | ||
792 | |||
793 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | ||
794 | /* | ||
795 | Returns the starting position for the next gzread or gzwrite on the | ||
796 | given compressed file. This position represents a number of bytes in the | ||
797 | uncompressed data stream. | ||
798 | |||
799 | gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) | ||
800 | */ | ||
801 | |||
802 | ZEXTERN int ZEXPORT gzeof OF((gzFile file)); | ||
803 | /* | ||
804 | Returns 1 when EOF has previously been detected reading the given | ||
805 | input stream, otherwise zero. | ||
806 | */ | ||
807 | |||
808 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | ||
809 | /* | ||
810 | Flushes all pending output if necessary, closes the compressed file | ||
811 | and deallocates all the (de)compression state. The return value is the zlib | ||
812 | error number (see function gzerror below). | ||
813 | */ | ||
814 | |||
815 | ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | ||
816 | /* | ||
817 | Returns the error message for the last error which occurred on the | ||
818 | given compressed file. errnum is set to zlib error number. If an | ||
819 | error occurred in the file system and not in the compression library, | ||
820 | errnum is set to Z_ERRNO and the application may consult errno | ||
821 | to get the exact error code. | ||
822 | */ | ||
823 | |||
824 | /* checksum functions */ | ||
825 | |||
826 | /* | ||
827 | These functions are not related to compression but are exported | ||
828 | anyway because they might be useful in applications using the | ||
829 | compression library. | ||
830 | */ | ||
831 | |||
832 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | ||
833 | |||
834 | /* | ||
835 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | ||
836 | return the updated checksum. If buf is NULL, this function returns | ||
837 | the required initial value for the checksum. | ||
838 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed | ||
839 | much faster. Usage example: | ||
840 | |||
841 | uLong adler = adler32(0L, Z_NULL, 0); | ||
842 | |||
843 | while (read_buffer(buffer, length) != EOF) { | ||
844 | adler = adler32(adler, buffer, length); | ||
845 | } | ||
846 | if (adler != original_adler) error(); | ||
847 | */ | ||
848 | |||
849 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | ||
850 | /* | ||
851 | Update a running crc with the bytes buf[0..len-1] and return the updated | ||
852 | crc. If buf is NULL, this function returns the required initial value | ||
853 | for the crc. Pre- and post-conditioning (one's complement) is performed | ||
854 | within this function so it shouldn't be done by the application. | ||
855 | Usage example: | ||
856 | |||
857 | uLong crc = crc32(0L, Z_NULL, 0); | ||
858 | |||
859 | while (read_buffer(buffer, length) != EOF) { | ||
860 | crc = crc32(crc, buffer, length); | ||
861 | } | ||
862 | if (crc != original_crc) error(); | ||
863 | */ | ||
864 | |||
865 | |||
866 | /* various hacks, don't look :) */ | ||
867 | |||
868 | /* deflateInit and inflateInit are macros to allow checking the zlib version | ||
869 | * and the compiler's view of z_stream: | ||
870 | */ | ||
871 | ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, | ||
872 | const char *version, int stream_size)); | ||
873 | ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, | ||
874 | const char *version, int stream_size)); | ||
875 | ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, | ||
876 | int windowBits, int memLevel, | ||
877 | int strategy, const char *version, | ||
878 | int stream_size)); | ||
879 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | ||
880 | const char *version, int stream_size)); | ||
881 | #define deflateInit(strm, level) \ | ||
882 | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) | ||
883 | #define inflateInit(strm) \ | ||
884 | inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) | ||
885 | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | ||
886 | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | ||
887 | (strategy), ZLIB_VERSION, sizeof(z_stream)) | ||
888 | #define inflateInit2(strm, windowBits) \ | ||
889 | inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) | ||
890 | |||
891 | |||
892 | #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) | ||
893 | struct internal_state {int dummy;}; /* hack for buggy compilers */ | ||
894 | #endif | ||
895 | |||
896 | ZEXTERN const char * ZEXPORT zError OF((int err)); | ||
897 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); | ||
898 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | ||
899 | |||
900 | #ifdef __cplusplus | ||
901 | } | ||
902 | #endif | ||
903 | |||
904 | #endif /* _ZLIB_H */ | ||
diff --git a/noncore/apps/opie-reader/ztxt.cpp b/noncore/apps/opie-reader/ztxt.cpp index 8091d32..79c5fa4 100644 --- a/noncore/apps/opie-reader/ztxt.cpp +++ b/noncore/apps/opie-reader/ztxt.cpp | |||
@@ -2,15 +2,16 @@ | |||
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include "ztxt.h" | 3 | #include "ztxt.h" |
4 | #include "my_list.h" | 4 | #include "my_list.h" |
5 | #include "Bkmks.h" | 5 | #include "Bkmks.h" |
6 | #include "static.h" | ||
6 | 7 | ||
7 | ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ } | 8 | ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ } |
8 | 9 | ||
9 | 10 | ||
10 | int ztxt::OpenFile(const char *src) | 11 | int ztxt::OpenFile(const char *src) |
11 | { | 12 | { |
12 | if (!Cpdb::openfile(src)) | 13 | if (!Cpdb::openpdbfile(src)) |
13 | { | 14 | { |
14 | return -1; | 15 | return -1; |
15 | } | 16 | } |
16 | 17 | ||
@@ -153,9 +154,21 @@ CList<Bkmk>* ztxt::getbkmklist() | |||
153 | { | 154 | { |
154 | zTXTbkmk bkmk; | 155 | zTXTbkmk bkmk; |
155 | if (fread(&bkmk, sizeof(bkmk), 1, fin) != 1) break; | 156 | if (fread(&bkmk, sizeof(bkmk), 1, fin) != 1) break; |
156 | // printf("Bookmark number:%d:%.20s\n", i, bkmk.title); | 157 | // printf("Bookmark number:%d:%.20s\n", i, bkmk.title); |
157 | t->push_back(Bkmk(bkmk.title, NULL, ntohl(bkmk.offset))); | 158 | tchar title[MAX_BMRK_LENGTH]; |
159 | for (int j = 0; j < MAX_BMRK_LENGTH; j++) | ||
160 | { | ||
161 | title[j] = bkmk.title[j]; | ||
162 | } | ||
163 | t->push_back(Bkmk(title, NULL, ntohl(bkmk.offset))); | ||
158 | } | 164 | } |
159 | fseek(fin, cur, SEEK_SET); | 165 | fseek(fin, cur, SEEK_SET); |
160 | return t; | 166 | return t; |
161 | } | 167 | } |
168 | |||
169 | #ifndef __STATIC | ||
170 | extern "C" | ||
171 | { | ||
172 | CExpander* newcodec() { return new ztxt; } | ||
173 | } | ||
174 | #endif | ||
diff --git a/noncore/apps/opie-reader/ztxt.h b/noncore/apps/opie-reader/ztxt.h index 709a055..f544b01 100644 --- a/noncore/apps/opie-reader/ztxt.h +++ b/noncore/apps/opie-reader/ztxt.h | |||
@@ -1,15 +1,14 @@ | |||
1 | #ifndef __ztxt_h | 1 | #ifndef __ztxt_h |
2 | #define __ztxt_h | 2 | #define __ztxt_h |
3 | 3 | ||
4 | #include "useqpe.h" | ||
5 | #include "CExpander.h" | 4 | #include "CExpander.h" |
6 | #include <zlib.h> | 5 | #include <zlib.h> |
7 | #include "pdb.h" | 6 | #include "pdb.h" |
8 | #ifdef _WINDOWS | 7 | #ifdef _WINDOWS |
9 | #include <winsock.h> | 8 | #include <winsock.h> |
10 | #endif | 9 | #endif |
11 | 10 | ||
12 | /* | 11 | /* |
13 | * Stuff common to both Weasel Reader and makeztxt | 12 | * Stuff common to both Weasel Reader and makeztxt |
14 | * | 13 | * |
15 | * $Id$ | 14 | * $Id$ |
@@ -21,9 +20,9 @@ | |||
21 | 20 | ||
22 | 21 | ||
23 | /* Padding is no good */ | 22 | /* Padding is no good */ |
24 | #if defined(__GNUC__) && defined(__UNIX__) | 23 | #if defined(__GNUC__) && defined(__UNIX__) |
25 | # pragma pack(2) | 24 | //# pragma pack(2) |
26 | #endif | 25 | #endif |
27 | 26 | ||
28 | /* The default creator is Weasel Reader 'GPlm' */ | 27 | /* The default creator is Weasel Reader 'GPlm' */ |
29 | #define GPLM_CREATOR_ID "GPlm" | 28 | #define GPLM_CREATOR_ID "GPlm" |
@@ -57,17 +56,17 @@ typedef struct zTXT_record0Type { | |||
57 | 56 | ||
58 | struct zTXTbkmk | 57 | struct zTXTbkmk |
59 | { | 58 | { |
60 | UInt32 offset; | 59 | UInt32 offset; |
61 | tchar title[MAX_BMRK_LENGTH]; | 60 | unsigned char title[MAX_BMRK_LENGTH]; |
62 | }; | 61 | }; |
63 | 62 | ||
64 | #endif | 63 | #endif |
65 | 64 | ||
66 | 65 | ||
67 | const UInt32 ZTXT_ID = 0x5458547a; | 66 | const UInt32 ZTXT_ID = 0x5458547a; |
68 | 67 | ||
69 | class ztxt : public CExpander, Cpdb | 68 | class ztxt : public Cpdb |
70 | { | 69 | { |
71 | bool bInit; | 70 | bool bInit; |
72 | UInt32 buffersize; | 71 | UInt32 buffersize; |
73 | UInt32 buffercontent; | 72 | UInt32 buffercontent; |
@@ -79,18 +78,9 @@ class ztxt : public CExpander, Cpdb | |||
79 | zTXT_record0 hdr0; | 78 | zTXT_record0 hdr0; |
80 | size_t currentpos; | 79 | size_t currentpos; |
81 | void home(); | 80 | void home(); |
82 | public: | 81 | public: |
83 | #ifdef USEQPE | 82 | QString about() { return QString("Weasel codec (c) Tim Wentford"); } |
84 | void suspend() | ||
85 | { | ||
86 | CExpander::suspend(fin); | ||
87 | } | ||
88 | void unsuspend() | ||
89 | { | ||
90 | CExpander::unsuspend(fin); | ||
91 | } | ||
92 | #endif | ||
93 | void sizes(unsigned long& _file, unsigned long& _text) | 83 | void sizes(unsigned long& _file, unsigned long& _text) |
94 | { | 84 | { |
95 | _file = file_length; | 85 | _file = file_length; |
96 | _text = ntohl(hdr0.size); | 86 | _text = ntohl(hdr0.size); |