[476] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4UIGAG.hh,v 1.7 2006/06/29 19:09:18 gunter Exp $ |
---|
[593] | 28 | // GEANT4 tag $Name: geant4-09-00-ref-01 $ |
---|
[476] | 29 | // |
---|
| 30 | // G4UIGAG.hh |
---|
| 31 | // GAG(Geant4 adaptive GUI) interface class |
---|
| 32 | // 18.Feb.98 Y.Nagamatu and T.Kodama created G4UIGAG from G4UIterminal |
---|
| 33 | |
---|
| 34 | // If you want to use GAG (Tcl and JAVA version), |
---|
| 35 | // read a document file README_Momo.html. |
---|
| 36 | |
---|
| 37 | #ifndef G4UIGAG_h |
---|
| 38 | #define G4UIGAG_h 1 |
---|
| 39 | |
---|
| 40 | #include "G4UIsession.hh" |
---|
| 41 | #include "G4UImanager.hh" |
---|
| 42 | #include <fstream> |
---|
| 43 | #include <vector> |
---|
| 44 | |
---|
| 45 | enum UImode { terminal_mode , java_mode, tcl_mode }; |
---|
| 46 | enum ChangeOfTree { notChanged=0, added, deleted, addedAndDeleted }; |
---|
| 47 | |
---|
| 48 | // class description: |
---|
| 49 | // |
---|
| 50 | // This class inherits the class G4UIsession. |
---|
| 51 | // This is the class which is the front-end to GAG (Geant4 Adaptive GUI). |
---|
| 52 | // Its usage is quite similar to G4UIterminal. |
---|
| 53 | |
---|
| 54 | class G4UIGAG : public G4UIsession |
---|
| 55 | { |
---|
| 56 | public: // with description |
---|
| 57 | G4UIGAG(); |
---|
| 58 | ~G4UIGAG(); |
---|
| 59 | |
---|
| 60 | G4UIsession * SessionStart(); |
---|
| 61 | |
---|
| 62 | // A GAG session "gagSession" is instantiated. |
---|
| 63 | // G4cout stream is redirected by default to the constructed instance. |
---|
| 64 | // Usage: G4UIsession * gagSession = new G4UIGAG; |
---|
| 65 | // "gagSession" is started. |
---|
| 66 | // Usage: gagSession->SessionStart(); |
---|
| 67 | // "gagSession" is deleted. |
---|
| 68 | // Usage: delete gagSession; |
---|
| 69 | // |
---|
| 70 | void PauseSessionStart(G4String); |
---|
| 71 | G4int ReceiveG4cout(G4String); |
---|
| 72 | G4int ReceiveG4cerr(G4String); |
---|
| 73 | // These methods are implementation of the virtual methods of |
---|
| 74 | // G4UIsession class. |
---|
| 75 | // |
---|
| 76 | void SessionTerminate(); |
---|
| 77 | void Prompt(G4String); |
---|
| 78 | G4String GetCommand(); |
---|
| 79 | // These methods are not for users. |
---|
| 80 | private: |
---|
| 81 | G4String prefix; |
---|
| 82 | G4UImanager * UI; |
---|
| 83 | G4String promptCharacter; |
---|
| 84 | G4bool iExit; |
---|
| 85 | G4bool iCont; |
---|
| 86 | UImode uiMode; |
---|
| 87 | |
---|
| 88 | private: |
---|
| 89 | G4String JVersion; |
---|
| 90 | G4String TVersion; |
---|
| 91 | void ExecuteCommand(G4String); |
---|
| 92 | void ChangeDirectory(G4String); |
---|
| 93 | void ListDirectory(G4String); |
---|
| 94 | void TerminalHelp(G4String); |
---|
| 95 | G4String ModifyPrefix(G4String); |
---|
| 96 | G4UIcommandTree * FindDirPath(G4String); |
---|
| 97 | void ShowCurrent(G4String); |
---|
| 98 | G4String GetFullPath(G4String); |
---|
| 99 | |
---|
| 100 | void SendCommandProperties(G4UIcommandTree *); |
---|
| 101 | void SendParameterProperties(G4UIcommandTree *); |
---|
| 102 | void SendAParamProperty(G4UIcommand *); |
---|
| 103 | void SendATclParamProperty(G4UIcommand *); |
---|
| 104 | void CodeGenJavaTree(G4UIcommandTree *,int recursiveLevel); |
---|
| 105 | void CodeGenJavaParams(G4UIcommandTree *,int recursiveLevel); |
---|
| 106 | void CodeGenTclTree(G4UIcommandTree *, int recursiveLevel); |
---|
| 107 | void CodeGenTclParams(G4UIcommandTree *, int recursiveLevel); |
---|
| 108 | void SendDisableList(G4UIcommandTree *, int recursiveLevel); |
---|
| 109 | |
---|
| 110 | void NotifyStateChange(void); |
---|
| 111 | void NotifyCommandUpdate(void); |
---|
| 112 | void NotifyParameterUpdate(G4UIcommand *); |
---|
| 113 | |
---|
| 114 | int CommandUpdated(void); |
---|
| 115 | void UpdateState(void); |
---|
| 116 | void UpdateParamVal(void); // if param is updated, |
---|
| 117 | // call NotifyParameterUpdate() |
---|
| 118 | |
---|
| 119 | // --- the following are used by Notify*Update() and *Updated() |
---|
| 120 | void GetNewTreeStructure( G4UIcommandTree*,int recursiveLevel); |
---|
| 121 | void GetNewTreeValues( G4UIcommandTree*,int recursiveLevel); |
---|
| 122 | |
---|
| 123 | std::vector<G4String> previousTreeCommands; |
---|
| 124 | std::vector<G4String> newTreeCommands; |
---|
| 125 | std::vector<G4String> previousTreeParams; |
---|
| 126 | std::vector<G4String> newTreeParams; |
---|
| 127 | std::vector<G4UIcommand*> previousTreePCP; |
---|
| 128 | std::vector<G4UIcommand*> newTreePCP; |
---|
| 129 | |
---|
| 130 | }; |
---|
| 131 | |
---|
| 132 | #endif |
---|