]> git.sesse.net Git - kdenlive/blob - src/commands/movetransitioncommand.cpp
2a24d2f665d7861628695a1a3f0c08c06ca5e0d1
[kdenlive] / src / commands / movetransitioncommand.cpp
1 /***************************************************************************
2                           movetransitioncommand.h  -  description
3                              -------------------
4     begin                : Mar 15 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
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 #include "movetransitioncommand.h"
19 #include "customtrackview.h"
20
21 #include <KLocale>
22
23 MoveTransitionCommand::MoveTransitionCommand(CustomTrackView *view, const ItemInfo &start, const ItemInfo &end, bool doIt, QUndoCommand * parent) :
24     QUndoCommand(parent),
25     m_view(view),
26     m_startPos(start),
27     m_endPos(end),
28     m_doIt(doIt)
29 {
30     setText(i18n("Move transition"));
31     if (parent) {
32         // command has a parent, so there are several operations ongoing, do not refresh monitor
33         m_refresh = false;
34     } else m_refresh = true;
35 }
36
37
38 // virtual
39 void MoveTransitionCommand::undo()
40 {
41     // kDebug()<<"----  undoing action";
42     m_doIt = true;
43     m_view->moveTransition(m_endPos, m_startPos, m_refresh);
44 }
45 // virtual
46 void MoveTransitionCommand::redo()
47 {
48     //kDebug() << "----  redoing action";
49     if (m_doIt)
50         m_view->moveTransition(m_startPos, m_endPos, m_refresh);
51     m_doIt = true;
52 }
53
54