diff options
Diffstat (limited to 'kugar/kudesigner_lib/view.cpp')
-rw-r--r-- | kugar/kudesigner_lib/view.cpp | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/kugar/kudesigner_lib/view.cpp b/kugar/kudesigner_lib/view.cpp index b2684ee1..a74bbd61 100644 --- a/kugar/kudesigner_lib/view.cpp +++ b/kugar/kudesigner_lib/view.cpp @@ -20,17 +20,17 @@ #include <math.h> -#include <qwmatrix.h> -#include <qevent.h> -#include <qpoint.h> -#include <qcanvas.h> -#include <qaction.h> -#include <qcursor.h> -#include <qpainter.h> -#include <qbitmap.h> -#include <qimage.h> - -#include <qprinter.h> +#include <tqwmatrix.h> +#include <tqevent.h> +#include <tqpoint.h> +#include <tqcanvas.h> +#include <tqaction.h> +#include <tqcursor.h> +#include <tqpainter.h> +#include <tqbitmap.h> +#include <tqimage.h> + +#include <tqprinter.h> #include <kdebug.h> #include <koproperty/property.h> @@ -54,47 +54,47 @@ namespace Kudesigner { -void SelectionRect::draw( QPainter & painter ) +void SelectionRect::draw( TQPainter & painter ) { - // painter.setPen(Qt::NoPen); + // painter.setPen(TQt::NoPen); - /* QPrinter pr; + /* TQPrinter pr; if ( pr.setup() ) { - QPainter p(&pr); + TQPainter p(&pr); m_canvas->drawArea( m_canvas->rect(), &p ); } */ /* kdDebug(31000) << "creating pixmap" << endl; - QPixmap mp(rect().size()); + TQPixmap mp(rect().size()); kdDebug(31000) << "creating painter" << endl; - QPainter p(&mp); + TQPainter p(&mp); kdDebug(31000) << "filling pixmap" << endl; m_canvas->drawArea(m_canvas->rect(), &p); kdDebug(31000) << "converting to image" << endl; - QImage im = mp.convertToImage(); + TQImage im = mp.convertToImage(); if (!im.isNull()) { kdDebug(31000) << "do dither" << endl; - mp.convertFromImage(im, Qt::OrderedAlphaDither); + mp.convertFromImage(im, TQt::OrderedAlphaDither); kdDebug(31000) << "creating brush" << endl; - QBrush br(KGlobalSettings::highlightColor(),Qt::CustomPattern); + TQBrush br(KGlobalSettings::highlightColor(),TQt::CustomPattern); br.setPixmap(mp); painter.setBrush(br); } kdDebug(31000) << "drawing" << endl;*/ // painter.drawRect(rect()); - QPen pen( QColor( 0, 0, 0 ), 0, Qt::DotLine ); + TQPen pen( TQColor( 0, 0, 0 ), 0, TQt::DotLine ); painter.setPen( pen ); - painter.setBrush( QBrush( NoBrush ) ); + painter.setBrush( TQBrush( NoBrush ) ); painter.drawRect( rect() ); - // QCanvasRectangle::draw(painter); + // TQCanvasRectangle::draw(painter); } -View::View( Canvas *canvas, QWidget *parent, const char *name, WFlags f ) : - QCanvasView( canvas, parent, name, f ), selectionBuf( 0 ), m_plugin( 0 ), m_canvas( canvas ) +View::View( Canvas *canvas, TQWidget *tqparent, const char *name, WFlags f ) : + TQCanvasView( canvas, tqparent, name, f ), selectionBuf( 0 ), m_plugin( 0 ), m_canvas( canvas ) { itemToInsert = 0; moving = 0; @@ -104,12 +104,12 @@ View::View( Canvas *canvas, QWidget *parent, const char *name, WFlags f ) : selectionRect = new SelectionRect( 0, 0, 0, 0, canvas ); - connect( m_canvas, SIGNAL( itemSelected() ), this, SLOT( selectItem() ) ); + connect( m_canvas, TQT_SIGNAL( itemSelected() ), this, TQT_SLOT( selectItem() ) ); } -void View::deleteItem( QCanvasItemList &l ) +void View::deleteItem( TQCanvasItemList &l ) { - for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) + for ( TQCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) { m_canvas->unselectItem( static_cast<Kudesigner::Box*>( *it ) ); if ( m_canvas->kugarTemplate() ->removeReportItem( *it ) ) @@ -117,10 +117,10 @@ void View::deleteItem( QCanvasItemList &l ) } } -void View::editItem( QCanvasItemList & /* l */ ) +void View::editItem( TQCanvasItemList & /* l */ ) { //display editor for report items or sections - /* for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) + /* for (TQCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { if ((*it)->rtti() >= 1800) //for my own report items { @@ -141,15 +141,15 @@ void View::editItem( QCanvasItemList & /* l */ ) }*/ } -void View::selectItemFromList( QCanvasItemList &l ) +void View::selectItemFromList( TQCanvasItemList &l ) { //display editor for report items or sections - for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) + for ( TQCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) { if ( ( *it ) ->rtti() >= 1800 ) //include bands and the template itself { Kudesigner::Box * b = static_cast<Kudesigner::Box*>( *it ); - if ( !m_canvas->selected.contains( b ) ) + if ( !m_canvas->selected.tqcontains( b ) ) { m_canvas->unselectAll(); m_canvas->selectItem( b, false ); @@ -158,7 +158,7 @@ void View::selectItemFromList( QCanvasItemList &l ) // selected->drawHolders(); return ; } - if ( m_canvas->selected.contains( b ) ) + if ( m_canvas->selected.tqcontains( b ) ) { if ( m_canvas->selected.count() > 1 ) { @@ -175,9 +175,9 @@ void View::selectItemFromList( QCanvasItemList &l ) } -void View::placeItem( QCanvasItemList &l, QMouseEvent *e ) +void View::placeItem( TQCanvasItemList &l, TQMouseEvent *e ) { - for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) + for ( TQCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) { if ( ( ( *it ) ->rtti() > 1800 ) && ( ( ( *it ) ->rtti() < 2000 ) ) ) { @@ -197,7 +197,7 @@ void View::placeItem( QCanvasItemList &l, QMouseEvent *e ) } -bool View::startResizing( QMouseEvent * /*e*/, QPoint &p ) +bool View::startResizing( TQMouseEvent * /*e*/, TQPoint &p ) { if ( m_canvas->selected.count() == 0 ) return false; @@ -240,13 +240,13 @@ bool View::startResizing( QMouseEvent * /*e*/, QPoint &p ) else if ( cbx->rtti() >= Rtti_ReportHeader ) { - resizing_constraint = QRect( 0, 0, 1000, 1000 ); + resizing_constraint = TQRect( 0, 0, 1000, 1000 ); resizing_minSize.setWidth( 0 ); resizing_minSize.setHeight( static_cast<Band*>( cbx ) ->minHeight() ); } else { - resizing_constraint = QRect( 0, 0, 1000, 1000 ); + resizing_constraint = TQRect( 0, 0, 1000, 1000 ); resizing_minSize.setWidth( 0 ); resizing_minSize.setHeight( 10 ); } @@ -256,11 +256,11 @@ bool View::startResizing( QMouseEvent * /*e*/, QPoint &p ) return false; } -void View::startMoveOrResizeOrSelectItem( QCanvasItemList &l, - QMouseEvent * /*e*/, QPoint &p ) +void View::startMoveOrResizeOrSelectItem( TQCanvasItemList &l, + TQMouseEvent * /*e*/, TQPoint &p ) { //allow user to move any item except for page rectangle - for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) + for ( TQCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) { Kudesigner::Box *cb = static_cast<Kudesigner::Box*>( *it ); if ( cb->rtti() >= 1700 ) //> 2001) @@ -290,10 +290,10 @@ void View::startMoveOrResizeOrSelectItem( QCanvasItemList &l, // qWarning("3"); } -void View::contentsMousePressEvent( QMouseEvent* e ) +void View::contentsMousePressEvent( TQMouseEvent* e ) { - QPoint p = inverseWorldMatrix().QWMatrix::map( e->pos() ); - QCanvasItemList l = m_canvas->collisions( p ); + TQPoint p = inverseWorldMatrix().TQWMatrix::map( e->pos() ); + TQCanvasItemList l = m_canvas->collisions( p ); //if there is a request for properties or for delete operation //perform that and do not take care about mouse buttons @@ -328,7 +328,7 @@ void View::contentsMousePressEvent( QMouseEvent* e ) */ switch ( e->button() ) { - case LeftButton: + case Qt::LeftButton: if ( itemToInsert ) { // qWarning("placing item"); @@ -350,19 +350,19 @@ void View::contentsMousePressEvent( QMouseEvent* e ) } } -void View::contentsMouseReleaseEvent( QMouseEvent* e ) +void View::contentsMouseReleaseEvent( TQMouseEvent* e ) { selectionRect->setSize( 0, 0 ); selectionRect->setX( 0 ); selectionRect->setY( 0 ); selectionRect->hide(); - QPoint p = inverseWorldMatrix().QWMatrix::map( e->pos() ); - QCanvasItemList l = m_canvas->collisions( p ); + TQPoint p = inverseWorldMatrix().TQWMatrix::map( e->pos() ); + TQCanvasItemList l = m_canvas->collisions( p ); switch ( e->button() ) { - case LeftButton: + case Qt::LeftButton: if ( selectionStarted ) finishSelection(); break; @@ -425,7 +425,7 @@ void View::fixMaxValues( double &pos, double size, double maxv, double &offset ) } } -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN double rint( double x ) { if ( fabs( x - floor( x ) ) < fabs( x - ceil( x ) ) ) @@ -453,20 +453,20 @@ void View::stickDimToGrid( double x, double y, double &w, double &h ) h = ny - y; } -void View::contentsMouseMoveEvent( QMouseEvent* e ) +void View::contentsMouseMoveEvent( TQMouseEvent* e ) { - QPoint p = inverseWorldMatrix().map( e->pos() ); + TQPoint p = inverseWorldMatrix().map( e->pos() ); - /* QCanvasItemList l=m_canvas->collisions(p); - setCursor(QCursor(Qt::ArrowCursor)); + /* TQCanvasItemList l=m_canvas->collisions(p); + setCursor(TQCursor(TQt::ArrowCursor)); unsetCursor(); - for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) + for (TQCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { if ((*it)->rtti() > 2000) { CanvasReportItem *item = (CanvasReportItem*)(*it); - if (item->bottomRightResizableRect().contains(e->pos())) - setCursor(QCursor(Qt::SizeFDiagCursor)); + if (item->bottomRightResizableRect().tqcontains(e->pos())) + setCursor(TQCursor(TQt::SizeFDiagCursor)); } }*/ @@ -474,10 +474,10 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) { double newXPos = moving->x() + p.x() - moving_start.x(); double newYPos = moving->y() + p.y() - moving_start.y(); - fixMinValues( newYPos, moving->parentSection->y(), moving_offsetY ); - fixMinValues( newXPos, moving->parentSection->x(), moving_offsetX ); - fixMaxValues( newYPos, moving->height(), moving->parentSection->y() + moving->parentSection->height(), moving_offsetY ); - fixMaxValues( newXPos, moving->width(), moving->parentSection->x() + moving->parentSection->width(), moving_offsetX ); + fixMinValues( newYPos, moving->tqparentSection->y(), moving_offsetY ); + fixMinValues( newXPos, moving->tqparentSection->x(), moving_offsetX ); + fixMaxValues( newYPos, moving->height(), moving->tqparentSection->y() + moving->tqparentSection->height(), moving_offsetY ); + fixMaxValues( newXPos, moving->width(), moving->tqparentSection->x() + moving->tqparentSection->width(), moving_offsetX ); double sx = newXPos; double sy = newYPos; @@ -487,7 +487,7 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) moving->move( newXPos, newYPos ); /* attempt to prevent item collisions - QCanvasItemList l=m_canvas->collisions(moving->rect()); + TQCanvasItemList l=m_canvas->collisions(moving->rect()); if (l.count() > 2) { moving->moveBy(-(p.x() - moving_start.x()), @@ -496,14 +496,14 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) return; }*/ // moving_start = p; - moving_start = QPoint( p.x() + ( int ) ( newXPos - sx ), p.y() + ( int ) ( newYPos - sy ) ); + moving_start = TQPoint( p.x() + ( int ) ( newXPos - sx ), p.y() + ( int ) ( newYPos - sy ) ); moving->updateGeomProps(); m_canvas->update(); emit modificationPerformed(); } if ( resizing ) { - QCanvasRectangle * r = ( QCanvasRectangle * ) resizing; + TQCanvasRectangle * r = ( TQCanvasRectangle * ) resizing; double newXPos = r->x(); double newYPos = r->y(); double h = r->height(); @@ -561,7 +561,7 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) int dx = ( int ) ( newXPos - sx ); int dy = ( int ) ( newYPos - sy ); - // moving_start = QPoint(p.x() + dx, p.y() + dy); + // moving_start = TQPoint(p.x() + dx, p.y() + dy); w -= dx; h -= dy; // moving_start = p; @@ -572,7 +572,7 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) int dw = ( int ) ( w - sw ); int dh = ( int ) ( h - sh ); - moving_start = QPoint( p.x() + dx + dw, p.y() + dy + dh ); + moving_start = TQPoint( p.x() + dx + dw, p.y() + dy + dh ); r->setSize( ( int ) w, ( int ) h ); resizing->updateGeomProps(); @@ -584,10 +584,10 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) selectionRect->setSize( ( int ) ( e->pos().x() - selectionRect->x() ), ( int ) ( e->pos().y() - selectionRect->y() ) ); m_canvas->unselectAll(); - QCanvasItemList l = m_canvas->collisions( selectionRect->rect() ); - for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) + TQCanvasItemList l = m_canvas->collisions( selectionRect->rect() ); + for ( TQCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it ) { - QRect r; + TQRect r; int left = selectionRect->rect().left(); int right = selectionRect->rect().right(); int top = selectionRect->rect().top(); @@ -598,7 +598,7 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) r.setBottom( top < bottom ? bottom : top ); if ( ( ( *it ) ->rtti() > 2001 ) && - ( r.contains( static_cast<Kudesigner::Box*>( *it ) ->rect() ) ) ) + ( r.tqcontains( static_cast<Kudesigner::Box*>( *it ) ->rect() ) ) ) { m_canvas->selectItem( static_cast<Kudesigner::Box*>( *it ) ); m_canvas->update(); @@ -609,11 +609,11 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) /* selectionRect->setSize(e->pos().x() - selectionRect->x(), e->pos().y() - selectionRect->y()); unselectAll(); - QCanvasItemList l = m_canvas->collisions(selectionRect->rect()); - for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) + TQCanvasItemList l = m_canvas->collisions(selectionRect->rect()); + for (TQCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { if ( ((*it)->rtti() > 2001) && - (selectionRect->rect().contains(((CanvasKudesigner::Box*)(*it))->rect())) ) + (selectionRect->rect().tqcontains(((CanvasKudesigner::Box*)(*it))->rect())) ) { selectItem((CanvasKudesigner::Box*)(*it)); m_canvas->update(); @@ -623,7 +623,7 @@ void View::contentsMouseMoveEvent( QMouseEvent* e ) } -void View::contentsMouseDoubleClickEvent( QMouseEvent *e ) +void View::contentsMouseDoubleClickEvent( TQMouseEvent *e ) { ReportItem * item = 0L; if ( e->button() == Qt::LeftButton && m_canvas->selected.count() == 1 ) @@ -642,15 +642,15 @@ void View::setRequest( RequestType r ) switch ( r ) { case RequestProps: - QApplication::restoreOverrideCursor(); - QApplication::setOverrideCursor( Qt::PointingHandCursor ); + TQApplication::restoreOverrideCursor(); + TQApplication::setOverrideCursor( TQt::PointingHandCursor ); break; case RequestDelete: - QApplication::restoreOverrideCursor(); - QApplication::setOverrideCursor( Qt::ForbiddenCursor ); + TQApplication::restoreOverrideCursor(); + TQApplication::setOverrideCursor( TQt::ForbiddenCursor ); break; case RequestNone: - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); break; } request = r; @@ -658,7 +658,7 @@ void View::setRequest( RequestType r ) void View::clearRequest() { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); request = RequestNone; emit selectedEditActionProcessed(); } @@ -716,12 +716,12 @@ void View::setPlugin( KuDesignerPlugin *plugin ) m_plugin = plugin; } -void View::contentsDragMoveEvent( QDragMoveEvent * event ) +void View::contentsDragMoveEvent( TQDragMoveEvent * event ) { //perhaps this could be optimized a little bit if ( !m_plugin ) return ; - QCanvasItemList l = m_canvas->collisions( event->pos() ); + TQCanvasItemList l = m_canvas->collisions( event->pos() ); /* kdDebug()<<l.count()<<endl;*/ if ( l.count() < 2 ) { @@ -736,12 +736,12 @@ void View::contentsDragMoveEvent( QDragMoveEvent * event ) event->ignore(); } -void View::contentsDragEnterEvent ( QDragEnterEvent * /*event*/ ) +void View::contentsDragEnterEvent ( TQDragEnterEvent * /*event*/ ) { // event->accept(); } -void View::keyPressEvent( QKeyEvent *e ) +void View::keyPressEvent( TQKeyEvent *e ) { kdDebug(31000) << k_funcinfo << endl; @@ -751,7 +751,7 @@ void View::keyPressEvent( QKeyEvent *e ) switch ( e->key() ) { - case Qt::Key_Delete: + case TQt::Key_Delete: kdDebug(31000) << "Deleting selection" << endl; /* unselectItem(item); ( (MyCanvas*) m_canvas )->templ->removeReportItem( item ); @@ -769,12 +769,12 @@ void View::keyPressEvent( QKeyEvent *e ) return ; /* Adjust height with - and + */ - case Qt::Key_Minus: - case Qt::Key_Plus: + case TQt::Key_Minus: + case TQt::Key_Plus: { int size = item->props[ "FontSize" ].value().toInt(); - if ( e->key() == Qt::Key_Minus ) + if ( e->key() == TQt::Key_Minus ) size--; else size++; @@ -808,7 +808,7 @@ void View::selectItem( ) { CanvasKudesigner::Box *b; - QPtrList<CanvasKudesigner::Box> list = m_canvas->selected; + TQPtrList<CanvasKudesigner::Box> list = m_canvas->selected; unselectAll(); for (b = list.first(); b; b = list.next()) @@ -822,10 +822,10 @@ void View::setCanvas( Canvas *canvas ) { if ( selectionRect ) delete selectionRect; - QCanvasView::setCanvas( ( QCanvas* ) canvas ); + TQCanvasView::setCanvas( ( TQCanvas* ) canvas ); m_canvas = canvas; selectionRect = new SelectionRect( 0, 0, 0, 0, m_canvas ); - connect( m_canvas, SIGNAL( itemSelected() ), this, SLOT( selectItem() ) ); + connect( m_canvas, TQT_SIGNAL( itemSelected() ), this, TQT_SLOT( selectItem() ) ); clearRequest(); } |