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()
53 view()->setCursor( TQCursor( TQt::arrowCursor ) );
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() );
107 &
view()->part()->document(),
120 view()->repaintAll(
view()->part()->document().selection()->boundingBox() );
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" );
void addCommand(VCommand *cmd, bool repaint=false)
insert a command into the undo/redo-history:
VSelection * selection() const
Returns a pointer to the selection.
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
const VObjectList & objects() const
Read only access to the selected objects.
void showHandle(bool handle=true)
Toggle selection handles on/off.
virtual const KoRect & boundingBox() const
Calculates the tightest bounding box around the object.