Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
G4UIXm Class Reference

#include <G4UIXm.hh>

Inheritance diagram for G4UIXm:
G4VBasicShell G4VInteractiveSession G4UIsession G4coutDestination

Public Types

using Transformer = std::function< G4bool(G4String &)>
 

Public Member Functions

void AddButton (const char *, const char *, const char *)
 
void AddCerrTransformer (const Transformer &t)
 
void AddCerrTransformer (Transformer &&t)
 
void AddCoutTransformer (const Transformer &t)
 
void AddCoutTransformer (Transformer &&t)
 
virtual void AddIcon (const char *, const char *, const char *, const char *)
 
void AddInteractor (G4String, G4Interactor)
 
void AddMenu (const char *, const char *)
 
virtual void ClearMenu ()
 
virtual void DefaultIcons (bool)
 
 G4UIXm (int, char **)
 
G4String GetCommand (Widget)
 
G4Interactor GetInteractor (G4String)
 
G4int GetLastReturnCode () const
 
virtual void NativeMenu (bool)
 
virtual void OutputStyle (const char *, const char *, const char *)
 
virtual void PauseSessionStart (const G4String &)
 
void Prompt (G4String)
 
virtual G4int ReceiveG4cerr (const G4String &)
 
G4int ReceiveG4cerr_ (const G4String &msg)
 
virtual G4int ReceiveG4cout (const G4String &)
 
G4int ReceiveG4cout_ (const G4String &msg)
 
virtual void ResetTransformers ()
 
G4UIsessionSessionStart ()
 
void SessionTerminate ()
 
 ~G4UIXm ()
 

Static Public Member Functions

static G4int InSession ()
 

Protected Member Functions

void ApplyShellCommand (const G4String &, G4bool &, G4bool &)
 
G4bool ChangeDirectory (const char *newDir)
 
void ChangeDirectoryCommand (const G4String &)
 
G4String Complete (const G4String &)
 
virtual void ExecuteCommand (const G4String &)
 
G4UIcommandFindCommand (const char *commandName) const
 
G4UIcommandTreeFindDirectory (const char *dirName) const
 
G4String FindMatchingPath (G4UIcommandTree *, const G4String &)
 
G4String GetCurrentWorkingDirectory () const
 
void ListDirectory (const G4String &) const
 
G4String ModifyToFullPathCommand (const char *aCommandLine) const
 
void ShowCurrent (const G4String &) const
 
void TerminalHelp (const G4String &)
 

Protected Attributes

G4int ifBatch = 0
 
G4int lastRC = 0
 
std::vector< TransformertransformersCerr
 
std::vector< TransformertransformersCout
 

Static Protected Attributes

static G4ICOMS_DLL G4int inSession = 0
 
static G4MTGLOB_DLL G4coutDestinationmasterG4coutDestination = nullptr
 

Private Types

typedef std::map< G4String, G4Interactor, std::less< G4String > > G4interactor_map
 

Private Member Functions

void ExitHelp () const
 
G4bool GetHelpChoice (G4int &)
 
G4String ModifyPath (const G4String &tempPath) const
 
void SecondaryLoop (G4String)
 

Static Private Member Functions

static void ButtonCallback (Widget, XtPointer, XtPointer)
 
static void CommandEnteredCallback (Widget, XtPointer, XtPointer)
 
static void keyHandler (Widget, XtPointer, XEvent *, Boolean *)
 

Private Attributes

Widget command
 
std::map< Widget, G4String, std::less< Widget > > commands
 
G4String currentDirectory
 
G4bool fHelp
 
G4int fHelpChoice
 
Widget form
 
G4interactor_map interactors
 
Widget menuBar
 
G4UImessengermessenger
 
Widget shell
 
Widget text
 

Detailed Description

Definition at line 60 of file G4UIXm.hh.

Member Typedef Documentation

◆ G4interactor_map

typedef std::map<G4String,G4Interactor, std::less<G4String> > G4VInteractiveSession::G4interactor_map
privateinherited

Definition at line 63 of file G4VInteractiveSession.hh.

◆ Transformer

Definition at line 61 of file G4coutDestination.hh.

Constructor & Destructor Documentation

◆ G4UIXm()

