OpendTect-6_4  6.4
undo.h
Go to the documentation of this file.
1 #ifndef undo_h
2 #define undo_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl
9  Date: 4-11-2002
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "algomod.h"
17 #include "bufstringset.h"
18 #include "callback.h"
19 
20 class UndoEvent;
21 
42 mExpClass(Algo) Undo : public CallBacker
43 {
44 public:
45  Undo();
46  virtual ~Undo();
47 
48  void removeAll();
49  int maxLength() const;
55  void setMaxLength(int);
56  int addEvent(UndoEvent* event,
57  const char* description=0);
60  int currentEventID() const;
61  int firstEventID() const;
62  int lastEventID() const;
63 
64  void removeAllAfterCurrentEvent();
65  void removeAllBeforeCurrentEvent();
66 
67  bool isUserInteractionEnd(int eventid) const;
68  void setUserInteractionEnd(int eventid,bool=true);
69  int getNextUserInteractionEnd(int start) const;
70 
71  BufferString getDesc(int eventid) const;
72  void setDesc(int eventid,const char* d);
73  BufferString unDoDesc() const;
74  BufferString reDoDesc() const;
77  bool canUnDo() const;
78  bool unDo(int nrtimes=1,bool userinteraction=true);
79 
80  bool canReDo() const;
81  bool reDo(int nrtimes=1,bool userinteraction=true);
82 
84  Notifier<Undo> undoredochange; //can**Do() or **DoDesc() change
85 
86 protected:
87  int indexOf(int eventid) const;
88 
89  void removeOldEvents();
90  void removeStartToAndIncluding(int);
93  int maxsize_;
94 
97 
99 };
100 
101 
105 {
106 public:
107  UndoEvent();
108  virtual ~UndoEvent();
109 
110  BufferString getDesc() const;
111  void setDesc(const char*);
112 
113  void setUserInteractionEnd(bool=true);
114  bool isUserInteractionEnd() const;
115 
116  virtual const char* getStandardDesc() const = 0;
117  virtual bool unDo() = 0;
118  virtual bool reDo() = 0;
119 
120 protected:
123 };
124 
125 
129 {
130 public:
131  virtual const BinID& getBinID() const;
132 };
133 
134 
135 #endif
virtual ~UndoEvent()
virtual bool reDo()=0
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
BinID UndoEvent.
Definition: undo.h:128
virtual const char * getStandardDesc() const =0
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
virtual bool unDo()=0
BufferString getDesc() const
int maxsize_
Definition: undo.h:93
int firsteventid_
Definition: undo.h:92
Notifier< Undo > undoredochange
Definition: undo.h:84
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
Class to handle undo/redo information.
Definition: undo.h:42
bool isUserInteractionEnd() const
void removeAll()
Notifier< Undo > changenotifier
Definition: undo.h:83
void setDesc(const char *)
Holds the information on how to undo/redo something.
Definition: undo.h:104
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
BufferString * desc_
Definition: undo.h:121
int currenteventid_
Definition: undo.h:91
ObjectSet< UndoEvent > events_
Definition: undo.h:95
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Threads::Lock addlock_
Definition: undo.h:98
int userendscount_
Definition: undo.h:96
bool isuserinteractionend_
Definition: undo.h:122
void setUserInteractionEnd(bool=true)

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019