1 /* 2 * This file is part of RawTherapee. 3 * 4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> 5 * 6 * RawTherapee is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * RawTherapee is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 #pragma once 20 21 #include <memory> 22 23 #include <gtkmm.h> 24 25 #include "toolpanel.h" 26 #include "../rtexif/rtexif.h" 27 28 class ExifPanel : 29 public Gtk::VBox, 30 public ToolPanel 31 { 32 33 private: 34 const rtengine::FramesMetaData* idata; 35 const std::unique_ptr<rtengine::procparams::ExifPairs> changeList; 36 const std::unique_ptr<rtengine::procparams::ExifPairs> defChangeList; 37 bool recursiveOp; 38 39 class ExifColumns : public Gtk::TreeModelColumnRecord 40 { 41 public: 42 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon; 43 Gtk::TreeModelColumn<Glib::ustring> field; 44 Gtk::TreeModelColumn<Glib::ustring> field_nopango; 45 Gtk::TreeModelColumn<Glib::ustring> value; 46 Gtk::TreeModelColumn<Glib::ustring> value_nopango; 47 Gtk::TreeModelColumn<Glib::ustring> orig_value; 48 Gtk::TreeModelColumn<rtexif::ActionCode> action; 49 Gtk::TreeModelColumn<bool> editable; 50 Gtk::TreeModelColumn<bool> edited; 51 Gtk::TreeModelColumn<bool> isSeparator; 52 ExifColumns()53 ExifColumns() 54 { 55 add (field); 56 add (value); 57 add (icon); 58 add (action); 59 add (edited); 60 add (field_nopango); 61 add (value_nopango); 62 add (editable); 63 add (orig_value); 64 add (isSeparator); 65 } 66 }; 67 Glib::RefPtr<Gdk::Pixbuf> delicon; 68 Glib::RefPtr<Gdk::Pixbuf> keepicon; 69 Glib::RefPtr<Gdk::Pixbuf> editicon; 70 71 ExifColumns exifColumns; 72 Gtk::TreeView* exifTree; 73 Gtk::ScrolledWindow* scrolledWindow; 74 Glib::RefPtr<Gtk::TreeStore> exifTreeModel; 75 76 Gtk::Button* remove; 77 Gtk::Button* keep; 78 Gtk::Button* add; 79 Gtk::Button* reset; 80 Gtk::Button* resetAll; 81 Gtk::ToggleButton* showAll; 82 83 Gtk::TreeModel::Children addTag (const Gtk::TreeModel::Children& root, Glib::ustring field, Glib::ustring value, rtexif::ActionCode action, bool editable); 84 void editTag (Gtk::TreeModel::Children root, Glib::ustring name, Glib::ustring value); 85 void updateChangeList (Gtk::TreeModel::Children root, std::string prefix); 86 void addDirectory (const rtexif::TagDirectory* dir, Gtk::TreeModel::Children root, bool checkForSeparator = false); 87 Gtk::TreeModel::Children addSeparator(); 88 Glib::ustring getSelection (bool onlyifeditable = false); 89 Glib::ustring getSelectedValue(); 90 void updateChangeList(); 91 void applyChangeList(); 92 void keepIt (Gtk::TreeModel::iterator iter); 93 void delIt (Gtk::TreeModel::iterator iter); 94 Gtk::TreeModel::iterator resetIt (Gtk::TreeModel::iterator iter); 95 void removePressed(); 96 void keepPressed(); 97 void resetPressed(); 98 void resetAllPressed(); 99 void addPressed(); 100 void showAlltoggled(); 101 bool rowSeperatorFunc(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator& iter); 102 103 public: 104 ExifPanel (); 105 ~ExifPanel() override; 106 107 void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; 108 void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; 109 void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; 110 111 void setImageData (const rtengine::FramesMetaData* id); 112 113 void exifSelectionChanged(); 114 void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column); 115 116 void notifyListener(); 117 118 }; 119