00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "KoParameterChangeStrategy.h"
00020
00021 #include "KoParameterShape.h"
00022 #include "KoPathCommand.h"
00023
00024 KoParameterChangeStrategy::KoParameterChangeStrategy( KoTool *tool, KoCanvasBase *canvas, KoParameterShape * parameterShape, int handleId )
00025 : KoInteractionStrategy( tool, canvas )
00026 , m_parameterShape( parameterShape )
00027 , m_handleId( handleId )
00028 , m_startPoint( m_parameterShape->handlePosition( handleId ) )
00029 {
00030 }
00031
00032 KoParameterChangeStrategy::~KoParameterChangeStrategy()
00033 {
00034 }
00035
00036 void KoParameterChangeStrategy::handleMouseMove( const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers )
00037 {
00038 m_parameterShape->moveHandle( m_handleId, m_parameterShape->documentToShape( mouseLocation ), modifiers );
00039 }
00040
00041 KCommand* KoParameterChangeStrategy::createCommand()
00042 {
00043 KoParameterChangeCommand *cmd = 0;
00044
00045 if ( m_startPoint != m_parameterShape->handlePosition( m_handleId ) )
00046 {
00047 cmd = new KoParameterChangeCommand( m_parameterShape, m_handleId, m_startPoint, m_parameterShape->handlePosition( m_handleId ) );
00048 }
00049 return cmd;
00050 }
00051