Normalized RAW tab and enhanced slider behaviour for the RAW tab + Green Equil slider was not listened

This commit is contained in:
Hombre
2011-02-18 00:57:08 +01:00
parent 06f885d7e2
commit 01401c20a6
44 changed files with 1039 additions and 451 deletions

View File

@@ -26,6 +26,7 @@ set (BASESOURCEFILES
batchqueue.cc lwbutton.cc lwbuttonset.cc
batchqueuebuttonset.cc browserfilter.cc exiffiltersettings.cc
profilestore.cc partialpastedlg.cc rawprocess.cc preprocess.cc
darkframe.cc rawcacorrection.cc rawexposure.cc
equalizer.cc dirpyrequalizer.cc hsvequalizer.cc defringe.cc
popupcommon.cc popupbutton.cc popuptogglebutton.cc)

View File

@@ -21,17 +21,19 @@
#include <math.h>
#include <multilangmgr.h>
#include <rtengine.h>
#include <options.h>
extern Glib::ustring argv0;
int Adjuster::delay = 1000;
Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, bool editedcb) {
adjusterListener = NULL;
afterReset = false;
blocked = false;
// TODO: let the user chose the default value of Adjuster::delay, for slow machines
delay = options.adjusterDelay; // delay is no more static, so we can set the delay individually (usefull for the RAW editor tab)
set_border_width (2);
hbox = Gtk::manage (new Gtk::HBox ());
@@ -212,6 +214,16 @@ double Adjuster::getValue () {
return spin->get_value ();
}
int Adjuster::getIntValue () {
return spin->get_value_as_int ();
}
Glib::ustring Adjuster::getTextValue () {
return spin->get_text ();
}
bool Adjuster::notifyListener () {
if (adjusterListener!=NULL && !blocked) {

View File

@@ -57,13 +57,15 @@ class Adjuster : public Gtk::VBox {
public:
static int delay;
int delay;
Adjuster (Glib::ustring label, double vmin, double vmax, double vstep, double vdefault, bool editedCheckBox=false);
virtual ~Adjuster ();
void setAdjusterListener (AdjusterListener* alistener);
double getValue ();
int getIntValue ();
Glib::ustring getTextValue ();
void setValue (double a);
void setLimits (double vmin, double vmax, double vstep, double vdefault);
void setEnabled (bool enabled);

121
rtgui/darkframe.cc Normal file
View File

@@ -0,0 +1,121 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* 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/>.
*/
#include <darkframe.h>
#include <options.h>
#include <guiutils.h>
#include <sstream>
using namespace rtengine;
using namespace rtengine::procparams;
DarkFrame::DarkFrame () : Gtk::VBox(), FoldableToolPanel(this)
{
hbdf = Gtk::manage(new Gtk::HBox());
darkFrameFile = Gtk::manage(new Gtk::FileChooserButton(M("TP_DARKFRAME_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
dfLabel = Gtk::manage(new Gtk::Label(M("GENERAL_FILE")));
btnReset = Gtk::manage(new Gtk::Button());
btnReset->set_image (*Gtk::manage(new Gtk::Image (Gtk::StockID("gtk-cancel"), Gtk::ICON_SIZE_BUTTON)));
hbdf->pack_start(*dfLabel, Gtk::PACK_SHRINK, 4);
hbdf->pack_start(*darkFrameFile);
hbdf->pack_start(*btnReset, Gtk::PACK_SHRINK, 4);
dfAuto = Gtk::manage(new Gtk::CheckButton((M("TP_DARKFRAME_AUTOSELECT"))));
pack_start( *hbdf, Gtk::PACK_SHRINK, 4);
pack_start( *dfAuto, Gtk::PACK_SHRINK, 4);
dfautoconn = dfAuto->signal_toggled().connect ( sigc::mem_fun(*this, &DarkFrame::dfAutoChanged), true);
dfFile = darkFrameFile->signal_file_set().connect ( sigc::mem_fun(*this, &DarkFrame::darkFrameChanged), true);
btnReset->signal_clicked().connect( sigc::mem_fun(*this, &DarkFrame::darkFrameReset), true );
}
void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
{
disableListener ();
dfautoconn.block(true);
if(pedited ){
dfAuto->set_inconsistent(!pedited->raw.dfAuto );
}
if (Glib::file_test (pp->raw.dark_frame, Glib::FILE_TEST_EXISTS))
darkFrameFile->set_filename (pp->raw.dark_frame);
else if( !options.rtSettings.darkFramesPath.empty() )
darkFrameFile->set_current_folder( options.rtSettings.darkFramesPath );
hbdf->set_sensitive( !pp->raw.df_autoselect );
lastDFauto = pp->raw.df_autoselect;
dfAuto->set_active( pp->raw.df_autoselect );
dfChanged = false;
dfautoconn.block(false);
enableListener ();
}
void DarkFrame::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.dark_frame = darkFrameFile->get_filename();
pp->raw.df_autoselect = dfAuto->get_active();
if (pedited) {
pedited->raw.darkFrame = dfChanged;
pedited->raw.dfAuto = !dfAuto->get_inconsistent();
}
}
void DarkFrame::dfAutoChanged()
{
if (batchMode) {
if (dfAuto->get_inconsistent()) {
dfAuto->set_inconsistent (false);
dfautoconn.block (true);
dfAuto->set_active (false);
dfautoconn.block (false);
}
else if (lastDFauto)
dfAuto->set_inconsistent (true);
lastDFauto = dfAuto->get_active ();
}
hbdf->set_sensitive( !dfAuto->get_active() );
if (listener)
listener->panelChanged (EvPreProcessAutoDF, dfAuto->get_active()?M("GENERAL_ENABLED"):M("GENERAL_DISABLED"));
}
void DarkFrame::darkFrameChanged()
{
dfChanged=true;
if (listener)
listener->panelChanged (EvPreProcessDFFile, Glib::path_get_basename(darkFrameFile->get_filename()));
}
void DarkFrame::darkFrameReset()
{
dfChanged=true;
//darkFrameFile->set_current_name("");
darkFrameFile->set_filename ("");
if( !options.rtSettings.darkFramesPath.empty() )
darkFrameFile->set_current_folder( options.rtSettings.darkFramesPath );
if (listener)
listener->panelChanged (EvPreProcessDFFile, M("GENERAL_NONE"));
}

53
rtgui/darkframe.h Normal file
View File

@@ -0,0 +1,53 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* 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/>.
*/
#ifndef _DARKFRAME_H_
#define _DARKFRAME_H_
#include <gtkmm.h>
#include <toolpanel.h>
#include <rawimage.h>
class DarkFrame : public Gtk::VBox, public FoldableToolPanel {
protected:
Gtk::ComboBoxText* darkFrameMethod;
Gtk::FileChooserButton *darkFrameFile;
Gtk::HBox *hbdf;
Gtk::Button *btnReset;
Gtk::Label *dfLabel;
Gtk::Label *dfInfo;
Gtk::CheckButton* dfAuto;
bool dfChanged;
bool lastDFauto;
sigc::connection dfautoconn, dfFile;
public:
DarkFrame ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void darkFrameChanged ();
void darkFrameReset ();
void dfAutoChanged ();
};
#endif

View File

@@ -18,7 +18,6 @@
*/
#include <options.h>
#include <stdio.h>
#include <adjuster.h>
#include <glib/gstdio.h>
#include <sstream>
#include <multilangmgr.h>
@@ -58,6 +57,7 @@ void Options::setDefaults () {
defProfRaw = "default";
defProfImg = "neutral";
dateFormat = "%y-%m-%d";
adjusterDelay = 0;
startupDir = 1;
startupPath = "";
profilePath = "profiles";
@@ -177,7 +177,7 @@ if (keyFile.has_group ("General")) {
if (keyFile.has_key ("General", "StartupPath")) startupPath = keyFile.get_string ("General", "StartupPath");
if (keyFile.has_key ("General", "DateFormat")) dateFormat = keyFile.get_string ("General", "DateFormat");
if (keyFile.has_key ("General", "AdjusterDelay")) Adjuster::delay = keyFile.get_integer ("General", "AdjusterDelay");
if (keyFile.has_key ("General", "AdjusterDelay")) adjusterDelay = keyFile.get_integer ("General", "AdjusterDelay");
if (keyFile.has_key ("General", "StoreLastProfile")) savesParamsAtExit = keyFile.get_boolean ("General", "StoreLastProfile");
if (keyFile.has_key ("General", "DualProcSupport")) rtSettings.dualThreadEnabled = keyFile.get_boolean ("General", "DualProcSupport");
if (keyFile.has_key ("General", "MultiUser")) multiUser = keyFile.get_boolean ("General", "MultiUser");
@@ -318,7 +318,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_string ("General", "StartupDirectory", "last");
keyFile.set_string ("General", "StartupPath", startupPath);
keyFile.set_string ("General", "DateFormat", dateFormat);
keyFile.set_integer ("General", "AdjusterDelay", Adjuster::delay);
keyFile.set_integer ("General", "AdjusterDelay", adjusterDelay);
keyFile.set_boolean ("General", "DualProcSupport", rtSettings.dualThreadEnabled);
keyFile.set_boolean ("General", "MultiUser", multiUser);
keyFile.set_string ("General", "Language", language);
@@ -326,8 +326,8 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme);
keyFile.set_integer ("General", "Version", TAGDISTANCE);
keyFile.set_boolean ("General", "FirstRun", firstRun);
keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath);
keyFile.set_boolean ("General", "Verbose", rtSettings.verbose);
keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath);
keyFile.set_boolean ("General", "Verbose", rtSettings.verbose);
keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo);
keyFile.set_string ("External Editor", "GimpDir", gimpDir);

View File

@@ -58,6 +58,7 @@ class Options {
Glib::ustring defProfRaw;
Glib::ustring defProfImg;
Glib::ustring dateFormat;
int adjusterDelay;
int startupDir;
Glib::ustring startupPath;
Glib::ustring profilePath;

View File

@@ -17,242 +17,108 @@
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <preprocess.h>
#include <options.h>
#include <guiutils.h>
#include <safegtk.h>
#include <sstream>
using namespace rtengine;
using namespace rtengine::procparams;
PreProcess::PreProcess (): Gtk::VBox(), FoldableToolPanel(this)
PreProcess::PreProcess () : Gtk::VBox(), FoldableToolPanel(this)
{
hbdf = Gtk::manage(new Gtk::HBox());
darkFrameFile = Gtk::manage(new Gtk::FileChooserButton(M("TP_PREPROCESS_DARKFRAME"), Gtk::FILE_CHOOSER_ACTION_OPEN));
dfLabel = Gtk::manage(new Gtk::Label(M("TP_PREPROCESS_DARKFRAME")));
btnReset = Gtk::manage(new Gtk::Button());
btnReset->set_image (*Gtk::manage(new Gtk::Image (Gtk::StockID("gtk-cancel"), Gtk::ICON_SIZE_BUTTON)));
hbdf->pack_start(*dfLabel, Gtk::PACK_SHRINK, 4);
hbdf->pack_start(*darkFrameFile);
hbdf->pack_start(*btnReset, Gtk::PACK_SHRINK, 4);
dfAuto = Gtk::manage(new Gtk::CheckButton((M("TP_PREPROCESS_DFAUTOSELECT"))));
caAutocorrect = Gtk::manage(new Gtk::CheckButton((M("PREFERENCES_CACORRECTION"))));
caRed = Gtk::manage(new Adjuster (M("PREFERENCES_CARED"),-4.0,4.0,0.1,0));
caRed->setAdjusterListener (this);
caRed->show();
caBlue = Gtk::manage(new Adjuster (M("PREFERENCES_CABLUE"),-4.0,4.0,0.1,0));
caBlue->setAdjusterListener (this);
caBlue->show();
//exposi
/*exPos = Gtk::manage(new Adjuster (M("PREFERENCES_EXPOS"),0.2,4.0,0.1,1));
exPos->setAdjusterListener (this);
exPos->show();
exPreser = Gtk::manage(new Adjuster (M("PREFERENCES_PRESER"),0,2.5,0.1,0));
exPreser->setAdjusterListener (this);
exPreser->show();*/
PexPos = Gtk::manage(new Adjuster (M("PREFERENCES_EXPOS"),0.2,4.0,0.1,1));
PexPos->setAdjusterListener (this);
PexPos->show();
PexPreser = Gtk::manage(new Adjuster (M("PREFERENCES_PRESER"),0,2.5,0.1,0));
PexPreser->setAdjusterListener (this);
PexPreser->show();
hotDeadPixel = Gtk::manage(new Gtk::CheckButton((M("TP_PREPROCESS_HOTDEADPIXFILT"))));
hotDeadPixel = Gtk::manage(new Gtk::CheckButton((M("PREFERENCES_HOTDEADPIXFILT"))));
lineDenoise = Gtk::manage(new Adjuster (M("PREFERENCES_LINEDENOISE"),0,1000,1,0));
lineDenoise = Gtk::manage(new Adjuster (M("TP_PREPROCESS_LINEDENOISE"),0,1000,1,0));
lineDenoise->setAdjusterListener (this);
if (lineDenoise->delay < 1000) lineDenoise->delay = 1000;
lineDenoise->show();
greenEqThreshold = Gtk::manage(new Adjuster (M("PREFERENCES_GREENEQUIL"),0,100,1,0));
greenEqThreshold = Gtk::manage(new Adjuster (M("TP_PREPROCESS_GREENEQUIL"),0,100,1,0));
greenEqThreshold->setAdjusterListener (this);
if (greenEqThreshold->delay < 1000) greenEqThreshold->delay = 1000;
greenEqThreshold->show();
pack_start( *hbdf, Gtk::PACK_SHRINK, 4);
pack_start( *dfAuto, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage (new Gtk::HSeparator()));
pack_start( *hotDeadPixel, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage (new Gtk::HSeparator()));
pack_start( *caAutocorrect, Gtk::PACK_SHRINK, 4);
pack_start( *caRed, Gtk::PACK_SHRINK, 4);
pack_start( *caBlue, Gtk::PACK_SHRINK, 4);
pack_start( *PexPos, Gtk::PACK_SHRINK, 4);//exposi
pack_start( *PexPreser, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage (new Gtk::HSeparator()));
pack_start( *lineDenoise, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage (new Gtk::HSeparator()));
pack_start( *greenEqThreshold, Gtk::PACK_SHRINK, 4);
pack_start( *lineDenoise, Gtk::PACK_SHRINK, 4);
caacsconn = caAutocorrect->signal_toggled().connect ( sigc::mem_fun(*this, &PreProcess::caCorrectionChanged), true);
dfautoconn = dfAuto->signal_toggled().connect ( sigc::mem_fun(*this, &PreProcess::dfAutoChanged), true);
hdpixelconn = hotDeadPixel->signal_toggled().connect ( sigc::mem_fun(*this, &PreProcess::hotDeadPixelChanged), true);
dfFile = darkFrameFile->signal_file_set().connect ( sigc::mem_fun(*this, &PreProcess::darkFrameChanged), true);
btnReset->signal_clicked().connect( sigc::mem_fun(*this, &PreProcess::darkFrameReset), true );
pack_start( *Gtk::manage (new Gtk::HSeparator()));
pack_start( *greenEqThreshold, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage (new Gtk::HSeparator()));
pack_start( *hotDeadPixel, Gtk::PACK_SHRINK, 4);
hdpixelconn = hotDeadPixel->signal_toggled().connect ( sigc::mem_fun(*this, &PreProcess::hotDeadPixelChanged), true);
}
void PreProcess::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
{
disableListener ();
caacsconn.block (true);
dfautoconn.block(true);
hdpixelconn.block (true);
disableListener ();
hdpixelconn.block (true);
if(pedited ){
dfAuto->set_inconsistent(!pedited->raw.dfAuto );
caAutocorrect->set_inconsistent(!pedited->raw.caCorrection);
caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited );
caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited );
PexPos->setEditedState( pedited->raw.exPos ? Edited : UnEdited );
PexPreser->setEditedState( pedited->raw.exPreser ? Edited : UnEdited );
//exposure
hotDeadPixel->set_inconsistent (!pedited->raw.hotDeadPixel);
lineDenoise->setEditedState( pedited->raw.linenoise ? Edited : UnEdited );
greenEqThreshold->setEditedState( pedited->raw.greenEq ? Edited : UnEdited );
}
if(pedited ){
hotDeadPixel->set_inconsistent (!pedited->raw.hotDeadPixel);
lineDenoise->setEditedState( pedited->raw.linenoise ? Edited : UnEdited );
greenEqThreshold->setEditedState( pedited->raw.greenEq ? Edited : UnEdited );
}
if (Glib::file_test (pp->raw.dark_frame, Glib::FILE_TEST_EXISTS))
darkFrameFile->set_filename (pp->raw.dark_frame);
else if( !options.rtSettings.darkFramesPath.empty() )
darkFrameFile->set_current_folder( options.rtSettings.darkFramesPath );
lastHot = pp->raw.hotdeadpix_filt;
lastCA = pp->raw.ca_autocorrect;
lastHot = pp->raw.hotdeadpix_filt;
lastDFauto = pp->raw.df_autoselect;
hotDeadPixel->set_active (pp->raw.hotdeadpix_filt);
lineDenoise->setValue (pp->raw.linenoise);
greenEqThreshold->setValue (pp->raw.greenthresh);
dfAuto->set_active( pp->raw.df_autoselect );
caAutocorrect->set_active(pp->raw.ca_autocorrect);
caRed->setValue (pp->raw.cared);
caBlue->setValue (pp->raw.cablue);
PexPos->setValue (pp->raw.expos);
PexPreser->setValue (pp->raw.preser);//exposi
hotDeadPixel->set_active (pp->raw.hotdeadpix_filt);
lineDenoise->setValue (pp->raw.linenoise);
greenEqThreshold->setValue (pp->raw.greenthresh);
dfChanged = false;
caacsconn.block (false);
dfautoconn.block(false);
hdpixelconn.block (false);
enableListener ();
hdpixelconn.block (false);
enableListener ();
}
void PreProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.dark_frame = darkFrameFile->get_filename();
pp->raw.df_autoselect = dfAuto->get_active();
pp->raw.ca_autocorrect = caAutocorrect->get_active();
pp->raw.cared = (double)caRed->getValue();
pp->raw.cablue = (double)caBlue->getValue();
pp->raw.expos = (double)PexPos->getValue();
pp->raw.preser = (double)PexPreser->getValue();//exposi
pp->raw.hotdeadpix_filt = hotDeadPixel->get_active();
pp->raw.linenoise = (int)lineDenoise->getValue();
pp->raw.greenthresh = (int)greenEqThreshold->getValue();
pp->raw.linenoise = lineDenoise->getIntValue();
pp->raw.greenthresh = greenEqThreshold->getIntValue();
if (pedited) {
pedited->raw.darkFrame = dfChanged;
pedited->raw.dfAuto = !dfAuto->get_inconsistent();
pedited->raw.linenoise = lineDenoise->getEditedState ();
pedited->raw.greenEq= greenEqThreshold->getEditedState ();
pedited->raw.caCorrection = !caAutocorrect->get_inconsistent();
pedited->raw.caRed = caRed->getEditedState ();
pedited->raw.caBlue = caBlue->getEditedState ();
pedited->raw.exPos = PexPos->getEditedState ();
pedited->raw.exPreser = PexPreser->getEditedState ();//exposi
pedited->raw.hotDeadPixel = !hotDeadPixel->get_inconsistent();
}
}
void PreProcess::adjusterChanged (Adjuster* a, double newval)
{
if (listener)
listener->panelChanged (EvPreProcess, Glib::ustring("params") );
if (listener) {
Glib::ustring value = a->getTextValue();
if (a == greenEqThreshold)
listener->panelChanged (EvPreProcessGEquilThresh, value );
else if (a == lineDenoise)
listener->panelChanged (EvPreProcessLineDenoise, value );
}
}
void PreProcess::setBatchMode(bool batchMode)
{
ToolPanel::setBatchMode (batchMode);
caRed->showEditedCB ();
caBlue->showEditedCB ();
PexPos->showEditedCB ();
PexPreser->showEditedCB ();//exposi
lineDenoise->showEditedCB ();
greenEqThreshold->showEditedCB ();
ToolPanel::setBatchMode (batchMode);
lineDenoise->showEditedCB ();
greenEqThreshold->showEditedCB ();
}
void PreProcess::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
{
lineDenoise->setDefault( defParams->raw.linenoise);
caRed->setDefault( defParams->raw.cared);
caBlue->setDefault( defParams->raw.cablue);
PexPos->setDefault( defParams->raw.expos);
PexPreser->setDefault( defParams->raw.preser);
greenEqThreshold->setDefault (defParams->raw.greenthresh);
if (pedited) {
lineDenoise->setDefaultEditedState( pedited->raw.linenoise ? Edited : UnEdited);
caRed->setDefaultEditedState( pedited->raw.caRed ? Edited : UnEdited);
caBlue->setDefaultEditedState( pedited->raw.caBlue ? Edited : UnEdited);
PexPos->setDefaultEditedState( pedited->raw.exPos ? Edited : UnEdited);
PexPreser->setDefaultEditedState( pedited->raw.exPreser ? Edited : UnEdited);
greenEqThreshold->setDefaultEditedState(pedited->raw.greenEq ? Edited : UnEdited);
}else{
} else {
lineDenoise->setDefaultEditedState( Irrelevant );
caRed->setDefaultEditedState( Irrelevant );
caBlue->setDefaultEditedState( Irrelevant );
PexPos->setDefaultEditedState( Irrelevant );
PexPreser->setDefaultEditedState( Irrelevant );
greenEqThreshold->setDefaultEditedState(Irrelevant );
}
}
void PreProcess::caCorrectionChanged()
{
if (batchMode) {
if (caAutocorrect->get_inconsistent()) {
caAutocorrect->set_inconsistent (false);
caacsconn.block (true);
caAutocorrect->set_active (false);
caacsconn.block (false);
}
else if (lastCA)
caAutocorrect->set_inconsistent (true);
lastCA = caAutocorrect->get_active ();
}
if (listener)
listener->panelChanged (EvPreProcess, Glib::ustring(M("PREFERENCES_CACORRECTION"))+"="+(caAutocorrect->get_active()?"ON":"OFF") );
}
void PreProcess::dfAutoChanged()
{
if (batchMode) {
if (dfAuto->get_inconsistent()) {
dfAuto->set_inconsistent (false);
dfautoconn.block (true);
dfAuto->set_active (false);
dfautoconn.block (false);
}
else if (lastDFauto)
dfAuto->set_inconsistent (true);
lastDFauto = dfAuto->get_active ();
}
hbdf->set_sensitive( !dfAuto->get_active() );
if (listener)
listener->panelChanged (EvPreProcess, Glib::ustring(M("TP_PREPROCESS_DFAUTOSELECT"))+"="+(dfAuto->get_active()?"ON":"OFF") );
}
void PreProcess::hotDeadPixelChanged ()
{
if (batchMode) {
@@ -268,21 +134,5 @@ void PreProcess::hotDeadPixelChanged ()
lastHot = hotDeadPixel->get_active ();
}
if (listener)
listener->panelChanged (EvPreProcess, Glib::ustring(M("PREFERENCES_HOTDEADPIXFILT"))+"="+(hotDeadPixel->get_active()?"ON":"OFF") );
}
void PreProcess::darkFrameChanged()
{
dfChanged=true;
if (listener)
listener->panelChanged (EvPreProcess, Glib::ustring(M("TP_PREPROCESS_DARKFRAME"))+"="+darkFrameFile->get_filename());
}
void PreProcess::darkFrameReset()
{
dfChanged=true;
darkFrameFile->set_current_name("");
darkFrameFile->set_filename ("");
if (listener)
listener->panelChanged (EvPreProcess, Glib::ustring(M("TP_PREPROCESS_DARKFRAME"))+"=0" );
listener->panelChanged (EvPreProcessHotDeadPixel, hotDeadPixel->get_active()?M("GENERAL_ENABLED"):M("GENERAL_DISABLED"));
}

View File

@@ -22,32 +22,19 @@
#include <gtkmm.h>
#include <adjuster.h>
#include <toolpanel.h>
#include <rawimage.h>
class PreProcess : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel{
class PreProcess : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel {
protected:
Gtk::ComboBoxText* darkFrameMethod;
Gtk::FileChooserButton *darkFrameFile;
Gtk::HBox *hbdf;
Gtk::Button *btnReset;
Gtk::Label *dfLabel;
bool dfChanged;
Adjuster* caRed;
Adjuster* caBlue;
Adjuster* PexPos;
Adjuster* PexPreser;
Adjuster* lineDenoise;
Adjuster* greenEqThreshold;
Gtk::CheckButton* caAutocorrect;
Gtk::CheckButton* hotDeadPixel;
Gtk::CheckButton* dfAuto;
bool lastCA,lastHot,lastDFauto;
sigc::connection caacsconn,dfautoconn,hdpixelconn,dfFile;
Adjuster* greenEqThreshold;
Gtk::CheckButton* hotDeadPixel;
bool lastHot;
sigc::connection hdpixelconn;
public:
PreProcess ();
@@ -58,11 +45,7 @@ class PreProcess : public Gtk::VBox, public AdjusterListener, public FoldableToo
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void adjusterChanged (Adjuster* a, double newval);
void caCorrectionChanged();
void hotDeadPixelChanged();
void darkFrameChanged();
void darkFrameReset();
void dfAutoChanged();
};
#endif

143
rtgui/rawcacorrection.cc Normal file
View File

@@ -0,0 +1,143 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* 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/>.
*/
#include <rawcacorrection.h>
#include <guiutils.h>
#include <safegtk.h>
#include <sstream>
using namespace rtengine;
using namespace rtengine::procparams;
RAWCACorr::RAWCACorr () : Gtk::VBox(), FoldableToolPanel(this)
{
caAutocorrect = Gtk::manage(new Gtk::CheckButton((M("TP_RAWCACORR_AUTO"))));
caRed = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CARED"),-4.0,4.0,0.1,0));
caRed->setAdjusterListener (this);
if (caRed->delay < 1000) caRed->delay = 1000;
caRed->show();
caBlue = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CABLUE"),-4.0,4.0,0.1,0));
caBlue->setAdjusterListener (this);
if (caBlue->delay < 1000) caBlue->delay = 1000;
caBlue->show();
pack_start( *caAutocorrect, Gtk::PACK_SHRINK, 4);
pack_start( *caRed, Gtk::PACK_SHRINK, 4);
pack_start( *caBlue, Gtk::PACK_SHRINK, 4);
caacsconn = caAutocorrect->signal_toggled().connect ( sigc::mem_fun(*this, &RAWCACorr::caCorrectionChanged), true);
}
void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
{
disableListener ();
caacsconn.block (true);
if(pedited ){
caAutocorrect->set_inconsistent(!pedited->raw.caCorrection);
caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited );
caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited );
}
lastCA = pp->raw.ca_autocorrect;
caAutocorrect->set_active(pp->raw.ca_autocorrect);
caRed->setValue (pp->raw.cared);
caBlue->setValue (pp->raw.cablue);
caacsconn.block (false);
enableListener ();
}
void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.ca_autocorrect = caAutocorrect->get_active();
pp->raw.cared = caRed->getValue();
pp->raw.cablue = caBlue->getValue();
if (pedited) {
pedited->raw.caCorrection = !caAutocorrect->get_inconsistent();
pedited->raw.caRed = caRed->getEditedState ();
pedited->raw.caBlue = caBlue->getEditedState ();
}
}
void RAWCACorr::adjusterChanged (Adjuster* a, double newval)
{
if (listener) {
Glib::ustring value = a->getTextValue();
if (a == caRed)
listener->panelChanged (EvPreProcessCARed, value );
else if (a == caBlue)
listener->panelChanged (EvPreProcessCABlue, value );
}
}
void RAWCACorr::setBatchMode(bool batchMode)
{
ToolPanel::setBatchMode (batchMode);
caRed->showEditedCB ();
caBlue->showEditedCB ();
}
void RAWCACorr::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
{
caRed->setDefault( defParams->raw.cared);
caBlue->setDefault( defParams->raw.cablue);
if (pedited) {
caRed->setDefaultEditedState( pedited->raw.caRed ? Edited : UnEdited);
caBlue->setDefaultEditedState( pedited->raw.caBlue ? Edited : UnEdited);
} else {
caRed->setDefaultEditedState( Irrelevant );
caBlue->setDefaultEditedState( Irrelevant );
}
}
void RAWCACorr::caCorrectionChanged()
{
if (batchMode) {
if (caAutocorrect->get_inconsistent()) {
caAutocorrect->set_inconsistent (false);
caacsconn.block (true);
caAutocorrect->set_active (false);
caacsconn.block (false);
}
else if (lastCA)
caAutocorrect->set_inconsistent (true);
lastCA = caAutocorrect->get_active ();
}
else {
// For non batch mode, we disable the red and blue slider if caAutocorrect is true
if (caAutocorrect->get_active ()) {
caRed->set_sensitive(false);
caBlue->set_sensitive(false);
}
else {
caRed->set_sensitive(true);
caBlue->set_sensitive(true);
}
}
if (listener)
listener->panelChanged (EvPreProcessAutoCA, caAutocorrect->get_active()?M("GENERAL_ENABLED"):M("GENERAL_DISABLED"));
}

