diff options
Diffstat (limited to 'lib/kformula/fontstyle.cc')
-rw-r--r-- | lib/kformula/fontstyle.cc | 298 |
1 files changed, 149 insertions, 149 deletions
diff --git a/lib/kformula/fontstyle.cc b/lib/kformula/fontstyle.cc index 3287120c..0d1792e0 100644 --- a/lib/kformula/fontstyle.cc +++ b/lib/kformula/fontstyle.cc @@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -#include <qpainter.h> -#include <qpen.h> -#include <qfontdatabase.h> -#include <qapplication.h> +#include <tqpainter.h> +#include <tqpen.h> +#include <tqfontdatabase.h> +#include <tqapplication.h> #include <kstaticdeleter.h> #include <klocale.h> @@ -48,19 +48,19 @@ bool FontStyle::init( ContextStyle* style, bool install ) return true; } -// Cache the family list from QFontDatabase after fixing it up (no foundry, lowercase) +// Cache the family list from TQFontDatabase after fixing it up (no foundry, lowercase) class FontList { public: FontList() { - QFontDatabase db; - const QStringList lst = db.families(); - for ( QStringList::const_iterator it = lst.begin(), end = lst.end() ; it != end ; ++it ) { - const QString name = *it; - int i = name.find('['); - QString family = name; + TQFontDatabase db; + const TQStringList lst = db.tqfamilies(); + for ( TQStringList::const_iterator it = lst.begin(), end = lst.end() ; it != end ; ++it ) { + const TQString name = *it; + int i = name.tqfind('['); + TQString family = name; // Remove foundry if ( i > -1 ) { - const int li = name.findRev(']'); + const int li = name.tqfindRev(']'); if (i < li) { if (name[i - 1] == ' ') i--; @@ -70,15 +70,15 @@ public: m_fontNames.append( family.lower() ); } } - bool hasFont( const QString& fontName ) const { - return m_fontNames.find( fontName ) != m_fontNames.end(); + bool hasFont( const TQString& fontName ) const { + return m_fontNames.tqfind( fontName ) != m_fontNames.end(); } - QStringList m_fontNames; + TQStringList m_fontNames; }; static FontList* s_fontList = 0; static KStaticDeleter<FontList> s_fontList_sd; -void FontStyle::testFont( QStringList& missing, const QString& fontName ) { +void FontStyle::testFont( TQStringList& missing, const TQString& fontName ) { if ( !s_fontList ) s_fontList_sd.setObject( s_fontList, new FontList() ); if ( !s_fontList->hasFont( fontName ) ) { @@ -88,18 +88,18 @@ void FontStyle::testFont( QStringList& missing, const QString& fontName ) { } -QStringList FontStyle::missingFonts( bool install ) +TQStringList FontStyle::missingFonts( bool install ) { if (!m_installed && install) installFonts(); - QStringList missing = missingFontsInternal(); + TQStringList missing = missingFontsInternal(); return missing; } -QStringList FontStyle::missingFontsInternal() +TQStringList FontStyle::missingFontsInternal() { - QStringList missing; + TQStringList missing; testFont( missing, "cmex10" ); testFont( missing, "arev sans"); @@ -111,11 +111,11 @@ void FontStyle::installFonts() { if (m_installed) return; - QStringList missing = missingFontsInternal(); + TQStringList missing = missingFontsInternal(); if (!missing.isEmpty()) { - QStringList urlList; - for (QStringList::iterator it = missing.begin(); it != missing.end(); ++it) + TQStringList urlList; + for (TQStringList::iterator it = missing.begin(); it != missing.end(); ++it) { if ( *it == "arev sans" ) { if (!KIO::NetAccess::exists("fonts:/Personal/Arev.ttf", true, NULL)) @@ -133,7 +133,7 @@ void FontStyle::installFonts() } } KIO::copy(urlList, "fonts:/Personal/", false); - KMessageBox::information(qApp->mainWidget(), + KMessageBox::information(tqApp->mainWidget(), i18n("Some fonts have been installed to assure that symbols in formulas are properly visualized. You must restart the application in order so that changes take effect")); } m_installed = true; @@ -146,45 +146,45 @@ Artwork* FontStyle::createArtwork( SymbolType type ) const // We claim that all chars come from the same font. // It's up to the font tables to ensure this. -const QChar leftRoundBracket[] = { +const TQChar leftRoundBracket[] = { 0x30, // uppercorner 0x40, // lowercorner 0x42 // line }; -const QChar leftSquareBracket[] = { +const TQChar leftSquareBracket[] = { 0x32, // uppercorner 0x34, // lowercorner 0x36 // line }; -const QChar leftCurlyBracket[] = { +const TQChar leftCurlyBracket[] = { 0x38, // uppercorner 0x3A, // lowercorner 0x3E, // line 0x3C // middle }; -const QChar leftLineBracket[] = { +const TQChar leftLineBracket[] = { 0x36, // line 0x36, // line 0x36 // line }; -const QChar rightLineBracket[] = { +const TQChar rightLineBracket[] = { 0x37, // line 0x37, // line 0x37 // line }; -const QChar rightRoundBracket[] = { +const TQChar rightRoundBracket[] = { 0x31, // uppercorner 0x41, // lowercorner 0x43 // line }; -const QChar rightSquareBracket[] = { +const TQChar rightSquareBracket[] = { 0x33, // uppercorner 0x35, // lowercorner 0x37 // line }; -const QChar rightCurlyBracket[] = { +const TQChar rightCurlyBracket[] = { 0x39, // uppercorner 0x3B, // lowercorner 0x3E, // line @@ -266,17 +266,17 @@ static short cmex_nextchar( short ch ) bool Artwork::calcCMDelimiterSize( const ContextStyle& context, uchar c, luPt fontSize, - luPt parentSize ) + luPt tqparentSize ) { - QFont f( "cmex10" ); - f.setPointSizeFloat( context.layoutUnitPtToPt( fontSize ) ); - QFontMetrics fm( f ); + TQFont f( "cmex10" ); + f.setPointSizeFloat( context.tqlayoutUnitPtToPt( fontSize ) ); + TQFontMetrics fm( f ); for ( char i=1; c != 0; ++i ) { LuPixelRect bound = fm.boundingRect( c ); luPt height = context.ptToLayoutUnitPt( bound.height() ); - if ( height >= parentSize ) { + if ( height >= tqparentSize ) { luPt width = context.ptToLayoutUnitPt( fm.width( c ) ); luPt baseline = context.ptToLayoutUnitPt( -bound.top() ); @@ -299,9 +299,9 @@ bool Artwork::calcCMDelimiterSize( const ContextStyle& context, void Artwork::calcLargest( const ContextStyle& context, uchar c, luPt fontSize ) { - QFont f( "cmex10" ); - f.setPointSizeFloat( context.layoutUnitPtToPt( fontSize ) ); - QFontMetrics fm( f ); + TQFont f( "cmex10" ); + f.setPointSizeFloat( context.tqlayoutUnitPtToPt( fontSize ) ); + TQFontMetrics fm( f ); cmChar = c; for ( ;; ) { @@ -324,26 +324,26 @@ void Artwork::calcLargest( const ContextStyle& context, } -void Artwork::drawCMDelimiter( QPainter& painter, const ContextStyle& style, +void Artwork::drawCMDelimiter( TQPainter& painter, const ContextStyle& style, luPixel x, luPixel y, luPt height ) { - QFont f( "cmex10" ); - f.setPointSizeFloat( style.layoutUnitToFontSize( height, false ) ); + TQFont f( "cmex10" ); + f.setPointSizeFloat( style.tqlayoutUnitToFontSize( height, false ) ); painter.setFont( f ); - painter.drawText( style.layoutUnitToPixelX( x ), - style.layoutUnitToPixelY( y + getBaseline() ), - QString( QChar( cmChar ) ) ); + painter.drawText( style.tqlayoutUnitToPixelX( x ), + style.tqlayoutUnitToPixelY( y + getBaseline() ), + TQString( TQChar( cmChar ) ) ); // Debug #if 0 - QFontMetrics fm( f ); + TQFontMetrics fm( f ); LuPixelRect bound = fm.boundingRect( cmChar ); - painter.setBrush(Qt::NoBrush); - painter.setPen(Qt::green); - painter.drawRect( style.layoutUnitToPixelX( x ), - style.layoutUnitToPixelY( y ), + painter.setBrush(TQt::NoBrush); + painter.setPen(TQt::green); + painter.drawRect( style.tqlayoutUnitToPixelX( x ), + style.tqlayoutUnitToPixelY( y ), fm.width( cmChar ), bound.height() ); #endif @@ -359,7 +359,7 @@ Artwork::Artwork(SymbolType t) void Artwork::calcSizes( const ContextStyle& style, ContextStyle::TextStyle tstyle, double factor, - luPt parentSize ) + luPt tqparentSize ) { setBaseline( -1 ); cmChar = -1; @@ -367,86 +367,86 @@ void Artwork::calcSizes( const ContextStyle& style, switch (getType()) { case LeftSquareBracket: if ( calcCMDelimiterSize( style, cmex_LeftSquareBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } - calcRoundBracket( style, leftSquareBracket, parentSize, mySize ); + calcRoundBracket( style, leftSquareBracket, tqparentSize, mySize ); break; case RightSquareBracket: if ( calcCMDelimiterSize( style, cmex_RightSquareBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } - calcRoundBracket( style, rightSquareBracket, parentSize, mySize ); + calcRoundBracket( style, rightSquareBracket, tqparentSize, mySize ); break; case LeftLineBracket: - calcRoundBracket( style, leftLineBracket, parentSize, mySize ); + calcRoundBracket( style, leftLineBracket, tqparentSize, mySize ); setWidth( getWidth()/2 ); break; case RightLineBracket: - calcRoundBracket( style, rightLineBracket, parentSize, mySize ); + calcRoundBracket( style, rightLineBracket, tqparentSize, mySize ); setWidth( getWidth()/2 ); break; case SlashBracket: if ( calcCMDelimiterSize( style, cmex_SlashBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } calcLargest( style, cmex_SlashBracket, mySize ); break; case BackSlashBracket: if ( calcCMDelimiterSize( style, cmex_BackSlashBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } calcLargest( style, cmex_BackSlashBracket, mySize ); break; case LeftCornerBracket: if ( calcCMDelimiterSize( style, cmex_LeftCornerBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } calcLargest( style, cmex_LeftCornerBracket, mySize ); break; case RightCornerBracket: if ( calcCMDelimiterSize( style, cmex_RightCornerBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } calcLargest( style, cmex_RightCornerBracket, mySize ); break; case LeftRoundBracket: if ( calcCMDelimiterSize( style, cmex_LeftRoundBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } - calcRoundBracket( style, leftRoundBracket, parentSize, mySize ); + calcRoundBracket( style, leftRoundBracket, tqparentSize, mySize ); break; case RightRoundBracket: if ( calcCMDelimiterSize( style, cmex_RightRoundBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } - calcRoundBracket( style, rightRoundBracket, parentSize, mySize ); + calcRoundBracket( style, rightRoundBracket, tqparentSize, mySize ); break; case EmptyBracket: - setHeight(parentSize); + setHeight(tqparentSize); //setWidth(style.getEmptyRectWidth()); setWidth(0); break; case LeftCurlyBracket: if ( calcCMDelimiterSize( style, cmex_LeftCurlyBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } - calcCurlyBracket( style, leftCurlyBracket, parentSize, mySize ); + calcCurlyBracket( style, leftCurlyBracket, tqparentSize, mySize ); break; case RightCurlyBracket: if ( calcCMDelimiterSize( style, cmex_RightCurlyBracket, - mySize, parentSize ) ) { + mySize, tqparentSize ) ) { return; } - calcCurlyBracket( style, rightCurlyBracket, parentSize, mySize ); + calcCurlyBracket( style, rightCurlyBracket, tqparentSize, mySize ); break; case Integral: calcCharSize( style, style.getBracketFont(), mySize, cmex_Int ); @@ -514,13 +514,13 @@ void Artwork::calcSizes( const ContextStyle& style, } -void Artwork::draw(QPainter& painter, const LuPixelRect& /*r*/, +void Artwork::draw(TQPainter& painter, const LuPixelRect& /*r*/, const ContextStyle& context, ContextStyle::TextStyle tstyle, - StyleAttributes& style, const LuPixelPoint& parentOrigin) + StyleAttributes& style, const LuPixelPoint& tqparentOrigin) { luPt mySize = context.getAdjustedSize( tstyle, style.sizeFactor() ); - luPixel myX = parentOrigin.x() + getX(); - luPixel myY = parentOrigin.y() + getY(); + luPixel myX = tqparentOrigin.x() + getX(); + luPixel myY = tqparentOrigin.y() + getY(); /* if ( !LuPixelRect( myX, myY, getWidth(), getHeight() ).intersects( r ) ) return; @@ -572,7 +572,7 @@ void Artwork::draw(QPainter& painter, const LuPixelRect& /*r*/, } } -void Artwork::draw(QPainter& painter, const LuPixelRect& , +void Artwork::draw(TQPainter& painter, const LuPixelRect& , const ContextStyle& context, ContextStyle::TextStyle tstyle, StyleAttributes& style, luPt , const LuPixelPoint& origin) { @@ -672,45 +672,45 @@ void Artwork::draw(QPainter& painter, const LuPixelRect& , case EmptyBracket: break; case Integral: - drawCharacter(painter, context, QFont( "cmex10" ), myX, myY, mySize, cmex_Int); + drawCharacter(painter, context, TQFont( "cmex10" ), myX, myY, mySize, cmex_Int); break; case Sum: - drawCharacter(painter, context, QFont( "cmex10" ), myX, myY, mySize, cmex_Sum); + drawCharacter(painter, context, TQFont( "cmex10" ), myX, myY, mySize, cmex_Sum); break; case Product: - drawCharacter(painter, context, QFont( "cmex10" ), myX, myY, mySize, cmex_Prod); + drawCharacter(painter, context, TQFont( "cmex10" ), myX, myY, mySize, cmex_Prod); break; } // debug -// painter.setBrush(Qt::NoBrush); -// painter.setPen(Qt::green); -// painter.drawRect( context.layoutUnitToPixelX( myX ), -// context.layoutUnitToPixelY( myY ), -// context.layoutUnitToPixelX( getWidth() ), -// context.layoutUnitToPixelY( getHeight() ) ); +// painter.setBrush(TQt::NoBrush); +// painter.setPen(TQt::green); +// painter.drawRect( context.tqlayoutUnitToPixelX( myX ), +// context.tqlayoutUnitToPixelY( myY ), +// context.tqlayoutUnitToPixelX( getWidth() ), +// context.tqlayoutUnitToPixelY( getHeight() ) ); } -void Artwork::calcCharSize( const ContextStyle& style, luPt height, QChar ch ) +void Artwork::calcCharSize( const ContextStyle& style, luPt height, TQChar ch ) { calcCharSize( style, style.getMathFont(), height, ch ); } -void Artwork::drawCharacter( QPainter& painter, const ContextStyle& style, +void Artwork::drawCharacter( TQPainter& painter, const ContextStyle& style, luPixel x, luPixel y, - luPt height, QChar ch ) + luPt height, TQChar ch ) { drawCharacter( painter, style, style.getMathFont(), x, y, height, ch ); } -void Artwork::calcCharSize( const ContextStyle& style, QFont f, - luPt height, QChar c ) +void Artwork::calcCharSize( const ContextStyle& style, TQFont f, + luPt height, TQChar c ) { - f.setPointSizeFloat( style.layoutUnitPtToPt( height ) ); + f.setPointSizeFloat( style.tqlayoutUnitPtToPt( height ) ); //f.setPointSize( height ); - QFontMetrics fm(f); + TQFontMetrics fm(f); setWidth( style.ptToLayoutUnitPt( fm.width( c ) ) ); LuPixelRect bound = fm.boundingRect( c ); setHeight( style.ptToLayoutUnitPt( bound.height() ) ); @@ -718,70 +718,70 @@ void Artwork::calcCharSize( const ContextStyle& style, QFont f, } -void Artwork::drawCharacter( QPainter& painter, const ContextStyle& style, - QFont f, +void Artwork::drawCharacter( TQPainter& painter, const ContextStyle& style, + TQFont f, luPixel x, luPixel y, luPt height, uchar c ) { - f.setPointSizeFloat( style.layoutUnitToFontSize( height, false ) ); + f.setPointSizeFloat( style.tqlayoutUnitToFontSize( height, false ) ); painter.setFont( f ); - painter.drawText( style.layoutUnitToPixelX( x ), - style.layoutUnitToPixelY( y+getBaseline() ), - QString( QChar( c ) ) ); + painter.drawText( style.tqlayoutUnitToPixelX( x ), + style.tqlayoutUnitToPixelY( y+getBaseline() ), + TQString( TQChar( c ) ) ); } -void Artwork::calcRoundBracket( const ContextStyle& style, const QChar chars[], +void Artwork::calcRoundBracket( const ContextStyle& style, const TQChar chars[], luPt height, luPt charHeight ) { uchar uppercorner = chars[0]; uchar lowercorner = chars[1]; //uchar line = style.symbolTable().character( chars[2] ); - QFont f = style.getBracketFont(); - f.setPointSizeFloat( style.layoutUnitPtToPt( charHeight ) ); - QFontMetrics fm( f ); + TQFont f = style.getBracketFont(); + f.setPointSizeFloat( style.tqlayoutUnitPtToPt( charHeight ) ); + TQFontMetrics fm( f ); LuPtRect upperBound = fm.boundingRect( uppercorner ); LuPtRect lowerBound = fm.boundingRect( lowercorner ); //LuPtRect lineBound = fm.boundingRect( line ); - setWidth( style.ptToLayoutUnitPt( fm.width( QChar( uppercorner ) ) ) ); + setWidth( style.ptToLayoutUnitPt( fm.width( TQChar( uppercorner ) ) ) ); luPt edgeHeight = style.ptToLayoutUnitPt( upperBound.height()+lowerBound.height() ); //luPt lineHeight = style.ptToLayoutUnitPt( lineBound.height() ); //setHeight( edgeHeight + ( ( height-edgeHeight-1 ) / lineHeight + 1 ) * lineHeight ); - setHeight( QMAX( edgeHeight, height ) ); + setHeight( TQMAX( edgeHeight, height ) ); } -void Artwork::drawBigRoundBracket( QPainter& p, const ContextStyle& style, const QChar chars[], +void Artwork::drawBigRoundBracket( TQPainter& p, const ContextStyle& style, const TQChar chars[], luPixel x, luPixel y, luPt charHeight ) { uchar uppercorner = chars[0]; uchar lowercorner = chars[1]; uchar line = chars[2]; - QFont f = style.getBracketFont(); - f.setPointSizeFloat( style.layoutUnitToFontSize( charHeight, false ) ); + TQFont f = style.getBracketFont(); + f.setPointSizeFloat( style.tqlayoutUnitToFontSize( charHeight, false ) ); p.setFont(f); - QFontMetrics fm(f); - QRect upperBound = fm.boundingRect(uppercorner); - QRect lowerBound = fm.boundingRect(lowercorner); - QRect lineBound = fm.boundingRect(line); + TQFontMetrics fm(f); + TQRect upperBound = fm.boundingRect(uppercorner); + TQRect lowerBound = fm.boundingRect(lowercorner); + TQRect lineBound = fm.boundingRect(line); - pixel ptX = style.layoutUnitToPixelX( x ); - pixel ptY = style.layoutUnitToPixelY( y ); - pixel height = style.layoutUnitToPixelY( getHeight() ); + pixel ptX = style.tqlayoutUnitToPixelX( x ); + pixel ptY = style.tqlayoutUnitToPixelY( y ); + pixel height = style.tqlayoutUnitToPixelY( getHeight() ); -// p.setPen( Qt::red ); +// p.setPen( TQt::red ); // //p.drawRect( ptX, ptY, upperBound.width(), upperBound.height() + lowerBound.height() ); -// p.drawRect( ptX, ptY, style.layoutUnitToPixelX( getWidth() ), -// style.layoutUnitToPixelY( getHeight() ) ); +// p.drawRect( ptX, ptY, style.tqlayoutUnitToPixelX( getWidth() ), +// style.tqlayoutUnitToPixelY( getHeight() ) ); -// p.setPen( Qt::black ); - p.drawText( ptX, ptY-upperBound.top(), QString( QChar( uppercorner ) ) ); +// p.setPen( TQt::black ); + p.drawText( ptX, ptY-upperBound.top(), TQString( TQChar( uppercorner ) ) ); p.drawText( ptX, ptY+height-lowerBound.top()-lowerBound.height(), - QString( QChar( lowercorner ) ) ); + TQString( TQChar( lowercorner ) ) ); // for printing //pt safety = lineBound.height() / 10.0; @@ -789,19 +789,19 @@ void Artwork::drawBigRoundBracket( QPainter& p, const ContextStyle& style, const pixel gap = height - upperBound.height() - lowerBound.height(); pixel lineHeight = lineBound.height() - safety; - int lineCount = qRound( static_cast<double>( gap ) / lineHeight ); + int lineCount = tqRound( static_cast<double>( gap ) / lineHeight ); pixel start = upperBound.height()-lineBound.top() - safety; for (int i = 0; i < lineCount; i++) { - p.drawText( ptX, ptY+start+i*lineHeight, QString(QChar(line))); + p.drawText( ptX, ptY+start+i*lineHeight, TQString(TQChar(line))); } pixel remaining = gap - lineCount*lineHeight; pixel dist = ( lineHeight - remaining ) / 2; p.drawText( ptX, ptY+height-upperBound.height()+dist-lineBound.height()-lineBound.top(), - QString( QChar( line ) ) ); + TQString( TQChar( line ) ) ); } -void Artwork::calcCurlyBracket( const ContextStyle& style, const QChar chars[], +void Artwork::calcCurlyBracket( const ContextStyle& style, const TQChar chars[], luPt height, luPt charHeight ) { uchar uppercorner = chars[0]; @@ -809,30 +809,30 @@ void Artwork::calcCurlyBracket( const ContextStyle& style, const QChar chars[], //uchar line = style.symbolTable().character( chars[2] ); uchar middle = chars[3]; - QFont f = style.getBracketFont(); - f.setPointSizeFloat( style.layoutUnitPtToPt( charHeight ) ); - QFontMetrics fm( f ); + TQFont f = style.getBracketFont(); + f.setPointSizeFloat( style.tqlayoutUnitPtToPt( charHeight ) ); + TQFontMetrics fm( f ); LuPtRect upperBound = fm.boundingRect( uppercorner ); LuPtRect lowerBound = fm.boundingRect( lowercorner ); //LuPtRect lineBound = fm.boundingRect( line ); LuPtRect middleBound = fm.boundingRect( middle ); - setWidth( style.ptToLayoutUnitPt( fm.width( QChar( uppercorner ) ) ) ); + setWidth( style.ptToLayoutUnitPt( fm.width( TQChar( uppercorner ) ) ) ); luPt edgeHeight = style.ptToLayoutUnitPt( upperBound.height()+ lowerBound.height()+ middleBound.height() ); //luPt lineHeight = style.ptToLayoutUnitPt( lineBound.height() ); //setHeight( edgeHeight + ( ( height-edgeHeight-1 ) / lineHeight + 1 ) * lineHeight ); - setHeight( QMAX( edgeHeight, height ) ); + setHeight( TQMAX( edgeHeight, height ) ); } -void Artwork::drawBigCurlyBracket( QPainter& p, const ContextStyle& style, const QChar chars[], +void Artwork::drawBigCurlyBracket( TQPainter& p, const ContextStyle& style, const TQChar chars[], luPixel x, luPixel y, luPt charHeight ) { - //QFont f = style.getSymbolFont(); - QFont f = style.getBracketFont(); - f.setPointSizeFloat( style.layoutUnitToFontSize( charHeight, false ) ); + //TQFont f = style.getSymbolFont(); + TQFont f = style.getBracketFont(); + f.setPointSizeFloat( style.tqlayoutUnitToFontSize( charHeight, false ) ); p.setFont(f); uchar uppercorner = chars[0]; @@ -840,24 +840,24 @@ void Artwork::drawBigCurlyBracket( QPainter& p, const ContextStyle& style, const uchar line = chars[2]; uchar middle = chars[3]; - QFontMetrics fm(p.fontMetrics()); - QRect upperBound = fm.boundingRect(uppercorner); - QRect lowerBound = fm.boundingRect(lowercorner); - QRect middleBound = fm.boundingRect(middle); - QRect lineBound = fm.boundingRect(line); + TQFontMetrics fm(p.fontMetrics()); + TQRect upperBound = fm.boundingRect(uppercorner); + TQRect lowerBound = fm.boundingRect(lowercorner); + TQRect middleBound = fm.boundingRect(middle); + TQRect lineBound = fm.boundingRect(line); - pixel ptX = style.layoutUnitToPixelX( x ); - pixel ptY = style.layoutUnitToPixelY( y ); - pixel height = style.layoutUnitToPixelY( getHeight() ); + pixel ptX = style.tqlayoutUnitToPixelX( x ); + pixel ptY = style.tqlayoutUnitToPixelY( y ); + pixel height = style.tqlayoutUnitToPixelY( getHeight() ); - //p.setPen(Qt::gray); + //p.setPen(TQt::gray); //p.drawRect(x, y, upperBound.width() + offset, height); - p.drawText( ptX, ptY-upperBound.top(), QString( QChar( uppercorner ) ) ); + p.drawText( ptX, ptY-upperBound.top(), TQString( TQChar( uppercorner ) ) ); p.drawText( ptX, ptY+(height-middleBound.height())/2-middleBound.top(), - QString( QChar( middle ) ) ); + TQString( TQChar( middle ) ) ); p.drawText( ptX, ptY+height-lowerBound.top()-lowerBound.height(), - QString( QChar( lowercorner ) ) ); + TQString( TQChar( lowercorner ) ) ); // for printing // If the world was perfect and the urw-symbol font correct @@ -869,19 +869,19 @@ void Artwork::drawBigCurlyBracket( QPainter& p, const ContextStyle& style, const pixel gap = height/2 - upperBound.height() - middleBound.height() / 2; if (gap > 0) { - QString ch = QString(QChar(line)); - int lineCount = qRound( gap / lineHeight ) + 1; + TQString ch = TQString(TQChar(line)); + int lineCount = tqRound( gap / lineHeight ) + 1; pixel start = (height - middleBound.height()) / 2 + safety; for (int i = 0; i < lineCount; i++) { - p.drawText( ptX, ptY-lineBound.top()+QMAX( start-(i+1)*lineHeight, + p.drawText( ptX, ptY-lineBound.top()+TQMAX( start-(i+1)*lineHeight, upperBound.width() ), ch ); } start = (height + middleBound.height()) / 2 - safety; for (int i = 0; i < lineCount; i++) { - p.drawText( ptX, ptY-lineBound.top()+QMIN( start+i*lineHeight, + p.drawText( ptX, ptY-lineBound.top()+TQMIN( start+i*lineHeight, height-upperBound.width()-lineBound.height() ), ch ); } |