OpendTect  6.3
undo.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Kristofer Tingdahl
8  Date: 4-11-2002
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "algomod.h"
15 #include "bufstringset.h"
16 #include "notify.h"
17 
18 class UndoEvent;
19 
40 mExpClass(Algo) Undo : public CallBacker
41 {
42 public:
43  Undo();
44  virtual ~Undo();
45 
46  void removeAll();
47  int maxLength() const;
53  void setMaxLength(int);
54  int addEvent(UndoEvent* event,
55  const char* description=0);
58  int currentEventID() const;
59  int firstEventID() const;
60  int lastEventID() const;
61 
62  void removeAllAfterCurrentEvent();
63  void removeAllBeforeCurrentEvent();
64 
65  bool isUserInteractionEnd(int eventid) const;
66  void setUserInteractionEnd(int eventid,bool=true);
67  int getNextUserInteractionEnd(int start) const;
68 
69  BufferString getDesc(int eventid) const;
70  void setDesc(int eventid,const char* d);
71  BufferString unDoDesc() const;
72  BufferString reDoDesc() const;
75  bool canUnDo() const;
76  bool unDo(int nrtimes=1,bool userinteraction=true);
77 
78  bool canReDo() const;
79  bool reDo(int nrtimes=1,bool userinteraction=true);
80 
82  Notifier<Undo> undoredochange; //can**Do() or **DoDesc() change
83 
84 protected:
85 
86  int indexOf(int eventid) const;
87 
88  void removeOldEvents();
89  void removeStartToAndIncluding(int);
92  int maxsize_;
93 
96 
98 
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:
121 
124 
125 };
126 
127 
131 {
132 public:
133 
134  virtual const BinID& getBinID() const;
135 
136 };
virtual ~UndoEvent()
virtual bool reDo()=0
#define mExpClass(module)
Definition: commondefs.h:157
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
BinID UndoEvent.
Definition: undo.h:130
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:51
virtual bool unDo()=0
BufferString getDesc() const
int maxsize_
Definition: undo.h:92
int firsteventid_
Definition: undo.h:91
Notifier< Undo > undoredochange
Definition: undo.h:82
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
Class to handle undo/redo information.
Definition: undo.h:40
bool isUserInteractionEnd() const
void removeAll()
Notifier< Undo > changenotifier
Definition: undo.h:81
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:38
BufferString * desc_
Definition: undo.h:122
int currenteventid_
Definition: undo.h:90
ObjectSet< UndoEvent > events_
Definition: undo.h:94
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:28
Threads::Lock addlock_
Definition: undo.h:97
int userendscount_
Definition: undo.h:95
bool isuserinteractionend_
Definition: undo.h:123
void setUserInteractionEnd(bool=true)

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