18# include FT_FREETYPE_H
91 text.TText::Copy(*
this);
99 src.TText::Copy(*
this);
114 *
reinterpret_cast<std::wstring*
>(&((
TText&)obj).fWcsTitle) = *
reinterpret_cast<const std::wstring*
>(&
fWcsTitle);
116 delete reinterpret_cast<std::wstring*
>(&((
TText&)obj).fWcsTitle);
117 ((
TText&)obj).fWcsTitle = NULL;
132 return reinterpret_cast<std::wstring *
>(
fWcsTitle)->c_str();
158 Int_t cBoxX[5], cBoxY[5];
228 static Bool_t resize,turn;
239 static Bool_t right, ndcsav;
241 Int_t ax, ay, bx, by, cx, cy;
245 Int_t cBoxX[4], cBoxY[4], part;
249 if (!
gPad->IsEditable())
return;
274 div = ((cBoxX[3]-cBoxX[0])*co-(cBoxY[3]-cBoxY[0])*si);
275 if (
TMath::Abs(div) > 1
e-8) part = (
Int_t)(3*((px-cBoxX[0])*co-(py-cBoxY[0])*si)/ div);
315 if (dtheta<0) theta = -theta;
317 if (theta<0) theta += 360;
318 if (right) {theta = theta+180;
if (theta>=360) theta -= 360;}
326 case 1 : ax = px1; ay = py1;
break;
327 case 2 : ax = px1+
Int_t(si*
h/2); ay = py1+
Int_t(co*
h/2);
break;
328 case 3 : ax = px1+
Int_t(si*
h*3/2); ay = py1+
Int_t(co*
h*3/2);
break;
333 case 1 : ax = px1-
Int_t(co*w/2); ay = py1+
Int_t(si*w/2);
break;
334 case 2 : ax = px1-
Int_t(co*w/2+si*
h/2); ay = py1+
Int_t(si*w/2+co*
h/2);
break;
335 case 3 : ax = px1-
Int_t(co*w/2+si*
h*3/2); ay = py1+
Int_t(si*w/2+co*
h*3/2);
break;
340 case 1 : ax = px1-
Int_t(co*w); ay = py1+
Int_t(si*w);
break;
341 case 2 : ax = px1-
Int_t(co*w+si*
h/2); ay = py1+
Int_t(si*w+co*
h/2);
break;
342 case 3 : ax = px1-
Int_t(co*w+si*
h*3/2); ay = py1+
Int_t(si*w+co*
h*3/2);
break;
345 if (height == 3) {bx = ax-
Int_t(si*
h); by = ay-
Int_t(co*
h);}
346 else {bx = ax; by = ay;}
348 lambda =
Double_t(((px-bx)*(cx-bx)+(py-by)*(cy-by)))/
Double_t(((cx-bx)*(cx-bx)+(cy-by)*(cy-by)));
357 dx = px - pxold; px1 += dx;
358 dy = py - pyold; py1 += dy;
364 if (resize)
gPad->ShowGuidelines(
this, event,
't',
false);
365 if ((!resize)&&(!turn))
gPad->ShowGuidelines(
this, event,
'i',
true);
366 gPad->ShowGuidelines(
this, event, !resize&!turn);
372 pxold = px; pyold = py;
382 gPad->ShowGuidelines(
this, event, !resize&!turn);
385 dpx =
gPad->GetX2() -
gPad->GetX1();
386 dpy =
gPad->GetY2() -
gPad->GetY1();
389 fX = (
gPad->AbsPixeltoX(px1)-xp1)/dpx;
390 fY = (
gPad->AbsPixeltoY(py1)-yp1)/dpy;
405 event =
gVirtualX->RequestLocator(1, 1, px, py);
434 case 1 : Dx = 0 ;
break;
435 case 2 : Dx = cBoxW/2;
break;
436 case 3 : Dx = cBoxW ;
break;
439 case 1 : Dy = 0 ;
break;
440 case 2 : Dy = cBoxH/2;
break;
441 case 3 : Dy = cBoxH ;
break;
448 cBoxY[1] =
y-cBoxH+Dy;
449 cBoxX[2] =
x+cBoxW-Dx;
450 cBoxY[2] =
y-cBoxH+Dy;
451 cBoxX[3] =
x+cBoxW-Dx;
458 for (
int i=0; i<4 ; i++) {
459 Int_t hcBoxX = cBoxX[i];
460 Int_t hcBoxY = cBoxY[i];
461 cBoxX[i] = (
Int_t)((hcBoxX-
x)*cosTheta-(hcBoxY-
y)*sinTheta+
x);
462 cBoxY[i] = (
Int_t)((hcBoxX-
x)*sinTheta+(hcBoxY-
y)*cosTheta+
y);
481 Int_t cBoxX[4], cBoxY[4];
495 for (
Int_t i=1; i<4; i++) {
496 if (cBoxX[i] <
x1)
x1 = cBoxX[i];
497 if (cBoxX[i] >
x2)
x2 = cBoxX[i];
498 if (cBoxY[i] < y1) y1 = cBoxY[i];
499 if (cBoxY[i] > y2) y2 = cBoxY[i];
692 Int_t cBoxX[4], cBoxY[4];
701 gVirtualX->DrawLine(cBoxX[0], cBoxY[0], cBoxX[1], cBoxY[1]);
702 gVirtualX->DrawLine(cBoxX[1], cBoxY[1], cBoxX[2], cBoxY[2]);
703 gVirtualX->DrawLine(cBoxX[2], cBoxY[2], cBoxX[3], cBoxY[3]);
704 gVirtualX->DrawLine(cBoxX[3], cBoxY[3], cBoxX[0], cBoxY[0]);
708 Int_t ix = 0, iy = 0;
712 case 1 : ix = 0 ; iy = 0 ;
break;
713 case 2 : ix = 0 ; iy = 1 ;
break;
714 case 3 : ix = 1 ; iy = 1 ;
break;
719 case 1 : ix = 0 ; iy = 3 ;
break;
720 case 2 : ix = 0 ; iy = 2 ;
break;
721 case 3 : ix = 1 ; iy = 2 ;
break;
726 case 1 : ix = 3 ; iy = 3 ;
break;
727 case 2 : ix = 2 ; iy = 3 ;
break;
728 case 3 : ix = 2 ; iy = 2 ;
break;
732 p.
fX = (cBoxX[ix]+cBoxX[iy])/2;
733 p.
fY = (cBoxY[ix]+cBoxY[iy])/2;
800 s.ReplaceAll(
"\"",
"\\\"");
801 out<<
"text = new TText("<<
fX<<
","<<
fY<<
","<<quote<<
s.Data()<<quote<<
");"<<std::endl;
806 out<<
" text->Draw();"<<std::endl;
823 char *mb_title =
new char[MB_CUR_MAX * wcslen(title) + 1]();
825 size_t length = wcslen(title);
826 for (
size_t i = 0; i < length; i++) {
827 const int n = wctomb(p, title[i]);
838void TText::Streamer(
TBuffer &R__b)
848 TNamed::Streamer(R__b);
849 TAttText::Streamer(R__b);
873 case 1 : Dx = 0 ;
break;
874 case 2 : Dx = w/2 ;
break;
875 case 3 : Dx = w ;
break;
878 case 1 : Dy =
h ;
break;
879 case 2 : Dy =
h/2 ;
break;
880 case 3 : Dy = 0 ;
break;
static const double x2[5]
static const double x1[5]
include TDocParser_001 C image html pict1_TDocParser_001 png width
Abstract base class for elements drawn in the editor.
virtual Float_t GetTextSize() const
Return the text size.
virtual void Modify()
Change current text attributes if necessary.
virtual Short_t GetTextAlign() const
Return the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
Float_t fTextAngle
Text angle.
virtual Color_t GetTextColor() const
Return the text color.
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual Float_t GetTextAngle() const
Return the text angle.
Font_t fTextFont
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.
Short_t fTextAlign
Text alignment.
void Copy(TAttText &atttext) const
Copy this text attributes to a new TAttText.
Float_t fTextSize
Text size.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
The TNamed class is the base class for all named ROOT classes.
virtual void Copy(TObject &named) const
Copy this to obj.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
@ kCanDelete
if object in a list can be deleted
@ kMustCleanup
if object destructor must call RecursiveRemove()
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static void SetKerning(Bool_t state)
Set kerning flag.
static Bool_t IsInitialized()
static void GetTextAdvance(UInt_t &a, char *text)
Get advance (a) when text is horizontal.
static Bool_t GetKerning()
static void SetTextFont(Font_t fontnumber)
Set specified font.
static void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Get width (w) and height (h) when text is horizontal.
static const FT_BBox & GetBox()
static void SetTextSize(Float_t textsize)
Set current text size.
Base class for several text objects.
virtual void ls(Option_t *option="") const
List this text with its attributes.
virtual TPoint GetBBoxCenter()
Return the point given by Alignment as 'center'.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a string.
Double_t fY
Y position of text (left,center,etc..)
const void * GetWcsTitle(void) const
Returns the text as UNICODE.
TText & operator=(const TText &src)
Assignment operator.
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual ~TText()
Text default destructor.
virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
virtual void SetY(Double_t y)
virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
Paint the text control box.
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the point given by Alignment as 'center'.
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
void * fWcsTitle
!Used by TMathText
Double_t fX
X position of text (left,center,etc..)
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
Draw this text with new coordinates in NDC.
void Copy(TObject &text) const
Copy this text to text.
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
Return text ascent and descent for string text.
virtual void SetX(Double_t x)
virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const
Return text advance for string text if kern is true (default) kerning is taken into account.
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
virtual void Print(Option_t *option="") const
Dump this text with its attributes.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t cBoxX[4], Int_t cBoxY[4])
Return the text control box.
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the point given by Alignment as 'center'.
virtual TText * DrawTextNDC(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates in NDC.
virtual void SetMbTitle(const wchar_t *title=L"")
Change (i.e. set) the title of the TNamed.
@ kTextNDC
The text position is in the NDC space.
virtual void SetBBoxCenter(const TPoint &p)
Set the point given by Alignment as 'center'.
virtual void Paint(Option_t *option="")
Paint this text with its current attributes.
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
static constexpr double s
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in array...
Double_t Sqrt(Double_t x)