106 :
TPave(
x1,
y1,
x2,
y2,4,
option),
TAttText(22,0,
gStyle->GetTextColor(),
gStyle->GetTextFont(),0)
143 TAttText::operator=(
pt);
163 if (!
gPad->IsEditable())
177 if (!
gPad->IsEditable())
227 if (!
gPad->IsEditable())
return;
264 if (!
gPad->IsEditable())
return;
271 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%zx)->SetSelected((TObject*)0x%zx)",
272 (
size_t)
gPad->GetCanvas(), (
size_t)
text));
273 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%zx)->Selected((TVirtualPad*)0x%zx,(TObject*)0x%zx,1)",
274 (
size_t)
gPad->GetCanvas(), (
size_t)
gPad, (
size_t)
text));
275 text->SetTextAttributes();
286 while (
auto obj = next()) {
290 if (nlines++ == number)
291 return (
TText *) obj;
305 while (
auto obj = next()) {
307 return (
TText *) obj;
317 if (!
fLines)
return nullptr;
319 if (nlines == 0)
return nullptr;
323 ymouse =
gPad->AbsPixeltoY(
gPad->GetEventY());
333 while (
auto line = next()) {
337 y1 = linel->GetY1();
if (
y1 == 0)
y1 = ytext;
else y1 =
fY1 +
y1*dy;
354 if (yl > 0 && yl <1) {
357 valign = linet->GetTextAlign()%10;
359 if (valign == 1)
y = ytext -0.5*yspace;
360 if (valign == 3)
y = ytext +0.5*yspace;
375 while (
auto line = next()) {
386 if (!
gPad->IsEditable())
return;
403 if (!
gPad->IsEditable())
return;
435 if (nlines == 0) nlines = 5;
464 if (
w > longest) longest =
w;
468 if (longest > 0.92*dx)
textsize *= 0.92*dx/longest;
520 if (xl > 0 && xl <1) {
524 if (halign == 1) xtext =
fX1 + margin;
525 if (halign == 2) xtext = 0.5*(
fX1+
fX2);
526 if (halign == 3) xtext =
fX2 - margin;
528 if (yl > 0 && yl <1) ytext =
fY1 + yl*dy;
549 if (xl > 0 && xl <1) {
553 if (halign == 1) xtext =
fX1 + margin;
554 if (halign == 2) xtext = 0.5*(
fX1+
fX2);
555 if (halign == 3) xtext =
fX2 - margin;
557 if (yl > 0 && yl <1) ytext =
fY1 + yl*dy;
620 std::ifstream
file(fname.
Data(),std::ios::in);
622 Error(
"ReadFile",
"illegal file name %s", fname.
Data());
626 const int linesize = 255;
627 char currentline[linesize];
628 char *ss, *sclose, *s =
nullptr;
632 file.getline(currentline,linesize);
633 if (
file.eof())
break;
634 if (kline >= fromline && kline < fromline+nlines) {
636 if (strstr(s,
"+SetText")) {
638 sclose = strstr(ss,
")");
639 if (!sclose)
continue;
642 if (!lastline)
continue;
643 if (strstr(ss,
"Color(")) {
644 sscanf(ss+6,
"%d",&ival);
648 if (strstr(ss,
"Align(")) {
649 sscanf(ss+6,
"%d",&ival);
653 if (strstr(ss,
"Font(")) {
654 sscanf(ss+5,
"%d",&ival);
658 if (strstr(ss,
"Size(")) {
659 sscanf(ss+5,
"%f",&val);
663 if (strstr(ss,
"Angle(")) {
664 sscanf(ss+6,
"%f",&val);
683 if (nlines == 0)
return;
694 while (
auto line = next()) {
698 if (saved || savedl) {
707 out<<line_name<<
" = "<<
name<<
"->AddLine("
708 <<linel->GetX1()<<
","<<linel->GetY1()<<
","<<linel->GetX2()<<
","<<linel->GetY2()<<
");"<<std::endl;
710 linel->SaveLineAttributes(out, line_name.Data(), 1, 1, 1);
716 if (saved || savedb) {
725 out<<box_name<<
" = "<<
name<<
"->AddBox("
726 <<lineb->GetX1()<<
","<<lineb->GetY1()<<
","<<lineb->GetX2()<<
","<<lineb->GetY2()<<
");"<<std::endl;
728 lineb->SaveFillAttributes(out, box_name.Data(), 18, 1001);
729 lineb->SaveLineAttributes(out, box_name.Data(), 1, 1, 1);
735 if (saved || savedt) {
747 if (!linet->GetX() && !linet->GetY())
748 out<<text_name<<
" = "<<
name<<
"->AddText(" <<quote<<s<<quote<<
");"<<std::endl;
750 out<<text_name<<
" = "<<
name<<
"->AddText("
751 <<linet->GetX()<<
","<<linet->GetY()<<
","<<quote<<s<<quote<<
");"<<std::endl;
753 linet->SaveTextAttributes(out, text_name.Data(), 0,
GetTextAngle(), 0, 0, 0);
759 if (saved || savedlt) {
768 TString sl = latex->GetTitle();
771 if (!latex->GetX() && !latex->GetY())
772 out<< latex_name <<
" = "<<
name<<
"->AddText(" <<quote<<sl<<quote<<
");"<<std::endl;
774 out<< latex_name <<
" = "<<
name<<
"->AddText("
775 <<latex->GetX()<<
","<<latex->GetY()<<
","<<quote<<sl<<quote<<
");"<<std::endl;
777 latex->SaveTextAttributes(out, latex_name.Data(), 0,
GetTextAngle(), 0, 0, 0);
797 <<
","<<quote<<
fOption<<quote<<
");"<<std::endl;
800 <<
","<<quote<<
fOption<<quote<<
");"<<std::endl;
802 if (strcmp(
GetName(),
"TPave")) {
803 out<<
" pt->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
806 out<<
" pt->SetLabel("<<quote<<
fLabel<<quote<<
");"<<std::endl;
809 out<<
" pt->SetBorderSize("<<
fBorderSize<<
");"<<std::endl;
815 out<<
" pt->Draw();"<<std::endl;
835 if (opt ==
"size")
line->SetTextSize(
value);
836 if (opt ==
"angle")
line->SetTextAngle(
value);
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 ColorStruct_t color const char filename
Option_t Option_t SetTextSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t SetTextFont
Option_t Option_t textsize
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TStyle * gStyle
virtual Color_t GetFillColor() const
Return the fill area color.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual Float_t GetTextSize() const
Return the text size.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual Short_t GetTextAlign() const
Return the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
virtual Color_t GetTextColor() const
Return the text color.
virtual void Streamer(TBuffer &)
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual Float_t GetTextAngle() const
Return the text angle.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SaveTextAttributes(std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1)
Save text attributes as C++ statement(s) on output stream out.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")
Draw this box with new coordinates.
Double_t fX1
X of 1st point.
TBox()
Box default constructor.
Double_t fY2
Y of 2nd point.
Double_t fX2
X of 2nd point.
Double_t fY1
Y of 1st point.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
To draw Mathematical Formula.
Double_t GetXsize()
Return size of the formula along X in pad coordinates when the text precision is smaller than 3.
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
Use the TLine constructor to create a simple line.
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
TClass * IsA() const override
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
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 const char * GetTitle() const
Returns title of object.
A Pave (see TPave) with a text centered in the Pave.
void Paint(Option_t *option="") override
Paint this pavelabel with its current attributes.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Int_t fLongest
Length of the longest line.
virtual Int_t GetSize() const
return number of text lines (ignoring TLine, etc)
void Streamer(TBuffer &) override
Stream an object of class TPaveText.
TList * fLines
List of labels.
virtual void PaintPrimitives(Int_t mode)
Paint list of primitives in this pavetext.
TClass * IsA() const override
void Print(Option_t *option="") const override
Dump this pavetext with its attributes.
TPaveText()
pavetext default constructor.
virtual TLine * AddLine(Double_t x1=0, Double_t y1=0, Double_t x2=0, Double_t y2=0)
Add a new graphics line to this pavetext.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
virtual void InsertText(const char *label)
Add a new Text line at the mouse position.
virtual void ReadFile(const char *filename, Option_t *option="", Int_t nlines=50, Int_t fromline=0)
Read lines of filename in this pavetext.
virtual void DrawFile(const char *filename, Option_t *option="")
Draw lines in filename in this pavetext.
virtual void EditText()
Edit text at the mouse position.
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
Set attribute option for all lines containing string text.
virtual TObject * GetObject(Double_t &ymouse, Double_t &yobj) const
Get object pointed by the mouse in this pavetext.
virtual void SaveLines(std::ostream &out, const char *name, Bool_t saved)
Save lines of this pavetext as C++ statements on output stream out.
virtual void DeleteText()
Delete text at the mouse position.
void Clear(Option_t *option="") override
Clear all lines in this pavetext.
virtual ~TPaveText()
pavetext default destructor.
TPaveText & operator=(const TPaveText &)
assignment operator
virtual TBox * AddBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Add a new graphics box to this pavetext.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
void Paint(Option_t *option="") override
Paint this pavetext with its current attributes.
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
TString fLabel
Label written at the top of the pavetext.
virtual void InsertLine()
Add a new line at the mouse position.
virtual TText * GetLineWith(const char *text) const
Get Pointer to first containing string text in this pavetext.
Float_t fMargin
Text margin.
void UseCurrentStyle() override
Replace current attributes by current style.
A TBox with a bordersize and a shadow option.
void Print(Option_t *option="") const override
Dump this pave with its attributes.
Int_t GetBorderSize() const
TPave & operator=(const TPave &src)
Assignment operator.
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
const char * GetName() const override
Returns name of object.
void Streamer(TBuffer &) override
Stream an object of class TPave.
Int_t fBorderSize
window box bordersize in pixels
Double_t fX2NDC
X2 point in NDC coordinates.
TString fOption
Pave style.
Double_t fY2NDC
Y2 point in NDC coordinates.
Double_t fX1NDC
X1 point in NDC coordinates.
Option_t * GetOption() const override
Double_t fY1NDC
Y1 point in NDC coordinates.
virtual void PaintPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with new coordinates.
void ToLower()
Change string to lower-case.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual void Streamer(TBuffer &)
Stream a string object.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Base class for several text objects.
virtual void SetY(Double_t y)
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void SetX(Double_t x)
R__ALWAYS_INLINE bool HasBeenDeleted(const TObject *obj)
Check if the TObject's memory has been deleted.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.