1 /*
2  *  Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 #ifndef _KIS_OVERLAYMODE_OPTION_H_
19 #define _KIS_OVERLAYMODE_OPTION_H_
20 
21 #include <QLabel>
22 
23 #include <kis_paintop_option.h>
24 
25 #include <brushengine/kis_paintop_lod_limitations.h>
26 
27 
28 class KisOverlayModeOption : public KisPaintOpOption
29 {
30 public:
KisOverlayModeOption()31     KisOverlayModeOption():
32         KisPaintOpOption(KisPaintOpOption::GENERAL, false)
33     {
34         setObjectName("KisOverlayModeOption");
35     }
36 
isCheckable()37     bool isCheckable() const override {
38         return true;
39     }
40 
writeOptionSetting(KisPropertiesConfigurationSP setting)41     void writeOptionSetting(KisPropertiesConfigurationSP setting) const override {
42         setting->setProperty("MergedPaint", isChecked());
43     }
44 
readOptionSetting(const KisPropertiesConfigurationSP setting)45     void readOptionSetting(const KisPropertiesConfigurationSP setting) override {
46         bool enabled = setting->getBool("MergedPaint");
47         setChecked(enabled);
48     }
49 
lodLimitations(KisPaintopLodLimitations * l)50     void lodLimitations(KisPaintopLodLimitations *l) const override {
51         l->blockers << KoID("colorsmudge-overlay", i18nc("PaintOp instant preview limitation", "Overlay Option"));
52     }
53 
54 };
55 
56 class KisOverlayModeOptionWidget: public KisOverlayModeOption
57 {
58 public:
KisOverlayModeOptionWidget()59     KisOverlayModeOptionWidget() {
60         QLabel* label = new QLabel(
61             i18n("Paints on the current layer\n\
62             but uses all layers that are currently visible for smudge input\n\
63             NOTE: This mode is only able to work correctly with a fully opaque background")
64         );
65 
66         label->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
67         setConfigurationPage(label);
68     }
69 };
70 
71 #endif // _KIS_OVERLAYMODE_OPTION_H_
72