Merge branch 'dev' into metadata-exiv2

This commit is contained in:
Flössie 2019-05-16 18:12:47 +02:00
commit 1fc17dab7e
14 changed files with 264 additions and 284 deletions

View File

@ -270,7 +270,8 @@ void rtengine::HaldCLUT::splitClutFilename(
const Glib::ustring& filename,
Glib::ustring& name,
Glib::ustring& extension,
Glib::ustring& profile_name
Glib::ustring& profile_name,
bool checkProfile
)
{
Glib::ustring basename = Glib::path_get_basename(filename);
@ -284,17 +285,19 @@ void rtengine::HaldCLUT::splitClutFilename(
name = basename;
}
profile_name = "sRGB";
if (checkProfile) {
profile_name = "sRGB";
if (!name.empty()) {
for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) {
if (
!working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway
&& std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin()
) {
profile_name = working_profile;
name.erase(name.size() - working_profile.size());
break;
if (!name.empty()) {
for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) {
if (
!working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway
&& std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin()
) {
profile_name = working_profile;
name.erase(name.size() - working_profile.size());
break;
}
}
}
}

View File

@ -39,7 +39,8 @@ public:
const Glib::ustring& filename,
Glib::ustring& name,
Glib::ustring& extension,
Glib::ustring& profile_name
Glib::ustring& profile_name,
bool checkProfile = true
);
private:

View File

@ -2518,13 +2518,13 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
}
}
} else {
float tmpr[4] ALIGNED16;
float tmpg[4] ALIGNED16;
float tmpb[4] ALIGNED16;
for (int i = istart, ti = 0; i < tH; i++, ti++) {
int j = jstart, tj = 0;
#ifdef __SSE2__
float tmpr[4] ALIGNED16;
float tmpg[4] ALIGNED16;
float tmpb[4] ALIGNED16;
for (; j < tW - 3; j+=4, tj+=4) {
//brightness/contrast
STVF(tmpr[0], tonecurve(LVF(rtemp[ti * TS + tj])));

View File

@ -25,83 +25,96 @@
#include "guiutils.h"
#include "rtimage.h"
#define MIN_RESET_BUTTON_HEIGHT 17
static double one2one(double val)
namespace {
constexpr int MIN_RESET_BUTTON_HEIGHT = 17;
double one2one(double val)
{
return val;
}
}
Adjuster::Adjuster (
Glib::ustring vlabel,
double vmin,
double vmax,
double vstep,
double vdefault,
Gtk::Image *imgIcon1,
Gtk::Image *imgIcon2,
double2double_fun slider2value,
double2double_fun value2slider)
:
adjustmentName(std::move(vlabel)),
grid(nullptr),
label(nullptr),
imageIcon1(imgIcon1),
automatic(nullptr),
adjusterListener(nullptr),
editedCheckBox(nullptr),
afterReset(false),
blocked(false),
addMode(false),
eventPending(false),
vMin(vmin),
vMax(vmax),
vStep(vstep),
logBase(0),
logPivot(0),
logAnchorMiddle(false),
value2slider(value2slider ? value2slider : &one2one),
slider2value(slider2value ? slider2value : &one2one),
delay(options.adjusterMinDelay)
Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1, Gtk::Image *imgIcon2, double2double_fun slider2value_, double2double_fun value2slider_)
{
set_hexpand(true);
set_vexpand(false);
label = nullptr;
adjusterListener = nullptr;
afterReset = false;
blocked = false;
automatic = nullptr;
eventPending = false;
grid = NULL;
imageIcon1 = imgIcon1;
logBase = 0;
logPivot = 0;
logAnchorMiddle = false;
if (imageIcon1) {
setExpandAlignProperties(imageIcon1, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
}
imageIcon2 = imgIcon2;
if (imageIcon2) {
setExpandAlignProperties(imageIcon2, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
if (imgIcon2) {
setExpandAlignProperties(imgIcon2, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
}
slider2value = slider2value_ ? slider2value_ : one2one;
value2slider = value2slider_ ? value2slider_ : one2one;
vMin = vmin;
vMax = vmax;
vStep = vstep;
addMode = false;
delay = options.adjusterMinDelay;
set_column_spacing(0);
set_column_homogeneous(false);
set_row_spacing(0);
set_row_homogeneous(false);
editedCheckBox = nullptr;
if (!vlabel.empty()) {
adjustmentName = vlabel;
label = Gtk::manage (new Gtk::Label (adjustmentName));
if (!adjustmentName.empty()) {
label = Gtk::manage(new Gtk::Label(adjustmentName));
setExpandAlignProperties(label, true, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
}
reset = Gtk::manage (new Gtk::Button ());
reset->add (*Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")));
reset = Gtk::manage(new Gtk::Button());
reset->add(*Gtk::manage(new RTImage("undo-small.png", "redo-small.png")));
setExpandAlignProperties(reset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
reset->set_relief (Gtk::RELIEF_NONE);
reset->set_tooltip_markup (M("ADJUSTER_RESET_TO_DEFAULT"));
reset->set_relief(Gtk::RELIEF_NONE);
reset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT"));
reset->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
reset->set_can_focus(false);
spin = Gtk::manage (new MySpinButton ());
spin = Gtk::manage(new MySpinButton());
setExpandAlignProperties(spin, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
spin->set_input_purpose(Gtk::INPUT_PURPOSE_DIGITS);
reset->set_size_request (-1, spin->get_height() > MIN_RESET_BUTTON_HEIGHT ? spin->get_height() : MIN_RESET_BUTTON_HEIGHT);
slider = Gtk::manage (new MyHScale ());
reset->set_size_request(-1, spin->get_height() > MIN_RESET_BUTTON_HEIGHT ? spin->get_height() : MIN_RESET_BUTTON_HEIGHT);
slider = Gtk::manage(new MyHScale());
setExpandAlignProperties(slider, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
slider->set_draw_value (false);
slider->set_draw_value(false);
//slider->set_has_origin(false); // ------------------ This will remove the colored part on the left of the slider's knob
if (vlabel.empty()) {
setLimits(vmin, vmax, vstep, vdefault);
if (adjustmentName.empty()) {
// No label, everything goes in a single row
attach_next_to(*slider, Gtk::POS_LEFT, 1, 1);
@ -109,9 +122,9 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep
attach_next_to(*imageIcon1, *slider, Gtk::POS_LEFT, 1, 1);
}
if (imageIcon2) {
attach_next_to(*imageIcon2, *slider, Gtk::POS_RIGHT, 1, 1);
attach_next_to(*spin, *imageIcon2, Gtk::POS_RIGHT, 1, 1);
if (imgIcon2) {
attach_next_to(*imgIcon2, *slider, Gtk::POS_RIGHT, 1, 1);
attach_next_to(*spin, *imgIcon2, Gtk::POS_RIGHT, 1, 1);
} else {
attach_next_to(*spin, *slider, Gtk::POS_RIGHT, 1, 1);
}
@ -129,9 +142,9 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep
grid->attach_next_to(*imageIcon1, *slider, Gtk::POS_LEFT, 1, 1);
}
if (imageIcon2) {
grid->attach_next_to(*imageIcon2, Gtk::POS_RIGHT, 1, 1);
grid->attach_next_to(*reset, *imageIcon2, Gtk::POS_RIGHT, 1, 1);
if (imgIcon2) {
grid->attach_next_to(*imgIcon2, Gtk::POS_RIGHT, 1, 1);
grid->attach_next_to(*reset, *imgIcon2, Gtk::POS_RIGHT, 1, 1);
} else {
grid->attach_next_to(*reset, *slider, Gtk::POS_RIGHT, 1, 1);
}
@ -139,37 +152,30 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep
attach_next_to(*grid, *label, Gtk::POS_BOTTOM, 2, 1);
}
setLimits (vmin, vmax, vstep, vdefault);
defaultVal = shapeValue (vdefault);
ctorDefaultVal = shapeValue (vdefault);
defaultVal = ctorDefaultVal = shapeValue(vdefault);
editedState = defEditedState = Irrelevant;
autoState = Irrelevant;
sliderChange = slider->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::sliderChanged) );
spinChange = spin->signal_value_changed().connect ( sigc::mem_fun(*this, &Adjuster::spinChanged), true);
spinChange = spin->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::spinChanged), true);
reset->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &Adjuster::resetPressed) );
show_all ();
show_all();
}
Adjuster::~Adjuster ()
{
sliderChange.block (true);
spinChange.block (true);
delayConnection.block (true);
sliderChange.block(true);
spinChange.block(true);
delayConnection.block(true);
adjusterListener = nullptr;
if (automatic) {
delete automatic;
}
}
void Adjuster::addAutoButton (Glib::ustring tooltip)
void Adjuster::addAutoButton (const Glib::ustring &tooltip)
{
if (!automatic) {
automatic = new Gtk::CheckButton ();
automatic = Gtk::manage(new Gtk::CheckButton());
//automatic->add (*Gtk::manage (new RTImage ("gears.png")));
automatic->set_tooltip_markup(tooltip.length() ? Glib::ustring::compose("<b>%1</b>\n\n%2", M("GENERAL_AUTO"), tooltip) : M("GENERAL_AUTO"));
setExpandAlignProperties(automatic, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
@ -185,15 +191,6 @@ void Adjuster::addAutoButton (Glib::ustring tooltip)
}
}
void Adjuster::delAutoButton ()
{
if (automatic) {
removeIfThere(grid, automatic);
delete automatic;
automatic = nullptr;
}
}
void Adjuster::throwOnButtonRelease(bool throwOnBRelease)
{
@ -221,7 +218,7 @@ void Adjuster::throwOnButtonRelease(bool throwOnBRelease)
void Adjuster::setDefault (double def)
{
defaultVal = shapeValue (def);
defaultVal = shapeValue(def);
}
void Adjuster::setDefaultEditedState (EditedState eState)
@ -258,7 +255,7 @@ void Adjuster::sliderReleased (GdkEventButton* event)
if ((event != nullptr) && (event->button == 1)) {
if (delayConnection.connected()) {
delayConnection.disconnect ();
delayConnection.disconnect();
}
notifyListener();
@ -270,7 +267,7 @@ void Adjuster::spinReleased (GdkEventButton* event)
if ((event != nullptr) && delay == 0) {
if (delayConnection.connected()) {
delayConnection.disconnect ();
delayConnection.disconnect();
}
notifyListener();
@ -283,12 +280,11 @@ void Adjuster::resetValue (bool toInitial)
editedState = defEditedState;
if (editedCheckBox) {
editedChange.block (true);
editedCheckBox->set_active (defEditedState == Edited);
editedChange.block (false);
editedChange.block(true);
editedCheckBox->set_active(defEditedState == Edited);
editedChange.block(false);
}
refreshLabelStyle ();
}
afterReset = true;
@ -317,32 +313,35 @@ void Adjuster::resetPressed (GdkEventButton* event)
}
}
double Adjuster::shapeValue (double a)
double Adjuster::shapeValue (double a) const
{
double val = round(a * pow(double(10), digits)) / pow(double(10), digits);
const double pow10 = std::pow(10.0, digits);
const double val = std::round(a * pow10) / pow10;
return val == -0.0 ? 0.0 : val;
}
void Adjuster::setLimits (double vmin, double vmax, double vstep, double vdefault)
{
sliderChange.block(true);
spinChange.block(true);
sliderChange.block (true);
spinChange.block (true);
double pow10 = vstep;
for (digits = 0; std::fabs(pow10 - floor(pow10)) > 0.000000000001; digits++, pow10 *= 10.0);
for (digits = 0; fabs(vstep * pow(double(10), digits) - floor(vstep * pow(double(10), digits))) > 0.000000000001; digits++);
spin->set_digits (digits);
spin->set_increments (vstep, 2.0 * vstep);
spin->set_range (vmin, vmax);
const double shapeVal = shapeValue(vdefault);
spin->set_digits(digits);
spin->set_increments(vstep, 2.0 * vstep);
spin->set_range(vmin, vmax);
spin->updateSize();
spin->set_value (shapeValue(vdefault));
slider->set_digits (digits);
slider->set_increments (vstep, 2.0 * vstep);
slider->set_range (addMode ? vmin : value2slider(vmin), addMode ? vmax : value2slider(vmax));
setSliderValue(addMode ? shapeValue(vdefault) : value2slider(shapeValue(vdefault)));
//defaultVal = shapeValue (vdefault);
sliderChange.block (false);
spinChange.block (false);
spin->set_value(shapeVal);
slider->set_digits(digits);
slider->set_increments(vstep, 2.0 * vstep);
slider->set_range(addMode ? vmin : value2slider(vmin), addMode ? vmax : value2slider(vmax));
setSliderValue(addMode ? shapeVal : value2slider(shapeVal));
sliderChange.block(false);
spinChange.block(false);
}
void Adjuster::setAddMode(bool addM)
@ -369,39 +368,36 @@ void Adjuster::setAddMode(bool addM)
void Adjuster::spinChanged ()
{
if (delayConnection.connected()) {
delayConnection.disconnect ();
delayConnection.disconnect();
}
sliderChange.block (true);
setSliderValue(addMode ? spin->get_value () : value2slider(spin->get_value ()));
sliderChange.block (false);
sliderChange.block(true);
setSliderValue(addMode ? spin->get_value() : value2slider(spin->get_value()));
sliderChange.block(false);
if (delay == 0) {
if (adjusterListener && !blocked) {
if (!buttonReleaseSlider.connected() || afterReset) {
eventPending = false;
adjusterListener->adjusterChanged (this, spin->get_value ());
adjusterListener->adjusterChanged(this, spin->get_value());
} else {
eventPending = true;
}
}
} else {
eventPending = true;
delayConnection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Adjuster::notifyListener), delay);
delayConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Adjuster::notifyListener), delay);
}
if (editedState == UnEdited) {
editedState = Edited;
if (editedCheckBox) {
editedChange.block (true);
editedCheckBox->set_active (true);
editedChange.block (false);
editedChange.block(true);
editedCheckBox->set_active(true);
editedChange.block(false);
}
refreshLabelStyle ();
}
afterReset = false;
@ -411,38 +407,36 @@ void Adjuster::sliderChanged ()
{
if (delayConnection.connected()) {
delayConnection.disconnect ();
delayConnection.disconnect();
}
spinChange.block (true);
double v = shapeValue(getSliderValue());
spin->set_value (addMode ? v : slider2value(v));
spinChange.block (false);
spinChange.block(true);
const double v = shapeValue(getSliderValue());
spin->set_value(addMode ? v : slider2value(v));
spinChange.block(false);
if (delay == 0 || afterReset) {
if (adjusterListener && !blocked) {
if (!buttonReleaseSlider.connected() || afterReset) {
eventPending = false;
adjusterListener->adjusterChanged (this, spin->get_value ());
adjusterListener->adjusterChanged(this, spin->get_value());
} else {
eventPending = true;
}
}
} else {
eventPending = true;
delayConnection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Adjuster::notifyListener), delay);
delayConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Adjuster::notifyListener), delay);
}
if (!afterReset && editedState == UnEdited) {
editedState = Edited;
if (editedCheckBox) {
editedChange.block (true);
editedCheckBox->set_active (true);
editedChange.block (false);
editedChange.block(true);
editedCheckBox->set_active(true);
editedChange.block(false);
}
refreshLabelStyle ();
}
afterReset = false;
@ -450,20 +444,19 @@ void Adjuster::sliderChanged ()
void Adjuster::setValue (double a)
{
spinChange.block (true);
sliderChange.block (true);
spin->set_value (shapeValue (a));
setSliderValue(addMode ? shapeValue(a) : value2slider(shapeValue (a)));
sliderChange.block (false);
spinChange.block (false);
spinChange.block(true);
sliderChange.block(true);
spin->set_value(shapeValue(a));
setSliderValue(addMode ? shapeValue(a) : value2slider(shapeValue(a)));
sliderChange.block(false);
spinChange.block(false);
afterReset = false;
}
void Adjuster::setAutoValue (bool a)
{
if (automatic) {
bool oldVal = autoChange.block(true);
const bool oldVal = autoChange.block(true);
automatic->set_active(a);
autoChange.block(oldVal);
@ -488,7 +481,7 @@ bool Adjuster::notifyListener ()
{
if (eventPending && adjusterListener != nullptr && !blocked) {
adjusterListener->adjusterChanged (this, spin->get_value ());
adjusterListener->adjusterChanged(this, spin->get_value());
}
eventPending = false;
@ -509,12 +502,12 @@ bool Adjuster::notifyListenerAutoToggled ()
void Adjuster::setEnabled (bool enabled)
{
bool autoVal = automatic && !editedCheckBox ? automatic->get_active() : true;
spin->set_sensitive (enabled && autoVal);
slider->set_sensitive (enabled && autoVal);
const bool autoVal = automatic && !editedCheckBox ? automatic->get_active() : true;
spin->set_sensitive(enabled && autoVal);
slider->set_sensitive(enabled && autoVal);
if (automatic) {
automatic->set_sensitive (enabled);
automatic->set_sensitive(enabled);
}
}
@ -523,13 +516,12 @@ void Adjuster::setEditedState (EditedState eState)
if (editedState != eState) {
if (editedCheckBox) {
editedChange.block (true);
editedCheckBox->set_active (eState == Edited);
editedChange.block (false);
editedChange.block(true);
editedCheckBox->set_active(eState == Edited);
editedChange.block(false);
}
editedState = eState;
refreshLabelStyle ();
}
}
@ -537,7 +529,7 @@ EditedState Adjuster::getEditedState ()
{
if (editedState != Irrelevant && editedCheckBox) {
editedState = editedCheckBox->get_active () ? Edited : UnEdited;
editedState = editedCheckBox->get_active() ? Edited : UnEdited;
}
return editedState;
@ -551,7 +543,7 @@ void Adjuster::showEditedCB ()
}
if (!editedCheckBox) {
editedCheckBox = Gtk::manage(new Gtk::CheckButton (adjustmentName));
editedCheckBox = Gtk::manage(new Gtk::CheckButton(adjustmentName));
editedCheckBox->set_vexpand(false);
if (grid) {
@ -576,50 +568,31 @@ void Adjuster::showEditedCB ()
}
}
void Adjuster::refreshLabelStyle ()
{
/* Glib::RefPtr<Gtk::StyleContext> style = label->get_style_context ();
Pango::FontDescription fd = style->get_font ();
fd.set_weight (editedState==Edited ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL);
style->set_font (fd);
label->set_style (style);
label->queue_draw ();*/
}
void Adjuster::editedToggled ()
{
if (adjusterListener && !blocked) {
adjusterListener->adjusterChanged (this, spin->get_value ());
adjusterListener->adjusterChanged(this, spin->get_value());
}
eventPending = false;
}
void Adjuster::trimValue (double &val)
void Adjuster::trimValue (double &val) const
{
val = rtengine::LIM(val, vMin, vMax);
}
void Adjuster::trimValue (int &val)
void Adjuster::trimValue (int &val) const
{
val = rtengine::LIM(val, static_cast<int>(vMin), static_cast<int>(vMax));
val = rtengine::LIM<int>(val, vMin, vMax);
}
void Adjuster::trimValue (float &val)
void Adjuster::trimValue (float &val) const
{
val = rtengine::LIM(val, static_cast<float>(vMin), static_cast<float>(vMax));
val = rtengine::LIM<float>(val, vMin, vMax);
}
inline double Adjuster::getSliderValue()
double Adjuster::getSliderValue() const
{
double val = slider->get_value();
if (logBase) {
@ -629,29 +602,28 @@ inline double Adjuster::getSliderValue()
if (val >= mmid) {
double range = vMax - mmid;
double x = (val - mmid) / range;
val = logPivot + (pow(logBase, x) - 1.0) / (logBase - 1.0) * (vMax - logPivot);
val = logPivot + (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * (vMax - logPivot);
} else {
double range = mmid - vMin;
double x = (mmid - val) / range;
val = logPivot - (pow(logBase, x) - 1.0) / (logBase - 1.0) * (logPivot - vMin);
val = logPivot - (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * (logPivot - vMin);
}
} else {
if (val >= logPivot) {
double range = vMax - logPivot;
double x = (val - logPivot) / range;
val = logPivot + (pow(logBase, x) - 1.0) / (logBase - 1.0) * range;
val = logPivot + (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * range;
} else {
double range = logPivot - vMin;
double x = (logPivot - val) / range;
val = logPivot - (pow(logBase, x) - 1.0) / (logBase - 1.0) * range;
val = logPivot - (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * range;
}
}
}
return val;
}
inline void Adjuster::setSliderValue(double val)
void Adjuster::setSliderValue(double val)
{
if (logBase) {
if (logAnchorMiddle) {
@ -659,39 +631,96 @@ inline void Adjuster::setSliderValue(double val)
if (val >= logPivot) {
double range = vMax - logPivot;
double x = (val - logPivot) / range;
val = (vMin + mid) + log(x * (logBase - 1.0) + 1.0) / log(logBase) * mid;
val = (vMin + mid) + std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * mid;
} else {
double range = logPivot - vMin;
double x = (logPivot - val) / range;
val = (vMin + mid) - log(x * (logBase - 1.0) + 1.0) / log(logBase) * mid;
val = (vMin + mid) - std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * mid;
}
} else {
if (val >= logPivot) {
double range = vMax - logPivot;
double x = (val - logPivot) / range;
val = logPivot + log(x * (logBase - 1.0) + 1.0) / log(logBase) * range;
val = logPivot + std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * range;
} else {
double range = logPivot - vMin;
double x = (logPivot - val) / range;
val = logPivot - log(x * (logBase - 1.0) + 1.0) / log(logBase) * range;
val = logPivot - std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * range;
}
}
}
slider->set_value(val);
}
void Adjuster::setLogScale(double base, double pivot, bool anchorMiddle)
{
spinChange.block (true);
sliderChange.block (true);
spinChange.block(true);
sliderChange.block(true);
double cur = getSliderValue();
const double cur = getSliderValue();
logBase = base;
logPivot = pivot;
logAnchorMiddle = anchorMiddle;
setSliderValue(cur);
sliderChange.block (false);
spinChange.block (false);
sliderChange.block(false);
spinChange.block(false);
}
bool Adjuster::getAutoValue() const
{
return automatic ? automatic->get_active() : false;
}
void Adjuster::setAutoInconsistent(bool i)
{
if (automatic) {
automatic->set_inconsistent(i);
}
}
bool Adjuster::getAutoInconsistent() const
{
return automatic ? automatic->get_inconsistent() : true /* we have to return something */;
}
void Adjuster::setAdjusterListener (AdjusterListener* alistener)
{
adjusterListener = alistener;
}
double Adjuster::getValue() const
{
return shapeValue(spin->get_value());
}
int Adjuster::getIntValue() const
{
return spin->get_value_as_int();
}
Glib::ustring Adjuster::getTextValue() const
{
if (addMode) {
return Glib::ustring::compose("<i>%1</i>", spin->get_text());
} else {
return spin->get_text();
}
}
void Adjuster::setLabel(const Glib::ustring &lbl)
{
label->set_label(lbl);
}
bool Adjuster::block(bool isBlocked)
{
bool oldValue = blocked;
blocked = isBlocked;
return oldValue;
}
bool Adjuster::getAddMode() const
{
return addMode;
}

View File

@ -43,7 +43,6 @@ protected:
Gtk::Grid* grid;
Gtk::Label* label;
Gtk::Image *imageIcon1;
Gtk::Image *imageIcon2;
MyHScale* slider;
MySpinButton* spin;
Gtk::Button* reset;
@ -60,7 +59,6 @@ protected:
double ctorDefaultVal; // default value at construction time
EditedState editedState;
EditedState defEditedState;
EditedState autoState;
int digits;
Gtk::CheckButton* editedCheckBox;
bool afterReset;
@ -75,11 +73,10 @@ protected:
double logPivot;
bool logAnchorMiddle;
double shapeValue (double a);
void refreshLabelStyle ();
double shapeValue (double a) const;
double2double_fun value2slider, slider2value;
double getSliderValue();
double getSliderValue() const;
void setSliderValue(double val);
public:
@ -90,85 +87,36 @@ public:
~Adjuster () override;
// Add an "Automatic" checkbox next to the reset button.
void addAutoButton(Glib::ustring tooltip = "");
// Remove the "Automatic" checkbox next to the reset button.
void delAutoButton();
void addAutoButton(const Glib::ustring &tooltip = "");
// Send back the value of og the Auto checkbox
bool getAutoValue ()
{
return automatic != nullptr ? automatic->get_active () : false;
}
void setAutoValue (bool a);
bool notifyListenerAutoToggled ();
void autoToggled ();
void setAutoInconsistent (bool i)
{
if (automatic) {
automatic->set_inconsistent(i);
}
}
bool getAutoInconsistent ()
{
return automatic ? automatic->get_inconsistent() : true /* we have to return something */;
}
void setAdjusterListener (AdjusterListener* alistener)
{
adjusterListener = alistener;
}
bool getAutoValue() const;
void setAutoValue(bool a);
bool notifyListenerAutoToggled();
void autoToggled();
void setAutoInconsistent(bool i);
bool getAutoInconsistent() const;
void setAdjusterListener(AdjusterListener* alistener);
// return the value trimmed to the limits at construction time
double getValue ()
{
return shapeValue(spin->get_value ());
}
double getValue() const;
// return the value trimmed to the limits at construction time
int getIntValue ()
{
return spin->get_value_as_int ();
}
int getIntValue() const;
// return the value trimmed to the limits at construction time,
// method only used by the history manager, so decoration is added if addMode=true
Glib::ustring getTextValue ()
{
if (addMode) {
return Glib::ustring::compose("<i>%1</i>", spin->get_text ());
} else {
return spin->get_text ();
}
}
void setLabel (Glib::ustring lbl)
{
label->set_label(lbl);
}
Glib::ustring getTextValue() const;
void setLabel (const Glib::ustring &lbl);
void setValue (double a);
void setLimits (double vmin, double vmax, double vstep, double vdefault);
void setEnabled (bool enabled);
void setDefault (double def);
// will let the adjuster throw it's "changed" signal when the mouse button is released. Can work altogether with the delay value.
void throwOnButtonRelease(bool throwOnBRelease = true);
void setNbDisplayedChars (int nbr)
{
spin->set_width_chars(nbr);
spin->set_max_width_chars(nbr);
}
void setEditedState (EditedState eState);
EditedState getEditedState ();
void setDefaultEditedState (EditedState eState);
void showEditedCB ();
bool block(bool isBlocked)
{
bool oldValue = blocked;
blocked = isBlocked;
return oldValue;
}
bool block(bool isBlocked);
void setAddMode(bool addM);
bool getAddMode()
{
return addMode;
};
bool getAddMode() const;
void spinChanged ();
void sliderChanged ();
bool notifyListener ();
@ -177,11 +125,10 @@ public:
void resetValue (bool toInitial);
void resetPressed (GdkEventButton* event);
void editedToggled ();
void trimValue (double &val);
void trimValue (float &val);
void trimValue (int &val);
void setLogScale(double base, double pivot, bool anchorMiddle=false);
void trimValue (double &val) const;
void trimValue (float &val) const;
void trimValue (int &val) const;
void setLogScale(double base, double pivot, bool anchorMiddle = false);
};
#endif

View File

@ -28,7 +28,7 @@
using namespace rtengine;
using namespace rtengine::procparams;
BayerPreProcess::BayerPreProcess() : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), true)
BayerPreProcess::BayerPreProcess() : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), options.prevdemo != PD_Sidecar)
{
auto m = ProcEventMapper::getInstance();
EvLineDenoiseDirection = m->newEvent(DARKFRAME, "HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION");

View File

@ -28,7 +28,7 @@ using namespace rtengine;
using namespace rtengine::procparams;
BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RAW_LABEL"), true)
BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RAW_LABEL"), options.prevdemo != PD_Sidecar)
{
auto m = ProcEventMapper::getInstance();

View File

@ -26,7 +26,7 @@
using namespace rtengine;
using namespace rtengine::procparams;
BayerRAWExposure::BayerRAWExposure () : FoldableToolPanel(this, "bayerrawexposure", M("TP_EXPOS_BLACKPOINT_LABEL"), true)
BayerRAWExposure::BayerRAWExposure () : FoldableToolPanel(this, "bayerrawexposure", M("TP_EXPOS_BLACKPOINT_LABEL"), options.prevdemo != PD_Sidecar)
{
PexBlack1 = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_1"), -2048, 2048, 0.1, 0)); //black level
PexBlack1->setAdjusterListener (this);

View File

@ -99,7 +99,7 @@ DirPyrEqualizer::DirPyrEqualizer () : FoldableToolPanel(this, "dirpyrequalizer",
ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMACOARSEST"));
}
multiplier[i] = Gtk::manage ( new Adjuster (ss, 0, 4, 0.01, 1.0) );
multiplier[i] = Gtk::manage(new Adjuster(std::move(ss), 0, 4, 0.01, 1.0));
multiplier[i]->setAdjusterListener(this);
pack_start(*multiplier[i]);
}

View File

@ -364,7 +364,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path)
}
// Fill menu structure with CLUT files
std::set<Glib::ustring> entries;
std::set<std::string> entries;
unsigned long fileCount = 0;
@ -390,10 +390,10 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path)
Glib::ustring name;
Glib::ustring extension;
Glib::ustring profileName;
HaldCLUT::splitClutFilename (entry, name, extension, profileName);
HaldCLUT::splitClutFilename (entry, name, extension, profileName, false);
extension = extension.casefold();
if (extension.compare("tif") != 0 && extension.compare("png") != 0) {
if (extension != "png" && extension != "tif") {
continue;
}

View File

@ -179,7 +179,7 @@ void MultiLangMgr::load(const Glib::ustring &language, const std::vector<Glib::u
value.replace(pos, 2, "\n");
pos++;
}
hint = translations.emplace_hint(hint, key, value);
hint = translations.emplace_hint(hint, std::move(key), std::move(value));
}
}
}

