Completing issue 1514: "Lab adjustements : CC curve and LC Hskin curve" + bugfix of the openIfNonlinear mechanism

This commit is contained in:
natureh
2012-08-16 13:53:17 +02:00
parent 88cf910c6d
commit 9c66911c99
32 changed files with 417 additions and 344 deletions

View File

@@ -1,4 +1,3 @@
ABOUT_TAB_BUILD;Version
ABOUT_TAB_CREDITS;Crédits
ABOUT_TAB_LICENSE;Licence
@@ -214,6 +213,7 @@ HISTOGRAM_BUTTON_R;R
HISTOGRAM_LABEL;Histogramme
HISTOGRAM_TOOLTIP_BAR;Montrer/Cacher l'indicateur RVB du pixel pointé\nCliquer le bouton droit de la souris sur l'image de prévisualisation pour geler/dégeler
HISTOGRAM_TOOLTIP_B;Montrer/cacher l'histogramme BLEU
HISTOGRAM_TOOLTIP_FULL;Basculer la vue de l'histogramme : complet / zoomé
HISTOGRAM_TOOLTIP_G;Montrer/cacher l'histogramme VERT
HISTOGRAM_TOOLTIP_L;Montrer/cacher l'histogramme Luminance CIELAB
HISTOGRAM_TOOLTIP_RAW;Montrer/Cacher l'histogramme des données RAW
@@ -390,9 +390,11 @@ HISTORY_MSG_164;Courbes RVB - V
HISTORY_MSG_165;Courbes RVB - B
HISTORY_MSG_166;Niveaux neutre
HISTORY_MSG_167;Mode N&B colorisable
HISTORY_MSG_168;Courbe 'Cc'
HISTORY_MSG_169;Courbe 'Ct'
HISTORY_MSG_168;Courbe 'CC'
HISTORY_MSG_169;Courbe 'CT'
HISTORY_MSG_170;Vibrance - courbe
HISTORY_MSG_171;Courbe 'LC'
HISTORY_MSG_172;Restreindre 'LC' aux tons rouge et peau
HISTORY_NEWSNAPSHOTAS;Sous...
HISTORY_NEWSNAPSHOT;Ajouter
HISTORY_NEWSSDIALOGLABEL;Label de la capture:
@@ -510,6 +512,9 @@ MAIN_TAB_TAGGING;Étiquetter
MAIN_TAB_TRANSFORM;Transformation
MAIN_TAB_TRANSFORM_TOOLTIP;<b>Alt-t</b>
MAIN_TOGGLE_BEFORE_AFTER;Av|Ap
MAIN_TOOLTIP_BACKCOLOR0;Couleur de fond de l'aperçu: <b>Selon le thème</b>\nRaccourci : <b>8</b>
MAIN_TOOLTIP_BACKCOLOR1;Couleur de fond de l'aperçu: <b>Noir</b>\nRaccourci : <b>9</b>
MAIN_TOOLTIP_BACKCOLOR2;Couleur de fond de l'aperçu: <b>Blanc</b>\nRaccourci: <b>0</b>
MAIN_TOOLTIP_BEFOREAFTERLOCK;<b>Vérouille</b> / <b>déverouille</b> la vue <b>Avant</b>\n\n<b>Vérouille</b>: garde la vue <b>Avant</b> inchangée - \nutile pour évaluer l'effet cumultaif de plusieurs outils.\nDe plus, une comparaison peut être faite à partir de n'importe quelle étape de l'historique\n\n<b>Déverouille</b>: la vue <b>Avant</b> représentera l'étape précédant la vue <b>Après</b>, montrant l'effet qui vient d'être modifié
MAIN_TOOLTIP_HIDEFP;Montrer/cacher le panneau inférieur (navigateur de dossiers et de fichiers) <b>F</b>
MAIN_TOOLTIP_HIDEHP;Montrer/cacher le panneau gauche (incluant l'historique) <b>H</b>
@@ -547,6 +552,7 @@ NAVIGATOR_S_NA;S = n/d
NAVIGATOR_S_VALUE;S = %1
NAVIGATOR_V_NA;V = n/d
NAVIGATOR_V_VALUE;V = %1
NAVIGATOR_XY_FULL;Largeur = %1, Hauteur = %2
NAVIGATOR_XY_NA;x = n/d, y = n/d
OPTIONS_DEFIMG_MISSING;Le profil par défaut pour les <b>images standards</b> n'a pas été trouvé ou n'a pas été réglé.\n\nVérifiez également le dossier de vos profils, il peut être manquant ou endommagé\n\nLes valeurs internes pas défaut seront utilisées.
OPTIONS_DEFRAW_MISSING;Le profil par défaut pour les <b>images Raw</b> n'a pas été trouvé ou n'a pas été réglé.\n\nVérifiez également le dossier de vos profils, il peut être manquant ou endommagé\n\nLes valeurs internes pas défaut seront utilisées.
@@ -787,6 +793,7 @@ PROGRESSBAR_LOADJPEG;Chargement du fichier JPEG...
PROGRESSBAR_LOADPNG;Chargement du fichier PNG...
PROGRESSBAR_LOADTIFF;Chargement du fichier TIFF...
PROGRESSBAR_PROCESSING;Traitement de l'Image...
PROGRESSBAR_PROCESSING_PROFILESAVED;Profil de traitement sauvegardé
PROGRESSBAR_READY;Prêt.
PROGRESSBAR_SAVEJPEG;Enregistrement du fichier JPEG...
PROGRESSBAR_SAVEPNG;Enregistrement du fichier PNG...
@@ -862,6 +869,7 @@ TP_COLORSHIFT_LABEL;Décalage couleur
TP_CROP_FIXRATIO;Ratio fixe:
TP_CROP_GTDIAGONALS;Règle des diagonales
TP_CROP_GTEPASSPORT;Passeport biométrique
TP_CROP_GTFRAME;Cadre
TP_CROP_GTGRID;Grille
TP_CROP_GTHARMMEANS1;Manière harmonique 1
TP_CROP_GTHARMMEANS2;Manière harmonique 2
@@ -981,9 +989,12 @@ TP_IMPULSEDENOISE_LABEL;Réduction du bruit d'impulsion
TP_IMPULSEDENOISE_THRESH;Seuil
TP_LABCURVE_AVOIDCOLORSHIFT;Éviter les dérives de teinte
TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Ramènes les données dans le gamut de l'espace couleur de travail\npuis applique la correction de Munsell
TP_LABCURVE_RSTPRO_TOOLTIP;Peut être tutilisé avec le curseur Chromaticité et la courbe CC.
TP_LABCURVE_LCREDSK;Restreindre LC aux tons rouge et peau
TP_LABCURVE_LCREDSK_TIP;Si activé, la courbe 'LC' est limitée au tons rouge et peau\nSi désactivé, s'applique à toutes les teintes
TP_LABCURVE_BRIGHTNESS;Luminosité
TP_LABCURVE_BWTONING;Mode N&B colorisable
TP_LABCURVE_BWTONING_TIP;Avec le mode <b>N&amp;B colorisable</b> activé, la Chromaticité, la courbe Cc et Ct sont sans effet.\nLa colorisation peut être effctué en utilisant les courbes <b>a</b> et <b>b</b>.
TP_LABCURVE_BWTONING_TIP;Avec le mode <b>N&amp;B colorisable</b> activé, la Chromaticité, la courbe CC, CT et LC sont sans effet.\nLa colorisation peut être effctué en utilisant les courbes <b>a</b> et <b>b</b>.
TP_LABCURVE_CHROMATICITY;Chromaticité
TP_LABCURVE_CONTRAST;Contraste
TP_LABCURVE_CURVEEDITOR;Courbe de luminance
@@ -1003,7 +1014,9 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturé
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticité en fonction de la Chromaticité
TP_LABCURVE_CURVEEDITOR_CH;CT
TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticité en fonction de la Teinte
TP_LABCURVE_LABEL;Courbes Lab
TP_LABCURVE_CURVEEDITOR_LC;LC
TP_LABCURVE_CURVEEDITOR_LC_TOOLTIP;Luminance en fonction de la Chromaticité
TP_LABCURVE_LABEL;Ajustements Lab
TP_LABCURVE_RSTPROTECTION;Protection des tons rouges et chair
TP_LENSGEOM_AUTOCROP;Recadrage auto
TP_LENSGEOM_FILL;Remplir
@@ -1183,15 +1196,3 @@ ZOOMPANEL_ZOOMIN;Zoom <b>+</b>
ZOOMPANEL_ZOOMOUT;Zoom <b>-</b>
#00 Français
#01 1.3.2008: Initial translation by Hombre
!!!!!!!!!!!!!!!!!!!!!!!!!
! Untranslated keys follow; remove the ! prefix after an entry is translated.
!!!!!!!!!!!!!!!!!!!!!!!!!
!HISTOGRAM_TOOLTIP_FULL;Toggle full or scaled histogram
!MAIN_TOOLTIP_BACKCOLOR0;Background color of the preview: <b>Theme-based</b>\nShortcut: <b>8</b>
!MAIN_TOOLTIP_BACKCOLOR1;Background color of the preview: <b>Black</b>\nShortcut: <b>9</b>
!MAIN_TOOLTIP_BACKCOLOR2;Background color of the preview: <b>White</b>\nShortcut: <b>0</b>
!NAVIGATOR_XY_FULL;Width = %1, Height = %2
!PROGRESSBAR_PROCESSING_PROFILESAVED;Processing Profile Saved
!TP_CROP_GTFRAME;Frame

View File

@@ -390,11 +390,11 @@ HISTORY_MSG_164;RGB Curves - G
HISTORY_MSG_165;RGB Curves - B
HISTORY_MSG_166;Neutral Levels
HISTORY_MSG_167;B&amp;W Toning
HISTORY_MSG_168;'Cc' curve
HISTORY_MSG_169;'Ch' curve
HISTORY_MSG_168;'CC' curve
HISTORY_MSG_169;'CH' curve
HISTORY_MSG_170;Vibrance - Curve
HISTORY_MSG_171;'Lc' curve
HISTORY_MSG_172;'Lc' curve - Red and skin tones
HISTORY_MSG_171;'LC' curve
HISTORY_MSG_172;Restrict 'LC' to Red and Skin Tones
HISTORY_NEWSNAPSHOTAS;As...
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSSDIALOGLABEL;Label of the snapshot:
@@ -981,12 +981,12 @@ TP_IMPULSEDENOISE_LABEL;Impulse Noise Reduction
TP_IMPULSEDENOISE_THRESH;Impulse NR Threshold
TP_LABCURVE_AVOIDCOLORSHIFT;Avoid Color Shift
TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space\nand apply Munsell correction
TP_LABCURVE_RSTPRO_TOOLTIP;Can be used with chromaticity and Cc curve.
TP_LABCURVE_LCREDSK;LC Curve - Red and skin tones
TP_LABCURVE_LCREDSK_TIP;If enabled 'LC curve' is limited to Red and skin tones\n if desabled all color are concerned
TP_LABCURVE_RSTPRO_TOOLTIP;Can be used with the Chromaticity slider and the CC curve.
TP_LABCURVE_LCREDSK;Restrict LC to Red and Skin Tones
TP_LABCURVE_LCREDSK_TIP;If enabled, 'LC curve' is limited to Red and skin tones\nIf disabled, applies on all tones
TP_LABCURVE_BRIGHTNESS;Brightness
TP_LABCURVE_BWTONING;B&W Toning
TP_LABCURVE_BWTONING_TIP;With <b>B&amp;W Toning</b> option enabled, the Lab Chromaticity, Cc Ch Lc curves are not in effect.\nToning can be achieved using the <b>a</b> and <b>b</b> curves
TP_LABCURVE_BWTONING_TIP;With <b>B&amp;W Toning</b> option enabled, the Lab Chromaticity, CC, CH and LC curves are not in effect.\nToning can be achieved using the <b>a</b> and <b>b</b> curves
TP_LABCURVE_CHROMATICITY;Chromaticity
TP_LABCURVE_CONTRAST;Contrast
TP_LABCURVE_CURVEEDITOR;Luminance Curve
@@ -1006,8 +1006,8 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturated
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity according to the Chromaticity
TP_LABCURVE_CURVEEDITOR_CH;CH
TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticity according to the Hue
TP_LABCURVE_CURVEEDITOR_CCL;LC
TP_LABCURVE_CURVEEDITOR_CCL_TOOLTIP;Luminance according to Chromaticity - Hue skin and also Red - Yellow - Blue Green
TP_LABCURVE_CURVEEDITOR_LC;LC
TP_LABCURVE_CURVEEDITOR_LC_TOOLTIP;Luminance according to Chromaticity
TP_LABCURVE_LABEL;Lab Adjustments
TP_LABCURVE_RSTPROTECTION;Red and Skin Tones Protection
TP_LENSGEOM_AUTOCROP; Auto Crop

View File

@@ -192,7 +192,7 @@ enum ProcEvent {
EvLCCCurve=167,
EvLCHCurve=168,
EvVibranceSkinTonesCurve=169,
EvLCLCurve=170,
EvLLCCurve=170,
EvLLCredsk=171,
NUMOFEVENTS=172

View File

@@ -188,9 +188,9 @@ RGBCURVE, // EvRGBbCurve
RGBCURVE, // EvNeutralExp
LUMINANCECURVE, // EvLBWtoning
LUMINANCECURVE, // EvLCCurve
LUMINANCECURVE, // EvLCHurve
RGBCURVE, //
LUMINANCECURVE, // EvCLCCurve
LUMINANCECURVE // EvCLLcredsk
LUMINANCECURVE, // EvLCHCurve
RGBCURVE, // EvVibranceSkinTonesCurve
LUMINANCECURVE, // EvLLCCurve
LUMINANCECURVE // EvLLCredsk
};

View File

@@ -230,6 +230,9 @@ void BatchToolPanelCoordinator::initSession () {
for (size_t i=0; i<toolPanels.size(); i++) {
toolPanels[i]->setDefaults (&pparams, &pparamsEdited);
toolPanels[i]->read (&pparams, &pparamsEdited);
// TODO: autoOpenCurve has been disabled because initSession is called on each parameter change from the editor panel,
// if the thumbnail remains selected in the DirectoryBrowser (i.e. always, unless the user think about deselecting it)
//toolPanels[i]->autoOpenCurve();
}
for (size_t i=0; i<paramcListeners.size(); i++)
// send this initial state to the History
@@ -311,7 +314,7 @@ void BatchToolPanelCoordinator::procParamsChanged (Thumbnail* thm, int whoChange
/*
* WARNING: profileChange is actually called by the History only.
* Using aProfile panel in the batch tool panel editor is actually
* Using a Profile panel in the batch tool panel editor is actually
* not supported by BatchToolPanelCoordinator::profileChange!
*/
void BatchToolPanelCoordinator::profileChange (const rtengine::procparams::PartialProfile* nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited) {
@@ -328,8 +331,9 @@ void BatchToolPanelCoordinator::profileChange (const rtengine::procparams::Part
for (size_t i=0; i<toolPanels.size(); i++)
// writing the values to the GUI
// writing the values to the GUI
toolPanels[i]->read (&pparams, &pparamsEdited);
// I guess we don't want to automatically unfold curve editors here...
somethingChanged = true;

View File

@@ -22,14 +22,9 @@
ColoredBar::ColoredBar (eRTOrientation orient) {
orientation = orient;
dirty = true;
cp = NULL;
this->x = this->y = this->w = this->h = 0;
}
void ColoredBar::setColorProvider (ColorProvider* p) {
cp = p;
}
/*
* Redraw the bar to a Cairo::Surface
*/
@@ -98,20 +93,67 @@ void ColoredBar::draw() {
}
else {
// ask the ColorProvider to provide colors :) for each pixels
if (cp) {
if (colorProvider) {
cr->set_antialias(Cairo::ANTIALIAS_NONE);
cr->set_line_width(1.);
for (int x=0; x<w; x++) {
for (int y=0; y<h; y++) {
double x2 = double(x)+0.5;
double y2 = double(y)+0.5;
double x01 = x2/(w-1);
double y01 = y2/h;
cp->colorForValue (x01, y01);
cr->set_source_rgb(cp->red, cp->green, cp->blue);
cr->move_to(x2, y2);
cr->stroke();
}
switch (orientation) {
case (RTO_Left2Right):
for (int x=0; x<w; x++) {
for (int y=0; y<h; y++) {
double x_ = double( x);
double y_ = double((h-1)-y);
double x01 = x_ /double(w-1);
double y01 = double(y)/double(h-1);
colorProvider->colorForValue (x01, y01, colorCallerId, this);
cr->set_source_rgb(ccRed, ccGreen, ccBlue);
cr->rectangle(x_, y_, 1., 1.);
cr->fill();
}
}
break;
case (RTO_Right2Left):
for (int x=0; x<w; x++) {
for (int y=0; y<h; y++) {
double x_ = double((w-1)-x);
double y_ = double((h-1)-y);
double x01 = double(x)/double(w-1);
double y01 = double(y)/double(h-1);
colorProvider->colorForValue (x01, y01, colorCallerId, this);
cr->set_source_rgb(ccRed, ccGreen, ccBlue);
cr->rectangle(x_, y_, 1., 1.);
cr->fill();
}
}
break;
case (RTO_Bottom2Top):
for (int x=0; x<w; x++) {
for (int y=0; y<h; y++) {
double x_ = double((w-1)-x);
double y_ = double((h-1)-y);
double x01 = double(x)/double(w-1);
double y01 = double(y)/double(h-1);
colorProvider->colorForValue (y01, x01, colorCallerId, this);
cr->set_source_rgb(ccRed, ccGreen, ccBlue);
cr->rectangle(x_, y_, 1., 1.);
cr->fill();
}
}
break;
case (RTO_Top2Bottom):
default:
for (int x=0; x<w; x++) {
for (int y=0; y<h; y++) {
double x_ = double( x);
double y_ = double( y);
double x01 = x_/double(w-1);
double y01 = y_/double(h-1);
colorProvider->colorForValue (y01, x01, colorCallerId, this);
cr->set_source_rgb(ccRed, ccGreen, ccBlue);
cr->rectangle(x_, y_, 1., 1.);
cr->fill();
}
}
break;
}
}
}
@@ -131,5 +173,5 @@ void ColoredBar::clearBgGradient () {
}
bool ColoredBar::canGetColors() {
return cp!=NULL || bgGradient.size()>0;
return colorProvider!=NULL || bgGradient.size()>0;
}

View File

@@ -26,13 +26,12 @@
* Parent class for all colored bar type; a ColorProvider has to be set
* thanks to "setColorProvider" to be able to display colors inside the bar
*/
class ColoredBar : public BackBuffer {
class ColoredBar : public BackBuffer, public ColorCaller {
private:
void draw();
protected:
ColorProvider* cp;
eRTOrientation orientation;
std::vector<GradientMilestone> bgGradient;
@@ -43,7 +42,6 @@ class ColoredBar : public BackBuffer {
void expose(Cairo::RefPtr<Cairo::Surface> destSurface);
void expose(BackBuffer *backBuffer);
void setColorProvider (ColorProvider* p);
bool canGetColors();
// Method for convenience; if no Gradient provided, the ColoredBar will ask colors on a per pixel basis

View File

@@ -19,6 +19,29 @@
#ifndef _COLORPROVIDER_
#define _COLORPROVIDER_
#include <gtkmm.h>
class ColorProvider;
/*
* The ColorCaller is the class that will query the ColorProvider
*/
class ColorCaller {
protected:
// a class can handle several ColorCaller;
// colorCallerId will let the provider identify the caller
int colorCallerId;
ColorProvider* colorProvider;
public:
double ccRed;
double ccGreen;
double ccBlue;
ColorCaller() : colorCallerId(-1), colorProvider(NULL), ccRed(0.), ccGreen(0.), ccBlue(0.) {}
void setColorProvider (ColorProvider* p, int id) { colorProvider = p; colorCallerId = id; }
};
/*
* Use it to let your widget feed a colored bar or graph lines with the wanted colors
* If you doesn't need to dynamically feed a widget with colors (e.g. curve's graph),
@@ -28,13 +51,8 @@
class ColorProvider {
public:
double red;
double green;
double blue;
ColorProvider() { red = green = blue = 0.0; };
virtual ~ColorProvider() {};
virtual void colorForValue (double valX, double valY) {};
virtual void colorForValue (double valX, double valY, int callerId, ColorCaller* caller) {};
};
#endif

View File

@@ -192,12 +192,13 @@ void CurveEditor::updateBackgroundHistogram (LUTu & hist) {
}
// Open up the curve if it has modifications and it's not already opened
// Returns: is it non-linear?
// Returns: true if curve was non linear and opened
bool CurveEditor::openIfNonlinear() {
bool nonLinear = tempCurve.size() && (tempCurve[0] > subGroup->getValLinear()) && (tempCurve[0] < subGroup->getValUnchanged());
if (nonLinear && !curveType->get_active()) {
// Will toggle the event doing the display
// Will trigger the signal_clicked event doing the display
curveType->set_active( true );
}
@@ -211,12 +212,14 @@ void CurveEditor::setTooltip(Glib::ustring ttip) {
Glib::ustring::compose("%1\n<b>%2</b>", ttip, M("CURVEEDITOR_TYPE")));
}
void CurveEditor::setLeftBarColorProvider(ColorProvider* cp) {
void CurveEditor::setLeftBarColorProvider(ColorProvider* cp, int callerId) {
leftBarCP = cp;
leftBarCId = callerId;
}
void CurveEditor::setBottomBarColorProvider(ColorProvider* cp) {
void CurveEditor::setBottomBarColorProvider(ColorProvider* cp, int callerId) {
bottomBarCP = cp;
bottomBarCId = callerId;
}
void CurveEditor::setLeftBarBgGradient (const std::vector<GradientMilestone> &milestones) {
@@ -227,8 +230,13 @@ void CurveEditor::setBottomBarBgGradient (const std::vector<GradientMilestone> &
bottomBarBgGradient = milestones;
}
void CurveEditor::setCurveColorProvider(ColorProvider* cp) {
void CurveEditor::refresh () {
subGroup->switchGUI();
}
void CurveEditor::setCurveColorProvider(ColorProvider* cp, int callerId) {
curveCP = cp;
curveCId = callerId;
}
ColorProvider* CurveEditor::getLeftBarColorProvider() {
@@ -243,6 +251,18 @@ ColorProvider* CurveEditor::getCurveColorProvider() {
return curveCP;
}
int CurveEditor::getLeftBarCallerId() {
return leftBarCId;
}
int CurveEditor::getBottomBarCallerId() {
return bottomBarCId;
}
int CurveEditor::getCurveCallerId() {
return curveCId;
}
std::vector<GradientMilestone> CurveEditor::getBottomBarBgGradient () const {
return bottomBarBgGradient;
}

View File

@@ -67,6 +67,9 @@ class CurveEditor {
ColorProvider* bottomBarCP;
ColorProvider* leftBarCP;
ColorProvider* curveCP;
int bottomBarCId;
int leftBarCId;
int curveCId;
std::vector<GradientMilestone> bottomBarBgGradient;
std::vector<GradientMilestone> leftBarBgGradient;
@@ -85,18 +88,22 @@ class CurveEditor {
void setUnChanged (bool uc);
void updateBackgroundHistogram (LUTu & hist);
void setLeftBarColorProvider(ColorProvider* cp);
void setBottomBarColorProvider(ColorProvider* cp);
void setCurveColorProvider(ColorProvider* cp);
void setLeftBarColorProvider(ColorProvider* cp, int callerId);
void setBottomBarColorProvider(ColorProvider* cp, int callerId);
void setCurveColorProvider(ColorProvider* cp, int callerId);
void setBottomBarBgGradient (const std::vector<GradientMilestone> &milestones);
void setLeftBarBgGradient (const std::vector<GradientMilestone> &milestones);
ColorProvider* getLeftBarColorProvider();
ColorProvider* getBottomBarColorProvider();
ColorProvider* getCurveColorProvider();
int getLeftBarCallerId();
int getBottomBarCallerId();
int getCurveCallerId();
std::vector<GradientMilestone> getBottomBarBgGradient () const;
std::vector<GradientMilestone> getLeftBarBgGradient () const;
bool openIfNonlinear(); // Open up the curve if it has modifications and it's not already opened
void refresh (); // refresh the display of the CurveEditor (e.g. when a ColoredBar has been changed from the outside)
bool openIfNonlinear(); // Open up the curve if it has modifications and it's not already opened
void setCurve (const std::vector<double>& p);
virtual std::vector<double> getCurve () = 0;

View File

@@ -289,7 +289,6 @@ void CurveEditorGroup::setUnChanged (bool uc, CurveEditor* ce) {
CurveEditorSubGroup::CurveEditorSubGroup(Glib::ustring& curveDir) : curveDir(curveDir), lastFilename("") {
leftBar = NULL;
bottomBar = NULL;
curveCP = NULL;
}
CurveEditorSubGroup::~CurveEditorSubGroup() {

View File

@@ -106,14 +106,14 @@ protected:
ColoredBar* leftBar;
ColoredBar* bottomBar;
ColorProvider* curveCP;
public:
~CurveEditorSubGroup();
virtual ~CurveEditorSubGroup();
int getValUnchanged() { return valUnchanged; }
int getValLinear() { return valLinear; }
int getValLinear() { return valLinear; }
virtual void updateBackgroundHistogram (CurveEditor* ce) {}
virtual void switchGUI() = 0;
protected:
@@ -131,7 +131,6 @@ protected:
virtual void storeCurveValues (CurveEditor* ce, const std::vector<double>& p) = 0;
virtual void storeDisplayedCurve () = 0;
virtual void restoreDisplayedHistogram() {};
virtual void switchGUI() = 0;
virtual void removeEditor () = 0;
virtual const std::vector<double> getCurveFromGUI (int type) = 0;

View File

@@ -270,11 +270,11 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
}
if (barColorProvider) {
bgGradient.clear();
leftBar->setColorProvider(barColorProvider);
leftBar->setColorProvider(barColorProvider, dCurve->getLeftBarCallerId());
leftBar->setBgGradient (bgGradient);
}
else {
leftBar->setColorProvider(NULL);
leftBar->setColorProvider(NULL, -1);
leftBar->setBgGradient (bgGradient);
}
}
@@ -282,24 +282,24 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
barColorProvider = dCurve->getBottomBarColorProvider();
bgGradient = dCurve->getBottomBarBgGradient();
if (barColorProvider == NULL && bgGradient.size() == 0) {
// dCurve has no left colored bar, so we delete the object
// dCurve has no bottom colored bar, so we delete the object
if (bottomBar) {
delete bottomBar;
bottomBar = NULL;
}
}
else {
// dCurve ave a ColorProvider or a background gradient defined, so we create/update the object
// dCurve has a ColorProvider or a background gradient defined, so we create/update the object
if (!bottomBar) {
bottomBar = new ColoredBar(RTO_Left2Right);
}
if (barColorProvider) {
bgGradient.clear();
bottomBar->setColorProvider(barColorProvider);
bottomBar->setColorProvider(barColorProvider, dCurve->getBottomBarCallerId());
bottomBar->setBgGradient (bgGradient);
}
else {
bottomBar->setColorProvider(NULL);
bottomBar->setColorProvider(NULL, -1);
bottomBar->setBgGradient (bgGradient);
}
}
@@ -307,7 +307,7 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
switch((DiagonalCurveType)(dCurve->curveType->getSelected())) {
case (DCT_Spline):
customCurve->setPoints (dCurve->customCurveEd);
customCurve->setColorProvider(dCurve->getCurveColorProvider());
customCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
customCurve->setColoredBar(leftBar, bottomBar);
parent->pack_start (*customCurveBox);
customCurveBox->check_resize();
@@ -335,9 +335,9 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
darks->setLabel(label[1]);
shadows->setValue (dCurve->paramCurveEd.at(7));
shadows->setLabel(label[0]);
shcSelector->setColorProvider(barColorProvider);
shcSelector->setColorProvider(barColorProvider, dCurve->getBottomBarCallerId());
shcSelector->setBgGradient(bgGradient);
shcSelector->setMargins( (leftBar ? CBAR_WIDTH+CBAR_MARGIN : RADIUS), RADIUS );
shcSelector->setMargins( (leftBar ? MyCurve::getBarWidth()+CBAR_MARGIN : RADIUS), RADIUS );
paramCurve->setColoredBar(leftBar, NULL);
parent->pack_start (*paramCurveBox);
paramCurve->forceResize();
@@ -345,7 +345,7 @@ void DiagonalCurveEditorSubGroup::switchGUI() {
}
case (DCT_NURBS):
NURBSCurve->setPoints (dCurve->NURBSCurveEd);
NURBSCurve->setColorProvider(dCurve->getCurveColorProvider());
NURBSCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
NURBSCurve->setColoredBar(leftBar, bottomBar);
parent->pack_start (*NURBSCurveBox);
NURBSCurveBox->check_resize();
@@ -650,12 +650,6 @@ bool DiagonalCurveEditorSubGroup::curveReset(int cType) {
return true;
}
void DiagonalCurveEditorSubGroup::setColorProvider (ColorProvider* p) {
customCurve->setColorProvider(p);
paramCurve->setColorProvider(p);
NURBSCurve->setColorProvider(p);
}
/*
* Listener
*/

View File

@@ -64,8 +64,7 @@ public:
DiagonalCurveEditor* addCurve(Glib::ustring curveLabel = "");
virtual void updateBackgroundHistogram (CurveEditor* ce);
virtual void setColorProvider (ColorProvider* p);
void switchGUI();
protected:
void storeCurveValues (CurveEditor* ce, const std::vector<double>& p);
@@ -75,7 +74,6 @@ protected:
void loadPressed ();
void copyPressed ();
void pastePressed ();
void switchGUI();
bool curveReset (int cType);
void removeEditor ();
const std::vector<double> getCurveFromGUI (int type);

View File

@@ -109,17 +109,17 @@ void FlatCurveEditorSubGroup::switchGUI() {
}
}
else {
// dCurve ave a ColorProvider or a background gradient defined, so we create/update the object
// dCurve has a ColorProvider or a background gradient defined, so we create/update the object
if (!leftBar) {
leftBar = new ColoredBar(RTO_Bottom2Top);
}
if (barColorProvider) {
bgGradient.clear();
leftBar->setColorProvider(barColorProvider);
leftBar->setColorProvider(barColorProvider, dCurve->getLeftBarCallerId());
leftBar->setBgGradient (bgGradient);
}
else {
leftBar->setColorProvider(NULL);
leftBar->setColorProvider(NULL, -1);
leftBar->setBgGradient (bgGradient);
}
}
@@ -127,7 +127,7 @@ void FlatCurveEditorSubGroup::switchGUI() {
barColorProvider = dCurve->getBottomBarColorProvider();
bgGradient = dCurve->getBottomBarBgGradient();
if (barColorProvider == NULL && bgGradient.size() == 0) {
// dCurve has no left colored bar, so we delete the object
// dCurve has no bottom colored bar, so we delete the object
if (bottomBar) {
delete bottomBar;
bottomBar = NULL;
@@ -140,11 +140,11 @@ void FlatCurveEditorSubGroup::switchGUI() {
}
if (barColorProvider) {
bgGradient.clear();
bottomBar->setColorProvider(barColorProvider);
bottomBar->setColorProvider(barColorProvider, dCurve->getBottomBarCallerId());
bottomBar->setBgGradient (bgGradient);
}
else {
bottomBar->setColorProvider(NULL);
bottomBar->setColorProvider(NULL, -1);
bottomBar->setBgGradient (bgGradient);
}
}
@@ -153,7 +153,7 @@ void FlatCurveEditorSubGroup::switchGUI() {
case (FCT_MinMaxCPoints):
CPointsCurve->setPeriodicity(dCurve->periodic); // Setting Periodicity before setting points
CPointsCurve->setPoints (dCurve->controlPointsCurveEd);
CPointsCurve->setColorProvider(dCurve->getCurveColorProvider());
CPointsCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
CPointsCurve->setColoredBar(leftBar, bottomBar);
parent->pack_start (*CPointsCurveBox);
CPointsCurveBox->check_resize();
@@ -313,10 +313,6 @@ bool FlatCurveEditorSubGroup::curveReset(int cType) {
}
}
void FlatCurveEditorSubGroup::setColorProvider (ColorProvider* p) {
CPointsCurve->setColorProvider(p);
}
/*void FlatCurveEditorSubGroup::updateBackgroundHistogram (CurveEditor* ce) {
CurveEditor* fce = (CurveEditor*)ce;
if (fce==displayedCurve) {

View File

@@ -42,7 +42,7 @@ public:
FlatCurveEditor* addCurve(Glib::ustring curveLabel = "", bool periodic = true);
//virtual void updateBackgroundHistogram (CurveEditor* ce);
virtual void setColorProvider (ColorProvider* p);
void switchGUI();
protected:
void storeCurveValues (CurveEditor* ce, const std::vector<double>& p);
@@ -50,7 +50,6 @@ protected:
void restoreDisplayedHistogram ();
void savePressed ();
void loadPressed ();
void switchGUI();
bool curveReset (int cType);
void removeEditor ();
const std::vector<double> getCurveFromGUI (int type);

View File

@@ -42,17 +42,17 @@ HSVEqualizer::HSVEqualizer () : Gtk::VBox(), FoldableToolPanel(this) {
hshape = static_cast<FlatCurveEditor*>(curveEditorG->addCurve(CT_Flat, M("TP_HSVEQUALIZER_HUE")));
hshape->setBottomBarBgGradient(bottomMilestones);
//hshape->setLeftBarColorProvider(this); Not working yet
hshape->setCurveColorProvider(this);
hshape->setCurveColorProvider(this, 1);
sshape = static_cast<FlatCurveEditor*>(curveEditorG->addCurve(CT_Flat, M("TP_HSVEQUALIZER_SAT")));
sshape->setBottomBarBgGradient(bottomMilestones);
//sshape->setLeftBarColorProvider(this); Not working yet
sshape->setCurveColorProvider(this);
sshape->setCurveColorProvider(this, 2);
vshape = static_cast<FlatCurveEditor*>(curveEditorG->addCurve(CT_Flat, M("TP_HSVEQUALIZER_VAL")));
vshape->setBottomBarBgGradient(bottomMilestones);
//vshape->setLeftBarColorProvider(this); Not working yet
vshape->setCurveColorProvider(this);
vshape->setCurveColorProvider(this, 3);
// This will add the reset button at the end of the curveType buttons
curveEditorG->curveListComplete();
@@ -83,12 +83,14 @@ void HSVEqualizer::read (const ProcParams* pp, const ParamsEdited* pedited) {
sshape->setCurve (pp->hsvequalizer.scurve);
vshape->setCurve (pp->hsvequalizer.vcurve);
enableListener ();
}
void HSVEqualizer::autoOpenCurve () {
// Open up the first curve if selected
bool active = hshape->openIfNonlinear();
if (!active) sshape->openIfNonlinear();
if (!active) vshape->openIfNonlinear();
enableListener ();
}
void HSVEqualizer::write (ProcParams* pp, ParamsEdited* pedited) {
@@ -201,13 +203,11 @@ void HSVEqualizer::adjusterChanged (Adjuster* a, double newval) {
}
*/
void HSVEqualizer::colorForValue (double valX, double valY) {
void HSVEqualizer::colorForValue (double valX, double valY, int callerId, ColorCaller* caller) {
float r, g, b;
CurveEditor* ce = curveEditorG->getDisplayedCurve();
if (ce == hshape) { // Hue = f(Hue)
if (callerId == 1) { // Hue = f(Hue)
float h = float((valY - 0.5) * 2. + valX);
if (h > 1.0f)
@@ -215,21 +215,21 @@ void HSVEqualizer::colorForValue (double valX, double valY) {
else if (h < 0.0f)
h += 1.0f;
Color::hsv2rgb01(h, 0.5f, 0.5f, r, g, b);
red = double(r);
green = double(g);
blue = double(b);
caller->ccRed = double(r);
caller->ccGreen = double(g);
caller->ccBlue = double(b);
}
else if (ce == sshape) { // Saturation = f(Hue)
else if (callerId == 2) { // Saturation = f(Hue)
Color::hsv2rgb01(float(valX), float(valY), 0.5f, r, g, b);
red = double(r);
green = double(g);
blue = double(b);
caller->ccRed = double(r);
caller->ccGreen = double(g);
caller->ccBlue = double(b);
}
else if (ce == vshape) { // Value = f(Hue)
else if (callerId == 3) { // Value = f(Hue)
Color::hsv2rgb01(float(valX), 0.5f, float(valY), r, g, b);
red = double(r);
green = double(g);
blue = double(b);
caller->ccRed = double(r);
caller->ccGreen = double(g);
caller->ccBlue = double(b);
}
else {
printf("Error: no curve displayed!\n");

View File

@@ -51,7 +51,8 @@ public:
void curveChanged (CurveEditor* ce);
//void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
virtual void colorForValue (double valX, double valY);
void autoOpenCurve ();
virtual void colorForValue (double valX, double valY, int callerId, ColorCaller* caller);
//void adjusterChanged (Adjuster* a, double newval);
};

View File

@@ -25,14 +25,7 @@ using namespace rtengine::procparams;
LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
std::vector<GradientMilestone> bottomMilestones;
std::vector<GradientMilestone> milestones;
float R, G, B;
// -0.1 rad < Hue < 1.6 rad
Color::hsv2rgb01(0.92f, 0.45f, 0.6f, R, G, B);
milestones.push_back( GradientMilestone(0.0, double(R), double(G), double(B)) );
Color::hsv2rgb01(0.14056f, 0.45f, 0.6f, R, G, B);
milestones.push_back( GradientMilestone(1.0, double(R), double(G), double(B)) );
brightness = Gtk::manage (new Adjuster (M("TP_LABCURVE_BRIGHTNESS"), -100., 100., 1., 0.));
contrast = Gtk::manage (new Adjuster (M("TP_LABCURVE_CONTRAST"), -100., 100., 1., 0.));
@@ -86,47 +79,7 @@ LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir);
curveEditorG->setCurveListener (this);
ccshape = static_cast<DiagonalCurveEditor*>(curveEditorG->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CC")));
ccshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP"));
ccshape->setRangeLabels(
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE1"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE2"),
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE4")
);
ccshape->setRangeDefaultMilestones(0.05, 0.2, 0.58);
// -0.1 rad < Hue < 1.6 rad
for (int i=0; i<7; i++) {
float R, G, B;
float x = float(i)*(1.0f/6.0);
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
bottomMilestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
}
chshape = static_cast<FlatCurveEditor*>(curveEditorG->addCurve(CT_Flat, M("TP_LABCURVE_CURVEEDITOR_CH")));
chshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP"));
chshape->setBottomBarBgGradient(bottomMilestones);
chshape->setCurveColorProvider(this);
lcshape = static_cast<DiagonalCurveEditor*>(curveEditorG->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CCL")));
lcshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CCL_TOOLTIP"));
//lcshape->setBottomBarBgGradient(milestones);
bottomMilestones.clear();
bottomMilestones.push_back( GradientMilestone(0., 0., 0., 0.) );
bottomMilestones.push_back( GradientMilestone(1., 1., 1., 1.) );
lcshape->setLeftBarBgGradient(bottomMilestones);
lcshape->setRangeLabels(
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE1"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE2"),
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE4")
);
lcshape->setRangeDefaultMilestones(0.15, 0.3, 0.6);
curveEditorG->newLine();
bottomMilestones.clear();
bottomMilestones.push_back( GradientMilestone(0., 0., 0., 0.) );
bottomMilestones.push_back( GradientMilestone(1., 1., 1., 1.) );
lshape = static_cast<DiagonalCurveEditor*>(curveEditorG->addCurve(CT_Diagonal, "L"));
lshape->setBottomBarBgGradient(bottomMilestones);
lshape->setLeftBarBgGradient(bottomMilestones);
ashape = static_cast<DiagonalCurveEditor*>(curveEditorG->addCurve(CT_Diagonal, "a"));
ashape->setRangeLabels(
M("TP_LABCURVE_CURVEEDITOR_A_RANGE1"), M("TP_LABCURVE_CURVEEDITOR_A_RANGE2"),
@@ -138,6 +91,54 @@ LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
M("TP_LABCURVE_CURVEEDITOR_B_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_B_RANGE4")
);
curveEditorG->newLine(); // ------------------------------------------------ second line
ccshape = static_cast<DiagonalCurveEditor*>(curveEditorG->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CC")));
ccshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP"));
ccshape->setRangeLabels(
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE1"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE2"),
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE4")
);
ccshape->setBottomBarColorProvider(this, 2);
ccshape->setLeftBarColorProvider(this, 2);
ccshape->setRangeDefaultMilestones(0.05, 0.2, 0.58);
chshape = static_cast<FlatCurveEditor*>(curveEditorG->addCurve(CT_Flat, M("TP_LABCURVE_CURVEEDITOR_CH")));
chshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP"));
chshape->setCurveColorProvider(this, 1);
lcshape = static_cast<DiagonalCurveEditor*>(curveEditorG->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_LC")));
lcshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_LC_TOOLTIP"));
// left and bottom bar uses the same caller id because the will display the same content
lcshape->setBottomBarColorProvider(this, 3);
lcshape->setRangeLabels(
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE1"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE2"),
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE4")
);
lcshape->setRangeDefaultMilestones(0.15, 0.3, 0.6);
// Setting the gradient milestones
// from black to white
milestones.push_back( GradientMilestone(0., 0., 0., 0.) );
milestones.push_back( GradientMilestone(1., 1., 1., 1.) );
lshape->setBottomBarBgGradient(milestones);
lshape->setLeftBarBgGradient(milestones);
milestones.at(0).r = milestones.at(0).g = milestones.at(0).b = 0.1;
milestones.at(1).r = milestones.at(1).g = milestones.at(1).b = 0.8;
lcshape->setLeftBarBgGradient(milestones);
// whole hue range
milestones.clear();
for (int i=0; i<7; i++) {
float R, G, B;
float x = float(i)*(1.0f/6.0);
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
milestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
}
chshape->setBottomBarBgGradient(milestones);
// This will add the reset button at the end of the curveType buttons
curveEditorG->curveListComplete();
@@ -173,7 +174,7 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
bshape->setUnChanged (!pedited->labCurve.bcurve);
ccshape->setUnChanged (!pedited->labCurve.cccurve);
chshape->setUnChanged (!pedited->labCurve.chcurve);
lcshape->setUnChanged (!pedited->labCurve.lccurve);
lcshape->setUnChanged (!pedited->labCurve.lccurve);
}
else {
//if bwtoning is enabled, chromaticity value, avoid color shift and rstprotection has no effect
@@ -183,7 +184,10 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
rstprotection->set_sensitive( !pp->labCurve.bwtoning /*&& pp->labCurve.chromaticity!=0*/ );//no reason for grey rstprotection
avoidcolorshift->set_sensitive(!pp->labCurve.bwtoning);
lcredsk->set_sensitive(!pp->labCurve.bwtoning);
std::vector<GradientMilestone> milestones;
lcshape->setBottomBarBgGradient(milestones);
lcshape->refresh();
}
brightness->setValue (pp->labCurve.brightness);
@@ -214,8 +218,14 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
bshape->setCurve (pp->labCurve.bcurve);
ccshape->setCurve (pp->labCurve.cccurve);
chshape->setCurve (pp->labCurve.chcurve);
lcshape->setCurve (pp->labCurve.lccurve);
lcshape->setCurve (pp->labCurve.lccurve);
queue_draw();
enableListener ();
}
void LCurve::autoOpenCurve () {
// Open up the first curve if selected
bool active = lshape->openIfNonlinear();
if (!active) ashape->openIfNonlinear();
@@ -223,28 +233,24 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
if (!active) ccshape->openIfNonlinear();
if (!active) chshape->openIfNonlinear();
if (!active) lcshape->openIfNonlinear();
queue_draw();
enableListener ();
}
void LCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pp->labCurve.brightness = brightness->getValue ();
pp->labCurve.contrast = (int)contrast->getValue ();
pp->labCurve.chromaticity = (int)chromaticity->getValue ();
//%%%%%%%%%%%%%%%%%%%%%%
pp->labCurve.bwtoning = bwtoning->get_active ();
pp->labCurve.avoidcolorshift = avoidcolorshift->get_active ();
pp->labCurve.lcredsk = lcredsk->get_active ();
pp->labCurve.chromaticity = (int)chromaticity->getValue ();
//%%%%%%%%%%%%%%%%%%%%%%
pp->labCurve.bwtoning = bwtoning->get_active ();
pp->labCurve.avoidcolorshift = avoidcolorshift->get_active ();
pp->labCurve.lcredsk = lcredsk->get_active ();
pp->labCurve.rstprotection = rstprotection->getValue ();
//%%%%%%%%%%%%%%%%%%%%%%
pp->labCurve.lcurve = lshape->getCurve ();
pp->labCurve.acurve = ashape->getCurve ();
pp->labCurve.acurve = ashape->getCurve ();
pp->labCurve.bcurve = bshape->getCurve ();
pp->labCurve.cccurve = ccshape->getCurve ();
pp->labCurve.chcurve = chshape->getCurve ();
@@ -253,22 +259,22 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) {
if (pedited) {
pedited->labCurve.brightness = brightness->getEditedState ();
pedited->labCurve.contrast = contrast->getEditedState ();
pedited->labCurve.chromaticity = chromaticity->getEditedState ();
//%%%%%%%%%%%%%%%%%%%%%%
pedited->labCurve.bwtoning = !bwtoning->get_inconsistent();
pedited->labCurve.avoidcolorshift = !avoidcolorshift->get_inconsistent();
pedited->labCurve.lcredsk = !lcredsk->get_inconsistent();
pedited->labCurve.chromaticity = chromaticity->getEditedState ();
//%%%%%%%%%%%%%%%%%%%%%%
pedited->labCurve.bwtoning = !bwtoning->get_inconsistent();
pedited->labCurve.avoidcolorshift = !avoidcolorshift->get_inconsistent();
pedited->labCurve.lcredsk = !lcredsk->get_inconsistent();
pedited->labCurve.rstprotection = rstprotection->getEditedState ();
//%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%
pedited->labCurve.lcurve = !lshape->isUnChanged ();
pedited->labCurve.acurve = !ashape->isUnChanged ();
pedited->labCurve.acurve = !ashape->isUnChanged ();
pedited->labCurve.bcurve = !bshape->isUnChanged ();
pedited->labCurve.cccurve = !ccshape->isUnChanged ();
pedited->labCurve.chcurve = !chshape->isUnChanged ();
pedited->labCurve.lccurve = !bshape->isUnChanged ();
pedited->labCurve.lccurve = !lcshape->isUnChanged ();
}
}
@@ -333,6 +339,9 @@ void LCurve::lcredsk_toggled () {
lastLCVal = lcredsk->get_active ();
}
else {
lcshape->refresh();
}
if (listener) {
if (lcredsk->get_active ())
@@ -399,7 +408,7 @@ void LCurve::curveChanged (CurveEditor* ce) {
if (ce == chshape)
listener->panelChanged (EvLCHCurve, M("HISTORY_CUSTOMCURVE"));
if (ce == lcshape)
listener->panelChanged (EvLCLCurve, M("HISTORY_CUSTOMCURVE"));
listener->panelChanged (EvLLCCurve, M("HISTORY_CUSTOMCURVE"));
}
}
@@ -430,46 +439,41 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) {
listener->panelChanged (EvLRSTProtection, costr);
}
void LCurve::colorForValue (double valX, double valY) {
void LCurve::colorForValue (double valX, double valY, int callerId, ColorCaller *caller) {
CurveEditor* ce = curveEditorG->getDisplayedCurve();
float R, G, B;
if (callerId == 1) { // ch - main curve
if (ce == lshape) { // L = f(L)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
Color::hsv2rgb01(float(valX), float(valY), 0.5f, R, G, B);
}
else if (ce == ashape) { // a = f(a)
// TODO: To be implemented
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == bshape) { // b = f(b)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == ccshape) { // c = f(c)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == chshape) { // c = f(h)
else if (callerId == 2) { // cc - bottom bar
float r, g, b;
Color::hsv2rgb01(float(valX), float(valY), 0.5f, r, g, b);
red = double(r);
green = double(g);
blue = double(b);
}
else {
printf("Error: no curve displayed!\n");
float value = (1.f - 0.7f) * float(valX) + 0.7f;
// whole hue range
// Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
Color::hsv2rgb01(float(valY), float(valX), value, R, G, B);
}
else if (callerId == 3) { // lc - bottom bar
float value = (1.f - 0.7f) * float(valX) + 0.7f;
if (lcredsk->get_active()) {
// skin range
// -0.1 rad < Hue < 1.6 rad
// Y axis / from 0.92 up to 0.14056
float hue = (1.14056f - 0.92f) * float(valY) + 0.92f;
if (hue > 1.0f) hue -= 1.0f;
// Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
Color::hsv2rgb01(hue, float(valX), value, R, G, B);
}
else {
// whole hue range
// Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
Color::hsv2rgb01(float(valY), float(valX), value, R, G, B);
}
}
caller->ccRed = double(R);
caller->ccGreen = double(G);
caller->ccBlue = double(B);
}
void LCurve::setBatchMode (bool batchMode) {
@@ -481,6 +485,8 @@ void LCurve::setBatchMode (bool batchMode) {
rstprotection->showEditedCB ();
curveEditorG->setBatchMode (batchMode);
lcshape->setBottomBarColorProvider(NULL, -1);
lcshape->setLeftBarColorProvider(NULL, -1);
}

View File

@@ -60,6 +60,7 @@ class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPan
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 autoOpenCurve ();
void setAdjusterBehavior (bool bradd, bool contradd, bool satadd);
void trimValues (rtengine::procparams::ProcParams* pp);
@@ -71,7 +72,7 @@ class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPan
void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma);
virtual void colorForValue (double valX, double valY);
virtual void colorForValue (double valX, double valY, int callerId, ColorCaller* caller);
};
#endif

View File

@@ -59,12 +59,12 @@ int MyCurve::calcDimensions () {
newRequestedW = newRequestedH = get_allocation().get_width();
if (leftBar && !bottomBar)
newRequestedH -= CBAR_WIDTH + CBAR_MARGIN - RADIUS;
newRequestedH -= getBarWidth() + CBAR_MARGIN - RADIUS;
if (!leftBar && bottomBar)
newRequestedH += CBAR_WIDTH + CBAR_MARGIN - RADIUS;
newRequestedH += getBarWidth() + CBAR_MARGIN - RADIUS;
graphW = newRequestedW - RADIUS - (leftBar ? (CBAR_WIDTH+CBAR_MARGIN) : RADIUS);
graphH = newRequestedH - RADIUS - (bottomBar ? (CBAR_WIDTH+CBAR_MARGIN) : RADIUS);
graphW = newRequestedW - RADIUS - (leftBar ? (getBarWidth()+CBAR_MARGIN) : RADIUS);
graphH = newRequestedH - RADIUS - (bottomBar ? (getBarWidth()+CBAR_MARGIN) : RADIUS);
graphX = newRequestedW - RADIUS - graphW;
graphY = RADIUS + graphH;

View File

@@ -26,9 +26,11 @@
#include "coloredbar.h"
#include "../rtengine/LUT.h"
#include "guiutils.h"
#include "options.h"
#define RADIUS 3 /* radius of the control points */
#define CBAR_WIDTH 10 /* width of the colored bar (border included) */
#define CBAR_WIDTH_STD 13 /* width of the colored bar (border included) for standard themes */
#define CBAR_WIDTH_SLIM 10 /* width of the colored bar (border included) for slim themes */
#define CBAR_MARGIN 2 /* spacing between the colored bar and the graph */
#define SQUARE 2 /* half length of the square shape of the tangent handles */
#define MIN_DISTANCE 5 /* min distance between control points */
@@ -54,7 +56,7 @@ enum ResizeState {
class MyCurveIdleHelper;
class MyCurve : public Gtk::DrawingArea, public BackBuffer {
class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller {
friend class MyCurveIdleHelper;
@@ -62,7 +64,6 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer {
CurveListener* listener;
ColoredBar *leftBar;
ColoredBar *bottomBar;
ColorProvider* colorProvider;
CursorShape cursor_type;
int graphX, graphY, graphW, graphH; // dimensions of the graphic area, excluding surrounding space for the points of for the colored bar
int prevGraphW, prevGraphH; // previous inner width and height of the editor
@@ -102,7 +103,6 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer {
void setCurveListener (CurveListener* cl) { listener = cl; }
void setColoredBar (ColoredBar *left, ColoredBar *bottom);
void setColorProvider (ColorProvider* cp) { colorProvider = cp; }
void notifyListener ();
void updateBackgroundHistogram (LUTu & hist) {return;} ;
void forceResize() { sized = RS_Force; }
@@ -111,6 +111,8 @@ class MyCurve : public Gtk::DrawingArea, public BackBuffer {
virtual void setPoints (const std::vector<double>& p) = 0;
virtual bool handleEvents (GdkEvent* event) = 0;
virtual void reset () = 0;
static int getBarWidth() { return options.slimUI ? CBAR_WIDTH_SLIM : CBAR_WIDTH_STD; }
};
class MyCurveIdleHelper {

View File

@@ -268,28 +268,30 @@ void MyDiagonalCurve::draw (int handle) {
// draw the left colored bar
if (leftBar) {
// first the background
int bWidth = getBarWidth();
BackBuffer *bb = this;
leftBar->setDrawRectangle(win, 1, graphY-graphH+1, CBAR_WIDTH-2, graphH-2);
leftBar->setDrawRectangle(win, 1, graphY-graphH+1, bWidth-2, graphH-2);
leftBar->expose(bb);
// now the border
c = style->get_dark (state);
cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p());
cr->rectangle(0.5, graphY-graphH+0.5, CBAR_WIDTH-1, graphH-1);
cr->rectangle(0.5, graphY-graphH+0.5, bWidth-1, graphH-1);
cr->stroke();
}
// draw the bottom colored bar
if (bottomBar) {
// first the background
int bWidth = getBarWidth();
BackBuffer *bb = this;
bottomBar->setDrawRectangle(win, graphX+1, graphY+CBAR_MARGIN+1, graphW-2, CBAR_WIDTH-2);
bottomBar->setDrawRectangle(win, graphX+1, graphY+CBAR_MARGIN+1, graphW-2, bWidth-2);
bottomBar->expose(bb);
// now the border
c = style->get_dark (state);
cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p());
cr->rectangle(graphX+0.5, graphY+CBAR_MARGIN+0.5, graphW-1, CBAR_WIDTH-1 );
cr->rectangle(graphX+0.5, graphY+CBAR_MARGIN+0.5, graphW-1, bWidth-1 );
cr->stroke();
}
@@ -807,19 +809,32 @@ void MyDiagonalCurve::reset() {
switch (curve.type) {
case DCT_Spline :
case DCT_NURBS :
curve.x.clear();
curve.y.clear();
curve.x.push_back(0.);
curve.y.push_back(0.);
curve.x.push_back(1.);
curve.y.push_back(1.);
case DCT_NURBS :
curve.x.resize(2);
curve.y.resize(2);
curve.x.at(0) = 0.;
curve.y.at(0) = 0.;
curve.x.at(1) = 1.;
curve.y.at(1) = 1.;
grab_point = -1;
lit_point = -1;
interpolate ();
break;
case DCT_Parametric :
// Nothing to do (?)
curve.x.resize(7);
curve.y.clear();
// the SHCSelector values doesn't really matter for the identity curve display
curve.x.at(0) = 0.25;
curve.x.at(1) = 0.50;
curve.x.at(2) = 0.75;
curve.x.at(3) = 0.00;
curve.x.at(4) = 0.00;
curve.x.at(5) = 0.00;
curve.x.at(6) = 0.00;
grab_point = -1; // not sure that it's necessary
lit_point = -1; // not sure that it's necessary
interpolate ();
break;
default:
break;
}

View File

@@ -135,28 +135,30 @@ void MyFlatCurve::draw () {
// draw the left colored bar
if (leftBar) {
// first the background
int bWidth = getBarWidth();
BackBuffer *bb = this;
leftBar->setDrawRectangle(win, 1, graphY-graphH+1, CBAR_WIDTH-2, graphH-2);
leftBar->setDrawRectangle(win, 1, graphY-graphH+1, bWidth-2, graphH-2);
leftBar->expose(bb);
// now the border
c = style->get_dark (state);
cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p());
cr->rectangle(0.5, graphY-graphH+0.5, CBAR_WIDTH-1, graphH-1);
cr->rectangle(0.5, graphY-graphH+0.5, bWidth-1, graphH-1);
cr->stroke();
}
// draw the bottom colored bar
if (bottomBar) {
// first the background
int bWidth = getBarWidth();
BackBuffer *bb = this;
bottomBar->setDrawRectangle(win, graphX+1, graphY+CBAR_MARGIN+1, graphW-2, CBAR_WIDTH-2);
bottomBar->setDrawRectangle(win, graphX+1, graphY+CBAR_MARGIN+1, graphW-2, bWidth-2);
bottomBar->expose(bb);
// now the border
c = style->get_dark (state);
cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p());
cr->rectangle(graphX+0.5, graphY+CBAR_MARGIN+0.5, graphW-1, CBAR_WIDTH-1 );
cr->rectangle(graphX+0.5, graphY+CBAR_MARGIN+0.5, graphW-1, bWidth-1 );
cr->stroke();
}
@@ -171,8 +173,8 @@ void MyFlatCurve::draw () {
if (curve.x[i] != -1.) {
cr->set_line_width (1.0);
colorProvider->colorForValue(curve.x[i], 0.5);
cr->set_source_rgb (colorProvider->red, colorProvider->green, colorProvider->blue);
colorProvider->colorForValue(curve.x[i], 0.5, colorCallerId, this);
cr->set_source_rgb (ccRed, ccGreen, ccBlue);
if ( i==lit_point && (editedHandle&(FCT_EditedHandle_CPointUD|FCT_EditedHandle_CPoint|FCT_EditedHandle_CPointX)) ) {
cr->set_line_width (4.0);
@@ -191,8 +193,8 @@ void MyFlatCurve::draw () {
cr->set_line_width (4.0);
}
colorProvider->colorForValue(curve.x[i], curve.y[i]);
cr->set_source_rgb (colorProvider->red, colorProvider->green, colorProvider->blue);
colorProvider->colorForValue(curve.x[i], curve.y[i], colorCallerId, this);
cr->set_source_rgb (ccRed, ccGreen, ccBlue);
cr->move_to (double(graphX+1) , double(graphY-1) - innerH*curve.y[lit_point]);
cr->rel_line_to (innerW, 0.);
@@ -319,8 +321,8 @@ void MyFlatCurve::draw () {
if (curve.x[i] != -1.) {
if (i == lit_point) {
if (colorProvider) {
colorProvider->colorForValue(curve.x[i], curve.y[i]);
cr->set_source_rgb (colorProvider->red, colorProvider->green, colorProvider->blue);
colorProvider->colorForValue(curve.x[i], curve.y[i], colorCallerId, this);
cr->set_source_rgb (ccRed, ccGreen, ccBlue);
}
else
cr->set_source_rgb (1.0, 0.0, 0.0);

View File

@@ -70,12 +70,14 @@ void RGBCurves::read (const ProcParams* pp, const ParamsEdited* pedited) {
Gshape->setCurve (pp->rgbCurves.gcurve);
Bshape->setCurve (pp->rgbCurves.bcurve);
enableListener ();
}
void RGBCurves::autoOpenCurve () {
// Open up the first curve if selected
bool active = Rshape->openIfNonlinear();
if (!active) Gshape->openIfNonlinear();
if (!active) Bshape->openIfNonlinear();
enableListener ();
}
void RGBCurves::write (ProcParams* pp, ParamsEdited* pedited) {
@@ -110,34 +112,6 @@ void RGBCurves::curveChanged (CurveEditor* ce) {
}
}
//!!! TODO: change
void RGBCurves::colorForValue (double valX, double valY) {
CurveEditor* ce = curveEditorG->getDisplayedCurve();
if (ce == Rshape) { // L = f(L)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == Gshape) { // a = f(a)
// TODO: To be implemented
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == Bshape) { // b = f(b)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else {
printf("Error: no curve displayed!\n");
}
}
void RGBCurves::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);

View File

@@ -42,11 +42,10 @@ class RGBCurves : public Gtk::VBox, public AdjusterListener, public FoldableTool
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 autoOpenCurve ();
void curveChanged (CurveEditor* ce);
void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma);
virtual void colorForValue (double valX, double valY);
};
#endif

View File

@@ -127,8 +127,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
shcompr->setEditedState (pedited->toneCurve.shcompr ? Edited : UnEdited);
brightness->setEditedState (pedited->toneCurve.brightness ? Edited : UnEdited);
contrast->setEditedState (pedited->toneCurve.contrast ? Edited : UnEdited);
saturation->setEditedState (pedited->toneCurve.saturation ? Edited : UnEdited);
autolevels->set_inconsistent (!pedited->toneCurve.autoexp);
saturation->setEditedState (pedited->toneCurve.saturation ? Edited : UnEdited);
autolevels->set_inconsistent (!pedited->toneCurve.autoexp);
clipDirty = pedited->toneCurve.clip;
shape->setUnChanged (!pedited->toneCurve.curve);
}
@@ -147,14 +147,16 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
if (!black->getAddMode()) shcompr->set_sensitive(!((int)black->getValue ()==0)); //at black=0 shcompr value has no effect
brightness->setValue (pp->toneCurve.brightness);
contrast->setValue (pp->toneCurve.contrast);
saturation->setValue (pp->toneCurve.saturation);
shape->setCurve (pp->toneCurve.curve);
shape->openIfNonlinear();
saturation->setValue (pp->toneCurve.saturation);
shape->setCurve (pp->toneCurve.curve);
enableListener ();
}
void ToneCurve::autoOpenCurve () {
shape->openIfNonlinear();
}
void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pp->toneCurve.autoexp = autolevels->get_active();
@@ -166,7 +168,7 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pp->toneCurve.shcompr = (int)shcompr->getValue ();
pp->toneCurve.brightness = (int)brightness->getValue ();
pp->toneCurve.contrast = (int)contrast->getValue ();
pp->toneCurve.saturation = (int)saturation->getValue ();
pp->toneCurve.saturation = (int)saturation->getValue ();
pp->toneCurve.curve = shape->getCurve ();
if (pedited) {
@@ -177,8 +179,8 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->toneCurve.shcompr = shcompr->getEditedState ();
pedited->toneCurve.brightness = brightness->getEditedState ();
pedited->toneCurve.contrast = contrast->getEditedState ();
pedited->toneCurve.saturation = saturation->getEditedState ();
pedited->toneCurve.autoexp = !autolevels->get_inconsistent();
pedited->toneCurve.saturation = saturation->getEditedState ();
pedited->toneCurve.autoexp = !autolevels->get_inconsistent();
pedited->toneCurve.clip = clipDirty;
pedited->toneCurve.curve = !shape->isUnChanged ();
}
@@ -203,7 +205,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
shcompr->setDefaultEditedState (pedited->toneCurve.shcompr ? Edited : UnEdited);
brightness->setDefaultEditedState (pedited->toneCurve.brightness ? Edited : UnEdited);
contrast->setDefaultEditedState (pedited->toneCurve.contrast ? Edited : UnEdited);
saturation->setDefaultEditedState (pedited->toneCurve.saturation ? Edited : UnEdited);
saturation->setDefaultEditedState (pedited->toneCurve.saturation ? Edited : UnEdited);
}
else {
expcomp->setDefaultEditedState (Irrelevant);
@@ -213,7 +215,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
shcompr->setDefaultEditedState (Irrelevant);
brightness->setDefaultEditedState (Irrelevant);
contrast->setDefaultEditedState (Irrelevant);
saturation->setDefaultEditedState (Irrelevant);
saturation->setDefaultEditedState (Irrelevant);
}
}
@@ -226,9 +228,9 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) {
// Switch off auto exposure if user changes sliders manually
if (autolevels->get_active() && (a==expcomp || a==brightness || a==contrast || a==black || a==hlcompr || a==hlcomprthresh)) {
autoconn.block(true);
autoconn.block(true);
autolevels->set_active (false);
autoconn.block(false);
autoconn.block(false);
autolevels->set_inconsistent (false);
}
@@ -366,13 +368,13 @@ void ToneCurve::waitForAutoExp () {
sclip->set_sensitive (false);
expcomp->setEnabled (false);
brightness->setEnabled (false);
contrast->setEnabled (false);
contrast->setEnabled (false);
black->setEnabled (false);
hlcompr->setEnabled (false);
hlcomprthresh->setEnabled (false);
shcompr->setEnabled (false);
contrast->setEnabled (false);
saturation->setEnabled (false);
saturation->setEnabled (false);
curveEditorG->set_sensitive (false);
}
@@ -385,8 +387,8 @@ void ToneCurve::autoExpChanged (double expcomp, int bright, int contr, int black
nextBlack = black;
nextExpcomp = expcomp;
nextBrightness = bright;
nextContrast = contr;
nextBrightness = bright;
nextContrast = contr;
nextHlcompr = hlcompr;
nextHlcomprthresh = hlcomprthresh;
g_idle_add (autoExpChangedUI, this);
@@ -404,7 +406,7 @@ void ToneCurve::enableAll () {
hlcomprthresh->setEnabled (true);
shcompr->setEnabled (true);
contrast->setEnabled (true);
saturation->setEnabled (true);
saturation->setEnabled (true);
curveEditorG->set_sensitive (true);
}
@@ -413,8 +415,8 @@ bool ToneCurve::autoExpComputed_ () {
disableListener ();
enableAll ();
expcomp->setValue (nextExpcomp);
brightness->setValue (nextBrightness);
contrast->setValue (nextContrast);
brightness->setValue (nextBrightness);
contrast->setValue (nextContrast);
black->setValue (nextBlack);
hlcompr->setValue (nextHlcompr);
hlcomprthresh->setValue (nextHlcomprthresh);

View File

@@ -65,7 +65,8 @@ class ToneCurve : public Gtk::VBox, public AdjusterListener, public FoldableTool
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void setAdjusterBehavior (bool expadd, bool hlcompadd, bool hlcompthreshadd, bool bradd, bool blackadd, bool shcompadd, bool contradd, bool satadd);
void trimValues (rtengine::procparams::ProcParams* pp);
void trimValues (rtengine::procparams::ProcParams* pp);
void autoOpenCurve ();
void adjusterChanged (Adjuster* a, double newval);

View File

@@ -33,6 +33,7 @@ class ToolPanelListener {
public:
virtual ~ToolPanelListener() {}
virtual void panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr) {}
};
@@ -46,14 +47,16 @@ class ToolPanel {
public:
ToolPanel () : listener(NULL), tmp(NULL), batchMode(false) {}
virtual ~ToolPanel() {}
void setParent (Gtk::Box* parent) {}
Gtk::Box* getParent () { return NULL; }
void setListener (ToolPanelListener* tpl) { listener = tpl; }
virtual void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL) {}
virtual void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL) {}
virtual void trimValues (rtengine::procparams::ProcParams* pp) { return; }
virtual void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL) {}
void setParent (Gtk::Box* parent) {}
Gtk::Box* getParent () { return NULL; }
void setListener (ToolPanelListener* tpl) { listener = tpl; }
virtual void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL) {}
virtual void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL) {}
virtual void trimValues (rtengine::procparams::ProcParams* pp) { return; }
virtual void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL) {}
virtual void autoOpenCurve () {}
void disableListener () { if (tmp==NULL) tmp = listener; listener = NULL; }
void enableListener () { if (tmp!=NULL) listener = tmp; tmp = NULL; }

View File

@@ -311,8 +311,11 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
crop->trim(params, fw, fh);
// updating the GUI with updated values
for (unsigned int i=0; i<toolPanels.size(); i++)
for (unsigned int i=0; i<toolPanels.size(); i++) {
toolPanels[i]->read (params);
if (event==rtengine::EvPhotoLoaded || event==rtengine::EvProfileChanged)
toolPanels[i]->autoOpenCurve();
}
// start the IPC processing
if (filterRawRefresh) {

View File

@@ -146,11 +146,14 @@ void Vibrance::read(const ProcParams* pp, const ParamsEdited* pedited) {
saturated->setValue (pp->vibrance.saturated); // Pastels and Saturated are separate
}
skinTonesCurve->setCurve (pp->vibrance.skintonescurve);
skinTonesCurve->openIfNonlinear();
enableListener ();
}
void Vibrance::autoOpenCurve () {
skinTonesCurve->openIfNonlinear();
}
void Vibrance::write( ProcParams* pp, ParamsEdited* pedited) {
pp->vibrance.enabled = enabled->get_active ();
pp->vibrance.pastels = pastels->getIntValue();
@@ -333,20 +336,6 @@ void Vibrance::setAdjusterBehavior (bool pastelsadd, bool saturatedadd, bool pst
saturated->setAddMode (saturatedadd);
}
void Vibrance::colorForValue (double valX, double valY) {
CurveEditor* ce = curveEditorGG->getDisplayedCurve();
if (ce == skinTonesCurve) { // L = f(L)
red = double(valY);
green = double(valY);
blue = double(valY);
}
else {
printf("Error: no curve displayed!\n");
}
}
void Vibrance::trimValues (ProcParams* pp) {
pastels->trimValue (pp->vibrance.pastels);
saturated->trimValue (pp->vibrance.saturated);

View File

@@ -27,7 +27,7 @@
#include "toolpanel.h"
class Vibrance : public Gtk::VBox, public AdjusterListener, public ThresholdCurveProvider, public ThresholdAdjusterListener,
public FoldableToolPanel, public CurveListener, public ColorProvider
public FoldableToolPanel, public CurveListener
{
protected:
@@ -66,13 +66,13 @@ public:
void adjusterChanged (Adjuster* a, double newval);
void adjusterChanged (ThresholdAdjuster* a, int newBottom, int newTop);
void curveChanged ();
void autoOpenCurve ();
void enabled_toggled ();
void protectskins_toggled ();
void avoidcolorshift_toggled ();
void pastsattog_toggled ();
std::vector<double> getCurvePoints(ThresholdSelector* tAdjuster) const;
virtual void colorForValue (double valX, double valY);
};