Adding new units for the RGB and HSV values in the Navigator tool (below
Histogram). Click on one of thes two columns to cycle to a new unit independantly, between [0-1], [0-255], [%] (Hue stays in degree instead of percent). The current unit is saved in Options for new Editor tabs or between sessions.
This commit is contained in:
@@ -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"));
|
||||||
@@ -127,6 +129,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));
|
||||||
|
|
||||||
@@ -139,11 +142,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));
|
||||||
|
|
||||||
@@ -156,7 +163,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);
|
||||||
|
|
||||||
@@ -214,15 +224,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::NU_0_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::NU_0_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::NU_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::NU_0_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::NU_0_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::NU_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);
|
||||||
@@ -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::NU__COUNT) {
|
||||||
|
v = 0;
|
||||||
|
}
|
||||||
|
options.navRGBUnit = currentRGBUnit = (Options::NavigatorUnit)v;
|
||||||
|
|
||||||
|
switch (currentRGBUnit) {
|
||||||
|
case Options::NavigatorUnit::NU_0_1:
|
||||||
|
R->set_text ("[0-1]");
|
||||||
|
G->set_text ("[0-1]");
|
||||||
|
B->set_text ("[0-1]");
|
||||||
|
break;
|
||||||
|
case Options::NavigatorUnit::NU_0_255:
|
||||||
|
R->set_text ("[0-255]");
|
||||||
|
G->set_text ("[0-255]");
|
||||||
|
B->set_text ("[0-255]");
|
||||||
|
break;
|
||||||
|
case Options::NavigatorUnit::NU_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::NU__COUNT) {
|
||||||
|
v = 0;
|
||||||
|
}
|
||||||
|
options.navHSVUnit = currentHSVUnit = (Options::NavigatorUnit)v;
|
||||||
|
|
||||||
|
switch (currentHSVUnit) {
|
||||||
|
case Options::NavigatorUnit::NU_0_1:
|
||||||
|
H->set_text ("[0-1]");
|
||||||
|
S->set_text ("[0-1]");
|
||||||
|
V->set_text ("[0-1]");
|
||||||
|
break;
|
||||||
|
case Options::NavigatorUnit::NU_0_255:
|
||||||
|
H->set_text ("[0-255]");
|
||||||
|
S->set_text ("[0-255]");
|
||||||
|
V->set_text ("[0-255]");
|
||||||
|
break;
|
||||||
|
case Options::NavigatorUnit::NU_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)
|
||||||
{
|
{
|
||||||
|
@@ -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;
|
||||||
|
@@ -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::NU_PERCENT;
|
||||||
|
navHSVUnit = NavigatorUnit::NU_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
|
||||||
@@ -1407,6 +1409,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");
|
||||||
}
|
}
|
||||||
@@ -2010,6 +2020,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);
|
||||||
|
@@ -86,6 +86,13 @@ private:
|
|||||||
const Glib::ustring& entryName, Glib::ustring& destination);
|
const Glib::ustring& entryName, Glib::ustring& destination);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum class NavigatorUnit {
|
||||||
|
NU_PERCENT,
|
||||||
|
NU_0_255,
|
||||||
|
NU_0_1,
|
||||||
|
NU__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;
|
||||||
|
Reference in New Issue
Block a user