summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabel/mymultilineedit.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-12 01:36:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-12 01:36:19 +0000
commit99a2774ca6f1cab334de5d43fe36fc44ae889a4c (patch)
treeeff34cf0762227f6baf2a93e8fef48d4bed2651c /kbabel/kbabel/mymultilineedit.cpp
parent1c104292188541106338d4940b0f04beeb4301a0 (diff)
downloadtdesdk-99a2774ca6f1cab334de5d43fe36fc44ae889a4c.tar.gz
tdesdk-99a2774ca6f1cab334de5d43fe36fc44ae889a4c.zip
TQt4 convert kdesdk
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1236185 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbabel/kbabel/mymultilineedit.cpp')
-rw-r--r--kbabel/kbabel/mymultilineedit.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/kbabel/kbabel/mymultilineedit.cpp b/kbabel/kbabel/mymultilineedit.cpp
index 9b7913d1..29a8da78 100644
--- a/kbabel/kbabel/mymultilineedit.cpp
+++ b/kbabel/kbabel/mymultilineedit.cpp
@@ -25,11 +25,11 @@
In addition, as a special exception, the copyright holders give
permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
+ the TQt library by Trolltech AS, Norway (or with modified versions
+ of TQt that use the same license as TQt), and distribute linked
combinations including the two. You must obey the GNU General
Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
+ TQt. If you modify this file, you may extend this exception to
your version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from
your version.
@@ -49,7 +49,7 @@
#include <tqclipboard.h>
#include <tqapplication.h>
#include <tqdragobject.h>
-//#include <private/qrichtext_p.h>
+//#include <private/tqrichtext_p.h>
#include <tqpopupmenu.h>
#include <kdebug.h>
@@ -62,8 +62,8 @@
using namespace KBabel;
-MyMultiLineEdit::MyMultiLineEdit(int ID, TQWidget* parent,const char* name)
- :KTextEdit(parent,name), emitUndo(true),
+MyMultiLineEdit::MyMultiLineEdit(int ID, TQWidget* tqparent,const char* name)
+ :KTextEdit(tqparent,name), emitUndo(true),
_firstChangedLine(0),
_lastChangedLine(0),
_lastParagraph(0),
@@ -75,7 +75,7 @@ MyMultiLineEdit::MyMultiLineEdit(int ID, TQWidget* parent,const char* name)
{
setUndoRedoEnabled(false); // we handle this ourselves
setWordWrap( WidgetWidth );
- viewport()->setAcceptDrops( false ); // we need our parent to get drops
+ viewport()->setAcceptDrops( false ); // we need our tqparent to get drops
connect(this, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT( onSelectionChanged() ) );
}
@@ -120,7 +120,7 @@ void MyMultiLineEdit::processCommand(EditCommand* cmd, bool undo)
TQPalette _visibleHighlight( palette() );
TQPalette _invisibleHighlight( palette() );
- TQColorGroup newcg( colorGroup() );
+ TQColorGroup newcg( tqcolorGroup() );
newcg.setColor( TQColorGroup::HighlightedText, newcg.text() );
newcg.setColor( TQColorGroup::Highlight, newcg.base() );
if( hasFocus() ) _invisibleHighlight.setActive( newcg );
@@ -141,7 +141,7 @@ void MyMultiLineEdit::processCommand(EditCommand* cmd, bool undo)
setCursorPosition( row, col );
_firstChangedLine=row;
- if(delcmd->str.find("\n")>0 )_lastChangedLine=row+delcmd->str.contains("\n");
+ if(delcmd->str.tqfind("\n")>0 )_lastChangedLine=row+delcmd->str.tqcontains("\n");
else _lastChangedLine=row;
KTextEdit::insert( delcmd->str );
@@ -293,10 +293,10 @@ void MyMultiLineEdit::setText(const TQString& s)
_lastParagraph=0;
_lastParagraphOffset=0;
// workaround, since insert does not interpret markup
- setTextFormat( Qt::PlainText );
+ setTextFormat( TQt::PlainText );
_firstChangedLine=_lastChangedLine=0;
KTextEdit::setText(s);
- setTextFormat( Qt::AutoText );
+ setTextFormat( TQt::AutoText );
// now the number of lines is known, let's do highlight
_lastChangedLine=paragraphs();
emit textChanged();
@@ -308,7 +308,7 @@ 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);
- // code from QMultiLineEdit
+ // code from TQMultiLineEdit
if( mark )
setSelection( line, col, line, col + s.length(), 0 );
// end of copied code
@@ -355,14 +355,14 @@ void MyMultiLineEdit::insert( const TQString & text, bool indent, bool checkNewL
emit signalUndoCmd( new EndCommand(-1,UndefPart));
}
- int n=text.find("\n");
+ int n=text.tqfind("\n");
if( n > 0 ) _lastChangedLine+=n;
// setup palettes
TQPalette _visibleHighlight( palette() );
TQPalette _invisibleHighlight( palette() );
- TQColorGroup newcg( colorGroup() );
+ TQColorGroup newcg( tqcolorGroup() );
newcg.setColor( TQColorGroup::HighlightedText, newcg.text() );
newcg.setColor( TQColorGroup::Highlight, newcg.base() );
if( hasFocus() ) _invisibleHighlight.setActive( newcg );
@@ -546,8 +546,8 @@ void MyMultiLineEdit::offset2Pos(int offset, int &paragraph, int &index) const
int MyMultiLineEdit::pos2Offset(uint paragraph, uint index)
{
- paragraph = QMAX( QMIN( (int)paragraph, paragraphs() - 1), 0 ); // Sanity check
- index = QMAX( QMIN( (int)index, paragraphLength( paragraph )), 0 ); // Sanity check
+ paragraph = TQMAX( TQMIN( (int)paragraph, paragraphs() - 1), 0 ); // Sanity check
+ index = TQMAX( TQMIN( (int)index, paragraphLength( paragraph )), 0 ); // Sanity check
{
uint lastI;
@@ -569,7 +569,7 @@ int MyMultiLineEdit::pos2Offset(uint paragraph, uint index)
_lastParagraphOffset=tmp;
_lastParagraph=paragraph;
- tmp += QMIN( lastI, index );
+ tmp += TQMIN( lastI, index );
return tmp;
}
@@ -592,27 +592,27 @@ void MyMultiLineEdit::setOverwriteMode( bool b )
}
/*******************************************************************************/
-MsgMultiLineEdit::MsgMultiLineEdit(int ID, KSpell* spell, TQWidget* parent,const char* name)
- :MyMultiLineEdit(ID, parent,name),
+MsgMultiLineEdit::MsgMultiLineEdit(int ID, KSpell* spell, TQWidget* tqparent,const char* name)
+ :MyMultiLineEdit(ID, tqparent,name),
_quotes(false),
_cleverEditing(false),
_highlightBg(false),
_spacePoints(false),
- _bgColor(colorGroup().base().dark(110)),
+ _bgColor(tqcolorGroup().base().dark(110)),
_textColor(KGlobalSettings::textColor()),
- _errorColor(Qt::red),
+ _errorColor(TQt::red),
_currentColor(KGlobalSettings::textColor()),
_whitespace(0),
_hlSyntax(true),
- _quoteColor(Qt::darkGreen),
- _unquoteColor(Qt::red),
- _cformatColor(Qt::blue),
- _accelColor(Qt::darkMagenta),
+ _quoteColor(TQt::darkGreen),
+ _unquoteColor(TQt::red),
+ _cformatColor(TQt::blue),
+ _accelColor(TQt::darkMagenta),
_showDiff(false),
_diffUnderlineAdd(true),
_diffStrikeOutDel(true),
- _diffAddColor(Qt::darkGreen),
- _diffDelColor(Qt::darkRed),
+ _diffAddColor(TQt::darkGreen),
+ _diffDelColor(TQt::darkRed),
_currentUnicodeNumber(0),
highlighter(0),
_tagStartPara(0), _tagStartIndex(0), _tagEndPara(0), _tagEndIndex(0)
@@ -661,7 +661,7 @@ void MsgMultiLineEdit::setText(const TQString& s)
if(_showDiff)
{
diffPos.clear();
- int lines = s.contains('\n');
+ int lines = s.tqcontains('\n');
diffPos.resize(lines+1);
TQStringList lineList = TQStringList::split('\n',s,true);
@@ -689,7 +689,7 @@ void MsgMultiLineEdit::setText(const TQString& s)
}
else
{
- addPos = (*it).find("<KBABELADD>",lastPos);
+ addPos = (*it).tqfind("<KBABELADD>",lastPos);
}
if(haveDel && multiline)
@@ -698,7 +698,7 @@ void MsgMultiLineEdit::setText(const TQString& s)
}
else
{
- delPos = (*it).find("<KBABELDEL>",lastPos);
+ delPos = (*it).tqfind("<KBABELDEL>",lastPos);
}
if(delPos >= 0 && addPos >= 0)
@@ -741,7 +741,7 @@ void MsgMultiLineEdit::setText(const TQString& s)
(*it).remove(addPos,11);
}
- int endPos = (*it).find("</KBABELADD>",addPos);
+ int endPos = (*it).tqfind("</KBABELADD>",addPos);
if(endPos < 0)
{
endPos = (*it).length();
@@ -768,7 +768,7 @@ void MsgMultiLineEdit::setText(const TQString& s)
(*it).remove(delPos,11);
}
- int endPos = (*it).find("</KBABELDEL>",delPos);
+ int endPos = (*it).tqfind("</KBABELDEL>",delPos);
if(endPos < 0)
{
endPos = (*it).length();
@@ -805,9 +805,9 @@ void MsgMultiLineEdit::setText(const TQString& s)
}
TQRegExp reg("</?KBABELADD>");
- str.replace(reg,"");
+ str.tqreplace(reg,"");
reg.setPattern("</?KBABELDEL>");
- str.replace(reg,"");
+ str.tqreplace(reg,"");
}
MyMultiLineEdit::setText(str);
@@ -882,10 +882,10 @@ void MsgMultiLineEdit::setFont(const TQFont& font)
// we don't need to calculate a special offset for non-breaking space, since
// they are very similar in size
TQFontMetrics fm(font);
- _wsOffsetX = QMAX(fm.width(' ')/2-2,1);
- _wsOffsetY = QMAX(fm.height()/2-1,0);
+ _wsOffsetX = TQMAX(fm.width(' ')/2-2,1);
+ _wsOffsetY = TQMAX(fm.height()/2-1,0);
- repaint();
+ tqrepaint();
}
void MsgMultiLineEdit::setDiffDisplayMode(bool addUnderline, bool delStrikeOut)
@@ -910,7 +910,7 @@ void MsgMultiLineEdit::setDiffColors(const TQColor& addColor
void MsgMultiLineEdit::setTextColor(const TQColor &color )
{
TQPalette p( palette() );
- TQColorGroup newcg( colorGroup() );
+ TQColorGroup newcg( tqcolorGroup() );
newcg.setColor( TQColorGroup::Text, color );
if( hasFocus() ) p.setActive( newcg );
else p.setInactive( newcg );
@@ -989,15 +989,15 @@ void MsgMultiLineEdit::paintSpacePoints()
if ( paragraphRect( curpara ).top() > contentsY()+visibleHeight()) break;
const TQString& s = text(curpara);
- int i = s.find( " " );
+ int i = s.tqfind( " " );
while( (i >= 0) && (i < (int)s.length()-1) ) // -1 because text will end by EOLN
{
- TQPixmap* pm = ( s.at(i).unicode() == 0x00A0U ) ? wsnb : ws;
+ TQPixmap* pm = ( s.at(i).tqunicode() == 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);
- i = s.find( " ", i+1 );
+ bitBlt(viewport(), r.topLeft(), pm, pm->rect(), TQt::CopyROP);
+ i = s.tqfind( " ", i+1 );
}
++curpara;
}
@@ -1015,7 +1015,7 @@ void MsgMultiLineEdit::paintSpacePoints()
painter.drawText( TQPoint( 0, mapToView( curpara, 0 ).top()) +
TQPoint(0, qs.height() + 4), "\""); // 4 = hardcoded margin in QT
- painter.drawText( mapToView( curpara, QMAX( 0,
+ painter.drawText( mapToView( curpara, TQMAX( 0,
((int)text( curpara ).length())-1)).topRight() +
TQPoint(0, qs.height() + 4), "\""); // 4 = hardcoded margin in QT
}
@@ -1025,7 +1025,7 @@ void MsgMultiLineEdit::paintSpacePoints()
{
if( paragraphs() == (int)diffPos.size() ) // sanity check
{
- painter.setRasterOp( Qt::AndROP );
+ painter.setRasterOp( TQt::AndROP );
for( int curpara = paranum; curpara < paragraphs() ; curpara++ )
{
r = paragraphRect(curpara);
@@ -1141,10 +1141,10 @@ void MsgMultiLineEdit::paintSpacePoints()
}
}
-void MsgMultiLineEdit::repaint()
+void MsgMultiLineEdit::tqrepaint()
{
highlight();
- MyMultiLineEdit::repaint();
+ MyMultiLineEdit::tqrepaint();
}
void MsgMultiLineEdit::forceUpdate()
@@ -1152,7 +1152,7 @@ void MsgMultiLineEdit::forceUpdate()
_firstChangedLine=0;
_lastChangedLine=paragraphs()-1;
highlighter->highlight();
- MyMultiLineEdit::repaint();
+ MyMultiLineEdit::tqrepaint();
}
void MsgMultiLineEdit::ensureCursorVisible()
@@ -1167,7 +1167,7 @@ void MsgMultiLineEdit::highlight()
TQColor bg;
if( _highlightBg ) bg = _bgColor;
- else bg = colorGroup().base();
+ else bg = tqcolorGroup().base();
for( int i = 0 ; i < paragraphs() ; i++ )
setParagraphBackgroundColor( i, bg );
@@ -1188,7 +1188,7 @@ void MsgMultiLineEdit::highlight()
TQRegExp markup("(\\\\)|(\")|(\\\\[abfnrtv'\"\?\\\\])|(\\\\\\d+)|(\\\\x[\\dabcdef]+)"
"|(%[\\ddioxXucsfeEgGphln]+)|(&[^\\s])|(&[\\w-]+;)");
- for( i = QMAX(_firstChangedLine,0) ; i < QMIN(_lastChangedLine+1,(uint)paragraphs()) ; i++ ) {
+ for( i = TQMAX(_firstChangedLine,0) ; i < TQMIN(_lastChangedLine+1,(uint)paragraphs()) ; i++ ) {
TQString line=text(i);
@@ -1252,7 +1252,7 @@ void MsgMultiLineEdit::highlight()
{
TQColor c;
TQFont f;
- VerticalAlignment v;
+ Qt::VerticalAlignment v;
getFormat(_firstChangedLine-1, paragraphLength(_firstChangedLine-1)-1, &f, &c, &v);
TQString l = text(_firstChangedLine-1);
if( c==_tagColor && !l.endsWith(">") ) // hope _tagColor will be different than other colors
@@ -1522,7 +1522,7 @@ void MsgMultiLineEdit::keyPressEvent(TQKeyEvent *e)
{
TQString spclChars="abfnrtv'\"?\\";
if(col < (int)str.length()-1
- && spclChars.contains(str.at(col+1)))
+ && spclChars.tqcontains(str.at(col+1)))
{
del();
}
@@ -1548,7 +1548,7 @@ void MsgMultiLineEdit::keyPressEvent(TQKeyEvent *e)
TQString str=text(row);
TQString spclChars="abfnrtv'\"?\\";
- if(!str.isEmpty() && col > 0 && spclChars.contains(str.at(col-1)))
+ if(!str.isEmpty() && col > 0 && spclChars.tqcontains(str.at(col-1)))
{
if(col > 1 && str.at(col-2)=='\\' && !isMasked(&str,col-2))
{