121 void TQCommand::Init(
const char *clname,
void *obj,
const char *redo,
const char *undo)
131 fUndo = undo ?
new TQConnection(clname, obj, cundo) :
fRedo;
138 if (!obj && !redo && !undo) {
172 Init(clname, obj, redo, undo);
204 else Init(0, 0, redo, undo);
222 for (
int i = 0; i<
fNRargs; i++) {
228 for (
int i = 0; i <
fNUargs; i++) {
298 TString ostr = lnk->GetOption();
300 TObject *obj = lnk->GetObject();
301 lnk->SetObject(
nullptr);
340 TIter next(collection);
345 "Cannot merge - an object which doesn't inherit from TQCommand found in the list");
405 for (
int i = 0; i <
fNRargs; i++) {
446 if (!redo || !undo || (redo != undo))
return kFALSE;
491 for (i = 0; i <
fNRargs; i++) {
494 for (i = 0; i <
fNUargs; i++) {
528 for (
int i = 0; i <
fNRargs; i++) {
562 for (
int i = 0; i <
fNUargs; i++) {
594 gActiveCommand =
this;
617 if (done)
Emit(
"Redo()");
632 gActiveCommand =
this;
638 TString opt = lnk->GetOption();
639 auto sav = lnk->PrevSP();
643 delete lnk->GetObject();
660 if (done)
Emit(
"Undo()");
673 const Int_t maxname = 100;
857 lnk->GetObject()->ls();
967 TString ostr = onredo ?
"1radd" :
"0radd";
968 if (opt) ostr += opt;
1016 Emit(
"CurrentChanged(TQCommand*)", (
long)c);
virtual Bool_t CanUndo() const
Returns kTRUE if undo action is possible.
virtual void SetUndoArgs(Int_t nargs,...)
Set undo parameters.
virtual void Merge(TQCommand *c)
Add command to the list of merged commands.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void SetLogging(Bool_t on=kTRUE)
Start logging.
Long_t * GetUndoArgs() const
Returns a pointer to array of undo arguments.
Bool_t IsUndoing() const
Undo action is in progress.
virtual void Add(TObject *obj, Option_t *opt)
Add command to the stack of commands.
Bool_t IsRedoing() const
Redo action is in progress.
const char * GetUndoName() const
Returns the name of undo command.
virtual void Compress(TQCommand *c)
Compress command.
virtual Int_t GetEntries() const
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
TQUndoManager()
Constructor.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Long_t * GetRedoArgs() const
Returns a pointer to array of redo arguments.
virtual Bool_t CanMerge(TQCommand *c) const
Two commands can be merged if they can be composed into a single command (Macro command).
virtual void Init(const char *cl, void *object, const char *redo, const char *undo)
Common protected method used in several constructors.
TQConnection * GetRedo() const
virtual Bool_t IsEqual(const TObject *obj) const
Equal comparison.
TQCommand * GetCursor() const
Returns a command correspondent to the current cursor position in stack.
virtual void Undo(Option_t *option="")
Performs undo action. Move cursor position backward in history stack.
virtual Bool_t IsSetter() const
Returns kTRUE is command if Redo is the same as Undo function and is the setter action.
virtual Bool_t CanRedo() const
Returns kTRUE if Redo action is possible, kFALSE if it's not.
virtual void AddLast(TObject *obj)
Add object at the end of the list.
virtual ~TQCommand()
dtor.
virtual void Redo(Option_t *option="")
Execute command and then merge commands.
virtual ~TQUndoManager()
Destructor.
Int_t GetNRargs() const
Returns a number of redo arguments.
Int_t GetNUargs() const
Returns a number of undo arguments.
virtual void ls(Option_t *option="") const
Lists all commands in stack.
virtual void Redo(Option_t *option="")
Performs redo action. Move cursor position forward in history stack.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void SetArgs(Int_t nargs,...)
Set do/redo and undo parameters.
UInt_t GetLimit() const
Returns a maximum number of commands which could be located in stack.
#define R__WRITE_LOCKGUARD(mutex)
R__EXTERN TVirtualRWMutex * gCoreMutex
TQCommand(const char *cl=0, void *object=0, const char *redo=0, const char *undo=0)
Constructor.
Bool_t IsExecuting() const
Returns kTRUE if command execution is in progress.
static TQCommand * gActiveCommand
void * GetObject() const
Returns an object for which undo redo actions are applied.
TQConnection class is an internal class, used in the object communication mechanism.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void CurrentChanged(TQCommand *c)
emit signal
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Collection abstract base class.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual Bool_t CanCompress(TQCommand *c) const
By default, commands can be compressed if they are:
virtual void Delete(Option_t *option="")
If "opt" is not zero delete every merged command which option string is equal to "opt".
Int_t GetStatus() const
Returns a number of sequential undo or redo operations.
virtual Bool_t CanUndo() const
Returns kTRUE if Undo action is possible, kFALSE if it's not.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
virtual void SetTitle(const char *title)
Sets description of the command.
virtual void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const
Print collection entry.
virtual void ls(Option_t *option="") const
ls this command and merged commands
virtual Bool_t IsEmpty() const
virtual Bool_t CanRedo() const
Returns kTRUE if redo action is possible.
Bool_t IsMacro() const
Returns kTRUE if neither redo nor undo action specified.
Wrapper around a TObject so it can be stored in a TList.
virtual void SetName(const char *name)
Sets name of the command.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void Add(TObject *obj, Option_t *opt)
Add command to the list of merged commands.
const char * GetName() const override
Returns name of connection (aka name of slot)
virtual const char * GetTitle() const
Returns command description.
virtual void SetRedoArgs(Int_t nargs,...)
Set redo parameters.
virtual void Undo(Option_t *option="")
Un-execute all merged commands and the command.
Mother of all ROOT objects.
TObject * GetObject() const
virtual void Add(TObject *obj)
Recorder of operations for undo and redo.
Bool_t IsLogging() const
Returns kTRUE if logging is ON.
static TString CompressName(const char *method_name)
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in t...
static TQCommand * GetCommand()
Return a command which is doing redo/undo action.
virtual const char * GetName() const
Returns the command name.
The Command design pattern is based on the idea, that all editing in an application is done by creati...
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
const char * GetRedoName() const
Returns the name of redo command.
TQCommand * GetCurrent() const
Returns the last executed command.
const char * GetClassName() const
virtual void PrintCollectionHeader(Option_t *option) const
Print collection header.
void ExecuteMethod(Int_t nargs, va_list va)=delete
virtual void SetLimit(UInt_t limit)
Returns a maximum number of commands which could be located in stack.
TObjLinkPtr_t fLast
pointer to first entry in linked list
const char * Data() const