summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReader.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index d64abb4..b356ba5 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -77,37 +77,37 @@ QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *nam
bdblspce(false),
btight(false),
bindenter(0),
m_fm(NULL)
{
init();
-// // qDebug("Load_file(1)");
+// // odebug << "Load_file(1)" << oendl;
load_file((const tchar*)filename);
}
*/
/*
void QTReader::mouseMoveEvent(QMouseEvent* _e)
{
mouseUpOn = !(_e->pos().x() == -1);
- qDebug("MouseMove:[%d, %d]", _e->pos().x(), _e->pos().y());
+ odebug << "MouseMove:[" << _e->pos().x() << ", " << _e->pos().y() << "]" << oendl;
}
*/
long QTReader::real_delay()
{
return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing );
}
void QTReader::mousePressEvent( QMouseEvent* _e )
{
buffdoc.unsuspend();
if (_e->button() == RightButton)
{
-// qDebug("MousePress");
+// odebug << "MousePress" << oendl;
mouseUpOn = false;
if (m_swapmouse)
{
int lineno = 0;
int ht = textarray[0]->lineSpacing();
while ((ht < _e->y()) && (lineno < numlines))
@@ -314,35 +314,35 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse
{
int i = first+1;
while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
if (t->width(i, true, width(), m_border) > tgt)
{
wrd = toQString(t->data()+first, i - first);
-// qDebug("Got %s", (const char *)wrd);
+// odebug << "Got " << (const char *)wrd << "" << oendl;
break;
}
while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
if ((*t)[i] == 0) break;
first = i;
}
}
if (!wrd.isEmpty())
{
-// qDebug("Selected:%s", (const char*)wrd);
+// odebug << "Selected:" << wrd << "" << oendl;
emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data()));
}
}
void QTReader::mouseReleaseEvent( QMouseEvent* _e )
{
buffdoc.unsuspend();
if (_e->button() == LeftButton)
{
if (mouseUpOn)
{
-// qDebug("MouseRelease");
+// odebug << "MouseRelease" << oendl;
if (_e->x() > width() - m_border)
{
locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height());
return;
}
if (textarray[0] != NULL)
@@ -391,13 +391,13 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e )
locate(pagelocate());
}
return;
}
case ePicture:
{
-// qDebug("Picture:%x", tgt);
+// odebug << "Picture:" << tgt << "" << oendl;
QImage* pm = buffdoc.getPicture(tgt);
if (pm != NULL)
{
emit OnShowPicture(*pm);
delete pm;
}
@@ -407,13 +407,13 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e )
}
return;
}
case eNone:
break;
default:
-// qDebug("Unknown linktype");
+// odebug << "Unknown linktype" << oendl;
return;
}
if (m_swapmouse)
processmousepositionevent(_e);
else
processmousewordevent(startpos, startoffset, _e, lineno);
@@ -693,13 +693,13 @@ void QTReader::setautoscroll(bool _sc)
CDrawBuffer* reusebuffer = textarray[numlines];
if (reusebuffer == NULL || reusebuffer->eof()) return;
m_autoScroll = true;
#ifdef _SCROLLPIPE
if (!m_pipetarget.isEmpty())
{
-// qDebug("Opening pipe to %s", (const char*)m_pipetarget);
+// odebug << "Opening pipe to " << m_pipetarget << "" << oendl;
m_pipeout = popen((const char*)m_pipetarget, "w");
m_isPaused = false;
}
#endif
autoscroll();
#ifdef USEQPE
@@ -820,53 +820,53 @@ void QTReader::setfont()
}
void QTReader::drawFonts( QPainter *p )
{
if (bDoUpdates)
{
-// qDebug("How refreshing...");
+// odebug << "How refreshing..." << oendl;
if (buffdoc.empty()) return;
setfont();
if (m_lastwidth != width())
{
-// qDebug("Not Optimised %d", m_lastwidth);
+// odebug << "Not Optimised " << m_lastwidth << "" << oendl;
m_lastwidth = width();
m_lastheight = height();
buffdoc.setwidth(m_lastwidth-2*m_border);
locate(pagelocate());
-// qDebug("Not Optimised %d", m_lastwidth);
+// odebug << "Not Optimised " << m_lastwidth << "" << oendl;
}
else
{
int newht = height();
if (m_lastheight > newht)
{
-// qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht);
+// odebug << "Optimised < " << numlines << " " << m_lastheight << " " << newht << "" << oendl;
int ypos = 0;
for (int i = 0; i < numlines; i++)
{
if ((ypos += textarray[i]->lineSpacing()) > newht)
{
numlines = i;
jumpto(mylastpos = locnarray[i+1]);
break;
}
}
-// qDebug("Optimised < %d", numlines);
+// odebug << "Optimised < " << numlines << "" << oendl;
m_lastheight = newht;
}
else if (m_lastheight < newht)
{
-// qDebug("Optimised > %d", numlines);
+// odebug << "Optimised > " << numlines << "" << oendl;
int ypos = 0;
for (int i = 0; i <= numlines; i++)
{
ypos += textarray[i]->lineSpacing();
}
fillbuffer(numlines+1, ypos, newht);
-// qDebug("Optimised > %d", numlines);
+// odebug << "Optimised > " << numlines << "" << oendl;
}
if (numlines > 0)
{
int ypos = textarray[0]->ascent();
textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border);
// int last = (m_showlast) ? numlines : numlines-1;
@@ -894,13 +894,13 @@ void QTReader::drawFonts( QPainter *p )
emit OnRedraw();
}
/*
else
{
- qDebug("Not so refreshing...");
+ odebug << "Not so refreshing..." << oendl;
}
*/
}
QString QTReader::firstword()
{
@@ -1025,13 +1025,13 @@ void QTReader::paintEvent( QPaintEvent * )
// Moves the button group to the upper right corner
// of the widget.
/*
void QTReader::resizeEvent( QResizeEvent * )
{
-// // qDebug("resize:(%u,%u)", width(), height());
+// // odebug << "resize:(" << width() << "," << height() << ")" << oendl;
// bgroup->move( width()-bgroup->width(), 0 );
}
*/
//
// Create and display our widget.
@@ -1050,17 +1050,17 @@ int main( int argc, tchar **argv )
bool QTReader::locate(unsigned long n) {
//printf("Locate\n");
buffdoc.unsuspend();
buffdoc.locate(n);
-// // qDebug("&buffdoc.located");
+// // odebug << "&buffdoc.located" << oendl;
fillbuffer();
-// // qDebug("&Buffer filled");
+// // odebug << "&Buffer filled" << oendl;
update();
-// // qDebug("&Located");
+// // odebug << "&Located" << oendl;
return true;
}
unsigned int QTReader::screenlines()
{
// int linespacing = (tight) ? m_ascent : m_ascent+m_descent;
@@ -1114,18 +1114,18 @@ bool QTReader::fillbuffer(int reuse, int ht, int newht)
return true;
}
void QTReader::dopagedn()
{
-// qDebug("HEIGHT(2):%d", m_lastheight);
+// odebug << "HEIGHT(2):" << m_lastheight << "" << oendl;
buffdoc.unsuspend();
int skip = 0, ypos = 0;
if (locate() != mylastpos)
{
-//// qDebug("Jumping to %u", mylastpos);
+//// odebug << "Jumping to " << mylastpos << "" << oendl;
jumpto(mylastpos);
}
CDrawBuffer* reusebuffer = textarray[numlines];
if (reusebuffer != NULL && reusebuffer->eof()) return;
if (reusebuffer != NULL)
{
@@ -1310,19 +1310,19 @@ bool QTReader::load_file(const char *newfile, unsigned int _lcn)
if (buffdoc.openfile(this,newfile) == 0)
{
m_lastfile = newfile;
buffdoc.setwidth(m_lastwidth-2*m_border);
bRC = true;
buffdoc.setContinuous(m_continuousDocument);
-// // qDebug("buffdoc.openfile done");
+// // odebug << "buffdoc.openfile done" << oendl;
locate(lcn);
-// // qDebug("buffdoc.locate done");
+// // odebug << "buffdoc.locate done" << oendl;
}
setfilter(getfilter());
update();
-// // qDebug("Updated");
+// // odebug << "Updated" << oendl;
return bRC;
}
void QTReader::lineDown()
{
int ypos = 0;