Krotos Modules 3
Loading...
Searching...
No Matches
KwidgetGUI_XyPad.h
Go to the documentation of this file.
1namespace krotos
2{
3#if ENABLE_REFORMER
4 class KwidgetGUI_XyPad : public KwidgetGUI, public Timer
5#else
7#endif
8 {
9 public:
11
14
15 void paint(Graphics& g) override;
16 void resized() override;
17
22 void setToggleVisibility(bool visible);
23
24 void setPerformMode(bool performMode)
25 {
26 m_performMode = performMode;
27 resized();
28 }
29
30#if ENABLE_REFORMER
31 void timerCallback() override;
32
38 void startTimerSlow(bool goSlow);
39#endif
40
43 {
44 static const String ButtonNoteTriggerId;
45 };
46
47 private:
48 void showContextMenu();
49
50 bool m_goSlow = false;
51
52 struct Constants
53 {
54 const int LabelPadding{40};
55 // TODO These values should come from custom LookAndFeel object
56 const int FontSize{11};
57 const float KerningFactor{0.02f};
58 const int mediumXYWidth{160};
59 const int smallXYWidth{120};
60 const int toggleOffset{20};
61 const float smallXYSideMargin{30.0f}; // 15px left & right
62 const int contextMenuSize{20};
63 const int contextMenuMargin{28};
65
67 juce::Label m_toggleLabel;
68 std::unique_ptr<XYButtonParameterAttachment> m_xyButtonAttachment;
69 std::unique_ptr<ParameterAttachment> m_toggleLabelAttachment;
70
71 std::unique_ptr<AttachedLabel> m_editableLabelX{nullptr};
72 std::unique_ptr<AttachedLabel> m_editableLabelY{nullptr};
73
74 // Only in 4Zone mode
75 std::unique_ptr<AttachedLabel> m_editableLabelW{nullptr};
76 std::unique_ptr<AttachedLabel> m_editableLabelZ{nullptr};
77
78 // Programmatically draw the curves and line for the 4Zone and Peak modes
79 // respectively,
80 void drawDebugGraphics(Graphics& g);
81
82 bool m_toggleVisibility{false};
83 bool m_performMode{false};
84
85 std::unique_ptr<krotos::GrainVisualiser> m_grainVisualiser;
86 Range<float> m_zoomRange;
87
89
90 // LAF_V4 is the default LAF for the XYPad GUI - the component design
91 // and positioning has been set up around it.
92 LookAndFeel_V4 m_lookAndFeelv4;
93
94#if ENABLE_REFORMER
95 int m_frameCooldownCounter{0};
96 // The number of frames to paint after grain activity stops
97 static const int FRAME_COOLDOWN{1000};
98 static const int PAINT_REFRESH_TIMER_HZ_NORMAL{25};
99 static const int PAINT_REFRESH_TIMER_HZ_SLOW{20};
100 int m_activeReformerKwidgets{0};
101#endif
102
103 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(KwidgetGUI_XyPad)
104 };
105} // namespace krotos
Draws a context menu button which has a kebab icon with mouse hover states.
Definition DrawableButtonHelpers.h:55
Definition KwidgetGUI_XyPad.h:8
ContextMenuButton m_contextMenu
Definition KwidgetGUI_XyPad.h:88
~KwidgetGUI_XyPad()
Definition KwidgetGUI_XyPad.cpp:142
void setToggleVisibility(bool visible)
Definition KwidgetGUI_XyPad.cpp:580
void setPerformMode(bool performMode)
Definition KwidgetGUI_XyPad.h:24
KwidgetGUI_XyPad(Kwidget &owner)
Definition KwidgetGUI_XyPad.cpp:5
std::unique_ptr< krotos::GrainVisualiser > m_grainVisualiser
Definition KwidgetGUI_XyPad.h:85
void paint(Graphics &g) override
Definition KwidgetGUI_XyPad.cpp:256
bool m_toggleVisibility
Definition KwidgetGUI_XyPad.h:82
std::unique_ptr< AttachedLabel > m_editableLabelZ
Definition KwidgetGUI_XyPad.h:76
Range< float > m_zoomRange
Definition KwidgetGUI_XyPad.h:86
void resized() override
Definition KwidgetGUI_XyPad.cpp:338
std::unique_ptr< XYButtonParameterAttachment > m_xyButtonAttachment
Definition KwidgetGUI_XyPad.h:68
XYButton m_xyButton
Definition KwidgetGUI_XyPad.h:66
std::unique_ptr< AttachedLabel > m_editableLabelX
Definition KwidgetGUI_XyPad.h:71
struct krotos::KwidgetGUI_XyPad::Constants constants
bool m_goSlow
Definition KwidgetGUI_XyPad.h:50
bool m_performMode
Definition KwidgetGUI_XyPad.h:83
void drawDebugGraphics(Graphics &g)
Definition KwidgetGUI_XyPad.cpp:258
juce::Label m_toggleLabel
Definition KwidgetGUI_XyPad.h:67
std::unique_ptr< ParameterAttachment > m_toggleLabelAttachment
Definition KwidgetGUI_XyPad.h:69
void showContextMenu()
Definition KwidgetGUI_XyPad.cpp:588
LookAndFeel_V4 m_lookAndFeelv4
Definition KwidgetGUI_XyPad.h:92
XYButton & getXYButton()
Definition KwidgetGUI_XyPad.h:41
std::unique_ptr< AttachedLabel > m_editableLabelW
Definition KwidgetGUI_XyPad.h:75
std::unique_ptr< AttachedLabel > m_editableLabelY
Definition KwidgetGUI_XyPad.h:72
Interface for a UI Component that controls a KwidgetProcessor.
Definition KwidgetGUI.h:24
Definition Kwidget.h:8
An XY Button UI component with a puck following the mouse position.
Definition XYButton.h:15
Definition AirAbsorptionFilter.cpp:2
Definition Kwidget_XyPad.h:32
Definition KwidgetGUI_XyPad.h:43
static const String ButtonNoteTriggerId
Definition KwidgetGUI_XyPad.h:44
Definition KwidgetGUI_XyPad.h:53
const int FontSize
Definition KwidgetGUI_XyPad.h:56
const float smallXYSideMargin
Definition KwidgetGUI_XyPad.h:61
const int LabelPadding
Definition KwidgetGUI_XyPad.h:54
const int smallXYWidth
Definition KwidgetGUI_XyPad.h:59
const int contextMenuMargin
Definition KwidgetGUI_XyPad.h:63
const int mediumXYWidth
Definition KwidgetGUI_XyPad.h:58
const int contextMenuSize
Definition KwidgetGUI_XyPad.h:62
const float KerningFactor
Definition KwidgetGUI_XyPad.h:57
const int toggleOffset
Definition KwidgetGUI_XyPad.h:60