49
rtgui/rawcacorrection.h Normal file
View File

@@ -0,0 +1,49 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* 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/>.
*/
#ifndef _RAWCACORRECTION_H_
#define _RAWCACORRECTION_H_
#include <gtkmm.h>
#include <adjuster.h>
#include <toolpanel.h>
#include <rawimage.h>
class RAWCACorr : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel {
protected:
Gtk::CheckButton* caAutocorrect;
Adjuster* caRed;
Adjuster* caBlue;
bool lastCA;
sigc::connection caacsconn;
public:
RAWCACorr ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void adjusterChanged (Adjuster* a, double newval);
void caCorrectionChanged ();
};
#endif

101
rtgui/rawexposure.cc Normal file
View File

@@ -0,0 +1,101 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* 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/>.
*/
#include <rawexposure.h>
#include <guiutils.h>
#include <safegtk.h>
#include <sstream>
using namespace rtengine;
using namespace rtengine::procparams;
RAWExposure::RAWExposure () : Gtk::VBox(), FoldableToolPanel(this)
{
PexPos = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_LINEAR"),0.2,4.0,0.1,1));
PexPos->setAdjusterListener (this);
if (PexPos->delay < 1000) PexPos->delay = 1000;
PexPos->show();
PexPreser = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_PRESER"),0,2.5,0.1,0));
PexPreser->setAdjusterListener (this);
if (PexPreser->delay < 1000) PexPreser->delay = 1000;
PexPreser->show();
pack_start( *PexPos, Gtk::PACK_SHRINK, 4);//exposi
pack_start( *PexPreser, Gtk::PACK_SHRINK, 4);
}
void RAWExposure::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
{
disableListener ();
if(pedited ){
PexPos->setEditedState( pedited->raw.exPos ? Edited : UnEdited );
PexPreser->setEditedState( pedited->raw.exPreser ? Edited : UnEdited );
}
PexPos->setValue (pp->raw.expos);
PexPreser->setValue (pp->raw.preser);//exposi
enableListener ();
}
void RAWExposure::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.expos = PexPos->getValue();
pp->raw.preser = PexPreser->getValue();//exposi
if (pedited) {
pedited->raw.exPos = PexPos->getEditedState ();
pedited->raw.exPreser = PexPreser->getEditedState ();//exposi
}
}
void RAWExposure::adjusterChanged (Adjuster* a, double newval)
{
if (listener) {
Glib::ustring value = a->getTextValue();
if (a == PexPos)
listener->panelChanged (EvPreProcessExpCorrLinear, value );
else if (a == PexPreser)
listener->panelChanged (EvPreProcessExpCorrPH, value );
}
}
void RAWExposure::setBatchMode(bool batchMode)
{
ToolPanel::setBatchMode (batchMode);
PexPos->showEditedCB ();
PexPreser->showEditedCB ();//exposi
}
void RAWExposure::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
{
PexPos->setDefault( defParams->raw.expos);
PexPreser->setDefault( defParams->raw.preser);
if (pedited) {
PexPos->setDefaultEditedState( pedited->raw.exPos ? Edited : UnEdited);
PexPreser->setDefaultEditedState( pedited->raw.exPreser ? Edited : UnEdited);
} else {
PexPos->setDefaultEditedState( Irrelevant );
PexPreser->setDefaultEditedState( Irrelevant );
}
}

