31 #include "RConfigure.h" 63 fLastMouseOverPos (-1, -1),
64 fLastMouseOverShape (0),
70 fMouseTimerRunning (
kFALSE),
73 fTooltipPixelTolerance (3),
75 fDoInternalSelection(
kTRUE),
76 fViewerCentricControls(
kFALSE)
239 Event_t eventSt = {
kOtherEvent, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
240 kFALSE, 0, 0, {0, 0, 0, 0, 0} };
355 Error(
"TGLEventHandler::HandleEvent",
"active drag-action at focus-in.");
362 Warning(
"TGLEventHandler::HandleEvent",
"drag-action active at focus-out.");
381 Error(
"TGLEventHandler::HandleFocusChange",
"active drag-action at focus-in.");
389 Warning(
"TGLEventHandler::HandleFocusChange",
"drag-action active at focus-out.");
406 if (event->
fCode != 0) {
413 Error(
"TGLEventHandler::HandleCrossing",
"active drag-action at enter-notify.");
422 Warning(
"TGLEventHandler::HandleCrossing",
"drag-action active at leave-notify.");
439 Info(
"TGLEventHandler::HandleButton",
"ignored - viewer is %s",
489 #if defined(R__HAS_COCOA) 525 Int_t x =
event->fX,
y =
event->fY;
553 switch (event->
fCode)
592 Warning(
"TGLEventHandler::HandleButton",
"Unexpected button-release.");
651 event->fX,
event->fY,
x,
y, childdum);
675 Info(
"TGLEventHandler::HandleDoubleClick",
"ignored - viewer is %s",
681 if (event->
fCode > 3)
708 Info(
"TGLEventHandler::HandleConfigureNotify",
"ignored - viewer is %s",
715 Int_t x =
event->fX,
y =
event->fY, w =
event->fWidth,
h =
event->fHeight;
732 Info(
"TGLViewer::HandleExpose",
"ignored - viewer is %s",
759 Info(
"TGLEventHandler::HandleKey",
"ignored - viewer is %s",
769 gVirtualX->LookupString(event, tmp,
sizeof(tmp), keysym);
771 keysym =
event->fCode;
870 Info(
"OpenGL viewer FORCED rebuild",
" ");
894 Info(
"TGLEventHandler::HandleMotion",
"ignored - viewer is %s",
923 Info(
"TGLEventHandler::HandleMotion",
"Redraw pending, ignoring.");
939 processed =
Rotate(xDelta, yDelta, mod1, mod2);
964 if (processed || changed) {
983 else return cam.
Rotate (xDelta, -yDelta, mod1, mod2);
997 Info(
"TGLEventHandler::HandleTimer",
"Redraw pending, ignoring.");
1051 Info(
"TGLViewer::HandleExpose",
"ignored - viewer is %s",
1091 static UInt_t screenW = 0, screenH = 0;
1096 if (screenW == 0 || screenH == 0) {
1097 screenW =
gClient->GetDisplayWidth();
1098 screenH =
gClient->GetDisplayHeight();
virtual void ReMouseOver(TObject *obj, UInt_t state)
Emit MouseOver signal.
TGLSelectRecord fSelRec
select record in use as selected
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Virtual method called-back after a secondary selection hit is recorded (see TGLViewer::HandleButton()...
void InvokeContextMenu(TContextMenu &menu, UInt_t x, UInt_t y) const
Request creation of context menu on shape, attached to 'menu' at screen position 'x' 'y'...
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
const Mask_t kKeyMod2Mask
void Reset()
Reset the timer.
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
void SwitchColorSet()
Switch between dark and light colorsets.
const Mask_t kKeyShiftMask
const Mask_t kKeyMod1Mask
TGLEventHandler(TGWindow *w, TObject *obj)
Constructor.
TGLLogicalShape * GetLogShape() const
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
Bool_t RequestOverlaySelect(Int_t x, Int_t y)
Post request for secondary selection rendering of selected object around the window point (x...
Float_t fMouseWheelFactor
virtual void SelectForMouseOver()
Run selection (optionally with on secondary selection) and emit corresponding MouseOver() signals...
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
virtual void UnGrabMouse()
Release mouse grab.
virtual Bool_t RotateArcBall(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Rotate the camera round view volume center established in Setup().
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Process event of type 'event' - one of EEventType types, occurring at window location px...
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
virtual void UnMouseOver(TObject *obj, UInt_t state)
Emit UnMouseOver signal.
TGLVertex3 ViewportToWorld(const TGLVertex3 &viewportVertex, TGLMatrix *modviewMat=0) const
Convert a '3D' viewport vertex to 3D world one.
Concrete physical shape - a GL drawable.
Int_t ControlValue(Int_t v)
TGLCamera & CurrentCamera() const
Bool_t fMouseTimerRunning
virtual ~TGLEventHandler()
Destructor.
const Mask_t kPointerMotionMask
Bool_t fDoInternalSelection
TGLPhysicalShape * GetPhysShape() const
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
Bool_t fDebugMode
cache logicals during scene rebuilds
TGLRedrawTimer * fRedrawTimer
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
virtual Bool_t HandleEvent(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes and terminate any interaction i...
Viewport (pixel base) 2D rectangle class.
virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Rotate the camera round view volume center established in Setup().
3 component (x/y/z) vector class.
void SetMouseOverTooltipDelay(Int_t ms)
Set delay of tooltip timer.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion 'event'.
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it...
void SetMultiple(Bool_t multi)
virtual void GrabMouse()
Acquire mouse grab.
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
virtual void StopMouseTimer()
Make sure mouse timers are not running.
TGLSelectRecord & GetSelRec()
void SetEventKeySym(UInt_t k)
virtual void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy)
Popup context menu.
const Mask_t kButtonPressMask
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
void SetMouseOverSelectDelay(Int_t ms)
Set delay of mouse-over probe (highlight).
void WindowToViewport(Int_t &, Int_t &y) const
virtual Bool_t HandleTimer(TTimer *t)
If mouse delay timer times out emit signal.
Bool_t RequestSelect(Int_t x, Int_t y)
Post request for selection render pass viewer, picking objects around the window point (x...
void RequestDraw(Int_t milliSec, Short_t redrawLOD)
Standard selection record including information about containing scene and details ob out selected ob...
virtual Bool_t HandleFocusChange(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes and terminate any interaction i...
virtual Bool_t Zoom(Int_t delta, Bool_t mod1, Bool_t mod2)=0
virtual void Clicked(TObject *obj)
Emit Clicked signal.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void SetExternalCenter(Bool_t x)
Set camera center diffrent than scene center, if enable is kTRUE.
virtual void TurnOff()
Remove timer from system timer list.
ELock CurrentLock() const
virtual Bool_t Truck(Double_t xDelta, Double_t yDelta)
Truck the camera - 'move camera parallel to film plane'.
virtual void DoubleClicked()
TGLOvlSelectRecord fOvlSelRec
current overlay element
Handles synchronous and a-synchronous timer events.
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
static constexpr double ms
Int_t fTooltipPixelTolerance
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle mouse double click 'event'.
ESecSelResult GetSecSelResult() const
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
void SetCenterVec(Double_t x, Double_t y, Double_t z)
Set camera center vector.
TGLPhysicalShape * fLastMouseOverShape
virtual void TriggerTooltip(const char *text)
Trigger display of tooltip.
virtual void ClearMouseOver()
Clear mouse-over state and emit mouse-over signals.
static const char * LockName(ELock lock)
Return name-string for given lock-type.
TObject * GetObject() const
void SetViewport(Int_t x, Int_t y, Int_t width, Int_t height)
Set viewer viewport (window area) with bottom/left at (x,y), with dimensions 'width'/'height'.
const Mask_t kButtonReleaseMask
Base-class and default implementation of event-handler for TGLViewer.
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2)
Dolly the camera - 'move camera along eye line, retaining lens focal length'.
TContextMenu * fContextMenu
external pad - remove replace with signal
TGLOverlayElement * fCurrentOvlElm
void SetHighlight(Bool_t hlt)
Mother of all ROOT objects.
virtual void RefreshPadEditor(TObject *obj=0)
Update GED editor if it is set.
virtual const char * GetTitle() const
Returns title of object.
virtual Bool_t HandleCrossing(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes and terminate any interaction i...
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left...
virtual void SelectForClicked(Event_t *event)
Run selection (optionally with on secondary selection) and emit corresponding Clicked() signals...
virtual Bool_t HandleExpose(Event_t *event)
Handle window expose 'event' - show.
virtual void MouseIdle(TGLPhysicalShape *, UInt_t, UInt_t)
Emit MouseIdle signal.
EPushAction GetPushAction() const
virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Method to handle action TGLViewer::kDragCameraRotate.
Bool_t GetExternalCenter()
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handle configure notify 'event' - a window resize/movement.
virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state)
Emit UnClicked signal with button id and modifier state.
const Mask_t kKeyControlMask
virtual void StartMouseTimer()
Start mouse timer in single-shot mode.
virtual Bool_t AlwaysSecondarySelect() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void TurnOn()
Add the timer to the system timer list.
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Bool_t fViewerCentricControls
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetStyle(Short_t st)
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button 'event'.
virtual void RemoveTooltip()
Hide the tooltip.
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard 'event'.
TGLSelectRecord fSecSelRec
select record from last select (should go to context)
void SetTime(Long_t milliSec)
virtual void Repaint()
Handle window expose 'event' - show.
TGLWidget * GetGLWidget()