vtkSMUndoStackBuilder.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMUndoStackBuilder.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkSMUndoStackBuilder_h
31 #define vtkSMUndoStackBuilder_h
32 
33 #include "vtkRemotingServerManagerModule.h" //needed for exports
34 #include "vtkSMMessageMinimal.h" // needed for vtkSMMessage
35 #include "vtkSMObject.h"
36 
37 class vtkSMProxy;
38 class vtkSMUndoStack;
39 class vtkUndoElement;
40 class vtkUndoSet;
41 class vtkSMSession;
42 
44 {
45 public:
46  static vtkSMUndoStackBuilder* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
60  virtual void Begin(const char* label);
61 
70  virtual void End();
71 
73 
77  {
78  this->End();
79  this->PushToStack();
80  }
82 
90  virtual void PushToStack();
91 
95  virtual void Clear();
96 
103  virtual bool Add(vtkUndoElement* element);
104 
106 
109  vtkGetObjectMacro(UndoStack, vtkSMUndoStack);
110  virtual void SetUndoStack(vtkSMUndoStack*);
112 
114 
121  vtkSetMacro(IgnoreAllChanges, bool);
122  vtkGetMacro(IgnoreAllChanges, bool);
124 
125  // Record a state change on a RemoteObject
126  virtual void OnStateChange(vtkSMSession* session, vtkTypeUInt32 globalId,
127  const vtkSMMessage* previousState, const vtkSMMessage* newState);
128 
129  // Indicate that a new object was created.
130  // Simply fires the vtkSMUndoStack::ObjectCreationEvent from the undo-stack.
131  virtual void OnCreateObject(vtkSMSession* session, vtkSMMessage* newState);
132 
133 protected:
135  ~vtkSMUndoStackBuilder() override;
136 
139  char* Label;
140  vtkSetStringMacro(Label);
141 
146  virtual bool HandleChangeEvents() { return (this->EnableMonitoring > 0); }
147 
148  void InitializeUndoSet();
149 
150  // used to count Begin/End call to make sure they stay consistent
151  // and make sure that a begin occurs before recording any event
154 
155 private:
157  void operator=(const vtkSMUndoStackBuilder&) = delete;
158 };
159 
160 #endif
unit undo-redo-able operation.
builds server manager undo sets and pushes them on the undo stack.
#define VTKREMOTINGSERVERMANAGER_EXPORT
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:35
This is the undo/redo stack for the Server Manager.
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
superclass for most server manager classes
Definition: vtkSMObject.h:29
virtual bool HandleChangeEvents()
Returns if the event raised by the proxy manager should be converted to undo elements.
Maintains a collection of vtkUndoElement that can be undone/redone in a single step.
Definition: vtkUndoSet.h:42
static vtkSMObject * New()
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
void EndAndPushToStack()
Convenience method call End(); PushToStack(); in that order.
void PrintSelf(ostream &os, vtkIndent indent) override