Added wavelet equalizer module

This commit is contained in:
Ilia Popov
2010-06-30 23:28:45 +02:00
parent e37b23ae8b
commit e0c25b4db6
22 changed files with 1632 additions and 787 deletions

View File

@@ -23,7 +23,8 @@ set (BASESOURCEFILES
thumbbrowserentrybase.cc batchqueueentry.cc
batchqueue.cc lwbutton.cc lwbuttonset.cc
batchqueuebuttonset.cc browserfilter.cc exiffiltersettings.cc
profilestore.cc partialpastedlg.cc)
profilestore.cc partialpastedlg.cc
equalizer.cc)
if (WIN32)
set (EXTRA_SRC windirmonitor.cc myicon.o)

View File

@@ -20,8 +20,8 @@
#define _COLORBOOST_H_
#include <gtkmm.h>
#include <adjuster.h>
#include <toolpanel.h>
#include "adjuster.h"
#include "toolpanel.h"
class ColorBoost : public Gtk::VBox, public AdjusterListener, public ToolPanel {

167
rtgui/equalizer.cc Normal file
View File

@@ -0,0 +1,167 @@
/*
* This file is part of RawTherapee.
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*
* 2010 Ilya Popov <ilia_popov@rambler.ru>
*/
#include <equalizer.h>
using namespace rtengine;
using namespace rtengine::procparams;
Equalizer::Equalizer () : ToolPanel() {
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
enabled->set_active (true);
pack_start(*enabled);
enabled->show();
enaConn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &Equalizer::enabled_toggled) );
Gtk::HSeparator *separator = Gtk::manage (new Gtk::HSeparator());
pack_start(*separator, Gtk::PACK_SHRINK, 2);
for(int i = 0; i < 8; i++)
{
std::stringstream ss;
ss << i;
if(i == 0)
ss << " (" << M("TP_EQUALIZER_FINEST") << ")";
if(i == 7)
ss << " (" << M("TP_EQUALIZER_LARGEST") << ")";
correction[i] = new Adjuster (ss.str(), -100, 100, 1, 0);
correction[i]->setAdjusterListener(this);
pack_start(*correction[i]);
}
show_all_children ();
}
Equalizer::~Equalizer () {
}
void Equalizer::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener ();
if (pedited) {
enabled->set_inconsistent (!pedited->equalizer.enabled);
for(int i = 0; i < 8; i++) {
correction[i]->setEditedState (pedited->equalizer.c[i] ? Edited : UnEdited);
}
}
enaConn.block (true);
enabled->set_active (pp->equalizer.enabled);
enaConn.block (false);
lastEnabled = pp->equalizer.enabled;
for (int i = 0; i < 8; i++) {
correction[i]->setValue(pp->equalizer.c[i]);
}
enableListener ();
}
void Equalizer::write (ProcParams* pp, ParamsEdited* pedited) {
pp->equalizer.enabled = enabled->get_active ();
for (int i = 0; i < 8; i++) {
pp->equalizer.c[i] = (int) correction[i]->getValue();
}
if (pedited) {
pedited->equalizer.enabled = !enabled->get_inconsistent();
for(int i = 0; i < 8; i++) {
pedited->equalizer.c[i] = correction[i]->getEditedState();
}
}
}
void Equalizer::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
for (int i = 0; i < 8; i++) {
correction[i]->setDefault(defParams->equalizer.c[i]);
}
if (pedited) {
for (int i = 0; i < 8; i++) {
correction[i]->setDefaultEditedState(pedited->equalizer.c[i] ? Edited : UnEdited);
}
}
else {
for (int i = 0; i < 8; i++) {
correction[i]->setDefaultEditedState(Irrelevant);
}
}
}
void Equalizer::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);
for (int i = 0; i < 8; i++) {
correction[i]->showEditedCB();
}
}
void Equalizer::adjusterChanged (Adjuster* a, double newval) {
if (listener && enabled->get_active()) {
std::stringstream ss;
ss << "(";
int i;
for (i = 0; i < 8; i++) {
if (i > 0) {
ss << ", ";
}
ss << static_cast<int>(correction[i]->getValue());
}
ss << ")";
listener->panelChanged (EvEqualizer, ss.str());
}
}
void Equalizer::enabled_toggled () {
if (batchMode) {
if (enabled->get_inconsistent()) {
enabled->set_inconsistent (false);
enaConn.block (true);
enabled->set_active (false);
enaConn.block (false);
}
else if (lastEnabled)
enabled->set_inconsistent (true);
lastEnabled = enabled->get_active ();
}
if (listener) {
if (enabled->get_active ())
listener->panelChanged (EvEqlEnabled, M("GENERAL_ENABLED"));
else
listener->panelChanged (EvEqlEnabled, M("GENERAL_DISABLED"));
}
}

53
rtgui/equalizer.h Normal file
View File

@@ -0,0 +1,53 @@
/*
* This file is part of RawTherapee.
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*
* 2010 Ilya Popov <ilia_popov@rambler.ru>
*/
#ifndef EQUALIZE_H_INCLUDED
#define EQUALIZE_H_INCLUDED
#include <gtkmm.h>
#include <adjuster.h>
#include <toolpanel.h>
class Equalizer : public Gtk::VBox, public AdjusterListener, public ToolPanel
{
protected:
Gtk::CheckButton * enabled;
Adjuster* correction[8];
sigc::connection enaConn;
bool lastEnabled;
public:
Equalizer ();
virtual ~Equalizer ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void adjusterChanged (Adjuster* a, double newval);
void enabled_toggled ();
};
#endif

