68 return _(
"print settings");
73 static const char *
v[] = {
"print", NULL};
105static const gchar *
_unit_names[] = { N_(
"mm"), N_(
"cm"), N_(
"inch"), NULL };
212 *n_digits = ceilf(log10f(1.0f /
units[unit]));
215 *incr = roundf(
units[unit] * 20.0f) / 20.0f;
219 *format = g_strdup_printf(
"%%.%df", *n_digits);
302 void *exif,
int exif_len, int32_t imgid,
int num,
int total,
dt_dev_pixelpipe_t *pipe,
303 const gboolean export_masks)
307 d->params->buf = (uint16_t *)malloc((
size_t)3 * (
d->bpp == 8?1:2) *
d->head.width *
d->head.height);
311 const uint8_t *in_ptr = (
const uint8_t *)in;
312 uint8_t *out_ptr = (uint8_t *)
d->params->buf;
313 for(
int y = 0; y <
d->head.height; y++)
315 for(
int x = 0;
x <
d->head.width;
x++, in_ptr += 4, out_ptr += 3)
316 memcpy(out_ptr, in_ptr, 3);
321 const uint16_t *in_ptr = (
const uint16_t *)in;
322 uint16_t *out_ptr = (uint16_t *)
d->params->buf;
323 for(
int y = 0; y <
d->head.height; y++)
325 for(
int x = 0;
x <
d->head.width;
x++, in_ptr += 4, out_ptr += 3)
326 memcpy(out_ptr, in_ptr, 6);
349 dat.
bpp = *params->p_icc_profile ? 16 : 8;
356 dt_control_log(_(
"processing `%s' for `%s'"), params->job_title, params->prt.printer.name);
358 const gboolean export_masks =
FALSE;
359 const gboolean is_scaling =
FALSE;
363 TRUE, is_scaling,
FALSE, NULL,
FALSE, export_masks, params->buf_icc_type,
364 params->buf_icc_profile, params->buf_icc_intent, NULL, NULL, 1, 1, NULL, NULL);
373 ¶ms->buf_icc_type,
374 params->buf_icc_profile);
375 if(*params->p_icc_profile)
382 dt_control_log(_(
"cannot open printer profile `%s'"), params->p_icc_profile);
383 fprintf(stderr,
"cannot open printer profile `%s'\n", params->p_icc_profile);
392 fprintf(stderr,
"error getting output profile for image %d\n", img->
imgid);
398 pprof->
profile, params->p_icc_intent, params->black_point_compensation))
400 dt_control_log(_(
"cannot apply printer profile `%s'"), params->p_icc_profile);
401 fprintf(stderr,
"cannot apply printer profile `%s'\n", params->p_icc_profile);
408 img->
buf = params->buf;
420 const int icc_id = 0;
437 const int resolution = params->prt.printer.resolution;
468 float x = 0.0f, y = 0.0f, swidth = 0.0f, sheight = 0.0f;
482 for(
int i=0;
i<9;
i++)
485 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[
i]), (
i == box->
alignment));
492 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_x),
x);
494 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_y), y);
496 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_width), swidth);
498 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_height), sheight);
533 for(
int k=0;
k<params->imgs.count;
k++)
547 g_strlcat(params->pdf_filename,
"/pf.XXXXXX.pdf",
sizeof(params->pdf_filename));
549 const gint fd = g_mkstemp(params->pdf_filename);
553 fprintf(stderr,
"failed to create temporary pdf for printing\n");
568 dt_print_file(imgid, params->pdf_filename, params->job_title, ¶ms->prt);
573 char tag[256] = { 0 };
575 snprintf (tag,
sizeof(tag),
"darktable|printed|%s", params->prt.printer.name);
578 for(
int k=0;
k<params->imgs.count;
k++)
614 gtk_widget_set_sensitive(ps->
del,
FALSE);
622 if(box_index == -1)
return;
636 gtk_widget_set_sensitive(ps->
del,
FALSE);
655 if(params->pdf_filename[0]) g_unlink(params->pdf_filename);
659 dt_free(params->buf_icc_profile);
660 dt_free(params->p_icc_profile);
706 memcpy(¶ms->imgs, &ps->
imgs,
sizeof(ps->
imgs));
713 params->job_title = g_strdup((gchar *)res->data);
727 params->job_title = g_strdup(img->
filename);
731 gchar *message = g_strdup_printf(_(
"processing `%s' for `%s'"), params->job_title, params->prt.printer.name);
741 params->buf_icc_intent =
dt_conf_get_int(
"plugins/print/print/iccintent");
772 for(
const GList *papers = ps->
paper_list; papers; papers = g_list_next (papers))
797 for(
const GList *media = ps->
media_list; media; media = g_list_next (media))
904 gtk_label_set_text(GTK_LABEL(ps->
width),
value);
916 const float awidth = box_size.
width;
917 const float aheight = box_size.
height;
919 const double scale = (iwidth <= awidth)
923 value = g_strdup_printf(_(
"%3.2f (dpi:%d)"), scale,
927 gtk_label_set_text(GTK_LABEL(ps->
info),
value);
937 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
949 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom),
value);
950 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left),
value);
951 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right),
value);
966 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
979 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
992 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
1006 ps->
lock_activated = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
1016 const double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
b_top));
1017 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom),
value);
1018 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left),
value);
1019 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right),
value);
1033 for(
int i=0;
i<9;
i++)
1038 if(GTK_WIDGET(ps->
dtba[
i]) == tb)
1040 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[
i]),
TRUE);
1043 else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[
i]),
FALSE);
1085 const float value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
grid_size));
1101 if(unit < 0)
return;
1116 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_top), n_digits);
1117 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_bottom), n_digits);
1118 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_left), n_digits);
1119 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_right), n_digits);
1120 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_top), incr, 10.f*incr);
1121 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_bottom), incr, 10.f*incr);
1122 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_left), incr, 10.f*incr);
1123 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_right), incr, 10.f*incr);
1125 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_x), n_digits);
1126 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_y), n_digits);
1127 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_width), n_digits);
1128 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
b_height), n_digits);
1129 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_x), incr, 10.f*incr);
1130 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_y), incr, 10.f*incr);
1131 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_width), incr, 10.f*incr);
1132 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
b_height), incr, 10.f*incr);
1134 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(ps->
grid_size), n_digits);
1135 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(ps->
grid_size), incr, 10.f*incr);
1140 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_top), margin_top *
units[ps->
unit]);
1141 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom), margin_bottom *
units[ps->
unit]);
1142 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left), margin_left *
units[ps->
unit]);
1143 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right), margin_right *
units[ps->
unit]);
1146 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
grid_size), grid_size *
units[ps->
unit]);
1177 for(
const GList *prof = ps->
profiles; prof; prof = g_list_next(prof))
1202 for(
const GList *prof = ps->
profiles; prof; prof = g_list_next(prof))
1306 list = g_list_prepend(list, prof);
1313 list = g_list_prepend(list, prof);
1322 g_strlcpy(prof->
name,
p->name,
sizeof(prof->
name));
1327 list = g_list_prepend(list, prof);
1331 return g_list_reverse(list);
1336 static int count = 0;
1342 g_signal_handlers_block_by_func(G_OBJECT(
d->printers), G_CALLBACK(
_printer_changed), NULL);
1346 if(!g_strcmp0(default_printer, printer->
name) || default_printer[0]==
'\0')
1354 g_signal_handlers_unblock_by_func(G_OBJECT(
d->printers), G_CALLBACK(
_printer_changed), NULL);
1382 const float dist = 20.0;
1388 if(fabsf(b->screen.x -
x) <
dist)
1391 if(fabsf(b->screen.y - y) <
dist)
1394 if(fabsf((b->screen.x + b->screen.width) -
x) <
dist)
1397 if(fabsf((b->screen.y + b->screen.height) - y) <
dist)
1417 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ps->
snap_grid)))
1420 const float step = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
grid_size)) *
units[ps->
unit];
1431 if(fabsf(*
x - grid_pos) < diff) *
x = grid_pos;
1442 if(fabsf(*y - grid_pos) < diff) *y = grid_pos;
1470 const float coef = dx / b->screen.width;
1475 ps->
x1 = b->screen.x + dx;
1476 ps->
y1 = b->screen.y + dy;
1477 ps->
x2 = b->screen.x + b->screen.width + dx;
1478 ps->
y2 = b->screen.y + b->screen.height + dy;
1481 ps->
x1 = b->screen.x + dx;
1484 ps->
y1 = b->screen.y + dy;
1487 ps->
x2 = b->screen.x + b->screen.width + dx;
1490 ps->
y2 = b->screen.y + b->screen.height + dy;
1493 ps->
x1 = b->screen.x + dx;
1494 ps->
y1 = b->screen.y + (coef * b->screen.height);
1497 ps->
x2 = b->screen.x + b->screen.width + dx;
1498 ps->
y1 = b->screen.y - (coef * b->screen.height);
1501 ps->
x1 = b->screen.x + dx;
1502 ps->
y2 = b->screen.y + b->screen.height - (coef * b->screen.height);
1505 ps->
x2 = b->screen.x + b->screen.width + dx;
1506 ps->
y2 = b->screen.y + b->screen.height + (coef * b->screen.height);
1542 const float tmp = *a;
1555 gtk_widget_set_sensitive(ps->
del,
TRUE);
1575 const float dx = ps->
x2 - ps->
x1;
1576 const float dy = ps->
y2 - ps->
y1;
1608 ps->
x1 = ps->
x2 =
x;
1609 ps->
y1 = ps->
y2 = y;
1622 else if(ps->
selected != -1 && which == 1)
1627 ps->
x1 = b->screen.x;
1628 ps->
y1 = b->screen.y;
1629 ps->
x2 = b->screen.x + b->screen.width;
1630 ps->
y2 = b->screen.y + b->screen.height;
1639 else if(ps->
selected != -1 && which == 3)
1657 const int x1,
const int y1,
const int x2,
const int y2)
1662 const gboolean all = sel_controls ==
BOX_ALL;
1664 cairo_move_to(cr, x1, y1);
1665 cairo_set_line_width(cr, (all || sel_controls ==
BOX_LEFT) ? sel_width : std_width);
1666 cairo_line_to(cr, x1, y2);
1669 cairo_move_to(cr, x1, y2);
1670 cairo_set_line_width(cr, (all || sel_controls ==
BOX_BOTTOM) ? sel_width : std_width);
1671 cairo_line_to(cr, x2, y2);
1674 cairo_move_to(cr, x2, y2);
1675 cairo_set_line_width(cr, (all || sel_controls ==
BOX_RIGHT) ? sel_width : std_width);
1676 cairo_line_to(cr, x2, y1);
1679 cairo_move_to(cr, x2, y1);
1680 cairo_set_line_width(cr, (all || sel_controls ==
BOX_TOP) ? sel_width : std_width);
1681 cairo_line_to(cr, x1, y1);
1684 if(sel_controls == 0)
1687 cairo_set_dash(cr, dash, 2, 0);
1690 cairo_move_to(cr, x1, y1);
1691 cairo_line_to(cr, x2, y2);
1693 cairo_move_to(cr, x1, y2);
1694 cairo_line_to(cr, x2, y1);
1698 cairo_set_dash(cr, NULL, 0, 0);
1699 cairo_set_line_width(cr, sel_width);
1730 int32_t pointerx, int32_t pointery)
1738 const float step = gtk_spin_button_get_value(GTK_SPIN_BUTTON(ps->
grid_size)) /
units[ps->
unit];
1741 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ps->
grid))
1745 cairo_set_source_rgba(cr, 1, .2, .2, 0.6);
1783 cairo_set_source_rgba(cr, 1, .2, .2, 0.6);
1784 cairo_set_dash(cr, NULL, 0, 0);
1792 cairo_set_source_rgba(cr, .4, .4, .4, 1.0);
1801 cairo_set_source_rgba(cr, .2, .2, .2, 1.0);
1810 float dx1, dy1, dx2, dy2, dwidth, dheight;
1811 float x1, y1, x2, y2;
1813 float pwidth, pheight;
1827 dwidth = fabsf(dx2 - dx1);
1828 dheight = fabsf(dy2 - dy1);
1843 dy2 = dy1 + dheight;
1851 cairo_set_source_rgba(cr, .4, .4, .4, 1.0);
1856 char dimensions[16];
1857 PangoLayout *layout;
1860 pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
1861 pango_font_description_set_absolute_size(desc,
DT_PIXEL_APPLY_DPI(16) * PANGO_SCALE);
1862 layout = pango_cairo_create_layout(cr);
1863 pango_layout_set_font_description(layout, desc);
1872 yp = y1 + (y2 - y1 - text_h) * 0.5;
1876 snprintf(dimensions,
sizeof(dimensions),
precision, dx1);
1877 pango_layout_set_text(layout, dimensions, -1);
1878 pango_layout_get_pixel_extents(layout, NULL, &ext);
1880 if(xp < ps->imgs.screen.page.x + 3 * margin)
1882 xp = x1 + 2 * margin;
1885 yp =
MIN(y2 - text_h, yp + ext.width + 0.5 * text_h + margin * 3);
1887 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1889 cairo_line_to(cr, x1, yp + text_h * 0.5);
1890 cairo_stroke_preserve(cr);
1891 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1892 cairo_set_dash(cr, &dash, 1, dash);
1894 cairo_set_dash(cr, NULL, 0, 0);
1896 cairo_set_source_rgb(cr, .8, .8, .8);
1897 cairo_move_to(cr, xp, yp);
1898 pango_cairo_show_layout(cr, layout);
1904 pango_layout_set_text(layout, dimensions, -1);
1905 pango_layout_get_pixel_extents(layout, NULL, &ext);
1908 xp = x2 - ext.width - 2 * margin;
1909 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1910 cairo_move_to(cr, x2, yp + text_h * 0.5);
1912 cairo_stroke_preserve(cr);
1913 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1914 cairo_set_dash(cr, &dash, 1, dash);
1916 cairo_set_dash(cr, NULL, 0, 0);
1918 xp - margin, yp - margin);
1919 cairo_set_source_rgb(cr, .8, .8, .8);
1920 cairo_move_to(cr, xp, yp);
1921 pango_cairo_show_layout(cr, layout);
1924 xp = x1 + (x2 - x1 - text_h) * 0.5;
1928 snprintf(dimensions,
sizeof(dimensions),
precision, dy1);
1929 pango_layout_set_text(layout, dimensions, -1);
1930 pango_layout_get_pixel_extents(layout, NULL, &ext);
1932 if(yp < ps->imgs.screen.page.y + 3 * margin)
1934 xp =
MIN(x2 - text_h, xp + ext.width + 0.5 * text_h + margin * 3);
1935 yp = y1 + 2 * margin;
1937 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1939 cairo_line_to(cr, xp + text_h * 0.5, y1);
1940 cairo_stroke_preserve(cr);
1941 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1942 cairo_set_dash(cr, &dash, 1, dash);
1944 cairo_set_dash(cr, NULL, 0, 0);
1946 xp - margin, yp - margin);
1947 cairo_set_source_rgb(cr, .8, .8, .8);
1948 cairo_move_to(cr, xp + text_h * 0.5, yp + ext.width * 0.5);
1950 cairo_rotate(cr, -M_PI_2);
1951 cairo_rel_move_to(cr, -0.5 * ext.width, -0.5 * text_h);
1952 pango_cairo_update_layout(cr, layout);
1953 pango_cairo_show_layout(cr, layout);
1959 snprintf(dimensions,
sizeof(dimensions),
precision, pheight *
units[ps->
unit] - dy2);
1960 pango_layout_set_text(layout, dimensions, -1);
1961 pango_layout_get_pixel_extents(layout, NULL, &ext);
1964 yp = y2 - ext.width - 2 * margin;
1965 cairo_set_source_rgba(cr, .7, .7, .7, .9);
1966 cairo_move_to(cr, xp + text_h * 0.5, y2);
1968 cairo_stroke_preserve(cr);
1969 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1970 cairo_set_dash(cr, &dash, 1, dash);
1972 cairo_set_dash(cr, NULL, 0, 0);
1974 xp - margin, yp - margin);
1975 cairo_set_source_rgb(cr, .8, .8, .8);
1976 cairo_move_to(cr, xp + text_h * 0.5, yp + ext.width * 0.5);
1978 cairo_rotate(cr, -M_PI_2);
1979 cairo_rel_move_to(cr, -0.5 * ext.width, -0.5 * text_h);
1980 pango_cairo_update_layout(cr, layout);
1981 pango_cairo_show_layout(cr, layout);
1986 snprintf(dimensions,
sizeof(dimensions),
precision, dwidth);
1987 pango_layout_set_text(layout, dimensions, -1);
1988 pango_layout_get_pixel_extents(layout, NULL, &ext);
1989 xp = (x1 + x2 - ext.width) * .5;
1990 if(y1 > text_h * 0.5 + margin)
1991 yp = y1 - text_h * 0.5;
1993 yp = y1 + text_h - 2 * margin;
1994 cairo_set_source_rgba(cr, .5, .5, .5, .9);
1996 xp - margin, yp - margin);
1997 cairo_set_source_rgb(cr, .8, .8, .8);
1998 cairo_move_to(cr, xp, yp);
1999 pango_cairo_show_layout(cr, layout);
2001 snprintf(dimensions,
sizeof(dimensions),
precision, dheight);
2002 pango_layout_set_text(layout, dimensions, -1);
2003 pango_layout_get_pixel_extents(layout, NULL, &ext);
2004 if(x1 > text_h * 0.5 + margin)
2005 xp = x1 - text_h * 0.5;
2007 xp = x1 + text_h - 2 * margin;
2008 yp = (y1 + y2) * .5;
2009 cairo_set_source_rgba(cr, .5, .5, .5, .9);
2011 xp - margin, yp - margin - 0.5 * ext.width);
2012 cairo_set_source_rgb(cr, .8, .8, .8);
2013 cairo_move_to(cr, xp + text_h * 0.5, yp);
2015 cairo_rotate(cr, -M_PI_2);
2016 cairo_rel_move_to(cr, -0.5 * ext.width, -0.5 * text_h);
2017 pango_cairo_update_layout(cr, layout);
2018 pango_cairo_show_layout(cr, layout);
2021 pango_font_description_free(desc);
2022 g_object_unref(layout);
2027 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
borderless),
TRUE);
2029 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
borderless),
FALSE);
2038 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2039 const float nv_mm = nv /
units[ps->
unit];
2057 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2058 const float nv_mm = nv /
units[ps->
unit];
2076 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2077 const float nv_mm = nv /
units[ps->
unit];
2095 const float nv = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
2096 const float nv_mm = nv /
units[ps->
unit];
2119 char *system_profile_dir = g_build_filename(datadir,
"color",
"out", NULL);
2120 char *user_profile_dir = g_build_filename(confdir,
"color",
"out", NULL);
2124 d->paper_list = NULL;
2125 d->media_list = NULL;
2127 d->width =
d->height = NULL;
2128 d->v_piccprofile = NULL;
2129 d->v_iccprofile = NULL;
2131 d->creation =
d->dragging =
FALSE;
2133 d->last_selected = -1;
2141 d->imgs.motion_over = -1;
2146 if(g_strcmp0(str, *names) == 0)
2158 d->prt.page.margin_top =
_to_mm(
d, top_b);
2159 d->prt.page.margin_bottom =
_to_mm(
d, bottom_b);
2160 d->prt.page.margin_left =
_to_mm(
d, left_b);
2161 d->prt.page.margin_right =
_to_mm(
d, right_b);
2170 d->b_top = gtk_spin_button_new_with_range(0, 1000, incr);
2171 d->b_left = gtk_spin_button_new_with_range(0, 1000, incr);
2172 d->b_right = gtk_spin_button_new_with_range(0, 1000, incr);
2173 d->b_bottom = gtk_spin_button_new_with_range(0, 1000, incr);
2174 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_top), n_digits);
2175 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_bottom), n_digits);
2176 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_left), n_digits);
2177 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_right), n_digits);
2179 d->b_x = gtk_spin_button_new_with_range(0, 1000, incr);
2180 d->b_y = gtk_spin_button_new_with_range(0, 1000, incr);
2181 d->b_width = gtk_spin_button_new_with_range(0, 1000, incr);
2182 d->b_height = gtk_spin_button_new_with_range(0, 1000, incr);
2183 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_x), n_digits);
2184 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_y), n_digits);
2185 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_width), n_digits);
2186 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->b_height), n_digits);
2188 d->grid_size = gtk_spin_button_new_with_range(0, 100, incr);
2189 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(
d->grid_size), n_digits);
2191 gtk_entry_set_alignment(GTK_ENTRY(
d->b_top), 1);
2192 gtk_entry_set_alignment(GTK_ENTRY(
d->b_left), 1);
2193 gtk_entry_set_alignment(GTK_ENTRY(
d->b_right), 1);
2194 gtk_entry_set_alignment(GTK_ENTRY(
d->b_bottom), 1);
2196 gtk_entry_set_alignment(GTK_ENTRY(
d->b_x), 1);
2197 gtk_entry_set_alignment(GTK_ENTRY(
d->b_y), 1);
2198 gtk_entry_set_alignment(GTK_ENTRY(
d->b_width), 1);
2199 gtk_entry_set_alignment(GTK_ENTRY(
d->b_height), 1);
2201 gtk_entry_set_alignment(GTK_ENTRY(
d->grid_size), 1);
2214 gtk_box_pack_start(GTK_BOX(self->
widget),
d->printers,
TRUE,
TRUE, 0);
2215 g_signal_connect(G_OBJECT(
d->printers),
"value-changed", G_CALLBACK(
_printer_changed), self);
2223 g_signal_connect(G_OBJECT(
d->media),
"value-changed", G_CALLBACK(
_media_changed), self);
2224 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->media),
TRUE,
TRUE, 0);
2233 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->pprofile),
TRUE,
TRUE, 0);
2234 int printer_profile_type =
dt_conf_get_int(
"plugins/print/printer/icctype");
2240 for(
const GList *l =
d->profiles; l; l = g_list_next(l))
2248 if(prof->
type == printer_profile_type &&
2252 d->v_picctype = printer_profile_type;
2253 d->v_piccprofile = g_strdup(printer_profile);
2266 d->v_piccprofile = g_strdup(
"");
2271 char *
tooltip = g_strdup_printf(_(
"printer ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
2272 gtk_widget_set_tooltip_text(
d->pprofile,
tooltip);
2285 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->pintent),
TRUE,
TRUE, 0);
2291 d->prt.printer.intent =
d->v_pintent;
2293 d->black_point_compensation = gtk_check_button_new_with_label(_(
"black point compensation"));
2294 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->black_point_compensation),
TRUE,
FALSE, 0);
2295 g_signal_connect(
d->black_point_compensation,
"toggled", G_CALLBACK(
_printer_bpc_callback), (gpointer)self);
2297 d->v_black_point_compensation =
dt_conf_get_bool(
"plugins/print/print/black_point_compensation");
2298 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
d->black_point_compensation),
d->v_black_point_compensation);
2300 gtk_widget_set_tooltip_text(
d->black_point_compensation,
2301 _(
"activate black point compensation when applying the printer profile"));
2303 gtk_widget_set_sensitive(GTK_WIDGET(
d->black_point_compensation), combo_idx==0?
FALSE:
TRUE);
2315 g_signal_connect(G_OBJECT(
d->papers),
"value-changed", G_CALLBACK(
_paper_changed), self);
2316 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->papers),
TRUE,
TRUE, 0);
2324 g_signal_connect(G_OBJECT(
d->orientation),
"value-changed", G_CALLBACK(
_orientation_changed), self);
2326 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->orientation),
TRUE,
TRUE, 0);
2336 label = gtk_label_new(_(
"image width/height"));
2338 d->width = gtk_label_new(_(
"width"));
2339 gtk_box_pack_start(GTK_BOX(hboxdim), GTK_WIDGET(
d->width),
TRUE,
TRUE, 0);
2340 label = gtk_label_new(_(
" x "));
2341 gtk_box_pack_start(GTK_BOX(hboxdim), GTK_WIDGET(label),
TRUE,
TRUE, 0);
2342 d->height = gtk_label_new(_(
"height"));
2343 gtk_box_pack_start(GTK_BOX(hboxdim), GTK_WIDGET(
d->height),
TRUE,
TRUE, 0);
2348 label = gtk_label_new(_(
"scale factor"));
2350 d->info = gtk_label_new(
"1.0");
2351 gtk_box_pack_start(GTK_BOX(hboxinfo), GTK_WIDGET(
d->info),
TRUE,
TRUE, 0);
2352 gtk_widget_set_tooltip_text(hboxinfo,
2353 _(
"image scale factor from native printer DPI:\n"
2354 " < 1 means that it is downscaled (best quality)\n"
2355 " > 1 means that the image is upscaled\n"
2356 " a too large value may result in poor print quality"));
2360 GtkGrid *bds = GTK_GRID(gtk_grid_new());
2364 d->lock_activated =
FALSE;
2367 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_top), _(
"top margin"));
2368 gtk_grid_attach(bds, GTK_WIDGET(
d->b_top), 1, 0, 1, 1);
2371 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_left), _(
"left margin"));
2372 gtk_grid_attach(bds, GTK_WIDGET(
d->b_left), 0, 1, 1, 1);
2374 d->lock_button = GTK_TOGGLE_BUTTON(gtk_toggle_button_new_with_label(_(
"lock")));
2375 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->lock_button), _(
"change all margins uniformly"));
2376 gtk_grid_attach(bds, GTK_WIDGET(
d->lock_button), 1, 1, 1, 1);
2379 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_right), _(
"right margin"));
2380 gtk_grid_attach(bds, GTK_WIDGET(
d->b_right), 2, 1, 1, 1);
2383 gtk_widget_set_tooltip_text(GTK_WIDGET(
d->b_bottom), _(
"bottom margin"));
2384 gtk_grid_attach(bds, GTK_WIDGET(
d->b_bottom), 1, 2, 1, 1);
2386 gtk_widget_set_halign(GTK_WIDGET(bds), GTK_ALIGN_CENTER);
2387 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(bds),
TRUE,
TRUE, 0);
2389 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_top), top_b);
2390 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_bottom), bottom_b);
2391 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_left), left_b);
2392 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->b_right), right_b);
2394 g_signal_connect(G_OBJECT (
d->b_top),
"value-changed",
2396 g_signal_connect(G_OBJECT (
d->b_bottom),
"value-changed",
2398 g_signal_connect(G_OBJECT (
d->b_left),
"value-changed",
2400 g_signal_connect(G_OBJECT (
d->b_right),
"value-changed",
2402 g_signal_connect(G_OBJECT(
d->lock_button),
"toggled",
2405 gtk_widget_set_halign(GTK_WIDGET(hboxdim), GTK_ALIGN_CENTER);
2406 gtk_widget_set_halign(GTK_WIDGET(hboxinfo), GTK_ALIGN_CENTER);
2408 const gboolean lock_active =
dt_conf_get_bool(
"plugins/print/print/lock_borders");
2409 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
d->lock_button), lock_active);
2416 d->grid = gtk_check_button_new_with_label(_(
"display grid"));
2418 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(
d->grid),
TRUE,
TRUE, 0);
2419 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(
d->grid_size),
TRUE,
TRUE, 0);
2421 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
d->grid_size),
2424 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
TRUE,
TRUE, 0);
2426 d->snap_grid = gtk_check_button_new_with_label(_(
"snap to grid"));
2427 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(
d->snap_grid),
TRUE,
TRUE, 0);
2429 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(vbox),
TRUE,
TRUE, 0);
2431 g_signal_connect(G_OBJECT(
d->grid_size),
"value-changed", G_CALLBACK(
_grid_size_changed), self);
2432 g_signal_connect(G_OBJECT(
d->grid),
"toggled", G_CALLBACK(
_grid_callback), self);
2436 d->borderless = gtk_check_button_new_with_label(_(
"borderless mode required"));
2437 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->borderless),
TRUE,
TRUE, 0);
2438 gtk_widget_set_tooltip_text(
d->borderless,
2439 _(
"indicates that the borderless mode should be activated\n"
2440 "in the printer driver because the selected margins are\n"
2441 "below the printer hardware margins"));
2442 gtk_widget_set_sensitive(
d->borderless,
FALSE);
2450 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hboxdim),
TRUE,
TRUE, 0);
2451 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hboxinfo),
TRUE,
TRUE, 0);
2456 GtkGrid *bat = GTK_GRID(gtk_grid_new());
2459 for(
int i=0;
i<9;
i++)
2463 gtk_grid_attach (GTK_GRID (bat), GTK_WIDGET (
d->dtba[
i]), (
i%3),
i/3, 1, 1);
2468 GtkWidget *label4 = gtk_label_new(_(
"alignment"));
2469 gtk_box_pack_start(GTK_BOX(hbox22),GTK_WIDGET(label4),
TRUE,
TRUE,0);
2470 gtk_box_pack_start(GTK_BOX(hbox22), GTK_WIDGET(bat),
TRUE,
TRUE, 0);
2471 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hbox22),
TRUE,
TRUE, 0);
2478 GtkGrid *fitbut = GTK_GRID(gtk_grid_new());
2481 gtk_grid_set_column_homogeneous(fitbut,
TRUE);
2482 gtk_grid_set_row_homogeneous(fitbut,
TRUE);
2485 _(
"add a new image area on the page\n"
2486 "click and drag on the page to place the area\n"
2487 "drag&drop image from film strip on it"), 0, 0);
2490 _(
"delete the currently selected image area"), 0, 0);
2491 gtk_widget_set_sensitive(
d->del,
FALSE);
2494 _(
"remove all image areas from the page"), 0, 0);
2496 gtk_grid_attach(fitbut, GTK_WIDGET(bnew), 0, 0, 2, 1);
2497 gtk_grid_attach(fitbut, GTK_WIDGET(
d->del), 0, 1, 1, 1);
2498 gtk_grid_attach(fitbut, GTK_WIDGET(bclear), 1, 1, 1, 1);
2500 gtk_box_pack_start(GTK_BOX(mfitbox), GTK_WIDGET(fitbut),
TRUE,
TRUE, 0);
2501 gtk_box_pack_start(GTK_BOX(hfitbox), GTK_WIDGET(mfitbox),
TRUE,
TRUE, 0);
2509 gtk_widget_set_tooltip_text(
d->b_x, _(
"image area x origin (in current unit)"));
2510 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_x), 5);
2513 gtk_widget_set_tooltip_text(
d->b_y, _(
"image area y origin (in current unit)"));
2514 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_y), 5);
2516 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_x),
TRUE,
TRUE, 0);
2517 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_y),
TRUE,
TRUE, 0);
2519 gtk_box_pack_start(GTK_BOX(hfitbox), GTK_WIDGET(box),
TRUE,
TRUE, 0);
2524 gtk_widget_set_tooltip_text(
d->b_width, _(
"image area width (in current unit)"));
2525 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_width), 5);
2528 gtk_widget_set_tooltip_text(
d->b_height, _(
"image area height (in current unit)"));
2529 gtk_entry_set_width_chars(GTK_ENTRY(
d->b_height), 5);
2531 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_width),
TRUE,
TRUE, 0);
2532 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
d->b_height),
TRUE,
TRUE, 0);
2534 gtk_box_pack_start(GTK_BOX(hfitbox), GTK_WIDGET(box),
TRUE,
TRUE, 0);
2536 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(hfitbox),
TRUE,
TRUE, 0);
2538 gtk_widget_add_events(
d->b_x, GDK_BUTTON_PRESS_MASK);
2539 gtk_widget_add_events(
d->b_y, GDK_BUTTON_PRESS_MASK);
2540 gtk_widget_add_events(
d->b_width, GDK_BUTTON_PRESS_MASK);
2541 gtk_widget_add_events(
d->b_height, GDK_BUTTON_PRESS_MASK);
2543 g_signal_connect(G_OBJECT(
d->b_x),
"value-changed", G_CALLBACK(
_x_changed), (gpointer)
d);
2544 g_signal_connect(G_OBJECT(
d->b_y),
"value-changed", G_CALLBACK(
_y_changed), (gpointer)
d);
2545 g_signal_connect(G_OBJECT(
d->b_width),
"value-changed", G_CALLBACK(
_width_changed), (gpointer)
d);
2546 g_signal_connect(G_OBJECT(
d->b_height),
"value-changed", G_CALLBACK(
_height_changed), (gpointer)
d);
2559 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->profile),
TRUE,
TRUE, 0);
2567 for(
const GList *l =
d->profiles; l; l = g_list_next(l))
2572 if(prof->
type == icctype
2576 d->v_icctype = icctype;
2577 d->v_iccprofile = g_strdup(iccprofile);
2588 d->v_iccprofile = g_strdup(
"");
2594 tooltip = g_strdup_printf(_(
"output ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
2595 gtk_widget_set_tooltip_text(
d->profile,
tooltip);
2598 g_signal_connect(G_OBJECT(
d->profile),
"value-changed", G_CALLBACK(
_profile_changed), (gpointer)self);
2610 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->intent),
TRUE,
TRUE, 0);
2614 g_signal_connect (G_OBJECT (
d->intent),
"value-changed", G_CALLBACK (
_intent_callback), (gpointer)self);
2625 combo_idx = -1;
n=0;
2627 for(
const GList *st_iter = styles; st_iter; st_iter = g_list_next(st_iter))
2632 if(g_strcmp0(style->
name,current_style)==0)
2635 d->v_style = g_strdup(current_style);
2641 gtk_box_pack_start(GTK_BOX(self->
widget), GTK_WIDGET(
d->style),
TRUE,
TRUE, 0);
2642 gtk_widget_set_tooltip_text(
d->style, _(
"temporary style to use while printing"));
2649 d->v_style = g_strdup(
"");
2654 g_signal_connect (G_OBJECT (
d->style),
"value-changed",
2661 _(
"print with current settings"), GDK_KEY_p, GDK_CONTROL_MASK);
2662 d->print_button = GTK_BUTTON(button);
2663 gtk_box_pack_start(GTK_BOX(self->
widget), button,
TRUE,
TRUE, 0);
2675 const int old_version,
int *new_version,
size_t *new_size)
2677 if(old_version == 1)
2701 const char *buf = (
const char *)old_params;
2704 const char *printer = buf;
2705 const int32_t printer_len = strlen(printer) + 1;
2709 const char *paper = buf;
2710 const int32_t paper_len = strlen(paper) + 1;
2714 const int32_t landscape = *(int32_t *)buf;
2715 buf +=
sizeof(int32_t);
2718 const char *profile = buf;
2719 const int32_t profile_len = strlen(profile) + 1;
2723 const int32_t intent = *(int32_t *)buf;
2724 buf +=
sizeof(int32_t);
2727 const char *pprofile = buf;
2728 const int32_t pprofile_len = strlen(pprofile) + 1;
2729 buf += pprofile_len;
2736 const char *profile_filename =
"", *pprofile_filename =
"";
2738 if(*profile ==
'\0' || !g_strcmp0(profile,
"none"))
2742 else if(!g_strcmp0(profile,
"sRGB"))
2746 else if(!g_strcmp0(profile,
"adobergb"))
2753 profile_filename = &profile[1];
2757 if(*pprofile ==
'\0')
2761 else if(!g_strcmp0(pprofile,
"sRGB"))
2765 else if(!g_strcmp0(pprofile,
"adobergb"))
2772 pprofile_filename = &pprofile[1];
2775 const int32_t new_profile_len = strlen(profile_filename) + 1;
2776 const int32_t new_pprofile_len = strlen(pprofile_filename) + 1;
2779 size_t new_params_size = old_params_size - profile_len - pprofile_len;
2781 new_params_size += new_profile_len + new_pprofile_len;
2782 void *new_params = malloc(new_params_size);
2786 memcpy((uint8_t *)new_params + pos, printer, printer_len);
2789 memcpy((uint8_t *)new_params + pos, paper, paper_len);
2792 memcpy((uint8_t *)new_params + pos, &landscape,
sizeof(int32_t));
2793 pos +=
sizeof(int32_t);
2795 memcpy((uint8_t *)new_params + pos, &profile_type,
sizeof(int32_t));
2796 pos +=
sizeof(int32_t);
2798 memcpy((uint8_t *)new_params + pos, profile_filename, new_profile_len);
2799 pos += new_profile_len;
2801 memcpy((uint8_t *)new_params + pos, &intent,
sizeof(int32_t));
2802 pos +=
sizeof(int32_t);
2804 memcpy((uint8_t *)new_params + pos, &pprofile_type,
sizeof(int32_t));
2805 pos +=
sizeof(int32_t);
2807 memcpy((uint8_t *)new_params + pos, pprofile_filename, new_pprofile_len);
2808 pos += new_pprofile_len;
2810 memcpy((uint8_t *)new_params + pos, buf, old_params_size - ((
char *)buf - (
char *)old_params));
2812 *new_size = new_params_size;
2816 else if(old_version == 2)
2819 size_t new_params_size = old_params_size + 1;
2820 void *new_params = calloc(1, new_params_size);
2822 memcpy(new_params, old_params, old_params_size);
2824 ((
char *)new_params)[old_params_size] =
'\0';
2826 *new_size = new_params_size;
2830 else if(old_version == 3)
2833 size_t new_params_size = old_params_size +
sizeof(int32_t) + 4 *
sizeof(
float);
2834 void *new_params = calloc(1, new_params_size);
2836 memcpy(new_params, old_params, old_params_size);
2840 int32_t idx = old_params_size;
2841 *(int32_t *)((uint8_t *)new_params + idx) = 1;
2842 idx +=
sizeof(int32_t);
2843 *(
float *)((uint8_t *)new_params + idx) = 0.05f;
2844 idx +=
sizeof(float);
2845 *(
float *)((uint8_t *)new_params + idx) = 0.05f;
2846 idx +=
sizeof(float);
2847 *(
float *)((uint8_t *)new_params + idx) = 0.90f;
2848 idx +=
sizeof(float);
2849 *(
float *)((uint8_t *)new_params + idx) = 0.90f;
2852 *new_size = new_params_size;
2867 const char *buf = (
char *)params;
2870 const char *printer = buf;
2872 const int32_t printer_len = strlen(printer) + 1;
2875 const char *paper = buf;
2877 const int32_t paper_len = strlen(paper) + 1;
2880 const int32_t landscape = *(int32_t *)buf;
2881 buf +=
sizeof(int32_t);
2883 const int32_t f_profile_type = *(int32_t *)buf;
2884 buf +=
sizeof(int32_t);
2886 const char *f_profile = buf;
2888 const int32_t profile_len = strlen(f_profile) + 1;
2891 const int32_t intent = *(int32_t *)buf;
2892 buf +=
sizeof(int32_t);
2894 const int32_t f_pprofile_type = *(int32_t *)buf;
2895 buf +=
sizeof(int32_t);
2897 const char *f_pprofile = buf;
2899 const int32_t pprofile_len = strlen(f_pprofile) + 1;
2900 buf += pprofile_len;
2902 const int32_t pintent = *(int32_t *)buf;
2903 buf +=
sizeof(int32_t);
2905 const int32_t bpc = *(int32_t *)buf;
2906 buf +=
sizeof(int32_t);
2908 const char *style = buf;
2910 const int32_t style_len = strlen(style) + 1;
2914 buf +=
sizeof(int32_t);
2916 const double b_top = *(
double *)buf;
2919 const double b_bottom = *(
double *)buf;
2922 const double b_left = *(
double *)buf;
2925 const double b_right = *(
double *)buf;
2928 const int32_t alignment = *(int32_t *)buf;
2929 buf +=
sizeof(int32_t);
2931 const char *media = buf;
2933 const int32_t media_len = strlen(media) + 1;
2937 buf +=
sizeof(int32_t);
2942 buf +=
sizeof(float);
2944 buf +=
sizeof(float);
2946 buf +=
sizeof(float);
2948 buf +=
sizeof(float);
2952 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)))
2956 if(printer[0] !=
'\0')
2959 if(paper[0] !=
'\0')
2962 if(media[0] !=
'\0')
2968 for(GList *iter = ps->
profiles; iter; iter = g_list_next(iter))
2971 if(f_profile_type ==
p->type && (f_profile_type !=
DT_COLORSPACE_FILE || !g_strcmp0(f_profile,
p->filename)))
2981 for(GList *iter = ps->
profiles; iter; iter = g_list_next(iter))
2984 if(f_pprofile_type ==
p->type && (f_pprofile_type !=
DT_COLORSPACE_FILE || !g_strcmp0(f_pprofile,
p->filename)))
2994 if(style[0] !=
'\0')
2997 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_top), b_top *
units[ps->
unit]);
2998 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_bottom), b_bottom *
units[ps->
unit]);
2999 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left), b_left *
units[ps->
unit]);
3000 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right), b_right *
units[ps->
unit]);
3002 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ps->
dtba[alignment]),
TRUE);
3021 const int32_t style_mode = 0;
3030 const int32_t alignment = 0;
3033 const char *profile =
"", *pprofile =
"";
3034 for(GList *iter = ps->
profiles; iter; iter = g_list_next(iter))
3037 if(
p->pos == profile_pos)
3039 profile_type =
p->type;
3040 profile =
p->filename;
3042 if(
p->ppos == pprofile_pos)
3044 pprofile_type =
p->type;
3045 pprofile =
p->filename;
3055 const int32_t printer_len = strlen (printer) + 1;
3056 const int32_t paper_len = strlen (paper) + 1;
3057 const int32_t media_len = strlen (media) + 1;
3058 const int32_t profile_len = strlen (profile) + 1;
3059 const int32_t pprofile_len = strlen (pprofile) + 1;
3060 const int32_t style_len = strlen (style) + 1;
3063 *
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));
3066 char *params = (
char *)malloc(*
size);
3070 memcpy(params+pos, printer, printer_len);
3072 memcpy(params+pos, paper, paper_len);
3074 memcpy(params+pos, &landscape,
sizeof(int32_t));
3075 pos +=
sizeof(int32_t);
3076 memcpy(params+pos, &profile_type,
sizeof(int32_t));
3077 pos +=
sizeof(int32_t);
3078 memcpy(params+pos, profile, profile_len);
3080 memcpy(params+pos, &intent,
sizeof(int32_t));
3081 pos +=
sizeof(int32_t);
3082 memcpy(params+pos, &pprofile_type,
sizeof(int32_t));
3083 pos +=
sizeof(int32_t);
3084 memcpy(params+pos, pprofile, pprofile_len);
3085 pos += pprofile_len;
3086 memcpy(params+pos, &pintent,
sizeof(int32_t));
3087 pos +=
sizeof(int32_t);
3088 memcpy(params+pos, &bpc,
sizeof(int32_t));
3089 pos +=
sizeof(int32_t);
3090 memcpy(params+pos, style, style_len);
3092 memcpy(params+pos, &style_mode,
sizeof(int32_t));
3093 pos +=
sizeof(int32_t);
3094 memcpy(params+pos, &b_top,
sizeof(
double));
3096 memcpy(params+pos, &b_bottom,
sizeof(
double));
3098 memcpy(params+pos, &b_left,
sizeof(
double));
3100 memcpy(params+pos, &b_right,
sizeof(
double));
3102 memcpy(params+pos, &alignment,
sizeof(int32_t));
3103 pos +=
sizeof(int32_t);
3104 memcpy(params+pos, media, media_len);
3108 memcpy(params+pos, &ps->
imgs.
count,
sizeof(int32_t));
3109 pos +=
sizeof(int32_t);
3113 memcpy(params+pos, &ps->
imgs.
box[
k].
pos.
x,
sizeof(
float));
3114 pos +=
sizeof(int32_t);
3115 memcpy(params+pos, &ps->
imgs.
box[
k].
pos.
y,
sizeof(
float));
3116 pos +=
sizeof(int32_t);
3118 pos +=
sizeof(int32_t);
3120 pos +=
sizeof(int32_t);
3123 g_assert(pos == *
size);
3159 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_top), 17 *
units[ps->
unit]);
3161 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_left), 17 *
units[ps->
unit]);
3162 gtk_spin_button_set_value(GTK_SPIN_BUTTON(ps->
b_right), 17 *
units[ps->
unit]);
3173 gtk_widget_set_sensitive(GTK_WIDGET(ps->
pintent),
TRUE);
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)
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
const dt_colorspaces_color_profile_t * dt_colorspaces_get_profile(dt_colorspaces_color_profile_type_t type, const char *filename, dt_colorspaces_profile_direction_t direction)
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_colorspaces_color_profile_type_t
@ DT_PROFILE_DIRECTION_OUT
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_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)
gchar * dt_conf_get_string(const char *name)
void dt_conf_set_int(const char *name, int val)
int dt_conf_get_int(const char *name)
void dt_conf_set_string(const char *name, const char *val)
const char * dt_conf_get_string_const(const char *name)
void dt_control_set_mouse_over_id(int32_t value)
void dt_control_log(const char *msg,...)
void dt_control_queue_redraw_center()
request redraw of center window. This redraws the center view within a gdk critical section to preven...
void dt_control_queue_redraw()
request redraw of the workspace. This redraws the whole workspace within a gdk critical section to pr...
#define dt_control_change_cursor(cursor)
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)
void dt_print(dt_debug_thread_t thread, const char *msg,...)
#define DT_MODULE(MODVER)
static void dt_free_gpointer(gpointer ptr)
static const dt_aligned_pixel_simd_t value
static gboolean dt_modifier_is(const GdkModifierType state, const GdkModifierType desired_modifier_mask)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
void dtgtk_cairo_paint_alignment(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data)
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_gui_draw_rounded_rectangle(cairo_t *cr, float width, float height, float x, float y)
void dt_gui_add_help_link(GtkWidget *widget, char *link)
static GtkWidget * dt_ui_section_label_new(const gchar *str)
#define DT_GUI_BOX_SPACING
#define DT_PIXEL_APPLY_DPI(value)
void dt_image_cache_read_release(dt_image_cache_t *cache, const dt_image_t *img)
dt_image_t * dt_image_cache_get(dt_image_cache_t *cache, const int32_t imgid, char mode)
void dt_image_cache_set_print_timestamp(dt_image_cache_t *cache, const int32_t imgid)
int 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, gboolean is_scaling, const gboolean thumbnail_export, 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)
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
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)
float *const restrict const size_t k
#define dt_mipmap_cache_get(A, B, C, D, E, F)
#define dt_mipmap_cache_release(A, B)
#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)
#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data)
#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal,...)
@ 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)
struct _GtkWidget GtkWidget
void dt_style_free(gpointer data)
GList * dt_styles_get_list(const char *filter)
const float uint32_t state[4]
struct dt_gui_gtk_t * gui
struct dt_colorspaces_t * color_profiles
struct dt_mipmap_cache_t * mipmap_cache
struct dt_control_signal_t * signals
struct dt_bauhaus_t * bauhaus
struct dt_image_cache_t * image_cache
struct dt_view_manager_t * view_manager
struct dt_control_t * control
PangoFontDescription * pango_font_desc
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
char pdf_filename[PATH_MAX]
dt_colorspaces_color_profile_type_t buf_icc_type
gboolean black_point_compensation
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)
@ DT_UI_CONTAINER_PANEL_RIGHT_CENTER