Implementing issue #190 (a new "Fit box" option in the resize tool), and correction of issue #28, #92, #149, #237 and #345, but i had to disable the resize preview for that.

This commit is contained in:
Hombre
2010-12-12 22:24:53 +01:00
parent e394b29d6d
commit 5027c8c00b
24 changed files with 934 additions and 727 deletions

View File

@@ -186,6 +186,8 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G
for (int i=0; i<toolPanels.size(); i++)
toolPanels[i]->write (&pparams, &pparamsEdited);
// TODO: We may update the crop on coarse rotate events here, like in ToolPanelCoordinator::panelChanged
if (event==rtengine::EvAutoExp || event==rtengine::EvClip)
for (int i=0; i<selected.size(); i++) {
initialPP[i].toneCurve.autoexp = pparams.toneCurve.autoexp;

View File

@@ -187,8 +187,6 @@ Crop::Crop () {
dpi->signal_value_changed().connect( sigc::mem_fun(*this, &Crop::refreshSize) );
nx = ny = nw = nh = 0;
nsx = nsy = nsw = nsh = 0;
lastScale = 1.0;
lastRotationDeg = 0;
show_all ();
}
@@ -217,15 +215,17 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
hconn.block (true);
rconn.block (true);
fconn.block (true);
econn.block (true);
oconn.block (true);
gconn.block (true);
enabled->set_active (pp->crop.enabled);
// check if the new values are larger than the maximum
double tmp, maxw, maxh;
w->get_range (tmp, maxw);
h->get_range (tmp, maxh);
if (pp->crop.x + pp->crop.w > maxw || pp->crop.y + pp->crop.h > maxh)
if (pp->crop.x + pp->crop.w > (int)maxw || pp->crop.y + pp->crop.h > (int)maxh)
setDimensions (pp->crop.x + pp->crop.w, pp->crop.y + pp->crop.h);
ratio->set_active_text (pp->crop.ratio);
@@ -263,14 +263,6 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
nw = pp->crop.w;
nh = pp->crop.h;
if (pp->resize.enabled)
lastScale = pp->resize.scale;
else
lastScale = 1.0;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
lastRotationDeg = pp->coarse.rotate;
wDirty = false;
@@ -302,6 +294,7 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
hconn.block (false);
rconn.block (false);
fconn.block (false);
econn.block (false);
oconn.block (false);
gconn.block (false);
@@ -354,6 +347,40 @@ void Crop::write (ProcParams* pp, ParamsEdited* pedited) {
}
void Crop::trim (ProcParams* pp, int ow, int oh) {
int xmin = pp->crop.x;
int ymin = pp->crop.y;
if (xmin > maxw || ymin > maxh) {
// the crop is completely out of the image, so we disable the crop
pp->crop.enabled = false;
// and we set the values to the defaults
pp->crop.x = 0;
pp->crop.y = 0;
pp->crop.w = ow;
pp->crop.h = oh;
// the ratio is now not guaranteed, so we set it off
pp->crop.fixratio = false;
}
else {
bool unsetRatio = false;
if ((xmin + pp->crop.w) > ow) {
// crop overflow in the width dimension ; we trim it
pp->crop.w = ow-xmin;
unsetRatio = true;
}
if ((ymin + pp->crop.h) > oh) {
// crop overflow in the height dimension ; we trim it
pp->crop.h = oh-ymin;
unsetRatio = true;
}
if (unsetRatio) {
// the ratio is certainly not respected anymore, so we set it off
pp->crop.fixratio = false;
}
}
}
void Crop::selectPressed () {
if (clistener)
@@ -407,32 +434,15 @@ int refreshspins (void* data) {
return 0;
}
void Crop::resizeScaleChanged (double rsc) {
lastScale = rsc;
nx = (int)round (nsx * rsc);
ny = (int)round (nsy * rsc);
nw = (int)round (nsw * rsc);
nh = (int)round (nsh * rsc);
if (nx+nw > maxw || ny+nh > maxh)
setDimensions (nx+nw, ny+nh);
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
}
void Crop::hFlipCrop () {
nx = maxw - nx - nw;
nsx = nx / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
}
void Crop::vFlipCrop () {
ny = maxh - ny - nh;
nsy = ny / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
}
@@ -461,10 +471,6 @@ void Crop::rotateCrop (int deg) {
ny = maxh - ny - nh;
break;
}
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
lastRotationDeg = deg;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
@@ -561,25 +567,29 @@ void Crop::refreshSize () {
}
}
/*
* Set the maximum dimensions of the image. This method can be called with wrong values, then
* called with the good ones !?
*/
void Crop::setDimensions (int mw, int mh) {
maxw = mw;
maxh = mh;
xconn.block (true);
yconn.block (true);
wconn.block (true);
hconn.block (true);
bool xconnWasBlocked = xconn.block (true);
bool yconnWasBlocked = yconn.block (true);
bool wconnWasBlocked = wconn.block (true);
bool hconnWasBlocked = hconn.block (true);
w->set_range (0, maxw);
h->set_range (0, maxh);
x->set_range (0, maxw);
y->set_range (0, maxh);
xconn.block (false);
yconn.block (false);
wconn.block (false);
hconn.block (false);
if (!xconnWasBlocked) xconn.block (false);
if (!yconnWasBlocked) yconn.block (false);
if (!wconnWasBlocked) wconn.block (false);
if (!hconnWasBlocked) hconn.block (false);
if (enabled->get_active()==false) {
nx = 0;
@@ -587,12 +597,8 @@ void Crop::setDimensions (int mw, int mh) {
nw = mw;
nh = mh;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
refreshSpins ();
}
}
refreshSize ();
}
@@ -671,11 +677,6 @@ void Crop::cropMoved (int &X, int &Y, int &W, int &H) {
nw = W;
nh = H;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
}
@@ -706,11 +707,6 @@ void Crop::cropWidth1Resized (int &X, int &Y, int &W, int &H) {
nw = W;
nh = H;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
}
@@ -743,11 +739,6 @@ void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H) {
nw = W;
nh = H;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
}
@@ -779,11 +770,6 @@ void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H) {
nw = W;
nh = H;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
}
@@ -815,11 +801,6 @@ void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H) {
nw = W;
nh = H;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
}
@@ -831,11 +812,6 @@ void Crop::cropInit (int &x, int &y, int &w, int &h) {
nw = 1;
nh = 1;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
w = 1; h = 1;
econn.block (true);
@@ -926,11 +902,6 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2) {
nw = W;
nh = H;
nsx = nx / lastScale;
nsy = ny / lastScale;
nsw = nw / lastScale;
nsh = nh / lastScale;
g_idle_add (refreshspins, new RefreshSpinHelper (this, false));
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
}

