13#include <QApplication>
19#include <ktoggleaction.h>
20#include <klocalizedstring.h>
179 action = actionManager->
createAction(
"convert_to_vector_selection");
182 action = actionManager->
createAction(
"convert_to_raster_selection");
185 action = actionManager->
createAction(
"convert_shapes_to_vector_selection");
188 action = actionManager->
createAction(
"convert_selection_to_shape");
197 QClipboard *cb = QApplication::clipboard();
213 m_imageView->image()->undoAdapter()->disconnect(
this);
225 m_imageView->canvasBase()->addDecoration(decoration);
244 return activeSelection && !activeSelection->
selectedRect().isEmpty();
286 if (!
m_view)
return false;
302 if (!masks.isEmpty()) {
443 if (!selection)
return;
448 if (!action->isChecked()) {
449 action->setChecked(
true);
450 Q_EMIT action->toggled(
true);
451 Q_EMIT action->triggered(
true);
467 if (shapes.isEmpty()) {
472 Q_FOREACH (
KoShape *shape, shapes) {
587 if (selectedShapes.contains(shape))
626 Q_FOREACH (
KoShape* shape, shapes) {
628 QPainterPath mappedOutline = matrix.map(shape->
outline());
662 bool isVectorLayer =
false;
663 if (currentNode->inherits(
"KisShapeLayer")) {
664 isVectorLayer =
true;
669 if (dlg->exec() == QDialog::Accepted) {
702 KisImageBarrierLock lock(image);
706 if (!device) device = node->
original();
735 actionName =
kundo2_i18n(
"Select Opaque (Subtract)");
738 actionName =
kundo2_i18n(
"Select Opaque (Intersect)");
741 actionName =
kundo2_i18n(
"Select Opaque (Symmetric Difference)");
749 rc.getRect(&x, &y, &w, &h);
756 for (
int row = y; row < h + y; ++row) {
759 }
while (deviter->
nextPixel() && selIter->nextPixel());
QList< QString > QStringList
const quint8 OPACITY_OPAQUE_U8
QSharedPointer< KoShapeStroke > KoShapeStrokeSP
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
A KisActionManager class keeps track of KisActions. These actions are always associated with the GUI....
KisAction * createAction(const QString &name)
KisAction * actionByName(const QString &name) const
KisAction * createStandardAction(KStandardAction::StandardAction, const QObject *receiver, const char *member)
void registerOperation(KisOperation *operation)
void setOperationID(const QString &id)
virtual const quint8 * oldRawData() const =0
virtual bool nextPixel()=0
KisSelectedShapesProxy selectedShapesProxy
KoShapeManager shapeManager
QPointer< KisView > imageView() const
KoShapeManager * globalShapeManager() const
KoCanvasResourceProvider * resourceManager()
static KisClipboard * instance()
bool canReselectGlobalSelection()
void addNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis, KisImageLayerAddCommand::Flags flags=KisImageLayerAddCommand::DoRedoUpdates|KisImageLayerAddCommand::DoUndoUpdates)
void beginMacro(const KUndo2MagicString ¯oName)
void slotNonUiActivatedNode(KisNodeSP node)
QRect exactBounds() const
KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w)
const KoColorSpace * colorSpace() const
KisHLineConstIteratorSP createHLineConstIteratorNG(qint32 x, qint32 y, qint32 w) const
static void runSingleCommandStroke(KisImageSP image, KUndo2Command *cmd, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
runSingleCommandStroke creates a stroke and runs cmd in it. The text() field of cmd is used as a titl...
KoSelection * selection() override
void setVisible(bool v) override
void slotStrokeSelection()
QPointer< KisSelectionDecoration > m_selectionDecoration
void imageResizeToSelection()
void setup(KisActionManager *actionManager)
KisAction * m_imageResizeToSelection
bool haveShapeSelectionWithShapes()
void fillForegroundColorOpacity()
KisAction * m_fillPatternOpacity
KisAction * m_fillBackgroundColorOpacity
void fillForegroundColor()
KisAction * m_fillPattern
KisSelectionManager(KisViewManager *view)
bool haveAnySelectionWithPixels()
Checks if the current selection is editable and has some pixels selected in the pixel selection.
bool showSelectionAsMask() const
void selectOpaqueOnNode(KisNodeSP node, SelectionAction action)
void setView(QPointer< KisView >imageView)
KisAction * m_strokeShapes
void slotToggleSelectionDecoration()
void currentSelectionChanged()
KisNodeCommandsAdapter * m_adapter
void shapeSelectionChanged()
KisClipboard * m_clipboard
bool canReselectDeactivatedSelection()
KisAction * m_fillForegroundColor
void toggleDisplaySelection()
KisAction * m_cutToNewLayer
void convertToVectorSelection()
KisAction * m_toggleSelectionOverlayMode
KisAction * m_pasteShapeStyle
void fillBackgroundColorOpacity()
bool havePixelsInClipboard()
KisAction * m_strokeSelected
bool haveShapesInClipboard()
KisAction * m_fillForegroundColorOpacity
bool haveRasterSelectionWithPixels()
QPointer< KisView > m_imageView
~KisSelectionManager() override
void fillPatternOpacity()
void clipboardDataChanged()
void copySelectionToNewLayer()
bool haveShapesSelected()
KisAction * m_fillBackgroundColor
void fillBackgroundColor()
KisAction * m_pasteAsReference
KisAction * m_toggleDisplaySelection
KisAction * m_copyToNewLayer
void paintSelectedShapes()
void displaySelectionChanged()
void convertShapesToVectorSelection()
void convertToRasterSelection()
void setSelection(KisImageWSP image)
bool blockUntilOperationsFinished(KisImageSP image)
blockUntilOperationsFinished blocks the GUI of the application until execution of actions on image is...
KisActionManager * actionManager() const
KisCanvas2 * canvasBase() const
Return the canvas base class.
KisSelectionSP selection()
KisLayerSP activeLayer()
Convenience method to get at the active layer.
KisPaintDeviceSP activeDevice()
Convenience method to get at the active paint device.
KisNodeManager * nodeManager() const
The node manager handles everything about nodes.
KisImageWSP image() const
Return the image this view is displaying.
KisCanvasResourceProvider * canvasResourceProvider()
KisStatusBar * statusBar() const
Return the wrapper class around the statusbar.
QVariant resource(int key) const
virtual quint8 opacityU8(const quint8 *pixel) const =0
void setProperty(const QString &name, const QVariant &value)
void select(KoShape *shape)
int count() const
return the selection count, i.e. the number of all selected shapes
const QList< KoShape * > selectedShapes() const
QList< KoShape * > shapes() const
QList< KoShape * > shapes
virtual QPainterPath outline() const
KoShapeContainer * parent() const
virtual void setStroke(KoShapeStrokeModelSP stroke)
QTransform absoluteTransformation() const
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
KisSharedPtr< KisPixelSelection > KisPixelSelectionSP
KUndo2MagicString kundo2_i18n(const char *text)
virtual KisPaintDeviceSP projection() const =0
virtual KisPaintDeviceSP original() const =0
virtual KisPaintDeviceSP paintDevice() const =0
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(Flags flags, KisViewManager *view)
void run(KisViewManager *view) override
void run(const QString &fillSource, KisViewManager *view)
void run(KisViewManager *view) override
virtual KisSelectionMaskSP selectionMask() const
QList< KisNodeSP > childNodes(const QStringList &nodeTypes, const KoProperties &properties) const
void run(Flags flags, KisViewManager *view)
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void invalidateOutlineCache()
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
bool hasNonEmptyPixelSelection() const
bool hasNonEmptyShapeSelection() const
KisSelectionComponent * shapeSelection
QRect selectedRect() const
bool hasShapeSelection() const
void run(KisViewManager *view) override
void run(KisViewManager *view, const StrokeSelectionOptions ¶ms)
void run(KisViewManager *view, const StrokeSelectionOptions ¶ms)