"Fossies" - the Fresh Open Source Software Archive

Member "rawtherapee-5.7/rtgui/metadatapanel.cc" (10 Sep 2019, 3728 Bytes) of package /linux/misc/rawtherapee-5.7.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "metadatapanel.cc" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.6_vs_5.7.

    1 /** -*- C++ -*-
    2  *  
    3  *  This file is part of RawTherapee.
    4  *
    5  *  Copyright (c) 2017 Alberto Griggio <alberto.griggio@gmail.com>
    6  *
    7  *  RawTherapee is free software: you can redistribute it and/or modify
    8  *  it under the terms of the GNU General Public License as published by
    9  *  the Free Software Foundation, either version 3 of the License, or
   10  *  (at your option) any later version.
   11  *
   12  *  RawTherapee is distributed in the hope that it will be useful,
   13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15  *  GNU General Public License for more details.
   16  *
   17  *  You should have received a copy of the GNU General Public License
   18  *  along with RawTherapee.  If not, see <https://www.gnu.org/licenses/>.
   19  */
   20 
   21 #include "metadatapanel.h"
   22 #include "eventmapper.h"
   23 #include "../rtengine/procparams.h"
   24 
   25 using namespace rtengine;
   26 using namespace rtengine::procparams;
   27 
   28 
   29 MetaDataPanel::MetaDataPanel() : EvMetaDataMode(ProcEventMapper::getInstance()->newEvent(M_VOID, "HISTORY_MSG_METADATA_MODE"))
   30 {
   31 
   32     Gtk::HBox *box = Gtk::manage(new Gtk::HBox());
   33     box->pack_start(*Gtk::manage(new Gtk::Label(M("TP_METADATA_MODE") + ": ")), Gtk::PACK_SHRINK, 4);
   34     metadataMode = Gtk::manage(new MyComboBoxText());
   35     metadataMode->append(M("TP_METADATA_TUNNEL"));
   36     metadataMode->append(M("TP_METADATA_EDIT"));
   37     metadataMode->append(M("TP_METADATA_STRIP"));
   38     metadataMode->set_active(0);
   39     box->pack_end(*metadataMode, Gtk::PACK_EXPAND_WIDGET, 4);
   40     pack_start(*box, Gtk::PACK_SHRINK, 4);
   41 
   42     metadataMode->signal_changed().connect(sigc::mem_fun(*this, &MetaDataPanel::metaDataModeChanged));
   43 
   44     tagsNotebook = Gtk::manage(new Gtk::Notebook());
   45     exifpanel = new ExifPanel();
   46     iptcpanel = new IPTCPanel();
   47     tagsNotebook->set_name("MetaPanelNotebook");
   48     tagsNotebook->append_page(*exifpanel, M("MAIN_TAB_EXIF"));
   49     tagsNotebook->append_page(*iptcpanel, M("MAIN_TAB_IPTC"));
   50 
   51     pack_end(*tagsNotebook);
   52 }
   53 
   54 
   55 MetaDataPanel::~MetaDataPanel()
   56 {
   57     delete iptcpanel;
   58     delete exifpanel;
   59 }
   60 
   61 
   62 void MetaDataPanel::setBatchMode(bool batchMode)
   63 {
   64     ToolPanel::setBatchMode(batchMode);
   65     metadataMode->append(M("GENERAL_UNCHANGED"));
   66     tagsNotebook->remove_page(-1);
   67     tagsNotebook->remove_page(-1);
   68 }
   69 
   70 
   71 void MetaDataPanel::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
   72 {
   73     disableListener();
   74     metadataMode->set_active(int(pp->metadata.mode));
   75     if (pedited) {
   76         if (!pedited->metadata.mode) {
   77             metadataMode->set_active(3);
   78         }
   79     }
   80 
   81     exifpanel->read(pp, pedited);
   82     iptcpanel->read(pp, pedited);
   83     
   84     enableListener();
   85 }
   86 
   87 
   88 void MetaDataPanel::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
   89 {
   90     pp->metadata.mode = static_cast<MetaDataParams::Mode>(min(metadataMode->get_active_row_number(), 2));
   91     
   92     if (pedited) {
   93         pedited->metadata.mode = metadataMode->get_active_row_number() != 3;
   94     }
   95 
   96     exifpanel->write(pp, pedited);
   97     iptcpanel->write(pp, pedited);
   98 }
   99 
  100 
  101 void MetaDataPanel::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
  102 {
  103     exifpanel->setDefaults(defParams, pedited);
  104     iptcpanel->setDefaults(defParams, pedited);
  105 }
  106 
  107 
  108 void MetaDataPanel::setImageData(const rtengine::FramesMetaData* id)
  109 {
  110     exifpanel->setImageData(id);
  111     iptcpanel->setImageData(id);
  112 }
  113 
  114 
  115 void MetaDataPanel::setListener(ToolPanelListener *tpl)
  116 {
  117     ToolPanel::setListener(tpl);
  118     exifpanel->setListener(tpl);
  119     iptcpanel->setListener(tpl);
  120 }
  121 
  122 
  123 void MetaDataPanel::metaDataModeChanged()
  124 {
  125     if (listener) {
  126         listener->panelChanged(EvMetaDataMode, M("HISTORY_CHANGED"));
  127     }
  128 }