Modifications such that the aspect ratio of the histogram is stored between sessions. Additionally, the scaling behavior is changed slightly to make the code easier without being to different from the current situation.

This commit is contained in:
Thanatomanic 2018-06-28 19:04:19 +02:00
parent dc6c628ad1
commit 08cad72be0
4 changed files with 25 additions and 33 deletions

View File

@ -851,6 +851,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
if (tbTopPanel_1) { if (tbTopPanel_1) {
tbTopPanel_1->signal_toggled().connect ( sigc::mem_fun (*this, &EditorPanel::tbTopPanel_1_toggled) ); tbTopPanel_1->signal_toggled().connect ( sigc::mem_fun (*this, &EditorPanel::tbTopPanel_1_toggled) );
} }
} }
EditorPanel::~EditorPanel () EditorPanel::~EditorPanel ()
@ -2341,6 +2342,7 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition)
histogramPanel->unreference(); histogramPanel->unreference();
} }
leftbox->set_position(options.historyPanelWidth * options.histogramAspect); // Make sure the panel gets the right aspect ratio
histogramPanel->reorder (Gtk::POS_LEFT); histogramPanel->reorder (Gtk::POS_LEFT);
break; break;
@ -2360,11 +2362,13 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition)
histogramPanel->unreference(); histogramPanel->unreference();
} }
vboxright->set_position(options.toolPanelWidth * options.histogramAspect); // Make sure the panel gets the right aspect ratio
histogramPanel->reorder (Gtk::POS_RIGHT); histogramPanel->reorder (Gtk::POS_RIGHT);
break; break;
} }
iareapanel->imageArea->setPointerMotionHListener (histogramPanel); iareapanel->imageArea->setPointerMotionHListener (histogramPanel);
} }

View File

@ -48,6 +48,9 @@ HistogramPanel::HistogramPanel ()
histogramArea = Gtk::manage (new HistogramArea (this)); histogramArea = Gtk::manage (new HistogramArea (this));
histogramArea->set_hexpand(true); histogramArea->set_hexpand(true);
histogramArea->set_vexpand(true); histogramArea->set_vexpand(true);
histogramArea->set_halign(Gtk::ALIGN_FILL);
histogramArea->set_valign(Gtk::ALIGN_FILL);
histogramRGBArea = Gtk::manage (new HistogramRGBArea ()); histogramRGBArea = Gtk::manage (new HistogramRGBArea ());
histogramRGBArea->set_hexpand(true); histogramRGBArea->set_hexpand(true);
histogramRGBArea->set_vexpand(false); histogramRGBArea->set_vexpand(false);
@ -244,19 +247,9 @@ HistogramPanel::~HistogramPanel ()
void HistogramPanel::resized (Gtk::Allocation& req) void HistogramPanel::resized (Gtk::Allocation& req)
{ {
/* // Store current aspect ratio of the histogram
rconn.block (true); options.histogramAspect = histogramArea->get_height() / (float)histogramArea->get_width();
int gHeight = req.get_width()/2;
if (gHeight > 150) gHeight = 150; else if (gHeight < 100) gHeight = 100;
int bHeight = req.get_width()/30;
if (bHeight > 10) bHeight = 10; else if (bHeight < 5 ) bHeight = 5;
histogramArea->set_size_request (req.get_width(), gHeight);
histogramRGBArea->set_size_request (req.get_width(), bHeight);
rconn.block (false);
*/
histogramArea->updateBackBuffer (); histogramArea->updateBackBuffer ();
histogramArea->queue_draw (); histogramArea->queue_draw ();
@ -723,33 +716,28 @@ HistogramArea::~HistogramArea ()
Gtk::SizeRequestMode HistogramArea::get_request_mode_vfunc () const Gtk::SizeRequestMode HistogramArea::get_request_mode_vfunc () const
{ {
return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; return Gtk::SIZE_REQUEST_CONSTANT_SIZE;
} }
void HistogramArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const void HistogramArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const
{ {
int minimumWidth = 0;
int naturalWidth = 0; minimum_height = 100;
get_preferred_width_vfunc (minimumWidth, naturalWidth); natural_height = 200;
get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height);
} }
void HistogramArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const void HistogramArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const
{ {
minimum_width = 60;
natural_width = 200; minimum_width = 200;
natural_width = 400;
} }
void HistogramArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const void HistogramArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const
{ {
int gHeight = width / 2;
if (gHeight < 100) { minimum_height = 0;
gHeight = 100; natural_height = 0;
}
minimum_height = gHeight * 0.7;
natural_height = gHeight;
} }
void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const

View File

@ -415,7 +415,7 @@ void Options::setDefaults ()
multiDisplayMode = 0; multiDisplayMode = 0;
histogramPosition = 1; histogramPosition = 1;
histogramBar = true; histogramBar = true;
//histogramFullMode = false; histogramAspect = 0.618;
histogramDrawMode = 0; histogramDrawMode = 0;
curvebboxpos = 1; curvebboxpos = 1;
prevdemo = PD_Sidecar; prevdemo = PD_Sidecar;
@ -1291,9 +1291,9 @@ void Options::readFromFile (Glib::ustring fname)
histogramBar = keyFile.get_boolean ("GUI", "HistogramBar"); histogramBar = keyFile.get_boolean ("GUI", "HistogramBar");
} }
//if (keyFile.has_key ("GUI", "HistogramFullMode")) { if (keyFile.has_key ("GUI", "HistogramAspect")) {
// histogramFullMode = keyFile.get_boolean ("GUI", "HistogramFullMode"); histogramAspect = keyFile.get_double ("GUI", "HistogramAspect");
//} }
if (keyFile.has_key ("GUI", "HistogramDrawMode")) { if (keyFile.has_key ("GUI", "HistogramDrawMode")) {
histogramDrawMode = keyFile.get_integer ("GUI", "HistogramDrawMode"); histogramDrawMode = keyFile.get_integer ("GUI", "HistogramDrawMode");
@ -1943,7 +1943,7 @@ void Options::saveToFile (Glib::ustring fname)
keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush);
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_double ("GUI", "HistogramAspect", histogramAspect);
keyFile.set_integer ("GUI", "HistogramDrawMode", histogramDrawMode); keyFile.set_integer ("GUI", "HistogramDrawMode", histogramDrawMode);
keyFile.set_integer ("GUI", "NavigatorRGBUnit", (int)navRGBUnit); keyFile.set_integer ("GUI", "NavigatorRGBUnit", (int)navRGBUnit);
keyFile.set_integer ("GUI", "NavigatorHSVUnit", (int)navHSVUnit); keyFile.set_integer ("GUI", "NavigatorHSVUnit", (int)navHSVUnit);

View File

@ -256,7 +256,7 @@ public:
int histogramPosition; // 0=disabled, 1=left pane, 2=right pane int histogramPosition; // 0=disabled, 1=left pane, 2=right pane
//int histogramWorking; // 0=disabled, 1=left pane, 2=right pane //int histogramWorking; // 0=disabled, 1=left pane, 2=right pane
bool histogramBar; bool histogramBar;
//bool histogramFullMode; float histogramAspect;
int histogramDrawMode; int histogramDrawMode;
bool FileBrowserToolbarSingleRow; bool FileBrowserToolbarSingleRow;
bool hideTPVScrollbar; bool hideTPVScrollbar;