Shortcut for clearing only the last mark.

svn path=/trunk/KDE/kdebase/workspace/; revision=758641
icc-effect-5.14.5
Luboš Luňák 2008-01-08 16:23:56 +00:00
parent 0b2f726634
commit f7c52e116b
3 changed files with 28 additions and 1 deletions

View File

@ -49,9 +49,13 @@ MouseMarkEffect::MouseMarkEffect()
{
KActionCollection* actionCollection = new KActionCollection( this );
KAction* a = static_cast< KAction* >( actionCollection->addAction( "ClearMouseMarks" ));
a->setText( i18n( "Clear Mouse Marks" ));
a->setText( i18n( "Clear All Mouse Marks" ));
a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 ));
connect( a, SIGNAL( triggered( bool )), this, SLOT( clear()));
a = static_cast< KAction* >( actionCollection->addAction( "ClearLastMouseMark" ));
a->setText( i18n( "Clear Last Mouse Mark" ));
a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F12 ));
connect( a, SIGNAL( triggered( bool )), this, SLOT( clearLast()));
KConfigGroup conf = EffectsHandler::effectConfig("MouseMark");
width = conf.readEntry( "LineWidth", 3 );
@ -104,6 +108,7 @@ void MouseMarkEffect::mouseChanged( const QPoint& pos, const QPoint&,
}
if( arrow_start != NULL_POINT )
return;
// TODO the shortcuts now trigger this right before they're activated
if( modifiers == ( Qt::META | Qt::SHIFT )) // activated
{
if( drawing.isEmpty())
@ -131,6 +136,24 @@ void MouseMarkEffect::clear()
effects->addRepaintFull();
}
void MouseMarkEffect::clearLast()
{
if( arrow_start != NULL_POINT )
{
arrow_start = NULL_POINT;
}
else if( !drawing.isEmpty())
{
drawing.clear();
effects->addRepaintFull();
}
else if( !marks.isEmpty())
{
marks.pop_back();
effects->addRepaintFull();
}
}
MouseMarkEffect::Mark MouseMarkEffect::createArrow( QPoint arrow_start, QPoint arrow_end )
{
Mark ret;

View File

@ -39,6 +39,7 @@ class MouseMarkEffect
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers );
private slots:
void clear();
void clearLast();
private:
typedef QVector< QPoint > Mark;
static Mark createArrow( QPoint arrow_start, QPoint arrow_end );

View File

@ -67,6 +67,9 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
KAction* a = static_cast< KAction* >( m_actionCollection->addAction( "ClearMouseMarks" ));
a->setText( i18n( "Clear Mouse Marks" ));
a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 ));
a = static_cast< KAction* >( m_actionCollection->addAction( "ClearLastMouseMark" ));
a->setText( i18n( "Clear Last Mouse Mark" ));
a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F12 ));
m_ui->editor->addCollection(m_actionCollection);
load();