Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4CommandLine.ui.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 /****************************************************************************
00017 ** ui.h extension file, included from the uic-generated form implementation.
00018 **
00019 ** If you want to add, delete, or rename functions or slots, use
00020 ** Qt Designer to update this file, preserving your code.
00021 **
00022 ** You should not define a constructor or destructor in this file.
00023 ** Instead, write your code in functions called init() and destroy().
00024 ** These will automatically be called by the form's constructor and
00025 ** destructor.
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()); // remove possible duplicate
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); // clear previous blank line
00069       InputLine->insertItem(str,0); // put last command on top of history
00070       InputLine->insertItem("", 0); // insert blank line on top
00071       if (InputLine->currentItem()!=0)
00072         InputLine->setCurrentItem(0); // provide free line
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             //cout <<"\n Save history saved "<<InputLine->text(i) << endl;
00107             histlist.append(InputLine->text(i));
00108         }
00109     go4sett->setCommandsHistoryGUI(histlist);
00110 }
00111 
00112 
00113 void TGo4CommandLine::LoadHistory()
00114 {
00115 // read command history from settings:
00116     QStringList histlist=go4sett->getCommandsHistoryGUI();
00117     InputLine->insertStringList(histlist);
00118 // prepared pre-loading of system macros:
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 //TGo4HelpWindow* helpw = new TGo4HelpWindow("class_TGo4AbstractInterface.html",0,"doxygen/go4abstractinterface");
00177 //helpw->show();
00178 }
00179 
00180 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:20 2008 for Go4-v3.04-1 by  doxygen 1.4.2