Merge branch 'master' into gtk3
This commit is contained in:
@@ -35,11 +35,13 @@
|
||||
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
class EditorPanel::MonitorProfileSelector
|
||||
class EditorPanel::ColorManagementToolbar
|
||||
{
|
||||
private:
|
||||
MyComboBoxText profileBox;
|
||||
PopUpButton intentBox;
|
||||
Gtk::ToggleButton softProof;
|
||||
Gtk::ToggleButton spGamutCheck;
|
||||
sigc::connection profileConn, intentConn;
|
||||
|
||||
rtengine::StagedImageProcessor* const& processor;
|
||||
@@ -61,29 +63,51 @@ private:
|
||||
profileBox.set_active (0);
|
||||
#endif
|
||||
|
||||
const std::vector<Glib::ustring> profiles = rtengine::iccStore->getProfiles ();
|
||||
const std::vector<Glib::ustring> profiles = rtengine::iccStore->getProfiles (true);
|
||||
|
||||
for (std::vector<Glib::ustring>::const_iterator iterator = profiles.begin (); iterator != profiles.end (); ++iterator) {
|
||||
profileBox.append (*iterator);
|
||||
}
|
||||
profileBox.set_tooltip_text (profileBox.get_active_text ());
|
||||
}
|
||||
|
||||
void prepareIntentBox ()
|
||||
{
|
||||
intentBox.addEntry ("intent-relative.png", M ("PREFERENCES_INTENT_RELATIVE"));
|
||||
// same order as the enum
|
||||
intentBox.addEntry ("intent-perceptual.png", M ("PREFERENCES_INTENT_PERCEPTUAL"));
|
||||
intentBox.addEntry("intent-relative.png", M("PREFERENCES_INTENT_RELATIVE"));
|
||||
intentBox.addEntry ("intent-absolute.png", M ("PREFERENCES_INTENT_ABSOLUTE"));
|
||||
setExpandAlignProperties (intentBox.buttonGroup, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||
|
||||
intentBox.setSelected (0);
|
||||
intentBox.setSelected(1);
|
||||
intentBox.show ();
|
||||
}
|
||||
|
||||
void prepareSoftProofingBox ()
|
||||
{
|
||||
Gtk::Image *softProofImage = Gtk::manage (new RTImage ("softProof.png"));
|
||||
softProofImage->set_padding(0, 0);
|
||||
softProof.add(*softProofImage);
|
||||
softProof.set_relief(Gtk::RELIEF_NONE);
|
||||
softProof.set_tooltip_markup(M("SOFTPROOF_TOOLTIP"));
|
||||
|
||||
softProof.set_active(false);
|
||||
softProof.show ();
|
||||
|
||||
Gtk::Image *spGamutCheckImage = Gtk::manage (new RTImage ("spGamutCheck.png"));
|
||||
spGamutCheckImage->set_padding(0, 0);
|
||||
spGamutCheck.add(*spGamutCheckImage);
|
||||
spGamutCheck.set_relief(Gtk::RELIEF_NONE);
|
||||
spGamutCheck.set_tooltip_markup(M("SOFTPROOF_GAMUTCHECK_TOOLTIP"));
|
||||
|
||||
spGamutCheck.set_active(false);
|
||||
spGamutCheck.set_sensitive(false);
|
||||
spGamutCheck.show ();
|
||||
}
|
||||
|
||||
void profileBoxChanged ()
|
||||
{
|
||||
updateParameters ();
|
||||
|
||||
profileBox.set_tooltip_text (profileBox.get_active_text ());
|
||||
}
|
||||
|
||||
void intentBoxChanged (int)
|
||||
@@ -91,7 +115,17 @@ private:
|
||||
updateParameters ();
|
||||
}
|
||||
|
||||
void updateParameters ()
|
||||
void softProofToggled ()
|
||||
{
|
||||
updateSoftProofParameters ();
|
||||
}
|
||||
|
||||
void spGamutCheckToggled ()
|
||||
{
|
||||
updateSoftProofParameters ();
|
||||
}
|
||||
|
||||
void updateParameters (bool noEvent = false)
|
||||
{
|
||||
ConnectionBlocker profileBlocker (profileConn);
|
||||
ConnectionBlocker intentBlocker (intentConn);
|
||||
@@ -123,23 +157,36 @@ private:
|
||||
profile.clear ();
|
||||
|
||||
intentBox.set_sensitive (false);
|
||||
intentBox.setSelected (0);
|
||||
intentBox.setSelected (1);
|
||||
softProof.set_sensitive(false);
|
||||
spGamutCheck.set_sensitive(false);
|
||||
|
||||
profileBox.set_tooltip_text ("");
|
||||
|
||||
} else {
|
||||
const std::uint8_t supportedIntents = rtengine::iccStore->getProofIntents (profile);
|
||||
const uint8_t supportedIntents = rtengine::iccStore->getProofIntents (profile);
|
||||
const bool supportsRelativeColorimetric = supportedIntents & 1 << INTENT_RELATIVE_COLORIMETRIC;
|
||||
const bool supportsPerceptual = supportedIntents & 1 << INTENT_PERCEPTUAL;
|
||||
const bool supportsAbsoluteColorimetric = supportedIntents & 1 << INTENT_ABSOLUTE_COLORIMETRIC;
|
||||
|
||||
if (supportsPerceptual || supportsRelativeColorimetric || supportsAbsoluteColorimetric) {
|
||||
intentBox.set_sensitive (true);
|
||||
intentBox.setItemSensitivity (0, supportsRelativeColorimetric);
|
||||
intentBox.setItemSensitivity (1, supportsPerceptual);
|
||||
intentBox.setItemSensitivity (2, supportsAbsoluteColorimetric);
|
||||
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 (0);
|
||||
intentBox.setSelected (1);
|
||||
softProof.set_sensitive(false);
|
||||
spGamutCheck.set_sensitive(false);
|
||||
}
|
||||
|
||||
profileBox.set_tooltip_text (profileBox.get_active_text ());
|
||||
}
|
||||
|
||||
rtengine::RenderingIntent intent;
|
||||
@@ -147,11 +194,11 @@ private:
|
||||
switch (intentBox.getSelected ()) {
|
||||
default:
|
||||
case 0:
|
||||
intent = rtengine::RI_RELATIVE;
|
||||
intent = rtengine::RI_PERCEPTUAL;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
intent = rtengine::RI_PERCEPTUAL;
|
||||
intent = rtengine::RI_RELATIVE;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@@ -163,29 +210,61 @@ 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 (bool noEvent = false)
|
||||
{
|
||||
spGamutCheck.set_sensitive(softProof.get_active());
|
||||
|
||||
if (profileBox.get_active_row_number () > 0) {
|
||||
if (!noEvent) {
|
||||
processor->beginUpdateParams ();
|
||||
}
|
||||
processor->setSoftProofing (softProof.get_sensitive() && softProof.get_active(), spGamutCheck.get_sensitive() && spGamutCheck.get_active());
|
||||
if (!noEvent) {
|
||||
processor->endUpdateParams (rtengine::EvMonitorTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
explicit MonitorProfileSelector (rtengine::StagedImageProcessor* const& ipc) :
|
||||
explicit ColorManagementToolbar (rtengine::StagedImageProcessor* const& ipc) :
|
||||
intentBox (Glib::ustring (), true),
|
||||
processor (ipc)
|
||||
{
|
||||
prepareProfileBox ();
|
||||
prepareIntentBox ();
|
||||
prepareSoftProofingBox ();
|
||||
|
||||
reset ();
|
||||
|
||||
profileConn = profileBox.signal_changed ().connect (sigc::mem_fun (this, &MonitorProfileSelector::profileBoxChanged));
|
||||
intentConn = intentBox.signal_changed ().connect (sigc::mem_fun (this, &MonitorProfileSelector::intentBoxChanged));
|
||||
softProof.signal_toggled().connect(sigc::mem_fun (this, &ColorManagementToolbar::softProofToggled));
|
||||
spGamutCheck.signal_toggled().connect(sigc::mem_fun (this, &ColorManagementToolbar::spGamutCheckToggled));;
|
||||
profileConn = profileBox.signal_changed ().connect (sigc::mem_fun (this, &ColorManagementToolbar::profileBoxChanged));
|
||||
intentConn = intentBox.signal_changed ().connect (sigc::mem_fun (this, &ColorManagementToolbar::intentBoxChanged));
|
||||
}
|
||||
|
||||
void pack_right_in (Gtk::Grid* grid)
|
||||
{
|
||||
grid->attach_next_to (profileBox, Gtk::POS_RIGHT, 1, 1);
|
||||
grid->attach_next_to (*intentBox.buttonGroup, Gtk::POS_RIGHT, 1, 1);
|
||||
grid->attach_next_to (softProof, Gtk::POS_RIGHT, 1, 1);
|
||||
grid->attach_next_to (spGamutCheck, Gtk::POS_RIGHT, 1, 1);
|
||||
}
|
||||
|
||||
void updateProcessor()
|
||||
{
|
||||
if (processor) {
|
||||
updateParameters(true);
|
||||
}
|
||||
}
|
||||
|
||||
void reset ()
|
||||
@@ -207,11 +286,11 @@ public:
|
||||
|
||||
switch (options.rtSettings.monitorIntent) {
|
||||
default:
|
||||
case rtengine::RI_RELATIVE:
|
||||
case rtengine::RI_PERCEPTUAL:
|
||||
intentBox.setSelected (0);
|
||||
break;
|
||||
|
||||
case rtengine::RI_PERCEPTUAL:
|
||||
case rtengine::RI_RELATIVE:
|
||||
intentBox.setSelected (1);
|
||||
break;
|
||||
|
||||
@@ -418,8 +497,6 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
|
||||
tbShowHideSidePanels->set_image (*iShowHideSidePanels);
|
||||
setExpandAlignProperties (tbShowHideSidePanels, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||
|
||||
monitorProfile.reset (new MonitorProfileSelector (ipc));
|
||||
|
||||
navPrev = navNext = navSync = NULL;
|
||||
|
||||
if (!simpleEditor && !options.tabbedUI) {
|
||||
@@ -452,6 +529,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
|
||||
// ================== PACKING THE BOTTOM WIDGETS =================
|
||||
|
||||
// Adding widgets from center to the left, on the left side (using Gtk::POS_LEFT)
|
||||
iops->attach_next_to (*vsep2, Gtk::POS_LEFT, 1, 1);
|
||||
iops->attach_next_to (*progressLabel, Gtk::POS_LEFT, 1, 1);
|
||||
iops->attach_next_to (*vsep1, Gtk::POS_LEFT, 1, 1);
|
||||
iops->attach_next_to (*sendtogimp, Gtk::POS_LEFT, 1, 1);
|
||||
@@ -462,9 +540,10 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
|
||||
|
||||
iops->attach_next_to (*saveimgas, Gtk::POS_LEFT, 1, 1);
|
||||
|
||||
// Adding widgets from center to the right, on the right side (using Gtk::POS_RIGHT)
|
||||
iops->attach_next_to (*vsep2, Gtk::POS_RIGHT, 1, 1);
|
||||
monitorProfile->pack_right_in (iops);
|
||||
|
||||
// Color management toolbar
|
||||
colorMgmtToolBar.reset (new ColorManagementToolbar (ipc));
|
||||
colorMgmtToolBar->pack_right_in (iops);
|
||||
|
||||
if (!simpleEditor && !options.tabbedUI) {
|
||||
iops->attach_next_to (*vsep3, Gtk::POS_RIGHT, 1, 1);
|
||||
@@ -736,6 +815,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);
|
||||
@@ -784,8 +864,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc)
|
||||
}
|
||||
|
||||
history->resetSnapShotNumber();
|
||||
|
||||
monitorProfile->reset ();
|
||||
}
|
||||
|
||||
void EditorPanel::close ()
|
||||
|
Reference in New Issue
Block a user