metadata: allow the user to specify XResolution/YResolution

see https://discuss.pixls.us/t/note-to-the-dev-guys-about-72-ppi-output

(cherry picked from commit ad237944699800368ba50151f6774ee203d61ed5)
This commit is contained in:
Alberto Griggio 2020-06-04 02:48:47 -07:00 committed by Lawrence Lee
parent 1e0cf45445
commit 393dbcf9f9
No known key found for this signature in database
GPG Key ID: 048FF2B76A63895F
9 changed files with 75 additions and 14 deletions

View File

@ -52,6 +52,7 @@ DYNPROFILEEDITOR_PROFILE;Processing Profile
EDITWINDOW_TITLE;Image Edit EDITWINDOW_TITLE;Image Edit
EDIT_OBJECT_TOOLTIP;Displays a widget on the preview window which lets you adjust this tool. 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. 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_APERTURE;Aperture
EXIFFILTER_CAMERA;Camera EXIFFILTER_CAMERA;Camera
EXIFFILTER_EXPOSURECOMPENSATION;Exposure compensation (EV) EXIFFILTER_EXPOSURECOMPENSATION;Exposure compensation (EV)
@ -1556,7 +1557,7 @@ MAIN_TAB_EXPOSURE_TOOLTIP;Shortcut: <b>Alt-e</b>
MAIN_TAB_FAVORITES;Favorites MAIN_TAB_FAVORITES;Favorites
MAIN_TAB_FAVORITES_TOOLTIP;Shortcut: <b>Alt-u</b> MAIN_TAB_FAVORITES_TOOLTIP;Shortcut: <b>Alt-u</b>
MAIN_TAB_FILTER; Filter MAIN_TAB_FILTER; Filter
MAIN_TAB_INSPECT; Inspect MAIN_TAB_INSPECT; Inspect
MAIN_TAB_IPTC;IPTC MAIN_TAB_IPTC;IPTC
MAIN_TAB_LOCALLAB;Local MAIN_TAB_LOCALLAB;Local
MAIN_TAB_LOCALLAB_TOOLTIP;Shortcut: <b>Alt-o</b> MAIN_TAB_LOCALLAB_TOOLTIP;Shortcut: <b>Alt-o</b>

View File

