diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index cd68aa0a6..2220f68c5 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -33,7 +33,7 @@ extern const Settings* settings; Crop::Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) : EditBuffer(editDataProvider), origCrop(NULL), laboCrop(NULL), labnCrop(NULL), cropImg(NULL), cbuf_real(NULL), cshmap(NULL), transCrop(NULL), cieCrop(NULL), cbuffer(NULL), - softProofing(false), updating(false), newUpdatePending(false), skip(10), + updating(false), newUpdatePending(false), skip(10), cropx(0), cropy(0), cropw(-1), croph(-1), trafx(0), trafy(0), trafw(-1), trafh(-1), rqcropx(0), rqcropy(0), rqcropw(-1), rqcroph(-1), @@ -987,42 +987,8 @@ void Crop::update (int todo) EditBuffer::setReady(); // switch back to rgb - parent->ipf.lab2monitorRgb (labnCrop, cropImg, softProofing); + parent->ipf.lab2monitorRgb (labnCrop, cropImg); - //parent->ipf.lab2monitorRgb (laboCrop, cropImg); - - //cropImg = baseCrop->to8(); - /* - // int xref,yref; - xref=000;yref=000; - if (colortest && cropw>115 && croph>115) - for(int j=1;j<5;j++){ - xref+=j*30;yref+=j*30; - int rlin = (CurveFactory::igamma2((float)cropImg->data[3*((int)(xref/skip)*cropImg->width+(int)(yref/skip))]/255.0) * 255.0); - int glin = (CurveFactory::igamma2((float)cropImg->data[3*((int)(xref/skip)*cropImg->width+(int)(yref/skip))+1]/255.0) * 255.0); - int blin = (CurveFactory::igamma2((float)cropImg->data[3*((int)(xref/skip)*cropImg->width+(int)(yref/skip))+2]/255.0) * 255.0); - - printf("after lab2rgb RGB lab2 Xr%i Yr%i Skip=%d R=%d G=%d B=%d \n",xref,yref,skip, - rlin,glin,blin); - //cropImg->data[3*((int)(xref/skip)*cropImg->width+(int)(yref/skip))], - //cropImg->data[(3*((int)(xref/skip)*cropImg->width+(int)(yref/skip))+1)], - //cropImg->data[(3*((int)(xref/skip)*cropImg->width+(int)(yref/skip))+2)]); - //printf("after lab2rgb Lab lab2 Xr%i Yr%i Skip=%d l=%f a=%f b=%f \n",xref,yref,skip, labnCrop->L[(int)(xref/skip)][(int)(yref/skip)]/327,labnCrop->a[(int)(xref/skip)][(int)(yref/skip)]/327,labnCrop->b[(int)(xref/skip)][(int)(yref/skip)]/327); - printf("after lab2rgb Lab Xr%i Yr%i Skip=%d l=%f a=%f b=%f \n",xref,yref,skip, - labnCrop->L[(int)(xref/skip)][(int)(yref/skip)]/327, - labnCrop->a[(int)(xref/skip)][(int)(yref/skip)]/327, - labnCrop->b[(int)(xref/skip)][(int)(yref/skip)]/327)q; - } - */ - /* - if (colortest && cropImg->height>115 && cropImg->width>115) {//for testing - xref=000;yref=000; - printf("dcrop final R= %d G= %d B= %d \n", - cropImg->data[3*xref/(skip)*(cropImg->width+1)], - cropImg->data[3*xref/(skip)*(cropImg->width+1)+1], - cropImg->data[3*xref/(skip)*(cropImg->width+1)+2]); - } - */ if (cropImageListener) { // this in output space held in parallel to allow analysis like shadow/highlight Glib::ustring outProfile = params.icm.output; diff --git a/rtengine/dcrop.h b/rtengine/dcrop.h index ea9b1bc00..57f388a51 100644 --- a/rtengine/dcrop.h +++ b/rtengine/dcrop.h @@ -54,7 +54,6 @@ protected: // ----------------------------------------------------------------- float** cbuffer; - bool softProofing; /// True if the Crop has to display a soft proof of the output with its profile bool updating; /// Flag telling if an updater thread is currently processing bool newUpdatePending; /// Flag telling the updater thread that a new update is pending int skip; @@ -104,10 +103,6 @@ public: /** @brief Asynchronously reprocess the detailed crop */ void fullUpdate (); // called via thread - void setSoftProofing(bool doSoftProof) { - softProofing = doSoftProof; - } - void setListener (DetailedCropListener* il); void destroy (); int get_skip () diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 8d700a0cc..63ca9c5d0 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -33,7 +33,7 @@ ImProcCoordinator::ImProcCoordinator () : orig_prev(NULL), oprevi(NULL), oprevl(NULL), nprevl(NULL), previmg(NULL), workimg(NULL), ncie(NULL), imgsrc(NULL), shmap(NULL), lastAwbEqual(0.), ipf(¶ms, true), monitorIntent(RI_PERCEPTUAL), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false), allocated(false), isColorProfileDirty(true), - softProofing(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(0.), + bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(0.), hltonecurve(65536), shtonecurve(65536), @@ -783,14 +783,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // Update the output color transform if necessary if (isColorProfileDirty || (todo & M_MONITOR)) { - ipf.updateColorProfiles(params.icm, monitorProfile, monitorIntent, softProofing); + ipf.updateColorProfiles(params.icm, monitorProfile, monitorIntent); isColorProfileDirty = false; } // process crop, if needed for (size_t i = 0; i < crops.size(); i++) if (crops[i]->hasListener () && cropCall != crops[i] ) { - crops[i]->setSoftProofing(softProofing); crops[i]->update (todo); // may call ourselves } @@ -805,7 +804,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) MyMutex::MyLock prevImgLock(previmg->getMutex()); try { - ipf.lab2monitorRgb (nprevl, previmg, softProofing); + ipf.lab2monitorRgb (nprevl, previmg); delete workimg; Glib::ustring outProfile = params.icm.output; @@ -1133,11 +1132,6 @@ void ImProcCoordinator::getAutoCrop (double ratio, int &x, int &y, int &w, int & y = (fullh - h) / 2; } -void ImProcCoordinator::setSoftProofing (bool softProof) -{ - softProofing = softProof; -} - void ImProcCoordinator::setMonitorProfile (Glib::ustring profile, RenderingIntent intent) { if (profile != monitorProfile) { diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 31f9543b6..78d3dca7f 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -82,7 +82,6 @@ protected: bool allocated; bool isColorProfileDirty; - bool softProofing; void freeAll (); @@ -258,7 +257,6 @@ public: void setMonitorProfile (Glib::ustring profile, RenderingIntent intent); void getMonitorProfile (Glib::ustring &profile, RenderingIntent &intent); - void setSoftProofing (bool softProof); bool updateTryLock () { diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 18ffc0e8d..b1f47c3a9 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -140,55 +140,8 @@ void ImProcFunctions::firstAnalysisThread (Imagefloat* original, Glib::ustring w } } } -/* -void ImProcFunctions::CAT02 (Imagefloat* baseImg, const ProcParams* params) -{ - const double toxyz[3][3] = {{0.7976749, 0.1351917, 0.0313534}, - {0.2880402, 0.7118741, 0.0000857}, - {0.0000000, 0.0000000, 0.8252100}}; - const double xyzto[3][3] = {{1.3459433, -0.2556075, -0.0511118}, - {-0.5445989, 1.5081673, 0.0205351}, - {0.0000000, 0.0000000, 1.2118128}}; - int fw = baseImg->width; - int fh = baseImg->height; - - double CAM02BB00,CAM02BB01,CAM02BB02,CAM02BB10,CAM02BB11,CAM02BB12,CAM02BB20,CAM02BB21,CAM02BB22; - double Xxx,Yyy,Zzz; - // Xxx=1.09844; - // Yyy=1.0; - // Zzz=0.355961; - //params.wb.temperature, params.wb.green, params.wb.method - double Xxyz, Zxyz; -// ColorTemp::temp2mulxyz (params->wb.temperature, params->wb.green, params->wb.method, Xxyz, Zxyz); - ColorTemp::temp2mulxyz (5000.0, 1.0, "Camera", Xxyz, Zxyz); - - ColorTemp::cieCAT02(Xxx, Yyy, Zzz, CAM02BB00,CAM02BB01,CAM02BB02,CAM02BB10,CAM02BB11,CAM02BB12,CAM02BB20,CAM02BB21,CAM02BB22); - printf("00=%f 01=%f 11=%f 20=%f 22=%f\n", CAM02BB00,CAM02BB01,CAM02BB11,CAM02BB20,CAM02BB22); - - - for (int i=0; ir(i,j); - float g = baseImg->g(i,j); - float b = baseImg->b(i,j); - - float x = toxyz[0][0] * r + toxyz[0][1] * g + toxyz[0][2] * b; - float y = toxyz[1][0] * r + toxyz[1][1] * g + toxyz[1][2] * b; - float z = toxyz[2][0] * r + toxyz[2][1] * g + toxyz[2][2] * b; - float Xcam=CAM02BB00* x +CAM02BB01* y + CAM02BB02* z ; - float Ycam=CAM02BB10* x +CAM02BB11* y + CAM02BB12* z ; - float Zcam=CAM02BB20* x +CAM02BB21* y + CAM02BB22* z ; - baseImg->r(i,j) = xyzto[0][0] * Xcam + xyzto[0][1] * Ycam + xyzto[0][2] * Zcam; - baseImg->g(i,j) = xyzto[1][0] * Xcam + xyzto[1][1] * Ycam + xyzto[1][2] * Zcam; - baseImg->b(i,j) = xyzto[2][0] * Xcam + xyzto[2][1] * Ycam + xyzto[2][2] * Zcam; - } - } -} -*/ - - -void ImProcFunctions::updateColorProfiles (const ColorManagementParams &icm, Glib::ustring monitorProfile, RenderingIntent monitorIntent, bool softProofing) +void ImProcFunctions::updateColorProfiles (const ColorManagementParams& icm, const Glib::ustring& monitorProfile, RenderingIntent monitorIntent) { // set up monitor transform if (monitorTransform != NULL) { @@ -224,9 +177,6 @@ void ImProcFunctions::updateColorProfiles (const ColorManagementParams &icm, Gli cmsHPROFILE jprof = iccStore->getProfile(outputProfile); if (jprof) { - //TODO: Create a dedicated softproof transformation (line below to be finished) - //lab2outputTransform = cmsCreateProofingTransform(iprof, TYPE_Lab_FLT, jprof, TYPE_RGB_FLT, monitor, icm.outputIntent, monitorIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE | cmsFLAGS_SOFTPROOFING ); - lab2outputTransform = cmsCreateTransform (iprof, TYPE_Lab_FLT, jprof, TYPE_RGB_FLT, icm.outputIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); output2monitorTransform = cmsCreateTransform (jprof, TYPE_RGB_FLT, monitor, TYPE_RGB_8, monitorIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); } diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index af49cb937..ec81f26eb 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -233,7 +233,7 @@ public: bool needsPCVignetting (); void firstAnalysis (Imagefloat* working, const ProcParams* params, LUTu & vhist16); - void updateColorProfiles (const ColorManagementParams &icm, Glib::ustring monitorProfile, RenderingIntent monitorIntent, bool softProofing); + void updateColorProfiles (const ColorManagementParams& icm, const Glib::ustring& monitorProfile, RenderingIntent monitorIntent); void rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *editBuffer, 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); @@ -266,7 +266,7 @@ public: void transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, double focalLen, double focalLen35mm, float focusDist, int rawRotationDeg, bool fullImage); float resizeScale (const ProcParams* params, int fw, int fh, int &imw, int &imh); - void lab2monitorRgb (LabImage* lab, Image8* image, bool softProofing=false); + void lab2monitorRgb (LabImage* lab, Image8* image); void resize (Image16* src, Image16* dst, float dScale); void Lanczos (const LabImage* src, LabImage* dst, float scale); void Lanczos (const Image16* src, Image16* dst, float scale); diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index a53bdb8e1..c36e185d0 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -39,7 +39,7 @@ const double (*iwprof[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, const char* wprofnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB"}; const int numprof = 7; -void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image, bool softProofing) +void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) { //gamutmap(lab); @@ -78,7 +78,7 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image, bool softPro buffer[iy++] = rb[j] / 327.68f; } - if (softProofing && !settings->HistogramWorking && output2monitorTransform && lab2outputTransform) { + if (!settings->HistogramWorking && output2monitorTransform && lab2outputTransform) { AlignedBuffer buf(3 * W); cmsDoTransform (lab2outputTransform, buffer, buf.data, W); cmsDoTransform (output2monitorTransform, buf.data, data + ix, W); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 4609c674a..21ecf5a83 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -455,8 +455,7 @@ enum ProcEvent { // EvLgrbl = 425, EvRetinexlhcurve = 425, EvOIntent = 426, - EvSoftProof = 427, - EvMonitorTransform = 428, + EvMonitorTransform = 427, NUMOFEVENTS }; } diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 37d0f52b4..f31300a64 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -455,7 +455,6 @@ int refreshmap[rtengine::NUMOFEVENTS] = { // DEMOSAIC, // EvLgrbl DEMOSAIC, // EvRetinexlhcurve ALLNORAW, // EvOIntent - ALLNORAW, // EvSoftProof MONITORTRANSFORM // EvMonitorTransform }; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 0c6999158..d20b89c33 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -418,7 +418,6 @@ public: virtual void setMonitorProfile (Glib::ustring monitorProfile, RenderingIntent intent) = 0; virtual void getMonitorProfile (Glib::ustring &monitorProfile, RenderingIntent &intent) = 0; - virtual void setSoftProofing (bool softProof) = 0; virtual ~StagedImageProcessor () {} diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 518b5ad8d..b9f123ac5 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -33,131 +33,113 @@ using namespace rtengine::procparams; -class MonitorProfileSelector +class EditorPanel::MonitorProfileSelector { private: - Gtk::ToggleButton* softProof; - MyComboBoxText* profileBox; - PopUpButton* intentBox; - sigc::connection profileConn, intentConn, softProofConn; + MyComboBoxText profileBox; + PopUpButton intentBox; + sigc::connection profileConn, intentConn; - rtengine::StagedImageProcessor* processor; + rtengine::StagedImageProcessor* const& processor; private: - void prepareSoftProofButton () - { - Gtk::Image *softProofImg = Gtk::manage (new RTImage("softProof.png")); - softProofImg->set_padding(0, 0); - softProof = Gtk::manage(new Gtk::ToggleButton()); - softProof->add(*softProofImg); - softProof->set_relief(Gtk::RELIEF_NONE); - softProof->set_tooltip_text(M("MONITOR_SOFTPROOF")); - softProofConn = softProof->signal_toggled().connect (sigc::mem_fun (this, &MonitorProfileSelector::softProofToggled)); - } - void prepareProfileBox () { - profileBox = Gtk::manage(new MyComboBoxText()); - profileBox->set_size_request(100,-1); + profileBox.set_size_request (100, -1); - profileBox->append_text (M("PREFERENCES_PROFILE_NONE")); - #if defined(WIN32) - profileBox->append_text (M("MONITOR_PROFILE_SYSTEM") + " (" + rtengine::iccStore->getDefaultMonitorProfileName() + ")"); - profileBox->set_active (options.rtSettings.autoMonitorProfile ? 1 : 0); - #else - profileBox->set_active (0); - #endif + profileBox.append_text (M("PREFERENCES_PROFILE_NONE")); +#ifdef WIN32 + profileBox.append_text (M("MONITOR_PROFILE_SYSTEM") + " (" + rtengine::iccStore->getDefaultMonitorProfileName() + ")"); + profileBox.set_active (options.rtSettings.autoMonitorProfile ? 1 : 0); +#else + profileBox.set_active (0); +#endif const std::vector profiles = rtengine::iccStore->getProfiles (); for (std::vector::const_iterator iterator = profiles.begin (); iterator != profiles.end (); ++iterator) { - profileBox->append_text (*iterator); + profileBox.append_text (*iterator); } - profileConn = profileBox->signal_changed ().connect (sigc::mem_fun (this, &MonitorProfileSelector::updateParameters)); } void prepareIntentBox () { - intentBox = Gtk::manage(new PopUpButton(Glib::ustring(), true)); - intentBox->addEntry("intent-relative.png", M("PREFERENCES_INTENT_RELATIVE")); - intentBox->addEntry("intent-perceptual.png", M("PREFERENCES_INTENT_PERCEPTUAL")); - intentBox->addEntry("intent-absolute.png", M("PREFERENCES_INTENT_ABSOLUTE")); - intentBox->setSelected(0); - intentConn = intentBox->signal_changed().connect (sigc::mem_fun (this, &MonitorProfileSelector::updateIntent)); - intentBox->show(); + intentBox.addEntry("intent-relative.png", M("PREFERENCES_INTENT_RELATIVE")); + intentBox.addEntry("intent-perceptual.png", M("PREFERENCES_INTENT_PERCEPTUAL")); + intentBox.addEntry("intent-absolute.png", M("PREFERENCES_INTENT_ABSOLUTE")); + + intentBox.setSelected(0); + intentBox.show (); } - void softProofToggled () + void profileBoxChanged () { - if (processor) { - processor->beginUpdateParams (); - processor->setSoftProofing( softProof->get_active() ); - processor->endUpdateParams ( rtengine::EvMonitorTransform ); - } + updateParameters (); + + profileBox.set_tooltip_text (profileBox.get_active_text ()); } - void updateIntent (int i) + void intentBoxChanged (int) { - updateParameters(); + updateParameters (); } void updateParameters () { + ConnectionBlocker profileBlocker (profileConn); + ConnectionBlocker intentBlocker (intentConn); + Glib::ustring profile; - profileBox->set_tooltip_text(profileBox->get_active_text ()); + #ifdef WIN32 - if (profileBox->get_active_row_number () == 1) { + if (profileBox.get_active_row_number () == 1) { profile = rtengine::iccStore->getDefaultMonitorProfileName (); - if (profile.empty()) { + if (profile.empty ()) { profile = options.rtSettings.monitorProfile; } - if (profile.empty()) { - profile = "sRGB IEC61966-2.1"; // assuming this profile always exist on Windows + if (profile.empty ()) { + profile = "sRGB IEC61966-2.1"; } - } else if (profileBox->get_active_row_number () > 1) { - profile = profileBox->get_active_text (); + } else if (profileBox.get_active_row_number () > 1) { + profile = profileBox.get_active_text (); } #else - profile = profileBox->get_active_row_number () > 0 ? profileBox->get_active_text () : Glib::ustring(); + profile = profileBox.get_active_row_number () > 0 ? profileBox.get_active_text () : Glib::ustring (); #endif - // MonitorProfile = None , disabling everything - if (profileBox->get_active_row_number () == 0) { + if (profileBox.get_active_row_number () == 0) { + profile.clear(); - bool wasBlocked = intentConn.block(true); - intentBox->setSelected(1); - intentBox->set_sensitive (false); - intentConn.block(wasBlocked); - softProof->set_active(false); - softProof->set_sensitive(false); - wasBlocked = softProofConn.block(true); - softProofConn.block(wasBlocked); + + intentBox.set_sensitive (false); + intentBox.setSelected (0); } else { - std::uint8_t supportedIntents = rtengine::iccStore->getProofIntents (profile); - const bool supportsPerceptual = supportedIntents & 1 << INTENT_PERCEPTUAL; + const std::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(2, supportsAbsoluteColorimetric); + if (supportsPerceptual || supportsRelativeColorimetric || supportsAbsoluteColorimetric) { + intentBox.set_sensitive (true); + intentBox.setItemSensitivity(0, supportsRelativeColorimetric); + intentBox.setItemSensitivity(1, supportsPerceptual); + intentBox.setItemSensitivity(2, supportsAbsoluteColorimetric); + } else { + intentBox.set_sensitive (false); + intentBox.setSelected (0); } - else { - bool wasBlocked = intentConn.block(true); - intentBox->setSelected(supportsPerceptual ? 0 : 1); - intentBox->set_sensitive (false); - intentConn.block(wasBlocked); - } - softProof->set_sensitive(true); } - rtengine::RenderingIntent intent = rtengine::RI_PERCEPTUAL; - switch (intentBox->getSelected()) { - case (0): + rtengine::RenderingIntent intent; + switch (intentBox.getSelected ()) { + default: + case 0: intent = rtengine::RI_RELATIVE; break; - case (2): + case 1: + intent = rtengine::RI_PERCEPTUAL; + break; + case 2: intent = rtengine::RI_ABSOLUTE; break; } @@ -166,81 +148,67 @@ private: return; } - // either store them in the options file for the default value when opening the next EditorPanel - //options.rtSettings.monitorProfile = profile; - //options.rtSettings.monitorIntent = intent; - - // ...or store them locally processor->beginUpdateParams (); - if (options.rtSettings.verbose) { - Glib::ustring intentName; - switch (intent) { - case (0): - intentName = M("PREFERENCES_INTENT_RELATIVE"); - break; - case (1): - intentName = M("PREFERENCES_INTENT_PERCEPTUAL"); - break; - case (2): - default: // to avoid complains from gcc - intentName = M("PREFERENCES_INTENT_ABSOLUTE"); - break; - } - printf("Monitor profile: %s, Intent: %s)\n", profile.empty() ? "None" : profile.c_str(), intentName.c_str()); - } - processor->setMonitorProfile(profile, intent); + processor->setMonitorProfile (profile, intent); processor->endUpdateParams (rtengine::EvMonitorTransform); } public: - MonitorProfileSelector () : - processor (NULL) + MonitorProfileSelector (rtengine::StagedImageProcessor* const& ipc) : + intentBox (Glib::ustring (), true), + processor (ipc) { - prepareSoftProofButton (); prepareProfileBox (); prepareIntentBox (); reset (); + + profileConn = profileBox.signal_changed ().connect (sigc::mem_fun (this, &MonitorProfileSelector::profileBoxChanged)); + intentConn = intentBox.signal_changed ().connect (sigc::mem_fun (this, &MonitorProfileSelector::intentBoxChanged)); } void pack_end_in (Gtk::Box* box) { - box->pack_end (*softProof, Gtk::PACK_SHRINK, 0); - box->pack_end (*intentBox->buttonGroup, Gtk::PACK_SHRINK, 0); - box->pack_end (*profileBox, Gtk::PACK_SHRINK, 0); + box->pack_end (*intentBox.buttonGroup, Gtk::PACK_SHRINK, 0); + box->pack_end (profileBox, Gtk::PACK_SHRINK, 0); } void reset () { - bool wasBlocked; + ConnectionBlocker profileBlocker (profileConn); + ConnectionBlocker intentBlocker (intentConn); + #ifdef WIN32 - wasBlocked = profileConn.block(true); if (options.rtSettings.autoMonitorProfile) { - setActiveTextOrIndex (*profileBox, options.rtSettings.monitorProfile, 1); + setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 1); } else { - setActiveTextOrIndex (*profileBox, options.rtSettings.monitorProfile, 0); + setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0); } - profileConn.block(wasBlocked); #else - wasBlocked = profileConn.block(true); - setActiveTextOrIndex (*profileBox, options.rtSettings.monitorProfile, 0); - profileConn.block(wasBlocked); + setActiveTextOrIndex (profileBox, options.rtSettings.monitorProfile, 0); #endif - wasBlocked = intentConn.block(true); - intentBox->setSelected(options.rtSettings.monitorIntent == rtengine::RI_RELATIVE ? 0 : options.rtSettings.monitorIntent == rtengine::RI_PERCEPTUAL ? 1 : 2); - intentConn.block(wasBlocked); - updateParameters(); - } + switch (options.rtSettings.monitorIntent) + { + default: + case rtengine::RI_RELATIVE: + intentBox.setSelected (0); + break; + case rtengine::RI_PERCEPTUAL: + intentBox.setSelected (1); + break; + case rtengine::RI_ABSOLUTE: + intentBox.setSelected (2); + break; + } - void setImageProcessor (rtengine::StagedImageProcessor* imageProc) { - processor = imageProc; + updateParameters (); } }; EditorPanel::EditorPanel (FilePanel* filePanel) - : realized(false), iHistoryShow(NULL), iHistoryHide(NULL), iTopPanel_1_Show(NULL), iTopPanel_1_Hide(NULL), iRightPanel_1_Show(NULL), iRightPanel_1_Hide(NULL), iBeforeLockON(NULL), iBeforeLockOFF(NULL), beforePreviewHandler(NULL), monitorProfile(new MonitorProfileSelector ()), beforeIarea(NULL), beforeBox(NULL), afterBox(NULL), afterHeaderBox(NULL), parent(NULL), openThm(NULL), ipc(NULL), beforeIpc(NULL), isProcessing(false), catalogPane(NULL) + : realized(false), iHistoryShow(NULL), iHistoryHide(NULL), iTopPanel_1_Show(NULL), iTopPanel_1_Hide(NULL), iRightPanel_1_Show(NULL), iRightPanel_1_Hide(NULL), iBeforeLockON(NULL), iBeforeLockOFF(NULL), beforePreviewHandler(NULL), beforeIarea(NULL), beforeBox(NULL), afterBox(NULL), afterHeaderBox(NULL), parent(NULL), openThm(NULL), ipc(NULL), beforeIpc(NULL), isProcessing(false), catalogPane(NULL) { epih = new EditorPanelIdleHelper; @@ -471,8 +439,10 @@ EditorPanel::EditorPanel (FilePanel* filePanel) iops->pack_end (*navPrev, Gtk::PACK_SHRINK, 0); } - // Monitor profile buttons iops->pack_end (*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_SHRINK, 0); + + // Monitor profile buttons + monitorProfile.reset (new MonitorProfileSelector (ipc)); monitorProfile->pack_end_in (iops); editbox->pack_start (*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0); @@ -732,7 +702,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) this->isrc = isrc; ipc = rtengine::StagedImageProcessor::create (isrc); - monitorProfile->setImageProcessor(ipc); ipc->setProgressListener (this); ipc->setPreviewImageListener (previewHandler); ipc->setPreviewScale (10); // Important @@ -783,7 +752,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) history->resetSnapShotNumber(); - //HOMBRE: not sure if we want to reset on opening a new image monitorProfile->reset (); } diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index ffb8a93a4..6de9928bd 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -42,8 +42,6 @@ struct EditorPanelIdleHelper { int pending; }; -class MonitorProfileSelector; - class RTWindow; class EditorPanel : public Gtk::VBox, public PParamsChangeListener, @@ -86,6 +84,7 @@ protected: Gtk::Button* navNext; Gtk::Button* navPrev; + class MonitorProfileSelector; std::auto_ptr monitorProfile; ImageAreaPanel* iareapanel; diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 80729b96b..79f050c2f 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -76,6 +76,22 @@ public: } }; +class ConnectionBlocker +{ +public: + ConnectionBlocker (sigc::connection& connection) : connection (connection) + { + wasBlocked = connection.block(); + } + ~ConnectionBlocker () + { + connection.block(wasBlocked); + } +private: + sigc::connection& connection; + bool wasBlocked; +}; + /** * @brief Glue box to control visibility of the MyExpender's content ; also handle the frame around it */ diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index 8acbd2802..f7e667219 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -55,7 +55,6 @@ PopUpCommon::~PopUpCommon () delete menu; delete buttonImage; - delete buttonGroup; } bool PopUpCommon::addEntry (const Glib::ustring& fileName, const Glib::ustring& label)