Commit f8ff9781 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Make the drop shadow settings editable

parent 33b3c636
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QListWidget> #include <QListWidget>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QComboBox>
#include <QDial>
#include <QCheckBox>
#include <QSpinBox>
#include "kis_config.h" #include "kis_config.h"
...@@ -80,8 +84,7 @@ KisDlgLayerStyle::KisDlgLayerStyle(KisPSDLayerStyle *layerStyle, QWidget *parent ...@@ -80,8 +84,7 @@ KisDlgLayerStyle::KisDlgLayerStyle(KisPSDLayerStyle *layerStyle, QWidget *parent
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
setStyle(layerStyle);
} }
void KisDlgLayerStyle::changePage(QListWidgetItem *current, QListWidgetItem *previous) void KisDlgLayerStyle::changePage(QListWidgetItem *current, QListWidgetItem *previous)
...@@ -94,7 +97,16 @@ void KisDlgLayerStyle::changePage(QListWidgetItem *current, QListWidgetItem *pre ...@@ -94,7 +97,16 @@ void KisDlgLayerStyle::changePage(QListWidgetItem *current, QListWidgetItem *pre
void KisDlgLayerStyle::setStyle(KisPSDLayerStyle *style) 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) BevelAndEmboss::BevelAndEmboss(QWidget *parent)
...@@ -129,6 +141,44 @@ DropShadow::DropShadow(QWidget *parent) ...@@ -129,6 +141,44 @@ DropShadow::DropShadow(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
ui.setupUi(this); 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 @@ ...@@ -20,6 +20,8 @@
#include <kdialog.h> #include <kdialog.h>
#include <psd.h>
#include "ui_wdglayerstyles.h" #include "ui_wdglayerstyles.h"
#include "ui_wdgBevelAndEmboss.h" #include "ui_wdgBevelAndEmboss.h"
#include "ui_wdgblendingoptions.h" #include "ui_wdgblendingoptions.h"
...@@ -72,6 +74,8 @@ private: ...@@ -72,6 +74,8 @@ private:
class DropShadow : public QWidget { class DropShadow : public QWidget {
public: public:
DropShadow(QWidget *parent); DropShadow(QWidget *parent);
void setDropShadow(const psd_layer_effects_drop_shadow &dropShadow);
psd_layer_effects_drop_shadow dropShadow() const;
private: private:
Ui::WdgDropShadow ui; Ui::WdgDropShadow ui;
...@@ -156,7 +160,12 @@ signals: ...@@ -156,7 +160,12 @@ signals:
public slots: public slots:
void changePage(QListWidgetItem *, QListWidgetItem*); void changePage(QListWidgetItem *, QListWidgetItem*);
// Sets all the widgets to the contents of the given style
void setStyle(KisPSDLayerStyle *style); void setStyle(KisPSDLayerStyle *style);
KisPSDLayerStyle *style() const;
private: private:
KisPSDLayerStyle *m_layerStyle; 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