G4UIXm::G4UIXm ( int  argc,
char **  argv 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 70 of file G4UIXm.cc.

74:shell(NULL)
75,command(NULL)
76,menuBar(NULL)
77,text(NULL)
78,fHelp(false)
80/***************************************************************************/
82{
84 if(UI!=NULL) UI->SetSession(this);
85
86 G4Xt* interactorManager = G4Xt::getInstance (argc,argv,(char*)"Xm");
87
88 Widget top = (Widget)interactorManager->GetMainInteractor();
89
90 if(std::getenv("XENVIRONMENT")==NULL) {
91 XrmDatabase database = XrmGetDatabase(XtDisplay(top));
92 if(database!=NULL) {
93 XrmPutLineResource(&database,"*topShadowColor:white");
94 XrmPutLineResource(&database,"*bottomShadowColor:black");
95 XrmPutLineResource(&database,"*foreground:black");
96 XrmPutLineResource(&database,"*background:lightgrey");
97 XrmPutLineResource(&database,"*borderColor:lightgrey");
98 XrmPutLineResource(&database,"*fontList:-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1");
99 XrmPutLineResource(&database,"*text.background:white");
100 XrmPutLineResource(&database,"*text.fontList:*courier*-r-*--14-*");
101 XrmPutLineResource(&database,"*text.maxLength:8000");
102 }
103 }
104
105 Arg args[9];
106 XtSetArg(args[0],XmNkeyboardFocusPolicy,XmPOINTER); // For completion.
107 shell = XtAppCreateShell ("G4UIXm","G4UIXm",
108 topLevelShellWidgetClass,XtDisplay(top),
109 args,1);
110 form = XmCreateForm (shell,(char*)"form",NULL,0);
111 XtManageChild (form);
112
113 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_FORM);
114 XtSetArg(args[1],XmNleftAttachment ,XmATTACH_FORM);
115 XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
116 menuBar = XmCreateMenuBar (form,(char*)"menuBar",args,3);
117
118 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_NONE);
119 XtSetArg(args[1],XmNleftAttachment ,XmATTACH_FORM);
120 XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
121 XtSetArg(args[3],XmNbottomAttachment ,XmATTACH_FORM);
122 command = XmCreateCommand (form,(char*)"command",args,4);
123 XtManageChild (command);
124
125 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_NONE);
126 XtSetArg(args[1],XmNleftAttachment ,XmATTACH_FORM);
127 XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
128 XtSetArg(args[3],XmNbottomAttachment,XmATTACH_WIDGET);
129 XtSetArg(args[4],XmNbottomWidget ,command);
130 XmString cps = XmStringLtoRCreate((char*)"Clear",(char*)XmSTRING_DEFAULT_CHARSET);
131 XtSetArg (args[5],XmNlabelString,cps);
132 Widget clearButton = XmCreatePushButton(form,(char*)"clearButton",args,6);
133 XmStringFree (cps);
134 XtManageChild (clearButton);
135
136 XtSetArg(args[0],XmNtopAttachment ,XmATTACH_WIDGET);
137 XtSetArg(args[1],XmNtopWidget ,menuBar);
138 XtSetArg(args[2],XmNleftAttachment ,XmATTACH_FORM);
139 XtSetArg(args[3],XmNrightAttachment ,XmATTACH_FORM);
140 XtSetArg(args[4],XmNbottomAttachment,XmATTACH_WIDGET);
141 XtSetArg(args[5],XmNbottomWidget ,clearButton);
142 XtSetArg(args[6],XmNeditMode ,XmMULTI_LINE_EDIT);
143 XtSetArg(args[7],XmNrows ,12);
144 XtSetArg(args[8],XmNcolumns ,80);
145 text = XmCreateScrolledText (form,(char*)"text",args,9);
146 XtManageChild (text);
147
148 XtAddCallback(clearButton,XmNactivateCallback,
149 clearButtonCallback,(XtPointer)text);
150 XtAddCallback(command,XmNcommandEnteredCallback,
151 CommandEnteredCallback,(XtPointer)this);
152
153 Widget commandText = XmCommandGetChild(command,XmDIALOG_COMMAND_TEXT);
154 XtAddEventHandler(commandText,KeyPressMask,False,keyHandler,(XtPointer)this);
155
156 XtRealizeWidget(shell);
157 XtMapWidget(shell);
158
159 if(UI!=NULL) UI->SetCoutDestination(this);
160}
static void clearButtonCallback(Widget, XtPointer, XtPointer)
Definition: G4UIXm.cc:401
static char ** args
Definition: G4Xt.cc:51
Widget text
Definition: G4UIXm.hh:90
Widget form
Definition: G4UIXm.hh:90
static void CommandEnteredCallback(Widget, XtPointer, XtPointer)
Definition: G4UIXm.cc:355
Widget command
Definition: G4UIXm.hh:90
Widget menuBar
Definition: G4UIXm.hh:90
static void keyHandler(Widget, XtPointer, XEvent *, Boolean *)
Definition: G4UIXm.cc:381
Widget shell
Definition: G4UIXm.hh:90
G4int fHelpChoice
Definition: G4UIXm.hh:95
G4bool fHelp
Definition: G4UIXm.hh:94
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:727
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetSession(G4UIsession *const value)
Definition: G4UImanager.hh:190
G4Interactor GetMainInteractor()
Definition: G4Xt.hh:48
static G4Xt * getInstance()
Definition: G4Xt.cc:55

References args, clearButtonCallback(), command, CommandEnteredCallback(), form, G4Xt::getInstance(), G4VInteractorManager::GetMainInteractor(), G4UImanager::GetUIpointer(), keyHandler(), menuBar, G4UImanager::SetCoutDestination(), G4UImanager::SetSession(), shell, and text.

◆ ~G4UIXm()

G4UIXm::~G4UIXm ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 162 of file G4UIXm.cc.

166{
168 if(UI!=NULL) {
169 UI->SetSession(NULL);
170 UI->SetCoutDestination(NULL);
171 }
172 XtDestroyWidget(shell);
173}

References G4UImanager::GetUIpointer(), G4UImanager::SetCoutDestination(), G4UImanager::SetSession(), and shell.

Member Function Documentation

◆ AddButton()

void G4UIXm::AddButton ( const char *  a_menu,
const char *  a_label,
const char *  a_command 
)
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4VInteractiveSession.

Definition at line 325 of file G4UIXm.cc.

332{
333 if(a_menu==NULL) return;
334 if(a_label==NULL) return;
335 if(a_command==NULL) return;
336 Widget parent = (Widget)GetInteractor(a_menu);
337 if(parent==NULL) return;
338 Widget widget = XmCreatePushButton(parent,(char*)a_label,NULL,0);
339 XtManageChild (widget);
340 XtAddCallback (widget,XmNactivateCallback,ButtonCallback,(XtPointer)this);
341 commands[widget] = a_command;
342}
static void ButtonCallback(Widget, XtPointer, XtPointer)
Definition: G4UIXm.cc:412
std::map< Widget, G4String, std::less< Widget > > commands
Definition: G4UIXm.hh:91
G4Interactor GetInteractor(G4String)

References ButtonCallback(), commands, and G4VInteractiveSession::GetInteractor().

◆ AddCerrTransformer() [1/2]

void G4coutDestination::AddCerrTransformer ( const Transformer t)
inlineinherited

Definition at line 67 of file G4coutDestination.hh.

68 {
69 transformersCerr.push_back(t);
70 }
std::vector< Transformer > transformersCerr

References G4coutDestination::transformersCerr.

Referenced by G4MTcoutDestination::HandleFileCerr().

◆ AddCerrTransformer() [2/2]

void G4coutDestination::AddCerrTransformer ( Transformer &&  t)
inlineinherited

Definition at line 71 of file G4coutDestination.hh.

71{ transformersCerr.push_back(t); }

References G4coutDestination::transformersCerr.

◆ AddCoutTransformer() [1/2]

void G4coutDestination::AddCoutTransformer ( const Transformer t)
inlineinherited

◆ AddCoutTransformer() [2/2]

