23#include <tdefiledialog.h>
26#include "vimagetool.h"
27#include <karbon_part.h>
28#include <karbon_view.h>
29#include <core/vimage.h>
30#include <core/vselection.h>
31#include <core/vcursor.h>
33VImageTool::VImageTool( KarbonView *view ) :
VTool( view,
"tool_image_plugin" )
39VImageTool::~VImageTool()
45VImageTool::contextHelp()
47 TQString s = i18n(
"<qt><b>Image tool:</b><br>" );
54 view()->setCursor( *m_cursor );
59VImageTool::statusText()
61 return i18n(
"Image Tool" );
65VImageTool::deactivate()
70VImageTool::mouseButtonRelease()
72 TQString fname = KFileDialog::getOpenFileName( TQString(),
"*.jpg *.gif *.png", view(), i18n(
"Choose Image to Add" ) );
73 if( !fname.isEmpty() )
75 VImage *image =
new VImage( 0L, fname );
76 VInsertImageCmd *cmd =
new VInsertImageCmd( &view()->part()->document(), i18n(
"Insert Image" ), image, first() );
78 view()->part()->addCommand( cmd,
true );
82VImageTool::VInsertImageCmd::VInsertImageCmd(
VDocument* doc,
const TQString& name, VImage *image, KoPoint pos )
83 :
VCommand( doc, name,
"frame_image" ), m_image( image ), m_pos( pos )
88VImageTool::VInsertImageCmd::execute()
98 m_image->transform( TQWMatrix().translate( m_pos.x(), m_pos.y() ) );
99 document()->append( m_image );
100 document()->selection()->clear();
101 document()->selection()->append( m_image );
108VImageTool::VInsertImageCmd::unexecute()
113 document()->selection()->take( *m_image );
120VImageTool::setup( TDEActionCollection *collection )
122 m_action =
static_cast<TDERadioAction *
>(collection -> action( name() ) );
126 m_action =
new TDERadioAction( i18n(
"Image Tool" ),
"14_image", TQt::SHIFT+TQt::Key_H,
this, TQ_SLOT( activate() ), collection, name() );
127 m_action->setToolTip( i18n(
"Image" ) );
128 m_action->setExclusiveGroup(
"misc" );
The base class for all karbon commands.
@ CrossHair
unthemed crosshair cursor
static TQCursor createCursor(CursorType type)
Creates a predefined cursor of the specified type.
All non-visual, static doc info is in here.
@ deleted
deleted, nearly dead
@ normal
visible, not active