Skip to content

Commit b4f15ae

Browse files
committed
tone equalizer: move exposure and contrast compensation sliders to advanced tab
since there're endless discussions on tweaking the tone equalizer a lowest common denominator might be simply moving the controls for mask exposure and contrast compensation to the advanced tab. since the real estate of the gui is driven by the simple tab, the additional required vertical space is taken from the graph and in masking tab there's unused space. the bar indication the spread of the histogram on masking tab is no longer needed, so removed
1 parent ab9dbbf commit b4f15ae

File tree

1 file changed

+24
-104
lines changed

1 file changed

+24
-104
lines changed

src/iop/toneequal.c

Lines changed: 24 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ typedef struct dt_iop_toneequalizer_gui_data_t
247247

248248
// GTK garbage, nobody cares, no SIMD here
249249
GtkWidget *noise, *ultra_deep_blacks, *deep_blacks, *blacks, *shadows, *midtones, *highlights, *whites, *speculars;
250-
GtkDrawingArea *area, *bar;
250+
GtkDrawingArea *area;
251251
GtkWidget *blending, *smoothing, *quantization;
252252
GtkWidget *method;
253253
GtkWidget *details, *feathering, *contrast_boost, *iterations, *exposure_boost;
@@ -2935,74 +2935,6 @@ static gboolean area_draw(GtkWidget *widget,
29352935
return TRUE;
29362936
}
29372937

2938-
static gboolean _toneequalizer_bar_draw(GtkWidget *widget,
2939-
cairo_t *crf,
2940-
dt_iop_module_t *self)
2941-
{
2942-
// Draw the widget equalizer view
2943-
const dt_iop_toneequalizer_gui_data_t *g = self->gui_data;
2944-
2945-
update_histogram(self);
2946-
2947-
GtkAllocation allocation;
2948-
gtk_widget_get_allocation(widget, &allocation);
2949-
cairo_surface_t *cst = dt_cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
2950-
allocation.width, allocation.height);
2951-
cairo_t *cr = cairo_create(cst);
2952-
2953-
// draw background
2954-
set_color(cr, darktable.bauhaus->graph_bg);
2955-
cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
2956-
cairo_fill_preserve(cr);
2957-
cairo_clip(cr);
2958-
2959-
dt_iop_gui_enter_critical_section(self);
2960-
2961-
if(g->histogram_valid)
2962-
{
2963-
// draw histogram span
2964-
const float left = (g->histogram_first_decile + 8.0f) / 8.0f;
2965-
const float right = (g->histogram_last_decile + 8.0f) / 8.0f;
2966-
const float width = (right - left);
2967-
set_color(cr, darktable.bauhaus->inset_histogram);
2968-
cairo_rectangle(cr, left * allocation.width, 0,
2969-
width * allocation.width, allocation.height);
2970-
cairo_fill(cr);
2971-
2972-
// draw average bar
2973-
set_color(cr, darktable.bauhaus->graph_fg);
2974-
cairo_set_line_width(cr, DT_PIXEL_APPLY_DPI(3));
2975-
const float average = (g->histogram_average + 8.0f) / 8.0f;
2976-
cairo_move_to(cr, average * allocation.width, 0.0);
2977-
cairo_line_to(cr, average * allocation.width, allocation.height);
2978-
cairo_stroke(cr);
2979-
2980-
// draw clipping bars
2981-
cairo_set_source_rgb(cr, 0.75, 0.50, 0);
2982-
cairo_set_line_width(cr, DT_PIXEL_APPLY_DPI(6));
2983-
if(g->histogram_first_decile < -7.9f)
2984-
{
2985-
cairo_move_to(cr, DT_PIXEL_APPLY_DPI(3), 0.0);
2986-
cairo_line_to(cr, DT_PIXEL_APPLY_DPI(3), allocation.height);
2987-
cairo_stroke(cr);
2988-
}
2989-
if(g->histogram_last_decile > - 0.1f)
2990-
{
2991-
cairo_move_to(cr, allocation.width - DT_PIXEL_APPLY_DPI(3), 0.0);
2992-
cairo_line_to(cr, allocation.width - DT_PIXEL_APPLY_DPI(3), allocation.height);
2993-
cairo_stroke(cr);
2994-
}
2995-
}
2996-
2997-
dt_iop_gui_leave_critical_section(self);
2998-
2999-
cairo_set_source_surface(crf, cst, 0, 0);
3000-
cairo_paint(crf);
3001-
cairo_destroy(cr);
3002-
cairo_surface_destroy(cst);
3003-
return TRUE;
3004-
}
3005-
30062938

