Merge branch 'master' into gtk3

This commit is contained in:
Morgan Hardwood 2016-09-02 17:51:45 +02:00
commit 9380034b19
8 changed files with 193 additions and 90 deletions

View File

@ -13,6 +13,9 @@ Of course, professionals may use RawTherapee too while enjoying complete freedom
Website: Website:
http://rawtherapee.com/ http://rawtherapee.com/
Forum:
https://discuss.pixls.us/c/software/rawtherapee
Features: Features:
http://rawpedia.rawtherapee.com/Features http://rawpedia.rawtherapee.com/Features
@ -25,9 +28,6 @@ http://rawtherapee.com/downloads
Download source code tarballs: Download source code tarballs:
http://rawtherapee.com/shared/source/ http://rawtherapee.com/shared/source/
Source code documentation:
http://michaelezra.com/projects/rt/documentation/
Git handbook: Git handbook:
http://git-scm.com/book/en/ http://git-scm.com/book/en/

View File

@ -2137,16 +2137,15 @@ void Color::gamutLchonly (float HH, float2 sincosval, float &Lprov1, float &Chpr
void Color::gamutLchonly (float HH, float2 sincosval, float &Lprov1, float &Chprov1, float &R, float &G, float &B, const double wip[3][3], const bool isHLEnabled, const float lowerCoef, const float higherCoef) void Color::gamutLchonly (float HH, float2 sincosval, float &Lprov1, float &Chprov1, float &R, float &G, float &B, const double wip[3][3], const bool isHLEnabled, const float lowerCoef, const float higherCoef)
#endif #endif
{ {
const float ClipLevel = 65535.0f; constexpr float ClipLevel = 65535.0f;
bool inGamut; bool inGamut;
#ifdef _DEBUG #ifdef _DEBUG
neg = false, more_rgb = false; neg = false, more_rgb = false;
#endif #endif
float ChprovSave = Chprov1;
do { do {
inGamut = true; inGamut = true;
//Lprov1=LL;
float aprov1 = Chprov1 * sincosval.y; float aprov1 = Chprov1 * sincosval.y;
float bprov1 = Chprov1 * sincosval.x; float bprov1 = Chprov1 * sincosval.x;
@ -2156,9 +2155,8 @@ void Color::gamutLchonly (float HH, float2 sincosval, float &Lprov1, float &Chpr
float fz = fy - (0.005f * bprov1); float fz = fy - (0.005f * bprov1);
float x_ = 65535.0f * f2xyz(fx) * D50x; float x_ = 65535.0f * f2xyz(fx) * D50x;
// float y_ = 65535.0f * f2xyz(fy);
float z_ = 65535.0f * f2xyz(fz) * D50z; float z_ = 65535.0f * f2xyz(fz) * D50z;
float y_ = (Lprov1 > epskap) ? 65535.0 * fy * fy * fy : 65535.0 * Lprov1 / kappa; float y_ = (Lprov1 > epskap) ? 65535.0f * fy * fy * fy : 65535.0f * Lprov1 / kappa;
xyz2rgb(x_, y_, z_, R, G, B, wip); xyz2rgb(x_, y_, z_, R, G, B, wip);
@ -2167,6 +2165,11 @@ void Color::gamutLchonly (float HH, float2 sincosval, float &Lprov1, float &Chpr
#ifdef _DEBUG #ifdef _DEBUG
neg = true; neg = true;
#endif #endif
if (isnan(HH)) {
float atemp = ChprovSave * sincosval.y * 327.68;
float btemp = ChprovSave * sincosval.x * 327.68;
HH = xatan2f(btemp, atemp);
}
if (Lprov1 < 0.1f) { if (Lprov1 < 0.1f) {
Lprov1 = 0.1f; Lprov1 = 0.1f;

View File

@ -2977,21 +2977,25 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
TMatrix wprof = iccStore->workingSpaceMatrix (params->icm.working); TMatrix wprof = iccStore->workingSpaceMatrix (params->icm.working);
TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working); TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working);
double toxyz[3][3] = { float toxyz[3][3] = {
{ {
( wprof[0][0] / Color::D50x), static_cast<float>( wprof[0][0] / Color::D50x),
( wprof[0][1] / Color::D50x), static_cast<float>( wprof[0][1] / Color::D50x),
( wprof[0][2] / Color::D50x) static_cast<float>( wprof[0][2] / Color::D50x)
}, { }, {
( wprof[1][0]), static_cast<float>( wprof[1][0]),
( wprof[1][1]), static_cast<float>( wprof[1][1]),
( wprof[1][2]) static_cast<float>( wprof[1][2])
}, { }, {
( wprof[2][0] / Color::D50z), static_cast<float>( wprof[2][0] / Color::D50z),
( wprof[2][1] / Color::D50z), static_cast<float>( wprof[2][1] / Color::D50z),
( wprof[2][2] / Color::D50z) static_cast<float>( wprof[2][2] / Color::D50z)
} }
}; };
float maxFactorToxyz = max(toxyz[1][0],toxyz[1][1],toxyz[1][2]);
float equalR = maxFactorToxyz / toxyz[1][0];
float equalG = maxFactorToxyz / toxyz[1][1];
float equalB = maxFactorToxyz / toxyz[1][2];
//inverse matrix user select //inverse matrix user select
double wip[3][3] = { double wip[3][3] = {
@ -3628,60 +3632,52 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) {
float r1, g1, b1, r2, g2, b2, L_1, L_2, Lfactor, a_1, b_1, x_, y_, z_, R, G, B ;
float y, fy, yy, fyy, x, z, fx, fz;
// rgb values before RGB curves // rgb values before RGB curves
r1 = rtemp[ti * TS + tj] ; float r = rtemp[ti * TS + tj] ;
g1 = gtemp[ti * TS + tj] ; float g = gtemp[ti * TS + tj] ;
b1 = btemp[ti * TS + tj] ; float b = btemp[ti * TS + tj] ;
//convert to Lab to get a&b before RGB curves //convert to Lab to get a&b before RGB curves
x = toxyz[0][0] * r1 + toxyz[0][1] * g1 + toxyz[0][2] * b1; float x = toxyz[0][0] * r + toxyz[0][1] * g + toxyz[0][2] * b;
y = toxyz[1][0] * r1 + toxyz[1][1] * g1 + toxyz[1][2] * b1; float y = toxyz[1][0] * r + toxyz[1][1] * g + toxyz[1][2] * b;
z = toxyz[2][0] * r1 + toxyz[2][1] * g1 + toxyz[2][2] * b1; float z = toxyz[2][0] * r + toxyz[2][1] * g + toxyz[2][2] * b;
fx = (x < 65535.0f ? Color::cachef[std::max(x, 0.f)] : 327.68f * std::cbrt(x / MAXVALF)); float fx = x < MAXVALF ? Color::cachef[x] : 327.68f * std::cbrt(x / MAXVALF);
fy = (y < 65535.0f ? Color::cachef[std::max(y, 0.f)] : 327.68f * std::cbrt(y / MAXVALF)); float fy = y < MAXVALF ? Color::cachef[y] : 327.68f * std::cbrt(y / MAXVALF);
fz = (z < 65535.0f ? Color::cachef[std::max(z, 0.f)] : 327.68f * std::cbrt(z / MAXVALF)); float fz = z < MAXVALF ? Color::cachef[z] : 327.68f * std::cbrt(z / MAXVALF);
L_1 = (116.0f * fy - 5242.88f); //5242.88=16.0*327.68; float a_1 = 500.0f * (fx - fy);
a_1 = (500.0f * (fx - fy) ); float b_1 = 200.0f * (fy - fz);
b_1 = (200.0f * (fy - fz) );
// rgb values after RGB curves // rgb values after RGB curves
if (rCurve) { if (rCurve) {
r2 = rCurve[ rtemp[ti * TS + tj]]; float rNew = rCurve[r];
} else { r += (rNew - r) * equalR;
r2 = r1;
} }
if (gCurve) { if (gCurve) {
g2 = gCurve[ gtemp[ti * TS + tj]]; float gNew = gCurve[g];
} else { g += (gNew - g) * equalG;
g2 = g1;
} }
if (bCurve) { if (bCurve) {
b2 = bCurve[ btemp[ti * TS + tj]]; float bNew = bCurve[b];
} else { b += (bNew - b) * equalB;
b2 = b1;
} }
// Luminosity after // Luminosity after
// only Luminance in Lab // only Luminance in Lab
yy = toxyz[1][0] * r2 + toxyz[1][1] * g2 + toxyz[1][2] * b2; float newy = toxyz[1][0] * r + toxyz[1][1] * g + toxyz[1][2] * b;
fyy = (yy < 65535.0f ? Color::cachef[std::max(yy, 0.f)] : 327.68f * std::cbrt(yy / MAXVALF)); float newfy = newy < MAXVALF ? Color::cachef[newy] : 327.68f * std::cbrt(newy / MAXVALF);
L_2 = (116.0f * fyy - 5242.88f); float L_2 = 116.0f * newfy - 5242.88f;
//gamut control //gamut control
if(settings->rgbcurveslumamode_gamut) { if(settings->rgbcurveslumamode_gamut) {
float RR, GG, BB; float Lpro = L_2 / 327.68f;
float HH, Lpro, Chpro; float Chpro = sqrtf(SQR(a_1) + SQR(b_1)) / 327.68f;
Lpro = L_2 / 327.68f; float HH = NAN; // we set HH to NAN, because then it will be calculated in Color::gamutLchonly only if needed
Chpro = sqrt(SQR(a_1) + SQR(b_1)) / 327.68f; // float HH = xatan2f(b_1, a_1);
HH = xatan2f(b_1, a_1); // According to mathematical laws we can get the sin and cos of HH by simple operations even if we don't calculate HH
// According to mathematical laws we can get the sin and cos of HH by simple operations float2 sincosval;
float2 sincosval;
if(Chpro == 0.0f) { if(Chpro == 0.0f) {
sincosval.y = 1.0f; sincosval.y = 1.0f;
@ -3695,30 +3691,18 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
bool neg = false; bool neg = false;
bool more_rgb = false; bool more_rgb = false;
//gamut control : Lab values are in gamut //gamut control : Lab values are in gamut
Color::gamutLchonly(HH, Lpro, Chpro, RR, GG, BB, wip, highlight, 0.15f, 0.96f, neg, more_rgb); Color::gamutLchonly(HH, sincosval, Lpro, Chpro, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], wip, highlight, 0.15f, 0.96f, neg, more_rgb);
#else #else
//gamut control : Lab values are in gamut //gamut control : Lab values are in gamut
Color::gamutLchonly(HH, Lpro, Chpro, RR, GG, BB, wip, highlight, 0.15f, 0.96f); Color::gamutLchonly(HH, sincosval, Lpro, Chpro, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], wip, highlight, 0.15f, 0.96f);
#endif #endif
//end of gamut control
//Color::gamutLchonly(HH,Lpro,Chpro, RR, GG, BB, wip, highlight, 0.15f, 0.96f); } else {
float x_, y_, z_;
//calculate RGB with L_2 and old value of a and b
Color::Lab2XYZ(L_2, a_1, b_1, x_, y_, z_) ;
// float2 sincosval = xsincosf(HH); Color::xyz2rgb(x_, y_, z_, rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], wip);
}
L_2 = Lpro * 327.68f;
a_1 = 327.68f * Chpro * sincosval.y;
b_1 = 327.68f * Chpro * sincosval.x;
} //end of gamut control
//calculate RGB with L_2 and old value of a and b
Color::Lab2XYZ(L_2, a_1, b_1, x_, y_, z_) ;
Color::xyz2rgb(x_, y_, z_, R, G, B, wip);
rtemp[ti * TS + tj] = R;
gtemp[ti * TS + tj] = G;
btemp[ti * TS + tj] = B;
} }
} }
} }

View File

@ -1029,8 +1029,7 @@ bool CropWindow::onArea (CursorArea a, int x, int y)
} }
getObservedFrameArea (x1, y1, w, h); getObservedFrameArea (x1, y1, w, h);
return x > x1 - 6 && y > y1 - 6 && x < x1 + w - 1 + 6 && y < y1 + h - 1 + 6 && return x >= x1 && x <= x1 + w && y >= y1 && y <= y1 + h;
!(x > x1 + 2 && y > y1 + 2 && x < x1 + w - 1 - 2 && y < y1 + h - 1 - 2);
} }
return false; return false;

