From e2f541c98dfa4081fa3ab3d28f08ea2309281884 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 15 Mar 2010 17:32:48 +0000 Subject: Added KDE3 version of kdesvn git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdesvn@1103685 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/svnfrontend/graphtree/graphtreelabel.cpp | 220 +++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 src/svnfrontend/graphtree/graphtreelabel.cpp (limited to 'src/svnfrontend/graphtree/graphtreelabel.cpp') diff --git a/src/svnfrontend/graphtree/graphtreelabel.cpp b/src/svnfrontend/graphtree/graphtreelabel.cpp new file mode 100644 index 0000000..9770fef --- /dev/null +++ b/src/svnfrontend/graphtree/graphtreelabel.cpp @@ -0,0 +1,220 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by Rajko Albrecht * + * ral@alwins-world.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#include "graphtreelabel.h" +#include "graphtree_defines.h" +#include + +GraphTreeLabel::GraphTreeLabel(const QString&text, const QString&_nodename,const QRect&r,QCanvas*c) + : QCanvasRectangle(r,c),StoredDrawParams() +{ + m_Nodename = _nodename; + m_SourceNode = QString::null; + setText(0,text); + setPosition(0, DrawParams::TopCenter); + drawFrame(true); +} + +GraphTreeLabel::~GraphTreeLabel() +{ +} + +const QString&GraphTreeLabel::nodename()const +{ + return m_Nodename; +} + +int GraphTreeLabel::rtti()const +{ + return GRAPHTREE_LABEL; +} + +void GraphTreeLabel::setBgColor(const QColor&c) +{ + _backColor=c; +} + +void GraphTreeLabel::drawShape(QPainter& p) +{ + QRect r = rect(); +/* + p.setPen(blue); + p.drawRect(r); +*/ + RectDrawing d(r); + d.drawBack(&p,this); + d.drawField(&p, 0, this); + d.drawField(&p, 1, this); +} + +void GraphTreeLabel::setSelected(bool s) +{ + QCanvasRectangle::setSelected(s); + StoredDrawParams::setSelected(s); + update(); +} + +const QString&GraphTreeLabel::source()const +{ + return m_SourceNode; +} + +void GraphTreeLabel::setSource(const QString&_s) +{ + m_SourceNode=_s; +} + +GraphEdge::GraphEdge(QCanvas*c) + : QCanvasSpline(c) +{ +} + +GraphEdge::~GraphEdge() +{ +} + +void GraphEdge::drawShape(QPainter& p) +{ + p.drawPolyline(poly); +} + +QPointArray GraphEdge::areaPoints() const +{ + int minX = poly[0].x(), minY = poly[0].y(); + int maxX = minX, maxY = minY; + int i; + + if (0) qDebug("GraphEdge::areaPoints\n P 0: %d/%d", minX, minY); + int len = poly.count(); + for (i=1;i maxX) maxX = poly[i].x(); + if (poly[i].y() > maxY) maxY = poly[i].y(); + if (0) qDebug(" P %d: %d/%d", i, poly[i].x(), poly[i].y()); + } + QPointArray a = poly.copy(), b = poly.copy(); + if (minX == maxX) { + a.translate(-2, 0); + b.translate(2, 0); + } + else { + a.translate(0, -2); + b.translate(0, 2); + } + a.resize(2*len); + for (i=0;iv2) { + r.setRect(r.x()-d, r.y()-d, r.width()+2*d, r.height()+2*d); + v /= f; + } + + _p = new QPixmap(r.size()); + _p->fill(Qt::white); + QPainter p(_p); + p.setPen(Qt::NoPen); + + r.moveBy(-r.x(), -r.y()); + + while (vwidth(), _p->height()); + move(n->rect().center().x()-_p->width()/2, + n->rect().center().y()-_p->height()/2); +} + +GraphMark::~ GraphMark() +{ +} + +bool GraphMark::hit(const QPoint&)const +{ + return false; +} + +int GraphMark::rtti()const +{ + return GRAPHTREE_MARK; +} + +void GraphMark::drawShape(QPainter&p) +{ + p.drawPixmap( int(x()), int(y()), *_p ); +} -- cgit v1.2.1