182class TGCursorWindow :
public TGFrame {
189 virtual ~TGCursorWindow();
199TGCursorWindow::TGCursorWindow() :
207 gVirtualX->ShapeCombineMask(fId, 0, 0, fMask);
208 SetBackgroundPixmap(fPic);
214 gVirtualX->ChangeWindowAttributes(fId, &wattr);
220TGCursorWindow::~TGCursorWindow()
243 if ((opt ==
"NEW") || (opt ==
"RECREATE"))
244 Start(filename, option);
338 if (delPreviousState)
411 "RegisterWindow(Window_t)");
464 Error(
"TRecorderReplaying::Initialize",
465 "The ROOT file is not valid event logfile.");
476 Error(
"TRecorderReplaying::Initialize",
477 "The ROOT file is not valid event logfile");
483 Info(
"TRecorderReplaying::Initialize",
484 "Log file empty. No event to replay.");
493 gClient->Connect(
"RegisteredWindow(Window_t)",
"TRecorderReplaying",
494 this,
"RegisterWindow(Window_t)");
496 Info(
"TRecorderReplaying::Initialize",
"Replaying of file %s started",
500 if (
f && !
f->IsZombie()) {
501 TIter nextkey(
f->GetListOfKeys());
504 while ((key = (
TKey*)nextkey())) {
514 while ((canvas = (
TCanvas*)nextc())) {
524 fTimer->
Connect(
"Timeout()",
"TRecorderReplaying",
this,
"ReplayRealtime()");
560 Error(
"TRecorderReplaying::RegisterWindow",
561 "More windows registered than expected");
567 std::ios::fmtflags
f = std::cout.flags();
568 std::cout <<
" Window registered: new ID: " << std::hex << w <<
569 " previous ID: " <<
fWin << std::dec << std::endl;
570 std::cout.flags(
f );
589 std::ios::fmtflags
f = std::cout.flags();
591 " registered." << std::dec << std::endl;
592 std::cout.flags(
f );
630 for (
Int_t i = 0; i < 5; ++i) {
651 std::ios_base::fmtflags org_flags = std::cout.flags();
656 std::cout.flags(org_flags);
832 Error(
"TRecorderReplaying::CanOverlap()",
"fGuiEvent = 0");
842 std::cout <<
"Event overlapping " <<
880 gROOT->SetEditorMode();
909 gVirtualX->LookupString(
e, str,
sizeof(str), keysym);
911 if ((keysym & ~0x20) ==
kKey_S) {
932 Info(
"TRecorderReplaying::ReplayRealtime",
"Replaying finished");
954 Info(
"TRecorderReplaying::Pause",
"Replaying paused.");
962 Info(
"TRecorderReplaying::ReplayStop",
"Replaying cancelled");
1016 if (replay->
Initialize(
r, showMouseCursor, mode)) {
1017 r->ChangeState(replay);
1040 if (
file->IsZombie() || !
file->IsOpen()) {
1047 Error(
"TRecorderInactive::List",
1048 "The ROOT file is not valid event logfile.");
1056 Int_t entries =
t1->GetEntries();
1057 for (
Int_t i = 0; i < entries; ++i) {
1059 std::cout <<
"[" << i <<
"] " <<
"fTime=" <<
1061 fCmdEvent->
GetText() << std::endl;
1063 std::cout << std::endl;
1083 if (
file->IsZombie() || !
file->IsOpen()) {
1090 Error(
"TRecorderInactive::ListGui",
1091 "The ROOT file is not valid event logfile.");
1099 Int_t entries =
t1->GetEntries();
1101 for (
Int_t i = 0; i < entries ; ++i) {
1116 std::ios::fmtflags
f = std::cout.flags();
1117 std::cout <<
"[" <<
n <<
"] " << std::dec << std::setw(10)
1119 <<
" fW:" << std::hex <<
e->fWindow
1120 <<
" t:" << std::dec <<
e->fTime
1130 <<
" se:" <<
e->fSendEvent
1131 <<
" h:" <<
e->fHandle
1135 for (
Int_t i=0; i<5; ++i)
1140 std::cout <<
" | fM:" << std::hex <<
e->fMasked;
1142 std::cout << std::endl;
1143 std::cout.flags(
f );
1153 if (
f && !
f->IsZombie()) {
1179 Info(
"TRecorderPaused::Resume",
"Replaying resumed");
1192 Info(
"TRecorderReplaying::ReplayStop",
"Reaplying cancelled");
1234 "RecordMousePosition()");
1279 this,
"RecordCmdEvent(const char*)");
1283 gClient->Connect(
"RegisteredWindow(Window_t)",
"TRecorderRecording",
this,
1284 "RegisterWindow(Window_t)");
1289 gClient->Connect(
"ProcessedEvent(Event_t*, Window_t)",
"TRecorderRecording",
1290 this,
"RecordGuiEvent(Event_t*, Window_t)");
1295 "TRecorderRecording",
this,
"RecordGuiCNEvent(Event_t*)");
1300 this,
"RecordPave(const TObject*)");
1304 "TRecorderRecording",
this,
"RecordText(const TObject*)");
1309 "FilterEventPave()");
1318 "TRecorderRecording",
this,
"RecordGuiBldEvent(Event_t*)");
1327 Int_t numCanvases =
gROOT->GetListOfCanvases()->LastIndex();
1329 if (numCanvases >= 0){
1335 while ((twin = (
TGWindow*) nextwindow())) {
1339 std::cout <<
"WindowID "<< twin2 <<
" filtered" << std::endl;
1342 else if (twin !=
gClient->GetRoot()) {
1356 Info(
"TRecorderRecording::StartRecording",
"Recording started. Log file: %s",
1368 "RecordGuiBldEvent(Event_t*)");
1370 "RecordGuiCNEvent(Event_t*)");
1372 "RecordPave(const TObject*)");
1374 "RecordText(const TObject*)");
1377 gClient->Disconnect(
gClient,
"ProcessedEvent(Event_t*, Window_t)",
this,
1378 "RecordGuiEvent(Event_t*, Window_t)");
1380 "RegisterWindow(Window_t)");
1382 "RecordCmdEvent(const char*)");
1396 Info(
"TRecorderRecording::Stop",
"Recording finished.");
1482 e->fFormat =
e->fType;
1561 cad =
"TPaveLabel *p = new TPaveLabel(";
1562 cad += pavel->
GetX1();
1564 cad += pavel->
GetY1();
1566 cad += pavel->
GetX2();
1568 cad += pavel->
GetY2();
1569 cad +=
",\"\"); p->Draw(); gPad->Modified(); gPad->Update();";
1571 interval /= (len + 2);
1573 for (i=0; i < len; ++i) {
1574 cad =
"p->SetLabel(\"";
1575 cad += (aux += label[i]);
1578 cad +=
" p->SetTextFont(83); p->SetTextSizePixels(14); ";
1580 cad +=
" gPad->Modified(); gPad->Update();";
1581 extratime += interval;
1584 cad =
"p->SetTextFont(";
1586 cad +=
"); p->SetTextSize(";
1588 cad +=
"); gPad->Modified(); gPad->Update();";
1589 extratime += interval;
1605 cad =
"TLatex *l = new TLatex(";
1606 cad += texto->
GetX();
1608 cad += texto->
GetY();
1609 cad +=
",\"\"); l->Draw(); gPad->Modified(); gPad->Update();";
1611 interval /= (len + 2);
1613 for (i=0; i < len; ++i) {
1614 cad =
"l->SetTitle(\"";
1615 cad += (aux += label[i]);
1618 cad +=
" l->SetTextFont(83); l->SetTextSizePixels(14); ";
1620 cad +=
" gPad->Modified(); gPad->Update();";
1621 extratime += interval;
1624 cad =
"l->SetTextFont(";
1626 cad +=
"); l->SetTextSize(";
1628 cad +=
"); gPad->Modified(); gPad->Update();";
1629 cad +=
" TVirtualPad *spad = gPad->GetCanvas()->GetSelectedPad();";
1630 cad +=
" gPad->GetCanvas()->Selected(spad, l, kButton1Down);";
1631 extratime += interval;
1690 for(
Int_t i=0; i<5; ++i)
1699 gVirtualX->LookupString(
e, tmp,
sizeof(tmp), keysym);
1732 if ((
e->fX == 0 &&
e->fY == 0)) {
1867 fTimer->
Connect(
"Timeout()",
"TGRecorder",
this,
"Update()");
1908 running = gmtime( &elapsed_time );
1923 stime.
Form(
"%02d:%02d:%02d", running->tm_hour,
1924 running->tm_min, running->tm_sec);
1966 "All files",
"*",
"Text files",
"*.txt",
"ROOT files",
"*.root", 0, 0
1984 if (!
gROOT->GetListOfCanvases()->IsEmpty()) {
2090 Int_t px, py, dx, dy;
2117 gVirtualX->GetWindowAttributes(
e->fWindow, attr);
2118 if ((
e->fX - attr.
fX > 0) && (
e->fY - attr.
fY > 0))
2133 Error(
"TRecGuiEvent::ReplayEvent",
2134 "kConfigureNotify: Unknown value: fUser[4] = %ld ",
2143 Error(
"TRecGuiEvent::ReplayEvent",
2144 "kConfigureNotify: Window does not exist anymore ");
2153 e->fX,
e->fY, px, py, wtarget);
2228 for(
Int_t i=0; i<5; ++i)
2229 e->fUser[i] = ge->
fUser[i];
2238 e->fUser[2] =
e->fCode;
const Mask_t kWAOverrideRedirect
const Mask_t kWASaveUnder
const Mask_t kKeyControlMask
unsigned long long ULong64_t
R__EXTERN TApplication * gApplication
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
static const char * gFiletypes[]
const char * kCmdEventTree
const char * kRecEventNames[]
const char * kExtraEventTree
static Int_t gDecorHeight
const char * kWindowsTree
const char * kGuiEventTree
static TGCursorWindow * gCursorWin
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualDragManager * gDragManager
R__EXTERN Atom_t gROOT_MESSAGE
R__EXTERN Atom_t gWM_DELETE_WINDOW
virtual Float_t GetTextSize() const
Return the text size.
virtual Font_t GetTextFont() const
Return the text font.
Using a TBrowser one can browse all ROOT objects.
void SetWindowSize(UInt_t ww, UInt_t wh)
UInt_t GetWindowHeight() const
virtual void Draw(Option_t *option="")
Draw a canvas.
UInt_t GetWindowWidth() const
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) override
Write memory objects to this file.
void Close(Option_t *option="") override
Close a file.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void Layout()
Layout the elements of the composite frame.
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual void MapWindow()
map window
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
virtual void SetText(TGString *newText)
Set new text in label.
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Pixmap_t GetPicture() const
Window_t fFilteredIds[fgWidgetsCount]
TGPictureButton * fStartStop
virtual ~TGRecorder()
Destructor. Cleanup the GUI.
TGCheckButton * fCursorCheckBox
void StartStop()
Handles push of the fStartStop button according to the current recorder state.
TGPictureButton * fReplay
TGRecorder(const TGWindow *p=0, UInt_t w=230, UInt_t h=150)
The GUI for the recorder.
void Update()
Called when fTimer timeouts (every 0.025 second) Updates GUI of recorder.
static const Int_t fgWidgetsCount
void SetDefault()
Sets GUI to the default inactive state.
void Replay()
Handles push of fReplay button according to the current recorder state.
virtual void Move(Int_t x, Int_t y)
Move the window.
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize the window.
const TGWindow * GetParent() const
virtual void Resize(UInt_t w, UInt_t h)
Resize the window.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual TObject * ReadObj()
To read a TObject* from the file.
To draw Mathematical Formula.
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
virtual void Add(TObject *obj)
Int_t UnLock()
Unlock the mutex.
Int_t Lock()
Lock the mutex.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
R__ALWAYS_INLINE Bool_t IsZombie() const
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.
A Pave (see TPave) with a text centered in the Pave.
const char * GetLabel() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
const char * GetText() const
void SetText(const char *text)
virtual void ReplayEvent(Bool_t showMouseCursor=kTRUE)=0
virtual void SetTime(TTime t)
virtual TTime GetTime() const
virtual ERecEventType GetType() const =0
virtual void ReplayEvent(Bool_t showMouseCursor=kTRUE)
Replays stored GUI event.
static Event_t * CreateEvent(TRecGuiEvent *ge)
Converts TRecGuiEvent type to Event_t type.
virtual void ListCmd(const char *filename)
Prints out commandline events recorded in given file.
virtual void Start(TRecorder *r, const char *filename, Option_t *option, Window_t *w=0, Int_t winCount=0)
Switches from INACTIVE state to RECORDING and starts recording.
void PrevCanvases(const char *filename, Option_t *option)
Save previous canvases in a .root file.
TSeqCollection * fCollect
virtual Bool_t Replay(TRecorder *r, const char *filename, Bool_t showMouseCursor, TRecorder::EReplayModes mode)
Switches from INACTIVE state of recorder to REPLAYING Return kTRUE if replaying has started or kFALSE...
static void DumpRootEvent(TRecGuiEvent *e, Int_t n)
Prints out attributes of one GUI event TRecGuiEvent *e Int_n n is number of event if called in cycle.
static long DisplayValid(Long_t n)
virtual void ListGui(const char *filename)
Prints out GUI events recorded in given file.
TRecorderReplaying * fReplayingState
virtual void Resume(TRecorder *r)
Continues replaying.
TRecorderPaused(TRecorderReplaying *state)
Rememeber the recorder state that is paused.
virtual void ReplayStop(TRecorder *r)
Replaying is cancelled.
TRecExtraEvent * fExtraEvent
void FilterEventPave()
Change the state of the flag to kTRUE when you are recording a pavelabel.
void RecordMousePosition()
Try to record all mouse moves...
friend class TRecorderInactive
TRecorderRecording(TRecorder *r, const char *filename, Option_t *option, Window_t *w, Int_t winCount)
Initializes TRecorderRecording for recording What is allocated here is deleted in destructor.
void RegisterWindow(Window_t w)
This method is called when RegisteredWindow(Window_t) is emitted from TGClient.
virtual void Stop(TRecorder *r, Bool_t guiCommand)
Disconnects all slots and stopps recording.
Bool_t StartRecording()
Connects appropriate signals and slots in order to gain all registered windows and processed events i...
void StartEditing()
Memorize the starting time of editinga TLatex or a TPaveLabel.
void RecordGuiBldEvent(Event_t *e)
Special case for the gui builder, having a timer handling some of the events.
void RecordPave(const TObject *obj)
Records TPaveLabel object created in TCreatePrimitives::Pave()
virtual ~TRecorderRecording()
Freeing of allocated memory.
Bool_t IsFiltered(Window_t id)
Returns kTRUE if passed id belongs to window IDs of recorder GUI itself.
void SetTypeOfConfigureNotify(Event_t *e)
Sets type of kConfigureNotify event to one of EConfigureNotify.
void RecordGuiCNEvent(Event_t *e)
Records GUI Event_t *e of type kConfigureNotify.
void RecordExtraEvent(TString line, TTime extTime)
Records TLatex or TPaveLabel object created in TCreatePrimitives, ExtTime is needed for the correct r...
void RecordGuiEvent(Event_t *e, Window_t wid)
Records GUI Event_t *e different from kConfigureNotify (they are recorded in TRecorderRecording::Reco...
void RecordText(const TObject *obj)
Records TLatex object created in TCreatePrimitives::Text()
void CopyEvent(Event_t *e, Window_t wid)
Copies all items of given event to fGuiEvent.
void RecordCmdEvent(const char *line)
Records commandline event (text and time) ans saves the previous commandline event This 1 event delay...
Bool_t FilterEvent(TRecGuiEvent *e)
friend class TRecorderPaused
friend class TRecorderInactive
virtual void ReplayStop(TRecorder *r)
Cancels replaying.
virtual ~TRecorderReplaying()
Closes all signal-slot connections Frees all memory allocated in contructor.
Bool_t RemapWindowReferences()
All references to the old windows (IDs) in fNextEvent are replaced by new ones according to the mappi...
TRecExtraEvent * fExtraEvent
virtual void Continue()
Continues previously paused replaying.
Bool_t CanOverlap()
ButtonPress and ButtonRelease must be sometimes replayed more times Example: pressing of a button ope...
virtual void Pause(TRecorder *r)
Pauses replaying.
TRecorderReplaying(const char *filename)
Allocates all necessary data structures used for replaying What is allocated here is deleted in destr...
Bool_t PrepareNextEvent()
Finds the next event in log file to replay and sets it to fNextEvent.
Bool_t Initialize(TRecorder *r, Bool_t showMouseCursor, TRecorder::EReplayModes mode)
Initialization of data structures for replaying.
void RegisterWindow(Window_t w)
Creates mapping for the newly registered window w and adds this mapping to fWindowList.
void ReplayRealtime()
Replays the next event.
virtual void PrevCanvases(const char *, Option_t *)
virtual void Resume(TRecorder *)
virtual void Start(TRecorder *, const char *, Option_t *, Window_t *, Int_t)
virtual void ListCmd(const char *)
virtual void ReplayStop(TRecorder *)
virtual void Pause(TRecorder *)
virtual void ListGui(const char *)
virtual TRecorder::ERecorderState GetState() const =0
virtual Bool_t Replay(TRecorder *, const char *, Bool_t, TRecorder::EReplayModes)
virtual void Stop(TRecorder *, Bool_t)
friend class TRecorderInactive
void Stop(Bool_t guiCommand=kFALSE)
Stopps recording events.
void ReplayStop()
Cancells replaying.
void Resume()
Resumes replaying.
TRecorderState * fRecorderState
virtual TRecorder::ERecorderState GetState() const
Get current state of recorder.
void Start(const char *filename, Option_t *option="RECREATE", Window_t *w=0, Int_t winCount=0)
Starts recording events.
void ListGui(const char *filename)
Prints out recorded GUI events.
void Pause()
Pauses replaying.
void Browse(TBrowser *)
Browse the recorder from a ROOT file.
void ListCmd(const char *filename)
Prints out recorded commandline events.
virtual ~TRecorder()
Destructor.
Bool_t Replay(const char *filename, Bool_t showMouseCursor=kTRUE, TRecorder::EReplayModes mode=kRealtime)
Replays events from 'filename'.
TRecorder()
Creates initial INACTIVE state for the recorder.
void PrevCanvases(const char *filename, Option_t *option)
Save previous canvases in a .root file.
void ChangeState(TRecorderState *newstate, Bool_t deletePreviousState=kTRUE)
Changes state from the current to the passed one (newstate) Deletes the old state if delPreviousState...
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Basic time type with millisecond precision.
Handles synchronous and a-synchronous timer events.
virtual void TurnOff()
Remove timer from system timer list.
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
virtual void TurnOn()
Add the timer to the system timer list.
void Reset()
Reset the timer.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
virtual Long64_t GetEntries() const
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual Bool_t HandleTimerEvent(Event_t *, TTimer *)