]>
Commit | Line | Data |
---|---|---|
114145dd | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
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 | //----------------------------------------------------------------- | |
23 | ||
114145dd | 24 | |
0b28fd57 | 25 | #include <TGFileDialog.h> |
26 | #include <TGLabel.h> | |
27 | #include <TGTextEntry.h> | |
28 | #include <TObjArray.h> | |
29 | #include <TObjString.h> | |
114145dd | 30 | |
31 | #include "AliTagAnalysisFrame.h" | |
32 | #include "AliAnalysisGUI.h" | |
33 | ||
34 | #include "AliSelectorFrame.h" | |
35 | ||
36 | ClassImp(AliSelectorFrame) | |
37 | ||
38 | //___________________________________________________________________________ | |
a313abd0 | 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) { | |
114145dd | 44 | // ctor. |
45 | ||
46 | fVFrame1 = new TGVerticalFrame(this, 100, 100); | |
47 | AddFrame(fVFrame1, new TGLayoutHints(kLHintsLeft, 5,5,5,5)); | |
48 | ||
49 | fLabel1 = new TGLabel(fVFrame1, new TGString("Selector macro")); | |
50 | fVFrame1->AddFrame(fLabel1, new TGLayoutHints(kLHintsTop, 5,5,5,5)); | |
51 | ||
52 | fTextSelector = new TGTextEntry(fVFrame1, new TGTextBuffer(50)); | |
53 | fVFrame1->AddFrame(fTextSelector, new TGLayoutHints(kLHintsBottom, 5,5,10,5)); | |
54 | fTextSelector->SetEnabled(false); | |
55 | ||
56 | fVFrame2 = new TGVerticalFrame(this, 100, 100); | |
57 | AddFrame(fVFrame2, new TGLayoutHints(kLHintsLeft, 5,5,5,5)); | |
58 | ||
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()"); | |
62 | ||
63 | fButtonRun = new TGTextButton(fVFrame2, "Run", 2); | |
64 | fVFrame2->AddFrame(fButtonRun, new TGLayoutHints(kLHintsExpandX | kLHintsBottom, 5,5,5,5)); | |
65 | ||
66 | fButtonRun->Connect("Clicked()", "AliSelectorFrame", this, "OnRun()"); | |
67 | ||
68 | MapWindow(); | |
69 | Resize(); | |
70 | MapSubwindows(); | |
71 | } | |
72 | ||
73 | //___________________________________________________________________________ | |
5e7c86a9 | 74 | AliSelectorFrame::AliSelectorFrame(const AliSelectorFrame& /*frame*/): |
24393e4f | 75 | TGHorizontalFrame(), |
114145dd | 76 | fVFrame1(0), |
77 | fVFrame2(0), | |
24393e4f | 78 | fLabel1(0), |
114145dd | 79 | fTextSelector(0), |
80 | fButtonSelect(0), | |
81 | fButtonRun(0), | |
82 | fAliAnalysisGUI(0), | |
83 | fTagAnalysisFrame(0) | |
84 | { | |
85 | //copy constructor | |
86 | } | |
87 | ||
88 | //___________________________________________________________________________ | |
89 | void AliSelectorFrame::OnSelect() { | |
90 | // When Select button is pressed. | |
91 | ||
92 | const char *filetypes[] = { | |
93 | "macro files", "*.C", | |
94 | 0, 0 | |
95 | }; | |
96 | ||
97 | static TString dir("."); | |
98 | TGFileInfo fi; | |
99 | fi.fFileTypes = filetypes; | |
100 | fi.fIniDir = StrDup(dir); | |
101 | ||
102 | new TGFileDialog(gClient->GetRoot(), fAliAnalysisGUI, kFDOpen, &fi); | |
103 | ||
104 | fTextSelector->SetText(fi.fFilename); | |
105 | } | |
106 | ||
107 | //___________________________________________________________________________ | |
108 | void AliSelectorFrame::OnRun() { | |
109 | // Run the Analysis Selector | |
110 | ||
111 | TString fname (fTextSelector->GetText()); | |
112 | ||
113 | TObjArray *a = fname.Tokenize("/"); | |
114 | TObjString * ostr = (TObjString*)a->At(a->GetEntries()-1); | |
115 | ||
116 | fTagAnalysisFrame->ProcessSelector(ostr->GetString().Data()); | |
117 | ||
118 | delete a; | |
119 | } |