View File

@ -26,9 +26,11 @@
#include "../rtengine/rt_math.h" #include "../rtengine/rt_math.h"
#include "options.h" #include "options.h"
extern Options options;
using namespace rtengine; using namespace rtengine;
Navigator::Navigator () Navigator::Navigator () : currentRGBUnit(options.navRGBUnit), currentHSVUnit(options.navHSVUnit)
{ {
set_label (M("MAIN_MSG_NAVIGATOR")); set_label (M("MAIN_MSG_NAVIGATOR"));
@ -133,6 +135,7 @@ Navigator::Navigator ()
// RGB // RGB
Gtk::EventBox *evBox1 = Gtk::manage (new Gtk::EventBox());
Gtk::HBox* hbox1 = Gtk::manage (new Gtk::HBox ()); // container Gtk::HBox* hbox1 = Gtk::manage (new Gtk::HBox ()); // container
Gtk::Table* table1 = Gtk::manage (new Gtk::Table (3, 2)); Gtk::Table* table1 = Gtk::manage (new Gtk::Table (3, 2));
@ -145,11 +148,15 @@ Navigator::Navigator ()
table1->attach (*lB, 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 4, 0); table1->attach (*lB, 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 4, 0);
table1->attach (*B, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0); table1->attach (*B, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0);
hbox1->pack_start (*table1, Gtk::PACK_EXPAND_WIDGET, 4); evBox1->add (*table1);
evBox1->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &Navigator::cycleUnitsRGB));
hbox1->pack_start (*evBox1, Gtk::PACK_EXPAND_WIDGET, 4);
hbox1->pack_start (*Gtk::manage (new Gtk::VSeparator()), Gtk::PACK_SHRINK, 4); hbox1->pack_start (*Gtk::manage (new Gtk::VSeparator()), Gtk::PACK_SHRINK, 4);
table0->attach (*hbox1, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0); table0->attach (*hbox1, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0);
// HSV // HSV
Gtk::EventBox *evBox2 = Gtk::manage (new Gtk::EventBox());
Gtk::HBox* hbox2 = Gtk::manage (new Gtk::HBox ()); // container Gtk::HBox* hbox2 = Gtk::manage (new Gtk::HBox ()); // container
Gtk::Table* table2 = Gtk::manage (new Gtk::Table (3, 2)); Gtk::Table* table2 = Gtk::manage (new Gtk::Table (3, 2));
@ -162,7 +169,10 @@ Navigator::Navigator ()
table2->attach (*lV, 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 4, 0); table2->attach (*lV, 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 4, 0);
table2->attach (*V, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0); table2->attach (*V, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0);
hbox2->pack_start (*table2, Gtk::PACK_EXPAND_WIDGET, 4); evBox2->add (*table2);
evBox2->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &Navigator::cycleUnitsHSV));
hbox2->pack_start (*evBox2, Gtk::PACK_EXPAND_WIDGET, 4);
hbox2->pack_start (*Gtk::manage (new Gtk::VSeparator()), Gtk::PACK_SHRINK, 4); hbox2->pack_start (*Gtk::manage (new Gtk::VSeparator()), Gtk::PACK_SHRINK, 4);
table0->attach (*hbox2, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0); table0->attach (*hbox2, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0);
@ -220,15 +230,45 @@ void Navigator::pointerMoved (bool validPos, Glib::ustring profile, Glib::ustrin
} else { } else {
position->set_text (Glib::ustring::compose ("x: %1, y: %2", x, y)); position->set_text (Glib::ustring::compose ("x: %1, y: %2", x, y));
R->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), r * 100.f / 255.f) + Glib::ustring("%")); switch (currentRGBUnit) {
G->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), g * 100.f / 255.f) + Glib::ustring("%")); case (Options::NavigatorUnit::R0_1):
B->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), b * 100.f / 255.f) + Glib::ustring("%")); R->set_text (Glib::ustring::format(std::fixed, std::setprecision(4), r / 255.f));
G->set_text (Glib::ustring::format(std::fixed, std::setprecision(4), g / 255.f));
B->set_text (Glib::ustring::format(std::fixed, std::setprecision(4), b / 255.f));
break;
case (Options::NavigatorUnit::R0_255):
R->set_text (Glib::ustring::format(std::fixed, std::setprecision(0), r));
G->set_text (Glib::ustring::format(std::fixed, std::setprecision(0), g));
B->set_text (Glib::ustring::format(std::fixed, std::setprecision(0), b));
break;
case (Options::NavigatorUnit::PERCENT):
default:
R->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), r * 100.f / 255.f) + Glib::ustring("%"));
G->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), g * 100.f / 255.f) + Glib::ustring("%"));
B->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), b * 100.f / 255.f) + Glib::ustring("%"));
break;
}
float h, s, v; float h, s, v;
Color::rgb2hsv (r * 0xffff / 0xff, g * 0xffff / 0xff, b * 0xffff / 0xff, h, s, v); Color::rgb2hsv (r * 0xffff / 0xff, g * 0xffff / 0xff, b * 0xffff / 0xff, h, s, v);
H->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), h * 360.f) + Glib::ustring("\xc2\xb0")); switch (currentHSVUnit) {
S->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), s * 100.f) + Glib::ustring("%")); case (Options::NavigatorUnit::R0_1):
V->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), v * 100.f) + Glib::ustring("%")); H->set_text (Glib::ustring::format(std::fixed, std::setprecision(4), h));
S->set_text (Glib::ustring::format(std::fixed, std::setprecision(4), s));
V->set_text (Glib::ustring::format(std::fixed, std::setprecision(4), v));
break;
case (Options::NavigatorUnit::R0_255):
H->set_text (Glib::ustring::format(std::fixed, std::setprecision(0), h * 255));
S->set_text (Glib::ustring::format(std::fixed, std::setprecision(0), s * 255));
V->set_text (Glib::ustring::format(std::fixed, std::setprecision(0), v * 255));
break;
case (Options::NavigatorUnit::PERCENT):
default:
H->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), h * 360.f) + Glib::ustring("\xc2\xb0"));
S->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), s * 100.f) + Glib::ustring("%"));
V->set_text (Glib::ustring::format(std::fixed, std::setprecision(1), v * 100.f) + Glib::ustring("%"));
break;
}
float LAB_a, LAB_b, LAB_l; float LAB_a, LAB_b, LAB_l;
//rgb2lab (r, g, b, LAB_l, LAB_a, LAB_b); //rgb2lab (r, g, b, LAB_l, LAB_a, LAB_b);
@ -239,6 +279,61 @@ void Navigator::pointerMoved (bool validPos, Glib::ustring profile, Glib::ustrin
} }
} }
void Navigator::cycleUnitsRGB (GdkEventButton *event) {
uint16_t v = (uint16_t)currentRGBUnit;
++v;
if (v == (uint16_t)Options::NavigatorUnit::_COUNT) {
v = 0;
}
options.navRGBUnit = currentRGBUnit = (Options::NavigatorUnit)v;
switch (currentRGBUnit) {
case Options::NavigatorUnit::R0_1:
R->set_text ("[0-1]");
G->set_text ("[0-1]");
B->set_text ("[0-1]");
break;
case Options::NavigatorUnit::R0_255:
R->set_text ("[0-255]");
G->set_text ("[0-255]");
B->set_text ("[0-255]");
break;
case Options::NavigatorUnit::PERCENT:
default:
R->set_text ("[%]");
G->set_text ("[%]");
B->set_text ("[%]");
break;
}
}
void Navigator::cycleUnitsHSV (GdkEventButton *event) {
uint16_t v = (uint16_t)currentHSVUnit;
++v;
if (v == (uint16_t)Options::NavigatorUnit::_COUNT) {
v = 0;
}
options.navHSVUnit = currentHSVUnit = (Options::NavigatorUnit)v;
switch (currentHSVUnit) {
case Options::NavigatorUnit::R0_1:
H->set_text ("[0-1]");
S->set_text ("[0-1]");
V->set_text ("[0-1]");
break;
case Options::NavigatorUnit::R0_255:
H->set_text ("[0-255]");
S->set_text ("[0-255]");
V->set_text ("[0-255]");
break;
case Options::NavigatorUnit::PERCENT:
default:
H->set_text ("[\xc2\xb0]");
S->set_text ("[%]");
V->set_text ("[%]");
break;
}
}
void Navigator::rgb2lab (Glib::ustring profile, Glib::ustring profileW, int r, int g, int b, float &LAB_l, float &LAB_a, float &LAB_b) void Navigator::rgb2lab (Glib::ustring profile, Glib::ustring profileW, int r, int g, int b, float &LAB_l, float &LAB_a, float &LAB_b)
{ {

View File

@ -22,6 +22,7 @@
#include <gtkmm.h> #include <gtkmm.h>
#include "previewwindow.h" #include "previewwindow.h"
#include "pointermotionlistener.h" #include "pointermotionlistener.h"
#include "options.h"
#include "../rtengine/iccstore.h" #include "../rtengine/iccstore.h"
class Navigator : public Gtk::Frame, public PointerMotionListener class Navigator : public Gtk::Frame, public PointerMotionListener
@ -29,6 +30,12 @@ class Navigator : public Gtk::Frame, public PointerMotionListener
typedef const double (*TMatrix)[3]; typedef const double (*TMatrix)[3];
private:
Options::NavigatorUnit currentRGBUnit;
Options::NavigatorUnit currentHSVUnit;
void cycleUnitsRGB (GdkEventButton *event);
void cycleUnitsHSV (GdkEventButton *event);
protected: protected:
Gtk::Label* position; Gtk::Label* position;
Gtk::Label *R, *G, *B; Gtk::Label *R, *G, *B;

View File

@ -353,6 +353,8 @@ void Options::setDefaults ()
fbShowExpComp = false; fbShowExpComp = false;
fbShowHidden = false; fbShowHidden = false;
fbArrangement = 2; // was 0 fbArrangement = 2; // was 0
navRGBUnit = NavigatorUnit::PERCENT;
navHSVUnit = NavigatorUnit::PERCENT;
multiUser = true; multiUser = true;
profilePath = "profiles"; profilePath = "profiles";
loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails
@ -733,8 +735,6 @@ int Options::readFromFile (Glib::ustring fname)
try { try {
if (keyFile.load_from_file (fname)) { if (keyFile.load_from_file (fname)) {
setDefaults ();
// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
if (keyFile.has_group ("General")) { if (keyFile.has_group ("General")) {
@ -1402,6 +1402,14 @@ int Options::readFromFile (Glib::ustring fname)
histogramFullMode = keyFile.get_boolean ("GUI", "HistogramFullMode"); histogramFullMode = keyFile.get_boolean ("GUI", "HistogramFullMode");
} }
if (keyFile.has_key ("GUI", "NavigatorRGBUnit")) {
navRGBUnit = (NavigatorUnit)keyFile.get_integer ("GUI", "NavigatorRGBUnit");
}
if (keyFile.has_key ("GUI", "NavigatorHSVUnit")) {
navHSVUnit = (NavigatorUnit)keyFile.get_integer ("GUI", "NavigatorHSVUnit");
}
if (keyFile.has_key ("GUI", "ShowFilmStripToolBar")) { if (keyFile.has_key ("GUI", "ShowFilmStripToolBar")) {
showFilmStripToolBar = keyFile.get_boolean ("GUI", "ShowFilmStripToolBar"); showFilmStripToolBar = keyFile.get_boolean ("GUI", "ShowFilmStripToolBar");
} }
@ -1776,14 +1784,10 @@ int Options::readFromFile (Glib::ustring fname)
if (options.rtSettings.verbose) { 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 (...) { } catch (...) {
if (options.rtSettings.verbose) { 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 ();
} }
return 1; return 1;
@ -2004,6 +2008,8 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition);
keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); keyFile.set_boolean ("GUI", "HistogramBar", histogramBar);
keyFile.set_boolean ("GUI", "HistogramFullMode", histogramFullMode); keyFile.set_boolean ("GUI", "HistogramFullMode", histogramFullMode);
keyFile.set_integer ("GUI", "NavigatorRGBUnit", (int)navRGBUnit);
keyFile.set_integer ("GUI", "NavigatorHSVUnit", (int)navHSVUnit);
keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar); keyFile.set_boolean ("GUI", "ShowFilmStripToolBar", showFilmStripToolBar);
keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow); keyFile.set_boolean ("GUI", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow);
keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar); keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar);

View File

@ -86,6 +86,13 @@ private:
const Glib::ustring& entryName, Glib::ustring& destination); const Glib::ustring& entryName, Glib::ustring& destination);
public: public:
enum class NavigatorUnit {
PERCENT,
R0_255,
R0_1,
_COUNT
};
bool savesParamsAtExit; bool savesParamsAtExit;
SaveFormat saveFormat, saveFormatBatch; SaveFormat saveFormat, saveFormatBatch;
Glib::ustring savePathTemplate; Glib::ustring savePathTemplate;
@ -133,6 +140,8 @@ public:
bool fbShowExpComp; bool fbShowExpComp;
bool fbShowHidden; bool fbShowHidden;
int fbArrangement; int fbArrangement;
NavigatorUnit navRGBUnit;
NavigatorUnit navHSVUnit;
bool multiUser; bool multiUser;
static Glib::ustring rtdir; static Glib::ustring rtdir;
Glib::ustring version; Glib::ustring version;