summaryrefslogtreecommitdiffstats
path: root/src/modules/dcc/canvaswidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/dcc/canvaswidget.cpp')
-rw-r--r--src/modules/dcc/canvaswidget.cpp462
1 files changed, 207 insertions, 255 deletions
diff --git a/src/modules/dcc/canvaswidget.cpp b/src/modules/dcc/canvaswidget.cpp
index 203e0b36..65c37175 100644
--- a/src/modules/dcc/canvaswidget.cpp
+++ b/src/modules/dcc/canvaswidget.cpp
@@ -25,12 +25,12 @@
#ifdef COMPILE_DCC_CANVAS
-#include <qcursor.h>
-#include <qpainter.h>
-#include <qsimplerichtext.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qvalidator.h>
+#include <tqcursor.h>
+#include <tqpainter.h>
+#include <tqsimplerichtext.h>
+#include <tqlineedit.h>
+#include <tqcombobox.h>
+#include <tqvalidator.h>
#include <stdlib.h>
#include "kvi_string.h"
@@ -45,8 +45,8 @@
// KviCanvasRectangleItem
//
-KviCanvasRectangleItem::KviCanvasRectangleItem(QCanvas * c,int x,int y,int w,int h)
-: QCanvasRectangle(x,y,w,h,c)
+KviCanvasRectangleItem::KviCanvasRectangleItem(TQCanvas * c,int x,int y,int w,int h)
+: TQCanvasRectangle(x,y,w,h,c)
{
}
@@ -54,21 +54,21 @@ KviCanvasRectangleItem::~KviCanvasRectangleItem()
{
}
-void KviCanvasRectangleItem::drawSelection(QPainter &p)
+void KviCanvasRectangleItem::drawSelection(TQPainter &p)
{
p.setRasterOp(NotROP);
- p.fillRect((int)x() + 1,(int)y() + 1,width() - 2,height() - 2,QBrush(Dense6Pattern));
- p.setPen(QPen(DotLine));
+ p.fillRect((int)x() + 1,(int)y() + 1,width() - 2,height() - 2,TQBrush(Dense6Pattern));
+ p.setPen(TQPen(DotLine));
p.drawRect((int)x(),(int)y(),width(),height());
p.setRasterOp(CopyROP);
}
-void KviCanvasRectangleItem::setProperty(const QString &property,const QVariant &val)
+void KviCanvasRectangleItem::setProperty(const TQString &property,const TQVariant &val)
{
if(m_properties[property].isValid())
{
- m_properties.replace(property,val);
+ m_properties.tqreplace(property,val);
hide();
show();
}
@@ -83,14 +83,14 @@ void KviCanvasRectangleItem::setProperty(const QString &property,const QVariant
//
-KviCanvasPolygon::KviCanvasPolygon(QCanvas * c,int x,int y,QPointArray &pnts,double dScaleFactor)
-: QCanvasPolygon(c)
+KviCanvasPolygon::KviCanvasPolygon(TQCanvas * c,int x,int y,TQPointArray &pnts,double dScaleFactor)
+: TQCanvasPolygon(c)
{
- m_properties.insert("clrForeground",QVariant(QColor(0,0,0)));
- m_properties.insert("uLineWidth",QVariant((unsigned int)0));
+ m_properties.insert("clrForeground",TQVariant(TQColor(0,0,0)));
+ m_properties.insert("uLineWidth",TQVariant((unsigned int)0));
- m_properties.insert("clrBackground",QVariant(QColor(0,0,0)));
- m_properties.insert("bHasBackground",QVariant(false,1));
+ m_properties.insert("clrBackground",TQVariant(TQColor(0,0,0)));
+ m_properties.insert("bHasBackground",TQVariant(false,1));
m_dScaleFactor = dScaleFactor;
m_points = pnts;
@@ -110,7 +110,7 @@ void KviCanvasPolygon::setScaleFactor(double dScaleFactor)
resetPoints();
}
-void KviCanvasPolygon::setInternalPoints(const QPointArray &pnts)
+void KviCanvasPolygon::setInternalPoints(const TQPointArray &pnts)
{
m_points = pnts;
resetPoints();
@@ -119,7 +119,7 @@ void KviCanvasPolygon::setInternalPoints(const QPointArray &pnts)
void KviCanvasPolygon::resetPoints()
{
- QPointArray scaled(m_points.size());
+ TQPointArray scaled(m_points.size());
for(unsigned int i=0;i<m_points.size();i++)
{
int px;
@@ -137,55 +137,47 @@ int KviCanvasPolygon::rtti() const
return KVI_CANVAS_RTTI_POLYGON;
}
-void KviCanvasPolygon::setProperty(const QString &property,const QVariant &val)
+void KviCanvasPolygon::setProperty(const TQString &property,const TQVariant &val)
{
if(m_properties[property].isValid())
{
- m_properties.replace(property,val);
+ m_properties.tqreplace(property,val);
if((property == "clrForeground") || (property == "uLineWidth"))
{
- setPen(QPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
+ setPen(TQPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
} else if((property == "clrBackground") || (property == "bHasBackground"))
{
if(m_properties["bHasBackground"].asBool())
- setBrush(QBrush(m_properties["clrBackground"].asColor()));
+ setBrush(TQBrush(m_properties["clrBackground"].asColor()));
else
- setBrush(QBrush());
+ setBrush(TQBrush());
} else {
hide(); show();
}
}
}
-void KviCanvasPolygon::draw(QPainter &p)
+void KviCanvasPolygon::draw(TQPainter &p)
{
-#if QT_VERSION >= 300
if(isEnabled())
-#else
- if(enabled())
-#endif
{
p.setBrush(brush());
p.setPen(pen());
p.drawPolygon(areaPoints());
}
-#if QT_VERSION >=300
if(isSelected())
-#else
- if(selected())
-#endif
{
p.setRasterOp(NotROP);
- p.setPen(QPen(DotLine));
+ p.setPen(TQPen(DotLine));
p.drawPolygon(areaPoints());
- p.setBrush(QBrush());
+ p.setBrush(TQBrush());
double dVal = 10;
p.drawEllipse((int)(x() - dVal),(int)(y() - dVal),(int)(dVal * 2),(int)(dVal * 2));
p.drawLine((int)(x() - (dVal * 2)),(int)y(),(int)(x() + (dVal * 2)),(int)y());
p.drawLine((int)x(),(int)(y() - (dVal * 2)),(int)x(),(int)(y() + (dVal * 2)));
p.setRasterOp(CopyROP);
- canvas()->setChanged(QRect((int)(x() - dVal),(int)(y() - dVal),(int)(dVal * 4),(int)(dVal * 4)));
+ canvas()->setChanged(TQRect((int)(x() - dVal),(int)(y() - dVal),(int)(dVal * 4),(int)(dVal * 4)));
}
}
@@ -194,59 +186,51 @@ void KviCanvasPolygon::draw(QPainter &p)
// KviCanvasEllipticItem
//
-KviCanvasEllipticItem::KviCanvasEllipticItem(QCanvas * c,int x,int y,int w,int h)
+KviCanvasEllipticItem::KviCanvasEllipticItem(TQCanvas * c,int x,int y,int w,int h)
: KviCanvasRectangleItem(c,x,y,w,h)
{
- m_properties.insert("clrForeground",QVariant(QColor(0,0,0)));
- m_properties.insert("uLineWidth",QVariant((unsigned int)0));
+ m_properties.insert("clrForeground",TQVariant(TQColor(0,0,0)));
+ m_properties.insert("uLineWidth",TQVariant((unsigned int)0));
- m_properties.insert("clrBackground",QVariant(QColor(0,0,0)));
- m_properties.insert("bHasBackground",QVariant(false,1));
+ m_properties.insert("clrBackground",TQVariant(TQColor(0,0,0)));
+ m_properties.insert("bHasBackground",TQVariant(false,1));
-// m_properties.insert("iStartAngle",QVariant(0));
-// m_properties.insert("iEndAngle",QVariant(360));
+// m_properties.insert("iStartAngle",TQVariant(0));
+// m_properties.insert("iEndAngle",TQVariant(360));
}
KviCanvasEllipticItem::~KviCanvasEllipticItem()
{
}
-void KviCanvasEllipticItem::draw(QPainter &p)
+void KviCanvasEllipticItem::draw(TQPainter &p)
{
-#if QT_VERSION >= 300
if(isEnabled())
-#else
- if(enabled())
-#endif
{
- QBrush b = p.brush();
+ TQBrush b = p.brush();
if(m_properties["bHasBackground"].asBool())p.setBrush(m_properties["clrBackground"].asColor());
- else p.setBrush(QBrush());
+ else p.setBrush(TQBrush());
p.setPen(pen());
drawContent(p);
p.setBrush(b);
}
-#if QT_VERSION >= 300
if(isSelected())drawSelection(p);
-#else
- if(selected())drawSelection(p);
-#endif
}
-void KviCanvasEllipticItem::drawContent(QPainter &p)
+void KviCanvasEllipticItem::drawContent(TQPainter &p)
{
}
-void KviCanvasEllipticItem::setProperty(const QString & property,const QVariant &val)
+void KviCanvasEllipticItem::setProperty(const TQString & property,const TQVariant &val)
{
if(m_properties[property].isValid())
{
- m_properties.replace(property,val);
+ m_properties.tqreplace(property,val);
if((property == "clrForeground") || (property == "uLineWidth"))
{
- setPen(QPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
+ setPen(TQPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
} else {
hide(); show();
}
@@ -265,7 +249,7 @@ int KviCanvasEllipticItem::rtti() const
//
-KviCanvasEllipse::KviCanvasEllipse(QCanvas * c,int x,int y,int w,int h)
+KviCanvasEllipse::KviCanvasEllipse(TQCanvas * c,int x,int y,int w,int h)
: KviCanvasEllipticItem(c,x,y,w,h)
{
}
@@ -279,7 +263,7 @@ int KviCanvasEllipse::rtti() const
return KVI_CANVAS_RTTI_ELLIPSE;
}
-void KviCanvasEllipse::drawContent(QPainter &p)
+void KviCanvasEllipse::drawContent(TQPainter &p)
{
p.drawEllipse((int)x(),(int)y(),width(),height());
}
@@ -290,11 +274,11 @@ void KviCanvasEllipse::drawContent(QPainter &p)
//
-KviCanvasPie::KviCanvasPie(QCanvas * c,int x,int y,int w,int h)
+KviCanvasPie::KviCanvasPie(TQCanvas * c,int x,int y,int w,int h)
: KviCanvasEllipticItem(c,x,y,w,h)
{
- m_properties.insert("iStartAngle",QVariant((int)0));
- m_properties.insert("iExtensionAngle",QVariant((int)360));
+ m_properties.insert("iStartAngle",TQVariant((int)0));
+ m_properties.insert("iExtensionAngle",TQVariant((int)360));
}
KviCanvasPie::~KviCanvasPie()
@@ -306,7 +290,7 @@ int KviCanvasPie::rtti() const
return KVI_CANVAS_RTTI_PIE;
}
-void KviCanvasPie::drawContent(QPainter &p)
+void KviCanvasPie::drawContent(TQPainter &p)
{
int iStartAngle = m_properties["iStartAngle"].asInt() * 16;
int iEndAngle = m_properties["iExtensionAngle"].asInt() * 16;
@@ -320,11 +304,11 @@ void KviCanvasPie::drawContent(QPainter &p)
//
-KviCanvasChord::KviCanvasChord(QCanvas * c,int x,int y,int w,int h)
+KviCanvasChord::KviCanvasChord(TQCanvas * c,int x,int y,int w,int h)
: KviCanvasEllipticItem(c,x,y,w,h)
{
- m_properties.insert("iStartAngle",QVariant((int)0));
- m_properties.insert("iExtensionAngle",QVariant((int)360));
+ m_properties.insert("iStartAngle",TQVariant((int)0));
+ m_properties.insert("iExtensionAngle",TQVariant((int)360));
}
KviCanvasChord::~KviCanvasChord()
@@ -336,7 +320,7 @@ int KviCanvasChord::rtti() const
return KVI_CANVAS_RTTI_CHORD;
}
-void KviCanvasChord::drawContent(QPainter &p)
+void KviCanvasChord::drawContent(TQPainter &p)
{
int iStartAngle = m_properties["iStartAngle"].asInt() * 16;
int iEndAngle = m_properties["iExtensionAngle"].asInt() * 16;
@@ -348,14 +332,14 @@ void KviCanvasChord::drawContent(QPainter &p)
// KviCanvasRectangle
//
-KviCanvasRectangle::KviCanvasRectangle(QCanvas * c,int x,int y,int w,int h)
+KviCanvasRectangle::KviCanvasRectangle(TQCanvas * c,int x,int y,int w,int h)
: KviCanvasRectangleItem(c,x,y,w,h)
{
- m_properties.insert("clrForeground",QVariant(QColor(0,0,0)));
- m_properties.insert("uLineWidth",QVariant((unsigned int)0));
+ m_properties.insert("clrForeground",TQVariant(TQColor(0,0,0)));
+ m_properties.insert("uLineWidth",TQVariant((unsigned int)0));
- m_properties.insert("clrBackground",QVariant(QColor(0,0,0)));
- m_properties.insert("bHasBackground",QVariant(false,1));
+ m_properties.insert("clrBackground",TQVariant(TQColor(0,0,0)));
+ m_properties.insert("bHasBackground",TQVariant(false,1));
}
KviCanvasRectangle::~KviCanvasRectangle()
@@ -368,27 +352,23 @@ int KviCanvasRectangle::rtti() const
}
-void KviCanvasRectangle::setProperty(const QString &property,const QVariant &val)
+void KviCanvasRectangle::setProperty(const TQString &property,const TQVariant &val)
{
if(m_properties[property].isValid())
{
- m_properties.replace(property,val);
+ m_properties.tqreplace(property,val);
if((property == "clrForeground") || (property == "uLineWidth"))
{
- setPen(QPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
+ setPen(TQPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
} else {
hide(); show();
}
}
}
-void KviCanvasRectangle::draw(QPainter & p)
+void KviCanvasRectangle::draw(TQPainter & p)
{
-#if QT_VERSION >= 300
if(isEnabled())
-#else
- if(enabled())
-#endif
{
if(m_properties["bHasBackground"].asBool())
{
@@ -397,11 +377,7 @@ void KviCanvasRectangle::draw(QPainter & p)
p.setPen(pen());
p.drawRect((int)x(),(int)y(),width(),height());
}
-#if QT_VERSION >= 300
if(isSelected())drawSelection(p);
-#else
- if(selected())drawSelection(p);
-#endif
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -409,14 +385,14 @@ void KviCanvasRectangle::draw(QPainter & p)
// KviCanvasRichText
//
-KviCanvasRichText::KviCanvasRichText(QCanvas * c,int x,int y,int w,int h)
+KviCanvasRichText::KviCanvasRichText(TQCanvas * c,int x,int y,int w,int h)
: KviCanvasRectangleItem(c,x,y,w,h)
{
- QFont f = QFont();
- f.setStyleHint(QFont::SansSerif);
+ TQFont f = TQFont();
+ f.setStyleHint(TQFont::SansSerif);
f.setPointSize(12);
- m_properties.insert("szText",QVariant(QString("<center>Insert here your <font color=\"#FF0000\"><b>RICH TEXT</b></font></center>")));
- m_properties.insert("fntDefault",QVariant(f));
+ m_properties.insert("szText",TQVariant(TQString("<center>Insert here your <font color=\"#FF0000\"><b>RICH TEXT</b></font></center>")));
+ m_properties.insert("fntDefault",TQVariant(f));
}
KviCanvasRichText::~KviCanvasRichText()
@@ -428,28 +404,16 @@ int KviCanvasRichText::rtti() const
return KVI_CANVAS_RTTI_RICHTEXT;
}
-void KviCanvasRichText::draw(QPainter & p)
+void KviCanvasRichText::draw(TQPainter & p)
{
-#if QT_VERSION >= 300
if(isEnabled())
-#else
- if(enabled())
-#endif
{
- QString szText = m_properties["szText"].asString();
- QSimpleRichText text(szText,m_properties["fntDefault"].asFont());
+ TQString szText = m_properties["szText"].asString();
+ TQSimpleRichText text(szText,m_properties["fntDefault"].asFont());
text.setWidth(width());
-#if QT_VERSION >= 300
- text.draw(&p,(int)x() + 1,(int)y() + 1,QRegion(QRect((int)x() + 1,(int)y() + 1,width(),height())),QColorGroup());
-#else
- text.draw(&p,(int)x() + 1,(int)y() + 1,QRegion(QRect((int)x() + 1,(int)y() + 1,width(),height())),QPalette());
-#endif
+ text.draw(&p,(int)x() + 1,(int)y() + 1,TQRegion(TQRect((int)x() + 1,(int)y() + 1,width(),height())),TQColorGroup());
}
-#if QT_VERSION >= 300
if(isSelected())drawSelection(p);
-#else
- if(selected())drawSelection(p);
-#endif
}
@@ -461,24 +425,24 @@ void KviCanvasRichText::draw(QPainter & p)
//
-KviCanvasLine::KviCanvasLine(QCanvas * c,int x1,int y1,int x2,int y2)
-: QCanvasLine(c)
+KviCanvasLine::KviCanvasLine(TQCanvas * c,int x1,int y1,int x2,int y2)
+: TQCanvasLine(c)
{
setPoints(x1,y1,x2,y2);
- m_properties.insert("uLineWidth",QVariant((unsigned int)0));
- m_properties.insert("clrForeground",QVariant(QColor()));
+ m_properties.insert("uLineWidth",TQVariant((unsigned int)0));
+ m_properties.insert("clrForeground",TQVariant(TQColor()));
}
KviCanvasLine::~KviCanvasLine()
{
}
-void KviCanvasLine::setProperty(const QString &property,const QVariant &val)
+void KviCanvasLine::setProperty(const TQString &property,const TQVariant &val)
{
- m_properties.replace(property,val);
+ m_properties.tqreplace(property,val);
if((property == "uLineWidth") || (property == "clrForeground"))
{
- setPen(QPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
+ setPen(TQPen(m_properties["clrForeground"].asColor(),m_properties["uLineWidth"].toInt()));
}
}
@@ -487,26 +451,18 @@ int KviCanvasLine::rtti() const
return KVI_CANVAS_RTTI_LINE;
}
-void KviCanvasLine::draw(QPainter &p)
+void KviCanvasLine::draw(TQPainter &p)
{
-#if QT_VERSION >= 300
if(isEnabled())
-#else
- if(enabled())
-#endif
{
p.setPen(pen());
p.drawLine(startPoint(),endPoint());
}
-#if QT_VERSION >= 300
if(isSelected())
-#else
- if(selected())
-#endif
{
p.setRasterOp(NotROP);
- p.setPen(QPen(DotLine));
+ p.setPen(TQPen(DotLine));
p.drawLine(startPoint(),endPoint());
p.setRasterOp(CopyROP);
}
@@ -517,8 +473,8 @@ void KviCanvasLine::draw(QPainter &p)
// KviCanvasView
//
-KviCanvasView::KviCanvasView(QCanvas * c,KviCanvasWidget * cw,QWidget * par)
-: QCanvasView(c,par)
+KviCanvasView::KviCanvasView(TQCanvas * c,KviCanvasWidget * cw,TQWidget * par)
+: TQCanvasView(c,par)
{
m_pCanvasWidget = cw;
m_state = Idle;
@@ -610,7 +566,7 @@ void KviCanvasView::insertPolygonHexagon()
#define M_PI 3.14159265358979323846
#endif
-static void calcPolygonPoints(QPointArray &pnts,unsigned int nVertices)
+static void calcPolygonPoints(TQPointArray &pnts,unsigned int nVertices)
{
double dDelta = (2 * M_PI) / nVertices;
for(unsigned int i=0;i<nVertices;i++)
@@ -622,9 +578,9 @@ static void calcPolygonPoints(QPointArray &pnts,unsigned int nVertices)
}
}
-void KviCanvasView::insertObjectAt(const QPoint & pnt,ObjectType o)
+void KviCanvasView::insertObjectAt(const TQPoint & pnt,ObjectType o)
{
- QCanvasItem * r = 0;
+ TQCanvasItem * r = 0;
switch(o)
{
@@ -648,7 +604,7 @@ void KviCanvasView::insertObjectAt(const QPoint & pnt,ObjectType o)
break;
case PolygonTriangle:
{
- QPointArray pa(3);
+ TQPointArray pa(3);
pa.setPoint(0,0,-500);
pa.setPoint(1,-450,220);
pa.setPoint(2,450,220);
@@ -657,7 +613,7 @@ void KviCanvasView::insertObjectAt(const QPoint & pnt,ObjectType o)
break;
case PolygonRectangle:
{
- QPointArray pa(4);
+ TQPointArray pa(4);
pa.setPoint(0,-350,-350);
pa.setPoint(1,350,-350);
pa.setPoint(2,350,350);
@@ -667,14 +623,14 @@ void KviCanvasView::insertObjectAt(const QPoint & pnt,ObjectType o)
break;
case PolygonPentagon:
{
- QPointArray pa(5);
+ TQPointArray pa(5);
calcPolygonPoints(pa,5);
r = new KviCanvasPolygon(canvas(),pnt.x(),pnt.y(),pa,0.1);
}
break;
case PolygonHexagon:
{
- QPointArray pa(6);
+ TQPointArray pa(6);
calcPolygonPoints(pa,6);
r = new KviCanvasPolygon(canvas(),pnt.x(),pnt.y(),pa,0.1);
}
@@ -704,7 +660,7 @@ void KviCanvasView::insertObjectAt(const QPoint & pnt,ObjectType o)
// canvas()->update();
}
-void KviCanvasView::setItemSelected(QCanvasItem * it)
+void KviCanvasView::setItemSelected(TQCanvasItem * it)
{
clearSelection();
it->setSelected(true);
@@ -723,9 +679,9 @@ void KviCanvasView::clearSelection()
-void KviCanvasView::beginDragLine(KviCanvasLine * it,const QPoint &p,bool bInitial)
+void KviCanvasView::beginDragLine(KviCanvasLine * it,const TQPoint &p,bool bInitial)
{
- QPoint sp = it->startPoint();
+ TQPoint sp = it->startPoint();
m_dragBegin = p - sp;
@@ -755,26 +711,26 @@ void KviCanvasView::beginDragLine(KviCanvasLine * it,const QPoint &p,bool bIniti
setCursor(pointingHandCursor);
}
-void KviCanvasView::dragLine(KviCanvasLine * it,const QPoint &p)
+void KviCanvasView::dragLine(KviCanvasLine * it,const TQPoint &p)
{
switch(m_dragMode)
{
case Bottom:
{
- QPoint sp = it->startPoint();
+ TQPoint sp = it->startPoint();
it->setPoints(sp.x(),sp.y(),p.x(),p.y());
}
break;
case Top:
{
- QPoint ep = it->endPoint();
+ TQPoint ep = it->endPoint();
it->setPoints(p.x(),p.y(),ep.x(),ep.y());
}
break;
case All:
{
- QPoint sp = p - m_dragBegin;
- QPoint ep = sp + (it->endPoint() - it->startPoint());
+ TQPoint sp = p - m_dragBegin;
+ TQPoint ep = sp + (it->endPoint() - it->startPoint());
it->setPoints(sp.x(),sp.y(),ep.x(),ep.y());
}
break;
@@ -833,15 +789,15 @@ static double ssm_hypot(double a,double b)
return sqrt((a * a) + (b * b));
}
-void KviCanvasView::beginDragPolygon(KviCanvasPolygon * it,const QPoint &p,bool bShift,bool bCtrl)
+void KviCanvasView::beginDragPolygon(KviCanvasPolygon * it,const TQPoint &p,bool bShift,bool bCtrl)
{
- m_dragBegin = QPoint((int)(p.x() - it->x()),(int)(p.y() - it->y()));
+ m_dragBegin = TQPoint((int)(p.x() - it->x()),(int)(p.y() - it->y()));
- QPointArray pa = it->areaPoints();
+ TQPointArray pa = it->areaPoints();
for(unsigned int i=0;i<pa.size();i++)
{
- QPoint pnt = pa.point(i);
+ TQPoint pnt = pa.point(i);
double dX = pnt.x() - p.x();
double dY = pnt.y() - p.y();
double dHypot = sqrt((dX * dX) + (dY * dY));
@@ -876,7 +832,7 @@ void KviCanvasView::beginDragPolygon(KviCanvasPolygon * it,const QPoint &p,bool
setCursor(pointingHandCursor);
}
-void KviCanvasView::dragPolygon(KviCanvasPolygon * it,const QPoint &p)
+void KviCanvasView::dragPolygon(KviCanvasPolygon * it,const TQPoint &p)
{
switch(m_dragMode)
{
@@ -885,7 +841,7 @@ void KviCanvasView::dragPolygon(KviCanvasPolygon * it,const QPoint &p)
break;
case SinglePoint:
{
- QPointArray pnt = it->internalPoints();
+ TQPointArray pnt = it->internalPoints();
pnt.setPoint(m_dragPointIndex,(int)((p.x() - it->x()) / it->scaleFactor()),(int)((p.y() - it->y()) / it->scaleFactor()));
it->setInternalPoints(pnt);
}
@@ -901,13 +857,13 @@ void KviCanvasView::dragPolygon(KviCanvasPolygon * it,const QPoint &p)
break;
case Rotate:
{
- QPoint act((int)(p.x() - it->x()),(int)(p.y() - it->y()));
+ TQPoint act((int)(p.x() - it->x()),(int)(p.y() - it->y()));
double dAngle = ssm_2d_rotationAngle(m_dragBegin.x(),m_dragBegin.y(),act.x(),act.y());
// debug("%d,%d %d,%d %f",m_dragBegin.x(),m_dragBegin.y(),act.x(),act.y(),dAngle);
- QPointArray thePoints = m_dragPointArray.copy();
+ TQPointArray thePoints = m_dragPointArray.copy();
for(unsigned int i=0;i<thePoints.size();i++)
{
- QPoint tmp = thePoints.point(i);
+ TQPoint tmp = thePoints.point(i);
double dx = tmp.x();
double dy = tmp.y();
ssm_2d_rotate(dx,dy,dAngle);
@@ -922,9 +878,9 @@ void KviCanvasView::dragPolygon(KviCanvasPolygon * it,const QPoint &p)
canvas()->update();
}
-void KviCanvasView::beginDragRectangle(KviCanvasRectangleItem * it,const QPoint & p,bool bInitial)
+void KviCanvasView::beginDragRectangle(KviCanvasRectangleItem * it,const TQPoint & p,bool bInitial)
{
- m_dragBegin = QPoint((int)(p.x() - it->x()),(int)(p.y() - it->y()));
+ m_dragBegin = TQPoint((int)(p.x() - it->x()),(int)(p.y() - it->y()));
if(bInitial)
{
@@ -998,7 +954,7 @@ void KviCanvasView::beginDragRectangle(KviCanvasRectangleItem * it,const QPoint
setCursor(pointingHandCursor);
}
-void KviCanvasView::dragRectangle(KviCanvasRectangleItem * it,const QPoint & p)
+void KviCanvasView::dragRectangle(KviCanvasRectangleItem * it,const TQPoint & p)
{
int aux1,aux2,aux3,aux4;
@@ -1098,19 +1054,15 @@ void KviCanvasView::dragRectangle(KviCanvasRectangleItem * it,const QPoint & p)
canvas()->update();
}
-void KviCanvasView::contentsMouseMoveEvent(QMouseEvent *e)
+void KviCanvasView::contentsMouseMoveEvent(TQMouseEvent *e)
{
-// QPoint p = inverseWorldMatrix().map(e->pos());
- QPoint p = e->pos();
+// TQPoint p = inverseWorldMatrix().map(e->pos());
+ TQPoint p = e->pos();
if(e->state() & Qt::LeftButton)
{
if((m_dragMode != None) && (m_pSelectedItem))
{
-#if QT_VERSION >= 300
if(m_pSelectedItem->isEnabled())m_pSelectedItem->setEnabled(false);
-#else
- if(m_pSelectedItem->enabled())m_pSelectedItem->setEnabled(false);
-#endif
switch(KVI_CANVAS_RTTI_CONTROL_TYPE(m_pSelectedItem))
{
case KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE:
@@ -1128,13 +1080,13 @@ void KviCanvasView::contentsMouseMoveEvent(QMouseEvent *e)
// Without buttons
if(m_state == Idle)
{
- QCanvasItemList l = canvas()->collisions(p);
- QCanvasItemList::Iterator it = l.begin();
+ TQCanvasItemList l = canvas()->collisions(p);
+ TQCanvasItemList::Iterator it = l.begin();
if(it != l.end())
{
// Got an item
- QCanvasItem * hit = (QCanvasItem *)*it;
+ TQCanvasItem * hit = (TQCanvasItem *)*it;
// Now find the point on that we have clicked it
if(hit == m_pSelectedItem)
{
@@ -1159,7 +1111,7 @@ void KviCanvasView::contentsMouseMoveEvent(QMouseEvent *e)
}
}
-void KviCanvasView::contentsMouseReleaseEvent(QMouseEvent *e)
+void KviCanvasView::contentsMouseReleaseEvent(TQMouseEvent *e)
{
if(m_dragMode != None)
{
@@ -1174,12 +1126,12 @@ void KviCanvasView::contentsMouseReleaseEvent(QMouseEvent *e)
}
}
-void KviCanvasView::contentsMousePressEvent(QMouseEvent *e)
+void KviCanvasView::contentsMousePressEvent(TQMouseEvent *e)
{
if(e->button() & Qt::LeftButton)
{
-// QPoint p = inverseWorldMatrix().map(e->pos());
- QPoint p = e->pos();
+// TQPoint p = inverseWorldMatrix().map(e->pos());
+ TQPoint p = e->pos();
switch(m_state)
{
@@ -1193,13 +1145,13 @@ void KviCanvasView::contentsMousePressEvent(QMouseEvent *e)
case Idle:
{
- QCanvasItemList l = canvas()->collisions(p);
- QCanvasItemList::Iterator it = l.begin();
+ TQCanvasItemList l = canvas()->collisions(p);
+ TQCanvasItemList::Iterator it = l.begin();
if(it != l.end())
{
// Got an item
- QCanvasItem * hit = *it;
+ TQCanvasItem * hit = *it;
if(hit != m_pSelectedItem)
{
// Was not selected yet
@@ -1216,7 +1168,7 @@ void KviCanvasView::contentsMousePressEvent(QMouseEvent *e)
beginDragLine(((KviCanvasLine *)hit),p);
break;
case KVI_CANVAS_RTTI_CONTROL_TYPE_POLYGON:
- beginDragPolygon(((KviCanvasPolygon *)hit),p,e->state() & Qt::ShiftButton,e->state() & Qt::ControlButton);
+ beginDragPolygon(((KviCanvasPolygon *)hit),p,e->state() & TQt::ShiftButton,e->state() & TQt::ControlButton);
break;
}
} else {
@@ -1231,7 +1183,7 @@ void KviCanvasView::contentsMousePressEvent(QMouseEvent *e)
}
-void KviCanvasView::propertyChanged(const QString &s,const QVariant &v)
+void KviCanvasView::propertyChanged(const TQString &s,const TQVariant &v)
{
if(!m_pSelectedItem)return;
@@ -1260,8 +1212,8 @@ void KviCanvasView::propertyChanged(const QString &s,const QVariant &v)
-KviVariantTableItem::KviVariantTableItem(QTable * t,const QVariant & property)
-: QTableItem(t,QTableItem::WhenCurrent,QString::null)
+KviVariantTableItem::KviVariantTableItem(TQTable * t,const TQVariant & property)
+: TQTableItem(t,TQTableItem::WhenCurrent,TQString())
{
m_property = property;
}
@@ -1271,65 +1223,65 @@ KviVariantTableItem::~KviVariantTableItem()
}
-QWidget * KviVariantTableItem::createEditor() const
+TQWidget * KviVariantTableItem::createEditor() const
{
switch(m_property.type())
{
- case QVariant::String:
+ case TQVariant::String:
{
- QLineEdit * e = new QLineEdit(table()->viewport());
+ TQLineEdit * e = new TQLineEdit(table()->viewport());
e->setText(m_property.toString());
return e;
}
break;
- case QVariant::Int:
+ case TQVariant::Int:
{
- QLineEdit * e = new QLineEdit(table()->viewport());
- QString sz;
+ TQLineEdit * e = new TQLineEdit(table()->viewport());
+ TQString sz;
sz.setNum(m_property.toInt());
e->setText(sz);
- e->setValidator(new QIntValidator(e));
+ e->setValidator(new TQIntValidator(TQT_TQOBJECT(e)));
return e;
}
break;
- case QVariant::UInt:
+ case TQVariant::UInt:
{
- QLineEdit * e = new QLineEdit(table()->viewport());
- QString sz;
+ TQLineEdit * e = new TQLineEdit(table()->viewport());
+ TQString sz;
sz.setNum(m_property.toInt());
e->setText(sz);
- QIntValidator * i = new QIntValidator(e);
+ TQIntValidator * i = new TQIntValidator(TQT_TQOBJECT(e));
i->setBottom(0);
e->setValidator(i);
return e;
}
break;
- case QVariant::Bool:
+ case TQVariant::Bool:
{
- QComboBox * b = new QComboBox(false,table()->viewport());
+ TQComboBox * b = new TQComboBox(false,table()->viewport());
b->insertItem("FALSE");
b->insertItem("TRUE");
b->setCurrentItem(m_property.toBool() ? 1 : 0);
return b;
}
break;
- case QVariant::Color:
+ case TQVariant::Color:
{
- QLineEdit * e = new QLineEdit(table()->viewport());
+ TQLineEdit * e = new TQLineEdit(table()->viewport());
e->setText(m_property.toColor().name());
return e;
}
break;
- case QVariant::Font:
+ case TQVariant::Font:
{
- QComboBox * b = new QComboBox(true,table()->viewport());
+ TQComboBox * b = new TQComboBox(true,table()->viewport());
- QString tmp;
- QString tmpDefault;
- QFont f = QFont();
- f.setStyleHint(QFont::SansSerif);
+ TQString tmp;
+ TQString tmpDefault;
+ TQFont f = TQFont();
+ f.setStyleHint(TQFont::SansSerif);
tmpDefault = f.family();
- f.setStyleHint(QFont::TypeWriter);
+ f.setStyleHint(TQFont::TypeWriter);
tmp.setNum(m_property.toFont().pointSize());
tmp.prepend(", ");
tmp.prepend(m_property.toFont().family());
@@ -1346,7 +1298,7 @@ QWidget * KviVariantTableItem::createEditor() const
b->insertItem(tmpDefault + ", 32");
b->insertItem(tmpDefault + ", 40");
b->insertItem(tmpDefault + ", 48");
- b->insertItem(f.family() + ", 12");
+ b->insertItem(TQString(f.family()) + ", 12");
b->setCurrentItem(0);
b->setCurrentItem(m_property.toBool() ? 1 : 0);
@@ -1359,28 +1311,28 @@ QWidget * KviVariantTableItem::createEditor() const
return 0;
}
-void KviVariantTableItem::setContentFromEditor(QWidget * w)
+void KviVariantTableItem::setContentFromEditor(TQWidget * w)
{
switch(m_property.type())
{
- case QVariant::String:
- m_property = QVariant(((QLineEdit *)w)->text());
+ case TQVariant::String:
+ m_property = TQVariant(((TQLineEdit *)w)->text());
break;
- case QVariant::Int:
- m_property = QVariant(((QLineEdit *)w)->text().toInt());
+ case TQVariant::Int:
+ m_property = TQVariant(((TQLineEdit *)w)->text().toInt());
break;
- case QVariant::UInt:
- m_property = QVariant(((QLineEdit *)w)->text().toUInt());
+ case TQVariant::UInt:
+ m_property = TQVariant(((TQLineEdit *)w)->text().toUInt());
break;
- case QVariant::Bool:
- m_property = QVariant(((QComboBox *)w)->currentItem(),1);
+ case TQVariant::Bool:
+ m_property = TQVariant(((TQComboBox *)w)->currentItem(),1);
break;
- case QVariant::Color:
- m_property.asColor().setNamedColor(((QLineEdit *)w)->text());
+ case TQVariant::Color:
+ m_property.asColor().setNamedColor(((TQLineEdit *)w)->text());
break;
- case QVariant::Font:
+ case TQVariant::Font:
{
- KviStr txt = ((QComboBox *)w)->currentText();
+ KviStr txt = ((TQComboBox *)w)->currentText();
if(txt.hasData())
{
KviStr fam = txt;
@@ -1392,7 +1344,7 @@ void KviVariantTableItem::setContentFromEditor(QWidget * w)
bool bOk;
unsigned int uSize = psz.toUInt(&bOk);
if(!bOk)uSize = 12;
- m_property = QVariant(QFont(fam.ptr(),uSize));
+ m_property = TQVariant(TQFont(fam.ptr(),uSize));
}
}
@@ -1403,39 +1355,39 @@ void KviVariantTableItem::setContentFromEditor(QWidget * w)
}
-void KviVariantTableItem::paint(QPainter *p,const QColorGroup &cg,const QRect &cr,bool)
+void KviVariantTableItem::paint(TQPainter *p,const TQColorGroup &cg,const TQRect &cr,bool)
{
p->fillRect(0,0,cr.width(),cr.height(),cg.base());
- if(m_property.type() == QVariant::Color)
+ if(m_property.type() == TQVariant::Color)
{
p->fillRect(3,3,cr.width() - 6,cr.height() - 6,m_property.asColor());
} else {
- QString sz;
+ TQString sz;
switch(m_property.type())
{
- case QVariant::String:
+ case TQVariant::String:
sz = m_property.toString();
break;
- case QVariant::Bool:
+ case TQVariant::Bool:
sz = m_property.toBool() ? "TRUE" : "FALSE";
break;
- case QVariant::Font:
+ case TQVariant::Font:
sz.setNum(m_property.toFont().pointSize());
sz.prepend(", ");
sz.prepend(m_property.toFont().family());
break;
- case QVariant::Int:
+ case TQVariant::Int:
sz.setNum(m_property.toInt());
break;
- case QVariant::UInt:
+ case TQVariant::UInt:
sz.setNum(m_property.toUInt());
break;
default:
break;
}
p->setPen(cg.text());
- p->drawText(0,0,cr.width(),cr.height(),Qt::AlignLeft | Qt::AlignTop,sz);
+ p->drawText(0,0,cr.width(),cr.height(),TQt::AlignLeft | TQt::AlignTop,sz);
}
}
@@ -1446,10 +1398,10 @@ void KviVariantTableItem::paint(QPainter *p,const QColorGroup &cg,const QRect &c
//
-KviCanvasItemPropertiesWidget::KviCanvasItemPropertiesWidget(QWidget * par)
-: QTable(par)
+KviCanvasItemPropertiesWidget::KviCanvasItemPropertiesWidget(TQWidget * par)
+: TQTable(par)
{
- setSelectionMode(QTable::NoSelection);
+ setSelectionMode(TQTable::NoSelection);
setColumnMovingEnabled(false);
setRowMovingEnabled(false);
setShowGrid(true);
@@ -1457,7 +1409,7 @@ KviCanvasItemPropertiesWidget::KviCanvasItemPropertiesWidget(QWidget * par)
setSorting(false);
setLeftMargin(0);
verticalHeader()->hide();
- connect(this,SIGNAL(valueChanged(int,int)),this,SLOT(cellEdited(int,int)));
+ connect(this,TQT_SIGNAL(valueChanged(int,int)),this,TQT_SLOT(cellEdited(int,int)));
}
KviCanvasItemPropertiesWidget::~KviCanvasItemPropertiesWidget()
@@ -1466,15 +1418,15 @@ KviCanvasItemPropertiesWidget::~KviCanvasItemPropertiesWidget()
void KviCanvasItemPropertiesWidget::cellEdited(int row,int)
{
- QTableItem * it = item(row,0);
+ TQTableItem * it = item(row,0);
if(!it)return;
- QString szName = it->text();
+ TQString szName = it->text();
it = item(row,1);
if(!it)return;
emit propertyChanged(szName,((KviVariantTableItem *)it)->property());
}
-void KviCanvasItemPropertiesWidget::editItem(QCanvasItem * it)
+void KviCanvasItemPropertiesWidget::editItem(TQCanvasItem * it)
{
if(!it)
{
@@ -1488,7 +1440,7 @@ void KviCanvasItemPropertiesWidget::editItem(QCanvasItem * it)
return;
}
- QMap<QString,QVariant> * m = 0;
+ TQMap<TQString,TQVariant> * m = 0;
switch(KVI_CANVAS_RTTI_CONTROL_TYPE(it))
{
@@ -1518,13 +1470,13 @@ void KviCanvasItemPropertiesWidget::editItem(QCanvasItem * it)
setNumRows(m->count());
- QTableItem * item;
+ TQTableItem * item;
int idx = 0;
- for(QMap<QString,QVariant>::ConstIterator iter = m->begin();iter != m->end();++iter)
+ for(TQMap<TQString,TQVariant>::ConstIterator iter = m->begin();iter != m->end();++iter)
{
- item = new QTableItem(this,QTableItem::Never,iter.key().utf8().data());
+ item = new TQTableItem(this,TQTableItem::Never,iter.key().utf8().data());
setItem(idx,0,item);
item = new KviVariantTableItem(this,iter.data());
setItem(idx,1,item);
@@ -1538,42 +1490,42 @@ void KviCanvasItemPropertiesWidget::editItem(QCanvasItem * it)
// KviCanvasWidget
//
-KviCanvasWidget::KviCanvasWidget(QWidget * par)
-: QWidget(par,"canvas_widget")
+KviCanvasWidget::KviCanvasWidget(TQWidget * par)
+: TQWidget(par,"canvas_widget")
{
- m_pCanvas = new QCanvas(this);
+ m_pCanvas = new TQCanvas(TQT_TQOBJECT(this));
//#warning "Make this size as parameter of Dcc ?"
m_pCanvas->resize(648,480);
- m_pMenuBar = new QMenuBar(this);
- m_pSplitter = new QSplitter(QSplitter::Horizontal,this);
+ m_pMenuBar = new TQMenuBar(this);
+ m_pSplitter = new TQSplitter(Qt::Horizontal,this);
m_pCanvasView = new KviCanvasView(m_pCanvas,this,m_pSplitter);
- m_pStatusLabel = new QLabel(this);
+ m_pStatusLabel = new TQLabel(this);
m_pPropertiesWidget = new KviCanvasItemPropertiesWidget(m_pSplitter);
- QValueList<int> l;
+ TQValueList<int> l;
l.append(80);
l.append(20);
m_pSplitter->setSizes(l);
- connect(m_pPropertiesWidget,SIGNAL(propertyChanged(const QString &,const QVariant &)),m_pCanvasView,SLOT(propertyChanged(const QString &,const QVariant &)));
+ connect(m_pPropertiesWidget,TQT_SIGNAL(propertyChanged(const TQString &,const TQVariant &)),m_pCanvasView,TQT_SLOT(propertyChanged(const TQString &,const TQVariant &)));
KviTalPopupMenu * add = new KviTalPopupMenu(m_pMenuBar);
- KviTalPopupMenu * shapes = new KviTalPopupMenu(add);
+ KviTalPopupMenu * tqshapes = new KviTalPopupMenu(add);
KviTalPopupMenu * polygons = new KviTalPopupMenu(add);
KviTalPopupMenu * items = new KviTalPopupMenu(add);
- shapes->insertItem(__tr2qs_ctx("&Line","dcc"),m_pCanvasView,SLOT(insertLine()));
- shapes->insertItem(__tr2qs_ctx("&Rectangle","dcc"),m_pCanvasView,SLOT(insertRectangle()));
- shapes->insertItem(__tr2qs_ctx("&Ellipse","dcc"),m_pCanvasView,SLOT(insertEllipse()));
- shapes->insertItem(__tr2qs_ctx("&Pie","dcc"),m_pCanvasView,SLOT(insertPie()));
- shapes->insertItem(__tr2qs_ctx("&Chord","dcc"),m_pCanvasView,SLOT(insertChord()));
+ tqshapes->insertItem(__tr2qs_ctx("&Line","dcc"),m_pCanvasView,TQT_SLOT(insertLine()));
+ tqshapes->insertItem(__tr2qs_ctx("&Rectangle","dcc"),m_pCanvasView,TQT_SLOT(insertRectangle()));
+ tqshapes->insertItem(__tr2qs_ctx("&Ellipse","dcc"),m_pCanvasView,TQT_SLOT(insertEllipse()));
+ tqshapes->insertItem(__tr2qs_ctx("&Pie","dcc"),m_pCanvasView,TQT_SLOT(insertPie()));
+ tqshapes->insertItem(__tr2qs_ctx("&Chord","dcc"),m_pCanvasView,TQT_SLOT(insertChord()));
- items->insertItem(__tr2qs_ctx("&Rich text (html)","dcc"),m_pCanvasView,SLOT(insertRichText()));
+ items->insertItem(__tr2qs_ctx("&Rich text (html)","dcc"),m_pCanvasView,TQT_SLOT(insertRichText()));
- polygons->insertItem(__tr2qs_ctx("&Triangle","dcc"),m_pCanvasView,SLOT(insertPolygonTriangle()));
- polygons->insertItem(__tr2qs_ctx("&Rectangle","dcc"),m_pCanvasView,SLOT(insertPolygonRectangle()));
- polygons->insertItem(__tr2qs_ctx("&Pentagon","dcc"),m_pCanvasView,SLOT(insertPolygonPentagon()));
- polygons->insertItem(__tr2qs_ctx("&Hexagon","dcc"),m_pCanvasView,SLOT(insertPolygonHexagon()));
+ polygons->insertItem(__tr2qs_ctx("&Triangle","dcc"),m_pCanvasView,TQT_SLOT(insertPolygonTriangle()));
+ polygons->insertItem(__tr2qs_ctx("&Rectangle","dcc"),m_pCanvasView,TQT_SLOT(insertPolygonRectangle()));
+ polygons->insertItem(__tr2qs_ctx("&Pentagon","dcc"),m_pCanvasView,TQT_SLOT(insertPolygonPentagon()));
+ polygons->insertItem(__tr2qs_ctx("&Hexagon","dcc"),m_pCanvasView,TQT_SLOT(insertPolygonHexagon()));
- add->insertItem(__tr2qs_ctx("&Shape","dcc"),shapes);
+ add->insertItem(__tr2qs_ctx("&Shape","dcc"),tqshapes);
add->insertItem(__tr2qs_ctx("&Item","dcc"),items);
add->insertItem(__tr2qs_ctx("&Polygons","dcc"),polygons);
@@ -1586,11 +1538,11 @@ KviCanvasWidget::~KviCanvasWidget()
-void KviCanvasWidget::resizeEvent(QResizeEvent *)
+void KviCanvasWidget::resizeEvent(TQResizeEvent *)
{
- int h = m_pMenuBar->sizeHint().height();
+ int h = m_pMenuBar->tqsizeHint().height();
m_pMenuBar->setGeometry(0,0,width(),h);
- int h2 = m_pStatusLabel->sizeHint().height();
+ int h2 = m_pStatusLabel->tqsizeHint().height();
m_pStatusLabel->setGeometry(0,height() - h2,width(),h2);
m_pSplitter->setGeometry(0,h,width(),height() - (h + h2));
}