comparison src/print.c @ 2837:c8cc3884bc8d

Ref #160: Replace print dialog by standard GTK dialog https://github.com/BestImageViewer/geeqie/issues/160 Rotate to exif orientation
author Colin Clark <colin.clark@cclark.uk>
date Thu, 04 Oct 2018 16:16:25 +0100
parents ac46f4e545a4
children 87242753ed2c
comparison
equal deleted inserted replaced
2835:bb44bd76f857 2837:c8cc3884bc8d
19 */ 19 */
20 20
21 #include "main.h" 21 #include "main.h"
22 #include "print.h" 22 #include "print.h"
23 23
24 #include "exif.h"
24 #include "filedata.h" 25 #include "filedata.h"
25 #include "image-load.h" 26 #include "image-load.h"
27 #include "pixbuf_util.h"
26 #include "ui_misc.h" 28 #include "ui_misc.h"
27 #include "ui_fileops.h" 29 #include "ui_fileops.h"
28 30
29 #define PRINT_SETTINGS "print_settings" // filename save printer settings 31 #define PRINT_SETTINGS "print_settings" // filename save printer settings
30 #define PAGE_SETUP "page_setup" // filename save page setup 32 #define PAGE_SETUP "page_setup" // filename save page setup
525 gdouble pixbuf_image_width, pixbuf_image_height; 527 gdouble pixbuf_image_width, pixbuf_image_height;
526 gdouble width_offset; 528 gdouble width_offset;
527 gdouble height_offset; 529 gdouble height_offset;
528 GdkPixbuf *pixbuf; 530 GdkPixbuf *pixbuf;
529 GdkPixbuf *pixbuf_scaled; 531 GdkPixbuf *pixbuf_scaled;
532 GdkPixbuf *rotated = NULL;
530 PangoLayout *layout_image = NULL; 533 PangoLayout *layout_image = NULL;
531 PangoLayout *layout_page = NULL; 534 PangoLayout *layout_page = NULL;
532 PangoFontDescription *desc; 535 PangoFontDescription *desc;
533 GString *image_text = g_string_new(NULL); 536 GString *image_text = g_string_new(NULL);
534 GString *page_text = g_string_new(NULL); 537 GString *page_text = g_string_new(NULL);
541 gdouble pango_image_height; 544 gdouble pango_image_height;
542 gdouble pango_page_height; 545 gdouble pango_page_height;
543 GtkTextIter start, end; 546 GtkTextIter start, end;
544 gchar *tmp; 547 gchar *tmp;
545 548
549 fd = g_list_nth_data(pw->source_selection, page_nr);
550
546 pixbuf = g_list_nth_data(pw->print_pixbuf_queue, page_nr); 551 pixbuf = g_list_nth_data(pw->print_pixbuf_queue, page_nr);
552 if (fd->exif_orientation != EXIF_ORIENTATION_TOP_LEFT)
553 {
554 rotated = pixbuf_apply_orientation(pixbuf, fd->exif_orientation);
555 pixbuf = rotated;
556 }
557
547 pixbuf_image_width = gdk_pixbuf_get_width(pixbuf); 558 pixbuf_image_width = gdk_pixbuf_get_width(pixbuf);
548 pixbuf_image_height = gdk_pixbuf_get_height(pixbuf); 559 pixbuf_image_height = gdk_pixbuf_get_height(pixbuf);
549
550 fd = g_list_nth_data(pw->source_selection, page_nr);
551 560
552 if (options->printer.show_image_text) 561 if (options->printer.show_image_text)
553 { 562 {
554 if (pw->text_fields & TEXT_INFO_FILENAME) 563 if (pw->text_fields & TEXT_INFO_FILENAME)
555 { 564 {
747 g_object_unref(layout_page); 756 g_object_unref(layout_page);
748 g_string_free(page_text, TRUE); 757 g_string_free(page_text, TRUE);
749 } 758 }
750 759
751 g_object_unref(pixbuf_scaled); 760 g_object_unref(pixbuf_scaled);
761 if (rotated) g_object_unref(rotated);
752 762
753 return; 763 return;
754 } 764 }
755 765
756 static void begin_print(GtkPrintOperation *operation, 766 static void begin_print(GtkPrintOperation *operation,