1 /**************************************************************************
2 * Copyright(c) 1998-2003, 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 **************************************************************************/
16 /////////////////////////////////////////////////////////////////////////
17 // ALICE SETTING FRAME CLASS //
18 // Author: Mayeul ROUSSELET //
19 // e-mail: Mayeul.Rousselet@cern.ch //
20 // Last update:26/08/2003 //
21 /////////////////////////////////////////////////////////////////////////
26 #include <TGNumberEntry.h>
30 #include "AliDisplay2.h"
31 #include "AliSettingFrame.h"
33 ClassImp(AliSettingFrame)
35 //_____________________________________________________________
36 AliSettingFrame::AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
37 :TGTransientFrame(p,main,w,h)
40 fMainFrame = new TGCompositeFrame((TGWindow *)((TGTransientFrame *)this),w,h,kVerticalFrame);
42 fZoomStepFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame);
43 fZoomStepLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5);
44 fZoomStepEntry = new TGNumberEntryField(fZoomStepFrame,kIdtZoomSTEP,gAliDisplay2->GetZoomStep());
45 fZoomStepEntry->Connect("ReturnPressed()","AliSettingFrame",this,"DoSettings(Int_t)");
46 fZoomStepLabel = new TGLabel(fZoomStepFrame,"Zoom step");
47 fZoomStepFrame->AddFrame(fZoomStepLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0));
48 fZoomStepFrame->AddFrame(fZoomStepEntry,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX ,5,5,0,0));
49 fMainFrame->AddFrame(fZoomStepFrame,fZoomStepLayout);
51 fSliderStepFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame);
52 fSliderStepLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5);
53 fSliderStepEntry = new TGNumberEntryField(fSliderStepFrame,kIdtSliderSTEP,gAliDisplay2->GetSliderStep());
54 fSliderStepEntry->Connect("ReturnPressed()","AliSettingFrame",this,"DoSettings(Int_t)");
55 fSliderStepLabel = new TGLabel(fSliderStepFrame,"Slider step");
56 fSliderStepFrame->AddFrame(fSliderStepLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0));
57 fSliderStepFrame->AddFrame(fSliderStepEntry,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX ,5,5,0,0));
58 fMainFrame->AddFrame(fSliderStepFrame,fSliderStepLayout);
60 fSliderUpdateFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame);
61 fSliderUpdateLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5);
62 fSliderUpdateButton = new TGCheckButton(fSliderUpdateFrame,"Update display on slider move",kIdtSliderUPDATE);
63 fSliderUpdateButton->Connect("Clicked()","AliSettingFrame",this,"DoSettings(Int_t)");
65 if(gAliDisplay2->GetSliderUpdate()) fSliderUpdateButton->SetState(kButtonDown);
66 else fSliderUpdateButton->SetState(kButtonUp);
69 fSliderUpdateFrame->AddFrame(fSliderUpdateButton,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0));
70 fMainFrame->AddFrame(fSliderUpdateFrame,fSliderUpdateLayout);
72 AddFrame(fMainFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,0,0,0,0));
74 // position relative to the parent's window
77 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
78 (Int_t)(((TGFrame *) main)->GetWidth() - GetWidth()) >> 1,
79 (Int_t)(((TGFrame *) main)->GetHeight() - GetHeight()) >> 1,
83 SetWindowName("Setting frame");
89 //_____________________________________________________________
90 AliSettingFrame::~AliSettingFrame()
93 delete fZoomStepLayout;
94 delete fZoomStepEntry;
95 delete fZoomStepLabel;
96 delete fSliderStepLayout;
97 delete fSliderStepEntry;
98 delete fSliderStepLabel;
100 delete fSliderUpdateLayout;
101 delete fSliderUpdateButton;
104 delete fZoomStepFrame;
105 delete fSliderUpdateFrame;
106 delete fSliderStepLayout;
109 //_____________________________________________________________
110 void AliSettingFrame::DoSettings(Int_t /*pos*/) const
113 TGNumberEntryField *ne = (TGNumberEntryField *) gTQSender;
114 int id = ne->WidgetId();
117 gAliDisplay2->SetZoomStep(ne->GetNumber());
120 case kIdtSliderSTEP:{
121 gAliDisplay2->SetSliderStep(ne->GetNumber());
124 case kIdtSliderUPDATE:{
125 if(fIsLoading) return ;
126 if(gAliDisplay2->GetSliderUpdate()) gAliDisplay2->SetSliderUpdate(kFALSE);
127 else gAliDisplay2->SetSliderUpdate(kTRUE);