void G4coutDestination::AddCoutTransformer ( Transformer &&  t)
inlineinherited

Definition at line 66 of file G4coutDestination.hh.

66{ transformersCout.push_back(t); }

References G4coutDestination::transformersCout.

◆ AddIcon()

void G4VInteractiveSession::AddIcon ( const char *  ,
const char *  ,
const char *  ,
const char *   
)
virtualinherited

Reimplemented in G4UIQt.

Definition at line 60 of file G4VInteractiveSession.cc.

61{
62}

◆ AddInteractor()

void G4VInteractiveSession::AddInteractor ( G4String  a_name,
G4Interactor  a_interactor 
)
inherited

Definition at line 80 of file G4VInteractiveSession.cc.

82{
83 interactors[a_name] = a_interactor;
84}

References G4VInteractiveSession::interactors.

Referenced by G4UIQt::AddMenu(), AddMenu(), G4UIWin32::AddMenu(), and G4UIWin32::G4UIWin32().

◆ AddMenu()

void G4UIXm::AddMenu ( const char *  a_name,
const char *  a_label 
)
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4VInteractiveSession.

Definition at line 299 of file G4UIXm.cc.

305{
306 if(menuBar==NULL) return;
307 if(a_name==NULL) return;
308 if(a_label==NULL) return;
309 XtManageChild (menuBar);
310 // Pulldown menu :
311 Widget widget;
312 widget = XmCreatePulldownMenu (menuBar,(char*)a_name,NULL,0);
313 AddInteractor (a_name,(G4Interactor)widget);
314 // Cascade button :
315 Arg args[2];
316 XmString cps = XmStringLtoRCreate((char*)a_label,(char*)XmSTRING_DEFAULT_CHARSET);
317 XtSetArg (args[0],XmNlabelString,cps);
318 XtSetArg (args[1],XmNsubMenuId,widget);
319 widget = XmCreateCascadeButton (menuBar,(char*)a_name,args,2);
320 XmStringFree (cps);
321 XtManageChild (widget);
323}
static void ExecuteChangeSizeFunction(Widget)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Definition: G4UIXm.cc:495
void * G4Interactor
void AddInteractor(G4String, G4Interactor)

References G4VInteractiveSession::AddInteractor(), args, ExecuteChangeSizeFunction(), form, and menuBar.

◆ ApplyShellCommand()

void G4VBasicShell::ApplyShellCommand ( const G4String a_string,
G4bool exitSession,
G4bool exitPause 
)
protectedinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 232 of file G4VBasicShell.cc.

237{
239 if(UI==NULL) return;
240
241 G4String command = G4StrUtil::lstrip_copy(a_string);
242
243 if( command[0] == '#' ) {
244
245 G4cout << command << G4endl;
246
247 } else if( command == "ls" || command.substr(0,3) == "ls " ) {
248
249 ListDirectory( command );
250
251 } else if( command == "pwd" ) {
252
253 G4cout << "Current Working Directory : "
255
256 } else if( command == "cd" || command.substr(0,3) == "cd ") {
257
258 ChangeDirectoryCommand ( command );
259
260 } else if( command == "help" || command.substr(0,5) == "help ") {
261
262 TerminalHelp( command );
263
264 } else if( command[0] == '?' ) {
265
266 ShowCurrent( command );
267
268 } else if( command == "hist" || command == "history") {
269
270 G4int nh = UI->GetNumberOfHistory();
271 for(G4int i=0;i<nh;i++) {
272 G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl;
273 }
274
275 } else if( command[0] == '!' ) {
276
277 G4String ss = command.substr(1,command.length()-1);
278 G4int vl;
279 const char* tt = ss;
280 std::istringstream is(tt);
281 is >> vl;
282 G4int nh = UI->GetNumberOfHistory();
283 if(vl>=0 && vl<nh) {
284 G4String prev = UI->GetPreviousCommand(vl);
285 G4cout << prev << G4endl;
287 } else {
288 G4cerr << "history " << vl << " is not found." << G4endl;
289 }
290
291 } else if( command == "exit" ) {
292
293 if( exitPause == false) { //In a secondary loop.
294 G4cout << "You are now processing RUN." << G4endl;
295 G4cout << "Please abort it using \"/run/abort\" command first" << G4endl;
296 G4cout << " and use \"continue\" command until the application" << G4endl;
297 G4cout << " becomes to Idle." << G4endl;
298 } else {
299 exitSession = true;
300 }
301
302 } else if( command == "cont" || command == "continue"){
303
304 exitPause = true;
305
306 } else {
307
309
310 }
311}
int G4int
Definition: G4Types.hh:85
static G4bool exitSession
Definition: G4UIQt.cc:92
static G4bool exitPause
Definition: G4UIQt.cc:93
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfHistory() const
Definition: G4UImanager.hh:201
G4String GetPreviousCommand(G4int i) const
Definition: G4UImanager.hh:202
G4String ModifyToFullPathCommand(const char *aCommandLine) const
void ShowCurrent(const G4String &) const
void TerminalHelp(const G4String &)
virtual void ExecuteCommand(const G4String &)
void ListDirectory(const G4String &) const
G4String GetCurrentWorkingDirectory() const
void ChangeDirectoryCommand(const G4String &)
G4String lstrip_copy(G4String str, char c=' ')
Return copy of string with leading characters removed.

References G4VBasicShell::ChangeDirectoryCommand(), G4VBasicShell::ExecuteCommand(), exitPause, exitSession, G4cerr, G4cout, G4endl, G4VBasicShell::GetCurrentWorkingDirectory(), G4UImanager::GetNumberOfHistory(), G4UImanager::GetPreviousCommand(), G4UImanager::GetUIpointer(), G4VBasicShell::ListDirectory(), G4StrUtil::lstrip_copy(), G4VBasicShell::ModifyToFullPathCommand(), G4VBasicShell::ShowCurrent(), and G4VBasicShell::TerminalHelp().

Referenced by G4UIQt::ButtonCallback(), ButtonCallback(), G4UIQt::CommandEnteredCallback(), CommandEnteredCallback(), G4UIWin32::DoOpenMacro(), G4UIWin32::DoSaveViewer(), G4UIWin32::ProcessDefaultCommands(), and G4UIWin32::ProcessEnterKey().

