diff options
Diffstat (limited to 'lib/kofficeui/KoRuler.cpp')
-rw-r--r-- | lib/kofficeui/KoRuler.cpp | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/lib/kofficeui/KoRuler.cpp b/lib/kofficeui/KoRuler.cpp index e0ced4662..8e936874b 100644 --- a/lib/kofficeui/KoRuler.cpp +++ b/lib/kofficeui/KoRuler.cpp @@ -26,10 +26,10 @@ #include <kglobalsettings.h> #include <kdebug.h> #include <kiconloader.h> -#include <qcursor.h> -#include <qpainter.h> -#include <qpopupmenu.h> -#include <qtooltip.h> +#include <tqcursor.h> +#include <tqpainter.h> +#include <tqpopupmenu.h> +#include <tqtooltip.h> #include <KoPageLayout.h> class KoRulerPrivate { @@ -38,13 +38,13 @@ public: } ~KoRulerPrivate() {} - QWidget *canvas; + TQWidget *canvas; int flags; int oldMx, oldMy; bool whileMovingBorderLeft, whileMovingBorderRight; bool whileMovingBorderTop, whileMovingBorderBottom; - QPixmap pmFirst, pmLeft; - KoPageLayout layout; + TQPixmap pmFirst, pmLeft; + KoPageLayout tqlayout; KoTabChooser *tabChooser; KoTabulatorList tabList; // Do we have to remove a certain tab in the DC Event? @@ -53,7 +53,7 @@ public: KoTabulator currTab; // The action we're currently doing - basically only valid between press and release time KoRuler::Action action; - QPopupMenu *rb_menu; + TQPopupMenu *rb_menu; int mRemoveTab, mPageLayout; // menu item ids int frameEnd; double i_right; @@ -79,9 +79,9 @@ const int KoRuler::F_HELPLINES = 4; const int KoRuler::F_NORESIZE = 8; /*================================================================*/ -KoRuler::KoRuler( QWidget *_parent, QWidget *_canvas, Orientation _orientation, +KoRuler::KoRuler( TQWidget *_parent, TQWidget *_canvas, Qt::Orientation _orientation, const KoPageLayout& _layout, int _flags, KoUnit::Unit _unit, KoTabChooser *_tabChooser ) - : QFrame( _parent ), buffer( width(), height() ), m_zoom(1.0), m_1_zoom(1.0), + : TQFrame( _parent ), buffer( width(), height() ), m_zoom(1.0), m_1_zoom(1.0), m_unit( _unit ) { setWFlags( WResizeNoErase | WRepaintNoErase ); @@ -93,7 +93,7 @@ KoRuler::KoRuler( QWidget *_parent, QWidget *_canvas, Orientation _orientation, d->canvas = _canvas; orientation = _orientation; - d->layout = _layout; + d->tqlayout = _layout; d->flags = _flags; d->m_bReadWrite=true; @@ -125,18 +125,18 @@ KoRuler::KoRuler( QWidget *_parent, QWidget *_canvas, Orientation _orientation, d->removeTab.type = T_INVALID; if ( orientation == Qt::Horizontal ) { - frameStart = qRound( zoomIt(d->layout.ptLeft) ); - d->frameEnd = qRound( zoomIt(d->layout.ptWidth - d->layout.ptRight) ); + frameStart = tqRound( zoomIt(d->tqlayout.ptLeft) ); + d->frameEnd = tqRound( zoomIt(d->tqlayout.ptWidth - d->tqlayout.ptRight) ); } else { - frameStart = qRound( zoomIt(d->layout.ptTop) ); - d->frameEnd = qRound( zoomIt(d->layout.ptHeight - d->layout.ptBottom) ); + frameStart = tqRound( zoomIt(d->tqlayout.ptTop) ); + d->frameEnd = tqRound( zoomIt(d->tqlayout.ptHeight - d->tqlayout.ptBottom) ); } m_bFrameStartSet = false; setupMenu(); // For compatibility, emitting doubleClicked shall emit openPageLayoutDia - connect( this, SIGNAL( doubleClicked() ), this, SIGNAL( openPageLayoutDia() ) ); + connect( this, TQT_SIGNAL( doubleClicked() ), this, TQT_SIGNAL( openPageLayoutDia() ) ); } /*================================================================*/ @@ -156,8 +156,8 @@ void KoRuler::setMousePos( int mx, int my ) { if ( !showMPos || ( mx == mposX && my == mposY ) ) return; - QPainter p( this ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( this ); + p.setRasterOp( TQt::NotROP ); if ( orientation == Qt::Horizontal ) { if ( hasToDelete ) @@ -201,23 +201,23 @@ double KoRuler::lineDistance() const } /*================================================================*/ -void KoRuler::drawHorizontal( QPainter *_painter ) +void KoRuler::drawHorizontal( TQPainter *_painter ) { - QFont font = KGlobalSettings::toolBarFont(); - QFontMetrics fm( font ); - resize( width(), QMAX( fm.height() + 4, 20 ) ); + TQFont font = KGlobalSettings::toolBarFont(); + TQFontMetrics fm( font ); + resize( width(), TQMAX( fm.height() + 4, 20 ) ); // Use a double-buffer pixmap - QPainter p( &buffer ); - p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( QColorGroup::Background ) ) ); + TQPainter p( &buffer ); + p.fillRect( 0, 0, width(), height(), TQBrush( tqcolorGroup().brush( TQColorGroup::Background ) ) ); - int totalw = qRound( zoomIt(d->layout.ptWidth) ); - QString str; + int totalw = tqRound( zoomIt(d->tqlayout.ptWidth) ); + TQString str; - p.setBrush( colorGroup().brush( QColorGroup::Base ) ); + p.setBrush( tqcolorGroup().brush( TQColorGroup::Base ) ); // Draw white rect - QRect r; + TQRect r; if ( !d->whileMovingBorderLeft ) r.setLeft( -diffx + frameStart ); else @@ -237,9 +237,9 @@ void KoRuler::drawHorizontal( QPainter *_painter ) int maxwidth = 0; for ( double i = 0.0;i <= (double)totalw;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - maxwidth = QMAX( maxwidth, textwidth ); + maxwidth = TQMAX( maxwidth, textwidth ); } // Make sure that the ruler stays readable at lower zoom levels @@ -248,11 +248,11 @@ void KoRuler::drawHorizontal( QPainter *_painter ) } for ( double i = 0.0;i <= (double)totalw;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - maxwidth = QMAX( maxwidth, textwidth ); - p.drawText( qRound(i) - diffx - qRound(textwidth * 0.5), - qRound(( height() - fm.height() ) * 0.5), + maxwidth = TQMAX( maxwidth, textwidth ); + p.drawText( tqRound(i) - diffx - tqRound(textwidth * 0.5), + tqRound(( height() - fm.height() ) * 0.5), textwidth, height(), AlignLeft | AlignTop, str ); } @@ -261,7 +261,7 @@ void KoRuler::drawHorizontal( QPainter *_painter ) if ( dist > maxwidth + 2 ) { for ( double i = dist * 0.5;i <= (double)totalw;i += dist ) { - int ii=qRound(i); + int ii=tqRound(i); p.drawLine( ii - diffx, 7, ii - diffx, height() - 7 ); } } @@ -271,7 +271,7 @@ void KoRuler::drawHorizontal( QPainter *_painter ) if ( dist * 0.5 > maxwidth + 2 ) { for ( double i = dist * 0.25;i <= (double)totalw;i += dist * 0.5 ) { - int ii=qRound(i); + int ii=tqRound(i); p.drawLine( ii - diffx, 9, ii - diffx, height() - 9 ); } } @@ -279,13 +279,13 @@ void KoRuler::drawHorizontal( QPainter *_painter ) // Draw ending bar (at page width) //int constant=zoomIt(1); //p.drawLine( totalw - diffx + constant, 1, totalw - diffx + constant, height() - 1 ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( tqcolorGroup().color( TQColorGroup::Base ) ); //p.drawLine( totalw - diffx, 1, totalw - diffx, height() - 1 ); // Draw starting bar (at 0) - //p.setPen( colorGroup().color( QColorGroup::Text ) ); + //p.setPen( tqcolorGroup().color( TQColorGroup::Text ) ); //p.drawLine( -diffx, 1, -diffx, height() - 1 ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( tqcolorGroup().color( TQColorGroup::Base ) ); //p.drawLine( -diffx - constant, 1, -diffx - constant, height() - 1 ); // Draw the indents triangles @@ -294,20 +294,20 @@ void KoRuler::drawHorizontal( QPainter *_painter ) double halfPixmapWidth = d->pmFirst.width() * 0.5; // Cumulate i_first with correct indent double firstLineIdent = i_first + ( d->rtl ? d->i_right : i_left ); - p.drawPixmap( qRound( static_cast<double>(r.left()) + applyRtlAndZoom( firstLineIdent ) - halfPixmapWidth ), + p.drawPixmap( tqRound( static_cast<double>(r.left()) + applyRtlAndZoom( firstLineIdent ) - halfPixmapWidth ), top, d->pmFirst ); int bottom = height() - d->pmLeft.height() - 1; halfPixmapWidth = d->pmLeft.width() * 0.5; - p.drawPixmap( qRound( static_cast<double>(r.left()) + zoomIt(i_left) - halfPixmapWidth ), + p.drawPixmap( tqRound( static_cast<double>(r.left()) + zoomIt(i_left) - halfPixmapWidth ), bottom, d->pmLeft ); - p.drawPixmap( qRound( static_cast<double>(r.right()) - zoomIt(d->i_right) - halfPixmapWidth ), + p.drawPixmap( tqRound( static_cast<double>(r.right()) - zoomIt(d->i_right) - halfPixmapWidth ), bottom, d->pmLeft ); } // Show the mouse position if ( d->action == A_NONE && showMPos ) { - p.setPen( colorGroup().color( QColorGroup::Text ) ); + p.setPen( tqcolorGroup().color( TQColorGroup::Text ) ); p.drawLine( mposX, 1, mposX, height() - 1 ); } hasToDelete = false; @@ -321,11 +321,11 @@ void KoRuler::drawHorizontal( QPainter *_painter ) } /*================================================================*/ -void KoRuler::drawTabs( QPainter &_painter ) +void KoRuler::drawTabs( TQPainter &_painter ) { int ptPos = 0; - _painter.setPen( QPen( colorGroup().color( QColorGroup::Text ), 2, SolidLine ) ); + _painter.setPen( TQPen( tqcolorGroup().color( TQColorGroup::Text ), 2, SolidLine ) ); // Check if we're in a mousemove event, removing a tab. // In that case, we'll have to skip drawing that one. bool willRemove = d->mousePressed && willRemoveTab( d->oldMy ) && d->currTab.type != T_INVALID; @@ -334,7 +334,7 @@ void KoRuler::drawTabs( QPainter &_painter ) for ( ; it != d->tabList.end() ; it++ ) { if ( willRemove && equals( d->currTab.ptPos, (*it).ptPos ) ) continue; - ptPos = qRound(applyRtlAndZoom((*it).ptPos)) - diffx + frameStart; + ptPos = tqRound(applyRtlAndZoom((*it).ptPos)) - diffx + frameStart; switch ( (*it).type ) { case T_LEFT: { ptPos -= 4; @@ -356,7 +356,7 @@ void KoRuler::drawTabs( QPainter &_painter ) _painter.drawLine( ptPos + 4, height() - 4, ptPos + 20 - 4, height() - 4 ); _painter.drawLine( ptPos + 20 / 2, 4, ptPos + 20 / 2, height() - 4 ); _painter.fillRect( ptPos + 20 / 2 + 2, height() - 9, 3, 3, - colorGroup().color( QColorGroup::Text ) ); + tqcolorGroup().color( TQColorGroup::Text ) ); } break; default: break; } @@ -364,28 +364,28 @@ void KoRuler::drawTabs( QPainter &_painter ) } /*================================================================*/ -void KoRuler::drawVertical( QPainter *_painter ) +void KoRuler::drawVertical( TQPainter *_painter ) { - QFont font = KGlobalSettings::toolBarFont(); - QFontMetrics fm( font ); - resize( QMAX( fm.height() + 4, 20 ), height() ); + TQFont font = KGlobalSettings::toolBarFont(); + TQFontMetrics fm( font ); + resize( TQMAX( fm.height() + 4, 20 ), height() ); - QPainter p( &buffer ); - p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( QColorGroup::Background ) ) ); + TQPainter p( &buffer ); + p.fillRect( 0, 0, width(), height(), TQBrush( tqcolorGroup().brush( TQColorGroup::Background ) ) ); - int totalh = qRound( zoomIt(d->layout.ptHeight) ); + int totalh = tqRound( zoomIt(d->tqlayout.ptHeight) ); // Clip rect - this gives basically always a rect like (2,2,width-2,height-2) - QRect paintRect = _painter->clipRegion( QPainter::CoordPainter ).boundingRect(); + TQRect paintRect = _painter->clipRegion( TQPainter::CoordPainter ).boundingRect(); // Ruler rect - QRect rulerRect( 0, -diffy, width(), totalh ); + TQRect rulerRect( 0, -diffy, width(), totalh ); if ( paintRect.intersects( rulerRect ) ) { - QString str; + TQString str; - p.setBrush( colorGroup().brush( QColorGroup::Base ) ); + p.setBrush( tqcolorGroup().brush( TQColorGroup::Base ) ); // Draw white rect - QRect r; + TQRect r; if ( !d->whileMovingBorderTop ) r.setTop( -diffy + frameStart ); else @@ -405,9 +405,9 @@ void KoRuler::drawVertical( QPainter *_painter ) int maxheight = 0; for ( double i = 0.0;i <= (double)totalh;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - maxheight = QMAX( maxheight, textwidth ); + maxheight = TQMAX( maxheight, textwidth ); } // Make sure that the ruler stays readable at lower zoom levels @@ -416,15 +416,15 @@ void KoRuler::drawVertical( QPainter *_painter ) } for ( double i = 0.0;i <= (double)totalh;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - int yOffset = qRound(i) - diffy + qRound(textwidth * 0.5); + int yOffset = tqRound(i) - diffy + tqRound(textwidth * 0.5); if(yOffset > paintRect.bottom()) break; // stop drawing when outside the to-paint-region int textheight = fm.height(); - maxheight = QMAX( maxheight, textwidth ); + maxheight = TQMAX( maxheight, textwidth ); p.save(); - p.translate( qRound(( width() - textheight ) * 0.5), yOffset); + p.translate( tqRound(( width() - textheight ) * 0.5), yOffset); p.rotate( -90 ); p.drawText( 0, 0, textwidth + 1, textheight, AlignLeft | AlignTop, str ); p.restore(); @@ -434,7 +434,7 @@ void KoRuler::drawVertical( QPainter *_painter ) if ( dist > maxheight + 2 ) { for ( double i = dist * 0.5;i <= (double)totalh;i += dist ) { - int ii=qRound(i) - diffy; + int ii=tqRound(i) - diffy; if(ii > paintRect.bottom()) break; // stop drawing when outside the to-paint-region p.drawLine( 7, ii, width() - 7, ii); @@ -445,7 +445,7 @@ void KoRuler::drawVertical( QPainter *_painter ) if ( dist * 0.5 > maxheight + 2 ) { for ( double i = dist * 0.25;i <=(double)totalh;i += dist *0.5 ) { - int ii=qRound(i) - diffy; + int ii=tqRound(i) - diffy; if(ii > paintRect.bottom()) break; // stop drawing when outside the to-paint-region p.drawLine( 9, ii, width() - 9, ii); @@ -454,19 +454,19 @@ void KoRuler::drawVertical( QPainter *_painter ) // Draw ending bar (at page height) //p.drawLine( 1, totalh - diffy + 1, width() - 1, totalh - diffy + 1 ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( tqcolorGroup().color( TQColorGroup::Base ) ); //p.drawLine( 1, totalh - diffy, width() - 1, totalh - diffy ); // Draw starting bar (at 0) - //p.setPen( colorGroup().color( QColorGroup::Text ) ); + //p.setPen( tqcolorGroup().color( TQColorGroup::Text ) ); //p.drawLine( 1, -diffy, width() - 1, -diffy ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( tqcolorGroup().color( TQColorGroup::Base ) ); //p.drawLine( 1, -diffy - 1, width() - 1, -diffy - 1 ); } // Show the mouse position if ( d->action == A_NONE && showMPos ) { - p.setPen( colorGroup().color( QColorGroup::Text ) ); + p.setPen( tqcolorGroup().color( TQColorGroup::Text ) ); p.drawLine( 1, mposY, width() - 1, mposY ); } hasToDelete = false; @@ -475,7 +475,7 @@ void KoRuler::drawVertical( QPainter *_painter ) _painter->drawPixmap( 0, 0, buffer ); } -void KoRuler::mousePressEvent( QMouseEvent *e ) +void KoRuler::mousePressEvent( TQMouseEvent *e ) { if( !d->m_bReadWrite) return; @@ -486,20 +486,20 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) d->removeTab.type = T_INVALID; switch ( e->button() ) { - case RightButton: + case Qt::RightButton: if(d->currTab.type == T_INVALID || !(d->flags & F_TABS)) d->rb_menu->setItemEnabled(d->mRemoveTab, false); else d->rb_menu->setItemEnabled(d->mRemoveTab, true); - d->rb_menu->popup( QCursor::pos() ); + d->rb_menu->popup( TQCursor::pos() ); d->action = A_NONE; d->mousePressed = false; return; - case MidButton: + case Qt::MidButton: // MMB shall do like double-click (it opens a dialog). handleDoubleClick(); return; - case LeftButton: + case Qt::LeftButton: if ( d->action == A_BR_RIGHT || d->action == A_BR_LEFT ) { if ( d->action == A_BR_RIGHT ) d->whileMovingBorderRight = true; @@ -516,8 +516,8 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) d->whileMovingBorderBottom = true; if ( d->canvas ) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.end(); } @@ -527,7 +527,7 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) drawLine(d->oldMx, -1); } else if ( d->action == A_TAB ) { if ( d->canvas && d->currTab.type != T_INVALID ) { - drawLine( qRound( applyRtlAndZoom(d->currTab.ptPos) ) + frameStart - diffx, -1 ); + drawLine( tqRound( applyRtlAndZoom(d->currTab.ptPos) ) + frameStart - diffx, -1 ); } } else if ( d->tabChooser && ( d->flags & F_TABS ) && d->tabChooser->getCurrTabType() != 0 ) { int left = frameStart - diffx; @@ -572,7 +572,7 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) else if ( d->flags & F_HELPLINES ) { setCursor( orientation == Qt::Horizontal ? - Qt::sizeVerCursor : Qt::sizeHorCursor ); + TQt::sizeVerCursor : TQt::sizeHorCursor ); d->action = A_HELPLINES; } default: @@ -580,7 +580,7 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) } } -void KoRuler::mouseReleaseEvent( QMouseEvent *e ) +void KoRuler::mouseReleaseEvent( TQMouseEvent *e ) { d->mousePressed = false; @@ -598,19 +598,19 @@ void KoRuler::mouseReleaseEvent( QMouseEvent *e ) if ( d->canvas ) drawLine(d->oldMx, -1); update(); - emit newPageLayout( d->layout ); + emit newPageLayout( d->tqlayout ); } else if ( d->action == A_BR_TOP || d->action == A_BR_BOTTOM ) { d->whileMovingBorderTop = false; d->whileMovingBorderBottom = false; if ( d->canvas ) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.end(); } update(); - emit newPageLayout( d->layout ); + emit newPageLayout( d->tqlayout ); } else if ( d->action == A_FIRST_INDENT ) { if ( d->canvas ) drawLine(d->oldMx, -1); @@ -628,7 +628,7 @@ void KoRuler::mouseReleaseEvent( QMouseEvent *e ) emit newRightIndent( d->i_right ); } else if ( d->action == A_TAB ) { if ( d->canvas && !fakeMovement ) { - drawLine( qRound( applyRtlAndZoom( d->currTab.ptPos ) ) + frameStart - diffx, -1); + drawLine( tqRound( applyRtlAndZoom( d->currTab.ptPos ) ) + frameStart - diffx, -1); } if ( willRemoveTab( e->y() ) ) { @@ -662,29 +662,29 @@ void KoRuler::mouseReleaseEvent( QMouseEvent *e ) d->currTab.type = T_INVALID; // added (DF) } -void KoRuler::mouseMoveEvent( QMouseEvent *e ) +void KoRuler::mouseMoveEvent( TQMouseEvent *e ) { hasToDelete = false; int pw = d->frameEnd - frameStart; - int ph = qRound(zoomIt(d->layout.ptHeight)); + int ph = tqRound(zoomIt(d->tqlayout.ptHeight)); int left = frameStart - diffx; - int top = qRound(zoomIt(d->layout.ptTop)); + int top = tqRound(zoomIt(d->tqlayout.ptTop)); top -= diffy; int right = d->frameEnd - diffx; - int bottom = qRound(zoomIt(d->layout.ptBottom)); + int bottom = tqRound(zoomIt(d->tqlayout.ptBottom)); bottom = ph - bottom - diffy; // Cumulate first-line-indent - int ip_first = qRound( zoomIt( i_first + ( d->rtl ? d->i_right : i_left) ) ); - int ip_left = qRound(zoomIt(i_left)); - int ip_right = qRound(zoomIt(d->i_right)); + int ip_first = tqRound( zoomIt( i_first + ( d->rtl ? d->i_right : i_left) ) ); + int ip_left = tqRound(zoomIt(i_left)); + int ip_right = tqRound(zoomIt(d->i_right)); int mx = e->x(); mx = mx+diffx < 0 ? 0 : mx; int my = e->y(); my = my+diffy < 0 ? 0 : my; - QToolTip::remove( this); + TQToolTip::remove( this); switch ( orientation ) { case Qt::Horizontal: { if ( !d->mousePressed ) { @@ -693,21 +693,21 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) /////// ###### // At the moment, moving the left and right border indicators // is disabled when setFrameStartEnd has been called (i.e. in KWord) - // Changing the layout margins directly from it would be utterly wrong + // Changing the tqlayout margins directly from it would be utterly wrong // (just try the 2-columns modes...). What needs to be done is: // emitting a signal frameResized in mouseReleaseEvent, when a left/right // border has been moved, and in kword we need to update the margins from // there, if the left border of the 1st column or the right border of the // last column was moved... and find what to do with the other borders. - // And for normal frames, resize the frame without touching the page layout. + // And for normal frames, resize the frame without touching the page tqlayout. // All that is too much for now -> disabling. if ( !m_bFrameStartSet ) { if ( mx > left - 5 && mx < left + 5 ) { - setCursor( Qt::sizeHorCursor ); + setCursor( TQt::sizeHorCursor ); d->action = A_BR_LEFT; } else if ( mx > right - 5 && mx < right + 5 ) { - setCursor( Qt::sizeHorCursor ); + setCursor( TQt::sizeHorCursor ); d->action = A_BR_RIGHT; } } @@ -715,17 +715,17 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) int firstX = d->rtl ? right - ip_first : left + ip_first; if ( mx > firstX - 5 && mx < firstX + 5 && my >= 2 && my <= d->pmFirst.size().height() + 2 ) { - QToolTip::add( this, i18n("First line indent") ); + TQToolTip::add( this, i18n("First line indent") ); setCursor( ArrowCursor ); d->action = A_FIRST_INDENT; } else if ( mx > left + ip_left - 5 && mx < left + ip_left + 5 && my >= height() - d->pmLeft.size().height() - 2 && my <= height() - 2 ) { - QToolTip::add( this, i18n("Left indent") ); + TQToolTip::add( this, i18n("Left indent") ); setCursor( ArrowCursor ); d->action = A_LEFT_INDENT; } else if ( mx > right - ip_right - 5 && mx < right - ip_right + 5 && my >= height() - d->pmLeft.size().height() - 2 && my <= height() - 2 ) { - QToolTip::add( this, i18n("Right indent") ); + TQToolTip::add( this, i18n("Right indent") ); setCursor( ArrowCursor ); d->action = A_RIGHT_INDENT; } @@ -737,7 +737,7 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) int newPos=mx; if( newPos!=right && gridSize!=0.0 && (e->state() & ShiftButton)==0) { // apply grid. double grid=zoomIt(gridSize * 16); - newPos=qRound( ((newPos * 16 / grid) * grid) / 16 ); + newPos=tqRound( ((newPos * 16 / grid) * grid) / 16 ); } if(newPos-left < 0) newPos=left; else if (right-newPos < 0) newPos=right; @@ -747,7 +747,7 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) case A_BR_LEFT: { if ( d->canvas && mx < right-10 && mx+diffx-2 > 0) { drawLine( d->oldMx, mx ); - d->layout.ptLeft = unZoomIt(static_cast<double>(mx + diffx)); + d->tqlayout.ptLeft = unZoomIt(static_cast<double>(mx + diffx)); if( ip_left > right-left-15 ) { ip_left=right-left-15; ip_left=ip_left<0 ? 0 : ip_left; @@ -770,7 +770,7 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) case A_BR_RIGHT: { if ( d->canvas && mx > left+10 && mx+diffx <= pw-2) { drawLine( d->oldMx, mx ); - d->layout.ptRight = unZoomIt(static_cast<double>(pw - ( mx + diffx ))); + d->tqlayout.ptRight = unZoomIt(static_cast<double>(pw - ( mx + diffx ))); if( ip_left > right-left-15 ) { ip_left=right-left-15; ip_left=ip_left<0 ? 0 : ip_left; @@ -830,8 +830,8 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) if ( d->canvas) { if (d->rtl) newValue = unZoomIt(pw) - newValue; if(newValue == d->currTab.ptPos) break; // no change - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); // prevent 1st drawLine when we just created a new tab // (it's a NOT line) double pt; @@ -839,18 +839,18 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) if( d->currTab != d->removeTab ) { pt = applyRtlAndZoom(d->currTab.ptPos); - pt_fr = qRound(pt) + frameStart - diffx; + pt_fr = tqRound(pt) + frameStart - diffx; p.drawLine( pt_fr, 0, pt_fr, d->canvas->height() ); } - KoTabulatorList::Iterator it = d->tabList.find( d->currTab ); + KoTabulatorList::Iterator it = d->tabList.tqfind( d->currTab ); Q_ASSERT( it != d->tabList.end() ); if ( it != d->tabList.end() ) (*it).ptPos = newValue; d->currTab.ptPos = newValue; pt = applyRtlAndZoom( newValue ); - pt_fr = qRound(pt) + frameStart - diffx; + pt_fr = tqRound(pt) + frameStart - diffx; p.drawLine( pt_fr, 0, pt_fr, d->canvas->height() ); p.end(); @@ -878,24 +878,24 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) if ( d->flags & F_NORESIZE ) break; if ( my > top - 5 && my < top + 5 ) { - QToolTip::add( this, i18n("Top margin") ); - setCursor( Qt::sizeVerCursor ); + TQToolTip::add( this, i18n("Top margin") ); + setCursor( TQt::sizeVerCursor ); d->action = A_BR_TOP; } else if ( my > bottom - 5 && my < bottom + 5 ) { - QToolTip::add( this, i18n("Bottom margin") ); - setCursor( Qt::sizeVerCursor ); + TQToolTip::add( this, i18n("Bottom margin") ); + setCursor( TQt::sizeVerCursor ); d->action = A_BR_BOTTOM; } } else { switch ( d->action ) { case A_BR_TOP: { if ( d->canvas && my < bottom-20 && my+diffy-2 > 0) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.drawLine( 0, my, d->canvas->width(), my ); p.end(); - d->layout.ptTop = unZoomIt(static_cast<double>(my + diffy)); + d->tqlayout.ptTop = unZoomIt(static_cast<double>(my + diffy)); d->oldMx = mx; d->oldMy = my; update(); @@ -905,12 +905,12 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) } break; case A_BR_BOTTOM: { if ( d->canvas && my > top+20 && my+diffy < ph-2) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.drawLine( 0, my, d->canvas->width(), my ); p.end(); - d->layout.ptBottom = unZoomIt(static_cast<double>(ph - ( my + diffy ))); + d->tqlayout.ptBottom = unZoomIt(static_cast<double>(ph - ( my + diffy ))); d->oldMx = mx; d->oldMy = my; update(); @@ -934,13 +934,13 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) d->oldMy = my; } -void KoRuler::resizeEvent( QResizeEvent *e ) +void KoRuler::resizeEvent( TQResizeEvent *e ) { - QFrame::resizeEvent( e ); + TQFrame::resizeEvent( e ); buffer.resize( size() ); } -void KoRuler::mouseDoubleClickEvent( QMouseEvent* ) +void KoRuler::mouseDoubleClickEvent( TQMouseEvent* ) { handleDoubleClick(); } @@ -984,7 +984,7 @@ void KoRuler::handleDoubleClick() // Double-clicked nothing d->action = A_NONE; - emit doubleClicked(); // usually page layout dialog + emit doubleClicked(); // usually page tqlayout dialog } void KoRuler::setTabList( const KoTabulatorList & _tabList ) @@ -1005,7 +1005,7 @@ double KoRuler::makeIntern( double _v ) void KoRuler::setupMenu() { - d->rb_menu = new QPopupMenu(); + d->rb_menu = new TQPopupMenu(); Q_CHECK_PTR( d->rb_menu ); for ( uint i = 0 ; i <= KoUnit::U_LASTUNIT ; ++i ) { @@ -1014,12 +1014,12 @@ void KoRuler::setupMenu() if ( m_unit == unit ) d->rb_menu->setItemChecked( i, true ); } - connect( d->rb_menu, SIGNAL( activated( int ) ), SLOT( slotMenuActivated( int ) ) ); + connect( d->rb_menu, TQT_SIGNAL( activated( int ) ), TQT_SLOT( slotMenuActivated( int ) ) ); d->rb_menu->insertSeparator(); - d->mPageLayout=d->rb_menu->insertItem(i18n("Page Layout..."), this, SLOT(pageLayoutDia())); + d->mPageLayout=d->rb_menu->insertItem(i18n("Page Layout..."), this, TQT_SLOT(pageLayoutDia())); d->rb_menu->insertSeparator(); - d->mRemoveTab=d->rb_menu->insertItem(i18n("Remove Tabulator"), this, SLOT(rbRemoveTab())); + d->mRemoveTab=d->rb_menu->insertItem(i18n("Remove Tabulator"), this, TQT_SLOT(rbRemoveTab())); d->rb_menu->setItemEnabled( d->mRemoveTab, false ); } @@ -1029,7 +1029,7 @@ void KoRuler::uncheckMenu() d->rb_menu->setItemChecked( i, false ); } -void KoRuler::setUnit( const QString& _unit ) +void KoRuler::setUnit( const TQString& _unit ) { setUnit( KoUnit::unit( _unit ) ); } @@ -1077,9 +1077,9 @@ void KoRuler::searchTab(int mx) { d->currTab.type = T_INVALID; KoTabulatorList::ConstIterator it = d->tabList.begin(); for ( ; it != d->tabList.end() ; ++it ) { - pos = qRound(applyRtlAndZoom((*it).ptPos)) - diffx + frameStart; + pos = tqRound(applyRtlAndZoom((*it).ptPos)) - diffx + frameStart; if ( mx > pos - 5 && mx < pos + 5 ) { - setCursor( Qt::sizeHorCursor ); + setCursor( TQt::sizeHorCursor ); d->action = A_TAB; d->currTab = *it; break; @@ -1089,8 +1089,8 @@ void KoRuler::searchTab(int mx) { void KoRuler::drawLine(int oldX, int newX) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( oldX, 0, oldX, d->canvas->height() ); if(newX!=-1) p.drawLine( newX, 0, newX, d->canvas->height() ); @@ -1176,26 +1176,26 @@ void KoRuler::slotMenuActivated( int i ) } } -QSize KoRuler::minimumSizeHint() const +TQSize KoRuler::tqminimumSizeHint() const { - QSize size; - QFont font = KGlobalSettings::toolBarFont(); - QFontMetrics fm( font ); + TQSize size; + TQFont font = KGlobalSettings::toolBarFont(); + TQFontMetrics fm( font ); - size.setWidth( QMAX( fm.height() + 4, 20 ) ); - size.setHeight( QMAX( fm.height() + 4, 20 ) ); + size.setWidth( TQMAX( fm.height() + 4, 20 ) ); + size.setHeight( TQMAX( fm.height() + 4, 20 ) ); return size; } -QSize KoRuler::sizeHint() const +TQSize KoRuler::tqsizeHint() const { - return minimumSizeHint(); + return tqminimumSizeHint(); } void KoRuler::setPageLayout( const KoPageLayout& _layout ) { - d->layout = _layout; + d->tqlayout = _layout; update(); } |