45
rtgui/rawexposure.h Normal file
View File

@@ -0,0 +1,45 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* 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/>.
*/
#ifndef _RAWEXPOSURE_H_
#define _RAWEXPOSURE_H_
#include <gtkmm.h>
#include <adjuster.h>
#include <toolpanel.h>
#include <rawimage.h>
class RAWExposure : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel {
protected:
Adjuster* PexPos;
Adjuster* PexPreser;
public:
RAWExposure ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void adjusterChanged (Adjuster* a, double newval);
};
#endif

View File

@@ -25,7 +25,7 @@ using namespace rtengine::procparams;
RawProcess::RawProcess () : Gtk::VBox(), FoldableToolPanel(this)
{
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("PREFERENCES_DMETHOD") +": ")));
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") +": ")));
dmethod = Gtk::manage (new Gtk::ComboBoxText ());
for( size_t i=0; i< procparams::RAWParams::numMethods;i++)
dmethod->append_text(procparams::RAWParams::methodstring[i]);
@@ -37,10 +37,11 @@ RawProcess::RawProcess () : Gtk::VBox(), FoldableToolPanel(this)
dcbOptions = Gtk::manage (new Gtk::VBox ());
dcbOptions->set_border_width(4);
dcbIterations = Gtk::manage (new Adjuster (M("PREFERENCES_DCBITERATIONS"),0,5,1,2));
dcbIterations ->setAdjusterListener (this);
dcbIterations ->show();
dcbEnhance = Gtk::manage (new Gtk::CheckButton(M("PREFERENCES_DCBENHANCE")));
dcbIterations = Gtk::manage (new Adjuster (M("TP_RAW_DCBITERATIONS"),0,5,1,2));
dcbIterations->setAdjusterListener (this);
if (dcbIterations->delay < 1000) dcbIterations->delay = 1000;
dcbIterations->show();
dcbEnhance = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_DCBENHANCE")));
dcbOptions->pack_start(*dcbIterations);
dcbOptions->pack_start(*dcbEnhance);
pack_start( *dcbOptions, Gtk::PACK_SHRINK, 4);
@@ -48,8 +49,9 @@ RawProcess::RawProcess () : Gtk::VBox(), FoldableToolPanel(this)
ccOptions = Gtk::manage (new Gtk::VBox ());
ccOptions->set_border_width(4);
ccSteps = Gtk::manage (new Adjuster (M("PREFERENCES_FALSECOLOR"),0,5,1,2 ));
ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"),0,5,1,2 ));
ccSteps->setAdjusterListener (this);
if (ccSteps->delay < 1000) ccSteps->delay = 1000;
ccSteps->show();
pack_start( *ccSteps, Gtk::PACK_SHRINK, 4);
@@ -103,8 +105,8 @@ void RawProcess::read(const rtengine::procparams::ProcParams* pp, const ParamsEd
void RawProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.ccSteps = (int)ccSteps->getValue();
pp->raw.dcb_iterations = (int)dcbIterations->getValue();
pp->raw.ccSteps = ccSteps->getIntValue();
pp->raw.dcb_iterations = dcbIterations->getIntValue();
pp->raw.dcb_enhance = dcbEnhance->get_active();
int currentRow = dmethod->get_active_row_number();
@@ -143,8 +145,12 @@ void RawProcess::setDefaults(const rtengine::procparams::ProcParams* defParams,
void RawProcess::adjusterChanged (Adjuster* a, double newval)
{
if (listener)
listener->panelChanged (EvDemosaic, Glib::ustring("params") );
if (listener) {
if (a == dcbIterations)
listener->panelChanged (EvDemosaicDCBIter, a->getTextValue() );
else if (a == ccSteps)
listener->panelChanged (EvDemosaicFalseColorIter, a->getTextValue() );
}
}
void RawProcess::methodChanged ()
@@ -160,7 +166,7 @@ void RawProcess::methodChanged ()
s = procparams::RAWParams::methodstring[curSelection];
if (listener)
listener->panelChanged (EvDemosaic, Glib::ustring(M("PREFERENCES_DMETHOD"))+ "="+ s);
listener->panelChanged (EvDemosaicMethod, s);
}
void RawProcess::dcbEnhanceChanged ()
@@ -178,5 +184,5 @@ void RawProcess::dcbEnhanceChanged ()
lastDCBen = dcbEnhance->get_active ();
}
if (listener)
listener->panelChanged (EvDemosaic, Glib::ustring("params") );
listener->panelChanged (EvDemosaicDCBEnhanced, dcbEnhance->get_active()?M("GENERAL_ENABLED"):M("GENERAL_DISABLED"));
}

