204 gVirtualX->ShapeCombineMask(fId, 0, 0, fMask);
205 SetBackgroundPixmap(fPic);
211 gVirtualX->ChangeWindowAttributes(fId, &wattr);
240 if ((opt ==
"NEW") || (opt ==
"RECREATE"))
241 Start(filename, option);
335 if (delPreviousState)
372 fEventReplayed =
kTRUE;
374 fExtraTreeCounter = 0;
375 fFilterStatusBar =
kFALSE;
381 fShowMouseCursor =
kTRUE;
382 fWaitingForWindow =
kFALSE;
390 fWindowList =
new TList();
408 "RegisterWindow(Window_t)");
421 gCursorWin->DeleteWindow();
461 Error(
"TRecorderReplaying::Initialize",
462 "The ROOT file is not valid event logfile.");
473 Error(
"TRecorderReplaying::Initialize",
474 "The ROOT file is not valid event logfile");
480 Info(
"TRecorderReplaying::Initialize",
481 "Log file empty. No event to replay.");
490 gClient->Connect(
"RegisteredWindow(Window_t)",
"TRecorderReplaying",
491 this,
"RegisterWindow(Window_t)");
493 Info(
"TRecorderReplaying::Initialize",
"Replaying of file %s started",
497 if (f && !f->IsZombie()) {
498 TIter nextkey(f->GetListOfKeys());
501 while ((key = (
TKey*)nextkey())) {
503 obj = key->ReadObj();
511 while ((canvas = (
TCanvas*)nextc())) {
521 fTimer->
Connect(
"Timeout()",
"TRecorderReplaying",
this,
"ReplayRealtime()");
557 Error(
"TRecorderReplaying::RegisterWindow",
558 "More windows registered than expected");
564 std::ios::fmtflags
f = std::cout.flags();
565 std::cout <<
" Window registered: new ID: " <<
std::hex << w <<
566 " previous ID: " <<
fWin << std::dec << std::endl;
567 std::cout.flags( f );
586 std::ios::fmtflags
f = std::cout.flags();
588 " registered." << std::dec << std::endl;
589 std::cout.flags( f );
627 for (
Int_t i = 0; i < 5; ++i) {
648 std::ios_base::fmtflags org_flags = std::cout.flags();
653 std::cout.flags(org_flags);
829 Error(
"TRecorderReplaying::CanOverlap()",
"fGuiEvent = 0");
839 std::cout <<
"Event overlapping " <<
877 gROOT->SetEditorMode();
906 gVirtualX->LookupString(e, str,
sizeof(str), keysym);
908 if ((keysym & ~0x20) ==
kKey_S) {
929 Info(
"TRecorderReplaying::ReplayRealtime",
"Replaying finished");
951 Info(
"TRecorderReplaying::Pause",
"Replaying paused.");
959 Info(
"TRecorderReplaying::ReplayStop",
"Replaying cancelled");
1013 if (replay->
Initialize(r, showMouseCursor, mode)) {
1044 Error(
"TRecorderInactive::List",
1045 "The ROOT file is not valid event logfile.");
1054 for (
Int_t i = 0; i < entries; ++i) {
1056 std::cout <<
"[" << i <<
"] " <<
"fTime=" <<
1058 fCmdEvent->
GetText() << std::endl;
1060 std::cout << std::endl;
1087 Error(
"TRecorderInactive::ListGui",
1088 "The ROOT file is not valid event logfile.");
1098 for (
Int_t i = 0; i < entries ; ++i) {
1113 std::ios::fmtflags
f = std::cout.flags();
1114 std::cout <<
"[" << n <<
"] " << std::dec << std::setw(10)
1117 <<
" t:" << std::dec << e->
fTime
1132 for (
Int_t i=0; i<5; ++i)
1139 std::cout << std::endl;
1140 std::cout.flags( f );
1167 fReplayingState = state;
1176 Info(
"TRecorderPaused::Resume",
"Replaying resumed");
1189 Info(
"TRecorderReplaying::ReplayStop",
"Reaplying cancelled");
1212 fFilteredIdsCount = winCount;
1213 fFilteredIds =
new Window_t[fFilteredIdsCount];
1214 for(
Int_t i=0; i < fFilteredIdsCount; ++i)
1215 fFilteredIds[i] = w[i];
1218 fCmdEventPending =
kFALSE;
1221 fFilterEventPave =
kFALSE;
1230 fMouseTimer->Connect(
"Timeout()",
"TRecorderRecording",
this,
1231 "RecordMousePosition()");
1237 fWinTree =
new TTree(kWindowsTree,
"Windows");
1238 fCmdTree =
new TTree(kCmdEventTree,
"Commandline events");
1239 fGuiTree =
new TTree(kGuiEventTree,
"GUI events");
1240 fExtraTree =
new TTree(kExtraEventTree,
"Extra events");
1276 this,
"RecordCmdEvent(const char*)");
1280 gClient->Connect(
"RegisteredWindow(Window_t)",
"TRecorderRecording",
this,
1281 "RegisterWindow(Window_t)");
1286 gClient->Connect(
"ProcessedEvent(Event_t*, Window_t)",
"TRecorderRecording",
1287 this,
"RecordGuiEvent(Event_t*, Window_t)");
1292 "TRecorderRecording",
this,
"RecordGuiCNEvent(Event_t*)");
1297 this,
"RecordPave(const TObject*)");
1301 "TRecorderRecording",
this,
"RecordText(const TObject*)");
1306 "FilterEventPave()");
1315 "TRecorderRecording",
this,
"RecordGuiBldEvent(Event_t*)");
1324 Int_t numCanvases =
gROOT->GetListOfCanvases()->LastIndex();
1326 if (numCanvases >= 0){
1332 while ((twin = (
TGWindow*) nextwindow())) {
1336 std::cout <<
"WindowID "<< twin2 <<
" filtered" << std::endl;
1339 else if (twin !=
gClient->GetRoot()) {
1353 Info(
"TRecorderRecording::StartRecording",
"Recording started. Log file: %s",
1365 "RecordGuiBldEvent(Event_t*)");
1367 "RecordGuiCNEvent(Event_t*)");
1369 "RecordPave(const TObject*)");
1371 "RecordText(const TObject*)");
1374 gClient->Disconnect(
gClient,
"ProcessedEvent(Event_t*, Window_t)",
this,
1375 "RecordGuiEvent(Event_t*, Window_t)");
1377 "RegisterWindow(Window_t)");
1379 "RecordCmdEvent(const char*)");
1393 Info(
"TRecorderRecording::Stop",
"Recording finished.");
1558 cad =
"TPaveLabel *p = new TPaveLabel(";
1559 cad += pavel->
GetX1();
1561 cad += pavel->
GetY1();
1563 cad += pavel->
GetX2();
1565 cad += pavel->
GetY2();
1566 cad +=
",\"\"); p->Draw(); gPad->Modified(); gPad->Update();";
1568 interval /= (len + 2);
1570 for (i=0; i < len; ++i) {
1571 cad =
"p->SetLabel(\"";
1572 cad += (aux += label[i]);
1575 cad +=
" p->SetTextFont(83); p->SetTextSizePixels(14); ";
1577 cad +=
" gPad->Modified(); gPad->Update();";
1578 extratime += interval;
1581 cad =
"p->SetTextFont(";
1583 cad +=
"); p->SetTextSize(";
1585 cad +=
"); gPad->Modified(); gPad->Update();";
1586 extratime += interval;
1602 cad =
"TLatex *l = new TLatex(";
1603 cad += texto->
GetX();
1605 cad += texto->
GetY();
1606 cad +=
",\"\"); l->Draw(); gPad->Modified(); gPad->Update();";
1608 interval /= (len + 2);
1610 for (i=0; i < len; ++i) {
1611 cad =
"l->SetTitle(\"";
1612 cad += (aux += label[i]);
1615 cad +=
" l->SetTextFont(83); l->SetTextSizePixels(14); ";
1617 cad +=
" gPad->Modified(); gPad->Update();";
1618 extratime += interval;
1621 cad =
"l->SetTextFont(";
1623 cad +=
"); l->SetTextSize(";
1625 cad +=
"); gPad->Modified(); gPad->Update();";
1626 cad +=
" TVirtualPad *spad = gPad->GetCanvas()->GetSelectedPad();";
1627 cad +=
" gPad->GetCanvas()->Selected(spad, l, kButton1Down);";
1628 extratime += interval;
1687 for(
Int_t i=0; i<5; ++i)
1696 gVirtualX->LookupString(e, tmp,
sizeof(tmp), keysym);
1729 if ((e->
fX == 0 && e->
fY == 0)) {
1783 fFilteredIds[0] = GetId();
1788 fFilteredIds[1] = hframe->
GetId();
1794 fFilteredIds[2] = vframe->
GetId();
1801 fFilteredIds[3] = fStatusLabel->
GetId();
1808 fFilteredIds[4] = fTimeLabel->
GetId();
1814 fFilteredIds[5] = vframe->
GetId();
1816 fStatus =
new TGLabel(vframe,
"Inactive");
1817 fStatus->SetTextColor(0x7cffff);
1818 fStatus->SetBackgroundColor((
Pixel_t)0x000000);
1821 fFilteredIds[6] = fStatus->GetId();
1823 fTimeDisplay =
new TGLabel(vframe,
"00:00:00");
1824 fTimeDisplay->SetTextColor(0x7cffff);
1825 fTimeDisplay->SetTextFont(
"Helvetica -34",
kFALSE);
1826 fTimeDisplay->SetBackgroundColor((
Pixel_t)0x000000);
1829 fFilteredIds[7] = fTimeDisplay->GetId();
1837 fFilteredIds[8] = hframe->
GetId();
1842 fStartStop->Connect(
"Clicked()",
"TGRecorder",
this,
"StartStop()");
1845 fStartStop->Resize(40,40);
1846 fFilteredIds[9] = fStartStop->GetId();
1851 fReplay->Connect(
"Clicked()",
"TGRecorder",
this,
"Replay()");
1854 fReplay->Resize(40,40);
1855 fFilteredIds[10] = fReplay->GetId();
1858 fCursorCheckBox =
new TGCheckButton(
this,
"Show mouse cursor");
1860 fFilteredIds[11] = fCursorCheckBox->GetId();
1864 fTimer->Connect(
"Timeout()",
"TGRecorder",
this,
"Update()");
1868 SetEditDisabled(kEditDisable | kEditDisableGrab);
1869 SetWindowName(
"ROOT Event Recorder");
1905 running = gmtime( &elapsed_time );
1920 stime.
Form(
"%02d:%02d:%02d", running->tm_hour,
1921 running->tm_min, running->tm_sec);
1963 "All files",
"*",
"Text files",
"*.txt",
"ROOT files",
"*.root", 0, 0
1981 if (!
gROOT->GetListOfCanvases()->IsEmpty()) {
2087 Int_t px, py, dx, dy;
2089 Event_t *e = CreateEvent(
this);
2115 if ((e->
fX - attr.
fX > 0) && (e->
fY - attr.
fY > 0))
2130 Error(
"TRecGuiEvent::ReplayEvent",
2131 "kConfigureNotify: Unknown value: fUser[4] = %ld ",
2140 Error(
"TRecGuiEvent::ReplayEvent",
2141 "kConfigureNotify: Window does not exist anymore ");
2150 e->
fX, e->
fY, px, py, wtarget);
2151 dx = px - gCursorWin->GetX();
2152 dy = py - gCursorWin->GetY();
2159 if (!gCursorWin->IsMapped()) {
2160 gCursorWin->MapRaised();
2165 gCursorWin->RaiseWindow();
2167 gCursorWin->Move(e->
fXRoot + gDecorWidth, e->
fYRoot + gDecorHeight);
2187 gClient->HandleMaskEvent(e, fMasked);
2225 for(
Int_t i=0; i<5; ++i)
void RegisterWindow(Window_t w)
This method is called when RegisteredWindow(Window_t) is emitted from TGClient.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual const char * GetTitle() const
Returns title of object.
void RecordCmdEvent(const char *line)
Records commandline event (text and time) ans saves the previous commandline event This 1 event delay...
TGPictureButton * fReplay
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
TRecExtraEvent * fExtraEvent
const char * kRecEventNames[]
Bool_t Replay(const char *filename, Bool_t showMouseCursor=kTRUE, TRecorder::EReplayModes mode=kRealtime)
Replays events from 'filename'.
friend class TRecorderInactive
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
void CopyEvent(Event_t *e, Window_t wid)
Copies all items of given event to fGuiEvent.
void RecordText(const TObject *obj)
Records TLatex object created in TCreatePrimitives::Text()
void FilterEventPave()
Change the state of the flag to kTRUE when you are recording a pavelabel.
void ListGui(const char *filename)
Prints out recorded GUI events.
virtual Font_t GetTextFont() const
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
static long DisplayValid(Long_t n)
const TGWindow * GetParent() const
void Reset()
Reset the timer.
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
virtual Int_t Fill()
Fill all branches.
void RecordExtraEvent(TString line, TTime extTime)
Records TLatex or TPaveLabel object created in TCreatePrimitives, ExtTime is needed for the correct r...
virtual void ListCmd(const char *)
const char * kCmdEventTree
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
TGCheckButton * fCursorCheckBox
virtual Float_t GetTextSize() const
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
static const char * filename()
virtual void Pause(TRecorder *)
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
R__EXTERN Atom_t gWM_DELETE_WINDOW
virtual TTime GetTime() const
TSeqCollection * fCollect
virtual Bool_t Replay(TRecorder *, const char *, Bool_t, TRecorder::EReplayModes)
virtual void SetTime(TTime t)
R__EXTERN TApplication * gApplication
Bool_t FilterEvent(TRecGuiEvent *e)
Basic time type with millisecond precision.
TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
UInt_t GetWindowHeight() const
void Start(const char *filename, Option_t *option="RECREATE", Window_t *w=0, Int_t winCount=0)
Starts recording events.
void RecordPave(const TObject *obj)
Records TPaveLabel object created in TCreatePrimitives::Pave()
virtual void ReplayStop(TRecorder *)
R__EXTERN TVirtualDragManager * gDragManager
Int_t UnLock()
Unlock the mutex.
TGCursorWindow()
TGCursorWindow constructor.
friend class TRecorderPaused
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
virtual void ReplayStop(TRecorder *r)
Replaying is cancelled.
TRecorderReplaying * fReplayingState
const char * Data() const
virtual void Start(TRecorder *, const char *, Option_t *, Window_t *, Int_t)
void Update()
Called when fTimer timeouts (every 0.025 second) Updates GUI of recorder.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
friend class TRecorderInactive
virtual void SetText(TGString *newText)
Set new text in label.
TRecorder()
Creates initial INACTIVE state for the recorder.
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
To draw Mathematical Formula.
virtual void Stop(TRecorder *, Bool_t)
void RecordGuiCNEvent(Event_t *e)
Records GUI Event_t *e of type kConfigureNotify.
if(pyself &&pyself!=Py_None)
void Info(const char *location, const char *msgfmt,...)
void RecordMousePosition()
Try to record all mouse moves...
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
virtual void ListGui(const char *filename)
Prints out GUI events recorded in given file.
void Replay()
Handles push of fReplay button according to the current recorder state.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Bool_t Initialize(TRecorder *r, Bool_t showMouseCursor, TRecorder::EReplayModes mode)
Initialization of data structures for replaying.
const char * AsString() const
void ListCmd(const char *filename)
Prints out recorded commandline events.
void Error(const char *location, const char *msgfmt,...)
TRecExtraEvent * fExtraEvent
virtual ~TGRecorder()
Destructor. Cleanup the GUI.
A Pave (see TPave) with a text centered in the Pave.
void SetText(const char *text)
Using a TBrowser one can browse all ROOT objects.
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...
virtual void Resize(UInt_t w, UInt_t h)
Resize the window.
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...
const char * GetText() const
virtual void Stop(TRecorder *r, Bool_t guiCommand)
Disconnects all slots and stopps recording.
R__EXTERN TSystem * gSystem
const Mask_t kWASaveUnder
void Resume()
Resumes replaying.
void ChangeState(TRecorderState *newstate, Bool_t deletePreviousState=kTRUE)
Changes state from the current to the passed one (newstate) Deletes the old state if delPreviousState...
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
Write memory objects to this file.
static const char * gFiletypes[]
void RegisterWindow(Window_t w)
Creates mapping for the newly registered window w and adds this mapping to fWindowList.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
void SetTypeOfConfigureNotify(Event_t *e)
Sets type of kConfigureNotify event to one of EConfigureNotify.
virtual void Continue()
Continues previously paused replaying.
virtual void TurnOff()
Remove timer from system timer list.
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...
void ReplayRealtime()
Replays the next event.
Handles synchronous and a-synchronous timer events.
virtual const char * GetName() const
Returns name of object.
ClassImp(TRecorderReplaying) TRecorderReplaying
Allocates all necessary data structures used for replaying What is allocated here is deleted in destr...
static Int_t gDecorHeight
const char * kGuiEventTree
UInt_t GetWindowWidth() const
virtual ERecEventType GetType() const =0
Bool_t PrepareNextEvent()
Finds the next event in log file to replay and sets it to fNextEvent.
static const Int_t fgWidgetsCount
virtual void Move(Int_t x, Int_t y)
Move the window.
const char * kExtraEventTree
void PrevCanvases(const char *filename, Option_t *option)
Save previous canvases in a .root file.
void RecordGuiEvent(Event_t *e, Window_t wid)
Records GUI Event_t *e different from kConfigureNotify (they are recorded in TRecorderRecording::Reco...
virtual void ReplayEvent(Bool_t showMouseCursor=kTRUE)=0
TRecorderState * fRecorderState
Pixmap_t GetPicture() const
virtual void ListCmd(const char *filename)
Prints out commandline events recorded in given file.
void StartStop()
Handles push of the fStartStop button according to the current recorder state.
unsigned long long ULong64_t
const Mask_t kWAOverrideRedirect
Int_t Lock()
Lock the mutex.
void RecordGuiBldEvent(Event_t *e)
Special case for the gui builder, having a timer handling some of the events.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
void ReplayStop()
Cancells replaying.
void SetWindowSize(UInt_t ww, UInt_t wh)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
void SetDefault()
Sets GUI to the default inactive state.
const char * GetLabel() const
void StartEditing()
Memorize the starting time of editinga TLatex or a TPaveLabel.
Mother of all ROOT objects.
Window_t fFilteredIds[fgWidgetsCount]
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize the window.
virtual void Draw(Option_t *option="")
Draw a canvas.
Bool_t StartRecording()
Connects appropriate signals and slots in order to gain all registered windows and processed events i...
typedef void((*Func_t)())
virtual ~TGCursorWindow()
Destructor.
virtual void PrevCanvases(const char *, Option_t *)
void Stop(Bool_t guiCommand=kFALSE)
Stopps recording events.
RooCmdArg Layout(Double_t xmin, Double_t xmax=0.99, Double_t ymin=0.95)
virtual void ReplayStop(TRecorder *r)
Cancels replaying.
virtual void Resume(TRecorder *)
virtual void Add(TObject *obj)
Bool_t IsFiltered(Window_t id)
Returns kTRUE if passed id belongs to window IDs of recorder GUI itself.
virtual void Resume(TRecorder *r)
Continues replaying.
static TGCursorWindow * gCursorWin
virtual Bool_t HandleTimerEvent(Event_t *, TTimer *)
static Event_t * CreateEvent(TRecGuiEvent *ge)
Converts TRecGuiEvent type to Event_t type.
virtual ~TRecorderReplaying()
Closes all signal-slot connections Frees all memory allocated in contructor.
void Pause()
Pauses replaying.
virtual ~TRecorder()
Destructor.
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.
virtual void ListGui(const char *)
virtual TRecorder::ERecorderState GetState() const =0
virtual void Pause(TRecorder *r)
Pauses replaying.
const Mask_t kKeyControlMask
virtual void ReplayEvent(Bool_t showMouseCursor=kTRUE)
virtual ~TRecorderRecording()
Freeing of allocated memory.
virtual TRecorder::ERecorderState GetState() const
Get current state of recorder.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void TurnOn()
Add the timer to the system timer list.
TGPictureButton * fStartStop
void PrevCanvases(const char *filename, Option_t *option)
Save previous canvases in a .root file.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
void Browse(TBrowser *)
Browse the recorder from a ROOT file.
friend class TRecorderInactive
const char * kWindowsTree
R__EXTERN Atom_t gROOT_MESSAGE
Bool_t RemapWindowReferences()
All references to the old windows (IDs) in fNextEvent are replaced by new ones according to the mappi...
virtual void Close(Option_t *option="")
Close a file.
Bool_t CanOverlap()
ButtonPress and ButtonRelease must be sometimes replayed more times Example: pressing of a button ope...