Skip to content

Commit a5e0a58

Browse files
authored
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 6cefa8f commit a5e0a58

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-
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
GdkEventCrossing *event,
@@ -3262,7 +3194,6 @@ static void _develop_preview_pipe_finished_callback(gpointer instance,
32623194

32633195
switch_cursors(self);
32643196
gtk_widget_queue_draw(GTK_WIDGET(g->area));
3265-
gtk_widget_queue_draw(GTK_WIDGET(g->bar));
32663197
}
32673198

32683199

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

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

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

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

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

0 commit comments

Comments
 (0)