diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index cb5314489..c4382a5a6 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -41,8 +41,9 @@ void loadProfiles (const Glib::ustring& dirName, std::map* profileNames, bool nameUpper, bool onlyRgb) { - if (dirName.empty ()) + if (dirName.empty ()) { return; + } try { @@ -52,23 +53,27 @@ void loadProfiles (const Glib::ustring& dirName, const Glib::ustring fileName = *entry; - if (fileName.size () < 4) + if (fileName.size () < 4) { continue; + } const Glib::ustring extension = fileName.substr (fileName.size () - 4).casefold (); - if (extension.compare (".icc") != 0 && extension.compare (".icm") != 0) + if (extension.compare (".icc") != 0 && extension.compare (".icm") != 0) { continue; + } const Glib::ustring filePath = Glib::build_filename (dirName, fileName); - if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR)) + if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR)) { continue; + } Glib::ustring name = fileName.substr (0, fileName.size() - 4); - if (nameUpper) + if (nameUpper) { name = name.uppercase (); + } if (profiles) { const rtengine::ProfileContent content (filePath); @@ -77,28 +82,31 @@ void loadProfiles (const Glib::ustring& dirName, if (profile && (!onlyRgb || cmsGetColorSpace (profile) == cmsSigRgbData)) { profiles->insert (std::make_pair (name, profile)); - if (profileContents) + if (profileContents) { profileContents->insert (std::make_pair (name, content)); + } } } - if (profileNames) + if (profileNames) { profileNames->insert (std::make_pair (name, filePath)); + } } - } - catch (Glib::Exception&) {} + } catch (Glib::Exception&) {} } inline void getSupportedIntent (cmsHPROFILE profile, cmsUInt32Number intent, cmsUInt32Number direction, std::uint8_t& result) { - if (cmsIsIntentSupported (profile, intent, direction)) + if (cmsIsIntentSupported (profile, intent, direction)) { result |= 1 << intent; + } } inline std::uint8_t getSupportedIntents (cmsHPROFILE profile, cmsUInt32Number direction) { - if (!profile) + if (!profile) { return 0; + } std::uint8_t result = 0; @@ -137,7 +145,7 @@ std::vector getGamma () std::vector res; - for (unsigned int i = 0; i < sizeof(wpgamma) / sizeof(wpgamma[0]); i++) { + for (unsigned int i = 0; i < sizeof (wpgamma) / sizeof (wpgamma[0]); i++) { res.push_back (wpgamma[i]); } @@ -149,7 +157,7 @@ std::vector getWorkingProfiles () std::vector res; - for (unsigned int i = 0; i < sizeof(wpnames) / sizeof(wpnames[0]); i++) { + for (unsigned int i = 0; i < sizeof (wpnames) / sizeof (wpnames[0]); i++) { res.push_back (wpnames[i]); } @@ -159,12 +167,13 @@ std::vector getWorkingProfiles () std::vector ICCStore::getProfiles () const { - MyMutex::MyLock lock(mutex_); + MyMutex::MyLock lock (mutex_); std::vector res; - for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile) + for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile) { res.push_back (profile->first); + } return res; } @@ -172,7 +181,7 @@ std::vector ICCStore::getProfiles () const std::vector ICCStore::getProfilesFromDir (const Glib::ustring& dirName) const { - MyMutex::MyLock lock(mutex_); + MyMutex::MyLock lock (mutex_); std::vector res; @@ -181,8 +190,9 @@ std::vector ICCStore::getProfilesFromDir (const Glib::ustring& di loadProfiles (profilesDir, &profiles, NULL, NULL, false, true); loadProfiles (dirName, &profiles, NULL, NULL, false, true); - for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile) + for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile) { res.push_back (profile->first); + } return res; } @@ -195,19 +205,19 @@ cmsHPROFILE ICCStore::makeStdGammaProfile (cmsHPROFILE iprof) } cmsUInt32Number bytesNeeded = 0; - cmsSaveProfileToMem(iprof, 0, &bytesNeeded); + cmsSaveProfileToMem (iprof, 0, &bytesNeeded); if (bytesNeeded == 0) { return NULL; } uint8_t *data = new uint8_t[bytesNeeded + 1]; - cmsSaveProfileToMem(iprof, data, &bytesNeeded); + cmsSaveProfileToMem (iprof, data, &bytesNeeded); const uint8_t *p = &data[128]; // skip 128 byte header uint32_t tag_count; - memcpy(&tag_count, p, 4); + memcpy (&tag_count, p, 4); p += 4; - tag_count = ntohl(tag_count); + tag_count = ntohl (tag_count); struct icctag { uint32_t sig; @@ -220,10 +230,10 @@ cmsHPROFILE ICCStore::makeStdGammaProfile (cmsHPROFILE iprof) int data_size = (gamma_size + 3) & ~3; for (uint32_t i = 0; i < tag_count; i++) { - memcpy(&tags[i], p, 12); - tags[i].sig = ntohl(tags[i].sig); - tags[i].offset = ntohl(tags[i].offset); - tags[i].size = ntohl(tags[i].size); + memcpy (&tags[i], p, 12); + tags[i].sig = ntohl (tags[i].sig); + tags[i].offset = ntohl (tags[i].offset); + tags[i].size = ntohl (tags[i].size); p += 12; if (tags[i].sig != 0x62545243 && // bTRC @@ -236,16 +246,16 @@ cmsHPROFILE ICCStore::makeStdGammaProfile (cmsHPROFILE iprof) uint32_t sz = 128 + 4 + tag_count * 12 + data_size; uint8_t *nd = new uint8_t[sz]; - memset(nd, 0, sz); - memcpy(nd, data, 128 + 4); - sz = htonl(sz); - memcpy(nd, &sz, 4); + memset (nd, 0, sz); + memcpy (nd, data, 128 + 4); + sz = htonl (sz); + memcpy (nd, &sz, 4); uint32_t offset = 128 + 4 + tag_count * 12; uint32_t gamma_offset = 0; for (uint32_t i = 0; i < tag_count; i++) { struct icctag tag; - tag.sig = htonl(tags[i].sig); + tag.sig = htonl (tags[i].sig); if (tags[i].sig == 0x62545243 || // bTRC tags[i].sig == 0x67545243 || // gTRC @@ -253,30 +263,30 @@ cmsHPROFILE ICCStore::makeStdGammaProfile (cmsHPROFILE iprof) tags[i].sig == 0x6B545243) { // kTRC if (gamma_offset == 0) { gamma_offset = offset; - uint32_t pcurve[] = { htonl(0x63757276), htonl(0), htonl(gamma_size == 12 ? 0 : 1) }; - memcpy(&nd[offset], pcurve, 12); + uint32_t pcurve[] = { htonl (0x63757276), htonl (0), htonl (gamma_size == 12 ? 0 : 1) }; + memcpy (&nd[offset], pcurve, 12); if (gamma_size == 14) { - uint16_t gm = htons(gamma); - memcpy(&nd[offset + 12], &gm, 2); + uint16_t gm = htons (gamma); + memcpy (&nd[offset + 12], &gm, 2); } offset += (gamma_size + 3) & ~3; } - tag.offset = htonl(gamma_offset); - tag.size = htonl(gamma_size); + tag.offset = htonl (gamma_offset); + tag.size = htonl (gamma_size); } else { - tag.offset = htonl(offset); - tag.size = htonl(tags[i].size); - memcpy(&nd[offset], &data[tags[i].offset], tags[i].size); + tag.offset = htonl (offset); + tag.size = htonl (tags[i].size); + memcpy (&nd[offset], &data[tags[i].offset], tags[i].size); offset += (tags[i].size + 3) & ~3; } - memcpy(&nd[128 + 4 + i * 12], &tag, 12); + memcpy (&nd[128 + 4 + i * 12], &tag, 12); } - cmsHPROFILE oprof = cmsOpenProfileFromMem (nd, ntohl(sz)); + cmsHPROFILE oprof = cmsOpenProfileFromMem (nd, ntohl (sz)); delete [] nd; delete [] data; return oprof; @@ -294,7 +304,7 @@ ICCStore::ICCStore () : { //cmsErrorAction (LCMS_ERROR_SHOW); - int N = sizeof(wpnames) / sizeof(wpnames[0]); + int N = sizeof (wpnames) / sizeof (wpnames[0]); for (int i = 0; i < N; i++) { wProfiles[wpnames[i]] = createFromMatrix (wprofiles[i]); @@ -355,7 +365,7 @@ cmsHPROFILE ICCStore::workingSpaceGamma (const Glib::ustring& name) const cmsHPROFILE ICCStore::getProfile (const Glib::ustring& name) const { - MyMutex::MyLock lock(mutex_); + MyMutex::MyLock lock (mutex_); const ProfileMap::const_iterator r = fileProfiles.find (name); @@ -368,8 +378,8 @@ cmsHPROFILE ICCStore::getProfile (const Glib::ustring& name) const const cmsHPROFILE profile = content.toProfile (); if (profile) { - const_cast(fileProfiles).insert(std::make_pair(name, profile)); - const_cast(fileProfileContents).insert(std::make_pair(name, content)); + const_cast (fileProfiles).insert (std::make_pair (name, profile)); + const_cast (fileProfileContents).insert (std::make_pair (name, content)); return profile; } @@ -383,37 +393,40 @@ cmsHPROFILE ICCStore::getStdProfile (const Glib::ustring& name) const const Glib::ustring nameUpper = name.uppercase (); - MyMutex::MyLock lock(mutex_); + MyMutex::MyLock lock (mutex_); const ProfileMap::const_iterator r = fileStdProfiles.find (nameUpper); // return profile from store - if (r != fileStdProfiles.end ()) + if (r != fileStdProfiles.end ()) { return r->second; + } // profile is not yet in store const NameMap::const_iterator f = fileStdProfilesFileNames.find (nameUpper); // profile does not exist - if (f == fileStdProfilesFileNames.end ()) + if (f == fileStdProfilesFileNames.end ()) { return NULL; + } // but there exists one => load it const ProfileContent content (f->second); const cmsHPROFILE profile = content.toProfile (); - if (profile) - const_cast(fileStdProfiles).insert (std::make_pair (f->first, profile)); + if (profile) { + const_cast (fileStdProfiles).insert (std::make_pair (f->first, profile)); + } // profile is not valid or it is now stored => remove entry from fileStdProfilesFileNames - const_cast(fileStdProfilesFileNames).erase (f); + const_cast (fileStdProfilesFileNames).erase (f); return profile; } ProfileContent ICCStore::getContent (const Glib::ustring& name) const { - MyMutex::MyLock lock(mutex_); + MyMutex::MyLock lock (mutex_); const ContentMap::const_iterator r = fileProfileContents.find (name); @@ -445,7 +458,7 @@ std::uint8_t ICCStore::getProofIntents (cmsHPROFILE profile) const void ICCStore::init (const Glib::ustring& usrICCDir, const Glib::ustring& rtICCDir) { - MyMutex::MyLock lock(mutex_); + MyMutex::MyLock lock (mutex_); // RawTherapee's profiles take precedence if a user's profile of the same name exists profilesDir = Glib::build_filename (rtICCDir, "output"); @@ -470,26 +483,27 @@ void ICCStore::findDefaultMonitorProfile () #ifdef WIN32 // Get current main monitor. Could be fine tuned to get the current windows monitor (multi monitor setup), // but problem is that we live in RTEngine with no GUI window to query around - HDC hDC = GetDC(NULL); + HDC hDC = GetDC (NULL); if (hDC != NULL) { - if (SetICMMode(hDC, ICM_ON)) { + if (SetICMMode (hDC, ICM_ON)) { char profileName[MAX_PATH + 1]; DWORD profileLength = MAX_PATH; - if (GetICMProfileA(hDC, &profileLength, profileName)) { - defaultMonitorProfile = Glib::ustring(profileName); - defaultMonitorProfile = Glib::path_get_basename(defaultMonitorProfile); - size_t pos = defaultMonitorProfile.rfind("."); + if (GetICMProfileA (hDC, &profileLength, profileName)) { + defaultMonitorProfile = Glib::ustring (profileName); + defaultMonitorProfile = Glib::path_get_basename (defaultMonitorProfile); + size_t pos = defaultMonitorProfile.rfind ("."); + if (pos != Glib::ustring::npos) { - defaultMonitorProfile = defaultMonitorProfile.substr(0, pos); + defaultMonitorProfile = defaultMonitorProfile.substr (0, pos); } } // might fail if e.g. the monitor has no profile } - ReleaseDC(NULL, hDC); + ReleaseDC (NULL, hDC); } #else @@ -497,11 +511,11 @@ void ICCStore::findDefaultMonitorProfile () #endif if (options.rtSettings.verbose) { - printf("Default monitor profile is: %s\n", defaultMonitorProfile.c_str()); + printf ("Default monitor profile is: %s\n", defaultMonitorProfile.c_str()); } } -ProfileContent::ProfileContent (const Glib::ustring& fileName) : data(NULL), length(0) +ProfileContent::ProfileContent (const Glib::ustring& fileName) : data (NULL), length (0) { FILE* f = g_fopen (fileName.c_str (), "rb"); @@ -532,16 +546,16 @@ ProfileContent::ProfileContent (const ProfileContent& other) } } -ProfileContent::ProfileContent (cmsHPROFILE hProfile) : data(NULL), length(0) +ProfileContent::ProfileContent (cmsHPROFILE hProfile) : data (NULL), length (0) { if (hProfile != NULL) { cmsUInt32Number bytesNeeded = 0; - cmsSaveProfileToMem(hProfile, 0, &bytesNeeded); + cmsSaveProfileToMem (hProfile, 0, &bytesNeeded); if (bytesNeeded > 0) { data = new char[bytesNeeded + 1]; - cmsSaveProfileToMem(hProfile, data, &bytesNeeded); + cmsSaveProfileToMem (hProfile, data, &bytesNeeded); length = (int)bytesNeeded; } } @@ -618,9 +632,9 @@ cmsHPROFILE ICCStore::createFromMatrix (const double matrix[3][3], bool gamma, c } // constructing profile header - unsigned* oprof = new unsigned [phead[0] / sizeof(unsigned)]; + unsigned* oprof = new unsigned [phead[0] / sizeof (unsigned)]; memset (oprof, 0, phead[0]); - memcpy (oprof, phead, sizeof(phead)); + memcpy (oprof, phead, sizeof (phead)); oprof[0] = 132 + 12 * pbody[0]; @@ -633,14 +647,14 @@ cmsHPROFILE ICCStore::createFromMatrix (const double matrix[3][3], bool gamma, c oprof[0] += (pbody[i * 3 + 3] + 3) & -4; } - memcpy (oprof + 32, pbody, sizeof(pbody)); + memcpy (oprof + 32, pbody, sizeof (pbody)); // wtpt - memcpy ((char *)oprof + pbody[8] + 8, pwhite, sizeof(pwhite)); + memcpy ((char *)oprof + pbody[8] + 8, pwhite, sizeof (pwhite)); // r/g/b TRC for (int i = 4; i < 7; i++) { - memcpy ((char *)oprof + pbody[i * 3 + 2], pcurve, sizeof(pcurve)); + memcpy ((char *)oprof + pbody[i * 3 + 2], pcurve, sizeof (pcurve)); } // r/g/b XYZ @@ -654,7 +668,7 @@ cmsHPROFILE ICCStore::createFromMatrix (const double matrix[3][3], bool gamma, c // convert to network byte order for (unsigned int i = 0; i < phead[0] / 4; i++) { - oprof[i] = htonl(oprof[i]); + oprof[i] = htonl (oprof[i]); } // cprt @@ -665,7 +679,7 @@ cmsHPROFILE ICCStore::createFromMatrix (const double matrix[3][3], bool gamma, c strcpy ((char *)oprof + pbody[5] + 12, name.c_str()); - cmsHPROFILE p = cmsOpenProfileFromMem (oprof, ntohl(oprof[0])); + cmsHPROFILE p = cmsOpenProfileFromMem (oprof, ntohl (oprof[0])); delete [] oprof; return p; } diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 4510044aa..5f1c2d10e 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -45,7 +45,7 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) #pragma omp parallel firstprivate(lab, data, W, H) #endif { - AlignedBuffer pBuf(3 * lab->W); + AlignedBuffer pBuf (3 * lab->W); float *buffer = pBuf.data; #ifdef _OPENMP @@ -70,7 +70,7 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) } if (!settings->HistogramWorking && output2monitorTransform && lab2outputTransform) { - AlignedBuffer buf(3 * W); + AlignedBuffer buf (3 * W); cmsDoTransform (lab2outputTransform, buffer, buf.data, W); cmsDoTransform (output2monitorTransform, buf.data, data + ix, W); } else { @@ -108,18 +108,18 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) fz = fy - (0.005 * rb[j]) / 327.68; LL = rL[j] / 327.68; - x_ = 65535.0 * Color::f2xyz(fx) * Color::D50x; + x_ = 65535.0 * Color::f2xyz (fx) * Color::D50x; // y_ = 65535.0 * Color::f2xyz(fy); - z_ = 65535.0 * Color::f2xyz(fz) * Color::D50z; + z_ = 65535.0 * Color::f2xyz (fz) * Color::D50z; y_ = (LL > Color::epskap) ? 65535.0 * fy * fy * fy : 65535.0 * LL / Color::kappa; - Color::xyz2srgb(x_, y_, z_, R, G, B); + Color::xyz2srgb (x_, y_, z_, R, G, B); /* copy RGB */ //int R1=((int)gamma2curve[(R)]) - data[ix++] = ((int)Color::gamma2curve[CLIP(R)]) >> 8; - data[ix++] = ((int)Color::gamma2curve[CLIP(G)]) >> 8; - data[ix++] = ((int)Color::gamma2curve[CLIP(B)]) >> 8; + data[ix++] = ((int)Color::gamma2curve[CLIP (R)]) >> 8; + data[ix++] = ((int)Color::gamma2curve[CLIP (G)]) >> 8; + data[ix++] = ((int)Color::gamma2curve[CLIP (B)]) >> 8; } } } @@ -153,14 +153,14 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, cmsHPROFILE oprofG = oprof; if (standard_gamma) { - oprofG = ICCStore::makeStdGammaProfile(oprof); + oprofG = ICCStore::makeStdGammaProfile (oprof); } lcmsMutex->lock (); - cmsHPROFILE hLab = cmsCreateLab4Profile(NULL); + cmsHPROFILE hLab = cmsCreateLab4Profile (NULL); cmsHTRANSFORM hTransform = cmsCreateTransform (hLab, TYPE_Lab_DBL, oprofG, TYPE_RGB_8, intent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); // NOCACHE is important for thread safety - cmsCloseProfile(hLab); + cmsCloseProfile (hLab); lcmsMutex->unlock (); unsigned char *data = image->data; @@ -170,7 +170,7 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, #pragma omp parallel #endif { - AlignedBuffer pBuf(3 * cw); + AlignedBuffer pBuf (3 * cw); double *buffer = pBuf.data; int condition = cy + ch; @@ -195,10 +195,10 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, } } // End of parallelization - cmsDeleteTransform(hTransform); + cmsDeleteTransform (hTransform); if (oprofG != oprof) { - cmsCloseProfile(oprofG); + cmsCloseProfile (oprofG); } } else { @@ -222,16 +222,16 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, float fz = fy - (0.005 * rb[j]) / 327.68; float LL = rL[j] / 327.68; - float x_ = 65535.0 * Color::f2xyz(fx) * Color::D50x; + float x_ = 65535.0 * Color::f2xyz (fx) * Color::D50x; //float y_ = 65535.0 * Color::f2xyz(fy); - float z_ = 65535.0 * Color::f2xyz(fz) * Color::D50z; + float z_ = 65535.0 * Color::f2xyz (fz) * Color::D50z; float y_ = (LL > Color::epskap) ? 65535.0 * fy * fy * fy : 65535.0 * LL / Color::kappa; - Color::xyz2rgb(x_, y_, z_, R, G, B, rgb_xyz); + Color::xyz2rgb (x_, y_, z_, R, G, B, rgb_xyz); - image->data[ix++] = (int)Color::gamma2curve[CLIP(R)] >> 8; - image->data[ix++] = (int)Color::gamma2curve[CLIP(G)] >> 8; - image->data[ix++] = (int)Color::gamma2curve[CLIP(B)] >> 8; + image->data[ix++] = (int)Color::gamma2curve[CLIP (R)] >> 8; + image->data[ix++] = (int)Color::gamma2curve[CLIP (G)] >> 8; + image->data[ix++] = (int)Color::gamma2curve[CLIP (B)] >> 8; } } } @@ -272,9 +272,9 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int float* rL = lab->L[i]; float* ra = lab->a[i]; float* rb = lab->b[i]; - short* xa = (short*)image->r(i - cy); - short* ya = (short*)image->g(i - cy); - short* za = (short*)image->b(i - cy); + short* xa = (short*)image->r (i - cy); + short* ya = (short*)image->g (i - cy); + short* za = (short*)image->b (i - cy); for (int j = cx; j < cx + cw; j++) { @@ -283,18 +283,18 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int float fz = fy - (0.005f * rb[j]) / 327.68f; float LL = rL[j] / 327.68f; - float x_ = 65535.0f * (float) Color::f2xyz(fx) * Color::D50x; + float x_ = 65535.0f * (float) Color::f2xyz (fx) * Color::D50x; //float y_ = 65535.0 * Color::f2xyz(fy); - float z_ = 65535.0f * (float) Color::f2xyz(fz) * Color::D50z; + float z_ = 65535.0f * (float) Color::f2xyz (fz) * Color::D50z; float y_ = (LL > Color::epskap) ? 65535.0f * fy * fy * fy : 65535.0f * LL / Color::kappa; - xa[j - cx] = CLIP((int) round(x_)); - ya[j - cx] = CLIP((int) round(y_)); - za[j - cx] = CLIP((int) round(z_)); + xa[j - cx] = CLIP ((int) round (x_)); + ya[j - cx] = CLIP ((int) round (y_)); + za[j - cx] = CLIP ((int) round (z_)); - if(bw && y_ < 65535.f ) { //force Bw value and take highlight into account - xa[j - cx] = (int) round(y_ * Color::D50x ); - za[j - cx] = (int) round(y_ * Color::D50z); + if (bw && y_ < 65535.f ) { //force Bw value and take highlight into account + xa[j - cx] = (int) round (y_ * Color::D50x ); + za[j - cx] = (int) round (y_ * Color::D50z); } } @@ -305,9 +305,9 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int cmsHTRANSFORM hTransform = cmsCreateTransform (iprof, TYPE_RGB_16, oprof, TYPE_RGB_16, intent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE); lcmsMutex->unlock (); - image->ExecCMSTransform(hTransform); + image->ExecCMSTransform (hTransform); - cmsDeleteTransform(hTransform); + cmsDeleteTransform (hTransform); } else { #pragma omp parallel for if (multiThread) @@ -324,16 +324,16 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int float fz = fy - (0.005f * rb[j]) / 327.68f; float LL = rL[j] / 327.68f; - float x_ = 65535.0f * (float) Color::f2xyz(fx) * Color::D50x; + float x_ = 65535.0f * (float) Color::f2xyz (fx) * Color::D50x; //float y_ = 65535.0 * Color::f2xyz(fy); - float z_ = 65535.0f * (float) Color::f2xyz(fz) * Color::D50z; + float z_ = 65535.0f * (float) Color::f2xyz (fz) * Color::D50z; float y_ = (LL > Color::epskap) ? (float) 65535.0f * fy * fy * fy : 65535.0f * LL / Color::kappa; - Color::xyz2srgb(x_, y_, z_, R, G, B); + Color::xyz2srgb (x_, y_, z_, R, G, B); - image->r(i - cy, j - cx) = (int)Color::gamma2curve[CLIP(R)]; - image->g(i - cy, j - cx) = (int)Color::gamma2curve[CLIP(G)]; - image->b(i - cy, j - cx) = (int)Color::gamma2curve[CLIP(B)]; + image->r (i - cy, j - cx) = (int)Color::gamma2curve[CLIP (R)]; + image->g (i - cy, j - cx) = (int)Color::gamma2curve[CLIP (G)]; + image->b (i - cy, j - cx) = (int)Color::gamma2curve[CLIP (B)]; } } } @@ -441,7 +441,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int if (!freegamma) {//if Free gamma not selected // gamma : ga0,ga1,ga2,ga3,ga4,ga5 by calcul - if(gam == "BT709_g2.2_s4.5") { + if (gam == "BT709_g2.2_s4.5") { ga0 = 2.22; //BT709 2.2 4.5 - my prefered as D.Coffin ga1 = 0.909995; ga2 = 0.090005; @@ -492,11 +492,11 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ga5 = 0.0; } } else { //free gamma selected - if(slpos == 0) { + if (slpos == 0) { slpos = eps; } - Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope : return parameters for LCMS2 + Color::calcGamma (pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope : return parameters for LCMS2 ga4 = g_a3 * ts; //printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); ga0 = gampos; @@ -508,7 +508,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int } - if(select_temp == 1) { + if (select_temp == 1) { t50 = 5003; // for Widegamut, Prophoto Best, Beta D50 } else if (select_temp == 2) { t50 = 6504; // for sRGB, AdobeRGB, Bruce D65 @@ -529,11 +529,11 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int Parameters[5] = ga5; Parameters[6] = ga6; // 7 parameters for smoother curves - cmsWhitePointFromTemp(&xyD, t50); - GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, 5, Parameters);//5 = more smoother than 4 - cmsHPROFILE oprofdef = cmsCreateRGBProfileTHR(NULL, &xyD, &Primaries, GammaTRC); //oprofdef become Outputprofile + cmsWhitePointFromTemp (&xyD, t50); + GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve (NULL, 5, Parameters); //5 = more smoother than 4 + cmsHPROFILE oprofdef = cmsCreateRGBProfileTHR (NULL, &xyD, &Primaries, GammaTRC); //oprofdef become Outputprofile - cmsFreeToneCurve(GammaTRC[0]); + cmsFreeToneCurve (GammaTRC[0]); if (oprofdef) { @@ -543,9 +543,9 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int float* rL = lab->L[i]; float* ra = lab->a[i]; float* rb = lab->b[i]; - short* xa = (short*)image->r(i - cy); - short* ya = (short*)image->g(i - cy); - short* za = (short*)image->b(i - cy); + short* xa = (short*)image->r (i - cy); + short* ya = (short*)image->g (i - cy); + short* za = (short*)image->b (i - cy); for (int j = cx; j < cx + cw; j++) { @@ -554,18 +554,18 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int float fz = fy - (0.005f * rb[j]) / 327.68f; float LL = rL[j] / 327.68f; - float x_ = 65535.0f * (float)Color::f2xyz(fx) * Color::D50x; + float x_ = 65535.0f * (float)Color::f2xyz (fx) * Color::D50x; // float y_ = 65535.0 * Color::f2xyz(fy); - float z_ = 65535.0f * (float)Color::f2xyz(fz) * Color::D50z; + float z_ = 65535.0f * (float)Color::f2xyz (fz) * Color::D50z; float y_ = (LL > Color::epskap) ? (float) 65535.0 * fy * fy * fy : 65535.0f * LL / Color::kappa; - xa[j - cx] = CLIP((int) round(x_)) ; - ya[j - cx] = CLIP((int) round(y_)); - za[j - cx] = CLIP((int) round(z_)); + xa[j - cx] = CLIP ((int) round (x_)) ; + ya[j - cx] = CLIP ((int) round (y_)); + za[j - cx] = CLIP ((int) round (z_)); - if(bw && y_ < 65535.f) { //force Bw value and take highlight into account - xa[j - cx] = (int) round(y_ * Color::D50x); - za[j - cx] = (int) round(y_ * Color::D50z); + if (bw && y_ < 65535.f) { //force Bw value and take highlight into account + xa[j - cx] = (int) round (y_ * Color::D50x); + za[j - cx] = (int) round (y_ * Color::D50z); } } @@ -576,8 +576,8 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int cmsHTRANSFORM hTransform = cmsCreateTransform (iprof, TYPE_RGB_16, oprofdef, TYPE_RGB_16, intent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE); lcmsMutex->unlock (); - image->ExecCMSTransform(hTransform); - cmsDeleteTransform(hTransform); + image->ExecCMSTransform (hTransform); + cmsDeleteTransform (hTransform); } else { // #pragma omp parallel for if (multiThread) @@ -594,16 +594,16 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int float fz = fy - (0.005f * rb[j]) / 327.68f; float LL = rL[j] / 327.68f; - float x_ = 65535.0f * (float) Color::f2xyz(fx) * Color::D50x; + float x_ = 65535.0f * (float) Color::f2xyz (fx) * Color::D50x; //float y_ = 65535.0 * Color::f2xyz(fy); - float z_ = 65535.0f * (float) Color::f2xyz(fz) * Color::D50z; + float z_ = 65535.0f * (float) Color::f2xyz (fz) * Color::D50z; float y_ = (LL > Color::epskap) ? (float) 65535.0 * fy * fy * fy : 65535.0f * LL / Color::kappa; - Color::xyz2srgb(x_, y_, z_, R, G, B); + Color::xyz2srgb (x_, y_, z_, R, G, B); - image->r(i - cy, j - cx) = (int)Color::gamma2curve[CLIP(R)]; - image->g(i - cy, j - cx) = (int)Color::gamma2curve[CLIP(G)]; - image->b(i - cy, j - cx) = (int)Color::gamma2curve[CLIP(B)]; + image->r (i - cy, j - cx) = (int)Color::gamma2curve[CLIP (R)]; + image->g (i - cy, j - cx) = (int)Color::gamma2curve[CLIP (G)]; + image->b (i - cy, j - cx) = (int)Color::gamma2curve[CLIP (B)]; } } } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c03addb42..ab9c85ffe 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -40,7 +40,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p errorCode = 0; - ProcessingJobImpl* job = static_cast(pjob); + ProcessingJobImpl* job = static_cast (pjob); if (pl) { pl->setProgressStr ("PROGRESSBAR_PROCESSING"); @@ -63,7 +63,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // acquire image from imagesource ImageSource* imgsrc = ii->getImageSource (); - int tr = getCoarseBitMask(params.coarse); + int tr = getCoarseBitMask (params.coarse); int fw, fh; imgsrc->getFullSize (fw, fh, tr); @@ -102,13 +102,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ImProcFunctions ipf (¶ms, true); PreviewProps pp (0, 0, fw, fh, 1); - imgsrc->preprocess( params.raw, params.lensProf, params.coarse); + imgsrc->preprocess ( params.raw, params.lensProf, params.coarse); if (params.toneCurve.autoexp) {// this enabled HLRecovery - LUTu histRedRaw(256), histGreenRaw(256), histBlueRaw(256); - imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw); + LUTu histRedRaw (256), histGreenRaw (256), histBlueRaw (256); + imgsrc->getRAWHistogram (histRedRaw, histGreenRaw, histBlueRaw); - if (ToneCurveParams::HLReconstructionNecessary(histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { + if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { params.toneCurve.hrenabled = true; // WARNING: Highlight Reconstruction is being forced 'on', should we force a method here too? } @@ -118,13 +118,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p pl->setProgress (0.20); } - imgsrc->demosaic( params.raw); + imgsrc->demosaic ( params.raw); if (pl) { pl->setProgress (0.30); } - if(params.retinex.enabled) { //enabled Retinex + if (params.retinex.enabled) { //enabled Retinex LUTf cdcurve (65536, 0); LUTf mapcurve (65536, 0); LUTu dummy; @@ -133,18 +133,18 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p bool mapcontlutili = false; bool useHsl = false; // multi_array2D conversionBuffer(1, 1); - multi_array2D conversionBuffer(1, 1); - imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); - imgsrc->retinexPrepareCurves(params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy ); + multi_array2D conversionBuffer (1, 1); + imgsrc->retinexPrepareBuffers (params.icm, params.retinex, conversionBuffer, dummy); + imgsrc->retinexPrepareCurves (params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy ); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); + imgsrc->retinex ( params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); } if (pl) { pl->setProgress (0.40); } - imgsrc->HLRecovery_Global( params.toneCurve ); + imgsrc->HLRecovery_Global ( params.toneCurve ); if (pl) { @@ -158,25 +158,25 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p currWB = imgsrc->getWB (); } else if (params.wb.method == "Auto") { double rm, gm, bm; - imgsrc->getAutoWBMultipliers(rm, gm, bm); - currWB.update(rm, gm, bm, params.wb.equal); + imgsrc->getAutoWBMultipliers (rm, gm, bm); + currWB.update (rm, gm, bm, params.wb.equal); } NoiseCurve noiseLCurve; NoiseCurve noiseCCurve; Imagefloat *calclum = NULL ; - params.dirpyrDenoise.getCurves(noiseLCurve, noiseCCurve); + params.dirpyrDenoise.getCurves (noiseLCurve, noiseCCurve); float autoNR = (float) settings->nrauto;// float autoNRmax = (float) settings->nrautomax;// int tilesize; int overlap; - if(settings->leveldnti == 0) { + if (settings->leveldnti == 0) { tilesize = 1024; overlap = 128; } - if(settings->leveldnti == 1) { + if (settings->leveldnti == 1) { tilesize = 768; overlap = 96; } @@ -187,7 +187,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ipf.Tile_calc (tilesize, overlap, 2, fw, fh, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); int nbtl = numtiles_W * numtiles_H; - if((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { + if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { nbtl = 9; } @@ -203,28 +203,28 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p float *pcsk = new float [nbtl]; // printf("expert=%d\n",settings->leveldnautsimpl); - if(settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "PON") { + if (settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "PON") { MyTime t1pone, t2pone; t1pone.set(); int crW, crH; - if(settings->leveldnv == 0) { + if (settings->leveldnv == 0) { crW = 100; crH = 100; } - if(settings->leveldnv == 1) { + if (settings->leveldnv == 1) { crW = 250; crH = 250; } - if(settings->leveldnv == 2) { - crW = int(tileWskip / 2); - crH = int(tileHskip / 2); + if (settings->leveldnv == 2) { + crW = int (tileWskip / 2); + crH = int (tileHskip / 2); } // if(settings->leveldnv ==2) {crW=int(tileWskip/2);crH=int(1.15f*(tileWskip/2));}//adapted to scale of preview - if(settings->leveldnv == 3) { + if (settings->leveldnv == 3) { crW = tileWskip - 10; crH = tileHskip - 10; } @@ -232,7 +232,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p float lowdenoise = 1.f; int levaut = settings->leveldnaut; - if(levaut == 1) { //Standard + if (levaut == 1) { //Standard lowdenoise = 0.7f; } @@ -241,9 +241,9 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // Imagefloat *origCropPart;//init auto noise // origCropPart = new Imagefloat (crW, crH);//allocate memory if (params.dirpyrDenoise.enabled) {//evaluate Noise - LUTf gamcurve(65536, 0); + LUTf gamcurve (65536, 0); float gam, gamthresh, gamslope; - ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); #pragma omp parallel { Imagefloat *origCropPart;//init auto noise @@ -252,23 +252,23 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int skipP = 1; #pragma omp for schedule(dynamic) collapse(2) nowait - for(int wcr = 0; wcr < numtiles_W; wcr++) { - for(int hcr = 0; hcr < numtiles_H; hcr++) { + for (int wcr = 0; wcr < numtiles_W; wcr++) { + for (int hcr = 0; hcr < numtiles_H; hcr++) { int beg_tileW = wcr * tileWskip + tileWskip / 2.f - crW / 2.f; int beg_tileH = hcr * tileHskip + tileHskip / 2.f - crH / 2.f; PreviewProps ppP (beg_tileW , beg_tileH, crW, crH, skipP); imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw ); // we only need image reduced to 1/4 here - for(int ii = 0; ii < crH; ii += 2) { - for(int jj = 0; jj < crW; jj += 2) { - provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); - provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); - provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); + for (int ii = 0; ii < crH; ii += 2) { + for (int jj = 0; jj < crW; jj += 2) { + provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); + provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); + provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); } } - imgsrc->convertColorSpace(provicalc, params.icm, currWB);//for denoise luminance curve + imgsrc->convertColorSpace (provicalc, params.icm, currWB); //for denoise luminance curve float maxr = 0.f; float maxb = 0.f; float pondcorrec = 1.0f; @@ -281,7 +281,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p maxblueaut = 0.f; chromina = 0.f; sigma = 0.f; - ipf.RGB_denoise_info(origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + ipf.RGB_denoise_info (origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); float multip = 1.f; float adjustr = 1.f; @@ -301,27 +301,27 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p adjustr = 1.f / 1.2f; } - if(!imgsrc->isRAW()) { + if (!imgsrc->isRAW()) { multip = 2.f; //take into account gamma for TIF / JPG approximate value...not good fot gamma=1 } - float maxmax = max(maxredaut, maxblueaut); + float maxmax = max (maxredaut, maxblueaut); float delta; int mode = 2; int lissage = settings->leveldnliss; ipf.calcautodn_info (chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); // printf("PROCESS cha=%f red=%f bl=%f redM=%f bluM=%f chrom=%f sigm=%f lum=%f sigL=%f\n",chaut,redaut,blueaut, maxredaut, maxblueaut, chromina, sigma, lumema, sigma_L); - if(maxredaut > maxblueaut) { + if (maxredaut > maxblueaut) { maxr = (delta) / ((autoNRmax * multip * adjustr * lowdenoise) / 2.f); - if(minblueaut <= minredaut && minblueaut < chaut) { + if (minblueaut <= minredaut && minblueaut < chaut) { maxb = (-chaut + minblueaut) / (autoNRmax * multip * adjustr * lowdenoise); } } else { maxb = (delta) / ((autoNRmax * multip * adjustr * lowdenoise) / 2.f); - if(minredaut <= minblueaut && minredaut < chaut) { + if (minredaut <= minblueaut && minredaut < chaut) { maxr = (-chaut + minredaut) / (autoNRmax * multip * adjustr * lowdenoise); } }//maxb mxr - empirical evaluation red / blue @@ -344,45 +344,45 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int liss = settings->leveldnliss; //smooth result around mean - if(liss == 2 || liss == 3) { + if (liss == 2 || liss == 3) { // I smooth only mean and not delta (max) float nchm = 0.f; float koef = 0.4f; //between 0.1 to 0.9 - if(liss == 3) { + if (liss == 3) { koef = 0.0f; //quasi auto for mean Ch } - for(int wcr = 0; wcr < numtiles_W; wcr++) { - for(int hcr = 0; hcr < numtiles_H; hcr++) { + for (int wcr = 0; wcr < numtiles_W; wcr++) { + for (int hcr = 0; hcr < numtiles_H; hcr++) { nchm += ch_M[hcr * numtiles_W + wcr]; } } nchm /= (numtiles_H * numtiles_W); - for(int wcr = 0; wcr < numtiles_W; wcr++) { - for(int hcr = 0; hcr < numtiles_H; hcr++) { + for (int wcr = 0; wcr < numtiles_W; wcr++) { + for (int hcr = 0; hcr < numtiles_H; hcr++) { ch_M[hcr * numtiles_W + wcr] = nchm + (ch_M[hcr * numtiles_W + wcr] - nchm) * koef; } } } - if(liss == 3) { //same as auto but with much cells + if (liss == 3) { //same as auto but with much cells float MaxR = 0.f; float MaxB = 0.f; float MaxRMoy = 0.f; float MaxBMoy = 0.f; - for(int k = 0; k < nbtl; k++) { + for (int k = 0; k < nbtl; k++) { MaxBMoy += max_b[k]; MaxRMoy += max_r[k]; - if(max_r[k] > MaxR) { + if (max_r[k] > MaxR) { MaxR = max_r[k]; } - if(max_b[k] > MaxB) { + if (max_b[k] > MaxB) { MaxB = max_b[k]; } @@ -391,8 +391,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p MaxBMoy /= nbtl; MaxRMoy /= nbtl; - for(int k = 0; k < nbtl; k++) { - if(MaxR > MaxB) { + for (int k = 0; k < nbtl; k++) { + if (MaxR > MaxB) { max_r[k] = MaxRMoy + (MaxR - MaxRMoy) * 0.66f; //#std Dev //max_b[k]=MinB; max_b[k] = MaxBMoy + (MaxB - MaxBMoy) * 0.66f; @@ -408,35 +408,35 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (settings->verbose) { t2pone.set(); - printf("Info denoise ponderated performed in %d usec:\n", t2pone.etime(t1pone)); + printf ("Info denoise ponderated performed in %d usec:\n", t2pone.etime (t1pone)); } } } - if((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { + if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { MyTime t1aue, t2aue; t1aue.set(); int crW, crH; - if(settings->leveldnv == 0) { + if (settings->leveldnv == 0) { crW = 100; crH = 100; } - if(settings->leveldnv == 1) { + if (settings->leveldnv == 1) { crW = 250; crH = 250; } - if(settings->leveldnv == 2) { - crW = int(tileWskip / 2); - crH = int(tileHskip / 2); + if (settings->leveldnv == 2) { + crW = int (tileWskip / 2); + crH = int (tileHskip / 2); } // if(settings->leveldnv ==2) {crW=int(tileWskip/2);crH=int(1.15f*(tileWskip/2));}//adapted to scale of preview - if(settings->leveldnv == 3) { + if (settings->leveldnv == 3) { crW = tileWskip - 10; crH = tileHskip - 10; } @@ -444,14 +444,14 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p float lowdenoise = 1.f; int levaut = settings->leveldnaut; - if(levaut == 1) { //Standard + if (levaut == 1) { //Standard lowdenoise = 0.7f; } if (params.dirpyrDenoise.enabled) {//evaluate Noise - LUTf gamcurve(65536, 0); + LUTf gamcurve (65536, 0); float gam, gamthresh, gamslope; - ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); int Nb[9]; int coordW[3];//coordonate of part of image to mesure noise int coordH[3]; @@ -471,24 +471,24 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p #pragma omp for schedule(dynamic) collapse(2) nowait - for(int wcr = 0; wcr <= 2; wcr++) { - for(int hcr = 0; hcr <= 2; hcr++) { + for (int wcr = 0; wcr <= 2; wcr++) { + for (int hcr = 0; hcr <= 2; hcr++) { PreviewProps ppP (coordW[wcr] , coordH[hcr], crW, crH, 1); imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw); // we only need image reduced to 1/4 here - for(int ii = 0; ii < crH; ii += 2) { - for(int jj = 0; jj < crW; jj += 2) { - provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); - provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); - provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); + for (int ii = 0; ii < crH; ii += 2) { + for (int jj = 0; jj < crW; jj += 2) { + provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); + provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); + provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); } } - imgsrc->convertColorSpace(provicalc, params.icm, currWB);//for denoise luminance curve + imgsrc->convertColorSpace (provicalc, params.icm, currWB); //for denoise luminance curve int nb = 0; float chaut = 0.f, redaut = 0.f, blueaut = 0.f, maxredaut = 0.f, maxblueaut = 0.f, minredaut = 0.f, minblueaut = 0.f, nresi = 0.f, highresi = 0.f, chromina = 0.f, sigma = 0.f, lumema = 0.f, sigma_L = 0.f, redyel = 0.f, skinc = 0.f, nsknc = 0.f; - ipf.RGB_denoise_info(origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + ipf.RGB_denoise_info (origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); Nb[hcr * 3 + wcr] = nb; ch_M[hcr * 3 + wcr] = chaut; max_r[hcr * 3 + wcr] = maxredaut; @@ -540,7 +540,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p adjustr = 1.f / 1.2f; } - if(!imgsrc->isRAW()) { + if (!imgsrc->isRAW()) { multip = 2.f; //take into account gamma for TIF / JPG approximate value...not good fot gamma=1 } @@ -548,17 +548,17 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int mode = 1; int lissage = settings->leveldnliss; - for(int k = 0; k < 9; k++) { - float maxmax = max(max_r[k], max_b[k]); + for (int k = 0; k < 9; k++) { + float maxmax = max (max_r[k], max_b[k]); ipf.calcautodn_info (ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k] ); // printf("ch_M=%f delta=%f\n",ch_M[k], delta[k]); } - for(int k = 0; k < 9; k++) { - if(max_r[k] > max_b[k]) { + for (int k = 0; k < 9; k++) { + if (max_r[k] > max_b[k]) { //printf("R delta=%f koef=%f\n",delta[k],autoNRmax*multip*adjustr*lowdenoise); Max_R[k] = (delta[k]) / ((autoNRmax * multip * adjustr * lowdenoise) / 2.f); - Min_B[k] = -(ch_M[k] - min_b[k]) / (autoNRmax * multip * adjustr * lowdenoise); + Min_B[k] = - (ch_M[k] - min_b[k]) / (autoNRmax * multip * adjustr * lowdenoise); Max_B[k] = 0.f; Min_R[k] = 0.f; } else { @@ -570,7 +570,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } } - for(int k = 0; k < 9; k++) { + for (int k = 0; k < 9; k++) { // printf("ch_M= %f Max_R=%f Max_B=%f min_r=%f min_b=%f\n",ch_M[k],Max_R[k], Max_B[k],Min_R[k], Min_B[k]); chM += ch_M[k]; MaxBMoy += Max_B[k]; @@ -578,19 +578,19 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p MinRMoy += Min_R[k]; MinBMoy += Min_B[k]; - if(Max_R[k] > MaxR) { + if (Max_R[k] > MaxR) { MaxR = Max_R[k]; } - if(Max_B[k] > MaxB) { + if (Max_B[k] > MaxB) { MaxB = Max_B[k]; } - if(Min_R[k] < MinR) { + if (Min_R[k] < MinR) { MinR = Min_R[k]; } - if(Min_B[k] < MinB) { + if (Min_B[k] < MinB) { MinB = Min_B[k]; } @@ -602,7 +602,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p MinBMoy /= 9; MinRMoy /= 9; - if(MaxR > MaxB) { + if (MaxR > MaxB) { maxr = MaxRMoy + (MaxR - MaxRMoy) * 0.66f; //#std Dev // maxb=MinB; maxb = MinBMoy + (MinB - MinBMoy) * 0.66f; @@ -623,7 +623,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (settings->verbose) { t2aue.set(); - printf("Info denoise auto performed in %d usec:\n", t2aue.etime(t1aue)); + printf ("Info denoise auto performed in %d usec:\n", t2aue.etime (t1aue)); } //end evaluate noise @@ -659,7 +659,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // at this stage, we can flush the raw data to free up quite an important amount of memory // commented out because it makes the application crash when batch processing... // TODO: find a better place to flush rawData and rawRGB - if(flush) { + if (flush) { imgsrc->flushRawData(); imgsrc->flushRGB(); } @@ -674,13 +674,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; // make a copy because we cheat here - if(denoiseParams.Lmethod == "CUR") { - if(noiseLCurve) { + if (denoiseParams.Lmethod == "CUR") { + if (noiseLCurve) { denoiseParams.luma = 0.5f; } else { denoiseParams.luma = 0.0f; } - } else if(denoiseParams.Lmethod == "SLI") { + } else if (denoiseParams.Lmethod == "SLI") { noiseLCurve.Reset(); } @@ -689,15 +689,15 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p calclum = new Imagefloat ((fw + 1) / 2, (fh + 1) / 2); //for luminance denoise curve #pragma omp parallel for - for(int ii = 0; ii < fh; ii += 2) { - for(int jj = 0; jj < fw; jj += 2) { - calclum->r(ii >> 1, jj >> 1) = baseImg->r(ii, jj); - calclum->g(ii >> 1, jj >> 1) = baseImg->g(ii, jj); - calclum->b(ii >> 1, jj >> 1) = baseImg->b(ii, jj); + for (int ii = 0; ii < fh; ii += 2) { + for (int jj = 0; jj < fw; jj += 2) { + calclum->r (ii >> 1, jj >> 1) = baseImg->r (ii, jj); + calclum->g (ii >> 1, jj >> 1) = baseImg->g (ii, jj); + calclum->b (ii >> 1, jj >> 1) = baseImg->b (ii, jj); } } - imgsrc->convertColorSpace(calclum, params.icm, currWB); + imgsrc->convertColorSpace (calclum, params.icm, currWB); } if (denoiseParams.enabled) { @@ -706,7 +706,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // ipf.RGB_denoise(baseImg, baseImg, calclum, imgsrc->isRAW(), denoiseParams, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, lldenoiseutili); float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi; int kall = 2; - ipf.RGB_denoise(kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi); + ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi); } @@ -722,7 +722,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p delete [] sk; delete [] pcsk; - imgsrc->convertColorSpace(baseImg, params.icm, currWB); + imgsrc->convertColorSpace (baseImg, params.icm, currWB); // perform first analysis LUTu hist16 (65536); @@ -743,10 +743,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = baseImg->getWidth(); const int H = baseImg->getHeight(); - LabImage labcbdl(W, H); - ipf.rgb2lab(*baseImg, labcbdl, params.icm.working); + LabImage labcbdl (W, H); + ipf.rgb2lab (*baseImg, labcbdl, params.icm.working); ipf.dirpyrequalizer (&labcbdl, 1); - ipf.lab2rgb(labcbdl, *baseImg, params.icm.working); + ipf.lab2rgb (labcbdl, *baseImg, params.icm.working); } // update blurmap @@ -754,7 +754,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (params.sh.enabled) { shmap = new SHMap (fw, fh, true); - double radius = sqrt (double(fw * fw + fh * fh)) / 2.0; + double radius = sqrt (double (fw * fw + fh * fh)) / 2.0; double shradius = params.sh.radius; if (!params.sh.hq) { @@ -771,7 +771,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p LUTf curve (65536, 0); LUTf satcurve (65536, 0); LUTf lhskcurve (65536, 0); - LUTf lumacurve(65536, 0); + LUTf lumacurve (65536, 0); LUTf clcurve (65536, 0); LUTf clToningcurve (65536, 0); LUTf cl2Toningcurve (65536, 0); @@ -812,12 +812,12 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p {wiprof[2][0], wiprof[2][1], wiprof[2][2]} }; bool opautili = false; - params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip, opautili); + params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, wip, opautili); bool clctoningutili = false; - CurveFactory::curveToningCL(clctoningutili, params.colorToning.clcurve, clToningcurve, 1); + CurveFactory::curveToningCL (clctoningutili, params.colorToning.clcurve, clToningcurve, 1); bool llctoningutili = false; - CurveFactory::curveToningLL(llctoningutili, params.colorToning.cl2curve, cl2Toningcurve, 1); + CurveFactory::curveToningLL (llctoningutili, params.colorToning.cl2curve, cl2Toningcurve, 1); LabImage* labView = new LabImage (fw, fh); @@ -825,20 +825,20 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p CurveFactory::curveBW (params.blackwhite.beforeCurve, params.blackwhite.afterCurve, hist16, dummy, customToneCurvebw1, customToneCurvebw2, 1); double rrm, ggm, bbm; float autor, autog, autob; - float satLimit = float(params.colorToning.satProtectionThreshold) / 100.f * 0.7f + 0.3f; - float satLimitOpacity = 1.f - (float(params.colorToning.saturatedOpacity) / 100.f); + float satLimit = float (params.colorToning.satProtectionThreshold) / 100.f * 0.7f + 0.3f; + float satLimitOpacity = 1.f - (float (params.colorToning.saturatedOpacity) / 100.f); - if(params.colorToning.enabled && params.colorToning.autosat) { //for colortoning evaluation of saturation settings + if (params.colorToning.enabled && params.colorToning.autosat) { //for colortoning evaluation of saturation settings float moyS = 0.f; float eqty = 0.f; ipf.moyeqt (baseImg, moyS, eqty);//return image : mean saturation and standard dev of saturation float satp = ((moyS + 1.5f * eqty) - 0.3f) / 0.7f; //1.5 sigma ==> 93% pixels with high saturation -0.3 / 0.7 convert to Hombre scale - if(satp >= 0.92f) { + if (satp >= 0.92f) { satp = 0.92f; //avoid values too high (out of gamut) } - if(satp <= 0.15f) { + if (satp <= 0.15f) { satp = 0.15f; //avoid too low values } @@ -848,11 +848,11 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000) - DCPProfile *dcpProf = imgsrc->getDCP(params.icm, currWB); + DCPProfile *dcpProf = imgsrc->getDCP (params.icm, currWB); ipf.rgbProc (baseImg, labView, NULL, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit , satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf); if (settings->verbose) { - printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob); + printf ("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob); } // if clut was used and size of clut cache == 1 we free the memory used by the clutstore (default clut cache size = 1 for 32 bit OS) @@ -891,7 +891,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p hist16.clear(); hist16C.clear(); - if(params.labCurve.contrast != 0) { //only use hist16 for contrast + if (params.labCurve.contrast != 0) { //only use hist16 for contrast #ifdef _OPENMP #pragma omp parallel shared(hist16,labView, fh, fw) @@ -906,12 +906,12 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p for (int i = 0; i < fh; i++) for (int j = 0; j < fw; j++) { - hist16thr[CLIP((int)((labView->L[i][j])))]++; + hist16thr[CLIP ((int) ((labView->L[i][j])))]++; } #pragma omp critical { - for(int i = 0; i < 65536; i++) + for (int i = 0; i < 65536; i++) { hist16[i] += hist16thr[i]; } @@ -929,7 +929,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p bool clcutili = false; CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, hist16, lumacurve, dummy, 1, utili); - CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, hist16C, dummy, 1); + CurveFactory::curveCL (clcutili, params.labCurve.clcurve, clcurve, hist16C, dummy, 1); CurveFactory::complexsgnCurve (1.f, autili, butili, ccutili, cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, @@ -939,34 +939,34 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); - if((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { - ipf.EPDToneMap(labView, 5, 1); + if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + ipf.EPDToneMap (labView, 5, 1); } - ipf.vibrance(labView); + ipf.vibrance (labView); - if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { ipf.impulsedenoise (labView); } // for all treatments Defringe, Sharpening, Contrast detail ,Microcontrast they are activated if "CIECAM" function are disabled - if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { ipf.defringe (labView); } if (params.sharpenEdge.enabled) { - ipf.MLsharpen(labView); + ipf.MLsharpen (labView); } if (params.sharpenMicro.enabled) { - if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { ipf.MLmicrocontrast (labView); //!params.colorappearance.sharpcie } } - if(((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) { + if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) { float **buffer = new float*[fh]; @@ -990,12 +990,12 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p WavOpacityCurveW waOpacityCurveW; WavOpacityCurveWL waOpacityCurveWL; - params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL ); + params.wavelet.getCurves (wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL ); // directional pyramid wavelet - if(params.dirpyrequalizer.cbdlMethod == "aft") { - if((params.colorappearance.enabled && !settings->autocielab) || !params.colorappearance.enabled) { + if (params.dirpyrequalizer.cbdlMethod == "aft") { + if ((params.colorappearance.enabled && !settings->autocielab) || !params.colorappearance.enabled) { ipf.dirpyrequalizer (labView, 1); //TODO: this is the luminance tonecurve, not the RGB one } } @@ -1003,10 +1003,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int kall = 2; bool wavcontlutili = false; - CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); + CurveFactory::curveWavContL (wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); - if((params.wavelet.enabled)) { - ipf.ip_wavelet(labView, labView, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, wavcontlutili, 1); + if ((params.wavelet.enabled)) { + ipf.ip_wavelet (labView, labView, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, wavcontlutili, 1); } wavCLVCurve.Reset(); @@ -1016,7 +1016,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int f_w = 1, f_h = 1; int begh = 0, endh = fh; - if(params.colorappearance.tonecie || params.colorappearance.enabled) { + if (params.colorappearance.tonecie || params.colorappearance.enabled) { f_w = fw; f_h = fh; } @@ -1035,21 +1035,21 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p customColCurve3, 1); - if(params.colorappearance.enabled) { + if (params.colorappearance.enabled) { double adap; float fnum = imgsrc->getMetaData()->getFNumber ();// F number float fiso = imgsrc->getMetaData()->getISOSpeed () ;// ISO float fspeed = imgsrc->getMetaData()->getShutterSpeed () ;//speed float fcomp = imgsrc->getMetaData()->getExpComp ();//compensation + - - if(fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) { + if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) { adap = 2000.; }//if no exif data or wrong else { float E_V = fcomp + log2 ((fnum * fnum) / fspeed / (fiso / 100.f)); E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV - E_V += log2(params.raw.expos);// exposure raw white point ; log2 ==> linear to EV - adap = powf(2.f, E_V - 3.f); //cd / m2 + E_V += log2 (params.raw.expos); // exposure raw white point ; log2 ==> linear to EV + adap = powf (2.f, E_V - 3.f); //cd / m2 } LUTf CAMBrightCurveJ; @@ -1062,8 +1062,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int sk = 1; - if(settings->ciecamfloat) { - ipf.ciecam_02float (cieView, float(adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, sk, 1); + if (settings->ciecamfloat) { + ipf.ciecam_02float (cieView, float (adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, sk, 1); } else { ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, 1, 1); } @@ -1073,8 +1073,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p double dd; int sk = 1; - if(settings->ciecamfloat) { - ipf.ciecam_02float (cieView, float(adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, sk, 1); + if (settings->ciecamfloat) { + ipf.ciecam_02float (cieView, float (adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, sk, 1); } else { ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, 1, 1); } @@ -1096,7 +1096,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } int imw, imh; - double tmpScale = ipf.resizeScale(¶ms, fw, fh, imw, imh); + double tmpScale = ipf.resizeScale (¶ms, fw, fh, imw, imh); bool labResize = params.resize.enabled && params.resize.method != "Nearest" && tmpScale != 1.0; LabImage *tmplab; @@ -1109,11 +1109,11 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p cw = params.crop.w; ch = params.crop.h; - if(labResize) { // crop lab data - tmplab = new LabImage(cw, ch); + if (labResize) { // crop lab data + tmplab = new LabImage (cw, ch); - for(int row = 0; row < ch; row++) { - for(int col = 0; col < cw; col++) { + for (int row = 0; row < ch; row++) { + for (int col = 0; col < cw; col++) { tmplab->L[row][col] = labView->L[row + cy][col + cx]; tmplab->a[row][col] = labView->a[row + cy][col + cx]; tmplab->b[row][col] = labView->b[row + cy][col + cx]; @@ -1129,16 +1129,16 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (labResize) { // resize lab data // resize image - tmplab = new LabImage(imw, imh); + tmplab = new LabImage (imw, imh); ipf.Lanczos (labView, tmplab, tmpScale); delete labView; labView = tmplab; cw = labView->W; ch = labView->H; - if(params.prsharpening.enabled) { - for(int i = 0; i < ch; i++) - for(int j = 0; j < cw; j++) { + if (params.prsharpening.enabled) { + for (int i = 0; i < ch; i++) + for (int j = 0; j < cw; j++) { labView->L[i][j] = labView->L[i][j] < 0.f ? 0.f : labView->L[i][j]; } @@ -1163,7 +1163,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p bool customGamma = false; bool useLCMS = false; - if(params.icm.gamma != "default" || params.icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8 + 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 cmsToneCurve* GammaTRC[3] = { NULL, NULL, NULL }; @@ -1186,32 +1186,32 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // some of them are actually provided by RT, thanks to Jacques Desmis if (j == 0) { chpro = options.rtSettings.prophoto; - } else if(j == 1) { + } else if (j == 1) { chpro = options.rtSettings.adobe; - } else if(j == 2) { + } else if (j == 2) { chpro = options.rtSettings.widegamut; - } else if(j == 3) { + } else if (j == 3) { chpro = options.rtSettings.beta; - } else if(j == 4) { + } else if (j == 4) { chpro = options.rtSettings.best; - } else if(j == 5) { + } else if (j == 5) { chpro = options.rtSettings.bruce; - } else if(j == 6) { + } else if (j == 6) { chpro = options.rtSettings.srgb; - } else if(j == 7) { + } else if (j == 7) { chpro = options.rtSettings.srgb10; //gamma 1.0 - } else if(j == 8) { + } else if (j == 8) { chpro = options.rtSettings.prophoto10; //gamma 1.0 } for (unsigned int i = 0; i < opnames.size(); i++) { - if(chpro.compare(opnames[i]) == 0) { + if (chpro.compare (opnames[i]) == 0) { present_space[j] = true; } } if (!present_space[j] && settings->verbose) { - printf("Missing file: %s\n", chpro.c_str()); + printf ("Missing file: %s\n", chpro.c_str()); } } @@ -1244,7 +1244,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } else { // Should not occurs if (settings->verbose) { - printf("\"%s\": unknown working profile! - use LCMS2 substitution\n", params.icm.working.c_str() ); + printf ("\"%s\": unknown working profile! - use LCMS2 substitution\n", params.icm.working.c_str() ); } useLCMS = true; @@ -1254,16 +1254,16 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p //"jprof" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile if (!useLCMS) { if (settings->verbose) { - printf("Output Gamma - profile: \"%s\"\n", outProfile.c_str() ); //c_str() + printf ("Output Gamma - profile: \"%s\"\n", outProfile.c_str() ); //c_str() } - jprof = iccStore->getProfile(outProfile); //get output profile + jprof = iccStore->getProfile (outProfile); //get output profile if (jprof == NULL) { useLCMS = true; if (settings->verbose) { - printf("\"%s\" ICC output profile not found!\n", outProfile.c_str()); + printf ("\"%s\" ICC output profile not found!\n", outProfile.c_str()); } } else { Parameters[0] = ga0; @@ -1275,43 +1275,43 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p Parameters[6] = ga6; // 7 parameters for smoother curves //change desc Tag , to "free gamma", or "BT709", etc. - cmsContext ContextID = cmsGetProfileContextID(jprof);//modification TAG - DescriptionMLU = cmsMLUalloc(ContextID, 1); - CopyrightMLU = cmsMLUalloc(ContextID, 1);//for ICC - DmndMLU = cmsMLUalloc(ContextID, 1); //for ICC - DmddMLU = cmsMLUalloc(ContextID, 1); // for ICC + cmsContext ContextID = cmsGetProfileContextID (jprof); //modification TAG + DescriptionMLU = cmsMLUalloc (ContextID, 1); + 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("Description error\n"); + 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 + 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.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"); + 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"); + 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"); + 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"); + 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"); + 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"); + gammaStr = std::wstring (L"GammaTRC: g=2.2"); } else if (params.icm.gamma == "standard_g1.8") { - gammaStr = std::wstring(L"GammaTRC: g=1.8"); + gammaStr = std::wstring (L"GammaTRC: g=1.8"); } - cmsMLUsetWide(DescriptionMLU, "en", "US", gammaStr.c_str()); + 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)"); @@ -1324,21 +1324,21 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } else { // create description with gamma + slope + primaries std::wostringstream gammaWs; - gammaWs.precision(2); + gammaWs.precision (2); gammaWs << "Manual GammaTRC: g=" << (float)params.icm.gampos << " s=" << (float)params.icm.slpos; - cmsMLUsetWide(DescriptionMLU, "en", "US", gammaWs.str().c_str()); + cmsMLUsetWide (DescriptionMLU, "en", "US", gammaWs.str().c_str()); } - cmsWriteTag(jprof, cmsSigProfileDescriptionTag, DescriptionMLU);//desc changed + cmsWriteTag (jprof, cmsSigProfileDescriptionTag, DescriptionMLU); //desc changed // cmsWriteTag(jprof, cmsSigCopyrightTag, CopyrightMLU); // cmsWriteTag(jprof, cmsSigDeviceMfgDescTag, DmndMLU); // cmsWriteTag(jprof, cmsSigDeviceModelDescTag, DmddMLU); // Calculate output profile's rTRC bTRC gTRC - GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, 5, Parameters); - cmsWriteTag(jprof, cmsSigGreenTRCTag, (void*)GammaTRC[1] ); - cmsWriteTag(jprof, cmsSigRedTRCTag, (void*)GammaTRC[0] ); - cmsWriteTag(jprof, cmsSigBlueTRCTag, (void*)GammaTRC[2] ); + GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve (NULL, 5, Parameters); + cmsWriteTag (jprof, cmsSigGreenTRCTag, (void*)GammaTRC[1] ); + cmsWriteTag (jprof, cmsSigRedTRCTag, (void*)GammaTRC[0] ); + cmsWriteTag (jprof, cmsSigBlueTRCTag, (void*)GammaTRC[2] ); //for generation ICC profiles : here Prophoto ==> Large // if(params.icm.gamma== "BT709_g2.2_s4.5") cmsSaveProfileToFile(jprof, "RT_sRGB_gBT709.icm"); // else if (params.icm.gamma== "sRGB_g2.4_s12.92") cmsSaveProfileToFile(jprof, "RT_Medium_gsRGB.icc"); @@ -1349,7 +1349,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } if (GammaTRC[0]) { - cmsFreeToneCurve(GammaTRC[0]); + cmsFreeToneCurve (GammaTRC[0]); } } else { // if Default gamma mode: we use the profile selected in the "Output profile" combobox; @@ -1358,14 +1358,14 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output, params.blackwhite.enabled); bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled ; - if(autili || butili ) { + if (autili || butili ) { bwonly = false; } readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output, params.icm.outputIntent, bwonly); if (settings->verbose) { - printf("Output profile_: \"%s\"\n", params.icm.output.c_str()); + printf ("Output profile_: \"%s\"\n", params.icm.output.c_str()); } } @@ -1374,16 +1374,16 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p - if(!autili && !butili ) { - if(params.blackwhite.enabled && !params.colorToning.enabled ) {//force BW r=g=b + if (!autili && !butili ) { + if (params.blackwhite.enabled && !params.colorToning.enabled ) { //force BW r=g=b if (settings->verbose) { - printf("Force BW\n"); + printf ("Force BW\n"); } for (int ccw = 0; ccw < cw; ccw++) { for (int cch = 0; cch < ch; cch++) { - readyImg->r(cch, ccw) = readyImg->g(cch, ccw); - readyImg->b(cch, ccw) = readyImg->g(cch, ccw); + readyImg->r (cch, ccw) = readyImg->g (cch, ccw); + readyImg->b (cch, ccw) = readyImg->g (cch, ccw); } } } @@ -1411,7 +1411,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (customGamma) { if (!useLCMS) { // use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16b - ProfileContent pc(jprof); + ProfileContent pc (jprof); readyImg->setOutputProfile (pc.data, pc.length); } } else { @@ -1429,15 +1429,15 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p }*/ // if iccStore->getProfile send back an object, then iccStore->getContent will do too - cmsHPROFILE jprof = iccStore->getProfile(outputProfile); //get outProfile + cmsHPROFILE jprof = iccStore->getProfile (outputProfile); //get outProfile if (jprof == NULL) { if (settings->verbose) { - printf("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", outputProfile.c_str()); + printf ("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", outputProfile.c_str()); } } else { if (settings->verbose) { - printf("Using \"%s\" output profile\n", outputProfile.c_str()); + printf ("Using \"%s\" output profile\n", outputProfile.c_str()); } ProfileContent pc = iccStore->getContent (outputProfile); @@ -1487,7 +1487,7 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bo IImage16* img = processImage (currentJob, errorCode, bpl, tunnelMetaData, true); if (errorCode) { - bpl->error (M("MAIN_MSG_CANNOTLOAD")); + bpl->error (M ("MAIN_MSG_CANNOTLOAD")); currentJob = NULL; } else { try { @@ -1506,10 +1506,10 @@ void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl, boo if (bpl) #if __GNUC__ == 4 && __GNUC_MINOR__ == 8 && defined( WIN32 ) && defined(__x86_64__) // See Issue 2384 "Very bad response time on win7/64 using gcc 4.8 when queue is running" - Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); + Glib::Thread::create (sigc::bind (sigc::ptr_fun (batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); #else - Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_LOW); + Glib::Thread::create (sigc::bind (sigc::ptr_fun (batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_LOW); #endif } diff --git a/rtgui/options.cc b/rtgui/options.cc index 5f4895433..869ef8cb8 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -60,7 +60,7 @@ Options::Options () const char *DefaultLanguage = "English (US)"; -inline bool Options::checkProfilePath(Glib::ustring &path) +inline bool Options::checkProfilePath (Glib::ustring &path) { if (path.empty()) { return false; @@ -81,13 +81,13 @@ inline bool Options::checkProfilePath(Glib::ustring &path) } } -bool Options::checkDirPath(Glib::ustring &path, Glib::ustring errString) +bool Options::checkDirPath (Glib::ustring &path, Glib::ustring errString) { if (Glib::file_test (path, Glib::FILE_TEST_EXISTS) && Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) { return true; } else { if (!errString.empty()) { - printf("%s\n", errString.c_str()); + printf ("%s\n", errString.c_str()); } return false; @@ -102,22 +102,22 @@ void Options::updatePaths() userProfilePath = ""; globalProfilePath = ""; - if (Glib::path_is_absolute(profilePath)) { + if (Glib::path_is_absolute (profilePath)) { // absolute path if (!checkDirPath (profilePath, "")) { g_mkdir_with_parents (profilePath.c_str (), 511); if (!checkDirPath (profilePath, "")) { // had problems with mkdir_with_parents return value on OS X, just check dir again - printf("Error: user's profiles' directory \"%s\" creation failed\n", profilePath.c_str()); + printf ("Error: user's profiles' directory \"%s\" creation failed\n", profilePath.c_str()); } } if (checkDirPath (profilePath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { if (multiUser) { userProfilePath = profilePath; - tmpPath = Glib::build_filename(argv0, "profiles"); + tmpPath = Glib::build_filename (argv0, "profiles"); - if(checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { + if (checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { if (userProfilePath != tmpPath) { globalProfilePath = tmpPath; } @@ -126,40 +126,40 @@ void Options::updatePaths() globalProfilePath = profilePath; } } else { - tmpPath = Glib::build_filename(argv0, "profiles"); + tmpPath = Glib::build_filename (argv0, "profiles"); - if(checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { + if (checkDirPath (tmpPath, "Error: the global's profiles' path doesn't point to a directory or doesn't exist!\n")) { globalProfilePath = tmpPath; } } } else { // relative paths if (multiUser) { - tmpPath = Glib::build_filename(rtdir, profilePath); + tmpPath = Glib::build_filename (rtdir, profilePath); if (!checkDirPath (tmpPath, "")) { g_mkdir_with_parents (tmpPath.c_str (), 511); if (!checkDirPath (tmpPath, "")) { - printf("Error: user's profiles' directory \"%s\" creation failed\n", tmpPath.c_str()); + printf ("Error: user's profiles' directory \"%s\" creation failed\n", tmpPath.c_str()); } } - if(checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory!\n")) { + if (checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory!\n")) { userProfilePath = tmpPath; } - tmpPath = Glib::build_filename(argv0, "profiles"); + tmpPath = Glib::build_filename (argv0, "profiles"); - if(checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { + if (checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { globalProfilePath = tmpPath; } } else { // common directory // directory name set in options is ignored, we use the default directory name - tmpPath = Glib::build_filename(argv0, "profiles"); + tmpPath = Glib::build_filename (argv0, "profiles"); - if(checkDirPath (tmpPath, "Error: no global profiles' directory found!\n")) { + if (checkDirPath (tmpPath, "Error: no global profiles' directory found!\n")) { globalProfilePath = tmpPath; } } @@ -236,7 +236,7 @@ Glib::ustring Options::getPreferredProfilePath() *@return Send back the absolute path of the given filename or "Neutral" if "Neutral" has been set to profName. Implementor will have * to test for this particular value. If the absolute path is invalid (e.g. the file doesn't exist), it will return an empty string. */ -Glib::ustring Options::findProfilePath(Glib::ustring &profName) +Glib::ustring Options::findProfilePath (Glib::ustring &profName) { if (profName.empty()) { return ""; @@ -246,41 +246,41 @@ Glib::ustring Options::findProfilePath(Glib::ustring &profName) return profName; } - Glib::ustring p = profName.substr(0, 4); + Glib::ustring p = profName.substr (0, 4); if (p == "${U}") { // the path starts by the User virtual path p = getUserProfilePath(); - Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension); + Glib::ustring fullPath = Glib::build_filename (p, profName.substr (5) + paramFileExtension); if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - return Glib::path_get_dirname(fullPath); + return Glib::path_get_dirname (fullPath); } } else if (p == "${G}") { // the path starts by the User virtual path p = getGlobalProfilePath(); - Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension); + Glib::ustring fullPath = Glib::build_filename (p, profName.substr (5) + paramFileExtension); if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - return Glib::path_get_dirname(fullPath); + return Glib::path_get_dirname (fullPath); } } else { // compatibility case -> convert the path to the new format p = getUserProfilePath(); - Glib::ustring fullPath = Glib::build_filename(p, profName + paramFileExtension); + Glib::ustring fullPath = Glib::build_filename (p, profName + paramFileExtension); if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { // update the profile path - profName = Glib::build_filename("${U}", profName); - return Glib::path_get_dirname(fullPath); + profName = Glib::build_filename ("${U}", profName); + return Glib::path_get_dirname (fullPath); } p = getGlobalProfilePath(); - fullPath = Glib::build_filename(p, profName + paramFileExtension); + fullPath = Glib::build_filename (p, profName + paramFileExtension); if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) { - profName = Glib::build_filename("${G}", profName); - return Glib::path_get_dirname(fullPath); + profName = Glib::build_filename ("${G}", profName); + return Glib::path_get_dirname (fullPath); } } @@ -609,10 +609,10 @@ void Options::setDefaults () rtSettings.darkFramesPath = ""; rtSettings.flatFieldsPath = ""; #ifdef WIN32 - const gchar* sysRoot = g_getenv("SystemRoot"); // Returns e.g. "c:\Windows" + const gchar* sysRoot = g_getenv ("SystemRoot"); // Returns e.g. "c:\Windows" if (sysRoot != NULL) { - rtSettings.iccDirectory = Glib::ustring(sysRoot) + Glib::ustring("\\System32\\spool\\drivers\\color"); + rtSettings.iccDirectory = Glib::ustring (sysRoot) + Glib::ustring ("\\System32\\spool\\drivers\\color"); } else { rtSettings.iccDirectory = "C:\\WINDOWS\\System32\\spool\\drivers\\color"; } @@ -715,17 +715,17 @@ void Options::filterOutParsedExtensions () for (unsigned int i = 0; i < parseExtensions.size(); i++) if (parseExtensionsEnabled[i]) { - parsedExtensions.push_back(parseExtensions[i].lowercase()); + parsedExtensions.push_back (parseExtensions[i].lowercase()); } } int Options::readFromFile (Glib::ustring fname) { - setlocale(LC_NUMERIC, "C"); // to set decimal point to "." + setlocale (LC_NUMERIC, "C"); // to set decimal point to "." Glib::KeyFile keyFile; - if( !Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) { + if ( !Glib::file_test (fname, Glib::FILE_TEST_EXISTS)) { return 1; } @@ -797,52 +797,52 @@ int Options::readFromFile (Glib::ustring fname) useSystemTheme = keyFile.get_boolean ("General", "UseSystemTheme"); } - if( keyFile.has_key ("General", "DarkFramesPath")) { - rtSettings.darkFramesPath = keyFile.get_string("General", "DarkFramesPath"); + 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", "FlatFieldsPath")) { + rtSettings.flatFieldsPath = keyFile.get_string ("General", "FlatFieldsPath"); } - if( keyFile.has_key ("General", "Verbose")) { + if ( keyFile.has_key ("General", "Verbose")) { rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); } if (keyFile.has_key ("General", "BotLeft")) { - rtSettings.bot_left = keyFile.get_double("General", "BotLeft"); + rtSettings.bot_left = keyFile.get_double ("General", "BotLeft"); } if (keyFile.has_key ("General", "TopLeft")) { - rtSettings.top_left = keyFile.get_double("General", "TopLeft"); + rtSettings.top_left = keyFile.get_double ("General", "TopLeft"); } if (keyFile.has_key ("General", "TopRight")) { - rtSettings.top_right = keyFile.get_double("General", "TopRight"); + rtSettings.top_right = keyFile.get_double ("General", "TopRight"); } if (keyFile.has_key ("General", "BotRight")) { - rtSettings.bot_right = keyFile.get_double("General", "BotRight"); + rtSettings.bot_right = keyFile.get_double ("General", "BotRight"); } if (keyFile.has_key ("General", "EDdetec")) { - rtSettings.ed_detec = keyFile.get_double("General", "EDdetec"); + rtSettings.ed_detec = keyFile.get_double ("General", "EDdetec"); } if (keyFile.has_key ("General", "EDdetecStr")) { - rtSettings.ed_detecStr = keyFile.get_double("General", "EDdetecStr"); + rtSettings.ed_detecStr = keyFile.get_double ("General", "EDdetecStr"); } if (keyFile.has_key ("General", "EDLow")) { - rtSettings.ed_low = keyFile.get_double("General", "EDLow"); + rtSettings.ed_low = keyFile.get_double ("General", "EDLow"); } if (keyFile.has_key ("General", "EDLipinfl")) { - rtSettings.ed_lipinfl = keyFile.get_double("General", "EDLipinfl"); + rtSettings.ed_lipinfl = keyFile.get_double ("General", "EDLipinfl"); } if (keyFile.has_key ("General", "EDLipampl")) { - rtSettings.ed_lipampl = keyFile.get_double("General", "EDLipampl"); + rtSettings.ed_lipampl = keyFile.get_double ("General", "EDLipampl"); } @@ -945,19 +945,19 @@ int Options::readFromFile (Glib::ustring fname) } if (keyFile.has_key ("Output", "AutoSuffix")) { - autoSuffix = keyFile.get_boolean("Output", "AutoSuffix"); + autoSuffix = keyFile.get_boolean ("Output", "AutoSuffix"); } if (keyFile.has_key ("Output", "ForceFormatOpts")) { - forceFormatOpts = keyFile.get_boolean("Output", "ForceFormatOpts"); + forceFormatOpts = keyFile.get_boolean ("Output", "ForceFormatOpts"); } if (keyFile.has_key ("Output", "SaveMethodNum")) { - saveMethodNum = keyFile.get_integer("Output", "SaveMethodNum"); + saveMethodNum = keyFile.get_integer ("Output", "SaveMethodNum"); } if (keyFile.has_key ("Output", "UsePathTemplate")) { - saveUsePathTemplate = keyFile.get_boolean("Output", "UsePathTemplate"); + saveUsePathTemplate = keyFile.get_boolean ("Output", "UsePathTemplate"); } if (keyFile.has_key ("Output", "LastSaveAsPath")) { @@ -965,11 +965,11 @@ int Options::readFromFile (Glib::ustring fname) } if (keyFile.has_key ("Output", "OverwriteOutputFile")) { - overwriteOutputFile = keyFile.get_boolean("Output", "OverwriteOutputFile"); + overwriteOutputFile = keyFile.get_boolean ("Output", "OverwriteOutputFile"); } if (keyFile.has_key ("Output", "TunnelMetaData")) { - tunnelMetaData = keyFile.get_boolean("Output", "TunnelMetaData"); + tunnelMetaData = keyFile.get_boolean ("Output", "TunnelMetaData"); } } @@ -1148,7 +1148,7 @@ int Options::readFromFile (Glib::ustring fname) maxRecentFolders = keyFile.get_integer ("File Browser", "MaxRecentFolders"); } - recentFolders.reserve(maxRecentFolders + 10); // reserve some more than maxRecentFolders, because at runtime it stores more than that + recentFolders.reserve (maxRecentFolders + 10); // reserve some more than maxRecentFolders, because at runtime it stores more than that if (keyFile.has_key ("File Browser", "RecentFolders")) { recentFolders = keyFile.get_string_list ("File Browser", "RecentFolders"); @@ -1174,23 +1174,23 @@ int Options::readFromFile (Glib::ustring fname) rgbDenoiseThreadLimit = keyFile.get_integer ("Performance", "RgbDenoiseThreadLimit"); } - if( keyFile.has_key ("Performance", "NRauto")) { + if ( keyFile.has_key ("Performance", "NRauto")) { rtSettings.nrauto = keyFile.get_double ("Performance", "NRauto"); } - if( keyFile.has_key ("Performance", "NRautomax")) { + if ( keyFile.has_key ("Performance", "NRautomax")) { rtSettings.nrautomax = keyFile.get_double ("Performance", "NRautomax"); } - if( keyFile.has_key ("Performance", "NRhigh")) { + if ( keyFile.has_key ("Performance", "NRhigh")) { rtSettings.nrhigh = keyFile.get_double ("Performance", "NRhigh"); } - if(rtSettings.nrhigh == 0.0) { //avoid crash by division by zero in noise reduction + if (rtSettings.nrhigh == 0.0) { //avoid crash by division by zero in noise reduction rtSettings.nrhigh = 0.45; } - if( keyFile.has_key ("Performance", "NRWavlevel")) { + if ( keyFile.has_key ("Performance", "NRWavlevel")) { rtSettings.nrwavlevel = keyFile.get_integer ("Performance", "NRWavlevel"); } @@ -1277,7 +1277,7 @@ int Options::readFromFile (Glib::ustring fname) } if (keyFile.has_key ("GUI", "SortType")) { - dirBrowserSortType = static_cast(keyFile.get_integer ("GUI", "SortType")); + dirBrowserSortType = static_cast (keyFile.get_integer ("GUI", "SortType")); } if (keyFile.has_key ("GUI", "PreferencesWidth")) { @@ -1454,111 +1454,111 @@ int Options::readFromFile (Glib::ustring fname) } if (keyFile.has_key ("Color Management", "Intent")) { - rtSettings.monitorIntent = static_cast(keyFile.get_integer("Color Management", "Intent")); + rtSettings.monitorIntent = static_cast (keyFile.get_integer ("Color Management", "Intent")); } if (keyFile.has_key ("Color Management", "CRI")) { - rtSettings.CRI_color = keyFile.get_integer("Color Management", "CRI"); + rtSettings.CRI_color = keyFile.get_integer ("Color Management", "CRI"); } if (keyFile.has_key ("Color Management", "DenoiseLabgamma")) { - rtSettings.denoiselabgamma = keyFile.get_integer("Color Management", "DenoiseLabgamma"); + rtSettings.denoiselabgamma = keyFile.get_integer ("Color Management", "DenoiseLabgamma"); } if (keyFile.has_key ("Color Management", "view")) { - rtSettings.viewingdevice = keyFile.get_integer("Color Management", "view"); + rtSettings.viewingdevice = keyFile.get_integer ("Color Management", "view"); } if (keyFile.has_key ("Color Management", "grey")) { - rtSettings.viewingdevicegrey = keyFile.get_integer("Color Management", "grey"); + rtSettings.viewingdevicegrey = keyFile.get_integer ("Color Management", "grey"); } if (keyFile.has_key ("Color Management", "greySc")) { - rtSettings.viewinggreySc = keyFile.get_integer("Color Management", "greySc"); + rtSettings.viewinggreySc = keyFile.get_integer ("Color Management", "greySc"); } if (keyFile.has_key ("Color Management", "CBDLArtif")) { - rtSettings.artifact_cbdl = keyFile.get_double("Color Management", "CBDLArtif"); + rtSettings.artifact_cbdl = keyFile.get_double ("Color Management", "CBDLArtif"); } if (keyFile.has_key ("Color Management", "CBDLlevel0")) { - rtSettings.level0_cbdl = keyFile.get_double("Color Management", "CBDLlevel0"); + rtSettings.level0_cbdl = keyFile.get_double ("Color Management", "CBDLlevel0"); } if (keyFile.has_key ("Color Management", "CBDLlevel123")) { - rtSettings.level123_cbdl = keyFile.get_double("Color Management", "CBDLlevel123"); + rtSettings.level123_cbdl = keyFile.get_double ("Color Management", "CBDLlevel123"); } // if (keyFile.has_key ("Color Management", "Colortoningab")) rtSettings.colortoningab = keyFile.get_double("Color Management", "Colortoningab"); // if (keyFile.has_key ("Color Management", "Decaction")) rtSettings.decaction = keyFile.get_double("Color Management", "Decaction"); if (keyFile.has_key ("Color Management", "WhiteBalanceSpotSize")) { - whiteBalanceSpotSize = keyFile.get_integer("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", "GamutICC")) { + rtSettings.gamutICC = keyFile.get_boolean ("Color Management", "GamutICC"); } // if( keyFile.has_key ("Color Management", "BWcomplement")) rtSettings.bw_complementary = keyFile.get_boolean("Color Management", "BWcomplement"); - if( keyFile.has_key ("Color Management", "Ciecamfloat")) { - rtSettings.ciecamfloat = keyFile.get_boolean("Color Management", "Ciecamfloat"); + if ( keyFile.has_key ("Color Management", "Ciecamfloat")) { + rtSettings.ciecamfloat = keyFile.get_boolean ("Color Management", "Ciecamfloat"); } - if( keyFile.has_key ("Color Management", "AdobeRGB")) { - rtSettings.adobe = keyFile.get_string("Color Management", "AdobeRGB"); + 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", "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", "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", "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", "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", "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", "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", "Best")) { + rtSettings.best = keyFile.get_string ("Color Management", "Best"); } - if( keyFile.has_key ("Color Management", "Bruce")) { - rtSettings.bruce = keyFile.get_string("Color Management", "Bruce"); + if ( keyFile.has_key ("Color Management", "Bruce")) { + rtSettings.bruce = keyFile.get_string ("Color Management", "Bruce"); } - if( keyFile.has_key ("Color Management", "GamutLch")) { - rtSettings.gamutLch = keyFile.get_boolean("Color Management", "GamutLch"); + if ( keyFile.has_key ("Color Management", "GamutLch")) { + rtSettings.gamutLch = keyFile.get_boolean ("Color Management", "GamutLch"); } - if( keyFile.has_key ("Color Management", "ProtectRed")) { - rtSettings.protectred = keyFile.get_integer("Color Management", "ProtectRed"); + if ( keyFile.has_key ("Color Management", "ProtectRed")) { + rtSettings.protectred = keyFile.get_integer ("Color Management", "ProtectRed"); } - if( keyFile.has_key ("Color Management", "ProtectRedH")) { - rtSettings.protectredh = keyFile.get_double("Color Management", "ProtectRedH"); + if ( keyFile.has_key ("Color Management", "ProtectRedH")) { + rtSettings.protectredh = keyFile.get_double ("Color Management", "ProtectRedH"); } - if( keyFile.has_key ("Color Management", "Amountchroma")) { - rtSettings.amchroma = keyFile.get_integer("Color Management", "Amountchroma"); + if ( keyFile.has_key ("Color Management", "Amountchroma")) { + rtSettings.amchroma = keyFile.get_integer ("Color Management", "Amountchroma"); } - if( keyFile.has_key ("Color Management", "ClutsDirectory")) { - clutsDir = keyFile.get_string("Color Management", "ClutsDirectory"); + if ( keyFile.has_key ("Color Management", "ClutsDirectory")) { + clutsDir = keyFile.get_string ("Color Management", "ClutsDirectory"); } // if( keyFile.has_key ("Color Management", "Ciebadpixgauss")) rtSettings.ciebadpixgauss = keyFile.get_boolean("Color Management", "Ciebadpixgauss"); @@ -1706,7 +1706,7 @@ int Options::readFromFile (Glib::ustring fname) } if (keyFile.has_key ("Fast Export", "fastexport_icm_output_intent" )) { - fastexport_icm_outputIntent = static_cast(keyFile.get_integer ("Fast Export", "fastexport_icm_output_intent" )); + fastexport_icm_outputIntent = static_cast (keyFile.get_integer ("Fast Export", "fastexport_icm_output_intent" )); } if (keyFile.has_key ("Fast Export", "fastexport_icm_gamma" )) { @@ -1743,21 +1743,21 @@ int Options::readFromFile (Glib::ustring fname) } if (keyFile.has_group ("Dialogs")) { - safeDirGet(keyFile, "Dialogs", "LastIccDir", lastIccDir); - safeDirGet(keyFile, "Dialogs", "LastDarkframeDir", lastDarkframeDir); - safeDirGet(keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir); - safeDirGet(keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastRetinexDir", lastRetinexDir); - safeDirGet(keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastBWCurvesDir", lastBWCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastIccDir", lastIccDir); + safeDirGet (keyFile, "Dialogs", "LastDarkframeDir", lastDarkframeDir); + safeDirGet (keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir); + safeDirGet (keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastRetinexDir", lastRetinexDir); + safeDirGet (keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastBWCurvesDir", lastBWCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastToneCurvesDir", lastToneCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); + safeDirGet (keyFile, "Dialogs", "LastToneCurvesDir", lastToneCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); + safeDirGet (keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); } // -------------------------------------------------------------------------------------------------------- @@ -1769,13 +1769,15 @@ int Options::readFromFile (Glib::ustring fname) } } catch (Glib::Error &err) { if (options.rtSettings.verbose) { - printf("Options::readFromFile / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str()); + printf ("Options::readFromFile / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str()); } + setDefaults (); } catch (...) { if (options.rtSettings.verbose) { - printf("Options::readFromFile / Unknown exception while trying to load \"%s\"!\n", fname.c_str()); + printf ("Options::readFromFile / Unknown exception while trying to load \"%s\"!\n", fname.c_str()); } + setDefaults (); } @@ -1783,8 +1785,8 @@ int Options::readFromFile (Glib::ustring fname) } -bool Options::safeDirGet(const Glib::KeyFile& keyFile, const Glib::ustring& section, - const Glib::ustring& entryName, Glib::ustring& destination) +bool Options::safeDirGet (const Glib::KeyFile& keyFile, const Glib::ustring& section, + const Glib::ustring& entryName, Glib::ustring& destination) { try { @@ -1793,7 +1795,7 @@ bool Options::safeDirGet(const Glib::KeyFile& keyFile, const Glib::ustring& sect return true; } - } catch(Glib::KeyFileError&) {} + } catch (Glib::KeyFileError&) {} return false; } @@ -1805,308 +1807,308 @@ int Options::saveToFile (Glib::ustring fname) try { - Glib::KeyFile keyFile; + Glib::KeyFile keyFile; - keyFile.set_boolean ("General", "TabbedEditor", tabbedUI); - keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit); + keyFile.set_boolean ("General", "TabbedEditor", tabbedUI); + keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit); - if (startupDir == STARTUPDIR_HOME) { - keyFile.set_string ("General", "StartupDirectory", "home"); - } else if (startupDir == STARTUPDIR_CURRENT) { - keyFile.set_string ("General", "StartupDirectory", "current"); - } else if (startupDir == STARTUPDIR_CUSTOM) { - keyFile.set_string ("General", "StartupDirectory", "custom"); - } else if (startupDir == STARTUPDIR_LAST) { - keyFile.set_string ("General", "StartupDirectory", "last"); - } - - keyFile.set_string ("General", "StartupPath", startupPath); - keyFile.set_string ("General", "DateFormat", dateFormat); - keyFile.set_integer ("General", "AdjusterMinDelay", adjusterMinDelay); - keyFile.set_integer ("General", "AdjusterMaxDelay", adjusterMaxDelay); - keyFile.set_boolean ("General", "MultiUser", multiUser); - keyFile.set_string ("General", "Language", language); - keyFile.set_boolean ("General", "LanguageAutoDetect", languageAutoDetect); - keyFile.set_string ("General", "Theme", theme); - keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme); - keyFile.set_string ("General", "Version", VERSION); - keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); - keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); - keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); - keyFile.set_double ("General", "BotLeft", rtSettings.bot_left); - keyFile.set_double ("General", "TopLeft", rtSettings.top_left); - keyFile.set_double ("General", "TopRight", rtSettings.top_right); - keyFile.set_double ("General", "BotRight", rtSettings.bot_right); - keyFile.set_double ("General", "EDdetec", rtSettings.ed_detec); - keyFile.set_double ("General", "EDdetecStr", rtSettings.ed_detecStr); - keyFile.set_double ("General", "EDLow", rtSettings.ed_low); - keyFile.set_double ("General", "EDLipinfl", rtSettings.ed_lipinfl); - keyFile.set_double ("General", "EDLipampl", rtSettings.ed_lipampl); - - - keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); - keyFile.set_string ("External Editor", "GimpDir", gimpDir); - keyFile.set_string ("External Editor", "PhotoshopDir", psDir); - keyFile.set_string ("External Editor", "CustomEditor", customEditorProg); - - keyFile.set_boolean ("File Browser", "BrowseOnlyRaw", fbOnlyRaw); - keyFile.set_boolean ("File Browser", "BrowserShowsDate", fbShowDateTime); - keyFile.set_boolean ("File Browser", "BrowserShowsExif", fbShowBasicExif); - keyFile.set_boolean ("File Browser", "BrowserShowsExpComp", fbShowExpComp); - keyFile.set_boolean ("File Browser", "BrowserShowsHidden", fbShowHidden); - keyFile.set_integer ("File Browser", "ThumbnailSize", thumbSize); - keyFile.set_integer ("File Browser", "ThumbnailSizeTab", thumbSizeTab); - keyFile.set_integer ("File Browser", "ThumbnailSizeQueue", thumbSizeQueue); - keyFile.set_integer ("File Browser", "SameThumbSize", sameThumbSize); - keyFile.set_integer ("File Browser", "MaxPreviewHeight", maxThumbnailHeight); - keyFile.set_integer ("File Browser", "MaxCacheEntries", maxCacheEntries); - Glib::ArrayHandle pext = parseExtensions; - keyFile.set_string_list ("File Browser", "ParseExtensions", pext); - Glib::ArrayHandle pextena = parseExtensionsEnabled; - keyFile.set_integer_list ("File Browser", "ParseExtensionsEnabled", pextena); - keyFile.set_integer ("File Browser", "ThumbnailArrangement", fbArrangement); - keyFile.set_integer ("File Browser", "ThumbnailInterpolation", thumbInterp); - keyFile.set_boolean ("File Browser", "LiveThumbnails", liveThumbnails); - Glib::ArrayHandle pfav = favoriteDirs; - keyFile.set_string_list ("File Browser", "FavoriteDirs", pfav); - Glib::ArrayHandle pren = renameTemplates; - keyFile.set_string_list ("File Browser", "RenameTemplates", pren); - keyFile.set_boolean ("File Browser", "RenameUseTemplates", renameUseTemplates); - Glib::ArrayHandle ptzoom = thumbnailZoomRatios; - keyFile.set_double_list ("File Browser", "ThumbnailZoomRatios", ptzoom); - keyFile.set_boolean ("File Browser", "OverlayedFileNames", overlayedFileNames); - keyFile.set_boolean ("File Browser", "FilmStripOverlayedFileNames", filmStripOverlayedFileNames); - keyFile.set_boolean ("File Browser", "ShowFileNames", showFileNames ); - keyFile.set_boolean ("File Browser", "FilmStripShowFileNames", filmStripShowFileNames ); - keyFile.set_boolean ("File Browser", "InternalThumbIfUntouched", internalThumbIfUntouched ); - keyFile.set_boolean ("File Browser", "menuGroupRank", menuGroupRank); - keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel); - keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations); - keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations); - keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg); - keyFile.set_integer ("File Browser", "MaxRecentFolders", maxRecentFolders); - { - std::vector temp; - temp.reserve(maxRecentFolders); - - for(unsigned int i = 0; i < std::min(recentFolders.size(), maxRecentFolders); i++) { - temp.push_back(recentFolders[i]); + if (startupDir == STARTUPDIR_HOME) { + keyFile.set_string ("General", "StartupDirectory", "home"); + } else if (startupDir == STARTUPDIR_CURRENT) { + keyFile.set_string ("General", "StartupDirectory", "current"); + } else if (startupDir == STARTUPDIR_CUSTOM) { + keyFile.set_string ("General", "StartupDirectory", "custom"); + } else if (startupDir == STARTUPDIR_LAST) { + keyFile.set_string ("General", "StartupDirectory", "last"); } - keyFile.set_string_list ("File Browser", "RecentFolders", temp); - } - keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); - keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); - keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); + keyFile.set_string ("General", "StartupPath", startupPath); + keyFile.set_string ("General", "DateFormat", dateFormat); + keyFile.set_integer ("General", "AdjusterMinDelay", adjusterMinDelay); + keyFile.set_integer ("General", "AdjusterMaxDelay", adjusterMaxDelay); + keyFile.set_boolean ("General", "MultiUser", multiUser); + keyFile.set_string ("General", "Language", language); + keyFile.set_boolean ("General", "LanguageAutoDetect", languageAutoDetect); + keyFile.set_string ("General", "Theme", theme); + keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme); + keyFile.set_string ("General", "Version", VERSION); + keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); + keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath); + keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); + keyFile.set_double ("General", "BotLeft", rtSettings.bot_left); + keyFile.set_double ("General", "TopLeft", rtSettings.top_left); + keyFile.set_double ("General", "TopRight", rtSettings.top_right); + keyFile.set_double ("General", "BotRight", rtSettings.bot_right); + keyFile.set_double ("General", "EDdetec", rtSettings.ed_detec); + keyFile.set_double ("General", "EDdetecStr", rtSettings.ed_detecStr); + keyFile.set_double ("General", "EDLow", rtSettings.ed_low); + keyFile.set_double ("General", "EDLipinfl", rtSettings.ed_lipinfl); + keyFile.set_double ("General", "EDLipampl", rtSettings.ed_lipampl); - keyFile.set_integer ("Performance", "RgbDenoiseThreadLimit", rgbDenoiseThreadLimit); - keyFile.set_double ("Performance", "NRauto", rtSettings.nrauto); - keyFile.set_double ("Performance", "NRautomax", rtSettings.nrautomax); - keyFile.set_double ("Performance", "NRhigh", rtSettings.nrhigh); - keyFile.set_integer ("Performance", "NRWavlevel", rtSettings.nrwavlevel); - keyFile.set_integer ("Performance", "LevNR", rtSettings.leveldnv); - keyFile.set_integer ("Performance", "LevNRTI", rtSettings.leveldnti); - keyFile.set_integer ("Performance", "LevNRAUT", rtSettings.leveldnaut); - keyFile.set_integer ("Performance", "LevNRLISS", rtSettings.leveldnliss); - keyFile.set_integer ("Performance", "SIMPLNRAUT", rtSettings.leveldnautsimpl); - keyFile.set_integer ("Performance", "ClutCacheSize", clutCacheSize); - keyFile.set_integer ("Performance", "MaxInspectorBuffers", maxInspectorBuffers); - keyFile.set_integer ("Performance", "PreviewDemosaicFromSidecar", prevdemo); - keyFile.set_boolean ("Performance", "Daubechies", rtSettings.daubech); - keyFile.set_boolean ("Performance", "SerializeTiffRead", serializeTiffRead); - keyFile.set_string ("Output", "Format", saveFormat.format); - keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); - keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); - keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); - keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); - keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); - keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); + keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); + keyFile.set_string ("External Editor", "GimpDir", gimpDir); + keyFile.set_string ("External Editor", "PhotoshopDir", psDir); + keyFile.set_string ("External Editor", "CustomEditor", customEditorProg); - keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format); - keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality); - keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression); - keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits); - keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits); - keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed); - keyFile.set_boolean ("Output", "SaveProcParamsBatch", saveFormatBatch.saveParams); + keyFile.set_boolean ("File Browser", "BrowseOnlyRaw", fbOnlyRaw); + keyFile.set_boolean ("File Browser", "BrowserShowsDate", fbShowDateTime); + keyFile.set_boolean ("File Browser", "BrowserShowsExif", fbShowBasicExif); + keyFile.set_boolean ("File Browser", "BrowserShowsExpComp", fbShowExpComp); + keyFile.set_boolean ("File Browser", "BrowserShowsHidden", fbShowHidden); + keyFile.set_integer ("File Browser", "ThumbnailSize", thumbSize); + keyFile.set_integer ("File Browser", "ThumbnailSizeTab", thumbSizeTab); + keyFile.set_integer ("File Browser", "ThumbnailSizeQueue", thumbSizeQueue); + keyFile.set_integer ("File Browser", "SameThumbSize", sameThumbSize); + keyFile.set_integer ("File Browser", "MaxPreviewHeight", maxThumbnailHeight); + keyFile.set_integer ("File Browser", "MaxCacheEntries", maxCacheEntries); + Glib::ArrayHandle pext = parseExtensions; + keyFile.set_string_list ("File Browser", "ParseExtensions", pext); + Glib::ArrayHandle pextena = parseExtensionsEnabled; + keyFile.set_integer_list ("File Browser", "ParseExtensionsEnabled", pextena); + keyFile.set_integer ("File Browser", "ThumbnailArrangement", fbArrangement); + keyFile.set_integer ("File Browser", "ThumbnailInterpolation", thumbInterp); + keyFile.set_boolean ("File Browser", "LiveThumbnails", liveThumbnails); + Glib::ArrayHandle pfav = favoriteDirs; + keyFile.set_string_list ("File Browser", "FavoriteDirs", pfav); + Glib::ArrayHandle pren = renameTemplates; + keyFile.set_string_list ("File Browser", "RenameTemplates", pren); + keyFile.set_boolean ("File Browser", "RenameUseTemplates", renameUseTemplates); + Glib::ArrayHandle ptzoom = thumbnailZoomRatios; + keyFile.set_double_list ("File Browser", "ThumbnailZoomRatios", ptzoom); + keyFile.set_boolean ("File Browser", "OverlayedFileNames", overlayedFileNames); + keyFile.set_boolean ("File Browser", "FilmStripOverlayedFileNames", filmStripOverlayedFileNames); + keyFile.set_boolean ("File Browser", "ShowFileNames", showFileNames ); + keyFile.set_boolean ("File Browser", "FilmStripShowFileNames", filmStripShowFileNames ); + keyFile.set_boolean ("File Browser", "InternalThumbIfUntouched", internalThumbIfUntouched ); + keyFile.set_boolean ("File Browser", "menuGroupRank", menuGroupRank); + keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel); + keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations); + keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations); + keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg); + keyFile.set_integer ("File Browser", "MaxRecentFolders", maxRecentFolders); + { + std::vector temp; + temp.reserve (maxRecentFolders); - keyFile.set_string ("Output", "PathTemplate", savePathTemplate); - keyFile.set_string ("Output", "PathFolder", savePathFolder); - keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix); - keyFile.set_boolean ("Output", "ForceFormatOpts", forceFormatOpts); - keyFile.set_integer ("Output", "SaveMethodNum", saveMethodNum); - keyFile.set_boolean ("Output", "UsePathTemplate", saveUsePathTemplate); - keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath); - keyFile.set_boolean ("Output", "OverwriteOutputFile", overwriteOutputFile); - keyFile.set_boolean ("Output", "TunnelMetaData", tunnelMetaData); + for (unsigned int i = 0; i < std::min (recentFolders.size(), maxRecentFolders); i++) { + temp.push_back (recentFolders[i]); + } - keyFile.set_string ("Profiles", "Directory", profilePath); - keyFile.set_boolean ("Profiles", "UseBundledProfiles", useBundledProfiles); - keyFile.set_string ("Profiles", "LoadSaveProfilePath", loadSaveProfilePath); - keyFile.set_string ("Profiles", "RawDefault", defProfRaw); - keyFile.set_string ("Profiles", "ImgDefault", defProfImg); - keyFile.set_boolean ("Profiles", "FilledProfile", filledProfile); - keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); - keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); - keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); - keyFile.set_string ("Profiles", "CustomProfileBuilderPath", CPBPath); - keyFile.set_integer ("Profiles", "CustomProfileBuilderKeys", CPBKeys); + keyFile.set_string_list ("File Browser", "RecentFolders", temp); + } + keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); + keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); + keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); - keyFile.set_string ("GUI", "Font", font); - keyFile.set_integer ("GUI", "WindowWidth", windowWidth); - keyFile.set_integer ("GUI", "WindowHeight", windowHeight); - keyFile.set_integer ("GUI", "WindowX", windowX); - keyFile.set_integer ("GUI", "WindowY", windowY); - keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); - keyFile.set_integer ("GUI", "DetailWindowWidth", detailWindowWidth); - keyFile.set_integer ("GUI", "DetailWindowHeight", detailWindowHeight); - keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); - keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); - keyFile.set_integer ("GUI", "SortType", dirBrowserSortType); - keyFile.set_integer ("GUI", "PreferencesWidth", preferencesWidth); - keyFile.set_integer ("GUI", "PreferencesHeight", preferencesHeight); - keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth); - keyFile.set_integer ("GUI", "SaveAsDialogHeight", saveAsDialogHeight); - keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth); - keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth); - keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight); - keyFile.set_boolean ("GUI", "BrowserToolPanelOpened", browserToolPanelOpened); - keyFile.set_boolean ("GUI", "EditorFilmStripOpened", editorFilmStripOpened); - keyFile.set_boolean ("GUI", "BrowserDirPanelOpened", browserDirPanelOpened); - keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth); - keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); - keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor); - keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan); - keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); - keyFile.set_boolean ("GUI", "ShowHistory", showHistory); - keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); - keyFile.set_boolean ("GUI", "ShowInfo", showInfo); - keyFile.set_boolean ("GUI", "MainNBVertical", mainNBVertical); - keyFile.set_boolean ("GUI", "ShowClippedHighlights", showClippedHighlights); - keyFile.set_boolean ("GUI", "ShowClippedShadows", showClippedShadows); - keyFile.set_integer ("GUI", "FrameColor", bgcolor); - keyFile.set_boolean ("GUI", "ProcessingQueueEnbled", procQueueEnabled); - Glib::ArrayHandle tpopen = tpOpen; - keyFile.set_integer_list ("GUI", "ToolPanelsExpanded", tpopen); - keyFile.set_integer ("GUI", "MultiDisplayMode", multiDisplayMode); - keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); - keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); - keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); - keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); - keyFile.set_boolean ("GUI", "HistogramFullMode", histogramFullMode); - keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar); - keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow); - keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar); - keyFile.set_boolean ("GUI", "UseIconNoText", UseIconNoText); - keyFile.set_boolean ("GUI", "HistogramWorking", rtSettings.HistogramWorking); - keyFile.set_integer ("GUI", "CurveBBoxPosition", curvebboxpos); + keyFile.set_integer ("Performance", "RgbDenoiseThreadLimit", rgbDenoiseThreadLimit); + keyFile.set_double ("Performance", "NRauto", rtSettings.nrauto); + keyFile.set_double ("Performance", "NRautomax", rtSettings.nrautomax); + keyFile.set_double ("Performance", "NRhigh", rtSettings.nrhigh); + keyFile.set_integer ("Performance", "NRWavlevel", rtSettings.nrwavlevel); + keyFile.set_integer ("Performance", "LevNR", rtSettings.leveldnv); + keyFile.set_integer ("Performance", "LevNRTI", rtSettings.leveldnti); + keyFile.set_integer ("Performance", "LevNRAUT", rtSettings.leveldnaut); + keyFile.set_integer ("Performance", "LevNRLISS", rtSettings.leveldnliss); + keyFile.set_integer ("Performance", "SIMPLNRAUT", rtSettings.leveldnautsimpl); + keyFile.set_integer ("Performance", "ClutCacheSize", clutCacheSize); + keyFile.set_integer ("Performance", "MaxInspectorBuffers", maxInspectorBuffers); + keyFile.set_integer ("Performance", "PreviewDemosaicFromSidecar", prevdemo); + keyFile.set_boolean ("Performance", "Daubechies", rtSettings.daubech); + keyFile.set_boolean ("Performance", "SerializeTiffRead", serializeTiffRead); - //Glib::ArrayHandle crvopen = crvOpen; - //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); + keyFile.set_string ("Output", "Format", saveFormat.format); + keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); + keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); + keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); + keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); + keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); + keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); + keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); - keyFile.set_integer ("Crop Settings", "PPI", cropPPI); + keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format); + keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality); + keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp); + keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression); + keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits); + keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits); + keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed); + keyFile.set_boolean ("Output", "SaveProcParamsBatch", saveFormatBatch.saveParams); - 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_boolean ("Color Management", "Autocielab", rtSettings.autocielab); - keyFile.set_boolean ("Color Management", "RGBcurvesLumamode_Gamut", rtSettings.rgbcurveslumamode_gamut); - keyFile.set_integer ("Color Management", "Intent", rtSettings.monitorIntent); - keyFile.set_integer ("Color Management", "view", rtSettings.viewingdevice); - keyFile.set_integer ("Color Management", "grey", rtSettings.viewingdevicegrey); - keyFile.set_integer ("Color Management", "greySc", rtSettings.viewinggreySc); + keyFile.set_string ("Output", "PathTemplate", savePathTemplate); + keyFile.set_string ("Output", "PathFolder", savePathFolder); + keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix); + keyFile.set_boolean ("Output", "ForceFormatOpts", forceFormatOpts); + keyFile.set_integer ("Output", "SaveMethodNum", saveMethodNum); + keyFile.set_boolean ("Output", "UsePathTemplate", saveUsePathTemplate); + keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath); + keyFile.set_boolean ("Output", "OverwriteOutputFile", overwriteOutputFile); + keyFile.set_boolean ("Output", "TunnelMetaData", tunnelMetaData); - 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); + keyFile.set_string ("Profiles", "Directory", profilePath); + keyFile.set_boolean ("Profiles", "UseBundledProfiles", useBundledProfiles); + keyFile.set_string ("Profiles", "LoadSaveProfilePath", loadSaveProfilePath); + keyFile.set_string ("Profiles", "RawDefault", defProfRaw); + keyFile.set_string ("Profiles", "ImgDefault", defProfImg); + keyFile.set_boolean ("Profiles", "FilledProfile", filledProfile); + keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); + keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); + keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); + keyFile.set_string ("Profiles", "CustomProfileBuilderPath", CPBPath); + keyFile.set_integer ("Profiles", "CustomProfileBuilderKeys", CPBKeys); + + keyFile.set_string ("GUI", "Font", font); + keyFile.set_integer ("GUI", "WindowWidth", windowWidth); + keyFile.set_integer ("GUI", "WindowHeight", windowHeight); + keyFile.set_integer ("GUI", "WindowX", windowX); + keyFile.set_integer ("GUI", "WindowY", windowY); + keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); + keyFile.set_integer ("GUI", "DetailWindowWidth", detailWindowWidth); + keyFile.set_integer ("GUI", "DetailWindowHeight", detailWindowHeight); + keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); + keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); + keyFile.set_integer ("GUI", "SortType", dirBrowserSortType); + keyFile.set_integer ("GUI", "PreferencesWidth", preferencesWidth); + keyFile.set_integer ("GUI", "PreferencesHeight", preferencesHeight); + keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth); + keyFile.set_integer ("GUI", "SaveAsDialogHeight", saveAsDialogHeight); + keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth); + keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth); + keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight); + keyFile.set_boolean ("GUI", "BrowserToolPanelOpened", browserToolPanelOpened); + keyFile.set_boolean ("GUI", "EditorFilmStripOpened", editorFilmStripOpened); + keyFile.set_boolean ("GUI", "BrowserDirPanelOpened", browserDirPanelOpened); + keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth); + keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); + keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor); + keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan); + keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); + keyFile.set_boolean ("GUI", "ShowHistory", showHistory); + keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); + keyFile.set_boolean ("GUI", "ShowInfo", showInfo); + keyFile.set_boolean ("GUI", "MainNBVertical", mainNBVertical); + keyFile.set_boolean ("GUI", "ShowClippedHighlights", showClippedHighlights); + keyFile.set_boolean ("GUI", "ShowClippedShadows", showClippedShadows); + keyFile.set_integer ("GUI", "FrameColor", bgcolor); + keyFile.set_boolean ("GUI", "ProcessingQueueEnbled", procQueueEnabled); + Glib::ArrayHandle tpopen = tpOpen; + keyFile.set_integer_list ("GUI", "ToolPanelsExpanded", tpopen); + keyFile.set_integer ("GUI", "MultiDisplayMode", multiDisplayMode); + keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); + keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); + keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); + keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); + keyFile.set_boolean ("GUI", "HistogramFullMode", histogramFullMode); + keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar); + keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow); + keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar); + keyFile.set_boolean ("GUI", "UseIconNoText", UseIconNoText); + keyFile.set_boolean ("GUI", "HistogramWorking", rtSettings.HistogramWorking); + keyFile.set_integer ("GUI", "CurveBBoxPosition", curvebboxpos); + + //Glib::ArrayHandle crvopen = crvOpen; + //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); + + keyFile.set_integer ("Crop Settings", "PPI", cropPPI); + + 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_boolean ("Color Management", "Autocielab", rtSettings.autocielab); + keyFile.set_boolean ("Color Management", "RGBcurvesLumamode_Gamut", rtSettings.rgbcurveslumamode_gamut); + keyFile.set_integer ("Color Management", "Intent", rtSettings.monitorIntent); + keyFile.set_integer ("Color Management", "view", rtSettings.viewingdevice); + keyFile.set_integer ("Color Management", "grey", rtSettings.viewingdevicegrey); + keyFile.set_integer ("Color Management", "greySc", rtSettings.viewinggreySc); + + 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); // keyFile.set_boolean ("Color Management", "BWcomplement", rtSettings.bw_complementary); - keyFile.set_boolean ("Color Management", "Ciecamfloat", rtSettings.ciecamfloat); - keyFile.set_boolean ("Color Management", "GamutLch", rtSettings.gamutLch); - keyFile.set_integer ("Color Management", "ProtectRed", rtSettings.protectred); - keyFile.set_integer ("Color Management", "Amountchroma", rtSettings.amchroma); - keyFile.set_double ("Color Management", "ProtectRedH", rtSettings.protectredh); - keyFile.set_integer ("Color Management", "CRI", rtSettings.CRI_color); - keyFile.set_integer ("Color Management", "DenoiseLabgamma", rtSettings.denoiselabgamma); + keyFile.set_boolean ("Color Management", "Ciecamfloat", rtSettings.ciecamfloat); + keyFile.set_boolean ("Color Management", "GamutLch", rtSettings.gamutLch); + keyFile.set_integer ("Color Management", "ProtectRed", rtSettings.protectred); + keyFile.set_integer ("Color Management", "Amountchroma", rtSettings.amchroma); + keyFile.set_double ("Color Management", "ProtectRedH", rtSettings.protectredh); + keyFile.set_integer ("Color Management", "CRI", rtSettings.CRI_color); + keyFile.set_integer ("Color Management", "DenoiseLabgamma", rtSettings.denoiselabgamma); // keyFile.set_boolean ("Color Management", "Ciebadpixgauss", rtSettings.ciebadpixgauss); - keyFile.set_double ("Color Management", "CBDLArtif", rtSettings.artifact_cbdl); - keyFile.set_double ("Color Management", "CBDLlevel0", rtSettings.level0_cbdl); - keyFile.set_double ("Color Management", "CBDLlevel123", rtSettings.level123_cbdl); + keyFile.set_double ("Color Management", "CBDLArtif", rtSettings.artifact_cbdl); + keyFile.set_double ("Color Management", "CBDLlevel0", rtSettings.level0_cbdl); + keyFile.set_double ("Color Management", "CBDLlevel123", rtSettings.level123_cbdl); // keyFile.set_double ("Color Management", "Colortoningab", rtSettings.colortoningab); // keyFile.set_double ("Color Management", "Decaction", rtSettings.decaction); - keyFile.set_string ("Color Management", "ClutsDirectory", clutsDir); + keyFile.set_string ("Color Management", "ClutsDirectory", clutsDir); - Glib::ArrayHandle bab = baBehav; - keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); + Glib::ArrayHandle bab = baBehav; + keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); - keyFile.set_boolean ("Sounds", "Enable", sndEnable); - keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone); - keyFile.set_string ("Sounds", "LngEditProcDone", sndLngEditProcDone); - keyFile.set_double ("Sounds", "LngEditProcDoneSecs", sndLngEditProcDoneSecs); + keyFile.set_boolean ("Sounds", "Enable", sndEnable); + keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone); + keyFile.set_string ("Sounds", "LngEditProcDone", sndLngEditProcDone); + keyFile.set_double ("Sounds", "LngEditProcDoneSecs", sndLngEditProcDoneSecs); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpening" , fastexport_bypass_sharpening ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenEdge" , fastexport_bypass_sharpenEdge ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenMicro" , fastexport_bypass_sharpenMicro ); - //keyFile.set_boolean ("Fast Export", "fastexport_bypass_lumaDenoise" , fastexport_bypass_lumaDenoise ); - //keyFile.set_boolean ("Fast Export", "fastexport_bypass_colorDenoise" , fastexport_bypass_colorDenoise ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_defringe" , fastexport_bypass_defringe ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrDenoise" , fastexport_bypass_dirpyrDenoise ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_sh_hq" , fastexport_bypass_sh_hq ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrequalizer" , fastexport_bypass_dirpyrequalizer ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_wavelet" , fastexport_bypass_wavelet ); - keyFile.set_string ("Fast Export", "fastexport_raw_bayer_method" , fastexport_raw_bayer_method ); - //keyFile.set_boolean ("Fast Export", "fastexport_bypass_bayer_raw_all_enhance" , fastexport_bypass_raw_bayer_all_enhance ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations" , fastexport_bypass_raw_bayer_dcb_iterations ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance" , fastexport_bypass_raw_bayer_dcb_enhance ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations", fastexport_bypass_raw_bayer_lmmse_iterations); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_linenoise" , fastexport_bypass_raw_bayer_linenoise ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh" , fastexport_bypass_raw_bayer_greenthresh ); - keyFile.set_string ("Fast Export", "fastexport_raw_xtrans_method" , fastexport_raw_xtrans_method ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ccSteps" , fastexport_bypass_raw_ccSteps ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ca" , fastexport_bypass_raw_ca ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_df" , fastexport_bypass_raw_df ); - keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ff" , fastexport_bypass_raw_ff ); - keyFile.set_string ("Fast Export", "fastexport_icm_input" , fastexport_icm_input ); - keyFile.set_string ("Fast Export", "fastexport_icm_working" , fastexport_icm_working ); - keyFile.set_string ("Fast Export", "fastexport_icm_output" , fastexport_icm_output ); - keyFile.set_integer ("Fast Export", "fastexport_icm_output_intent" , fastexport_icm_outputIntent ); - keyFile.set_string ("Fast Export", "fastexport_icm_gamma" , fastexport_icm_gamma ); - keyFile.set_boolean ("Fast Export", "fastexport_resize_enabled" , fastexport_resize_enabled ); - keyFile.set_double ("Fast Export", "fastexport_resize_scale" , fastexport_resize_scale ); - keyFile.set_string ("Fast Export", "fastexport_resize_appliesTo" , fastexport_resize_appliesTo ); - keyFile.set_string ("Fast Export", "fastexport_resize_method" , fastexport_resize_method ); - keyFile.set_integer ("Fast Export", "fastexport_resize_dataspec" , fastexport_resize_dataspec ); - keyFile.set_integer ("Fast Export", "fastexport_resize_width" , fastexport_resize_width ); - keyFile.set_integer ("Fast Export", "fastexport_resize_height" , fastexport_resize_height ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpening" , fastexport_bypass_sharpening ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenEdge" , fastexport_bypass_sharpenEdge ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sharpenMicro" , fastexport_bypass_sharpenMicro ); + //keyFile.set_boolean ("Fast Export", "fastexport_bypass_lumaDenoise" , fastexport_bypass_lumaDenoise ); + //keyFile.set_boolean ("Fast Export", "fastexport_bypass_colorDenoise" , fastexport_bypass_colorDenoise ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_defringe" , fastexport_bypass_defringe ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrDenoise" , fastexport_bypass_dirpyrDenoise ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_sh_hq" , fastexport_bypass_sh_hq ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_dirpyrequalizer" , fastexport_bypass_dirpyrequalizer ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_wavelet" , fastexport_bypass_wavelet ); + keyFile.set_string ("Fast Export", "fastexport_raw_bayer_method" , fastexport_raw_bayer_method ); + //keyFile.set_boolean ("Fast Export", "fastexport_bypass_bayer_raw_all_enhance" , fastexport_bypass_raw_bayer_all_enhance ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_iterations" , fastexport_bypass_raw_bayer_dcb_iterations ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_dcb_enhance" , fastexport_bypass_raw_bayer_dcb_enhance ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_lmmse_iterations", fastexport_bypass_raw_bayer_lmmse_iterations); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_linenoise" , fastexport_bypass_raw_bayer_linenoise ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_bayer_greenthresh" , fastexport_bypass_raw_bayer_greenthresh ); + keyFile.set_string ("Fast Export", "fastexport_raw_xtrans_method" , fastexport_raw_xtrans_method ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ccSteps" , fastexport_bypass_raw_ccSteps ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ca" , fastexport_bypass_raw_ca ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_df" , fastexport_bypass_raw_df ); + keyFile.set_boolean ("Fast Export", "fastexport_bypass_raw_ff" , fastexport_bypass_raw_ff ); + keyFile.set_string ("Fast Export", "fastexport_icm_input" , fastexport_icm_input ); + keyFile.set_string ("Fast Export", "fastexport_icm_working" , fastexport_icm_working ); + keyFile.set_string ("Fast Export", "fastexport_icm_output" , fastexport_icm_output ); + keyFile.set_integer ("Fast Export", "fastexport_icm_output_intent" , fastexport_icm_outputIntent ); + keyFile.set_string ("Fast Export", "fastexport_icm_gamma" , fastexport_icm_gamma ); + keyFile.set_boolean ("Fast Export", "fastexport_resize_enabled" , fastexport_resize_enabled ); + keyFile.set_double ("Fast Export", "fastexport_resize_scale" , fastexport_resize_scale ); + keyFile.set_string ("Fast Export", "fastexport_resize_appliesTo" , fastexport_resize_appliesTo ); + keyFile.set_string ("Fast Export", "fastexport_resize_method" , fastexport_resize_method ); + keyFile.set_integer ("Fast Export", "fastexport_resize_dataspec" , fastexport_resize_dataspec ); + keyFile.set_integer ("Fast Export", "fastexport_resize_width" , fastexport_resize_width ); + keyFile.set_integer ("Fast Export", "fastexport_resize_height" , fastexport_resize_height ); - keyFile.set_string ("Dialogs", "LastIccDir", lastIccDir); - keyFile.set_string ("Dialogs", "LastDarkframeDir", lastDarkframeDir); - keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir); - keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); - keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir); - keyFile.set_string ("Dialogs", "LastRetinexDir", lastRetinexDir); - keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); - keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); - keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir); - keyFile.set_string ("Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); - keyFile.set_string ("Dialogs", "LastBWCurvesDir", lastBWCurvesDir); - keyFile.set_string ("Dialogs", "LastToneCurvesDir", lastToneCurvesDir); - keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); - keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); + keyFile.set_string ("Dialogs", "LastIccDir", lastIccDir); + keyFile.set_string ("Dialogs", "LastDarkframeDir", lastDarkframeDir); + keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir); + keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); + keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir); + keyFile.set_string ("Dialogs", "LastRetinexDir", lastRetinexDir); + keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); + keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); + keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir); + keyFile.set_string ("Dialogs", "LastHsvCurvesDir", lastHsvCurvesDir); + keyFile.set_string ("Dialogs", "LastBWCurvesDir", lastBWCurvesDir); + keyFile.set_string ("Dialogs", "LastToneCurvesDir", lastToneCurvesDir); + keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); + keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); - keyData = keyFile.to_data (); + keyData = keyFile.to_data (); } catch (Glib::KeyFileError&) {} @@ -2118,7 +2120,7 @@ int Options::saveToFile (Glib::ustring fname) if (f == NULL) { if (options.rtSettings.verbose) { - printf("Options::saveToFile / Error: unable to open file \"%s\" with write access!\n", fname.c_str()); + printf ("Options::saveToFile / Error: unable to open file \"%s\" with write access!\n", fname.c_str()); } return 1; @@ -2137,12 +2139,12 @@ bool Options::load () const gchar* path; Glib::ustring dPath; - path = g_getenv("RT_SETTINGS"); + path = g_getenv ("RT_SETTINGS"); if (path != NULL) { - rtdir = Glib::ustring(path); + rtdir = Glib::ustring (path); - if (!Glib::path_is_absolute(rtdir)) { + if (!Glib::path_is_absolute (rtdir)) { return false; } } else { @@ -2150,42 +2152,42 @@ bool Options::load () WCHAR pathW[MAX_PATH] = {0}; char pathA[MAX_PATH]; - if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_LOCAL_APPDATA, false)) { - WideCharToMultiByte(CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0); - rtdir = Glib::build_filename(Glib::ustring(pathA), Glib::ustring(CACHEFOLDERNAME)); + if (SHGetSpecialFolderPathW (NULL, pathW, CSIDL_LOCAL_APPDATA, false)) { + WideCharToMultiByte (CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0); + rtdir = Glib::build_filename (Glib::ustring (pathA), Glib::ustring (CACHEFOLDERNAME)); } #else - rtdir = Glib::build_filename(Glib::ustring(g_get_user_config_dir ()), Glib::ustring(CACHEFOLDERNAME)); + rtdir = Glib::build_filename (Glib::ustring (g_get_user_config_dir ()), Glib::ustring (CACHEFOLDERNAME)); #endif } if (options.rtSettings.verbose) { - printf("Settings directory (rtdir) = %s\n", rtdir.c_str()); + printf ("Settings directory (rtdir) = %s\n", rtdir.c_str()); } // Set the cache folder in RT's base folder - cacheBaseDir = Glib::build_filename(argv0, "cache"); + cacheBaseDir = Glib::build_filename (argv0, "cache"); // Read the global option file (the one located in the application's base folder) - options.readFromFile (Glib::build_filename(argv0, "options")); + options.readFromFile (Glib::build_filename (argv0, "options")); // Modify the path of the cache folder to the one provided in RT_CACHE environment variable - path = g_getenv("RT_CACHE"); + path = g_getenv ("RT_CACHE"); if (path != NULL) { - cacheBaseDir = Glib::ustring(path); + cacheBaseDir = Glib::ustring (path); - if (!Glib::path_is_absolute(cacheBaseDir)) { + if (!Glib::path_is_absolute (cacheBaseDir)) { return false; } } // No environment variable provided, so falling back to the multi user mode, is enabled else if (options.multiUser) { #ifdef WIN32 - cacheBaseDir = Glib::build_filename(rtdir, "cache"); + cacheBaseDir = Glib::build_filename (rtdir, "cache"); #else - cacheBaseDir = Glib::build_filename(Glib::ustring(g_get_user_cache_dir()), Glib::ustring(CACHEFOLDERNAME)); + cacheBaseDir = Glib::build_filename (Glib::ustring (g_get_user_cache_dir()), Glib::ustring (CACHEFOLDERNAME)); #endif } @@ -2193,12 +2195,12 @@ bool Options::load () if (options.multiUser) { // Read the user option file (the one located somewhere in the user's home folder) // Those values supersets those of the global option file - int r = options.readFromFile (Glib::build_filename(rtdir, "options")); + int r = options.readFromFile (Glib::build_filename (rtdir, "options")); // If the local option file does not exist or is broken, and the local cache folder does not exist, recreate it if (r && !g_mkdir_with_parents (rtdir.c_str (), 511)) { // Save the option file - options.saveToFile (Glib::build_filename(rtdir, "options")); + options.saveToFile (Glib::build_filename (rtdir, "options")); } #ifdef __APPLE__ @@ -2208,7 +2210,7 @@ bool Options::load () } if (options.rtSettings.verbose) { - printf("Cache directory (cacheBaseDir) = %s\n", cacheBaseDir.c_str()); + printf ("Cache directory (cacheBaseDir) = %s\n", cacheBaseDir.c_str()); } // Update profile's path and recreate it if necessary @@ -2218,15 +2220,15 @@ bool Options::load () if (options.defProfRaw.empty()) { options.defProfRaw = DEFPROFILE_INTERNAL; } else { - Glib::ustring tmpFName = options.findProfilePath(options.defProfRaw); + Glib::ustring tmpFName = options.findProfilePath (options.defProfRaw); if (!tmpFName.empty()) { if (options.rtSettings.verbose) { - printf("Raws' default profile \"%s\" found\n", options.defProfRaw.c_str()); + printf ("Raws' default profile \"%s\" found\n", options.defProfRaw.c_str()); } } else { if (options.rtSettings.verbose) { - printf("Raws' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfRaw.c_str()); + printf ("Raws' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfRaw.c_str()); } options.defProfRaw = DEFPROFILE_INTERNAL; @@ -2237,15 +2239,15 @@ bool Options::load () if (options.defProfImg.empty()) { options.defProfImg = DEFPROFILE_INTERNAL; } else { - Glib::ustring tmpFName = options.findProfilePath(options.defProfImg); + Glib::ustring tmpFName = options.findProfilePath (options.defProfImg); if (!tmpFName.empty()) { if (options.rtSettings.verbose) { - printf("Images' default profile \"%s\" found\n", options.defProfImg.c_str()); + printf ("Images' default profile \"%s\" found\n", options.defProfImg.c_str()); } } else { if (options.rtSettings.verbose) { - printf("Images' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfImg.c_str()); + printf ("Images' default profile \"%s\" not found or not set -> using Internal values\n", options.defProfImg.c_str()); } options.defProfImg = DEFPROFILE_INTERNAL; @@ -2277,10 +2279,10 @@ bool Options::load () } if (!options.language.empty()) { - std::vector langPortions = Glib::Regex::split_simple(" ", options.language); + std::vector langPortions = Glib::Regex::split_simple (" ", options.language); if (langPortions.size() >= 1) { - languageTranslation = argv0 + "/languages/" + langPortions.at(0); + languageTranslation = argv0 + "/languages/" + langPortions.at (0); } if (langPortions.size() >= 2) { @@ -2288,7 +2290,7 @@ bool Options::load () } } - langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation))); + langMgr.load (localeTranslation, new MultiLangMgr (languageTranslation, new MultiLangMgr (defaultTranslation))); rtengine::init (&options.rtSettings, argv0, rtdir); @@ -2299,9 +2301,9 @@ void Options::save () { if (options.multiUser == false) { - options.saveToFile (Glib::build_filename(argv0, "options")); + options.saveToFile (Glib::build_filename (argv0, "options")); } else { - options.saveToFile (Glib::build_filename(rtdir, "options")); + options.saveToFile (Glib::build_filename (rtdir, "options")); } } @@ -2311,7 +2313,7 @@ void Options::save () bool Options::has_retained_extention (Glib::ustring fname) { - Glib::ustring ext = getExtension(fname).lowercase(); + Glib::ustring ext = getExtension (fname).lowercase(); if (!ext.empty()) { // there is an extension to the filename