diff options
Diffstat (limited to 'krita/ui/kcurve.cc')
-rw-r--r-- | krita/ui/kcurve.cc | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/krita/ui/kcurve.cc b/krita/ui/kcurve.cc index 8e50804f..59aa7efc 100644 --- a/krita/ui/kcurve.cc +++ b/krita/ui/kcurve.cc @@ -20,17 +20,17 @@ #include <cmath> #include <cstdlib> -// Qt includes. - -#include <qpixmap.h> -#include <qpainter.h> -#include <qpoint.h> -#include <qpen.h> -#include <qevent.h> -#include <qtimer.h> -#include <qrect.h> -#include <qfont.h> -#include <qfontmetrics.h> +// TQt includes. + +#include <tqpixmap.h> +#include <tqpainter.h> +#include <tqpoint.h> +#include <tqpen.h> +#include <tqevent.h> +#include <tqtimer.h> +#include <tqrect.h> +#include <tqfont.h> +#include <tqfontmetrics.h> // KDE includes. @@ -42,8 +42,8 @@ #include "kcurve.h" -KCurve::KCurve(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) +KCurve::KCurve(TQWidget *tqparent, const char *name, WFlags f) + : TQWidget(tqparent, name, f) { m_grab_point = NULL; m_readOnlyMode = false; @@ -52,16 +52,16 @@ KCurve::KCurve(QWidget *parent, const char *name, WFlags f) m_pix = NULL; setMouseTracking(true); - setPaletteBackgroundColor(Qt::NoBackground); + setPaletteBackgroundColor(TQt::NoBackground); setMinimumSize(150, 50); - QPair<double,double> *p = new QPair<double,double>; + TQPair<double,double> *p = new TQPair<double,double>; p->first = 0.0; p->second=0.0; m_points.append(p); - p = new QPair<double,double>; + p = new TQPair<double,double>; p->first = 1.0; p->second=1.0; m_points.append(p); m_points.setAutoDelete(true); - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(TQ_StrongFocus); } KCurve::~KCurve() @@ -73,32 +73,32 @@ void KCurve::reset(void) { m_grab_point = NULL; m_guideVisible = false; - repaint(false); + tqrepaint(false); } -void KCurve::setCurveGuide(QColor color) +void KCurve::setCurveGuide(TQColor color) { m_guideVisible = true; m_colorGuide = color; - repaint(false); + tqrepaint(false); } -void KCurve::setPixmap(QPixmap pix) +void KCurve::setPixmap(TQPixmap pix) { if (m_pix) delete m_pix; - m_pix = new QPixmap(pix); - repaint(false); + m_pix = new TQPixmap(pix); + tqrepaint(false); } -void KCurve::keyPressEvent(QKeyEvent *e) +void KCurve::keyPressEvent(TQKeyEvent *e) { - if(e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) + if(e->key() == TQt::Key_Delete || e->key() == TQt::Key_Backspace) { - QPair<double,double> *closest_point=NULL; + TQPair<double,double> *closest_point=NULL; if(m_grab_point) { //first find closest point to get focus afterwards - QPair<double,double> *p = m_points.first(); + TQPair<double,double> *p = m_points.first(); double distance = 1000; // just a big number while(p) { @@ -113,13 +113,13 @@ void KCurve::keyPressEvent(QKeyEvent *e) m_points.remove(m_grab_point); } m_grab_point = closest_point; - repaint(false); + tqrepaint(false); } else - QWidget::keyPressEvent(e); + TQWidget::keyPressEvent(e); } -void KCurve::paintEvent(QPaintEvent *) +void KCurve::paintEvent(TQPaintEvent *) { int x, y; int wWidth = width(); @@ -129,10 +129,10 @@ void KCurve::paintEvent(QPaintEvent *) y = 0; // Drawing selection or all histogram values. - // A QPixmap is used for enable the double buffering. + // A TQPixmap is used for enable the double buffering. - QPixmap pm(size()); - QPainter p1; + TQPixmap pm(size()); + TQPainter p1; p1.begin(&pm, this); // draw background @@ -146,7 +146,7 @@ void KCurve::paintEvent(QPaintEvent *) pm.fill(); // Draw grid separators. - p1.setPen(QPen::QPen(Qt::gray, 1, Qt::SolidLine)); + p1.setPen(TQPen::TQPen(TQt::gray, 1, TQt::SolidLine)); p1.drawLine(wWidth/3, 0, wWidth/3, wHeight); p1.drawLine(2*wWidth/3, 0, 2*wWidth/3, wHeight); p1.drawLine(0, wHeight/3, wWidth, wHeight/3); @@ -154,7 +154,7 @@ void KCurve::paintEvent(QPaintEvent *) // Draw curve. double curvePrevVal = getCurveValue(0.0); - p1.setPen(QPen::QPen(Qt::black, 1, Qt::SolidLine)); + p1.setPen(TQPen::TQPen(TQt::black, 1, TQt::SolidLine)); for (x = 0 ; x < wWidth ; x++) { double curveX; @@ -175,7 +175,7 @@ void KCurve::paintEvent(QPaintEvent *) // Drawing curve handles. if ( !m_readOnlyMode ) { - QPair<double,double> *p = m_points.first(); + TQPair<double,double> *p = m_points.first(); while(p) { @@ -184,13 +184,13 @@ void KCurve::paintEvent(QPaintEvent *) if(p == m_grab_point) { - p1.setPen(QPen::QPen(Qt::red, 3, Qt::SolidLine)); + p1.setPen(TQPen::TQPen(TQt::red, 3, TQt::SolidLine)); p1.drawEllipse( int(curveX * wWidth) - 2, wHeight - 2 - int(curveY * wHeight), 4, 4 ); } else { - p1.setPen(QPen::QPen(Qt::red, 1, Qt::SolidLine)); + p1.setPen(TQPen::TQPen(TQt::red, 1, TQt::SolidLine)); p1.drawEllipse( int(curveX * wWidth) - 3, wHeight - 3 - int(curveY * wHeight), 6, 6 ); @@ -204,11 +204,11 @@ void KCurve::paintEvent(QPaintEvent *) bitBlt(this, 0, 0, &pm); } -void KCurve::mousePressEvent ( QMouseEvent * e ) +void KCurve::mousePressEvent ( TQMouseEvent * e ) { if (m_readOnlyMode) return; - QPair<double,double> *closest_point=NULL; + TQPair<double,double> *closest_point=NULL; double distance; if (e->button() != Qt::LeftButton) @@ -219,7 +219,7 @@ void KCurve::mousePressEvent ( QMouseEvent * e ) distance = 1000; // just a big number - QPair<double,double> *p = m_points.first(); + TQPair<double,double> *p = m_points.first(); int insert_pos,pos=0; while(p) { @@ -239,14 +239,14 @@ void KCurve::mousePressEvent ( QMouseEvent * e ) if(closest_point == NULL) { - closest_point = new QPair<double,double>; + closest_point = new TQPair<double,double>; closest_point->first = x; closest_point->second = y; m_points.append(closest_point); } else if(distance * width() > 5) { - closest_point = new QPair<double,double>; + closest_point = new TQPair<double,double>; closest_point->first = x; closest_point->second = y; m_points.insert(insert_pos, closest_point); @@ -281,10 +281,10 @@ void KCurve::mousePressEvent ( QMouseEvent * e ) } p = m_points.next(); } - repaint(false); + tqrepaint(false); } -void KCurve::mouseReleaseEvent ( QMouseEvent * e ) +void KCurve::mouseReleaseEvent ( TQMouseEvent * e ) { if (m_readOnlyMode) return; @@ -293,22 +293,22 @@ void KCurve::mouseReleaseEvent ( QMouseEvent * e ) setCursor( KCursor::arrowCursor() ); m_dragging = false; - repaint(false); + tqrepaint(false); emit modified(); } -void KCurve::mouseMoveEvent ( QMouseEvent * e ) +void KCurve::mouseMoveEvent ( TQMouseEvent * e ) { if (m_readOnlyMode) return; double x = e->pos().x() / (float)width(); double y = 1.0 - e->pos().y() / (float)height(); - if (m_dragging == false) // If no point is selected set the the cursor shape if on top + if (m_dragging == false) // If no point is selected set the the cursor tqshape if on top { double distance = 1000; double ydistance = 1000; - QPair<double,double> *p = m_points.first(); + TQPair<double,double> *p = m_points.first(); while(p) { if (fabs (x - p->first) < distance) @@ -349,7 +349,7 @@ void KCurve::mouseMoveEvent ( QMouseEvent * e ) emit modified(); } - repaint(false); + tqrepaint(false); } double KCurve::getCurveValue(double x) @@ -357,11 +357,11 @@ double KCurve::getCurveValue(double x) return getCurveValue(m_points, x); } -double KCurve::getCurveValue(QPtrList<QPair<double,double> > &curve, double x) +double KCurve::getCurveValue(TQPtrList<TQPair<double,double> > &curve, double x) { double t; - QPair<double,double> *p; - QPair<double,double> *p0,*p1,*p2,*p3; + TQPair<double,double> *p; + TQPair<double,double> *p0,*p1,*p2,*p3; double c0,c1,c2,c3; double val; @@ -411,39 +411,39 @@ double KCurve::getCurveValue(QPtrList<QPair<double,double> > &curve, double x) return val; } -QPtrList<QPair<double,double> > KCurve::getCurve() +TQPtrList<TQPair<double,double> > KCurve::getCurve() { - QPtrList<QPair<double,double> > outlist; - QPair<double,double> *p; - QPair<double,double> *outpoint; + TQPtrList<TQPair<double,double> > outlist; + TQPair<double,double> *p; + TQPair<double,double> *outpoint; p = m_points.first(); while(p) { - outpoint = new QPair<double,double>(p->first, p->second); + outpoint = new TQPair<double,double>(p->first, p->second); outlist.append(outpoint); p = m_points.next(); } return outlist; } -void KCurve::setCurve(QPtrList<QPair<double,double> >inlist) +void KCurve::setCurve(TQPtrList<TQPair<double,double> >inlist) { - QPair<double,double> *p; - QPair<double,double> *inpoint; + TQPair<double,double> *p; + TQPair<double,double> *inpoint; m_points.clear(); inpoint = inlist.first(); while(inpoint) { - p = new QPair<double,double>(inpoint->first, inpoint->second); + p = new TQPair<double,double>(inpoint->first, inpoint->second); m_points.append(p); inpoint = inlist.next(); } } -void KCurve::leaveEvent( QEvent * ) +void KCurve::leaveEvent( TQEvent * ) { } |