View File

@@ -119,6 +119,11 @@ void ParamsEdited::set (bool v) {
icm.gammaOnInput = v;
icm.working = v;
icm.output = v;
equalizer.enabled = v;
for(int i = 0; i < 8; i++)
{
equalizer.c[i] = v;
}
exif.clear ();
iptc.clear ();
}
@@ -226,6 +231,10 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
icm.gammaOnInput = icm.gammaOnInput && p.icm.gammaOnInput == other.icm.gammaOnInput;
icm.working = icm.working && p.icm.working == other.icm.working;
icm.output = icm.output && p.icm.output == other.icm.output;
equalizer.enabled = equalizer.enabled && p.equalizer.enabled == other.equalizer.enabled;
for(int i = 0; i < 8; i++) {
equalizer.c[i] = equalizer.c[i] && p.equalizer.c[i] == other.equalizer.c[i];
}
// exif = exif && p.exif==other.exif
// iptc = other.iptc;
}
@@ -324,6 +333,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (icm.gammaOnInput) toEdit.icm.gammaOnInput = mods.icm.gammaOnInput;
if (icm.working) toEdit.icm.working = mods.icm.working;
if (icm.output) toEdit.icm.output = mods.icm.output;
if (equalizer.enabled) toEdit.equalizer.enabled = mods.equalizer.enabled;
for(int i = 0; i < 8; i++) {
if(equalizer.c[i]) toEdit.equalizer.c[i] = mods.equalizer.c[i];
}
// if (exif) toEdit.exif==mo.exif = mods.exif==other.exif;
// if (iptc;) toEdit.iptc==other.iptc; = mods.iptc==other.iptc;;
}

View File

@@ -215,6 +215,13 @@ class ColorManagementParamsEdited {
bool output;
};
class EqualizerParamsEdited {
public:
bool enabled;
bool c[8];
};
class ExifPairEdited {
public:
@@ -253,6 +260,7 @@ class ParamsEdited {
HRecParamsEdited hlrecovery;
ResizeParamsEdited resize;
ColorManagementParamsEdited icm;
EqualizerParamsEdited equalizer;
std::vector<ExifPairEdited> exif;
std::vector<IPTCPairEdited> iptc;

View File

@@ -53,6 +53,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
icm = Gtk::manage (new ICMPanel ());
exifpanel = Gtk::manage (new ExifPanel ());
iptcpanel = Gtk::manage (new IPTCPanel ());
equalizer = Gtk::manage (new Equalizer ());
addPanel (colorPanel, whitebalance, M("TP_WBALANCE_LABEL")); toolPanels.push_back (whitebalance);
addPanel (exposurePanel, curve, M("TP_EXPOSURE_LABEL")); toolPanels.push_back (curve);
@@ -65,10 +66,11 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
addPanel (exposurePanel, lcurve, M("TP_LUMACURVE_LABEL")); toolPanels.push_back (lcurve);
addPanel (detailsPanel, lumadenoise, M("TP_LUMADENOISE_LABEL")); toolPanels.push_back (lumadenoise);
addPanel (detailsPanel, colordenoise, M("TP_COLORDENOISE_LABEL")); toolPanels.push_back (colordenoise);
addPanel (detailsPanel, equalizer, M("TP_EQUALIZER_LABEL")); toolPanels.push_back (equalizer);
addPanel (transformPanel, crop, M("TP_CROP_LABEL")); toolPanels.push_back (crop);
addPanel (transformPanel, resize, M("TP_RESIZE_LABEL")); toolPanels.push_back (resize);
addPanel (transformPanel, lensgeom, M("TP_LENSGEOM_LABEL")); toolPanels.push_back (lensgeom);
addPanel (lensgeom->getPackBox(), rotate, M("TP_ROTATE_LABEL")); toolPanels.push_back (rotate);
addPanel (lensgeom->getPackBox(), rotate, M("TP_ROTATE_LABEL")); toolPanels.push_back (rotate);
addPanel (lensgeom->getPackBox(), perspective, M("TP_PERSPECTIVE_LABEL")); toolPanels.push_back (perspective);
addPanel (lensgeom->getPackBox(), distortion, M("TP_DISTORTION_LABEL")); toolPanels.push_back (distortion);
addPanel (lensgeom->getPackBox(), cacorrection, M("TP_CACORRECTION_LABEL")); toolPanels.push_back (cacorrection);

View File

@@ -51,6 +51,7 @@
#include <toolbar.h>
#include <lensgeom.h>
#include <lensgeomlistener.h>
#include <equalizer.h>
class ImageEditorCoordinator;
@@ -86,6 +87,7 @@ class ToolPanelCoordinator : public ToolPanelListener,
ColorDenoise* colordenoise;
Sharpening* sharpening;
LCurve* lcurve;
Equalizer * equalizer;
std::vector<PParamsChangeListener*> paramcListeners;