194 if ((opt ==
"NEW") || (opt ==
"RECREATE"))
195 Start(filename, option);
240 return fRecorderState->Replay(
this, filename, showMouseCursor, mode);
289 if (delPreviousState)
356 fTimer->Disconnect(
fTimer,
"Timeout()",
this,
"ReplayRealtime()");
361 "RegisterWindow(Window_t)");
414 Error(
"TRecorderReplaying::Initialize",
415 "The ROOT file is not valid event logfile.");
426 Error(
"TRecorderReplaying::Initialize",
427 "The ROOT file is not valid event logfile");
433 Info(
"TRecorderReplaying::Initialize",
434 "Log file empty. No event to replay.");
443 gClient->Connect(
"RegisteredWindow(Window_t)",
"TRecorderReplaying",
444 this,
"RegisterWindow(Window_t)");
446 Info(
"TRecorderReplaying::Initialize",
"Replaying of file %s started",
450 if (
f && !
f->IsZombie()) {
451 TIter nextkey(
f->GetListOfKeys());
454 while ((key = (
TKey*)nextkey())) {
464 while ((canvas = (
TCanvas*)nextc())) {
474 fTimer->Connect(
"Timeout()",
"TRecorderReplaying",
this,
"ReplayRealtime()");
510 Error(
"TRecorderReplaying::RegisterWindow",
511 "More windows registered than expected");
517 std::ios::fmtflags
f = std::cout.flags();
518 std::cout <<
" Window registered: new ID: " << std::hex << w <<
519 " previous ID: " <<
fWin << std::dec << std::endl;
520 std::cout.flags(
f );
539 std::ios::fmtflags
f = std::cout.flags();
540 std::cout <<
" Window " << std::hex <<
fGuiEvent->fWindow <<
541 " registered." << std::dec << std::endl;
542 std::cout.flags(
f );
580 for (
Int_t i = 0; i < 5; ++i) {
601 std::ios_base::fmtflags org_flags = std::cout.flags();
603 " No mapping found for ID " << std::hex <<
fGuiEvent->fWindow << std::endl;
606 std::cout.flags(org_flags);
782 Error(
"TRecorderReplaying::CanOverlap()",
"fGuiEvent = 0");
792 std::cout <<
"Event overlapping " <<
830 gROOT->SetEditorMode();
859 gVirtualX->LookupString(
e, str,
sizeof(str), keysym);
861 if ((keysym & ~0x20) ==
kKey_S) {
882 Info(
"TRecorderReplaying::ReplayRealtime",
"Replaying finished");
904 Info(
"TRecorderReplaying::Pause",
"Replaying paused.");
912 Info(
"TRecorderReplaying::ReplayStop",
"Replaying cancelled");
944 r->fFilename =
gSystem->BaseName(filename);
965 if (replay->
Initialize(
r, showMouseCursor, mode)) {
966 r->ChangeState(replay);
967 r->fFilename =
gSystem->BaseName(filename);
996 Error(
"TRecorderInactive::List",
997 "The ROOT file is not valid event logfile.");
1005 Int_t entries =
t1->GetEntries();
1006 for (
Int_t i = 0; i < entries; ++i) {
1008 std::cout <<
"[" << i <<
"] " <<
"fTime=" <<
1010 fCmdEvent->
GetText() << std::endl;
1012 std::cout << std::endl;
1039 Error(
"TRecorderInactive::ListGui",
1040 "The ROOT file is not valid event logfile.");
1048 Int_t entries =
t1->GetEntries();
1050 for (
Int_t i = 0; i < entries ; ++i) {
1065 std::ios::fmtflags
f = std::cout.flags();
1066 std::cout <<
"[" <<
n <<
"] " << std::dec << std::setw(10)
1068 <<
" fW:" << std::hex <<
e->fWindow
1069 <<
" t:" << std::dec <<
e->fTime
1079 <<
" se:" <<
e->fSendEvent
1080 <<
" h:" <<
e->fHandle
1084 for (
Int_t i=0; i<5; ++i)
1089 std::cout <<
" | fM:" << std::hex <<
e->fMasked;
1091 std::cout << std::endl;
1092 std::cout.flags(
f );
1102 if (
f && !
f->IsZombie()) {
1127 Info(
"TRecorderPaused::Resume",
"Replaying resumed");
1140 Info(
"TRecorderReplaying::ReplayStop",
"Replaying cancelled");
1180 fMouseTimer->Connect(
"Timeout()",
"TRecorderRecording",
this,
1181 "RecordMousePosition()");
1225 gApplication->Connect(
"LineProcessed(const char*)",
"TRecorderRecording",
1226 this,
"RecordCmdEvent(const char*)");
1230 gClient->Connect(
"RegisteredWindow(Window_t)",
"TRecorderRecording",
this,
1231 "RegisterWindow(Window_t)");
1236 gClient->Connect(
"ProcessedEvent(Event_t*, Window_t)",
"TRecorderRecording",
1237 this,
"RecordGuiEvent(Event_t*, Window_t)");
1242 "TRecorderRecording",
this,
"RecordGuiCNEvent(Event_t*)");
1247 this,
"RecordPave(const TObject*)");
1251 "TRecorderRecording",
this,
"RecordText(const TObject*)");
1256 "FilterEventPave()");
1265 "TRecorderRecording",
this,
"RecordGuiBldEvent(Event_t*)");
1274 Int_t numCanvases =
gROOT->GetListOfCanvases()->LastIndex();
1276 if (numCanvases >= 0){
1281 while ((twin = (
TGWindow*) nextwindow())) {
1285 std::cout <<
"WindowID "<< twin2 <<
" filtered" << std::endl;
1288 else if (twin !=
gClient->GetRoot()) {
1301 Info(
"TRecorderRecording::StartRecording",
"Recording started. Log file: %s",
1313 "RecordGuiBldEvent(Event_t*)");
1315 "RecordGuiCNEvent(Event_t*)");
1317 "RecordPave(const TObject*)");
1319 "RecordText(const TObject*)");
1322 gClient->Disconnect(
gClient,
"ProcessedEvent(Event_t*, Window_t)",
this,
1323 "RecordGuiEvent(Event_t*, Window_t)");
1325 "RegisterWindow(Window_t)");
1327 "RecordCmdEvent(const char*)");
1341 Info(
"TRecorderRecording::Stop",
"Recording finished.");
1427 e->fFormat =
e->fType;
1506 cad =
"TPaveLabel *p = new TPaveLabel(";
1507 cad += pavel->
GetX1();
1509 cad += pavel->
GetY1();
1511 cad += pavel->
GetX2();
1513 cad += pavel->
GetY2();
1514 cad +=
",\"\"); p->Draw(); gPad->Modified(); gPad->Update();";
1516 interval /= (len + 2);
1518 for (i=0; i < len; ++i) {
1519 cad =
"p->SetLabel(\"";
1520 cad += (aux += label[i]);
1523 cad +=
" p->SetTextFont(83); p->SetTextSizePixels(14); ";
1525 cad +=
" gPad->Modified(); gPad->Update();";
1526 extratime += interval;
1529 cad =
"p->SetTextFont(";
1531 cad +=
"); p->SetTextSize(";
1533 cad +=
"); gPad->Modified(); gPad->Update();";
1534 extratime += interval;
1550 cad =
"TLatex *l = new TLatex(";
1551 cad += texto->
GetX();
1553 cad += texto->
GetY();
1554 cad +=
",\"\"); l->Draw(); gPad->Modified(); gPad->Update();";
1556 interval /= (len + 2);
1558 for (i=0; i < len; ++i) {
1559 cad =
"l->SetTitle(\"";
1560 cad += (aux += label[i]);
1563 cad +=
" l->SetTextFont(83); l->SetTextSizePixels(14); ";
1565 cad +=
" gPad->Modified(); gPad->Update();";
1566 extratime += interval;
1569 cad =
"l->SetTextFont(";
1571 cad +=
"); l->SetTextSize(";
1573 cad +=
"); gPad->Modified(); gPad->Update();";
1574 cad +=
" TVirtualPad *spad = gPad->GetCanvas()->GetSelectedPad();";
1575 cad +=
" gPad->GetCanvas()->Selected(spad, l, kButton1Down);";
1576 extratime += interval;
1635 for(
Int_t i=0; i<5; ++i)
1644 gVirtualX->LookupString(
e, tmp,
sizeof(tmp), keysym);
1677 if ((
e->fX == 0 &&
e->fY == 0)) {
1764 fStatus->SetTextColor(0x7cffff);
1789 fStartStop->Connect(
"Clicked()",
"TGRecorder",
this,
"StartStop()");
1798 fReplay->Connect(
"Clicked()",
"TGRecorder",
this,
"Replay()");
1811 fTimer->Connect(
"Timeout()",
"TGRecorder",
this,
"Update()");
1852 running = gmtime( &elapsed_time );
1864 fStatus->SetText(
"Replaying");
1866 fStatus->SetText(
"Recording");
1867 stime.
Form(
"%02d:%02d:%02d", running->tm_hour,
1868 running->tm_min, running->tm_sec);
1873 fStatus->SetText(
"Waiting...");
1910 "All files",
"*",
"Text files",
"*.txt",
"ROOT files",
"*.root", 0, 0
1928 if (!
gROOT->GetListOfCanvases()->IsEmpty()) {
2032 Int_t px, py, dx, dy;
2059 gVirtualX->GetWindowAttributes(
e->fWindow, attr);
2060 if ((
e->fX - attr.
fX > 0) && (
e->fY - attr.
fY > 0))
2061 w->Move(
e->fX - attr.
fX,
e->fY - attr.
fY);
2066 w->Resize(
e->fWidth,
e->fHeight);
2071 w->MoveResize(
e->fX,
e->fY,
e->fWidth,
e->fHeight);
2075 Error(
"TRecGuiEvent::ReplayEvent",
2076 "kConfigureNotify: Unknown value: fUser[4] = %ld ",
2085 Error(
"TRecGuiEvent::ReplayEvent",
2086 "kConfigureNotify: Window does not exist anymore ");
2095 e->fX,
e->fY, px, py, wtarget);
2170 for(
Int_t i=0; i<5; ++i)
2171 e->fUser[i] = ge->
fUser[i];
2180 e->fUser[2] =
e->fCode;
const Mask_t kWAOverrideRedirect
const Mask_t kWASaveUnder
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kKeyControlMask
ULong_t Pixel_t
Pixel value.
Handle_t Window_t
Window handle.
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
long long Long64_t
Portable signed long integer 8 bytes.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
const char Option_t
Option string (const char).
externTApplication * gApplication
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
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
externTVirtualDragManager * gDragManager
externAtom_t gROOT_MESSAGE
externAtom_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)
Set canvas window size.
UInt_t GetWindowHeight() const
UInt_t GetWindowWidth() const
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
void Layout() override
Layout the elements of the composite frame.
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
~TGCursorWindow() override
Destructor.
TGCursorWindow()
TGCursorWindow constructor.
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
Bool_t fOverwrite
if true overwrite the file with existing name on save
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
TGFrame(const TGFrame &)=delete
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
void MapWindow() override
map window
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
This class describes layout hints used by the layout classes.
TGMainFrame(const TGMainFrame &)=delete
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Pixmap_t GetPicture() const
Window_t fFilteredIds[fgWidgetsCount]
TGPictureButton * fStartStop
TGRecorder(const TGWindow *p=nullptr, UInt_t w=230, UInt_t h=150)
The GUI for the recorder.
TGCheckButton * fCursorCheckBox
void StartStop()
Handles push of the fStartStop button according to the current recorder state.
TGPictureButton * fReplay
void Update()
Called when fTimer timeouts (every 0.025 second) Updates GUI of recorder.
static const Int_t fgWidgetsCount
~TGRecorder() override
Destructor. Cleanup the GUI.
void SetDefault()
Sets GUI to the default inactive state.
void Replay()
Handles push of fReplay button according to the current recorder state.
A composite frame that layout their children in vertical way.
ROOT GUI Window base class.
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
@ kEditDisableGrab
window grab cannot be edited
@ kEditDisable
disable edit of this window
const TGWindow * GetParent() const
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.
TObject * Next() override
Return next object in the list. Returns 0 when no more objects in list.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
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=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
Class used for storing information about 1 commandline event.
const char * GetText() const
virtual TTime GetTime() const
static Event_t * CreateEvent(TRecGuiEvent *ge)
Converts TRecGuiEvent type to Event_t type.
void ReplayEvent(Bool_t showMouseCursor=kTRUE) override
Replays stored GUI event.
Class used for storing of window IDs mapping.
Represents state of TRecorder just after its creation.
void ListGui(const char *filename) override
Prints out GUI events recorded in given file.
void ListCmd(const char *filename) override
Prints out commandline events recorded in given file.
void Start(TRecorder *r, const char *filename, Option_t *option, Window_t *w=nullptr, Int_t winCount=0) override
Switches from INACTIVE state to RECORDING and starts recording.
TSeqCollection * fCollect
void PrevCanvases(const char *filename, Option_t *option) override
Save previous canvases in a .root file.
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)
Bool_t Replay(TRecorder *r, const char *filename, Bool_t showMouseCursor, TRecorder::EReplayModes mode) override
Switches from INACTIVE state of recorder to REPLAYING Return kTRUE if replaying has started or kFALSE...
void ReplayStop(TRecorder *r) override
Replaying is cancelled.
TRecorderReplaying * fReplayingState
void Resume(TRecorder *r) override
Continues replaying.
TRecorderPaused(TRecorderReplaying *state)
Remember the recorder state that is paused.
friend class TRecorderReplaying
Represents state of TRecorder when recording events.
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() override
Freeing of allocated memory.
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.
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().
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 Stop(TRecorder *r, Bool_t guiCommand) override
Disconnects all slots and stopps recording.
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...
Represents state of TRecorder when replaying previously recorded events.
Bool_t FilterEvent(TRecGuiEvent *e)
friend class TRecorderPaused
friend class TRecorderInactive
void Pause(TRecorder *r) override
Pauses replaying.
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...
void ReplayStop(TRecorder *r) override
Cancels replaying.
~TRecorderReplaying() override
Closes all signal-slot connections Frees all memory allocated in constructor.
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.
Class provides direct recorder/replayer interface for a user.
~TRecorder() override
Destructor.
friend class TRecorderInactive
void Stop(Bool_t guiCommand=kFALSE)
Stopps recording events.
void ReplayStop()
Cancels replaying.
friend class TRecorderState
void Resume()
Resumes replaying.
TRecorderState * fRecorderState
! Current state of recorder
virtual TRecorder::ERecorderState GetState() const
Get current state of recorder.
void ListGui(const char *filename)
Prints out recorded GUI events.
void Start(const char *filename, Option_t *option="RECREATE", Window_t *w=nullptr, Int_t winCount=0)
Starts recording events.
void Pause()
Pauses replaying.
void Browse(TBrowser *) override
Browse the recorder from a ROOT file.
void ListCmd(const char *filename)
Prints out recorded commandline events.
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.
Basic time type with millisecond precision.
Handles synchronous and a-synchronous timer events.
A TTree represents a columnar dataset.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
Bool_t fSendEvent
true if event came from SendEvent
Handle_t fHandle
general resource handle (used for atoms or windows)
Int_t fFormat
Next fields only used by kClientMessageEvent.
UInt_t fHeight
width and height of exposed area
Int_t fCount
if non-zero, at least this many more exposes
Window_t fWindow
window reported event is relative to
UInt_t fState
key or button mask
Int_t fYRoot
coordinates relative to root
Time_t fTime
time event event occurred in ms
UInt_t fCode
key or button code
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Attributes that can be used when creating or changing a window.
Bool_t fOverrideRedirect
boolean value for override-redirect
Mask_t fMask
bit mask specifying which fields are valid
Bool_t fSaveUnder
should bits under be saved (popups)?
Window attributes that can be inquired.
Int_t fY
location of window