18#ifndef KIS_CROP_VISITOR_H_
19#define KIS_CROP_VISITOR_H_
25#include "kis_layer_visitor.h"
28#include "kis_group_layer.h"
29#include "kis_paint_layer.h"
30#include "kis_adjustment_layer.h"
31#include "kis_transaction.h"
32#include <kis_selected_transaction.h>
34class KisProgressDisplayInterface;
35class KisFilterStrategy;
37class KisCropVisitor :
public KisLayerVisitor {
41 KisCropVisitor(
const TQRect & rc,
bool movelayers =
true)
43 , m_rect(rc), m_movelayers(movelayers)
47 virtual ~KisCropVisitor()
55 bool visit(KisPaintLayer *layer)
57 KisPaintDeviceSP dev = layer->paintDevice();
58 KisSelectedTransaction * t = 0;
59 if (layer->undoAdapter() && layer->undoAdapter()->undo())
60 t =
new KisSelectedTransaction(i18n(
"Crop"), dev.data());
64 if (layer->undoAdapter() && layer->undoAdapter()->undo()) {
65 layer->undoAdapter()->addCommand(t);
69 if(layer->undoAdapter() && layer->undoAdapter()->undo()) {
70 KNamedCommand * cmd = dev->moveCommand(layer->x() - m_rect.x(), layer->y() - m_rect.y());
71 layer->undoAdapter()->addCommand(cmd);
74 layer->
setDirty(dev->image()->bounds());
78 bool visit(KisGroupLayer *layer)
85 child = child->nextSibling();
91 bool visit(KisPartLayer *)
96 virtual bool visit(KisAdjustmentLayer* layer)
virtual KisLayerSP firstChild() const
Returns the first child layer of this layer (if it supports that).
virtual void resetProjection(KisPaintDevice *to=0)
virtual void setDirty(bool propagate=true)
Set the entire layer extent dirty; this percolates up to parent layers all the way to the root layer.
virtual void setDirty(bool propagate=true)
Overridden to call the private convertMaskToSelection.