F:/KPlato/koffice/libs/flake/KoPathControlPointMoveStrategy.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 "KoPathControlPointMoveStrategy.h"
00022 
00023 #include "KoPathTool.h"
00024 #include "KoPathCommand.h"
00025 
00026 KoPathControlPointMoveStrategy::KoPathControlPointMoveStrategy( KoPathTool *tool, KoCanvasBase *canvas, KoPathPoint *point, KoPathPoint::KoPointType type, const QPointF &pos )
00027 : KoInteractionStrategy( tool, canvas )
00028 , m_lastPosition( pos )
00029 , m_move( 0, 0 )
00030 , m_tool( tool )    
00031 , m_point( point )    
00032 , m_pointType( type )    
00033 {
00034 }
00035 
00036 KoPathControlPointMoveStrategy::~KoPathControlPointMoveStrategy() 
00037 {
00038 }
00039 
00040 void KoPathControlPointMoveStrategy::handleMouseMove( const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers )
00041 {
00042     QPointF docPoint = m_tool->snapToGrid( mouseLocation, modifiers );
00043     QPointF move = docPoint - m_lastPosition;
00044     // as the last position can change when the top left is changed we have
00045     // to save it in document pos and not in shape pos
00046     m_lastPosition = docPoint;
00047 
00048     m_move += move;
00049 
00050     KoControlPointMoveCommand cmd( m_point, move, m_pointType );
00051     cmd.execute();
00052 }
00053 
00054 void KoPathControlPointMoveStrategy::finishInteraction( Qt::KeyboardModifiers modifiers ) 
00055 { 
00056     Q_UNUSED( modifiers );
00057 }
00058 
00059 KCommand* KoPathControlPointMoveStrategy::createCommand()
00060 {
00061     KCommand *cmd = 0;
00062     if( !m_move.isNull() )
00063     {
00064         cmd = new KoControlPointMoveCommand( m_point, m_move, m_pointType );
00065     }
00066     return cmd;
00067 }

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