Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 96 |
1 files changed, 28 insertions, 68 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index 3bcdde4..9daa07a 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h @@ -13,35 +13,38 @@ class CDrawBuffer; //class CBuffer; #include <qpixmap.h> class QPainter; class QTimer; class QImage; #include "BGType.h" -#include "striphtml.h" -#define ROTATION_ENABLED #define SPECIALSCROLL -#define DOUBLEBUFFER -#ifdef DOUBLEBUFFER + class QPainter; -#endif +class COutput; class CStyle; +#define USETIMER class QTReader : public QWidget { Q_OBJECT friend class QTReaderApp; -#ifdef DOUBLEBUFFER +#ifdef USETIMER + QTimer* m_dragtimer; + unsigned long m_dragtarget; +#endif + COutput* m_output; + bool checkoutput(); + bool m_outofdate, m_drageligible; 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; @@ -69,48 +72,48 @@ class QTReader : public QWidget 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 + void drawBackground(QPainter*); bool m_rotated; void setrotated(bool); -#endif void autoscroll(); QTimer* timer; 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 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(); } + QString m_outputName; #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(); + void readAloud(); CList<Bkmk>* Bkmklist() { return pBkmklist; } void setBackground(const QColor& _c) { m_default_bg = _c; reset_bg(); } void setForeground(const QColor& _c) { @@ -148,17 +151,17 @@ public: 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(const QString& n, const QString& s, unsigned int lcn = 0) { m_string = n; load_file((const char*)s, lcn); }; /* void setText(bool oldfile) { if (oldfile) { m_string = m_lastfile; load_file((const tchar*)m_string); } @@ -220,121 +223,78 @@ public: case 0: // 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(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(m_reparastring)); - if (bonespace) filt->addfilter(new OnePara); - if (bindenter) filt->addfilter(new indenter(bindenter)); - if (bdblspce) filt->addfilter(new dblspce); - 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; - } - + CFilterChain* getfilter(); private slots: +#ifdef USETIMER + void actionDrag(); +#endif void dopageup(); void lineDown(); void lineUp(); void dopagedn(); void goHome(); void goBack(); void goForward(); void doscroll(); void paintEvent( QPaintEvent * ); -#ifdef DOUBLEBUFFER + void resizeEvent( QResizeEvent * p ); -#endif + void keyPressEvent(QKeyEvent*); 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 mouseMoveEvent( QMouseEvent* ); void mousePressEvent( QMouseEvent* ); void mouseReleaseEvent( QMouseEvent* ); // void mouseDoubleClickEvent( QMouseEvent* ); QString m_string, m_fontname, m_reparastring; void setfont(); + bool m_doubleBuffered; + + void setDoubleBuffer(bool _b); //myoutput stuff private: #ifdef SPECIALSCROLL int m_scrolldy; #endif bool mouseUpOn; - 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*&); + 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*&, size_t&); bool m_twotouch, m_touchone; size_t m_startpos, m_startoffset; void dopageup(unsigned int); 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, /*bNegative,*/ bInverse; - bool bkern, brepalm; + bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust, /*bNegative,*/ bInverse, bNoInlineTables; + bool bkern, brepalm, bunderlineLink; bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; unsigned char bindenter; QString m_lastfile; size_t m_lastposn; bool bDoUpdates; public: + bool doOutput(const QString& wrd); 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); |