From b589254d2142de3bb0e43be26b542fa670c4aa9b Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 29 Dec 2017 23:03:44 +0100 Subject: [PATCH] Moved "Copy metadata unchanged" to PP3, and added "strip metadata" mode Fixes #3647 --- rtdata/languages/default | 5 ++ rtengine/procparams.cc | 30 ++++++++++ rtengine/procparams.h | 20 +++++++ rtengine/rtengine.h | 7 +-- rtengine/simpleprocess.cc | 26 ++++---- rtgui/CMakeLists.txt | 1 + rtgui/batchqueue.cc | 2 +- rtgui/editorpanel.cc | 6 +- rtgui/main-cli.cc | 2 +- rtgui/metadatapanel.cc | 121 ++++++++++++++++++++++++++++++++++++++ rtgui/metadatapanel.h | 48 +++++++++++++++ rtgui/options.cc | 6 -- rtgui/options.h | 1 - rtgui/paramsedited.cc | 5 ++ rtgui/paramsedited.h | 8 +++ rtgui/preferences.cc | 12 ---- rtgui/preferences.h | 1 - rtgui/toolpanelcoord.cc | 35 +++-------- rtgui/toolpanelcoord.h | 7 +-- 19 files changed, 270 insertions(+), 73 deletions(-) create mode 100644 rtgui/metadatapanel.cc create mode 100644 rtgui/metadatapanel.h diff --git a/rtdata/languages/default b/rtdata/languages/default index f4361fc5d..1f7f43e07 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -730,6 +730,7 @@ HISTORY_MSG_LOCALCONTRAST_DARKNESS;Local Contrast - Darkness HISTORY_MSG_LOCALCONTRAST_ENABLED;Local Contrast HISTORY_MSG_LOCALCONTRAST_LIGHTNESS;Local Contrast - Lightness HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius +HISTORY_MSG_METADATA_MODE;Metadata copy mode HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -1690,6 +1691,10 @@ TP_LOCALCONTRAST_DARKNESS;Darkness level TP_LOCALCONTRAST_LABEL;Local Contrast TP_LOCALCONTRAST_LIGHTNESS;Lightness level TP_LOCALCONTRAST_RADIUS;Radius +TP_METADATA_MODE;Metadata copy mode +TP_METADATA_TUNNEL;Copy unchanged +TP_METADATA_EDIT;Apply modifications +TP_METADATA_STRIP;Strip all metadata TP_NEUTRAL;Reset TP_NEUTRAL_TIP;Resets exposure sliders to neutral values.\nApplies to the same controls that Auto Levels applies to, regardless of whether you used Auto Levels or not. TP_PCVIGNETTE_FEATHER;Feather diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 5e8fa63cf..97b54e37f 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2604,6 +2604,23 @@ Glib::ustring RAWParams::getFlatFieldBlurTypeString(FlatFieldBlurType type) return getFlatFieldBlurTypeStrings()[toUnderlying(type)]; } + +MetaDataParams::MetaDataParams(): + mode(MetaDataParams::TUNNEL) +{ +} + +bool MetaDataParams::operator==(const MetaDataParams &other) const +{ + return mode == other.mode; +} + +bool MetaDataParams::operator!=(const MetaDataParams &other) const +{ + return !(*this == other); +} + + ProcParams::ProcParams () { setDefaults (); @@ -2692,6 +2709,7 @@ void ProcParams::setDefaults () raw = RAWParams(); + metadata = MetaDataParams(); exif.clear (); iptc.clear (); @@ -3389,6 +3407,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos, keyFile); saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser, keyFile); +// MetaData + saveToKeyfile(!pedited || pedited->metadata.mode, "MetaData", "Mode", metadata.mode, keyFile); + // EXIF change list if (!pedited || pedited->exif) { for (ExifPairs::const_iterator i = exif.begin(); i != exif.end(); ++i) { @@ -4704,6 +4725,14 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackBlue", pedited, raw.xtranssensor.blackblue, pedited->raw.xtranssensor.exBlackBlue); } + if (keyFile.has_group("MetaData")) { + int mode = int(MetaDataParams::TUNNEL); + assignFromKeyfile(keyFile, "MetaData", "Mode", pedited, mode, pedited->metadata.mode); + if (mode >= int(MetaDataParams::TUNNEL) && mode <= int(MetaDataParams::STRIP)) { + metadata.mode = static_cast(mode); + } + } + if (keyFile.has_group ("Exif")) { std::vector keys = keyFile.get_keys ("Exif"); @@ -4815,6 +4844,7 @@ bool ProcParams::operator ==(const ProcParams& other) const && filmSimulation == other.filmSimulation && rgbCurves == other.rgbCurves && colorToning == other.colorToning + && metadata == other.metadata && exif == other.exif && iptc == other.iptc; } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index cd47f31a2..58cc2cdfc 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1024,6 +1024,25 @@ struct ColorManagementParams { bool operator !=(const ColorManagementParams& other) const; }; + +/** + * Parameters for metadata handling + */ +struct MetaDataParams { + enum Mode { + TUNNEL, + EDIT, + STRIP + }; + Mode mode; + + MetaDataParams(); + + bool operator ==(const MetaDataParams &other) const; + bool operator !=(const MetaDataParams &other) const; +}; + + /** * Typedef for representing a key/value for the exif metadata information */ @@ -1400,6 +1419,7 @@ public: Glib::ustring appVersion; ///< Version of the application that generated the parameters int ppVersion; ///< Version of the PP file from which the parameters have been read + MetaDataParams metadata; ///< Metadata parameters ExifPairs exif; ///< List of modifications appplied on the exif tags of the input image IPTCPairs iptc; ///< The IPTC tags and values to be saved to the output image diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index f7bdc36cb..8e24b7bb9 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -533,9 +533,8 @@ public: * @param job the ProcessingJob to cancel. * @param errorCode is the error code if an error occured (e.g. the input image could not be loaded etc.) * @param pl is an optional ProgressListener if you want to keep track of the progress - * @param tunnelMetaData tunnels IPTC and XMP to output without change * @return the resulting image, with the output profile applied, exif and iptc data set. You have to save it or you can access the pixel data directly. */ -IImage16* processImage (ProcessingJob* job, int& errorCode, ProgressListener* pl = nullptr, bool tunnelMetaData = false, bool flush = false); +IImage16* processImage (ProcessingJob* job, int& errorCode, ProgressListener* pl = nullptr, bool flush = false); /** This class is used to control the batch processing. The class implementing this interface will be called when the full processing of an * image is ready and the next job to process is needed. */ @@ -555,8 +554,8 @@ public: * The ProcessingJob passed becomes invalid, you can not use it any more. * @param job the ProcessingJob to cancel. * @param bpl is the BatchProcessingListener that is called when the image is ready or the next job is needed. It also acts as a ProgressListener. - * @param tunnelMetaData tunnels IPTC and XMP to output without change */ -void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData); + **/ +void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl); extern MyMutex* lcmsMutex; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c6d10f996..9f79153f7 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -50,11 +50,10 @@ class ImageProcessor { public: ImageProcessor (ProcessingJob* pjob, int& errorCode, - ProgressListener* pl, bool tunnelMetaData, bool flush): + ProgressListener* pl, bool flush): job (static_cast (pjob)), errorCode (errorCode), pl (pl), - tunnelMetaData (tunnelMetaData), flush (flush), // internal state ipf_p (nullptr), @@ -1289,13 +1288,19 @@ private: readyImg = tempImage; } - if (tunnelMetaData) { + switch (params.metadata.mode) { + case MetaDataParams::TUNNEL: // Sending back the whole first root, which won't necessarily be the selected frame number // and may contain subframe depending on initial raw's hierarchy readyImg->setMetadata (ii->getMetaData()->getRootExifData ()); - } else { + break; + case MetaDataParams::EDIT: // ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy readyImg->setMetadata (ii->getMetaData()->getBestExifData(imgsrc, ¶ms.raw), params.exif, params.iptc); + break; + default: // case MetaDataParams::STRIP + // nothing to do + break; } @@ -1490,7 +1495,6 @@ private: ProcessingJobImpl* job; int& errorCode; ProgressListener* pl; - bool tunnelMetaData; bool flush; // internal state @@ -1564,20 +1568,20 @@ private: } // namespace -IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool tunnelMetaData, bool flush) +IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool flush) { - ImageProcessor proc (pjob, errorCode, pl, tunnelMetaData, flush); + ImageProcessor proc (pjob, errorCode, pl, flush); return proc(); } -void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) +void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) { ProcessingJob* currentJob = job; while (currentJob) { int errorCode; - IImage16* img = processImage (currentJob, errorCode, bpl, tunnelMetaData, true); + IImage16* img = processImage (currentJob, errorCode, bpl, true); if (errorCode) { bpl->error (M ("MAIN_MSG_CANNOTLOAD")); @@ -1593,11 +1597,11 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bo } } -void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) +void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) { if (bpl) { - Glib::Thread::create (sigc::bind (sigc::ptr_fun (batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_LOW); + Glib::Thread::create (sigc::bind (sigc::ptr_fun (batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW); } } diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index 222ee2550..f5a20b88a 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -150,6 +150,7 @@ set(NONCLISOURCEFILES fattaltonemap.cc localcontrast.cc eventmapper.cc + metadatapanel.cc ) include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 43ee5d79d..6b04ed0ae 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -572,7 +572,7 @@ void BatchQueue::startProcessing () next->removeButtonSet (); // start batch processing - rtengine::startBatchProcessing (next->job, this, options.tunnelMetaData); + rtengine::startBatchProcessing (next->job, this); queue_draw (); } } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index e86b7d9ab..643803075 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1938,7 +1938,7 @@ void EditorPanel::saveAsPressed () rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams); ProgressConnector *ld = new ProgressConnector(); - ld->startFunc (sigc::bind (sigc::ptr_fun (&rtengine::processImage), job, err, parent->getProgressListener(), options.tunnelMetaData, false ), + ld->startFunc (sigc::bind (sigc::ptr_fun (&rtengine::processImage), job, err, parent->getProgressListener(), false ), sigc::bind (sigc::mem_fun ( *this, &EditorPanel::idle_saveImage ), ld, fnameOut, sf, pparams)); saveimgas->set_sensitive (false); sendtogimp->set_sensitive (false); @@ -1982,7 +1982,7 @@ void EditorPanel::sendToGimpPressed () ipc->getParams (&pparams); rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams); ProgressConnector *ld = new ProgressConnector(); - ld->startFunc (sigc::bind (sigc::ptr_fun (&rtengine::processImage), job, err, parent->getProgressListener(), options.tunnelMetaData, false ), + ld->startFunc (sigc::bind (sigc::ptr_fun (&rtengine::processImage), job, err, parent->getProgressListener(), false ), sigc::bind (sigc::mem_fun ( *this, &EditorPanel::idle_sendToGimp ), ld, openThm->getFileName() )); saveimgas->set_sensitive (false); sendtogimp->set_sensitive (false); @@ -1996,7 +1996,7 @@ bool EditorPanel::saveImmediately (const Glib::ustring &filename, const SaveForm rtengine::ProcessingJob *job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams); // save immediately - rtengine::IImage16 *img = rtengine::processImage (job, err, nullptr, options.tunnelMetaData, false); + rtengine::IImage16 *img = rtengine::processImage (job, err, nullptr, false); int err = 0; diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index 1d1917e8c..870f90940 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -822,7 +822,7 @@ int processLineParams ( int argc, char **argv ) } // Process image - rtengine::IImage16* resultImage = rtengine::processImage (job, errorCode, nullptr, options.tunnelMetaData); + rtengine::IImage16* resultImage = rtengine::processImage (job, errorCode, nullptr); if ( !resultImage ) { errors++; diff --git a/rtgui/metadatapanel.cc b/rtgui/metadatapanel.cc new file mode 100644 index 000000000..8d5ae158a --- /dev/null +++ b/rtgui/metadatapanel.cc @@ -0,0 +1,121 @@ +/** -*- C++ -*- + * + * This file is part of RawTherapee. + * + * Copyright (c) 2017 Alberto Griggio + * + * RawTherapee is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RawTherapee is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RawTherapee. If not, see . + */ + +#include "metadatapanel.h" +#include "eventmapper.h" +#include "../rtengine/procparams.h" + +using namespace rtengine; +using namespace rtengine::procparams; + + +MetaDataPanel::MetaDataPanel() +{ + EvMetaDataMode = ProcEventMapper::getInstance()->newEvent(M_VOID, "HISTORY_MSG_METADATA_MODE"); + + Gtk::HBox *box = Gtk::manage(new Gtk::HBox()); + box->pack_start(*Gtk::manage(new Gtk::Label(M("TP_METADATA_MODE") + ": ")), Gtk::PACK_SHRINK, 4); + metadataMode = Gtk::manage(new MyComboBoxText()); + metadataMode->append(M("TP_METADATA_TUNNEL")); + metadataMode->append(M("TP_METADATA_EDIT")); + metadataMode->append(M("TP_METADATA_STRIP")); + metadataMode->set_active(0); + box->pack_end(*metadataMode, Gtk::PACK_EXPAND_WIDGET, 4); + pack_start(*box, Gtk::PACK_SHRINK, 4); + + metadataMode->signal_changed().connect(sigc::mem_fun(*this, &MetaDataPanel::metaDataModeChanged)); + + tagsNotebook = Gtk::manage(new Gtk::Notebook()); + exifpanel = Gtk::manage(new ExifPanel()); + iptcpanel = Gtk::manage(new IPTCPanel()); + tagsNotebook->set_name("MetaPanelNotebook"); + tagsNotebook->append_page(*exifpanel, M("MAIN_TAB_EXIF")); + tagsNotebook->append_page(*iptcpanel, M("MAIN_TAB_IPTC")); + + pack_end(*tagsNotebook); +} + + +void MetaDataPanel::setBatchMode(bool batchMode) +{ + ToolPanel::setBatchMode(batchMode); + metadataMode->append(M("GENERAL_UNCHANGED")); + tagsNotebook->remove_page(-1); + tagsNotebook->remove_page(-1); +} + + +void MetaDataPanel::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) +{ + disableListener(); + metadataMode->set_active(int(pp->metadata.mode)); + if (pedited) { + if (!pedited->metadata.mode) { + metadataMode->set_active(3); + } + } + + exifpanel->read(pp, pedited); + iptcpanel->read(pp, pedited); + + enableListener(); +} + + +void MetaDataPanel::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) +{ + pp->metadata.mode = static_cast(max(metadataMode->get_active_row_number(), 2)); + if (pedited) { + pedited->metadata.mode = metadataMode->get_active_row_number() != 3; + } + + exifpanel->write(pp, pedited); + iptcpanel->write(pp, pedited); +} + + +void MetaDataPanel::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) +{ + exifpanel->setDefaults(defParams, pedited); + iptcpanel->setDefaults(defParams, pedited); +} + + +void MetaDataPanel::setImageData(const rtengine::FramesMetaData* id) +{ + exifpanel->setImageData(id); + iptcpanel->setImageData(id); +} + + +void MetaDataPanel::setListener(ToolPanelListener *tpl) +{ + ToolPanel::setListener(tpl); + exifpanel->setListener(tpl); + iptcpanel->setListener(tpl); +} + + +void MetaDataPanel::metaDataModeChanged() +{ + if (listener) { + listener->panelChanged(EvMetaDataMode, M("HISTORY_CHANGED")); + } +} diff --git a/rtgui/metadatapanel.h b/rtgui/metadatapanel.h new file mode 100644 index 000000000..d0a649a86 --- /dev/null +++ b/rtgui/metadatapanel.h @@ -0,0 +1,48 @@ +/** -*- C++ -*- + * + * This file is part of RawTherapee. + * + * Copyright (c) 2017 Alberto Griggio + * + * RawTherapee is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RawTherapee is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RawTherapee. If not, see . + */ +#pragma once + +#include +#include "toolpanel.h" +#include "exifpanel.h" +#include "iptcpanel.h" + +class MetaDataPanel: public Gtk::VBox, public ToolPanel { +private: + rtengine::ProcEvent EvMetaDataMode; + MyComboBoxText *metadataMode; + Gtk::Notebook *tagsNotebook; + ExifPanel *exifpanel; + IPTCPanel *iptcpanel; + + void metaDataModeChanged(); + +public: + MetaDataPanel(); + + void setBatchMode(bool batchMode); + void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr); + void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr); + void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr); + + void setImageData(const rtengine::FramesMetaData* id); + void setListener(ToolPanelListener *tpl); +}; + diff --git a/rtgui/options.cc b/rtgui/options.cc index 031678ddd..127ea990f 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -426,7 +426,6 @@ void Options::setDefaults () tabbedUI = false; mainNBVertical = true; multiDisplayMode = 0; - tunnelMetaData = true; histogramPosition = 1; histogramBar = true; histogramFullMode = false; @@ -868,10 +867,6 @@ void Options::readFromFile (Glib::ustring fname) if (keyFile.has_key ("Output", "OverwriteOutputFile")) { overwriteOutputFile = keyFile.get_boolean ("Output", "OverwriteOutputFile"); } - - if (keyFile.has_key ("Output", "TunnelMetaData")) { - tunnelMetaData = keyFile.get_boolean ("Output", "TunnelMetaData"); - } } if (keyFile.has_group ("Profiles")) { @@ -1942,7 +1937,6 @@ void Options::saveToFile (Glib::ustring fname) keyFile.set_boolean ("Output", "UsePathTemplate", saveUsePathTemplate); keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath); keyFile.set_boolean ("Output", "OverwriteOutputFile", overwriteOutputFile); - keyFile.set_boolean ("Output", "TunnelMetaData", tunnelMetaData); keyFile.set_string ("Profiles", "Directory", profilePath); keyFile.set_boolean ("Profiles", "UseBundledProfiles", useBundledProfiles); diff --git a/rtgui/options.h b/rtgui/options.h index 947d3b615..feeca7983 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -249,7 +249,6 @@ public: double sndLngEditProcDoneSecs; // Minimum processing time seconds till the sound is played bool sndEnable; - bool tunnelMetaData; // Pass through IPTC and XMP unchanged int histogramPosition; // 0=disabled, 1=left pane, 2=right pane //int histogramWorking; // 0=disabled, 1=left pane, 2=right pane bool histogramBar; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 977d7ff3a..fc302299c 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -563,6 +563,7 @@ void ParamsEdited::set (bool v) filmSimulation.enabled = v; filmSimulation.clutFilename = v; filmSimulation.strength = v; + metadata.mode = v; exif = v; iptc = v; @@ -1112,6 +1113,7 @@ void ParamsEdited::initFrom (const std::vector filmSimulation.enabled = filmSimulation.enabled && p.filmSimulation.enabled == other.filmSimulation.enabled; filmSimulation.clutFilename = filmSimulation.clutFilename && p.filmSimulation.clutFilename == other.filmSimulation.clutFilename; filmSimulation.strength = filmSimulation.strength && p.filmSimulation.strength == other.filmSimulation.strength; + metadata.mode = metadata.mode && p.metadata.mode == other.metadata.mode; // How the hell can we handle that??? // exif = exif && p.exif==other.exif @@ -3090,6 +3092,9 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.filmSimulation.strength = dontforceSet && options.baBehav[ADDSET_FILMSIMULATION_STRENGTH] ? toEdit.filmSimulation.strength + mods.filmSimulation.strength : mods.filmSimulation.strength; } + if (metadata.mode) { + toEdit.metadata.mode = mods.metadata.mode; + } // Exif changes are added to the existing ones if (exif) diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 9c4e97a64..5a835bf05 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -797,6 +797,13 @@ public: bool isUnchanged() const; }; + +class MetaDataParamsEdited { +public: + bool mode; +}; + + class ParamsEdited { @@ -845,6 +852,7 @@ public: WaveletParamsEdited wavelet; HSVEqualizerParamsEdited hsvequalizer; FilmSimulationParamsEdited filmSimulation; + MetaDataParamsEdited metadata; bool exif; bool iptc; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 0f082c70c..b53e884f5 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -582,14 +582,6 @@ Gtk::Widget* Preferences::getProcParamsPanel () cdf->add(*dirgrid); mvbpp->pack_start (*cdf, Gtk::PACK_SHRINK, 4 ); - // Metadata - Gtk::Frame* fmd = Gtk::manage (new Gtk::Frame (M ("PREFERENCES_METADATA"))); - Gtk::VBox* vbmd = Gtk::manage (new Gtk::VBox ()); - ckbTunnelMetaData = Gtk::manage (new Gtk::CheckButton (M ("PREFERENCES_TUNNELMETADATA"))); - vbmd->pack_start (*ckbTunnelMetaData, Gtk::PACK_SHRINK, 4); - fmd->add (*vbmd); - mvbpp->pack_start (*fmd, Gtk::PACK_SHRINK, 4); - return mvbpp; } @@ -1810,8 +1802,6 @@ void Preferences::storePreferences () moptions.paramsLoadLocation = (PPLoadLocation)loadParamsPreference->get_active_row_number (); moptions.useBundledProfiles = useBundledProfiles->get_active (); - moptions.tunnelMetaData = ckbTunnelMetaData->get_active (); - moptions.rtSettings.darkFramesPath = darkFrameDir->get_filename(); moptions.rtSettings.flatFieldsPath = flatFieldDir->get_filename(); @@ -2039,8 +2029,6 @@ void Preferences::fillPreferences () loadParamsPreference->set_active (moptions.paramsLoadLocation); useBundledProfiles->set_active (moptions.useBundledProfiles); - ckbTunnelMetaData->set_active (moptions.tunnelMetaData); - if (!moptions.tabbedUI) { editorLayout->set_active (moptions.mainNBVertical ? 1 : 0); } else { diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 70cef4bee..7ce592457 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -188,7 +188,6 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener Gtk::Entry* txtSndLngEditProcDone; Gtk::SpinButton* spbSndLngEditProcDoneSecs; - Gtk::CheckButton* ckbTunnelMetaData; Gtk::CheckButton* ckbInternalThumbIfUntouched; Gtk::Entry* txtCustProfBuilderPath; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 318ebf55b..7726f9a5e 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -71,10 +71,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan prsharpening = Gtk::manage (new PrSharpening()); crop = Gtk::manage (new Crop ()); icm = Gtk::manage (new ICMPanel ()); - if(!batch) { - exifpanel = Gtk::manage (new ExifPanel ()); - iptcpanel = Gtk::manage (new IPTCPanel ()); - } + metadata = Gtk::manage(new MetaDataPanel()); wavelet = Gtk::manage (new Wavelet ()); dirpyrequalizer = Gtk::manage (new DirPyrEqualizer ()); hsvequalizer = Gtk::manage (new HSVEqualizer ()); @@ -153,17 +150,8 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan addPanel (rawPanel, flatfield); toolPanels.push_back (coarse); + toolPanels.push_back(metadata); - if(!batch) { - toolPanels.push_back (exifpanel); - toolPanels.push_back (iptcpanel); - metadataPanel = Gtk::manage (new Gtk::Notebook ()); - metadataPanel->set_name ("MetaPanelNotebook"); - metadataPanel->append_page (*exifpanel, M ("MAIN_TAB_EXIF")); - metadataPanel->append_page (*iptcpanel, M ("MAIN_TAB_IPTC")); - } else { - metadataPanel = nullptr; - } toolPanelNotebook = new Gtk::Notebook (); toolPanelNotebook->set_name ("ToolPanelNotebook"); @@ -219,11 +207,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan toiW = Gtk::manage (new TextOrIcon ("wavelet.png", M ("MAIN_TAB_WAVELET"), M ("MAIN_TAB_WAVELET_TOOLTIP"), type)); toiT = Gtk::manage (new TextOrIcon ("transform.png", M ("MAIN_TAB_TRANSFORM"), M ("MAIN_TAB_TRANSFORM_TOOLTIP"), type)); toiR = Gtk::manage (new TextOrIcon ("raw.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP"), type)); - if(!batch) { - toiM = Gtk::manage (new TextOrIcon ("meta.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP"), type)); - } else { - toiM = nullptr; - } + toiM = Gtk::manage (new TextOrIcon ("meta.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP"), type)); toolPanelNotebook->append_page (*exposurePanelSW, *toiE); toolPanelNotebook->append_page (*detailsPanelSW, *toiD); @@ -231,9 +215,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan toolPanelNotebook->append_page (*waveletPanelSW, *toiW); toolPanelNotebook->append_page (*transformPanelSW, *toiT); toolPanelNotebook->append_page (*rawPanelSW, *toiR); - if(!batch) { - toolPanelNotebook->append_page (*metadataPanel, *toiM); - } + toolPanelNotebook->append_page (*metadata, *toiM); toolPanelNotebook->set_current_page (0); @@ -483,8 +465,7 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool if (ipc) { const rtengine::FramesMetaData* pMetaData = ipc->getInitialImage()->getMetaData(); - exifpanel->setImageData (pMetaData); - iptcpanel->setImageData (pMetaData); + metadata->setImageData(pMetaData); ipc->setAutoExpListener (toneCurve); ipc->setAutoCamListener (colorappearance); @@ -824,10 +805,8 @@ bool ToolPanelCoordinator::handleShortcutKey (GdkEventKey* event) return true; case GDK_KEY_m: - if (metadataPanel) { - toolPanelNotebook->set_current_page (toolPanelNotebook->page_num (*metadataPanel)); - return true; - } + toolPanelNotebook->set_current_page (toolPanelNotebook->page_num (*metadata)); + return true; } } diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 7c4b94ed9..11f6dfc0a 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -38,8 +38,7 @@ #include "epd.h" #include "sharpening.h" #include "labcurve.h" -#include "exifpanel.h" -#include "iptcpanel.h" +#include "metadatapanel.h" #include "crop.h" #include "icmpanel.h" #include "resize.h" @@ -149,6 +148,7 @@ protected: BayerRAWExposure* bayerrawexposure; XTransRAWExposure* xtransrawexposure; FattalToneMapping *fattal; + MetaDataPanel* metadata; std::vector paramcListeners; @@ -161,9 +161,6 @@ protected: ToolVBox* transformPanel; ToolVBox* rawPanel; ToolVBox* waveletPanel; - Gtk::Notebook* metadataPanel; - ExifPanel* exifpanel; - IPTCPanel* iptcpanel; ToolBar* toolBar; TextOrIcon* toiE;