diff options
Diffstat (limited to 'krita/plugins/tools/tool_perspectivegrid')
4 files changed, 61 insertions, 59 deletions
diff --git a/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc b/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc index 944807eb5..04524e48a 100644 --- a/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc +++ b/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc @@ -19,11 +19,11 @@ */ #include <kis_tool_perspectivegrid.h> -#include <qapplication.h> -#include <qpainter.h> -#include <qregion.h> -#include <qwidget.h> -#include <qlayout.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqregion.h> +#include <tqwidget.h> +#include <tqlayout.h> #include <kaction.h> #include <kdebug.h> @@ -95,9 +95,9 @@ void KisToolPerspectiveGrid::update (KisCanvasSubject *subject) super::update(m_subject); } -bool KisToolPerspectiveGrid::mouseNear(const QPoint& mousep, const QPoint point) +bool KisToolPerspectiveGrid::mouseNear(const TQPoint& mousep, const TQPoint point) { - return (QRect( (point.x() - m_handleHalfSize), (point.y() - m_handleHalfSize), m_handleSize, m_handleSize).contains(mousep) ); + return (TQRect( (point.x() - m_handleHalfSize), (point.y() - m_handleHalfSize), m_handleSize, m_handleSize).tqcontains(mousep) ); } void KisToolPerspectiveGrid::buttonPress(KisButtonPressEvent *event) @@ -128,40 +128,40 @@ void KisToolPerspectiveGrid::buttonPress(KisButtonPressEvent *event) return; KisCanvasController *controller = m_subject->canvasController(); Q_ASSERT(controller); - QPoint mousep = controller->windowToView( event->pos().roundQPoint() ); + TQPoint mousep = controller->windowToView( event->pos().roundTQPoint() ); - for( QValueList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) + for( TQValueList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) { KisSubPerspectiveGrid* grid = *it; - if( mouseNear( mousep, controller->windowToView(grid->topLeft()->roundQPoint() ) ) ) + if( mouseNear( mousep, controller->windowToView(grid->topLeft()->roundTQPoint() ) ) ) { kdDebug() << " PRESS TOPLEFT HANDLE " << endl; m_mode = MODE_DRAGING_NODE; m_selectedNode1 = grid->topLeft(); break; } - else if( mouseNear( mousep, controller->windowToView(grid->topRight()->roundQPoint() ) ) ) + else if( mouseNear( mousep, controller->windowToView(grid->topRight()->roundTQPoint() ) ) ) { kdDebug() << " PRESS TOPRIGHT HANDLE " << endl; m_mode = MODE_DRAGING_NODE; m_selectedNode1 = grid->topRight(); break; } - else if( mouseNear( mousep, controller->windowToView(grid->bottomLeft()->roundQPoint() ) ) ) + else if( mouseNear( mousep, controller->windowToView(grid->bottomLeft()->roundTQPoint() ) ) ) { kdDebug() << " PRESS BOTTOMLEFT HANDLE " << endl; m_mode = MODE_DRAGING_NODE; m_selectedNode1 = grid->bottomLeft(); break; } - else if( mouseNear( mousep, controller->windowToView(grid->bottomRight()->roundQPoint() ) ) ) + else if( mouseNear( mousep, controller->windowToView(grid->bottomRight()->roundTQPoint() ) ) ) { kdDebug() << " PRESS BOTTOMRIGHT HANDLE " << endl; m_mode = MODE_DRAGING_NODE; m_selectedNode1 = grid->bottomRight(); break; } - else if( !grid->leftGrid() && mouseNear( mousep, controller->windowToView( ((*grid->topLeft() + *grid->bottomLeft() )*0.5) ).roundQPoint() ) ) + else if( !grid->leftGrid() && mouseNear( mousep, controller->windowToView( ((*grid->topLeft() + *grid->bottomLeft() )*0.5) ).roundTQPoint() ) ) { kdDebug() << " PRESS LEFT HANDLE " << endl; m_mode = MODE_DRAGING_TRANSLATING_TWONODES; @@ -176,7 +176,7 @@ void KisToolPerspectiveGrid::buttonPress(KisButtonPressEvent *event) drawGrid(); break; } - else if( !grid->rightGrid() && mouseNear( mousep, controller->windowToView( ((*grid->topRight() + *grid->bottomRight() )*0.5) ).roundQPoint() ) ) + else if( !grid->rightGrid() && mouseNear( mousep, controller->windowToView( ((*grid->topRight() + *grid->bottomRight() )*0.5) ).roundTQPoint() ) ) { kdDebug() << " PRESS RIGHT HANDLE " << endl; m_mode = MODE_DRAGING_TRANSLATING_TWONODES; @@ -191,7 +191,7 @@ void KisToolPerspectiveGrid::buttonPress(KisButtonPressEvent *event) drawGrid(); break; } - else if( !grid->topGrid() && mouseNear( mousep, controller->windowToView( ((*grid->topLeft() + *grid->topRight() )*0.5) ).roundQPoint() ) ) + else if( !grid->topGrid() && mouseNear( mousep, controller->windowToView( ((*grid->topLeft() + *grid->topRight() )*0.5) ).roundTQPoint() ) ) { kdDebug() << " PRESS TOP HANDLE " << endl; m_mode = MODE_DRAGING_TRANSLATING_TWONODES; @@ -206,7 +206,7 @@ void KisToolPerspectiveGrid::buttonPress(KisButtonPressEvent *event) drawGrid(); break; } - else if( !grid->bottomGrid() && mouseNear( mousep, controller->windowToView( ((*grid->bottomLeft() + *grid->bottomRight() )*0.5) ).roundQPoint() ) ) + else if( !grid->bottomGrid() && mouseNear( mousep, controller->windowToView( ((*grid->bottomLeft() + *grid->bottomRight() )*0.5) ).roundTQPoint() ) ) { kdDebug() << " PRESS BOTTOM HANDLE " << endl; m_mode = MODE_DRAGING_TRANSLATING_TWONODES; @@ -297,7 +297,7 @@ void KisToolPerspectiveGrid::paint(KisCanvasPainter& gc) } } -void KisToolPerspectiveGrid::paint(KisCanvasPainter& gc, const QRect&) +void KisToolPerspectiveGrid::paint(KisCanvasPainter& gc, const TQRect&) { if( m_mode == MODE_CREATION ) { @@ -324,19 +324,19 @@ void KisToolPerspectiveGrid::drawGridCreation(KisCanvasPainter& gc) if (!m_subject) return; - QPen pen(Qt::white); + TQPen pen(TQt::white); gc.setPen(pen); - gc.setRasterOp(Qt::XorROP); + gc.setRasterOp(TQt::XorROP); KisCanvasController *controller = m_subject->canvasController(); KisPoint start, end; - QPoint startPos; - QPoint endPos; + TQPoint startPos; + TQPoint endPos; if (m_dragging) { - startPos = controller->windowToView(m_dragStart.floorQPoint()); - endPos = controller->windowToView(m_dragEnd.floorQPoint()); + startPos = controller->windowToView(m_dragStart.floorTQPoint()); + endPos = controller->windowToView(m_dragEnd.floorTQPoint()); gc.drawLine(startPos, endPos); } else { for (KisPointVector::iterator it = m_points.begin(); it != m_points.end(); ++it) { @@ -347,8 +347,8 @@ void KisToolPerspectiveGrid::drawGridCreation(KisCanvasPainter& gc) } else { end = (*it); - startPos = controller->windowToView(start.floorQPoint()); - endPos = controller->windowToView(end.floorQPoint()); + startPos = controller->windowToView(start.floorTQPoint()); + endPos = controller->windowToView(end.floorTQPoint()); gc.drawLine(startPos, endPos); @@ -358,7 +358,7 @@ void KisToolPerspectiveGrid::drawGridCreation(KisCanvasPainter& gc) } } -void KisToolPerspectiveGrid::drawSmallRectangle(KisCanvasPainter& gc, QPoint p) +void KisToolPerspectiveGrid::drawSmallRectangle(KisCanvasPainter& gc, TQPoint p) { gc.drawRect( p.x() - m_handleHalfSize - 1, p.y() - m_handleHalfSize - 1, m_handleSize, m_handleSize); } @@ -371,15 +371,15 @@ void KisToolPerspectiveGrid::drawGrid(KisCanvasPainter& gc) KisCanvasController *controller = m_subject->canvasController(); - QPen pen(Qt::white); - QPoint startPos; - QPoint endPos; + TQPen pen(TQt::white); + TQPoint startPos; + TQPoint endPos; gc.setPen(pen); - gc.setRasterOp(Qt::XorROP); + gc.setRasterOp(TQt::XorROP); KisPerspectiveGrid* pGrid = m_subject->currentImg()->perspectiveGrid(); - for( QValueList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) + for( TQValueList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) { KisSubPerspectiveGrid* grid = *it; int index = grid->index(); @@ -388,8 +388,8 @@ void KisToolPerspectiveGrid::drawGrid(KisCanvasPainter& gc) bool drawTop = !(grid->topGrid() && (index > grid->topGrid()->index() ) ); bool drawBottom = !(grid->bottomGrid() && (index > grid->bottomGrid()->index() ) ); if(drawTop) { - startPos = controller->windowToView(grid->topLeft()->roundQPoint()); - endPos = controller->windowToView(grid->topRight()->roundQPoint()); + startPos = controller->windowToView(grid->topLeft()->roundTQPoint()); + endPos = controller->windowToView(grid->topRight()->roundTQPoint()); gc.drawLine( startPos, endPos ); if( !grid->topGrid() ) { @@ -403,8 +403,8 @@ void KisToolPerspectiveGrid::drawGrid(KisCanvasPainter& gc) } } if(drawRight) { - startPos = controller->windowToView(grid->topRight()->roundQPoint()); - endPos = controller->windowToView(grid->bottomRight()->roundQPoint()); + startPos = controller->windowToView(grid->topRight()->roundTQPoint()); + endPos = controller->windowToView(grid->bottomRight()->roundTQPoint()); gc.drawLine( startPos, endPos ); if( !grid->rightGrid() ) { @@ -412,8 +412,8 @@ void KisToolPerspectiveGrid::drawGrid(KisCanvasPainter& gc) } } if(drawBottom) { - startPos = controller->windowToView(grid->bottomRight()->roundQPoint()); - endPos = controller->windowToView(grid->bottomLeft()->roundQPoint()); + startPos = controller->windowToView(grid->bottomRight()->roundTQPoint()); + endPos = controller->windowToView(grid->bottomLeft()->roundTQPoint()); gc.drawLine( startPos, endPos ); if( !grid->bottomGrid() ) { @@ -427,8 +427,8 @@ void KisToolPerspectiveGrid::drawGrid(KisCanvasPainter& gc) } } if(drawLeft) { - startPos = controller->windowToView(grid->bottomLeft()->roundQPoint()); - endPos = controller->windowToView(grid->topLeft()->roundQPoint()); + startPos = controller->windowToView(grid->bottomLeft()->roundTQPoint()); + endPos = controller->windowToView(grid->topLeft()->roundTQPoint()); gc.drawLine( startPos, endPos ); if( !grid->leftGrid() ) { @@ -438,14 +438,14 @@ void KisToolPerspectiveGrid::drawGrid(KisCanvasPainter& gc) KisPoint tbVpf = grid->topBottomVanishingPoint(); if( fabs(tbVpf.x()) < 30000000. && fabs(tbVpf.y()) < 30000000.) { - QPoint tbVp = controller->windowToView(tbVpf.roundQPoint()); + TQPoint tbVp = controller->windowToView(tbVpf.roundTQPoint()); gc.drawLine( tbVp.x() - m_handleHalfSize, tbVp.y() - m_handleHalfSize, tbVp.x() + m_handleHalfSize, tbVp.y() + m_handleHalfSize); gc.drawLine( tbVp.x() - m_handleHalfSize, tbVp.y() + m_handleHalfSize, tbVp.x() + m_handleHalfSize, tbVp.y() - m_handleHalfSize); } KisPoint lrVpf = grid->leftRightVanishingPoint(); if( fabs(lrVpf.x()) < 30000000. && fabs(lrVpf.y()) < 30000000.) { // Don't display it, if it is too far, or you get funny results - QPoint lrVp = controller->windowToView(lrVpf.roundQPoint()); + TQPoint lrVp = controller->windowToView(lrVpf.roundTQPoint()); gc.drawLine( lrVp.x() - m_handleHalfSize, lrVp.y() - m_handleHalfSize, lrVp.x() + m_handleHalfSize, lrVp.y() + m_handleHalfSize); gc.drawLine( lrVp.x() - m_handleHalfSize, lrVp.y() + m_handleHalfSize, lrVp.x() + m_handleHalfSize, lrVp.y() - m_handleHalfSize); } @@ -474,7 +474,7 @@ void KisToolPerspectiveGrid::setup(KActionCollection *collection) "tool_perspectivegrid" , 0, this, - SLOT(activate()), + TQT_SLOT(activate()), collection, name()); Q_CHECK_PTR(m_action); @@ -485,12 +485,12 @@ void KisToolPerspectiveGrid::setup(KActionCollection *collection) } -// QWidget* KisToolPerspectiveGrid::createOptionWidget(QWidget* parent) +// TQWidget* KisToolPerspectiveGrid::createOptionWidget(TQWidget* tqparent) // { // return 0; // } // -// QWidget* KisToolPerspectiveGrid::optionWidget() +// TQWidget* KisToolPerspectiveGrid::optionWidget() // { // return 0; // } diff --git a/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h b/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h index b6318c7d1..2b5467d41 100644 --- a/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h +++ b/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h @@ -28,6 +28,7 @@ class KisToolPerspectiveGrid : public KisToolNonPaint { Q_OBJECT + TQ_OBJECT enum PerspectiveGridEditionMode { MODE_CREATION, // This is the mode when there is not yet a perspective grid MODE_EDITING, // This is the mode when the grid has been created, and we are waiting for the user to click on a control box @@ -49,14 +50,14 @@ public: // virtual void setup(KActionCollection *collection); - virtual Q_UINT32 priority() { return 3; } + virtual TQ_UINT32 priority() { return 3; } virtual enumToolType toolType() { return TOOL_VIEW; } virtual void buttonPress(KisButtonPressEvent *event); virtual void move(KisMoveEvent *event); virtual void buttonRelease(KisButtonReleaseEvent *event); -// QWidget* createOptionWidget(QWidget* parent); -// virtual QWidget* optionWidget(); +// TQWidget* createOptionWidget(TQWidget* tqparent); +// virtual TQWidget* optionWidget(); public slots: virtual void activate(); @@ -64,15 +65,15 @@ public slots: protected: virtual void paint(KisCanvasPainter& gc); - virtual void paint(KisCanvasPainter& gc, const QRect& rc); + virtual void paint(KisCanvasPainter& gc, const TQRect& rc); void drawGridCreation(KisCanvasPainter& gc); void drawGridCreation(); void drawGrid(KisCanvasPainter& gc); void drawGrid(); private: - void drawSmallRectangle(KisCanvasPainter& gc, QPoint p); - bool mouseNear(const QPoint& mousep, const QPoint point); + void drawSmallRectangle(KisCanvasPainter& gc, TQPoint p); + bool mouseNear(const TQPoint& mousep, const TQPoint point); protected: KisPoint m_dragStart; @@ -80,11 +81,11 @@ protected: bool m_dragging; private: - typedef QValueVector<KisPoint> KisPointVector; + typedef TQValueVector<KisPoint> KisPointVector; KisCanvasSubject *m_subject; KisPointVector m_points; PerspectiveGridEditionMode m_mode; - Q_INT32 m_handleSize, m_handleHalfSize; + TQ_INT32 m_handleSize, m_handleHalfSize; KisPerspectiveGridNodeSP m_selectedNode1, m_selectedNode2; }; diff --git a/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc b/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc index 157a74579..54a39f0f2 100644 --- a/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc +++ b/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc @@ -20,7 +20,7 @@ #include <stdlib.h> #include <vector> -#include <qpoint.h> +#include <tqpoint.h> #include <klocale.h> #include <kiconloader.h> @@ -42,14 +42,14 @@ typedef KGenericFactory<ToolPerspectiveGrid> ToolPerspectiveGridFactory; K_EXPORT_COMPONENT_FACTORY( kritatoolperspectivegrid, ToolPerspectiveGridFactory( "krita" ) ) -ToolPerspectiveGrid::ToolPerspectiveGrid(QObject *parent, const char *name, const QStringList &) - : KParts::Plugin(parent, name) +ToolPerspectiveGrid::ToolPerspectiveGrid(TQObject *tqparent, const char *name, const TQStringList &) + : KParts::Plugin(tqparent, name) { setInstance(ToolPerspectiveGridFactory::instance()); - if ( parent->inherits("KisToolRegistry") ) + if ( tqparent->inherits("KisToolRegistry") ) { - KisToolRegistry * r = dynamic_cast<KisToolRegistry*>(parent); + KisToolRegistry * r = dynamic_cast<KisToolRegistry*>(tqparent); r->add(new KisToolPerspectiveGridFactory()); } diff --git a/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h b/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h index e98cbf09b..aed4a60cd 100644 --- a/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h +++ b/krita/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h @@ -29,8 +29,9 @@ class KisView; class ToolPerspectiveGrid : public KParts::Plugin { Q_OBJECT + TQ_OBJECT public: - ToolPerspectiveGrid(QObject *parent, const char *name, const QStringList &); + ToolPerspectiveGrid(TQObject *tqparent, const char *name, const TQStringList &); virtual ~ToolPerspectiveGrid(); private: |
