From 63dc64617a8c14cad494fdbd9fa93602015cdfc2 Mon Sep 17 00:00:00 2001 From: Diederik ter Rahe Date: Sat, 10 Jun 2023 09:59:58 -0400 Subject: [PATCH] move filmic graph to within the notebook to save space took this from diederiks ansil branch (@jenshannoschwalm) --- src/iop/filmicrgb.c | 59 ++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/src/iop/filmicrgb.c b/src/iop/filmicrgb.c index edae7f5ebca4..f2c94019bb0c 100644 --- a/src/iop/filmicrgb.c +++ b/src/iop/filmicrgb.c @@ -4335,6 +4335,16 @@ static gboolean area_motion_notify(GtkWidget *widget, const GdkEventMotion *even } } +static void _tab_switch(GtkNotebook *notebook, GtkWidget *page, guint page_num, GtkWidget *area) +{ + if(page_num == 1 || page_num == 4) return; + + g_object_ref(area); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(area)), area); + gtk_box_pack_end(GTK_BOX(page), area, TRUE, TRUE, 0); + g_object_unref(area); +} + void gui_init(dt_iop_module_t *self) { dt_iop_filmicrgb_gui_data_t *g = IOP_GUI_ALLOC(filmicrgb); @@ -4362,9 +4372,16 @@ void gui_init(dt_iop_module_t *self) static struct dt_action_def_t notebook_def = { }; g->notebook = dt_ui_notebook_new(¬ebook_def); dt_action_define_iop(self, NULL, N_("page"), GTK_WIDGET(g->notebook), ¬ebook_def); + GtkSizeGroup *group = gtk_size_group_new(GTK_SIZE_GROUP_VERTICAL); // Page SCENE - self->widget = dt_ui_notebook_page(g->notebook, N_("scene"), NULL); + GtkWidget *page = dt_ui_notebook_page(g->notebook, N_("scene"), NULL); + + self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_size_group_add_widget(group, self->widget); + gtk_box_pack_start(GTK_BOX(page), GTK_WIDGET(self->widget), FALSE, FALSE, 0); + + gtk_box_pack_end(GTK_BOX(page), GTK_WIDGET(g->area), TRUE, TRUE, 0); g->grey_point_source = dt_color_picker_new(self, DT_COLOR_PICKER_AREA | DT_COLOR_PICKER_DENOISE, @@ -4490,7 +4507,11 @@ void gui_init(dt_iop_module_t *self) "decrease if you see magenta or out-of-gamut highlights.")); // Page LOOK - self->widget = dt_ui_notebook_page(g->notebook, N_("look"), NULL); + page = dt_ui_notebook_page(g->notebook, N_("look"), NULL); + + self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_size_group_add_widget(group, self->widget); + gtk_box_pack_start(GTK_BOX(page), GTK_WIDGET(self->widget), FALSE, FALSE, 0); g->contrast = dt_bauhaus_slider_from_params(self, N_("contrast")); dt_bauhaus_slider_set_soft_range(g->contrast, 0.5, 3.0); @@ -4532,7 +4553,11 @@ void gui_init(dt_iop_module_t *self) "increase if shadows and/or highlights are under-saturated.")); // Page DISPLAY - self->widget = dt_ui_notebook_page(g->notebook, N_("display"), NULL); + page = dt_ui_notebook_page(g->notebook, N_("display"), NULL); + + self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_size_group_add_widget(group, self->widget); + gtk_box_pack_start(GTK_BOX(page), GTK_WIDGET(self->widget), FALSE, FALSE, 0); // Black slider g->black_point_target = dt_bauhaus_slider_from_params(self, "black_point_target"); @@ -4557,6 +4582,17 @@ void gui_init(dt_iop_module_t *self) _("luminance of output pure white, this should be 100%\n" "except if you want a faded look")); + // Curve type + g->highlights = dt_bauhaus_combobox_from_params(self, "highlights"); + gtk_widget_set_tooltip_text(g->highlights, _("choose the desired curvature of the filmic spline in highlights.\n" + "hard uses a high curvature resulting in more tonal compression.\n" + "soft uses a low curvature resulting in less tonal compression.")); + + g->shadows = dt_bauhaus_combobox_from_params(self, "shadows"); + gtk_widget_set_tooltip_text(g->shadows, _("choose the desired curvature of the filmic spline in shadows.\n" + "hard uses a high curvature resulting in more tonal compression.\n" + "soft uses a low curvature resulting in less tonal compression.")); + // Page OPTIONS self->widget = dt_ui_notebook_page(g->notebook, N_("options"), NULL); @@ -4575,19 +4611,6 @@ void gui_init(dt_iop_module_t *self) const int pos = dt_bauhaus_combobox_get_from_value(g->preserve_color, DT_FILMIC_METHOD_EUCLIDEAN_NORM_V1); dt_bauhaus_combobox_remove_at(g->preserve_color, pos); - // Curve type - g->highlights = dt_bauhaus_combobox_from_params(self, "highlights"); - gtk_widget_set_tooltip_text(g->highlights, - _("choose the desired curvature of the filmic spline in highlights.\n" - "hard uses a high curvature resulting in more tonal compression.\n" - "soft uses a low curvature resulting in less tonal compression.")); - - g->shadows = dt_bauhaus_combobox_from_params(self, "shadows"); - gtk_widget_set_tooltip_text(g->shadows, - _("choose the desired curvature of the filmic spline in shadows.\n" - "hard uses a high curvature resulting in more tonal compression.\n" - "soft uses a low curvature resulting in less tonal compression.")); - g->custom_grey = dt_bauhaus_toggle_from_params(self, "custom_grey"); gtk_widget_set_tooltip_text(g->custom_grey, /* xgettext:no-c-format */ @@ -4624,7 +4647,9 @@ void gui_init(dt_iop_module_t *self) "this is useful to match natural sensor noise pattern.")); // start building top level widget - self->widget = dt_gui_vbox(g->area, g->notebook); + g_signal_connect(G_OBJECT(g->notebook), "switch_page", G_CALLBACK(_tab_switch), g->area); + g_object_unref(group); + self->widget = dt_gui_vbox(g->notebook); } void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous)