summaryrefslogtreecommitdiff
path: root/src/book.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-03-23 19:39:06 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-03-23 19:39:06 +0100
commit38ac62651d156559476f3e147575887781d330b2 (patch)
tree99843d21369bb3ad3f5ad72071df30c99335c6f3 /src/book.vala
parente2e8c38f24f25469f2a154c82d2cb9804e9f8785 (diff)
parent1676db749dc23da9fcd9c767de2f1e9a0c61b2b2 (diff)
Update upstream source from tag 'upstream/44.0'
Update to upstream version '44.0' with Debian dir a228d21d874f6f97e085fc1b64e77b9556d9bcfb
Diffstat (limited to 'src/book.vala')
-rw-r--r--src/book.vala26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/book.vala b/src/book.vala
index d2aa54d..e25eb35 100644
--- a/src/book.vala
+++ b/src/book.vala
@@ -11,6 +11,12 @@
public delegate void ProgressionCallback (double fraction);
+// Assumes first page has index 0
+public enum FlipEverySecond {
+ Even = 1,
+ Odd = 0,
+}
+
public class Book : Object
{
private List<Page> pages;
@@ -99,6 +105,26 @@ public class Book : Object
changed ();
}
+ public void flip_every_second (FlipEverySecond flip)
+ {
+ var new_pages = new List<Page> ();
+ for (var i = 0; i < n_pages; i++)
+ {
+ var page = pages.nth_data (i);
+ if (i % 2 == (int)flip) {
+ page.rotate_left();
+ page.rotate_left();
+ new_pages.append (page);
+ } else {
+ new_pages.append (page);
+ }
+ }
+ pages = (owned) new_pages;
+
+ reordered ();
+ changed ();
+ }
+
public void combine_sides_reverse ()
{
var new_pages = new List<Page> ();