106 :
TPave(x1,y1,x2,y2,4,option),
TAttText(22,0,
gStyle->GetTextColor(),
gStyle->GetTextFont(),0)
143 TAttText::operator=(
pt);
163 if (!
gPad->IsEditable())
165 TBox *newbox =
new TBox(x1,y1,x2,y2);
177 if (!
gPad->IsEditable())
179 TLine *newline =
new TLine(x1,y1,x2,y2);
191 TLatex *newtext =
new TLatex(x1,y1,
text);
227 if (!
gPad->IsEditable())
return;
243 if (option && strlen(option)) opt = option;
264 if (!
gPad->IsEditable())
return;
269 TText *
text = (TText*)obj;
272 (
size_t)
gPad->GetCanvas(), (
size_t)
text));
273 gROOT->ProcessLine(
TString::Format(
"((TCanvas*)0x%zx)->Selected((TVirtualPad*)0x%zx,(TObject*)0x%zx,1)",
274 (
size_t)
gPad->GetCanvas(), (
size_t)
gPad, (
size_t)
text));
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()) {
336 auto linel = (TLine *)
line;
337 y1 = linel->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 =
fY1 + y1*dy;
345 if (y1 == 0) y1 = ytext;
else y1 =
fY1 + y1*dy;
351 auto linet = (TText *)
line;
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;
390 TLine *newline =
AddLine(0,yline,0,yline);
393 if (yobj < ymouse)
fLines->AddBefore(obj,newline);
394 else fLines->AddAfter(obj,newline);
403 if (!
gPad->IsEditable())
return;
409 if (yobj < ymouse)
fLines->AddBefore(obj,newtext);
410 else fLines->AddAfter(obj,newtext);
435 if (nlines == 0) nlines = 5;
452 textsize = 0.85*yspace/(y2 - y1);
455 latex = (TLatex*)
line;
464 if (w > longest) longest = w;
468 if (longest > 0.92*dx) textsize *= 0.92*dx/longest;
469 if (mode ==
kDiamond) textsize *= 0.66;
484 linel = (TLine*)
line;
485 x1 = linel->
GetX1();
if (x1 == 0) x1 =
fX1;
else x1 =
fX1 + x1*dx;
486 x2 = linel->
GetX2();
if (x2 == 0) x2 =
fX2;
else x2 =
fX1 + x2*dx;
487 y1 = linel->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 =
fY1 + y1*dy;
488 y2 = linel->
GetY2();
if (y2 == 0) y2 = ytext;
else y2 =
fY1 + y2*dy;
496 if (x1) x1 =
fX1 + x1*dx;
497 else x1 =
fX1 +
gPad->PixeltoX(1) -
gPad->PixeltoX(0);
499 if (x2) x2 =
fX1 + x2*dx;
501 y1 = lineb->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 =
fY1 + y1*dy;
502 y2 = lineb->
GetY2();
if (y2 == 0) y2 = ytext;
else y2 =
fY1 + y2*dy;
508 linet = (TText*)
line;
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;
537 latex = (TLatex*)
line;
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;
573 if (
fLabel.Length() > 0) {
608 TString opt = option;
615 TString fname = filename;
621 std::ifstream file(fname.
Data(),std::ios::in);
623 Error(
"ReadFile",
"illegal file name %s", fname.
Data());
627 const int linesize = 255;
628 char currentline[linesize];
629 char *ss, *sclose, *s =
nullptr;
633 file.getline(currentline,linesize);
634 if (file.eof())
break;
635 if (kline >= fromline && kline < fromline+nlines) {
637 if (strstr(s,
"+SetText")) {
639 sclose = strstr(ss,
")");
640 if (!sclose)
continue;
642 TText *lastline = (TText*)
fLines->Last();
643 if (!lastline)
continue;
644 if (strstr(ss,
"Color(")) {
645 sscanf(ss+6,
"%d",&ival);
649 if (strstr(ss,
"Align(")) {
650 sscanf(ss+6,
"%d",&ival);
654 if (strstr(ss,
"Font(")) {
655 sscanf(ss+5,
"%d",&ival);
659 if (strstr(ss,
"Size(")) {
660 sscanf(ss+5,
"%f",&val);
664 if (strstr(ss,
"Angle(")) {
665 sscanf(ss+6,
"%f",&val);
684 if (nlines == 0)
return;
689 static int linecnt = 0;
694 while (
auto line = next()) {
697 auto linel =
static_cast<TLine *
>(
line);
699 out <<
" TLine *" << line_name <<
" = " <<
name <<
"->AddLine(" << linel->
GetX1() <<
"," << linel->
GetY1()
700 <<
"," << linel->
GetX2() <<
"," << linel->
GetY2() <<
");" << std::endl;
704 auto lineb =
static_cast<TBox *
>(
line);
706 out <<
" TBox *" << box_name <<
" = " <<
name <<
"->AddBox(" << lineb->
GetX1() <<
"," << lineb->
GetY1()
707 <<
"," << lineb->
GetX2() <<
"," << lineb->
GetY2() <<
");" << std::endl;
712 auto linet =
static_cast<TText *
>(
line);
718 out <<
" TText *" << text_name <<
" = ";
720 if (!linet->
GetX() && !linet->
GetY())
721 out <<
name <<
"->AddText(\"" << s <<
"\");" << std::endl;
723 out <<
name <<
"->AddText(" << linet->
GetX() <<
", " << linet->
GetY() <<
", \"" << s <<
"\");" << std::endl;
737 if (strcmp(
GetName(),
"TPave"))
738 out <<
" pt->SetName(\"" <<
GetName() <<
"\");\n";
740 out <<
" pt->SetLabel(\"" << TString(
fLabel).ReplaceSpecialCppChars() <<
"\");\n";
742 out <<
" pt->SetBorderSize(" <<
fBorderSize <<
");\n";
758 TString opt = option;
761 while (
auto obj = next()) {
762 auto line =
dynamic_cast<TText *
> (obj);
764 if (opt ==
"align")
line->SetTextAlign(
Int_t(value));
765 if (opt ==
"color")
line->SetTextColor(
Int_t(value));
766 if (opt ==
"font")
line->SetTextFont(
Int_t(value));
767 if (opt ==
"size")
line->SetTextSize(value);
768 if (opt ==
"angle")
line->SetTextAngle(value);
788 if (R__v > 1)
fLabel.Streamer(R__b);
805 if (
gStyle->IsReading()) {
int Int_t
Signed integer 4 bytes (int).
float Size_t
Attribute size (float).
short Version_t
Class version identifier (short).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Short_t
Signed Short integer 2 bytes (short).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
short Style_t
Style number (short).
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
virtual Color_t GetFillColor() const
Return the fill area color.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
virtual Float_t GetTextSize() const
Return the text size.
virtual void SetTextAttributes()
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 SetTextSize(Float_t tsize=1)
Set the text size.
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)
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
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
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
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
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.
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
TObject()
TObject constructor.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
virtual Int_t GetSize() const
virtual void DrawFile(const char *filename, Option_t *option="")
virtual void InsertText(const char *label)
Int_t fLongest
Length of the longest line.
virtual TText * GetLine(Int_t number) const
void Streamer(TBuffer &) override
Stream an object of class TPave.
TList * fLines
List of labels.
TClass * IsA() const override
virtual void DeleteText()
void Print(Option_t *option="") const override
Dump this pave with its attributes.
virtual void InsertLine()
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
virtual void ReadFile(const char *filename, Option_t *option="", Int_t nlines=50, Int_t fromline=0)
virtual TLine * AddLine(Double_t x1=0, Double_t y1=0, Double_t x2=0, Double_t y2=0)
virtual void SaveLines(std::ostream &out, const char *name, Bool_t)
void Clear(Option_t *option="") override
TPaveText & operator=(const TPaveText &)
virtual TBox * AddBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void Draw(Option_t *option="") override
Draw this pave with its current attributes.
virtual void PaintPrimitives(Int_t mode)
virtual TObject * GetObject(Double_t &ymouse, Double_t &yobj) const
void Paint(Option_t *option="") override
Paint this pave with its current attributes.
TString fLabel
Label written at the top of the pavetext.
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
virtual TText * GetLineWith(const char *text) const
Float_t fMargin
Text margin.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
void UseCurrentStyle() override
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
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.
TString GetSavePaveArgs(const char *extra_arg=nullptr, Bool_t save_option=kTRUE)
Returns arguments which should be used when saving primitive constructor Check if coordinates are ini...
void Streamer(TBuffer &) override
Stream an object of class TPave.
Int_t fBorderSize
window box bordersize in pixels
Option_t * GetOption() const override
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
TString & ReplaceAll(const TString &s1, const TString &s2)
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
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
virtual void PaintText(Double_t x, Double_t y, const char *text)
virtual void SetY(Double_t y)
virtual void SetX(Double_t x)
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.