Changeset View
Changeset View
Standalone View
Standalone View
plugins/tools/basictools/kis_tool_colorpicker.h
Context not available. | |||||
2 | * Copyright (c) 1999 Matthias Elter <elter@kde.org> | 2 | * Copyright (c) 1999 Matthias Elter <elter@kde.org> | ||
---|---|---|---|---|---|
3 | * Copyright (c) 2002 Patrick Julien <freak@codepimps.org> | 3 | * Copyright (c) 2002 Patrick Julien <freak@codepimps.org> | ||
4 | * Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com> | 4 | * Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com> | ||
5 | * Copyright (c) 2018 Emmet & Eoin O'Neill <emmetoneill.pdx@gmail.com> | ||||
5 | * | 6 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by | ||
Context not available. | |||||
21 | #ifndef KIS_TOOL_COLOR_PICKER_H_ | 22 | #ifndef KIS_TOOL_COLOR_PICKER_H_ | ||
22 | #define KIS_TOOL_COLOR_PICKER_H_ | 23 | #define KIS_TOOL_COLOR_PICKER_H_ | ||
23 | 24 | | |||
24 | #include <QList> | | |||
25 | #include <QTimer> | 25 | #include <QTimer> | ||
26 | | ||||
27 | #include "KoToolFactoryBase.h" | 26 | #include "KoToolFactoryBase.h" | ||
28 | #include "ui_wdgcolorpicker.h" | 27 | #include "ui_wdgcolorpicker.h" | ||
29 | #include "kis_tool.h" | 28 | #include "kis_tool.h" | ||
30 | #include <flake/kis_node_shape.h> | | |||
31 | #include <KoIcon.h> | | |||
32 | #include <kis_icon.h> | 29 | #include <kis_icon.h> | ||
33 | #include <QKeySequence> | | |||
34 | 30 | | |||
35 | class KoResource; | 31 | class KoResource; | ||
36 | class KoColorSet; | 32 | class KoColorSet; | ||
Context not available. | |||||
51 | 47 | | |||
52 | class KisToolColorPicker : public KisTool | 48 | class KisToolColorPicker : public KisTool | ||
53 | { | 49 | { | ||
54 | | ||||
55 | Q_OBJECT | 50 | Q_OBJECT | ||
56 | Q_PROPERTY(bool toForeground READ toForeground WRITE setToForeground NOTIFY toForegroundChanged) | 51 | Q_PROPERTY(bool toForeground READ toForeground WRITE setToForeground NOTIFY toForegroundChanged) | ||
57 | 52 | | |||
58 | public: | 53 | public: | ||
59 | KisToolColorPicker(KoCanvasBase* canvas); | 54 | KisToolColorPicker(KoCanvasBase *canvas); | ||
60 | ~KisToolColorPicker() override; | 55 | ~KisToolColorPicker() override; | ||
61 | 56 | | |||
62 | public: | 57 | public: | ||
Context not available. | |||||
69 | bool normaliseValues; | 64 | bool normaliseValues; | ||
70 | bool sampleMerged; | 65 | bool sampleMerged; | ||
71 | int radius; | 66 | int radius; | ||
67 | int blend; | ||||
72 | 68 | | |||
73 | void save(ToolActivation activation) const; | 69 | void save(ToolActivation activation) const; | ||
74 | void load(ToolActivation activation); | 70 | void load(ToolActivation activation); | ||
Context not available. | |||||
81 | void continuePrimaryAction(KoPointerEvent *event) override; | 77 | void continuePrimaryAction(KoPointerEvent *event) override; | ||
82 | void endPrimaryAction(KoPointerEvent *event) override; | 78 | void endPrimaryAction(KoPointerEvent *event) override; | ||
83 | 79 | | |||
84 | void paint(QPainter& gc, const KoViewConverter &converter) override; | 80 | void paint(QPainter &gc, const KoViewConverter &converter) override; | ||
85 | 81 | | |||
86 | bool toForeground() const; | 82 | bool toForeground() const; | ||
87 | 83 | | |||
Context not available. | |||||
98 | void slotSetNormaliseValues(bool); | 94 | void slotSetNormaliseValues(bool); | ||
99 | void slotSetAddPalette(bool); | 95 | void slotSetAddPalette(bool); | ||
100 | void slotChangeRadius(int); | 96 | void slotChangeRadius(int); | ||
97 | void slotChangeBlend(int); | ||||
101 | void slotAddPalette(KoResource* resource); | 98 | void slotAddPalette(KoResource* resource); | ||
102 | void slotSetColorSource(int value); | 99 | void slotSetColorSource(int value); | ||
103 | 100 | | |||
Context not available. | |||||
106 | void pickColor(const QPointF& pos); | 103 | void pickColor(const QPointF& pos); | ||
107 | void updateOptionWidget(); | 104 | void updateOptionWidget(); | ||
108 | 105 | | |||
109 | //Configuration m_config; | 106 | // Configuration | ||
110 | QScopedPointer<KisToolUtils::ColorPickerConfig> m_config; | 107 | QScopedPointer<KisToolUtils::ColorPickerConfig> m_config; | ||
108 | | ||||
111 | ToolActivation m_toolActivationSource; | 109 | ToolActivation m_toolActivationSource; | ||
112 | bool m_isActivated; | 110 | bool m_isActivated; | ||
113 | 111 | | |||
114 | KoColor m_pickedColor; | 112 | KoColor m_pickedColor; | ||
115 | 113 | | |||
116 | // used to skip some of the tablet events and don't update the colour that often | 114 | // Used to skip some tablet events and update color less often | ||
117 | QTimer m_colorPickerDelayTimer; | 115 | QTimer m_colorPickerDelayTimer; | ||
118 | 116 | | |||
119 | ColorPickerOptionsWidget *m_optionsWidget; | 117 | ColorPickerOptionsWidget *m_optionsWidget; | ||
Context not available. | |||||
123 | 121 | | |||
124 | class KisToolColorPickerFactory : public KoToolFactoryBase | 122 | class KisToolColorPickerFactory : public KoToolFactoryBase | ||
125 | { | 123 | { | ||
126 | | ||||
127 | public: | 124 | public: | ||
128 | KisToolColorPickerFactory() | 125 | KisToolColorPickerFactory() | ||
129 | : KoToolFactoryBase("KritaSelected/KisToolColorPicker") { | 126 | : KoToolFactoryBase("KritaSelected/KisToolColorPicker") { | ||
Context not available. | |||||
137 | 134 | | |||
138 | ~KisToolColorPickerFactory() override {} | 135 | ~KisToolColorPickerFactory() override {} | ||
139 | 136 | | |||
140 | KoToolBase * createTool(KoCanvasBase *canvas) override { | 137 | KoToolBase *createTool(KoCanvasBase *canvas) override { | ||
141 | return new KisToolColorPicker(canvas); | 138 | return new KisToolColorPicker(canvas); | ||
142 | } | 139 | } | ||
143 | }; | 140 | }; | ||
144 | 141 | | |||
145 | | ||||
146 | #endif // KIS_TOOL_COLOR_PICKER_H_ | 142 | #endif // KIS_TOOL_COLOR_PICKER_H_ | ||
147 | | ||||
Context not available. |