View File

@@ -51,7 +51,6 @@ class Crop : public Gtk::VBox, public CropGUIListener, public ToolPanel, public
Gtk::VBox* dpibox;
int maxw, maxh;
int nx, ny, nw, nh;
double nsx, nsy, nsw, nsh, lastScale;
int lastRotationDeg;
sigc::connection xconn, yconn, wconn, hconn, econn, fconn, rconn, oconn, gconn;
bool wDirty, hDirty, xDirty, yDirty, lastEnabled, lastAspect;
@@ -67,7 +66,7 @@ class Crop : public Gtk::VBox, public CropGUIListener, public ToolPanel, public
void ratioChanged ();
void refreshSize ();
void selectPressed ();
void setDimensions (int mw, int mh);
void setDimensions (int mw, int mh);
void enabledChanged ();
void positionChanged ();
void widthChanged ();
@@ -75,6 +74,7 @@ class Crop : public Gtk::VBox, public CropGUIListener, public ToolPanel, public
bool refreshSpins (bool notify=false);
void notifyListener ();
void sizeChanged (int w, int h, int ow, int oh);
void trim (rtengine::procparams::ProcParams* pp, int ow, int oh);
void readOptions ();
void writeOptions ();

View File

@@ -246,8 +246,6 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
}
EditorPanel::~EditorPanel () {
history->setHistoryBeforeLineListener (NULL);
@@ -389,15 +387,15 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
}
void EditorPanel::close () {
if (ipc)
{
saveProfile ();
// close image processor and the current thumbnail
tpc->closeImage (); // this call stops image processing
tpc->writeOptions ();
rtengine::ImageSource* is=isrc->getImageSource();
is->setProgressListener( NULL );
rtengine::ImageSource* is=isrc->getImageSource();
is->setProgressListener( NULL );
if (ipc)
ipc->setPreviewImageListener (NULL);
@@ -425,9 +423,8 @@ void EditorPanel::close () {
}
void EditorPanel::saveProfile () {
if (!ipc) return;
if (!ipc)
return;
ProcParams params;
ipc->getParams (&params);
@@ -894,7 +891,6 @@ void EditorPanel::saveAsPressed () {
}
void EditorPanel::queueImgPressed () {
saveProfile ();
parent->addBatchQueueJob (createBatchQueueEntry ());
}
@@ -1042,11 +1038,6 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16*
return false;
}
/*
void EditorPanel::saveOptions () {
}
*/
void EditorPanel::historyBeforeLineChanged (const rtengine::procparams::ProcParams& params) {
if (beforeIpc) {

View File

@@ -28,123 +28,124 @@ ParamsEdited::ParamsEdited () {
void ParamsEdited::set (bool v) {
toneCurve.curve = v;
toneCurve.brightness = v;
toneCurve.black = v;
toneCurve.contrast = v;
toneCurve.saturation = v;
toneCurve.shcompr = v;
toneCurve.hlcompr = v;
toneCurve.autoexp = v;
toneCurve.clip = v;
toneCurve.expcomp = v;
labCurve.lcurve = v;
labCurve.acurve = v;
labCurve.bcurve = v;
labCurve.brightness = v;
labCurve.contrast = v;
labCurve.saturation = v;
sharpening.enabled = v;
sharpening.radius = v;
sharpening.amount = v;
sharpening.threshold = v;
sharpening.edgesonly = v;
sharpening.edges_radius = v;
sharpening.edges_tolerance = v;
sharpening.halocontrol = v;
sharpening.halocontrol_amount= v;
sharpening.method = v;
sharpening.deconvamount = v;
sharpening.deconvradius = v;
sharpening.deconviter = v;
sharpening.deconvdamping = v;
colorBoost.amount = v;
colorBoost.avoidclip = v;
colorBoost.enable_saturationlimiter = v;
colorBoost.saturationlimit = v;
wb.method = v;
wb.green = v;
wb.temperature = v;
colorShift.a = v;
colorShift.b = v;
lumaDenoise.enabled = v;
lumaDenoise.radius = v;
lumaDenoise.edgetolerance = v;
colorDenoise.enabled = v;
colorDenoise.amount = v;
defringe.enabled = v;
defringe.radius = v;
defringe.threshold = v;
impulseDenoise.enabled = v;
impulseDenoise.thresh = v;
dirpyrDenoise.enabled = v;
dirpyrDenoise.luma = v;
toneCurve.curve = v;
toneCurve.brightness = v;
toneCurve.black = v;
toneCurve.contrast = v;
toneCurve.saturation = v;
toneCurve.shcompr = v;
toneCurve.hlcompr = v;
toneCurve.autoexp = v;
toneCurve.clip = v;
toneCurve.expcomp = v;
labCurve.lcurve = v;
labCurve.acurve = v;
labCurve.bcurve = v;
labCurve.brightness = v;
labCurve.contrast = v;
labCurve.saturation = v;
sharpening.enabled = v;
sharpening.radius = v;
sharpening.amount = v;
sharpening.threshold = v;
sharpening.edgesonly = v;
sharpening.edges_radius = v;
sharpening.edges_tolerance = v;
sharpening.halocontrol = v;
sharpening.halocontrol_amount= v;
sharpening.method = v;
sharpening.deconvamount = v;
sharpening.deconvradius = v;
sharpening.deconviter = v;
sharpening.deconvdamping = v;
colorBoost.amount = v;
colorBoost.avoidclip = v;
colorBoost.enable_saturationlimiter = v;
colorBoost.saturationlimit = v;
wb.method = v;
wb.green = v;
wb.temperature = v;
colorShift.a = v;
colorShift.b = v;
lumaDenoise.enabled = v;
lumaDenoise.radius = v;
lumaDenoise.edgetolerance = v;
colorDenoise.enabled = v;
colorDenoise.amount = v;
defringe.enabled = v;
defringe.radius = v;
defringe.threshold = v;
impulseDenoise.enabled = v;
impulseDenoise.thresh = v;
dirpyrDenoise.enabled = v;
dirpyrDenoise.luma = v;
dirpyrDenoise.chroma = v;
dirpyrDenoise.gamma = v;
sh.enabled = v;
sh.hq = v;
sh.highlights = v;
sh.htonalwidth = v;
sh.shadows = v;
sh.stonalwidth = v;
sh.localcontrast = v;
sh.radius = v;
crop.enabled = v;
crop.x = v;
crop.y = v;
crop.w = v;
crop.h = v;
crop.fixratio = v;
crop.ratio = v;
crop.orientation = v;
crop.guide = v;
coarse.rotate = v;
coarse.hflip = v;
coarse.vflip = v;
commonTrans.autofill = v;
rotate.degree = v;
distortion.uselensfun = v;
distortion.amount = v;
perspective.horizontal = v;
perspective.vertical = v;
cacorrection.red = v;
cacorrection.blue = v;
vignetting.amount = v;
vignetting.radius = v;
vignetting.strength = v;
vignetting.centerX = v;
vignetting.centerY = v;
chmixer.red[0] = v;
chmixer.red[1] = v;
chmixer.red[2] = v;
chmixer.green[0] = v;
chmixer.green[1] = v;
chmixer.green[2] = v;
chmixer.blue[0] = v;
chmixer.blue[1] = v;
chmixer.blue[2] = v;
hlrecovery.enabled = v;
hlrecovery.method = v;
resize.scale = v;
resize.method = v;
resize.dataspec = v;
resize.width = v;
resize.height = v;
resize.enabled = v;
icm.input = v;
icm.gammaOnInput = v;
icm.working = v;
icm.output = v;
raw.ccSteps = v;
raw.dmethod = v;
raw.dcbIterations = v;
raw.dcbEnhance = v;
equalizer.enabled = v;
dirpyrequalizer.enabled = v;
hsvequalizer.enabled = v;
for(int i = 0; i < 8; i++) {
equalizer.c[i] = v;
}
sh.enabled = v;
sh.hq = v;
sh.highlights = v;
sh.htonalwidth = v;
sh.shadows = v;
sh.stonalwidth = v;
sh.localcontrast = v;
sh.radius = v;
crop.enabled = v;
crop.x = v;
crop.y = v;
crop.w = v;
crop.h = v;
crop.fixratio = v;
crop.ratio = v;
crop.orientation = v;
crop.guide = v;
coarse.rotate = v;
coarse.hflip = v;
coarse.vflip = v;
commonTrans.autofill = v;
rotate.degree = v;
distortion.uselensfun = v;
distortion.amount = v;
perspective.horizontal = v;
perspective.vertical = v;
cacorrection.red = v;
cacorrection.blue = v;
vignetting.amount = v;
vignetting.radius = v;
vignetting.strength = v;
vignetting.centerX = v;
vignetting.centerY = v;
chmixer.red[0] = v;
chmixer.red[1] = v;
chmixer.red[2] = v;
chmixer.green[0] = v;
chmixer.green[1] = v;
chmixer.green[2] = v;
chmixer.blue[0] = v;
chmixer.blue[1] = v;
chmixer.blue[2] = v;
hlrecovery.enabled = v;
hlrecovery.method = v;
resize.scale = v;
resize.appliesTo = v;
resize.method = v;
resize.dataspec = v;
resize.width = v;
resize.height = v;
resize.enabled = v;
icm.input = v;
icm.gammaOnInput = v;
icm.working = v;
icm.output = v;
raw.ccSteps = v;
raw.dmethod = v;
raw.dcbIterations = v;
raw.dcbEnhance = v;
equalizer.enabled = v;
dirpyrequalizer.enabled = v;
hsvequalizer.enabled = v;
for(int i = 0; i < 8; i++) {
equalizer.c[i] = v;
}
for(int i = 0; i < 5; i++) {
dirpyrequalizer.mult[i] = v;
}
@@ -153,8 +154,8 @@ void ParamsEdited::set (bool v) {
hsvequalizer.val[i] = v;
hsvequalizer.hue[i] = v;
}
exif.clear ();
iptc.clear ();
exif.clear ();
iptc.clear ();
}
using namespace rtengine;
@@ -173,19 +174,19 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
toneCurve.brightness = toneCurve.brightness && p.toneCurve.brightness == other.toneCurve.brightness;
toneCurve.black = toneCurve.black && p.toneCurve.black == other.toneCurve.black;
toneCurve.contrast = toneCurve.contrast && p.toneCurve.contrast == other.toneCurve.contrast;
toneCurve.saturation = toneCurve.saturation && p.toneCurve.saturation == other.toneCurve.saturation;
toneCurve.shcompr = toneCurve.shcompr && p.toneCurve.shcompr == other.toneCurve.shcompr;
toneCurve.saturation = toneCurve.saturation && p.toneCurve.saturation == other.toneCurve.saturation;
toneCurve.shcompr = toneCurve.shcompr && p.toneCurve.shcompr == other.toneCurve.shcompr;
toneCurve.hlcompr = toneCurve.hlcompr && p.toneCurve.hlcompr == other.toneCurve.hlcompr;
toneCurve.autoexp = toneCurve.autoexp && p.toneCurve.autoexp == other.toneCurve.autoexp;
toneCurve.clip = toneCurve.clip && p.toneCurve.clip == other.toneCurve.clip;
toneCurve.expcomp = toneCurve.expcomp && p.toneCurve.expcomp == other.toneCurve.expcomp;
labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve;
labCurve.acurve = labCurve.acurve && p.labCurve.acurve == other.labCurve.acurve;
labCurve.acurve = labCurve.acurve && p.labCurve.acurve == other.labCurve.acurve;
labCurve.bcurve = labCurve.bcurve && p.labCurve.bcurve == other.labCurve.bcurve;
labCurve.brightness = labCurve.brightness && p.labCurve.brightness == other.labCurve.brightness;
labCurve.contrast = labCurve.contrast && p.labCurve.contrast == other.labCurve.contrast;
labCurve.saturation = labCurve.saturation && p.labCurve.saturation == other.labCurve.saturation;
sharpening.enabled = sharpening.enabled && p.sharpening.enabled == other.sharpening.enabled;
labCurve.saturation = labCurve.saturation && p.labCurve.saturation == other.labCurve.saturation;
sharpening.enabled = sharpening.enabled && p.sharpening.enabled == other.sharpening.enabled;
sharpening.radius = sharpening.radius && p.sharpening.radius == other.sharpening.radius;
sharpening.amount = sharpening.amount && p.sharpening.amount == other.sharpening.amount;
sharpening.threshold = sharpening.threshold && p.sharpening.threshold == other.sharpening.threshold;
@@ -213,17 +214,17 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
lumaDenoise.edgetolerance = lumaDenoise.edgetolerance && p.lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance;
colorDenoise.enabled = colorDenoise.enabled && p.colorDenoise.enabled == other.colorDenoise.enabled;
colorDenoise.amount = colorDenoise.amount && p.colorDenoise.amount == other.colorDenoise.amount;
defringe.enabled = defringe.enabled && p.defringe.enabled == other.defringe.enabled;
defringe.enabled = defringe.enabled && p.defringe.enabled == other.defringe.enabled;
defringe.radius = defringe.radius && p.defringe.radius == other.defringe.radius;
defringe.threshold = defringe.threshold && p.defringe.threshold == other.defringe.threshold;
impulseDenoise.enabled = impulseDenoise.enabled && p.impulseDenoise.enabled == other.impulseDenoise.enabled;
impulseDenoise.thresh = impulseDenoise.thresh && p.impulseDenoise.thresh == other.impulseDenoise.thresh;
impulseDenoise.enabled = impulseDenoise.enabled && p.impulseDenoise.enabled == other.impulseDenoise.enabled;
impulseDenoise.thresh = impulseDenoise.thresh && p.impulseDenoise.thresh == other.impulseDenoise.thresh;
dirpyrDenoise.enabled = dirpyrDenoise.enabled && p.dirpyrDenoise.enabled == other.dirpyrDenoise.enabled;
dirpyrDenoise.enabled = dirpyrDenoise.enabled && p.dirpyrDenoise.enabled == other.dirpyrDenoise.enabled;
dirpyrDenoise.luma = dirpyrDenoise.luma && p.dirpyrDenoise.luma == other.dirpyrDenoise.luma;
dirpyrDenoise.chroma = dirpyrDenoise.chroma && p.dirpyrDenoise.chroma == other.dirpyrDenoise.chroma;
dirpyrDenoise.gamma = dirpyrDenoise.gamma && p.dirpyrDenoise.gamma == other.dirpyrDenoise.gamma;
dirpyrDenoise.gamma = dirpyrDenoise.gamma && p.dirpyrDenoise.gamma == other.dirpyrDenoise.gamma;
sh.enabled = sh.enabled && p.sh.enabled == other.sh.enabled;
sh.hq = sh.hq && p.sh.hq == other.sh.hq;
@@ -270,6 +271,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
hlrecovery.enabled = hlrecovery.enabled && p.hlrecovery.enabled == other.hlrecovery.enabled;
hlrecovery.method = hlrecovery.method && p.hlrecovery.method == other.hlrecovery.method;
resize.scale = resize.scale && p.resize.scale == other.resize.scale;
resize.appliesTo = resize.appliesTo && p.resize.appliesTo == other.resize.appliesTo;
resize.method = resize.method && p.resize.method == other.resize.method;
resize.dataspec = resize.dataspec && p.resize.dataspec == other.resize.dataspec;
resize.width = resize.width && p.resize.width == other.resize.width;
@@ -296,14 +298,14 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
for(int i = 0; i < 8; i++) {
equalizer.c[i] = equalizer.c[i] && p.equalizer.c[i] == other.equalizer.c[i];
}
dirpyrequalizer.enabled = dirpyrequalizer.enabled && p.dirpyrequalizer.enabled == other.dirpyrequalizer.enabled;
dirpyrequalizer.enabled = dirpyrequalizer.enabled && p.dirpyrequalizer.enabled == other.dirpyrequalizer.enabled;
for(int i = 0; i < 8; i++) {
dirpyrequalizer.mult[i] = dirpyrequalizer.mult[i] && p.dirpyrequalizer.mult[i] == other.dirpyrequalizer.mult[i];
}
hsvequalizer.enabled = hsvequalizer.enabled && p.hsvequalizer.enabled == other.hsvequalizer.enabled;
hsvequalizer.enabled = hsvequalizer.enabled && p.hsvequalizer.enabled == other.hsvequalizer.enabled;
for(int i = 0; i < 8; i++) {
hsvequalizer.sat[i] = hsvequalizer.sat[i] && p.hsvequalizer.sat[i] == other.hsvequalizer.sat[i];
hsvequalizer.val[i] = hsvequalizer.val[i] && p.hsvequalizer.val[i] == other.hsvequalizer.val[i];
hsvequalizer.val[i] = hsvequalizer.val[i] && p.hsvequalizer.val[i] == other.hsvequalizer.val[i];
hsvequalizer.hue[i] = hsvequalizer.hue[i] && p.hsvequalizer.hue[i] == other.hsvequalizer.hue[i];
}
// exif = exif && p.exif==other.exif
@@ -415,6 +417,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (hlrecovery.enabled) toEdit.hlrecovery.enabled = mods.hlrecovery.enabled;
if (hlrecovery.method) toEdit.hlrecovery.method = mods.hlrecovery.method;
if (resize.scale) toEdit.resize.scale = mods.resize.scale;
if (resize.appliesTo) toEdit.resize.appliesTo = mods.resize.appliesTo;
if (resize.method) toEdit.resize.method = mods.resize.method;
if (resize.dataspec) toEdit.resize.dataspec = mods.resize.dataspec;
if (resize.width) toEdit.resize.width = mods.resize.width;

View File

@@ -231,6 +231,7 @@ class ResizeParamsEdited {
public:
bool scale;
bool appliesTo;
bool method;
bool dataspec;
bool width;
@@ -314,9 +315,9 @@ class ParamsEdited {
LumaDenoiseParamsEdited lumaDenoise;
ColorDenoiseParamsEdited colorDenoise;
DefringeParamsEdited defringe;
DirPyrDenoiseParamsEdited dirpyrDenoise;
ImpulseDenoiseParamsEdited impulseDenoise;
DefringeParamsEdited defringe;
DirPyrDenoiseParamsEdited dirpyrDenoise;
ImpulseDenoiseParamsEdited impulseDenoise;
SHParamsEdited sh;
CropParamsEdited crop;
@@ -333,8 +334,8 @@ class ParamsEdited {
ColorManagementParamsEdited icm;
EqualizerParamsEdited equalizer;
RAWParamsEdited raw;
DirPyrEqualizerParamsEdited dirpyrequalizer;
HSVEqualizerParamsEdited hsvequalizer;
DirPyrEqualizerParamsEdited dirpyrequalizer;
HSVEqualizerParamsEdited hsvequalizer;
std::vector<ExifPairEdited> exif;
std::vector<IPTCPairEdited> iptc;

View File

@@ -25,12 +25,23 @@ using namespace rtengine::procparams;
Resize::Resize () : maxw(100000), maxh(100000) {
cropw = 0;
croph = 0;
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
pack_start(*enabled);
pack_start(*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_SHRINK, 2);
Gtk::Table* combos = Gtk::manage (new Gtk::Table (2, 2));
appliesTo = Gtk::manage (new Gtk::ComboBoxText ());
appliesTo->append_text (M("TP_RESIZE_CROPPEDAREA"));
appliesTo->append_text (M("TP_RESIZE_FULLIMAGE"));
appliesTo->set_active (0);
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_APPLIESTO"))), 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*appliesTo, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
method = Gtk::manage (new Gtk::ComboBoxText ());
method->append_text (M("TP_RESIZE_NEAREST"));
method->append_text (M("TP_RESIZE_BILINEAR"));
@@ -42,22 +53,23 @@ Resize::Resize () : maxw(100000), maxh(100000) {
method->append_text (M("TP_RESIZE_LANCZOS"));
method->set_active (0);
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_METHOD"))), 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*method, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_METHOD"))), 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*method, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
spec = Gtk::manage (new Gtk::ComboBoxText ());
spec->append_text (M("TP_RESIZE_SCALE"));
spec->append_text (M("TP_RESIZE_WIDTH"));
spec->append_text (M("TP_RESIZE_HEIGHT"));
method->set_active (0);
spec->append_text (M("TP_RESIZE_FITBOX"));
spec->set_active (0);
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_SPECIFY"))), 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*spec, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_SPECIFY"))), 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*spec, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
pack_start (*combos, Gtk::PACK_SHRINK, 4);
scale = new Adjuster (M("TP_RESIZE_SCALE"), 0.2, 4, 0.01, 1);
scale->setAdjusterListener (this);
scale = new Adjuster (M("TP_RESIZE_SCALE"), 0.01, 4, 0.01, 1.);
scale->setAdjusterListener (this);
pack_start (*scale, Gtk::PACK_SHRINK, 4);
@@ -91,8 +103,9 @@ Resize::Resize () : maxw(100000), maxh(100000) {
wconn = w->signal_value_changed().connect ( sigc::mem_fun(*this, &Resize::entryWChanged), true);
hconn = h->signal_value_changed().connect ( sigc::mem_fun(*this, &Resize::entryHChanged), true);
aconn = appliesTo->signal_changed().connect ( sigc::mem_fun(*this, &Resize::appliesToChanged) );
method->signal_changed().connect ( sigc::mem_fun(*this, &Resize::methodChanged) );
spec->signal_changed().connect ( sigc::mem_fun(*this, &Resize::specChanged) );
sconn = spec->signal_changed().connect ( sigc::mem_fun(*this, &Resize::specChanged) );
enaConn = enabled->signal_toggled().connect ( sigc::mem_fun(*this, &Resize::enabledToggled) );
show_all();
@@ -107,14 +120,24 @@ Resize::~Resize () {
void Resize::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener ();
aconn.block (true);
wconn.block (true);
hconn.block (true);
sconn.block (true);
scale->block(true);
scale->setValue (pp->resize.scale);
w->set_value (pp->resize.width);
h->set_value (pp->resize.height);
enabled->set_active (pp->resize.enabled);
spec->set_active (pp->resize.dataspec);
updateGUI();
appliesTo->set_active (0);
if (pp->resize.appliesTo == "Cropped area")
appliesTo->set_active (0);
else if (pp->resize.appliesTo == "Full image")
appliesTo->set_active (1);
method->set_active (2);
if (pp->resize.method == "Nearest")
@@ -141,23 +164,36 @@ void Resize::read (const ProcParams* pp, const ParamsEdited* pedited) {
wDirty = pedited->resize.width;
hDirty = pedited->resize.height;
scale->setEditedState (pedited->resize.scale ? Edited : UnEdited);
if (!pedited->resize.appliesTo)
method->set_active (2);
if (!pedited->resize.method)
method->set_active (5);
method->set_active (8);
if (!pedited->resize.dataspec)
spec->set_active (3);
spec->set_active (4);
enabled->set_inconsistent (!pedited->resize.enabled);
}
lastEnabled = pp->resize.enabled;
scale->block(false);
sconn.block (false);
wconn.block (false);
hconn.block (false);
aconn.block (false);
enableListener ();
}
void Resize::write (ProcParams* pp, ParamsEdited* pedited) {
int dataSpec = spec->get_active_row_number();
pp->resize.scale = scale->getValue();
pp->resize.appliesTo = "Cropped area";
if (appliesTo->get_active_row_number() == 0)
pp->resize.appliesTo = "Cropped area";
else if (appliesTo->get_active_row_number() == 1)
pp->resize.appliesTo = "Full image";
pp->resize.scale = scale->getValue ();
pp->resize.method = "Bicubic";
if (method->get_active_row_number() == 0)
pp->resize.method = "Nearest";
@@ -176,15 +212,17 @@ void Resize::write (ProcParams* pp, ParamsEdited* pedited) {
else if (method->get_active_row_number() == 7)
pp->resize.method = "Lanczos";
pp->resize.dataspec = spec->get_active_row_number();
pp->resize.width = round (w->get_value ());
pp->resize.height = round(h->get_value ());
pp->resize.dataspec = dataSpec;
pp->resize.width = w->get_value_as_int ();
pp->resize.height = h->get_value_as_int ();
pp->resize.enabled = enabled->get_active ();
//printf(" L:%d H:%d\n", pp->resize.width, pp->resize.height);
if (pedited) {
pedited->resize.enabled = !enabled->get_inconsistent();
pedited->resize.dataspec = spec->get_active_row_number() != 3;
pedited->resize.method = method->get_active_row_number() != 5;
pedited->resize.dataspec = dataSpec != 4;
pedited->resize.appliesTo = appliesTo->get_active_row_number() != 2;
pedited->resize.method = method->get_active_row_number() != 8;
if (pedited->resize.dataspec) {
pedited->resize.scale = scale->getEditedState ();
pedited->resize.width = wDirty;
@@ -213,14 +251,44 @@ void Resize::adjusterChanged (Adjuster* a, double newval) {
if (!batchMode) {
wconn.block (true);
hconn.block (true);
h->set_value (maxh * a->getValue ());
w->set_value (maxw * a->getValue ());
h->set_value ((croph && appliesTo->get_active_row_number()==0 ? croph : maxh) * a->getValue ());
w->set_value ((cropw && appliesTo->get_active_row_number()==0 ? cropw : maxw) * a->getValue ());
wconn.block (false);
hconn.block (false);
}
if (listener && (enabled->get_active () || batchMode))
listener->panelChanged (EvResizeScale, Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), scale->getValue()));
listener->panelChanged (EvResizeScale, Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(2), scale->getValue()));
}
int Resize::getComputedWidth() {
if (cropw && appliesTo->get_active_row_number()==0)
// we use the crop dimensions
return (int)((double)(cropw) * (h->get_value()/(double)(croph)) + 0.5);
else
// we use the image dimensions
return (int)((double)(maxw) * (h->get_value()/(double)(maxh)) + 0.5);
}
int Resize::getComputedHeight() {
if (croph && appliesTo->get_active_row_number()==0)
// we use the crop dimensions
return (int)((double)(croph) * (w->get_value()/(double)(cropw)) + 0.5);
else
// we use the image dimensions
return (int)((double)(maxh) * (w->get_value()/(double)(maxw)) + 0.5);
}
void Resize::appliesToChanged () {
//printf("\nPASSAGE EN MODE \"%s\"\n\n", appliesTo->get_active_text().c_str());
setDimensions();
if (listener && (enabled->get_active () || batchMode)) {
//printf("Appel du listener\n");
listener->panelChanged (EvResizeAppliesTo, appliesTo->get_active_text());
}
}
void Resize::methodChanged () {
@@ -229,65 +297,155 @@ void Resize::methodChanged () {
listener->panelChanged (EvResizeMethod, method->get_active_text());
}
struct setrdimparams {
Resize* resize;
int mw;
int mh;
int ow;
int oh;
};
void Resize::update (bool isCropped, int cw, int ch, int ow, int oh) {
int setrdim (void* data) {
// updating crop values now
if (isCropped) {
cropw = cw;
croph = ch;
}
else {
cropw = 0;
croph = 0;
}
gdk_threads_enter ();
setrdimparams* params = (setrdimparams*)data;
params->resize->setDimensions (params->mw, params->mh, params->ow, params->oh);
delete params;
gdk_threads_leave ();
return 0;
// updating the full image dimensions
if (ow && oh) {
maxw = ow;
maxh = oh;
}
// updating the GUI synchronously
setDimensions();
}
void Resize::sizeChanged (int mw, int mh, int ow, int oh) {
setrdimparams* params = new setrdimparams;
params->mw = mw;
params->mh = mh;
params->ow = ow;
params->oh = oh;
params->resize = this;
g_idle_add (setrdim, params);
}
void Resize::setDimensions (int mw, int mh, int ow, int oh) {
// updating max values now
maxw = ow;
maxh = oh;
// updating the GUI synchronously
setDimensions();
}
void Resize::setDimensions () {
int refw, refh;
wconn.block (true);
hconn.block (true);
scale->block(true);
w->set_range (32, 4*maxw);
h->set_range (32, 4*maxh);
if (appliesTo->get_active_row_number()==0 && cropw) {
// Applies to Cropped area
refw = cropw;
refh = croph;
}
else {
// Applies to Full image or crop is disabled
refw = maxw;
refh = maxh;
}
w->set_range (32, 4*refw);
h->set_range (32, 4*refh);
double tmpScale;
switch (spec->get_active_row_number()) {
case (0): // Scale mode
w->set_value((double)((int)( (double)(refw) * scale->getValue() + 0.5) ));
h->set_value((double)((int)( (double)(refh) * scale->getValue() + 0.5) ));
break;
case (1): // Width mode
tmpScale = w->get_value() / (double)refw;
scale->setValue (tmpScale);
h->set_value((double)((int)( (double)(refh) * tmpScale + 0.5) ));
break;
case (2): // Height mode
tmpScale = h->get_value() / (double)refh;
scale->setValue (tmpScale);
w->set_value((double)((int)( (double)(refw) * tmpScale + 0.5) ));
case (3): { // Bounding box mode
double wSliderValue = w->get_value();
double hSliderValue = h->get_value();
if ( (wSliderValue/hSliderValue) < ((double)refw/(double)refh)) {
tmpScale = wSliderValue / (double)refw;
}
else {
tmpScale = hSliderValue / (double)refh;
}
scale->setValue (tmpScale);
break;
}
default:
break;
}
scale->block(false);
wconn.block (false);
hconn.block (false);
}
void Resize::fitBoxScale() {
double tmpScale;
double neww = w->get_value ();
double newh = h->get_value ();
if (cropw && appliesTo->get_active_row_number()==0) {
// we use the crop dimensions
if (((double)(cropw) / (double)(croph)) > (neww / newh)) {
// the new scale is given by the image width
tmpScale = neww / (double)(cropw);
}
else {
// the new scale is given by the image height
tmpScale = newh / (double)(croph);
}
}
else {
// we use the image dimensions
if (((double)(maxw) / (double)(maxh)) > (neww / newh)) {
// the new scale is given by the image width
tmpScale = neww / (double)(maxw);
}
else {
// the new scale is given by the image height
tmpScale = newh / (double)(maxh);
}
}
scale->setValue (tmpScale);
}
void Resize::entryWChanged () {
wDirty = true;
if (!batchMode && listener) {
hconn.block (true);
h->set_value (w->get_value () * maxh / maxw);
hconn.block (false);
scale->setValue (w->get_value () / maxw);
// updating width
if (!batchMode) {
if (spec->get_active_row_number() == 3) {
// Fit box mode
fitBoxScale();
}
else {
// Other modes
hconn.block (true);
scale->block (true);
h->set_value ((double)(getComputedHeight()));
scale->setValue (w->get_value () / (cropw && appliesTo->get_active_row_number()==0 ? (double)cropw : (double)maxw));
scale->block (false);
hconn.block (false);
}
}
if (listener && (enabled->get_active () || batchMode))
listener->panelChanged (EvResizeWidth, Glib::ustring::format ((int)w->get_value()));
if (listener) {
if (spec->get_active_row_number() == 3)
notifyBBox();
else {
if (enabled->get_active () || batchMode)
listener->panelChanged (EvResizeWidth, Glib::ustring::format (w->get_value_as_int()));
}
}
}
void Resize::entryHChanged () {
@@ -295,39 +453,96 @@ void Resize::entryHChanged () {
hDirty = true;
if (!batchMode && listener) {
wconn.block (true);
w->set_value (h->get_value () * maxw / maxh);
wconn.block (false);
scale->setValue (h->get_value () / maxh);
if (spec->get_active_row_number() == 3) {
// Fit box mode
fitBoxScale();
}
else {
// Other modes
wconn.block (true);
scale->block (true);
w->set_value ((double)(getComputedWidth()));
scale->setValue (h->get_value () / (croph && appliesTo->get_active_row_number()==0 ? (double)croph : (double)maxh));
scale->block (false);
wconn.block (false);
}
}
if (listener && (enabled->get_active () || batchMode))
listener->panelChanged (EvResizeHeight, Glib::ustring::format ((int)h->get_value()));
if (listener) {
if (spec->get_active_row_number() == 3)
notifyBBox();
else {
if (enabled->get_active () || batchMode)
listener->panelChanged (EvResizeHeight, Glib::ustring::format (h->get_value_as_int()));
}
}
}
void Resize::specChanged () {
switch (spec->get_active_row_number()) {
case (0):
// Scale mode
scale->sliderChanged ();
break;
case (1):
// Width mode
w->set_value((double)(getComputedWidth()));
entryWChanged ();
break;
case (2):
// Height mode
h->set_value((double)(getComputedHeight()));
entryHChanged ();
break;
case (3):
// Bounding box mode
notifyBBox();
default:
break;
}
updateGUI();
}
void Resize::updateGUI () {
removeIfThere (this, scale, false);
removeIfThere (this, sizeBox, false);
if (spec->get_active_row_number() == 0) {
switch (spec->get_active_row_number()) {
case (0):
// Scale mode
pack_start (*scale, Gtk::PACK_SHRINK, 4);
scale->sliderChanged ();
}
else if (spec->get_active_row_number() == 1) {
break;
case (1):
// Width mode
pack_start (*sizeBox, Gtk::PACK_SHRINK, 4);
w->set_sensitive (true);
h->set_sensitive (false);
entryWChanged ();
}
else if (spec->get_active_row_number() == 2) {
break;
case (2):
// Height mode
pack_start (*sizeBox, Gtk::PACK_SHRINK, 4);
h->set_sensitive (true);
w->set_sensitive (false);
entryHChanged ();
h->set_sensitive (true);
break;
case (3):
// Bounding box mode
pack_start (*sizeBox, Gtk::PACK_SHRINK, 4);
w->set_sensitive (true);
h->set_sensitive (true);
default:
break;
}
}
void Resize::notifyBBox() {
if (listener && (enabled->get_active () || batchMode))
listener->panelChanged (EvResizeBoundingBox, Glib::ustring::compose("(%1x%2)",(int)w->get_value(), (int)h->get_value() ));
}
void Resize::setBatchMode (bool batchMode) {
method->append_text (M("GENERAL_UNCHANGED"));

View File

@@ -29,12 +29,14 @@ class Resize : public Gtk::VBox, public AdjusterListener, public ToolPanel, publ
Gtk::CheckButton* enabled;
Adjuster* scale;
Gtk::VBox* sizeBox;
Gtk::ComboBoxText* appliesTo;
Gtk::ComboBoxText* method;
Gtk::ComboBoxText* spec;
Gtk::SpinButton* w;
Gtk::SpinButton* h;
int maxw, maxh;
sigc::connection wconn, hconn, enaConn;
int cropw, croph;
sigc::connection sconn, aconn, wconn, hconn, enaConn;
bool wDirty, hDirty, lastEnabled;
public:
@@ -47,14 +49,24 @@ class Resize : public Gtk::VBox, public AdjusterListener, public ToolPanel, publ
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void adjusterChanged (Adjuster* a, double newval);
void entryWChanged ();
void entryHChanged ();
void methodChanged ();
void specChanged ();
void sizeChanged (int w, int h, int ow, int oh);
void setDimensions (int w, int h, int ow, int oh);
void enabledToggled ();
void adjusterChanged (Adjuster* a, double newval);
void entryWChanged ();
void entryHChanged ();
void appliesToChanged ();
void methodChanged ();
void specChanged ();
void update (bool isCropped, int cw, int ch, int ow=0, int oh=0);
void setGUIFromCrop (bool isCropped, int cw, int ch);
void sizeChanged (int w, int h, int ow, int oh);
void setDimensions ();
void enabledToggled ();
private:
void fitBoxScale ();
int getComputedWidth ();
int getComputedHeight ();
void notifyBBox ();
void updateGUI ();
};
#endif

View File

@@ -36,19 +36,19 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
shadowshighlights = Gtk::manage (new ShadowsHighlights ());
lumadenoise = Gtk::manage (new LumaDenoise ());
colordenoise = Gtk::manage (new ColorDenoise ());
impulsedenoise = Gtk::manage (new ImpulseDenoise ());
defringe = Gtk::manage (new Defringe ());
dirpyrdenoise = Gtk::manage (new DirPyrDenoise ());
impulsedenoise = Gtk::manage (new ImpulseDenoise ());
defringe = Gtk::manage (new Defringe ());
dirpyrdenoise = Gtk::manage (new DirPyrDenoise ());
sharpening = Gtk::manage (new Sharpening ());
lcurve = Gtk::manage (new LCurve ());
colorboost = Gtk::manage (new ColorBoost ());
colorshift = Gtk::manage (new ColorShift ());
lensgeom = Gtk::manage (new LensGeometry ());
lensgeom = Gtk::manage (new LensGeometry ());
distortion = Gtk::manage (new Distortion ());
rotate = Gtk::manage (new Rotate ());
whitebalance = Gtk::manage (new WhiteBalance ());
vignetting = Gtk::manage (new Vignetting ());
perspective = Gtk::manage (new PerspCorrection ());
perspective = Gtk::manage (new PerspCorrection ());
cacorrection = Gtk::manage (new CACorrection ());
hlrecovery = Gtk::manage (new HLRecovery ());
chmixer = Gtk::manage (new ChMixer ());
@@ -59,7 +59,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
iptcpanel = Gtk::manage (new IPTCPanel ());
equalizer = Gtk::manage (new Equalizer ());
dirpyrequalizer = Gtk::manage (new DirPyrEqualizer ());
hsvequalizer = Gtk::manage (new HSVEqualizer ());
hsvequalizer = Gtk::manage (new HSVEqualizer ());
rawprocess = Gtk::manage (new RawProcess ());
preprocess = Gtk::manage (new PreProcess ());
@@ -71,14 +71,14 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
addPanel (detailsPanel, sharpening, M("TP_SHARPENING_LABEL")); toolPanels.push_back (sharpening);
addPanel (colorPanel, colorboost, M("TP_COLORBOOST_LABEL")); toolPanels.push_back (colorboost);
addPanel (colorPanel, colorshift, M("TP_COLORSHIFT_LABEL")); toolPanels.push_back (colorshift);
addPanel (colorPanel, hsvequalizer, M("TP_HSVEQUALIZER_LABEL")); toolPanels.push_back (hsvequalizer);
addPanel (exposurePanel, lcurve, M("TP_LABCURVE_LABEL")); toolPanels.push_back (lcurve);
addPanel (detailsPanel, impulsedenoise, M("TP_IMPULSEDENOISE_LABEL")); toolPanels.push_back (impulsedenoise);
addPanel (colorPanel, hsvequalizer, M("TP_HSVEQUALIZER_LABEL")); toolPanels.push_back (hsvequalizer);
addPanel (exposurePanel, lcurve, M("TP_LABCURVE_LABEL")); toolPanels.push_back (lcurve);
addPanel (detailsPanel, impulsedenoise, M("TP_IMPULSEDENOISE_LABEL")); toolPanels.push_back (impulsedenoise);
addPanel (detailsPanel, lumadenoise, M("TP_LUMADENOISE_LABEL")); toolPanels.push_back (lumadenoise);
addPanel (detailsPanel, colordenoise, M("TP_COLORDENOISE_LABEL")); toolPanels.push_back (colordenoise);
addPanel (detailsPanel, dirpyrdenoise, M("TP_DIRPYRDENOISE_LABEL")); toolPanels.push_back (dirpyrdenoise);
addPanel (detailsPanel, defringe, M("TP_DEFRINGE_LABEL")); toolPanels.push_back (defringe);
addPanel (detailsPanel, dirpyrequalizer, M("TP_DIRPYREQUALIZER_LABEL")); toolPanels.push_back (dirpyrequalizer);
addPanel (detailsPanel, dirpyrdenoise, M("TP_DIRPYRDENOISE_LABEL")); toolPanels.push_back (dirpyrdenoise);
addPanel (detailsPanel, defringe, M("TP_DEFRINGE_LABEL")); toolPanels.push_back (defringe);
addPanel (detailsPanel, dirpyrequalizer, M("TP_DIRPYREQUALIZER_LABEL")); toolPanels.push_back (dirpyrequalizer);
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);
@@ -188,11 +188,7 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
toolPanels[i]->write (params);
// some transformations make the crop change for convenience
if (event==rtengine::EvResizeScale) {
crop->resizeScaleChanged (params->resize.scale);
crop->write (params);
}
else if (event==rtengine::EvCTHFlip) {
if (event==rtengine::EvCTHFlip) {
crop->hFlipCrop ();
crop->write (params);
}
@@ -203,6 +199,12 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
else if (event==rtengine::EvCTRotate) {
crop->rotateCrop (params->coarse.rotate);
crop->write (params);
resize->update (params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
resize->write (params);
}
else if (event==rtengine::EvCrop) {
resize->update (params->crop.enabled, params->crop.w, params->crop.h);
resize->write (params);
}
ipc->paramsUpdateReady ();
@@ -216,10 +218,15 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
void ToolPanelCoordinator::profileChange (const ProcParams *nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited) {
if (!ipc) return;
ProcParams* params = ipc->getParamsForUpdate (event);
ProcParams *params = ipc->getParamsForUpdate (event);
*params = *nparams;
for (int i=0; i<toolPanels.size(); i++)
toolPanels[i]->read (nparams);
// trimming overflowing cropped area
crop->trim(params, ipc->getFullWidth(), ipc->getFullHeight());
// updating the GUI with updated values
for (unsigned int i=0; i<toolPanels.size(); i++)
toolPanels[i]->read (params);
ipc->paramsUpdateReady ();