summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Aportis.cpp109
-rw-r--r--noncore/apps/opie-reader/Aportis.h21
-rw-r--r--noncore/apps/opie-reader/AportisCodec.mak166
-rw-r--r--noncore/apps/opie-reader/AportisCodec.omak139
-rw-r--r--noncore/apps/opie-reader/AportisCodec.wmak127
-rw-r--r--noncore/apps/opie-reader/AportisCodec.wpro17
-rw-r--r--noncore/apps/opie-reader/AportisCodec.zmak127
-rw-r--r--noncore/apps/opie-reader/AportisCodec.zpro17
-rw-r--r--noncore/apps/opie-reader/AportisCodec/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/AportisCodec/AportisCodec.pro30
-rw-r--r--noncore/apps/opie-reader/BGType.h9
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp105
-rw-r--r--noncore/apps/opie-reader/Bkmks.h26
-rw-r--r--noncore/apps/opie-reader/BuffDoc.cpp428
-rw-r--r--noncore/apps/opie-reader/BuffDoc.h58
-rw-r--r--noncore/apps/opie-reader/ButtonPrefs.cpp181
-rw-r--r--noncore/apps/opie-reader/ButtonPrefs.h77
-rw-r--r--noncore/apps/opie-reader/CAnnoEdit.cpp121
-rw-r--r--noncore/apps/opie-reader/CAnnoEdit.h33
-rw-r--r--noncore/apps/opie-reader/CBuffer.h2
-rw-r--r--noncore/apps/opie-reader/CDrawBuffer.cpp400
-rw-r--r--noncore/apps/opie-reader/CDrawBuffer.h28
-rw-r--r--noncore/apps/opie-reader/CEncoding.cpp30
-rw-r--r--noncore/apps/opie-reader/CEncoding.h46
-rw-r--r--noncore/apps/opie-reader/CEncoding_tables.cpp1
-rw-r--r--noncore/apps/opie-reader/CExpander.cpp103
-rw-r--r--noncore/apps/opie-reader/CExpander.h193
-rw-r--r--noncore/apps/opie-reader/CFilter.cpp600
-rw-r--r--noncore/apps/opie-reader/CFilter.h289
-rw-r--r--noncore/apps/opie-reader/CHM.cpp380
-rw-r--r--noncore/apps/opie-reader/CHM.h68
-rw-r--r--noncore/apps/opie-reader/CHM.mak177
-rw-r--r--noncore/apps/opie-reader/CHM.omak140
-rw-r--r--noncore/apps/opie-reader/CHM.zmak140
-rw-r--r--noncore/apps/opie-reader/CHM.zpro16
-rw-r--r--noncore/apps/opie-reader/CHM/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/CHM/CHM.pro18
-rw-r--r--noncore/apps/opie-reader/CRegExp.cpp599
-rw-r--r--noncore/apps/opie-reader/CRegExp.h51
-rw-r--r--noncore/apps/opie-reader/CloseDialog.cpp5
-rw-r--r--noncore/apps/opie-reader/Filedata.h4
-rw-r--r--noncore/apps/opie-reader/FontControl.cpp10
-rw-r--r--noncore/apps/opie-reader/FontControl.h43
-rw-r--r--noncore/apps/opie-reader/GraphicWin.cpp122
-rw-r--r--noncore/apps/opie-reader/GraphicWin.h29
-rw-r--r--noncore/apps/opie-reader/HTMLFilter.mak170
-rw-r--r--noncore/apps/opie-reader/HTMLFilter.omak131
-rw-r--r--noncore/apps/opie-reader/HTMLFilter.wmak131
-rw-r--r--noncore/apps/opie-reader/HTMLFilter.wpro17
-rw-r--r--noncore/apps/opie-reader/HTMLFilter.zmak131
-rw-r--r--noncore/apps/opie-reader/HTMLFilter.zpro17
-rw-r--r--noncore/apps/opie-reader/HTMLFilter/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/HTMLFilter/HTMLFilter.pro20
-rw-r--r--noncore/apps/opie-reader/HTMLentities252
-rw-r--r--noncore/apps/opie-reader/Markups.h3
-rw-r--r--noncore/apps/opie-reader/Navigation.cpp79
-rw-r--r--noncore/apps/opie-reader/Navigation.h83
-rw-r--r--noncore/apps/opie-reader/PPMd.h53
-rw-r--r--noncore/apps/opie-reader/PPMdType.h81
-rw-r--r--noncore/apps/opie-reader/Palm2QImage.cpp64
-rw-r--r--noncore/apps/opie-reader/Palm2QImage.h2
-rw-r--r--noncore/apps/opie-reader/PluckerCodec.mak176
-rw-r--r--noncore/apps/opie-reader/PluckerCodec.omak138
-rw-r--r--noncore/apps/opie-reader/PluckerCodec.wmak138
-rw-r--r--noncore/apps/opie-reader/PluckerCodec.wpro16
-rw-r--r--noncore/apps/opie-reader/PluckerCodec.zmak138
-rw-r--r--noncore/apps/opie-reader/PluckerCodec.zpro16
-rw-r--r--noncore/apps/opie-reader/PluckerCodec/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/PluckerCodec/PluckerCodec.pro18
-rw-r--r--noncore/apps/opie-reader/Prefs.cpp463
-rw-r--r--noncore/apps/opie-reader/Prefs.h190
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp1890
-rw-r--r--noncore/apps/opie-reader/QTReader.h230
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp1902
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.h155
-rw-r--r--noncore/apps/opie-reader/Queue.h10
-rw-r--r--noncore/apps/opie-reader/StateData.h33
-rw-r--r--noncore/apps/opie-reader/StyleConsts.cpp16
-rw-r--r--noncore/apps/opie-reader/StyleConsts.h38
-rw-r--r--noncore/apps/opie-reader/ToolbarPrefs.cpp76
-rw-r--r--noncore/apps/opie-reader/ToolbarPrefs.h14
-rw-r--r--noncore/apps/opie-reader/URLDialog.cpp5
-rw-r--r--noncore/apps/opie-reader/WeaselCodec.mak166
-rw-r--r--noncore/apps/opie-reader/WeaselCodec.omak127
-rw-r--r--noncore/apps/opie-reader/WeaselCodec.wmak127
-rw-r--r--noncore/apps/opie-reader/WeaselCodec.wpro15
-rw-r--r--noncore/apps/opie-reader/WeaselCodec.zmak127
-rw-r--r--noncore/apps/opie-reader/WeaselCodec.zpro15
-rw-r--r--noncore/apps/opie-reader/WeaselCodec/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/WeaselCodec/WeaselCodec.pro17
-rw-r--r--noncore/apps/opie-reader/ZText.h39
-rw-r--r--noncore/apps/opie-reader/cbkmkselector.h2
-rw-r--r--noncore/apps/opie-reader/chm_lib.c1876
-rw-r--r--noncore/apps/opie-reader/chm_lib.h134
-rw-r--r--noncore/apps/opie-reader/codeclib.mak195
-rw-r--r--noncore/apps/opie-reader/codeclib.omak160
-rw-r--r--noncore/apps/opie-reader/codeclib.wmak160
-rw-r--r--noncore/apps/opie-reader/codeclib.wpro15
-rw-r--r--noncore/apps/opie-reader/codeclib.zmak160
-rw-r--r--noncore/apps/opie-reader/codeclib.zpro15
-rw-r--r--noncore/apps/opie-reader/codeclib/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/codeclib/codeclib.pro17
-rw-r--r--noncore/apps/opie-reader/ebookcodec.h120
-rw-r--r--noncore/apps/opie-reader/fileBrowser.cpp76
-rw-r--r--noncore/apps/opie-reader/fileBrowser.h4
-rwxr-xr-xnoncore/apps/opie-reader/hash.h201
-rw-r--r--noncore/apps/opie-reader/hrule.cpp11
-rw-r--r--noncore/apps/opie-reader/hrule.h8
-rw-r--r--noncore/apps/opie-reader/iSilo.cpp638
-rwxr-xr-xnoncore/apps/opie-reader/iSilo.h104
-rw-r--r--noncore/apps/opie-reader/iSiloCodec.mak162
-rw-r--r--noncore/apps/opie-reader/iSiloCodec.omak123
-rw-r--r--noncore/apps/opie-reader/iSiloCodec.wmak123
-rw-r--r--noncore/apps/opie-reader/iSiloCodec.wpro17
-rw-r--r--noncore/apps/opie-reader/iSiloCodec.zmak123
-rw-r--r--noncore/apps/opie-reader/iSiloCodec.zpro17
-rw-r--r--noncore/apps/opie-reader/iSiloCodec/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/iSiloCodec/iSiloCodec.pro19
-rw-r--r--noncore/apps/opie-reader/infowin.cpp54
-rw-r--r--noncore/apps/opie-reader/infowin.h37
-rw-r--r--noncore/apps/opie-reader/linktype.h8
-rw-r--r--noncore/apps/opie-reader/lzx.c811
-rw-r--r--noncore/apps/opie-reader/lzx.h62
-rw-r--r--noncore/apps/opie-reader/main.cpp2
-rw-r--r--noncore/apps/opie-reader/my_list.h12
-rw-r--r--noncore/apps/opie-reader/name.h8
-rw-r--r--noncore/apps/opie-reader/opie-reader.control2
-rw-r--r--noncore/apps/opie-reader/opie-reader.pro100
-rw-r--r--noncore/apps/opie-reader/opie.h6
-rw-r--r--noncore/apps/opie-reader/orkey.cpp134
-rw-r--r--noncore/apps/opie-reader/orkey.h68
-rw-r--r--noncore/apps/opie-reader/pdb.cpp38
-rw-r--r--noncore/apps/opie-reader/pdb.h14
-rw-r--r--noncore/apps/opie-reader/pdblib.mak161
-rw-r--r--noncore/apps/opie-reader/pdblib.omak122
-rw-r--r--noncore/apps/opie-reader/pdblib.wmak122
-rw-r--r--noncore/apps/opie-reader/pdblib.wpro14
-rw-r--r--noncore/apps/opie-reader/pdblib.zmak122
-rw-r--r--noncore/apps/opie-reader/pdblib.zpro14
-rw-r--r--noncore/apps/opie-reader/pdblib/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/pdblib/pdblib.pro16
-rw-r--r--noncore/apps/opie-reader/plucker.cpp98
-rw-r--r--noncore/apps/opie-reader/plucker.h9
-rw-r--r--noncore/apps/opie-reader/plucker_base.cpp448
-rw-r--r--noncore/apps/opie-reader/plucker_base.h36
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib.mak169
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib.omak131
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib.wmak131
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib.wpro14
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib.zmak131
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib.zpro14
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/pluckerbaselib/pluckerbaselib.pro18
-rw-r--r--noncore/apps/opie-reader/ppm.cpp1
-rw-r--r--noncore/apps/opie-reader/ppm_expander.cpp16
-rw-r--r--noncore/apps/opie-reader/ppm_expander.h3
-rw-r--r--noncore/apps/opie-reader/ppmsCodec.mak178
-rw-r--r--noncore/apps/opie-reader/ppmsCodec.omak141
-rw-r--r--noncore/apps/opie-reader/ppmsCodec.wmak141
-rw-r--r--noncore/apps/opie-reader/ppmsCodec.wpro17
-rw-r--r--noncore/apps/opie-reader/ppmsCodec.zmak141
-rw-r--r--noncore/apps/opie-reader/ppmsCodec.zpro17
-rw-r--r--noncore/apps/opie-reader/ppmsCodec/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/ppmsCodec/ppmsCodec.pro19
-rwxr-xr-xnoncore/apps/opie-reader/preferences.cpp105
-rw-r--r--noncore/apps/opie-reader/preferences.h27
-rw-r--r--noncore/apps/opie-reader/reader.mak591
-rw-r--r--noncore/apps/opie-reader/reader.omak605
-rw-r--r--noncore/apps/opie-reader/reader.staticmak846
-rw-r--r--noncore/apps/opie-reader/reader.staticpro108
-rw-r--r--noncore/apps/opie-reader/reader.staticzmak862
-rw-r--r--noncore/apps/opie-reader/reader.staticzpro108
-rw-r--r--noncore/apps/opie-reader/reader.wmak604
-rw-r--r--noncore/apps/opie-reader/reader.wpro93
-rw-r--r--noncore/apps/opie-reader/reader.zmak605
-rw-r--r--noncore/apps/opie-reader/reader.zpro95
-rw-r--r--noncore/apps/opie-reader/reader/.cvsignore5
-rw-r--r--noncore/apps/opie-reader/reader/reader.pro91
-rw-r--r--noncore/apps/opie-reader/setn.sh27
-rw-r--r--noncore/apps/opie-reader/seto.sh25
-rw-r--r--noncore/apps/opie-reader/setqt.sh30
-rw-r--r--noncore/apps/opie-reader/setws.sh27
-rw-r--r--noncore/apps/opie-reader/setz.sh25
-rw-r--r--noncore/apps/opie-reader/striphtml.cpp1249
-rw-r--r--noncore/apps/opie-reader/striphtml.h93
-rwxr-xr-xnoncore/apps/opie-reader/update-gcc3.sh47
-rwxr-xr-xnoncore/apps/opie-reader/update-opie.sh45
-rwxr-xr-xnoncore/apps/opie-reader/update.sh56
-rw-r--r--noncore/apps/opie-reader/useqpe.h3
-rw-r--r--noncore/apps/opie-reader/util.cpp36
-rw-r--r--noncore/apps/opie-reader/util.h57
-rw-r--r--noncore/apps/opie-reader/version.cpp20
-rw-r--r--noncore/apps/opie-reader/version.h4
-rw-r--r--noncore/apps/opie-reader/zlib/zconf.h279
-rw-r--r--noncore/apps/opie-reader/zlib/zlib.h904
-rw-r--r--noncore/apps/opie-reader/ztxt.cpp17
-rw-r--r--noncore/apps/opie-reader/ztxt.h18
197 files changed, 25233 insertions, 3618 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
@@ -1,374 +1,455 @@
#include <stdio.h>
#include <string.h>
#include "Aportis.h"
#include "my_list.h"
#include "Bkmks.h"
+#include "static.h"
Aportis::Aportis() : peanutfile(false) { /*printf("constructing:%x\n",fin);*/ }
void Aportis::dePeanut(int& ch)
{
if (peanutfile && ch != EOF)
{
unsigned char c = ch;
if (peanutfile) c ^= 0xa5;
ch = c;
}
}
CList<Bkmk>* Aportis::getbkmklist()
{
/*
if (peanutfile)
{
if (nRecs2 > nRecs)
{
CList<Bkmk>* t = new CList<Bkmk>;
for (int i = nRecs; i < nRecs2; i++)
{
char name[17];
name[16] = '\0';
-// odebug << "Record:" << i << ", Length:" << recordlength(i) << "" << oendl;
+// qDebug("Record:%d, Length:%u",i,recordlength(i));
gotorecordnumber(i);
fread(name,1,16,fin);
unsigned long lcn;
fread(&lcn,sizeof(lcn),1,fin);
lcn ^= 0xa5a5a5a5;
lcn = SwapLong(lcn);
-// odebug << "Bookmark:" << name << ":" << lcn << "" << oendl;
+// qDebug("Bookmark:%s:%u", name,lcn);
tchar tname[17];
memset(tname, 0, sizeof(tname));
for (int i = 0; name[i] != 0; i++)
{
tname[i] = name[i] ^ 0xa5;
}
t->push_back(Bkmk(tname, NULL, lcn));
}
return t;
}
else
{
return NULL;
}
}
*/
if (bCompressed != 4) return NULL;
CList<Bkmk>* t = new CList<Bkmk>;
size_t cur = ftell(fin);
for (int i = 0; i < nRecs2; i++)
{
DWORD dwPos;
fseek(fin, 0x56 + 8*i, SEEK_SET);
fread(&dwPos, 4, 1, fin);
dwPos = SwapLong(dwPos);
fseek(fin,dwPos,SEEK_SET);
unsigned char ch;
fread(&ch,1,1,fin);
if (ch != 241)
{
char name[17];
name[16] = '\0';
fseek(fin,dwPos,SEEK_SET);
fread(name,1,16,fin);
unsigned long lcn;
fread(&lcn,sizeof(lcn),1,fin);
lcn = SwapLong(lcn);
#ifdef _UNICODE
tchar tname[17];
memset(tname, 0, sizeof(tname));
for (int i = 0; name[i] != 0; i++)
{
tname[i] = name[i];
}
t->push_back(Bkmk(tname, NULL, lcn));
#else
t->push_back(Bkmk(name,lcn));
#endif
}
}
fseek(fin, cur, SEEK_SET);
return t;
}
int Aportis::OpenFile(const char *src)
{
// printf("In openfile\n");
int ret = 0;
+ html = false;
+ mobiimagerec = 0;
+ if (!Cpdb::openpdbfile(src)) return -1;
- if (!Cpdb::openfile(src)) return -1;
-
- if (head.creator != 0x64414552 // 'dAER'
- || head.type != 0x74584554) // 'tXET')
+ if (head.creator == 0x64414552 // 'dAER'
+ || head.type == 0x74584554) // 'tXET')
{
-
- if (memcmp(&head.creator, "PPrs", 4) == 0 && memcmp(&head.type, "PNRd", 4) == 0)
+ }
+ else if (memcmp(&head.creator, "PPrs", 4) == 0 && memcmp(&head.type, "PNRd", 4) == 0)
{
peanutfile = true;
}
+ else if (memcmp(&head.creator, "MOBI", 4) == 0 && memcmp(&head.type, "BOOK", 4) == 0)
+ {
+ html = true;
+ unsigned char vsn;
+ fseek(fin, recordpos(0)+39, SEEK_SET);
+ fread(&vsn, 1, sizeof(vsn), fin);
+ qDebug("Mobi version:%x", vsn);
+ if (vsn > 2)
+ {
+ fseek(fin, recordpos(0)+110, SEEK_SET);
+ fread(&mobiimagerec, 1, sizeof(mobiimagerec), fin);
+ mobiimagerec = ntohs(mobiimagerec)-1;
+ }
+ }
else
{
return -2;
}
- }
nRecs2 = nRecs = SwapWord(head.recordList.numRecords) - 1;
- fseek(fin,0,SEEK_END);
- dwLen = ftell(fin);
+
+ struct stat _stat;
+ stat(src,&_stat);
+ dwLen = _stat.st_size;
+
+ //fseek(fin,0,SEEK_END);
+ //dwLen = ftell(fin);
if (peanutfile)
{
PeanutHeader hdr0;
gotorecordnumber(0);
fread(&hdr0, sizeof(hdr0), 1, fin);
-// odebug << "Version:" << ntohs(hdr0.Version) << "" << oendl;
+// qDebug("Version:%x", ntohs(hdr0.Version));
if (hdr0.Version && 0x0200)
{
bCompressed = 2;
}
else
{
bCompressed = 1;
}
BlockSize = 4096;
nRecs = SwapWord(hdr0.Records)-1;
dwTLen = nRecs*BlockSize;
}
else
{
gotorecordnumber(0);
tDocRecord0 hdr0;
fread(&hdr0, sizeof(hdr0), 1, fin);
bCompressed = SwapWord(hdr0.wVersion);
if (bCompressed!=1 && bCompressed!=2 && bCompressed != 4) {
+ qDebug("ERROR:Unrecognised compression type in Aportis:%u", bCompressed);
ret = bCompressed;
bCompressed = 2;
}
switch (bCompressed)
{
case 4:
{
dwTLen = 0;
int i;
for (i = 0; i < nRecs; i++)
{
unsigned int bs = GetBS(i);
if (bs == 0) break;
else dwTLen += bs;
}
nRecs = i;
BlockSize = 0;
}
break;
case 1:
case 2:
default:
nRecs = SwapWord(hdr0.wNumRecs);
+ if (mobiimagerec == 0 || mobiimagerec > nRecs2) mobiimagerec = nRecs;
dwTLen = SwapLong(hdr0.dwStoryLen);
BlockSize = SwapWord(hdr0.wRecSize);
if (BlockSize == 0)
{
BlockSize = 4096;
printf("WARNING: Blocksize not set in source file\n");
}
}
}
-
+ qDebug("Mobi image rec:%u", mobiimagerec);
// this is the main record buffer
// it knows how to stretch to accomodate the decompress
currentrec = 0;
cbptr = 0;
outptr = 0;
refreshbuffer();
-// odebug << "Number of records:[" << nRecs << "," << nRecs2 << "]" << oendl;
+ if (!html)
+ {
+ int c;
+ char htmltag[] = "<HTML>";
+ char *p = htmltag;
+ while (1)
+ {
+ c = getch();
+ char ch = *p++;
+ if (ch == 0)
+ {
+ html = true;
+ break;
+ }
+ if (c != ch)
+ {
+ html = false;
+ break;
+ }
+ }
+ currentrec = 0;
+ cbptr = 0;
+ outptr = 0;
+ refreshbuffer();
+ }
+ /*
+ for (int i = 0; i < nRecs2; i++)
+ {
+ qDebug("Record:%u - %u bytes at position %x", i, recordlength(i), recordpos(i));
+ }
+ */
+
+ qDebug("Number of records:[%u,%u]", nRecs, nRecs2);
return ret;
}
int Aportis::getch()
{
if (bCompressed == 1)
{
if ((dwRecLen == 0) && !refreshbuffer()) return EOF;
else
{
int c = getc(fin);
dePeanut(c);
dwRecLen--;
currentpos++;
return c;
}
}
if (outptr != cbptr)
{
currentpos++;
return (circbuf[outptr = (outptr + 1) % 2048]);
}
if ((dwRecLen == 0) && !refreshbuffer()) return EOF;
currentpos++;
int c;
// take a char from the input buffer
c = getc(fin);
dePeanut(c);
dwRecLen--;
// separate the char into zones: 0, 1...8, 9...0x7F, 0x80...0xBF, 0xC0...0xFF
// codes 1...8 mean copy that many chars; for accented chars & binary
if (c == 0)
{
circbuf[outptr = cbptr = (cbptr+1)%2048] = c;
return c;
}
else if (c >= 0x09 && c <= 0x7F)
{
circbuf[outptr = cbptr = (cbptr+1)%2048] = c;
return c;
}
else if (c >= 0x01 && c <= 0x08)
{
dwRecLen -= c;
while(c--)
{
int c = getc(fin);
dePeanut(c);
circbuf[cbptr = (cbptr+1)%2048] = c;
}
return circbuf[outptr = (outptr+1)%2048];
}
else if (c >= 0x80 && c <= 0xBF)
{
int m,n;
c <<= 8;
int c1 = getc(fin);
dePeanut(c1);
c += c1;
dwRecLen--;
m = (c & 0x3FFF) >> COUNT_BITS;
n = c & ((1<<COUNT_BITS) - 1);
n += 3;
while (n--)
{
cbptr = (cbptr+1)%2048;
circbuf[cbptr] = circbuf[(cbptr+2048-m)%2048];
}
return circbuf[outptr = (outptr+1)%2048];
}
else if (c >= 0xC0 && c <= 0xFF)
{
circbuf[cbptr = (cbptr+1)%2048] = ' ';
circbuf[cbptr = (cbptr+1)%2048] = c^0x80;
return circbuf[outptr = (outptr+1)%2048];
}
}
unsigned int Aportis::GetBS(unsigned int bn)
{
DWORD dwPos;
WORD fs;
fseek(fin, 0x56 + 8*bn, SEEK_SET);
fread(&dwPos, 4, 1, fin);
dwPos = SwapLong(dwPos);
fseek(fin,dwPos,SEEK_SET);
// gotorecordnumber(bn+1);
unsigned char ch;
fread(&ch,1,1,fin);
if (ch == 241)
{
fread(&fs,sizeof(fs),1,fin);
fs = SwapWord(fs);
}
else
fs = 0;
return fs;
}
unsigned int Aportis::locate()
{
if (bCompressed == 4)
{
size_t cur = ftell(fin);
unsigned int clen = 0;
for (unsigned int i = 0; i < currentrec-1; i++)
{
unsigned int bs = GetBS(i);
if (bs == 0) break;
clen += bs;
}
fseek(fin,cur,SEEK_SET);
return clen+currentpos;
}
else
return (currentrec-1)*BlockSize+currentpos;
}
void Aportis::locate(unsigned int n)
{
unsigned int offset;
// currentrec = (n >> OFFBITS);
switch (bCompressed)
{
case 4:
{
DWORD clen = 0;
offset = n;
unsigned int i;
for (i = 0; i < nRecs; i++)
{
unsigned int bs = GetBS(i);
if (bs == 0) break;
clen += bs;
if (clen > n) break;
offset = n - clen;
}
currentrec = i;
}
break;
case 1:
case 2:
default:
currentrec = n / BlockSize;
offset = n % BlockSize;
}
outptr = cbptr;
refreshbuffer();
while (currentpos < offset && getch() != EOF);
}
bool Aportis::refreshbuffer()
{
if (currentrec < nRecs)
{
dwRecLen = recordlength(currentrec+1);
gotorecordnumber(currentrec+1);
if (bCompressed == 4)
{
unsigned char t[3];
fread(t,1,3,fin);
if (t[0] != 241)
{
printf("You shouldn't be here!\n");
return false;
}
dwRecLen -= 3;
}
/*
int n = fread(t.buf, 1, dwRecLen, fin);
t.len = n;
// if(bCompressed)
t.Decompress();
t.buf[t.Len()] = '\0';
*/
currentpos = 0;
currentrec++;
return true;
}
else {
return false;
}
}
+
+#include <qimage.h>
+
+QImage* Aportis::getPicture(unsigned long tgt)
+{
+ unsigned short tgtrec = tgt+mobiimagerec;
+ if (tgtrec > nRecs2) return NULL;
+ size_t cur = ftell(fin);
+ unsigned short reclen = recordlength(tgtrec);
+ gotorecordnumber(tgtrec);
+ UInt8* imgbuffer = new UInt8[reclen];
+ fread(imgbuffer, 1, reclen, fin);
+ QByteArray arr;
+ arr.assign((const char*)imgbuffer, reclen);
+
+ QImage* qimage = new QImage(arr);
+ fseek(fin, cur, SEEK_SET);
+
+ return qimage;
+}
+
+#ifndef __STATIC
+extern "C"
+{
+ CExpander* newcodec() { return new Aportis; }
+}
+#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
@@ -1,110 +1,103 @@
/*
Derived from makedoc9 by Pat Beirne
*/
#ifndef __Aportis_h
#define __Aportis_h
-#include "useqpe.h"
#include "CExpander.h"
#include "pdb.h"
typedef UInt32 DWORD;
typedef UInt16 WORD;
#define DISP_BITS 11
#define COUNT_BITS 3
/*
// all numbers in these structs are big-endian, MAC format
struct tDocHeader {
char sName[32];
DWORD dwUnknown1;
DWORD dwTime1;
DWORD dwTime2;
DWORD dwTime3;
DWORD dwLastSync;
DWORD ofsSort;
DWORD ofsCatagories;
DWORD dwCreator;
DWORD dwType;
DWORD dwUnknown2;
DWORD dwUnknown3;
WORD wNumRecs;
};
*/
struct tDocRecord0 {
WORD wVersion; // 1=plain text, 2=compressed
WORD wSpare;
DWORD dwStoryLen; // in chars, when decompressed
WORD wNumRecs; // text records only; equals tDocHeader.wNumRecs-1
WORD wRecSize; // usually 0x1000
DWORD dwSpare2;
};
struct PeanutHeader
{
UInt16 Version;
UInt8 Junk1[6];
UInt16 Records;
UInt8 Junk2[106];
};
////////////// utilities //////////////////////////////////////
inline WORD SwapWord(WORD r)
{
return (r>>8) + (r<<8);
}
inline DWORD SwapLong(DWORD r)
{
return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000);
}
-class Aportis : public CExpander, Cpdb {
- bool peanutfile;
+class Aportis : public Cpdb {
+ bool peanutfile, html;
void dePeanut(int&);
DWORD dwLen;
WORD nRecs2;
DWORD dwTLen;
WORD nRecs;
WORD BlockSize;
DWORD dwRecLen;
+ WORD mobiimagerec;
int currentrec, currentpos;
unsigned int cbptr;
unsigned int outptr;
unsigned char circbuf[2048];
char bCompressed;
public:
-#ifdef USEQPE
- void suspend()
- {
- CExpander::suspend(fin);
- }
- void unsuspend()
- {
- CExpander::unsuspend(fin);
- }
-#endif
void sizes(unsigned long& _file, unsigned long& _text)
{
+ qDebug("Calling aportis sizes:(%u,%u,%u)", dwTLen, nRecs, BlockSize);
_file = dwLen;
_text = dwTLen;
}
bool hasrandomaccess() { return true; }
virtual ~Aportis() {}
Aportis();
int OpenFile(const char *src);
int getch();
unsigned int locate();
void locate(unsigned int n);
CList<Bkmk>* getbkmklist();
MarkupType PreferredMarkup()
{
- return (peanutfile) ? cPML : cTEXT;
+ return (peanutfile) ? cPML : ((html) ? cHTML : cTEXT);
}
+ QImage* getPicture(unsigned long);
+ QString about() { return QString("AportisDoc codec (c) Tim Wentford"); }
private:
bool refreshbuffer();
unsigned int GetBS(unsigned int bn);
};
#endif
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 @@
+#############################################################################
+# Makefile for building: libAportis.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:36:46 2004
+# Project: AportisCodec.pro
+# Template: lib
+# Command: $(QMAKE) -o AportisCodec.mak AportisCodec.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libAportis.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = Aportis.cpp
+OBJECTS = QREADEROBJS/Aportis.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = AportisCodec.pro
+QMAKE_TARGET = Aportis
+DESTDIR = $(READERDIR)/codecs/
+TARGET = libAportis.so.1.0.0
+TARGETA = $(READERDIR)/codecs/libAportis.a
+TARGETD = libAportis.so.1.0.0
+TARGET0 = libAportis.so
+TARGET1 = libAportis.so.1
+TARGET2 = libAportis.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: AportisCodec.mak $(READERDIR)/codecs/$(TARGET)
+
+$(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+AportisCodec.mak: AportisCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o AportisCodec.mak AportisCodec.pro
+qmake:
+ @$(QMAKE) -o AportisCodec.mak AportisCodec.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/Aportis.o: Aportis.cpp Aportis.h \
+ my_list.h \
+ Bkmks.h \
+ QREADERINC/static.h \
+ CExpander.h \
+ pdb.h \
+ QREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ Filedata.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Aportis.o Aportis.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libAportis.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: AportisCodec.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libAportis.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h \
+ CExpander.h \
+ OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h
+SOURCES = Aportis.cpp
+OBJECTS = OREADEROBJS/Aportis.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libAportis.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libAportis.a
+TARGETD = libAportis.so.1.0.0
+TARGET0 = libAportis.so
+TARGET1 = libAportis.so.1
+TARGET2 = libAportis.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: AportisCodec.omak
+
+AportisCodec.omak: AportisCodec.opro
+ tmake AportisCodec.opro -o AportisCodec.omak
+
+dist:
+ $(TAR) AportisCodec.opro.tar AportisCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) AportisCodec.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/Aportis.o: Aportis.cpp \
+ Aportis.h \
+ CExpander.h \
+ OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ OREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Aportis.o Aportis.cpp
+
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 @@
+#############################################################################
+# Makefile for building libAportis.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: AportisCodec.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libAportis.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = Aportis.cpp
+OBJECTS = WSREADEROBJS/Aportis.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libAportis.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libAportis.a
+TARGETD = libAportis.so.1.0.0
+TARGET0 = libAportis.so
+TARGET1 = libAportis.so.1
+TARGET2 = libAportis.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: AportisCodec.wmak
+
+AportisCodec.wmak: AportisCodec.wpro
+ tmake AportisCodec.wpro -o AportisCodec.wmak
+
+dist:
+ $(TAR) AportisCodec.wpro.tar AportisCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) AportisCodec.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/Aportis.o: Aportis.cpp \
+ Aportis.h \
+ CExpander.h \
+ WSREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ WSREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Aportis.o Aportis.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = Aportis.h
+
+SOURCES = Aportis.cpp
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = Aportis
+LIBS += -lreader_pdb -lreader_codec
+
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libAportis.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: AportisCodec.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libAportis.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = Aportis.cpp
+OBJECTS = ZREADEROBJS/Aportis.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libAportis.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libAportis.a
+TARGETD = libAportis.so.1.0.0
+TARGET0 = libAportis.so
+TARGET1 = libAportis.so.1
+TARGET2 = libAportis.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libAportis.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: AportisCodec.zmak
+
+AportisCodec.zmak: AportisCodec.zpro
+ tmake AportisCodec.zpro -o AportisCodec.zmak
+
+dist:
+ $(TAR) AportisCodec.zpro.tar AportisCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) AportisCodec.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/Aportis.o: Aportis.cpp \
+ Aportis.h \
+ CExpander.h \
+ ZREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ ZREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Aportis.o Aportis.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = Aportis.h
+
+SOURCES = Aportis.cpp
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = Aportis
+LIBS += -lreader_pdb -lreader_codec
+
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = Aportis.h \
+ CExpander.h \
+ ../OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h
+
+SOURCES = Aportis.cpp
+
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/codecs
+TARGET = Aportis
+LIBS += -lreader_pdb -lreader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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 @@
+#ifndef __BGTYPE_H
+#define __BGTYPE_H
+enum bground
+ {
+ bgCentred,
+ bgTiled,
+ bgStretched
+ };
+#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,320 +1,399 @@
#include <qmessagebox.h>
#include "Bkmks.h"
+#include "StyleConsts.h"
+#include "Markups.h"
#include "my_list.h"
#include "version.h"
#include "names.h"
const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE);
-Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p) : m_position(_p)
+Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p)
{
init(_nm, _nmlen, _anno, _annolen, _p);
}
Bkmk::Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short annolen, unsigned int _p) : m_position(_p)
{
init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, annolen, _p);
}
Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p)
{
+ if (_anno == NULL)
+ {
+ tchar t = 0;
+ init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p);
+ }
+ else
+ {
+ init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p);
+ }
+}
+Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2) : m_position(_p)
+{
if (_anno == NULL)
{
tchar t = 0;
init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p);
}
else
{
init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p);
}
+ m_position2 = _p2;
+ m_red = m_green = m_blue = 127;
}
void Bkmk::init(const void* _nm, unsigned short _nmlen, const void* _anno, unsigned short _annolen, unsigned int _p)
{
m_namelen = _nmlen;
if (m_namelen > 0)
{
m_name = new unsigned char[m_namelen];
memcpy(m_name, _nm, m_namelen);
}
else
{
m_name = NULL;
}
m_annolen = _annolen;
if (m_annolen > 0)
{
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, _anno, m_annolen);
}
else
{
m_anno = NULL;
}
m_position = _p;
+ m_position2 = _p;
+ m_red = m_green = m_blue = 255;
+ m_level = 0;
}
Bkmk::~Bkmk()
{
if (m_name != NULL) delete [] m_name;
m_name = NULL;
if (m_anno != NULL) delete [] m_anno;
m_anno = NULL;
}
Bkmk& Bkmk::operator=(const Bkmk& rhs)
{
if (m_name != NULL)
{
delete [] m_name;
m_name = NULL;
}
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (rhs.m_name != NULL)
{
m_namelen = rhs.m_namelen;
m_name = new unsigned char[m_namelen];
memcpy(m_name, rhs.m_name, m_namelen);
}
else
m_name = NULL;
if (rhs.m_anno != NULL)
{
m_annolen = rhs.m_annolen;
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, rhs.m_anno, m_annolen);
}
else
m_anno = NULL;
m_position = rhs.m_position;
+ m_position2 = rhs.m_position2;
+ m_red = rhs.m_red;
+ m_green = rhs.m_green;
+ m_blue = rhs.m_blue;
+ m_level = rhs.m_level;
return *this;
}
bool Bkmk::operator==(const Bkmk& rhs)
{
- return (m_position == rhs.m_position && (rhs.m_namelen == m_namelen) && memcmp(m_name,rhs.m_name,m_namelen) == 0);
+ 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);
}
void Bkmk::setAnno(unsigned char* t, unsigned short len)
{
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (t != NULL)
{
m_annolen = len;
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, t, m_annolen);
}
else
{
m_annolen = sizeof(tchar);
m_anno = new unsigned char[m_annolen];
*((tchar*)m_anno) = 0;
}
}
void Bkmk::setAnno(tchar* t)
{
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (t != NULL)
{
unsigned short len = ustrlen(t)+1;
m_annolen = sizeof(tchar)*len;
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, t, m_annolen);
}
else
{
m_annolen = sizeof(tchar);
m_anno = new unsigned char[m_annolen];
*((tchar*)m_anno) = 0;
}
}
-BkmkFile::BkmkFile(const char *fnm, bool w)
+BkmkFile::BkmkFile(const char *fnm, bool w, bool _x)
:
- wt(w), isUpgraded(false)
+ wt(w), isUpgraded(false), m_extras(_x)
{
if (w)
{
f = fopen(fnm, "wb");
}
else
{
f = fopen(fnm, "rb");
}
}
BkmkFile::~BkmkFile()
{
if (f != NULL) fclose(f);
}
void BkmkFile::write(const Bkmk& b)
{
if (f != NULL)
{
fwrite(&b.m_namelen, sizeof(b.m_namelen),1,f);
fwrite(b.m_name,1,b.m_namelen,f);
fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f);
fwrite(b.m_anno,1,b.m_annolen,f);
fwrite(&b.m_position,sizeof(b.m_position),1,f);
+ if (m_extras)
+ {
+ fwrite(&b.m_position2,sizeof(b.m_position2),1,f);
+ fwrite(&b.m_red,sizeof(b.m_red),1,f);
+ fwrite(&b.m_green,sizeof(b.m_green),1,f);
+ fwrite(&b.m_blue,sizeof(b.m_blue),1,f);
+ fwrite(&b.m_level,sizeof(b.m_level),1,f);
+ }
}
}
void BkmkFile::write(CList<Bkmk>& bl)
{
if (f != NULL)
{
fwrite(&magic, sizeof(magic), 1, f);
for (CList<Bkmk>::iterator i = bl.begin(); i != bl.end(); i++)
{
write(*i);
}
}
}
CList<Bkmk>* BkmkFile::readall()
{
CList<Bkmk>* bl = NULL;
if (f != NULL)
{
unsigned long newmagic;
fread(&newmagic, sizeof(newmagic), 1, f);
if ((newmagic & 0xffffff00) != (magic & 0xffffff00))
{
if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of " PROGNAME "\ndid you upgrade from?", "0_4*", "Any other version") == 0)
{
fseek(f,0,SEEK_SET);
bl = readall00(&read05);
}
else
{
fseek(f,0,SEEK_SET);
bl = readall00(&read03);
}
isUpgraded = true;
}
else
{
switch(newmagic & 0xff)
{
- case 6:
+ case 7:
isUpgraded = false;
+ bl = readall00(read07);
+// qDebug("Correct version!");
+ break;
+ case 6:
+ isUpgraded = true;
bl = readall00(read06);
-// odebug << "Correct version!" << oendl;
+// qDebug("Correct version!");
break;
case 5:
isUpgraded = true;
bl = readall00(read05);
-// odebug << "Known version!" << oendl;
+// qDebug("Known version!");
break;
default:
-// odebug << "Unknown version!" << oendl;
+// qDebug("Unknown version!");
isUpgraded = true;
bl = readall00(read05);
}
}
}
return bl;
}
-CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(FILE*))
+CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(BkmkFile*, FILE*))
{
CList<Bkmk>* bl = new CList<Bkmk>;
while (1)
{
- Bkmk* b = (*readfn)(f);
+ Bkmk* b = (*readfn)(this, f);
if (b == NULL) break;
bl->push_back(*b);
delete b;
}
return bl;
}
-Bkmk* BkmkFile::read03(FILE* f)
+Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f)
{
Bkmk* b = NULL;
if (f != NULL)
{
unsigned short ln;
if (fread(&ln,sizeof(ln),1,f) == 1)
{
tchar* name = new tchar[ln+1];
fread(name,sizeof(tchar),ln,f);
name[ln] = 0;
ln = 0;
tchar* anno = new tchar[ln+1];
anno[ln] = 0;
unsigned int pos;
fread(&pos,sizeof(pos),1,f);
b = new Bkmk(name,anno,pos);
}
}
return b;
}
-Bkmk* BkmkFile::read05(FILE* f)
+Bkmk* BkmkFile::read05(BkmkFile* /*_this*/, FILE* f)
{
Bkmk* b = NULL;
if (f != NULL)
{
unsigned short ln;
if (fread(&ln,sizeof(ln),1,f) == 1)
{
tchar* nm = new tchar[ln+1];
fread(nm,sizeof(tchar),ln,f);
nm[ln] = 0;
fread(&ln,sizeof(ln),1,f);
tchar* anno = new tchar[ln+1];
if (ln > 0) fread(anno,sizeof(tchar),ln,f);
anno[ln] = 0;
unsigned int pos;
fread(&pos,sizeof(pos),1,f);
b = new Bkmk(nm,anno,pos);
}
}
return b;
}
-Bkmk* BkmkFile::read06(FILE* f)
+Bkmk* BkmkFile::read06(BkmkFile* /*_this*/, FILE* f)
+{
+ Bkmk* b = NULL;
+ if (f != NULL)
+ {
+ unsigned short ln;
+ if (fread(&ln,sizeof(ln),1,f) == 1)
+ {
+ b = new Bkmk;
+ b->m_namelen = ln;
+ b->m_name = new unsigned char[b->m_namelen];
+ fread(b->m_name,1,b->m_namelen,f);
+
+ fread(&(b->m_annolen),sizeof(b->m_annolen),1,f);
+ if (b->m_annolen > 0)
+ {
+ b->m_anno = new unsigned char[b->m_annolen];
+ fread(b->m_anno,1,b->m_annolen,f);
+ }
+ fread(&(b->m_position),sizeof(b->m_position),1,f);
+ b->m_position2 = b->m_position+b->m_namelen-1;
+ b->m_red = b->m_green = b->m_blue = 127;
+ b->m_level = 0;
+ }
+ }
+ return b;
+}
+
+Bkmk* BkmkFile::read07(BkmkFile* _this, FILE* f)
{
Bkmk* b = NULL;
if (f != NULL)
{
unsigned short ln;
if (fread(&ln,sizeof(ln),1,f) == 1)
{
b = new Bkmk;
b->m_namelen = ln;
b->m_name = new unsigned char[b->m_namelen];
fread(b->m_name,1,b->m_namelen,f);
fread(&(b->m_annolen),sizeof(b->m_annolen),1,f);
if (b->m_annolen > 0)
{
b->m_anno = new unsigned char[b->m_annolen];
fread(b->m_anno,1,b->m_annolen,f);
}
fread(&(b->m_position),sizeof(b->m_position),1,f);
+ if (_this->m_extras)
+ {
+ fread(&(b->m_position2),sizeof(b->m_position2),1,f);
+ fread(&(b->m_red),sizeof(b->m_red),1,f);
+ fread(&(b->m_green),sizeof(b->m_green),1,f);
+ fread(&(b->m_blue),sizeof(b->m_blue),1,f);
+ fread(&(b->m_level),sizeof(b->m_level),1,f);
+ }
+ else
+ {
+ b->m_position2 = b->m_position;
+ b->m_red = b->m_green = b->m_blue = 255;
+ b->m_level = 0;
+ }
}
}
return b;
}
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
@@ -1,70 +1,84 @@
#ifndef __Bkmks_h
#define __Bkmks_h
#include "config.h"
#include "Filedata.h"
#include <stdio.h>
template<class T>
class CList;
class Bkmk
{
friend class BkmkFile;
unsigned char* m_name;
unsigned short m_namelen;
unsigned char* m_anno;
unsigned short m_annolen;
unsigned int m_position;
+ unsigned int m_position2;
+ unsigned char m_red,m_green,m_blue, m_level;
void init(const void*, unsigned short, const void*, unsigned short, unsigned int);
public:
Bkmk() : m_name(NULL), m_namelen(0), m_anno(NULL), m_annolen(0), m_position(0) {};
Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p);
Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short _annolen, unsigned int _p);
Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p);
+ Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2);
Bkmk(const Bkmk& rhs) : m_name(NULL), m_anno(NULL)
{
*this = rhs;
}
~Bkmk();
unsigned int value() const { return m_position; }
void value(unsigned int _v) { m_position = _v; }
+ unsigned int value2() const { return m_position2; }
+ void value2(unsigned int _v) { m_position2 = _v; }
+ unsigned char red() { return m_red; }
+ unsigned char green() { return m_green; }
+ unsigned char blue() { return m_blue; }
+ void red(unsigned char _v) { m_red = _v; }
+ void green(unsigned char _v) { m_green = _v; }
+ void blue(unsigned char _v) { m_blue = _v; }
+ unsigned char level() { return m_level; }
+ void level(unsigned char _v) { m_level = _v; }
tchar *name() const { return (tchar*)m_name; }
tchar *anno() const { return (tchar*)m_anno; }
bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); }
Bkmk& operator=(const Bkmk& rhs);
bool operator==(const Bkmk& rhs);
void setAnno(tchar* t);
void setAnno(unsigned char* t, unsigned short len);
unsigned char* filedata()
{
CFiledata fd(anno());
return m_anno+fd.length();
}
unsigned short filedatalen()
{
CFiledata fd(anno());
return m_annolen - fd.length();
}
};
class BkmkFile
{
FILE* f;
bool wt;
- bool isUpgraded;
+ bool isUpgraded, m_extras;
static const unsigned long magic;
private:
- static Bkmk* read06(FILE*);
- static Bkmk* read05(FILE*);
- static Bkmk* read03(FILE*);
- CList<Bkmk>* readall00(Bkmk*(*fn)(FILE*));
+ static Bkmk* read07(BkmkFile*, FILE*);
+ static Bkmk* read06(BkmkFile*, FILE*);
+ static Bkmk* read05(BkmkFile*, FILE*);
+ static Bkmk* read03(BkmkFile*, FILE*);
+ CList<Bkmk>* readall00(Bkmk*(*fn)(BkmkFile*, FILE*));
void write(const Bkmk& b);
public:
bool upgraded() { return isUpgraded; }
- BkmkFile(const char *fnm, bool w = false);
+ BkmkFile(const char *fnm, bool w, bool _x);
~BkmkFile();
void write(CList<Bkmk>& bl);
CList<Bkmk>* readall();
};
#endif
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,412 +1,710 @@
+#include "static.h"
+#include "names.h"
#define NEWLINEBREAK
+#define INCREMENTALWIDTH
+#include "useqpe.h"
+#include "usenef.h"
#include "BuffDoc.h"
-//#include <FL/fl_draw.h>
+#include "config.h"
+#include "CDrawBuffer.h"
+#include "ZText.h"
+#include "ebookcodec.h"
+
+#ifdef __STATIC
+#include "Aportis.h"
+#include "CHM.h"
+#include "ppm_expander.h"
+#include "ztxt.h"
#include "plucker.h"
#ifdef USENEF
#include "nef.h"
#include "arrierego.h"
#endif
+#include "iSilo.h"
+#endif
+
-linkType BuffDoc::hyperlink(unsigned int n, QString& wrd)
+linkType BuffDoc::hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm)
{
linkType bRet = eNone;
if (exp != NULL)
{
- bRet = exp->hyperlink(n, wrd);
- if (bRet == eLink)
+ bRet = filt->hyperlink(n, noff, wrd, nm);
+ if ((bRet & eLink) != 0)
{
lastword.empty();
lastsizes[0] = laststartline = n;
#ifdef NEWLINEBREAK
- lastispara = true;
+ lastispara = false;
#else
lastispara = false;
#endif
lastsizes[0] = laststartline = exp->locate();
}
}
return bRet;
}
void BuffDoc::locate(unsigned int n)
{
- // //odebug << "BuffDoc:locating:" << n << "" << oendl;
+ // //qDebug("BuffDoc:locating:%u",n);
lastword.empty();
lastsizes[0] = laststartline = n;
#ifdef NEWLINEBREAK
- lastispara = true;
+ lastispara = false;
#else
lastispara = false;
#endif
// tchar linebuf[1024];
- if (exp != NULL) exp->locate(n);
- // //odebug << "BuffDoc:Located" << oendl;
+ if (exp != NULL) filt->locate(n);
+ // //qDebug("BuffDoc:Located");
+}
+
+static bool isletter(unsigned short c)
+{
+ if ('a' <= c && c <= 'z') return true;
+ if ('A' <= c && c <= 'Z') return true;
+ // Cyrillic letters
+ if (0x400 <= c && c <= 0x52F) return true;
+ return false;
+}
+
+static bool isvowel(unsigned short c) // Only want lower case vowels
+{
+ switch (c)
+ {
+ case 'a':
+ case 'e':
+ case 'i':
+ case 'o':
+ case 'u':
+ // Cyrillic vowels
+ case 0x430:
+ case 0x435:
+ case 0x438:
+ case 0x43E:
+ case 0x443:
+ case 0x44B:
+ case 0x44D:
+ case 0x44E:
+ case 0x44F:
+ case 0x451:
+
+ case 0x450:
+ case 0x454:
+ case 0x456:
+ case 0x457:
+ case 0x45D:
+
+ case 0x463:
+
+ case 0x4AF:
+ case 0x4B1:
+ case 0x4D1:
+ case 0x4D3:
+
+ case 0x4D5:
+ case 0x4D7:
+ case 0x4E3:
+ case 0x4E5:
+ case 0x4E7:
+ case 0x4E9:
+ case 0x4EB:
+ case 0x4ED:
+ case 0x4EF:
+ case 0x4F1:
+ case 0x4F3:
+ case 0x4F9:
+ return true;
+ default:
+ return ((0xe0 <= c) && (c <= 0xfc) && (c != 0xf1) && (c != 0xf7) && (c != 0xe7));
+ }
+}
+
+inline bool isconsonant(unsigned short c)
+{
+ switch( c )
+ {
+ // Some cyrillic letters are neither vowels, nor consonants, or otherwise
+ // the letters no word can start from.
+ case 0x439:
+ case 0x44A:
+ case 0x44C:
+
+ case 0x45E:
+
+ return false;
+
+ default:
+ return (isletter(c) && !isvowel(c));
+ }
+ return (isletter(c) && !isvowel(c));
}
#ifdef NEWLINEBREAK
-bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border)
+bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht)
{
bool moreleft = true;
bool margindone = false;
- int w = wth-2*_border;
+ int isCentred = -1;
+ int w = wth-(_lborder+_rborder);
tchar ch = 32;
CStyle cs;
buff->empty();
if (exp == NULL)
{
buff->empty();
buff->setEof();
return false;
}
int len = 0;
if (lastword.length() > 0)
{
+ if (isCentred < 0)
+ {
+ isCentred = (lastword.firststyle().getJustify() == m_AlignCentre) ? 1 : 0;
+ }
*buff = lastword;
cs = lastword.laststyle();
w -= buff->leftMargin() + buff->rightMargin();
margindone = true;
len = lastword.length();
}
else buff->empty();
lastword.empty();
- unsigned int slen = buff->width(len);
+ unsigned int slen = buff->width(availht, len);
if (lastispara) buff->setstartpara();
+ int nospaces = 0;
while (1)
{
- lastsizes[len] = exp->locate();
- getch(ch, cs);
+ getch(ch, cs, lastsizes[len]);
+ if (isCentred < 0)
+ {
+ isCentred = (cs.getJustify() == m_AlignCentre) ? 1 : 0;
+ }
if (ch == 10 && len == 0 && !lastispara)
{
- lastsizes[len] = exp->locate();
- getch(ch, cs);
+ getch(ch, cs, lastsizes[len]);
+ buff->setstartpara();
}
if (ch == UEOF)
{
+ buff->setendpara(cs);
if (len == 0)
{
buff->setEof();
moreleft = false;
}
laststartline = exp->locate();
break;
}
if (ch == 10)
{
- buff->setendpara();
+ buff->setendpara(cs);
+ lastispara = true;
+ laststartline = exp->locate();
+ break;
+ }
+ if (ch == 6)
+ {
+ buff->setendpara(cs);
+ buff->setBop();
lastispara = true;
laststartline = exp->locate();
break;
}
lastispara = false;
buff->addch(ch, cs);
+ if (ch == ' ')
+ {
+ nospaces++;
+ }
len++;
if (!margindone)
{
w -= buff->leftMargin() + buff->rightMargin();
margindone = true;
}
- if ((slen = buff->width(len)) > w)
+#ifdef INCREMENTALWIDTH
+ if ((slen += buff->charwidth(len-1, cs)) > w)
+#else
+ if ((slen = buff->width(availht, len)) > w)
+#endif
{
if (ch == ' ' || len == 1)
{
if (ch == ' ') buff->truncate(len-1);
laststartline = exp->locate();
break;
}
else // should do a backward search for spaces, first.
{
+ int lastk = len-4;
for (int i = len-2; i > 0; i--)
{
- if ((*buff)[i] == ' ')
+ if (
+ (((*buff)[i] == 0x2014) && isletter((*buff)[i+1]))
+ ||
+ ((*buff)[i] == '-')
+ // ((*buff)[i] == '-' && !(((*buff)[i-1] == '-') || ((*buff)[i+1] == '-')))
+)
{
(*buff)[len] = 0;
lastword.setright(*buff, i+1);
- buff->truncate(i);
- (*buff)[i] = '\0';
+ buff->truncate(i+1);
+ (*buff)[i+1] = '\0';
laststartline = lastsizes[i+1];
- buff->resize();
+ // buff->resize();
for (int j = 0; j < lastword.length(); j++)
{
lastsizes[j] = lastsizes[j+i+1];
}
return true;
}
- if ((*buff)[i] == '-' && !(((*buff)[i-1] == '-') || ((*buff)[i+1] == '-')))
+
+ //if (hyphenate && (m_hyphenthreshold+1)*i < m_hyphenthreshold*len)
+ // We end up with i+1 characters instead of len-1
+ // Thus we are removing len - 1 - (i + 1) = len-i-2
+ // The space characters will be stretched to cover
+ // nospaces to nospaces + len - i - 2
+ // The stretch factor is hence
+ // (nospaces+len-i-2)/nospaces
+ if (hyphenate && !isCentred && ( 100*(nospaces+len-i-2) > (100+m_hyphenthreshold)*nospaces ))
+ {
+ /*
+ if (m_customhyphen)
+ {
+ for (int k = lastk; k >= i && k >= 2; k--)
+ {
+ if (
+ isletter((*buff)[k+3])
+ &&
+ isletter((*buff)[k+2])
+ &&
+ isvowel((*buff)[k+1])
+ &&
+ isconsonant((*buff)[k])
+ &&
+ isletter((*buff)[k-1])
+ &&
+ isletter((*buff)[k-2])
+ )
+ {
+ (*buff)[len] = 0;
+ lastword.setright(*buff, k+1);
+ buff->truncate(k+2);
+ (*buff)[k+1] = '-';
+ (*buff)[k+2] = '\0';
+ laststartline = lastsizes[k+1];
+ buff->resize();
+ for (int j = 0; j < lastword.length(); j++)
+ {
+ lastsizes[j] = lastsizes[j+k+1];
+ }
+ return true;
+ }
+ }
+ }
+ else
+ */
+ {
+ for (int k = lastk; k >= i && k >= 1; k--)
+ {
+ if (
+ /*
+ (
+ k < len-3
+ &&
+ k >= 1
+ &&
+ isletter((*buff)[k+3])
+ &&
+ isletter((*buff)[k+2])
+ &&
+ isconsonant((*buff)[k+1])
+ &&
+ ((*buff)[k+1] != 'y')
+ &&
+ ((*buff)[k+1] != 'h')
+ &&
+ isconsonant((*buff)[k])
+ &&
+ ((*buff)[k] != 'h')
+ &&
+ isletter((*buff)[k-1])
+ )
+ ||
+ */
+ (
+ isletter((*buff)[k+3])
+ &&
+ isletter((*buff)[k+2])
+ &&
+ isconsonant((*buff)[k+1])
+ &&
+ ((*buff)[k+1] != 'y')
+ &&
+ isletter((*buff)[k])
+ &&
+ ((*buff)[k] != 'h')
+ &&
+ isletter((*buff)[k-1])
+ && // Do not hyphenate when the first part ends with a vowel,
+ // and the second starts with the two consonants.
+ // Examples: "co-nsona-nts" -> "con-sonants",
+ // "hy-phenation" -> "hyp-henation" etc.
+ !( isvowel( (*buff)[k] ) && isconsonant( (*buff)[k+2] ) )
+ )
+ )
+ {
+ (*buff)[len] = 0;
+ lastword.setright(*buff, k+1);
+ buff->truncate(k+2);
+ (*buff)[k+1] = '-';
+ (*buff)[k+2] = '\0';
+ laststartline = lastsizes[k+1];
+ // buff->resize();
+ for (int j = 0; j < lastword.length(); j++)
+ {
+ lastsizes[j] = lastsizes[j+k+1];
+ }
+ return true;
+ }
+ }
+ }
+ lastk = i;
+ }
+ if ((*buff)[i] == ' ')
{
(*buff)[len] = 0;
lastword.setright(*buff, i+1);
- buff->truncate(i+1);
- (*buff)[i+1] = '\0';
+ buff->truncate(i);
+ (*buff)[i] = '\0';
laststartline = lastsizes[i+1];
- buff->resize();
+ // buff->resize();
for (int j = 0; j < lastword.length(); j++)
{
lastsizes[j] = lastsizes[j+i+1];
}
return true;
}
}
laststartline = lastsizes[len-1];
(*buff)[len] = 0;
lastword.setright(*buff, len - 1);
buff->truncate(len-1);
buff->addch('-', cs);
for (int j = 0; j < lastword.length(); j++)
{
lastsizes[j] = lastsizes[j+len];
}
break;
}
}
}
(*buff)[len] = '\0';
- buff->resize();
+ // buff->resize();
return moreleft;
}
#else
-bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned char _border)
+bool BuffDoc::getline(CDrawBuffer* buff, int wth, unsigned short _lborder, unsigned short _rborder)
{
bool margindone = false;
- int w = wth-2*_border;
+ int w = wth-(_lborder+_rborder);
tchar ch = 32;
CStyle cs;
buff->empty();
if (exp == NULL)
{
// (*buff)[0] = '\0';
buff->empty();
return false;
}
int len = 0, lastcheck = 0;
if (lastword.length() > 0)
{
*buff = lastword;
cs = lastword.laststyle();
w -= buff->leftMargin() + buff->rightMargin();
margindone = true;
}
else buff->empty();
-// //odebug << "Buff:" << toQString(buff->data()) << " Lastword:" << toQString(lastword.data()) << "" << oendl;
+// //qDebug("Buff:%s Lastword:%s", (const char*)toQString(buff->data()), (const char*)toQString(lastword.data()));
lastcheck = len = buff->length();
- unsigned int slen = buff->width(len);
+ unsigned int slen = buff->width(availht, len);
if (slen > w)
{
for ( ; len > 1; len--)
{
- if (buff->width(len) < w) break;
+ if (buff->width(availht, len) < w) break;
}
// lastword = buff->data() + len - 1;
laststartline = lastsizes[len-1];
for (int i = 0; i < buff->length(); i++) lastsizes[i] = lastsizes[i+len-1];
// (*buff)[len-1] = '-';
if (len > 2)
{
lastword.setright(*buff, len - 1);
buff->truncate(len-1);
buff->addch('-', cs);
(*buff)[len] = '\0';
}
else
{
lastword.empty();
(*buff)[len] = '\0';
}
- buff->resize();
+ // buff->resize();
return true;
}
if (lastispara)
{
lastispara = false;
// lastword[0] = '\0';
lastword.empty();
len = buff->length();
- while (buff->width(len) > w) len--;
+ while (buff->width(availht, len) > w) len--;
// (*buff)[len] = '\0';
buff->truncate(len);
laststartline = exp->locate();
- buff->resize();
+ // buff->resize();
return true;
}
lastispara = false;
for (int i = 0; i < len; i++) allsizes[i] = lastsizes[i];
while (slen < w)
{
lastcheck = len;
- allsizes[len] = exp->locate();
- getch(ch, cs);
+ getch(ch, cs, allsizes[len]);
while (ch != ' ' && ch != '\012' && ch != UEOF && len < 128)
{
len++;
buff->addch(ch,cs);
- allsizes[len] = exp->locate();
- getch(ch, cs);
+ getch(ch, cs, allsizes[len]);
}
(*buff)[len] = 0;
- slen = buff->width(len);
+ slen = buff->width(availht, len);
len++;
buff->addch(' ', cs);
if (!margindone)
{
w -= buff->leftMargin() + buff->rightMargin();
margindone = true;
}
allsizes[len] = exp->locate();
if (slen < w && ch != ' ')
{
lastcheck = len;
break;
}
lastispara = (ch == '\012');
}
(*buff)[len] = '\0';
// lastword = buff->data()+lastcheck;
#ifdef _WINDOWS
lastword.setright(*buff, (lastcheck > 0) ? lastcheck : 1);
{
int i;
for (i = 0; i < lastword.length(); i++) lastsizes[i] = allsizes[i+lastcheck];
}
#else
lastword.setright(*buff, (lastcheck > 0) ? lastcheck : 1);
for (int i = 0; i < lastword.length(); i++) lastsizes[i] = allsizes[i+lastcheck];
#endif
if (lastcheck > 0)
{
laststartline = allsizes[lastcheck];
// (*buff)[lastcheck-1] = '\0';
buff->truncate(lastcheck-1);
}
else
{
laststartline = (lastcheck == len) ? exp->locate() : allsizes[lastcheck+1];
// (*buff)[lastcheck] = '\0';
buff->truncate(lastcheck);
}
// buff->frig();
- buff->resize();
+// buff->resize();
if (ch == UEOF && buff->length() == 0)
{
buff->setEof();
return false;
}
return true;
}
#endif
-bool BuffDoc::getline(CDrawBuffer* buff, int wth, int cw, unsigned char _border)
+bool BuffDoc::getline(CDrawBuffer* buff, int wth, int cw, unsigned short _lborder, unsigned short _rborder, int availht)
{
- int w = wth-2*_border;
+ int w = wth-(_lborder+_rborder);
buff->empty();
if (exp == NULL)
{
return false;
}
tchar ch;
CStyle cs;
int i = 1;
- while (i*cw < w-buff->offset(w,0))
+ int offset = buff->offset(w,0,0,availht);
+ while (i*cw < w-offset)
{
- getch(ch, cs);
+ unsigned long dummy;
+ getch(ch, cs, dummy);
if (ch == '\12' || ch == UEOF) break;
buff->addch(ch,cs);
i++;
}
buff->truncate(i);
laststartline = exp->locate();
- buff->resize();
+ // buff->resize();
return (ch != UEOF);
}
int BuffDoc::openfile(QWidget* _parent, const char *src)
{
- // //odebug << "BuffDoc:Openfile:" << src << "" << oendl;
- // //odebug << "Trying aportis " << exp << "" << oendl;
if (exp != NULL) delete exp;
- lastword.empty();
- lastsizes[0] = laststartline = 0;
-#ifdef NEWLINEBREAK
- lastispara = true;
-#else
- lastispara = false;
-#endif
- /*
- exp = new Text;
- int ret = exp->openfile(src);
- */
+ exp = NULL;
+#ifdef __STATIC
exp = new Aportis;
int ret = exp->openfile(src);
if (ret == -1)
{
delete exp;
exp = NULL;
return ret;
}
if (ret == -2)
{
delete exp;
exp = new ztxt;
ret = exp->openfile(src);
}
+ /*
+ }
+ if (ret != 0)
+ {
+ delete exp;
+ exp = new ebookcodec("Aportis");
+ ret = exp->openfile(src);
+ if (ret == 0) qDebug("Aportis format");
+ }
+ */
#ifdef USENEF
if (ret != 0)
{
delete exp;
exp = new CArriere;
ret = exp->openfile(src);
+ if (ret == 0) qDebug("Arriere format");
}
if (ret != 0)
{
delete exp;
exp = new CNEF;
ret = exp->openfile(src);
+ if (ret == 0) qDebug("NEF format");
}
#endif
if (ret != 0)
{
delete exp;
exp = new CPlucker;
ret = exp->openfile(src);
}
if (ret != 0)
{
+
delete exp;
- //odebug << "Trying ppms" << oendl;
+ exp = new CHM;
+ ret = exp->openfile(src);
+ }
+ if (ret != 0)
+ {
+
+ delete exp;
+ exp = new iSilo;
+ ret = exp->openfile(src);
+ }
+ if (ret != 0)
+ {
+ delete exp;
+ //qDebug("Trying ppms");
exp = new ppm_expander;
ret = exp->openfile(src);
}
if (ret != 0)
{
delete exp;
exp = new Text;
-// //odebug << "Trying text" << oendl;
+// //qDebug("Trying text");
ret = exp->openfile(src);
+ if (ret == 0) qDebug("Text format");
}
if (ret != 0)
{
delete exp;
QMessageBox::information(_parent, PROGNAME, "Unknown file compression type","Try another file");
return ret;
}
- // //odebug << "Doing final open:" << exp << ":" << filt << "" << oendl;
+ // //qDebug("Doing final open:%x:%x",exp,filt);
+#else
+ QString codecpath(QTReaderUtil::getPluginPath());
+ QDir d(codecpath, "*.so");
+
+ if (d.exists())
+ {
+ const QFileInfoList *list = d.entryInfoList();
+ QFileInfoListIterator it( *list ); // create list iterator
+ QFileInfo *fi; // pointer for traversing
+
+ int ret = -1;
+ while ( ret != 0 && (fi=it.current()) )
+ { // for each file...
+ if (exp != NULL) delete exp;
+ qDebug("Trying %s", (const char*)fi->fileName());
+ exp = new ebookcodec(fi->fileName());
+ ret = exp->openfile(src);
+ ++it;
+ }
+ qDebug("Buffdoc:Finished opening");
+ if (ret != 0)
+ {
+ if (exp != NULL) delete exp;
+ exp = new Text;
+ ret = exp->openfile(src);
+ }
+ }
+ else
+ {
+ if (exp != NULL) delete exp;
+ exp = new Text;
+ exp->openfile(src);
+ }
+#endif
lastword.empty();
lastsizes[0] = laststartline = 0;
#ifdef NEWLINEBREAK
- lastispara = true;
+ lastispara = false;
#else
lastispara = false;
#endif
- exp->locate(0);
+ exp->locate(exp->getHome());
filt->setsource(exp);
- // //odebug << "BuffDoc:file opened" << oendl;
+ qDebug("BuffDoc:file opened");
return 0;
}
+
+QString BuffDoc::about()
+{
+ return QString("Buffered Decompressor (c) Tim Wentford\nHyphenation algorithm (c) Tim Wentford\n (Cyrillic support by Konstantin Isakov\n")+filt->about();
+}
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,122 +1,144 @@
#ifndef __BuffDoc_h
#define __BuffDoc_h
#include "useqpe.h"
-#include "ZText.h"
-#include "Aportis.h"
-#include "ztxt.h"
-#include "ppm_expander.h"
#include "CDrawBuffer.h"
#include "CFilter.h"
+#include "CExpander.h"
#include <qfontmetrics.h>
#include <qmessagebox.h>
class BuffDoc
{
CDrawBuffer lastword;
CSizeBuffer lastsizes, allsizes;
size_t laststartline;
bool lastispara;
- CExpander* exp;
+ CExpander_Interface* exp;
CFilterChain* filt;
+ int m_hyphenthreshold;
+ // bool m_customhyphen;
public:
+ QString about();
+ bool findanchor(const QString& nm)
+ {
+ return filt->findanchor(nm);
+ }
+ // void setCustomHyphen(bool _v) { m_customhyphen = _v; }
+ // bool getCustomHyphen() { return m_customhyphen; }
+ void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; }
void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
{
if (exp == NULL)
{
data = NULL;
len = 0;
}
else
{
exp->setSaveData(data, len, src, srclen);
}
}
void putSaveData(unsigned char*& src, unsigned short& srclen)
{
if (exp != NULL)
{
exp->putSaveData(src, srclen);
}
}
#ifdef USEQPE
void suspend() { if (exp != NULL) exp->suspend(); }
void unsuspend() { if (exp != NULL) exp->unsuspend(); }
#else
void suspend() {}
void unsuspend() {}
#endif
~BuffDoc()
{
delete filt;
delete exp;
}
BuffDoc()
{
exp = NULL;
filt = NULL;
lastword.empty();
- // odebug << "Buffdoc created" << oendl;
+// // qDebug("Buffdoc created");
}
bool empty() { return (exp == NULL); }
void setfilter(CFilterChain* _f)
{
if (filt != NULL) delete filt;
filt = _f;
filt->setsource(exp);
}
CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); }
bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); }
bool iseol() { return (lastword[0] == '\0'); }
int openfile(QWidget* _parent, const char *src);
tchar getch()
{
tchar ch = UEOF;
CStyle sty;
if (exp != NULL)
{
- filt->getch(ch, sty);
+ unsigned long dummy;
+ filt->getch(ch, sty, dummy);
}
return ch;
}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (exp != NULL)
{
- filt->getch(ch, sty);
+ filt->getch(ch, sty, pos);
}
else
ch = UEOF;
}
void setwidth(int w) { if (exp != NULL) exp->setwidth(w); }
QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); }
unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); }
unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); }
unsigned int locate() { return (exp == NULL) ? 0 : laststartline; }
unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); }
void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); }
MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); }
- linkType hyperlink(unsigned int n, QString& wrd);
+ linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm);
size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); }
void locate(unsigned int n);
- bool getline(CDrawBuffer* buff, int w, unsigned char _border);
- bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border);
- void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); }
+ bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht);
+ bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht);
+ void sizes(unsigned long& fs, unsigned long& ts)
+ {
+ if (exp != NULL)
+ {
+ exp->sizes(fs,ts);
+ }
+ else
+ {
+ fs = ts = 0;
+ }
+ }
int getpara(CBuffer& buff)
{
tchar ch;
int i = 0;
while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch;
buff[i] = '\0';
if (i == 0 && ch == UEOF) i = -1;
laststartline = exp->locate();
return i;
}
- void saveposn(size_t posn) { exp->saveposn(posn); }
- void writeposn(size_t posn) { exp->writeposn(posn); }
- bool forward(size_t& loc) { return exp->forward(loc); }
- bool back(size_t& loc) { return exp->back(loc); }
- bool hasnavigation() { return exp->hasnavigation(); }
+ void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); }
+ void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); }
+ linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); }
+ linkType back(QString& f, size_t& loc) { return filt->back(f, loc); }
+ bool hasnavigation() { return filt->hasnavigation(); }
+ bool getFile(QString href)
+ {
+ return (exp == NULL) ? false : exp->getFile(href);
+ }
};
#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 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'Prefs.ui'
+**
+** Created: Tue Feb 11 23:53:35 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "ButtonPrefs.h"
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qbuttongroup.h>
+#include <qmultilineedit.h>
+#ifdef USECOMBO
+#include <qcombobox.h>
+#else
+#include <qpe/menubutton.h>
+#endif
+#include <qfontdatabase.h>
+
+#include <qlistview.h>
+
+class MyQListViewItem : public QListViewItem
+{
+ orKey o;
+public:
+ MyQListViewItem(const orKey& _o, QListView* p, const QString& c1, const QString& c2, const QString& c3) : QListViewItem(p, c1, c2, c3), o(_o) { }
+ orKey getKey() { return o; }
+};
+
+void CButtonPrefs::mapkey(Qt::ButtonState st, int _key)
+{
+ mapkey(st, _key, action->currentItem());
+}
+
+void CButtonPrefs::mapkey(Qt::ButtonState st, int _key, int act)
+{
+ orKey key(st, _key, ((act == cesScrollMore) || (act == cesScrollLess)));
+ QMap<orKey,QListViewItem*>::Iterator iter = listmap.find(key);
+ if (iter != listmap.end())
+ {
+ lb->takeItem(iter.data());
+ }
+ (*kmap)[key] = act;
+ listmap[key] = new MyQListViewItem(key, lb, key.text(), action->text(act), (key.isScroll()) ? "*":"");
+}
+
+void CButtonPrefs::keyPressEvent(QKeyEvent* e)
+{
+ switch (e->key())
+ {
+ case Key_Shift:
+ case Key_Control:
+ case Key_Meta:
+ case Key_Alt:
+ case Key_CapsLock:
+ case Key_NumLock:
+ case Key_ScrollLock:
+ e->ignore();
+ break;
+ default:
+ mapkey(e->state(), e->key());
+ e->accept();
+ break;
+ }
+}
+
+#ifdef USECOMBO
+void CButtonPrefs::populate(QComboBox *mb)
+#else
+void CButtonPrefs::populate(MenuButton *mb)
+#endif
+{
+ mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ mb->insertItem( tr("Open file") );
+ mb->insertItem( tr("Autoscroll") );
+ mb->insertItem( tr("Bookmark") );
+ mb->insertItem( tr("Annotate") );
+ mb->insertItem( tr("Fullscreen") );
+
+ mb->insertItem( tr("Zoom in") );
+ mb->insertItem( tr("Zoom out") );
+ mb->insertItem( tr("Back") );
+ mb->insertItem( tr("Forward") );
+ mb->insertItem( tr("Home") );
+ mb->insertItem( tr("Page up") );
+ mb->insertItem( tr("Page down") );
+ mb->insertItem( tr("Line up") );
+ mb->insertItem( tr("Line down") );
+ mb->insertItem( tr("Beginning") );
+ mb->insertItem( tr("End") );
+ mb->insertItem( tr("Rotate") );
+ mb->insertItem( tr("Scroll faster") );
+ mb->insertItem( tr("Scroll slower") );
+ mb->insertItem( tr("Invert colours") );
+ mb->insertItem( tr("Toggle tools") );
+ mb->insertItem( tr("Toggle scrollbar") );
+ mb->insertItem( tr("Toggle statusbar") );
+ mb->insertItem( tr("Next link") );
+ mb->insertItem( tr("Goto link") );
+}
+
+CButtonPrefs::CButtonPrefs( QMap<orKey, int>* _kmap, QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl ), kmap(_kmap)
+{
+ QVBoxLayout* vo = new QVBoxLayout(this);
+ QHBoxLayout* lo = new QHBoxLayout();
+ setFocusPolicy(QWidget::StrongFocus);
+#ifdef USECOMBO
+ action = new QComboBox( this );
+#else
+ action = new MenuButton( this );
+#endif
+ populate(action);
+ action->setFocusProxy(this);
+
+
+
+ QMultiLineEdit* TextLabel1 = new QMultiLineEdit( this );
+ 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." ) );
+ TextLabel1->setReadOnly(true);
+ TextLabel1->setWordWrap(QMultiLineEdit::WidgetWidth);
+
+ // lo->addWidget(TextLabel, 0, Qt::AlignTop);
+ // lo->addWidget(action, 0, Qt::AlignTop);
+ lo->addWidget(TextLabel1);
+ lo->addWidget(action);
+ vo->addLayout(lo);
+ lb = new QListView(this);
+ lb->addColumn( tr( "Key" ) );
+ lb->addColumn( tr( "Function" ) );
+ lb->addColumn( tr( "Scroll" ) );
+ lb->setFocusProxy(this);
+ vo->addWidget(lb,1);
+ for (QMap<orKey,int>::Iterator i = kmap->begin(); i != kmap->end(); i++)
+ {
+ listmap[i.key()] = new MyQListViewItem(i.key(), lb, i.key().text(), action->text(i.data()), (i.key().isScroll()) ? "*":"");
+ }
+
+ lo = new QHBoxLayout();
+ QLabel* TextLabel = new QLabel( this, "TextLabel1" );
+ TextLabel->setText( tr( "Debounce" ) );
+ lo->addWidget(TextLabel);
+
+ debounce = new QSpinBox( this, "Debounce" );
+ debounce->setRange(0,1000);
+ lo->addWidget(debounce);
+ lo->addStretch(1);
+ QPushButton* delButton = new QPushButton("Delete", this);
+ connect(delButton, SIGNAL( clicked() ), this, SLOT( erasemapping() ));
+ lo->addWidget(delButton);
+ QPushButton* exitButton = new QPushButton("Close", this);
+ connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotClosed() ) );
+ lo->addWidget(exitButton);
+ vo->addLayout(lo);
+}
+
+void CButtonPrefs::erasemapping()
+{
+ MyQListViewItem* li = (MyQListViewItem*)lb->selectedItem();
+ if (li != NULL)
+ {
+ orKey key(li->getKey());
+ qDebug("Tapped %s", (const char*)key.text());
+ kmap->remove(key);
+ lb->takeItem(listmap[key]);
+ listmap.remove(key);
+ }
+}
+
+CButtonPrefs::~CButtonPrefs()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
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 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'Prefs.ui'
+**
+** Created: Tue Feb 11 23:53:32 2003
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef __BUTTON_PREFS_H
+#define __BUTTON_PREFS_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+#include <qtabdialog.h>
+#include <qtabwidget.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qlineedit.h>
+
+#define USECOMBO
+
+#ifdef USECOMBO
+#include <qcombobox.h>
+#else
+#include <qpe/menubutton.h>
+#endif
+
+#include "orkey.h"
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+//class QCheckBox;
+class QLabel;
+//class QSpinBox;
+class QListViewItem;
+
+class QListView;
+class QListViewItem;
+
+class CButtonPrefs : public QWidget
+{
+ Q_OBJECT
+
+ QMap<orKey, int> *kmap;
+ QMap<orKey, QListViewItem*> listmap;
+ QListView* lb;
+ void keyPressEvent(QKeyEvent* e);
+#ifdef USECOMBO
+ void populate(QComboBox*);
+#else
+ void populate(MenuButton*);
+#endif
+
+#ifdef USECOMBO
+ QComboBox *action;
+#else
+ MenuButton *action;
+#endif
+ QSpinBox* debounce;
+ signals:
+ void Closed();
+ private slots:
+ void slotClosed() { emit Closed(); }
+
+public:
+
+ CButtonPrefs( QMap<orKey, int>*, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~CButtonPrefs();
+ int Debounce() { return debounce->value(); }
+ void Debounce(int v) { debounce->setValue(v); }
+ void mapkey(Qt::ButtonState st, int key);
+ void mapkey(Qt::ButtonState st, int key, int _fn);
+ private slots:
+ void erasemapping();
+};
+#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 @@
+#include "CAnnoEdit.h"
+
+QColor CAnnoEdit::getColor()
+{
+ switch (colorbox->currentItem())
+ {
+ case 0:
+ default:
+ return white;
+ case 1:
+ return darkGray;
+ case 2:
+ return gray;
+ case 3:
+ return lightGray;
+ case 4:
+ return red;
+ case 5:
+ return green;
+ case 6:
+ return blue;
+ case 7:
+ return cyan;
+ case 8:
+ return magenta;
+ case 9:
+ return yellow;
+ case 10:
+ return darkRed;
+ case 11:
+ return darkGreen;
+ case 12:
+ return darkBlue;
+ case 13:
+ return darkCyan;
+ case 14:
+ return darkMagenta;
+ case 15:
+ return darkYellow;
+ }
+}
+
+void CAnnoEdit::setColor(QColor v)
+{
+ if (v == white)
+ colorbox->setCurrentItem(0);
+ else if (v == darkGray)
+ colorbox->setCurrentItem(1);
+ else if (v == gray)
+ colorbox->setCurrentItem(2);
+ else if (v == lightGray)
+ colorbox->setCurrentItem(3);
+ else if (v == red)
+ colorbox->setCurrentItem(4);
+ else if (v == green)
+ colorbox->setCurrentItem(5);
+ else if (v == blue)
+ colorbox->setCurrentItem(6);
+ else if (v == cyan)
+ colorbox->setCurrentItem(7);
+ else if (v == magenta)
+ colorbox->setCurrentItem(8);
+ else if (v == yellow)
+ colorbox->setCurrentItem(9);
+ else if (v == darkRed)
+ colorbox->setCurrentItem(10);
+ else if (v == darkGreen)
+ colorbox->setCurrentItem(11);
+ else if (v == darkBlue)
+ colorbox->setCurrentItem(12);
+ else if (v == darkCyan)
+ colorbox->setCurrentItem(13);
+ else if (v == darkMagenta)
+ colorbox->setCurrentItem(14);
+ else if (v == darkYellow)
+ colorbox->setCurrentItem(15);
+ else
+ colorbox->setCurrentItem(0);
+}
+
+CAnnoEdit::CAnnoEdit(QWidget *parent, const char *name, WFlags f) :
+ QWidget(parent, name, f)
+{
+ QVBoxLayout* grid = new QVBoxLayout(this);
+ m_name = new QLineEdit(this, "Name");
+ m_anno = new QMultiLineEdit(this, "Annotation");
+ m_anno->setWordWrap(QMultiLineEdit::WidgetWidth);
+ QPushButton* exitButton = new QPushButton("Okay", this);
+ connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotOkay() ) );
+ QPushButton* cancelButton = new QPushButton("Cancel", this);
+ connect(cancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
+ QLabel *l = new QLabel("Text",this);
+ grid->addWidget(l);
+ grid->addWidget(m_name);
+ l = new QLabel("Annotation",this);
+ grid->addWidget(l);
+ grid->addWidget(m_anno,1);
+
+ colorbox = new QComboBox( this );
+
+ colorbox->insertItem("None");
+ colorbox->insertItem("Dark Gray");
+ colorbox->insertItem("Gray");
+ colorbox->insertItem("Light Gray");
+ colorbox->insertItem("Red");
+ colorbox->insertItem("Green");
+ colorbox->insertItem("Blue");
+ colorbox->insertItem("Cyan");
+ colorbox->insertItem("Magenta");
+ colorbox->insertItem("Yellow");
+ colorbox->insertItem("Dark Red");
+ colorbox->insertItem("Dark Green");
+ colorbox->insertItem("Dark Blue");
+ colorbox->insertItem("Dark Cyan");
+ colorbox->insertItem("Dark Magenta");
+ colorbox->insertItem("Dark Yellow");
+ QHBoxLayout* hgrid = new QHBoxLayout(grid);
+ hgrid->addWidget(colorbox);
+ hgrid->addWidget(cancelButton);
+ hgrid->addWidget(exitButton);
+}
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
@@ -1,59 +1,48 @@
#ifndef __CANNOEDIT_H
#define __CANNOEDIT_H
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
+#include <qcombobox.h>
class CAnnoEdit : public QWidget
{
Q_OBJECT
QLineEdit* m_name;
QMultiLineEdit* m_anno;
- size_t m_posn;
+ size_t m_posn, m_posn2;
+ QComboBox* colorbox;
public:
void setPosn(size_t p) { m_posn = p; }
+ void setPosn2(size_t p) { m_posn2 = p; }
size_t getPosn() { return m_posn; }
+ size_t getPosn2() { return m_posn2; }
+ QColor getColor();
+ void setColor(QColor);
void setName(const QString& name)
{
m_name->setText(name);
}
void setAnno(const QString& name)
{
m_anno->setText(name);
m_anno->setEdited(false);
}
bool edited() { return m_anno->edited(); }
- CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0) :
- QWidget(parent, name, f)
+ CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0);
+ private slots:
+ void slotOkay()
{
- QVBoxLayout* grid = new QVBoxLayout(this);
- m_name = new QLineEdit(this, "Name");
- m_anno = new QMultiLineEdit(this, "Annotation");
- m_anno->setWordWrap(QMultiLineEdit::WidgetWidth);
- QPushButton* exitButton = new QPushButton("Okay", this);
- connect(exitButton, SIGNAL( released() ), this, SLOT( slotOkay() ) );
- QPushButton* cancelButton = new QPushButton("Cancel", this);
- connect(cancelButton, SIGNAL( released() ), this, SLOT( slotCancel() ) );
- QLabel *l = new QLabel("Text",this);
- grid->addWidget(l);
- grid->addWidget(m_name);
- l = new QLabel("Annotation",this);
- grid->addWidget(l);
- grid->addWidget(m_anno,1);
- QHBoxLayout* hgrid = new QHBoxLayout(grid);
- hgrid->addWidget(cancelButton);
- hgrid->addWidget(exitButton);
+ emit finished(m_name->text(), m_anno->text());
}
- private slots:
- void slotOkay() { emit finished(m_name->text(), m_anno->text()); }
void slotCancel() { emit cancelled(); }
public:
signals:
void finished(const QString&, const QString&);
void cancelled();
};
#endif
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
@@ -1,55 +1,55 @@
#ifndef __CBUFFER_H
#define __CBUFFER_H
#include <stdlib.h>
#include <string.h>
#include "config.h"
class CBufferBase
{
protected:
size_t len;
unsigned char *buffer;
size_t membersize;
CBufferBase(const CBufferBase&);
public:
CBufferBase& assign(const void* sztmp, size_t ms);
void* data() { return buffer; }
CBufferBase(size_t ms, size_t n = 16);
~CBufferBase() { delete [] buffer; }
void* operator[](int i);
size_t bstrlen(unsigned char* _buffer = NULL);
size_t totallen() { return len; }
};
template<class T>
class CBufferFace
{
CBufferBase m_buffer;
protected:
CBufferFace(const CBufferFace&);
public:
CBufferFace& operator=(const T* sztmp)
{
m_buffer.assign(sztmp, m_buffer.bstrlen(sztmp));
return *this;
}
void assign(const T* sztmp, size_t n)
{
m_buffer.assign(sztmp, n);
}
size_t length() { return m_buffer.bstrlen(); }
size_t totallen() { return m_buffer.totallen(); }
T* data() { return (T*)m_buffer.data(); }
CBufferFace(size_t n = 16) : m_buffer(sizeof(T), n) {}
T& operator[](int i)
{
return *((T*)m_buffer[i]);
}
};
typedef CBufferFace<tchar> CBuffer;
-typedef CBufferFace<size_t> CSizeBuffer;
+typedef CBufferFace<unsigned long> CSizeBuffer;
#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,546 +1,864 @@
#include "CDrawBuffer.h"
#include "FontControl.h"
+#include <qfontmetrics.h>
#include <qpainter.h>
+#include <qpixmap.h>
#include <qimage.h>
+#include "useqpe.h"
+#include "opie.h"
CDrawBuffer::~CDrawBuffer()
{
while (!segs.isEmpty()) segs.erase(0);
}
void CDrawBuffer::setright(CDrawBuffer& rhs, int f)
{
int i;
len = rhs.len;
fc = rhs.fc;
- m_maxstyle = m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0;
+ m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0;
while (!segs.isEmpty())
{
segs.erase(0);
}
for (CList<textsegment>::iterator iter = rhs.segs.begin(); iter != rhs.segs.end(); )
{
CList<textsegment>::iterator next = iter;
iter++;
if (iter == rhs.segs.end() || iter->start > f)
{
int st = next->start-f;
if (st < 0) st = 0;
CStyle _style = next->style;
-
segs.push_back(textsegment(st,next->style));
}
}
for (i = f; rhs[i] != '\0'; i++) (*this)[i-f] = rhs[i];
(*this)[i-f] = '\0';
len = i;
}
CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs)
{
int i;
-// //odebug << "Trying 2" << oendl;
+// //qDebug("Trying 2");
len = rhs.len;
- m_maxstyle = rhs.m_maxstyle;
m_ascent = rhs.m_ascent;
m_descent = rhs.m_descent;
m_lineSpacing = rhs.m_lineSpacing;
m_lineExtraSpacing = rhs.m_lineExtraSpacing;
+ m_showPartial = rhs.m_showPartial;
while (!segs.isEmpty())
{
segs.erase(0);
}
for (CList<textsegment>::iterator iter = rhs.segs.begin(); iter != rhs.segs.end(); iter++)
{
segs.push_back(*iter);
}
for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i];
(*this)[i] = '\0';
len = i;
-// //odebug << "Tried 2" << oendl;
+// //qDebug("Tried 2");
return *this;
}
CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp)
{
int i;
while (!segs.isEmpty())
{
segs.erase(0);
}
segs.push_back(textsegment(0, CStyle()));
for (i = 0; sztmp[i] != '\0'; i++) (*this)[i] = sztmp[i];
(*this)[i] = '\0';
len = i;
return *this;
}
void CDrawBuffer::empty()
{
m_bSop = false;
m_bEop = false;
+ m_bBop = false;
len = 0;
(*this)[0] = 0;
while (!segs.isEmpty())
{
segs.erase(0);
}
segs.push_back(textsegment(0,CStyle()));
- m_maxstyle = m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0;
+ m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0;
m_bEof = false;
}
+void CDrawBuffer::setendpara(const CStyle& _style/* = ucFontBase*/)
+{
+ m_bEop = true;
+ if (len == 0)
+ {
+ segs.first().start = 0;
+ segs.first().style = _style;
+ }
+}
+
void CDrawBuffer::addch(tchar ch, CStyle _style/* = ucFontBase*/)
{
if (len == 0)
{
segs.first().start = 0;
segs.first().style = _style;
}
else if (_style != segs.last().style)
{
segs.push_back(textsegment(len, _style));
}
(*this)[len++] = ch;
}
void CDrawBuffer::truncate(int n)
{
len = n;
(*this)[n] = 0;
}
-int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _border)
+int CDrawBuffer::width(int availht, int numchars, bool onscreen, int scwidth, unsigned short _lborder, unsigned short _rborder)
{
int gzoom = fc->gzoom();
int currentx = 0, end = 0;
QString text = (numchars < 0) ? toQString(data()) : toQString(data(), numchars);
CList<textsegment>::iterator textstart = segs.begin();
int extraspace = 0;
bool just = (onscreen && !m_bEop && textstart->style.getJustify() == m_AlignJustify);
int spaces = 0;
int spacesofar = 0;
int spacenumber = 0;
int nonspace = 0;
if (just)
{
for (int i = 0; i < len; i++)
{
if ((*this)[i] != ' ')
{
nonspace = i;
break;
}
}
#ifdef _WINDOWS
for (i = nonspace; i < len; i++)
#else
for (int i = nonspace; i < len; i++)
#endif
{
if ((*this)[i] == ' ')
{
spaces++;
}
}
if (spaces == 0)
{
just = false;
}
else
{
- extraspace = (scwidth - 2*_border - rightMargin() - leftMargin() - width());
+ extraspace = (scwidth - (_lborder+_rborder) - rightMargin() - leftMargin() - width(availht));
if (extraspace == 0) just = false;
}
}
CList<textsegment>::iterator textend = textstart;
do
{
textend++;
end = (textend != segs.end()) ? textend->start : len;
if (numchars >= 0 && end > numchars)
{
end = numchars;
}
CStyle currentstyle = textstart->style;
if (currentstyle.isPicture())
{
if (currentstyle.canScale())
{
- currentx += (gzoom*currentstyle.getPicture()->width())/100;
+ int ht = (gzoom*currentstyle.getPicture()->height())/100;
+ int wt = (gzoom*currentstyle.getPicture()->width())/100;
+ if (ht > availht)
+ {
+ wt = (wt*availht)/ht;
+ }
+ currentx += wt;
}
else
{
currentx += currentstyle.getPicture()->width();
}
}
else
{
if (currentstyle.isMono() && !fc->hasCourier())
{
int cw = (7*fc->getsize(currentstyle))/10;
currentx += cw*(end-textstart->start);
}
else
{
QFont f(currentstyle.isMono() ? QString(fc->fixedfontname()) : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) );
// f.setUnderline(currentstyle.isUnderline());
QString str = text.mid(textstart->start, end-textstart->start);
QFontMetrics fm(f);
if (just)
{
int lastspace = -1;
int nsp = 0;
int cx = currentx;
while ((nsp = str.find(" ", lastspace+1)) >= 0)
{
if (nsp > nonspace)
{
spacenumber++;
int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar;
QString nstr = str.mid(lastspace+1, nsp-lastspace);
int lw = fm.width(nstr);
cx += lw+nexttoadd;
spacesofar += nexttoadd;
lastspace = nsp;
}
else
{
QString nstr = str.mid(lastspace+1, nsp-lastspace);
-// odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl;
+// qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr);
int lw = fm.width(nstr);
cx += lw;
lastspace = nsp;
}
}
QString nstr = str.right(str.length()-1-lastspace);
cx += fm.width(nstr);
currentx = cx;
}
else
{
currentx += fm.width(str);
}
}
}
textstart = textend;
}
while (textend != segs.end() && end != numchars && textstart->start < len);
return currentx;
}
+int CDrawBuffer::charwidth(int numchars, CStyle& currentstyle)
+{
+ if (currentstyle.isPicture())
+ {
+ int gzoom = fc->gzoom();
+ if (currentstyle.canScale())
+ {
+ return (gzoom*currentstyle.getPicture()->width())/100;
+ }
+ else
+ {
+ return currentstyle.getPicture()->width();
+ }
+ }
+ else
+ {
+ if (currentstyle.isMono() && !fc->hasCourier())
+ {
+ return (7*fc->getsize(currentstyle))/10;
+ }
+ else
+ {
+ QString text = QChar((data())[numchars]);
+ QFont f(currentstyle.isMono() ? QString(fc->fixedfontname()) : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) );
+ // f.setUnderline(currentstyle.isUnderline());
+ QFontMetrics fm(f);
+ return fm.width(text);
+ }
+ }
+ return 0;
+}
+
+int CDrawBuffer::charwidth(int numchars)
+{
+ int gzoom = fc->gzoom();
+ int end = 0;
+ QString text = QChar((data())[numchars]);
+ CList<textsegment>::iterator textstart = segs.begin();
+ CList<textsegment>::iterator textend = textstart;
+ do
+ {
+ textend++;
+ end = (textend != segs.end()) ? textend->start : len;
+ if (end <= numchars)
+ {
+ textstart = textend;
+ continue;
+ }
+ if (numchars >= 0 && end > numchars)
+ {
+ end = numchars;
+ }
+ CStyle currentstyle = textstart->style;
+ if (currentstyle.isPicture())
+ {
+ if (currentstyle.canScale())
+ {
+ return (gzoom*currentstyle.getPicture()->width())/100;
+ }
+ else
+ {
+ return currentstyle.getPicture()->width();
+ }
+ }
+ else
+ {
+ if (currentstyle.isMono() && !fc->hasCourier())
+ {
+ return (7*fc->getsize(currentstyle))/10;
+ }
+ else
+ {
+ QFont f(currentstyle.isMono() ? QString(fc->fixedfontname()) : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) );
+// f.setUnderline(currentstyle.isUnderline());
+ QFontMetrics fm(f);
+ return fm.width(text);
+ }
+ }
+ textstart = textend;
+ }
+ while (textend != segs.end() /* && end != numchars*/ && textstart->start < len);
+ return 0;
+}
+
+
+
int CDrawBuffer::leftMargin()
{
return (segs.begin()->style.getLeftMargin()*fc->getsize(segs.begin()->style)+3)/6;
}
int CDrawBuffer::rightMargin()
{
return (segs.begin()->style.getRightMargin()*fc->getsize(segs.begin()->style)+3)/6;
}
-int CDrawBuffer::offset(int scwidth, unsigned char _border)
+int CDrawBuffer::offset(int scwidth, unsigned short _lborder, unsigned short _rborder, int availht)
{
- int currentx = _border;
+ int currentx = _lborder;
switch(segs.begin()->style.getJustify())
{
case m_AlignRight:
{
- currentx = scwidth - _border - rightMargin() - width();
+ currentx = scwidth - _rborder - rightMargin() - width(availht);
}
break;
case m_AlignCentre:
{
currentx = (
- scwidth +
+ scwidth - _lborder -_rborder +
leftMargin() - rightMargin()
- - width())/2;
+ - width(availht))/2 + _lborder;
}
break;
case m_AlignJustify:
case m_AlignLeft:
- currentx = _border + leftMargin();
+ currentx = _lborder + leftMargin();
break;
}
return currentx;
}
-void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scwidth, unsigned char _border)
+void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scwidth, unsigned short _lborder, unsigned short _rborder, const QColor& _bg, int availht)
{
+ CList<textsegment>::iterator textstart = segs.begin();
+ QColor paperColour = QColor(qRgb(textstart->style.pRed(),
+ textstart->style.pGreen(),
+ textstart->style.pBlue()));
+
+ Highlight(_p, !(paperColour == _bg), _lborder, _y, scwidth-(_lborder+_rborder), paperColour);
+ // Highlight(_p, true, _lborder, _y, scwidth-(_lborder+_rborder), paperColour);
int gzoom = fc->gzoom();
- int currentx = offset(scwidth, _border);
+ int currentx = offset(scwidth, _lborder, _rborder, availht);
+ if (!m_hastext)
+ {
+ for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); iter++)
+ {
+ CStyle currentstyle = iter->style;
+ if (currentstyle.isPicture())
+ {
+ CStyle currentstyle = segs.begin()->style;
+ int ht = (gzoom*currentstyle.getPicture()->height())/100;
+ int wt = (gzoom*currentstyle.getPicture()->width())/100;
+ bool willscale = false;
+ if (ht > availht)
+ {
+ wt = (wt*availht)/ht;
+ ht = availht;
+ willscale = true;
+ }
+
+ QPixmap pc;
+ if ((willscale || gzoom != 100) && currentstyle.canScale())
+ {
+ QImage im = currentstyle.getPicture()->smoothScale(wt,ht);
+ pc.convertFromImage(im);
+ }
+ else
+ {
+ pc.convertFromImage(*currentstyle.getPicture());
+ }
+ int yoffset = pc.height()/2;
+ _p->drawPixmap( currentx, _y-yoffset, pc );
+ currentx += pc.width();
+ }
+ }
+ return;
+ }
QString text = toQString(data());
- CList<textsegment>::iterator textstart = segs.begin();
int extraspace = 0;
bool just = (!m_bEop && textstart->style.getJustify() == m_AlignJustify);
int spaces = 0;
int spacesofar = 0;
int spacenumber = 0;
int nonspace = 0;
if (just)
{
for (int i = 0; i < len; i++)
{
if ((*this)[i] != ' ')
{
nonspace = i;
break;
}
}
#ifdef _WINDOWS
for (i = nonspace; i < len; i++)
#else
for (int i = nonspace; i < len; i++)
#endif
{
if ((*this)[i] == ' ')
{
spaces++;
}
}
if (spaces == 0)
{
just = false;
}
else
{
- extraspace = (scwidth - 2*_border - rightMargin() - leftMargin() - width());
+ extraspace = (scwidth - (_lborder+_rborder) - rightMargin() - leftMargin() - width(availht));
if (extraspace == 0) just = false;
}
}
CList<textsegment>::iterator textend = textstart;
+
+ bool drawBackground = false;
do
{
textend++;
int end = (textend != segs.end()) ? textend->start : len;
CStyle currentstyle = textstart->style;
+ /*
+ bool drawBackground = (
+ currentstyle.bRed() != 255
+ ||
+ currentstyle.bGreen() != 255
+ ||
+ currentstyle.bBlue() != 255
+ );
+ */
+ QColor bgColour = QColor(qRgb(currentstyle.bRed(),
+ currentstyle.bGreen(),
+ currentstyle.bBlue()));
+ drawBackground = !(bgColour == _bg);
+
+// if (drawBackground) qDebug("Drawing background");
+
QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) );
// f.setUnderline(currentstyle.isUnderline());
-// if (currentstyle.isUnderline()) odebug << "UNDERLINE" << oendl;
+// if (currentstyle.isUnderline()) qDebug("UNDERLINE");
_p->setFont(f);
QString str = text.mid(textstart->start, end-textstart->start);
#if defined(OPIE) || !defined(USEQPE)
_p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/100));
#else
_p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/10));
#endif
int voffset = currentstyle.getVOffset()*fc->getsize(currentstyle)/2;
+
if (_bMono)
{
+
+ Highlight(_p, drawBackground, currentx, _y, str.length()*_charWidth, bgColour);
if (currentstyle.isUnderline())
{
_p->drawLine( currentx, _y+voffset, currentx + str.length()*_charWidth, _y+voffset);
}
if (currentstyle.isStrikethru())
{
int ascent = fc->ascent(currentstyle)/3;
_p->drawLine( currentx, _y-ascent+voffset, currentx + str.length()*_charWidth, _y-ascent+voffset);
}
for (int i = 0; i < str.length(); i++)
{
_p->drawText( currentx + i*_charWidth, _y+voffset, QString(str[i]));
}
currentx += str.length()*_charWidth;
}
else
{
if (currentstyle.isPicture())
{
int ht = (gzoom*currentstyle.getPicture()->height())/100;
int wt = (gzoom*currentstyle.getPicture()->width())/100;
+ bool willscale = false;
+ if (ht > availht)
+ {
+ wt = (wt*availht)/ht;
+ ht = availht;
+ willscale = true;
+ }
int ascent = fc->ascent(currentstyle)/2;
int yoffset = ht/2 + ascent;
QPixmap pc;
- if (gzoom != 100 && currentstyle.canScale())
+ if ((willscale || gzoom != 100) && currentstyle.canScale())
{
QImage im = currentstyle.getPicture()->smoothScale(wt,ht);
pc.convertFromImage(im);
}
else
{
pc.convertFromImage(*currentstyle.getPicture());
}
_p->drawPixmap( currentx, _y-yoffset, pc );
currentx += wt;
}
else
{
if (currentstyle.isMono() && !fc->hasCourier())
{
int cw = (7*fc->getsize(currentstyle))/10;
int w = cw*(end-textstart->start);
+ Highlight(_p, drawBackground, currentx, _y, w, bgColour);
if (currentstyle.isUnderline())
{
_p->drawLine( currentx, _y+voffset, currentx + w, _y+voffset);
}
if (currentstyle.isStrikethru())
{
int ascent = fc->ascent(currentstyle)/3;
_p->drawLine( currentx, _y-ascent+voffset, currentx + w, _y-ascent+voffset);
}
QString str = text.mid(textstart->start, end-textstart->start);
for (unsigned int i = 0; i < str.length(); i++)
{
#ifdef _WINDOWS
_p->drawText( currentx, _y+voffset, QString(str.at(i)));
#else
_p->drawText( currentx, _y+voffset, QString(str[i]));
#endif
currentx += cw;
}
}
else
{
QFontMetrics fm(f);
int w;
if (just)
{
int lastspace = -1;
int nsp = 0;
int cx = currentx;
while ((nsp = str.find(" ", lastspace+1)) >= 0)
{
if (nsp+textstart->start >= nonspace)
{
spacenumber++;
int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar;
QString nstr = str.mid(lastspace+1, nsp-lastspace);
-// odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl;
+// qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr);
int lw = fm.width(nstr);
+ Highlight(_p, drawBackground, cx, _y, lw, bgColour);
_p->drawText( cx, _y+voffset, nstr);
+ Highlight(_p, drawBackground, cx+lw, _y, nexttoadd, bgColour);
cx += lw+nexttoadd;
spacesofar += nexttoadd;
lastspace = nsp;
}
else
{
QString nstr = str.mid(lastspace+1, nsp-lastspace);
-// odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl;
+// qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr);
int lw = fm.width(nstr);
+ Highlight(_p, drawBackground, cx, _y, lw, bgColour);
_p->drawText( cx, _y+voffset, nstr);
cx += lw;
lastspace = nsp;
}
}
QString nstr = str.right(str.length()-1-lastspace);
+ int lw = fm.width(nstr);
+ Highlight(_p, drawBackground, cx, _y, lw, bgColour);
_p->drawText( cx, _y+voffset, nstr);
- cx += fm.width(nstr);
+ cx += lw;
w = cx - currentx;
}
else
{
+ int lw = fm.width(str);
+ Highlight(_p, drawBackground, currentx, _y, lw, bgColour);
_p->drawText( currentx, _y+voffset, str);
- w = fm.width(str);
+ w = lw;
}
if (currentstyle.isUnderline())
{
_p->drawLine( currentx, _y+voffset, currentx + w, _y+voffset);
}
if (currentstyle.isStrikethru())
{
int ascent = fc->ascent(currentstyle)/3;
_p->drawLine( currentx, _y-ascent+voffset, currentx + w, _y-ascent+voffset);
}
currentx += w;
}
}
}
textstart = textend;
}
while (textend != segs.end() && textstart->start < len);
+/*
+ if (firstColour == bgColour)
+ {
+ Highlight(_p, drawBackground, currentx, _y, scwidth - (currentx + _lborder + _rborder), bgColour);
+ }
+ */
+}
+
+void CDrawBuffer::Highlight(QPainter* _p, bool drawBackground, int _x, int _y, int w, QColor bgColour)
+{
+ if (drawBackground)
+ {
+ _p->fillRect(_x, _y-m_ascent, w, m_lineSpacing, bgColour);
+ }
}
CStyle CDrawBuffer::laststyle()
{
return segs.last().style;
}
-linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt)
+CStyle CDrawBuffer::firststyle()
+{
+ return segs.first().style;
+}
+
+linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*& img)
{
+ linkType ret = eNone;
int end = 0;
CStyle currentstyle;
CList<textsegment>::iterator textstart = segs.begin();
CList<textsegment>::iterator textend = textstart;
do
{
textend++;
end = (textend != segs.end()) ? textend->start : len;
currentstyle = textstart->style;
/*
- if (currentstyle.isPicture()) odebug << "Passed thru picture" << oendl;
- if (currentstyle.getLink()) odebug << "Passed thru link" << oendl;
- //odebug << "islink:" << numchars << " - " << end << "" << oendl;
+ if (currentstyle.isPicture()) qDebug("Passed thru picture");
+ if (currentstyle.getLink()) qDebug("Passed thru link");
+ //qDebug("islink:%d - %d", numchars, end);
*/
textstart = textend;
}
while (textend != segs.end() && end <= numchars);
-// if (currentstyle.isPicture()) odebug << "Clicked on picture" << oendl;
+ img = currentstyle.getPicture();
if (currentstyle.getPictureLink())
{
- tgt = currentstyle.getPictureLinkData();
- return ePicture;
+ pictgt = currentstyle.getPictureLinkData();
+ ret |= ePicture;
}
if (currentstyle.getLink())
{
tgt = currentstyle.getData();
- return eLink;
+ offset = currentstyle.getOffset();
+ ret |= eLink;
}
- return eNone;
+ return ret;
}
-void CDrawBuffer::resize()
+void CDrawBuffer::resize(int availht)
{
int gzoom = fc->gzoom();
- m_maxstyle = m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0;
+ m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0;
+ /*
+ int t_ascent = 0;
+ int t_descent = 0;
+ int t_lineExtraSpacing = 0;
+ */
+ int t_lineSpacing = 0;
+ m_hastext = false;
+ for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end() && iter->start <= len; )
+ {
+ CStyle _style = iter->style;
+ if (!_style.isPicture())
+ {
+ m_hastext = true;
+ break;
+ }
+ iter++;
+ }
+ if (m_hastext)
+ {
+
for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end() && iter->start <= len; )
{
CList<textsegment>::iterator next = iter;
iter++;
int st = next->start;
if (st < 0) st = 0;
CStyle _style = next->style;
int linespacing, ascent, descent, extra;
ascent = fc->ascent(_style);
descent = fc->descent(_style);
linespacing = fc->lineSpacing(_style);
extra = linespacing - ascent - descent;
- if (_style.isPicture() && _style.canScale())
+ /*
+ if (ascent > t_ascent) t_ascent = ascent;
+ if (descent > t_descent) t_descent = descent;
+ if (extra > t_lineExtraSpacing) t_lineExtraSpacing = extra;
+ t_lineSpacing = t_ascent+t_descent+t_lineExtraSpacing;
+ */
+ if (linespacing > t_lineSpacing) t_lineSpacing = linespacing;
+ if (_style.isPicture())
+ {
+ int ht = (gzoom*_style.getPicture()->height())/100;
+ int wt = (gzoom*_style.getPicture()->width())/100;
+
+ bool willscale = false;
+ if (ht > availht)
+ {
+ wt = (wt*availht)/ht;
+ ht = availht;
+ willscale = true;
+ }
+ if (willscale || _style.canScale())
{
descent = ((gzoom*_style.getPicture()->height())/100-ascent)/2;
ascent = ((gzoom*_style.getPicture()->height())/100+ascent)/2;
}
+ }
+
/*
else if (fc != NULL)
{
ascent = fc->ascent(_style);
descent = fc->descent(_style);
linespacing = fc->lineSpacing(_style);
extra = linespacing - ascent - descent;
}
*/
if (ascent > m_ascent) m_ascent = ascent;
if (descent > m_descent) m_descent = descent;
if (extra > m_lineExtraSpacing) m_lineExtraSpacing = extra;
m_lineSpacing = m_ascent+m_descent+m_lineExtraSpacing;
}
+ m_showPartial = (m_lineSpacing > t_lineSpacing);
int lead = fc->getlead();
if (lead != 0)
{
- int xt = (lead*m_lineSpacing+5)/10;
- m_descent += xt;
+ int xt = (lead*t_lineSpacing+5)/10;
+ m_lineExtraSpacing += xt;
m_lineSpacing += xt;
}
if (m_bSop)
{
int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10;
-// odebug << "ExtraSpace:" << xt << "" << oendl;
+ // qDebug("ExtraSpace:%d", xt);
m_ascent += xt;
m_lineSpacing += xt;
}
}
+ else
+ {
+ m_showPartial = true;
+ int maxheight = 0;
+ for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); iter++)
+ {
+ CStyle _style = iter->style;
+ if (_style.isPicture())
+ {
+ int ht = 0;
+ if (_style.canScale())
+ {
+ ht = ((gzoom*_style.getPicture()->height())/100);
+ }
+ else
+ {
+ ht = _style.getPicture()->height();
+ }
+ if (ht > availht)
+ {
+ ht = availht;
+ }
+ if (ht > maxheight) maxheight = ht;
+ }
+ }
+ m_ascent = maxheight/2;
+ m_descent = maxheight-m_ascent;
+ m_lineExtraSpacing = 0;
+ m_lineSpacing = m_ascent+m_descent;
+ }
+}
+
+CStyle* CDrawBuffer::getNextLink(int& offset)
+{
+ CStyle* ret = NULL;
+ for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); ++iter)
+ {
+ if (offset < iter->start && iter->style.getLink())
+ {
+ ret = &(iter->style);
+ offset = iter->start;
+ qDebug("Found a link at offset %d!", offset);
+ break;
+ }
+ }
+ return ret;
+}
+
+int CDrawBuffer::invertLink(int offset)
+{
+ for (CList<textsegment>::iterator iter = segs.begin(); iter != segs.end(); ++iter)
+ {
+ if (offset <= iter->start && iter->style.getLink())
+ {
+ iter->style.invert();
+ unsigned long currentvalue = iter->style.getData();
+ qDebug("Link data %u", currentvalue);
+ CList<textsegment>::iterator next = iter;
+ ++next;
+ while (next != segs.end() && (currentvalue == next->style.getData()) && next->style.getLink())
+ {
+ next->style.invert();
+ offset = next->start;
+ iter++;
+ next++;
+ }
+ return offset;
+ }
+ }
+ qDebug("Failed to invert");
+ return offset;
+}
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,73 +1,87 @@
#ifndef __CDRAWBUFFER_H
#define __CDRAWBUFFER_H
+#include <qcolor.h>
#include "StyleConsts.h"
#include "CBuffer.h"
#include "my_list.h"
#include "linktype.h"
class QPainter;
+class QImage;
struct textsegment
{
int start;
CStyle style;
textsegment(int _start, const CStyle& _style)
:
start(_start), style(_style)
{}
};
class FontControl;
class CDrawBuffer : public CBuffer
{
+ bool m_hastext;
CList<textsegment> segs;
int len;
FontControl* fc;
- int m_maxstyle, m_ascent, m_descent, m_lineSpacing, m_lineExtraSpacing;
- bool m_bEof;
+ int m_ascent, m_descent, m_lineSpacing, m_lineExtraSpacing;
+ bool m_bEof, m_bBop;
bool m_bSop, m_bEop;
+ bool m_showPartial;
CDrawBuffer(const CDrawBuffer&);
CDrawBuffer& operator=(const tchar*sztmp);
+ void Highlight(QPainter*_p, bool drawBackground, int _x, int _y, int w, QColor bgColour);
public:
void setstartpara() { m_bSop = true; }
+ void setBop() { m_bBop = true; }
+ bool isBop() { return m_bBop; }
void setendpara() { m_bEop = true; }
+ void setendpara(const CStyle& cs);
int leftMargin();
int rightMargin();
void setEof() { m_bEof = true; }
bool eof() { return m_bEof; }
CDrawBuffer& operator=(CDrawBuffer&);
CDrawBuffer(FontControl* _fs = NULL)
:
fc(_fs)
{
empty();
}
~CDrawBuffer();
/*
CDrawBuffer()
:
size(0)
{
empty();
}
*/
- int width(int numchars = -1, bool onscreen = false, int scwidth = 0, unsigned char _border = 0);
- int offset(int, unsigned char);
- void render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scw, unsigned char);
+ int charwidth(int numchars, CStyle& currentstyle);
+ int charwidth(int numchars);
+ int width(int availht, int numchars = -1, bool onscreen = false, int scwidth = 0, unsigned short _lborder = 0, unsigned short _rborder = 0);
+ int offset(int, unsigned short, unsigned short, int);
+ void render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scw, unsigned short, unsigned short, const QColor&, int availht);
void empty();
void addch(tchar ch, CStyle _style);
void truncate(int);
void setright(CDrawBuffer&, int);
+ CStyle firststyle();
CStyle laststyle();
int ascent() { return m_ascent; }
int descent() { return m_descent; }
int lineSpacing() { return m_lineSpacing; }
int lineExtraSpacing() { return m_lineExtraSpacing; }
// void frig();
- linkType getLinkType(int numchars, size_t& tgt);
- void resize();
+ linkType getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*&);
+ void resize(int);
+ bool showPartial() { return m_showPartial; }
+ CStyle* getNextLink(int&);
+ int invertLink(int);
};
#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,210 +1,210 @@
#include <stdio.h>
#include "CEncoding.h"
-void CUtf8::getch(tchar& ch, CStyle& sty)
+void CUtf8::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
tchar ret;
- parent->getch(ret, sty);
+ parent->getch(ret, sty, pos);
if (ret == UEOF)
{
ch = UEOF;
return;
}
int count = 0;
if (ret & (1 << 7))
{
unsigned char flags = ret << 1;
while ((flags & (1 << 7)) != 0)
{
ret <<= 6;
tchar iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
ret += iret & 0x3f;
flags <<= 1;
count++;
}
switch (count)
{
case 0:
break;
case 1:
ret &= 0x07ff;
break;
case 2:
break;
case 3:
case 4:
case 5:
default:
printf("Only 16bit unicode supported...");
}
}
ch = ret;
return;
}
-void CUcs16be::getch(tchar& ch, CStyle& sty)
+void CUcs16be::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
tchar iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
if (iret == UEOF)
{
ch = UEOF;
return;
}
tchar ret = iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
ch = (ret << 8) + iret;
}
-void CUcs16le::getch(tchar& ch, CStyle& sty)
+void CUcs16le::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
tchar iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
if (iret == UEOF)
{
ch = UEOF;
return;
}
tchar ret = iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
ch = ret + (iret << 8);
}
-void Ccp1252::getch(tchar& ch, CStyle& sty)
+void Ccp1252::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
tchar iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
ch = iret;
switch (ch)
{
case UEOF:
ch = UEOF;
break;
case 0x80:
ch = 0x20ac;
break;
case 0x82:
ch = 0x201a;
break;
case 0x83:
ch = 0x0192;
break;
case 0x84:
ch = 0x201e;
break;
case 0x85:
ch = 0x2026;
break;
case 0x86:
ch = 0x2020;
break;
case 0x87:
ch = 0x2021;
break;
case 0x88:
ch = 0x02c6;
break;
case 0x89:
ch = 0x2030;
break;
case 0x8a:
ch = 0x0160;
break;
case 0x8b:
ch = 0x2039;
break;
case 0x8c:
ch = 0x0152;
break;
case 0x8e:
ch = 0x017d;
break;
case 0x91:
ch = 0x2018;
break;
case 0x92:
ch = 0x2019;
break;
case 0x93:
ch = 0x201c;
break;
case 0x94:
ch = 0x201d;
break;
case 0x95:
ch = 0x2022;
break;
case 0x96:
ch = 0x2013;
break;
case 0x97:
ch = 0x2014;
break;
case 0x98:
ch = 0x02dc;
break;
case 0x99:
ch = 0x2122;
break;
case 0x9a:
ch = 0x0161;
break;
case 0x9b:
ch = 0x203a;
break;
case 0x9c:
ch = 0x0153;
break;
case 0x9e:
ch = 0x017e;
break;
case 0x9f:
ch = 0x0178;
break;
default:
break;
}
}
-void CPalm::getch(tchar& ch, CStyle& sty)
+void CPalm::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- Ccp1252::getch(ch, sty);
+ Ccp1252::getch(ch, sty, pos);
switch (ch)
{
case 0x18:
ch = 0x2026;
break;
case 0x19:
ch = 0x2007;
break;
case 0x8d:
ch = 0x2662;
break;
case 0x8e:
ch = 0x2663;
break;
case 0x8f:
ch = 0x2661;
break;
case 0x90:
ch = 0x2660;
break;
default:
break;
}
}
-void CAscii::getch(tchar& ch, CStyle& sty)
+void CAscii::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
tchar iret;
- parent->getch(iret, sty);
+ parent->getch(iret, sty, pos);
if (iret == UEOF)
{
ch = UEOF;
}
else
{
ch = iret;
}
}
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
@@ -1,74 +1,94 @@
#ifndef __CENCODING_H
#define __CENCODING_H
#include "CExpander.h"
#define MAX_ENCODING 6
class CEncoding : public CCharacterSource
{
friend class CFilterChain;
protected:
- CExpander* parent;
- linkType hyperlink(unsigned int n, QString& t) { return parent->hyperlink(n,t); }
+ CExpander_Interface* parent;
+ linkType hyperlink(unsigned int n, unsigned int noff, QString& t, QString& nm) { return parent->hyperlink(n, noff, t, nm); }
public:
CEncoding() : parent(NULL) {}
- void setparent(CExpander* p) { parent = p; }
+ void setparent(CExpander_Interface* p) { parent = p; }
virtual ~CEncoding() {};
+ void locate(unsigned int n) { parent->locate(n); }
+ bool findanchor(const QString& nm) { return false; }
+ void saveposn(const QString& f, size_t posn) { parent->saveposn(posn); }
+ void writeposn(const QString& f, size_t posn) { parent->writeposn(posn); }
+ linkType forward(QString& f, size_t& loc) { return parent->forward(loc); }
+ linkType back(QString& f, size_t& loc) { return parent->back(loc); }
+ bool hasnavigation() { return parent->hasnavigation(); }
+ virtual int getwidth() { return parent->getwidth(); }
+ QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); }
+ QImage* getPicture(const QString& href) { return parent->getPicture(href); }
+ bool getFile(const QString& href) { qDebug("Encoding Get File"); return parent->getFile(href);}
+
+
};
class CUtf8 : public CEncoding
{
public:
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("UTF8 decoder (c) Tim Wentford\n")+parent->about(); }
};
class CUcs16be : public CEncoding
{
public:
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("UCS16 decoder (c) Tim Wentford\n")+parent->about(); }
};
class CUcs16le : public CEncoding
{
public:
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("UCS16 decoder (c) Tim Wentford\n")+parent->about(); }
};
class Ccp1252 : public CEncoding
{
public:
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Codepage 1252 decoder (c) Tim Wentford\n")+parent->about(); }
};
class CPalm : public Ccp1252
{
public:
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Palm decoder (c) Tim Wentford\n")+parent->about(); }
};
class CAscii : public CEncoding
{
public:
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Vanilla Ascii decoder (c) Tim Wentford\n")+parent->about(); }
};
#include "CEncoding_tables.h"
class CGeneral8Bit : public CEncoding
{
int m_index;
public:
CGeneral8Bit(int _i) : m_index(_i)
{
-// odebug << "8Bit: " << _i << oendl;
-// odebug << unicodetable::iterator(_i)->mime << oendl;
+// qDebug("8Bit:%d", _i);
+// qDebug("%s", unicodetable::iterator(_i)->mime);
}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
ch = unicodetable::unicodevalue(m_index, ch);
}
+ QString about() { return QString("8-bit decoder (c) Tim Wentford - based on QT code\n")+parent->about(); }
};
#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,257 +1,258 @@
#include "CEncoding_tables.h"
+#include "config.h"
static const unicodetable unicodevalues[] = {
// from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt
{ "KOI8-R", "KOI8-R", 2084,
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248,
0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556,
0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E,
0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565,
0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9,
0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } },
// /**/ - The BULLET OPERATOR is confused. Some people think
// it should be 0x2022 (BULLET).
// from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt
{ "KOI8-U", "KOI8-U", 2088,
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248,
0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457,
0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E,
0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407,
0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9,
0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } },
// next bits generated from tables on the Unicode 2.0 CD. we can
// use these tables since this is part of the transition to using
// unicode everywhere in qt.
// $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits ) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
// then I inserted the files manually.
{ "ISO-8859-2", "ISO 8859-2", 5,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7,
0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7,
0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C,
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} },
{ "ISO-8859-3", "ISO 8859-3", 6,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFD, 0x0124, 0x00A7,
0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFD, 0x017B,
0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7,
0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFD, 0x017C,
0x00C0, 0x00C1, 0x00C2, 0xFFFD, 0x00C4, 0x010A, 0x0108, 0x00C7,
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0xFFFD, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7,
0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0xFFFD, 0x00E4, 0x010B, 0x0109, 0x00E7,
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7,
0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} },
{ "ISO-8859-4", "ISO 8859-4", 7,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7,
0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7,
0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B,
0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A,
0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF,
0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B,
0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} },
{ "ISO-8859-5", "ISO 8859-5", 8,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} },
{ "ISO-8859-6", "ISO 8859-6", 82,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x060C, 0x00AD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0x061B, 0xFFFD, 0xFFFD, 0xFFFD, 0x061F,
0xFFFD, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
0x0638, 0x0639, 0x063A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F,
0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
{ "ISO-8859-7", "ISO 8859-7", 10,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x2018, 0x2019, 0x00A3, 0xFFFD, 0xFFFD, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0xFFFD, 0x2015,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7,
0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} },
{ "ISO-8859-8-I", "ISO 8859-8-I", 85,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2017,
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
{ "ISO-8859-9", "ISO 8859-9", 12,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} },
{ "ISO-8859-10", "ISO 8859-10", 13,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7,
0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7,
0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B,
0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF,
0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168,
0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169,
0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} },
{ "ISO-8859-13", "ISO 8859-13", 109,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7,
0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7,
0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} },
{ "ISO-8859-14", "ISO 8859-14", 110,
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7,
0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178,
0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56,
0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61,
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A,
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} },
// next bits generated again from tables on the Unicode 3.0 CD.
// $ for a in CP* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
{ "CP 850", "IBM 850", 2009,
{ 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE,
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE,
0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
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 @@
+#include "CExpander.h"
+
+size_t CExpander::getHome() { return m_homepos; }
+
+CExpander::CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {};
+
+CExpander::~CExpander() { if (fname != NULL) delete [] fname; };
+
+int CExpander::openfile(const char *src)
+{
+ bSuspended = false;
+ fname = strdup(src);
+ return OpenFile(src);
+}
+
+void CExpander::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ pos = locate();
+ int ich = getch();
+ ch = (ich == EOF) ? UEOF : ich;
+ // sty.unset();
+}
+
+linkType CExpander::hyperlink(unsigned int n, unsigned int, QString& wrd, QString& nm)
+{
+ locate(n);
+ return eLink;
+}
+
+unsigned long CExpander::startSection()
+{
+ unsigned long current = locate();
+ if (m_currentstart > current || current > m_currentend)
+ {
+ start2endSection();
+ }
+ return m_currentstart;
+}
+
+unsigned long CExpander::endSection()
+{
+ unsigned long current = locate();
+ if (m_currentstart > current || current > m_currentend)
+ {
+ start2endSection();
+ }
+ return m_currentend;
+}
+
+void CExpander::start2endSection()
+{
+ m_currentstart = 0;
+ unsigned long file;
+ sizes(file, m_currentend);
+}
+
+#ifdef USEQPE
+void CExpander::suspend(FILE*& fin)
+{
+ bSuspended = true;
+ suspos = ftell(fin);
+ fclose(fin);
+ fin = NULL;
+ sustime = time(NULL);
+}
+
+void CExpander::unsuspend(FILE*& fin)
+{
+ if (bSuspended)
+ {
+ bSuspended = false;
+ int delay = time(NULL) - sustime;
+ if (delay < 10) sleep(10-delay);
+ fin = fopen(fname, "rb");
+ for (int i = 0; fin == NULL && i < 5; i++)
+ {
+ sleep(5);
+ fin = fopen(fname, "rb");
+ }
+ if (fin == NULL)
+ {
+ QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
+ exit(0);
+ }
+ suspos = fseek(fin, suspos, SEEK_SET);
+ }
+}
+#endif
+
+void CExpander::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
+{
+ len = srclen;
+ data = new unsigned char[len];
+ memcpy(data, src, len);
+}
+
+void CExpander::putSaveData(unsigned char*& src, unsigned short& srclen)
+{
+ if (srclen != 0)
+ {
+ qDebug("Don't know what to do with non-zero save data");
+ }
+}
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,158 +1,149 @@
#ifndef __CExpander_h
#define __CExpander_h
+#ifndef _WINDOWS
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <qmessagebox.h>
#include "useqpe.h"
#include "config.h"
#include "StyleConsts.h"
#include "Markups.h"
#include "names.h"
#include "linktype.h"
-/* OPIE */
-#include <opie2/odebug.h>
-
-/* QT */
-#include <qmessagebox.h>
-
-/* STD */
-#ifndef _WINDOWS
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <time.h>
-
class QImage;
class Bkmk;
+class QString;
template<class T>
class CList;
class CCharacterSource
{
public:
- virtual void getch(tchar&, CStyle&) = 0;
- virtual linkType hyperlink(unsigned int n, QString&) = 0;
+ virtual void getch(tchar&, CStyle&, unsigned long&) = 0;
+ virtual linkType hyperlink(unsigned int n, unsigned int noff, QString&, QString& nm) = 0;
+ virtual void locate(unsigned int n) = 0;
+ virtual bool findanchor(const QString& nm) = 0;
+ virtual void saveposn(const QString& f, size_t posn) = 0;
+ virtual void writeposn(const QString& f, size_t posn) = 0;
+ virtual linkType forward(QString& f, size_t& loc) = 0;
+ virtual linkType back(QString& f, size_t& loc) = 0;
+ virtual bool hasnavigation() = 0;
+ virtual int getwidth() = 0;
+ virtual QImage* getPicture(unsigned long) = 0;
+ virtual QImage* getPicture(const QString& href) = 0;
+ virtual bool getFile(const QString& href) = 0;
+ virtual QString about() = 0;
};
-class CExpander
+class CExpander_Interface
+{
+ public:
+#ifdef USEQPE
+ virtual void suspend() = 0;
+ virtual void unsuspend() = 0;
+#endif
+ virtual QString about() = 0;
+ virtual size_t getHome() = 0;
+ //CExpander_Interface();
+ //virtual ~CExpander_Interface();
+ virtual int openfile(const char *src) = 0;
+ //virtual int OpenFile(const char *src) = 0;
+ virtual unsigned int locate() = 0;
+ virtual void locate(unsigned int n) = 0;
+ virtual bool hasrandomaccess() = 0;
+ virtual void sizes(unsigned long& file, unsigned long& text) = 0;
+ virtual CList<Bkmk>* getbkmklist() { return NULL; }
+ virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos) = 0;
+ virtual int getch() = 0;
+ virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) = 0;
+ virtual MarkupType PreferredMarkup() = 0;
+ virtual void saveposn(size_t posn) {}
+ virtual void writeposn(size_t posn) {}
+ virtual linkType forward(size_t& loc) { return eNone; }
+ virtual linkType back(size_t& loc) { return eNone; }
+ virtual bool hasnavigation() { return false; }
+ virtual unsigned long startSection() = 0;
+ virtual unsigned long endSection() = 0;
+ virtual void start2endSection() = 0;
+ virtual QImage* getPicture(unsigned long tgt) { return NULL; }
+ virtual void setContinuous(bool _b) = 0;
+#ifdef USEQPE
+ virtual void suspend(FILE*& fin) = 0;
+ virtual void unsuspend(FILE*& fin) = 0;
+#endif
+ virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) = 0;
+ virtual void putSaveData(unsigned char*& src, unsigned short& srclen) = 0;
+ virtual void setwidth(int w) = 0;
+ // bool findstring(const QString& info);
+ // int getpara(CBuffer& buff);
+ virtual int getwidth() = 0;
+ virtual QImage* getPicture(const QString& href) = 0;
+ virtual bool getFile(const QString& href) = 0;
+};
+
+class CExpander : public CExpander_Interface
{
protected:
size_t m_homepos;
bool m_continuous;
char* fname;
bool bSuspended;
size_t suspos;
time_t sustime;
int m_scrWidth;
unsigned long m_currentstart, m_currentend;
public:
#ifdef USEQPE
virtual void suspend() = 0;
virtual void unsuspend() = 0;
#endif
- size_t getHome() { return m_homepos; }
- CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {};
- virtual ~CExpander() { if (fname != NULL) delete [] fname; };
- int openfile(const char *src)
- {
- bSuspended = false;
- fname = strdup(src);
- return OpenFile(src);
- }
+ size_t getHome();
+ CExpander();
+ virtual ~CExpander();
+ int openfile(const char *src);
virtual int OpenFile(const char *src) = 0;
virtual unsigned int locate() = 0;
virtual void locate(unsigned int n) = 0;
virtual bool hasrandomaccess() = 0;
virtual void sizes(unsigned long& file, unsigned long& text) = 0;
virtual CList<Bkmk>* getbkmklist() { return NULL; }
- virtual void getch(tchar& ch, CStyle& sty)
- {
- int ich = getch();
- ch = (ich == EOF) ? UEOF : ich;
- sty.unset();
- }
+ virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos);
virtual int getch() = 0;
- virtual linkType hyperlink(unsigned int n, QString& wrd)
- {
- locate(n);
- return eLink;
- }
+ virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm);
virtual MarkupType PreferredMarkup() = 0;
virtual void saveposn(size_t posn) {}
virtual void writeposn(size_t posn) {}
- virtual bool forward(size_t& loc) { return false; }
- virtual bool back(size_t& loc) { return false; }
+ virtual linkType forward(size_t& loc) { return eNone; }
+ virtual linkType back(size_t& loc) { return eNone; }
virtual bool hasnavigation() { return false; }
- unsigned long startSection()
- {
- unsigned long current = locate();
- if (m_currentstart > current || current > m_currentend)
- {
- start2endSection();
- }
- return m_currentstart;
- }
- unsigned long endSection()
- {
- unsigned long current = locate();
- if (m_currentstart > current || current > m_currentend)
- {
- start2endSection();
- }
- return m_currentend;
- }
- virtual void start2endSection()
- {
- m_currentstart = 0;
- unsigned long file;
- sizes(file, m_currentend);
- }
+ unsigned long startSection();
+ unsigned long endSection();
+ virtual void start2endSection();
virtual QImage* getPicture(unsigned long tgt) { return NULL; }
void setContinuous(bool _b) { m_continuous = _b; }
#ifdef USEQPE
- virtual void suspend(FILE*& fin)
- {
- bSuspended = true;
- suspos = ftell(fin);
- fclose(fin);
- fin = NULL;
- sustime = time(NULL);
- }
- virtual void unsuspend(FILE*& fin)
- {
- if (bSuspended)
- {
- bSuspended = false;
- int delay = time(NULL) - sustime;
- if (delay < 10) sleep(10-delay);
- fin = fopen(fname, "rb");
- for (int i = 0; fin == NULL && i < 5; i++)
- {
- sleep(5);
- fin = fopen(fname, "rb");
- }
- if (fin == NULL)
- {
- QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
- exit(0);
- }
- suspos = fseek(fin, suspos, SEEK_SET);
- }
- }
+ virtual void suspend(FILE*& fin);
+ virtual void unsuspend(FILE*& fin);
#endif
- virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
+ virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen);
+ virtual void putSaveData(unsigned char*& src, unsigned short& srclen);
+ void setwidth(int w)
{
- len = srclen;
- data = new unsigned char[len];
- memcpy(data, src, len);
+ m_scrWidth = w;
}
- virtual void putSaveData(unsigned char*& src, unsigned short& srclen)
+ int getwidth()
{
- if (srclen != 0)
- {
- odebug << "Don't know what to do with non-zero save data" << oendl;
- }
+ return m_scrWidth;
}
- void setwidth(int w) { m_scrWidth = w; }
+ // bool findstring(const QString& info);
+ // int getpara(CBuffer& buff);
+ virtual QImage* getPicture(const QString& href) { return NULL; }
+ virtual bool getFile(const QString& href) { return false; }
};
#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,741 +1,815 @@
+#include <qmap.h>
+#include <qfileinfo.h>
+#include <qtextstream.h>
+#include <qdir.h>
+#include "useqpe.h"
+#ifdef USEQPE
+#include <qpe/global.h>
+#endif
+#include "CDrawBuffer.h"
#include "CFilter.h"
+#include "hrule.h"
+#include "util.h"
-unsigned short striphtml::skip_ws()
-{
- tchar ch;
- CStyle sty;
- do
- {
- parent->getch(ch, sty);
- }
- while (ch < 33);
- return ch;
-}
-
-unsigned short striphtml::skip_ws_end()
-{
- tchar ch;
- CStyle sty;
- parent->getch(ch, sty);
- if (ch == ' ')
- {
- do
- {
- parent->getch(ch, sty);
- }
- while (ch != '>');
- }
- return ch;
-}
-
-unsigned short striphtml::parse_m()
-{
- tchar ch;
- CStyle sty;
- parent->getch(ch, sty);
- if (ch == 'm' || ch == 'M')
- {
- ch = skip_ws_end();
- if (ch == '>')
- {
- return 0;
- }
- }
- return ch;
-}
-
-void striphtml::mygetch(tchar& ch, CStyle& sty)
-{
- parent->getch(ch, sty);
- if (ch == 10) ch = ' ';
-}
-
-void striphtml::getch(tchar& ch, CStyle& sty)
-{
- CStyle dummy;
- mygetch(ch, dummy);
- if (ch == 10) ch = ' ';
- while (ch == '<')
- {
- ch = skip_ws();
-
- switch (ch)
- {
- case 'p':
- case 'P':
- ch = skip_ws_end();
- if (ch == '>')
- {
- ch = 10;
- continue;
- }
- break;
- case 'b':
- case 'B':
- ch = skip_ws_end();
- if (ch == '>')
- {
- currentstyle.setBold();
- mygetch(ch, dummy);
- continue;
- }
- else if (ch == 'r' || ch == 'R')
- {
- ch = skip_ws_end();
- if (ch == '>')
- {
- ch = 10;
- continue;
- }
- }
- break;
- case 'i':
- case 'I':
- ch = skip_ws_end();
- if (ch == '>')
- {
- currentstyle.setItalic();
- mygetch(ch, dummy);
- continue;
- }
- break;
- case 'e':
- case 'E':
- if ((ch = parse_m()) == 0)
- {
- currentstyle.setItalic();
- mygetch(ch, dummy);
- continue;
- }
- break;
- case 'h':
- case 'H':
- mygetch(ch, dummy);
- if ('0' < ch && ch <= '9')
- {
- tchar hs = ch;
- ch = skip_ws_end();
- if (ch == '>')
- {
- switch (hs)
- {
- case '1':
-// currentstyle = ucBold | ucFontBase+2 | (ucAlignCentre << ucAlignShift);
- currentstyle.unset();
- currentstyle.setFontSize(2);
- currentstyle.setBold();
- currentstyle.setCentreJustify();
- break;
- case '2':
-// currentstyle = ucBold | ucFontBase+1;
- currentstyle.unset();
- currentstyle.setFontSize(1);
- currentstyle.setBold();
- break;
- default:
-// currentstyle = ucBold | ucFontBase;
- currentstyle.unset();
- currentstyle.setBold();
- }
- ch = 10;
-// mygetch(ch, dummy);
- continue;
- }
- }
- break;
- case '/':
- mygetch(ch, dummy);
- switch (ch)
- {
- case 'b':
- case 'B':
- ch = skip_ws_end();
- if (ch == '>')
- {
- currentstyle.unsetBold();
- mygetch(ch, dummy);
- continue;
- }
- break;
- case 'i':
- case 'I':
- ch = skip_ws_end();
- if (ch == '>')
- {
- currentstyle.unsetItalic();
- mygetch(ch, dummy);
- continue;
- }
- break;
- case 'e':
- case 'E':
- if ((ch = parse_m()) == 0)
- {
- currentstyle.unsetItalic();
- mygetch(ch, dummy);
- continue;
- }
- break;
- case 'h':
- case 'H':
- mygetch(ch, dummy);
- if ('0' < ch && ch <= '9')
- {
- ch = skip_ws_end();
- if (ch == '>')
- {
- currentstyle.unset();
- //mygetch(ch, dummy);
- ch = 10;
- continue;
- }
- }
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- while (ch != '>' && ch != UEOF)
- {
- mygetch(ch, dummy);
- }
- mygetch(ch, dummy);
- }
- if (ch == '&')
- {
- mygetch(ch, dummy);
- if (ch == '#')
- {
- int id = 0;
- mygetch(ch, dummy);
- while (ch != ';' && ch != UEOF)
- {
- id = 10*id+ch-'0';
- mygetch(ch, dummy);
- }
- ch = id;
- }
- }
-// sty = (dummy == ucFontBase) ? currentstyle : dummy;
- sty = currentstyle;
- return;
-}
-
+#include <qregexp.h>
+#include <qimage.h>
+#include <qpixmap.h>
+//#include <qprogressdialog.h>
+//#include <qapplication.h>
-void textfmt::mygetch(tchar& ch, CStyle& sty)
+void textfmt::mygetch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (uselast)
{
ch = lastchar;
uselast = false;
}
else
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
}
}
-void textfmt::getch(tchar& ch, CStyle& sty)
+void textfmt::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- mygetch(ch, sty);
+ mygetch(ch, sty, pos);
do
{
sty = currentstyle;
switch (ch)
{
case 10:
currentstyle.unset();
sty = currentstyle;
break;
// Use this if you want to replace -- by em-dash
case '-':
// parent->getch(ch, sty);
- mygetch(ch, sty);
+ mygetch(ch, sty, pos);
if (ch == '-')
{
ch = 0x2014;
}
else
{
lastchar = ch;
uselast = true;
ch = '-';
}
break;
case '*':
if (currentstyle.isBold())
{
// Already bold - time to turn it off?
// The next two lines ensure that * follows a character but it works better without
// QChar c(lastchar);
// if ((lastchar != '*') && (c.isPunct() || c.isLetterOrNumber()))
if (lastchar != '*')
{
currentstyle.unsetBold();
CStyle dummy;
// parent->getch(ch, dummy);
- mygetch(ch, dummy);
+ mygetch(ch, dummy, pos);
}
}
else
{
// not bold - time to turn it on?
CStyle dummy;
// parent->getch(ch, dummy);
- mygetch(ch, dummy);
+ mygetch(ch, dummy, pos);
QChar c(ch);
if ((ch != '*') && (c.isPunct() || c.isLetterOrNumber()))
{
currentstyle.setBold();
}
else
{
lastchar = ch;
uselast = true;
ch = '*';
}
}
break;
case '_':
if (currentstyle.isItalic())
{
// Already bold - time to turn it off?
// The next two lines ensure that * follows a character but it works better without
// QChar c(lastchar);
// if ((lastchar != '_') && (c.isPunct() || c.isLetterOrNumber()))
if (lastchar != '_')
{
currentstyle.unsetItalic();
CStyle dummy;
// parent->getch(ch, dummy);
- mygetch(ch, dummy);
+ mygetch(ch, dummy, pos);
}
}
else
{
// not bold - time to turn it on?
CStyle dummy;
// parent->getch(ch, dummy);
- mygetch(ch, dummy);
+ mygetch(ch, dummy, pos);
QChar c(ch);
if ((ch != '_') && (c.isPunct() || c.isLetterOrNumber()))
{
currentstyle.setItalic();
}
else
{
lastchar = ch;
uselast = true;
ch = '_';
}
}
break;
}
}
while (sty != currentstyle);
if (!uselast) lastchar = ch;
return;
}
-void remap::getch(tchar& ch, CStyle& sty)
+void remap::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (q[offset] != 0)
{
q[offset++];
sty = currentstyle;
return;
}
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
switch (ch)
{
case 0x201a:
ch = '\'';
break;
case 0x0192:
ch = 'f';
break;
case 0x201e:
ch = '"';
break;
case 0x2026:
offset = 0;
q[0] = '.';
q[1] = '.';
q[2] = 0;
ch = '.'; // should be ...
break;
case 0x0160:
ch = 'S';
break;
case 0x2039:
ch = '<';
break;
case 0x0152:
offset = 0;
q[0] = 'E';
q[1] = 0;
ch = 'O';
break;
case 0x017d:
ch = 'Z';
break;
case 0x2018:
ch = '\'';
break;
case 0x2019:
ch = '\'';
break;
case 0x201c:
ch = '"';
break;
case 0x201d:
ch = '"';
break;
case 0x2022:
ch = '>';
break;
case 0x2013:
ch = '-';
break;
case 0x2014:
offset = 0;
q[0] = '-';
q[1] = 0;
ch = '-'; // should be --
break;
case 0x02dc:
ch = '~';
break;
case 0x0161:
ch = 's';
break;
case 0x203a:
ch = '>';
break;
case 0x0153:
offset = 0;
q[0] = 'e';
q[1] = 0;
ch = 'o';// should be oe
break;
+ /*
+ case 0x0009: // tab
+ offset = 0;
+ q[0] = ' ';
+ q[1] = 0;
+ ch = ' ';
+ break;
+ */
case 0x017e:
ch = 'z';
break;
case 0x0178:
ch = 'Y';
break;
}
currentstyle = sty;
}
-void PeanutFormatter::getch(tchar& ch, CStyle& sty)
+void PeanutFormatter::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
CStyle dummy;
currentstyle.setColour(0,0,0);
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
while (ch == '\\')
{
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
if (ch == '\\') break;
switch(ch)
{
case 'a':
{
int code = 0;
for (int i = 0; i < 3; i++)
{
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
code = 10*code + ch - '0';
}
ch = code;
}
break;
case 'v':
{
while (1)
{
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
if (ch == '\\')
{
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
if (ch == 'v')
{
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
break;
}
}
}
}
break;
case 's':
case 'n':
currentstyle.setFontSize(0);
- parent->getch(ch,dummy);
+ parent->getch(ch,dummy, pos);
break;
case 'p':
currentstyle.unset();
// parent->getch(ch,dummy);
ch = 10;
break;
case 'l':
if (currentstyle.getFontSize() == 1)
{
currentstyle.setFontSize(0);
}
else
{
currentstyle.setFontSize(1);
}
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
break;
case 'x':
if (currentstyle.getFontSize() == 0)
{
// currentstyle.unset();
// currentstyle.setBold();
currentstyle.setFontSize(1);
}
else
{
currentstyle.unset();
}
// parent->getch(ch, dummy);
ch = 10;
break;
case 'i':
if (currentstyle.isItalic())
{
currentstyle.unsetItalic();
}
else
{
currentstyle.setItalic();
}
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
break;
case 'b':
case 'B':
if (currentstyle.isBold())
{
currentstyle.unsetBold();
}
else
{
currentstyle.setBold();
}
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
break;
case 'c':
if (currentstyle.getJustify() == m_AlignCentre)
{
currentstyle.setLeftJustify();
}
else
{
currentstyle.setCentreJustify();
}
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
break;
case 'r':
if (currentstyle.getJustify() == m_AlignRight)
{
currentstyle.setLeftJustify();
}
else
{
currentstyle.setRightJustify();
}
- parent->getch(ch, dummy);
+ parent->getch(ch, dummy, pos);
break;
default:
currentstyle.setColour(255,0,0);
}
}
sty = currentstyle;
}
-void OnePara::getch(tchar& ch, CStyle& sty)
+void OnePara::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
if (m_lastchar == 10)
{
- while (ch == 10) parent->getch(ch, sty);
+ while (ch == 10) parent->getch(ch, sty, pos);
}
m_lastchar = ch;
}
-#ifdef REPALM
-void repalm::getch(tchar& ch, CStyle& sty)
+void repalm::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
switch (ch)
{
case 0x80:
ch = 0x20ac;
break;
case 0x82:
ch = 0x201a;
break;
case 0x83:
ch = 0x0192;
break;
case 0x84:
ch = 0x201e;
break;
case 0x85:
ch = 0x2026;
break;
case 0x86:
ch = 0x2020;
break;
case 0x87:
ch = 0x2021;
break;
case 0x88:
ch = 0x02c6;
break;
case 0x89:
ch = 0x2030;
break;
case 0x8a:
ch = 0x0160;
break;
case 0x8b:
ch = 0x2039;
break;
case 0x8c:
ch = 0x0152;
break;
/*
case 0x8e:
ch = 0x017d;
break;
*/
case 0x91:
ch = 0x2018;
break;
case 0x92:
ch = 0x2019;
break;
case 0x93:
ch = 0x201c;
break;
case 0x94:
ch = 0x201d;
break;
case 0x95:
ch = 0x2022;
break;
case 0x96:
ch = 0x2013;
break;
case 0x97:
ch = 0x2014;
break;
case 0x98:
ch = 0x02dc;
break;
case 0x99:
ch = 0x2122;
break;
case 0x9a:
ch = 0x0161;
break;
case 0x9b:
ch = 0x203a;
break;
case 0x9c:
ch = 0x0153;
break;
case 0x9e:
ch = 0x017e;
break;
case 0x9f:
ch = 0x0178;
break;
case 0x18:
ch = 0x2026;
break;
case 0x19:
ch = 0x2007;
break;
case 0x8d:
ch = 0x2662;
break;
case 0x8e:
ch = 0x2663;
break;
case 0x8f:
ch = 0x2661;
break;
case 0x90:
ch = 0x2660;
break;
default:
break;
}
}
-#endif
//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 };
//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 };
-void DePluck::getch(tchar& ch, CStyle& sty)
+void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (m_buffed > 0)
{
sty = m_laststyle;
ch = nextpart[m_current++];
if (m_current == m_buffed)
{
m_current = m_buffed = 0;
}
}
else
{
if (m_buffer != 0)
{
ch = m_buffer;
m_buffer = 0;
return;
}
- unsigned long lnk;
+ unsigned long lnk, lnkoff;
do
{
if (nextpart[m_buffed] == 0) break;
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
m_laststyle = sty;
- if (sty.getLink()) lnk = sty.getData();
+ if (sty.getLink())
+ {
+ lnk = sty.getData();
+ lnkoff = sty.getOffset();
+ }
} while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed);
m_current = 0;
if (nextpart[m_buffed] == 0)
{
m_buffed = 0;
- QString dmy;
- parent->hyperlink(lnk, dmy);
+ QString dmy, dmy2;
+ parent->hyperlink(lnk, lnkoff, dmy, dmy2);
do
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
}
while (ch != 10);
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
}
else if (m_buffed > 0)
{
m_buffer = ch;
ch = nextpart[0];
if (m_buffed == 1)
{
m_buffed = 0;
}
else m_current = 1;
}
}
return;
}
+
+HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255)
+{
+}
+
+#include "Bkmks.h"
+#include "QTReader.h"
+
+void HighlightFilter::refresh(unsigned long pos)
+{
+ bkmks = pReader->Bkmklist();
+
+ red = green = blue = 255;
+
+ if (bkmks == NULL)
+ {
+ lastpos = 0;
+ nextpos = 0xffffffff;
+ }
+ else
+ {
+ lastpos = 0;
+ nextpos = 0xffffffff;
+ for (CList<Bkmk>::iterator i = bkmks->begin(); i != bkmks->end(); i++)
+ {
+ if ((*i).value() <= pos && pos < (*i).value2())
+ {
+ red = i->red();
+ green = i->green();
+ blue = i->blue();
+ lastpos = (*i).value();
+ nextpos = (*i).value2();
+ break;
+ }
+ if ((*i).value() > pos)
+ {
+ nextpos = (*i).value();
+ break;
+ }
+ lastpos = (*i).value();
+ }
+ }
+}
+
+void HighlightFilter::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ parent->getch(ch, sty, pos);
+ if (bkmks != pReader->Bkmklist() || pos <= lastpos || pos >= nextpos)
+ {
+ // qDebug("Recalc <%lu, %lu, %lu>", lastpos, pos, nextpos);
+ refresh(pos);
+ // qDebug("Recalc(2) <%lu, %lu, %lu>", lastpos, pos, nextpos);
+ }
+ int r = sty.bRed(), g = sty.bGreen(), b = sty.bBlue();
+ if (r == 255 && g == 255 && b == 255)
+ {
+ sty.setBackground(red, green, blue);
+ }
+}
+
+void kern::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ if (uselast)
+ {
+ ch = lastchar;
+ sty = laststy;
+ uselast = false;
+ return;
+ }
+ else
+ {
+ parent->getch(ch, sty, pos);
+ }
+ switch (ch)
+ {
+ case 'f':
+ {
+ tchar savedchar = 'f';
+ parent->getch(ch, sty, pos);
+ switch (ch)
+ {
+ case 'i':
+ ch = (251 << 8) + 1;
+ break;
+ case 'l':
+ ch = (251 << 8) + 2;
+ break;
+ default:
+ lastchar = ch;
+ uselast = true;
+ laststy = sty;
+ ch = savedchar;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+class ErrorFilter : public CFilter
+{
+ QString error;
+ int currentpos;
+ public:
+ ErrorFilter(const QString& _s) : error(_s), currentpos(0) {}
+ ~ErrorFilter() {}
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
+ {
+ if (currentpos == error.length())
+ {
+ ch = UEOF;
+ currentpos = 0;
+ }
+ else
+ {
+ ch = error[currentpos++].unicode();
+ }
+ }
+ QString about() { return parent->about(); }
+};
+
+#ifndef __STATIC
+ExternFilter::ExternFilter(const QString& nm, const QString& optional) : filt(NULL), handle(NULL)
+{
+ QString filterpath(QTReaderUtil::getPluginPath("filters/lib"));
+ filterpath += nm;
+ filterpath += ".so";
+ if (QFile::exists(filterpath))
+ {
+ qDebug("Filter:%s", (const char*)filterpath);
+ handle = dlopen(filterpath, RTLD_LAZY);
+ if (handle == 0)
+ {
+ qDebug("Can't find filter:%s", dlerror());
+ // status = -10;
+ filt = new ErrorFilter(QString("Can't find plugin:")+nm);
+ return;
+ }
+ CFilter* (*newfilter)(const QString&);
+ newfilter = (CFilter* (*)(const QString&))dlsym(handle, "newfilter");
+ if (newfilter == NULL)
+ {
+ qDebug("Can't find newfilter");
+ filt = new ErrorFilter(QString("Can't find entry point in plugin:")+nm);
+ return;
+ }
+ filt = (*newfilter)(optional);
+ }
+ else
+ {
+ qDebug("No filter path");
+ filt = new ErrorFilter(QString("No filter plugins installed:")+nm);
+ }
+ if (filt == NULL)
+ {
+ qDebug("Can't do newfilter");
+ filt = new ErrorFilter(QString("Filter creation failed:")+nm);
+ return;
+ }
+}
+#endif
+
+void makeInverse::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ parent->getch(ch, sty, pos);
+ int r,g,b;
+ r = 255 - sty.Red(), g = 255 - sty.Green(), b = 255 - sty.Blue();
+ sty.setColour(r,g,b);
+ r = 255 - sty.bRed(), g = 255 - sty.bGreen(), b = 255 - sty.bBlue();
+ sty.setBackground(r,g,b);
+ r = 255 - sty.pRed(), g = 255 - sty.pGreen(), b = 255 - sty.pBlue();
+ sty.setPaper(r,g,b);
+}
+/*
+void makeNegative::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ parent->getch(ch, sty, pos);
+ QColor fg(sty.Red(), sty.Green(), sty.Blue());
+ int h,s,v;
+ fg.hsv(&h,&s,&v);
+ fg.setHsv(h,s,255-v);
+ int r,g,b;
+ fg.rgb(&r,&g,&b);
+ sty.setColour(r,g,b);
+
+ fg = QColor(sty.bRed(), sty.bGreen(), sty.bBlue());
+ fg.hsv(&h,&s,&v);
+ fg.setHsv(h,s,255-v);
+ fg.rgb(&r,&g,&b);
+ sty.setBackground(r,g,b);
+}
+*/
+void setbg::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ parent->getch(ch, sty, pos);
+ int r = sty.pRed(), g = sty.pGreen(), b = sty.pBlue();
+ if (r == 255 && g == 255 && b == 255)
+ {
+ sty.setPaper(m_r,m_g,m_b);
+ }
+ else
+ {
+ qDebug("We have background [%x%x%x]", r, g, b);
+ }
+ r = sty.bRed(), g = sty.bGreen(), b = sty.bBlue();
+ if (r == 255 && g == 255 && b == 255)
+ {
+ sty.setBackground(m_r,m_g,m_b);
+ }
+ else
+ {
+ qDebug("We have background [%x%x%x]", r, g, b);
+ }
+}
+
+void setfg::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ parent->getch(ch, sty, pos);
+ int r = sty.Red(), g = sty.Green(), b = sty.Blue();
+ if (r == 0 && g == 0 && b == 0)
+ {
+ sty.setColour(m_r,m_g,m_b);
+ }
+}
+
+#include "CRegExp.h"
+
+repara::repara(const QString& pat) : tch(0)
+{
+ // QString pat("{\\n[A-Z\"]}");
+ flt = new CRegExpFilt(pat, false);
+ qDebug("Construction done");
+}
+
+repara::~repara()
+{
+ delete flt;
+}
+
+void repara::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ if (flt->empty())
+ {
+ while (flt->empty())
+ {
+ parent->getch(ch, sty, pos);
+ flt->addch(ch);
+ }
+ }
+ ch = flt->pop();
+ /*
+ parent->getch(ch, sty, pos);
+ if (ch == 10 || ch == ' ')
+ {
+ if (tch == 10)
+ {
+ tch = ch;
+ ch = 10;
+ return;
+ }
+ else
+ {
+ tch = ch;
+ ch = ' ';
+ return;
+ }
+ }
+ tch = ch;
+ */
+ return;
+}
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
@@ -1,328 +1,475 @@
#ifndef __CFILTER_H
#define __CFILTER_H
#include "CExpander.h"
#include "CEncoding.h"
-class CFilter : public CCharacterSource
+class CFilter_IFace : public CCharacterSource
+{
+ public:
+ virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) = 0;
+ virtual void setparent(CCharacterSource* p) = 0;
+ virtual ~CFilter_IFace() {};
+ virtual void locate(unsigned int n) = 0;
+ virtual bool findanchor(const QString& nm) = 0;
+ virtual void saveposn(const QString& f, size_t posn) = 0;
+ virtual void writeposn(const QString& f, size_t posn) = 0;
+ virtual linkType forward(QString& f, size_t& loc) = 0;
+ virtual linkType back(QString& f, size_t& loc) = 0;
+ virtual bool hasnavigation() = 0;
+ virtual int getwidth() = 0;
+ virtual CCharacterSource* getparent() = 0;
+};
+
+class CFilter : public CFilter_IFace
{
- friend class CFilterChain;
protected:
CCharacterSource* parent;
- linkType hyperlink(unsigned int n, QString& w)
+ public:
+ virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm)
{
- return parent->hyperlink(n,w);
+ return parent->hyperlink(n,noff,w,nm);
}
- public:
CFilter() : parent(NULL) {}
void setparent(CCharacterSource* p) { parent = p; }
+ CCharacterSource* getparent() { return parent; }
virtual ~CFilter() {};
+ virtual void locate(unsigned int n)
+ {
+ parent->locate(n);
+ }
+ virtual bool findanchor(const QString& nm)
+ {
+ return parent->findanchor(nm);
+ }
+ virtual void saveposn(const QString& f, size_t posn) { parent->saveposn(f, posn); }
+ virtual void writeposn(const QString& f, size_t posn) { parent->writeposn(f, posn); }
+ virtual linkType forward(QString& f, size_t& loc) { return parent->forward(f, loc); }
+ virtual linkType back(QString& f, size_t& loc) { return parent->back(f, loc); }
+ virtual bool hasnavigation() { return parent->hasnavigation(); }
+ virtual int getwidth() { return parent->getwidth(); }
+ QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); }
+ QImage* getPicture(const QString& href) { return parent->getPicture(href); }
+ bool getFile(const QString& href) { return parent->getFile(href); }
};
class CFilterChain
{
- CExpander* expander;
+ CExpander_Interface* expander;
CEncoding* encoder;
- CFilter* first;
+ CFilter_IFace* first;
CCharacterSource* front;
public:
CFilterChain(CEncoding* _e) : encoder(_e), first(NULL), front(_e) {};
~CFilterChain()
{
CCharacterSource* p = front;
while (p != encoder)
{
- CFilter* pnext = (CFilter*)p;
- p = ((CFilter*)p)->parent;
+ CFilter_IFace* pnext = (CFilter_IFace*)p;
+ p = ((CFilter_IFace*)p)->getparent();
delete pnext;
}
delete encoder;
}
- void getch(tchar& ch, CStyle& sty)
+ linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm)
+ {
+ return front->hyperlink(n, noff, wrd, nm);
+ }
+ void locate(unsigned int n)
+ {
+ front->locate(n);
+ }
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- front->getch(ch, sty);
+ front->getch(ch, sty, pos);
}
- void addfilter(CFilter* p)
+ void addfilter(CFilter_IFace* p)
{
if (first == NULL)
{
front = first = p;
p->setparent(encoder);
}
else
{
p->setparent(front);
front = p;
}
}
- void setsource(CExpander* p)
+ void setsource(CExpander_Interface* p)
{
expander = p;
encoder->setparent(p);
}
void setencoder(CEncoding* p)
{
delete encoder;
encoder = p;
first->setparent(p);
encoder->setparent(expander);
}
+ bool findanchor(const QString& nm)
+ {
+ return front->findanchor(nm);
+ }
+ void saveposn(const QString& f, size_t posn) { front->saveposn(f, posn); }
+ void writeposn(const QString& f, size_t posn) { front->writeposn(f, posn); }
+ linkType forward(QString& f, size_t& loc) { return front->forward(f, loc); }
+ linkType back(QString& f, size_t& loc) { return front->back(f, loc); }
+ bool hasnavigation() { return front->hasnavigation(); }
+ QString about() { return QString("Filter chain (c) Tim Wentford\n")+front->about(); }
};
class stripcr : public CFilter
{
public:
stripcr() {}
~stripcr() {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
do
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
}
while (ch == 13);
}
+ QString about() { return QString("StripCR filter (c) Tim Wentford\n")+parent->about(); }
};
class dehyphen : public CFilter
{
bool m_bCharWaiting;
tchar m_nextChar;
CStyle m_nextSty;
public:
dehyphen() : m_bCharWaiting(false) {}
~dehyphen() {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (m_bCharWaiting)
{
m_bCharWaiting = false;
ch = m_nextChar;
sty = m_nextSty;
return;
}
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
if (ch != '-') return;
- parent->getch(m_nextChar, m_nextSty);
+ parent->getch(m_nextChar, m_nextSty, pos);
if (m_nextChar != 10)
{
m_bCharWaiting = true;
ch = '-';
return;
}
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
}
+ QString about() { return QString("Hyphenation filter (c) Tim Wentford\n")+parent->about(); }
};
-class striphtml : public CFilter
+template<class A, class B>class QMap;
+
+const int m_cmaxdepth = 8;
+
+class htmlmark
{
- CStyle currentstyle;
- unsigned short skip_ws();
- unsigned short skip_ws_end();
- unsigned short parse_m();
- void mygetch(tchar& ch, CStyle& sty);
+ QString file;
+ size_t pos;
public:
- striphtml() {}
- ~striphtml() {}
- void getch(tchar& ch, CStyle& sty);
+ htmlmark() : file(), pos(0) {}
+ htmlmark(const QString& _f, size_t _p) : file(_f), pos(_p) {}
+ QString filename() { return file; }
+ size_t posn() { return pos; }
};
class unindent : public CFilter
{
tchar lc;
public:
unindent() : lc(0) {}
~unindent() {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (lc == 10)
{
do
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
}
while (ch == ' ');
}
- else parent->getch(ch, sty);
+ else parent->getch(ch, sty, pos);
lc = ch;
return;
}
+ QString about() { return QString("Unindent filter (c) Tim Wentford\n")+parent->about(); }
};
+class CRegExpFilt;
class repara : public CFilter
{
tchar tch;
+ CRegExpFilt* flt;
public:
- repara() : tch(0) {}
- ~repara() {}
- void getch(tchar& ch, CStyle& sty)
- {
- parent->getch(ch, sty);
- if (ch == 10)
- {
- if (tch == 10)
- {
- return;
- }
- else
- {
- tch = ch;
- ch = ' ';
- return;
- }
- }
- tch = ch;
- return;
- }
+ repara(const QString&);
+ ~repara();
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Reparagraph filter (c) Tim Wentford\n")+parent->about(); }
};
class indenter : public CFilter
{
int amnt;
int indent;
CStyle lsty;
public:
indenter(int _a=5) : amnt(_a), indent(0) {}
~indenter() {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (indent > 0)
{
indent--;
ch = ' ';
sty = lsty;
return;
}
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
if (ch == 10)
{
indent = amnt;
lsty = sty;
}
return;
}
+ QString about() { return QString("Indentation filter (c) Tim Wentford\n")+parent->about(); }
};
class dblspce : public CFilter
{
bool lastlf;
CStyle lsty;
public:
dblspce() : lastlf(false) {}
~dblspce() {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (lastlf)
{
lastlf = false;
ch = 10;
sty = lsty;
return;
}
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
if (lastlf = (ch == 10))
{
lsty = sty;
}
return;
}
+ QString about() { return QString("Double space (c) Tim Wentford\n")+parent->about(); }
};
class textfmt : public CFilter
{
CStyle currentstyle;
tchar lastchar;
bool uselast;
- void mygetch(tchar&, CStyle&);
+ void mygetch(tchar&, CStyle&, unsigned long& pos);
public:
textfmt() : lastchar(0), uselast(false) {}
~textfmt() {}
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Text formatting filter (c) Tim Wentford\n")+parent->about(); }
};
class embolden : public CFilter
{
public:
embolden() {}
~embolden() {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
sty.setBold();
}
+ QString about() { return QString("Emboldening filter (c) Tim Wentford\n")+parent->about(); }
};
class remap : public CFilter
{
tchar q[3];
int offset;
CStyle currentstyle;
public:
remap() : offset(0) { q[0] = 0; }
~remap() {}
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Character remapping filter (c) Tim Wentford\n")+parent->about(); }
};
class PeanutFormatter : public CFilter
{
CStyle currentstyle;
public:
~PeanutFormatter() {}
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("PML filter (c) Tim Wentford\n")+parent->about(); }
};
class OnePara : public CFilter
{
tchar m_lastchar;
public:
OnePara() : m_lastchar(0) {}
~OnePara() {}
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Single space filter (c) Tim Wentford\n")+parent->about(); }
};
class DePluck : public CFilter
{
tchar* nextpart;
tchar m_buffer;
int m_buffed;
int m_current;
bool m_debuff;
CStyle m_laststyle;
public:
DePluck(tchar* t) : nextpart(t), m_buffer(0), m_buffed(0), m_current(0), m_debuff(false) {}
~DePluck() {}
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Depluck filter (c) Tim Wentford\n")+parent->about(); }
};
-#ifdef REPALM
class repalm : public CFilter
{
public:
~repalm() {}
- void getch(tchar& ch, CStyle& sty);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Repalm filter (c) Tim Wentford\n")+parent->about(); }
};
-#endif
class FullJust : public CFilter
{
public:
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
if (sty.getJustify() == m_AlignLeft) sty.setFullJustify();
}
+ QString about() { return QString("Full justification filter (c) Tim Wentford\n")+parent->about(); }
};
/*
class AddSpace : public CFilter
{
unsigned char m_espc;
public:
AddSpace(unsigned char s) : m_espc(s) {}
- void getch(tchar& ch, CStyle& sty)
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
- parent->getch(ch, sty);
+ parent->getch(ch, sty, pos);
sty.setExtraSpace(m_espc);
}
};
*/
+
+class QTReader;
+
+class HighlightFilter : public CFilter
+{
+ QTReader* pReader;
+ unsigned long lastpos, nextpos;
+ unsigned char red, green, blue;
+ CList<Bkmk>* bkmks;
+ public:
+ HighlightFilter(QTReader*);
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ void refresh(unsigned long);
+ QString about() { return QString("High-lighting filter (c) Tim Wentford\n")+parent->about(); }
+};
+
+#include "static.h"
+#ifndef __STATIC
+#include <dlfcn.h>
+
+class ExternFilter : public CFilter_IFace
+{
+ CFilter* filt;
+ void *handle;
+ public:
+ linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm)
+ {
+ return filt->hyperlink(n, noff, w, nm);
+ }
+ void setparent(CCharacterSource* p) { filt->setparent(p); }
+ ExternFilter(const QString& nm, const QString& optional);
+ ~ExternFilter()
+ {
+ if (filt != NULL) delete filt;
+ if (handle != NULL) dlclose(handle);
+ }
+ void locate(unsigned int n) { filt->locate(n); }
+ bool findanchor(const QString& nm) { return filt->findanchor(nm); }
+ void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); }
+ void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); }
+ linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); }
+ linkType back(QString& f, size_t& loc) { return filt->back(f, loc); }
+ bool hasnavigation() { return filt->hasnavigation(); }
+ int getwidth() { return filt->getwidth(); }
+ CCharacterSource* getparent() { return filt->getparent(); }
+ void getch(tchar& c, CStyle& s, unsigned long& l) { filt->getch(c, s, l); }
+ QImage* getPicture(unsigned long tgt) { return filt->getPicture(tgt); }
+ CFilter* filter() { return filt; }
+ QImage* getPicture(const QString& href) { return filt->getPicture(href); }
+ bool getFile(const QString& href) { return filt->getFile(href); }
+ QString about() { return QString("Filter plug-in (c) Tim Wentford\n")+filt->about(); }
+};
+#endif
+
+class kern : public CFilter
+{
+ tchar lastchar;
+ bool uselast;
+ CStyle laststy;
+ public:
+ kern() : lastchar(0), uselast(false) {}
+ ~kern() {}
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Kerning filter (c) Tim Wentford\n")+parent->about(); }
+};
+
+class makeInverse : public CFilter
+{
+ public:
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Colourmap inversion filter (c) Tim Wentford\n")+parent->about(); }
+};
+/*
+class makeNegative : public CFilter
+{
+ public:
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+};
+*/
+class setbg : public CFilter
+{
+ int m_r, m_g, m_b;
+ public:
+ setbg(int _r, int _g, int _b) : m_r(_r), m_g(_g), m_b(_b) {}
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Background colour filter (c) Tim Wentford\n")+parent->about(); }
+};
+
+class setfg : public CFilter
+{
+ int m_r, m_g, m_b;
+ public:
+ setfg(int _r, int _g, int _b) : m_r(_r), m_g(_g), m_b(_b) {}
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ QString about() { return QString("Foreground colour filter (c) Tim Wentford\n")+parent->about(); }
+};
+
#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 @@
+#include "CHM.h"
+#include "chm_lib.h"
+#include "static.h"
+#include <qstring.h>
+#include <qstringlist.h>
+#include <stdio.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#ifndef __STATIC
+extern "C"
+{
+ CExpander* newcodec() { return new CHM; }
+}
+#endif
+
+static int _print_ui_index(struct chmFile *h, struct chmUnitInfo *ui,
+ void *context)
+{
+ CHM *chm = (CHM *)context;
+ QString temp = "<tr>";
+ char buff[1024];
+ sprintf( buff,"<td align=right>%8d\n</td><td><a href=\"%s\">%s</a></td></tr>",(int)ui->length, ui->path, ui->path);
+ temp += buff;
+ chm->addContent(temp);
+ return CHM_ENUMERATOR_CONTINUE;
+}
+
+static int _get_hhc (struct chmFile *h, struct chmUnitInfo *ui,
+ void *context)
+{
+ CHM *chm = (CHM *)context;
+ QString PathName = ui->path;
+ if (PathName.find(".hhc") > -1) {
+ chm->setPath(PathName);
+ }
+ return CHM_ENUMERATOR_CONTINUE;
+}
+
+CHM::CHM() {
+ chmFile = NULL;
+ chmPath = "";
+ chmHHCPath = "";
+ chmBuffer = "";
+ bufpos = 0;
+}
+
+CHM::~CHM() {
+ if (chmFile != NULL)
+ chm_close(chmFile);
+}
+
+void CHM::suspend() {
+#ifdef USEQPE
+ bSuspended = true;
+ //suspos = gztell(file);
+ chm_close(chmFile);
+ chmFile = NULL;
+ sustime = time(NULL);
+#endif
+}
+
+void CHM::unsuspend() {
+#ifdef USEQPE
+ if (bSuspended)
+ {
+ bSuspended = false;
+ int delay = time(NULL) - sustime;
+ if (delay < 10)
+ sleep(10-delay);
+ chmFile = chm_open(fname);
+ for (int i = 0; chmFile == NULL && i < 5; i++) {
+ sleep(5);
+ chmFile = chm_open(fname);
+ }
+ if (chmFile == NULL) {
+ QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
+ exit(0);
+ }
+ //suspos = gzseek(file, suspos, SEEK_SET);
+ }
+#endif
+}
+
+void CHM::addContent(QString content) {
+ chmBuffer += content;
+}
+
+void CHM::FillHomeContent() {
+ if (chmHHCPath != "") {
+ const char *ext;
+ char buffer[65536];
+ unsigned int swath, offset;
+ QString tmp="";
+ QString HTML="";
+ /* try to find the file */
+ const char *filename = (const char *)chmHHCPath;
+ if (chm_resolve_object(chmFile, filename, &m_ui) != CHM_RESOLVE_SUCCESS)
+ {
+ chmBuffer = "HELP";
+ fsize = chmBuffer.length();
+ return;
+ }
+ m_homestart = m_ui.start;
+ m_homeend = m_homestart + m_ui.length;
+ swath = 65536;
+ offset = 0;
+ fsize = m_ui.length;
+ while (offset < m_ui.length)
+ {
+ if ((m_ui.length - offset) < 65536)
+ swath = m_ui.length - offset;
+ else
+ swath = 65536;
+ swath = (int)chm_retrieve_object(chmFile, &m_ui, (unsigned char *) buffer, offset, swath);
+ tmp += buffer;
+ offset += swath;
+ }
+ HTML +="<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN>\r\n";
+ HTML +="<HTML>\r\n";
+ HTML +="<BODY>\r\n";
+ HTML +="<h2>Home Page</h2>\r\n";
+ HTML +="<h3>\r\n";
+ QStringList qsl = QStringList::split("\r\n",tmp);
+ QString NameFind ="<param name=\"Name\" value=\"";
+ QString LocalFind = "<param name=\"Local\" value=\"";
+ QString ULOpenFind = "<UL>";
+ QString LIOpenFind = "<LI>";
+ QString ULCloseFind = "</UL>";
+ QString Name = "";
+ QString Local = "";
+ for ( QStringList::Iterator it = qsl.begin(); it != qsl.end(); ++it ) {
+ QString Line = (*it);
+ int NamePos = Line.find( NameFind);
+ int LocalPos = Line.find( LocalFind);
+ if (NamePos > -1) {
+ Name = Line.mid(NamePos+NameFind.length(),Line.length());
+ Name = Name.left(Name.length() - 2);
+ }
+ if (LocalPos > -1) {
+ Local = Line.mid(LocalPos+LocalFind.length(),Line.length());
+ Local = Local.left(Local.length() - 2);
+ if (Name != "") {
+ HTML += "<br>\r\n<a href=";
+ HTML += Local;
+ HTML += ">";
+ HTML += Name;
+ HTML += "</a>\r\n";
+ Name = "";
+ }
+ }
+ }
+ HTML +="</h3>";
+ HTML +="</BODY>\r\n";
+ HTML +="</HTML>\r\n";
+ chmHomeBuffer = HTML;
+ chmBuffer = HTML;
+ fsize = chmBuffer.length();
+ m_currentstart = m_ui.start;
+ m_currentend = m_currentstart+chmBuffer.length();
+ }
+}
+
+bool CHM::FillBuffer()
+{
+ bool bRetVal = false;
+ char buffer[65536];
+ int swath, offset;
+ chmBuffer = "";
+ swath = 65536;
+ offset = 0;
+ fsize = m_ui.length;
+ while (offset < m_ui.length)
+ {
+ if ((m_ui.length - offset) < 65536)
+ swath = m_ui.length - offset;
+ else
+ swath = 65536;
+ swath = (int)chm_retrieve_object(chmFile, &m_ui, (unsigned char *) buffer, offset, swath);
+ chmBuffer += buffer;
+ offset += swath;
+ }
+ //There seems to be a ton of gobbledygook at the end that is reminiscent of the hhc file - remove it
+ QString temp = chmBuffer.lower();
+ int lpos = temp.find("</html");
+ if (lpos > -1) {
+ chmBuffer.truncate(lpos);
+ chmBuffer = chmBuffer+"</HTML>";
+ }
+ fsize = chmBuffer.length();
+
+ bufpos = 0;
+ bRetVal = true;
+ m_currentstart = m_ui.start;
+ m_currentend = m_currentstart+chmBuffer.length();
+ return bRetVal;
+}
+
+bool CHM::FillContent() {
+ bool bRetVal = false;
+ if (chmPath != "") {
+ /* try to find the file */
+ const char *filename = (const char *)chmPath;
+ if (chm_resolve_object(chmFile, filename, &m_ui) != CHM_RESOLVE_SUCCESS)
+ {
+ fsize = chmBuffer.length();
+ return bRetVal;
+ }
+
+ char buffer[65536];
+ int swath, offset;
+ chmBuffer = "";
+ swath = 65536;
+ offset = 0;
+ fsize = m_ui.length;
+ while (offset < m_ui.length)
+ {
+ if ((m_ui.length - offset) < 65536)
+ swath = m_ui.length - offset;
+ else
+ swath = 65536;
+ swath = (int)chm_retrieve_object(chmFile, &m_ui, (unsigned char *) buffer, offset, swath);
+ chmBuffer += buffer;
+ offset += swath;
+ }
+ //There seems to be a ton of gobbledygook at the end that is reminiscent of the hhc file - remove it
+ QString temp = chmBuffer.lower();
+ int lpos = temp.find("</html");
+ if (lpos > -1) {
+ chmBuffer.truncate(lpos);
+ chmBuffer = chmBuffer+"</HTML>";
+ }
+ fsize = chmBuffer.length();
+
+ bufpos = 0;
+ m_currentstart = m_ui.start;
+ m_currentend = m_currentstart+chmBuffer.length();
+ bRetVal = true;
+ }
+ return bRetVal;
+}
+
+bool CHM::getFile(const QString& href) {
+ qDebug("Got:%s", (const char*)href);
+ bool bRetVal = false;
+ QString temp = chmPath;
+ chmPath = href;
+ if (FillContent()) {
+ qDebug("Got it");
+ bRetVal = true;
+ } else {
+ qDebug("Missed");
+ chmPath = temp;
+ FillContent();
+ }
+ return bRetVal;
+}
+
+QImage *CHM::getPicture(const QString& href) {
+ QImage *img = NULL;
+ QString PicRef = "/"+href;
+ struct chmUnitInfo ui;
+ const char *ext;
+ /* try to find the file */
+ const char *filename = (const char *)PicRef;
+ if (chm_resolve_object(chmFile, filename, &ui) != CHM_RESOLVE_SUCCESS)
+ {
+ qDebug ("Could not resolve image");
+ return img;
+ }
+ if (ui.length > 0) {
+ char *temp = new char[ui.length];
+ char buffer[65536];
+ int swath, offset;
+ swath = 65536;
+ offset = 0;
+
+ while (offset < ui.length)
+ {
+ if ((ui.length - offset) < 65536)
+ swath = ui.length - offset;
+ else
+ swath = 65536;
+ swath = (int)chm_retrieve_object(chmFile, &ui, (unsigned char *) buffer, offset, swath);
+ memcpy( (void *) (temp + offset), (void *)&buffer, swath );
+ offset += swath;
+ }
+ QByteArray qba;
+ qba.setRawData( (const char *)temp, ui.length);
+ QPixmap qpm(qba);
+ img = new QImage(qpm.convertToImage());
+ qba.resetRawData((const char *)temp, ui.length);
+ delete[] temp;
+ }
+
+ return img;
+}
+
+int CHM::OpenFile(const char *src) {
+ if (chmFile != NULL) chm_close(chmFile);
+ struct stat _stat;
+ stat(src,&_stat);
+ fsize = _stat.st_size;
+ chmFile = chm_open(src);
+ if (chmFile != NULL) {
+ chm_enumerate(chmFile,
+ CHM_ENUMERATE_ALL,
+ _get_hhc,
+ (void *)this);
+ if ( chmPath != "") {
+ setHomePath(chmPath);
+ FillHomeContent();
+ }
+ }
+ m_homepos = locate();
+ qDebug("Home:%u", m_homepos);
+ return (chmFile==NULL);
+}
+
+int CHM::getch() {
+ if ( (bufpos+1) >= chmBuffer.length() )
+ return EOF;
+#ifdef _WINDOWS
+ QChar letter = chmBuffer.at(bufpos++);
+#else
+ QChar letter = chmBuffer[bufpos++];
+#endif
+ return (int)(char)letter;
+}
+
+void CHM::getch(tchar& ch, CStyle& sty)
+{
+ int ich = getch();
+ ch = (ich == EOF) ? UEOF : ich;
+}
+
+void CHM::start2endSection()
+{
+ m_currentstart = m_ui.start;
+ m_currentend = m_currentstart+chmBuffer.length();
+}
+
+unsigned int CHM::locate() {
+ return m_currentstart+bufpos;
+}
+
+void CHM::locate(unsigned int n) {
+ if (n == 0) n = m_homepos;
+ if (n >= m_homestart && n < m_homeend)
+ {
+ FillHomeContent();
+ bufpos = n - m_homestart;
+ start2endSection();
+ qDebug("Home:%u:<%u, %u, %u>", m_ui.start, m_currentstart, n, m_currentend);
+ }
+ else if (n >= m_currentstart && n < m_currentend)
+ {
+ bufpos = n - m_currentstart;
+ }
+ else if (CHM_RESOLVE_FAILURE == chm_resolve_location(chmFile, n/4, &m_ui))
+ {
+ qDebug("Resolve failure");
+ FillHomeContent();
+ bufpos = 0;
+ start2endSection();
+ qDebug("Home:%u:<%u, %u, %u>", m_ui.start, m_currentstart, n, m_currentend);
+ }
+ else
+ {
+ qDebug("Resolve success");
+ FillBuffer();
+ start2endSection();
+ bufpos=n-m_currentstart;
+ qDebug("Not Home:%u:<%u, %u, %u>", m_ui.start, m_currentstart, n, m_currentend);
+ }
+}
+
+void CHM::sizes(unsigned long& _file, unsigned long& _text) {
+ _text = _file = fsize;
+}
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 @@
+#ifndef __CHM_h
+#define __CHM_h
+#include <stdio.h>
+#include <sys/stat.h>
+#include "useqpe.h"
+#include "CExpander.h"
+#include "chm_lib.h"
+#include "my_list.h"
+#include "CExpander.h"
+
+struct Ref {
+ QString RefName;
+ QString RefLoc;
+ int beginpos;
+ int endpos;
+};
+
+struct Pic {
+ QString RefName;
+ QString RefLoc;
+ int beginpos;
+ int endpos;
+};
+
+class CHM : public CExpander
+{
+ void start2endSection();
+ struct chmUnitInfo m_ui;
+ struct chmFile *chmFile;
+ chmUnitInfo chmui;
+ //alloc a meg to buffer
+ QString chmHomeBuffer;
+ QString chmBuffer;
+ QString chmPath;
+ QString chmHHCPath;
+ unsigned int bufpos;
+ unsigned long fsize;
+ unsigned long m_homestart, m_homeend;
+public:
+ void suspend();
+ void unsuspend();
+ bool hasnavigation() { return true; }
+
+ CHM();
+ virtual ~CHM();
+ int OpenFile(const char *src);
+ int getch();
+ unsigned int locate();
+ void locate(unsigned int n);
+ bool hasrandomaccess() { return true; }
+ void sizes(unsigned long& _file, unsigned long& _text);
+ void addContent(QString content);
+ void getch(tchar& ch, CStyle& sty);
+ void setPath(QString PathName) {chmPath = PathName;};
+ void setHomePath(QString PathName) {chmHHCPath = PathName;};
+
+ MarkupType PreferredMarkup() {
+ return cCHM;
+ }
+ bool getFile(const QString& href);
+ QImage *getPicture(const QString& href);
+ QString about() { return QString("CHM codec (c) Bob Griffin\nchm_lib (c) Jed Wing\nLZX code (c) Stuart Cale"); }
+private :
+ bool FillBuffer();
+ bool FillContent();
+ void FillHomeContent();
+};
+#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 @@
+#############################################################################
+# Makefile for building: libCHM.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:37:00 2004
+# Project: CHM.pro
+# Template: lib
+# Command: $(QMAKE) -o CHM.mak CHM.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -w -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -w -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libCHM.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = CHM.h \
+ chm_lib.h \
+ lzx.h
+SOURCES = CHM.cpp \
+ chm_lib.c \
+ lzx.c
+OBJECTS = QREADEROBJS/CHM.o \
+ QREADEROBJS/chm_lib.o \
+ QREADEROBJS/lzx.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = CHM.pro
+QMAKE_TARGET = CHM
+DESTDIR = $(READERDIR)/codecs/
+TARGET = libCHM.so.1.0.0
+TARGETA = $(READERDIR)/codecs/libCHM.a
+TARGETD = libCHM.so.1.0.0
+TARGET0 = libCHM.so
+TARGET1 = libCHM.so.1
+TARGET2 = libCHM.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: CHM.mak $(READERDIR)/codecs/$(TARGET)
+
+$(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+CHM.mak: CHM.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o CHM.mak CHM.pro
+qmake:
+ @$(QMAKE) -o CHM.mak CHM.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/CHM.o: CHM.cpp CHM.h \
+ chm_lib.h \
+ QREADERINC/static.h \
+ QREADERINC/useqpe.h \
+ CExpander.h \
+ my_list.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CHM.o CHM.cpp
+
+QREADEROBJS/chm_lib.o: chm_lib.c chm_lib.h \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o QREADEROBJS/chm_lib.o chm_lib.c
+
+QREADEROBJS/lzx.o: lzx.c lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o QREADEROBJS/lzx.o lzx.c
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libCHM.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: CHM.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libCHM.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = CHM.h \
+ chm_lib.h \
+ lzx.h
+SOURCES = CHM.cpp \
+ chm_lib.c \
+ lzx.c
+OBJECTS = OREADEROBJS/CHM.o \
+ OREADEROBJS/chm_lib.o \
+ OREADEROBJS/lzx.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libCHM.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libCHM.a
+TARGETD = libCHM.so.1.0.0
+TARGET0 = libCHM.so
+TARGET1 = libCHM.so.1
+TARGET2 = libCHM.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: CHM.omak
+
+CHM.omak: CHM.opro
+ tmake CHM.opro -o CHM.omak
+
+dist:
+ $(TAR) CHM.opro.tar CHM.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) CHM.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/CHM.o: CHM.cpp \
+ CHM.h \
+ OREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ chm_lib.h \
+ my_list.h \
+ OREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CHM.o CHM.cpp
+
+OREADEROBJS/chm_lib.o: chm_lib.c \
+ chm_lib.h \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o OREADEROBJS/chm_lib.o chm_lib.c
+
+OREADEROBJS/lzx.o: lzx.c \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o OREADEROBJS/lzx.o lzx.c
+
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 @@
+#############################################################################
+# Makefile for building libCHM.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: CHM.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libCHM.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = CHM.h \
+ chm_lib.h \
+ lzx.h
+SOURCES = CHM.cpp \
+ chm_lib.c \
+ lzx.c
+OBJECTS = ZREADEROBJS/CHM.o \
+ ZREADEROBJS/chm_lib.o \
+ ZREADEROBJS/lzx.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libCHM.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libCHM.a
+TARGETD = libCHM.so.1.0.0
+TARGET0 = libCHM.so
+TARGET1 = libCHM.so.1
+TARGET2 = libCHM.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libCHM.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: CHM.zmak
+
+CHM.zmak: CHM.zpro
+ tmake CHM.zpro -o CHM.zmak
+
+dist:
+ $(TAR) CHM.zpro.tar CHM.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) CHM.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/CHM.o: CHM.cpp \
+ CHM.h \
+ ZREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ chm_lib.h \
+ my_list.h \
+ ZREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CHM.o CHM.cpp
+
+ZREADEROBJS/chm_lib.o: chm_lib.c \
+ chm_lib.h \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o ZREADEROBJS/chm_lib.o chm_lib.c
+
+ZREADEROBJS/lzx.o: lzx.c \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o ZREADEROBJS/lzx.o lzx.c
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = CHM.h chm_lib.h lzx.h
+
+SOURCES = CHM.cpp chm_lib.c lzx.c
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = CHM
+LIBS += -lreader_codec
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = CHM.h chm_lib.h lzx.h
+
+SOURCES = CHM.cpp chm_lib.c lzx.c
+
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/codecs
+TARGET = CHM
+LIBS += -lreader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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 @@
+#include "CRegExp.h"
+
+//#include <stdio.h>
+#include <stdlib.h>
+//#include <string.h>
+
+
+tchar CRegExpFilt::escapedchar(tchar c)
+{
+ switch (c)
+ {
+ case '\\':
+ return '\\';
+ break;
+ case '"':
+ return '\"';
+ break;
+ case 'a':
+ return '\a';
+ break;
+ case 'b':
+ return '\b';
+ break;
+ case 'f':
+ return '\f';
+ break;
+ case 'n':
+ return '\n';
+ break;
+ case 'r':
+ return '\r';
+ break;
+ case 't':
+ return '\t';
+ break;
+ case 'v':
+ return '\v';
+ break;
+ default:
+ return c;
+ break;
+ }
+}
+
+void CRegExpFilt::regchar(tchar c, bool insens)
+{
+ if (insens)
+ {
+ tchar t = upper(c);
+ CV[t] = 0;
+ t = lower(c);
+ CV[t] = 0;
+ }
+ else
+ {
+ CV[c] = 0;
+ }
+}
+
+void CRegExpFilt::prepreprocessing(const QString& pat, bool insens)
+{
+ for (unsigned int p = 0; p < pat.length(); p++)
+ {
+#ifdef _WINDOWS
+ switch (pat.at(p).unicode())
+#else
+ switch (pat[p].unicode())
+#endif
+ {
+ case '{':
+ {
+ break;
+ }
+ case '}':
+ {
+ break;
+ }
+ case '^':
+ {
+ break;
+ }
+ case '.' :
+ {
+ break;
+ }
+ case '#':
+ {
+ p++;
+#ifdef _WINDOWS
+ while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9')
+#else
+ while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9')
+#endif
+ {
+ }
+ p--;
+ break;
+ }
+ case '\\' :
+ {
+#ifdef _WINDOWS
+ tchar c = escapedchar(pat.at(++p).unicode());
+#else
+ tchar c = escapedchar(pat[++p].unicode());
+#endif
+ regchar(c, insens);
+ break;
+ }
+
+ case '[' :
+ {
+ tchar clast;
+ bool invert = false;
+ tchar c;
+#ifdef _WINDOWS
+ if (pat.at(p+1).unicode() == '^')
+#else
+ if (pat[p+1].unicode() == '^')
+#endif
+ {
+ p++;
+ invert = true;
+ }
+#ifdef _WINDOWS
+ while ((c = pat.at(++p).unicode()) != ']')
+#else
+ while ((c = pat[++p].unicode()) != ']')
+#endif
+ {
+ if (c == '\\')
+ {
+#ifdef _WINDOWS
+ c = escapedchar(pat.at(++p).unicode());
+#else
+ c = escapedchar(pat[++p].unicode());
+#endif
+ if (c == ']') break;
+ }
+ if (c == '-')
+ {
+#ifdef _WINDOWS
+ c = pat.at(++p).unicode();
+#else
+ c = pat[++p].unicode();
+#endif
+ for (tchar j = clast; j <= c; j++)
+ {
+ regchar(j, insens);
+ }
+ }
+ else
+ {
+ regchar(c, insens);
+ }
+ clast = c;
+ }
+ break;
+ }
+ default :
+ {
+#ifdef _WINDOWS
+ regchar(pat.at(p).unicode(), insens);
+#else
+ regchar(pat[p].unicode(), insens);
+#endif
+ break;
+ }
+ }
+ }
+ /*
+ for (iter i = CV.begin(); i != CV.end(); ++i)
+ {
+ printf("Pre: [%u]\n", i.first());
+ }
+ */
+ CV[0] = 0;
+}
+
+unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens)
+{
+ prepreprocessing(pat, insens);
+ qDebug("PrePreProcessing done");
+ unsigned int p, m;
+ bool inkeep = false;
+ keep = 0;
+ replace = 0;
+ for (unsigned int j = 0; j < WORD_SIZE; j++)
+ {
+ bit[j] = (1 << (WORD_SIZE -j -1));
+ lfcnt[j] = 0;
+ }
+
+ for (p = 0, m = 0; p < pat.length(); p++)
+ {
+ qDebug("m is %u", m);
+ if (inkeep) keep |= bit[m];
+#ifdef _WINDOWS
+ switch (pat.at(p).unicode())
+#else
+ switch (pat[p].unicode())
+#endif
+ {
+ case '{':
+ {
+ inkeep = true;
+ break;
+ }
+ case '}':
+ {
+ keep ^= bit[m];
+ inkeep = false;
+ break;
+ }
+ case '^':
+ {
+ replace |= bit[m];
+ lfcnt[m]++;
+ break;
+ }
+ case '.' :
+ {
+ for (iter j = CV.begin(); j != CV.end(); ++j) CV[j.first()] |= bit[m];
+ m++;
+ break;
+ }
+ case '#':
+ {
+ if (m > 0)
+ {
+ p++;
+ int count = 0;
+#ifdef _WINDOWS
+ while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9')
+#else
+ while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9')
+#endif
+ {
+#ifdef _WINDOWS
+ count = 10*count + pat.at(p++).unicode() - '0';
+#else
+ count = 10*count + pat[p++].unicode() - '0';
+#endif
+ }
+ p--;
+ count = count-1;
+ unsigned int mask = 0;
+ for (unsigned int i = m; i < m+count; i++)
+ {
+ mask |= bit[i];
+ }
+
+ for (iter it = CV.begin(); it != CV.end(); ++it)
+ {
+ if (CV[it.first()] & bit[m-1])
+ {
+ CV[it.first()] |= mask;
+ }
+ }
+ if (keep & bit[m-1]) keep |= mask;
+ m += count;
+ }
+ else
+ {
+ p++;
+ }
+ break;
+ }
+ case '\\' :
+ {
+#ifdef _WINDOWS
+ tchar c = escapedchar(pat.at(++p).unicode());
+#else
+ tchar c = escapedchar(pat[++p].unicode());
+#endif
+ if (insens)
+ {
+ CV[upper(c)] |= bit[m];
+ CV[lower(c)] |= bit[m];
+ }
+ else
+ {
+ CV[c] |= bit[m];
+ }
+ m++;
+ break;
+ }
+
+ case '[' :
+ {
+ tchar c, clast;
+ bool invert = false;
+#ifdef _WINDOWS
+ if (pat.at(p+1).unicode() == '^')
+#else
+ if (pat[p+1].unicode() == '^')
+#endif
+ {
+ p++;
+ invert = true;
+ }
+#ifdef _WINDOWS
+ while ((c = pat.at(++p).unicode()) != ']')
+#else
+ while ((c = pat[++p].unicode()) != ']')
+#endif
+ {
+ if (c == '\\')
+ {
+#ifdef _WINDOWS
+ c = escapedchar(pat.at(++p).unicode());
+#else
+ c = escapedchar(pat[++p].unicode());
+#endif
+ if (c == ']') break;
+ }
+ if (c == '-')
+ {
+#ifdef _WINDOWS
+ c = pat.at(++p).unicode();
+#else
+ c = pat[++p].unicode();
+#endif
+ for (tchar j = clast; j <= c; j++)
+ {
+ if (insens)
+ {
+ iter it;
+ if ((it = CV.find(upper(j))) != CV.end())
+ CV[it] |= bit[m];
+ else
+ CV[0] |= bit[m];
+ if ((it = CV.find(lower(j))) != CV.end())
+ CV[it] |= bit[m];
+ else
+ CV[0] |= bit[m];
+ }
+ else
+ {
+ iter it;
+ if ((it = CV.find(j)) != CV.end())
+ CV[it] |= bit[m];
+ else
+ {
+ CV[0] |= bit[m];
+ }
+ }
+ }
+ }
+ else
+ {
+ if (insens)
+ {
+ iter it;
+ if ((it = CV.find(upper(c))) != CV.end())
+ CV[it] |= bit[m];
+ else
+ CV[0] |= bit[m];
+ if ((it = CV.find(lower(c))) != CV.end())
+ CV[it] |= bit[m];
+ else
+ CV[0] |= bit[m];
+ }
+ else
+ {
+ iter it;
+ if ((it = CV.find(c)) != CV.end())
+ CV[it] |= bit[m];
+ else
+ CV[0] |= bit[m];
+ }
+ }
+ clast = c;
+ }
+ if (invert)
+ {
+ for (iter i = CV.begin(); i != CV.end(); ++i)
+ {
+ CV[i.first()] ^= bit[m];
+ }
+ }
+ m++;
+ break;
+ }
+ default :
+ {
+#ifdef _WINDOWS
+ tchar c = pat.at(p).unicode();
+#else
+ tchar c = pat[p].unicode();
+#endif
+ if (insens)
+ {
+ CV[upper(c)] |= bit[m];
+ CV[lower(c)] |= bit[m];
+ }
+ else CV[c] |= bit[m];
+ m++;
+ break;
+ }
+ }
+ }
+ qDebug("Returning:%u",m);
+ return m;
+}
+
+bool CRegExpFilt::empty()
+{
+ return m_outQueue.empty();
+}
+
+tchar CRegExpFilt::pop()
+{
+ return m_outQueue.pop();
+}
+
+bool CRegExpFilt::addch(tchar ch)
+{
+ word[cur] = ch;
+ cur = (cur+1)%patlength;
+ if (len < patlength) len++;
+
+ unsigned int cv = 0;
+ iter it;
+ if ((it = CV.find(ch)) == CV.end())
+ {
+ cv = CV[0];
+ }
+ else
+ {
+ cv = CV[it];
+ }
+
+ R = ((R >> 1) | bit_0) & cv; /* Exact matches */
+ if (R & endpos)
+ {
+ for (unsigned int i = 0; i < patlength; i++)
+ {
+ if (replace & bit[i])
+ {
+ for (unsigned int j = 0; j < lfcnt[i]; j++)
+ {
+ m_outQueue.push(10);
+ }
+ }
+ if (keep & bit[i])
+ {
+ m_outQueue.push(word[(cur+i)%patlength]);
+ // putchar('*');
+ // putchar(i + '0');
+ }
+ len = 0;
+ }
+ return true;
+ }
+ else
+ {
+ if (len == patlength)
+ {
+ tchar ch = word[cur];
+ if (ch == 10) ch = ' ';
+ m_outQueue.push(ch);
+ }
+ return false;
+ }
+}
+
+void CRegExpFilt::restart()
+{
+ R = 0;
+ len = 0;
+}
+
+CRegExpFilt::CRegExpFilt(const QString& pat, bool insensflag) : CV(300)
+{
+ cur = 0;
+ patlength = preprocessing(pat, insensflag);
+ qDebug("Preprocesing done:%u", patlength);
+ endpos = bit[patlength-1];
+ bit_0 = bit[0];
+
+ restart();
+
+ qDebug("Pattern: %s:%u", (const char*)pat, patlength);
+
+}
+
+
+CRegExpFilt::~CRegExpFilt()
+{
+}
+
+#ifdef NOWAYISTHISDEFINED
+void reportmatch(tchar *line, /*tchar *text,*/ unsigned int mtype, unsigned int lino)
+{
+ /*
+ tchar *text = line + strlen(line);
+
+ tchar *ptr = line;
+ if (mtype == 0)
+ printf("Exact match at line number %u.\n", lino);
+ else
+ printf("%u error match at line number %u.\n", mtype, lino);
+ while (ptr < text) putchar(*ptr++);
+ printf("%c[4m^%c[24m%s\n", 27, 27, ptr);
+ */
+}
+
+
+void usage(void)
+{
+ printf("Usage: CRegExpFilt [-i] pattern/a file\n");
+}
+
+int getline(tchar *s,int lim,FILE *f)
+{
+ int c, i;
+
+ for (i = 0; i < lim-1 && (c = getc(f)) != EOF && c != '\n'; )
+ {
+ s[i++] = (tchar)c;
+ }
+ s[i] = '\0';
+ return ((c == EOF && i == 0) ? -1 : i);
+}
+
+#define BUF_SIZE 256
+
+int main(int argc, char **argv)
+{
+ unsigned int lino = 0;
+ unsigned int blino = 0;
+ bool insens = false;
+ int len;
+ tchar line[BUF_SIZE];
+ FILE *inf;
+
+ /* Error checking of cmd ln args! */
+ if (argc < 3)
+ {usage(); return 10; }
+ /* Corresponds to requiring a minimum of 3 matches */
+ for (len = 1; len < argc-2; len++)
+ {
+ if (argv[len][0] != '-')
+ {usage(); return 10; }
+ else switch (argv[len][1])
+ {
+ case 'i' :
+ {
+ insens = true;
+ break;
+ }
+ default :
+ {usage(); return 10;}
+ }
+ }
+
+ tchar* pattern = new tchar[strlen(argv[argc-2])+1];
+
+ for (int i = 0; (pattern[i] = argv[argc-2][i]) != 0; i++);
+
+
+
+ CRegExpFilt test(pattern, insens);
+
+ delete [] pattern;
+
+ inf = fopen(argv[argc-1], "r");
+ if (!inf)
+ {
+ printf("file not found\n");
+ return 10;
+ }
+
+ while ((len = getline(line, BUF_SIZE, inf)) >= 0)
+ {
+ lino++;
+ bool ret = false;
+
+ {
+ tchar *textend = line+len;
+ tchar *text = line;
+ while (text < textend)
+ {
+ ret |= test.addch(*text++);
+ }
+ ret |= test.addch('\n');
+ while (!test.empty())
+ {
+ putchar(test.pop());
+ }
+ }
+ // inswt = test.addch(line, len);
+ if (ret) reportmatch(line, 0, lino);
+ }
+ fclose(inf);
+ // CloseSTDLIB();
+ return 0;
+}
+#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 @@
+#include "config.h"
+#include "hash.h"
+#include "Queue.h"
+#include <qstring.h>
+
+typedef hashtable<tchar,unsigned int>::iterator iter;
+
+#define WORD_SIZE 32
+
+class CRegExpFilt
+{
+ CQueue<tchar> m_outQueue;
+ hashtable<tchar,unsigned int> CV;
+ unsigned int bit[WORD_SIZE];
+ unsigned int R;
+ unsigned int bit_0, endpos;
+ unsigned int patlength;
+ unsigned int keep, len;
+ unsigned int replace, cur;
+ void regchar(tchar, bool);
+ void prepreprocessing(const QString& pat, bool insens);
+ unsigned int preprocessing(const QString& pat, bool insens);
+ tchar word[WORD_SIZE];
+ unsigned int lfcnt[WORD_SIZE];
+ tchar escapedchar(tchar c);
+ int islower(tchar c)
+ {
+ return (('a' <= c) && (c <= 'z'));
+ }
+ tchar upper(tchar c)
+ {
+ return (tchar)(islower(c) ? (c - 'a' + 'A') : c);
+ }
+ int isupper(tchar c)
+ {
+ return (('A' <= c) && (c <= 'Z'));
+ }
+ tchar lower(tchar c)
+ {
+ return (tchar)(isupper(c) ? (c + 'a' - 'A') : c);
+ }
+ public:
+ CRegExpFilt(const QString& pat, bool insens);
+ ~CRegExpFilt();
+ bool addch(tchar);
+ void restart();
+ unsigned int matchlength()
+ { return patlength; }
+ bool empty();
+ tchar pop();
+};
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,21 +1,18 @@
#include "CloseDialog.h"
#include "qlayout.h"
-#include <qpe/qpeapplication.h>
-
CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
{
setCaption(tr("Tidy-up"));
QVBoxLayout *tmp = new QVBoxLayout(this);
QVButtonGroup* vb = new QVButtonGroup(tr("Delete"), this);
tmp->addWidget(vb);
QString filestring = tr("Delete") + " " + fname;
file = new QCheckBox(filestring, vb);
marks = new QCheckBox(tr("Delete Bookmarks"), vb);
config = new QCheckBox(tr("Delete Configuration"), vb);
file->setChecked(false);
marks->setChecked(true);
config->setChecked(true);
- if (fs)
- QPEApplication::showDialog( this );
+ if (fs) showMaximized();
}
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
@@ -1,51 +1,51 @@
#ifndef __FILEDATA_H
#define __FILEDATA_H
#include <time.h>
class CFiledata
{
unsigned char* data;
bool m_own;
public:
CFiledata(tchar* d)
{
data = (unsigned char*)d;
m_own = false;
}
CFiledata(time_t dt, tchar* nm)
{
int nlen = ustrlen(nm)+1;
data = new unsigned char[sizeof(time_t)+sizeof(tchar)*nlen];
*((time_t *)data) = dt;
memcpy(data+sizeof(time_t), nm, sizeof(tchar)*nlen);
m_own = true;
}
~CFiledata()
{
if (m_own && data != NULL)
{
delete [] data;
-// odebug << "~Filedata: deleting" << oendl;
+// qDebug("~Filedata: deleting");
}
else
{
-// odebug << "~Filedata: not deleting" << oendl;
+// qDebug("~Filedata: not deleting");
}
}
tchar* name() const { return (tchar*)(data+sizeof(time_t)); }
time_t date() { return *((time_t *)data); }
void setdate(time_t _t) { *((time_t *)data) = _t; }
unsigned char* content() { return data; }
size_t length() const { return sizeof(time_t)+sizeof(tchar)*(ustrlen(name())+1); }
bool operator==(const CFiledata& rhs)
{
return ((length() == rhs.length()) && (memcmp(data, rhs.data, length()) == 0));
}
bool samename(const CFiledata& rhs)
{
return (ustrcmp((tchar *)(data+sizeof(time_t)),(tchar *)(rhs.data+sizeof(time_t))) == 0);
}
};
#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,58 +1,68 @@
+#include <qfontdatabase.h>
+#include "opie.h"
+#include "useqpe.h"
#include "FontControl.h"
int FontControl::gzoom()
{
+ if (m_fixgraphics)
+ {
+ return 100;
+ }
+ else
+ {
int ret;
if (m_size == g_size)
{
ret = m_fontsizes[m_size]*m_basesize;
}
else if (g_size < 0)
{
int f = -g_size;
ret = (m_fontsizes[0]*m_basesize) >> (f/2);
if (f%2) ret = (2*ret/3);
}
else
{
int f = g_size - m_maxsize + 1;
ret = (m_fontsizes[m_maxsize-1]*m_basesize) << (f/2);
if (f%2) ret = (3*ret/2);
}
return ret;
}
+}
bool FontControl::ChangeFont(QString& n, int tgt)
{
QValueList<int>::Iterator it;
QFontDatabase fdb;
QValueList<int> sizes = fdb.pointSizes(n);
if (sizes.count() == 0)
{
return false;
}
else
{
m_fontname = n;
m_maxsize = sizes.count();
if (m_fontsizes != NULL) delete [] m_fontsizes;
m_fontsizes = new int[m_maxsize];
uint i = 0;
uint best = 0;
for (it = sizes.begin(); it != sizes.end(); it++)
{
#if defined(OPIE) || !defined(USEQPE)
m_fontsizes[i] = (*it);
#else
m_fontsizes[i] = (*it)/10;
#endif
if (abs(tgt-m_fontsizes[i]) < abs(tgt-m_fontsizes[best]))
{
best = i;
}
i++;
}
g_size = m_size = best;
}
return true;
}
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,153 +1,172 @@
#ifndef __FONTCONTROL_H
#define __FONTCONTROL_H
-#include <qfontdatabase.h>
#include <qfontmetrics.h>
#include "StyleConsts.h"
class FontControl
{
int * m_fontsizes;
int m_size, g_size;
QString m_fontname;
QString m_fixedfontname;
int m_maxsize;
bool m_hasCourier;
int m_leading, m_extraspace;
unsigned char m_basesize;
+ bool m_fixgraphics;
public:
+ void FixGraphics(bool _b)
+ {
+ m_fixgraphics = _b;
+ }
+ bool FixGraphics()
+ {
+ return m_fixgraphics;
+ }
void setBaseSize(unsigned char _s) { m_basesize = _s; }
unsigned char getBaseSize() { return m_basesize; }
int gzoom();
FontControl(QString n = "helvetica", int size = 10)
:
- m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0)
+ m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0), m_fixgraphics(true)
{
ChangeFont(n, size);
}
~FontControl()
{
if (m_fontsizes != NULL) delete [] m_fontsizes;
}
void hasCourier(bool _b, const QString& _nm)
{
m_hasCourier = _b;
m_fixedfontname = _nm;
}
QString& fixedfontname() { return m_fixedfontname; }
bool hasCourier() { return m_hasCourier; }
QString name() { return m_fontname; }
- int currentsize() { return m_fontsizes[m_size]; }
+ int currentsize() { return (m_fontsizes == NULL) ? 0 : m_fontsizes[m_size]; }
int getsize(const CStyle& size)
{
- int tgt = m_size+size.getFontSize();
+ return getsize(size.getFontSize());
+ }
+ int getsize(int _offset)
+ {
+ int tgt = m_size+_offset;
if (tgt < 0)
{
tgt = 0;
}
if (tgt >= m_maxsize)
{
tgt = m_maxsize - 1;
}
return m_fontsizes[tgt];
}
int ascent()
{
QFont f(name(), currentsize());
QFontMetrics fm(f);
return fm.ascent();
}
int ascent(const CStyle& ch)
{
QFont f(name(), getsize(ch));
QFontMetrics fm(f);
return fm.ascent();
}
int descent()
{
QFont f(name(), currentsize());
QFontMetrics fm(f);
return fm.descent();
}
int descent(const CStyle& ch)
{
QFont f(name(), getsize(ch));
QFontMetrics fm(f);
return fm.descent();
}
int lineSpacing()
{
QFont f(name(), currentsize());
QFontMetrics fm(f);
return fm.lineSpacing();
}
int lineSpacing(const CStyle& ch)
{
QFont f(name(), getsize(ch));
QFontMetrics fm(f);
return fm.lineSpacing();
}
bool decreasesize()
{
-/*
+ if (m_fixgraphics)
+ {
if (--m_size < 0)
{
m_size = 0;
return false;
}
- else return true;
-*/
+ g_size = m_size;
+ }
+ else
+ {
if (g_size-- == m_size)
{
if (--m_size < 0)
{
m_size = 0;
}
}
-// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
+ }
+// qDebug("Font:%d Graphics:%d", m_size, g_size);
return true;
}
bool increasesize()
{
-/*
+ if (m_fixgraphics)
+ {
if (++m_size >= m_maxsize)
{
m_size = m_maxsize - 1;
return false;
}
- else return true;
-*/
+ g_size = m_size;
+ }
+ else
+ {
if (g_size++ == m_size)
{
if (++m_size >= m_maxsize)
{
m_size = m_maxsize - 1;
}
}
-// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
+ }
return true;
}
bool ChangeFont(QString& n)
{
return ChangeFont(n, currentsize());
}
bool ChangeFont(QString& n, int tgt);
void setlead(int _lead)
{
m_leading = _lead;
}
int getlead()
{
return m_leading;
}
void setextraspace(int _lead)
{
m_extraspace = _lead;
}
int getextraspace()
{
return m_extraspace;
}
};
#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 @@
+
+#include "GraphicWin.h"
+
+GraphicWin::GraphicWin( QWidget *parent, const char *name, WFlags f)
+ : QWidget(parent, name, f), m_isFitted(false), m_isRotated(false)
+{
+ QVBoxLayout* grid = new QVBoxLayout(this);
+ m_scroll = new GraphicScroll(this);
+ grid->addWidget(m_scroll,1);
+ QHBoxLayout* b = new QHBoxLayout(grid);
+
+ QPushButton* fitButton = new QPushButton("Rotated", this);
+ connect(fitButton, SIGNAL( clicked() ), this, SLOT( slotRotate() ) );
+ b->addWidget(fitButton);
+
+ fitButton = new QPushButton("Fitted", this);
+ connect(fitButton, SIGNAL( clicked() ), this, SLOT( slotFit() ) );
+ b->addWidget(fitButton);
+
+ fitButton = new QPushButton("Close", this);
+ connect(fitButton, SIGNAL( clicked() ), this, SLOT( slotClosed() ) );
+ b->addWidget(fitButton);
+}
+
+void GraphicWin::setImage(QImage& im)
+{
+ m_isRotated = m_isFitted = false;
+ m_im = im;
+ resetpm();
+}
+
+QImage GraphicWin::resizeimage(int w, int h)
+{
+ if (w*m_im.height() < h*m_im.width())
+ {
+ h = (m_im.height()*w + m_im.width()/2)/m_im.width();
+ }
+ else
+ {
+ w = (m_im.width()*h + m_im.height()/2)/m_im.height();
+ }
+ return m_im.smoothScale(w,h);
+}
+
+void GraphicWin::slotFit()
+{
+ m_isFitted = !m_isFitted;
+ resetpm();
+}
+
+void GraphicWin::slotRotate()
+{
+ m_isRotated = !m_isRotated;
+ resetpm();
+}
+
+void GraphicWin::resetpm()
+{
+ QImage im;
+ if (m_isFitted)
+ {
+ int w, h;
+ if (m_isRotated)
+ {
+ w = m_scroll->height()-5;
+ h = m_scroll->width()-5;
+ }
+ else
+ {
+ w = m_scroll->width()-5;
+ h = m_scroll->height()-5;
+ }
+ im = resizeimage(w, h);
+ }
+ else
+ {
+ im = m_im;
+ }
+ QPixmap pc;
+ if (m_isRotated)
+ {
+ QWMatrix m;
+ m.rotate(90);
+ QPixmap pc1;
+ pc1.convertFromImage(im);
+ pc = pc1.xForm(m);
+ }
+ else
+ {
+ pc.convertFromImage(im);
+ }
+ m_scroll->setPixmap(pc);
+}
+
+/*
+ Something like this should work...but doesn't quite
+ smoothscale is better anyway.
+
+void GraphicWin::resetpm()
+{
+ QWMatrix m;
+ if (m_isRotated)
+ {
+ m.rotate(90);
+ }
+ if (m_isFitted)
+ {
+ double sw = (width()-5.0)/(m_isRotated ? m_im.height() : m_im.width());
+ double sh = (height()-5.0)/(m_isRotated ? m_im.width() : m_im.height());
+ if (sw < sh)
+ {
+ m.scale(sw, sw);
+ }
+ else
+ {
+ m.scale(sh, sh);
+ }
+ }
+ QPixmap pc = m_im.xForm(m);
+ m_scroll->setPixmap(pc);
+}
+*/
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
@@ -1,65 +1,56 @@
#ifndef __GRAPHICWIN_H
#define __GRAPHICWIN_H
#include <qscrollview.h>
#include <qpixmap.h>
+#include <qimage.h>
#include <qpushbutton.h>
#include <qlayout.h>
+#include <qwmatrix.h>
class GraphicScroll : public QScrollView
{
Q_OBJECT
QWidget* m_picture;
protected:
void hideEvent( QHideEvent * p)
{
m_picture->setFixedSize(1,1);
}
public:
GraphicScroll( QWidget *parent=0, const char *name=0, WFlags f = 0)
: QScrollView(parent, name, f)
{
m_picture = new QWidget(viewport());
addChild(m_picture);
}
void setPixmap(QPixmap& pm)
{
m_picture->setFixedSize(pm.size());
m_picture->setBackgroundPixmap(pm);
}
-/*
- private slots:
- void graphicClose() { emit Close(); }
- signals:
- void Close();
-*/
-
};
class GraphicWin : public QWidget
{
Q_OBJECT
GraphicScroll* m_scroll;
+ QImage m_im;
+ QImage resizeimage(int w, int h);
+ void resetpm();
+ bool m_isFitted, m_isRotated;
signals:
void Closed();
private slots:
void slotClosed() { emit Closed(); }
-
+ void slotFit();
+ void slotRotate();
public:
-
void setPixmap(QPixmap& pm) { m_scroll->setPixmap(pm); }
- GraphicWin( QWidget *parent=0, const char *name=0, WFlags f = 0)
- : QWidget(parent, name, f)
- {
- QVBoxLayout* grid = new QVBoxLayout(this);
- m_scroll = new GraphicScroll(this);
- QPushButton* exitButton = new QPushButton("Close", this);
- connect(exitButton, SIGNAL( released() ), this, SLOT( slotClosed() ) );
- grid->addWidget(m_scroll,1);
- grid->addWidget(exitButton);
- }
+ void setImage(QImage& im);
+ GraphicWin( QWidget *parent=0, const char *name=0, WFlags f = 0);
};
#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 @@
+#############################################################################
+# Makefile for building: libHTMLfilter.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:38:47 2004
+# Project: HTMLFilter.pro
+# Template: lib
+# Command: $(QMAKE) -o HTMLFilter.mak HTMLFilter.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libHTMLfilter.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = CFilter.h
+SOURCES = striphtml.cpp
+OBJECTS = QREADEROBJS/striphtml.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = HTMLFilter.pro
+QMAKE_TARGET = HTMLfilter
+DESTDIR = $(READERDIR)/filters/
+TARGET = libHTMLfilter.so.1.0.0
+TARGETA = $(READERDIR)/filters/libHTMLfilter.a
+TARGETD = libHTMLfilter.so.1.0.0
+TARGET0 = libHTMLfilter.so
+TARGET1 = libHTMLfilter.so.1
+TARGET2 = libHTMLfilter.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: HTMLFilter.mak $(READERDIR)/filters/$(TARGET)
+
+$(READERDIR)/filters/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/filters/ || mkdir -p $(READERDIR)/filters/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/filters/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/filters/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/filters/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/filters/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/filters/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+HTMLFilter.mak: HTMLFilter.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o HTMLFilter.mak HTMLFilter.pro
+qmake:
+ @$(QMAKE) -o HTMLFilter.mak HTMLFilter.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/filters/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/filters/$(TARGET0) $(READERDIR)/filters/$(TARGET1) $(READERDIR)/filters/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/striphtml.o: striphtml.cpp QREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ striphtml.h \
+ hrule.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CFilter.h \
+ Navigation.h \
+ CExpander.h \
+ CEncoding.h \
+ QREADERINC/static.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/striphtml.o striphtml.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libHTMLfilter.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: HTMLFilter.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libHTMLfilter.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = CFilter.h
+SOURCES = striphtml.cpp
+OBJECTS = OREADEROBJS/striphtml.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libHTMLfilter.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/filters/libHTMLfilter.a
+TARGETD = libHTMLfilter.so.1.0.0
+TARGET0 = libHTMLfilter.so
+TARGET1 = libHTMLfilter.so.1
+TARGET2 = libHTMLfilter.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0
+
+$(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/filters/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: HTMLFilter.omak
+
+HTMLFilter.omak: HTMLFilter.opro
+ tmake HTMLFilter.opro -o HTMLFilter.omak
+
+dist:
+ $(TAR) HTMLFilter.opro.tar HTMLFilter.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) HTMLFilter.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/striphtml.o: striphtml.cpp \
+ OREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ OREADERINC/static.h \
+ Navigation.h \
+ hrule.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/striphtml.o striphtml.cpp
+
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 @@
+#############################################################################
+# Makefile for building libHTMLfilter.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: HTMLFilter.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libHTMLfilter.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = CFilter.h
+SOURCES = striphtml.cpp
+OBJECTS = WSREADEROBJS/striphtml.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libHTMLfilter.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/filters/libHTMLfilter.a
+TARGETD = libHTMLfilter.so.1.0.0
+TARGET0 = libHTMLfilter.so
+TARGET1 = libHTMLfilter.so.1
+TARGET2 = libHTMLfilter.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0
+
+$(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/filters/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: HTMLFilter.wmak
+
+HTMLFilter.wmak: HTMLFilter.wpro
+ tmake HTMLFilter.wpro -o HTMLFilter.wmak
+
+dist:
+ $(TAR) HTMLFilter.wpro.tar HTMLFilter.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) HTMLFilter.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/striphtml.o: striphtml.cpp \
+ WSREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ WSREADERINC/static.h \
+ Navigation.h \
+ hrule.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/striphtml.o striphtml.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = CFilter.h
+
+SOURCES = striphtml.cpp
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/filters
+TARGET = HTMLfilter
+
+
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libHTMLfilter.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: HTMLFilter.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libHTMLfilter.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = CFilter.h
+SOURCES = striphtml.cpp
+OBJECTS = ZREADEROBJS/striphtml.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libHTMLfilter.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/filters/libHTMLfilter.a
+TARGETD = libHTMLfilter.so.1.0.0
+TARGET0 = libHTMLfilter.so
+TARGET1 = libHTMLfilter.so.1
+TARGET2 = libHTMLfilter.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0
+
+$(QTDIR)/plugins/reader/filters/libHTMLfilter.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/filters/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/filters/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: HTMLFilter.zmak
+
+HTMLFilter.zmak: HTMLFilter.zpro
+ tmake HTMLFilter.zpro -o HTMLFilter.zmak
+
+dist:
+ $(TAR) HTMLFilter.zpro.tar HTMLFilter.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) HTMLFilter.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/striphtml.o: striphtml.cpp \
+ ZREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZREADERINC/static.h \
+ Navigation.h \
+ hrule.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/striphtml.o striphtml.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = CFilter.h
+
+SOURCES = striphtml.cpp
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/filters
+TARGET = HTMLfilter
+
+
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = CFilter.h \
+ util.h
+
+SOURCES = striphtml.cpp
+
+# copy data file to install directory
+QMAKE_PRE_LINK = mkdir -p $(OPIEDIR)/plugins/reader/data && cp ../HTMLentities $(OPIEDIR)/plugins/reader/data/HTMLentities
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/filters
+TARGET = HTMLfilter
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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 @@
+nbsp:160
+iexcl:161
+cent:162
+pound:163
+curren:164
+yen:165
+brvbar:166
+sect:167
+uml:168
+copy:169
+ordf:170
+laquo:171
+not:172
+shy:173
+reg:174
+macr:175
+deg:176
+plusmn:177
+sup2:178
+sup3:179
+acute:180
+micro:181
+para:182
+middot:183
+cedil:184
+sup1:185
+ordm:186
+raquo:187
+frac14:188
+frac12:189
+frac34:190
+iquest:191
+Agrave:192
+Aacute:193
+Acirc:194
+Atilde:195
+Auml:196
+Aring:197
+AElig:198
+Ccedil:199
+Egrave:200
+Eacute:201
+Ecirc:202
+Euml:203
+Igrave:204
+Iacute:205
+Icirc:206
+Iuml:207
+ETH:208
+Ntilde:209
+Ograve:210
+Oacute:211
+Ocirc:212
+Otilde:213
+Ouml:214
+times:215
+Oslash:216
+Ugrave:217
+Uacute:218
+Ucirc:219
+Uuml:220
+Yacute:221
+THORN:222
+szlig:223
+agrave:224
+aacute:225
+acirc:226
+atilde:227
+auml:228
+aring:229
+aelig:230
+ccedil:231
+egrave:232
+eacute:233
+ecirc:234
+euml:235
+igrave:236
+iacute:237
+icirc:238
+iuml:239
+eth:240
+ntilde:241
+ograve:242
+oacute:243
+ocirc:244
+otilde:245
+ouml:246
+divide:247
+oslash:248
+ugrave:249
+uacute:250
+ucirc:251
+uuml:252
+yacute:253
+thorn:254
+yuml:255
+fnof:402
+Alpha:913
+Beta:914
+Gamma:915
+Delta:916
+Epsilon:917
+Zeta:918
+Eta:919
+Theta:920
+Iota:921
+Kappa:922
+Lambda:923
+Mu:924
+Nu:925
+Xi:926
+Omicron:927
+Pi:928
+Rho:929
+Sigma:931
+Tau:932
+Upsilon:933
+Phi:934
+Chi:935
+Psi:936
+Omega:937
+alpha:945
+beta:946
+gamma:947
+delta:948
+epsilon:949
+zeta:950
+eta:951
+theta:952
+iota:953
+kappa:954
+lambda:955
+mu:956
+nu:957
+xi:958
+omicron:959
+pi:960
+rho:961
+sigmaf:962
+sigma:963
+tau:964
+upsilon:965
+phi:966
+chi:967
+psi:968
+omega:969
+thetasym:977
+upsih:978
+piv:982
+bull:8226
+hellip:8230
+prime:8242
+Prime:8243
+oline:8254
+frasl:8260
+weierp:8472
+image:8465
+real:8476
+trade:8482
+alefsym:8501
+larr:8592
+uarr:8593
+rarr:8594
+darr:8595
+harr:8596
+crarr:8629
+lArr:8656
+uArr:8657
+rArr:8658
+dArr:8659
+hArr:8660
+forall:8704
+part:8706
+exist:8707
+empty:8709
+nabla:8711
+isin:8712
+notin:8713
+ni:8715
+prod:8719
+sum:8721
+minus:8722
+lowast:8727
+radic:8730
+prop:8733
+infin:8734
+ang:8736
+and:8743
+or:8744
+cap:8745
+cup:8746
+int:8747
+there4:8756
+sim:8764
+cong:8773
+asymp:8776
+ne:8800
+equiv:8801
+le:8804
+ge:8805
+sub:8834
+sup:8835
+nsub:8836
+sube:8838
+supe:8839
+oplus:8853
+otimes:8855
+perp:8869
+sdot:8901
+lceil:8968
+rceil:8969
+lfloor:8970
+rfloor:8971
+lang:9001
+rang:9002
+loz:9674
+spades:9824
+clubs:9827
+hearts:9829
+diams:9830
+%:34
+amp:38
+lt:60
+gt:62
+OElig:338
+oelig:339
+Scaron:352
+scaron:353
+Yuml:376
+circ:710
+tilde:732
+ensp:8194
+emsp:8195
+thinsp:8201
+zwnj:8204
+zwj:8205
+lrm:8206
+rlm:8207
+ndash:8211
+mdash:8212
+lsquo:8216
+rsquo:8217
+sbquo:8218
+ldquo:8220
+rdquo:8221
+bdquo:8222
+dagger:8224
+Dagger:8225
+permil:8240
+lsaquo:8249
+rsaquo:8250
+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
@@ -1,7 +1,8 @@
enum MarkupType
{
cNONE,
cTEXT,
cHTML,
- cPML
+ cPML,
+ cCHM
};
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,122 +1,43 @@
#ifdef _WINDOWS
#include <string.h>
#endif
#include "Navigation.h"
-//#include <stdio.h>
-
-/*
- void saveposn(size_t posn)
- save/push position to history buffer for future use of back() function
-*/
-void CNavigation::saveposn(size_t posn)
-{
- //printf("saving position %u, depth %u\n",posn,historycurrent);
- history[historycurrent] = posn;
- historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE;
- if (historycurrent==historystart)
- // circular buffer full, forget oldest record
- historystart=(historystart+1)%NAVIGATION_HISTORY_SIZE;
- // no forward possible after saveposn
- historyend = historycurrent;
-}
-
-/*
- void writeposn(size_t posn)
- overwrite current (unused) position
- useful for saving current position before using back button
-*/
-void CNavigation::writeposn(size_t posn)
-{
- //printf("witing position %u, depth %u\n",posn,historycurrent);
- history[historycurrent] = posn;
-}
-
-/*
- bool back(size_t& posn)
- go back in history
- restore last position saved with saveposn() and return true
- return false if there is nothing saved in history
-*/
-bool CNavigation::back(size_t& posn)
-{
- if (historycurrent!=historystart) {
- // buffer is not empty
- if (historycurrent==0)
- historycurrent=NAVIGATION_HISTORY_SIZE-1;
- else
- historycurrent--;
- posn=history[historycurrent];
- //printf("back(): going back to %u depth %u\n",posn,historycurrent);
- return true;
-
- } else {
- // circular buffer empty
- //printf("back(): empty history\n");
- return false;
- }
-}
-
-/*
- bool forward(size_t& posn)
- go forward in history, if possible
- undo calling of back()
-*/
-bool CNavigation::forward(size_t& posn)
-{
- if (historycurrent!=historyend) {
- // [historycurrent] = current position
- // [historycurrent+1] = position we need
- historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE;
- posn = history[historycurrent];
- //printf("forward(): going to position %d\n",posn);
- return true;
- } else {
- //printf("forward(): there is no future :)\n");
- return false;
- }
-}
void CNavigation::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
{
len = srclen+sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE);
data = new unsigned char[len];
unsigned char* p = data;
memcpy(p, src, srclen);
p += srclen;
memcpy(p, &historystart, sizeof(size_t));
p += sizeof(size_t);
memcpy(p, &historyend, sizeof(size_t));
p += sizeof(size_t);
memcpy(p, &historycurrent, sizeof(size_t));
p += sizeof(size_t);
memcpy(p, history, sizeof(size_t)*NAVIGATION_HISTORY_SIZE);
-/*
- printf("<%u,%u,%u>\n", historystart, historyend, historycurrent);
- for (int i = historystart; i <= historyend; i++)
- printf("<%u> ", history[i]);
- printf("\n");
-*/
}
void CNavigation::putSaveData(unsigned char*& src, unsigned short& srclen)
{
if (srclen >= sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE))
{
unsigned char* p = src;
memcpy(&historystart, p, sizeof(size_t));
p += sizeof(size_t);
memcpy(&historyend, p, sizeof(size_t));
p += sizeof(size_t);
memcpy(&historycurrent, p, sizeof(size_t));
p += sizeof(size_t);
memcpy(history, p, sizeof(size_t)*NAVIGATION_HISTORY_SIZE);
src = p + sizeof(size_t)*NAVIGATION_HISTORY_SIZE;
srclen -= sizeof(size_t)*(3+NAVIGATION_HISTORY_SIZE);
}
/*
printf("<%u,%u,%u>\n", historystart, historyend, historycurrent);
for (int i = historystart; i <= historyend; i++)
printf("<%u> ", history[i]);
printf("\n");
*/
}
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 @@
+#ifndef __NAVIGATION_H
+#define __NAVIGATION_H
+
#include <string.h>
#include <stdlib.h>
const size_t NAVIGATION_HISTORY_SIZE = 32;
-class CNavigation
+template<class T>
+class CNavigation_base
{
- size_t history[NAVIGATION_HISTORY_SIZE];
+protected:
+ T history[NAVIGATION_HISTORY_SIZE];
size_t historystart, historyend, historycurrent;
public:
- CNavigation() : historystart(0),historyend(0),historycurrent(0) {}
- void saveposn(size_t posn);
- void writeposn(size_t posn);
- bool forward(size_t& loc);
- bool back(size_t& loc);
+ CNavigation_base() : historystart(0),historyend(0),historycurrent(0) {}
+ void saveposn(T posn);
+ void writeposn(T posn);
+ bool forward(T& loc);
+ bool back(T& loc);
+};
+
+class CNavigation : public CNavigation_base<size_t>
+{
+ public:
void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen);
void putSaveData(unsigned char*& src, unsigned short& srclen);
};
+
+template<class T>
+inline void CNavigation_base<T>::saveposn(T posn)
+{
+ history[historycurrent] = posn;
+ historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE;
+ if (historycurrent==historystart)
+ {
+ historystart=(historystart+1)%NAVIGATION_HISTORY_SIZE;
+ }
+ historyend = historycurrent;
+}
+
+template<class T>
+inline void CNavigation_base<T>::writeposn(T posn)
+{
+ history[historycurrent] = posn;
+}
+
+template<class T>
+inline bool CNavigation_base<T>::back(T& posn)
+{
+ if (historycurrent!=historystart)
+ {
+ // buffer is not empty
+ if (historycurrent==0)
+ {
+ historycurrent=NAVIGATION_HISTORY_SIZE-1;
+ }
+ else
+ {
+ historycurrent--;
+ }
+ posn=history[historycurrent];
+ return true;
+ }
+ else
+ {
+ // circular buffer empty
+ return false;
+ }
+}
+
+template<class T>
+inline bool CNavigation_base<T>::forward(T& posn)
+{
+ if (historycurrent!=historyend)
+ {
+ historycurrent=(historycurrent+1)%NAVIGATION_HISTORY_SIZE;
+ posn = history[historycurrent];
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+#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 @@
+#include "CSource.h"
+/****************************************************************************
+ * This file is part of PPMd project *
+ * Written and distributed to public domain by Dmitry Shkarin 1997, *
+ * 1999-2001 *
+ * Contents: interface to encoding/decoding routines *
+ * Comments: this file can be used as an interface to PPMd module *
+ * (consisting of Model.cpp) from external program *
+ ****************************************************************************/
+#if !defined(_PPMD_H_)
+#define _PPMD_H_
+
+#include "PPMdType.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+BOOL _STDCALL StartSubAllocator(UINT SubAllocatorSize);
+void _STDCALL StopSubAllocator(); /* it can be called once */
+DWORD _STDCALL GetUsedMemory(); /* for information only */
+
+/****************************************************************************
+ * Method of model restoration at memory insufficiency: *
+ * MRM_RESTART - restart model from scratch (default) *
+ * MRM_CUT_OFF - cut off model (nearly twice slower) *
+ * MRM_FREEZE - freeze context tree (dangerous) */
+enum MR_METHOD { MRM_RESTART, MRM_CUT_OFF, MRM_FREEZE };
+
+/****************************************************************************
+ * (MaxOrder == 1) parameter value has special meaning, it does not restart *
+ * model and can be used for solid mode archives; *
+ * Call sequence: *
+ * StartSubAllocator(SubAllocatorSize); *
+ * EncodeFile(SolidArcFile,File1,MaxOrder,MRM_RESTART); *
+ * EncodeFile(SolidArcFile,File2, 1,MRM_RESTART); *
+ * ... *
+ * EncodeFile(SolidArcFile,FileN, 1,MRM_RESTART); *
+ * StopSubAllocator(); *
+ ****************************************************************************/
+void _STDCALL EncodeFile(CSink* EncodedFile,CSource* DecodedFile,
+ int MaxOrder,MR_METHOD MRMethod=MRM_RESTART);
+void _STDCALL DecodeFile(CSink* DecodedFile,CSource* EncodedFile,
+ int MaxOrder,MR_METHOD MRMethod=MRM_RESTART);
+
+/* imported function */
+void _STDCALL PrintInfo(CInfo* DecodedFile, CInfo* EncodedFile);
+
+#ifdef __cplusplus
+}
+#endif
+
+#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 @@
+/****************************************************************************
+ * This file is part of PPMd project *
+ * Written and distributed to public domain by Dmitry Shkarin 1997, *
+ * 1999-2001 *
+ * Contents: compilation parameters and miscelaneous definitions *
+ * Comments: system & compiler dependent file *
+ ****************************************************************************/
+#if !defined(_PPMDTYPE_H_)
+#define _PPMDTYPE_H_
+
+#include <stdio.h>
+
+//#define _WIN32_ENVIRONMENT_
+//#define _DOS32_ENVIRONMENT_
+#define _POSIX_ENVIRONMENT_
+//#define _UNKNOWN_ENVIRONMENT_
+#if defined(_WIN32_ENVIRONMENT_)+defined(_DOS32_ENVIRONMENT_)+defined(_POSIX_ENVIRONMENT_)+defined(_UNKNOWN_ENVIRONMENT_) != 1
+#error Only one environment must be defined
+#endif /* defined(_WIN32_ENVIRONMENT_)+defined(_DOS32_ENVIRONMENT_)+defined(_POSIX_ENVIRONMENT_)+defined(_UNKNOWN_ENVIRONMENT_) != 1 */
+
+#if defined(_WIN32_ENVIRONMENT_)
+#include <windows.h>
+#else /* _DOS32_ENVIRONMENT_ || _POSIX_ENVIRONMENT_ || _UNKNOWN_ENVIRONMENT_ */
+typedef int BOOL;
+#define FALSE 0
+#define TRUE 1
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+typedef unsigned int UINT;
+#endif /* defined(_WIN32_ENVIRONMENT_) */
+
+const DWORD PPMdSignature=0x84ACAF8F, Variant='I';
+const int MAX_O=16; /* maximum allowed model order */
+
+#define _USE_PREFETCHING /* for puzzling mainly */
+
+#if !defined(_UNKNOWN_ENVIRONMENT_) && !defined(__GNUC__)
+#define _FASTCALL __fastcall
+#define _STDCALL __stdcall
+#else
+#define _FASTCALL
+#define _STDCALL
+#endif /* !defined(_UNKNOWN_ENVIRONMENT_) && !defined(__GNUC__) */
+
+#if defined(__GNUC__)
+#define _PACK_ATTR __attribute__ ((packed))
+#else /* "#pragma pack" is used for other compilers */
+#define _PACK_ATTR
+#endif /* defined(__GNUC__) */
+
+/* PPMd module works with file streams via ...GETC/...PUTC macros only */
+typedef FILE _PPMD_FILE;
+#define _PPMD_E_GETC(pps) (pps)->get()
+#define _PPMD_E_PUTC(c,pps) (pps)->put(c)
+#define _PPMD_D_GETC(pps) (pps)->get()
+#define _PPMD_D_PUTC(c,pps) (pps)->put(c)
+/****************** Example of C++ buffered stream ************************
+class PRIME_STREAM {
+public:
+enum { BUF_SIZE=64*1024 };
+ PRIME_STREAM(): Error(0), StrPos(0), Count(0), p(Buf) {}
+ int get( ) { return (--Count >= 0)?(*p++ ):( fill( )); }
+ int put(int c) { return (--Count >= 0)?(*p++ = c):(flush(c)); }
+ int getErr() const { return Error; }
+ int tell() const { return StrPos+(p-Buf); }
+ BOOL atEOS() const { return (Count < 0); }
+protected:
+ int Error, StrPos, Count;
+ BYTE* p, Buf[BUF_SIZE];
+ virtual int fill( ) = 0; // it must fill Buf[]
+ virtual int flush(int c) = 0; // it must remove (p-Buf) bytes
+};
+typedef PRIME_STREAM _PPMD_FILE;
+#define _PPMD_E_GETC(pps) (pps)->get()
+#define _PPMD_E_PUTC(c,pps) (pps)->put(c)
+#define _PPMD_D_GETC(pps) (pps)->get()
+#define _PPMD_D_PUTC(c,pps) (pps)->put(c)
+************************** End of example *********************************/
+
+#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,319 +1,299 @@
/* -*- mode: c; indent-tabs-mode: nil; -*- */
-
-/* OPIE */
-#include <opie2/odebug.h>
-
-/* QT */
-#include <qimage.h>
-
-/* STD */
+#include "useqpe.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _WINDOWS
#include <unistd.h> /* for link */
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
+#include <qimage.h>
/***********************************************************************/
/***********************************************************************/
/***** *****/
/***** Code to decode the Palm image format to JPEG *****/
/***** *****/
/***********************************************************************/
/***********************************************************************/
#define READ_BIGENDIAN_SHORT(p) (((p)[0] << 8)|((p)[1]))
#define READ_BIGENDIAN_LONG(p) (((p)[0] << 24)|((p)[1] << 16)|((p)[2] << 8)|((p)[3]))
#define PALM_IS_COMPRESSED_FLAG 0x8000
#define PALM_HAS_COLORMAP_FLAG 0x4000
#define PALM_HAS_TRANSPARENCY_FLAG 0x2000
#define PALM_DIRECT_COLOR_FLAG 0x0400
#define PALM_4_BYTE_FIELD_FLAG 0x0200
#define PALM_COMPRESSION_SCANLINE 0x00
#define PALM_COMPRESSION_RLE 0x01
#define PALM_COMPRESSION_PACKBITS 0x02
#define PALM_COMPRESSION_NONE 0xFF
#define PALM_COLORMAP_SIZE 232
typedef struct {
unsigned char red;
unsigned char green;
unsigned char blue;
} ColorMapEntry;
static ColorMapEntry Palm8BitColormap[] = {
{ 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 },
{ 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 },
{ 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 },
{ 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 },
{ 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 },
{ 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 },
{ 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 },
{ 204, 51, 204 }, { 204, 0, 204 }, { 204, 255, 153 }, { 204, 204, 153 },
{ 204, 153, 153 }, { 204, 102, 153 }, { 204, 51, 153 }, { 204, 0, 153 },
{ 153, 255, 255 }, { 153, 204, 255 }, { 153, 153, 255 }, { 153, 102, 255 },
{ 153, 51, 255 }, { 153, 0, 255 }, { 153, 255, 204 }, { 153, 204, 204 },
{ 153, 153, 204 }, { 153, 102, 204 }, { 153, 51, 204 }, { 153, 0, 204 },
{ 153, 255, 153 }, { 153, 204, 153 }, { 153, 153, 153 }, { 153, 102, 153 },
{ 153, 51, 153 }, { 153, 0, 153 }, { 102, 255, 255 }, { 102, 204, 255 },
{ 102, 153, 255 }, { 102, 102, 255 }, { 102, 51, 255 }, { 102, 0, 255 },
{ 102, 255, 204 }, { 102, 204, 204 }, { 102, 153, 204 }, { 102, 102, 204 },
{ 102, 51, 204 }, { 102, 0, 204 }, { 102, 255, 153 }, { 102, 204, 153 },
{ 102, 153, 153 }, { 102, 102, 153 }, { 102, 51, 153 }, { 102, 0, 153 },
{ 51, 255, 255 }, { 51, 204, 255 }, { 51, 153, 255 }, { 51, 102, 255 },
{ 51, 51, 255 }, { 51, 0, 255 }, { 51, 255, 204 }, { 51, 204, 204 },
{ 51, 153, 204 }, { 51, 102, 204 }, { 51, 51, 204 }, { 51, 0, 204 },
{ 51, 255, 153 }, { 51, 204, 153 }, { 51, 153, 153 }, { 51, 102, 153 },
{ 51, 51, 153 }, { 51, 0, 153 }, { 0, 255, 255 }, { 0, 204, 255 },
{ 0, 153, 255 }, { 0, 102, 255 }, { 0, 51, 255 }, { 0, 0, 255 },
{ 0, 255, 204 }, { 0, 204, 204 }, { 0, 153, 204 }, { 0, 102, 204 },
{ 0, 51, 204 }, { 0, 0, 204 }, { 0, 255, 153 }, { 0, 204, 153 },
{ 0, 153, 153 }, { 0, 102, 153 }, { 0, 51, 153 }, { 0, 0, 153 },
{ 255, 255, 102 }, { 255, 204, 102 }, { 255, 153, 102 }, { 255, 102, 102 },
{ 255, 51, 102 }, { 255, 0, 102 }, { 255, 255, 51 }, { 255, 204, 51 },
{ 255, 153, 51 }, { 255, 102, 51 }, { 255, 51, 51 }, { 255, 0, 51 },
{ 255, 255, 0 }, { 255, 204, 0 }, { 255, 153, 0 }, { 255, 102, 0 },
{ 255, 51, 0 }, { 255, 0, 0 }, { 204, 255, 102 }, { 204, 204, 102 },
{ 204, 153, 102 }, { 204, 102, 102 }, { 204, 51, 102 }, { 204, 0, 102 },
{ 204, 255, 51 }, { 204, 204, 51 }, { 204, 153, 51 }, { 204, 102, 51 },
{ 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 },
{ 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 },
{ 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 },
{ 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 },
{ 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 },
{ 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 },
{ 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 },
{ 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 },
{ 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 },
{ 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 },
{ 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 },
{ 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 },
{ 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 },
{ 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 },
{ 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 },
{ 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 },
{ 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 },
{ 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 },
{ 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 },
{ 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 },
{ 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 },
{ 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 },
{ 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 },
{ 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }};
static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }};
static ColorMapEntry Palm2BitColormap[] = {
{ 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }};
static ColorMapEntry Palm4BitColormap[] = {
{ 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 },
{ 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 },
{ 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 },
{ 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }};
QImage* Palm2QImage
(unsigned char *image_bytes_in, int byte_count_in)
{
unsigned int width, height, bytes_per_row, flags, next_depth_offset;
unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount;
unsigned int palm_red_bits, palm_green_bits, palm_blue_bits;
unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow,
*imagedatastart, *palmimage;
ColorMapEntry *colormap;
palmimage = image_bytes_in;
width = READ_BIGENDIAN_SHORT(palmimage + 0);
height = READ_BIGENDIAN_SHORT(palmimage + 2);
bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4);
flags = READ_BIGENDIAN_SHORT(palmimage + 6);
bits_per_pixel = palmimage[8];
version = palmimage[9];
next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10);
transparent_index = palmimage[12];
compression_type = palmimage[13];
/* bytes 14 and 15 are reserved by Palm and always 0 */
#if 0
-// odebug << "Palm image is " << width << "x" << height
-// << ", " << bits_per_pixel << " bpp, version " << version
-// << ", flags 0x" << flags << ", compression " << compression_type << oendl;
+// qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type);
#endif
if (compression_type == PALM_COMPRESSION_PACKBITS) {
-// odebug << "Image uses packbits compression; not yet supported" << oendl;
+// qDebug ("Image uses packbits compression; not yet supported");
return NULL;
} else if ((compression_type != PALM_COMPRESSION_NONE) &&
(compression_type != PALM_COMPRESSION_RLE) &&
(compression_type != PALM_COMPRESSION_SCANLINE)) {
-// odebug << "Image uses unknown compression, code 0x" << compression_type << oendl;
+// qDebug ("Image uses unknown compression, code 0x%x", compression_type);
return NULL;
}
/* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps:
1, 2, or 4 bit grayscale
8-bit StaticColor using the Palm standard colormap
8-bit PseudoColor using a user-specified colormap
16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue
Each of these can be compressed with one of four compression schemes,
"RLE", "Scanline", "PackBits", or none.
We begin by constructing the colormap.
*/
if (flags & PALM_HAS_COLORMAP_FLAG) {
-// odebug << "Palm images with custom colormaps are not currently supported." << oendl;
+// qDebug("Palm images with custom colormaps are not currently supported.\n");
return NULL;
} else if (bits_per_pixel == 1) {
colormap = Palm1BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 2) {
colormap = Palm2BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 4) {
colormap = Palm4BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 8) {
colormap = Palm8BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) {
colormap = NULL;
palm_red_bits = palmimage[16];
palm_green_bits = palmimage[17];
palm_blue_bits = palmimage[18];
-// odebug << "Bits:" << palm_red_bits << ", " << palm_green_bits << ", " << palm_blue_bits << oendl;
+// qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits);
if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) {
-// odebug << "Can't handle this format DirectColor image -- too wide in some color ("
-// << palm_red_bits << ":" << palm_green_bits << ":" << palm_blue_bits << oendl;
+// 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);
return NULL;
}
if (bits_per_pixel > (8 * sizeof(unsigned long))) {
-// odebug << "Can't handle this format DirectColor image -- too many bits per pixel ("
-// << bits_per_pixel << ")" << oendl;
+// qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel);
return NULL;
}
imagedatastart = palmimage + 24;
} else {
-// odebug << "Unknown bits-per-pixel of " << bits_per_pixel << " encountered" << oendl;
+// qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel);
return NULL;
}
#ifndef USEQPE
QImage* qimage = new QImage(width, height, 32);
#else
QImage* qimage = new QImage(width, height, 16);
#endif
/* row by row, uncompress the Palm image and copy it to the JPEG buffer */
rowbuf = new unsigned char[bytes_per_row * width];
lastrow = new unsigned char[bytes_per_row * width];
for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) {
-// odebug << "inval:" << inval << " palm_ptr:" << palm_ptr << " x_ptr:" << x_ptr
-// << " bpr:" << bytes_per_row << oendl;
+// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row);
/* first, uncompress the Palm image */
if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) {
for (j = 0; j < bytes_per_row; ) {
incount = *palm_ptr++;
inval = *palm_ptr++;
memset(rowbuf + j, inval, incount);
j += incount;
}
} else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) {
for (j = 0; j < bytes_per_row; j += 8) {
incount = *palm_ptr++;
inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8;
for (inbit = 0; inbit < inval; inbit += 1) {
if (incount & (1 << (7 - inbit)))
rowbuf[j + inbit] = *palm_ptr++;
else
rowbuf[j + inbit] = lastrow[j + inbit];
}
}
memcpy (lastrow, rowbuf, bytes_per_row);
} else if (((flags & PALM_IS_COMPRESSED_FLAG) &&
(compression_type == PALM_COMPRESSION_NONE)) ||
((flags & PALM_IS_COMPRESSED_FLAG) == 0))
{
memcpy (rowbuf, palm_ptr, bytes_per_row);
palm_ptr += bytes_per_row;
}
else {
- odebug << "Case 4" << oendl;
- odebug << "Is compressed:" << (((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true") << oendl;
- odebug << "Has colourmap:" << (((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true") << oendl;
- odebug << "Has transparency:" << (((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true") << oendl;
- odebug << "Direct colour:" << (((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true") << oendl;
- odebug << "four byte field:" << (((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true") << oendl;
+ qDebug("Case 4");
+ qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true");
+ qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true");
+ qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true");
+ qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true");
+ qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true");
memcpy (rowbuf, palm_ptr, bytes_per_row);
palm_ptr += bytes_per_row;
}
/* next, write it to the GDK bitmap */
if (colormap) {
mask = (1 << bits_per_pixel) - 1;
for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) {
inval = ((*inbyte) & (mask << inbit)) >> inbit;
/* correct for oddity of the 8-bit color Palm pixmap... */
if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231;
/* now lookup the correct color and set the pixel in the GTK bitmap */
QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue);
qimage->setPixel(j, i, colour);
if (!inbit) {
++inbyte;
inbit = 8 - bits_per_pixel;
} else {
inbit -= bits_per_pixel;
}
}
} else if (!colormap &&
bits_per_pixel == 16) {
for (inbyte = rowbuf, j = 0; j < width; ++j) {
inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1];
/*
- odebug << "pixel is " << j << "," << i << " ("
- << (((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits)) << ":"
- << (((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits)) << ":"
- << (((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)) << ")" << oendl;
+ qDebug ("pixel is %d,%d (%d:%d:%d)",
+ j, i,
+ ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits),
+ ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits),
+ ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits));
*/
QRgb colour = qRgb(
((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits),
((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits),
((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits));
qimage->setPixel(j, i, colour);
inbyte += 2;
}
}
}
delete [] rowbuf;
delete [] lastrow;
return qimage;
}
-
-QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b)
-{
-// odebug << "hrule [" << w << ", " << h << "]" << oendl;
- QPixmap* qimage = new QPixmap(w, h);
- qimage->fill(QColor(r,g,b));
- QImage* ret = new QImage(qimage->convertToImage());
- delete qimage;
- return ret;
-}
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
@@ -1,7 +1,5 @@
#include <qimage.h>
#include <qpixmap.h>
QImage* Palm2QImage
(unsigned char *image_bytes_in, int byte_count_in);
-
-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 @@
+#############################################################################
+# Makefile for building: libPlucker.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:40:46 2004
+# Project: PluckerCodec.pro
+# Template: lib
+# Command: $(QMAKE) -o PluckerCodec.mak PluckerCodec.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libPlucker.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = plucker.h
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+OBJECTS = QREADEROBJS/plucker.o \
+ QREADEROBJS/Palm2QImage.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = PluckerCodec.pro
+QMAKE_TARGET = Plucker
+DESTDIR = $(READERDIR)/codecs/
+TARGET = libPlucker.so.1.0.0
+TARGETA = $(READERDIR)/codecs/libPlucker.a
+TARGETD = libPlucker.so.1.0.0
+TARGET0 = libPlucker.so
+TARGET1 = libPlucker.so.1
+TARGET2 = libPlucker.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: PluckerCodec.mak $(READERDIR)/codecs/$(TARGET)
+
+$(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+PluckerCodec.mak: PluckerCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o PluckerCodec.mak PluckerCodec.pro
+qmake:
+ @$(QMAKE) -o PluckerCodec.mak PluckerCodec.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/plucker.o: plucker.cpp QREADERINC/useqpe.h \
+ plucker.h \
+ Aportis.h \
+ Palm2QImage.h \
+ QREADERINC/static.h \
+ plucker_base.h \
+ CExpander.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/plucker.o plucker.cpp
+
+QREADEROBJS/Palm2QImage.o: Palm2QImage.cpp QREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Palm2QImage.o Palm2QImage.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libPlucker.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: PluckerCodec.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libPlucker.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = plucker.h
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+OBJECTS = OREADEROBJS/plucker.o \
+ OREADEROBJS/Palm2QImage.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libPlucker.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libPlucker.a
+TARGETD = libPlucker.so.1.0.0
+TARGET0 = libPlucker.so
+TARGET1 = libPlucker.so.1
+TARGET2 = libPlucker.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: PluckerCodec.omak
+
+PluckerCodec.omak: PluckerCodec.opro
+ tmake PluckerCodec.opro -o PluckerCodec.omak
+
+dist:
+ $(TAR) PluckerCodec.opro.tar PluckerCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) PluckerCodec.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/plucker.o: plucker.cpp \
+ OREADERINC/useqpe.h \
+ plucker.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Palm2QImage.h \
+ OREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/plucker.o plucker.cpp
+
+OREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \
+ OREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Palm2QImage.o Palm2QImage.cpp
+
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 @@
+#############################################################################
+# Makefile for building libPlucker.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: PluckerCodec.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libPlucker.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = plucker.h
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+OBJECTS = WSREADEROBJS/plucker.o \
+ WSREADEROBJS/Palm2QImage.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libPlucker.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libPlucker.a
+TARGETD = libPlucker.so.1.0.0
+TARGET0 = libPlucker.so
+TARGET1 = libPlucker.so.1
+TARGET2 = libPlucker.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: PluckerCodec.wmak
+
+PluckerCodec.wmak: PluckerCodec.wpro
+ tmake PluckerCodec.wpro -o PluckerCodec.wmak
+
+dist:
+ $(TAR) PluckerCodec.wpro.tar PluckerCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) PluckerCodec.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/plucker.o: plucker.cpp \
+ WSREADERINC/useqpe.h \
+ plucker.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Palm2QImage.h \
+ WSREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/plucker.o plucker.cpp
+
+WSREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \
+ WSREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Palm2QImage.o Palm2QImage.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = plucker.h
+
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = Plucker
+LIBS += -lreader_pdb -lreader_pluckerbase -lreader_codec
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libPlucker.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: PluckerCodec.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libPlucker.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_pluckerbase -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = plucker.h
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+OBJECTS = ZREADEROBJS/plucker.o \
+ ZREADEROBJS/Palm2QImage.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libPlucker.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libPlucker.a
+TARGETD = libPlucker.so.1.0.0
+TARGET0 = libPlucker.so
+TARGET1 = libPlucker.so.1
+TARGET2 = libPlucker.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libPlucker.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: PluckerCodec.zmak
+
+PluckerCodec.zmak: PluckerCodec.zpro
+ tmake PluckerCodec.zpro -o PluckerCodec.zmak
+
+dist:
+ $(TAR) PluckerCodec.zpro.tar PluckerCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) PluckerCodec.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/plucker.o: plucker.cpp \
+ ZREADERINC/useqpe.h \
+ plucker.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Palm2QImage.h \
+ ZREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/plucker.o plucker.cpp
+
+ZREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \
+ ZREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Palm2QImage.o Palm2QImage.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = plucker.h
+
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = Plucker
+LIBS += -lreader_pdb -lreader_pluckerbase -lreader_codec
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = plucker.h
+
+SOURCES = plucker.cpp \
+ Palm2QImage.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/codecs
+TARGET = Plucker
+LIBS += -lreader_pdb -lreader_pluckerbase -lreader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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
@@ -1,630 +1,777 @@
/****************************************************************************
** Form implementation generated from reading ui file 'Prefs.ui'
**
** Created: Tue Feb 11 23:53:35 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "Prefs.h"
+#include <qcheckbox.h>
#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
#include <qbuttongroup.h>
-#ifdef USEQPE
-#include <qpe/menubutton.h>
-#include <qpe/fontdatabase.h>
+#include <qlineedit.h>
+#ifdef USECOMBO
+#include <qcombobox.h>
#else
-#include <qfontdatabase.h>
+#include <qpe/menubutton.h>
#endif
+#include <qfontdatabase.h>
-#include <qpe/qpeapplication.h>
+#ifdef USECOMBO
+void populate_colours(QComboBox *mb)
+#else
+void populate_colours(MenuButton *mb)
+#endif
+{
+ mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ mb->insertItem("White");
+ mb->insertItem("Black");
+ mb->insertItem("Dark Gray");
+ mb->insertItem("Gray");
+ mb->insertItem("Light Gray");
+ mb->insertItem("Red");
+ mb->insertItem("Green");
+ mb->insertItem("Blue");
+ mb->insertItem("Cyan");
+ mb->insertItem("Magenta");
+ mb->insertItem("Yellow");
+ mb->insertItem("Dark Red");
+ mb->insertItem("Dark Green");
+ mb->insertItem("Dark Blue");
+ mb->insertItem("Dark Cyan");
+ mb->insertItem("Dark Magenta");
+ mb->insertItem("Dark Yellow");
+}
CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QHBoxLayout* hb = new QHBoxLayout(this);
- QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, tr("Text"), this);
+ QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Text", this);
hb->addWidget(bg);
StripCR = new QCheckBox( bg );
StripCR->setText( tr( "Strip CR" ) );
Dehyphen = new QCheckBox( bg );
Dehyphen->setText( tr( "Dehyphen" ) );
SingleSpace = new QCheckBox( bg );
SingleSpace->setText( tr( "Single Space" ) );
Unindent = new QCheckBox( bg );
Unindent->setText( tr( "Unindent" ) );
Reparagraph = new QCheckBox( bg );
Reparagraph->setText( tr( "Reparagraph" ) );
DoubleSpace = new QCheckBox( bg );
DoubleSpace->setText( tr( "Double Space" ) );
Remap = new QCheckBox( bg );
Remap->setText( tr( "Remap" ) );
Embolden = new QCheckBox( bg );
Embolden->setText( tr( "Embolden" ) );
FullJustify = new QCheckBox( bg );
FullJustify->setText( tr( "Full Justify" ) );
+ FixGraphics = new QCheckBox( bg );
+ FixGraphics->setText( tr( "Fix Graphic Size" ) );
+
+ hyphenate = new QCheckBox( bg );
+ hyphenate->setText( tr( "Hyphenate" ) );
+
+ /*
+ customhyphen = new QCheckBox( bg );
+ customhyphen->setText( tr( "Custom Hyphen'n" ) );
+ */
+
+ prepalm = new QCheckBox( bg );
+ prepalm->setText( tr( "Repalm(Baen)" ) );
+
+ pkern = new QCheckBox( bg );
+ pkern->setText( tr( "Kern" ) );
+
+ /*
+ Negative = new QCheckBox( bg );
+ Negative->setText( tr( "Negative" ) );
+ */
+
+ // Inverse = new QCheckBox( bg );
+ // Inverse->setText( tr( "Inverse" ) );
}
/*
* Destroys the object and frees any allocated resources
*/
CLayoutPrefs::~CLayoutPrefs()
{
// no need to delete child widgets, Qt does it all for us
}
-CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl )
+CLayoutPrefs2::CLayoutPrefs2( int w, QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+
+ QVBoxLayout* vb = new QVBoxLayout(this);
+ QGridLayout* gl = new QGridLayout(vb, 4, 5);
+
+ QLabel *TextLabel;
+
+ TextLabel = new QLabel( this );
+ TextLabel->setText( tr( "Page\nOverlap" ) );
+ gl->addWidget(TextLabel, 0, 0);
+ pageoverlap = new QSpinBox( this );
+ pageoverlap->setRange(0,20);
+ gl->addWidget(pageoverlap, 0, 1);
+
+ TextLabel = new QLabel( this, "TextLabel1" );
+ TextLabel->setText( tr( "Indent" ) );
+ gl->addWidget(TextLabel, 1, 0);
+ Indent = new QSpinBox( this, "Indent" );
+ Indent->setRange(0,20);
+ gl->addWidget(Indent, 1, 1);
+
+
+
+ TextLabel = new QLabel( this );
+ TextLabel->setText( tr( "Graphics\nZoom" ) );
+ gl->addWidget(TextLabel, 1, 2);
+ gfxzoom = new QSpinBox( this );
+ gfxzoom->setRange(0,2000);
+ gfxzoom->setLineStep(10);
+ gfxzoom->setSuffix("%");
+ gl->addWidget(gfxzoom, 1, 3);
+
+ TextLabel = new QLabel( this, "TextLabel4" );
+ TextLabel->setText( tr( "Top\nMargin" ) );
+ gl->addWidget(TextLabel, 2, 0);
+ TopMargin = new QSpinBox( this, "TMargin" );
+ TopMargin->setRange(0, 1000);
+ gl->addWidget(TopMargin, 2, 1);
+
+ TextLabel = new QLabel( this );
+ TextLabel->setText( tr( "Bottom\nMargin" ) );
+ gl->addWidget(TextLabel, 2, 2);
+ BottomMargin = new QSpinBox( this, "BMargin" );
+ BottomMargin->setRange(0, 1000);
+ gl->addWidget(BottomMargin, 2, 3);
+
+ TextLabel = new QLabel( this, "TextLabel4" );
+ TextLabel->setText( tr( "Left\nMargin" ) );
+ gl->addWidget(TextLabel, 3, 0);
+ LeftMargin = new QSpinBox( this, "LMargin" );
+ LeftMargin->setRange(0, 1000);
+ gl->addWidget(LeftMargin, 3, 1);
+
+ TextLabel = new QLabel( this );
+ TextLabel->setText( tr( "Right\nMargin" ) );
+ gl->addWidget(TextLabel, 3, 2);
+ RightMargin = new QSpinBox( this, "RMargin" );
+ RightMargin->setRange(0, 1000);
+ gl->addWidget(RightMargin, 3, 3);
+
+ TextLabel = new QLabel( this );
+ TextLabel->setText( tr( "Paragraph\nLeading" ) );
+ gl->addWidget(TextLabel, 4, 0);
+ ParaLead = new QSpinBox( this );
+ ParaLead->setRange(-5, 50);
+ gl->addWidget(ParaLead, 4, 1);
+
+ TextLabel = new QLabel( this );
+ TextLabel->setText( tr( "Line\nLeading" ) );
+ gl->addWidget(TextLabel, 4, 2);
+ LineLead = new QSpinBox( this );
+ LineLead->setRange(-5, 50);
+ gl->addWidget(LineLead, 4, 3);
+
+ gl = new QGridLayout(vb, 2, 2);
+
+ TextLabel = new QLabel( this);
+ TextLabel->setText( tr( "Markup" ) );
+ gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom);
+ TextLabel = new QLabel( this);
+ TextLabel->setText( tr( "Font" ) );
+ gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom);
+
+
+#ifdef USECOMBO
+ Markup = new QComboBox( this);
+#else
+ Markup = new MenuButton( this);
+#endif
+ Markup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ Markup->insertItem("Auto");
+ Markup->insertItem("None");
+ Markup->insertItem("Text");
+ Markup->insertItem("HTML");
+ Markup->insertItem("PML");
+ gl->addWidget(Markup, 1, 0, Qt::AlignTop);
+
+#ifdef USECOMBO
+ fontselector = new QComboBox( this);
+#else
+ fontselector = new MenuButton( this);
+#endif
+ fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ {
+ QFontDatabase f;
+ QStringList flist = f.families();
+ for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
+ {
+ fontselector->insertItem(*nm);
+ }
+ } // delete the FontDatabase!!!
+ gl->addWidget(fontselector, 1, 1, Qt::AlignTop);
+
+#ifdef USECOMBO
+ bgsel = new QComboBox( this );
+#else
+ bgsel = new MenuButton( this );
+#endif
+ populate_colours(bgsel);
+
+#ifdef USECOMBO
+ fgsel = new QComboBox( this );
+#else
+ fgsel = new MenuButton( this );
+#endif
+ populate_colours(fgsel);
+ gl = new QGridLayout(vb, 2, 2);
+
+ TextLabel = new QLabel( this);
+ TextLabel->setText( tr( "Background" ) );
+ gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom);
+ TextLabel = new QLabel( this);
+ TextLabel->setText( tr( "Foreground" ) );
+ gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom);
+
+ gl->addWidget(bgsel, 1, 0, Qt::AlignTop);
+ gl->addWidget(fgsel, 1, 1, Qt::AlignTop);
+
+}
+/*
+CLayoutPrefs2::CLayoutPrefs2( int w, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QVBoxLayout* vb = new QVBoxLayout(this);
QGridLayout* gl = new QGridLayout(vb, 4, 3);
QLabel *TextLabel;
TextLabel = new QLabel( this, "TextLabel1" );
TextLabel->setText( tr( "Indent" ) );
gl->addWidget(TextLabel, 0, 0);
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Page\nOverlap" ) );
gl->addWidget(TextLabel, 0, 1);
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Graphics\nZoom" ) );
gl->addWidget(TextLabel, 0, 2);
Indent = new QSpinBox( this, "Indent" );
Indent->setRange(0,20);
gl->addWidget(Indent, 1, 0);
pageoverlap = new QSpinBox( this );
pageoverlap->setRange(0,20);
gl->addWidget(pageoverlap, 1, 1);
gfxzoom = new QSpinBox( this );
gfxzoom->setRange(0,100);
gl->addWidget(gfxzoom, 1, 2);
TextLabel = new QLabel( this, "TextLabel4" );
TextLabel->setText( tr( "Margin" ) );
gl->addWidget(TextLabel, 2, 0);
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Paragraph\nLeading" ) );
gl->addWidget(TextLabel, 2, 1);
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Line\nLeading" ) );
gl->addWidget(TextLabel, 2, 2);
Margin = new QSpinBox( this, "Margin" );
- Margin->setRange(0, 100);
+ Margin->setRange(0, w/2);
gl->addWidget(Margin, 3, 0);
ParaLead = new QSpinBox( this );
ParaLead->setRange(-5, 50);
gl->addWidget(ParaLead, 3, 1);
LineLead = new QSpinBox( this );
LineLead->setRange(-5, 50);
gl->addWidget(LineLead, 3, 2);
gl = new QGridLayout(vb, 2, 2);
TextLabel = new QLabel( this);
TextLabel->setText( tr( "Markup" ) );
gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom);
TextLabel = new QLabel( this);
TextLabel->setText( tr( "Font" ) );
gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom);
#ifdef USECOMBO
Markup = new QComboBox( this);
#else
Markup = new MenuButton( this);
#endif
Markup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
Markup->insertItem("Auto");
Markup->insertItem("None");
Markup->insertItem("Text");
Markup->insertItem("HTML");
Markup->insertItem("PML");
gl->addWidget(Markup, 1, 0, Qt::AlignTop);
#ifdef USECOMBO
fontselector = new QComboBox( this);
#else
fontselector = new MenuButton( this);
#endif
fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
{
-#ifdef USEQPE
- FontDatabase f;
-#else
QFontDatabase f;
-#endif
QStringList flist = f.families();
for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
{
fontselector->insertItem(*nm);
}
} // delete the FontDatabase!!!
gl->addWidget(fontselector, 1, 1, Qt::AlignTop);
+
+#ifdef USECOMBO
+ bgsel = new QComboBox( this );
+#else
+ bgsel = new MenuButton( this );
+#endif
+ populate_colours(bgsel);
+
+#ifdef USECOMBO
+ fgsel = new QComboBox( this );
+#else
+ fgsel = new MenuButton( this );
+#endif
+ populate_colours(fgsel);
+ gl = new QGridLayout(vb, 2, 2);
+
+ TextLabel = new QLabel( this);
+ TextLabel->setText( tr( "Background" ) );
+ gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom);
+ TextLabel = new QLabel( this);
+ TextLabel->setText( tr( "Foreground" ) );
+ gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom);
+
+ gl->addWidget(bgsel, 1, 0, Qt::AlignTop);
+ gl->addWidget(fgsel, 1, 1, Qt::AlignTop);
+
}
+*/
/*
CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QHBoxLayout* hb = new QHBoxLayout(this);
QVBoxLayout* vb = new QVBoxLayout;
hb->addLayout(vb);
QLabel *TextLabel;
TextLabel = new QLabel( this, "TextLabel1" );
TextLabel->setText( tr( "Indent" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
Indent = new QSpinBox( this, "Indent" );
Indent->setRange(0,20);
vb->addWidget( Indent, 0, Qt::AlignLeft );
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Page\nOverlap" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
pageoverlap = new QSpinBox( this );
pageoverlap->setRange(0,20);
vb->addWidget( pageoverlap, 0, Qt::AlignLeft );
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Graphics\nZoom" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
gfxzoom = new QSpinBox( this );
gfxzoom->setRange(0,100);
vb->addWidget( gfxzoom, 0, Qt::AlignLeft );
vb->addStretch();
vb = new QVBoxLayout;
hb->addLayout(vb);
TextLabel = new QLabel( this, "TextLabel4" );
TextLabel->setText( tr( "Margin" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
Margin = new QSpinBox( this, "Margin" );
Margin->setRange(0, 100);
vb->addWidget( Margin, 0, Qt::AlignLeft );
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Paragraph\nLeading" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
ParaLead = new QSpinBox( this );
ParaLead->setRange(-5, 50);
vb->addWidget( ParaLead, 0, Qt::AlignLeft );
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Line\nLeading" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
LineLead = new QSpinBox( this );
LineLead->setRange(-5, 50);
vb->addWidget( LineLead, 0, Qt::AlignLeft );
vb->addStretch();
vb = new QVBoxLayout;
hb->addLayout(vb);
TextLabel = new QLabel( this);
TextLabel->setText( tr( "Markup" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
Markup = new MenuButton( this);
Markup->insertItem("Auto");
Markup->insertItem("None");
Markup->insertItem("Text");
Markup->insertItem("HTML");
Markup->insertItem("PML");
vb->addWidget( Markup, 0, Qt::AlignLeft );
TextLabel = new QLabel( this);
TextLabel->setText( tr( "Font" ) );
vb->addWidget( TextLabel, 0, Qt::AlignBottom );
fontselector = new MenuButton( this);
fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
{
FontDatabase f;
QStringList flist = f.families();
for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
{
fontselector->insertItem(*nm);
}
} // delete the FontDatabase!!!
vb->addWidget( fontselector, 0, Qt::AlignLeft );
vb->addStretch();
}
*/
/*
* Destroys the object and frees any allocated resources
*/
CLayoutPrefs2::~CLayoutPrefs2()
{
// no need to delete child widgets, Qt does it all for us
}
/*
CPluckerPrefs::CPluckerPrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
Layout11 = new QVBoxLayout(this);
Layout11->setMargin( 0 );
Depluck = new QCheckBox( this, "Depluck" );
Depluck->setText( tr( "Depluck" ) );
Layout11->addWidget( Depluck );
Dejpluck = new QCheckBox( this, "Dejpluck" );
Dejpluck->setText( tr( "Dejpluck" ) );
Layout11->addWidget( Dejpluck );
Continuous = new QCheckBox( this, "Continuous" );
Continuous->setText( tr( "Continuous" ) );
Layout11->addWidget( Continuous );
}
CPluckerPrefs::~CPluckerPrefs()
{
// no need to delete child widgets, Qt does it all for us
}
*/
/*
CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QVBoxLayout* Layout11 = new QVBoxLayout(this);
Layout11->setMargin( 0 );
QHBoxLayout* hl = new QHBoxLayout;
QLabel* TextLabel = new QLabel( this );
TextLabel->setText( tr( "Action for\nSelect Button" ) );
hl->addWidget(TextLabel);
action = new QComboBox( this );
action->insertItem("Open file");
action->insertItem("Autoscroll");
action->insertItem("Mark");
action->insertItem("Annotate");
action->insertItem("Fullscreen");
hl->addWidget( action );
Layout11->addLayout(hl);
hl = new QHBoxLayout;
TextLabel = new QLabel( this );
TextLabel->setText( tr( "Dictionary\nApplication" ) );
hl->addWidget(TextLabel);
target = new QLineEdit(this);
hl->addWidget( target );
Layout11->addLayout(hl);
QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Selection Target", this);
Layout11->addWidget( bg );
annotation = new QCheckBox( bg );
annotation->setText( tr( "Annotation" ) );
dictionary = new QCheckBox( bg );
dictionary->setText( tr( "Dictionary" ) );
clipboard = new QCheckBox( bg );
clipboard->setText( tr( "Clipboard" ) );
}
CMiscPrefs::~CMiscPrefs()
{
// no need to delete child widgets, Qt does it all for us
}
*/
CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
- QGridLayout* hl = new QGridLayout(this,1,2);
+ QVBoxLayout* vl = new QVBoxLayout(this);
+ QHBoxLayout* hl = new QHBoxLayout;
+ vl->addLayout(hl);
+ vl->setMargin( 0 );
hl->setMargin( 0 );
- QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("Select Action"), this);
- hl->addWidget( gb, 0, 0 );
+ QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Select Action", this);
+ hl->addWidget( gb );
annotation = new QCheckBox( gb );
annotation->setText( tr( "Annotation" ) );
dictionary = new QCheckBox( gb );
dictionary->setText( tr( "Dictionary" ) );
clipboard = new QCheckBox( gb );
clipboard->setText( tr( "Clipboard" ) );
- QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, tr("Plucker"), this);
- hl->addWidget( bg, 0 , 1 );
+ QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Plucker", this);
+ hl->addWidget( bg );
Depluck = new QCheckBox( bg );
Depluck->setText( tr( "Depluck" ) );
Dejpluck = new QCheckBox( bg );
Dejpluck->setText( tr( "Dejpluck" ) );
Continuous = new QCheckBox( bg );
Continuous->setText( tr( "Continuous" ) );
+ bg = new QButtonGroup(2, Qt::Horizontal, "Scroll", this);
+ vl->addWidget( bg );
-/*
+ // scrollinplace = new QCheckBox( bg );
+ // scrollinplace->setText( tr( "In Place" ) );
+#ifdef USECOMBO
+ scrolltype = new QComboBox( bg );
+#else
+ scrolltype = new MenuButton( this);
+#endif
+ scrolltype->insertItem("In Place");
+ scrolltype->insertItem("Rolling (moving bg)");
+ scrolltype->insertItem("Rolling (window)");
+ scrolltype->insertItem("Rolling (static bg)");
+ scrolltype->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
- QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Navigation", this);
- TextLabel = new QLabel( gb );
- TextLabel->setText( tr( "Overlap" ) );
- QSpinBox* sb = new QSpinBox( gb );
-
- Internationalisation
- Ideogram/Word
- Set Width
- Set Encoding
- Set Font
-*/
+
+#ifdef USECOMBO
+ scrollcolor = new QComboBox( bg );
+#else
+ scrollcolor = new MenuButton( this);
+#endif
+ populate_colours(scrollcolor);
+ scrollcolor->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+
+ QLabel* TextLabel = new QLabel( bg );
+ TextLabel->setText( tr( "Scroll step" ) );
+ // gl->addWidget(TextLabel, 2, 0);
+ scrollstep = new QSpinBox( bg );
+ scrollstep->setRange(1, 10);
+ scrollstep->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+ TextLabel = new QLabel( bg );
+ TextLabel->setText( tr( "Minibar Colour" ) );
+#ifdef USECOMBO
+ minibarcol = new QComboBox( bg );
+#else
+ minibarcol = new MenuButton( this);
+#endif
+ populate_colours(minibarcol);
+ minibarcol->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+
+ bg = new QButtonGroup(2, Qt::Vertical, "Background", this);
+ vl->addWidget( bg );
+
+// QLabel* TextLabel = new QLabel( bg );
+// TextLabel->setText( tr( "Copy an image to \"background\" in\n~/Applications/uqtreader/Theme/" ) );
+
+#ifdef USECOMBO
+ bgtype = new QComboBox( bg );
+#else
+ bgtype = new MenuButton( this);
+#endif
+ bgtype->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+ bgtype->insertItem( tr("Centred") );
+ bgtype->insertItem( tr("Tiled") );
+ bgtype->insertItem( tr("Fitted") );
}
CMiscPrefs::~CMiscPrefs()
{
// no need to delete child widgets, Qt does it all for us
}
-CPrefs::CPrefs(bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
+CPrefs::CPrefs( int w, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
{
setCaption(tr( "OpieReader Settings" ) );
QTabWidget* td = new QTabWidget(this);
layout = new CLayoutPrefs(this);
- layout2 = new CLayoutPrefs2(this);
+ layout2 = new CLayoutPrefs2(w, this);
misc = new CMiscPrefs(this);
- button = new CButtonPrefs(this);
+ // button = new CButtonPrefs(kmap, this);
inter = new CInterPrefs(this);
td->addTab(layout, tr("Layout"));
td->addTab(layout2, tr("Layout(2)"));
td->addTab(inter, tr("Locale"));
td->addTab(misc, tr("Misc"));
- td->addTab(button, tr("Buttons"));
+ // td->addTab(button, tr("Buttons"));
QVBoxLayout* v = new QVBoxLayout(this);
v->addWidget(td);
- if (fs)
- QPEApplication::showDialog( this );
+ if (fs) showMaximized();
}
/*
Unicode
Ideo/Word
Width
Encoding
*/
#include "CEncoding_tables.h"
CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QHBoxLayout* hb = new QHBoxLayout(this);
QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("International"), this);
hb->addWidget(gb);
QLabel *TextLabel;
ideogram = new QCheckBox( gb );
ideogram->setText( tr( "Ideograms" ) );
TextLabel = new QLabel( gb );
TextLabel->setText( tr( "Ideogram Width" ) );
ideogramwidth = new QSpinBox( gb );
ideogramwidth->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
ideogramwidth->setRange(1,200);
propfontchange = new QCheckBox( gb );
propfontchange->setText( tr( "Apply font\nto dialogs" ) );
TextLabel = new QLabel( gb );
TextLabel->setText( tr( "Encoding" ) );
#ifdef USECOMBO
encoding = new QComboBox(gb);
#else
encoding = new MenuButton(gb);
#endif
encoding->insertItem("Ascii");
encoding->insertItem("UTF-8");
encoding->insertItem("UCS-2(BE)");
encoding->insertItem("USC-2(LE)");
encoding->insertItem("Palm");
for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++)
{
encoding->insertItem(iter->mime);
}
QVBoxLayout* vb = new QVBoxLayout;
- gb = new QGroupBox(1, Qt::Horizontal, tr("Dictionary"), this);
+ gb = new QGroupBox(1, Qt::Horizontal, "Dictionary", this);
TextLabel = new QLabel( gb );
TextLabel->setText( tr( "Application" ) );
application = new QLineEdit(gb);
application->setFixedWidth(80);
TextLabel = new QLabel( gb );
TextLabel->setText( tr( "Message" ) );
message = new QLineEdit(gb);
message->setFixedWidth(80);
// message->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
twotouch = new QCheckBox( gb );
twotouch->setText( tr( "Two/One\nTouch" ) );
SwapMouse = new QCheckBox( gb );
- SwapMouse->setText(tr("Swap Tap\nActions") );
+ SwapMouse->setText("Swap Tap\nActions");
vb->addWidget(gb);
// vb->addStretch();
hb->addLayout(vb);
}
CInterPrefs::~CInterPrefs()
{
// no need to delete child widgets, Qt does it all for us
}
-
-
-
-#ifdef USECOMBO
-void CButtonPrefs::populate(QComboBox *mb)
-#else
-void CButtonPrefs::populate(MenuButton *mb)
-#endif
-{
- mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
- mb->insertItem(tr("<Nothing>") );
- mb->insertItem(tr("Open file") );
- mb->insertItem(tr("Autoscroll") );
- mb->insertItem(tr("Bookmark") );
- mb->insertItem(tr("Annotate") );
- mb->insertItem(tr("Fullscreen") );
-
- mb->insertItem(tr("Zoom in") );
- mb->insertItem(tr("Zoom out") );
- mb->insertItem(tr("Back") );
- mb->insertItem(tr("Forward") );
- mb->insertItem(tr("Home") );
- mb->insertItem(tr("Page up") );
- mb->insertItem(tr("Page down") );
- mb->insertItem(tr("Line up") );
- mb->insertItem(tr("Line down") );
- mb->insertItem(tr("Beginning") );
- mb->insertItem(tr("End") );
-}
-
-CButtonPrefs::CButtonPrefs( QWidget* parent, const char* name, WFlags fl )
- : QWidget( parent, name, fl )
-{
-
- QGridLayout* hl = new QGridLayout(this,10,2);
-
- hl->setMargin( 0 );
-
- QLabel* ql = new QLabel(tr("Escape Button"), this);
- hl->addWidget(ql, 0, 0, Qt::AlignBottom);
-#ifdef USECOMBO
- escapeAction = new QComboBox( this );
-#else
- escapeAction = new MenuButton( this );
-#endif
- populate(escapeAction);
- hl->addWidget(escapeAction, 1, 0, Qt::AlignTop | Qt::AlignLeft);
-
- ql = new QLabel(tr("Space Button"), this);
- hl->addWidget(ql, 2, 0, Qt::AlignBottom);
-#ifdef USECOMBO
- spaceAction = new QComboBox( this );
-#else
- spaceAction = new MenuButton( this );
-#endif
- populate(spaceAction);
- hl->addWidget(spaceAction, 3, 0, Qt::AlignTop | Qt::AlignLeft);
-
- ql = new QLabel(tr("Return Button"), this);
- hl->addWidget(ql, 2, 1, Qt::AlignBottom);
-#ifdef USECOMBO
- returnAction = new QComboBox( this );
-#else
- returnAction = new MenuButton( this );
-#endif
- populate(returnAction);
- hl->addWidget(returnAction, 3, 1, Qt::AlignTop | Qt::AlignLeft);
-
- ql = new QLabel(tr("Left Arrow"), this);
- hl->addWidget(ql, 4, 0, Qt::AlignBottom);
-#ifdef USECOMBO
- leftAction = new QComboBox( this );
-#else
- leftAction = new MenuButton( this );
-#endif
- populate(leftAction);
- hl->addWidget(leftAction, 5, 0, Qt::AlignTop | Qt::AlignLeft);
- leftScroll = new QCheckBox( tr("Scroll Speed"), this );
- hl->addWidget(leftScroll, 6, 0, Qt::AlignTop | Qt::AlignLeft);
-
- ql = new QLabel(tr("Right Arrow"), this);
- hl->addWidget(ql, 4, 1, Qt::AlignBottom);
-#ifdef USECOMBO
- rightAction = new QComboBox( this );
-#else
- rightAction = new MenuButton( this );
-#endif
- populate(rightAction);
- hl->addWidget(rightAction, 5, 1, Qt::AlignTop | Qt::AlignLeft);
- rightScroll = new QCheckBox( tr("Scroll Speed"), this );
- hl->addWidget(rightScroll, 6, 1, Qt::AlignTop | Qt::AlignLeft);
-
- ql = new QLabel(tr("Down Arrow"), this);
- hl->addWidget(ql, 7, 0, Qt::AlignBottom);
-#ifdef USECOMBO
- downAction = new QComboBox( this );
-#else
- downAction = new MenuButton( this );
-#endif
- populate(downAction);
- hl->addWidget(downAction, 8, 0, Qt::AlignTop | Qt::AlignLeft);
- downScroll = new QCheckBox( tr("Scroll Speed"), this );
- hl->addWidget(downScroll, 9, 0, Qt::AlignTop | Qt::AlignLeft);
-
- ql = new QLabel(tr("Up Arrow"), this);
- hl->addWidget(ql, 7, 1, Qt::AlignBottom);
-#ifdef USECOMBO
- upAction = new QComboBox( this );
-#else
- upAction = new MenuButton( this );
-#endif
- populate(upAction);
- hl->addWidget(upAction, 8, 1, Qt::AlignTop | Qt::AlignLeft);
- upScroll = new QCheckBox( tr("Scroll Speed"), this );
- hl->addWidget(upScroll, 9, 1, Qt::AlignTop | Qt::AlignLeft);
-}
-
-CButtonPrefs::~CButtonPrefs()
-{
- // no need to delete child widgets, Qt does it all for us
-}
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
@@ -1,341 +1,385 @@
/****************************************************************************
** Form interface generated from reading ui file 'Prefs.ui'
**
** Created: Tue Feb 11 23:53:32 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef CPREFS_H
#define CPREFS_H
-#include "useqpe.h"
+
#include <qvariant.h>
#include <qwidget.h>
#include <qtabdialog.h>
#include <qtabwidget.h>
#include <qspinbox.h>
#include <qcheckbox.h>
-#include <qcombobox.h>
#include <qlineedit.h>
-#ifdef USEQPE
+
+#define USECOMBO
+
+#ifdef USECOMBO
+#include <qcombobox.h>
+#else
#include <qpe/menubutton.h>
#endif
-//#include "opie.h"
-//#ifdef OPIE
-#define USECOMBO
-//#endif
+#include "orkey.h"
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
//class QCheckBox;
class QLabel;
//class QSpinBox;
+class QListViewItem;
class CLayoutPrefs : public QWidget
{
- Q_OBJECT
+
public:
friend class CPrefs;
CLayoutPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CLayoutPrefs();
QCheckBox* StripCR;
QCheckBox* Dehyphen;
QCheckBox* SingleSpace;
QCheckBox* Unindent;
QCheckBox* Reparagraph;
QCheckBox* DoubleSpace;
QCheckBox* Remap;
QCheckBox* Embolden;
QCheckBox* FullJustify;
+ QCheckBox* FixGraphics;
+ QCheckBox* hyphenate;
+ // QCheckBox* customhyphen;
+ QCheckBox* prepalm;
+ QCheckBox* pkern;
+ // QCheckBox* Inverse;
+ // QCheckBox* Negative;
};
class CLayoutPrefs2 : public QWidget
{
- Q_OBJECT
+
public:
friend class CPrefs;
- CLayoutPrefs2( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ CLayoutPrefs2( int w, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CLayoutPrefs2();
QSpinBox* ParaLead;
QSpinBox* LineLead;
QSpinBox* Indent;
- QSpinBox* Margin, *gfxzoom, *pageoverlap;
+ QSpinBox *TopMargin, *BottomMargin, *LeftMargin, *RightMargin, *gfxzoom, *pageoverlap;
#ifdef USECOMBO
- QComboBox *Markup, *fontselector;
+ QComboBox *Markup, *fontselector, *fgsel, *bgsel;
#else
- MenuButton *Markup, *fontselector;
+ MenuButton *Markup, *fontselector, *fgsel, *bgsel;
#endif
};
/*
class CPluckerPrefs : public QWidget
{
public:
friend class CPrefs;
CPluckerPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CPluckerPrefs();
QCheckBox* Depluck;
QCheckBox* Dejpluck;
QCheckBox* Continuous;
protected:
QHBoxLayout* Layout5;
QVBoxLayout* Layout11;
QGridLayout* Layout4;
};
*/
class CMiscPrefs : public QWidget
{
- Q_OBJECT
+
public:
friend class CPrefs;
CMiscPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CMiscPrefs();
QCheckBox *annotation, *dictionary, *clipboard;
QCheckBox *Depluck, *Dejpluck, *Continuous;
+
+ QSpinBox *scrollstep;
+
+#ifdef USECOMBO
+ QComboBox *scrollcolor, *bgtype, *scrolltype, *minibarcol;
+#else
+ MenuButton *scrollcolor, *bgtype, *scrolltype, *minibarcol;
+#endif
};
+/*
+class QListView;
+class QListViewItem;
class CButtonPrefs : public QWidget
{
Q_OBJECT
+ QMap<orKey, int> *kmap;
+ QMap<orKey, QListViewItem*> listmap;
+ QListView* lb;
+ void keyPressEvent(QKeyEvent* e);
#ifdef USECOMBO
void populate(QComboBox*);
#else
void populate(MenuButton*);
#endif
public:
friend class CPrefs;
- CButtonPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ CButtonPrefs( QMap<orKey, int>*, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CButtonPrefs();
#ifdef USECOMBO
- QComboBox *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction;
+ QComboBox *action;
#else
- MenuButton *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction;
+ MenuButton *action;
#endif
- QCheckBox *leftScroll, *rightScroll, *upScroll, *downScroll;
-};
+ QSpinBox* debounce;
+ // QCheckBox *leftScroll, *rightScroll, *upScroll, *downScroll;
+ private slots:
+ void erasemapping(QListViewItem*);
+};
+*/
class CInterPrefs : public QWidget
{
- Q_OBJECT
+
public:
friend class CPrefs;
CInterPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CInterPrefs();
QCheckBox *ideogram, *propfontchange, *SwapMouse, *twotouch;
#ifdef USECOMBO
QComboBox* encoding;
#else
MenuButton* encoding;
#endif
QSpinBox* ideogramwidth;
QLineEdit *application, *message;
};
class CPrefs : public QDialog
{
Q_OBJECT
CLayoutPrefs* layout;
CLayoutPrefs2* layout2;
CMiscPrefs* misc;
- CButtonPrefs* button;
+ // CButtonPrefs* button;
CInterPrefs* inter;
void keyPressEvent(QKeyEvent* e)
{
switch (e->key())
{
case Key_Escape:
e->accept();
reject();
break;
case Key_Space:
case Key_Return:
e->accept();
accept();
break;
default:
QWidget::keyPressEvent(e);
}
}
public:
- CPrefs(bool fs = true, QWidget* parent = 0, const char* name = 0);
+ CPrefs(int w, bool fs = true, QWidget* parent = 0, const char* name = 0);
~CPrefs()
{
}
+ bool hyphenate() { return layout->hyphenate->isChecked(); }
+ void hyphenate(bool _v) { layout->hyphenate->setChecked(_v); }
+ /*
+ bool customhyphen() { return layout->customhyphen->isChecked(); }
+ void customhyphen(bool _v) { layout->customhyphen->setChecked(_v); }
+ */
bool StripCR() { return layout->StripCR->isChecked(); }
+ bool repalm() { return layout->prepalm->isChecked(); }
+ bool kern() { return layout->pkern->isChecked(); }
bool Dehyphen() { return layout->Dehyphen->isChecked(); }
bool SingleSpace() { return layout->SingleSpace->isChecked(); }
bool Unindent() { return layout->Unindent->isChecked(); }
bool Reparagraph() { return layout->Reparagraph->isChecked(); }
bool DoubleSpace() { return layout->DoubleSpace->isChecked(); }
bool Remap() { return layout->Remap->isChecked(); }
bool Embolden() { return layout->Embolden->isChecked(); }
bool FullJustify() { return layout->FullJustify->isChecked(); }
+ // bool Inverse() { return layout->Inverse->isChecked(); }
+ // bool Negative() { return layout->Negative->isChecked(); }
+ bool FixGraphics() { return layout->FixGraphics->isChecked(); }
int ParaLead() { return layout2->ParaLead->value(); }
int LineLead() { return layout2->LineLead->value(); }
- int Margin() { return layout2->Margin->value(); }
+ int TopMargin() { return layout2->TopMargin->value(); }
+ int BottomMargin() { return layout2->BottomMargin->value(); }
+ int LeftMargin() { return layout2->LeftMargin->value(); }
+ int RightMargin() { return layout2->RightMargin->value(); }
int Indent() { return layout2->Indent->value(); }
int Markup() { return layout2->Markup->currentItem(); }
QString Font() { return layout2->fontselector->currentText(); }
void StripCR(bool v) { layout->StripCR->setChecked(v); }
+ void repalm(bool v) { layout->prepalm->setChecked(v); }
+ void kern(bool v) { layout->pkern->setChecked(v); }
void Dehyphen(bool v) { layout->Dehyphen->setChecked(v); }
void SingleSpace(bool v) { layout->SingleSpace->setChecked(v); }
void Unindent(bool v) { layout->Unindent->setChecked(v); }
void Reparagraph(bool v) { layout->Reparagraph->setChecked(v); }
void DoubleSpace(bool v) { layout->DoubleSpace->setChecked(v); }
void Remap(bool v) { layout->Remap->setChecked(v); }
void Embolden(bool v) { layout->Embolden->setChecked(v); }
void FullJustify(bool v) { layout->FullJustify->setChecked(v); }
+ // void Negative(bool v) { layout->Negative->setChecked(v); }
+ // void Inverse(bool v) { layout->Inverse->setChecked(v); }
+ void FixGraphics(bool v) { layout->FixGraphics->setChecked(v); }
void ParaLead(int v) { layout2->ParaLead->setValue(v); }
void LineLead(int v) { layout2->LineLead->setValue(v); }
- void Margin(int v) { layout2->Margin->setValue(v); }
+ void TopMargin(int v) { layout2->TopMargin->setValue(v); }
+ void BottomMargin(int v) { layout2->BottomMargin->setValue(v); }
+ void LeftMargin(int v) { layout2->LeftMargin->setValue(v); }
+ void RightMargin(int v) { layout2->RightMargin->setValue(v); }
void Indent(int v) { layout2->Indent->setValue(v); }
#ifdef USECOMBO
void Markup(int v) { layout2->Markup->setCurrentItem(v); }
#else
void Markup(int v) { layout2->Markup->select(v); }
#endif
#ifdef USECOMBO
+ void bgtype(int v) { misc->bgtype->setCurrentItem(v); }
+ void scrollcolor(int v) { misc->scrollcolor->setCurrentItem(v); }
+ void minibarcol(int v) { misc->minibarcol->setCurrentItem(v); }
+#else
+ void bgtype(int v) { misc->bgtype->select(v); }
+ void scrollcolor(int v) { misc->scrollcolor->select(v); }
+ void minibarcol(int v) { misc->minibarcol->select(v); }
+#endif
+ int bgtype() { return misc->bgtype->currentItem(); }
+ int scrollcolor() { return misc->scrollcolor->currentItem(); }
+ int minibarcol() { return misc->minibarcol->currentItem(); }
+
+
+#ifdef USECOMBO
+ void foreground(int v) { layout2->fgsel->setCurrentItem(v); }
+#else
+ void foreground(int v) { layout2->fgsel->select(v); }
+#endif
+ int foreground() { return layout2->fgsel->currentItem(); }
+
+#ifdef USECOMBO
+ void background(int v) { layout2->bgsel->setCurrentItem(v); }
+#else
+ void background(int v) { layout2->bgsel->select(v); }
+#endif
+ int background() { return layout2->bgsel->currentItem(); }
+
+
+
+#ifdef USECOMBO
void Font(QString& s)
{
for (int i = 1; i <= layout2->fontselector->count(); i++)
{
if (layout2->fontselector->text(i) == s)
{
layout2->fontselector->setCurrentItem(i);
break;
}
}
}
#else
void Font(QString& s) { layout2->fontselector->select(s); }
#endif
bool Depluck() { return misc->Depluck->isChecked(); }
void Depluck(bool v) { misc->Depluck->setChecked(v); }
bool Dejpluck() { return misc->Dejpluck->isChecked(); }
void Dejpluck(bool v) { misc->Dejpluck->setChecked(v); }
bool Continuous() { return misc->Continuous->isChecked(); }
void Continuous(bool v) { misc->Continuous->setChecked(v); }
bool SwapMouse() { return inter->SwapMouse->isChecked(); }
void SwapMouse(bool v) { inter->SwapMouse->setChecked(v); }
void dictApplication(const QString& v) { inter->application->setText(v); }
QString dictApplication() { return inter->application->text(); }
void dictMessage(const QString& v) { inter->message->setText(v); }
QString dictMessage() { return inter->message->text(); }
void miscannotation(bool v) { misc->annotation->setChecked(v); }
void miscdictionary(bool v) { misc->dictionary->setChecked(v); }
void miscclipboard(bool v) { misc->clipboard->setChecked(v); }
bool miscannotation() { return misc->annotation->isChecked(); }
bool miscdictionary() { return misc->dictionary->isChecked(); }
bool miscclipboard() { return misc->clipboard->isChecked(); }
-
- int spaceAction() { return button->spaceAction->currentItem(); }
-#ifdef USECOMBO
- void spaceAction(int v) { button->spaceAction->setCurrentItem(v); }
-#else
- void spaceAction(int v) { button->spaceAction->select(v); }
-#endif
- int escapeAction() { return button->escapeAction->currentItem(); }
-#ifdef USECOMBO
- void escapeAction(int v) { button->escapeAction->setCurrentItem(v); }
-#else
- void escapeAction(int v) { button->escapeAction->select(v); }
-#endif
- int returnAction() { return button->returnAction->currentItem(); }
-#ifdef USECOMBO
- void returnAction(int v) { button->returnAction->setCurrentItem(v); }
-#else
- void returnAction(int v) { button->returnAction->select(v); }
-#endif
- int leftAction() { return button->leftAction->currentItem(); }
-#ifdef USECOMBO
- void leftAction(int v) { button->leftAction->setCurrentItem(v); }
-#else
- void leftAction(int v) { button->leftAction->select(v); }
-#endif
- int rightAction() { return button->rightAction->currentItem(); }
-#ifdef USECOMBO
- void rightAction(int v) { button->rightAction->setCurrentItem(v); }
-#else
- void rightAction(int v) { button->rightAction->select(v); }
-#endif
- int upAction() { return button->upAction->currentItem(); }
-#ifdef USECOMBO
- void upAction(int v) { button->upAction->setCurrentItem(v); }
-#else
- void upAction(int v) { button->upAction->select(v); }
-#endif
- int downAction() { return button->downAction->currentItem(); }
-#ifdef USECOMBO
- void downAction(int v) { button->downAction->setCurrentItem(v); }
-#else
- void downAction(int v) { button->downAction->select(v); }
-#endif
+ /*
+ int Debounce() { return button->debounce->value(); }
+ void Debounce(int v) { button->debounce->setValue(v); }
+ */
+ /*
bool leftScroll() { return button->leftScroll->isChecked(); }
void leftScroll(bool v) { button->leftScroll->setChecked(v); }
bool rightScroll() { return button->rightScroll->isChecked(); }
void rightScroll(bool v) { button->rightScroll->setChecked(v); }
bool upScroll() { return button->upScroll->isChecked(); }
void upScroll(bool v) { button->upScroll->setChecked(v); }
bool downScroll() { return button->downScroll->isChecked(); }
void downScroll(bool v) { button->downScroll->setChecked(v); }
+ */
-
- int gfxsize() { return layout2->gfxzoom->value(); }
- void gfxsize(int v) { layout2->gfxzoom->setValue(v); }
+ int gfxsize() { return layout2->gfxzoom->value()/10; }
+ void gfxsize(int v) { layout2->gfxzoom->setValue(10*v); }
int pageoverlap() { return layout2->pageoverlap->value(); }
void pageoverlap(int v) { layout2->pageoverlap->setValue(v); }
bool twotouch() { return inter->twotouch->isChecked(); }
void twotouch(bool v) { inter->twotouch->setChecked(v); }
bool ideogram() { return inter->ideogram->isChecked(); }
void ideogram(bool v) { inter->ideogram->setChecked(v); }
int ideogramwidth() { return inter->ideogramwidth->value(); }
void ideogramwidth(int v) { inter->ideogramwidth->setValue(v); }
bool propfontchange() { return inter->propfontchange->isChecked(); }
void propfontchange(bool v) { inter->propfontchange->setChecked(v); }
int encoding() { return inter->encoding->currentItem(); }
+ int scrolltype() { return misc->scrolltype->currentItem(); }
#ifdef USECOMBO
void encoding(int v) { inter->encoding->setCurrentItem(v); }
+ void scrolltype(int v) { misc->scrolltype->setCurrentItem(v); }
#else
void encoding(int v) { inter->encoding->select(v); }
+ void scrolltype(int v) { misc->scrolltype->select(v); }
#endif
-
-
-
+ void scrollstep(int v) { misc->scrollstep->setValue(v); }
+ int scrollstep() { return misc->scrollstep->value(); }
};
#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
@@ -1,1554 +1,2986 @@
/****************************************************************************
** $Id$
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of an example program for Qt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
+const int _SBARHEIGHT = 3;
+
+#include "useqpe.h"
+#include <qpainter.h>
+//#include <qdirectpainter_qws.h>
+#include <qimage.h>
+#include <qtimer.h>
+#include "config.h"
#include "QTReader.h"
-#include "QTReaderApp.h"
+//#include "QTReaderApp.h"
+#include "CDrawBuffer.h"
#ifdef USEQPE
#include <qpe/qpeapplication.h>
#endif
#include <math.h>
#include <ctype.h>
#include <stdio.h> //for sprintf
#ifdef USEQPE
#include <qpe/config.h>
#include <qpe/applnk.h>
#include <qpe/global.h>
#include <qpe/qcopenvelope_qws.h>
#endif
+#include <qfileinfo.h>
+#include <qdir.h>
#ifdef _UNICODE
const char *QTReader::fonts[] = { "unifont", "Courier", "Times", 0 };
#else
const char *QTReader::fonts[] = { "Helvetica", "Courier", "Times", 0 };
#endif
//const int QTReader::fontsizes[] = { 8, 10, 12, 14, 18, 24, 30, 40, 50, 60, 70, 80, 90, 100, 0 };
//const tchar *QTReader::fonts[] = { "unifont", "fixed", "micro", "smoothtimes", "Courier", "Times", 0 };
//const int QTReader::fontsizes[] = {10,16,17,22,0};
//const tchar *QTReader::fonts[] = { "verdana", "Courier", "Times", 0 };
//const int QTReader::fontsizes[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,0};
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 };
tchar QTReader::jplucknextpart[] = { 'N','e','x','t',' ','P','a','r','t',' ','>','>',0 };
//tchar QTReader::jplucknextpart[] = { 10,'#',10,'N','e','x','t',' ','P','a','r','t',' ','>','>',0 };
+
QTReader::QTReader( QWidget *parent, const char *name, WFlags f) :
QWidget(parent, name, f),
+ m_default_fg(0,0,0),
+ m_default_bg(255,255,255),
+ m_bg(255,255,255),
m_delay(100),
m_scrolldy1(0),
m_scrolldy2(0),
+ m_totalscroll(0),
m_autoScroll(false),
//textarray(NULL),
//locnarray(NULL),
numlines(0),
m_fontname("unifont"),
m_fm(NULL),
mouseUpOn(true),
m_twotouch(true),
m_touchone(true),
bDoUpdates(false),
#ifdef _SCROLLPIPE
m_pipeout(NULL),
#endif
- m_border(2)
+ m_left_border(2),
+ m_right_border(2),
+ m_rotated(true),
+ pBkmklist(NULL),
+ m_scrollpos(0),
+ // bNegative(false),
+ bInverse(false),
+ m_highlightfilter(NULL),
+ m_bgIsScaled(false),
+ m_scrollstep(2),
+ m_topmargin(5),
+ m_bottommargin(5),
+ m_reparastring("{\\n[\\n ]}"),
+ m_currentlinkstyle(NULL),
+ m_currentlinkoffset(-1),
+ m_currentlink(-1)
{
m_overlap = 1;
setKeyCompression ( true );
+#ifdef DOUBLEBUFFER
+ dbuff = new QPixmap();
+ dbp = new QPainter();
+ // if (painter->isActive()) painter->end();
+ // painter->begin(frame);
+#endif
// init();
+
}
/*
QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) :
QWidget(parent, name, f),
m_textfont(0),
m_textsize(1),
textarray(NULL),
numlines(0),
bstripcr(true),
bunindent(false),
brepara(false),
bdblspce(false),
btight(false),
bindenter(0),
m_fm(NULL)
{
init();
-// // odebug << "Load_file(1)" << oendl;
+// // qDebug("Load_file(1)");
load_file((const tchar*)filename);
}
*/
/*
void QTReader::mouseMoveEvent(QMouseEvent* _e)
{
mouseUpOn = !(_e->pos().x() == -1);
- odebug << "MouseMove:[" << _e->pos().x() << ", " << _e->pos().y() << "]" << oendl;
+ qDebug("MouseMove:[%d, %d]", _e->pos().x(), _e->pos().y());
}
*/
long QTReader::real_delay()
{
- return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing );
+ return m_scrollstep*( 8976 + m_delay ) / ( m_linespacing * m_linespacing );
}
void QTReader::mousePressEvent( QMouseEvent* _e )
{
buffdoc.unsuspend();
+ int x, y, ht, wh;
+ if (m_rotated)
+ {
+ x = _e->y();
+ y = width()-_e->x();
+ ht = width();
+ wh = height();
+ }
+ else
+ {
+ x = _e->x();
+ y = _e->y();
+ ht = height();
+ wh = width();
+ }
if (_e->button() == RightButton)
{
-// odebug << "MousePress" << oendl;
+// qDebug("MousePress");
mouseUpOn = false;
if (m_swapmouse)
{
int lineno = 0;
- int ht = textarray[0]->lineSpacing();
- while ((ht < _e->y()) && (lineno < numlines))
+ /*
+ int hgt = textarray[0]->lineSpacing();
+ while ((hgt < y) && (lineno < numlines))
{
- ht += textarray[++lineno]->lineSpacing();
+ hgt += textarray[++lineno]->lineSpacing();
}
- size_t startpos, startoffset, tgt;
- getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt);
+ */
+ size_t startpos, startoffset, tgt, tgtoffset, pictgt;
+ QImage* img;
+ getcurrentpos(x, y, wh, ht, lineno, startpos, startoffset, tgt, tgtoffset, pictgt, img);
processmousewordevent(startpos, startoffset, _e, lineno);
}
else
processmousepositionevent(_e);
}
}
void QTReader::processmousepositionevent( QMouseEvent* _e )
{
+ int x, y, ht, wh;
+ if (m_rotated)
+ {
+ x = _e->y();
+ y = width()-_e->x();
+ ht = width();
+ wh = height();
+ }
+ else
+ {
+ x = _e->x();
+ y = _e->y();
+ ht = height();
+ wh = width();
+ }
if (buffdoc.hasnavigation())
{
- if (_e->y() > (2*height())/3)
+ if (y > (2*ht)/3)
{
goDown();
}
- else if (_e->y() < height()/3)
+ else if (y < ht/3)
{
goUp();
}
else
{
- if (_e->x() < width()/3)
+ if (x < wh/3)
{
goBack();
}
- else if (_e->x() > (2*width())/3)
+ else if (x > (2*wh)/3)
{
goForward();
}
else
{
goHome();
}
}
}
else
{
- if (_e->y() > height()/2)
+ if (y > ht/2)
{
goDown();
}
else
{
goUp();
}
}
}
void QTReader::goHome()
{
if (buffdoc.hasnavigation())
{
size_t current=pagelocate();
size_t home=buffdoc.getHome();
if (current!=home)
{
- buffdoc.saveposn(current);
+ buffdoc.saveposn(m_lastfile, current);
locate(home);
}
}
+ else
+ locate(0);
}
void QTReader::goBack()
{
if (buffdoc.hasnavigation())
{
size_t target = pagelocate();
- buffdoc.writeposn(target);
- if (buffdoc.back(target))
+ QString nxt = m_lastfile;
+ buffdoc.writeposn(m_lastfile, target);
+ linkType lt = buffdoc.back(nxt, target);
+ if ((lt & eFile) != 0)
+ {
+ if (nxt != m_lastfile)
+ {
+ emit NewFileRequest(nxt);
+ }
+ locate(target);
+ }
+ else if ((lt & eLink) != 0)
{
locate(target);
}
}
}
void QTReader::goForward()
{
if (buffdoc.hasnavigation())
{
size_t target = pagelocate();
- if (buffdoc.forward(target))
+ QString nxt = m_lastfile;
+ linkType lt = buffdoc.forward(nxt, target);
+ if ((lt & eFile) != 0)
+ {
+ if (nxt != m_lastfile)
+ {
+ emit NewFileRequest(nxt);
+ }
+ locate(target);
+ }
+ else if ((lt & eLink) != 0)
{
locate(target);
}
}
}
-linkType QTReader::getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt)
+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)
{
- int lineno = 0;
- int ht = textarray[0]->lineSpacing();
- while ((ht < y) && (lineno < numlines))
+ int ht;
+ if (m_scrolldy == m_topmargin)
+ {
+ lineno = 0;
+ ht = textarray[0]->lineSpacing()-m_scrolldy1 + m_topmargin;
+ }
+ else
+ {
+ if (y >= m_scrolldy)
+ {
+ lineno = 0;
+ ht = textarray[0]->lineSpacing()-m_scrolldy1+m_scrolldy + m_topmargin;
+ }
+ else
+ {
+ lineno = 0;
+ ht = textarray[0]->lineSpacing()-m_scrolldy1+m_scrolldy+m_topmargin;
+ while ((ht < h) && (lineno < numlines-1))
+ {
+ ht += textarray[++lineno]->lineSpacing();
+ }
+ ht = textarray[lineno]->lineSpacing();
+ }
+ }
+ while ((ht < y) && (lineno < numlines-1))
{
ht += textarray[++lineno]->lineSpacing();
}
+ if (ht < y && textarray[numlines]->showPartial()) lineno = numlines;
start = locnarray[lineno];
+ int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin;
if (m_bMonoSpaced)
{
- offset = (x - textarray[lineno]->offset(width(), m_border))/m_charWidth;
+ offset = (x - textarray[lineno]->offset(w, m_left_border, m_right_border, availht))/m_charWidth;
}
else
{
int i;
CDrawBuffer* t = textarray[lineno];
- x = x - t->offset(width(), m_border);
- for (i = t->length(); i >= 0 && t->width(i, true, width(), m_border) > x; i--);
+ x = x - t->offset(width(), m_left_border, m_right_border, availht);
+ for (i = t->length(); i > 0 && t->width(availht, i, true, w, m_left_border, m_right_border) > x; i--);
offset = i;
}
- return textarray[lineno]->getLinkType(offset, tgt);
+ return textarray[lineno]->getLinkType(offset, tgt, tgtoffset, pictgt, img);
}
void QTReader::suspend()
{
-#ifdef OPIE
+ buffdoc.suspend();
+ /*#ifdef OPIE
if (memcmp("/mnt/", m_lastfile.latin1(), 5) == 0) buffdoc.suspend();
#else
if (memcmp("/usr/mnt.rom/", m_lastfile.latin1(), 13) == 0) buffdoc.suspend();
#endif
+ */
}
void QTReader::setTwoTouch(bool _b)
{
- setBackgroundColor( white );
+ setBackgroundColor( m_bg );
m_twotouch = m_touchone = _b;
}
void QTReader::setContinuous(bool _b)
{
buffdoc.unsuspend();
buffdoc.setContinuous(m_continuousDocument = _b);
}
void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno)
{
+ unsigned long wrdstart, wrdend;
QString wrd;
+ int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin;
if (m_twotouch)
{
if (m_touchone)
{
m_touchone = false;
m_startpos = startpos;
m_startoffset = startoffset;
setBackgroundColor( lightGray );
}
else
{
m_touchone = true;
- setBackgroundColor( white );
+ setBackgroundColor( m_bg );
size_t endpos, endoffset;
endpos = startpos;
endoffset = startoffset;
size_t currentpos = locate();
if (endpos >= m_startpos)
{
jumpto(m_startpos);
for (int i = 0; i < m_startoffset; i++)
{
getch();
}
+ wrdstart = buffdoc.explocate();
if (m_startpos == endpos)
{
for (int i = m_startoffset; i <= endoffset; i++)
{
wrd += QChar(getch());
}
}
else
{
while (buffdoc.explocate() <= endpos)
{
wrd += QChar(getch());
}
for (int i = 0; i < endoffset; i++)
{
wrd += QChar(getch());
}
}
+ wrdend = buffdoc.explocate();
jumpto(currentpos);
}
}
}
else if (m_bMonoSpaced)
{
- int chno = (_e->x()-textarray[lineno]->offset(width(), m_border))/m_charWidth;
+ int chno = (m_rotated) ?
+ (_e->y()-textarray[lineno]->offset(height(), m_left_border, m_right_border, availht))/m_charWidth
+ :
+ (_e->x()-textarray[lineno]->offset(width(), m_left_border, m_right_border, availht))/m_charWidth;
if (chno < ustrlen(textarray[lineno]->data()))
{
wrd[0] = textarray[lineno]->data()[chno];
}
}
else
{
CDrawBuffer* t = textarray[lineno];
int first = 0;
- int tgt = _e->x() - t->offset(width(), m_border);
+ int tgt = (m_rotated) ?
+ _e->y() - t->offset(height(), m_left_border, m_right_border, availht) :
+ _e->x() - t->offset(width(), m_left_border, m_right_border, availht);
while (1)
{
int i = first+1;
+ int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin;
while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
- if (t->width(i, true, width(), m_border) > tgt)
+ if (t->width(availht, i, true, (m_rotated) ? height() : width(), m_left_border, m_right_border) > tgt)
{
wrd = toQString(t->data()+first, i - first);
-// odebug << "Got " << (const char *)wrd << "" << oendl;
+// qDebug("Got %s", (const char *)wrd);
break;
}
while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
if ((*t)[i] == 0) break;
first = i;
}
}
if (!wrd.isEmpty())
{
-// odebug << "Selected:" << wrd << "" << oendl;
- emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data()));
+ qDebug("Selecteed:%s", (const char*)wrd);
+ if (m_twotouch)
+ {
+ emit OnWordSelected(wrd, wrdstart, wrdend, wrd);
+ }
+ else
+ {
+ QString line = toQString(textarray[lineno]->data());
+ emit OnWordSelected(wrd, locnarray[lineno], locnarray[lineno]+line.length(), line);
+ }
}
}
void QTReader::mouseReleaseEvent( QMouseEvent* _e )
{
buffdoc.unsuspend();
+ int x, y, ht, wh;
+ if (m_rotated)
+ {
+ x = _e->y();
+ y = width()-_e->x();
+ ht = width();
+ wh = height();
+ }
+ else
+ {
+ x = _e->x();
+ y = _e->y();
+ ht = height();
+ wh = width();
+ }
if (_e->button() == LeftButton)
{
if (mouseUpOn)
{
-// odebug << "MouseRelease" << oendl;
- if (_e->x() > width() - m_border)
+// qDebug("MouseRelease");
+ switch(m_scrollpos)
+ {
+ case 1: // Bottom
+ if (y > ht - 5)
+ {
+ locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*x+wh/2)/wh);
+ return;
+ }
+ break;
+ case 2: // right
+ if (x > wh - m_right_border)
{
- locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height());
+ locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*y+ht/2)/ht);
return;
}
+ break;
+ case 3: // left
+ if (x < m_left_border)
+ {
+ locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*y+ht/2)/ht);
+ return;
+ }
+ break;
+ case 0:
+ default:
+ break;
+ }
if (textarray[0] != NULL)
{
QString line;
// int lineno = _e->y()/m_linespacing;
int lineno = 0;
+ /*
int ht = textarray[0]->lineSpacing();
- while ((ht < _e->y()) && (lineno < numlines))
+ while ((ht < y) && (lineno < numlines))
{
ht += textarray[++lineno]->lineSpacing();
}
- size_t startpos, startoffset, tgt;
- switch (getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt))
+ */
+ size_t startpos, startoffset, tgt, tgtoffset, pictgt;
+ QImage* img;
+ if (m_currentlinkstyle != NULL)
+ {
+ textarray[m_currentlink]->invertLink(m_currentlinkoffset);
+ m_currentlinkstyle = NULL;
+ m_currentlink = -1;
+ m_currentlinkoffset = -1;
+ }
+ linkType glt = getcurrentpos(x, y, wh, ht, lineno, startpos, startoffset, tgt, tgtoffset, pictgt, img);
+ if ((glt & eLink) != 0)
+ {
+ if ((glt & ePicture) != 0)
+ {
+ qDebug("Big Picture:%x", pictgt);
+ if (QMessageBox::warning(this, PROGNAME, "Show picture or goto link?", "Show", "Goto Link") == 0)
+ {
+ QImage* pm = buffdoc.getPicture(pictgt);
+ if (pm != NULL)
{
- case eLink:
+ emit OnShowPicture(*pm);
+ delete pm;
+ return;
+ }
+ }
+ }
+ else if (img != NULL)
{
+ if (QMessageBox::warning(this, PROGNAME, "Show picture or goto link?", "Show", "Goto Link") == 0)
+ {
+ emit OnShowPicture(*img);
+ return;
+ }
+ }
size_t saveposn = pagelocate();
- QString href;
- linkType lt = buffdoc.hyperlink(tgt, href);
- if (lt == eLink)
+ QString href, nm;
+ linkType lt = buffdoc.hyperlink(tgt, tgtoffset, href, nm);
+ qDebug("URL(1):%s", (const char*)href);
+ if ((lt & eFile) != 0)
+ {
+ buffdoc.saveposn(m_lastfile, saveposn);
+#ifdef USEQPE
+ {
+ QCopEnvelope e("QPE/System", "busy()");
+ }
+#endif
+ ResetScroll();
+ if (!href.isEmpty())
+ {
+ if (!buffdoc.getFile(href))
+ {
+ emit NewFileRequest(href);
+ }
+ else
+ {
+ ResetScroll();
+ fillbuffer();
+ update();
+ }
+ }
+ if (!nm.isEmpty())
+ {
+ qDebug("QTReader:Finding %s", (const char*)nm);
+ if (buffdoc.findanchor(nm))
+ {
+ fillbuffer();
+ update();
+ }
+ }
+ //fillbuffer();
+ //update();
+#ifdef USEQPE
+ {
+ QCopEnvelope e("QPE/System", "notBusy()");
+ }
+#endif
+ }
+ else if ((lt & eLink) != 0)
{
- buffdoc.saveposn(saveposn);
+ buffdoc.saveposn(m_lastfile, saveposn);
+ ResetScroll();
fillbuffer();
update();
}
else
{
- if (lt == ePicture)
+ if ((lt & ePicture) != 0)
{
QImage* pm = buffdoc.getPicture(tgt);
if (pm != NULL)
{
emit OnShowPicture(*pm);
delete pm;
}
}
else
{
// QString anchortext = textarray[lineno]->getanchortext(startoffset);
if (!href.isEmpty())
{
- emit OnURLSelected(href);
+ emit OnURLSelected(href, tgt);
}
}
locate(pagelocate());
}
return;
}
- case ePicture:
+ else if ((glt & ePicture) != 0)
{
-// odebug << "Picture:" << tgt << "" << oendl;
- QImage* pm = buffdoc.getPicture(tgt);
+ qDebug("Big Picture:%x", pictgt);
+ QImage* pm = buffdoc.getPicture(pictgt);
if (pm != NULL)
{
emit OnShowPicture(*pm);
delete pm;
}
else
{
locate(pagelocate());
}
return;
}
- case eNone:
- break;
- default:
-// odebug << "Unknown linktype" << oendl;
+ else if (img != NULL)
+ {
+ emit OnShowPicture(*img);
return;
}
if (m_swapmouse)
processmousepositionevent(_e);
else
processmousewordevent(startpos, startoffset, _e, lineno);
}
}
else
{
mouseUpOn = true;
}
}
}
void QTReader::focusInEvent(QFocusEvent* e)
{
if (m_autoScroll) timer->start(real_delay(), false);
update();
}
void QTReader::focusOutEvent(QFocusEvent* e)
{
if (m_autoScroll)
{
timer->stop();
// m_scrolldy1 = m_scrolldy2 = 0;
}
}
+#include <qapplication.h>
+#include <qdrawutil.h>
#ifndef _WINDOWS
#include <unistd.h>
#endif
void QTReader::goDown()
{
if (m_bpagemode)
{
dopagedn();
}
else
{
lineDown();
}
}
void QTReader::goUp()
{
if (m_bpagemode)
{
dopageup();
}
else
{
lineUp();
}
}
void QTReader::NavUp()
{
buffdoc.unsuspend();
if (buffdoc.hasnavigation())
{
/*
size_t target = pagelocate();
if (buffdoc.back(target))
{
locate(target);
}
*/
locate(buffdoc.startSection());
}
else
{
goUp();
}
}
void QTReader::NavDown()
{
buffdoc.unsuspend();
if (buffdoc.hasnavigation())
{
/*
size_t target = pagelocate();
if (buffdoc.forward(target))
{
locate(target);
}
*/
dopageup(buffdoc.endSection());
}
else
{
goDown();
}
}
void QTReader::zoomin()
{
if (m_fontControl.increasesize())
{
bool sc = m_autoScroll;
+ setautoscroll(false);
setfont();
- m_autoScroll = false;
locate(pagelocate());
- update();
- m_autoScroll = sc;
- if (m_autoScroll) autoscroll();
+ repaint();
+ setautoscroll(sc);
}
}
void QTReader::zoomout()
{
if (m_fontControl.decreasesize())
{
bool sc = m_autoScroll;
- m_autoScroll = false;
+ setautoscroll(false);
setfont();
locate(pagelocate());
- update();
- m_autoScroll = sc;
- if (m_autoScroll) autoscroll();
+ repaint();
+ setautoscroll(sc);
}
}
void QTReader::reduceScroll()
{
if (m_delay < 59049)
{
m_delay = (3*m_delay)/2;
timer->changeInterval(real_delay());
}
else
{
m_delay = 59049;
}
}
void QTReader::increaseScroll()
{
- if (m_delay > 1024)
+ if (m_delay > 454)
{
m_delay = (2*m_delay)/3;
timer->changeInterval(real_delay());
}
else
{
- m_delay = 1024;
+ m_delay = 454;
}
}
void QTReader::keyPressEvent(QKeyEvent* e)
{
buffdoc.unsuspend();
- ((QTReaderApp*)parent()->parent())->handlekey(e);
+
+ //((QTReaderApp*)parent()->parent())->handlekey(e);
+ emit HandleKeyRequest(e);
// e->ignore();
return;
#ifdef _SCROLLPIPE
if (m_isPaused)
{
m_isPaused = false;
if (e->key() != Key_Space)
{
m_autoScroll = false;
if (m_pipeout != NULL)
{
pclose(m_pipeout);
m_pipeout = NULL;
}
- ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
+ //((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
+ emit SetScrollState(m_autoScroll);
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
else
{
timer->start(real_delay(), false);
}
e->accept();
return;
}
#endif
-/*
- switch (e->key())
- {
- case Key_Down:
- {
- e->accept();
- if (m_autoScroll)
- {
- if (m_delay < 59049)
- {
- m_delay = (3*m_delay)/2;
- timer->changeInterval(real_delay());
}
- else
+
+void QTReader::CalculateScrollParameters()
{
- m_delay = 59049;
- }
- }
- else
+ int bmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0);
+ if (bmargin < m_bottommargin) bmargin = m_bottommargin;
+ switch (m_scrolltype)
{
- goDown();
- }
- }
- break;
- case Key_Up:
+ case 0:
{
- e->accept();
- if (m_autoScroll)
+ if (m_scrolldy == m_topmargin)
{
- if (m_delay > 1024)
- {
- m_delay = (2*m_delay)/3;
- timer->changeInterval(real_delay());
+ m_scrolldy1 = 0;
+ m_scrolldy2 = 0;
+ m_totalscroll = 0;
+ return;
}
- else
+ if (m_scrolldy < textarray[0]->lineSpacing())
{
- m_delay = 1024;
- }
+ m_scrolldy2 = m_scrolldy;
+ return;
}
- else
+ int ht = m_scrolldy - m_scrolldy1;
+ int i;
+ for (i = 0; (ht < ((m_rotated) ? width() : height())-bmargin) && (i < numlines); i++)
{
- goUp();
+ ht += textarray[i]->lineSpacing();
}
- }
- break;
- case Key_Right:
- {
- e->accept();
- if (m_navkeys && buffdoc.hasnavigation())
- {
- size_t target = pagelocate();
- if (buffdoc.forward(target))
+ ht = 0;
+ int j;
+ i--;
+ for (j = i; j < numlines; j++)
{
- locate(target);
- }
+ ht += textarray[j]->lineSpacing();
}
- else zoomin();
+ ht -= (
+ textarray[i]->lineExtraSpacing()
+ +
+ (i != 0) ? textarray[numlines-1]->lineExtraSpacing() : 0
+ )/2-2;
+
+ m_scrolldy2 = m_scrolldy-ht;
}
break;
- case Key_Left:
- {
- e->accept();
- if (m_navkeys && buffdoc.hasnavigation())
+ case 1:
+ case 2:
+ case 3:
{
- size_t target = pagelocate();
- if (buffdoc.back(target))
+ int ypos = m_topmargin;
+ for (int i = 0; i < numlines; i++)
{
- locate(target);
- }
+ ypos += textarray[i]->lineSpacing();
}
- else zoomout();
+ ypos -= (
+ textarray[0]->lineExtraSpacing()
+ +
+ ((numlines > 1) ? textarray[numlines-1]->lineExtraSpacing() : 0)
+ )/2 +
+ m_scrolldy1 - 2;
+ m_scrolldy2 = ((m_rotated) ? width() : height()) - ypos - bmargin;
}
break;
- default:
- e->ignore();
}
-*/
}
void QTReader::setautoscroll(bool _sc)
{
if (_sc == m_autoScroll) return;
if (m_autoScroll)
{
m_autoScroll = false;
#ifdef USEQPE
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
#endif
#ifdef _SCROLLPIPE
if (m_pipeout != NULL)
{
pclose(m_pipeout);
m_pipeout = NULL;
}
#endif
+ // m_scrolldy1 = 0;
+ //refresh();
}
else
{
CDrawBuffer* reusebuffer = textarray[numlines];
if (reusebuffer == NULL || reusebuffer->eof()) return;
m_autoScroll = true;
+ CalculateScrollParameters();
+
#ifdef _SCROLLPIPE
if (!m_pipetarget.isEmpty())
{
-// odebug << "Opening pipe to " << m_pipetarget << "" << oendl;
+// qDebug("Opening pipe to %s", (const char*)m_pipetarget);
m_pipeout = popen((const char*)m_pipetarget, "w");
m_isPaused = false;
}
#endif
autoscroll();
#ifdef USEQPE
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; // light is even not dimmed
#endif
}
}
bool QTReader::getline(CDrawBuffer *buff)
{
buffdoc.unsuspend();
+ bool bRet;
+ int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin;
if (m_bMonoSpaced)
{
- return buffdoc.getline(buff ,width(), m_charWidth, m_border);
+ bRet = buffdoc.getline(buff ,(m_rotated) ? height() : width(), m_charWidth, m_left_border, m_right_border, availht);
}
else
{
- return buffdoc.getline(buff, width(), m_border);
+ bRet = buffdoc.getline(buff, (m_rotated) ? height() : width(), m_left_border, m_right_border, hyphenate, availht);
}
+ buff->resize(availht);
+ return bRet;
}
void QTReader::doscroll()
{
if (!m_autoScroll)
{
timer->stop();
return;
}
-// timer->changeInterval(real_delay());
- QPainter p( this );
- QBrush b( white);
- bitBlt(this,0,0,this,0,1,width(),-1);
- qDrawPlainRect(&p,0,height() - 2,width(),2,white,1,&b);
+ switch (m_scrolltype)
+ {
+ case 0:
+ doinplacescroll();
+ break;
+ case 1:
+ dorollingscroll(false);
+ break;
+ case 2:
+ dorollingscroll(true);
+ break;
+ case 3:
+ dostaticscroll();
+ break;
+ }
+}
- if (++m_scrolldy1 == textarray[0]->lineSpacing())
+void QTReader::doinplacescroll()
+{
+ QPainter p( this );
+ // p.setBackgroundMode(OpaqueMode);
+ int wh, ht;
+ int bmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0);
+ if (bmargin < m_bottommargin) bmargin = m_bottommargin;
+ if (m_rotated)
+ {
+ ht = width()-bmargin;
+ wh = height();
+ }
+ else
{
+ ht = height()-bmargin;
+ wh = width();
+ }
+ int lastdy = m_scrolldy;
+ m_scrolldy += m_scrollstep;
+ if ((m_scrolldy1 = m_scrolldy1+m_scrollstep) >= textarray[0]->lineSpacing())
+ {
+ int ht = textarray[0]->lineSpacing();
#ifdef _SCROLLPIPE
if (m_pipeout != NULL)
{
QString outstr = toQString(textarray[0]->data());
if (!outstr.isEmpty())
{
fprintf(m_pipeout, "%s\n", (const char*)outstr);
fflush(m_pipeout);
}
else if (m_pauseAfterEachPara)
{
m_isPaused = true;
timer->stop();
}
-// write(m_pipeout, (const char*)outstr, outstr.length());
-// write(m_pipeout, "\n", 1);
-// fputc(10, m_pipeout);
}
#endif
CDrawBuffer* buff = textarray[0];
for (int i = 1; i <= numlines; i++)
{
textarray[i-1] = textarray[i];
locnarray[i-1] = locnarray[i];
}
textarray[numlines] = buff;
--numlines;
- m_scrolldy1 = 0;
+ m_scrolldy1 -= ht;
+ }
+ if ((m_scrolldy2 = m_scrolldy2+m_scrollstep) >= textarray[numlines]->lineSpacing())
+ {
+ m_scrolldy2 -= textarray[numlines]->lineSpacing();
+ numlines++;
+
+ if (textarray[numlines] == NULL)
+ {
+ textarray[numlines] = new CDrawBuffer(&m_fontControl);
+ }
+ locnarray[numlines] = locate();
+ int ch = getline(textarray[numlines]);
+ if (m_rotated)
+ {
+ blitRot(width()-m_scrolldy, 0, height(), -1, textarray[numlines-1]);
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(m_left_border,m_scrolldy-textarray[numlines-1]->lineSpacing(),width()-(m_left_border+m_right_border),textarray[numlines-1]->lineSpacing(),m_bg);
+ }
+ else
+ {
+ int h_tmp = textarray[numlines-1]->lineSpacing();
+ 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);
+ }
+ 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);
+ }
+ mylastpos = locate();
+ if (!ch)
+ {
+ /*
+ if (m_rotated)
+ {
+ blitRot2(0,0,height(),width()-m_scrolldy,NULL);
+// blitRot2(0,0,0,height(),width()-m_scrolldy,NULL);
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(0,m_scrolldy,width(),height()-m_scrolldy,m_bg);
+ }
+ else
+ {
+ bitBlt(this, 0, m_scrolldy, dbuff, 0, m_scrolldy, width(), height()-m_scrolldy);
+ }
}
- if (++m_scrolldy2 == textarray[numlines]->lineSpacing())
+ */
+ m_scrolldy = m_topmargin;
+ m_autoScroll = false;
+#ifdef _SCROLLPIPE
+ for (int i = 0; i < numlines; i++)
+ {
+ if (m_pipeout != NULL)
{
+ QString outstr = toQString(textarray[i]->data());
+ if (!outstr.isEmpty())
+ {
+ fprintf(m_pipeout, "%s\n", (const char*)outstr);
+ fflush(m_pipeout);
+ }
+ }
+ }
+#endif
+ //((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
+ emit SetScrollState(m_autoScroll);
+#ifdef USEQPE
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+#endif
+ }
+ if (m_scrolldy > ht-textarray[numlines]->lineSpacing())
+ {
+ if (m_rotated)
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(bmargin, m_left_border, ht-m_scrolldy, wh-(m_left_border+m_right_border), m_bg);
+ }
+ else
+ {
+ blitRot(bmargin, 0,height(), ht-m_scrolldy, NULL);
+ }
+ }
+ else
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(m_left_border,m_scrolldy,width()-(m_left_border+m_right_border),height()-m_scrolldy,m_bg);
+ }
+ else
+ {
+ bitBlt(this,m_left_border,m_scrolldy,dbuff,m_left_border,m_scrolldy,width()-(m_left_border+m_right_border), height()-m_scrolldy);
+ }
+ m_scrolldy = m_topmargin;
m_scrolldy2 = 0;
+ }
+ redrawScroll(&p);
+ emitRedraw();
+ lastdy = -1;
+ }
+ // else
+ {
+ if (m_rotated)
+ {
+ if (lastdy >= 0)
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(width()-lastdy, m_left_border, m_scrollstep, wh-(m_left_border+m_right_border),m_bg);
+ }
+ else
+ {
+ blitRot(width()-lastdy,m_left_border,wh-(m_left_border+m_right_border), m_scrollstep, NULL);
+ }
+ }
+ p.fillRect(width()-m_scrolldy, m_left_border, 1,wh-(m_left_border+m_right_border),m_scrollcolor);
+ }
+ else
+ {
+ if (lastdy >= 0)
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(m_left_border,lastdy,width()-(m_left_border+m_right_border),m_scrollstep,m_bg);
+ }
+ else
+ {
+ bitBlt(this, m_left_border, lastdy, dbuff, m_left_border, lastdy, width()-(m_left_border+m_right_border), m_scrollstep);
+ }
+ }
+ p.fillRect(m_left_border,m_scrolldy,width()-(m_left_border+m_right_border),1,m_scrollcolor);
+ }
+ }
+}
+
+void QTReader::dorollingscroll(bool _statbord)
+{
+ bool bredrawscroll = false;
+ QPainter p( this );
+ // 2 = right, 3 = left
+ int tmargin = (_statbord) ? m_topmargin : 0;
+ int lmargin = (m_scrollpos == 3 || _statbord) ? m_left_border : 0;
+ int rmargin = (m_scrollpos == 2 || _statbord) ? m_right_border : 0;
+ int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0);
+ if (hmargin < m_bottommargin) hmargin = m_bottommargin;
+ if (m_rotated)
+ {
+ m_totalscroll = (m_totalscroll+m_scrollstep) % width();
+ bitBlt(this, m_scrollstep+hmargin, lmargin, this, hmargin, lmargin, width()-tmargin-hmargin, height()-(lmargin+rmargin));
+ if (!m_bgpm.isNull())
+ {
+ blitRot(hmargin, tmargin, height(), m_scrollstep, NULL);
+ }
+ else
+ {
+ p.fillRect(hmargin, rmargin, m_scrollstep, height()-lmargin-rmargin, m_bg);
+ }
+ }
+ else
+ {
+ m_totalscroll = (m_totalscroll+m_scrollstep) % height();
+ bitBlt(this,lmargin,tmargin,this,lmargin,tmargin+m_scrollstep,width()-(lmargin+rmargin),height() - tmargin - hmargin - m_scrollstep);
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(0, height() - (m_scrollstep+1) - hmargin, width(), (m_scrollstep+1), m_bg);
+ }
+ else
+ {
+ int loff = (_statbord) ? 0 : m_totalscroll;
+ bitBlt(this,0,height() - (m_scrollstep+1) - hmargin, dbuff, 0, (loff+height() - (m_scrollstep+1) - hmargin) % height(), width(), (m_scrollstep+1));
+ }
+ }
+
+ if ((m_scrolldy1 = m_scrolldy1+m_scrollstep) >= textarray[0]->lineSpacing())
+ {
+ int ht = textarray[0]->lineSpacing();
+ bredrawscroll = true;
+#ifdef _SCROLLPIPE
+ if (m_pipeout != NULL)
+ {
+ QString outstr = toQString(textarray[0]->data());
+ if (!outstr.isEmpty())
+ {
+ fprintf(m_pipeout, "%s\n", (const char*)outstr);
+ fflush(m_pipeout);
+ }
+ else if (m_pauseAfterEachPara)
+ {
+ m_isPaused = true;
+ timer->stop();
+ }
+ }
+#endif
+ CDrawBuffer* buff = textarray[0];
+ for (int i = 1; i <= numlines; i++)
+ {
+ textarray[i-1] = textarray[i];
+ locnarray[i-1] = locnarray[i];
+ }
+ textarray[numlines] = buff;
+ --numlines;
+ m_scrolldy1 -= ht;
+ }
+ if ((m_scrolldy2 = m_scrolldy2+m_scrollstep) >= textarray[numlines]->lineSpacing())
+ {
+ bredrawscroll = true;
+ m_scrolldy2 -= textarray[numlines]->lineSpacing();
numlines++;
if (textarray[numlines] == NULL)
{
textarray[numlines] = new CDrawBuffer(&m_fontControl);
}
locnarray[numlines] = locate();
int ch = getline(textarray[numlines]);
- textarray[numlines-1]->render(&p, height() - textarray[numlines-1]->descent() - 2, m_bMonoSpaced, m_charWidth, width(), m_border);
+ if (m_rotated)
+ {
+ blitRot(hmargin, 0, height(), -1, textarray[numlines-1]);
+ }
+ else
+ {
+ // 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);
+ 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);
+
+ }
mylastpos = locate();
if (!ch)
{
+ redrawScroll(&p);
+ emitRedraw();
m_autoScroll = false;
#ifdef _SCROLLPIPE
for (int i = 0; i < numlines; i++)
{
if (m_pipeout != NULL)
{
QString outstr = toQString(textarray[i]->data());
if (!outstr.isEmpty())
{
fprintf(m_pipeout, "%s\n", (const char*)outstr);
fflush(m_pipeout);
}
}
}
#endif
- ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
+ emit SetScrollState(m_autoScroll);
#ifdef USEQPE
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
#endif
+ return;
}
- emit OnRedraw();
}
+ if (!bredrawscroll && ((m_scrolldy2/m_scrollstep) % 10 == 5) && textarray[numlines]->showPartial())
+ {
+ if (m_rotated)
+ {
+ blitRot(hmargin + m_scrolldy2 - textarray[numlines]->lineSpacing(), 0, height(), -1, textarray[numlines]);
+ }
+ else
+ {
+ 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);
+ }
+ }
+ if (m_scrollpos != 0)
+ {
+ redrawScroll(&p);
+ }
+ if (bredrawscroll) emitRedraw();
+}
+
+void QTReader::dostaticscroll()
+{
+ redrawall();
+ bool bredraw = false;
+ if ((m_scrolldy1 = m_scrolldy1+m_scrollstep) >= textarray[0]->lineSpacing())
+ {
+ int ht = textarray[0]->lineSpacing();
+ bredraw = true;
+#ifdef _SCROLLPIPE
+ if (m_pipeout != NULL)
+ {
+ QString outstr = toQString(textarray[0]->data());
+ if (!outstr.isEmpty())
+ {
+ fprintf(m_pipeout, "%s\n", (const char*)outstr);
+ fflush(m_pipeout);
+ }
+ else if (m_pauseAfterEachPara)
+ {
+ m_isPaused = true;
+ timer->stop();
+ }
+ }
+#endif
+ CDrawBuffer* buff = textarray[0];
+ for (int i = 1; i <= numlines; i++)
+ {
+ textarray[i-1] = textarray[i];
+ locnarray[i-1] = locnarray[i];
+ }
+ textarray[numlines] = buff;
+ --numlines;
+ m_scrolldy1 -= ht;
+ }
+ if ((m_scrolldy2 = m_scrolldy2 + m_scrollstep) >= textarray[numlines]->lineSpacing())
+ {
+ bredraw = true;
+ m_scrolldy2 -= textarray[numlines]->lineSpacing();
+ numlines++;
+
+ if (textarray[numlines] == NULL)
+ {
+ textarray[numlines] = new CDrawBuffer(&m_fontControl);
+ }
+ locnarray[numlines] = locate();
+ int ch = getline(textarray[numlines]);
+ mylastpos = locate();
+ if (!ch)
+ {
+ redrawall();
+ emitRedraw();
+ m_autoScroll = false;
+#ifdef _SCROLLPIPE
+ for (int i = 0; i < numlines; i++)
+ {
+ if (m_pipeout != NULL)
+ {
+ QString outstr = toQString(textarray[i]->data());
+ if (!outstr.isEmpty())
+ {
+ fprintf(m_pipeout, "%s\n", (const char*)outstr);
+ fflush(m_pipeout);
+ }
+ }
+ }
+#endif
+ emit SetScrollState(m_autoScroll);
+#ifdef USEQPE
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+#endif
+ return;
+ }
+ }
+ if (bredraw) emitRedraw();
+}
+
+void QTReader::redrawScroll(QPainter* p)
+{
+ int offset = (m_scrolltype == 1) ? m_totalscroll : 0;
+ switch (m_scrollpos)
+ {
+ case 1:
+ {
+ int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0);
+ if (hmargin < m_bottommargin) hmargin = m_bottommargin;
+ if (m_rotated)
+ {
+ if (m_bgpm.isNull())
+ {
+ p->fillRect(0,0,hmargin,height(),m_bg);
+ }
+ else
+ {
+ blitRot(0,0, height(), hmargin, NULL);
+ }
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p->fillRect(0,height() - hmargin,width(),hmargin,m_bg);
+ }
+ else
+ {
+ int toffset = (offset+height()-hmargin) % height();
+ if (toffset+hmargin > height())
+ {
+ int fp = height()-toffset;
+ bitBlt(this,
+ 0,height() - hmargin,
+ dbuff,
+ 0, toffset, width(), fp);
+ bitBlt(this,
+ 0,height()-hmargin+fp,
+ dbuff,
+ 0, 0, width(), hmargin-fp);
+ }
+ else
+ {
+ bitBlt(this,
+ 0,height() - hmargin,
+ dbuff,
+ 0, toffset, width(), hmargin);
+ }
+ }
+ }
+ }
+ break;
+ case 2: //right
+ if (m_rotated)
+ {
+ if (m_bgpm.isNull())
+ {
+ p->fillRect(0,height()-m_right_border,width(),m_right_border,m_bg);
+ }
+ else
+ {
+ blitRot(0,height()-m_right_border, m_right_border, width(), NULL);
+ }
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p->fillRect(width()-m_right_border,0,m_right_border,height(),m_bg);
+ }
+ else
+ {
+ int x = width() - m_right_border;
+ int fp = height()-offset;
+ bitBlt(this, x, 0, dbuff, x, offset, m_right_border, fp);
+ bitBlt(this, x, fp, dbuff, x, 0, m_right_border, height()-fp);
+ }
+ }
+ break;
+ case 3: //left
+ if (m_rotated)
+ {
+ if (m_bgpm.isNull())
+ {
+ p->fillRect(0,0,width(),m_left_border,m_bg);
+ }
+ else
+ {
+ blitRot(0,0, m_left_border, width(), NULL);
+ }
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p->fillRect(0,0,m_left_border,height(),m_bg);
+ }
+ else
+ {
+ int fp = height()-offset;
+ bitBlt(this, 0, 0, dbuff, 0, offset, m_left_border, fp);
+ bitBlt(this, 0, fp, dbuff, 0, 0, m_left_border, height()-fp);
+ }
+ }
+ break;
+ case 0:
+ default:
+ break;
+ }
+ if (m_scrollpos != 0) DrawScroll(p, width(), height());
}
void QTReader::autoscroll()
{
+ drawBackground();
+ dbp->end();
timer->start(real_delay(), false);
}
void QTReader::setfont()
{
// m_fontControl.Change
m_charWidth = (m_charpc*m_fontControl.currentsize())/100;
if (m_charWidth <= 0) m_charWidth = 1;
m_ascent = m_fontControl.ascent();
m_descent = m_fontControl.descent();
m_linespacing = m_fontControl.lineSpacing();
}
-void QTReader::drawFonts( QPainter *p )
+void QTReader::DrawStraight(QPainter* p, int w, int h)
+{
+ if (m_scrolldy == m_topmargin)
+ {
+ int ypos = textarray[0]->ascent()-m_scrolldy1+m_topmargin;
+ textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin);
+ int i;
+ for (i = 1; i < numlines; i++)
+ {
+ ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+
+ (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2;
+ textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin);
+ }
+ if (textarray[i]->showPartial())
+ {
+ ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+
+ (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2;
+ textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin);
+ }
+ }
+ else
+ {
+ int ypos = textarray[0]->ascent()-m_scrolldy1+m_scrolldy+m_topmargin;
+ textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin);
+ // p->fillRect(m_border, 0, w-2*m_border, m_scrolldy, m_bg);
+ for (int i = 1; i < numlines; i++)
+ {
+ ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+
+ (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2;
+ if (ypos+textarray[i]->descent() > h)
+ {
+ ypos = textarray[i]->ascent();
+ }
+ textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, w, m_left_border, m_right_border, m_bg, h-m_topmargin-m_bottommargin);
+ }
+ p->fillRect(m_left_border,m_scrolldy,w-(m_left_border+m_right_border),1,m_scrollcolor);
+ }
+ bool wasrotated = m_rotated;
+ m_rotated = false;
+ DrawScroll(p, w, h);
+ m_rotated = wasrotated;
+
+}
+
+void QTReader::redrawall()
+{
+ if (m_rotated)
+ {
+#ifdef DOUBLEBUFFER
+ drawBackground();
+ DrawStraight(dbp, height(), width());
+ dbp->end();
+
+ QWMatrix m;
+ m.rotate(90);
+ QPixmap rp = dbuff->xForm(m);
+ bitBlt(this, 0,0,&rp,0,0,-1,-1);
+#else
+ QPixmap dbuff(height(), width());
+ QPainter dbp(&dbuff);
+ // dbp.setBackgroundMode(OpaqueMode);
+ dbp.fillRect(dbuff.rect(), m_bg);
+
+ DrawStraight(&dbp, height(), width());
+
+ QWMatrix m;
+ m.rotate(90);
+ QPixmap rp = dbuff.xForm(m);
+ bitBlt(this, 0,0,&rp,0,0,-1,-1);
+#endif
+ }
+ else
+ {
+#ifdef DOUBLEBUFFER
+ drawBackground();
+ DrawStraight(dbp, width(), height());
+ dbp->end();
+ bitBlt(this, 0,0,dbuff,0,0,-1,-1);
+#else
+ DrawStraight(p, width(), height());
+#endif
+ }
+}
+
+void QTReader::drawFonts()
{
if (bDoUpdates)
{
-// odebug << "How refreshing..." << oendl;
+ int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0);
+ if (hmargin < m_bottommargin) hmargin = m_bottommargin;
+// qDebug("How refreshing...");
if (buffdoc.empty()) return;
setfont();
+ // if (!m_autoScroll) m_scrolldy1 = 0;
+#ifdef ROTATION_ENABLED
+ if (m_lastwidth != ((m_rotated) ? height() : width()))
+ {
+ m_scrolldy = m_topmargin;
+ // qDebug("Not Optimised %d", m_lastwidth);
+ m_lastwidth = ((m_rotated) ? height() : width());
+ m_lastheight = ((m_rotated) ? width() : height());
+ buffdoc.setwidth(m_lastwidth-(m_left_border+m_right_border));
+ locate(pagelocate());
+ // qDebug("Not Optimised %d", m_lastwidth);
+ }
+ else
+ {
+ int newht = ((m_rotated) ? width() : height());
+ if (m_lastheight > newht)
+ {
+ // qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht);
+ m_scrolldy = m_topmargin;
+ int ypos = m_scrolldy1+m_topmargin;
+ for (int i = 0; i < numlines; i++)
+ {
+ if ((ypos += textarray[i]->lineSpacing()) > newht - hmargin)
+ {
+ numlines = i;
+ jumpto(mylastpos = locnarray[i+1]);
+ break;
+ }
+ }
+ // qDebug("Optimised < %d", numlines);
+ m_lastheight = newht;
+ }
+ else if (m_lastheight < newht)
+ {
+ m_scrolldy = m_topmargin;
+ // qDebug("Optimised > %d", numlines);
+ int ypos = m_scrolldy1+m_topmargin;
+ for (int i = 0; i <= numlines; i++)
+ {
+ ypos += textarray[i]->lineSpacing();
+ }
+ fillbuffer(numlines+1, ypos, newht);
+ // qDebug("Optimised > %d", numlines);
+ }
+ if (numlines > 0)
+ {
+ redrawall();
+ }
+ }
+#else
if (m_lastwidth != width())
{
-// odebug << "Not Optimised " << m_lastwidth << "" << oendl;
+ // qDebug("Not Optimised %d", m_lastwidth);
m_lastwidth = width();
m_lastheight = height();
- buffdoc.setwidth(m_lastwidth-2*m_border);
+ buffdoc.setwidth(m_lastwidth-(m_left_border+m_right_border));
locate(pagelocate());
-// odebug << "Not Optimised " << m_lastwidth << "" << oendl;
+// qDebug("Not Optimised %d", m_lastwidth);
}
else
{
int newht = height();
if (m_lastheight > newht)
{
-// odebug << "Optimised < " << numlines << " " << m_lastheight << " " << newht << "" << oendl;
- int ypos = 0;
+// qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht);
+ int ypos = m_topmargin;
for (int i = 0; i < numlines; i++)
{
- if ((ypos += textarray[i]->lineSpacing()) > newht)
+ if ((ypos += textarray[i]->lineSpacing()) > newht - hmargin)
{
numlines = i;
jumpto(mylastpos = locnarray[i+1]);
break;
}
}
-// odebug << "Optimised < " << numlines << "" << oendl;
+// qDebug("Optimised < %d", numlines);
m_lastheight = newht;
}
else if (m_lastheight < newht)
{
-// odebug << "Optimised > " << numlines << "" << oendl;
- int ypos = 0;
+// qDebug("Optimised > %d", numlines);
+ int ypos = m_topmargin;
for (int i = 0; i <= numlines; i++)
{
ypos += textarray[i]->lineSpacing();
}
fillbuffer(numlines+1, ypos, newht);
-// odebug << "Optimised > " << numlines << "" << oendl;
+// qDebug("Optimised > %d", numlines);
}
if (numlines > 0)
{
- int ypos = textarray[0]->ascent();
- textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border);
+ int ypos = textarray[0]->ascent()+m_topmargin;
+ textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin);
// int last = (m_showlast) ? numlines : numlines-1;
// for (int i = 1; i <= last; i++)
for (int i = 1; i < numlines; i++)
{
// ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2;
ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+
(textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2;
- textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border);
+ textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin);
}
// mylastpos = locate();
}
}
+#endif
+ emitRedraw();
+ }
+/*
+ else
+ {
+ qDebug("Not so refreshing...");
+ }
+*/
+}
- m_scrolldy1 = m_scrolldy2 = m_scrollpart;
- if (m_border > 5 && !buffdoc.empty())
+void QTReader::DrawScroll( QPainter *p, int _w, int _h )
+{
+ if (!buffdoc.empty())
+ {
+ QBrush checkered = QBrush( Dense4Pattern );
+ checkered.setColor(m_scrollbarcolor);
+ switch (m_scrollpos)
+ {
+ case 1:
+ if (m_rotated)
+ {
+ p->fillRect(0, 0, 2, _h, checkered);
+ }
+ else
+ {
+ p->fillRect(0, _h-2, _w, 2, checkered);
+ }
+ break;
+ case 2:
+ if (m_rotated)
+ {
+ p->fillRect(0, _h-2, _w, 2, checkered);
+ }
+ else
+ {
+ p->fillRect(_w-2, 0, 2, _h, checkered);
+ }
+ break;
+ case 3:
+ if (m_rotated)
+ {
+ p->fillRect(0, 0, _w, 2, checkered);
+ }
+ else
+ {
+ p->fillRect(0, 0, 2, _h, checkered);
+ }
+ break;
+ case 0:
+ default:
+ break;
+ }
+ switch (m_scrollpos)
{
- p->fillRect(width()-2, 0, 2, height(), cyan);
+ case 1:
+ {
+ int ht;
+ if (m_rotated)
+ {
+ ht = _h;
+ }
+ else
+ {
+ ht = _w;
+ }
int sectionsize = (buffdoc.endSection()-buffdoc.startSection());
- int mid = (height()*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize);
- p->fillRect(width()-2, mid-5, 2, 10, yellow);
- p->fillRect(width()-2, (height()*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*height()+sectionsize/2)/sectionsize, magenta);
+ int mid = (ht*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize);
+ int sliderheight = ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize;
+ int sliderpos;
+ if (sliderheight < 10)
+ {
+ sliderheight = 10;
+ sliderpos = mid-5;
}
-
- emit OnRedraw();
+ else
+ {
+ sliderpos = (ht*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize;
+ }
+ if (m_rotated)
+ {
+ p->fillRect(0, sliderpos, 3, sliderheight, m_scrollbarcolor);
}
-/*
else
{
- odebug << "Not so refreshing..." << oendl;
+ p->fillRect(sliderpos, _h-3, sliderheight, 3, m_scrollbarcolor);
+ }
+ }
+ break;
+ case 2:
+ case 3:
+ {
+ int ht;
+ if (m_rotated)
+ {
+ ht = _w;
+ }
+ else
+ {
+ ht = _h;
+ }
+ int sectionsize = (buffdoc.endSection()-buffdoc.startSection());
+ int mid = (ht*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize);
+ int sliderheight = ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize;
+ int sliderpos;
+ if (sliderheight < 10)
+ {
+ sliderheight = 10;
+ sliderpos = mid-5;
+ }
+ else
+ {
+ sliderpos = (ht*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize;
+ }
+ if (m_rotated)
+ {
+ int hoff;
+ if (m_scrollpos == 2) //right
+ {
+ hoff = _h-3;
+ }
+ else
+ {
+ hoff = 0;
+ }
+ p->fillRect(ht-sliderpos-sliderheight, hoff, sliderheight, 3, m_scrollbarcolor);
+ }
+ else
+ {
+ int hoff;
+ if (m_scrollpos == 2) //right
+ {
+ hoff = _w-3;
+ }
+ else
+ {
+ hoff = 0;
+ }
+ p->fillRect(hoff, sliderpos, 3, sliderheight, m_scrollbarcolor);
+ }
+ }
+ break;
+ case 0:
+ default:
+ break;
+ }
}
-*/
}
+/*
+void QTReader::DrawScroll( QPainter *p )
+{
+ if (m_border > 5 && !buffdoc.empty())
+ {
+ int ht, wh;
+ if (m_rotated)
+ {
+ ht = width();
+ wh = height()g;
+ p->fillRect(0, wh-2, ht, 2, cyan);
+ }
+ else
+ {
+ ht = height();
+ wh = width();
+ p->fillRect(wh-2, 0, 2, ht, cyan);
+ }
+ int sectionsize = (buffdoc.endSection()-buffdoc.startSection());
+ int mid = (ht*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize);
+ if (m_rotated)
+ {
+ p->fillRect(ht-mid-5, wh-2, 10, 2, yellow);
+ p->fillRect(ht-(ht*(locnarray[numlines]-buffdoc.startSection())+sectionsize/2)/sectionsize, wh-2, ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize, 2, magenta);
+ }
+ else
+ {
+ p->fillRect(wh-2, mid-5, 2, 10, yellow);
+ p->fillRect(wh-2, (ht*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*ht+sectionsize/2)/sectionsize, magenta);
+ }
+ }
+}
+*/
QString QTReader::firstword()
{
if (m_bMonoSpaced)
{
return toQString(textarray[0]->data());
}
else
{
int start, end, len, j;
for (j = 0; j < numlines; j++)
{
len = textarray[j]->length();
for (start = 0; start < len && !isalpha((*textarray[j])[start]); start++);
if (start < len) break;
}
if (j < numlines)
{
QString ret = "";
for (end = start; end < len && isalpha((*textarray[j])[end]); end++)
ret += (*textarray[j])[end];
if (ret.isEmpty()) ret = "Current position";
return ret;
}
else
return "Current position";
}
}
//
// Construct the QTReader with buttons.
//
bool QTReader::ChangeFont(int tgt)
{
return m_fontControl.ChangeFont(m_fontname, tgt);
}
void QTReader::init()
{
-// m_showlast = true;
- // setCaption( "Qt Draw Demo Application" );
-
buffdoc.unsuspend();
- setBackgroundColor( white );
-// QPainter p(this);
-// p.setBackgroundMode( Qt::OpaqueMode );
+ setBackgroundColor( m_bg );
buffdoc.setfilter(getfilter());
ChangeFont(m_textsize);
setFocusPolicy(QWidget::StrongFocus);
- // resize( 240, 320 );
- //setFocus();
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(doscroll()));
// QMessageBox::information(this, "init", m_lastfile, 1);
setfont();
-/*
- if (!m_lastfile.isEmpty())
- {
- m_string = DocLnk(m_lastfile).name();
- load_file(m_lastfile);
- }
-*/
}
//
// Clean up
//
QTReader::~QTReader()
{
+#ifdef DOUBLEBUFFER
+ delete dbuff;
+ delete dbp;
+#endif
#ifdef USEQPE
if (m_autoScroll)
{
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
#ifdef _SCROLLPIPE
if (m_pipeout != NULL)
{
fclose(m_pipeout);
}
#endif
}
//
-// Calls the drawing function as specified by the radio buttons.
-//
-
-void QTReader::drawIt( QPainter *p )
-{
- drawFonts(p);
-}
-
-//
// Called when the print button is clicked.
//
/*
void QTReader::printIt()
{
#ifndef QT_NO_PRINTER
if ( printer->setup( this ) ) {
QPainter paint;
if ( !paint.begin( printer ) )
return;
drawIt( &paint );
}
#endif
}
*/
//
// Called when the widget needs to be updated.
//
void QTReader::paintEvent( QPaintEvent * )
{
- QPainter paint( this );
- drawIt( &paint );
+ drawFonts();
}
//
// Called when the widget has been resized.
// Moves the button group to the upper right corner
// of the widget.
/*
void QTReader::resizeEvent( QResizeEvent * )
{
-// // odebug << "resize:(" << width() << "," << height() << ")" << oendl;
+// // qDebug("resize:(%u,%u)", width(), height());
// bgroup->move( width()-bgroup->width(), 0 );
}
*/
//
// Create and display our widget.
//
/*
int main( int argc, tchar **argv )
{
QApplication app( argc, argv );
QTReader draw;
app.setMainWidget( &draw );
draw.setCaption("Qt Example - Drawdemo");
draw.show();
return app.exec();
}
*/
bool QTReader::locate(unsigned long n) {
//printf("Locate\n");
buffdoc.unsuspend();
buffdoc.locate(n);
-// // odebug << "&buffdoc.located" << oendl;
+// // qDebug("&buffdoc.located");
+ ResetScroll();
fillbuffer();
-// // odebug << "&Buffer filled" << oendl;
+// // qDebug("&Buffer filled");
update();
-// // odebug << "&Located" << oendl;
+// // qDebug("&Located");
+ emitRedraw();
return true;
}
unsigned int QTReader::screenlines()
{
// int linespacing = (tight) ? m_ascent : m_ascent+m_descent;
// return (height()-m_descent)/(m_linespacing);
return (height()-2)/(m_linespacing);
};
bool QTReader::fillbuffer(int reuse, int ht, int newht)
{
buffdoc.unsuspend();
+ int hmargin = ((m_scrollpos == 1) ? _SBARHEIGHT : 0);
+ if (hmargin < m_bottommargin) hmargin = m_bottommargin;
+ if (ht < 0) ht = m_topmargin;
if (buffdoc.empty()) return false;
if (newht < 0)
- m_lastheight = height();
+ m_lastheight = (m_rotated) ? width() : height();
else
m_lastheight = newht;
int ch;
bool ret = false;
unsigned int oldpagepos = locnarray[reuse];
int lastypos = ht, ypos = ht;
numlines = reuse;
- while (ypos < m_lastheight || numlines < 2)
+ while (ypos < m_lastheight - hmargin || numlines < 2)
{
lastypos = ypos;
if (textarray[numlines] == NULL)
{
textarray[numlines] = new CDrawBuffer(&m_fontControl);
}
locnarray[numlines] = locate();
int ch = getline(textarray[numlines]);
ypos += textarray[numlines]->lineSpacing();
numlines++;
if (!ch)
{
if (numlines - reuse == 1 /*&& locnarray[numlines] == buffdoc.locate()*/)
{
+ qDebug("FALSE");
locate(oldpagepos);
return false;
}
else
{
+ qDebug("TRUE");
--numlines;
mylastpos = locate();
return true;
}
}
+ if (numlines > 1 && textarray[numlines-2]->isBop())
+ {
+ --numlines;
+ mylastpos = locate();
+ return true;
+ }
}
--numlines;
mylastpos = locate();
- m_scrolldy1 = m_scrolldy2 = m_scrollpart = m_lastheight - lastypos;
-
+ m_scrollpart = m_lastheight - lastypos - hmargin;
+ if (m_autoScroll)
+ {
+ CalculateScrollParameters();
+ }
return true;
}
void QTReader::dopagedn()
{
-// odebug << "HEIGHT(2):" << m_lastheight << "" << oendl;
+// qDebug("HEIGHT(2):%d", m_lastheight);
buffdoc.unsuspend();
- int skip = 0, ypos = 0;
+ ResetScroll();
+ int skip = 0, ypos = m_topmargin;
if (locate() != mylastpos)
{
-//// odebug << "Jumping to " << mylastpos << "" << oendl;
jumpto(mylastpos);
}
CDrawBuffer* reusebuffer = textarray[numlines];
- if (reusebuffer != NULL && reusebuffer->eof()) return;
if (reusebuffer != NULL)
{
+ if (reusebuffer->eof()) return;
for (int i = 0; i <= m_overlap; i++)
{
int offset = numlines - m_overlap + i;
reusebuffer = textarray[offset];
size_t reuselocn = locnarray[offset];
textarray[offset] = textarray[i];
textarray[i] = reusebuffer;
// reusebuffer->empty();
locnarray[offset] = locnarray[i];
locnarray[i] = reuselocn;
ypos += textarray[i]->lineSpacing();
skip++;
}
}
+ if (numlines <= 1)
+ {
+ skip = 0;
+ ypos = 0;
+ qDebug("Doing extra skip");
+ }
if (fillbuffer(skip, ypos))
{
- update();
+ drawFonts();
}
}
void QTReader::dopageup()
{
- buffdoc.unsuspend();
dopageup(locnarray[(m_overlap < numlines) ? m_overlap : numlines/2]);
}
bool QTReader::synch(size_t start, size_t end)
{
jumpto(start);
while (start++ < end)
{
tchar ch = getch();
if (ch == 10) return true;
if (ch == UEOF) return false;
+ if (ch == 6) return false;
}
return false;
}
void QTReader::dopageup(unsigned int target)
{
buffdoc.unsuspend();
+ ResetScroll();
CBufferFace<CDrawBuffer*> buff;
CBufferFace<size_t> loc;
size_t delta, guess = 2*(locate()-pagelocate()), lastdelta = 0;
bool ch = true;
- int nbfl, ypos = 0;
+ int nbfl, ypos = m_topmargin;
if (guess < 128) guess = 128;
while (1)
{
+ // qDebug("Guess:%u", guess);
+
ch = true;
if (target < guess)
{
delta = 0; // 0 is a flag to say don't guess any more
jumpto( (m_continuousDocument) ? 0 : buffdoc.startSection() );
}
else if (!m_continuousDocument && (target - guess < buffdoc.startSection()))
{
delta = 0; // 0 is a flag to say don't guess any more
jumpto(buffdoc.startSection());
}
else
{
delta = guess;
if (!synch(target-delta, target-lastdelta))
{
lastdelta = delta;
if (guess < 4000)
{
guess <<= 1;
continue;
}
else
{
jumpto(target-delta);
}
}
}
nbfl = 0;
- ypos = 0;
+ ypos = m_topmargin;
while (locate() < target)
{
if (buff[nbfl] == NULL) buff[nbfl] = new CDrawBuffer(&m_fontControl);
loc[nbfl] = locate();
ch = getline(buff[nbfl]);
ypos += buff[nbfl]->lineSpacing();
nbfl++;
if (!ch) break;
}
- if (guess < 4000 && ypos < height() && (delta != 0))
+ if (guess < 4000 && ypos < ((m_rotated) ? width() : height())-(m_bottommargin) && (delta != 0))
{
for (int i = 0; i < nbfl; i++)
{
delete buff[i];
buff[i] = NULL;
}
guess <<= 1;
continue;
}
break;
}
if (ch)
{
if (buff[nbfl] == NULL) buff[nbfl] = new CDrawBuffer(&m_fontControl);
loc[nbfl] = locate();
int ch = getline(buff[nbfl]);
nbfl++;
}
/*
ypos = 0;
numlines = 0;
while (ypos < height() && numlines <= nbfl-1)
{
ypos += buff[nbfl - numlines - 1]->lineSpacing();
numlines++;
}
--numlines;
*/
- ypos = 0;
+ ypos = m_topmargin;
numlines = 0;
- while (ypos < height() && numlines+2 <= nbfl)
+ while (ypos < ((m_rotated) ? width() : height())-m_bottommargin && numlines+2 <= nbfl)
{
ypos += buff[nbfl - numlines - 2]->lineSpacing();
numlines++;
}
if (numlines > 0) --numlines;
if (numlines == 0 && nbfl > 1) numlines = 1;
int offset = nbfl-1;
offset -= numlines;
- ypos = 0;
+ ypos = m_topmargin;
for (int i = 0; i <= numlines; i++)
{
delete textarray[i];
textarray[i] = buff[offset+i];
locnarray[i] = loc[offset + i];
ypos += textarray[i]->lineSpacing();
}
#ifdef _WINDOWS
for (i = 0; i < nbfl - numlines - 1; i++)
#else
for (int i = 0; i < nbfl - numlines - 1; i++)
#endif
{
delete buff[i];
}
- while (ypos < height())
+ while (ypos < ((m_rotated) ? width() : height())-m_bottommargin)
{
numlines++;
locnarray[numlines] = locate();
if (textarray[numlines] == NULL) textarray[numlines] = new CDrawBuffer(&m_fontControl);
if (!getline(textarray[numlines])) break;
ypos += textarray[numlines]->lineSpacing();
}
mylastpos = locate();
-
- update();
+ CalculateScrollParameters();
+ drawFonts();
+ // repaint();
}
bool QTReader::load_file(const char *newfile, unsigned int _lcn)
{
// QMessageBox::information(this, "Name", name, 1);
// QMessageBox::information(this, "load_file", newfile, 1);
-
+ int prog = 0;
bool bRC = false;
unsigned int lcn = _lcn;
+ ResetScroll();
if (m_lastfile == newfile)
{
lcn = m_lastposn;
}
// QMessageBox::information(0, "Opening...", newfile);
+ if (m_rotated)
+ {
+ m_lastwidth = height();
+ m_lastheight = width();
+ }
+ else
+ {
m_lastwidth = width();
m_lastheight = height();
+ }
if (buffdoc.openfile(this,newfile) == 0)
{
m_lastfile = newfile;
- buffdoc.setwidth(m_lastwidth-2*m_border);
+ buffdoc.setwidth(m_lastwidth-(m_left_border+m_right_border));
bRC = true;
buffdoc.setContinuous(m_continuousDocument);
-// // odebug << "buffdoc.openfile done" << oendl;
+ qDebug("buffdoc.openfile done");
locate(lcn);
-// // odebug << "buffdoc.locate done" << oendl;
+ qDebug("buffdoc.locate done");
}
setfilter(getfilter());
- update();
-// // odebug << "Updated" << oendl;
+ qDebug("Updated");
return bRC;
}
void QTReader::lineDown()
{
- int ypos = 0;
+ int ypos = m_topmargin;
+ ResetScroll();
int offset = numlines;
for (int i = 0; i <= numlines; i++)
{
- if ((ypos += textarray[numlines-i]->lineSpacing()) > height())
+ if ((ypos += textarray[numlines-i]->lineSpacing()) > ((m_rotated) ? width() : height()))
{
offset = i-1;
break;
}
}
offset = numlines - offset;
#ifdef _WINDOWS
for (i = offset; i <= numlines; i++)
#else
for (int i = offset; i <= numlines; i++)
#endif
{
CDrawBuffer* buff = textarray[i-offset];
textarray[i-offset] = textarray[i];
locnarray[i-offset] = locnarray[i];
textarray[i] = buff;
}
numlines = numlines - offset + 1;
locnarray[numlines] = locate();
if (textarray[numlines] == NULL)
{
textarray[numlines] = new CDrawBuffer(&m_fontControl);
}
getline(textarray[numlines]);
mylastpos = locate();
update();
}
/*
void QTReader::lineUp()
{
CBuffer** buff = textarray;
unsigned int *loc = new unsigned int[numlines];
int cbptr = 0;
if (locate() != mylastpos) jumpto(mylastpos);
unsigned int target = locnarray[numlines-1];
if (buffdoc.hasrandomaccess())
{
unsigned int delta = locate()-pagelocate();
if (delta < 64) delta = 64;
do
{
delta <<= 1;
if (delta >= target)
{
delta = target;
jumpto(0);
for (int i = 0; i < numlines; i++)
{
loc[i] = locate();
getline(buff[i]);
}
break;
}
jumpto(target-delta);
do
{
buffdoc.getline(buff[0],width());
#ifdef WS
//printf("Trying:%s\n",buff[0]);
#endif
if (locate() > target) continue;
}
while (!buffdoc.iseol());
for (int i = 0; i < numlines; i++)
{
loc[i] = locate();
buffdoc.getline(buff[i],width());
#ifdef WS
//printf("Filling:%s\n",buff[i]);
#endif
}
}
while (locate() >= target && delta < 4096);
#ifdef WS
//printf("Delta:%u\n",delta);
#endif
}
else
{
jumpto(0);
for (int i = 0; i < numlines; i++)
{
loc[i] = locate();
buffdoc.getline(buff[i],width());
}
}
cbptr = 0;
while (locate() < target)
{
loc[cbptr] = locate();
buffdoc.getline(buff[cbptr], width());
#ifdef WS
//printf("Adding:%s\n",buff[cbptr]->data());
#endif
cbptr = (cbptr+1) % numlines;
}
pagepos = loc[cbptr];
textarray = new CBuffer*[numlines];
for (int i = 0; i < numlines; i++)
{
int j = (cbptr+i)%numlines;
textarray[i] = buff[j];
locnarray[i] = loc[j];
}
delete [] buff;
delete [] loc;
mylastpos = locate();
update();
}
*/
+
+void QTReader::ResetScroll()
+{
+ m_totalscroll = 0;
+ m_scrolldy1 = 0;
+ m_scrolldy = m_topmargin;
+ if (m_autoScroll && ((m_scrolltype == 0) || !m_bgpm.isNull()))
+ {
+ setautoscroll(false);
+ }
+}
+
void QTReader::lineUp()
{
+ dopageup(locnarray[numlines-1]);
+
+ /*
buffdoc.unsuspend();
+ ResetScroll();
+
CDrawBuffer* buff = textarray[numlines];
unsigned int loc;
unsigned int end = locnarray[numlines];
int cbptr = 0;
if (locate() != mylastpos) jumpto(mylastpos);
unsigned int target = locnarray[0];
if (target == 0) return;
if (!m_continuousDocument && (target == buffdoc.startSection())) return;
if (buffdoc.hasrandomaccess())
{
unsigned int delta = locate()-pagelocate();
if (delta < 64) delta = 64;
do
{
delta <<= 1;
if (delta >= target)
{
delta = target;
jumpto(0);
loc = locate();
getline(buff);
break;
}
else if (!m_continuousDocument && (target - delta < buffdoc.startSection()))
{
delta = target-buffdoc.startSection();
jumpto(buffdoc.startSection());
loc = locate();
getline(buff);
break;
}
jumpto(target-delta);
do
{
getline(buff);
#ifdef WS
//printf("Trying:%s\n",buff[0]);
#endif
if (locate() > target) continue;
}
while (!buffdoc.iseol());
loc = locate();
getline(buff);
}
while (locate() >= target && delta < 4096);
}
else
{
jumpto(0);
loc = locate();
getline(buff);
}
cbptr = 0;
while (locate() < target)
{
loc = locate();
getline(buff);
}
for (int i = numlines; i > 0; i--)
{
textarray[i] = textarray[i-1];
locnarray[i] = locnarray[i-1];
}
textarray[0] = buff;
locnarray[0] = loc;
int start = numlines;
- int ypos = 0;
+ int ypos = m_topmargin;
#ifdef _WINDOWS
for (i = 0; i <= numlines; i++)
#else
for (int i = 0; i <= numlines; i++)
#endif
{
ypos += textarray[i]->lineSpacing();
- if (ypos > height())
+ if (ypos > ((m_rotated) ? width() : height()))
{
start = i;
ypos -= textarray[i]->lineSpacing();
break;
}
}
jumpto(locnarray[start]);
fillbuffer(start, ypos);
- update();
+ repaint();
+ */
}
bool QTReader::empty()
{
return buffdoc.empty();
}
MarkupType QTReader::PreferredMarkup()
{
MarkupType m = buffdoc.PreferredMarkup();
if (m == cTEXT)
{
int ext = m_lastfile.findRev('.');
if (ext >= 0)
{
QString ft = m_lastfile.right(m_lastfile.length()-ext-1).upper();
if (ft.left(3) == "HTM")
{
m = cHTML;
}
}
}
return m;
}
+#ifdef DOUBLEBUFFER
+void QTReader::resizeEvent( QResizeEvent * p )
+{
+ if (m_rotated)
+ {
+ dbuff->resize(p->size().height(),p->size().width());
+ }
+ else
+ {
+ dbuff->resize(p->size());
+ }
+ m_bgIsScaled = false;
+ if (m_bgtype == bgStretched)
+ {
+ emit RefreshBitmap();
+ }
+
+ {
+ int h, w;
+ if (m_rotated)
+ {
+ h = p->size().width();
+ w = p->size().height();
+ }
+ else
+ {
+ w = p->size().width();
+ h = p->size().height();
+ }
+ m_topmargin = (h*m_abstopmargin+500)/1000;
+ m_bottommargin = (h*m_absbottommargin+500)/1000;
+ m_left_border = (w*m_absleft_border+500)/1000;
+ m_right_border = (w*m_absright_border+500)/1000;
+
+ qDebug("Top margin:%u", m_topmargin );
+ qDebug("Bottom margin:%u", m_bottommargin );
+ qDebug("Left margin:%u", m_left_border );
+ qDebug("Right margin:%u", m_right_border );
+ }
+}
+#endif
+
+void QTReader::setrotated(bool sfs)
+{
+ m_rotated = sfs;
+#ifdef DOUBLEBUFFER
+ if (m_rotated)
+ {
+ dbuff->resize(height(), width());
+ }
+ else
+ {
+ dbuff->resize(width(), height());
+ }
+ m_bgIsScaled = false;
+#endif
+ int h, w;
+ if (m_rotated)
+ {
+ h = width();
+ w = height();
+ }
+ else
+ {
+ w = width();
+ h = height();
+ }
+ m_topmargin = (h*m_abstopmargin+500)/1000;
+ m_bottommargin = (h*m_absbottommargin+500)/1000;
+ m_left_border = (w*m_absleft_border+500)/1000;
+ m_right_border = (w*m_absright_border+500)/1000;
+
+ qDebug("Top margin:%u", m_topmargin );
+ qDebug("Bottom margin:%u", m_bottommargin );
+ qDebug("Left margin:%u", m_left_border );
+ qDebug("Right margin:%u", m_right_border );
+}
+
+void QTReader::drawBackground()
+{
+ dbp->begin(dbuff);
+ // dbp->setBackgroundMode(OpaqueMode);
+ dbp->setBackgroundColor(m_bg);
+ dbp->eraseRect(dbuff->rect());
+ if (!m_bgpm.isNull())
+ {
+ // dbp->setBackgroundMode(TransparentMode);
+ switch (m_bgtype)
+ {
+ case bgCentred:
+ {
+ int w = (dbuff->rect().width()-m_bgpm.width())/2;
+ int h = (dbuff->rect().height()-m_bgpm.height())/2;
+ dbp->drawPixmap(w,h,m_bgpm);
+ }
+ break;
+ case bgTiled:
+ {
+ dbp->drawTiledPixmap(0,0,dbuff->rect().width(),dbuff->rect().height(),m_bgpm);
+ /*
+ for (int h = 0; h < dbuff->rect().height(); h += m_bgpm.height())
+ {
+ for (int w = 0; w < dbuff->rect().width(); w += m_bgpm.width())
+ {
+ dbp->drawPixmap(w,h,m_bgpm);
+ }
+ }
+ */
+ }
+ break;
+ case bgStretched:
+ {
+ if (!m_bgIsScaled)
+ {
+ m_bgIsScaled = true;
+ QImage im = m_bgpm.convertToImage();
+ m_bgpm.convertFromImage(im.smoothScale(dbuff->rect().width(), dbuff->rect().height()));
+ }
+ dbp->drawPixmap(0,0,m_bgpm);
+ }
+ break;
+ default:
+ qDebug("Unknown background type");
+ }
+ // dbp->setBackgroundMode(OpaqueMode);
+ }
+}
+
+void QTReader::blitRot(int dx, int dy, int sw, int sh, CDrawBuffer* txt)
+{
+ if (txt != NULL)
+ {
+ sh = txt->lineSpacing();
+ }
+ int sy = width()-dx-sh;
+ if (m_autoScroll && !(m_scrolltype == 0))
+ {
+ sy = (sy+m_totalscroll+1)%width();
+ }
+
+ QPixmap pm(sw, sh);
+
+ QPainter pd(&pm, this);
+ if (m_bgpm.isNull())
+ {
+ pd.eraseRect(pm.rect());
+ }
+ else
+ {
+ if (sy+pm.height() > dbuff->height())
+ {
+ // pd.eraseRect(pm.rect());
+ int fh = dbuff->height() - sy;
+ if (sy+fh > dbuff->height())
+ {
+ qDebug("Oh no!");
+ }
+
+ if (fh > pm.height())
+ {
+ qDebug("Oh no! - 2");
+ }
+
+ bitBlt(&pm,0,0,dbuff,dy,sy,pm.width(),fh);
+ bitBlt(&pm,0,fh,dbuff,dy,0,pm.width(),pm.height()-fh);
+ }
+ else
+ {
+ bitBlt(&pm,0,0,dbuff,dy,sy,pm.width(),pm.height());
+ }
+ }
+ if (txt != NULL)
+ {
+ // txt->render(&pd, txt->lineSpacing() - txt->descent() - txt->lineExtraSpacing(), m_bMonoSpaced, m_charWidth, sw, m_left_border, m_right_border, m_bg);
+ 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);
+ }
+ QWMatrix m;
+ m.rotate(90);
+ QPixmap rp = pm.xForm(m);
+ /*
+ p.drawPixmap(QPoint(dx, dy), rp);
+ */
+ bitBlt(this, dx, dy, &rp, 0, 0, -1, -1, CopyROP);
+}
+
+QString QTReader::about()
+{
+ return QString("QTReader widget (c) Tim Wentford\n")+buffdoc.about() + "\nMini-scrollbar by Markus Gritsch\nNavigation History fixes by Frantisek Dufka";
+}
+
+void QTReader::getNextLink()
+{
+ if (m_scrolldy != 0)
+ {
+ setautoscroll(false);
+ ResetScroll();
+ redrawall();
+ }
+ bool redraw = false;
+ bool found = false;
+ if (m_currentlink >= 0)
+ {
+ m_currentlinkoffset = textarray[m_currentlink]->invertLink(m_currentlinkoffset);
+ if ((m_currentlinkstyle = textarray[m_currentlink]->getNextLink(m_currentlinkoffset)) != NULL)
+ {
+ qDebug("Found a link at %u", m_currentlinkoffset);
+ int offset = textarray[m_currentlink]->invertLink(m_currentlinkoffset);
+ qDebug("Finishes at %u", offset);
+ found = true;
+ }
+ redraw = true;
+ drawSingleLine(m_currentlink);
+ // if (found) return;
+ }
+ if (!found)
+ {
+ m_currentlinkoffset = -1;
+ for (int i = m_currentlink+1; i < numlines; ++i)
+ {
+ if ((m_currentlinkstyle = textarray[i]->getNextLink(m_currentlinkoffset)) != NULL)
+ {
+ m_currentlink = i;
+ qDebug("Found a link at %u", m_currentlinkoffset);
+ int offset = textarray[m_currentlink]->invertLink(m_currentlinkoffset);
+ qDebug("Finishes at %u", offset);
+ //drawSingleLine(i);
+ redraw = true;
+ found = true;
+ drawSingleLine(m_currentlink);
+ break;
+ }
+ }
+ }
+ if (redraw)
+ {
+ // redrawall();
+ }
+ if (!found)
+ {
+ m_currentlink = -1;
+ m_currentlinkstyle = NULL;
+ m_currentlinkoffset = -1;
+ dopagedn();
+ }
+}
+
+void QTReader::emitRedraw()
+{
+ m_currentlinkstyle = NULL;
+ m_currentlink = -1;
+ m_currentlinkoffset = -1;
+ emit OnRedraw();
+};
+
+void QTReader::drawSingleLine(int lineno)
+{
+ QPainter p( this );
+ int ypos = textarray[0]->ascent()+m_topmargin;
+ if (lineno == 0)
+ {
+ if (m_rotated)
+ {
+ blitRot(width()-(ypos+textarray[lineno]->descent()+textarray[lineno]->lineExtraSpacing()), 0, height(), -1, textarray[lineno]);
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(m_left_border,ypos-textarray[lineno]->ascent(),width()-(m_left_border+m_right_border),textarray[lineno]->lineSpacing(),m_bg);
+ }
+ else
+ {
+ 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());
+ }
+ textarray[lineno]->render( &p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin);
+ }
+ }
+ for (int i = 1; i < numlines; i++)
+ {
+ ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+
+ (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2;
+ if (i == lineno)
+ {
+ if (m_rotated)
+ {
+ blitRot(width()-(ypos+textarray[i]->descent()+textarray[i]->lineExtraSpacing()), 0, height(), -1, textarray[i]);
+ }
+ else
+ {
+ if (m_bgpm.isNull())
+ {
+ p.fillRect(m_left_border,ypos-textarray[lineno]->ascent(),width()-(m_left_border+m_right_border),textarray[lineno]->lineSpacing(),m_bg);
+ }
+ else
+ {
+ 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());
+ }
+ textarray[i]->render( &p, ypos, m_bMonoSpaced, m_charWidth, width(), m_left_border, m_right_border, m_bg, height()-m_topmargin-m_bottommargin);
+ }
+ }
+ }
+}
+
+
+void QTReader::gotoLink()
+{
+ if (m_currentlinkstyle == NULL) return;
+ textarray[m_currentlink]->invertLink(m_currentlinkoffset);
+ size_t saveposn = pagelocate();
+ QString href, nm;
+ unsigned long tgt = m_currentlinkstyle->getData();
+ unsigned long tgtoffset = m_currentlinkstyle->getOffset();
+ linkType lt = buffdoc.hyperlink(tgt, tgtoffset, href, nm);
+ qDebug("URL(1):%s", (const char*)href);
+ if ((lt & eFile) != 0)
+ {
+ buffdoc.saveposn(m_lastfile, saveposn);
+#ifdef USEQPE
+ {
+ QCopEnvelope e("QPE/System", "busy()");
+ }
+#endif
+ ResetScroll();
+ if (!href.isEmpty())
+ {
+ if (!buffdoc.getFile(href))
+ {
+ emit NewFileRequest(href);
+ }
+ else
+ {
+ ResetScroll();
+ fillbuffer();
+ update();
+ }
+ }
+ if (!nm.isEmpty())
+ {
+ qDebug("QTReader:Finding %s", (const char*)nm);
+ if (buffdoc.findanchor(nm))
+ {
+ fillbuffer();
+ update();
+ }
+ }
+ //fillbuffer();
+ //update();
+#ifdef USEQPE
+ {
+ QCopEnvelope e("QPE/System", "notBusy()");
+ }
+#endif
+ }
+ else if ((lt & eLink) != 0)
+ {
+ buffdoc.saveposn(m_lastfile, saveposn);
+ ResetScroll();
+ fillbuffer();
+ update();
+ }
+ else
+ {
+ if ((lt & ePicture) != 0)
+ {
+ QImage* pm = buffdoc.getPicture(tgt);
+ if (pm != NULL)
+ {
+ emit OnShowPicture(*pm);
+ delete pm;
+ }
+ }
+ else
+ {
+ // QString anchortext = textarray[lineno]->getanchortext(startoffset);
+ if (!href.isEmpty())
+ {
+ emit OnURLSelected(href, tgt);
+ }
+ }
+ locate(pagelocate());
+ }
+ m_currentlinkstyle = NULL;
+ m_currentlink = -1;
+ m_currentlinkoffset = -1;
+}
+
+void QTReader::refresh(bool full)
+{
+ int h, w;
+ if (m_rotated)
+ {
+ h = width();
+ w = height();
+ }
+ else
+ {
+ w = width();
+ h = height();
+ }
+ m_topmargin = (h*m_abstopmargin+500)/1000;
+ m_bottommargin = (h*m_absbottommargin+500)/1000;
+ m_left_border = (w*m_absleft_border+500)/1000;
+ m_right_border = (w*m_absright_border+500)/1000;
+
+ qDebug("Top margin:%u", m_topmargin );
+ qDebug("Bottom margin:%u", m_bottommargin );
+ qDebug("Left margin:%u", m_left_border );
+ qDebug("Right margin:%u", m_right_border );
+ if (full && m_highlightfilter) m_highlightfilter->refresh(pagelocate());
+ locate(pagelocate());
+}
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,272 +1,416 @@
#ifndef __QTREADER_H
#define __QTREADER_H
//#define _SCROLLPIPE
-
+#include "static.h"
#include <qwidget.h>
//#include <qpainter.h>
#include "my_list.h"
#include "BuffDoc.h"
#include "FontControl.h"
//#include <qtimer.h>
class CDrawBuffer;
//class CBuffer;
+#include <qpixmap.h>
class QPainter;
class QTimer;
-class QPixmap;
+class QImage;
+
+#include "BGType.h"
+#include "striphtml.h"
+
+#define ROTATION_ENABLED
+#define SPECIALSCROLL
+#define DOUBLEBUFFER
+#ifdef DOUBLEBUFFER
+class QPainter;
+#endif
+
+class CStyle;
class QTReader : public QWidget
{
Q_OBJECT
+ friend class QTReaderApp;
+#ifdef DOUBLEBUFFER
+ QPixmap *dbuff;
+ QPainter* dbp;
+#endif
+ void drawSingleLine(int lineno);
+ void gotoLink();
+ void emitRedraw();
+ CStyle* m_currentlinkstyle;
+ int m_currentlink;
+ int m_currentlinkoffset;
+ QPixmap m_bgpm;
+ bool m_bgIsScaled;
+ bground m_bgtype;
+ int m_scrollpos;
+ unsigned short m_scrollstep;
+ void blitRot(int dx, int sx, int sw, int sh, CDrawBuffer* txt);
+ void setBackgroundBitmap(const QPixmap& _pm, bground bg)
+ {
+ m_bgpm = _pm;
+ m_bgtype = bg;
+ m_bgIsScaled = false;
+ }
+ QColor m_bg, m_default_bg, m_default_fg, m_negative_fg;
static tchar pluckernextpart[];
static tchar jplucknextpart[];
- friend class QTReaderApp;
- void suspend();
+ CList<Bkmk>* pBkmklist;
+ void setHyphenThreshold(int _v) { buffdoc.setHyphenThreshold(_v); }
+ void ResetScroll();
void increaseScroll();
void reduceScroll();
void drawText(QPainter& p, int x, int y, tchar* text);
- int m_delay;
+ void DrawScroll( QPainter *p, int w, int h );
+ void dorollingscroll(bool);
+ void doinplacescroll();
+ void dostaticscroll();
+ void suspend();
+ void redrawScroll(QPainter* p);
+ int m_delay, m_scrolltype;
unsigned int m_overlap;
bool m_autoScroll, m_swapmouse;
+ void drawBackground();
+#ifdef ROTATION_ENABLED
+ bool m_rotated;
+ void setrotated(bool);
+#endif
void autoscroll();
QTimer* timer;
- int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart;
+ int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart, m_totalscroll;
void focusInEvent(QFocusEvent*);
void focusOutEvent(QFocusEvent*);
void processmousepositionevent( QMouseEvent* _e );
void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno);
bool ChangeFont(int);
bool getline(CDrawBuffer*);
int m_charWidth;
int m_charpc;
- unsigned char m_border;
+ unsigned short m_absleft_border, m_absright_border;
+ unsigned short m_left_border, m_right_border;
FontControl m_fontControl;
void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); }
unsigned char getBaseSize() { return m_fontControl.getBaseSize(); }
#ifdef _SCROLLPIPE
FILE* m_pipeout;
QString m_pipetarget;
bool m_isPaused;
bool m_pauseAfterEachPara;
#endif
public:
QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0);
// QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0);
~QTReader();
+ QString about();
+ CList<Bkmk>* Bkmklist() { return pBkmklist; }
+ void setBackground(const QColor& _c)
+ {
+ m_default_bg = _c;
+ reset_bg();
+ }
+ void setForeground(const QColor& _c)
+ {
+ m_default_fg = _c;
+ int r,g,b;
+ m_default_fg.rgb(&r, &g, &b);
+ r = 255-r;
+ g = 255-g;
+ b = 255-b;
+ m_negative_fg.setRgb(r,g,b);
+ }
void zoomin();
void zoomout();
void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
{
buffdoc.setSaveData(data, len, src, srclen);
}
void putSaveData(unsigned char*& src, unsigned short& srclen)
{
buffdoc.putSaveData(src, srclen);
}
bool empty();
void setContinuous(bool _b);
void toggle_autoscroll();
void setautoscroll(bool);
void disableAutoscroll() { m_autoScroll = false; }
void copy()
{
/*
size_t nd = locate();
jumpto(m_mark);
QString text;
while (m_mark < nd)
{
text += buffdoc.getch();
m_mark++;
}
QApplication::clipboard()->setText(text);
jumpto(nd);
*/
};
void clear() {};
void setText(const QString& n, const QString& s) { m_string = n; load_file((const char*)s); };
/*
void setText(bool oldfile)
{
if (oldfile)
{
m_string = m_lastfile;
load_file((const tchar*)m_string);
}
else
{
m_string = QString::null;
}
};
*/
void setlead(int _lead)
{
m_fontControl.setlead(_lead);
}
int getlead()
{
return m_fontControl.getlead();
}
void setextraspace(int _lead)
{
m_fontControl.setextraspace(_lead);
}
int getextraspace()
{
return m_fontControl.getextraspace();
}
void setpagemode(bool _b)
{
m_bpagemode = _b;
}
void setmono(bool _b)
{
m_bMonoSpaced = _b;
ChangeFont(m_fontControl.currentsize());
locate(pagelocate());
}
void setencoding(int _f)
{
m_encd = _f;
setfilter(getfilter());
}
MarkupType PreferredMarkup();
CEncoding* getencoding()
{
-// odebug << "m_encd:" << m_encd << oendl;
+// qDebug("m_encd:%d", m_encd);
switch (m_encd)
{
case 4:
-// odebug << "palm" << oendl;
+// qDebug("palm");
return new CPalm;
case 1:
-// odebug << "utf8" << oendl;
+// qDebug("utf8");
return new CUtf8;
case 2:
-// odebug << "ucs16be" << oendl;
+// qDebug("ucs16be");
return new CUcs16be;
case 3:
-// odebug << "ucs16le" << oendl;
+// qDebug("ucs16le");
return new CUcs16le;
case 0:
-// odebug << "ascii" << oendl;
+// qDebug("ascii");
return new CAscii;
default:
return new CGeneral8Bit(m_encd-MAX_ENCODING+1);
}
}
+ HighlightFilter* m_highlightfilter;
CFilterChain* getfilter()
{
CFilterChain * filt = new CFilterChain(getencoding());
if (bstripcr) filt->addfilter(new stripcr);
if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt);
if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter);
- if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml);
+ // if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile));
+
+#ifdef __STATIC
+ if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile));
+ if (bautofmt && (PreferredMarkup() == cCHM))
+ {
+ filt->addfilter(new striphtml(m_lastfile));
+ }
+#else
+ if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new ExternFilter("HTMLfilter", m_lastfile));
+ if (bautofmt && (PreferredMarkup() == cCHM))
+ {
+ ExternFilter* f = new ExternFilter("HTMLfilter",m_lastfile);
+ ((striphtml*)f->filter())->setchm(true);
+ filt->addfilter(f);
+ }
+#endif
+ m_highlightfilter = new HighlightFilter(this);
+ filt->addfilter(m_highlightfilter);
if (bdehyphen) filt->addfilter(new dehyphen);
if (bunindent) filt->addfilter(new unindent);
- if (brepara) filt->addfilter(new repara);
+ if (brepara) filt->addfilter(new repara(m_reparastring));
if (bonespace) filt->addfilter(new OnePara);
if (bindenter) filt->addfilter(new indenter(bindenter));
if (bdblspce) filt->addfilter(new dblspce);
-#ifdef REPALM
- if (brepalm) filt->addfilter(new repalm);
-#endif
- if (bremap) filt->addfilter(new remap);
if (bdepluck) filt->addfilter(new DePluck(pluckernextpart));
if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart));
+ if (brepalm) filt->addfilter(new repalm);
+ if (bkern) filt->addfilter(new kern);
+ if (bremap) filt->addfilter(new remap);
if (bmakebold) filt->addfilter(new embolden);
if (bfulljust) filt->addfilter(new FullJust);
+ int r,g,b;
+ m_default_bg.rgb(&r, &g, &b);
+ if (r != 255 || g != 255 || b != 255)
+ filt->addfilter(new setbg(r,g,b));
+ m_default_fg.rgb(&r, &g, &b);
+ if (r != 0 || g != 0 || b != 0)
+ filt->addfilter(new setfg(r,g,b));
+ // if (bNegative) filt->addfilter(new makeNegative);
+ if (bInverse) filt->addfilter(new makeInverse);
return filt;
}
private slots:
+ void dopageup();
+ void lineDown();
+ void lineUp();
+ void dopagedn();
void goHome();
void goBack();
void goForward();
void doscroll();
- void drawIt( QPainter * );
void paintEvent( QPaintEvent * );
-// void resizeEvent( QResizeEvent * p ) { update(); }
+#ifdef DOUBLEBUFFER
+ void resizeEvent( QResizeEvent * p );
+#endif
void keyPressEvent(QKeyEvent*);
- void drawFonts(QPainter*);
private:
+ // void drawIt( QPainter * );
+ void redrawall();
+ void drawFonts();
+ void DrawStraight(QPainter* p, int w, int h);
+ QColor m_scrollcolor, m_scrollbarcolor;
void setTwoTouch(bool _b);
void init();
void mousePressEvent( QMouseEvent* );
void mouseReleaseEvent( QMouseEvent* );
// void mouseDoubleClickEvent( QMouseEvent* );
- QString m_string, m_fontname;
+ QString m_string, m_fontname, m_reparastring;
void setfont();
//myoutput stuff
private:
+#ifdef SPECIALSCROLL
+ int m_scrolldy;
+#endif
bool mouseUpOn;
- linkType getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt);
+ 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*&);
bool m_twotouch, m_touchone;
size_t m_startpos, m_startoffset;
void dopageup(unsigned int);
- void dopageup();
- void lineDown();
- void lineUp();
- void dopagedn();
long real_delay();
int m_textsize;
int m_lastwidth, m_lastheight;
CBufferFace<CDrawBuffer*> textarray;
CBufferFace<size_t> locnarray;
unsigned int numlines;
// bool m_showlast;
- bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust;
-#ifdef REPALM
- bool brepalm;
-#endif
+ bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust, /*bNegative,*/ bInverse;
+ bool bkern, brepalm;
bool m_bpagemode, m_bMonoSpaced, m_continuousDocument;
unsigned char bindenter;
QString m_lastfile;
size_t m_lastposn;
- public:
bool bDoUpdates;
+ public:
+ void setDoUpdates(bool b) { bDoUpdates = b; }
+ void setStripCR(bool b) { bstripcr = b; }
void NavUp();
void NavDown();
tchar getch() { return buffdoc.getch(); }
bool synch(size_t, size_t);
bool tight;
bool load_file(const char *newfile, unsigned int lcn=0);
BuffDoc buffdoc;
CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); }
bool locate(unsigned long n);
- void jumpto(unsigned long n) { buffdoc.unsuspend(); buffdoc.locate(n); }
- unsigned long locate() { buffdoc.unsuspend(); return buffdoc.locate(); }
- unsigned long explocate() { buffdoc.unsuspend(); return buffdoc.explocate(); }
+ void jumpto(unsigned long n) { buffdoc.locate(n); }
+ unsigned long locate() { return buffdoc.locate(); }
+ unsigned long explocate() { return buffdoc.explocate(); }
unsigned long pagelocate() { return locnarray[0]; }
unsigned long mylastpos;
- void setfilter(CFilterChain *f) { buffdoc.unsuspend(); buffdoc.setfilter(f); locate(pagelocate()); }
+ void getNextLink();
+ void setfilter(CFilterChain *f) { buffdoc.setfilter(f); if (bDoUpdates) locate(pagelocate()); }
void restore() { jumpto(mylastpos); }
void goUp();
- void refresh() { locate(pagelocate()); }
+ void refresh(bool full = false);
void goDown();
// bool bold;
int textsize() { return m_textsize; }
void textsize(int ts) { m_textsize = ts; }
- bool fillbuffer(int ru = 0, int ht = 0, int newht = -1);
+ bool fillbuffer(int ru = 0, int ht = -1, int newht = -1);
+ void CalculateScrollParameters();
unsigned int screenlines();
- void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.unsuspend(); buffdoc.sizes(fs,ts); }
+ void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.sizes(fs,ts); }
static const char *fonts[];
// unsigned int *fontsizes;
int m_ascent, m_descent, m_linespacing;
+ int m_topmargin, m_bottommargin;
+ int m_abstopmargin, m_absbottommargin;
QFontMetrics* m_fm;
QString firstword();
-
+ bool hyphenate;
+ void reset_bg()
+ {
+ int r,g,b;
+ m_default_bg.rgb(&r, &g, &b);
+ if (bInverse)
+ {
+ r = 255-r;
+ g = 255-g;
+ b = 255-b;
+ }
+ m_bg.setRgb(r,g,b);
+ /*
+ int h,s,v;
+ m_bg.hsv(&h, &s, &v);
+ if (bNegative)
+ {
+ v = 255-v;
+ m_bg.setHsv(h,s,v);
+ }
+ */
+ setBackgroundColor( m_bg );
+ }
+ void setInverse(bool b)
+ {
+ bInverse = b;
+ reset_bg();
+ }
+ /*
+ void setNegative()
+ {
+ bNegative = !bNegative;
+ reset_bg();
+ }
+ */
signals:
void OnRedraw();
- void OnWordSelected(const QString&, size_t, const QString&);
+ void OnWordSelected(const QString&, size_t, size_t, const QString&);
void OnShowPicture(QImage&);
- void OnURLSelected(const QString&);
+ void OnURLSelected(const QString&, const size_t);
+ void NewFileRequest(const QString&);
+ void HandleKeyRequest(QKeyEvent*);
+ void SetScrollState(bool);
+ void RefreshBitmap();
};
#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 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. Allrights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-
#include "useqpe.h"
-#include "QTReader.h"
-#include "GraphicWin.h"
-#include "Bkmks.h"
-#include "cbkmkselector.h"
-#include "infowin.h"
-#include "ToolbarPrefs.h"
-#include "Prefs.h"
-#include "CAnnoEdit.h"
-#include "QFloatBar.h"
-#include "FixedFont.h"
-#include "URLDialog.h"
-#include "QTReaderApp.h"
-#include "CDrawBuffer.h"
-#include "Filedata.h"
-#include "opie.h"
-#include "names.h"
-#include "CEncoding_tables.h"
-#include "CloseDialog.h"
-
-/* OPIE */
-#include <opie2/odebug.h>
-#ifdef USEQPE
-#include <qpe/menubutton.h>
-#include <qpe/fontdatabase.h>
-#include <qpe/global.h>
-#include <qpe/applnk.h>
-#include <qpe/config.h>
-#include <qpe/qcopenvelope_qws.h>
-#endif
-
-/* QT */
-#ifdef USEQPE
-#include <qmenubar.h>
-#include <qtoolbar.h>
-#endif
#include <qregexp.h>
#include <qclipboard.h>
#include <qwidgetstack.h>
+#ifdef USEQPE
+#include <qpe/qpemenubar.h>
+#include <qpe/qpetoolbar.h>
+#endif
#include <qmenubar.h>
#include <qtoolbar.h>
+#ifdef USEQPE
+#include <qpe/menubutton.h>
+#endif
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qaction.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qtoolbutton.h>
#include <qspinbox.h>
#include <qobjectlist.h>
+#include <qstatusbar.h>
+#ifdef USEQPE
+#include <qpe/global.h>
+#include <qpe/applnk.h>
+#endif
#include <qfileinfo.h>
+#include <stdlib.h> //getenv
#include <qprogressbar.h>
+#ifdef USEQPE
+#include <qpe/config.h>
+#endif
#include <qbuttongroup.h>
#include <qradiobutton.h>
-
-/* STD */
-#include <stdlib.h> //getenv
-
-
+#ifdef USEQPE
+#include <qpe/qcopenvelope_qws.h>
+#endif
+#include "QTReader.h"
+#include "GraphicWin.h"
+#include "Bkmks.h"
+#include "cbkmkselector.h"
+#include "infowin.h"
+#include "ToolbarPrefs.h"
+#include "Prefs.h"
+#include "CAnnoEdit.h"
+#include "QFloatBar.h"
+#include "FixedFont.h"
+#include "URLDialog.h"
+#include "util.h"
+#include <qfontdatabase.h>
+#include "opie.h"
#ifdef USEQPE
#include <qpe/resource.h>
-#include <qpe/qpeapplication.h>
+#ifdef OPIE
+//#include <qpe/applnk.h>
+#include <opie2/ofiledialog.h>
+using namespace Opie::Ui;
+#else
#include "fileBrowser.h"
+#endif
#else
#include "qfiledialog.h"
#endif
+#include "QTReaderApp.h"
+#include "CDrawBuffer.h"
+#include "Filedata.h"
+#include "useqpe.h"
+#include "names.h"
+#include "CEncoding_tables.h"
+#include "CloseDialog.h"
+
+#include "ButtonPrefs.h"
+
bool CheckVersion(int&, int&, char&);
#ifdef _WINDOWS
#define PICDIR "c:\\uqtreader\\pics\\"
#else
#ifdef USEQPE
+#define USEMSGS
#define PICDIR "opie-reader/"
#else
-#define PICDIR "/home/tim/uqtreader/pics/"
+//#define PICDIR "/home/tim/uqtreader/pics/"
+QString picdir()
+{
+ QString hd(getenv("READERDIR"));
+ return hd + "/pics";
+}
+#define PICDIR picdir()
#endif
#endif
unsigned long QTReaderApp::m_uid = 0;
void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
#ifdef USEQPE
#define geticon(iconname) Resource::loadPixmap( iconname )
#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname )
#else
-#define geticon(iconname) QPixmap(PICDIR iconname ".png")
+//#define geticon(iconname) QPixmap(PICDIR iconname ".png")
+#define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png")
#define getmyicon(iconname) geticon(iconname)
//#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) )
#endif
#ifndef _WINDOWS
#include <unistd.h>
#endif
#include <stddef.h>
#ifndef _WINDOWS
#include <dirent.h>
#endif
void QTReaderApp::listBkmkFiles()
{
bkmkselector->clear();
bkmkselector->setText("Cancel");
#ifndef USEQPE
int cnt = 0;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
d.setFilter( QDir::Files | QDir::NoSymLinks );
// d.setSorting( QDir::Size | QDir::Reversed );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
bkmkselector->insertItem(fi->fileName());
cnt++;
- //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl;
+ //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
++it; // goto next list element
}
#else /* USEQPE */
int cnt = 0;
DIR *d;
d = opendir((const char *)Global::applicationFileName(APPDIR,""));
while(1)
{
struct dirent* de;
struct stat buf;
de = readdir(d);
if (de == NULL) break;
if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
{
bkmkselector->insertItem(de->d_name);
cnt++;
}
}
closedir(d);
#endif
if (cnt > 0)
{
//tjw menu->hide();
+
+
editorStack->raiseWidget( bkmkselector );
hidetoolbars();
m_nBkmkAction = cRmBkmkFile;
}
else
QMessageBox::information(this, PROGNAME, "No bookmark files");
}
void QTReaderApp::hidetoolbars()
{
+ if (m_scrollbar != NULL) m_scrollbar->hide();
+ if (m_prog != NULL) m_prog->hide();
+
+#ifdef USEQPE
menubar->hide();
+#endif
+
+ if (m_scrollbar != NULL) m_scrollbar->hide();
+
if (fileBar != NULL) fileBar->hide();
if (viewBar != NULL) viewBar->hide();
if (navBar != NULL) navBar->hide();
if (markBar != NULL) markBar->hide();
if (m_fontVisible) m_fontBar->hide();
if (regVisible)
{
#ifdef USEQPE
Global::hideInputMethod();
#endif
regBar->hide();
}
if (searchVisible)
{
#ifdef USEQPE
Global::hideInputMethod();
#endif
searchBar->hide();
}
}
QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
- : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false),
- fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL)
+ : QMainWindow( parent, name, f ), m_dontSave(false),
+ fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false)
{
+ {
+ setKeyCompression ( true );
+#ifndef USEQPE
+ QDir d = QDir::home(); // "/"
+ d.cd(APPDIR);
+ QFileInfo fi(d, ".keymap");
+ FILE* f = fopen((const char *)fi.absFilePath(), "r");
+#else /* USEQPE */
+ FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r");
+#endif /* USEQPE */
+ if (f != NULL)
+ {
+ uint cnt;
+ if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION))
+ {
+ if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0;
+ for (uint i = 0; i != cnt; i++)
+ {
+ orKey key;
+ int data;
+ fread(&key, sizeof(key), 1, f);
+ fread(&data, sizeof(data), 1, f);
+ kmap[key] = data;
+ }
+ }
+ fclose(f);
+ }
+ }
+
m_url_clipboard = false;
m_url_localfile = false;
m_url_globalfile = false;
ftime(&m_lastkeytime);
-//// odebug << "Application directory = " << (const tchar *)QPEApplication::documentDir() << "" << oendl;
-//// odebug << "Application directory = " << (const tchar *)Global::applicationFileName("uqtreader" << "" << oendl;
+//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir());
+//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
m_bcloseDisabled = true;
m_disableesckey = false;
pBkmklist = NULL;
pOpenlist = NULL;
// doc = 0;
m_fBkmksChanged = false;
QString lang = getenv( "LANG" );
QString rot = getenv( "QWS_DISPLAY" );
/*
int m_rot = 0;
if (rot.contains("Rot90"))
{
m_rot = 90;
}
else if (rot.contains("Rot180"))
{
m_rot = 180;
}
else if (rot.contains("Rot270"))
{
m_rot = 270;
}
-// odebug << "Initial Rotation(" << m_rot << "):" << rot << "" << oendl;
+// qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot);
*/
m_autogenstr = "^ *[A-Z].*[a-z] *$";
#ifdef USEQPE
setIcon( Resource::loadPixmap( PICDIR "uqtreader") );
#else
- setIcon( QPixmap (PICDIR "uqtreader.png") );
+ setIcon( QPixmap (PICDIR + "/uqtreader.png") );
#endif /* USEQPE */
-// QToolBar *bar = new QToolBar( this );
-// menubar = new QToolBar( this );
+// QPEToolBar *bar = new QPEToolBar( this );
+// menubar = new QPEToolBar( this );
#ifdef USEQPE
Config config( APPDIR );
#else
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
QFileInfo fi(d, INIFILE);
-// odebug << "Path:" << fi.absFilePath() << "" << oendl;
+// qDebug("Path:%s", (const char*)fi.absFilePath());
Config config(fi.absFilePath());
#endif
config.setGroup("Toolbar");
m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
- menubar = new QToolBar("Menus", this, m_tbposition);
+ m_qtscroll = config.readNumEntry("QTScrollBar", false);
+ m_localscroll = config.readNumEntry("LocalScrollBar", false);
// fileBar = new QToolBar("File", this);
// QToolBar* viewBar = new QToolBar("File", this);
// QToolBar* navBar = new QToolBar("File", this);
// QToolBar* markBar = new QToolBar("File", this);
#ifdef USEQPE
- mb = new QMenuBar( menubar );
+ menubar = new QToolBar("Menus", this, m_tbposition);
+ mb = new QPEMenuBar( menubar );
#else
- mb = new QMenuBar( menubar );
+ mb = new QMenuBar( this );
#endif
-//#ifdef USEQPE
+#ifdef USEQPE
QPopupMenu* tmp = new QPopupMenu(mb);
mb->insertItem( geticon( "AppsIcon" ), tmp );
-//#else
-// QMenuBar* tmp = mb;
-//#endif
+#else
+ QMenuBar* tmp = mb;
+#endif
QPopupMenu *file = new QPopupMenu( mb );
tmp->insertItem( tr( "File" ), file );
QPopupMenu *navigation = new QPopupMenu(mb);
tmp->insertItem( tr( "Navigation" ), navigation );
QPopupMenu *view = new QPopupMenu( mb );
tmp->insertItem( tr( "View" ), view );
QPopupMenu *marks = new QPopupMenu( this );
tmp->insertItem( tr( "Marks" ), marks );
QPopupMenu *settings = new QPopupMenu( this );
tmp->insertItem( tr( "Settings" ), settings );
// addToolBar(menubar, "Menus",QMainWindow::Top);
// addToolBar(fileBar, "Toolbar",QMainWindow::Top);
// QPopupMenu *edit = new QPopupMenu( this );
/*
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( bar );
a->addTo( file );
*/
+ QWidget* widge = new QWidget(this);
+ setCentralWidget( widge );
+ QVBoxLayout* vlayout = new QVBoxLayout(widge);
+ m_layout = new QBoxLayout(QBoxLayout::LeftToRight);
+ m_prog = new QLabel(widge);
+ vlayout->addLayout(m_layout, 1);
+ vlayout->addWidget(m_prog);
- editorStack = new QWidgetStack( this );
- setCentralWidget( editorStack );
+ editorStack = new QWidgetStack( widge );
+ // setCentralWidget( editorStack );
searchVisible = FALSE;
regVisible = FALSE;
m_fontVisible = false;
+ m_buttonprefs = new CButtonPrefs(&kmap, this);
+ editorStack->addWidget(m_buttonprefs, get_unique_id());
+ connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
+
+
m_annoWin = new CAnnoEdit(editorStack);
editorStack->addWidget(m_annoWin, get_unique_id());
connect( m_annoWin, SIGNAL( finished(const QString&,const QString&) ), this, SLOT( addAnno(const QString&,const QString&) ) );
connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) );
m_infoWin = new infowin(editorStack);
editorStack->addWidget(m_infoWin, get_unique_id());
connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
m_graphicwin = new GraphicWin(editorStack);
editorStack->addWidget(m_graphicwin, get_unique_id());
connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
// bkmkselector = new QListBox(editorStack, "Bookmarks");
bkmkselector = new CBkmkSelector(editorStack, "Bookmarks");
// connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) );
connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) );
editorStack->addWidget( bkmkselector, get_unique_id() );
/*
importSelector = new FileSelector( "*", editorStack, "importselector", false );
connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) );
editorStack->addWidget( importSelector, get_unique_id() );
// don't need the close visible, it is redundant...
importSelector->setCloseVisible( FALSE );
*/
-// odebug << "Reading file list" << oendl;
+// qDebug("Reading file list");
readfilelist();
reader = new QTReader( editorStack );
- reader->bDoUpdates = false;
+ reader->setDoUpdates(false);
#ifdef USEQPE
((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold);
#endif
-// odebug << "Reading config" << oendl;
+// qDebug("Reading config");
// Config config( APPDIR );
config.setGroup( "View" );
m_debounce = config.readNumEntry("Debounce", 0);
+ m_buttonprefs->Debounce(m_debounce);
#ifdef USEQPE
m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
#else
m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true);
#endif
- reader->bstripcr = config.readBoolEntry( "StripCr", true );
+ reader->setStripCR(config.readBoolEntry( "StripCr", true ));
reader->bfulljust = config.readBoolEntry( "FullJust", false );
+ /*
+ bool btmp = config.readBoolEntry("Negative", false);
+ if (btmp) reader->setNegative();
+ */
+ reader->bInverse = config.readBoolEntry("Inverse", false);
+ reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false ));
reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 ));
reader->setlead(config.readNumEntry( "ExtraLead", 0 ));
reader->btextfmt = config.readBoolEntry( "TextFmt", false );
reader->bautofmt = config.readBoolEntry( "AutoFmt", true );
reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
reader->bpeanut = config.readBoolEntry( "Peanut", false );
reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
reader->bdepluck = config.readBoolEntry( "Depluck", false );
reader->bdejpluck = config.readBoolEntry( "Dejpluck", false );
reader->bonespace = config.readBoolEntry( "OneSpace", false );
reader->bunindent = config.readBoolEntry( "Unindent", false );
reader->brepara = config.readBoolEntry( "Repara", false );
+ reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}");
+ m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 );
+ m_themename = config.readEntry("Theme", QString::null );
reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
reader->bindenter = config.readNumEntry( "Indent", 0 );
reader->m_textsize = config.readNumEntry( "FontSize", 12 );
reader->m_delay = config.readNumEntry( "ScrollDelay", 5184);
+ reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1);
+
reader->m_lastfile = config.readEntry( "LastFile", QString::null );
reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
+ reader->m_rotated = config.readBoolEntry( "IsRotated", false );
+ reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 );
+ m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%");
+ m_statusishidden = config.readBoolEntry("StatusHidden", false);
+ m_background = config.readNumEntry( "Background", 0 );
+ reader->setBackground(getcolour(m_background));
+ m_foreground = config.readNumEntry( "Foreground", 1 );
+ reader->setForeground(getcolour(m_foreground));
+ m_scrollcolor = config.readNumEntry( "ScrollColour", 5 );
+ setscrollcolour();
+ m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 );
+ setscrollbarcolour();
+ reader->hyphenate = config.readBoolEntry( "Hyphenate", false );
reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
reader->m_encd = config.readNumEntry( "Encoding", 0 );
reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
reader->m_overlap = config.readNumEntry( "Overlap", 0 );
- reader->m_border = config.readNumEntry( "Margin", 6 );
-#ifdef REPALM
- reader->brepalm = config.readBoolEntry( "Repalm", true );
-#endif
+ reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 );
+ reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 );
+ reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 );
+ reader->m_absright_border = config.readNumEntry( "Right Margin", 100 );
+
+ m_scrollishidden = config.readBoolEntry( "HideScrollBar", false );
+
+ reader->brepalm = config.readBoolEntry( "Repalm", false );
+ reader->bkern = config.readBoolEntry( "Kern", false );
reader->bremap = config.readBoolEntry( "Remap", true );
reader->bmakebold = config.readBoolEntry( "MakeBold", false );
reader->setContinuous(config.readBoolEntry( "Continuous", true ));
m_targetapp = config.readEntry( "TargetApp", QString::null );
m_targetmsg = config.readEntry( "TargetMsg", QString::null );
#ifdef _SCROLLPIPE
reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null );
reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true );
#endif
m_twoTouch = config.readBoolEntry( "TwoTouch", false);
m_doAnnotation = config.readBoolEntry( "Annotation", false);
m_doDictionary = config.readBoolEntry( "Dictionary", false);
m_doClipboard = config.readBoolEntry( "Clipboard", false);
+ /*
m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll);
m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone);
m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen);
m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut);
m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn);
m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp);
m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown);
m_leftScroll = config.readBoolEntry("LeftScroll", false);
m_rightScroll = config.readBoolEntry("RightScroll", false);
m_upScroll = config.readBoolEntry("UpScroll", true);
m_downScroll = config.readBoolEntry("DownScroll", true);
-
+ */
m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false);
reader->setBaseSize(config.readNumEntry( "Basesize", 10 ));
-
+ reader->setHyphenThreshold(config.readNumEntry( "HyphenThreshold", 50 ));
+ // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false ));
#ifndef USEQPE
config.setGroup( "Geometry" );
setGeometry(0,0,
config.readNumEntry( "width", QApplication::desktop()->width()/2 ),
config.readNumEntry( "height", QApplication::desktop()->height()/2 ));
move(
config.readNumEntry( "x", 20 ),
config.readNumEntry( "y", 20 ));
+#else
+ m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", false);
#endif
setTwoTouch(m_twoTouch);
connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) );
connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) );
- connect( reader, SIGNAL( OnWordSelected(const QString&,size_t,const QString&) ), this, SLOT( OnWordSelected(const QString&,size_t,const QString&) ) );
- connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) );
+ connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, size_t, const QString&) ) );
+ connect( reader, SIGNAL( OnURLSelected(const QString&, const size_t) ), this, SLOT( OnURLSelected(const QString&, const size_t) ) );
+ connect( reader, SIGNAL( NewFileRequest(const QString&) ), this, SLOT( forceopen(const QString&) ) );
+ connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) );
+ connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) );
+ connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap()));
editorStack->addWidget( reader, get_unique_id() );
m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL);
connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) );
m_preferences_action->addTo( settings );
m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL);
connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) );
m_saveconfig_action->addTo( settings );
m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL);
connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) );
m_loadconfig_action->addTo( settings );
m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL);
connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) );
m_tidyconfig_action->addTo( settings );
settings->insertSeparator();
m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL);
connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) );
m_toolbarprefs_action->addTo( settings );
+ m_buttonprefs_action = new QAction( tr( "Buttons" ), QString::null, 0, this, NULL);
+ connect( m_buttonprefs_action, SIGNAL( activated() ), this, SLOT( showbuttonprefs() ) );
+ m_buttonprefs_action->addTo( settings );
+
+ m_loadtheme_action = new QAction( tr( "Load Theme" ), QString::null, 0, this, NULL);
+ connect( m_loadtheme_action, SIGNAL( activated() ), this, SLOT( LoadTheme() ) );
+ m_loadtheme_action->addTo( settings );
+
+ m_repara_action = new QAction( tr( "EOP Marker" ), QString::null, 0, this, NULL);
+ connect( m_repara_action, SIGNAL( activated() ), this, SLOT( reparastring() ) );
+ m_repara_action->addTo(settings);
+
+#ifdef USEQPE
+ m_grab_action = new QAction( tr( "Grab Buttons" ), QString::null, 0, this, NULL, true );
+ connect( m_grab_action, SIGNAL( toggled(bool) ), this, SLOT( setgrab(bool) ) );
+ m_grab_action->setOn(m_grabkeyboard);
+ m_grab_action->addTo( settings );
+#endif
+
m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 );
connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
m_open_action->addTo( file );
m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 );
connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) );
m_close_action->addTo( file );
#ifdef _SCRIPT
a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL);
connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) );
a->addTo( file );
#endif
/*
a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
a->addTo( file );
a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
a->addTo( filebar() );
a->addTo( edit );
*/
m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL);
connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) );
m_info_action->addTo( file );
m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true );
connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) );
m_touch_action->setOn(m_twoTouch);
m_touch_action->addTo( file );
m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL);
connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) );
file->insertSeparator();
// a->addTo( bar );
m_find_action->addTo( file );
m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL);
connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) );
m_exportlinks_action->addTo( file );
m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true );
connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
m_scrollButton->addTo(navigation);
m_scrollButton->setOn(false);
m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL);
connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) );
m_start_action->addTo(navigation);
m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL);
connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) );
m_end_action->addTo(navigation);
m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL);
connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) );
m_jump_action->addTo(navigation);
m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true );
connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) );
m_pageline_action->addTo(navigation);
m_pageline_action->setOn(reader->m_bpagemode);
m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 );
connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) );
m_pageup_action->addTo( navigation );
m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 );
connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) );
m_pagedn_action->addTo( navigation );
m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 );
connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) );
m_back_action->addTo( navigation );
m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 );
connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) );
m_home_action->addTo( navigation );
m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 );
connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) );
m_forward_action->addTo( navigation );
/*
a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true );
// connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
a->addTo( file );
a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true );
// connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
a->addTo( file );
*/
// file->insertSeparator();
#ifdef _SCROLLPIPE
QActionGroup* ag = new QActionGroup(this);
ag->setExclusive(false);
spacemenu = new QPopupMenu(this);
file->insertItem( tr( "Scrolling" ), spacemenu );
a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL);
connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) );
a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true );
connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) );
a->setOn(reader->m_pauseAfterEachPara);
ag->addTo(spacemenu);
// file->insertSeparator();
#endif
/*
a = new QAction( tr( "Import" ), QString::null, 0, this, NULL );
connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) );
a->addTo( file );
*/
/*
a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
a->addTo( fileBar );
a->addTo( edit );
*/
// a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 );
m_fullscreen = false;
m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true );
connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) );
m_actFullscreen->setOn(m_fullscreen);
m_actFullscreen->addTo( view );
+ m_rotate_action = new QAction( tr( "Rotate" ), geticon( "repeat" ), QString::null, 0, this, NULL, true );
+ connect( m_rotate_action, SIGNAL( toggled(bool) ), this, SLOT( setrotated(bool) ) );
+ m_rotate_action->setOn(reader->m_rotated);
+ m_rotate_action->addTo( view );
+
+ m_inverse_action = new QAction( tr( "Invert" ), getmyicon( "invert" ), QString::null, 0, this, NULL, true );
+ connect( m_inverse_action, SIGNAL( toggled(bool) ), this, SLOT( setinverted(bool) ) );
+ m_inverse_action->setOn(reader->bInverse);
+ m_inverse_action->addTo( view );
+
view->insertSeparator();
m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this);
connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) );
m_zoomin_action->addTo( view );
m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this);
connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) );
m_zoomout_action->addTo( view );
view->insertSeparator();
m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this);
connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) );
m_setfont_action->addTo( view );
view->insertSeparator();
m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this);
connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) );
m_setenc_action->addTo( view );
m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true);
connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
m_setmono_action->addTo( view );
m_setmono_action->setOn(reader->m_bMonoSpaced);
// a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true );
// a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 );
// a->addTo( filebar() );
// view->insertSeparator();
/*
a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true );
connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
a->setOn(reader->m_bMonoSpaced);
a->addTo( view );
*/
/*
a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL);
connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) );
a->addTo( view );
*/
m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL);
connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) );
m_mark_action->addTo( marks );
m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL);
connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) );
m_annotate_action->addTo( marks );
m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false );
connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) );
m_goto_action->addTo( marks );
m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL);
connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) );
m_delete_action->addTo( marks );
m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false );
connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) );
marks->insertSeparator();
m_autogen_action->addTo( marks );
m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL);
connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) );
m_clear_action->addTo( marks );
m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL );
connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) );
m_save_action->addTo( marks );
m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL);
connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) );
marks->insertSeparator();
m_tidy_action->addTo( marks );
m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL);
connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) );
marks->insertSeparator();
m_startBlock_action->addTo( marks );
m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL);
connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) );
m_endBlock_action->addTo( marks );
m_bkmkAvail = NULL;
setToolBarsMovable(m_tbmove);
addtoolbars(&config);
pbar = new QProgressBar(this);
pbar->hide();
searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE );
searchBar->setHorizontalStretchable( TRUE );
connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
searchEdit = new QLineEdit( searchBar, "searchEdit" );
// QFont f("unifont", 16 /*, QFont::Bold*/);
// searchEdit->setFont( f );
searchBar->setStretchableWidget( searchEdit );
#ifdef __ISEARCH
connect( searchEdit, SIGNAL( textChanged(const QString&) ),
this, SLOT( search(const QString&) ) );
#else
connect( searchEdit, SIGNAL( returnPressed() ),
this, SLOT( search() ) );
#endif
QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
a->addTo( searchBar );
a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
a->addTo( searchBar );
searchBar->hide();
regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE );
connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
regBar->setHorizontalStretchable( TRUE );
regEdit = new QLineEdit( regBar, "regEdit" );
// regEdit->setFont( f );
regBar->setStretchableWidget( regEdit );
connect( regEdit, SIGNAL( returnPressed() ),
this, SLOT( do_regaction() ) );
a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) );
a->addTo( regBar );
a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) );
a->addTo( regBar );
regBar->hide();
m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE );
m_fontBar->setHorizontalStretchable( TRUE );
-// odebug << "Font selector" << oendl;
+// qDebug("Font selector");
m_fontSelector = new QComboBox(false, m_fontBar);
m_fontBar->setStretchableWidget( m_fontSelector );
{
-#ifndef USEQPE
QFontDatabase f;
-#else
- FontDatabase f;
-#endif
QStringList flist = f.families();
bool realfont = false;
for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
{
if (reader->m_fontname == *nm)
{
realfont = true;
}
if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm);
}
if (!realfont) reader->m_fontname = flist[0];
} // delete the FontDatabase!!!
connect( m_fontSelector, SIGNAL( activated(const QString&) ),
this, SLOT( do_setfont(const QString&) ) );
connect( m_fontSelector, SIGNAL( activated(int) ),
this, SLOT( do_setencoding(int) ) );
m_fontBar->hide();
m_fontVisible = false;
#ifdef USEMSGS
connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
this, SLOT( msgHandler(const QCString&,const QByteArray&) ) );
#endif
-// odebug << "Initing" << oendl;
+// qDebug("Initing");
+
+ m_layout->addWidget(editorStack);
+ if (m_qtscroll != 0)
+ {
+ /*
+ m_scrollbar = new QToolBar( "Autogen", this, (m_localscrollbar) ? QMainWindow::Left : QMainWindow::Right, TRUE );
+
+ m_scrollbar->setVerticalStretchable( TRUE );
+ */
+ scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge);
+ m_layout->addWidget(scrollbar);
+ scrollbar->setTracking(false);
+ // connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) );
+ // m_scrollbar->setStretchableWidget( scrollbar );
+ if (m_scrollishidden)
+ {
+ m_scrollbar->hide();
+ }
+ else
+ {
+ m_scrollbar->show();
+ }
+
+ setrotated(reader->m_rotated);
+ }
+ else
+ {
+ m_scrollbar = NULL;
+ }
+ setBackgroundBitmap();
+ m_inverse_action->setOn(reader->bInverse);
reader->init();
-// odebug << "Inited" << oendl;
+
+// qDebug("Inited");
// m_buttonAction[m_spaceTarget]->setOn(true);
-// odebug << "fonting" << oendl;
+// qDebug("fonting");
do_setfont(reader->m_fontname);
+ // qDebug("fonted");
+ QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0));
+ m_prog->setFont( progfont );
+ if (m_statusishidden) m_prog->hide();
if (!reader->m_lastfile.isEmpty())
{
-// odebug << "doclnk" << oendl;
+// qDebug("doclnk");
// doc = new DocLnk(reader->m_lastfile);
-// odebug << "doclnk done" << oendl;
+// qDebug("doclnk done");
if (pOpenlist != NULL)
{
/*
int ind = 0;
Bkmk* p = (*pOpenlist)[ind];
while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
{
p = (*pOpenlist)[++ind];
}
*/
Bkmk* p = NULL;
for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
{
p = iter.pContent();
if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile)
{
break;
}
-// odebug << "Item:" << toQString(CFiledata(p->anno()).name()) << "" << oendl;
+// qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name()));
p = NULL;
}
if (p != NULL)
{
-// odebug << "openfrombkmk" << oendl;
if (!openfrombkmk(p))
+ {
showEditTools();
}
+ }
else
{
-// odebug << "openfile" << oendl;
openFile( reader->m_lastfile );
}
}
else
{
-// odebug << "Openfile 2" << oendl;
if (!reader->m_lastfile.isEmpty())
+ {
openFile( reader->m_lastfile );
}
}
+ }
else
{
showEditTools();
}
// qApp->processEvents();
+ if (m_scrollbar == NULL || m_scrollbar->isHidden())
+ {
+ reader->m_scrollpos = m_localscroll;
+ }
+ else
+ {
+ reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0;
+ }
reader->bDoUpdates = true;
reader->update();
config.setGroup("Version");
int major = config.readNumEntry("Major", 0);
int bkmktype = config.readNumEntry("BkmkType", 0);
char minor = config.readNumEntry("Minor", 0);
if (CheckVersion(major, bkmktype, minor))
{
config.writeEntry("Major", major);
config.writeEntry("BkmkType", bkmktype);
config.writeEntry("Minor", (int)minor);
}
-// odebug << "finished update" << oendl;
+// qDebug("finished update");
+ if (kmap.isEmpty())
+ {
+ 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.");
+
+ m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp);
+ m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown);
+
+ m_buttonprefs->mapkey(Qt::NoButton, Key_Right, cesZoomIn);
+ m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut);
+
+ showbuttonprefs();
+ }
}
void QTReaderApp::addtoolbars(Config* config)
{
config->setGroup("Toolbar");
if (fileBar != NULL)
{
+#ifdef USEQPE
if (fileBar != menubar)
{
fileBar->clear();
}
else
{
m_preferences_action->removeFrom( filebar() );
m_open_action->removeFrom( filebar() );
m_close_action->removeFrom( filebar() );
m_info_action->removeFrom( filebar() );
m_touch_action->removeFrom( filebar() );
m_find_action->removeFrom( filebar() );
}
+#else
+ fileBar->clear();
+#endif
}
m_preferences_action->addTo( filebar() );
addfilebar(config, "Open", m_open_action);
addfilebar(config, "Close", m_close_action);
addfilebar(config, "Info", m_info_action);
addfilebar(config, "Two/One Touch", m_touch_action);
addfilebar(config, "Find", m_find_action);
if (navBar != NULL)
{
+#ifdef USEQPE
if ((navBar == fileBar) && (fileBar == menubar))
+#else
+ if (navBar == fileBar)
+#endif
{
m_scrollButton->removeFrom( navbar() );
m_start_action->removeFrom( navbar() );
m_end_action->removeFrom( navbar() );
m_jump_action->removeFrom( navbar() );
m_pageline_action->removeFrom( navbar() );
m_pageup_action->removeFrom( navbar() );
m_pagedn_action->removeFrom( navbar() );
m_back_action->removeFrom( navbar() );
m_home_action->removeFrom( navbar() );
m_forward_action->removeFrom( navbar() );
}
else if (navBar != fileBar)
{
navBar->clear();
}
}
addnavbar(config, "Scroll", m_scrollButton);
addnavbar(config, "Goto Start", m_start_action);
addnavbar(config, "Goto End", m_end_action);
addnavbar(config, "Jump", m_jump_action);
addnavbar(config, "Page/Line Scroll", m_pageline_action);
addnavbar(config, "Page Up", m_pageup_action);
addnavbar(config, "Page Down", m_pagedn_action);
addnavbar(config, "Back", m_back_action);
addnavbar(config, "Home", m_home_action);
addnavbar(config, "Forward", m_forward_action);
if (viewBar != NULL)
{
+#ifdef USEQPE
if ((viewBar == fileBar) && (fileBar == menubar))
+#else
+ if (viewBar == fileBar)
+#endif
{
m_actFullscreen->removeFrom( filebar() );
+ m_rotate_action->removeFrom( viewbar() );
+ m_inverse_action->removeFrom( viewbar() );
m_zoomin_action->removeFrom( viewbar() );
m_zoomout_action->removeFrom( viewbar() );
m_setfont_action->removeFrom( viewbar() );
m_setenc_action->removeFrom( viewbar() );
m_setmono_action->removeFrom( viewbar() );
}
else if (viewBar != fileBar)
{
viewBar->clear();
}
}
addviewbar(config, "Fullscreen", m_actFullscreen);
+ addviewbar(config, "Rotate", m_rotate_action);
+ addviewbar(config, "Invert Action", m_inverse_action);
addviewbar(config, "Zoom In", m_zoomin_action);
addviewbar(config, "Zoom Out", m_zoomout_action);
addviewbar(config, "Set Font", m_setfont_action);
addviewbar(config, "Encoding Select", m_setenc_action);
addviewbar(config, "Ideogram Mode", m_setmono_action);
if (markBar != NULL)
{
+#ifdef USEQPE
if ((markBar == fileBar) && (fileBar == menubar))
+#else
+ if (markBar == fileBar)
+#endif
{
m_mark_action->removeFrom( markbar() );
m_annotate_action->removeFrom( markbar());
m_goto_action->removeFrom( markbar() );
m_delete_action->removeFrom( markbar() );
m_autogen_action->removeFrom( markbar() );
m_clear_action->removeFrom( markbar() );
m_save_action->removeFrom( markbar() );
m_tidy_action->removeFrom( markbar() );
m_startBlock_action->removeFrom( markbar() );
m_endBlock_action->removeFrom( markbar() );
}
else if (markBar != fileBar)
{
markBar->clear();
}
}
addmarkbar(config, "Mark", m_mark_action);
addmarkbar(config, "Annotate", m_annotate_action);
addmarkbar(config, "Goto", m_goto_action);
addmarkbar(config, "Delete", m_delete_action);
addmarkbar(config, "Autogen", m_autogen_action);
addmarkbar(config, "Clear", m_clear_action);
addmarkbar(config, "Save", m_save_action);
addmarkbar(config, "Tidy", m_tidy_action);
addmarkbar(config, "Start Block", m_startBlock_action);
addmarkbar(config, "Copy Block", m_endBlock_action);
if (checkbar(config, "Annotation indicator"))
{
if (m_bkmkAvail == NULL)
{
m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 );
connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) );
m_bkmkAvail->setEnabled(false);
}
QLabel *spacer = new QLabel(markBar, "");
markbar()->setStretchableWidget(spacer);
m_bkmkAvail->removeFrom( markbar() );
m_bkmkAvail->addTo( markbar() );
}
else
{
if (m_bkmkAvail != NULL)
{
m_bkmkAvail->removeFrom( markbar() );
delete m_bkmkAvail;
m_bkmkAvail = NULL;
}
}
}
bool QTReaderApp::checkbar(Config* _config, const QString& key)
{
return _config->readBoolEntry(key, false);
}
QToolBar* QTReaderApp::filebar()
{
if (fileBar == NULL)
{
switch (m_tbpol)
{
+#ifdef USEQPE
case cesSingle:
-// odebug << "Setting filebar to menubar" << oendl;
+// qDebug("Setting filebar to menubar");
fileBar = menubar;
break;
+#endif
default:
- odebug << "Incorrect toolbar policy set" << oendl;
+ qDebug("Incorrect toolbar policy set");
case cesMenuTool:
case cesMultiple:
-// odebug << "Creating new file bar" << oendl;
+// qDebug("Creating new file bar");
fileBar = new QToolBar("File", this, m_tbposition);
break;
}
// fileBar->setHorizontalStretchable( true );
}
return fileBar;
}
QToolBar* QTReaderApp::viewbar()
{
if (viewBar == NULL)
{
switch (m_tbpol)
{
case cesMultiple:
viewBar = new QToolBar("View", this, m_tbposition);
break;
default:
- odebug << "Incorrect toolbar policy set" << oendl;
+ qDebug("Incorrect toolbar policy set");
+#ifdef USEQPE
case cesSingle:
+#endif
case cesMenuTool:
viewBar = fileBar;
break;
}
}
return viewBar;
}
QToolBar* QTReaderApp::navbar()
{
if (navBar == NULL)
{
switch (m_tbpol)
{
case cesMultiple:
-// odebug << "Creating new nav bar" << oendl;
+// qDebug("Creating new nav bar");
navBar = new QToolBar("Navigation", this, m_tbposition);
break;
default:
- odebug << "Incorrect toolbar policy set" << oendl;
+ qDebug("Incorrect toolbar policy set");
+#ifdef USEQPE
case cesSingle:
+#endif
case cesMenuTool:
navBar = fileBar;
-// odebug << "Setting navbar to filebar" << oendl;
+// qDebug("Setting navbar to filebar");
break;
}
}
return navBar;
}
QToolBar* QTReaderApp::markbar()
{
if (markBar == NULL)
{
switch (m_tbpol)
{
case cesMultiple:
markBar = new QToolBar("Marks", this, m_tbposition);
break;
default:
- odebug << "Incorrect toolbar policy set" << oendl;
+ qDebug("Incorrect toolbar policy set");
+#ifdef USEQPE
case cesSingle:
+#endif
case cesMenuTool:
markBar = fileBar;
break;
}
}
return markBar;
}
void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a)
{
if (_config->readBoolEntry(key, false)) a->addTo( filebar() );
}
void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a)
{
if (_config->readBoolEntry(key, false)) a->addTo( navbar() );
}
void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a)
{
if (_config->readBoolEntry(key, false)) a->addTo( markbar() );
}
void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a)
{
if (_config->readBoolEntry(key, false)) a->addTo( viewbar() );
}
void QTReaderApp::suspend() { reader->suspend(); }
-#ifdef USEMSGS
void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
{
+#ifndef USEMSGS
+ return;
+#else
QString msg = QString::fromUtf8(_msg);
-//// odebug << "Received:" << msg << "" << oendl;
-
+ qDebug("Received:%s", (const char*)msg);
+ QDataStream stream( _data, IO_ReadOnly );
+ if ( msg == "suspend()" )
+ {
+ qDebug("Suspending");
+ suspend();
+ qDebug("Suspendedb");
+ }
+ return;
+ /*
QDataStream stream( _data, IO_ReadOnly );
if ( msg == "info(QString)" )
{
QString info;
stream >> info;
QMessageBox::information(this, PROGNAME, info);
}
else if ( msg == "Update(int)" )
{
int info;
stream >> info;
if (info)
{
reader->bDoUpdates = true;
reader->refresh();
}
else
{
reader->bDoUpdates = false;
}
}
else if ( msg == "warn(QString)" )
{
QString info;
stream >> info;
QMessageBox::warning(this, PROGNAME, info);
}
else if ( msg == "exit()" )
{
m_dontSave = true;
close();
}
else if ( msg == "pageDown()" )
{
reader->dopagedn();
}
else if ( msg == "pageUp()" )
{
reader->dopageup();
}
else if ( msg == "lineDown()" )
{
reader->lineDown();
}
else if ( msg == "lineUp()" )
{
reader->lineUp();
}
else if ( msg == "showText()" )
{
showEditTools();
}
else if ( msg == "home()" )
{
reader->goHome();
}
else if ( msg == "back()" )
{
reader->goBack();
}
else if ( msg == "forward()" )
{
reader->goForward();
}
else if ( msg == "File/Open(QString)" )
{
QString info;
stream >> info;
openFile( info );
}
else if ( msg == "File/Info()" )
{
showinfo();
}
else if ( msg == "File/Action(QString)" )
{
QString info;
stream >> info;
m_spaceTarget = ActNameToInt(info);
}
else if ( msg == "Navigation/Scroll(int)" )
{
int info;
stream >> info;
autoScroll(info);
}
else if ( msg == "Navigation/GotoStart()" )
{
gotoStart();
}
else if ( msg == "Navigation/GotoEnd()" )
{
gotoEnd();
}
else if ( msg == "Navigation/Jump(int)" )
{
int info;
stream >> info;
reader->locate(info);
}
else if ( msg == "Navigation/Page/LineScroll(int)" )
{
int info;
stream >> info;
pagemode(info);
}
else if ( msg == "Navigation/SetOverlap(int)" )
{
int info;
stream >> info;
reader->m_overlap = info;
}
else if ( msg == "Navigation/SetMargin(int)" )
{
int info;
stream >> info;
do_margin(info);
}
else if ( msg == "File/SetDictionary(QString)" )
{
QString info;
stream >> info;
do_settarget(info);
}
#ifdef _SCROLLPIPE
else if ( msg == "File/SetScrollTarget(QString)" )
{
QString info;
stream >> info;
reader->m_pipetarget = info;
}
#endif
else if ( msg == "File/Two/OneTouch(int)" )
{
int info;
stream >> info;
setTwoTouch(info);
}
else if ( msg == "Target/Annotation(int)" )
{
int info;
stream >> info;
OnAnnotation(info);
}
else if ( msg == "Target/Dictionary(int)" )
{
int info;
stream >> info;
OnDictionary(info);
}
else if ( msg == "Target/Clipboard(int)" )
{
int info;
stream >> info;
OnClipboard(info);
}
else if ( msg == "File/Find(QString)" )
{
QString info;
stream >> info;
QRegExp arg(info);
size_t pos = reader->pagelocate();
size_t start = pos;
CDrawBuffer test(&(reader->m_fontControl));
reader->getline(&test);
while (arg.match(toQString(test.data())) == -1)
{
pos = reader->locate();
if (!reader->getline(&test))
{
QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info);
pos = start;
break;
}
}
reader->locate(pos);
}
else if ( msg == "File/Fullscreen(int)" )
{
int info;
stream >> info;
setfullscreen(info);
}
else if ( msg == "File/Continuous(int)" )
{
int info;
stream >> info;
setcontinuous(info);
}
else if ( msg == "Markup(QString)" )
{
QString info;
stream >> info;
if (info == "Auto")
{
autofmt(true);
}
if (info == "None")
{
autofmt(false);
textfmt(false);
striphtml(false);
peanut(false);
}
if (info == "Text")
{
textfmt(true);
}
if (info == "HTML")
{
striphtml(true);
}
if (info == "Peanut/PML")
{
peanut(true);
}
}
else if ( msg == "Layout/StripCR(int)" )
{
int info;
stream >> info;
stripcr(info);
}
else if ( msg == "Layout/Dehyphen(int)" )
{
int info;
stream >> info;
dehyphen(info);
}
else if ( msg == "Layout/Depluck(int)" )
{
int info;
stream >> info;
depluck(info);
}
else if ( msg == "Layout/Dejpluck(int)" )
{
int info;
stream >> info;
dejpluck(info);
}
else if ( msg == "Layout/SingleSpace(int)" )
{
int info;
stream >> info;
onespace(info);
}
-#ifdef REPALM
else if ( msg == "Layout/Repalm(int)" )
{
int info;
stream >> info;
repalm(info);
}
-#endif
else if ( msg == "Layout/Unindent(int)" )
{
int info;
stream >> info;
unindent(info);
}
else if ( msg == "Layout/Re-paragraph(int)" )
{
int info;
stream >> info;
repara(info);
}
else if ( msg == "Layout/DoubleSpace(int)" )
{
int info;
stream >> info;
dblspce(info);
}
else if ( msg == "Layout/Indent(int)" )
{
int info;
stream >> info;
reader->bindenter = info;
reader->setfilter(reader->getfilter());
}
else if ( msg == "Layout/Remap(int)" )
{
int info;
stream >> info;
remap(info);
}
else if ( msg == "Layout/Embolden(int)" )
{
int info;
stream >> info;
embolden(info);
}
else if ( msg == "Format/Ideogram/Word(int)" )
{
int info;
stream >> info;
monospace(info);
}
else if ( msg == "Format/SetWidth(int)" )
{
int info;
stream >> info;
reader->m_charpc = info;
reader->setfont();
reader->refresh();
}
else if ( msg == "Format/SetFont(QString,int)" )
{
QString fontname;
int size;
stream >> fontname;
stream >> size;
setfontHelper(fontname, size);
}
else if ( msg == "Marks/Autogen(QString)" )
{
QString info;
stream >> info;
do_autogen(info);
}
else if ( msg == "File/StartBlock()" )
{
editMark();
}
else if ( msg == "File/CopyBlock()" )
{
editCopy();
}
-}
+ */
#endif
+}
+
ActionTypes QTReaderApp::ActNameToInt(const QString& _enc)
{
for (int i = 0; i < MAX_ACTIONS; i++)
{
if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i;
}
return cesAutoScroll;
}
+void QTReaderApp::setinverted(bool sfs)
+{
+ reader->setInverse(sfs);
+ reader->setfilter(reader->getfilter());
+ reader->refresh();
+}
+
+void QTReaderApp::setrotated(bool sfs)
+{
+ reader->setrotated(sfs);
+ if (sfs)
+ {
+ m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom );
+ if (m_scrollbar != NULL)
+ {
+ scrollbar->disconnect();
+ m_scrollbar->setOrientation(Qt::Horizontal);
+ connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) );
+ connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) );
+ connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) );
+ connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) );
+ connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) );
+ }
+ // reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border);
+ reader->repaint();
+ }
+ else
+ {
+ m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight );
+ if (m_scrollbar != NULL)
+ {
+ scrollbar->disconnect();
+ m_scrollbar->setOrientation(Qt::Vertical);
+ connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) );
+ connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) );
+ connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) );
+ connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) );
+ connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) );
+ }
+ // reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height());
+ reader->repaint();
+ }
+ // reader->update();
+}
+
+void QTReaderApp::setgrab(bool sfs)
+{
+#ifdef USEQPE
+ m_grabkeyboard = sfs;
+ if (m_grabkeyboard)
+ {
+ ((QPEApplication*)qApp)->grabKeyboard();
+ }
+ else
+ {
+ ((QPEApplication*)qApp)->ungrabKeyboard();
+ }
+#endif
+}
+
void QTReaderApp::setfullscreen(bool sfs)
{
reader->bDoUpdates = false;
m_fullscreen = sfs;
showEditTools();
// qApp->processEvents();
reader->bDoUpdates = true;
reader->update();
}
-
+/*
void QTReaderApp::buttonActionSelected(QAction* _a)
{
-//// odebug << "es:" << _a << " : " << (const char *)(_a->text()) << " (" << ActNameToInt(_a->text()) << ")" << oendl;
+//// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text()));
m_spaceTarget = ActNameToInt(_a->text());
}
-
+*/
QTReaderApp::~QTReaderApp()
{
}
void QTReaderApp::autoScroll(bool _b)
{
reader->setautoscroll(_b);
setScrollState(reader->m_autoScroll);
}
void QTReaderApp::zoomin()
{
reader->zoomin();
+ QFont f(reader->m_fontname, reader->m_fontControl.getsize(0));
+ m_prog->setFont( f );
}
void QTReaderApp::zoomout()
{
reader->zoomout();
+ QFont f(reader->m_fontname, reader->m_fontControl.getsize(0));
+ m_prog->setFont( f );
}
void QTReaderApp::clearBkmkList()
{
delete pBkmklist;
- pBkmklist = NULL;
+ reader->pBkmklist = pBkmklist = NULL;
m_fBkmksChanged = false;
+ reader->refresh(true);
}
void QTReaderApp::fileClose()
{
CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this);
if (cd->exec())
{
if (pOpenlist != NULL)
{
int ind = 0;
Bkmk* p = (*pOpenlist)[ind];
while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
{
p = (*pOpenlist)[++ind];
}
if (p != NULL) pOpenlist->erase(ind);
if (cd->delFile())
{
unlink((const char*)reader->m_lastfile);
}
if (cd->delMarks())
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR);
d.remove(reader->m_string);
#else /* USEQPE */
unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string));
#endif /* USEQPE */
}
if (cd->delConfig())
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR "/configs");
d.remove(reader->m_string);
#else /* USEQPE */
unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string));
#endif /* USEQPE */
}
}
fileOpen2();
}
delete cd;
}
void QTReaderApp::updatefileinfo()
{
if (reader->m_string.isEmpty()) return;
if (reader->m_lastfile.isEmpty()) return;
tchar* nm = fromQString(reader->m_string);
tchar* fl = fromQString(reader->m_lastfile);
-// odebug << "Lastfile:" << fl << "" << oendl;
+// qDebug("Lastfile:%x", fl);
bool notadded = true;
if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>;
else
{
for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
{
if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0)
{
iter->value(reader->pagelocate());
unsigned short dlen;
unsigned char* data;
CFiledata fd(iter->anno());
reader->setSaveData(data, dlen, fd.content(), fd.length());
-// odebug << "Filedata(1):" << fd.length() << ", " << dlen << "" << oendl;
+// qDebug("Filedata(1):%u, %u", fd.length(), dlen);
// getstate(data, dlen);
iter->setAnno(data, dlen);
notadded = false;
delete [] data;
break;
}
}
}
-// odebug << "Added?:" << notadded << "" << oendl;
+// qDebug("Added?:%x", notadded);
if (notadded)
{
struct stat fnstat;
stat((const char *)reader->m_lastfile, &fnstat);
CFiledata fd(fnstat.st_mtime, fl);
unsigned short dlen;
unsigned char* data;
reader->setSaveData(data, dlen, fd.content(), fd.length());
pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate()));
-// odebug << "Filedata(2):" << fd.length() << ", " << dlen << "" << oendl;
+// qDebug("Filedata(2):%u, %u", fd.length(), dlen);
delete [] data;
}
delete [] nm;
delete [] fl;
}
void QTReaderApp::fileOpen()
{
/*
menu->hide();
fileBar->hide();
if (regVisible) regBar->hide();
if (searchVisible) searchBar->hide();
*/
-// odebug << "fileOpen" << oendl;
+// qDebug("fileOpen");
// if (!reader->m_lastfile.isEmpty())
updatefileinfo();
fileOpen2();
}
void QTReaderApp::fileOpen2()
{
if (pBkmklist != NULL)
{
if (m_fBkmksChanged)
{
if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0)
savebkmks();
}
delete pBkmklist;
- pBkmklist = NULL;
+ reader->pBkmklist = pBkmklist = NULL;
m_fBkmksChanged = false;
}
reader->disableAutoscroll();
/*
editorStack->raiseWidget( fileSelector );
fileSelector->reread();
*/
bool usebrowser = true;
if (pOpenlist != NULL)
{
m_nBkmkAction = cOpenFile;
if (listbkmk(pOpenlist, "Browse")) usebrowser = false;
}
if (usebrowser)
{
QString fn = usefilebrowser();
// qApp->processEvents();
if (!fn.isEmpty() && QFileInfo(fn).isFile())
{
openFile(fn);
}
reader->setFocus();
}
// reader->refresh();
-// odebug << "HEIGHT:" << reader->m_lastheight << "" << oendl;
+// qDebug("HEIGHT:%d", reader->m_lastheight);
}
QString QTReaderApp::usefilebrowser()
{
#ifndef USEQPE
QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) );
return s;
#else
+ QString fn;
+#ifdef OPIE
+ QMap<QString, QStringList> mimeTypes;
+ QStringList etypes;
+ etypes << "etext/*";
+ mimeTypes.insert( tr("eText"), etypes );
+ QStringList types;
+ types << "text/*";
+ mimeTypes.insert( tr("Text"), types );
+ mimeTypes.insert( tr("All"), "*/*" );
+ fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader");
+#else
fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog,
0,
// WStyle_Customize | WStyle_NoBorderEx,
"*", QFileInfo(reader->m_lastfile).dirPath(true));
- QString fn;
if (fb->exec())
{
fn = fb->getCurrentFile();
}
-// odebug << "Selected " << fn << "" << oendl;
+// qDebug("Selected %s", (const char*)fn);
delete fb;
+#endif
showEditTools();
return fn;
#endif
}
void QTReaderApp::showgraphic(QImage& pm)
{
- QPixmap pc;
- pc.convertFromImage(pm);
- m_graphicwin->setPixmap(pc);
+ m_graphicwin->setImage(pm);
editorStack->raiseWidget( m_graphicwin );
+ hidetoolbars();
m_graphicwin->setFocus();
}
+void QTReaderApp::showbuttonprefs()
+{
+ editorStack->raiseWidget( m_buttonprefs );
+ hidetoolbars();
+ m_buttonprefs->setFocus();
+ m_kmapchanged = true;
+}
void QTReaderApp::showprefs()
{
- CPrefs* prefwin = new CPrefs(!m_bFloatingDialog, this);
-
+ CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this);
+
+ // prefwin->Debounce(m_debounce);
+ prefwin->bgtype(m_bgtype);
+ prefwin->repalm(reader->brepalm);
+ prefwin->kern(reader->bkern);
+ prefwin->hyphenate(reader->hyphenate);
+ // prefwin->customhyphen(reader->buffdoc.getCustomHyphen());
+ prefwin->scrolltype(reader->m_scrolltype);
+ prefwin->scrollstep(reader->m_scrollstep);
+ prefwin->scrollcolor(m_scrollcolor);
+ prefwin->minibarcol(m_scrollbarcolor);
+ prefwin->foreground(m_foreground);
+ prefwin->background(m_background);
prefwin->twotouch(m_twoTouch);
prefwin->propfontchange(m_propogatefontchange);
prefwin->StripCR(reader->bstripcr);
prefwin->Dehyphen(reader->bdehyphen);
prefwin->SingleSpace(reader->bonespace);
prefwin->Unindent(reader->bunindent);
prefwin->Reparagraph(reader->brepara);
prefwin->DoubleSpace(reader->bdblspce);
prefwin->Remap(reader->bremap);
prefwin->Embolden(reader->bmakebold);
prefwin->FullJustify(reader->bfulljust);
+ // prefwin->Inverse(reader->bInverse);
+ // prefwin->Negative(reader->bNegative);
+ prefwin->FixGraphics(reader->m_fontControl.FixGraphics());
prefwin->ParaLead(reader->getextraspace());
prefwin->LineLead(reader->getlead());
- prefwin->Margin(reader->m_border);
+ prefwin->TopMargin(reader->m_abstopmargin);
+ prefwin->BottomMargin(reader->m_absbottommargin);
+ prefwin->LeftMargin(reader->m_absleft_border);
+ prefwin->RightMargin(reader->m_absright_border);
prefwin->Indent(reader->bindenter);
if (reader->bautofmt)
{
prefwin->Markup(0);
}
else if (reader->btextfmt)
{
prefwin->Markup(2);
}
else if (reader->bstriphtml)
{
prefwin->Markup(3);
}
else if (reader->bpeanut)
{
prefwin->Markup(4);
}
else
{
prefwin->Markup(1);
}
prefwin->Depluck(reader->bdepluck);
prefwin->Dejpluck(reader->bdejpluck);
prefwin->Continuous(reader->m_continuousDocument);
prefwin->dictApplication(m_targetapp);
prefwin->dictMessage(m_targetmsg);
- prefwin->spaceAction(m_spaceTarget);
- prefwin->escapeAction(m_escapeTarget);
- prefwin->returnAction(m_returnTarget);
- prefwin->leftAction(m_leftTarget);
- prefwin->rightAction(m_rightTarget);
- prefwin->upAction(m_upTarget);
- prefwin->downAction(m_downTarget);
-
+ /*
prefwin->leftScroll(m_leftScroll);
prefwin->rightScroll(m_rightScroll);
prefwin->upScroll(m_upScroll);
prefwin->downScroll(m_downScroll);
+ */
prefwin->miscannotation(m_doAnnotation);
prefwin->miscdictionary(m_doDictionary);
prefwin->miscclipboard(m_doClipboard);
prefwin->SwapMouse(reader->m_swapmouse);
prefwin->Font(reader->m_fontname);
prefwin->gfxsize(reader->getBaseSize());
prefwin->pageoverlap(reader->m_overlap);
prefwin->ideogram(reader->m_bMonoSpaced);
prefwin->encoding(reader->m_encd);
prefwin->ideogramwidth(reader->m_charpc);
if (prefwin->exec())
{
+ // m_debounce = prefwin->Debounce();
+ reader->brepalm = prefwin->repalm();
+ reader->bkern = prefwin->kern();
+ reader->hyphenate = prefwin->hyphenate();
+ // reader->buffdoc.setCustomHyphen(prefwin->customhyphen());
+ reader->m_scrolltype = prefwin->scrolltype();
+ reader->m_scrollstep = prefwin->scrollstep();
+ m_scrollcolor = prefwin->scrollcolor();
+ setscrollcolour();
+ m_scrollbarcolor = prefwin->minibarcol();
+ setscrollbarcolour();
+ m_foreground = prefwin->foreground();
+ reader->setForeground(getcolour(m_foreground));
+ m_background = prefwin->background();
+ reader->setBackground(getcolour(m_background));
m_twoTouch = prefwin->twotouch();
reader->setTwoTouch(m_twoTouch);
m_touch_action->setOn(m_twoTouch);
reader->bstripcr = prefwin->StripCR();
reader->bdehyphen = prefwin->Dehyphen();
reader->bonespace = prefwin->SingleSpace();
reader->bunindent = prefwin->Unindent();
reader->brepara = prefwin->Reparagraph();
reader->bdblspce = prefwin->DoubleSpace();
reader->bremap = prefwin->Remap();
reader->bmakebold = prefwin->Embolden();
reader->bfulljust = prefwin->FullJustify();
+ // if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse());
+ // if (reader->bNegative != prefwin->Negative()) reader->setNegative();
+ reader->m_fontControl.FixGraphics(prefwin->FixGraphics());
+
reader->setextraspace(prefwin->ParaLead());
reader->setlead(prefwin->LineLead());
- reader->m_border = prefwin->Margin();
+ reader->m_abstopmargin = prefwin->TopMargin();
+ reader->m_absbottommargin = prefwin->BottomMargin();
+ reader->m_absleft_border = prefwin->LeftMargin();
+ reader->m_absright_border = prefwin->RightMargin();
reader->bindenter = prefwin->Indent();
reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false;
switch (prefwin->Markup())
{
case 0:
reader->bautofmt = true;
break;
case 1:
break;
case 2:
reader->btextfmt = true;
break;
case 3:
reader->bstriphtml = true;
break;
case 4:
reader->bpeanut = true;
break;
default:
- odebug << "Format out of range" << oendl;
+ qDebug("Format out of range");
}
reader->bdepluck = prefwin->Depluck();
reader->bdejpluck = prefwin->Dejpluck();
reader->setContinuous(prefwin->Continuous());
- m_spaceTarget = (ActionTypes)prefwin->spaceAction();
- m_escapeTarget = (ActionTypes)prefwin->escapeAction();
- m_returnTarget = (ActionTypes)prefwin->returnAction();
- m_leftTarget = (ActionTypes)prefwin->leftAction();
- m_rightTarget = (ActionTypes)prefwin->rightAction();
- m_upTarget = (ActionTypes)prefwin->upAction();
- m_downTarget = (ActionTypes)prefwin->downAction();
+ /*
m_leftScroll = prefwin->leftScroll();
m_rightScroll = prefwin->rightScroll();
m_upScroll = prefwin->upScroll();
m_downScroll = prefwin->downScroll();
-
+ */
m_targetapp = prefwin->dictApplication();
m_targetmsg = prefwin->dictMessage();
m_doAnnotation = prefwin->miscannotation();
m_doDictionary = prefwin->miscdictionary();
m_doClipboard = prefwin->miscclipboard();
reader->m_swapmouse = prefwin->SwapMouse();
reader->setBaseSize(prefwin->gfxsize());
reader->m_overlap = prefwin->pageoverlap();
reader->m_bMonoSpaced = prefwin->ideogram();
m_setmono_action->setOn(reader->m_bMonoSpaced);
reader->m_encd = prefwin->encoding();
reader->m_charpc = prefwin->ideogramwidth();
if (
reader->m_fontname != prefwin->Font()
||
m_propogatefontchange != prefwin->propfontchange())
{
m_propogatefontchange = prefwin->propfontchange();
setfontHelper(prefwin->Font());
}
+ if (m_bgtype != (bground)prefwin->bgtype())
+ {
+ m_bgtype = (bground)prefwin->bgtype();
+ setBackgroundBitmap();
+ }
delete prefwin;
reader->setfilter(reader->getfilter());
reader->refresh();
-
}
else
{
delete prefwin;
}
}
void QTReaderApp::showtoolbarprefs()
{
#ifdef USEQPE
CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this);
#else
QFileInfo fi;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/%s\" directory", APPDIR );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
fi.setFile(d, INIFILE);
CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this);
#endif
prefwin->tbpolicy(m_tbpolsave);
prefwin->tbposition(m_tbposition-2);
prefwin->tbmovable(m_tbmovesave);
prefwin->floating(m_bFloatingDialog);
+ prefwin->qtscroll(m_qtscroll);
+ prefwin->localscroll(m_localscroll);
if (prefwin->exec())
{
m_bFloatingDialog = prefwin->floating();
if (
m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy()
||
m_tbposition != (ToolBarDock)(prefwin->tbposition()+2)
||
m_tbmovesave != prefwin->tbmovable()
+ ||
+ m_qtscroll != prefwin->qtscroll()
+ // ||
+ // m_localscrollbar != prefwin->scrollonleft()
)
{
QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started");
}
m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy();
m_tbposition = (ToolBarDock)(prefwin->tbposition()+2);
m_tbmovesave = prefwin->tbmovable();
+ reader->m_scrollpos = m_localscroll = prefwin->localscroll();
+ if (m_qtscroll != prefwin->qtscroll())
+ {
+ m_qtscroll = prefwin->qtscroll();
+ setrotated(reader->m_rotated);
+ }
+ if (m_scrollbar == NULL || m_scrollbar->isHidden())
+ {
+ reader->m_scrollpos = m_localscroll;
+ }
+ else
+ {
+ reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0;
+ }
bool isChanged = prefwin->isChanged();
delete prefwin;
#ifdef USEQPE
Config config( APPDIR );
#else
QFileInfo fi;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/%s\" directory", APPDIR );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
fi.setFile(d, INIFILE);
Config config( fi.absFilePath() );
#endif
if (isChanged) addtoolbars(&config);
}
else
{
delete prefwin;
}
}
void QTReaderApp::showinfo()
{
- unsigned long fs, ts, pl;
+ unsigned long ds, fs, ts, pl, dl;
if (reader->empty())
{
QMessageBox::information(this, PROGNAME, "No file loaded", 1);
}
else
{
reader->sizes(fs,ts);
+ ds = reader->buffdoc.endSection() - reader->buffdoc.startSection();
pl = reader->pagelocate();
+ dl = pl - reader->buffdoc.startSection();
m_infoWin->setFileSize(fs);
m_infoWin->setTextSize(ts);
m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts);
m_infoWin->setLocation(pl);
m_infoWin->setRead((100*pl + (ts >> 1))/ts);
+ m_infoWin->setDocSize(ds);
+ m_infoWin->setDocLocation(dl);
+ m_infoWin->setDocRead((100*dl + (ds >> 1))/ds);
+ m_infoWin->setZoom(reader->m_fontControl.currentsize()*10);
+ m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about());
editorStack->raiseWidget( m_infoWin );
+ hidetoolbars();
m_infoWin->setFocus();
}
}
-void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
+void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2)
{
- if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
+ if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>;
#ifdef _UNICODE
CBuffer buff(name.length()+1);
int i;
for (i = 0; i < name.length(); i++)
{
buff[i] = name[i].unicode();
}
buff[i] = 0;
CBuffer buff2(text.length()+1);
for (i = 0; i < text.length(); i++)
{
buff2[i] = text[i].unicode();
}
buff2[i] = 0;
- pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn));
+ Bkmk b(buff.data(), buff2.data(), posn, posn2);
+ QColor c = m_annoWin->getColor();
+ int red,green,blue;
+ c.rgb(&red, &green, &blue);
+ b.red(red);
+ b.green(green);
+ b.blue(blue);
+ pBkmklist->push_front(b);
#else
pBkmklist->push_front(Bkmk((const tchar*)text,posn));
#endif
m_fBkmksChanged = true;
pBkmklist->sort();
}
void QTReaderApp::addAnno(const QString& name, const QString& text)
{
if (m_annoIsEditing)
{
if (name.isEmpty())
{
QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1);
}
else
{
- addAnno(name, text, m_annoWin->getPosn());
+ addAnno(name, text, m_annoWin->getPosn(), m_annoWin->getPosn2());
}
showEditTools();
}
else
{
if (m_annoWin->edited())
{
CBuffer buff(text.length()+1);
int i;
for (i = 0; i < text.length(); i++)
{
buff[i] = text[i].unicode();
}
buff[i] = 0;
m_fBkmksChanged = true;
m_anno->setAnno(buff.data());
}
+ QColor c = m_annoWin->getColor();
+ int red,green,blue;
+ c.rgb(&red, &green, &blue);
+ m_anno->red(red);
+ m_anno->green(green);
+ m_anno->blue(blue);
bool found = findNextBookmark(m_anno->value()+1);
if (found)
{
m_annoWin->setName(toQString(m_anno->name()));
m_annoWin->setAnno(toQString(m_anno->anno()));
+ m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue()));
}
else
{
showEditTools();
}
}
}
bool QTReaderApp::findNextBookmark(size_t start)
{
bool found = false;
for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++)
{
if (iter->value() >= start)
{
if (iter->value() < reader->locate())
{
found = true;
m_anno = iter.pContent();
}
break;
}
}
return found;
}
void QTReaderApp::addanno()
{
if (reader->empty())
{
QMessageBox::information(this, PROGNAME, "No file loaded", 1);
}
else
{
m_annoWin->setName("");
m_annoWin->setAnno("");
m_annoWin->setPosn(reader->pagelocate());
m_annoIsEditing = true;
editorStack->raiseWidget( m_annoWin );
+ hidetoolbars();
#ifdef USEQPE
Global::showInputMethod();
#endif
m_annoWin->setFocus();
}
}
void QTReaderApp::infoClose()
{
+ m_debounce = m_buttonprefs->Debounce();
+ if (m_kmapchanged)
+ {
+ m_kmapchanged = false;
+#ifndef USEQPE
+ QDir d = QDir::home(); // "/"
+ d.cd(APPDIR);
+ QFileInfo fi(d, ".keymap");
+ FILE* f = fopen((const char *)fi.absFilePath(), "w");
+#else /* USEQPE */
+ FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "w");
+#endif /* USEQPE */
+ if (f != NULL)
+ {
+ uint cnt = KEYMAPVERSION;
+ fwrite(&cnt, sizeof(cnt), 1, f);
+ cnt = kmap.count();
+ fwrite(&cnt, sizeof(cnt), 1, f);
+ for (QMap<orKey,int>::Iterator i = kmap.begin(); i != kmap.end(); i++)
+ {
+ orKey key = i.key();
+ int data = i.data();
+ fwrite(&key, sizeof(key), 1, f);
+ fwrite(&data, sizeof(data), 1, f);
+ qDebug("Saved %s as %u", (const char*)key.text(), data);
+ }
+ fclose(f);
+ }
+ }
showEditTools();
}
/*
void QTReaderApp::fileRevert()
{
clear();
fileOpen();
}
void QTReaderApp::editCut()
{
#ifndef QT_NO_CLIPBOARD
editor->cut();
#endif
}
*/
void QTReaderApp::editMark()
{
m_savedpos = reader->pagelocate();
}
void QTReaderApp::editCopy()
{
QClipboard* cb = QApplication::clipboard();
QString text;
int ch;
unsigned long currentpos = reader->pagelocate();
unsigned long endpos = reader->locate();
if (m_savedpos == 0xffffffff)
{
m_savedpos = currentpos;
}
reader->jumpto(m_savedpos);
while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF)
{
text += ch;
}
cb->setText(text);
reader->locate(currentpos);
m_savedpos = 0xffffffff;
}
void QTReaderApp::gotoStart()
{
reader->locate(reader->buffdoc.startSection());
}
void QTReaderApp::gotoEnd()
{
reader->dopageup(reader->buffdoc.endSection());
}
void QTReaderApp::pageup()
{
reader->NavUp();
}
void QTReaderApp::pagedn()
{
reader->NavDown();
}
void QTReaderApp::pagemode(bool _b)
{
reader->setpagemode(_b);
}
/*
void QTReaderApp::setspacing()
{
m_nRegAction = cMonoSpace;
char lcn[20];
sprintf(lcn, "%lu", reader->m_charpc);
regEdit->setText(lcn);
do_regedit();
}
*/
void QTReaderApp::settarget()
{
m_nRegAction = cSetTarget;
QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp)
+ "/"
+ ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg);
regEdit->setText(text);
do_regedit();
}
/*
void QTReaderApp::do_mono(const QString& lcn)
{
bool ok;
unsigned long ulcn = lcn.toULong(&ok);
if (ok)
{
reader->m_charpc = ulcn;
reader->setfont();
reader->refresh();
// reader->setmono(true);
}
else
QMessageBox::information(this, PROGNAME, "Must be a number");
}
*/
/*
void QTReaderApp::editPaste()
{
#ifndef QT_NO_CLIPBOARD
editor->paste();
#endif
}
*/
void QTReaderApp::editFind()
{
searchStart = reader->pagelocate();
#ifdef __ISEARCH
searchStack = new QStack<searchrecord>;
#endif
#ifdef USEQPE
Global::showInputMethod();
#endif
searchBar->show();
searchVisible = TRUE;
searchEdit->setFocus();
#ifdef __ISEARCH
searchStack->push(new searchrecord("",reader->pagelocate()));
#endif
}
void QTReaderApp::findNext()
{
-// // odebug << "findNext called\n" << oendl;
+// // qDebug("findNext called\n");
#ifdef __ISEARCH
QString arg = searchEdit->text();
#else
QRegExp arg = searchEdit->text();
#endif
CDrawBuffer test(&(reader->m_fontControl));
size_t start = reader->pagelocate();
reader->jumpto(start);
reader->getline(&test);
dosearch(start, test, arg);
}
void QTReaderApp::findClose()
{
searchVisible = FALSE;
searchEdit->setText("");
#ifdef USEQPE
Global::hideInputMethod();
#endif
searchBar->hide();
#ifdef __ISEARCH
// searchStack = new QStack<searchrecord>;
while (!searchStack->isEmpty())
{
delete searchStack->pop();
}
delete searchStack;
#endif
reader->setFocus();
}
void QTReaderApp::regClose()
{
regVisible = FALSE;
regEdit->setText("");
regBar->hide();
#ifdef USEQPE
Global::hideInputMethod();
#endif
reader->setFocus();
}
#ifdef __ISEARCH
bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg)
#else
bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
#endif
{
bool ret = true;
unsigned long fs, ts;
reader->sizes(fs,ts);
size_t pos = reader->locate();
pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height());
pbar->show();
pbar->raise();
pbar->reset();
int offset;
int lastpc = (100*pos)/ts;
pbar->setProgress(lastpc);
// qApp->processEvents();
if (reader->buffdoc.getpara(test) >= 0)
{
reader->setFocus();
#ifdef __ISEARCH
while (strstr(test.data(),(const tchar*)arg) == NULL)
#else
#ifdef _UNICODE
while ((offset = arg.match(toQString(test.data()))) == -1)
#else
while (arg.match(test.data()) == -1)
#endif
#endif
{
pos = reader->locate();
int pc = (100*pos)/ts;
if (pc != lastpc)
{
pbar->setProgress(pc);
qApp->processEvents();
reader->setFocus();
lastpc = pc;
}
if (reader->buffdoc.getpara(test) < 0)
{
if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
pos = searchStart;
else
pos = start;
findClose();
pbar->hide();
reader->locate(pos);
return false;
}
}
-// odebug << "Found it at " << pos << ":" << offset << "" << oendl;
+// qDebug("Found it at %u:%u", pos, offset);
pbar->hide();
-// odebug << "Hid" << oendl;
+// qDebug("Hid");
reader->locate(pos+offset);
-// odebug << "Loacted" << oendl;
-// odebug << "page up" << oendl;
+// qDebug("Loacted");
+// qDebug("page up");
ret = true;
}
else
{
if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
pos = searchStart;
else
pos = start;
ret = false;
findClose();
}
return ret;
}
#ifdef __ISEARCH
void QTReaderApp::search(const QString & arg)
{
searchrecord* ss = searchStack->top();
CBuffer test;
size_t start = reader->pagelocate();
bool haspopped = false;
while (arg.left(ss->s.length()) != ss->s)
{
haspopped = true;
start = ss->pos;
// reader->locate(start);
searchStack->pop();
delete ss;
}
if (haspopped) reader->locate(start);
/*
if (arg.length() < ss->len)
{
start = ss->pos;
reader->locate(start);
searchStack->pop();
delete ss;
}
*/
else
{
start = reader->pagelocate();
reader->jumpto(start);
searchStack->push(new searchrecord(arg,start));
}
dosearch(start, test, arg);
}
#else
void QTReaderApp::search()
{
findNext();
}
#endif
void QTReaderApp::openFile( const QString &f )
{
-// odebug << "File:" << f << "" << oendl;
+// qDebug("File:%s", (const char*)f);
// openFile(DocLnk(f));
//}
//
//void QTReaderApp::openFile( const DocLnk &f )
//{
clear();
QFileInfo fm(f);
if ( fm.exists() )
{
// QMessageBox::information(0, "Progress", "Calling fileNew()");
#ifdef USEQPE
if (fm.extension( FALSE ) == "desktop")
{
DocLnk d(f);
QFileInfo fnew(d.file());
fm = fnew;
if (!fm.exists()) return;
}
#endif
clear();
-
reader->setText(fm.baseName(), fm.absFilePath());
- m_loadedconfig = readconfig(reader->m_string, false);
+ m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false);
+ qDebug("Showing tools");
showEditTools();
+ qDebug("Shown tools");
readbkmks();
+ qDebug("read markss");
m_savedpos = 0xffffffff;
}
else
{
- QMessageBox::information(this, PROGNAME, "File does not exist");
+ QString msg = f;
+ msg += "\nFile does not exist";
+ QMessageBox::information(this, PROGNAME, msg);
reader->m_lastfile = QString::null;
}
}
/*
void QTReaderApp::resizeEvent(QResizeEvent* e)
{
if (m_fullscreen)
{
showNormal();
showFullScreen();
}
}
*/
void QTReaderApp::handlekey(QKeyEvent* e)
{
-// odebug << "Keypress event" << oendl;
+// qDebug("Keypress event");
timeb now;
ftime(&now);
unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm;
if (etime < m_debounce)
{
return;
}
- m_lastkeytime = now;
switch(e->key())
{
case Key_Escape:
-// odebug << "escape event" << oendl;
+// qDebug("escape event");
if (m_disableesckey)
{
m_disableesckey = false;
}
else
{
m_bcloseDisabled = true;
if (m_fullscreen)
{
m_actFullscreen->setOn(false);
e->accept();
}
else
{
-// odebug << "escape action" << oendl;
- doAction(m_escapeTarget, e);
+// qDebug("escape action");
+ doAction(e);
}
}
break;
- case Key_Space:
- {
- doAction(m_spaceTarget, e);
- }
- break;
- case Key_Return:
- {
- doAction(m_returnTarget, e);
- }
- break;
+ /*
case Key_Left:
{
- if (reader->m_autoScroll && m_leftScroll)
+ if (reader->m_autoScroll)
{
reader->reduceScroll();
}
else
{
- doAction(m_leftTarget, e);
+ doAction(e);
}
}
break;
case Key_Right:
{
- if (reader->m_autoScroll && m_rightScroll)
+ if (reader->m_autoScroll)
{
reader->increaseScroll();
}
else
{
- doAction(m_rightTarget, e);
+ doAction(e);
}
}
break;
case Key_Up:
{
- if (reader->m_autoScroll && m_upScroll)
+ if (reader->m_autoScroll)
{
reader->increaseScroll();
}
else
{
- doAction(m_upTarget, e);
+ doAction(e);
}
}
break;
case Key_Down:
{
- if (reader->m_autoScroll && m_downScroll)
+ if (reader->m_autoScroll)
{
reader->reduceScroll();
}
else
{
- doAction(m_downTarget, e);
+ doAction(e);
}
}
break;
+ */
default:
{
- e->ignore();
+ doAction(e);
}
/*
QString msg("Key press was:");
QString key;
msg += key.setNum(e->key());
QMessageBox::information(this, PROGNAME, msg);
*/
}
+ ftime(&m_lastkeytime);
+}
+
+#ifdef NEWFULLSCREEN
+void QTReaderApp::enableFullscreen()
+{
+ setFixedSize(qApp->desktop()->size());
+ showNormal();
+ reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
+ showFullScreen();
}
+void QTReaderApp::resizeEvent(QResizeEvent *)
+{
+ if (m_fullscreen && (size() != qApp->desktop()->size()))
+ {
+ enableFullscreen();
+ }
+}
+
+void QTReaderApp::focusInEvent(QFocusEvent*)
+{
+ if (m_fullscreen)
+ {
+ enableFullscreen();
+ raise();
+ }
+}
+#endif
+
void QTReaderApp::showEditTools()
{
// if ( !doc )
// close();
if (m_fullscreen)
{
+#ifdef USEQPE
if (menubar != NULL) menubar->hide();
+#endif
if (fileBar != NULL) fileBar->hide();
if (viewBar != NULL) viewBar->hide();
if (navBar != NULL) navBar->hide();
if (markBar != NULL) markBar->hide();
+ if (m_prog != NULL)
+ {
+ // qDebug("Hiding status");
+ m_prog->hide();
+ }
searchBar->hide();
regBar->hide();
#ifdef USEQPE
Global::hideInputMethod();
#endif
+ if (m_scrollbar != NULL) m_scrollbar->hide();
m_fontBar->hide();
// showNormal();
+#ifdef NEWFULLSCREEN
+ enableFullscreen();
+#else
showFullScreen();
+#endif
}
else
{
-// odebug << "him" << oendl;
+// qDebug("him");
#ifdef USEQPE
Global::hideInputMethod();
#endif
-// odebug << "eb" << oendl;
+// qDebug("eb");
+ if (m_scrollbar != NULL)
+ {
+ if (m_scrollishidden)
+ {
+ m_scrollbar->hide();
+ }
+ else
+ {
+ m_scrollbar->show();
+ }
+ }
+ if (!m_hidebars)
+ {
+#ifdef USEQPE
menubar->show();
+#endif
if (fileBar != NULL) fileBar->show();
if (viewBar != NULL) viewBar->show();
if (navBar != NULL) navBar->show();
if (markBar != NULL) markBar->show();
+ if (m_prog != NULL && !m_statusishidden)
+ {
+ // qDebug("Showing status");
+ m_prog->show();
+ // qDebug("Shown status");
+ }
+ // qDebug("Showing mb");
mb->show();
+ }
if ( searchVisible )
{
#ifdef USEQPE
Global::showInputMethod();
#endif
searchBar->show();
}
if ( regVisible )
{
#ifdef USEQPE
Global::showInputMethod();
#endif
regBar->show();
}
if (m_fontVisible) m_fontBar->show();
-// odebug << "sn" << oendl;
+// qDebug("sn");
showNormal();
-// odebug << "sm" << oendl;
+// qDebug("sm");
#ifdef USEQPE
showMaximized();
#endif
// setCentralWidget(reader);
}
-// odebug << "uc" << oendl;
+ // qDebug("uc");
updateCaption();
-// odebug << "rw" << oendl;
+ // qDebug("rw");
editorStack->raiseWidget( reader );
-// odebug << "sf" << oendl;
+ // qDebug("sf");
reader->setFocus();
- reader->refresh();
+ // qDebug("ref");
+ reader->refresh(true);
+ // qDebug("done");
}
/*
void QTReaderApp::save()
{
if ( !doc )
return;
if ( !editor->edited() )
return;
QString rt = editor->text();
QString pt = rt;
if ( doc->name().isEmpty() ) {
unsigned ispace = pt.find( ' ' );
unsigned ienter = pt.find( '\n' );
int i = (ispace < ienter) ? ispace : ienter;
QString docname;
if ( i == -1 ) {
if ( pt.isEmpty() )
docname = "Empty Text";
else
docname = pt;
} else {
docname = pt.left( i );
}
doc->setName(docname);
}
FileManager fm;
fm.saveFile( *doc, rt );
}
*/
void QTReaderApp::clear()
{
// if (doc != 0)
// {
// QMessageBox::information(this, PROGNAME, "Deleting doc", 1);
// delete doc;
// QMessageBox::information(this, PROGNAME, "Deleted doc", 1);
// doc = 0;
// }
reader->clear();
}
void QTReaderApp::updateCaption()
{
// if ( !doc )
// setCaption( tr("QTReader") );
// else {
// QString s = doc->name();
// if ( s.isEmpty() )
// s = tr( "Unnamed" );
- setCaption( reader->m_string + " - " + tr("Reader") );
+ setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) );
// }
}
void QTReaderApp::setDocument(const QString& fileref)
{
- bFromDocView = TRUE;
//QMessageBox::information(0, "setDocument", fileref);
openFile(fileref);
// showEditTools();
}
void QTReaderApp::closeEvent( QCloseEvent *e )
{
-// odebug << "Close event" << oendl;
+// qDebug("Close event");
if (m_fullscreen)
{
m_fullscreen = false;
showEditTools();
- e->accept();
+ e->ignore();
+ }
+ else if (editorStack->visibleWidget() == m_buttonprefs)
+ {
+ m_buttonprefs->mapkey(Qt::NoButton, Key_Escape);
+ e->ignore();
}
else if (m_dontSave)
{
e->accept();
}
else
{
if (editorStack->visibleWidget() == reader)
{
- if ((m_escapeTarget != cesNone) && m_bcloseDisabled)
+ if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled)
{
-// odebug << "Close disabled" << oendl;
+// qDebug("Close disabled");
m_bcloseDisabled = false;
e->ignore();
}
else
{
if (m_fontVisible)
{
m_fontBar->hide();
m_fontVisible = false;
+ e->ignore();
+ return;
}
if (regVisible)
{
regBar->hide();
#ifdef USEQPE
Global::hideInputMethod();
#endif
regVisible = false;
+ e->ignore();
return;
}
if (searchVisible)
{
searchBar->hide();
#ifdef USEQPE
Global::hideInputMethod();
#endif
searchVisible = false;
+ e->ignore();
return;
}
if (m_fBkmksChanged && pBkmklist != NULL)
{
if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0)
savebkmks();
delete pBkmklist;
- pBkmklist = NULL;
+ reader->pBkmklist = pBkmklist = NULL;
m_fBkmksChanged = false;
}
- bFromDocView = FALSE;
updatefileinfo();
saveprefs();
e->accept();
}
}
else
{
showEditTools();
m_disableesckey = true;
}
}
}
void QTReaderApp::do_gotomark()
{
m_nBkmkAction = cGotoBkmk;
if (!listbkmk(pBkmklist))
QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
}
void QTReaderApp::do_delmark()
{
m_nBkmkAction = cDelBkmk;
if (!listbkmk(pBkmklist))
QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
}
bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab)
{
bkmkselector->clear();
if (_lab.isEmpty())
bkmkselector->setText("Cancel");
else
bkmkselector->setText(_lab);
int cnt = 0;
if (plist != NULL)
{
for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++)
{
#ifdef _UNICODE
-// odebug << "Item:" << toQString(i->name()) << "" << oendl;
+// qDebug("Item:%s", (const char*)toQString(i->name()));
bkmkselector->insertItem(toQString(i->name()));
#else
bkmkselector->insertItem(i->name());
#endif
cnt++;
}
}
if (cnt > 0)
{
hidetoolbars();
editorStack->raiseWidget( bkmkselector );
return true;
}
else
return false;
}
void QTReaderApp::do_autogen()
{
m_nRegAction = cAutoGen;
regEdit->setText(m_autogenstr);
do_regedit();
}
void QTReaderApp::do_regedit()
{
// fileBar->hide();
reader->bDoUpdates = false;
-// odebug << "Showing regbar" << oendl;
+// qDebug("Showing regbar");
regBar->show();
-// odebug << "Showing kbd" << oendl;
+// qDebug("Showing kbd");
#ifdef USEQPE
Global::showInputMethod();
#endif
regVisible = true;
regEdit->setFocus();
// qApp->processEvents();
reader->bDoUpdates = true;
reader->update();
}
bool QTReaderApp::openfrombkmk(Bkmk* bk)
{
QString fn = toQString(
CFiledata(bk->anno()).name()
);
-// odebug << "fileinfo" << oendl;
+// qDebug("fileinfo");
if (!fn.isEmpty() && QFileInfo(fn).isFile())
{
-// odebug << "Opening" << oendl;
+// qDebug("Opening");
openFile(fn);
struct stat fnstat;
stat((const char *)reader->m_lastfile, &fnstat);
if (CFiledata(bk->anno()).date()
!= fnstat.st_mtime)
{
CFiledata fd(bk->anno());
fd.setdate(fnstat.st_mtime);
bk->value(0);
}
else
{
unsigned short svlen = bk->filedatalen();
unsigned char* svdata = bk->filedata();
reader->putSaveData(svdata, svlen);
// setstate(svdata, svlen);
if (svlen != 0)
{
QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?");
}
-// odebug << "updating" << oendl;
+// qDebug("updating");
// showEditTools();
reader->locate(bk->value());
}
return true;
}
else
{
return false;
}
}
void QTReaderApp::gotobkmk(int ind)
{
+ qDebug("gbkmk");
showEditTools();
switch (m_nBkmkAction)
{
case cOpenFile:
{
// qApp->processEvents();
if (!openfrombkmk((*pOpenlist)[ind]))
{
pOpenlist->erase(ind);
QMessageBox::information(this, PROGNAME, "Can't find file");
}
}
break;
case cGotoBkmk:
+ reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate());
reader->locate((*pBkmklist)[ind]->value());
break;
case cDelBkmk:
-//// odebug << "Deleting:" << (*pBkmklist)[ind]->name() << "\n" << oendl;
+//// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name());
pBkmklist->erase(ind);
m_fBkmksChanged = true;
+ reader->refresh(true);
// pBkmklist->sort();
break;
case cRmBkmkFile:
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR);
d.remove(bkmkselector->text(ind));
#else /* USEQPE */
unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind)));
#endif /* USEQPE */
}
break;
case cLdConfig:
- readconfig(bkmkselector->text(ind), false);
+ readconfig(APPDIR "/configs", bkmkselector->text(ind), false);
+ break;
+ case cLdTheme:
+ m_themename = bkmkselector->text(ind);
+ readconfig(QString(APPDIR "/Themes/")+m_themename , "config", false);
+ setBackgroundBitmap();
break;
case cRmConfig:
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR "/configs");
d.remove(bkmkselector->text(ind));
#else /* USEQPE */
unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind)));
#endif /* USEQPE */
}
break;
case cExportLinks:
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR "/urls");
QFileInfo fi(d, bkmkselector->text(ind));
if (fi.exists())
{
QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) );
if (!outfile.isEmpty())
{
FILE* fout = fopen((const char *)outfile, "w");
if (fout != NULL)
{
FILE* fin = fopen((const char *)fi.absFilePath(), "r");
if (fin != NULL)
{
fprintf(fout, "<html><body>\n");
int ch = 0;
while ((ch = fgetc(fin)) != EOF)
{
fputc(ch, fout);
}
fclose(fin);
fprintf(fout, "</html></body>\n");
d.remove(bkmkselector->text(ind));
}
fclose(fout);
}
else
QMessageBox::information(this, PROGNAME, "Couldn't open output");
}
}
#else /* USEQPE */
FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r");
if (fin != NULL)
{
bool allok = false;
+#ifdef OPIE
+ QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader");
+ if (!outfile.isEmpty())
+ {
+ FILE* fout = fopen((const char *)outfile, "w");
+ if (fout != NULL)
+ {
+ fprintf(fout, "<html><body>\n");
+ int ch = 0;
+ while ((ch = fgetc(fin)) != EOF)
+ {
+ fputc(ch, fout);
+ }
+ fprintf(fout, "</html></body>\n");
+ fclose(fout);
+ allok = true;
+ }
+ else
+ QMessageBox::information(this, PROGNAME, "Couldn't open output");
+ }
+ fclose(fin);
+ if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)));
+#else
fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null);
if (fb->exec())
{
QString outfile = fb->getCurrentFile();
FILE* fout = fopen((const char *)outfile, "w");
if (fout != NULL)
{
fprintf(fout, "<html><body>\n");
int ch = 0;
while ((ch = fgetc(fin)) != EOF)
{
fputc(ch, fout);
}
fprintf(fout, "</html></body>\n");
fclose(fout);
allok = true;
}
else
QMessageBox::information(this, PROGNAME, "Couldn't open output");
}
delete fb;
fclose(fin);
if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)));
+#endif
}
else
{
QMessageBox::information(this, PROGNAME, "Couldn't open input");
}
/*
CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE );
int ret = f->exec();
- odebug << "Return:" << ret << "" << oendl;
+ qDebug("Return:%d", ret);
DocLnk* doc = f->getDoc();
if (doc != NULL)
{
FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r");
QString rt;
rt = "<html><body>\n";
int ch = 0;
while ((ch = fgetc(fin)) != EOF)
{
rt += (char)ch;
}
fclose(fin);
rt += "</html></body>\n";
if ( doc->name().isEmpty() )
{
doc->setName(bkmkselector->text(ind));
}
FileManager fm;
fm.saveFile( *doc, rt );
- odebug << "YES" << oendl;
+ qDebug("YES");
}
else
{
- odebug << "NO" << oendl;
+ qDebug("NO");
}
delete f;
*/
#endif /* USEQPE */
}
break;
}
}
void QTReaderApp::cancelbkmk()
{
if (m_nBkmkAction == cOpenFile)
{
QString fn = usefilebrowser();
if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
}
showEditTools();
}
+void QTReaderApp::reparastring()
+{
+ m_nRegAction = cRepara;
+ regEdit->setText(reader->m_reparastring);
+ do_regedit();
+}
+
+void QTReaderApp::do_reparastring(const QString& _lcn)
+{
+ reader->m_reparastring = _lcn;
+ if (reader->brepara)
+ {
+ reader->bDoUpdates = true;
+ reader->setfilter(reader->getfilter());
+ }
+}
+
void QTReaderApp::jump()
{
m_nRegAction = cJump;
char lcn[20];
sprintf(lcn, "%lu", reader->pagelocate());
regEdit->setText(lcn);
do_regedit();
}
-void QTReaderApp::do_jump(const QString& lcn)
+void QTReaderApp::do_jump(const QString& _lcn)
{
bool ok;
+ QString lcn = _lcn.stripWhiteSpace();
unsigned long ulcn = lcn.toULong(&ok);
+ if (!ok)
+ {
+ double pc = 0.0;
+#ifdef _WINDOWS
+ if (lcn.at(lcn.length()-1) == '%')
+#else
+ if (lcn[lcn.length()-1] == '%')
+#endif
+ {
+ lcn = lcn.left(lcn.length()-1);
+ pc = lcn.toDouble(&ok);
+ }
+ else
+ {
+ pc = lcn.toDouble(&ok);
+ }
+ if (ok && 0 <= pc && pc <= 100)
+ {
+ ulcn = (pc*(reader->buffdoc.endSection()-reader->buffdoc.startSection()))/100 + reader->buffdoc.startSection();
+ }
+ else
+ {
+ ok = false;
+ }
+ }
if (ok)
reader->locate(ulcn);
else
- QMessageBox::information(this, PROGNAME, "Must be a number");
+ QMessageBox::information(this, PROGNAME, "Must be a number\nor a percentage");
}
void QTReaderApp::do_regaction()
{
reader->bDoUpdates = false;
regBar->hide();
#ifdef USEQPE
Global::hideInputMethod();
#endif
regVisible = false;
switch(m_nRegAction)
{
case cAutoGen:
do_autogen(regEdit->text());
break;
case cAddBkmk:
do_addbkmk(regEdit->text());
break;
+ case cRepara:
+ do_reparastring(regEdit->text());
+ break;
case cJump:
do_jump(regEdit->text());
break;
/*
case cMonoSpace:
do_mono(regEdit->text());
break;
*/
case cSetTarget:
do_settarget(regEdit->text());
break;
#ifdef _SCROLLPIPE
case cSetPipeTarget:
do_setpipetarget(regEdit->text());
break;
#endif
case cSetConfigName:
-// odebug << "Saving config" << oendl;
+// qDebug("Saving config");
do_saveconfig(regEdit->text(), false);
break;
}
// reader->restore();
// fileBar->show();
reader->setFocus();
// qApp->processEvents();
reader->bDoUpdates = true;
reader->update();
}
void QTReaderApp::do_settarget(const QString& _txt)
{
int ind = _txt.find('/');
if (ind == -1)
{
m_targetapp = "";
m_targetmsg = "";
QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename");
}
else
{
m_targetapp = _txt.left(ind);
m_targetmsg = _txt.right(_txt.length()-ind-1);
}
}
void QTReaderApp::chooseencoding()
{
m_fontSelector->clear();
m_fontSelector->insertItem("Ascii");
m_fontSelector->insertItem("UTF-8");
m_fontSelector->insertItem("UCS-2(BE)");
m_fontSelector->insertItem("USC-2(LE)");
m_fontSelector->insertItem("Palm");
for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++)
{
m_fontSelector->insertItem(iter->mime);
} // delete the FontDatabase!!!
m_fontSelector->setCurrentItem (reader->m_encd);
m_fontAction = cChooseEncoding;
m_fontBar->show();
m_fontVisible = true;
}
void QTReaderApp::setfont()
{
m_fontSelector->clear();
{
-#ifdef USEQPE
- FontDatabase f;
-#else
QFontDatabase f;
-#endif
QStringList flist = f.families();
m_fontSelector->insertStringList(flist);
} // delete the FontDatabase!!!
for (int i = 1; i <= m_fontSelector->count(); i++)
{
if (m_fontSelector->text(i) == reader->m_fontname)
{
m_fontSelector->setCurrentItem(i);
break;
}
}
m_fontAction = cChooseFont;
m_fontBar->show();
m_fontVisible = true;
}
void QTReaderApp::setfontHelper(const QString& lcn, int size)
{
if (size == 0) size = reader->m_fontControl.currentsize();
if (m_propogatefontchange)
{
QFont f(lcn, 10);
bkmkselector->setFont( f );
regEdit->setFont( f );
searchEdit->setFont( f );
m_annoWin->setFont( f );
}
reader->m_fontname = lcn;
if (!reader->ChangeFont(size))
{
reader->ChangeFont(size);
}
}
void QTReaderApp::do_setencoding(int i)
{
-// odebug << "setencoding:" << i << "" << oendl;
+ qDebug("setencoding:%d", i);
if (m_fontAction == cChooseEncoding)
{
reader->setencoding(i);
}
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
-// odebug << "showedit" << oendl;
+// qDebug("showedit");
if (reader->isVisible()) showEditTools();
-// odebug << "showeditdone" << oendl;
+// qDebug("showeditdone");
}
void QTReaderApp::do_setfont(const QString& lcn)
{
if (m_fontAction == cChooseFont)
{
setfontHelper(lcn);
}
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
-// odebug << "showedit" << oendl;
+ // qDebug("setfont");
//if (reader->isVisible())
showEditTools();
-// odebug << "showeditdone" << oendl;
+// qDebug("showeditdone");
}
void QTReaderApp::do_autogen(const QString& regText)
{
unsigned long fs, ts;
reader->sizes(fs,ts);
-// // odebug << "Reg:" << (const tchar*)(regEdit->text()) << "\n" << oendl;
+// // qDebug("Reg:%s\n", (const tchar*)(regEdit->text()));
m_autogenstr = regText;
QRegExp re(regText);
CBuffer buff;
if (pBkmklist != NULL) delete pBkmklist;
- pBkmklist = new CList<Bkmk>;
+ reader->pBkmklist = pBkmklist = new CList<Bkmk>;
m_fBkmksChanged = true;
pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height());
pbar->show();
pbar->raise();
pbar->reset();
reader->update();
qApp->processEvents();
reader->setFocus();
reader->jumpto(0);
int lastpc = 0;
int i = 0;
while (i >= 0)
{
unsigned int lcn = reader->locate();
int pc = (100*lcn)/ts;
if (pc != lastpc)
{
pbar->setProgress(pc);
qApp->processEvents();
if (reader->locate() != lcn) reader->jumpto(lcn);
reader->setFocus();
lastpc = pc;
}
i = reader->buffdoc.getpara(buff);
#ifdef _UNICODE
if (re.match(toQString(buff.data())) != -1)
#else
if (re.match(buff.data()) != -1)
#endif
pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn));
}
pBkmklist->sort();
pbar->setProgress(100);
qApp->processEvents();
pbar->hide();
reader->refresh();
}
void QTReaderApp::saveprefs()
{
-// odebug << "saveprefs" << oendl;
-// reader->saveprefs("uqtreader");
-// if (!m_loadedconfig)
do_saveconfig( APPDIR, true );
-
-/*
- Config config( APPDIR );
- config.setGroup( "View" );
-
- reader->m_lastposn = reader->pagelocate();
-
- config.writeEntry("FloatDialogs", m_bFloatingDialog);
- config.writeEntry( "StripCr", reader->bstripcr );
- config.writeEntry( "AutoFmt", reader->bautofmt );
- config.writeEntry( "TextFmt", reader->btextfmt );
- config.writeEntry( "StripHtml", reader->bstriphtml );
- config.writeEntry( "Dehyphen", reader->bdehyphen );
- config.writeEntry( "Depluck", reader->bdepluck );
- config.writeEntry( "Dejpluck", reader->bdejpluck );
- config.writeEntry( "OneSpace", reader->bonespace );
- config.writeEntry( "Unindent", reader->bunindent );
- config.writeEntry( "Repara", reader->brepara );
- config.writeEntry( "DoubleSpace", reader->bdblspce );
- config.writeEntry( "Indent", reader->bindenter );
- config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) );
- config.writeEntry( "ScrollDelay", reader->m_delay);
- config.writeEntry( "LastFile", reader->m_lastfile );
- config.writeEntry( "LastPosn", (int)(reader->pagelocate()) );
- config.writeEntry( "PageMode", reader->m_bpagemode );
- config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced );
- config.writeEntry( "SwapMouse", reader->m_swapmouse);
- config.writeEntry( "Fontname", reader->m_fontname );
- config.writeEntry( "Encoding", reader->m_encd );
- config.writeEntry( "CharSpacing", reader->m_charpc );
- config.writeEntry( "Overlap", (int)(reader->m_overlap) );
- config.writeEntry( "Margin", (int)reader->m_border );
- config.writeEntry( "TargetApp", m_targetapp );
- config.writeEntry( "TargetMsg", m_targetmsg );
-#ifdef _SCROLLPIPE
- config.writeEntry( "PipeTarget", reader->m_pipetarget );
- config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara );
-#endif
- config.writeEntry( "TwoTouch", m_twoTouch );
- config.writeEntry( "Annotation", m_doAnnotation);
- config.writeEntry( "Dictionary", m_doDictionary);
- config.writeEntry( "Clipboard", m_doClipboard);
- config.writeEntry( "SpaceTarget", m_spaceTarget);
- config.writeEntry( "EscapeTarget", m_escapeTarget);
- config.writeEntry( "ReturnTarget", m_returnTarget);
- config.writeEntry( "LeftTarget", m_leftTarget);
- config.writeEntry( "RightTarget", m_rightTarget);
- config.writeEntry( "UpTarget", m_upTarget);
- config.writeEntry( "DownTarget", m_downTarget);
- config.writeEntry("LeftScroll", m_leftScroll);
- config.writeEntry("RightScroll", m_rightScroll);
- config.writeEntry("UpScroll", m_upScroll);
- config.writeEntry("DownScroll", m_downScroll);
-#ifdef REPALM
- config.writeEntry( "Repalm", reader->brepalm );
-#endif
- config.writeEntry( "Remap", reader->bremap );
- config.writeEntry( "Peanut", reader->bpeanut );
- config.writeEntry( "MakeBold", reader->bmakebold );
- config.writeEntry( "Continuous", reader->m_continuousDocument );
- config.writeEntry( "FullJust", reader->bfulljust );
- config.writeEntry( "ExtraSpace", reader->getextraspace() );
- config.writeEntry( "ExtraLead", reader->getlead() );
- config.writeEntry( "Basesize", (int)reader->getBaseSize());
- config.writeEntry( "RequestorFontChange", m_propogatefontchange);
-
- config.setGroup( "Toolbar" );
- config.writeEntry("Movable", m_tbmovesave);
- config.writeEntry("Policy", m_tbpolsave);
- config.writeEntry("Position", m_tbposition);
-*/
savefilelist();
}
/*
void QTReaderApp::oldFile()
{
-// odebug << "oldFile called" << oendl;
+// qDebug("oldFile called");
reader->setText(true);
-// odebug << "settext called" << oendl;
+// qDebug("settext called");
showEditTools();
-// odebug << "showedit called" << oendl;
+// qDebug("showedit called");
}
*/
/*
void info_cb(Fl_Widget* o, void* _data)
{
if (infowin == NULL)
{
infowin = new Fl_Window(160,240);
filename = new Fl_Output(45,5,110,14,"Filename");
filesize = new Fl_Output(45,25,110,14,"Filesize");
textsize = new Fl_Output(45,45,110,14,"Textsize");
comprat = new CBar(45,65,110,14,"Ratio %");
posn = new Fl_Output(45,85,110,14,"Location");
frcn = new CBar(45,105,110,14,"% Read");
about = new Fl_Multiline_Output(5,125,150,90);
about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files");
Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay");
infowin->set_modal();
}
if (((reader_ui *)_data)->g_filename[0] != '\0')
{
unsigned long fs,ts;
tchar sz[20];
((reader_ui *)_data)->input->sizes(fs,ts);
unsigned long pl = ((reader_ui *)_data)->input->locate();
filename->value(((reader_ui *)_data)->g_filename);
sprintf(sz,"%u",fs);
filesize->value(sz);
sprintf(sz,"%u",ts);
textsize->value(sz);
comprat->value(100-(100*fs + (ts >> 1))/ts);
sprintf(sz,"%u",pl);
posn->value(sz);
frcn->value((100*pl + (ts >> 1))/ts);
}
infowin->show();
}
*/
void QTReaderApp::savebkmks()
{
if (pBkmklist != NULL)
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR);
QFileInfo fi(d, reader->m_string);
- BkmkFile bf((const char *)fi.absFilePath(), true);
+ BkmkFile bf((const char *)fi.absFilePath(), true, true);
#else /* USEQPE */
- BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true);
+ BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true, true);
#endif /* USEQPE */
bf.write(*pBkmklist);
}
m_fBkmksChanged = false;
}
void QTReaderApp::readfilelist()
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR);
QFileInfo fi(d, ".openfiles");
- BkmkFile bf((const char *)fi.absFilePath());
+ BkmkFile bf((const char *)fi.absFilePath(), false, false);
#else /* USEQPE */
- BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"));
+ BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), false, false);
#endif /* USEQPE */
-// odebug << "Reading open files" << oendl;
+// qDebug("Reading open files");
pOpenlist = bf.readall();
-// if (pOpenlist != NULL) odebug << "...with success" << oendl;
-// else odebug << "...without success!" << oendl;
+// if (pOpenlist != NULL) qDebug("...with success");
+// else qDebug("...without success!");
}
void QTReaderApp::savefilelist()
{
if (pOpenlist != NULL)
{
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR);
QFileInfo fi(d, ".openfiles");
- BkmkFile bf((const char *)fi.absFilePath(), true);
+ BkmkFile bf((const char *)fi.absFilePath(), true, false);
#else /* USEQPE */
- BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true);
+ BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true, false);
#endif /* USEQPE */
-// odebug << "Writing open files" << oendl;
+// qDebug("Writing open files");
bf.write(*pOpenlist);
}
}
void QTReaderApp::readbkmks()
{
if (pBkmklist != NULL)
{
delete pBkmklist;
}
struct stat fnstat;
struct stat bkstat;
#ifndef USEQPE
QDir d = QDir::home(); // "/"
d.cd(APPDIR);
QFileInfo fi(d, reader->m_string);
#endif /* ! USEQPE */
if (
stat((const char *)reader->m_lastfile, &fnstat) == 0
&&
#ifndef USEQPE
stat((const char *)fi.absFilePath(), &bkstat) == 0
#else /* USEQPE */
stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0
#endif /* USEQPE */
)
{
if (bkstat.st_mtime < fnstat.st_mtime)
{
#ifndef USEQPE
unlink((const char *)fi.absFilePath());
#else /* USEQPE */
unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string));
#endif /* USEQPE */
}
}
#ifndef USEQPE
- BkmkFile bf((const char *)fi.absFilePath());
+ BkmkFile bf((const char *)fi.absFilePath(), false, true);
#else /* USEQPE */
- BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string));
+ BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), false, true);
#endif /* USEQPE */
- pBkmklist = bf.readall();
+ reader->pBkmklist = pBkmklist = bf.readall();
m_fBkmksChanged = bf.upgraded();
if (pBkmklist == NULL)
{
- pBkmklist = reader->getbkmklist();
+ reader->pBkmklist = pBkmklist = reader->getbkmklist();
}
if (pBkmklist != NULL)
pBkmklist->sort();
}
void QTReaderApp::addbkmk()
{
m_nRegAction = cAddBkmk;
regEdit->setText(reader->firstword());
do_regedit();
}
void QTReaderApp::do_addbkmk(const QString& text)
{
if (text.isEmpty())
{
QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1);
}
else
{
- if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
+ if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>;
#ifdef _UNICODE
CBuffer buff;
int i = 0;
for (i = 0; i < text.length(); i++)
{
buff[i] = text[i].unicode();
}
buff[i] = 0;
pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate()));
#else
pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate()));
#endif
m_fBkmksChanged = true;
pBkmklist->sort();
+ reader->refresh(true);
}
}
+void QTReaderApp::UpdateStatus()
+{
+ QString status;
+ for (int i = 0; i < m_statusstring.length(); i++)
+ {
+ if (m_statusstring[i].unicode() == '%')
+ {
+ i++;
+ if (i < m_statusstring.length())
+ {
+ switch (m_statusstring[i].unicode())
+ {
+ case 'F':
+ {
+ unsigned long fs,ts;
+ reader->sizes(fs,ts);
+ status += filesize(ts);
+ }
+ break;
+ case 'f':
+ {
+ status += filesize(reader->pagelocate());
+ }
+ break;
+ case 'D':
+ {
+ status += filesize(reader->buffdoc.endSection()-reader->buffdoc.startSection());
+ }
+ break;
+ case 'd':
+ {
+ status += filesize(reader->pagelocate()-reader->buffdoc.startSection());
+ }
+ break;
+ case 'P':
+ {
+ unsigned long fs,ts;
+ reader->sizes(fs,ts);
+ status += percent(reader->pagelocate(),ts);
+ }
+ break;
+ case 'p':
+ {
+ status += percent(reader->pagelocate()-reader->buffdoc.startSection(),reader->buffdoc.endSection()-reader->buffdoc.startSection());
+ }
+ break;
+ case 'z':
+ {
+ // qDebug("case d");
+ status += QString().setNum(reader->m_fontControl.currentsize()*10);
+ }
+ break;
+ default:
+ status += m_statusstring[i];
+ }
+ }
+ }
+ else
+ {
+ status += m_statusstring[i];
+ }
+ }
+ m_prog->setText(status);
+}
+
void QTReaderApp::OnRedraw()
{
if ((pBkmklist != NULL) && (m_bkmkAvail != NULL))
{
bool found = findNextBookmark(reader->pagelocate());
m_bkmkAvail->setEnabled(found);
}
+ if (m_scrollbar != NULL)
+ {
+ //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection());
+ scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1);
+ scrollbar->setPageStep(reader->locate()-reader->pagelocate());
+ scrollbar->setValue((reader->m_rotated) ?
+ (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) :
+ reader->pagelocate());
+ }
+ if (m_prog->isVisible())
+ {
+ // qDebug("updating status");
+ UpdateStatus();
+ // qDebug("updated status");
+ }
}
void QTReaderApp::showAnnotation()
{
m_annoWin->setName(toQString(m_anno->name()));
m_annoWin->setAnno(toQString(m_anno->anno()));
+ m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue()));
m_annoIsEditing = false;
#ifdef USEQPE
Global::showInputMethod();
#endif
editorStack->raiseWidget( m_annoWin );
+ hidetoolbars();
m_annoWin->setFocus();
}
-void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line)
+void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line)
{
-//// odebug << "OnWordSelected(" << posn << "):" << wrd << "" << oendl;
+//// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd);
if (m_doClipboard)
{
QClipboard* cb = QApplication::clipboard();
cb->setText(wrd);
#ifdef USEQPE
if (wrd.length() > 10)
{
Global::statusMessage(wrd.left(8) + "..");
}
else
{
Global::statusMessage(wrd);
}
#endif
}
if (m_doAnnotation)
{
// addAnno(wrd, "Need to be able to edit this", posn);
m_annoWin->setName(line);
m_annoWin->setAnno("");
m_annoWin->setPosn(posn);
+ m_annoWin->setPosn2(posn2);
m_annoIsEditing = true;
#ifdef USEQPE
Global::showInputMethod();
#endif
editorStack->raiseWidget( m_annoWin );
+ hidetoolbars();
}
#ifdef USEQPE
if (m_doDictionary)
{
if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty())
{
QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8());
e << wrd;
}
}
#endif
}
-void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e)
+void QTReaderApp::doAction(QKeyEvent* e)
+{
+ QMap<orKey,int>::Iterator f = kmap.end();
+
+ if (reader->m_autoScroll)
{
- if (a == 0)
+ f = kmap.find(orKey(e->state(), e->key(), true));
+ }
+ if (f == kmap.end())
+ {
+ f = kmap.find(orKey(e->state(), e->key(), false));
+ }
+
+ if (f == kmap.end())
{
+ qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data());
e->ignore();
}
else
{
+ qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data());
+ ActionTypes a = (ActionTypes)f.data();
e->accept();
-// odebug << "Accepted" << oendl;
+// qDebug("Accepted");
switch (a)
{
+ case cesGotoLink:
+ {
+ reader->gotoLink();
+ }
+ break;
+ case cesNextLink:
+ {
+ reader->getNextLink();
+ }
+ break;
+ case cesInvertColours:
+ m_inverse_action->setOn(!reader->bInverse);
+ break;
+ case cesToggleBars:
+ m_hidebars = !m_hidebars;
+ if (m_hidebars)
+ {
+#ifdef USEQPE
+ menubar->hide();
+#endif
+ if (fileBar != NULL) fileBar->hide();
+ if (viewBar != NULL) viewBar->hide();
+ if (navBar != NULL) navBar->hide();
+ if (markBar != NULL) markBar->hide();
+ mb->hide();
+ }
+ else
+ {
+#ifdef USEQPE
+ menubar->show();
+#endif
+ if (fileBar != NULL) fileBar->show();
+ if (viewBar != NULL) viewBar->show();
+ if (navBar != NULL) navBar->show();
+ if (markBar != NULL) markBar->show();
+ mb->show();
+ }
+ break;
+ case cesToggleScrollBar:
+ if (m_scrollbar != NULL)
+ {
+ if (m_scrollbar->isHidden())
+ {
+ m_scrollishidden = false;
+ m_scrollbar->show();
+ reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0;
+ }
+ else
+ {
+ m_scrollishidden = true;
+ m_scrollbar->hide();
+ reader->m_scrollpos = m_localscroll;
+ }
+ }
+ break;
+ case cesToggleStatusBar:
+ if (m_prog != NULL)
+ {
+ if (m_prog->isHidden())
+ {
+ m_statusishidden = false;
+ m_prog->show();
+ }
+ else
+ {
+ m_statusishidden = true;
+ m_prog->hide();
+ }
+ }
+ break;
case cesOpenFile:
{
+ qDebug("Open file");
fileOpen();
}
break;
case cesAutoScroll:
{
reader->setautoscroll(!reader->m_autoScroll);
setScrollState(reader->m_autoScroll);
}
break;
case cesActionMark:
{
addbkmk();
}
break;
case cesFullScreen:
{
m_actFullscreen->setOn(!m_fullscreen);
}
break;
+ case cesRotate:
+ {
+ m_rotate_action->setOn(!reader->m_rotated);
+ }
+ break;
case cesActionAnno:
{
addanno();
}
break;
case cesZoomIn:
zoomin();
break;
case cesZoomOut:
zoomout();
break;
case cesBack:
reader->goBack();
break;
case cesForward:
reader->goForward();
break;
case cesHome:
reader->goHome();
break;
case cesPageUp:
reader->dopageup();
+ /*
+ ftime(&m_lastkeytime);
+ m_fndelay = m_debounce;
+ //
+ {
+ timeb now;
+ ftime(&now);
+ m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+100;
+ }
+ */
break;
case cesPageDown:
reader->dopagedn();
+ /*
+ ftime(&m_lastkeytime);
+ m_fndelay = m_debounce;
+ //
+ if (m_debounce != 0)
+ {
+ timeb now;
+ ftime(&now);
+ m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+10;
+ }
+ */
break;
case cesLineUp:
reader->lineUp();
break;
case cesLineDown:
reader->lineDown();
break;
case cesStartDoc:
gotoStart();
break;
case cesEndDoc:
gotoEnd();
break;
+ case cesScrollMore:
+ reader->increaseScroll();
+ break;
+ case cesScrollLess:
+ reader->reduceScroll();
+ break;
default:
- odebug << "Unknown ActionType:" << a << "" << oendl;
+ qDebug("Unknown ActionType:%u", a);
break;
}
}
}
void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); }
void QTReaderApp::restoreFocus() { reader->setFocus(); }
void QTReaderApp::SaveConfig()
{
m_nRegAction = cSetConfigName;
regEdit->setText(reader->m_string);
do_regedit();
}
void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
{
-// odebug << "do_saveconfig:" << _txt << "" << oendl;
+// qDebug("do_saveconfig:%s", (const char*)_txt);
#ifdef USEQPE
QString configname;
Config::Domain dom;
if (full)
{
configname = _txt;
dom = Config::User;
}
else
{
configname = Global::applicationFileName(APPDIR "/configs", _txt);
dom = Config::File;
}
Config config(configname, dom);
config.setGroup( "View" );
#else
QFileInfo fi;
if (full)
{
-// odebug << "full:" << _txt << "" << oendl;
+// qDebug("full:%s", (const char*)_txt);
QDir d = QDir::home(); // "/"
if ( !d.cd(_txt) )
{ // "/tmp"
- owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt );
d = QDir::home();
d.mkdir(_txt);
d.cd(_txt);
}
fi.setFile(d, INIFILE);
}
else
{
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd("configs") )
{ // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" );
d = QDir::home();
d.cd(APPDIR);
d.mkdir("configs");
d.cd("configs");
}
fi.setFile(d, _txt);
}
-// odebug << "Path:" << fi.absFilePath() << "" << oendl;
+// qDebug("Path:%s", (const char*)fi.absFilePath());
Config config(fi.absFilePath());
#endif
config.writeEntry( "StripCr", reader->bstripcr );
config.writeEntry( "AutoFmt", reader->bautofmt );
config.writeEntry( "TextFmt", reader->btextfmt );
config.writeEntry( "StripHtml", reader->bstriphtml );
config.writeEntry( "Dehyphen", reader->bdehyphen );
config.writeEntry( "Depluck", reader->bdepluck );
config.writeEntry( "Dejpluck", reader->bdejpluck );
config.writeEntry( "OneSpace", reader->bonespace );
config.writeEntry( "Unindent", reader->bunindent );
config.writeEntry( "Repara", reader->brepara );
+ config.writeEntry( "ReparaString", reader->m_reparastring);
+ config.writeEntry( "BackgroundType" , (int)m_bgtype );
+ config.writeEntry( "Theme", m_themename );
config.writeEntry( "DoubleSpace", reader->bdblspce );
config.writeEntry( "Indent", reader->bindenter );
config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) );
config.writeEntry( "ScrollDelay", reader->m_delay);
+ config.writeEntry( "ScrollStep", reader->m_scrollstep);
+ config.writeEntry( "ScrollType", reader->m_scrolltype );
if (full)
{
config.writeEntry("Debounce", m_debounce);
config.writeEntry("FloatDialogs", m_bFloatingDialog);
reader->m_lastposn = reader->pagelocate();
config.writeEntry( "LastFile", reader->m_lastfile );
config.writeEntry( "LastPosn", (int)(reader->pagelocate()) );
}
config.writeEntry( "PageMode", reader->m_bpagemode );
config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced );
config.writeEntry( "SwapMouse", reader->m_swapmouse);
+ config.writeEntry( "IsRotated", reader->m_rotated );
+ config.writeEntry("StatusContent", m_statusstring);
+ config.writeEntry("StatusHidden", m_statusishidden);
+ config.writeEntry( "Background", m_background );
+ config.writeEntry( "Foreground", m_foreground );
+ config.writeEntry( "ScrollColour", m_scrollcolor );
+ config.writeEntry( "ScrollBarColour", m_scrollbarcolor );
+ config.writeEntry( "Hyphenate", reader->hyphenate );
+ // config.writeEntry( "CustomHyphen", reader->buffdoc.getCustomHyphen() );
config.writeEntry( "Fontname", reader->m_fontname );
config.writeEntry( "Encoding", reader->m_encd );
config.writeEntry( "CharSpacing", reader->m_charpc );
config.writeEntry( "Overlap", (int)(reader->m_overlap) );
- config.writeEntry( "Margin", (int)reader->m_border );
+ config.writeEntry( "Top Margin", (int)reader->m_abstopmargin );
+ config.writeEntry( "Bottom Margin", (int)reader->m_absbottommargin );
+ config.writeEntry( "Left Margin", (int)reader->m_absleft_border );
+ config.writeEntry( "Right Margin", (int)reader->m_absright_border );
config.writeEntry( "TargetApp", m_targetapp );
config.writeEntry( "TargetMsg", m_targetmsg );
#ifdef _SCROLLPIPE
config.writeEntry( "PipeTarget", reader->m_pipetarget );
config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara );
#endif
config.writeEntry( "TwoTouch", m_twoTouch );
config.writeEntry( "Annotation", m_doAnnotation);
config.writeEntry( "Dictionary", m_doDictionary);
config.writeEntry( "Clipboard", m_doClipboard);
+ /*
config.writeEntry( "SpaceTarget", m_spaceTarget);
config.writeEntry( "EscapeTarget", m_escapeTarget);
config.writeEntry( "ReturnTarget", m_returnTarget);
config.writeEntry( "LeftTarget", m_leftTarget);
config.writeEntry( "RightTarget", m_rightTarget);
config.writeEntry( "UpTarget", m_upTarget);
config.writeEntry( "DownTarget", m_downTarget);
config.writeEntry("LeftScroll", m_leftScroll);
config.writeEntry("RightScroll", m_rightScroll);
config.writeEntry("UpScroll", m_upScroll);
config.writeEntry("DownScroll", m_downScroll);
-#ifdef REPALM
+ */
config.writeEntry( "Repalm", reader->brepalm );
-#endif
+ config.writeEntry( "HideScrollBar", m_scrollishidden );
+ config.writeEntry( "Kern", reader->bkern );
config.writeEntry( "Remap", reader->bremap );
config.writeEntry( "Peanut", reader->bpeanut );
config.writeEntry( "MakeBold", reader->bmakebold );
config.writeEntry( "Continuous", reader->m_continuousDocument );
config.writeEntry( "FullJust", reader->bfulljust );
+ // config.writeEntry( "Negative", reader->bNegative );
+ config.writeEntry( "Inverse", reader->bInverse );
+ config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics());
config.writeEntry( "ExtraSpace", reader->getextraspace() );
config.writeEntry( "ExtraLead", reader->getlead() );
config.writeEntry( "Basesize", (int)reader->getBaseSize());
config.writeEntry( "RequestorFontChange", m_propogatefontchange);
+#ifdef USEQPE
+ config.writeEntry( "GrabKeyboard", m_grabkeyboard );
+#endif
if (full)
{
config.setGroup( "Toolbar" );
+ config.writeEntry("QTScrollBar", m_qtscroll);
+ config.writeEntry("LocalScrollBar", m_localscroll);
config.writeEntry("Movable", m_tbmovesave);
config.writeEntry("Policy", m_tbpolsave);
config.writeEntry("Position", m_tbposition);
#ifndef USEQPE
+ if (!isMaximized() && !isMinimized())
+ {
config.setGroup( "Geometry" );
config.writeEntry( "x", x() );
config.writeEntry( "y", y() );
config.writeEntry( "width", width() );
config.writeEntry( "height", height() );
-#endif
- }
}
-
-/*
-void QTReaderApp::setstate(unsigned char* _sd, unsigned short _sdlen)
-{
- unsigned short sdlen;
- memcpy(&sdlen, _sd, sizeof(sdlen));
- sdlen -= sizeof(sdlen);
- _sd += sizeof(sdlen);
- statedata* sd;
- char* data;
- if (sdlen < sizeof(statedata)+1)
- {
- sdlen = sizeof(statedata)+1;
- }
- data = new char[sdlen];
- sd = (statedata*)data;
- memcpy(sd, _sd, sdlen);
- data[sdlen] = 0;
- reader->setstate(*sd);
- delete [] data;
-}
-
-void QTReaderApp::getstate(unsigned char*& data, unsigned short& len)
-{
- unsigned char* olddata = data;
- unsigned short oldlen = len;
- len = oldlen+sizeof(unsigned short)+sizeof(statedata)+reader->m_fontname.length();
- data = new unsigned char[len];
- memcpy(data, olddata, oldlen);
- delete [] olddata;
- memcpy(data+oldlen, &len, sizeof(len));
- statedata* sd = (statedata*)(data+oldlen+sizeof(unsigned short));
-
- sd->bstripcr = reader->bstripcr;
- sd->btextfmt = reader->btextfmt;
- sd->bautofmt = reader->bautofmt;
- sd->bstriphtml = reader->bstriphtml;
- sd->bpeanut = reader->bpeanut;
- sd->bdehyphen = reader->bdehyphen;
- sd->bdepluck = reader->bdepluck;
- sd->bdejpluck = reader->bdejpluck;
- sd->bonespace = reader->bonespace;
- sd->bunindent = reader->bunindent;
- sd->brepara = reader->brepara;
- sd->bdblspce = reader->bdblspce;
- sd->m_bpagemode = reader->m_bpagemode;
- sd->m_bMonoSpaced = reader->m_bMonoSpaced;
- sd->bremap = reader->bremap;
- sd->bmakebold = reader->bmakebold;
- sd->Continuous = reader->m_continuousDocument;
-#ifdef REPALM
- sd->brepalm = reader->brepalm;
#endif
- sd->bindenter = reader->bindenter;
- sd->m_textsize = reader->m_textsize; //reader->m_fontControl.currentsize()
- sd->m_encd = reader->m_encd;
- sd->m_charpc = reader->m_charpc;
- strcpy(sd->m_fontname, reader->m_fontname.latin1());
-}
-*/
-#ifdef _SCRIPT
-void QTReaderApp::RunScript()
-{
- fileBrowser* fb = new fileBrowser(this,"OpieReader",!m_bFloatingDialog,
- 0,
-// WStyle_Customize | WStyle_NoBorderEx,
- "*", Global::applicationFileName(APPDIR "/scripts", ""));
-
- QString fn;
- if (fb->exec())
- {
- fn = fb->fileList[0];
- }
- delete fb;
- if ( !fn.isEmpty() && fork() == 0 )
- {
- execlp((const char *)fn,(const char *)fn,NULL);
}
}
-void QTReaderApp::SaveScript(const char* sname)
-{
- FILE* f = fopen(sname,"w");
- if (f != NULL)
- {
-#ifdef OPIE
- fprintf(f, "#!/bin/sh\nmsg() {\n\tqcop QPE/Application/reader \"$1\" \"$2\" \"$3\"\n}\n");
-#else
- fprintf(f, "#!/bin/bash\nmsg() {\n\tqcop QPE/Application/uqtreader \"$1\" \"$2\" \"$3\"\n}\n");
-#endif
- fprintf(f, "msg \"Update(int)\" 0\n");
- fprintf(f, "msg \"Layout/StripCR(int)\" %d\n", (reader->bstripcr) ? 1:0);
- if (reader->btextfmt) fprintf(f, "msg \"Markup(QString)\" \"Text\"\n");
- else if (reader->bautofmt) fprintf(f, "msg \"Markup(QString)\" \"Auto\"\n");
- else if (reader->bstriphtml) fprintf(f, "msg \"Markup(QString)\" \"HTML\"\n");
- else if (reader->bpeanut) fprintf(f, "msg \"Markup(QString)\" \"Peanut/PML\"\n");
- else fprintf(f, "msg \"Markup(QString)\" \"None\"\n");
- fprintf(f, "msg \"Layout/Dehyphen(int)\" %d\n", (reader->bdehyphen) ? 1:0);
- fprintf(f, "msg \"Layout/Depluck(int)\" %d\n", (reader->bdepluck) ? 1:0);
- fprintf(f, "msg \"Layout/Dejpluck(int)\" %d\n", (reader->bdejpluck) ? 1:0);
- fprintf(f, "msg \"Layout/SingleSpace(int)\" %d\n", (reader->bonespace) ? 1:0);
- fprintf(f, "msg \"Layout/Unindent(int)\" %d\n", (reader->bunindent) ? 1:0);
- fprintf(f, "msg \"Layout/Re-paragraph(int)\" %d\n", (reader->brepara) ? 1:0);
- fprintf(f, "msg \"Layout/DoubleSpace(int)\" %d\n", (reader->bdblspce) ? 1:0);
- fprintf(f, "msg \"Layout/Indent(int)\" %d\n", reader->bindenter);
- fprintf(f, "msg \"Format/SetFont(QString,int)\" \"%s\" %d\n", (const char*)reader->m_fontname, reader->m_textsize);
- fprintf(f, "msg \"Navigation/Page/LineScroll(int)\" %d\n", (reader->m_bpagemode) ? 1:0);
- fprintf(f, "msg \"Format/Ideogram/Word(int)\" %d\n", (reader->m_bMonoSpaced) ? 1:0);
- fprintf(f, "msg \"Format/Encoding(QString)\" \"%s\"\n", (const char*)m_EncodingAction[reader->m_encd]->text());
- fprintf(f, "msg \"Format/SetWidth(int)\" %d\n", reader->m_charpc);
- fprintf(f, "msg \"Navigation/SetOverlap(int)\" %d\n", reader->m_overlap);
- fprintf(f, "msg \"Layout/Remap(int)\" %d\n", (reader->bremap) ? 1:0);
- fprintf(f, "msg \"Layout/Embolden(int)\" %d\n", (reader->bmakebold) ? 1:0);
- fprintf(f, "msg \"File/Continuous(int)\" %d\n", (reader->m_continuousDocument) ? 1:0);
- fprintf(f, "msg \"File/SetDictionary(QString)\" \"%s/%s\"\n", (const char *)m_targetapp, (const char *)m_targetmsg);
-#ifdef _SCROLLPIPE
- fprintf(f, "msg \"File/SetScrollTarget(QString)\" \"%s\"\n", (const char *)reader->m_pipetarget);
-#endif
- fprintf(f, "msg \"File/Two/OneTouch(int)\" %d\n", (m_twoTouch) ? 1:0);
- fprintf(f, "msg \"Target/Annotation(int)\" %d\n", (m_doAnnotation) ? 1:0);
- fprintf(f, "msg \"Target/Dictionary(int)\" %d\n", (m_doDictionary) ? 1:0);
- fprintf(f, "msg \"Target/Clipboard(int)\" %d\n", (m_doClipboard) ? 1:0);
- fprintf(f, "msg \"File/Action(QString)\" \"%s\"\n", (const char *)m_buttonAction[m_spaceTarget]->text());
- fprintf(f, "msg \"Update(int)\" 1\n");
- fprintf(f, "msg \"info(QString)\" \"All Done\"\n");
- fclose(f);
- chmod(sname, S_IXUSR | S_IXGRP | S_IXOTH);
- }
-}
-
-void QTReaderApp::SaveConfig()
-{
- m_nRegAction = cSetConfigName;
- regEdit->setText("");
- do_regedit();
-}
-
-void QTReaderApp::do_saveconfig(const QString& _txt)
-{
- SaveScript(Global::applicationFileName(APPDIR "/scripts", _txt));
-}
-#endif
-
#ifdef _SCROLLPIPE
void QTReaderApp::setpipetarget()
{
m_nRegAction = cSetPipeTarget;
QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget;
regEdit->setText(text);
do_regedit();
}
void QTReaderApp::do_setpipetarget(const QString& _txt)
{
reader->m_pipetarget = _txt;
}
void QTReaderApp::setpause(bool sfs)
{
reader->m_pauseAfterEachPara = sfs;
}
#endif
void QTReaderApp::monospace(bool _b)
{
reader->setmono(_b);
}
-bool QTReaderApp::readconfig(const QString& _txt, bool full=false)
+bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool full=false)
{
#ifdef USEQPE
QString configname;
Config::Domain dom;
if (full)
{
configname = _txt;
dom = Config::User;
}
else
{
- configname = Global::applicationFileName(APPDIR "/configs", _txt);
+ configname = Global::applicationFileName(dirname, _txt);
QFileInfo fm(configname);
if ( !fm.exists() ) return false;
dom = Config::File;
}
Config config(configname, dom);
config.setGroup( "View" );
#else
- QFileInfo fi;
+ QString fullname;
if (full)
{
- QDir d = QDir::home(); // "/"
- if ( !d.cd(_txt) )
- { // "/tmp"
- owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl;
- d = QDir::home();
- d.mkdir(_txt);
- d.cd(_txt);
- }
- fi.setFile(d, INIFILE);
+ fullname = QDir::homeDirPath() + "/" + _txt + "/" + INIFILE;
}
else
{
- QDir d = QDir::home(); // "/"
- if ( !d.cd(APPDIR) )
- { // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
- d = QDir::home();
- d.mkdir(APPDIR);
- d.cd(APPDIR);
+ fullname = QDir::homeDirPath() + "/" + dirname + "/" + _txt;
}
- if ( !d.cd("configs") )
- { // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl;
- d = QDir::home();
- d.mkdir("configs");
- d.cd("configs");
- }
- fi.setFile(d, _txt);
- }
-#ifdef _WINDOWS
- struct stat fnstat;
- if (stat((const char *)reader->m_lastfile, &fnstat) == 0) return false; // get round fileinfo bug on windows
-#else
- if (!fi.exists()) return false;
-#endif
- Config config(fi.absFilePath());
+ if (!QFile::exists(fullname)) return false;
+
+ Config config(fullname);
#endif
if (full)
{
config.setGroup("Toolbar");
- m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
- m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
- m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
+ m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave);
+ m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave);
+ m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition);
}
config.setGroup( "View" );
- m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
- reader->bstripcr = config.readBoolEntry( "StripCr", true );
- reader->bfulljust = config.readBoolEntry( "FullJust", false );
- reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 ));
- reader->setlead(config.readNumEntry( "ExtraLead", 0 ));
- reader->btextfmt = config.readBoolEntry( "TextFmt", false );
- reader->bautofmt = config.readBoolEntry( "AutoFmt", true );
- reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
- reader->bpeanut = config.readBoolEntry( "Peanut", false );
- reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
- reader->bdepluck = config.readBoolEntry( "Depluck", false );
- reader->bdejpluck = config.readBoolEntry( "Dejpluck", false );
- reader->bonespace = config.readBoolEntry( "OneSpace", false );
- reader->bunindent = config.readBoolEntry( "Unindent", false );
- reader->brepara = config.readBoolEntry( "Repara", false );
- reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
- reader->bindenter = config.readNumEntry( "Indent", 0 );
- reader->m_textsize = config.readNumEntry( "FontSize", 12 );
- reader->m_delay = config.readNumEntry( "ScrollDelay", 5184);
+ m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog);
+ reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr );
+ reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust );
+ reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse );
+ // reader->bNegative = config.readBoolEntry( "Negative", false );
+ reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() ));
+ reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() ));
+ reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() ));
+ reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt );
+ reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt );
+ reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml );
+ reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut );
+ reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen );
+ reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck );
+ reader->bdejpluck = config.readBoolEntry( "Dejpluck", reader->bdejpluck );
+ reader->bonespace = config.readBoolEntry( "OneSpace", reader->bonespace );
+ reader->bunindent = config.readBoolEntry( "Unindent", reader->bunindent );
+ reader->brepara = config.readBoolEntry( "Repara", reader->brepara );
+ reader->m_reparastring = config.readEntry( "ReparaString", reader->m_reparastring);
+ m_bgtype = (bground)config.readNumEntry( "BackgroundType" , m_bgtype );
+ m_themename = config.readEntry("Theme", m_themename );
+ reader->bdblspce = config.readBoolEntry( "DoubleSpace", reader->bdblspce );
+ reader->bindenter = config.readNumEntry( "Indent", reader->bindenter );
+ reader->m_textsize = config.readNumEntry( "FontSize", reader->m_textsize );
+ reader->m_delay = config.readNumEntry( "ScrollDelay", reader->m_delay);
+ reader->m_scrollstep = config.readNumEntry( "ScrollStep", reader->m_scrollstep);
+ reader->m_scrolltype = config.readNumEntry( "ScrollType", reader->m_scrolltype);
if (full)
{
- reader->m_lastfile = config.readEntry( "LastFile", QString::null );
- reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
- }
- reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
- reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
- reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
- reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
- reader->m_encd = config.readNumEntry( "Encoding", 0 );
- reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
- reader->m_overlap = config.readNumEntry( "Overlap", 0 );
- reader->m_border = config.readNumEntry( "Margin", 6 );
-#ifdef REPALM
- reader->brepalm = config.readBoolEntry( "Repalm", true );
-#endif
- reader->bremap = config.readBoolEntry( "Remap", true );
- reader->bmakebold = config.readBoolEntry( "MakeBold", false );
- reader->setContinuous(config.readBoolEntry( "Continuous", true ));
- m_targetapp = config.readEntry( "TargetApp", QString::null );
- m_targetmsg = config.readEntry( "TargetMsg", QString::null );
+ reader->m_lastfile = config.readEntry( "LastFile", reader->m_lastfile );
+ reader->m_lastposn = config.readNumEntry( "LastPosn", reader->m_lastposn );
+ }
+ reader->m_bpagemode = config.readBoolEntry( "PageMode", reader->m_bpagemode );
+ reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", reader->m_bMonoSpaced);
+ reader->m_rotated = config.readBoolEntry( "IsRotated", reader->m_rotated );
+ m_statusstring = config.readEntry("StatusContent", m_statusstring);
+ m_statusishidden = config.readBoolEntry("StatusHidden", m_statusishidden);
+ m_background = config.readNumEntry( "Background", m_background );
+ reader->setBackground(getcolour(m_background));
+ m_foreground = config.readNumEntry( "Foreground", m_foreground );
+ reader->setForeground(getcolour(m_foreground));
+ m_scrollcolor = config.readNumEntry( "ScrollColour", m_scrollcolor);
+ setscrollcolour();
+ m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", m_scrollbarcolor);
+ setscrollbarcolour();
+ reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate );
+ // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false ));
+ reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse);
+ reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname );
+ reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd );
+ reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc );
+ reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap );
+ reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin );
+ reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin );
+ reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border );
+ reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border );
+ m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden );
+ reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm );
+ reader->bkern = config.readBoolEntry( "Kern", reader->bkern );
+ reader->bremap = config.readBoolEntry( "Remap", reader->bremap );
+ reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold );
+ reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument ));
+ m_targetapp = config.readEntry( "TargetApp", m_targetapp );
+ m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg );
#ifdef _SCROLLPIPE
- reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null );
- reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true );
+ reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget );
+ reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara );
#endif
- m_twoTouch = config.readBoolEntry( "TwoTouch", false);
- m_doAnnotation = config.readBoolEntry( "Annotation", false);
- m_doDictionary = config.readBoolEntry( "Dictionary", false);
- m_doClipboard = config.readBoolEntry( "Clipboard", false);
- m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll);
- m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone);
- m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen);
- m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut);
- m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn);
- m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp);
- m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown);
-
- m_leftScroll = config.readBoolEntry("LeftScroll", false);
- m_rightScroll = config.readBoolEntry("RightScroll", false);
- m_upScroll = config.readBoolEntry("UpScroll", true);
- m_downScroll = config.readBoolEntry("DownScroll", true);
- m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false);
- reader->setBaseSize(config.readNumEntry( "Basesize", 10 ));
+ m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch);
+ m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation);
+ m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary);
+ m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard);
+#ifdef USEQPE
+ m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard);
+#endif
+ m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange);
+ reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() ));
reader->setTwoTouch(m_twoTouch);
m_touch_action->setOn(m_twoTouch);
m_setmono_action->setOn(reader->m_bMonoSpaced);
setfontHelper(reader->m_fontname);
if (full)
{
addtoolbars(&config);
}
reader->setfilter(reader->getfilter());
reader->refresh();
return true;
}
-bool QTReaderApp::PopulateConfig(const char* tgtdir)
+bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs)
{
bkmkselector->clear();
bkmkselector->setText("Cancel");
#ifndef USEQPE
int cnt = 0;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd(tgtdir) ) { // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "/" << tgtdir << "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir );
d = QDir::home();
d.mkdir(tgtdir);
d.cd(tgtdir);
}
- d.setFilter( QDir::Files | QDir::NoSymLinks );
+ d.setFilter( ((usedirs) ? QDir::Dirs : QDir::Files) | QDir::NoSymLinks );
// d.setSorting( QDir::Size | QDir::Reversed );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
bkmkselector->insertItem(fi->fileName());
cnt++;
- //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl;
+ //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
++it; // goto next list element
}
#else /* USEQPE */
int cnt = 0;
DIR *d;
char* finaldir;
finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1];
strcpy(finaldir, APPDIR);
strcat(finaldir, "/");
strcat(finaldir, tgtdir);
d = opendir((const char *)Global::applicationFileName(finaldir,""));
while(1)
{
struct dirent* de;
struct stat buf;
de = readdir(d);
if (de == NULL) break;
- if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
+ if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode))))
{
bkmkselector->insertItem(de->d_name);
cnt++;
}
}
delete [] finaldir;
closedir(d);
#endif
return (cnt > 0);
}
+void QTReaderApp::LoadTheme()
+{
+ if (PopulateConfig("Themes", true))
+ {
+ editorStack->raiseWidget( bkmkselector );
+ hidetoolbars();
+ m_nBkmkAction = cLdTheme;
+ }
+ else
+ QMessageBox::information(this, PROGNAME, "No config files");
+}
+
void QTReaderApp::LoadConfig()
{
if (PopulateConfig("configs"))
{
editorStack->raiseWidget( bkmkselector );
hidetoolbars();
m_nBkmkAction = cLdConfig;
}
else
QMessageBox::information(this, PROGNAME, "No config files");
}
void QTReaderApp::TidyConfig()
{
if (PopulateConfig("configs"))
{
editorStack->raiseWidget( bkmkselector );
hidetoolbars();
m_nBkmkAction = cRmConfig;
}
else
QMessageBox::information(this, PROGNAME, "No config files");
}
void QTReaderApp::ExportLinks()
{
if (PopulateConfig("urls"))
{
editorStack->raiseWidget( bkmkselector );
hidetoolbars();
m_nBkmkAction = cExportLinks;
}
else
QMessageBox::information(this, PROGNAME, "No url files");
}
-void QTReaderApp::OnURLSelected(const QString& href)
+void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt)
+{
+#ifndef USEQPE
+ qDebug("URL:%s", (const char*)href);
+ int col = href.find(':');
+ if (col > 0)
+ {
+ QString type = href.left(col);
+ qDebug("Type:%s", (const char*)type);
+ }
+ else
+ {
+ qDebug("No type");
+ }
+#else
+ if (href.isEmpty())
+ {
+ QMessageBox::information(this, PROGNAME, "No URL information supplied");
+ }
+ else
{
CURLDialog* urld = new CURLDialog(href, false, this);
urld->clipboard(m_url_clipboard);
urld->localfile(m_url_localfile);
urld->globalfile(m_url_globalfile);
if (urld->exec())
{
m_url_clipboard = urld->clipboard();
m_url_localfile = urld->localfile();
m_url_globalfile = urld->globalfile();
if (m_url_clipboard)
{
QClipboard* cb = QApplication::clipboard();
cb->setText(href);
- odebug << "<a href=\"" << href << "\">" << href << "</a>" << oendl;
+ qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href);
}
if (m_url_localfile)
{
writeUrl(reader->m_string, href);
}
if (m_url_globalfile)
{
writeUrl("GlobalURLFile", href);
}
}
delete urld;
}
+#endif
+}
void QTReaderApp::writeUrl(const QString& file, const QString& href)
{
QString filename;
#ifdef USEQPE
filename = Global::applicationFileName(APPDIR "/urls", file);
#else
QFileInfo fi;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) )
{ // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
if ( !d.cd("urls") )
{ // "/tmp"
- owarn << "Cannot find the \"~/" APPDIR "/urls\" directory" << oendl;
+ qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" );
d = QDir::home();
d.cd(APPDIR);
d.mkdir("urls");
d.cd("urls");
}
fi.setFile(d, file);
filename = fi.absFilePath();
#endif
FILE* fout = fopen(filename, "a");
if (fout != NULL)
{
fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href);
fclose(fout);
}
else
{
QMessageBox::warning(this, PROGNAME, "Problem with writing URL");
}
}
+
+QColor QTReaderApp::getcolour(int _c)
+{
+ QColor c = white;
+ switch (_c)
+ {
+ case 0:
+ c = white;
+ break;
+ case 1:
+ c = black;
+ break;
+ case 2:
+ c = darkGray;
+ break;
+ case 3:
+ c = gray;
+ break;
+ case 4:
+ c = lightGray;
+ break;
+ case 5:
+ c = red;
+ break;
+ case 6:
+ c = green;
+ break;
+ case 7:
+ c = blue;
+ break;
+ case 8:
+ c = cyan;
+ break;
+ case 9:
+ c = magenta;
+ break;
+ case 10:
+ c = yellow;
+ break;
+ case 11:
+ c = darkRed;
+ break;
+ case 12:
+ c = darkGreen;
+ break;
+ case 13:
+ c = darkBlue;
+ break;
+ case 14:
+ c = darkCyan;
+ break;
+ case 15:
+ c = darkMagenta;
+ break;
+ case 16:
+ c = darkYellow;
+ break;
+ default:
+ c = lightGray;
+ break;
+ }
+ return c;
+}
+
+void QTReaderApp::setscrollcolour()
+{
+ /*
+ QColor xc = getcolour(m_scrollcolor);
+ int r,g,b;
+ xc.rgb(&r,&g,&b);
+ reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b);
+ */
+ reader->m_scrollcolor = getcolour(m_scrollcolor);
+}
+
+void QTReaderApp::setscrollbarcolour()
+{
+ /*
+ QColor xc = getcolour(m_scrollcolor);
+ int r,g,b;
+ xc.rgb(&r,&g,&b);
+ reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b);
+ */
+ reader->m_scrollbarcolor = getcolour(m_scrollbarcolor);
+}
+
+void QTReaderApp::forceopen(const QString& filename)
+{
+ /*
+ QFileInfo fi(reader->m_lastfile);
+ fi = QFileInfo(filename);
+ QString flnm = fi.absFilePath();
+ */
+ if (!filename.isEmpty())
+ {
+ updatefileinfo();
+ if (pBkmklist != NULL)
+ {
+ if (m_fBkmksChanged)
+ {
+ savebkmks();
+ }
+ delete pBkmklist;
+ pBkmklist = NULL;
+ m_fBkmksChanged = false;
+ }
+ reader->disableAutoscroll();
+ openFile(filename);
+ reader->setFocus();
+ }
+}
+
+void QTReaderApp::actionscroll(int v)
+{
+ if (reader->m_rotated)
+ {
+ reader->dopageup(reader->buffdoc.startSection()+reader->buffdoc.endSection()-v);
+ }
+ else
+ {
+ /*
+ if (reader->pagelocate() < v)
+ {
+ while (reader->pagelocate() < v) reader->lineDown();
+ }
+ else
+ */
+ reader->locate(v);
+ }
+}
+
+void QTReaderApp::setBackgroundBitmap()
+{
+#ifdef USEQPE
+ QString file = APPDIR "/Themes/";
+ file += m_themename;
+ QString tgt = Global::applicationFileName(file,"background");
+#else
+ QString tgt(QDir::homeDirPath());
+ tgt += QString("/" APPDIR "/Themes/") + m_themename + "/background";
+#endif
+ qDebug("Trying to load %s", (const char *)tgt);
+ QPixmap pm(tgt);
+ reader->setBackgroundBitmap(pm, m_bgtype);
+}
+
+/*
+
+ myChannel = new QCopChannel( "QPE/FooBar", this );
+ connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)),
+ this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) );
+
+*/
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
@@ -1,442 +1,485 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __QTREADERAPP_H
#define __QTREADERAPP_H
//#define _SCROLLPIPE
//#define __ISEARCH
//#define MAX_ENCODING 6
#define MAX_ACTIONS 5
#include "useqpe.h"
#include <sys/timeb.h>
#include <qmainwindow.h>
#include "CExpander.h"
#include "CEncoding.h"
#include <qlist.h>
//#include <qpe/filemanager.h>
#include <qmap.h>
#include <qlineedit.h>
#include <qstack.h>
#include <qlistbox.h>
+#ifdef USEQPE
+#include <qpe/qpeapplication.h>
+#endif
+#include "orkey.h"
//#include "Queue.h"
+#include "BGType.h"
+class QBoxLayout;
class QWidgetStack;
class QToolButton;
class QPopupMenu;
class QToolBar;
#ifdef USEQPE
-class QToolBar;
-class QMenuBar;
+class QPEToolBar;
+class QPEMenuBar;
#endif
+class QScrollBar;
class CBkmkSelector;
class QProgressBar;
class QAction;
class CAnnoEdit;
class QFloatBar;
class CDrawBuffer;
class QTReader;
class QImage;
class Config;
+class CButtonPrefs;
-enum ActionTypes
-{
- cesNone = 0,
- cesOpenFile,
- cesAutoScroll,
- cesActionMark,
- cesActionAnno,
- cesFullScreen,
- cesZoomIn,
- cesZoomOut,
- cesBack,
- cesForward,
- cesHome,
- cesPageUp,
- cesPageDown,
- cesLineUp,
- cesLineDown,
- cesStartDoc,
- cesEndDoc
-};
-/*
-*m_preferences_action, *m_close_action *m_info_action, *m_touch_action,
-*m_find_action, *m_jump_action, *m_setfont_action *m_goto_action,
-*m_delete_action; *m_autogen_action, *m_clear_action, *m_save_action;
-*m_tidy_action, *m_startBlock_action, *m_endBlock_action;
-*m_setenc_action, *m_setmono_action;
-*/
+#ifdef USEQPE
enum ToolbarPolicy
{
cesSingle = 0,
cesMenuTool,
cesMultiple
};
+#else
+enum ToolbarPolicy
+{
+ cesMenuTool = 0,
+ cesMultiple
+};
+#endif
enum regedit_type
{
cAutoGen,
cAddBkmk,
cJump,
cMonoSpace,
cSetTarget,
#ifdef _SCROLLPIPE
cSetPipeTarget,
#endif
cSetConfigName,
cMargin,
cExtraSpace,
- cExtraLead
+ cExtraLead,
+ cRepara
};
enum bkmk_action
{
cOpenFile,
cGotoBkmk,
cDelBkmk,
cRmBkmkFile,
cLdConfig,
cRmConfig,
- cExportLinks
+ cExportLinks,
+ cLdTheme
};
enum fontselector_action
{
cChooseFont,
cChooseEncoding
};
#ifdef __ISEARCH
struct searchrecord
{
QString s;
size_t pos;
searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {}
};
#endif
class infowin;
class GraphicWin;
class QTReaderApp : public QMainWindow
{
Q_OBJECT
+ QColor getcolour(int c);
+
+ QMap<orKey, int> kmap;
unsigned long m_savedpos;
int m_debounce;
+ bool m_kmapchanged;
+ bground m_bgtype;
timeb m_lastkeytime;
+ QScrollBar* m_scrollbar;
+ QScrollBar* scrollbar;
+ int m_qtscroll, m_localscroll;
+ bool m_hidebars, m_scrollishidden, m_statusishidden;
+ QBoxLayout *m_layout;
+ QLabel* m_prog;
bool m_annoIsEditing;
bool m_propogatefontchange, m_bFloatingDialog;
bool m_url_clipboard, m_url_localfile, m_url_globalfile;
+ CButtonPrefs* m_buttonprefs;
fontselector_action m_fontAction;
- void doAction(ActionTypes a, QKeyEvent* e);
+ void doAction(QKeyEvent* e);
public:
QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~QTReaderApp();
- void handlekey(QKeyEvent* e);
void hideEvent(QHideEvent*)
{
+#ifdef USEQPE
+ if (m_grabkeyboard)
+ {
+ ((QPEApplication*)qApp)->ungrabKeyboard();
+ }
+#endif
suspend();
}
-
+#ifdef USEQPE
+ void showEvent(QShowEvent*)
+ {
+ if (m_grabkeyboard)
+ {
+ ((QPEApplication*)qApp)->grabKeyboard();
+ }
+ }
+#endif
void suspend();
void openFile( const QString & );
- void setScrollState(bool _b);
protected:
void setfontHelper(const QString& lcn, int size = 0);
QAction* m_bkmkAvail, *m_actFullscreen;
CAnnoEdit* m_annoWin;
Bkmk* m_anno;
+ int m_scrollcolor, m_scrollbarcolor, m_background, m_foreground;
// void resizeEvent(QResizeEvent* e);
void closeEvent( QCloseEvent *e );
+#ifdef NEWFULLSCREEN
+ void resizeEvent(QResizeEvent *);
+ void focusInEvent(QFocusEvent*);
+ void enableFullscreen();
+#endif
void readbkmks();
void do_mono(const QString&);
void do_jump(const QString&);
+ void do_reparastring(const QString&);
void do_settarget(const QString&);
#ifdef _SCROLLPIPE
// void do_setpipetarget(const QString&);
#endif
void do_saveconfig(const QString&, bool);
- bool readconfig(const QString&, bool);
- bool PopulateConfig(const char*);
+ bool readconfig(const QString&, const QString&, bool);
+ bool PopulateConfig(const char*, bool usedirs = false);
ActionTypes ActNameToInt(const QString&);
+#ifdef USEQPE
+ bool m_grabkeyboard;
+#endif
bool m_doAnnotation;
bool m_doDictionary;
bool m_doClipboard;
bool m_fullscreen;
bool m_loadedconfig;
public:
void saveprefs();
public slots:
+ void setBackgroundBitmap();
+ void UpdateStatus();
+ void setScrollState(bool _b);
+ void handlekey(QKeyEvent* e);
+ void forceopen(const QString& filename);
void setDocument(const QString&);
private slots:
#ifdef _SCRIPT
// void RunScript();
#endif
+ void actionscroll(int v);
void SaveConfig();
+ void LoadTheme();
void LoadConfig();
void TidyConfig();
void ExportLinks();
void zoomin();
void zoomout();
void chooseencoding();
void setfullscreen(bool sfs);
+ void setrotated(bool sfs);
+ void setinverted(bool sfs);
+ void setgrab(bool sfs);
// void setcontinuous(bool sfs);
void setTwoTouch(bool _b);
void restoreFocus();
void OnAnnotation(bool _b)
{
m_doAnnotation = _b;
}
void OnDictionary(bool _b)
{
m_doDictionary = _b;
}
void OnClipboard(bool _b)
{
m_doClipboard = _b;
}
- void OnWordSelected(const QString&, size_t, const QString&);
- void OnURLSelected(const QString& href);
+ void OnWordSelected(const QString&, size_t, size_t, const QString&);
+ void OnURLSelected(const QString& href, const size_t tgt);
void showgraphic(QImage&);
- void addAnno(const QString&, const QString&, size_t);
+ void addAnno(const QString&, const QString&, size_t, size_t);
void addAnno(const QString&, const QString&);
void addanno();
void showAnnotation();
void do_setencoding(int i);
void do_setfont(const QString&);
- void buttonActionSelected(QAction*);
-// void msgHandler(const QCString&, const QByteArray&);
+ // void buttonActionSelected(QAction*);
+ void msgHandler(const QCString&, const QByteArray&);
void monospace(bool);
void jump();
+ void reparastring();
void settarget();
#ifdef _SCROLLPIPE
// void setpipetarget();
// void setpause(bool);
#endif
// void setspacing();
void setfont();
void clearBkmkList();
void listBkmkFiles();
void editMark();
void autoScroll(bool);
void addbkmk();
void savebkmks();
// void importFiles();
void showprefs();
void showtoolbarprefs();
+ void showbuttonprefs();
void infoClose();
// void oldFile();
void showinfo();
// void indentplus();
// void indentminus();
void fileOpen();
void fileClose();
void editCopy();
void editFind();
void gotoStart();
void gotoEnd();
void pageup();
void pagedn();
void findNext();
void findClose();
void regClose();
#ifdef __ISEARCH
// void search( const QString& );
#else
void search();
#endif
void showEditTools();
// void stripcr(bool);
// void setfulljust(bool);
// void onespace(bool);
-#ifdef REPALM
// void repalm(bool);
-#endif
// void peanut(bool _b);
// void remap(bool);
// void embolden(bool);
// void autofmt(bool);
// void textfmt(bool);
// void striphtml(bool);
// void dehyphen(bool);
// void depluck(bool);
// void dejpluck(bool);
// void unindent(bool);
// void repara(bool);
// void dblspce(bool);
void pagemode(bool);
// void gotobkmk(const QString& bm);
void gotobkmk(int);
void cancelbkmk();
void do_gotomark();
void do_delmark();
void do_autogen();
void do_regaction();
void OnRedraw();
private:
+ void setscrollcolour();
+ void setscrollbarcolour();
void writeUrl(const QString& file, const QString& href);
QAction *m_preferences_action, *m_open_action, *m_close_action;
QAction *m_info_action, *m_touch_action, *m_find_action, *m_start_action;
QAction *m_end_action, *m_jump_action, *m_pageline_action;
QAction *m_pageup_action, *m_pagedn_action, *m_back_action;
QAction *m_home_action, *m_forward_action, *m_zoomin_action;
QAction *m_zoomout_action, *m_setfont_action, *m_mark_action;
QAction *m_annotate_action, *m_goto_action, *m_delete_action;
QAction *m_autogen_action, *m_clear_action, *m_save_action;
QAction *m_tidy_action, *m_startBlock_action, *m_endBlock_action;
QAction *m_setenc_action, *m_setmono_action, *m_saveconfig_action;
- QAction *m_loadconfig_action, *m_toolbarprefs_action, *m_tidyconfig_action;
- QAction *m_exportlinks_action;
+ QAction *m_loadconfig_action, *m_loadtheme_action, *m_toolbarprefs_action, *m_tidyconfig_action;
+ QAction *m_exportlinks_action, *m_rotate_action, *m_buttonprefs_action, *m_inverse_action;
+ QAction *m_repara_action;
+#ifdef USEQPE
+ QAction *m_grab_action;
+#endif
void addtoolbars(Config* config);
ToolbarPolicy m_tbpol, m_tbpolsave;
ToolBarDock m_tbposition;
bool m_tbmove, m_tbmovesave;
QToolBar* filebar();
QToolBar* viewbar();
QToolBar* navbar();
QToolBar* markbar();
void hidetoolbars();
void addfilebar(Config* _config, const QString& key, QAction* a);
void addviewbar(Config* _config, const QString& key, QAction* a);
void addnavbar(Config* _config, const QString& key, QAction* a);
void addmarkbar(Config* _config, const QString& key, QAction* a);
bool checkbar(Config* _config, const QString& key);
#ifdef _SCRIPT
void SaveScript(const char* sname);
#endif
/*
void setstate(unsigned char* _sd, unsigned short _sdlen);
void getstate(unsigned char*& data, unsigned short& len);
*/
void fileOpen2();
void readfilelist();
void savefilelist();
void updatefileinfo();
bool openfrombkmk(Bkmk*);
- QString m_targetapp, m_targetmsg;
+ QString m_targetapp, m_targetmsg, m_statusstring, m_themename;
bool listbkmk(CList<Bkmk>*, const QString& _lab = QString::null);
QString usefilebrowser();
void do_regedit();
void colorChanged( const QColor &c );
void clear();
void updateCaption();
void do_autogen(const QString&);
void do_addbkmk(const QString&);
bool findNextBookmark(size_t start);
private:
QAction* m_scrollButton;
QAction* m_buttonAction[MAX_ACTIONS];
CBkmkSelector* bkmkselector;
- ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget,
- m_upTarget, m_downTarget;
- bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll;
+ // ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget,
+ //m_upTarget, m_downTarget;
+ //bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll;
bool m_bcloseDisabled, m_disableesckey;
size_t searchStart;
#ifdef __ISEARCH
QStack<searchrecord>* searchStack;
bool dosearch(size_t start, CDrawBuffer& test, const QString& arg);
#else
bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg);
#endif
QWidgetStack *editorStack;
QTReader* reader;
QComboBox* m_fontSelector;
-// QToolBar /* *menu,*/ *fileBar;
- QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar;
+// QPEToolBar /* *menu,*/ *fileBar;
#ifdef USEQPE
- QMenuBar *mb;
+ QToolBar *menubar;
+#endif
+ QToolBar *fileBar, *navBar, *viewBar, *markBar;
+#ifdef USEQPE
+ QPEMenuBar *mb;
#else
QMenuBar *mb;
#endif
QFloatBar *searchBar, *regBar/*, *m_fontBar*/;
QToolBar /* *searchBar, *regBar,*/ *m_fontBar;
QLineEdit *searchEdit, *regEdit;
bool searchVisible;
bool regVisible;
bool m_fontVisible, m_twoTouch;
- bool bFromDocView;
static unsigned long m_uid;
long unsigned get_unique_id() { return m_uid++; }
/*
void resizeEvent( QResizeEvent * r)
{
-// odebug << "resize:(" << r->oldSize().width() << "," << r->oldSize().height() << ")" << oendl;
-// odebug << "resize:(" << r->size().width() << "," << r->size().height() << ")" << oendl;
+// qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height());
+// qDebug("resize:(%u,%u)", r->size().width(), r->size().height());
// bgroup->move( width()-bgroup->width(), 0 );
}
*/
CList<Bkmk>* pBkmklist;
CList<Bkmk>* pOpenlist;
infowin* m_infoWin;
GraphicWin* m_graphicwin;
QProgressBar* pbar;
bool m_fBkmksChanged;
// int m_nRegAction;
regedit_type m_nRegAction;
bkmk_action m_nBkmkAction;
QString m_autogenstr;
bool m_dontSave;
};
//const int cAutoGen = 0;
//const int cAddBkmk = 1;
//const int cDelBkmk = 2;
//const int cGotoBkmk = 3;
//const int cRmBkmkFile = 4;
//const int cJump = 5;
//const int cMonoSpace = 6;
//const int cOverlap = 7;
//const int cSetTarget = 8;
//const int cOpenFile = 9;
//const int cSetPipeTarget = 10;
//const int cSetConfigName = 11;
//const int cMargin = 12;
//const int cExtraSpace = 14;
//const int cExtraLead = 15;
//const int cGfxSize = 16;
//const int cChooseFont = 2;
//const int cChooseEncoding = 1;
#endif
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
@@ -1,21 +1,13 @@
#ifndef __QUEUE_H
#define __QUEUE_H
#include "my_list.h"
template<class T>
class CQueue : public CList<T>
{
public:
- bool empty() { return (front == NULL); }
+ bool empty() { return (CList<T>::front == NULL); }
void push(const T& t) { push_back(t); }
- T pop()
- {
- T data = front->data;
- node* n = front;
- front = front->next;
- delete n;
- return data;
- }
};
#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 @@
-#ifndef __STATEDATA_H
-#define __STATEDATA_H
-
-struct statedata
-{
- bool bstripcr/*:1*/;
- bool btextfmt/*:1*/;
- bool bautofmt/*:1*/;
- bool bstriphtml/*:1*/;
- bool bpeanut/*:1*/;
- bool bdehyphen/*:1*/;
- bool bdepluck/*:1*/;
- bool bonespace/*:1*/;
- bool bunindent/*:1*/;
- bool brepara/*:1*/;
- bool bdblspce/*:1*/;
- bool m_bpagemode/*:1*/;
- bool m_navkeys/*:1*/;
- bool m_bMonoSpaced/*:1*/;
- bool bremap/*:1*/;
- bool bmakebold/*:1*/;
- bool Continuous/*:1*/;
-#ifdef REPALM
- bool brepalm/*:1*/;
-#endif
- int bindenter;
- int m_textsize;
- int m_encd;
- int m_charpc;
- char m_fontname[1];
-};
-
-#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
@@ -1,94 +1,108 @@
#include <qimage.h>
#include "StyleConsts.h"
GraphicLink::~GraphicLink() { delete graphic; }
pmstore::~pmstore()
{
-//// odebug << "Deleting image" << oendl;
+//// qDebug("Deleting image");
delete graphic;
}
CStyle::~CStyle()
{
if (graphic != NULL)
{
if (--(graphic->count) == 0)
{
delete graphic;
}
}
}
CStyle::CStyle(const CStyle& rhs) : graphic(NULL)
{
*this = rhs;
}
CStyle& CStyle::operator=(const CStyle& rhs)
{
if (rhs.graphic != NULL)
{
(rhs.graphic->count)++;
if (graphic != NULL)
{
if (--(graphic->count) == 0)
{
delete graphic;
}
}
graphic = rhs.graphic;
}
else
{
if (graphic != NULL)
{
if (--(graphic->count) == 0)
{
delete graphic;
}
graphic = NULL;
}
}
sty = rhs.sty;
return *this;
}
void CStyle::clearPicture()
{
if (graphic != NULL)
{
if (--(graphic->count) == 0)
{
delete graphic;
}
graphic = NULL;
}
}
void CStyle::unset()
{
sty.unset();
if (graphic != NULL)
{
if (--(graphic->count) == 0)
{
delete graphic;
}
graphic = NULL;
}
}
void CStyle::setPicture(bool canScale, QImage* _g, bool il, unsigned long tgt)
{
if (graphic != NULL)
{
if (--(graphic->count) == 0)
{
delete graphic;
}
graphic = NULL;
}
if (_g != NULL) graphic = new pmstore(canScale, _g, il, tgt);
}
+
+void CStyle::invert()
+{
+ qDebug("Before:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue);
+ qDebug("Before:<%02x%02x%02x>", sty.red, sty.green, sty.blue);
+ sty.bred = 255-sty.bred;
+ sty.bgreen = 255-sty.bgreen;
+ sty.bblue = 255-sty.bblue;
+ sty.red = 255-sty.red;
+ sty.green = 255-sty.green;
+ sty.blue = 255-sty.blue;
+ qDebug("After:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue);
+ qDebug("After:<%02x%02x%02x>", sty.red, sty.green, sty.blue);
+}
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
@@ -1,188 +1,222 @@
#ifndef __STYLECONSTS_H
#define __STYLECONSTS_H
typedef unsigned short StyleType;
+#ifdef _WINDOWS
+#include <string.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <qglobal.h>
class QImage;
struct GraphicLink
{
QImage* graphic;
bool isLink;
unsigned long link;
GraphicLink(QImage* p, bool isLnk, unsigned long tgt) :
graphic(p), isLink(isLnk), link(tgt) {}
~GraphicLink();
};
struct pmstore
{
unsigned int count;
bool m_isScaleable;
GraphicLink* graphic;
pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt) : count(1), m_isScaleable(_canScale)
{
graphic = new GraphicLink(p, isLnk, tgt);
}
~pmstore();
};
enum EalignmentType
{
m_AlignLeft,
m_AlignRight,
m_AlignCentre,
m_AlignJustify
};
class CBasicStyle
{
friend class CStyle;
bool m_bold,
m_italic;
int m_fontsize;
EalignmentType m_align;
unsigned char red, green, blue;
+ unsigned char bred, bgreen, bblue;
+ unsigned char pred, pgreen, pblue;
unsigned long data;
+ unsigned long offset;
bool isLink;
+ // bool isVisited;
bool m_underline;
bool m_strikethru;
bool m_monospaced;
unsigned char m_leftmargin, m_rightmargin;
signed char m_extraspace;
signed char m_voffset;
CBasicStyle()
{
unset();
}
bool operator!=(const CBasicStyle& rhs)
{
return (memcmp(this, &rhs, sizeof(CBasicStyle)) != 0);
}
void unset()
{
m_bold = false;
m_italic = false;
m_fontsize = 0;
m_align = m_AlignLeft;
red = green = blue = 0;
+ bred = bgreen = bblue = 255;
+ pred = pgreen = pblue = 255;
data = 0;
+ offset = 0;
isLink = false;
+ // isVisited = false;
m_underline = false;
m_strikethru = false;
m_leftmargin = 0;
m_rightmargin = 0;
m_monospaced = false;
m_extraspace = 0;
m_voffset = 0;
}
};
class CStyle
{
CBasicStyle sty;
pmstore* graphic;
public:
signed char getVOffset() { return sty.m_voffset; }
void setVOffset(signed char sp) { sty.m_voffset = sp; }
signed char getExtraSpace() { return sty.m_extraspace; }
void setExtraSpace(signed char sp) { sty.m_extraspace = sp; }
bool getPictureLink()
{
return (graphic != NULL && graphic->graphic->isLink);
}
unsigned long getPictureLinkData()
{
return graphic->graphic->link;
}
void setLeftMargin(unsigned char m) { sty.m_leftmargin = m; }
unsigned char getLeftMargin() { return sty.m_leftmargin; }
void setRightMargin(unsigned char m) { sty.m_rightmargin = m; }
unsigned char getRightMargin() { return sty.m_rightmargin; }
unsigned char Red() { return sty.red; }
unsigned char Green() { return sty.green; }
unsigned char Blue() { return sty.blue; }
void setColour(unsigned char r, unsigned char g, unsigned char b)
{
sty.red = r;
sty.green = g;
sty.blue = b;
}
+ unsigned char bRed() { return sty.bred; }
+ unsigned char bGreen() { return sty.bgreen; }
+ unsigned char bBlue() { return sty.bblue; }
+ unsigned char pRed() { return sty.pred; }
+ unsigned char pGreen() { return sty.pgreen; }
+ unsigned char pBlue() { return sty.pblue; }
+ void setPaper(unsigned char r, unsigned char g, unsigned char b)
+ {
+ sty.pred = r;
+ sty.pgreen = g;
+ sty.pblue = b;
+ }
+ void setBackground(unsigned char r, unsigned char g, unsigned char b)
+ {
+ sty.bred = r;
+ sty.bgreen = g;
+ sty.bblue = b;
+ }
CStyle() : graphic(NULL) {}
~CStyle();
// CStyle(CStyle&);
CStyle(const CStyle&);
CStyle& operator=(const CStyle&);
void unset();
- bool isPicture() { return (graphic != NULL); }
- bool canScale() { return graphic->m_isScaleable; }
+ bool isPicture() const { return (graphic != NULL); }
+ bool canScale() const { return graphic->m_isScaleable; }
void clearPicture();
void setPicture(bool canScale, QImage* _g, bool il=false, unsigned long tgt=0);
QImage* getPicture()
{
QImage* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL);
return pm;
}
void setUnderline() { sty.m_underline = true; }
void unsetUnderline() { sty.m_underline = false; }
bool isUnderline() { return sty.m_underline; }
void setStrikethru() { sty.m_strikethru = true; }
void unsetStrikethru() { sty.m_strikethru = false; }
bool isStrikethru() { return sty.m_strikethru; }
void setBold() { sty.m_bold = true; }
void unsetBold() { sty.m_bold = false; }
bool isBold() { return sty.m_bold; }
void setItalic() { sty.m_italic = true; }
void unsetItalic() { sty.m_italic = false; }
bool isItalic() { return sty.m_italic; }
void setMono() { sty.m_monospaced = true; }
void unsetMono() { sty.m_monospaced = false; }
bool isMono() { return sty.m_monospaced; }
void setLeftJustify()
{
sty.m_align = m_AlignLeft;
}
void setRightJustify()
{
sty.m_align = m_AlignRight;
}
void setCentreJustify()
{
sty.m_align = m_AlignCentre;
}
void setFullJustify()
{
sty.m_align = m_AlignJustify;
}
StyleType getJustify()
{
return sty.m_align;
}
void setFontSize(int _fs)
{
sty.m_fontsize = _fs;
}
int getFontSize() const
{
return sty.m_fontsize;
}
bool operator!=(const CStyle& rhs)
{
return
(
(sty != rhs.sty) ||
(graphic != rhs.graphic)
);
}
void setLink(bool _l) { sty.isLink = _l; }
bool getLink() { return sty.isLink; }
+ // void setVisited(bool _l) { sty.isVisited = _l; }
+ // bool getVisited() { return sty.isVisited; }
void setData(unsigned long _d) { sty.data = _d; }
unsigned long getData() { return sty.data; }
+ void setOffset(unsigned long _d) { sty.offset = _d; }
+ unsigned long getOffset() { return sty.offset; }
+ void invert();
};
#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
@@ -1,491 +1,547 @@
/****************************************************************************
** Form implementation generated from reading ui file 'Prefs.ui'
**
** Created: Tue Feb 11 23:53:35 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
+#include "useqpe.h"
#include "ToolbarPrefs.h"
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qcombobox.h>
#include <qbuttongroup.h>
+#include <qlineedit.h>
#ifdef USEQPE
#include <qpe/menubutton.h>
#endif
-#include <qpe/qpeapplication.h>
CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir )
{
setCaption(tr( "Toolbar Settings" ) );
QTabWidget* td = new QTabWidget(this);
misc = new CMiscBarPrefs(this);
filebar = new CFileBarPrefs(config, this);
navbar = new CNavBarPrefs(config, this);
viewbar = new CViewBarPrefs(config, this);
markbar = new CMarkBarPrefs(config, this);
indbar = new CIndBarPrefs(config, this);
td->addTab(filebar, tr("File"));
td->addTab(navbar, tr("Navigation"));
td->addTab(viewbar, tr("View"));
td->addTab(markbar, tr("Marks"));
td->addTab(indbar, tr("Indicators"));
td->addTab(misc, tr("Policy"));
QVBoxLayout* v = new QVBoxLayout(this);
v->addWidget(td);
- if (fs)
- QPEApplication::showDialog( this );
+ if (fs) showMaximized();
}
/*
CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
config.setGroup( "Toolbar" );
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(3, Qt::Horizontal, "File", this);
vb->addWidget(bg);
open = new QCheckBox( tr("Open"), bg );
open->setChecked(config.readBoolEntry( "Open", false ));
connect(open, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
close = new QCheckBox( tr("Close"), bg );
close->setChecked(config.readBoolEntry( "Close", false ));
connect(close, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
info = new QCheckBox( tr("Info"), bg );
info->setChecked(config.readBoolEntry( "Info", false ));
connect(info, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
twotouch = new QCheckBox( tr("Two/One\nTouch"), bg );
twotouch->setChecked(config.readBoolEntry( "Two/One Touch", false ));
connect(twotouch, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
find = new QCheckBox( tr("Find"), bg );
find->setChecked(config.readBoolEntry( "Find", false ));
connect(find, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this);
vb->addWidget(bg);
scroll = new QCheckBox( tr("Scroll"), bg );
scroll->setChecked(config.readBoolEntry( "Scroll", false ));
connect(scroll, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
navigation = new QCheckBox( tr("Back/Home/Forward"), bg );
navigation->setChecked(config.readBoolEntry( "Back/Home/Forward", false ));
connect(navigation, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
page = new QCheckBox( tr("Page\nUp/Down"), bg );
page->setChecked(config.readBoolEntry( "Page Up/Down", false ));
connect(page, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
startend = new QCheckBox( tr("Goto Start/End"), bg );
startend->setChecked(config.readBoolEntry( "Goto Start/End", false ));
connect(startend, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
jump = new QCheckBox( tr("Jump"), bg );
jump->setChecked(config.readBoolEntry( "Jump", false ));
connect(jump, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
pageline = new QCheckBox( tr("Page/Line Scroll"), bg );
pageline->setChecked(config.readBoolEntry( "Page/Line Scroll", false ));
connect(pageline, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CBarPrefs1::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Open", open->isChecked());
config.writeEntry( "Close", close->isChecked());
config.writeEntry( "Info", info->isChecked());
config.writeEntry( "Two/One Touch", twotouch->isChecked());
config.writeEntry( "Find", find->isChecked());
config.writeEntry( "Scroll", scroll->isChecked());
config.writeEntry( "Back/Home/Forward", navigation->isChecked());
config.writeEntry( "Page Up/Down", page->isChecked());
config.writeEntry( "Goto Start/End", startend->isChecked());
config.writeEntry( "Jump", jump->isChecked());
config.writeEntry( "Page/Line Scroll", pageline->isChecked());
}
CBarPrefs1::~CBarPrefs1()
{
}
*/
/*
CBarPrefs2::CBarPrefs2( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(3, Qt::Horizontal, "View", this);
vb->addWidget(bg);
config.setGroup( "Toolbar" );
fullscreen = new QCheckBox( tr("Fullscreen"), bg );
fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false ));
connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
+ rotate = new QCheckBox( tr("Rotate"), bg );
+ rotate->setChecked(config.readBoolEntry( "Rotate", false ));
+ connect(rotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
+
+ invert = new QCheckBox( tr("Invert"), bg );
+ invert->setChecked(config.readBoolEntry( "Invert Action", false ));
+ connect(invert, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
+
zoom = new QCheckBox( tr("Zoom"), bg );
zoom->setChecked(config.readBoolEntry( "Zoom In/Out", false ));
connect(zoom, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
setfont = new QCheckBox( tr("Set Font"), bg );
setfont->setChecked(config.readBoolEntry( "Set Font", false ));
connect(setfont, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
encoding = new QCheckBox( tr("Encoding"), bg );
encoding->setChecked(config.readBoolEntry("Encoding Select", false));
connect(encoding, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
ideogram = new QCheckBox( tr("Ideogram"), bg );
ideogram->setChecked(config.readBoolEntry("Ideogram Mode", false));
connect(ideogram, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
bg = new QGroupBox(3, Qt::Horizontal, "Marks", this);
vb->addWidget(bg);
mark = new QCheckBox( tr("Bookmark"), bg );
mark->setChecked(config.readBoolEntry( "Mark", false ));
connect(mark, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
annotate = new QCheckBox( tr("Annotate"), bg );
annotate->setChecked(config.readBoolEntry( "Annotate", false ));
connect(annotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
go_to = new QCheckBox( tr("Goto"), bg );
go_to->setChecked(config.readBoolEntry( "Goto", false ));
connect(go_to, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
Delete = new QCheckBox( tr("Delete"), bg );
Delete->setChecked(config.readBoolEntry( "Delete", false ));
connect(Delete, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
autogen = new QCheckBox( tr("Autogen"), bg );
autogen->setChecked(config.readBoolEntry( "Autogen", false ));
connect(autogen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
clear = new QCheckBox( tr("Clear"), bg );
clear->setChecked(config.readBoolEntry( "Clear", false ));
connect(clear, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
save = new QCheckBox( tr("Save"), bg );
save->setChecked(config.readBoolEntry( "Save", false ));
connect(save, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
tidy = new QCheckBox( tr("Tidy"), bg );
tidy->setChecked(config.readBoolEntry( "Tidy", false ));
connect(tidy, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
block = new QCheckBox( tr("Mark/Copy"), bg );
block->setChecked(config.readBoolEntry( "Start/Copy Block", false ));
connect(block, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
bg = new QGroupBox(1, Qt::Horizontal, "Indicators", this);
vb->addWidget(bg);
indannotate = new QCheckBox( tr("Annotation"), bg );
indannotate->setChecked(config.readBoolEntry( "Annotation indicator", false ));
connect(indannotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CBarPrefs2::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Fullscreen", fullscreen->isChecked());
+ config.writeEntry( "Rotate", rotate->isChecked());
+ config.writeEntry( "Invert Action", invert->isChecked());
config.writeEntry( "Zoom In/Out", zoom->isChecked());
config.writeEntry( "Set Font", setfont->isChecked());
config.writeEntry("Encoding Select", encoding->isChecked());
config.writeEntry("Ideogram Mode", ideogram->isChecked());
config.writeEntry( "Mark", mark->isChecked());
config.writeEntry( "Annotate", annotate->isChecked());
config.writeEntry( "Goto", go_to->isChecked());
config.writeEntry( "Delete", Delete->isChecked());
config.writeEntry( "Autogen", autogen->isChecked());
config.writeEntry( "Clear", clear->isChecked());
config.writeEntry( "Save", save->isChecked());
config.writeEntry( "Tidy", tidy->isChecked());
config.writeEntry( "Start/Copy Block", block->isChecked());
config.writeEntry( "Annotation indicator", indannotate->isChecked());
}
CBarPrefs2::~CBarPrefs2()
{
}
*/
CFileBarPrefs::CFileBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
config.setGroup( "Toolbar" );
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "File", this);
vb->addWidget(bg);
open = new QCheckBox( tr("Open"), bg );
open->setChecked(config.readBoolEntry( "Open", false ));
connect(open, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
close = new QCheckBox( tr("Close"), bg );
close->setChecked(config.readBoolEntry( "Close", false ));
connect(close, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
info = new QCheckBox( tr("Info"), bg );
info->setChecked(config.readBoolEntry( "Info", false ));
connect(info, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
twotouch = new QCheckBox( tr("Two/One\nTouch"), bg );
twotouch->setChecked(config.readBoolEntry( "Two/One Touch", false ));
connect(twotouch, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
find = new QCheckBox( tr("Find"), bg );
find->setChecked(config.readBoolEntry( "Find", false ));
connect(find, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CFileBarPrefs::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Open", open->isChecked());
config.writeEntry( "Close", close->isChecked());
config.writeEntry( "Info", info->isChecked());
config.writeEntry( "Two/One Touch", twotouch->isChecked());
config.writeEntry( "Find", find->isChecked());
}
CFileBarPrefs::~CFileBarPrefs()
{
}
CNavBarPrefs::CNavBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
config.setGroup( "Toolbar" );
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this);
vb->addWidget(bg);
scroll = new QCheckBox( tr("Scroll"), bg );
scroll->setChecked(config.readBoolEntry( "Scroll", false ));
connect(scroll, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
navback = new QCheckBox( tr("Back"), bg );
navback->setChecked(config.readBoolEntry( "Back", false ));
connect(navback, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
navhome = new QCheckBox( tr("Home"), bg );
navhome->setChecked(config.readBoolEntry( "Home", false ));
connect(navhome, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
navforward = new QCheckBox( tr("Forward"), bg );
navforward->setChecked(config.readBoolEntry( "Forward", false ));
connect(navforward, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
pageup = new QCheckBox( tr("Page Up"), bg );
pageup->setChecked(config.readBoolEntry( "Page Up", false ));
connect(pageup, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
pagedown = new QCheckBox( tr("Page Down"), bg );
pagedown->setChecked(config.readBoolEntry( "Page Down", false ));
connect(pagedown, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
gotostart = new QCheckBox( tr("Goto Start"), bg );
gotostart->setChecked(config.readBoolEntry( "Goto Start", false ));
connect(gotostart, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
gotoend = new QCheckBox( tr("Goto End"), bg );
gotoend->setChecked(config.readBoolEntry( "Goto End", false ));
connect(gotoend, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
jump = new QCheckBox( tr("Jump"), bg );
jump->setChecked(config.readBoolEntry( "Jump", false ));
connect(jump, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
pageline = new QCheckBox( tr("Page/Line Scroll"), bg );
pageline->setChecked(config.readBoolEntry( "Page/Line Scroll", false ));
connect(pageline, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CNavBarPrefs::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Scroll", scroll->isChecked());
config.writeEntry( "Back", navback->isChecked());
config.writeEntry( "Home", navhome->isChecked());
config.writeEntry( "Forward", navforward->isChecked());
config.writeEntry( "Page Up", pageup->isChecked());
config.writeEntry( "Page Down", pagedown->isChecked());
config.writeEntry( "Goto Start", gotostart->isChecked());
config.writeEntry( "Goto End", gotoend->isChecked());
config.writeEntry( "Jump", jump->isChecked());
config.writeEntry( "Page/Line Scroll", pageline->isChecked());
}
CNavBarPrefs::~CNavBarPrefs()
{
}
CViewBarPrefs::CViewBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "View", this);
vb->addWidget(bg);
config.setGroup( "Toolbar" );
fullscreen = new QCheckBox( tr("Fullscreen"), bg );
fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false ));
connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
+ rotate = new QCheckBox( tr("Rotate"), bg );
+ rotate->setChecked(config.readBoolEntry( "Rotate", false ));
+ connect(rotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
+
+ invert = new QCheckBox( tr("Invert"), bg );
+ invert->setChecked(config.readBoolEntry( "Invert Action", false ));
+ connect(invert, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
+
zoomin = new QCheckBox( tr("Zoom In"), bg );
zoomin->setChecked(config.readBoolEntry( "Zoom In", false ));
connect(zoomin, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
zoomout = new QCheckBox( tr("Zoom Out"), bg );
zoomout->setChecked(config.readBoolEntry( "Zoom Out", false ));
connect(zoomout, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
setfont = new QCheckBox( tr("Set Font"), bg );
setfont->setChecked(config.readBoolEntry( "Set Font", false ));
connect(setfont, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
encoding = new QCheckBox( tr("Encoding"), bg );
encoding->setChecked(config.readBoolEntry("Encoding Select", false));
connect(encoding, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
ideogram = new QCheckBox( tr("Ideogram"), bg );
ideogram->setChecked(config.readBoolEntry("Ideogram Mode", false));
connect(ideogram, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CViewBarPrefs::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Fullscreen", fullscreen->isChecked());
+ config.writeEntry( "Rotate", rotate->isChecked());
+ config.writeEntry( "Invert Action", invert->isChecked());
config.writeEntry( "Zoom In", zoomin->isChecked());
config.writeEntry( "Zoom Out", zoomout->isChecked());
config.writeEntry( "Set Font", setfont->isChecked());
config.writeEntry("Encoding Select", encoding->isChecked());
config.writeEntry("Ideogram Mode", ideogram->isChecked());
}
CViewBarPrefs::~CViewBarPrefs()
{
}
CMarkBarPrefs::CMarkBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Marks", this);
vb->addWidget(bg);
mark = new QCheckBox( tr("Bookmark"), bg );
mark->setChecked(config.readBoolEntry( "Mark", false ));
connect(mark, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
annotate = new QCheckBox( tr("Annotate"), bg );
annotate->setChecked(config.readBoolEntry( "Annotate", false ));
connect(annotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
go_to = new QCheckBox( tr("Goto"), bg );
go_to->setChecked(config.readBoolEntry( "Goto", false ));
connect(go_to, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
Delete = new QCheckBox( tr("Delete"), bg );
Delete->setChecked(config.readBoolEntry( "Delete", false ));
connect(Delete, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
autogen = new QCheckBox( tr("Autogen"), bg );
autogen->setChecked(config.readBoolEntry( "Autogen", false ));
connect(autogen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
clear = new QCheckBox( tr("Clear"), bg );
clear->setChecked(config.readBoolEntry( "Clear", false ));
connect(clear, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
save = new QCheckBox( tr("Save"), bg );
save->setChecked(config.readBoolEntry( "Save", false ));
connect(save, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
tidy = new QCheckBox( tr("Tidy"), bg );
tidy->setChecked(config.readBoolEntry( "Tidy", false ));
connect(tidy, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
startblock = new QCheckBox( tr("Mark Block"), bg );
startblock->setChecked(config.readBoolEntry( "Start Block", false ));
connect(startblock, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
copyblock = new QCheckBox( tr("Copy Block"), bg );
copyblock->setChecked(config.readBoolEntry( "Copy Block", false ));
connect(copyblock, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CMarkBarPrefs::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Mark", mark->isChecked());
config.writeEntry( "Annotate", annotate->isChecked());
config.writeEntry( "Goto", go_to->isChecked());
config.writeEntry( "Delete", Delete->isChecked());
config.writeEntry( "Autogen", autogen->isChecked());
config.writeEntry( "Clear", clear->isChecked());
config.writeEntry( "Save", save->isChecked());
config.writeEntry( "Tidy", tidy->isChecked());
config.writeEntry( "Start Block", startblock->isChecked());
config.writeEntry( "Copy Block", copyblock->isChecked());
}
CMarkBarPrefs::~CMarkBarPrefs()
{
}
CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
- QGridLayout* hl = new QGridLayout(this,1,2);
+ QGridLayout* hl = new QGridLayout(this,2,2);
hl->setMargin( 0 );
QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Dialogs", this);
floating = new QCheckBox(gb);
floating->setText(tr("Floating"));
-
-// QLabel* TextLabel = new QLabel( gb );
-// TextLabel->setText( tr( "Select Button" ) );
-
-
hl->addWidget( gb, 0, 0 );
gb = new QGroupBox(1, Qt::Horizontal, "Bars (Restart)", this);
// QLabel* ql = new QLabel("Restart to apply changes", gb);
// TextLabel = new QLabel( gb );
// TextLabel->setText( tr( "Policy" ) );
#ifdef USECOMBO
tbpolicy = new QComboBox(gb);
#else
tbpolicy = new MenuButton(gb);
#endif
tbpolicy->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+#ifdef USEQPE
tbpolicy->insertItem(tr("Single bar"));
tbpolicy->insertItem(tr("Menu/tool bar"));
tbpolicy->insertItem(tr("Multiple bars"));
+#else
+ tbpolicy->insertItem(tr("Single bar"));
+ tbpolicy->insertItem(tr("Multiple bars"));
+#endif
#ifdef USECOMBO
tbposition = new QComboBox(gb);
#else
tbposition = new MenuButton(gb);
#endif
tbposition->insertItem(tr("Top"));
tbposition->insertItem(tr("Bottom"));
tbposition->insertItem(tr("Right"));
tbposition->insertItem(tr("Left"));
tbposition->insertItem(tr("Minimised"));
tbmovable = new QCheckBox( tr("Movable"), gb );
-// ch->setChecked(config.readBoolEntry( "Movable", false ));
hl->addWidget(gb, 0, 1);
+ gb = new QGroupBox(1, Qt::Horizontal, "QT Scroll Bar", this);
+
+#ifdef USECOMBO
+ qtscroll = new QComboBox(gb);
+#else
+ qtscroll = new MenuButton(gb);
+#endif
+ qtscroll->insertItem(tr("None"));
+ qtscroll->insertItem(tr("Right"));
+ qtscroll->insertItem(tr("Left"));
+
+ hl->addWidget(gb, 1, 0);
+ gb = new QGroupBox(1, Qt::Horizontal, "Miniscroll", this);
+
+#ifdef USECOMBO
+ localscroll = new QComboBox(gb);
+#else
+ localscroll = new MenuButton(gb);
+#endif
+ localscroll->insertItem(tr("None"));
+ localscroll->insertItem(tr("Bottom"));
+ localscroll->insertItem(tr("Right"));
+ localscroll->insertItem(tr("Left"));
+
+ //scrollonleft = new QCheckBox( tr("... on Left"), gb );
+ // ch->setChecked(config.readBoolEntry( "Movable", false ));
+
+ hl->addWidget(gb, 1, 1);
+
}
CMiscBarPrefs::~CMiscBarPrefs()
{
// no need to delete child widgets, Qt does it all for us
}
CIndBarPrefs::CIndBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ), config(_config)
{
QVBoxLayout* vb = new QVBoxLayout(this);
QGroupBox* bg = new QGroupBox(1, Qt::Horizontal, "Indicators", this);
vb->addWidget(bg);
indannotate = new QCheckBox( tr("Annotation"), bg );
indannotate->setChecked(config.readBoolEntry( "Annotation indicator", false ));
connect(indannotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
m_isChanged = false;
}
void CIndBarPrefs::saveall()
{
config.setGroup( "Toolbar" );
config.writeEntry( "Annotation indicator", indannotate->isChecked());
}
CIndBarPrefs::~CIndBarPrefs()
{
}
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
@@ -1,263 +1,269 @@
/****************************************************************************
** Form interface generated from reading ui file 'Prefs.ui'
**
** Created: Tue Feb 11 23:53:32 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef CTOOLBARPREFS_H
#define CTOOLBARPREFS_H
#include "useqpe.h"
#include <qvariant.h>
#include <qwidget.h>
#include <qtabdialog.h>
#include <qtabwidget.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlineedit.h>
#ifdef USEQPE
#include <qpe/menubutton.h>
#include <qpe/config.h>
#else
#include "preferences.h"
#endif
//#include "opie.h"
//#ifdef OPIE
#define USECOMBO
//#endif
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
//class QCheckBox;
class QLabel;
//class QSpinBox;
/*
class CBarPrefs1 : public QWidget
{
Q_OBJECT
Config& config;
QCheckBox *open, *close, *info, *twotouch,*find,*scroll,*navigation,*page,*startend,*jump,*pageline;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CBarPrefs1( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CBarPrefs1();
void saveall();
bool isChanged() { return m_isChanged; }
};
*/
class CFileBarPrefs : public QWidget
{
Q_OBJECT
Config& config;
QCheckBox *open, *close, *info, *twotouch, *find, *scroll;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CFileBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CFileBarPrefs();
void saveall();
bool isChanged() { return m_isChanged; }
};
class CNavBarPrefs : public QWidget
{
Q_OBJECT
Config& config;
QCheckBox *scroll, *navback, *navhome, *navforward;
QCheckBox *pageup, *pagedown, *gotostart, *gotoend, *jump, *pageline;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CNavBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CNavBarPrefs();
void saveall();
bool isChanged() { return m_isChanged; }
};
/*
class CBarPrefs2 : public QWidget
{
Q_OBJECT
Config& config;
QCheckBox *fullscreen, *zoom, *setfont, *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *block, *indannotate, *encoding, *ideogram;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CBarPrefs2( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CBarPrefs2();
void saveall();
bool isChanged() { return m_isChanged; }
};
*/
class CViewBarPrefs : public QWidget
{
Q_OBJECT
Config& config;
- QCheckBox *fullscreen, *zoomin, *zoomout, *setfont, *encoding, *ideogram;
+ QCheckBox *fullscreen, *rotate, *zoomin, *zoomout, *setfont, *encoding, *ideogram, *invert;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CViewBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CViewBarPrefs();
void saveall();
bool isChanged() { return m_isChanged; }
};
class CMarkBarPrefs : public QWidget
{
Q_OBJECT
Config& config;
QCheckBox *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *startblock, *copyblock;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CMarkBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CMarkBarPrefs();
void saveall();
bool isChanged() { return m_isChanged; }
};
class CIndBarPrefs : public QWidget
{
Q_OBJECT
Config& config;
QCheckBox *indannotate;
bool m_isChanged;
private slots:
void isChanged(int _v) { m_isChanged = true; }
public:
CIndBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CIndBarPrefs();
void saveall();
bool isChanged() { return m_isChanged; }
};
class CMiscBarPrefs : public QWidget
{
- Q_OBJECT
+
public:
CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~CMiscBarPrefs();
#ifdef USECOMBO
- QComboBox *tbpolicy, *tbposition;
+ QComboBox *tbpolicy, *tbposition, *qtscroll, *localscroll;
#else
- MenuButton *tbpolicy, *tbposition;
+ MenuButton *tbpolicy, *tbposition, *qtscroll, *localscroll;
#endif
QCheckBox *tbmovable, *floating;
};
class CBarPrefs : public QDialog
{
Q_OBJECT
;
CMiscBarPrefs* misc;
CFileBarPrefs* filebar;
CNavBarPrefs* navbar;
CViewBarPrefs* viewbar;
CMarkBarPrefs* markbar;
CIndBarPrefs* indbar;
Config config;
void keyPressEvent(QKeyEvent* e)
{
switch (e->key())
{
case Key_Escape:
e->accept();
reject();
break;
case Key_Space:
case Key_Return:
e->accept();
accept();
break;
default:
QWidget::keyPressEvent(e);
}
}
public:
CBarPrefs(const QString& appdir, bool fs = true, QWidget* parent = 0, const char* name = 0);
~CBarPrefs()
{
if (result())
{
if (navbar->isChanged()) navbar->saveall();
if (filebar->isChanged()) filebar->saveall();
if (viewbar->isChanged()) viewbar->saveall();
if (markbar->isChanged()) markbar->saveall();
if (indbar->isChanged()) indbar->saveall();
}
}
bool isChanged()
{
return
(
filebar->isChanged()
||
navbar->isChanged()
||
viewbar->isChanged()
||
markbar->isChanged()
||
indbar->isChanged()
);
}
bool floating() { return misc->floating->isChecked(); }
void floating(bool v) { misc->floating->setChecked(v); }
int tbpolicy() { return misc->tbpolicy->currentItem(); }
+ int qtscroll() { return misc->qtscroll->currentItem(); }
+ int localscroll() { return misc->localscroll->currentItem(); }
#ifdef USECOMBO
void tbpolicy(int v) { misc->tbpolicy->setCurrentItem(v); }
+ void qtscroll(int v) { misc->qtscroll->setCurrentItem(v); }
+ void localscroll(int v) { misc->localscroll->setCurrentItem(v); }
#else
void tbpolicy(int v) { misc->tbpolicy->select(v); }
+ void qtscroll(int v) { misc->qtscroll->select(v); }
+ void localscroll(int v) { misc->localscroll->select(v); }
#endif
bool tbmovable() { return misc->tbmovable->isChecked(); }
void tbmovable(bool v) { misc->tbmovable->setChecked(v); }
int tbposition() { return misc->tbposition->currentItem(); }
#ifdef USECOMBO
void tbposition(int v) { misc->tbposition->setCurrentItem(v); }
#else
void tbposition(int v) { misc->tbposition->select(v); }
#endif
};
#endif // CPREFS_H
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 @@
#include "URLDialog.h"
#include "qlayout.h"
-#include <qpe/qpeapplication.h>
-
CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
{
setCaption(tr("Save URL"));
QVBoxLayout *tmp = new QVBoxLayout(this);
QVButtonGroup* vb = new QVButtonGroup(fname, this);
tmp->addWidget(vb);
m_clipboard = new QCheckBox(tr("Clipboard"), vb);
m_localfile = new QCheckBox(tr("Local file"), vb);
m_globalfile = new QCheckBox(tr("Global file"), vb);
- if (fs)
- QPEApplication::showDialog( this );
+ if (fs) showMaximized();
}
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 @@
+#############################################################################
+# Makefile for building: libWeasel.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:43:37 2004
+# Project: WeaselCodec.pro
+# Template: lib
+# Command: $(QMAKE) -o WeaselCodec.mak WeaselCodec.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libWeasel.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = ztxt.h
+SOURCES = ztxt.cpp
+OBJECTS = QREADEROBJS/ztxt.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = WeaselCodec.pro
+QMAKE_TARGET = Weasel
+DESTDIR = $(READERDIR)/codecs/
+TARGET = libWeasel.so.1.0.0
+TARGETA = $(READERDIR)/codecs/libWeasel.a
+TARGETD = libWeasel.so.1.0.0
+TARGET0 = libWeasel.so
+TARGET1 = libWeasel.so.1
+TARGET2 = libWeasel.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: WeaselCodec.mak $(READERDIR)/codecs/$(TARGET)
+
+$(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+WeaselCodec.mak: WeaselCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o WeaselCodec.mak WeaselCodec.pro
+qmake:
+ @$(QMAKE) -o WeaselCodec.mak WeaselCodec.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/ztxt.o: ztxt.cpp ztxt.h \
+ my_list.h \
+ Bkmks.h \
+ QREADERINC/static.h \
+ CExpander.h \
+ pdb.h \
+ QREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ Filedata.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ztxt.o ztxt.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libWeasel.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: WeaselCodec.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libWeasel.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = ztxt.h
+SOURCES = ztxt.cpp
+OBJECTS = OREADEROBJS/ztxt.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libWeasel.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libWeasel.a
+TARGETD = libWeasel.so.1.0.0
+TARGET0 = libWeasel.so
+TARGET1 = libWeasel.so.1
+TARGET2 = libWeasel.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: WeaselCodec.omak
+
+WeaselCodec.omak: WeaselCodec.opro
+ tmake WeaselCodec.opro -o WeaselCodec.omak
+
+dist:
+ $(TAR) WeaselCodec.opro.tar WeaselCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) WeaselCodec.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/ztxt.o: ztxt.cpp \
+ ztxt.h \
+ CExpander.h \
+ OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ OREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ztxt.o ztxt.cpp
+
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 @@
+#############################################################################
+# Makefile for building libWeasel.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: WeaselCodec.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libWeasel.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = ztxt.h
+SOURCES = ztxt.cpp
+OBJECTS = WSREADEROBJS/ztxt.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libWeasel.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libWeasel.a
+TARGETD = libWeasel.so.1.0.0
+TARGET0 = libWeasel.so
+TARGET1 = libWeasel.so.1
+TARGET2 = libWeasel.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: WeaselCodec.wmak
+
+WeaselCodec.wmak: WeaselCodec.wpro
+ tmake WeaselCodec.wpro -o WeaselCodec.wmak
+
+dist:
+ $(TAR) WeaselCodec.wpro.tar WeaselCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) WeaselCodec.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/ztxt.o: ztxt.cpp \
+ ztxt.h \
+ CExpander.h \
+ WSREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ WSREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ztxt.o ztxt.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = ztxt.h
+
+SOURCES = ztxt.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = Weasel
+LIBS += -lreader_pdb -lreader_codec
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libWeasel.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: WeaselCodec.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libWeasel.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = ztxt.h
+SOURCES = ztxt.cpp
+OBJECTS = ZREADEROBJS/ztxt.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libWeasel.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libWeasel.a
+TARGETD = libWeasel.so.1.0.0
+TARGET0 = libWeasel.so
+TARGET1 = libWeasel.so.1
+TARGET2 = libWeasel.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libWeasel.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: WeaselCodec.zmak
+
+WeaselCodec.zmak: WeaselCodec.zpro
+ tmake WeaselCodec.zpro -o WeaselCodec.zmak
+
+dist:
+ $(TAR) WeaselCodec.zpro.tar WeaselCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) WeaselCodec.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/ztxt.o: ztxt.cpp \
+ ztxt.h \
+ CExpander.h \
+ ZREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ ZREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ztxt.o ztxt.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = ztxt.h
+
+SOURCES = ztxt.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = Weasel
+LIBS += -lreader_pdb -lreader_codec
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = ztxt.h
+
+SOURCES = ztxt.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/codecs
+TARGET = Weasel
+LIBS += -lreader_pdb -lreader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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
@@ -1,85 +1,116 @@
#ifndef __Text_h
#define __Text_h
#include <stdio.h>
#include <zlib.h>
#include <sys/stat.h>
#include "useqpe.h"
#include "CExpander.h"
class Text: public CExpander {
gzFile file;
unsigned long fsize;
public:
void suspend()
{
#ifdef USEQPE
+ if (!bSuspended)
+ {
bSuspended = true;
suspos = gztell(file);
gzclose(file);
file = NULL;
sustime = time(NULL);
+ }
#endif
}
void unsuspend()
{
#ifdef USEQPE
if (bSuspended)
{
bSuspended = false;
+ if (sustime != ((time_t)-1))
+ {
int delay = time(NULL) - sustime;
if (delay < 10) sleep(10-delay);
+ }
file = gzopen(fname, "rb");
for (int i = 0; file == NULL && i < 5; i++)
{
sleep(5);
file = gzopen(fname, "rb");
}
if (file == NULL)
{
QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file");
exit(0);
}
suspos = gzseek(file, suspos, SEEK_SET);
}
#endif
}
Text() : file(NULL) {};
virtual ~Text()
{
- if (file != NULL) gzclose(file);
+ if (file != NULL)
+ {
+#ifdef USEQPE
+ unsuspend();
+#endif
+ gzclose(file);
+ }
}
int OpenFile(const char *src)
{
if (file != NULL) gzclose(file);
struct stat _stat;
stat(src,&_stat);
fsize = _stat.st_size;
return ((file = gzopen(src,"rb")) == NULL);
}
- int getch() { return gzgetc(file); }
- unsigned int locate() { return gztell(file); }
- void locate(unsigned int n) { gzseek(file,n,SEEK_SET); }
+ int getch()
+ {
+#ifdef USEQPE
+ unsuspend();
+#endif
+ return gzgetc(file);
+ }
+ unsigned int locate()
+ {
+#ifdef USEQPE
+ unsuspend();
+#endif
+ return gztell(file);
+ }
+ void locate(unsigned int n)
+ {
+#ifdef USEQPE
+ unsuspend();
+#endif
+ gzseek(file,n,SEEK_SET);
+ }
bool hasrandomaccess() { return true; }
void sizes(unsigned long& _file, unsigned long& _text)
{
_text = _file = fsize;
FILE* f = fopen(fname, "rb");
if (f != NULL)
{
unsigned char mn[2];
fread(mn, 1, 2, f);
if ((mn[0] == 31) && (mn[1] == 139))
{
int tmp = sizeof(_text);
fseek(f,-tmp,SEEK_END);
fread(&_text, sizeof(_text), 1, f);
}
fclose(f);
}
}
MarkupType PreferredMarkup()
{
return cTEXT;
}
+ QString about() { return QString("Text/gzipped text codec (c) Tim Wentford"); }
};
#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
@@ -1,43 +1,43 @@
#include <qwidget.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qlayout.h>
class CBkmkSelector : public QWidget
{
Q_OBJECT
QListBox* bkmkselector;
QPushButton* exitButton;
signals:
void selected(int i);
void cancelled();
private slots:
void slotSelected(QListBoxItem* t) { emit selected(bkmkselector->index(t)); }
void slotSelected(int t) { emit selected(t); }
void slotCancel() { emit cancelled(); }
public:
CBkmkSelector( QWidget *parent=0, const char *name=0, WFlags f = 0) :
QWidget(parent, name, f)
{
// QFont f("unifont", 16);
// setFont( f );
QVBoxLayout* grid = new QVBoxLayout(this);
bkmkselector = new QListBox(this, "Bookmarks");
exitButton = new QPushButton("Cancel", this);
connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) );
connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) );
- connect(exitButton, SIGNAL( released() ), this, SLOT( slotCancel() ) );
+ connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
grid->addWidget(bkmkselector,1);
grid->addWidget(exitButton);
}
void clear() { bkmkselector->clear(); }
void insertItem(const QString& item) { bkmkselector->insertItem(item); }
QString text(int index) const { return bkmkselector->text(index); }
void setText(const QString& _l) { exitButton->setText(_l); }
};
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 @@
+/* $Id$ */
+/***************************************************************************
+ * chm_lib.c - CHM archive manipulation routines *
+ * ------------------- *
+ * *
+ * author: Jed Wing <jedwin@ugcs.caltech.edu> *
+ * version: 0.3 *
+ * notes: These routines are meant for the manipulation of microsoft *
+ * .chm (compiled html help) files, but may likely be used *
+ * for the manipulation of any ITSS archive, if ever ITSS *
+ * archives are used for any other purpose. *
+ * *
+ * Note also that the section names are statically handled. *
+ * To be entirely correct, the section names should be read *
+ * from the section names meta-file, and then the various *
+ * content sections and the "transforms" to apply to the data *
+ * they contain should be inferred from the section name and *
+ * the meta-files referenced using that name; however, all of *
+ * the files I've been able to get my hands on appear to have *
+ * only two sections: Uncompressed and MSCompressed. *
+ * Additionally, the ITSS.DLL file included with Windows does *
+ * not appear to handle any different transforms than the *
+ * simple LZX-transform. Furthermore, the list of transforms *
+ * to apply is broken, in that only half the required space *
+ * is allocated for the list. (It appears as though the *
+ * space is allocated for ASCII strings, but the strings are *
+ * written as unicode. As a result, only the first half of *
+ * the string appears.) So this is probably not too big of *
+ * a deal, at least until CHM v4 (MS .lit files), which also *
+ * incorporate encryption, of some description. *
+ * *
+ * switches: CHM_MT: compile library with thread-safety *
+ * *
+ * switches (Linux only): *
+ * CHM_USE_PREAD: compile library to use pread instead of *
+ * lseek/read *
+ * CHM_USE_IO64: compile library to support full 64-bit I/O *
+ * as is needed to properly deal with the *
+ * 64-bit file offsets. *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of the *
+ * License, or (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "chm_lib.h"
+
+#ifdef CHM_MT
+#define _REENTRANT
+#endif
+
+#include "lzx.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#if __sun || __sgi
+#include <strings.h>
+#endif
+
+#ifdef WIN32
+#include <windows.h>
+#include <malloc.h>
+#else
+/* basic Linux system includes */
+#define _XOPEN_SOURCE 500
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <malloc.h>
+#endif
+
+/* includes/defines for threading, if using them */
+#ifdef CHM_MT
+#ifdef WIN32
+#define CHM_ACQUIRE_LOCK(a) do { \
+ EnterCriticalSection(&(a)); \
+ } while(0)
+#define CHM_RELEASE_LOCK(a) do { \
+ EnterCriticalSection(&(a)); \
+ } while(0)
+
+#else
+#include <pthread.h>
+
+#define CHM_ACQUIRE_LOCK(a) do { \
+ pthread_mutex_lock(&(a)); \
+ } while(0)
+#define CHM_RELEASE_LOCK(a) do { \
+ pthread_mutex_unlock(&(a)); \
+ } while(0)
+
+#endif
+#else
+#define CHM_ACQUIRE_LOCK(a) /* do nothing */
+#define CHM_RELEASE_LOCK(a) /* do nothing */
+#endif
+
+#ifdef WIN32
+#define CHM_NULL_FD (INVALID_HANDLE_VALUE)
+#define CHM_USE_WIN32IO 1
+#define CHM_CLOSE_FILE(fd) CloseHandle((fd))
+#else
+#define CHM_NULL_FD (-1)
+#define CHM_CLOSE_FILE(fd) close((fd))
+#endif
+
+/*
+ * defines related to tuning
+ */
+#ifndef CHM_MAX_BLOCKS_CACHED
+#define CHM_MAX_BLOCKS_CACHED 5
+#endif
+
+/*
+ * architecture specific defines
+ *
+ * Note: as soon as C99 is more widespread, the below defines should
+ * probably just use the C99 sized-int types.
+ *
+ * The following settings will probably work for many platforms. The sizes
+ * don't have to be exactly correct, but the types must accommodate at least as
+ * many bits as they specify.
+ */
+
+/* i386, 32-bit, Windows */
+#ifdef WIN32
+typedef unsigned char UChar;
+typedef __int16 Int16;
+typedef unsigned __int16 UInt16;
+typedef __int32 Int32;
+typedef unsigned __int32 UInt32;
+typedef __int64 Int64;
+typedef unsigned __int64 UInt64;
+
+/* I386, 32-bit, non-Windows */
+/* Sparc */
+/* MIPS */
+#else
+typedef unsigned char UChar;
+typedef short Int16;
+typedef unsigned short UInt16;
+typedef long Int32;
+typedef unsigned long UInt32;
+typedef long long Int64;
+typedef unsigned long long UInt64;
+#endif
+
+/* GCC */
+#ifdef __GNUC__
+#define memcmp __builtin_memcmp
+#define memcpy __builtin_memcpy
+#define strlen __builtin_strlen
+
+#elif defined(WIN32)
+static int ffs(unsigned int val)
+{
+ int bit=1, idx=1;
+ while (bit != 0 && (val & bit) == 0)
+ {
+ bit <<= 1;
+ ++idx;
+ }
+ if (bit == 0)
+ return 0;
+ else
+ return idx;
+}
+
+#endif
+
+/* utilities for unmarshalling data */
+static int _unmarshal_char_array(unsigned char **pData,
+ unsigned long *pLenRemain,
+ char *dest,
+ int count)
+{
+ if (count <= 0 || (unsigned int)count > *pLenRemain)
+ return 0;
+ memcpy(dest, (*pData), count);
+ *pData += count;
+ *pLenRemain -= count;
+ return 1;
+}
+
+static int _unmarshal_uchar_array(unsigned char **pData,
+ unsigned long *pLenRemain,
+ unsigned char *dest,
+ int count)
+{
+ if (count <= 0 || (unsigned int)count > *pLenRemain)
+ return 0;
+ memcpy(dest, (*pData), count);
+ *pData += count;
+ *pLenRemain -= count;
+ return 1;
+}
+
+static int _unmarshal_int16(unsigned char **pData,
+ unsigned long *pLenRemain,
+ Int16 *dest)
+{
+ if (2 > *pLenRemain)
+ return 0;
+ *dest = (*pData)[0] | (*pData)[1]<<8;
+ *pData += 2;
+ *pLenRemain -= 2;
+ return 1;
+}
+
+static int _unmarshal_uint16(unsigned char **pData,
+ unsigned long *pLenRemain,
+ UInt16 *dest)
+{
+ if (2 > *pLenRemain)
+ return 0;
+ *dest = (*pData)[0] | (*pData)[1]<<8;
+ *pData += 2;
+ *pLenRemain -= 2;
+ return 1;
+}
+
+static int _unmarshal_int32(unsigned char **pData,
+ unsigned long *pLenRemain,
+ Int32 *dest)
+{
+ if (4 > *pLenRemain)
+ return 0;
+ *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24;
+ *pData += 4;
+ *pLenRemain -= 4;
+ return 1;
+}
+
+static int _unmarshal_uint32(unsigned char **pData,
+ unsigned long *pLenRemain,
+ UInt32 *dest)
+{
+ if (4 > *pLenRemain)
+ return 0;
+ *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24;
+ *pData += 4;
+ *pLenRemain -= 4;
+ return 1;
+}
+
+static int _unmarshal_int64(unsigned char **pData,
+ unsigned long *pLenRemain,
+ Int64 *dest)
+{
+ Int64 temp;
+ int i;
+ if (8 > *pLenRemain)
+ return 0;
+ temp=0;
+ for(i=8; i>0; i--)
+ {
+ temp <<= 8;
+ temp |= (*pData)[i-1];
+ }
+ *dest = temp;
+ *pData += 8;
+ *pLenRemain -= 8;
+ return 1;
+}
+
+static int _unmarshal_uint64(unsigned char **pData,
+ unsigned long *pLenRemain,
+ UInt64 *dest)
+{
+ UInt64 temp;
+ int i;
+ if (8 > *pLenRemain)
+ return 0;
+ temp=0;
+ for(i=8; i>0; i--)
+ {
+ temp <<= 8;
+ temp |= (*pData)[i-1];
+ }
+ *dest = temp;
+ *pData += 8;
+ *pLenRemain -= 8;
+ return 1;
+}
+
+static int _unmarshal_uuid(unsigned char **pData,
+ unsigned long *pDataLen,
+ unsigned char *dest)
+{
+ return _unmarshal_uchar_array(pData, pDataLen, dest, 16);
+}
+
+/* names of sections essential to decompression */
+static const char _CHMU_RESET_TABLE[] =
+ "::DataSpace/Storage/MSCompressed/Transform/"
+ "{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/"
+ "InstanceData/ResetTable";
+static const char _CHMU_LZXC_CONTROLDATA[] =
+ "::DataSpace/Storage/MSCompressed/ControlData";
+static const char _CHMU_CONTENT[] =
+ "::DataSpace/Storage/MSCompressed/Content";
+static const char _CHMU_SPANINFO[] =
+ "::DataSpace/Storage/MSCompressed/SpanInfo";
+
+/*
+ * structures local to this module
+ */
+
+/* structure of ITSF headers */
+#define _CHM_ITSF_V2_LEN (0x58)
+#define _CHM_ITSF_V3_LEN (0x60)
+struct chmItsfHeader
+{
+ char signature[4]; /* 0 (ITSF) */
+ Int32 version; /* 4 */
+ Int32 header_len; /* 8 */
+ Int32 unknown_000c; /* c */
+ UInt32 last_modified; /* 10 */
+ UInt32 lang_id; /* 14 */
+ UChar dir_uuid[16]; /* 18 */
+ UChar stream_uuid[16]; /* 28 */
+ UInt64 unknown_offset; /* 38 */
+ UInt64 unknown_len; /* 40 */
+ UInt64 dir_offset; /* 48 */
+ UInt64 dir_len; /* 50 */
+ UInt64 data_offset; /* 58 (Not present before V3) */
+}; /* __attribute__ ((aligned (1))); */
+
+static int _unmarshal_itsf_header(unsigned char **pData,
+ unsigned long *pDataLen,
+ struct chmItsfHeader *dest)
+{
+ /* we only know how to deal with the 0x58 and 0x60 byte structures */
+ if (*pDataLen != _CHM_ITSF_V2_LEN && *pDataLen != _CHM_ITSF_V3_LEN)
+ return 0;
+
+ /* unmarshal common fields */
+ _unmarshal_char_array(pData, pDataLen, dest->signature, 4);
+ _unmarshal_int32 (pData, pDataLen, &dest->version);
+ _unmarshal_int32 (pData, pDataLen, &dest->header_len);
+ _unmarshal_int32 (pData, pDataLen, &dest->unknown_000c);
+ _unmarshal_uint32 (pData, pDataLen, &dest->last_modified);
+ _unmarshal_uint32 (pData, pDataLen, &dest->lang_id);
+ _unmarshal_uuid (pData, pDataLen, dest->dir_uuid);
+ _unmarshal_uuid (pData, pDataLen, dest->stream_uuid);
+ _unmarshal_uint64 (pData, pDataLen, &dest->unknown_offset);
+ _unmarshal_uint64 (pData, pDataLen, &dest->unknown_len);
+ _unmarshal_uint64 (pData, pDataLen, &dest->dir_offset);
+ _unmarshal_uint64 (pData, pDataLen, &dest->dir_len);
+
+ /* error check the data */
+ /* XXX: should also check UUIDs, probably, though with a version 3 file,
+ * current MS tools do not seem to use them.
+ */
+ if (memcmp(dest->signature, "ITSF", 4) != 0)
+ return 0;
+ if (dest->version == 2)
+ {
+ if (dest->header_len < _CHM_ITSF_V2_LEN)
+ return 0;
+ }
+ else if (dest->version == 3)
+ {
+ if (dest->header_len < _CHM_ITSF_V3_LEN)
+ return 0;
+ }
+ else
+ return 0;
+
+ /* now, if we have a V3 structure, unmarshal the rest.
+ * otherwise, compute it
+ */
+ if (dest->version == 3)
+ {
+ if (*pDataLen != 0)
+ _unmarshal_uint64(pData, pDataLen, &dest->data_offset);
+ else
+ return 0;
+ }
+ else
+ dest->data_offset = dest->dir_offset + dest->dir_len;
+
+ return 1;
+}
+
+/* structure of ITSP headers */
+#define _CHM_ITSP_V1_LEN (0x54)
+struct chmItspHeader
+{
+ char signature[4]; /* 0 (ITSP) */
+ Int32 version; /* 4 */
+ Int32 header_len; /* 8 */
+ Int32 unknown_000c; /* c */
+ UInt32 block_len; /* 10 */
+ Int32 blockidx_intvl; /* 14 */
+ Int32 index_depth; /* 18 */
+ Int32 index_root; /* 1c */
+ Int32 index_head; /* 20 */
+ Int32 unknown_0024; /* 24 */
+ UInt32 num_blocks; /* 28 */
+ Int32 unknown_002c; /* 2c */
+ UInt32 lang_id; /* 30 */
+ UChar system_uuid[16]; /* 34 */
+ UChar unknown_0044[16]; /* 44 */
+}; /* __attribute__ ((aligned (1))); */
+
+static int _unmarshal_itsp_header(unsigned char **pData,
+ unsigned long *pDataLen,
+ struct chmItspHeader *dest)
+{
+ /* we only know how to deal with a 0x54 byte structures */
+ if (*pDataLen != _CHM_ITSP_V1_LEN)
+ return 0;
+
+ /* unmarshal fields */
+ _unmarshal_char_array(pData, pDataLen, dest->signature, 4);
+ _unmarshal_int32 (pData, pDataLen, &dest->version);
+ _unmarshal_int32 (pData, pDataLen, &dest->header_len);
+ _unmarshal_int32 (pData, pDataLen, &dest->unknown_000c);
+ _unmarshal_uint32 (pData, pDataLen, &dest->block_len);
+ _unmarshal_int32 (pData, pDataLen, &dest->blockidx_intvl);
+ _unmarshal_int32 (pData, pDataLen, &dest->index_depth);
+ _unmarshal_int32 (pData, pDataLen, &dest->index_root);
+ _unmarshal_int32 (pData, pDataLen, &dest->index_head);
+ _unmarshal_int32 (pData, pDataLen, &dest->unknown_0024);
+ _unmarshal_uint32 (pData, pDataLen, &dest->num_blocks);
+ _unmarshal_int32 (pData, pDataLen, &dest->unknown_002c);
+ _unmarshal_uint32 (pData, pDataLen, &dest->lang_id);
+ _unmarshal_uuid (pData, pDataLen, dest->system_uuid);
+ _unmarshal_uchar_array(pData, pDataLen, dest->unknown_0044, 16);
+
+ /* error check the data */
+ if (memcmp(dest->signature, "ITSP", 4) != 0)
+ return 0;
+ if (dest->version != 1)
+ return 0;
+ if (dest->header_len != _CHM_ITSP_V1_LEN)
+ return 0;
+
+ return 1;
+}
+
+/* structure of PMGL headers */
+static const char _chm_pmgl_marker[4] = "PMGL";
+#define _CHM_PMGL_LEN (0x14)
+struct chmPmglHeader
+{
+ char signature[4]; /* 0 (PMGL) */
+ UInt32 free_space; /* 4 */
+ UInt32 unknown_0008; /* 8 */
+ Int32 block_prev; /* c */
+ Int32 block_next; /* 10 */
+}; /* __attribute__ ((aligned (1))); */
+
+static int _unmarshal_pmgl_header(unsigned char **pData,
+ unsigned long *pDataLen,
+ struct chmPmglHeader *dest)
+{
+ /* we only know how to deal with a 0x14 byte structures */
+ if (*pDataLen != _CHM_PMGL_LEN)
+ return 0;
+
+ /* unmarshal fields */
+ _unmarshal_char_array(pData, pDataLen, dest->signature, 4);
+ _unmarshal_uint32 (pData, pDataLen, &dest->free_space);
+ _unmarshal_uint32 (pData, pDataLen, &dest->unknown_0008);
+ _unmarshal_int32 (pData, pDataLen, &dest->block_prev);
+ _unmarshal_int32 (pData, pDataLen, &dest->block_next);
+
+ /* check structure */
+ if (memcmp(dest->signature, _chm_pmgl_marker, 4) != 0)
+ return 0;
+
+ return 1;
+}
+
+/* structure of PMGI headers */
+static const char _chm_pmgi_marker[4] = "PMGI";
+#define _CHM_PMGI_LEN (0x08)
+struct chmPmgiHeader
+{
+ char signature[4]; /* 0 (PMGI) */
+ UInt32 free_space; /* 4 */
+}; /* __attribute__ ((aligned (1))); */
+
+static int _unmarshal_pmgi_header(unsigned char **pData,
+ unsigned long *pDataLen,
+ struct chmPmgiHeader *dest)
+{
+ /* we only know how to deal with a 0x8 byte structures */
+ if (*pDataLen != _CHM_PMGI_LEN)
+ return 0;
+
+ /* unmarshal fields */
+ _unmarshal_char_array(pData, pDataLen, dest->signature, 4);
+ _unmarshal_uint32 (pData, pDataLen, &dest->free_space);
+
+ /* check structure */
+ if (memcmp(dest->signature, _chm_pmgi_marker, 4) != 0)
+ return 0;
+
+ return 1;
+}
+
+/* structure of LZXC reset table */
+#define _CHM_LZXC_RESETTABLE_V1_LEN (0x28)
+struct chmLzxcResetTable
+{
+ UInt32 version;
+ UInt32 block_count;
+ UInt32 unknown;
+ UInt32 table_offset;
+ UInt64 uncompressed_len;
+ UInt64 compressed_len;
+ UInt64 block_len;
+}; /* __attribute__ ((aligned (1))); */
+
+static int _unmarshal_lzxc_reset_table(unsigned char **pData,
+ unsigned long *pDataLen,
+ struct chmLzxcResetTable *dest)
+{
+ /* we only know how to deal with a 0x28 byte structures */
+ if (*pDataLen != _CHM_LZXC_RESETTABLE_V1_LEN)
+ return 0;
+
+ /* unmarshal fields */
+ _unmarshal_uint32 (pData, pDataLen, &dest->version);
+ _unmarshal_uint32 (pData, pDataLen, &dest->block_count);
+ _unmarshal_uint32 (pData, pDataLen, &dest->unknown);
+ _unmarshal_uint32 (pData, pDataLen, &dest->table_offset);
+ _unmarshal_uint64 (pData, pDataLen, &dest->uncompressed_len);
+ _unmarshal_uint64 (pData, pDataLen, &dest->compressed_len);
+ _unmarshal_uint64 (pData, pDataLen, &dest->block_len);
+
+ /* check structure */
+ if (dest->version != 2)
+ return 0;
+
+ return 1;
+}
+
+/* structure of LZXC control data block */
+#define _CHM_LZXC_MIN_LEN (0x18)
+#define _CHM_LZXC_V2_LEN (0x1c)
+struct chmLzxcControlData
+{
+ UInt32 size; /* 0 */
+ char signature[4]; /* 4 (LZXC) */
+ UInt32 version; /* 8 */
+ UInt32 resetInterval; /* c */
+ UInt32 windowSize; /* 10 */
+ UInt32 unknown_14; /* 14 */
+ UInt32 unknown_18; /* 18 */
+};
+
+static int _unmarshal_lzxc_control_data(unsigned char **pData,
+ unsigned long *pDataLen,
+ struct chmLzxcControlData *dest)
+{
+ /* we want at least 0x18 bytes */
+ if (*pDataLen < _CHM_LZXC_MIN_LEN)
+ return 0;
+
+ /* unmarshal fields */
+ _unmarshal_uint32 (pData, pDataLen, &dest->size);
+ _unmarshal_char_array(pData, pDataLen, dest->signature, 4);
+ _unmarshal_uint32 (pData, pDataLen, &dest->version);
+ _unmarshal_uint32 (pData, pDataLen, &dest->resetInterval);
+ _unmarshal_uint32 (pData, pDataLen, &dest->windowSize);
+ _unmarshal_uint32 (pData, pDataLen, &dest->unknown_14);
+
+ if (*pDataLen >= _CHM_LZXC_V2_LEN)
+ _unmarshal_uint32 (pData, pDataLen, &dest->unknown_18);
+ else
+ dest->unknown_18 = 0;
+
+ if (dest->version == 2)
+ {
+ dest->resetInterval *= 0x8000;
+ dest->windowSize *= 0x8000;
+ dest->unknown_14 *= 0x8000;
+ }
+ if (dest->windowSize == 0 || dest->resetInterval == 0)
+ return 0;
+
+ /* for now, only support resetInterval a multiple of windowSize/2 */
+ if (dest->windowSize == 1)
+ return 0;
+ if ((dest->resetInterval % (dest->windowSize/2)) != 0)
+ return 0;
+
+ /* check structure */
+ if (memcmp(dest->signature, "LZXC", 4) != 0)
+ return 0;
+
+ return 1;
+}
+
+/* the structure used for chm file handles */
+struct chmFile
+{
+#ifdef WIN32
+ HANDLE fd;
+#else
+ int fd;
+#endif
+
+#ifdef CHM_MT
+#ifdef WIN32
+ CRITICAL_SECTION mutex;
+ CRITICAL_SECTION lzx_mutex;
+ CRITICAL_SECTION cache_mutex;
+#else
+ pthread_mutex_t mutex;
+ pthread_mutex_t lzx_mutex;
+ pthread_mutex_t cache_mutex;
+#endif
+#endif
+
+ UInt64 dir_offset;
+ UInt64 dir_len;
+ UInt64 data_offset;
+ Int32 index_root;
+ Int32 index_head;
+ UInt32 block_len;
+
+ UInt64 span;
+ struct chmUnitInfo rt_unit;
+ struct chmUnitInfo cn_unit;
+ struct chmLzxcResetTable reset_table;
+
+ /* LZX control data */
+ UInt32 window_size;
+ UInt32 reset_interval;
+ UInt32 reset_blkcount;
+
+ /* decompressor state */
+ struct LZXstate *lzx_state;
+ int lzx_last_block;
+
+ /* cache for decompressed blocks */
+ UChar **cache_blocks;
+ Int64 *cache_block_indices;
+ Int32 cache_num_blocks;
+};
+
+/*
+ * utility functions local to this module
+ */
+
+/* utility function to handle differences between {pread,read}(64)? */
+static Int64 _chm_fetch_bytes(struct chmFile *h,
+ UChar *buf,
+ UInt64 os,
+ Int64 len)
+{
+ Int64 readLen=0, oldOs=0;
+ if (h->fd == CHM_NULL_FD)
+ return readLen;
+
+ CHM_ACQUIRE_LOCK(h->mutex);
+#ifdef CHM_USE_WIN32IO
+ /* NOTE: this might be better done with CreateFileMapping, et cetera... */
+ {
+ DWORD origOffsetLo=0, origOffsetHi=0;
+ DWORD offsetLo, offsetHi;
+ DWORD actualLen=0;
+
+ /* awkward Win32 Seek/Tell */
+ offsetLo = (unsigned long)(os & 0xffffffffL);
+ offsetHi = (unsigned long)((os >> 32) & 0xffffffffL);
+ origOffsetLo = SetFilePointer(h->fd, 0, &origOffsetHi, FILE_CURRENT);
+ offsetLo = SetFilePointer(h->fd, offsetLo, &offsetHi, FILE_BEGIN);
+
+ /* read the data */
+ if (ReadFile(h->fd,
+ buf,
+ (DWORD)len,
+ &actualLen,
+ NULL) == TRUE)
+ readLen = actualLen;
+ else
+ readLen = 0;
+
+ /* restore original position */
+ SetFilePointer(h->fd, origOffsetLo, &origOffsetHi, FILE_BEGIN);
+ }
+#else
+#ifdef CHM_USE_PREAD
+#ifdef CHM_USE_IO64
+ readLen = pread64(h->fd, buf, (long)len, os);
+#else
+ readLen = pread(h->fd, buf, (long)len, (unsigned long)os);
+#endif
+#else
+#ifdef CHM_USE_IO64
+ oldOs = lseek64(h->fd, 0, SEEK_CUR);
+ lseek64(h->fd, os, SEEK_SET);
+ readLen = read(h->fd, buf, len);
+ lseek64(h->fd, oldOs, SEEK_SET);
+#else
+ oldOs = lseek(h->fd, 0, SEEK_CUR);
+ lseek(h->fd, (long)os, SEEK_SET);
+ readLen = read(h->fd, buf, len);
+ lseek(h->fd, (long)oldOs, SEEK_SET);
+#endif
+#endif
+#endif
+ CHM_RELEASE_LOCK(h->mutex);
+ return readLen;
+}
+
+/* open an ITS archive */
+struct chmFile *chm_open(const char *filename)
+{
+ unsigned char sbuffer[256];
+ unsigned long sremain;
+ unsigned char *sbufpos;
+ struct chmFile *newHandle=NULL;
+ struct chmItsfHeader itsfHeader;
+ struct chmItspHeader itspHeader;
+ struct chmUnitInfo uiSpan;
+ struct chmUnitInfo uiLzxc;
+ struct chmLzxcControlData ctlData;
+
+ /* allocate handle */
+ newHandle = (struct chmFile *)malloc(sizeof(struct chmFile));
+ newHandle->fd = CHM_NULL_FD;
+ newHandle->lzx_state = NULL;
+ newHandle->cache_blocks = NULL;
+ newHandle->cache_block_indices = NULL;
+ newHandle->cache_num_blocks = 0;
+
+ /* open file */
+#ifdef WIN32
+ if ((newHandle->fd=CreateFileA(filename,
+ GENERIC_READ,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL)) == CHM_NULL_FD)
+ {
+ free(newHandle);
+ return NULL;
+ }
+#else
+ if ((newHandle->fd=open(filename, O_RDONLY)) == CHM_NULL_FD)
+ {
+ free(newHandle);
+ return NULL;
+ }
+#endif
+
+ /* initialize mutexes, if needed */
+#ifdef CHM_MT
+#ifdef WIN32
+ InitializeCriticalSection(&newHandle->mutex);
+ InitializeCriticalSection(&newHandle->lzx_mutex);
+ InitializeCriticalSection(&newHandle->cache_mutex);
+#else
+ pthread_mutex_init(&newHandle->mutex, NULL);
+ pthread_mutex_init(&newHandle->lzx_mutex, NULL);
+ pthread_mutex_init(&newHandle->cache_mutex, NULL);
+#endif
+#endif
+
+ /* read and verify header */
+ sremain = _CHM_ITSF_V3_LEN;
+ sbufpos = sbuffer;
+ if (_chm_fetch_bytes(newHandle, sbuffer, (UInt64)0, sremain) != sremain ||
+ !_unmarshal_itsf_header(&sbufpos, &sremain, &itsfHeader))
+ {
+ chm_close(newHandle);
+ return NULL;
+ }
+
+ /* stash important values from header */
+ newHandle->dir_offset = itsfHeader.dir_offset;
+ newHandle->dir_len = itsfHeader.dir_len;
+ newHandle->data_offset = itsfHeader.data_offset;
+
+ /* now, read and verify the directory header chunk */
+ sremain = _CHM_ITSP_V1_LEN;
+ sbufpos = sbuffer;
+ if (_chm_fetch_bytes(newHandle, sbuffer,
+ (UInt64)itsfHeader.dir_offset, sremain) != sremain ||
+ !_unmarshal_itsp_header(&sbufpos, &sremain, &itspHeader))
+ {
+ chm_close(newHandle);
+ return NULL;
+ }
+
+ /* grab essential information from ITSP header */
+ newHandle->dir_offset += itspHeader.header_len;
+ newHandle->dir_len -= itspHeader.header_len;
+ newHandle->index_root = itspHeader.index_root;
+ newHandle->index_head = itspHeader.index_head;
+ newHandle->block_len = itspHeader.block_len;
+
+ /* if the index root is -1, this means we don't have any PMGI blocks.
+ * as a result, we must use the sole PMGL block as the index root
+ */
+ if (newHandle->index_root == -1)
+ newHandle->index_root = newHandle->index_head;
+
+ /* prefetch most commonly needed unit infos */
+ if (CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle,
+ _CHMU_SPANINFO,
+ &uiSpan) ||
+ uiSpan.space == CHM_COMPRESSED ||
+ CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle,
+ _CHMU_RESET_TABLE,
+ &newHandle->rt_unit) ||
+ newHandle->rt_unit.space == CHM_COMPRESSED ||
+ CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle,
+ _CHMU_CONTENT,
+ &newHandle->cn_unit) ||
+ newHandle->cn_unit.space == CHM_COMPRESSED ||
+ CHM_RESOLVE_SUCCESS != chm_resolve_object(newHandle,
+ _CHMU_LZXC_CONTROLDATA,
+ &uiLzxc) ||
+ uiLzxc.space == CHM_COMPRESSED)
+ {
+ chm_close(newHandle);
+ return NULL;
+ }
+
+ /* try to read span */
+ /* N.B.: we've already checked that uiSpan is in the uncompressed section,
+ * so this should not require attempting to decompress, which may
+ * rely on having a valid "span"
+ */
+ sremain = 8;
+ sbufpos = sbuffer;
+ if (chm_retrieve_object(newHandle, &uiSpan, sbuffer,
+ 0, sremain) != sremain ||
+ !_unmarshal_uint64(&sbufpos, &sremain, &newHandle->span))
+ {
+ chm_close(newHandle);
+ return NULL;
+ }
+
+ /* read reset table info */
+ sremain = _CHM_LZXC_RESETTABLE_V1_LEN;
+ sbufpos = sbuffer;
+ if (chm_retrieve_object(newHandle, &newHandle->rt_unit, sbuffer,
+ 0, sremain) != sremain ||
+ !_unmarshal_lzxc_reset_table(&sbufpos, &sremain,
+ &newHandle->reset_table))
+ {
+ chm_close(newHandle);
+ return NULL;
+ }
+
+ /* read control data */
+ sremain = (unsigned long)uiLzxc.length;
+ sbufpos = sbuffer;
+ if (chm_retrieve_object(newHandle, &uiLzxc, sbuffer,
+ 0, sremain) != sremain ||
+ !_unmarshal_lzxc_control_data(&sbufpos, &sremain,
+ &ctlData))
+ {
+ chm_close(newHandle);
+ return NULL;
+ }
+ newHandle->window_size = ctlData.windowSize;
+ newHandle->reset_interval = ctlData.resetInterval;
+ newHandle->reset_blkcount = newHandle->reset_interval /
+ (newHandle->window_size / 2);
+
+ /* initialize cache */
+ chm_set_param(newHandle, CHM_PARAM_MAX_BLOCKS_CACHED,
+ CHM_MAX_BLOCKS_CACHED);
+
+ return newHandle;
+}
+
+/* close an ITS archive */
+void chm_close(struct chmFile *h)
+{
+ if (h != NULL)
+ {
+ if (h->fd != CHM_NULL_FD)
+ CHM_CLOSE_FILE(h->fd);
+ h->fd = CHM_NULL_FD;
+
+#ifdef CHM_MT
+#ifdef WIN32
+ DeleteCriticalSection(&h->mutex);
+ DeleteCriticalSection(&h->lzx_mutex);
+ DeleteCriticalSection(&h->cache_mutex);
+#else
+ pthread_mutex_destroy(&h->mutex);
+ pthread_mutex_destroy(&h->lzx_mutex);
+ pthread_mutex_destroy(&h->cache_mutex);
+#endif
+#endif
+
+ if (h->lzx_state)
+ LZXteardown(h->lzx_state);
+ h->lzx_state = NULL;
+
+ if (h->cache_blocks)
+ {
+ int i;
+ for (i=0; i<h->cache_num_blocks; i++)
+ {
+ if (h->cache_blocks[i])
+ free(h->cache_blocks[i]);
+ }
+ free(h->cache_blocks);
+ h->cache_blocks = NULL;
+ }
+
+ if (h->cache_block_indices)
+ free(h->cache_block_indices);
+ h->cache_block_indices = NULL;
+
+ free(h);
+ }
+}
+
+/*
+ * set a parameter on the file handle.
+ * valid parameter types:
+ * CHM_PARAM_MAX_BLOCKS_CACHED:
+ * how many decompressed blocks should be cached? A simple
+ * caching scheme is used, wherein the index of the block is
+ * used as a hash value, and hash collision results in the
+ * invalidation of the previously cached block.
+ */
+void chm_set_param(struct chmFile *h,
+ int paramType,
+ int paramVal)
+{
+ switch (paramType)
+ {
+ case CHM_PARAM_MAX_BLOCKS_CACHED:
+ CHM_ACQUIRE_LOCK(h->cache_mutex);
+ if (paramVal != h->cache_num_blocks)
+ {
+ UChar **newBlocks;
+ UInt64 *newIndices;
+ int i;
+
+ /* allocate new cached blocks */
+ newBlocks = (UChar **)malloc(paramVal * sizeof (UChar *));
+ newIndices = (UInt64 *)malloc(paramVal * sizeof (UInt64));
+ for (i=0; i<paramVal; i++)
+ {
+ newBlocks[i] = NULL;
+ newIndices[i] = 0;
+ }
+
+ /* re-distribute old cached blocks */
+ if (h->cache_blocks)
+ {
+ for (i=0; i<h->cache_num_blocks; i++)
+ {
+ int newSlot = (int)(h->cache_block_indices[i] % paramVal);
+
+ if (h->cache_blocks[i])
+ {
+ /* in case of collision, destroy newcomer */
+ if (newBlocks[newSlot])
+ {
+ free(h->cache_blocks[i]);
+ h->cache_blocks[i] = NULL;
+ }
+ else
+ {
+ newBlocks[newSlot] = h->cache_blocks[i];
+ newIndices[newSlot] =
+ h->cache_block_indices[i];
+ }
+ }
+ }
+
+ free(h->cache_blocks);
+ free(h->cache_block_indices);
+ }
+
+ /* now, set new values */
+ h->cache_blocks = newBlocks;
+ h->cache_block_indices = newIndices;
+ h->cache_num_blocks = paramVal;
+ }
+ CHM_RELEASE_LOCK(h->cache_mutex);
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*
+ * helper methods for chm_resolve_object
+ */
+
+/* skip a compressed dword */
+static void _chm_skip_cword(UChar **pEntry)
+{
+ while (*(*pEntry)++ >= 0x80)
+ ;
+}
+
+/* skip the data from a PMGL entry */
+static void _chm_skip_PMGL_entry_data(UChar **pEntry)
+{
+ _chm_skip_cword(pEntry);
+ _chm_skip_cword(pEntry);
+ _chm_skip_cword(pEntry);
+}
+
+/* parse a compressed dword */
+static UInt64 _chm_parse_cword(UChar **pEntry)
+{
+ UInt64 accum = 0;
+ UChar temp;
+ while ((temp=*(*pEntry)++) >= 0x80)
+ {
+ accum <<= 7;
+ accum += temp & 0x7f;
+ }
+
+ return (accum << 7) + temp;
+}
+
+/* parse a utf-8 string into an ASCII char buffer */
+static int _chm_parse_UTF8(UChar **pEntry, UInt64 count, char *path)
+{
+ /* XXX: implement UTF-8 support, including a real mapping onto
+ * ISO-8859-1? probably there is a library to do this? As is
+ * immediately apparent from the below code, I'm only handling files
+ * in which none of the strings contain UTF-8 multi-byte characters.
+ */
+ while (count != 0)
+ {
+ if (*(*pEntry) > 0x7f)
+ return 0;
+
+ *path++ = (char)(*(*pEntry)++);
+ --count;
+ }
+
+ *path = '\0';
+ return 1;
+}
+
+/* parse a PMGL entry into a chmUnitInfo struct; return 1 on success. */
+static int _chm_parse_PMGL_entry(UChar **pEntry, struct chmUnitInfo *ui)
+{
+ UInt64 strLen;
+
+ /* parse str len */
+ strLen = _chm_parse_cword(pEntry);
+ if (strLen > CHM_MAX_PATHLEN)
+ return 0;
+
+ /* parse path */
+ if (! _chm_parse_UTF8(pEntry, strLen, ui->path))
+ return 0;
+
+ /* parse info */
+ ui->space = (int)_chm_parse_cword(pEntry);
+ ui->start = _chm_parse_cword(pEntry);
+ ui->length = _chm_parse_cword(pEntry);
+ return 1;
+}
+
+/* find an exact entry in PMGL; return NULL if we fail */
+static UChar *_chm_find_in_PMGL(UChar *page_buf,
+ UInt32 block_len,
+ const char *objPath)
+{
+ /* XXX: modify this to do a binary search using the nice index structure
+ * that is provided for us.
+ */
+ struct chmPmglHeader header;
+ UInt32 hremain;
+ UChar *end;
+ UChar *cur;
+ UChar *temp;
+ UInt64 strLen;
+ char buffer[CHM_MAX_PATHLEN+1];
+
+ /* figure out where to start and end */
+ cur = page_buf;
+ hremain = _CHM_PMGL_LEN;
+ if (! _unmarshal_pmgl_header(&cur, &hremain, &header))
+ return NULL;
+ end = page_buf + block_len - (header.free_space);
+
+ /* now, scan progressively */
+ while (cur < end)
+ {
+ /* grab the name */
+ temp = cur;
+ strLen = _chm_parse_cword(&cur);
+ if (! _chm_parse_UTF8(&cur, strLen, buffer))
+ return NULL;
+
+ /* check if it is the right name */
+#ifdef WIN32
+ if (! stricmp(buffer, objPath))
+ return temp;
+#else
+ if (! strcasecmp(buffer, objPath))
+ return temp;
+#endif
+
+ _chm_skip_PMGL_entry_data(&cur);
+ }
+
+ return NULL;
+}
+
+/* find which block should be searched next for the entry; -1 if no block */
+static Int32 _chm_find_in_PMGI(UChar *page_buf,
+ UInt32 block_len,
+ const char *objPath)
+{
+ /* XXX: modify this to do a binary search using the nice index structure
+ * that is provided for us
+ */
+ struct chmPmgiHeader header;
+ UInt32 hremain;
+ int page=-1;
+ UChar *end;
+ UChar *cur;
+ UInt64 strLen;
+ char buffer[CHM_MAX_PATHLEN+1];
+
+ /* figure out where to start and end */
+ cur = page_buf;
+ hremain = _CHM_PMGI_LEN;
+ if (! _unmarshal_pmgi_header(&cur, &hremain, &header))
+ return -1;
+ end = page_buf + block_len - (header.free_space);
+
+ /* now, scan progressively */
+ while (cur < end)
+ {
+ /* grab the name */
+ strLen = _chm_parse_cword(&cur);
+ if (! _chm_parse_UTF8(&cur, strLen, buffer))
+ return -1;
+
+ /* check if it is the right name */
+#ifdef WIN32
+ if (stricmp(buffer, objPath) > 0)
+ return page;
+#else
+ if (strcasecmp(buffer, objPath) > 0)
+ return page;
+#endif
+
+ /* load next value for path */
+ page = (int)_chm_parse_cword(&cur);
+ }
+
+ return page;
+}
+
+/* resolve a particular object from the archive */
+int chm_resolve_object(struct chmFile *h,
+ const char *objPath,
+ struct chmUnitInfo *ui)
+{
+ /*
+ * XXX: implement caching scheme for dir pages
+ */
+
+ Int32 curPage;
+
+ /* buffer to hold whatever page we're looking at */
+#ifdef WIN32
+ UChar *page_buf = alloca(h->block_len);
+#else
+ UChar page_buf[h->block_len];
+#endif
+
+ /* starting page */
+ curPage = h->index_root;
+
+ /* until we have either returned or given up */
+ while (curPage != -1)
+ {
+
+ /* try to fetch the index page */
+ if (_chm_fetch_bytes(h, page_buf,
+ (UInt64)h->dir_offset + (UInt64)curPage*h->block_len,
+ h->block_len) != h->block_len)
+ return CHM_RESOLVE_FAILURE;
+
+ /* now, if it is a leaf node: */
+ if (memcmp(page_buf, _chm_pmgl_marker, 4) == 0)
+ {
+ /* scan block */
+ UChar *pEntry = _chm_find_in_PMGL(page_buf,
+ h->block_len,
+ objPath);
+ if (pEntry == NULL)
+ return CHM_RESOLVE_FAILURE;
+
+ /* parse entry and return */
+ _chm_parse_PMGL_entry(&pEntry, ui);
+ return CHM_RESOLVE_SUCCESS;
+ }
+
+ /* else, if it is a branch node: */
+ else if (memcmp(page_buf, _chm_pmgi_marker, 4) == 0)
+ curPage = _chm_find_in_PMGI(page_buf, h->block_len, objPath);
+
+ /* else, we are confused. give up. */
+ else
+ return CHM_RESOLVE_FAILURE;
+ }
+
+ /* didn't find anything. fail. */
+ return CHM_RESOLVE_FAILURE;
+}
+
+/*
+ * utility methods for dealing with compressed data
+ */
+
+/* get the bounds of a compressed block. return 0 on failure */
+static int _chm_get_cmpblock_bounds(struct chmFile *h,
+ UInt64 block,
+ UInt64 *start,
+ Int64 *len)
+{
+ UChar buffer[8], *dummy;
+ UInt32 remain;
+
+ /* for all but the last block, use the reset table */
+ if (block < h->reset_table.block_count-1)
+ {
+ /* unpack the start address */
+ dummy = buffer;
+ remain = 8;
+ if (_chm_fetch_bytes(h, buffer,
+ (UInt64)h->data_offset
+ + (UInt64)h->rt_unit.start
+ + (UInt64)h->reset_table.table_offset
+ + (UInt64)block*8,
+ remain) != remain ||
+ !_unmarshal_uint64(&dummy, &remain, start))
+ return 0;
+
+ /* unpack the end address */
+ dummy = buffer;
+ remain = 8;
+ if (_chm_fetch_bytes(h, buffer,
+ (UInt64)h->data_offset
+ + (UInt64)h->rt_unit.start
+ + (UInt64)h->reset_table.table_offset
+ + (UInt64)block*8 + 8,
+ remain) != remain ||
+ !_unmarshal_int64(&dummy, &remain, len))
+ return 0;
+ }
+
+ /* for the last block, use the span in addition to the reset table */
+ else
+ {
+ /* unpack the start address */
+ dummy = buffer;
+ remain = 8;
+ if (_chm_fetch_bytes(h, buffer,
+ (UInt64)h->data_offset
+ + (UInt64)h->rt_unit.start
+ + (UInt64)h->reset_table.table_offset
+ + (UInt64)block*8,
+ remain) != remain ||
+ !_unmarshal_uint64(&dummy, &remain, start))
+ return 0;
+
+ *len = h->reset_table.compressed_len;
+ }
+
+ /* compute the length and absolute start address */
+ *len -= *start;
+ *start += h->data_offset + h->cn_unit.start;
+
+ return 1;
+}
+
+/* decompress the block. must have lzx_mutex. */
+static Int64 _chm_decompress_block(struct chmFile *h,
+ UInt64 block,
+ UChar **ubuffer)
+{
+#ifdef WIN32
+ UChar *cbuffer = alloca(((unsigned int)h->reset_table.block_len + 6144));
+#else
+ UChar cbuffer[h->reset_table.block_len + 6144]; /* compressed buffer */
+#endif
+ UInt64 cmpStart; /* compressed start */
+ Int64 cmpLen; /* compressed len */
+ int indexSlot; /* cache index slot */
+ UChar *lbuffer; /* local buffer ptr */
+ UInt32 blockAlign = (UInt32)(block % h->reset_blkcount); /* reset intvl. aln. */
+ UInt32 i; /* local loop index */
+
+ /* check if we need previous blocks */
+ if (blockAlign != 0)
+ {
+ /* fetch all required previous blocks since last reset */
+ for (i = h->reset_blkcount - blockAlign; i > 0; i--)
+ {
+
+ /* check if we most recently decompressed the previous block */
+ if (h->lzx_last_block != block-i)
+ {
+ indexSlot = (int)((block-i) % h->cache_num_blocks);
+ h->cache_block_indices[indexSlot] = block-i;
+ if (! h->cache_blocks[indexSlot])
+ h->cache_blocks[indexSlot] = (UChar *)malloc(
+ (unsigned int)(h->reset_table.block_len));
+ lbuffer = h->cache_blocks[indexSlot];
+
+ /* decompress the previous block */
+ LZXreset(h->lzx_state);
+ if (!_chm_get_cmpblock_bounds(h, block-i, &cmpStart, &cmpLen) ||
+ _chm_fetch_bytes(h, cbuffer, cmpStart, cmpLen) != cmpLen ||
+ LZXdecompress(h->lzx_state, cbuffer, lbuffer, (int)cmpLen,
+ (int)h->reset_table.block_len) != DECR_OK)
+ return (Int64)0;
+ }
+
+ h->lzx_last_block = (int)(block - i);
+ }
+ }
+ else
+ LZXreset(h->lzx_state);
+
+ /* allocate slot in cache */
+ indexSlot = (int)(block % h->cache_num_blocks);
+ h->cache_block_indices[indexSlot] = block;
+ if (! h->cache_blocks[indexSlot])
+ h->cache_blocks[indexSlot] = (UChar *)malloc(
+ ((unsigned int)h->reset_table.block_len));
+ lbuffer = h->cache_blocks[indexSlot];
+ *ubuffer = lbuffer;
+
+ /* decompress the block we actually want */
+ if (! _chm_get_cmpblock_bounds(h, block, &cmpStart, &cmpLen) ||
+ _chm_fetch_bytes(h, cbuffer, cmpStart, cmpLen) != cmpLen ||
+ LZXdecompress(h->lzx_state, cbuffer, lbuffer, (int)cmpLen,
+ (int)h->reset_table.block_len) != DECR_OK)
+ return (Int64)0;
+ h->lzx_last_block = (int)block;
+
+ /* XXX: modify LZX routines to return the length of the data they
+ * decompressed and return that instead, for an extra sanity check.
+ */
+ return h->reset_table.block_len;
+}
+
+/* grab a region from a compressed block */
+static Int64 _chm_decompress_region(struct chmFile *h,
+ UChar *buf,
+ UInt64 start,
+ Int64 len)
+{
+ UInt64 nBlock, nOffset;
+ UInt64 nLen;
+ UInt64 gotLen;
+ UChar *ubuffer;
+
+ if (len <= 0)
+ return (Int64)0;
+
+ /* figure out what we need to read */
+ nBlock = start / h->reset_table.block_len;
+ nOffset = start % h->reset_table.block_len;
+ nLen = len;
+ if (nLen > (h->reset_table.block_len - nOffset))
+ nLen = h->reset_table.block_len - nOffset;
+
+ /* if block is cached, return data from it. */
+ CHM_ACQUIRE_LOCK(h->lzx_mutex);
+ CHM_ACQUIRE_LOCK(h->cache_mutex);
+ if (h->cache_block_indices[nBlock % h->cache_num_blocks] == nBlock &&
+ h->cache_blocks[nBlock % h->cache_num_blocks] != NULL)
+ {
+ memcpy(buf,
+ h->cache_blocks[nBlock % h->cache_num_blocks] + nOffset,
+ (unsigned int)nLen);
+ CHM_RELEASE_LOCK(h->cache_mutex);
+ CHM_RELEASE_LOCK(h->lzx_mutex);
+ return nLen;
+ }
+ CHM_RELEASE_LOCK(h->cache_mutex);
+
+ /* data request not satisfied, so... start up the decompressor machine */
+ if (! h->lzx_state)
+ {
+ int window_size = ffs(h->window_size) - 1;
+ h->lzx_last_block = -1;
+ h->lzx_state = LZXinit(window_size);
+ }
+
+ /* decompress some data */
+ gotLen = _chm_decompress_block(h, nBlock, &ubuffer);
+ if (gotLen < nLen)
+ nLen = gotLen;
+ memcpy(buf, ubuffer+nOffset, (unsigned int)nLen);
+ CHM_RELEASE_LOCK(h->lzx_mutex);
+ return nLen;
+}
+
+/* retrieve (part of) an object */
+LONGINT64 chm_retrieve_object(struct chmFile *h,
+ struct chmUnitInfo *ui,
+ unsigned char *buf,
+ LONGUINT64 addr,
+ LONGINT64 len)
+{
+ /* must be valid file handle */
+ if (h == NULL)
+ return (Int64)0;
+
+ /* starting address must be in correct range */
+ if (addr < 0 || addr >= ui->length)
+ return (Int64)0;
+
+ /* clip length */
+ if (addr + len > ui->length)
+ len = ui->length - addr;
+
+ /* if the file is uncompressed, it's simple */
+ if (ui->space == CHM_UNCOMPRESSED)
+ {
+ /* read data */
+ return _chm_fetch_bytes(h,
+ buf,
+ (UInt64)h->data_offset + (UInt64)ui->start + (UInt64)addr,
+ len);
+ }
+
+ /* else if the file is compressed, it's a little trickier */
+ else /* ui->space == CHM_COMPRESSED */
+ {
+ Int64 swath=0, total=0;
+ do {
+
+ /* swill another mouthful */
+ swath = _chm_decompress_region(h, buf, ui->start + addr, len);
+
+ /* if we didn't get any... */
+ if (swath == 0)
+ return total;
+
+ /* update stats */
+ total += swath;
+ len -= swath;
+ addr += swath;
+ buf += swath;
+
+ } while (len != 0);
+
+ return total;
+ }
+}
+
+/* enumerate the objects in the .chm archive */
+int chm_enumerate(struct chmFile *h,
+ int what,
+ CHM_ENUMERATOR e,
+ void *context)
+{
+ Int32 curPage;
+
+ /* buffer to hold whatever page we're looking at */
+#ifdef WIN32
+ UChar *page_buf = alloca((unsigned int)h->block_len);
+#else
+ UChar page_buf[h->block_len];
+#endif
+ struct chmPmglHeader header;
+ UChar *end;
+ UChar *cur;
+ unsigned long lenRemain;
+
+ /* the current ui */
+ struct chmUnitInfo ui;
+ int flag;
+
+ /* starting page */
+ curPage = h->index_head;
+
+ /* until we have either returned or given up */
+ while (curPage != -1)
+ {
+
+ /* try to fetch the index page */
+ if (_chm_fetch_bytes(h,
+ page_buf,
+ (UInt64)h->dir_offset + (UInt64)curPage*h->block_len,
+ h->block_len) != h->block_len)
+ return 0;
+
+ /* figure out start and end for this page */
+ cur = page_buf;
+ lenRemain = _CHM_PMGL_LEN;
+ if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header))
+ return 0;
+ end = page_buf + h->block_len - (header.free_space);
+
+ /* loop over this page */
+ while (cur < end)
+ {
+ if (! _chm_parse_PMGL_entry(&cur, &ui))
+ return 0;
+
+ /* check for DIRS */
+ if (ui.length == 0 && !(what & CHM_ENUMERATE_DIRS))
+ continue;
+
+ /* check for FILES */
+ if (ui.length != 0 && !(what & CHM_ENUMERATE_FILES))
+ continue;
+
+ /* check for NORMAL vs. META */
+ if (ui.path[0] == '/')
+ {
+
+ /* check for NORMAL vs. SPECIAL */
+ if (ui.path[1] == '#' || ui.path[1] == '$')
+ flag = CHM_ENUMERATE_SPECIAL;
+ else
+ flag = CHM_ENUMERATE_NORMAL;
+ }
+ else
+ flag = CHM_ENUMERATE_META;
+ if (! (what & flag))
+ continue;
+
+ /* call the enumerator */
+ {
+ int status = (*e)(h, &ui, context);
+ switch (status)
+ {
+ case CHM_ENUMERATOR_FAILURE: return 0;
+ case CHM_ENUMERATOR_CONTINUE: break;
+ case CHM_ENUMERATOR_SUCCESS: return 1;
+ default: break;
+ }
+ }
+ }
+
+ /* advance to next page */
+ curPage = header.block_next;
+ }
+
+ return 1;
+}
+
+int chm_enumerate_dir(struct chmFile *h,
+ const char *prefix,
+ int what,
+ CHM_ENUMERATOR e,
+ void *context)
+{
+ /*
+ * XXX: do this efficiently (i.e. using the tree index)
+ */
+
+ Int32 curPage;
+
+ /* buffer to hold whatever page we're looking at */
+#ifdef WIN32
+ UChar *page_buf = alloca((unsigned int)h->block_len);
+#else
+ UChar page_buf[h->block_len];
+#endif
+ struct chmPmglHeader header;
+ UChar *end;
+ UChar *cur;
+ unsigned long lenRemain;
+
+ /* set to 1 once we've started */
+ int it_has_begun=0;
+
+ /* the current ui */
+ struct chmUnitInfo ui;
+ int flag;
+
+ /* the length of the prefix */
+ char prefixRectified[CHM_MAX_PATHLEN+1];
+ int prefixLen;
+ char lastPath[CHM_MAX_PATHLEN];
+ int lastPathLen;
+
+ /* starting page */
+ curPage = h->index_head;
+
+ /* initialize pathname state */
+ strncpy(prefixRectified, prefix, CHM_MAX_PATHLEN);
+ prefixLen = strlen(prefixRectified);
+ if (prefixLen != 0)
+ {
+ if (prefixRectified[prefixLen-1] != '/')
+ {
+ prefixRectified[prefixLen] = '/';
+ prefixRectified[prefixLen+1] = '\0';
+ ++prefixLen;
+ }
+ }
+ lastPath[0] = '\0';
+ lastPathLen = -1;
+
+ /* until we have either returned or given up */
+ while (curPage != -1)
+ {
+
+ /* try to fetch the index page */
+ if (_chm_fetch_bytes(h,
+ page_buf,
+ (UInt64)h->dir_offset + (UInt64)curPage*h->block_len,
+ h->block_len) != h->block_len)
+ return 0;
+
+ /* figure out start and end for this page */
+ cur = page_buf;
+ lenRemain = _CHM_PMGL_LEN;
+ if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header))
+ return 0;
+ end = page_buf + h->block_len - (header.free_space);
+
+ /* loop over this page */
+ while (cur < end)
+ {
+ if (! _chm_parse_PMGL_entry(&cur, &ui))
+ return 0;
+
+ /* check if we should start */
+ if (! it_has_begun)
+ {
+ if (ui.length == 0 && strncmp(ui.path, prefixRectified, prefixLen) == 0)
+ it_has_begun = 1;
+ else
+ continue;
+
+ if (ui.path[prefixLen] == '\0')
+ continue;
+ }
+
+ /* check if we should stop */
+ else
+ {
+ if (strncmp(ui.path, prefixRectified, prefixLen) != 0)
+ return 1;
+ }
+
+ /* check if we should include this path */
+ if (lastPathLen != -1)
+ {
+ if (strncmp(ui.path, lastPath, lastPathLen) == 0)
+ continue;
+ }
+ strcpy(lastPath, ui.path);
+ lastPathLen = strlen(lastPath);
+
+ /* check for DIRS */
+ if (ui.length == 0 && !(what & CHM_ENUMERATE_DIRS))
+ continue;
+
+ /* check for FILES */
+ if (ui.length != 0 && !(what & CHM_ENUMERATE_FILES))
+ continue;
+
+ /* check for NORMAL vs. META */
+ if (ui.path[0] == '/')
+ {
+
+ /* check for NORMAL vs. SPECIAL */
+ if (ui.path[1] == '#' || ui.path[1] == '$')
+ flag = CHM_ENUMERATE_SPECIAL;
+ else
+ flag = CHM_ENUMERATE_NORMAL;
+ }
+ else
+ flag = CHM_ENUMERATE_META;
+ if (! (what & flag))
+ continue;
+
+ /* call the enumerator */
+ {
+ int status = (*e)(h, &ui, context);
+ switch (status)
+ {
+ case CHM_ENUMERATOR_FAILURE: return 0;
+ case CHM_ENUMERATOR_CONTINUE: break;
+ case CHM_ENUMERATOR_SUCCESS: return 1;
+ default: break;
+ }
+ }
+ }
+
+ /* advance to next page */
+ curPage = header.block_next;
+ }
+
+ return 1;
+}
+
+/* resolve a particular object from the archive */
+int chm_resolve_location(struct chmFile *h,
+ unsigned long pos,
+ struct chmUnitInfo *ui)
+{
+ /*
+ * XXX: implement caching scheme for dir pages
+ */
+
+ Int32 curPage;
+
+ /* buffer to hold whatever page we're looking at */
+#ifdef WIN32
+ UChar *page_buf = alloca(h->block_len);
+#else
+ UChar page_buf[h->block_len];
+#endif
+
+ /* starting page */
+ curPage = h->index_root;
+
+ /* until we have either returned or given up */
+ while (curPage != -1)
+ {
+
+ /* try to fetch the index page */
+ if (_chm_fetch_bytes(h, page_buf,
+ (UInt64)h->dir_offset + (UInt64)curPage*h->block_len,
+ h->block_len) != h->block_len)
+ return CHM_RESOLVE_FAILURE;
+
+ /* now, if it is a leaf node: */
+ if (memcmp(page_buf, _chm_pmgl_marker, 4) == 0)
+ {
+ /* scan block */
+ /* UChar *pEntry = _chm_find_in_PMGL(page_buf, h->block_len, objPath);*/
+ {
+ /* XXX: modify this to do a binary search using the nice index structure
+ * that is provided for us.
+ */
+ struct chmPmglHeader header;
+ UInt32 hremain;
+ UChar *end;
+ UChar *cur;
+ UChar *temp;
+/*
+ UInt64 strLen;
+ char buffer[CHM_MAX_PATHLEN+1];
+*/
+ /* figure out where to start and end */
+ cur = page_buf;
+ hremain = _CHM_PMGL_LEN;
+ if (! _unmarshal_pmgl_header(&cur, &hremain, &header))
+ return CHM_RESOLVE_FAILURE;
+ end = page_buf + h->block_len - (header.free_space);
+
+ /* now, scan progressively */
+ while (cur < end)
+ {
+ UInt32 st = 0;
+ UInt32 nd = 0;
+ /* grab the name */
+ temp = cur;
+
+ if (_chm_parse_PMGL_entry(&cur, ui) == 0)
+ {
+ return CHM_RESOLVE_FAILURE;
+ }
+ st = ui->start;
+ nd = ui->start+ui->length;
+ if ((st <= pos) && (pos < nd))
+ {
+ printf("Resolve:[%u,%u,%u]\n", st, pos, nd);
+ return CHM_RESOLVE_SUCCESS;
+ }
+ }
+
+ return CHM_RESOLVE_FAILURE;
+ }
+
+ }
+
+ /* else, if it is a branch node: */
+ else if (memcmp(page_buf, _chm_pmgi_marker, 4) == 0)
+ {
+ /* curPage = _chm_find_in_PMGI(page_buf, h->block_len, objPath);*/
+ return CHM_RESOLVE_FAILURE;
+ if (0)
+ {
+ /* XXX: modify this to do a binary search using the nice index structure
+ * that is provided for us
+ */
+ struct chmPmgiHeader header;
+ UInt32 hremain;
+ int page=-1;
+ UChar *end;
+ UChar *cur;
+ UInt64 strLen;
+ char buffer[CHM_MAX_PATHLEN+1];
+
+ /* figure out where to start and end */
+ cur = page_buf;
+ hremain = _CHM_PMGI_LEN;
+ if (! _unmarshal_pmgi_header(&cur, &hremain, &header))
+ return -1;
+ end = page_buf + h->block_len - (header.free_space);
+
+ /* now, scan progressively */
+ while (cur < end)
+ {
+
+
+
+ if (_chm_parse_PMGL_entry(&cur, ui) == 0)
+ {
+ return CHM_RESOLVE_FAILURE;
+ }
+
+ if (ui->start <= pos && pos < ui->start + ui->length)
+ {
+ return CHM_RESOLVE_SUCCESS;
+ }
+
+
+
+
+
+ /* grab the name */
+ strLen = _chm_parse_cword(&cur);
+ if (! _chm_parse_UTF8(&cur, strLen, buffer))
+ return -1;
+
+ /* check if it is the right name */
+ /*
+#ifdef WIN32
+ if (stricmp(buffer, objPath) > 0)
+ return page;
+#else
+ if (strcasecmp(buffer, objPath) > 0)
+ return page;
+#endif
+ */
+ /* load next value for path */
+ page = (int)_chm_parse_cword(&cur);
+ }
+
+ curPage = page;
+ }
+ }
+ /* else, we are confused. give up. */
+ else
+ return CHM_RESOLVE_FAILURE;
+ }
+
+ /* didn't find anything. fail. */
+ return CHM_RESOLVE_FAILURE;
+
+}
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 @@
+/* $Id$ */
+/***************************************************************************
+ * chm_lib.h - CHM archive manipulation routines *
+ * ------------------- *
+ * *
+ * author: Jed Wing <jedwin@ugcs.caltech.edu> *
+ * version: 0.3 *
+ * notes: These routines are meant for the manipulation of microsoft *
+ * .chm (compiled html help) files, but may likely be used *
+ * for the manipulation of any ITSS archive, if ever ITSS *
+ * archives are used for any other purpose. *
+ * *
+ * Note also that the section names are statically handled. *
+ * To be entirely correct, the section names should be read *
+ * from the section names meta-file, and then the various *
+ * content sections and the "transforms" to apply to the data *
+ * they contain should be inferred from the section name and *
+ * the meta-files referenced using that name; however, all of *
+ * the files I've been able to get my hands on appear to have *
+ * only two sections: Uncompressed and MSCompressed. *
+ * Additionally, the ITSS.DLL file included with Windows does *
+ * not appear to handle any different transforms than the *
+ * simple LZX-transform. Furthermore, the list of transforms *
+ * to apply is broken, in that only half the required space *
+ * is allocated for the list. (It appears as though the *
+ * space is allocated for ASCII strings, but the strings are *
+ * written as unicode. As a result, only the first half of *
+ * the string appears.) So this is probably not too big of *
+ * a deal, at least until CHM v4 (MS .lit files), which also *
+ * incorporate encryption, of some description. *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of the *
+ * License, or (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef INCLUDED_CHMLIB_H
+#define INCLUDED_CHMLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef WIN32
+typedef unsigned __int64 LONGUINT64;
+typedef __int64 LONGINT64;
+#else
+typedef unsigned long long LONGUINT64;
+typedef long long LONGINT64;
+#endif
+
+/* the two available spaces in a CHM file */
+/* N.B.: The format supports arbitrarily many spaces, but only */
+/* two appear to be used at present. */
+#define CHM_UNCOMPRESSED (0)
+#define CHM_COMPRESSED (1)
+
+/* structure representing an ITS (CHM) file stream */
+struct chmFile;
+
+/* structure representing an element from an ITS file stream */
+#define CHM_MAX_PATHLEN (256)
+struct chmUnitInfo
+{
+ LONGUINT64 start;
+ LONGUINT64 length;
+ int space;
+ char path[CHM_MAX_PATHLEN+1];
+};
+
+/* open an ITS archive */
+struct chmFile* chm_open(const char *filename);
+
+/* close an ITS archive */
+void chm_close(struct chmFile *h);
+
+/* methods for ssetting tuning parameters for particular file */
+#define CHM_PARAM_MAX_BLOCKS_CACHED 0
+void chm_set_param(struct chmFile *h,
+ int paramType,
+ int paramVal);
+
+/* resolve a particular object from the archive */
+#define CHM_RESOLVE_SUCCESS (0)
+#define CHM_RESOLVE_FAILURE (1)
+int chm_resolve_object(struct chmFile *h,
+ const char *objPath,
+ struct chmUnitInfo *ui);
+
+/* retrieve part of an object from the archive */
+LONGINT64 chm_retrieve_object(struct chmFile *h,
+ struct chmUnitInfo *ui,
+ unsigned char *buf,
+ LONGUINT64 addr,
+ LONGINT64 len);
+
+/* enumerate the objects in the .chm archive */
+typedef int (*CHM_ENUMERATOR)(struct chmFile *h,
+ struct chmUnitInfo *ui,
+ void *context);
+#define CHM_ENUMERATE_NORMAL (1)
+#define CHM_ENUMERATE_META (2)
+#define CHM_ENUMERATE_SPECIAL (4)
+#define CHM_ENUMERATE_FILES (8)
+#define CHM_ENUMERATE_DIRS (16)
+#define CHM_ENUMERATE_ALL (31)
+#define CHM_ENUMERATOR_FAILURE (0)
+#define CHM_ENUMERATOR_CONTINUE (1)
+#define CHM_ENUMERATOR_SUCCESS (2)
+int chm_enumerate(struct chmFile *h,
+ int what,
+ CHM_ENUMERATOR e,
+ void *context);
+
+int chm_enumerate_dir(struct chmFile *h,
+ const char *prefix,
+ int what,
+ CHM_ENUMERATOR e,
+ void *context);
+
+int chm_resolve_location(struct chmFile *h,
+ unsigned long pos,
+ struct chmUnitInfo *ui);
+
+#ifdef __cplusplus
+}
+#endif
+
+#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 @@
+#############################################################################
+# Makefile for building: libreader_codec.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:37:45 2004
+# Project: codeclib.pro
+# Template: lib
+# Command: $(QMAKE) -o codeclib.mak codeclib.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libreader_codec.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = CExpander.cpp \
+ CBuffer.cpp \
+ StyleConsts.cpp \
+ hrule.cpp \
+ Navigation.cpp \
+ Bkmks.cpp
+OBJECTS = QREADEROBJS/CExpander.o \
+ QREADEROBJS/CBuffer.o \
+ QREADEROBJS/StyleConsts.o \
+ QREADEROBJS/hrule.o \
+ QREADEROBJS/Navigation.o \
+ QREADEROBJS/Bkmks.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = codeclib.pro
+QMAKE_TARGET = reader_codec
+DESTDIR = $(READERDIR)/lib/
+TARGET = libreader_codec.so.1.0.0
+TARGETA = $(READERDIR)/lib/libreader_codec.a
+TARGETD = libreader_codec.so.1.0.0
+TARGET0 = libreader_codec.so
+TARGET1 = libreader_codec.so.1
+TARGET2 = libreader_codec.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: codeclib.mak $(READERDIR)/lib/$(TARGET)
+
+$(READERDIR)/lib/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/lib/ || mkdir -p $(READERDIR)/lib/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/lib/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+codeclib.mak: codeclib.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o codeclib.mak codeclib.pro
+qmake:
+ @$(QMAKE) -o codeclib.mak codeclib.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) $(READERDIR)/lib/$(TARGET1) $(READERDIR)/lib/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/CExpander.o: CExpander.cpp CExpander.h \
+ QREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CExpander.o CExpander.cpp
+
+QREADEROBJS/CBuffer.o: CBuffer.cpp CBuffer.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CBuffer.o CBuffer.cpp
+
+QREADEROBJS/StyleConsts.o: StyleConsts.cpp StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/StyleConsts.o StyleConsts.cpp
+
+QREADEROBJS/hrule.o: hrule.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/hrule.o hrule.cpp
+
+QREADEROBJS/Navigation.o: Navigation.cpp Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Navigation.o Navigation.cpp
+
+QREADEROBJS/Bkmks.o: Bkmks.cpp Bkmks.h \
+ StyleConsts.h \
+ Markups.h \
+ my_list.h \
+ version.h \
+ names.h \
+ config.h \
+ Filedata.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Bkmks.o Bkmks.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libreader_codec.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: codeclib.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libreader_codec.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = CExpander.cpp \
+ CBuffer.cpp \
+ StyleConsts.cpp \
+ hrule.cpp \
+ Navigation.cpp \
+ Bkmks.cpp
+OBJECTS = OREADEROBJS/CExpander.o \
+ OREADEROBJS/CBuffer.o \
+ OREADEROBJS/StyleConsts.o \
+ OREADEROBJS/hrule.o \
+ OREADEROBJS/Navigation.o \
+ OREADEROBJS/Bkmks.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_codec.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_codec.a
+TARGETD = libreader_codec.so.1.0.0
+TARGET0 = libreader_codec.so
+TARGET1 = libreader_codec.so.1
+TARGET2 = libreader_codec.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_codec.so.1.0.0
+
+$(QTDIR)/lib/libreader_codec.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: codeclib.omak
+
+codeclib.omak: codeclib.opro
+ tmake codeclib.opro -o codeclib.omak
+
+dist:
+ $(TAR) codeclib.opro.tar codeclib.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) codeclib.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/CExpander.o: CExpander.cpp \
+ CExpander.h \
+ OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CExpander.o CExpander.cpp
+
+OREADEROBJS/CBuffer.o: CBuffer.cpp \
+ CBuffer.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CBuffer.o CBuffer.cpp
+
+OREADEROBJS/StyleConsts.o: StyleConsts.cpp \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/StyleConsts.o StyleConsts.cpp
+
+OREADEROBJS/hrule.o: hrule.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/hrule.o hrule.cpp
+
+OREADEROBJS/Navigation.o: Navigation.cpp \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Navigation.o Navigation.cpp
+
+OREADEROBJS/Bkmks.o: Bkmks.cpp \
+ Bkmks.h \
+ config.h \
+ ustring.h \
+ Filedata.h \
+ StyleConsts.h \
+ Markups.h \
+ my_list.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Bkmks.o Bkmks.cpp
+
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 @@
+#############################################################################
+# Makefile for building libreader_codec.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: codeclib.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libreader_codec.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = CExpander.cpp \
+ CBuffer.cpp \
+ StyleConsts.cpp \
+ hrule.cpp \
+ Navigation.cpp \
+ Bkmks.cpp
+OBJECTS = WSREADEROBJS/CExpander.o \
+ WSREADEROBJS/CBuffer.o \
+ WSREADEROBJS/StyleConsts.o \
+ WSREADEROBJS/hrule.o \
+ WSREADEROBJS/Navigation.o \
+ WSREADEROBJS/Bkmks.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_codec.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_codec.a
+TARGETD = libreader_codec.so.1.0.0
+TARGET0 = libreader_codec.so
+TARGET1 = libreader_codec.so.1
+TARGET2 = libreader_codec.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_codec.so.1.0.0
+
+$(QTDIR)/lib/libreader_codec.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: codeclib.wmak
+
+codeclib.wmak: codeclib.wpro
+ tmake codeclib.wpro -o codeclib.wmak
+
+dist:
+ $(TAR) codeclib.wpro.tar codeclib.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) codeclib.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/CExpander.o: CExpander.cpp \
+ CExpander.h \
+ WSREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CExpander.o CExpander.cpp
+
+WSREADEROBJS/CBuffer.o: CBuffer.cpp \
+ CBuffer.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CBuffer.o CBuffer.cpp
+
+WSREADEROBJS/StyleConsts.o: StyleConsts.cpp \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/StyleConsts.o StyleConsts.cpp
+
+WSREADEROBJS/hrule.o: hrule.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/hrule.o hrule.cpp
+
+WSREADEROBJS/Navigation.o: Navigation.cpp \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Navigation.o Navigation.cpp
+
+WSREADEROBJS/Bkmks.o: Bkmks.cpp \
+ Bkmks.h \
+ config.h \
+ ustring.h \
+ Filedata.h \
+ StyleConsts.h \
+ Markups.h \
+ my_list.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Bkmks.o Bkmks.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = CExpander.cpp CBuffer.cpp StyleConsts.cpp \
+ hrule.cpp Navigation.cpp Bkmks.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/lib
+TARGET = reader_codec
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libreader_codec.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: codeclib.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libreader_codec.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = CExpander.cpp \
+ CBuffer.cpp \
+ StyleConsts.cpp \
+ hrule.cpp \
+ Navigation.cpp \
+ Bkmks.cpp
+OBJECTS = ZREADEROBJS/CExpander.o \
+ ZREADEROBJS/CBuffer.o \
+ ZREADEROBJS/StyleConsts.o \
+ ZREADEROBJS/hrule.o \
+ ZREADEROBJS/Navigation.o \
+ ZREADEROBJS/Bkmks.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_codec.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_codec.a
+TARGETD = libreader_codec.so.1.0.0
+TARGET0 = libreader_codec.so
+TARGET1 = libreader_codec.so.1
+TARGET2 = libreader_codec.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_codec.so.1.0.0
+
+$(QTDIR)/lib/libreader_codec.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: codeclib.zmak
+
+codeclib.zmak: codeclib.zpro
+ tmake codeclib.zpro -o codeclib.zmak
+
+dist:
+ $(TAR) codeclib.zpro.tar codeclib.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) codeclib.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/CExpander.o: CExpander.cpp \
+ CExpander.h \
+ ZREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CExpander.o CExpander.cpp
+
+ZREADEROBJS/CBuffer.o: CBuffer.cpp \
+ CBuffer.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CBuffer.o CBuffer.cpp
+
+ZREADEROBJS/StyleConsts.o: StyleConsts.cpp \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/StyleConsts.o StyleConsts.cpp
+
+ZREADEROBJS/hrule.o: hrule.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/hrule.o hrule.cpp
+
+ZREADEROBJS/Navigation.o: Navigation.cpp \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Navigation.o Navigation.cpp
+
+ZREADEROBJS/Bkmks.o: Bkmks.cpp \
+ Bkmks.h \
+ config.h \
+ ustring.h \
+ Filedata.h \
+ StyleConsts.h \
+ Markups.h \
+ my_list.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Bkmks.o Bkmks.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = CExpander.cpp CBuffer.cpp StyleConsts.cpp \
+ hrule.cpp Navigation.cpp Bkmks.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/lib
+TARGET = reader_codec
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = CExpander.cpp CBuffer.cpp StyleConsts.cpp \
+ hrule.cpp Navigation.cpp Bkmks.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/lib
+TARGET = reader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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 @@
+#include "CExpander.h"
+
+#include <qfileinfo.h>
+#include <qdir.h>
+
+#include "useqpe.h"
+#ifdef USEQPE
+#include <qpe/global.h>
+#endif
+
+#include "util.h"
+
+#include "static.h"
+#ifndef __STATIC
+#include <dlfcn.h>
+class ebookcodec : public CExpander_Interface
+{
+ CExpander *codec;
+ void *handle;
+ int status;
+ public:
+ QString about()
+ {
+ return QString("Plug-in ebook codec interface (c) Tim Wentford\n")+codec->about();
+ }
+ ebookcodec(const QString& _s) : codec(NULL), handle(NULL), status(0)
+ {
+ QString codecpath(QTReaderUtil::getPluginPath());
+ codecpath += _s;
+ if (QFile::exists(codecpath))
+ {
+ qDebug("Codec:%s", (const char*)codecpath);
+ handle = dlopen(codecpath, RTLD_LAZY);
+ if (handle == 0)
+ {
+ /*
+ QString wrn(dlerror());
+ QString fmt;
+ while (wrn.length() > 10)
+ {
+ fmt += wrn.left(10);
+ fmt += '\n';
+ wrn = wrn.right(wrn.length()-10);
+ }
+ fmt += wrn;
+ QMessageBox::warning(NULL, PROGNAME, fmt);
+ */
+ qDebug("Can't find codec:%s", dlerror());
+ status = -10;
+ return;
+ }
+ CExpander* (*newcodec)();
+ newcodec = (CExpander* (*)())dlsym(handle, "newcodec");
+ if (newcodec == NULL)
+ {
+ qDebug("Can't find newcodec");
+ status = -20;
+ return;
+ }
+ codec = (*newcodec)();
+ }
+ else
+ {
+ qDebug("Can't find codec");
+ }
+ if (codec == NULL)
+ {
+ qDebug("Can't do newcodec");
+ status = -30;
+ return;
+ }
+ }
+ virtual ~ebookcodec()
+ {
+ if (codec != NULL) delete codec;
+ if (handle != NULL) dlclose(handle);
+ }
+ size_t getHome() { return codec->getHome(); }
+#ifdef USEQPE
+ void suspend() { codec->suspend(); }
+ void unsuspend() { codec->unsuspend(); }
+ void suspend(FILE*& fin) { codec->suspend(fin); }
+ void unsuspend(FILE*& fin) { codec->unsuspend(fin); }
+#endif
+ unsigned int locate() { return codec->locate(); }
+ void locate(unsigned int n) { codec->locate(n); }
+ bool hasrandomaccess() { return codec->hasrandomaccess(); }
+ void sizes(unsigned long& file, unsigned long& text)
+ {
+ codec->sizes(file, text);
+ //qDebug("Codec sizes:(%u, %u)", file, text);
+ }
+ CList<Bkmk>* getbkmklist() { return codec->getbkmklist(); }
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos) { codec->getch(ch, sty, pos); }
+ int getch() { return codec->getch(); }
+ linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) { return codec->hyperlink(n, noff, wrd, nm); }
+ MarkupType PreferredMarkup() { return codec->PreferredMarkup(); }
+ void saveposn(size_t posn) { codec->saveposn(posn); }
+ void writeposn(size_t posn) { codec->writeposn(posn); }
+ linkType forward(size_t& loc) { return codec->forward(loc); }
+ linkType back(size_t& loc) { return codec->back(loc); }
+ bool hasnavigation() { return codec->hasnavigation(); }
+ void start2endSection() { codec->start2endSection(); }
+ QImage* getPicture(unsigned long tgt) { return codec->getPicture(tgt); }
+ void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) { return codec->setSaveData(data, len, src, srclen); }
+ void putSaveData(unsigned char*& src, unsigned short& srclen) { codec->putSaveData(src, srclen); }
+ void setContinuous(bool _b) { codec->setContinuous(_b); }
+ void setwidth(int w) { codec->setwidth(w); }
+ unsigned long startSection() { return codec->startSection(); }
+ unsigned long endSection() { return codec->endSection(); }
+ int openfile(const char *src)
+ {
+ //qDebug("ebook openfile:%s", src);
+ return (status != 0) ? status : codec->openfile(src);
+ }
+ int getwidth() { return codec->getwidth(); }
+ QImage* getPicture(const QString& href) { return codec->getPicture(href); }
+ bool getFile(const QString& href) { return codec->getFile(href); }
+};
+#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
@@ -1,266 +1,288 @@
/****************************************************************************
Derived from a file browser which was
** copyright 2001 ljp ljp@llornkcor.com
Extensive modification by Tim Wentford to allow it to work in rotated mode
****************************************************************************/
#include "fileBrowser.h"
#include "QtrListView.h"
#include <qlineedit.h>
#include <qpushbutton.h>
+#include <qfile.h>
+#include <qmessagebox.h>
#ifndef _WINDOWS
#include <unistd.h>
#endif
#include <qlayout.h>
#ifdef _WINDOWS
#include <direct.h>
#endif
-#include <qpe/qpeapplication.h>
-
-
fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath )
: QDialog( parent, name, true,
fl/* | WStyle_Customize | WStyle_Tool*/),
filterspec(QDir::All)
{
// showMaximized();
if ( !name )
setName( "fileBrowser" );
-/*
- if (parent != NULL)
- {
-#ifdef OPIE
- move(0,0);
- resize( parent->width(), parent->height() );
-#else
- setGeometry(parent->x(), parent->y(), parent->width(), parent->height() );
-#endif
- }
-*/
-// showFullScreen();
setCaption(tr( "Browse for file" ) );
filterStr=filter;
buttonOk = new QPushButton( this, "buttonOk" );
- buttonOk->setFixedSize( 25, 25 );
+ // buttonOk->setFixedSize( 25, 25 );
buttonOk->setAutoDefault( false );
buttonOk->setText( tr( "/" ) );
buttonShowHidden = new QPushButton( this, "buttonShowHidden" );
// buttonShowHidden->setFixedSize( 50, 25 );
buttonShowHidden->setText( tr( "Hidden" ) );
buttonShowHidden->setAutoDefault( false );
buttonShowHidden->setToggleButton( true );
buttonShowHidden->setOn( false );
dirLabel = new QLabel(this, "DirLabel");
dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak);
dirLabel->setText(currentDir.canonicalPath());
ListView = new QtrListView( this, "ListView" );
ListView->addColumn( tr( "Name" ) );
ListView->setSorting( 2, FALSE);
ListView->addColumn( tr( "Size" ) );
ListView->setSelectionMode(QListView::Single);
ListView->setAllColumnsShowFocus( TRUE );
ListView->setColumnWidthMode(0, QListView::Manual);
ListView->setColumnWidthMode(1, QListView::Manual);
// signals and slots connections
connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) );
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) );
connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) );
connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) );
connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) );
connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) );
connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) );
QVBoxLayout* grid = new QVBoxLayout(this);
+ grid->addWidget(dirLabel);
QHBoxLayout* hgrid = new QHBoxLayout(grid);
- hgrid->addWidget(dirLabel,1);
- hgrid->addWidget(buttonShowHidden);
+
+ QPushButton* bt = new QPushButton( this );
+ bt->setText( tr( "SD" ) );
+ connect( bt, SIGNAL( clicked() ), this, SLOT( onSD() ) );
+ hgrid->addWidget(bt);
+
+ bt = new QPushButton( this );
+ bt->setText( tr( "CF" ) );
+ connect( bt, SIGNAL( clicked() ), this, SLOT( onCF() ) );
+ hgrid->addWidget(bt);
+
+ bt = new QPushButton( this );
+ bt->setText( tr( "Home" ) );
+ connect( bt, SIGNAL( clicked() ), this, SLOT( onHome() ) );
+ hgrid->addWidget(bt);
+
hgrid->addWidget(buttonOk);
+ hgrid->addWidget(buttonShowHidden);
grid->addWidget(ListView,1);
if (allownew)
{
m_filename = new QLineEdit(this);
grid->addWidget(m_filename);
connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() ));
}
else
{
m_filename = NULL;
}
if (QFileInfo(iPath).exists())
{
currentDir.setPath(iPath);
#ifdef _WINDOWS
_chdir(iPath.latin1());
#else
chdir(iPath.latin1());
#endif
}
else
{
currentDir.setPath(QDir::currentDirPath());
chdir(QDir::currentDirPath().latin1());
}
populateList();
- if (modal)
- QPEApplication::showDialog( this );
+ if (modal) showMaximized();
}
void fileBrowser::resizeEvent(QResizeEvent* e)
{
ListView->setColumnWidth(1,(ListView->width())/4);
ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1));
}
fileBrowser::~fileBrowser()
{
}
void fileBrowser::populateList()
{
ListView->clear();
-////odebug << currentDir.canonicalPath() << oendl;
+////qDebug(currentDir.canonicalPath());
// currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks );
currentDir.setFilter( filterspec );
currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentDir.setMatchAllDirs(TRUE);
currentDir.setNameFilter(filterStr);
// currentDir.setNameFilter("*.txt;*.etx");
QString fileL, fileS;
const QFileInfoList *list = currentDir.entryInfoList();
QFileInfoListIterator it(*list);
QFileInfo *fi;
while ( (fi=it.current()) )
{
if (fi->fileName() != ".")
{
fileS.sprintf( "%10li", fi->size() );
fileL.sprintf( "%s",fi->fileName().data() );
if( fi->isDir() )
{
fileL+="/";
}
else
{
-//// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl;
+//// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
}
new QListViewItem( ListView,fileL,fileS );
}
++it;
}
ListView->setSorting( 2, FALSE);
dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath());
ListView->setFocus();
}
void fileBrowser::upDir()
{
-//// odebug << currentDir.canonicalPath() << oendl;
+//// qDebug(currentDir.canonicalPath());
}
void fileBrowser::listClicked(QListViewItem *selectedItem)
{
if (selectedItem == NULL) return;
QString strItem=selectedItem->text(0);
-//// odebug << "" << strItem << "" << oendl;
+//// qDebug("%s", (const char*)strItem);
QString strSize=selectedItem->text(1);
strSize.stripWhiteSpace();
bool ok;
QFileInfo fi(strItem);
while (fi.isSymLink()) fi.setFile(fi.readLink());
if (fi.isDir())
{
strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
if(QDir(strItem).exists())
{
currentDir.cd(strItem, TRUE);
populateList();
}
} else
{
QListViewItem *selectedItem = ListView->selectedItem();
if (selectedItem == NULL)
{
filename = "";
}
else
{
filename = QDir::cleanDirPath(currentDir.canonicalPath()+"/"+selectedItem->text(0));
}
OnOK();
}
chdir(strItem.latin1());
//
}
// you may want to switch these 2 functions. I like single clicks
void fileBrowser::listDoubleClicked(QListViewItem *selectedItem)
{
}
QString fileBrowser::getCurrentFile()
{
return filename;
}
void fileBrowser::OnOK()
{
accept();
}
void fileBrowser::OnRoot()
{
- currentDir.cd("/", TRUE);
- populateList();
- chdir("/");
+ setdir("/");
}
void fileBrowser::OnCancel()
{
reject();
}
void fileBrowser::setHidden(bool _hidden)
{
if (_hidden)
filterspec = QDir::All | QDir::Hidden;
else
filterspec = QDir::All;
populateList();
}
void fileBrowser::onReturn()
{
QListViewItem *selectedItem = ListView->selectedItem();
if (selectedItem == NULL)
{
filename = m_filename->text();
}
else
{
filename = QDir::cleanDirPath(currentDir.canonicalPath()+"/"+m_filename->text());
}
OnOK();
}
+
+void fileBrowser::onCF()
+{
+ setdir("/mnt/cf");
+}
+
+void fileBrowser::onSD()
+{
+ setdir("/mnt/card");
+}
+
+void fileBrowser::onHome()
+{
+ setdir(QDir::homeDirPath());
+}
+
+void fileBrowser::setdir(const QString& s)
+{
+ currentDir.cd(s, TRUE);
+ populateList();
+ chdir(s);
+}
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,77 +1,81 @@
/*
Derived from the file browser published by ljp@llornkcor.com but extensively
modified to work in rotated views on the Zaurus
*/
/****************************************************************************
** Form interface generated from reading ui file 'fileBrowzer.ui'
**
** Created: Fri Dec 14 08:16:02 2001
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
blah,blah,blah
****************************************************************************/
#ifndef FILEBROWSER_H
#define FILEBROWSER_H
//#include <qvariant.h>
#include <qdialog.h>
#include <qfile.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qlabel.h>
#include <qstring.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QtrListView;
class QListViewItem;
class QPushButton;
class QLineEdit;
class fileBrowser : public QDialog
{
Q_OBJECT
public:
void populateList();
fileBrowser( bool allownew, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0, const QString iPath=0);
~fileBrowser();
QPushButton* buttonOk;
QPushButton* buttonShowHidden;
QtrListView* ListView;
QPushButton* buttonCancel;
QLabel *dirLabel;
QString selectedFileName, filterStr;
QDir currentDir;
QFile file;
QString getCurrentFile();
QLineEdit* m_filename;
int filterspec;
// QDir::FilterSpec filterspec;
//QListViewItem * item;
public slots:
private:
QString filename;
private slots:
void upDir();
void listDoubleClicked(QListViewItem *);
void listClicked(QListViewItem *);
void OnRoot();
void OnCancel();
void setHidden(bool);
void onReturn();
+ void onCF();
+ void onSD();
+ void onHome();
protected slots:
protected:
void OnOK();
virtual void resizeEvent(QResizeEvent* e);
+ void setdir(const QString& s);
};
#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 @@
+#ifndef __HASH_H
+#define __HASH_H
+
+#include <stdlib.h>
+/* Primes
+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
+101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181
+191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277
+281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383
+389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487
+491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601
+607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709
+719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827
+829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947
+953 967 971 977 983 991 997
+*/
+
+inline size_t hashfn(unsigned long l)
+{
+ return l*0x33f3;
+}
+
+inline size_t hash2fn(unsigned long l)
+{
+ return l & 7;
+}
+/*/
+template<class K>size_t hashfn(const K& l)
+{
+ size_t s = 0;
+ unsigned char* p = (unsigned char*)&l;
+ for (int i = 0; i < sizeof(K)-1; i++)
+ {
+ s = 3*s+(255-p[i]);
+ }
+}
+
+template<class K>size_t hash2fn(const K& l)
+{
+ unsigned char* p = (unsigned char*)&l;
+ return 255-p[sizeof(K)-1];
+}
+*/
+template<class K, class D>
+class hashtable
+{
+ public:
+ class iterator;
+ friend class hashtable::iterator;
+#ifndef _WINDOWS
+ private:
+#endif
+ struct keydata
+ {
+ K key;
+ D data;
+ bool inuse;
+ keydata() : inuse(false) {}
+ keydata(K k, D d) : key(k), data(d), inuse(true) {}
+ };
+ keydata* table;
+ size_t hshsz;
+ bool notprime(size_t p)
+ {
+ size_t d;
+ if (p % 2 == 0) return true;
+ d = 3;
+ while (d*d <= p)
+ {
+ if (p % d == 0)
+ {
+ return true;
+ }
+ d += 2;
+ }
+ return false;
+ }
+ void resize()
+ {
+ size_t oldsz = hshsz;
+ hshsz = (3*hshsz)/2;
+ while (notprime(hshsz))
+ {
+ hshsz++;
+ }
+ //printf("Size:%u\n", hshsz);
+ keydata* oldtable = table;
+ table = new keydata[hshsz];
+ for (size_t i = 0; i < oldsz; i++)
+ {
+ if (oldtable[i].inuse)
+ {
+ //printf("Setting %u to %u\n", oldtable[i].key, oldtable[i].data);
+ (*this)[oldtable[i].key] = oldtable[i].data;
+ //printf("Now %u is %u\n", oldtable[i].key, (*this)[oldtable[i].key]);
+ }
+ }
+ delete [] oldtable;
+ }
+ size_t findkey(const K& key) // returns -1 if can't find it
+ {
+ size_t hash2 = hash2fn(key)%(hshsz-1)+1;
+ size_t hash = hashfn(key) % hshsz;
+ size_t i = hash;
+ //printf("Key:%u, hash:%u, hash2:%u\n", key, hash, hash2);
+ while (table[i].inuse) // !empty
+ {
+ if (table[i].key == key)
+ {
+ //printf("Key %u present at %u\n", key, i);
+ return i; // but its the correct one & present
+ }
+ i = (i+hash2) % hshsz;
+ if (i == hash) // Table full
+ {
+ resize();
+ hash2 = hash2fn(key)%(hshsz-1)+1;
+ hash = hashfn(key) % hshsz;
+ i = hash;
+ //printf("(R)Key:%u, hash:%u, hash2:%u\n", key, hash, hash2);
+ }
+ }
+ //printf("Key %u absent at %u\n", key, i);
+ return i; // found & absent
+ }
+ public:
+ hashtable(int sz) : hshsz(sz)
+ {
+ while (notprime(hshsz))
+ {
+ hshsz++;
+ }
+ //printf("Size:%u\n", hshsz);
+ table = new keydata[hshsz];
+ }
+ ~hashtable()
+ {
+ delete [] table;
+ }
+ D& operator[](K k)
+ {
+ int i = findkey(k);
+ table[i].key = k;
+ table[i].inuse = true;
+ return table[i].data;
+ }
+ class iterator
+ {
+ friend class hashtable;
+#ifdef _WINDOWS
+ public:
+#endif
+ unsigned int ptr;
+ hashtable* tab;
+ iterator(int t, hashtable* _tab) : ptr(t), tab(_tab)
+ {
+ while (!tab->table[ptr].inuse && ptr < tab->hshsz)
+ {
+ ptr++;
+ }
+ }
+ public:
+ iterator() : tab(NULL) {}
+ iterator operator++()
+ {
+ while (++ptr < tab->hshsz)
+ {
+ if (tab->table[ptr].inuse) return *this;
+ }
+ return *this;
+ }
+ iterator& operator=(const iterator& r)
+ {
+ ptr = r.ptr;
+ tab = r.tab;
+ return *this;
+ }
+ bool operator!=(const iterator& r)
+ {
+ return !((ptr == r.ptr) && (tab == r.tab));
+ }
+ bool operator==(const iterator& r)
+ {
+ return ((ptr == r.ptr) && (tab == r.tab));
+ }
+ K first() { return tab->table[ptr].key; }
+ D second() { return tab->table[ptr].data; }
+ };
+ iterator find(K k)
+ {
+ size_t i = findkey(k);
+ return (table[i].inuse) ? iterator(i,this) : end();
+ }
+ D& operator[](const iterator& i) // Never call with an invalid iterator!
+ {
+ return table[i.ptr].data;
+ }
+ iterator begin() { return iterator(0, this); }
+ iterator end() { return iterator(hshsz, this); }
+};
+#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 @@
+#include <qimage.h>
+
+QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b)
+{
+//// qDebug("hrule [%d, %d]", w, h);
+ QPixmap* qimage = new QPixmap(w, h);
+ qimage->fill(QColor(r,g,b));
+ QImage* ret = new QImage(qimage->convertToImage());
+ delete qimage;
+ return ret;
+}
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 @@
+#ifndef __HRULE_H
+#define __HRULE_H
+
+class QImage;
+
+QImage* hRule(int w, int h, unsigned char r=0, unsigned char g=0, unsigned char b=0);
+
+#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 @@
+#include "iSilo.h"
+#ifdef _WINDOWS
+#include <winsock.h>
+#endif
+u_int8_t *rodata = (u_int8_t *)
+ "\x10\x11\x12\x00\x08\x07\x09\x06\x0a\x05\x0b\x04\x0c\x03\x0d\x02\x0e\x01\x0f";
+
+u_int16_t *rsize_min = (u_int16_t *)
+ "\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0d"
+"\x00\x0f\x00\x11\x00\x13\x00\x17\x00\x1b\x00\x1f\x00\x23\x00\x2b\x00\x33\x00"
+"\x3b\x00\x43\x00\x53\x00\x63\x00\x73\x00\x83\x00\xa3\x00\xc3\x00\xe3\x00\x02"
+"\x01";
+
+u_int8_t *rsize_delta = (u_int8_t *)
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x02\x02\x02\x02\x03\x03\x03"
+"\x03\x04\x04\x04\x04\x05\x05\x05\x05\x00";
+
+u_int16_t *rpos_min = (u_int16_t *)
+ "\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x07\x00\x09\x00\x0d\x00\x11\x00\x19"
+"\x00\x21\x00\x31\x00\x41\x00\x61\x00\x81\x00\xc1\x00\x01\x01\x81\x01\x01\x02"
+"\x01\x03\x01\x04\x01\x06\x01\x08\x01\x0c\x01\x10\x01\x18\x01\x20\x01\x30\x01"
+"\x40\x01\x60";
+
+u_int8_t *rpos_delta = (u_int8_t *)
+ "\x00\x00\x00\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06\x07\x07"
+"\x08\x08\x09\x09\x0a\x0a\x0b\x0b\x0c\x0c\x0d\x0d";
+
+void iSilo::init_tables(void)
+{
+ int i;
+ u_int16_t j;
+ return;
+ for (i = 0; i < 3; i++)
+ rodata[i] = 0x10 + i;
+ rodata[3] = 0;
+ for (i = 4; i < 19; i = i + 2)
+ rodata[i] = 8 + (i-4)/2;
+ for (i = 5; i < 19; i = i + 2)
+ rodata[i] = 7 - (i-5)/2;
+
+ memset(rsize_delta, 0, 29);
+ for (i = 4; i < 29; i++) {
+ rsize_delta[i] = (i - 4) >> 2;
+ }
+ memset(rpos_delta, 0, 30);
+ for (i = 2; i < 30; i++) {
+ rpos_delta[i] = (i - 2) >> 1;
+ }
+ j = 3;
+ for (i = 0; i < 29; i++) {
+ rsize_min[i] = j;
+ j += 1 << rsize_delta[i];
+ }
+ j = 1;
+ for (i = 0; i < 30; i++) {
+ rpos_min[i] = j;
+ j += 1 << rpos_delta[i];
+ }
+}
+
+/* read num bits from the file descriptor */
+
+int iSilo::code2tree(struct s_huffman *h) {
+ struct s_tree *t, *tmp;
+ u_int32_t i;
+ int j, b;
+
+ t = new s_tree();
+ h->tree = t;
+ if (t == NULL) return -1;
+ memset(t, 0, sizeof(struct s_tree));
+ t->value = (u_int32_t)-1;
+ for (i = 0; i < h->num; i++) {
+ tmp = t;
+ for (j = 0; j < h->size[i]; j++) {
+ b = (h->code[i] >> j) & 1;
+ if (tmp->branch[b] == NULL) {
+ tmp->branch[b] =new s_tree();
+ if (tmp->branch[b] == NULL) return(-1);
+ memset(tmp->branch[b], 0, sizeof(struct s_tree));
+ tmp->value = (u_int32_t)-1;
+ }
+ tmp = tmp->branch[b];
+ }
+ if (h->size[i] > 0) tmp->value = i;
+ }
+ return (0);
+}
+
+u_int32_t iSilo::swap_bits(u_int32_t n, int num) {
+ n = ((n >> 1) & 0x55555555) | ((n << 1) & 0xaaaaaaaa);
+ n = ((n >> 2) & 0x33333333) | ((n << 2) & 0xcccccccc);
+ n = ((n >> 4) & 0x0f0f0f0f) | ((n << 4) & 0xf0f0f0f0);
+ n = ((n >> 8) & 0x00ff00ff) | ((n << 8) & 0xff00ff00);
+ n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000);
+ n >>= (32 - num);
+ return(n);
+}
+
+
+u_int32_t *iSilo::huffman_get(struct s_huffman *h)
+{
+ int b;
+ struct s_tree *t = h->tree;
+
+ while (t->value == -1) {
+ b = get_bits(1);
+ if (t->branch[b] == NULL) {
+ return(NULL);
+ }
+ t = t->branch[b];
+ }
+ return (&t->value);
+}
+
+int iSilo::size2code(struct s_huffman *h) {
+ u_int8_t i, sk, max = 0;
+ u_int16_t sc, c;
+ u_int32_t j, k, l;
+ int skip;
+
+ for (l = 0; l < h->num; l++) {
+ if (h->size[l] > max) max = h->size[l];
+ }
+
+ for (i = 1; i <= max; i++) {
+ sc = 0;
+ c = 0;
+ for (j = 0; j < h->num; j++) {
+ if (h->size[j] == i) {
+ do {
+ skip = 0;
+ for (k = 0; k < h->num; k++) {
+ sk = h->size[k];
+
+ if ((sk < i) && (sk != 0) && !((h->code[k] ^ c) & ((1 << sk)-1))) {
+ if ((c + 1) == (1 << i)) {
+ return -1;
+ }
+ sc += 1 << (i-sk);
+ c = swap_bits(sc, i);
+ skip = 1;
+ break;
+ }
+ }
+ } while (skip);
+ h->code[j] = c;
+ sc++;
+ c = swap_bits(sc, i);
+ }
+ }
+ }
+ return(0);
+}
+
+
+struct s_huffman *iSilo::huffman_create(u_int32_t num) {
+ struct s_huffman *h;
+ h = new s_huffman();
+ h->tree = new s_tree();
+ memset(h->tree, 0, sizeof(struct s_tree));
+ h->tree->value = (u_int32_t)-1;
+ h->num = num;
+ h->code = new u_int16_t[num];
+ h->size = new u_int8_t[num];
+ memset(h->size, 0, num);
+ memset(h->code, 0, num*2);
+ return (h);
+}
+
+void iSilo::kill_tree(struct s_tree *tree) {
+ if (tree == NULL) {
+ return;
+ }
+ kill_tree(tree->branch[0]);
+ kill_tree(tree->branch[1]);
+ delete tree;
+}
+
+void iSilo::kill_huffman(struct s_huffman *h) {
+ if (h == NULL) {
+ return;
+ }
+ kill_tree(h->tree);
+ delete h->code;
+ delete h->size;
+ delete h;
+}
+
+int iSilo::read_size(struct s_huffman *prev, struct s_huffman *h) {
+ u_int32_t *j;
+ u_int32_t i, n;
+ int s_ok = 0, ls = 0;
+
+ for (i = 0;i < h->num;) {
+ j = huffman_get(prev);
+ if (j == NULL)
+ return(-1);
+ switch(*j) {
+ case HM_MEDIUM:
+ n = get_swapped(3) + 3; /* n bytes of 0 */
+ memset(h->size + i, 0, n);
+ i += n;
+ break;
+ case HM_LONG:
+ n = get_swapped(7) + 11; /* n bytes of 0 */
+ memset(h->size + i, 0, n);
+ i += n;
+ break;
+ case HM_SHORT:
+ if (!s_ok) {
+ return(-1);
+ }
+ n = get_swapped(2) + 3; /* n+1 bytes of ls */
+ memset(h->size + i, ls, n);
+ i += n;
+ break;
+ default:
+ h->size[i] = *j;
+ ls = *j;
+ i++;
+ break;
+ }
+ if ((*j == HM_LONG) || (*j == HM_MEDIUM)) {
+ s_ok = 0;
+ } else {
+ s_ok = 1;
+ }
+ }
+ return(0);
+}
+
+void iSilo::mymemcpy(u_int8_t *dst, u_int8_t *src, u_int32_t num) {
+ u_int32_t i;
+ for (i = 0; i < num; i++) {
+ dst[i] = src[i];
+ }
+}
+/* return size or -1 for error */
+
+int iSilo::read_tree(struct s_huffman *prev, struct s_huffman *curr) {
+ if (read_size(prev, curr) == -1)
+ return(-1);
+ if (size2code(curr) == -1)
+ return(-1);
+ if (code2tree(curr) == -1)
+ return(-1);
+ return(0);
+}
+bool iSilo::reset_trees()
+{
+ get_bits(0); /* flush buffer */
+ /* This is a Table record so we reload the tables */
+ kill_huffman(lz);
+ kill_huffman(text);
+ kill_huffman(master);
+
+ master = huffman_create(19);
+ text = huffman_create(get_swapped(5) + 257);
+ lz = huffman_create(get_swapped(5) + 1);
+ int rdmax = get_swapped(4) + 4;
+
+ for (int i = 0; i < rdmax; i++)
+ {
+ master->size[rodata[i]] = get_swapped(3);
+ }
+
+ if (size2code(master) == -1) {
+ qDebug("size2code(master) error: size-table is incompatible");
+ return false;
+ }
+
+ code2tree(master);
+
+ if (read_tree(master, text) == -1) {
+ qDebug("read_tree() failed (format incorrect?)");
+ return false;
+ }
+
+ if (read_tree(master, lz) == -1) {
+ qDebug("read_tree() failed (format incorrect?)");
+ return false;;
+ }
+ return true;
+}
+u_int32_t iSilo::get_bits(int num) {
+ int i, r;
+ u_int32_t result = 0;
+
+ if (num == 0) {
+ pos = 0;
+ return(0);
+ }
+
+ for (i = 0; i < num; i++) {
+ if (pos == 0) {
+ r = fread(buf, sizeof(u_int32_t), 256, fin);
+ if (r <= 0) {
+ qDebug("ERROR: Unexpected end of file");
+ exit(-1); /* FIXME */
+ }
+ pos = 32*256;
+ }
+
+ pos--;
+ result <<= 1;
+ result |= (ntohl(buf[255 - (pos/32)]) >> (31-(pos % 32))) & 1;
+ }
+ return(result);
+}
+u_int32_t iSilo::get_swapped(int num) {
+ return(swap_bits(get_bits(num),num));
+}
+int iSilo::read_text() {
+ u_int32_t *j;
+ u_int32_t k, l, bp, idx;
+ for (bp = 0; bp < buffer_size;) {
+ j = huffman_get(text);
+ if (j == NULL)
+ return(-1);
+ if (*j == 256) {
+ break;
+ }
+ if (*j >= 257) {
+ idx = *j - 257;
+ k = rsize_min[idx];
+ if (rsize_delta[idx] != 0) {
+ k += get_swapped(rsize_delta[idx]);
+ }
+ j = huffman_get(lz);
+ if (j == NULL)
+ return(-1);
+ l = rpos_min[*j];
+ if (rpos_delta[*j] != 0) {
+ l += get_swapped(rpos_delta[*j]);
+ }
+ if (k <= l) {
+ memcpy(buffer + bp, buffer + bp - l, k);
+ } else {
+ mymemcpy(buffer + bp, buffer + bp - l, k);
+ }
+ bp += k;
+ } else {
+ buffer[bp] = *j;
+ bp++;
+ }
+ }
+ return(bp);
+}
+u_int32_t iSilo::getreccode()
+{
+ u_int32_t offset, rec_code;
+ gotorecordnumber(cur_rec);
+ if (fread(&rec_code, sizeof(rec_code), 1, fin) != 1)
+ {
+ qDebug("short read");
+ return 0xff;
+ }
+ return rec_code;
+}
+bool iSilo::process_record()
+{
+ u_int32_t rec_code = getreccode();
+ if (((rec_code & 0xFF) == 0) && (cur_rec != 0))
+ {
+ return false;
+ }
+ else
+ {
+ /* process text */
+ if ((cur_rec % 9) == 1)
+ {
+ bsize = 0;
+ if (!reset_trees()) return false;
+ cur_rec++;
+ rec_code = getreccode();
+ if (((rec_code & 0xFF) == 0) && (cur_rec != 0))
+ {
+ return false;
+ }
+ }
+ if (cur_rec != 0)
+ {
+ /* This is a Data record so we decode text using the table */
+ get_bits(0);
+ bsize = read_text();
+ } /* end of text processing */
+ }
+ return true;
+}
+iSilo::~iSilo()
+{
+ kill_huffman(master);
+ kill_huffman(lz);
+ kill_huffman(text);
+ if (attr != NULL)
+ {
+ delete [] attr;
+ attr = NULL;
+ }
+}
+int iSilo::getch()
+{
+ if (filepos >= textsize)
+ {
+ // qDebug("File end at record %u", cur_rec);
+ return EOF;
+ }
+ if (current_pos >= bsize)
+ {
+ cur_rec++;
+ if (!process_record()) return EOF;
+ current_pos = 0;
+ }
+ filepos++;
+ while (attr != NULL && filepos > attr[current_attr].offset)
+ {
+ mystyle.unset();
+ u_int16_t a = attr[current_attr].value;
+ // qDebug("Handling attr:%x at pos:%u", a, filepos);
+ if ((a & 0x1) != 0)
+ {
+ mystyle.setBold();
+ }
+ if ((a & 0xe) != 0)
+ {
+ qDebug("Unknown attribute:%x (%x)", a & 0xe, a);
+ }
+ if ((a & 0x10) != 0)
+ {
+ mystyle.setCentreJustify();
+ }
+ else if ((a & 0x20) != 0)
+ {
+ mystyle.setRightJustify();
+ }
+ else
+ {
+ mystyle.setLeftJustify();
+ }
+ if ((a & 0x40) != 0)
+ {
+ qDebug("Unknown attribute:%x (%x)", a & 0x40, a);
+ }
+ if ((a & 0x80) != 0)
+ {
+ mystyle.setLeftMargin(10);
+ mystyle.setRightMargin(10);
+ }
+ switch (a & 0xf00)
+ {
+ case 0x300:
+ mystyle.setFontSize(0);
+ break;
+ case 0xd00:
+ mystyle.setFontSize(1);
+ break;
+ case 0xe00:
+ mystyle.setFontSize(2);
+ break;
+ case 0xf00:
+ mystyle.setFontSize(3);
+ break;
+ default:
+ mystyle.setFontSize(0);
+ qDebug("Not sure of font size:%x (%x)", a & 0xf00, a);
+ break;
+ }
+ if ((a & 0x1000) != 0)
+ {
+ mystyle.setMono();
+ }
+ if ((a & 0x2000) != 0)
+ {
+ mystyle.setItalic();
+ }
+ if ((a & 0x4000) != 0)
+ {
+ qDebug("Unknown attribute:%x (%x)", a & 0x4000, a);
+ }
+ if ((a & 0x8000) != 0)
+ {
+ mystyle.setUnderline();
+ }
+ current_attr++;
+ if (current_attr >= attr_num)
+ {
+ attr_rec++;
+ read_attr();
+ }
+ }
+ return buffer[current_pos++];
+}
+
+void iSilo::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ pos = filepos;
+ ch = getch();
+ sty = mystyle;
+}
+
+int iSilo::OpenFile(const char* src)
+{
+ struct stat _stat;
+ stat(src,&_stat);
+ filesize = _stat.st_size;
+ pos = 0;
+ cur_rec = 0;
+ buffer_size = 4096;
+ current_pos = 0;
+ bsize = 0;
+ filepos = 0;
+
+ if (!Cpdb::openpdbfile(src))
+ {
+ return -1;
+ }
+ if (head.creator != 0x6F476F54 // 'ToGo'
+ || head.type != 0x6F476F54) // 'ToGo')
+ {
+ return -1;
+ }
+ qDebug("There is %u records in this PDB file", ntohs(head.recordList.numRecords));
+ init_tables();
+ gotorecordnumber(0);
+ fread(buffer,1,12,fin);
+ fread(&textsize, sizeof(textsize), 1, fin);
+ textsize = ntohl(textsize);
+ fread(buffer,1,4,fin);
+ fread(&attr_start,sizeof(attr_start),1,fin);
+ attr_start = ntohs(attr_start);
+ fread(buffer,1,2,fin);
+ fread(&attr_end,sizeof(attr_end),1,fin);
+ attr_end = ntohs(attr_end);
+ attr_rec = attr_start;
+ attr = NULL;
+ pos_hi = 0xffff;
+ last_pos = 0xffff;
+ last_value = 0xffff;
+ read_attr();
+ return 0;
+}
+
+void iSilo::read_attr()
+{
+ // qDebug("read_attr:<%u, %u, %u>", attr_rec, attr_start, attr_end);
+ current_attr = 0;
+ if (attr != NULL)
+ {
+ delete [] attr;
+ attr = NULL;
+ }
+ if (attr_rec >= attr_start && attr_rec < attr_end)
+ {
+ gotorecordnumber(attr_rec);
+ fread(buffer, 1, 4, fin);
+ fread(&attr_num, sizeof(attr_num), 1, fin);
+ attr_num = ntohs(attr_num)+1;
+ attr = new s_attrib[attr_num];
+ for (int j = 0; j < attr_num; j++)
+ {
+ fread(&attr[j].offset, 2, 1, fin);
+ attr[j].offset = htons(attr[j].offset);
+ }
+#ifdef _WINDOWS
+ for (j = 0; j < attr_num; j++)
+#else
+ for (int j = 0; j < attr_num; j++)
+#endif
+ {
+ fread(&attr[j].value, 2, 1, fin);
+ if (attr[j].offset < last_pos)
+ {
+ pos_hi++;
+ }
+
+ if ((attr[j].offset == last_pos) && (attr[j].value == last_value))
+ {
+ pos_hi++;
+ }
+
+ last_pos = attr[j].offset;
+ attr[j].offset |= ((u_int32_t)pos_hi) << 16;
+ last_value = attr[j].value;
+ }
+ current_attr = 0;
+ // last_value = attr[attr_num-1].value;
+ // qDebug("Next attr:%u (%u)", attr[current_attr].offset, filepos);
+ // qDebug("Next attr:%x (%x)", attr[current_attr].offset, filepos);
+ }
+}
+
+void iSilo::locate(unsigned int n)
+{
+ // qDebug("Locating %u", n);
+ if (n >= textsize) n = 0;
+ pos = 0;
+ buffer_size = 4096;
+ current_pos = 0;
+ bsize = 0;
+ /* Brute force
+ cur_rec = 0;
+ filepos = 0;
+ */ // Fast
+ filepos = n - n % (8*buffer_size);
+ cur_rec = 9*(n/(8*buffer_size));
+ // End of fast
+ pos_hi = 0xffff;
+ last_pos = 0xffff;
+ last_value = 0xffff;
+ attr_rec = attr_start;
+ read_attr();
+ // While loop added for fast locate
+ while (attr != NULL && attr[attr_num-1].offset < filepos)
+ {
+ attr_rec++;
+ read_attr();
+ }
+
+ while (filepos < n)
+ {
+ getch();
+ }
+}
+/*
+ if (!process_record()) return EOF;
+ current_pos = 0;
+*/
+
+QString iSilo::about()
+{
+ return QString("iSilo codec (c) Tim Wentford, based on code supplied by an anonymous donor");
+}
+
+extern "C"
+{
+ CExpander* newcodec() { return new iSilo; }
+}
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 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifndef _WINDOWS
+#include <netinet/in.h>
+#include <unistd.h>
+#include <stdlib.h>
+#else
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned long u_int32_t;
+#endif
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "pdb.h"
+
+#define VERSION "deSilo version 0.4a by Clement"
+
+
+struct s_tree {
+ struct s_tree *branch[2];
+ u_int32_t value;
+};
+
+struct s_attrib {
+ u_int32_t offset;
+ u_int16_t value;
+};
+
+struct s_huffman {
+ struct s_tree *tree;
+ u_int8_t *size;
+ u_int16_t *code;
+ u_int32_t num;
+};
+
+#define HM_SHORT 0x10
+#define HM_MEDIUM 0x11
+#define HM_LONG 0x12
+
+class iSilo : public Cpdb
+{
+ CStyle mystyle;
+ u_int16_t BlockSize;
+ int pos;
+ u_int32_t buf[256];
+ struct s_huffman *master, *lz, *text;
+ u_int32_t cur_rec;
+ u_int8_t buffer[4096];
+ u_int32_t buffer_size;
+ u_int16_t current_pos, bsize;
+ u_int32_t filepos, filesize, textsize;
+ u_int16_t attr_start, attr_end, attr_num, current_attr, attr_rec;
+ u_int16_t pos_hi;
+ u_int16_t last_pos, last_value;
+
+
+ s_attrib* attr;
+
+
+ void init_tables(void);
+ int code2tree(struct s_huffman *h);
+ u_int32_t swap_bits(u_int32_t n, int num);
+ u_int32_t *huffman_get(struct s_huffman *h);
+ int size2code(struct s_huffman *h);
+ void read_attr();
+ struct s_huffman *huffman_create(u_int32_t num);
+ void kill_tree(struct s_tree *tree);
+ void kill_huffman(struct s_huffman *h);
+ int read_size(struct s_huffman *prev, struct s_huffman *h);
+ void mymemcpy(u_int8_t *dst, u_int8_t *src, u_int32_t num);
+ int read_tree(struct s_huffman *prev, struct s_huffman *curr);
+ bool reset_trees();
+ u_int32_t get_bits(int num);
+ u_int32_t get_swapped(int num);
+ int read_text();
+ u_int32_t getreccode();
+ bool process_record();
+public:
+ iSilo() : pos(0), master(NULL), lz(NULL), text(NULL), cur_rec(0), buffer_size(4096), current_pos(0), bsize(0), BlockSize(4096)
+ {
+ }
+ ~iSilo();
+ int getch();
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ MarkupType PreferredMarkup()
+ {
+ return cNONE;
+ }
+ void sizes(unsigned long& _file, unsigned long& _text)
+ {
+ _file = filesize;
+ _text = textsize;
+ }
+ bool hasrandomaccess() { return false; }
+ int OpenFile(const char* src);
+ unsigned int locate()
+ {
+ return filepos;
+ }
+ void locate(unsigned int n);
+ QString about();
+};
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 @@
+#############################################################################
+# Makefile for building: libiSilo.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:39:31 2004
+# Project: iSiloCodec.pro
+# Template: lib
+# Command: $(QMAKE) -o iSiloCodec.mak iSiloCodec.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libiSilo.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_pdb -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS =
+SOURCES = iSilo.cpp
+OBJECTS = QREADEROBJS/iSilo.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = iSiloCodec.pro
+QMAKE_TARGET = iSilo
+DESTDIR = $(READERDIR)/codecs/
+TARGET = libiSilo.so.1.0.0
+TARGETA = $(READERDIR)/codecs/libiSilo.a
+TARGETD = libiSilo.so.1.0.0
+TARGET0 = libiSilo.so
+TARGET1 = libiSilo.so.1
+TARGET2 = libiSilo.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: iSiloCodec.mak $(READERDIR)/codecs/$(TARGET)
+
+$(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+iSiloCodec.mak: iSiloCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o iSiloCodec.mak iSiloCodec.pro
+qmake:
+ @$(QMAKE) -o iSiloCodec.mak iSiloCodec.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/iSilo.o: iSilo.cpp iSilo.h \
+ pdb.h \
+ QREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/iSilo.o iSilo.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libiSilo.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: iSiloCodec.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libiSilo.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS =
+SOURCES = iSilo.cpp
+OBJECTS = OREADEROBJS/iSilo.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libiSilo.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libiSilo.a
+TARGETD = libiSilo.so.1.0.0
+TARGET0 = libiSilo.so
+TARGET1 = libiSilo.so.1
+TARGET2 = libiSilo.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: iSiloCodec.omak
+
+iSiloCodec.omak: iSiloCodec.opro
+ tmake iSiloCodec.opro -o iSiloCodec.omak
+
+dist:
+ $(TAR) iSiloCodec.opro.tar iSiloCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) iSiloCodec.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/iSilo.o: iSilo.cpp \
+ iSilo.h \
+ pdb.h \
+ OREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/iSilo.o iSilo.cpp
+
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 @@
+#############################################################################
+# Makefile for building libiSilo.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: iSiloCodec.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libiSilo.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS =
+SOURCES = iSilo.cpp
+OBJECTS = WSREADEROBJS/iSilo.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libiSilo.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libiSilo.a
+TARGETD = libiSilo.so.1.0.0
+TARGET0 = libiSilo.so
+TARGET1 = libiSilo.so.1
+TARGET2 = libiSilo.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: iSiloCodec.wmak
+
+iSiloCodec.wmak: iSiloCodec.wpro
+ tmake iSiloCodec.wpro -o iSiloCodec.wmak
+
+dist:
+ $(TAR) iSiloCodec.wpro.tar iSiloCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) iSiloCodec.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/iSilo.o: iSilo.cpp \
+ iSilo.h \
+ pdb.h \
+ WSREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/iSilo.o iSilo.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+#HEADERS = Aportis.h
+
+SOURCES = iSilo.cpp
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = iSilo
+LIBS += -lreader_pdb -lreader_codec
+
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libiSilo.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: iSiloCodec.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libiSilo.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_pdb -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS =
+SOURCES = iSilo.cpp
+OBJECTS = ZREADEROBJS/iSilo.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libiSilo.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libiSilo.a
+TARGETD = libiSilo.so.1.0.0
+TARGET0 = libiSilo.so
+TARGET1 = libiSilo.so.1
+TARGET2 = libiSilo.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libiSilo.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: iSiloCodec.zmak
+
+iSiloCodec.zmak: iSiloCodec.zpro
+ tmake iSiloCodec.zpro -o iSiloCodec.zmak
+
+dist:
+ $(TAR) iSiloCodec.zpro.tar iSiloCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) iSiloCodec.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/iSilo.o: iSilo.cpp \
+ iSilo.h \
+ pdb.h \
+ ZREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/iSilo.o iSilo.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+#HEADERS = Aportis.h
+
+SOURCES = iSilo.cpp
+
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = iSilo
+LIBS += -lreader_pdb -lreader_codec
+
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+#HEADERS = Aportis.h
+
+SOURCES = iSilo.cpp
+
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/codecs
+TARGET = iSilo
+LIBS += -lreader_pdb -lreader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+include ( $(OPIEDIR)/include.pro )
+
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,43 +1,83 @@
#include "infowin.h"
#include "version.h"
#include <stdio.h>
+#include <qmultilineedit.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
#include "names.h"
+void infowin::setAbout(const QString& _s)
+{
+ char vstr[128];
+ sprintf(vstr, PROGNAME " v%u.%u%c (%s) - A small e-text reader\n%s %s", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE, __DATE__, __TIME__);
+ // l = new QLabel(vstr, this);
+ QString c = vstr;
+ c += _s;
+ aboutbox->setText(c);
+}
+
infowin::infowin( QWidget *parent, const char *name, WFlags f) :
QWidget(parent, name, f)
{
- grid = new QGridLayout(this, 6, 2);
+ QVBoxLayout* vl = new QVBoxLayout(this);
+ aboutbox = new QMultiLineEdit(this);
+ aboutbox->setReadOnly(true);
+ aboutbox->setWordWrap(QMultiLineEdit::WidgetWidth);
+ //grid->addWidget(l, 5, 0);
+ vl->addWidget(aboutbox);
+ QGridLayout* grid = new QGridLayout(vl, 10, 2);
QLabel* l;
l = new QLabel("Compressed file size", this);
grid->addWidget(l, 0, 0);
fileSize = new QLabel("0", this);
fileSize->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(fileSize, 0, 1);
l = new QLabel("Original text size", this);
grid->addWidget(l, 1, 0);
textSize = new QLabel("0", this);
textSize->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(textSize, 1, 1);
l = new QLabel("Compression Ratio", this);
grid->addWidget(l, 2, 0);
ratio = new QLabel("0", this);
grid->addWidget(ratio, 2, 1);
ratio->setAlignment( AlignVCenter | AlignRight );
l = new QLabel("Current location", this);
grid->addWidget(l, 3, 0);
location = new QLabel("0", this);
location->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(location, 3, 1);
- l = new QLabel("Per centage read", this);
+ l = new QLabel("Per centage read (file)", this);
grid->addWidget(l, 4, 0);
read = new QLabel("0", this);
read->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(read, 4, 1);
- char vstr[128];
- sprintf(vstr, PROGNAME " v%u.%u%c (%s)\nA small e-text reader", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE);
- l = new QLabel(vstr, this);
+
+ l = new QLabel("Document Size", this);
grid->addWidget(l, 5, 0);
+ docSize = new QLabel("0", this);
+ docSize->setAlignment( AlignVCenter | AlignRight );
+ grid->addWidget(docSize, 5, 1);
+
+ l = new QLabel("Document Location", this);
+ grid->addWidget(l, 6, 0);
+ docLocation = new QLabel("0", this);
+ docLocation->setAlignment( AlignVCenter | AlignRight );
+ grid->addWidget(docLocation, 6, 1);
+
+ l = new QLabel("Per centage read (doc)", this);
+ grid->addWidget(l, 7, 0);
+ docread = new QLabel("0", this);
+ docread->setAlignment( AlignVCenter | AlignRight );
+ grid->addWidget(docread, 7, 1);
+
+
+ l = new QLabel("Zoom", this);
+ grid->addWidget(l, 8, 0);
+ zoom = new QLabel("0", this);
+ zoom->setAlignment( AlignVCenter | AlignRight );
+ grid->addWidget(zoom, 8, 1);
QPushButton* exitbutton = new QPushButton("Cancel", this);
- connect( exitbutton, SIGNAL( released() ), this, SLOT( infoClose() ) );
- grid->addWidget(exitbutton, 5, 1);
+ connect( exitbutton, SIGNAL( clicked() ), this, SLOT( infoClose() ) );
+ grid->addWidget(exitbutton, 9, 1);
}
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,52 +1,39 @@
#ifndef __INFOWIN_H
#define __INFOWIN_H
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qgrid.h>
#include <qlabel.h>
+class QString;
+class QMultiLineEdit;
class infowin : public QWidget
{
Q_OBJECT
QLabel* fileSize;
QLabel* textSize;
QLabel* ratio;
QLabel* location;
QLabel* read;
- QGridLayout* grid;
+ QLabel* docread;
+ QLabel* docSize;
+ QLabel* docLocation;
+ QLabel* zoom;
+ QMultiLineEdit* aboutbox;
public:
infowin::infowin( QWidget *parent=0, const char *name=0, WFlags f = 0);
-/*
- void addcancel(QPushButton* exitbutton)
- {
- grid->addWidget(exitbutton, 5, 1);
- }
-*/
void setFileSize(int sz) { fileSize->setNum(sz); }
void setTextSize(int sz) { textSize->setNum(sz); }
void setRatio(int sz) { ratio->setText(QString().setNum(sz)+"%"); }
void setLocation(int sz) { location->setNum(sz); }
void setRead(int sz) { read->setText(QString().setNum(sz)+"%"); }
-/*
- virtual void keyPressEvent(QKeyEvent* e)
- {
- printf("Received:%d\n", e->key());
- switch (e->key())
- {
- case Key_Escape:
- e->accept();
- emit Close();
- break;
- default:
- e->ignore();
- }
- }
-*/
+ void setDocRead(int sz) { docread->setText(QString().setNum(sz)+"%"); }
+ void setZoom(int sz) { zoom->setText(QString().setNum(sz)+"%"); }
+ void setDocSize(int sz) { docSize->setNum(sz); }
+ void setDocLocation(int sz) { docLocation->setNum(sz); }
+ void setAbout(const QString& s);
private slots:
void infoClose() { emit Close(); }
signals:
void Close();
};
#endif
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 @@
#ifndef __LINKTYPE_H
#define __LINKTYPE_H
-enum linkType
-{
- eNone,
- eLink,
- ePicture
-};
+typedef unsigned int linkType;
+const linkType eNone = 0, eLink = 1, ePicture = 2, eFile = 4;
#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 @@
+/* $Id$ */
+/***************************************************************************
+ * lzx.c - LZX decompression routines *
+ * ------------------- *
+ * *
+ * maintainer: Jed Wing <jedwin@ugcs.caltech.edu> *
+ * source: modified lzx.c from cabextract v0.5 *
+ * notes: This file was taken from cabextract v0.5, which was, *
+ * itself, a modified version of the lzx decompression code *
+ * from unlzx. *
+ * *
+ * platforms: In its current incarnation, this file has been tested on *
+ * two different Linux platforms (one, redhat-based, with a *
+ * 2.1.2 glibc and gcc 2.95.x, and the other, Debian, with *
+ * 2.2.4 glibc and both gcc 2.95.4 and gcc 3.0.2). Both were *
+ * Intel x86 compatible machines. *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. Note that an exemption to this *
+ * license has been granted by Stuart Caie for the purposes of *
+ * distribution with chmlib. This does not, to the best of my *
+ * knowledge, constitute a change in the license of this (the LZX) code *
+ * in general. *
+ * *
+ ***************************************************************************/
+
+#include "lzx.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+
+#ifdef __GNUC__
+#define memcpy __builtin_memcpy
+#endif
+
+/* sized types */
+typedef unsigned char UBYTE; /* 8 bits exactly */
+typedef unsigned short UWORD; /* 16 bits (or more) */
+typedef unsigned int ULONG; /* 32 bits (or more) */
+typedef signed int LONG; /* 32 bits (or more) */
+
+/* some constants defined by the LZX specification */
+#define LZX_MIN_MATCH (2)
+#define LZX_MAX_MATCH (257)
+#define LZX_NUM_CHARS (256)
+#define LZX_BLOCKTYPE_INVALID (0) /* also blocktypes 4-7 invalid */
+#define LZX_BLOCKTYPE_VERBATIM (1)
+#define LZX_BLOCKTYPE_ALIGNED (2)
+#define LZX_BLOCKTYPE_UNCOMPRESSED (3)
+#define LZX_PRETREE_NUM_ELEMENTS (20)
+#define LZX_ALIGNED_NUM_ELEMENTS (8) /* aligned offset tree #elements */
+#define LZX_NUM_PRIMARY_LENGTHS (7) /* this one missing from spec! */
+#define LZX_NUM_SECONDARY_LENGTHS (249) /* length tree #elements */
+
+/* LZX huffman defines: tweak tablebits as desired */
+#define LZX_PRETREE_MAXSYMBOLS (LZX_PRETREE_NUM_ELEMENTS)
+#define LZX_PRETREE_TABLEBITS (6)
+#define LZX_MAINTREE_MAXSYMBOLS (LZX_NUM_CHARS + 50*8)
+#define LZX_MAINTREE_TABLEBITS (12)
+#define LZX_LENGTH_MAXSYMBOLS (LZX_NUM_SECONDARY_LENGTHS+1)
+#define LZX_LENGTH_TABLEBITS (12)
+#define LZX_ALIGNED_MAXSYMBOLS (LZX_ALIGNED_NUM_ELEMENTS)
+#define LZX_ALIGNED_TABLEBITS (7)
+
+#define LZX_LENTABLE_SAFETY (64) /* we allow length table decoding overruns */
+
+#define LZX_DECLARE_TABLE(tbl) \
+ UWORD tbl##_table[(1<<LZX_##tbl##_TABLEBITS) + (LZX_##tbl##_MAXSYMBOLS<<1)];\
+ UBYTE tbl##_len [LZX_##tbl##_MAXSYMBOLS + LZX_LENTABLE_SAFETY]
+
+struct LZXstate
+{
+ UBYTE *window; /* the actual decoding window */
+ ULONG window_size; /* window size (32Kb through 2Mb) */
+ ULONG actual_size; /* window size when it was first allocated */
+ ULONG window_posn; /* current offset within the window */
+ ULONG R0, R1, R2; /* for the LRU offset system */
+ UWORD main_elements; /* number of main tree elements */
+ int header_read; /* have we started decoding at all yet? */
+ UWORD block_type; /* type of this block */
+ ULONG block_length; /* uncompressed length of this block */
+ ULONG block_remaining; /* uncompressed bytes still left to decode */
+ ULONG frames_read; /* the number of CFDATA blocks processed */
+ LONG intel_filesize; /* magic header value used for transform */
+ LONG intel_curpos; /* current offset in transform space */
+ int intel_started; /* have we seen any translatable data yet? */
+
+ LZX_DECLARE_TABLE(PRETREE);
+ LZX_DECLARE_TABLE(MAINTREE);
+ LZX_DECLARE_TABLE(LENGTH);
+ LZX_DECLARE_TABLE(ALIGNED);
+};
+
+/* LZX decruncher */
+
+/* Microsoft's LZX document and their implementation of the
+ * com.ms.util.cab Java package do not concur.
+ *
+ * In the LZX document, there is a table showing the correlation between
+ * window size and the number of position slots. It states that the 1MB
+ * window = 40 slots and the 2MB window = 42 slots. In the implementation,
+ * 1MB = 42 slots, 2MB = 50 slots. The actual calculation is 'find the
+ * first slot whose position base is equal to or more than the required
+ * window size'. This would explain why other tables in the document refer
+ * to 50 slots rather than 42.
+ *
+ * The constant NUM_PRIMARY_LENGTHS used in the decompression pseudocode
+ * is not defined in the specification.
+ *
+ * The LZX document does not state the uncompressed block has an
+ * uncompressed length field. Where does this length field come from, so
+ * we can know how large the block is? The implementation has it as the 24
+ * bits following after the 3 blocktype bits, before the alignment
+ * padding.
+ *
+ * The LZX document states that aligned offset blocks have their aligned
+ * offset huffman tree AFTER the main and length trees. The implementation
+ * suggests that the aligned offset tree is BEFORE the main and length
+ * trees.
+ *
+ * The LZX document decoding algorithm states that, in an aligned offset
+ * block, if an extra_bits value is 1, 2 or 3, then that number of bits
+ * should be read and the result added to the match offset. This is
+ * correct for 1 and 2, but not 3, where just a huffman symbol (using the
+ * aligned tree) should be read.
+ *
+ * Regarding the E8 preprocessing, the LZX document states 'No translation
+ * may be performed on the last 6 bytes of the input block'. This is
+ * correct. However, the pseudocode provided checks for the *E8 leader*
+ * up to the last 6 bytes. If the leader appears between -10 and -7 bytes
+ * from the end, this would cause the next four bytes to be modified, at
+ * least one of which would be in the last 6 bytes, which is not allowed
+ * according to the spec.
+ *
+ * The specification states that the huffman trees must always contain at
+ * least one element. However, many CAB files contain blocks where the
+ * length tree is completely empty (because there are no matches), and
+ * this is expected to succeed.
+ */
+
+
+/* LZX uses what it calls 'position slots' to represent match offsets.
+ * What this means is that a small 'position slot' number and a small
+ * offset from that slot are encoded instead of one large offset for
+ * every match.
+ * - position_base is an index to the position slot bases
+ * - extra_bits states how many bits of offset-from-base data is needed.
+ */
+static const UBYTE extra_bits[51] = {
+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
+ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14,
+ 15, 15, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17
+};
+
+static const ULONG position_base[51] = {
+ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192,
+ 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152,
+ 65536, 98304, 131072, 196608, 262144, 393216, 524288, 655360, 786432, 917504, 1048576, 1179648, 1310720, 1441792, 1572864, 1703936,
+ 1835008, 1966080, 2097152
+};
+
+struct LZXstate *LZXinit(int window)
+{
+ struct LZXstate *pState=NULL;
+ ULONG wndsize = 1 << window;
+ int i, posn_slots;
+
+ /* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */
+ /* if a previously allocated window is big enough, keep it */
+ if (window < 15 || window > 21) return NULL;
+
+ /* allocate state and associated window */
+ pState = (struct LZXstate *)malloc(sizeof(struct LZXstate));
+ if (!(pState->window = (UBYTE *)malloc(wndsize)))
+ {
+ free(pState);
+ return NULL;
+ }
+ pState->actual_size = wndsize;
+ pState->window_size = wndsize;
+
+ /* calculate required position slots */
+ if (window == 20) posn_slots = 42;
+ else if (window == 21) posn_slots = 50;
+ else posn_slots = window << 1;
+
+ /** alternatively **/
+ /* posn_slots=i=0; while (i < wndsize) i += 1 << extra_bits[posn_slots++]; */
+
+ /* initialize other state */
+ pState->R0 = pState->R1 = pState->R2 = 1;
+ pState->main_elements = LZX_NUM_CHARS + (posn_slots << 3);
+ pState->header_read = 0;
+ pState->frames_read = 0;
+ pState->block_remaining = 0;
+ pState->block_type = LZX_BLOCKTYPE_INVALID;
+ pState->intel_curpos = 0;
+ pState->intel_started = 0;
+ pState->window_posn = 0;
+
+ /* initialise tables to 0 (because deltas will be applied to them) */
+ for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) pState->MAINTREE_len[i] = 0;
+ for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) pState->LENGTH_len[i] = 0;
+
+ return pState;
+}
+
+void LZXteardown(struct LZXstate *pState)
+{
+ if (pState)
+ {
+ if (pState->window)
+ free(pState->window);
+ free(pState);
+ }
+}
+
+int LZXreset(struct LZXstate *pState)
+{
+ int i;
+
+ pState->R0 = pState->R1 = pState->R2 = 1;
+ pState->header_read = 0;
+ pState->frames_read = 0;
+ pState->block_remaining = 0;
+ pState->block_type = LZX_BLOCKTYPE_INVALID;
+ pState->intel_curpos = 0;
+ pState->intel_started = 0;
+ pState->window_posn = 0;
+
+ for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS + LZX_LENTABLE_SAFETY; i++) pState->MAINTREE_len[i] = 0;
+ for (i = 0; i < LZX_LENGTH_MAXSYMBOLS + LZX_LENTABLE_SAFETY; i++) pState->LENGTH_len[i] = 0;
+
+ return DECR_OK;
+};
+
+
+/* Bitstream reading macros:
+ *
+ * INIT_BITSTREAM should be used first to set up the system
+ * READ_BITS(var,n) takes N bits from the buffer and puts them in var
+ *
+ * ENSURE_BITS(n) ensures there are at least N bits in the bit buffer
+ * PEEK_BITS(n) extracts (without removing) N bits from the bit buffer
+ * REMOVE_BITS(n) removes N bits from the bit buffer
+ *
+ * These bit access routines work by using the area beyond the MSB and the
+ * LSB as a free source of zeroes. This avoids having to mask any bits.
+ * So we have to know the bit width of the bitbuffer variable. This is
+ * sizeof(ULONG) * 8, also defined as ULONG_BITS
+ */
+
+/* number of bits in ULONG. Note: This must be at multiple of 16, and at
+ * least 32 for the bitbuffer code to work (ie, it must be able to ensure
+ * up to 17 bits - that's adding 16 bits when there's one bit left, or
+ * adding 32 bits when there are no bits left. The code should work fine
+ * for machines where ULONG >= 32 bits.
+ */
+#define ULONG_BITS (sizeof(ULONG)<<3)
+
+#define INIT_BITSTREAM do { bitsleft = 0; bitbuf = 0; } while (0)
+
+#define ENSURE_BITS(n) \
+ while (bitsleft < (n)) { \
+ bitbuf |= ((inpos[1]<<8)|inpos[0]) << (ULONG_BITS-16 - bitsleft); \
+ bitsleft += 16; inpos+=2; \
+ }
+
+#define PEEK_BITS(n) (bitbuf >> (ULONG_BITS - (n)))
+#define REMOVE_BITS(n) ((bitbuf <<= (n)), (bitsleft -= (n)))
+
+#define READ_BITS(v,n) do { \
+ ENSURE_BITS(n); \
+ (v) = PEEK_BITS(n); \
+ REMOVE_BITS(n); \
+} while (0)
+
+
+/* Huffman macros */
+
+#define TABLEBITS(tbl) (LZX_##tbl##_TABLEBITS)
+#define MAXSYMBOLS(tbl) (LZX_##tbl##_MAXSYMBOLS)
+#define SYMTABLE(tbl) (pState->tbl##_table)
+#define LENTABLE(tbl) (pState->tbl##_len)
+
+/* BUILD_TABLE(tablename) builds a huffman lookup table from code lengths.
+ * In reality, it just calls make_decode_table() with the appropriate
+ * values - they're all fixed by some #defines anyway, so there's no point
+ * writing each call out in full by hand.
+ */
+#define BUILD_TABLE(tbl) \
+ if (make_decode_table( \
+ MAXSYMBOLS(tbl), TABLEBITS(tbl), LENTABLE(tbl), SYMTABLE(tbl) \
+ )) { return DECR_ILLEGALDATA; }
+
+
+/* READ_HUFFSYM(tablename, var) decodes one huffman symbol from the
+ * bitstream using the stated table and puts it in var.
+ */
+#define READ_HUFFSYM(tbl,var) do { \
+ ENSURE_BITS(16); \
+ hufftbl = SYMTABLE(tbl); \
+ if ((i = hufftbl[PEEK_BITS(TABLEBITS(tbl))]) >= MAXSYMBOLS(tbl)) { \
+ j = 1 << (ULONG_BITS - TABLEBITS(tbl)); \
+ do { \
+ j >>= 1; i <<= 1; i |= (bitbuf & j) ? 1 : 0; \
+ if (!j) { return DECR_ILLEGALDATA; } \
+ } while ((i = hufftbl[i]) >= MAXSYMBOLS(tbl)); \
+ } \
+ j = LENTABLE(tbl)[(var) = i]; \
+ REMOVE_BITS(j); \
+} while (0)
+
+
+/* READ_LENGTHS(tablename, first, last) reads in code lengths for symbols
+ * first to last in the given table. The code lengths are stored in their
+ * own special LZX way.
+ */
+#define READ_LENGTHS(tbl,first,last) do { \
+ lb.bb = bitbuf; lb.bl = bitsleft; lb.ip = inpos; \
+ if (lzx_read_lens(pState, LENTABLE(tbl),(first),(last),&lb)) { \
+ return DECR_ILLEGALDATA; \
+ } \
+ bitbuf = lb.bb; bitsleft = lb.bl; inpos = lb.ip; \
+} while (0)
+
+
+/* make_decode_table(nsyms, nbits, length[], table[])
+ *
+ * This function was coded by David Tritscher. It builds a fast huffman
+ * decoding table out of just a canonical huffman code lengths table.
+ *
+ * nsyms = total number of symbols in this huffman tree.
+ * nbits = any symbols with a code length of nbits or less can be decoded
+ * in one lookup of the table.
+ * length = A table to get code lengths from [0 to syms-1]
+ * table = The table to fill up with decoded symbols and pointers.
+ *
+ * Returns 0 for OK or 1 for error
+ */
+
+static int make_decode_table(ULONG nsyms, ULONG nbits, UBYTE *length, UWORD *table) {
+ register UWORD sym;
+ register ULONG leaf;
+ register UBYTE bit_num = 1;
+ ULONG fill;
+ ULONG pos = 0; /* the current position in the decode table */
+ ULONG table_mask = 1 << nbits;
+ ULONG bit_mask = table_mask >> 1; /* don't do 0 length codes */
+ ULONG next_symbol = bit_mask; /* base of allocation for long codes */
+
+ /* fill entries for codes short enough for a direct mapping */
+ while (bit_num <= nbits) {
+ for (sym = 0; sym < nsyms; sym++) {
+ if (length[sym] == bit_num) {
+ leaf = pos;
+
+ if((pos += bit_mask) > table_mask) return 1; /* table overrun */
+
+ /* fill all possible lookups of this symbol with the symbol itself */
+ fill = bit_mask;
+ while (fill-- > 0) table[leaf++] = sym;
+ }
+ }
+ bit_mask >>= 1;
+ bit_num++;
+ }
+
+ /* if there are any codes longer than nbits */
+ if (pos != table_mask) {
+ /* clear the remainder of the table */
+ for (sym = pos; sym < table_mask; sym++) table[sym] = 0;
+
+ /* give ourselves room for codes to grow by up to 16 more bits */
+ pos <<= 16;
+ table_mask <<= 16;
+ bit_mask = 1 << 15;
+
+ while (bit_num <= 16) {
+ for (sym = 0; sym < nsyms; sym++) {
+ if (length[sym] == bit_num) {
+ leaf = pos >> 16;
+ for (fill = 0; fill < bit_num - nbits; fill++) {
+ /* if this path hasn't been taken yet, 'allocate' two entries */
+ if (table[leaf] == 0) {
+ table[(next_symbol << 1)] = 0;
+ table[(next_symbol << 1) + 1] = 0;
+ table[leaf] = next_symbol++;
+ }
+ /* follow the path and select either left or right for next bit */
+ leaf = table[leaf] << 1;
+ if ((pos >> (15-fill)) & 1) leaf++;
+ }
+ table[leaf] = sym;
+
+ if ((pos += bit_mask) > table_mask) return 1; /* table overflow */
+ }
+ }
+ bit_mask >>= 1;
+ bit_num++;
+ }
+ }
+
+ /* full table? */
+ if (pos == table_mask) return 0;
+
+ /* either erroneous table, or all elements are 0 - let's find out. */
+ for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1;
+ return 0;
+}
+
+struct lzx_bits {
+ ULONG bb;
+ int bl;
+ UBYTE *ip;
+};
+
+static int lzx_read_lens(struct LZXstate *pState, UBYTE *lens, ULONG first, ULONG last, struct lzx_bits *lb) {
+ ULONG i,j, x,y;
+ int z;
+
+ register ULONG bitbuf = lb->bb;
+ register int bitsleft = lb->bl;
+ UBYTE *inpos = lb->ip;
+ UWORD *hufftbl;
+
+ for (x = 0; x < 20; x++) {
+ READ_BITS(y, 4);
+ LENTABLE(PRETREE)[x] = y;
+ }
+ BUILD_TABLE(PRETREE);
+
+ for (x = first; x < last; ) {
+ READ_HUFFSYM(PRETREE, z);
+ if (z == 17) {
+ READ_BITS(y, 4); y += 4;
+ while (y--) lens[x++] = 0;
+ }
+ else if (z == 18) {
+ READ_BITS(y, 5); y += 20;
+ while (y--) lens[x++] = 0;
+ }
+ else if (z == 19) {
+ READ_BITS(y, 1); y += 4;
+ READ_HUFFSYM(PRETREE, z);
+ z = lens[x] - z; if (z < 0) z += 17;
+ while (y--) lens[x++] = z;
+ }
+ else {
+ z = lens[x] - z; if (z < 0) z += 17;
+ lens[x++] = z;
+ }
+ }
+
+ lb->bb = bitbuf;
+ lb->bl = bitsleft;
+ lb->ip = inpos;
+ return 0;
+}
+
+int LZXdecompress(struct LZXstate *pState, unsigned char *inpos, unsigned char *outpos, int inlen, int outlen) {
+ UBYTE *endinp = inpos + inlen;
+ UBYTE *window = pState->window;
+ UBYTE *runsrc, *rundest;
+ UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */
+
+ ULONG window_posn = pState->window_posn;
+ ULONG window_size = pState->window_size;
+ ULONG R0 = pState->R0;
+ ULONG R1 = pState->R1;
+ ULONG R2 = pState->R2;
+
+ register ULONG bitbuf;
+ register int bitsleft;
+ ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */
+ struct lzx_bits lb; /* used in READ_LENGTHS macro */
+
+ int togo = outlen, this_run, main_element, aligned_bits;
+ int match_length, length_footer, extra, verbatim_bits;
+
+ INIT_BITSTREAM;
+
+ /* read header if necessary */
+ if (!pState->header_read) {
+ i = j = 0;
+ READ_BITS(k, 1); if (k) { READ_BITS(i,16); READ_BITS(j,16); }
+ pState->intel_filesize = (i << 16) | j; /* or 0 if not encoded */
+ pState->header_read = 1;
+ }
+
+ /* main decoding loop */
+ while (togo > 0) {
+ /* last block finished, new block expected */
+ if (pState->block_remaining == 0) {
+ if (pState->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) {
+ if (pState->block_length & 1) inpos++; /* realign bitstream to word */
+ INIT_BITSTREAM;
+ }
+
+ READ_BITS(pState->block_type, 3);
+ READ_BITS(i, 16);
+ READ_BITS(j, 8);
+ pState->block_remaining = pState->block_length = (i << 8) | j;
+
+ switch (pState->block_type) {
+ case LZX_BLOCKTYPE_ALIGNED:
+ for (i = 0; i < 8; i++) { READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j; }
+ BUILD_TABLE(ALIGNED);
+ /* rest of aligned header is same as verbatim */
+
+ case LZX_BLOCKTYPE_VERBATIM:
+ READ_LENGTHS(MAINTREE, 0, 256);
+ READ_LENGTHS(MAINTREE, 256, pState->main_elements);
+ BUILD_TABLE(MAINTREE);
+ if (LENTABLE(MAINTREE)[0xE8] != 0) pState->intel_started = 1;
+
+ READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS);
+ BUILD_TABLE(LENGTH);
+ break;
+
+ case LZX_BLOCKTYPE_UNCOMPRESSED:
+ pState->intel_started = 1; /* because we can't assume otherwise */
+ ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */
+ if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */
+ R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
+ R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
+ R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
+ break;
+
+ default:
+ return DECR_ILLEGALDATA;
+ }
+ }
+
+ /* buffer exhaustion check */
+ if (inpos > endinp) {
+ /* it's possible to have a file where the next run is less than
+ * 16 bits in size. In this case, the READ_HUFFSYM() macro used
+ * in building the tables will exhaust the buffer, so we should
+ * allow for this, but not allow those accidentally read bits to
+ * be used (so we check that there are at least 16 bits
+ * remaining - in this boundary case they aren't really part of
+ * the compressed data)
+ */
+ if (inpos > (endinp+2) || bitsleft < 16) return DECR_ILLEGALDATA;
+ }
+
+ while ((this_run = pState->block_remaining) > 0 && togo > 0) {
+ if (this_run > togo) this_run = togo;
+ togo -= this_run;
+ pState->block_remaining -= this_run;
+
+ /* apply 2^x-1 mask */
+ window_posn &= window_size - 1;
+ /* runs can't straddle the window wraparound */
+ if ((window_posn + this_run) > window_size)
+ return DECR_DATAFORMAT;
+
+ switch (pState->block_type) {
+
+ case LZX_BLOCKTYPE_VERBATIM:
+ while (this_run > 0) {
+ READ_HUFFSYM(MAINTREE, main_element);
+
+ if (main_element < LZX_NUM_CHARS) {
+ /* literal: 0 to LZX_NUM_CHARS-1 */
+ window[window_posn++] = main_element;
+ this_run--;
+ }
+ else {
+ /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
+ main_element -= LZX_NUM_CHARS;
+
+ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
+ if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
+ READ_HUFFSYM(LENGTH, length_footer);
+ match_length += length_footer;
+ }
+ match_length += LZX_MIN_MATCH;
+
+ match_offset = main_element >> 3;
+
+ if (match_offset > 2) {
+ /* not repeated offset */
+ if (match_offset != 3) {
+ extra = extra_bits[match_offset];
+ READ_BITS(verbatim_bits, extra);
+ match_offset = position_base[match_offset] - 2 + verbatim_bits;
+ }
+ else {
+ match_offset = 1;
+ }
+
+ /* update repeated offset LRU queue */
+ R2 = R1; R1 = R0; R0 = match_offset;
+ }
+ else if (match_offset == 0) {
+ match_offset = R0;
+ }
+ else if (match_offset == 1) {
+ match_offset = R1;
+ R1 = R0; R0 = match_offset;
+ }
+ else /* match_offset == 2 */ {
+ match_offset = R2;
+ R2 = R0; R0 = match_offset;
+ }
+
+ rundest = window + window_posn;
+ runsrc = rundest - match_offset;
+ window_posn += match_length;
+ this_run -= match_length;
+
+ /* copy any wrapped around source data */
+ while ((runsrc < window) && (match_length-- > 0)) {
+ *rundest++ = *(runsrc + window_size); runsrc++;
+ }
+ /* copy match data - no worries about destination wraps */
+ while (match_length-- > 0) *rundest++ = *runsrc++;
+
+ }
+ }
+ break;
+
+ case LZX_BLOCKTYPE_ALIGNED:
+ while (this_run > 0) {
+ READ_HUFFSYM(MAINTREE, main_element);
+
+ if (main_element < LZX_NUM_CHARS) {
+ /* literal: 0 to LZX_NUM_CHARS-1 */
+ window[window_posn++] = main_element;
+ this_run--;
+ }
+ else {
+ /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
+ main_element -= LZX_NUM_CHARS;
+
+ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
+ if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
+ READ_HUFFSYM(LENGTH, length_footer);
+ match_length += length_footer;
+ }
+ match_length += LZX_MIN_MATCH;
+
+ match_offset = main_element >> 3;
+
+ if (match_offset > 2) {
+ /* not repeated offset */
+ extra = extra_bits[match_offset];
+ match_offset = position_base[match_offset] - 2;
+ if (extra > 3) {
+ /* verbatim and aligned bits */
+ extra -= 3;
+ READ_BITS(verbatim_bits, extra);
+ match_offset += (verbatim_bits << 3);
+ READ_HUFFSYM(ALIGNED, aligned_bits);
+ match_offset += aligned_bits;
+ }
+ else if (extra == 3) {
+ /* aligned bits only */
+ READ_HUFFSYM(ALIGNED, aligned_bits);
+ match_offset += aligned_bits;
+ }
+ else if (extra > 0) { /* extra==1, extra==2 */
+ /* verbatim bits only */
+ READ_BITS(verbatim_bits, extra);
+ match_offset += verbatim_bits;
+ }
+ else /* extra == 0 */ {
+ /* ??? */
+ match_offset = 1;
+ }
+
+ /* update repeated offset LRU queue */
+ R2 = R1; R1 = R0; R0 = match_offset;
+ }
+ else if (match_offset == 0) {
+ match_offset = R0;
+ }
+ else if (match_offset == 1) {
+ match_offset = R1;
+ R1 = R0; R0 = match_offset;
+ }
+ else /* match_offset == 2 */ {
+ match_offset = R2;
+ R2 = R0; R0 = match_offset;
+ }
+
+ rundest = window + window_posn;
+ runsrc = rundest - match_offset;
+ window_posn += match_length;
+ this_run -= match_length;
+
+ /* copy any wrapped around source data */
+ while ((runsrc < window) && (match_length-- > 0)) {
+ *rundest++ = *(runsrc + window_size); runsrc++;
+ }
+ /* copy match data - no worries about destination wraps */
+ while (match_length-- > 0) *rundest++ = *runsrc++;
+
+ }
+ }
+ break;
+
+ case LZX_BLOCKTYPE_UNCOMPRESSED:
+ if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA;
+ memcpy(window + window_posn, inpos, (size_t) this_run);
+ inpos += this_run; window_posn += this_run;
+ break;
+
+ default:
+ return DECR_ILLEGALDATA; /* might as well */
+ }
+
+ }
+ }
+
+ if (togo != 0) return DECR_ILLEGALDATA;
+ memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) - outlen, (size_t) outlen);
+
+ pState->window_posn = window_posn;
+ pState->R0 = R0;
+ pState->R1 = R1;
+ pState->R2 = R2;
+
+ /* intel E8 decoding */
+ if ((pState->frames_read++ < 32768) && pState->intel_filesize != 0) {
+ if (outlen <= 6 || !pState->intel_started) {
+ pState->intel_curpos += outlen;
+ }
+ else {
+ UBYTE *data = outpos;
+ UBYTE *dataend = data + outlen - 10;
+ LONG curpos = pState->intel_curpos;
+ LONG filesize = pState->intel_filesize;
+ LONG abs_off, rel_off;
+
+ pState->intel_curpos = curpos + outlen;
+
+ while (data < dataend) {
+ if (*data++ != 0xE8) { curpos++; continue; }
+ abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
+ if ((abs_off >= -curpos) && (abs_off < filesize)) {
+ rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize;
+ data[0] = (UBYTE) rel_off;
+ data[1] = (UBYTE) (rel_off >> 8);
+ data[2] = (UBYTE) (rel_off >> 16);
+ data[3] = (UBYTE) (rel_off >> 24);
+ }
+ data += 4;
+ curpos += 5;
+ }
+ }
+ }
+ return DECR_OK;
+}
+
+#ifdef LZX_CHM_TESTDRIVER
+int main(int c, char **v)
+{
+ FILE *fin, *fout;
+ struct LZXstate state;
+ UBYTE ibuf[16384];
+ UBYTE obuf[32768];
+ int ilen, olen;
+ int status;
+ int i;
+ int count=0;
+ int w = atoi(v[1]);
+ LZXinit(&state, w);
+ fout = fopen(v[2], "wb");
+ for (i=3; i<c; i++)
+ {
+ fin = fopen(v[i], "rb");
+ ilen = fread(ibuf, 1, 16384, fin);
+ status = LZXdecompress(&state, ibuf, obuf, ilen, 32768);
+ switch (status)
+ {
+ case DECR_OK:
+ printf("ok\n");
+ fwrite(obuf, 1, 32768, fout);
+ break;
+ case DECR_DATAFORMAT:
+ printf("bad format\n");
+ break;
+ case DECR_ILLEGALDATA:
+ printf("illegal data\n");
+ break;
+ case DECR_NOMEMORY:
+ printf("no memory\n");
+ break;
+ default:
+ break;
+ }
+ fclose(fin);
+ if (++count == 2)
+ {
+ count = 0;
+ LZXreset(&state);
+ }
+ }
+ fclose(fout);
+}
+#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 @@
+/* $Id$ */
+/***************************************************************************
+ * lzx.h - LZX decompression routines *
+ * ------------------- *
+ * *
+ * maintainer: Jed Wing <jedwin@ugcs.caltech.edu> *
+ * source: modified lzx.c from cabextract v0.5 *
+ * notes: This file was taken from cabextract v0.5, which was, *
+ * itself, a modified version of the lzx decompression code *
+ * from unlzx. *
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. Note that an exemption to this *
+ * license has been granted by Stuart Caie for the purposes of *
+ * distribution with chmlib. This does not, to the best of my *
+ * knowledge, constitute a change in the license of this (the LZX) code *
+ * in general. *
+ * *
+ ***************************************************************************/
+
+#ifndef INCLUDED_LZX_H
+#define INCLUDED_LZX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* return codes */
+#define DECR_OK (0)
+#define DECR_DATAFORMAT (1)
+#define DECR_ILLEGALDATA (2)
+#define DECR_NOMEMORY (3)
+
+/* opaque state structure */
+struct LZXstate;
+
+/* create an lzx state object */
+struct LZXstate *LZXinit(int window);
+
+/* destroy an lzx state object */
+void LZXteardown(struct LZXstate *pState);
+
+/* reset an lzx stream */
+int LZXreset(struct LZXstate *pState);
+
+/* decompress an LZX compressed block */
+int LZXdecompress(struct LZXstate *pState,
+ unsigned char *inpos,
+ unsigned char *outpos,
+ int inlen,
+ int outlen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#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
@@ -1,48 +1,50 @@
#include "useqpe.h"
#ifdef USEQPE
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#include "QTReaderApp.h"
#include "signal.h"
+#include "stdio.h"
+#include "time.h"
#ifdef USEQPE
QTReaderApp* app = NULL;
void handler(int signum)
{
if (app != NULL)
{
app->suspend();
app->saveprefs();
}
signal(signum, handler);
}
#endif
int main( int argc, char ** argv )
{
#ifdef USEQPE
signal(SIGCONT, handler);
QPEApplication a( argc, argv );
QTReaderApp m;
a.showMainDocumentWidget( &m );
app = &m;
#else
QApplication a( argc, argv );
QTReaderApp m;
a.setMainWidget( &m );
if (argc > 1)
{
m.setDocument(argv[1]);
}
#endif
return a.exec();
}
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,183 +1,195 @@
#ifndef __MY_LIST_H
#define __MY_LIST_H
+#ifndef NULL
+#define NULL 0
+#endif
+
template<class T>
class CList
{
struct node
{
T data;
node* next;
node(T _data, node* _next = NULL) : data(_data), next(_next) {}
node() : next(NULL) {};
};
protected:
node* front;
node* back;
public:
CList() : front(NULL), back(NULL) {}
~CList()
{
if (front != NULL)
{
while (front != NULL)
{
node *p = front;
front = p->next;
delete p;
}
}
}
T& first() { return front->data; }
T& last() { return back->data; }
+ T pop()
+ {
+ T data = front->data;
+ node* n = front;
+ front = front->next;
+ delete n;
+ return data;
+ }
T* operator[](int n)
{
node* current = front;
while (n-- > 0)
{
if ((current = current->next) == NULL)
return NULL;
}
return &(current->data);
}
void push_front(const T& t)
{
node* n = new node(t,front);
if (front == NULL)
{
front = back = n;
}
else
front = n;
}
void push_back(const T& t)
{
node* n = new node(t);
if (front == NULL)
{
front = back = n;
}
else
{
back->next = n;
back = n;
}
}
bool isEmpty() { return (front == NULL); }
void erase(unsigned int n)
{
node* p = front;
node* last = front;
while (n-- > 0)
{
last = p;
p = p->next;
if (p == NULL) return;
}
if (p == front)
{
front = p->next;
}
else
{
last->next = p->next;
}
if (p == back)
{
back = last;
}
delete p;
}
void sort()
{
int i,j,inc,n;
T v;
T* item;
node* t;
t = front;
n = 0;
while (t != NULL)
{
n++;
t = t->next;
}
if (n >= 2)
{
item = new T[n];
i = 0;
t = front;
for (t = front, i = 0; t != NULL; t = t->next, i++)
{
item[i] = t->data;
}
for (inc = 1; inc <= n; inc = 3*inc+1);
do
{
inc /= 3;
for (i = inc; i < n; i++)
{
v = item[i];
for (j = i; v < item[j-inc] && j >= inc; j -= inc)
{
item[j] = item[j-inc];
}
item[j] = v;
}
}
while (inc > 1);
for (t = front, i = 0; t != NULL; t = t->next, i++)
{
t->data = item[i];
}
// back = *(item[n-1]);
delete [] item;
}
}
class iterator
{
node* current;
public:
iterator(node* _c) : current(_c) {}
iterator& operator++()
{
current = current->next;
return *this;
}
iterator& operator++(int)
{
current = current->next;
return *this;
}
T operator*()
{
return current->data;
}
T* operator->()
{
return &(current->data);
}
T* pContent()
{
return &(current->data);
}
bool operator!=(iterator t)
{
return (current != t.current);
}
bool operator==(iterator t)
{
return (current == t.current);
}
};
iterator begin()
{
return iterator(front);
}
iterator end()
{
return iterator(NULL);
}
};
#endif
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 @@
-#ifndef __NAME_H
-#define __NAME_H
-
-#define PROGNAME "Opie-Reader"
-#define SHORTPROGNAME "Reader"
-#define APPDIR "uqtreader"
-
-#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,10 +1,10 @@
Package: opie-reader
-Files: bin/reader bin/reader apps/Applications/opie-reader.desktop pics/opie-reader/*
+Files: bin/reader lib/libreader* plugins/reader/* apps/Applications/opie-reader.desktop pics/opie-reader/*
Priority: optional
Section: opie/applications
Maintainer: Tim Wentford <timwentford@hotmail.com>
Architecture: arm
Depends: task-opie-minimal
License: GPL
Description: E-Book reader
Version: $QPE_VERSION$EXTRAVERSION
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 @@
-CONFIG = qt warn_on
-HEADERS = Aportis.h \
- Bkmks.h \
- BuffDoc.h \
- CAnnoEdit.h \
- CBuffer.h \
- CDrawBuffer.h \
- CEncoding.h \
- CEncoding_tables.h \
- CExpander.h \
- CFilter.h \
- CloseDialog.h \
- Filedata.h \
- FixedFont.h \
- FontControl.h \
- GraphicWin.h \
- Markups.h \
- Navigation.h \
- Palm2QImage.h \
- Prefs.h \
- QFloatBar.h \
- QTReader.h \
- QTReaderApp.h \
- QtrListView.h \
- Queue.h \
- StateData.h \
- StyleConsts.h \
- ToolbarPrefs.h \
- URLDialog.h \
- ZText.h \
- arith.h \
- cbkmkselector.h \
- config.h \
- fileBrowser.h \
- infowin.h \
- linktype.h \
- my_list.h \
- names.h \
- opie.h \
- pdb.h \
- plucker_base.h \
- plucker.h \
- ppm.h \
- ppm_expander.h \
- usenef.h \
- useqpe.h \
- ustring.h \
- utypes.h \
- version.h \
- ztxt.h
-
-SOURCES = Aportis.cpp \
- Bkmks.cpp \
- BuffDoc.cpp \
- CBuffer.cpp \
- CDrawBuffer.cpp \
- CEncoding.cpp \
- CEncoding_tables.cpp \
- CFilter.cpp \
- CloseDialog.cpp \
- FontControl.cpp \
- Navigation.cpp \
- Palm2QImage.cpp \
- Prefs.cpp \
- QTReader.cpp \
- QTReaderApp.cpp \
- QtrListView.cpp \
- StyleConsts.cpp \
- ToolbarPrefs.cpp \
- URLDialog.cpp \
- arith_d.cpp \
- fileBrowser.cpp \
- infowin.cpp \
- main.cpp \
- pdb.cpp \
- plucker.cpp \
- plucker_base.cpp \
- ppm.cpp \
- ppm_expander.cpp \
- version.cpp \
- ztxt.cpp
-
-DESTDIR = $(OPIEDIR)/bin
-TARGET = opie-reader
-
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopiecore2
+TEMPLATE = subdirs
+SUBDIRS = pluckerbaselib \
+ codeclib \
+ PluckerCodec \
+ AportisCodec \
+ CHM \
+ HTMLFilter \
+ WeaselCodec \
+ iSiloCodec \
+ pdblib \
+ ppmsCodec \
+ reader
include ( $(OPIEDIR)/include.pro )
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 @@
-#ifndef __OPIE_H
-#define __OPIE_H
-
-#define OPIE
-
-#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 @@
+#include <qstring.h>
+#include <qnamespace.h>
+#include "orkey.h"
+
+QString orKey::text() const
+{
+ QString ks;
+ if ((m_st & Qt::ControlButton) != 0)
+ {
+ ks += "ctrl_";
+ }
+ if ((m_st & Qt::AltButton) != 0)
+ {
+ ks += "alt_";
+ }
+ if ((m_st & Qt::ShiftButton) != 0)
+ {
+ ks += "shift_";
+ }
+ /*
+ if (m_st & meta_flag != 0)
+ {
+ ks += "meta_";
+ }
+ if (m_st & capslock_flag != 0)
+ {
+ ks += "capslock_";
+ }
+ if (m_st & scrolllock_flag != 0)
+ {
+ ks += "scrolllock_";
+ }
+ */
+ if (m_ky == 0x20)
+ {
+ ks += "' '";
+ }
+ else if (0x21 <= m_ky && m_ky <= 0xff)
+ {
+ char st[2];
+ st[0] = m_ky;
+ st[1] = 0;
+ ks += st;
+ }
+ else if (0x1030 <= m_ky && m_ky <= 0x1052)
+ {
+ ks += QString("f") + QChar(m_ky - 0x1030 + 1);
+ }
+ else
+ {
+ switch (m_ky)
+ {
+ case Qt::Key_Escape:
+ ks += "esc";
+ break;
+ case Qt::Key_Tab:
+ ks += "Tab";
+ break;
+ case Qt::Key_Backtab:
+ ks += "Backtab";
+ break;
+ case Qt::Key_Backspace:
+ ks += "Backspace";
+ break;
+ case Qt::Key_Return:
+ ks += "Return";
+ break;
+ case Qt::Key_Enter:
+ ks += "Enter";
+ break;
+ case Qt::Key_Insert:
+ ks += "Insert";
+ break;
+ case Qt::Key_Delete:
+ ks += "Delete";
+ break;
+ case Qt::Key_Pause:
+ ks += "Pause";
+ break;
+ case Qt::Key_Print:
+ ks += "Print";
+ break;
+ case Qt::Key_SysReq:
+ ks += "SysReq";
+ break;
+ case Qt::Key_Home:
+ ks += "Home";
+ break;
+ case Qt::Key_End:
+ ks += "End";
+ break;
+ case Qt::Key_Left:
+ ks += "Left";
+ break;
+ case Qt::Key_Up:
+ ks += "Up";
+ break;
+ case Qt::Key_Right:
+ ks += "Right";
+ break;
+ case Qt::Key_Down:
+ ks += "Down";
+ break;
+ case Qt::Key_PageUp:
+ ks += "PageUp";
+ break;
+ case Qt::Key_PageDown:
+ ks += "PageDown";
+ break;
+ case Qt::Key_Super_L:
+ ks += "Super_L";
+ break;
+ case Qt::Key_Super_R:
+ ks += "Super_R";
+ break;
+ case Qt::Key_Menu:
+ ks += "Menu";
+ break;
+ case Qt::Key_Hyper_L:
+ ks += "Hyper_L";
+ break;
+ case Qt::Key_Hyper_R:
+ ks += "Hyper_R";
+ break;
+ case Qt::Key_Help:
+ ks += "Help";
+ break;
+ default:
+ ks += "???";
+ break;
+ }
+ }
+ return ks;
+}
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 @@
+#ifndef __ORKEY_H
+#define __ORKEY_H
+
+const uint KEYMAPVERSION = 0;
+
+enum ActionTypes
+{
+ cesOpenFile = 0,
+ cesAutoScroll,
+ cesActionMark,
+ cesActionAnno,
+ cesFullScreen,
+ cesZoomIn,
+ cesZoomOut,
+ cesBack,
+ cesForward,
+ cesHome,
+ cesPageUp,
+ cesPageDown,
+ cesLineUp,
+ cesLineDown,
+ cesStartDoc,
+ cesEndDoc,
+ cesRotate,
+ cesScrollMore,
+ cesScrollLess,
+ cesInvertColours,
+ cesToggleBars,
+ cesToggleScrollBar,
+ cesToggleStatusBar,
+ cesNextLink,
+ cesGotoLink
+};
+
+class orKey
+{
+ friend bool operator<(const orKey& lhs, const orKey& rhs);
+ Qt::ButtonState m_st;
+ int m_ky;
+ bool m_scroll;
+ public:
+ orKey(Qt::ButtonState _s = Qt::NoButton, int _k = 0, bool _sc = false) : m_st(_s), m_ky(_k), m_scroll(_sc) {}
+ QString text() const;
+ bool isScroll() const { return m_scroll; }
+ void toggleScroll() { m_scroll = !m_scroll; }
+};
+
+inline bool operator<(const orKey& lhs, const orKey& rhs)
+{
+ if (lhs.m_ky < rhs.m_ky)
+ {
+ return true;
+ }
+ if (lhs.m_ky > rhs.m_ky)
+ {
+ return false;
+ }
+ if (lhs.m_st < rhs.m_st)
+ {
+ return true;
+ }
+ if (lhs.m_st > rhs.m_st)
+ {
+ return false;
+ }
+ return (lhs.m_scroll < rhs.m_scroll);
+}
+#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
@@ -1,60 +1,90 @@
#include "pdb.h"
#ifdef _WINDOWS
#include <winsock2.h>
#endif
+#include "useqpe.h"
+
+#ifdef USEQPE
+void Cpdb::suspend()
+{
+ CExpander::suspend(fin);
+}
+void Cpdb::unsuspend()
+{
+ CExpander::unsuspend(fin);
+}
+#endif
+
+Cpdb::~Cpdb()
+{
+ if (fin != NULL)
+ {
+#ifdef USEQPE
+ unsuspend();
+#endif
+ fclose(fin);
+ }
+}
+
size_t Cpdb::recordpos(int n)
{
UInt16 mxn = ntohs(head.recordList.numRecords);
if (n >= mxn)
{
return file_length;
}
else
{
size_t dataoffset = sizeof(DatabaseHdrType) - sizeof(UInt16);
dataoffset += /*dataoffset%4 + */ sizeof(RecordListType) * n;
fseek(fin, dataoffset, SEEK_SET);
RecordListType hdr;
fread(&hdr, 1, sizeof(hdr), fin);
return ntohl(hdr.nextRecordListID);
}
}
size_t Cpdb::recordlength(int n)
{
return recordpos(n+1)-recordpos(n);
}
void Cpdb::gotorecordnumber(int n)
{
fseek(fin, recordpos(n), SEEK_SET);
}
-bool Cpdb::openfile(const char *src)
+bool Cpdb::openpdbfile(const char *src)
{
+ //qDebug("cpdb openfile:%s", src);
// printf("In openfile\n");
- int ret = 0;
// printf("closing fin:%x\n",fin);
if (fin != NULL) fclose(fin);
// printf("opening fin\n");
fin = fopen(src,"rb");
if (fin==0)
{
return false;
}
// just holds the first few chars of the file
// char buf[0x100];
- fseek(fin,0,SEEK_END);
- file_length = ftell(fin);
+ struct stat _stat;
+ stat(src,&_stat);
+ file_length = _stat.st_size;
+ // fseek(fin,0,SEEK_END);
+ // file_length = ftell(fin);
fseek(fin,0,SEEK_SET);
fread(&head, 1, sizeof(head), fin);
+ qDebug("Database name:%s", head.name);
+ qDebug("Total number of records:%u", ntohs(head.recordList.numRecords));
+
return true;
}
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
@@ -1,93 +1,101 @@
/*
* This header file defines some structures and types normally found in the
* Palm SDK. However, I don't want to require the presense of the SDK for a
* small utility since most Palm owners won't have it.
*
* $Id$
*
*/
#ifndef __PDB_H__
#define __PDB_H__
#ifndef _WINDOWS
#include <netinet/in.h>
#endif
#include <stdio.h>
+#include "useqpe.h"
+#include "CExpander.h"
/* Normal Palm typedefs */
typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef signed short Int16;
typedef unsigned long UInt32;
typedef UInt32 LocalID;
/* Max length of DB name */
#define dmDBNameLength 0x20
/************************************************************
* Structure of a Record entry
*************************************************************/
typedef struct {
LocalID localChunkID; // local chunkID of a record
UInt8 attributes; // record attributes;
UInt8 uniqueID[3]; // unique ID of record; should
// not be 0 for a legal record.
} RecordEntryType;
/************************************************************
* Structure of a record list extension. This is used if all
* the database record/resource entries of a database can't fit into
* the database header.
*************************************************************/
typedef struct {
LocalID nextRecordListID; // local chunkID of next list
UInt16 numRecords; // number of records in this list
UInt16 firstEntry; // array of Record/Rsrc entries
// starts here
} RecordListType;
/************************************************************
* Structure of a Database Header
*************************************************************/
typedef struct {
UInt8 name[dmDBNameLength]; // name of database
UInt16 attributes; // database attributes
UInt16 version; // version of database
UInt32 creationDate; // creation date of database
UInt32 modificationDate; // latest modification date
UInt32 lastBackupDate; // latest backup date
UInt32 modificationNumber; // modification number of database
LocalID appInfoID; // application specific info
LocalID sortInfoID; // app specific sorting info
UInt32 type; // database type
UInt32 creator; // database creator
UInt32 uniqueIDSeed; // used to generate unique IDs.
// Note that only the low order
// 3 bytes of this is used (in
// RecordEntryType.uniqueID).
// We are keeping 4 bytes for
// alignment purposes.
RecordListType recordList; // first record list
} DatabaseHdrType;
-class Cpdb
+class Cpdb : public CExpander
{
protected:
size_t file_length;
FILE* fin;
size_t recordpos(int);
size_t recordlength(int);
void gotorecordnumber(int);
DatabaseHdrType head;
- bool openfile(const char* src);
+ bool openpdbfile(const char* src);
Cpdb() : fin(NULL) {}
- ~Cpdb() { if (fin != NULL) fclose(fin); }
+ ~Cpdb();
+#ifdef USEQPE
+ void suspend();
+ void unsuspend();
+#endif
+ public:
+ virtual void sizes(unsigned long& _file, unsigned long& _text) = 0;
};
#endif
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 @@
+#############################################################################
+# Makefile for building: libreader_pdb.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:39:56 2004
+# Project: pdblib.pro
+# Template: lib
+# Command: $(QMAKE) -o pdblib.mak pdblib.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libreader_pdb.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = pdb.cpp
+OBJECTS = QREADEROBJS/pdb.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = pdblib.pro
+QMAKE_TARGET = reader_pdb
+DESTDIR = $(READERDIR)/lib/
+TARGET = libreader_pdb.so.1.0.0
+TARGETA = $(READERDIR)/lib/libreader_pdb.a
+TARGETD = libreader_pdb.so.1.0.0
+TARGET0 = libreader_pdb.so
+TARGET1 = libreader_pdb.so.1
+TARGET2 = libreader_pdb.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: pdblib.mak $(READERDIR)/lib/$(TARGET)
+
+$(READERDIR)/lib/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/lib/ || mkdir -p $(READERDIR)/lib/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/lib/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+pdblib.mak: pdblib.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o pdblib.mak pdblib.pro
+qmake:
+ @$(QMAKE) -o pdblib.mak pdblib.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) $(READERDIR)/lib/$(TARGET1) $(READERDIR)/lib/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/pdb.o: pdb.cpp pdb.h \
+ QREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/pdb.o pdb.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libreader_pdb.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: pdblib.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libreader_pdb.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = pdb.cpp
+OBJECTS = OREADEROBJS/pdb.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_pdb.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_pdb.a
+TARGETD = libreader_pdb.so.1.0.0
+TARGET0 = libreader_pdb.so
+TARGET1 = libreader_pdb.so.1
+TARGET2 = libreader_pdb.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_pdb.so.1.0.0
+
+$(QTDIR)/lib/libreader_pdb.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: pdblib.omak
+
+pdblib.omak: pdblib.opro
+ tmake pdblib.opro -o pdblib.omak
+
+dist:
+ $(TAR) pdblib.opro.tar pdblib.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) pdblib.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/pdb.o: pdb.cpp \
+ pdb.h \
+ OREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/pdb.o pdb.cpp
+
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 @@
+#############################################################################
+# Makefile for building libreader_pdb.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: pdblib.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libreader_pdb.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = pdb.cpp
+OBJECTS = WSREADEROBJS/pdb.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_pdb.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_pdb.a
+TARGETD = libreader_pdb.so.1.0.0
+TARGET0 = libreader_pdb.so
+TARGET1 = libreader_pdb.so.1
+TARGET2 = libreader_pdb.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_pdb.so.1.0.0
+
+$(QTDIR)/lib/libreader_pdb.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: pdblib.wmak
+
+pdblib.wmak: pdblib.wpro
+ tmake pdblib.wpro -o pdblib.wmak
+
+dist:
+ $(TAR) pdblib.wpro.tar pdblib.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) pdblib.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/pdb.o: pdb.cpp \
+ pdb.h \
+ WSREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/pdb.o pdb.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = pdb.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/lib
+TARGET = reader_pdb
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libreader_pdb.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: pdblib.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libreader_pdb.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = pdb.cpp
+OBJECTS = ZREADEROBJS/pdb.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_pdb.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_pdb.a
+TARGETD = libreader_pdb.so.1.0.0
+TARGET0 = libreader_pdb.so
+TARGET1 = libreader_pdb.so.1
+TARGET2 = libreader_pdb.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_pdb.so.1.0.0
+
+$(QTDIR)/lib/libreader_pdb.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: pdblib.zmak
+
+pdblib.zmak: pdblib.zpro
+ tmake pdblib.zpro -o pdblib.zmak
+
+dist:
+ $(TAR) pdblib.zpro.tar pdblib.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) pdblib.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/pdb.o: pdb.cpp \
+ pdb.h \
+ ZREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/pdb.o pdb.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = pdb.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/lib
+TARGET = reader_pdb
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = pdb.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/lib
+TARGET = reader_pdb
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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,151 +1,231 @@
+#include "useqpe.h"
#include <stdio.h>
#include <string.h>
+#include <qmessagebox.h>
+#include <qpixmap.h>
#ifdef USEQPE
#include <qpe/qcopenvelope_qws.h>
#endif
#ifdef LOCALPICTURES
#include <qscrollview.h>
#endif
#ifdef USEQPE
#include <qpe/global.h>
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
+#include <qclipboard.h>
#include "plucker.h"
+#include "Aportis.h"
#include "Palm2QImage.h"
+#include "static.h"
struct CPlucker_dataRecord
{
UInt16 uid;
UInt16 nParagraphs;
UInt16 size;
UInt8 type;
UInt8 reserved;
};
int CPlucker::HeaderSize()
{
return sizeof(CPlucker_dataRecord);
}
void CPlucker::GetHeader(UInt16& uid, UInt16& nParagraphs, UInt32& size, UInt8& type, UInt8& reserved)
{
CPlucker_dataRecord thishdr;
fread(&thishdr, 1, HeaderSize(), fin);
uid = ntohs(thishdr.uid);
nParagraphs = ntohs(thishdr.nParagraphs);
size = ntohs(thishdr.size);
type = thishdr.type;
reserved = thishdr.reserved;
}
CPlucker::CPlucker()
- { /*printf("constructing:%x\n",fin);*/ }
+ { /*printf("constructing:%x\n",fin);*/
+ EOPPhase = 0;
+ }
bool CPlucker::CorrectDecoder()
{
return (memcmp(&head.type, "DataPlkr", 8) == 0);
}
int CPlucker::bgetch()
{
int ch = EOF;
if (bufferpos >= buffercontent)
{
+ if (isEndOfSection(bufferrec))
+ {
if (!m_continuous) return EOF;
- if (bufferrec >= ntohs(head.recordList.numRecords) - 1) return EOF;
-//// odebug << "Passing through " << currentpos << "" << oendl;
- if (!expand(bufferrec+1)) return EOF;
+ }
+ if (bufferrec >= ntohs(head.recordList.numRecords) - 1)
+ {
+ return EOF;
+ }
+ if (!expand(bufferrec+1))
+ {
+ return EOF;
+ }
mystyle.unset();
if (m_ParaOffsets[m_nextParaIndex] == 0)
{
while (m_ParaOffsets[m_nextParaIndex+1] == 0)
{
-// odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl;
+// qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7);
m_nextParaIndex++;
}
}
mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2);
-// odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl;
+// qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7);
ch = 10;
- EOPPhase = 4;
+ if (m_continuous) EOPPhase = 4;
}
else if (bufferpos == m_nextPara)
{
while (bufferpos == m_nextPara)
{
UInt16 attr = m_ParaAttrs[m_nextParaIndex];
m_nextParaIndex++;
-// odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl;
+// qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7);
if (m_nextParaIndex == m_nParas)
{
m_nextPara = -1;
}
else
{
m_nextPara += m_ParaOffsets[m_nextParaIndex];
}
}
mystyle.unset();
mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2);
-// odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl;
+// qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7);
if (m_lastBreak == locate())
{
currentpos++;
ch = expandedtextbuffer[bufferpos++];
}
else
{
ch = 10;
}
}
else
{
currentpos++;
ch = expandedtextbuffer[bufferpos++];
}
return ch;
}
tchar CPlucker::getch(bool fast)
{
mystyle.clearPicture();
if (EOPPhase > 0)
{
int ch = 10;
switch (EOPPhase)
{
case 4:
if (!fast) mystyle.setPicture(false, hRule(100,5));
mystyle.setCentreJustify();
ch = '#';
break;
case 3:
mystyle.setFontSize(3);
ch = 10;
break;
case 2:
ch = 10;
break;
case 1:
mystyle.unset();
default:
ch = 10;
}
EOPPhase--;
return ch;
}
return getch_base(fast);
}
QImage* CPlucker::imagefromdata(UInt8* imgbuffer, UInt32 imgsize)
{
QImage* qimage = Palm2QImage(imgbuffer, imgsize);
delete [] imgbuffer;
return qimage;
}
+
+void CPlucker::start2endSection() // to plucker base
+{
+ m_currentstart = NEFstartSection();
+ m_currentend = NEFendSection();
+}
+
+unsigned long CPlucker::NEFstartSection() // virtual in plucker base - differs only in obsoleted nef so move implementation
+{
+//inefficient - Should calc start/end of section on entry to section?
+ UInt16 thishdr_uid, thishdr_nParagraphs;
+ UInt32 thishdr_size;
+ UInt8 thishdr_type, thishdr_reserved;
+ unsigned long textlength = currentpos-bufferpos;
+ for (UInt16 recptr = bufferrec-1; recptr >= 1; recptr--)
+ {
+ gotorecordnumber(recptr);
+ //qDebug("recptr:%u", recptr);
+ GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
+ if (thishdr_type < 2)
+ {
+ if ((thishdr_reserved && continuation_bit) == 0) break;
+ textlength -= thishdr_size;
+ //qDebug("Textlength:%u, reserved:%u, recptr:%u", textlength, thishdr_reserved, recptr);
+ }
+ }
+ return textlength;
+}
+
+unsigned long CPlucker::NEFendSection() // virtual in plucker base - differs only in obsoleted nef so move implementation
+{
+//inefficient - Should calc start/end of section on entry to section?
+ unsigned long textlength = currentpos-bufferpos+buffercontent;
+ gotorecordnumber(bufferrec);
+ UInt16 thishdr_uid, thishdr_nParagraphs;
+ UInt32 thishdr_size;
+ UInt8 thishdr_type, thishdr_reserved;
+ GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
+ if ((thishdr_reserved && continuation_bit) != 0)
+ {
+ for (UInt16 recptr = bufferrec+1; recptr < ntohs(head.recordList.numRecords); recptr++)
+ {
+ gotorecordnumber(recptr);
+ UInt16 thishdr_uid, thishdr_nParagraphs;
+ UInt32 thishdr_size;
+ UInt8 thishdr_type, thishdr_reserved;
+ GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
+ // qDebug("recptr %u bufferrec %u type %u m_reserved %u", recptr, bufferrec, typ
+ if (thishdr_type < 2)
+ {
+ textlength += thishdr_size;
+ if ((thishdr_reserved && continuation_bit) == 0) break;
+ }
+ }
+ }
+ return textlength;
+}
+
+#ifndef __STATIC
+extern "C"
+{
+ CExpander* newcodec() { return new CPlucker; }
+}
+#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
@@ -1,36 +1,39 @@
#ifndef __plucker_h
#define __plucker_h
#include "plucker_base.h"
#ifdef LOCALPICTURES
class QScrollView;
class QWidget;
#endif
class CPlucker : public CPlucker_base
{
- void start2endSection()
+ bool isEndOfSection(int thisrec)
{
- m_currentstart = currentpos-bufferpos;
- m_currentend = m_currentstart+buffercontent;
+ return !m_bufferisreserved;
}
+ unsigned long NEFstartSection();
+ unsigned long NEFendSection();
+ void start2endSection();
void setbuffersize()
{
compressedbuffersize = buffersize = 32*1024;
}
int HeaderSize();
void GetHeader(UInt16& uid, UInt16& nParagraphs, UInt32& size, UInt8& type, UInt8& reserved);
int bgetch();
tchar getch(bool fast);
UInt8 EOPPhase;
bool CorrectDecoder(); // Virtual
void setlink(QString&, const QString&); // Virtual
QImage* imagefromdata(UInt8*, UInt32); // virtual
public:
CPlucker();
+ QString about() { return CPlucker_base::about()+QString("\nPlucker codec (c) Tim Wentford - Image reading code based on unpluck by Bill Janssen"); }
};
#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,1243 +1,1411 @@
-
-
#include "useqpe.h"
-#include "plucker_base.h"
-#include "Aportis.h"
-#include "Palm2QImage.h"
-
-/* OPIE */
-#include <opie2/odebug.h>
+#include "usenef.h"
+#include <stdio.h>
+#include <string.h>
+#include <qmessagebox.h>
+#include <qpixmap.h>
#ifdef USEQPE
#include <qpe/qcopenvelope_qws.h>
+#endif /* USEQPE */
+#ifdef LOCALPICTURES
+#include <qscrollview.h>
+#endif
+#ifdef USEQPE
#include <qpe/global.h>
#endif /* USEQPE */
-
+#include <qclipboard.h>
#ifndef USEQPE
#include <qapplication.h>
#else /* USEQPE */
#include <qpe/qpeapplication.h>
#endif /* USEQPE */
+#include <qimage.h>
-/* QT */
-#ifdef LOCALPICTURES
-#include <qscrollview.h>
-#endif
-
-/* STD */
-#include <stdio.h>
-#include <string.h>
+#include "static.h"
+#include "plucker_base.h"
+#include "Aportis.h"
+#include "hrule.h"
+#include "util.h"
+const UInt8 CPlucker_base::continuation_bit = 1;
CPlucker_base::CPlucker_base() :
#ifdef LOCALPICTURES
m_viewer(NULL),
m_picture(NULL),
#endif
expandedtextbuffer(NULL),
- compressedtextbuffer(NULL)
+ compressedtextbuffer(NULL),
+ bufferrec(-1),
+ m_offset(0)
//, urls(NULL)
{ /*printf("constructing:%x\n",fin);*/ }
void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buffersize)
{
if (type%2 == 0)
{
fread(buffer, reclen, sizeof(char), fin);
}
else
{
UInt8* readbuffer = NULL;
if (reclen > compressedbuffersize)
{
readbuffer = new UInt8[reclen];
}
else
{
readbuffer = compressedtextbuffer;
}
if (readbuffer != NULL)
{
fread(readbuffer, reclen, sizeof(char), fin);
- switch (ntohs(hdr0.version))
- {
- case 2:
- UnZip(readbuffer, reclen, buffer, buffersize);
- break;
- case 1:
- UnDoc(readbuffer, reclen, buffer, buffersize);
- break;
- }
+ (*m_decompress)(readbuffer, reclen, buffer, buffersize);
if (reclen > compressedbuffersize)
{
delete [] readbuffer;
}
}
}
}
void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text)
{
_file = file_length;
if (textlength == 0)
{
for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++)
{
gotorecordnumber(recptr);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_type < 2) textlength += thishdr_size;
}
}
_text = textlength;
//ntohl(hdr0.size);
}
char* CPlucker_base::geturl(UInt16 tgt)
{
char * pRet = NULL;
gotorecordnumber(0);
fread(&hdr0, 1, 6, fin);
unsigned int nrecs = ntohs(hdr0.nRecords);
- //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl;
+ //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs);
UInt16 urlid = 0;
bool urlsfound = false;
char* urls = NULL;
size_t urlsize = 0;
for (unsigned int i = 0; i < nrecs; i++)
{
UInt16 id, name;
fread(&name, 1, sizeof(name), fin);
fread(&id, 1, sizeof(id), fin);
- //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl;
+ //qDebug("N:%d, I:%d", ntohs(name), ntohs(id));
if (ntohs(name) == 2)
{
urlsfound = true;
urlid = id;
- //odebug << "Found url index:" << ntohs(urlid) << "" << oendl;
+ //qDebug("Found url index:%d", ntohs(urlid));
}
-// //odebug << "" << id << "" << oendl;
+ // //qDebug("%x", id);
}
if (urlsfound)
{
unsigned short recptr = finduid(ntohs(urlid));
if (recptr != 0)
{
gotorecordnumber(recptr);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
UInt16 urlctr = 0;
while (1)
{
UInt16 tctr;
fread(&tctr, 1, sizeof(tctr), fin);
fread(&urlid, 1, sizeof(urlid), fin);
tctr = ntohs(tctr);
- //odebug << "tgt:" << tgt << " urlctr:" << urlctr << " tctr:" << tctr << "" << oendl;
+ //qDebug("tgt:%u urlctr:%u tctr:%u", tgt, urlctr, tctr);
if (tctr >= tgt)
{
break;
}
urlctr = tctr;
}
- //odebug << "urls are in " << ntohs(urlid) << "" << oendl;
+ //qDebug("urls are in %d", ntohs(urlid));
recptr = finduid(ntohs(urlid));
if (recptr != 0)
{
UInt32 reclen = recordlength(recptr) - HeaderSize();
gotorecordnumber(recptr);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
- //odebug << "Found urls:" << thishdr_type << "" << oendl;
+ //qDebug("Found urls:%x",thishdr_type);
urlsize = thishdr_size;
urls = new char[urlsize];
Expand(reclen, thishdr_type, (UInt8*)urls, urlsize);
char* ptr = urls;
int rn = urlctr+1;
while (ptr - urls < urlsize)
{
if (rn == tgt)
{
- //odebug << "URL:" << ptr << "" << oendl;
+ //qDebug("URL:%s", ptr);
int len = strlen(ptr)+1;
pRet = new char[len];
memcpy(pRet, ptr, len);
break;
}
ptr += strlen(ptr)+1;
rn++;
}
delete [] urls;
}
}
}
else
{
- QMessageBox::information(NULL,
- QString(PROGNAME),
- QString("No external links\nin this pluck")
- );
+ pRet = NULL;
}
return pRet;
}
CPlucker_base::~CPlucker_base()
{
if (expandedtextbuffer != NULL) delete [] expandedtextbuffer;
if (compressedtextbuffer != NULL) delete [] compressedtextbuffer;
#ifdef LOCALPICTURES
if (m_viewer != NULL) delete m_viewer;
#endif
}
int CPlucker_base::getch() { return getch(false); }
-void CPlucker_base::getch(tchar& ch, CStyle& sty)
+void CPlucker_base::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
+ pos = locate();
ch = getch(false);
sty = mystyle;
}
unsigned int CPlucker_base::locate()
{
return currentpos;
/*
UInt16 thisrec = 1;
unsigned long locpos = 0;
gotorecordnumber(thisrec);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
while (thisrec < bufferrec)
{
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_type < 2) locpos += thishdr_size;
thisrec++;
gotorecordnumber(thisrec);
}
return locpos+bufferpos;
*/
}
void CPlucker_base::locate(unsigned int n)
{
// clock_t start = clock();
+ if (n >= currentpos-bufferpos && n < currentpos - bufferpos + buffercontent)
+ {
+ currentpos -= bufferpos;
+ expand(bufferrec);
+ while (currentpos < n && bufferpos < buffercontent) getch_base(true);
+ return;
+ }
+ /*
+
UInt32 textlength = currentpos - bufferpos;
UInt16 recptr = bufferrec;
if (n < textlength/2)
{
textlength = 0;
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size = buffercontent;
UInt8 thishdr_type, thishdr_reserved;
for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++)
{
gotorecordnumber(recptr);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_type < 2)
{
textlength += thishdr_size;
if (textlength > n)
{
textlength -= thishdr_size;
break;
}
}
}
}
else if (n < textlength)
{
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
while (n < textlength && recptr > 1)
{
recptr--;
gotorecordnumber(recptr);
- //odebug << "recptr:" << recptr << "" << oendl;
+ //qDebug("recptr:%u", recptr);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_type < 2)
{
textlength -= thishdr_size;
}
}
}
else
{
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size = buffercontent;
UInt8 thishdr_type, thishdr_reserved;
while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1)
{
textlength += thishdr_size;
recptr++;
gotorecordnumber(recptr);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (!(thishdr_type < 2))
{
thishdr_size = 0;
}
}
}
-// odebug << "Time(1): " << clock()-start << "" << oendl;
-/*
- expand(recptr);
- mystyle.unset();
- bufferpos = n-textlength;
- currentpos = n;
- while (bufferpos >= m_nextPara && m_nextPara >= 0)
- {
- UInt16 attr = m_ParaAttrs[m_nextParaIndex];
- m_nextParaIndex++;
- if (m_nextParaIndex == m_nParas)
- {
- m_nextPara = -1;
- }
- else
- {
- m_nextPara += m_ParaOffsets[m_nextParaIndex];
- }
- }
- return;
*/
-// start = clock();
-
UInt16 thisrec = 0;
unsigned long locpos = 0;
unsigned long bs = 0;
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
do
{
thisrec++;
locpos += bs;
gotorecordnumber(thisrec);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_type < 2)
{
bs = thishdr_size;
}
else
{
bs = 0;
}
} while (locpos + bs <= n);
-// odebug << "Time(2): " << clock()-start << "" << oendl;
+ // qDebug("Time(2): %u", clock()-start);
+ /*
if (recptr != thisrec)
{
- odebug << "Disaster:recptr:" << recptr << " thisrec:" << thisrec << "" << oendl;
+ qDebug("Disaster:recptr:%u thisrec:%u", recptr, thisrec);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size = buffercontent;
UInt8 thishdr_type, thishdr_reserved;
for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++)
{
gotorecordnumber(recptr);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
-// odebug << "UID:" << thishdr_uid << " Paras:" << thishdr_nParagraphs << " Size:" << thishdr_size << " Type:" << (unsigned int)thishdr_type << " Reserved:" << (unsigned int)thishdr_reserved << "" << oendl;
+ // 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);
}
// QApplication::exit ( 100 );
}
-
+ */
currentpos = locpos;
expand(thisrec);
while (currentpos < n && bufferpos < buffercontent) getch_base(true);
/* // This is faster but the alignment attribute doesn't get set 8^(
bufferpos = n-locpos;
currentpos = n;
while (bufferpos >= m_nextPara && m_nextPara >= 0)
{
UInt16 attr = m_ParaAttrs[m_nextParaIndex];
m_nextParaIndex++;
if (m_nextParaIndex == m_nParas)
{
m_nextPara = -1;
}
else
{
m_nextPara += m_ParaOffsets[m_nextParaIndex];
}
}
*/
}
bool CPlucker_base::expand(int thisrec)
{
mystyle.unset();
+ if (bufferrec != thisrec)
+ {
size_t reclen = recordlength(thisrec);
gotorecordnumber(thisrec);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
while (1)
{
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
- //odebug << "This (" << thisrec << ") type is " << thishdr_type << ", uid is " << thishdr_uid << "" << oendl;
+ //qDebug("This (%d) type is %d, uid is %u", thisrec, thishdr_type, thishdr_uid);
if (thishdr_type < 2) break;
- //odebug << "Skipping paragraph of type " << thishdr_type << "" << oendl;
+ //qDebug("Skipping paragraph of type %d", thishdr_type);
if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false;
reclen = recordlength(thisrec);
gotorecordnumber(thisrec);
}
m_nParas = thishdr_nParagraphs;
m_bufferisreserved = (thishdr_reserved != 0);
- //odebug << "It has " << thishdr_nParagraphs << " paragraphs and is " << thishdr_size << " bytes" << oendl;
+ //qDebug("It has %u paragraphs and is %u bytes", thishdr_nParagraphs, thishdr_size);
uid = thishdr_uid;
// gotorecordnumber(thisrec);
// fread(expandedtextbuffer,1,10,fin);
for (int i = 0; i < m_nParas; i++)
{
UInt16 ubytes, attrs;
fread(&ubytes, 1, sizeof(ubytes), fin);
fread(&attrs, 1, sizeof(attrs), fin);
m_ParaOffsets[i] = ntohs(ubytes);
m_ParaAttrs[i] = ntohs(attrs);
-// //odebug << "Bytes " << ntohs(ubytes) << ", Attr " << ntohs(attrs) << "" << oendl;
- }
- if (m_nParas > 0)
- {
- m_nextPara = m_ParaOffsets[0];
- //odebug << "First offset = " << m_nextPara << "" << oendl;
- m_nextParaIndex = 0;
- }
- else
- {
- m_nextPara = -1;
+ // //qDebug("Bytes %u, Attr %x", ntohs(ubytes), ntohs(attrs));
}
reclen -= HeaderSize()+4*m_nParas;
buffercontent = thishdr_size;
if (thishdr_size > buffersize)
{
delete [] expandedtextbuffer;
buffersize = thishdr_size;
expandedtextbuffer = new UInt8[buffersize];
}
-
Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent);
- bufferpos = 0;
bufferrec = thisrec;
- //odebug << "BC:" << buffercontent << ", HS:" << thishdr_size << "" << oendl;
+ }
+
+
+ if (m_nParas > 0)
+ {
+ m_nextPara = m_ParaOffsets[0];
+ //qDebug("First offset = %u", m_nextPara);
+ m_nextParaIndex = 0;
+ }
+ else
+ {
+ m_nextPara = -1;
+ }
+ bufferpos = 0;
+ //qDebug("BC:%u, HS:%u", buffercontent, thishdr_size);
return true;
}
void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize)
{
z_stream zstream;
memset(&zstream,sizeof(zstream),0);
zstream.next_in = compressedbuffer;
zstream.next_out = tgtbuffer;
zstream.avail_out = bsize;
zstream.avail_in = reclen;
int keylen = 0;
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
// printf("Initialising\n");
inflateInit(&zstream);
int err = 0;
do {
if ( zstream.avail_in == 0 && 0 < keylen ) {
zstream.next_in = compressedbuffer + keylen;
zstream.avail_in = reclen - keylen;
keylen = 0;
}
zstream.next_out = tgtbuffer;
zstream.avail_out = bsize;
err = inflate( &zstream, Z_SYNC_FLUSH );
-// //odebug << "err:" << err << " - " << zstream.avail_in << "" << oendl;
+ // //qDebug("err:%d - %u", err, zstream.avail_in);
} while ( err == Z_OK );
inflateEnd(&zstream);
}
void CPlucker_base::UnDoc(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize)
{
// UInt16 headerSize;
UInt16 docSize;
UInt16 i;
UInt16 j;
UInt16 k;
UInt8 *inBuf = compressedbuffer;
UInt8 *outBuf = tgtbuffer;
// headerSize = sizeof( Header ) + record->paragraphs * sizeof( Paragraph );
docSize = reclen;
j = 0;
k = 0;
while ( j < docSize ) {
i = 0;
while ( i < bsize && j < docSize ) {
UInt16 c;
c = (UInt16) inBuf[ j++ ];
if ( 0 < c && c < 9 ) {
while ( 0 < c-- )
outBuf[ i++ ] = inBuf[ j++ ];
}
else if ( c < 0x80 )
outBuf[ i++ ] = c;
else if ( 0xc0 <= c ) {
outBuf[ i++ ] = ' ';
outBuf[ i++ ] = c ^ 0x80;
}
else {
Int16 m;
Int16 n;
c <<= 8;
c += inBuf[ j++ ];
m = ( c & 0x3fff ) >> COUNT_BITS;
n = c & ( ( 1 << COUNT_BITS ) - 1 );
n += 2;
do {
outBuf[ i ] = outBuf[ i - m ];
i++;
} while ( 0 < n-- );
}
}
k += bsize;
}
}
void CPlucker_base::home()
{
currentpos = 0;
expand(1);
}
CList<Bkmk>* CPlucker_base::getbkmklist()
{
/*
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
for (int i = 1; i < ntohs(head.recordList.numRecords); i++)
{
gotorecordnumber(i);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_type == 8)
{
UInt16 n;
fread(&n, 1, sizeof(n), fin);
n = ntohs(n);
- //odebug << "Found " << n << " bookmarks" << oendl;
+ //qDebug("Found %u bookmarks", n);
}
- //odebug << "Found:" << i << ", " << thishdr_type << "" << oendl;
+ //qDebug("Found:%d, %u", i , thishdr_type);
}
*/
return NULL;
}
+#include <qnamespace.h>
QImage* CPlucker_base::expandimg(UInt16 tgt, bool border)
{
QImage* qimage = getimg(tgt);
QImage* ret;
if (qimage == NULL) return NULL;
if (border)
{
QPixmap* image = new QPixmap(0,0);
image->convertFromImage(*qimage);
delete qimage;
QPixmap* pret = new QPixmap(image->width()+4, image->height()+4);
pret->fill(Qt::red);
bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP);
delete image;
ret = new QImage(pret->convertToImage());
}
else
{
ret = qimage;
}
return ret;
}
#ifdef _BUFFERPICS
#include <qmap.h>
#endif
QImage* CPlucker_base::getPicture(unsigned long tgt)
{
#ifdef _BUFFERPICS
static QMap<unsigned long, QPixmap> pix;
QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt);
if (t == pix.end())
{
pix[tgt] = *expandimg(tgt);
return &pix[tgt];
}
else
return &(t.data());
#else
return expandimg(tgt >> 16);
#endif
}
#ifdef LOCALPICTURES
#include <unistd.h>
#include <qpe/global.h>
void CPlucker_base::showimg(UInt16 tgt)
{
- //odebug << "Crassssssh!" << oendl;
+ //qDebug("Crassssssh!");
QPixmap* qimage = expandimg(tgt);
m_picture->setFixedSize(qimage->size());
m_picture->setBackgroundPixmap(*qimage);
delete qimage;
m_viewer->show();
/*
char tmp[] = "uqtreader.XXXXXX";
QImage* qimage = getimg(tgt);
QPixmap* image = new QPixmap(0,0);
-// //odebug << "New image" << oendl;
+ // //qDebug("New image");
image->convertFromImage(*qimage);
delete qimage;
char tmpfile[sizeof(tmp)+1];
strcpy(tmpfile,tmp);
int f = mkstemp(tmpfile);
close(f);
- //odebug << "TMPFILE:" << tmpfile << "" << oendl;
+ //qDebug("TMPFILE:%s", tmpfile);
if (image->save(tmpfile,"PNG"))
{
QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)");
e << QString(tmpfile);
}
Global::statusMessage("Opening image");
sleep(5);
delete image;
unlink(tmpfile);
*/
}
#endif
unsigned short CPlucker_base::finduid(unsigned short urlid)
{
-// //odebug << "Finding " << urlid << "" << oendl;
+ // //qDebug("Finding %u", urlid);
unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords);
unsigned short jmid = (jmin+jmax) >> 1;
while (jmax - jmin > 1)
{
gotorecordnumber(jmid);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
unsigned short luid = thishdr_uid;
-// //odebug << "" << jmin << " " << jmid << " " << jmax << " : " << urlid << "" << oendl;
+ // //qDebug("%u %u %u : %u", jmin, jmid, jmax, urlid);
if (luid == urlid)
{
return jmid;
}
if (luid < urlid)
{
jmin = jmid;
}
else
{
jmax = jmid;
}
jmid = (jmin+jmax) >> 1;
}
gotorecordnumber(jmin);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
unsigned short luid = thishdr_uid;
- //odebug << "jmin at end:" << jmin << "," << luid << "" << oendl;
+ //qDebug("jmin at end:%u,%u", jmin, luid);
if (luid == urlid)
{
return jmin;
}
gotorecordnumber(jmax);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
luid = thishdr_uid;
- //odebug << "jmax at end:" << jmax << "," << luid << "" << oendl;
+ //qDebug("jmax at end:%u,%u", jmax, luid);
if (luid == urlid)
{
return jmax;
}
- //odebug << "Couldn't find " << urlid << "" << oendl;
+ //qDebug("Couldn't find %u", urlid);
return 0; // Not found!
}
+#include <qnamespace.h>
void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
{
unsigned short sz = 0;
for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
{
sz++;
}
size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long);
unsigned char* newdata = new unsigned char[newlen];
unsigned char* pdata = newdata;
memcpy(newdata, src, srclen);
newdata += srclen;
memcpy(newdata, &sz, sizeof(sz));
newdata += sizeof(sz);
#ifdef _WINDOWS
for (it = visited.begin(); it != visited.end(); it++)
#else
for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
#endif
{
unsigned long t = *it;
-// odebug << "[" << t << "]" << oendl;
+ // qDebug("[%u]", t);
memcpy(newdata, &t, sizeof(t));
newdata += sizeof(t);
}
m_nav.setSaveData(data, len, pdata, newlen);
delete [] pdata;
}
void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen)
{
unsigned short sz;
if (srclen >= sizeof(sz))
{
memcpy(&sz, src, sizeof(sz));
src += sizeof(sz);
srclen -= sizeof(sz);
}
for (int i = 0; i < sz; i++)
{
unsigned long t;
if (srclen >= sizeof(t))
{
memcpy(&t, src, sizeof(t));
-// odebug << "[" << t << "]" << oendl;
+ // qDebug("[%u]", t);
visited.push_front(t);
src += sizeof(t);
srclen -= sizeof(t);
}
else
{
QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself");
break;
}
}
m_nav.putSaveData(src, srclen);
}
int CPlucker_base::OpenFile(const char *src)
{
+ qDebug("plucker openfile:%s", src);
m_lastBreak = 0;
- if (!Cpdb::openfile(src))
+ if (!Cpdb::openpdbfile(src))
{
return -1;
}
if (!CorrectDecoder()) return -1;
gotorecordnumber(0);
fread(&hdr0, 1, 6, fin);
+ qDebug("Compression type:%u", ntohs(hdr0.version));
+
+
+ switch (ntohs(hdr0.version))
+ {
+ case 2:
+ m_decompress = UnZip;
+ break;
+ case 1:
+ m_decompress = UnDoc;
+ break;
+#ifdef USENEF
+ case 3:
+ m_decompress = getdecompressor("PluckerDecompress3");
+ break;
+ case 4:
+ m_decompress = getdecompressor("PluckerDecompress4");
+ break;
+#endif
+ default:
+ m_decompress = NULL;
+ }
+ if (m_decompress == NULL) return -1;
+
setbuffersize();
compressedtextbuffer = new UInt8[compressedbuffersize];
expandedtextbuffer = new UInt8[buffersize];
- //odebug << "Total number of records:" << ntohs(head.recordList.numRecords) << "" << oendl;
-
unsigned int nrecs = ntohs(hdr0.nRecords);
- //odebug << "Version " << ntohs(hdr0.version) << ", no. recs " << nrecs << "" << oendl;
+ qDebug("Version %u, no. reserved recs %u", ntohs(hdr0.version), nrecs);
+ textlength = ntohl(head.sortInfoID);
+ qDebug("Textlength at startup:%u", textlength);
UInt16 homerecid = 1;
for (unsigned int i = 0; i < nrecs; i++)
{
UInt16 id, name;
fread(&name, 1, sizeof(name), fin);
fread(&id, 1, sizeof(id), fin);
- //odebug << "N:" << ntohs(name) << ", I:" << ntohs(id) << "" << oendl;
+ //qDebug("N:%d, I:%d", ntohs(name), ntohs(id));
if (ntohs(name) == 0) homerecid = ntohs(id);
}
textlength = 0;
for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++)
{
gotorecordnumber(recptr);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (thishdr_uid == homerecid)
{
m_homepos = textlength;
break;
}
if (thishdr_type < 2) textlength += thishdr_size;
}
+ qDebug("Found home");
textlength = 0;
home();
+ qDebug("Gone home");
#ifdef LOCALPICTURES
if (m_viewer == NULL)
{
m_viewer = new QScrollView(NULL);
m_picture = new QWidget(m_viewer->viewport());
m_viewer->addChild(m_picture);
}
#endif
return 0;
}
QImage* CPlucker_base::getimg(UInt16 tgt)
{
size_t reclen;
UInt16 thisrec = finduid(tgt);
+ qDebug("getimg:Found %u from uid:%u", thisrec, tgt);
reclen = recordlength(thisrec);
gotorecordnumber(thisrec);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
+ if (thishdr_type == 15)
+ {
+ char *buffer = new char[thishdr_size];
+ fread(buffer, thishdr_size, sizeof(char), fin);
+ unsigned short tmp;
+ memcpy(&tmp, buffer, sizeof(tmp));
+ unsigned short cols = ntohs(tmp);
+ memcpy(&tmp, buffer+sizeof(tmp), sizeof(tmp));
+ unsigned short rows = ntohs(tmp);
+ qDebug("Found a picture of type:%u [%u,%u]", thishdr_type, rows, cols);
+ QImage*** images;
+ images = new QImage**[rows];
+#ifdef _WINDOWS
+ int i;
+ for (i = 0; i < rows; i++)
+#else
+ for (int i = 0; i < rows; i++)
+#endif
+ {
+ images[i] = new QImage*[cols];
+ }
+ int height = 0;
+ int width = 0;
+#ifdef _WINDOWS
+ for (i = 0; i < rows; i++)
+#else
+ for (int i = 0; i < rows; i++)
+#endif
+ {
+ width = 0;
+ for (int j = 0; j < cols; j++)
+ {
+ memcpy(&tmp, buffer+(i*cols+j+2)*sizeof(tmp), sizeof(tmp));
+ unsigned short uid = ntohs(tmp);
+ images[i][j] = getimg(uid);
+ width += images[i][j]->width();
+ }
+ height += images[i][0]->height();
+ }
+ delete [] buffer;
+ QPixmap pm(width, height);
+ int hoffset = 0;
+#ifdef _WINDOWS
+ for (i = 0; i < rows; i++)
+#else
+ for (int i = 0; i < rows; i++)
+#endif
+ {
+ int woffset = 0;
+ int delht = images[i][0]->height();
+ for (int j = 0; j < cols; j++)
+ {
+ QPixmap pm2;
+ pm2.convertFromImage(*(images[i][j]));
+ delete images[i][j];
+ bitBlt(&pm, woffset, hoffset, &pm2, 0, 0, pm2.width(), pm2.height());
+ woffset += pm2.width();
+ }
+ hoffset += delht;
+ }
+#ifdef _WINDOWS
+ for (i = 0; i < rows; i++)
+#else
+ for (int i = 0; i < rows; i++)
+#endif
+ {
+ delete [] images[i];
+ }
+ delete [] images;
+ return new QImage(pm.convertToImage());
+ }
+ else
+ {
+ qDebug("Found a picture of type:%u", thishdr_type);
reclen -= HeaderSize();
UInt32 imgsize = thishdr_size;
UInt8* imgbuffer = new UInt8[imgsize];
Expand(reclen, thishdr_type, imgbuffer, imgsize);
return imagefromdata(imgbuffer, imgsize);
}
+}
-linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd)
+linkType CPlucker_base::hyperlink(unsigned int n, unsigned int offset, QString& wrd, QString&)
{
visited.push_front(n);
UInt16 tuid = (n >> 16);
n &= 0xffff;
-// //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl;
+ char *turl = geturl(tuid);
+ if (turl != NULL)
+ {
+ qDebug("URL in PB:%s", turl);
+ wrd = turl;
+ delete [] turl;
+ }
+ else
+ {
+ wrd.truncate(0);
+ }
+ qDebug("Hyper: UID:%u, Para:%u, Offset:%u", tuid, n, offset);
UInt16 thisrec = 1;
currentpos = 0;
gotorecordnumber(thisrec);
UInt16 thishdr_uid, thishdr_nParagraphs;
UInt32 thishdr_size;
UInt8 thishdr_type, thishdr_reserved;
while (1)
{
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
if (tuid == thishdr_uid) break;
if (thishdr_type < 2) currentpos += thishdr_size;
-// //odebug << "hyper-cp:" << currentpos << "" << oendl;
+ // //qDebug("hyper-cp:%u", currentpos);
thisrec++;
if (thisrec >= ntohs(head.recordList.numRecords))
{
- char *turl = geturl(tuid);
- if (turl == NULL)
+ if (wrd.isEmpty())
{
QMessageBox::information(NULL,
QString(PROGNAME),
QString("Couldn't find link")
);
}
else
{
- wrd = turl;
#ifdef USEQPE
if (wrd.length() > 10)
{
Global::statusMessage(wrd.left(8) + "..");
}
else
{
Global::statusMessage(wrd);
}
#else
#endif /* USEQPE */
- //odebug << "Link:" << wrd << "" << oendl;
+ //qDebug("Link:%s", (const char*)wrd);
// setlink(fn, wrd);
- delete [] turl;
}
return eNone;
}
gotorecordnumber(thisrec);
}
if (thishdr_type > 1)
{
if (thishdr_type == 4)
{
QMessageBox::information(NULL,
QString(PROGNAME),
QString("Mailto links\nnot yet supported (2)"));
}
else
{
- if (thishdr_type > 3)
+ if (thishdr_type > 3 && thishdr_type != 15)
{
QMessageBox::information(NULL,
QString(PROGNAME),
QString("External links\nnot yet supported (2)")
);
return eNone;
}
else
{
#ifdef LOCALPICTURES
showimg(tuid);
#else
return ePicture;
#endif
}
}
return eNone;
}
/*
if (thishdr_type == 2 || thishdr_type == 3)
{
expandimg(thisrec);
}
*/
else
{
expand(thisrec);
+ unsigned int paraoffset = offset;
+ // unsigned int noff = 0;
if (n != 0)
{
if (n >= m_nParas)
{
QMessageBox::information(NULL,
QString(PROGNAME),
QString("Error in link\nPara # too big")
);
return eNone;
}
unsigned int noff = 0;
for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i];
- n = noff;
+
+ paraoffset += noff;
}
- if (n > thishdr_size)
+ if (paraoffset > thishdr_size)
{
QMessageBox::information(NULL,
QString(PROGNAME),
QString("Error in link\nOffset too big")
);
return eNone;
}
- //odebug << "Hyper:<" << tuid << "," << n << ">" << oendl;
- while (bufferpos < n && bufferpos < buffercontent) getch_base(true);
+ while (bufferpos < paraoffset && bufferpos < buffercontent) getch_base(true);
+ //qDebug("Hyper:<%u,%u,%u>", paraoffset, bufferpos, currentpos);
/* // This is faster but the alignment doesn't get set
mystyle.unset();
bufferpos = n;
currentpos += n;
while (bufferpos >= m_nextPara && m_nextPara >= 0)
{
UInt16 attr = m_ParaAttrs[m_nextParaIndex];
m_nextParaIndex++;
if (m_nextParaIndex == m_nParas)
{
m_nextPara = -1;
}
else
{
m_nextPara += m_ParaOffsets[m_nextParaIndex];
}
}
*/
}
return eLink;
}
tchar CPlucker_base::getch_base(bool fast)
{
int ch = bgetch();
while (ch == 0)
{
ch = bgetch();
-// //odebug << "Function:" << ch << "" << oendl;
+ // //qDebug("Function:%x", ch);
switch (ch)
{
case 0x38:
-// //odebug << "Break:" << locate() << "" << oendl;
+ // //qDebug("Break:%u", locate());
if (m_lastBreak == locate())
{
ch = bgetch();
}
else
{
ch = 10;
}
m_lastBreak = locate();
break;
case 0x0a:
case 0x0c:
{
unsigned long ln = 0;
int skip = ch & 7;
for (int i = 0; i < 2; i++)
{
int ch = bgetch();
ln = (ln << 8) + ch;
-// //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl;
+ // //qDebug("ch:%d, ln:%u", ch, ln);
}
if (skip == 2)
{
ln <<= 16;
}
else
{
for (int i = 0; i < 2; i++)
{
int ch = bgetch();
ln = (ln << 8) + ch;
-// //odebug << "ch:" << ch << ", ln:" << ln << "" << oendl;
+ // //qDebug("ch:%d, ln:%u", ch, ln);
}
}
-// //odebug << "ln:" << ln << "" << oendl;
+ // //qDebug("ln:%u", ln);
mystyle.setLink(true);
mystyle.setData(ln);
// mystyle.setColour(255, 0, 0);
bool hasseen = false;
for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
{
if (*it == ln)
{
hasseen = true;
break;
}
}
if (hasseen)
{
mystyle.setStrikethru();
}
else
{
mystyle.setUnderline();
}
+ mystyle.setOffset(m_offset);
+ m_offset = 0;
ch = bgetch();
}
break;
case 0x08:
ch = bgetch();
// mystyle.setColour(0, 0, 0);
mystyle.unsetUnderline();
mystyle.unsetStrikethru();
mystyle.setLink(false);
mystyle.setData(0);
break;
case 0x40:
mystyle.setItalic();
ch = bgetch();
break;
case 0x48:
mystyle.unsetItalic();
ch = bgetch();
break;
case 0x11:
{
ch = bgetch();
-// //odebug << "Font:" << ch << "" << oendl;
+ // //qDebug("Font:%d",ch);
mystyle.setVOffset(0);
mystyle.unsetMono();
mystyle.unsetBold();
- mystyle.setFontSize(0);
switch (ch)
{
case 0:
+ mystyle.setFontSize(0);
break;
case 1:
- mystyle.setBold();
mystyle.setFontSize(3);
+ mystyle.setBold();
break;
case 2:
- mystyle.setBold();
mystyle.setFontSize(2);
+ mystyle.setBold();
break;
case 3:
- mystyle.setBold();
mystyle.setFontSize(1);
+ mystyle.setBold();
break;
case 4:
+ mystyle.setFontSize(0);
mystyle.setBold();
break;
case 5:
+ mystyle.setFontSize(0);
mystyle.setBold();
break;
case 6:
+ mystyle.setFontSize(0);
mystyle.setBold();
break;
case 7:
+ mystyle.setFontSize(0);
mystyle.setBold();
break;
case 8: // should be fixed width
- //odebug << "Trying fixed width" << oendl;
+ //qDebug("Trying fixed width");
+ mystyle.setFontSize(0);
mystyle.setMono();
break;
case 9:
+ // mystyle.setFontSize(mystyle.getFontSize());
mystyle.setFontSize(-1);
break;
case 10:
mystyle.setFontSize(-2);
mystyle.setVOffset(1);
break;
case 11:
mystyle.setFontSize(-2);
mystyle.setVOffset(-1);
break;
default:
- odebug << "Unrecognised font" << oendl;
+ qDebug("Unrecognised font");
break;
}
ch = bgetch();
}
break;
case 0x29:
ch = bgetch();
switch (ch)
{
case 0:
mystyle.setLeftJustify();
-// //odebug << "left" << oendl;
+ // //qDebug("left");
break;
case 1:
mystyle.setRightJustify();
-// //odebug << "right" << oendl;
+ // //qDebug("right");
break;
case 2:
mystyle.setCentreJustify();
-// //odebug << "centre" << oendl;
+ // //qDebug("centre");
break;
case 3:
mystyle.setFullJustify();
-// //odebug << "full" << oendl;
+ // //qDebug("full");
break;
}
ch = bgetch();
break;
case 0x53:
{
int r = bgetch();
int g = bgetch();
int b = bgetch();
mystyle.setColour(r,g,b);
ch = bgetch();
}
break;
case 0x1a:
case 0x5c:
{
bool hasalternate = (ch == 0x5c);
UInt16 ir = bgetch();
ir = (ir << 8) + bgetch();
if (hasalternate)
{
- //odebug << "Alternate image:" << ir << "" << oendl;
+ //qDebug("Alternate image:%x", ir);
UInt16 ir2 = bgetch();
ir2 = (ir2 << 8) + bgetch();
if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16);
#ifdef LOCALPICTURES
UInt32 ln = ir;
ln <<= 16;
mystyle.setLink(true);
mystyle.setData(ln);
#endif
}
else
{
if (!fast) mystyle.setPicture(true, expandimg(ir));
}
-// if (mystyle.getLink()) odebug << "Picture link!" << oendl;
+ // if (mystyle.getLink()) qDebug("Picture link!");
ch = '#';
}
// ch = bgetch();
break;
case 0x33:
{
UInt8 h = bgetch();
UInt8 wc = bgetch();
UInt8 pc = bgetch();
UInt16 w = wc;
-// //odebug << "h,w,pc [" << h << ", " << w << ", " << pc << "]" << oendl;
+ // //qDebug("h,w,pc [%u, %u, %u]", h, w, pc);
if (w == 0)
{
w = (m_scrWidth*(unsigned long)pc)/100;
}
if (w == 0) w = m_scrWidth;
mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue()));
-// if (mystyle.getLink()) //odebug << "hRule link!" << oendl;
+ // if (mystyle.getLink()) //qDebug("hRule link!");
ch = '#';
}
break;
case 0x60:
mystyle.setUnderline();
ch = bgetch();
break;
case 0x68:
mystyle.unsetUnderline();
ch = bgetch();
break;
case 0x22:
ch = bgetch();
mystyle.setLeftMargin(ch);
-// //odebug << "Left margin:" << ch << "" << oendl;
+ // //qDebug("Left margin:%d", ch);
ch = bgetch();
mystyle.setRightMargin(ch);
-// //odebug << "Right margin:" << ch << "" << oendl;
+ // //qDebug("Right margin:%d", ch);
ch = bgetch();
break;
case 0x70:
mystyle.setStrikethru();
ch = bgetch();
break;
case 0x78:
mystyle.unsetStrikethru();
ch = bgetch();
break;
case 0x83:
{
int tlen = bgetch();
ch = bgetch();
ch <<= 8;
ch |= (tchar)bgetch();
for (int i = 0; i < tlen; i++) bgetch();
- //odebug << "Function 83" << oendl;
+ //qDebug("Function 83");
+ }
+ break;
+ case 0x9a:
+ {
+ m_offset = 255*bgetch();
+ m_offset += bgetch();
+ qDebug("Found offset:%u", m_offset);
+ ch = bgetch();
}
break;
case 0x85:
default:
- odebug << "Function:" << ch << " NOT IMPLEMENTED" << oendl;
+ qDebug("Function:%x NOT IMPLEMENTED", ch);
{
int skip = ch & 7;
for (int i = 0; i < skip; i++)
{
ch = bgetch();
- //odebug << "Arg " << i << ", " << ch << "" << oendl;
+ //qDebug("Arg %d, %d", i, ch);
}
ch = bgetch();
}
}
}
if (m_lastIsBreak && !mystyle.isMono())
{
while (ch == ' ')
{
ch = getch(false);
}
}
m_lastIsBreak = (ch == 10);
return (ch == EOF) ? UEOF : ch;
}
+
+#include "static.h"
+#if defined(__STATIC) && defined(USENEF)
+#include "Model.h"
+void (*CPlucker_base::getdecompressor(const QString& _s))(UInt8*, size_t, UInt8*, size_t)
+{
+ if (_s == "PluckerDecompress3")
+ {
+ return PluckerDecompress3;
+ }
+ if (_s == "PluckerDecompress4")
+ {
+ return PluckerDecompress4;
+ }
+ return NULL;
+}
+#else
+
+#include "qfileinfo.h"
+
+#include <dlfcn.h>
+
+void (*CPlucker_base::getdecompressor(const QString& _s))(UInt8*, size_t, UInt8*, size_t)
+{
+ QString codecpath(QTReaderUtil::getPluginPath("support"));
+ codecpath += "/libpluckerdecompress.so";
+ qDebug("Codec:%s", (const char*)codecpath);
+ if (QFile::exists(codecpath))
+ {
+ qDebug("Codec:%s", (const char*)codecpath);
+ void* handle = dlopen(codecpath, RTLD_LAZY);
+ if (handle == 0)
+ {
+ qDebug("Can't find codec:%s", dlerror());
+ return NULL;
+ }
+ return (void (*)(UInt8*, size_t, UInt8*, size_t))dlsym(handle, _s);
+ }
+ return NULL;
+}
+#endif
+
+QString CPlucker_base::about()
+{
+ QString abt = "Plucker base codec (c) Tim Wentford";
+ if (m_decompress != UnDoc && m_decompress != UnZip)
+ {
+ abt += "\nSpecial decompression (c) Tim Wentford";
+ }
+ return abt;
+}
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,119 +1,115 @@
#ifndef __PLUCKER_BASE_H
#define __PLUCKER_BASE_H
-#include "useqpe.h"
#include "CExpander.h"
#include <zlib.h>
#include "ztxt.h"
#include "pdb.h"
#include "CBuffer.h"
#include "my_list.h"
#include "Navigation.h"
+#include "hrule.h"
struct CPlucker_record0
{
UInt16 uid;
UInt16 version;
UInt16 nRecords;
};
struct CPluckerbkmk
{
UInt32 offset;
tchar title[MAX_BMRK_LENGTH];
};
#ifdef LOCALPICTURES
class QScrollView;
class QWidget;
#endif
+class QString;
-class CPlucker_base : public CExpander, public Cpdb
+class CPlucker_base : public Cpdb
{
protected:
+ static const UInt8 continuation_bit;
virtual void setbuffersize() = 0;
virtual void GetHeader(UInt16&, UInt16&, UInt32&, UInt8&, UInt8&) = 0;
virtual int HeaderSize() = 0;
unsigned short finduid(unsigned short);
char* geturl(UInt16);
void Expand(UInt32, UInt8, UInt8*, UInt32);
CList<unsigned long> visited;
bool m_lastIsBreak;
#ifdef LOCALPICTURES
QScrollView* m_viewer;
QWidget* m_picture;
#endif
- size_t textlength, m_lastBreak;
+ size_t textlength, m_lastBreak, m_offset;
UInt16 uid;
int m_nextPara, m_nextParaIndex;
CBufferFace<UInt16> m_ParaOffsets;
CBufferFace<UInt16> m_ParaAttrs;
UInt16 m_nParas;
CStyle mystyle;
// bool bInit;
UInt32 buffersize;
UInt32 compressedbuffersize;
UInt32 buffercontent;
UInt8* expandedtextbuffer;
UInt8* compressedtextbuffer;
// char* urls;
// size_t urlsize;
size_t bufferpos;
- UInt16 bufferrec;
+ int bufferrec;
CPlucker_record0 hdr0;
bool m_bufferisreserved;
size_t currentpos;
bool expand(int);
- void UnZip(UInt8*, size_t, UInt8*, size_t);
- void UnDoc(UInt8*, size_t, UInt8*, size_t);
+ static void UnZip(UInt8*, size_t, UInt8*, size_t);
+ static void UnDoc(UInt8*, size_t, UInt8*, size_t);
+
+ void (*m_decompress)(UInt8*, size_t, UInt8*, size_t);
+ void (*getdecompressor(const QString& _s))(UInt8*, size_t, UInt8*, size_t);
#ifdef LOCALPICTURES
void showimg(UInt16 tgt);
#endif
QImage* getimg(UInt16 tgt);
QImage* expandimg(UInt16 tgt, bool border=false);
void home();
virtual int bgetch() = 0;
CNavigation m_nav;
public:
-#ifdef USEQPE
- void suspend()
- {
- CExpander::suspend(fin);
- }
- void unsuspend()
- {
- CExpander::unsuspend(fin);
- }
-#endif
+ QString about();
QImage* getPicture(unsigned long tgt);
void sizes(unsigned long& _file, unsigned long& _text);
bool hasrandomaccess() { return true; }
virtual ~CPlucker_base();
CPlucker_base();
int OpenFile(const char *src);
virtual tchar getch(bool) = 0;
tchar getch_base(bool);
int getch();
- void getch(tchar&, CStyle&);
+ void getch(tchar&, CStyle&, unsigned long& pos);
unsigned int locate();
void locate(unsigned int n);
CList<Bkmk>* getbkmklist();
- linkType hyperlink(unsigned int n, QString&);
+ linkType hyperlink(unsigned int, unsigned int, QString&, QString&);
MarkupType PreferredMarkup()
{
return cNONE;
}
void saveposn(size_t posn) { m_nav.saveposn(posn); }
void writeposn(size_t posn) { m_nav.writeposn(posn); }
- bool forward(size_t& loc) { return m_nav.forward(loc); }
- bool back(size_t& loc) { return m_nav.back(loc); }
+ linkType forward(size_t& loc) { return (m_nav.forward(loc)) ? eLink : eNone; }
+ linkType back(size_t& loc) { return (m_nav.back(loc)) ? eLink : eNone; }
bool hasnavigation() { return true; }
void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen);
void putSaveData(unsigned char*& src, unsigned short& srclen);
virtual bool CorrectDecoder() = 0;
// virtual void setlink(QString&, const QString&) = 0;
virtual QImage* imagefromdata(UInt8*, UInt32) = 0;
};
#endif
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 @@
+#############################################################################
+# Makefile for building: libreader_pluckerbase.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:40:18 2004
+# Project: pluckerbaselib.pro
+# Template: lib
+# Command: $(QMAKE) -o pluckerbaselib.mak pluckerbaselib.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libreader_pluckerbase.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = plucker_base.cpp
+OBJECTS = QREADEROBJS/plucker_base.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = pluckerbaselib.pro
+QMAKE_TARGET = reader_pluckerbase
+DESTDIR = $(READERDIR)/lib/
+TARGET = libreader_pluckerbase.so.1.0.0
+TARGETA = $(READERDIR)/lib/libreader_pluckerbase.a
+TARGETD = libreader_pluckerbase.so.1.0.0
+TARGET0 = libreader_pluckerbase.so
+TARGET1 = libreader_pluckerbase.so.1
+TARGET2 = libreader_pluckerbase.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: pluckerbaselib.mak $(READERDIR)/lib/$(TARGET)
+
+$(READERDIR)/lib/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/lib/ || mkdir -p $(READERDIR)/lib/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/lib/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+pluckerbaselib.mak: pluckerbaselib.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o pluckerbaselib.mak pluckerbaselib.pro
+qmake:
+ @$(QMAKE) -o pluckerbaselib.mak pluckerbaselib.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/lib/$(TARGET0) $(READERDIR)/lib/$(TARGET1) $(READERDIR)/lib/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/plucker_base.o: plucker_base.cpp QREADERINC/useqpe.h \
+ QREADERINC/static.h \
+ plucker_base.h \
+ Aportis.h \
+ hrule.h \
+ CExpander.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/plucker_base.o plucker_base.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libreader_pluckerbase.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: pluckerbaselib.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libreader_pluckerbase.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = plucker_base.cpp
+OBJECTS = OREADEROBJS/plucker_base.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_pluckerbase.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_pluckerbase.a
+TARGETD = libreader_pluckerbase.so.1.0.0
+TARGET0 = libreader_pluckerbase.so
+TARGET1 = libreader_pluckerbase.so.1
+TARGET2 = libreader_pluckerbase.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0
+
+$(QTDIR)/lib/libreader_pluckerbase.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: pluckerbaselib.omak
+
+pluckerbaselib.omak: pluckerbaselib.opro
+ tmake pluckerbaselib.opro -o pluckerbaselib.omak
+
+dist:
+ $(TAR) pluckerbaselib.opro.tar pluckerbaselib.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) pluckerbaselib.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/plucker_base.o: plucker_base.cpp \
+ OREADERINC/useqpe.h \
+ OREADERINC/static.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Model.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/plucker_base.o plucker_base.cpp
+
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 @@
+#############################################################################
+# Makefile for building libreader_pluckerbase.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: pluckerbaselib.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libreader_pluckerbase.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = plucker_base.cpp
+OBJECTS = WSREADEROBJS/plucker_base.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_pluckerbase.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_pluckerbase.a
+TARGETD = libreader_pluckerbase.so.1.0.0
+TARGET0 = libreader_pluckerbase.so
+TARGET1 = libreader_pluckerbase.so.1
+TARGET2 = libreader_pluckerbase.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0
+
+$(QTDIR)/lib/libreader_pluckerbase.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: pluckerbaselib.wmak
+
+pluckerbaselib.wmak: pluckerbaselib.wpro
+ tmake pluckerbaselib.wpro -o pluckerbaselib.wmak
+
+dist:
+ $(TAR) pluckerbaselib.wpro.tar pluckerbaselib.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) pluckerbaselib.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/plucker_base.o: plucker_base.cpp \
+ WSREADERINC/useqpe.h \
+ WSREADERINC/static.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Model.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/plucker_base.o plucker_base.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = plucker_base.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/lib
+TARGET = reader_pluckerbase
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libreader_pluckerbase.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: pluckerbaselib.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libreader_pluckerbase.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = pdb.h
+SOURCES = plucker_base.cpp
+OBJECTS = ZREADEROBJS/plucker_base.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libreader_pluckerbase.so.1.0.0
+TARGETA = $(QTDIR)/lib/libreader_pluckerbase.a
+TARGETD = libreader_pluckerbase.so.1.0.0
+TARGET0 = libreader_pluckerbase.so
+TARGET1 = libreader_pluckerbase.so.1
+TARGET2 = libreader_pluckerbase.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/lib/libreader_pluckerbase.so.1.0.0
+
+$(QTDIR)/lib/libreader_pluckerbase.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/lib/$(TARGET)
+ -rm -f $(QTDIR)/lib/$(TARGET0)
+ -rm -f $(QTDIR)/lib/$(TARGET1)
+ -rm -f $(QTDIR)/lib/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/lib/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: pluckerbaselib.zmak
+
+pluckerbaselib.zmak: pluckerbaselib.zpro
+ tmake pluckerbaselib.zpro -o pluckerbaselib.zmak
+
+dist:
+ $(TAR) pluckerbaselib.zpro.tar pluckerbaselib.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) pluckerbaselib.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/plucker_base.o: plucker_base.cpp \
+ ZREADERINC/useqpe.h \
+ ZREADERINC/static.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Model.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/plucker_base.o plucker_base.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h
+
+SOURCES = plucker_base.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/lib
+TARGET = reader_pluckerbase
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = pdb.h \
+ util.h
+
+SOURCES = plucker_base.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/lib
+TARGET = reader_pluckerbase
+LIBS += -ldl
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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,258 +1,259 @@
#include <stdlib.h>
#include <stdio.h>
+#include "arith.h"
#include "ppm.h"
/****************************************************************************
* Gestion des noeuds
****************************************************************************/
/*
* Désallocation du noeud p
*/
void ppm_worker::Node_Free(UINT p) {
node_heap[node_free_last].free_next=p;
node_heap[p].free_next=NIL;
node_free_last=p;
node_free_nb++;
}
/*
* Allocation d'un noeud
* s'il ne reste plus de place, on désalloue le contexte le moins utilisé.
*/
UINT ppm_worker::Node_Alloc(void) {
UINT p;
if (node_free_nb<=2) Context_DeleteLast();
p=node_free_first;
node_free_first=node_heap[node_free_first].free_next;
node_free_nb--;
#ifdef DEBUG
printf("Node_Alloc: p=%d\n",p);
#endif
return p;
}
/****************************************************************************
* Gestion des contextes
****************************************************************************/
/*
* Mise au début de la liste des contextes du contexte c
*/
void ppm_worker::Context_MoveFirst(UINT c) {
NODE *ctx;
if (c!=ctx_first) {
ctx=&node_heap[c];
/* suppression du contexte dans la liste */
if (c==ctx_last) {
ctx_last=ctx->hdr.ctx_prev;
} else {
node_heap[ctx->hdr.ctx_prev].hdr.ctx_next=ctx->hdr.ctx_next;
node_heap[ctx->hdr.ctx_next].hdr.ctx_prev=ctx->hdr.ctx_prev;
}
/* insertion au début de la liste */
node_heap[ctx_first].hdr.ctx_prev=c;
ctx->hdr.ctx_next=ctx_first;
ctx_first=c;
}
}
/*
* Destruction du contexte le moins utilisé (ctx_last)
*/
void ppm_worker::Context_DeleteLast(void) {
NODE *n;
UINT h,h_next,node,node_next;
USHORT *p;
n=&node_heap[ctx_last];
/* libération dans la table de hachage. Comme on ne dispose pas de
* pointeur hash_prev dans les contextes, il faut parcourir toute
* la liste. Heureusement, celle-ci est de longueur faible en moyenne
*/
h_next=n->hdr.hash_next;
h=h_next;
while (h<HASH_ADDRESS) h=node_heap[h].hdr.hash_next;
p=&hash_table[h-HASH_ADDRESS];
while (*p!=ctx_last) p=&node_heap[*p].hdr.hash_next;
*p=h_next;
/* libération des noeuds & modification de ctx_last */
if (n->hdr.sf_max>=2) {
node=n->hdr.sf.l.sf_next;
while (1) {
node_next=node_heap[node].sf.sf_next;
Node_Free(node);
if (node_next==NIL) break;
node=node_next;
}
}
node=ctx_last;
ctx_last=n->hdr.ctx_prev;
Node_Free(node);
ctx_nb--;
}
/*
* Création d'un nouveau contexte avec un seul symbole sym de fréquence 1
* Utilisation implicite de sym_context et sym_hash.
* Libération de mémoire si nécessaire, et mise en premier dans la liste
*/
void ppm_worker::Context_New(int sym,int order) {
NODE *ctx;
UINT i,c;
#ifdef DEBUG
printf("Context_New: sym=%d o=%d\n",sym,order);
#endif
c=Node_Alloc();
ctx=&node_heap[c];
/* mise du contexte en tête de la liste */
ctx->hdr.ctx_next=ctx_first;
node_heap[ctx_first].hdr.ctx_prev=c;
ctx_first=c;
ctx_nb++;
/* insertion dans la table de hachage */
ctx->hdr.hash_next=hash_table[sym_hash[order]];
hash_table[sym_hash[order]]=ctx_first;
/* initialisation du contexte */
ctx->hdr.order=order;
for(i=0;i<order;i++) ctx->hdr.sym[i]=sym_context[i+1];
ctx->hdr.sf_max=0;
ctx->hdr.sf.sf[0].sym=sym;
ctx->hdr.sf.sf[0].freq=1;
#ifdef DEBUG
Context_Print(ctx_first);
#endif
}
/*
* Ajout d'un nouveau symbole au contexte c
*/
void ppm_worker::Context_NewSym(int sym,UINT c) {
NODE *n,*m;
UINT p,sf_max;
#ifdef DEBUG
printf("Context_NewSym: sym=%d c=%d\n",sym,c);
Context_Print(c);
#endif
n=&node_heap[c];
sf_max=n->hdr.sf_max;
n->hdr.sf_max++;
if (sf_max==0) {
n->hdr.sf.sf[1].sym=sym;
n->hdr.sf.sf[1].freq=1;
} else if (sf_max==1) {
p=Node_Alloc();
m=&node_heap[p];
m->sf.sf[0]=n->hdr.sf.sf[0];
m->sf.sf[1]=n->hdr.sf.sf[1];
m->sf.sf[2].sym=sym;
m->sf.sf[2].freq=1;
m->sf.sf_next=NIL;
n->hdr.sf.l.sf_next=p;
n->hdr.sf.l.freq_tot=((UINT)m->sf.sf[0].freq+(UINT)m->sf.sf[1].freq+1);
} else {
n->hdr.sf.l.freq_tot++;
m=&node_heap[n->hdr.sf.l.sf_next];
while (sf_max>=NODE_SFNB) {
sf_max-=NODE_SFNB;
m=&node_heap[m->sf.sf_next];
}
sf_max++;
if (sf_max==NODE_SFNB) {
p=Node_Alloc();
m->sf.sf_next=p;
m=&node_heap[p];
m->sf.sf_next=NIL;
sf_max=0;
}
m->sf.sf[sf_max].sym=sym;
m->sf.sf[sf_max].freq=1;
}
#ifdef DEBUG
Context_Print(c);
#endif
}
#ifdef STAT
int hash_nb=1;
int hash_cnt=0;
#endif
/*
* Recherche d'un contexte, utilisation de façon implicite de sym_context
* et de sym_hash.
* C'est une procédure très critique qui doit être particulièrement optimisée
*/
UINT ppm_worker::Context_Search(int order) {
UCHAR *sym;
UINT i,p;
NODE *n;
#ifdef DEBUG
printf("Context_Search: o=%d\n",order);
#endif
p=hash_table[sym_hash[order]];
sym=&sym_context[1];
#ifdef STAT
hash_nb++;
#endif
while (p<HASH_ADDRESS) {
#ifdef STAT
hash_cnt++;
#endif
n=&node_heap[p];
if (n->hdr.order==order) {
if (order==0) return p;
i=0;
while (sym[i]==n->hdr.sym[i]) {
i++;
if (i==order) return p;
}
}
p=n->hdr.hash_next;
}
return HASH_ADDRESS;
}
/*
* Cette macro est HORRIBLE mais permet de simplifier beaucoup le parcours
* des listes de couples symbole,fréquence tout en ayant un code rapide.
* Une alternative élégante mais lente aurait été de passer une fonction
* en paramètre contenant le code à exécuter
*/
#define SF_Read(n,p,code_to_execute) \
{\
UINT nb,i;\
nb=(UINT)n->hdr.sf_max+1;\
if (nb<=HDR_SFNB) {\
p=&n->hdr.sf.sf[0];\
} else {\
p=&node_heap[n->hdr.sf.l.sf_next].sf.sf[0];\
while (nb>NODE_SFNB) {\
for(i=0;i<NODE_SFNB;i++) {\
code_to_execute;\
p++;\
}\
p=&node_heap[ *((USHORT *)p) ].sf.sf[0];\
nb-=NODE_SFNB;\
}\
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
@@ -1,108 +1,116 @@
/*
* Interface pour le programme de compression
* (c) 1995 Fabrice Bellard
*/
#include <stdlib.h>
//#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
+#include "static.h"
/***************************************************************************
* Interface avec les routines de compression
*/
#define METHOD_NB 2 /* nombre total de méthodes de compression */
#define METHOD_STORE 0
#define METHOD_PPM 1
#define DEFAULT_SUFFIX ".st" /* extension par défault */
/* signature en début de fichier */
#define STAT_MAGIC_SIZE 4
char stat_magic[STAT_MAGIC_SIZE]={'P','P','M','S'};
#include "ppm_expander.h"
ppm_expander::~ppm_expander() {
if (needppmend) ppm.PPM_End();
ppm.arith.Arith_DecodeEnd();
if (buf_in!=NULL) delete [] buf_in;
if (buf_out!=NULL) delete [] buf_out;
if (my_read_buf != NULL) delete my_read_buf;
if (my_file_in != NULL) fclose(my_file_in);
}
int ppm_expander::OpenFile(const char* infile)
{
my_file_in=fopen(infile,"rb");
my_read_buf = new PPM_ReadBuf(my_file_in);
return home();
}
void ppm_expander::sizes(unsigned long& file, unsigned long& text)
{
struct stat _stat;
fstat(fileno(my_file_in),&_stat);
file = _stat.st_size;
text = numblocks*blocksize;
}
int ppm_expander::home()
{
fseek(my_file_in,0, SEEK_SET);
unsigned char header[STAT_MAGIC_SIZE];
size_t len=fread(header,1,STAT_MAGIC_SIZE,my_file_in);
if (strncmp((char*)header,stat_magic,STAT_MAGIC_SIZE)!=0) {
return 1;
}
if (len!=(STAT_MAGIC_SIZE)) {
return 1;
}
if (fread(&maxnode,sizeof(maxnode),1,my_file_in) != 1) return 1;
if (fread(&blocksize,sizeof(blocksize),1,my_file_in) != 1) return 1;
if (fread(&numblocks,sizeof(numblocks),1,my_file_in) != 1) return 1;
//fprintf(stderr,"<%u,%u,%u>\n",maxnode,blocksize,numblocks);
- int err = locate(0,0);
+ locate(0,0);
outbytes = 0;
- return err;
+ return 0;
}
void ppm_expander::locate(unsigned int n) {
locate(n/blocksize, n%blocksize);
outbytes = n;
}
-int ppm_expander::locate(unsigned short block, unsigned int n)
+void ppm_expander::locate(unsigned short block, unsigned int n)
{
if (needppmend)
{
ppm.PPM_End();
needppmend = false;
}
size_t fpos;
fseek(my_file_in,STAT_MAGIC_SIZE+sizeof(maxnode)+sizeof(blocksize)+sizeof(numblocks)+block*sizeof(fpos),SEEK_SET);
- if (fread(&fpos,sizeof(fpos),1,my_file_in) != 1) return 1;
+ fread(&fpos,sizeof(fpos),1,my_file_in);
fseek(my_file_in,fpos,SEEK_SET);
ppm.arith.Arith_DecodeInit(my_read_buf,buf_in,bufsize);
int err=ppm.PPM_Init(maxnode);
needppmend = true;
curblock = block;
for (int i = 0; i < n; i++) getch();
}
int ppm_expander::getch() {
if (curblock >= numblocks) return EOF;
int c=ppm.PPM_Decode();
if (c == SYM_EOF)
{
if (++curblock >= numblocks) return EOF;
locate(curblock,0);
c = ppm.PPM_Decode();
}
outbytes++;
return (c==SYM_EOF) ? EOF : c;
}
+
+#ifndef __STATIC
+extern "C"
+{
+ CExpander* newcodec() { return new ppm_expander; }
+}
+#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,61 +1,62 @@
#ifndef __ppm_expander_h
#define __ppm_expander_h
#include "useqpe.h"
#include "CExpander.h"
#include <sys/stat.h>
#include "utypes.h"
#include "ppm.h"
#include "arith.h"
#define SYM_EOF 256
class ppm_expander : public CExpander {
UCHAR *buf_in,*buf_out;
unsigned int bufsize;
unsigned int outbytes;
unsigned long blocksize;
unsigned short numblocks;
unsigned short curblock;
unsigned short maxnode;
bool needppmend;
int home();
FILE* my_file_in;
PPM_ReadBuf* my_read_buf;
ppm_worker ppm;
public:
+ QString about() { return QString("ppms Codec (c) Tim Wentford\nCompression code (c) Fabrice Bellard"); }
#ifdef USEQPE
void suspend()
{
CExpander::suspend(my_file_in);
}
void unsuspend()
{
CExpander::unsuspend(my_file_in);
}
#endif
ppm_expander() : needppmend(false), my_file_in(NULL), my_read_buf(NULL)
{
bufsize = 1024;
buf_in = new UCHAR[bufsize];
buf_out = new UCHAR[bufsize];
outbytes = 0;
}
int OpenFile(const char* infile);
int getch();
- int locate(unsigned short block, unsigned int n);
+ void locate(unsigned short block, unsigned int n);
virtual ~ppm_expander();
unsigned int locate() { return outbytes; }
void locate(unsigned int n);
bool hasrandomaccess() { return (numblocks > 1); }
void sizes(unsigned long& file, unsigned long& text);
MarkupType PreferredMarkup()
{
return cTEXT;
}
};
#endif
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 @@
+#############################################################################
+# Makefile for building: libppms.so.1.0.0
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:41:16 2004
+# Project: ppmsCodec.pro
+# Template: lib
+# Command: $(QMAKE) -o ppmsCodec.mak ppmsCodec.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS = -shared -Wl,-soname,libppms.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_codec -lqt-mt -lXext -lX11 -lm -lpthread
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+OBJECTS = QREADEROBJS/ppm_expander.o \
+ QREADEROBJS/ppm.o \
+ QREADEROBJS/arith_d.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST = ppmsCodec.pro
+QMAKE_TARGET = ppms
+DESTDIR = $(READERDIR)/codecs/
+TARGET = libppms.so.1.0.0
+TARGETA = $(READERDIR)/codecs/libppms.a
+TARGETD = libppms.so.1.0.0
+TARGET0 = libppms.so
+TARGET1 = libppms.so.1
+TARGET2 = libppms.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: ppmsCodec.mak $(READERDIR)/codecs/$(TARGET)
+
+$(READERDIR)/codecs/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)
+ test -d $(READERDIR)/codecs/ || mkdir -p $(READERDIR)/codecs/
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET1)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET2)
+ -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(READERDIR)/codecs/
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+ppmsCodec.mak: ppmsCodec.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o ppmsCodec.mak ppmsCodec.pro
+qmake:
+ @$(QMAKE) -o ppmsCodec.mak ppmsCodec.pro
+
+dist:
+ @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
+
+mocclean:
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean:
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET) $(TARGET)
+ -$(DEL_FILE) $(READERDIR)/codecs/$(TARGET0) $(READERDIR)/codecs/$(TARGET1) $(READERDIR)/codecs/$(TARGET2) $(TARGETA)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/ppm_expander.o: ppm_expander.cpp QREADERINC/static.h \
+ ppm_expander.h \
+ QREADERINC/useqpe.h \
+ CExpander.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ppm_expander.o ppm_expander.cpp
+
+QREADEROBJS/ppm.o: ppm.cpp arith.h \
+ ppm.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ppm.o ppm.cpp
+
+QREADEROBJS/arith_d.o: arith_d.cpp arith.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/arith_d.o arith_d.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building libppms.so.1.0.0
+# Generated by tmake at 15:14, 2004/05/08
+# Project: ppmsCodec.opro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -fPIC -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libppms.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+OBJECTS = OREADEROBJS/ppm_expander.o \
+ OREADEROBJS/ppm.o \
+ OREADEROBJS/arith_d.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libppms.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libppms.a
+TARGETD = libppms.so.1.0.0
+TARGET0 = libppms.so
+TARGET1 = libppms.so.1
+TARGET2 = libppms.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: ppmsCodec.omak
+
+ppmsCodec.omak: ppmsCodec.opro
+ tmake ppmsCodec.opro -o ppmsCodec.omak
+
+dist:
+ $(TAR) ppmsCodec.opro.tar ppmsCodec.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) ppmsCodec.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/ppm_expander.o: ppm_expander.cpp \
+ OREADERINC/static.h \
+ ppm_expander.h \
+ OREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ utypes.h \
+ ppm.h \
+ arith.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ppm_expander.o ppm_expander.cpp
+
+OREADEROBJS/ppm.o: ppm.cpp \
+ arith.h \
+ utypes.h \
+ ppm.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ppm.o ppm.cpp
+
+OREADEROBJS/arith_d.o: arith_d.cpp \
+ arith.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/arith_d.o arith_d.cpp
+
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 @@
+#############################################################################
+# Makefile for building libppms.so.1.0.0
+# Generated by tmake at 23:23, 2004/03/09
+# Project: ppmsCodec.wpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS = -shared -Wl,-soname,libppms.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+OBJECTS = WSREADEROBJS/ppm_expander.o \
+ WSREADEROBJS/ppm.o \
+ WSREADEROBJS/arith_d.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libppms.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libppms.a
+TARGETD = libppms.so.1.0.0
+TARGET0 = libppms.so
+TARGET1 = libppms.so.1
+TARGET2 = libppms.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: ppmsCodec.wmak
+
+ppmsCodec.wmak: ppmsCodec.wpro
+ tmake ppmsCodec.wpro -o ppmsCodec.wmak
+
+dist:
+ $(TAR) ppmsCodec.wpro.tar ppmsCodec.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) ppmsCodec.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/ppm_expander.o: ppm_expander.cpp \
+ WSREADERINC/static.h \
+ ppm_expander.h \
+ WSREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ utypes.h \
+ ppm.h \
+ arith.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ppm_expander.o ppm_expander.cpp
+
+WSREADEROBJS/ppm.o: ppm.cpp \
+ arith.h \
+ utypes.h \
+ ppm.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ppm.o ppm.cpp
+
+WSREADEROBJS/arith_d.o: arith_d.cpp \
+ arith.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/arith_d.o arith_d.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = Aportis.h
+
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = ppms
+LIBS += -lreader_codec
+
+OBJECTS_DIR = WSREADEROBJS
+MOC_DIR = WSREADERMOCS
+INCLUDEPATH += WSREADERINC
+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 @@
+#############################################################################
+# Makefile for building libppms.so.1.0.0
+# Generated by tmake at 15:17, 2004/05/08
+# Project: ppmsCodec.zpro
+# Template: lib
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -fPIC -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fPIC -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS = -shared -Wl,-soname,libppms.so.1
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lreader_codec -lqte
+AR = arm-linux-ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+OBJECTS = ZREADEROBJS/ppm_expander.o \
+ ZREADEROBJS/ppm.o \
+ ZREADEROBJS/arith_d.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC =
+OBJMOC =
+DIST =
+TARGET = libppms.so.1.0.0
+TARGETA = $(QTDIR)/plugins/reader/codecs/libppms.a
+TARGETD = libppms.so.1.0.0
+TARGET0 = libppms.so
+TARGET1 = libppms.so.1
+TARGET2 = libppms.so.1.0
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0
+
+$(QTDIR)/plugins/reader/codecs/libppms.so.1.0.0: $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ -rm -f $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET0)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET1)
+ -rm -f $(QTDIR)/plugins/reader/codecs/$(TARGET2)
+ -mv $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(QTDIR)/plugins/reader/codecs/
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ -rm -f $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+
+moc: $(SRCMOC)
+
+tmake: ppmsCodec.zmak
+
+ppmsCodec.zmak: ppmsCodec.zpro
+ tmake ppmsCodec.zpro -o ppmsCodec.zmak
+
+dist:
+ $(TAR) ppmsCodec.zpro.tar ppmsCodec.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) ppmsCodec.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/ppm_expander.o: ppm_expander.cpp \
+ ZREADERINC/static.h \
+ ppm_expander.h \
+ ZREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ utypes.h \
+ ppm.h \
+ arith.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ppm_expander.o ppm_expander.cpp
+
+ZREADEROBJS/ppm.o: ppm.cpp \
+ arith.h \
+ utypes.h \
+ ppm.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ppm.o ppm.cpp
+
+ZREADEROBJS/arith_d.o: arith_d.cpp \
+ arith.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/arith_d.o arith_d.cpp
+
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 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = Aportis.h
+
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+
+INTERFACES =
+DESTDIR = $(QTDIR)/plugins/reader/codecs
+TARGET = ppms
+LIBS += -lreader_codec
+
+OBJECTS_DIR = ZREADEROBJS
+MOC_DIR = ZREADERMOCS
+INCLUDEPATH += ZREADERINC
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = lib
+CONFIG = qt warn_on release dll
+HEADERS = Aportis.h
+
+SOURCES = ppm_expander.cpp \
+ ppm.cpp \
+ arith_d.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/plugins/reader/codecs
+TARGET = ppms
+LIBS += -lreader_codec
+
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+
+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 @@
+#include "useqpe.h"
+#ifndef USEQPE
+
+#include "preferences.h"
+
+#include <qfile.h>
+#include <qtextstream.h>
+
+Config::Config(const QString& _fn) : fname(_fn)
+{
+// qDebug("Config::Config:%s", (const char*)fname);
+ QFile fl(fname);
+ if (fl.open(IO_ReadOnly))
+ {
+ QTextStream t(&fl);
+ QString key, value;
+ while (!t.eof())
+ {
+ QString data = t.readLine();
+ int colon = data.find(':');
+ if (colon > 0)
+ {
+ QString key = data.left(colon);
+ QString value = data.right(data.length()-colon-1);
+ values[key] = value;
+ }
+ }
+ fl.close();
+ }
+// read entries into values
+}
+Config::~Config()
+{
+// qDebug("Config::~Config:%s", (const char*)fname);
+ QFile fl(fname);
+ if (fl.open(IO_WriteOnly))
+ {
+ QTextStream t(&fl);
+ for (QMap<QString,QString>::Iterator iter = values.begin();
+ iter != values.end();
+ iter++)
+ {
+ t << iter.key() << ':' << iter.data() << '\n';
+ }
+ fl.close();
+ }
+}
+QString Config::readEntry(const QString& key, const QString& deflt)
+{
+ QMap<QString,QString>::Iterator iter = values.find(key);
+ if (iter != values.end())
+ {
+ return iter.data();
+ }
+ else
+ {
+ return deflt;
+ }
+}
+bool Config::readBoolEntry(const QString& key, const bool deflt)
+{
+ bool ok;
+ QMap<QString,QString>::Iterator iter = values.find(key);
+ if (iter != values.end())
+ {
+ int ret = iter.data().toInt(&ok);
+ return ((ok) ? !!ret : deflt);
+ }
+ else
+ {
+ return deflt;
+ }
+}
+int Config::readNumEntry(const QString& key, const int deflt)
+{
+ bool ok;
+ QMap<QString,QString>::Iterator iter = values.find(key);
+ if (iter != values.end())
+ {
+ int ret = iter.data().toInt(&ok);
+ return ((ok) ? ret : deflt);
+ }
+ else
+ {
+ return deflt;
+ }
+}
+void Config::writeEntry(const QString& key, const QString& value)
+{
+ values[key] = value;
+}
+
+void Config::writeEntry(const QString& key, const bool value)
+{
+ values[key] = (value) ? "1" : "0";
+}
+
+void Config::writeEntry(const QString& key, const int value)
+{
+ QString rhs;
+ rhs.setNum(value);
+ values[key] = rhs;
+}
+
+#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 @@
+#include "useqpe.h"
+#ifndef USEQPE
+#ifndef __PREFERENCES_H
+#define __PREFERENCES_H
+
+#include <qstring.h>
+#include <qmap.h>
+
+class Config
+{
+ QMap<QString, QString> values;
+ QString fname;
+ public:
+ Config(const QString& fname);
+ ~Config();
+ void setGroup(const QString& s) { }
+ QString readEntry(const QString&, const QString&);
+ bool readBoolEntry(const QString&, const bool);
+ int readNumEntry(const QString&, const int);
+
+ void writeEntry(const QString&, const QString&);
+ void writeEntry(const QString&, const bool);
+ void writeEntry(const QString&, const int);
+};
+
+#endif // PREFERENCES
+#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 @@
+#############################################################################
+# Makefile for building: ../bin/uqtreader
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 08:41:42 2004
+# Project: reader.pro
+# Template: app
+# Command: $(QMAKE) -o reader.mak reader.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG
+CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQREADERINC -I$(QTDIR)/include -IQREADERMOCS/
+LINK = g++
+LFLAGS =
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(READERDIR)/lib -lreader_codec -lqt-mt -lXext -lX11 -lm
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QREADEROBJS/
+
+####### Files
+
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StyleConsts.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ cbkmkselector.h \
+ config.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ QREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ preferences.h \
+ usenef.h \
+ QREADERINC/useqpe.h \
+ ustring.h \
+ util.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ preferences.cpp \
+ util.cpp \
+ version.cpp
+OBJECTS = QREADEROBJS/BuffDoc.o \
+ QREADEROBJS/ButtonPrefs.o \
+ QREADEROBJS/CAnnoEdit.o \
+ QREADEROBJS/CDrawBuffer.o \
+ QREADEROBJS/CEncoding.o \
+ QREADEROBJS/CEncoding_tables.o \
+ QREADEROBJS/CFilter.o \
+ QREADEROBJS/CRegExp.o \
+ QREADEROBJS/CloseDialog.o \
+ QREADEROBJS/FontControl.o \
+ QREADEROBJS/GraphicWin.o \
+ QREADEROBJS/Prefs.o \
+ QREADEROBJS/QTReader.o \
+ QREADEROBJS/QTReaderApp.o \
+ QREADEROBJS/QtrListView.o \
+ QREADEROBJS/ToolbarPrefs.o \
+ QREADEROBJS/URLDialog.o \
+ QREADEROBJS/infowin.o \
+ QREADEROBJS/main.o \
+ QREADEROBJS/orkey.o \
+ QREADEROBJS/preferences.o \
+ QREADEROBJS/util.o \
+ QREADEROBJS/version.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC = QREADERMOCS/moc_ButtonPrefs.cpp \
+ QREADERMOCS/moc_CAnnoEdit.cpp \
+ QREADERMOCS/moc_CloseDialog.cpp \
+ QREADERMOCS/moc_GraphicWin.cpp \
+ QREADERMOCS/moc_Prefs.cpp \
+ QREADERMOCS/moc_QFloatBar.cpp \
+ QREADERMOCS/moc_QTReader.cpp \
+ QREADERMOCS/moc_QTReaderApp.cpp \
+ QREADERMOCS/moc_QtrListView.cpp \
+ QREADERMOCS/moc_ToolbarPrefs.cpp \
+ QREADERMOCS/moc_URLDialog.cpp \
+ QREADERMOCS/moc_cbkmkselector.cpp \
+ QREADERMOCS/moc_infowin.cpp
+OBJMOC = QREADEROBJS/moc_ButtonPrefs.o \
+ QREADEROBJS/moc_CAnnoEdit.o \
+ QREADEROBJS/moc_CloseDialog.o \
+ QREADEROBJS/moc_GraphicWin.o \
+ QREADEROBJS/moc_Prefs.o \
+ QREADEROBJS/moc_QFloatBar.o \
+ QREADEROBJS/moc_QTReader.o \
+ QREADEROBJS/moc_QTReaderApp.o \
+ QREADEROBJS/moc_QtrListView.o \
+ QREADEROBJS/moc_ToolbarPrefs.o \
+ QREADEROBJS/moc_URLDialog.o \
+ QREADEROBJS/moc_cbkmkselector.o \
+ QREADEROBJS/moc_infowin.o
+DIST = reader.pro
+QMAKE_TARGET = uqtreader
+DESTDIR = ../bin/
+TARGET = ../bin/uqtreader
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: reader.mak $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ test -d ../bin/ || mkdir -p ../bin/
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+reader.mak: reader.pro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o reader.mak reader.pro
+qmake:
+ @$(QMAKE) -o reader.mak reader.pro
+
+dist:
+ @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
+
+mocclean:
+ -$(DEL_FILE) $(OBJMOC)
+ -$(DEL_FILE) $(SRCMOC)
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean: mocclean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) ../bin/$(TARGET) $(TARGET)
+
+
+FORCE:
+
+####### Compile
+
+QREADEROBJS/BuffDoc.o: BuffDoc.cpp QREADERINC/static.h \
+ names.h \
+ BuffDoc.h \
+ config.h \
+ CDrawBuffer.h \
+ ZText.h \
+ ebookcodec.h \
+ QREADERINC/useqpe.h \
+ Aportis.h \
+ CHM.h \
+ ppm_expander.h \
+ ztxt.h \
+ plucker.h \
+ iSilo.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ ustring.h \
+ CEncoding.h \
+ Markups.h \
+ CEncoding_tables.h \
+ pdb.h \
+ chm_lib.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ plucker_base.h \
+ Navigation.h \
+ hrule.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/BuffDoc.o BuffDoc.cpp
+
+QREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp
+
+QREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp
+
+QREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp CDrawBuffer.h \
+ FontControl.h \
+ QREADERINC/useqpe.h \
+ QREADERINC/opie.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp
+
+QREADEROBJS/CEncoding.o: CEncoding.cpp CEncoding.h \
+ CExpander.h \
+ CEncoding_tables.h \
+ QREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CEncoding.o CEncoding.cpp
+
+QREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp CEncoding_tables.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp
+
+QREADEROBJS/CFilter.o: CFilter.cpp QREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ CFilter.h \
+ hrule.h \
+ Bkmks.h \
+ QTReader.h \
+ CRegExp.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CExpander.h \
+ CEncoding.h \
+ QREADERINC/static.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h \
+ Filedata.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ hash.h \
+ Queue.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CFilter.o CFilter.cpp
+
+QREADEROBJS/CRegExp.o: CRegExp.cpp CRegExp.h \
+ config.h \
+ hash.h \
+ Queue.h \
+ ustring.h \
+ my_list.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CRegExp.o CRegExp.cpp
+
+QREADEROBJS/CloseDialog.o: CloseDialog.cpp CloseDialog.h \
+ QREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/CloseDialog.o CloseDialog.cpp
+
+QREADEROBJS/FontControl.o: FontControl.cpp QREADERINC/opie.h \
+ QREADERINC/useqpe.h \
+ FontControl.h \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/FontControl.o FontControl.cpp
+
+QREADEROBJS/GraphicWin.o: GraphicWin.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/GraphicWin.o GraphicWin.cpp
+
+QREADEROBJS/Prefs.o: Prefs.cpp Prefs.h \
+ CEncoding_tables.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/Prefs.o Prefs.cpp
+
+QREADEROBJS/QTReader.o: QTReader.cpp QREADERINC/useqpe.h \
+ config.h \
+ QTReader.h \
+ CDrawBuffer.h \
+ ustring.h \
+ QREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ CEncoding.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/QTReader.o QTReader.cpp
+
+QREADEROBJS/QTReaderApp.o: QTReaderApp.cpp QREADERINC/useqpe.h \
+ QTReader.h \
+ GraphicWin.h \
+ Bkmks.h \
+ cbkmkselector.h \
+ infowin.h \
+ ToolbarPrefs.h \
+ Prefs.h \
+ CAnnoEdit.h \
+ QFloatBar.h \
+ FixedFont.h \
+ URLDialog.h \
+ util.h \
+ QREADERINC/opie.h \
+ fileBrowser.h \
+ QTReaderApp.h \
+ CDrawBuffer.h \
+ Filedata.h \
+ names.h \
+ CEncoding_tables.h \
+ CloseDialog.h \
+ ButtonPrefs.h \
+ QREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CEncoding.h \
+ Markups.h \
+ Navigation.h \
+ preferences.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/QTReaderApp.o QTReaderApp.cpp
+
+QREADEROBJS/QtrListView.o: QtrListView.cpp QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/QtrListView.o QtrListView.cpp
+
+QREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp QREADERINC/useqpe.h \
+ ToolbarPrefs.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp
+
+QREADEROBJS/URLDialog.o: URLDialog.cpp URLDialog.h \
+ QREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/URLDialog.o URLDialog.cpp
+
+QREADEROBJS/infowin.o: infowin.cpp infowin.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/infowin.o infowin.cpp
+
+QREADEROBJS/main.o: main.cpp QREADERINC/useqpe.h \
+ QTReaderApp.h \
+ CExpander.h \
+ CEncoding.h \
+ orkey.h \
+ BGType.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/main.o main.cpp
+
+QREADEROBJS/orkey.o: orkey.cpp orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/orkey.o orkey.cpp
+
+QREADEROBJS/preferences.o: preferences.cpp QREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/preferences.o preferences.cpp
+
+QREADEROBJS/util.o: util.cpp util.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/util.o util.cpp
+
+QREADEROBJS/version.o: version.cpp version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/version.o version.cpp
+
+QREADEROBJS/moc_ButtonPrefs.o: QREADERMOCS/moc_ButtonPrefs.cpp ButtonPrefs.h orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_ButtonPrefs.o QREADERMOCS/moc_ButtonPrefs.cpp
+
+QREADEROBJS/moc_CAnnoEdit.o: QREADERMOCS/moc_CAnnoEdit.cpp CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_CAnnoEdit.o QREADERMOCS/moc_CAnnoEdit.cpp
+
+QREADEROBJS/moc_CloseDialog.o: QREADERMOCS/moc_CloseDialog.cpp CloseDialog.h QREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_CloseDialog.o QREADERMOCS/moc_CloseDialog.cpp
+
+QREADEROBJS/moc_GraphicWin.o: QREADERMOCS/moc_GraphicWin.cpp GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_GraphicWin.o QREADERMOCS/moc_GraphicWin.cpp
+
+QREADEROBJS/moc_Prefs.o: QREADERMOCS/moc_Prefs.cpp Prefs.h orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_Prefs.o QREADERMOCS/moc_Prefs.cpp
+
+QREADEROBJS/moc_QFloatBar.o: QREADERMOCS/moc_QFloatBar.cpp QFloatBar.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QFloatBar.o QREADERMOCS/moc_QFloatBar.cpp
+
+QREADEROBJS/moc_QTReader.o: QREADERMOCS/moc_QTReader.cpp QTReader.h QREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ QREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CEncoding.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QTReader.o QREADERMOCS/moc_QTReader.cpp
+
+QREADEROBJS/moc_QTReaderApp.o: QREADERMOCS/moc_QTReaderApp.cpp QTReaderApp.h QREADERINC/useqpe.h \
+ CExpander.h \
+ CEncoding.h \
+ orkey.h \
+ BGType.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QTReaderApp.o QREADERMOCS/moc_QTReaderApp.cpp
+
+QREADEROBJS/moc_QtrListView.o: QREADERMOCS/moc_QtrListView.cpp QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_QtrListView.o QREADERMOCS/moc_QtrListView.cpp
+
+QREADEROBJS/moc_ToolbarPrefs.o: QREADERMOCS/moc_ToolbarPrefs.cpp ToolbarPrefs.h QREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_ToolbarPrefs.o QREADERMOCS/moc_ToolbarPrefs.cpp
+
+QREADEROBJS/moc_URLDialog.o: QREADERMOCS/moc_URLDialog.cpp URLDialog.h QREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_URLDialog.o QREADERMOCS/moc_URLDialog.cpp
+
+QREADEROBJS/moc_cbkmkselector.o: QREADERMOCS/moc_cbkmkselector.cpp cbkmkselector.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_cbkmkselector.o QREADERMOCS/moc_cbkmkselector.cpp
+
+QREADEROBJS/moc_infowin.o: QREADERMOCS/moc_infowin.cpp infowin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QREADEROBJS/moc_infowin.o QREADERMOCS/moc_infowin.cpp
+
+QREADERMOCS/moc_ButtonPrefs.cpp: $(MOC) ButtonPrefs.h
+ $(MOC) ButtonPrefs.h -o QREADERMOCS/moc_ButtonPrefs.cpp
+
+QREADERMOCS/moc_CAnnoEdit.cpp: $(MOC) CAnnoEdit.h
+ $(MOC) CAnnoEdit.h -o QREADERMOCS/moc_CAnnoEdit.cpp
+
+QREADERMOCS/moc_CloseDialog.cpp: $(MOC) CloseDialog.h
+ $(MOC) CloseDialog.h -o QREADERMOCS/moc_CloseDialog.cpp
+
+QREADERMOCS/moc_GraphicWin.cpp: $(MOC) GraphicWin.h
+ $(MOC) GraphicWin.h -o QREADERMOCS/moc_GraphicWin.cpp
+
+QREADERMOCS/moc_Prefs.cpp: $(MOC) Prefs.h
+ $(MOC) Prefs.h -o QREADERMOCS/moc_Prefs.cpp
+
+QREADERMOCS/moc_QFloatBar.cpp: $(MOC) QFloatBar.h
+ $(MOC) QFloatBar.h -o QREADERMOCS/moc_QFloatBar.cpp
+
+QREADERMOCS/moc_QTReader.cpp: $(MOC) QTReader.h
+ $(MOC) QTReader.h -o QREADERMOCS/moc_QTReader.cpp
+
+QREADERMOCS/moc_QTReaderApp.cpp: $(MOC) QTReaderApp.h
+ $(MOC) QTReaderApp.h -o QREADERMOCS/moc_QTReaderApp.cpp
+
+QREADERMOCS/moc_QtrListView.cpp: $(MOC) QtrListView.h
+ $(MOC) QtrListView.h -o QREADERMOCS/moc_QtrListView.cpp
+
+QREADERMOCS/moc_ToolbarPrefs.cpp: $(MOC) ToolbarPrefs.h
+ $(MOC) ToolbarPrefs.h -o QREADERMOCS/moc_ToolbarPrefs.cpp
+
+QREADERMOCS/moc_URLDialog.cpp: $(MOC) URLDialog.h
+ $(MOC) URLDialog.h -o QREADERMOCS/moc_URLDialog.cpp
+
+QREADERMOCS/moc_cbkmkselector.cpp: $(MOC) cbkmkselector.h
+ $(MOC) cbkmkselector.h -o QREADERMOCS/moc_cbkmkselector.cpp
+
+QREADERMOCS/moc_infowin.cpp: $(MOC) infowin.h
+ $(MOC) infowin.h -o QREADERMOCS/moc_infowin.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+#############################################################################
+# Makefile for building $(QPEDIR)/bin/reader
+# Generated by tmake at 15:14, 2004/05/08
+# Project: reader.opro
+# Template: app
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O3 -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O3 -DNO_DEBUG
+INCPATH = -IOREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS =
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqpe -lreader_codec -lpng12 -ljpeg -lz -lqte
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Coder.h \
+ CSource.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ PPMd.h \
+ PPMdType.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ SubAlloc.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ arrierego.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ nef.h \
+ OREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ usenef.h \
+ OREADERINC/useqpe.h \
+ ustring.h \
+ util.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ fileBrowser.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ util.cpp \
+ version.cpp
+OBJECTS = OREADEROBJS/BuffDoc.o \
+ OREADEROBJS/ButtonPrefs.o \
+ OREADEROBJS/CAnnoEdit.o \
+ OREADEROBJS/CDrawBuffer.o \
+ OREADEROBJS/CEncoding.o \
+ OREADEROBJS/CEncoding_tables.o \
+ OREADEROBJS/CFilter.o \
+ OREADEROBJS/CRegExp.o \
+ OREADEROBJS/CloseDialog.o \
+ OREADEROBJS/FontControl.o \
+ OREADEROBJS/Prefs.o \
+ OREADEROBJS/QTReader.o \
+ OREADEROBJS/QTReaderApp.o \
+ OREADEROBJS/QtrListView.o \
+ OREADEROBJS/ToolbarPrefs.o \
+ OREADEROBJS/URLDialog.o \
+ OREADEROBJS/fileBrowser.o \
+ OREADEROBJS/infowin.o \
+ OREADEROBJS/main.o \
+ OREADEROBJS/orkey.o \
+ OREADEROBJS/util.o \
+ OREADEROBJS/version.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = OREADERMOCS/moc_ButtonPrefs.cpp \
+ OREADERMOCS/moc_CAnnoEdit.cpp \
+ OREADERMOCS/moc_CloseDialog.cpp \
+ OREADERMOCS/moc_GraphicWin.cpp \
+ OREADERMOCS/moc_Prefs.cpp \
+ OREADERMOCS/moc_QFloatBar.cpp \
+ OREADERMOCS/moc_QTReader.cpp \
+ OREADERMOCS/moc_QTReaderApp.cpp \
+ OREADERMOCS/moc_QtrListView.cpp \
+ OREADERMOCS/moc_ToolbarPrefs.cpp \
+ OREADERMOCS/moc_URLDialog.cpp \
+ OREADERMOCS/moc_cbkmkselector.cpp \
+ OREADERMOCS/moc_fileBrowser.cpp \
+ OREADERMOCS/moc_infowin.cpp
+OBJMOC = OREADEROBJS/moc_ButtonPrefs.o \
+ OREADEROBJS/moc_CAnnoEdit.o \
+ OREADEROBJS/moc_CloseDialog.o \
+ OREADEROBJS/moc_GraphicWin.o \
+ OREADEROBJS/moc_Prefs.o \
+ OREADEROBJS/moc_QFloatBar.o \
+ OREADEROBJS/moc_QTReader.o \
+ OREADEROBJS/moc_QTReaderApp.o \
+ OREADEROBJS/moc_QtrListView.o \
+ OREADEROBJS/moc_ToolbarPrefs.o \
+ OREADEROBJS/moc_URLDialog.o \
+ OREADEROBJS/moc_cbkmkselector.o \
+ OREADEROBJS/moc_fileBrowser.o \
+ OREADEROBJS/moc_infowin.o
+DIST =
+TARGET = $(QPEDIR)/bin/reader
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake: reader.omak
+
+reader.omak: reader.opro
+ tmake reader.opro -o reader.omak
+
+dist:
+ $(TAR) reader.opro.tar reader.opro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) reader.opro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+OREADEROBJS/BuffDoc.o: BuffDoc.cpp \
+ OREADERINC/static.h \
+ names.h \
+ BuffDoc.h \
+ OREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZText.h \
+ ebookcodec.h \
+ Aportis.h \
+ pdb.h \
+ CHM.h \
+ chm_lib.h \
+ ppm_expander.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ ztxt.h \
+ plucker.h \
+ plucker_base.h \
+ Navigation.h \
+ hrule.h \
+ nef.h \
+ usenef.h \
+ arrierego.h \
+ iSilo.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/BuffDoc.o BuffDoc.cpp
+
+OREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp
+
+OREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp
+
+OREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ FontControl.h \
+ OREADERINC/useqpe.h \
+ OREADERINC/opie.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp
+
+OREADEROBJS/CEncoding.o: CEncoding.cpp \
+ CEncoding.h \
+ CExpander.h \
+ OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CEncoding.o CEncoding.cpp
+
+OREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \
+ CEncoding_tables.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp
+
+OREADEROBJS/CFilter.o: CFilter.cpp \
+ OREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ OREADERINC/static.h \
+ hrule.h \
+ Bkmks.h \
+ Filedata.h \
+ QTReader.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ CRegExp.h \
+ hash.h \
+ Queue.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CFilter.o CFilter.cpp
+
+OREADEROBJS/CRegExp.o: CRegExp.cpp \
+ CRegExp.h \
+ config.h \
+ ustring.h \
+ hash.h \
+ Queue.h \
+ my_list.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CRegExp.o CRegExp.cpp
+
+OREADEROBJS/CloseDialog.o: CloseDialog.cpp \
+ CloseDialog.h \
+ OREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/CloseDialog.o CloseDialog.cpp
+
+OREADEROBJS/FontControl.o: FontControl.cpp \
+ OREADERINC/opie.h \
+ OREADERINC/useqpe.h \
+ FontControl.h \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/FontControl.o FontControl.cpp
+
+OREADEROBJS/Prefs.o: Prefs.cpp \
+ Prefs.h \
+ orkey.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/Prefs.o Prefs.cpp
+
+OREADEROBJS/QTReader.o: QTReader.cpp \
+ OREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ QTReader.h \
+ OREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/QTReader.o QTReader.cpp
+
+OREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \
+ OREADERINC/useqpe.h \
+ QTReader.h \
+ OREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ GraphicWin.h \
+ Bkmks.h \
+ Filedata.h \
+ cbkmkselector.h \
+ infowin.h \
+ ToolbarPrefs.h \
+ preferences.h \
+ Prefs.h \
+ orkey.h \
+ CAnnoEdit.h \
+ QFloatBar.h \
+ FixedFont.h \
+ URLDialog.h \
+ util.h \
+ fileBrowser.h \
+ QTReaderApp.h \
+ CloseDialog.h \
+ ButtonPrefs.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/QTReaderApp.o QTReaderApp.cpp
+
+OREADEROBJS/QtrListView.o: QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/QtrListView.o QtrListView.cpp
+
+OREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \
+ OREADERINC/useqpe.h \
+ ToolbarPrefs.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp
+
+OREADEROBJS/URLDialog.o: URLDialog.cpp \
+ URLDialog.h \
+ OREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/URLDialog.o URLDialog.cpp
+
+OREADEROBJS/fileBrowser.o: fileBrowser.cpp \
+ fileBrowser.h \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/fileBrowser.o fileBrowser.cpp
+
+OREADEROBJS/infowin.o: infowin.cpp \
+ infowin.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/infowin.o infowin.cpp
+
+OREADEROBJS/main.o: main.cpp \
+ OREADERINC/useqpe.h \
+ QTReaderApp.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/main.o main.cpp
+
+OREADEROBJS/orkey.o: orkey.cpp \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/orkey.o orkey.cpp
+
+OREADEROBJS/util.o: util.cpp \
+ util.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/util.o util.cpp
+
+OREADEROBJS/version.o: version.cpp \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/version.o version.cpp
+
+OREADEROBJS/moc_ButtonPrefs.o: OREADERMOCS/moc_ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_ButtonPrefs.o OREADERMOCS/moc_ButtonPrefs.cpp
+
+OREADEROBJS/moc_CAnnoEdit.o: OREADERMOCS/moc_CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_CAnnoEdit.o OREADERMOCS/moc_CAnnoEdit.cpp
+
+OREADEROBJS/moc_CloseDialog.o: OREADERMOCS/moc_CloseDialog.cpp \
+ CloseDialog.h \
+ OREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_CloseDialog.o OREADERMOCS/moc_CloseDialog.cpp
+
+OREADEROBJS/moc_GraphicWin.o: OREADERMOCS/moc_GraphicWin.cpp \
+ GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_GraphicWin.o OREADERMOCS/moc_GraphicWin.cpp
+
+OREADEROBJS/moc_Prefs.o: OREADERMOCS/moc_Prefs.cpp \
+ Prefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_Prefs.o OREADERMOCS/moc_Prefs.cpp
+
+OREADEROBJS/moc_QFloatBar.o: OREADERMOCS/moc_QFloatBar.cpp \
+ QFloatBar.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QFloatBar.o OREADERMOCS/moc_QFloatBar.cpp
+
+OREADEROBJS/moc_QTReader.o: OREADERMOCS/moc_QTReader.cpp \
+ QTReader.h \
+ OREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ OREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QTReader.o OREADERMOCS/moc_QTReader.cpp
+
+OREADEROBJS/moc_QTReaderApp.o: OREADERMOCS/moc_QTReaderApp.cpp \
+ QTReaderApp.h \
+ OREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QTReaderApp.o OREADERMOCS/moc_QTReaderApp.cpp
+
+OREADEROBJS/moc_QtrListView.o: OREADERMOCS/moc_QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_QtrListView.o OREADERMOCS/moc_QtrListView.cpp
+
+OREADEROBJS/moc_ToolbarPrefs.o: OREADERMOCS/moc_ToolbarPrefs.cpp \
+ ToolbarPrefs.h \
+ OREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_ToolbarPrefs.o OREADERMOCS/moc_ToolbarPrefs.cpp
+
+OREADEROBJS/moc_URLDialog.o: OREADERMOCS/moc_URLDialog.cpp \
+ URLDialog.h \
+ OREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_URLDialog.o OREADERMOCS/moc_URLDialog.cpp
+
+OREADEROBJS/moc_cbkmkselector.o: OREADERMOCS/moc_cbkmkselector.cpp \
+ cbkmkselector.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_cbkmkselector.o OREADERMOCS/moc_cbkmkselector.cpp
+
+OREADEROBJS/moc_fileBrowser.o: OREADERMOCS/moc_fileBrowser.cpp \
+ fileBrowser.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_fileBrowser.o OREADERMOCS/moc_fileBrowser.cpp
+
+OREADEROBJS/moc_infowin.o: OREADERMOCS/moc_infowin.cpp \
+ infowin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o OREADEROBJS/moc_infowin.o OREADERMOCS/moc_infowin.cpp
+
+OREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h
+ $(MOC) ButtonPrefs.h -o OREADERMOCS/moc_ButtonPrefs.cpp
+
+OREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h
+ $(MOC) CAnnoEdit.h -o OREADERMOCS/moc_CAnnoEdit.cpp
+
+OREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h
+ $(MOC) CloseDialog.h -o OREADERMOCS/moc_CloseDialog.cpp
+
+OREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h
+ $(MOC) GraphicWin.h -o OREADERMOCS/moc_GraphicWin.cpp
+
+OREADERMOCS/moc_Prefs.cpp: Prefs.h
+ $(MOC) Prefs.h -o OREADERMOCS/moc_Prefs.cpp
+
+OREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h
+ $(MOC) QFloatBar.h -o OREADERMOCS/moc_QFloatBar.cpp
+
+OREADERMOCS/moc_QTReader.cpp: QTReader.h
+ $(MOC) QTReader.h -o OREADERMOCS/moc_QTReader.cpp
+
+OREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h
+ $(MOC) QTReaderApp.h -o OREADERMOCS/moc_QTReaderApp.cpp
+
+OREADERMOCS/moc_QtrListView.cpp: QtrListView.h
+ $(MOC) QtrListView.h -o OREADERMOCS/moc_QtrListView.cpp
+
+OREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h
+ $(MOC) ToolbarPrefs.h -o OREADERMOCS/moc_ToolbarPrefs.cpp
+
+OREADERMOCS/moc_URLDialog.cpp: URLDialog.h
+ $(MOC) URLDialog.h -o OREADERMOCS/moc_URLDialog.cpp
+
+OREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h
+ $(MOC) cbkmkselector.h -o OREADERMOCS/moc_cbkmkselector.cpp
+
+OREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h
+ $(MOC) fileBrowser.h -o OREADERMOCS/moc_fileBrowser.cpp
+
+OREADERMOCS/moc_infowin.cpp: infowin.h
+ $(MOC) infowin.h -o OREADERMOCS/moc_infowin.cpp
+
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 @@
+#############################################################################
+# Makefile for building: QSTATICREADEROBJS/uqtreader
+# Generated by qmake (1.06c) (Qt 3.2.3) on: Sun Jul 25 09:15:20 2004
+# Project: reader.staticpro
+# Template: app
+# Command: $(QMAKE) -o reader.staticmak reader.staticpro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+CFLAGS = -pipe -w -g
+CXXFLAGS = -pipe -w -g
+LEXFLAGS =
+YACCFLAGS= -d
+INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -IQSTATICREADERINC -I$(QTDIR)/include -IQSTATICREADERMOCS/
+LINK = g++
+LFLAGS =
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
+AR = ar cqs
+RANLIB =
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+QMAKE = qmake
+TAR = tar -cf
+GZIP = gzip -9f
+COPY = cp -f
+COPY_FILE= $(COPY)
+COPY_DIR = $(COPY) -r
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = QSTATICREADEROBJS/
+
+####### Files
+
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StyleConsts.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ QSTATICREADERINC/opie.h \
+ pdb.h \
+ plucker_base.h \
+ plucker.h \
+ ppm.h \
+ ppm_expander.h \
+ preferences.h \
+ QSTATICREADERINC/static.h \
+ usenef.h \
+ QSTATICREADERINC/useqpe.h \
+ ustring.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+SOURCES = Aportis.cpp \
+ Bkmks.cpp \
+ BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CBuffer.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CExpander.cpp \
+ CFilter.cpp \
+ CHM.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Navigation.cpp \
+ Palm2QImage.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ StyleConsts.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ arith_d.cpp \
+ chm_lib.c \
+ fileBrowser.cpp \
+ hrule.cpp \
+ infowin.cpp \
+ iSilo.cpp \
+ lzx.c \
+ main.cpp \
+ orkey.cpp \
+ pdb.cpp \
+ plucker.cpp \
+ plucker_base.cpp \
+ ppm.cpp \
+ ppm_expander.cpp \
+ preferences.cpp \
+ striphtml.cpp \
+ util.cpp \
+ version.cpp \
+ ztxt.cpp
+OBJECTS = QSTATICREADEROBJS/Aportis.o \
+ QSTATICREADEROBJS/Bkmks.o \
+ QSTATICREADEROBJS/BuffDoc.o \
+ QSTATICREADEROBJS/ButtonPrefs.o \
+ QSTATICREADEROBJS/CAnnoEdit.o \
+ QSTATICREADEROBJS/CBuffer.o \
+ QSTATICREADEROBJS/CDrawBuffer.o \
+ QSTATICREADEROBJS/CEncoding.o \
+ QSTATICREADEROBJS/CEncoding_tables.o \
+ QSTATICREADEROBJS/CExpander.o \
+ QSTATICREADEROBJS/CFilter.o \
+ QSTATICREADEROBJS/CHM.o \
+ QSTATICREADEROBJS/CRegExp.o \
+ QSTATICREADEROBJS/CloseDialog.o \
+ QSTATICREADEROBJS/FontControl.o \
+ QSTATICREADEROBJS/GraphicWin.o \
+ QSTATICREADEROBJS/Navigation.o \
+ QSTATICREADEROBJS/Palm2QImage.o \
+ QSTATICREADEROBJS/Prefs.o \
+ QSTATICREADEROBJS/QTReader.o \
+ QSTATICREADEROBJS/QTReaderApp.o \
+ QSTATICREADEROBJS/QtrListView.o \
+ QSTATICREADEROBJS/StyleConsts.o \
+ QSTATICREADEROBJS/ToolbarPrefs.o \
+ QSTATICREADEROBJS/URLDialog.o \
+ QSTATICREADEROBJS/arith_d.o \
+ QSTATICREADEROBJS/chm_lib.o \
+ QSTATICREADEROBJS/fileBrowser.o \
+ QSTATICREADEROBJS/hrule.o \
+ QSTATICREADEROBJS/infowin.o \
+ QSTATICREADEROBJS/iSilo.o \
+ QSTATICREADEROBJS/lzx.o \
+ QSTATICREADEROBJS/main.o \
+ QSTATICREADEROBJS/orkey.o \
+ QSTATICREADEROBJS/pdb.o \
+ QSTATICREADEROBJS/plucker.o \
+ QSTATICREADEROBJS/plucker_base.o \
+ QSTATICREADEROBJS/ppm.o \
+ QSTATICREADEROBJS/ppm_expander.o \
+ QSTATICREADEROBJS/preferences.o \
+ QSTATICREADEROBJS/striphtml.o \
+ QSTATICREADEROBJS/util.o \
+ QSTATICREADEROBJS/version.o \
+ QSTATICREADEROBJS/ztxt.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC = QSTATICREADERMOCS/moc_ButtonPrefs.cpp \
+ QSTATICREADERMOCS/moc_CAnnoEdit.cpp \
+ QSTATICREADERMOCS/moc_CloseDialog.cpp \
+ QSTATICREADERMOCS/moc_GraphicWin.cpp \
+ QSTATICREADERMOCS/moc_Prefs.cpp \
+ QSTATICREADERMOCS/moc_QFloatBar.cpp \
+ QSTATICREADERMOCS/moc_QTReader.cpp \
+ QSTATICREADERMOCS/moc_QTReaderApp.cpp \
+ QSTATICREADERMOCS/moc_QtrListView.cpp \
+ QSTATICREADERMOCS/moc_ToolbarPrefs.cpp \
+ QSTATICREADERMOCS/moc_URLDialog.cpp \
+ QSTATICREADERMOCS/moc_cbkmkselector.cpp \
+ QSTATICREADERMOCS/moc_fileBrowser.cpp \
+ QSTATICREADERMOCS/moc_infowin.cpp
+OBJMOC = QSTATICREADEROBJS/moc_ButtonPrefs.o \
+ QSTATICREADEROBJS/moc_CAnnoEdit.o \
+ QSTATICREADEROBJS/moc_CloseDialog.o \
+ QSTATICREADEROBJS/moc_GraphicWin.o \
+ QSTATICREADEROBJS/moc_Prefs.o \
+ QSTATICREADEROBJS/moc_QFloatBar.o \
+ QSTATICREADEROBJS/moc_QTReader.o \
+ QSTATICREADEROBJS/moc_QTReaderApp.o \
+ QSTATICREADEROBJS/moc_QtrListView.o \
+ QSTATICREADEROBJS/moc_ToolbarPrefs.o \
+ QSTATICREADEROBJS/moc_URLDialog.o \
+ QSTATICREADEROBJS/moc_cbkmkselector.o \
+ QSTATICREADEROBJS/moc_fileBrowser.o \
+ QSTATICREADEROBJS/moc_infowin.o
+DIST = reader.staticpro
+QMAKE_TARGET = uqtreader
+DESTDIR = QSTATICREADEROBJS/
+TARGET = QSTATICREADEROBJS/uqtreader
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .c .o .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+all: reader.staticmak $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ test -d QSTATICREADEROBJS/ || mkdir -p QSTATICREADEROBJS/
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+
+mocables: $(SRCMOC)
+uicables: $(UICDECLS) $(UICIMPLS)
+
+$(MOC):
+ ( cd $(QTDIR)/src/moc ; $(MAKE) )
+
+reader.staticmak: reader.staticpro /usr/lib/qt3/mkspecs/default/qmake.conf
+ $(QMAKE) -o reader.staticmak reader.staticpro
+qmake:
+ @$(QMAKE) -o reader.staticmak reader.staticpro
+
+dist:
+ @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
+
+mocclean:
+ -$(DEL_FILE) $(OBJMOC)
+ -$(DEL_FILE) $(SRCMOC)
+
+uiclean:
+
+yaccclean:
+lexclean:
+clean: mocclean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) QSTATICREADEROBJS/$(TARGET) $(TARGET)
+
+
+FORCE:
+
+####### Compile
+
+QSTATICREADEROBJS/Aportis.o: Aportis.cpp Aportis.h \
+ my_list.h \
+ Bkmks.h \
+ QSTATICREADERINC/static.h \
+ CExpander.h \
+ pdb.h \
+ QSTATICREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ Filedata.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Aportis.o Aportis.cpp
+
+QSTATICREADEROBJS/Bkmks.o: Bkmks.cpp Bkmks.h \
+ StyleConsts.h \
+ Markups.h \
+ my_list.h \
+ version.h \
+ names.h \
+ config.h \
+ Filedata.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Bkmks.o Bkmks.cpp
+
+QSTATICREADEROBJS/BuffDoc.o: BuffDoc.cpp QSTATICREADERINC/static.h \
+ names.h \
+ QSTATICREADERINC/useqpe.h \
+ usenef.h \
+ BuffDoc.h \
+ config.h \
+ CDrawBuffer.h \
+ ZText.h \
+ ebookcodec.h \
+ Aportis.h \
+ CHM.h \
+ ppm_expander.h \
+ ztxt.h \
+ plucker.h \
+ iSilo.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ ustring.h \
+ CEncoding.h \
+ Markups.h \
+ CEncoding_tables.h \
+ pdb.h \
+ chm_lib.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ plucker_base.h \
+ Navigation.h \
+ hrule.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/BuffDoc.o BuffDoc.cpp
+
+QSTATICREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp
+
+QSTATICREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp
+
+QSTATICREADEROBJS/CBuffer.o: CBuffer.cpp CBuffer.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CBuffer.o CBuffer.cpp
+
+QSTATICREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp CDrawBuffer.h \
+ FontControl.h \
+ QSTATICREADERINC/useqpe.h \
+ QSTATICREADERINC/opie.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp
+
+QSTATICREADEROBJS/CEncoding.o: CEncoding.cpp CEncoding.h \
+ CExpander.h \
+ CEncoding_tables.h \
+ QSTATICREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CEncoding.o CEncoding.cpp
+
+QSTATICREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp CEncoding_tables.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp
+
+QSTATICREADEROBJS/CExpander.o: CExpander.cpp CExpander.h \
+ QSTATICREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CExpander.o CExpander.cpp
+
+QSTATICREADEROBJS/CFilter.o: CFilter.cpp QSTATICREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ CFilter.h \
+ hrule.h \
+ Bkmks.h \
+ QTReader.h \
+ CRegExp.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CExpander.h \
+ CEncoding.h \
+ QSTATICREADERINC/static.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h \
+ Filedata.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ hash.h \
+ Queue.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CFilter.o CFilter.cpp
+
+QSTATICREADEROBJS/CHM.o: CHM.cpp CHM.h \
+ chm_lib.h \
+ QSTATICREADERINC/static.h \
+ QSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ my_list.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CHM.o CHM.cpp
+
+QSTATICREADEROBJS/CRegExp.o: CRegExp.cpp CRegExp.h \
+ config.h \
+ hash.h \
+ Queue.h \
+ ustring.h \
+ my_list.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CRegExp.o CRegExp.cpp
+
+QSTATICREADEROBJS/CloseDialog.o: CloseDialog.cpp CloseDialog.h \
+ QSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/CloseDialog.o CloseDialog.cpp
+
+QSTATICREADEROBJS/FontControl.o: FontControl.cpp QSTATICREADERINC/opie.h \
+ QSTATICREADERINC/useqpe.h \
+ FontControl.h \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/FontControl.o FontControl.cpp
+
+QSTATICREADEROBJS/GraphicWin.o: GraphicWin.cpp GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/GraphicWin.o GraphicWin.cpp
+
+QSTATICREADEROBJS/Navigation.o: Navigation.cpp Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Navigation.o Navigation.cpp
+
+QSTATICREADEROBJS/Palm2QImage.o: Palm2QImage.cpp QSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Palm2QImage.o Palm2QImage.cpp
+
+QSTATICREADEROBJS/Prefs.o: Prefs.cpp Prefs.h \
+ CEncoding_tables.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/Prefs.o Prefs.cpp
+
+QSTATICREADEROBJS/QTReader.o: QTReader.cpp QSTATICREADERINC/useqpe.h \
+ config.h \
+ QTReader.h \
+ CDrawBuffer.h \
+ ustring.h \
+ QSTATICREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ CEncoding.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/QTReader.o QTReader.cpp
+
+QSTATICREADEROBJS/QTReaderApp.o: QTReaderApp.cpp QSTATICREADERINC/useqpe.h \
+ QTReader.h \
+ GraphicWin.h \
+ Bkmks.h \
+ cbkmkselector.h \
+ infowin.h \
+ ToolbarPrefs.h \
+ Prefs.h \
+ CAnnoEdit.h \
+ QFloatBar.h \
+ FixedFont.h \
+ URLDialog.h \
+ util.h \
+ QSTATICREADERINC/opie.h \
+ fileBrowser.h \
+ QTReaderApp.h \
+ CDrawBuffer.h \
+ Filedata.h \
+ names.h \
+ CEncoding_tables.h \
+ CloseDialog.h \
+ ButtonPrefs.h \
+ QSTATICREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CEncoding.h \
+ Markups.h \
+ Navigation.h \
+ preferences.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/QTReaderApp.o QTReaderApp.cpp
+
+QSTATICREADEROBJS/QtrListView.o: QtrListView.cpp QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/QtrListView.o QtrListView.cpp
+
+QSTATICREADEROBJS/StyleConsts.o: StyleConsts.cpp StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/StyleConsts.o StyleConsts.cpp
+
+QSTATICREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp QSTATICREADERINC/useqpe.h \
+ ToolbarPrefs.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp
+
+QSTATICREADEROBJS/URLDialog.o: URLDialog.cpp URLDialog.h \
+ QSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/URLDialog.o URLDialog.cpp
+
+QSTATICREADEROBJS/arith_d.o: arith_d.cpp arith.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/arith_d.o arith_d.cpp
+
+QSTATICREADEROBJS/chm_lib.o: chm_lib.c chm_lib.h \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o QSTATICREADEROBJS/chm_lib.o chm_lib.c
+
+QSTATICREADEROBJS/fileBrowser.o: fileBrowser.cpp fileBrowser.h \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/fileBrowser.o fileBrowser.cpp
+
+QSTATICREADEROBJS/hrule.o: hrule.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/hrule.o hrule.cpp
+
+QSTATICREADEROBJS/infowin.o: infowin.cpp infowin.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/infowin.o infowin.cpp
+
+QSTATICREADEROBJS/iSilo.o: iSilo.cpp iSilo.h \
+ pdb.h \
+ QSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/iSilo.o iSilo.cpp
+
+QSTATICREADEROBJS/lzx.o: lzx.c lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o QSTATICREADEROBJS/lzx.o lzx.c
+
+QSTATICREADEROBJS/main.o: main.cpp QSTATICREADERINC/useqpe.h \
+ QTReaderApp.h \
+ CExpander.h \
+ CEncoding.h \
+ orkey.h \
+ BGType.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/main.o main.cpp
+
+QSTATICREADEROBJS/orkey.o: orkey.cpp orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/orkey.o orkey.cpp
+
+QSTATICREADEROBJS/pdb.o: pdb.cpp pdb.h \
+ QSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/pdb.o pdb.cpp
+
+QSTATICREADEROBJS/plucker.o: plucker.cpp QSTATICREADERINC/useqpe.h \
+ plucker.h \
+ Aportis.h \
+ Palm2QImage.h \
+ QSTATICREADERINC/static.h \
+ plucker_base.h \
+ CExpander.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/plucker.o plucker.cpp
+
+QSTATICREADEROBJS/plucker_base.o: plucker_base.cpp QSTATICREADERINC/useqpe.h \
+ usenef.h \
+ QSTATICREADERINC/static.h \
+ plucker_base.h \
+ Aportis.h \
+ hrule.h \
+ CExpander.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/plucker_base.o plucker_base.cpp
+
+QSTATICREADEROBJS/ppm.o: ppm.cpp arith.h \
+ ppm.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ppm.o ppm.cpp
+
+QSTATICREADEROBJS/ppm_expander.o: ppm_expander.cpp QSTATICREADERINC/static.h \
+ ppm_expander.h \
+ QSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ppm_expander.o ppm_expander.cpp
+
+QSTATICREADEROBJS/preferences.o: preferences.cpp QSTATICREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/preferences.o preferences.cpp
+
+QSTATICREADEROBJS/striphtml.o: striphtml.cpp QSTATICREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ striphtml.h \
+ hrule.h \
+ StyleConsts.h \
+ CBuffer.h \
+ my_list.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CFilter.h \
+ Navigation.h \
+ CExpander.h \
+ CEncoding.h \
+ QSTATICREADERINC/static.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/striphtml.o striphtml.cpp
+
+QSTATICREADEROBJS/util.o: util.cpp util.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/util.o util.cpp
+
+QSTATICREADEROBJS/version.o: version.cpp version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/version.o version.cpp
+
+QSTATICREADEROBJS/ztxt.o: ztxt.cpp ztxt.h \
+ my_list.h \
+ Bkmks.h \
+ QSTATICREADERINC/static.h \
+ CExpander.h \
+ pdb.h \
+ QSTATICREADERINC/useqpe.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ Filedata.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/ztxt.o ztxt.cpp
+
+QSTATICREADEROBJS/moc_ButtonPrefs.o: QSTATICREADERMOCS/moc_ButtonPrefs.cpp ButtonPrefs.h orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_ButtonPrefs.o QSTATICREADERMOCS/moc_ButtonPrefs.cpp
+
+QSTATICREADEROBJS/moc_CAnnoEdit.o: QSTATICREADERMOCS/moc_CAnnoEdit.cpp CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_CAnnoEdit.o QSTATICREADERMOCS/moc_CAnnoEdit.cpp
+
+QSTATICREADEROBJS/moc_CloseDialog.o: QSTATICREADERMOCS/moc_CloseDialog.cpp CloseDialog.h QSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_CloseDialog.o QSTATICREADERMOCS/moc_CloseDialog.cpp
+
+QSTATICREADEROBJS/moc_GraphicWin.o: QSTATICREADERMOCS/moc_GraphicWin.cpp GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_GraphicWin.o QSTATICREADERMOCS/moc_GraphicWin.cpp
+
+QSTATICREADEROBJS/moc_Prefs.o: QSTATICREADERMOCS/moc_Prefs.cpp Prefs.h orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_Prefs.o QSTATICREADERMOCS/moc_Prefs.cpp
+
+QSTATICREADEROBJS/moc_QFloatBar.o: QSTATICREADERMOCS/moc_QFloatBar.cpp QFloatBar.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QFloatBar.o QSTATICREADERMOCS/moc_QFloatBar.cpp
+
+QSTATICREADEROBJS/moc_QTReader.o: QSTATICREADERMOCS/moc_QTReader.cpp QTReader.h QSTATICREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ QSTATICREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ CFilter.h \
+ CExpander.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ config.h \
+ ustring.h \
+ CEncoding.h \
+ Markups.h \
+ names.h \
+ CEncoding_tables.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QTReader.o QSTATICREADERMOCS/moc_QTReader.cpp
+
+QSTATICREADEROBJS/moc_QTReaderApp.o: QSTATICREADERMOCS/moc_QTReaderApp.cpp QTReaderApp.h QSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ CEncoding.h \
+ orkey.h \
+ BGType.h \
+ config.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ustring.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QTReaderApp.o QSTATICREADERMOCS/moc_QTReaderApp.cpp
+
+QSTATICREADEROBJS/moc_QtrListView.o: QSTATICREADERMOCS/moc_QtrListView.cpp QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_QtrListView.o QSTATICREADERMOCS/moc_QtrListView.cpp
+
+QSTATICREADEROBJS/moc_ToolbarPrefs.o: QSTATICREADERMOCS/moc_ToolbarPrefs.cpp ToolbarPrefs.h QSTATICREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_ToolbarPrefs.o QSTATICREADERMOCS/moc_ToolbarPrefs.cpp
+
+QSTATICREADEROBJS/moc_URLDialog.o: QSTATICREADERMOCS/moc_URLDialog.cpp URLDialog.h QSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_URLDialog.o QSTATICREADERMOCS/moc_URLDialog.cpp
+
+QSTATICREADEROBJS/moc_cbkmkselector.o: QSTATICREADERMOCS/moc_cbkmkselector.cpp cbkmkselector.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_cbkmkselector.o QSTATICREADERMOCS/moc_cbkmkselector.cpp
+
+QSTATICREADEROBJS/moc_fileBrowser.o: QSTATICREADERMOCS/moc_fileBrowser.cpp fileBrowser.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_fileBrowser.o QSTATICREADERMOCS/moc_fileBrowser.cpp
+
+QSTATICREADEROBJS/moc_infowin.o: QSTATICREADERMOCS/moc_infowin.cpp infowin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QSTATICREADEROBJS/moc_infowin.o QSTATICREADERMOCS/moc_infowin.cpp
+
+QSTATICREADERMOCS/moc_ButtonPrefs.cpp: $(MOC) ButtonPrefs.h
+ $(MOC) ButtonPrefs.h -o QSTATICREADERMOCS/moc_ButtonPrefs.cpp
+
+QSTATICREADERMOCS/moc_CAnnoEdit.cpp: $(MOC) CAnnoEdit.h
+ $(MOC) CAnnoEdit.h -o QSTATICREADERMOCS/moc_CAnnoEdit.cpp
+
+QSTATICREADERMOCS/moc_CloseDialog.cpp: $(MOC) CloseDialog.h
+ $(MOC) CloseDialog.h -o QSTATICREADERMOCS/moc_CloseDialog.cpp
+
+QSTATICREADERMOCS/moc_GraphicWin.cpp: $(MOC) GraphicWin.h
+ $(MOC) GraphicWin.h -o QSTATICREADERMOCS/moc_GraphicWin.cpp
+
+QSTATICREADERMOCS/moc_Prefs.cpp: $(MOC) Prefs.h
+ $(MOC) Prefs.h -o QSTATICREADERMOCS/moc_Prefs.cpp
+
+QSTATICREADERMOCS/moc_QFloatBar.cpp: $(MOC) QFloatBar.h
+ $(MOC) QFloatBar.h -o QSTATICREADERMOCS/moc_QFloatBar.cpp
+
+QSTATICREADERMOCS/moc_QTReader.cpp: $(MOC) QTReader.h
+ $(MOC) QTReader.h -o QSTATICREADERMOCS/moc_QTReader.cpp
+
+QSTATICREADERMOCS/moc_QTReaderApp.cpp: $(MOC) QTReaderApp.h
+ $(MOC) QTReaderApp.h -o QSTATICREADERMOCS/moc_QTReaderApp.cpp
+
+QSTATICREADERMOCS/moc_QtrListView.cpp: $(MOC) QtrListView.h
+ $(MOC) QtrListView.h -o QSTATICREADERMOCS/moc_QtrListView.cpp
+
+QSTATICREADERMOCS/moc_ToolbarPrefs.cpp: $(MOC) ToolbarPrefs.h
+ $(MOC) ToolbarPrefs.h -o QSTATICREADERMOCS/moc_ToolbarPrefs.cpp
+
+QSTATICREADERMOCS/moc_URLDialog.cpp: $(MOC) URLDialog.h
+ $(MOC) URLDialog.h -o QSTATICREADERMOCS/moc_URLDialog.cpp
+
+QSTATICREADERMOCS/moc_cbkmkselector.cpp: $(MOC) cbkmkselector.h
+ $(MOC) cbkmkselector.h -o QSTATICREADERMOCS/moc_cbkmkselector.cpp
+
+QSTATICREADERMOCS/moc_fileBrowser.cpp: $(MOC) fileBrowser.h
+ $(MOC) fileBrowser.h -o QSTATICREADERMOCS/moc_fileBrowser.cpp
+
+QSTATICREADERMOCS/moc_infowin.cpp: $(MOC) infowin.h
+ $(MOC) infowin.h -o QSTATICREADERMOCS/moc_infowin.cpp
+
+####### Install
+
+install: all
+
+uninstall:
+
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 @@
+TEMPLATE = app
+CONFIG = qt warn_off debug
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StyleConsts.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ QSTATICREADERINC/opie.h \
+ pdb.h \
+ plucker_base.h \
+ plucker.h \
+ ppm.h \
+ ppm_expander.h \
+ preferences.h \
+ QSTATICREADERINC/static.h \
+ usenef.h \
+ QSTATICREADERINC/useqpe.h \
+ ustring.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+
+SOURCES = Aportis.cpp \
+ Bkmks.cpp \
+ BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CBuffer.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CExpander.cpp \
+ CFilter.cpp \
+ CHM.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Navigation.cpp \
+ Palm2QImage.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ StyleConsts.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ arith_d.cpp \
+ chm_lib.c \
+ fileBrowser.cpp \
+ hrule.cpp \
+ infowin.cpp \
+ iSilo.cpp \
+ lzx.c \
+ main.cpp \
+ orkey.cpp \
+ pdb.cpp \
+ plucker.cpp \
+ plucker_base.cpp \
+ ppm.cpp \
+ ppm_expander.cpp \
+ preferences.cpp \
+ striphtml.cpp \
+ util.cpp \
+ version.cpp \
+ ztxt.cpp
+
+INTERFACES =
+DESTDIR = QSTATICREADEROBJS
+INCLUDEPATH += QSTATICREADERINC
+DEPENDPATH += QSTATICREADERINC
+OBJECTS_DIR = QSTATICREADEROBJS
+MOC_DIR = QSTATICREADERMOCS
+TARGET = uqtreader
+#LIBS += -lqpe
+
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 @@
+#############################################################################
+# Makefile for building ZSTATICREADEROBJS/uqtreader
+# Generated by tmake at 09:24, 2004/07/25
+# Project: reader.staticzpro
+# Template: app
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG
+INCPATH = -IZSTATICREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS =
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqpe -lqte
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ ZSTATICREADERINC/opie.h \
+ pdb.h \
+ plucker_base.h \
+ plucker.h \
+ ppm.h \
+ ppm_expander.h \
+ preferences.h \
+ ZSTATICREADERINC/static.h \
+ usenef.h \
+ ZSTATICREADERINC/useqpe.h \
+ ustring.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+SOURCES = Aportis.cpp \
+ Bkmks.cpp \
+ BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CBuffer.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CExpander.cpp \
+ CFilter.cpp \
+ CHM.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Navigation.cpp \
+ Palm2QImage.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ StyleConsts.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ arith_d.cpp \
+ chm_lib.c \
+ fileBrowser.cpp \
+ hrule.cpp \
+ infowin.cpp \
+ iSilo.cpp \
+ lzx.c \
+ main.cpp \
+ orkey.cpp \
+ pdb.cpp \
+ plucker.cpp \
+ plucker_base.cpp \
+ ppm.cpp \
+ ppm_expander.cpp \
+ striphtml.cpp \
+ util.cpp \
+ version.cpp \
+ ztxt.cpp
+OBJECTS = ZSTATICREADEROBJS/Aportis.o \
+ ZSTATICREADEROBJS/Bkmks.o \
+ ZSTATICREADEROBJS/BuffDoc.o \
+ ZSTATICREADEROBJS/ButtonPrefs.o \
+ ZSTATICREADEROBJS/CAnnoEdit.o \
+ ZSTATICREADEROBJS/CBuffer.o \
+ ZSTATICREADEROBJS/CDrawBuffer.o \
+ ZSTATICREADEROBJS/CEncoding.o \
+ ZSTATICREADEROBJS/CEncoding_tables.o \
+ ZSTATICREADEROBJS/CExpander.o \
+ ZSTATICREADEROBJS/CFilter.o \
+ ZSTATICREADEROBJS/CHM.o \
+ ZSTATICREADEROBJS/CRegExp.o \
+ ZSTATICREADEROBJS/CloseDialog.o \
+ ZSTATICREADEROBJS/FontControl.o \
+ ZSTATICREADEROBJS/GraphicWin.o \
+ ZSTATICREADEROBJS/Navigation.o \
+ ZSTATICREADEROBJS/Palm2QImage.o \
+ ZSTATICREADEROBJS/Prefs.o \
+ ZSTATICREADEROBJS/QTReader.o \
+ ZSTATICREADEROBJS/QTReaderApp.o \
+ ZSTATICREADEROBJS/QtrListView.o \
+ ZSTATICREADEROBJS/StyleConsts.o \
+ ZSTATICREADEROBJS/ToolbarPrefs.o \
+ ZSTATICREADEROBJS/URLDialog.o \
+ ZSTATICREADEROBJS/arith_d.o \
+ ZSTATICREADEROBJS/chm_lib.o \
+ ZSTATICREADEROBJS/fileBrowser.o \
+ ZSTATICREADEROBJS/hrule.o \
+ ZSTATICREADEROBJS/infowin.o \
+ ZSTATICREADEROBJS/iSilo.o \
+ ZSTATICREADEROBJS/lzx.o \
+ ZSTATICREADEROBJS/main.o \
+ ZSTATICREADEROBJS/orkey.o \
+ ZSTATICREADEROBJS/pdb.o \
+ ZSTATICREADEROBJS/plucker.o \
+ ZSTATICREADEROBJS/plucker_base.o \
+ ZSTATICREADEROBJS/ppm.o \
+ ZSTATICREADEROBJS/ppm_expander.o \
+ ZSTATICREADEROBJS/striphtml.o \
+ ZSTATICREADEROBJS/util.o \
+ ZSTATICREADEROBJS/version.o \
+ ZSTATICREADEROBJS/ztxt.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = ZSTATICREADERMOCS/moc_ButtonPrefs.cpp \
+ ZSTATICREADERMOCS/moc_CAnnoEdit.cpp \
+ ZSTATICREADERMOCS/moc_CloseDialog.cpp \
+ ZSTATICREADERMOCS/moc_GraphicWin.cpp \
+ ZSTATICREADERMOCS/moc_Prefs.cpp \
+ ZSTATICREADERMOCS/moc_QFloatBar.cpp \
+ ZSTATICREADERMOCS/moc_QTReader.cpp \
+ ZSTATICREADERMOCS/moc_QTReaderApp.cpp \
+ ZSTATICREADERMOCS/moc_QtrListView.cpp \
+ ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp \
+ ZSTATICREADERMOCS/moc_URLDialog.cpp \
+ ZSTATICREADERMOCS/moc_cbkmkselector.cpp \
+ ZSTATICREADERMOCS/moc_fileBrowser.cpp \
+ ZSTATICREADERMOCS/moc_infowin.cpp
+OBJMOC = ZSTATICREADEROBJS/moc_ButtonPrefs.o \
+ ZSTATICREADEROBJS/moc_CAnnoEdit.o \
+ ZSTATICREADEROBJS/moc_CloseDialog.o \
+ ZSTATICREADEROBJS/moc_GraphicWin.o \
+ ZSTATICREADEROBJS/moc_Prefs.o \
+ ZSTATICREADEROBJS/moc_QFloatBar.o \
+ ZSTATICREADEROBJS/moc_QTReader.o \
+ ZSTATICREADEROBJS/moc_QTReaderApp.o \
+ ZSTATICREADEROBJS/moc_QtrListView.o \
+ ZSTATICREADEROBJS/moc_ToolbarPrefs.o \
+ ZSTATICREADEROBJS/moc_URLDialog.o \
+ ZSTATICREADEROBJS/moc_cbkmkselector.o \
+ ZSTATICREADEROBJS/moc_fileBrowser.o \
+ ZSTATICREADEROBJS/moc_infowin.o
+DIST =
+TARGET = ZSTATICREADEROBJS/uqtreader
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake: reader.staticzmak
+
+reader.staticzmak: reader.staticzpro
+ tmake reader.staticzpro -o reader.staticzmak
+
+dist:
+ $(TAR) reader.staticzpro.tar reader.staticzpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) reader.staticzpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZSTATICREADEROBJS/Aportis.o: Aportis.cpp \
+ Aportis.h \
+ CExpander.h \
+ ZSTATICREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ ZSTATICREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Aportis.o Aportis.cpp
+
+ZSTATICREADEROBJS/Bkmks.o: Bkmks.cpp \
+ Bkmks.h \
+ config.h \
+ ustring.h \
+ Filedata.h \
+ StyleConsts.h \
+ Markups.h \
+ my_list.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Bkmks.o Bkmks.cpp
+
+ZSTATICREADEROBJS/BuffDoc.o: BuffDoc.cpp \
+ ZSTATICREADERINC/static.h \
+ names.h \
+ ZSTATICREADERINC/useqpe.h \
+ usenef.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZText.h \
+ ebookcodec.h \
+ Aportis.h \
+ pdb.h \
+ CHM.h \
+ chm_lib.h \
+ ppm_expander.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ ztxt.h \
+ plucker.h \
+ plucker_base.h \
+ Navigation.h \
+ hrule.h \
+ iSilo.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/BuffDoc.o BuffDoc.cpp
+
+ZSTATICREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp
+
+ZSTATICREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp
+
+ZSTATICREADEROBJS/CBuffer.o: CBuffer.cpp \
+ CBuffer.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CBuffer.o CBuffer.cpp
+
+ZSTATICREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ FontControl.h \
+ ZSTATICREADERINC/useqpe.h \
+ ZSTATICREADERINC/opie.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp
+
+ZSTATICREADEROBJS/CEncoding.o: CEncoding.cpp \
+ CEncoding.h \
+ CExpander.h \
+ ZSTATICREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CEncoding.o CEncoding.cpp
+
+ZSTATICREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \
+ CEncoding_tables.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp
+
+ZSTATICREADEROBJS/CExpander.o: CExpander.cpp \
+ CExpander.h \
+ ZSTATICREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CExpander.o CExpander.cpp
+
+ZSTATICREADEROBJS/CFilter.o: CFilter.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZSTATICREADERINC/static.h \
+ hrule.h \
+ Bkmks.h \
+ Filedata.h \
+ QTReader.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ CRegExp.h \
+ hash.h \
+ Queue.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CFilter.o CFilter.cpp
+
+ZSTATICREADEROBJS/CHM.o: CHM.cpp \
+ CHM.h \
+ ZSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ chm_lib.h \
+ my_list.h \
+ ZSTATICREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CHM.o CHM.cpp
+
+ZSTATICREADEROBJS/CRegExp.o: CRegExp.cpp \
+ CRegExp.h \
+ config.h \
+ ustring.h \
+ hash.h \
+ Queue.h \
+ my_list.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CRegExp.o CRegExp.cpp
+
+ZSTATICREADEROBJS/CloseDialog.o: CloseDialog.cpp \
+ CloseDialog.h \
+ ZSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/CloseDialog.o CloseDialog.cpp
+
+ZSTATICREADEROBJS/FontControl.o: FontControl.cpp \
+ ZSTATICREADERINC/opie.h \
+ ZSTATICREADERINC/useqpe.h \
+ FontControl.h \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/FontControl.o FontControl.cpp
+
+ZSTATICREADEROBJS/GraphicWin.o: GraphicWin.cpp \
+ GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/GraphicWin.o GraphicWin.cpp
+
+ZSTATICREADEROBJS/Navigation.o: Navigation.cpp \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Navigation.o Navigation.cpp
+
+ZSTATICREADEROBJS/Palm2QImage.o: Palm2QImage.cpp \
+ ZSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Palm2QImage.o Palm2QImage.cpp
+
+ZSTATICREADEROBJS/Prefs.o: Prefs.cpp \
+ Prefs.h \
+ orkey.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/Prefs.o Prefs.cpp
+
+ZSTATICREADEROBJS/QTReader.o: QTReader.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ QTReader.h \
+ ZSTATICREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/QTReader.o QTReader.cpp
+
+ZSTATICREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ QTReader.h \
+ ZSTATICREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ GraphicWin.h \
+ Bkmks.h \
+ Filedata.h \
+ cbkmkselector.h \
+ infowin.h \
+ ToolbarPrefs.h \
+ preferences.h \
+ Prefs.h \
+ orkey.h \
+ CAnnoEdit.h \
+ QFloatBar.h \
+ FixedFont.h \
+ URLDialog.h \
+ util.h \
+ ZSTATICREADERINC/opie.h \
+ fileBrowser.h \
+ QTReaderApp.h \
+ CloseDialog.h \
+ ButtonPrefs.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/QTReaderApp.o QTReaderApp.cpp
+
+ZSTATICREADEROBJS/QtrListView.o: QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/QtrListView.o QtrListView.cpp
+
+ZSTATICREADEROBJS/StyleConsts.o: StyleConsts.cpp \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/StyleConsts.o StyleConsts.cpp
+
+ZSTATICREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ ToolbarPrefs.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp
+
+ZSTATICREADEROBJS/URLDialog.o: URLDialog.cpp \
+ URLDialog.h \
+ ZSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/URLDialog.o URLDialog.cpp
+
+ZSTATICREADEROBJS/arith_d.o: arith_d.cpp \
+ arith.h \
+ utypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/arith_d.o arith_d.cpp
+
+ZSTATICREADEROBJS/chm_lib.o: chm_lib.c \
+ chm_lib.h \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/chm_lib.o chm_lib.c
+
+ZSTATICREADEROBJS/fileBrowser.o: fileBrowser.cpp \
+ fileBrowser.h \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/fileBrowser.o fileBrowser.cpp
+
+ZSTATICREADEROBJS/hrule.o: hrule.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/hrule.o hrule.cpp
+
+ZSTATICREADEROBJS/infowin.o: infowin.cpp \
+ infowin.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/infowin.o infowin.cpp
+
+ZSTATICREADEROBJS/iSilo.o: iSilo.cpp \
+ iSilo.h \
+ pdb.h \
+ ZSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/iSilo.o iSilo.cpp
+
+ZSTATICREADEROBJS/lzx.o: lzx.c \
+ lzx.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/lzx.o lzx.c
+
+ZSTATICREADEROBJS/main.o: main.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ QTReaderApp.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/main.o main.cpp
+
+ZSTATICREADEROBJS/orkey.o: orkey.cpp \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/orkey.o orkey.cpp
+
+ZSTATICREADEROBJS/pdb.o: pdb.cpp \
+ pdb.h \
+ ZSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/pdb.o pdb.cpp
+
+ZSTATICREADEROBJS/plucker.o: plucker.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ plucker.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h \
+ Palm2QImage.h \
+ ZSTATICREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/plucker.o plucker.cpp
+
+ZSTATICREADEROBJS/plucker_base.o: plucker_base.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ usenef.h \
+ ZSTATICREADERINC/static.h \
+ plucker_base.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ ztxt.h \
+ pdb.h \
+ CBuffer.h \
+ my_list.h \
+ Navigation.h \
+ hrule.h \
+ Aportis.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/plucker_base.o plucker_base.cpp
+
+ZSTATICREADEROBJS/ppm.o: ppm.cpp \
+ arith.h \
+ utypes.h \
+ ppm.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ppm.o ppm.cpp
+
+ZSTATICREADEROBJS/ppm_expander.o: ppm_expander.cpp \
+ ZSTATICREADERINC/static.h \
+ ppm_expander.h \
+ ZSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ utypes.h \
+ ppm.h \
+ arith.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ppm_expander.o ppm_expander.cpp
+
+ZSTATICREADEROBJS/striphtml.o: striphtml.cpp \
+ ZSTATICREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ striphtml.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZSTATICREADERINC/static.h \
+ Navigation.h \
+ hrule.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/striphtml.o striphtml.cpp
+
+ZSTATICREADEROBJS/util.o: util.cpp \
+ util.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/util.o util.cpp
+
+ZSTATICREADEROBJS/version.o: version.cpp \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/version.o version.cpp
+
+ZSTATICREADEROBJS/ztxt.o: ztxt.cpp \
+ ztxt.h \
+ CExpander.h \
+ ZSTATICREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ pdb.h \
+ my_list.h \
+ Bkmks.h \
+ Filedata.h \
+ ZSTATICREADERINC/static.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/ztxt.o ztxt.cpp
+
+ZSTATICREADEROBJS/moc_ButtonPrefs.o: ZSTATICREADERMOCS/moc_ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_ButtonPrefs.o ZSTATICREADERMOCS/moc_ButtonPrefs.cpp
+
+ZSTATICREADEROBJS/moc_CAnnoEdit.o: ZSTATICREADERMOCS/moc_CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_CAnnoEdit.o ZSTATICREADERMOCS/moc_CAnnoEdit.cpp
+
+ZSTATICREADEROBJS/moc_CloseDialog.o: ZSTATICREADERMOCS/moc_CloseDialog.cpp \
+ CloseDialog.h \
+ ZSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_CloseDialog.o ZSTATICREADERMOCS/moc_CloseDialog.cpp
+
+ZSTATICREADEROBJS/moc_GraphicWin.o: ZSTATICREADERMOCS/moc_GraphicWin.cpp \
+ GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_GraphicWin.o ZSTATICREADERMOCS/moc_GraphicWin.cpp
+
+ZSTATICREADEROBJS/moc_Prefs.o: ZSTATICREADERMOCS/moc_Prefs.cpp \
+ Prefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_Prefs.o ZSTATICREADERMOCS/moc_Prefs.cpp
+
+ZSTATICREADEROBJS/moc_QFloatBar.o: ZSTATICREADERMOCS/moc_QFloatBar.cpp \
+ QFloatBar.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QFloatBar.o ZSTATICREADERMOCS/moc_QFloatBar.cpp
+
+ZSTATICREADEROBJS/moc_QTReader.o: ZSTATICREADERMOCS/moc_QTReader.cpp \
+ QTReader.h \
+ ZSTATICREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ ZSTATICREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QTReader.o ZSTATICREADERMOCS/moc_QTReader.cpp
+
+ZSTATICREADEROBJS/moc_QTReaderApp.o: ZSTATICREADERMOCS/moc_QTReaderApp.cpp \
+ QTReaderApp.h \
+ ZSTATICREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QTReaderApp.o ZSTATICREADERMOCS/moc_QTReaderApp.cpp
+
+ZSTATICREADEROBJS/moc_QtrListView.o: ZSTATICREADERMOCS/moc_QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_QtrListView.o ZSTATICREADERMOCS/moc_QtrListView.cpp
+
+ZSTATICREADEROBJS/moc_ToolbarPrefs.o: ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp \
+ ToolbarPrefs.h \
+ ZSTATICREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_ToolbarPrefs.o ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp
+
+ZSTATICREADEROBJS/moc_URLDialog.o: ZSTATICREADERMOCS/moc_URLDialog.cpp \
+ URLDialog.h \
+ ZSTATICREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_URLDialog.o ZSTATICREADERMOCS/moc_URLDialog.cpp
+
+ZSTATICREADEROBJS/moc_cbkmkselector.o: ZSTATICREADERMOCS/moc_cbkmkselector.cpp \
+ cbkmkselector.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_cbkmkselector.o ZSTATICREADERMOCS/moc_cbkmkselector.cpp
+
+ZSTATICREADEROBJS/moc_fileBrowser.o: ZSTATICREADERMOCS/moc_fileBrowser.cpp \
+ fileBrowser.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_fileBrowser.o ZSTATICREADERMOCS/moc_fileBrowser.cpp
+
+ZSTATICREADEROBJS/moc_infowin.o: ZSTATICREADERMOCS/moc_infowin.cpp \
+ infowin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZSTATICREADEROBJS/moc_infowin.o ZSTATICREADERMOCS/moc_infowin.cpp
+
+ZSTATICREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h
+ $(MOC) ButtonPrefs.h -o ZSTATICREADERMOCS/moc_ButtonPrefs.cpp
+
+ZSTATICREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h
+ $(MOC) CAnnoEdit.h -o ZSTATICREADERMOCS/moc_CAnnoEdit.cpp
+
+ZSTATICREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h
+ $(MOC) CloseDialog.h -o ZSTATICREADERMOCS/moc_CloseDialog.cpp
+
+ZSTATICREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h
+ $(MOC) GraphicWin.h -o ZSTATICREADERMOCS/moc_GraphicWin.cpp
+
+ZSTATICREADERMOCS/moc_Prefs.cpp: Prefs.h
+ $(MOC) Prefs.h -o ZSTATICREADERMOCS/moc_Prefs.cpp
+
+ZSTATICREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h
+ $(MOC) QFloatBar.h -o ZSTATICREADERMOCS/moc_QFloatBar.cpp
+
+ZSTATICREADERMOCS/moc_QTReader.cpp: QTReader.h
+ $(MOC) QTReader.h -o ZSTATICREADERMOCS/moc_QTReader.cpp
+
+ZSTATICREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h
+ $(MOC) QTReaderApp.h -o ZSTATICREADERMOCS/moc_QTReaderApp.cpp
+
+ZSTATICREADERMOCS/moc_QtrListView.cpp: QtrListView.h
+ $(MOC) QtrListView.h -o ZSTATICREADERMOCS/moc_QtrListView.cpp
+
+ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h
+ $(MOC) ToolbarPrefs.h -o ZSTATICREADERMOCS/moc_ToolbarPrefs.cpp
+
+ZSTATICREADERMOCS/moc_URLDialog.cpp: URLDialog.h
+ $(MOC) URLDialog.h -o ZSTATICREADERMOCS/moc_URLDialog.cpp
+
+ZSTATICREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h
+ $(MOC) cbkmkselector.h -o ZSTATICREADERMOCS/moc_cbkmkselector.cpp
+
+ZSTATICREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h
+ $(MOC) fileBrowser.h -o ZSTATICREADERMOCS/moc_fileBrowser.cpp
+
+ZSTATICREADERMOCS/moc_infowin.cpp: infowin.h
+ $(MOC) infowin.h -o ZSTATICREADERMOCS/moc_infowin.cpp
+
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 @@
+TEMPLATE = app
+CONFIG = qt warn_on release
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ ZSTATICREADERINC/opie.h \
+ pdb.h \
+ plucker_base.h \
+ plucker.h \
+ ppm.h \
+ ppm_expander.h \
+ preferences.h \
+ ZSTATICREADERINC/static.h \
+ usenef.h \
+ ZSTATICREADERINC/useqpe.h \
+ ustring.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+
+SOURCES = Aportis.cpp \
+ Bkmks.cpp \
+ BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CBuffer.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CExpander.cpp \
+ CFilter.cpp \
+ CHM.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Navigation.cpp \
+ Palm2QImage.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ StyleConsts.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ arith_d.cpp \
+ chm_lib.c \
+ fileBrowser.cpp \
+ hrule.cpp \
+ infowin.cpp \
+ iSilo.cpp \
+ lzx.c \
+ main.cpp \
+ orkey.cpp \
+ pdb.cpp \
+ plucker.cpp \
+ plucker_base.cpp \
+ ppm.cpp \
+ ppm_expander.cpp \
+ striphtml.cpp \
+ util.cpp \
+ version.cpp \
+ ztxt.cpp
+
+INTERFACES =
+DESTDIR = ZSTATICREADEROBJS
+INCLUDEPATH += ZSTATICREADERINC
+DEPENDPATH += ZSTATICREADERINC
+OBJECTS_DIR = ZSTATICREADEROBJS
+MOC_DIR = ZSTATICREADERMOCS
+TARGET = uqtreader
+LIBS += -lqpe
+
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 @@
+#############################################################################
+# Makefile for building $(QPEDIR)/bin/uqtreader
+# Generated by tmake at 23:23, 2004/03/09
+# Project: reader.wpro
+# Template: app
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc-2.96
+CXX = g++-2.96
+CFLAGS = -pipe -Wall -W -O2 -DNO_DEBUG
+CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG
+INCPATH = -IWSREADERINC -I$(QTDIR)/include
+LINK = g++-2.96
+LFLAGS =
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqpe -lreader_codec -lqte
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Coder.h \
+ CSource.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ PPMd.h \
+ PPMdType.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ SubAlloc.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ arrierego.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ nef.h \
+ WSREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ usenef.h \
+ WSREADERINC/useqpe.h \
+ ustring.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ fileBrowser.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ util.cpp \
+ version.cpp
+OBJECTS = WSREADEROBJS/BuffDoc.o \
+ WSREADEROBJS/ButtonPrefs.o \
+ WSREADEROBJS/CAnnoEdit.o \
+ WSREADEROBJS/CDrawBuffer.o \
+ WSREADEROBJS/CEncoding.o \
+ WSREADEROBJS/CEncoding_tables.o \
+ WSREADEROBJS/CFilter.o \
+ WSREADEROBJS/CRegExp.o \
+ WSREADEROBJS/CloseDialog.o \
+ WSREADEROBJS/FontControl.o \
+ WSREADEROBJS/Prefs.o \
+ WSREADEROBJS/QTReader.o \
+ WSREADEROBJS/QTReaderApp.o \
+ WSREADEROBJS/QtrListView.o \
+ WSREADEROBJS/ToolbarPrefs.o \
+ WSREADEROBJS/URLDialog.o \
+ WSREADEROBJS/fileBrowser.o \
+ WSREADEROBJS/infowin.o \
+ WSREADEROBJS/main.o \
+ WSREADEROBJS/orkey.o \
+ WSREADEROBJS/util.o \
+ WSREADEROBJS/version.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = WSREADERMOCS/moc_ButtonPrefs.cpp \
+ WSREADERMOCS/moc_CAnnoEdit.cpp \
+ WSREADERMOCS/moc_CloseDialog.cpp \
+ WSREADERMOCS/moc_GraphicWin.cpp \
+ WSREADERMOCS/moc_Prefs.cpp \
+ WSREADERMOCS/moc_QFloatBar.cpp \
+ WSREADERMOCS/moc_QTReader.cpp \
+ WSREADERMOCS/moc_QTReaderApp.cpp \
+ WSREADERMOCS/moc_QtrListView.cpp \
+ WSREADERMOCS/moc_ToolbarPrefs.cpp \
+ WSREADERMOCS/moc_URLDialog.cpp \
+ WSREADERMOCS/moc_cbkmkselector.cpp \
+ WSREADERMOCS/moc_fileBrowser.cpp \
+ WSREADERMOCS/moc_infowin.cpp
+OBJMOC = WSREADEROBJS/moc_ButtonPrefs.o \
+ WSREADEROBJS/moc_CAnnoEdit.o \
+ WSREADEROBJS/moc_CloseDialog.o \
+ WSREADEROBJS/moc_GraphicWin.o \
+ WSREADEROBJS/moc_Prefs.o \
+ WSREADEROBJS/moc_QFloatBar.o \
+ WSREADEROBJS/moc_QTReader.o \
+ WSREADEROBJS/moc_QTReaderApp.o \
+ WSREADEROBJS/moc_QtrListView.o \
+ WSREADEROBJS/moc_ToolbarPrefs.o \
+ WSREADEROBJS/moc_URLDialog.o \
+ WSREADEROBJS/moc_cbkmkselector.o \
+ WSREADEROBJS/moc_fileBrowser.o \
+ WSREADEROBJS/moc_infowin.o
+DIST =
+TARGET = $(QPEDIR)/bin/uqtreader
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake: reader.wmak
+
+reader.wmak: reader.wpro
+ tmake reader.wpro -o reader.wmak
+
+dist:
+ $(TAR) reader.wpro.tar reader.wpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) reader.wpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+WSREADEROBJS/BuffDoc.o: BuffDoc.cpp \
+ WSREADERINC/static.h \
+ names.h \
+ BuffDoc.h \
+ WSREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZText.h \
+ ebookcodec.h \
+ Aportis.h \
+ pdb.h \
+ CHM.h \
+ chm_lib.h \
+ ppm_expander.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ ztxt.h \
+ plucker.h \
+ plucker_base.h \
+ Navigation.h \
+ hrule.h \
+ nef.h \
+ usenef.h \
+ arrierego.h \
+ iSilo.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/BuffDoc.o BuffDoc.cpp
+
+WSREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp
+
+WSREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp
+
+WSREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ FontControl.h \
+ WSREADERINC/useqpe.h \
+ WSREADERINC/opie.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp
+
+WSREADEROBJS/CEncoding.o: CEncoding.cpp \
+ CEncoding.h \
+ CExpander.h \
+ WSREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CEncoding.o CEncoding.cpp
+
+WSREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \
+ CEncoding_tables.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp
+
+WSREADEROBJS/CFilter.o: CFilter.cpp \
+ WSREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ WSREADERINC/static.h \
+ hrule.h \
+ Bkmks.h \
+ Filedata.h \
+ QTReader.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ CRegExp.h \
+ hash.h \
+ Queue.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CFilter.o CFilter.cpp
+
+WSREADEROBJS/CRegExp.o: CRegExp.cpp \
+ CRegExp.h \
+ config.h \
+ ustring.h \
+ hash.h \
+ Queue.h \
+ my_list.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CRegExp.o CRegExp.cpp
+
+WSREADEROBJS/CloseDialog.o: CloseDialog.cpp \
+ CloseDialog.h \
+ WSREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/CloseDialog.o CloseDialog.cpp
+
+WSREADEROBJS/FontControl.o: FontControl.cpp \
+ WSREADERINC/opie.h \
+ WSREADERINC/useqpe.h \
+ FontControl.h \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/FontControl.o FontControl.cpp
+
+WSREADEROBJS/Prefs.o: Prefs.cpp \
+ Prefs.h \
+ orkey.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/Prefs.o Prefs.cpp
+
+WSREADEROBJS/QTReader.o: QTReader.cpp \
+ WSREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ QTReader.h \
+ WSREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/QTReader.o QTReader.cpp
+
+WSREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \
+ WSREADERINC/useqpe.h \
+ QTReader.h \
+ WSREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ GraphicWin.h \
+ Bkmks.h \
+ Filedata.h \
+ cbkmkselector.h \
+ infowin.h \
+ ToolbarPrefs.h \
+ preferences.h \
+ Prefs.h \
+ orkey.h \
+ CAnnoEdit.h \
+ QFloatBar.h \
+ FixedFont.h \
+ URLDialog.h \
+ util.h \
+ fileBrowser.h \
+ QTReaderApp.h \
+ CloseDialog.h \
+ ButtonPrefs.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/QTReaderApp.o QTReaderApp.cpp
+
+WSREADEROBJS/QtrListView.o: QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/QtrListView.o QtrListView.cpp
+
+WSREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \
+ WSREADERINC/useqpe.h \
+ ToolbarPrefs.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp
+
+WSREADEROBJS/URLDialog.o: URLDialog.cpp \
+ URLDialog.h \
+ WSREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/URLDialog.o URLDialog.cpp
+
+WSREADEROBJS/fileBrowser.o: fileBrowser.cpp \
+ fileBrowser.h \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/fileBrowser.o fileBrowser.cpp
+
+WSREADEROBJS/infowin.o: infowin.cpp \
+ infowin.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/infowin.o infowin.cpp
+
+WSREADEROBJS/main.o: main.cpp \
+ WSREADERINC/useqpe.h \
+ QTReaderApp.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/main.o main.cpp
+
+WSREADEROBJS/orkey.o: orkey.cpp \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/orkey.o orkey.cpp
+
+WSREADEROBJS/util.o: util.cpp \
+ util.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/util.o util.cpp
+
+WSREADEROBJS/version.o: version.cpp \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/version.o version.cpp
+
+WSREADEROBJS/moc_ButtonPrefs.o: WSREADERMOCS/moc_ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_ButtonPrefs.o WSREADERMOCS/moc_ButtonPrefs.cpp
+
+WSREADEROBJS/moc_CAnnoEdit.o: WSREADERMOCS/moc_CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_CAnnoEdit.o WSREADERMOCS/moc_CAnnoEdit.cpp
+
+WSREADEROBJS/moc_CloseDialog.o: WSREADERMOCS/moc_CloseDialog.cpp \
+ CloseDialog.h \
+ WSREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_CloseDialog.o WSREADERMOCS/moc_CloseDialog.cpp
+
+WSREADEROBJS/moc_GraphicWin.o: WSREADERMOCS/moc_GraphicWin.cpp \
+ GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_GraphicWin.o WSREADERMOCS/moc_GraphicWin.cpp
+
+WSREADEROBJS/moc_Prefs.o: WSREADERMOCS/moc_Prefs.cpp \
+ Prefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_Prefs.o WSREADERMOCS/moc_Prefs.cpp
+
+WSREADEROBJS/moc_QFloatBar.o: WSREADERMOCS/moc_QFloatBar.cpp \
+ QFloatBar.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QFloatBar.o WSREADERMOCS/moc_QFloatBar.cpp
+
+WSREADEROBJS/moc_QTReader.o: WSREADERMOCS/moc_QTReader.cpp \
+ QTReader.h \
+ WSREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ WSREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QTReader.o WSREADERMOCS/moc_QTReader.cpp
+
+WSREADEROBJS/moc_QTReaderApp.o: WSREADERMOCS/moc_QTReaderApp.cpp \
+ QTReaderApp.h \
+ WSREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QTReaderApp.o WSREADERMOCS/moc_QTReaderApp.cpp
+
+WSREADEROBJS/moc_QtrListView.o: WSREADERMOCS/moc_QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_QtrListView.o WSREADERMOCS/moc_QtrListView.cpp
+
+WSREADEROBJS/moc_ToolbarPrefs.o: WSREADERMOCS/moc_ToolbarPrefs.cpp \
+ ToolbarPrefs.h \
+ WSREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_ToolbarPrefs.o WSREADERMOCS/moc_ToolbarPrefs.cpp
+
+WSREADEROBJS/moc_URLDialog.o: WSREADERMOCS/moc_URLDialog.cpp \
+ URLDialog.h \
+ WSREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_URLDialog.o WSREADERMOCS/moc_URLDialog.cpp
+
+WSREADEROBJS/moc_cbkmkselector.o: WSREADERMOCS/moc_cbkmkselector.cpp \
+ cbkmkselector.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_cbkmkselector.o WSREADERMOCS/moc_cbkmkselector.cpp
+
+WSREADEROBJS/moc_fileBrowser.o: WSREADERMOCS/moc_fileBrowser.cpp \
+ fileBrowser.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_fileBrowser.o WSREADERMOCS/moc_fileBrowser.cpp
+
+WSREADEROBJS/moc_infowin.o: WSREADERMOCS/moc_infowin.cpp \
+ infowin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o WSREADEROBJS/moc_infowin.o WSREADERMOCS/moc_infowin.cpp
+
+WSREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h
+ $(MOC) ButtonPrefs.h -o WSREADERMOCS/moc_ButtonPrefs.cpp
+
+WSREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h
+ $(MOC) CAnnoEdit.h -o WSREADERMOCS/moc_CAnnoEdit.cpp
+
+WSREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h
+ $(MOC) CloseDialog.h -o WSREADERMOCS/moc_CloseDialog.cpp
+
+WSREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h
+ $(MOC) GraphicWin.h -o WSREADERMOCS/moc_GraphicWin.cpp
+
+WSREADERMOCS/moc_Prefs.cpp: Prefs.h
+ $(MOC) Prefs.h -o WSREADERMOCS/moc_Prefs.cpp
+
+WSREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h
+ $(MOC) QFloatBar.h -o WSREADERMOCS/moc_QFloatBar.cpp
+
+WSREADERMOCS/moc_QTReader.cpp: QTReader.h
+ $(MOC) QTReader.h -o WSREADERMOCS/moc_QTReader.cpp
+
+WSREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h
+ $(MOC) QTReaderApp.h -o WSREADERMOCS/moc_QTReaderApp.cpp
+
+WSREADERMOCS/moc_QtrListView.cpp: QtrListView.h
+ $(MOC) QtrListView.h -o WSREADERMOCS/moc_QtrListView.cpp
+
+WSREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h
+ $(MOC) ToolbarPrefs.h -o WSREADERMOCS/moc_ToolbarPrefs.cpp
+
+WSREADERMOCS/moc_URLDialog.cpp: URLDialog.h
+ $(MOC) URLDialog.h -o WSREADERMOCS/moc_URLDialog.cpp
+
+WSREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h
+ $(MOC) cbkmkselector.h -o WSREADERMOCS/moc_cbkmkselector.cpp
+
+WSREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h
+ $(MOC) fileBrowser.h -o WSREADERMOCS/moc_fileBrowser.cpp
+
+WSREADERMOCS/moc_infowin.cpp: infowin.h
+ $(MOC) infowin.h -o WSREADERMOCS/moc_infowin.cpp
+
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 @@
+TEMPLATE = app
+CONFIG = qt warn_on release
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Coder.h \
+ CSource.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ PPMd.h \
+ PPMdType.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ SubAlloc.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ arrierego.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ nef.h \
+ WSREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ usenef.h \
+ WSREADERINC/useqpe.h \
+ ustring.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ fileBrowser.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ util.cpp \
+ version.cpp
+
+
+INTERFACES =
+DESTDIR = $(QPEDIR)/bin
+INCLUDEPATH += WSREADERINC
+DEPENDPATH += WSREADERINC
+TARGET = uqtreader
+LIBS += -lqpe -lreader_codec
+
+OBJECTS_DIR = WSREADEROBJS
+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 @@
+#############################################################################
+# Makefile for building $(QPEDIR)/bin/uqtreader
+# Generated by tmake at 15:17, 2004/05/08
+# Project: reader.zpro
+# Template: app
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+CFLAGS = -pipe -Wall -W -O2 -DNO_DEBUG
+CXXFLAGS= -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG
+INCPATH = -IZREADERINC -I$(QTDIR)/include
+LINK = arm-linux-gcc
+LFLAGS =
+LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqpe -lreader_codec -lqte
+MOC = $(QTDIR)/bin/moc
+UIC = $(QTDIR)/bin/uic
+
+TAR = tar -cf
+GZIP = gzip -9f
+
+####### Files
+
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Coder.h \
+ CSource.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ PPMd.h \
+ PPMdType.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ SubAlloc.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ arrierego.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ nef.h \
+ ZREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ usenef.h \
+ ZREADERINC/useqpe.h \
+ ustring.h \
+ util.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ fileBrowser.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ util.cpp \
+ version.cpp
+OBJECTS = ZREADEROBJS/BuffDoc.o \
+ ZREADEROBJS/ButtonPrefs.o \
+ ZREADEROBJS/CAnnoEdit.o \
+ ZREADEROBJS/CDrawBuffer.o \
+ ZREADEROBJS/CEncoding.o \
+ ZREADEROBJS/CEncoding_tables.o \
+ ZREADEROBJS/CFilter.o \
+ ZREADEROBJS/CRegExp.o \
+ ZREADEROBJS/CloseDialog.o \
+ ZREADEROBJS/FontControl.o \
+ ZREADEROBJS/Prefs.o \
+ ZREADEROBJS/QTReader.o \
+ ZREADEROBJS/QTReaderApp.o \
+ ZREADEROBJS/QtrListView.o \
+ ZREADEROBJS/ToolbarPrefs.o \
+ ZREADEROBJS/URLDialog.o \
+ ZREADEROBJS/fileBrowser.o \
+ ZREADEROBJS/infowin.o \
+ ZREADEROBJS/main.o \
+ ZREADEROBJS/orkey.o \
+ ZREADEROBJS/util.o \
+ ZREADEROBJS/version.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = ZREADERMOCS/moc_ButtonPrefs.cpp \
+ ZREADERMOCS/moc_CAnnoEdit.cpp \
+ ZREADERMOCS/moc_CloseDialog.cpp \
+ ZREADERMOCS/moc_GraphicWin.cpp \
+ ZREADERMOCS/moc_Prefs.cpp \
+ ZREADERMOCS/moc_QFloatBar.cpp \
+ ZREADERMOCS/moc_QTReader.cpp \
+ ZREADERMOCS/moc_QTReaderApp.cpp \
+ ZREADERMOCS/moc_QtrListView.cpp \
+ ZREADERMOCS/moc_ToolbarPrefs.cpp \
+ ZREADERMOCS/moc_URLDialog.cpp \
+ ZREADERMOCS/moc_cbkmkselector.cpp \
+ ZREADERMOCS/moc_fileBrowser.cpp \
+ ZREADERMOCS/moc_infowin.cpp
+OBJMOC = ZREADEROBJS/moc_ButtonPrefs.o \
+ ZREADEROBJS/moc_CAnnoEdit.o \
+ ZREADEROBJS/moc_CloseDialog.o \
+ ZREADEROBJS/moc_GraphicWin.o \
+ ZREADEROBJS/moc_Prefs.o \
+ ZREADEROBJS/moc_QFloatBar.o \
+ ZREADEROBJS/moc_QTReader.o \
+ ZREADEROBJS/moc_QTReaderApp.o \
+ ZREADEROBJS/moc_QtrListView.o \
+ ZREADEROBJS/moc_ToolbarPrefs.o \
+ ZREADEROBJS/moc_URLDialog.o \
+ ZREADEROBJS/moc_cbkmkselector.o \
+ ZREADEROBJS/moc_fileBrowser.o \
+ ZREADEROBJS/moc_infowin.o
+DIST =
+TARGET = $(QPEDIR)/bin/uqtreader
+INTERFACE_DECL_PATH = .
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake: reader.zmak
+
+reader.zmak: reader.zpro
+ tmake reader.zpro -o reader.zmak
+
+dist:
+ $(TAR) reader.zpro.tar reader.zpro.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+ $(GZIP) reader.zpro.tar
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+ -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+ZREADEROBJS/BuffDoc.o: BuffDoc.cpp \
+ ZREADERINC/static.h \
+ names.h \
+ BuffDoc.h \
+ ZREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZText.h \
+ ebookcodec.h \
+ Aportis.h \
+ pdb.h \
+ CHM.h \
+ chm_lib.h \
+ ppm_expander.h \
+ utypes.h \
+ ppm.h \
+ arith.h \
+ ztxt.h \
+ plucker.h \
+ plucker_base.h \
+ Navigation.h \
+ hrule.h \
+ nef.h \
+ usenef.h \
+ arrierego.h \
+ iSilo.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/BuffDoc.o BuffDoc.cpp
+
+ZREADEROBJS/ButtonPrefs.o: ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ButtonPrefs.o ButtonPrefs.cpp
+
+ZREADEROBJS/CAnnoEdit.o: CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CAnnoEdit.o CAnnoEdit.cpp
+
+ZREADEROBJS/CDrawBuffer.o: CDrawBuffer.cpp \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ FontControl.h \
+ ZREADERINC/useqpe.h \
+ ZREADERINC/opie.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CDrawBuffer.o CDrawBuffer.cpp
+
+ZREADEROBJS/CEncoding.o: CEncoding.cpp \
+ CEncoding.h \
+ CExpander.h \
+ ZREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CEncoding.o CEncoding.cpp
+
+ZREADEROBJS/CEncoding_tables.o: CEncoding_tables.cpp \
+ CEncoding_tables.h \
+ config.h \
+ ustring.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CEncoding_tables.o CEncoding_tables.cpp
+
+ZREADEROBJS/CFilter.o: CFilter.cpp \
+ ZREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ my_list.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ ZREADERINC/static.h \
+ hrule.h \
+ Bkmks.h \
+ Filedata.h \
+ QTReader.h \
+ BuffDoc.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ CRegExp.h \
+ hash.h \
+ Queue.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CFilter.o CFilter.cpp
+
+ZREADEROBJS/CRegExp.o: CRegExp.cpp \
+ CRegExp.h \
+ config.h \
+ ustring.h \
+ hash.h \
+ Queue.h \
+ my_list.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CRegExp.o CRegExp.cpp
+
+ZREADEROBJS/CloseDialog.o: CloseDialog.cpp \
+ CloseDialog.h \
+ ZREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/CloseDialog.o CloseDialog.cpp
+
+ZREADEROBJS/FontControl.o: FontControl.cpp \
+ ZREADERINC/opie.h \
+ ZREADERINC/useqpe.h \
+ FontControl.h \
+ StyleConsts.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/FontControl.o FontControl.cpp
+
+ZREADEROBJS/Prefs.o: Prefs.cpp \
+ Prefs.h \
+ orkey.h \
+ CEncoding_tables.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/Prefs.o Prefs.cpp
+
+ZREADEROBJS/QTReader.o: QTReader.cpp \
+ ZREADERINC/useqpe.h \
+ config.h \
+ ustring.h \
+ QTReader.h \
+ ZREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/QTReader.o QTReader.cpp
+
+ZREADEROBJS/QTReaderApp.o: QTReaderApp.cpp \
+ ZREADERINC/useqpe.h \
+ QTReader.h \
+ ZREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h \
+ GraphicWin.h \
+ Bkmks.h \
+ Filedata.h \
+ cbkmkselector.h \
+ infowin.h \
+ ToolbarPrefs.h \
+ preferences.h \
+ Prefs.h \
+ orkey.h \
+ CAnnoEdit.h \
+ QFloatBar.h \
+ FixedFont.h \
+ URLDialog.h \
+ util.h \
+ fileBrowser.h \
+ QTReaderApp.h \
+ CloseDialog.h \
+ ButtonPrefs.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/QTReaderApp.o QTReaderApp.cpp
+
+ZREADEROBJS/QtrListView.o: QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/QtrListView.o QtrListView.cpp
+
+ZREADEROBJS/ToolbarPrefs.o: ToolbarPrefs.cpp \
+ ZREADERINC/useqpe.h \
+ ToolbarPrefs.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/ToolbarPrefs.o ToolbarPrefs.cpp
+
+ZREADEROBJS/URLDialog.o: URLDialog.cpp \
+ URLDialog.h \
+ ZREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/URLDialog.o URLDialog.cpp
+
+ZREADEROBJS/fileBrowser.o: fileBrowser.cpp \
+ fileBrowser.h \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/fileBrowser.o fileBrowser.cpp
+
+ZREADEROBJS/infowin.o: infowin.cpp \
+ infowin.h \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/infowin.o infowin.cpp
+
+ZREADEROBJS/main.o: main.cpp \
+ ZREADERINC/useqpe.h \
+ QTReaderApp.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/main.o main.cpp
+
+ZREADEROBJS/orkey.o: orkey.cpp \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/orkey.o orkey.cpp
+
+ZREADEROBJS/util.o: util.cpp \
+ util.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/util.o util.cpp
+
+ZREADEROBJS/version.o: version.cpp \
+ version.h \
+ names.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/version.o version.cpp
+
+ZREADEROBJS/moc_ButtonPrefs.o: ZREADERMOCS/moc_ButtonPrefs.cpp \
+ ButtonPrefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_ButtonPrefs.o ZREADERMOCS/moc_ButtonPrefs.cpp
+
+ZREADEROBJS/moc_CAnnoEdit.o: ZREADERMOCS/moc_CAnnoEdit.cpp \
+ CAnnoEdit.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_CAnnoEdit.o ZREADERMOCS/moc_CAnnoEdit.cpp
+
+ZREADEROBJS/moc_CloseDialog.o: ZREADERMOCS/moc_CloseDialog.cpp \
+ CloseDialog.h \
+ ZREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_CloseDialog.o ZREADERMOCS/moc_CloseDialog.cpp
+
+ZREADEROBJS/moc_GraphicWin.o: ZREADERMOCS/moc_GraphicWin.cpp \
+ GraphicWin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_GraphicWin.o ZREADERMOCS/moc_GraphicWin.cpp
+
+ZREADEROBJS/moc_Prefs.o: ZREADERMOCS/moc_Prefs.cpp \
+ Prefs.h \
+ orkey.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_Prefs.o ZREADERMOCS/moc_Prefs.cpp
+
+ZREADEROBJS/moc_QFloatBar.o: ZREADERMOCS/moc_QFloatBar.cpp \
+ QFloatBar.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QFloatBar.o ZREADERMOCS/moc_QFloatBar.cpp
+
+ZREADEROBJS/moc_QTReader.o: ZREADERMOCS/moc_QTReader.cpp \
+ QTReader.h \
+ ZREADERINC/static.h \
+ my_list.h \
+ BuffDoc.h \
+ ZREADERINC/useqpe.h \
+ CDrawBuffer.h \
+ StyleConsts.h \
+ CBuffer.h \
+ config.h \
+ ustring.h \
+ linktype.h \
+ CFilter.h \
+ CExpander.h \
+ Markups.h \
+ names.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ FontControl.h \
+ BGType.h \
+ striphtml.h \
+ Navigation.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QTReader.o ZREADERMOCS/moc_QTReader.cpp
+
+ZREADEROBJS/moc_QTReaderApp.o: ZREADERMOCS/moc_QTReaderApp.cpp \
+ QTReaderApp.h \
+ ZREADERINC/useqpe.h \
+ CExpander.h \
+ config.h \
+ ustring.h \
+ StyleConsts.h \
+ Markups.h \
+ names.h \
+ linktype.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ orkey.h \
+ BGType.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QTReaderApp.o ZREADERMOCS/moc_QTReaderApp.cpp
+
+ZREADEROBJS/moc_QtrListView.o: ZREADERMOCS/moc_QtrListView.cpp \
+ QtrListView.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_QtrListView.o ZREADERMOCS/moc_QtrListView.cpp
+
+ZREADEROBJS/moc_ToolbarPrefs.o: ZREADERMOCS/moc_ToolbarPrefs.cpp \
+ ToolbarPrefs.h \
+ ZREADERINC/useqpe.h \
+ preferences.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_ToolbarPrefs.o ZREADERMOCS/moc_ToolbarPrefs.cpp
+
+ZREADEROBJS/moc_URLDialog.o: ZREADERMOCS/moc_URLDialog.cpp \
+ URLDialog.h \
+ ZREADERINC/useqpe.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_URLDialog.o ZREADERMOCS/moc_URLDialog.cpp
+
+ZREADEROBJS/moc_cbkmkselector.o: ZREADERMOCS/moc_cbkmkselector.cpp \
+ cbkmkselector.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_cbkmkselector.o ZREADERMOCS/moc_cbkmkselector.cpp
+
+ZREADEROBJS/moc_fileBrowser.o: ZREADERMOCS/moc_fileBrowser.cpp \
+ fileBrowser.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_fileBrowser.o ZREADERMOCS/moc_fileBrowser.cpp
+
+ZREADEROBJS/moc_infowin.o: ZREADERMOCS/moc_infowin.cpp \
+ infowin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ZREADEROBJS/moc_infowin.o ZREADERMOCS/moc_infowin.cpp
+
+ZREADERMOCS/moc_ButtonPrefs.cpp: ButtonPrefs.h
+ $(MOC) ButtonPrefs.h -o ZREADERMOCS/moc_ButtonPrefs.cpp
+
+ZREADERMOCS/moc_CAnnoEdit.cpp: CAnnoEdit.h
+ $(MOC) CAnnoEdit.h -o ZREADERMOCS/moc_CAnnoEdit.cpp
+
+ZREADERMOCS/moc_CloseDialog.cpp: CloseDialog.h
+ $(MOC) CloseDialog.h -o ZREADERMOCS/moc_CloseDialog.cpp
+
+ZREADERMOCS/moc_GraphicWin.cpp: GraphicWin.h
+ $(MOC) GraphicWin.h -o ZREADERMOCS/moc_GraphicWin.cpp
+
+ZREADERMOCS/moc_Prefs.cpp: Prefs.h
+ $(MOC) Prefs.h -o ZREADERMOCS/moc_Prefs.cpp
+
+ZREADERMOCS/moc_QFloatBar.cpp: QFloatBar.h
+ $(MOC) QFloatBar.h -o ZREADERMOCS/moc_QFloatBar.cpp
+
+ZREADERMOCS/moc_QTReader.cpp: QTReader.h
+ $(MOC) QTReader.h -o ZREADERMOCS/moc_QTReader.cpp
+
+ZREADERMOCS/moc_QTReaderApp.cpp: QTReaderApp.h
+ $(MOC) QTReaderApp.h -o ZREADERMOCS/moc_QTReaderApp.cpp
+
+ZREADERMOCS/moc_QtrListView.cpp: QtrListView.h
+ $(MOC) QtrListView.h -o ZREADERMOCS/moc_QtrListView.cpp
+
+ZREADERMOCS/moc_ToolbarPrefs.cpp: ToolbarPrefs.h
+ $(MOC) ToolbarPrefs.h -o ZREADERMOCS/moc_ToolbarPrefs.cpp
+
+ZREADERMOCS/moc_URLDialog.cpp: URLDialog.h
+ $(MOC) URLDialog.h -o ZREADERMOCS/moc_URLDialog.cpp
+
+ZREADERMOCS/moc_cbkmkselector.cpp: cbkmkselector.h
+ $(MOC) cbkmkselector.h -o ZREADERMOCS/moc_cbkmkselector.cpp
+
+ZREADERMOCS/moc_fileBrowser.cpp: fileBrowser.h
+ $(MOC) fileBrowser.h -o ZREADERMOCS/moc_fileBrowser.cpp
+
+ZREADERMOCS/moc_infowin.cpp: infowin.h
+ $(MOC) infowin.h -o ZREADERMOCS/moc_infowin.cpp
+
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 @@
+TEMPLATE = app
+CONFIG = qt warn_on release
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Coder.h \
+ CSource.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ PPMd.h \
+ PPMdType.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StateData.h \
+ StyleConsts.h \
+ SubAlloc.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ arrierego.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ nef.h \
+ ZREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ usenef.h \
+ ZREADERINC/useqpe.h \
+ ustring.h \
+ util.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ fileBrowser.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ util.cpp \
+ version.cpp
+
+
+INTERFACES =
+DESTDIR = $(QPEDIR)/bin
+INCLUDEPATH += ZREADERINC
+DEPENDPATH += ZREADERINC
+TARGET = uqtreader
+LIBS += -lqpe -lreader_codec
+
+OBJECTS_DIR = ZREADEROBJS
+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 @@
+Makefile
+config.in
+moc_*
+.moc
+.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 @@
+DEFINES += OPIE USEQPE
+VPATH = ..
+TEMPLATE = app
+CONFIG = qt warn_on release
+HEADERS = Aportis.h \
+ Bkmks.h \
+ BuffDoc.h \
+ ButtonPrefs.h \
+ CAnnoEdit.h \
+ CBuffer.h \
+ CDrawBuffer.h \
+ CEncoding.h \
+ CEncoding_tables.h \
+ CExpander.h \
+ CFilter.h \
+ CloseDialog.h \
+ Filedata.h \
+ FixedFont.h \
+ FontControl.h \
+ GraphicWin.h \
+ Markups.h \
+ Navigation.h \
+ Palm2QImage.h \
+ Prefs.h \
+ PPMd.h \
+ PPMdType.h \
+ QFloatBar.h \
+ QTReader.h \
+ QTReaderApp.h \
+ QtrListView.h \
+ Queue.h \
+ StyleConsts.h \
+ ToolbarPrefs.h \
+ URLDialog.h \
+ ZText.h \
+ arith.h \
+ cbkmkselector.h \
+ config.h \
+ fileBrowser.h \
+ infowin.h \
+ linktype.h \
+ my_list.h \
+ names.h \
+ ../OREADERINC/opie.h \
+ pdb.h \
+ plucker.h \
+ plucker_base.h \
+ ppm.h \
+ ppm_expander.h \
+ usenef.h \
+ ../OREADERINC/useqpe.h \
+ ustring.h \
+ util.h \
+ utypes.h \
+ version.h \
+ ztxt.h
+
+SOURCES = BuffDoc.cpp \
+ ButtonPrefs.cpp \
+ CAnnoEdit.cpp \
+ CDrawBuffer.cpp \
+ CEncoding.cpp \
+ CEncoding_tables.cpp \
+ CFilter.cpp \
+ CRegExp.cpp \
+ CloseDialog.cpp \
+ FontControl.cpp \
+ GraphicWin.cpp \
+ Prefs.cpp \
+ QTReader.cpp \
+ QTReaderApp.cpp \
+ QtrListView.cpp \
+ ToolbarPrefs.cpp \
+ URLDialog.cpp \
+ fileBrowser.cpp \
+ infowin.cpp \
+ main.cpp \
+ orkey.cpp \
+ util.cpp \
+ version.cpp
+
+INTERFACES =
+DESTDIR = $(OPIEDIR)/bin
+INCLUDEPATH += ../OREADERINC $(OPIEDIR)/include
+DEPENDPATH += ../OREADERINC $(OPIEDIR)/include
+TARGET = reader
+LIBS += -lopieui2 -lqpe -lreader_codec
+
+DEPENDPATH += ../OREADERINC
+
+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 @@
+red='\e[0;31m'
+RED='\e[1;31m'
+blue='\e[0;34m'
+BLUE='\e[1;34m'
+cyan='\e[0;36m'
+CYAN='\e[1;36m'
+NC='\e[0m' # No Color
+
+if test -z $OLDPATH; then
+ export OLDPATH=$PATH
+fi
+
+if test -z $OLD_LD_LIBRARY_PATH; then
+ export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+fi
+
+#export QPEDIR=/opt/Qtopia
+export QTDIR=/home/tim/nevyos/qt-embedded-free-3.1.1
+export PATH=$QTDIR/bin:$OLDPATH
+export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++
+export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH
+
+#PS1="[${cyan}\T$NC][${RED}Laptop${NC}]\W> "
+#PS1="[${RED}NevyOS${NC}]\W> "
+PS1="[NevyOS]\W> "
+
+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 @@
+red='\e[0;31m'
+RED='\e[1;31m'
+blue='\e[0;34m'
+BLUE='\e[1;34m'
+cyan='\e[0;36m'
+CYAN='\e[1;36m'
+NC='\e[0m' # No Color
+
+if test -z $OLDPATH; then
+ export OLDPATH=$PATH
+fi
+
+if test -z $OLD_LD_LIBRARY_PATH; then
+ export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+fi
+
+export QPEDIR=/opt/Qtopia/opie
+export QTDIR=/opt/Qtopia/opie
+export PATH=$QTDIR/bin:/usr/local/arm/3.3/bin:$OLDPATH
+export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-opie-g++
+#export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH
+
+PS1="[Opie]\W> "
+
+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 @@
+red='\e[0;31m'
+RED='\e[1;31m'
+blue='\e[0;34m'
+BLUE='\e[1;34m'
+cyan='\e[0;36m'
+CYAN='\e[1;36m'
+NC='\e[0m' # No Color
+
+if test -z $OLDPATH; then
+ export OLDPATH=$PATH
+fi
+
+if test -z $OLD_LD_LIBRARY_PATH; then
+ export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+fi
+
+#export QPEDIR=/opt/Qtopia
+export QTDIR=/usr/lib/qt3
+export PATH=$QTDIR/bin:$OLDPATH
+#export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++
+
+export READERDIR=/home/tim/uqtreader
+export LD_LIBRARY_PATH=$READERDIR/lib:$OLD_LD_LIBRARY_PATH
+
+
+#PS1="[${cyan}\T$NC][${RED}Laptop${NC}]\W> "
+#PS1="[${RED}NevyOS${NC}]\W> "
+PS1="[QT]\W> "
+
+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 @@
+red='\e[0;31m'
+RED='\e[1;31m'
+blue='\e[0;34m'
+BLUE='\e[1;34m'
+cyan='\e[0;36m'
+CYAN='\e[1;36m'
+NC='\e[0m' # No Color
+
+if test -z $OLDPATH; then
+ export OLDPATH=$PATH
+fi
+
+if test -z $OLD_LD_LIBRARY_PATH; then
+ export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+fi
+
+export QPEDIR=/opt/Qtopia
+export QTDIR=/opt/Qtopia
+export PATH=$QTDIR/bin:$OLDPATH
+export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++
+export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH
+
+#PS1="[${cyan}\T$NC][${RED}Laptop${NC}]\W> "
+#PS1="[${RED}Laptop${NC}]\W> "
+PS1="[Laptop]\W> "
+
+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 @@
+red='\e[0;31m'
+RED='\e[1;31m'
+blue='\e[0;34m'
+BLUE='\e[1;34m'
+cyan='\e[0;36m'
+CYAN='\e[1;36m'
+NC='\e[0m' # No Color
+
+if test -z $OLDPATH; then
+ export OLDPATH=$PATH
+fi
+
+if test -z $OLD_LD_LIBRARY_PATH; then
+ export OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+fi
+
+export QPEDIR=/opt/Qtopia/sharp
+export QTDIR=/opt/Qtopia/sharp
+export PATH=$QTDIR/bin:/usr/local/arm/bin:$OLDPATH
+export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-sharp-g++
+export LD_LIBRARY_PATH=$QTDIR/lib:$OLD_LD_LIBRARY_PATH
+
+PS1="[Zaurus]\W> "
+
+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 @@
+#include <qmap.h>
+#include <qfileinfo.h>
+#include <qtextstream.h>
+#include <qdir.h>
+#include "useqpe.h"
+#ifdef USEQPE
+#include <qpe/global.h>
+#endif
+#include "CDrawBuffer.h"
+#include "striphtml.h"
+#include "hrule.h"
+#include "util.h"
+
+#include <qregexp.h>
+#include <qimage.h>
+#include <qpixmap.h>
+//#include <qprogressdialog.h>
+//#include <qapplication.h>
+
+static unsigned char h2i(unsigned char c)
+{
+ unsigned char ret = 0;
+ if ('0' <= c && c <= '9')
+ {
+ ret = c - '0';
+ }
+ else if ('a' <= c && c <= 'f')
+ {
+ ret = c - 'a' + 10;
+ }
+ return ret;
+}
+
+static void parse_color(const QString& attr, unsigned char& r, unsigned char& g, unsigned char& b)
+{
+ r = g = b = 0;
+ if (attr.length() >= 7 && attr[0] == '#')
+ {
+ r = h2i(attr[1].unicode());
+ r = 16*r + h2i(attr[2].unicode());
+ g = h2i(attr[3].unicode());
+ g = 16*g + h2i(attr[4].unicode());
+ b = h2i(attr[5].unicode());
+ b = 16*b + h2i(attr[6].unicode());
+ }
+ else if (attr == "red")
+ {
+ r = 255;
+ }
+ else if (attr == "green")
+ {
+ g = 255;
+ }
+ else if (attr == "blue")
+ {
+ b = 255;
+ }
+ else if (attr == "white")
+ {
+ r = g = b = 255;
+ }
+ else if (attr == "black")
+ {
+ r = g = b = 0;
+ }
+ else
+ {
+ qDebug("Don't understand colour \"%s\"", (const char*)attr);
+ }
+}
+
+CNavigation_base<htmlmark> striphtml::m_nav;
+
+void striphtml::skipblock(const QString& _ent)
+{
+ tchar ch = '>';
+ CStyle dummy;
+ QString ent;
+ unsigned long pos;
+ do
+ {
+ while (ch != '<' && ch != UEOF)
+ {
+ mygetch(ch, dummy, pos);
+ }
+
+ ch = skip_ws();
+
+ ent = getname(ch, " >").lower();
+ qDebug("Skipblock:%s", (const char*)ent);
+ } while (ent != _ent && ch != UEOF);
+}
+
+void striphtml::locate(unsigned int n)
+{
+ m_inblock = false;
+ text_q = "";
+ forcecentre = false;
+ ignorespace = false;
+ while (!stylestack.isEmpty()) stylestack.pop();
+ currentstyle.unset();
+ qDebug("striphtml:locating:%u", n);
+ parent->locate(n);
+}
+
+int striphtml::getpara(CBuffer& buff, unsigned long& startpos)
+{
+ tchar ch;
+ CStyle sty;
+ unsigned long pos;
+ int i = 0;
+ parent->getch(ch, sty, startpos);
+ pos = startpos;
+ while (1)
+ {
+ if (ch == 10 && !isPre)
+ {
+ ch = ' ';
+ }
+ if (ch == UEOF)
+ {
+ // qDebug("EOF:%d:%u", i, pos);
+ buff[i] = 0;
+ if (i == 0)
+ {
+ i = -1;
+ }
+ return i;
+ }
+ else if (ch == '<')
+ {
+ tchar ch2 = skip_ws();
+ QString ent = getname(ch2, " >");
+ ent = ent.lower();
+ // qDebug("ent:%s", (const char*)ent);
+ if (ent == "a")
+ {
+ buff[i++] = '<';
+ buff[i++] = 'a';
+ buff[i++] = ch2;
+ // buff[i] = 0; qDebug("ANCHOR:%s", (const char*)toQString(buff.data()));
+ }
+ else if (ent == "/a")
+ {
+ buff[i++] = '<';
+ buff[i++] = '/';
+ buff[i++] = 'a';
+ buff[i++] = ch2;
+ // buff[i] = 0; qDebug("/ANCHOR:%s", (const char*)toQString(buff.data()));
+ }
+ else if (ent == "div")
+ {
+ // buff[i] = 0; qDebug("DIV:%s", (const char*)toQString(buff.data()));
+ if (i == 0)
+ {
+ buff[i++] = '<';
+ buff[i++] = 'd';
+ buff[i++] = 'i';
+ buff[i++] = 'v';
+ buff[i++] = ' ';
+ buff[i++] = ch2;
+ while (ch2 != '>' && ch2 != UEOF && i < 2048)
+ {
+ parent->getch(ch2, sty, pos);
+ buff[i++] = ch2;
+ }
+ }
+ else
+ {
+ locate(pos);
+ }
+ buff[i++] = 0;
+ // qDebug("DIV:%s", (const char*)toQString(buff.data()));
+ return i;
+ }
+ else if (ent == "p" || (ent[0] == 'h' && ent.length() == 2 && QString("123456789").find(ent[1]) != -1))
+ {
+ buff[i++] = 0;
+ while (ch2 != '>' && ch2 != UEOF)
+ {
+ parent->getch(ch2, sty, pos);
+ }
+ return i;
+ }
+ else
+ {
+ while (ch2 != '>' && ch2 != UEOF)
+ {
+ parent->getch(ch2, sty, pos);
+ }
+ }
+ }
+ else
+ {
+ buff[i++] = ch;
+ }
+ parent->getch(ch, sty, pos);
+ }
+}
+
+QString striphtml::dehtml(const QString& _info)
+{
+ QString info;
+ for (int i = 0; i < _info.length(); i++)
+ {
+ tchar ch = _info[i];
+ if (ch == '%')
+ {
+ ch = 0;
+ for (int j = 0; j < 2; j++)
+ {
+ ch <<= 4;
+ tchar ch1 = _info[++i];
+ if ('0' <= ch1 && ch1 <= '9')
+ {
+ ch += ch1 - '0';
+ }
+ else if ('a' <= ch1 && ch1 <= 'f')
+ {
+ ch += ch1 - 'a' + 10;
+ }
+ else if ('A' <= ch1 && ch1 <= 'F')
+ {
+ ch += ch1 - 'A' + 10;
+ }
+ }
+ }
+ info += ch;
+ }
+ return info;
+}
+
+bool striphtml::findanchor(const QString& _info)
+{
+ // QProgressDialog dlg("Finding link...", QString::null, 0, NULL, "progress", true);
+ // QProgressBar dlg(0);
+#if defined(USEQPE) || defined(_WINDOWS)
+ QString info;
+ for (int i = 0; i < _info.length(); i++)
+ {
+ tchar ch = _info[i];
+ if (QString(".^$[]*+?").find(ch) != -1)
+ {
+ info += '\\';
+ }
+ info += ch;
+ }
+#else
+ QString info = QRegExp::escape(_info);
+#endif
+ qDebug("Adjusted searchstring:%s", (const char*)info);
+ QString sname("<[Aa][^>]*[ \t]+[Nn][Aa][Mm][Ee][ \t]*=[ \t]*\"?");
+ sname += info + "\"?[ \t>]";
+ QString sid("<[A-Za-z][^>]*[ \t]+[Ii][Dd][ \t]*=[ \t]*\"?");
+ sid += info+"\"?[ \t>]";
+#ifdef USEQPE
+ QRegExp name(sname);
+ QRegExp id(sid);
+#else
+ QRegExp name(sname+"|"+sid);
+#endif
+ bool ret = true;
+ locate(0);
+ unsigned long pos = 0;
+ unsigned long startpos = 0;
+ int offset;
+ CBuffer test;
+ qDebug("striphtml::findanchor");
+ // dlg.show();
+ if (getpara(test, pos) >= 0)
+ {
+ while (1)
+ {
+ // qApp->processEvents();
+ if ((offset = name.match(toQString(test.data()))) != -1) break;
+#ifdef USEQPE
+ if ((offset = id.match(toQString(test.data()))) != -1) break;
+#endif
+ if (getpara(test, pos) < 0)
+ {
+ locate(startpos);
+ qDebug("Not found");
+ return false;
+ }
+ }
+ locate(pos);
+ qDebug("Found");
+ ret = true;
+ }
+ else
+ {
+ locate(startpos);
+ qDebug("Not found");
+ ret = false;
+ }
+ return ret;
+}
+
+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)
+{
+ href2filepos = new QMap<QString, unsigned long>;
+ id2href = new QMap<unsigned long, QString>;
+}
+
+striphtml::~striphtml()
+{
+ if (entmap != NULL) delete entmap;
+ delete href2filepos;
+ delete id2href;
+}
+
+void striphtml::initentmap()
+{
+ entmap = new QMap<QString, tchar>;
+ QString fname(QTReaderUtil::getPluginPath("data"));
+ QFileInfo fi;
+ fi.setFile(fname, "HTMLentities");
+ if (fi.exists())
+ {
+ fname = fi.absFilePath();
+
+ QFile fl(fname);
+ if (fl.open(IO_ReadOnly))
+ {
+ QTextStream t(&fl);
+ QString key, value;
+ while (!t.eof())
+ {
+ QString data = t.readLine();
+ int colon = data.find(':');
+ if (colon > 0)
+ {
+ QString key = data.left(colon);
+ QString value = data.right(data.length()-colon-1);
+ bool ok;
+ int ret = value.toInt(&ok);
+ if (ok)
+ {
+ (*entmap)[key] = ret;
+ }
+ }
+ }
+ fl.close();
+ }
+ }
+}
+
+unsigned short striphtml::skip_ws()
+{
+ tchar ch;
+ CStyle sty;
+ unsigned long dummy;
+ do
+ {
+ mygetch(ch, sty, dummy);
+ }
+ while (ch < 33 && ch != UEOF);
+ return ch;
+}
+
+unsigned short striphtml::skip_ws_end()
+{
+ unsigned long dummy;
+ return skip_ws_end(dummy);
+}
+
+unsigned short striphtml::skip_ws_end(unsigned long& pos)
+{
+ tchar ch;
+ CStyle sty;
+ do
+ {
+ mygetch(ch, sty, pos);
+ }
+ while (ch != '>' && ch != UEOF);
+ return ch;
+}
+
+QString striphtml::getname(tchar& ch, const QString& nd)
+{
+ QString nm = "";
+ // nm += ch;
+ CStyle sty;
+ unsigned long dummy;
+ while (1)
+ {
+ // if ( QChar(ch).isLetterOrNumber() )
+ if (ch != UEOF && nd.find(ch, 0, false) == -1 && nm.length() < 2048)
+ {
+ nm += ch;
+ }
+ else
+ {
+ break;
+ }
+ mygetch(ch, sty, dummy);
+ }
+ return nm;
+}
+
+QString striphtml::getattr(tchar& ch)
+{
+ QString ref;
+ CStyle sty;
+ unsigned long pos;
+ if (ch == ' ') ch = skip_ws();
+ if (ch == '=')
+ {
+ ch = skip_ws();
+ if (ch == '"')
+ {
+ mygetch(ch, sty, pos);
+ ref = getname(ch, "\"");
+ ch = skip_ws();
+ }
+ else
+ {
+ ref = getname(ch, " >");
+ if (ch == ' ') ch = skip_ws();
+ }
+ }
+ return ref;
+}
+
+linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm)
+{
+#if defined(USEQPE) || defined(_WINDOWS)
+ QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n);
+#else
+ QMap<unsigned long, QString>::iterator hrefit = id2href->find(n);
+#endif
+ if (hrefit == id2href->end())
+ {
+ return eNone;
+ }
+ QString href = *hrefit;
+#if defined(USEQPE) || defined(_WINDOWS)
+ QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href);
+#else
+ QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href);
+#endif
+ if (fpit == href2filepos->end())
+ {
+ if (href == "history.back()")
+ {
+ QString fc = currentfile;
+ unsigned long loc;
+ htmlmark m(fc, loc);
+ linkType ret = (m_nav.back(m)) ? eFile : eNone;
+ if (fc == m.filename())
+ {
+ if ((ret & eFile) != 0)
+ {
+ locate(m.posn());
+ return eLink;
+ }
+ }
+ return eNone;
+ }
+ qDebug("Searching for %s", (const char*)href);
+
+
+ QString file, name;
+
+ int colon = href.find('#');
+ if (colon >= 0)
+ {
+ file = dehtml(href.left(colon));
+ name = dehtml(href.right(href.length()-colon-1));
+ }
+ else
+ {
+ file = dehtml(href);
+ }
+
+ qDebug("File:%s", (const char*)file);
+ qDebug("Name:%s", (const char*)name);
+
+
+ if (file.isEmpty())
+ {
+ fpit = href2filepos->find(name);
+ if (fpit != href2filepos->end())
+ {
+ locate(*fpit);
+ return eLink;
+ }
+ else
+ {
+ // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\"";
+ qDebug("Do a search for:%s", (const char*)name);
+ parent->locate(0);
+ findanchor(name);
+ return eLink;
+ }
+ }
+ else
+ // if (href.find('#') == -1)
+ {
+ if (m_bchm)
+ {
+ w = "/"+file;
+ nm = name;
+ return eFile;
+ }
+ else
+ {
+ QFileInfo f(currentfile);
+ QFileInfo f1(f.dir(true), file);
+ if (f1.exists())
+ {
+ w = f1.absFilePath();
+ nm = name;
+ }
+ else
+ {
+ w = file;
+ }
+ return (f1.exists() ? eFile : eNone);
+ }
+ }
+ return eNone;
+ }
+ locate(*fpit);
+ // parent->locate((*href2filepos)[(*id2href)[n]]);
+ return eLink;
+}
+/*
+unsigned short striphtml::parse_m()
+{
+ tchar ch;
+ CStyle sty;
+ unsigned long dummy;
+ mygetch(ch, sty, dummy);
+ if (ch == 'm' || ch == 'M')
+ {
+ ch = skip_ws_end();
+ if (ch == '>')
+ {
+ return 0;
+ }
+ }
+ return ch;
+}
+*/
+
+void striphtml::mygetch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ if (!text_q.isEmpty() && !m_inblock)
+ {
+ ch = text_q[0].unicode();
+ text_q = text_q.right(text_q.length()-1);
+ }
+ else
+ {
+ parent->getch(ch, sty, pos);
+ if (ch == '<')
+ {
+ m_inblock = true;
+ }
+ if (ch == '>')
+ {
+ m_inblock = false;
+ }
+ }
+ if (ch == 10 && !isPre)
+ {
+ ch = ' ';
+ }
+}
+
+void striphtml::parse_paragraph(CStyle& currentstyle, tchar& ch, unsigned long pos)
+{
+/*
+ int count = 0;
+ for (CList<CStyle>::iterator iter = stylestack.begin(); iter != stylestack.end(); ++iter)
+ {
+ count++;
+ }
+ qDebug("Currently have %u styles", count);
+*/
+ if (stylestack.isEmpty())
+ {
+ currentstyle.unset();
+ }
+ else
+ {
+ qDebug("Using stack style");
+ currentstyle = stylestack.first();
+ }
+ if (forcecentre)
+ {
+ currentstyle.setCentreJustify();
+ }
+ if (ch == ' ') ch = skip_ws();
+ while (ch != '>' && ch != UEOF)
+ {
+ QString ent = getname(ch, " =>").lower();
+ QString attr = getattr(ch).lower();
+ //qDebug("(Paragraph)Entity:%s Attr:%s", (const char*)ent, (const char*)attr);
+ if (ent == "align")
+ {
+ if (attr == "center")
+ {
+ currentstyle.setCentreJustify();
+ }
+ if (attr == "right")
+ {
+ currentstyle.setRightJustify();
+ }
+ }
+ if (ent == "id")
+ {
+ (*href2filepos)[attr] = pos;
+ }
+ if (ent == "bgcolor")
+ {
+ qDebug("Got paper colour:%s", (const char*)attr);
+ unsigned char r,g,b;
+ parse_color(attr, r, g, b);
+ currentstyle.setPaper(r, g, b);
+ }
+ if (ent == "color")
+ {
+ qDebug("Got foreground colour:%s", (const char*)attr);
+ unsigned char r,g,b;
+ parse_color(attr, r, g, b);
+ currentstyle.setColour(r, g, b);
+ }
+ if (ch == ' ') ch = skip_ws();
+ }
+ ch = 10;
+}
+
+void striphtml::getch(tchar& ch, CStyle& sty, unsigned long& pos)
+{
+ currentstyle.clearPicture();
+ if (!q.isEmpty())
+ {
+ ch = q[0].unicode();
+ if (ch == '-')
+ {
+ tchar w = q[1].unicode();
+ tchar h = q[2].unicode();
+ unsigned char r = q[3].unicode();
+ unsigned char g = q[4].unicode();
+ unsigned char b = q[5].unicode();
+ ch = '#';
+ //qDebug("html:hrule<%u, %u>", w, h);
+ currentstyle.setPicture(false, hRule(w,h,r,g,b));
+ q = q.right(q.length()-6);
+ }
+ else
+ {
+ q = q.right(q.length()-1);
+ }
+ sty = currentstyle;
+ return;
+ }
+ do
+ {
+ unsigned long npos;
+ CStyle dummy;
+ mygetch(ch, dummy, pos);
+ // if (ch == 10 && !isPre) ch = ' ';
+ while (ch == '<' && ch != UEOF)
+ {
+ ch = skip_ws();
+
+ QString ent = getname(ch, " >").lower();
+
+ // qDebug("Entity:%s", (const char*)ent);
+
+ if (ent == "a"/* || ent == "reference"*/)
+ {
+ if (ch == ' ') ch = skip_ws();
+ bool fileposfound = false;
+ bool ishref = false;
+ unsigned int filepos = 0;
+ QString ref, name;
+ while (ch != '>' && ch != UEOF)
+ {
+ QString ent = getname(ch, " =>").lower();
+ QString attr = getattr(ch);
+ qDebug("<A>Entity:%s Attr:%s", (const char*)ent, (const char*)attr);
+ if (ent == "name")
+ {
+ name = attr;
+ }
+ if (ent == "onclick")
+ {
+ int st = attr.find('\'');
+ int nd = attr.findRev('\'');
+ ref = attr.mid(st+1, nd-st-1);
+ ishref = true;
+ qDebug("Onclick:%s", (const char*)ref);
+ }
+ if (ent == "href")
+ {
+ ishref = true;
+ ref = attr;
+ }
+ if (ent == "filepos")
+ {
+ filepos = attr.toUInt(&fileposfound);
+ if (ref.isEmpty())
+ {
+ ishref = true;
+ ref = attr;
+ }
+ }
+ if (ent == "title")
+ {
+ text_q = attr + "</a><p>";
+ }
+ qDebug("<a %s=%s>", (const char*)ent, (const char*)ref);
+ }
+ if (ishref)
+ {
+ currentstyle.setColour(0,0,255);
+ currentstyle.setLink(true);
+ currentstyle.setData(currentid);
+ if (!text_q.isEmpty())
+ {
+ currentstyle.setBold();
+ currentstyle.setCentreJustify();
+ }
+ (*id2href)[currentid] = ref;
+ currentid++;
+
+
+ if (fileposfound)
+ {
+ (*href2filepos)[ref] = filepos;
+ }
+ }
+ if (!name.isEmpty())
+ {
+ (*href2filepos)[name] = pos;
+ }
+ }
+ else if (ent == "p")
+ {
+ parse_paragraph(currentstyle, ch, pos);
+ currentstyle.setExtraSpace(3);
+ continue;
+ }
+ else if (ent == "div")
+ {
+ parse_paragraph(currentstyle, ch, pos);
+ stylestack.push_front(currentstyle);
+ //indent = 0;
+ continue;
+ }
+ else if (ent == "sup")
+ {
+ currentstyle.setVOffset(-1);
+ }
+ else if (ent == "sup")
+ {
+ currentstyle.setVOffset(1);
+ }
+ else if (ent == "/sup" || ent == "/sub")
+ {
+ currentstyle.setVOffset(0);
+ }
+ else if (ent == "span")
+ {
+ if (ch == ' ') ch = skip_ws();
+ while (ch != '>' && ch != UEOF)
+ {
+ QString ent = getname(ch, " =>").lower();
+ QString attr = getattr(ch).lower();
+ if (ent == "bgcolor")
+ {
+ qDebug("Got background colour:%s", (const char*)attr);
+ unsigned char r,g,b;
+ parse_color(attr, r, g, b);
+ currentstyle.setBackground(r, g, b);
+ }
+ if (ent == "color")
+ {
+ qDebug("Got foreground colour:%s", (const char*)attr);
+ unsigned char r,g,b;
+ parse_color(attr, r, g, b);
+ currentstyle.setColour(r, g, b);
+ }
+ }
+ stylestack.push_front(currentstyle);
+ }
+ else if (ent == "/span")
+ {
+ if (ch != '>') ch = skip_ws_end();
+ currentstyle.setBackground(255, 255, 255);
+ currentstyle.setColour(0, 0, 0);
+ if (!stylestack.isEmpty())
+ {
+ stylestack.pop();
+ }
+ }
+ else if (ent == "pre")
+ {
+ isPre = true;
+ currentstyle.setMono();
+ }
+ else if (ent == "tt")
+ {
+ currentstyle.setMono();
+ }
+ else if (ent == "b" || ent == "strong")
+ {
+ currentstyle.setBold();
+ }
+ else if (ent == "u")
+ {
+ currentstyle.setUnderline();
+ }
+ else if (ent == "/u")
+ {
+ currentstyle.unsetUnderline();
+ }
+ else if (ent == "blockquote")
+ {
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ currentstyle.setLeftMargin(30);
+ currentstyle.setRightMargin(30);
+ continue;
+ }
+ else if (ent == "br" || ent == "br/")
+ {
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ continue;
+ }
+ else if (ent == "mbp:pagebreak")
+ {
+ /*
+ if (ch != '>') ch = skip_ws_end(pos);
+ q += 10;
+ q += QChar(UEOF);
+ ch = 10;
+ continue;
+ */
+ ch = 6;
+ // currentstyle.setTop();
+ continue;
+ }
+ else if (ent == "center")
+ {
+ //forcecentre = true;
+ qDebug("setting centre");
+ currentstyle.setCentreJustify();
+ ch = 10;
+ continue;
+ }
+ else if (ent == "/center")
+ {
+ qDebug("unsetting centre");
+ forcecentre = false;
+ }
+ else if (ent == "li")
+ {
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ if (m_listtype[indent % m_cmaxdepth] == 1)
+ {
+ q.setNum(m_ctr[indent % m_cmaxdepth]++);
+ }
+ else
+ {
+ q += QChar(8226);
+ }
+ q += ' ';
+ currentstyle.setLeftMargin(6*indent);
+ qDebug("Setting indent:%d", indent);
+ continue;
+ }
+ else if (ent == "ul")
+ {
+ indent++;
+ m_listtype[indent % m_cmaxdepth] = 0;
+ }
+ else if (ent == "/ul")
+ {
+ indent--;
+ }
+ else if (ent == "ol")
+ {
+ indent++;
+ m_listtype[indent % m_cmaxdepth] = 1;
+ m_ctr[indent % m_cmaxdepth] = 1;
+ }
+ else if (ent == "/ol")
+ {
+ indent--;
+ }
+ else if (ent == "i")
+ {
+ currentstyle.setItalic();
+ }
+ else if (ent == "em")
+ {
+ currentstyle.setItalic();
+ }
+ else if (ent == "small")
+ {
+ currentstyle.setFontSize(-2);
+ }
+ else if (ent == "/small")
+ {
+ currentstyle.setFontSize(0);
+ }
+ else if (ent == "big")
+ {
+ currentstyle.setFontSize(2);
+ }
+ else if (ent == "/big")
+ {
+ currentstyle.setFontSize(0);
+ }
+ else if (ent[0] == 'h' && ent.length() == 2 && QString("123456789").find(ent[1]) != -1)
+ {
+ indent = 0;
+ if (ent[1] == '1')
+ {
+ parse_paragraph(currentstyle, ch, pos);
+ currentstyle.setFontSize(3);
+ currentstyle.setExtraSpace(8);
+ currentstyle.setBold();
+ // currentstyle.setExtraSpace(10);
+ continue;
+ }
+ else if (ent[1] == '2')
+ {
+ parse_paragraph(currentstyle, ch, pos);
+ currentstyle.setFontSize(2);
+ currentstyle.setExtraSpace(6);
+ currentstyle.setBold();
+ // currentstyle.setExtraSpace(10);
+ continue;
+ }
+ else if (ent[1] == '3')
+ {
+ parse_paragraph(currentstyle, ch, pos);
+ currentstyle.setFontSize(1);
+ currentstyle.setExtraSpace(4);
+ currentstyle.setBold();
+ // currentstyle.setExtraSpace(10);
+ continue;
+ }
+ else
+ {
+ parse_paragraph(currentstyle, ch, pos);
+ currentstyle.setExtraSpace(4);
+ currentstyle.setBold();
+ // currentstyle.setExtraSpace(10);
+ continue;
+ }
+ }
+
+
+ else if (ent == "/a")
+ {
+ currentstyle.setColour(0,0,0);
+ currentstyle.setLink(false);
+ }
+ else if (ent == "/pre")
+ {
+ currentstyle.unsetMono();
+ isPre = false;
+ }
+ else if (ent == "/tt")
+ {
+ currentstyle.unsetMono();
+ }
+ else if (ent == "/b" || ent == "/strong")
+ {
+ currentstyle.unsetBold();
+ }
+ else if (ent == "/i")
+ {
+ currentstyle.unsetItalic();
+ }
+ else if (ent == "/em")
+ {
+ currentstyle.unsetItalic();
+ }
+ else if (ent == "/div")
+ {
+ currentstyle.unset();
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ if (!stylestack.isEmpty())
+ {
+ stylestack.pop();
+ }
+ continue;
+ }
+ else if (ent == "tr")
+ {
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ q += '-';
+ q += QChar(parent->getwidth());
+ q += 2;
+ q += '\0';
+ q += '\0';
+ q += '\0';
+ continue;
+ }
+ else if (ent == "td")
+ {
+ if (ch != '>') ch = skip_ws_end();
+ ignorespace = false;
+ }
+ else if (ent == "/td")
+ {
+ ignorespace = true;
+ // parse_paragraph(currentstyle, ch, pos);
+ //stylestack.push_front(currentstyle);
+ if (ch != '>') ch = skip_ws_end();
+ // ch = '|';
+ //continue;
+ ch = 10;
+ q += '-';
+ q += QChar(parent->getwidth());
+ q += 1;
+ q += '\0';
+ q += '\0';
+ q += '\0';
+ continue;
+ }
+ /*
+ else if (ent == "/td")
+ {
+ currentstyle.unset();
+ if (ch != '>') ch = skip_ws_end();
+ if (!stylestack.isEmpty())
+ {
+ stylestack.pop();
+ }
+ // ch = 10;
+ continue;
+ }
+ */
+ else if (ent[0] == '/' && ent.length() == 3 && ent[1] == 'h' && QString("123456789").find(ent[2]) != -1)
+ {
+ currentstyle.unset();
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ continue;
+ }
+
+
+
+ else if (ent == "table" || ent == "/table")
+ {
+ currentstyle.unset();
+ ignorespace = (ent == "table");
+ if (ch == ' ') ch = skip_ws();
+ while (ch != '>' && ch != UEOF)
+ {
+ QString ent = getname(ch, " =>").lower();
+ QString attr = getattr(ch);
+ qDebug("<table>Entity:%s Attr:%s", (const char*)ent, (const char*)attr);
+ }
+ if (ch != '>') ch = skip_ws_end();
+
+ ch = 10;
+ q += '-';
+ q += QChar(parent->getwidth());
+ q += 2;
+ q += '\0';
+ q += '\0';
+ q += '\0';
+ continue;
+ }
+ else if (ent == "hr")
+ {
+ if (ch == ' ') ch = skip_ws();
+ // if (stylestack.isEmpty())
+ // {
+ currentstyle.unset();
+ // }
+ /*
+ else
+ {
+ qDebug("Using stack style");
+ currentstyle = stylestack.first();
+ }
+ */
+ unsigned char red = 0, green = 0, blue = 0;
+ while (ch != '>' && ch != UEOF)
+ {
+ QString ent = getname(ch, " =>").lower();
+ QString attr = getattr(ch);
+ if (ent == "color")
+ {
+ parse_color(attr, red, green, blue);
+ }
+ qDebug("<hr>Entity:%s Attr:%s", (const char*)ent, (const char*)attr);
+ }
+ if (ch != '>') ch = skip_ws_end();
+ ch = 10;
+ q += '-';
+ q += QChar(parent->getwidth());
+ q += 3;
+ q += red;
+ q += green;
+ q += blue;
+ continue;
+ }
+
+
+
+ else if (ent == "img")
+ {
+ if (ch == ' ') ch = skip_ws();
+ while (ch != '>' && ch != UEOF)
+ {
+ QString ent = getname(ch, " =>").lower();
+ QString attr = getattr(ch);
+ qDebug("<img>Entity:%s Attr:%s", (const char*)ent, (const char*)attr);
+ if (ent == "src")
+ {
+ if (m_bchm)
+ {
+ QImage* img = parent->getPicture(attr);
+ if (img != NULL)
+ {
+ currentstyle.setPicture(true, img);
+ }
+ }
+ else
+ {
+ QFileInfo f(currentfile);
+ QFileInfo f1(f.dir(true), attr);
+ QPixmap pm;
+ if (pm.load(f1.absFilePath()))
+ {
+ QImage* img = new QImage(pm.convertToImage());
+ currentstyle.setPicture(true, img);
+ }
+ }
+ }
+ if (ent == "recindex")
+ {
+ bool ok;
+ unsigned int picindex = attr.toUInt(&ok);
+ qDebug("Looking for image at %u", picindex);
+ QImage* img = parent->getPicture(picindex);
+ if (img != NULL)
+ {
+ currentstyle.setPicture(true, img);
+ }
+ else
+ {
+ qDebug("No image found");
+ }
+ }
+ }
+ if (ch != '>') ch = skip_ws_end();
+ ch = '#';
+ break;
+ }
+ else if (ent.left(2) == "dc")
+ {
+ QString nd("/");
+ skipblock(nd+ent);
+ }
+ else if (ent == "metadata")
+ {
+ // skipblock("/metadata");
+ }
+ /*
+ else if (ent == "metadata")
+ {
+ currentstyle.setFontSize(-2);
+ }
+ else if (ent == "/metadata")
+ {
+ currentstyle.unset();
+ ch = 10;
+ continue;
+ }
+ */
+ else
+ {
+ if (ent[0] != '/')
+ qDebug("Not handling:%s", (const char*)ent);
+ }
+
+ if (ch != '>') ch = skip_ws_end();
+ mygetch(ch, dummy, npos);
+ }
+ if (ch == '&')
+ {
+ mygetch(ch, dummy, npos);
+ if (ch == '#')
+ {
+ int id = 0;
+ mygetch(ch, dummy, npos);
+ while (ch != ';' && ch != UEOF)
+ {
+ id = 10*id+ch-'0';
+ mygetch(ch, dummy, npos);
+ }
+ ch = id;
+ }
+ else
+ {
+ QString en;
+ en += ch;
+ mygetch(ch, dummy, npos);
+ while (ch != ';' && ch != UEOF)
+ {
+ en += ch;
+ mygetch(ch, dummy, npos);
+ }
+ if (entmap == NULL) initentmap();
+#if defined(USEQPE) || defined(_WINDOWS)
+ QMap<QString, tchar>::Iterator it = entmap->find(en);
+#else
+ QMap<QString, tchar>::iterator it = entmap->find(en);
+#endif
+ if (it != entmap->end())
+ {
+ ch = *it;
+ }
+ else
+ {
+ ch = '.';
+ }
+ }
+ }
+ // sty = (dummy == ucFontBase) ? currentstyle : dummy;
+ sty = currentstyle;
+ }
+ while (!isPre && (lastch == ' ' || lastch == 10 || ignorespace) && ch == ' ');
+ // lastch = ch;
+ lastch = ch;
+ return;
+}
+
+extern "C"
+{
+ CFilter* newfilter(const QString& s) { return new striphtml(s); }
+}
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 @@
+#ifndef __STRIPHTML_H
+#define __STRIPHTML_H
+
+#include "CFilter.h"
+#include "Navigation.h"
+#include "CBuffer.h"
+#include "CExpander.h"
+#include "my_list.h"
+
+class striphtml : public CFilter
+{
+ bool ignorespace;
+ bool m_bchm;
+ CList<CStyle> stylestack;
+ static CNavigation_base<htmlmark> m_nav;
+ QMap<QString, tchar>* entmap;
+ CStyle currentstyle;
+ bool isPre;
+ unsigned short skip_ws();
+ unsigned short skip_ws_end();
+ unsigned short skip_ws_end(unsigned long&);
+ unsigned short parse_m();
+ QMap<QString, unsigned long>* href2filepos;
+ QMap<unsigned long, QString>* id2href;
+ unsigned long currentid;
+ tchar lastch;
+ QString currentfile;
+ QString q;
+ bool forcecentre, m_inblock;
+ QString text_q;
+ int indent;
+ int m_listtype[m_cmaxdepth];
+ int m_ctr[m_cmaxdepth];
+ void mygetch(tchar& ch, CStyle& sty, unsigned long& pos);
+ void initentmap();
+ QString getname(tchar& ch, const QString& nd);
+ void skipblock(const QString&);
+ QString getattr(tchar&);
+ QString dehtml(const QString& _info);
+ void parse_paragraph(CStyle& currentstyle, tchar& ch, unsigned long);
+ int getpara(CBuffer&, unsigned long&);
+ public:
+ QString about() { return QString("HTML filter (c) Tim Wentford\n")+parent->about(); }
+ striphtml(const QString&);
+ ~striphtml();
+ void getch(tchar& ch, CStyle& sty, unsigned long& pos);
+ virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm);
+ bool findanchor(const QString&);
+
+
+ void saveposn(const QString& f, size_t posn) { m_nav.saveposn(htmlmark(f, posn)); }
+ void writeposn(const QString& f, size_t posn) { m_nav.writeposn(htmlmark(f, posn)); }
+ linkType forward(QString& f, size_t& loc)
+ {
+ htmlmark m(f, loc);
+ linkType ret = (m_nav.forward(m)) ? eFile : eNone;
+ if (f == m.filename())
+ {
+ if (ret == eFile)
+ {
+ ret = eLink;
+ }
+ }
+ else
+ {
+ f = m.filename();
+ }
+ loc = m.posn();
+ return ret;
+ }
+ linkType back(QString& f, size_t& loc)
+ {
+ htmlmark m(f, loc);
+ linkType ret = (m_nav.back(m)) ? eFile : eNone;
+ if (f == m.filename())
+ {
+ if (ret == eFile)
+ {
+ ret = eLink;
+ }
+ }
+ else
+ {
+ f = m.filename();
+ }
+ loc = m.posn();
+ return ret;
+ }
+ bool hasnavigation() { return true; }
+ virtual void locate(unsigned int n);
+ void setchm(bool _b) { m_bchm = _b; }
+};
+#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 @@
+#!/bin/bash
+touch infowin.cpp
+for f in *lib.omak; do make -f $f; done
+for f in *.omak; do make -f $f; done
+for f in *.omak; do make -f $f; done
+cp /home/tim/codecreader/opie-reader.desktop $QTDIR/apps/Applications/
+cp /home/tim/codecreader/pics/* $QTDIR/pics/opie-reader/
+cp /home/tim/codecreader/opie-pics/* $QTDIR/pics/opie-reader/
+cp HTMLentities $QTDIR/plugins/reader/data/
+rm $QTDIR/help/html/*reader*.html
+cp /home/tim/codecreader/help/*.html $QTDIR/help/html/
+rm $QTDIR/help/html/*reader*.html
+cp /home/tim/codecreader/help/*.html $QTDIR/help/html/
+rm -f $QTDIR/lib/libreader*.so
+rm -f $QTDIR/lib/libreader*.so.1
+for f in $QTDIR/lib/libreader*.1.0.0 ; do mv -f $f $QTDIR/lib/`basename $f .1.0.0`.1 ; done
+rm -f $QTDIR/lib/libreader*.so.1.*
+
+/home/tim/bin/zstrip.sh $QTDIR/bin/reader
+for f in $QTDIR/lib/libreader* ; do /home/tim/bin/zstrip.sh $f; done
+
+for SUBDIR in codecs support filters
+do
+ CDIR=$QTDIR/plugins/reader/$SUBDIR
+ rm -f $CDIR/*.so
+ for f in $CDIR/*.1.0.0 ; do mv -f $f $CDIR/`basename $f .1.0.0` ; done
+ rm -f $CDIR/*.so.*
+ for f in $CDIR/*.so ; do /home/tim/bin/zstrip.sh $f ; done
+done
+rm -f opie-reader-gcc3_*.ipk
+rm -f full/opie-reader-gcc3_*.ipk
+rm -f partial/opie-reader-gcc3_*.ipk
+mkipks opie-reader-gcc3.control
+cp opie-reader-gcc3_*.ipk full/
+for f in opie-reader-gcc3_*.ipk
+ do
+ cp $f full/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk
+done
+rm $QTDIR/plugins/reader/support/libpluckerdecompress.so
+rm $QTDIR/plugins/reader/codecs/libArriereGo.so
+rm $QTDIR/plugins/reader/codecs/libNEF.so
+mkipks opie-reader-gcc3.control
+cp opie-reader-gcc3_*.ipk partial/
+for f in opie-reader-gcc3_*.ipk
+ do
+ cp $f partial/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk
+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 @@
+#!/bin/bash
+touch infowin.cpp
+for f in *lib.zmak; do make -f $f; done
+for f in *.zmak; do make -f $f; done
+for f in *.zmak; do make -f $f; done
+cp /home/tim/codecreader/pics/* $QTDIR/pics/opie-reader/
+cp /home/tim/codecreader/opie-pics/* $QTDIR/pics/opie-reader/
+cp HTMLentities $QTDIR/plugins/reader/data/
+rm $QTDIR/help/html/*reader*.html
+cp /home/tim/codecreader/help/*.html $QTDIR/help/html/
+rm -f $QTDIR/lib/libreader*.so
+rm -f $QTDIR/lib/libreader*.so.1
+for f in $QTDIR/lib/libreader*.1.0.0 ; do mv -f $f $QTDIR/lib/`basename $f .1.0.0`.1 ; done
+rm -f $QTDIR/lib/libreader*.so.1.*
+
+/home/tim/bin/zstrip.sh $QTDIR/bin/uqtreader
+rm -f $QTDIR/bin/reader
+mv $QTDIR/bin/uqtreader $QTDIR/bin/reader
+for f in $QTDIR/lib/libreader* ; do /home/tim/bin/zstrip.sh $f; done
+for SUBDIR in codecs support filters
+do
+ CDIR=$QTDIR/plugins/reader/$SUBDIR
+ rm -f $CDIR/*.so
+ for f in $CDIR/*.1.0.0 ; do mv -f $f $CDIR/`basename $f .1.0.0` ; done
+ rm -f $CDIR/*.so.*
+ for f in $CDIR/*.so ; do zstrip.sh $f ; done
+done
+rm -f opie-reader-opie_*.ipk
+rm -f full/opie-reader-opie_*.ipk
+rm -f partial/opie-reader-opie_*.ipk
+mkipks opie-reader-opie.control
+cp opie-reader-opie_*.ipk full/
+for f in opie-reader-opie_*.ipk
+ do
+ cp $f full/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk
+done
+rm $QTDIR/plugins/reader/support/libpluckerdecompress.so
+rm $QTDIR/plugins/reader/codecs/libArriereGo.so
+rm $QTDIR/plugins/reader/codecs/libNEF.so
+mkipks opie-reader-opie.control
+cp opie-reader-opie_*.ipk partial/
+for f in opie-reader-opie_*.ipk
+ do
+ cp $f partial/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk
+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 @@
#!/bin/bash
-cp /home/tim/uqtreader/uqtreader.desktop /opt/Qtopia/apps/Applications/
-cp /home/tim/bin/uqtreader /opt/Qtopia/bin/
-cp /home/tim/uqtreader/uqtreader.png /opt/Qtopia/pics/
-cp /home/tim/qtreader/panel-arrow-down.png /opt/Qtopia/pics/
-cp /home/tim/uqtreader/uqtreader.desktop /opt/Qtopia/sharp/apps/Applications/
-cp /home/tim/bin/uqtreader /opt/Qtopia/sharp/bin/
-cp /home/tim/uqtreader/uqtreader.png /opt/Qtopia/sharp/pics/
-cp /home/tim/qtreader/panel-arrow-down.png /opt/Qtopia/sharp/pics/
-#source /home/tim/bin/setz.sh
-#mkipks qpe-qtreader.control
+touch infowin.cpp
+for f in *lib.zmak; do make -f $f; done
+for f in *.zmak; do make -f $f; done
+for f in *.zmak; do make -f $f; done
+cp /home/tim/codecreader/uqtreader*.desktop /opt/Qtopia/apps/Applications/
+cp /home/tim/codecreader/pics/* /opt/Qtopia/pics/opie-reader/
+cp /home/tim/codecreader/uqtreader*.desktop $QTDIR/apps/Applications/
+cp /home/tim/codecreader/opie-reader.desktop $QTDIR/apps/Applications/
+cp /home/tim/codecreader/pics/* $QTDIR/pics/opie-reader/
+cp HTMLentities $QTDIR/plugins/reader/data/
+rm $QTDIR/help/html/*reader*.html
+cp /home/tim/codecreader/help/*.html $QTDIR/help/html/
+rm -f $QTDIR/lib/libreader*.so
+rm -f $QTDIR/lib/libreader*.so.1
+for f in $QTDIR/lib/libreader*.1.0.0 ; do mv -f $f $QTDIR/lib/`basename $f .1.0.0`.1 ; done
+rm -f $QTDIR/lib/libreader*.so.1.*
+
+/home/tim/bin/zstrip.sh $QTDIR/bin/uqtreader
+for f in $QTDIR/lib/libreader* ; do /home/tim/bin/zstrip.sh $f; done
+
+for SUBDIR in codecs support filters
+do
+ CDIR=$QTDIR/plugins/reader/$SUBDIR
+ rm -f $CDIR/*.so
+ for f in $CDIR/*.1.0.0 ; do mv -f $f $CDIR/`basename $f .1.0.0` ; done
+ rm -f $CDIR/*.so.*
+ for f in $CDIR/*.so ; do /home/tim/bin/zstrip.sh $f ; done
+done
+rm -f opie-reader_*.ipk
+rm -f full/opie-reader_*.ipk
+rm -f partial/opie-reader_*.ipk
+mkipks opie-reader.control
+cp opie-reader_*.ipk full/
+for f in opie-reader_*.ipk
+ do
+ cp $f full/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk
+done
+rm $QTDIR/plugins/reader/support/libpluckerdecompress.so
+rm $QTDIR/plugins/reader/codecs/libArriereGo.so
+rm $QTDIR/plugins/reader/codecs/libNEF.so
+mkipks opie-reader.control
+cp opie-reader_*.ipk partial/
+for f in opie-reader_*.ipk
+ do
+ cp $f partial/`basename $f _arm.ipk`-`date +%y%m%d`_arm.ipk
+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 @@
-#ifndef USEQPE
-#define USEQPE
-#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 @@
+#include "util.h"
+
+QString filesize(unsigned long l)
+{
+ char units[] = { 'K', 'M', 'G' };
+ int iu = 0;
+ while (l > 999 && iu < sizeof(units))
+ {
+ l = (l+512)/1024;
+ iu++;
+ }
+ QString ret = QString::number(l);
+ if (iu != 0)
+ {
+ ret += QChar(units[iu-1]);
+ }
+ return ret;
+}
+
+QString percent(unsigned long pos, unsigned long len)
+{
+ unsigned long permil = 0;
+ if (len != 0)
+ {
+ permil = (1000*pos+len/2)/len;
+ }
+ unsigned long percen = permil/10;
+ unsigned long frac = permil - 10*percen;
+ return QString::number(percen) + "." + QString::number(frac);
+}
+
+QString fmt(unsigned long pos, unsigned long len)
+{
+ QString ret = filesize(pos) + "/" + filesize(len) + " : " + percent(pos,len) +"%";
+ return ret;
+}
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 @@
+#ifndef __UTIL_H
+#define __UTIL_H
+
+#include <qstring.h>
+#include <qdir.h>
+#include <stdlib.h>
+
+QString filesize(unsigned long l);
+QString percent(unsigned long pos, unsigned long len);
+QString fmt(unsigned long pos, unsigned long len);
+
+/**
+ * class with utility inline function(s)
+ * (in contrast to global functions they become available by just
+ * including util.h)
+ */
+class QTReaderUtil
+{
+ public:
+
+ /**
+ * searches for a specific direcory inside OpieReader installation
+ *
+ * @param subdir name of sub directory inside installation directory which is needed
+ * @return full path name including that sub directory
+ *
+ * search order is (on all platforms):
+ * - OPIEDIR
+ * - QTDIR
+ * - READERDIR
+ */
+ static QString getPluginPath( const char *subdir = "codecs/" )
+ {
+ QString dirname;
+ dirname = getenv("OPIEDIR");
+ dirname += "/plugins/reader/";
+ dirname += subdir;
+ if (QDir(dirname).exists())
+ return dirname;
+
+ dirname = getenv("QTDIR");
+ dirname += "/plugins/reader/";
+ dirname += subdir;
+ if (QDir(dirname).exists())
+ return dirname;
+
+ dirname = getenv("READERDIR");
+ dirname += "/";
+ dirname += subdir;
+ if (QDir(dirname).exists())
+ return dirname;
+
+ return "";
+ }
+};
+
+#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,37 +1,29 @@
#include "version.h"
+#include "names.h"
+#include <qmessagebox.h>
bool CheckVersion(int& major, int& bkmktype, char& minor)
{
if (
(major != MAJOR)
||
(bkmktype != BKMKTYPE)
||
(minor != MINOR)
)
{
major = MAJOR;
bkmktype = BKMKTYPE;
minor = MINOR;
-/*
+
QMessageBox::warning(NULL, PROGNAME,
- "This is the first time that you have\n"
- "run this version of OpieReader.\n\n"
- "There are two new icons visible at\n"
- "the left end of the toolbar. The left\n"
- "one brings up the menus, the next\n"
- "one brings up the settings dialog.\n\n"
- "Start by tapping the settings icon\n"
- "and selecting the Buttons tab to\n"
- "make sure that the buttons are\n"
- "mapped as you expect\n\n"
- "Next go to Settings/Toolbars via the\n"
- "menu icon to set up your toolbars.");
-*/
+ "New Features in this version\n\n\n"
+ "Relative margin settings\n"
+ "Cyrillic hyphenation");
return true;
}
else
{
return false;
}
}
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 @@
#ifndef __VERSION_H
#define __VERSION_H
#define MAJOR 0
-#define BKMKTYPE 6
-#define MINOR 'j'
+#define BKMKTYPE 7
+#define MINOR 'g'
#define RELEASE_TYPE "beta"
#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 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-1998 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef _ZCONF_H
-#define _ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateReset z_inflateReset
-# define compress z_compress
-# define compress2 z_compress2
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
-# define WIN32
-#endif
-#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
-# ifndef __32BIT__
-# define __32BIT__
-# endif
-#endif
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#if defined(MSDOS) && !defined(__32BIT__)
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
-# define STDC
-#endif
-#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
-# ifndef STDC
-# define STDC
-# endif
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Old Borland C incorrectly complains about missing returns: */
-#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
-# define NEED_DUMMY_RETURN
-#endif
-
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-#endif
-#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
-# ifndef __32BIT__
-# define SMALL_MEDIUM
-# define FAR _far
-# endif
-#endif
-
-/* Compile with -DZLIB_DLL for Windows DLL support */
-#if defined(ZLIB_DLL)
-# if defined(_WINDOWS) || defined(WINDOWS)
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR _cdecl _export
-# endif
-# endif
-# if defined (__BORLANDC__)
-# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
-# include <windows.h>
-# define ZEXPORT __declspec(dllexport) WINAPI
-# define ZEXPORTRVA __declspec(dllexport) WINAPIV
-# else
-# if defined (_Windows) && defined (__DLL__)
-# define ZEXPORT _export
-# define ZEXPORTVA _export
-# endif
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# if defined (ZLIB_DLL)
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-#endif
-
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(MACOS) && !defined(TARGET_OS_MAC)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
-# define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-# pragma map(deflateInit_,"DEIN")
-# pragma map(deflateInit2_,"DEIN2")
-# pragma map(deflateEnd,"DEEND")
-# pragma map(inflateInit_,"ININ")
-# pragma map(inflateInit2_,"ININ2")
-# pragma map(inflateEnd,"INEND")
-# pragma map(inflateSync,"INSY")
-# pragma map(inflateSetDictionary,"INSEDI")
-# pragma map(inflate_blocks,"INBL")
-# pragma map(inflate_blocks_new,"INBLNE")
-# pragma map(inflate_blocks_free,"INBLFR")
-# pragma map(inflate_blocks_reset,"INBLRE")
-# pragma map(inflate_codes_free,"INCOFR")
-# pragma map(inflate_codes,"INCO")
-# pragma map(inflate_fast,"INFA")
-# pragma map(inflate_flush,"INFLU")
-# pragma map(inflate_mask,"INMA")
-# pragma map(inflate_set_dictionary,"INSEDI2")
-# pragma map(inflate_copyright,"INCOPY")
-# pragma map(inflate_trees_bits,"INTRBI")
-# pragma map(inflate_trees_dynamic,"INTRDY")
-# pragma map(inflate_trees_fixed,"INTRFI")
-# pragma map(inflate_trees_free,"INTRFR")
-#endif
-
-#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 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.1.3, July 9th, 1998
-
- Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef _ZLIB_H
-#define _ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.1.3"
-
-#ifdef QT_MAKEDLL
-#define Q_ZEXPORT __declspec(dllexport)
-#else
-#ifdef QT_DLL
-#define Q_ZEXPORT __declspec(dllimport)
-#else
-#define Q_ZEXPORT ZEXPORT
-#endif
-#endif
-
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms will be added later and will have the same
- stream interface.
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never
- crash even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: ascii or binary */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- The application must update next_in and avail_in when avail_in has
- dropped to zero. It must update next_out and avail_out when avail_out
- has dropped to zero. The application must initialize zalloc, zfree and
- opaque before calling the init function. All other fields are set by the
- compression library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by zalloc for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or
- progress reports. After compression, total_in holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-/* Allowed flush values; see deflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_ASCII 1
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller.
- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
- use default allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
- compression (currently equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- msg is set to null if there is no error message. deflateInit does not
- perform any compression: this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce some
- output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating avail_in or avail_out accordingly; avail_out
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
- and with zero avail_out, it must be called again after making room in the
- output buffer because there might be more output pending.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In particular
- avail_in is zero after the call if enough output space has been provided
- before the call.) Flushing may degrade compression for some compression
- algorithms and so it should be used only when necessary.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- the compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out).
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there
- was enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the
- stream are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least
- 0.1% larger than avail_in plus 12 bytes. If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update data_type if it can make a good guess about
- the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero).
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- msg may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
- value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller. msg is set to null if there is no error
- message. inflateInit does not perform any decompression apart from reading
- the zlib header if present: this will be done by inflate(). (So next_in and
- avail_in may be modified, but next_out and avail_out are unchanged.)
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may some
- introduce some output latency (reading input without producing any output)
- except when forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing
- will resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there
- is no more input data or no more space in the output buffer (see below
- about the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (avail_out == 0), or after each
- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
- must be called again after making room in the output buffer because there
- might be more output pending.
-
- If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
- output as possible to the output buffer. The flushing behavior of inflate is
- not specified for values of the flush parameter other than Z_SYNC_FLUSH
- and Z_FINISH, but the current implementation actually flushes as much output
- as possible anyway.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step
- (a single call of inflate), the parameter flush should be set to
- Z_FINISH. In this case all pending input is processed and all pending
- output is flushed; avail_out must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
- is never required, but can be used to inform inflate that a faster routine
- may be used for the single inflate() call.
-
- If a preset dictionary is needed at this point (see inflateSetDictionary
- below), inflate sets strm-adler to the adler32 checksum of the
- dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
- it sets strm->adler to the adler32 checksum of all output produced
- so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
- an error code as described below. At the end of the stream, inflate()
- checks that its computed adler32 checksum is equal to that saved by the
- compressor and returns Z_STREAM_END only if the checksum is correct.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect
- adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
- (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if no progress is possible or if there was not
- enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
- case, the application may then call inflateSync to look for a good
- compression block.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match). Filtered data consists mostly of small values with a
- somewhat random distribution. In this case, the compression algorithm is
- tuned to compress them better. The effect of Z_FILTERED is to force more
- Huffman coding and less string matching; it is somewhat intermediate
- between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
- the compression ratio but not the correctness of the compressed output even
- if it is not set appropriately.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
- method). msg is set to null if there is no error message. deflateInit2 does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any
- call of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- deflate or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front.
-
- Upon return of this function, strm->adler is set to the Adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The Adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.)
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
- perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. If a compressed stream with a larger window size is given as
- input, inflate() will return with the error code Z_DATA_ERROR instead of
- trying to allocate a larger window.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
- memLevel). msg is set to null if there is no error message. inflateInit2
- does not perform any decompression apart from reading the zlib header if
- present: this will be done by inflate(). (So next_in and avail_in may be
- modified, but next_out and avail_out are unchanged.)
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate
- if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the Adler32 value returned by this call of
- inflate. The compressor and decompressor must use exactly the same
- dictionary (see deflateSetDictionary).
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect Adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-*/
-
-ZEXTERN int Q_ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least 0.1% larger than
- sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
- compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN int Q_ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-
-
-typedef voidp gzFile;
-
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h". (See the description
- of deflateInit2 for more information about the strategy parameter.)
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression.
-
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR). */
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- const voidp buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- gzgets returns buf, or Z_NULL in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
-*/
-
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-/*
- Sets the starting position for the next gzread or gzwrite on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-/*
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running crc with the bytes buf[0..len-1] and return the updated
- crc. If buf is NULL, this function returns the required initial value
- for the crc. Pre- and post-conditioning (one's complement) is performed
- within this function so it shouldn't be done by the application.
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-
-
-#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-ZEXTERN const char * ZEXPORT zError OF((int err));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
-
-#ifdef __cplusplus
-}
-#endif
-
-#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
@@ -1,161 +1,174 @@
#include <stdio.h>
#include <string.h>
#include "ztxt.h"
#include "my_list.h"
#include "Bkmks.h"
+#include "static.h"
ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ }
int ztxt::OpenFile(const char *src)
{
- if (!Cpdb::openfile(src))
+ if (!Cpdb::openpdbfile(src))
{
return -1;
}
//printf("Okay %u\n", 4);
if (head.type != ZTXT_ID) return -1;
gotorecordnumber(0);
fread(&hdr0, 1, sizeof(hdr0), fin);
//printf("Okay %u\n", 5);
buffersize = ntohl(hdr0.size);
compressedtextbuffer = new UInt8[buffersize];
expandedtextbuffer = new UInt8[buffersize];
//printf("Okay %u\n", 6);
home();
//printf("Okay %u\n", 7);
// printf("Returning 0\n");
return 0;
}
int ztxt::getch()
{
if (bufferpos >= buffercontent)
{
size_t reclen = recordlength(++bufferrec);
if (reclen == 0) return -1;
gotorecordnumber(bufferrec);
fread(compressedtextbuffer, reclen, sizeof(char), fin);
zstream.next_in = compressedtextbuffer;
zstream.next_out = expandedtextbuffer;
zstream.avail_out = buffersize;
zstream.avail_in = reclen;
int ret = inflate(&zstream, Z_SYNC_FLUSH);
buffercontent = buffersize - zstream.avail_out;
bufferpos = 0;
}
currentpos++;
return expandedtextbuffer[bufferpos++];
}
unsigned int ztxt::locate()
{
return currentpos;
}
void ztxt::locate(unsigned int n)
{
if (hasrandomaccess())
{
bufferrec = n / ntohs(hdr0.recordSize) + 1;
if (bufferrec == 1)
{
inflateEnd(&zstream);
}
size_t reclen = recordlength(bufferrec);
if (reclen == 0) return;
gotorecordnumber(bufferrec);
fread(compressedtextbuffer, reclen, sizeof(char), fin);
zstream.next_in = compressedtextbuffer;
zstream.next_out = expandedtextbuffer;
zstream.avail_out = buffersize;
zstream.avail_in = reclen;
if (bufferrec == 1)
{
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
inflateInit(&zstream);
}
int ret = inflate(&zstream, Z_SYNC_FLUSH);
buffercontent = buffersize - zstream.avail_out;
bufferpos = 0;
currentpos = n - n % ntohs(hdr0.recordSize);
while (currentpos < n) getch();
}
else
{
home();
while (currentpos < n && getch() != EOF);
}
}
void ztxt::home()
{
if (bInit)
{
inflateEnd(&zstream);
}
bInit = true;
size_t reclen = recordlength(1);
gotorecordnumber(1);
fread(compressedtextbuffer, reclen, sizeof(char), fin);
zstream.next_in = compressedtextbuffer;
zstream.next_out = expandedtextbuffer;
zstream.avail_out = buffersize;
zstream.avail_in = reclen;
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
// printf("Initialising\n");
inflateInit(&zstream);
int ret = inflate(&zstream, Z_SYNC_FLUSH);
// printf("Inflate : %d\n", ret);
bufferpos = 0;
bufferrec = 1;
currentpos = 0;
buffercontent = buffersize - zstream.avail_out;
// printf("buffercontent:%u\n", buffercontent);
}
CList<Bkmk>* ztxt::getbkmklist()
{
UInt16 recno = ntohs(hdr0.bookmarkRecord);
// printf("Bookmarks - record %d contains %d\n", recno, ntohs(hdr0.numBookmarks));
if (recno == 0) return NULL;
CList<Bkmk>* t = new CList<Bkmk>;
size_t cur = ftell(fin);
gotorecordnumber(recno);
for (int i = 0; i < ntohs(hdr0.numBookmarks); i++)
{
zTXTbkmk bkmk;
if (fread(&bkmk, sizeof(bkmk), 1, fin) != 1) break;
// printf("Bookmark number:%d:%.20s\n", i, bkmk.title);
- t->push_back(Bkmk(bkmk.title, NULL, ntohl(bkmk.offset)));
+ tchar title[MAX_BMRK_LENGTH];
+ for (int j = 0; j < MAX_BMRK_LENGTH; j++)
+ {
+ title[j] = bkmk.title[j];
+ }
+ t->push_back(Bkmk(title, NULL, ntohl(bkmk.offset)));
}
fseek(fin, cur, SEEK_SET);
return t;
}
+
+#ifndef __STATIC
+extern "C"
+{
+ CExpander* newcodec() { return new ztxt; }
+}
+#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,120 +1,110 @@
#ifndef __ztxt_h
#define __ztxt_h
-#include "useqpe.h"
#include "CExpander.h"
#include <zlib.h>
#include "pdb.h"
#ifdef _WINDOWS
#include <winsock.h>
#endif
/*
* Stuff common to both Weasel Reader and makeztxt
*
* $Id$
*
*/
#ifndef _WEASEL_COMMON_H_
#define _WEASEL_COMMON_H_ 1
/* Padding is no good */
#if defined(__GNUC__) && defined(__UNIX__)
-# pragma pack(2)
+//# pragma pack(2)
#endif
/* The default creator is Weasel Reader 'GPlm' */
#define GPLM_CREATOR_ID "GPlm"
/* Databases of type 'zTXT' */
#define ZTXT_TYPE_ID "zTXT"
/* Size of one database record */
#define RECORD_SIZE 8192
/* Allow largest WBIT size for data. Lower with command line options
in makeztxt */
#define MAXWBITS 15
/* Max length for a bookmark/annotation title */
#define MAX_BMRK_LENGTH 20
/*****************************************************
* This is the zTXT document header (record #0) *
* ----zTXT version 1.42---- *
*****************************************************/
typedef struct zTXT_record0Type {
UInt16 version; /* zTXT format version */
UInt16 numRecords; /* Number of data (TEXT) records */
UInt32 size; /* Size in bytes of uncomp. data */
UInt16 recordSize; /* Size of a single data record */
UInt16 numBookmarks; /* Number of bookmarks in DB */
UInt16 bookmarkRecord; /* Record containing bookmarks */
UInt16 numAnnotations; /* Number of annotation records */
UInt16 annotationRecord; /* Record # of annotation index */
UInt8 randomAccess; /* 1 if compressed w/Z_FULL_FLUSH */
UInt8 padding[0x20 - 19]; /* Pad to a size of 0x20 bytes */
} zTXT_record0;
struct zTXTbkmk
{
UInt32 offset;
- tchar title[MAX_BMRK_LENGTH];
+ unsigned char title[MAX_BMRK_LENGTH];
};
#endif
const UInt32 ZTXT_ID = 0x5458547a;
-class ztxt : public CExpander, Cpdb
+class ztxt : public Cpdb
{
bool bInit;
UInt32 buffersize;
UInt32 buffercontent;
UInt8* expandedtextbuffer;
UInt8* compressedtextbuffer;
z_stream zstream;
size_t bufferpos;
UInt16 bufferrec;
zTXT_record0 hdr0;
size_t currentpos;
void home();
public:
-#ifdef USEQPE
- void suspend()
- {
- CExpander::suspend(fin);
- }
- void unsuspend()
- {
- CExpander::unsuspend(fin);
- }
-#endif
+ QString about() { return QString("Weasel codec (c) Tim Wentford"); }
void sizes(unsigned long& _file, unsigned long& _text)
{
_file = file_length;
_text = ntohl(hdr0.size);
}
bool hasrandomaccess() { return (hdr0.randomAccess != 0); }
virtual ~ztxt()
{
if (expandedtextbuffer != NULL) delete [] expandedtextbuffer;
if (compressedtextbuffer != NULL) delete [] compressedtextbuffer;
if (bInit)
{
inflateEnd(&zstream);
}
}
ztxt();
int OpenFile(const char *src);
int getch();
unsigned int locate();
void locate(unsigned int n);
CList<Bkmk>* getbkmklist();
MarkupType PreferredMarkup()
{
return cTEXT;
}
};
#endif