Line data Source code
1 : #pragma once
2 :
3 : #include <string>
4 :
5 : class MultiHandleSliderLogic {
6 : public:
7 : enum class HandleType { None, LoopStart, Playhead, LoopEnd, MiddleZone };
8 :
9 : explicit MultiHandleSliderLogic(double maxValue = 0.0);
10 :
11 13 : double loopStart() const { return loopStart_; }
12 7 : double playhead() const { return playhead_; }
13 14 : double loopEnd() const { return loopEnd_; }
14 2 : double maxValue() const { return maxValue_; }
15 :
16 : void setLoopStart(double v);
17 : void setPlayhead(double v);
18 : void setLoopEnd(double v);
19 : void setMaxValue(double v);
20 :
21 : HandleType hitTest(float mouseX,
22 : float trackStart, float trackWidth,
23 : float thumbRadius) const;
24 :
25 : void dragHandle(HandleType handle, float mouseX,
26 : float trackStart, float trackWidth);
27 :
28 : void dragMiddleZone(double initialLoopStart, double initialLoopEnd,
29 : float deltaPixels,
30 : float trackStart, float trackWidth);
31 :
32 : static std::string formatTime(double seconds);
33 :
34 : private:
35 : double loopStart_ = 0.0;
36 : double playhead_ = 0.0;
37 : double loopEnd_ = 0.0;
38 : double maxValue_ = 0.0;
39 : };
|