30072939
static gboolean area_enter_leave_notify(GtkWidget *widget,
30082940
const GdkEventCrossing *event,
@@ -3261,7 +3193,6 @@ static void _develop_preview_pipe_finished_callback(gpointer instance,
32613193

32623194
switch_cursors(self);
32633195
gtk_widget_queue_draw(GTK_WIDGET(g->area));
3264-
gtk_widget_queue_draw(GTK_WIDGET(g->bar));
32653196
}
32663197

32673198

@@ -3381,7 +3312,30 @@ void gui_init(dt_iop_module_t *self)
33813312
gtk_box_pack_start(GTK_BOX(self->widget), g->smoothing, FALSE, FALSE, 0);
33823313
g_signal_connect(G_OBJECT(g->smoothing), "value-changed",
33833314
G_CALLBACK(smoothing_callback), self);
3315+
3316+
g->exposure_boost = dt_bauhaus_slider_from_params(self, "exposure_boost");
3317+
dt_bauhaus_slider_set_soft_range(g->exposure_boost, -4.0, 4.0);
3318+
dt_bauhaus_slider_set_format(g->exposure_boost, _(" EV"));
3319+
gtk_widget_set_tooltip_text
3320+
(g->exposure_boost,
3321+
_("use this to slide the mask average exposure along channels\n"
3322+
"for a better control of the exposure correction with the available nodes."));
3323+
dt_bauhaus_widget_set_quad(g->exposure_boost, self, dtgtk_cairo_paint_wand, FALSE, auto_adjust_exposure_boost,
3324+
_("auto-adjust the average exposure"));
33843325

3326+
g->contrast_boost = dt_bauhaus_slider_from_params(self, "contrast_boost");
3327+
dt_bauhaus_slider_set_soft_range(g->contrast_boost, -2.0, 2.0);
3328+
dt_bauhaus_slider_set_format(g->contrast_boost, _(" EV"));
3329+
gtk_widget_set_tooltip_text
3330+
(g->contrast_boost,
3331+
_("use this to counter the averaging effect of the guided filter\n"
3332+
"and dilate the mask contrast around -4EV\n"
3333+
"this allows to spread the exposure histogram over more channels\n"
3334+
"for a better control of the exposure correction."));
3335+
dt_bauhaus_widget_set_quad(g->contrast_boost, self, dtgtk_cairo_paint_wand, FALSE, auto_adjust_contrast_boost,
3336+
_("auto-adjust the contrast"));
3337+
3338+
33853339
// Masking options
33863340

33873341
self->widget = dt_ui_notebook_page(g->notebook, N_("masking"), NULL);
@@ -3435,18 +3389,6 @@ void gui_init(dt_iop_module_t *self)
34353389
dt_ui_section_label_new(C_("section", "mask post-processing")),
34363390
FALSE, FALSE, 0);
34373391

3438-
g->bar = GTK_DRAWING_AREA(gtk_drawing_area_new());
3439-
gtk_widget_set_size_request(GTK_WIDGET(g->bar), -1, 4);
3440-
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->bar), TRUE, TRUE, 0);
3441-
gtk_widget_set_can_focus(GTK_WIDGET(g->bar), TRUE);
3442-
g_signal_connect(G_OBJECT(g->bar), "draw",
3443-
G_CALLBACK(_toneequalizer_bar_draw), self);
3444-
gtk_widget_set_tooltip_text
3445-
(GTK_WIDGET(g->bar),
3446-
_("mask histogram span between the first and last deciles.\n"
3447-
"the central line shows the average. orange bars appear at extrema"
3448-
" if clipping occurs."));
3449-
34503392
g->quantization = dt_bauhaus_slider_from_params(self, "quantization");
34513393
dt_bauhaus_slider_set_format(g->quantization, _(" EV"));
34523394
gtk_widget_set_tooltip_text
@@ -3455,28 +3397,6 @@ void gui_init(dt_iop_module_t *self)
34553397
"higher values posterize the luminance mask to help the guiding\n"
34563398
"produce piece-wise smooth areas when using high feathering values"));
34573399

3458-
g->exposure_boost = dt_bauhaus_slider_from_params(self, "exposure_boost");
3459-
dt_bauhaus_slider_set_soft_range(g->exposure_boost, -4.0, 4.0);
3460-
dt_bauhaus_slider_set_format(g->exposure_boost, _(" EV"));
3461-
gtk_widget_set_tooltip_text
3462-
(g->exposure_boost,
3463-
_("use this to slide the mask average exposure along channels\n"
3464-
"for a better control of the exposure correction with the available nodes."));
3465-
dt_bauhaus_widget_set_quad(g->exposure_boost, self, dtgtk_cairo_paint_wand, FALSE, auto_adjust_exposure_boost,
3466-
_("auto-adjust the average exposure"));
3467-
3468-
g->contrast_boost = dt_bauhaus_slider_from_params(self, "contrast_boost");
3469-
dt_bauhaus_slider_set_soft_range(g->contrast_boost, -2.0, 2.0);
3470-
dt_bauhaus_slider_set_format(g->contrast_boost, _(" EV"));
3471-
gtk_widget_set_tooltip_text
3472-
(g->contrast_boost,
3473-
_("use this to counter the averaging effect of the guided filter\n"
3474-
"and dilate the mask contrast around -4EV\n"
3475-
"this allows to spread the exposure histogram over more channels\n"
3476-
"for a better control of the exposure correction."));
3477-
dt_bauhaus_widget_set_quad(g->contrast_boost, self, dtgtk_cairo_paint_wand, FALSE, auto_adjust_contrast_boost,
3478-
_("auto-adjust the contrast"));
3479-
34803400
// start building top level widget
34813401
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
34823402

0 commit comments

Comments
 (0)