Krita Source Code Documentation
Loading...
Searching...
No Matches
colorrange.cc
Go to the documentation of this file.
1/*
2 * colorrange.h -- Part of Krita
3 *
4 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt (boud@valdyas.org)
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "colorrange.h"
10
11#include <klocalizedstring.h>
12#include <kis_debug.h>
13#include <kpluginfactory.h>
14
15#include "kis_image.h"
16#include "kis_layer.h"
17#include "kis_paint_device.h"
18#include "kis_global.h"
19#include "kis_types.h"
20#include "KisViewManager.h"
21#include "kis_selection.h"
24#include "kis_canvas2.h"
25#include "kis_iterator_ng.h"
26#include "kis_action.h"
27
28#include "dlg_colorrange.h"
29#include <KoColorSpace.h>
30#include <KisSignalMapper.h>
31
32K_PLUGIN_FACTORY_WITH_JSON(ColorRangeFactory, "kritacolorrange.json", registerPlugin<ColorRange>();)
33
34
35ColorRange::ColorRange(QObject *parent, const QVariantList &)
36 : KisActionPlugin(parent)
37{
38 KisAction* action = createAction("colorrange");
39 connect(action, SIGNAL(triggered()), this, SLOT(slotActivated()));
40
41
42 KisSignalMapper *mapper = new KisSignalMapper(this);
43 connect(mapper, SIGNAL(mapped(int)), SLOT(selectOpaque(int)));
44
45 action = createAction("selectopaque");
46 mapper->setMapping(action, int(SELECTION_REPLACE));
47 connect(action, SIGNAL(triggered(bool)), mapper, SLOT(map()));
48
49 action = createAction("selectopaque_add");
50 mapper->setMapping(action, int(SELECTION_ADD));
51 connect(action, SIGNAL(triggered(bool)), mapper, SLOT(map()));
52
53 action = createAction("selectopaque_subtract");
54 mapper->setMapping(action, int(SELECTION_SUBTRACT));
55 connect(action, SIGNAL(triggered(bool)), mapper, SLOT(map()));
56
57 action = createAction("selectopaque_intersect");
58 mapper->setMapping(action, int(SELECTION_INTERSECT));
59 connect(action, SIGNAL(triggered(bool)), mapper, SLOT(map()));
60}
61
65
67{
68 DlgColorRange *dlgColorRange = new DlgColorRange(viewManager(), viewManager()->mainWindowAsQWidget());
69 Q_CHECK_PTR(dlgColorRange);
70
71 dlgColorRange->exec();
72}
73
75{
76 KisNodeSP node = viewManager()->activeNode();
77 if (!node) return;
78
79 viewManager()->selectionManager()->
80 selectOpaqueOnNode(node, SelectionAction(id));
81}
82
83#include "colorrange.moc"
84
SelectionAction
@ SELECTION_REPLACE
@ SELECTION_INTERSECT
@ SELECTION_SUBTRACT
@ SELECTION_ADD
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
~ColorRange() override
Definition colorrange.cc:62
void slotActivated()
Definition colorrange.cc:66
ColorRange(QObject *parent, const QVariantList &)
Definition colorrange.cc:35
void selectOpaque(int id)
Definition colorrange.cc:74
QPointer< KisViewManager > viewManager() const
The KisSignalMapper class bundles signals from identifiable senders.
void setMapping(QObject *sender, int id)
K_PLUGIN_FACTORY_WITH_JSON(KritaASCCDLFactory, "kritaasccdl.json", registerPlugin< KritaASCCDL >();) KritaASCCDL