diff --git a/.gitignore b/.gitignore
index 82d5f81fbcfe..eb7e6203a75f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,5 @@ tools/iop_deps.pdf
cscope.out
.*.swp
.vscode/
+.idea
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 000000000000..79b3c94830ba
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000000..94a25f7f4cb4
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/bauhaus/bauhaus.c b/src/bauhaus/bauhaus.c
index 27f897a3fb33..94d378456b06 100644
--- a/src/bauhaus/bauhaus.c
+++ b/src/bauhaus/bauhaus.c
@@ -72,8 +72,7 @@ static void set_bg_normal(cairo_t *cr)
static void set_bg_focus(cairo_t *cr)
{
- cairo_set_source_rgb(cr, darktable.bauhaus->bg_focus, darktable.bauhaus->bg_focus,
- darktable.bauhaus->bg_focus);
+ cairo_set_source_rgb(cr, darktable.bauhaus->bg_focus, darktable.bauhaus->bg_focus, darktable.bauhaus->bg_focus);
}
static void set_text_color(cairo_t *cr, int sensitive)
@@ -117,9 +116,12 @@ static int show_pango_text(cairo_t *cr, char *text, float x_pos, float y_pos, fl
pango_layout_set_width(layout, (int)(PANGO_SCALE * max_width + 0.5f));
}
- if(text) {
+ if(text)
+ {
pango_layout_set_text(layout, text, -1);
- } else {
+ }
+ else
+ {
// length of -1 is not allowed with NULL string (wtf)
pango_layout_set_text(layout, NULL, 0);
}
@@ -129,7 +131,7 @@ static int show_pango_text(cairo_t *cr, char *text, float x_pos, float y_pos, fl
int pango_width, pango_height;
pango_layout_get_size(layout, &pango_width, &pango_height);
- float text_width = ((double)pango_width/PANGO_SCALE);
+ float text_width = ((double)pango_width / PANGO_SCALE);
if(right_aligned) x_pos -= text_width;
@@ -213,8 +215,8 @@ static float get_slider_line_offset(float pos, float scale, float x, float y, fl
}
// draw a loupe guideline for the quadratic zoom in in the slider interface:
-static void draw_slider_line(cairo_t *cr, float pos, float off, float scale, const int width,
- const int height, const int ht)
+static void draw_slider_line(cairo_t *cr, float pos, float off, float scale, const int width, const int height,
+ const int ht)
{
// pos is normalized position [0,1], offset is on that scale.
// ht is in pixels here
@@ -310,8 +312,7 @@ static gboolean dt_bauhaus_popup_scroll(GtkWidget *widget, GdkEventScroll *event
switch(darktable.bauhaus->current->type)
{
case DT_BAUHAUS_COMBOBOX:
- if(dt_gui_get_scroll_unit_deltas(event, NULL, &delta_y))
- combobox_popup_scroll(delta_y);
+ if(dt_gui_get_scroll_unit_deltas(event, NULL, &delta_y)) combobox_popup_scroll(delta_y);
break;
case DT_BAUHAUS_SLIDER:
break;
@@ -499,11 +500,11 @@ void dt_bauhaus_init()
GtkWidget *root_window = dt_ui_main_window(darktable.gui->ui);
GtkStyleContext *ctx = gtk_style_context_new();
GtkWidgetPath *path;
- path = gtk_widget_path_new ();
+ path = gtk_widget_path_new();
int pos = gtk_widget_path_append_type(path, GTK_TYPE_WIDGET);
gtk_widget_path_iter_set_name(path, pos, "iop-plugin-ui");
gtk_style_context_set_path(ctx, path);
- gtk_style_context_set_screen (ctx, gtk_widget_get_screen(root_window));
+ gtk_style_context_set_screen(ctx, gtk_widget_get_screen(root_window));
GdkRGBA color, selected_color, bg_color, selected_bg_color;
gtk_style_context_get_color(ctx, GTK_STATE_FLAG_NORMAL, &color);
@@ -581,17 +582,18 @@ void dt_bauhaus_init()
gtk_widget_set_can_focus(darktable.bauhaus->popup_area, TRUE);
gtk_widget_add_events(darktable.bauhaus->popup_area, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- | GDK_KEY_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK
- | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
+ | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ | GDK_KEY_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK
+ | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
- g_signal_connect(G_OBJECT(darktable.bauhaus->popup_window), "show", G_CALLBACK(dt_bauhaus_window_show), (gpointer)NULL);
+ g_signal_connect(G_OBJECT(darktable.bauhaus->popup_window), "show", G_CALLBACK(dt_bauhaus_window_show),
+ (gpointer)NULL);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "draw", G_CALLBACK(dt_bauhaus_popup_draw),
(gpointer)NULL);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_window), "motion-notify-event",
G_CALLBACK(dt_bauhaus_window_motion_notify), (gpointer)NULL);
- g_signal_connect(G_OBJECT(darktable.bauhaus->popup_window), "button-press-event", G_CALLBACK(dt_bauhaus_window_button_press),
- (gpointer)NULL);
+ g_signal_connect(G_OBJECT(darktable.bauhaus->popup_window), "button-press-event",
+ G_CALLBACK(dt_bauhaus_window_button_press), (gpointer)NULL);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "motion-notify-event",
G_CALLBACK(dt_bauhaus_popup_motion_notify), (gpointer)NULL);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "leave-notify-event",
@@ -604,8 +606,8 @@ void dt_bauhaus_init()
// G_CALLBACK (dt_bauhaus_popup_button_release), (gpointer)NULL);
g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "key-press-event",
G_CALLBACK(dt_bauhaus_popup_key_press), (gpointer)NULL);
- g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "scroll-event",
- G_CALLBACK(dt_bauhaus_popup_scroll), (gpointer)NULL);
+ g_signal_connect(G_OBJECT(darktable.bauhaus->popup_area), "scroll-event", G_CALLBACK(dt_bauhaus_popup_scroll),
+ (gpointer)NULL);
}
void dt_bauhaus_cleanup()
@@ -650,9 +652,8 @@ static void dt_bauhaus_widget_init(dt_bauhaus_widget_t *w, dt_iop_module_t *self
gtk_widget_set_size_request(GTK_WIDGET(w), -1, get_line_height());
gtk_widget_add_events(GTK_WIDGET(w), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK
- | GDK_SMOOTH_SCROLL_MASK);
+ | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
g_signal_connect(G_OBJECT(w), "draw", G_CALLBACK(dt_bauhaus_draw), NULL);
@@ -670,7 +671,7 @@ void dt_bauhaus_combobox_set_default(GtkWidget *widget, int def)
d->defpos = def;
}
-void dt_bauhaus_slider_set_hard_min(GtkWidget* widget, float val)
+void dt_bauhaus_slider_set_hard_min(GtkWidget *widget, float val)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
@@ -679,25 +680,25 @@ void dt_bauhaus_slider_set_hard_min(GtkWidget* widget, float val)
d->hard_min = rawval;
d->min = MAX(d->min, d->hard_min);
d->soft_min = MAX(d->soft_min, d->hard_min);
- if(rawval > d->hard_max) dt_bauhaus_slider_set_hard_max(widget,val);
+ if(rawval > d->hard_max) dt_bauhaus_slider_set_hard_max(widget, val);
if(pos < val)
{
- dt_bauhaus_slider_set_soft(widget,val);
+ dt_bauhaus_slider_set_soft(widget, val);
}
- else
+ else
{
- dt_bauhaus_slider_set_soft(widget,pos);
+ dt_bauhaus_slider_set_soft(widget, pos);
}
}
-float dt_bauhaus_slider_get_hard_min(GtkWidget* widget)
+float dt_bauhaus_slider_get_hard_min(GtkWidget *widget)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
return d->callback(widget, d->hard_min, DT_BAUHAUS_GET);
}
-void dt_bauhaus_slider_set_hard_max(GtkWidget* widget, float val)
+void dt_bauhaus_slider_set_hard_max(GtkWidget *widget, float val)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
@@ -706,53 +707,54 @@ void dt_bauhaus_slider_set_hard_max(GtkWidget* widget, float val)
d->hard_max = rawval;
d->max = MIN(d->max, d->hard_max);
d->soft_max = MIN(d->soft_max, d->hard_max);
- if(rawval < d->hard_min) dt_bauhaus_slider_set_hard_min(widget,val);
- if(pos > val) {
+ if(rawval < d->hard_min) dt_bauhaus_slider_set_hard_min(widget, val);
+ if(pos > val)
+ {
- dt_bauhaus_slider_set_soft(widget,val);
- }
- else
+ dt_bauhaus_slider_set_soft(widget, val);
+ }
+ else
{
- dt_bauhaus_slider_set_soft(widget,pos);
+ dt_bauhaus_slider_set_soft(widget, pos);
}
}
-float dt_bauhaus_slider_get_hard_max(GtkWidget* widget)
+float dt_bauhaus_slider_get_hard_max(GtkWidget *widget)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
return d->callback(widget, d->hard_max, DT_BAUHAUS_GET);
}
-void dt_bauhaus_slider_set_soft_min(GtkWidget* widget, float val)
+void dt_bauhaus_slider_set_soft_min(GtkWidget *widget, float val)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
float pos = dt_bauhaus_slider_get(widget);
float rawval = d->callback(widget, val, DT_BAUHAUS_SET);
d->soft_min = rawval;
- d->hard_min = MIN(d->hard_min,d->soft_min);
- d->min = d->soft_min;
- if(rawval > d->soft_max) dt_bauhaus_slider_set_soft_max(widget,val);
- if(rawval > d->hard_max) dt_bauhaus_slider_set_hard_max(widget,val);
- if(pos < val)
+ d->hard_min = MIN(d->hard_min, d->soft_min);
+ d->min = d->soft_min;
+ if(rawval > d->soft_max) dt_bauhaus_slider_set_soft_max(widget, val);
+ if(rawval > d->hard_max) dt_bauhaus_slider_set_hard_max(widget, val);
+ if(pos < val)
{
- dt_bauhaus_slider_set_soft(widget,val);
- }
- else
+ dt_bauhaus_slider_set_soft(widget, val);
+ }
+ else
{
- dt_bauhaus_slider_set_soft(widget,pos);
+ dt_bauhaus_slider_set_soft(widget, pos);
}
}
-float dt_bauhaus_slider_get_soft_min(GtkWidget* widget)
+float dt_bauhaus_slider_get_soft_min(GtkWidget *widget)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
return d->callback(widget, d->soft_min, DT_BAUHAUS_GET);
}
-void dt_bauhaus_slider_set_soft_max(GtkWidget* widget, float val)
+void dt_bauhaus_slider_set_soft_max(GtkWidget *widget, float val)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
@@ -760,17 +762,20 @@ void dt_bauhaus_slider_set_soft_max(GtkWidget* widget, float val)
float rawval = d->callback(widget, val, DT_BAUHAUS_SET);
d->soft_max = rawval;
d->hard_max = MAX(d->soft_max, d->hard_max);
- d->max = d->soft_max;
- if(rawval < d->soft_min) dt_bauhaus_slider_set_soft_min(widget,val);
- if(rawval < d->hard_min) dt_bauhaus_slider_set_hard_min(widget,val);
- if(pos > val) {
- dt_bauhaus_slider_set_soft(widget,val);
- } else {
- dt_bauhaus_slider_set_soft(widget,pos);
+ d->max = d->soft_max;
+ if(rawval < d->soft_min) dt_bauhaus_slider_set_soft_min(widget, val);
+ if(rawval < d->hard_min) dt_bauhaus_slider_set_hard_min(widget, val);
+ if(pos > val)
+ {
+ dt_bauhaus_slider_set_soft(widget, val);
+ }
+ else
+ {
+ dt_bauhaus_slider_set_soft(widget, pos);
}
}
-float dt_bauhaus_slider_get_soft_max(GtkWidget* widget)
+float dt_bauhaus_slider_get_soft_max(GtkWidget *widget)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
dt_bauhaus_slider_data_t *d = &w->data.slider;
@@ -825,8 +830,7 @@ void dt_bauhaus_widget_set_label(GtkWidget *widget, const char *section, const c
{
*val = 0;
if(!g_list_find_custom(darktable.bauhaus->key_mod, mod, (GCompareFunc)strcmp))
- darktable.bauhaus->key_mod
- = g_list_insert_sorted(darktable.bauhaus->key_mod, mod, (GCompareFunc)strcmp);
+ darktable.bauhaus->key_mod = g_list_insert_sorted(darktable.bauhaus->key_mod, mod, (GCompareFunc)strcmp);
else
g_free(mod);
@@ -840,7 +844,7 @@ void dt_bauhaus_widget_set_label(GtkWidget *widget, const char *section, const c
}
}
-const char* dt_bauhaus_widget_get_label(GtkWidget *widget)
+const char *dt_bauhaus_widget_get_label(GtkWidget *widget)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
return w->label;
@@ -880,20 +884,20 @@ GtkWidget *dt_bauhaus_slider_new(dt_iop_module_t *self)
return dt_bauhaus_slider_new_with_range(self, 0.0, 1.0, 0.1, 0.5, 3);
}
-GtkWidget *dt_bauhaus_slider_new_with_range(dt_iop_module_t *self, float min, float max, float step,
- float defval, int digits)
+GtkWidget *dt_bauhaus_slider_new_with_range(dt_iop_module_t *self, float min, float max, float step, float defval,
+ int digits)
{
return dt_bauhaus_slider_new_with_range_and_feedback(self, min, max, step, defval, digits, 1);
}
-GtkWidget *dt_bauhaus_slider_new_with_range_and_feedback(dt_iop_module_t *self, float min, float max,
- float step, float defval, int digits, int feedback)
+GtkWidget *dt_bauhaus_slider_new_with_range_and_feedback(dt_iop_module_t *self, float min, float max, float step,
+ float defval, int digits, int feedback)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(g_object_new(DT_BAUHAUS_WIDGET_TYPE, NULL));
- return dt_bauhaus_slider_from_widget(w,self, min, max, step, defval, digits, feedback);
+ return dt_bauhaus_slider_from_widget(w, self, min, max, step, defval, digits, feedback);
}
-GtkWidget *dt_bauhaus_slider_from_widget(dt_bauhaus_widget_t* w,dt_iop_module_t *self, float min, float max,
- float step, float defval, int digits, int feedback)
+GtkWidget *dt_bauhaus_slider_from_widget(dt_bauhaus_widget_t *w, dt_iop_module_t *self, float min, float max,
+ float step, float defval, int digits, int feedback)
{
w->type = DT_BAUHAUS_SLIDER;
dt_bauhaus_widget_init(w, self);
@@ -921,14 +925,12 @@ GtkWidget *dt_bauhaus_slider_from_widget(dt_bauhaus_widget_t* w,dt_iop_module_t
gtk_widget_add_events(GTK_WIDGET(w), GDK_KEY_PRESS_MASK);
gtk_widget_set_can_focus(GTK_WIDGET(w), TRUE);
- g_signal_connect(G_OBJECT(w), "button-press-event", G_CALLBACK(dt_bauhaus_slider_button_press),
- (gpointer)NULL);
+ g_signal_connect(G_OBJECT(w), "button-press-event", G_CALLBACK(dt_bauhaus_slider_button_press), (gpointer)NULL);
g_signal_connect(G_OBJECT(w), "button-release-event", G_CALLBACK(dt_bauhaus_slider_button_release),
(gpointer)NULL);
g_signal_connect(G_OBJECT(w), "scroll-event", G_CALLBACK(dt_bauhaus_slider_scroll), (gpointer)NULL);
g_signal_connect(G_OBJECT(w), "key-press-event", G_CALLBACK(dt_bauhaus_slider_key_press), (gpointer)NULL);
- g_signal_connect(G_OBJECT(w), "motion-notify-event", G_CALLBACK(dt_bauhaus_slider_motion_notify),
- (gpointer)NULL);
+ g_signal_connect(G_OBJECT(w), "motion-notify-event", G_CALLBACK(dt_bauhaus_slider_motion_notify), (gpointer)NULL);
g_signal_connect(G_OBJECT(w), "destroy", G_CALLBACK(dt_bauhaus_slider_destroy), (gpointer)NULL);
return GTK_WIDGET(w);
}
@@ -948,11 +950,11 @@ static void dt_bauhaus_combobox_destroy(dt_bauhaus_widget_t *widget, gpointer us
GtkWidget *dt_bauhaus_combobox_new(dt_iop_module_t *self)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(g_object_new(DT_BAUHAUS_WIDGET_TYPE, NULL));
- dt_bauhaus_combobox_from_widget(w,self);
+ dt_bauhaus_combobox_from_widget(w, self);
return GTK_WIDGET(w);
}
-void dt_bauhaus_combobox_from_widget(dt_bauhaus_widget_t* w,dt_iop_module_t *self)
+void dt_bauhaus_combobox_from_widget(dt_bauhaus_widget_t *w, dt_iop_module_t *self)
{
w->type = DT_BAUHAUS_COMBOBOX;
dt_bauhaus_widget_init(w, self);
@@ -968,8 +970,7 @@ void dt_bauhaus_combobox_from_widget(dt_bauhaus_widget_t* w,dt_iop_module_t *sel
gtk_widget_add_events(GTK_WIDGET(w), GDK_KEY_PRESS_MASK);
gtk_widget_set_can_focus(GTK_WIDGET(w), TRUE);
- g_signal_connect(G_OBJECT(w), "button-press-event", G_CALLBACK(dt_bauhaus_combobox_button_press),
- (gpointer)NULL);
+ g_signal_connect(G_OBJECT(w), "button-press-event", G_CALLBACK(dt_bauhaus_combobox_button_press), (gpointer)NULL);
g_signal_connect(G_OBJECT(w), "button-release-event", G_CALLBACK(dt_bauhaus_popup_button_release),
(gpointer)NULL);
g_signal_connect(G_OBJECT(w), "scroll-event", G_CALLBACK(dt_bauhaus_combobox_scroll), (gpointer)NULL);
@@ -1033,7 +1034,7 @@ void dt_bauhaus_combobox_remove_at(GtkWidget *widget, int pos)
d->num_labels--;
}
-void dt_bauhaus_combobox_insert(GtkWidget *widget, const char *text,int pos)
+void dt_bauhaus_combobox_insert(GtkWidget *widget, const char *text, int pos)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
if(w->type != DT_BAUHAUS_COMBOBOX) return;
@@ -1185,8 +1186,7 @@ static void dt_bauhaus_draw_indicator(dt_bauhaus_widget_t *w, float pos, cairo_t
const float r = 1.0f - (ht + 4.0f) / wd;
set_indicator_color(cr, 1);
#ifndef DT_BAUHAUS_OLD
- cairo_translate(cr, (l + pos * (r - l)) * wd,
- get_line_height() * (darktable.bauhaus->label_font_size + 0.25f));
+ cairo_translate(cr, (l + pos * (r - l)) * wd, get_line_height() * (darktable.bauhaus->label_font_size + 0.25f));
cairo_scale(cr, 1.0f, -1.0f);
draw_equilateral_triangle(cr, ht * get_marker_size());
cairo_fill_preserve(cr);
@@ -1413,9 +1413,9 @@ static void dt_bauhaus_widget_accept(dt_bauhaus_widget_t *w)
case DT_BAUHAUS_SLIDER:
{
dt_bauhaus_slider_data_t *d = &w->data.slider;
- const float mouse_off = get_slider_line_offset(
- d->oldpos, d->scale, darktable.bauhaus->end_mouse_x / width,
- darktable.bauhaus->end_mouse_y / height, allocation.height / (float)height, allocation.width);
+ const float mouse_off = get_slider_line_offset(d->oldpos, d->scale, darktable.bauhaus->end_mouse_x / width,
+ darktable.bauhaus->end_mouse_y / height,
+ allocation.height / (float)height, allocation.width);
dt_bauhaus_slider_set_normalized(w, d->oldpos + mouse_off);
d->oldpos = d->pos;
break;
@@ -1667,8 +1667,7 @@ static gboolean dt_bauhaus_draw(GtkWidget *widget, cairo_t *crf, gpointer user_d
case DT_BAUHAUS_COMBOBOX:
{
// draw label and quad area at right end
- float label_width
- = show_pango_text(cr, w->label, 2, 0, 0, FALSE, gtk_widget_is_sensitive(widget), FALSE);
+ float label_width = show_pango_text(cr, w->label, 2, 0, 0, FALSE, gtk_widget_is_sensitive(widget), FALSE);
dt_bauhaus_draw_quad(w, cr);
if(gtk_widget_is_sensitive(widget))
@@ -1676,8 +1675,8 @@ static gboolean dt_bauhaus_draw(GtkWidget *widget, cairo_t *crf, gpointer user_d
dt_bauhaus_combobox_data_t *d = &w->data.combobox;
gchar *text = d->text;
if(d->active >= 0) text = (gchar *)g_list_nth_data(d->labels, d->active);
- show_pango_text(cr, text, width - 4 - height, 0, width - 4 - height - label_width - height, TRUE,
- TRUE, FALSE);
+ show_pango_text(cr, text, width - 4 - height, 0, width - 4 - height - label_width - height, TRUE, TRUE,
+ FALSE);
}
break;
}
@@ -1913,8 +1912,10 @@ static gboolean dt_bauhaus_combobox_button_press(GtkWidget *widget, GdkEventButt
gtk_widget_get_allocation(widget, &allocation);
dt_bauhaus_widget_t *w = (dt_bauhaus_widget_t *)widget;
if(w->type != DT_BAUHAUS_COMBOBOX) return FALSE;
- if(w->module) dt_iop_request_focus(w->module);
- else gtk_widget_grab_focus(GTK_WIDGET(w));
+ if(w->module)
+ dt_iop_request_focus(w->module);
+ else
+ gtk_widget_grab_focus(GTK_WIDGET(w));
GtkAllocation tmp;
gtk_widget_get_allocation(GTK_WIDGET(w), &tmp);
dt_bauhaus_combobox_data_t *d = &w->data.combobox;
@@ -1959,7 +1960,8 @@ float dt_bauhaus_slider_get(GtkWidget *widget)
dt_bauhaus_widget_t *w = (dt_bauhaus_widget_t *)DT_BAUHAUS_WIDGET(widget);
if(w->type != DT_BAUHAUS_SLIDER) return -1.0f;
dt_bauhaus_slider_data_t *d = &w->data.slider;
- if(d->max == d->min) {
+ if(d->max == d->min)
+ {
return d->max;
}
float rawval = d->min + d->pos * (d->max - d->min);
@@ -2044,7 +2046,8 @@ void dt_bauhaus_slider_set_format(GtkWidget *widget, const char *format)
g_strlcpy(d->format, format, sizeof(d->format));
}
-void dt_bauhaus_slider_set_callback(GtkWidget *widget, float (*callback)(GtkWidget *self, float value, dt_bauhaus_callback_t dir))
+void dt_bauhaus_slider_set_callback(GtkWidget *widget,
+ float (*callback)(GtkWidget *self, float value, dt_bauhaus_callback_t dir))
{
dt_bauhaus_widget_t *w = (dt_bauhaus_widget_t *)DT_BAUHAUS_WIDGET(widget);
if(w->type != DT_BAUHAUS_SLIDER) return;
@@ -2167,9 +2170,8 @@ static gboolean dt_bauhaus_popup_key_press(GtkWidget *widget, GdkEventKey *event
else if(darktable.bauhaus->keys_cnt > 0
&& (event->keyval == GDK_KEY_BackSpace || event->keyval == GDK_KEY_Delete))
{
- darktable.bauhaus->keys_cnt
- -= (darktable.bauhaus->keys + darktable.bauhaus->keys_cnt)
- - g_utf8_prev_char(darktable.bauhaus->keys + darktable.bauhaus->keys_cnt);
+ darktable.bauhaus->keys_cnt -= (darktable.bauhaus->keys + darktable.bauhaus->keys_cnt)
+ - g_utf8_prev_char(darktable.bauhaus->keys + darktable.bauhaus->keys_cnt);
darktable.bauhaus->keys[darktable.bauhaus->keys_cnt] = 0;
gtk_widget_queue_draw(darktable.bauhaus->popup_area);
}
@@ -2226,8 +2228,10 @@ static gboolean dt_bauhaus_slider_button_press(GtkWidget *widget, GdkEventButton
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
dt_bauhaus_widget_t *w = (dt_bauhaus_widget_t *)widget;
- if(w->module) dt_iop_request_focus(w->module);
- else gtk_widget_grab_focus(GTK_WIDGET(w));
+ if(w->module)
+ dt_iop_request_focus(w->module);
+ else
+ gtk_widget_grab_focus(GTK_WIDGET(w));
GtkAllocation tmp;
gtk_widget_get_allocation(GTK_WIDGET(w), &tmp);
if(w->quad_paint && (event->x > allocation.width - allocation.height))
diff --git a/src/bauhaus/bauhaus.h b/src/bauhaus/bauhaus.h
index 392a0524842b..9686c66e7d86 100644
--- a/src/bauhaus/bauhaus.h
+++ b/src/bauhaus/bauhaus.h
@@ -39,7 +39,7 @@
#define DT_BAUHAUS_WIDGET_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST((obj), DT_BAUHAUS_WIDGET, DtBauhausWidgetClass))
#define DT_IS_BAUHAUS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), DT_BAUHAUS_WIDGET_TYPE))
#define DT_IS_BAUHAUS_WIDGET_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((obj), DT_BAUHAUS_WIDGET_TYPE))
-#define DT_BAUHAUS_WIDGET_GET_CLASS \
+#define DT_BAUHAUS_WIDGET_GET_CLASS \
(G_TYPE_INSTANCE_GET_CLASS((obj), DT_BAUHAUS_WIDGET_TYPE, DtBauhausWidgetClass))
extern GType DT_BAUHAUS_WIDGET_TYPE;
@@ -82,10 +82,10 @@ typedef struct dt_bauhaus_slider_data_t
char format[24]; // numeric value is printed with this string
- int is_dragging; // indicates is mouse is dragging slider
- int is_changed; // indicates new data
- guint timeout_handle; // used to store id of timeout routine
- float (*callback)(GtkWidget*, float, dt_bauhaus_callback_t); // callback function
+ int is_dragging; // indicates is mouse is dragging slider
+ int is_changed; // indicates new data
+ guint timeout_handle; // used to store id of timeout routine
+ float (*callback)(GtkWidget *, float, dt_bauhaus_callback_t); // callback function
} dt_bauhaus_slider_data_t;
typedef enum dt_bauhaus_combobox_alignment_t
@@ -227,7 +227,7 @@ void dt_bauhaus_cleanup();
// common functions:
// set the label text:
void dt_bauhaus_widget_set_label(GtkWidget *w, const char *section, const char *label);
-const char* dt_bauhaus_widget_get_label(GtkWidget *w);
+const char *dt_bauhaus_widget_get_label(GtkWidget *w);
// attach a custom painted quad to the space at the right side (overwriting the default icon if any):
void dt_bauhaus_widget_set_quad_paint(GtkWidget *w, dt_bauhaus_quad_paint_f f, int paint_flags);
// make this quad a toggle button:
@@ -238,27 +238,27 @@ void dt_bauhaus_show_popup(dt_bauhaus_widget_t *w);
// slider:
GtkWidget *dt_bauhaus_slider_new(dt_iop_module_t *self);
-GtkWidget *dt_bauhaus_slider_new_with_range(dt_iop_module_t *self, float min, float max, float step,
- float defval, int digits);
-GtkWidget *dt_bauhaus_slider_new_with_range_and_feedback(dt_iop_module_t *self, float min, float max,
- float step, float defval, int digits, int feedback);
+GtkWidget *dt_bauhaus_slider_new_with_range(dt_iop_module_t *self, float min, float max, float step, float defval,
+ int digits);
+GtkWidget *dt_bauhaus_slider_new_with_range_and_feedback(dt_iop_module_t *self, float min, float max, float step,
+ float defval, int digits, int feedback);
-GtkWidget *dt_bauhaus_slider_from_widget(dt_bauhaus_widget_t* widget, dt_iop_module_t *self, float min, float max,
- float step, float defval, int digits, int feedback);
+GtkWidget *dt_bauhaus_slider_from_widget(dt_bauhaus_widget_t *widget, dt_iop_module_t *self, float min, float max,
+ float step, float defval, int digits, int feedback);
// outside doesn't see the real type, we cast it internally.
void dt_bauhaus_slider_set(GtkWidget *w, float pos);
void dt_bauhaus_slider_set_soft(GtkWidget *w, float pos);
float dt_bauhaus_slider_get(GtkWidget *w);
-void dt_bauhaus_slider_set_soft_min(GtkWidget* w, float val);
-float dt_bauhaus_slider_get_soft_min(GtkWidget* w);
-void dt_bauhaus_slider_set_soft_max(GtkWidget* w, float val);
-float dt_bauhaus_slider_get_soft_max(GtkWidget* w);
+void dt_bauhaus_slider_set_soft_min(GtkWidget *w, float val);
+float dt_bauhaus_slider_get_soft_min(GtkWidget *w);
+void dt_bauhaus_slider_set_soft_max(GtkWidget *w, float val);
+float dt_bauhaus_slider_get_soft_max(GtkWidget *w);
-void dt_bauhaus_slider_set_hard_min(GtkWidget* w, float val);
-float dt_bauhaus_slider_get_hard_min(GtkWidget* w);
-void dt_bauhaus_slider_set_hard_max(GtkWidget* w, float val);
-float dt_bauhaus_slider_get_hard_max(GtkWidget* w);
+void dt_bauhaus_slider_set_hard_min(GtkWidget *w, float val);
+float dt_bauhaus_slider_get_hard_min(GtkWidget *w);
+void dt_bauhaus_slider_set_hard_max(GtkWidget *w, float val);
+float dt_bauhaus_slider_get_hard_max(GtkWidget *w);
void dt_bauhaus_slider_set_digits(GtkWidget *w, int val);
int dt_bauhaus_slider_get_digits(GtkWidget *w);
@@ -271,17 +271,18 @@ void dt_bauhaus_slider_set_stop(GtkWidget *widget, float stop, float r, float g,
void dt_bauhaus_slider_clear_stops(GtkWidget *widget);
void dt_bauhaus_slider_set_default(GtkWidget *widget, float def);
void dt_bauhaus_slider_enable_soft_boundaries(GtkWidget *widget, float hard_min, float hard_max);
-void dt_bauhaus_slider_set_callback(GtkWidget *widget, float (*callback)(GtkWidget *self, float value, dt_bauhaus_callback_t dir));
+void dt_bauhaus_slider_set_callback(GtkWidget *widget,
+ float (*callback)(GtkWidget *self, float value, dt_bauhaus_callback_t dir));
// combobox:
-void dt_bauhaus_combobox_from_widget(dt_bauhaus_widget_t* widget,dt_iop_module_t *self);
+void dt_bauhaus_combobox_from_widget(dt_bauhaus_widget_t *widget, dt_iop_module_t *self);
GtkWidget *dt_bauhaus_combobox_new(dt_iop_module_t *self);
void dt_bauhaus_combobox_add(GtkWidget *widget, const char *text);
void dt_bauhaus_combobox_add_aligned(GtkWidget *widget, const char *text, dt_bauhaus_combobox_alignment_t align);
void dt_bauhaus_combobox_set(GtkWidget *w, int pos);
void dt_bauhaus_combobox_remove_at(GtkWidget *widget, int pos);
-void dt_bauhaus_combobox_insert(GtkWidget *widget, const char *text,int pos);
+void dt_bauhaus_combobox_insert(GtkWidget *widget, const char *text, int pos);
int dt_bauhaus_combobox_length(GtkWidget *widget);
void dt_bauhaus_combobox_set_editable(GtkWidget *w, int editable);
int dt_bauhaus_combobox_get_editable(GtkWidget *w);
diff --git a/src/chart/cairo.c b/src/chart/cairo.c
index acc27171dd19..6ad89fea0032 100644
--- a/src/chart/cairo.c
+++ b/src/chart/cairo.c
@@ -127,7 +127,8 @@ void draw_color_boxes_outline(cairo_t *cr, point_t *bb, chart_t *chart)
_draw_boxes(cr, bb, chart->box_table);
}
-void draw_color_boxes_inside(cairo_t *cr, point_t *bb, chart_t *chart, float shrink, float line_width, gboolean colored)
+void draw_color_boxes_inside(cairo_t *cr, point_t *bb, chart_t *chart, float shrink, float line_width,
+ gboolean colored)
{
GHashTableIter table_iter;
gpointer key, value;
diff --git a/src/chart/colorchart.c b/src/chart/colorchart.c
index 441424f15924..2e5ffa53ef72 100644
--- a/src/chart/colorchart.c
+++ b/src/chart/colorchart.c
@@ -27,7 +27,8 @@
#define MAX_LINE_LENGTH 512
-typedef enum parser_state_t {
+typedef enum parser_state_t
+{
BLOCK_NONE = 0,
BLOCK_BOXES,
BLOCK_BOX_SHRINK,
diff --git a/src/chart/main.c b/src/chart/main.c
index 472092fb472d..849ed80e1ee9 100644
--- a/src/chart/main.c
+++ b/src/chart/main.c
@@ -604,8 +604,7 @@ static void export_raw(dt_lut_t *self, char *filename, char *name, char *descrip
GList *patch_names = NULL;
char *gray_ramp_key = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(self->gray_ramp));
- if(gray_ramp_key)
- patch_names = g_hash_table_lookup(self->chart->patch_sets, gray_ramp_key);
+ if(gray_ramp_key) patch_names = g_hash_table_lookup(self->chart->patch_sets, gray_ramp_key);
const int num_gray = g_list_length(patch_names);
@@ -708,13 +707,15 @@ static void add_hdr_patches(int *N, double **target_L, double **target_a, double
for(int j = 0; j < *N; j++)
{
- if((*target_L)[j] == 100.0 && (*target_a)[j] == 0.0 && (*target_b)[j] == 0.0 && (*colorchecker_Lab)[j * 3] == 100.0
- && (*colorchecker_Lab)[j * 3 + 1] == 0.0 && (*colorchecker_Lab)[j * 3 + 2] == 0.0)
+ if((*target_L)[j] == 100.0 && (*target_a)[j] == 0.0 && (*target_b)[j] == 0.0
+ && (*colorchecker_Lab)[j * 3] == 100.0 && (*colorchecker_Lab)[j * 3 + 1] == 0.0
+ && (*colorchecker_Lab)[j * 3 + 2] == 0.0)
{
need_hdr00 = FALSE;
}
- else if((*target_L)[j] == 200.0 && (*target_a)[j] == 0.0 && (*target_b)[j] == 0.0 && (*colorchecker_Lab)[j * 3] == 200.0
- && (*colorchecker_Lab)[j * 3 + 1] == 0.0 && (*colorchecker_Lab)[j * 3 + 2] == 0.0)
+ else if((*target_L)[j] == 200.0 && (*target_a)[j] == 0.0 && (*target_b)[j] == 0.0
+ && (*colorchecker_Lab)[j * 3] == 200.0 && (*colorchecker_Lab)[j * 3 + 1] == 0.0
+ && (*colorchecker_Lab)[j * 3 + 2] == 0.0)
{
need_hdr01 = FALSE;
}
@@ -970,14 +971,14 @@ static void process_data(dt_lut_t *self, double *target_L, double *target_a, dou
double avgerr, maxerr;
sparsity = thinplate_match(&tonecurve, 3, N, colorchecker_Lab, target, sparsity, perm, coeff, &avgerr, &maxerr);
- if (self->result_label != NULL)
+ if(self->result_label != NULL)
{
// TODO: is the rank interesting, too?
char *result_string = g_strdup_printf(_("average dE: %.02f\nmax dE: %.02f"), avgerr, maxerr);
gtk_label_set_text(GTK_LABEL(self->result_label), result_string);
g_free(result_string);
}
-
+
free(coeff_b);
free(coeff_a);
free(coeff_L);
@@ -1539,21 +1540,19 @@ static void get_corners(point_t *bb, box_t *box, point_t *corners)
static void get_pixel_region(const image_t *const image, const point_t *const corners, int *x_start, int *y_start,
int *x_end, int *y_end)
{
- *x_start = CLAMP((int)(MIN(corners[TOP_LEFT].x,
- MIN(corners[TOP_RIGHT].x, MIN(corners[BOTTOM_RIGHT].x, corners[BOTTOM_LEFT].x)))
- + 0.5),
- 0, image->width);
+ *x_start
+ = CLAMP((int)(MIN(corners[TOP_LEFT].x,
+ MIN(corners[TOP_RIGHT].x, MIN(corners[BOTTOM_RIGHT].x, corners[BOTTOM_LEFT].x))) + 0.5),
+ 0, image->width);
*x_end = CLAMP((int)(MAX(corners[TOP_LEFT].x,
- MAX(corners[TOP_RIGHT].x, MAX(corners[BOTTOM_RIGHT].x, corners[BOTTOM_LEFT].x)))
- + 0.5),
+ MAX(corners[TOP_RIGHT].x, MAX(corners[BOTTOM_RIGHT].x, corners[BOTTOM_LEFT].x))) + 0.5),
0, image->width);
- *y_start = CLAMP((int)(MIN(corners[TOP_LEFT].y,
- MIN(corners[TOP_RIGHT].y, MIN(corners[BOTTOM_RIGHT].y, corners[BOTTOM_LEFT].y)))
- + 0.5),
- 0, image->height);
+ *y_start
+ = CLAMP((int)(MIN(corners[TOP_LEFT].y,
+ MIN(corners[TOP_RIGHT].y, MIN(corners[BOTTOM_RIGHT].y, corners[BOTTOM_LEFT].y))) + 0.5),
+ 0, image->height);
*y_end = CLAMP((int)(MAX(corners[TOP_LEFT].y,
- MAX(corners[TOP_RIGHT].y, MAX(corners[BOTTOM_RIGHT].y, corners[BOTTOM_LEFT].y)))
- + 0.5),
+ MAX(corners[TOP_RIGHT].y, MAX(corners[BOTTOM_RIGHT].y, corners[BOTTOM_LEFT].y))) + 0.5),
0, image->height);
}
@@ -1675,7 +1674,8 @@ static int main_gui(dt_lut_t *self, int argc, char *argv[])
}
static int parse_csv(dt_lut_t *self, const char *filename, double **target_L_ptr, double **target_a_ptr,
- double **target_b_ptr, double **source_Lab_ptr, int *num_gray, char **name, char **description)
+ double **target_b_ptr, double **source_Lab_ptr, int *num_gray, char **name,
+ char **description)
{
*target_L_ptr = NULL;
*target_a_ptr = NULL;
@@ -1698,7 +1698,7 @@ static int parse_csv(dt_lut_t *self, const char *filename, double **target_L_ptr
}
// header lines
- char key[16] = {0}, value[256] = {0};
+ char key[16] = { 0 }, value[256] = { 0 };
int unused = fscanf(f, "%15[^;];%255[^\n]\n", key, value);
if(g_strcmp0(key, "name") || unused == EOF)
{
diff --git a/src/chart/pfm.c b/src/chart/pfm.c
index 7fb64e65be39..6b58b73747bf 100644
--- a/src/chart/pfm.c
+++ b/src/chart/pfm.c
@@ -81,7 +81,8 @@ float *read_pfm(const char *filename, int *wd, int *ht)
for(size_t i = (size_t)width * height; i > 0; i--)
for(int c = 0; c < 3; c++)
{
- union {
+ union
+ {
float f;
guint32 i;
} v;
@@ -95,7 +96,8 @@ float *read_pfm(const char *filename, int *wd, int *ht)
for(size_t j = 0; j < height; j++)
for(size_t i = 0; i < width; i++)
{
- union {
+ union
+ {
float f;
guint32 i;
} v;
diff --git a/src/chart/thinplate.c b/src/chart/thinplate.c
index 6668e606b4af..ed3ca00bbfe0 100644
--- a/src/chart/thinplate.c
+++ b/src/chart/thinplate.c
@@ -38,7 +38,11 @@
// very fast, very approximate
static inline float __attribute__((__unused__)) fasterlog(float x)
{
- union { float f; uint32_t i; } vx = { x };
+ union
+ {
+ float f;
+ uint32_t i;
+ } vx = { x };
float y = vx.i;
y *= 8.2629582881927490e-8f;
return y - 87.989971088f;
@@ -55,14 +59,9 @@ static inline double thinplate_kernel(const double *x, const double *y)
// return r * r * fasterlog(MAX(1e-8f, r));
}
-static inline double compute_error(
- const tonecurve_t *c,
- const double **target,
- const double *residual_L,
- const double *residual_a,
- const double *residual_b,
- const int wd,
- double *maxerr)
+static inline double compute_error(const tonecurve_t *c, const double **target, const double *residual_L,
+ const double *residual_a, const double *residual_b, const int wd,
+ double *maxerr)
{
// compute error:
double err = 0.0;
@@ -78,8 +77,9 @@ static inline double compute_error(
const double localerr = dt_colorspaces_deltaE_2000(Lab0, Lab1);
err += localerr;
#else
- const double localerr = sqrt(residual_L[i] * residual_L[i] + residual_a[i] * residual_a[i] + residual_b[i] * residual_b[i]);
- err += localerr/wd;
+ const double localerr
+ = sqrt(residual_L[i] * residual_L[i] + residual_a[i] * residual_a[i] + residual_b[i] * residual_b[i]);
+ err += localerr / wd;
#endif
merr = MAX(merr, localerr);
@@ -150,8 +150,8 @@ int thinplate_match(const tonecurve_t *curve, // tonecurve to apply after this (
int *permutation, // pointing to original order of points, to identify correct output coeff
double **coeff, // output coefficient arrays for each dimension, ordered according to
// permutation[dim]
- double *avgerr, // average error
- double *maxerr) // max error
+ double *avgerr, // average error
+ double *maxerr) // max error
{
if(avgerr) *avgerr = 0.0;
if(maxerr) *maxerr = 0.0;
@@ -306,7 +306,7 @@ int thinplate_match(const tonecurve_t *curve, // tonecurve to apply after this (
for(int i = 0; i < sparsity; i++)
for(int j = 0; j < wd; j++) As[j * S + i] = A[j * wd + permutation[i]];
- if(solve(As, w, v, b[ch], coeff[ch], wd, sparsity-1, S))
+ if(solve(As, w, v, b[ch], coeff[ch], wd, sparsity - 1, S))
{
free(r);
free(b);
@@ -357,7 +357,7 @@ int thinplate_match(const tonecurve_t *curve, // tonecurve to apply after this (
fprintf(stderr, "replacing %d <- %d\n", mincol, maxcol);
// replace column
permutation[mincol] = maxcol;
- // reset norm[] of discarded column to something > 0
+// reset norm[] of discarded column to something > 0
#ifdef EXACT
norm[mincol] = 1.0;
#else
@@ -372,7 +372,7 @@ int thinplate_match(const tonecurve_t *curve, // tonecurve to apply after this (
#ifdef EXACT
double err = 1. / maxdot;
#else
- const int sp = MIN(sparsity, S-1); // need to fix up for replacement
+ const int sp = MIN(sparsity, S - 1); // need to fix up for replacement
// solve linear least squares for sparse c for every output channel:
for(int ch = 0; ch < dim; ch++)
{
@@ -408,15 +408,14 @@ int thinplate_match(const tonecurve_t *curve, // tonecurve to apply after this (
#endif
// residual is max CIE76 delta E now
// everything < 2 is usually considired a very good approximation:
- if(patches == S-4)
+ if(patches == S - 4)
{
if(avgerr) *avgerr = err;
if(maxerr) *maxerr = merr;
fprintf(stderr, "rank %d/%d avg DE %g max DE %g\n", sp + 1, patches, err, merr);
}
- if(s >= S && err >= olderr)
- fprintf(stderr, "error increased!\n");
- // return sparsity + 1;
+ if(s >= S && err >= olderr) fprintf(stderr, "error increased!\n");
+ // return sparsity + 1;
// if(err < 2.0) return sparsity+1;
olderr = err;
}
diff --git a/src/chart/thinplate.h b/src/chart/thinplate.h
index bf33e8bbafad..f997f4241778 100644
--- a/src/chart/thinplate.h
+++ b/src/chart/thinplate.h
@@ -29,8 +29,8 @@ int thinplate_match(const tonecurve_t *curve, // tonecurve to apply after this (
int *permutation, // pointing to original order of points, to identify correct output coeff
double **coeff, // output coefficient arrays for each dimension, ordered according to
// permutation[dim]
- double *avgerr, // average error
- double *maxerr); // max error
+ double *avgerr, // average error
+ double *maxerr); // max error
float thinplate_color_pos(float L, float a, float b);
diff --git a/src/cli/main.c b/src/cli/main.c
index 7fb32f8a9c0b..56a1589b4058 100644
--- a/src/cli/main.c
+++ b/src/cli/main.c
@@ -52,7 +52,8 @@
static void usage(const char *progname)
{
fprintf(stderr, "usage: %s [
]