From e985f7e545f4739493965aad69bbecb136dc9346 Mon Sep 17 00:00:00 2001
From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Thu, 16 Jun 2011 19:02:47 +0000
Subject: TQt4 port kdewebdev This enables compilation under both Qt3 and Qt4

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 kimagemapeditor/kimearea.cpp | 218 +++++++++++++++++++++----------------------
 1 file changed, 109 insertions(+), 109 deletions(-)

(limited to 'kimagemapeditor/kimearea.cpp')

diff --git a/kimagemapeditor/kimearea.cpp b/kimagemapeditor/kimearea.cpp
index cee54b8a..4a6be5be 100644
--- a/kimagemapeditor/kimearea.cpp
+++ b/kimagemapeditor/kimearea.cpp
@@ -85,7 +85,7 @@ Area::~Area() {
 
 }
 
-bool Area::contains(const TQPoint &) const {
+bool Area::tqcontains(const TQPoint &) const {
   return false;
 }
 
@@ -100,7 +100,7 @@ TQString Area::attribute(const TQString & name) const
 
 void Area::setAttribute(const TQString & name, const TQString & value)
 {
-  _attributes.replace(name.lower(),value);
+  _attributes.tqreplace(name.lower(),value);
   if (value.isEmpty())
      _attributes.remove(name.lower());
 }
@@ -279,9 +279,9 @@ void Area::removeCoord(int pos) {
 
 bool Area::removeSelectionPoint(TQRect * r)
 {
-  if (_selectionPoints->contains(r))
+  if (_selectionPoints->tqcontains(r))
   {
-    removeCoord(_selectionPoints->find(r));
+    removeCoord(_selectionPoints->tqfind(r));
     return true;
   }
 
@@ -319,7 +319,7 @@ void Area::drawHighlighting(TQPainter & p)
 {
 	if (Area::highlightArea && !isMoving() && _highlightedPixmap)
 	{
-  	p.setRasterOp(Qt::CopyROP);
+  	p.setRasterOp(TQt::CopyROP);
   	
   	TQPoint point = TQPoint(rect().x(),rect().y());
     if (point.x()<0)
@@ -336,10 +336,10 @@ void Area::drawAlt(TQPainter & p)
 {
   double x,y;
 
-  double scalex = p.worldMatrix().m11();
-//  double scaley = p.worldMatrix().m12();
+  double scalex = p.tqworldMatrix().m11();
+//  double scaley = p.tqworldMatrix().m12();
 
-  TQWMatrix oldMatrix = p.worldMatrix();
+  TQWMatrix oldMatrix = p.tqworldMatrix();
 
   p.setWorldMatrix(TQWMatrix(1,oldMatrix.m12(), oldMatrix.m21(), 1, oldMatrix.dx(), oldMatrix.dy() ));
 
@@ -356,12 +356,12 @@ void Area::drawAlt(TQPainter & p)
 
   if (highlightArea)
   {
-    p.setRasterOp(Qt::CopyROP);
-    p.setPen(Qt::black);
+    p.setRasterOp(TQt::CopyROP);
+    p.setPen(TQt::black);
   }
   else
   {
-    p.setRasterOp(Qt::XorROP);
+    p.setRasterOp(TQt::XorROP);
   	p.setPen(TQPen(TQColor("white"),1));
 	}
 
@@ -379,10 +379,10 @@ void Area::draw(TQPainter & p)
   {
 		int i=0;
 
-    double scalex = p.worldMatrix().m11();
-//    double scaley = p.worldMatrix().m12();
+    double scalex = p.tqworldMatrix().m11();
+//    double scaley = p.tqworldMatrix().m12();
 
-    TQWMatrix oldMatrix = p.worldMatrix();
+    TQWMatrix oldMatrix = p.tqworldMatrix();
 
     p.setWorldMatrix(TQWMatrix(1,oldMatrix.m12(), oldMatrix.m21(), 1, oldMatrix.dx(), oldMatrix.dy() ));
 
@@ -392,15 +392,15 @@ void Area::draw(TQPainter & p)
 			if (i==currentHighlighted) {
 				TQRect r2(0,0,15,15);
 				r2.moveCenter(r->center()*scalex);
-				p.setRasterOp(Qt::CopyROP);
+				p.setRasterOp(TQt::CopyROP);
 				p.setPen(TQPen(TQColor("lightgreen"),2));
 				p.drawEllipse(r2);
-				p.setRasterOp(Qt::XorROP);
+				p.setRasterOp(TQt::XorROP);
 				p.setPen(TQPen(TQColor("white"),1));
 			}
 
 			// Draw the selection point
-			p.setRasterOp(Qt::XorROP);
+			p.setRasterOp(TQt::XorROP);
 
 			TQRect r3(*r);
       int d = 1;
@@ -415,7 +415,7 @@ void Area::draw(TQPainter & p)
 
 			r3.setSize(r3.size()+TQSize(2,2));
 //+			r3.moveBy(-1,-1);	
-			p.setRasterOp(Qt::CopyROP);
+			p.setRasterOp(TQt::CopyROP);
 			p.setPen(TQPen(TQColor("lightgreen"),1));
 			p.setBrush(TQColor("lightgreen"));
 			p.drawPie(r3,0,5760);
@@ -435,7 +435,7 @@ void Area::draw(TQPainter & p)
   {
      drawAlt(p);
    }
-  p.setRasterOp(Qt::XorROP);
+  p.setRasterOp(TQt::XorROP);
 	
 }
 
@@ -447,7 +447,7 @@ TQRect* Area::onSelectionPoint(const TQPoint & p, double zoom) const
 
     r2.moveCenter(r2.center()*zoom);
 
-    if (r2.contains(p))
+    if (r2.tqcontains(p))
     {
 
 			return r;
@@ -477,12 +477,12 @@ TQPixmap Area::cutOut(const TQImage & image)
 		return dummyPix;
 	}
 
-	// Get the mask from the subclasses
-	TQBitmap mask=getMask();
+	// Get the tqmask from the subclasses
+	TQBitmap tqmask=getMask();
 			
 	// The rectangle which is part of the image
 	TQRect partOfImage=rect();
-	TQRect partOfMask(0,0,mask.width(),mask.height());
+	TQRect partOfMask(0,0,tqmask.width(),tqmask.height());
 	
 	
 	// If the area is outside of the image make the
@@ -507,8 +507,8 @@ TQPixmap Area::cutOut(const TQImage & image)
 		partOfMask.setY(myabs(rect().y()));
 	}
 		
-  TQImage tempImage=mask.convertToImage().copy(partOfMask);
-	mask.convertFromImage(tempImage);
+  TQImage tempImage=tqmask.convertToImage().copy(partOfMask);
+	tqmask.convertFromImage(tempImage);
 
 //  partOfImage = partOfImage.normalize();
 	TQImage cut=image.copy(partOfImage);
@@ -521,23 +521,23 @@ TQPixmap Area::cutOut(const TQImage & image)
 	            << partOfMask.width() << "," << partOfMask.height() << "," << endl;
 
 /*	            	
-	TQBitmap mask2(partOfMask.width(), partOfMask.height());
-	TQPainter p4(&mask2);
-	p4.drawPixmap( TQPoint(0,0) ,mask,partOfMask);
+	TQBitmap tqmask2(partOfMask.width(), partOfMask.height());
+	TQPainter p4(&tqmask2);
+	p4.drawPixmap( TQPoint(0,0) ,tqmask,partOfMask);
 	p4.flush();
 	p4.end();
 */
 	
 	pix.convertFromImage(cut);
 
-	setHighlightedPixmap(cut, mask);
+	setHighlightedPixmap(cut, tqmask);
 		
 	TQPixmap retPix(pix.width(),pix.height());
   TQPainter p3(&retPix);
 	
 	// if transparent image fill the background
 	// with gimp-like rectangles
-	if (pix.mask()) {
+	if (pix.tqmask()) {
   	TQPixmap backPix(32,32);
   	
   	// Gimp like transparent rectangle
@@ -555,7 +555,7 @@ TQPixmap Area::cutOut(const TQImage & image)
 	p3.drawPixmap(TQPoint(0,0),pix);
 	p3.flush();
 	p3.end();
-	retPix.setMask(mask);
+	retPix.setMask(tqmask);
 
 	return retPix;
 }
@@ -566,7 +566,7 @@ TQBitmap Area::getMask() const
 	return b;
 }
 
-void Area::setHighlightedPixmap( TQImage & im, TQBitmap & mask )
+void Area::setHighlightedPixmap( TQImage & im, TQBitmap & tqmask )
 {
   if (!Area::highlightArea)
      return;
@@ -584,9 +584,9 @@ void Area::setHighlightedPixmap( TQImage & im, TQBitmap & mask )
   {
     for (int x=0; x < size.width(); x++)
     {
-      r = qRed(image.pixel(x,y));
-      g = qGreen(image.pixel(x,y));
-      b = qBlue(image.pixel(x,y));
+      r = tqRed(image.pixel(x,y));
+      g = tqGreen(image.pixel(x,y));
+      b = tqBlue(image.pixel(x,y));
       r = (r *123 / 255)+132;
       g = (g *123 / 255)+132;
       b = (b *123 / 255)+132;
@@ -598,7 +598,7 @@ void Area::setHighlightedPixmap( TQImage & im, TQBitmap & mask )
 
   _highlightedPixmap = new TQPixmap();
   _highlightedPixmap->convertFromImage( image );
-  _highlightedPixmap->setMask( mask );
+  _highlightedPixmap->setMask( tqmask );
 
   if (_highlightedPixmap->isNull())
      kdDebug() << "HighlightedPixmap is null" << endl;
@@ -639,15 +639,15 @@ void RectArea::draw(TQPainter & p)
 {
 
   drawHighlighting(p);
-//  p.setRasterOp(Qt::CopyROP);
-//  p.setRasterOp(Qt:: OrROP);
+//  p.setRasterOp(TQt::CopyROP);
+//  p.setRasterOp(TQt:: OrROP);
 //  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.setRasterOp(TQt::XorROP);
 	p.setPen(TQPen(TQColor("white"),1));
   TQRect r(rect());
   r.setWidth(r.width()+1);
@@ -659,32 +659,32 @@ void RectArea::draw(TQPainter & p)
 
 TQBitmap RectArea::getMask() const
 {
-	TQBitmap mask(rect().width(),rect().height());
+	TQBitmap tqmask(rect().width(),rect().height());
 	
-	mask.fill(Qt::color0);
-	TQPainter p(&mask);
-	p.setBackgroundColor(Qt::color0);
-	p.setPen(Qt::color1);
-	p.setBrush(Qt::color1);
-	mask.fill(Qt::color1);
+	tqmask.fill(TQt::color0);
+	TQPainter p(&tqmask);
+	p.setBackgroundColor(TQt::color0);
+	p.setPen(TQt::color1);
+	p.setBrush(TQt::color1);
+	tqmask.fill(TQt::color1);
 	p.end();
 	
-	return mask;
+	return tqmask;
 }
 
 TQString RectArea::coordsToString() const
 {
 	TQString retStr=TQString("%1,%2,%3,%4")
-					.arg(rect().left())
-					.arg(rect().top())
-					.arg(rect().right())
-					.arg(rect().bottom());
+					.tqarg(rect().left())
+					.tqarg(rect().top())
+					.tqarg(rect().right())
+					.tqarg(rect().bottom());
 
 	return retStr;					
 }
 
-bool RectArea::contains(const TQPoint & p) const{
-	return rect().contains(p);
+bool RectArea::tqcontains(const TQPoint & p) const{
+	return rect().tqcontains(p);
 }
 
 void RectArea::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p)
@@ -747,7 +747,7 @@ bool RectArea::setCoords(const TQString & s)
 TQString RectArea::getHTMLCode() const {
 	TQString retStr;
 	retStr+="<area ";
-	retStr+="shape=\"rect\" ";
+	retStr+="tqshape=\"rect\" ";
 	
 	retStr+=getHTMLAttributes();
 	
@@ -791,7 +791,7 @@ void CircleArea::draw(TQPainter & p)
   drawHighlighting(p);
 
 /*
-  p.setRasterOp(Qt::CopyROP);
+  p.setRasterOp(TQt::CopyROP);
 	TQBrush bold = p.brush();
 	TQBrush b(TQBrush::Dense5Pattern);
 	b.setColor(TQColor("green"));
@@ -802,7 +802,7 @@ void CircleArea::draw(TQPainter & p)
 	p.drawChord(r,0,5760);
 	p.setBrush(bold);
 */	
-  p.setRasterOp(Qt::XorROP);
+  p.setRasterOp(TQt::XorROP);
   p.setPen(TQPen(TQColor("white"),1));
 
   TQRect r(_rect);
@@ -815,36 +815,36 @@ void CircleArea::draw(TQPainter & p)
 
 TQBitmap CircleArea::getMask() const
 {
-	TQBitmap mask(_rect.width(),_rect.height());
+	TQBitmap tqmask(_rect.width(),_rect.height());
 	
-	mask.fill(Qt::color0);
-	TQPainter p(&mask);
-	p.setBackgroundColor(Qt::color0);
-	p.setPen(Qt::color1);
-	p.setBrush(Qt::color1);
+	tqmask.fill(TQt::color0);
+	TQPainter p(&tqmask);
+	p.setBackgroundColor(TQt::color0);
+	p.setPen(TQt::color1);
+	p.setBrush(TQt::color1);
 	p.drawPie(TQRect(0,0,_rect.width(),_rect.height()),0,5760);
 	p.flush();
 	p.end();
 	
 	
-	return mask;
+	return tqmask;
 
 }
 
 TQString CircleArea::coordsToString() const
 {
 	TQString retStr=TQString("%1,%2,%3")
-					.arg(_rect.center().x())
-					.arg(_rect.center().y())
-					.arg(_rect.width()/2);
+					.tqarg(_rect.center().x())
+					.tqarg(_rect.center().y())
+					.tqarg(_rect.width()/2);
 	
 	return retStr;
 }
 
-bool CircleArea::contains(const TQPoint & p) const
+bool CircleArea::tqcontains(const TQPoint & p) const
 {
 	TQRegion r(_rect,TQRegion::Ellipse);
-	return r.contains(p);
+	return r.tqcontains(p);
 }
 
 void CircleArea::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p)
@@ -949,7 +949,7 @@ bool CircleArea::setCoords(const TQString & s)
 TQString CircleArea::getHTMLCode() const {
 	TQString retStr;
 	retStr+="<area ";
-	retStr+="shape=\"circle\" ";
+	retStr+="tqshape=\"circle\" ";
 	
 	retStr+=getHTMLAttributes();
 	
@@ -985,16 +985,16 @@ void PolyArea::draw(TQPainter & p)
 {
   drawHighlighting(p);
 	
-	p.setRasterOp(Qt::XorROP);
+	p.setRasterOp(TQt::XorROP);
 	p.setPen(TQPen(TQColor("white"),1));
  	if (_coords->count()==0) return;
 
 
 
  	if (_finished)
-    p.drawPolygon ( *_coords,false,0,_coords->count());
+    p.tqdrawPolygon ( *_coords,false,0,_coords->count());
   else
-    p.drawPolyline ( *_coords,0,_coords->count());
+    p.tqdrawPolyline ( *_coords,0,_coords->count());
 
 /*
  	p.moveTo(_coords->point(0));
@@ -1009,22 +1009,22 @@ void PolyArea::draw(TQPainter & p)
 
 TQBitmap PolyArea::getMask() const
 {
-	TQBitmap mask(_rect.width(),_rect.height());
+	TQBitmap tqmask(_rect.width(),_rect.height());
 	
-	mask.fill(Qt::color0);
-	TQPainter p(&mask);
-	p.setBackgroundColor(Qt::color0);
-	p.setPen(Qt::color1);
-	p.setBrush(Qt::color1);
+	tqmask.fill(TQt::color0);
+	TQPainter p(&tqmask);
+	p.setBackgroundColor(TQt::color0);
+	p.setPen(TQt::color1);
+	p.setBrush(TQt::color1);
  	p.setClipping(true);
  	TQRegion r(*_coords);
  	r.translate(-_rect.left(),-_rect.top());
  	p.setClipRegion(r);
- 	p.fillRect(TQRect(0,0,_rect.width(),_rect.height()),Qt::color1);
+ 	p.fillRect(TQRect(0,0,_rect.width(),_rect.height()),TQt::color1);
  	p.flush();
 	p.end();
 	
-	return mask;
+	return tqmask;
 }
 
 TQString PolyArea::coordsToString() const
@@ -1033,8 +1033,8 @@ TQString PolyArea::coordsToString() const
  	
  	for (uint i=0;i<_coords->count();i++) {
  		retStr.append(TQString("%1,%2,")
- 			.arg(_coords->point(i).x())
- 			.arg(_coords->point(i).y()));
+ 			.tqarg(_coords->point(i).x())
+ 			.tqarg(_coords->point(i).y()));
  	}
  	
  	retStr.remove(retStr.length()-1,1);
@@ -1160,12 +1160,12 @@ int PolyArea::addCoord(const TQPoint & p)
 
 }		
 
-bool PolyArea::contains(const TQPoint & p) const
+bool PolyArea::tqcontains(const TQPoint & p) const
 {
 	// A line can't contain a point
  	if (_coords->count() >2 ) {
  		TQRegion r(*_coords);
- 		return r.contains(p);
+ 		return r.tqcontains(p);
  	}
  	else
  		return false;
@@ -1224,7 +1224,7 @@ bool PolyArea::setCoords(const TQString & s)
 TQString PolyArea::getHTMLCode() const {
 	TQString retStr;
 	retStr+="<area ";
-	retStr+="shape=\"poly\" ";
+	retStr+="tqshape=\"poly\" ";
 
 	retStr+=getHTMLAttributes();
 		
@@ -1283,7 +1283,7 @@ void DefaultArea::draw(TQPainter &)
 TQString DefaultArea::getHTMLCode() const {
 	TQString retStr;
 	retStr+="<area ";
-	retStr+="shape=\"default\" ";
+	retStr+="tqshape=\"default\" ";
 
 	retStr+=getHTMLAttributes();
 		
@@ -1302,7 +1302,7 @@ AreaSelection::AreaSelection()
 {
 	_areas = new AreaList();
 	_name = "Selection";
-	invalidate();
+	tqinvalidate();
 }
 
 AreaSelection::~AreaSelection() {
@@ -1338,7 +1338,7 @@ void AreaSelection::add(Area *a)
 		
 		for (Area* area = list.first(); area != 0L; area = list.next() )
 		{
-			if ( _areas->find( area ) == -1 ) {
+			if ( _areas->tqfind( area ) == -1 ) {
 				_areas->append( area );  // Must come before area->setSelected
 				area->setSelected( true );
 			}
@@ -1346,23 +1346,23 @@ void AreaSelection::add(Area *a)
 	}
 	else
 	{
-		if ( _areas->find( a ) == -1 ) {
+		if ( _areas->tqfind( a ) == -1 ) {
   		_areas->append( a );  // Must come before a->setSelected
   		a->setSelected( true );
   	}
   }
 
-	invalidate();
+	tqinvalidate();
 }
 
 void AreaSelection::remove(Area *a)
 {
-	if (_areas->find(a) == -1)
+	if (_areas->tqfind(a) == -1)
 		return;
 		
 	a->setSelected( false );	
 	_areas->remove( a );
-	invalidate();
+	tqinvalidate();
 }
 
 void AreaSelection::reset()
@@ -1375,17 +1375,17 @@ void AreaSelection::reset()
   }
  	
  	_areas->clear();
-	invalidate();
+	tqinvalidate();
 }
 
-bool AreaSelection::contains(const TQPoint & p) const
+bool AreaSelection::tqcontains(const TQPoint & p) const
 {
 	bool b=false;
   AreaListIterator it=getAreaListIterator();
 
   for ( ; it.current() != 0L; ++it )
   {
-  	if ( it.current()->contains( p ) )
+  	if ( it.current()->tqcontains( p ) )
   	{
   		b=true;
   		break;
@@ -1423,7 +1423,7 @@ void AreaSelection::moveSelectionPoint(TQRect* selectionPoint, const TQPoint & p
 		
 	_areas->getFirst()->moveSelectionPoint(selectionPoint,p);		
 
-	invalidate();
+	tqinvalidate();
 }
 
 
@@ -1436,7 +1436,7 @@ void AreaSelection::moveBy(int dx, int dy)
 
 	Area::moveBy( dx, dy );  	
 
-	invalidate();
+	tqinvalidate();
 }
 
 TQString AreaSelection::typeString() const
@@ -1474,7 +1474,7 @@ void AreaSelection::updateSelectionPoints()
 		it.current()->updateSelectionPoints();
   }
 
- 	invalidate();
+ 	tqinvalidate();
 
 }
 
@@ -1525,7 +1525,7 @@ void AreaSelection::setArea(const Area & copy)
 		setAreaSelection(*selection);
 	else {	
     Area::setArea(copy);
-  	invalidate();
+  	tqinvalidate();
   }
 }
 
@@ -1541,14 +1541,14 @@ void AreaSelection::setAreaSelection(const AreaSelection & copy)
    	it.current()->setArea(*it2.current());
 
   Area::setArea(copy);
-	invalidate();
+	tqinvalidate();
 }
 
 void AreaSelection::setAreaList( const AreaList & areas )
 {
 	delete _areas;
 	_areas = new AreaList(areas);
-	invalidate();
+	tqinvalidate();
 }
 
 void AreaSelection::setRect(const TQRect & r)
@@ -1558,7 +1558,7 @@ void AreaSelection::setRect(const TQRect & r)
 		_areas->getFirst()->setRect(r);
 	}
 
-	invalidate();
+	tqinvalidate();
 	_rect=rect();
 	updateSelectionPoints();
 }
@@ -1586,7 +1586,7 @@ int AreaSelection::addCoord(const TQPoint & p)
 	if ( _areas->count()==1 )
 	{
 		return _areas->getFirst()->addCoord(p);
-		invalidate();
+		tqinvalidate();
 	}
 
   return 0;	
@@ -1597,7 +1597,7 @@ void AreaSelection::insertCoord(int pos, const TQPoint & p)
 	if ( _areas->count()==1 )
 	{
 		_areas->getFirst()->insertCoord(pos, p);
-		invalidate();
+		tqinvalidate();
 	}	
 }
 
@@ -1606,7 +1606,7 @@ void AreaSelection::removeCoord(int pos)
 	if ( _areas->count()==1 )
 	{
 		_areas->getFirst()->removeCoord(pos);
-		invalidate();
+		tqinvalidate();
 	}	
 }
 
@@ -1617,7 +1617,7 @@ bool AreaSelection::removeSelectionPoint(TQRect * r)
 	if ( _areas->count()==1 )
 	{
 		result = _areas->getFirst()->removeSelectionPoint(r);
-		invalidate();
+		tqinvalidate();
 	}	
 	
 	return result;
@@ -1639,7 +1639,7 @@ void AreaSelection::moveCoord(int pos,const TQPoint & p)
 	if ( _areas->count()==1 )
 	{
 		_areas->getFirst()->moveCoord(pos,p);
-		invalidate();
+		tqinvalidate();
 	}	
 }
 
@@ -1648,7 +1648,7 @@ void AreaSelection::highlightSelectionPoint(int i)
 	if ( _areas->count()==1 )
 	{
 		_areas->getFirst()->highlightSelectionPoint(i);
-		invalidate();
+		tqinvalidate();
 	}	
 }
 
@@ -1730,7 +1730,7 @@ bool AreaSelection::isMoving() const
  **/
 bool AreaSelection::allAreasWithin(const TQRect & r) const
 {
-  if ( ! r.contains(rect()) )
+  if ( ! r.tqcontains(rect()) )
   {
     AreaListIterator it=getAreaListIterator();
 
-- 
cgit v1.2.1