View File

@ -28,7 +28,7 @@
using namespace rtengine;
using namespace rtengine::procparams;
PreProcess::PreProcess () : FoldableToolPanel(this, "preprocess", M("TP_PREPROCESS_LABEL"), true)
PreProcess::PreProcess () : FoldableToolPanel(this, "preprocess", M("TP_PREPROCESS_LABEL"), options.prevdemo != PD_Sidecar)
{
Gtk::HBox* hotdeadPixel = Gtk::manage( new Gtk::HBox () );

View File

@ -290,7 +290,7 @@ Wavelet::Wavelet() :
ss = Glib::ustring::compose( "%1", (i + 1));
}
correction[i] = Gtk::manage ( new Adjuster (ss, -100, 350, 1, 0) );
correction[i] = Gtk::manage(new Adjuster(std::move(ss), -100, 350, 1, 0));
correction[i]->setAdjusterListener(this);
levBox->pack_start(*correction[i]);
}
@ -398,7 +398,7 @@ Wavelet::Wavelet() :
ss = Glib::ustring::compose( "%1", (i + 1));
}
correctionch[i] = Gtk::manage ( new Adjuster (ss, -100, 100, 1, 0) );
correctionch[i] = Gtk::manage(new Adjuster(std::move(ss), -100, 100, 1, 0));
correctionch[i]->setAdjusterListener(this);
chBox->pack_start(*correctionch[i]);
}

View File

@ -27,7 +27,7 @@
using namespace rtengine;
using namespace rtengine::procparams;
XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP_RAW_LABEL"), true)
XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP_RAW_LABEL"), options.prevdemo != PD_Sidecar)
{
auto m = ProcEventMapper::getInstance();
EvDemosaicBorder = m->newEvent(DEMOSAIC, "HISTORY_MSG_RAW_BORDER");