summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CDrawBuffer.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/CDrawBuffer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CDrawBuffer.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/noncore/apps/opie-reader/CDrawBuffer.cpp b/noncore/apps/opie-reader/CDrawBuffer.cpp
index ec36fb2..b137ac3 100644
--- a/noncore/apps/opie-reader/CDrawBuffer.cpp
+++ b/noncore/apps/opie-reader/CDrawBuffer.cpp
@@ -37,13 +37,13 @@ void CDrawBuffer::setright(CDrawBuffer& rhs, int f)
37 len = i; 37 len = i;
38} 38}
39 39
40CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs) 40CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs)
41{ 41{
42 int i; 42 int i;
43// //qDebug("Trying 2"); 43// //odebug << "Trying 2" << oendl;
44 len = rhs.len; 44 len = rhs.len;
45 m_maxstyle = rhs.m_maxstyle; 45 m_maxstyle = rhs.m_maxstyle;
46 m_ascent = rhs.m_ascent; 46 m_ascent = rhs.m_ascent;
47 m_descent = rhs.m_descent; 47 m_descent = rhs.m_descent;
48 m_lineSpacing = rhs.m_lineSpacing; 48 m_lineSpacing = rhs.m_lineSpacing;
49 m_lineExtraSpacing = rhs.m_lineExtraSpacing; 49 m_lineExtraSpacing = rhs.m_lineExtraSpacing;
@@ -55,13 +55,13 @@ CDrawBuffer& CDrawBuffer::operator=(CDrawBuffer& rhs)
55 { 55 {
56 segs.push_back(*iter); 56 segs.push_back(*iter);
57 } 57 }
58 for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i]; 58 for (i = 0; rhs[i] != '\0'; i++) (*this)[i] = rhs[i];
59 (*this)[i] = '\0'; 59 (*this)[i] = '\0';
60 len = i; 60 len = i;
61// //qDebug("Tried 2"); 61// //odebug << "Tried 2" << oendl;
62 return *this; 62 return *this;
63} 63}
64 64
65CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp) 65CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp)
66{ 66{
67 int i; 67 int i;
@@ -205,13 +205,13 @@ int CDrawBuffer::width(int numchars, bool onscreen, int scwidth, unsigned char _
205 spacesofar += nexttoadd; 205 spacesofar += nexttoadd;
206 lastspace = nsp; 206 lastspace = nsp;
207 } 207 }
208 else 208 else
209 { 209 {
210 QString nstr = str.mid(lastspace+1, nsp-lastspace); 210 QString nstr = str.mid(lastspace+1, nsp-lastspace);
211 // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); 211 // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl;
212 int lw = fm.width(nstr); 212 int lw = fm.width(nstr);
213 cx += lw; 213 cx += lw;
214 lastspace = nsp; 214 lastspace = nsp;
215 } 215 }
216 } 216 }
217 QString nstr = str.right(str.length()-1-lastspace); 217 QString nstr = str.right(str.length()-1-lastspace);
@@ -314,13 +314,13 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int
314 { 314 {
315 textend++; 315 textend++;
316 int end = (textend != segs.end()) ? textend->start : len; 316 int end = (textend != segs.end()) ? textend->start : len;
317 CStyle currentstyle = textstart->style; 317 CStyle currentstyle = textstart->style;
318 QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) ); 318 QFont f((currentstyle.isMono() && fc->hasCourier()) ? fc->fixedfontname() : fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) );
319 //f.setUnderline(currentstyle.isUnderline()); 319 //f.setUnderline(currentstyle.isUnderline());
320 //if (currentstyle.isUnderline()) qDebug("UNDERLINE"); 320 //if (currentstyle.isUnderline()) odebug << "UNDERLINE" << oendl;
321 _p->setFont(f); 321 _p->setFont(f);
322 QString str = text.mid(textstart->start, end-textstart->start); 322 QString str = text.mid(textstart->start, end-textstart->start);
323#if defined(OPIE) || !defined(USEQPE) 323#if defined(OPIE) || !defined(USEQPE)
324 _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/100)); 324 _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/100));
325#else 325#else
326 _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/10)); 326 _p->setPen(QPen(QColor(currentstyle.Red(), currentstyle.Green(), currentstyle.Blue()), fc->getsize(currentstyle)/10));
@@ -405,23 +405,23 @@ void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int
405 { 405 {
406 if (nsp+textstart->start >= nonspace) 406 if (nsp+textstart->start >= nonspace)
407 { 407 {
408 spacenumber++; 408 spacenumber++;
409 int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar; 409 int nexttoadd = (extraspace*spacenumber+spaces/2)/spaces - spacesofar;
410 QString nstr = str.mid(lastspace+1, nsp-lastspace); 410 QString nstr = str.mid(lastspace+1, nsp-lastspace);
411 // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); 411 // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl;
412 int lw = fm.width(nstr); 412 int lw = fm.width(nstr);
413 _p->drawText( cx, _y+voffset, nstr); 413 _p->drawText( cx, _y+voffset, nstr);
414 cx += lw+nexttoadd; 414 cx += lw+nexttoadd;
415 spacesofar += nexttoadd; 415 spacesofar += nexttoadd;
416 lastspace = nsp; 416 lastspace = nsp;
417 } 417 }
418 else 418 else
419 { 419 {
420 QString nstr = str.mid(lastspace+1, nsp-lastspace); 420 QString nstr = str.mid(lastspace+1, nsp-lastspace);
421 // qDebug("str:%s: last:%d new:%d nstr:%s:", (const char*)str, lastspace, nsp, (const char*)nstr); 421 // odebug << "str:" << str << ": last:" << lastspace << " new:" << nsp << " nstr:" << nstr << ":" << oendl;
422 int lw = fm.width(nstr); 422 int lw = fm.width(nstr);
423 _p->drawText( cx, _y+voffset, nstr); 423 _p->drawText( cx, _y+voffset, nstr);
424 cx += lw; 424 cx += lw;
425 lastspace = nsp; 425 lastspace = nsp;
426 } 426 }
427 } 427 }
@@ -467,20 +467,20 @@ linkType CDrawBuffer::getLinkType(int numchars, size_t& tgt)
467 do 467 do
468 { 468 {
469 textend++; 469 textend++;
470 end = (textend != segs.end()) ? textend->start : len; 470 end = (textend != segs.end()) ? textend->start : len;
471 currentstyle = textstart->style; 471 currentstyle = textstart->style;
472/* 472/*
473 if (currentstyle.isPicture()) qDebug("Passed thru picture"); 473 if (currentstyle.isPicture()) odebug << "Passed thru picture" << oendl;
474 if (currentstyle.getLink()) qDebug("Passed thru link"); 474 if (currentstyle.getLink()) odebug << "Passed thru link" << oendl;
475 //qDebug("islink:%d - %d", numchars, end); 475 //odebug << "islink:" << numchars << " - " << end << "" << oendl;
476*/ 476*/
477 textstart = textend; 477 textstart = textend;
478 } 478 }
479 while (textend != segs.end() && end <= numchars); 479 while (textend != segs.end() && end <= numchars);
480// if (currentstyle.isPicture()) qDebug("Clicked on picture"); 480// if (currentstyle.isPicture()) odebug << "Clicked on picture" << oendl;
481 if (currentstyle.getPictureLink()) 481 if (currentstyle.getPictureLink())
482 { 482 {
483 tgt = currentstyle.getPictureLinkData(); 483 tgt = currentstyle.getPictureLinkData();
484 return ePicture; 484 return ePicture;
485 } 485 }
486 if (currentstyle.getLink()) 486 if (currentstyle.getLink())
@@ -536,11 +536,11 @@ void CDrawBuffer::resize()
536 m_descent += xt; 536 m_descent += xt;
537 m_lineSpacing += xt; 537 m_lineSpacing += xt;
538 } 538 }
539 if (m_bSop) 539 if (m_bSop)
540 { 540 {
541 int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10; 541 int xt = ((segs.begin()->style.getExtraSpace()+fc->getextraspace())*fc->getsize(segs.begin()->style)+5)/10;
542 //qDebug("ExtraSpace:%d", xt); 542 //odebug << "ExtraSpace:" << xt << "" << oendl;
543 m_ascent += xt; 543 m_ascent += xt;
544 m_lineSpacing += xt; 544 m_lineSpacing += xt;
545 } 545 }
546} 546}