diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-03-23 19:39:03 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-03-23 19:39:03 +0100 |
commit | 1676db749dc23da9fcd9c767de2f1e9a0c61b2b2 (patch) | |
tree | d575e4db5a722421795ed6194da81d50d5a7fae4 /src/book.vala | |
parent | c4ee1d5857bc5b93d501a42a070be1d9faa3a48a (diff) |
New upstream version 44.0upstream/44.0
Diffstat (limited to 'src/book.vala')
-rw-r--r-- | src/book.vala | 26 |
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> (); |