vtkSMUndoStackBuilder.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkSMUndoStackBuilder_h
19 #define vtkSMUndoStackBuilder_h
20 
21 #include "vtkRemotingServerManagerModule.h" //needed for exports
22 #include "vtkSMMessageMinimal.h" // needed for vtkSMMessage
23 #include "vtkSMObject.h"
24 
25 class vtkSMProxy;
26 class vtkSMUndoStack;
27 class vtkUndoElement;
28 class vtkUndoSet;
29 class vtkSMSession;
30 
32 {
33 public:
34  static vtkSMUndoStackBuilder* New();
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
48  virtual void Begin(const char* label);
49 
58  virtual void End();
59 
61 
65  {
66  this->End();
67  this->PushToStack();
68  }
70 
78  virtual void PushToStack();
79 
83  virtual void Clear();
84 
91  virtual bool Add(vtkUndoElement* element);
92 
94 
97  vtkGetObjectMacro(UndoStack, vtkSMUndoStack);
98  virtual void SetUndoStack(vtkSMUndoStack*);
100 
102 
109  vtkSetMacro(IgnoreAllChanges, bool);
110  vtkGetMacro(IgnoreAllChanges, bool);
112 
113  // Record a state change on a RemoteObject
114  virtual void OnStateChange(vtkSMSession* session, vtkTypeUInt32 globalId,
115  const vtkSMMessage* previousState, const vtkSMMessage* newState);
116 
117  // Indicate that a new object was created.
118  // Simply fires the vtkSMUndoStack::ObjectCreationEvent from the undo-stack.
119  virtual void OnCreateObject(vtkSMSession* session, vtkSMMessage* newState);
120 
121 protected:
123  ~vtkSMUndoStackBuilder() override;
124 
127  char* Label;
128  vtkSetStringMacro(Label);
129 
134  virtual bool HandleChangeEvents() { return (this->EnableMonitoring > 0); }
135 
136  void InitializeUndoSet();
137 
138  // used to count Begin/End call to make sure they stay consistent
139  // and make sure that a begin occurs before recording any event
142 
143 private:
145  void operator=(const vtkSMUndoStackBuilder&) = delete;
146 };
147 
148 #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:22
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:17
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:30
static vtkSMObject * New()
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
void EndAndPushToStack()
Convenience method call End(); PushToStack(); in that order.
void PrintSelf(ostream &os, vtkIndent indent) override