Krita Source Code Documentation
Loading...
Searching...
No Matches
KisCurveOptionWidget.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KisCurveOptionWidget_H
7#define KisCurveOptionWidget_H
8
10
11class Ui_WdgCurveOption2;
12class KisCurveOption;
13class QComboBox;
14
15#include <KisCurveOptionData.h>
19#include <lager/cursor.hpp>
20#include <lager/constant.hpp>
21
22
23class PAINTOP_EXPORT KisCurveOptionWidget : public KisPaintOpOption
24{
25 Q_OBJECT
26public:
27 enum Flag {
28 None = 0x0,
29 SupportsCommonCurve = 0x1,
30 SupportsCurveMode = 0x2,
31 UseFloatingPointStrength = 0x4,
32 };
33
34 Q_DECLARE_FLAGS(Flags, Flag)
35
36public:
38
39 KisCurveOptionWidget(lager::cursor<KisCurveOptionDataCommon> optionData,
41 lager::reader<bool> enabledLink = lager::make_constant(true),
42 std::optional<lager::reader<std::tuple<qreal, qreal>>> strengthRangeReader = std::nullopt);
43
44 KisCurveOptionWidget(lager::cursor<KisCurveOptionDataCommon> optionData,
46 const QString &curveMinLabel, const QString &curveMaxLabel,
47 lager::reader<bool> enabledLink = lager::make_constant(true),
48 std::optional<lager::reader<std::tuple<qreal, qreal>>> strengthRangeReader = std::nullopt);
49
50 KisCurveOptionWidget(lager::cursor<KisCurveOptionDataCommon> optionData,
52 const QString &curveMinLabel, const QString &curveMaxLabel,
53 int curveMinValue, int curveMaxValue, const QString &curveValueSuffix,
54 lager::reader<bool> enabledLink = lager::make_constant(true),
55 std::optional<lager::reader<std::tuple<qreal, qreal>>> strengthRangeReader = std::nullopt);
56
57 KisCurveOptionWidget(lager::cursor<KisCurveOptionDataCommon> optionData,
58 PaintopCategory category,
59 const QString &curveMinLabel, const QString &curveMaxLabel,
60 int curveMinValue, int curveMaxValue, const QString &curveValueSuffix,
61 const QString &strengthPrefix, const QString &strengthSuffix,
62 qreal strengthDisplayMultiplier,
63 lager::reader<bool> enabledLink = lager::make_constant(true),
64 std::optional<lager::reader<std::tuple<qreal, qreal>>> strengthRangeReader = std::nullopt);
65
66protected:
67 KisCurveOptionWidget(lager::cursor<KisCurveOptionDataCommon> optionData,
69 const QString &strengthPrefix, const QString &strengthSuffix,
70 qreal strengthDisplayMultiplier,
71 lager::reader<bool> enabledLink,
72 std::optional<lager::reader<std::tuple<qreal, qreal>>> strengthRangeReader,
73 KisCurveRangeModelFactory curveRangeModelFactory,
76 Flags flags);
77public:
78
79 ~KisCurveOptionWidget() override;
80
81 void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
82 void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
83
84 bool isCheckable() const override;
85 void show();
86
87protected:
88 lager::cursor<qreal> strengthValueDenorm();
89
90 void setCurveWidgetsEnabled(bool value);
91 QWidget* curveWidget();
92
93protected Q_SLOTS:
94 void updateThemedIcons();
95
96
97 // curve shape preset buttons
98 void changeCurveLinear();
99 void changeCurveReverseLinear();
100 void changeCurveSShape();
101 void changeCurveReverseSShape();
102 void changeCurveJShape();
103 void changeCurveLShape();
104 void changeCurveUShape();
105 void changeCurveArchShape();
106
107
108protected:
109 QWidget* m_widget {nullptr};
110 Ui_WdgCurveOption2* m_curveOptionWidget {nullptr};
111 QScopedPointer<KisCurveOptionInputControlsStrategyInterface> m_curveInputControlsStrategy;
112 QScopedPointer<KisCurveOptionRangeControlsStrategyInterface> m_curveRangeControlsStrategy;
113 QComboBox* m_curveMode {nullptr};
114 struct Private;
115 const QScopedPointer<Private> m_d;
116};
117
118Q_DECLARE_OPERATORS_FOR_FLAGS(KisCurveOptionWidget::Flags)
119
120#endif // KisCurveOptionWidget_H
float value(const T *src, size_t ch)
std::function< KisCurveOptionInputControlsStrategyInterface *( KisCurveRangeModelInterface *, KisCurveWidget *, QWidget *, QWidget *)> KisCurveOptionInputControlsStrategyFactory
std::function< KisCurveOptionRangeControlsStrategyInterface *( KisCurveRangeModelInterface *, QWidget *)> KisCurveOptionRangeControlsStrategyFactory
std::function< KisCurveRangeModelInterface *(lager::cursor< QString >, lager::cursor< QRectF >, lager::reader< QString >, lager::reader< int >)> KisCurveRangeModelFactory
Q_DECLARE_FLAGS(KisUpdaterContextSnapshotEx, KisUpdaterContextSnapshotExTag)
QScopedPointer< KisCurveOptionInputControlsStrategyInterface > m_curveInputControlsStrategy
const QScopedPointer< Private > m_d
QScopedPointer< KisCurveOptionRangeControlsStrategyInterface > m_curveRangeControlsStrategy
virtual void readOptionSetting(const KisPropertiesConfigurationSP setting)
virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const
virtual bool isCheckable() const
Q_DECLARE_OPERATORS_FOR_FLAGS(KisBaseRectsWalker::SubtreeVisitFlags)