]> git.sesse.net Git - kdenlive/blob - src/editkeyframecommand.cpp
Sort initializers in declaration order
[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
18
19 #include "editkeyframecommand.h"
20 #include "customtrackview.h"
21
22 #include <KLocale>
23
24 EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, GenTime pos, const int effectIndex, const QString& oldkeyframes, const QString& newkeyframes, bool doIt) :
25         m_view(view),
26         m_oldkfr(oldkeyframes),
27         m_newkfr(newkeyframes),
28         m_track(track),
29         m_index(effectIndex),
30         m_pos(pos),
31         m_doIt(doIt)
32 {
33     int prev = m_oldkfr.split(';', QString::SkipEmptyParts).count();
34     int next = m_newkfr.split(';', QString::SkipEmptyParts).count();
35     if (prev == next) setText(i18n("Edit keyframe"));
36     else if (prev > next) setText(i18n("Delete keyframe"));
37     else setText(i18n("Add keyframe"));
38     //kDebug() << "///  CREATE GUIDE COMMAND, TIMES: " << m_oldPos.frames(25) << "x" << m_pos.frames(25);
39 }
40
41
42 // virtual
43 void EditKeyFrameCommand::undo()
44 {
45     m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr);
46 }
47 // virtual
48 void EditKeyFrameCommand::redo()
49 {
50     if (m_doIt) {
51         m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
52     }
53     m_doIt = true;
54 }
55