View File

@@ -21,6 +21,7 @@
#include <ilabel.h>
#include <options.h>
#include <imagesource.h>
#include <dfmanager.h>
using namespace rtengine::procparams;
@@ -63,6 +64,9 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
hsvequalizer = Gtk::manage (new HSVEqualizer ());
rawprocess = Gtk::manage (new RawProcess ());
preprocess = Gtk::manage (new PreProcess ());
darkframe = Gtk::manage (new DarkFrame ());
rawcacorrection = Gtk::manage (new RAWCACorr ());
rawexposure = Gtk::manage (new RAWExposure ());
addPanel (colorPanel, whitebalance, M("TP_WBALANCE_LABEL")); toolPanels.push_back (whitebalance);
addPanel (exposurePanel, curve, M("TP_EXPOSURE_LABEL")); toolPanels.push_back (curve);
@@ -90,8 +94,11 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
addPanel (lensgeom->getPackBox(), cacorrection, M("TP_CACORRECTION_LABEL")); toolPanels.push_back (cacorrection);
addPanel (lensgeom->getPackBox(), vignetting, M("TP_VIGNETTING_LABEL")); toolPanels.push_back (vignetting);
addPanel (colorPanel, icm, M("TP_ICM_LABEL")); toolPanels.push_back (icm);
addPanel (rawPanel, rawprocess, M("TP_RAWPANEL_DEMOSAICING")); toolPanels.push_back (rawprocess);
addPanel (rawPanel, preprocess, M("TP_RAWPANEL_PREPROCESSING"));toolPanels.push_back (preprocess);
addPanel (rawPanel, rawprocess, M("TP_RAW_LABEL")); toolPanels.push_back (rawprocess);
addPanel (rawPanel, preprocess, M("TP_PREPROCESS_LABEL")); toolPanels.push_back (preprocess);
addPanel (rawPanel, rawexposure, M("TP_EXPOSCORR_LABEL")); toolPanels.push_back (rawexposure);
addPanel (rawPanel, darkframe, M("TP_DARKFRAME_LABEL")); toolPanels.push_back (darkframe);
addPanel (rawPanel, rawcacorrection, M("TP_CHROMATABERR_LABEL")); toolPanels.push_back (rawcacorrection);
toolPanels.push_back (coarse);
toolPanels.push_back (exifpanel);

View File

@@ -59,6 +59,9 @@
#include <hsvequalizer.h>
#include <rawprocess.h>
#include <preprocess.h>
#include <darkframe.h>
#include <rawcacorrection.h>
#include <rawexposure.h>
class ImageEditorCoordinator;
@@ -101,6 +104,9 @@ class ToolPanelCoordinator : public ToolPanelListener,
HSVEqualizer * hsvequalizer;
RawProcess* rawprocess;
PreProcess* preprocess;
DarkFrame* darkframe;
RAWCACorr* rawcacorrection;
RAWExposure* rawexposure;
std::vector<PParamsChangeListener*> paramcListeners;
@@ -161,6 +167,9 @@ class ToolPanelCoordinator : public ToolPanelListener,
void getAutoWB (double& temp, double& green) { if (ipc) ipc->getAutoWB (temp, green); }
void getCamWB (double& temp, double& green) { if (ipc) ipc->getCamWB (temp, green); }
//DFProvider interface
rtengine::RawImage* getDF();
// rotatelistener interface
void straightenRequested ();
void autoCropRequested ();