]>
Commit | Line | Data |
---|---|---|
7bb7ac14 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, 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 | ///////////////////////////////////////////////////////////////////////// | |
17 | // ALICE SETTING FRAME CLASS // | |
18 | // Author: Mayeul ROUSSELET // | |
19 | // e-mail: Mayeul.Rousselet@cern.ch // | |
20 | // Last update:26/08/2003 // | |
21 | ///////////////////////////////////////////////////////////////////////// | |
22 | ||
23 | #include <TGWindow.h> | |
24 | #include <TGFrame.h> | |
25 | #include <TGLayout.h> | |
26 | #include <TGNumberEntry.h> | |
27 | #include <TGLabel.h> | |
28 | #include <TGButton.h> | |
29 | ||
30 | #include "AliDisplay2.h" | |
31 | #include "AliSettingFrame.h" | |
32 | ||
925e6570 | 33 | ClassImp(AliSettingFrame) |
7bb7ac14 | 34 | |
35 | //_____________________________________________________________ | |
36 | AliSettingFrame::AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h) | |
37 | :TGTransientFrame(p,main,w,h) | |
38 | { | |
39 | // Constructor | |
40 | fMainFrame = new TGCompositeFrame((TGWindow *)((TGTransientFrame *)this),w,h,kVerticalFrame); | |
41 | ||
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); | |
50 | ||
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); | |
59 | ||
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)"); | |
64 | fIsLoading = kTRUE; | |
65 | if(gAliDisplay2->GetSliderUpdate()) fSliderUpdateButton->SetState(kButtonDown); | |
66 | else fSliderUpdateButton->SetState(kButtonUp); | |
67 | fIsLoading = kFALSE; | |
68 | ||
69 | fSliderUpdateFrame->AddFrame(fSliderUpdateButton,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); | |
70 | fMainFrame->AddFrame(fSliderUpdateFrame,fSliderUpdateLayout); | |
71 | ||
72 | AddFrame(fMainFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,0,0,0,0)); | |
73 | fMainFrame->Layout(); | |
74 | // position relative to the parent's window | |
75 | Window_t wdum; | |
76 | int ax, ay; | |
77 | gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(), | |
78 | (Int_t)(((TGFrame *) main)->GetWidth() - GetWidth()) >> 1, | |
79 | (Int_t)(((TGFrame *) main)->GetHeight() - GetHeight()) >> 1, | |
80 | ax, ay, wdum); | |
81 | Move(ax, ay); | |
82 | ||
83 | SetWindowName("Setting frame"); | |
84 | MapSubwindows(); | |
85 | MapWindow(); | |
86 | Layout(); | |
87 | } | |
88 | ||
89 | //_____________________________________________________________ | |
90 | AliSettingFrame::~AliSettingFrame() | |
91 | { | |
92 | // Destructor | |
93 | delete fZoomStepLayout; | |
94 | delete fZoomStepEntry; | |
95 | delete fZoomStepLabel; | |
96 | delete fSliderStepLayout; | |
97 | delete fSliderStepEntry; | |
98 | delete fSliderStepLabel; | |
99 | ||
100 | delete fSliderUpdateLayout; | |
101 | delete fSliderUpdateButton; | |
102 | ||
103 | delete fMainFrame; | |
104 | delete fZoomStepFrame; | |
105 | delete fSliderUpdateFrame; | |
106 | delete fSliderStepLayout; | |
107 | } | |
108 | ||
109 | //_____________________________________________________________ | |
110 | void AliSettingFrame::DoSettings(Int_t /*pos*/) const | |
111 | { | |
112 | // Updates settings | |
113 | TGNumberEntryField *ne = (TGNumberEntryField *) gTQSender; | |
114 | int id = ne->WidgetId(); | |
115 | switch(id){ | |
116 | case kIdtZoomSTEP:{ | |
117 | gAliDisplay2->SetZoomStep(ne->GetNumber()); | |
118 | } | |
119 | break; | |
120 | case kIdtSliderSTEP:{ | |
121 | gAliDisplay2->SetSliderStep(ne->GetNumber()); | |
122 | } | |
123 | break; | |
124 | case kIdtSliderUPDATE:{ | |
125 | if(fIsLoading) return ; | |
126 | if(gAliDisplay2->GetSliderUpdate()) gAliDisplay2->SetSliderUpdate(kFALSE); | |
127 | else gAliDisplay2->SetSliderUpdate(kTRUE); | |
128 | } | |
129 | break; | |
130 | default: break; | |
131 | } | |
132 | } | |
133 |