Krotos Modules 3
Loading...
Searching...
No Matches
AreaSelectionComp.h
Go to the documentation of this file.
1namespace krotos
2{
4 {
5 public:
6 enum class WaveformMode
7 {
10 noLine,
12 };
13
15 {
16 public:
17 virtual ~Listener() = default;
18 virtual void sampleAreaChanged(AreaSelectionComp* areaSelectionComp, float startPos, float endPos) = 0;
19 };
20
21 AreaSelectionComp(bool drawBackground, bool drawMarqueeBackground, bool useEndPoint);
22 ~AreaSelectionComp() override;
23
26
27 void paint(Graphics& g) override;
28
29 void setStartPointInPercentage(float percentage, float nonModulatedPercentage = -1);
30 void setEndPointInPercentage(float percentage);
33
34 void toggleAreaOrControl(bool toggleState);
35 void determineMinSelectionWidth(float sampleRate, float numSamples);
36
38
39 private:
40 void modifierKeysChanged(const ModifierKeys& modifiers) override;
41
42 void mouseDown(const MouseEvent& event) override;
43 void mouseDrag(const MouseEvent& event) override;
44 void mouseUp(const MouseEvent& event) override;
45
46 ListenerList<Listener> m_listeners;
47
48 float m_diff{0.f};
49
53
54 bool m_shiftKeyPressed{false};
55 bool m_shiftDragging{false};
56 bool inAreaSelectMode{true};
57
58 const float m_epsilon{0.0001f}; // use to fix issue due to numerical precision error
60
64
67
69
70 const int m_lineWidth{2};
71 const int m_clickingThreshold{5};
74
77 bool m_dragging{false};
78
80
81 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AreaSelectionComp)
82 };
83} // namespace krotos
Definition AreaSelectionComp.h:15
virtual void sampleAreaChanged(AreaSelectionComp *areaSelectionComp, float startPos, float endPos)=0
Definition AreaSelectionComp.h:4
int m_selectionStart
Definition AreaSelectionComp.h:62
const float m_epsilon
Definition AreaSelectionComp.h:58
bool m_leftBarWasSelected
Definition AreaSelectionComp.h:75
~AreaSelectionComp() override
Definition AreaSelectionComp.cpp:8
void modifierKeysChanged(const ModifierKeys &modifiers) override
Definition AreaSelectionComp.cpp:161
void setStartPointInPercentage(float percentage, float nonModulatedPercentage=-1)
Definition AreaSelectionComp.cpp:91
ListenerList< Listener > m_listeners
Definition AreaSelectionComp.h:46
const int m_clickingThreshold
Definition AreaSelectionComp.h:71
bool m_shiftDragging
Definition AreaSelectionComp.h:55
float m_diff
Definition AreaSelectionComp.h:48
void setEndPointInPercentage(float percentage)
Definition AreaSelectionComp.cpp:110
float m_endPosPercentage
Definition AreaSelectionComp.h:66
AreaSelectionComp(bool drawBackground, bool drawMarqueeBackground, bool useEndPoint)
Definition AreaSelectionComp.cpp:3
int m_grabAreaWidth
Definition AreaSelectionComp.h:59
float getStartPosInPercentage()
Definition AreaSelectionComp.cpp:127
float getEndPosInPercentage()
Definition AreaSelectionComp.cpp:133
int m_selectionEnd
Definition AreaSelectionComp.h:63
bool m_drawMarqueeBackground
Definition AreaSelectionComp.h:51
int m_minSelectionWidth
Definition AreaSelectionComp.h:73
void addListener(Listener *Listener)
Definition AreaSelectionComp.cpp:10
const int m_lineWidth
Definition AreaSelectionComp.h:70
bool m_shiftKeyPressed
Definition AreaSelectionComp.h:54
bool m_drawBackground
Definition AreaSelectionComp.h:50
void setWaveformMode(WaveformMode mode)
Definition AreaSelectionComp.cpp:282
bool m_rightBarWasSelected
Definition AreaSelectionComp.h:76
float m_additionalPercentHack
Definition AreaSelectionComp.h:68
bool m_useEndPoint
Definition AreaSelectionComp.h:52
WaveformMode m_waveformMode
Definition AreaSelectionComp.h:79
void mouseDown(const MouseEvent &event) override
Definition AreaSelectionComp.cpp:169
void toggleAreaOrControl(bool toggleState)
Definition AreaSelectionComp.cpp:139
void removeListener(Listener *Listener)
Definition AreaSelectionComp.cpp:12
void mouseUp(const MouseEvent &event) override
Definition AreaSelectionComp.cpp:268
WaveformMode
Definition AreaSelectionComp.h:7
void determineMinSelectionWidth(float sampleRate, float numSamples)
Definition AreaSelectionComp.cpp:154
bool m_dragging
Definition AreaSelectionComp.h:77
void mouseDrag(const MouseEvent &event) override
Definition AreaSelectionComp.cpp:215
void paint(Graphics &g) override
Definition AreaSelectionComp.cpp:14
int m_selectionWidth
Definition AreaSelectionComp.h:61
const int m_minSelectionWidthMin
Definition AreaSelectionComp.h:72
bool inAreaSelectMode
Definition AreaSelectionComp.h:56
float m_startPosPercentage
Definition AreaSelectionComp.h:65
Enables zooming of a painted component using special drawing methods.
Definition ZoomableComponent.h:7
Definition AirAbsorptionFilter.cpp:2