HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_UndoBundle.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: OP_UndoBundle.h ( Operator Library, C++)
7  *
8  * COMMENTS:
9  * This is the Undo class that is responsible for undoing all
10  * changes to OP bundles. It even handles creation and deletion.
11  */
12 
13 #ifndef __OP_UndoBundle__
14 #define __OP_UndoBundle__
15 
16 #include "OP_API.h"
17 #include <UT/UT_Array.h>
18 #include <UT/UT_String.h>
19 #include <UT/UT_Undo.h>
20 
21 class OP_Bundle;
22 class OP_BundleFilter;
23 
25 {
26  OP_UNDO_BUNDLE_CREATE, // Create a new bundle
27  OP_UNDO_BUNDLE_DELETE, // Delete a bundle
28  OP_UNDO_BUNDLE_MODIFY, // Add/Remove ops to a bundle
29  OP_UNDO_BUNDLE_FILTER, // Change bundle filter
30  OP_UNDO_BUNDLE_LOCK_FLAG, // Change flag
31  OP_UNDO_BUNDLE_NAME, // Name change
32  OP_UNDO_BUNDLE_PATTERN // Smart bundle pattern change
33 };
34 
36 {
37 public:
39  OP_UndoBundle(OP_Bundle *, const char *oldname);
40  ~OP_UndoBundle() override;
41 
42  void undo() override;
43  void redo() override;
44 
45 private:
46  void resetSize();
47  void swap(OP_Bundle *bundle);
48  void swapFilter(OP_Bundle *bundle);
49  void swapPattern(OP_Bundle *bundle);
50  void swapName();
51 
52  UT_String myBundleName;
53  UT_String myOldBundleName;
54  UT_String * myPattern;
55  const OP_BundleFilter *myFilter;
56  int myLockFlag:1;
57  int myPatternNode;
58  UT_Array<int> myNodeIds;
59  OP_UndoBundleOperation myOperation;
60 };
61 #endif
62 
virtual void redo()=0
void swap(T &lhs, T &rhs)
Definition: pugixml.cpp:7172
OP_UndoBundleOperation
Definition: OP_UndoBundle.h:24
virtual void undo()=0
#define OP_API
Definition: OP_API.h:10