diff options
Diffstat (limited to 'kdbg/sourcewnd.cpp')
-rw-r--r-- | kdbg/sourcewnd.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/kdbg/sourcewnd.cpp b/kdbg/sourcewnd.cpp index bef2e89..87a6945 100644 --- a/kdbg/sourcewnd.cpp +++ b/kdbg/sourcewnd.cpp @@ -6,13 +6,13 @@ #include "debugger.h" #include "sourcewnd.h" -#include <qtextstream.h> -#include <qpainter.h> -#include <qbrush.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qkeycode.h> -#include <qpopupmenu.h> +#include <ntqtextstream.h> +#include <ntqpainter.h> +#include <ntqbrush.h> +#include <ntqfile.h> +#include <ntqfileinfo.h> +#include <ntqkeycode.h> +#include <ntqpopupmenu.h> #include <kapplication.h> #include <kiconloader.h> #include <kglobalsettings.h> @@ -24,8 +24,8 @@ #include "mydebug.h" -SourceWindow::SourceWindow(const QString& fileName, QWidget* parent, const char* name) : - QTextEdit(parent, name), +SourceWindow::SourceWindow(const TQString& fileName, TQWidget* parent, const char* name) : + TQTextEdit(parent, name), m_fileName(fileName), m_curRow(-1), m_widthItems(16), @@ -52,7 +52,7 @@ SourceWindow::SourceWindow(const QString& fileName, QWidget* parent, const char* viewport()->installEventFilter(this); // add a syntax highlighter - if (QRegExp("\\.(c(pp|c|\\+\\+)?|CC?|h(\\+\\+|h)?|HH?)$").search(m_fileName) >= 0) + if (TQRegExp("\\.(c(pp|c|\\+\\+)?|CC?|h(\\+\\+|h)?|HH?)$").search(m_fileName) >= 0) { new HighlightCpp(this); } @@ -65,13 +65,13 @@ SourceWindow::~SourceWindow() bool SourceWindow::loadFile() { - // first we load the code into QTextEdit - QFile f(m_fileName); + // first we load the code into TQTextEdit + TQFile f(m_fileName); if (!f.open(IO_ReadOnly)) { return false; } - QTextStream t(&f); + TQTextStream t(&f); setText(t.read()); f.close(); @@ -94,7 +94,7 @@ bool SourceWindow::loadFile() void SourceWindow::reloadFile() { - QFile f(m_fileName); + TQFile f(m_fileName); if (!f.open(IO_ReadOnly)) { // open failed; leave alone return; @@ -103,7 +103,7 @@ void SourceWindow::reloadFile() // read text into m_sourceCode m_sourceCode.clear(); /* clear old text */ - QTextStream t(&f); + TQTextStream t(&f); setText(t.read()); f.close(); @@ -148,13 +148,13 @@ void SourceWindow::scrollToRow(int row) ensureCursorVisible(); } -void SourceWindow::drawFrame(QPainter* p) +void SourceWindow::drawFrame(TQPainter* p) { - QTextEdit::drawFrame(p); + TQTextEdit::drawFrame(p); // and paragraph at the top is... - int top = paragraphAt(QPoint(0,contentsY())); - int bot = paragraphAt(QPoint(0,contentsY()+visibleHeight()-1)); + int top = paragraphAt(TQPoint(0,contentsY())); + int bot = paragraphAt(TQPoint(0,contentsY()+visibleHeight()-1)); if (bot < 0) bot = paragraphs()-1; @@ -162,10 +162,10 @@ void SourceWindow::drawFrame(QPainter* p) // set a clip rectangle int fw = frameWidth(); - QRect inside = rect(); + TQRect inside = rect(); inside.addCoords(fw,fw,-fw,-fw); - QRegion clip = p->clipRegion(); - clip &= QRegion(inside); + TQRegion clip = p->clipRegion(); + clip &= TQRegion(inside); p->setClipRegion(clip); p->setFont(m_lineNoFont); @@ -177,8 +177,8 @@ void SourceWindow::drawFrame(QPainter* p) uchar item = m_lineItems[row]; p->save(); - QRect r = paragraphRect(row); - QPoint pt = contentsToViewport(r.topLeft()); + TQRect r = paragraphRect(row); + TQPoint pt = contentsToViewport(r.topLeft()); int h = r.height(); p->translate(fw, pt.y()+viewport()->y()); @@ -237,7 +237,7 @@ void SourceWindow::drawFrame(QPainter* p) p->translate(m_widthPlus, 0); if (!isRowDisassCode(row)) { p->drawText(0, 0, m_widthLineNo, h, AlignRight|AlignVCenter, - QString().setNum(rowToLine(row)+1)); + TQString().setNum(rowToLine(row)+1)); } p->restore(); } @@ -251,7 +251,7 @@ void SourceWindow::updateLineItems(const KDebugger* dbg) if (m_lineItems[i] & liBPany) { // check if this breakpoint still exists int line = rowToLine(i); - TRACE(QString().sprintf("checking for bp at %d", line)); + TRACE(TQString().sprintf("checking for bp at %d", line)); KDebugger::BrkptROIterator bp = dbg->breakpointsBegin(); for (; bp != dbg->breakpointsEnd(); ++bp) { @@ -275,7 +275,7 @@ void SourceWindow::updateLineItems(const KDebugger* dbg) for (KDebugger::BrkptROIterator bp = dbg->breakpointsBegin(); bp != dbg->breakpointsEnd(); ++bp) { if (fileNameMatches(bp->fileName)) { - TRACE(QString().sprintf("updating %s:%d", bp->fileName.data(), bp->lineNo)); + TRACE(TQString().sprintf("updating %s:%d", bp->fileName.data(), bp->lineNo)); int i = bp->lineNo; if (i < 0 || i >= int(m_sourceCode.size())) continue; @@ -322,27 +322,27 @@ void SourceWindow::setPC(bool set, int lineNo, const DbgAddr& address, int frame } } -void SourceWindow::find(const QString& text, bool caseSensitive, FindDirection dir) +void SourceWindow::find(const TQString& text, bool caseSensitive, FindDirection dir) { ASSERT(dir == 1 || dir == -1); - if (QTextEdit::find(text, caseSensitive, false, dir > 0)) + if (TQTextEdit::find(text, caseSensitive, false, dir > 0)) return; // not found; wrap around int para = dir > 0 ? 0 : paragraphs(), index = 0; - QTextEdit::find(text, caseSensitive, false, dir > 0, ¶, &index); + TQTextEdit::find(text, caseSensitive, false, dir > 0, ¶, &index); } -void SourceWindow::mousePressEvent(QMouseEvent* ev) +void SourceWindow::mousePressEvent(TQMouseEvent* ev) { // we handle left and middle button if (ev->button() != LeftButton && ev->button() != MidButton) { - QTextEdit::mousePressEvent(ev); + TQTextEdit::mousePressEvent(ev); return; } // get row - QPoint p = viewportToContents(QPoint(0, ev->y() - viewport()->y())); + TQPoint p = viewportToContents(TQPoint(0, ev->y() - viewport()->y())); int row = paragraphAt(p); if (row < 0) return; @@ -370,22 +370,22 @@ void SourceWindow::mousePressEvent(QMouseEvent* ev) switch (ev->button()) { case LeftButton: - TRACE(QString().sprintf("left-clicked line %d", line)); + TRACE(TQString().sprintf("left-clicked line %d", line)); emit clickedLeft(m_fileName, line, address, (ev->state() & ShiftButton) != 0); break; case MidButton: - TRACE(QString().sprintf("mid-clicked row %d", line)); + TRACE(TQString().sprintf("mid-clicked row %d", line)); emit clickedMid(m_fileName, line, address); break; default:; } } -void SourceWindow::keyPressEvent(QKeyEvent* ev) +void SourceWindow::keyPressEvent(TQKeyEvent* ev) { int top1, top2; - QPoint top; + TQPoint top; switch (ev->key()) { case Key_Plus: actionExpandRow(m_curRow); @@ -411,35 +411,35 @@ void SourceWindow::keyPressEvent(QKeyEvent* ev) return; case Key_Next: case Key_Prior: - top = viewportToContents(QPoint(0,0)); + top = viewportToContents(TQPoint(0,0)); top1 = paragraphAt(top); } - QTextEdit::keyPressEvent(ev); + TQTextEdit::keyPressEvent(ev); switch (ev->key()) { case Key_Next: case Key_Prior: - top = viewportToContents(QPoint(0,0)); + top = viewportToContents(TQPoint(0,0)); top2 = paragraphAt(top); setCursorPosition(m_curRow+(top2-top1), 0); } } -static inline bool isident(QChar c) +static inline bool isident(TQChar c) { return c.isLetterOrNumber() || c.latin1() == '_'; } -bool SourceWindow::wordAtPoint(const QPoint& p, QString& word, QRect& r) +bool SourceWindow::wordAtPoint(const TQPoint& p, TQString& word, TQRect& r) { - QPoint pv = viewportToContents(p - viewport()->pos()); + TQPoint pv = viewportToContents(p - viewport()->pos()); int row, col = charAt(pv, &row); if (row < 0 || col < 0) return false; // isolate the word at row, col - QString line = text(row); + TQString line = text(row); if (!isident(line[col])) return false; @@ -450,30 +450,30 @@ bool SourceWindow::wordAtPoint(const QPoint& p, QString& word, QRect& r) ++col; while (col < int(line.length()) && isident(line[col])); - r = QRect(p, p); + r = TQRect(p, p); r.addCoords(-5,-5,5,5); word = line.mid(begin, col-begin); return true; } -void SourceWindow::paletteChange(const QPalette& oldPal) +void SourceWindow::paletteChange(const TQPalette& oldPal) { setFont(KGlobalSettings::fixedFont()); - QTextEdit::paletteChange(oldPal); + TQTextEdit::paletteChange(oldPal); } /* * Two file names (possibly full paths) match if the last parts - the file * names - match. */ -bool SourceWindow::fileNameMatches(const QString& other) +bool SourceWindow::fileNameMatches(const TQString& other) { - return QFileInfo(other).fileName() == QFileInfo(m_fileName).fileName(); + return TQFileInfo(other).fileName() == TQFileInfo(m_fileName).fileName(); } void SourceWindow::disassembled(int lineNo, const std::list<DisassembledCode>& disass) { - TRACE("disassembled line " + QString().setNum(lineNo)); + TRACE("disassembled line " + TQString().setNum(lineNo)); if (lineNo < 0 || lineNo >= int(m_sourceCode.size())) return; @@ -486,7 +486,7 @@ void SourceWindow::disassembled(int lineNo, const std::list<DisassembledCode>& d int i = 0; for (std::list<DisassembledCode>::const_iterator c = disass.begin(); c != disass.end(); ++c, ++i) { - QString code = c->code; + TQString code = c->code; while (code.endsWith("\n")) code.truncate(code.length()-1); sl.disass[i] = c->address.asString() + ' ' + code; @@ -594,10 +594,10 @@ bool SourceWindow::isRowDisassCode(int row) void SourceWindow::expandRow(int row) { - TRACE("expanding row " + QString().setNum(row)); + TRACE("expanding row " + TQString().setNum(row)); // get disassembled code int line = rowToLine(row); - const std::vector<QString>& disass = m_sourceCode[line].disass; + const std::vector<TQString>& disass = m_sourceCode[line].disass; // remove PC (must be set again in slot of signal expanded()) m_lineItems[row] &= ~(liPC|liPCup); @@ -625,7 +625,7 @@ void SourceWindow::expandRow(int row) void SourceWindow::collapseRow(int row) { - TRACE("collapsing row " + QString().setNum(row)); + TRACE("collapsing row " + TQString().setNum(row)); int line = rowToLine(row); // find end of this block @@ -723,8 +723,8 @@ void SourceWindow::setTabWidth(int numChars) { if (numChars <= 0) numChars = 8; - QFontMetrics fm(currentFont()); - QString s; + TQFontMetrics fm(currentFont()); + TQString s; int w = fm.width(s.fill('x', numChars)); setTabStopWidth(w); } @@ -741,36 +741,36 @@ void SourceWindow::cursorChanged(int row) } /* - * We must override the context menu handling because QTextEdit's handling + * We must override the context menu handling because TQTextEdit's handling * requires that it receives ownership of the popup menu; but the popup menu * returned from the GUI factory is owned by the factory. */ -void SourceWindow::contextMenuEvent(QContextMenuEvent* e) +void SourceWindow::contextMenuEvent(TQContextMenuEvent* e) { // get the context menu from the GUI factory - QWidget* top = this; + TQWidget* top = this; do top = top->parentWidget(); while (!top->isTopLevel()); KMainWindow* mw = static_cast<KMainWindow*>(top); - QPopupMenu* m = - static_cast<QPopupMenu*>(mw->factory()->container("popup_files", mw)); + TQPopupMenu* m = + static_cast<TQPopupMenu*>(mw->factory()->container("popup_files", mw)); m->exec(e->globalPos()); } -bool SourceWindow::eventFilter(QObject* watched, QEvent* e) +bool SourceWindow::eventFilter(TQObject* watched, TQEvent* e) { - if (e->type() == QEvent::ContextMenu && watched == viewport()) + if (e->type() == TQEvent::ContextMenu && watched == viewport()) { - contextMenuEvent(static_cast<QContextMenuEvent*>(e)); + contextMenuEvent(static_cast<TQContextMenuEvent*>(e)); return true; } - return QTextEdit::eventFilter(watched, e); + return TQTextEdit::eventFilter(watched, e); } HighlightCpp::HighlightCpp(SourceWindow* srcWnd) : - QSyntaxHighlighter(srcWnd), + TQSyntaxHighlighter(srcWnd), m_srcWnd(srcWnd) { } @@ -782,7 +782,7 @@ enum HLState { hlString }; -static const QString ckw[] = +static const TQString ckw[] = { "and", "and_eq", @@ -860,7 +860,7 @@ static const QString ckw[] = "xor_eq" }; -int HighlightCpp::highlightParagraph(const QString& text, int state) +int HighlightCpp::highlightParagraph(const TQString& text, int state) { int row = currentParagraph(); // highlight assembly lines @@ -876,12 +876,12 @@ int HighlightCpp::highlightParagraph(const QString& text, int state) // check for preprocessor line if (state == 0 && text.stripWhiteSpace().startsWith("#")) { - setFormat(0, text.length(), QColor("dark green")); + setFormat(0, text.length(), TQColor("dark green")); return 0; } // a font for keywords - QFont identFont = textEdit()->currentFont(); + TQFont identFont = textEdit()->currentFont(); identFont.setBold(!identFont.bold()); unsigned start = 0; @@ -892,7 +892,7 @@ int HighlightCpp::highlightParagraph(const QString& text, int state) case hlCommentLine: end = text.length(); state = 0; - setFormat(start, end-start, QColor("gray50")); + setFormat(start, end-start, TQColor("gray50")); break; case hlCommentBlock: end = text.find("*/", start); @@ -900,7 +900,7 @@ int HighlightCpp::highlightParagraph(const QString& text, int state) end += 2, state = 0; else end = text.length(); - setFormat(start, end-start, QColor("gray50")); + setFormat(start, end-start, TQColor("gray50")); break; case hlString: for (end = start+1; end < int(text.length()); end++) { @@ -913,7 +913,7 @@ int HighlightCpp::highlightParagraph(const QString& text, int state) } } state = 0; - setFormat(start, end-start, QColor("dark red")); + setFormat(start, end-start, TQColor("dark red")); break; case hlIdent: for (end = start+1; end < int(text.length()); end++) { |