chalk

kis_selection_manager.h
1/*
2 * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
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_SELECTION_MANAGER_
19#define KIS_SELECTION_MANAGER_
20
21#include "tqobject.h"
22#include "tqptrlist.h"
23
24#include "kis_image.h"
25#include <koffice_export.h>
26
27class TDEAction;
28class KisView;
29class KisDoc;
30class KisClipboard;
31
36class KRITACORE_EXPORT KisSelectionManager : public TQObject {
37
38 TQ_OBJECT
39
40
41public:
42
43 KisSelectionManager(KisView * parent, KisDoc * doc);
44 virtual ~KisSelectionManager();
45
46 void setup(TDEActionCollection * collection);
47
48 void addSelectionAction(TDEAction * action);
49
50public:
54 bool displaySelection();
55
56public slots:
57
58 void updateGUI();
59 void imgSelectionChanged(KisImageSP img);
60 void clipboardDataChanged();
61
62 void cut();
63 void copy();
64 KisLayerSP paste();
65 void pasteNew();
66 void cutToNewLayer();
67 void selectAll();
68 void deselect();
69 void clear();
70 void fillForegroundColor();
71 void fillBackgroundColor();
72 void fillPattern();
73 void reselect();
74 void invert();
75 void copySelectionToNewLayer();
76 void feather();
77 void border();
78 void expand();
79 void contract();
80 void smooth();
81 void similar();
82 void transform();
83 void load();
84 void save();
85 void toggleDisplaySelection();
86
87public:
88 void grow (TQ_INT32 xradius, TQ_INT32 yradius);
89 void shrink (TQ_INT32 xradius, TQ_INT32 yradius, bool edge_lock);
90 void border(TQ_INT32 xradius, TQ_INT32 yradius);
91 // the following functions are needed for the siox tool
92 // they might be also usefull on its own
93 void erode();
94 void dilate();
95
96private:
97 void fill(const KisColor& color, bool fillWithPattern, const TQString& transactionText);
98
99 void computeBorder (TQ_INT32 *circ, TQ_INT32 xradius, TQ_INT32 yradius);
100 inline void rotatePointers (TQ_UINT8 **p, TQ_UINT32 n);
101 void computeTransition (TQ_UINT8* transition, TQ_UINT8** buf, TQ_INT32 width);
102
103 KisView * m_parent;
104 KisDoc * m_doc;
105
106 KisClipboard * m_clipboard;
107
108 TDEAction *m_copy;
109 TDEAction *m_cut;
110 TDEAction *m_paste;
111 TDEAction *m_pasteNew;
112 TDEAction *m_cutToNewLayer;
113 TDEAction *m_selectAll;
114 TDEAction *m_deselect;
115 TDEAction *m_clear;
116 TDEAction *m_reselect;
117 TDEAction *m_invert;
118 TDEAction *m_toNewLayer;
119 TDEAction *m_feather;
120 TDEAction *m_border;
121 TDEAction *m_expand;
122 TDEAction *m_smooth;
123 TDEAction *m_contract;
124 TDEAction *m_similar;
125 TDEAction *m_transform;
126 TDEAction *m_load;
127 TDEAction *m_save;
128 TDEAction *m_fillForegroundColor;
129 TDEAction *m_fillBackgroundColor;
130 TDEAction *m_fillPattern;
131 TDEToggleAction *m_toggleDisplaySelection;
132
133 TQPtrList<TDEAction> m_pluginActions;
134
135};
136
137#endif // KIS_SELECTION_MANAGER_
The Chalk clipboard is a clipboard that can store paint devices instead of just qimage's.
A KisColor describes a color in a certain colorspace.
Definition kis_color.h:33
bool displaySelection()
This function return if the selection should be displayed.