diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc
index 892a9efed..9b2de3e3b 100644
--- a/rtengine/imagedata.cc
+++ b/rtengine/imagedata.cc
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see .
*/
+#include
#include
#include
#include
@@ -43,6 +44,22 @@ Glib::ustring to_utf8 (const std::string& str)
}
}
+template
+T getFromFrame(
+ const std::vector>& frames,
+ std::size_t frame,
+ const std::function& function
+)
+{
+ if (frame < frames.size()) {
+ return function(*frames[frame]);
+ }
+ if (!frames.empty()) {
+ return function(*frames[0]);
+ }
+ return {};
+}
+
}
FramesMetaData* FramesMetaData::fromFile (const Glib::ustring& fname, std::unique_ptr rml, bool firstFrameOnly)
@@ -900,74 +917,196 @@ procparams::IPTCPairs FramesData::getIPTCData (unsigned int frame) const
}
}
-bool FramesData::hasExif (unsigned int frame) const
+bool FramesData::hasExif(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? false : frames.at(frame)->hasExif ();
-}
-bool FramesData::hasIPTC (unsigned int frame) const
-{
- return frames.empty() || frame >= frames.size() ? false : frames.at(frame)->hasIPTC ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.hasExif();
+ }
+ );
}
-tm FramesData::getDateTime (unsigned int frame) const
+bool FramesData::hasIPTC(unsigned int frame) const
{
- if (frames.empty() || frame >= frames.size() ) {
- return {};
- } else {
- return frames.at(frame)->getDateTime ();
- }
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.hasIPTC();
+ }
+ );
}
+
+tm FramesData::getDateTime(unsigned int frame) const
+{
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getDateTime();
+ }
+ );
+}
+
time_t FramesData::getDateTimeAsTS(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0 : frames.at(frame)->getDateTimeAsTS ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getDateTimeAsTS();
+ }
+ );
}
-int FramesData::getISOSpeed (unsigned int frame) const
+
+int FramesData::getISOSpeed(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0 : frames.at(frame)->getISOSpeed ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getISOSpeed();
+ }
+ );
}
-double FramesData::getFNumber (unsigned int frame) const
+
+double FramesData::getFNumber(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0. : frames.at(frame)->getFNumber ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getFNumber();
+ }
+ );
}
-double FramesData::getFocalLen (unsigned int frame) const
+
+double FramesData::getFocalLen(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0. : frames.at(frame)->getFocalLen ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getFocalLen();
+ }
+ );
}
-double FramesData::getFocalLen35mm (unsigned int frame) const
+
+double FramesData::getFocalLen35mm(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0. : frames.at(frame)->getFocalLen35mm ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getFocalLen35mm();
+ }
+ );
}
-float FramesData::getFocusDist (unsigned int frame) const
+
+float FramesData::getFocusDist(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0.f : frames.at(frame)->getFocusDist ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getFocusDist();
+ }
+ );
}
-double FramesData::getShutterSpeed (unsigned int frame) const
+
+double FramesData::getShutterSpeed(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0. : frames.at(frame)->getShutterSpeed ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getShutterSpeed();
+ }
+ );
}
-double FramesData::getExpComp (unsigned int frame) const
+
+double FramesData::getExpComp(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? 0. : frames.at(frame)->getExpComp ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getExpComp();
+ }
+ );
}
-std::string FramesData::getMake (unsigned int frame) const
+
+std::string FramesData::getMake(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? std::string() : frames.at(frame)->getMake ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getMake();
+ }
+ );
}
-std::string FramesData::getModel (unsigned int frame) const
+
+std::string FramesData::getModel(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? std::string() : frames.at(frame)->getModel ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getModel();
+ }
+ );
}
-std::string FramesData::getLens (unsigned int frame) const
+
+std::string FramesData::getLens(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? std::string() : frames.at(frame)->getLens ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getLens();
+ }
+ );
}
-std::string FramesData::getSerialNumber (unsigned int frame) const
+
+std::string FramesData::getSerialNumber(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? std::string() : frames.at(frame)->getSerialNumber ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getSerialNumber();
+ }
+ );
}
-std::string FramesData::getOrientation (unsigned int frame) const
+
+std::string FramesData::getOrientation(unsigned int frame) const
{
- return frames.empty() || frame >= frames.size() ? std::string() : frames.at(frame)->getOrientation ();
+ return getFromFrame(
+ frames,
+ frame,
+ [](const FrameData& frame_data)
+ {
+ return frame_data.getOrientation();
+ }
+ );
}
diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc
index 34ec06492..74233741c 100644
--- a/rtengine/imagefloat.cc
+++ b/rtengine/imagefloat.cc
@@ -499,7 +499,6 @@ void Imagefloat::ExecCMSTransform(cmsHTRANSFORM hTransform)
*(p++) = *(pR++);
*(p++) = *(pG++);
*(p++) = *(pB++);
-
}
cmsDoTransform (hTransform, pBuf.data, pBuf.data, width);
diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h
index 995717593..242e02dea 100644
--- a/rtexif/rtexif.h
+++ b/rtexif/rtexif.h
@@ -488,8 +488,8 @@ template
class ChoiceInterpreter : public Interpreter
{
protected:
- using Choices = std::map;
- using ChoicesIterator = typename Choices::const_iterator;
+ using Choices = std::map;
+ using ChoicesIterator = typename Choices::const_iterator;
Choices choices;
public:
ChoiceInterpreter () {};
diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h
index 1d9c621eb..86361b720 100644
--- a/rtgui/addsetids.h
+++ b/rtgui/addsetids.h
@@ -134,13 +134,13 @@ enum {
ADDSET_FATTAL_ANCHOR,
ADDSET_SHARPENMICRO_CONTRAST,
ADDSET_SHARP_CONTRAST,
- ADDSET_BAYER_FALSE_COLOR_SUPPRESSION,
- ADDSET_BAYER_ITER,
- ADDSET_BAYER_PS_SMOOTH,
- ADDSET_BAYER_PS_EPERISO,
- ADDSET_BAYER_PS_SIGMA,
- ADDSET_BAYER_DUALDEMOZCONTRAST,
- ADDSET_XTRANS_FALSE_COLOR_SUPPRESSION,
+ ADDSET_BAYER_FALSE_COLOR_SUPPRESSION,
+ ADDSET_BAYER_ITER,
+ ADDSET_BAYER_PS_SMOOTH,
+ ADDSET_BAYER_PS_EPERISO,
+ ADDSET_BAYER_PS_SIGMA,
+ ADDSET_BAYER_DUALDEMOZCONTRAST,
+ ADDSET_XTRANS_FALSE_COLOR_SUPPRESSION,
ADDSET_SOFTLIGHT_STRENGTH,
ADDSET_DEHAZE_STRENGTH,
diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc
index e8b92062a..8f48ea3d7 100644
--- a/rtgui/diagonalcurveeditorsubgroup.cc
+++ b/rtgui/diagonalcurveeditorsubgroup.cc
@@ -56,7 +56,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
customCurve = Gtk::manage (new MyDiagonalCurve ());
customCurve->setType (DCT_Spline);
-
+
Gtk::Grid* customCurveBox= Gtk::manage (new Gtk::Grid ());
customCurveBox->get_style_context()->add_class("curve-curvebox");
customCurveBox->add(*customCurve);
@@ -148,7 +148,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
NURBSCurve = Gtk::manage (new MyDiagonalCurve ());
NURBSCurve->setType (DCT_NURBS);
-
+
Gtk::Grid* NURBSCurveBox= Gtk::manage (new Gtk::Grid ());
NURBSCurveBox->get_style_context()->add_class("curve-curvebox");
NURBSCurveBox->add(*NURBSCurve);
@@ -240,7 +240,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
paramCurve = Gtk::manage (new MyDiagonalCurve ());
paramCurve->setType (DCT_Parametric);
-
+
Gtk::Grid* paramCurveBox= Gtk::manage (new Gtk::Grid ());
paramCurveBox->get_style_context()->add_class("curve-curvebox");
paramCurveBox->add(*paramCurve);
@@ -669,9 +669,7 @@ void DiagonalCurveEditorSubGroup::switchGUI()
} else {
// dCurve ave a ColorProvider or a background gradient defined, so we create/update the object
if (!leftBar) {
- leftBar = new ColoredBar(RTO_Bottom2Top);
-
-
+ leftBar = new ColoredBar(RTO_Bottom2Top);
}
if (barColorProvider) {
@@ -1197,7 +1195,7 @@ bool DiagonalCurveEditorSubGroup::curveReset(CurveEditor *ce)
customCurve->reset (dce->customResetCurve, dce->getIdentityValue());
return true;
- case (DCT_CatumullRom) :
+ case (DCT_CatumullRom) :
customCurve->reset (dce->catmullRomResetCurve, dce->getIdentityValue());
return true;
diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc
index b6756a59c..8ee19eca8 100644
--- a/rtgui/histogrampanel.cc
+++ b/rtgui/histogrampanel.cc
@@ -647,7 +647,7 @@ bool HistogramRGBArea::on_button_press_event (GdkEventButton* event)
void HistogramRGBArea::factorChanged (double newFactor)
{
- factor = newFactor;
+ factor = newFactor;
}
//