28#include <karbon_part.h>
29#include <karbon_view.h>
30#include <core/vglobal.h>
31#include "vrotatetool.h"
32#include <render/vpainter.h>
33#include <render/vpainterfactory.h>
34#include <commands/vtransformcmd.h>
38VRotateTool::VRotateTool( KarbonView *view )
39 :
VTool( view,
"tool_rotate" )
41 m_objects.setAutoDelete(
true );
45VRotateTool::~VRotateTool()
51VRotateTool::activate()
53 view()->setCursor( TQCursor( TQt::arrowCursor ) );
55 view()->part()->document().selection()->showHandle(
false );
60VRotateTool::statusText()
62 return i18n(
"Rotate" );
68 VPainter* painter = view()->painterFactory()->editpainter();
70 painter->setRasterOp( TQt::NotROP );
72 VObjectListIterator itr = m_objects;
73 for( ; itr.current(); ++itr )
75 itr.current()->draw( painter, &itr.current()->boundingBox() );
80VRotateTool::mouseButtonPress()
91VRotateTool::mouseDrag()
103VRotateTool::mouseDragRelease()
105 view()->part()->addCommand(
107 &view()->part()->document(),
109 m_angle, altPressed() ),
120 view()->repaintAll( view()->part()->document().selection()->boundingBox() );
128 m_center = view()->part()->document().selection()->boundingBox().center();
131 m_angle = VGlobal::one_pi_180 * (
133 last().y() - m_center.y(),
134 last().x() - m_center.x() )
137 first().y() - m_center.y(),
138 first().x() - m_center.x() ) );
140 VRotateCmd cmd( 0L, m_center, m_angle );
147 for ( ; itr.current() ; ++itr )
151 copy = itr.current()->
clone();
157 m_objects.append( copy );
163VRotateTool::setup( TDEActionCollection *collection )
165 m_action =
static_cast<TDERadioAction *
>(collection -> action( name() ) );
169 m_action =
new TDERadioAction( i18n(
"Rotate Tool" ),
"14_rotate", TQt::SHIFT+TQt::Key_H,
this, TQ_SLOT( activate() ), collection, name() );
170 m_action->setToolTip( i18n(
"Rotate" ) );
171 m_action->setExclusiveGroup(
"manipulation" );
VSelection * selection() const
Returns a pointer to the selection.
The base class for all karbon objects.
virtual VObject * clone() const =0
Create an exact copy of this object.
virtual void setState(const VState state)
Sets the state to a specified new state.
@ selected
visible, active and can be manipulated by tools
@ deleted
deleted, nearly dead
@ edit
visible, active and is currently manipulated by a tool
VDocument * document() const
Return document the object belongs to.
const VObjectList & objects() const
Read only access to the selected objects.