forked from Sneeds-Feed-and-Seed/sneedacity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnvelopeEditor.h
73 lines (56 loc) · 2.01 KB
/
EnvelopeEditor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**********************************************************************
Sneedacity: A Digital Audio Editor
EnvelopeEditor.h
Paul Licameli split this from Envelope.h
**********************************************************************/
#ifndef __SNEEDACITY_ENVELOPE_EDITOR__
#define __SNEEDACITY_ENVELOPE_EDITOR__
class wxMouseEvent;
class wxRect;
class Envelope;
struct TrackPanelDrawingContext;
class ZoomInfo;
// A class that holds state for the duration of dragging
// of an envelope point.
class SNEEDACITY_DLL_API EnvelopeEditor
{
public:
static void DrawPoints(
const Envelope &env,
TrackPanelDrawingContext &context,
const wxRect & r,
bool dB, double dBRange,
float zoomMin, float zoomMax, bool mirrored);
EnvelopeEditor(Envelope &envelope, bool mirrored);
~EnvelopeEditor();
// Event Handlers
// Each of these returns true if the envelope needs to be redrawn
bool MouseEvent(const wxMouseEvent & event, wxRect & r,
const ZoomInfo &zoomInfo, bool dB, double dBRange,
float zoomMin = -1.0, float zoomMax = 1.0);
private:
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();
private:
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);
Envelope &mEnvelope;
const bool mMirrored;
/** \brief Number of pixels contour is from the true envelope. */
int mContourOffset;
// double mInitialVal;
// int mInitialY;
bool mUpper;
int mButton;
bool mDirty;
};
#endif