diff --git a/rtdata/languages/default b/rtdata/languages/default
index 1b625bdac..a0b25e0b6 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -52,6 +52,7 @@ DYNPROFILEEDITOR_PROFILE;Processing Profile
EDITWINDOW_TITLE;Image Edit
EDIT_OBJECT_TOOLTIP;Displays a widget on the preview window which lets you adjust this tool.
EDIT_PIPETTE_TOOLTIP;To add an adjustment point to the curve, hold the Ctrl key while left-clicking the desired spot in the image preview.\nTo adjust the point, hold the Ctrl key while left-clicking the corresponding area in the preview, then let go of Ctrl (unless you desire fine control) and while still holding the left mouse button move the mouse up or down to move that point up or down in the curve.
+ERROR_MSG_METADATA_VALUE;Metadata: error setting %1 to %2
EXIFFILTER_APERTURE;Aperture
EXIFFILTER_CAMERA;Camera
EXIFFILTER_EXPOSURECOMPENSATION;Exposure compensation (EV)
@@ -1556,7 +1557,7 @@ MAIN_TAB_EXPOSURE_TOOLTIP;Shortcut: Alt-e
MAIN_TAB_FAVORITES;Favorites
MAIN_TAB_FAVORITES_TOOLTIP;Shortcut: Alt-u
MAIN_TAB_FILTER; Filter
-MAIN_TAB_INSPECT; Inspect
+MAIN_TAB_INSPECT; Inspect
MAIN_TAB_IPTC;IPTC
MAIN_TAB_LOCALLAB;Local
MAIN_TAB_LOCALLAB_TOOLTIP;Shortcut: Alt-o
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index d5cc7b45b..f0300a011 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -5289,7 +5289,9 @@ const std::map exif_keys = {
{"Make", "Exif.Image.Make"},
{"Model", "Exif.Image.Model"},
{"Lens", "Exif.Photo.LensModel"},
- {"DateTime", "Exif.Photo.DateTimeOriginal"}
+ {"DateTime", "Exif.Photo.DateTimeOriginal"},
+ {"XResolution", "Exif.Image.XResolution"},
+ {"YResolution", "Exif.Image.YResolution"}
};
const std::map iptc_keys = {
@@ -5330,7 +5332,9 @@ std::vector MetaDataParams::basicExifKeys = {
"Exif.Photo.ISOSpeedRatings",
"Exif.Photo.ExposureBiasValue",
"Exif.Photo.Flash",
- "Exif.Photo.DateTimeOriginal"
+ "Exif.Photo.DateTimeOriginal",
+ "Exif.Image.XResolution",
+ "Exif.Image.YResolution"
};
diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc
index c2ad9241a..350538626 100644
--- a/rtgui/editorpanel.cc
+++ b/rtgui/editorpanel.cc
@@ -487,7 +487,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
firstProcessingDone = false;
// construct toolpanelcoordinator
- tpc = new ToolPanelCoordinator ();
+ tpc = new ToolPanelCoordinator();
+ tpc->setProgressListener(this);
// build GUI
@@ -1227,6 +1228,7 @@ void EditorPanel::setProgressState(bool inProcessing)
void EditorPanel::error(const Glib::ustring& descr)
{
+ parent->error(descr);
}
void EditorPanel::error(const Glib::ustring& title, const Glib::ustring& descr)
diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc
index 136e97b6e..719674151 100644
--- a/rtgui/exifpanel.cc
+++ b/rtgui/exifpanel.cc
@@ -34,7 +34,8 @@ using namespace rtengine::procparams;
ExifPanel::ExifPanel() :
idata(nullptr),
changeList(new rtengine::procparams::ExifPairs),
- defChangeList(new rtengine::procparams::ExifPairs)
+ defChangeList(new rtengine::procparams::ExifPairs),
+ pl_(nullptr)
{
for (auto &k : MetaDataParams::basicExifKeys) {
editableTags.push_back(std::make_pair(k, ""));
@@ -318,8 +319,16 @@ void ExifPanel::refreshTags()
for (const auto& p : *changeList) {
try {
- exif[p.first] = p.second;
+ auto &datum = exif[p.first];
+ if (datum.setValue(p.second) != 0) {
+ if (pl_) {
+ pl_->error(Glib::ustring::compose(M("ERROR_MSG_METADATA_VALUE"), p.first, p.second));
+ }
+ }
} catch (const std::exception& exc) {
+ if (pl_) {
+ pl_->error(Glib::ustring::compose(M("ERROR_MSG_METADATA_VALUE"), p.first, p.second));
+ }
}
}
@@ -628,19 +637,45 @@ void ExifPanel::setExifTagValue(Gtk::CellRenderer *renderer, const Gtk::TreeMode
}
-void ExifPanel::onEditExifTagValue(const Glib::ustring &path, const Glib::ustring &value)
+void ExifPanel::onEditExifTagValue(const Glib::ustring &path, const Glib::ustring &val)
{
auto it = exifTreeModel->get_iter(path);
auto row = *it;
std::string key = row[exifColumns.key];
+ auto value = val;
- (*changeList)[key] = value;
- if (!all_keys_active()) {
- cur_active_keys_.insert(key);
+ bool good = true;
+ try {
+ Exiv2::ExifData data;
+ auto &datum = data[key];
+ if (datum.setValue(value) != 0) {
+ if ((datum.typeId() == Exiv2::signedRational || datum.typeId() == Exiv2::unsignedRational) && datum.setValue(value + "/1") == 0) {
+ value += "/1";
+ } else {
+ good = false;
+ }
+ }
+ } catch (std::exception &exc) {
+ good = false;
}
- refreshTags();
- it = exifTreeModel->get_iter(path);
- exifTree->get_selection()->select(it);
- notifyListener();
+ if (good) {
+ (*changeList)[key] = value;
+ if (!all_keys_active()) {
+ cur_active_keys_.insert(key);
+ }
+ refreshTags();
+
+ it = exifTreeModel->get_iter(path);
+ exifTree->get_selection()->select(it);
+ notifyListener();
+ } else if (pl_) {
+ pl_->error(Glib::ustring::compose(M("ERROR_MSG_METADATA_VALUE"), key, value));
+ }
+}
+
+
+void ExifPanel::setProgressListener(rtengine::ProgressListener *pl)
+{
+ pl_ = pl;
}
diff --git a/rtgui/exifpanel.h b/rtgui/exifpanel.h
index 261561ea0..bc8d6229f 100644
--- a/rtgui/exifpanel.h
+++ b/rtgui/exifpanel.h
@@ -99,6 +99,8 @@ private:
std::unordered_set initial_active_keys_;
std::unordered_set cur_active_keys_;
+ rtengine::ProgressListener *pl_;
+
void addTag(const std::string &key, const std::pair &label, const Glib::ustring &value, bool editable, bool edited);
void refreshTags();
void resetIt(const Gtk::TreeModel::const_iterator& iter);
@@ -136,4 +138,5 @@ public:
void notifyListener();
+ void setProgressListener(rtengine::ProgressListener *pl);
};
diff --git a/rtgui/metadatapanel.cc b/rtgui/metadatapanel.cc
index e26444ccc..4e6252da4 100644
--- a/rtgui/metadatapanel.cc
+++ b/rtgui/metadatapanel.cc
@@ -127,3 +127,9 @@ void MetaDataPanel::metaDataModeChanged()
listener->panelChanged(EvMetaDataMode, M("HISTORY_CHANGED"));
}
}
+
+
+void MetaDataPanel::setProgressListener(rtengine::ProgressListener *pl)
+{
+ exifpanel->setProgressListener(pl);
+}
diff --git a/rtgui/metadatapanel.h b/rtgui/metadatapanel.h
index bc74ac484..aacbb9fe1 100644
--- a/rtgui/metadatapanel.h
+++ b/rtgui/metadatapanel.h
@@ -45,5 +45,7 @@ public:
void setImageData(const rtengine::FramesMetaData* id);
void setListener(ToolPanelListener *tpl) override;
+
+ void setProgressListener(rtengine::ProgressListener *pl);
};
diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc
index fde949606..defe64065 100644
--- a/rtgui/toolpanelcoord.cc
+++ b/rtgui/toolpanelcoord.cc
@@ -1271,3 +1271,9 @@ bool ToolPanelCoordinator::getFilmNegativeSpot(rtengine::Coord spot, int spotSiz
{
return ipc && ipc->getFilmNegativeSpot(spot.x, spot.y, spotSize, refInput, refOutput);
}
+
+
+void ToolPanelCoordinator::setProgressListener(rtengine::ProgressListener *pl)
+{
+ metadata->setProgressListener(pl);
+}
diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h
index 675b77de7..4c46a39ec 100644
--- a/rtgui/toolpanelcoord.h
+++ b/rtgui/toolpanelcoord.h
@@ -348,6 +348,8 @@ public:
void setEditProvider(EditDataProvider *provider);
+ void setProgressListener(rtengine::ProgressListener *pl);
+
private:
IdleRegister idle_register;
};