#pragma once #include "Document/EditorSession.h" #include #include #include class PickerField; class QButtonGroup; class QSlider; class QVBoxLayout; // Swift's EffectsSheet: one effect's controls, bound to its panel's layer. class EffectsSheet : public QWidget { Q_OBJECT public: EffectsSheet(EditorSession &session, LayerEffectKind kind, QWidget *parent = nullptr); ~EffectsSheet() override; private: // Swift's slider: a title, a slider, a whole-number field. struct Slider { std::function(const LayerEffects &)> value; std::function change; double low; double high; // What a field or step may reach, past the slider. double typedHigh; QSlider *slider; PickerField *field; }; void header(const QString &title, bool position); void colour(bool labelled); void slider(const QString &title, std::function(const LayerEffects &)> value, std::function change, double low, double high, const QString &unit, std::optional typedHigh = std::nullopt); // A value clamped to the typed range, as Swift's setAmount. void apply(const Slider &control, double value); void synchronize(); EditorSession &m_session; const LayerEffectKind m_kind; QVBoxLayout *const m_column; // What shows only while the effect is on its layer. std::vector m_controls; std::vector m_sliders; QButtonGroup *m_position = nullptr; // The picker's colour as last seen, Swift's onChange. std::optional m_pickerColour; };