[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita
From: Sven Langkamp <sven.langkamp () gmail ! com>
Date: 2010-10-04 0:13:35
Message-ID: 20101004001335.BF5C5AC88C () svn ! kde ! org
[Download RAW message or body]
SVN commit 1182253 by langkamp:
fix shape selection move
CCBUG:252463
M +8 -2 image/kis_selection.cc
M +2 -0 image/kis_selection_component.h
M +21 -0 ui/flake/kis_shape_selection.cpp
M +4 -0 ui/flake/kis_shape_selection.h
--- trunk/koffice/krita/image/kis_selection.cc #1182252:1182253
@@ -350,20 +350,26 @@
void KisSelection::setX(qint32 x)
{
+ qint32 delta = x - this->x();
KisPaintDevice::setX(x);
if (hasPixelSelection()) {
m_d->pixelSelection->setX(x);
}
- //TODO shape selection
+ if (hasShapeSelection()) {
+ m_d->shapeSelection->moveX(delta);
}
+}
void KisSelection::setY(qint32 y)
{
+ qint32 delta = y - this->y();
KisPaintDevice::setY(y);
if (hasPixelSelection()) {
m_d->pixelSelection->setY(y);
}
- //TODO shape selection
+ if (hasShapeSelection()) {
+ m_d->shapeSelection->moveY(delta);
}
+}
--- trunk/koffice/krita/image/kis_selection_component.h #1182252:1182253
@@ -34,6 +34,8 @@
virtual void renderToProjection(KisSelection* projection) = 0;
virtual void renderToProjection(KisSelection* projection, const QRect& r) = 0;
+ virtual void moveX(qint32 x) {}
+ virtual void moveY(qint32 x) {}
};
#endif
--- trunk/koffice/krita/ui/flake/kis_shape_selection.cpp #1182252:1182253
@@ -392,4 +392,25 @@
setHidden(true);
}
+void KisShapeSelection::moveX(qint32 x)
+{
+ foreach (KoShape* shape, shapeManager()->shapes()) {
+ if (shape != this) {
+ QPointF pos = shape->position();
+ shape->setPosition(QPointF(pos.x() + x/m_image->xRes(), pos.y()));
+ }
+ }
+}
+
+void KisShapeSelection::moveY(qint32 y)
+{
+ foreach (KoShape* shape, shapeManager()->shapes()) {
+ if (shape != this) {
+ QPointF pos = shape->position();
+ shape->setPosition(QPointF(pos.x(), pos.y() + y/m_image->yRes()));
+ }
+ }
+}
+
+
#include "kis_shape_selection.moc"
--- trunk/koffice/krita/ui/flake/kis_shape_selection.h #1182252:1182253
@@ -67,6 +67,10 @@
KoShapeManager *shapeManager() const;
+ void moveX(qint32 x);
+ void moveY(qint32 y);
+
+
protected:
virtual void paintComponent(QPainter& painter, const KoViewConverter& converter);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic