Added "Show all" button in Exif panel + astylized exifpanel.cc/.h
See #4008
This commit is contained in:
@@ -68,6 +68,7 @@ EXIFPANEL_RESET;Réinitialiser
|
||||
EXIFPANEL_RESETALL;Réinitialiser tout
|
||||
EXIFPANEL_RESETALLHINT;Réinitialise tous les tags à leur valeur initiale
|
||||
EXIFPANEL_RESETHINT;Réinitialise les données sélectionnées à la valeur initiale
|
||||
EXIFPANEL_SHOWALL;Voir tout
|
||||
EXIFPANEL_SUBDIRECTORY;Sous-répertoire
|
||||
EXPORT_BYPASS;Étapes de traitement à ignorer
|
||||
EXPORT_BYPASS_ALL;Sélectionner / Désélectionner tout
|
||||
|
@@ -826,7 +826,7 @@ const TagAttrib ifdAttribs[] = {
|
||||
{0, AC_WRITE, 0, nullptr, 0xc62f, AUTO, "CameraSerialNumber", &stdInterpreter},
|
||||
{0, AC_SYSTEM, 0, nullptr, 0xc630, AUTO, "DNGLensInfo", &stdInterpreter},
|
||||
{0, AC_DONTWRITE, 0, nullptr, 0xC634, AUTO, "MakerNote", &stdInterpreter}, //DNGPrivateData
|
||||
{0, AC_DONTWRITE, 0, nullptr, 0xC640, AUTO, "RawImageSegmentation", &rawImageSegmentationInterpreter},
|
||||
{0, AC_SYSTEM, 0, nullptr, 0xC640, AUTO, "RawImageSegmentation", &rawImageSegmentationInterpreter},
|
||||
{0, AC_WRITE, 0, nullptr, 0xc65d, AUTO, "RawDataUniqueID", &stdInterpreter},
|
||||
{0, AC_DONTWRITE, 0, nullptr, 0xc761, AUTO, "NoiseProfile", &stdInterpreter},
|
||||
{ -1, AC_DONTWRITE, 0, nullptr, 0, AUTO, "", nullptr}
|
||||
|
@@ -47,8 +47,9 @@ ExifPanel::ExifPanel () : idata(nullptr)
|
||||
exifTree->set_model (exifTreeModel);
|
||||
exifTree->set_grid_lines (Gtk::TREE_VIEW_GRID_LINES_NONE);
|
||||
exifTree->set_row_separator_func (
|
||||
[&](const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator& row)
|
||||
{ return row->get_value (exifColumns.isSeparator); }
|
||||
[&] (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator & row) {
|
||||
return row->get_value (exifColumns.isSeparator);
|
||||
}
|
||||
);
|
||||
|
||||
delicon = RTImage::createFromFile ("gtk-close.png");
|
||||
@@ -96,11 +97,11 @@ ExifPanel::ExifPanel () : idata(nullptr)
|
||||
Gtk::Grid* buttons1 = Gtk::manage (new Gtk::Grid());
|
||||
buttons1->set_row_homogeneous (true);
|
||||
buttons1->set_column_homogeneous (true);
|
||||
setExpandAlignProperties(buttons1, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
|
||||
setExpandAlignProperties (buttons1, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
|
||||
Gtk::Grid* buttons2 = Gtk::manage (new Gtk::Grid());
|
||||
buttons2->set_row_homogeneous (true);
|
||||
buttons2->set_column_homogeneous (true);
|
||||
setExpandAlignProperties(buttons2, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
|
||||
setExpandAlignProperties (buttons2, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
|
||||
|
||||
remove = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_REMOVE")
|
||||
remove->set_image (*Gtk::manage (new Gtk::Image (delicon)));
|
||||
@@ -123,12 +124,18 @@ ExifPanel::ExifPanel () : idata(nullptr)
|
||||
setExpandAlignProperties (add, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
||||
buttons1->attach_next_to (*add, Gtk::POS_RIGHT, 1, 1);
|
||||
|
||||
showAll = Gtk::manage (new Gtk::ToggleButton (M ("EXIFPANEL_SHOWALL")));
|
||||
//add->set_tooltip_text (M("EXIFPANEL_SHOWALL"));
|
||||
setExpandAlignProperties (showAll, false, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
||||
showAll->set_active (options.lastShowAllExif);
|
||||
buttons2->attach_next_to (*showAll, Gtk::POS_LEFT, 1, 1);
|
||||
|
||||
reset = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_RESET")
|
||||
reset->set_image (*Gtk::manage (new RTImage ("gtk-undo-ltr.png", "gtk-undo-rtl.png")));
|
||||
reset->set_tooltip_text (M ("EXIFPANEL_RESETHINT"));
|
||||
reset->get_style_context()->add_class ("Left");
|
||||
setExpandAlignProperties (reset, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
||||
buttons2->attach_next_to(*reset, Gtk::POS_LEFT, 1, 1);
|
||||
buttons2->attach_next_to (*reset, Gtk::POS_RIGHT, 1, 1);
|
||||
|
||||
resetAll = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_RESETALL")
|
||||
resetAll->set_image (*Gtk::manage (new RTImage ("gtk-undoall-ltr.png", "gtk-undoall-rtl.png")));
|
||||
@@ -148,6 +155,7 @@ ExifPanel::ExifPanel () : idata(nullptr)
|
||||
reset->signal_clicked().connect ( sigc::mem_fun (*this, &ExifPanel::resetPressed) );
|
||||
resetAll->signal_clicked().connect ( sigc::mem_fun (*this, &ExifPanel::resetAllPressed) );
|
||||
add->signal_clicked().connect ( sigc::mem_fun (*this, &ExifPanel::addPressed) );
|
||||
showAll->signal_toggled().connect ( sigc::mem_fun (*this, &ExifPanel::showAlltoggled) );
|
||||
|
||||
show_all ();
|
||||
}
|
||||
@@ -188,14 +196,10 @@ void ExifPanel::setImageData (const FramesMetaData* id)
|
||||
idata = id;
|
||||
exifTreeModel->clear ();
|
||||
|
||||
if (id) {
|
||||
if (idata) {
|
||||
for (unsigned int rootNum = 0; rootNum < id->getRootCount (); ++rootNum) {
|
||||
if ( id->getRootExifData (rootNum)) {
|
||||
//id->getRootExifData ()->printAll ();
|
||||
if (rootNum > 0) {
|
||||
addSeparator();
|
||||
}
|
||||
addDirectory (id->getRootExifData (rootNum), exifTreeModel->children());
|
||||
addDirectory (id->getRootExifData (rootNum), exifTreeModel->children(), rootNum > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,23 +251,45 @@ Gtk::TreeModel::Children ExifPanel::addSeparator ()
|
||||
return row.children();
|
||||
}
|
||||
|
||||
void ExifPanel::addDirectory (const TagDirectory* dir, Gtk::TreeModel::Children root)
|
||||
void ExifPanel::addDirectory (const TagDirectory* dir, Gtk::TreeModel::Children root, bool checkForSeparator)
|
||||
{
|
||||
|
||||
for (int i = 0; i < dir->getCount(); i++) {
|
||||
for (int i = 0; i < dir->getCount(); ++i) {
|
||||
Tag* t = (const_cast<TagDirectory*> (dir))->getTagByIndex (i);
|
||||
|
||||
if (t->getAttrib() && t->getAttrib()->action == AC_SYSTEM) {
|
||||
bool hasContent = false;
|
||||
|
||||
if (checkForSeparator && i == 0) {
|
||||
for (int j = 0; j < dir->getCount(); ++j) {
|
||||
Tag* t2 = (const_cast<TagDirectory*> (dir))->getTagByIndex (j);
|
||||
const TagAttrib* currAttrib = t->getAttrib();
|
||||
|
||||
if (currAttrib && ((options.lastShowAllExif) || (!options.lastShowAllExif && currAttrib->action != AC_SYSTEM))) {
|
||||
addSeparator();
|
||||
hasContent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hasContent = true;
|
||||
}
|
||||
|
||||
if (!hasContent) {
|
||||
return;
|
||||
}
|
||||
|
||||
const TagAttrib* currAttrib = t->getAttrib();
|
||||
|
||||
if (!options.lastShowAllExif && currAttrib && currAttrib->action == AC_SYSTEM) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (t->isDirectory())
|
||||
for (int j = 0; t->getDirectory (j); j++) {
|
||||
Gtk::TreeModel::Children ch = addTag (root, t->nameToString (j), M("EXIFPANEL_SUBDIRECTORY"), t->getAttrib() ? t->getAttrib()->action : AC_DONTWRITE, t->getAttrib() && t->getAttrib()->editable);
|
||||
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 {
|
||||
addTag (root, t->nameToString (), t->valueToString (), t->getAttrib() ? (t->getOwnMemory() ? t->getAttrib()->action : AC_SYSTEM) : AC_DONTWRITE, t->getAttrib() && t->getAttrib()->editable);
|
||||
} else {
|
||||
addTag (root, t->nameToString (), t->valueToString (), currAttrib ? (t->getOwnMemory() ? currAttrib->action : AC_SYSTEM) : AC_DONTWRITE, currAttrib && currAttrib->editable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,6 +532,12 @@ void ExifPanel::addPressed ()
|
||||
delete hb2;
|
||||
}
|
||||
|
||||
void ExifPanel::showAlltoggled ()
|
||||
{
|
||||
options.lastShowAllExif = showAll->get_active();
|
||||
setImageData (idata);
|
||||
}
|
||||
|
||||
void ExifPanel::editTag (Gtk::TreeModel::Children root, Glib::ustring name, Glib::ustring value)
|
||||
{
|
||||
|
||||
@@ -541,8 +573,9 @@ void ExifPanel::editTag (Gtk::TreeModel::Children root, Glib::ustring name, Glib
|
||||
}
|
||||
}
|
||||
|
||||
if (iter == root.end())
|
||||
if (iter == root.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dp == Glib::ustring::npos) {
|
||||
if (value == "#keep" && iter->get_value (exifColumns.action) != AC_SYSTEM) {
|
||||
@@ -664,8 +697,7 @@ void ExifPanel::row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewCo
|
||||
exifTree->collapse_row (path);
|
||||
} else {
|
||||
exifTree->expand_row (path, false);
|
||||
}
|
||||
else if (iter->get_value (exifColumns.editable)) {
|
||||
} else if (iter->get_value (exifColumns.editable)) {
|
||||
addPressed ();
|
||||
}
|
||||
}
|
||||
|
@@ -73,11 +73,12 @@ private:
|
||||
Gtk::Button* add;
|
||||
Gtk::Button* reset;
|
||||
Gtk::Button* resetAll;
|
||||
Gtk::ToggleButton* showAll;
|
||||
|
||||
Gtk::TreeModel::Children addTag (const Gtk::TreeModel::Children& root, Glib::ustring field, Glib::ustring value, rtexif::ActionCode action, bool editable);
|
||||
void editTag (Gtk::TreeModel::Children root, Glib::ustring name, Glib::ustring value);
|
||||
void updateChangeList (Gtk::TreeModel::Children root, std::string prefix);
|
||||
void addDirectory (const rtexif::TagDirectory* dir, Gtk::TreeModel::Children root);
|
||||
void addDirectory (const rtexif::TagDirectory* dir, Gtk::TreeModel::Children root, bool checkForSeparator = false);
|
||||
Gtk::TreeModel::Children addSeparator();
|
||||
Glib::ustring getSelection (bool onlyifeditable = false);
|
||||
Glib::ustring getSelectedValue();
|
||||
@@ -86,6 +87,13 @@ private:
|
||||
void keepIt (Gtk::TreeModel::iterator iter);
|
||||
void delIt (Gtk::TreeModel::iterator iter);
|
||||
Gtk::TreeModel::iterator resetIt (Gtk::TreeModel::iterator iter);
|
||||
void removePressed();
|
||||
void keepPressed();
|
||||
void resetPressed();
|
||||
void resetAllPressed();
|
||||
void addPressed();
|
||||
void showAlltoggled();
|
||||
|
||||
public:
|
||||
ExifPanel ();
|
||||
virtual ~ExifPanel();
|
||||
@@ -97,11 +105,6 @@ public:
|
||||
void setImageData (const rtengine::FramesMetaData* id);
|
||||
|
||||
void exifSelectionChanged();
|
||||
void removePressed ();
|
||||
void keepPressed ();
|
||||
void resetPressed ();
|
||||
void resetAllPressed ();
|
||||
void addPressed ();
|
||||
void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
|
||||
|
||||
void notifyListener();
|
||||
|
@@ -354,6 +354,7 @@ void Options::setDefaults ()
|
||||
CPFontFamily = "default";
|
||||
CPFontSize = 8;
|
||||
lastScale = 5;
|
||||
lastShowAllExif = false;
|
||||
panAccelFactor = 5;
|
||||
rememberZoomAndPan = true;
|
||||
lastCropSize = 1;
|
||||
@@ -1390,6 +1391,10 @@ void Options::readFromFile (Glib::ustring fname)
|
||||
lastScale = keyFile.get_integer ("GUI", "LastPreviewScale");
|
||||
}
|
||||
|
||||
if (keyFile.has_key ("GUI", "LastShowAllExif")) {
|
||||
lastShowAllExif = keyFile.get_boolean ("GUI", "LastShowAllExif");
|
||||
}
|
||||
|
||||
if (keyFile.has_key ("GUI", "PanAccelFactor")) {
|
||||
panAccelFactor = keyFile.get_integer ("GUI", "PanAccelFactor");
|
||||
}
|
||||
@@ -2105,6 +2110,7 @@ void Options::saveToFile (Glib::ustring fname)
|
||||
keyFile.set_string ("GUI", "CPFontFamily", CPFontFamily);
|
||||
keyFile.set_integer ("GUI", "CPFontSize", CPFontSize);
|
||||
keyFile.set_integer ("GUI", "LastPreviewScale", lastScale);
|
||||
keyFile.set_boolean ("GUI", "LastShowAllExif", lastShowAllExif);
|
||||
keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor);
|
||||
keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan);
|
||||
keyFile.set_integer ("GUI", "LastCropSize", lastCropSize);
|
||||
|
@@ -168,6 +168,7 @@ public:
|
||||
int dirBrowserHeight;
|
||||
int preferencesWidth;
|
||||
int preferencesHeight;
|
||||
bool lastShowAllExif;
|
||||
int lastScale;
|
||||
int panAccelFactor;
|
||||
int lastCropSize;
|
||||
|
Reference in New Issue
Block a user