13#include <QApplication>
19#include <ktoggleaction.h>
20#include <klocalizedstring.h>
103 connect(action, SIGNAL(triggered()),
this, SLOT(
copySharp()));
106 connect(action, SIGNAL(triggered()),
this, SLOT(
cutSharp()));
180 action = actionManager->
createAction(
"convert_to_vector_selection");
183 action = actionManager->
createAction(
"convert_to_raster_selection");
186 action = actionManager->
createAction(
"convert_shapes_to_vector_selection");
189 action = actionManager->
createAction(
"convert_selection_to_shape");
198 action->setVisible(
false);
206 QClipboard *cb = QApplication::clipboard();
224 m_imageView->image()->undoAdapter()->disconnect(
this);
236 m_imageView->canvasBase()->addDecoration(decoration);
255 return activeSelection && !activeSelection->
selectedRect().isEmpty();
297 if (!
m_view)
return false;
313 if (!masks.isEmpty()) {
454 if (!selection)
return;
459 if (!action->isChecked()) {
460 action->setChecked(
true);
461 Q_EMIT action->toggled(
true);
462 Q_EMIT action->triggered(
true);
478 if (shapes.isEmpty()) {
483 Q_FOREACH (
KoShape *shape, shapes) {
613 if (selectedShapes.contains(shape))
652 Q_FOREACH (
KoShape* shape, shapes) {
654 QPainterPath mappedOutline = matrix.map(shape->
outline());
688 bool isVectorLayer =
false;
689 if (currentNode->inherits(
"KisShapeLayer")) {
690 isVectorLayer =
true;
695 if (dlg->exec() == QDialog::Accepted) {
728 KisImageBarrierLock lock(image);
732 if (!device) device = node->
original();
761 actionName =
kundo2_i18n(
"Select Opaque (Subtract)");
764 actionName =
kundo2_i18n(
"Select Opaque (Intersect)");
767 actionName =
kundo2_i18n(
"Select Opaque (Symmetric Difference)");
775 rc.getRect(&x, &y, &w, &h);
782 for (
int row = y; row < h + y; ++row) {
785 }
while (deviter->
nextPixel() && selIter->nextPixel());
QList< QString > QStringList
const quint8 OPACITY_OPAQUE_U8
QSharedPointer< KoShapeStroke > KoShapeStrokeSP
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()
static KisConfigNotifier * instance()
void notifyConfigChanged(void)
bool selectionActionBar(bool defaultValue=false) const
void setSelectionActionBar(bool value)
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_enableSelectionActionsPanel
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()
void enableSelectionActionsPanel(bool enabled)
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)