diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /kimagemapeditor/kimearea.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kimagemapeditor/kimearea.cpp')
-rw-r--r-- | kimagemapeditor/kimearea.cpp | 412 |
1 files changed, 206 insertions, 206 deletions
diff --git a/kimagemapeditor/kimearea.cpp b/kimagemapeditor/kimearea.cpp index cb873564..cee54b8a 100644 --- a/kimagemapeditor/kimearea.cpp +++ b/kimagemapeditor/kimearea.cpp @@ -15,16 +15,16 @@ * * ***************************************************************************/ -#include <qbitmap.h> -#include <qpointarray.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qimage.h> -#include <qpen.h> -#include <qbrush.h> -#include <qpalette.h> -#include <qcolor.h> -#include <qlistview.h> +#include <tqbitmap.h> +#include <tqpointarray.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqimage.h> +#include <tqpen.h> +#include <tqbrush.h> +#include <tqpalette.h> +#include <tqcolor.h> +#include <tqlistview.h> #include <kdebug.h> @@ -41,7 +41,7 @@ bool Area::showAlt; Area::Area() { - _coords=new QPointArray(); + _coords=new TQPointArray(); _selectionPoints= new SelectionPointList(); _selectionPoints->setAutoDelete(true); _finished=false; @@ -61,13 +61,13 @@ Area* Area::clone() const return areaClone; } -QPointArray* Area::coords() const { +TQPointArray* Area::coords() const { return _coords; } -QString Area::getHTMLAttributes() const +TQString Area::getHTMLAttributes() const { - QString retStr=""; + TQString retStr=""; for (AttributeIterator it = firstAttribute();it!=lastAttribute();++it) { @@ -85,20 +85,20 @@ Area::~Area() { } -bool Area::contains(const QPoint &) const { +bool Area::contains(const TQPoint &) const { return false; } -QString Area::getHTMLCode() const { +TQString Area::getHTMLCode() const { return ""; } -QString Area::attribute(const QString & name) const +TQString Area::attribute(const TQString & name) const { return _attributes[name.lower()]; } -void Area::setAttribute(const QString & name, const QString & value) +void Area::setAttribute(const TQString & name, const TQString & value) { _attributes.replace(name.lower(),value); if (value.isEmpty()) @@ -116,16 +116,16 @@ AttributeIterator Area::lastAttribute() const } -bool Area::setCoords(const QString &) { +bool Area::setCoords(const TQString &) { return true; } -void Area::moveSelectionPoint(QRect*, const QPoint &) +void Area::moveSelectionPoint(TQRect*, const TQPoint &) {} // Default implementation; is specified by subclasses -QString Area::coordsToString() const +TQString Area::coordsToString() const { return ""; } @@ -139,13 +139,13 @@ void Area::setArea(const Area & copy) { delete _coords; delete _selectionPoints; - _coords=new QPointArray(copy.coords()->copy()); + _coords=new TQPointArray(copy.coords()->copy()); _selectionPoints= new SelectionPointList(); currentHighlighted=-1; // Need a deep copy of the list - for (QRect *r=copy.selectionPoints()->first();r!=0L;r=copy.selectionPoints()->next()) - _selectionPoints->append(new QRect( r->topLeft(),r->bottomRight() ) ); + for (TQRect *r=copy.selectionPoints()->first();r!=0L;r=copy.selectionPoints()->next()) + _selectionPoints->append(new TQRect( r->topLeft(),r->bottomRight() ) ); _finished=copy.finished(); _isSelected=copy.isSelected(); @@ -162,7 +162,7 @@ void Area::setArea(const Area & copy) } -void Area::setListViewItem(QListViewItem* item) { +void Area::setListViewItem(TQListViewItem* item) { _listViewItem=item; } @@ -173,13 +173,13 @@ void Area::deleteListViewItem() } -void Area::setRect(const QRect & r) +void Area::setRect(const TQRect & r) { _rect=r; updateSelectionPoints(); } -QRect Area::rect() const { +TQRect Area::rect() const { return _rect; } @@ -196,7 +196,7 @@ void Area::moveBy(int dx, int dy) { _coords->setPoint(i,newX,newY); } - for (QRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { + for (TQRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { r->moveBy(dx,dy); } } @@ -213,12 +213,12 @@ uint Area::countSelectionPoints() const return (uint) selectionPoints()->count(); } -int Area::addCoord(const QPoint & p) +int Area::addCoord(const TQPoint & p) { _coords->resize(_coords->size()+1); _coords->setPoint(_coords->size()-1,p); - QRect *r= new QRect(0,0,SELSIZE,SELSIZE); + TQRect *r= new TQRect(0,0,SELSIZE,SELSIZE); r->moveCenter(p); _selectionPoints->append(r); setRect(_coords->boundingRect()); @@ -226,7 +226,7 @@ int Area::addCoord(const QPoint & p) return _coords->size()-1; } -void Area::insertCoord(int pos, const QPoint & p) +void Area::insertCoord(int pos, const TQPoint & p) { /* @@ -253,7 +253,7 @@ void Area::insertCoord(int pos, const QPoint & p) } _coords->setPoint(pos, p); - QRect *r= new QRect(0,0,SELSIZE,SELSIZE); + TQRect *r= new TQRect(0,0,SELSIZE,SELSIZE); r->moveCenter(p); _selectionPoints->insert(pos,r); setRect(_coords->boundingRect()); @@ -277,7 +277,7 @@ void Area::removeCoord(int pos) { setRect(_coords->boundingRect()); } -bool Area::removeSelectionPoint(QRect * r) +bool Area::removeSelectionPoint(TQRect * r) { if (_selectionPoints->contains(r)) { @@ -289,7 +289,7 @@ bool Area::removeSelectionPoint(QRect * r) } -void Area::moveCoord(int pos, const QPoint & p) { +void Area::moveCoord(int pos, const TQPoint & p) { _coords->setPoint(pos,p); _selectionPoints->at(pos)->moveCenter(p); setRect(_coords->boundingRect()); @@ -307,21 +307,21 @@ void Area::highlightSelectionPoint(int number){ currentHighlighted=number; } -QRect Area::selectionRect() const { - QRect r = rect(); +TQRect Area::selectionRect() const { + TQRect r = rect(); r.moveBy(-SELSIZE*2,-SELSIZE*2); - r.setSize(r.size()+QSize(SELSIZE*4,SELSIZE*4)); + r.setSize(r.size()+TQSize(SELSIZE*4,SELSIZE*4)); return r; } -void Area::drawHighlighting(QPainter & p) +void Area::drawHighlighting(TQPainter & p) { if (Area::highlightArea && !isMoving() && _highlightedPixmap) { p.setRasterOp(Qt::CopyROP); - QPoint point = QPoint(rect().x(),rect().y()); + TQPoint point = TQPoint(rect().x(),rect().y()); if (point.x()<0) point.setX(0); if (point.y()<0) @@ -332,21 +332,21 @@ void Area::drawHighlighting(QPainter & p) } } -void Area::drawAlt(QPainter & p) +void Area::drawAlt(TQPainter & p) { double x,y; double scalex = p.worldMatrix().m11(); // double scaley = p.worldMatrix().m12(); - QWMatrix oldMatrix = p.worldMatrix(); + TQWMatrix oldMatrix = p.worldMatrix(); - p.setWorldMatrix(QWMatrix(1,oldMatrix.m12(), oldMatrix.m21(), 1, oldMatrix.dx(), oldMatrix.dy() )); + p.setWorldMatrix(TQWMatrix(1,oldMatrix.m12(), oldMatrix.m21(), 1, oldMatrix.dx(), oldMatrix.dy() )); x = (rect().x()+rect().width()/2)*scalex; y = (rect().y()+rect().height()/2)*scalex; - QFontMetrics metrics = p.fontMetrics(); + TQFontMetrics metrics = p.fontMetrics(); int w = metrics.width(attribute("alt")); x -= w/2; @@ -362,7 +362,7 @@ void Area::drawAlt(QPainter & p) else { p.setRasterOp(Qt::XorROP); - p.setPen(QPen(QColor("white"),1)); + p.setPen(TQPen(TQColor("white"),1)); } p.drawText(myround(x),myround(y),attribute("alt")); @@ -370,7 +370,7 @@ void Area::drawAlt(QPainter & p) p.setWorldMatrix(oldMatrix); } -void Area::draw(QPainter & p) +void Area::draw(TQPainter & p) { // Only draw the selection points at base class @@ -382,45 +382,45 @@ void Area::draw(QPainter & p) double scalex = p.worldMatrix().m11(); // double scaley = p.worldMatrix().m12(); - QWMatrix oldMatrix = p.worldMatrix(); + TQWMatrix oldMatrix = p.worldMatrix(); - p.setWorldMatrix(QWMatrix(1,oldMatrix.m12(), oldMatrix.m21(), 1, oldMatrix.dx(), oldMatrix.dy() )); + p.setWorldMatrix(TQWMatrix(1,oldMatrix.m12(), oldMatrix.m21(), 1, oldMatrix.dx(), oldMatrix.dy() )); - for (QRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { + for (TQRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { // Draw a green circle around the selected point ( only when editing a polygon ) if (i==currentHighlighted) { - QRect r2(0,0,15,15); + TQRect r2(0,0,15,15); r2.moveCenter(r->center()*scalex); p.setRasterOp(Qt::CopyROP); - p.setPen(QPen(QColor("lightgreen"),2)); + p.setPen(TQPen(TQColor("lightgreen"),2)); p.drawEllipse(r2); p.setRasterOp(Qt::XorROP); - p.setPen(QPen(QColor("white"),1)); + p.setPen(TQPen(TQColor("white"),1)); } // Draw the selection point p.setRasterOp(Qt::XorROP); - QRect r3(*r); + TQRect r3(*r); int d = 1; if (scalex > 2) d=0; - r3.moveCenter( QPoint((int)(r3.center().x()*scalex),(int)(r3.center().y()*scalex)) ); + r3.moveCenter( TQPoint((int)(r3.center().x()*scalex),(int)(r3.center().y()*scalex)) ); - p.fillRect(r3,QBrush("white")); + p.fillRect(r3,TQBrush("white")); /* - QRect r3(*r); - r3.moveTopLeft( QPoint(r3.left()*scalex+2*(scalex-1), r3.top()*scalex+2*(scalex-1)) ); + TQRect r3(*r); + r3.moveTopLeft( TQPoint(r3.left()*scalex+2*(scalex-1), r3.top()*scalex+2*(scalex-1)) ); - r3.setSize(r3.size()+QSize(2,2)); + r3.setSize(r3.size()+TQSize(2,2)); //+ r3.moveBy(-1,-1); p.setRasterOp(Qt::CopyROP); - p.setPen(QPen(QColor("lightgreen"),1)); - p.setBrush(QColor("lightgreen")); + p.setPen(TQPen(TQColor("lightgreen"),1)); + p.setBrush(TQColor("lightgreen")); p.drawPie(r3,0,5760); - p.setPen(QPen(QColor("black"),1)); - r3.setSize(r3.size()+QSize(2,2)); + p.setPen(TQPen(TQColor("black"),1)); + r3.setSize(r3.size()+TQSize(2,2)); r3.moveBy(-1,-1); p.drawEllipse(r3); */ @@ -439,11 +439,11 @@ void Area::draw(QPainter & p) } -QRect* Area::onSelectionPoint(const QPoint & p, double zoom) const +TQRect* Area::onSelectionPoint(const TQPoint & p, double zoom) const { - for (QRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) + for (TQRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { - QRect r2(r->topLeft(),r->bottomRight()); + TQRect r2(r->topLeft(),r->bottomRight()); r2.moveCenter(r2.center()*zoom); @@ -464,13 +464,13 @@ QRect* Area::onSelectionPoint(const QPoint & p, double zoom) const * returns only the part of the image which is * covered by the area */ -QPixmap Area::cutOut(const QImage & image) +TQPixmap Area::cutOut(const TQImage & image) { if ( 0>=rect().width() || 0>=rect().height() || !rect().intersects(image.rect()) ) { - QPixmap dummyPix(10,10); + TQPixmap dummyPix(10,10); dummyPix.fill(); delete _highlightedPixmap; _highlightedPixmap = 0L; @@ -478,11 +478,11 @@ QPixmap Area::cutOut(const QImage & image) } // Get the mask from the subclasses - QBitmap mask=getMask(); + TQBitmap mask=getMask(); // The rectangle which is part of the image - QRect partOfImage=rect(); - QRect partOfMask(0,0,mask.width(),mask.height()); + TQRect partOfImage=rect(); + TQRect partOfMask(0,0,mask.width(),mask.height()); // If the area is outside of the image make the @@ -507,13 +507,13 @@ QPixmap Area::cutOut(const QImage & image) partOfMask.setY(myabs(rect().y())); } - QImage tempImage=mask.convertToImage().copy(partOfMask); + TQImage tempImage=mask.convertToImage().copy(partOfMask); mask.convertFromImage(tempImage); // partOfImage = partOfImage.normalize(); - QImage cut=image.copy(partOfImage); + TQImage cut=image.copy(partOfImage); - QPixmap pix; + TQPixmap pix; // partOfMask = partOfMask.normalize(); if (!partOfMask.isValid()) @@ -521,9 +521,9 @@ QPixmap Area::cutOut(const QImage & image) << partOfMask.width() << "," << partOfMask.height() << "," << endl; /* - QBitmap mask2(partOfMask.width(), partOfMask.height()); - QPainter p4(&mask2); - p4.drawPixmap( QPoint(0,0) ,mask,partOfMask); + TQBitmap mask2(partOfMask.width(), partOfMask.height()); + TQPainter p4(&mask2); + p4.drawPixmap( TQPoint(0,0) ,mask,partOfMask); p4.flush(); p4.end(); */ @@ -532,27 +532,27 @@ QPixmap Area::cutOut(const QImage & image) setHighlightedPixmap(cut, mask); - QPixmap retPix(pix.width(),pix.height()); - QPainter p3(&retPix); + TQPixmap retPix(pix.width(),pix.height()); + TQPainter p3(&retPix); // if transparent image fill the background // with gimp-like rectangles if (pix.mask()) { - QPixmap backPix(32,32); + TQPixmap backPix(32,32); // Gimp like transparent rectangle - QPainter p2(&backPix); - p2.fillRect(0,0,32,32,QColor(156,149,156)); - p2.fillRect(0,16,16,16,QColor(98,105,98)); - p2.fillRect(16,0,16,16,QColor(98,105,98)); + TQPainter p2(&backPix); + p2.fillRect(0,0,32,32,TQColor(156,149,156)); + p2.fillRect(0,16,16,16,TQColor(98,105,98)); + p2.fillRect(16,0,16,16,TQColor(98,105,98)); p2.flush(); - p3.setPen(QPen()); - p3.fillRect(0,0,pix.width(),pix.height(),QBrush(QColor("black"),backPix)); + p3.setPen(TQPen()); + p3.fillRect(0,0,pix.width(),pix.height(),TQBrush(TQColor("black"),backPix)); } - p3.drawPixmap(QPoint(0,0),pix); + p3.drawPixmap(TQPoint(0,0),pix); p3.flush(); p3.end(); retPix.setMask(mask); @@ -560,22 +560,22 @@ QPixmap Area::cutOut(const QImage & image) return retPix; } -QBitmap Area::getMask() const +TQBitmap Area::getMask() const { - QBitmap b; + TQBitmap b; return b; } -void Area::setHighlightedPixmap( QImage & im, QBitmap & mask ) +void Area::setHighlightedPixmap( TQImage & im, TQBitmap & mask ) { if (!Area::highlightArea) return; delete _highlightedPixmap; - QImage image = im.convertDepth( 32 ); - QSize size = image.size(); - QColor pixel; + TQImage image = im.convertDepth( 32 ); + TQSize size = image.size(); + TQColor pixel; double r,g,b; @@ -596,7 +596,7 @@ void Area::setHighlightedPixmap( QImage & im, QBitmap & mask ) } } - _highlightedPixmap = new QPixmap(); + _highlightedPixmap = new TQPixmap(); _highlightedPixmap->convertFromImage( image ); _highlightedPixmap->setMask( mask ); @@ -613,13 +613,13 @@ void Area::setHighlightedPixmap( QImage & im, QBitmap & mask ) RectArea::RectArea() : Area() { - QRect *p = new QRect(0,0,SELSIZE,SELSIZE); + TQRect *p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); - p = new QRect(0,0,SELSIZE,SELSIZE); + p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); - p = new QRect(0,0,SELSIZE,SELSIZE); + p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); - p = new QRect(0,0,SELSIZE,SELSIZE); + p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); _type=Area::Rectangle; @@ -635,21 +635,21 @@ Area* RectArea::clone() const return areaClone; } -void RectArea::draw(QPainter & p) +void RectArea::draw(TQPainter & p) { drawHighlighting(p); // p.setRasterOp(Qt::CopyROP); // p.setRasterOp(Qt:: OrROP); -// QBrush b(QBrush::SolidPattern); -// QBrush b(QBrush::Dense4Pattern); -// QBrush b(QBrush::BDiagPattern); -// b.setColor(QColor(32,32,32)); +// TQBrush b(TQBrush::SolidPattern); +// TQBrush b(TQBrush::Dense4Pattern); +// TQBrush b(TQBrush::BDiagPattern); +// b.setColor(TQColor(32,32,32)); // p.fillRect(rect(), b); p.setRasterOp(Qt::XorROP); - p.setPen(QPen(QColor("white"),1)); - QRect r(rect()); + p.setPen(TQPen(TQColor("white"),1)); + TQRect r(rect()); r.setWidth(r.width()+1); r.setHeight(r.height()+1); p.drawRect(r); @@ -657,12 +657,12 @@ void RectArea::draw(QPainter & p) Area::draw(p); } -QBitmap RectArea::getMask() const +TQBitmap RectArea::getMask() const { - QBitmap mask(rect().width(),rect().height()); + TQBitmap mask(rect().width(),rect().height()); mask.fill(Qt::color0); - QPainter p(&mask); + TQPainter p(&mask); p.setBackgroundColor(Qt::color0); p.setPen(Qt::color1); p.setBrush(Qt::color1); @@ -672,9 +672,9 @@ QBitmap RectArea::getMask() const return mask; } -QString RectArea::coordsToString() const +TQString RectArea::coordsToString() const { - QString retStr=QString("%1,%2,%3,%4") + TQString retStr=TQString("%1,%2,%3,%4") .arg(rect().left()) .arg(rect().top()) .arg(rect().right()) @@ -683,20 +683,20 @@ QString RectArea::coordsToString() const return retStr; } -bool RectArea::contains(const QPoint & p) const{ +bool RectArea::contains(const TQPoint & p) const{ return rect().contains(p); } -void RectArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) +void RectArea::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p) { selectionPoint->moveCenter(p); int i=0; - for (QRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { + for (TQRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { if (r==selectionPoint) break; i++; } - QRect r2(_rect); + TQRect r2(_rect); switch (i) { case 0 : _rect.setLeft(p.x()); _rect.setTop(p.y()); @@ -720,19 +720,19 @@ void RectArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) void RectArea::updateSelectionPoints() { _selectionPoints->first()->moveCenter(_rect.topLeft()); - _selectionPoints->next()->moveCenter(_rect.topRight()+QPoint(1,0)); - _selectionPoints->next()->moveCenter(_rect.bottomLeft()+QPoint(0,1)); - _selectionPoints->next()->moveCenter(_rect.bottomRight()+QPoint(1,1)); + _selectionPoints->next()->moveCenter(_rect.topRight()+TQPoint(1,0)); + _selectionPoints->next()->moveCenter(_rect.bottomLeft()+TQPoint(0,1)); + _selectionPoints->next()->moveCenter(_rect.bottomRight()+TQPoint(1,1)); } -bool RectArea::setCoords(const QString & s) +bool RectArea::setCoords(const TQString & s) { _finished=true; - QStringList list=QStringList::split(",",s); - QRect r; + TQStringList list=TQStringList::split(",",s); + TQRect r; bool ok=true; - QStringList::Iterator it = list.begin(); + TQStringList::Iterator it = list.begin(); r.setLeft((*it).toInt(&ok,10));it++; r.setTop((*it).toInt(&ok,10));it++; r.setRight((*it).toInt(&ok,10));it++; @@ -744,8 +744,8 @@ bool RectArea::setCoords(const QString & s) return false; } -QString RectArea::getHTMLCode() const { - QString retStr; +TQString RectArea::getHTMLCode() const { + TQString retStr; retStr+="<area "; retStr+="shape=\"rect\" "; @@ -766,13 +766,13 @@ CircleArea::CircleArea() : Area() { _type=Area::Circle; - QRect *p = new QRect(0,0,SELSIZE,SELSIZE); + TQRect *p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); - p = new QRect(0,0,SELSIZE,SELSIZE); + p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); - p = new QRect(0,0,SELSIZE,SELSIZE); + p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); - p = new QRect(0,0,SELSIZE,SELSIZE); + p = new TQRect(0,0,SELSIZE,SELSIZE); _selectionPoints->append(p); } @@ -786,26 +786,26 @@ Area* CircleArea::clone() const return areaClone; } -void CircleArea::draw(QPainter & p) +void CircleArea::draw(TQPainter & p) { drawHighlighting(p); /* p.setRasterOp(Qt::CopyROP); - QBrush bold = p.brush(); - QBrush b(QBrush::Dense5Pattern); - b.setColor(QColor("green")); + TQBrush bold = p.brush(); + TQBrush b(TQBrush::Dense5Pattern); + b.setColor(TQColor("green")); p.setBrush(b); - QRect r = _rect; + TQRect r = _rect; r.moveBy(1,1); - r.setSize( r.size()-QSize(2,2) ); + r.setSize( r.size()-TQSize(2,2) ); p.drawChord(r,0,5760); p.setBrush(bold); */ p.setRasterOp(Qt::XorROP); - p.setPen(QPen(QColor("white"),1)); + p.setPen(TQPen(TQColor("white"),1)); - QRect r(_rect); + TQRect r(_rect); r.setWidth(r.width()+1); r.setHeight(r.height()+1); p.drawEllipse(r); @@ -813,16 +813,16 @@ void CircleArea::draw(QPainter & p) Area::draw(p); } -QBitmap CircleArea::getMask() const +TQBitmap CircleArea::getMask() const { - QBitmap mask(_rect.width(),_rect.height()); + TQBitmap mask(_rect.width(),_rect.height()); mask.fill(Qt::color0); - QPainter p(&mask); + TQPainter p(&mask); p.setBackgroundColor(Qt::color0); p.setPen(Qt::color1); p.setBrush(Qt::color1); - p.drawPie(QRect(0,0,_rect.width(),_rect.height()),0,5760); + p.drawPie(TQRect(0,0,_rect.width(),_rect.height()),0,5760); p.flush(); p.end(); @@ -831,9 +831,9 @@ QBitmap CircleArea::getMask() const } -QString CircleArea::coordsToString() const +TQString CircleArea::coordsToString() const { - QString retStr=QString("%1,%2,%3") + TQString retStr=TQString("%1,%2,%3") .arg(_rect.center().x()) .arg(_rect.center().y()) .arg(_rect.width()/2); @@ -841,18 +841,18 @@ QString CircleArea::coordsToString() const return retStr; } -bool CircleArea::contains(const QPoint & p) const +bool CircleArea::contains(const TQPoint & p) const { - QRegion r(_rect,QRegion::Ellipse); + TQRegion r(_rect,TQRegion::Ellipse); return r.contains(p); } -void CircleArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) +void CircleArea::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p) { selectionPoint->moveCenter(p); int i=0; - for (QRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { + for (TQRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { if (r==selectionPoint) break; i++; @@ -860,7 +860,7 @@ void CircleArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) // The code below really sucks, but I have no better idea. // it only makes sure that the circle is perfektly round - QPoint newPoint; + TQPoint newPoint; int diff=myabs(p.x()-_rect.center().x()); if (myabs(p.y()-_rect.center().y())>diff) diff=myabs(p.y()-_rect.center().y()); @@ -910,9 +910,9 @@ void CircleArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) } -void CircleArea::setRect(const QRect & r) +void CircleArea::setRect(const TQRect & r) { - QRect r2 = r; + TQRect r2 = r; if ( r2.height() != r2.width() ) r2.setHeight( r2.width() ); @@ -928,26 +928,26 @@ void CircleArea::updateSelectionPoints() _selectionPoints->next()->moveCenter(_rect.bottomRight()); } -bool CircleArea::setCoords(const QString & s) +bool CircleArea::setCoords(const TQString & s) { _finished=true; - QStringList list=QStringList::split(",",s); + TQStringList list=TQStringList::split(",",s); bool ok=true; - QStringList::Iterator it = list.begin(); + TQStringList::Iterator it = list.begin(); int x=(*it).toInt(&ok,10);it++; int y=(*it).toInt(&ok,10);it++; int rad=(*it).toInt(&ok,10); if (!ok) return false; - QRect r; + TQRect r; r.setWidth(rad*2); r.setHeight(rad*2); - r.moveCenter(QPoint(x,y)); + r.moveCenter(TQPoint(x,y)); setRect(r); return true; } -QString CircleArea::getHTMLCode() const { - QString retStr; +TQString CircleArea::getHTMLCode() const { + TQString retStr; retStr+="<area "; retStr+="shape=\"circle\" "; @@ -981,12 +981,12 @@ Area* PolyArea::clone() const return areaClone; } -void PolyArea::draw(QPainter & p) +void PolyArea::draw(TQPainter & p) { drawHighlighting(p); p.setRasterOp(Qt::XorROP); - p.setPen(QPen(QColor("white"),1)); + p.setPen(TQPen(TQColor("white"),1)); if (_coords->count()==0) return; @@ -1007,32 +1007,32 @@ void PolyArea::draw(QPainter & p) Area::draw(p); } -QBitmap PolyArea::getMask() const +TQBitmap PolyArea::getMask() const { - QBitmap mask(_rect.width(),_rect.height()); + TQBitmap mask(_rect.width(),_rect.height()); mask.fill(Qt::color0); - QPainter p(&mask); + TQPainter p(&mask); p.setBackgroundColor(Qt::color0); p.setPen(Qt::color1); p.setBrush(Qt::color1); p.setClipping(true); - QRegion r(*_coords); + TQRegion r(*_coords); r.translate(-_rect.left(),-_rect.top()); p.setClipRegion(r); - p.fillRect(QRect(0,0,_rect.width(),_rect.height()),Qt::color1); + p.fillRect(TQRect(0,0,_rect.width(),_rect.height()),Qt::color1); p.flush(); p.end(); return mask; } -QString PolyArea::coordsToString() const +TQString PolyArea::coordsToString() const { - QString retStr; + TQString retStr; for (uint i=0;i<_coords->count();i++) { - retStr.append(QString("%1,%2,") + retStr.append(TQString("%1,%2,") .arg(_coords->point(i).x()) .arg(_coords->point(i).y())); } @@ -1042,13 +1042,13 @@ QString PolyArea::coordsToString() const return retStr; } -int PolyArea::distance(const QPoint &p1, const QPoint &p2) +int PolyArea::distance(const TQPoint &p1, const TQPoint &p2) { - QPoint temp = p1-p2; + TQPoint temp = p1-p2; return temp.manhattanLength(); } -bool PolyArea::isBetween(const QPoint &p, const QPoint &p1, const QPoint &p2) +bool PolyArea::isBetween(const TQPoint &p, const TQPoint &p1, const TQPoint &p2) { int dist = distance(p,p1)+distance(p,p2)-distance(p1,p2); @@ -1063,7 +1063,7 @@ void PolyArea::simplifyCoords() if (_coords->size()<4) return; - QPoint p = _coords->point(0) - _coords->point(1); + TQPoint p = _coords->point(0) - _coords->point(1); uint i = 1; @@ -1119,7 +1119,7 @@ void PolyArea::simplifyCoords() } -int PolyArea::addCoord(const QPoint & p) +int PolyArea::addCoord(const TQPoint & p) { if (_coords->size()<3) { @@ -1135,7 +1135,7 @@ int PolyArea::addCoord(const QPoint & p) int n=_coords->size(); -// QPoint temp = p-_coords->point(0); +// TQPoint temp = p-_coords->point(0); int nearest = 0; int olddist = distance(p,_coords->point(0)); int mindiff = 999999999; @@ -1160,23 +1160,23 @@ int PolyArea::addCoord(const QPoint & p) } -bool PolyArea::contains(const QPoint & p) const +bool PolyArea::contains(const TQPoint & p) const { // A line can't contain a point if (_coords->count() >2 ) { - QRegion r(*_coords); + TQRegion r(*_coords); return r.contains(p); } else return false; } -void PolyArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) +void PolyArea::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p) { selectionPoint->moveCenter(p); int i=0; - for (QRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { + for (TQRect *r=_selectionPoints->first();r!=0L;r=_selectionPoints->next()) { if (r==selectionPoint) break; i++; @@ -1187,7 +1187,7 @@ void PolyArea::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) void PolyArea::updateSelectionPoints() { - QRect *r; + TQRect *r; r=_selectionPoints->first(); for (uint i=0;i<_coords->size();i++) @@ -1198,14 +1198,14 @@ void PolyArea::updateSelectionPoints() } -bool PolyArea::setCoords(const QString & s) +bool PolyArea::setCoords(const TQString & s) { _finished=true; - QStringList list=QStringList::split(",",s); - _coords=new QPointArray(); + TQStringList list=TQStringList::split(",",s); + _coords=new TQPointArray(); _selectionPoints= new SelectionPointList(); - for (QStringList::Iterator it = list.begin(); it !=list.end(); ++it) + for (TQStringList::Iterator it = list.begin(); it !=list.end(); ++it) { bool ok=true; int newXCoord=(*it).toInt(&ok,10); @@ -1214,15 +1214,15 @@ bool PolyArea::setCoords(const QString & s) if (it==list.end()) break; int newYCoord=(*it).toInt(&ok,10); if (!ok) return false; - insertCoord(_coords->size(), QPoint(newXCoord,newYCoord)); + insertCoord(_coords->size(), TQPoint(newXCoord,newYCoord)); } return true; } -QString PolyArea::getHTMLCode() const { - QString retStr; +TQString PolyArea::getHTMLCode() const { + TQString retStr; retStr+="<area "; retStr+="shape=\"poly\" "; @@ -1243,12 +1243,12 @@ void PolyArea::setFinished(bool b) _finished=b; } -QRect PolyArea::selectionRect() const +TQRect PolyArea::selectionRect() const { - QRect r = _rect; + TQRect r = _rect; r.moveBy(-10,-10); - r.setSize(r.size()+QSize(21,21)); + r.setSize(r.size()+TQSize(21,21)); return r; } @@ -1276,12 +1276,12 @@ Area* DefaultArea::clone() const return areaClone; } -void DefaultArea::draw(QPainter &) +void DefaultArea::draw(TQPainter &) {} -QString DefaultArea::getHTMLCode() const { - QString retStr; +TQString DefaultArea::getHTMLCode() const { + TQString retStr; retStr+="<area "; retStr+="shape=\"default\" "; @@ -1378,7 +1378,7 @@ void AreaSelection::reset() invalidate(); } -bool AreaSelection::contains(const QPoint & p) const +bool AreaSelection::contains(const TQPoint & p) const { bool b=false; AreaListIterator it=getAreaListIterator(); @@ -1395,14 +1395,14 @@ bool AreaSelection::contains(const QPoint & p) const return b; } -QRect* AreaSelection::onSelectionPoint(const QPoint & p, double zoom) const +TQRect* AreaSelection::onSelectionPoint(const TQPoint & p, double zoom) const { AreaListIterator it=getAreaListIterator(); if (it.count() != 1) return 0L; - QRect* retRect=0L; + TQRect* retRect=0L; for ( ; it.current() != 0L; ++it ) { @@ -1415,7 +1415,7 @@ QRect* AreaSelection::onSelectionPoint(const QPoint & p, double zoom) const return retRect; } -void AreaSelection::moveSelectionPoint(QRect* selectionPoint, const QPoint & p) +void AreaSelection::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p) { // It's only possible to move a SelectionPoint if only one Area is selected if (_areas->count() != 1) @@ -1439,7 +1439,7 @@ void AreaSelection::moveBy(int dx, int dy) invalidate(); } -QString AreaSelection::typeString() const +TQString AreaSelection::typeString() const { // if there is only one Area selected // show the name of that Area @@ -1480,12 +1480,12 @@ void AreaSelection::updateSelectionPoints() -QRect AreaSelection::selectionRect() const +TQRect AreaSelection::selectionRect() const { if (!_selectionCacheValid) { _selectionCacheValid=true; - QRect r; + TQRect r; AreaListIterator it=getAreaListIterator(); for ( ; it.current() != 0L; ++it ) @@ -1551,7 +1551,7 @@ void AreaSelection::setAreaList( const AreaList & areas ) invalidate(); } -void AreaSelection::setRect(const QRect & r) +void AreaSelection::setRect(const TQRect & r) { if ( _areas->count()==1 ) { @@ -1563,12 +1563,12 @@ void AreaSelection::setRect(const QRect & r) updateSelectionPoints(); } -QRect AreaSelection::rect() const +TQRect AreaSelection::rect() const { if (!_rectCacheValid) { _rectCacheValid=true; - QRect r; + TQRect r; AreaListIterator it=getAreaListIterator(); for ( ; it.current() != 0L; ++it ) @@ -1581,7 +1581,7 @@ QRect AreaSelection::rect() const } -int AreaSelection::addCoord(const QPoint & p) +int AreaSelection::addCoord(const TQPoint & p) { if ( _areas->count()==1 ) { @@ -1592,7 +1592,7 @@ int AreaSelection::addCoord(const QPoint & p) return 0; } -void AreaSelection::insertCoord(int pos, const QPoint & p) +void AreaSelection::insertCoord(int pos, const TQPoint & p) { if ( _areas->count()==1 ) { @@ -1610,7 +1610,7 @@ void AreaSelection::removeCoord(int pos) } } -bool AreaSelection::removeSelectionPoint(QRect * r) +bool AreaSelection::removeSelectionPoint(TQRect * r) { bool result=false; @@ -1634,7 +1634,7 @@ SelectionPointList* AreaSelection::selectionPoints() const } -void AreaSelection::moveCoord(int pos,const QPoint & p) +void AreaSelection::moveCoord(int pos,const TQPoint & p) { if ( _areas->count()==1 ) { @@ -1653,7 +1653,7 @@ void AreaSelection::highlightSelectionPoint(int i) } -QPointArray* AreaSelection::coords() const +TQPointArray* AreaSelection::coords() const { if ( _areas->count()==1 ) { @@ -1663,7 +1663,7 @@ QPointArray* AreaSelection::coords() const return Area::coords(); } -QString AreaSelection::attribute(const QString & name) const +TQString AreaSelection::attribute(const TQString & name) const { if ( _areas->count()==1 ) { @@ -1673,7 +1673,7 @@ QString AreaSelection::attribute(const QString & name) const return Area::attribute(name); } -void AreaSelection::setAttribute(const QString & name, const QString & value) +void AreaSelection::setAttribute(const TQString & name, const TQString & value) { AreaListIterator it=getAreaListIterator(); @@ -1728,7 +1728,7 @@ bool AreaSelection::isMoving() const * Checks if an area is outside the rectangle parameter * returns false if an area has no pixel in common with the rectangle parameter **/ -bool AreaSelection::allAreasWithin(const QRect & r) const +bool AreaSelection::allAreasWithin(const TQRect & r) const { if ( ! r.contains(rect()) ) { @@ -1743,7 +1743,7 @@ bool AreaSelection::allAreasWithin(const QRect & r) const } -void AreaSelection::draw(QPainter &) +void AreaSelection::draw(TQPainter &) {} |