120void TQCommand::Init(
const char *clname,
void *obj,
const char *redo,
const char *undo)
137 if (!obj && !redo && !undo) {
171 Init(clname, obj, redo, undo);
203 else Init(
nullptr,
nullptr, redo, undo);
221 for (
int i = 0; i<
fNRargs; i++) {
227 for (
int i = 0; i <
fNUargs; i++) {
297 TString ostr = lnk->GetOption();
299 TObject *obj = lnk->GetObject();
300 lnk->SetObject(
nullptr);
339 TIter next(collection);
344 "Cannot merge - an object which doesn't inherit from TQCommand found in the list");
369 if (
c->CanCompress(o) || (
c->IsEqual(o) && ostr.
Contains(
"compress"))) {
404 for (
int i = 0; i <
fNRargs; i++) {
427 return ((
cname ==
c->GetRedo()->GetClassName()) &&
428 (rname ==
c->GetRedo()->GetName()));
445 if (!redo || !undo || (redo != undo))
return kFALSE;
490 for (i = 0; i <
fNRargs; i++) {
493 for (i = 0; i <
fNUargs; i++) {
527 for (
int i = 0; i <
fNRargs; i++) {
561 for (
int i = 0; i <
fNUargs; i++) {
616 if (done)
Emit(
"Redo()");
637 TString opt = lnk->GetOption();
638 auto sav = lnk->PrevSP();
642 delete lnk->GetObject();
659 if (done)
Emit(
"Undo()");
672 const Int_t maxname = 100;
966 TString ostr = onredo ?
"1radd" :
"0radd";
967 if (opt) ostr += opt;
992 if (
c->CanCompress(o) ||
c->CanMerge(o) ||
995 c->Add(o, ostr.
Data());
1090 if (
c->CanRedo())
return kTRUE;
1093 return (
c &&
c->CanRedo());
1104 if (
c->CanUndo())
return kTRUE;
1107 return (
c &&
c->CanUndo());
constexpr UInt_t kMaxUInt
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
static TQCommand * gActiveCommand
#define R__WRITE_LOCKGUARD(mutex)
Collection abstract base class.
virtual Int_t GetEntries() const
virtual Bool_t IsEmpty() const
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
void AddLast(TObject *obj) override
Add object at the end of the list.
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
TObjLinkPtr_t fLast
pointer to first entry in linked list
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
The Command design pattern is based on the idea, that all editing in an application is done by creati...
Bool_t IsRedoing() const
Redo action is in progress.
virtual void SetArgs(Int_t nargs,...)
Set do/redo and undo parameters.
virtual void Undo(Option_t *option="")
Un-execute all merged commands and the command.
virtual Bool_t CanCompress(TQCommand *c) const
By default, commands can be compressed if they are:
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 SetRedoArgs(Int_t nargs,...)
Set redo parameters.
Int_t GetNUargs() const
Returns a number of undo arguments.
TQCommand(const char *cl=nullptr, void *object=nullptr, const char *redo=nullptr, const char *undo=nullptr)
Constructor.
Long_t * GetRedoArgs() const
Returns a pointer to array of redo arguments.
void Delete(Option_t *option="") override
If "opt" is not zero delete every merged command which option string is equal to "opt".
virtual Bool_t CanRedo() const
Returns kTRUE if Redo action is possible, kFALSE if it's not.
virtual Bool_t CanUndo() const
Returns kTRUE if Undo action is possible, kFALSE if it's not.
void Add(TObject *obj, Option_t *opt) override
Add command to the list of merged commands.
const char * GetUndoName() const
Returns the name of undo command.
virtual Bool_t IsSetter() const
Returns kTRUE is command if Redo is the same as Undo function and is the setter action.
const char * GetRedoName() const
Returns the name of redo command.
virtual void Compress(TQCommand *c)
Compress command.
const char * GetName() const override
Returns the command name.
virtual void SetUndoArgs(Int_t nargs,...)
Set undo parameters.
virtual void SetName(const char *name)
Sets name of the command.
Bool_t IsUndoing() const
Undo action is in progress.
virtual void Merge(TQCommand *c)
Add command to the list of merged commands.
void * GetObject() const
Returns an object for which undo redo actions are applied.
virtual ~TQCommand()
dtor.
virtual void Init(const char *cl, void *object, const char *redo, const char *undo)
Common protected method used in several constructors.
Bool_t IsExecuting() const
Returns kTRUE if command execution is in progress.
void PrintCollectionHeader(Option_t *option) const override
Print collection header.
const char * GetTitle() const override
Returns command description.
Bool_t IsEqual(const TObject *obj) const override
Equal comparison.
Int_t GetStatus() const
Returns a number of sequential undo or redo operations.
virtual void Redo(Option_t *option="")
Execute command and then merge commands.
Bool_t IsMacro() const
Returns kTRUE if neither redo nor undo action specified.
Long_t * GetUndoArgs() const
Returns a pointer to array of undo arguments.
static TQCommand * GetCommand()
Return a command which is doing redo/undo action.
Int_t GetNRargs() const
Returns a number of redo arguments.
virtual void SetTitle(const char *title)
Sets description of the command.
void ls(Option_t *option="") const override
ls this command and merged commands
TQConnection class is an internal class, used in the object communication mechanism.
const char * GetClassName() const
const char * GetName() const override
Returns name of connection (aka name of slot)
void ExecuteMethod(Int_t nargs, va_list va)=delete
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
static TString CompressName(const char *method_name)
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in t...
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Recorder of operations for undo and redo.
virtual ~TQUndoManager()
Destructor.
Bool_t CanUndo() const override
Returns kTRUE if undo action is possible.
void ls(Option_t *option="") const override
Lists all commands in stack.
TQUndoManager()
Constructor.
UInt_t GetLimit() const
Returns a maximum number of commands which could be located in stack.
void Redo(Option_t *option="") override
Performs redo action. Move cursor position forward in history stack.
Bool_t IsLogging() const
Returns kTRUE if logging is ON.
TQCommand * GetCursor() const
Returns a command correspondent to the current cursor position in stack.
TQCommand * GetCurrent() const
Returns the last executed command.
void Add(TObject *obj, Option_t *opt) override
Add command to the stack of commands.
void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const override
Print collection entry.
Bool_t CanRedo() const override
Returns kTRUE if redo action is possible.
void Undo(Option_t *option="") override
Performs undo action. Move cursor position backward in history stack.
virtual void SetLogging(Bool_t on=kTRUE)
Start logging.
virtual void CurrentChanged(TQCommand *c)
emit signal
virtual void SetLimit(UInt_t limit)
Returns a maximum number of commands which could be located in stack.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
R__EXTERN TVirtualRWMutex * gCoreMutex