| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|---|
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|---|
| 3 | <title>G4UIGAG.cc Source File</title>
|
|---|
| 4 | <link href="doxygen.css" rel="stylesheet" type="text/css">
|
|---|
| 5 | </head><body>
|
|---|
| 6 | <!-- Generated by Doxygen 1.3.4 -->
|
|---|
| 7 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
|
|---|
| 8 | <h1>G4UIGAG.cc</h1><a href="G4UIGAG_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">//</span>
|
|---|
| 9 | 00002 <span class="comment">// ********************************************************************</span>
|
|---|
| 10 | 00003 <span class="comment">// * License and Disclaimer *</span>
|
|---|
| 11 | 00004 <span class="comment">// * *</span>
|
|---|
| 12 | 00005 <span class="comment">// * The Geant4 software is copyright of the Copyright Holders of *</span>
|
|---|
| 13 | 00006 <span class="comment">// * the Geant4 Collaboration. It is provided under the terms and *</span>
|
|---|
| 14 | 00007 <span class="comment">// * conditions of the Geant4 Software License, included in the file *</span>
|
|---|
| 15 | 00008 <span class="comment">// * LICENSE and available at http://cern.ch/geant4/license . These *</span>
|
|---|
| 16 | 00009 <span class="comment">// * include a list of copyright holders. *</span>
|
|---|
| 17 | 00010 <span class="comment">// * *</span>
|
|---|
| 18 | 00011 <span class="comment">// * Neither the authors of this software system, nor their employing *</span>
|
|---|
| 19 | 00012 <span class="comment">// * institutes,nor the agencies providing financial support for this *</span>
|
|---|
| 20 | 00013 <span class="comment">// * work make any representation or warranty, express or implied, *</span>
|
|---|
| 21 | 00014 <span class="comment">// * regarding this software system or assume any liability for its *</span>
|
|---|
| 22 | 00015 <span class="comment">// * use. Please see the license in the file LICENSE and URL above *</span>
|
|---|
| 23 | 00016 <span class="comment">// * for the full disclaimer and the limitation of liability. *</span>
|
|---|
| 24 | 00017 <span class="comment">// * *</span>
|
|---|
| 25 | 00018 <span class="comment">// * This code implementation is the result of the scientific and *</span>
|
|---|
| 26 | 00019 <span class="comment">// * technical work of the GEANT4 collaboration. *</span>
|
|---|
| 27 | 00020 <span class="comment">// * By using, copying, modifying or distributing the software (or *</span>
|
|---|
| 28 | 00021 <span class="comment">// * any work based on the software) you agree to acknowledge its *</span>
|
|---|
| 29 | 00022 <span class="comment">// * use in resulting scientific publications, and indicate your *</span>
|
|---|
| 30 | 00023 <span class="comment">// * acceptance of all terms of the Geant4 Software license. *</span>
|
|---|
| 31 | 00024 <span class="comment">// ********************************************************************</span>
|
|---|
| 32 | 00025 <span class="comment">//</span>
|
|---|
| 33 | 00026 <span class="comment">//</span>
|
|---|
| 34 | 00027 <span class="comment">// $Id: G4UIGAG.cc,v 1.18 2006/06/29 19:09:23 gunter Exp $</span>
|
|---|
| 35 | 00028 <span class="comment">// GEANT4 tag $Name: geant4-08-01-patch-01 $</span>
|
|---|
| 36 | 00029 <span class="comment">//</span>
|
|---|
| 37 | 00030 <span class="comment">// G4UIGAG.cc</span>
|
|---|
| 38 | 00031 <span class="comment">// 18.Feb.98 M.Nagamatu and T.Kodama created G4UIGAG from G4UIterminal</span>
|
|---|
| 39 | 00032
|
|---|
| 40 | 00033 <span class="preprocessor">#include "<a class="code" href="G4UIGAG_8hh.html">G4UIGAG.hh</a>"</span>
|
|---|
| 41 | 00034 <span class="preprocessor">#include "G4StateManager.hh"</span>
|
|---|
| 42 | 00035 <span class="preprocessor">#include "G4UIcommandTree.hh"</span>
|
|---|
| 43 | 00036 <span class="preprocessor">#include "G4UIcommand.hh"</span>
|
|---|
| 44 | 00037 <span class="preprocessor">#include "G4UIcommandStatus.hh"</span>
|
|---|
| 45 | 00038 <span class="preprocessor">#include <sstream></span>
|
|---|
| 46 | 00039
|
|---|
| 47 | <a name="l00040"></a><a class="code" href="classG4UIGAG.html#a0">00040</a> <a class="code" href="classG4UIGAG.html#a0">G4UIGAG::G4UIGAG</a>()<span class="comment">//: TVersion("T1.0a"), JVersion("J1.0a")</span>
|
|---|
| 48 | 00041 {
|
|---|
| 49 | 00042 <a class="code" href="classG4UIGAG.html#r7">TVersion</a>=<span class="stringliteral">"T1.0a"</span>; <a class="code" href="classG4UIGAG.html#r6">JVersion</a>=<span class="stringliteral">"J1.0a"</span>;
|
|---|
| 50 | 00043 <span class="comment">//G4cout << "G4UIGAG: Apr15,98." << G4endl;</span>
|
|---|
| 51 | 00044 <a class="code" href="classG4UIGAG.html#r0">prefix</a> = <span class="stringliteral">"/"</span>;
|
|---|
| 52 | 00045 <a class="code" href="classG4UIGAG.html#r1">UI</a> = G4UImanager::GetUIpointer();
|
|---|
| 53 | 00046 <a class="code" href="classG4UIGAG.html#r1">UI</a>->SetSession(<span class="keyword">this</span>);
|
|---|
| 54 | 00047 <a class="code" href="classG4UIGAG.html#r1">UI</a>->SetCoutDestination(<span class="keyword">this</span>);
|
|---|
| 55 | 00048 G4StateManager * statM = G4StateManager::GetStateManager();
|
|---|
| 56 | 00049 <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> = statM->GetStateString(statM->GetCurrentState());
|
|---|
| 57 | 00050 <a class="code" href="classG4UIGAG.html#r5">uiMode</a> = <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a>; <span class="comment">// GAG</span>
|
|---|
| 58 | 00051 <a class="code" href="classG4UIGAG.html#r3">iExit</a> = <span class="keyword">false</span>;
|
|---|
| 59 | 00052 <a class="code" href="classG4UIGAG.html#r4">iCont</a> = <span class="keyword">false</span>;
|
|---|
| 60 | 00053 <span class="comment">// -- Initialize Notify routines begin</span>
|
|---|
| 61 | 00054 G4UIcommandTree * tree = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 62 | 00055 <a class="code" href="classG4UIGAG.html#d23">GetNewTreeStructure</a>(tree,0);
|
|---|
| 63 | 00056 <a class="code" href="classG4UIGAG.html#d24">GetNewTreeValues</a>(tree,0);
|
|---|
| 64 | 00057 <a class="code" href="classG4UIGAG.html#r8">previousTreeCommands</a> = <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>;
|
|---|
| 65 | 00058 <a class="code" href="classG4UIGAG.html#r10">previousTreeParams</a> = <a class="code" href="classG4UIGAG.html#r11">newTreeParams</a>;
|
|---|
| 66 | 00059 <a class="code" href="classG4UIGAG.html#r12">previousTreePCP</a> = <a class="code" href="classG4UIGAG.html#r13">newTreePCP</a>;
|
|---|
| 67 | 00060 <span class="comment">// -- end</span>
|
|---|
| 68 | 00061 }
|
|---|
| 69 | 00062
|
|---|
| 70 | <a name="l00063"></a><a class="code" href="classG4UIGAG.html#a1">00063</a> <a class="code" href="classG4UIGAG.html#a1">G4UIGAG::~G4UIGAG</a>()
|
|---|
| 71 | 00064 {
|
|---|
| 72 | 00065 <span class="keywordflow">if</span>( G4UImanager::GetUIpointer() != 0)
|
|---|
| 73 | 00066 {
|
|---|
| 74 | 00067 <a class="code" href="classG4UIGAG.html#r1">UI</a>->SetSession(NULL);
|
|---|
| 75 | 00068 <a class="code" href="classG4UIGAG.html#r1">UI</a>->SetCoutDestination(NULL);
|
|---|
| 76 | 00069 <span class="comment">// G4cout << "GAG session deleted" << G4endl;</span>
|
|---|
| 77 | 00070 }
|
|---|
| 78 | 00071 }
|
|---|
| 79 | 00072
|
|---|
| 80 | <a name="l00073"></a><a class="code" href="classG4UIGAG.html#a2">00073</a> G4UIsession * <a class="code" href="classG4UIGAG.html#a2">G4UIGAG::SessionStart</a>()
|
|---|
| 81 | 00074 {
|
|---|
| 82 | 00075 <a class="code" href="classG4UIGAG.html#r3">iExit</a> = <span class="keyword">true</span>;
|
|---|
| 83 | 00076 G4StateManager * statM = G4StateManager::GetStateManager();
|
|---|
| 84 | 00077 <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> = statM->GetStateString(statM->GetCurrentState());
|
|---|
| 85 | 00078 G4String newCommand = <a class="code" href="classG4UIGAG.html#a8">GetCommand</a>();
|
|---|
| 86 | 00079 <span class="keywordflow">while</span>( <a class="code" href="classG4UIGAG.html#r3">iExit</a> )
|
|---|
| 87 | 00080 {
|
|---|
| 88 | 00081 <a class="code" href="classG4UIGAG.html#d0">ExecuteCommand</a>(newCommand);
|
|---|
| 89 | 00082 <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> = statM->GetStateString(statM->GetCurrentState());
|
|---|
| 90 | 00083 newCommand = <a class="code" href="classG4UIGAG.html#a8">GetCommand</a>();
|
|---|
| 91 | 00084 }
|
|---|
| 92 | 00085 <span class="keywordflow">return</span> NULL;
|
|---|
| 93 | 00086 }
|
|---|
| 94 | 00087
|
|---|
| 95 | <a name="l00088"></a><a class="code" href="classG4UIGAG.html#a3">00088</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#a3">G4UIGAG::PauseSessionStart</a>(G4String msg)
|
|---|
| 96 | 00089 {
|
|---|
| 97 | 00090 <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> = msg;
|
|---|
| 98 | 00091 G4cout << <span class="stringliteral">"@@PROMPT \""</span> << <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> << <span class="stringliteral">"\""</span> << G4endl;
|
|---|
| 99 | 00092 <a class="code" href="classG4UIGAG.html#r4">iCont</a> = <span class="keyword">true</span>;
|
|---|
| 100 | 00093 G4String newCommand = <a class="code" href="classG4UIGAG.html#a8">GetCommand</a>();
|
|---|
| 101 | 00094 <span class="keywordflow">while</span>( <a class="code" href="classG4UIGAG.html#r4">iCont</a> )
|
|---|
| 102 | 00095 {
|
|---|
| 103 | 00096 <a class="code" href="classG4UIGAG.html#d0">ExecuteCommand</a>(newCommand);
|
|---|
| 104 | 00097 newCommand = <a class="code" href="classG4UIGAG.html#a8">GetCommand</a>();
|
|---|
| 105 | 00098 }
|
|---|
| 106 | 00099 }
|
|---|
| 107 | 00100
|
|---|
| 108 | <a name="l00101"></a><a class="code" href="classG4UIGAG.html#d0">00101</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d0">G4UIGAG::ExecuteCommand</a>(G4String aCommand)
|
|---|
| 109 | 00102 {
|
|---|
| 110 | 00103 G4UIcommandTree * tree = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 111 | 00104 <span class="keywordflow">if</span>(aCommand.length()<2) <span class="keywordflow">return</span>;
|
|---|
| 112 | 00105 G4int returnVal = <a class="code" href="classG4UIGAG.html#r1">UI</a>->ApplyCommand(aCommand);
|
|---|
| 113 | 00106 G4int paramIndex = returnVal % 100;
|
|---|
| 114 | 00107 G4int commandStatus = returnVal - paramIndex;
|
|---|
| 115 | 00108
|
|---|
| 116 | 00109 <a class="code" href="classG4UIGAG.html#d21">UpdateState</a>();
|
|---|
| 117 | 00110 <span class="keywordflow">if</span> ( <a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a>){
|
|---|
| 118 | 00111 <span class="keywordflow">switch</span>(commandStatus) {
|
|---|
| 119 | 00112 <span class="keywordflow">case</span> fCommandSucceeded:
|
|---|
| 120 | 00113 <span class="keywordflow">break</span>;
|
|---|
| 121 | 00114 <span class="keywordflow">case</span> fCommandNotFound:
|
|---|
| 122 | 00115 <span class="comment">// G4cerr << "command not found" << G4endl;</span>
|
|---|
| 123 | 00116 G4cerr << <span class="stringliteral">"command <"</span> << <a class="code" href="classG4UIGAG.html#r1">UI</a>->SolveAlias(aCommand) << <span class="stringliteral">"> not found"</span> << G4endl;
|
|---|
| 124 | 00117 <span class="keywordflow">break</span>;
|
|---|
| 125 | 00118 <span class="keywordflow">case</span> fIllegalApplicationState:
|
|---|
| 126 | 00119 G4cerr << <span class="stringliteral">"illegal application state -- command refused"</span> << G4endl;
|
|---|
| 127 | 00120 <span class="keywordflow">break</span>;
|
|---|
| 128 | 00121 <span class="keywordflow">case</span> fParameterOutOfRange:
|
|---|
| 129 | 00122 <span class="keywordflow">case</span> fParameterUnreadable:
|
|---|
| 130 | 00123 G4cerr << <span class="stringliteral">"Parameter is wrong type and/or is not omittable (index "</span> << paramIndex << <span class="stringliteral">")"</span> << G4endl;
|
|---|
| 131 | 00124 <span class="keywordflow">break</span>;
|
|---|
| 132 | 00125 <span class="keywordflow">case</span> fParameterOutOfCandidates:
|
|---|
| 133 | 00126 G4cerr << <span class="stringliteral">"Parameter is out of candidate list (index "</span> << paramIndex << <span class="stringliteral">")"</span> << G4endl;
|
|---|
| 134 | 00127 <span class="comment">// G4cerr << "Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates() << G4endl;</span>
|
|---|
| 135 | 00128 <span class="keywordflow">break</span>;
|
|---|
| 136 | 00129 <span class="keywordflow">case</span> fAliasNotFound:
|
|---|
| 137 | 00130 <span class="keywordflow">default</span>:
|
|---|
| 138 | 00131 G4cerr << <span class="stringliteral">"command refused ("</span> << commandStatus << <span class="stringliteral">")"</span> << G4endl;
|
|---|
| 139 | 00132 }
|
|---|
| 140 | 00133 }<span class="keywordflow">else</span>{
|
|---|
| 141 | 00134 <span class="keywordflow">switch</span>(commandStatus) {
|
|---|
| 142 | 00135 <span class="keywordflow">case</span> fCommandSucceeded:
|
|---|
| 143 | 00136 {
|
|---|
| 144 | 00137 <a class="code" href="classG4UIGAG.html#d23">GetNewTreeStructure</a>(tree,0);
|
|---|
| 145 | 00138 <a class="code" href="classG4UIGAG.html#d24">GetNewTreeValues</a>(tree,0);
|
|---|
| 146 | 00139 <span class="keywordflow">if</span> (<a class="code" href="classG4UIGAG.html#d20">CommandUpdated</a>()) {
|
|---|
| 147 | 00140 <a class="code" href="classG4UIGAG.html#d18">NotifyCommandUpdate</a>();
|
|---|
| 148 | 00141 } <span class="keywordflow">else</span> {
|
|---|
| 149 | 00142 <a class="code" href="classG4UIGAG.html#d22">UpdateParamVal</a>(); <span class="comment">// if param is updated, call notifyPara...</span>
|
|---|
| 150 | 00143 }
|
|---|
| 151 | 00144 <a class="code" href="classG4UIGAG.html#r8">previousTreeCommands</a> = <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>;
|
|---|
| 152 | 00145 <a class="code" href="classG4UIGAG.html#r10">previousTreeParams</a> = <a class="code" href="classG4UIGAG.html#r11">newTreeParams</a>;
|
|---|
| 153 | 00146 <a class="code" href="classG4UIGAG.html#r12">previousTreePCP</a> = <a class="code" href="classG4UIGAG.html#r13">newTreePCP</a>;
|
|---|
| 154 | 00147 }
|
|---|
| 155 | 00148 <span class="keywordflow">break</span>;
|
|---|
| 156 | 00149 <span class="keywordflow">case</span> fCommandNotFound:
|
|---|
| 157 | 00150 G4cout << <span class="stringliteral">"@@ErrResult \" <"</span> << <a class="code" href="classG4UIGAG.html#r1">UI</a>->SolveAlias(aCommand) << <span class="stringliteral">"> command not found.\""</span> << G4endl;
|
|---|
| 158 | 00151 <span class="keywordflow">break</span>;
|
|---|
| 159 | 00152 <span class="keywordflow">case</span> fIllegalApplicationState:
|
|---|
| 160 | 00153 G4cout << <span class="stringliteral">"@@ErrResult \"Illegal application state -- command refused\""</span> << G4endl;
|
|---|
| 161 | 00154 <span class="keywordflow">break</span>;
|
|---|
| 162 | 00155 <span class="keywordflow">case</span> fParameterOutOfRange:
|
|---|
| 163 | 00156 G4cout << <span class="stringliteral">"@@ErrResult \"Parameter Out of Range.\""</span> << G4endl;
|
|---|
| 164 | 00157 <span class="keywordflow">break</span>;
|
|---|
| 165 | 00158 <span class="keywordflow">case</span> fParameterUnreadable:
|
|---|
| 166 | 00159 G4cout << <span class="stringliteral">"@@ErrResult \"Parameter is wrong type and/or is not omittable.\""</span> << G4endl;
|
|---|
| 167 | 00160 <span class="keywordflow">break</span>;
|
|---|
| 168 | 00161 <span class="keywordflow">case</span> fParameterOutOfCandidates:
|
|---|
| 169 | 00162 <span class="comment">// G4cout << "@@ErrResult \"Parameter Out of Candidates. Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates()<< "\"" << G4endl;</span>
|
|---|
| 170 | 00163 G4cout << <span class="stringliteral">"@@ErrResult \"Parameter Out of Candidates.\""</span> << G4endl;
|
|---|
| 171 | 00164 <span class="keywordflow">break</span>;
|
|---|
| 172 | 00165 <span class="keywordflow">case</span> fAliasNotFound:
|
|---|
| 173 | 00166 <span class="keywordflow">default</span>:
|
|---|
| 174 | 00167 G4cout << <span class="stringliteral">"@@ErrResult \"command refused ("</span> << commandStatus << <span class="stringliteral">")\""</span> << G4endl;
|
|---|
| 175 | 00168 }
|
|---|
| 176 | 00169 }
|
|---|
| 177 | 00170 }
|
|---|
| 178 | 00171
|
|---|
| 179 | 00172
|
|---|
| 180 | <a name="l00173"></a><a class="code" href="classG4UIGAG.html#a4">00173</a> G4int <a class="code" href="classG4UIGAG.html#a4">G4UIGAG::ReceiveG4cout</a>(G4String coutString)
|
|---|
| 181 | 00174 {
|
|---|
| 182 | 00175 std::cout << coutString << std::flush;
|
|---|
| 183 | 00176 <span class="keywordflow">return</span> 0;
|
|---|
| 184 | 00177 }
|
|---|
| 185 | 00178
|
|---|
| 186 | <a name="l00179"></a><a class="code" href="classG4UIGAG.html#a5">00179</a> G4int <a class="code" href="classG4UIGAG.html#a5">G4UIGAG::ReceiveG4cerr</a>(G4String cerrString)
|
|---|
| 187 | 00180 {
|
|---|
| 188 | 00181 std::cerr << cerrString << std::flush;
|
|---|
| 189 | 00182 <span class="keywordflow">return</span> 0;
|
|---|
| 190 | 00183 }
|
|---|
| 191 | 00184
|
|---|
| 192 | <a name="l00185"></a><a class="code" href="classG4UIGAG.html#a7">00185</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#a7">G4UIGAG::Prompt</a>(G4String aPrompt)
|
|---|
| 193 | 00186 {
|
|---|
| 194 | 00187 <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> = aPrompt;
|
|---|
| 195 | 00188 }
|
|---|
| 196 | 00189
|
|---|
| 197 | <a name="l00190"></a><a class="code" href="classG4UIGAG.html#a8">00190</a> G4String <a class="code" href="classG4UIGAG.html#a8">G4UIGAG::GetCommand</a>()
|
|---|
| 198 | 00191 {
|
|---|
| 199 | 00192 G4String newCommand;
|
|---|
| 200 | 00193 G4String nullString;
|
|---|
| 201 | 00194 <span class="keywordflow">while</span>( 1 )
|
|---|
| 202 | 00195 {
|
|---|
| 203 | 00196 G4UIcommandTree* tree = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 204 | 00197 <span class="keywordflow">if</span> ( <a class="code" href="classG4UIGAG.html#r5">uiMode</a> != <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a> ){
|
|---|
| 205 | 00198 G4cout << <span class="stringliteral">"@@PROMPT \""</span> << <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> << <span class="stringliteral">"\""</span> << G4endl;
|
|---|
| 206 | 00199 }
|
|---|
| 207 | 00200 <span class="keywordflow">if</span> ( <a class="code" href="classG4UIGAG.html#r5">uiMode</a> != <a class="code" href="G4UIGAG_8hh.html#a7a1">java_mode</a> ){
|
|---|
| 208 | 00201 G4cout << <a class="code" href="classG4UIGAG.html#r2">promptCharacter</a> << <span class="stringliteral">"> "</span> << std::flush;
|
|---|
| 209 | 00202 }<span class="keywordflow">else</span>{
|
|---|
| 210 | 00203 G4cout << <span class="stringliteral">"@@Ready"</span> << G4endl;
|
|---|
| 211 | 00204 }
|
|---|
| 212 | 00205 newCommand.readLine( G4cin, FALSE );
|
|---|
| 213 | 00206 <span class="keywordflow">if</span> (!G4cin.good()) { G4cin.clear(); newCommand = nullString; <a class="code" href="classG4UIGAG.html#r3">iExit</a>=<span class="keyword">false</span>;<span class="keywordflow">break</span>;}
|
|---|
| 214 | 00207
|
|---|
| 215 | 00208 newCommand = newCommand.strip(G4String::leading);
|
|---|
| 216 | 00209 <span class="keywordflow">if</span>( newCommand.length() < 1) { <span class="keywordflow">break</span>; }
|
|---|
| 217 | 00210
|
|---|
| 218 | 00211 <span class="keywordflow">while</span>( newCommand(newCommand.length()-1) == <span class="charliteral">'_'</span> )
|
|---|
| 219 | 00212 {
|
|---|
| 220 | 00213 G4String newLine;
|
|---|
| 221 | 00214 newCommand.remove(newCommand.length()-1);
|
|---|
| 222 | 00215 newLine.readLine( G4cin );
|
|---|
| 223 | 00216 <span class="keywordflow">if</span> (!G4cin.good()) { G4cin.clear(); newCommand = nullString; <a class="code" href="classG4UIGAG.html#r3">iExit</a>=<span class="keyword">false</span>;<span class="keywordflow">break</span>;}
|
|---|
| 224 | 00217 newCommand.append(newLine);
|
|---|
| 225 | 00218 }
|
|---|
| 226 | 00219
|
|---|
| 227 | 00220 G4String nC = newCommand.strip(G4String::leading);
|
|---|
| 228 | 00221 <span class="keywordflow">if</span>( nC.length() < 1) { <span class="keywordflow">break</span>; }
|
|---|
| 229 | 00222
|
|---|
| 230 | 00223 <span class="comment">// -------------------- nC.toUpper();</span>
|
|---|
| 231 | 00224 <span class="keywordflow">if</span>( nC == <span class="stringliteral">"@@GAGmodeJAVA"</span> ) {
|
|---|
| 232 | 00225 <a class="code" href="classG4UIGAG.html#r5">uiMode</a> = <a class="code" href="G4UIGAG_8hh.html#a7a1">java_mode</a>;
|
|---|
| 233 | 00226 G4cout << G4endl << <span class="stringliteral">"@@Version "</span> << <a class="code" href="classG4UIGAG.html#r6">JVersion</a> << G4endl;
|
|---|
| 234 | 00227 <a class="code" href="classG4UIGAG.html#d8">SendCommandProperties</a>(tree);
|
|---|
| 235 | 00228 <a class="code" href="classG4UIGAG.html#d17">NotifyStateChange</a>();
|
|---|
| 236 | 00229 }
|
|---|
| 237 | 00230 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC == <span class="stringliteral">"@@GAGmodeTcl"</span> ) {
|
|---|
| 238 | 00231 <a class="code" href="classG4UIGAG.html#r5">uiMode</a> = <a class="code" href="G4UIGAG_8hh.html#a7a2">tcl_mode</a>;
|
|---|
| 239 | 00232 G4cout << G4endl << <span class="stringliteral">"@@Version "</span> << <a class="code" href="classG4UIGAG.html#r7">TVersion</a> << G4endl;
|
|---|
| 240 | 00233 <a class="code" href="classG4UIGAG.html#d8">SendCommandProperties</a>(tree);
|
|---|
| 241 | 00234 <a class="code" href="classG4UIGAG.html#d17">NotifyStateChange</a>();
|
|---|
| 242 | 00235 }
|
|---|
| 243 | 00236 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC(0) == <span class="charliteral">'#'</span> )
|
|---|
| 244 | 00237 { G4cout << nC << G4endl; }
|
|---|
| 245 | 00238
|
|---|
| 246 | 00239 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC == <span class="stringliteral">"ls"</span> || nC(0,3) == <span class="stringliteral">"ls "</span> )
|
|---|
| 247 | 00240 { <a class="code" href="classG4UIGAG.html#d2">ListDirectory</a>( nC ); }
|
|---|
| 248 | 00241 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC == <span class="stringliteral">"pwd"</span> )
|
|---|
| 249 | 00242 { G4cout << <span class="stringliteral">"Current Working Directory : "</span> << <a class="code" href="classG4UIGAG.html#r0">prefix</a> << G4endl; }
|
|---|
| 250 | 00243 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC(0,2) == <span class="stringliteral">"cd"</span> || nC(0,3) == <span class="stringliteral">"cd "</span> )
|
|---|
| 251 | 00244 { <a class="code" href="classG4UIGAG.html#d1">ChangeDirectory</a>( nC ); }
|
|---|
| 252 | 00245 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC == <span class="stringliteral">"help"</span> || nC(0,5) == <span class="stringliteral">"help "</span>)
|
|---|
| 253 | 00246 { <a class="code" href="classG4UIGAG.html#d3">TerminalHelp</a>( nC ); }
|
|---|
| 254 | 00247 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC(0) == <span class="charliteral">'?'</span> )
|
|---|
| 255 | 00248 { <a class="code" href="classG4UIGAG.html#d6">ShowCurrent</a>( nC ); }
|
|---|
| 256 | 00249 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC(0,4) == <span class="stringliteral">"hist"</span> || nC == <span class="stringliteral">"history"</span>)
|
|---|
| 257 | 00250 {
|
|---|
| 258 | 00251 G4int nh = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetNumberOfHistory();
|
|---|
| 259 | 00252 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<nh;i++)
|
|---|
| 260 | 00253 { G4cout << i << <span class="stringliteral">": "</span> << <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetPreviousCommand(i) << G4endl; }
|
|---|
| 261 | 00254 }
|
|---|
| 262 | 00255 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC(0) == <span class="charliteral">'!'</span> )
|
|---|
| 263 | 00256 {
|
|---|
| 264 | 00257 G4String ss = nC(1,nC.length()-1);
|
|---|
| 265 | 00258 G4int vl;
|
|---|
| 266 | 00259 <span class="keyword">const</span> <span class="keywordtype">char</span>* tt = ss;
|
|---|
| 267 | 00260 std::istringstream is((<span class="keywordtype">char</span>*)tt);
|
|---|
| 268 | 00261 is >> vl;
|
|---|
| 269 | 00262 G4int nh = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetNumberOfHistory();
|
|---|
| 270 | 00263 <span class="keywordflow">if</span>(vl>=0 && vl<nh)
|
|---|
| 271 | 00264 {
|
|---|
| 272 | 00265 newCommand = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetPreviousCommand(vl);
|
|---|
| 273 | 00266 G4cout << newCommand << G4endl;
|
|---|
| 274 | 00267 <span class="keywordflow">break</span>;
|
|---|
| 275 | 00268 }
|
|---|
| 276 | 00269 <span class="keywordflow">else</span>
|
|---|
| 277 | 00270 { G4cerr << <span class="stringliteral">"history "</span> << vl << <span class="stringliteral">" is not found."</span> << G4endl; }
|
|---|
| 278 | 00271 }
|
|---|
| 279 | 00272 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC(0,4) == <span class="stringliteral">"exit"</span> )
|
|---|
| 280 | 00273 {
|
|---|
| 281 | 00274 <span class="keywordflow">if</span>( <a class="code" href="classG4UIGAG.html#r4">iCont</a> )
|
|---|
| 282 | 00275 {
|
|---|
| 283 | 00276 <span class="keywordflow">if</span> ( <a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a>){
|
|---|
| 284 | 00277 G4cerr << <span class="stringliteral">"You are now processing RUN."</span> << G4endl;
|
|---|
| 285 | 00278 G4cerr << <span class="stringliteral">"Please abrot it using \"/run/abort\" command first"</span> << G4endl;
|
|---|
| 286 | 00279 G4cerr << <span class="stringliteral">" and use \"continue\" command until the application"</span> << G4endl;
|
|---|
| 287 | 00280 G4cerr << <span class="stringliteral">" becomes to Idle."</span> << G4endl;
|
|---|
| 288 | 00281 }<span class="keywordflow">else</span>{
|
|---|
| 289 | 00282 G4cout << <span class="stringliteral">"@@ErrResult \"You are now processing RUN.\""</span> << G4endl;
|
|---|
| 290 | 00283 }
|
|---|
| 291 | 00284 }
|
|---|
| 292 | 00285 <span class="keywordflow">else</span>
|
|---|
| 293 | 00286 {
|
|---|
| 294 | 00287 <a class="code" href="classG4UIGAG.html#r3">iExit</a> = <span class="keyword">false</span>;
|
|---|
| 295 | 00288 newCommand = nullString;
|
|---|
| 296 | 00289 <span class="keywordflow">break</span>;
|
|---|
| 297 | 00290 }
|
|---|
| 298 | 00291 }
|
|---|
| 299 | 00292 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( nC == <span class="stringliteral">"cont"</span> || nC == <span class="stringliteral">"continue"</span> )
|
|---|
| 300 | 00293 {
|
|---|
| 301 | 00294 <a class="code" href="classG4UIGAG.html#r4">iCont</a> = <span class="keyword">false</span>;
|
|---|
| 302 | 00295 newCommand = nullString;
|
|---|
| 303 | 00296 <span class="keywordflow">break</span>;
|
|---|
| 304 | 00297 }
|
|---|
| 305 | 00298 <span class="keywordflow">else</span>
|
|---|
| 306 | 00299 { <span class="keywordflow">break</span>; }
|
|---|
| 307 | 00300 }
|
|---|
| 308 | 00301 <span class="keywordflow">return</span> <a class="code" href="classG4UIGAG.html#d7">GetFullPath</a>(newCommand);
|
|---|
| 309 | 00302 }
|
|---|
| 310 | 00303
|
|---|
| 311 | <a name="l00304"></a><a class="code" href="classG4UIGAG.html#d7">00304</a> G4String <a class="code" href="classG4UIGAG.html#d7">G4UIGAG::GetFullPath</a>( G4String aNewCommand )
|
|---|
| 312 | 00305 {
|
|---|
| 313 | 00306 G4String newCommand = aNewCommand.strip(G4String::both);
|
|---|
| 314 | 00307 G4String tmpString;
|
|---|
| 315 | 00308 <span class="keywordflow">if</span>( newCommand(0) == <span class="charliteral">'/'</span> )
|
|---|
| 316 | 00309 { tmpString = newCommand; }
|
|---|
| 317 | 00310 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( newCommand(0,3) == <span class="stringliteral">"../"</span> )
|
|---|
| 318 | 00311 {
|
|---|
| 319 | 00312 G4String tmpPrefix = <a class="code" href="classG4UIGAG.html#r0">prefix</a>;
|
|---|
| 320 | 00313 <span class="comment">/*G4int*/</span> <span class="keywordtype">unsigned</span> i_direc = 0;
|
|---|
| 321 | 00314 <span class="keywordflow">while</span>( i_direc < newCommand.length() )
|
|---|
| 322 | 00315 {
|
|---|
| 323 | 00316 <span class="keywordflow">if</span>( newCommand(i_direc,3) == <span class="stringliteral">"../"</span> )
|
|---|
| 324 | 00317 {
|
|---|
| 325 | 00318 i_direc += 3;
|
|---|
| 326 | 00319 prefix = <a class="code" href="classG4UIGAG.html#d4">ModifyPrefix</a>( G4String(<span class="stringliteral">"../"</span>) );
|
|---|
| 327 | 00320 }
|
|---|
| 328 | 00321 <span class="keywordflow">else</span>
|
|---|
| 329 | 00322 { <span class="keywordflow">break</span>; }
|
|---|
| 330 | 00323 }
|
|---|
| 331 | 00324 tmpString = prefix;
|
|---|
| 332 | 00325 tmpString.append( newCommand( i_direc, newCommand.length()-i_direc ) );
|
|---|
| 333 | 00326 prefix = tmpPrefix;
|
|---|
| 334 | 00327 }
|
|---|
| 335 | 00328 <span class="keywordflow">else</span>
|
|---|
| 336 | 00329 {
|
|---|
| 337 | 00330 tmpString = <a class="code" href="classG4UIGAG.html#r0">prefix</a>;
|
|---|
| 338 | 00331 tmpString.append( newCommand );
|
|---|
| 339 | 00332 }
|
|---|
| 340 | 00333 <span class="keywordflow">return</span> tmpString;
|
|---|
| 341 | 00334 }
|
|---|
| 342 | 00335
|
|---|
| 343 | <a name="l00336"></a><a class="code" href="classG4UIGAG.html#a6">00336</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#a6">G4UIGAG::SessionTerminate</a>()
|
|---|
| 344 | 00337 {
|
|---|
| 345 | 00338 G4cout << <span class="stringliteral">"***** Terminal session end *****"</span> << G4endl;
|
|---|
| 346 | 00339 }
|
|---|
| 347 | 00340
|
|---|
| 348 | <a name="l00341"></a><a class="code" href="classG4UIGAG.html#d6">00341</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d6">G4UIGAG::ShowCurrent</a>( G4String newCommand )
|
|---|
| 349 | 00342 {
|
|---|
| 350 | 00343 G4String theCommand = <a class="code" href="classG4UIGAG.html#d7">GetFullPath</a>(newCommand(1,newCommand.length()-1));
|
|---|
| 351 | 00344 G4String curV = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetCurrentValues(theCommand);
|
|---|
| 352 | 00345 <span class="keywordflow">if</span>( ! (curV.isNull()||curV(0)==<span class="charliteral">'\0'</span> ) ) {
|
|---|
| 353 | 00346 <span class="keywordflow">if</span> (<a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a>){
|
|---|
| 354 | 00347 G4cout << <span class="stringliteral">"Current value(s) of the parameter(s) : "</span> << curV << G4endl;
|
|---|
| 355 | 00348 }<span class="keywordflow">else</span>{
|
|---|
| 356 | 00349 G4cout << <span class="stringliteral">"@@CurrentValue "</span> << curV << G4endl;
|
|---|
| 357 | 00350 }
|
|---|
| 358 | 00351 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a>){
|
|---|
| 359 | 00352 G4cout << <span class="stringliteral">"Current value is not available."</span> << G4endl;
|
|---|
| 360 | 00353 } <span class="keywordflow">else</span> {
|
|---|
| 361 | 00354 G4cout << <span class="stringliteral">"@@ErrResult \"Current value is not available.\""</span> << G4endl;
|
|---|
| 362 | 00355 }
|
|---|
| 363 | 00356 }
|
|---|
| 364 | 00357
|
|---|
| 365 | <a name="l00358"></a><a class="code" href="classG4UIGAG.html#d1">00358</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d1">G4UIGAG::ChangeDirectory</a>( G4String newCommand )
|
|---|
| 366 | 00359 {
|
|---|
| 367 | 00360 G4String savedPrefix = <a class="code" href="classG4UIGAG.html#r0">prefix</a>;
|
|---|
| 368 | 00361 <span class="keywordflow">if</span>( newCommand.length() <= 3 )
|
|---|
| 369 | 00362 { prefix = <span class="stringliteral">"/"</span>; }
|
|---|
| 370 | 00363 <span class="keywordflow">else</span>
|
|---|
| 371 | 00364 {
|
|---|
| 372 | 00365 G4String aNewPrefix = newCommand(3,newCommand.length()-3);
|
|---|
| 373 | 00366 G4String newPrefix = aNewPrefix.strip(G4String::both);
|
|---|
| 374 | 00367 <span class="keywordflow">if</span>( newPrefix(0) == <span class="charliteral">'/'</span> )
|
|---|
| 375 | 00368 { prefix = newPrefix; }
|
|---|
| 376 | 00369 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( newPrefix(0) != <span class="charliteral">'.'</span> )
|
|---|
| 377 | 00370 {
|
|---|
| 378 | 00371 prefix += newPrefix;
|
|---|
| 379 | 00372 }
|
|---|
| 380 | 00373 <span class="keywordflow">else</span>
|
|---|
| 381 | 00374 { prefix = <a class="code" href="classG4UIGAG.html#d4">ModifyPrefix</a>( newPrefix ); }
|
|---|
| 382 | 00375 }
|
|---|
| 383 | 00376 <span class="keywordflow">if</span>( <a class="code" href="classG4UIGAG.html#r0">prefix</a>( prefix.length() - 1 ) != <span class="charliteral">'/'</span> )
|
|---|
| 384 | 00377 { prefix += <span class="stringliteral">"/"</span>; }
|
|---|
| 385 | 00378 <span class="keywordflow">if</span>( <a class="code" href="classG4UIGAG.html#d5">FindDirPath</a>( prefix ) == NULL )
|
|---|
| 386 | 00379 {
|
|---|
| 387 | 00380 G4cout << <span class="stringliteral">"Directory <"</span> << prefix << <span class="stringliteral">"> is not found."</span> << G4endl;
|
|---|
| 388 | 00381 prefix = savedPrefix;
|
|---|
| 389 | 00382 }
|
|---|
| 390 | 00383 }
|
|---|
| 391 | 00384
|
|---|
| 392 | <a name="l00385"></a><a class="code" href="classG4UIGAG.html#d2">00385</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d2">G4UIGAG::ListDirectory</a>( G4String newCommand )
|
|---|
| 393 | 00386 {
|
|---|
| 394 | 00387 G4String targetDir(<span class="charliteral">'\0'</span>);
|
|---|
| 395 | 00388 <span class="keywordflow">if</span>( newCommand.length() <= 3 )
|
|---|
| 396 | 00389 { targetDir = <a class="code" href="classG4UIGAG.html#r0">prefix</a>; }
|
|---|
| 397 | 00390 <span class="keywordflow">else</span>
|
|---|
| 398 | 00391 {
|
|---|
| 399 | 00392 G4String newPrefix = newCommand(3,newCommand.length()-3);
|
|---|
| 400 | 00393 newPrefix.strip(G4String::both);
|
|---|
| 401 | 00394 <span class="keywordflow">if</span>( newPrefix(0) == <span class="charliteral">'/'</span> )
|
|---|
| 402 | 00395 { targetDir = newPrefix; }
|
|---|
| 403 | 00396 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( newPrefix(0) != <span class="charliteral">'.'</span> )
|
|---|
| 404 | 00397 {
|
|---|
| 405 | 00398 targetDir = <a class="code" href="classG4UIGAG.html#r0">prefix</a>;
|
|---|
| 406 | 00399 targetDir += newPrefix;
|
|---|
| 407 | 00400 }
|
|---|
| 408 | 00401 <span class="keywordflow">else</span>
|
|---|
| 409 | 00402 { targetDir = <a class="code" href="classG4UIGAG.html#d4">ModifyPrefix</a>( newPrefix ); }
|
|---|
| 410 | 00403 }
|
|---|
| 411 | 00404 <span class="keywordflow">if</span>( targetDir( targetDir.length() - 1 ) != <span class="charliteral">'/'</span> )
|
|---|
| 412 | 00405 { targetDir += <span class="stringliteral">"/"</span>; }
|
|---|
| 413 | 00406 G4UIcommandTree * commandTree = <a class="code" href="classG4UIGAG.html#d5">FindDirPath</a>( targetDir );
|
|---|
| 414 | 00407 <span class="keywordflow">if</span>( commandTree == NULL )
|
|---|
| 415 | 00408 { G4cout << <span class="stringliteral">"Directory <"</span> << targetDir << <span class="stringliteral">"> is not found."</span> << G4endl; }
|
|---|
| 416 | 00409 <span class="keywordflow">else</span>
|
|---|
| 417 | 00410 { commandTree->ListCurrent(); }
|
|---|
| 418 | 00411 }
|
|---|
| 419 | 00412
|
|---|
| 420 | <a name="l00413"></a><a class="code" href="classG4UIGAG.html#d3">00413</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d3">G4UIGAG::TerminalHelp</a>(G4String newCommand)
|
|---|
| 421 | 00414 {
|
|---|
| 422 | 00415 G4UIcommandTree * treeTop = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 423 | 00416 <span class="comment">/*int*/</span><span class="keywordtype">unsigned</span> i = newCommand.index(<span class="stringliteral">" "</span>);
|
|---|
| 424 | 00417 <span class="keywordflow">if</span>( i != std::string::npos )
|
|---|
| 425 | 00418 {
|
|---|
| 426 | 00419 G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
|
|---|
| 427 | 00420 newValue.strip(G4String::both);
|
|---|
| 428 | 00421 <span class="keywordflow">if</span>( newValue(0) != <span class="charliteral">'/'</span> )
|
|---|
| 429 | 00422 { newValue.prepend( <a class="code" href="classG4UIGAG.html#r0">prefix</a> ); }
|
|---|
| 430 | 00423 G4UIcommand * theCommand = treeTop->FindPath( newValue );
|
|---|
| 431 | 00424 <span class="keywordflow">if</span>( theCommand != NULL )
|
|---|
| 432 | 00425 {
|
|---|
| 433 | 00426 theCommand->List();
|
|---|
| 434 | 00427 <span class="keywordflow">return</span>;
|
|---|
| 435 | 00428 }
|
|---|
| 436 | 00429 <span class="keywordflow">else</span>
|
|---|
| 437 | 00430 {
|
|---|
| 438 | 00431 G4cout << <span class="stringliteral">"Command <"</span> << newValue << <span class="stringliteral">" is not found."</span> << G4endl;
|
|---|
| 439 | 00432 <span class="keywordflow">return</span>;
|
|---|
| 440 | 00433 }
|
|---|
| 441 | 00434 }
|
|---|
| 442 | 00435
|
|---|
| 443 | 00436 G4UIcommandTree * floor[10];
|
|---|
| 444 | 00437 floor[0] = treeTop;
|
|---|
| 445 | 00438 <span class="keywordtype">int</span> iFloor = 0;
|
|---|
| 446 | 00439 <span class="comment">/*int*/</span> <span class="keywordtype">unsigned</span> prefixIndex = 1;
|
|---|
| 447 | 00440 <span class="keywordflow">while</span>( prefixIndex < <a class="code" href="classG4UIGAG.html#r0">prefix</a>.length()-1 )
|
|---|
| 448 | 00441 {
|
|---|
| 449 | 00442 <span class="keywordtype">int</span> ii = <a class="code" href="classG4UIGAG.html#r0">prefix</a>.index(<span class="stringliteral">"/"</span>,prefixIndex);
|
|---|
| 450 | 00443 floor[iFloor+1] =
|
|---|
| 451 | 00444 floor[iFloor]->GetTree(G4String(<a class="code" href="classG4UIGAG.html#r0">prefix</a>(0,ii+1)));
|
|---|
| 452 | 00445 prefixIndex = ii+1;
|
|---|
| 453 | 00446 iFloor++;
|
|---|
| 454 | 00447 }
|
|---|
| 455 | 00448 floor[iFloor]->ListCurrentWithNum();
|
|---|
| 456 | 00449 <span class="comment">// 1998 Oct 2 non-number input</span>
|
|---|
| 457 | 00450 <span class="keywordflow">while</span>(1){
|
|---|
| 458 | 00451 <span class="keywordtype">int</span> i;
|
|---|
| 459 | 00452 G4cout << G4endl << <span class="stringliteral">"Type the number ( 0:end, -n:n level back ) : "</span><<std::flush;
|
|---|
| 460 | 00453 G4cin >> i;
|
|---|
| 461 | 00454 <span class="keywordflow">if</span>(!G4cin.good()){
|
|---|
| 462 | 00455 G4cin.clear();
|
|---|
| 463 | 00456 G4cin.ignore(30,<span class="charliteral">'\n'</span>);
|
|---|
| 464 | 00457 G4cout << G4endl << <span class="stringliteral">"Not a number, once more"</span> << G4endl; <span class="keywordflow">continue</span>;}
|
|---|
| 465 | 00458 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( i < 0 ){
|
|---|
| 466 | 00459 iFloor += i;
|
|---|
| 467 | 00460 <span class="keywordflow">if</span>( iFloor < 0 ) iFloor = 0;
|
|---|
| 468 | 00461 floor[iFloor]->ListCurrentWithNum(); <span class="keywordflow">continue</span>;}
|
|---|
| 469 | 00462 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(i == 0) { <span class="keywordflow">break</span>;}
|
|---|
| 470 | 00463 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( i > 0 ) {
|
|---|
| 471 | 00464 <span class="keywordtype">int</span> n_tree = floor[iFloor]->GetTreeEntry();
|
|---|
| 472 | 00465 <span class="keywordflow">if</span>( i > n_tree )
|
|---|
| 473 | 00466 {
|
|---|
| 474 | 00467 <span class="keywordflow">if</span>( i <= n_tree + floor[iFloor]->GetCommandEntry() )
|
|---|
| 475 | 00468 {
|
|---|
| 476 | 00469 floor[iFloor]->GetCommand(i-n_tree)->List();
|
|---|
| 477 | 00470 <span class="comment">//iFloor++;</span>
|
|---|
| 478 | 00471 }
|
|---|
| 479 | 00472 }
|
|---|
| 480 | 00473 <span class="keywordflow">else</span>
|
|---|
| 481 | 00474 {
|
|---|
| 482 | 00475 floor[iFloor+1] = floor[iFloor]->GetTree(i);
|
|---|
| 483 | 00476 iFloor++;
|
|---|
| 484 | 00477 floor[iFloor]->ListCurrentWithNum();
|
|---|
| 485 | 00478 }
|
|---|
| 486 | 00479 }
|
|---|
| 487 | 00480
|
|---|
| 488 | 00481 }
|
|---|
| 489 | 00482 G4cout << <span class="stringliteral">"Exit from HELP."</span> << G4endl << G4endl;
|
|---|
| 490 | 00483 G4cout << G4endl;
|
|---|
| 491 | 00484 <span class="comment">// G4cin.flush();</span>
|
|---|
| 492 | 00485 <span class="keywordtype">char</span> temp[100];
|
|---|
| 493 | 00486 G4cin.getline( temp, 100 );
|
|---|
| 494 | 00487 }
|
|---|
| 495 | 00488
|
|---|
| 496 | 00489
|
|---|
| 497 | 00490
|
|---|
| 498 | 00491
|
|---|
| 499 | 00492
|
|---|
| 500 | 00493
|
|---|
| 501 | 00494
|
|---|
| 502 | <a name="l00495"></a><a class="code" href="classG4UIGAG.html#d4">00495</a> G4String <a class="code" href="classG4UIGAG.html#d4">G4UIGAG::ModifyPrefix</a>(G4String newCommand)
|
|---|
| 503 | 00496 {
|
|---|
| 504 | 00497 G4String newPrefix = <a class="code" href="classG4UIGAG.html#r0">prefix</a>;
|
|---|
| 505 | 00498 <span class="keywordflow">while</span>( 1 )
|
|---|
| 506 | 00499 {
|
|---|
| 507 | 00500 <span class="keywordflow">if</span>( newCommand(0,2) == <span class="stringliteral">".."</span> )
|
|---|
| 508 | 00501 {
|
|---|
| 509 | 00502 <span class="keywordflow">if</span>( newPrefix != <span class="stringliteral">"/"</span> )
|
|---|
| 510 | 00503 {
|
|---|
| 511 | 00504 G4String tmpString = newPrefix(0,newPrefix.length()-1);
|
|---|
| 512 | 00505 newPrefix = newPrefix(0,tmpString.last(<span class="charliteral">'/'</span>)+1);
|
|---|
| 513 | 00506 }
|
|---|
| 514 | 00507 }
|
|---|
| 515 | 00508 <span class="keywordflow">else</span>
|
|---|
| 516 | 00509 {
|
|---|
| 517 | 00510 newPrefix += newCommand;
|
|---|
| 518 | 00511 <span class="keywordflow">break</span>;
|
|---|
| 519 | 00512 }
|
|---|
| 520 | 00513 <span class="keywordflow">if</span>( newCommand == <span class="stringliteral">".."</span> || newCommand == <span class="stringliteral">"../"</span> )
|
|---|
| 521 | 00514 { <span class="keywordflow">break</span>; }
|
|---|
| 522 | 00515 newCommand = newCommand(3,newCommand.length()-3);
|
|---|
| 523 | 00516 }
|
|---|
| 524 | 00517 <span class="keywordflow">return</span> newPrefix;
|
|---|
| 525 | 00518 }
|
|---|
| 526 | 00519
|
|---|
| 527 | <a name="l00520"></a><a class="code" href="classG4UIGAG.html#d5">00520</a> G4UIcommandTree * <a class="code" href="classG4UIGAG.html#d5">G4UIGAG::FindDirPath</a>(G4String newCommand)
|
|---|
| 528 | 00521 {
|
|---|
| 529 | 00522 G4UIcommandTree * comTree = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 530 | 00523 <span class="comment">/*int*/</span> <span class="keywordtype">unsigned</span> idx = 1;
|
|---|
| 531 | 00524 <span class="keywordflow">while</span>( idx < newCommand.length()-1 )
|
|---|
| 532 | 00525 {
|
|---|
| 533 | 00526 <span class="keywordtype">int</span> i = newCommand.index(<span class="stringliteral">"/"</span>,idx);
|
|---|
| 534 | 00527 comTree = comTree->GetTree(G4String(newCommand(0,i+1)));
|
|---|
| 535 | 00528 <span class="keywordflow">if</span>( comTree == NULL )
|
|---|
| 536 | 00529 { <span class="keywordflow">return</span> NULL; }
|
|---|
| 537 | 00530 idx = i+1;
|
|---|
| 538 | 00531 }
|
|---|
| 539 | 00532 <span class="keywordflow">return</span> comTree;
|
|---|
| 540 | 00533 }
|
|---|
| 541 | 00534
|
|---|
| 542 | 00535 <span class="comment">// ----- for JAVA GAG (by T.Kodama)</span>
|
|---|
| 543 | 00536
|
|---|
| 544 | <a name="l00537"></a><a class="code" href="classG4UIGAG.html#d8">00537</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d8">G4UIGAG::SendCommandProperties</a>(G4UIcommandTree * tree)
|
|---|
| 545 | 00538 {
|
|---|
| 546 | 00539 <span class="keywordflow">if</span>( tree == NULL ) {
|
|---|
| 547 | 00540 G4cerr << <span class="stringliteral">"GetTree() returnes null."</span> << G4endl;
|
|---|
| 548 | 00541 <span class="keywordflow">return</span>;
|
|---|
| 549 | 00542 }
|
|---|
| 550 | 00543 <span class="keywordflow">if</span> (<a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a1">java_mode</a>){
|
|---|
| 551 | 00544 G4cout << <span class="stringliteral">"@@JTreeBegin"</span> << G4endl;
|
|---|
| 552 | 00545 <a class="code" href="classG4UIGAG.html#d12">CodeGenJavaTree</a>(tree, 0);
|
|---|
| 553 | 00546 G4cout << <span class="stringliteral">"@@JTreeEnd"</span> << G4endl;
|
|---|
| 554 | 00547 <a class="code" href="classG4UIGAG.html#d13">CodeGenJavaParams</a>(tree, 0);
|
|---|
| 555 | 00548 }<span class="keywordflow">else</span>{
|
|---|
| 556 | 00549 G4cout << G4endl << <span class="stringliteral">"@@maketree_start"</span> << G4endl;
|
|---|
| 557 | 00550 <a class="code" href="classG4UIGAG.html#d14">CodeGenTclTree</a>(tree,0);
|
|---|
| 558 | 00551 G4cout << <span class="stringliteral">"@@maketree_end"</span> << G4endl;
|
|---|
| 559 | 00552 <a class="code" href="classG4UIGAG.html#d15">CodeGenTclParams</a>(tree, 0);
|
|---|
| 560 | 00553 }
|
|---|
| 561 | 00554 }
|
|---|
| 562 | <a name="l00555"></a><a class="code" href="classG4UIGAG.html#d9">00555</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d9">G4UIGAG::SendParameterProperties</a>(G4UIcommandTree * tree)
|
|---|
| 563 | 00556 {
|
|---|
| 564 | 00557 <span class="keywordflow">if</span>( tree == NULL ) {
|
|---|
| 565 | 00558 G4cerr << <span class="stringliteral">"GetTree() returnes null."</span> << G4endl;
|
|---|
| 566 | 00559 <span class="keywordflow">return</span>;
|
|---|
| 567 | 00560 }
|
|---|
| 568 | 00561 <span class="keywordflow">if</span> (<a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a1">java_mode</a>){
|
|---|
| 569 | 00562 <a class="code" href="classG4UIGAG.html#d13">CodeGenJavaParams</a>(tree, 0);
|
|---|
| 570 | 00563 }<span class="keywordflow">else</span>{
|
|---|
| 571 | 00564 <a class="code" href="classG4UIGAG.html#d15">CodeGenTclParams</a>(tree, 0);
|
|---|
| 572 | 00565 }
|
|---|
| 573 | 00566 }
|
|---|
| 574 | 00567
|
|---|
| 575 | <a name="l00568"></a><a class="code" href="classG4UIGAG.html#d12">00568</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d12">G4UIGAG::CodeGenJavaTree</a>(G4UIcommandTree * tree, <span class="keywordtype">int</span> level)
|
|---|
| 576 | 00569 {
|
|---|
| 577 | 00570 <span class="keywordtype">int</span> treeEntry, commandEntry;
|
|---|
| 578 | 00571 treeEntry = tree->GetTreeEntry();
|
|---|
| 579 | 00572 commandEntry = tree->GetCommandEntry();
|
|---|
| 580 | 00573
|
|---|
| 581 | 00574 <span class="keywordflow">if</span>(level!=0) {
|
|---|
| 582 | 00575 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<commandEntry; i++){
|
|---|
| 583 | 00576 G4cout << tree->GetCommand(i+1)->GetCommandPath() << G4endl;
|
|---|
| 584 | 00577 }
|
|---|
| 585 | 00578 }
|
|---|
| 586 | 00579 <span class="keywordflow">if</span>(treeEntry == 0) <span class="keywordflow">return</span>; <span class="comment">//end recursion</span>
|
|---|
| 587 | 00580
|
|---|
| 588 | 00581 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j<treeEntry; j++){
|
|---|
| 589 | 00582 <a class="code" href="classG4UIGAG.html#d12">CodeGenJavaTree</a>(tree->GetTree(j+1), level+1);
|
|---|
| 590 | 00583 }
|
|---|
| 591 | 00584 }
|
|---|
| 592 | 00585
|
|---|
| 593 | <a name="l00586"></a><a class="code" href="classG4UIGAG.html#d13">00586</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d13">G4UIGAG::CodeGenJavaParams</a>(G4UIcommandTree * tree, <span class="keywordtype">int</span> level) <span class="comment">//recursive</span>
|
|---|
| 594 | 00587 {
|
|---|
| 595 | 00588 <span class="keywordtype">int</span> treeEntry, commandEntry, i;
|
|---|
| 596 | 00589 <span class="comment">//G4UIcommand * Comp;</span>
|
|---|
| 597 | 00590 G4UIcommandTree * treeLink;
|
|---|
| 598 | 00591
|
|---|
| 599 | 00592 treeEntry = tree->GetTreeEntry();
|
|---|
| 600 | 00593 commandEntry = tree->GetCommandEntry();
|
|---|
| 601 | 00594
|
|---|
| 602 | 00595 <span class="keywordflow">for</span>(i=0; i<commandEntry; i++) {
|
|---|
| 603 | 00596 <a class="code" href="classG4UIGAG.html#d10">SendAParamProperty</a>(tree->GetCommand(i+1));
|
|---|
| 604 | 00597 }
|
|---|
| 605 | 00598 <span class="keywordflow">if</span>( treeEntry == 0 ) <span class="keywordflow">return</span>; <span class="comment">// end recursion</span>
|
|---|
| 606 | 00599
|
|---|
| 607 | 00600 <span class="keywordflow">for</span>(i=0; i< treeEntry; i++) {
|
|---|
| 608 | 00601 treeLink = tree->GetTree(i+1);
|
|---|
| 609 | 00602 G4cout << <span class="stringliteral">"@@JDirGuideBegin"</span> << G4endl;
|
|---|
| 610 | 00603 G4cout << treeLink->GetPathName() << G4endl << treeLink->GetTitle() << G4endl;
|
|---|
| 611 | 00604 G4cout << <span class="stringliteral">"@@JDirGuideEnd"</span> << G4endl;
|
|---|
| 612 | 00605 <a class="code" href="classG4UIGAG.html#d13">CodeGenJavaParams</a>(treeLink, level+1);
|
|---|
| 613 | 00606 }
|
|---|
| 614 | 00607 }
|
|---|
| 615 | 00608
|
|---|
| 616 | <a name="l00609"></a><a class="code" href="classG4UIGAG.html#d10">00609</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d10">G4UIGAG::SendAParamProperty</a>(G4UIcommand * Comp)
|
|---|
| 617 | 00610 {
|
|---|
| 618 | 00611 <span class="keywordtype">int</span> guidanceEntry, parameterEntry;
|
|---|
| 619 | 00612 G4String title, title2;
|
|---|
| 620 | 00613 G4UIparameter * prp;
|
|---|
| 621 | 00614 <span class="keywordtype">char</span> c[2];
|
|---|
| 622 | 00615 guidanceEntry = Comp->GetGuidanceEntries();
|
|---|
| 623 | 00616 parameterEntry = Comp->GetParameterEntries();
|
|---|
| 624 | 00617 G4cout << <span class="stringliteral">"@@JParamBegin"</span> << G4endl;
|
|---|
| 625 | 00618 G4cout << Comp->GetCommandPath() << G4endl;
|
|---|
| 626 | 00619 G4cout << guidanceEntry << G4endl;
|
|---|
| 627 | 00620 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j<guidanceEntry; j++){
|
|---|
| 628 | 00621 title = Comp->GetGuidanceLine(j);
|
|---|
| 629 | 00622 title2 = <span class="stringliteral">""</span>;
|
|---|
| 630 | 00623 <span class="keywordflow">if</span> (title != <span class="stringliteral">""</span>){
|
|---|
| 631 | 00624 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i< (<span class="keywordtype">int</span>)title.length(); i++){
|
|---|
| 632 | 00625 c[0]=title(i);
|
|---|
| 633 | 00626 c[1]= <span class="charliteral">'\0'</span>;
|
|---|
| 634 | 00627 <span class="keywordflow">if</span> ( c[0] == <span class="charliteral">'\n'</span> || c[0] == <span class="charliteral">'\r'</span>) {
|
|---|
| 635 | 00628 c[0]= <span class="charliteral">' '</span>;
|
|---|
| 636 | 00629 }
|
|---|
| 637 | 00630 title2.append(c);
|
|---|
| 638 | 00631 }
|
|---|
| 639 | 00632 }
|
|---|
| 640 | 00633 G4cout << title2 << G4endl;
|
|---|
| 641 | 00634 }
|
|---|
| 642 | 00635 G4cout << Comp->GetRange() << G4endl;
|
|---|
| 643 | 00636 G4cout << parameterEntry << G4endl;
|
|---|
| 644 | 00637 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> par=0; par<parameterEntry; par++) {
|
|---|
| 645 | 00638 prp = (G4UIparameter *)Comp->GetParameter(par);
|
|---|
| 646 | 00639 G4cout << prp->GetParameterName() << G4endl;
|
|---|
| 647 | 00640 G4cout << prp->GetParameterGuidance() << G4endl;
|
|---|
| 648 | 00641 G4cout << prp->GetParameterType() << G4endl;
|
|---|
| 649 | 00642 G4cout << prp->IsOmittable() << G4endl;
|
|---|
| 650 | 00643 G4cout << prp->GetDefaultValue() << G4endl;
|
|---|
| 651 | 00644 G4cout << prp->GetParameterRange() << G4endl;
|
|---|
| 652 | 00645 G4cout << prp->GetParameterCandidates() << G4endl;
|
|---|
| 653 | 00646 }
|
|---|
| 654 | 00647 G4cout << <span class="stringliteral">"@@JParamEnd"</span> << G4endl;
|
|---|
| 655 | 00648 }
|
|---|
| 656 | 00649
|
|---|
| 657 | <a name="l00650"></a><a class="code" href="classG4UIGAG.html#d16">00650</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d16">G4UIGAG::SendDisableList</a>(G4UIcommandTree * tree, <span class="keywordtype">int</span> level)
|
|---|
| 658 | 00651 {
|
|---|
| 659 | 00652 <span class="keywordtype">int</span> treeEntry, commandEntry;
|
|---|
| 660 | 00653 G4UIcommand * Comp;
|
|---|
| 661 | 00654 treeEntry = tree->GetTreeEntry();
|
|---|
| 662 | 00655 commandEntry = tree->GetCommandEntry();
|
|---|
| 663 | 00656
|
|---|
| 664 | 00657 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> com=0; com<commandEntry; com++) {
|
|---|
| 665 | 00658 Comp = tree->GetCommand(com+1);
|
|---|
| 666 | 00659 <span class="keywordflow">if</span>( Comp->IsAvailable()==<span class="keyword">false</span> ) {
|
|---|
| 667 | 00660 G4cout << Comp->GetCommandPath()<<G4endl;
|
|---|
| 668 | 00661 }
|
|---|
| 669 | 00662 }
|
|---|
| 670 | 00663 <span class="keywordflow">if</span>( treeEntry == 0 ) <span class="keywordflow">return</span>; <span class="comment">// end recursion</span>
|
|---|
| 671 | 00664
|
|---|
| 672 | 00665 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<treeEntry; i++) {
|
|---|
| 673 | 00666 <a class="code" href="classG4UIGAG.html#d16">SendDisableList</a>(tree->GetTree(i+1), level+1);
|
|---|
| 674 | 00667 <span class="comment">// be sure the function name is the same</span>
|
|---|
| 675 | 00668 }
|
|---|
| 676 | 00669 }
|
|---|
| 677 | 00670
|
|---|
| 678 | 00671 <span class="comment">// ----- for Tcl GAG</span>
|
|---|
| 679 | 00672
|
|---|
| 680 | <a name="l00673"></a><a class="code" href="classG4UIGAG.html#d14">00673</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d14">G4UIGAG::CodeGenTclTree</a>(G4UIcommandTree * tree, <span class="keywordtype">int</span> level)
|
|---|
| 681 | 00674 {
|
|---|
| 682 | 00675 <span class="keywordtype">int</span> i, j;
|
|---|
| 683 | 00676 <span class="keywordtype">int</span> treeEntry, commandEntry, guidanceEntry;
|
|---|
| 684 | 00677 treeEntry = tree->GetTreeEntry();
|
|---|
| 685 | 00678 commandEntry = tree->GetCommandEntry();
|
|---|
| 686 | 00679 G4String commandPath, pathName, title1, title2;
|
|---|
| 687 | 00680 G4UIcommandTree * t;
|
|---|
| 688 | 00681 G4UIcommand * Comp;
|
|---|
| 689 | 00682
|
|---|
| 690 | 00683 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> com=0; com<commandEntry; com++){
|
|---|
| 691 | 00684 Comp = tree->GetCommand(com+1);
|
|---|
| 692 | 00685 commandPath = Comp->GetCommandPath();
|
|---|
| 693 | 00686 G4cout << commandPath << <span class="stringliteral">" @@command"</span> << G4endl;
|
|---|
| 694 | 00687 guidanceEntry = Comp->GetGuidanceEntries();
|
|---|
| 695 | 00688 <span class="keywordflow">if</span> (guidanceEntry == 0){
|
|---|
| 696 | 00689 title2 = <span class="stringliteral">"...Title not available..."</span>;
|
|---|
| 697 | 00690 } <span class="keywordflow">else</span> {
|
|---|
| 698 | 00691 title2 = <span class="stringliteral">""</span>;
|
|---|
| 699 | 00692 j = 0;
|
|---|
| 700 | 00693 <span class="keywordflow">while</span>(1){
|
|---|
| 701 | 00694 title1 = Comp->GetGuidanceLine(j);
|
|---|
| 702 | 00695 <span class="keywordflow">for</span>(i=0; i< (<span class="keywordtype">int</span>)title1.length(); i++){
|
|---|
| 703 | 00696 <span class="keywordtype">char</span> c[2];
|
|---|
| 704 | 00697 c[0]=title1(i);
|
|---|
| 705 | 00698 c[1]= <span class="charliteral">'\0'</span>;
|
|---|
| 706 | 00699 <span class="keywordflow">if</span>( c[0] == <span class="charliteral">'\"'</span>) {
|
|---|
| 707 | 00700 title2.append(<span class="stringliteral">"\\\""</span>); <span class="comment">// a Backslash and a double quote</span>
|
|---|
| 708 | 00701 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( c[0] == <span class="charliteral">'\n'</span> || c[0] == <span class="charliteral">'\r'</span>) {
|
|---|
| 709 | 00702 title2.append(<span class="stringliteral">"\\n"</span>);
|
|---|
| 710 | 00703 } <span class="keywordflow">else</span> title2.append(c);
|
|---|
| 711 | 00704 }
|
|---|
| 712 | 00705 j++;
|
|---|
| 713 | 00706 <span class="keywordflow">if</span> (j >= guidanceEntry) <span class="keywordflow">break</span>;
|
|---|
| 714 | 00707 title2.append(<span class="stringliteral">"\\n"</span>);
|
|---|
| 715 | 00708 }
|
|---|
| 716 | 00709 }
|
|---|
| 717 | 00710 G4cout << commandPath << <span class="stringliteral">" @@title \""</span><< title2 <<<span class="stringliteral">"\""</span><< G4endl;
|
|---|
| 718 | 00711 }
|
|---|
| 719 | 00712
|
|---|
| 720 | 00713 <span class="keywordflow">if</span>(treeEntry == 0) <span class="keywordflow">return</span>; <span class="comment">//end recursion</span>
|
|---|
| 721 | 00714
|
|---|
| 722 | 00715 <span class="keywordflow">for</span>(i=0; i< treeEntry; i++){
|
|---|
| 723 | 00716 t = tree->GetTree(i+1);
|
|---|
| 724 | 00717 pathName = t->GetPathName();
|
|---|
| 725 | 00718 title1 = t->GetTitle();
|
|---|
| 726 | 00719 title2 = <span class="stringliteral">""</span>;
|
|---|
| 727 | 00720 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<(<span class="keywordtype">int</span>)title1.length(); i++){
|
|---|
| 728 | 00721 <span class="keywordtype">char</span> c[2];
|
|---|
| 729 | 00722 c[0]=title1(i);
|
|---|
| 730 | 00723 c[1]= <span class="charliteral">'\0'</span>;
|
|---|
| 731 | 00724 <span class="keywordflow">if</span>( c[0] == <span class="charliteral">'\"'</span>)
|
|---|
| 732 | 00725 title2.append(<span class="stringliteral">"\\\""</span>); <span class="comment">// a Backslash and a double quote</span>
|
|---|
| 733 | 00726 <span class="keywordflow">else</span> title2.append(c);
|
|---|
| 734 | 00727 }
|
|---|
| 735 | 00728 <span class="keywordflow">if</span>(level==0) G4cout << pathName<< G4endl;
|
|---|
| 736 | 00729 <span class="keywordflow">else</span> G4cout << pathName<< <span class="stringliteral">" @@cascade"</span><<G4endl;
|
|---|
| 737 | 00730 G4cout << pathName << <span class="stringliteral">" @@title \""</span> << title1 << <span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 738 | 00731 <a class="code" href="classG4UIGAG.html#d14">CodeGenTclTree</a>(t, level+1);
|
|---|
| 739 | 00732 }
|
|---|
| 740 | 00733 }
|
|---|
| 741 | 00734
|
|---|
| 742 | <a name="l00735"></a><a class="code" href="classG4UIGAG.html#d15">00735</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d15">G4UIGAG::CodeGenTclParams</a>( G4UIcommandTree * tree, <span class="keywordtype">int</span> level) <span class="comment">// recursive</span>
|
|---|
| 743 | 00736 {
|
|---|
| 744 | 00737 <span class="keywordtype">int</span> treeEntry, commandEntry;
|
|---|
| 745 | 00738 G4UIcommand * Comp;
|
|---|
| 746 | 00739 treeEntry = tree->GetTreeEntry();
|
|---|
| 747 | 00740 commandEntry = tree->GetCommandEntry();
|
|---|
| 748 | 00741
|
|---|
| 749 | 00742 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> com=0; com<commandEntry; com++) {
|
|---|
| 750 | 00743 Comp = tree->GetCommand(com+1);
|
|---|
| 751 | 00744 <a class="code" href="classG4UIGAG.html#d11">SendATclParamProperty</a>(Comp);
|
|---|
| 752 | 00745 }
|
|---|
| 753 | 00746 <span class="keywordflow">if</span>( treeEntry == 0 ) <span class="keywordflow">return</span>; <span class="comment">// end recursion</span>
|
|---|
| 754 | 00747
|
|---|
| 755 | 00748 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<treeEntry; i++) {
|
|---|
| 756 | 00749 <a class="code" href="classG4UIGAG.html#d15">CodeGenTclParams</a>(tree->GetTree(i+1), level+1);
|
|---|
| 757 | 00750 <span class="comment">// be sure the function name is the same</span>
|
|---|
| 758 | 00751 }
|
|---|
| 759 | 00752 }
|
|---|
| 760 | 00753
|
|---|
| 761 | <a name="l00754"></a><a class="code" href="classG4UIGAG.html#d11">00754</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d11">G4UIGAG::SendATclParamProperty</a>(G4UIcommand * Comp)
|
|---|
| 762 | 00755 {
|
|---|
| 763 | 00756 G4UIparameter * prp;
|
|---|
| 764 | 00757 <span class="keywordtype">int</span> parameterEntry = Comp->GetParameterEntries();
|
|---|
| 765 | 00758 G4String commandPath = Comp->GetCommandPath();
|
|---|
| 766 | 00759 G4String commandRange = Comp->GetRange();
|
|---|
| 767 | 00760 G4cout << <span class="stringliteral">"@@parameter_start"</span> << G4endl;
|
|---|
| 768 | 00761 G4cout << commandPath << <span class="stringliteral">" @@param "</span> << parameterEntry << G4endl;
|
|---|
| 769 | 00762 G4cout << <span class="stringliteral">"@@command_range \""</span> << commandRange << <span class="stringliteral">"\""</span> << G4endl;
|
|---|
| 770 | 00763 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> par=0; par<parameterEntry; par++) {
|
|---|
| 771 | 00764 prp = (G4UIparameter *)Comp->GetParameter(par);
|
|---|
| 772 | 00765 G4cout << <span class="stringliteral">"{"</span> ;
|
|---|
| 773 | 00766 G4cout << <span class="stringliteral">"@@param_name : \""</span> << prp->GetParameterName() <<<span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 774 | 00767 G4String guide1,guide2;
|
|---|
| 775 | 00768 guide1 = prp->GetParameterGuidance();
|
|---|
| 776 | 00769 guide2 = <span class="stringliteral">""</span>;
|
|---|
| 777 | 00770 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<(<span class="keywordtype">int</span>)guide1.length(); i++){
|
|---|
| 778 | 00771 <span class="keywordtype">char</span> c[2];
|
|---|
| 779 | 00772 c[0]=guide1(i);
|
|---|
| 780 | 00773 c[1]= <span class="charliteral">'\0'</span>;
|
|---|
| 781 | 00774 <span class="keywordflow">if</span>( c[0] == <span class="charliteral">'\"'</span>)
|
|---|
| 782 | 00775 guide2.append(<span class="stringliteral">"\\\""</span>); <span class="comment">// a Backslash and a double quote</span>
|
|---|
| 783 | 00776 <span class="keywordflow">else</span> guide2.append(c);
|
|---|
| 784 | 00777 }
|
|---|
| 785 | 00778 G4cout << <span class="stringliteral">" @@param_guide : \""</span> << guide2 << <span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 786 | 00779 G4cout << <span class="stringliteral">" @@param_type : \""</span> << prp->GetParameterType()<<<span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 787 | 00780 G4cout << <span class="stringliteral">" @@param_omit : \""</span> << prp->IsOmittable()<<<span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 788 | 00781 G4cout << <span class="stringliteral">" @@param_default : \""</span><< prp->GetDefaultValue()<<<span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 789 | 00782 G4cout << <span class="stringliteral">" @@param_range : \""</span><< prp->GetParameterRange()<<<span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 790 | 00783 G4cout << <span class="stringliteral">" @@param_candidate : \""</span> << prp->GetParameterCandidates()<< <span class="stringliteral">"\""</span><<G4endl;
|
|---|
| 791 | 00784 G4cout << <span class="stringliteral">"}"</span> << G4endl;
|
|---|
| 792 | 00785 }
|
|---|
| 793 | 00786 G4cout << <span class="stringliteral">"@@parameter_end"</span> << G4endl;
|
|---|
| 794 | 00787 }
|
|---|
| 795 | 00788
|
|---|
| 796 | <a name="l00789"></a><a class="code" href="classG4UIGAG.html#d17">00789</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d17">G4UIGAG::NotifyStateChange</a>(<span class="keywordtype">void</span>)
|
|---|
| 797 | 00790 {
|
|---|
| 798 | 00791 G4String stateString;
|
|---|
| 799 | 00792 G4StateManager * statM = G4StateManager::GetStateManager();
|
|---|
| 800 | 00793 G4UIcommandTree * tree = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 801 | 00794 stateString = statM->GetStateString(statM->GetCurrentState());
|
|---|
| 802 | 00795 <span class="keywordflow">if</span> ( <a class="code" href="classG4UIGAG.html#r5">uiMode</a> != <a class="code" href="G4UIGAG_8hh.html#a7a0">terminal_mode</a> ){
|
|---|
| 803 | 00796 G4cout << <span class="stringliteral">"@@State \""</span> << stateString << <span class="stringliteral">"\""</span> << G4endl;
|
|---|
| 804 | 00797 G4cout << <span class="stringliteral">"@@DisableListBegin"</span><<G4endl;
|
|---|
| 805 | 00798 <a class="code" href="classG4UIGAG.html#d16">SendDisableList</a>(tree, 0);
|
|---|
| 806 | 00799 G4cout << <span class="stringliteral">"@@DisableListEnd"</span> <<G4endl;
|
|---|
| 807 | 00800 }
|
|---|
| 808 | 00801 }
|
|---|
| 809 | 00802
|
|---|
| 810 | <a name="l00803"></a><a class="code" href="classG4UIGAG.html#d18">00803</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d18">G4UIGAG::NotifyCommandUpdate</a>(<span class="keywordtype">void</span>)
|
|---|
| 811 | 00804 {
|
|---|
| 812 | 00805 G4UIcommandTree * tree = <a class="code" href="classG4UIGAG.html#r1">UI</a>->GetTree();
|
|---|
| 813 | 00806 <a class="code" href="classG4UIGAG.html#d8">SendCommandProperties</a>(tree);
|
|---|
| 814 | 00807 }
|
|---|
| 815 | 00808
|
|---|
| 816 | <a name="l00809"></a><a class="code" href="classG4UIGAG.html#d19">00809</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d19">G4UIGAG::NotifyParameterUpdate</a>(G4UIcommand* com)
|
|---|
| 817 | 00810 {
|
|---|
| 818 | 00811 <span class="keywordflow">if</span> (<a class="code" href="classG4UIGAG.html#r5">uiMode</a> == <a class="code" href="G4UIGAG_8hh.html#a7a1">java_mode</a>)
|
|---|
| 819 | 00812 <a class="code" href="classG4UIGAG.html#d10">SendAParamProperty</a>(com);
|
|---|
| 820 | 00813 <span class="keywordflow">else</span>
|
|---|
| 821 | 00814 <a class="code" href="classG4UIGAG.html#d11">SendATclParamProperty</a>(com);
|
|---|
| 822 | 00815 }
|
|---|
| 823 | 00816
|
|---|
| 824 | 00817 <span class="comment">//####### update check routines ####################################</span>
|
|---|
| 825 | <a name="l00818"></a><a class="code" href="classG4UIGAG.html#d21">00818</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d21">G4UIGAG::UpdateState</a>(<span class="keywordtype">void</span>)
|
|---|
| 826 | 00819 {
|
|---|
| 827 | 00820 <span class="keyword">static</span> G4ApplicationState previousState= G4State_PreInit;
|
|---|
| 828 | 00821 G4ApplicationState newState;
|
|---|
| 829 | 00822 G4StateManager *statM = G4StateManager::GetStateManager();
|
|---|
| 830 | 00823 newState = statM->GetCurrentState();
|
|---|
| 831 | 00824 <span class="keywordflow">if</span>( newState != previousState )
|
|---|
| 832 | 00825 {
|
|---|
| 833 | 00826 <a class="code" href="classG4UIGAG.html#d17">NotifyStateChange</a>();
|
|---|
| 834 | 00827 previousState = newState;
|
|---|
| 835 | 00828 }
|
|---|
| 836 | 00829 }
|
|---|
| 837 | 00830
|
|---|
| 838 | <a name="l00831"></a><a class="code" href="classG4UIGAG.html#d20">00831</a> <span class="keywordtype">int</span> <a class="code" href="classG4UIGAG.html#d20">G4UIGAG::CommandUpdated</a>(<span class="keywordtype">void</span>)
|
|---|
| 839 | 00832 {
|
|---|
| 840 | 00833 <span class="keywordtype">int</span> <a class="code" href="G4UIGAG_8hh.html#a8a4">added</a>=0, <a class="code" href="G4UIGAG_8hh.html#a8a5">deleted</a>=0;
|
|---|
| 841 | 00834 <span class="keywordtype">int</span> pEntry= <a class="code" href="classG4UIGAG.html#r8">previousTreeCommands</a>.size();
|
|---|
| 842 | 00835 <span class="keywordtype">int</span> nEntry= <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>.size();
|
|---|
| 843 | 00836 <span class="keywordtype">int</span> i,j;
|
|---|
| 844 | 00837 <span class="keywordflow">for</span>( i=0; i<pEntry; i++) { <span class="comment">// check deleted command(s)</span>
|
|---|
| 845 | 00838 <span class="keywordflow">for</span>( j=0; j<nEntry; j++) {
|
|---|
| 846 | 00839 <span class="keywordflow">if</span>( <a class="code" href="classG4UIGAG.html#r8">previousTreeCommands</a>[i] == <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>[j]) <span class="keywordflow">break</span>;
|
|---|
| 847 | 00840 }
|
|---|
| 848 | 00841 <span class="keywordflow">if</span>( j==nEntry ) {
|
|---|
| 849 | 00842 <a class="code" href="G4UIGAG_8hh.html#a8a5">deleted</a> = 1;
|
|---|
| 850 | 00843 <span class="comment">//G4cout <<"deleted: "<< previousTreeCommands(i) << G4endl;</span>
|
|---|
| 851 | 00844 }
|
|---|
| 852 | 00845 }
|
|---|
| 853 | 00846 <span class="keywordflow">for</span>( i=0; i<nEntry; i++) { <span class="comment">// check added command(s)</span>
|
|---|
| 854 | 00847 <span class="keywordflow">for</span>( j=0; j<pEntry; j++) {
|
|---|
| 855 | 00848 <span class="keywordflow">if</span>( <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>[i] == <a class="code" href="classG4UIGAG.html#r8">previousTreeCommands</a>[j]) <span class="keywordflow">break</span>;
|
|---|
| 856 | 00849 }
|
|---|
| 857 | 00850 <span class="keywordflow">if</span>( j==pEntry ) {
|
|---|
| 858 | 00851 <a class="code" href="G4UIGAG_8hh.html#a8a4">added</a> = 1;
|
|---|
| 859 | 00852 <span class="comment">// G4cout <<"added: "<< newTreeCommands(i) << G4endl;</span>
|
|---|
| 860 | 00853 }
|
|---|
| 861 | 00854 }
|
|---|
| 862 | 00855 <span class="keywordflow">if</span>( <a class="code" href="G4UIGAG_8hh.html#a8a4">added</a> && <a class="code" href="G4UIGAG_8hh.html#a8a5">deleted</a>==0 ) {G4cout<<<span class="stringliteral">"c added"</span><<G4endl;<span class="keywordflow">return</span> <a class="code" href="G4UIGAG_8hh.html#a8a4">added</a>;}
|
|---|
| 863 | 00856 <span class="keywordflow">if</span>( <a class="code" href="G4UIGAG_8hh.html#a8a4">added</a>==0 && <a class="code" href="G4UIGAG_8hh.html#a8a5">deleted</a> ) {G4cout<<<span class="stringliteral">"c deleted"</span><<G4endl;<span class="keywordflow">return</span> <a class="code" href="G4UIGAG_8hh.html#a8a5">deleted</a>;}
|
|---|
| 864 | 00857 <span class="keywordflow">if</span>( <a class="code" href="G4UIGAG_8hh.html#a8a4">added</a> && <a class="code" href="G4UIGAG_8hh.html#a8a5">deleted</a> ) {G4cout<<<span class="stringliteral">"c add/deleted"</span><<G4endl;<span class="keywordflow">return</span> <a class="code" href="G4UIGAG_8hh.html#a8a6">addedAndDeleted</a>;}
|
|---|
| 865 | 00858 <span class="keywordflow">return</span> <a class="code" href="G4UIGAG_8hh.html#a8a3">notChanged</a>;
|
|---|
| 866 | 00859 }
|
|---|
| 867 | 00860
|
|---|
| 868 | <a name="l00861"></a><a class="code" href="classG4UIGAG.html#d23">00861</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d23">G4UIGAG::GetNewTreeStructure</a>(G4UIcommandTree * tree, <span class="keywordtype">int</span> level)
|
|---|
| 869 | 00862 {
|
|---|
| 870 | 00863 G4String commandPath;
|
|---|
| 871 | 00864 G4String title;
|
|---|
| 872 | 00865 G4String pathName; <span class="comment">//tree name</span>
|
|---|
| 873 | 00866 G4UIcommandTree * t;
|
|---|
| 874 | 00867 <span class="keywordtype">int</span> treeEntry = tree->GetTreeEntry();
|
|---|
| 875 | 00868 <span class="keywordtype">int</span> commandEntry = tree->GetCommandEntry();
|
|---|
| 876 | 00869
|
|---|
| 877 | 00870 <span class="keywordflow">if</span>( level==0 ) { <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>.clear();}
|
|---|
| 878 | 00871 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> com=0; com<commandEntry; com++){
|
|---|
| 879 | 00872 commandPath = tree->GetCommand(com+1)->GetCommandPath();
|
|---|
| 880 | 00873 title = tree->GetCommand(com+1)->GetTitle();
|
|---|
| 881 | 00874 <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>.push_back( commandPath + <span class="stringliteral">" "</span> + title );
|
|---|
| 882 | 00875 }
|
|---|
| 883 | 00876
|
|---|
| 884 | 00877 <span class="keywordflow">if</span>(treeEntry == 0) <span class="keywordflow">return</span>; <span class="comment">//end recursion</span>
|
|---|
| 885 | 00878
|
|---|
| 886 | 00879 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i< treeEntry; i++){
|
|---|
| 887 | 00880 t = tree->GetTree(i+1);
|
|---|
| 888 | 00881 pathName = t->GetPathName();
|
|---|
| 889 | 00882 title = t->GetTitle();
|
|---|
| 890 | 00883 <a class="code" href="classG4UIGAG.html#r9">newTreeCommands</a>.push_back( pathName + <span class="stringliteral">" "</span> + title );
|
|---|
| 891 | 00884 <a class="code" href="classG4UIGAG.html#d23">GetNewTreeStructure</a>(t, level+1);
|
|---|
| 892 | 00885 }
|
|---|
| 893 | 00886 }
|
|---|
| 894 | 00887
|
|---|
| 895 | <a name="l00888"></a><a class="code" href="classG4UIGAG.html#d22">00888</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d22">G4UIGAG::UpdateParamVal</a>(<span class="keywordtype">void</span>)
|
|---|
| 896 | 00889 {
|
|---|
| 897 | 00890 <span class="comment">// call NotifyParameterUpdate() if the value of each</span>
|
|---|
| 898 | 00891 <span class="comment">// command/parameter is updated.</span>
|
|---|
| 899 | 00892 <span class="comment">// assuming the command structure is not changed.</span>
|
|---|
| 900 | 00893 <span class="keywordtype">int</span> pEntry= <a class="code" href="classG4UIGAG.html#r10">previousTreeParams</a>.size();
|
|---|
| 901 | 00894 <span class="keywordtype">int</span> nEntry= <a class="code" href="classG4UIGAG.html#r11">newTreeParams</a>.size();
|
|---|
| 902 | 00895 <span class="keywordtype">int</span> i;
|
|---|
| 903 | 00896 G4UIcommand* Comp;
|
|---|
| 904 | 00897 <span class="keywordflow">if</span> (pEntry != nEntry) <span class="keywordflow">return</span>;
|
|---|
| 905 | 00898 <span class="keywordflow">for</span>( i=0; i<nEntry; i++) {
|
|---|
| 906 | 00899 <span class="keywordflow">if</span>( <a class="code" href="classG4UIGAG.html#r10">previousTreeParams</a>[i] != <a class="code" href="classG4UIGAG.html#r11">newTreeParams</a>[i]){
|
|---|
| 907 | 00900 Comp = <a class="code" href="classG4UIGAG.html#r13">newTreePCP</a>[i];
|
|---|
| 908 | 00901 G4cout << Comp->GetCommandPath()
|
|---|
| 909 | 00902 << <span class="stringliteral">" command is updated."</span> <<G4endl;
|
|---|
| 910 | 00903 <a class="code" href="classG4UIGAG.html#d19">NotifyParameterUpdate</a>(Comp);
|
|---|
| 911 | 00904 }
|
|---|
| 912 | 00905 }
|
|---|
| 913 | 00906 }
|
|---|
| 914 | 00907
|
|---|
| 915 | 00908 <span class="comment">//void G4UIGAG::paramUpdate(void)</span>
|
|---|
| 916 | 00909 <span class="comment">//{ </span>
|
|---|
| 917 | 00910 <span class="comment">// int added=0, deleted=0;</span>
|
|---|
| 918 | 00911 <span class="comment">// int pEntry= previousTreeParams.entries();</span>
|
|---|
| 919 | 00912 <span class="comment">// int nEntry= newTreeParams.entries();</span>
|
|---|
| 920 | 00913 <span class="comment">// int i,j;</span>
|
|---|
| 921 | 00914 <span class="comment">//</span>
|
|---|
| 922 | 00915 <span class="comment">// if (pEntry != nEntry) return NULL;</span>
|
|---|
| 923 | 00916 <span class="comment">// for( i=0; i<pEntry; i++) { // check deleted param(s)</span>
|
|---|
| 924 | 00917 <span class="comment">// for( j=0; j<nEntry; j++) {</span>
|
|---|
| 925 | 00918 <span class="comment">// if( previousTreeParams(i) == newTreeParams(j)) break;</span>
|
|---|
| 926 | 00919 <span class="comment">// }</span>
|
|---|
| 927 | 00920 <span class="comment">// if( j==nEntry ) { </span>
|
|---|
| 928 | 00921 <span class="comment">// deleted = 1;</span>
|
|---|
| 929 | 00922 <span class="comment">// //G4cout <<"para deleted: "<< previousTreeParams(i) << G4endl;</span>
|
|---|
| 930 | 00923 <span class="comment">// }</span>
|
|---|
| 931 | 00924 <span class="comment">// }</span>
|
|---|
| 932 | 00925 <span class="comment">// for( i=0; i<nEntry; i++) { // check added param(s)</span>
|
|---|
| 933 | 00926 <span class="comment">// for( j=0; j<pEntry; j++) {</span>
|
|---|
| 934 | 00927 <span class="comment">// if( newTreeParams(i) == previousTreeParams(j)) break;</span>
|
|---|
| 935 | 00928 <span class="comment">// }</span>
|
|---|
| 936 | 00929 <span class="comment">// if( j==pEntry ) { </span>
|
|---|
| 937 | 00930 <span class="comment">// added = 1;</span>
|
|---|
| 938 | 00931 <span class="comment">// //G4cout <<"para added: "<< newTreeParams(i) << G4endl;</span>
|
|---|
| 939 | 00932 <span class="comment">// }</span>
|
|---|
| 940 | 00933 <span class="comment">// }</span>
|
|---|
| 941 | 00934 <span class="comment">// if( added && deleted==0 ) {G4cout<<"p added"<<G4endl;return added;}</span>
|
|---|
| 942 | 00935 <span class="comment">// if( added==0 && deleted ) {G4cout<<"p deleted"<<G4endl;return deleted;}</span>
|
|---|
| 943 | 00936 <span class="comment">// if( added && deleted ) {G4cout<<"p add/deleted"<<G4endl; return addedAndDeleted;}</span>
|
|---|
| 944 | 00937 <span class="comment">// return notChanged;</span>
|
|---|
| 945 | 00938 <span class="comment">//}</span>
|
|---|
| 946 | 00939
|
|---|
| 947 | <a name="l00940"></a><a class="code" href="classG4UIGAG.html#d24">00940</a> <span class="keywordtype">void</span> <a class="code" href="classG4UIGAG.html#d24">G4UIGAG::GetNewTreeValues</a>( G4UIcommandTree * tree, <span class="keywordtype">int</span> level) <span class="comment">// recursive</span>
|
|---|
| 948 | 00941 {
|
|---|
| 949 | 00942 G4String commandPath;
|
|---|
| 950 | 00943 G4String pathName; <span class="comment">//tree name</span>
|
|---|
| 951 | 00944 G4UIcommandTree * t;
|
|---|
| 952 | 00945 <span class="keywordtype">int</span> parameterEntry;
|
|---|
| 953 | 00946 <span class="keywordtype">int</span> treeEntry = tree->GetTreeEntry();
|
|---|
| 954 | 00947 <span class="keywordtype">int</span> commandEntry = tree->GetCommandEntry();
|
|---|
| 955 | 00948 G4UIcommand * Comp;
|
|---|
| 956 | 00949 G4UIparameter * prp;
|
|---|
| 957 | 00950 G4String param, str(<span class="stringliteral">" "</span>);
|
|---|
| 958 | 00951
|
|---|
| 959 | 00952 <span class="keywordflow">if</span>( level==0 ) { <a class="code" href="classG4UIGAG.html#r11">newTreeParams</a>.clear(); }
|
|---|
| 960 | 00953 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> com=0; com<commandEntry; com++) {
|
|---|
| 961 | 00954 Comp = tree->GetCommand(com+1);
|
|---|
| 962 | 00955 commandPath = Comp->GetCommandPath();
|
|---|
| 963 | 00956 parameterEntry = Comp->GetParameterEntries();
|
|---|
| 964 | 00957 param = commandPath +<span class="stringliteral">" "</span>;
|
|---|
| 965 | 00958 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> par=0; par< parameterEntry; par++) {
|
|---|
| 966 | 00959 prp = (G4UIparameter *)Comp->GetParameter(par);
|
|---|
| 967 | 00960 param += prp->GetParameterName() +<span class="stringliteral">" "</span>;
|
|---|
| 968 | 00961 str(0) = prp->GetParameterType();
|
|---|
| 969 | 00962 param += str + <span class="stringliteral">" "</span>;
|
|---|
| 970 | 00963 param += prp->GetDefaultValue() +<span class="stringliteral">" "</span>;
|
|---|
| 971 | 00964 param += prp->GetParameterRange() +<span class="stringliteral">" "</span>;
|
|---|
| 972 | 00965 param += prp->GetParameterCandidates();
|
|---|
| 973 | 00966 }
|
|---|
| 974 | 00967 <a class="code" href="classG4UIGAG.html#r11">newTreeParams</a>.push_back( param + <span class="stringliteral">"\n"</span>);
|
|---|
| 975 | 00968 <a class="code" href="classG4UIGAG.html#r13">newTreePCP</a>.push_back( Comp );
|
|---|
| 976 | 00969 }
|
|---|
| 977 | 00970 <span class="keywordflow">if</span>( treeEntry == 0 ) <span class="keywordflow">return</span>; <span class="comment">// end recursion</span>
|
|---|
| 978 | 00971 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i< treeEntry; i++) {
|
|---|
| 979 | 00972 t = tree->GetTree(i+1);
|
|---|
| 980 | 00973 <a class="code" href="classG4UIGAG.html#d24">GetNewTreeValues</a>(t, level+1);
|
|---|
| 981 | 00974 }
|
|---|
| 982 | 00975 }
|
|---|
| 983 | 00976 <span class="comment">//######################################################</span>
|
|---|
| 984 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 22 11:07:02 2007 by
|
|---|
| 985 | <a href="http://www.doxygen.org/index.html">
|
|---|
| 986 | <img src="doxygen.png" alt="doxygen" align="middle" border=0 >
|
|---|
| 987 | </a>1.3.4 </small></address>
|
|---|
| 988 | </body>
|
|---|
| 989 | </html>
|
|---|