diff --git a/CAVEATS.txt b/CAVEATS.txt new file mode 100644 index 000000000..f1d6e9f02 --- /dev/null +++ b/CAVEATS.txt @@ -0,0 +1,13 @@ + +RT 4.0.7 CAVEATS + + + +Difference between Preview and Output image: + + +The color managed preview in RawTherapee is (and has always been) based on image data in the Working Space profile. Although the actual preview is rendered using a monitor profile (or sRGB profile, if monitor profile is not specified), it does not reflect the Output profile & Output Gamma settings. This can lead to a slightly different output rendering when Working Space profile and Output Space profiles are not the same. A workaround is to set them to the same values to ensure the preview accurately reflects the final render output. + +For generic use in sRGB workflow when output is targeting web-based image display, it is recommended to use the default values of the Color/ICM toolset. + +Future releases of RawTherapee are planned to support a more comprehensive color-managed preview that will allow accurate visualization of the final output render based on not only the working space and monitor profiles, but also on user-selected Output color profile and Output Gamma. \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 2716df9b7..de2a9a628 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,6 +344,7 @@ endif(USE_CLANG) install (FILES AUTHORS.txt DESTINATION ${CREDITSDIR}) install (FILES LICENSE.txt DESTINATION ${LICENCEDIR}) install (FILES AboutThisBuild.txt DESTINATION ${CREDITSDIR}) +install (FILES CAVEATS.txt DESTINATION ${CREDITSDIR} OPTIONAL) add_subdirectory (rtexif) add_subdirectory (rtengine) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 793190003..8b33d02b7 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1,4 +1,5 @@ ABOUT_TAB_BUILD;Version +ABOUT_TAB_CAVEATS;Mise en garde ABOUT_TAB_CREDITS;Crédits ABOUT_TAB_LICENSE;Licence ABOUT_TAB_SPLASH;Splash @@ -1062,7 +1063,7 @@ HISTORY_MSG_165;Courbes RVB - B HISTORY_MSG_166;Niveaux neutre MAIN_TOOLTIP_BEFOREAFTERLOCK;Vérouille / déverouille la vue Avant\n\nVérouille: garde la vue Avant inchangée - \nutile pour évaluer l'effet cumultaif de plusieurs outils.\nDe plus, une comparaison peut être faite à partir de n'importe quelle étape de l'historique\n\nDéverouille: la vue Avant représentera l'étape précédant la vue Après, montrant l'effet qui vient d'être modifié MAIN_TOOLTIP_PREVIEWB;Affichage du canal Bleu -MAIN_TOOLTIP_PREVIEWFOCUSMASK;Affichage du Masque du focus +MAIN_TOOLTIP_PREVIEWFOCUSMASK;Affichage du Masque du focus (beta) Shift-F\n\nPlus précis sur les images avec une faible profondeur de champ, à faible bruit et à des niveaux de zoom élevé\n\nPour améliorer la précision de détection des images bruitées, évaluez les à un facteur de zoom de 10-30%\n\nLa prévisualisation met plus de temps à se calculer lorsque cet outil est actif. MAIN_TOOLTIP_PREVIEWG;Affichage du canal Vert MAIN_TOOLTIP_PREVIEWL;Affichage de la Luminosité\n0.299*R + 0.587*V + 0.114*B MAIN_TOOLTIP_PREVIEWR;Affichage du canal Rouge diff --git a/rtdata/languages/default b/rtdata/languages/default index dfc3abe23..a0d49ee80 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1,4 +1,5 @@ ABOUT_TAB_BUILD;Version +ABOUT_TAB_CAVEATS;Caveats ABOUT_TAB_CREDITS;Credits ABOUT_TAB_LICENSE;License ABOUT_TAB_SPLASH;Splash diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 65986e14a..726145517 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -77,7 +77,9 @@ class ImageSource : public InitialImage { virtual bool IsrgbSourceModified() =0; // tracks whether cached rgb output of demosaic has been modified + // use the right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* virtual void getImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, HRecParams hlp, ColorManagementParams cmp, RAWParams raw) {} + // true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource virtual bool isWBProviderReady () =0; virtual ColorTemp getWB () =0; virtual ColorTemp getAutoWB () =0; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 42858e9da..00961040e 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -89,7 +89,7 @@ ALLNORAW, // EvHREnabled, ALLNORAW, // EvHRAmount, ALLNORAW, // EvHRMethod, ALL, // EvWProfile, -ALL, // EvOProfile, +OUTPUTPROFIL, // EvOProfile, ALL, // EvIProfile, TRANSFORM, // EvVignetting, RGBCURVE, // EvChMixer, @@ -152,10 +152,10 @@ FLATFIELD, // EvFlatFieldBlurType, TRANSFORM, // EvAutoDIST, DIRPYRDENOISE, // EvDPDNLumCurve, DIRPYRDENOISE, // EvDPDNChromCurve, -ALL, // EvGAMMA -ALL, // EvGAMPOS -ALL, // EvGAMFREE -ALL, // EvSLPOS +GAMMA, // EvGAMMA +GAMMA, // EvGAMPOS +GAMMA, // EvGAMFREE +GAMMA, // EvSLPOS DARKFRAME, // EvPreProcessExpBlackzero DARKFRAME, // EvPreProcessExpBlackone DARKFRAME, // EvPreProcessExpBlacktwo diff --git a/rtengine/refreshmap.h b/rtengine/refreshmap.h index 9a2f37b07..8594d2ac5 100644 --- a/rtengine/refreshmap.h +++ b/rtengine/refreshmap.h @@ -63,6 +63,8 @@ #define EXIF M_VOID #define IPTC M_VOID #define DIRPYREQUALIZER (M_COLOR|M_LUMINANCE) +#define OUTPUTPROFIL (M_COLOR|M_LUMINANCE) +#define GAMMA (M_COLOR|M_LUMINANCE) #define NONE 0 #define ALLNORAW (M_INIT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index ffa4daede..0c246de36 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -248,24 +248,23 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p bool useLCMS; if(params.icm.gamma != "default" || params.icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8 - cmsMLU *DescriptionMLU, *CopyrightMLU, *DmndMLU, *DmddMLU;// for modification TAG - + cmsMLU *DescriptionMLU, *CopyrightMLU, *DmndMLU, *DmddMLU;// for modification TAG + cmsToneCurve* GammaTRC[3]; cmsFloat64Number Parameters[7]; - double ga0,ga1,ga2,ga3,ga4,ga5,ga6; + double ga0,ga1,ga2,ga3,ga4,ga5,ga6; // wchar_t string[80] ; - const wchar_t* stri[]= {L" RT_Large ", L" RT_Medium",L" RT_sRGB ",L" WideGamut",L" Beta RGB ",L" BestRGB ",L" BruceRGB"};//label for Free gamma and Output Gamma - int ns;//numero of stri[] - if (params.icm.working=="ProPhoto") ns=0; - else if (params.icm.working=="Adobe RGB") ns=1; - else if (params.icm.working=="sRGB") ns=2; - else if (params.icm.working=="WideGamut") ns=3; - else if (params.icm.working=="Beta RGB") ns=4; - else if (params.icm.working=="BestRGB") ns=5; - else if (params.icm.working=="BruceRGB") ns=6; + int ns;//numero of stri[] + if (params.icm.working=="ProPhoto") ns=0; + else if (params.icm.working=="Adobe RGB") ns=1; + else if (params.icm.working=="sRGB") ns=2; + else if (params.icm.working=="WideGamut") ns=3; + else if (params.icm.working=="Beta RGB") ns=4; + else if (params.icm.working=="BestRGB") ns=5; + else if (params.icm.working=="BruceRGB") ns=6; - readyImg = ipf.lab2rgb16b (labView, cx, cy, cw, ch, params.icm.output, params.icm.working, params.icm.gamma, params.icm.freegamma, params.icm.gampos, params.icm.slpos, ga0,ga1,ga2,ga3,ga4,ga5,ga6 ); + readyImg = ipf.lab2rgb16b (labView, cx, cy, cw, ch, params.icm.output, params.icm.working, params.icm.gamma, params.icm.freegamma, params.icm.gampos, params.icm.slpos, ga0,ga1,ga2,ga3,ga4,ga5,ga6 ); customGamma = true; //or selected Free gamma @@ -337,50 +336,38 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p CopyrightMLU = cmsMLUalloc(ContextID, 1);//for ICC DmndMLU=cmsMLUalloc(ContextID, 1);//for ICC DmddMLU=cmsMLUalloc(ContextID, 1);// for ICC - // instruction with //ICC are used for generate icc profile - if (DescriptionMLU == NULL) printf("Error Description\n"); - cmsMLUsetWide(CopyrightMLU, "en", "US", L"No copyright Rawtherapee -AdobeRGB compatible") ;//adapt to profil - cmsMLUsetWide(DmndMLU, "en", "US", L"Rawtherapee") ; - cmsMLUsetWide(DmddMLU, "en", "US", L"RTMedium") ; //adapt to profil + if (DescriptionMLU == NULL) printf("Description error\n"); + cmsMLUsetWide(CopyrightMLU, "en", "US", L"General Public License - AdobeRGB compatible") ;//adapt to profil + cmsMLUsetWide(DmndMLU, "en", "US", L"RawTherapee") ; + cmsMLUsetWide(DmddMLU, "en", "US", L"RTMedium") ; //adapt to profil //display Tag desc with : selection of gamma and Primaries - if(params.icm.gamma=="High_g1.3_s3.35" && !params.icm.freegamma) { - wchar_t string1[80] = L"GammaTRC: High g1.3 s3.35"; - wcsncat( string1, stri[ns], 37 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string1); - } - else if (params.icm.gamma=="Low_g2.6_s6.9" && !params.icm.freegamma) { - wchar_t string2[80] = L"GammaTRC: Low g2.6 s6.9"; - wcsncat( string2, stri[ns], 36 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string2); - } - else if (params.icm.gamma=="sRGB_g2.4_s12.92" && !params.icm.freegamma) { - wchar_t string3[80] = L"GammaTRC: sRGB g2.4 s12.92"; - wcsncat( string3, stri[ns], 37 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string3); - } - else if (params.icm.gamma== "BT709_g2.2_s4.5" && !params.icm.freegamma) { - wchar_t string4[80] = L"GammaTRC: BT709 g2.2 s4.5"; - wcsncat( string4, stri[ns], 36 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string4); - } - else if (params.icm.gamma== "linear_g1.0" && !params.icm.freegamma) { - wchar_t string5[80] = L"GammaTRC: Linear g1.0"; - wcsncat( string5, stri[ns], 32 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string5); - } - else if (params.icm.gamma== "standard_g2.2" && !params.icm.freegamma) { - wchar_t string6[80] = L"GammaTRC: g2.2"; - wcsncat( string6, stri[ns], 30 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string6); - } - else if (params.icm.gamma== "standard_g1.8" && !params.icm.freegamma) { - wchar_t string7[80] = L"GammaTRC: g1.8"; - wcsncat( string7, stri[ns], 30 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string7); - } + if (!params.icm.freegamma) { + std::wstring gammaStr; + if(params.icm.gamma=="High_g1.3_s3.35") { + gammaStr = std::wstring(L"GammaTRC: High g=1.3 s=3.35"); + } + else if (params.icm.gamma=="Low_g2.6_s6.9") { + gammaStr = std::wstring(L"GammaTRC: Low g=2.6 s=6.9"); + } + else if (params.icm.gamma=="sRGB_g2.4_s12.92") { + gammaStr = std::wstring(L"GammaTRC: sRGB g=2.4 s=12.92"); + } + else if (params.icm.gamma== "BT709_g2.2_s4.5") { + gammaStr = std::wstring(L"GammaTRC: BT709 g=2.2 s=4.5"); + } + else if (params.icm.gamma== "linear_g1.0") { + gammaStr = std::wstring(L"GammaTRC: Linear g=1.0"); + } + else if (params.icm.gamma== "standard_g2.2") { + gammaStr = std::wstring(L"GammaTRC: g=2.2"); + } + else if (params.icm.gamma== "standard_g1.8") { + gammaStr = std::wstring(L"GammaTRC: g=1.8"); + } + cmsMLUsetWide(DescriptionMLU, "en", "US", gammaStr.c_str()); //for elaboration ICC profiles // else if (params.icm.gamma== "sRGB_g2.4_s12.92" && !params.icm.freegamma) cmsMLUsetWide(DescriptionMLU, "en", "US", L"RT_Medium gamma sRGB(AdobeRGB compatible)"); @@ -390,36 +377,14 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p //else if (params.icm.gamma== "BT709_g2.2_s4.5" && !params.icm.freegamma) cmsMLUsetWide(DescriptionMLU, "en", "US", L"RT_Large gamma BT709(Prophoto compatible)"); // else if (params.icm.gamma== "sRGB_g2.4_s12.92" && !params.icm.freegamma) cmsMLUsetWide(DescriptionMLU, "en", "US", L"RT_Large gamma sRGB(Prophoto compatible)"); // else if (params.icm.gamma== "linear_g1.0" && !params.icm.freegamma) cmsMLUsetWide(DescriptionMLU, "en", "US", L"RT_Large gamma Linear1.0(Prophoto compatible)"); - - else if (params.icm.freegamma) {//prepare wchar_t for Free Gamma - std::wostringstream sgamm; - float gamm = params.icm.gampos;//gamma - sgamm< buf( cga , cga + (ws.size() + 1) ); - wchar_t* wp = &buf[0]; - wchar_t wpr[5]=L"2222"; - wcsncpy(wpr,wp,4); //gamma (gampos==> string) - wchar_t string[80] = L"Free Gamma g="; - - wchar_t mid[5]=L" s="; - wcsncat( string, wpr, 17 ); - wcsncat( string, mid, 20 ); - - std::wostringstream slp;//slope - float slop = params.icm.slpos; - slp< buf2( cslo , cslo + (ws2.size() + 1) ); - wchar_t* wp2 = &buf2[0]; // wchar_t* - wchar_t wpr2[6]=L"22222"; - wcsncpy(wpr2,wp2,5); //Slope (slope==> string) - - wcsncat( string, wpr2, 23 ); - wcsncat( string, stri[ns], 33 ); - cmsMLUsetWide(DescriptionMLU, "en", "US", string);}//display description with gamma + slope + primaries + } + else { + // create description with gamma + slope + primaries + std::wostringstream gammaWs; + gammaWs.precision(2); + gammaWs<<"Manual GammaTRC: g="<<(float)params.icm.gampos<<" s="<<(float)params.icm.slpos; + cmsMLUsetWide(DescriptionMLU, "en", "US", gammaWs.str().c_str()); + } cmsWriteTag(jprof, cmsSigProfileDescriptionTag, DescriptionMLU);//desc changed // cmsWriteTag(jprof, cmsSigCopyrightTag, CopyrightMLU); @@ -521,7 +486,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // Setting the output curve to readyImg if (customGamma) { if (!useLCMS) { - // use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generate by lab2rgb16b + // use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16b ProfileContent pc(jprof); readyImg->setOutputProfile (pc.data, pc.length); } diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 241b0853b..11d7e8ef1 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -320,18 +320,22 @@ MySpinButton::MySpinButton () { void MySpinButton::updateSize() { double vMin, vMax; double step, page; - double maxAbs; + int maxAbs; unsigned int digits, digits2; unsigned int maxLen; get_range(vMin, vMax); get_increments (step, page); - maxAbs = fmax(fabs(vMin), fabs(vMax)); digits = get_digits(); - for (digits2=0; maxAbs/pow(double(10),digits2)>=1.0; digits2++); + maxAbs = (int)(fmax(fabs(vMin), fabs(vMax))+0.000001); + if (maxAbs==0) + digits2 = 1; + else { + digits2 = (int)(log10(double(maxAbs))+0.000001); + digits2++; + } maxLen = digits+digits2+(vMin<0?1:0)+(digits>0?1:0); - set_max_length(maxLen); set_width_chars(maxLen); } diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 053d98acc..24549a1a3 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include #include "icmpanel.h" #include "options.h" #include "guiutils.h" @@ -331,7 +332,7 @@ void ICMPanel::adjusterChanged (Adjuster* a, double newval) { if (listener && freegamma->get_active()) { - Glib::ustring costr = Glib::ustring::format ((int)a->getValue()); + Glib::ustring costr = Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), newval); if (a==gampos) listener->panelChanged (EvGAMPOS, costr); diff --git a/rtgui/options.cc b/rtgui/options.cc index 56ccf5db5..2bf862a75 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -49,7 +49,6 @@ void Options::setDefaults () { windowWidth = 900; windowHeight = 560; windowMaximized = false; - firstRun = true; savesParamsAtExit = true; saveFormat.format = "jpg"; saveFormat.jpegQuality = 100; @@ -79,8 +78,8 @@ void Options::setDefaults () { profilePath = "profiles"; dirBrowserWidth = 200; dirBrowserHeight = 150; - preferencesWidth = 0; - preferencesHeight = 0; + preferencesWidth = 0; + preferencesHeight = 0; toolPanelWidth = 300; browserToolPanelWidth = 300; browserToolPanelHeight = 300; @@ -95,7 +94,7 @@ void Options::setDefaults () { fbShowHidden = false; fbArrangement = 2; // was 0 multiUser = true; - version = VERSION; + version = "0.0.0.0"; // temporary value; will be correctly set in RTWindow::on_realize thumbSize = 240; // was 80 thumbSizeTab = 80; showHistory = true; @@ -233,14 +232,14 @@ void Options::setDefaults () { #endif rtSettings.colorimetricIntent = 1; rtSettings.monitorProfile = ""; - rtSettings.autoMonitorProfile = false; + rtSettings.autoMonitorProfile = false; rtSettings.LCMSSafeMode = true; rtSettings.adobe = "RT_Medium_gsRGB"; // put the name of yours profiles (here windows) rtSettings.prophoto = "RT_Large_gBT709"; // these names appear in the menu "output profile" rtSettings.prophoto10 = "RT_Large_g10"; // these names appear in the menu "output profile" rtSettings.srgb10 = "RT_sRGB_g10"; rtSettings.widegamut = "WideGamutRGB"; - rtSettings.srgb = "RT_sRGB_gBT709"; + rtSettings.srgb = "RT_sRGB"; rtSettings.bruce = "Bruce"; rtSettings.beta = "BetaRGB"; rtSettings.best = "BestRGB"; @@ -296,7 +295,6 @@ if (keyFile.has_group ("General")) { if (keyFile.has_key ("General", "Theme")) theme = keyFile.get_string ("General", "Theme"); if (keyFile.has_key ("General", "SlimUI")) slimUI = keyFile.get_boolean ("General", "SlimUI"); if (keyFile.has_key ("General", "UseSystemTheme")) useSystemTheme = keyFile.get_boolean ("General", "UseSystemTheme"); - if (keyFile.has_key ("General", "FirstRun")) firstRun = keyFile.get_boolean ("General", "FirstRun"); if( keyFile.has_key ("General", "DarkFramesPath")) rtSettings.darkFramesPath = keyFile.get_string("General", "DarkFramesPath"); if( keyFile.has_key ("General", "FlatFieldsPath")) rtSettings.flatFieldsPath = keyFile.get_string("General", "FlatFieldsPath"); if( keyFile.has_key ("General", "Verbose")) rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); @@ -435,18 +433,16 @@ if (keyFile.has_group ("Color Management")) { if (keyFile.has_key ("Color Management", "Intent")) rtSettings.colorimetricIntent = keyFile.get_integer("Color Management", "Intent"); if (keyFile.has_key ("Color Management", "WhiteBalanceSpotSize")) whiteBalanceSpotSize = keyFile.get_integer("Color Management", "WhiteBalanceSpotSize"); - if( keyFile.has_key ("Color Management", "GamutICC")) rtSettings.gamutICC = keyFile.get_boolean("Color Management", "GamutICC"); - if( keyFile.has_key ("Color Management", "RT_Adobe_RGB")) rtSettings.adobe = keyFile.get_string("Color Management", "RT_Adobe_RGB"); - if( keyFile.has_key ("Color Management", "RT_Pro_Photo")) rtSettings.prophoto = keyFile.get_string("Color Management","RT_Pro_Photo"); - if( keyFile.has_key ("Color Management", "RT_Pro_Photo10")) rtSettings.prophoto10 = keyFile.get_string("Color Management","RT_Pro_Photo10"); - - if( keyFile.has_key ("Color Management", "Wide_Gamut")) rtSettings.widegamut = keyFile.get_string("Color Management","Wide_Gamut"); - if( keyFile.has_key ("Color Management", "RT_S_rgb")) rtSettings.srgb = keyFile.get_string("Color Management","RT_S_rgb"); - if( keyFile.has_key ("Color Management", "RT_S_rgb10")) rtSettings.srgb10 = keyFile.get_string("Color Management","RT_S_rgb10"); - - if( keyFile.has_key ("Color Management", "B_eta")) rtSettings.beta = keyFile.get_string("Color Management","B_eta"); - if( keyFile.has_key ("Color Management", "B_est")) rtSettings.best = keyFile.get_string("Color Management","B_est"); - if( keyFile.has_key ("Color Management", "B_ruce")) rtSettings.bruce = keyFile.get_string("Color Management","B_ruce"); + if( keyFile.has_key ("Color Management", "GamutICC")) rtSettings.gamutICC = keyFile.get_boolean("Color Management", "GamutICC"); + if( keyFile.has_key ("Color Management", "AdobeRGB")) rtSettings.adobe = keyFile.get_string("Color Management", "AdobeRGB"); + if( keyFile.has_key ("Color Management", "ProPhoto")) rtSettings.prophoto = keyFile.get_string("Color Management", "ProPhoto"); + if( keyFile.has_key ("Color Management", "ProPhoto10")) rtSettings.prophoto10 = keyFile.get_string("Color Management", "ProPhoto10"); + if( keyFile.has_key ("Color Management", "WideGamut")) rtSettings.widegamut = keyFile.get_string("Color Management", "WideGamut"); + if( keyFile.has_key ("Color Management", "sRGB")) rtSettings.srgb = keyFile.get_string("Color Management", "sRGB"); + if( keyFile.has_key ("Color Management", "sRGB10")) rtSettings.srgb10 = keyFile.get_string("Color Management", "sRGB10"); + if( keyFile.has_key ("Color Management", "Beta")) rtSettings.beta = keyFile.get_string("Color Management", "Beta"); + if( keyFile.has_key ("Color Management", "Best")) rtSettings.best = keyFile.get_string("Color Management", "Best"); + if( keyFile.has_key ("Color Management", "Bruce")) rtSettings.bruce = keyFile.get_string("Color Management", "Bruce"); // Disabled (default is true) till issues are sorted out //if (keyFile.has_key ("Color Management", "LCMSSafeMode")) rtSettings.LCMSSafeMode = keyFile.get_boolean ("Color Management", "LCMSSafeMode"); @@ -492,7 +488,6 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_boolean ("General", "SlimUI", slimUI); keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme); keyFile.set_string ("General", "Version", VERSION); - keyFile.set_boolean ("General", "FirstRun", false); keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); @@ -613,22 +608,20 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_integer ("Crop Settings", "PPI", cropPPI); - keyFile.set_string ("Color Management", "ICCDirectory", rtSettings.iccDirectory); + keyFile.set_string ("Color Management", "ICCDirectory", rtSettings.iccDirectory); keyFile.set_string ("Color Management", "MonitorProfile", rtSettings.monitorProfile); keyFile.set_boolean ("Color Management", "AutoMonitorProfile", rtSettings.autoMonitorProfile); - keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent); + keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent); keyFile.set_boolean ("Color Management", "LCMSSafeMode", rtSettings.LCMSSafeMode); - keyFile.set_string ("Color Management", "RT_Adobe_RGB", rtSettings.adobe); - keyFile.set_string ("Color Management", "RT_Pro_Photo", rtSettings.prophoto); - keyFile.set_string ("Color Management", "RT_Pro_Photo10", rtSettings.prophoto10); - - keyFile.set_string ("Color Management", "Wide_Gamut", rtSettings.widegamut); - keyFile.set_string ("Color Management", "RT_S_rgb", rtSettings.srgb); - keyFile.set_string ("Color Management", "RT_S_rgb10", rtSettings.srgb10); - - keyFile.set_string ("Color Management", "B_eta", rtSettings.beta); - keyFile.set_string ("Color Management", "B_est", rtSettings.best); - keyFile.set_string ("Color Management", "B_ruce", rtSettings.bruce); + keyFile.set_string ("Color Management", "AdobeRGB", rtSettings.adobe); + keyFile.set_string ("Color Management", "ProPhoto", rtSettings.prophoto); + keyFile.set_string ("Color Management", "ProPhoto10", rtSettings.prophoto10); + keyFile.set_string ("Color Management", "WideGamut", rtSettings.widegamut); + keyFile.set_string ("Color Management", "sRGB", rtSettings.srgb); + keyFile.set_string ("Color Management", "sRGB10", rtSettings.srgb10); + keyFile.set_string ("Color Management", "Beta", rtSettings.beta); + keyFile.set_string ("Color Management", "Best", rtSettings.best); + keyFile.set_string ("Color Management", "Bruce", rtSettings.bruce); keyFile.set_integer ("Color Management", "WhiteBalanceSpotSize", whiteBalanceSpotSize); keyFile.set_boolean ("Color Management", "GamutICC", rtSettings.gamutICC); diff --git a/rtgui/options.h b/rtgui/options.h index 52efd4c55..f64b607f6 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -49,7 +49,6 @@ class Options { void error (int line); public: - bool firstRun; bool savesParamsAtExit; SaveFormat saveFormat,saveFormatBatch; Glib::ustring savePathTemplate; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 6c45ea82f..f155cf515 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -33,6 +33,8 @@ extern Glib::ustring argv0; Preferences::Preferences (RTWindow *rtwindow):parent(rtwindow) { + splash = NULL; + set_title (M("MAIN_BUTTON_PREFERENCES")); moptions.copyFrom (&options); @@ -1296,9 +1298,9 @@ void Preferences::selectStartupDir () { void Preferences::aboutPressed () { - Splash* splash = new Splash (); + splash = new Splash (*this); splash->set_transient_for (*this); - splash->set_modal (true); + splash->signal_delete_event().connect( sigc::mem_fun(*this, &Preferences::splashClosed) ); splash->show (); } @@ -1478,3 +1480,9 @@ void Preferences::updateFFinfos() Glib::ustring s = Glib::ustring::compose("%1: %2 %3, %4 %5", M("PREFERENCES_FLATFIELDFOUND"), t1, M("PREFERENCES_FLATFIELDSHOTS"), t2, M("PREFERENCES_FLATFIELDTEMPLATES")); ffLabel->set_text(s); } + +bool Preferences::splashClosed(GdkEventAny* event) { + delete splash; + splash = NULL; + return true; +} diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 3b93b22f4..1b6c7655b 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -51,6 +51,7 @@ class Preferences : public Gtk::Dialog { protected: + Splash* splash; Gtk::ComboBoxText* rprofiles; Gtk::ComboBoxText* iprofiles; Gtk::ComboBoxText* languages; @@ -159,6 +160,7 @@ class Preferences : public Gtk::Dialog { void cacheFormatComboChanged (); void switchThemeTo (Glib::ustring newTheme, bool slimInterface); void switchFontTo (Glib::ustring newFont); + bool splashClosed(GdkEventAny* event); void appendBehavList (Gtk::TreeModel::iterator& parent, Glib::ustring label, int id, bool set); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 3a56f33a1..5e5860c32 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + #include "rtwindow.h" #include "options.h" #include "preferences.h" @@ -28,6 +29,7 @@ RTWindow::RTWindow () ,bpanel(NULL) ,epanel(NULL) ,fpanel(NULL) +,splash(NULL) { cacheMgr->init (); @@ -202,6 +204,27 @@ RTWindow::RTWindow () if (!isSingleTabMode()&& !simpleEditor) epanel->hide_all(); } +void RTWindow::findVerNumbers(int* numbers, Glib::ustring versionStr) { + numbers[0] = numbers[1] = numbers[2] = numbers[3] = 0; + int n=0; + for (unsigned int i=0; i= '0' && chr <= '9') { + numbers[n] *= 10; + numbers[n] += (int)(chr - '0'); + } + else { + n++; + if (n>4) { + printf("Error: malformed version string; \"%s\" must follow this format: xx.xx.xx.xx. Admitting it's a developer version...\n", versionStr.c_str()); + // Reseting the already found numbers + numbers[0] = numbers[1] = numbers[2] = numbers[3] = 100; + return; + } + } + } +} + void RTWindow::on_realize () { Gtk::Window::on_realize (); @@ -209,6 +232,38 @@ void RTWindow::on_realize () { fpanel->setAspect(); cursorManager.init (get_window()); + + // Check if first run of this version, then display the caveats text + if (options.version != versionString) { + int prevVerNbr[4]; + int currVerNbr[4]; + findVerNumbers(prevVerNbr, options.version); + findVerNumbers(currVerNbr, versionString); + + // Now we can update the version parameter with the right value + options.version = versionString; + + bool showCaveats = false; + // Check if the current version is newer + if (currVerNbr[0] > prevVerNbr[0]) showCaveats = true; + else if (currVerNbr[1] > prevVerNbr[1]) showCaveats = true; + else if (currVerNbr[2] > prevVerNbr[2]) showCaveats = true; + + if (showCaveats) { + // this is a first run! + splash = new Splash (*this); + splash->set_transient_for (*this); + splash->signal_delete_event().connect( sigc::mem_fun(*this, &RTWindow::splashClosed) ); + if (splash->hasCaveats()) { + splash->showCaveats(); + splash->show (); + } + else { + delete splash; + splash = NULL; + } + } + } } bool RTWindow::on_window_state_event(GdkEventWindowState* event) { @@ -317,7 +372,7 @@ bool RTWindow::selectEditorPanel(const std::string &name) { bool RTWindow::keyPressed (GdkEventKey* event) { bool ctrl = event->state & GDK_CONTROL_MASK; - bool shift = event->state & GDK_SHIFT_MASK; + //bool shift = event->state & GDK_SHIFT_MASK; if (ctrl) { switch(event->keyval) { @@ -397,8 +452,6 @@ bool RTWindow::on_delete_event(GdkEventAny* event) { WhiteBalance::cleanup(); - options.firstRun = false; - if (!options.windowMaximized) { options.windowWidth = get_width(); options.windowHeight = get_height(); @@ -531,3 +584,9 @@ void RTWindow::updateHistogramPosition (int oldPosition, int newPosition) { ((*itr).second)->updateHistogramPosition (oldPosition, newPosition); } } + +bool RTWindow::splashClosed(GdkEventAny* event) { + delete splash; + splash = NULL; + return true; +} diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index fcce1a7ee..9f7026e9a 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -25,6 +25,7 @@ #include #include "progressconnector.h" #include "editwindow.h" +#include "splash.h" class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ @@ -34,6 +35,7 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ std::set filesEdited; std::map epanels; + Splash* splash; Gtk::ProgressBar prProgBar; PLDBridge* pldBridge; bool is_fullscreen; @@ -42,9 +44,11 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ Gtk::Image *iFullscreen, *iFullscreen_exit; bool isSingleTabMode() { return !options.tabbedUI && !EditWindow::isMultiDisplayEnabled(); }; + void findVerNumbers(int* numbers, Glib::ustring versionStr); bool on_expose_event_epanel(GdkEventExpose* event); bool on_expose_event_fpanel(GdkEventExpose* event); + bool splashClosed(GdkEventAny* event); public: RTWindow (); diff --git a/rtgui/splash.cc b/rtgui/splash.cc index 12336b46f..5bbb4370b 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -70,16 +70,17 @@ bool SplashImage::on_expose_event (GdkEventExpose* event) { return true; } -Splash::Splash () { +Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, true) { - set_title (M("GENERAL_ABOUT")); set_border_width (4); - Gtk::Notebook* nb = Gtk::manage (new Gtk::Notebook ()); + caveatsSW = NULL; + + nb = Gtk::manage (new Gtk::Notebook ()); get_vbox()->pack_start (*nb); // Tab 1: the image - splashImage = new SplashImage (); + splashImage = Gtk::manage(new SplashImage ()); nb->append_page (*splashImage, M("ABOUT_TAB_SPLASH")); splashImage->show (); @@ -145,13 +146,37 @@ Splash::Splash () { textBuffer->set_text((Glib::ustring)(ostr.str())); Gtk::ScrolledWindow *licenseSW = Gtk::manage (new Gtk::ScrolledWindow()); - Gtk::TextView *creditsTV = Gtk::manage (new Gtk::TextView (textBuffer)); - creditsTV->set_editable(false); - licenseSW->add(*creditsTV); + Gtk::TextView *licenseTV = Gtk::manage (new Gtk::TextView (textBuffer)); + licenseTV->set_editable(false); + licenseSW->add(*licenseTV); nb->append_page (*licenseSW, M("ABOUT_TAB_LICENSE")); } } + // Tab 5: the caveats + std::string caveatsFileName = Glib::build_filename (creditsPath, "CAVEATS.txt"); + if ( safe_file_test(caveatsFileName, (Glib::FILE_TEST_EXISTS)) ) { + FILE *f = safe_g_fopen (caveatsFileName, "rt"); + if (f != NULL) { + char* buffer = new char[1024]; + std::ostringstream ostr; + while (fgets (buffer, 1024, f)) + ostr << buffer; + delete [] buffer; + fclose (f); + + Glib::RefPtr textBuffer = Gtk::TextBuffer::create(); + textBuffer->set_text((Glib::ustring)(ostr.str())); + + caveatsSW = Gtk::manage (new Gtk::ScrolledWindow()); + Gtk::TextView *caveatsTV = Gtk::manage (new Gtk::TextView (textBuffer)); + caveatsTV->set_editable(false); + caveatsTV->set_wrap_mode(Gtk::WRAP_WORD); + caveatsSW->add(*caveatsTV); + nb->append_page (*caveatsSW, M("ABOUT_TAB_CAVEATS")); + } + } + set_position (Gtk::WIN_POS_CENTER); //add_events(Gdk::BUTTON_RELEASE_MASK); @@ -160,15 +185,12 @@ Splash::Splash () { nb->set_current_page (0); show_all_children (); - set_modal (true); set_keep_above (true); } -Splash::Splash (int maxtime) { +Splash::Splash (Gtk::Window& parent, int maxtime) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, true) { - set_title (M("GENERAL_ABOUT")); - - splashImage = new SplashImage (); + splashImage = Gtk::manage(new SplashImage ()); // add (*splashImage); get_vbox()->pack_start (*splashImage); splashImage->show (); @@ -190,8 +212,16 @@ bool Splash::on_timer () { return false; } +/* + * removed as it seem to be too sensitive in some OS bool Splash::on_button_release_event (GdkEventButton* event) { hide (); return true; } +*/ + +void Splash::showCaveats() { + if (caveatsSW) + nb->set_current_page(nb->page_num(*caveatsSW)); +} diff --git a/rtgui/splash.h b/rtgui/splash.h index 9418be06c..9a75d04fe 100644 --- a/rtgui/splash.h +++ b/rtgui/splash.h @@ -39,13 +39,17 @@ class Splash : public Gtk::Dialog { private: SplashImage* splashImage; + Gtk::Notebook* nb; + Gtk::ScrolledWindow* caveatsSW; public: - Splash (int maxtime); - Splash (); + Splash (Gtk::Window& parent, int maxtime); + Splash (Gtk::Window& parent); + bool hasCaveats() { return caveatsSW != NULL; }; + void showCaveats(); bool on_timer (); - virtual bool on_button_release_event (GdkEventButton* event); + //virtual bool on_button_release_event (GdkEventButton* event); }; #endif