Merge branch 'master' into softproofing

This commit is contained in:
Hombre 2016-09-02 16:24:14 +02:00
commit bdf4665c16
6 changed files with 136 additions and 14 deletions

View File

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

View File

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

View File

@ -26,9 +26,11 @@
#include "../rtengine/rt_math.h"
#include "options.h"
extern Options options;
using namespace rtengine;
Navigator::Navigator ()
Navigator::Navigator () : currentRGBUnit(options.navRGBUnit), currentHSVUnit(options.navHSVUnit)
{
set_label (M("MAIN_MSG_NAVIGATOR"));
@ -127,6 +129,7 @@ Navigator::Navigator ()
// RGB
Gtk::EventBox *evBox1 = Gtk::manage (new Gtk::EventBox());
Gtk::HBox* hbox1 = Gtk::manage (new Gtk::HBox ()); // container
Gtk::Table* table1 = Gtk::manage (new Gtk::Table (3, 2));
@ -139,11 +142,15 @@ Navigator::Navigator ()
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);
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);
table0->attach (*hbox1, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0);
// HSV
Gtk::EventBox *evBox2 = Gtk::manage (new Gtk::EventBox());
Gtk::HBox* hbox2 = Gtk::manage (new Gtk::HBox ()); // container
Gtk::Table* table2 = Gtk::manage (new Gtk::Table (3, 2));
@ -156,7 +163,10 @@ Navigator::Navigator ()
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);
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);
table0->attach (*hbox2, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 0, 0);
@ -214,15 +224,45 @@ void Navigator::pointerMoved (bool validPos, Glib::ustring profile, Glib::ustrin
} else {
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("%"));
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("%"));
switch (currentRGBUnit) {
case (Options::NavigatorUnit::R0_1):
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;
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"));
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("%"));
switch (currentHSVUnit) {
case (Options::NavigatorUnit::R0_1):
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;
//rgb2lab (r, g, b, LAB_l, LAB_a, LAB_b);
@ -233,6 +273,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)
{

View File

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

View File

@ -353,6 +353,8 @@ void Options::setDefaults ()
fbShowExpComp = false;
fbShowHidden = false;
fbArrangement = 2; // was 0
navRGBUnit = NavigatorUnit::PERCENT;
navHSVUnit = NavigatorUnit::PERCENT;
multiUser = true;
profilePath = "profiles";
loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails
@ -1407,6 +1409,14 @@ int Options::readFromFile (Glib::ustring fname)
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")) {
showFilmStripToolBar = keyFile.get_boolean ("GUI", "ShowFilmStripToolBar");
}
@ -2014,6 +2024,8 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition);
keyFile.set_boolean ("GUI", "HistogramBar", histogramBar);
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", "FileBrowserToolbarSingleRow", FileBrowserToolbarSingleRow);
keyFile.set_boolean ("GUI", "HideTPVScrollbar", hideTPVScrollbar);

View File

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