Audacity  2.2.0
ZoomHandle Class Referencefinal

#include <ZoomHandle.h>

Inheritance diagram for ZoomHandle:

Public Member Functions

 ZoomHandle ()
ZoomHandleoperator= (const ZoomHandle &)=default
virtual ~ZoomHandle ()
Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
HitTestPreview Preview (const TrackPanelMouseState &state, const AudacityProject *pProject) override
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Result Cancel (AudacityProject *pProject) override
void DrawExtras (DrawingPass pass, wxDC *dc, const wxRegion &updateRegion, const wxRect &panelRect) override
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
virtual void Enter (bool forward)
virtual bool HasRotation () const
virtual bool Rotate (bool forward)
virtual bool HasEscape () const
virtual bool Escape ()
virtual bool StopsOnKeystroke ()
virtual void OnProjectChange (AudacityProject *pProject)
Result GetChangeHighlight () const
void SetChangeHighlight (Result val)

Static Public Member Functions

static UIHandlePtr HitAnywhere (std::weak_ptr< ZoomHandle > &holder)
static UIHandlePtr HitTest (std::weak_ptr< ZoomHandle > &holder, const wxMouseState &state)
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)

Private Member Functions

 ZoomHandle (const ZoomHandle &)=delete
bool IsDragZooming () const

Static Private Member Functions

static HitTestPreview HitPreview (const wxMouseState &state, const AudacityProject *pProject)

Private Attributes

int mZoomStart {}
int mZoomEnd {}
wxRect mRect {}

Additional Inherited Members

- Public Types inherited from UIHandle
enum  DrawingPass { Cells, Panel }
using Result = unsigned
using Cell = TrackPanelCell
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }

Constructor & Destructor Documentation

ZoomHandle::ZoomHandle ( const ZoomHandle )
ZoomHandle::ZoomHandle ( )

This class takes care of our different zoom possibilities. It is possible for a user to just "zoom in" or "zoom out," but it is also possible for a user to drag and select an area that he or she wants to be zoomed in on. We use mZoomStart and mZoomEnd to track the beginning and end of such a zoom area. Note that the ViewInfo actually keeps track of our zoom constant, so we achieve zooming by altering the zoom constant and forcing a refresh.

ZoomHandle::~ZoomHandle ( )

Member Function Documentation

UIHandle::Result ZoomHandle::Cancel ( AudacityProject pProject)

Implements UIHandle.

References RefreshCode::RefreshAll.

UIHandle::Result ZoomHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject pProject 

Zoom button down, record the position.

Implements UIHandle.

References TrackPanelMouseEvent::event, TrackPanelMouseEvent::rect, and RefreshCode::RefreshNone.

UIHandle::Result ZoomHandle::Drag ( const TrackPanelMouseEvent event,
AudacityProject pProject 
void ZoomHandle::DrawExtras ( DrawingPass  pass,
wxDC *  dc,
const wxRegion &  updateRegion,
const wxRect &  panelRect 

Reimplemented from UIHandle.

References min().

UIHandlePtr ZoomHandle::HitAnywhere ( std::weak_ptr< ZoomHandle > &  holder)

References AssignUIHandlePtr().

Referenced by HitPreview(), and Track::HitTest().

HitTestPreview ZoomHandle::HitPreview ( const wxMouseState &  state,
const AudacityProject pProject 

References _(), HitAnywhere(), and MakeCursor().

UIHandlePtr ZoomHandle::HitTest ( std::weak_ptr< ZoomHandle > &  holder,
const wxMouseState &  state 

Referenced by Track::HitTest().

bool ZoomHandle::IsDragZooming ( ) const

References DragThreshold, mZoomEnd, and mZoomStart.

ZoomHandle& ZoomHandle::operator= ( const ZoomHandle )
HitTestPreview ZoomHandle::Preview ( const TrackPanelMouseState state,
const AudacityProject pProject 

Implements UIHandle.

References TrackPanelMouseState::state.

UIHandle::Result ZoomHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent 

This actually sets the Zoom value when you're done doing a drag zoom.

This handles normal Zoom In/Out, if you just clicked; IOW, if you were NOT dragging to zoom an area.

MAGIC NUMBER: We've got several in this method.

Implements UIHandle.

References TrackPanelMouseEvent::event, RefreshCode::FixScrollbars, ZoomInfo::GetDefaultZoom(), AudacityProject::GetViewInfo(), ZoomInfo::h, ZoomInfo::PositionToTime(), RefreshCode::RefreshAll, ZoomInfo::SetZoom(), and ZoomInfo::ZoomBy().

Member Data Documentation

wxRect ZoomHandle::mRect {}
int ZoomHandle::mZoomEnd {}

Referenced by IsDragZooming().

int ZoomHandle::mZoomStart {}

Referenced by IsDragZooming().

The documentation for this class was generated from the following files: