Audacity  2.2.0
EnvelopeEditor Class Reference

#include <Envelope.h>

Public Member Functions

 EnvelopeEditor (Envelope &envelope, bool mirrored)
 
 ~EnvelopeEditor ()
 
bool MouseEvent (const wxMouseEvent &event, wxRect &r, const ZoomInfo &zoomInfo, bool dB, double dBRange, float zoomMin=-1.0, float zoomMax=1.0)
 

Private Member Functions

bool HandleMouseButtonDown (const wxMouseEvent &event, wxRect &r, const ZoomInfo &zoomInfo, bool dB, double dBRange, float zoomMin=-1.0, float zoomMax=1.0)
 
bool HandleDragging (const wxMouseEvent &event, wxRect &r, const ZoomInfo &zoomInfo, bool dB, double dBRange, float zoomMin=-1.0, float zoomMax=1.0, float eMin=0., float eMax=2.)
 
bool HandleMouseButtonUp ()
 
float ValueOfPixel (int y, int height, bool upper, bool dB, double dBRange, float zoomMin, float zoomMax)
 
void MoveDragPoint (const wxMouseEvent &event, wxRect &r, const ZoomInfo &zoomInfo, bool dB, double dBRange, float zoomMin, float zoomMax)
 

Private Attributes

EnvelopemEnvelope
 
const bool mMirrored
 
int mContourOffset
 Number of pixels contour is from the true envelope. More...
 
bool mUpper
 
int mButton
 
bool mDirty
 

Constructor & Destructor Documentation

EnvelopeEditor::EnvelopeEditor ( Envelope envelope,
bool  mirrored 
)
EnvelopeEditor::~EnvelopeEditor ( )

Member Function Documentation

bool EnvelopeEditor::HandleDragging ( const wxMouseEvent &  event,
wxRect &  r,
const ZoomInfo zoomInfo,
bool  dB,
double  dBRange,
float  zoomMin = -1.0,
float  zoomMax = 1.0,
float  eMin = 0.,
float  eMax = 2. 
)
private
bool EnvelopeEditor::HandleMouseButtonDown ( const wxMouseEvent &  event,
wxRect &  r,
const ZoomInfo zoomInfo,
bool  dB,
double  dBRange,
float  zoomMin = -1.0,
float  zoomMax = 1.0 
)
private

HandleMouseButtonDown either finds an existing control point or adds a NEW one which is then recorded as the point to drag. This is slightly complicated by there possibly being four control points for a given time value: We have an upper and lower envelope line. Also we may be showing an inner envelope (at 0.5 the range).

References Envelope::GetNumberOfPoints(), Envelope::GetOffset(), Envelope::GetValue(), GetWaveYPos(), Envelope::InsertOrReplace(), mButton, mContourOffset, mDirty, mEnvelope, mMirrored, mUpper, ZoomInfo::PositionToTime(), Envelope::SetDragPoint(), ZoomInfo::TimeToPosition(), and ValueOfPixel().

Referenced by MouseEvent().

bool EnvelopeEditor::HandleMouseButtonUp ( )
private

References Envelope::ClearDragPoint(), mButton, and mEnvelope.

Referenced by MouseEvent().

bool EnvelopeEditor::MouseEvent ( const wxMouseEvent &  event,
wxRect &  r,
const ZoomInfo zoomInfo,
bool  dB,
double  dBRange,
float  zoomMin = -1.0,
float  zoomMax = 1.0 
)
void EnvelopeEditor::MoveDragPoint ( const wxMouseEvent &  event,
wxRect &  r,
const ZoomInfo zoomInfo,
bool  dB,
double  dBRange,
float  zoomMin,
float  zoomMax 
)
private
float EnvelopeEditor::ValueOfPixel ( int  y,
int  height,
bool  upper,
bool  dB,
double  dBRange,
float  zoomMin,
float  zoomMax 
)
private

ValueOfPixel() converts a y position on screen to an envelope value.

Parameters
y- y position, usually of the mouse.relative to the clip.
height- height of the rectangle we are in. - true if we are on the upper line, false if on lower. - display mode either linear or log. - vertical scale, typically -1.0 - vertical scale, typically +1.0

References Envelope::ClampValue(), mContourOffset, and mEnvelope.

Referenced by HandleMouseButtonDown(), and MoveDragPoint().

Member Data Documentation

int EnvelopeEditor::mButton
private
int EnvelopeEditor::mContourOffset
private

Number of pixels contour is from the true envelope.

Referenced by HandleMouseButtonDown(), and ValueOfPixel().

bool EnvelopeEditor::mDirty
private
const bool EnvelopeEditor::mMirrored
private

Referenced by HandleMouseButtonDown().

bool EnvelopeEditor::mUpper
private

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