21#include <tqgroupbox.h>
26#include <karbon_view.h>
27#include <karbon_part.h>
28#include <shapes/vrectangle.h>
29#include "vroundrecttool.h"
30#include "KoUnitWidgets.h"
32#include <kgenericfactory.h>
34VRoundRectTool::VRoundRectOptionsWidget::VRoundRectOptionsWidget(
KarbonPart *part, TQWidget* parent,
const char* name )
35 : KDialogBase( parent, name, true, i18n(
"Insert Round Rect" ), Ok | Cancel ), m_part( part )
37 TQGroupBox *group =
new TQGroupBox( 2, TQt::Horizontal, i18n(
"Properties" ),
this );
38 new TQLabel( i18n(
"object width",
"Width:" ), group );
40 KoUnit::Unit unit = KoUnit::U_CM;
41 m_width =
new KoUnitDoubleSpinBox( group, 0.0, KoUnit::fromUserValue( 1000.0, unit ), KoUnit::fromUserValue( 0.5, unit ), KoUnit::fromUserValue( 10.0, unit ), unit );
43 new TQLabel( i18n(
"Height (%1):" ).arg(KoUnit::unitName( m_part->unit() )), group );
44 m_height =
new KoUnitDoubleSpinBox( group, 0.0, KoUnit::fromUserValue( 1000.0, unit ), KoUnit::fromUserValue( 0.5, unit ), KoUnit::fromUserValue( 10.0, unit ), unit );
46 new TQLabel( i18n(
"Edge radius X:" ), group );
47 m_roundx =
new KoUnitDoubleSpinBox( group, 0.0, KoUnit::fromUserValue( 100.0, unit ), KoUnit::fromUserValue( 0.1, unit ), KoUnit::fromUserValue( 1.0, unit ), unit );
49 new TQLabel( i18n(
"Edge radius Y:" ), group );
50 m_roundy =
new KoUnitDoubleSpinBox( group, 0.0, KoUnit::fromUserValue( 100.0, unit ), KoUnit::fromUserValue( 0.1, unit ), KoUnit::fromUserValue( 1.0, unit ), unit );
52 group->setInsideMargin( 4 );
53 group->setInsideSpacing( 2 );
55 setMainWidget( group );
56 setFixedSize( baseSize() );
60VRoundRectTool::VRoundRectOptionsWidget::width()
const
62 return m_width->value();
66VRoundRectTool::VRoundRectOptionsWidget::height()
const
68 return m_height->value();
72VRoundRectTool::VRoundRectOptionsWidget::roundx()
const
74 return m_roundx->value();
78VRoundRectTool::VRoundRectOptionsWidget::roundy()
const
80 return m_roundy->value();
84VRoundRectTool::VRoundRectOptionsWidget::setWidth(
double value )
86 m_width->changeValue( value );
90VRoundRectTool::VRoundRectOptionsWidget::setHeight(
double value )
92 m_height->changeValue( value );
96VRoundRectTool::VRoundRectOptionsWidget::setRoundX(
double value )
98 m_roundx->changeValue( value );
102VRoundRectTool::VRoundRectOptionsWidget::setRoundY(
double value )
104 m_roundy->changeValue( value );
108VRoundRectTool::VRoundRectOptionsWidget::refreshUnit ()
110 m_width->setUnit( m_part->unit() );
111 m_height->setUnit( m_part->unit() );
112 m_roundx->setUnit( m_part->unit() );
113 m_roundy->setUnit( m_part->unit() );
116VRoundRectTool::VRoundRectTool( KarbonView *
view )
117 : VShapeTool(
view,
"tool_round_rectangle" )
120 m_optionsWidget =
new VRoundRectOptionsWidget( view->part() );
121 registerTool(
this );
124VRoundRectTool::~VRoundRectTool()
126 delete( m_optionsWidget );
131 m_optionsWidget->refreshUnit();
135VRoundRectTool::shape(
bool interactive )
const
143 m_optionsWidget->width(),
144 m_optionsWidget->height(),
145 m_optionsWidget->roundx(),
146 m_optionsWidget->roundy() );
155 m_optionsWidget->roundx(),
156 m_optionsWidget->roundy() );
163 return m_optionsWidget->exec() == TQDialog::Accepted;
167VRoundRectTool::setup( TDEActionCollection *collection )
169 m_action =
static_cast<TDERadioAction *
>(collection ->
action( name() ) );
173 m_action =
new TDERadioAction( i18n(
"Round Rectangle Tool" ),
"14_roundrect", TQt::SHIFT+TQt::Key_H,
this, TQ_SLOT(
activate() ), collection, name() );
174 m_action->setToolTip( i18n(
"Round Rectangle" ) );
175 m_action->setExclusiveGroup(
"shapes" );
Keeps track of visual per document properties.
A composite path consists of one or many subpaths.