62 fCommand->Connect(
"ReturnPressed()",
"TGCommandPlugin",
this,
64 fCommand->Connect(
"CursorOutUp()",
"TGCommandPlugin",
this,
65 "HandleArrows(=kKey_Up)");
66 fCommand->Connect(
"CursorOutDown()",
"TGCommandPlugin",
this,
67 "HandleArrows(=kKey_Down)");
68 fCommand->Connect(
"TabPressed()",
"TGCommandPlugin",
this,
70 fCommand->Connect(
"TextChanged(const char *)",
"TGCommandPlugin",
this,
71 "HandleTextChanged(const char *)");
75 gClient->GetColorByName(
"#a0a0a0", pxl);
84 FILE *lunin = fopen(defhist.
Data(),
"rt");
89 while (fgets(histline, 256, lunin))
92 if (linecount > 500) {
94 while(--linecount > 0)
95 if (!fgets(histline, 256, lunin))
99 while (fgets(histline, 256, lunin)) {
100 histline[strlen(histline)-1] = 0;
101 fComboCmd->InsertEntry(histline, linecount, -1);
103 if (++linecount > 500)
124 fCommand->Disconnect(
"ReturnPressed()");
125 fCommand->Disconnect(
"CursorOutUp()");
126 fCommand->Disconnect(
"CursorOutDown()");
127 fCommand->Disconnect(
"TabPressed()");
128 fCommand->Disconnect(
"TextChanged(const char *)");
145 if (end > 0 && end !=
kNPOS) {
148 gClient->GetColorByName(
"#ff0000", pxl);
149 fLabel->SetTextColor(pxl);
154 gClient->GetColorByName(
"#000000", pxl);
155 fLabel->SetTextColor(pxl);
156 fLabel->SetText(
"Command (local):");
196 if (strlen(
string) > 0) {
203 sPrompt = ((
TRint*)
gROOT->GetApplication())->GetPrompt();
204 FILE *lunout = fopen(pathtmp.
Data(),
"a+t");
206 fputs(
Form(
"%s%s\n",sPrompt.
Data(),
string), lunout);
211 gROOT->ProcessLine(
string);
213 fComboCmd->InsertEntry(
string, entries, -1);
216 Gl_histadd((
char *)
string);
232 std::vector<std::string>
result;
233 size_t cur =
line.length();
237 std::string found =
result[0];
239 size_t colon =
line.find_last_of(
"::");
240 if (colon != std::string::npos)
242 size_t pos = found.find(
what) +
what.length();
243 std::string suffix = found.substr(pos);
244 fCommand->AppendText(suffix.c_str());
248 if (prompt.find(
"root") == std::string::npos)
252 fStatus->AddLine(prompt.c_str());
254 for (
auto& res :
result) {
ULong_t Pixel_t
Pixel value.
R__EXTERN TApplication * gApplication
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char text
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Class used to redirect the command line input/output.
TGHorizontalFrame * fHf
horizontal frame
void SetHistAdd(Bool_t add=kTRUE)
The function SetHistAdd() is needed for a standalone TApplication to log the TGCommandPlugin commands...
Bool_t fHistAdd
flag to add commands to history
TGTextBuffer * fCommandBuf
command text buffer
Int_t fPid
current process id
TTimer * fTimer
for local/remote update
void HandleCommand()
Handle command line from the "command" combo box.
TGTextEntry * fCommand
command text entry widget
void HandleTextChanged(const char *)
Handle the text changed events.
TGCommandPlugin(const TGWindow *p, UInt_t w, UInt_t h)
TGCommandPlugin Constructor.
TString fTempString
temporary command string
void ToggleTimer(Bool_t on)
Let user stop the internal timer when there is no need to check for remote.
void HandleTab()
Handle the 'TAB' key events.
Bool_t HandleTimer(TTimer *t) override
Handle timer event.
TGComboBox * fComboCmd
commands combobox
void CheckRemote(const char *)
Check if actual ROOT session is a remote one or a local one.
TGTextView * fStatus
output capture view
TGLabel * fLabel
"command :" label
~TGCommandPlugin() override
Destructor.
Int_t fPos
current history position
void HandleArrows(Int_t keysym)
Handle the 'up' and 'down' arrow key events.
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
static Pixel_t GetWhitePixel()
Get white pixel value.
void MapWindow() override
map window
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
TGMainFrame(const TGMainFrame &)=delete
const char * GetString() const
Text string listbox entries.
const TGString * GetText() const
A TGTextView is a text viewer widget.
ROOT GUI Window base class.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
const char * Data() const
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Handles synchronous and a-synchronous timer events.