diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index d88c853df..abf5b6ae5 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -803,11 +803,11 @@ rtexif::TagDirectory* FramesData::getBestExifData (ImageSource *imgSource, procp eSensorType sensorType = imgSource->getSensorType(); unsigned int imgNum = 0; if (sensorType == ST_BAYER) { - imgNum = rtengine::LIM(rawParams->bayersensor.imageNum, 1, frames.size()); + imgNum = rtengine::LIM(rawParams->bayersensor.imageNum, 0, frames.size() - 1); /* // might exist someday ? } else if (sensorType == ST_FUJI_XTRANS) { - imgNum = rtengine::LIM(rawParams->xtranssensor.imageNum, 1, frames.size()); + imgNum = rtengine::LIM(rawParams->xtranssensor.imageNum, 0, frames.size() - 1); } else if (sensorType == ST_NONE && !imgSource->isRAW()) { // standard image multiframe support should come here (when implemented in GUI) */ diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 8a5ee8ae2..bc0e2002f 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -730,7 +730,12 @@ void TagDirectory::applyChange (std::string name, Glib::ustring value) } else if (value == "#delete" && t) { t->setKeep (false); } else if (t && !t->isDirectory()) { - t->valueFromString (value); + if (name == "UserComment") { + // UserComment can be Unicode + t->userCommentFromString (value); + } else { + t->valueFromString (value); + } } else { const TagAttrib* attrib = nullptr; @@ -1752,6 +1757,19 @@ void Tag::valueFromString (const std::string& value) } } +void Tag::userCommentFromString (const Glib::ustring& text) +{ + + if (!allocOwnMemory) { + return; + } + if (value) { + delete [] value; + value = nullptr; + } + initUserComment(text); +} + int Tag::calculateSize () { int size = 0; diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 887ea2b46..125d38c94 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -290,9 +290,10 @@ public: // additional getter/setter for more comfortable use - std::string valueToString (); - std::string nameToString (int i = 0); - void valueFromString (const std::string& value); + std::string valueToString (); + std::string nameToString (int i = 0); + void valueFromString (const std::string& value); + void userCommentFromString (const Glib::ustring& text); // functions for writing int calculateSize (); diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index 0e7875815..2e47786e5 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -284,11 +284,12 @@ void ExifPanel::addDirectory (const TagDirectory* dir, Gtk::TreeModel::Children continue; } - if (t->isDirectory()) + if (t->isDirectory()) { for (int j = 0; t->getDirectory (j); j++) { Gtk::TreeModel::Children ch = addTag (root, t->nameToString (j), M ("EXIFPANEL_SUBDIRECTORY"), currAttrib ? currAttrib->action : AC_DONTWRITE, currAttrib && currAttrib->editable); addDirectory (t->getDirectory (j), ch); - } else { + } + } else { addTag (root, t->nameToString (), t->valueToString (), currAttrib ? (t->getOwnMemory() ? currAttrib->action : AC_SYSTEM) : AC_DONTWRITE, currAttrib && currAttrib->editable); } } @@ -631,11 +632,11 @@ Glib::ustring ExifPanel::getSelection (bool onlyeditable) while (iter) { if (first) { ret = iter->get_value (exifColumns.field_nopango); + editable = iter->get_value (exifColumns.editable); } else { ret = iter->get_value (exifColumns.field_nopango) + "." + ret; } - editable = iter->get_value (exifColumns.editable); iter = iter->parent (); first = false; }