]> git.sesse.net Git - kdenlive/blob - src/editkeyframecommand.cpp
f9dde76cadeb1f357b57d9dfca8fde9b18b35696
[kdenlive] / src / editkeyframecommand.cpp
1 /***************************************************************************
2                           editkeyframecommand.cpp  -  description
3                              -------------------
4     begin                : 2008
5     copyright            : (C) 2008 by Jean-Baptiste Mardelle
6     email                : jb@kdenlive.org
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 #include <KLocale>
18
19 #include "editkeyframecommand.h"
20 #include "customtrackview.h"
21
22 EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, GenTime pos, const int effectIndex, const QString& oldkeyframes, const QString& newkeyframes, bool doIt) : m_view(view), m_track(track), m_pos(pos), m_index(effectIndex), m_oldkfr(oldkeyframes), m_newkfr(newkeyframes), m_doIt(doIt) {
23     int prev = m_oldkfr.split(";", QString::SkipEmptyParts).count();
24     int next = m_newkfr.split(";", QString::SkipEmptyParts).count();
25     if (prev == next) setText(i18n("Edit keyframe"));
26     else if (prev > next) setText(i18n("Delete keyframe"));
27     else setText(i18n("Add keyframe"));
28     //kDebug() << "///  CREATE GUIDE COMMAND, TIMES: " << m_oldPos.frames(25) << "x" << m_pos.frames(25);
29 }
30
31
32 // virtual
33 void EditKeyFrameCommand::undo() {
34     m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr);
35 }
36 // virtual
37 void EditKeyFrameCommand::redo() {
38     if (m_doIt) {
39         m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
40     }
41     m_doIt = true;
42 }
43
44 #include "editkeyframecommand.moc"