From 818200522a0501395e2e48bdeff69152cbc7bb61 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 15 Sep 2017 20:11:49 +0200 Subject: [PATCH 1/3] Fix some inconsistencies in Profiled Lens Correction gui --- rtengine/dcrop.cc | 4 +- rtengine/improccoordinator.cc | 2 +- rtengine/iptransform.cc | 4 +- rtengine/procparams.cc | 43 +- rtengine/procparams.h | 46 +- rtengine/rawimagesource.cc | 2 +- rtengine/rtlensfun.cc | 4 +- rtgui/lensprofile.cc | 85 +- rtgui/lensprofile.h | 4 +- rtgui/options.cc.save-failed | 2508 +++++++++++++++++++++++++++++++++ rtgui/paramsedited.cc | 20 +- rtgui/paramsedited.h | 1 + rtgui/ppversion.h | 4 +- 13 files changed, 2627 insertions(+), 100 deletions(-) create mode 100644 rtgui/options.cc.save-failed diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 25710205f..0738e48b0 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1083,9 +1083,7 @@ bool check_need_larger_crop_for_lcp_distortion (int fw, int fh, int x, int y, in return false; } - return (params.lensProf.useDist && - (params.lensProf.useLensfun || - params.lensProf.lcpFile.length() > 0)); + return (params.lensProf.useDist && (params.lensProf.useLensfun() || params.lensProf.useLcp())); } } // namespace diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 2b9edc3d6..7e03ac909 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1120,7 +1120,7 @@ void ImProcCoordinator::getAutoCrop (double ratio, int &x, int &y, int &w, int & LensCorrection *pLCPMap = nullptr; - if (params.lensProf.lcpFile.length() && imgsrc->getMetaData()->getFocalLen() > 0) { + if (params.lensProf.useLcp() && imgsrc->getMetaData()->getFocalLen() > 0) { const std::shared_ptr pLCPProf = LCPStore::getInstance()->getProfile (params.lensProf.lcpFile); if (pLCPProf) pLCPMap = new LCPMapper (pLCPProf, imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index bfd01b301..1cafac7a9 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -1015,12 +1015,12 @@ bool ImProcFunctions::needsVignetting () bool ImProcFunctions::needsLCP () { - return params->lensProf.lcpFile.length() > 0 && !needsLensfun(); + return params->lensProf.useLcp(); } bool ImProcFunctions::needsLensfun() { - return params->lensProf.useLensfun; + return params->lensProf.useLensfun(); } bool ImProcFunctions::needsTransform () diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 29b2cce84..a18982325 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -52,6 +52,7 @@ const int br = (int) options.rtSettings.bot_right; const int tl = (int) options.rtSettings.top_left; const int bl = (int) options.rtSettings.bot_left; +const char *LensProfParams::methodstring[static_cast(LensProfParams::eLcMode::lcp) + 1u] = {"none", "lfauto", "lfmanual", "lcp"}; const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "fast", "mono", "none", "pixelshift" }; const char *RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::numMethods] = {"3-pass (best)", "1-pass (medium)", "fast", "mono", "none" }; @@ -919,11 +920,10 @@ void ToneCurveParams::setDefaults() void LensProfParams::setDefaults() { + lcMode = eLcMode::none; lcpFile = ""; useDist = useVign = true; useCA = false; - useLensfun = false; - lfAutoMatch = true; lfCameraMake = ""; lfCameraModel = ""; lfLens = ""; @@ -2554,6 +2554,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b } // lens profile + if (!pedited || pedited->lensProf.lcMode) { + keyFile.set_string ("LensProfile", "LcMode", lensProf.getMethodString (lensProf.lcMode)); + } + if (!pedited || pedited->lensProf.lcpFile) { keyFile.set_string ("LensProfile", "LCPFile", relativePathIfInside (fname, fnameAbsolute, lensProf.lcpFile)); } @@ -2570,12 +2574,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_boolean ("LensProfile", "UseCA", lensProf.useCA); } - if (!pedited || pedited->lensProf.useLensfun) { - keyFile.set_boolean("LensProfile", "UseLensfun", lensProf.useLensfun); - } - if (!pedited || pedited->lensProf.lfAutoMatch) { - keyFile.set_boolean("LensProfile", "LFAutoMatch", lensProf.lfAutoMatch); - } if (!pedited || pedited->lensProf.lfCameraMake) { keyFile.set_string("LensProfile", "LFCameraMake", lensProf.lfCameraMake); } @@ -5822,12 +5820,24 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) // lens profile if (keyFile.has_group ("LensProfile")) { + if (keyFile.has_key ("LensProfile", "LcMode")) { + lensProf.lcMode = lensProf.getMethodNumber (keyFile.get_string ("LensProfile", "LcMode")); + + if (pedited) { + pedited->lensProf.lcMode = true; + } + } + if (keyFile.has_key ("LensProfile", "LCPFile")) { lensProf.lcpFile = expandRelativePath (fname, "", keyFile.get_string ("LensProfile", "LCPFile")); if (pedited) { pedited->lensProf.lcpFile = true; } + + if(ppVersion < 327 && !lensProf.lcpFile.empty()) { + lensProf.lcMode = LensProfParams::eLcMode::lcp; + } } if (keyFile.has_key ("LensProfile", "UseDistortion")) { @@ -5854,20 +5864,6 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } - if (keyFile.has_key("LensProfile", "UseLensfun")) { - lensProf.useLensfun = keyFile.get_boolean("LensProfile", "UseLensfun"); - if (pedited) { - pedited->lensProf.useLensfun = true; - } - } - - if (keyFile.has_key("LensProfile", "LFAutoMatch")) { - lensProf.lfAutoMatch = keyFile.get_boolean("LensProfile", "LFAutoMatch"); - if (pedited) { - pedited->lensProf.lfAutoMatch = true; - } - } - if (keyFile.has_key("LensProfile", "LFCameraMake")) { lensProf.lfCameraMake = keyFile.get_string("LensProfile", "LFCameraMake"); if (pedited) { @@ -8484,12 +8480,11 @@ bool ProcParams::operator== (const ProcParams& other) && rotate.degree == other.rotate.degree && commonTrans.autofill == other.commonTrans.autofill && distortion.amount == other.distortion.amount + && lensProf.lcMode == other.lensProf.lcMode && lensProf.lcpFile == other.lensProf.lcpFile && lensProf.useDist == other.lensProf.useDist && lensProf.useVign == other.lensProf.useVign && lensProf.useCA == other.lensProf.useCA - && lensProf.useLensfun == other.lensProf.useLensfun - && lensProf.lfAutoMatch == other.lensProf.lfAutoMatch && lensProf.lfCameraMake == other.lensProf.lfCameraMake && lensProf.lfCameraModel == other.lensProf.lfCameraModel && lensProf.lfLens == other.lensProf.lfLens diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c7bedf611..9e7b728eb 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -829,10 +829,17 @@ class LensProfParams { public: + enum class eLcMode { + none, // No lens correction + lensfunAutoMatch, // Lens correction using auto matched lensfun database entry + lensfunManual, // Lens correction using manually selected lensfun database entry + lcp // Lens correction using lcp file + }; + + static const char *methodstring[static_cast(eLcMode::lcp) + 1u]; + eLcMode lcMode; Glib::ustring lcpFile; bool useDist, useVign, useCA; - bool useLensfun; - bool lfAutoMatch; Glib::ustring lfCameraMake; Glib::ustring lfCameraModel; Glib::ustring lfLens; @@ -842,6 +849,41 @@ public: setDefaults(); } void setDefaults(); + + bool useLensfun() const + { + return lcMode == eLcMode::lensfunAutoMatch || lcMode == eLcMode::lensfunManual; + } + + bool lfAutoMatch() const + { + return lcMode == eLcMode::lensfunAutoMatch; + } + + bool useLcp() const + { + return lcMode == eLcMode::lcp && lcpFile.length() > 0; + } + + bool lfManual() const + { + return lcMode == eLcMode::lensfunManual; + } + + Glib::ustring getMethodString(eLcMode mode) const + { + return methodstring[static_cast(mode)]; + } + + eLcMode getMethodNumber(const Glib::ustring &mode) const + { + for(size_t i = 0; i < static_cast(eLcMode::lcp); ++i) { + if(methodstring[i] == mode) { + return static_cast(i); + } + } + return eLcMode::none; + } }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index fdf5b6bc8..1b29b352a 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1857,7 +1857,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le // Correct vignetting of lens profile if (!hasFlatField && lensProf.useVign) { std::unique_ptr pmap; - if (lensProf.useLensfun) { + if (lensProf.useLensfun()) { pmap = std::move(LFDatabase::findModifier(lensProf, idata, W, H, coarse, -1)); } else { const std::shared_ptr pLCPProf = LCPStore::getInstance()->getProfile(lensProf.lcpFile); diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index a352613ab..1e1da319f 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -395,7 +395,7 @@ std::unique_ptr LFDatabase::findModifier(const LensProfParams &lensP const LFDatabase *db = getInstance(); Glib::ustring make, model, lens; float focallen = idata->getFocalLen(); - if (lensProf.lfAutoMatch) { + if (lensProf.lfAutoMatch()) { if (focallen <= 0) { return nullptr; } @@ -408,7 +408,7 @@ std::unique_ptr LFDatabase::findModifier(const LensProfParams &lensP lens = lensProf.lfLens; } LFCamera c = db->findCamera(make, model); - LFLens l = db->findLens(lensProf.lfAutoMatch ? c : LFCamera(), lens); + LFLens l = db->findLens(lensProf.lfAutoMatch() ? c : LFCamera(), lens); if (focallen <= 0 && l.data_ && l.data_->MinFocal == l.data_->MaxFocal) { focallen = l.data_->MinFocal; } diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index bb9138461..b6cef05fc 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -33,6 +33,7 @@ LensProfilePanel::LFDbHelper *LensProfilePanel::lf(nullptr); LensProfilePanel::LensProfilePanel () : FoldableToolPanel(this, "lensprof", M("TP_LENSPROFILE_LABEL")), + lcModeChanged(false), lcpFileChanged(false), useDistChanged(false), useVignChanged(false), @@ -122,10 +123,6 @@ LensProfilePanel::LensProfilePanel () : hbLCPFile->pack_start(*fcbLCPFile); - btnReset = Gtk::manage(new Gtk::Button()); - btnReset->set_image (*Gtk::manage(new RTImage ("gtk-cancel.png"))); - hbLCPFile->pack_start(*btnReset, Gtk::PACK_SHRINK, 4); - pack_start(*hbLCPFile, Gtk::PACK_SHRINK, 4); ckbUseDist = Gtk::manage (new Gtk::CheckButton (M("TP_LENSPROFILE_USEDIST"))); @@ -136,7 +133,6 @@ LensProfilePanel::LensProfilePanel () : pack_start (*ckbUseCA, Gtk::PACK_SHRINK, 4); conLCPFile = fcbLCPFile->signal_file_set().connect( sigc::mem_fun(*this, &LensProfilePanel::onLCPFileChanged), true); - btnReset->signal_clicked().connect( sigc::mem_fun(*this, &LensProfilePanel::onLCPFileReset), true); conUseDist = ckbUseDist->signal_toggled().connect( sigc::mem_fun(*this, &LensProfilePanel::onUseDistChanged) ); ckbUseVign->signal_toggled().connect( sigc::mem_fun(*this, &LensProfilePanel::onUseVignChanged) ); ckbUseCA->signal_toggled().connect( sigc::mem_fun(*this, &LensProfilePanel::onUseCAChanged) ); @@ -163,32 +159,29 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa } corrLensfunAuto->set_sensitive(true); - - if (pp->lensProf.useLensfun) { - if (pp->lensProf.lfAutoMatch) { - corrLensfunAuto->set_active(true); - } else { - corrLensfunManual->set_active(true); - } - } else if (!pp->lensProf.lcpFile.empty() && LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) { + + if(pp->lensProf.lcMode == procparams::LensProfParams::eLcMode::lcp) { corrLcpFile->set_active(true); + } else if(pp->lensProf.lcMode == procparams::LensProfParams::eLcMode::lensfunAutoMatch) { + corrLensfunAuto->set_active(true); + } else if(pp->lensProf.lcMode == procparams::LensProfParams::eLcMode::lensfunManual) { + corrLensfunManual->set_active(true); + } else { + corrOff->set_active(true); + } + + if (pp->lensProf.lcpFile.empty()) { + Glib::ustring lastFolder = fcbLCPFile->get_current_folder(); + fcbLCPFile->set_current_folder(lastFolder); + fcbLCPFile->set_filename(lastFolder + "/."); + bindCurrentFolder(*fcbLCPFile, options.lastLensProfileDir); + updateDisabled(false); + } else if (LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) { fcbLCPFile->set_filename (pp->lensProf.lcpFile); updateDisabled(true); } else { - Glib::ustring fname = fcbLCPFile->get_filename(); - - if (!pp->lensProf.lcpFile.empty()) { - fcbLCPFile->unselect_filename(fname); - } else { - Glib::ustring lastFolder = fcbLCPFile->get_current_folder(); - fcbLCPFile->set_current_folder(lastFolder); - fcbLCPFile->set_filename(lastFolder + "/."); - bindCurrentFolder(*fcbLCPFile, options.lastLensProfileDir); - } - + fcbLCPFile->unselect_filename(fcbLCPFile->get_filename()); updateDisabled(false); - - corrOff->set_active(true); } ckbUseDist->set_active (pp->lensProf.useDist); @@ -203,14 +196,14 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa l = db->findLens(c, metadata->getLens()); } - if (!setLensfunCamera(pp->lensProf.lfCameraMake, pp->lensProf.lfCameraModel) && pp->lensProf.lfAutoMatch) { + if (!setLensfunCamera(pp->lensProf.lfCameraMake, pp->lensProf.lfCameraModel) && !pp->lensProf.lfManual()) { setLensfunCamera(c.getMake(), c.getModel()); } - if (!setLensfunLens(pp->lensProf.lfLens) && pp->lensProf.lfAutoMatch) { + if (!setLensfunLens(pp->lensProf.lfLens) && !pp->lensProf.lfManual()) { setLensfunLens(l.getLens()); } - lcpFileChanged = useDistChanged = useVignChanged = useCAChanged = false; + lcModeChanged = lcpFileChanged = useDistChanged = useVignChanged = useCAChanged = false; useLensfunChanged = lensfunAutoChanged = lensfunCameraChanged = lensfunLensChanged = false; if (!batchMode && !checkLensfunCanCorrect(true)) { @@ -276,7 +269,17 @@ void LensProfilePanel::setRawMeta(bool raw, const rtengine::ImageMetaData* pMeta void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) { - if (corrLcpFile->get_active() && LCPStore::getInstance()->isValidLCPFileName(fcbLCPFile->get_filename())) { + if (corrLcpFile->get_active()) { + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::lcp; + } else if(corrLensfunManual->get_active()) { + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::lensfunManual; + } else if(corrLensfunAuto->get_active()) { + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::lensfunAutoMatch; + } else if(corrOff->get_active()) { + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::none; + } + + if (LCPStore::getInstance()->isValidLCPFileName(fcbLCPFile->get_filename())) { pp->lensProf.lcpFile = fcbLCPFile->get_filename(); } else { pp->lensProf.lcpFile = ""; @@ -286,8 +289,6 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited pp->lensProf.useVign = ckbUseVign->get_active(); pp->lensProf.useCA = ckbUseCA->get_active(); - pp->lensProf.useLensfun = corrLensfunAuto->get_active() || corrLensfunManual->get_active(); - pp->lensProf.lfAutoMatch = corrLensfunAuto->get_active(); auto itc = lensfunCameras->get_active(); if (itc) { pp->lensProf.lfCameraMake = (*itc)[lf->lensfunModelCam.make]; @@ -304,6 +305,7 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited } if (pedited) { + pedited->lensProf.lcMode = lcModeChanged; pedited->lensProf.lcpFile = lcpFileChanged; pedited->lensProf.useDist = useDistChanged; pedited->lensProf.useVign = useVignChanged; @@ -332,22 +334,6 @@ void LensProfilePanel::onLCPFileChanged() } } -void LensProfilePanel::onLCPFileReset() -{ - lcpFileChanged = true; - - fcbLCPFile->unselect_filename(fcbLCPFile->get_filename()); - updateDisabled(false); - - - if (listener) { - disableListener(); - corrOff->set_active(true); - enableListener(); - listener->panelChanged (EvLCPFile, M("GENERAL_NONE")); - } -} - void LensProfilePanel::onUseDistChanged() { useDistChanged = true; @@ -563,7 +549,7 @@ void LensProfilePanel::onCorrModeChanged() mode = M("GENERAL_UNCHANGED"); } - + lcModeChanged = true; updateLensfunWarning(); if (listener) { @@ -579,7 +565,6 @@ bool LensProfilePanel::checkLensfunCanCorrect(bool automatch) } rtengine::procparams::ProcParams lpp; write(&lpp); - lpp.lensProf.lfAutoMatch = automatch; std::unique_ptr mod(LFDatabase::findModifier(lpp.lensProf, metadata, 100, 100, lpp.coarse, -1)); return mod.get() != nullptr; } diff --git a/rtgui/lensprofile.h b/rtgui/lensprofile.h index aca8f16ef..1b1554cab 100644 --- a/rtgui/lensprofile.h +++ b/rtgui/lensprofile.h @@ -32,9 +32,8 @@ protected: MyFileChooserButton *fcbLCPFile; Gtk::CheckButton *ckbUseDist, *ckbUseVign, *ckbUseCA; Gtk::HBox *hbLCPFile; - Gtk::Button *btnReset; Gtk::Label *lLCPFileHead; - bool lcpFileChanged, useDistChanged, useVignChanged, useCAChanged; + bool lcModeChanged, lcpFileChanged, useDistChanged, useVignChanged, useCAChanged; sigc::connection conLCPFile, conUseDist, conUseVign, conUseCA; void updateDisabled(bool enable); bool allowFocusDep; @@ -98,7 +97,6 @@ public: void setRawMeta (bool raw, const rtengine::ImageMetaData* pMeta); void onLCPFileChanged (); - void onLCPFileReset (); void onUseDistChanged(); void onUseVignChanged(); void onUseCAChanged(); diff --git a/rtgui/options.cc.save-failed b/rtgui/options.cc.save-failed new file mode 100644 index 000000000..d03ece485 --- /dev/null +++ b/rtgui/options.cc.save-failed @@ -0,0 +1,2508 @@ +/* + * This file is part of RawTherapee. + * + * Copyright (c) 2004-2010 Gabor Horvath + * + * 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 "options.h" +#include +#include +#include +#include "multilangmgr.h" +#include "addsetids.h" +#include "guiutils.h" +#include "version.h" +#include "config.h" +#include +#ifdef _OPENMP +#include +#endif + + + +#ifdef WIN32 +#include +// for GCC32 +#ifndef _WIN32_IE +#define _WIN32_IE 0x0600 +#endif +#include +#endif + +// User's settings directory, including images' profiles if used +Glib::ustring Options::rtdir; +// User's cached datas' directory +Glib::ustring Options::cacheBaseDir; + +Options options; +Glib::ustring versionString = RTVERSION; +Glib::ustring paramFileExtension = ".pp3"; + +Options::Options () +{ + + defProfRawMissing = false; + defProfImgMissing = false; + setDefaults (); +} + +const char *DefaultLanguage = "English (US)"; + +inline bool Options::checkProfilePath (Glib::ustring &path) +{ + if (path.empty()) { + return false; + } + + Glib::ustring p = getUserProfilePath(); + + if (!p.empty() && Glib::file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS)) { + return true; + } + + p = getGlobalProfilePath(); + + return !p.empty() && Glib::file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS); +} + +bool Options::checkDirPath (Glib::ustring &path, Glib::ustring errString) +{ + if (Glib::file_test (path, Glib::FILE_TEST_EXISTS) && Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) { + return true; + } else { + if (!errString.empty()) { + printf ("%s\n", errString.c_str()); + } + + return false; + } +} + +void Options::updatePaths() +{ + + Glib::ustring tmpPath; + + userProfilePath = ""; + globalProfilePath = ""; + + if (Glib::path_is_absolute (profilePath)) { + // absolute path + if (!checkDirPath (profilePath, "")) { + g_mkdir_with_parents (profilePath.c_str (), 511); + + if (!checkDirPath (profilePath, "")) { // had problems with mkdir_with_parents return value on OS X, just check dir again + printf ("Error: user's profiles' directory \"%s\" creation failed\n", profilePath.c_str()); + } + } + + if (checkDirPath (profilePath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { + if (multiUser) { + userProfilePath = profilePath; + tmpPath = Glib::build_filename (argv0, "profiles"); + + if (checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { + if (userProfilePath != tmpPath) { + globalProfilePath = tmpPath; + } + } + } else { + globalProfilePath = profilePath; + } + } else { + tmpPath = Glib::build_filename (argv0, "profiles"); + + if (checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { + globalProfilePath = tmpPath; + } + } + } else { + // relative paths + if (multiUser) { + tmpPath = Glib::build_filename (rtdir, profilePath); + + if (!checkDirPath (tmpPath, "")) { + g_mkdir_with_parents (tmpPath.c_str (), 511); + + if (!checkDirPath (tmpPath, "")) { + printf ("Error: user's profiles' directory \"%s\" creation failed\n", tmpPath.c_str()); + } + } + + if (checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory!\n")) { + userProfilePath = tmpPath; + } + + tmpPath = Glib::build_filename (argv0, "profiles"); + + if (checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { + globalProfilePath = tmpPath; + } + } else { + // common directory + // directory name set in options is ignored, we use the default directory name + tmpPath = Glib::build_filename (argv0, "profiles"); + + if (checkDirPath (tmpPath, "Error: no global profiles' directory found!\n")) { + globalProfilePath = tmpPath; + } + } + } + + Glib::ustring preferredPath = getPreferredProfilePath(); + + // Paths are updated only if the user or global profile path is set + if (lastRgbCurvesDir.empty() || !Glib::file_test (lastRgbCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastRgbCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastRgbCurvesDir = preferredPath; + } + + if (lastLabCurvesDir.empty() || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastLabCurvesDir = preferredPath; + } + + if (lastRetinexDir.empty() || !Glib::file_test (lastRetinexDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastRetinexDir = preferredPath; + } + + if (lastDenoiseCurvesDir.empty() || !Glib::file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastDenoiseCurvesDir = preferredPath; + } + + if (lastWaveletCurvesDir.empty() || !Glib::file_test (lastWaveletCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastWaveletCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastWaveletCurvesDir = preferredPath; + } + + if (lastPFCurvesDir.empty() || !Glib::file_test (lastPFCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastPFCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastPFCurvesDir = preferredPath; + } + + if (lastHsvCurvesDir.empty() || !Glib::file_test (lastHsvCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastHsvCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastHsvCurvesDir = preferredPath; + } + + if (lastToneCurvesDir.empty() || !Glib::file_test (lastToneCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastToneCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastToneCurvesDir = preferredPath; + } + + if (lastProfilingReferenceDir.empty() || !Glib::file_test (lastProfilingReferenceDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastProfilingReferenceDir, Glib::FILE_TEST_IS_DIR)) { + lastProfilingReferenceDir = preferredPath; + } + + if (lastVibranceCurvesDir.empty() || !Glib::file_test (lastVibranceCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastVibranceCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastVibranceCurvesDir = preferredPath; + } + + if (loadSaveProfilePath.empty() || !Glib::file_test (loadSaveProfilePath, Glib::FILE_TEST_EXISTS) || !Glib::file_test (loadSaveProfilePath, Glib::FILE_TEST_IS_DIR)) { + loadSaveProfilePath = preferredPath; + } + + if (lastBWCurvesDir.empty() || !Glib::file_test (lastBWCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastBWCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastBWCurvesDir = preferredPath; + } + +} + +Glib::ustring Options::getPreferredProfilePath() +{ + if (!userProfilePath.empty()) { + return userProfilePath; + } else if (!globalProfilePath.empty()) { + return globalProfilePath; + } else { + return ""; + } +} + +/** @brief Get the absolute path of the given filename or the "Neutral" special value + * + *@param profName path + filename of the procparam to look for. A filename without path can be provided for backward compatibility. + * In this case, this parameter will be updated with the new format. + *@return Send back the absolute path of the given filename or "Neutral" if "Neutral" has been set to profName. Implementor will have + * to test for this particular value. If the absolute path is invalid (e.g. the file doesn't exist), it will return an empty string. + */ +Glib::ustring Options::findProfilePath (Glib::ustring &profName) +{ + if (profName.empty()) { + return ""; + } + + if (profName == DEFPROFILE_INTERNAL) { + return profName; + } + + if (profName == DEFPROFILE_DYNAMIC) { + return profName; + } + + Glib::ustring p = profName.substr (0, 4); + + if (p == "${U}") { + // the path starts by the User virtual path + p = getUserProfilePath(); + Glib::ustring fullPath = Glib::build_filename (p, profName.substr (5) + paramFileExtension); + + if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { + return Glib::path_get_dirname (fullPath); + } + } else if (p == "${G}") { + // the path starts by the User virtual path + p = getGlobalProfilePath(); + Glib::ustring fullPath = Glib::build_filename (p, profName.substr (5) + paramFileExtension); + + if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { + return Glib::path_get_dirname (fullPath); + } + } else { + // compatibility case -> convert the path to the new format + p = getUserProfilePath(); + Glib::ustring fullPath = Glib::build_filename (p, profName + paramFileExtension); + + if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { + // update the profile path + profName = Glib::build_filename ("${U}", profName); + return Glib::path_get_dirname (fullPath); + } + + p = getGlobalProfilePath(); + fullPath = Glib::build_filename (p, profName + paramFileExtension); + + if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { + profName = Glib::build_filename ("${G}", profName); + return Glib::path_get_dirname (fullPath); + } + } + + return ""; + +} + +void Options::setDefaults () +{ + + windowWidth = 1200; + windowHeight = 680; + windowX = 0; + windowY = 0; + windowMaximized = true; + windowMonitor = 0; + meowMonitor = -1; + meowFullScreen = false; + meowMaximized = true; + meowWidth = 1200; + meowHeight = 680; + meowX = 0; + meowY = 0; + saveAsDialogWidth = 920; + saveAsDialogHeight = 680; + savesParamsAtExit = true; + saveFormat.format = "jpg"; + saveFormat.jpegQuality = 92; + saveFormat.jpegSubSamp = 2; + saveFormat.pngCompression = 6; + saveFormat.pngBits = 8; + saveFormat.tiffBits = 16; + saveFormat.tiffUncompressed = true; + saveFormat.saveParams = true; + + saveFormatBatch.format = "jpg"; + saveFormatBatch.jpegQuality = 92; + saveFormatBatch.jpegSubSamp = 2; + saveFormatBatch.pngCompression = 6; + saveFormatBatch.pngBits = 8; + saveFormatBatch.tiffBits = 16; + saveFormatBatch.tiffUncompressed = true; + saveFormatBatch.saveParams = true; + + savePathTemplate = "%p1/converted/%f"; + savePathFolder = ""; + saveUsePathTemplate = true; + defProfRaw = DEFPROFILE_RAW; + defProfImg = DEFPROFILE_IMG; + dateFormat = "%y-%m-%d"; + adjusterMinDelay = 100; + adjusterMaxDelay = 200; + startupDir = STARTUPDIR_LAST; + startupPath = ""; + useBundledProfiles = true; + detailWindowWidth = -1; + detailWindowHeight = -1; + dirBrowserWidth = 260; + dirBrowserHeight = 350; + dirBrowserSortType = Gtk::SORT_ASCENDING; + preferencesWidth = 800; + preferencesHeight = 0; + toolPanelWidth = 400; + browserToolPanelWidth = 465; + browserToolPanelHeight = 600; + browserToolPanelOpened = true;; + browserDirPanelOpened = true; + editorFilmStripOpened = true; + historyPanelWidth = 330; + fontFamily = "default"; + fontSize = 10; + CPFontFamily = "default"; + CPFontSize = 8; + lastScale = 5; + panAccelFactor = 5; + rememberZoomAndPan = true; + lastCropSize = 1; + fbOnlyRaw = false; + fbShowDateTime = true; + fbShowBasicExif = true; + fbShowExpComp = false; + fbShowHidden = false; + fbArrangement = 2; // was 0 + navRGBUnit = NavigatorUnit::PERCENT; + navHSVUnit = NavigatorUnit::PERCENT; + multiUser = true; + profilePath = "profiles"; + loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails + version = "0.0.0.0"; // temporary value; will be correctly set in RTWindow::on_realize + thumbSize = 160; + thumbSizeTab = 160; + thumbSizeQueue = 160; + sameThumbSize = false; // preferring speed of switch between file browser and single editor tab + showHistory = true; + showFilePanelState = 0; // Not used anymore ; was the thumb strip state + showInfo = true; + cropPPI = 600; + showClippedHighlights = false; + showClippedShadows = false; + highlightThreshold = 253; // was 254 + shadowThreshold = 8; // was 0 + bgcolor = 0; + blinkClipped = false; + language = DefaultLanguage; + languageAutoDetect = langMgr.isOSLanguageDetectSupported(); + lastSaveAsPath = ""; + overwriteOutputFile = false; // if TRUE, existing output JPGs/PNGs are overwritten, instead of adding ..-1.jpg, -2.jpg etc. + theme = "RawTherapee"; + maxThumbnailHeight = 250; + maxCacheEntries = 20000; + thumbInterp = 1; + autoSuffix = true; + forceFormatOpts = true; + saveMethodNum = 0; // 0->immediate, 1->putToQueuHead, 2->putToQueueTail + saveParamsFile = true; // was false, but saving the procparams files next to the file make more sense when reorganizing file tree than in a cache + saveParamsCache = false; // there's no need to save the procparams files in a cache if saveParamsFile is true + paramsLoadLocation = PLL_Input; // was PLL_Cache + procQueueEnabled = false; + gimpDir = ""; + psDir = ""; + customEditorProg = ""; + CPBKeys = CPBKT_TID; + editorToSendTo = 1; + favoriteDirs.clear(); + tpOpen.clear (); + autoSaveTpOpen = true; + //crvOpen.clear (); + parseExtensions.clear (); + parseExtensionsEnabled.clear (); + parsedExtensions.clear (); + renameUseTemplates = false; + renameTemplates.clear (); + thumbnailZoomRatios.clear (); + thumbnailZoomRatios.push_back (0.2); + thumbnailZoomRatios.push_back (0.3); + thumbnailZoomRatios.push_back (0.45); + thumbnailZoomRatios.push_back (0.6); + thumbnailZoomRatios.push_back (0.8); + thumbnailZoomRatios.push_back (1.0); + overlayedFileNames = false; + filmStripOverlayedFileNames = false; + internalThumbIfUntouched = true; // if TRUE, only fast, internal preview images are taken if the image is not edited yet + showFileNames = true; + filmStripShowFileNames = false; + tabbedUI = false; + mainNBVertical = true; + multiDisplayMode = 0; + tunnelMetaData = true; + histogramPosition = 1; + histogramBar = true; + histogramFullMode = false; + curvebboxpos = 1; + prevdemo = PD_Sidecar; + rgbDenoiseThreadLimit = 0; +#if defined( _OPENMP ) && defined( __x86_64__ ) + clutCacheSize = omp_get_num_procs(); +#else + clutCacheSize = 1; +#endif + filledProfile = false; + maxInspectorBuffers = 2; // a rather conservative value for low specced systems... + serializeTiffRead = true; + + FileBrowserToolbarSingleRow = false; + hideTPVScrollbar = false; + UseIconNoText = true; + whiteBalanceSpotSize = 8; + showFilmStripToolBar = false; + menuGroupRank = true; + menuGroupLabel = true; + menuGroupFileOperations = true; + menuGroupProfileOperations = true; + menuGroupExtProg = true; + + fastexport_bypass_sharpening = true; + fastexport_bypass_sharpenEdge = true; + fastexport_bypass_sharpenMicro = true; + //fastexport_bypass_lumaDenoise = true; + //fastexport_bypass_colorDenoise = true; + fastexport_bypass_defringe = true; + fastexport_bypass_dirpyrDenoise = true; + fastexport_bypass_sh_hq = true; + fastexport_bypass_dirpyrequalizer = true; + fastexport_bypass_wavelet = true; + fastexport_raw_bayer_method = "fast"; + //fastexport_bypass_raw_bayer_all_enhance = true; + fastexport_bypass_raw_bayer_dcb_iterations = true; + fastexport_bypass_raw_bayer_dcb_enhance = true; + fastexport_bypass_raw_bayer_lmmse_iterations = true; + fastexport_bypass_raw_bayer_linenoise = true; + fastexport_bypass_raw_bayer_greenthresh = true; + fastexport_raw_xtrans_method = "fast"; + fastexport_bypass_raw_ccSteps = true; + fastexport_bypass_raw_ca = true; + fastexport_bypass_raw_df = true; + fastexport_bypass_raw_ff = true; + fastexport_icm_input = "(camera)"; + fastexport_icm_working = "ProPhoto"; + fastexport_icm_output = "RT_sRGB"; + fastexport_icm_outputIntent = rtengine::RI_RELATIVE; + fastexport_icm_outputBPC = true; + fastexport_icm_gamma = "default"; + fastexport_resize_enabled = true; + fastexport_resize_scale = 1; + fastexport_resize_appliesTo = "Cropped area"; + fastexport_resize_method = "Lanczos"; + fastexport_resize_dataspec = 3; + fastexport_resize_width = 900; + fastexport_resize_height = 900; + fastexport_use_fast_pipeline = true; + + clutsDir = "./cluts"; + + cutOverlayBrush = std::vector (4); + cutOverlayBrush[3] = 0.667; // :-p + + navGuideBrush = std::vector (4); + //default to red + navGuideBrush[0] = 1.0; + navGuideBrush[1] = 0.0; + navGuideBrush[2] = 0.0; + navGuideBrush[3] = 1.0; + + sndEnable = true; + sndLngEditProcDoneSecs = 3.0; +#ifdef __linux__ + sndBatchQueueDone = "complete"; + sndLngEditProcDone = "window-attention"; +#endif + + // Reminder: 0 = SET mode, 1 = ADD mode + baBehav = { + 1, // ADDSET_TC_EXPCOMP + 1, // ADDSET_TC_BRIGHTNESS + 1, // ADDSET_TC_BLACKLEVEL + 1, // ADDSET_TC_CONTRAST + 1, // ADDSET_SH_HIGHLIGHTS + 1, // ADDSET_SH_SHADOWS + 1, // ADDSET_SH_LOCALCONTRAST + 1, // ADDSET_LC_BRIGHTNESS + 1, // ADDSET_LC_CONTRAST + 1, // ADDSET_SHARP_AMOUNT + 1, // ADDSET_WB_TEMPERATURE + 1, // ADDSET_WB_GREEN + 1, // ADDSET_ROTATE_DEGREE + 1, // ADDSET_DIST_AMOUNT + 1, // ADDSET_PERSPECTIVE + 1, // ADDSET_CA + 1, // ADDSET_VIGN_AMOUNT + 1, // ADDSET_VIGN_RADIUS + 1, // ADDSET_VIGN_STRENGTH + 1, // ADDSET_VIGN_CENTER + 1, // ADDSET_LC_CHROMATICITY + 1, // ADDSET_TC_SATURATION + 1, // ADDSET_TC_HLCOMPAMOUNT + 1, // ADDSET_TC_HLCOMPTHRESH + 1, // ADDSET_TC_SHCOMP + 1, // ADDSET_DIRPYREQ + 1, // ADDSET_DIRPYRDN_LUMA + 1, // ADDSET_DIRPYRDN_LUDET + 1, // ADDSET_DIRPYRDN_CHROMA + 1, // ADDSET_DIRPYRDN_CHROMARED + 1, // ADDSET_DIRPYRDN_CHROMABLUE + 1, // ADDSET_DIRPYRDN_GAMMA + 1, // ADDSET_CHMIXER + 1, // ADDSET_PREPROCESS_GREENEQUIL + 1, // ADDSET_PREPROCESS_LINEDENOISE + 1, // ADDSET_RAWCACORR + 1, // ADDSET_RAWEXPOS_LINEAR + 1, // ADDSET_RAWEXPOS_PRESER + 1, // ADDSET_RAWEXPOS_BLACKS + 1, // ADDSET_SHARPENEDGE_AMOUNT + 1, // ADDSET_SHARPENMICRO_AMOUNT + 1, // ADDSET_SHARPENEDGE_PASS + 1, // ADDSET_SHARPENMICRO_UNIFORMITY + 1, // ADDSET_VIBRANCE_PASTELS + 1, // ADDSET_VIBRANCE_SATURATED + 1, // ADDSET_FREE_OUPUT_GAMMA + 1, // ADDSET_FREE_OUTPUT_SLOPE + 1, // ADDSET_CAT_DEGREE + 1, // ADDSET_CAT_ADAPSCEN + 1, // ADDSET_CAT_ADAPLUM + 1, // ADDSET_CAT_LIGHT + 1, // ADDSET_CAT_RSTPRO + 1, // ADDSET_CAT_BADPIX + 1, // ADDSET_CAT_JLIGHT + 1, // ADDSET_CAT_CHROMA + 1, // ADDSET_CAT_CONTRAST + 1, // ADDSET_CAT_CHROMA_S + 1, // ADDSET_CAT_CHROMA_M + 1, // ADDSET_CAT_HUE + 1, // ADDSET_CAT_BADPIX + 1, // ADDSET_WB_EQUAL + 1, // ADDSET_GRADIENT_DEGREE + 1, // ADDSET_GRADIENT_FEATHER + 1, // ADDSET_GRADIENT_STRENGTH + 1, // ADDSET_GRADIENT_CENTER + 1, // ADDSET_PCVIGNETTE_STRENGTH + 1, // ADDSET_PCVIGNETTE_FEATHER + 1, // ADDSET_PCVIGNETTE_ROUNDNESS + 1, // ADDSET_BLACKWHITE_HUES + 1, // ADDSET_BLACKWHITE_GAMMA + 1, // ADDSET_DIRPYREQ_THRESHOLD + 1, // ADDSET_DIRPYREQ_SKINPROTECT + 1, // ADDSET_COLORTONING_SPLIT + 1, // ADDSET_COLORTONING_SATTHRESHOLD + 1, // ADDSET_COLORTONING_SATOPACITY + 1, // ADDSET_COLORTONING_BALANCE + 1, // ADDSET_COLORTONING_STRENGTH + 1, // ADDSET_DIRPYRDN_PASSES + 1, // ADDSET_RAWFFCLIPCONTROL + 1, // ADDSET_FILMSIMULATION_STRENGTH + 1, // ADDSET_WA + 1, // ADDSET_WA_SKINPROTECT + 1, // ADDSET_WA_THRESHOLD2 + 1, // ADDSET_WA_THRR + 1, // ADDSET_WA_THRRH + 1, // ADDSET_WA_THRESHOLD + 1, // ADDSET_WA_THRESHOLD2 + 1, // ADDSET_WA_CHRO + 1, // ADDSET_WA_CHROMA + 1, // ADDSET_WA_CONTRAST + 1, // ADDSET_WA_RESCON + 1, // ADDSET_WA_RESCONH + 1, // ADDSET_WA_RESCHRO + 1, // ADDSET_WA_SKYPROTECT + 1, // ADDSET_WA_EDGRAD + 1, // ADDSET_WA_EDGVAL + 1, // ADDSET_WA_STRENGTH + 1, // ADDSET_WA_EDGEDETECT + 1, // ADDSET_WA_EDGEDETECTTHR + 1, // ADDSET_WA_EDGEDETECTTHR2 + 1, // ADDSET_WA_TMRS + 1, // ADDSET_WA_GAMMA + 1, // ADDSET_RETI_STR + 1, // ADDSET_RETI_NEIGH + 1, // ADDSET_RETI_LIMD + 1, // ADDSET_RETI_GAIN + 1, // ADDSET_RETI_OFFS + 1, // ADDSET_RETI_VART + 1, // ADDSET_RETI_GAM + 1, // ADDSET_RETI_SLO + 1, // ADDSET_WB_TEMPBIAS + }; + + rtSettings.darkFramesPath = ""; + rtSettings.flatFieldsPath = ""; +#ifdef WIN32 + const gchar* sysRoot = g_getenv ("SystemRoot"); // Returns e.g. "c:\Windows" + + if (sysRoot != NULL) { + rtSettings.iccDirectory = Glib::ustring (sysRoot) + Glib::ustring ("\\System32\\spool\\drivers\\color"); + } else { + rtSettings.iccDirectory = "C:\\WINDOWS\\System32\\spool\\drivers\\color"; + } + +#elif defined __APPLE__ + rtSettings.iccDirectory = "/library/ColorSync/Profiles/Displays"; +#else + rtSettings.iccDirectory = "/usr/share/color/icc"; +#endif +// rtSettings.viewingdevice = 0; +// rtSettings.viewingdevicegrey = 3; + // rtSettings.viewinggreySc = 1; + rtSettings.leveldnv = 2; + rtSettings.leveldnti = 0; + rtSettings.leveldnaut = 0; + rtSettings.leveldnliss = 0; + rtSettings.leveldnautsimpl = 0; + + rtSettings.printerProfile = Glib::ustring(); + rtSettings.printerIntent = rtengine::RI_RELATIVE; + rtSettings.printerBPC = true; + rtSettings.monitorProfile = Glib::ustring(); + rtSettings.monitorIntent = rtengine::RI_RELATIVE; + rtSettings.monitorBPC = true; + rtSettings.autoMonitorProfile = false; + rtSettings.adobe = "RT_Medium_gsRGB"; // put the name of yours profiles (here windows) + rtSettings.prophoto = "RT_Large_gBT709"; // these names appear in the menu "output profile" + rtSettings.prophoto10 = "RT_Large_g10"; // these names appear in the menu "output profile" + rtSettings.srgb10 = "RT_sRGB_g10"; + rtSettings.widegamut = "WideGamutRGB"; + rtSettings.srgb = "RT_sRGB"; + rtSettings.bruce = "Bruce"; + rtSettings.beta = "BetaRGB"; + rtSettings.best = "BestRGB"; + rtSettings.rec2020 = "Rec2020"; + rtSettings.verbose = false; + rtSettings.gamutICC = true; + rtSettings.gamutLch = true; + rtSettings.amchroma = 40;//between 20 and 140 low values increase effect..and also artefacts, high values reduces + rtSettings.artifact_cbdl = 4.; + rtSettings.level0_cbdl = 0; + rtSettings.level123_cbdl = 30; + rtSettings.bot_left = 0; + rtSettings.top_left = 10; + rtSettings.top_right = 40; + rtSettings.bot_right = 75; + rtSettings.ed_detec = 3; //between 2 and 10 + rtSettings.ed_detecStr = 1.3; //not use + rtSettings.ed_low = 15.; //between 5 to 40 + rtSettings.ed_lipinfl = 0.8; //between 0.5 to 0.9 + rtSettings.ed_lipampl = 1.1; //between 1 and 2 + + + rtSettings.ciecamfloat = true; + rtSettings.protectred = 60; + rtSettings.protectredh = 0.3; + rtSettings.CRI_color = 0; + rtSettings.autocielab = true; + rtSettings.denoiselabgamma = 2; + rtSettings.HistogramWorking = false; + + rtSettings.daubech = false; + + rtSettings.nrauto = 10;//between 2 and 20 + rtSettings.nrautomax = 40;//between 5 and 100 + rtSettings.nrhigh = 0.45;//between 0.1 and 0.9 + rtSettings.nrwavlevel = 1;//integer between 0 and 2 + +// rtSettings.colortoningab =0.7; +//rtSettings.decaction =0.3; +// rtSettings.ciebadpixgauss=false; + rtSettings.rgbcurveslumamode_gamut = true; + lastIccDir = rtSettings.iccDirectory; + lastDarkframeDir = rtSettings.darkFramesPath; + lastFlatfieldDir = rtSettings.flatFieldsPath; +// rtSettings.bw_complementary = true; + // There is no reasonable default for curves. We can still suppose that they will take place + // in a subdirectory of the user's own ProcParams presets, i.e. in a subdirectory + // of the one pointed to by the "profile" field. + // The following fields will then be initialized when "profile" will have its final value, + // at the end of the "updatePaths" method. + lastRgbCurvesDir = ""; + lastLabCurvesDir = ""; + lastRetinexDir = ""; + lastDenoiseCurvesDir = ""; + lastWaveletCurvesDir = ""; + lastPFCurvesDir = ""; + lastHsvCurvesDir = ""; + lastToneCurvesDir = ""; + lastVibranceCurvesDir = ""; + lastProfilingReferenceDir = ""; + lastBWCurvesDir = ""; + lastLensProfileDir = ""; + gimpPluginShowInfoDialog = true; + maxRecentFolders = 15; + + rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH; + std::cout << "." << rtSettings.lensfunDbDirectory << "." << std::endl; +} + +Options* Options::copyFrom (Options* other) +{ + *this = *other; + return this; +} + +void Options::filterOutParsedExtensions () +{ + parsedExtensions.clear(); + + for (unsigned int i = 0; i < parseExtensions.size(); i++) + if (parseExtensionsEnabled[i]) { + parsedExtensions.push_back (parseExtensions[i].lowercase()); + } +} + +void Options::readFromFile (Glib::ustring fname) +{ + setlocale (LC_NUMERIC, "C"); // to set decimal point to "." + + Glib::KeyFile keyFile; + + if ( !Glib::file_test (fname, Glib::FILE_TEST_EXISTS)) { + Glib::ustring msg = Glib::ustring::compose ("Options file %1 does not exist", fname); + throw Error (msg); + } + + try { + if (keyFile.load_from_file (fname)) { + +// -------------------------------------------------------------------------------------------------------- + + if (keyFile.has_group ("General")) { + if (keyFile.has_key ("General", "TabbedEditor")) { + tabbedUI = keyFile.get_boolean ("General", "TabbedEditor"); + } + + if (keyFile.has_key ("General", "StartupDirectory")) { + if ( keyFile.get_string ("General", "StartupDirectory") == "home") { + startupDir = STARTUPDIR_HOME; + } else if ( keyFile.get_string ("General", "StartupDirectory") == "current") { + startupDir = STARTUPDIR_CURRENT; + } else if ( keyFile.get_string ("General", "StartupDirectory") == "last") { + startupDir = STARTUPDIR_LAST; + } else if ( keyFile.get_string ("General", "StartupDirectory") == "custom") { + startupDir = STARTUPDIR_CUSTOM; + } + } + + if (keyFile.has_key ("General", "StartupPath")) { + startupPath = keyFile.get_string ("General", "StartupPath"); + } + + if (keyFile.has_key ("General", "DateFormat")) { + dateFormat = keyFile.get_string ("General", "DateFormat"); + } + + if (keyFile.has_key ("General", "AdjusterMinDelay")) { + adjusterMinDelay = keyFile.get_integer ("General", "AdjusterMinDelay"); + } + + if (keyFile.has_key ("General", "AdjusterMaxDelay")) { + adjusterMaxDelay = keyFile.get_integer ("General", "AdjusterMaxDelay"); + } + + if (keyFile.has_key ("General", "StoreLastProfile")) { + savesParamsAtExit = keyFile.get_boolean ("General", "StoreLastProfile"); + } + + if (keyFile.has_key ("General", "MultiUser")) { + multiUser = keyFile.get_boolean ("General", "MultiUser"); + } + + if (keyFile.has_key ("General", "Version")) { + version = keyFile.get_string ("General", "Version"); + } + + if (keyFile.has_key ("General", "Language")) { + language = keyFile.get_string ("General", "Language"); + } + + if (keyFile.has_key ("General", "LanguageAutoDetect")) { + languageAutoDetect = keyFile.get_boolean ("General", "LanguageAutoDetect"); + } + + if (keyFile.has_key ("General", "Theme")) { + theme = keyFile.get_string ("General", "Theme"); + } + + if ( keyFile.has_key ("General", "DarkFramesPath")) { + rtSettings.darkFramesPath = keyFile.get_string ("General", "DarkFramesPath"); + } + + if ( keyFile.has_key ("General", "FlatFieldsPath")) { + rtSettings.flatFieldsPath = keyFile.get_string ("General", "FlatFieldsPath"); + } + + if ( keyFile.has_key ("General", "Verbose")) { + rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); + } + + if (keyFile.has_key ("General", "BotLeft")) { + rtSettings.bot_left = keyFile.get_double ("General", "BotLeft"); + } + + if (keyFile.has_key ("General", "TopLeft")) { + rtSettings.top_left = keyFile.get_double ("General", "TopLeft"); + } + + if (keyFile.has_key ("General", "TopRight")) { + rtSettings.top_right = keyFile.get_double ("General", "TopRight"); + } + + if (keyFile.has_key ("General", "BotRight")) { + rtSettings.bot_right = keyFile.get_double ("General", "BotRight"); + } + + if (keyFile.has_key ("General", "EDdetec")) { + rtSettings.ed_detec = keyFile.get_double ("General", "EDdetec"); + } + + if (keyFile.has_key ("General", "EDdetecStr")) { + rtSettings.ed_detecStr = keyFile.get_double ("General", "EDdetecStr"); + } + + if (keyFile.has_key ("General", "EDLow")) { + rtSettings.ed_low = keyFile.get_double ("General", "EDLow"); + } + + if (keyFile.has_key ("General", "EDLipinfl")) { + rtSettings.ed_lipinfl = keyFile.get_double ("General", "EDLipinfl"); + } + + if (keyFile.has_key ("General", "EDLipampl")) { + rtSettings.ed_lipampl = keyFile.get_double ("General", "EDLipampl"); + } + + + } + + if (keyFile.has_group ("External Editor")) { + if (keyFile.has_key ("External Editor", "EditorKind")) { + editorToSendTo = keyFile.get_integer ("External Editor", "EditorKind"); + } + + if (keyFile.has_key ("External Editor", "GimpDir")) { + gimpDir = keyFile.get_string ("External Editor", "GimpDir"); + } + + if (keyFile.has_key ("External Editor", "PhotoshopDir")) { + psDir = keyFile.get_string ("External Editor", "PhotoshopDir"); + } + + if (keyFile.has_key ("External Editor", "CustomEditor")) { + customEditorProg = keyFile.get_string ("External Editor", "CustomEditor"); + } + } + + if (keyFile.has_group ("Output")) { + if (keyFile.has_key ("Output", "Format")) { + saveFormat.format = keyFile.get_string ("Output", "Format"); + } + + if (keyFile.has_key ("Output", "JpegQuality")) { + saveFormat.jpegQuality = keyFile.get_integer ("Output", "JpegQuality"); + } + + if (keyFile.has_key ("Output", "JpegSubSamp")) { + saveFormat.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSamp"); + } + + if (keyFile.has_key ("Output", "PngCompression")) { + saveFormat.pngCompression = keyFile.get_integer ("Output", "PngCompression"); + } + + if (keyFile.has_key ("Output", "PngBps")) { + saveFormat.pngBits = keyFile.get_integer ("Output", "PngBps"); + } + + if (keyFile.has_key ("Output", "TiffBps")) { + saveFormat.tiffBits = keyFile.get_integer ("Output", "TiffBps"); + } + + if (keyFile.has_key ("Output", "TiffUncompressed")) { + saveFormat.tiffUncompressed = keyFile.get_boolean ("Output", "TiffUncompressed"); + } + + if (keyFile.has_key ("Output", "SaveProcParams")) { + saveFormat.saveParams = keyFile.get_boolean ("Output", "SaveProcParams"); + } + + + if (keyFile.has_key ("Output", "FormatBatch")) { + saveFormatBatch.format = keyFile.get_string ("Output", "FormatBatch"); + } + + if (keyFile.has_key ("Output", "JpegQualityBatch")) { + saveFormatBatch.jpegQuality = keyFile.get_integer ("Output", "JpegQualityBatch"); + } + + if (keyFile.has_key ("Output", "JpegSubSampBatch")) { + saveFormatBatch.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSampBatch"); + } + + if (keyFile.has_key ("Output", "PngCompressionBatch")) { + saveFormatBatch.pngCompression = keyFile.get_integer ("Output", "PngCompressionBatch"); + } + + if (keyFile.has_key ("Output", "PngBpsBatch")) { + saveFormatBatch.pngBits = keyFile.get_integer ("Output", "PngBpsBatch"); + } + + if (keyFile.has_key ("Output", "TiffBpsBatch")) { + saveFormatBatch.tiffBits = keyFile.get_integer ("Output", "TiffBpsBatch"); + } + + if (keyFile.has_key ("Output", "TiffUncompressedBatch")) { + saveFormatBatch.tiffUncompressed = keyFile.get_boolean ("Output", "TiffUncompressedBatch"); + } + + if (keyFile.has_key ("Output", "SaveProcParamsBatch")) { + saveFormatBatch.saveParams = keyFile.get_boolean ("Output", "SaveProcParamsBatch"); + } + + if (keyFile.has_key ("Output", "Path")) { + savePathTemplate = keyFile.get_string ("Output", "Path"); + } + + if (keyFile.has_key ("Output", "PathTemplate")) { + savePathTemplate = keyFile.get_string ("Output", "PathTemplate"); + } + + if (keyFile.has_key ("Output", "PathFolder")) { + savePathFolder = keyFile.get_string ("Output", "PathFolder"); + } + + if (keyFile.has_key ("Output", "AutoSuffix")) { + autoSuffix = keyFile.get_boolean ("Output", "AutoSuffix"); + } + + if (keyFile.has_key ("Output", "ForceFormatOpts")) { + forceFormatOpts = keyFile.get_boolean ("Output", "ForceFormatOpts"); + } + + if (keyFile.has_key ("Output", "SaveMethodNum")) { + saveMethodNum = keyFile.get_integer ("Output", "SaveMethodNum"); + } + + if (keyFile.has_key ("Output", "UsePathTemplate")) { + saveUsePathTemplate = keyFile.get_boolean ("Output", "UsePathTemplate"); + } + + if (keyFile.has_key ("Output", "LastSaveAsPath")) { + lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath"); + } + + 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")) { + if (keyFile.has_key ("Profiles", "Directory")) { + profilePath = keyFile.get_string ("Profiles", "Directory"); + } + + if (keyFile.has_key ("Profiles", "UseBundledProfiles")) { + useBundledProfiles = keyFile.get_boolean ("Profiles", "UseBundledProfiles"); + } + + if (keyFile.has_key ("Profiles", "LoadSaveProfilePath")) { + loadSaveProfilePath = keyFile.get_string ("Profiles", "LoadSaveProfilePath"); + } + + if (keyFile.has_key ("Profiles", "RawDefault")) { + defProfRaw = keyFile.get_string ("Profiles", "RawDefault"); + } + + if (keyFile.has_key ("Profiles", "ImgDefault")) { + defProfImg = keyFile.get_string ("Profiles", "ImgDefault"); + } + + if (keyFile.has_key ("Profiles", "FilledProfile")) { + filledProfile = keyFile.get_boolean ("Profiles", "FilledProfile"); + } + + if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) { + saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile"); + } + + if (keyFile.has_key ("Profiles", "SaveParamsToCache")) { + saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache"); + } + + if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) { + paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation"); + } + + if (keyFile.has_key ("Profiles", "CustomProfileBuilder")) { + CPBPath = keyFile.get_string ("Profiles", "CustomProfileBuilder"); // for backward compatibility only + } + + if (keyFile.has_key ("Profiles", "CustomProfileBuilderPath")) { + CPBPath = keyFile.get_string ("Profiles", "CustomProfileBuilderPath"); + } + + if (keyFile.has_key ("Profiles", "CustomProfileBuilderKeys")) { + CPBKeys = (CPBKeyType)keyFile.get_integer ("Profiles", "CustomProfileBuilderKeys"); + } + } + + if (keyFile.has_group ("File Browser")) { + if (keyFile.has_key ("File Browser", "ThumbnailSize")) { + thumbSize = keyFile.get_integer ("File Browser", "ThumbnailSize"); + } + + if (keyFile.has_key ("File Browser", "ThumbnailSizeTab")) { + thumbSizeTab = keyFile.get_integer ("File Browser", "ThumbnailSizeTab"); + } + + if (keyFile.has_key ("File Browser", "ThumbnailSizeQueue")) { + thumbSizeQueue = keyFile.get_integer ("File Browser", "ThumbnailSizeQueue"); + } + + if (keyFile.has_key ("File Browser", "SameThumbSize")) { + sameThumbSize = keyFile.get_integer ("File Browser", "SameThumbSize"); + } + + if (keyFile.has_key ("File Browser", "BrowseOnlyRaw")) { + fbOnlyRaw = keyFile.get_boolean ("File Browser", "BrowseOnlyRaw"); + } + + if (keyFile.has_key ("File Browser", "BrowserShowsDate")) { + fbShowDateTime = keyFile.get_boolean ("File Browser", "BrowserShowsDate"); + } + + if (keyFile.has_key ("File Browser", "BrowserShowsExif")) { + fbShowBasicExif = keyFile.get_boolean ("File Browser", "BrowserShowsExif"); + } + + if (keyFile.has_key ("File Browser", "BrowserShowsExpComp")) { + fbShowExpComp = keyFile.get_boolean ("File Browser", "BrowserShowsExpComp"); + } + + if (keyFile.has_key ("File Browser", "BrowserShowsHidden")) { + fbShowHidden = keyFile.get_boolean ("File Browser", "BrowserShowsHidden"); + } + + if (keyFile.has_key ("File Browser", "MaxPreviewHeight")) { + maxThumbnailHeight = keyFile.get_integer ("File Browser", "MaxPreviewHeight"); + } + + if (keyFile.has_key ("File Browser", "MaxCacheEntries")) { + maxCacheEntries = keyFile.get_integer ("File Browser", "MaxCacheEntries"); + } + + if (keyFile.has_key ("File Browser", "ParseExtensions")) { + parseExtensions = keyFile.get_string_list ("File Browser", "ParseExtensions"); + } + + if (keyFile.has_key ("File Browser", "ParseExtensionsEnabled")) { + parseExtensionsEnabled = keyFile.get_integer_list ("File Browser", "ParseExtensionsEnabled"); + } + + if (keyFile.has_key ("File Browser", "ThumbnailArrangement")) { + fbArrangement = keyFile.get_integer ("File Browser", "ThumbnailArrangement"); + } + + if (keyFile.has_key ("File Browser", "ThumbnailInterpolation")) { + thumbInterp = keyFile.get_integer ("File Browser", "ThumbnailInterpolation"); + } + + if (keyFile.has_key ("File Browser", "FavoriteDirs")) { + favoriteDirs = keyFile.get_string_list ("File Browser", "FavoriteDirs"); + } + + if (keyFile.has_key ("File Browser", "RenameTemplates")) { + renameTemplates = keyFile.get_string_list ("File Browser", "RenameTemplates"); + } + + if (keyFile.has_key ("File Browser", "RenameUseTemplates")) { + renameUseTemplates = keyFile.get_boolean ("File Browser", "RenameUseTemplates"); + } + + if (keyFile.has_key ("File Browser", "ThumbnailZoomRatios")) { + thumbnailZoomRatios = keyFile.get_double_list ("File Browser", "ThumbnailZoomRatios"); + } + + if (keyFile.has_key ("File Browser", "OverlayedFileNames")) { + overlayedFileNames = keyFile.get_boolean ("File Browser", "OverlayedFileNames"); + } + + if (keyFile.has_key ("File Browser", "FilmStripOverlayedFileNames")) { + filmStripOverlayedFileNames = keyFile.get_boolean ("File Browser", "FilmStripOverlayedFileNames"); + } + + if (keyFile.has_key ("File Browser", "ShowFileNames")) { + showFileNames = keyFile.get_boolean ("File Browser", "ShowFileNames"); + } + + if (keyFile.has_key ("File Browser", "FilmStripShowFileNames")) { + filmStripShowFileNames = keyFile.get_boolean ("File Browser", "FilmStripShowFileNames"); + } + + if (keyFile.has_key ("File Browser", "InternalThumbIfUntouched")) { + internalThumbIfUntouched = keyFile.get_boolean ("File Browser", "InternalThumbIfUntouched"); + } + + if (keyFile.has_key ("File Browser", "menuGroupRank")) { + menuGroupRank = keyFile.get_boolean ("File Browser", "menuGroupRank"); + } + + if (keyFile.has_key ("File Browser", "menuGroupLabel")) { + menuGroupLabel = keyFile.get_boolean ("File Browser", "menuGroupLabel"); + } + + if (keyFile.has_key ("File Browser", "menuGroupFileOperations")) { + menuGroupFileOperations = keyFile.get_boolean ("File Browser", "menuGroupFileOperations"); + } + + if (keyFile.has_key ("File Browser", "menuGroupProfileOperations")) { + menuGroupProfileOperations = keyFile.get_boolean ("File Browser", "menuGroupProfileOperations"); + } + + if (keyFile.has_key ("File Browser", "menuGroupExtProg")) { + menuGroupExtProg = keyFile.get_boolean ("File Browser", "menuGroupExtProg"); + } + + if (keyFile.has_key ("File Browser", "MaxRecentFolders")) { + maxRecentFolders = keyFile.get_integer ("File Browser", "MaxRecentFolders"); + } + + recentFolders.reserve (maxRecentFolders + 10); // reserve some more than maxRecentFolders, because at runtime it stores more than that + + if (keyFile.has_key ("File Browser", "RecentFolders")) { + recentFolders = keyFile.get_string_list ("File Browser", "RecentFolders"); + } + } + + if (keyFile.has_group ("Clipping Indication")) { + if (keyFile.has_key ("Clipping Indication", "HighlightThreshold")) { + highlightThreshold = keyFile.get_integer ("Clipping Indication", "HighlightThreshold"); + } + + if (keyFile.has_key ("Clipping Indication", "ShadowThreshold")) { + shadowThreshold = keyFile.get_integer ("Clipping Indication", "ShadowThreshold"); + } + + if (keyFile.has_key ("Clipping Indication", "BlinkClipped")) { + blinkClipped = keyFile.get_boolean ("Clipping Indication", "BlinkClipped"); + } + } + + if (keyFile.has_group ("Performance")) { + if (keyFile.has_key ("Performance", "RgbDenoiseThreadLimit")) { + rgbDenoiseThreadLimit = keyFile.get_integer ("Performance", "RgbDenoiseThreadLimit"); + } + + if ( keyFile.has_key ("Performance", "NRauto")) { + rtSettings.nrauto = keyFile.get_double ("Performance", "NRauto"); + } + + if ( keyFile.has_key ("Performance", "NRautomax")) { + rtSettings.nrautomax = keyFile.get_double ("Performance", "NRautomax"); + } + + if ( keyFile.has_key ("Performance", "NRhigh")) { + rtSettings.nrhigh = keyFile.get_double ("Performance", "NRhigh"); + } + + if (rtSettings.nrhigh == 0.0) { //avoid crash by division by zero in noise reduction + rtSettings.nrhigh = 0.45; + } + + if ( keyFile.has_key ("Performance", "NRWavlevel")) { + rtSettings.nrwavlevel = keyFile.get_integer ("Performance", "NRWavlevel"); + } + + if (keyFile.has_key ("Performance", "LevNR")) { + rtSettings.leveldnv = keyFile.get_integer ("Performance", "LevNR"); + } + + if (keyFile.has_key ("Performance", "LevNRTI")) { + rtSettings.leveldnti = keyFile.get_integer ("Performance", "LevNRTI"); + } + + if (keyFile.has_key ("Performance", "LevNRAUT")) { + rtSettings.leveldnaut = keyFile.get_integer ("Performance", "LevNRAUT"); + } + + if (keyFile.has_key ("Performance", "LevNRLISS")) { + rtSettings.leveldnliss = keyFile.get_integer ("Performance", "LevNRLISS"); + } + + if (keyFile.has_key ("Performance", "SIMPLNRAUT")) { + rtSettings.leveldnautsimpl = keyFile.get_integer ("Performance", "SIMPLNRAUT"); + } + + if (keyFile.has_key ("Performance", "ClutCacheSize")) { + clutCacheSize = keyFile.get_integer ("Performance", "ClutCacheSize"); + } + + if (keyFile.has_key ("Performance", "MaxInspectorBuffers")) { + maxInspectorBuffers = keyFile.get_integer ("Performance", "MaxInspectorBuffers"); + } + + if (keyFile.has_key ("Performance", "PreviewDemosaicFromSidecar")) { + prevdemo = (prevdemo_t)keyFile.get_integer ("Performance", "PreviewDemosaicFromSidecar"); + } + + if (keyFile.has_key ("Performance", "Daubechies")) { + rtSettings.daubech = keyFile.get_boolean ("Performance", "Daubechies"); + } + + if (keyFile.has_key ("Performance", "SerializeTiffRead")) { + serializeTiffRead = keyFile.get_boolean ("Performance", "SerializeTiffRead"); + } + } + + if (keyFile.has_group ("GUI")) { + if (keyFile.has_key ("GUI", "WindowWidth")) { + windowWidth = keyFile.get_integer ("GUI", "WindowWidth"); + } + + if (keyFile.has_key ("GUI", "WindowHeight")) { + windowHeight = keyFile.get_integer ("GUI", "WindowHeight"); + } + + if (keyFile.has_key ("GUI", "WindowX")) { + windowX = keyFile.get_integer ("GUI", "WindowX"); + } + + if (keyFile.has_key ("GUI", "WindowY")) { + windowY = keyFile.get_integer ("GUI", "WindowY"); + } + + if (keyFile.has_key ("GUI", "WindowMonitor")) { + windowMonitor = keyFile.get_integer ("GUI", "WindowMonitor"); + } + + if (keyFile.has_key ("GUI", "MeowMonitor")) { + meowMonitor = keyFile.get_integer ("GUI", "MeowMonitor"); + } + + if (keyFile.has_key ("GUI", "MeowFullScreen")) { + meowFullScreen = keyFile.get_boolean ("GUI", "MeowFullScreen"); + } + + if (keyFile.has_key ("GUI", "MeowMaximized")) { + meowMaximized = keyFile.get_boolean ("GUI", "MeowMaximized"); + } + + if (keyFile.has_key ("GUI", "MeowWidth")) { + meowWidth = keyFile.get_integer ("GUI", "MeowWidth"); + } + + if (keyFile.has_key ("GUI", "MeowHeight")) { + meowHeight = keyFile.get_integer ("GUI", "MeowHeight"); + } + + if (keyFile.has_key ("GUI", "MeowX")) { + meowX = keyFile.get_integer ("GUI", "MeowX"); + } + + if (keyFile.has_key ("GUI", "MeowY")) { + meowY = keyFile.get_integer ("GUI", "MeowY"); + } + + if (keyFile.has_key ("GUI", "WindowMaximized")) { + windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized"); + } + + if (keyFile.has_key ("GUI", "DetailWindowWidth")) { + detailWindowWidth = keyFile.get_integer ("GUI", "DetailWindowWidth"); + } + + if (keyFile.has_key ("GUI", "DetailWindowHeight")) { + detailWindowHeight = keyFile.get_integer ("GUI", "DetailWindowHeight"); + } + + if (keyFile.has_key ("GUI", "DirBrowserWidth")) { + dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth"); + } + + if (keyFile.has_key ("GUI", "DirBrowserHeight")) { + dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight"); + } + + if (keyFile.has_key ("GUI", "SortType")) { + dirBrowserSortType = static_cast (keyFile.get_integer ("GUI", "SortType")); + } + + if (keyFile.has_key ("GUI", "PreferencesWidth")) { + preferencesWidth = keyFile.get_integer ("GUI", "PreferencesWidth"); + } + + if (keyFile.has_key ("GUI", "PreferencesHeight")) { + preferencesHeight = keyFile.get_integer ("GUI", "PreferencesHeight"); + } + + if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) { + saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth"); + } + + if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) { + saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight"); + } + + if (keyFile.has_key ("GUI", "ToolPanelWidth")) { + toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth"); + } + + if (keyFile.has_key ("GUI", "BrowserToolPanelWidth")) { + browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth"); + } + + if (keyFile.has_key ("GUI", "BrowserToolPanelHeight")) { + browserToolPanelHeight = keyFile.get_integer ("GUI", "BrowserToolPanelHeight"); + } + + if (keyFile.has_key ("GUI", "BrowserToolPanelOpened")) { + browserToolPanelOpened = keyFile.get_boolean ("GUI", "BrowserToolPanelOpened"); + } + + if (keyFile.has_key ("GUI", "BrowserDirPanelOpened")) { + browserDirPanelOpened = keyFile.get_boolean ("GUI", "BrowserDirPanelOpened"); + } + + if (keyFile.has_key ("GUI", "EditorFilmStripOpened")) { + editorFilmStripOpened = keyFile.get_boolean ("GUI", "EditorFilmStripOpened"); + } + + if (keyFile.has_key ("GUI", "HistoryPanelWidth")) { + historyPanelWidth = keyFile.get_integer ("GUI", "HistoryPanelWidth"); + } + + if (keyFile.has_key ("GUI", "FontFamily")) { + fontFamily = keyFile.get_string ("GUI", "FontFamily"); + } + + if (keyFile.has_key ("GUI", "FontSize")) { + fontSize = keyFile.get_integer ("GUI", "FontSize"); + } + + if (keyFile.has_key ("GUI", "CPFontFamily")) { + CPFontFamily = keyFile.get_string ("GUI", "CPFontFamily"); + } + + if (keyFile.has_key ("GUI", "CPFontSize")) { + CPFontSize = keyFile.get_integer ("GUI", "CPFontSize"); + } + + if (keyFile.has_key ("GUI", "LastPreviewScale")) { + lastScale = keyFile.get_integer ("GUI", "LastPreviewScale"); + } + + if (keyFile.has_key ("GUI", "PanAccelFactor")) { + panAccelFactor = keyFile.get_integer ("GUI", "PanAccelFactor"); + } + + if (keyFile.has_key ("GUI", "RememberZoomAndPan")) { + rememberZoomAndPan = keyFile.get_boolean ("GUI", "RememberZoomAndPan"); + } + + if (keyFile.has_key ("GUI", "LastCropSize")) { + lastCropSize = keyFile.get_integer ("GUI", "LastCropSize"); + } + + if (keyFile.has_key ("GUI", "ShowHistory")) { + showHistory = keyFile.get_boolean ("GUI", "ShowHistory"); + } + + if (keyFile.has_key ("GUI", "ShowFilePanelState")) { + showFilePanelState = keyFile.get_integer ("GUI", "ShowFilePanelState"); + } + + if (keyFile.has_key ("GUI", "ShowInfo")) { + showInfo = keyFile.get_boolean ("GUI", "ShowInfo"); + } + + if (keyFile.has_key ("GUI", "MainNBVertical")) { + mainNBVertical = keyFile.get_boolean ("GUI", "MainNBVertical"); + } + + if (keyFile.has_key ("GUI", "ShowClippedHighlights")) { + showClippedHighlights = keyFile.get_boolean ("GUI", "ShowClippedHighlights"); + } + + if (keyFile.has_key ("GUI", "ShowClippedShadows")) { + showClippedShadows = keyFile.get_boolean ("GUI", "ShowClippedShadows"); + } + + if (keyFile.has_key ("GUI", "FrameColor")) { + bgcolor = keyFile.get_integer ("GUI", "FrameColor"); + } + + if (keyFile.has_key ("GUI", "ProcessingQueueEnbled")) { + procQueueEnabled = keyFile.get_boolean ("GUI", "ProcessingQueueEnbled"); + } + + if (keyFile.has_key ("GUI", "ToolPanelsExpanded")) { + tpOpen = keyFile.get_integer_list ("GUI", "ToolPanelsExpanded"); + } + + if (keyFile.has_key ("GUI", "ToolPanelsExpandedAutoSave")) { + autoSaveTpOpen = keyFile.get_boolean ("GUI", "ToolPanelsExpandedAutoSave"); + } + + if (keyFile.has_key ("GUI", "MultiDisplayMode")) { + multiDisplayMode = keyFile.get_integer ("GUI", "MultiDisplayMode"); + } + + //if (keyFile.has_key ("GUI", "CurvePanelsExpanded")) crvOpen = keyFile.get_integer_list ("GUI", "CurvePanelsExpanded"); + if (keyFile.has_key ("GUI", "CutOverlayBrush")) { + cutOverlayBrush = keyFile.get_double_list ("GUI", "CutOverlayBrush"); + } + + if (keyFile.has_key ("GUI", "NavGuideBrush")) { + navGuideBrush = keyFile.get_double_list ("GUI", "NavGuideBrush"); + } + + if (keyFile.has_key ("GUI", "HistogramPosition")) { + histogramPosition = keyFile.get_integer ("GUI", "HistogramPosition"); + } + + if (keyFile.has_key ("GUI", "HistogramBar")) { + histogramBar = keyFile.get_boolean ("GUI", "HistogramBar"); + } + + if (keyFile.has_key ("GUI", "HistogramFullMode")) { + histogramFullMode = keyFile.get_boolean ("GUI", "HistogramFullMode"); + } + + if (keyFile.has_key ("GUI", "NavigatorRGBUnit")) { + navRGBUnit = (NavigatorUnit)keyFile.get_integer ("GUI", "NavigatorRGBUnit"); + } + + if (keyFile.has_key ("GUI", "NavigatorHSVUnit")) { + navHSVUnit = (NavigatorUnit)keyFile.get_integer ("GUI", "NavigatorHSVUnit"); + } + + if (keyFile.has_key ("GUI", "ShowFilmStripToolBar")) { + showFilmStripToolBar = keyFile.get_boolean ("GUI", "ShowFilmStripToolBar"); + } + + if (keyFile.has_key ("GUI", "FileBrowserToolbarSingleRow")) { + FileBrowserToolbarSingleRow = keyFile.get_boolean ("GUI", "FileBrowserToolbarSingleRow"); + } + + if (keyFile.has_key ("GUI", "HideTPVScrollbar")) { + hideTPVScrollbar = keyFile.get_boolean ("GUI", "HideTPVScrollbar"); + } + + if (keyFile.has_key ("GUI", "UseIconNoText")) { + UseIconNoText = keyFile.get_boolean ("GUI", "UseIconNoText"); + } + + if (keyFile.has_key ("GUI", "HistogramWorking")) { + rtSettings.HistogramWorking = keyFile.get_boolean ("GUI", "HistogramWorking"); + } + + if (keyFile.has_key ("GUI", "CurveBBoxPosition")) { + curvebboxpos = keyFile.get_integer ("GUI", "CurveBBoxPosition"); + } + } + + if (keyFile.has_group ("Crop Settings")) { + if (keyFile.has_key ("Crop Settings", "PPI")) { + cropPPI = keyFile.get_integer ("Crop Settings", "PPI"); + } + } + + if (keyFile.has_group ("Color Management")) { + if (keyFile.has_key ("Color Management", "ICCDirectory")) { + rtSettings.iccDirectory = keyFile.get_string ("Color Management", "ICCDirectory"); + } + + if (keyFile.has_key ("Color Management", "PrinterIntent")) { + rtSettings.printerIntent = static_cast (keyFile.get_integer ("Color Management", "PrinterIntent")); + } + + if (keyFile.has_key ("Color Management", "PrinterBPC")) { + rtSettings.printerBPC = keyFile.get_boolean ("Color Management", "PrinterBPC"); + } + + if (keyFile.has_key ("Color Management", "PrinterProfile")) { + rtSettings.printerProfile = keyFile.get_string ("Color Management", "PrinterProfile"); + } + + if (keyFile.has_key ("Color Management", "MonitorProfile")) { + rtSettings.monitorProfile = keyFile.get_string ("Color Management", "MonitorProfile"); + } + + if (keyFile.has_key ("Color Management", "AutoMonitorProfile")) { + rtSettings.autoMonitorProfile = keyFile.get_boolean ("Color Management", "AutoMonitorProfile"); + } + + if (keyFile.has_key ("Color Management", "Autocielab")) { + rtSettings.autocielab = keyFile.get_boolean ("Color Management", "Autocielab"); + } + + if (keyFile.has_key ("Color Management", "RGBcurvesLumamode_Gamut")) { + rtSettings.rgbcurveslumamode_gamut = keyFile.get_boolean ("Color Management", "RGBcurvesLumamode_Gamut"); + } + + if (keyFile.has_key ("Color Management", "Intent")) { + rtSettings.monitorIntent = static_cast (keyFile.get_integer ("Color Management", "Intent")); + } + + if (keyFile.has_key ("Color Management", "MonitorBPC")) { + rtSettings.monitorBPC = keyFile.get_boolean ("Color Management", "MonitorBPC"); + } + + if (keyFile.has_key ("Color Management", "CRI")) { + rtSettings.CRI_color = keyFile.get_integer ("Color Management", "CRI"); + } + + if (keyFile.has_key ("Color Management", "DenoiseLabgamma")) { + rtSettings.denoiselabgamma = keyFile.get_integer ("Color Management", "DenoiseLabgamma"); + } + + /* + if (keyFile.has_key ("Color Management", "view")) { + rtSettings.viewingdevice = keyFile.get_integer ("Color Management", "view"); + } + + if (keyFile.has_key ("Color Management", "grey")) { + rtSettings.viewingdevicegrey = keyFile.get_integer ("Color Management", "grey"); + } + */ + /* + if (keyFile.has_key ("Color Management", "greySc")) { + rtSettings.viewinggreySc = keyFile.get_integer ("Color Management", "greySc"); + } + */ + if (keyFile.has_key ("Color Management", "CBDLArtif")) { + rtSettings.artifact_cbdl = keyFile.get_double ("Color Management", "CBDLArtif"); + } + + if (keyFile.has_key ("Color Management", "CBDLlevel0")) { + rtSettings.level0_cbdl = keyFile.get_double ("Color Management", "CBDLlevel0"); + } + + if (keyFile.has_key ("Color Management", "CBDLlevel123")) { + rtSettings.level123_cbdl = keyFile.get_double ("Color Management", "CBDLlevel123"); + } + + //if (keyFile.has_key ("Color Management", "Colortoningab")) rtSettings.colortoningab = keyFile.get_double("Color Management", "Colortoningab"); + //if (keyFile.has_key ("Color Management", "Decaction")) rtSettings.decaction = keyFile.get_double("Color Management", "Decaction"); + + if (keyFile.has_key ("Color Management", "WhiteBalanceSpotSize")) { + whiteBalanceSpotSize = keyFile.get_integer ("Color Management", "WhiteBalanceSpotSize"); + } + + if ( keyFile.has_key ("Color Management", "GamutICC")) { + rtSettings.gamutICC = keyFile.get_boolean ("Color Management", "GamutICC"); + } + + //if ( keyFile.has_key ("Color Management", "BWcomplement")) rtSettings.bw_complementary = keyFile.get_boolean("Color Management", "BWcomplement"); + if ( keyFile.has_key ("Color Management", "Ciecamfloat")) { + rtSettings.ciecamfloat = keyFile.get_boolean ("Color Management", "Ciecamfloat"); + } + + if ( keyFile.has_key ("Color Management", "AdobeRGB")) { + rtSettings.adobe = keyFile.get_string ("Color Management", "AdobeRGB"); + } + + if ( keyFile.has_key ("Color Management", "ProPhoto")) { + rtSettings.prophoto = keyFile.get_string ("Color Management", "ProPhoto"); + } + + if ( keyFile.has_key ("Color Management", "ProPhoto10")) { + rtSettings.prophoto10 = keyFile.get_string ("Color Management", "ProPhoto10"); + } + + if ( keyFile.has_key ("Color Management", "WideGamut")) { + rtSettings.widegamut = keyFile.get_string ("Color Management", "WideGamut"); + } + + if ( keyFile.has_key ("Color Management", "sRGB")) { + rtSettings.srgb = keyFile.get_string ("Color Management", "sRGB"); + } + + if ( keyFile.has_key ("Color Management", "sRGB10")) { + rtSettings.srgb10 = keyFile.get_string ("Color Management", "sRGB10"); + } + + if ( keyFile.has_key ("Color Management", "Beta")) { + rtSettings.beta = keyFile.get_string ("Color Management", "Beta"); + } + + if ( keyFile.has_key ("Color Management", "Best")) { + rtSettings.best = keyFile.get_string ("Color Management", "Best"); + } + + if ( keyFile.has_key ("Color Management", "Rec2020")) { + rtSettings.rec2020 = keyFile.get_string ("Color Management", "Rec2020"); + } + + if ( keyFile.has_key ("Color Management", "Bruce")) { + rtSettings.bruce = keyFile.get_string ("Color Management", "Bruce"); + } + + if ( keyFile.has_key ("Color Management", "GamutLch")) { + rtSettings.gamutLch = keyFile.get_boolean ("Color Management", "GamutLch"); + } + + if ( keyFile.has_key ("Color Management", "ProtectRed")) { + rtSettings.protectred = keyFile.get_integer ("Color Management", "ProtectRed"); + } + + if ( keyFile.has_key ("Color Management", "ProtectRedH")) { + rtSettings.protectredh = keyFile.get_double ("Color Management", "ProtectRedH"); + } + + if ( keyFile.has_key ("Color Management", "Amountchroma")) { + rtSettings.amchroma = keyFile.get_integer ("Color Management", "Amountchroma"); + } + + if ( keyFile.has_key ("Color Management", "ClutsDirectory")) { + clutsDir = keyFile.get_string ("Color Management", "ClutsDirectory"); + } + + //if( keyFile.has_key ("Color Management", "Ciebadpixgauss")) rtSettings.ciebadpixgauss = keyFile.get_boolean("Color Management", "Ciebadpixgauss"); + + } + + if (keyFile.has_group ("Batch Processing")) { + if (keyFile.has_key ("Batch Processing", "AdjusterBehavior")) { + baBehav = keyFile.get_integer_list ("Batch Processing", "AdjusterBehavior"); + } + } + + if (keyFile.has_group ("Sounds")) { + if (keyFile.has_key ("Sounds", "Enable")) { + sndEnable = keyFile.get_boolean ("Sounds", "Enable"); + } + + if (keyFile.has_key ("Sounds", "BatchQueueDone")) { + sndBatchQueueDone = keyFile.get_string ("Sounds", "BatchQueueDone"); + } + + if (keyFile.has_key ("Sounds", "LngEditProcDone")) { + sndLngEditProcDone = keyFile.get_string ("Sounds", "LngEditProcDone"); + } + + if (keyFile.has_key ("Sounds", "LngEditProcDoneSecs")) { + sndLngEditProcDoneSecs = keyFile.get_double ("Sounds", "LngEditProcDoneSecs"); + } + } + + if (keyFile.has_group ("Fast Export")) { + if (keyFile.has_key ("Fast Export", "fastexport_bypass_sharpening" )) { + fastexport_bypass_sharpening = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sharpening" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_sharpenEdge" )) { + fastexport_bypass_sharpenEdge = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sharpenEdge" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_sharpenMicro" )) { + fastexport_bypass_sharpenMicro = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sharpenMicro" ); + } + + //if (keyFile.has_key ("Fast Export", "fastexport_bypass_lumaDenoise" )) fastexport_bypass_lumaDenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_lumaDenoise" ); + //if (keyFile.has_key ("Fast Export", "fastexport_bypass_colorDenoise" )) fastexport_bypass_colorDenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_colorDenoise" ); + if (keyFile.has_key ("Fast Export", "fastexport_bypass_defringe" )) { + fastexport_bypass_defringe = keyFile.get_boolean ("Fast Export", "fastexport_bypass_defringe" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_dirpyrDenoise" )) { + fastexport_bypass_dirpyrDenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_dirpyrDenoise" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_sh_hq" )) { + fastexport_bypass_sh_hq = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sh_hq" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_dirpyrequalizer" )) { + fastexport_bypass_dirpyrequalizer = keyFile.get_boolean ("Fast Export", "fastexport_bypass_dirpyrequalizer" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_wavelet" )) { + fastexport_bypass_wavelet = keyFile.get_boolean ("Fast Export", "fastexport_bypass_wavelet" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_raw_dmethod" )) { + fastexport_raw_bayer_method = keyFile.get_string ("Fast Export", "fastexport_raw_dmethod" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_raw_bayer_method" )) { + fastexport_raw_bayer_method = keyFile.get_string ("Fast Export", "fastexport_raw_bayer_method" ); + } + +//if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_all_enhance" )) fastexport_bypass_raw_bayer_all_enhance = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_all_enhance" ); + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_dcb_iterations" )) { + fastexport_bypass_raw_bayer_dcb_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_dcb_iterations" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations" )) { + fastexport_bypass_raw_bayer_dcb_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_dcb_enhance" )) { + fastexport_bypass_raw_bayer_dcb_enhance = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_dcb_enhance" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance" )) { + fastexport_bypass_raw_bayer_dcb_enhance = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_lmmse_iterations" )) { + fastexport_bypass_raw_bayer_lmmse_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_lmmse_iterations" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations")) { + fastexport_bypass_raw_bayer_lmmse_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations"); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_linenoise" )) { + fastexport_bypass_raw_bayer_linenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_linenoise" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_linenoise" )) { + fastexport_bypass_raw_bayer_linenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_linenoise" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_greenthresh" )) { + fastexport_bypass_raw_bayer_greenthresh = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_greenthresh" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh" )) { + fastexport_bypass_raw_bayer_greenthresh = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_raw_xtrans_method" )) { + fastexport_raw_xtrans_method = keyFile.get_string ("Fast Export", "fastexport_raw_xtrans_method" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_ccSteps" )) { + fastexport_bypass_raw_ccSteps = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_ccSteps" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_ca" )) { + fastexport_bypass_raw_ca = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_ca" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_df" )) { + fastexport_bypass_raw_df = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_df" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_ff" )) { + fastexport_bypass_raw_ff = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_ff" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_icm_input" )) { + fastexport_icm_input = keyFile.get_string ("Fast Export", "fastexport_icm_input" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_icm_working" )) { + fastexport_icm_working = keyFile.get_string ("Fast Export", "fastexport_icm_working" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_icm_output" )) { + fastexport_icm_output = keyFile.get_string ("Fast Export", "fastexport_icm_output" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_icm_output_intent" )) { + fastexport_icm_outputIntent = static_cast (keyFile.get_integer ("Fast Export", "fastexport_icm_output_intent" )); + } + + if (keyFile.has_key ("Fast Export", "fastexport_icm_output_bpc" )) { + fastexport_icm_outputBPC = keyFile.get_boolean ("Fast Export", "fastexport_icm_output_bpc" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_icm_gamma" )) { + fastexport_icm_gamma = keyFile.get_string ("Fast Export", "fastexport_icm_gamma" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_enabled" )) { + fastexport_resize_enabled = keyFile.get_boolean ("Fast Export", "fastexport_resize_enabled" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_scale" )) { + fastexport_resize_scale = keyFile.get_double ("Fast Export", "fastexport_resize_scale" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_appliesTo" )) { + fastexport_resize_appliesTo = keyFile.get_string ("Fast Export", "fastexport_resize_appliesTo" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_method" )) { + fastexport_resize_method = keyFile.get_string ("Fast Export", "fastexport_resize_method" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_dataspec" )) { + fastexport_resize_dataspec = keyFile.get_integer ("Fast Export", "fastexport_resize_dataspec" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_width" )) { + fastexport_resize_width = keyFile.get_integer ("Fast Export", "fastexport_resize_width" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_resize_height" )) { + fastexport_resize_height = keyFile.get_integer ("Fast Export", "fastexport_resize_height" ); + } + + if (keyFile.has_key ("Fast Export", "fastexport_use_fast_pipeline" )) { + fastexport_use_fast_pipeline = keyFile.get_integer ("Fast Export", "fastexport_use_fast_pipeline" ); + } + } + + if (keyFile.has_group ("Dialogs")) { + safeDirGet (keyFile, "Dialogs", "LastIccDir", lastIccDir); + safeDirGet (keyFile, "Dialogs", "LastDarkframeDir", lastDarkframeDir); + safeDirGet (keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir); + safeDirGet (keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastRetinexDir", lastRetinexDir); + safeDirGet (keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastBWCurvesDir", lastBWCurvesDir); + + safeDirGet (keyFile, "Dialogs", "LastToneCurvesDir", lastToneCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); + safeDirGet (keyFile, "Dialogs", "LastLensProfileDir", lastLensProfileDir); + + if (keyFile.has_key ("Dialogs", "GimpPluginShowInfoDialog")) { + gimpPluginShowInfoDialog = keyFile.get_boolean ("Dialogs", "GimpPluginShowInfoDialog"); + } + } + + if (keyFile.has_group ("Lensfun")) { + if (keyFile.has_key ("Lensfun", "DBDirectory")) { + rtSettings.lensfunDbDirectory = keyFile.get_string ("Lensfun", "DBDirectory"); + } + } + +// -------------------------------------------------------------------------------------------------------- + + filterOutParsedExtensions (); + + return; + + } + } catch (Glib::Error &err) { + Glib::ustring msg = Glib::ustring::compose ("Options::readFromFile / Error code %1 while reading values from \"%2\":\n%3", err.code(), fname, err.what()); + + if (options.rtSettings.verbose) { + printf ("%s\n", msg.c_str()); + } + + throw Error (msg); + } catch (...) { + Glib::ustring msg = Glib::ustring::compose ("Options::readFromFile / Unknown exception while trying to load \"%1\"!", fname); + + if (options.rtSettings.verbose) { + printf ("%s\n", msg.c_str()); + } + + throw Error (msg); + } +} + +bool Options::safeDirGet (const Glib::KeyFile& keyFile, const Glib::ustring& section, + const Glib::ustring& entryName, Glib::ustring& destination) +{ + try { + + if (keyFile.has_key (section, entryName) && !keyFile.get_string (section, entryName).empty ()) { + destination = keyFile.get_string (section, entryName); + return true; + } + + } catch (Glib::KeyFileError&) {} + + return false; +} + +void Options::saveToFile (Glib::ustring fname) +{ + + Glib::ustring keyData; + + try { + + Glib::KeyFile keyFile; + + keyFile.set_boolean ("General", "TabbedEditor", tabbedUI); + keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit); + + if (startupDir == STARTUPDIR_HOME) { + keyFile.set_string ("General", "StartupDirectory", "home"); + } else if (startupDir == STARTUPDIR_CURRENT) { + keyFile.set_string ("General", "StartupDirectory", "current"); + } else if (startupDir == STARTUPDIR_CUSTOM) { + keyFile.set_string ("General", "StartupDirectory", "custom"); + } else if (startupDir == STARTUPDIR_LAST) { + keyFile.set_string ("General", "StartupDirectory", "last"); + } + + keyFile.set_string ("General", "StartupPath", startupPath); + keyFile.set_string ("General", "DateFormat", dateFormat); + keyFile.set_integer ("General", "AdjusterMinDelay", adjusterMinDelay); + keyFile.set_integer ("General", "AdjusterMaxDelay", adjusterMaxDelay); + keyFile.set_boolean ("General", "MultiUser", multiUser); + keyFile.set_string ("General", "Language", language); + keyFile.set_boolean ("General", "LanguageAutoDetect", languageAutoDetect); + keyFile.set_string ("General", "Theme", theme); + keyFile.set_string ("General", "Version", RTVERSION); + keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); + keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); + keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); + keyFile.set_double ("General", "BotLeft", rtSettings.bot_left); + keyFile.set_double ("General", "TopLeft", rtSettings.top_left); + keyFile.set_double ("General", "TopRight", rtSettings.top_right); + keyFile.set_double ("General", "BotRight", rtSettings.bot_right); + keyFile.set_double ("General", "EDdetec", rtSettings.ed_detec); + keyFile.set_double ("General", "EDdetecStr", rtSettings.ed_detecStr); + keyFile.set_double ("General", "EDLow", rtSettings.ed_low); + keyFile.set_double ("General", "EDLipinfl", rtSettings.ed_lipinfl); + keyFile.set_double ("General", "EDLipampl", rtSettings.ed_lipampl); + + + keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); + keyFile.set_string ("External Editor", "GimpDir", gimpDir); + keyFile.set_string ("External Editor", "PhotoshopDir", psDir); + keyFile.set_string ("External Editor", "CustomEditor", customEditorProg); + + keyFile.set_boolean ("File Browser", "BrowseOnlyRaw", fbOnlyRaw); + keyFile.set_boolean ("File Browser", "BrowserShowsDate", fbShowDateTime); + keyFile.set_boolean ("File Browser", "BrowserShowsExif", fbShowBasicExif); + keyFile.set_boolean ("File Browser", "BrowserShowsExpComp", fbShowExpComp); + keyFile.set_boolean ("File Browser", "BrowserShowsHidden", fbShowHidden); + keyFile.set_integer ("File Browser", "ThumbnailSize", thumbSize); + keyFile.set_integer ("File Browser", "ThumbnailSizeTab", thumbSizeTab); + keyFile.set_integer ("File Browser", "ThumbnailSizeQueue", thumbSizeQueue); + keyFile.set_integer ("File Browser", "SameThumbSize", sameThumbSize); + keyFile.set_integer ("File Browser", "MaxPreviewHeight", maxThumbnailHeight); + keyFile.set_integer ("File Browser", "MaxCacheEntries", maxCacheEntries); + Glib::ArrayHandle pext = parseExtensions; + keyFile.set_string_list ("File Browser", "ParseExtensions", pext); + Glib::ArrayHandle pextena = parseExtensionsEnabled; + keyFile.set_integer_list ("File Browser", "ParseExtensionsEnabled", pextena); + keyFile.set_integer ("File Browser", "ThumbnailArrangement", fbArrangement); + keyFile.set_integer ("File Browser", "ThumbnailInterpolation", thumbInterp); + Glib::ArrayHandle pfav = favoriteDirs; + keyFile.set_string_list ("File Browser", "FavoriteDirs", pfav); + Glib::ArrayHandle pren = renameTemplates; + keyFile.set_string_list ("File Browser", "RenameTemplates", pren); + keyFile.set_boolean ("File Browser", "RenameUseTemplates", renameUseTemplates); + Glib::ArrayHandle ptzoom = thumbnailZoomRatios; + keyFile.set_double_list ("File Browser", "ThumbnailZoomRatios", ptzoom); + keyFile.set_boolean ("File Browser", "OverlayedFileNames", overlayedFileNames); + keyFile.set_boolean ("File Browser", "FilmStripOverlayedFileNames", filmStripOverlayedFileNames); + keyFile.set_boolean ("File Browser", "ShowFileNames", showFileNames ); + keyFile.set_boolean ("File Browser", "FilmStripShowFileNames", filmStripShowFileNames ); + keyFile.set_boolean ("File Browser", "InternalThumbIfUntouched", internalThumbIfUntouched ); + keyFile.set_boolean ("File Browser", "menuGroupRank", menuGroupRank); + keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel); + keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations); + keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations); + keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg); + keyFile.set_integer ("File Browser", "MaxRecentFolders", maxRecentFolders); + { + std::vector temp; + temp.reserve (maxRecentFolders); + + for (unsigned int i = 0; i < std::min (recentFolders.size(), maxRecentFolders); i++) { + temp.push_back (recentFolders[i]); + } + + keyFile.set_string_list ("File Browser", "RecentFolders", temp); + } + keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); + keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); + keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); + + keyFile.set_integer ("Performance", "RgbDenoiseThreadLimit", rgbDenoiseThreadLimit); + keyFile.set_double ("Performance", "NRauto", rtSettings.nrauto); + keyFile.set_double ("Performance", "NRautomax", rtSettings.nrautomax); + keyFile.set_double ("Performance", "NRhigh", rtSettings.nrhigh); + keyFile.set_integer ("Performance", "NRWavlevel", rtSettings.nrwavlevel); + keyFile.set_integer ("Performance", "LevNR", rtSettings.leveldnv); + keyFile.set_integer ("Performance", "LevNRTI", rtSettings.leveldnti); + keyFile.set_integer ("Performance", "LevNRAUT", rtSettings.leveldnaut); + keyFile.set_integer ("Performance", "LevNRLISS", rtSettings.leveldnliss); + keyFile.set_integer ("Performance", "SIMPLNRAUT", rtSettings.leveldnautsimpl); + keyFile.set_integer ("Performance", "ClutCacheSize", clutCacheSize); + keyFile.set_integer ("Performance", "MaxInspectorBuffers", maxInspectorBuffers); + keyFile.set_integer ("Performance", "PreviewDemosaicFromSidecar", prevdemo); + keyFile.set_boolean ("Performance", "Daubechies", rtSettings.daubech); + keyFile.set_boolean ("Performance", "SerializeTiffRead", serializeTiffRead); + + keyFile.set_string ("Output", "Format", saveFormat.format); + keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); + keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); + keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); + keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); + keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); + keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); + keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); + + keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format); + keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality); + keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp); + keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression); + keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits); + keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits); + keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed); + keyFile.set_boolean ("Output", "SaveProcParamsBatch", saveFormatBatch.saveParams); + + keyFile.set_string ("Output", "PathTemplate", savePathTemplate); + keyFile.set_string ("Output", "PathFolder", savePathFolder); + keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix); + keyFile.set_boolean ("Output", "ForceFormatOpts", forceFormatOpts); + keyFile.set_integer ("Output", "SaveMethodNum", saveMethodNum); + 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); + keyFile.set_string ("Profiles", "LoadSaveProfilePath", loadSaveProfilePath); + keyFile.set_string ("Profiles", "RawDefault", defProfRaw); + keyFile.set_string ("Profiles", "ImgDefault", defProfImg); + keyFile.set_boolean ("Profiles", "FilledProfile", filledProfile); + keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); + keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); + keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); + keyFile.set_string ("Profiles", "CustomProfileBuilderPath", CPBPath); + keyFile.set_integer ("Profiles", "CustomProfileBuilderKeys", CPBKeys); + + keyFile.set_integer ("GUI", "WindowWidth", windowWidth); + keyFile.set_integer ("GUI", "WindowHeight", windowHeight); + keyFile.set_integer ("GUI", "WindowX", windowX); + keyFile.set_integer ("GUI", "WindowY", windowY); + keyFile.set_integer ("GUI", "WindowMonitor", windowMonitor); + keyFile.set_integer ("GUI", "MeowMonitor", meowMonitor); + keyFile.set_boolean ("GUI", "MeowFullScreen", meowFullScreen); + keyFile.set_boolean ("GUI", "MeowMaximized", meowMaximized); + keyFile.set_integer ("GUI", "MeowWidth", meowWidth); + keyFile.set_integer ("GUI", "MeowHeight", meowHeight); + keyFile.set_integer ("GUI", "MeowX", meowX); + keyFile.set_integer ("GUI", "MeowY", meowY); + keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); + keyFile.set_integer ("GUI", "DetailWindowWidth", detailWindowWidth); + keyFile.set_integer ("GUI", "DetailWindowHeight", detailWindowHeight); + keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); + keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); + keyFile.set_integer ("GUI", "SortType", dirBrowserSortType); + keyFile.set_integer ("GUI", "PreferencesWidth", preferencesWidth); + keyFile.set_integer ("GUI", "PreferencesHeight", preferencesHeight); + keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth); + keyFile.set_integer ("GUI", "SaveAsDialogHeight", saveAsDialogHeight); + keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth); + keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth); + keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight); + keyFile.set_boolean ("GUI", "BrowserToolPanelOpened", browserToolPanelOpened); + keyFile.set_boolean ("GUI", "EditorFilmStripOpened", editorFilmStripOpened); + keyFile.set_boolean ("GUI", "BrowserDirPanelOpened", browserDirPanelOpened); + keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth); + keyFile.set_string ("GUI", "FontFamily", fontFamily); + keyFile.set_integer ("GUI", "FontSize", fontSize); + keyFile.set_string ("GUI", "CPFontFamily", CPFontFamily); + keyFile.set_integer ("GUI", "CPFontSize", CPFontSize); + keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); + keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor); + keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan); + keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); + keyFile.set_boolean ("GUI", "ShowHistory", showHistory); + keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); + keyFile.set_boolean ("GUI", "ShowInfo", showInfo); + keyFile.set_boolean ("GUI", "MainNBVertical", mainNBVertical); + keyFile.set_boolean ("GUI", "ShowClippedHighlights", showClippedHighlights); + keyFile.set_boolean ("GUI", "ShowClippedShadows", showClippedShadows); + keyFile.set_integer ("GUI", "FrameColor", bgcolor); + keyFile.set_boolean ("GUI", "ProcessingQueueEnbled", procQueueEnabled); + Glib::ArrayHandle tpopen = tpOpen; + keyFile.set_integer_list ("GUI", "ToolPanelsExpanded", tpopen); + keyFile.set_boolean ("GUI", "ToolPanelsExpandedAutoSave", autoSaveTpOpen); + keyFile.set_integer ("GUI", "MultiDisplayMode", multiDisplayMode); + keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); + keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); + keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); + keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); + keyFile.set_boolean ("GUI", "HistogramFullMode", histogramFullMode); + keyFile.set_integer ("GUI", "NavigatorRGBUnit", (int)navRGBUnit); + keyFile.set_integer ("GUI", "NavigatorHSVUnit", (int)navHSVUnit); + keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar); + keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow); + keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar); + keyFile.set_boolean ("GUI", "UseIconNoText", UseIconNoText); + keyFile.set_boolean ("GUI", "HistogramWorking", rtSettings.HistogramWorking); + keyFile.set_integer ("GUI", "CurveBBoxPosition", curvebboxpos); + + //Glib::ArrayHandle crvopen = crvOpen; + //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); + + keyFile.set_integer ("Crop Settings", "PPI", cropPPI); + + keyFile.set_string ("Color Management", "PrinterProfile", rtSettings.printerProfile); + keyFile.set_integer ("Color Management", "PrinterIntent", rtSettings.printerIntent); + keyFile.set_boolean ("Color Management", "PrinterBPC", rtSettings.printerBPC); + + keyFile.set_string ("Color Management", "ICCDirectory", rtSettings.iccDirectory); + keyFile.set_string ("Color Management", "MonitorProfile", rtSettings.monitorProfile); + keyFile.set_boolean ("Color Management", "AutoMonitorProfile", rtSettings.autoMonitorProfile); + keyFile.set_boolean ("Color Management", "Autocielab", rtSettings.autocielab); + keyFile.set_boolean ("Color Management", "RGBcurvesLumamode_Gamut", rtSettings.rgbcurveslumamode_gamut); + keyFile.set_integer ("Color Management", "Intent", rtSettings.monitorIntent); + keyFile.set_boolean ("Color Management", "MonitorBPC", rtSettings.monitorBPC); + //keyFile.set_integer ("Color Management", "view", rtSettings.viewingdevice); + //keyFile.set_integer ("Color Management", "grey", rtSettings.viewingdevicegrey); +// keyFile.set_integer ("Color Management", "greySc", rtSettings.viewinggreySc); + + keyFile.set_string ("Color Management", "AdobeRGB", rtSettings.adobe); + keyFile.set_string ("Color Management", "ProPhoto", rtSettings.prophoto); + keyFile.set_string ("Color Management", "ProPhoto10", rtSettings.prophoto10); + keyFile.set_string ("Color Management", "WideGamut", rtSettings.widegamut); + keyFile.set_string ("Color Management", "sRGB", rtSettings.srgb); + keyFile.set_string ("Color Management", "sRGB10", rtSettings.srgb10); + keyFile.set_string ("Color Management", "Beta", rtSettings.beta); + keyFile.set_string ("Color Management", "Best", rtSettings.best); + keyFile.set_string ("Color Management", "Rec2020", rtSettings.rec2020); + keyFile.set_string ("Color Management", "Bruce", rtSettings.bruce); + keyFile.set_integer ("Color Management", "WhiteBalanceSpotSize", whiteBalanceSpotSize); + keyFile.set_boolean ("Color Management", "GamutICC", rtSettings.gamutICC); + //keyFile.set_boolean ("Color Management", "BWcomplement", rtSettings.bw_complementary); + keyFile.set_boolean ("Color Management", "Ciecamfloat", rtSettings.ciecamfloat); + keyFile.set_boolean ("Color Management", "GamutLch", rtSettings.gamutLch); + keyFile.set_integer ("Color Management", "ProtectRed", rtSettings.protectred); + keyFile.set_integer ("Color Management", "Amountchroma", rtSettings.amchroma); + keyFile.set_double ("Color Management", "ProtectRedH", rtSettings.protectredh); + keyFile.set_integer ("Color Management", "CRI", rtSettings.CRI_color); + keyFile.set_integer ("Color Management", "DenoiseLabgamma", rtSettings.denoiselabgamma); + //keyFile.set_boolean ("Color Management", "Ciebadpixgauss", rtSettings.ciebadpixgauss); + keyFile.set_double ("Color Management", "CBDLArtif", rtSettings.artifact_cbdl); + keyFile.set_double ("Color Management", "CBDLlevel0", rtSettings.level0_cbdl); + keyFile.set_double ("Color Management", "CBDLlevel123", rtSettings.level123_cbdl); + //keyFile.set_double ("Color Management", "Colortoningab", rtSettings.colortoningab); + //keyFile.set_double ("Color Management", "Decaction", rtSettings.decaction); + keyFile.set_string ("Color Management", "ClutsDirectory", clutsDir); + + + Glib::ArrayHandle bab = baBehav; + keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); + + keyFile.set_boolean ("Sounds", "Enable", sndEnable); + keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone); + keyFile.set_string ("Sounds", "LngEditProcDone", sndLngEditProcDone); + keyFile.set_double ("Sounds", "LngEditProcDoneSecs", sndLngEditProcDoneSecs); + + + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpening", fastexport_bypass_sharpening); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenEdge", fastexport_bypass_sharpenEdge); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenMicro", fastexport_bypass_sharpenMicro); + //keyFile.set_boolean ("Fast Export", "fastexport_bypass_lumaDenoise" , fastexport_bypass_lumaDenoise); + //keyFile.set_boolean ("Fast Export", "fastexport_bypass_colorDenoise" , fastexport_bypass_colorDenoise); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_defringe", fastexport_bypass_defringe); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrDenoise", fastexport_bypass_dirpyrDenoise); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sh_hq", fastexport_bypass_sh_hq); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrequalizer", fastexport_bypass_dirpyrequalizer); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_wavelet", fastexport_bypass_wavelet); + keyFile.set_string ("Fast Export", "fastexport_raw_bayer_method", fastexport_raw_bayer_method); + //keyFile.set_boolean ("Fast Export", "fastexport_bypass_bayer_raw_all_enhance" , fastexport_bypass_raw_bayer_all_enhance); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations", fastexport_bypass_raw_bayer_dcb_iterations); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance", fastexport_bypass_raw_bayer_dcb_enhance); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations", fastexport_bypass_raw_bayer_lmmse_iterations); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_linenoise", fastexport_bypass_raw_bayer_linenoise); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh", fastexport_bypass_raw_bayer_greenthresh); + keyFile.set_string ("Fast Export", "fastexport_raw_xtrans_method", fastexport_raw_xtrans_method); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ccSteps", fastexport_bypass_raw_ccSteps); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ca", fastexport_bypass_raw_ca); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_df", fastexport_bypass_raw_df); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ff", fastexport_bypass_raw_ff); + keyFile.set_string ("Fast Export", "fastexport_icm_input", fastexport_icm_input); + keyFile.set_string ("Fast Export", "fastexport_icm_working", fastexport_icm_working); + keyFile.set_string ("Fast Export", "fastexport_icm_output", fastexport_icm_output); + keyFile.set_integer ("Fast Export", "fastexport_icm_output_intent", fastexport_icm_outputIntent); + keyFile.set_boolean ("Fast Export", "fastexport_icm_output_bpc", fastexport_icm_outputBPC); + keyFile.set_string ("Fast Export", "fastexport_icm_gamma", fastexport_icm_gamma); + keyFile.set_boolean ("Fast Export", "fastexport_resize_enabled", fastexport_resize_enabled); + keyFile.set_double ("Fast Export", "fastexport_resize_scale", fastexport_resize_scale); + keyFile.set_string ("Fast Export", "fastexport_resize_appliesTo", fastexport_resize_appliesTo); + keyFile.set_string ("Fast Export", "fastexport_resize_method", fastexport_resize_method); + keyFile.set_integer ("Fast Export", "fastexport_resize_dataspec", fastexport_resize_dataspec); + keyFile.set_integer ("Fast Export", "fastexport_resize_width", fastexport_resize_width); + keyFile.set_integer ("Fast Export", "fastexport_resize_height", fastexport_resize_height); + keyFile.set_integer ("Fast Export", "fastexport_use_fast_pipeline", fastexport_use_fast_pipeline); + + keyFile.set_string ("Dialogs", "LastIccDir", lastIccDir); + keyFile.set_string ("Dialogs", "LastDarkframeDir", lastDarkframeDir); + keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir); + keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); + keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir); + keyFile.set_string ("Dialogs", "LastRetinexDir", lastRetinexDir); + keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); + keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); + keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir); + keyFile.set_string ("Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); + keyFile.set_string ("Dialogs", "LastBWCurvesDir", lastBWCurvesDir); + keyFile.set_string ("Dialogs", "LastToneCurvesDir", lastToneCurvesDir); + keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); + keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); + keyFile.set_string ("Dialogs", "LastLensProfileDir", lastLensProfileDir); + keyFile.set_boolean ("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog); + + keyFile.set_string ("Lensfun", "DBDirectory", rtSettings.lensfunDbDirectory); + + keyData = keyFile.to_data (); + + } catch (Glib::KeyFileError &e) { + throw Error (e.what()); + } + + FILE *f = g_fopen (fname.c_str (), "wt"); + + if (f == nullptr) { + std::cout << "Warning! Unable to save your preferences to: " << fname << std::endl; + Glib::ustring msg_ = Glib::ustring::compose (M ("MAIN_MSG_WRITEFAILED"), fname.c_str()); + throw Error (msg_); + } else { + fprintf (f, "%s", keyData.c_str ()); + fclose (f); + } +} + +void Options::load (bool lightweight) +{ + + // Find the application data path + + const gchar* path; + Glib::ustring dPath; + + path = g_getenv ("RT_SETTINGS"); + + if (path != nullptr) { + rtdir = Glib::ustring (path); + + if (!Glib::path_is_absolute (rtdir)) { + Glib::ustring msg = Glib::ustring::compose ("Settings path %1 is not absolute", rtdir); + throw Error (msg); + } + } else { +#ifdef WIN32 + WCHAR pathW[MAX_PATH] = {0}; + + if (SHGetSpecialFolderPathW (NULL, pathW, CSIDL_LOCAL_APPDATA, false)) { + char pathA[MAX_PATH]; + WideCharToMultiByte (CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0); + rtdir = Glib::build_filename (Glib::ustring (pathA), Glib::ustring (CACHEFOLDERNAME)); + } + +#else + rtdir = Glib::build_filename (Glib::ustring (g_get_user_config_dir ()), Glib::ustring (CACHEFOLDERNAME)); +#endif + } + + if (options.rtSettings.verbose) { + printf ("Settings directory (rtdir) = %s\n", rtdir.c_str()); + } + + // Set the cache folder in RT's base folder + cacheBaseDir = Glib::build_filename (argv0, "cache"); + + // Read the global option file (the one located in the application's base folder) + try { + options.readFromFile (Glib::build_filename (argv0, "options")); + } catch (Options::Error &) { + // ignore errors here + } + + // Modify the path of the cache folder to the one provided in RT_CACHE environment variable + path = g_getenv ("RT_CACHE"); + + if (path != nullptr) { + cacheBaseDir = Glib::ustring (path); + + if (!Glib::path_is_absolute (cacheBaseDir)) { + Glib::ustring msg = Glib::ustring::compose ("Cache base dir %1 is not absolute", cacheBaseDir); + throw Error (msg); + } + } + // No environment variable provided, so falling back to the multi user mode, is enabled + else if (options.multiUser) { +#ifdef WIN32 + cacheBaseDir = Glib::build_filename (rtdir, "cache"); +#else + cacheBaseDir = Glib::build_filename (Glib::ustring (g_get_user_cache_dir()), Glib::ustring (CACHEFOLDERNAME)); +#endif + } + + // Check if RT is installed in Multi-User mode + if (options.multiUser) { + // Read the user option file (the one located somewhere in the user's home folder) + // Those values supersets those of the global option file + try { + options.readFromFile (Glib::build_filename (rtdir, "options")); + } catch (Options::Error &) { + // If the local option file does not exist or is broken, and the local cache folder does not exist, recreate it + if (!g_mkdir_with_parents (rtdir.c_str (), 511)) { + // Save the option file + options.saveToFile (Glib::build_filename (rtdir, "options")); + } + } + +#ifdef __APPLE__ + // make sure .local/share exists on OS X so we don't get problems with recently-used.xbel + g_mkdir_with_parents (g_get_user_data_dir(), 511); +#endif + } + + if (options.rtSettings.verbose) { + printf ("Cache directory (cacheBaseDir) = %s\n", cacheBaseDir.c_str()); + } + + // Update profile's path and recreate it if necessary + options.updatePaths(); + + // Check default Raw and Img procparams existence + if (options.defProfRaw.empty()) { + options.defProfRaw = DEFPROFILE_INTERNAL; + } else { + Glib::ustring tmpFName = options.findProfilePath (options.defProfRaw); + + if (!tmpFName.empty()) { + if (options.rtSettings.verbose) { + printf ("Raws' default profile \"%s\" found\n", options.defProfRaw.c_str()); + } + } else { + if (options.rtSettings.verbose) { + printf ("Raws' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfRaw.c_str()); + } + + options.defProfRaw = DEFPROFILE_INTERNAL; + options.defProfRawMissing = true; + } + } + + if (options.defProfImg.empty()) { + options.defProfImg = DEFPROFILE_INTERNAL; + } else { + Glib::ustring tmpFName = options.findProfilePath (options.defProfImg); + + if (!tmpFName.empty()) { + if (options.rtSettings.verbose) { + printf ("Images' default profile \"%s\" found\n", options.defProfImg.c_str()); + } + } else { + if (options.rtSettings.verbose) { + printf ("Images' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfImg.c_str()); + } + + options.defProfImg = DEFPROFILE_INTERNAL; + options.defProfImgMissing = true; + } + } + + //We handle languages using a hierarchy of translations. The top of the hierarchy is default. This includes a default translation for all items + // (most likely using simple English). The next level is the language: for instance, English, French, Chinese, etc. This file should contain a + // generic translation for all items which differ from default. Finally there is the locale. This is region-specific items which differ from the + // language file. These files must be name in the format (), where Language is the name of the language which it inherits from, + // and LC is the local code. Some examples of this would be English (US) (American English), French (FR) (Franch French), French (CA) (Canadian + // French), etc. + // + // Each level will only contain the differences between itself and its parent translation. For instance, English (UK) or English (CA) may + // include the translation "HISTORY_MSG_34;Avoid Colour Clipping" where English would translate it as "HISTORY_MSG_34;Avoid Color Clipping" (note + // the difference in the spelling of 'colour'). + // + // It is important that when naming the translation files, that you stick to the format or (). We depend on that to figure + // out which are the parent translations. Furthermore, there must be a file for each locale () -- you cannot have + // 'French (CA)' unless there is a file 'French'. + + Glib::ustring defaultTranslation = Glib::build_filename (argv0, "languages", "default"); + Glib::ustring languageTranslation = ""; + Glib::ustring localeTranslation = ""; + + if (options.languageAutoDetect) { + options.language = langMgr.getOSUserLanguage(); + } + + if (!options.language.empty()) { + std::vector langPortions = Glib::Regex::split_simple (" ", options.language); + + if (langPortions.size() >= 1) { + languageTranslation = Glib::build_filename (argv0, "languages", langPortions.at (0)); + } + + if (langPortions.size() >= 2) { + localeTranslation = Glib::build_filename (argv0, "languages", options.language); + } + } + + langMgr.load (localeTranslation, new MultiLangMgr (languageTranslation, new MultiLangMgr (defaultTranslation))); + + rtengine::init (&options.rtSettings, argv0, rtdir, !lightweight); +} + +void Options::save () +{ + + if (!options.multiUser) { + options.saveToFile (Glib::build_filename (argv0, "options")); + } else { + options.saveToFile (Glib::build_filename (rtdir, "options")); + } +} + +/* + * return true if ext is a parsed extension (retained or not) + */ +bool Options::is_parse_extention (Glib::ustring fname) +{ + Glib::ustring ext = getExtension (fname).lowercase(); + + if (!ext.empty()) { + // there is an extension to the filename + + // look out if it has one of the listed extensions (selected or not) + for (unsigned int i = 0; i < parseExtensions.size(); i++) { + if (ext == parseExtensions[i]) { + return true; + } + } + } + + return false; +} + +/* + * return true if fname ends with one of the retained image file extensions + */ +bool Options::has_retained_extention (Glib::ustring fname) +{ + + Glib::ustring ext = getExtension (fname).lowercase(); + + if (!ext.empty()) { + // there is an extension to the filename + + // look out if it has one of the retained extensions + for (unsigned int i = 0; i < parsedExtensions.size(); i++) { + if (ext == parsedExtensions[i]) { + return true; + } + } + } + + return false; +} + +/* + * return true if ext is an enabled extension + */ +bool Options::is_extention_enabled (Glib::ustring ext) +{ + for (int j = 0; j < (int)parseExtensions.size(); j++) + if (parseExtensions[j].casefold() == ext.casefold()) { + return j >= (int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j]; + } + + return false; +} diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index aa3c21256..0827a0d7f 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -287,6 +287,7 @@ void ParamsEdited::set (bool v) commonTrans.autofill = v; rotate.degree = v; distortion.amount = v; + lensProf.lcMode = v; lensProf.lcpFile = v; lensProf.useDist = v; lensProf.useVign = v; @@ -826,12 +827,13 @@ void ParamsEdited::initFrom (const std::vector commonTrans.autofill = commonTrans.autofill && p.commonTrans.autofill == other.commonTrans.autofill; rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree; distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount; + lensProf.lcMode = lensProf.lcMode && p.lensProf.lcMode == other.lensProf.lcMode; lensProf.lcpFile = lensProf.lcpFile && p.lensProf.lcpFile == other.lensProf.lcpFile; lensProf.useDist = lensProf.useDist && p.lensProf.useDist == other.lensProf.useDist; lensProf.useVign = lensProf.useVign && p.lensProf.useVign == other.lensProf.useVign; lensProf.useCA = lensProf.useCA && p.lensProf.useCA == other.lensProf.useCA; - lensProf.useLensfun = lensProf.useLensfun && p.lensProf.useLensfun == other.lensProf.useLensfun; - lensProf.lfAutoMatch = lensProf.lfAutoMatch && p.lensProf.lfAutoMatch == other.lensProf.lfAutoMatch; + lensProf.useLensfun = lensProf.useLensfun && p.lensProf.useLensfun() == other.lensProf.useLensfun(); + lensProf.lfAutoMatch = lensProf.lfAutoMatch && p.lensProf.lfAutoMatch() == other.lensProf.lfAutoMatch(); lensProf.lfCameraMake = lensProf.lfCameraMake && p.lensProf.lfCameraMake == other.lensProf.lfCameraMake; lensProf.lfCameraModel = lensProf.lfCameraModel && p.lensProf.lfCameraModel == other.lensProf.lfCameraModel; lensProf.lfLens = lensProf.lfLens && p.lensProf.lfLens == other.lensProf.lfLens; @@ -2062,6 +2064,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.distortion.amount = dontforceSet && options.baBehav[ADDSET_DIST_AMOUNT] ? toEdit.distortion.amount + mods.distortion.amount : mods.distortion.amount; } + if (lensProf.lcMode) { + toEdit.lensProf.lcMode = mods.lensProf.lcMode; + } + if (lensProf.lcpFile) { toEdit.lensProf.lcpFile = mods.lensProf.lcpFile; } @@ -2078,14 +2084,6 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.lensProf.useCA = mods.lensProf.useCA; } - if (lensProf.useLensfun) { - toEdit.lensProf.useLensfun = mods.lensProf.useLensfun; - } - - if (lensProf.lfAutoMatch) { - toEdit.lensProf.lfAutoMatch = mods.lensProf.lfAutoMatch; - } - if (lensProf.lfCameraMake) { toEdit.lensProf.lfCameraMake = mods.lensProf.lfCameraMake; } @@ -3053,7 +3051,7 @@ bool RAWParamsEdited::isUnchanged() const bool LensProfParamsEdited::isUnchanged() const { - return lcpFile && useVign && lfLens; + return lcMode && lcpFile && useVign && lfLens; } bool RetinexParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index c30134f86..46a68d3f5 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -429,6 +429,7 @@ class LensProfParamsEdited public: bool lcpFile, useDist, useVign, useCA; bool useLensfun, lfAutoMatch, lfCameraMake, lfCameraModel, lfLens; + bool lcMode; bool isUnchanged() const; }; diff --git a/rtgui/ppversion.h b/rtgui/ppversion.h index 6a695416e..d2e9be090 100644 --- a/rtgui/ppversion.h +++ b/rtgui/ppversion.h @@ -2,11 +2,13 @@ #define _PPVERSION_ // This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes -#define PPVERSION 326 +#define PPVERSION 327 #define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified /* Log of version changes + 327 2017-09-15 + [Profiles Lens Correction] Added Lensfun 326 2015-07-26 [Exposure] Added 'Perceptual' tone curve mode 325 2015-07-23 From b20464a06f106f42ccf4c4791edd03fa03f4abc7 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 15 Sep 2017 20:14:27 +0200 Subject: [PATCH 2/3] removed accidentially added file --- rtgui/options.cc.save-failed | 2508 ---------------------------------- 1 file changed, 2508 deletions(-) delete mode 100644 rtgui/options.cc.save-failed diff --git a/rtgui/options.cc.save-failed b/rtgui/options.cc.save-failed deleted file mode 100644 index d03ece485..000000000 --- a/rtgui/options.cc.save-failed +++ /dev/null @@ -1,2508 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * 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 "options.h" -#include -#include -#include -#include "multilangmgr.h" -#include "addsetids.h" -#include "guiutils.h" -#include "version.h" -#include "config.h" -#include -#ifdef _OPENMP -#include -#endif - - - -#ifdef WIN32 -#include -// for GCC32 -#ifndef _WIN32_IE -#define _WIN32_IE 0x0600 -#endif -#include -#endif - -// User's settings directory, including images' profiles if used -Glib::ustring Options::rtdir; -// User's cached datas' directory -Glib::ustring Options::cacheBaseDir; - -Options options; -Glib::ustring versionString = RTVERSION; -Glib::ustring paramFileExtension = ".pp3"; - -Options::Options () -{ - - defProfRawMissing = false; - defProfImgMissing = false; - setDefaults (); -} - -const char *DefaultLanguage = "English (US)"; - -inline bool Options::checkProfilePath (Glib::ustring &path) -{ - if (path.empty()) { - return false; - } - - Glib::ustring p = getUserProfilePath(); - - if (!p.empty() && Glib::file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS)) { - return true; - } - - p = getGlobalProfilePath(); - - return !p.empty() && Glib::file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS); -} - -bool Options::checkDirPath (Glib::ustring &path, Glib::ustring errString) -{ - if (Glib::file_test (path, Glib::FILE_TEST_EXISTS) && Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) { - return true; - } else { - if (!errString.empty()) { - printf ("%s\n", errString.c_str()); - } - - return false; - } -} - -void Options::updatePaths() -{ - - Glib::ustring tmpPath; - - userProfilePath = ""; - globalProfilePath = ""; - - if (Glib::path_is_absolute (profilePath)) { - // absolute path - if (!checkDirPath (profilePath, "")) { - g_mkdir_with_parents (profilePath.c_str (), 511); - - if (!checkDirPath (profilePath, "")) { // had problems with mkdir_with_parents return value on OS X, just check dir again - printf ("Error: user's profiles' directory \"%s\" creation failed\n", profilePath.c_str()); - } - } - - if (checkDirPath (profilePath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { - if (multiUser) { - userProfilePath = profilePath; - tmpPath = Glib::build_filename (argv0, "profiles"); - - if (checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { - if (userProfilePath != tmpPath) { - globalProfilePath = tmpPath; - } - } - } else { - globalProfilePath = profilePath; - } - } else { - tmpPath = Glib::build_filename (argv0, "profiles"); - - if (checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { - globalProfilePath = tmpPath; - } - } - } else { - // relative paths - if (multiUser) { - tmpPath = Glib::build_filename (rtdir, profilePath); - - if (!checkDirPath (tmpPath, "")) { - g_mkdir_with_parents (tmpPath.c_str (), 511); - - if (!checkDirPath (tmpPath, "")) { - printf ("Error: user's profiles' directory \"%s\" creation failed\n", tmpPath.c_str()); - } - } - - if (checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory!\n")) { - userProfilePath = tmpPath; - } - - tmpPath = Glib::build_filename (argv0, "profiles"); - - if (checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { - globalProfilePath = tmpPath; - } - } else { - // common directory - // directory name set in options is ignored, we use the default directory name - tmpPath = Glib::build_filename (argv0, "profiles"); - - if (checkDirPath (tmpPath, "Error: no global profiles' directory found!\n")) { - globalProfilePath = tmpPath; - } - } - } - - Glib::ustring preferredPath = getPreferredProfilePath(); - - // Paths are updated only if the user or global profile path is set - if (lastRgbCurvesDir.empty() || !Glib::file_test (lastRgbCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastRgbCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastRgbCurvesDir = preferredPath; - } - - if (lastLabCurvesDir.empty() || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastLabCurvesDir = preferredPath; - } - - if (lastRetinexDir.empty() || !Glib::file_test (lastRetinexDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastRetinexDir = preferredPath; - } - - if (lastDenoiseCurvesDir.empty() || !Glib::file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastDenoiseCurvesDir = preferredPath; - } - - if (lastWaveletCurvesDir.empty() || !Glib::file_test (lastWaveletCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastWaveletCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastWaveletCurvesDir = preferredPath; - } - - if (lastPFCurvesDir.empty() || !Glib::file_test (lastPFCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastPFCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastPFCurvesDir = preferredPath; - } - - if (lastHsvCurvesDir.empty() || !Glib::file_test (lastHsvCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastHsvCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastHsvCurvesDir = preferredPath; - } - - if (lastToneCurvesDir.empty() || !Glib::file_test (lastToneCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastToneCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastToneCurvesDir = preferredPath; - } - - if (lastProfilingReferenceDir.empty() || !Glib::file_test (lastProfilingReferenceDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastProfilingReferenceDir, Glib::FILE_TEST_IS_DIR)) { - lastProfilingReferenceDir = preferredPath; - } - - if (lastVibranceCurvesDir.empty() || !Glib::file_test (lastVibranceCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastVibranceCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastVibranceCurvesDir = preferredPath; - } - - if (loadSaveProfilePath.empty() || !Glib::file_test (loadSaveProfilePath, Glib::FILE_TEST_EXISTS) || !Glib::file_test (loadSaveProfilePath, Glib::FILE_TEST_IS_DIR)) { - loadSaveProfilePath = preferredPath; - } - - if (lastBWCurvesDir.empty() || !Glib::file_test (lastBWCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastBWCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastBWCurvesDir = preferredPath; - } - -} - -Glib::ustring Options::getPreferredProfilePath() -{ - if (!userProfilePath.empty()) { - return userProfilePath; - } else if (!globalProfilePath.empty()) { - return globalProfilePath; - } else { - return ""; - } -} - -/** @brief Get the absolute path of the given filename or the "Neutral" special value - * - *@param profName path + filename of the procparam to look for. A filename without path can be provided for backward compatibility. - * In this case, this parameter will be updated with the new format. - *@return Send back the absolute path of the given filename or "Neutral" if "Neutral" has been set to profName. Implementor will have - * to test for this particular value. If the absolute path is invalid (e.g. the file doesn't exist), it will return an empty string. - */ -Glib::ustring Options::findProfilePath (Glib::ustring &profName) -{ - if (profName.empty()) { - return ""; - } - - if (profName == DEFPROFILE_INTERNAL) { - return profName; - } - - if (profName == DEFPROFILE_DYNAMIC) { - return profName; - } - - Glib::ustring p = profName.substr (0, 4); - - if (p == "${U}") { - // the path starts by the User virtual path - p = getUserProfilePath(); - Glib::ustring fullPath = Glib::build_filename (p, profName.substr (5) + paramFileExtension); - - if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - return Glib::path_get_dirname (fullPath); - } - } else if (p == "${G}") { - // the path starts by the User virtual path - p = getGlobalProfilePath(); - Glib::ustring fullPath = Glib::build_filename (p, profName.substr (5) + paramFileExtension); - - if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - return Glib::path_get_dirname (fullPath); - } - } else { - // compatibility case -> convert the path to the new format - p = getUserProfilePath(); - Glib::ustring fullPath = Glib::build_filename (p, profName + paramFileExtension); - - if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - // update the profile path - profName = Glib::build_filename ("${U}", profName); - return Glib::path_get_dirname (fullPath); - } - - p = getGlobalProfilePath(); - fullPath = Glib::build_filename (p, profName + paramFileExtension); - - if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - profName = Glib::build_filename ("${G}", profName); - return Glib::path_get_dirname (fullPath); - } - } - - return ""; - -} - -void Options::setDefaults () -{ - - windowWidth = 1200; - windowHeight = 680; - windowX = 0; - windowY = 0; - windowMaximized = true; - windowMonitor = 0; - meowMonitor = -1; - meowFullScreen = false; - meowMaximized = true; - meowWidth = 1200; - meowHeight = 680; - meowX = 0; - meowY = 0; - saveAsDialogWidth = 920; - saveAsDialogHeight = 680; - savesParamsAtExit = true; - saveFormat.format = "jpg"; - saveFormat.jpegQuality = 92; - saveFormat.jpegSubSamp = 2; - saveFormat.pngCompression = 6; - saveFormat.pngBits = 8; - saveFormat.tiffBits = 16; - saveFormat.tiffUncompressed = true; - saveFormat.saveParams = true; - - saveFormatBatch.format = "jpg"; - saveFormatBatch.jpegQuality = 92; - saveFormatBatch.jpegSubSamp = 2; - saveFormatBatch.pngCompression = 6; - saveFormatBatch.pngBits = 8; - saveFormatBatch.tiffBits = 16; - saveFormatBatch.tiffUncompressed = true; - saveFormatBatch.saveParams = true; - - savePathTemplate = "%p1/converted/%f"; - savePathFolder = ""; - saveUsePathTemplate = true; - defProfRaw = DEFPROFILE_RAW; - defProfImg = DEFPROFILE_IMG; - dateFormat = "%y-%m-%d"; - adjusterMinDelay = 100; - adjusterMaxDelay = 200; - startupDir = STARTUPDIR_LAST; - startupPath = ""; - useBundledProfiles = true; - detailWindowWidth = -1; - detailWindowHeight = -1; - dirBrowserWidth = 260; - dirBrowserHeight = 350; - dirBrowserSortType = Gtk::SORT_ASCENDING; - preferencesWidth = 800; - preferencesHeight = 0; - toolPanelWidth = 400; - browserToolPanelWidth = 465; - browserToolPanelHeight = 600; - browserToolPanelOpened = true;; - browserDirPanelOpened = true; - editorFilmStripOpened = true; - historyPanelWidth = 330; - fontFamily = "default"; - fontSize = 10; - CPFontFamily = "default"; - CPFontSize = 8; - lastScale = 5; - panAccelFactor = 5; - rememberZoomAndPan = true; - lastCropSize = 1; - fbOnlyRaw = false; - fbShowDateTime = true; - fbShowBasicExif = true; - fbShowExpComp = false; - fbShowHidden = false; - fbArrangement = 2; // was 0 - navRGBUnit = NavigatorUnit::PERCENT; - navHSVUnit = NavigatorUnit::PERCENT; - multiUser = true; - profilePath = "profiles"; - loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails - version = "0.0.0.0"; // temporary value; will be correctly set in RTWindow::on_realize - thumbSize = 160; - thumbSizeTab = 160; - thumbSizeQueue = 160; - sameThumbSize = false; // preferring speed of switch between file browser and single editor tab - showHistory = true; - showFilePanelState = 0; // Not used anymore ; was the thumb strip state - showInfo = true; - cropPPI = 600; - showClippedHighlights = false; - showClippedShadows = false; - highlightThreshold = 253; // was 254 - shadowThreshold = 8; // was 0 - bgcolor = 0; - blinkClipped = false; - language = DefaultLanguage; - languageAutoDetect = langMgr.isOSLanguageDetectSupported(); - lastSaveAsPath = ""; - overwriteOutputFile = false; // if TRUE, existing output JPGs/PNGs are overwritten, instead of adding ..-1.jpg, -2.jpg etc. - theme = "RawTherapee"; - maxThumbnailHeight = 250; - maxCacheEntries = 20000; - thumbInterp = 1; - autoSuffix = true; - forceFormatOpts = true; - saveMethodNum = 0; // 0->immediate, 1->putToQueuHead, 2->putToQueueTail - saveParamsFile = true; // was false, but saving the procparams files next to the file make more sense when reorganizing file tree than in a cache - saveParamsCache = false; // there's no need to save the procparams files in a cache if saveParamsFile is true - paramsLoadLocation = PLL_Input; // was PLL_Cache - procQueueEnabled = false; - gimpDir = ""; - psDir = ""; - customEditorProg = ""; - CPBKeys = CPBKT_TID; - editorToSendTo = 1; - favoriteDirs.clear(); - tpOpen.clear (); - autoSaveTpOpen = true; - //crvOpen.clear (); - parseExtensions.clear (); - parseExtensionsEnabled.clear (); - parsedExtensions.clear (); - renameUseTemplates = false; - renameTemplates.clear (); - thumbnailZoomRatios.clear (); - thumbnailZoomRatios.push_back (0.2); - thumbnailZoomRatios.push_back (0.3); - thumbnailZoomRatios.push_back (0.45); - thumbnailZoomRatios.push_back (0.6); - thumbnailZoomRatios.push_back (0.8); - thumbnailZoomRatios.push_back (1.0); - overlayedFileNames = false; - filmStripOverlayedFileNames = false; - internalThumbIfUntouched = true; // if TRUE, only fast, internal preview images are taken if the image is not edited yet - showFileNames = true; - filmStripShowFileNames = false; - tabbedUI = false; - mainNBVertical = true; - multiDisplayMode = 0; - tunnelMetaData = true; - histogramPosition = 1; - histogramBar = true; - histogramFullMode = false; - curvebboxpos = 1; - prevdemo = PD_Sidecar; - rgbDenoiseThreadLimit = 0; -#if defined( _OPENMP ) && defined( __x86_64__ ) - clutCacheSize = omp_get_num_procs(); -#else - clutCacheSize = 1; -#endif - filledProfile = false; - maxInspectorBuffers = 2; // a rather conservative value for low specced systems... - serializeTiffRead = true; - - FileBrowserToolbarSingleRow = false; - hideTPVScrollbar = false; - UseIconNoText = true; - whiteBalanceSpotSize = 8; - showFilmStripToolBar = false; - menuGroupRank = true; - menuGroupLabel = true; - menuGroupFileOperations = true; - menuGroupProfileOperations = true; - menuGroupExtProg = true; - - fastexport_bypass_sharpening = true; - fastexport_bypass_sharpenEdge = true; - fastexport_bypass_sharpenMicro = true; - //fastexport_bypass_lumaDenoise = true; - //fastexport_bypass_colorDenoise = true; - fastexport_bypass_defringe = true; - fastexport_bypass_dirpyrDenoise = true; - fastexport_bypass_sh_hq = true; - fastexport_bypass_dirpyrequalizer = true; - fastexport_bypass_wavelet = true; - fastexport_raw_bayer_method = "fast"; - //fastexport_bypass_raw_bayer_all_enhance = true; - fastexport_bypass_raw_bayer_dcb_iterations = true; - fastexport_bypass_raw_bayer_dcb_enhance = true; - fastexport_bypass_raw_bayer_lmmse_iterations = true; - fastexport_bypass_raw_bayer_linenoise = true; - fastexport_bypass_raw_bayer_greenthresh = true; - fastexport_raw_xtrans_method = "fast"; - fastexport_bypass_raw_ccSteps = true; - fastexport_bypass_raw_ca = true; - fastexport_bypass_raw_df = true; - fastexport_bypass_raw_ff = true; - fastexport_icm_input = "(camera)"; - fastexport_icm_working = "ProPhoto"; - fastexport_icm_output = "RT_sRGB"; - fastexport_icm_outputIntent = rtengine::RI_RELATIVE; - fastexport_icm_outputBPC = true; - fastexport_icm_gamma = "default"; - fastexport_resize_enabled = true; - fastexport_resize_scale = 1; - fastexport_resize_appliesTo = "Cropped area"; - fastexport_resize_method = "Lanczos"; - fastexport_resize_dataspec = 3; - fastexport_resize_width = 900; - fastexport_resize_height = 900; - fastexport_use_fast_pipeline = true; - - clutsDir = "./cluts"; - - cutOverlayBrush = std::vector (4); - cutOverlayBrush[3] = 0.667; // :-p - - navGuideBrush = std::vector (4); - //default to red - navGuideBrush[0] = 1.0; - navGuideBrush[1] = 0.0; - navGuideBrush[2] = 0.0; - navGuideBrush[3] = 1.0; - - sndEnable = true; - sndLngEditProcDoneSecs = 3.0; -#ifdef __linux__ - sndBatchQueueDone = "complete"; - sndLngEditProcDone = "window-attention"; -#endif - - // Reminder: 0 = SET mode, 1 = ADD mode - baBehav = { - 1, // ADDSET_TC_EXPCOMP - 1, // ADDSET_TC_BRIGHTNESS - 1, // ADDSET_TC_BLACKLEVEL - 1, // ADDSET_TC_CONTRAST - 1, // ADDSET_SH_HIGHLIGHTS - 1, // ADDSET_SH_SHADOWS - 1, // ADDSET_SH_LOCALCONTRAST - 1, // ADDSET_LC_BRIGHTNESS - 1, // ADDSET_LC_CONTRAST - 1, // ADDSET_SHARP_AMOUNT - 1, // ADDSET_WB_TEMPERATURE - 1, // ADDSET_WB_GREEN - 1, // ADDSET_ROTATE_DEGREE - 1, // ADDSET_DIST_AMOUNT - 1, // ADDSET_PERSPECTIVE - 1, // ADDSET_CA - 1, // ADDSET_VIGN_AMOUNT - 1, // ADDSET_VIGN_RADIUS - 1, // ADDSET_VIGN_STRENGTH - 1, // ADDSET_VIGN_CENTER - 1, // ADDSET_LC_CHROMATICITY - 1, // ADDSET_TC_SATURATION - 1, // ADDSET_TC_HLCOMPAMOUNT - 1, // ADDSET_TC_HLCOMPTHRESH - 1, // ADDSET_TC_SHCOMP - 1, // ADDSET_DIRPYREQ - 1, // ADDSET_DIRPYRDN_LUMA - 1, // ADDSET_DIRPYRDN_LUDET - 1, // ADDSET_DIRPYRDN_CHROMA - 1, // ADDSET_DIRPYRDN_CHROMARED - 1, // ADDSET_DIRPYRDN_CHROMABLUE - 1, // ADDSET_DIRPYRDN_GAMMA - 1, // ADDSET_CHMIXER - 1, // ADDSET_PREPROCESS_GREENEQUIL - 1, // ADDSET_PREPROCESS_LINEDENOISE - 1, // ADDSET_RAWCACORR - 1, // ADDSET_RAWEXPOS_LINEAR - 1, // ADDSET_RAWEXPOS_PRESER - 1, // ADDSET_RAWEXPOS_BLACKS - 1, // ADDSET_SHARPENEDGE_AMOUNT - 1, // ADDSET_SHARPENMICRO_AMOUNT - 1, // ADDSET_SHARPENEDGE_PASS - 1, // ADDSET_SHARPENMICRO_UNIFORMITY - 1, // ADDSET_VIBRANCE_PASTELS - 1, // ADDSET_VIBRANCE_SATURATED - 1, // ADDSET_FREE_OUPUT_GAMMA - 1, // ADDSET_FREE_OUTPUT_SLOPE - 1, // ADDSET_CAT_DEGREE - 1, // ADDSET_CAT_ADAPSCEN - 1, // ADDSET_CAT_ADAPLUM - 1, // ADDSET_CAT_LIGHT - 1, // ADDSET_CAT_RSTPRO - 1, // ADDSET_CAT_BADPIX - 1, // ADDSET_CAT_JLIGHT - 1, // ADDSET_CAT_CHROMA - 1, // ADDSET_CAT_CONTRAST - 1, // ADDSET_CAT_CHROMA_S - 1, // ADDSET_CAT_CHROMA_M - 1, // ADDSET_CAT_HUE - 1, // ADDSET_CAT_BADPIX - 1, // ADDSET_WB_EQUAL - 1, // ADDSET_GRADIENT_DEGREE - 1, // ADDSET_GRADIENT_FEATHER - 1, // ADDSET_GRADIENT_STRENGTH - 1, // ADDSET_GRADIENT_CENTER - 1, // ADDSET_PCVIGNETTE_STRENGTH - 1, // ADDSET_PCVIGNETTE_FEATHER - 1, // ADDSET_PCVIGNETTE_ROUNDNESS - 1, // ADDSET_BLACKWHITE_HUES - 1, // ADDSET_BLACKWHITE_GAMMA - 1, // ADDSET_DIRPYREQ_THRESHOLD - 1, // ADDSET_DIRPYREQ_SKINPROTECT - 1, // ADDSET_COLORTONING_SPLIT - 1, // ADDSET_COLORTONING_SATTHRESHOLD - 1, // ADDSET_COLORTONING_SATOPACITY - 1, // ADDSET_COLORTONING_BALANCE - 1, // ADDSET_COLORTONING_STRENGTH - 1, // ADDSET_DIRPYRDN_PASSES - 1, // ADDSET_RAWFFCLIPCONTROL - 1, // ADDSET_FILMSIMULATION_STRENGTH - 1, // ADDSET_WA - 1, // ADDSET_WA_SKINPROTECT - 1, // ADDSET_WA_THRESHOLD2 - 1, // ADDSET_WA_THRR - 1, // ADDSET_WA_THRRH - 1, // ADDSET_WA_THRESHOLD - 1, // ADDSET_WA_THRESHOLD2 - 1, // ADDSET_WA_CHRO - 1, // ADDSET_WA_CHROMA - 1, // ADDSET_WA_CONTRAST - 1, // ADDSET_WA_RESCON - 1, // ADDSET_WA_RESCONH - 1, // ADDSET_WA_RESCHRO - 1, // ADDSET_WA_SKYPROTECT - 1, // ADDSET_WA_EDGRAD - 1, // ADDSET_WA_EDGVAL - 1, // ADDSET_WA_STRENGTH - 1, // ADDSET_WA_EDGEDETECT - 1, // ADDSET_WA_EDGEDETECTTHR - 1, // ADDSET_WA_EDGEDETECTTHR2 - 1, // ADDSET_WA_TMRS - 1, // ADDSET_WA_GAMMA - 1, // ADDSET_RETI_STR - 1, // ADDSET_RETI_NEIGH - 1, // ADDSET_RETI_LIMD - 1, // ADDSET_RETI_GAIN - 1, // ADDSET_RETI_OFFS - 1, // ADDSET_RETI_VART - 1, // ADDSET_RETI_GAM - 1, // ADDSET_RETI_SLO - 1, // ADDSET_WB_TEMPBIAS - }; - - rtSettings.darkFramesPath = ""; - rtSettings.flatFieldsPath = ""; -#ifdef WIN32 - const gchar* sysRoot = g_getenv ("SystemRoot"); // Returns e.g. "c:\Windows" - - if (sysRoot != NULL) { - rtSettings.iccDirectory = Glib::ustring (sysRoot) + Glib::ustring ("\\System32\\spool\\drivers\\color"); - } else { - rtSettings.iccDirectory = "C:\\WINDOWS\\System32\\spool\\drivers\\color"; - } - -#elif defined __APPLE__ - rtSettings.iccDirectory = "/library/ColorSync/Profiles/Displays"; -#else - rtSettings.iccDirectory = "/usr/share/color/icc"; -#endif -// rtSettings.viewingdevice = 0; -// rtSettings.viewingdevicegrey = 3; - // rtSettings.viewinggreySc = 1; - rtSettings.leveldnv = 2; - rtSettings.leveldnti = 0; - rtSettings.leveldnaut = 0; - rtSettings.leveldnliss = 0; - rtSettings.leveldnautsimpl = 0; - - rtSettings.printerProfile = Glib::ustring(); - rtSettings.printerIntent = rtengine::RI_RELATIVE; - rtSettings.printerBPC = true; - rtSettings.monitorProfile = Glib::ustring(); - rtSettings.monitorIntent = rtengine::RI_RELATIVE; - rtSettings.monitorBPC = true; - rtSettings.autoMonitorProfile = false; - rtSettings.adobe = "RT_Medium_gsRGB"; // put the name of yours profiles (here windows) - rtSettings.prophoto = "RT_Large_gBT709"; // these names appear in the menu "output profile" - rtSettings.prophoto10 = "RT_Large_g10"; // these names appear in the menu "output profile" - rtSettings.srgb10 = "RT_sRGB_g10"; - rtSettings.widegamut = "WideGamutRGB"; - rtSettings.srgb = "RT_sRGB"; - rtSettings.bruce = "Bruce"; - rtSettings.beta = "BetaRGB"; - rtSettings.best = "BestRGB"; - rtSettings.rec2020 = "Rec2020"; - rtSettings.verbose = false; - rtSettings.gamutICC = true; - rtSettings.gamutLch = true; - rtSettings.amchroma = 40;//between 20 and 140 low values increase effect..and also artefacts, high values reduces - rtSettings.artifact_cbdl = 4.; - rtSettings.level0_cbdl = 0; - rtSettings.level123_cbdl = 30; - rtSettings.bot_left = 0; - rtSettings.top_left = 10; - rtSettings.top_right = 40; - rtSettings.bot_right = 75; - rtSettings.ed_detec = 3; //between 2 and 10 - rtSettings.ed_detecStr = 1.3; //not use - rtSettings.ed_low = 15.; //between 5 to 40 - rtSettings.ed_lipinfl = 0.8; //between 0.5 to 0.9 - rtSettings.ed_lipampl = 1.1; //between 1 and 2 - - - rtSettings.ciecamfloat = true; - rtSettings.protectred = 60; - rtSettings.protectredh = 0.3; - rtSettings.CRI_color = 0; - rtSettings.autocielab = true; - rtSettings.denoiselabgamma = 2; - rtSettings.HistogramWorking = false; - - rtSettings.daubech = false; - - rtSettings.nrauto = 10;//between 2 and 20 - rtSettings.nrautomax = 40;//between 5 and 100 - rtSettings.nrhigh = 0.45;//between 0.1 and 0.9 - rtSettings.nrwavlevel = 1;//integer between 0 and 2 - -// rtSettings.colortoningab =0.7; -//rtSettings.decaction =0.3; -// rtSettings.ciebadpixgauss=false; - rtSettings.rgbcurveslumamode_gamut = true; - lastIccDir = rtSettings.iccDirectory; - lastDarkframeDir = rtSettings.darkFramesPath; - lastFlatfieldDir = rtSettings.flatFieldsPath; -// rtSettings.bw_complementary = true; - // There is no reasonable default for curves. We can still suppose that they will take place - // in a subdirectory of the user's own ProcParams presets, i.e. in a subdirectory - // of the one pointed to by the "profile" field. - // The following fields will then be initialized when "profile" will have its final value, - // at the end of the "updatePaths" method. - lastRgbCurvesDir = ""; - lastLabCurvesDir = ""; - lastRetinexDir = ""; - lastDenoiseCurvesDir = ""; - lastWaveletCurvesDir = ""; - lastPFCurvesDir = ""; - lastHsvCurvesDir = ""; - lastToneCurvesDir = ""; - lastVibranceCurvesDir = ""; - lastProfilingReferenceDir = ""; - lastBWCurvesDir = ""; - lastLensProfileDir = ""; - gimpPluginShowInfoDialog = true; - maxRecentFolders = 15; - - rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH; - std::cout << "." << rtSettings.lensfunDbDirectory << "." << std::endl; -} - -Options* Options::copyFrom (Options* other) -{ - *this = *other; - return this; -} - -void Options::filterOutParsedExtensions () -{ - parsedExtensions.clear(); - - for (unsigned int i = 0; i < parseExtensions.size(); i++) - if (parseExtensionsEnabled[i]) { - parsedExtensions.push_back (parseExtensions[i].lowercase()); - } -} - -void Options::readFromFile (Glib::ustring fname) -{ - setlocale (LC_NUMERIC, "C"); // to set decimal point to "." - - Glib::KeyFile keyFile; - - if ( !Glib::file_test (fname, Glib::FILE_TEST_EXISTS)) { - Glib::ustring msg = Glib::ustring::compose ("Options file %1 does not exist", fname); - throw Error (msg); - } - - try { - if (keyFile.load_from_file (fname)) { - -// -------------------------------------------------------------------------------------------------------- - - if (keyFile.has_group ("General")) { - if (keyFile.has_key ("General", "TabbedEditor")) { - tabbedUI = keyFile.get_boolean ("General", "TabbedEditor"); - } - - if (keyFile.has_key ("General", "StartupDirectory")) { - if ( keyFile.get_string ("General", "StartupDirectory") == "home") { - startupDir = STARTUPDIR_HOME; - } else if ( keyFile.get_string ("General", "StartupDirectory") == "current") { - startupDir = STARTUPDIR_CURRENT; - } else if ( keyFile.get_string ("General", "StartupDirectory") == "last") { - startupDir = STARTUPDIR_LAST; - } else if ( keyFile.get_string ("General", "StartupDirectory") == "custom") { - startupDir = STARTUPDIR_CUSTOM; - } - } - - if (keyFile.has_key ("General", "StartupPath")) { - startupPath = keyFile.get_string ("General", "StartupPath"); - } - - if (keyFile.has_key ("General", "DateFormat")) { - dateFormat = keyFile.get_string ("General", "DateFormat"); - } - - if (keyFile.has_key ("General", "AdjusterMinDelay")) { - adjusterMinDelay = keyFile.get_integer ("General", "AdjusterMinDelay"); - } - - if (keyFile.has_key ("General", "AdjusterMaxDelay")) { - adjusterMaxDelay = keyFile.get_integer ("General", "AdjusterMaxDelay"); - } - - if (keyFile.has_key ("General", "StoreLastProfile")) { - savesParamsAtExit = keyFile.get_boolean ("General", "StoreLastProfile"); - } - - if (keyFile.has_key ("General", "MultiUser")) { - multiUser = keyFile.get_boolean ("General", "MultiUser"); - } - - if (keyFile.has_key ("General", "Version")) { - version = keyFile.get_string ("General", "Version"); - } - - if (keyFile.has_key ("General", "Language")) { - language = keyFile.get_string ("General", "Language"); - } - - if (keyFile.has_key ("General", "LanguageAutoDetect")) { - languageAutoDetect = keyFile.get_boolean ("General", "LanguageAutoDetect"); - } - - if (keyFile.has_key ("General", "Theme")) { - theme = keyFile.get_string ("General", "Theme"); - } - - if ( keyFile.has_key ("General", "DarkFramesPath")) { - rtSettings.darkFramesPath = keyFile.get_string ("General", "DarkFramesPath"); - } - - if ( keyFile.has_key ("General", "FlatFieldsPath")) { - rtSettings.flatFieldsPath = keyFile.get_string ("General", "FlatFieldsPath"); - } - - if ( keyFile.has_key ("General", "Verbose")) { - rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); - } - - if (keyFile.has_key ("General", "BotLeft")) { - rtSettings.bot_left = keyFile.get_double ("General", "BotLeft"); - } - - if (keyFile.has_key ("General", "TopLeft")) { - rtSettings.top_left = keyFile.get_double ("General", "TopLeft"); - } - - if (keyFile.has_key ("General", "TopRight")) { - rtSettings.top_right = keyFile.get_double ("General", "TopRight"); - } - - if (keyFile.has_key ("General", "BotRight")) { - rtSettings.bot_right = keyFile.get_double ("General", "BotRight"); - } - - if (keyFile.has_key ("General", "EDdetec")) { - rtSettings.ed_detec = keyFile.get_double ("General", "EDdetec"); - } - - if (keyFile.has_key ("General", "EDdetecStr")) { - rtSettings.ed_detecStr = keyFile.get_double ("General", "EDdetecStr"); - } - - if (keyFile.has_key ("General", "EDLow")) { - rtSettings.ed_low = keyFile.get_double ("General", "EDLow"); - } - - if (keyFile.has_key ("General", "EDLipinfl")) { - rtSettings.ed_lipinfl = keyFile.get_double ("General", "EDLipinfl"); - } - - if (keyFile.has_key ("General", "EDLipampl")) { - rtSettings.ed_lipampl = keyFile.get_double ("General", "EDLipampl"); - } - - - } - - if (keyFile.has_group ("External Editor")) { - if (keyFile.has_key ("External Editor", "EditorKind")) { - editorToSendTo = keyFile.get_integer ("External Editor", "EditorKind"); - } - - if (keyFile.has_key ("External Editor", "GimpDir")) { - gimpDir = keyFile.get_string ("External Editor", "GimpDir"); - } - - if (keyFile.has_key ("External Editor", "PhotoshopDir")) { - psDir = keyFile.get_string ("External Editor", "PhotoshopDir"); - } - - if (keyFile.has_key ("External Editor", "CustomEditor")) { - customEditorProg = keyFile.get_string ("External Editor", "CustomEditor"); - } - } - - if (keyFile.has_group ("Output")) { - if (keyFile.has_key ("Output", "Format")) { - saveFormat.format = keyFile.get_string ("Output", "Format"); - } - - if (keyFile.has_key ("Output", "JpegQuality")) { - saveFormat.jpegQuality = keyFile.get_integer ("Output", "JpegQuality"); - } - - if (keyFile.has_key ("Output", "JpegSubSamp")) { - saveFormat.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSamp"); - } - - if (keyFile.has_key ("Output", "PngCompression")) { - saveFormat.pngCompression = keyFile.get_integer ("Output", "PngCompression"); - } - - if (keyFile.has_key ("Output", "PngBps")) { - saveFormat.pngBits = keyFile.get_integer ("Output", "PngBps"); - } - - if (keyFile.has_key ("Output", "TiffBps")) { - saveFormat.tiffBits = keyFile.get_integer ("Output", "TiffBps"); - } - - if (keyFile.has_key ("Output", "TiffUncompressed")) { - saveFormat.tiffUncompressed = keyFile.get_boolean ("Output", "TiffUncompressed"); - } - - if (keyFile.has_key ("Output", "SaveProcParams")) { - saveFormat.saveParams = keyFile.get_boolean ("Output", "SaveProcParams"); - } - - - if (keyFile.has_key ("Output", "FormatBatch")) { - saveFormatBatch.format = keyFile.get_string ("Output", "FormatBatch"); - } - - if (keyFile.has_key ("Output", "JpegQualityBatch")) { - saveFormatBatch.jpegQuality = keyFile.get_integer ("Output", "JpegQualityBatch"); - } - - if (keyFile.has_key ("Output", "JpegSubSampBatch")) { - saveFormatBatch.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSampBatch"); - } - - if (keyFile.has_key ("Output", "PngCompressionBatch")) { - saveFormatBatch.pngCompression = keyFile.get_integer ("Output", "PngCompressionBatch"); - } - - if (keyFile.has_key ("Output", "PngBpsBatch")) { - saveFormatBatch.pngBits = keyFile.get_integer ("Output", "PngBpsBatch"); - } - - if (keyFile.has_key ("Output", "TiffBpsBatch")) { - saveFormatBatch.tiffBits = keyFile.get_integer ("Output", "TiffBpsBatch"); - } - - if (keyFile.has_key ("Output", "TiffUncompressedBatch")) { - saveFormatBatch.tiffUncompressed = keyFile.get_boolean ("Output", "TiffUncompressedBatch"); - } - - if (keyFile.has_key ("Output", "SaveProcParamsBatch")) { - saveFormatBatch.saveParams = keyFile.get_boolean ("Output", "SaveProcParamsBatch"); - } - - if (keyFile.has_key ("Output", "Path")) { - savePathTemplate = keyFile.get_string ("Output", "Path"); - } - - if (keyFile.has_key ("Output", "PathTemplate")) { - savePathTemplate = keyFile.get_string ("Output", "PathTemplate"); - } - - if (keyFile.has_key ("Output", "PathFolder")) { - savePathFolder = keyFile.get_string ("Output", "PathFolder"); - } - - if (keyFile.has_key ("Output", "AutoSuffix")) { - autoSuffix = keyFile.get_boolean ("Output", "AutoSuffix"); - } - - if (keyFile.has_key ("Output", "ForceFormatOpts")) { - forceFormatOpts = keyFile.get_boolean ("Output", "ForceFormatOpts"); - } - - if (keyFile.has_key ("Output", "SaveMethodNum")) { - saveMethodNum = keyFile.get_integer ("Output", "SaveMethodNum"); - } - - if (keyFile.has_key ("Output", "UsePathTemplate")) { - saveUsePathTemplate = keyFile.get_boolean ("Output", "UsePathTemplate"); - } - - if (keyFile.has_key ("Output", "LastSaveAsPath")) { - lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath"); - } - - 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")) { - if (keyFile.has_key ("Profiles", "Directory")) { - profilePath = keyFile.get_string ("Profiles", "Directory"); - } - - if (keyFile.has_key ("Profiles", "UseBundledProfiles")) { - useBundledProfiles = keyFile.get_boolean ("Profiles", "UseBundledProfiles"); - } - - if (keyFile.has_key ("Profiles", "LoadSaveProfilePath")) { - loadSaveProfilePath = keyFile.get_string ("Profiles", "LoadSaveProfilePath"); - } - - if (keyFile.has_key ("Profiles", "RawDefault")) { - defProfRaw = keyFile.get_string ("Profiles", "RawDefault"); - } - - if (keyFile.has_key ("Profiles", "ImgDefault")) { - defProfImg = keyFile.get_string ("Profiles", "ImgDefault"); - } - - if (keyFile.has_key ("Profiles", "FilledProfile")) { - filledProfile = keyFile.get_boolean ("Profiles", "FilledProfile"); - } - - if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) { - saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile"); - } - - if (keyFile.has_key ("Profiles", "SaveParamsToCache")) { - saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache"); - } - - if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) { - paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation"); - } - - if (keyFile.has_key ("Profiles", "CustomProfileBuilder")) { - CPBPath = keyFile.get_string ("Profiles", "CustomProfileBuilder"); // for backward compatibility only - } - - if (keyFile.has_key ("Profiles", "CustomProfileBuilderPath")) { - CPBPath = keyFile.get_string ("Profiles", "CustomProfileBuilderPath"); - } - - if (keyFile.has_key ("Profiles", "CustomProfileBuilderKeys")) { - CPBKeys = (CPBKeyType)keyFile.get_integer ("Profiles", "CustomProfileBuilderKeys"); - } - } - - if (keyFile.has_group ("File Browser")) { - if (keyFile.has_key ("File Browser", "ThumbnailSize")) { - thumbSize = keyFile.get_integer ("File Browser", "ThumbnailSize"); - } - - if (keyFile.has_key ("File Browser", "ThumbnailSizeTab")) { - thumbSizeTab = keyFile.get_integer ("File Browser", "ThumbnailSizeTab"); - } - - if (keyFile.has_key ("File Browser", "ThumbnailSizeQueue")) { - thumbSizeQueue = keyFile.get_integer ("File Browser", "ThumbnailSizeQueue"); - } - - if (keyFile.has_key ("File Browser", "SameThumbSize")) { - sameThumbSize = keyFile.get_integer ("File Browser", "SameThumbSize"); - } - - if (keyFile.has_key ("File Browser", "BrowseOnlyRaw")) { - fbOnlyRaw = keyFile.get_boolean ("File Browser", "BrowseOnlyRaw"); - } - - if (keyFile.has_key ("File Browser", "BrowserShowsDate")) { - fbShowDateTime = keyFile.get_boolean ("File Browser", "BrowserShowsDate"); - } - - if (keyFile.has_key ("File Browser", "BrowserShowsExif")) { - fbShowBasicExif = keyFile.get_boolean ("File Browser", "BrowserShowsExif"); - } - - if (keyFile.has_key ("File Browser", "BrowserShowsExpComp")) { - fbShowExpComp = keyFile.get_boolean ("File Browser", "BrowserShowsExpComp"); - } - - if (keyFile.has_key ("File Browser", "BrowserShowsHidden")) { - fbShowHidden = keyFile.get_boolean ("File Browser", "BrowserShowsHidden"); - } - - if (keyFile.has_key ("File Browser", "MaxPreviewHeight")) { - maxThumbnailHeight = keyFile.get_integer ("File Browser", "MaxPreviewHeight"); - } - - if (keyFile.has_key ("File Browser", "MaxCacheEntries")) { - maxCacheEntries = keyFile.get_integer ("File Browser", "MaxCacheEntries"); - } - - if (keyFile.has_key ("File Browser", "ParseExtensions")) { - parseExtensions = keyFile.get_string_list ("File Browser", "ParseExtensions"); - } - - if (keyFile.has_key ("File Browser", "ParseExtensionsEnabled")) { - parseExtensionsEnabled = keyFile.get_integer_list ("File Browser", "ParseExtensionsEnabled"); - } - - if (keyFile.has_key ("File Browser", "ThumbnailArrangement")) { - fbArrangement = keyFile.get_integer ("File Browser", "ThumbnailArrangement"); - } - - if (keyFile.has_key ("File Browser", "ThumbnailInterpolation")) { - thumbInterp = keyFile.get_integer ("File Browser", "ThumbnailInterpolation"); - } - - if (keyFile.has_key ("File Browser", "FavoriteDirs")) { - favoriteDirs = keyFile.get_string_list ("File Browser", "FavoriteDirs"); - } - - if (keyFile.has_key ("File Browser", "RenameTemplates")) { - renameTemplates = keyFile.get_string_list ("File Browser", "RenameTemplates"); - } - - if (keyFile.has_key ("File Browser", "RenameUseTemplates")) { - renameUseTemplates = keyFile.get_boolean ("File Browser", "RenameUseTemplates"); - } - - if (keyFile.has_key ("File Browser", "ThumbnailZoomRatios")) { - thumbnailZoomRatios = keyFile.get_double_list ("File Browser", "ThumbnailZoomRatios"); - } - - if (keyFile.has_key ("File Browser", "OverlayedFileNames")) { - overlayedFileNames = keyFile.get_boolean ("File Browser", "OverlayedFileNames"); - } - - if (keyFile.has_key ("File Browser", "FilmStripOverlayedFileNames")) { - filmStripOverlayedFileNames = keyFile.get_boolean ("File Browser", "FilmStripOverlayedFileNames"); - } - - if (keyFile.has_key ("File Browser", "ShowFileNames")) { - showFileNames = keyFile.get_boolean ("File Browser", "ShowFileNames"); - } - - if (keyFile.has_key ("File Browser", "FilmStripShowFileNames")) { - filmStripShowFileNames = keyFile.get_boolean ("File Browser", "FilmStripShowFileNames"); - } - - if (keyFile.has_key ("File Browser", "InternalThumbIfUntouched")) { - internalThumbIfUntouched = keyFile.get_boolean ("File Browser", "InternalThumbIfUntouched"); - } - - if (keyFile.has_key ("File Browser", "menuGroupRank")) { - menuGroupRank = keyFile.get_boolean ("File Browser", "menuGroupRank"); - } - - if (keyFile.has_key ("File Browser", "menuGroupLabel")) { - menuGroupLabel = keyFile.get_boolean ("File Browser", "menuGroupLabel"); - } - - if (keyFile.has_key ("File Browser", "menuGroupFileOperations")) { - menuGroupFileOperations = keyFile.get_boolean ("File Browser", "menuGroupFileOperations"); - } - - if (keyFile.has_key ("File Browser", "menuGroupProfileOperations")) { - menuGroupProfileOperations = keyFile.get_boolean ("File Browser", "menuGroupProfileOperations"); - } - - if (keyFile.has_key ("File Browser", "menuGroupExtProg")) { - menuGroupExtProg = keyFile.get_boolean ("File Browser", "menuGroupExtProg"); - } - - if (keyFile.has_key ("File Browser", "MaxRecentFolders")) { - maxRecentFolders = keyFile.get_integer ("File Browser", "MaxRecentFolders"); - } - - recentFolders.reserve (maxRecentFolders + 10); // reserve some more than maxRecentFolders, because at runtime it stores more than that - - if (keyFile.has_key ("File Browser", "RecentFolders")) { - recentFolders = keyFile.get_string_list ("File Browser", "RecentFolders"); - } - } - - if (keyFile.has_group ("Clipping Indication")) { - if (keyFile.has_key ("Clipping Indication", "HighlightThreshold")) { - highlightThreshold = keyFile.get_integer ("Clipping Indication", "HighlightThreshold"); - } - - if (keyFile.has_key ("Clipping Indication", "ShadowThreshold")) { - shadowThreshold = keyFile.get_integer ("Clipping Indication", "ShadowThreshold"); - } - - if (keyFile.has_key ("Clipping Indication", "BlinkClipped")) { - blinkClipped = keyFile.get_boolean ("Clipping Indication", "BlinkClipped"); - } - } - - if (keyFile.has_group ("Performance")) { - if (keyFile.has_key ("Performance", "RgbDenoiseThreadLimit")) { - rgbDenoiseThreadLimit = keyFile.get_integer ("Performance", "RgbDenoiseThreadLimit"); - } - - if ( keyFile.has_key ("Performance", "NRauto")) { - rtSettings.nrauto = keyFile.get_double ("Performance", "NRauto"); - } - - if ( keyFile.has_key ("Performance", "NRautomax")) { - rtSettings.nrautomax = keyFile.get_double ("Performance", "NRautomax"); - } - - if ( keyFile.has_key ("Performance", "NRhigh")) { - rtSettings.nrhigh = keyFile.get_double ("Performance", "NRhigh"); - } - - if (rtSettings.nrhigh == 0.0) { //avoid crash by division by zero in noise reduction - rtSettings.nrhigh = 0.45; - } - - if ( keyFile.has_key ("Performance", "NRWavlevel")) { - rtSettings.nrwavlevel = keyFile.get_integer ("Performance", "NRWavlevel"); - } - - if (keyFile.has_key ("Performance", "LevNR")) { - rtSettings.leveldnv = keyFile.get_integer ("Performance", "LevNR"); - } - - if (keyFile.has_key ("Performance", "LevNRTI")) { - rtSettings.leveldnti = keyFile.get_integer ("Performance", "LevNRTI"); - } - - if (keyFile.has_key ("Performance", "LevNRAUT")) { - rtSettings.leveldnaut = keyFile.get_integer ("Performance", "LevNRAUT"); - } - - if (keyFile.has_key ("Performance", "LevNRLISS")) { - rtSettings.leveldnliss = keyFile.get_integer ("Performance", "LevNRLISS"); - } - - if (keyFile.has_key ("Performance", "SIMPLNRAUT")) { - rtSettings.leveldnautsimpl = keyFile.get_integer ("Performance", "SIMPLNRAUT"); - } - - if (keyFile.has_key ("Performance", "ClutCacheSize")) { - clutCacheSize = keyFile.get_integer ("Performance", "ClutCacheSize"); - } - - if (keyFile.has_key ("Performance", "MaxInspectorBuffers")) { - maxInspectorBuffers = keyFile.get_integer ("Performance", "MaxInspectorBuffers"); - } - - if (keyFile.has_key ("Performance", "PreviewDemosaicFromSidecar")) { - prevdemo = (prevdemo_t)keyFile.get_integer ("Performance", "PreviewDemosaicFromSidecar"); - } - - if (keyFile.has_key ("Performance", "Daubechies")) { - rtSettings.daubech = keyFile.get_boolean ("Performance", "Daubechies"); - } - - if (keyFile.has_key ("Performance", "SerializeTiffRead")) { - serializeTiffRead = keyFile.get_boolean ("Performance", "SerializeTiffRead"); - } - } - - if (keyFile.has_group ("GUI")) { - if (keyFile.has_key ("GUI", "WindowWidth")) { - windowWidth = keyFile.get_integer ("GUI", "WindowWidth"); - } - - if (keyFile.has_key ("GUI", "WindowHeight")) { - windowHeight = keyFile.get_integer ("GUI", "WindowHeight"); - } - - if (keyFile.has_key ("GUI", "WindowX")) { - windowX = keyFile.get_integer ("GUI", "WindowX"); - } - - if (keyFile.has_key ("GUI", "WindowY")) { - windowY = keyFile.get_integer ("GUI", "WindowY"); - } - - if (keyFile.has_key ("GUI", "WindowMonitor")) { - windowMonitor = keyFile.get_integer ("GUI", "WindowMonitor"); - } - - if (keyFile.has_key ("GUI", "MeowMonitor")) { - meowMonitor = keyFile.get_integer ("GUI", "MeowMonitor"); - } - - if (keyFile.has_key ("GUI", "MeowFullScreen")) { - meowFullScreen = keyFile.get_boolean ("GUI", "MeowFullScreen"); - } - - if (keyFile.has_key ("GUI", "MeowMaximized")) { - meowMaximized = keyFile.get_boolean ("GUI", "MeowMaximized"); - } - - if (keyFile.has_key ("GUI", "MeowWidth")) { - meowWidth = keyFile.get_integer ("GUI", "MeowWidth"); - } - - if (keyFile.has_key ("GUI", "MeowHeight")) { - meowHeight = keyFile.get_integer ("GUI", "MeowHeight"); - } - - if (keyFile.has_key ("GUI", "MeowX")) { - meowX = keyFile.get_integer ("GUI", "MeowX"); - } - - if (keyFile.has_key ("GUI", "MeowY")) { - meowY = keyFile.get_integer ("GUI", "MeowY"); - } - - if (keyFile.has_key ("GUI", "WindowMaximized")) { - windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized"); - } - - if (keyFile.has_key ("GUI", "DetailWindowWidth")) { - detailWindowWidth = keyFile.get_integer ("GUI", "DetailWindowWidth"); - } - - if (keyFile.has_key ("GUI", "DetailWindowHeight")) { - detailWindowHeight = keyFile.get_integer ("GUI", "DetailWindowHeight"); - } - - if (keyFile.has_key ("GUI", "DirBrowserWidth")) { - dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth"); - } - - if (keyFile.has_key ("GUI", "DirBrowserHeight")) { - dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight"); - } - - if (keyFile.has_key ("GUI", "SortType")) { - dirBrowserSortType = static_cast (keyFile.get_integer ("GUI", "SortType")); - } - - if (keyFile.has_key ("GUI", "PreferencesWidth")) { - preferencesWidth = keyFile.get_integer ("GUI", "PreferencesWidth"); - } - - if (keyFile.has_key ("GUI", "PreferencesHeight")) { - preferencesHeight = keyFile.get_integer ("GUI", "PreferencesHeight"); - } - - if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) { - saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth"); - } - - if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) { - saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight"); - } - - if (keyFile.has_key ("GUI", "ToolPanelWidth")) { - toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth"); - } - - if (keyFile.has_key ("GUI", "BrowserToolPanelWidth")) { - browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth"); - } - - if (keyFile.has_key ("GUI", "BrowserToolPanelHeight")) { - browserToolPanelHeight = keyFile.get_integer ("GUI", "BrowserToolPanelHeight"); - } - - if (keyFile.has_key ("GUI", "BrowserToolPanelOpened")) { - browserToolPanelOpened = keyFile.get_boolean ("GUI", "BrowserToolPanelOpened"); - } - - if (keyFile.has_key ("GUI", "BrowserDirPanelOpened")) { - browserDirPanelOpened = keyFile.get_boolean ("GUI", "BrowserDirPanelOpened"); - } - - if (keyFile.has_key ("GUI", "EditorFilmStripOpened")) { - editorFilmStripOpened = keyFile.get_boolean ("GUI", "EditorFilmStripOpened"); - } - - if (keyFile.has_key ("GUI", "HistoryPanelWidth")) { - historyPanelWidth = keyFile.get_integer ("GUI", "HistoryPanelWidth"); - } - - if (keyFile.has_key ("GUI", "FontFamily")) { - fontFamily = keyFile.get_string ("GUI", "FontFamily"); - } - - if (keyFile.has_key ("GUI", "FontSize")) { - fontSize = keyFile.get_integer ("GUI", "FontSize"); - } - - if (keyFile.has_key ("GUI", "CPFontFamily")) { - CPFontFamily = keyFile.get_string ("GUI", "CPFontFamily"); - } - - if (keyFile.has_key ("GUI", "CPFontSize")) { - CPFontSize = keyFile.get_integer ("GUI", "CPFontSize"); - } - - if (keyFile.has_key ("GUI", "LastPreviewScale")) { - lastScale = keyFile.get_integer ("GUI", "LastPreviewScale"); - } - - if (keyFile.has_key ("GUI", "PanAccelFactor")) { - panAccelFactor = keyFile.get_integer ("GUI", "PanAccelFactor"); - } - - if (keyFile.has_key ("GUI", "RememberZoomAndPan")) { - rememberZoomAndPan = keyFile.get_boolean ("GUI", "RememberZoomAndPan"); - } - - if (keyFile.has_key ("GUI", "LastCropSize")) { - lastCropSize = keyFile.get_integer ("GUI", "LastCropSize"); - } - - if (keyFile.has_key ("GUI", "ShowHistory")) { - showHistory = keyFile.get_boolean ("GUI", "ShowHistory"); - } - - if (keyFile.has_key ("GUI", "ShowFilePanelState")) { - showFilePanelState = keyFile.get_integer ("GUI", "ShowFilePanelState"); - } - - if (keyFile.has_key ("GUI", "ShowInfo")) { - showInfo = keyFile.get_boolean ("GUI", "ShowInfo"); - } - - if (keyFile.has_key ("GUI", "MainNBVertical")) { - mainNBVertical = keyFile.get_boolean ("GUI", "MainNBVertical"); - } - - if (keyFile.has_key ("GUI", "ShowClippedHighlights")) { - showClippedHighlights = keyFile.get_boolean ("GUI", "ShowClippedHighlights"); - } - - if (keyFile.has_key ("GUI", "ShowClippedShadows")) { - showClippedShadows = keyFile.get_boolean ("GUI", "ShowClippedShadows"); - } - - if (keyFile.has_key ("GUI", "FrameColor")) { - bgcolor = keyFile.get_integer ("GUI", "FrameColor"); - } - - if (keyFile.has_key ("GUI", "ProcessingQueueEnbled")) { - procQueueEnabled = keyFile.get_boolean ("GUI", "ProcessingQueueEnbled"); - } - - if (keyFile.has_key ("GUI", "ToolPanelsExpanded")) { - tpOpen = keyFile.get_integer_list ("GUI", "ToolPanelsExpanded"); - } - - if (keyFile.has_key ("GUI", "ToolPanelsExpandedAutoSave")) { - autoSaveTpOpen = keyFile.get_boolean ("GUI", "ToolPanelsExpandedAutoSave"); - } - - if (keyFile.has_key ("GUI", "MultiDisplayMode")) { - multiDisplayMode = keyFile.get_integer ("GUI", "MultiDisplayMode"); - } - - //if (keyFile.has_key ("GUI", "CurvePanelsExpanded")) crvOpen = keyFile.get_integer_list ("GUI", "CurvePanelsExpanded"); - if (keyFile.has_key ("GUI", "CutOverlayBrush")) { - cutOverlayBrush = keyFile.get_double_list ("GUI", "CutOverlayBrush"); - } - - if (keyFile.has_key ("GUI", "NavGuideBrush")) { - navGuideBrush = keyFile.get_double_list ("GUI", "NavGuideBrush"); - } - - if (keyFile.has_key ("GUI", "HistogramPosition")) { - histogramPosition = keyFile.get_integer ("GUI", "HistogramPosition"); - } - - if (keyFile.has_key ("GUI", "HistogramBar")) { - histogramBar = keyFile.get_boolean ("GUI", "HistogramBar"); - } - - if (keyFile.has_key ("GUI", "HistogramFullMode")) { - histogramFullMode = keyFile.get_boolean ("GUI", "HistogramFullMode"); - } - - if (keyFile.has_key ("GUI", "NavigatorRGBUnit")) { - navRGBUnit = (NavigatorUnit)keyFile.get_integer ("GUI", "NavigatorRGBUnit"); - } - - if (keyFile.has_key ("GUI", "NavigatorHSVUnit")) { - navHSVUnit = (NavigatorUnit)keyFile.get_integer ("GUI", "NavigatorHSVUnit"); - } - - if (keyFile.has_key ("GUI", "ShowFilmStripToolBar")) { - showFilmStripToolBar = keyFile.get_boolean ("GUI", "ShowFilmStripToolBar"); - } - - if (keyFile.has_key ("GUI", "FileBrowserToolbarSingleRow")) { - FileBrowserToolbarSingleRow = keyFile.get_boolean ("GUI", "FileBrowserToolbarSingleRow"); - } - - if (keyFile.has_key ("GUI", "HideTPVScrollbar")) { - hideTPVScrollbar = keyFile.get_boolean ("GUI", "HideTPVScrollbar"); - } - - if (keyFile.has_key ("GUI", "UseIconNoText")) { - UseIconNoText = keyFile.get_boolean ("GUI", "UseIconNoText"); - } - - if (keyFile.has_key ("GUI", "HistogramWorking")) { - rtSettings.HistogramWorking = keyFile.get_boolean ("GUI", "HistogramWorking"); - } - - if (keyFile.has_key ("GUI", "CurveBBoxPosition")) { - curvebboxpos = keyFile.get_integer ("GUI", "CurveBBoxPosition"); - } - } - - if (keyFile.has_group ("Crop Settings")) { - if (keyFile.has_key ("Crop Settings", "PPI")) { - cropPPI = keyFile.get_integer ("Crop Settings", "PPI"); - } - } - - if (keyFile.has_group ("Color Management")) { - if (keyFile.has_key ("Color Management", "ICCDirectory")) { - rtSettings.iccDirectory = keyFile.get_string ("Color Management", "ICCDirectory"); - } - - if (keyFile.has_key ("Color Management", "PrinterIntent")) { - rtSettings.printerIntent = static_cast (keyFile.get_integer ("Color Management", "PrinterIntent")); - } - - if (keyFile.has_key ("Color Management", "PrinterBPC")) { - rtSettings.printerBPC = keyFile.get_boolean ("Color Management", "PrinterBPC"); - } - - if (keyFile.has_key ("Color Management", "PrinterProfile")) { - rtSettings.printerProfile = keyFile.get_string ("Color Management", "PrinterProfile"); - } - - if (keyFile.has_key ("Color Management", "MonitorProfile")) { - rtSettings.monitorProfile = keyFile.get_string ("Color Management", "MonitorProfile"); - } - - if (keyFile.has_key ("Color Management", "AutoMonitorProfile")) { - rtSettings.autoMonitorProfile = keyFile.get_boolean ("Color Management", "AutoMonitorProfile"); - } - - if (keyFile.has_key ("Color Management", "Autocielab")) { - rtSettings.autocielab = keyFile.get_boolean ("Color Management", "Autocielab"); - } - - if (keyFile.has_key ("Color Management", "RGBcurvesLumamode_Gamut")) { - rtSettings.rgbcurveslumamode_gamut = keyFile.get_boolean ("Color Management", "RGBcurvesLumamode_Gamut"); - } - - if (keyFile.has_key ("Color Management", "Intent")) { - rtSettings.monitorIntent = static_cast (keyFile.get_integer ("Color Management", "Intent")); - } - - if (keyFile.has_key ("Color Management", "MonitorBPC")) { - rtSettings.monitorBPC = keyFile.get_boolean ("Color Management", "MonitorBPC"); - } - - if (keyFile.has_key ("Color Management", "CRI")) { - rtSettings.CRI_color = keyFile.get_integer ("Color Management", "CRI"); - } - - if (keyFile.has_key ("Color Management", "DenoiseLabgamma")) { - rtSettings.denoiselabgamma = keyFile.get_integer ("Color Management", "DenoiseLabgamma"); - } - - /* - if (keyFile.has_key ("Color Management", "view")) { - rtSettings.viewingdevice = keyFile.get_integer ("Color Management", "view"); - } - - if (keyFile.has_key ("Color Management", "grey")) { - rtSettings.viewingdevicegrey = keyFile.get_integer ("Color Management", "grey"); - } - */ - /* - if (keyFile.has_key ("Color Management", "greySc")) { - rtSettings.viewinggreySc = keyFile.get_integer ("Color Management", "greySc"); - } - */ - if (keyFile.has_key ("Color Management", "CBDLArtif")) { - rtSettings.artifact_cbdl = keyFile.get_double ("Color Management", "CBDLArtif"); - } - - if (keyFile.has_key ("Color Management", "CBDLlevel0")) { - rtSettings.level0_cbdl = keyFile.get_double ("Color Management", "CBDLlevel0"); - } - - if (keyFile.has_key ("Color Management", "CBDLlevel123")) { - rtSettings.level123_cbdl = keyFile.get_double ("Color Management", "CBDLlevel123"); - } - - //if (keyFile.has_key ("Color Management", "Colortoningab")) rtSettings.colortoningab = keyFile.get_double("Color Management", "Colortoningab"); - //if (keyFile.has_key ("Color Management", "Decaction")) rtSettings.decaction = keyFile.get_double("Color Management", "Decaction"); - - if (keyFile.has_key ("Color Management", "WhiteBalanceSpotSize")) { - whiteBalanceSpotSize = keyFile.get_integer ("Color Management", "WhiteBalanceSpotSize"); - } - - if ( keyFile.has_key ("Color Management", "GamutICC")) { - rtSettings.gamutICC = keyFile.get_boolean ("Color Management", "GamutICC"); - } - - //if ( keyFile.has_key ("Color Management", "BWcomplement")) rtSettings.bw_complementary = keyFile.get_boolean("Color Management", "BWcomplement"); - if ( keyFile.has_key ("Color Management", "Ciecamfloat")) { - rtSettings.ciecamfloat = keyFile.get_boolean ("Color Management", "Ciecamfloat"); - } - - if ( keyFile.has_key ("Color Management", "AdobeRGB")) { - rtSettings.adobe = keyFile.get_string ("Color Management", "AdobeRGB"); - } - - if ( keyFile.has_key ("Color Management", "ProPhoto")) { - rtSettings.prophoto = keyFile.get_string ("Color Management", "ProPhoto"); - } - - if ( keyFile.has_key ("Color Management", "ProPhoto10")) { - rtSettings.prophoto10 = keyFile.get_string ("Color Management", "ProPhoto10"); - } - - if ( keyFile.has_key ("Color Management", "WideGamut")) { - rtSettings.widegamut = keyFile.get_string ("Color Management", "WideGamut"); - } - - if ( keyFile.has_key ("Color Management", "sRGB")) { - rtSettings.srgb = keyFile.get_string ("Color Management", "sRGB"); - } - - if ( keyFile.has_key ("Color Management", "sRGB10")) { - rtSettings.srgb10 = keyFile.get_string ("Color Management", "sRGB10"); - } - - if ( keyFile.has_key ("Color Management", "Beta")) { - rtSettings.beta = keyFile.get_string ("Color Management", "Beta"); - } - - if ( keyFile.has_key ("Color Management", "Best")) { - rtSettings.best = keyFile.get_string ("Color Management", "Best"); - } - - if ( keyFile.has_key ("Color Management", "Rec2020")) { - rtSettings.rec2020 = keyFile.get_string ("Color Management", "Rec2020"); - } - - if ( keyFile.has_key ("Color Management", "Bruce")) { - rtSettings.bruce = keyFile.get_string ("Color Management", "Bruce"); - } - - if ( keyFile.has_key ("Color Management", "GamutLch")) { - rtSettings.gamutLch = keyFile.get_boolean ("Color Management", "GamutLch"); - } - - if ( keyFile.has_key ("Color Management", "ProtectRed")) { - rtSettings.protectred = keyFile.get_integer ("Color Management", "ProtectRed"); - } - - if ( keyFile.has_key ("Color Management", "ProtectRedH")) { - rtSettings.protectredh = keyFile.get_double ("Color Management", "ProtectRedH"); - } - - if ( keyFile.has_key ("Color Management", "Amountchroma")) { - rtSettings.amchroma = keyFile.get_integer ("Color Management", "Amountchroma"); - } - - if ( keyFile.has_key ("Color Management", "ClutsDirectory")) { - clutsDir = keyFile.get_string ("Color Management", "ClutsDirectory"); - } - - //if( keyFile.has_key ("Color Management", "Ciebadpixgauss")) rtSettings.ciebadpixgauss = keyFile.get_boolean("Color Management", "Ciebadpixgauss"); - - } - - if (keyFile.has_group ("Batch Processing")) { - if (keyFile.has_key ("Batch Processing", "AdjusterBehavior")) { - baBehav = keyFile.get_integer_list ("Batch Processing", "AdjusterBehavior"); - } - } - - if (keyFile.has_group ("Sounds")) { - if (keyFile.has_key ("Sounds", "Enable")) { - sndEnable = keyFile.get_boolean ("Sounds", "Enable"); - } - - if (keyFile.has_key ("Sounds", "BatchQueueDone")) { - sndBatchQueueDone = keyFile.get_string ("Sounds", "BatchQueueDone"); - } - - if (keyFile.has_key ("Sounds", "LngEditProcDone")) { - sndLngEditProcDone = keyFile.get_string ("Sounds", "LngEditProcDone"); - } - - if (keyFile.has_key ("Sounds", "LngEditProcDoneSecs")) { - sndLngEditProcDoneSecs = keyFile.get_double ("Sounds", "LngEditProcDoneSecs"); - } - } - - if (keyFile.has_group ("Fast Export")) { - if (keyFile.has_key ("Fast Export", "fastexport_bypass_sharpening" )) { - fastexport_bypass_sharpening = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sharpening" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_sharpenEdge" )) { - fastexport_bypass_sharpenEdge = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sharpenEdge" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_sharpenMicro" )) { - fastexport_bypass_sharpenMicro = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sharpenMicro" ); - } - - //if (keyFile.has_key ("Fast Export", "fastexport_bypass_lumaDenoise" )) fastexport_bypass_lumaDenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_lumaDenoise" ); - //if (keyFile.has_key ("Fast Export", "fastexport_bypass_colorDenoise" )) fastexport_bypass_colorDenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_colorDenoise" ); - if (keyFile.has_key ("Fast Export", "fastexport_bypass_defringe" )) { - fastexport_bypass_defringe = keyFile.get_boolean ("Fast Export", "fastexport_bypass_defringe" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_dirpyrDenoise" )) { - fastexport_bypass_dirpyrDenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_dirpyrDenoise" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_sh_hq" )) { - fastexport_bypass_sh_hq = keyFile.get_boolean ("Fast Export", "fastexport_bypass_sh_hq" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_dirpyrequalizer" )) { - fastexport_bypass_dirpyrequalizer = keyFile.get_boolean ("Fast Export", "fastexport_bypass_dirpyrequalizer" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_wavelet" )) { - fastexport_bypass_wavelet = keyFile.get_boolean ("Fast Export", "fastexport_bypass_wavelet" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_raw_dmethod" )) { - fastexport_raw_bayer_method = keyFile.get_string ("Fast Export", "fastexport_raw_dmethod" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_raw_bayer_method" )) { - fastexport_raw_bayer_method = keyFile.get_string ("Fast Export", "fastexport_raw_bayer_method" ); - } - -//if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_all_enhance" )) fastexport_bypass_raw_bayer_all_enhance = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_all_enhance" ); - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_dcb_iterations" )) { - fastexport_bypass_raw_bayer_dcb_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_dcb_iterations" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations" )) { - fastexport_bypass_raw_bayer_dcb_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_dcb_enhance" )) { - fastexport_bypass_raw_bayer_dcb_enhance = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_dcb_enhance" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance" )) { - fastexport_bypass_raw_bayer_dcb_enhance = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_lmmse_iterations" )) { - fastexport_bypass_raw_bayer_lmmse_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_lmmse_iterations" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations")) { - fastexport_bypass_raw_bayer_lmmse_iterations = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations"); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_linenoise" )) { - fastexport_bypass_raw_bayer_linenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_linenoise" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_linenoise" )) { - fastexport_bypass_raw_bayer_linenoise = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_linenoise" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_greenthresh" )) { - fastexport_bypass_raw_bayer_greenthresh = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_greenthresh" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh" )) { - fastexport_bypass_raw_bayer_greenthresh = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_raw_xtrans_method" )) { - fastexport_raw_xtrans_method = keyFile.get_string ("Fast Export", "fastexport_raw_xtrans_method" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_ccSteps" )) { - fastexport_bypass_raw_ccSteps = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_ccSteps" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_ca" )) { - fastexport_bypass_raw_ca = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_ca" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_df" )) { - fastexport_bypass_raw_df = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_df" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_bypass_raw_ff" )) { - fastexport_bypass_raw_ff = keyFile.get_boolean ("Fast Export", "fastexport_bypass_raw_ff" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_icm_input" )) { - fastexport_icm_input = keyFile.get_string ("Fast Export", "fastexport_icm_input" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_icm_working" )) { - fastexport_icm_working = keyFile.get_string ("Fast Export", "fastexport_icm_working" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_icm_output" )) { - fastexport_icm_output = keyFile.get_string ("Fast Export", "fastexport_icm_output" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_icm_output_intent" )) { - fastexport_icm_outputIntent = static_cast (keyFile.get_integer ("Fast Export", "fastexport_icm_output_intent" )); - } - - if (keyFile.has_key ("Fast Export", "fastexport_icm_output_bpc" )) { - fastexport_icm_outputBPC = keyFile.get_boolean ("Fast Export", "fastexport_icm_output_bpc" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_icm_gamma" )) { - fastexport_icm_gamma = keyFile.get_string ("Fast Export", "fastexport_icm_gamma" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_enabled" )) { - fastexport_resize_enabled = keyFile.get_boolean ("Fast Export", "fastexport_resize_enabled" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_scale" )) { - fastexport_resize_scale = keyFile.get_double ("Fast Export", "fastexport_resize_scale" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_appliesTo" )) { - fastexport_resize_appliesTo = keyFile.get_string ("Fast Export", "fastexport_resize_appliesTo" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_method" )) { - fastexport_resize_method = keyFile.get_string ("Fast Export", "fastexport_resize_method" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_dataspec" )) { - fastexport_resize_dataspec = keyFile.get_integer ("Fast Export", "fastexport_resize_dataspec" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_width" )) { - fastexport_resize_width = keyFile.get_integer ("Fast Export", "fastexport_resize_width" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_resize_height" )) { - fastexport_resize_height = keyFile.get_integer ("Fast Export", "fastexport_resize_height" ); - } - - if (keyFile.has_key ("Fast Export", "fastexport_use_fast_pipeline" )) { - fastexport_use_fast_pipeline = keyFile.get_integer ("Fast Export", "fastexport_use_fast_pipeline" ); - } - } - - if (keyFile.has_group ("Dialogs")) { - safeDirGet (keyFile, "Dialogs", "LastIccDir", lastIccDir); - safeDirGet (keyFile, "Dialogs", "LastDarkframeDir", lastDarkframeDir); - safeDirGet (keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir); - safeDirGet (keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastRetinexDir", lastRetinexDir); - safeDirGet (keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastBWCurvesDir", lastBWCurvesDir); - - safeDirGet (keyFile, "Dialogs", "LastToneCurvesDir", lastToneCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); - safeDirGet (keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); - safeDirGet (keyFile, "Dialogs", "LastLensProfileDir", lastLensProfileDir); - - if (keyFile.has_key ("Dialogs", "GimpPluginShowInfoDialog")) { - gimpPluginShowInfoDialog = keyFile.get_boolean ("Dialogs", "GimpPluginShowInfoDialog"); - } - } - - if (keyFile.has_group ("Lensfun")) { - if (keyFile.has_key ("Lensfun", "DBDirectory")) { - rtSettings.lensfunDbDirectory = keyFile.get_string ("Lensfun", "DBDirectory"); - } - } - -// -------------------------------------------------------------------------------------------------------- - - filterOutParsedExtensions (); - - return; - - } - } catch (Glib::Error &err) { - Glib::ustring msg = Glib::ustring::compose ("Options::readFromFile / Error code %1 while reading values from \"%2\":\n%3", err.code(), fname, err.what()); - - if (options.rtSettings.verbose) { - printf ("%s\n", msg.c_str()); - } - - throw Error (msg); - } catch (...) { - Glib::ustring msg = Glib::ustring::compose ("Options::readFromFile / Unknown exception while trying to load \"%1\"!", fname); - - if (options.rtSettings.verbose) { - printf ("%s\n", msg.c_str()); - } - - throw Error (msg); - } -} - -bool Options::safeDirGet (const Glib::KeyFile& keyFile, const Glib::ustring& section, - const Glib::ustring& entryName, Glib::ustring& destination) -{ - try { - - if (keyFile.has_key (section, entryName) && !keyFile.get_string (section, entryName).empty ()) { - destination = keyFile.get_string (section, entryName); - return true; - } - - } catch (Glib::KeyFileError&) {} - - return false; -} - -void Options::saveToFile (Glib::ustring fname) -{ - - Glib::ustring keyData; - - try { - - Glib::KeyFile keyFile; - - keyFile.set_boolean ("General", "TabbedEditor", tabbedUI); - keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit); - - if (startupDir == STARTUPDIR_HOME) { - keyFile.set_string ("General", "StartupDirectory", "home"); - } else if (startupDir == STARTUPDIR_CURRENT) { - keyFile.set_string ("General", "StartupDirectory", "current"); - } else if (startupDir == STARTUPDIR_CUSTOM) { - keyFile.set_string ("General", "StartupDirectory", "custom"); - } else if (startupDir == STARTUPDIR_LAST) { - keyFile.set_string ("General", "StartupDirectory", "last"); - } - - keyFile.set_string ("General", "StartupPath", startupPath); - keyFile.set_string ("General", "DateFormat", dateFormat); - keyFile.set_integer ("General", "AdjusterMinDelay", adjusterMinDelay); - keyFile.set_integer ("General", "AdjusterMaxDelay", adjusterMaxDelay); - keyFile.set_boolean ("General", "MultiUser", multiUser); - keyFile.set_string ("General", "Language", language); - keyFile.set_boolean ("General", "LanguageAutoDetect", languageAutoDetect); - keyFile.set_string ("General", "Theme", theme); - keyFile.set_string ("General", "Version", RTVERSION); - keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); - keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); - keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); - keyFile.set_double ("General", "BotLeft", rtSettings.bot_left); - keyFile.set_double ("General", "TopLeft", rtSettings.top_left); - keyFile.set_double ("General", "TopRight", rtSettings.top_right); - keyFile.set_double ("General", "BotRight", rtSettings.bot_right); - keyFile.set_double ("General", "EDdetec", rtSettings.ed_detec); - keyFile.set_double ("General", "EDdetecStr", rtSettings.ed_detecStr); - keyFile.set_double ("General", "EDLow", rtSettings.ed_low); - keyFile.set_double ("General", "EDLipinfl", rtSettings.ed_lipinfl); - keyFile.set_double ("General", "EDLipampl", rtSettings.ed_lipampl); - - - keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); - keyFile.set_string ("External Editor", "GimpDir", gimpDir); - keyFile.set_string ("External Editor", "PhotoshopDir", psDir); - keyFile.set_string ("External Editor", "CustomEditor", customEditorProg); - - keyFile.set_boolean ("File Browser", "BrowseOnlyRaw", fbOnlyRaw); - keyFile.set_boolean ("File Browser", "BrowserShowsDate", fbShowDateTime); - keyFile.set_boolean ("File Browser", "BrowserShowsExif", fbShowBasicExif); - keyFile.set_boolean ("File Browser", "BrowserShowsExpComp", fbShowExpComp); - keyFile.set_boolean ("File Browser", "BrowserShowsHidden", fbShowHidden); - keyFile.set_integer ("File Browser", "ThumbnailSize", thumbSize); - keyFile.set_integer ("File Browser", "ThumbnailSizeTab", thumbSizeTab); - keyFile.set_integer ("File Browser", "ThumbnailSizeQueue", thumbSizeQueue); - keyFile.set_integer ("File Browser", "SameThumbSize", sameThumbSize); - keyFile.set_integer ("File Browser", "MaxPreviewHeight", maxThumbnailHeight); - keyFile.set_integer ("File Browser", "MaxCacheEntries", maxCacheEntries); - Glib::ArrayHandle pext = parseExtensions; - keyFile.set_string_list ("File Browser", "ParseExtensions", pext); - Glib::ArrayHandle pextena = parseExtensionsEnabled; - keyFile.set_integer_list ("File Browser", "ParseExtensionsEnabled", pextena); - keyFile.set_integer ("File Browser", "ThumbnailArrangement", fbArrangement); - keyFile.set_integer ("File Browser", "ThumbnailInterpolation", thumbInterp); - Glib::ArrayHandle pfav = favoriteDirs; - keyFile.set_string_list ("File Browser", "FavoriteDirs", pfav); - Glib::ArrayHandle pren = renameTemplates; - keyFile.set_string_list ("File Browser", "RenameTemplates", pren); - keyFile.set_boolean ("File Browser", "RenameUseTemplates", renameUseTemplates); - Glib::ArrayHandle ptzoom = thumbnailZoomRatios; - keyFile.set_double_list ("File Browser", "ThumbnailZoomRatios", ptzoom); - keyFile.set_boolean ("File Browser", "OverlayedFileNames", overlayedFileNames); - keyFile.set_boolean ("File Browser", "FilmStripOverlayedFileNames", filmStripOverlayedFileNames); - keyFile.set_boolean ("File Browser", "ShowFileNames", showFileNames ); - keyFile.set_boolean ("File Browser", "FilmStripShowFileNames", filmStripShowFileNames ); - keyFile.set_boolean ("File Browser", "InternalThumbIfUntouched", internalThumbIfUntouched ); - keyFile.set_boolean ("File Browser", "menuGroupRank", menuGroupRank); - keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel); - keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations); - keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations); - keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg); - keyFile.set_integer ("File Browser", "MaxRecentFolders", maxRecentFolders); - { - std::vector temp; - temp.reserve (maxRecentFolders); - - for (unsigned int i = 0; i < std::min (recentFolders.size(), maxRecentFolders); i++) { - temp.push_back (recentFolders[i]); - } - - keyFile.set_string_list ("File Browser", "RecentFolders", temp); - } - keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); - keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); - keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); - - keyFile.set_integer ("Performance", "RgbDenoiseThreadLimit", rgbDenoiseThreadLimit); - keyFile.set_double ("Performance", "NRauto", rtSettings.nrauto); - keyFile.set_double ("Performance", "NRautomax", rtSettings.nrautomax); - keyFile.set_double ("Performance", "NRhigh", rtSettings.nrhigh); - keyFile.set_integer ("Performance", "NRWavlevel", rtSettings.nrwavlevel); - keyFile.set_integer ("Performance", "LevNR", rtSettings.leveldnv); - keyFile.set_integer ("Performance", "LevNRTI", rtSettings.leveldnti); - keyFile.set_integer ("Performance", "LevNRAUT", rtSettings.leveldnaut); - keyFile.set_integer ("Performance", "LevNRLISS", rtSettings.leveldnliss); - keyFile.set_integer ("Performance", "SIMPLNRAUT", rtSettings.leveldnautsimpl); - keyFile.set_integer ("Performance", "ClutCacheSize", clutCacheSize); - keyFile.set_integer ("Performance", "MaxInspectorBuffers", maxInspectorBuffers); - keyFile.set_integer ("Performance", "PreviewDemosaicFromSidecar", prevdemo); - keyFile.set_boolean ("Performance", "Daubechies", rtSettings.daubech); - keyFile.set_boolean ("Performance", "SerializeTiffRead", serializeTiffRead); - - keyFile.set_string ("Output", "Format", saveFormat.format); - keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); - keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); - keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); - keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); - keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); - keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); - - keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format); - keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality); - keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression); - keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits); - keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits); - keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed); - keyFile.set_boolean ("Output", "SaveProcParamsBatch", saveFormatBatch.saveParams); - - keyFile.set_string ("Output", "PathTemplate", savePathTemplate); - keyFile.set_string ("Output", "PathFolder", savePathFolder); - keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix); - keyFile.set_boolean ("Output", "ForceFormatOpts", forceFormatOpts); - keyFile.set_integer ("Output", "SaveMethodNum", saveMethodNum); - 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); - keyFile.set_string ("Profiles", "LoadSaveProfilePath", loadSaveProfilePath); - keyFile.set_string ("Profiles", "RawDefault", defProfRaw); - keyFile.set_string ("Profiles", "ImgDefault", defProfImg); - keyFile.set_boolean ("Profiles", "FilledProfile", filledProfile); - keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); - keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); - keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); - keyFile.set_string ("Profiles", "CustomProfileBuilderPath", CPBPath); - keyFile.set_integer ("Profiles", "CustomProfileBuilderKeys", CPBKeys); - - keyFile.set_integer ("GUI", "WindowWidth", windowWidth); - keyFile.set_integer ("GUI", "WindowHeight", windowHeight); - keyFile.set_integer ("GUI", "WindowX", windowX); - keyFile.set_integer ("GUI", "WindowY", windowY); - keyFile.set_integer ("GUI", "WindowMonitor", windowMonitor); - keyFile.set_integer ("GUI", "MeowMonitor", meowMonitor); - keyFile.set_boolean ("GUI", "MeowFullScreen", meowFullScreen); - keyFile.set_boolean ("GUI", "MeowMaximized", meowMaximized); - keyFile.set_integer ("GUI", "MeowWidth", meowWidth); - keyFile.set_integer ("GUI", "MeowHeight", meowHeight); - keyFile.set_integer ("GUI", "MeowX", meowX); - keyFile.set_integer ("GUI", "MeowY", meowY); - keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); - keyFile.set_integer ("GUI", "DetailWindowWidth", detailWindowWidth); - keyFile.set_integer ("GUI", "DetailWindowHeight", detailWindowHeight); - keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); - keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); - keyFile.set_integer ("GUI", "SortType", dirBrowserSortType); - keyFile.set_integer ("GUI", "PreferencesWidth", preferencesWidth); - keyFile.set_integer ("GUI", "PreferencesHeight", preferencesHeight); - keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth); - keyFile.set_integer ("GUI", "SaveAsDialogHeight", saveAsDialogHeight); - keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth); - keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth); - keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight); - keyFile.set_boolean ("GUI", "BrowserToolPanelOpened", browserToolPanelOpened); - keyFile.set_boolean ("GUI", "EditorFilmStripOpened", editorFilmStripOpened); - keyFile.set_boolean ("GUI", "BrowserDirPanelOpened", browserDirPanelOpened); - keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth); - keyFile.set_string ("GUI", "FontFamily", fontFamily); - keyFile.set_integer ("GUI", "FontSize", fontSize); - keyFile.set_string ("GUI", "CPFontFamily", CPFontFamily); - keyFile.set_integer ("GUI", "CPFontSize", CPFontSize); - keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); - keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor); - keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan); - keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); - keyFile.set_boolean ("GUI", "ShowHistory", showHistory); - keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); - keyFile.set_boolean ("GUI", "ShowInfo", showInfo); - keyFile.set_boolean ("GUI", "MainNBVertical", mainNBVertical); - keyFile.set_boolean ("GUI", "ShowClippedHighlights", showClippedHighlights); - keyFile.set_boolean ("GUI", "ShowClippedShadows", showClippedShadows); - keyFile.set_integer ("GUI", "FrameColor", bgcolor); - keyFile.set_boolean ("GUI", "ProcessingQueueEnbled", procQueueEnabled); - Glib::ArrayHandle tpopen = tpOpen; - keyFile.set_integer_list ("GUI", "ToolPanelsExpanded", tpopen); - keyFile.set_boolean ("GUI", "ToolPanelsExpandedAutoSave", autoSaveTpOpen); - keyFile.set_integer ("GUI", "MultiDisplayMode", multiDisplayMode); - keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); - keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); - keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); - keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); - keyFile.set_boolean ("GUI", "HistogramFullMode", histogramFullMode); - keyFile.set_integer ("GUI", "NavigatorRGBUnit", (int)navRGBUnit); - keyFile.set_integer ("GUI", "NavigatorHSVUnit", (int)navHSVUnit); - keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar); - keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow); - keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar); - keyFile.set_boolean ("GUI", "UseIconNoText", UseIconNoText); - keyFile.set_boolean ("GUI", "HistogramWorking", rtSettings.HistogramWorking); - keyFile.set_integer ("GUI", "CurveBBoxPosition", curvebboxpos); - - //Glib::ArrayHandle crvopen = crvOpen; - //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); - - keyFile.set_integer ("Crop Settings", "PPI", cropPPI); - - keyFile.set_string ("Color Management", "PrinterProfile", rtSettings.printerProfile); - keyFile.set_integer ("Color Management", "PrinterIntent", rtSettings.printerIntent); - keyFile.set_boolean ("Color Management", "PrinterBPC", rtSettings.printerBPC); - - keyFile.set_string ("Color Management", "ICCDirectory", rtSettings.iccDirectory); - keyFile.set_string ("Color Management", "MonitorProfile", rtSettings.monitorProfile); - keyFile.set_boolean ("Color Management", "AutoMonitorProfile", rtSettings.autoMonitorProfile); - keyFile.set_boolean ("Color Management", "Autocielab", rtSettings.autocielab); - keyFile.set_boolean ("Color Management", "RGBcurvesLumamode_Gamut", rtSettings.rgbcurveslumamode_gamut); - keyFile.set_integer ("Color Management", "Intent", rtSettings.monitorIntent); - keyFile.set_boolean ("Color Management", "MonitorBPC", rtSettings.monitorBPC); - //keyFile.set_integer ("Color Management", "view", rtSettings.viewingdevice); - //keyFile.set_integer ("Color Management", "grey", rtSettings.viewingdevicegrey); -// keyFile.set_integer ("Color Management", "greySc", rtSettings.viewinggreySc); - - keyFile.set_string ("Color Management", "AdobeRGB", rtSettings.adobe); - keyFile.set_string ("Color Management", "ProPhoto", rtSettings.prophoto); - keyFile.set_string ("Color Management", "ProPhoto10", rtSettings.prophoto10); - keyFile.set_string ("Color Management", "WideGamut", rtSettings.widegamut); - keyFile.set_string ("Color Management", "sRGB", rtSettings.srgb); - keyFile.set_string ("Color Management", "sRGB10", rtSettings.srgb10); - keyFile.set_string ("Color Management", "Beta", rtSettings.beta); - keyFile.set_string ("Color Management", "Best", rtSettings.best); - keyFile.set_string ("Color Management", "Rec2020", rtSettings.rec2020); - keyFile.set_string ("Color Management", "Bruce", rtSettings.bruce); - keyFile.set_integer ("Color Management", "WhiteBalanceSpotSize", whiteBalanceSpotSize); - keyFile.set_boolean ("Color Management", "GamutICC", rtSettings.gamutICC); - //keyFile.set_boolean ("Color Management", "BWcomplement", rtSettings.bw_complementary); - keyFile.set_boolean ("Color Management", "Ciecamfloat", rtSettings.ciecamfloat); - keyFile.set_boolean ("Color Management", "GamutLch", rtSettings.gamutLch); - keyFile.set_integer ("Color Management", "ProtectRed", rtSettings.protectred); - keyFile.set_integer ("Color Management", "Amountchroma", rtSettings.amchroma); - keyFile.set_double ("Color Management", "ProtectRedH", rtSettings.protectredh); - keyFile.set_integer ("Color Management", "CRI", rtSettings.CRI_color); - keyFile.set_integer ("Color Management", "DenoiseLabgamma", rtSettings.denoiselabgamma); - //keyFile.set_boolean ("Color Management", "Ciebadpixgauss", rtSettings.ciebadpixgauss); - keyFile.set_double ("Color Management", "CBDLArtif", rtSettings.artifact_cbdl); - keyFile.set_double ("Color Management", "CBDLlevel0", rtSettings.level0_cbdl); - keyFile.set_double ("Color Management", "CBDLlevel123", rtSettings.level123_cbdl); - //keyFile.set_double ("Color Management", "Colortoningab", rtSettings.colortoningab); - //keyFile.set_double ("Color Management", "Decaction", rtSettings.decaction); - keyFile.set_string ("Color Management", "ClutsDirectory", clutsDir); - - - Glib::ArrayHandle bab = baBehav; - keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); - - keyFile.set_boolean ("Sounds", "Enable", sndEnable); - keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone); - keyFile.set_string ("Sounds", "LngEditProcDone", sndLngEditProcDone); - keyFile.set_double ("Sounds", "LngEditProcDoneSecs", sndLngEditProcDoneSecs); - - - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpening", fastexport_bypass_sharpening); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenEdge", fastexport_bypass_sharpenEdge); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenMicro", fastexport_bypass_sharpenMicro); - //keyFile.set_boolean ("Fast Export", "fastexport_bypass_lumaDenoise" , fastexport_bypass_lumaDenoise); - //keyFile.set_boolean ("Fast Export", "fastexport_bypass_colorDenoise" , fastexport_bypass_colorDenoise); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_defringe", fastexport_bypass_defringe); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrDenoise", fastexport_bypass_dirpyrDenoise); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sh_hq", fastexport_bypass_sh_hq); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrequalizer", fastexport_bypass_dirpyrequalizer); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_wavelet", fastexport_bypass_wavelet); - keyFile.set_string ("Fast Export", "fastexport_raw_bayer_method", fastexport_raw_bayer_method); - //keyFile.set_boolean ("Fast Export", "fastexport_bypass_bayer_raw_all_enhance" , fastexport_bypass_raw_bayer_all_enhance); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations", fastexport_bypass_raw_bayer_dcb_iterations); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance", fastexport_bypass_raw_bayer_dcb_enhance); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations", fastexport_bypass_raw_bayer_lmmse_iterations); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_linenoise", fastexport_bypass_raw_bayer_linenoise); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh", fastexport_bypass_raw_bayer_greenthresh); - keyFile.set_string ("Fast Export", "fastexport_raw_xtrans_method", fastexport_raw_xtrans_method); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ccSteps", fastexport_bypass_raw_ccSteps); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ca", fastexport_bypass_raw_ca); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_df", fastexport_bypass_raw_df); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ff", fastexport_bypass_raw_ff); - keyFile.set_string ("Fast Export", "fastexport_icm_input", fastexport_icm_input); - keyFile.set_string ("Fast Export", "fastexport_icm_working", fastexport_icm_working); - keyFile.set_string ("Fast Export", "fastexport_icm_output", fastexport_icm_output); - keyFile.set_integer ("Fast Export", "fastexport_icm_output_intent", fastexport_icm_outputIntent); - keyFile.set_boolean ("Fast Export", "fastexport_icm_output_bpc", fastexport_icm_outputBPC); - keyFile.set_string ("Fast Export", "fastexport_icm_gamma", fastexport_icm_gamma); - keyFile.set_boolean ("Fast Export", "fastexport_resize_enabled", fastexport_resize_enabled); - keyFile.set_double ("Fast Export", "fastexport_resize_scale", fastexport_resize_scale); - keyFile.set_string ("Fast Export", "fastexport_resize_appliesTo", fastexport_resize_appliesTo); - keyFile.set_string ("Fast Export", "fastexport_resize_method", fastexport_resize_method); - keyFile.set_integer ("Fast Export", "fastexport_resize_dataspec", fastexport_resize_dataspec); - keyFile.set_integer ("Fast Export", "fastexport_resize_width", fastexport_resize_width); - keyFile.set_integer ("Fast Export", "fastexport_resize_height", fastexport_resize_height); - keyFile.set_integer ("Fast Export", "fastexport_use_fast_pipeline", fastexport_use_fast_pipeline); - - keyFile.set_string ("Dialogs", "LastIccDir", lastIccDir); - keyFile.set_string ("Dialogs", "LastDarkframeDir", lastDarkframeDir); - keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir); - keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); - keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir); - keyFile.set_string ("Dialogs", "LastRetinexDir", lastRetinexDir); - keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); - keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); - keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir); - keyFile.set_string ("Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); - keyFile.set_string ("Dialogs", "LastBWCurvesDir", lastBWCurvesDir); - keyFile.set_string ("Dialogs", "LastToneCurvesDir", lastToneCurvesDir); - keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); - keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); - keyFile.set_string ("Dialogs", "LastLensProfileDir", lastLensProfileDir); - keyFile.set_boolean ("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog); - - keyFile.set_string ("Lensfun", "DBDirectory", rtSettings.lensfunDbDirectory); - - keyData = keyFile.to_data (); - - } catch (Glib::KeyFileError &e) { - throw Error (e.what()); - } - - FILE *f = g_fopen (fname.c_str (), "wt"); - - if (f == nullptr) { - std::cout << "Warning! Unable to save your preferences to: " << fname << std::endl; - Glib::ustring msg_ = Glib::ustring::compose (M ("MAIN_MSG_WRITEFAILED"), fname.c_str()); - throw Error (msg_); - } else { - fprintf (f, "%s", keyData.c_str ()); - fclose (f); - } -} - -void Options::load (bool lightweight) -{ - - // Find the application data path - - const gchar* path; - Glib::ustring dPath; - - path = g_getenv ("RT_SETTINGS"); - - if (path != nullptr) { - rtdir = Glib::ustring (path); - - if (!Glib::path_is_absolute (rtdir)) { - Glib::ustring msg = Glib::ustring::compose ("Settings path %1 is not absolute", rtdir); - throw Error (msg); - } - } else { -#ifdef WIN32 - WCHAR pathW[MAX_PATH] = {0}; - - if (SHGetSpecialFolderPathW (NULL, pathW, CSIDL_LOCAL_APPDATA, false)) { - char pathA[MAX_PATH]; - WideCharToMultiByte (CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0); - rtdir = Glib::build_filename (Glib::ustring (pathA), Glib::ustring (CACHEFOLDERNAME)); - } - -#else - rtdir = Glib::build_filename (Glib::ustring (g_get_user_config_dir ()), Glib::ustring (CACHEFOLDERNAME)); -#endif - } - - if (options.rtSettings.verbose) { - printf ("Settings directory (rtdir) = %s\n", rtdir.c_str()); - } - - // Set the cache folder in RT's base folder - cacheBaseDir = Glib::build_filename (argv0, "cache"); - - // Read the global option file (the one located in the application's base folder) - try { - options.readFromFile (Glib::build_filename (argv0, "options")); - } catch (Options::Error &) { - // ignore errors here - } - - // Modify the path of the cache folder to the one provided in RT_CACHE environment variable - path = g_getenv ("RT_CACHE"); - - if (path != nullptr) { - cacheBaseDir = Glib::ustring (path); - - if (!Glib::path_is_absolute (cacheBaseDir)) { - Glib::ustring msg = Glib::ustring::compose ("Cache base dir %1 is not absolute", cacheBaseDir); - throw Error (msg); - } - } - // No environment variable provided, so falling back to the multi user mode, is enabled - else if (options.multiUser) { -#ifdef WIN32 - cacheBaseDir = Glib::build_filename (rtdir, "cache"); -#else - cacheBaseDir = Glib::build_filename (Glib::ustring (g_get_user_cache_dir()), Glib::ustring (CACHEFOLDERNAME)); -#endif - } - - // Check if RT is installed in Multi-User mode - if (options.multiUser) { - // Read the user option file (the one located somewhere in the user's home folder) - // Those values supersets those of the global option file - try { - options.readFromFile (Glib::build_filename (rtdir, "options")); - } catch (Options::Error &) { - // If the local option file does not exist or is broken, and the local cache folder does not exist, recreate it - if (!g_mkdir_with_parents (rtdir.c_str (), 511)) { - // Save the option file - options.saveToFile (Glib::build_filename (rtdir, "options")); - } - } - -#ifdef __APPLE__ - // make sure .local/share exists on OS X so we don't get problems with recently-used.xbel - g_mkdir_with_parents (g_get_user_data_dir(), 511); -#endif - } - - if (options.rtSettings.verbose) { - printf ("Cache directory (cacheBaseDir) = %s\n", cacheBaseDir.c_str()); - } - - // Update profile's path and recreate it if necessary - options.updatePaths(); - - // Check default Raw and Img procparams existence - if (options.defProfRaw.empty()) { - options.defProfRaw = DEFPROFILE_INTERNAL; - } else { - Glib::ustring tmpFName = options.findProfilePath (options.defProfRaw); - - if (!tmpFName.empty()) { - if (options.rtSettings.verbose) { - printf ("Raws' default profile \"%s\" found\n", options.defProfRaw.c_str()); - } - } else { - if (options.rtSettings.verbose) { - printf ("Raws' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfRaw.c_str()); - } - - options.defProfRaw = DEFPROFILE_INTERNAL; - options.defProfRawMissing = true; - } - } - - if (options.defProfImg.empty()) { - options.defProfImg = DEFPROFILE_INTERNAL; - } else { - Glib::ustring tmpFName = options.findProfilePath (options.defProfImg); - - if (!tmpFName.empty()) { - if (options.rtSettings.verbose) { - printf ("Images' default profile \"%s\" found\n", options.defProfImg.c_str()); - } - } else { - if (options.rtSettings.verbose) { - printf ("Images' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfImg.c_str()); - } - - options.defProfImg = DEFPROFILE_INTERNAL; - options.defProfImgMissing = true; - } - } - - //We handle languages using a hierarchy of translations. The top of the hierarchy is default. This includes a default translation for all items - // (most likely using simple English). The next level is the language: for instance, English, French, Chinese, etc. This file should contain a - // generic translation for all items which differ from default. Finally there is the locale. This is region-specific items which differ from the - // language file. These files must be name in the format (), where Language is the name of the language which it inherits from, - // and LC is the local code. Some examples of this would be English (US) (American English), French (FR) (Franch French), French (CA) (Canadian - // French), etc. - // - // Each level will only contain the differences between itself and its parent translation. For instance, English (UK) or English (CA) may - // include the translation "HISTORY_MSG_34;Avoid Colour Clipping" where English would translate it as "HISTORY_MSG_34;Avoid Color Clipping" (note - // the difference in the spelling of 'colour'). - // - // It is important that when naming the translation files, that you stick to the format or (). We depend on that to figure - // out which are the parent translations. Furthermore, there must be a file for each locale () -- you cannot have - // 'French (CA)' unless there is a file 'French'. - - Glib::ustring defaultTranslation = Glib::build_filename (argv0, "languages", "default"); - Glib::ustring languageTranslation = ""; - Glib::ustring localeTranslation = ""; - - if (options.languageAutoDetect) { - options.language = langMgr.getOSUserLanguage(); - } - - if (!options.language.empty()) { - std::vector langPortions = Glib::Regex::split_simple (" ", options.language); - - if (langPortions.size() >= 1) { - languageTranslation = Glib::build_filename (argv0, "languages", langPortions.at (0)); - } - - if (langPortions.size() >= 2) { - localeTranslation = Glib::build_filename (argv0, "languages", options.language); - } - } - - langMgr.load (localeTranslation, new MultiLangMgr (languageTranslation, new MultiLangMgr (defaultTranslation))); - - rtengine::init (&options.rtSettings, argv0, rtdir, !lightweight); -} - -void Options::save () -{ - - if (!options.multiUser) { - options.saveToFile (Glib::build_filename (argv0, "options")); - } else { - options.saveToFile (Glib::build_filename (rtdir, "options")); - } -} - -/* - * return true if ext is a parsed extension (retained or not) - */ -bool Options::is_parse_extention (Glib::ustring fname) -{ - Glib::ustring ext = getExtension (fname).lowercase(); - - if (!ext.empty()) { - // there is an extension to the filename - - // look out if it has one of the listed extensions (selected or not) - for (unsigned int i = 0; i < parseExtensions.size(); i++) { - if (ext == parseExtensions[i]) { - return true; - } - } - } - - return false; -} - -/* - * return true if fname ends with one of the retained image file extensions - */ -bool Options::has_retained_extention (Glib::ustring fname) -{ - - Glib::ustring ext = getExtension (fname).lowercase(); - - if (!ext.empty()) { - // there is an extension to the filename - - // look out if it has one of the retained extensions - for (unsigned int i = 0; i < parsedExtensions.size(); i++) { - if (ext == parsedExtensions[i]) { - return true; - } - } - } - - return false; -} - -/* - * return true if ext is an enabled extension - */ -bool Options::is_extention_enabled (Glib::ustring ext) -{ - for (int j = 0; j < (int)parseExtensions.size(); j++) - if (parseExtensions[j].casefold() == ext.casefold()) { - return j >= (int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j]; - } - - return false; -} From 9f75b197eacfd9730657af197e4ed7cf74952cbd Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 16 Sep 2017 18:52:48 +0200 Subject: [PATCH 3/3] some cleanups --- rtengine/procparams.cc | 6 +++--- rtengine/procparams.h | 22 +++++++++++----------- rtgui/lensprofile.cc | 28 ++++++++++++++++------------ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index a18982325..886e99c08 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -52,7 +52,7 @@ const int br = (int) options.rtSettings.bot_right; const int tl = (int) options.rtSettings.top_left; const int bl = (int) options.rtSettings.bot_left; -const char *LensProfParams::methodstring[static_cast(LensProfParams::eLcMode::lcp) + 1u] = {"none", "lfauto", "lfmanual", "lcp"}; +const char *LensProfParams::methodstring[static_cast(LensProfParams::eLcMode::LC_LCP) + 1u] = {"none", "lfauto", "lfmanual", "lcp"}; const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "fast", "mono", "none", "pixelshift" }; const char *RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::numMethods] = {"3-pass (best)", "1-pass (medium)", "fast", "mono", "none" }; @@ -920,7 +920,7 @@ void ToneCurveParams::setDefaults() void LensProfParams::setDefaults() { - lcMode = eLcMode::none; + lcMode = eLcMode::LC_NOCORRECTION; lcpFile = ""; useDist = useVign = true; useCA = false; @@ -5836,7 +5836,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } if(ppVersion < 327 && !lensProf.lcpFile.empty()) { - lensProf.lcMode = LensProfParams::eLcMode::lcp; + lensProf.lcMode = LensProfParams::eLcMode::LC_LCP; } } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 9e7b728eb..8c7cb6a1d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -830,13 +830,13 @@ class LensProfParams public: enum class eLcMode { - none, // No lens correction - lensfunAutoMatch, // Lens correction using auto matched lensfun database entry - lensfunManual, // Lens correction using manually selected lensfun database entry - lcp // Lens correction using lcp file + LC_NOCORRECTION, // No lens correction + LC_LENSFUNAUTOMATCH, // Lens correction using auto matched lensfun database entry + LC_LENSFUNMANUAL, // Lens correction using manually selected lensfun database entry + LC_LCP // Lens correction using lcp file }; - static const char *methodstring[static_cast(eLcMode::lcp) + 1u]; + static const char *methodstring[static_cast(eLcMode::LC_LCP) + 1u]; eLcMode lcMode; Glib::ustring lcpFile; bool useDist, useVign, useCA; @@ -852,22 +852,22 @@ public: bool useLensfun() const { - return lcMode == eLcMode::lensfunAutoMatch || lcMode == eLcMode::lensfunManual; + return lcMode == eLcMode::LC_LENSFUNAUTOMATCH || lcMode == eLcMode::LC_LENSFUNMANUAL; } bool lfAutoMatch() const { - return lcMode == eLcMode::lensfunAutoMatch; + return lcMode == eLcMode::LC_LENSFUNAUTOMATCH; } bool useLcp() const { - return lcMode == eLcMode::lcp && lcpFile.length() > 0; + return lcMode == eLcMode::LC_LCP && lcpFile.length() > 0; } bool lfManual() const { - return lcMode == eLcMode::lensfunManual; + return lcMode == eLcMode::LC_LENSFUNMANUAL; } Glib::ustring getMethodString(eLcMode mode) const @@ -877,12 +877,12 @@ public: eLcMode getMethodNumber(const Glib::ustring &mode) const { - for(size_t i = 0; i < static_cast(eLcMode::lcp); ++i) { + for(size_t i = 0; i < static_cast(eLcMode::LC_LCP); ++i) { if(methodstring[i] == mode) { return static_cast(i); } } - return eLcMode::none; + return eLcMode::LC_NOCORRECTION; } }; diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index b6cef05fc..7ce62b0a5 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -160,14 +160,18 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa corrLensfunAuto->set_sensitive(true); - if(pp->lensProf.lcMode == procparams::LensProfParams::eLcMode::lcp) { - corrLcpFile->set_active(true); - } else if(pp->lensProf.lcMode == procparams::LensProfParams::eLcMode::lensfunAutoMatch) { - corrLensfunAuto->set_active(true); - } else if(pp->lensProf.lcMode == procparams::LensProfParams::eLcMode::lensfunManual) { - corrLensfunManual->set_active(true); - } else { - corrOff->set_active(true); + switch(pp->lensProf.lcMode) { + case procparams::LensProfParams::eLcMode::LC_LCP : + corrLcpFile->set_active(true); + break; + case procparams::LensProfParams::eLcMode::LC_LENSFUNAUTOMATCH : + corrLensfunAuto->set_active(true); + break; + case procparams::LensProfParams::eLcMode::LC_LENSFUNMANUAL : + corrLensfunManual->set_active(true); + break; + case procparams::LensProfParams::eLcMode::LC_NOCORRECTION : + corrOff->set_active(true); } if (pp->lensProf.lcpFile.empty()) { @@ -270,13 +274,13 @@ void LensProfilePanel::setRawMeta(bool raw, const rtengine::ImageMetaData* pMeta void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) { if (corrLcpFile->get_active()) { - pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::lcp; + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_LCP; } else if(corrLensfunManual->get_active()) { - pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::lensfunManual; + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_LENSFUNMANUAL; } else if(corrLensfunAuto->get_active()) { - pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::lensfunAutoMatch; + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_LENSFUNAUTOMATCH; } else if(corrOff->get_active()) { - pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::none; + pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_NOCORRECTION; } if (LCPStore::getInstance()->isValidLCPFileName(fcbLCPFile->get_filename())) {