105 :
TPave(x1,y1,x2,y2,4,option),
TAttText(22,0,
gStyle->
GetTextColor(),
gStyle->
GetTextFont(),0)
158 if (!
gPad->IsEditable())
return 0;
159 TBox *newbox =
new TBox(x1,y1,x2,y2);
171 if (!
gPad->IsEditable())
return 0;
189 Int_t nch = strlen(text);
220 if (!
gPad->IsEditable())
return;
236 if (option && strlen(option)) opt = option;
257 if (!
gPad->IsEditable())
return;
263 gROOT->SetSelectedPrimitive(text);
264 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%lx)->SetSelected((TObject*)0x%lx)",
266 gROOT->ProcessLine(
Form(
"((TCanvas*)0x%lx)->Selected((TVirtualPad*)0x%lx,(TObject*)0x%lx,1)",
279 while ((line = (
TText*) next())) {
280 if (nlines == number)
return line;
293 while ((line = (
TText*) next())) {
306 if (nlines == 0)
return 0;
310 ymouse =
gPad->AbsPixeltoY(
gPad->GetEventY());
324 while ((line = (
TObject*) next())) {
327 linel = (
TLine*)line;
328 y1 = linel->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 = fY1 + y1*dy;
335 y1 = lineb->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 = fY1 + y1*dy;
341 linet = (
TText*)line;
346 if (yl > 0 && yl <1) {
351 if (valign == 1) y = ytext -0.5*yspace;
352 if (valign == 3) y = ytext +0.5*yspace;
368 while ((line = (
TObject*) next())) {
379 if (!
gPad->IsEditable())
return;
396 if (!
gPad->IsEditable())
return;
428 if (nlines == 0) nlines = 5;
445 textsize = 0.85*yspace/(y2 - y1);
446 while ((line = (
TObject*) next())) {
457 if (w > longest) longest = w;
461 if (longest > 0.92*dx) textsize *= 0.92*dx/longest;
462 if (mode ==
kDiamond) textsize *= 0.66;
474 while ((line = (
TObject*) next())) {
477 linel = (
TLine*)line;
478 x1 = linel->
GetX1();
if (x1 == 0) x1 =
fX1;
else x1 = fX1 + x1*dx;
479 x2 = linel->
GetX2();
if (x2 == 0) x2 =
fX2;
else x2 = fX1 + x2*dx;
480 y1 = linel->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 = fY1 + y1*dy;
481 y2 = linel->
GetY2();
if (y2 == 0) y2 = ytext;
else y2 = fY1 + y2*dy;
489 if (x1) x1 = fX1 + x1*dx;
490 else x1 = fX1 +
gPad->PixeltoX(1) -
gPad->PixeltoX(0);
492 if (x2) x2 = fX1 + x2*dx;
494 y1 = lineb->
GetY1();
if (y1 == 0) y1 = ytext;
else y1 = fY1 + y1*dy;
495 y2 = lineb->
GetY2();
if (y2 == 0) y2 = ytext;
else y2 = fY1 + y2*dy;
501 linet = (
TText*)line;
513 if (xl > 0 && xl <1) {
517 if (halign == 1) xtext = fX1 + margin;
518 if (halign == 2) xtext = 0.5*(fX1+
fX2);
519 if (halign == 3) xtext =
fX2 - margin;
521 if (yl > 0 && yl <1) ytext = fY1 + yl*dy;
542 if (xl > 0 && xl <1) {
546 if (halign == 1) xtext = fX1 + margin;
547 if (halign == 2) xtext = 0.5*(fX1+
fX2);
548 if (halign == 3) xtext =
fX2 - margin;
550 if (yl > 0 && yl <1) ytext = fY1 + yl*dy;
609 Int_t nch = strlen(filename);
610 if (nch == 0)
return;
612 char *fname =
StrDup(filename);
613 if (fname[nch-1] ==
';') { nch--; fname[nch]=0;}
615 std::ifstream
file(fname,std::ios::in);
617 Error(
"ReadFile",
"illegal file name");
622 const int linesize = 255;
623 char currentline[linesize];
624 char *ss, *sclose, *
s= 0;
628 file.getline(currentline,linesize);
629 if (file.eof())
break;
630 if (kline >= fromline && kline < fromline+nlines) {
632 if (strstr(s,
"+SetText")) {
634 sclose = strstr(ss,
")");
635 if (!sclose)
continue;
638 if (!lastline)
continue;
639 if (strstr(ss,
"Color(")) {
640 sscanf(ss+6,
"%d",&ival);
644 if (strstr(ss,
"Align(")) {
645 sscanf(ss+6,
"%d",&ival);
649 if (strstr(ss,
"Font(")) {
650 sscanf(ss+5,
"%d",&ival);
654 if (strstr(ss,
"Size(")) {
655 sscanf(ss+5,
"%f",&val);
659 if (strstr(ss,
"Angle(")) {
660 sscanf(ss+6,
"%f",&val);
680 if (nlines == 0)
return;
695 while ((line = (
TObject*) next())) {
698 linel = (
TLine*)line;
699 if (saved || savedl) {
705 out<<name<<
"_Line = "<<name<<
"->AddLine(" 706 <<linel->
GetX1()<<
","<<linel->
GetY1()<<
","<<linel->
GetX2()<<
","<<linel->
GetY2()<<
");"<<std::endl;
710 out<<
" "<<name<<
"_Line->SetLineColor(ci);" << std::endl;
712 out<<
" "<<name<<
"_Line->SetLineColor("<<linel->
GetLineColor()<<
");"<<std::endl;
715 out<<
" "<<name<<
"_Line->SetLineStyle("<<linel->
GetLineStyle()<<
");"<<std::endl;
718 out<<
" "<<name<<
"_Line->SetLineWidth("<<linel->
GetLineWidth()<<
");"<<std::endl;
725 if (saved || savedb) {
731 out<<name<<
"_Box = "<<name<<
"->AddBox(" 732 <<lineb->
GetX1()<<
","<<lineb->
GetY1()<<
","<<lineb->
GetX2()<<
","<<lineb->
GetY2()<<
");"<<std::endl;
736 out<<
" "<<name<<
"_Box->SetFillColor(ci);" << std::endl;
738 out<<
" "<<name<<
"_Box->SetFillColor("<<lineb->
GetFillColor()<<
");"<<std::endl;
741 out<<
" "<<name<<
"_Box->SetFillStyle("<<lineb->
GetFillStyle()<<
");"<<std::endl;
746 out<<
" "<<name<<
"_Box->SetLineColor(ci);" << std::endl;
748 out<<
" "<<name<<
"_Box->SetLineColor("<<lineb->
GetLineColor()<<
");"<<std::endl;
751 out<<
" "<<name<<
"_Box->SetLineStyle("<<lineb->
GetLineStyle()<<
");"<<std::endl;
754 out<<
" "<<name<<
"_Box->SetLineWidth("<<lineb->
GetLineWidth()<<
");"<<std::endl;
760 linet = (
TText*)line;
761 if (saved || savedt) {
767 if (!linet->
GetX() && !linet->
GetY()) {
770 out<<name<<
"_Text = "<<name<<
"->AddText(" 771 <<quote<<s.
Data()<<quote<<
");"<<std::endl;
773 out<<name<<
"_Text = "<<name<<
"->AddText(" 774 <<linet->
GetX()<<
","<<linet->
GetY()<<
","<<quote<<linet->
GetTitle()<<quote<<
");"<<std::endl;
779 out<<
" "<<name<<
"_Text->SetTextColor(ci);" << std::endl;
781 out<<
" "<<name<<
"_Text->SetTextColor("<<linet->
GetTextColor()<<
");"<<std::endl;
784 out<<
" "<<name<<
"_Text->SetTextFont("<<linet->
GetTextFont()<<
");"<<std::endl;
787 out<<
" "<<name<<
"_Text->SetTextSize("<<linet->
GetTextSize()<<
");"<<std::endl;
790 out<<
" "<<name<<
"_Text->SetTextAngle("<<linet->
GetTextAngle()<<
");"<<std::endl;
793 out<<
" "<<name<<
"_Text->SetTextAlign("<<linet->
GetTextAlign()<<
");"<<std::endl;
799 if (saved || savedlt) {
805 if (!latex->
GetX() && !latex->
GetY()) {
808 out<<name<<
"_LaTex = "<<name<<
"->AddText(" 809 <<quote<<sl.
Data()<<quote<<
");"<<std::endl;
811 out<<name<<
"_LaTex = "<<name<<
"->AddText(" 812 <<latex->
GetX()<<
","<<latex->
GetY()<<
","<<quote<<latex->
GetTitle()<<quote<<
");"<<std::endl;
817 out<<
" "<<name<<
"_LaTex->SetTextColor(ci);" << std::endl;
819 out<<
" "<<name<<
"_LaTex->SetTextColor("<<latex->
GetTextColor()<<
");"<<std::endl;
822 out<<
" "<<name<<
"_LaTex->SetTextFont("<<latex->
GetTextFont()<<
");"<<std::endl;
825 out<<
" "<<name<<
"_LaTex->SetTextSize("<<latex->
GetTextSize()<<
");"<<std::endl;
828 out<<
" "<<name<<
"_LaTex->SetTextAngle("<<latex->
GetTextAngle()<<
");"<<std::endl;
831 out<<
" "<<name<<
"_LaTex->SetTextAlign("<<latex->
GetTextAlign()<<
");"<<std::endl;
852 <<
","<<quote<<
fOption<<quote<<
");"<<std::endl;
855 <<
","<<quote<<
fOption<<quote<<
");"<<std::endl;
857 if (strcmp(
GetName(),
"TPave")) {
858 out<<
" pt->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
861 out<<
" pt->SetLabel("<<quote<<
fLabel<<quote<<
");"<<std::endl;
864 out<<
" pt->SetBorderSize("<<
fBorderSize<<
");"<<std::endl;
870 out<<
" pt->Draw();"<<std::endl;
885 while ((line = (
TText*) next())) {
899 void TPaveText::Streamer(
TBuffer &R__b)
909 TPave::Streamer(R__b);
910 TAttText::Streamer(R__b);
911 if (R__v > 1)
fLabel.Streamer(R__b);
void SetBufferOffset(Int_t offset=0)
TBox & operator=(const TBox &)
Assignment operator.
Option_t * GetOption() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void Print(Option_t *option="") const
Dump this pave with its attributes.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
TBox()
Box default constructor.
virtual TBox * AddBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Add a new graphics box to this pavetext.
virtual Color_t GetTextColor() const
Return the text color.
virtual Short_t GetTextAlign() const
Return the text alignment.
Float_t fMargin
Text margin.
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.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual void SetX(Double_t x)
TString & ReplaceAll(const TString &s1, const TString &s2)
R__EXTERN TStyle * gStyle
virtual void DeleteText()
Delete text at the mouse position.
static void SaveColor(std::ostream &out, Int_t ci)
Save a color with index > 228 as a C++ statement(s) on output stream out.
virtual void UseCurrentStyle()
Replace current attributes by current style.
virtual Float_t GetTextAngle() const
Return the text angle.
Double_t fY2
Y of 2nd point.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
Buffer base class used for serializing objects.
virtual void SetTextAttributes()
Invoke the DialogCanvas Text attributes.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void ToLower()
Change string to lower-case.
virtual void InsertText(const char *label)
Add a new Text line at the mouse position.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
A TBox with a bordersize and a shadow option.
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
Double_t fY1
Y of 1st point.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual Style_t GetLineStyle() const
Return the line style.
static const double x2[5]
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void DrawFile(const char *filename, Option_t *option="")
Draw lines in filename in this pavetext.
Double_t fX1NDC
X1 point in NDC coordinates.
virtual void Paint(Option_t *option="")
Paint this pavetext with its current attributes.
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 Int_t GetSize() const
return number of text lines (ignoring TLine, etc)
To draw Mathematical Formula.
TList * fLines
List of labels.
TString fLabel
Label written at the top of the pavetext.
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
virtual void Clear(Option_t *option="")
Clear all lines in this pavetext.
Base class for several text objects.
virtual ~TPaveText()
pavetext default destructor.
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
virtual void ReadFile(const char *filename, Option_t *option="", Int_t nlines=50, Int_t fromline=0)
Read lines of filename in this pavetext.
Int_t fLongest
Length of the longest line.
object has not been deleted
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
A Pave (see TPave) with a text centered in the Pave.
virtual void InsertLine()
Add a new line at the mouse position.
virtual void EditText()
Edit text at the mouse position.
virtual TText * GetLineWith(const char *text) const
Get Pointer to first containing string text in this pavetext.
Double_t GetXsize()
Return size of the formula along X in pad coordinates.
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 SetFillColor(Color_t fcolor)
Set the fill area color.
virtual Font_t GetTextFont() const
Return the text font.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Double_t fX2
X of 2nd point.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual TObject * GetObject(Double_t &ymouse, Double_t &yobj) const
Get object pointed by the mouse in this pavetext.
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 Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
Double_t fX1
X of 1st point.
void SetReadMode()
Set buffer in read mode.
Option_t * GetName() const
Returns name of object.
virtual void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
Int_t fBorderSize
window box bordersize in pixels
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")
Draw this box with new coordinates.
char * StrDup(const char *str)
Duplicate the string str.
virtual Color_t GetLineColor() const
Return the line color.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Double_t fY2NDC
Y2 point in NDC coordinates.
static const double x1[5]
A Pave (see TPave) with text, lines or/and boxes inside.
virtual void Print(Option_t *option="") const
Dump this pavetext with its attributes.
virtual Color_t GetFillColor() const
Return the fill area color.
virtual void SaveLines(std::ostream &out, const char *name, Bool_t saved)
Save lines of this pavetext as C++ statements on output stream out.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
Double_t fX2NDC
X2 point in NDC coordinates.
virtual void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
Binding & operator=(OUT(*fun)(void))
Mother of all ROOT objects.
virtual void Add(TObject *obj)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual void PaintPrimitives(Int_t mode)
Paint list of primitives in this pavetext.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetY(Double_t y)
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.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
TString fOption
Pave style.
TPaveText & operator=(const TPaveText &)
assignment operator
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void Paint(Option_t *option="")
Paint this pavelabel with its current attributes.
TPaveText()
pavetext default constructor.
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
Set attribute option for all lines containing string text.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual const char * GetTitle() const
Returns title of object.
Int_t GetBorderSize() const
const char * Data() const