CMS 3D CMS Logo

FWGLEventHandler.cc
Go to the documentation of this file.
6 
7 #include "KeySymbols.h"
8 #include "TGLViewer.h"
9 #include "TGLWidget.h"
10 #include "TGLPhysicalShape.h"
11 #include "TGLLogicalShape.h"
12 #include "TEveGedEditor.h"
13 #include "TEveViewer.h"
14 #include "FWGeoTopNodeScene.h"
15 
16 FWGLEventHandler::FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego *l)
17  : TEveLegoEventHandler(w, obj, l), m_viewer(nullptr) {}
18 
19 //______________________________________________________________________________
20 void FWGLEventHandler::PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) {
21  // Popup context menu.
22 
23  if (event->fState & kKeyShiftMask && event->fState & kKeyControlMask) {
24  TGLEventHandler::PopupContextMenu(pshp, event, gx, gy);
25  return;
26  }
27 
28  if (m_viewer && pshp) {
29  SelectForClicked(event);
30 
31  if (pshp->GetLogical()) {
32  FWGeoTopNodeGLScene *js = dynamic_cast<FWGeoTopNodeGLScene *>(pshp->GetLogical()->GetScene());
33  if (js) {
34  js->GeoPopupMenu(gx, gy, fGLViewer);
35  return;
36  }
37  }
38 
40  }
41 }
42 
43 //______________________________________________________________________________
44 
46  Bool_t res = TEveLegoEventHandler::HandleButton(event);
47  if (m_viewer && m_viewer->requestGLHandlerPick() && event->fType == kButtonPress) {
48  Int_t x, y;
49  Window_t childdum;
50  gVirtualX->TranslateCoordinates(
51  gClient->GetDefaultRoot()->GetId(), fGLViewer->GetGLWidget()->GetId(), event->fX, event->fY, x, y, childdum);
52  fGLViewer->RequestSelect(event->fX, event->fY);
53  if (fGLViewer->GetSelRec().GetN() > 0) {
54  TGLVector3 v(event->fX, event->fY, 0.5 * fGLViewer->GetSelRec().GetMinZ());
55  fGLViewer->CurrentCamera().WindowToViewport(v);
56  v = fGLViewer->CurrentCamera().ViewportToWorld(v);
57  FW3DViewBase *v3d = dynamic_cast<FW3DViewBase *>(m_viewer);
58  v3d->setCurrentDMTVertex(v.X(), v.Y(), v.Z());
59  }
60  }
61 
62  return res;
63 }
64 
66  UInt_t keysym;
67  char tmp[2];
68  gVirtualX->LookupString(event, tmp, sizeof(tmp), keysym);
69 
70  if (m_viewer && (keysym == kKey_Enter || keysym == kKey_Return || keysym == kKey_Space)) {
71  if (event->fType == kGKeyPress) {
72  Int_t x, y;
73  Window_t childdum;
74  gVirtualX->TranslateCoordinates(
75  fGLViewer->GetGLWidget()->GetId(), gClient->GetDefaultRoot()->GetId(), event->fX, event->fY, x, y, childdum);
76 
77  fGLViewer->RequestSelect(event->fX, event->fY);
78  PopupContextMenu(fGLViewer->GetSelRec().GetPhysShape(), event, x, y);
79  }
80  return kTRUE;
81  } else {
82  return TEveLegoEventHandler::HandleKey(event);
83  }
84 }
85 
87  // Handle generic Event_t type 'event' - provided to catch focus changes
88  // and terminate any interaction in viewer.
89 
90  if (m_viewer && m_viewer->viewer() && event->fType == kFocusOut)
91  TEveGedEditor::ElementChanged(m_viewer->viewer());
92 
93  return TGLEventHandler::HandleFocusChange(event);
94 }
95 
96 //______________________________________________________________________________
98  // Handle generic Event_t type 'event' - provided to catch focus changes
99  // and terminate any interaction in viewer.
100 
101  if (m_viewer && m_viewer->viewer() && event->fType == kLeaveNotify)
102  TEveGedEditor::ElementChanged(m_viewer->viewer());
103 
104  return TGLEventHandler::HandleCrossing(event);
105 }
Bool_t HandleKey(Event_t *event) override
void GeoPopupMenu(Int_t gx, Int_t gy, TGLViewer *)
virtual bool requestGLHandlerPick() const
Definition: FWEveView.h:92
void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) override
const double w
Definition: UKUtility.cc:23
FWEveView * m_viewer
#define nullptr
Bool_t HandleCrossing(Event_t *event) override
void setCurrentDMTVertex(double x, double y, double z)
FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego *l=nullptr)
Definition: Electron.h:6
TEveViewer * viewer()
Definition: FWEveView.cc:179
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Bool_t HandleFocusChange(Event_t *event) override
Bool_t HandleButton(Event_t *event) override
tmp
align.sh
Definition: createJobs.py:716
Definition: event.py:1
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_