Fix navigation in twoPagesSpread mode stripview
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 3 Jul 2007 23:46:02 +0000 (01:46 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 3 Jul 2007 23:46:02 +0000 (01:46 +0200)
src/comicmain.cpp

index 9567c7d..c0c867d 100644 (file)
@@ -838,15 +838,6 @@ void ComicMainWindow::jumpToPage(int n, bool force)
 
                 if (twoPagesAction->isOn())
                 {
-                       img2 = sink->getImage(currpage + (++page_off), result2);
-
-                       if (result2 == 0 && img2->getFormat() == STRIP_FORMAT && stripModeAction->isOn()) {
-                               list[0].append(img1);
-                               nextpage = buildStripList(currpage+page_off, img2, &(list[1]), false);
-                               jumpToStrip(n, list, true);
-                               return;
-                       }
-
                        // If the first page is a spread and we consider spreads as
                        // two pages, skip loading a second page and mark this
                        if (img1->getFormat() == SPREAD_FORMAT && cfg->twoPagesSpread())
@@ -857,8 +848,18 @@ void ComicMainWindow::jumpToPage(int n, bool force)
                        else
                        {
                                spreading = false;
+
+                               img2 = sink->getImage(currpage + (++page_off), result2);
+
+                               if (result2 == 0 && img2->getFormat() == STRIP_FORMAT && stripModeAction->isOn()) {
+                                       list[0].append(img1);
+                                       nextpage = buildStripList(currpage+page_off, img2, &(list[1]), false);
+                                       jumpToStrip(n, list, true);
+                                       return;
+                               }
                        }
 
+
                        // If the second page is a spread, and we consider spreads as
                        // two pages, there are two possible ways of handling the lone
                        // first page: either we display it alone, or we display it
@@ -873,17 +874,21 @@ void ComicMainWindow::jumpToPage(int n, bool force)
                        {
                                if (cfg->twoPagesSkip())
                                { // Skip spreads:
+                                       int save_page_off = page_off;
                                        while (result2 == 0 && img2->getFormat() == SPREAD_FORMAT)
                                        {
                                                delete img2;
                                                img2 = sink->getImage(currpage + (++page_off), result2);
                                                spreading = true;
                                        }
+                                       page_off = save_page_off - 1; // Reset counter for next page
                                }
                                else
                                { // Stop at spreads:
                                        result2 = 1;
                                        spreading = true;
+                                       delete img2;
+                                       --page_off; // Reset counter for next page
                                }
                        }