#include <ZoomPad.h>
Public Member Functions | |
| ZoomPad (const char *name, const char *title, double xlow=0, double ylow=0, double xup=1, double yup=1) | |
| virtual | ~ZoomPad () |
| RangeDouble2D | GetCurRange () |
| void | UseCurRangeX (RangeDouble *rx) |
| void | UseCurRangeY (RangeDouble *ry) |
| RangeDouble2D | GetAxisRange () |
| void | UseAxisRangeX (RangeDouble *rx) |
| void | UseAxisRangeY (RangeDouble *ry) |
| void | Update (void) |
| void | ApplySelectionToZoom () |
| void | SetIsZoomable (bool x=true, bool y=true) |
| void | Unzoom (int number=1) |
| void | SetScales (double xscale=1.0, double yscale=1.0) |
Public Attributes | |
| SigC::Signal0< void > | selection |
Private Member Functions | |
| void | UpdateRange (void) |
| void | UpdateRangeAxis (void) |
| void | ClearSelection (void) |
| virtual void | RangeChanged () |
| virtual void | RangeAxisChanged () |
| void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Private Attributes | |
| RangeDouble2D | fCurRange |
| RangeDouble2D | fAxisRange |
| RangeInt2D | fSelRange |
| SigC::Connection | fConCurX |
| SigC::Connection | fConCurY |
| SigC::Connection | fConAxisX |
| SigC::Connection | fConAxisY |
| bool | fHaveSelection |
| bool | fDrawingSelection |
| bool | fInside |
| bool | fIsZoomableX |
| bool | fIsZoomableY |
| double | fXscale |
| double | fYscale |
Midad
Contact: bv@bnl.gov
Created on: Sat Nov 10 17:37:11 2001
Definition at line 29 of file ZoomPad.h.
|
||||||||||||||||||||||||||||
|
Definition at line 10 of file ZoomPad.cxx. References fAxisRange, fConAxisX, fConAxisY, fConCurX, fConCurY, fCurRange, UpdateRange(), UpdateRangeAxis(), Range2D< TYPE >::x, and Range2D< TYPE >::y. 00013 : TPad(name,title,xlow,ylow,xup,yup) 00014 , fHaveSelection(false) 00015 , fDrawingSelection(false) 00016 , fIsZoomableX(true) 00017 , fIsZoomableY(true) 00018 , fXscale(1.0) 00019 , fYscale(1.0) 00020 { 00021 00022 fCurRange.x->Set(0.,1.); 00023 fCurRange.y->Set(0.,1.); 00024 00025 fConCurX = 00026 fCurRange.x->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRange)); 00027 fConCurY = 00028 fCurRange.y->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRange)); 00029 fConAxisX = 00030 fAxisRange.x->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRangeAxis)); 00031 fConAxisY = 00032 fAxisRange.y->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRangeAxis)); 00033 00034 this->SetRightMargin(0.05); 00035 this->SetLeftMargin(0.05); 00036 this->SetTopMargin(0.05); 00037 this->SetBottomMargin(0.05); 00038 00039 // this->Clear(); 00040 }
|
|
|
Definition at line 42 of file ZoomPad.cxx. 00043 {
00044 }
|
|
|
Definition at line 128 of file ZoomPad.cxx. References fCurRange, fSelRange, fXscale, fYscale, Range2D< TYPE >::x, and Range2D< TYPE >::y. Referenced by MultiPage::SelectionZoom(), EVD::SelectionZoom(), and set_pad_in_history(). 00129 {
00130 if (!fHaveSelection) return;
00131
00132 double x1 = this->AbsPixeltoX(fSelRange.x->Min());
00133 double x2 = this->AbsPixeltoX(fSelRange.x->Max());
00134 double y1 = this->AbsPixeltoY(fSelRange.y->Min());
00135 double y2 = this->AbsPixeltoY(fSelRange.y->Max());
00136
00137 if (x1 > x2) { double tmp = x1; x1 = x2; x2 = tmp; }
00138 if (y1 > y2) { double tmp = y1; y1 = y2; y2 = tmp; }
00139
00140 if (fIsZoomableX) fCurRange.x->Set(x1/fXscale,x2/fXscale);
00141 if (fIsZoomableY) fCurRange.y->Set(y1/fYscale,y2/fYscale);
00142 }
|
|
|
Definition at line 119 of file ZoomPad.cxx. References fDrawingSelection, fHaveSelection, fSelRange, Range2D< TYPE >::x, and Range2D< TYPE >::y. Referenced by ExecuteEvent(). 00120 {
00121 fHaveSelection = false;
00122 fDrawingSelection = false;
00123 fSelRange.x->Set(0,0);
00124 fSelRange.y->Set(0,0);
00125 }
|
|
||||||||||||||||
|
Definition at line 57 of file ZoomPad.cxx. References ClearSelection(), fDrawingSelection, fHaveSelection, fInside, fSelRange, selection, Range2D< TYPE >::x, and Range2D< TYPE >::y. 00058 {
00059 switch (event) {
00060
00061 case kButton1Down:
00062 this->SetCursor(kHand);
00063 fInside = 1;
00064 fSelRange.x->SetMin(px);
00065 fSelRange.y->SetMin(py);
00066 break;
00067
00068 case kButton1Motion:
00069 fInside=1;
00070 if (fDrawingSelection)
00071 gVirtualX->DrawBox(fSelRange.x->Min(), fSelRange.y->Min(),
00072 fSelRange.x->Max(), fSelRange.y->Max(),
00073 TVirtualX::kHollow);
00074 fSelRange.x->SetMax(px);
00075 fSelRange.y->SetMax(py);
00076 fDrawingSelection = true;
00077 gVirtualX->DrawBox(fSelRange.x->Min(), fSelRange.y->Min(),
00078 fSelRange.x->Max(), fSelRange.y->Max(),
00079 TVirtualX::kHollow);
00080 break;
00081
00082 case kButton1Up: {
00083 this->SetCursor(kPointer);
00084
00085 Int_t dtp = this->DistancetoPrimitive(fSelRange.x->Max(),
00086 fSelRange.y->Max());
00087
00088 if (!fDrawingSelection || dtp || !fInside) {
00089 #if 0
00090 cerr
00091 << "fDrawingSelection = " << fDrawingSelection
00092 << ", DistanceToPrimitive = " << dtp
00093 << ", fInside = " << fInside
00094 << endl;
00095 #endif
00096 this->ClearSelection();
00097 break;
00098 }
00099
00100 fHaveSelection = true;
00101 fDrawingSelection = false;
00102
00103 selection.emit();
00104 break;
00105 }
00106 case kMouseLeave:
00107 fInside = false;
00108 break;
00109 case kMouseEnter:
00110 fInside = true;
00111 break;
00112 default:
00113 this->TPad::ExecuteEvent(event,px,py);
00114 break;
00115 }
00116 // cerr << "Got event: " << event << "[ " << px << " , " << py << " ]\n";
00117 }
|
|
|
Definition at line 44 of file ZoomPad.h. References RangeDouble2D. 00044 { return fAxisRange; }
|
|
|
Definition at line 41 of file ZoomPad.h. References RangeDouble2D. Referenced by main(), and set_pad_in_history(). 00041 { return fCurRange; }
|
|
|
Definition at line 179 of file ZoomPad.cxx. References fAxisRange, fConAxisX, fConAxisY, Form(), fXscale, fYscale, Range2D< TYPE >::x, and Range2D< TYPE >::y. 00180 {
00181 // Propgate Rt signal
00182 this->TPad::RangeAxisChanged();
00183
00184 double x1,y1,x2,y2;
00185 this->TPad::GetRangeAxis(x1,y1,x2,y2);
00186
00187 #if 0
00188 cerr << "ZoomPad::RangeAxisChanged: "
00189 << Form ("(%.1f, %.1f) --> (%.1f, %.1f)\n",x1,y1,x2,y2);
00190 #endif
00191
00192 // Axis Range changed, update Range objects
00193 fConAxisX.block(true);
00194 fConAxisY.block(true);
00195 fAxisRange.x->Set(x1/fXscale,x2/fXscale);
00196 fAxisRange.y->Set(y1/fYscale,y2/fYscale);
00197 fConAxisX.block(false);
00198 fConAxisY.block(false);
00199
00200
00201 }
|
|
|
Definition at line 154 of file ZoomPad.cxx. References fConCurX, fConCurY, fCurRange, Form(), fXscale, fYscale, Range2D< TYPE >::x, and Range2D< TYPE >::y. 00155 {
00156 // Propgate Rt signal
00157 this->TPad::RangeChanged();
00158
00159 double x1,y1,x2,y2;
00160 this->TPad::GetRange(x1,y1,x2,y2);
00161
00162 #if 0
00163 cerr << "ZoomPad::RangeChanged: "
00164 << Form ("(%.1f, %.1f) --> (%.1f, %.1f)\n",
00165 x1, y1, x2, y2);
00166 #endif
00167
00168 // Axis Range changed, update Range objects
00169 fConCurX.block(true);
00170 fConCurY.block(true);
00171 fCurRange.x->Set(x1/fXscale,x2/fXscale);
00172 fCurRange.y->Set(y1/fYscale,y2/fYscale);
00173 fConCurX.block(false);
00174 fConCurY.block(false);
00175
00176
00177
00178 }
|
|
||||||||||||
|
Definition at line 55 of file ZoomPad.h. References fIsZoomableX, and fIsZoomableY. 00056 { fIsZoomableX = x; fIsZoomableY = y; }
|
|
||||||||||||
|
Definition at line 46 of file ZoomPad.cxx. References fXscale, and fYscale. Referenced by TimeHist::TimeHist().
|
|
|
Definition at line 52 of file ZoomPad.cxx. 00053 {
00054 cerr << "Can't unzoom yet\n" ;
00055 }
|
|
|
Definition at line 144 of file ZoomPad.cxx. Referenced by MultiPage::UpdateCanvas(), EVD::UpdateCanvas(), and TimeHist::UpdatePad(). 00145 {
00146 this->cd();
00147 this->TPad::Update();
00148 }
|
|
|
Definition at line 204 of file ZoomPad.cxx. References fCurRange, Form(), fXscale, fYscale, Range2D< TYPE >::x, and Range2D< TYPE >::y. Referenced by UseCurRangeX(), UseCurRangeY(), and ZoomPad(). 00205 {
00206 #if 0
00207 cerr << "ZoomPad::UpdateRange: "
00208 << Form ("(%.1f, %.1f) --> (%.1f, %.1f)\n",
00209 fXscale*fCurRange.x->Min(),fYscale*fCurRange.y->Min(),
00210 fXscale*fCurRange.x->Max(),fYscale*fCurRange.y->Max());
00211 #endif
00212 bool is_editable = this->IsEditable();
00213 this->SetEditable(true);
00214 this->Range(fXscale*fCurRange.x->Min(),fYscale*fCurRange.y->Min(),
00215 fXscale*fCurRange.x->Max(),fYscale*fCurRange.y->Max());
00216 this->TPad::Modified();
00217 this->SetEditable(is_editable);
00218 }
|
|
|
Definition at line 219 of file ZoomPad.cxx. References fAxisRange, Form(), fXscale, fYscale, Range2D< TYPE >::x, and Range2D< TYPE >::y. Referenced by UseAxisRangeX(), UseAxisRangeY(), and ZoomPad(). 00220 {
00221 #if 0
00222 cerr << "ZoomPad::UpdateRangeAxis: "
00223 << Form ("(%.1f, %.1f) --> (%.1f, %.1f)\n",
00224 fXscale*fAxisRange.x->Min(),fYscale*fAxisRange.y->Min(),
00225 fXscale*fAxisRange.x->Max(),fYscale*fAxisRange.y->Max());
00226 #endif
00227 bool is_editable = this->IsEditable();
00228 this->SetEditable(true);
00229 this->RangeAxis(fXscale*fAxisRange.x->Min(),fYscale*fAxisRange.y->Min(),
00230 fXscale*fAxisRange.x->Max(),fYscale*fAxisRange.y->Max());
00231 this->TPad::Modified();
00232 this->SetEditable(is_editable);
00233 }
|
|
|
Definition at line 250 of file ZoomPad.cxx. References fAxisRange, fConAxisX, RangeDouble, UpdateRangeAxis(), and Range2D< TYPE >::x. 00251 {
00252 fConAxisX.disconnect();
00253 fAxisRange.x = rx;
00254 fConAxisX =
00255 fAxisRange.x->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRangeAxis));
00256
00257 }
|
|
|
Definition at line 258 of file ZoomPad.cxx. References fAxisRange, fConAxisY, RangeDouble, UpdateRangeAxis(), and Range2D< TYPE >::y. 00259 {
00260 fConAxisY.disconnect();
00261 fAxisRange.y = ry;
00262 fConAxisY =
00263 fAxisRange.y->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRangeAxis));
00264 }
|
|
|
Definition at line 235 of file ZoomPad.cxx. References fConCurX, fCurRange, RangeDouble, UpdateRange(), and Range2D< TYPE >::x. Referenced by MultiPage::Init(), and EVD::Init(). 00236 {
00237 fConCurX.disconnect();
00238 fCurRange.x = rx;
00239 fConCurX =
00240 fCurRange.x->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRange));
00241
00242 }
|
|
|
Definition at line 243 of file ZoomPad.cxx. References fConCurY, fCurRange, RangeDouble, UpdateRange(), and Range2D< TYPE >::y. Referenced by MultiPage::Init(), and EVD::Init(). 00244 {
00245 fConCurY.disconnect();
00246 fCurRange.y = ry;
00247 fConCurY =
00248 fCurRange.y->modified.connect(SigC::slot_class(*this,&ZoomPad::UpdateRange));
00249 }
|
|
|
Definition at line 78 of file ZoomPad.h. Referenced by RangeAxisChanged(), UpdateRangeAxis(), UseAxisRangeX(), UseAxisRangeY(), and ZoomPad(). |
|
|
Definition at line 80 of file ZoomPad.h. Referenced by RangeAxisChanged(), UseAxisRangeX(), and ZoomPad(). |
|
|
Definition at line 80 of file ZoomPad.h. Referenced by RangeAxisChanged(), UseAxisRangeY(), and ZoomPad(). |
|
|
Definition at line 80 of file ZoomPad.h. Referenced by RangeChanged(), UseCurRangeX(), and ZoomPad(). |
|
|
Definition at line 80 of file ZoomPad.h. Referenced by RangeChanged(), UseCurRangeY(), and ZoomPad(). |
|
|
Definition at line 77 of file ZoomPad.h. Referenced by ApplySelectionToZoom(), RangeChanged(), UpdateRange(), UseCurRangeX(), UseCurRangeY(), and ZoomPad(). |
|
|
Definition at line 82 of file ZoomPad.h. Referenced by ClearSelection(), and ExecuteEvent(). |
|
|
Definition at line 82 of file ZoomPad.h. Referenced by ClearSelection(), and ExecuteEvent(). |
|
|
Definition at line 82 of file ZoomPad.h. Referenced by ExecuteEvent(). |
|
|
Definition at line 83 of file ZoomPad.h. Referenced by SetIsZoomable(). |
|
|
Definition at line 83 of file ZoomPad.h. Referenced by SetIsZoomable(). |
|
|
Definition at line 79 of file ZoomPad.h. Referenced by ApplySelectionToZoom(), ClearSelection(), and ExecuteEvent(). |
|
|
Definition at line 84 of file ZoomPad.h. Referenced by ApplySelectionToZoom(), RangeAxisChanged(), RangeChanged(), SetScales(), UpdateRange(), and UpdateRangeAxis(). |
|
|
Definition at line 84 of file ZoomPad.h. Referenced by ApplySelectionToZoom(), RangeAxisChanged(), RangeChanged(), SetScales(), UpdateRange(), and UpdateRangeAxis(). |
|
|
Definition at line 39 of file ZoomPad.h. Referenced by ExecuteEvent(), MultiPage::Init(), EVD::Init(), and main(). |
1.3.9.1