From 23863acecac898e3e6773e70dfeb1aeeee8bdd75 Mon Sep 17 00:00:00 2001 From: Hombre Date: Fri, 30 Dec 2016 03:59:18 +0100 Subject: [PATCH] Printer profile added in Preferences for soft-proofing The output profiles now retain only 'Display' device class as well as the Monitor profile - and they both have to have rgb color space, the printer profile retain only 'Output' device class. MacOS can use soft-proofing but due to undocumented feature of OSX, and since Cairo assume that the image data are sRGB, the monitor profile is forced to 'RT_sRGB'. A warning message replace the combobox for this OS. --- rtdata/languages/Francais | 8 +- rtdata/languages/default | 12 ++- rtengine/iccstore.cc | 12 ++- rtengine/iccstore.h | 8 +- rtengine/improccoordinator.cc | 2 +- rtengine/improcfun.cc | 32 +++----- rtengine/improcfun.h | 2 +- rtengine/rtthumbnail.cc | 2 +- rtengine/settings.h | 3 + rtgui/editorpanel.cc | 42 +++++++--- rtgui/guiutils.h | 8 +- rtgui/icmpanel.cc | 2 +- rtgui/options.cc | 19 +++++ rtgui/preferences.cc | 143 ++++++++++++++++++++++++++++++---- rtgui/preferences.h | 3 + 15 files changed, 238 insertions(+), 60 deletions(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 6dadfaf06..e8549975b 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -955,7 +955,9 @@ PREFERENCES_MENUGROUPRANK;Classement PREFERENCES_MENUOPTIONS;Options du menu PREFERENCES_METADATA;Metadonnées PREFERENCES_MIN;Mini (100x115) -PREFERENCES_MONBPC;Compensation du Point Noir pour la transformation L*a*b*->Moniteur +PREFERENCES_MONBPC;Compensation du Point Noir +PREFERENCES_MONITOR;Moniteur +PREFERENCES_MONPROFILE_WARNOSX;Due à des limitations de MacOS, seul sRGB est supporté. PREFERENCES_MULTITAB;Éditeurs multiple PREFERENCES_MULTITABDUALMON;Éditeurs multiple, si possible sur un second moniteur PREFERENCES_NAVGUIDEBRUSH;Couleur du cadre dans le Navigateur @@ -978,6 +980,7 @@ PREFERENCES_PREVDEMO;Méthode de Dématriçage de l'Aperçu PREFERENCES_PREVDEMO_FAST;Rapide PREFERENCES_PREVDEMO_LABEL;Méthode de dématriçage utilisé pour l'aperçu à un zoom <100%: PREFERENCES_PREVDEMO_SIDECAR;Idem PP3 +PREFERENCES_PRINTER;Imprimante (épreuvage écran) PREFERENCES_PROFILEHANDLING;Gestionnaire des profils de traitement PREFERENCES_PROFILELOADPR;Priorité de chargement des profils PREFERENCES_PROFILEPRCACHE;Profil dans le Cache @@ -985,6 +988,9 @@ PREFERENCES_PROFILEPRFILE;Profil accolé au fichier d'entrée PREFERENCES_PROFILESAVECACHE;Enregistrer la paramètres de traitement dans le Cache PREFERENCES_PROFILESAVEINPUT;Enregistrer la paramètres de traitement accolé au fichier d'entrée PREFERENCES_PROPERTY;Propriété +PREFERENCES_PRTBPC;Compensation du Point Noir +PREFERENCES_PRTINTENT;Intention de rendu +PREFERENCES_PRTPROFILE;Profile couleur PREFERENCES_PSPATH;Dossier d'installation d'Adobe Photoshop PREFERENCES_REMEMBERZOOMPAN;Se souvenir de niveau de zoom et de la position de l'image PREFERENCES_REMEMBERZOOMPAN_TOOLTIP;Retient le niveau de zoom et la position de l'image courante lors de l'ouverture d'une nouvelle image.\n\nCette option ne fonctionne que dans le mode "Éditeur unique" et quand "Méthode de dématriçage utilisé pour l'aperçu à un zoom <100%" is set to "Idem PP3". diff --git a/rtdata/languages/default b/rtdata/languages/default index dcc2272fc..04b263c5b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1001,9 +1001,11 @@ PREFERENCES_MENUGROUPRANK;Group "Rank" PREFERENCES_MENUOPTIONS;Context Menu Options PREFERENCES_METADATA;Metadata PREFERENCES_MIN;Mini (100x115) -PREFERENCES_MONBPC;Black Point Compensation for the L*a*b*->Monitor transform -PREFERENCES_MONINTENT;Default monitor intent -PREFERENCES_MONPROFILE;Default monitor profile +PREFERENCES_MONBPC;Black Point Compensation +PREFERENCES_MONITOR;Monitor +PREFERENCES_MONINTENT;Default rendering intent +PREFERENCES_MONPROFILE;Default profile +PREFERENCES_MONPROFILE_WARNOSX;Due to MacOS limitations, only sRGB is supported. PREFERENCES_MULTITAB;Multiple Editor Tabs Mode PREFERENCES_MULTITABDUALMON;Multiple Editor Tabs In Own Window Mode PREFERENCES_NAVGUIDEBRUSH;Navigator guide color @@ -1028,6 +1030,7 @@ PREFERENCES_PREVDEMO;Preview Demosaic Method PREFERENCES_PREVDEMO_FAST;Fast PREFERENCES_PREVDEMO_LABEL;Demosaicing method used for the preview at <100% zoom: PREFERENCES_PREVDEMO_SIDECAR;As in PP3 +PREFERENCES_PRINTER;Printer (soft-proofing) PREFERENCES_PROFILEHANDLING;Processing Profile Handling PREFERENCES_PROFILELOADPR;Processing profile loading priority PREFERENCES_PROFILEPRCACHE;Profile in cache @@ -1036,6 +1039,9 @@ PREFERENCES_PROFILESAVECACHE;Save processing profile to the cache PREFERENCES_PROFILESAVEINPUT;Save processing profile next to the input file PREFERENCES_PROFILE_NONE;None PREFERENCES_PROPERTY;Property +PREFERENCES_PRTBPC;Black Point Compensation +PREFERENCES_PRTINTENT;Rendering intent +PREFERENCES_PRTPROFILE;Color profile PREFERENCES_PSPATH;Adobe Photoshop installation directory PREFERENCES_REMEMBERZOOMPAN;Remember zoom % and pan offset PREFERENCES_REMEMBERZOOMPAN_TOOLTIP;Remember the zoom % and pan offset of the current image when opening a new image.\n\nThis option only works in "Single Editor Tab Mode" and when "Demosaicing method used for the preview at <100% zoom" is set to "As in PP3". diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 3cb9b4a71..3965b2335 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -165,16 +165,20 @@ std::vector getWorkingProfiles () return res; } -std::vector ICCStore::getProfiles (const bool onlyRgb) const +std::vector ICCStore::getProfiles (const ProfileType type) const { MyMutex::MyLock lock(mutex_); std::vector res; - for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile) { - if (!onlyRgb || (onlyRgb && cmsGetColorSpace (profile->second) == cmsSigRgbData)) - res.push_back (profile->first); + for (const auto profile : fileProfiles) { + if ( (type==ICCStore::ProfileType::MONITOR && cmsGetDeviceClass(profile.second) == cmsSigDisplayClass && cmsGetColorSpace (profile.second) == cmsSigRgbData) + || (type==ICCStore::ProfileType::PRINTER && cmsGetDeviceClass(profile.second) == cmsSigOutputClass) + || (type==ICCStore::ProfileType::OUTPUT && cmsGetDeviceClass(profile.second) == cmsSigDisplayClass && cmsGetColorSpace (profile.second) == cmsSigRgbData) ) + { + res.push_back (profile.first); + } } return res; diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index bb9693f1a..58ddfdbc9 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -84,6 +84,12 @@ class ICCStore public: + enum class ProfileType { + MONITOR, + PRINTER, + OUTPUT // (actually correspond to the same profiles than with MONITOR) + }; + static ICCStore* getInstance (); void init (const Glib::ustring& usrICCDir, const Glib::ustring& stdICCDir); @@ -112,7 +118,7 @@ public: cmsHPROFILE getXYZProfile () const; cmsHPROFILE getsRGBProfile () const; - std::vector getProfiles (const bool onlyRgb = false) const; + std::vector getProfiles (const ProfileType type = ProfileType::MONITOR) const; std::vector getProfilesFromDir (const Glib::ustring& dirName) const; uint8_t getInputIntents (cmsHPROFILE profile) const; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 9c04e0710..46cf031bd 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -781,7 +781,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) lastOutputProfile = params.icm.output; lastOutputIntent = params.icm.outputIntent; lastOutputBPC = params.icm.outputBPC; - ipf.updateColorProfiles(params.icm, monitorProfile, monitorIntent, softProof, gamutCheck); + ipf.updateColorProfiles(monitorProfile, monitorIntent, softProof, gamutCheck); } // process crop, if needed diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 3e0433197..1a3a969ae 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -68,7 +68,7 @@ void ImProcFunctions::setScale (double iscale) scale = iscale; } -void ImProcFunctions::updateColorProfiles (const ColorManagementParams& icm, const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck) +void ImProcFunctions::updateColorProfiles (const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck) { // set up monitor transform if (monitorTransform) { @@ -77,9 +77,14 @@ void ImProcFunctions::updateColorProfiles (const ColorManagementParams& icm, con monitorTransform = nullptr; + cmsHPROFILE monitor = nullptr; + if (!monitorProfile.empty()) { #if !defined(__APPLE__) // No support for monitor profiles on OS X, all data is sRGB - - cmsHPROFILE monitor = iccStore->getProfile (monitorProfile); + monitor = iccStore->getProfile (monitorProfile); +#else + monitor = iccStore->getProfile ("RT_sRGB"); +#endif + } if (monitor) { MyMutex::MyLock lcmsLock (*lcmsMutex); @@ -91,25 +96,14 @@ void ImProcFunctions::updateColorProfiles (const ColorManagementParams& icm, con if (softProof) { cmsHPROFILE oprof = nullptr; - if(icm.gamma != "default" || icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8 - GammaValues ga; - iccStore->getGammaArray(icm, ga); - oprof = iccStore->createGammaProfile (icm, ga); - } - else if (!icm.output.empty() && icm.output != ColorManagementParams::NoICMString) { - if(icm.gamma != "default" || icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8 - GammaValues ga; - iccStore->getGammaArray(icm, ga); - oprof = iccStore->createCustomGammaOutputProfile (icm, ga); - } else { - oprof = iccStore->getProfile(icm.output); - } + if (!settings->printerProfile.empty()) { + oprof = iccStore->getProfile(settings->printerProfile); } if (oprof) { // NOCACHE is for thread safety, NOOPTIMIZE for precision flags = cmsFLAGS_SOFTPROOFING | cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE; - if (icm.outputBPC) { + if (settings->printerBPC) { flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; } if (gamutCheck) { @@ -119,7 +113,7 @@ void ImProcFunctions::updateColorProfiles (const ColorManagementParams& icm, con iprof, TYPE_Lab_FLT, monitor, TYPE_RGB_8, oprof, - monitorIntent, icm.outputIntent, + monitorIntent, settings->printerIntent, flags ); if (monitorTransform) { @@ -138,8 +132,6 @@ void ImProcFunctions::updateColorProfiles (const ColorManagementParams& icm, con cmsCloseProfile(iprof); } - -#endif } void ImProcFunctions::firstAnalysis (const Imagefloat* const original, const ProcParams ¶ms, LUTu & histogram) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 6a182e67b..e70083b0b 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -205,7 +205,7 @@ public: bool needsPCVignetting (); void firstAnalysis (const Imagefloat* const working, const ProcParams ¶ms, LUTu & vhist16); - void updateColorProfiles (const ColorManagementParams& icm, const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); + void updateColorProfiles (const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); void rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit , float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve ); diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index af42ce8b0..daf7f2fa2 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -942,7 +942,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei ImProcFunctions ipf (¶ms, false); ipf.setScale (sqrt(double(fw * fw + fh * fh)) / sqrt(double(thumbImg->width * thumbImg->width + thumbImg->height * thumbImg->height))*scale); - ipf.updateColorProfiles (params.icm, options.rtSettings.monitorProfile, options.rtSettings.monitorIntent, false, false); + ipf.updateColorProfiles (options.rtSettings.monitorProfile, options.rtSettings.monitorIntent, false, false); LUTu hist16 (65536); diff --git a/rtengine/settings.h b/rtengine/settings.h index b572e7310..ada63400a 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -38,6 +38,9 @@ public: int leveldnliss; // level of auto multi zone int leveldnautsimpl; // STD or EXPERT + Glib::ustring printerProfile; ///< ICC profile name used for soft-proofing a printer output + RenderingIntent printerIntent; ///< Colorimetric intent used with the above profile + bool printerBPC; ///< Black Point Compensation for the Labimage->Printer->Monitor transform Glib::ustring monitorProfile; ///< ICC profile name used for the monitor RenderingIntent monitorIntent; ///< Colorimetric intent used with the above profile bool monitorBPC; ///< Black Point Compensation for the Labimage->Monitor transform (directly, i.e. not soft-proofing and no WCS in between) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 4ba581ddd..2847b5824 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -38,7 +38,9 @@ using namespace rtengine::procparams; class EditorPanel::ColorManagementToolbar { private: +#if !defined(__APPLE__) // monitor profile not supported on apple MyComboBoxText profileBox; +#endif PopUpButton intentBox; Gtk::ToggleButton softProof; Gtk::ToggleButton spGamutCheck; @@ -47,6 +49,7 @@ private: rtengine::StagedImageProcessor* const& processor; private: +#if !defined(__APPLE__) // monitor profile not supported on apple void prepareProfileBox () { profileBox.set_size_request (100, -1); @@ -58,13 +61,13 @@ private: #else profileBox.set_active (0); #endif - - const std::vector profiles = rtengine::iccStore->getProfiles (true); - for (std::vector::const_iterator iterator = profiles.begin (); iterator != profiles.end (); ++iterator) { - profileBox.append_text (*iterator); + const std::vector profiles = rtengine::iccStore->getProfiles (rtengine::ICCStore::ProfileType::MONITOR); + for (const auto profile: profiles) { + profileBox.append_text (profile); } profileBox.set_tooltip_text (profileBox.get_active_text ()); } +#endif void prepareIntentBox () { @@ -121,12 +124,15 @@ private: void updateParameters (bool noEvent = false) { +#if !defined(__APPLE__) // monitor profile not supported on apple ConnectionBlocker profileBlocker (profileConn); +#endif ConnectionBlocker intentBlocker (intentConn); Glib::ustring profile; -#ifdef WIN32 +#if !defined(__APPLE__) // monitor profile not supported on apple + #ifdef WIN32 if (profileBox.get_active_row_number () == 1) { profile = rtengine::iccStore->getDefaultMonitorProfileName (); if (profile.empty ()) { @@ -138,10 +144,14 @@ private: } else if (profileBox.get_active_row_number () > 1) { profile = profileBox.get_active_text (); } -#else + #else profile = profileBox.get_active_row_number () > 0 ? profileBox.get_active_text () : Glib::ustring (); + #endif +#else + profile = "RT_sRGB"; #endif +#if !defined(__APPLE__) // monitor profile not supported on apple if (profileBox.get_active_row_number () == 0) { profile.clear(); @@ -178,7 +188,7 @@ private: profileBox.set_tooltip_text (profileBox.get_active_text ()); } - +#endif rtengine::RenderingIntent intent; switch (intentBox.getSelected ()) { default: @@ -211,7 +221,9 @@ private: { spGamutCheck.set_sensitive(softProof.get_active()); +#if !defined(__APPLE__) // monitor profile not supported on apple if (profileBox.get_active_row_number () > 0) { +#endif if (!noEvent) { processor->beginUpdateParams (); } @@ -219,7 +231,9 @@ private: if (!noEvent) { processor->endUpdateParams (rtengine::EvMonitorTransform); } +#if !defined(__APPLE__) // monitor profile not supported on apple } +#endif } public: @@ -227,7 +241,9 @@ public: intentBox (Glib::ustring (), true), processor (ipc) { +#if !defined(__APPLE__) // monitor profile not supported on apple prepareProfileBox (); +#endif prepareIntentBox (); prepareSoftProofingBox (); @@ -235,7 +251,9 @@ public: softProof.signal_toggled().connect(sigc::mem_fun (this, &ColorManagementToolbar::softProofToggled)); spGamutCheck.signal_toggled().connect(sigc::mem_fun (this, &ColorManagementToolbar::spGamutCheckToggled));; +#if !defined(__APPLE__) // monitor profile not supported on apple profileConn = profileBox.signal_changed ().connect (sigc::mem_fun (this, &ColorManagementToolbar::profileBoxChanged)); +#endif intentConn = intentBox.signal_changed ().connect (sigc::mem_fun (this, &ColorManagementToolbar::intentBoxChanged)); } @@ -244,7 +262,9 @@ public: box->pack_end (spGamutCheck, Gtk::PACK_SHRINK, 0); box->pack_end (softProof, Gtk::PACK_SHRINK, 0); box->pack_end (*intentBox.buttonGroup, Gtk::PACK_SHRINK, 0); +#if !defined(__APPLE__) // monitor profile not supported on apple box->pack_end (profileBox, Gtk::PACK_SHRINK, 0); +#endif } void updateProcessor() @@ -256,17 +276,19 @@ public: void reset () { - ConnectionBlocker profileBlocker (profileConn); ConnectionBlocker intentBlocker (intentConn); +#if !defined(__APPLE__) // monitor profile not supported on apple + ConnectionBlocker profileBlocker (profileConn); -#ifdef WIN32 + #ifdef WIN32 if (options.rtSettings.autoMonitorProfile) { setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 1); } else { setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0); } -#else + #else setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0); + #endif #endif switch (options.rtSettings.monitorIntent) diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index b8e058eb4..597173086 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -472,9 +472,13 @@ public: inline void setActiveTextOrIndex (Gtk::ComboBoxText& comboBox, const Glib::ustring& text, int index) { - comboBox.set_active_text (text); + bool valueSet = false; + if (!text.empty()) { + comboBox.set_active_text (text); + valueSet = true; + } - if (comboBox.get_active_row_number () < 0) + if (!valueSet || comboBox.get_active_row_number () < 0) comboBox.set_active (index); } diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 68663ed7e..1ca9fd055 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -181,7 +181,7 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch onames->append_text (M("TP_ICM_NOICM")); onames->set_active (0); - std::vector opnames = iccStore->getProfiles (); + std::vector opnames = iccStore->getProfiles (rtengine::ICCStore::ProfileType::OUTPUT); for (size_t i = 0; i < opnames.size(); i++) { onames->append_text (opnames[i]); diff --git a/rtgui/options.cc b/rtgui/options.cc index 1c29387ac..397b5996a 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -632,6 +632,9 @@ void Options::setDefaults () 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; @@ -1450,6 +1453,18 @@ int Options::readFromFile (Glib::ustring fname) 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"); } @@ -2031,6 +2046,10 @@ int Options::saveToFile (Glib::ustring fname) 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); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 30d9d5ed2..31c1fce70 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -685,63 +685,138 @@ Gtk::Widget* Preferences::getColorManagementPanel () Gtk::VBox* mvbcm = Gtk::manage (new Gtk::VBox ()); mvbcm->set_border_width (4); + mvbcm->set_spacing (4); iccDir = Gtk::manage (new Gtk::FileChooserButton (M("PREFERENCES_ICCDIR"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER)); Gtk::Label* pdlabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_ICCDIR") + ":", Gtk::ALIGN_LEFT)); + Gtk::HBox* iccdhb = Gtk::manage (new Gtk::HBox ()); + iccdhb->set_spacing(4); + + iccdhb->pack_start(*pdlabel, Gtk::PACK_SHRINK); + iccdhb->pack_start(*iccDir, Gtk::PACK_EXPAND_WIDGET); + + iccDir->signal_selection_changed ().connect (sigc::mem_fun (this, &Preferences::iccDirChanged)); + + mvbcm->pack_start(*iccdhb, Gtk::PACK_SHRINK); + + //------------------------- MONITOR ---------------------- + + Gtk::Frame* fmonitor = Gtk::manage( new Gtk::Frame (M("PREFERENCES_MONITOR")) ); + Gtk::VBox* vbmonitor = Gtk::manage( new Gtk::VBox () ); + vbmonitor->set_border_width (4); + monProfile = Gtk::manage (new Gtk::ComboBoxText ()); Gtk::Label* mplabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_MONPROFILE") + ":", Gtk::ALIGN_LEFT)); monIntent = Gtk::manage (new Gtk::ComboBoxText ()); Gtk::Label* milabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_MONINTENT")+":", Gtk::ALIGN_LEFT)); + monProfile->set_size_request(80, -1); monProfile->append_text (M("PREFERENCES_PROFILE_NONE")); monProfile->set_active (0); - const std::vector profiles = rtengine::ICCStore::getInstance ()->getProfiles (true); - for (std::vector::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile) - monProfile->append_text (*profile); + const std::vector profiles = rtengine::ICCStore::getInstance ()->getProfiles (rtengine::ICCStore::ProfileType::MONITOR); + for (const auto profile : profiles) { + monProfile->append_text (profile); + } // same order as the enum monIntent->append_text (M("PREFERENCES_INTENT_PERCEPTUAL")); monIntent->append_text (M("PREFERENCES_INTENT_RELATIVE")); monIntent->append_text (M("PREFERENCES_INTENT_ABSOLUTE")); monIntent->set_active (1); + monIntent->set_size_request(80, -1); monBPC = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_MONBPC"))); monBPC->set_active (true); - iccDir->signal_selection_changed ().connect (sigc::mem_fun (this, &Preferences::iccDirChanged)); - #if defined(WIN32) // Auto-detection not implemented for Linux, see issue 851 cbAutoMonProfile = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_AUTOMONPROFILE"))); autoMonProfileConn = cbAutoMonProfile->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::autoMonProfileToggled)); -#endif Gtk::Table* colt = Gtk::manage (new Gtk::Table (3, 2)); +#else + Gtk::Table* colt = Gtk::manage (new Gtk::Table (2, 2)); +#endif int row = 0; - colt->attach (*pdlabel, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK, 2, 2); - colt->attach (*iccDir, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); -#if !defined(__APPLE__) // monitor profile not supported on apple - ++row; colt->attach (*mplabel, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK, 2, 2); +#if defined(__APPLE__) // monitor profile not supported on apple + colt->attach (*Gtk::manage (new Gtk::Label (M("PREFERENCES_MONPROFILE_WARNOSX"), Gtk::ALIGN_LEFT)), 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK, 2, 2); +#else colt->attach (*monProfile, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); +#endif #if defined(WIN32) ++row; colt->attach (*cbAutoMonProfile, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); -#endif #endif ++row; colt->attach (*milabel, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK, 2, 2); colt->attach (*monIntent, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); - mvbcm->pack_start (*colt, Gtk::PACK_SHRINK, 4); + vbmonitor->pack_start (*colt, Gtk::PACK_SHRINK, 4); - mvbcm->pack_start (*monBPC, Gtk::PACK_SHRINK, 4); + vbmonitor->pack_start (*monBPC, Gtk::PACK_SHRINK, 4); #if defined(WIN32) autoMonProfileToggled(); #endif + fmonitor->add(*vbmonitor); + + mvbcm->pack_start(*fmonitor, Gtk::PACK_SHRINK); + + //------------------------- PRINTER ---------------------- + + Gtk::Frame* fprinter = Gtk::manage( new Gtk::Frame (M("PREFERENCES_PRINTER")) ); + Gtk::VBox* vbprinter = Gtk::manage( new Gtk::VBox () ); + vbprinter->set_border_width (4); + prtProfile = Gtk::manage (new Gtk::ComboBoxText ()); + Gtk::Label* pplabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_PRTPROFILE") + ":", Gtk::ALIGN_LEFT)); + + prtIntent = Gtk::manage (new Gtk::ComboBoxText ()); + Gtk::Label* pilabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_PRTINTENT")+":", Gtk::ALIGN_LEFT)); + + prtProfile->set_size_request(80, -1); + prtProfile->append_text (M("PREFERENCES_PROFILE_NONE")); + prtProfile->set_active (0); + + const std::vector prtprofiles = rtengine::ICCStore::getInstance ()->getProfiles (rtengine::ICCStore::ProfileType::PRINTER); + for (const auto prtprofile : prtprofiles) + prtProfile->append_text (prtprofile); + + // same order as the enum + prtIntent->append_text (M("PREFERENCES_INTENT_PERCEPTUAL")); + prtIntent->append_text (M("PREFERENCES_INTENT_RELATIVE")); + prtIntent->append_text (M("PREFERENCES_INTENT_ABSOLUTE")); + prtIntent->set_active (1); + prtIntent->set_size_request(80, -1); + + prtBPC = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_PRTBPC"))); + prtBPC->set_active (true); + + Gtk::Table* coltp = Gtk::manage (new Gtk::Table (2, 2)); + row = 0; +#if !defined(__APPLE__) // monitor profile not supported on apple + coltp->attach (*pplabel, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK, 2, 2); + coltp->attach (*prtProfile, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); +#endif + ++row; + coltp->attach (*pilabel, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK, 2, 2); + coltp->attach (*prtIntent, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); + vbprinter->pack_start (*coltp, Gtk::PACK_SHRINK, 4); + + vbprinter->pack_start (*prtBPC, Gtk::PACK_SHRINK, 4); + +#if defined(WIN32) + autoMonProfileToggled(); +#endif + + fprinter->add(*vbprinter); + + mvbcm->pack_start(*fprinter, Gtk::PACK_SHRINK); + + //------------------------- CIECAM ---------------------- + Gtk::VBox* vbdp = Gtk::manage (new Gtk::VBox ()); vbdp->set_border_width (4); Gtk::Label* viewlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_VIEW") + ":", Gtk::ALIGN_LEFT)); @@ -790,7 +865,7 @@ Gtk::Widget* Preferences::getColorManagementPanel () vbcielab->pack_start (*colo, Gtk::PACK_EXPAND_WIDGET, 4); fcielab->add (*vbcielab); - mvbcm->pack_start (*fcielab, Gtk::PACK_SHRINK, 4); + mvbcm->pack_start (*fcielab, Gtk::PACK_SHRINK); return mvbcm; } @@ -1457,8 +1532,31 @@ void Preferences::storePreferences () moptions.CPBPath = txtCustProfBuilderPath->get_text(); moptions.CPBKeys = CPBKeyType(custProfBuilderLabelType->get_active_row_number()); + if (!prtProfile->get_active_row_number()) { + moptions.rtSettings.printerProfile = ""; + } else { + moptions.rtSettings.printerProfile = prtProfile->get_active_text (); + } + switch (prtIntent->get_active_row_number ()) { + default: + case 0: + moptions.rtSettings.printerIntent = rtengine::RI_PERCEPTUAL; + break; + case 1: + moptions.rtSettings.printerIntent = rtengine::RI_RELATIVE; + break; + case 2: + moptions.rtSettings.printerIntent = rtengine::RI_ABSOLUTE; + break; + } + moptions.rtSettings.printerBPC = prtBPC->get_active (); + #if !defined(__APPLE__) // monitor profile not supported on apple - moptions.rtSettings.monitorProfile = monProfile->get_active_text (); + if (!monProfile->get_active_row_number()) { + moptions.rtSettings.monitorProfile = ""; + } else { + moptions.rtSettings.monitorProfile = monProfile->get_active_text (); + } switch (monIntent->get_active_row_number ()) { default: case 0: @@ -1588,6 +1686,21 @@ void Preferences::fillPreferences () rememberZoomPanCheckbutton->set_active (moptions.rememberZoomAndPan); ctiffserialize->set_active(moptions.serializeTiffRead); + setActiveTextOrIndex (*prtProfile, moptions.rtSettings.printerProfile, 0); + switch (moptions.rtSettings.printerIntent) { + default: + case rtengine::RI_PERCEPTUAL: + prtIntent->set_active (0); + break; + case rtengine::RI_RELATIVE: + prtIntent->set_active (1); + break; + case rtengine::RI_ABSOLUTE: + prtIntent->set_active (2); + break; + } + prtBPC->set_active (moptions.rtSettings.printerBPC); + #if !defined(__APPLE__) // monitor profile not supported on apple setActiveTextOrIndex (*monProfile, moptions.rtSettings.monitorProfile, 0); switch (moptions.rtSettings.monitorIntent) { diff --git a/rtgui/preferences.h b/rtgui/preferences.h index a94601663..66feb41f1 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -95,6 +95,9 @@ protected: Gtk::CheckButton* showExpComp; Gtk::FileChooserButton* iccDir; + Gtk::ComboBoxText* prtProfile; + Gtk::ComboBoxText* prtIntent; + Gtk::CheckButton* prtBPC; Gtk::ComboBoxText* monProfile; Gtk::ComboBoxText* monIntent; Gtk::CheckButton* monBPC;