1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-----------------------------------------------------------------
19 // AliSelectorFrame class
20 // The class that deals with the selector tab of the GUI
21 // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-----------------------------------------------------------------
25 #include <TGFileDialog.h>
27 #include <TGTextEntry.h>
28 #include <TObjArray.h>
29 #include <TObjString.h>
31 #include "AliTagAnalysisFrame.h"
32 #include "AliAnalysisGUI.h"
34 #include "AliSelectorFrame.h"
36 ClassImp(AliSelectorFrame)
38 //___________________________________________________________________________
39 AliSelectorFrame::AliSelectorFrame(const TGWindow *main, UInt_t w, UInt_t h, AliAnalysisGUI *v, AliTagAnalysisFrame* t):
40 TGHorizontalFrame(main, w, h),
41 fVFrame1(0), fVFrame2(0),
42 fLabel1(0), fTextSelector(0), fButtonSelect(0), fButtonRun(0),
43 fAliAnalysisGUI(v), fTagAnalysisFrame(t) {
46 fVFrame1 = new TGVerticalFrame(this, 100, 100);
47 AddFrame(fVFrame1, new TGLayoutHints(kLHintsLeft, 5,5,5,5));
49 fLabel1 = new TGLabel(fVFrame1, new TGString("Selector macro"));
50 fVFrame1->AddFrame(fLabel1, new TGLayoutHints(kLHintsTop, 5,5,5,5));
52 fTextSelector = new TGTextEntry(fVFrame1, new TGTextBuffer(50));
53 fVFrame1->AddFrame(fTextSelector, new TGLayoutHints(kLHintsBottom, 5,5,10,5));
54 fTextSelector->SetEnabled(false);
56 fVFrame2 = new TGVerticalFrame(this, 100, 100);
57 AddFrame(fVFrame2, new TGLayoutHints(kLHintsLeft, 5,5,5,5));
59 fButtonSelect = new TGTextButton(fVFrame2, "Select...", 1);
60 fVFrame2->AddFrame(fButtonSelect, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 5,5,5,5));
61 fButtonSelect->Connect("Clicked()", "AliSelectorFrame", this, "OnSelect()");
63 fButtonRun = new TGTextButton(fVFrame2, "Run", 2);
64 fVFrame2->AddFrame(fButtonRun, new TGLayoutHints(kLHintsExpandX | kLHintsBottom, 5,5,5,5));
66 fButtonRun->Connect("Clicked()", "AliSelectorFrame", this, "OnRun()");
73 //___________________________________________________________________________
74 AliSelectorFrame::AliSelectorFrame(const AliSelectorFrame& /*frame*/):
88 //___________________________________________________________________________
89 void AliSelectorFrame::OnSelect() {
90 // When Select button is pressed.
92 const char *filetypes[] = {
97 static TString dir(".");
99 fi.fFileTypes = filetypes;
100 fi.fIniDir = StrDup(dir);
102 new TGFileDialog(gClient->GetRoot(), fAliAnalysisGUI, kFDOpen, &fi);
104 fTextSelector->SetText(fi.fFilename);
107 //___________________________________________________________________________
108 void AliSelectorFrame::OnRun() {
109 // Run the Analysis Selector
111 TString fname (fTextSelector->GetText());
113 TObjArray *a = fname.Tokenize("/");
114 TObjString * ostr = (TObjString*)a->At(a->GetEntries()-1);
116 fTagAnalysisFrame->ProcessSelector(ostr->GetString().Data());