Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d0a21c8a authored by Thomas Zander's avatar Thomas Zander

Don't pass unused variable and rename method.

Also whitespace fixes (follow coding style)

svn path=/trunk/koffice/; revision=1118042
parent 099902b7
......@@ -40,7 +40,7 @@ ShapeMoveStrategy::ShapeMoveStrategy(KoToolBase *tool, const QPointF &clicked)
QList<KoShape*> selectedShapes = tool->canvas()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection);
QRectF boundingRect;
foreach(KoShape *shape, selectedShapes) {
if( ! shape->isEditable() )
if (! shape->isEditable())
continue;
m_selectedShapes << shape;
m_previousPositions << shape->position();
......@@ -52,7 +52,7 @@ ShapeMoveStrategy::ShapeMoveStrategy(KoToolBase *tool, const QPointF &clicked)
m_initialSelectionPosition = selection->position();
tool->canvas()->snapGuide()->setIgnoredShapes( selection->selectedShapes( KoFlake::FullSelection ) );
tool->setStatusText( i18n("Press ALT to hold x- or y-position.") );
tool->setStatusText(i18n("Press ALT to hold x- or y-position."));
}
void ShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifiers modifiers)
......@@ -61,15 +61,13 @@ void ShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifi
return;
QPointF diff = point - m_start;
if(modifiers & (Qt::AltModifier | Qt::ControlModifier)) {
if (modifiers & (Qt::AltModifier | Qt::ControlModifier)) {
// keep x or y position unchanged
if(qAbs(diff.x()) < qAbs(diff.y()))
diff.setX(0);
else
diff.setY(0);
}
else
{
} else {
QPointF positionToSnap = point + m_initialOffset;
tool()->canvas()->updateCanvas( tool()->canvas()->snapGuide()->boundingRect() );
QPointF snappedPosition = tool()->canvas()->snapGuide()->snap( positionToSnap, modifiers );
......@@ -79,14 +77,14 @@ void ShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifi
m_diff = diff;
moveBy( diff );
moveSelection();
}
void ShapeMoveStrategy::handleCustomEvent( KoPointerEvent * event )
void ShapeMoveStrategy::handleCustomEvent(KoPointerEvent *event)
{
QPointF diff = tool()->canvas()->viewConverter()->viewToDocument( event->pos() );
QPointF diff = tool()->canvas()->viewConverter()->viewToDocument(event->pos());
if( event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
if (event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
// keep x or y position unchanged
if(qAbs(diff.x()) < qAbs(diff.y()))
diff.setX(0);
......@@ -96,12 +94,11 @@ void ShapeMoveStrategy::handleCustomEvent( KoPointerEvent * event )
m_diff += 0.1 * diff ;
moveBy( diff );
moveSelection();
}
void ShapeMoveStrategy::moveBy( const QPointF &diff )
void ShapeMoveStrategy::moveSelection()
{
Q_UNUSED(diff);
Q_ASSERT(m_newPositions.count());
int i=0;
......
......@@ -52,7 +52,7 @@ public:
virtual void paint( QPainter &painter, const KoViewConverter &converter);
virtual void handleCustomEvent( KoPointerEvent * event );
private:
void moveBy( const QPointF &diff );
void moveSelection();
QList<QPointF> m_previousPositions;
QList<QPointF> m_newPositions;
QPointF m_start, m_diff, m_initialSelectionPosition, m_initialOffset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment