Commit 615c1b64 authored by Tobias Ellinghaus's avatar Tobias Ellinghaus

dtgtk: Add data to paint callbacks

(cherry picked from commit b630b911)
parent a6a7ba8b
......@@ -644,6 +644,7 @@ static void dt_bauhaus_widget_init(dt_bauhaus_widget_t *w, dt_iop_module_t *self
// no quad icon and no toggle button:
w->quad_paint = 0;
w->quad_paint_data = NULL;
w->quad_toggle = 0;
w->combo_populate = NULL;
gtk_widget_set_size_request(GTK_WIDGET(w), -1, get_line_height());
......@@ -845,11 +846,12 @@ const char* dt_bauhaus_widget_get_label(GtkWidget *widget)
return w->label;
}
void dt_bauhaus_widget_set_quad_paint(GtkWidget *widget, dt_bauhaus_quad_paint_f f, int paint_flags)
void dt_bauhaus_widget_set_quad_paint(GtkWidget *widget, dt_bauhaus_quad_paint_f f, int paint_flags, void *paint_data)
{
dt_bauhaus_widget_t *w = DT_BAUHAUS_WIDGET(widget);
w->quad_paint = f;
w->quad_paint_flags = paint_flags;
w->quad_paint_data = paint_data;
}
// make this quad a toggle button:
......@@ -1235,9 +1237,10 @@ static void dt_bauhaus_draw_quad(dt_bauhaus_widget_t *w, cairo_t *cr)
{
cairo_save(cr);
set_grid_color(cr, gtk_widget_is_sensitive(GTK_WIDGET(w)));
w->quad_paint(cr, width - height - 1, -1, height + 2, get_label_font_size() + 2, w->quad_paint_flags);
w->quad_paint(cr, width - height - 1, -1, height + 2, get_label_font_size() + 2, w->quad_paint_flags,
w->quad_paint_data);
set_indicator_color(cr, gtk_widget_is_sensitive(GTK_WIDGET(w)));
w->quad_paint(cr, width - height, 0, height, get_label_font_size(), w->quad_paint_flags);
w->quad_paint(cr, width - height, 0, height, get_label_font_size(), w->quad_paint_flags, w->quad_paint_data);
cairo_restore(cr);
}
else
......
......@@ -119,7 +119,7 @@ typedef union dt_bauhaus_data_t
typedef struct dt_bauhaus_widget_t DtBauhausWidget;
typedef struct dt_bauhaus_widget_class_t DtBauhausWidgetClass;
typedef void (*dt_bauhaus_quad_paint_f)(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags);
typedef void (*dt_bauhaus_quad_paint_f)(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data);
// our new widget and its private members, inheriting from drawing area:
typedef struct dt_bauhaus_widget_t
......@@ -136,6 +136,8 @@ typedef struct dt_bauhaus_widget_t
dt_bauhaus_quad_paint_f quad_paint;
// minimal modifiers for paint function.
int quad_paint_flags;
// data for the paint callback
void *quad_paint_data;
// quad is a toggle button?
int quad_toggle;
......@@ -229,7 +231,7 @@ void dt_bauhaus_cleanup();
void dt_bauhaus_widget_set_label(GtkWidget *w, const char *section, const char *label);
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);
void dt_bauhaus_widget_set_quad_paint(GtkWidget *w, dt_bauhaus_quad_paint_f f, int paint_flags, void *paint_data);
// make this quad a toggle button:
void dt_bauhaus_widget_set_quad_toggle(GtkWidget *w, int toggle);
......
......@@ -1239,15 +1239,15 @@ void dt_iop_gui_init_blendif(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_start(GTK_BOX(notebook), GTK_WIDGET(bd->channel_tabs), FALSE, FALSE, 0);
bd->colorpicker
= dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(bd->colorpicker, _("pick GUI color from image"));
gtk_widget_set_size_request(GTK_WIDGET(bd->colorpicker), bs, bs);
GtkWidget *res = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
GtkWidget *res = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(res, _("reset blend mask settings"));
gtk_widget_set_size_request(res, bs, bs);
GtkWidget *inv = dtgtk_button_new(dtgtk_cairo_paint_invert, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
GtkWidget *inv = dtgtk_button_new(dtgtk_cairo_paint_invert, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(inv, _("invert all channel's polarities"));
gtk_widget_set_size_request(inv, bs, bs);
......@@ -1260,11 +1260,11 @@ void dt_iop_gui_init_blendif(GtkBox *blendw, dt_iop_module_t *module)
bd->upper_slider = DTGTK_GRADIENT_SLIDER_MULTIVALUE(dtgtk_gradient_slider_multivalue_new(4));
bd->lower_polarity
= dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(bd->lower_polarity, _("toggle polarity. best seen by enabling 'display mask'"));
bd->upper_polarity
= dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(bd->upper_polarity, _("toggle polarity. best seen by enabling 'display mask'"));
gtk_box_pack_start(GTK_BOX(upslider), GTK_WIDGET(bd->upper_slider), TRUE, TRUE, 0);
......@@ -1425,7 +1425,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_start(GTK_BOX(hbox), bd->masks_combo, TRUE, TRUE, 0);
bd->masks_edit
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_eye, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_eye, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(bd->masks_edit), "button-press-event", G_CALLBACK(_blendop_masks_show_and_edit),
module);
gtk_widget_set_tooltip_text(bd->masks_edit, _("show and edit mask elements"));
......@@ -1434,7 +1434,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_start(GTK_BOX(hbox), bd->masks_edit, FALSE, FALSE, 0);
bd->masks_polarity
= dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(bd->masks_polarity, _("toggle polarity of drawn mask"));
g_signal_connect(G_OBJECT(bd->masks_polarity), "toggled", G_CALLBACK(_blendop_masks_polarity_callback),
module);
......@@ -1443,7 +1443,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_start(GTK_BOX(hbox), bd->masks_polarity, FALSE, FALSE, 0);
bd->masks_gradient
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_gradient, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_gradient, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(bd->masks_gradient), "button-press-event",
G_CALLBACK(_blendop_masks_add_gradient), module);
gtk_widget_set_tooltip_text(bd->masks_gradient, _("add gradient"));
......@@ -1452,7 +1452,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_end(GTK_BOX(abox), bd->masks_gradient, FALSE, FALSE, 0);
bd->masks_path
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_path, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_path, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(bd->masks_path), "button-press-event", G_CALLBACK(_blendop_masks_add_path),
module);
gtk_widget_set_tooltip_text(bd->masks_path, _("add path"));
......@@ -1461,7 +1461,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_end(GTK_BOX(abox), bd->masks_path, FALSE, FALSE, bs);
bd->masks_ellipse
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_ellipse, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_ellipse, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(bd->masks_ellipse), "button-press-event",
G_CALLBACK(_blendop_masks_add_ellipse), module);
gtk_widget_set_tooltip_text(bd->masks_ellipse, _("add ellipse"));
......@@ -1470,7 +1470,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_end(GTK_BOX(abox), bd->masks_ellipse, FALSE, FALSE, 0);
bd->masks_circle
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_circle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_circle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(bd->masks_circle), "button-press-event", G_CALLBACK(_blendop_masks_add_circle),
module);
gtk_widget_set_tooltip_text(bd->masks_circle, _("add circle"));
......@@ -1479,7 +1479,7 @@ void dt_iop_gui_init_masks(GtkBox *blendw, dt_iop_module_t *module)
gtk_box_pack_end(GTK_BOX(abox), bd->masks_circle, FALSE, FALSE, bs);
bd->masks_brush
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_brush, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_masks_brush, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(bd->masks_brush), "button-press-event", G_CALLBACK(_blendop_masks_add_brush),
module);
gtk_widget_set_tooltip_text(bd->masks_brush, _("add brush"));
......@@ -2034,7 +2034,7 @@ void dt_iop_gui_init_blending(GtkWidget *iopw, dt_iop_module_t *module)
G_CALLBACK(_blendop_blendif_radius_callback), bd);
bd->showmask = dtgtk_button_new(dtgtk_cairo_paint_showmask, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
bd->showmask = dtgtk_button_new(dtgtk_cairo_paint_showmask, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(bd->showmask, _("display mask and/or color channel. ctrl-click to display mask, "
"shift-click to display channel. hover over parametric mask slider to "
"select channel for display"));
......@@ -2043,7 +2043,7 @@ void dt_iop_gui_init_blending(GtkWidget *iopw, dt_iop_module_t *module)
bd->suppress
= dtgtk_togglebutton_new(dtgtk_cairo_paint_eye_toggle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
= dtgtk_togglebutton_new(dtgtk_cairo_paint_eye_toggle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(bd->suppress, _("temporarily switch off blend mask. only for module in focus"));
gtk_widget_set_size_request(GTK_WIDGET(bd->suppress), bs, bs);
g_signal_connect(G_OBJECT(bd->suppress), "toggled", G_CALLBACK(_blendop_blendif_suppress_toggled), module);
......
......@@ -1614,7 +1614,7 @@ static void dt_iop_gui_set_single_expanded(dt_iop_module_t *module, gboolean exp
g_list_free(childs);
if(!expanded) flags = CPF_DIRECTION_LEFT;
dtgtk_icon_set_paint(icon, dtgtk_cairo_paint_solid_arrow, flags);
dtgtk_icon_set_paint(icon, dtgtk_cairo_paint_solid_arrow, flags, NULL);
/* store expanded state of module.
* we do that first, so update_expanded won't think it should be visible
......@@ -1699,7 +1699,7 @@ void dt_iop_gui_update_expanded(dt_iop_module_t *module)
g_list_free(childs);
if(!expanded) flags = CPF_DIRECTION_LEFT;
dtgtk_icon_set_paint(icon, dtgtk_cairo_paint_solid_arrow, flags);
dtgtk_icon_set_paint(icon, dtgtk_cairo_paint_solid_arrow, flags, NULL);
dtgtk_expander_set_expanded(DTGTK_EXPANDER(module->expander), expanded);
}
......@@ -1810,11 +1810,11 @@ GtkWidget *dt_iop_gui_get_expander(dt_iop_module_t *module)
GtkWidget *hw[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
/* add the expand indicator icon */
hw[idx] = dtgtk_icon_new(dtgtk_cairo_paint_solid_arrow, CPF_DIRECTION_LEFT);
hw[idx] = dtgtk_icon_new(dtgtk_cairo_paint_solid_arrow, CPF_DIRECTION_LEFT, NULL);
gtk_widget_set_size_request(GTK_WIDGET(hw[idx++]), bs, bs);
/* add duplicate button */
/*hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_plusminus, CPF_ACTIVE|CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
/*hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_plusminus, CPF_ACTIVE|CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER, NULL);
module->duplicate_button = GTK_WIDGET(hw[idx]);
gtk_widget_set_tooltip_text(GTK_WIDGET(hw[idx]), _("add new instance"));
g_signal_connect (G_OBJECT (hw[idx]), "clicked",
......@@ -1872,7 +1872,7 @@ got_image:
}
else
{
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_multiinstance, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_multiinstance, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
module->multimenu_button = GTK_WIDGET(hw[idx]);
gtk_widget_set_tooltip_text(GTK_WIDGET(hw[idx]),
_("multiple instances actions\nmiddle-click creates new instance"));
......@@ -1882,7 +1882,7 @@ got_image:
}
/* add reset button */
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
module->reset_button = GTK_WIDGET(hw[idx]);
gtk_widget_set_tooltip_text(GTK_WIDGET(hw[idx]), _("reset parameters"));
g_signal_connect(G_OBJECT(hw[idx]), "clicked", G_CALLBACK(dt_iop_gui_reset_callback), module);
......@@ -1890,7 +1890,7 @@ got_image:
/* add preset button if module has implementation */
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_presets, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_presets, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
module->presets_button = GTK_WIDGET(hw[idx]);
gtk_widget_set_tooltip_text(GTK_WIDGET(hw[idx]), _("presets"));
g_signal_connect(G_OBJECT(hw[idx]), "clicked", G_CALLBACK(popup_callback), module);
......@@ -1902,7 +1902,7 @@ got_image:
gtk_widget_set_size_request(GTK_WIDGET(hw[idx++]), bs, bs);
/* add enabled button */
hw[idx] = dtgtk_togglebutton_new(dtgtk_cairo_paint_switch, CPF_DO_NOT_USE_BORDER | CPF_BG_TRANSPARENT);
hw[idx] = dtgtk_togglebutton_new(dtgtk_cairo_paint_switch, CPF_DO_NOT_USE_BORDER | CPF_BG_TRANSPARENT, NULL);
gtk_widget_set_no_show_all(hw[idx], TRUE);
gchar *module_label = dt_history_item_get_name(module);
snprintf(tooltip, sizeof(tooltip), module->enabled ? _("%s is switched on") : _("%s is switched off"),
......@@ -1919,7 +1919,7 @@ got_image:
if(hw[i]) gtk_box_pack_start(GTK_BOX(header), hw[i], i == 2 ? TRUE : FALSE, i == 2 ? TRUE : FALSE, 2);
gtk_widget_set_halign(hw[2], GTK_ALIGN_END);
dtgtk_icon_set_paint(hw[0], dtgtk_cairo_paint_solid_arrow, CPF_DIRECTION_LEFT);
dtgtk_icon_set_paint(hw[0], dtgtk_cairo_paint_solid_arrow, CPF_DIRECTION_LEFT, NULL);
/* add the blending ui if supported */
gtk_box_pack_start(GTK_BOX(iopw), module->widget, TRUE, TRUE, 0);
......
......@@ -101,15 +101,16 @@ static gboolean _button_draw(GtkWidget *widget, cairo_t *cr)
{
int icon_width = text ? height - (border * 2) : width - (border * 2);
int icon_height = height - (border * 2);
void *icon_data = DTGTK_BUTTON(widget)->icon_data;
if(icon_width > 0 && icon_height > 0)
{
if(text)
DTGTK_BUTTON(widget)
->icon(cr, border, border, height - (border * 2), height - (border * 2), flags);
->icon(cr, border, border, height - (border * 2), height - (border * 2), flags, icon_data);
else
DTGTK_BUTTON(widget)
->icon(cr, border, border, width - (border * 2), height - (border * 2), flags);
->icon(cr, border, border, width - (border * 2), height - (border * 2), flags, icon_data);
}
}
......@@ -128,12 +129,13 @@ static gboolean _button_draw(GtkWidget *widget, cairo_t *cr)
}
// Public functions
GtkWidget *dtgtk_button_new(DTGTKCairoPaintIconFunc paint, gint paintflags)
GtkWidget *dtgtk_button_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata)
{
GtkDarktableButton *button;
button = g_object_new(dtgtk_button_get_type(), NULL);
button->icon = paint;
button->icon_flags = paintflags;
button->icon_data = paintdata;
gtk_widget_set_size_request(GTK_WIDGET(button), DT_PIXEL_APPLY_DPI(17), DT_PIXEL_APPLY_DPI(17));
return (GtkWidget *)button;
}
......@@ -155,10 +157,11 @@ GType dtgtk_button_get_type()
return dtgtk_button_type;
}
void dtgtk_button_set_paint(GtkDarktableButton *button, DTGTKCairoPaintIconFunc paint, gint paintflags)
void dtgtk_button_set_paint(GtkDarktableButton *button, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata)
{
button->icon = paint;
button->icon_flags = paintflags;
button->icon_data = paintdata;
}
void dtgtk_button_set_active(GtkDarktableButton *button, gboolean active)
......
......@@ -37,6 +37,7 @@ typedef struct _GtkDarktableButton
GtkButton widget;
DTGTKCairoPaintIconFunc icon;
gint icon_flags;
void *icon_data;
GdkRGBA bg, fg;
} GtkDarktableButton;
......@@ -48,9 +49,9 @@ typedef struct _GtkDarktableButtonClass
GType dtgtk_button_get_type(void);
/** instantiate a new darktable button control passing paint function as content */
GtkWidget *dtgtk_button_new(DTGTKCairoPaintIconFunc paint, gint paintflags);
GtkWidget *dtgtk_button_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata);
/** set the paint function for a button */
void dtgtk_button_set_paint(GtkDarktableButton *button, DTGTKCairoPaintIconFunc paint, gint paintflags);
void dtgtk_button_set_paint(GtkDarktableButton *button, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata);
/** set the active state of the button icon */
void dtgtk_button_set_active(GtkDarktableButton *button, gboolean active);
/** overwrite the foreground color, or NULL to reset it */
......
......@@ -559,11 +559,11 @@ static gboolean _gradient_slider_draw(GtkWidget *widget, cairo_t *cr)
if(mk & 0x01) /* filled */
dtgtk_cairo_paint_solid_triangle(cr, (vx - DT_PIXEL_APPLY_DPI(sz) * 0.5),
sz < 10 ? DT_PIXEL_APPLY_DPI(1) : DT_PIXEL_APPLY_DPI(-2),
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_DOWN);
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_DOWN, NULL);
else
dtgtk_cairo_paint_triangle(cr, (vx - DT_PIXEL_APPLY_DPI(sz) * 0.5),
sz < 10 ? DT_PIXEL_APPLY_DPI(1) : DT_PIXEL_APPLY_DPI(-2),
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_DOWN);
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_DOWN, NULL);
}
if(mk & 0x02) /* lower arrow */
......@@ -572,11 +572,11 @@ static gboolean _gradient_slider_draw(GtkWidget *widget, cairo_t *cr)
dtgtk_cairo_paint_solid_triangle(cr, (vx - DT_PIXEL_APPLY_DPI(sz) * 0.5),
sz < 10 ? height - DT_PIXEL_APPLY_DPI(6) : height
- DT_PIXEL_APPLY_DPI(11),
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_UP);
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_UP, NULL);
else
dtgtk_cairo_paint_triangle(cr, (vx - DT_PIXEL_APPLY_DPI(sz) * 0.5),
sz < 10 ? height - DT_PIXEL_APPLY_DPI(6) : height - DT_PIXEL_APPLY_DPI(11),
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_UP);
DT_PIXEL_APPLY_DPI(sz), DT_PIXEL_APPLY_DPI(sz), CPF_DIRECTION_UP, NULL);
}
}
......
......@@ -53,19 +53,21 @@ static gboolean _icon_draw(GtkWidget *widget, cairo_t *cr)
/* draw icon */
if(DTGTK_ICON(widget)->icon)
DTGTK_ICON(widget)->icon(cr, 0, 0, allocation.width, allocation.height, DTGTK_ICON(widget)->icon_flags);
DTGTK_ICON(widget)->icon(cr, 0, 0, allocation.width, allocation.height, DTGTK_ICON(widget)->icon_flags,
DTGTK_ICON(widget)->icon_data);
return FALSE;
}
// Public functions
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags)
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata)
{
GtkDarktableIcon *icon;
icon = g_object_new(dtgtk_icon_get_type(), NULL);
gtk_event_box_set_visible_window(GTK_EVENT_BOX(icon), FALSE);
icon->icon = paint;
icon->icon_flags = paintflags;
icon->icon_data = paintdata;
return (GtkWidget *)icon;
}
......@@ -86,10 +88,11 @@ GType dtgtk_icon_get_type()
return dtgtk_icon_type;
}
void dtgtk_icon_set_paint(GtkWidget *icon, DTGTKCairoPaintIconFunc paint, gint paintflags)
void dtgtk_icon_set_paint(GtkWidget *icon, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata)
{
DTGTK_ICON(icon)->icon = paint;
DTGTK_ICON(icon)->icon_flags = paintflags;
DTGTK_ICON(icon)->icon_data = paintdata;
gtk_widget_queue_draw(icon);
}
......
......@@ -31,6 +31,7 @@ typedef struct _GtkDarktableIcon
GtkEventBox widget;
DTGTKCairoPaintIconFunc icon;
gint icon_flags;
void *icon_data;
} GtkDarktableIcon;
typedef struct _GtkDarktableIconClass
......@@ -41,10 +42,10 @@ typedef struct _GtkDarktableIconClass
GType dtgtk_icon_get_type(void);
/** instantiate a new darktable icon control passing paint function as content */
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags);
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata);
/** set the paint function for a icon */
void dtgtk_icon_set_paint(GtkWidget *icon, DTGTKCairoPaintIconFunc paint, gint paintflags);
void dtgtk_icon_set_paint(GtkWidget *icon, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata);
G_END_DECLS
......
This diff is collapsed.
This diff is collapsed.
......@@ -128,15 +128,16 @@ static gboolean _togglebutton_draw(GtkWidget *widget, cairo_t *cr)
int icon_width = text ? height - (border * 2) : width - (border * 2);
int icon_height = height - (border * 2);
void *icon_data = DTGTK_TOGGLEBUTTON(widget)->icon_data;
if(icon_width > 0 && icon_height > 0)
{
if(text)
DTGTK_TOGGLEBUTTON(widget)
->icon(cr, border, border, height - (border * 2), height - (border * 2), flags);
->icon(cr, border, border, height - (border * 2), height - (border * 2), flags, icon_data);
else
DTGTK_TOGGLEBUTTON(widget)
->icon(cr, border, border, width - (border * 2), height - (border * 2), flags);
->icon(cr, border, border, width - (border * 2), height - (border * 2), flags, icon_data);
}
}
......@@ -158,12 +159,13 @@ static gboolean _togglebutton_draw(GtkWidget *widget, cairo_t *cr)
}
// Public functions
GtkWidget *dtgtk_togglebutton_new(DTGTKCairoPaintIconFunc paint, gint paintflags)
GtkWidget *dtgtk_togglebutton_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata)
{
GtkDarktableToggleButton *button;
button = g_object_new(dtgtk_togglebutton_get_type(), NULL);
button->icon = paint;
button->icon_flags = paintflags;
button->icon_data = paintdata;
gtk_widget_set_size_request(GTK_WIDGET(button), DT_PIXEL_APPLY_DPI(17), DT_PIXEL_APPLY_DPI(17));
return (GtkWidget *)button;
}
......@@ -188,10 +190,11 @@ GType dtgtk_togglebutton_get_type()
void dtgtk_togglebutton_set_paint(GtkDarktableToggleButton *button, DTGTKCairoPaintIconFunc paint,
gint paintflags)
gint paintflags, void *paintdata)
{
button->icon = paint;
button->icon_flags = paintflags;
button->icon_data = paintdata;
}
void dtgtk_togglebutton_override_color(GtkDarktableToggleButton *button, GdkRGBA *color)
......
......@@ -33,6 +33,7 @@ typedef struct _GtkDarktableToggleButton
GtkToggleButton widget;
DTGTKCairoPaintIconFunc icon;
gint icon_flags;
void *icon_data;
GdkRGBA bg, fg;
} GtkDarktableToggleButton;
......@@ -44,11 +45,11 @@ typedef struct _GtkDarktableToggleButtonClass
GType dtgtk_togglebutton_get_type(void);
/** instantiate a new darktable toggle button */
GtkWidget *dtgtk_togglebutton_new(DTGTKCairoPaintIconFunc paint, gint paintflag);
GtkWidget *dtgtk_togglebutton_new(DTGTKCairoPaintIconFunc paint, gint paintflag, void *paintdata);
/** Set the paint function and paint flags */
void dtgtk_togglebutton_set_paint(GtkDarktableToggleButton *button, DTGTKCairoPaintIconFunc paint,
gint paintflags);
gint paintflags, void *paintdata);
/** overwrite the foreground color, or NULL to reset it */
void dtgtk_togglebutton_override_color(GtkDarktableToggleButton *button, GdkRGBA *color);
/** overwrite the background color, or NULL to reset it */
......
......@@ -178,13 +178,13 @@ static _camera_gconf_widget_t *_camera_import_gconf_widget(_camera_import_dialog
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(gcw->entry), TRUE, TRUE, 0);
GtkWidget *button = dtgtk_button_new(dtgtk_cairo_paint_store, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
GtkWidget *button = dtgtk_button_new(dtgtk_cairo_paint_store, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(button, _("store value as default"));
gtk_widget_set_size_request(button, DT_PIXEL_APPLY_DPI(13), DT_PIXEL_APPLY_DPI(13));
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_gcw_store_callback), gcw);
button = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
button = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(button, _("reset value to default"));
gtk_widget_set_size_request(button, DT_PIXEL_APPLY_DPI(13), DT_PIXEL_APPLY_DPI(13));
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
......
......@@ -256,7 +256,7 @@ static void tree_insert_presets(GtkTreeStore *tree_model)
DT_PIXEL_APPLY_DPI(ICON_SIZE));
cairo_t *lock_cr = cairo_create(lock_cst);
cairo_set_source_rgb(lock_cr, 0.7, 0.7, 0.7);
dtgtk_cairo_paint_lock(lock_cr, 0, 0, DT_PIXEL_APPLY_DPI(ICON_SIZE), DT_PIXEL_APPLY_DPI(ICON_SIZE), 0);
dtgtk_cairo_paint_lock(lock_cr, 0, 0, DT_PIXEL_APPLY_DPI(ICON_SIZE), DT_PIXEL_APPLY_DPI(ICON_SIZE), 0, NULL);
cairo_surface_flush(lock_cst);
guchar *data = cairo_image_surface_get_data(lock_cst);
dt_draw_cairo_to_gdk_pixbuf(data, DT_PIXEL_APPLY_DPI(ICON_SIZE), DT_PIXEL_APPLY_DPI(ICON_SIZE));
......@@ -270,7 +270,7 @@ static void tree_insert_presets(GtkTreeStore *tree_model)
DT_PIXEL_APPLY_DPI(ICON_SIZE));
cairo_t *check_cr = cairo_create(check_cst);
cairo_set_source_rgb(check_cr, 0.7, 0.7, 0.7);
dtgtk_cairo_paint_check_mark(check_cr, 0, 0, DT_PIXEL_APPLY_DPI(ICON_SIZE), DT_PIXEL_APPLY_DPI(ICON_SIZE), 0);
dtgtk_cairo_paint_check_mark(check_cr, 0, 0, DT_PIXEL_APPLY_DPI(ICON_SIZE), DT_PIXEL_APPLY_DPI(ICON_SIZE), 0, NULL);
cairo_surface_flush(check_cst);
data = cairo_image_surface_get_data(check_cst);
dt_draw_cairo_to_gdk_pixbuf(data, DT_PIXEL_APPLY_DPI(ICON_SIZE), DT_PIXEL_APPLY_DPI(ICON_SIZE));
......
......@@ -164,7 +164,7 @@ void gui_init(dt_imageio_module_storage_t *self)
gtk_widget_set_tooltip_text(widget, tooltip_text);
g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(entry_changed_callback), self);
widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER);
widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_size_request(widget, DT_PIXEL_APPLY_DPI(18), DT_PIXEL_APPLY_DPI(18));
gtk_widget_set_tooltip_text(widget, _("select directory"));
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
......
......@@ -514,7 +514,7 @@ void gui_init(dt_imageio_module_storage_t *self)
gtk_widget_set_sensitive(ui->album_list, FALSE);
gtk_box_pack_start(GTK_BOX(hbox), ui->album_list, TRUE, TRUE, 0);
button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_DO_NOT_USE_BORDER);
button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(button, _("refresh album list"));
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(flickr_button1_clicked), (gpointer)ui);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
......
......@@ -174,7 +174,7 @@ void gui_init(dt_imageio_module_storage_t *self)
g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(entry_changed_callback), self);
g_free(tooltip_text);
widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER);
widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(widget, _("select directory"));
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self);
......
......@@ -173,7 +173,7 @@ void gui_init(dt_imageio_module_storage_t *self)
g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(entry_changed_callback), self);
g_free(tooltip_text);
widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER);
widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_tooltip_text(widget, _("select directory"));
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self);
......
......@@ -4449,17 +4449,17 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_set_halign(label1, GTK_ALIGN_START);
gtk_grid_attach(GTK_GRID(grid), label1, 0, 0, 1, 1);
g->fit_v = dtgtk_button_new(dtgtk_cairo_paint_perspective, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 1);
g->fit_v = dtgtk_button_new(dtgtk_cairo_paint_perspective, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 1, NULL);
gtk_widget_set_hexpand(GTK_WIDGET(g->fit_v), TRUE);
gtk_widget_set_size_request(g->fit_v, -1, DT_PIXEL_APPLY_DPI(24));
gtk_grid_attach_next_to(GTK_GRID(grid), g->fit_v, label1, GTK_POS_RIGHT, 1, 1);
g->fit_h = dtgtk_button_new(dtgtk_cairo_paint_perspective, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 2);
g->fit_h = dtgtk_button_new(dtgtk_cairo_paint_perspective, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 2, NULL);
gtk_widget_set_hexpand(GTK_WIDGET(g->fit_h), TRUE);
gtk_widget_set_size_request(g->fit_h, -1, DT_PIXEL_APPLY_DPI(24));
gtk_grid_attach_next_to(GTK_GRID(grid), g->fit_h, g->fit_v, GTK_POS_RIGHT, 1, 1);
g->fit_both = dtgtk_button_new(dtgtk_cairo_paint_perspective, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 3);
g->fit_both = dtgtk_button_new(dtgtk_cairo_paint_perspective, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 3, NULL);
gtk_widget_set_hexpand(GTK_WIDGET(g->fit_both), TRUE);
gtk_widget_set_size_request(g->fit_both, -1, DT_PIXEL_APPLY_DPI(24));
gtk_grid_attach_next_to(GTK_GRID(grid), g->fit_both, g->fit_h, GTK_POS_RIGHT, 1, 1);
......@@ -4468,15 +4468,15 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_set_halign(label2, GTK_ALIGN_START);
gtk_grid_attach(GTK_GRID(grid), label2, 0, 1, 1, 1);
g->structure = dtgtk_button_new(dtgtk_cairo_paint_structure, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
g->structure = dtgtk_button_new(dtgtk_cairo_paint_structure, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_hexpand(GTK_WIDGET(g->structure), TRUE);
gtk_grid_attach_next_to(GTK_GRID(grid), g->structure, label2, GTK_POS_RIGHT, 1, 1);
g->clean = dtgtk_button_new(dtgtk_cairo_paint_cancel, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
g->clean = dtgtk_button_new(dtgtk_cairo_paint_cancel, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_hexpand(GTK_WIDGET(g->clean), TRUE);
gtk_grid_attach_next_to(GTK_GRID(grid), g->clean, g->structure, GTK_POS_RIGHT, 1, 1);
g->eye = dtgtk_togglebutton_new(dtgtk_cairo_paint_eye_toggle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
g->eye = dtgtk_togglebutton_new(dtgtk_cairo_paint_eye_toggle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_hexpand(GTK_WIDGET(g->eye), TRUE);
gtk_grid_attach_next_to(GTK_GRID(grid), g->eye, g->clean, GTK_POS_RIGHT, 1, 1);
......
......@@ -1037,7 +1037,7 @@ void gui_init(struct dt_iop_module_t *self)
GtkWidget *label = dtgtk_reset_label_new(_("border color"), self, &p->color, 3 * sizeof(float));
g_signal_connect(G_OBJECT(g->colorpick), "color-set", G_CALLBACK(colorpick_color_set), self);
g->border_picker = GTK_TOGGLE_BUTTON(dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT));
g->border_picker = GTK_TOGGLE_BUTTON(dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT, NULL));
gtk_widget_set_tooltip_text(GTK_WIDGET(g->border_picker), _("pick border color from image"));
gtk_widget_set_size_request(GTK_WIDGET(g->border_picker), DT_PIXEL_APPLY_DPI(24), DT_PIXEL_APPLY_DPI(24));
g_signal_connect(G_OBJECT(g->border_picker), "toggled", G_CALLBACK(request_pick_toggled_border), self);
......@@ -1055,7 +1055,7 @@ void gui_init(struct dt_iop_module_t *self)
label = dtgtk_reset_label_new(_("frame line color"), self, &p->color, 3 * sizeof(float));
g_signal_connect(G_OBJECT(g->frame_colorpick), "color-set", G_CALLBACK(frame_colorpick_color_set), self);
g->frame_picker = GTK_TOGGLE_BUTTON(dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT));
g->frame_picker = GTK_TOGGLE_BUTTON(dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT, NULL));
gtk_widget_set_tooltip_text(GTK_WIDGET(g->frame_picker), _("pick frame line color from image"));
gtk_widget_set_size_request(GTK_WIDGET(g->frame_picker), DT_PIXEL_APPLY_DPI(24), DT_PIXEL_APPLY_DPI(24));
g_signal_connect(G_OBJECT(g->frame_picker), "toggled", G_CALLBACK(request_pick_toggled_frame), self);
......
......@@ -2007,7 +2007,7 @@ void gui_init(struct dt_iop_module_t *self)
g_signal_connect(G_OBJECT(g->aspect_presets), "value-changed", G_CALLBACK(aspect_presets_changed), self);
gtk_widget_set_tooltip_text(g->aspect_presets, _("set the aspect ratio\n"
"the list is sorted: from most square to least square"));
dt_bauhaus_widget_set_quad_paint(g->aspect_presets, dtgtk_cairo_paint_aspectflip, 0);
dt_bauhaus_widget_set_quad_paint(g->aspect_presets, dtgtk_cairo_paint_aspectflip, 0, NULL);
g_signal_connect(G_OBJECT(g->aspect_presets), "quad-pressed", G_CALLBACK(aspect_flip), self);
gtk_box_pack_start(GTK_BOX(self->widget), g->aspect_presets, TRUE, TRUE, 0);
......
......@@ -1079,7 +1079,7 @@ static gboolean checker_draw(GtkWidget *widget, cairo_t *crf, gpointer user_data
dt_bauhaus_widget_set_quad_paint(
g->combobox_patch, dtgtk_cairo_paint_colorpicker,
(self->request_color_pick == DT_REQUEST_COLORPICK_MODULE ? CPF_ACTIVE : CPF_NONE));
(self->request_color_pick == DT_REQUEST_COLORPICK_MODULE ? CPF_ACTIVE : CPF_NONE), NULL);
// highlight patch that is closest to picked colour,
// or the one selected in the combobox.
......@@ -1275,7 +1275,7 @@ void gui_init(struct dt_iop_module_t *self)
dt_bauhaus_combobox_add(g->combobox_patch, cboxentry);
}
self->request_color_pick = DT_REQUEST_COLORPICK_OFF;
dt_bauhaus_widget_set_quad_paint(g->combobox_patch, dtgtk_cairo_paint_colorpicker, CPF_NONE);
dt_bauhaus_widget_set_quad_paint(g->combobox_patch, dtgtk_cairo_paint_colorpicker, CPF_NONE, NULL);
g->scale_L = dt_bauhaus_slider_new_with_range(self, -100.0, 200.0, 1.0, 0.0f, 2);
gtk_widget_set_tooltip_text(g->scale_L, _("lightness offset"));
......
......@@ -1079,7 +1079,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_notebook_set_current_page(GTK_NOTEBOOK(c->channel_tabs), c->channel);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(c->channel_tabs), FALSE, FALSE, 0);
GtkWidget *tb = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
GtkWidget *tb = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_size_request(GTK_WIDGET(tb), DT_PIXEL_APPLY_DPI(14), DT_PIXEL_APPLY_DPI(14));
gtk_widget_set_tooltip_text(tb, _("pick GUI color from image"));
g_signal_connect(G_OBJECT(tb), "toggled", G_CALLBACK(request_pick_toggled), self);
......
......@@ -883,7 +883,7 @@ void gui_init(struct dt_iop_module_t *self)
gtk_widget_set_tooltip_text(g->autoexpp, _("percentage of bright values clipped out, toggle color picker to activate"));
dt_bauhaus_slider_set_format(g->autoexpp, "%.3f%%");
dt_bauhaus_widget_set_label(g->autoexpp, NULL, _("clipping threshold"));
dt_bauhaus_widget_set_quad_paint(g->autoexpp, dtgtk_cairo_paint_colorpicker, CPF_ACTIVE);
dt_bauhaus_widget_set_quad_paint(g->autoexpp, dtgtk_cairo_paint_colorpicker, CPF_ACTIVE, NULL);
gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(g->autoexpp), TRUE, TRUE, 0);
gtk_widget_show_all(vbox_manual);
......
......@@ -508,13 +508,13 @@ void gui_init(struct dt_iop_module_t *self)
GtkWidget *label = dtgtk_reset_label_new(_("rotate"), self, &p->orientation, sizeof(int32_t));
gtk_box_pack_start(GTK_BOX(self->widget), label, TRUE, TRUE, 0);
GtkWidget *button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
GtkWidget *button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
gtk_widget_set_size_request(button, -1, DT_PIXEL_APPLY_DPI(24));
gtk_widget_set_tooltip_text(button, _("rotate 90 degrees CCW"));
gtk_box_pack_start(GTK_BOX(self->widget), button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(rotate_ccw), (gpointer)self);
button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 1);
button = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | 1, NULL);
gtk_widget_set_size_request(button, -1, DT_PIXEL_APPLY_DPI(24));
gtk_widget_set_tooltip_text(button, _("rotate 90 degrees CW"));
gtk_box_pack_start(GTK_BOX(self->widget), button, TRUE, TRUE, 0);
......
......@@ -616,7 +616,7 @@ void gui_init(dt_iop_module_t *self)
g_signal_connect(G_OBJECT(g->colorpicker), "color-set", G_CALLBACK(colorpicker_callback), self);
gtk_box_pack_start(GTK_BOX(g->pickerbuttons), GTK_WIDGET(g->colorpicker), TRUE, TRUE, 0);
g->picker = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);