From 657d8b8812f16b2c377e5b77ff2ffcc4046a7dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 16 Jul 2017 10:20:56 +0200 Subject: New upstream version 3.25.1 --- src/book.vala | 63 +++++++++-------------------------------------------------- 1 file changed, 9 insertions(+), 54 deletions(-) (limited to 'src/book.vala') diff --git a/src/book.vala b/src/book.vala index 4119cfc..a843981 100644 --- a/src/book.vala +++ b/src/book.vala @@ -15,24 +15,11 @@ public class Book public uint n_pages { get { return pages.length (); } } - private bool needs_saving_; - public bool needs_saving - { - get { return needs_saving_; } - set - { - if (needs_saving_ == value) - return; - needs_saving_ = value; - needs_saving_changed (); - } - } - public signal void page_added (Page page); public signal void page_removed (Page page); public signal void reordered (); public signal void cleared (); - public signal void needs_saving_changed (); + public signal void changed (); public signal void saving (int i); public Book () @@ -62,7 +49,7 @@ public class Book private void page_changed_cb (Page page) { - needs_saving = true; + changed (); } public void append_page (Page page) @@ -72,7 +59,7 @@ public class Book pages.append (page); page_added (page); - needs_saving = true; + changed (); } public void move_page (Page page, uint location) @@ -80,7 +67,7 @@ public class Book pages.remove (page); pages.insert (page, (int) location); reordered (); - needs_saving = true; + changed (); } public void reverse () @@ -91,7 +78,7 @@ public class Book pages = (owned) new_pages; reordered (); - needs_saving = true; + changed (); } public void combine_sides () @@ -108,7 +95,7 @@ public class Book pages = (owned) new_pages; reordered (); - needs_saving = true; + changed (); } public void combine_sides_reverse () @@ -124,7 +111,7 @@ public class Book pages = (owned) new_pages; reordered (); - needs_saving = true; + changed (); } public void delete_page (Page page) @@ -133,7 +120,7 @@ public class Book page.crop_changed.disconnect (page_changed_cb); pages.remove (page); page_removed (page); - needs_saving = true; + changed (); } public Page get_page (int page_number) @@ -148,7 +135,7 @@ public class Book return pages.index (page); } - private File make_indexed_file (string uri, int i) + public File make_indexed_file (string uri, int i) { if (n_pages == 1) return File.new_for_uri (uri); @@ -178,34 +165,6 @@ public class Book } } - private void save_ps_pdf_surface (Cairo.Surface surface, Gdk.Pixbuf image, double dpi) - { - var context = new Cairo.Context (surface); - context.scale (72.0 / dpi, 72.0 / dpi); - Gdk.cairo_set_source_pixbuf (context, image, 0, 0); - context.get_source ().set_filter (Cairo.Filter.BEST); - context.paint (); - } - - private void save_ps (File file) throws Error - { - var stream = file.replace (null, false, FileCreateFlags.NONE, null); - var writer = new PsWriter (stream); - var surface = writer.surface; - - for (var i = 0; i < n_pages; i++) - { - var page = get_page (i); - var image = page.get_image (true); - var width = image.width * 72.0 / page.dpi; - var height = image.height * 72.0 / page.dpi; - surface.set_size (width, height); - save_ps_pdf_surface (surface, image, page.dpi); - surface.show_page (); - saving (i); - } - } - private uint8[]? compress_zlib (uint8[] data) { var stream = ZLib.DeflateStream (ZLib.Level.BEST_COMPRESSION); @@ -611,12 +570,8 @@ public class Book { case "jpeg": case "png": - case "tiff": save_multi_file (type, quality, file); break; - case "ps": - save_ps (file); - break; case "pdf": save_pdf (file, quality); break; -- cgit v1.2.3