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
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)

View File

@ -5289,7 +5289,9 @@ const std::map<std::string, std::string> 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<std::string, std::string> iptc_keys = {
@ -5330,7 +5332,9 @@ std::vector<std::string> MetaDataParams::basicExifKeys = {
"Exif.Photo.ISOSpeedRatings",
"Exif.Photo.ExposureBiasValue",
"Exif.Photo.Flash",
"Exif.Photo.DateTimeOriginal"
"Exif.Photo.DateTimeOriginal",
"Exif.Image.XResolution",
"Exif.Image.YResolution"
};

View File

@ -488,6 +488,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
// construct 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)

View File

@ -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,12 +637,29 @@ 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;
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;
}
if (good) {
(*changeList)[key] = value;
if (!all_keys_active()) {
cur_active_keys_.insert(key);
@ -643,4 +669,13 @@ void ExifPanel::onEditExifTagValue(const Glib::ustring &path, const Glib::ustrin
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> 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 refreshTags();
void resetIt(const Gtk::TreeModel::const_iterator& iter);
@ -136,4 +138,5 @@ public:
void notifyListener();
void setProgressListener(rtengine::ProgressListener *pl);
};

View File

@ -127,3 +127,9 @@ void MetaDataPanel::metaDataModeChanged()
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 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);
}
void ToolPanelCoordinator::setProgressListener(rtengine::ProgressListener *pl)
{
metadata->setProgressListener(pl);
}

View File

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