openshot-audio  0.1.4
juce_UndoManager.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_UNDOMANAGER_H_INCLUDED
26 #define JUCE_UNDOMANAGER_H_INCLUDED
27 
28 
29 //==============================================================================
50 {
51 public:
52  //==============================================================================
66  UndoManager (int maxNumberOfUnitsToKeep = 30000,
67  int minimumTransactionsToKeep = 30);
68 
70  ~UndoManager();
71 
72  //==============================================================================
74  void clearUndoHistory();
75 
79  int getNumberOfUnitsTakenUpByStoredCommands() const;
80 
95  void setMaxNumberOfStoredUnits (int maxNumberOfUnitsToKeep,
96  int minimumTransactionsToKeep);
97 
98  //==============================================================================
106  bool perform (UndoableAction* action);
107 
118  bool perform (UndoableAction* action, const String& actionName);
119 
126  void beginNewTransaction() noexcept;
127 
137  void beginNewTransaction (const String& actionName) noexcept;
138 
145  void setCurrentTransactionName (const String& newName) noexcept;
146 
150  String getCurrentTransactionName() const noexcept;
151 
152  //==============================================================================
156  bool canUndo() const noexcept;
157 
161  String getUndoDescription() const;
162 
167  bool undo();
168 
182  bool undoCurrentTransactionOnly();
183 
192  void getActionsInCurrentTransaction (Array<const UndoableAction*>& actionsFound) const;
193 
198  int getNumActionsInCurrentTransaction() const;
199 
203  Time getTimeOfUndoTransaction() const;
204 
208  Time getTimeOfRedoTransaction() const;
209 
210  //==============================================================================
214  bool canRedo() const noexcept;
215 
219  String getRedoDescription() const;
220 
225  bool redo();
226 
227 
228 private:
229  //==============================================================================
230  struct ActionSet;
231  friend struct ContainerDeletePolicy<ActionSet>;
232  OwnedArray<ActionSet> transactions;
233  String newTransactionName;
234  int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
235  bool newTransaction, reentrancyCheck;
236  ActionSet* getCurrentSet() const noexcept;
237  ActionSet* getNextSet() const noexcept;
238  void clearFutureTransactions();
239 
241 };
242 
243 
244 #endif // JUCE_UNDOMANAGER_H_INCLUDED
Definition: juce_UndoableAction.h:36
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_Time.h:41
Definition: juce_String.h:43
Definition: juce_ChangeBroadcaster.h:35
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_UndoManager.cpp:25
Definition: juce_ContainerDeletePolicy.h:44
Definition: juce_ApplicationCommandID.h:83
Definition: juce_Array.h:60
Definition: juce_ApplicationCommandID.h:86
Definition: juce_OwnedArray.h:55
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_UndoManager.h:49