48 if (
auto pad =
dynamic_cast<TPad *
>(
gPad))
67 template<
typename T,
typename... Rest>
72 auto res =
dynamic_cast<T *
>(
fObject);
78 auto res2 =
new T(std::forward<Rest>(rest)...);
169 gROOT->SetEditorMode();
180 s.Replace(
l-2, 2,
"<");
185 }
else if (isprint(py)) {
186 s.Insert(
l - 1, (
char)py);
238 if ((inter->fObject && !parent.
FindObject(inter->fObject)) || (
mode != inter->fMode)) {
245 auto obj = inter->fObject;
250 while (
auto pobj = next()) {
269 if (!newpad->IsZombie()) {
270 newpad->UseCurrentStyle();
286 gROOT->SetEditorMode();
294 bool had_object = (inter->fObject !=
nullptr);
298 if (
auto line = inter->Make<
TLine>(parent, inter->fX0, inter->fY0,
x,
y)) {
313 cline->SetEndPoint(
x,
y);
316 if (
auto carc = inter->Make<
TCurlyArc>(parent, inter->fX0, inter->fY0, 1., 0., 360.,
318 auto pradius =
TMath::Sqrt((
px - inter->fPX0) * (
px - inter->fPX0) + (
py - inter->fPY0) * (
py - inter->fPY0));
320 carc->SetRadius(radius);
324 if (
auto arc = inter->Make<
TArc>(parent, 1., 1., 1, 45, 315)) {
327 arc->SetX1(0.5*(
x + inter->fX0));
328 arc->SetY1(0.5*(
y + inter->fY0));
332 if (
auto ellipse = inter->Make<
TEllipse>(parent, 1., 1., 1, 1)) {
335 ellipse->SetX1(0.5*(
x + inter->fX0));
336 ellipse->SetY1(0.5*(
y + inter->fY0));
340 if (
auto pave = inter->Make<
TPave>(parent,
x,
y,
x,
y))
341 inter->SetCoord<
TPave>(pave,
x,
y);
345 inter->SetCoord<
TPave>(pave,
x,
y);
348 if (
auto pave = inter->Make<
TPaveText>(parent,
x,
y,
x,
y)) {
351 inter->SetCoord<
TPave>(pave,
x,
y);
358 inter->SetCoord<
TPave>(pave,
x,
y);
362 if (
auto diamond = inter->Make<
TDiamond>(parent,
x,
y,
x,
y))
363 inter->SetCoord<
TPave>(diamond,
x,
y);
366 if (
auto box = inter->Make<
TBox>(parent,
x,
y,
x,
y)) {
367 box->SetFillStyle(1);
375 if (inter->fObject) {
388 if (
auto pad =
dynamic_cast<TPad *
>(
gPad))
398 if (
auto pad =
dynamic_cast<TPad *
>(
gPad))
408 if (
auto pad =
dynamic_cast<TPad *
>(
gPad))
462 inter->fGraph->SetPoint(inter->fNPoints, inter->fX0, inter->fY0);
467 gROOT->SetEditorMode();
471 inter->fGraph->Set(inter->fNPoints + 1);
472 inter->fGraph->SetPoint(inter->fNPoints,
x,
y);
481 parent.Add(inter->fGraph,
"L");
487 if (inter->fNPoints < (
mode ==
kCutG ? 3 : 2)) {
489 parent.
Remove(inter->fGraph);
490 delete inter->fGraph;
493 inter->fGraph->SetPoint(inter->fNPoints, inter->fX0, inter->fY0);
496 inter->fGraph->Set(inter->fNPoints);
503 gROOT->SetEditorMode();
509 inter->fGraph->SetPoint(inter->fNPoints,
x,
y);
523 if (
auto pad =
dynamic_cast<TPad *
>(
gPad))
537 if (inter && !parent.
FindObject(inter->GetObject())) {
546 if (inter && inter->ProcessKeyPress(parent,
py))
553 inter->FinishEditing();
556 gROOT->SetEditorMode();
570 gROOT->SetEditorMode();
592 if (
auto pad =
dynamic_cast<TPad *
>(
gPad))
619 default:
gROOT->SetEditorMode();
break;
int Int_t
Signed integer 4 bytes (int)
Option_t Option_t TPoint TPoint const char mode
R__EXTERN TSystem * gSystem
Draw all kinds of Arrows.
static Option_t * GetDefaultOption()
Get default option.
static Float_t GetDefaultArrowSize()
Get default arrow size.
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
static void Int_t Int_t py
static void ExecutePolyLine(TPad &parent, Int_t mode, Int_t event, Int_t px, Int_t py)
Create a new TGraph or TCutG in the pad.
static void Int_t Int_t Int_t mode
static void ExecuteTwoPoint(TPad &pad, Int_t mode, Int_t event, Int_t px, Int_t py)
Create a new line/arrow/pave/subpad in the specified pad.
static void ExecuteText(TPad &pad, Int_t mode, Int_t event, Int_t px, Int_t py)
Create a new TLatex or TMarker at the cursor position in the provided pad.
static void ExecuteEvent(TPad &pad, Int_t edit_mode, Int_t event, Int_t px, Int_t py)
Handle edit mode in the TPad Executed when editmode is not 0.
Implements curly or wavy arcs used to draw Feynman diagrams.
static Double_t GetDefaultWaveLength()
Get default wave length.
static Double_t GetDefaultAmplitude()
Get default wave amplitude.
Implements curly or wavy polylines used to draw Feynman diagrams.
static Double_t GetDefaultWaveLength()
Get default wave length.
static Double_t GetDefaultAmplitude()
Get default amplitude.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
@ kClipFrame
Clip to the frame boundary.
void SetName(const char *name="") override
Set graph name.
To draw Mathematical Formula.
Use the TLine constructor to create a simple line.
virtual void SetY2(Double_t y2)
virtual void SetX2(Double_t x2)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
The most important graphics class in the ROOT system.
virtual void StartEditing()
Double_t PadtoY(Double_t y) const override
Convert y from pad to Y.
Double_t GetY2() const override
TObject * Remove(TObject *obj, Bool_t modified=kTRUE) override
Remove object from list of primitives When.
TList * GetListOfPrimitives() const override
Double_t AbsPixeltoY(Double_t py) override
Double_t PadtoX(Double_t x) const override
Convert x from pad to X.
Double_t YtoPad(Double_t y) const override
Convert y from Y to pad.
void Update() override
Update pad.
Double_t AbsPixeltoX(Double_t px) override
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
Double_t GetY1() const override
TCanvas * GetCanvas() const override
void Add(TObject *obj, Option_t *opt="", Bool_t modified=kTRUE) override
Add an object to list of primitives with specified draw option When.
TObject * FindObject(const char *name) const override
Search if object named name is inside this pad or in pads inside this pad.
Double_t PixeltoX(Double_t px) override
Convert pixel to X coordinate.
Double_t GetX2() const override
Double_t GetX1() const override
const char * GetName() const override
Returns name of object.
Double_t XtoPad(Double_t x) const override
Convert x from X to pad.
A Pave (see TPave) with a text centered in the Pave.
const char * GetLabel() const
virtual void SetLabel(const char *label)
A Pave (see TPave) with text, lines or/and boxes inside.
virtual Int_t GetSize() const
return number of text lines (ignoring TLine, etc)
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
A TBox with a bordersize and a shadow option.
A PaveText (see TPaveText) with several stacked paves.
Interactive object for TGraph and TCutG editing.
TPolyLineEditInteractive(Int_t mode, const char *name, Double_t x0, Double_t y0, Int_t px0, Int_t py0)
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Internal class implementing text editing.
TTextEditInteractive(TPaveLabel *lbl)
TPaveText * fPaveText
or in TPave(s)Text
bool ProcessKeyPress(TPad &parent, Int_t py)
TLatex * fLatex
editing text in TLatex
TObject * GetObject() const
TTextEditInteractive(TPaveText *txt)
TTextEditInteractive(TLatex *ltx)
TPaveLabel * fLabel
or in TPaveLabel
void SetText(const TString &s)
Internal class implementing mouse click/move/relase editing Used for many classes like line,...
Int_t fMode
edit mode when interactive action started
T * Make(TPad &parent, Rest &&... rest)
TObject * fObject
object created by interactive action, owned by pad
TTwoPointInteractive(Int_t mode, Double_t x0, Double_t y0, Int_t px0, Int_t py0)
Double_t fY0
initial mouse pointer position in user coordiantes
Int_t fPY0
initial mouse pointer position in pixel coordiantes
void SetCoord(T *obj, Double_t x, Double_t y)
small helper class to store/restore gPad context in TPad methods
Helper class to store interactive parameters for individual objects Should be used via MakeInteractiv...
T * GetInteractive(TObject *obj)
T * MakeInteractive(TObject *obj, Rest &&... rest)
void FreeInteractive(TObject *obj)
Release interactive instance for specified object.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.