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:
committed by
Lawrence Lee
parent
1e0cf45445
commit
393dbcf9f9
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -127,3 +127,9 @@ void MetaDataPanel::metaDataModeChanged()
|
||||
listener->panelChanged(EvMetaDataMode, M("HISTORY_CHANGED"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MetaDataPanel::setProgressListener(rtengine::ProgressListener *pl)
|
||||
{
|
||||
exifpanel->setProgressListener(pl);
|
||||
}
|
||||
|
||||
@@ -45,5 +45,7 @@ public:
|
||||
|
||||
void setImageData(const rtengine::FramesMetaData* id);
|
||||
void setListener(ToolPanelListener *tpl) override;
|
||||
|
||||
void setProgressListener(rtengine::ProgressListener *pl);
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -348,6 +348,8 @@ public:
|
||||
|
||||
void setEditProvider(EditDataProvider *provider);
|
||||
|
||||
void setProgressListener(rtengine::ProgressListener *pl);
|
||||
|
||||
private:
|
||||
IdleRegister idle_register;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user