krita
kis_selection_manager.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KIS_SELECTION_MANAGER_
00019 #define KIS_SELECTION_MANAGER_
00020
00021 #include "qobject.h"
00022 #include "qptrlist.h"
00023
00024 #include "kis_image.h"
00025 #include <koffice_export.h>
00026
00027 class KAction;
00028 class KisView;
00029 class KisDoc;
00030 class KisClipboard;
00031
00036 class KRITACORE_EXPORT KisSelectionManager : public QObject {
00037
00038 Q_OBJECT
00039
00040 public:
00041
00042 KisSelectionManager(KisView * parent, KisDoc * doc);
00043 virtual ~KisSelectionManager();
00044
00045 void setup(KActionCollection * collection);
00046
00047 void addSelectionAction(KAction * action);
00048
00049 public:
00053 bool displaySelection();
00054
00055 public slots:
00056
00057 void updateGUI();
00058 void imgSelectionChanged(KisImageSP img);
00059 void clipboardDataChanged();
00060
00061 void cut();
00062 void copy();
00063 KisLayerSP paste();
00064 void pasteNew();
00065 void cutToNewLayer();
00066 void selectAll();
00067 void deselect();
00068 void clear();
00069 void fillForegroundColor();
00070 void fillBackgroundColor();
00071 void fillPattern();
00072 void reselect();
00073 void invert();
00074 void copySelectionToNewLayer();
00075 void feather();
00076 void border();
00077 void expand();
00078 void contract();
00079 void grow();
00080 void smooth();
00081 void similar();
00082 void transform();
00083 void load();
00084 void save();
00085 void toggleDisplaySelection();
00086
00087 public:
00088 void grow (Q_INT32 xradius, Q_INT32 yradius);
00089 void shrink (Q_INT32 xradius, Q_INT32 yradius, bool edge_lock);
00090 void border(Q_INT32 xradius, Q_INT32 yradius);
00091
00092
00093 void erode();
00094 void dilate();
00095
00096 private:
00097 void fill(const KisColor& color, bool fillWithPattern, const QString& transactionText);
00098
00099 void computeBorder (Q_INT32 *circ, Q_INT32 xradius, Q_INT32 yradius);
00100 inline void rotatePointers (Q_UINT8 **p, Q_UINT32 n);
00101 void computeTransition (Q_UINT8* transition, Q_UINT8** buf, Q_INT32 width);
00102
00103 KisView * m_parent;
00104 KisDoc * m_doc;
00105
00106 KisClipboard * m_clipboard;
00107
00108 KAction *m_copy;
00109 KAction *m_cut;
00110 KAction *m_paste;
00111 KAction *m_pasteNew;
00112 KAction *m_cutToNewLayer;
00113 KAction *m_selectAll;
00114 KAction *m_deselect;
00115 KAction *m_clear;
00116 KAction *m_reselect;
00117 KAction *m_invert;
00118 KAction *m_toNewLayer;
00119 KAction *m_feather;
00120 KAction *m_border;
00121 KAction *m_expand;
00122 KAction *m_smooth;
00123 KAction *m_contract;
00124 KAction *m_grow;
00125 KAction *m_similar;
00126 KAction *m_transform;
00127 KAction *m_load;
00128 KAction *m_save;
00129 KAction *m_fillForegroundColor;
00130 KAction *m_fillBackgroundColor;
00131 KAction *m_fillPattern;
00132 KToggleAction *m_toggleDisplaySelection;
00133
00134 QPtrList<KAction> m_pluginActions;
00135
00136 };
00137
00138 #endif // KIS_SELECTION_MANAGER_
|