Add ability make a selection for loop region.

This commit is contained in:
apoorv569
2021-08-11 02:32:39 +05:30
parent cf9c3f5551
commit 627cb76950
2 changed files with 174 additions and 30 deletions
+29 -4
View File
@@ -40,6 +40,13 @@ class WaveformViewer : public wxPanel
wxTimer& timer, wxInfoBar& infoBar, const std::string& configFilepath, const std::string& databaseFilepath);
~WaveformViewer();
private:
// -------------------------------------------------------------------
struct LoopPoints
{
double A, B;
};
private:
// -------------------------------------------------------------------
wxWindow* m_ParentFrame;
@@ -60,20 +67,38 @@ class WaveformViewer : public wxPanel
wxColour m_PlayheadColour;
wxColour m_WaveformColour;
// -------------------------------------------------------------------
// Selection area coordinates
wxPoint m_AnchorPoint;
wxPoint m_CurrentPoint;
private:
// -------------------------------------------------------------------
bool bBitmapDirty;
bool bBitmapDirty = false;
bool bSelectRange = false;
bool bDrawSelectedArea = false;
bool bAreaSelected = false;
private:
// -------------------------------------------------------------------
void OnPaint(wxPaintEvent& event);
void RenderPlayhead(wxDC& dc);
void UpdateWaveformBitmap();
void OnHoverPlayhead(wxMouseEvent& event);
void OnGrabPlayhead(wxMouseEvent& event);
void OnReleasePlayhead(wxMouseEvent& event);
// -------------------------------------------------------------------
void OnMouseMotion(wxMouseEvent& event);
void OnMouseLeftButtonDown(wxMouseEvent& event);
void OnMouseLeftButtonUp(wxMouseEvent& event);
// -------------------------------------------------------------------
void OnControlKeyUp(wxKeyEvent& event);
void OnControlKeyDown(wxKeyEvent& event);
public:
LoopPoints GetLoopPoints();
public:
inline bool IsBitmapDirty() { return bBitmapDirty; }
inline void SetBitmapDirty(bool dirty) { bBitmapDirty = dirty; }
inline bool IsAreaSelected() { return bAreaSelected; }
};