◆ ButtonCallback()

void G4UIXm::ButtonCallback ( Widget  a_widget,
XtPointer  a_tag,
XtPointer   
)
staticprivate

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 412 of file G4UIXm.cc.

419{
420 G4UIXm* This = (G4UIXm*)a_tag;
421 if(This->fHelp==true) return; // Disabled when in help.
422 G4String ss = This->GetCommand (a_widget);
424}
static G4bool exitSession
Definition: G4UIXm.cc:66
static G4bool exitPause
Definition: G4UIXm.cc:67
Definition: G4UIXm.hh:60
G4String GetCommand(Widget)
Definition: G4UIXm.cc:344
void ApplyShellCommand(const G4String &, G4bool &, G4bool &)

References G4VBasicShell::ApplyShellCommand(), exitPause, exitSession, fHelp, and GetCommand().

Referenced by AddButton().

◆ ChangeDirectory()

G4bool G4VBasicShell::ChangeDirectory ( const char *  newDir)
protectedinherited

Definition at line 74 of file G4VBasicShell.cc.

75{
76 G4String newPrefix = G4StrUtil::strip_copy(newDir);
77
78 G4String newDirectory = ModifyPath( newPrefix );
79 if( newDirectory.back() != '/' )
80 { newDirectory += "/"; }
81 if( FindDirectory( newDirectory.c_str() ) == NULL )
82 { return false; }
83 currentDirectory = newDirectory;
84 return true;
85}
G4String ModifyPath(const G4String &tempPath) const
G4String currentDirectory
G4UIcommandTree * FindDirectory(const char *dirName) const
G4String strip_copy(G4String str, char c=' ')
Return copy of string with leading and trailing characters removed.

References G4VBasicShell::currentDirectory, G4VBasicShell::FindDirectory(), G4VBasicShell::ModifyPath(), and G4StrUtil::strip_copy().

Referenced by G4VBasicShell::ChangeDirectoryCommand().

◆ ChangeDirectoryCommand()

void G4VBasicShell::ChangeDirectoryCommand ( const G4String newCommand)
protectedinherited

Definition at line 325 of file G4VBasicShell.cc.

326{
328 if( newCommand.length() <= 3 ) {
329 prefix = "/";
330 } else {
331 G4String aNewPrefix = newCommand.substr(3, newCommand.length()-3);
332 prefix = G4StrUtil::strip_copy(aNewPrefix);
333 }
334 if(!ChangeDirectory(prefix)) {
335 G4cout << "directory <" << prefix << "> not found." << G4endl;
336 }
337}
G4bool ChangeDirectory(const char *newDir)

References G4VBasicShell::ChangeDirectory(), G4cout, G4endl, and G4StrUtil::strip_copy().

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIterminal::GetCommand(), and G4ZMQServer::GetCommand().

◆ ClearMenu()

void G4VInteractiveSession::ClearMenu ( )
virtualinherited

Reimplemented in G4UIQt.

Definition at line 75 of file G4VInteractiveSession.cc.

76{
77}

◆ CommandEnteredCallback()

void G4UIXm::CommandEnteredCallback ( Widget  ,
XtPointer  a_tag,
XtPointer  a_data 
)
staticprivate

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 355 of file G4UIXm.cc.

