Commit f8ff9781 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Make the drop shadow settings editable

parent 33b3c636
......@@ -22,6 +22,10 @@
#include <QTreeWidget>
#include <QListWidget>
#include <QListWidgetItem>
#include <QComboBox>
#include <QDial>
#include <QCheckBox>
#include <QSpinBox>
#include "kis_config.h"
......@@ -80,8 +84,7 @@ KisDlgLayerStyle::KisDlgLayerStyle(KisPSDLayerStyle *layerStyle, QWidget *parent
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
setStyle(layerStyle);
}
void KisDlgLayerStyle::changePage(QListWidgetItem *current, QListWidgetItem *previous)
......@@ -94,7 +97,16 @@ void KisDlgLayerStyle::changePage(QListWidgetItem *current, QListWidgetItem *pre
void KisDlgLayerStyle::setStyle(KisPSDLayerStyle *style)
{
QListWidgetItem *item = wdgLayerStyles.lstStyleSelector->item(2);
item->setCheckState(style->dropShadow().effect_enable ? Qt::Checked : Qt::Unchecked);
m_dropShadow->setDropShadow(style->dropShadow());
}
KisPSDLayerStyle *KisDlgLayerStyle::style() const
{
m_layerStyle->setDropShadow(m_dropShadow->dropShadow());
return m_layerStyle;
}
BevelAndEmboss::BevelAndEmboss(QWidget *parent)
......@@ -129,6 +141,44 @@ DropShadow::DropShadow(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
ui.doubleOpacity->setRange(0, 100, 0);
ui.doubleOpacity->setSuffix("%");
}
void DropShadow::setDropShadow(const psd_layer_effects_drop_shadow &dropShadow)
{
ui.chkLayerKnocksOutDropShadow->setChecked(dropShadow.knocks_out);
//ui.cmbContour;
ui.chkAntiAliased->setChecked(dropShadow.anti_aliased);
ui.intNoise->setValue(dropShadow.noise);
ui.cmbCompositeOp->selectCompositeOp(KoID(dropShadow.blend_mode));
ui.doubleOpacity->setValue(dropShadow.opacity);
ui.dialAngle->setValue(dropShadow.angle);
ui.intAngle->setValue(dropShadow.angle);
ui.chkUseGlobalLight->setChecked(dropShadow.use_global_light);
ui.intDistance->setValue(dropShadow.distance);
ui.intSpread->setValue(dropShadow.spread);
ui.intSize->setValue(dropShadow.size);
}
psd_layer_effects_drop_shadow DropShadow::dropShadow() const
{
psd_layer_effects_drop_shadow ds;
ds.knocks_out = ui.chkLayerKnocksOutDropShadow->isChecked();
// ui.cmbContour;
ds.anti_aliased = ui.chkAntiAliased->isChecked();
ds.noise = ui.intNoise->value();
ds.blend_mode = ui.cmbCompositeOp->selectedCompositeOp().id();
ds.opacity = ui.doubleOpacity->value();
ds.angle = ui.dialAngle->value();
ds.use_global_light = ui.chkUseGlobalLight->isChecked();
ds.distance = ui.intDistance->value();
ds.spread = ui.intSpread->value();
ds.size = ui.intSize->value();
return ds;
}
......
......@@ -20,6 +20,8 @@
#include <kdialog.h>
#include <psd.h>
#include "ui_wdglayerstyles.h"
#include "ui_wdgBevelAndEmboss.h"
#include "ui_wdgblendingoptions.h"
......@@ -72,6 +74,8 @@ private:
class DropShadow : public QWidget {
public:
DropShadow(QWidget *parent);
void setDropShadow(const psd_layer_effects_drop_shadow &dropShadow);
psd_layer_effects_drop_shadow dropShadow() const;
private:
Ui::WdgDropShadow ui;
......@@ -156,7 +160,12 @@ signals:
public slots:
void changePage(QListWidgetItem *, QListWidgetItem*);
// Sets all the widgets to the contents of the given style
void setStyle(KisPSDLayerStyle *style);
KisPSDLayerStyle *style() const;
private:
KisPSDLayerStyle *m_layerStyle;
......
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