[sword-svn] r153 - trunk/src/SwordReader_GUI

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Mon Jul 21 19:50:50 MST 2008


Author: dtrotzjr
Date: 2008-07-21 19:50:49 -0700 (Mon, 21 Jul 2008)
New Revision: 153

Modified:
   trunk/src/SwordReader_GUI/SRMainFrame.cpp
   trunk/src/SwordReader_GUI/SRNumberChooser.cpp
Log:
Fixed issue #0000008 which dealt with the NumberChooser being confused when going from a book w/ a large number of chapters to a book with few. 
My fix resulted in my addressing issue #0000009, in which the NumberChooser now reflects the currently selected chapter/verse.

Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-07-22 02:01:42 UTC (rev 152)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-07-22 02:50:49 UTC (rev 153)
@@ -359,6 +359,7 @@
             break;
         case MENU_CHAP:
             m_viewChapter->SetEndNumber(GetMaxChapters());
+            m_viewChapter->SetSelectedNumber(m_keyCurVerse->Chapter());
             m_viewChapter->Show();
             m_viewBook->Hide();
             m_viewText->Hide();
@@ -367,6 +368,7 @@
             break;
         case MENU_VERSE:
             m_viewVerse->SetEndNumber(GetMaxVerses());
+            m_viewVerse->SetSelectedNumber(m_keyCurVerse->Verse());
             m_viewVerse->Show();
             m_viewBook->Hide();
             m_viewChapter->Hide();

Modified: trunk/src/SwordReader_GUI/SRNumberChooser.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRNumberChooser.cpp	2008-07-22 02:01:42 UTC (rev 152)
+++ trunk/src/SwordReader_GUI/SRNumberChooser.cpp	2008-07-22 02:50:49 UTC (rev 153)
@@ -375,6 +375,13 @@
 
 void SRNumberChooser::SetSelectedNumber(INT nSelectedNumber)
 {
+	// Adjust the starting page.
+    INT nMaxCols = MaxCols();
+	INT nMaxRows = MaxRows();
+    INT nIndex = nSelectedNumber / (nMaxCols * nMaxRows);
+    // Integer math makes this work, otherwise the (nMaxCols * nMaxRows) term would cancel.
+    m_nStartAt = nIndex * (nMaxCols * nMaxRows) + 1; 
+
     if(nSelectedNumber < 0 || nSelectedNumber > m_nEndNumber)
         m_nSelectedNumber = 0;
     else




More information about the sword-cvs mailing list