From c96c7dc8f396805fda1c74d01509607ebdece050 Mon Sep 17 00:00:00 2001 From: Hombre Date: Fri, 2 Sep 2016 16:23:21 +0200 Subject: [PATCH] Soft-proofing ang GamutCheck buttons are now disabled if Monitor profile == NONE of is no suported intent for the selected profile. The Monitor profile list (in the Editor and in Preferences) shows RGB profiles only, whereas the output profile list shows all profiles (RGB, CMYK, ... anything!) Bugfix: When switching to a new image, the image now use the selected profile and intent. --- rtengine/iccstore.cc | 17 ++++++++------- rtengine/iccstore.h | 2 +- rtengine/improccoordinator.cc | 5 ----- rtgui/editorpanel.cc | 39 ++++++++++++++++++++++++++++------- rtgui/preferences.cc | 2 +- 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 166ee1cc9..b0be63151 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -40,7 +40,7 @@ void loadProfiles (const Glib::ustring& dirName, std::map* profiles, std::map* profileContents, std::map* profileNames, - bool nameUpper, bool onlyRgb) + bool nameUpper) { if (dirName.empty ()) { return; @@ -80,7 +80,7 @@ void loadProfiles (const Glib::ustring& dirName, const ProfileContent content (filePath); const cmsHPROFILE profile = content.toProfile (); - if (profile && (!onlyRgb || cmsGetColorSpace (profile) == cmsSigRgbData)) { + if (profile) { profiles->insert (std::make_pair (name, profile)); if (profileContents) { @@ -165,7 +165,7 @@ std::vector getWorkingProfiles () return res; } -std::vector ICCStore::getProfiles () const +std::vector ICCStore::getProfiles (const bool onlyRgb) const { MyMutex::MyLock lock(mutex_); @@ -173,6 +173,7 @@ std::vector ICCStore::getProfiles () const 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); } @@ -188,8 +189,8 @@ std::vector ICCStore::getProfilesFromDir (const Glib::ustring& di ProfileMap profiles; - loadProfiles (profilesDir, &profiles, nullptr, nullptr, false, true); - loadProfiles (dirName, &profiles, nullptr, nullptr, false, true); + loadProfiles (profilesDir, &profiles, nullptr, nullptr, false); + loadProfiles (dirName, &profiles, nullptr, nullptr, false); for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile) { res.push_back (profile->first); @@ -768,15 +769,15 @@ void ICCStore::init (const Glib::ustring& usrICCDir, const Glib::ustring& rtICCD profilesDir = Glib::build_filename (rtICCDir, "output"); fileProfiles.clear(); fileProfileContents.clear(); - loadProfiles (profilesDir, &fileProfiles, &fileProfileContents, nullptr, false, true); - loadProfiles (usrICCDir, &fileProfiles, &fileProfileContents, nullptr, false, true); + loadProfiles (profilesDir, &fileProfiles, &fileProfileContents, nullptr, false); + loadProfiles (usrICCDir, &fileProfiles, &fileProfileContents, nullptr, false); // Input profiles // Load these to different areas, since the short name (e.g. "NIKON D700" may overlap between system/user and RT dir) stdProfilesDir = Glib::build_filename (rtICCDir, "input"); fileStdProfiles.clear(); fileStdProfilesFileNames.clear(); - loadProfiles (stdProfilesDir, nullptr, nullptr, &fileStdProfilesFileNames, true, false); + loadProfiles (stdProfilesDir, nullptr, nullptr, &fileStdProfilesFileNames, true); } // Determine the first monitor default profile of operating system, if selected diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index ac52c998a..0c49a7e4c 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -112,7 +112,7 @@ public: cmsHPROFILE getXYZProfile () const; cmsHPROFILE getsRGBProfile () const; - std::vector getProfiles () const; + std::vector getProfiles (const bool onlyRgb = false) 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 4aa0b8243..3bcb2699b 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -779,11 +779,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // Update the monitor color transform if necessary if ((todo & M_MONITOR) || (lastOutputProfile!=params.icm.output) || lastOutputIntent!=params.icm.outputIntent || lastOutputBPC!=params.icm.outputBPC) { - if (lastOutputIntent == RI__COUNT) { - // initializing... - monitorProfile = options.rtSettings.monitorProfile; - monitorIntent = options.rtSettings.monitorIntent; - } lastOutputProfile = params.icm.output; lastOutputIntent = params.icm.outputIntent; lastOutputBPC = params.icm.outputBPC; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 3323c795d..50297632a 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -59,7 +59,7 @@ private: profileBox.set_active (0); #endif - const std::vector profiles = rtengine::iccStore->getProfiles (); + const std::vector profiles = rtengine::iccStore->getProfiles (true); for (std::vector::const_iterator iterator = profiles.begin (); iterator != profiles.end (); ++iterator) { profileBox.append_text (*iterator); } @@ -119,7 +119,7 @@ private: updateSoftProofParameters (); } - void updateParameters () + void updateParameters (bool noEvent = false) { ConnectionBlocker profileBlocker (profileConn); ConnectionBlocker intentBlocker (intentConn); @@ -148,6 +148,8 @@ private: intentBox.set_sensitive (false); intentBox.setSelected (1); + softProof.set_sensitive(false); + spGamutCheck.set_sensitive(false); profileBox.set_tooltip_text (""); @@ -162,12 +164,16 @@ private: intentBox.setItemSensitivity(0, supportsPerceptual); intentBox.setItemSensitivity(1, supportsRelativeColorimetric); intentBox.setItemSensitivity(2, supportsAbsoluteColorimetric); + softProof.set_sensitive(true); + spGamutCheck.set_sensitive(true); } else { intentBox.setItemSensitivity(0, true); intentBox.setItemSensitivity(1, true); intentBox.setItemSensitivity(2, true); intentBox.set_sensitive (false); intentBox.setSelected (1); + softProof.set_sensitive(false); + spGamutCheck.set_sensitive(false); } profileBox.set_tooltip_text (profileBox.get_active_text ()); @@ -191,19 +197,28 @@ private: return; } - processor->beginUpdateParams (); + if (!noEvent) { + processor->beginUpdateParams (); + } processor->setMonitorProfile (profile, intent); - processor->endUpdateParams (rtengine::EvMonitorTransform); + processor->setSoftProofing (softProof.get_sensitive() && softProof.get_active(), spGamutCheck.get_sensitive() && spGamutCheck.get_active()); + if (!noEvent) { + processor->endUpdateParams (rtengine::EvMonitorTransform); + } } - void updateSoftProofParameters () + void updateSoftProofParameters (bool noEvent = false) { spGamutCheck.set_sensitive(softProof.get_active()); if (profileBox.get_active_row_number () > 0) { - processor->beginUpdateParams (); - processor->setSoftProofing (softProof.get_active(), spGamutCheck.get_active()); - processor->endUpdateParams (rtengine::EvMonitorTransform); + if (!noEvent) { + processor->beginUpdateParams (); + } + processor->setSoftProofing (softProof.get_sensitive() && softProof.get_active(), spGamutCheck.get_sensitive() && spGamutCheck.get_active()); + if (!noEvent) { + processor->endUpdateParams (rtengine::EvMonitorTransform); + } } } @@ -232,6 +247,13 @@ public: box->pack_end (profileBox, Gtk::PACK_SHRINK, 0); } + void updateProcessor() + { + if (processor) { + updateParameters(true); + } + } + void reset () { ConnectionBlocker profileBlocker (profileConn); @@ -762,6 +784,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) this->isrc = isrc; ipc = rtengine::StagedImageProcessor::create (isrc); ipc->setProgressListener (this); + colorMgmtToolBar->updateProcessor(); ipc->setPreviewImageListener (previewHandler); ipc->setPreviewScale (10); // Important tpc->initImage (ipc, tmb->getType() == FT_Raw); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 980fc0702..28f5e2096 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -698,7 +698,7 @@ Gtk::Widget* Preferences::getColorManagementPanel () monProfile->append_text (M("PREFERENCES_PROFILE_NONE")); monProfile->set_active (0); - const std::vector profiles = rtengine::ICCStore::getInstance ()->getProfiles (); + 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);