Merge pull request #5483 from Beep6581/whitespace

Whitespace cleanup
This commit is contained in:
Beep6581 2019-10-07 08:21:59 +02:00 committed by GitHub
commit 710f6c089d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 2085 additions and 2097 deletions

View File

@ -640,11 +640,11 @@ spinbutton entry {
} }
spinbutton button { spinbutton button {
margin: 0; margin: 0;
padding: 0; padding: 0;
border-radius: 0; border-radius: 0;
} }
spinbutton button.up { spinbutton button.up {
border-radius: 0 0.16666666666666666666em 0.16666666666666666666em 0; border-radius: 0 0.16666666666666666666em 0.16666666666666666666em 0;
} }
entry:disabled, spinbutton:disabled { entry:disabled, spinbutton:disabled {
@ -841,7 +841,7 @@ flowboxchild:selected {
color: #CCCCCC; color: #CCCCCC;
padding: 0; padding: 0;
margin: 0 0.25em 0 0.25em; margin: 0 0.25em 0 0.25em;
font-size: 1.1em; font-size: 1.1em;
} }
#MyExpanderTitle:hover { #MyExpanderTitle:hover {
background-color: #202020; background-color: #202020;
@ -955,7 +955,7 @@ fontchooser scrolledwindow,
} }
#PlacesPaned { #PlacesPaned {
margin: 0; margin: 0;
padding: 0 0.4166666666666666em 0 0; padding: 0 0.4166666666666666em 0 0;
} }
#PlacesPaned > box:nth-child(1) scrolledwindow + grid { #PlacesPaned > box:nth-child(1) scrolledwindow + grid {
@ -1050,7 +1050,7 @@ dialog frame > label:not(.dummy) {
#LabelRightNotebook { #LabelRightNotebook {
padding: 0.4166666666666666em; padding: 0.4166666666666666em;
margin: 0.1666666666666666em; margin: 0.1666666666666666em;
font-size: 1.25em; font-size: 1.25em;
} }
#ToolPanelNotebook { #ToolPanelNotebook {

View File

