author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (side-by-side diff) | |
tree | 96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/BuffDoc.cpp | |
parent | 279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff) | |
download | opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2 |
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.cpp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.cpp b/noncore/apps/opie-reader/BuffDoc.cpp index 1f0a524..355d14d 100644 --- a/noncore/apps/opie-reader/BuffDoc.cpp +++ b/noncore/apps/opie-reader/BuffDoc.cpp @@ -2,9 +2,8 @@ #define NEWLINEBREAK #define INCREMENTALWIDTH -#include "usenef.h" #include "BuffDoc.h" #include "config.h" #include "CDrawBuffer.h" #include "ZText.h" @@ -20,8 +19,9 @@ #include "nef.h" #include "arrierego.h" #endif #include "iSilo.h" +#include "Reb.h" #endif linkType BuffDoc::hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) @@ -59,8 +59,20 @@ void BuffDoc::locate(unsigned int n) if (exp != NULL) filt->locate(n); // //qDebug("BuffDoc:Located"); } +void BuffDoc::resetPos() +{ + // //qDebug("BuffDoc:locating:%u",n); + lastword.empty(); + lastsizes[0] = laststartline = exp->locate(); +#ifdef NEWLINEBREAK + lastispara = false; +#else + lastispara = false; +#endif +} + static bool isletter(unsigned short c) { if ('a' <= c && c <= 'z') return true; if ('A' <= c && c <= 'Z') return true; @@ -634,8 +646,15 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) if (ret != 0) { delete exp; //qDebug("Trying ppms"); + exp = new CReb; + ret = exp->openfile(src); + } + if (ret != 0) + { + delete exp; + //qDebug("Trying ppms"); exp = new ppm_expander; ret = exp->openfile(src); } if (ret != 0) @@ -654,9 +673,19 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) return ret; } // //qDebug("Doing final open:%x:%x",exp,filt); #else - QString codecpath(QTReaderUtil::getPluginPath()); +#ifdef USEQPE +#ifdef OPIE + QString codecpath(getenv("OPIEDIR")); +#else + QString codecpath(getenv("QTDIR")); +#endif + codecpath += "/plugins/reader/codecs"; +#else + QString codecpath(getenv("READERDIR")); + codecpath += "/codecs"; +#endif QDir d(codecpath, "*.so"); if (d.exists()) { @@ -705,4 +734,26 @@ int BuffDoc::openfile(QWidget* _parent, const char *src) QString BuffDoc::about() { return QString("Buffered Decompressor (c) Tim Wentford\nHyphenation algorithm (c) Tim Wentford\n (Cyrillic support by Konstantin Isakov\n")+filt->about(); } + +int BuffDoc::getsentence(CBuffer& buff) +{ + tchar ch; + int i = 0; + bool intext = false; + while ((ch = getch()) != 10 && ch != UEOF) + { + buff[i++] = ch; + if (ch == '"' || ch == '\'' || ch == 0x2018 || ch == 0x2019 || + ch == 0x201a || ch == 0x201b || ch == 0x201c || ch == 0x201d) + { + intext = !intext; + } + if (!intext && (ch == '.' || ch == '!' || ch == '?')) break; + } + + buff[i] = '\0'; + if (i == 0 && ch == UEOF) i = -1; + laststartline = exp->locate(); + return i; +} |