00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 void TGo4CommandLine::init()
00029 {
00030 fiHistoryDepth=50;
00031 LoadHistory();
00032
00033 }
00034
00035
00036 void TGo4CommandLine::FileSearchDialog()
00037 {
00038 QFileDialog fd( this, "search macro", true);
00039 fd.setCaption("Select ROOT macro to execute in GUI");
00040 fd.setMode( QFileDialog::ExistingFile);
00041 fd.setName( "Select macro file");
00042 QString filters="ROOT macro (*.C *.c)";
00043 filters+=";;Go4 hotstart script (*.hotstart)";
00044 fd.setFilters(filters);
00045 if (fd.exec() != QDialog::Accepted) return;
00046 QString cmd;
00047 if(fd.selectedFilter().contains(".hotstart"))
00048 {
00049 cmd=fd.selectedFile();
00050 }
00051 else
00052 {
00053 cmd = QString(".x ") + fd.selectedFile();
00054 }
00055 InputLine->insertItem(cmd, 0);
00056 }
00057
00058
00059 void TGo4CommandLine::SelectCommand( const QString & str )
00060 {
00061 if (InputLine->EnterPressed() && (str!="")) {
00062 InputLine->ResetEnterPressed();
00063 InputLine->removeItem(InputLine->currentItem());
00064 int pos = -1;
00065 for (int i=0;i<InputLine->count();i++){
00066 if (InputLine->text(i)=="") pos = i;
00067 }
00068 if (pos>=0) InputLine->removeItem(pos);
00069 InputLine->insertItem(str,0);
00070 InputLine->insertItem("", 0);
00071 if (InputLine->currentItem()!=0)
00072 InputLine->setCurrentItem(0);
00073 QString message;
00074 if(str.contains("help") || str.contains(".go4h"))
00075 {
00076 PrintHelp();
00077 }
00078 else if(str.contains(".hotstart") && !str.contains(".x"))
00079 {
00080 QTextOStream( &message ) <<"Executing hotstart script: "<<str.latin1() << endl;
00081 StatusMessage(message);
00082 fxMainWindow->HotStart(str.latin1());
00083 }
00084 else
00085 {
00086 QTextOStream( &message ) <<"Executing command: "<<str.latin1() << endl;
00087 StatusMessage(message);
00088 gROOT->ProcessLine(str.latin1());
00089 }
00090 SaveHistory();
00091 }
00092 }
00093
00094
00095 void TGo4CommandLine::setMainWindow( TGo4MainWindow * win )
00096 {
00097 fxMainWindow=win;
00098 }
00099
00100
00101 void TGo4CommandLine::SaveHistory()
00102 {
00103 QStringList histlist;
00104 for(int i=0;( (i<InputLine->count() ) && (i<fiHistoryDepth) ); ++i)
00105 {
00106
00107 histlist.append(InputLine->text(i));
00108 }
00109 go4sett->setCommandsHistoryGUI(histlist);
00110 }
00111
00112
00113 void TGo4CommandLine::LoadHistory()
00114 {
00115
00116 QStringList histlist=go4sett->getCommandsHistoryGUI();
00117 InputLine->insertStringList(histlist);
00118
00119 gROOT->ProcessLine(".L $GO4SYS/macros/corrhistos.C");
00120 gROOT->ProcessLine(".L $GO4SYS/macros/hishisto.C");
00121 gROOT->ProcessLine(".L $GO4SYS/macros/addhistos.C");
00122 gROOT->ProcessLine(".L $GO4SYS/macros/divhistos.C");
00123 gROOT->ProcessLine(".L $GO4SYS/macros/profileX.C");
00124 gROOT->ProcessLine(".L $GO4SYS/macros/profileY.C");
00125 gROOT->ProcessLine(".L $GO4SYS/macros/projectionX.C");
00126 gROOT->ProcessLine(".L $GO4SYS/macros/projectionY.C");
00127 gROOT->ProcessLine(".L $GO4SYS/macros/rebin.C");
00128 gROOT->ProcessLine(".L $GO4SYS/macros/scalex.C");
00129
00130 }
00131
00132
00133 void TGo4CommandLine::PredefinedDialog()
00134 {
00135 TGo4MacroDialog md( this, "select", true);
00136 if (md.exec() != QDialog::Accepted) return;
00137 QString cmd=md.getCommand();
00138 InputLine->insertItem(cmd, 0);
00139
00140
00141
00142 }
00143
00144
00145 void TGo4CommandLine::PrintHelp()
00146 {
00147 cout <<"\n--- Go4 GUI command line short help --- " << endl;
00148 cout <<"- execute any command by pressing RETURN (Enter key)" << endl;
00149 cout <<"--" << endl;
00150 cout <<"- use '.h' for help concerning ROOT commands" << endl;
00151 cout <<"--" << endl;
00152 cout <<"- use 'go4->...' to access TGo4AbstractInterface for gui commands" << endl;
00153 cout <<"--" << endl;
00154 cout <<"- Some useful Go4 GUI command functions:" << endl;
00155
00156 cout <<"\t- TObject* go4->GetObject(const char* itemname);"<< endl;
00157 cout <<"\t\t: get browser object by full pathname. " << endl;
00158 cout <<"\t- TString go4->FindItem(const char* name); " << endl;
00159 cout <<"\t\t: get full pathname of browser object by name " << endl;
00160 cout <<"\t- TString go4->SaveToMemory(const char* path, TObject* obj, Bool_t ownership = kFALSE);"<< endl;
00161 cout <<"\t\t: Put object obj into workspace memory under subfolder path. Returns full item pathname. " << endl;
00162 cout <<"\t- ViewPanelHandle go4->StartViewPanel()"<< endl;
00163 cout <<"\t\t: Open new Go4 viewpanel with default size. Returns handle of new panel." << endl;
00164 cout <<"\t- Bool_t go4->DrawItem(const char* itemname, ViewPanelHandle panel = 0, const char* drawopt = 0);"<< endl;
00165 cout <<"\t\t: Draw object of full name itemname onto viewpanel panel. Will open new viewpanel if panel not specified. \n\t ROOT drawoption may be set. " << endl;
00166 cout <<"\t- go4->OpenFile(const char* fname)" << endl;
00167 cout <<"\t\t: open ROOT file of fname in Go4 browser " << endl;
00168 cout <<"\t- go4->LaunchAnalysis()" << endl;
00169 cout <<"\t\t: Start Go4 analysis process with previous set up " << endl;
00170 cout <<"--" << endl;
00171 cout <<"---- Please: note the Go4 helpwindow with TGo4AbstractInterface full method documentation!" << endl;
00172 cout <<"---- see example scripts at $GO4SYS/macros !" << endl;
00173 cout <<"---- visit our website at: \t http://go4.gsi.de !" << endl;
00174 cout <<"------ " << endl;
00175 HelpWindow("classTGo4AbstractInterface.html","doxygen/go4abstractinterface");
00176
00177
00178 }
00179
00180