X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcommands%2Finsertspacecommand.cpp;fp=src%2Fcommands%2Finsertspacecommand.cpp;h=7a485fd3544ad44b8be7496f705179d2bee6c3bd;hb=e0a70e0428309070f6ed2716beaeaaba05edd3b5;hp=0000000000000000000000000000000000000000;hpb=6363960471c6299e51caba3ee5a8cf6e480def58;p=kdenlive diff --git a/src/commands/insertspacecommand.cpp b/src/commands/insertspacecommand.cpp new file mode 100644 index 00000000..7a485fd3 --- /dev/null +++ b/src/commands/insertspacecommand.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + + +#include "commands/insertspacecommand.h" +#include "customtrackview.h" + +#include + +InsertSpaceCommand::InsertSpaceCommand(CustomTrackView *view, QList clipsToMove, QList transToMove, int track, const GenTime &duration, bool doIt, QUndoCommand * parent) : + QUndoCommand(parent), + m_view(view), + m_clipsToMove(clipsToMove), + m_transToMove(transToMove), + m_duration(duration), + m_track(track), + m_doIt(doIt) +{ + if (duration > GenTime()) setText(i18n("Insert space")); + else setText(i18n("Remove space")); +} + +// virtual +void InsertSpaceCommand::undo() +{ + // kDebug()<<"---- undoing action"; + m_view->insertSpace(m_clipsToMove, m_transToMove, m_track, GenTime() - m_duration, m_duration); +} +// virtual +void InsertSpaceCommand::redo() +{ + // kDebug() << "---- redoing action cut: " << m_cutTime.frames(25); + if (m_doIt) { + m_view->insertSpace(m_clipsToMove, m_transToMove, m_track, m_duration, GenTime()); + } + m_doIt = true; +} +