diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 396b2a1f1..b59a607f4 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -851,6 +851,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) if (tbTopPanel_1) { tbTopPanel_1->signal_toggled().connect ( sigc::mem_fun (*this, &EditorPanel::tbTopPanel_1_toggled) ); } + } EditorPanel::~EditorPanel () @@ -2341,6 +2342,7 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition) histogramPanel->unreference(); } + leftbox->set_position(options.historyPanelWidth * options.histogramAspect); // Make sure the panel gets the right aspect ratio histogramPanel->reorder (Gtk::POS_LEFT); break; @@ -2360,11 +2362,13 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition) histogramPanel->unreference(); } + vboxright->set_position(options.toolPanelWidth * options.histogramAspect); // Make sure the panel gets the right aspect ratio histogramPanel->reorder (Gtk::POS_RIGHT); break; } iareapanel->imageArea->setPointerMotionHListener (histogramPanel); + } diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index ac8835617..407d7fd34 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -48,6 +48,9 @@ HistogramPanel::HistogramPanel () histogramArea = Gtk::manage (new HistogramArea (this)); histogramArea->set_hexpand(true); histogramArea->set_vexpand(true); + histogramArea->set_halign(Gtk::ALIGN_FILL); + histogramArea->set_valign(Gtk::ALIGN_FILL); + histogramRGBArea = Gtk::manage (new HistogramRGBArea ()); histogramRGBArea->set_hexpand(true); histogramRGBArea->set_vexpand(false); @@ -244,19 +247,9 @@ HistogramPanel::~HistogramPanel () void HistogramPanel::resized (Gtk::Allocation& req) { - - /* - rconn.block (true); - - 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); - */ + + // Store current aspect ratio of the histogram + options.histogramAspect = histogramArea->get_height() / (float)histogramArea->get_width(); histogramArea->updateBackBuffer (); histogramArea->queue_draw (); @@ -723,33 +716,28 @@ HistogramArea::~HistogramArea () 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 { - int minimumWidth = 0; - int naturalWidth = 0; - get_preferred_width_vfunc (minimumWidth, naturalWidth); - get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height); + + minimum_height = 100; + natural_height = 200; } 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 { - int gHeight = width / 2; - if (gHeight < 100) { - gHeight = 100; - } - - minimum_height = gHeight * 0.7; - natural_height = gHeight; + minimum_height = 0; + natural_height = 0; } void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const diff --git a/rtgui/options.cc b/rtgui/options.cc index 501756d3f..788bdb440 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -415,7 +415,7 @@ void Options::setDefaults () multiDisplayMode = 0; histogramPosition = 1; histogramBar = true; - //histogramFullMode = false; + histogramAspect = 0.618; histogramDrawMode = 0; curvebboxpos = 1; prevdemo = PD_Sidecar; @@ -1291,9 +1291,9 @@ void Options::readFromFile (Glib::ustring fname) histogramBar = keyFile.get_boolean ("GUI", "HistogramBar"); } - //if (keyFile.has_key ("GUI", "HistogramFullMode")) { - // histogramFullMode = keyFile.get_boolean ("GUI", "HistogramFullMode"); - //} + if (keyFile.has_key ("GUI", "HistogramAspect")) { + histogramAspect = keyFile.get_double ("GUI", "HistogramAspect"); + } if (keyFile.has_key ("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_integer ("GUI", "HistogramPosition", histogramPosition); 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", "NavigatorRGBUnit", (int)navRGBUnit); keyFile.set_integer ("GUI", "NavigatorHSVUnit", (int)navHSVUnit); diff --git a/rtgui/options.h b/rtgui/options.h index 33835b664..08e7288bb 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -256,7 +256,7 @@ public: int histogramPosition; // 0=disabled, 1=left pane, 2=right pane //int histogramWorking; // 0=disabled, 1=left pane, 2=right pane bool histogramBar; - //bool histogramFullMode; + float histogramAspect; int histogramDrawMode; bool FileBrowserToolbarSingleRow; bool hideTPVScrollbar;