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

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Mon Sep 8 00:36:39 MST 2008


Author: dtrotzjr
Date: 2008-09-08 00:36:39 -0700 (Mon, 08 Sep 2008)
New Revision: 176

Modified:
   trunk/src/SwordReader_GUI/SRMainFrame.cpp
   trunk/src/SwordReader_GUI/SRModuleView.cpp
   trunk/src/SwordReader_GUI/SRTabbedViews.cpp
   trunk/src/SwordReader_GUI/SRTabbedViews.h
Log:
More polish on tabbed displays. Getting closer to something testable.

Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-09-08 05:46:38 UTC (rev 175)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-09-08 07:36:39 UTC (rev 176)
@@ -353,10 +353,14 @@
 
 VOID SRMainFrame::SaveOptions()
 {
-    /*REM
-    (*m_confOptions)["History"]["LastVersion"] = m_viewModules[m_nCurrentModule]->GetModule()->Name();
-    (*m_confOptions)["History"]["LastPassage"] = m_viewModules[m_nCurrentModule]->GetVerseKey().getText();
-    */
+    CHAR buff[32] = {0};   
+    (*m_confOptions)["History"]["LastBibleVersion"] = m_tabViews->GetBibleModule()->Name();
+    (*m_confOptions)["History"]["LastBiblePassage"] = m_tabViews->GetBibleModule()->getKey()->getText();
+    (*m_confOptions)["History"]["LastCommVersion"] = m_tabViews->GetCommModule()->Name();
+    (*m_confOptions)["History"]["LastCommPassage"] = m_tabViews->GetCommModule()->getKey()->getText();
+    sprintf(buff, "%d", m_tabViews->m_tabs.GetCurSel());
+    (*m_confOptions)["History"]["LastTabViewed"] = buff;
+
     for(int i = 0; i < m_nTotalOpts; i++){
         (*m_confOptions)["GlobalOptions"][m_bufModOptions[i].c_str()] = m_swmgr->getGlobalOption(m_bufModOptions[i]);
     }
@@ -531,9 +535,11 @@
         nCurID++;
     }    
     */
-
-    verse = new VerseKey((*m_confOptions)["History"].getWithDefault("LastPassage", "Gen 1:1"));
+    INT nLastTab = atoi((*m_confOptions)["History"].getWithDefault("LastTabViewed", "0"));
+    m_tabViews->ManualChangeCurrentTab(nLastTab);
+    verse = new VerseKey((*m_confOptions)["History"].getWithDefault("LastBiblePassage", "Gen 1:1"));
     m_tabViews->SetBibleKey(*verse);
+    verse = new VerseKey((*m_confOptions)["History"].getWithDefault("LastCommPassage", "Gen 1:1"));
     m_tabViews->SetCommKey(*verse);
     
     delete verse;

Modified: trunk/src/SwordReader_GUI/SRModuleView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.cpp	2008-09-08 05:46:38 UTC (rev 175)
+++ trunk/src/SwordReader_GUI/SRModuleView.cpp	2008-09-08 07:36:39 UTC (rev 176)
@@ -68,13 +68,21 @@
     if(m_verse == verse)
         return;
     AbortThread();
-    
-    if(verse.Book() != m_verse.Book() || (m_verse.Book == verse.Book() && m_verse.Chapter() != verse.Chapter()))
-        m_fChapterChanged = true;
-    
-    m_verse = verse;
-
-    LoadTextView();
+    if(m_viewType == BibleView){
+        if(verse.Book() != m_verse.Book() || (m_verse.Book == verse.Book() && m_verse.Chapter() != verse.Chapter())){
+            m_fChapterChanged = true;
+            m_verse = verse;
+            LoadTextView();
+        }else{
+            ScrollToVerse(verse.Verse());
+        }
+    }else if(m_viewType == CommView){
+        if(m_verse != verse){
+            m_fChapterChanged = true;
+            m_verse = verse;
+            LoadTextView();
+        }
+    }
 }
 
 VOID SRModuleView::SetBook(INT nBook)

Modified: trunk/src/SwordReader_GUI/SRTabbedViews.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.cpp	2008-09-08 05:46:38 UTC (rev 175)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.cpp	2008-09-08 07:36:39 UTC (rev 176)
@@ -322,13 +322,17 @@
     UINT test = TCN_SELCHANGE;
     switch(pnmh->code)
     {
+    case TCN_SELCHANGING:
+        if(m_tabs.GetCurSel() < 2) // i.e. this was a tab with a versekey
+            m_keyLinked = GetCurrentVerseKey();
+        return FALSE;
     case TCN_SELCHANGE:
         SwitchToCurrentView();
+        m_pParentWnd->SetFocus(); // Give focus back to the parent.
         break;
     default:
         return FALSE;
     }
-    m_pParentWnd->SetFocus(); // Give focus back to the parent.
     return TRUE;
 }
 
@@ -337,10 +341,12 @@
     switch(m_tabs.GetCurSel())
     {
     case SR_TAB_BIBLE:
+        m_viewBible->SetKey(m_keyLinked);
         m_viewBible->Show();
         m_viewComm->Hide();
         break;
     case SR_TAB_COMM:
+        m_viewComm->SetKey(m_keyLinked);
         m_viewComm->Show();
         m_viewBible->Hide();
         break;
@@ -349,4 +355,10 @@
         m_viewComm->Hide();
         break;
     }
+}
+
+VOID SRTabbedViews::ManualChangeCurrentTab(INT nNewTab)
+{
+    m_tabs.SetCurSel(nNewTab);
+    SwitchToCurrentView();
 }
\ No newline at end of file

Modified: trunk/src/SwordReader_GUI/SRTabbedViews.h
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.h	2008-09-08 05:46:38 UTC (rev 175)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.h	2008-09-08 07:36:39 UTC (rev 176)
@@ -43,6 +43,8 @@
     VOID SetCurrentVerse(INT nVerse, BOOL fScroll);
     VOID SetCurrentModule(SWModule *pModule);
     VOID SetCurrentKey(const VerseKey &verse);
+    VOID SetLinkedKey(const VerseKey &key) { m_keyLinked = key; }
+    VOID ManualChangeCurrentTab(INT nNewTab);
     
     void MoveWindow(LPCRECT lpRect,BOOL bRepaint = TRUE);
     BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
@@ -58,4 +60,5 @@
     
     SRModuleView *m_viewBible;
     SRModuleView *m_viewComm;
+    VerseKey     m_keyLinked;
 };




More information about the sword-cvs mailing list