automatically select the system monitor profile if the preferences say so

Fix for issue #3821
This commit is contained in:
Alberto Griggio 2017-04-12 16:20:03 +02:00
parent 239476cc3a
commit ecae94f17c
7 changed files with 70 additions and 4 deletions

View File

@ -302,6 +302,8 @@ public:
if (loadAll) { if (loadAll) {
loadProfiles(stdProfilesDir, nullptr, nullptr, &fileStdProfilesFileNames, true); loadProfiles(stdProfilesDir, nullptr, nullptr, &fileStdProfilesFileNames, true);
} }
defaultMonitorProfile = settings->monitorProfile;
} }
cmsHPROFILE workingSpace(const Glib::ustring& name) const cmsHPROFILE workingSpace(const Glib::ustring& name) const
@ -534,6 +536,16 @@ public:
return getProofIntents(getProfile(name)); return getProofIntents(getProfile(name));
} }
Glib::ustring getDefaultMonitorProfileName() const
{
return defaultMonitorProfile;
}
void setDefaultMonitorProfileName(const Glib::ustring &name)
{
defaultMonitorProfile = name;
}
private: private:
using ProfileMap = std::map<Glib::ustring, cmsHPROFILE>; using ProfileMap = std::map<Glib::ustring, cmsHPROFILE>;
using MatrixMap = std::map<Glib::ustring, TMatrix>; using MatrixMap = std::map<Glib::ustring, TMatrix>;
@ -617,6 +629,18 @@ rtengine::ProfileContent rtengine::ICCStore::getContent(const Glib::ustring& nam
return implementation->getContent(name); return implementation->getContent(name);
} }
Glib::ustring rtengine::ICCStore::getDefaultMonitorProfileName() const
{
return implementation->getDefaultMonitorProfileName();
}
void rtengine::ICCStore::setDefaultMonitorProfileName(const Glib::ustring &name)
{
implementation->setDefaultMonitorProfileName(name);
}
cmsHPROFILE rtengine::ICCStore::getXYZProfile() const cmsHPROFILE rtengine::ICCStore::getXYZProfile() const
{ {
return implementation->getXYZProfile(); return implementation->getXYZProfile();

View File

@ -78,6 +78,9 @@ public:
cmsHPROFILE getStdProfile(const Glib::ustring& name) const; cmsHPROFILE getStdProfile(const Glib::ustring& name) const;
ProfileContent getContent(const Glib::ustring& name) const; ProfileContent getContent(const Glib::ustring& name) const;
Glib::ustring getDefaultMonitorProfileName() const;
void setDefaultMonitorProfileName(const Glib::ustring &name);
cmsHPROFILE getXYZProfile() const; cmsHPROFILE getXYZProfile() const;
cmsHPROFILE getsRGBProfile() const; cmsHPROFILE getsRGBProfile() const;

View File

@ -1040,7 +1040,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
ImProcFunctions ipf (&params, false); ImProcFunctions ipf (&params, false);
ipf.setScale (sqrt(double(fw * fw + fh * fh)) / sqrt(double(thumbImg->getWidth() * thumbImg->getWidth() + thumbImg->getHeight() * thumbImg->getHeight()))*scale); ipf.setScale (sqrt(double(fw * fw + fh * fh)) / sqrt(double(thumbImg->getWidth() * thumbImg->getWidth() + thumbImg->getHeight() * thumbImg->getHeight()))*scale);
ipf.updateColorProfiles (options.rtSettings.monitorProfile, options.rtSettings.monitorIntent, false, false); ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), options.rtSettings.monitorIntent, false, false);
LUTu hist16 (65536); LUTu hist16 (65536);

View File

