kwave  18.07.70
UndoInsertTrack.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  UndoInsertTrack.cpp - Undo action for insertion of tracks
3  -------------------
4  begin : Sun Jun 24 2001
5  copyright : (C) 2001 by Thomas Eschenbacher
6  email : Thomas Eschenbacher <Thomas.Eschenbacher@gmx.de>
7 
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #include "config.h"
20 
21 #include <KLocalizedString>
22 
23 #include <new>
24 
25 #include "libkwave/SignalManager.h"
28 
29 //***************************************************************************
31  unsigned int track)
32  :UndoAction(), m_signal(signal), m_track(track)
33 {
34 }
35 
36 //***************************************************************************
38 {
39 }
40 
41 //***************************************************************************
43 {
44  return i18n("Insert Track");
45 }
46 
47 //***************************************************************************
49 {
50  return sizeof(*this);
51 }
52 
53 //***************************************************************************
55 {
56  return (m_signal.length() * sizeof(sample_t)) + sizeof(UndoDeleteTrack);
57 }
58 
59 //***************************************************************************
61 {
62  // nothing to do, the track number has already
63  // been stored in the constructor
64  return true;
65 }
66 
67 //***************************************************************************
69  Kwave::SignalManager &manager, bool with_redo)
70 {
71  Kwave::UndoAction *redo = Q_NULLPTR;
72 
73  // store data for redo
74  if (with_redo) {
75  redo = new(std::nothrow) Kwave::UndoDeleteTrack(m_signal, m_track);
76  Q_ASSERT(redo);
77  if (redo) redo->store(manager);
78  }
79 
80  // remove the track from the signal
82 
83  return redo;
84 }
85 
86 //***************************************************************************
87 //***************************************************************************
void deleteTrack(unsigned int index)
Definition: Signal.cpp:119
virtual qint64 undoSize() Q_DECL_OVERRIDE
sample_index_t length()
Definition: Signal.cpp:258
virtual QString description() Q_DECL_OVERRIDE
virtual bool store(Kwave::SignalManager &manager) Q_DECL_OVERRIDE
Kwave::Signal & m_signal
virtual qint64 redoSize() Q_DECL_OVERRIDE
virtual ~UndoInsertTrack() Q_DECL_OVERRIDE
UndoInsertTrack(Kwave::Signal &signal, unsigned int track)
virtual Kwave::UndoAction * undo(Kwave::SignalManager &manager, bool with_redo) Q_DECL_OVERRIDE
virtual bool store(Kwave::SignalManager &manager)=0
qint32 sample_t
Definition: Sample.h:37