From 114145dd2f5fecdbc879e0aa30ff10bc0ed5d991 Mon Sep 17 00:00:00 2001 From: panos Date: Mon, 13 Nov 2006 12:59:06 +0000 Subject: [PATCH] Adding the AliSelectorFrame class: the selector frame of the GUI (fourth tab). --- ANALYSIS/Aliengui/AliSelectorFrame.cxx | 112 +++++++++++++++++++++++++ ANALYSIS/Aliengui/AliSelectorFrame.h | 64 ++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 ANALYSIS/Aliengui/AliSelectorFrame.cxx create mode 100644 ANALYSIS/Aliengui/AliSelectorFrame.h diff --git a/ANALYSIS/Aliengui/AliSelectorFrame.cxx b/ANALYSIS/Aliengui/AliSelectorFrame.cxx new file mode 100644 index 00000000000..6588a65d799 --- /dev/null +++ b/ANALYSIS/Aliengui/AliSelectorFrame.cxx @@ -0,0 +1,112 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//----------------------------------------------------------------- +// AliSelectorFrame class +// The class that deals with the selector tab of the GUI +// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch +//----------------------------------------------------------------- + +#include "TGFileDialog.h" +#include "TGTextEntry.h" +#include "TGLabel.h" + +#include "TObjString.h" + +#include "AliTagAnalysisFrame.h" +#include "AliAnalysisGUI.h" + +#include "AliSelectorFrame.h" + +ClassImp(AliSelectorFrame) + +//___________________________________________________________________________ +AliSelectorFrame::AliSelectorFrame(const TGWindow *main, UInt_t w, UInt_t h, AliAnalysisGUI *v, AliTagAnalysisFrame* t): TGHorizontalFrame(main, w, h), fAliAnalysisGUI(v), fTagAnalysisFrame(t) { + // ctor. + + fVFrame1 = new TGVerticalFrame(this, 100, 100); + AddFrame(fVFrame1, new TGLayoutHints(kLHintsLeft, 5,5,5,5)); + + fLabel1 = new TGLabel(fVFrame1, new TGString("Selector macro")); + fVFrame1->AddFrame(fLabel1, new TGLayoutHints(kLHintsTop, 5,5,5,5)); + + fTextSelector = new TGTextEntry(fVFrame1, new TGTextBuffer(50)); + fVFrame1->AddFrame(fTextSelector, new TGLayoutHints(kLHintsBottom, 5,5,10,5)); + fTextSelector->SetEnabled(false); + + fVFrame2 = new TGVerticalFrame(this, 100, 100); + AddFrame(fVFrame2, new TGLayoutHints(kLHintsLeft, 5,5,5,5)); + + fButtonSelect = new TGTextButton(fVFrame2, "Select...", 1); + fVFrame2->AddFrame(fButtonSelect, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 5,5,5,5)); + fButtonSelect->Connect("Clicked()", "AliSelectorFrame", this, "OnSelect()"); + + fButtonRun = new TGTextButton(fVFrame2, "Run", 2); + fVFrame2->AddFrame(fButtonRun, new TGLayoutHints(kLHintsExpandX | kLHintsBottom, 5,5,5,5)); + + fButtonRun->Connect("Clicked()", "AliSelectorFrame", this, "OnRun()"); + + MapWindow(); + Resize(); + MapSubwindows(); +} + +//___________________________________________________________________________ +AliSelectorFrame::AliSelectorFrame(const AliSelectorFrame&): + fVFrame1(0), + fVFrame2(0), + fTextSelector(0), + fButtonSelect(0), + fButtonRun(0), + fAliAnalysisGUI(0), + fTagAnalysisFrame(0) +{ + //copy constructor +} + +//___________________________________________________________________________ +void AliSelectorFrame::OnSelect() { + // When Select button is pressed. + + const char *filetypes[] = { + "macro files", "*.C", + 0, 0 + }; + + static TString dir("."); + TGFileInfo fi; + fi.fFileTypes = filetypes; + fi.fIniDir = StrDup(dir); + + new TGFileDialog(gClient->GetRoot(), fAliAnalysisGUI, kFDOpen, &fi); + + fTextSelector->SetText(fi.fFilename); +} + +//___________________________________________________________________________ +void AliSelectorFrame::OnRun() { + // Run the Analysis Selector + + TString fname (fTextSelector->GetText()); + + TObjArray *a = fname.Tokenize("/"); + TObjString * ostr = (TObjString*)a->At(a->GetEntries()-1); + + fTagAnalysisFrame->ProcessSelector(ostr->GetString().Data()); + + delete a; +} diff --git a/ANALYSIS/Aliengui/AliSelectorFrame.h b/ANALYSIS/Aliengui/AliSelectorFrame.h new file mode 100644 index 00000000000..5284a94c226 --- /dev/null +++ b/ANALYSIS/Aliengui/AliSelectorFrame.h @@ -0,0 +1,64 @@ +#ifndef ALISELECTORFRAME_H +#define ALISELECTORFRAME_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// Class AliSelectorFrame +// AliSelectorFrame class that describes the selector frame of the GUI +// +// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch +//------------------------------------------------------------------------- + + + +////////////////////////////////////////////////////////////////////////// +// // +// AliSelectorFrame // +// // +// Selector tab of the GUI. // +// // +////////////////////////////////////////////////////////////////////////// + +#include + +class TGCanvas; +class TGVerticalFrame; +class TGTextEntry; +class TGButton; +class TGLabel; + +class AliAnalysisGUI; + +//___________________________________________________________________________ +class AliSelectorFrame : public TGHorizontalFrame { + + public: + AliSelectorFrame(const TGWindow *main, UInt_t w, UInt_t h, AliAnalysisGUI*, AliTagAnalysisFrame*); + AliSelectorFrame(const AliSelectorFrame& fSelectorFrame); + + //___________________________________________________________________________ + //slots + void OnSelect(); + void OnRun(); + + //___________________________________________________________________________ + private: + TGVerticalFrame *fVFrame1, *fVFrame2; //vertical frames + TGLabel *fLabel1; //macro label + TGTextEntry *fTextSelector; //selector text box + TGButton *fButtonSelect; //select button + TGButton *fButtonRun; //run button + + AliAnalysisGUI *fAliAnalysisGUI; //analysis gui pointer + AliTagAnalysisFrame *fTagAnalysisFrame; //tag frame pointer + + AliSelectorFrame & operator=(const AliSelectorFrame & ) {return *this;} + + ClassDef(AliSelectorFrame, 0); // SelectorFrame +}; + + +#endif -- 2.43.0