72#include <glib/gstdio.h>
82 return _(
"print settings");
87 static const char *
v[] = {
"print", NULL};
119static const gchar *
_unit_names[] = { N_(
"mm"), N_(
"cm"), N_(
"inch"), NULL };
226 *n_digits = ceilf(log10f(1.0f /
units[unit]));
229 *incr = roundf(
units[unit] * 20.0f) / 20.0f;
233 *format = g_strdup_printf(
"%%.%df", *n_digits);
317 const gboolean export_masks)
321 d->params->buf = (uint16_t *)malloc((
size_t)3 * (
d->bpp == 8?1:2) *
d->head.width *
d->head.height);
325 const uint8_t *in_ptr = (
const uint8_t *)in;
326 uint8_t *out_ptr = (uint8_t *)
d->params->buf;
327 for(
int y = 0; y <
d->head.height; y++)
329 for(
int x = 0;
x <
d->head.width;
x++, in_ptr += 4, out_ptr += 3)
330 memcpy(out_ptr, in_ptr, 3);
335 const uint16_t *in_ptr = (
const uint16_t *)in;
336 uint16_t *out_ptr = (uint16_t *)
d->params->buf;
337 for(
int y = 0; y <
d->head.height; y++)
339 for(
int x = 0;
x <
d->head.width;
x++, in_ptr += 4, out_ptr += 3)
340 memcpy(out_ptr, in_ptr, 6);
363 dat.
bpp = *
params->p_icc_profile ? 16 : 8;
372 const gboolean export_masks =
FALSE;
373 const double no_scale_factor = 0.0;
378 params->buf_icc_profile,
params->buf_icc_intent, NULL, NULL, 1, 1, NULL, NULL);
389 if(*
params->p_icc_profile)
405 fprintf(stderr,
"error getting output profile for image %d\n", img->
imgid);
432 const int icc_id = 0;
449 const int resolution =
params->prt.printer.resolution;
480 float x = 0.0f, y = 0.0f, swidth = 0.0f, sheight = 0.0f;
494 for(
int i=0;
i<9;
i++)
497 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[
i]), (
i == box->
alignment));
504 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_x),
x);
506 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_y), y);
508 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_width), swidth);
510 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_height), sheight);
559 g_strlcat(
params->pdf_filename,
"/pf.XXXXXX.pdf",
sizeof(
params->pdf_filename));
561 const gint fd = g_mkstemp(
params->pdf_filename);
564 dt_control_alert(_(
"Printing failed"), _(
"failed to create temporary pdf for printing"), NULL);
584 char tag[256] = { 0 };
586 snprintf (tag,
sizeof(tag),
"darktable|printed|%s",
params->prt.printer.name);
625 gtk_widget_set_sensitive(ps->
del,
FALSE);
633 if(box_index == -1)
return;
647 gtk_widget_set_sensitive(ps->
del,
FALSE);
666 if(
params->pdf_filename[0]) g_unlink(
params->pdf_filename);
724 params->job_title = g_strdup((gchar *)
res->data);
742 gchar *message = g_strdup_printf(_(
"processing `%s' for `%s'"),
params->job_title,
params->prt.printer.name);
783 for(
const GList *papers = ps->
paper_list; papers; papers = g_list_next (papers))
808 for(
const GList *media = ps->
media_list; media; media = g_list_next (media))
915 gtk_label_set_text(GTK_LABEL(ps->
width),
value);
927 const float awidth = box_size.
width;
928 const float aheight = box_size.
height;
930 const double scale = (iwidth <= awidth)
934 value = g_strdup_printf(_(
"%3.2f (dpi:%d)"), scale,
938 gtk_label_set_text(GTK_LABEL(ps->
info),
value);
948 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
960 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom),
value);
961 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left),
value);
962 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right),
value);
977 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
990 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
1003 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
1017 ps->
lock_activated = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
1027 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
b_top));
1028 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom),
value);
1029 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left),
value);
1030 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right),
value);
1044 for(
int i=0;
i<9;
i++)
1049 if(GTK_WIDGET(ps->
dtba[
i]) == tb)
1051 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[
i]),
TRUE);
1054 else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[
i]),
FALSE);
1096 const float value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
grid_size));
1112 if(unit < 0)
return;
1127 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_top), n_digits);
1128 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_bottom), n_digits);
1129 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_left), n_digits);
1130 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_right), n_digits);
1131 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_top), incr, 10.f*incr);
1132 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_bottom), incr, 10.f*incr);
1133 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_left), incr, 10.f*incr);
1134 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_right), incr, 10.f*incr);
1136 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_x), n_digits);
1137 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_y), n_digits);
1138 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_width), n_digits);
1139 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_height), n_digits);
1140 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_x), incr, 10.f*incr);
1141 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_y), incr, 10.f*incr);
1142 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_width), incr, 10.f*incr);
1143 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_height), incr, 10.f*incr);
1145 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
grid_size), n_digits);
1146 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
grid_size), incr, 10.f*incr);
1151 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_top), margin_top *
units[ps->
unit]);
1152 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom), margin_bottom *
units[ps->
unit]);
1153 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left), margin_left *
units[ps->
unit]);
1154 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right), margin_right *
units[ps->
unit]);
1157 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
grid_size), grid_size *
units[ps->
unit]);
1188 for(
const GList *prof = ps->
profiles; prof; prof = g_list_next(prof))
1213 for(
const GList *prof = ps->
profiles; prof; prof = g_list_next(prof))
1317 list = g_list_prepend(list, prof);
1324 list = g_list_prepend(list, prof);
1335 for(
size_t k = 0;
k < n_file_profiles;
k++)
1340 g_strlcpy(prof->
name, file_profiles[
k].
name,
sizeof(prof->
name));
1345 list = g_list_prepend(list, prof);
1349 return g_list_reverse(list);
1354 static int count = 0;
1360 g_signal_handlers_block_by_func(G_OBJECT(
d->printers), G_CALLBACK(
_printer_changed), NULL);
1364 if(!g_strcmp0(default_printer, printer->
name) || default_printer[0]==
'\0')
1372 g_signal_handlers_unblock_by_func(G_OBJECT(
d->printers), G_CALLBACK(
_printer_changed), NULL);
1400 const float dist = 20.0;
1406 if(fabsf(b->screen.x -
x) <
dist)
1409 if(fabsf(b->screen.y - y) <
dist)
1412 if(fabsf((b->screen.x + b->screen.width) -
x) <
dist)
1415 if(fabsf((b->screen.y + b->screen.height) - y) <
dist)
1435 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ps->
snap_grid)))
1438 const float step = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
grid_size)) *
units[ps->
unit];
1449 if(fabsf(*
x - grid_pos) < diff) *
x = grid_pos;
1460 if(fabsf(*y - grid_pos) < diff) *y = grid_pos;
1488 const float coef = dx / b->screen.width;
1493 ps->
x1 = b->screen.x + dx;
1494 ps->
y1 = b->screen.y + dy;
1495 ps->
x2 = b->screen.x + b->screen.width + dx;
1496 ps->
y2 = b->screen.y + b->screen.height + dy;
1499 ps->
x1 = b->screen.x + dx;
1502 ps->
y1 = b->screen.y + dy;
1505 ps->
x2 = b->screen.x + b->screen.width + dx;
1508 ps->
y2 = b->screen.y + b->screen.height + dy;
1511 ps->
x1 = b->screen.x + dx;
1512 ps->
y1 = b->screen.y + (coef * b->screen.height);
1515 ps->
x2 = b->screen.x + b->screen.width + dx;
1516 ps->
y1 = b->screen.y - (coef * b->screen.height);
1519 ps->
x1 = b->screen.x + dx;
1520 ps->
y2 = b->screen.y + b->screen.height - (coef * b->screen.height);
1523 ps->
x2 = b->screen.x + b->screen.width + dx;
1524 ps->
y2 = b->screen.y + b->screen.height + (coef * b->screen.height);
1560 const float tmp = *a;
1573 gtk_widget_set_sensitive(ps->
del,
TRUE);
1593 const float dx = ps->
x2 - ps->
x1;
1594 const float dy = ps->
y2 - ps->
y1;
1626 ps->
x1 = ps->
x2 =
x;
1627 ps->
y1 = ps->
y2 = y;
1640 else if(ps->
selected != -1 && which == 1)
1645 ps->
x1 = b->screen.x;
1646 ps->
y1 = b->screen.y;
1647 ps->
x2 = b->screen.x + b->screen.width;
1648 ps->
y2 = b->screen.y + b->screen.height;
1657 else if(ps->
selected != -1 && which == 3)
1675 const int x1,
const int y1,
const int x2,
const int y2)
1680 const gboolean all = sel_controls ==
BOX_ALL;
1682 cairo_move_to(cr, x1, y1);
1683 cairo_set_line_width(cr, (all || sel_controls ==
BOX_LEFT) ? sel_width : std_width);
1684 cairo_line_to(cr, x1, y2);
1687 cairo_move_to(cr, x1, y2);
1688 cairo_set_line_width(cr, (all || sel_controls ==
BOX_BOTTOM) ? sel_width : std_width);
1689 cairo_line_to(cr, x2, y2);
1692 cairo_move_to(cr, x2, y2);
1693 cairo_set_line_width(cr, (all || sel_controls ==
BOX_RIGHT) ? sel_width : std_width);
1694 cairo_line_to(cr, x2, y1);
1697 cairo_move_to(cr, x2, y1);
1698 cairo_set_line_width(cr, (all || sel_controls ==
BOX_TOP) ? sel_width : std_width);
1699 cairo_line_to(cr, x1, y1);
1702 if(sel_controls == 0)
1705 cairo_set_dash(cr, dash, 2, 0);
1708 cairo_move_to(cr, x1, y1);
1709 cairo_line_to(cr, x2, y2);
1711 cairo_move_to(cr, x1, y2);
1712 cairo_line_to(cr, x2, y1);
1716 cairo_set_dash(cr, NULL, 0, 0);
1717 cairo_set_line_width(cr, sel_width);
1748 int32_t pointerx, int32_t pointery)
1756 const float step = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
grid_size)) /
units[ps->
unit];
1759 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ps->
grid))
1763 cairo_set_source_rgba(cr, 1, .2, .2, 0.6);
1801 cairo_set_source_rgba(cr, 1, .2, .2, 0.6);
1802 cairo_set_dash(cr, NULL, 0, 0);
1810 cairo_set_source_rgba(cr, .4, .4, .4, 1.0);
1819 cairo_set_source_rgba(cr, .2, .2, .2, 1.0);
1828 float dx1, dy1, dx2, dy2, dwidth, dheight;
1829 float x1, y1, x2, y2;
1831 float pwidth, pheight;
1845 dwidth = fabsf(dx2 - dx1);
1846 dheight = fabsf(dy2 - dy1);
1861 dy2 = dy1 + dheight;
1869 cairo_set_source_rgba(cr, .4, .4, .4, 1.0);
1874 char dimensions[16];
1875 PangoLayout *layout;
1877 PangoFontDescription *desc = pango_font_description_copy_static(
dt_bauhaus_get_global()->pango_font_desc);
1878 pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
1879 pango_font_description_set_absolute_size(desc,
DT_PIXEL_APPLY_DPI(16) * PANGO_SCALE);
1880 layout = pango_cairo_create_layout(cr);
1881 pango_layout_set_font_description(layout, desc);
1890 yp = y1 + (y2 - y1 - text_h) * 0.5;
1894 snprintf(dimensions,
sizeof(dimensions),
precision, dx1);
1895 pango_layout_set_text(layout, dimensions, -1);
1896 pango_layout_get_pixel_extents(layout, NULL, &ext);
1898 if(xp < ps->imgs.screen.page.x + 3 * margin)
1900 xp = x1 + 2 * margin;
1903 yp =
MIN(y2 - text_h, yp + ext.width + 0.5 * text_h + margin * 3);
1905 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1907 cairo_line_to(cr, x1, yp + text_h * 0.5);
1908 cairo_stroke_preserve(cr);
1909 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1910 cairo_set_dash(cr, &dash, 1, dash);
1912 cairo_set_dash(cr, NULL, 0, 0);
1914 cairo_set_source_rgb(cr, .8, .8, .8);
1915 cairo_move_to(cr, xp, yp);
1916 pango_cairo_show_layout(cr, layout);
1922 pango_layout_set_text(layout, dimensions, -1);
1923 pango_layout_get_pixel_extents(layout, NULL, &ext);
1926 xp = x2 - ext.width - 2 * margin;
1927 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1928 cairo_move_to(cr, x2, yp + text_h * 0.5);
1930 cairo_stroke_preserve(cr);
1931 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1932 cairo_set_dash(cr, &dash, 1, dash);
1934 cairo_set_dash(cr, NULL, 0, 0);
1936 xp - margin, yp - margin);
1937 cairo_set_source_rgb(cr, .8, .8, .8);
1938 cairo_move_to(cr, xp, yp);
1939 pango_cairo_show_layout(cr, layout);
1942 xp = x1 + (x2 - x1 - text_h) * 0.5;
1946 snprintf(dimensions,
sizeof(dimensions),
precision, dy1);
1947 pango_layout_set_text(layout, dimensions, -1);
1948 pango_layout_get_pixel_extents(layout, NULL, &ext);
1950 if(yp < ps->imgs.screen.page.y + 3 * margin)
1952 xp =
MIN(x2 - text_h, xp + ext.width + 0.5 * text_h + margin * 3);
1953 yp = y1 + 2 * margin;
1955 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1957 cairo_line_to(cr, xp + text_h * 0.5, y1);
1958 cairo_stroke_preserve(cr);
1959 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1960 cairo_set_dash(cr, &dash, 1, dash);
1962 cairo_set_dash(cr, NULL, 0, 0);
1964 xp - margin, yp - margin);
1965 cairo_set_source_rgb(cr, .8, .8, .8);
1966 cairo_move_to(cr, xp + text_h * 0.5, yp + ext.width * 0.5);
1968 cairo_rotate(cr, -M_PI_2);
1969 cairo_rel_move_to(cr, -0.5 * ext.width, -0.5 * text_h);
1970 pango_cairo_update_layout(cr, layout);
1971 pango_cairo_show_layout(cr, layout);
1977 snprintf(dimensions,
sizeof(dimensions),
precision, pheight *
units[ps->
unit] - dy2);
1978 pango_layout_set_text(layout, dimensions, -1);
1979 pango_layout_get_pixel_extents(layout, NULL, &ext);
1982 yp = y2 - ext.width - 2 * margin;
1983 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1984 cairo_move_to(cr, xp + text_h * 0.5, y2);
1986 cairo_stroke_preserve(cr);
1987 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1988 cairo_set_dash(cr, &dash, 1, dash);
1990 cairo_set_dash(cr, NULL, 0, 0);
1992 xp - margin, yp - margin);
1993 cairo_set_source_rgb(cr, .8, .8, .8);
1994 cairo_move_to(cr, xp + text_h * 0.5, yp + ext.width * 0.5);
1996 cairo_rotate(cr, -M_PI_2);
1997 cairo_rel_move_to(cr, -0.5 * ext.width, -0.5 * text_h);
1998 pango_cairo_update_layout(cr, layout);
1999 pango_cairo_show_layout(cr, layout);
2004 snprintf(dimensions,
sizeof(dimensions),
precision, dwidth);
2005 pango_layout_set_text(layout, dimensions, -1);
2006 pango_layout_get_pixel_extents(layout, NULL, &ext);
2007 xp = (x1 + x2 - ext.width) * .5;
2008 if(y1 > text_h * 0.5 + margin)
2009 yp = y1 - text_h * 0.5;
2011 yp = y1 + text_h - 2 * margin;
2012 cairo_set_source_rgba(cr, .5, .5, .5, .9);
2014 xp - margin, yp - margin);
2015 cairo_set_source_rgb(cr, .8, .8, .8);
2016 cairo_move_to(cr, xp, yp);
2017 pango_cairo_show_layout(cr, layout);
2019 snprintf(dimensions,
sizeof(dimensions),
precision, dheight);
2020 pango_layout_set_text(layout, dimensions, -1);
2021 pango_layout_get_pixel_extents(layout, NULL, &ext);
2022 if(x1 > text_h * 0.5 + margin)
2023 xp = x1 - text_h * 0.5;
2025 xp = x1 + text_h - 2 * margin;
2026 yp = (y1 + y2) * .5;
2027 cairo_set_source_rgba(cr, .5, .5, .5, .9);
2029 xp - margin, yp - margin - 0.5 * ext.width);
2030 cairo_set_source_rgb(cr, .8, .8, .8);
2031 cairo_move_to(cr, xp + text_h * 0.5, yp);
2033 cairo_rotate(cr, -M_PI_2);
2034 cairo_rel_move_to(cr, -0.5 * ext.width, -0.5 * text_h);
2035 pango_cairo_update_layout(cr, layout);
2036 pango_cairo_show_layout(cr, layout);
2039 pango_font_description_free(desc);
2040 g_object_unref(layout);
2045 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
borderless),
TRUE);
2047 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
borderless),
FALSE);
2056 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2057 const float nv_mm = nv /
units[ps->
unit];
2075 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2076 const float nv_mm = nv /
units[ps->
unit];
2094 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2095 const float nv_mm = nv /
units[ps->
unit];
2113 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2114 const float nv_mm = nv /
units[ps->
unit];
2137 char *system_profile_dir = g_build_filename(datadir,
"color",
"out", NULL);
2138 char *user_profile_dir = g_build_filename(confdir,
"color",
"out", NULL);
2142 d->paper_list = NULL;
2143 d->media_list = NULL;
2145 d->width =
d->height = NULL;
2146 d->v_piccprofile = NULL;
2147 d->v_iccprofile = NULL;
2149 d->creation =
d->dragging =
FALSE;
2151 d->last_selected = -1;
2159 d->imgs.motion_over = -1;
2164 if(g_strcmp0(str, *
names) == 0)
2176 d->prt.page.margin_top =
_to_mm(
d, top_b);
2177 d->prt.page.margin_bottom =
_to_mm(
d, bottom_b);
2178 d->prt.page.margin_left =
_to_mm(
d, left_b);
2179 d->prt.page.margin_right =
_to_mm(
d, right_b);
2188 d->b_top = gtk_spin_button_new_with_range(0, 1000, incr);
2189 d->b_left = gtk_spin_button_new_with_range(0, 1000, incr);
2190 d->b_right = gtk_spin_button_new_with_range(0, 1000, incr);
2191 d->b_bottom = gtk_spin_button_new_with_range(0, 1000, incr);
2192 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_top), n_digits);
2193 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_bottom), n_digits);
2194 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_left), n_digits);
2195 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_right), n_digits);
2197 d->b_x = gtk_spin_button_new_with_range(0, 1000, incr);
2198 d->b_y = gtk_spin_button_new_with_range(0, 1000, incr);
2199 d->b_width = gtk_spin_button_new_with_range(0, 1000, incr);
2200 d->b_height = gtk_spin_button_new_with_range(0, 1000, incr);
2201 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_x), n_digits);
2202 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_y), n_digits);
2203 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_width), n_digits);
2204 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_height), n_digits);
2206 d->grid_size = gtk_spin_button_new_with_range(0, 100, incr);
2207 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->grid_size), n_digits);
2209 gtk_entry_set_alignment(GTK_ENTRY(
d->b_top), 1);
2210 gtk_entry_set_alignment(GTK_ENTRY(
d->b_left), 1);
2211 gtk_entry_set_alignment(GTK_ENTRY(
d->b_right), 1);
2212 gtk_entry_set_alignment(GTK_ENTRY(
d->b_bottom), 1);
2214 gtk_entry_set_alignment(GTK_ENTRY(
d->b_x), 1);
2215 gtk_entry_set_alignment(GTK_ENTRY(
d->b_y), 1);
2216 gtk_entry_set_alignment(GTK_ENTRY(
d->b_width), 1);
2217 gtk_entry_set_alignment(GTK_ENTRY(
d->b_height), 1);
2219 gtk_entry_set_alignment(GTK_ENTRY(
d->grid_size), 1);
2232 gtk_box_pack_start(GTK_BOX(self->
widget),
d->printers,
TRUE,
TRUE, 0);
2233 g_signal_connect(G_OBJECT(
d->printers),
"value-changed", G_CALLBACK(
_printer_changed), self);
2241 g_signal_connect(G_OBJECT(
d->media),
"value-changed", G_CALLBACK(
_media_changed), self);
2242 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->media),
TRUE,
TRUE, 0);
2251 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->pprofile),
TRUE,
TRUE, 0);
2252 int printer_profile_type =
dt_conf_get_int(
"plugins/print/printer/icctype");
2258 for(
const GList *l =
d->profiles; l; l = g_list_next(l))
2266 if(prof->
type == printer_profile_type &&
2270 d->v_picctype = printer_profile_type;
2271 d->v_piccprofile = g_strdup(printer_profile);
2284 d->v_piccprofile = g_strdup(
"");
2289 char *
tooltip = g_strdup_printf(_(
"printer ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
2290 gtk_widget_set_tooltip_text(
d->pprofile,
tooltip);
2303 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->pintent),
TRUE,
TRUE, 0);
2309 d->prt.printer.intent =
d->v_pintent;
2311 d->black_point_compensation = gtk_check_button_new_with_label(_(
"black point compensation"));
2312 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->black_point_compensation),
TRUE,
FALSE, 0);
2313 g_signal_connect(
d->black_point_compensation,
"toggled", G_CALLBACK(
_printer_bpc_callback), (gpointer)self);
2315 d->v_black_point_compensation =
dt_conf_get_bool(
"plugins/print/print/black_point_compensation");
2316 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
d->black_point_compensation),
d->v_black_point_compensation);
2318 gtk_widget_set_tooltip_text(
d->black_point_compensation,
2319 _(
"activate black point compensation when applying the printer profile"));
2321 gtk_widget_set_sensitive(GTK_WIDGET(
d->black_point_compensation), combo_idx==0?
FALSE:
TRUE);
2333 g_signal_connect(G_OBJECT(
d->papers),
"value-changed", G_CALLBACK(
_paper_changed), self);
2334 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->papers),
TRUE,
TRUE, 0);
2342 g_signal_connect(G_OBJECT(
d->orientation),
"value-changed", G_CALLBACK(
_orientation_changed), self);
2344 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->orientation),
TRUE,
TRUE, 0);
2354 label = gtk_label_new(_(
"image width/height"));
2356 d->width = gtk_label_new(_(
"width"));
2357 gtk_box_pack_start(GTK_BOX(hboxdim), GTK_WIDGET(
d->width),
TRUE,
TRUE, 0);
2358 label = gtk_label_new(_(
" x "));
2359 gtk_box_pack_start(GTK_BOX(hboxdim), GTK_WIDGET(label),
TRUE,
TRUE, 0);
2360 d->height = gtk_label_new(_(
"height"));
2361 gtk_box_pack_start(GTK_BOX(hboxdim), GTK_WIDGET(
d->height),
TRUE,
TRUE, 0);
2366 label = gtk_label_new(_(
"scale factor"));
2368 d->info = gtk_label_new(
"1.0");
2369 gtk_box_pack_start(GTK_BOX(hboxinfo), GTK_WIDGET(
d->info),
TRUE,
TRUE, 0);
2370 gtk_widget_set_tooltip_text(hboxinfo,
2371 _(
"image scale factor from native printer DPI:\n"
2372 " < 1 means that it is downscaled (best quality)\n"
2373 " > 1 means that the image is upscaled\n"
2374 " a too large value may result in poor print quality"));
2378 GtkGrid *bds = GTK_GRID(gtk_grid_new());
2382 d->lock_activated =
FALSE;
2385 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_top), _(
"top margin"));
2386 gtk_grid_attach(bds, GTK_WIDGET(
d->b_top), 1, 0, 1, 1);
2389 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_left), _(
"left margin"));
2390 gtk_grid_attach(bds, GTK_WIDGET(
d->b_left), 0, 1, 1, 1);
2392 d->lock_button = GTK_TOGGLE_BUTTON(gtk_toggle_button_new_with_label(_(
"lock")));
2393 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->lock_button), _(
"change all margins uniformly"));
2394 gtk_grid_attach(bds, GTK_WIDGET(
d->lock_button), 1, 1, 1, 1);
2397 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_right), _(
"right margin"));
2398 gtk_grid_attach(bds, GTK_WIDGET(
d->b_right), 2, 1, 1, 1);
2401 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_bottom), _(
"bottom margin"));
2402 gtk_grid_attach(bds, GTK_WIDGET(
d->b_bottom), 1, 2, 1, 1);
2404 gtk_widget_set_halign(GTK_WIDGET(bds), GTK_ALIGN_CENTER);
2405 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(bds),
TRUE,
TRUE, 0);
2407 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_top), top_b);
2408 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_bottom), bottom_b);
2409 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_left), left_b);
2410 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_right), right_b);
2412 g_signal_connect(G_OBJECT (
d->b_top),
"value-changed",
2414 g_signal_connect(G_OBJECT (
d->b_bottom),
"value-changed",
2416 g_signal_connect(G_OBJECT (
d->b_left),
"value-changed",
2418 g_signal_connect(G_OBJECT (
d->b_right),
"value-changed",
2420 g_signal_connect(G_OBJECT(
d->lock_button),
"toggled",
2423 gtk_widget_set_halign(GTK_WIDGET(hboxdim), GTK_ALIGN_CENTER);
2424 gtk_widget_set_halign(GTK_WIDGET(hboxinfo), GTK_ALIGN_CENTER);
2426 const gboolean lock_active =
dt_conf_get_bool(
"plugins/print/print/lock_borders");
2427 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
d->lock_button), lock_active);
2434 d->grid = gtk_check_button_new_with_label(_(
"display grid"));
2436 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(
d->grid),
TRUE,
TRUE, 0);
2437 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(
d->grid_size),
TRUE,
TRUE, 0);
2439 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->grid_size),
2442 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
TRUE,
TRUE, 0);
2444 d->snap_grid = gtk_check_button_new_with_label(_(
"snap to grid"));
2445 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(
d->snap_grid),
TRUE,
TRUE, 0);
2447 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(vbox),
TRUE,
TRUE, 0);
2449 g_signal_connect(G_OBJECT(
d->grid_size),
"value-changed", G_CALLBACK(
_grid_size_changed), self);
2450 g_signal_connect(G_OBJECT(
d->grid),
"toggled", G_CALLBACK(
_grid_callback), self);
2454 d->borderless = gtk_check_button_new_with_label(_(
"borderless mode required"));
2455 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->borderless),
TRUE,
TRUE, 0);
2456 gtk_widget_set_tooltip_text(
d->borderless,
2457 _(
"indicates that the borderless mode should be activated\n"
2458 "in the printer driver because the selected margins are\n"
2459 "below the printer hardware margins"));
2460 gtk_widget_set_sensitive(
d->borderless,
FALSE);
2468 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hboxdim),
TRUE,
TRUE, 0);
2469 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hboxinfo),
TRUE,
TRUE, 0);
2474 GtkGrid *bat = GTK_GRID(gtk_grid_new());
2477 for(
int i=0;
i<9;
i++)
2481 gtk_grid_attach (GTK_GRID (bat), GTK_WIDGET (
d->dtba[
i]), (
i%3),
i/3, 1, 1);
2486 GtkWidget *label4 = gtk_label_new(_(
"alignment"));
2487 gtk_box_pack_start(GTK_BOX(hbox22),GTK_WIDGET(label4),
TRUE,
TRUE,0);
2488 gtk_box_pack_start(GTK_BOX(hbox22), GTK_WIDGET(bat),
TRUE,
TRUE, 0);
2489 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hbox22),
TRUE,
TRUE, 0);
2496 GtkGrid *fitbut = GTK_GRID(gtk_grid_new());
2499 gtk_grid_set_column_homogeneous(fitbut,
TRUE);
2500 gtk_grid_set_row_homogeneous(fitbut,
TRUE);
2503 _(
"add a new image area on the page\n"
2504 "click and drag on the page to place the area\n"
2505 "drag&drop image from film strip on it"), 0, 0);
2508 _(
"delete the currently selected image area"), 0, 0);
2509 gtk_widget_set_sensitive(
d->del,
FALSE);
2512 _(
"remove all image areas from the page"), 0, 0);
2514 gtk_grid_attach(fitbut, GTK_WIDGET(bnew), 0, 0, 2, 1);
2515 gtk_grid_attach(fitbut, GTK_WIDGET(
d->del), 0, 1, 1, 1);
2516 gtk_grid_attach(fitbut, GTK_WIDGET(bclear), 1, 1, 1, 1);
2518 gtk_box_pack_start(GTK_BOX(mfitbox), GTK_WIDGET(fitbut),
TRUE,
TRUE, 0);
2519 gtk_box_pack_start(GTK_BOX(hfitbox), GTK_WIDGET(mfitbox),
TRUE,
TRUE, 0);
2527 gtk_widget_set_tooltip_text(
d->b_x, _(
"image area x origin (in current unit)"));
2528 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_x), 5);
2531 gtk_widget_set_tooltip_text(
d->b_y, _(
"image area y origin (in current unit)"));
2532 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_y), 5);
2534 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_x),
TRUE,
TRUE, 0);
2535 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_y),
TRUE,
TRUE, 0);
2537 gtk_box_pack_start(GTK_BOX(hfitbox), GTK_WIDGET(box),
TRUE,
TRUE, 0);
2542 gtk_widget_set_tooltip_text(
d->b_width, _(
"image area width (in current unit)"));
2543 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_width), 5);
2546 gtk_widget_set_tooltip_text(
d->b_height, _(
"image area height (in current unit)"));
2547 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_height), 5);
2549 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_width),
TRUE,
TRUE, 0);
2550 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_height),
TRUE,
TRUE, 0);
2552 gtk_box_pack_start(GTK_BOX(hfitbox), GTK_WIDGET(box),
TRUE,
TRUE, 0);
2554 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hfitbox),
TRUE,
TRUE, 0);
2556 gtk_widget_add_events(
d->b_x, GDK_BUTTON_PRESS_MASK);
2557 gtk_widget_add_events(
d->b_y, GDK_BUTTON_PRESS_MASK);
2558 gtk_widget_add_events(
d->b_width, GDK_BUTTON_PRESS_MASK);
2559 gtk_widget_add_events(
d->b_height, GDK_BUTTON_PRESS_MASK);
2561 g_signal_connect(G_OBJECT(
d->b_x),
"value-changed", G_CALLBACK(
_x_changed), (gpointer)
d);
2562 g_signal_connect(G_OBJECT(
d->b_y),
"value-changed", G_CALLBACK(
_y_changed), (gpointer)
d);
2563 g_signal_connect(G_OBJECT(
d->b_width),
"value-changed", G_CALLBACK(
_width_changed), (gpointer)
d);
2564 g_signal_connect(G_OBJECT(
d->b_height),
"value-changed", G_CALLBACK(
_height_changed), (gpointer)
d);
2577 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->profile),
TRUE,
TRUE, 0);
2585 for(
const GList *l =
d->profiles; l; l = g_list_next(l))
2590 if(prof->
type == icctype
2594 d->v_icctype = icctype;
2595 d->v_iccprofile = g_strdup(iccprofile);
2606 d->v_iccprofile = g_strdup(
"");
2612 tooltip = g_strdup_printf(_(
"output ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
2613 gtk_widget_set_tooltip_text(
d->profile,
tooltip);
2616 g_signal_connect(G_OBJECT(
d->profile),
"value-changed", G_CALLBACK(
_profile_changed), (gpointer)self);
2628 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->intent),
TRUE,
TRUE, 0);
2632 g_signal_connect (G_OBJECT (
d->intent),
"value-changed", G_CALLBACK (
_intent_callback), (gpointer)self);
2643 combo_idx = -1;
n=0;
2645 for(
const GList *st_iter = styles; st_iter; st_iter = g_list_next(st_iter))
2650 if(g_strcmp0(style->
name,current_style)==0)
2653 d->v_style = g_strdup(current_style);
2659 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->style),
TRUE,
TRUE, 0);
2660 gtk_widget_set_tooltip_text(
d->style, _(
"temporary style to use while printing"));
2667 d->v_style = g_strdup(
"");
2672 g_signal_connect (G_OBJECT (
d->style),
"value-changed",
2680 d->print_button = GTK_BUTTON(button);
2681 gtk_box_pack_start(GTK_BOX(self->
widget), button,
TRUE,
TRUE, 0);
2693 const int old_version,
int *new_version,
size_t *new_size)
2695 if(old_version == 1)
2719 const char *buf = (
const char *)old_params;
2722 const char *printer = buf;
2723 const int32_t printer_len = strlen(printer) + 1;
2727 const char *paper = buf;
2728 const int32_t paper_len = strlen(paper) + 1;
2732 const int32_t landscape = *(int32_t *)buf;
2733 buf +=
sizeof(int32_t);
2736 const char *profile = buf;
2737 const int32_t profile_len = strlen(profile) + 1;
2741 const int32_t intent = *(int32_t *)buf;
2742 buf +=
sizeof(int32_t);
2745 const char *pprofile = buf;
2746 const int32_t pprofile_len = strlen(pprofile) + 1;
2747 buf += pprofile_len;
2754 const char *profile_filename =
"", *pprofile_filename =
"";
2756 if(*profile ==
'\0' || !g_strcmp0(profile,
"none"))
2760 else if(!g_strcmp0(profile,
"sRGB"))
2764 else if(!g_strcmp0(profile,
"adobergb"))
2771 profile_filename = &profile[1];
2775 if(*pprofile ==
'\0')
2779 else if(!g_strcmp0(pprofile,
"sRGB"))
2783 else if(!g_strcmp0(pprofile,
"adobergb"))
2790 pprofile_filename = &pprofile[1];
2793 const int32_t new_profile_len = strlen(profile_filename) + 1;
2794 const int32_t new_pprofile_len = strlen(pprofile_filename) + 1;
2797 size_t new_params_size = old_params_size - profile_len - pprofile_len;
2799 new_params_size += new_profile_len + new_pprofile_len;
2800 void *new_params = malloc(new_params_size);
2804 memcpy((uint8_t *)new_params + pos, printer, printer_len);
2807 memcpy((uint8_t *)new_params + pos, paper, paper_len);
2810 memcpy((uint8_t *)new_params + pos, &landscape,
sizeof(int32_t));
2811 pos +=
sizeof(int32_t);
2813 memcpy((uint8_t *)new_params + pos, &profile_type,
sizeof(int32_t));
2814 pos +=
sizeof(int32_t);
2816 memcpy((uint8_t *)new_params + pos, profile_filename, new_profile_len);
2817 pos += new_profile_len;
2819 memcpy((uint8_t *)new_params + pos, &intent,
sizeof(int32_t));
2820 pos +=
sizeof(int32_t);
2822 memcpy((uint8_t *)new_params + pos, &pprofile_type,
sizeof(int32_t));
2823 pos +=
sizeof(int32_t);
2825 memcpy((uint8_t *)new_params + pos, pprofile_filename, new_pprofile_len);
2826 pos += new_pprofile_len;
2828 memcpy((uint8_t *)new_params + pos, buf, old_params_size - ((
char *)buf - (
char *)old_params));
2830 *new_size = new_params_size;
2834 else if(old_version == 2)
2837 size_t new_params_size = old_params_size + 1;
2838 void *new_params = calloc(1, new_params_size);
2840 memcpy(new_params, old_params, old_params_size);
2842 ((
char *)new_params)[old_params_size] =
'\0';
2844 *new_size = new_params_size;
2848 else if(old_version == 3)
2851 size_t new_params_size = old_params_size +
sizeof(int32_t) + 4 *
sizeof(
float);
2852 void *new_params = calloc(1, new_params_size);
2854 memcpy(new_params, old_params, old_params_size);
2858 int32_t idx = old_params_size;
2859 *(int32_t *)((uint8_t *)new_params + idx) = 1;
2860 idx +=
sizeof(int32_t);
2861 *(
float *)((uint8_t *)new_params + idx) = 0.05f;
2862 idx +=
sizeof(float);
2863 *(
float *)((uint8_t *)new_params + idx) = 0.05f;
2864 idx +=
sizeof(float);
2865 *(
float *)((uint8_t *)new_params + idx) = 0.90f;
2866 idx +=
sizeof(float);
2867 *(
float *)((uint8_t *)new_params + idx) = 0.90f;
2870 *new_size = new_params_size;
2885 const char *buf = (
char *)
params;
2888 const char *printer = buf;
2890 const int32_t printer_len = strlen(printer) + 1;
2893 const char *paper = buf;
2895 const int32_t paper_len = strlen(paper) + 1;
2898 const int32_t landscape = *(int32_t *)buf;
2899 buf +=
sizeof(int32_t);
2901 const int32_t f_profile_type = *(int32_t *)buf;
2902 buf +=
sizeof(int32_t);
2904 const char *f_profile = buf;
2906 const int32_t profile_len = strlen(f_profile) + 1;
2909 const int32_t intent = *(int32_t *)buf;
2910 buf +=
sizeof(int32_t);
2912 const int32_t f_pprofile_type = *(int32_t *)buf;
2913 buf +=
sizeof(int32_t);
2915 const char *f_pprofile = buf;
2917 const int32_t pprofile_len = strlen(f_pprofile) + 1;
2918 buf += pprofile_len;
2920 const int32_t pintent = *(int32_t *)buf;
2921 buf +=
sizeof(int32_t);
2923 const int32_t bpc = *(int32_t *)buf;
2924 buf +=
sizeof(int32_t);
2926 const char *style = buf;
2928 const int32_t style_len = strlen(style) + 1;
2932 buf +=
sizeof(int32_t);
2934 const double b_top = *(
double *)buf;
2937 const double b_bottom = *(
double *)buf;
2940 const double b_left = *(
double *)buf;
2943 const double b_right = *(
double *)buf;
2946 const int32_t alignment = *(int32_t *)buf;
2947 buf +=
sizeof(int32_t);
2949 const char *media = buf;
2951 const int32_t media_len = strlen(media) + 1;
2955 buf +=
sizeof(int32_t);
2960 buf +=
sizeof(float);
2962 buf +=
sizeof(float);
2964 buf +=
sizeof(float);
2966 buf +=
sizeof(float);
2970 if(
size != printer_len + paper_len + media_len + profile_len + pprofile_len + style_len + 8 *
sizeof(int32_t) + 4 *
sizeof(
double) +
sizeof(int32_t) + (ps->
imgs.
count * 4 *
sizeof(float)))
2974 if(printer[0] !=
'\0')
2977 if(paper[0] !=
'\0')
2980 if(media[0] !=
'\0')
2986 for(GList *iter = ps->
profiles; iter; iter = g_list_next(iter))
2989 if(f_profile_type ==
p->type && (f_profile_type !=
DT_COLORSPACE_FILE || !g_strcmp0(f_profile,
p->filename)))
2999 for(GList *iter = ps->
profiles; iter; iter = g_list_next(iter))
3002 if(f_pprofile_type ==
p->type && (f_pprofile_type !=
DT_COLORSPACE_FILE || !g_strcmp0(f_pprofile,
p->filename)))
3012 if(style[0] !=
'\0')
3015 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_top), b_top *
units[ps->
unit]);
3016 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom), b_bottom *
units[ps->
unit]);
3017 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left), b_left *
units[ps->
unit]);
3018 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right), b_right *
units[ps->
unit]);
3020 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[alignment]),
TRUE);
3039 const int32_t style_mode = 0;
3048 const int32_t alignment = 0;
3051 const char *profile =
"", *pprofile =
"";
3052 for(GList *iter = ps->
profiles; iter; iter = g_list_next(iter))
3055 if(
p->pos == profile_pos)
3057 profile_type =
p->type;
3058 profile =
p->filename;
3060 if(
p->ppos == pprofile_pos)
3062 pprofile_type =
p->type;
3063 pprofile =
p->filename;
3073 const int32_t printer_len = strlen (printer) + 1;
3074 const int32_t paper_len = strlen (paper) + 1;
3075 const int32_t media_len = strlen (media) + 1;
3076 const int32_t profile_len = strlen (profile) + 1;
3077 const int32_t pprofile_len = strlen (pprofile) + 1;
3078 const int32_t style_len = strlen (style) + 1;
3081 *
size = printer_len + paper_len + media_len + profile_len + pprofile_len + style_len + 8 *
sizeof(int32_t) + 4 *
sizeof(
double) +
sizeof(int32_t) + (ps->
imgs.
count * 4 *
sizeof(
float));
3088 memcpy(
params+pos, printer, printer_len);
3090 memcpy(
params+pos, paper, paper_len);
3092 memcpy(
params+pos, &landscape,
sizeof(int32_t));
3093 pos +=
sizeof(int32_t);
3094 memcpy(
params+pos, &profile_type,
sizeof(int32_t));
3095 pos +=
sizeof(int32_t);
3096 memcpy(
params+pos, profile, profile_len);
3098 memcpy(
params+pos, &intent,
sizeof(int32_t));
3099 pos +=
sizeof(int32_t);
3100 memcpy(
params+pos, &pprofile_type,
sizeof(int32_t));
3101 pos +=
sizeof(int32_t);
3102 memcpy(
params+pos, pprofile, pprofile_len);
3103 pos += pprofile_len;
3104 memcpy(
params+pos, &pintent,
sizeof(int32_t));
3105 pos +=
sizeof(int32_t);
3106 memcpy(
params+pos, &bpc,
sizeof(int32_t));
3107 pos +=
sizeof(int32_t);
3108 memcpy(
params+pos, style, style_len);
3110 memcpy(
params+pos, &style_mode,
sizeof(int32_t));
3111 pos +=
sizeof(int32_t);
3112 memcpy(
params+pos, &b_top,
sizeof(
double));
3114 memcpy(
params+pos, &b_bottom,
sizeof(
double));
3116 memcpy(
params+pos, &b_left,
sizeof(
double));
3118 memcpy(
params+pos, &b_right,
sizeof(
double));
3120 memcpy(
params+pos, &alignment,
sizeof(int32_t));
3121 pos +=
sizeof(int32_t);
3122 memcpy(
params+pos, media, media_len);
3127 pos +=
sizeof(int32_t);
3132 pos +=
sizeof(int32_t);
3134 pos +=
sizeof(int32_t);
3136 pos +=
sizeof(int32_t);
3138 pos +=
sizeof(int32_t);
3141 g_assert(pos == *
size);
3177 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_top), 17 *
units[ps->
unit]);
3179 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left), 17 *
units[ps->
unit]);
3180 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right), 17 *
units[ps->
unit]);
3191 gtk_widget_set_sensitive(GTK_WIDGET(ps->
pintent),
TRUE);
Handle default and user-set shortcuts (accelerators)
void dt_gui_add_help_link(GtkWidget *widget, char *link)
static double dist(double x1, double y1, double x2, double y2)
GtkWidget * dt_bauhaus_combobox_new_full(dt_bauhaus_t *bh, dt_gui_module_t *self, const char *label, const char *tip, int pos, GtkCallback callback, gpointer data, const char **texts)
void dt_bauhaus_combobox_clear(GtkWidget *widget)
int dt_bauhaus_combobox_get(GtkWidget *widget)
const char * dt_bauhaus_combobox_get_text(GtkWidget *widget)
void dt_bauhaus_combobox_set(GtkWidget *widget, const int pos)
void dt_bauhaus_widget_set_label(GtkWidget *widget, const char *label)
GtkWidget * dt_bauhaus_combobox_new(dt_bauhaus_t *bh, dt_gui_module_t *self)
gboolean dt_bauhaus_combobox_set_from_text(GtkWidget *widget, const char *text)
void dt_bauhaus_combobox_add(GtkWidget *widget, const char *text)
const dt_colorspaces_color_profile_t * dt_colorspaces_get_profile(dt_colorspaces_color_profile_type_t type, const char *filename, dt_colorspaces_profile_role_t role)
Resolve a profile identity to its registered entry.
size_t dt_colorspaces_enumerate_profiles(const dt_colorspaces_profile_role_t role, dt_colorprofile_desc_t **out)
Ordered snapshot of every profile registered for one role.
The colour-profile module's API: which profiles exist, and how to apply one.
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
void dt_conf_set_bool(const char *name, int val)
int dt_conf_get_bool(const char *name)
void dt_conf_set_float(const char *name, float val)
float dt_conf_get_float(const char *name)
Float for name, clamped to its declared bounds.
gchar * dt_conf_get_string(const char *name)
Read the stored string for name as a private copy.
void dt_conf_set_int(const char *name, int val)
int dt_conf_get_int(const char *name)
Integer for name, clamped to the bounds declared in the XML.
void dt_conf_set_string(const char *name, const char *val)
const char * dt_conf_get_string_const(const char *name)
Borrow the stored string for name without copying it.
dt_pdf_page_t * dt_pdf_add_page(dt_pdf_t *pdf, dt_pdf_image_t **images, int n_images)
dt_pdf_image_t * dt_pdf_add_image(dt_pdf_t *pdf, const unsigned char *image, int width, int height, int bpp, int icc_id, float border)
void dt_pdf_finish(dt_pdf_t *pdf, dt_pdf_page_t **pages, int n_pages)
dt_pdf_t * dt_pdf_start(const char *filename, float width, float height, float dpi, dt_pdf_stream_encoder_t default_encoder)
void dt_control_set_mouse_over_id(int32_t value)
void dt_control_alert(const char *title, const char *message, const char *item)
Tell the user something that must not go unseen: what it says stays true after a toast would have fad...
void dt_control_log(const char *msg,...)
void dt_control_queue_redraw_center()
Request a redraw of the centre view.
void dt_control_queue_redraw()
Request a redraw of the whole workspace.
#define dt_control_change_cursor(cursor)
struct dt_control_t * dt_control_get_global(void)
void dt_get_printer_info(const char *printer_name, dt_printer_info_t *pinfo)
void dt_print_file(const int32_t imgid, const char *filename, const char *job_title, const dt_print_info_t *pinfo)
dt_medium_info_t * dt_get_medium(GList *media, const char *name)
GList * dt_get_media_type(const dt_printer_info_t *printer)
void dt_printers_discovery(void(*cb)(dt_printer_info_t *pr, void *user_data), void *user_data)
dt_paper_info_t * dt_get_paper(GList *papers, const char *name)
GList * dt_get_papers(const dt_printer_info_t *printer)
void dt_init_print_info(dt_print_info_t *pinfo)
void expose(dt_view_t *self, cairo_t *cri, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
struct dt_view_manager_t * dt_view_manager_get_global(void)
struct dt_bauhaus_t * dt_bauhaus_get_global(void)
GHashTable * names
GtkWidget* -> the name the application knows it by.
static void dt_gui_draw_rounded_rectangle(cairo_t *cr, float width, float height, float x, float y)
void dt_loc_get_tmp_dir(char *tmpdir, size_t bufsize)
void dt_loc_get_datadir(char *datadir, size_t bufsize)
void dt_loc_get_user_config_dir(char *configdir, size_t bufsize)
void dt_image_cache_set_print_timestamp(const int32_t imgid)
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
dt_imageio_retval_t dt_imageio_export_with_flags(const int32_t imgid, const char *filename, dt_imageio_module_format_t *format, dt_imageio_module_data_t *format_params, const gboolean ignore_exif, const gboolean display_byteorder, const gboolean high_quality, const double scale_factor, const gboolean thumbnail_export, const gboolean ignore_history, const char *filter, const gboolean copy_metadata, const gboolean export_masks, dt_colorspaces_color_profile_type_t icc_type, const gchar *icc_filename, dt_iop_color_intent_t icc_intent, dt_imageio_module_storage_t *storage, dt_imageio_module_data_t *storage_params, int num, int total, dt_export_metadata_t *metadata, dt_atomic_int *shutdown)
const dt_colorspaces_color_profile_t * dt_colorspaces_get_output_profile(const int32_t imgid, dt_colorspaces_color_profile_type_t *over_type, const char *over_filename)
dt_job_state_t dt_control_job_get_state(_dt_job_t *job)
dt_job_t * dt_control_job_create(dt_job_execute_callback execute, const char *msg,...)
int dt_control_add_job(dt_control_t *control, dt_job_queue_t queue_id, _dt_job_t *job)
void * dt_control_job_get_params(const _dt_job_t *job)
void dt_control_job_set_progress(dt_job_t *job, double value)
void dt_control_job_add_progress(dt_job_t *job, const char *message, gboolean cancellable)
void dt_control_job_set_params(_dt_job_t *job, void *params, dt_job_destroy_callback callback)
void dt_control_job_dispose(_dt_job_t *job)
@ DT_JOB_QUEUE_USER_EXPORT
GtkWidget * dt_ui_section_label_new(const gchar *str)
static const dt_dev_pixelpipe_t * pipe
static const dt_iop_drawlayer_params_t * params
static int precision(double x, double adj)
GtkWidget * dt_action_button_new(dt_lib_module_t *self, const gchar *label, gpointer callback, gpointer data, const gchar *tooltip, guint accel_key, GdkModifierType mods)
_lib_location_type_t type
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
float *const restrict const size_t k
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free_align(ptr)
Release memory from dt_alloc_align() and set ptr to NULL.
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
#define dt_mipmap_cache_get(B, C, D, E, F)
#define dt_mipmap_cache_release(B)
#define DT_MODULE(MODVER)
Instantiate the version handshake every module must export. Use once, at file scope,...
#define DT_PATH_MAX
Buffer size for a filesystem path anywhere in Ansel.
#define dt_pdf_pixel_to_point(px, dpi)
#define dt_pdf_mm_to_point(mm)
@ DT_PDF_STREAM_ENCODER_FLATE
static void _page_delete_area(const dt_lib_module_t *self, const int box_index)
static void _print_job_cleanup(void *p)
void gui_reset(dt_lib_module_t *self)
static GList * _get_profiles()
int set_params(dt_lib_module_t *self, const void *params, int size)
void _get_control(dt_lib_print_settings_t *ps, float x, float y)
void * get_params(dt_lib_module_t *self, int *size)
struct _dialog_description dialog_description_t
static void _printer_changed(GtkWidget *combo, const dt_lib_module_t *self)
static void _left_border_callback(GtkWidget *spin, gpointer user_data)
void gui_post_expose(struct dt_lib_module_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
static int _print_job_run(dt_job_t *job)
int mouse_leave(struct dt_lib_module_t *self)
static void _snap_grid_callback(GtkWidget *widget, dt_lib_module_t *self)
static void _print_button_clicked(GtkWidget *widget, gpointer user_data)
static const float units[UNIT_N]
static void _profile_changed(GtkWidget *widget, dt_lib_module_t *self)
static void _paper_changed(GtkWidget *combo, const dt_lib_module_t *self)
static void _grid_size_changed(GtkWidget *widget, dt_lib_module_t *self)
static float _vscreen_to_mm(dt_lib_print_settings_t *ps, const float value, const gboolean offset)
static void _printer_bpc_callback(GtkWidget *widget, dt_lib_module_t *self)
static void _grid_callback(GtkWidget *widget, dt_lib_module_t *self)
static void _y_changed(GtkWidget *widget, gpointer user_data)
static void _top_border_callback(GtkWidget *spin, gpointer user_data)
void _fill_box_values(dt_lib_print_settings_t *ps)
static void _orientation_changed(GtkWidget *combo, dt_lib_module_t *self)
static void _page_delete_area_clicked(GtkWidget *widget, gpointer user_data)
static void _print_settings_activate_or_update_callback(gpointer instance, int32_t imgid, gpointer user_data)
enum _set_controls dt_box_control_set
static void _create_pdf(dt_job_t *job, dt_images_box imgs, const float width, const float height)
static void _x_changed(GtkWidget *widget, gpointer user_data)
void gui_cleanup(dt_lib_module_t *self)
static void _swap(float *a, float *b)
static void _bottom_border_callback(GtkWidget *spin, gpointer user_data)
static float _to_mm(dt_lib_print_settings_t *ps, double value)
static void _width_changed(GtkWidget *widget, gpointer user_data)
static float _mm_to_hscreen(dt_lib_print_settings_t *ps, const float value, const gboolean offset)
static void _set_orientation(dt_lib_print_settings_t *ps, int32_t imgid)
static void _get_page_dimension(dt_print_info_t *prt, float *width, float *height)
static void _alignment_callback(GtkWidget *tb, gpointer user_data)
static void _lock_callback(GtkWidget *button, gpointer user_data)
static float _percent_unit_of(dt_lib_print_settings_t *ps, float ref, float value)
void _cairo_rectangle(cairo_t *cr, const int sel_controls, const int x1, const int y1, const int x2, const int y2)
static void _new_printer_callback(dt_printer_info_t *printer, void *user_data)
static void _style_callback(GtkWidget *widget, dt_lib_module_t *self)
int mouse_moved(struct dt_lib_module_t *self, double x, double y, double pressure, int which)
static void _intent_callback(GtkWidget *widget, dt_lib_module_t *self)
uint32_t container(dt_lib_module_t *self)
static void _printer_intent_callback(GtkWidget *widget, dt_lib_module_t *self)
static void _printer_profile_changed(GtkWidget *widget, dt_lib_module_t *self)
int button_pressed(struct dt_lib_module_t *self, double x, double y, double pressure, int which, int type, uint32_t state)
static void _update_slider(dt_lib_print_settings_t *ps)
static void _precision_by_unit(_unit_t unit, int *n_digits, float *incr, char **format)
static float _hscreen_to_mm(dt_lib_print_settings_t *ps, const float value, const gboolean offset)
static void _media_changed(GtkWidget *combo, const dt_lib_module_t *self)
static const char * mime(dt_imageio_module_data_t *data)
void view_leave(struct dt_lib_module_t *self, struct dt_view_t *old_view, struct dt_view_t *new_view)
void gui_init(dt_lib_module_t *self)
void view_enter(struct dt_lib_module_t *self, struct dt_view_t *old_view, struct dt_view_t *new_view)
const char ** views(dt_lib_module_t *self)
void * legacy_params(dt_lib_module_t *self, const void *const old_params, const size_t old_params_size, const int old_version, int *new_version, size_t *new_size)
static void _snap_to_grid(dt_lib_print_settings_t *ps, float *x, float *y)
static void _page_clear_area_clicked(GtkWidget *widget, gpointer user_data)
static int levels(dt_imageio_module_data_t *data)
static int write_image(dt_imageio_module_data_t *data, const char *filename, const void *in, dt_colorspaces_color_profile_type_t over_type, const char *over_filename, void *exif, int exif_len, int32_t imgid, int num, int total, dt_dev_pixelpipe_t *pipe, const gboolean export_masks)
static void _page_new_area_clicked(GtkWidget *widget, gpointer user_data)
static void _height_changed(GtkWidget *widget, gpointer user_data)
static int _export_and_setup_pos(dt_job_t *job, dt_image_box *img, const int32_t idx)
static float _mm_to_vscreen(dt_lib_print_settings_t *ps, const float value, const gboolean offset)
static void _right_border_callback(GtkWidget *spin, gpointer user_data)
static int _export_image(dt_job_t *job, dt_image_box *img)
static void _set_printer(const dt_lib_module_t *self, const char *printer_name)
static const gchar * _unit_names[]
int button_released(struct dt_lib_module_t *self, double x, double y, int which, uint32_t state)
static void _unit_changed(GtkWidget *combo, dt_lib_module_t *self)
void dt_printing_get_image_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
int32_t dt_printing_get_image_box(const dt_images_box *imgs, const int x, const int y)
void dt_printing_clear_box(dt_image_box *img)
void dt_printing_setup_box(dt_images_box *imgs, const int idx, const float x, const float y, const float width, const float height)
void dt_printing_setup_image(dt_images_box *imgs, const int idx, const int32_t imgid, const int32_t width, const int32_t height, const dt_alignment_t alignment)
void dt_printing_setup_page(dt_images_box *imgs, const float page_width, const float page_height, const int resolution)
void dt_printing_clear_boxes(dt_images_box *imgs)
void dt_printing_get_image_pos_mm(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
#define MAX_IMAGE_PER_PAGE
int dt_apply_printer_profile(void **in, uint32_t width, uint32_t height, int bpp, cmsHPROFILE hInProfile, cmsHPROFILE hOutProfile, int intent, gboolean black_point_compensation)
Convert an interleaved RGB buffer from hInProfile to hOutProfile, replacing the caller's buffer with ...
The printer-profile application path: the last colour transform an image goes through before it is ha...
dt_iop_color_intent_t
ICC rendering intent, as stored in iop params and in conf.
dt_colorspaces_color_profile_type_t
@ DT_COLORSPACE_FILE
A user ICC file on disk; the only type whose filename is meaningful.
@ DT_COLORSPACE_SRGB
sRGB – registered TWICE, and the two entries are not interchangeable.
@ DT_COLORSPACE_NONE
No profile / "take it from the image settings". Never matches a list entry.
@ DT_PROFILE_ROLE_OUTPUT
Listed in the output/export-profile combo (colorout, export).
@ DT_PROFILE_ROLE_INPUT
Listed in the input-profile combo (colorin).
#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data)
#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal,...)
struct dt_control_signal_t * dt_control_signal_get_global(void)
@ DT_SIGNAL_TAG_CHANGED
This signal is raised when a tag is added/deleted/changed
@ DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE
This signal is raised when a thumb is single-clicked in the filmstrip. Views that want filmstrip clic...
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
static const dt_aligned_pixel_simd_t value
void dt_style_free(gpointer data)
GList * dt_styles_get_list(const char *filter)
const float uint32_t state[4]
A profile's public identity: what the GUI displays and stores, and nothing else.
char name[512]
translated, display-ready
char filename[DT_IOP_COLOR_ICC_LEN]
"" unless type == DT_COLORSPACE_FILE
One registered profile: its identity, its LCMS handle, and where it sits in each combo box.
cmsHPROFILE profile
the actual profile; NULL for the three category entries
char filename[DT_MAX_FILENAME_LEN]
dt_colorspaces_color_profile_type_t type
dt_colorspaces_color_profile_type_t p_icc_type
dt_iop_color_intent_t buf_icc_intent
dt_colorspaces_color_profile_type_t buf_icc_type
gboolean black_point_compensation
char pdf_filename[DT_PATH_MAX]
dt_iop_color_intent_t p_icc_intent
dt_box_control_set sel_controls
GtkWidget * black_point_compensation
GtkToggleButton * lock_button
gboolean v_black_point_compensation
GtkDarktableToggleButton * dtba[9]
dt_printer_info_t printer
dt_iop_color_intent_t intent
typedef double((*spd)(unsigned long int wavelength, double TempK))
char * dt_get_help_url(char *name)
size_t dt_utf8_strlcpy(char *dest, const char *src, size_t n)
void dt_view_print_settings(const dt_view_manager_t *vm, dt_print_info_t *pinfo, dt_images_box *imgs)
@ DT_UI_CONTAINER_PANEL_RIGHT_CENTER