@ -160,7 +160,12 @@ private:
Glib::ustring defprofname; Glib::ustring defprofname;
if (find_default_monitor_profile(profileBox.get_root_window()->gobj(), defprof, defprofname)) { if (find_default_monitor_profile(profileBox.get_root_window()->gobj(), defprof, defprofname)) {
profileBox.append (M ("MONITOR_PROFILE_SYSTEM") + " (" + defprofname + ")"); profileBox.append (M ("MONITOR_PROFILE_SYSTEM") + " (" + defprofname + ")");
profileBox.set_active (options.rtSettings.autoMonitorProfile ? 1 : 0); if (options.rtSettings.autoMonitorProfile) {
rtengine::ICCStore::getInstance()->setDefaultMonitorProfileName(defprof);
profileBox.set_active(1);
} else {
profileBox.set_active(0);
}
} else { } else {
profileBox.set_active (0); profileBox.set_active (0);
} }
@ -402,7 +407,7 @@ public:
ConnectionBlocker profileBlocker (profileConn); ConnectionBlocker profileBlocker (profileConn);
if (!defprof.empty() && options.rtSettings.autoMonitorProfile) { if (!defprof.empty() && options.rtSettings.autoMonitorProfile) {
setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 1); profileBox.set_active(1);
} else { } else {
setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0); setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0);
} }
@ -426,6 +431,23 @@ public:
updateParameters (); updateParameters ();
} }
void defaultMonitorProfileChanged(const Glib::ustring &profile_name, bool auto_monitor_profile)
{
ConnectionBlocker profileBlocker (profileConn);
if (auto_monitor_profile && !defprof.empty()) {
rtengine::ICCStore::getInstance()->setDefaultMonitorProfileName(defprof);
#ifndef __APPLE__
profileBox.set_active(1);
#endif
} else {
rtengine::ICCStore::getInstance()->setDefaultMonitorProfileName(profile_name);
#ifndef __APPLE__
setActiveTextOrIndex(profileBox, profile_name, 0);
#endif
}
}
}; };
EditorPanel::EditorPanel (FilePanel* filePanel) EditorPanel::EditorPanel (FilePanel* filePanel)
@ -2214,3 +2236,10 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition)
iareapanel->imageArea->setPointerMotionHListener (histogramPanel); iareapanel->imageArea->setPointerMotionHListener (histogramPanel);
} }
void EditorPanel::defaultMonitorProfileChanged(const Glib::ustring &profile_name, bool auto_monitor_profile)
{
colorMgmtToolBar->defaultMonitorProfileChanged(profile_name, auto_monitor_profile);
}

View File

@ -129,6 +129,8 @@ public:
void updateTabsUsesIcons (bool useIcons); void updateTabsUsesIcons (bool useIcons);
void updateHistogramPosition (int oldPosition, int newPosition); void updateHistogramPosition (int oldPosition, int newPosition);
void defaultMonitorProfileChanged(const Glib::ustring &profile_name, bool auto_monitor_profile);
Gtk::Paned* catalogPane; Gtk::Paned* catalogPane;
private: private:

View File

@ -742,7 +742,9 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
const std::vector<Glib::ustring> profiles = rtengine::ICCStore::getInstance ()->getProfiles (rtengine::ICCStore::ProfileType::MONITOR); const std::vector<Glib::ustring> profiles = rtengine::ICCStore::getInstance ()->getProfiles (rtengine::ICCStore::ProfileType::MONITOR);
for (const auto profile : profiles) { for (const auto profile : profiles) {
monProfile->append (profile); if (profile.find("file:") != 0) {
monProfile->append (profile);
}
} }
// same order as the enum // same order as the enum

View File

@ -657,6 +657,12 @@ void RTWindow::showPreferences ()
delete pref; delete pref;
fpanel->optionsChanged (); fpanel->optionsChanged ();
if (epanel) {
epanel->defaultMonitorProfileChanged(options.rtSettings.monitorProfile, options.rtSettings.autoMonitorProfile);
}
for (const auto &p : epanels) {
p.second->defaultMonitorProfileChanged(options.rtSettings.monitorProfile, options.rtSettings.autoMonitorProfile);
}
} }
void RTWindow::setProgress (double p) void RTWindow::setProgress (double p)