summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabel/mymultilineedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/kbabel/mymultilineedit.cpp')
-rw-r--r--kbabel/kbabel/mymultilineedit.cpp300
1 files changed, 150 insertions, 150 deletions
diff --git a/kbabel/kbabel/mymultilineedit.cpp b/kbabel/kbabel/mymultilineedit.cpp
index 820d493e..9b7913d1 100644
--- a/kbabel/kbabel/mymultilineedit.cpp
+++ b/kbabel/kbabel/mymultilineedit.cpp
@@ -41,16 +41,16 @@
#include "editcmd.h"
#include "resources.h"
-#include <qpixmap.h>
-#include <qpainter.h>
-#include <qvaluelist.h>
-#include <qstringlist.h>
-#include <qregexp.h>
-#include <qclipboard.h>
-#include <qapplication.h>
-#include <qdragobject.h>
+#include <tqpixmap.h>
+#include <tqpainter.h>
+#include <tqvaluelist.h>
+#include <tqstringlist.h>
+#include <tqregexp.h>
+#include <tqclipboard.h>
+#include <tqapplication.h>
+#include <tqdragobject.h>
//#include <private/qrichtext_p.h>
-#include <qpopupmenu.h>
+#include <tqpopupmenu.h>
#include <kdebug.h>
#include <kglobal.h>
@@ -62,7 +62,7 @@
using namespace KBabel;
-MyMultiLineEdit::MyMultiLineEdit(int ID, QWidget* parent,const char* name)
+MyMultiLineEdit::MyMultiLineEdit(int ID, TQWidget* parent,const char* name)
:KTextEdit(parent,name), emitUndo(true),
_firstChangedLine(0),
_lastChangedLine(0),
@@ -77,7 +77,7 @@ MyMultiLineEdit::MyMultiLineEdit(int ID, QWidget* parent,const char* name)
setWordWrap( WidgetWidth );
viewport()->setAcceptDrops( false ); // we need our parent to get drops
- connect(this, SIGNAL(selectionChanged()), this, SLOT( onSelectionChanged() ) );
+ connect(this, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT( onSelectionChanged() ) );
}
void MyMultiLineEdit::onSelectionChanged()
@@ -118,11 +118,11 @@ void MyMultiLineEdit::processCommand(EditCommand* cmd, bool undo)
bool oldEmitUndo = emitUndo;
emitUndo = false;
- QPalette _visibleHighlight( palette() );
- QPalette _invisibleHighlight( palette() );
- QColorGroup newcg( colorGroup() );
- newcg.setColor( QColorGroup::HighlightedText, newcg.text() );
- newcg.setColor( QColorGroup::Highlight, newcg.base() );
+ TQPalette _visibleHighlight( palette() );
+ TQPalette _invisibleHighlight( palette() );
+ TQColorGroup newcg( colorGroup() );
+ newcg.setColor( TQColorGroup::HighlightedText, newcg.text() );
+ newcg.setColor( TQColorGroup::Highlight, newcg.base() );
if( hasFocus() ) _invisibleHighlight.setActive( newcg );
else _invisibleHighlight.setInactive( newcg );
setPalette( _invisibleHighlight );
@@ -213,34 +213,34 @@ void MyMultiLineEdit::emitCursorPosition()
emit cursorPositionChanged(line, col);
}
-void MyMultiLineEdit::wheelEvent(QWheelEvent *e)
+void MyMultiLineEdit::wheelEvent(TQWheelEvent *e)
{
e->ignore();
}
-void MyMultiLineEdit::focusInEvent(QFocusEvent *e)
+void MyMultiLineEdit::focusInEvent(TQFocusEvent *e)
{
KTextEdit::focusInEvent(e);
emitCursorPosition();
}
-void MyMultiLineEdit::contentsContextMenuEvent( QContextMenuEvent * e)
+void MyMultiLineEdit::contentsContextMenuEvent( TQContextMenuEvent * e)
{
e->accept();
if( _menu ) _menu->exec( e->globalPos() );
}
-QPopupMenu * MyMultiLineEdit::createPopupMenu()
+TQPopupMenu * MyMultiLineEdit::createPopupMenu()
{
return _menu;
}
-QPopupMenu * MyMultiLineEdit::createPopupMenu(const QPoint &)
+TQPopupMenu * MyMultiLineEdit::createPopupMenu(const TQPoint &)
{
return 0;
}
-void MyMultiLineEdit::setContextMenu( QPopupMenu * menu )
+void MyMultiLineEdit::setContextMenu( TQPopupMenu * menu )
{
_menu = menu;
}
@@ -270,10 +270,10 @@ void MyMultiLineEdit::doKeyboardAction( KeyboardAction action )
{
int x,y;
getCursorPosition( &x, &y );
- QString s = text(x);
+ TQString s = text(x);
if( y < (int)s.length()-1 ) // not the end of paragraph
{
- QString delText = s.mid( y, s.length()-y-1);
+ TQString delText = s.mid( y, s.length()-y-1);
emit signalUndoCmd( new DelTextCmd(currentIndex(), delText, _myID ) );
} else
if( x < paragraphs()-1 ) // not the end of text
@@ -288,7 +288,7 @@ void MyMultiLineEdit::doKeyboardAction( KeyboardAction action )
emitCursorPosition();
}
-void MyMultiLineEdit::setText(const QString& s)
+void MyMultiLineEdit::setText(const TQString& s)
{
_lastParagraph=0;
_lastParagraphOffset=0;
@@ -303,7 +303,7 @@ void MyMultiLineEdit::setText(const QString& s)
emitCursorPosition();
}
-void MyMultiLineEdit::insertAt( const QString & s, int line, int col, bool mark )
+void MyMultiLineEdit::insertAt( const TQString & s, int line, int col, bool mark )
{
// it will invoke insert, don't need to send InsTextCmd
KTextEdit::insertAt(s,line,col);
@@ -316,7 +316,7 @@ void MyMultiLineEdit::insertAt( const QString & s, int line, int col, bool mark
emitCursorPosition();
}
-void MyMultiLineEdit::insert( const QString & text, bool indent, bool checkNewLine, bool removeSelected )
+void MyMultiLineEdit::insert( const TQString & text, bool indent, bool checkNewLine, bool removeSelected )
{
int row,col;
@@ -360,11 +360,11 @@ void MyMultiLineEdit::insert( const QString & text, bool indent, bool checkNewLi
// setup palettes
- QPalette _visibleHighlight( palette() );
- QPalette _invisibleHighlight( palette() );
- QColorGroup newcg( colorGroup() );
- newcg.setColor( QColorGroup::HighlightedText, newcg.text() );
- newcg.setColor( QColorGroup::Highlight, newcg.base() );
+ TQPalette _visibleHighlight( palette() );
+ TQPalette _invisibleHighlight( palette() );
+ TQColorGroup newcg( colorGroup() );
+ newcg.setColor( TQColorGroup::HighlightedText, newcg.text() );
+ newcg.setColor( TQColorGroup::Highlight, newcg.base() );
if( hasFocus() ) _invisibleHighlight.setActive( newcg );
else _invisibleHighlight.setInactive( newcg );
setPalette( _invisibleHighlight );
@@ -391,7 +391,7 @@ void MyMultiLineEdit::clear()
_dontUpdate=true;
- QString s = text();
+ TQString s = text();
if( !s.isEmpty() && emitUndo ) {
emit signalUndoCmd( new BeginCommand(-1,UndefPart) );
emit signalUndoCmd( new DelTextCmd(0,s,_myID) );
@@ -423,10 +423,10 @@ void MyMultiLineEdit::my_backspace()
{
int offset = currentIndex();
- QString s= text(cursorY);
+ TQString s= text(cursorY);
if(cursorX != 0)
{
- QString delTxt(s[cursorX-1]);
+ TQString delTxt(s[cursorX-1]);
emit signalUndoCmd(new DelTextCmd(offset-1,delTxt,_myID));
}
else if( cursorY > 0 || cursorX > 0 ) // not at the beginning
@@ -453,10 +453,10 @@ void MyMultiLineEdit::my_del()
{
int offset = pos2Offset(cursorY, cursorX);
- QString s=text(cursorY);
+ TQString s=text(cursorY);
if(cursorX != (int)s.length()-1)
{
- QString delTxt(s[cursorX]);
+ TQString delTxt(s[cursorX]);
emit signalUndoCmd(new DelTextCmd(offset,delTxt,_myID));
}
else if( cursorY < (int)paragraphs()-1 || ( (cursorY == (int)paragraphs()-1) && (cursorX < (int)text( paragraphs()-1 ).length()-1 ) ) )// !atEnd() )
@@ -583,7 +583,7 @@ void MyMultiLineEdit::setReadOnly(bool on)
setBackgroundMode(PaletteBase);
}
- QTextEdit::setReadOnly(on);
+ TQTextEdit::setReadOnly(on);
}
void MyMultiLineEdit::setOverwriteMode( bool b )
@@ -592,7 +592,7 @@ void MyMultiLineEdit::setOverwriteMode( bool b )
}
/*******************************************************************************/
-MsgMultiLineEdit::MsgMultiLineEdit(int ID, KSpell* spell, QWidget* parent,const char* name)
+MsgMultiLineEdit::MsgMultiLineEdit(int ID, KSpell* spell, TQWidget* parent,const char* name)
:MyMultiLineEdit(ID, parent,name),
_quotes(false),
_cleverEditing(false),
@@ -620,32 +620,32 @@ MsgMultiLineEdit::MsgMultiLineEdit(int ID, KSpell* spell, QWidget* parent,const
diffPos.setAutoDelete(true);
diffPos.clear();
- _whitespace = new QPixmap(2,2,-1,QPixmap::BestOptim);
+ _whitespace = new TQPixmap(2,2,-1,TQPixmap::BestOptim);
_whitespace->fill(_textColor);
- _errorWhitespace = new QPixmap(2,2,-1,QPixmap::BestOptim);
+ _errorWhitespace = new TQPixmap(2,2,-1,TQPixmap::BestOptim);
_errorWhitespace->fill(_errorColor);
- _whitespaceNB = new QPixmap(3,3,-1,QPixmap::BestOptim);
+ _whitespaceNB = new TQPixmap(3,3,-1,TQPixmap::BestOptim);
_whitespaceNB->fill();
- _errorWhitespaceNB = new QPixmap(3,3,-1,QPixmap::BestOptim);
+ _errorWhitespaceNB = new TQPixmap(3,3,-1,TQPixmap::BestOptim);
_errorWhitespaceNB->fill();
- QPainter p(_whitespaceNB);
+ TQPainter p(_whitespaceNB);
p.setPen( _textColor );
p.drawEllipse(_whitespaceNB->rect());
- QPainter q(_errorWhitespaceNB);
+ TQPainter q(_errorWhitespaceNB);
q.setPen( _errorColor );
q.drawEllipse(_errorWhitespaceNB->rect());
// this will setup bitBlt pixmaps
setFont( font() );
highlighter = new KBabelHighlighter( this, spell );
- connect( this, SIGNAL( signalSyntaxHighlightingChanged( bool ) ), highlighter, SLOT( setSyntaxHighlighting( bool ) ) );
+ connect( this, TQT_SIGNAL( signalSyntaxHighlightingChanged( bool ) ), highlighter, TQT_SLOT( setSyntaxHighlighting( bool ) ) );
- connect( this, SIGNAL( selectionChanged() ), this, SLOT( paintSpacePoints() ) );
- connect( this, SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( paintSpacePoints(int, int) ) );
- connect( this, SIGNAL( textChanged() ), this, SLOT( emittedTextChanged() ) );
+ connect( this, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( paintSpacePoints() ) );
+ connect( this, TQT_SIGNAL( cursorPositionChanged( int, int ) ), this, TQT_SLOT( paintSpacePoints(int, int) ) );
+ connect( this, TQT_SIGNAL( textChanged() ), this, TQT_SLOT( emittedTextChanged() ) );
}
MsgMultiLineEdit::~MsgMultiLineEdit ()
@@ -654,9 +654,9 @@ MsgMultiLineEdit::~MsgMultiLineEdit ()
delete highlighter;
}
-void MsgMultiLineEdit::setText(const QString& s)
+void MsgMultiLineEdit::setText(const TQString& s)
{
- QString str = s;
+ TQString str = s;
if(_showDiff)
{
@@ -664,13 +664,13 @@ void MsgMultiLineEdit::setText(const QString& s)
int lines = s.contains('\n');
diffPos.resize(lines+1);
- QStringList lineList = QStringList::split('\n',s,true);
+ TQStringList lineList = TQStringList::split('\n',s,true);
int lineCounter=-1;
bool haveAdd=false;
bool haveDel=false;
bool multiline=false;
- QStringList::Iterator it;
+ TQStringList::Iterator it;
for(it = lineList.begin(); it != lineList.end(); ++it)
{
lineCounter++;
@@ -791,10 +791,10 @@ void MsgMultiLineEdit::setText(const QString& s)
if(di.begin >= 0)
{
- QValueList<DiffInfo> *list = diffPos[lineCounter];
+ TQValueList<DiffInfo> *list = diffPos[lineCounter];
if(!list)
{
- list = new QValueList<DiffInfo>;
+ list = new TQValueList<DiffInfo>;
diffPos.insert(lineCounter,list);
}
@@ -804,7 +804,7 @@ void MsgMultiLineEdit::setText(const QString& s)
}
}
- QRegExp reg("</?KBABELADD>");
+ TQRegExp reg("</?KBABELADD>");
str.replace(reg,"");
reg.setPattern("</?KBABELDEL>");
str.replace(reg,"");
@@ -833,7 +833,7 @@ void MsgMultiLineEdit::setHighlightBg(bool on)
}
-void MsgMultiLineEdit::setBgColor(const QColor& color)
+void MsgMultiLineEdit::setBgColor(const TQColor& color)
{
_bgColor=color;
@@ -857,8 +857,8 @@ void MsgMultiLineEdit::setHighlightSyntax(bool on)
update();
}
-void MsgMultiLineEdit::setHighlightColors(const QColor& quoteColor, const QColor& unquoteColor
- , const QColor& cformatColor, const QColor& accelColor, const QColor& tagColor)
+void MsgMultiLineEdit::setHighlightColors(const TQColor& quoteColor, const TQColor& unquoteColor
+ , const TQColor& cformatColor, const TQColor& accelColor, const TQColor& tagColor)
{
_quoteColor=quoteColor;
_unquoteColor=unquoteColor;
@@ -875,13 +875,13 @@ void MsgMultiLineEdit::setHighlightColors(const QColor& quoteColor, const QColor
}
-void MsgMultiLineEdit::setFont(const QFont& font)
+void MsgMultiLineEdit::setFont(const TQFont& font)
{
KTextEdit::setFont(font);
// we don't need to calculate a special offset for non-breaking space, since
// they are very similar in size
- QFontMetrics fm(font);
+ TQFontMetrics fm(font);
_wsOffsetX = QMAX(fm.width(' ')/2-2,1);
_wsOffsetY = QMAX(fm.height()/2-1,0);
@@ -897,8 +897,8 @@ void MsgMultiLineEdit::setDiffDisplayMode(bool addUnderline, bool delStrikeOut)
update();
}
-void MsgMultiLineEdit::setDiffColors(const QColor& addColor
- , const QColor& delColor)
+void MsgMultiLineEdit::setDiffColors(const TQColor& addColor
+ , const TQColor& delColor)
{
_diffAddColor = addColor;
_diffDelColor = delColor;
@@ -907,11 +907,11 @@ void MsgMultiLineEdit::setDiffColors(const QColor& addColor
update();
}
-void MsgMultiLineEdit::setTextColor(const QColor &color )
+void MsgMultiLineEdit::setTextColor(const TQColor &color )
{
- QPalette p( palette() );
- QColorGroup newcg( colorGroup() );
- newcg.setColor( QColorGroup::Text, color );
+ TQPalette p( palette() );
+ TQColorGroup newcg( colorGroup() );
+ newcg.setColor( TQColorGroup::Text, color );
if( hasFocus() ) p.setActive( newcg );
else p.setInactive( newcg );
setPalette( p );
@@ -919,7 +919,7 @@ void MsgMultiLineEdit::setTextColor(const QColor &color )
highlighter->setHighlightColor( KBabelHighlighter::Normal, color );
}
-void MsgMultiLineEdit::setErrorColor(const QColor &color )
+void MsgMultiLineEdit::setErrorColor(const TQColor &color )
{
_errorColor = color;
highlighter->setHighlightColor( KBabelHighlighter::Error, color );
@@ -961,17 +961,17 @@ void MsgMultiLineEdit::paintSpacePoints(int, int )
void MsgMultiLineEdit::paintSpacePoints()
{
- QRect r;
- QPainter painter(viewport() );
- const QFontMetrics& fm = fontMetrics();
+ TQRect r;
+ TQPainter painter(viewport() );
+ const TQFontMetrics& fm = fontMetrics();
- int paranum = paragraphAt(QPoint(contentsX(), contentsY()));
+ int paranum = paragraphAt(TQPoint(contentsX(), contentsY()));
if( _spacePoints )
{
int curpara = paranum;
painter.setPen( _currentColor );
- QPixmap* ws, *wsnb;
+ TQPixmap* ws, *wsnb;
if( _currentColor== _errorColor )
{
@@ -988,12 +988,12 @@ void MsgMultiLineEdit::paintSpacePoints()
{
if ( paragraphRect( curpara ).top() > contentsY()+visibleHeight()) break;
- const QString& s = text(curpara);
+ const TQString& s = text(curpara);
int i = s.find( " " );
while( (i >= 0) && (i < (int)s.length()-1) ) // -1 because text will end by EOLN
{
- QPixmap* pm = ( s.at(i).unicode() == 0x00A0U ) ? wsnb : ws;
- QRect r = mapToView( curpara, i );
+ TQPixmap* pm = ( s.at(i).unicode() == 0x00A0U ) ? wsnb : ws;
+ TQRect r = mapToView( curpara, i );
r.moveBy( r.width()/2, (r.height() - fm.descent())/2 );
r.moveBy( -pm->rect().width()/2, -pm->rect().height()/2-1 );
bitBlt(viewport(), r.topLeft(), pm, pm->rect(), Qt::CopyROP);
@@ -1005,19 +1005,19 @@ void MsgMultiLineEdit::paintSpacePoints()
if( _quotes )
{
- QFontMetrics fm( font());
- QRect qs = fm.boundingRect("\"");
+ TQFontMetrics fm( font());
+ TQRect qs = fm.boundingRect("\"");
for( int curpara = paranum; curpara < paragraphs() ; curpara++ )
{
r = paragraphRect(curpara);
if( r.y() > contentsY()+visibleHeight() ) break;
- painter.drawText( QPoint( 0, mapToView( curpara, 0 ).top()) +
- QPoint(0, qs.height() + 4), "\""); // 4 = hardcoded margin in QT
+ painter.drawText( TQPoint( 0, mapToView( curpara, 0 ).top()) +
+ TQPoint(0, qs.height() + 4), "\""); // 4 = hardcoded margin in QT
painter.drawText( mapToView( curpara, QMAX( 0,
((int)text( curpara ).length())-1)).topRight() +
- QPoint(0, qs.height() + 4), "\""); // 4 = hardcoded margin in QT
+ TQPoint(0, qs.height() + 4), "\""); // 4 = hardcoded margin in QT
}
}
@@ -1031,16 +1031,16 @@ void MsgMultiLineEdit::paintSpacePoints()
r = paragraphRect(curpara);
if( r.y() > contentsY()+visibleHeight() ) break;
- QValueList<DiffInfo> *list = diffPos[curpara];
+ TQValueList<DiffInfo> *list = diffPos[curpara];
if(list)
{
- QValueList<DiffInfo>::ConstIterator it;
+ TQValueList<DiffInfo>::ConstIterator it;
for(it = list->begin(); it != list->end(); ++it)
{
- QRect beg = mapToView( curpara, (*it).begin );
- QRect end = mapToView( curpara, (*it).end );
+ TQRect beg = mapToView( curpara, (*it).begin );
+ TQRect end = mapToView( curpara, (*it).end );
- QColor* c = 0;
+ TQColor* c = 0;
if( (*it).add && !_diffUnderlineAdd)
c = &_diffAddColor;
else if(!(*it).add && !_diffStrikeOutDel)
@@ -1051,23 +1051,23 @@ void MsgMultiLineEdit::paintSpacePoints()
// Single or multiple lines?
if ( beg.top() == end.top())
{
- painter.fillRect( QRect( beg.topLeft(),
- QPoint( end.right(), end.bottom())), *c );
+ painter.fillRect( TQRect( beg.topLeft(),
+ TQPoint( end.right(), end.bottom())), *c );
}
else
{
- painter.fillRect( QRect(
+ painter.fillRect( TQRect(
beg.topLeft(),
- QPoint( r.right(), beg.bottom())), *c );
+ TQPoint( r.right(), beg.bottom())), *c );
if( end.top()-beg.bottom() > 2 ) {
// there is a line, not only thin space
- painter.fillRect( QRect(
- QPoint( r.left(), beg.bottom()),
- QPoint( r.right(), end.top())), *c );
+ painter.fillRect( TQRect(
+ TQPoint( r.left(), beg.bottom()),
+ TQPoint( r.right(), end.top())), *c );
}
- painter.fillRect( QRect(
- QPoint( r.left(), end.top()),
- QPoint( end.right(), end.bottom())), *c );
+ painter.fillRect( TQRect(
+ TQPoint( r.left(), end.top()),
+ TQPoint( end.right(), end.bottom())), *c );
}
}
}
@@ -1085,18 +1085,18 @@ void MsgMultiLineEdit::paintSpacePoints()
r = paragraphRect(curpara);
if( r.y() > contentsY()+visibleHeight() ) break;
- QValueList<DiffInfo> *list = diffPos[curpara];
+ TQValueList<DiffInfo> *list = diffPos[curpara];
if(list)
{
- QPen addPen(_diffAddColor,2);
- QPen delPen(_diffDelColor,2);
- QValueList<DiffInfo>::ConstIterator it;
+ TQPen addPen(_diffAddColor,2);
+ TQPen delPen(_diffDelColor,2);
+ TQValueList<DiffInfo>::ConstIterator it;
for(it = list->begin(); it != list->end(); ++it)
{
- QRect beg = mapToView( curpara, (*it).begin );
- QRect end = mapToView( curpara, (*it).end );
+ TQRect beg = mapToView( curpara, (*it).begin );
+ TQRect end = mapToView( curpara, (*it).end );
- QPen* p = 0;
+ TQPen* p = 0;
int dy = 0;
if( (*it).add && _diffUnderlineAdd)
p = &addPen;
@@ -1113,25 +1113,25 @@ void MsgMultiLineEdit::paintSpacePoints()
// Single or multiple lines?
if ( beg.top() == end.top())
painter.drawLine(
- beg.topLeft() + QPoint(0, fm.ascent()-dy),
- end.topRight()+ QPoint(0, fm.ascent()-dy));
+ beg.topLeft() + TQPoint(0, fm.ascent()-dy),
+ end.topRight()+ TQPoint(0, fm.ascent()-dy));
else
{
int y = beg.top() + fm.ascent();
painter.drawLine(
- QPoint(beg.left(), y),
- QPoint(r.right(), y));
+ TQPoint(beg.left(), y),
+ TQPoint(r.right(), y));
y += fm.lineSpacing();
while (y < end.top() + fm.ascent())
{
painter.drawLine(
- QPoint(r.left(), y),
- QPoint(r.right(), y));
+ TQPoint(r.left(), y),
+ TQPoint(r.right(), y));
y += fm.lineSpacing();
}
painter.drawLine(
- QPoint(r.left(), end.top() + fm.ascent()),
- QPoint(end.right(), end.top() + fm.ascent()));
+ TQPoint(r.left(), end.top() + fm.ascent()),
+ TQPoint(end.right(), end.top() + fm.ascent()));
}
}
}
@@ -1165,7 +1165,7 @@ void MsgMultiLineEdit::highlight()
{
/* if( _dontUpdate ) return;
- QColor bg;
+ TQColor bg;
if( _highlightBg ) bg = _bgColor;
else bg = colorGroup().base();
@@ -1185,19 +1185,19 @@ void MsgMultiLineEdit::highlight()
uint i;
- QRegExp markup("(\\\\)|(\")|(\\\\[abfnrtv'\"\?\\\\])|(\\\\\\d+)|(\\\\x[\\dabcdef]+)"
+ TQRegExp markup("(\\\\)|(\")|(\\\\[abfnrtv'\"\?\\\\])|(\\\\\\d+)|(\\\\x[\\dabcdef]+)"
"|(%[\\ddioxXucsfeEgGphln]+)|(&[^\\s])|(&[\\w-]+;)");
for( i = QMAX(_firstChangedLine,0) ; i < QMIN(_lastChangedLine+1,(uint)paragraphs()) ; i++ ) {
- QString line=text(i);
+ TQString line=text(i);
//remove old highlighting
setSelection(i,0,i,line.length());
setColor( _currentColor );
removeSelection();
- QColor colorToUse;
+ TQColor colorToUse;
int index=0;
index=markup.search( line, index );
@@ -1234,7 +1234,7 @@ void MsgMultiLineEdit::highlight()
int lineindex=0;
uint index=0;
int startPara, endPara, startIndex, endIndex;
- QString t= text();
+ TQString t= text();
if(_lastParagraph <= _firstChangedLine)
{
@@ -1245,19 +1245,19 @@ void MsgMultiLineEdit::highlight()
for( ; index<_firstChangedLine ; index++)
lineindex+=paragraphLength(index)+1;
- QRegExp re("<.*>");
+ TQRegExp re("<.*>");
re.setMinimal(true);
if( _firstChangedLine >0 )
{
- QColor c;
- QFont f;
+ TQColor c;
+ TQFont f;
VerticalAlignment v;
getFormat(_firstChangedLine-1, paragraphLength(_firstChangedLine-1)-1, &f, &c, &v);
- QString l = text(_firstChangedLine-1);
+ TQString l = text(_firstChangedLine-1);
if( c==_tagColor && !l.endsWith(">") ) // hope _tagColor will be different than other colors
{
- QRegExp endtag("[^<]*>");
+ TQRegExp endtag("[^<]*>");
tagindex=endtag.search(t, lineindex);
taglength=endtag.matchedLength();
} else {
@@ -1311,26 +1311,26 @@ void MsgMultiLineEdit::highlight()
*/
}
-void MsgMultiLineEdit::drawContents( QPainter *painter, int clipx, int clipy, int clipw, int cliph )
+void MsgMultiLineEdit::drawContents( TQPainter *painter, int clipx, int clipy, int clipw, int cliph )
{
MyMultiLineEdit::drawContents( painter, clipx, clipy, clipw, cliph );
paintSpacePoints();
}
-void MsgMultiLineEdit::paintEvent( QPaintEvent *event )
+void MsgMultiLineEdit::paintEvent( TQPaintEvent *event )
{
MyMultiLineEdit::paintEvent( event );
paintSpacePoints();
}
-QRect MsgMultiLineEdit::mapToView( int para, int index )
+TQRect MsgMultiLineEdit::mapToView( int para, int index )
{
if( para < 0 || para > paragraphs() ||
index < 0 || index > paragraphLength(para) )
- return QRect(); //invalid rectangle
+ return TQRect(); //invalid rectangle
- const QFontMetrics& fm = fontMetrics();
- const QString& paratext = text(para);
+ const TQFontMetrics& fm = fontMetrics();
+ const TQString& paratext = text(para);
// Find index of the first character on the same line as parameter
// 'index' using binary search. Very fast, even for long texts.
@@ -1377,9 +1377,9 @@ QRect MsgMultiLineEdit::mapToView( int para, int index )
// no tag on the line, no bold
linewidth = fm.width( paratext.mid( linestart, index-linestart ));
} else {
- QFont f( font() );
+ TQFont f( font() );
f.setBold( true );
- QFontMetrics bfm( f );
+ TQFontMetrics bfm( f );
// is tag single displayed line?
if( _tagStartPara == _tagEndPara
&& lineOfChar( _tagStartPara, _tagStartIndex ) == lineOfChar( _tagEndPara, _tagEndIndex ) )
@@ -1400,9 +1400,9 @@ QRect MsgMultiLineEdit::mapToView( int para, int index )
}
else {
// in tag
- QFont f( font() );
+ TQFont f( font() );
f.setBold( true );
- QFontMetrics bfm( f );
+ TQFontMetrics bfm( f );
// is it the first line of the tag?
if( para == _tagStartPara && indexline == lineOfChar( _tagStartPara, _tagStartIndex ) ) {
// start of the line is normal
@@ -1415,23 +1415,23 @@ QRect MsgMultiLineEdit::mapToView( int para, int index )
}
}
- // FIXME as soon as it's possible to ask real margins from QTextEdit:
+ // FIXME as soon as it's possible to ask real margins from TQTextEdit:
const int left_margin = 4;
// const int top_margin = 4;
- QPainter painter( viewport());
- const QRect& linerect = paragraphRect(para);
- return QRect(
- contentsToViewport( QPoint(
+ TQPainter painter( viewport());
+ const TQRect& linerect = paragraphRect(para);
+ return TQRect(
+ contentsToViewport( TQPoint(
left_margin + linerect.left() + linewidth ,
/*top_margin + */linerect.top() + indexline * fm.lineSpacing() + fm.leading())),
- QSize(
+ TQSize(
fm.charWidth( paratext, index ),
fm.lineSpacing()
));
}
-void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
+void MsgMultiLineEdit::keyPressEvent(TQKeyEvent *e)
{
if(!_cleverEditing || isReadOnly())
{
@@ -1447,7 +1447,7 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
int row, col;
getCursorPosition(&row,&col);
- QString str=text(row);
+ TQString str=text(row);
if(e->state() & ShiftButton)
{
@@ -1491,7 +1491,7 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
if( !str.isEmpty())
{
// construct new event without modifiers
- MyMultiLineEdit::keyPressEvent( new QKeyEvent(e->type(), e->key(), e->ascii(), 0,
+ MyMultiLineEdit::keyPressEvent( new TQKeyEvent(e->type(), e->key(), e->ascii(), 0,
e->text(), e->isAutoRepeat(), e->count() ) );
e->accept();
}
@@ -1515,12 +1515,12 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
{
int row, col;
getCursorPosition(&row,&col);
- QString str=text(row);
+ TQString str=text(row);
if(!str.isEmpty() && col < (int)str.length() && str.at(col) == '\\'
&& !isMasked(&str,col))
{
- QString spclChars="abfnrtv'\"?\\";
+ TQString spclChars="abfnrtv'\"?\\";
if(col < (int)str.length()-1
&& spclChars.contains(str.at(col+1)))
{
@@ -1545,9 +1545,9 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
{
int row, col;
getCursorPosition(&row,&col);
- QString str=text(row);
+ TQString str=text(row);
- QString spclChars="abfnrtv'\"?\\";
+ TQString spclChars="abfnrtv'\"?\\";
if(!str.isEmpty() && col > 0 && spclChars.contains(str.at(col-1)))
{
if(col > 1 && str.at(col-2)=='\\' && !isMasked(&str,col-2))
@@ -1571,7 +1571,7 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
int row, col;
getCursorPosition(&row,&col);
- QString str=text(row);
+ TQString str=text(row);
if(col == 0 || str.at(col-1) != '\\' || isMasked(&str,col-1) )
{
@@ -1589,14 +1589,14 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
}
else if(e->key() == Key_Space && ( e->state() & AltButton ) )
{
- insert( QChar( 0x00a0U ) );
+ insert( TQChar( 0x00a0U ) );
e->accept();
return;
}
// ALT+123 feature
else if(( e->state() & AltButton ) && e->text()[0].isDigit() )
{
- QString text=e->text();
+ TQString text=e->text();
while ( text[0].isDigit() ) {
_currentUnicodeNumber = 10*_currentUnicodeNumber+(text[0].digitValue());
text.remove( 0, 1 );
@@ -1608,11 +1608,11 @@ void MsgMultiLineEdit::keyPressEvent(QKeyEvent *e)
}
}
-void MsgMultiLineEdit::keyReleaseEvent(QKeyEvent* e)
+void MsgMultiLineEdit::keyReleaseEvent(TQKeyEvent* e)
{
if ( e->key() == Key_Alt && _currentUnicodeNumber >= 32 )
{
- QString text = QChar( _currentUnicodeNumber );
+ TQString text = TQChar( _currentUnicodeNumber );
_currentUnicodeNumber=0;
insert( text );
}
@@ -1628,7 +1628,7 @@ void MsgMultiLineEdit::setDiffMode(bool on)
}
}
-bool MsgMultiLineEdit::isMasked(QString *str, uint col)
+bool MsgMultiLineEdit::isMasked(TQString *str, uint col)
{
if(col == 0 || !str)
return false;