362{
363 G4UIXm* This = (G4UIXm*)a_tag;
364
365 XmString cps = ((XmCommandCallbackStruct*)a_data)->value;
366 char* ss = XmConvertCompoundStringToString(cps,0);
367 G4String command (ss);
368 XtFree (ss);
369
370 if(This->fHelp==true) {
371 exitHelp = true;
372 This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
373 } else {
375 }
376
377 //a_widget = NULL; Not used (1st argument). Comment out to avoid compiler warnings. (JA)
378 a_tag = NULL;
379}
static G4bool ConvertStringToInt(const char *, int &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Definition: G4UIXm.cc:478
static char * XmConvertCompoundStringToString(XmString, int)
Definition: G4UIXm.cc:428
static G4bool exitHelp
Definition: G4UIXm.cc:68

References G4VBasicShell::ApplyShellCommand(), command, ConvertStringToInt(), exitHelp, exitPause, exitSession, fHelp, fHelpChoice, and XmConvertCompoundStringToString().

Referenced by G4UIXm().

◆ Complete()

G4String G4VBasicShell::Complete ( const G4String commandName)
protectedinherited

Definition at line 180 of file G4VBasicShell.cc.

181{
182 G4String rawCommandLine = commandName;
183 G4String commandLine = G4StrUtil::strip_copy(rawCommandLine);
184
185 size_t i = commandLine.find(" ");
186 if( i != std::string::npos ) return rawCommandLine; // Already entering parameters,
187 // assume command path is correct.
188 G4String commandString = commandLine;
189 G4String targetCom = ModifyPath(commandString);
191 G4String value = FindMatchingPath(tree,targetCom);
192 if(value=="") return rawCommandLine;
193 return value;
194}
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
G4String FindMatchingPath(G4UIcommandTree *, const G4String &)

References G4VBasicShell::FindMatchingPath(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), G4VBasicShell::ModifyPath(), and G4StrUtil::strip_copy().

Referenced by G4UIQt::eventFilter(), keyHandler(), and G4UIWin32::ProcessTabKey().

◆ DefaultIcons()

void G4VInteractiveSession::DefaultIcons ( bool  )
virtualinherited

Reimplemented in G4UIQt.

Definition at line 55 of file G4VInteractiveSession.cc.

56{
57}

◆ ExecuteCommand()

void G4VBasicShell::ExecuteCommand ( const G4String aCommand)
protectedvirtualinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented in G4UIterminal, and G4ZMQServer.

Definition at line 206 of file G4VBasicShell.cc.

210{
211 if(aCommand.length()<2) return;
213 if(UI==NULL) return;
214 G4int commandStatus = UI->ApplyCommand(aCommand);
215 switch(commandStatus) {
217 break;
218 case fCommandNotFound:
219 G4cerr << "command not found: " << "\"" << aCommand << "\"" << G4endl;
220 break;
222 G4cerr << "illegal application state -- command refused:" << "\"" << aCommand << "\"" << G4endl;
223 break;
227 default:
228 G4cerr << "command refused (" << commandStatus << "):" << "\"" << aCommand << "\"" << G4endl;
229 }
230}
@ fParameterOutOfCandidates
@ fCommandNotFound
@ fIllegalApplicationState
@ fParameterUnreadable
@ fCommandSucceeded
@ fParameterOutOfRange
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485

References G4UImanager::ApplyCommand(), fCommandNotFound, fCommandSucceeded, fIllegalApplicationState, fParameterOutOfCandidates, fParameterOutOfRange, fParameterUnreadable, G4cerr, G4endl, and G4UImanager::GetUIpointer().

Referenced by G4VBasicShell::ApplyShellCommand().

◆ ExitHelp()

void G4UIXm::ExitHelp ( ) const
privatevirtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 292 of file G4UIXm.cc.

296{
297}

◆ FindCommand()

G4UIcommand * G4VBasicShell::FindCommand ( const char *  commandName) const
protectedinherited

Definition at line 109 of file G4VBasicShell.cc.

110{
111 G4String commandLine = G4StrUtil::strip_copy(commandName);
112
113 G4String commandString;
114 size_t i = commandLine.find(" ");
115 if( i != std::string::npos )
116 { commandString = commandLine.substr(0,i); }
117 else
118 { commandString = commandLine; }
119
120 G4String targetCom = ModifyPath(commandString);
121 return G4UImanager::GetUIpointer()->GetTree()->FindPath(targetCom);
122}
G4UIcommand * FindPath(const char *commandPath) const

References G4UIcommandTree::FindPath(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), G4VBasicShell::ModifyPath(), and G4StrUtil::strip_copy().

Referenced by G4UIterminal::ExecuteCommand(), and G4ZMQServer::ExecuteCommand().

◆ FindDirectory()

G4UIcommandTree * G4VBasicShell::FindDirectory ( const char *  dirName) const
protectedinherited

Definition at line 87 of file G4VBasicShell.cc.

88{
89 G4String theDir = G4StrUtil::strip_copy(dirName);
90
91 G4String targetDir = ModifyPath( theDir );
92 if( targetDir.back() != '/' )
93 { targetDir += "/"; }
95 if( targetDir == "/" )
96 { return comTree; }
97 size_t idx = 1;
98 while( idx < targetDir.length()-1 )
99 {
100 size_t i = targetDir.find("/",idx);
101 comTree = comTree->GetTree(targetDir.substr(0,i+1).c_str());
102 if( comTree == NULL )
103 { return NULL; }
104 idx = i+1;
105 }
106 return comTree;
107}
G4UIcommandTree * GetTree(G4int i)

References G4UImanager::GetTree(), G4UIcommandTree::GetTree(), G4UImanager::GetUIpointer(), G4VBasicShell::ModifyPath(), and G4StrUtil::strip_copy().

Referenced by G4VBasicShell::ChangeDirectory(), G4VBasicShell::ListDirectory(), and G4ZMQServer::SessionStart().

◆ FindMatchingPath()

G4String G4VBasicShell::FindMatchingPath ( G4UIcommandTree aTree,
const G4String aCommandPath 
)
protectedinherited

Definition at line 196 of file G4VBasicShell.cc.

198{
199 return aTree-> CompleteCommandPath(aCommandPath);
200}

Referenced by G4VBasicShell::Complete().

◆ GetCommand()

G4String G4UIXm::GetCommand ( Widget  a_widget)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 344 of file G4UIXm.cc.

349{
350 return commands[a_widget];
351}

References commands.

Referenced by ButtonCallback().

◆ GetCurrentWorkingDirectory()

G4String G4VBasicShell::GetCurrentWorkingDirectory ( ) const
protectedinherited

◆ GetHelpChoice()

G4bool G4UIXm::GetHelpChoice ( G4int aInt)
privatevirtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 268 of file G4UIXm.cc.

273{
274 fHelp = true;
275 // SecondaryLoop :
276 G4Xt* interactorManager = G4Xt::getInstance ();
277 Prompt("Help");
278 exitHelp = false;
279 void* event;
280 while((event = interactorManager->GetEvent())!=NULL) {
281 interactorManager->DispatchEvent(event);
282 if(exitHelp==true) break;
283 }
284 Prompt("session");
285 //
286 if(fHelp==false) return false;
287 aInt = fHelpChoice;
288 fHelp = false;
289 return true;
290}
void Prompt(G4String)
Definition: G4UIXm.cc:193
void * GetEvent()
Definition: G4Xt.cc:150

References G4VInteractorManager::DispatchEvent(), exitHelp, fHelp, fHelpChoice, G4Xt::GetEvent(), G4Xt::getInstance(), and Prompt().

◆ GetInteractor()

G4Interactor G4VInteractiveSession::GetInteractor ( G4String  a_name)
inherited

Definition at line 87 of file G4VInteractiveSession.cc.

88{
89 G4interactor_map::iterator it;
90 if((it=interactors.find(a_name))==interactors.end()) return NULL;
91 return (*it).second;
92}

References G4VInteractiveSession::interactors.

Referenced by G4UIQt::AddButton(), AddButton(), and G4UIWin32::AddButton().

◆ GetLastReturnCode()

G4int G4UIsession::GetLastReturnCode ( ) const
inlineinherited

Definition at line 63 of file G4UIsession.hh.

63{ return lastRC; }
G4int lastRC
Definition: G4UIsession.hh:69

References G4UIsession::lastRC.

◆ InSession()

G4int G4UIsession::InSession ( )
staticinherited

Definition at line 68 of file G4UIsession.cc.

69{
70 return inSession;
71}
static G4ICOMS_DLL G4int inSession
Definition: G4UIsession.hh:67

References G4UIsession::inSession.

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ keyHandler()

void G4UIXm::keyHandler ( Widget  a_widget,
XtPointer  a_tag,
XEvent *  a_event,
Boolean *   
)
staticprivate

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 381 of file G4UIXm.cc.

389{
390 KeySym keySym;
391 XLookupString(&(a_event->xkey),NULL,0,&keySym,NULL);
392 if(keySym!=XK_Tab) return;
393 G4UIXm* This = (G4UIXm*)a_tag;
394 char* s = XmTextGetString(a_widget);
395 G4String ss = This->Complete(s);
396 XmTextSetString(a_widget,(char*)ss.data());
397 XtFree(s);
398 XmTextSetInsertionPosition(a_widget,XmTextGetLastPosition(a_widget));
399}
static constexpr double s
Definition: G4SIunits.hh:154
G4String Complete(const G4String &)

References G4VBasicShell::Complete(), and s.

Referenced by G4UIXm().

◆ ListDirectory()

void G4VBasicShell::ListDirectory ( const G4String newCommand) const
protectedinherited

Definition at line 339 of file G4VBasicShell.cc.

340{
341 G4String targetDir;
342 if( newCommand.length() <= 3 ) {
343 targetDir = GetCurrentWorkingDirectory();
344 } else {
345 G4String newPrefix = newCommand.substr(3, newCommand.length()-3);
346 targetDir = G4StrUtil::strip_copy(newPrefix);
347 }
348 G4UIcommandTree* commandTree = FindDirectory( targetDir );
349 if( commandTree == NULL ) {
350 G4cout << "Directory <" << targetDir << "> is not found." << G4endl;
351 } else {
352 commandTree->ListCurrent();
353 }
354}
void ListCurrent() const

References G4VBasicShell::FindDirectory(), G4cout, G4endl, G4VBasicShell::GetCurrentWorkingDirectory(), G4UIcommandTree::ListCurrent(), and G4StrUtil::strip_copy().

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIterminal::GetCommand(), and G4ZMQServer::GetCommand().

◆ ModifyPath()

G4String G4VBasicShell::ModifyPath ( const G4String tempPath) const
privateinherited

Definition at line 124 of file G4VBasicShell.cc.

125{
126 if( tempPath.length() == 0 ) return tempPath;
127
128 G4String newPath = "";
129
130 // temporal full path
131 if( tempPath[0] == '/') newPath = tempPath;
132 else newPath = currentDirectory + tempPath;
133
134 // body of path...
135 while(1){
136 size_t idx = newPath.find("/./");
137 if( idx == G4String::npos) break;
138 newPath.erase(idx,2);
139 }
140
141 while(1) {
142 size_t idx = newPath.find("/../");
143 if( idx == G4String::npos) break;
144 if( idx == 0) {
145 newPath.erase(1,3);
146 continue;
147 }
148 size_t idx2 = newPath.find_last_of('/', idx-1);
149 if(idx2 != G4String::npos) newPath.erase(idx2, idx-idx2+3);
150 }
151
152 // end of path...
153 if ( newPath.size() >= 3 ) {
154 if(newPath.substr(newPath.size()-3,3) == "/..") {
155 if( newPath.size() == 3) {
156 newPath = "/";
157 } else {
158 size_t idx = newPath.find_last_of('/', newPath.size()-4);
159 if(idx != G4String::npos) newPath.erase(idx+1);
160 }
161 }
162 }
163
164 if ( newPath.size() >= 2 ) {
165 if(newPath.substr(newPath.size()-2,2) == "/.") newPath.erase(newPath.size()-1,1);
166 }
167
168 // truncate "/////" to "/"
169 while(1) {
170 size_t idx = newPath.find("//");
171 if( idx == G4String::npos) break;
172 newPath.erase(idx,1);
173 }
174
175 return newPath;
176}

References G4VBasicShell::currentDirectory.

Referenced by G4VBasicShell::ChangeDirectory(), G4VBasicShell::Complete(), G4VBasicShell::FindCommand(), G4VBasicShell::FindDirectory(), and G4VBasicShell::ModifyToFullPathCommand().

◆ ModifyToFullPathCommand()

G4String G4VBasicShell::ModifyToFullPathCommand ( const char *  aCommandLine) const
protectedinherited

Definition at line 47 of file G4VBasicShell.cc.

48{
49 G4String rawCommandLine = aCommandLine;
50 if(rawCommandLine.empty()||rawCommandLine[0]=='\0') return rawCommandLine;
51 G4String commandLine = G4StrUtil::strip_copy(rawCommandLine);
52 G4String commandString;
53 G4String parameterString;
54 size_t i = commandLine.find(" ");
55 if( i != std::string::npos )
56 {
57 commandString = commandLine.substr(0,i);
58 parameterString = " ";
59 parameterString += commandLine.substr(i+1,commandLine.length()-(i+1));
60 }
61 else
62 { commandString = commandLine; }
63
64 G4String fullPathCommandLine
65 = ModifyPath( commandString )+parameterString;
66 return fullPathCommandLine;
67}

References G4VBasicShell::ModifyPath(), and G4StrUtil::strip_copy().

Referenced by G4UIQt::ActivateCommand(), G4VBasicShell::ApplyShellCommand(), G4UIterminal::GetCommand(), G4ZMQServer::GetCommand(), G4VBasicShell::ShowCurrent(), and G4VBasicShell::TerminalHelp().

◆ NativeMenu()

void G4VInteractiveSession::NativeMenu ( bool  )
virtualinherited

Reimplemented in G4UIQt.

Definition at line 70 of file G4VInteractiveSession.cc.

71{
72}

◆ OutputStyle()

void G4VInteractiveSession::OutputStyle ( const char *  ,
const char *  ,
const char *   
)
virtualinherited

Reimplemented in G4UIQt.

Definition at line 65 of file G4VInteractiveSession.cc.

66{
67}

◆ PauseSessionStart()

void G4UIXm::PauseSessionStart ( const G4String a_state)
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 215 of file G4UIXm.cc.

220{
221 if(a_state=="G4_pause> ") {
222 SecondaryLoop ("Pause, type continue to exit this state");
223 }
224
225 if(a_state=="EndOfEvent") {
226 // Picking with feed back in event data Done here !!!
227 SecondaryLoop ("End of event, type continue to exit this state");
228 }
229}
void SecondaryLoop(G4String)
Definition: G4UIXm.cc:231

References SecondaryLoop().

◆ Prompt()

void G4UIXm::Prompt ( G4String  aPrompt)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 193 of file G4UIXm.cc.

198{
199 Arg args[1];
200 char* str = (char*)XtNewString(aPrompt.data());
201 XmString cps = XmStringLtoRCreate(str,(char*)XmSTRING_DEFAULT_CHARSET);
202 XtFree(str);
203 XtSetArg(args[0],XmNpromptString,cps);
204 XtSetValues(command,args,1);
205 XmStringFree(cps);
206}

References args, and command.

Referenced by GetHelpChoice(), SecondaryLoop(), and SessionStart().

◆ ReceiveG4cerr()

G4int G4UIXm::ReceiveG4cerr ( const G4String a_string)
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4UIsession.

Definition at line 258 of file G4UIXm.cc.

263{
264 XmTextAppendString(text,(char*)a_string.data());
265 return 0;
266}
static void XmTextAppendString(Widget, char *)
Definition: G4UIXm.cc:463

References text, and XmTextAppendString().

◆ ReceiveG4cerr_()

G4int G4coutDestination::ReceiveG4cerr_ ( const G4String msg)
inherited

Definition at line 84 of file G4coutDestination.cc.

85{
86 if(transformersCout.size() > 0)
87 {
88 G4String m = msg;
89 std::for_each(transformersCerr.begin(), transformersCerr.end(),
90 [&m](const Transformer& t) { t(m); }
91 // Call transforming function on message
92 );
93 return ReceiveG4cerr(m);
94 }
95 else
96 {
97 return ReceiveG4cerr(msg);
98 }
99}
static constexpr double m
Definition: G4SIunits.hh:109
virtual G4int ReceiveG4cerr(const G4String &msg)
std::function< G4bool(G4String &)> Transformer

References m, G4coutDestination::ReceiveG4cerr(), G4coutDestination::transformersCerr, and G4coutDestination::transformersCout.

Referenced by G4MasterForwardcoutDestination::ReceiveG4cerr().

◆ ReceiveG4cout()

G4int G4UIXm::ReceiveG4cout ( const G4String a_string)
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4UIsession.

Definition at line 248 of file G4UIXm.cc.

253{
254 XmTextAppendString(text,(char*)a_string.data());
255 return 0;
256}

References text, and XmTextAppendString().

◆ ReceiveG4cout_()

G4int G4coutDestination::ReceiveG4cout_ ( const G4String msg)
inherited

Definition at line 62 of file G4coutDestination.cc.

63{
64 // Avoid copy of string if not necessary
65 if(transformersCout.size() > 0)
66 {
67 G4String m = msg;
68 G4bool result = true;
69 for(const auto& el : transformersCout)
70 {
71 result &= el(m);
72 if(!result)
73 break;
74 }
75 return (result ? ReceiveG4cout(m) : 0);
76 }
77 else
78 {
79 return ReceiveG4cout(msg);
80 }
81}
bool G4bool
Definition: G4Types.hh:86
virtual G4int ReceiveG4cout(const G4String &msg)

References m, G4coutDestination::ReceiveG4cout(), and G4coutDestination::transformersCout.

Referenced by G4MasterForwardcoutDestination::ReceiveG4cout().

◆ ResetTransformers()

void G4coutDestination::ResetTransformers ( )
virtualinherited

Definition at line 41 of file G4coutDestination.cc.

42{
43 transformersCout.clear();
44 transformersCerr.clear();
45}

References G4coutDestination::transformersCerr, and G4coutDestination::transformersCout.

◆ SecondaryLoop()

void G4UIXm::SecondaryLoop ( G4String  a_prompt)
private

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 231 of file G4UIXm.cc.

236{
237 G4Xt* interactorManager = G4Xt::getInstance ();
238 Prompt(a_prompt);
239 exitPause = false;
240 void* event;
241 while((event = interactorManager->GetEvent())!=NULL) {
242 interactorManager->DispatchEvent(event);
243 if(exitPause==true) break;
244 }
245 Prompt("session");
246}

References G4VInteractorManager::DispatchEvent(), exitPause, G4Xt::GetEvent(), G4Xt::getInstance(), and Prompt().

Referenced by PauseSessionStart().

◆ SessionStart()

G4UIsession * G4UIXm::SessionStart ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 175 of file G4UIXm.cc.

179{
180 G4Xt* interactorManager = G4Xt::getInstance ();
181 Prompt("session");
182 exitSession = false;
183 interactorManager->DisableSecondaryLoop ();
184 void* event;
185 while((event = interactorManager->GetEvent())!=NULL) {
186 interactorManager->DispatchEvent(event);
187 if(exitSession==true) break;
188 }
189 interactorManager->EnableSecondaryLoop ();
190 return this;
191}

References G4VInteractorManager::DisableSecondaryLoop(), G4VInteractorManager::DispatchEvent(), G4VInteractorManager::EnableSecondaryLoop(), exitSession, G4Xt::GetEvent(), G4Xt::getInstance(), and Prompt().

◆ SessionTerminate()

void G4UIXm::SessionTerminate ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 208 of file G4UIXm.cc.

212{
213}

◆ ShowCurrent()

void G4VBasicShell::ShowCurrent ( const G4String newCommand) const
protectedinherited

Definition at line 313 of file G4VBasicShell.cc.

314{
316 if(UI==NULL) return;
317 G4String comString = newCommand.substr(1,newCommand.length()-1);
318 G4String theCommand = ModifyToFullPathCommand(comString);
319 G4String curV = UI->GetCurrentValues(theCommand);
320 if( ! curV.empty() ) {
321 G4cout << "Current value(s) of the parameter(s) : " << curV << G4endl;
322 }
323}
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:164

References G4cout, G4endl, G4UImanager::GetCurrentValues(), G4UImanager::GetUIpointer(), and G4VBasicShell::ModifyToFullPathCommand().

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIterminal::GetCommand(), and G4ZMQServer::GetCommand().

◆ TerminalHelp()

void G4VBasicShell::TerminalHelp ( const G4String newCommand)
protectedinherited

Definition at line 355 of file G4VBasicShell.cc.

356{
358 if(UI==NULL) return;
359 G4UIcommandTree * treeTop = UI->GetTree();
360 size_t i = newCommand.find(" ");
361 if( i != std::string::npos )
362 {
363 G4String newValue = newCommand.substr(i+1, newCommand.length()-(i+1));
364 G4StrUtil::strip(newValue);
365 G4String targetCom = ModifyToFullPathCommand(newValue);
366 G4UIcommand* theCommand = treeTop->FindPath(targetCom);
367 if( theCommand != NULL )
368 {
369 theCommand->List();
370 return;
371 }
372 else
373 {
374 G4cout << "Command <" << newValue << " is not found." << G4endl;
375 return;
376 }
377 }
378
379 G4UIcommandTree * floor[10];
380 floor[0] = treeTop;
381 size_t iFloor = 0;
382 size_t prefixIndex = 1;
384 while( prefixIndex < prefix.length()-1 )
385 {
386 size_t ii = prefix.find("/",prefixIndex);
387 floor[iFloor+1] =
388 floor[iFloor]->GetTree(G4String(prefix.substr(0,ii+1)));
389 prefixIndex = ii+1;
390 iFloor++;
391 }
392 floor[iFloor]->ListCurrentWithNum();
393 // 1998 Oct 2 non-number input
394 while(1){
395 //G4cout << G4endl << "Type the number ( 0:end, -n:n level back ) : "<<std::flush;
396 G4cout << G4endl << "Type the number ( 0:end, -n:n level back ) : "<<G4endl;
397 G4int j;
398 if(!GetHelpChoice(j)){
399 G4cout << G4endl << "Not a number, once more" << G4endl;
400 continue;
401 } else if( j < 0 ){
402 if( iFloor < (size_t)-j ) iFloor = 0;
403 else iFloor += j;
404 //iFloor += j;
405 //if( iFloor < 0 ) iFloor = 0;
406 floor[iFloor]->ListCurrentWithNum();
407 continue;
408 } else if(j == 0) {
409 break;
410 } else if( j > 0 ) {
411 G4int n_tree = floor[iFloor]->GetTreeEntry();
412 if( j > n_tree )
413 {
414 if( j <= n_tree + floor[iFloor]->GetCommandEntry() )
415 {
416 floor[iFloor]->GetCommand(j-n_tree)->List();
417 }
418 }
419 else
420 {
421 floor[iFloor+1] = floor[iFloor]->GetTree(j);
422 iFloor++;
423 floor[iFloor]->ListCurrentWithNum();
424 }
425 }
426 }
427 G4cout << "Exit from HELP." << G4endl << G4endl;
428 //G4cout << G4endl;
429 ExitHelp();
430}
G4UIcommand * GetCommand(G4int i)
G4int GetTreeEntry() const
void ListCurrentWithNum() const
virtual void List()
Definition: G4UIcommand.cc:410
virtual void ExitHelp() const =0
virtual G4bool GetHelpChoice(G4int &)=0
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.

References G4VBasicShell::ExitHelp(), G4UIcommandTree::FindPath(), G4cout, G4endl, G4UIcommandTree::GetCommand(), G4VBasicShell::GetCurrentWorkingDirectory(), G4VBasicShell::GetHelpChoice(), G4UImanager::GetTree(), G4UIcommandTree::GetTree(), G4UIcommandTree::GetTreeEntry(), G4UImanager::GetUIpointer(), G4UIcommand::List(), G4UIcommandTree::ListCurrentWithNum(), G4VBasicShell::ModifyToFullPathCommand(), and G4StrUtil::strip().

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIterminal::GetCommand(), G4ZMQServer::GetCommand(), and G4UIQt::ShowHelpCallback().

Field Documentation

◆ command

Widget G4UIXm::command
private

Definition at line 90 of file G4UIXm.hh.

Referenced by CommandEnteredCallback(), G4UIXm(), and Prompt().

◆ commands

std::map<Widget,G4String, std::less<Widget> > G4UIXm::commands
private

Definition at line 91 of file G4UIXm.hh.

Referenced by AddButton(), and GetCommand().

◆ currentDirectory

G4String G4VBasicShell::currentDirectory
privateinherited

◆ fHelp

G4bool G4UIXm::fHelp
private

Definition at line 94 of file G4UIXm.hh.

Referenced by ButtonCallback(), CommandEnteredCallback(), and GetHelpChoice().

◆ fHelpChoice

G4int G4UIXm::fHelpChoice
private

Definition at line 95 of file G4UIXm.hh.

Referenced by CommandEnteredCallback(), and GetHelpChoice().

◆ form

Widget G4UIXm::form
private

Definition at line 90 of file G4UIXm.hh.

Referenced by AddMenu(), and G4UIXm().

◆ ifBatch

G4int G4UIsession::ifBatch = 0
protectedinherited

Definition at line 68 of file G4UIsession.hh.

Referenced by G4UIsession::~G4UIsession().

◆ inSession

G4int G4UIsession::inSession = 0
staticprotectedinherited

◆ interactors

G4interactor_map G4VInteractiveSession::interactors
privateinherited

◆ lastRC

G4int G4UIsession::lastRC = 0
protectedinherited

◆ masterG4coutDestination

G4coutDestination * G4coutDestination::masterG4coutDestination = nullptr
staticprotectedinherited

◆ menuBar

Widget G4UIXm::menuBar
private

Definition at line 90 of file G4UIXm.hh.

Referenced by AddMenu(), and G4UIXm().

◆ messenger

G4UImessenger* G4VInteractiveSession::messenger
privateinherited

◆ shell

Widget G4UIXm::shell
private

Definition at line 90 of file G4UIXm.hh.

Referenced by G4UIXm(), and ~G4UIXm().

◆ text

Widget G4UIXm::text
private

Definition at line 90 of file G4UIXm.hh.

Referenced by G4UIXm(), ReceiveG4cerr(), and ReceiveG4cout().

◆ transformersCerr

std::vector<Transformer> G4coutDestination::transformersCerr
protectedinherited

◆ transformersCout

std::vector<Transformer> G4coutDestination::transformersCout
protectedinherited

The documentation for this class was generated from the following files: