Commit 1742d8c4 authored by Silvio Heinrich's avatar Silvio Heinrich

Revert "save mirror, erase, composite op and mirror settings to presets"

This reverts commit 254395339794a7d50c6c04bcf313f33a1b41cf9d.
parent a217fee2
......@@ -28,12 +28,6 @@
class QImage;
const QString KRITA_PAINTOP_OPACITY = "Krita/opacity";
const QString KRITA_PAINTOP_COMPOSITEOP = "Krita/compositeop";
const QString KRITA_PAINTOP_ERASE = "Krita/erase";
const QString KRITA_PAINTOP_MIRRORHORIZONTAL = "Krita/mirrorhorizontal";
const QString KRITA_PAINTOP_MIRRORVERTICAL = "Krita/mirrorvertical";
/**
* A KisPaintOpPreset contains a particular set of settings
* associated with a paintop, like brush, paintopsettings.
......
......@@ -33,6 +33,7 @@
#include <KoColorModelStandardIds.h>
#include <KoColorProfile.h>
#include <KoAbstractGradient.h>
#include <KoCompositeOp.h>
#include <KoResourceServerProvider.h>
#include <KoStopGradient.h>
......@@ -72,8 +73,12 @@ void KisCanvasResourceProvider::setResourceManager(KoResourceManager *resourceMa
v.setValue(KoColor(Qt::white, m_view->image()->colorSpace()));
m_resourceManager->setResource(KoCanvasResource::BackgroundColor, v);
setCurrentCompositeOp(COMPOSITE_OVER);
resetDisplayProfile();
setMirrorHorizontal(false);
setMirrorVertical(false);
connect(m_resourceManager, SIGNAL(resourceChanged(int, const QVariant &)),
this, SLOT(slotResourceChanged(int, const QVariant&)));
......@@ -303,6 +308,8 @@ void KisCanvasResourceProvider::slotResourceChanged(int key, const QVariant & re
case(CurrentKritaNode) :
emit sigNodeChanged(currentNode());
break;
case(CurrentCompositeOp) :
emit sigCompositeOpChanged(currentCompositeOp());
default:
;
// Do nothing
......@@ -348,6 +355,19 @@ const KoColorProfile *KisCanvasResourceProvider::getScreenProfile(int screen)
#endif
}
void KisCanvasResourceProvider::setCurrentCompositeOp(const QString& compositeOp)
{
QVariant v;
v.setValue(compositeOp);
m_resourceManager->setResource(CurrentCompositeOp, v);
emit sigCompositeOpChanged(compositeOp);
}
QString KisCanvasResourceProvider::currentCompositeOp() const
{
return m_resourceManager->resource(CurrentCompositeOp).value<QString>();
}
void KisCanvasResourceProvider::slotPainting()
{
if (m_fGChanged && m_enablefGChange) {
......@@ -376,9 +396,34 @@ void KisCanvasResourceProvider::removePerspectiveGrid(KisAbstractPerspectiveGrid
m_perspectiveGrids.removeOne(grid);
}
void KisCanvasResourceProvider::setPaintOpPresetModified()
void KisCanvasResourceProvider::setMirrorHorizontal(bool mirrorHorizontal)
{
m_resourceManager->setResource(MirrorHorizontal, mirrorHorizontal);
}
bool KisCanvasResourceProvider::mirrorHorizontal() const
{
return m_resourceManager->resource(MirrorHorizontal).toBool();
}
void KisCanvasResourceProvider::setMirrorVertical(bool mirrorVertical)
{
m_resourceManager->setResource(MirrorVertical, mirrorVertical);
}
bool KisCanvasResourceProvider::mirrorVertical() const
{
return m_resourceManager->resource(MirrorVertical).toBool();
}
void KisCanvasResourceProvider::setOpacity(int opacity)
{
m_resourceManager->setResource(Opacity, opacity);
}
int KisCanvasResourceProvider::opacity()
{
emit sigPaintOpPresetModified();
return m_resourceManager->resource(Opacity).toInt();
}
#include "kis_canvas_resource_provider.moc"
......@@ -59,6 +59,8 @@ public:
CurrentPaintOpPreset,
CurrentGeneratorConfiguration,
CurrentCompositeOp,
MirrorHorizontal,
MirrorVertical,
MirrorAxisCenter,
Opacity
};
......@@ -96,12 +98,22 @@ public:
KisFilterConfiguration* currentGeneratorConfiguration() const;
static const KoColorProfile* getScreenProfile(int screen = -1);
void setCurrentCompositeOp(const QString& compositeOp);
QString currentCompositeOp() const;
QList<KisAbstractPerspectiveGrid*> perspectiveGrids() const;
void addPerspectiveGrid(KisAbstractPerspectiveGrid*);
void removePerspectiveGrid(KisAbstractPerspectiveGrid*);
void setPaintOpPresetModified();
void setMirrorHorizontal(bool mirrorHorizontal);
bool mirrorHorizontal() const;
void setMirrorVertical(bool mirrorVertical);
bool mirrorVertical() const;
void setOpacity(int opacity);
int opacity();
public slots:
......@@ -143,7 +155,7 @@ signals:
void sigDisplayProfileChanged(const KoColorProfile *);
void sigGeneratorConfigurationChanged(KisFilterConfiguration * generatorConfiguration);
void sigFGColorUsed(const KoColor&);
void sigPaintOpPresetModified();
void sigCompositeOpChanged(const QString &);
private:
......
This diff is collapsed.
......@@ -54,7 +54,6 @@ class KisPaintOpSettingsWidget;
class KisCmbPaintop;
class KisCmbComposite;
class KisSliderSpinBox;
class KAction;
/**
......@@ -98,15 +97,15 @@ private:
KoID defaultPaintop(const KoInputDevice & inputDevice);
KisPaintOpPresetSP activePreset(const KoID & paintop, const KoInputDevice & inputDevice);
///Sets the current composite op in the canvas resource provide
///Composite op will be set to eraser if the erase mode of the input device is active
void compositeOpChanged();
///Sets the internal composite op, without emitting
/// @param id id of the composite op, when empty COMPOSITE_OVER will be used
void setCompositeOpInternal(const QString & id);
void setEnabledInternal(bool value);
virtual void setConfiguration(const KisPropertiesConfiguration * config);
virtual void writeConfiguration(KisPropertiesConfiguration *config) const;
private slots:
void updatePaintops();
......@@ -117,6 +116,9 @@ private slots:
void slotSetPaintop(const QString& paintOpId);
void slotSaveToFavouriteBrushes();
void slotWatchPresetNameLineEdit(const QString& text);
void slotHorizontalMirrorChanged(bool value);
void slotVerticalMirrorChanged(bool value);
void slotOpacityChanged(int value);
private:
const KoColorSpace* m_colorspace;
......@@ -130,15 +132,13 @@ private:
KisPopupButton* m_presetWidget;
KisPopupButton* m_brushChooser;
KisCmbComposite* m_cmbComposite;
QToolButton* m_eraseModeButton;
KisPaintOpPresetsPopup* m_presetsPopup;
KisPaintOpPresetsChooserPopup* m_presetsChooserPopup;
KisView2* m_view;
QPushButton* m_paletteButton;
KisPopupButton* m_workspaceWidget;
KisSliderSpinBox* m_sliderOpacity;
KAction* m_eraseAction;
KAction* m_hMirrorAction;
KAction* m_vMirrorAction;
QMap<KoID, KisPaintOpSettingsWidget*> m_paintopOptionWidgets;
KisPaintOpPresetSP m_activePreset;
......
......@@ -69,7 +69,6 @@
#include "kis_color_picker_utils.h"
#include <kis_paintop.h>
#include <kaction.h>
#include <kis_paintop_preset.h>
const int STEP = 20;
......@@ -98,7 +97,7 @@ KisToolPaint::KisToolPaint(KoCanvasBase * canvas, const QCursor & cursor)
addAction("make_brush_color_darker", m_darkerColor);
connect(kiscanvas->view()->resourceProvider(), SIGNAL(sigPaintOpPresetModified()), this, SLOT(slotPaintOpPresetModified()));
connect(kiscanvas->view()->resourceProvider(), SIGNAL(sigCompositeOpChanged(QString)), this, SLOT(slotSetCompositeMode(QString)));
connect(this, SIGNAL(sigFavoritePaletteCalled(const QPoint&)), kiscanvas, SIGNAL(favoritePaletteCalled(const QPoint&)));
connect(this, SIGNAL(sigPaintingFinished()), kiscanvas->view()->resourceProvider(), SLOT(slotPainting()));
}
......@@ -114,8 +113,11 @@ void KisToolPaint::resourceChanged(int key, const QVariant & v)
switch(key){
case(KisCanvasResourceProvider::CurrentKritaNode):
slotPaintOpPresetModified();
break;
slotSetCompositeMode(canvas()->resourceManager()->resource(KisCanvasResourceProvider::CurrentCompositeOp).toString());
break;
case(KisCanvasResourceProvider::Opacity):
slotSetOpacity(v.toInt());
break;
default: //nothing
break;
}
......@@ -130,7 +132,7 @@ void KisToolPaint::activate(ToolActivation toolActivation, const QSet<KoShape*>
{
KisTool::activate(toolActivation, shapes);
KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
slotPaintOpPresetModified();
slotSetCompositeMode(kiscanvas->view()->resourceProvider()->currentCompositeOp());
resetCursorStyle();
}
......@@ -383,14 +385,13 @@ void KisToolPaint::setupPainter(KisPainter* painter)
KisTool::setupPainter(painter);
painter->setOpacity(m_opacity);
painter->setCompositeOp(m_compositeOp);
QPointF axisCenter = canvas()->resourceManager()->resource(KisCanvasResourceProvider::MirrorAxisCenter).toPointF();
if (axisCenter.isNull()){
axisCenter = QPointF(0.5 * image()->width(), 0.5 * image()->height());
}
KisPaintOpSettingsSP settings = currentPaintOpPreset()->settings();
bool mirrorMaskHorizontal = settings->getBool(KRITA_PAINTOP_MIRRORHORIZONTAL);
bool mirrorMaskVertical = settings->getBool(KRITA_PAINTOP_MIRRORVERTICAL);
bool mirrorMaskHorizontal = canvas()->resourceManager()->resource(KisCanvasResourceProvider::MirrorHorizontal).toBool();
bool mirrorMaskVertical = canvas()->resourceManager()->resource(KisCanvasResourceProvider::MirrorVertical).toBool();
painter->setMirrorInformation(axisCenter, mirrorMaskHorizontal, mirrorMaskVertical);
}
......@@ -446,18 +447,5 @@ void KisToolPaint::makeColorLighter()
transformColor(STEP);
}
void KisToolPaint::slotPaintOpPresetModified()
{
if(!currentPaintOpPreset()) {
return;
}
KisPaintOpSettingsSP settings = currentPaintOpPreset()->settings();
slotSetOpacity(settings->getInt(KRITA_PAINTOP_OPACITY));
if(settings->getBool(KRITA_PAINTOP_ERASE)) {
slotSetCompositeMode(COMPOSITE_ERASE);
} else {
slotSetCompositeMode(settings->getString(KRITA_PAINTOP_COMPOSITEOP));
}
}
#include "kis_tool_paint.moc"
......@@ -138,8 +138,6 @@ private slots:
void slotPopupQuickHelp();
void slotSetOpacity(int opacityPerCent);
void slotPaintOpPresetModified();
void slotSetCompositeMode(const QString& compositeOp);
void makeColorLighter();
void makeColorDarker();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment