F:/KPlato/koffice/libs/flake/KoPathPointMoveStrategy.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
00003  * Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #include "KoPathPointMoveStrategy.h"
00022 
00023 #include "KoPathCommand.h"
00024 #include "KoPathTool.h"
00025 
00026 KoPathPointMoveStrategy::KoPathPointMoveStrategy( KoPathTool *tool, KoCanvasBase *canvas, const QPointF &pos )
00027 : KoInteractionStrategy( tool, canvas )
00028 , m_lastPosition( pos )
00029 , m_move( 0, 0 )
00030 , m_tool( tool )
00031 {
00032 }
00033 
00034 KoPathPointMoveStrategy::~KoPathPointMoveStrategy() 
00035 {
00036 }
00037 
00038 void KoPathPointMoveStrategy::handleMouseMove( const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers )
00039 {
00040     QPointF docPoint = m_tool->snapToGrid( mouseLocation, modifiers );
00041     QPointF move = docPoint - m_lastPosition;
00042     // as the last position can change when the top left is changed we have
00043     // to save it in document pos and not in shape pos
00044     m_lastPosition = docPoint;
00045 
00046     m_move += move;
00047 
00048     KoPointMoveCommand cmd( m_tool->m_pointSelection.selectedPointMap(), move );
00049     cmd.execute();
00050 }
00051 
00052 void KoPathPointMoveStrategy::finishInteraction( Qt::KeyboardModifiers modifiers ) 
00053 { 
00054     Q_UNUSED( modifiers );
00055 }
00056 
00057 KCommand* KoPathPointMoveStrategy::createCommand()
00058 {
00059     KCommand *cmd = 0;
00060     if( !m_move.isNull() )
00061     {
00062         cmd = new KoPointMoveCommand( m_tool->m_pointSelection.selectedPointMap(), m_move );
00063     }
00064     return cmd;
00065 }

Généré le Wed Nov 22 23:40:59 2006 pour KPlato par  doxygen 1.5.1-p1