diff --git a/krita/krita.action b/krita/krita.action
--- a/krita/krita.action
+++ b/krita/krita.action
@@ -2151,6 +2151,57 @@
true
+
+
+ Insert N Frame Left
+
+ Insert N Frame Left
+ Insert N Frame Left
+ 100000
+ 0
+
+ false
+
+
+
+
+ Insert N Frame Right
+
+ Insert N Frame Right
+ Insert N Frame Right
+ 100000
+ 0
+
+ false
+
+
+
+
+ Clear Columns
+
+ Clear Columns
+ Clear Columns
+ 100000
+ 0
+
+ false
+
+
+
+
+ Remove Columns
+
+ Remove Columns
+ Remove Columns
+ 100000
+ 0
+
+ false
+
+
+
+
+
diff --git a/krita/kritamenu.action b/krita/kritamenu.action
--- a/krita/kritamenu.action
+++ b/krita/kritamenu.action
@@ -503,6 +503,8 @@
false
+
+
Delete keyframe
@@ -517,6 +519,7 @@
+
Window
diff --git a/plugins/dockers/animation/animation_docker.h b/plugins/dockers/animation/animation_docker.h
--- a/plugins/dockers/animation/animation_docker.h
+++ b/plugins/dockers/animation/animation_docker.h
@@ -39,7 +39,7 @@
QString observerName() override { return "AnimationDocker"; }
void setCanvas(KoCanvasBase *canvas) override;
void unsetCanvas() override;
- void setMainWindow(KisViewManager *kisview) override;
+ void setMainWindow(KisViewManager *kisview) override;
private Q_SLOTS:
void slotPreviousFrame();
@@ -115,6 +115,8 @@
void addKeyframe(const QString &channel, bool copy);
void deleteKeyframe(const QString &channel);
+
+ void setActions(KisActionManager* actionManager);
};
diff --git a/plugins/dockers/animation/animation_docker.cpp b/plugins/dockers/animation/animation_docker.cpp
--- a/plugins/dockers/animation/animation_docker.cpp
+++ b/plugins/dockers/animation/animation_docker.cpp
@@ -66,117 +66,7 @@
QWidget* mainWidget = new QWidget(this);
setWidget(mainWidget);
- m_animationWidget->setupUi(mainWidget);
-
- // TODO: create all the actions using action manager!
- m_previousFrameAction = new KisAction(i18n("Previous Frame"), m_animationWidget->btnPreviousFrame);
- m_previousFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnPreviousFrame->setDefaultAction(m_previousFrameAction);
-
- m_nextFrameAction = new KisAction(i18n("Next Frame"), m_animationWidget->btnNextFrame);
- m_nextFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnNextFrame->setDefaultAction(m_nextFrameAction);
-
- m_previousKeyFrameAction = new KisAction(i18n("Previous Key Frame"), m_animationWidget->btnPreviousKeyFrame);
- m_previousKeyFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnPreviousKeyFrame->setDefaultAction(m_previousKeyFrameAction);
-
- m_nextKeyFrameAction = new KisAction(i18n("Next Key Frame"), m_animationWidget->btnNextKeyFrame);
- m_nextKeyFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnNextKeyFrame->setDefaultAction(m_nextKeyFrameAction);
-
- m_firstFrameAction = new KisAction(i18n("First Frame"), m_animationWidget->btnFirstFrame);
- m_firstFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnFirstFrame->setDefaultAction(m_firstFrameAction);
-
- m_lastFrameAction = new KisAction(i18n("Last Frame"), m_animationWidget->btnLastFrame);
- m_lastFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnLastFrame->setDefaultAction(m_lastFrameAction);
-
- m_playPauseAction = new KisAction(i18n("Play / Stop"), m_animationWidget->btnPlay);
- m_playPauseAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
- m_animationWidget->btnPlay->setDefaultAction(m_playPauseAction);
-
- m_addBlankFrameAction = new KisAction(KisAnimationUtils::addFrameActionName, m_animationWidget->btnAddKeyframe);
- m_addBlankFrameAction->setActivationFlags(KisAction::ACTIVE_NODE);
- m_animationWidget->btnAddKeyframe->setDefaultAction(m_addBlankFrameAction);
-
- m_addDuplicateFrameAction = new KisAction(KisAnimationUtils::duplicateFrameActionName, m_animationWidget->btnAddDuplicateFrame);
- m_addDuplicateFrameAction->setActivationFlags(KisAction::ACTIVE_DEVICE);
- m_animationWidget->btnAddDuplicateFrame->setDefaultAction(m_addDuplicateFrameAction);
-
- m_deleteKeyframeAction = new KisAction(KisAnimationUtils::removeFrameActionName, m_animationWidget->btnDeleteKeyframe);
- m_deleteKeyframeAction->setActivationFlags(KisAction::ACTIVE_NODE);
- m_animationWidget->btnDeleteKeyframe->setDefaultAction(m_deleteKeyframeAction);
-
- m_newKeyframeMenu = new QMenu(this);
- m_animationWidget->btnAddKeyframe->setMenu(m_newKeyframeMenu);
- m_animationWidget->btnAddKeyframe->setPopupMode(QToolButton::MenuButtonPopup);
-
- m_deleteKeyframeMenu = new QMenu(this);
- m_animationWidget->btnDeleteKeyframe->setMenu(m_deleteKeyframeMenu);
- m_animationWidget->btnDeleteKeyframe->setPopupMode(QToolButton::MenuButtonPopup);
-
- m_addOpacityKeyframeAction = new KisAction(KisAnimationUtils::addOpacityKeyframeActionName);
- m_deleteOpacityKeyframeAction = new KisAction(KisAnimationUtils::removeOpacityKeyframeActionName);
-
- m_addTransformKeyframeAction = new KisAction(KisAnimationUtils::addTransformKeyframeActionName);
- m_deleteTransformKeyframeAction = new KisAction(KisAnimationUtils::removeTransformKeyframeActionName);
-
- {
- KisImageConfig cfg;
- setupActionButton(KisAnimationUtils::lazyFrameCreationActionName,
- KisAction::ACTIVE_IMAGE,
- cfg.lazyFrameCreationEnabled(),
- m_animationWidget->btnLazyFrame,
- &m_lazyFrameAction);
- }
-
- {
- KisConfig cfg;
- setupActionButton(KisAnimationUtils::dropFramesActionName,
- KisAction::ACTIVE_IMAGE,
- cfg.animationDropFrames(),
- m_animationWidget->btnDropFrames,
- &m_dropFramesAction);
- }
-
- QFont font;
- font.setPointSize(1.7 * font.pointSize());
- font.setBold(true);
- m_animationWidget->intCurrentTime->setFont(font);
-
- connect(m_previousFrameAction, SIGNAL(triggered()), this, SLOT(slotPreviousFrame()));
- connect(m_nextFrameAction, SIGNAL(triggered()), this, SLOT(slotNextFrame()));
-
- connect(m_previousKeyFrameAction, SIGNAL(triggered()), this, SLOT(slotPreviousKeyFrame()));
- connect(m_nextKeyFrameAction, SIGNAL(triggered()), this, SLOT(slotNextKeyFrame()));
-
- connect(m_firstFrameAction, SIGNAL(triggered()), this, SLOT(slotFirstFrame()));
- connect(m_lastFrameAction, SIGNAL(triggered()), this, SLOT(slotLastFrame()));
-
- connect(m_playPauseAction, SIGNAL(triggered()), this, SLOT(slotPlayPause()));
-
- connect(m_addBlankFrameAction, SIGNAL(triggered()), this, SLOT(slotAddBlankFrame()));
- connect(m_addDuplicateFrameAction, SIGNAL(triggered()), this, SLOT(slotAddDuplicateFrame()));
- connect(m_deleteKeyframeAction, SIGNAL(triggered()), this, SLOT(slotDeleteKeyframe()));
- connect(m_lazyFrameAction, SIGNAL(toggled(bool)), this, SLOT(slotLazyFrameChanged(bool)));
- connect(m_dropFramesAction, SIGNAL(toggled(bool)), this, SLOT(slotDropFramesChanged(bool)));
-
- connect(m_addOpacityKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotAddOpacityKeyframe()));
- connect(m_deleteOpacityKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotDeleteOpacityKeyframe()));
-
- connect(m_addTransformKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotAddTransformKeyframe()));
- connect(m_deleteTransformKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTransformKeyframe()));
-
- m_animationWidget->btnOnionSkinOptions->setToolTip(i18n("Onion Skins"));
- connect(m_animationWidget->btnOnionSkinOptions, SIGNAL(clicked()), this, SLOT(slotOnionSkinOptions()));
-
- connect(m_animationWidget->spinFromFrame, SIGNAL(valueChanged(int)), this, SLOT(slotUIRangeChanged()));
- connect(m_animationWidget->spinToFrame, SIGNAL(valueChanged(int)), this, SLOT(slotUIRangeChanged()));
- connect(m_animationWidget->intFramerate, SIGNAL(valueChanged(int)), this, SLOT(slotUIFramerateChanged()));
-
- connect(m_animationWidget->intCurrentTime, SIGNAL(valueChanged(int)), SLOT(slotTimeSpinBoxChanged()));
+ m_animationWidget->setupUi(mainWidget);
}
AnimationDocker::~AnimationDocker()
@@ -202,6 +92,7 @@
m_canvas = dynamic_cast(canvas);
if (m_canvas && m_canvas->image()) {
+
KisImageAnimationInterface *animation = m_canvas->image()->animationInterface();
{
KisSignalsBlocker bloker(m_animationWidget->spinFromFrame,
@@ -213,6 +104,7 @@
m_animationWidget->intFramerate->setValue(animation->framerate());
}
+
connect(animation, SIGNAL(sigUiTimeChanged(int)), this, SLOT(slotGlobalTimeChanged()));
connect(m_canvas->animationPlayer(), SIGNAL(sigFrameChanged()), this, SLOT(slotGlobalTimeChanged()));
connect(m_canvas->animationPlayer(), SIGNAL(sigPlaybackStopped()), this, SLOT(slotGlobalTimeChanged()));
@@ -238,29 +130,10 @@
void AnimationDocker::setMainWindow(KisViewManager *view)
{
- KisActionManager *actionManager = view->actionManager();
-
- actionManager->addAction("previous_frame", m_previousFrameAction);
- actionManager->addAction("next_frame", m_nextFrameAction);
-
- actionManager->addAction("previous_keyframe", m_previousKeyFrameAction);
- actionManager->addAction("next_keyframe", m_nextKeyFrameAction);
-
- actionManager->addAction("first_frame", m_firstFrameAction);
- actionManager->addAction("last_frame", m_lastFrameAction);
-
- actionManager->addAction("lazy_frame", m_lazyFrameAction);
- actionManager->addAction("drop_frames", m_dropFramesAction);
-
- actionManager->addAction("toggle_playback", m_playPauseAction);
- actionManager->addAction("add_blank_frame", m_addBlankFrameAction);
- actionManager->addAction("add_duplicate_frame", m_addDuplicateFrameAction);
- actionManager->addAction("delete_keyframe", m_deleteKeyframeAction);
+ setActions(view->actionManager());
slotUpdateIcons();
connect(view->mainWindow(), SIGNAL(themeChanged()), this, SLOT(slotUpdateIcons()));
-
-
m_mainWindow = view->mainWindow();
}
@@ -662,3 +535,141 @@
const int time = m_canvas->image()->animationInterface()->currentTime();
KisAnimationUtils::removeKeyframe(m_canvas->image(), node, channel, time);
}
+
+void AnimationDocker::setActions(KisActionManager *actionMan)
+{
+ KisActionManager *actionManager = actionMan;
+
+ m_previousFrameAction = new KisAction(i18n("Previous Frame"), m_animationWidget->btnPreviousFrame);
+ m_previousFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnPreviousFrame->setDefaultAction(m_previousFrameAction);
+
+ m_nextFrameAction = new KisAction(i18n("Next Frame"), m_animationWidget->btnNextFrame);
+ m_nextFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnNextFrame->setDefaultAction(m_nextFrameAction);
+
+ m_previousKeyFrameAction = new KisAction(i18n("Previous Key Frame"), m_animationWidget->btnPreviousKeyFrame);
+ m_previousKeyFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnPreviousKeyFrame->setDefaultAction(m_previousKeyFrameAction);
+
+ m_nextKeyFrameAction = new KisAction(i18n("Next Key Frame"), m_animationWidget->btnNextKeyFrame);
+ m_nextKeyFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnNextKeyFrame->setDefaultAction(m_nextKeyFrameAction);
+
+ m_firstFrameAction = new KisAction(i18n("First Frame"), m_animationWidget->btnFirstFrame);
+ m_firstFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnFirstFrame->setDefaultAction(m_firstFrameAction);
+
+ m_lastFrameAction = new KisAction(i18n("Last Frame"), m_animationWidget->btnLastFrame);
+ m_lastFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnLastFrame->setDefaultAction(m_lastFrameAction);
+
+
+ m_playPauseAction = new KisAction(i18n("Play / Stop"), m_animationWidget->btnPlay);
+ m_playPauseAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
+ m_animationWidget->btnPlay->setDefaultAction(m_playPauseAction);
+
+ m_addBlankFrameAction = new KisAction(KisAnimationUtils::addFrameActionName, m_animationWidget->btnAddKeyframe);
+ m_addBlankFrameAction->setActivationFlags(KisAction::ACTIVE_NODE);
+ m_animationWidget->btnAddKeyframe->setDefaultAction(m_addBlankFrameAction);
+
+ m_addDuplicateFrameAction = new KisAction(KisAnimationUtils::duplicateFrameActionName, m_animationWidget->btnAddDuplicateFrame);
+ m_addDuplicateFrameAction->setActivationFlags(KisAction::ACTIVE_DEVICE);
+ m_animationWidget->btnAddDuplicateFrame->setDefaultAction(m_addDuplicateFrameAction);
+
+ m_deleteKeyframeAction = new KisAction(KisAnimationUtils::removeFrameActionName, m_animationWidget->btnDeleteKeyframe);
+ m_deleteKeyframeAction->setActivationFlags(KisAction::ACTIVE_NODE);
+ m_animationWidget->btnDeleteKeyframe->setDefaultAction(m_deleteKeyframeAction);
+
+ m_newKeyframeMenu = new QMenu(this);
+ m_animationWidget->btnAddKeyframe->setMenu(m_newKeyframeMenu);
+ m_animationWidget->btnAddKeyframe->setPopupMode(QToolButton::MenuButtonPopup);
+
+ m_deleteKeyframeMenu = new QMenu(this);
+ m_animationWidget->btnDeleteKeyframe->setMenu(m_deleteKeyframeMenu);
+ m_animationWidget->btnDeleteKeyframe->setPopupMode(QToolButton::MenuButtonPopup);
+
+ m_addOpacityKeyframeAction = new KisAction(KisAnimationUtils::addOpacityKeyframeActionName);
+ m_deleteOpacityKeyframeAction = new KisAction(KisAnimationUtils::removeOpacityKeyframeActionName);
+
+ m_addTransformKeyframeAction = new KisAction(KisAnimationUtils::addTransformKeyframeActionName);
+ m_deleteTransformKeyframeAction = new KisAction(KisAnimationUtils::removeTransformKeyframeActionName);
+
+
+ // other new stuff
+ actionManager->addAction("previous_frame", m_previousFrameAction);
+ actionManager->addAction("next_frame", m_nextFrameAction);
+
+ actionManager->addAction("previous_keyframe", m_previousKeyFrameAction);
+ actionManager->addAction("next_keyframe", m_nextKeyFrameAction);
+
+ actionManager->addAction("first_frame", m_firstFrameAction);
+ actionManager->addAction("last_frame", m_lastFrameAction);
+
+ {
+ KisImageConfig cfg;
+ setupActionButton(KisAnimationUtils::lazyFrameCreationActionName,
+ KisAction::ACTIVE_IMAGE,
+ cfg.lazyFrameCreationEnabled(),
+ m_animationWidget->btnLazyFrame,
+ &m_lazyFrameAction);
+ }
+
+ {
+ KisConfig cfg;
+ setupActionButton(KisAnimationUtils::dropFramesActionName,
+ KisAction::ACTIVE_IMAGE,
+ cfg.animationDropFrames(),
+ m_animationWidget->btnDropFrames,
+ &m_dropFramesAction);
+ }
+
+
+ // these actions are created in the setupActionButton() above, so we need to add actions after that
+ actionManager->addAction("lazy_frame", m_lazyFrameAction);
+ actionManager->addAction("drop_frames", m_dropFramesAction);
+
+ actionManager->addAction("toggle_playback", m_playPauseAction);
+ actionManager->addAction("add_blank_frame", m_addBlankFrameAction);
+ actionManager->addAction("add_duplicate_frame", m_addDuplicateFrameAction);
+
+ actionManager->addAction("delete_keyframe", m_deleteKeyframeAction);
+
+
+ QFont font;
+ font.setPointSize(1.7 * font.pointSize());
+ font.setBold(true);
+ m_animationWidget->intCurrentTime->setFont(font);
+
+ connect(m_previousFrameAction, SIGNAL(triggered()), this, SLOT(slotPreviousFrame()));
+ connect(m_nextFrameAction, SIGNAL(triggered()), this, SLOT(slotNextFrame()));
+
+ connect(m_previousKeyFrameAction, SIGNAL(triggered()), this, SLOT(slotPreviousKeyFrame()));
+ connect(m_nextKeyFrameAction, SIGNAL(triggered()), this, SLOT(slotNextKeyFrame()));
+
+ connect(m_firstFrameAction, SIGNAL(triggered()), this, SLOT(slotFirstFrame()));
+ connect(m_lastFrameAction, SIGNAL(triggered()), this, SLOT(slotLastFrame()));
+
+ connect(m_playPauseAction, SIGNAL(triggered()), this, SLOT(slotPlayPause()));
+
+ connect(m_addBlankFrameAction, SIGNAL(triggered()), this, SLOT(slotAddBlankFrame()));
+ connect(m_addDuplicateFrameAction, SIGNAL(triggered()), this, SLOT(slotAddDuplicateFrame()));
+ connect(m_deleteKeyframeAction, SIGNAL(triggered()), this, SLOT(slotDeleteKeyframe()));
+ connect(m_lazyFrameAction, SIGNAL(toggled(bool)), this, SLOT(slotLazyFrameChanged(bool)));
+ connect(m_dropFramesAction, SIGNAL(toggled(bool)), this, SLOT(slotDropFramesChanged(bool)));
+
+ connect(m_addOpacityKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotAddOpacityKeyframe()));
+ connect(m_deleteOpacityKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotDeleteOpacityKeyframe()));
+
+ connect(m_addTransformKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotAddTransformKeyframe()));
+ connect(m_deleteTransformKeyframeAction, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTransformKeyframe()));
+
+ m_animationWidget->btnOnionSkinOptions->setToolTip(i18n("Onion Skins"));
+ connect(m_animationWidget->btnOnionSkinOptions, SIGNAL(clicked()), this, SLOT(slotOnionSkinOptions()));
+
+ connect(m_animationWidget->spinFromFrame, SIGNAL(valueChanged(int)), this, SLOT(slotUIRangeChanged()));
+ connect(m_animationWidget->spinToFrame, SIGNAL(valueChanged(int)), this, SLOT(slotUIRangeChanged()));
+ connect(m_animationWidget->intFramerate, SIGNAL(valueChanged(int)), this, SLOT(slotUIFramerateChanged()));
+
+ connect(m_animationWidget->intCurrentTime, SIGNAL(valueChanged(int)), SLOT(slotTimeSpinBoxChanged()));
+}
diff --git a/plugins/dockers/animation/timeline_docker.cpp b/plugins/dockers/animation/timeline_docker.cpp
--- a/plugins/dockers/animation/timeline_docker.cpp
+++ b/plugins/dockers/animation/timeline_docker.cpp
@@ -154,4 +154,6 @@
}
m_d->view->setShowInTimeline(actionManager->actionByName("show_in_timeline"));
+
+ m_d->view->setActionManager(actionManager);
}
diff --git a/plugins/dockers/animation/timeline_frames_view.h b/plugins/dockers/animation/timeline_frames_view.h
--- a/plugins/dockers/animation/timeline_frames_view.h
+++ b/plugins/dockers/animation/timeline_frames_view.h
@@ -21,7 +21,7 @@
#include
#include
-
+#include "kis_action_manager.h"
#include "kritaanimationdocker_export.h"
class KisAction;
@@ -43,6 +43,8 @@
void setShowInTimeline(KisAction *action);
+ void setActionManager( KisActionManager * actionManager);
+
public Q_SLOTS:
void slotSelectionChanged();
void slotUpdateIcons();
diff --git a/plugins/dockers/animation/timeline_frames_view.cpp b/plugins/dockers/animation/timeline_frames_view.cpp
--- a/plugins/dockers/animation/timeline_frames_view.cpp
+++ b/plugins/dockers/animation/timeline_frames_view.cpp
@@ -131,6 +131,8 @@
QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const;
KoIconToolTip tip;
+
+ KisActionManager * actionMan = 0;
};
TimelineFramesView::TimelineFramesView(QWidget *parent)
@@ -292,6 +294,18 @@
m_d->layerEditingMenu->addAction(m_d->showHideLayerAction);
}
+
+void TimelineFramesView::setActionManager( KisActionManager * actionManager)
+{
+ m_d->actionMan = actionManager;
+ m_d->horizontalRuler->setActionManager(actionManager);
+}
+
+
+
+
+
+
void resizeToMinimalSize(QAbstractButton *w, int minimalSize) {
QSize buttonSize = w->sizeHint();
if (buttonSize.height() > minimalSize) {
diff --git a/plugins/dockers/animation/timeline_ruler_header.h b/plugins/dockers/animation/timeline_ruler_header.h
--- a/plugins/dockers/animation/timeline_ruler_header.h
+++ b/plugins/dockers/animation/timeline_ruler_header.h
@@ -20,8 +20,8 @@
#define TIMELINE_RULER_HEADER_H
#include
-
#include
+#include "kis_action_manager.h"
class QPaintEvent;
@@ -37,6 +37,8 @@
void setModel(QAbstractItemModel *model) override;
+ void setActionManager( KisActionManager * actionManager);
+
protected:
void mousePressEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
diff --git a/plugins/dockers/animation/timeline_ruler_header.cpp b/plugins/dockers/animation/timeline_ruler_header.cpp
--- a/plugins/dockers/animation/timeline_ruler_header.cpp
+++ b/plugins/dockers/animation/timeline_ruler_header.cpp
@@ -29,6 +29,7 @@
#include "kis_time_based_item_model.h"
#include "timeline_color_scheme.h"
+#include "kis_action.h"
#include "kis_debug.h"
@@ -39,16 +40,19 @@
int fps;
QMenu *columnEditingMenu;
- QAction *insertLeftAction;
- QAction *insertRightAction;
- QAction *removeAction;
- QAction *clearAction;
+ KisAction *insertLeftAction;
+ KisAction *insertRightAction;
+ KisAction *removeAction;
+ KisAction *clearAction;
KisTimeBasedItemModel *model;
int lastPressSectionIndex;
int calcSpanWidth(const int sectionWidth);
QModelIndexList prepareFramesSlab(int startCol, int endCol);
+
+ KisActionManager* actionMan = 0;
+
};
TimelineRulerHeader::TimelineRulerHeader(QWidget *parent)
@@ -58,11 +62,8 @@
setSectionResizeMode(QHeaderView::Fixed);
setDefaultSectionSize(18);
- m_d->columnEditingMenu = new QMenu(this);
- m_d->insertLeftAction = m_d->columnEditingMenu->addAction("Insert 1 Left", this, SLOT(slotInsertColumnLeft()));
- m_d->insertRightAction = m_d->columnEditingMenu->addAction("Insert 1 Right", this, SLOT(slotInsertColumnRight()));
- m_d->clearAction = m_d->columnEditingMenu->addAction("Clear Columns", this, SLOT(slotClearColumns()));
- m_d->removeAction = m_d->columnEditingMenu->addAction("Remove Columns", this, SLOT(slotRemoveColumns()));
+
+
}
@@ -70,6 +71,32 @@
{
}
+
+void TimelineRulerHeader::setActionManager( KisActionManager * actionManager)
+{
+ m_d->actionMan = actionManager;
+
+ m_d->insertLeftAction = actionManager->createAction("insert_n_frames_left");
+ connect(m_d->insertLeftAction, SIGNAL(triggered()), SLOT(slotInsertColumnLeft()));
+
+ m_d->insertRightAction = actionManager->createAction("insert_n_frames_right");
+ connect(m_d->insertRightAction, SIGNAL(triggered()), SLOT(slotInsertColumnRight()));
+
+ m_d->clearAction = actionManager->createAction("clear_animation_columns");
+ connect(m_d->clearAction, SIGNAL(triggered()), SLOT(slotClearColumns()));
+
+ m_d->removeAction = actionManager->createAction("remove_animation_columns");
+ connect(m_d->removeAction, SIGNAL(triggered()), SLOT(slotRemoveColumns()));
+
+
+ m_d->columnEditingMenu = new QMenu(this);
+ m_d->columnEditingMenu->addAction(static_cast(m_d->insertLeftAction));
+ m_d->columnEditingMenu->addAction(static_cast(m_d->insertRightAction));
+ m_d->columnEditingMenu->addAction(static_cast(m_d->clearAction));
+ m_d->columnEditingMenu->addAction(static_cast(m_d->removeAction));
+}
+
+
void TimelineRulerHeader::paintEvent(QPaintEvent *e)
{
QHeaderView::paintEvent(e);
@@ -388,6 +415,7 @@
model()->setHeaderData(logical, orientation(), true, KisTimeBasedItemModel::ActiveFrameRole);
}
+
m_d->insertLeftAction->setText(i18n("Insert %1 left", numSelectedColumns));
m_d->insertRightAction->setText(i18n("Insert %1 right", numSelectedColumns));
m_d->clearAction->setText(i18n("Clear %1 columns", numSelectedColumns));