@ -46,7 +46,7 @@ GtkBox {
border-style: none; border-style: none;
border-radius: 0; border-radius: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
GtkGrid { GtkGrid {

View File

@ -98,16 +98,6 @@ set(RTENGINESOURCEFILES
ipwavelet.cc ipwavelet.cc
jdatasrc.cc jdatasrc.cc
jpeg_ijg/jpeg_memsrc.cc jpeg_ijg/jpeg_memsrc.cc
klt/convolve.cc
klt/error.cc
klt/klt_util.cc
klt/klt.cc
klt/pnmio.cc
klt/pyramid.cc
klt/selectGoodFeatures.cc
klt/storeFeatures.cc
klt/trackFeatures.cc
klt/writeFeatures.cc
labimage.cc labimage.cc
lcp.cc lcp.cc
lj92.c lj92.c

View File

@ -145,8 +145,8 @@ void Ciecam02::curveJfloat (float br, float contr, const LUTu & histogram, LUTf
} }
outCurve *= 32767.f; outCurve *= 32767.f;
//printf("out500=%f out15000=%f\n", outCurve[500], outCurve[15000]); //printf("out500=%f out15000=%f\n", outCurve[500], outCurve[15000]);
//outCurve.dump("brig"); //outCurve.dump("brig");
} }
/** /**

View File

@ -1070,12 +1070,11 @@ public:
*/ */
static inline double gamma2 (double x) // g3 1+g4 static inline double gamma2 (double x) // g3 1+g4
{ {
// return x <= 0.003041 ? x * 12.92310 : 1.055 * exp(log(x) / 2.39990) - 0.055;//calculate with calcgamma // return x <= 0.003041 ? x * 12.92310 : 1.055 * exp(log(x) / 2.39990) - 0.055;//calculate with calcgamma
//return x <= 0.0031308 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//standard discontinuous //return x <= 0.0031308 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//standard discontinuous
//very small differences between the 2 //very small differences between the 2
return x <= 0.003040 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//continuous return x <= 0.003040 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//continuous
// return x <= 0.003041 ? x * 12.92310 : 1.055011 * exp(log(x) / sRGBGammaCurve) - 0.055011;//continuous // return x <= 0.003041 ? x * 12.92310 : 1.055011 * exp(log(x) / sRGBGammaCurve) - 0.055011;//continuous
} }
@ -1087,12 +1086,11 @@ public:
*/ */
static inline double igamma2 (double x) //g2 static inline double igamma2 (double x) //g2
{ {
// return x <= 0.039289 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * 2.39990);//calculate with calcgamma // return x <= 0.039289 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * 2.39990);//calculate with calcgamma
// return x <= 0.04045 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//standard discontinuous // return x <= 0.04045 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//standard discontinuous
//very small differences between the 4 //very small differences between the 4
return x <= 0.039286 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//continuous return x <= 0.039286 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//continuous
// return x <= 0.039293 ? x / 12.92310 : exp(log((x + 0.055011) / 1.055011) * sRGBGammaCurve);//continuous // return x <= 0.039293 ? x / 12.92310 : exp(log((x + 0.055011) / 1.055011) * sRGBGammaCurve);//continuous
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ add_library(rtexif STATIC
olympusattribs.cc olympusattribs.cc
panasonicattribs.cc panasonicattribs.cc
pentaxattribs.cc pentaxattribs.cc
rtexif.cc rtexif.cc
sonyminoltaattribs.cc sonyminoltaattribs.cc
stdattribs.cc stdattribs.cc
) )

View File

@ -142,7 +142,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea)
case (RTO_Left2Right): case (RTO_Left2Right):
for (int py = 0; py < h; ++py) { for (int py = 0; py < h; ++py) {
for (int px = 0; px < w; ++px) { for (int px = 0; px < w; ++px) {
unsigned char *pixel = surfaceData + (py * w + px) * 4; unsigned char *pixel = surfaceData + (py * w + px) * 4;
double x_ = double( px); double x_ = double( px);
//double y_ = double((h-1)-py); unused //double y_ = double((h-1)-py); unused
double x01 = x_ / double(w - 1); double x01 = x_ / double(w - 1);
@ -158,7 +158,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea)
case (RTO_Right2Left): case (RTO_Right2Left):
for (int py = 0; py < h; ++py) { for (int py = 0; py < h; ++py) {
for (int px = 0; px < w; ++px) { for (int px = 0; px < w; ++px) {
unsigned char *pixel = surfaceData + (py * w + px) * 4; unsigned char *pixel = surfaceData + (py * w + px) * 4;
//double x_ = double((w-1)-px); unused //double x_ = double((w-1)-px); unused
//double y_ = double((h-1)-py); unused //double y_ = double((h-1)-py); unused
double x01 = double(px) / double(w - 1); double x01 = double(px) / double(w - 1);
@ -174,7 +174,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea)
case (RTO_Bottom2Top): case (RTO_Bottom2Top):
for (int py = 0; py < h; ++py) { for (int py = 0; py < h; ++py) {
for (int px = 0; px < w; ++px) { for (int px = 0; px < w; ++px) {
unsigned char *pixel = surfaceData + (py * w + px) * 4; unsigned char *pixel = surfaceData + (py * w + px) * 4;
//double x_ = double((w-1)-px); unused //double x_ = double((w-1)-px); unused
//double y_ = double((h-1)-py); unused //double y_ = double((h-1)-py); unused
double x01 = double(px) / double(w - 1); double x01 = double(px) / double(w - 1);
@ -191,7 +191,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea)
default: default:
for (int py = 0; py < h; ++py) { for (int py = 0; py < h; ++py) {
for (int px = 0; px < w; ++px) { for (int px = 0; px < w; ++px) {
unsigned char *pixel = surfaceData + (py * w + px) * 4; unsigned char *pixel = surfaceData + (py * w + px) * 4;
double x_ = double( px); double x_ = double( px);
double y_ = double( py); double y_ = double( py);
double x01 = x_ / double(w - 1); double x01 = x_ / double(w - 1);

View File

@ -529,13 +529,13 @@ int main (int argc, char **argv)
int ret = 0; int ret = 0;
if (options.pseudoHiDPISupport) { if (options.pseudoHiDPISupport) {
// Reading/updating GDK_SCALE early if it exists // Reading/updating GDK_SCALE early if it exists
const gchar *gscale = g_getenv("GDK_SCALE"); const gchar *gscale = g_getenv("GDK_SCALE");
if (gscale && gscale[0] == '2') { if (gscale && gscale[0] == '2') {
initialGdkScale = 2; initialGdkScale = 2;
} }
// HOMBRE: On Windows, if resolution is set to 200%, Gtk internal variables are SCALE=2 and DPI=96 // HOMBRE: On Windows, if resolution is set to 200%, Gtk internal variables are SCALE=2 and DPI=96
g_setenv("GDK_SCALE", "1", true); g_setenv("GDK_SCALE", "1", true);
} }
gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave))); gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave)));

View File

@ -1258,7 +1258,7 @@ void Options::readFromFile(Glib::ustring fname)
} }
if (keyFile.has_key("GUI", "PseudoHiDPISupport")) { if (keyFile.has_key("GUI", "PseudoHiDPISupport")) {
pseudoHiDPISupport = keyFile.get_boolean("GUI", "PseudoHiDPISupport"); pseudoHiDPISupport = keyFile.get_boolean("GUI", "PseudoHiDPISupport");
} }
if (keyFile.has_key("GUI", "LastPreviewScale")) { if (keyFile.has_key("GUI", "LastPreviewScale")) {

View File

@ -37,9 +37,9 @@ Gtk::TextDirection RTScalable::direction = Gtk::TextDirection::TEXT_DIR_NONE;
void RTScalable::setDPInScale (const double newDPI, const int newScale) void RTScalable::setDPInScale (const double newDPI, const int newScale)
{ {
if (!options.pseudoHiDPISupport) { if (!options.pseudoHiDPISupport) {
scale = 1; scale = 1;
dpi = baseDPI; dpi = baseDPI;
return; return;
} }
if (scale != newScale || (scale == 1 && dpi != newDPI)) { if (scale != newScale || (scale == 1 && dpi != newDPI)) {

View File

@ -168,7 +168,7 @@ RTWindow::RTWindow ()
#endif #endif
//GTK318 //GTK318
if (options.pseudoHiDPISupport) { if (options.pseudoHiDPISupport) {
fontScale = options.fontSize / (float)RTScalable::baseFontSize; fontScale = options.fontSize / (float)RTScalable::baseFontSize;
} }
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {
printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale); printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale);
@ -196,7 +196,7 @@ RTWindow::RTWindow ()
pt = fontSize / Pango::SCALE; pt = fontSize / Pango::SCALE;
} }
if (options.pseudoHiDPISupport) { if (options.pseudoHiDPISupport) {
fontScale = (float)pt / (float)RTScalable::baseFontSize; fontScale = (float)pt / (float)RTScalable::baseFontSize;
} }
if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) { if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) {
css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale); css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale);

View File

@ -1,293 +1,293 @@
#region Usings #region Usings
using System; using System;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Globalization; using System.Globalization;
using System.Diagnostics; using System.Diagnostics;
using System.Configuration; using System.Configuration;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
#endregion #endregion
// *** Raw Therapee sample Custom Profile builder (version 2013-08-12) *** // *** Raw Therapee sample Custom Profile builder (version 2013-08-12) ***
// //
// //
// WARNING: The command line parameters has changed since this file has been created by Oduis. The new mechanism involves a // WARNING: The command line parameters has changed since this file has been created by Oduis. The new mechanism involves a
// temporary communication file (.ini style) to provide system parameters and metadata read by RawTherapee. This script has // temporary communication file (.ini style) to provide system parameters and metadata read by RawTherapee. This script has
// to be updated by some C# developer in order to work. // to be updated by some C# developer in order to work.
// //
// //
// WARNING: PP3 format may change in the future versions! If this happens there will probably be no automatic migration path, // WARNING: PP3 format may change in the future versions! If this happens there will probably be no automatic migration path,
// you'll have to adjust on your own. This is a sample, and therefore not supported by the RT team (just by oduis) // you'll have to adjust on your own. This is a sample, and therefore not supported by the RT team (just by oduis)
// //
// //
// How to use: // How to use:
// 1. Modify the GetCorrectedSettings function below according to your needs. // 1. Modify the GetCorrectedSettings function below according to your needs.
// 2. Download and install Microsoft .Net Runtime (latest version is 4.0 as of writing), if it's not already on your machine. // 2. Download and install Microsoft .Net Runtime (latest version is 4.0 as of writing), if it's not already on your machine.
// You can get it for free via Windows Update or from microsoft.com. No need for Visual Studio etc. // You can get it for free via Windows Update or from microsoft.com. No need for Visual Studio etc.
// 3. Open a command line and compile this CS-File using the C# 32bit compiler. It is usually installed somewhere here: // 3. Open a command line and compile this CS-File using the C# 32bit compiler. It is usually installed somewhere here:
// C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe // C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
// Call csc.exe (C#-Compiler) with your .CS file as parameter like this (one big line): // Call csc.exe (C#-Compiler) with your .CS file as parameter like this (one big line):
// //
// C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc // C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc
// /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll // /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll
// /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll // /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll
// RTProfileBuilderSample.cs // RTProfileBuilderSample.cs
// //
// (On most machines it already works with "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc RTProfileBuilderSample.cs") // (On most machines it already works with "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc RTProfileBuilderSample.cs")
// CSC will compile it and emit an EXE. // CSC will compile it and emit an EXE.
// 4. Open your RT options files and find the entry [Profiles]/CustomProfileBuilder // 4. Open your RT options files and find the entry [Profiles]/CustomProfileBuilder
// 5. Enter the path to your newly built exe here. On Windows, don't forget double slashes (e.g. "C:\\MyDir\\Mybuilder.exe") // 5. Enter the path to your newly built exe here. On Windows, don't forget double slashes (e.g. "C:\\MyDir\\Mybuilder.exe")
// And you're done! The EXE is only called on opening the image editor and there is no PP3 already // And you're done! The EXE is only called on opening the image editor and there is no PP3 already
// //
// If you want to use EXIFTOOL to gather more details information to build queries: // If you want to use EXIFTOOL to gather more details information to build queries:
// 1. Download exiftool.exe from http://www.sno.phy.queensu.ca/~phil/exiftool/ // 1. Download exiftool.exe from http://www.sno.phy.queensu.ca/~phil/exiftool/
// 2. Rename it to exiftool.exe (NOT exiftool(-k).. or something!) // 2. Rename it to exiftool.exe (NOT exiftool(-k).. or something!)
// 3. Copy the RTProfilerBuilder.exe.config next to your own EXE. If you renamed it, rename config to "(Yourname).exe.config" // 3. Copy the RTProfilerBuilder.exe.config next to your own EXE. If you renamed it, rename config to "(Yourname).exe.config"
// 4. Open the config with notepad (it's an XML file). Set ExifToolPath to your downloaded and renamed exe // 4. Open the config with notepad (it's an XML file). Set ExifToolPath to your downloaded and renamed exe
// //
// If you want to know what parameters are available, call "exiftool.exe <raw file name> -tab -short" // If you want to know what parameters are available, call "exiftool.exe <raw file name> -tab -short"
// //
// This description is for Windows. The C# code does not use anything fancy, will probably work with MONO on Linux/OSX, too // This description is for Windows. The C# code does not use anything fancy, will probably work with MONO on Linux/OSX, too
namespace RTProfilerBuilder { namespace RTProfilerBuilder {
/// <summary>Main class. Mostly change GetCorrectedSettings.</summary> /// <summary>Main class. Mostly change GetCorrectedSettings.</summary>
class RTProfileBuilder { class RTProfileBuilder {
/// <summary>Adds the Nikkor zoom distortion correction profile. /// <summary>Adds the Nikkor zoom distortion correction profile.
/// First array is list of focal lengths, second array is the RT setting that should correct the /// First array is list of focal lengths, second array is the RT setting that should correct the
/// distortion for the corresponding focal length. Values between these values are automatically interpolated. /// distortion for the corresponding focal length. Values between these values are automatically interpolated.
/// The focal length values must already be ordered. The number of sample points is not limited.</summary> /// The focal length values must already be ordered. The number of sample points is not limited.</summary>
static DistortionCorrectProf distNikkor24120f4 = new DistortionCorrectProf( static DistortionCorrectProf distNikkor24120f4 = new DistortionCorrectProf(
new double[] { 24, 28, 35, 50, 70, 85, 120 }, new double[] { 24, 28, 35, 50, 70, 85, 120 },
new double[] { -0.1, -0.063, -0.012, 0.018, 0.034, 0.04, 0.048 } new double[] { -0.1, -0.063, -0.012, 0.018, 0.034, 0.04, 0.048 }
); );
/// <summary>This is your personalisation function</summary> /// <summary>This is your personalisation function</summary>
/// <param name="exif">Full EXIF from EXIFTOOL (if configured).</param> /// <param name="exif">Full EXIF from EXIFTOOL (if configured).</param>
/// <param name="sectionEntry">Entry, like "Sharpening/Radius"</param> /// <param name="sectionEntry">Entry, like "Sharpening/Radius"</param>
/// <param name="value">Current value (from default file)</param> /// <param name="value">Current value (from default file)</param>
/// <param name="fNumber">FNumber</param><param name="exposureSecs">Exposure in seconds</param> /// <param name="fNumber">FNumber</param><param name="exposureSecs">Exposure in seconds</param>
/// <param name="focalLength">Focal length in MM</param><param name="iso">ISO value</param> /// <param name="focalLength">Focal length in MM</param><param name="iso">ISO value</param>
/// <param name="lens">Lens from EXIF</param><param name="camera">Camera from EXIF</param> /// <param name="lens">Lens from EXIF</param><param name="camera">Camera from EXIF</param>
/// <returns>The value to be written. Simply take the current value if you have nothing to touch.</returns> /// <returns>The value to be written. Simply take the current value if you have nothing to touch.</returns>
static string GetCorrectedSetting(NameValueCollection exif, string sectionEntry, string value, static string GetCorrectedSetting(NameValueCollection exif, string sectionEntry, string value,
double fNumber, double exposureSecs, double focalLength, long iso, string lens, string camera) { double fNumber, double exposureSecs, double focalLength, long iso, string lens, string camera) {
string s; string s;
// We don't do anything to the value if it's not our camera // We don't do anything to the value if it's not our camera
if (camera.EndsWith("NIKON D700", StringComparison.InvariantCultureIgnoreCase) && lens.Contains("24.0-120.0 mm f/4.0")) { if (camera.EndsWith("NIKON D700", StringComparison.InvariantCultureIgnoreCase) && lens.Contains("24.0-120.0 mm f/4.0")) {
switch (sectionEntry) { switch (sectionEntry) {
// Here is the place to adjust your settings // Here is the place to adjust your settings
// Pretty simple: "SectionName/EntryName" in options file // Pretty simple: "SectionName/EntryName" in options file
case "Vignetting Correction/Amount": case "Vignetting Correction/Amount":
value = (fNumber < 8 && focalLength < 30) ? "30" : "0"; value = (fNumber < 8 && focalLength < 30) ? "30" : "0";
break; break;
case "RAW/CA": case "RAW/CA":
value = ToBool(fNumber < 11); // Means "Enabled if fnumber<11, otherwise disabled" value = ToBool(fNumber < 11); // Means "Enabled if fnumber<11, otherwise disabled"
break; break;
case "Impulse Denoising/Enabled": case "Impulse Denoising/Enabled":
value = ToBool(iso >= 3200); value = ToBool(iso >= 3200);
break; break;
case "HLRecovery/Enabled": case "HLRecovery/Enabled":
value = ToBool(iso >= 1600); // Dynamic range decreases, so we'll probably need it value = ToBool(iso >= 1600); // Dynamic range decreases, so we'll probably need it
break; break;
case "Color Boost/Amount": case "Color Boost/Amount":
if (iso >= 6400) value = "0"; // Colors will get poppy anyway... if (iso >= 6400) value = "0"; // Colors will get poppy anyway...
break; break;
case "Distortion/Amount": case "Distortion/Amount":
// we already checked in the IF upstairs that this is "our" lens // we already checked in the IF upstairs that this is "our" lens
value = distNikkor24120f4.GetDistortionAmount(focalLength); value = distNikkor24120f4.GetDistortionAmount(focalLength);
break; break;
// Add other parameters here. Mention this is case sensitive! // Add other parameters here. Mention this is case sensitive!
default: break; // we don't touch values we don't care about default: break; // we don't touch values we don't care about
} }
} // end if camera=xxx } // end if camera=xxx
// This is for camera independent settings // This is for camera independent settings
switch (sectionEntry) { switch (sectionEntry) {
// These are parsed from EXIFTOOL and XMP in DNG (see http://en.wikipedia.org/wiki/Extensible_Metadata_Platform) // These are parsed from EXIFTOOL and XMP in DNG (see http://en.wikipedia.org/wiki/Extensible_Metadata_Platform)
case "IPTC/City": case "IPTC/City":
s = exif.Get("City"); s = exif.Get("City");
if (!String.IsNullOrEmpty(s)) value = s; if (!String.IsNullOrEmpty(s)) value = s;
break; break;
case "IPTC/Country": case "IPTC/Country":
s = exif.Get("Country"); s = exif.Get("Country");
if (!String.IsNullOrEmpty(s)) value = s; if (!String.IsNullOrEmpty(s)) value = s;
break; break;
case "IPTC/Caption": case "IPTC/Caption":
case "IPTC/Title": case "IPTC/Title":
s = exif.Get("Headline"); s = exif.Get("Headline");
if (!String.IsNullOrEmpty(s)) value = s; if (!String.IsNullOrEmpty(s)) value = s;
break; break;
// Add other parameters here. Mention this is case sensitive! // Add other parameters here. Mention this is case sensitive!
default: break; // we don't touch values we don't care about default: break; // we don't touch values we don't care about
} }
return value; return value;
} }
#region * Main and Helpers #region * Main and Helpers
static string ToBool(bool condition) { return condition ? "true" : "false"; } static string ToBool(bool condition) { return condition ? "true" : "false"; }
static string ToFloat(float f) { return f.ToString(CultureInfo.InvariantCulture); } static string ToFloat(float f) { return f.ToString(CultureInfo.InvariantCulture); }
/// <summary>Reads default file and parses it. No need to touch it for your personal settings.</summary> /// <summary>Reads default file and parses it. No need to touch it for your personal settings.</summary>
/// <param name="args">Command line args</param> /// <param name="args">Command line args</param>
/// <return>0 on all OK.</return> /// <return>0 on all OK.</return>
static int Main(string[] args) { static int Main(string[] args) {
int exitCode = 0; int exitCode = 0;
try { try {
#region Parse input parameters #region Parse input parameters
int argNo = 0; int argNo = 0;
// Name of raw/JPG to process // Name of raw/JPG to process
string sourceFile = args[argNo++]; string sourceFile = args[argNo++];
// What the user selected as his base profile // What the user selected as his base profile
string defaultProfileFilePath = args[argNo++]; string defaultProfileFilePath = args[argNo++];
// Cache directory, for any logging file // Cache directory, for any logging file
string cachePath = args[argNo++]; string cachePath = args[argNo++];
// True if the image is only being flagged as inTrash, rank or colorLabel but still need valid PP3 - actually not used by this script // True if the image is only being flagged as inTrash, rank or colorLabel but still need valid PP3 - actually not used by this script
bool forFlaggingPurpose = bool.Parse(args[argNo++], CultureInfo.InvariantCulture); bool forFlaggingPurpose = bool.Parse(args[argNo++], CultureInfo.InvariantCulture);
// Note that old C++ has no automatic number globalization // Note that old C++ has no automatic number globalization
double fNumber = double.Parse(args[argNo++], CultureInfo.InvariantCulture); double fNumber = double.Parse(args[argNo++], CultureInfo.InvariantCulture);
double exposureSecs = double.Parse(args[argNo++], CultureInfo.InvariantCulture); double exposureSecs = double.Parse(args[argNo++], CultureInfo.InvariantCulture);
double focalLength = double.Parse(args[argNo++], CultureInfo.InvariantCulture); double focalLength = double.Parse(args[argNo++], CultureInfo.InvariantCulture);
long iso = long.Parse(args[argNo++], CultureInfo.InvariantCulture); long iso = long.Parse(args[argNo++], CultureInfo.InvariantCulture);
string lens = args[argNo++]; string lens = args[argNo++];
string cameraMake = args[argNo++]; string cameraMake = args[argNo++];
string cameraModel = args[argNo++]; string cameraModel = args[argNo++];
string camera = cameraMake + " " + cameraModel; string camera = cameraMake + " " + cameraModel;
#endregion #endregion
// Read default file as basis // Read default file as basis
string[] lines = File.ReadAllLines(defaultProfileFilePath); string[] lines = File.ReadAllLines(defaultProfileFilePath);
NameValueCollection nvEXIF = ParseFullExifData(sourceFile); NameValueCollection nvEXIF = ParseFullExifData(sourceFile);
// File should be Windows ANSI // File should be Windows ANSI
using (TextWriter tw = new StreamWriter(sourceFile + ".pp3", false, new UTF8Encoding(false))) { using (TextWriter tw = new StreamWriter(sourceFile + ".pp3", false, new UTF8Encoding(false))) {
string section = ""; string section = "";
foreach (string line in lines) { foreach (string line in lines) {
string l = line.Trim(); string l = line.Trim();
if (!String.IsNullOrEmpty(line)) { if (!String.IsNullOrEmpty(line)) {
if (l.StartsWith("[")) if (l.StartsWith("["))
section = l.Trim(new char[] { '[', ']' }); section = l.Trim(new char[] { '[', ']' });
else if (char.IsLetterOrDigit(l[0]) && l.Contains("=")) { else if (char.IsLetterOrDigit(l[0]) && l.Contains("=")) {
int valPos = l.IndexOf("=") + 1; int valPos = l.IndexOf("=") + 1;
string newValue = GetCorrectedSetting(nvEXIF, section + "/" + l.Substring(0, valPos - 1), l.Substring(valPos).Trim(), string newValue = GetCorrectedSetting(nvEXIF, section + "/" + l.Substring(0, valPos - 1), l.Substring(valPos).Trim(),
fNumber, exposureSecs, focalLength, iso, lens, camera); fNumber, exposureSecs, focalLength, iso, lens, camera);
// Merge in new value // Merge in new value
l = l.Substring(0, valPos) + (newValue ?? ""); l = l.Substring(0, valPos) + (newValue ?? "");
} }
} }
tw.WriteLine(l); tw.WriteLine(l);
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine("Error: " + ex.ToString()); // can be seen in the RT console window Console.WriteLine("Error: " + ex.ToString()); // can be seen in the RT console window
exitCode = 1; exitCode = 1;
} }
return exitCode; return exitCode;
} }
static NameValueCollection ParseFullExifData(string filePath) { static NameValueCollection ParseFullExifData(string filePath) {
NameValueCollection nv = new NameValueCollection(); NameValueCollection nv = new NameValueCollection();
string exifToolPath = ConfigurationManager.AppSettings["ExifToolPath"]; string exifToolPath = ConfigurationManager.AppSettings["ExifToolPath"];
if (!String.IsNullOrEmpty(exifToolPath)) { if (!String.IsNullOrEmpty(exifToolPath)) {
ProcessStartInfo psi = new ProcessStartInfo(exifToolPath, "\"" + filePath + "\" -tab -short"); ProcessStartInfo psi = new ProcessStartInfo(exifToolPath, "\"" + filePath + "\" -tab -short");
psi.CreateNoWindow = false; psi.CreateNoWindow = false;
psi.UseShellExecute = false; psi.UseShellExecute = false;
psi.StandardOutputEncoding = System.Text.Encoding.UTF8; psi.StandardOutputEncoding = System.Text.Encoding.UTF8;
psi.RedirectStandardOutput = true; psi.RedirectStandardOutput = true;
Process p = Process.Start(psi); Process p = Process.Start(psi);
using (StreamReader sr = p.StandardOutput) { using (StreamReader sr = p.StandardOutput) {
while (!sr.EndOfStream) { while (!sr.EndOfStream) {
string line = sr.ReadLine(); string line = sr.ReadLine();
if (line.Contains("\t")) { if (line.Contains("\t")) {
string[] split = line.Split('\t'); string[] split = line.Split('\t');
nv.Add(split[0], split[1]); nv.Add(split[0], split[1]);
} }
} }
} }
p.WaitForExit(); p.WaitForExit();
} }
return nv; return nv;
} }
#endregion #endregion
} }
#region DistortionCorrectProf #region DistortionCorrectProf
/// <summary>Holds a distortion correction profile for one lens. Uses sample points (focal length vs. dist. correction) as input.</summary> /// <summary>Holds a distortion correction profile for one lens. Uses sample points (focal length vs. dist. correction) as input.</summary>
class DistortionCorrectProf { class DistortionCorrectProf {
double[] adFocLen, adCorrect; double[] adFocLen, adCorrect;
/// <summary>Parses array to internal structure</summary> /// <summary>Parses array to internal structure</summary>
/// <param name="focLen">Focal lengths</param> /// <param name="focLen">Focal lengths</param>
/// <param name="correct">Correction factors</param> /// <param name="correct">Correction factors</param>
public DistortionCorrectProf(double[] focLen, double[] correct) { public DistortionCorrectProf(double[] focLen, double[] correct) {
if (focLen == null || correct == null || focLen.Length != correct.Length || focLen.Length < 2) if (focLen == null || correct == null || focLen.Length != correct.Length || focLen.Length < 2)
throw new Exception("DistortionCorrectProf inputs must be valid and of the same lengths, at least 2 points"); throw new Exception("DistortionCorrectProf inputs must be valid and of the same lengths, at least 2 points");
adFocLen = focLen; adCorrect = correct; adFocLen = focLen; adCorrect = correct;
for (int i = 0; i < adFocLen.Length - 1; i++) for (int i = 0; i < adFocLen.Length - 1; i++)
if (adFocLen[i] >= adFocLen[i + 1]) throw new Exception("The distortion correction focal length points must be ordered!"); if (adFocLen[i] >= adFocLen[i + 1]) throw new Exception("The distortion correction focal length points must be ordered!");
} }
/// <summary>Calculates regression value of RT distortion amount for the given focal length.</summary> /// <summary>Calculates regression value of RT distortion amount for the given focal length.</summary>
/// <param name="focalLength">Input focal length.</param> /// <param name="focalLength">Input focal length.</param>
/// <returns>Distortion in RT format.</returns> /// <returns>Distortion in RT format.</returns>
public string GetDistortionAmount(double focalLength) { public string GetDistortionAmount(double focalLength) {
// if it's out of area (which should just happen with e.g. rounding errors), return flat defaults. // if it's out of area (which should just happen with e.g. rounding errors), return flat defaults.
if (focalLength <= adFocLen[0]) return adCorrect[0].ToString("G", CultureInfo.InvariantCulture); if (focalLength <= adFocLen[0]) return adCorrect[0].ToString("G", CultureInfo.InvariantCulture);
if (focalLength >= adFocLen[adFocLen.Length - 1]) return adCorrect[adFocLen.Length - 1].ToString("G", CultureInfo.InvariantCulture); if (focalLength >= adFocLen[adFocLen.Length - 1]) return adCorrect[adFocLen.Length - 1].ToString("G", CultureInfo.InvariantCulture);
for (int i = 0; i < adFocLen.Length - 1; i++) { for (int i = 0; i < adFocLen.Length - 1; i++) {
if (focalLength >= adFocLen[i] && focalLength < adFocLen[i + 1]) { if (focalLength >= adFocLen[i] && focalLength < adFocLen[i + 1]) {
// from the sample curves taken so far, it it safe to take a simple linear interpolation here // from the sample curves taken so far, it it safe to take a simple linear interpolation here
double corr = adCorrect[i] + (adCorrect[i + 1] - adCorrect[i]) * (focalLength - adFocLen[i]) / (adFocLen[i + 1] - adFocLen[i]); double corr = adCorrect[i] + (adCorrect[i + 1] - adCorrect[i]) * (focalLength - adFocLen[i]) / (adFocLen[i + 1] - adFocLen[i]);
return corr.ToString("G3", CultureInfo.InvariantCulture); return corr.ToString("G3", CultureInfo.InvariantCulture);
} }
} }
return ""; // should never happen return ""; // should never happen
} }
} }
#endregion #endregion
} }

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<appSettings> <appSettings>
<!-- Set this full path to exiftool.exe. Rename exiftool(-k).exe to exiftool.exe before using it here! <!-- Set this full path to exiftool.exe. Rename exiftool(-k).exe to exiftool.exe before using it here!
If you leave the value empty, EXIFTOOL is simply not used. --> If you leave the value empty, EXIFTOOL is simply not used. -->
<add key="ExifToolPath" value="C:\Program Files (x86)\exiftool.exe"/> <add key="ExifToolPath" value="C:\Program Files (x86)\exiftool.exe"/>
</appSettings> </appSettings>
</configuration> </configuration>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>RawTherapee-bin</string> <string>RawTherapee-bin</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.rawtherapee.rawtherapee</string> <string>com.rawtherapee.rawtherapee</string>
</dict> </dict>
</plist> </plist>

View File

@ -1,167 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>English</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>RawTherapee</string> <string>RawTherapee</string>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>pp3</string> <string>pp3</string>
<string>PP3</string> <string>PP3</string>
</array> </array>
<key>CFBundleTypeIconFile</key> <key>CFBundleTypeIconFile</key>
<string>profile.icns</string> <string>profile.icns</string>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>RawTherapee Profile Data</string> <string>RawTherapee Profile Data</string>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Editor</string> <string>Editor</string>
<key>LSIsAppleDefaultForType</key> <key>LSIsAppleDefaultForType</key>
<true/> <true/>
<key>LSItemContentTypes</key> <key>LSItemContentTypes</key>
<array> <array>
<string>com.rawtherapee.pp3</string> <string>com.rawtherapee.pp3</string>
</array> </array>
</dict> </dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>3FR</string> <string>3FR</string>
<string>3fr</string> <string>3fr</string>
<string>ARW</string> <string>ARW</string>
<string>arw</string> <string>arw</string>
<string>CR2</string> <string>CR2</string>
<string>cr2</string> <string>cr2</string>
<string>CRF</string> <string>CRF</string>
<string>crf</string> <string>crf</string>
<string>CRW</string> <string>CRW</string>
<string>crw</string> <string>crw</string>
<string>DCR</string> <string>DCR</string>
<string>dcr</string> <string>dcr</string>
<string>DNG</string> <string>DNG</string>
<string>dng</string> <string>dng</string>
<string>FFF</string> <string>FFF</string>
<string>fff</string> <string>fff</string>
<string>IIQ</string> <string>IIQ</string>
<string>iiq</string> <string>iiq</string>
<string>KDC</string> <string>KDC</string>
<string>kdc</string> <string>kdc</string>
<string>MEF</string> <string>MEF</string>
<string>mef</string> <string>mef</string>
<string>MOS</string> <string>MOS</string>
<string>mos</string> <string>mos</string>
<string>MRW</string> <string>MRW</string>
<string>mrw</string> <string>mrw</string>
<string>NEF</string> <string>NEF</string>
<string>nef</string> <string>nef</string>
<string>NRW</string> <string>NRW</string>
<string>nrw</string> <string>nrw</string>
<string>ORF</string> <string>ORF</string>
<string>orf</string> <string>orf</string>
<string>PEF</string> <string>PEF</string>
<string>pef</string> <string>pef</string>
<string>RAF</string> <string>RAF</string>
<string>raf</string> <string>raf</string>
<string>RAW</string> <string>RAW</string>
<string>raw</string> <string>raw</string>
<string>RW2</string> <string>RW2</string>
<string>rw2</string> <string>rw2</string>
<string>RWZ</string> <string>RWZ</string>
<string>rwz</string> <string>rwz</string>
<string>SR2</string> <string>SR2</string>
<string>sr2</string> <string>sr2</string>
<string>SRF</string> <string>SRF</string>
<string>srf</string> <string>srf</string>
<string>SRW</string> <string>SRW</string>
<string>srw</string> <string>srw</string>
</array> </array>
<key>CFBundleTypeMIMETypes</key> <key>CFBundleTypeMIMETypes</key>
<array> <array>
<string>image/raw</string> <string>image/raw</string>
</array> </array>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>Camera Raw</string> <string>Camera Raw</string>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Viewer</string> <string>Viewer</string>
</dict> </dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>JPEG</string> <string>JPEG</string>
<string>jpeg</string> <string>jpeg</string>
<string>JPG</string> <string>JPG</string>
<string>jpg</string> <string>jpg</string>
<string>PNG</string> <string>PNG</string>
<string>png</string> <string>png</string>
<string>TIF</string> <string>TIF</string>
<string>tif</string> <string>tif</string>
<string>TIFF</string> <string>TIFF</string>
<string>tiff</string> <string>tiff</string>
</array> </array>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>Image</string> <string>Image</string>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Viewer</string> <string>Viewer</string>
</dict> </dict>
</array> </array>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>rawtherapee</string> <string>rawtherapee</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>@version@, Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team</string> <string>@version@, Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>rawtherapee.icns</string> <string>rawtherapee.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.rawtherapee.rawtherapee</string> <string>com.rawtherapee.rawtherapee</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>RawTherapee</string> <string>RawTherapee</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>@shortVersion@</string> <string>@shortVersion@</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>@shortVersion@</string> <string>@shortVersion@</string>
<key>LSExecutableArchitectures</key> <key>LSExecutableArchitectures</key>
<array> <array>
<string>@arch@</string> <string>@arch@</string>
</array> </array>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<true/> <true/>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team</string> <string>Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team</string>
<key>UTExportedTypeDeclarations</key> <key>UTExportedTypeDeclarations</key>
<array> <array>
<dict> <dict>
<key>UTTypeConformsTo</key> <key>UTTypeConformsTo</key>
<array> <array>
<string>public.data</string> <string>public.data</string>
</array> </array>
<key>UTTypeDescription</key> <key>UTTypeDescription</key>
<string>RawTherapee Profile Data</string> <string>RawTherapee Profile Data</string>
<key>UTTypeIconFile</key> <key>UTTypeIconFile</key>
<string>Icons.icns</string> <string>Icons.icns</string>
<key>UTTypeIdentifier</key> <key>UTTypeIdentifier</key>
<string>com.rawtherapee.pp3</string> <string>com.rawtherapee.pp3</string>
<key>UTTypeReferenceURL</key> <key>UTTypeReferenceURL</key>
<string>http://www.rawtherapee.com/</string> <string>http://www.rawtherapee.com/</string>
<key>UTTypeTagSpecification</key> <key>UTTypeTagSpecification</key>
<dict> <dict>
<key>com.apple.ostype</key> <key>com.apple.ostype</key>
<string>PP3</string> <string>PP3</string>
<key>public.filename-extension</key> <key>public.filename-extension</key>
<array> <array>
<string>pp3</string> <string>pp3</string>
<string>PP3</string> <string>PP3</string>
</array> </array>
</dict> </dict>
</dict> </dict>
</array> </array>
</dict> </dict>
</plist> </plist>

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>application-identifier</key> <key>application-identifier</key>
<string>com.rawtherapee.rawtherapee</string> <string>com.rawtherapee.rawtherapee</string>
<key>com.apple.security.temporary-exception.files.absolute-path.read-write</key> <key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
<array> <array>
<string>&quot;/&quot;</string> <string>&quot;/&quot;</string>
</array> </array>
<key>com.apple.security.cs.allow-dyld-environment-variables</key> <key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/> <true/>
<key>com.apple.security.files.user-selected.read-write</key> <key>com.apple.security.files.user-selected.read-write</key>
<true/> <true/>
<key>com.apple.security.app-sandbox</key> <key>com.apple.security.app-sandbox</key>
<true/> <true/>
<key>com.apple.security.files.downloads.read-write</key> <key>com.apple.security.files.downloads.read-write</key>
<true/> <true/>
</dict> </dict>
</plist> </plist>