Diffstat (limited to 'noncore/apps/opie-reader/CDrawBuffer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CDrawBuffer.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/CDrawBuffer.cpp b/noncore/apps/opie-reader/CDrawBuffer.cpp index bfb3027..227f0f6 100644 --- a/noncore/apps/opie-reader/CDrawBuffer.cpp +++ b/noncore/apps/opie-reader/CDrawBuffer.cpp @@ -359,16 +359,17 @@ int CDrawBuffer::offset(int scwidth, unsigned short _lborder, unsigned short _rb currentx = ( scwidth - _lborder -_rborder + leftMargin() - rightMargin() - width(availht))/2 + _lborder; } break; case m_AlignJustify: case m_AlignLeft: + case m_AlignNone: currentx = _lborder + leftMargin(); break; } return currentx; } void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scwidth, unsigned short _lborder, unsigned short _rborder, const QColor& _bg, int availht) { @@ -479,17 +480,17 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int // 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()) 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)); + _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/10/*0*/)); #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) { @@ -653,17 +654,17 @@ CStyle CDrawBuffer::laststyle() return segs.last().style; } CStyle CDrawBuffer::firststyle() { return segs.first().style; } -linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*& img) +linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*& img, size_t& tabletgt) { linkType ret = eNone; int end = 0; CStyle currentstyle; CList<textsegment>::iterator textstart = segs.begin(); CList<textsegment>::iterator textend = textstart; do { @@ -685,16 +686,21 @@ linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt, size_t& offset, siz ret |= ePicture; } if (currentstyle.getLink()) { tgt = currentstyle.getData(); offset = currentstyle.getOffset(); ret |= eLink; } + if (currentstyle.isTable()) + { + tabletgt = currentstyle.getTable(); + ret |= eTable; + } return ret; } void CDrawBuffer::resize(int availht) { int gzoom = fc->gzoom(); m_ascent = m_descent = m_lineSpacing = m_lineExtraSpacing = 0; /* @@ -711,17 +717,17 @@ void CDrawBuffer::resize(int availht) { m_hastext = true; break; } iter++; } if (m_hastext) { - + int p_linespacing = 0; 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; @@ -751,33 +757,44 @@ void CDrawBuffer::resize(int availht) 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 + { + descent = (_style.getPicture()->height()-ascent)/2; + ascent = (_style.getPicture()->height()+ascent)/2; + } + int lineSpacing = ascent+descent; + if (lineSpacing > p_linespacing) + { + p_linespacing = lineSpacing; + } + extra = 0; } /* 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); + m_showPartial = (p_linespacing > t_lineSpacing); int lead = fc->getlead(); if (lead != 0) { int xt = (lead*t_lineSpacing+5)/10; m_lineExtraSpacing += xt; m_lineSpacing += xt; } if (m_bSop) |