@ -5289,7 +5289,9 @@ const std::map<std::string, std::string> exif_keys = {
{"Make", "Exif.Image.Make"}, {"Make", "Exif.Image.Make"},
{"Model", "Exif.Image.Model"}, {"Model", "Exif.Image.Model"},
{"Lens", "Exif.Photo.LensModel"}, {"Lens", "Exif.Photo.LensModel"},
{"DateTime", "Exif.Photo.DateTimeOriginal"} {"DateTime", "Exif.Photo.DateTimeOriginal"},
{"XResolution", "Exif.Image.XResolution"},
{"YResolution", "Exif.Image.YResolution"}
}; };
const std::map<std::string, std::string> iptc_keys = { const std::map<std::string, std::string> iptc_keys = {
@ -5330,7 +5332,9 @@ std::vector<std::string> MetaDataParams::basicExifKeys = {
"Exif.Photo.ISOSpeedRatings", "Exif.Photo.ISOSpeedRatings",
"Exif.Photo.ExposureBiasValue", "Exif.Photo.ExposureBiasValue",
"Exif.Photo.Flash", "Exif.Photo.Flash",
"Exif.Photo.DateTimeOriginal" "Exif.Photo.DateTimeOriginal",
"Exif.Image.XResolution",
"Exif.Image.YResolution"
}; };

View File

@ -487,7 +487,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
firstProcessingDone = false; firstProcessingDone = false;
// construct toolpanelcoordinator // construct toolpanelcoordinator
tpc = new ToolPanelCoordinator (); tpc = new ToolPanelCoordinator();
tpc->setProgressListener(this);
// build GUI // build GUI
@ -1227,6 +1228,7 @@ void EditorPanel::setProgressState(bool inProcessing)
void EditorPanel::error(const Glib::ustring& descr) void EditorPanel::error(const Glib::ustring& descr)
{ {
parent->error(descr);
} }
void EditorPanel::error(const Glib::ustring& title, const Glib::ustring& descr) void EditorPanel::error(const Glib::ustring& title, const Glib::ustring& descr)

View File

@ -34,7 +34,8 @@ using namespace rtengine::procparams;
ExifPanel::ExifPanel() : ExifPanel::ExifPanel() :
idata(nullptr), idata(nullptr),
changeList(new rtengine::procparams::ExifPairs), changeList(new rtengine::procparams::ExifPairs),
defChangeList(new rtengine::procparams::ExifPairs) defChangeList(new rtengine::procparams::ExifPairs),
pl_(nullptr)
{ {
for (auto &k : MetaDataParams::basicExifKeys) { for (auto &k : MetaDataParams::basicExifKeys) {
editableTags.push_back(std::make_pair(k, "")); editableTags.push_back(std::make_pair(k, ""));
@ -318,8 +319,16 @@ void ExifPanel::refreshTags()
for (const auto& p : *changeList) { for (const auto& p : *changeList) {
try { 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) { } 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 it = exifTreeModel->get_iter(path);
auto row = *it; auto row = *it;
std::string key = row[exifColumns.key]; std::string key = row[exifColumns.key];
auto value = val;
(*changeList)[key] = value; bool good = true;
if (!all_keys_active()) { try {
cur_active_keys_.insert(key); 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); if (good) {
exifTree->get_selection()->select(it); (*changeList)[key] = value;
notifyListener(); 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;
} }

View File

@ -99,6 +99,8 @@ private:
std::unordered_set<std::string> initial_active_keys_; std::unordered_set<std::string> initial_active_keys_;
std::unordered_set<std::string> cur_active_keys_; std::unordered_set<std::string> cur_active_keys_;
rtengine::ProgressListener *pl_;
void addTag(const std::string &key, const std::pair<Glib::ustring, Glib::ustring> &label, const Glib::ustring &value, bool editable, bool edited); void addTag(const std::string &key, const std::pair<Glib::ustring, Glib::ustring> &label, const Glib::ustring &value, bool editable, bool edited);
void refreshTags(); void refreshTags();
void resetIt(const Gtk::TreeModel::const_iterator& iter); void resetIt(const Gtk::TreeModel::const_iterator& iter);
@ -136,4 +138,5 @@ public:
void notifyListener(); void notifyListener();
void setProgressListener(rtengine::ProgressListener *pl);
}; };

View File

@ -127,3 +127,9 @@ void MetaDataPanel::metaDataModeChanged()
listener->panelChanged(EvMetaDataMode, M("HISTORY_CHANGED")); listener->panelChanged(EvMetaDataMode, M("HISTORY_CHANGED"));
} }
} }
void MetaDataPanel::setProgressListener(rtengine::ProgressListener *pl)
{
exifpanel->setProgressListener(pl);
}

View File

@ -45,5 +45,7 @@ public:
void setImageData(const rtengine::FramesMetaData* id); void setImageData(const rtengine::FramesMetaData* id);
void setListener(ToolPanelListener *tpl) override; void setListener(ToolPanelListener *tpl) override;
void setProgressListener(rtengine::ProgressListener *pl);
}; };

View File

@ -1271,3 +1271,9 @@ bool ToolPanelCoordinator::getFilmNegativeSpot(rtengine::Coord spot, int spotSiz
{ {
return ipc && ipc->getFilmNegativeSpot(spot.x, spot.y, spotSize, refInput, refOutput); return ipc && ipc->getFilmNegativeSpot(spot.x, spot.y, spotSize, refInput, refOutput);
} }
void ToolPanelCoordinator::setProgressListener(rtengine::ProgressListener *pl)
{
metadata->setProgressListener(pl);
}

View File

@ -348,6 +348,8 @@ public:
void setEditProvider(EditDataProvider *provider); void setEditProvider(EditDataProvider *provider);
void setProgressListener(rtengine::ProgressListener *pl);
private: private:
IdleRegister idle_register; IdleRegister idle_register;
}; };