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

dtrotzjr at crosswire.org dtrotzjr at crosswire.org
Sat Jan 3 22:45:25 MST 2009


Author: dtrotzjr
Date: 2009-01-03 22:45:25 -0700 (Sat, 03 Jan 2009)
New Revision: 191

Added:
   trunk/src/SwordReader_GUI/SRBibleWidget.cpp
   trunk/src/SwordReader_GUI/SRBibleWidget.h
Modified:
   trunk/src/SwordReader_GUI/SRLexiView.cpp
   trunk/src/SwordReader_GUI/SRLexiView.h
   trunk/src/SwordReader_GUI/SRMainFrame.cpp
   trunk/src/SwordReader_GUI/SRModuleView.cpp
   trunk/src/SwordReader_GUI/SRModuleView.h
   trunk/src/SwordReader_GUI/SRTabbedViews.cpp
   trunk/src/SwordReader_GUI/SRTabbedViews.h
   trunk/src/SwordReader_GUI/SRTextView.cpp
   trunk/src/SwordReader_GUI/SRTextView.h
   trunk/src/SwordReader_GUI/SwordReaderResource.h
   trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
Log:
Started on strongs greek and hebrew sub-windows. Builds does not run properly.

Added: trunk/src/SwordReader_GUI/SRBibleWidget.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRBibleWidget.cpp	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRBibleWidget.cpp	2009-01-04 05:45:25 UTC (rev 191)
@@ -0,0 +1,236 @@
+#include "SRBibleWidget.h"
+#include "SRFramework\SRApp.h"
+
+BOOL SRBibleWidget::s_fRegistered = false;
+
+SRBibleWidget::SRBibleWidget()
+:m_viewBible(NULL)
+,m_viewLexi(NULL)
+,m_modGreekDef(NULL)
+,m_modGreekMorph(NULL)
+,m_modHebrewDef(NULL)
+,m_modHebrewMorph(NULL)
+{
+    m_wcsClassName = "SRBibleWidget";
+    m_wcsWindowName = "";
+    m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+}
+
+SRBibleWidget::~SRBibleWidget()
+{
+
+}
+
+BOOL SRBibleWidget::Create(SRWnd *pParentWnd, RECT bounds)
+{
+    if(!Register())
+        return FALSE;
+
+    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName,WS_CHILD | WS_VISIBLE, bounds, pParentWnd, NULL, m_hInstance))
+        return FALSE;
+
+
+    return TRUE;
+}
+
+BOOL SRBibleWidget::Register()
+{
+    // Register window class...
+    WNDCLASS    wc;
+    if(s_fRegistered)
+        return TRUE;
+
+    wc.style            = CS_HREDRAW | CS_VREDRAW | CS_PARENTDC;
+    wc.lpfnWndProc      = (WNDPROC) MessageRoute;
+    wc.cbClsExtra       = 0;
+    wc.cbWndExtra       = 0;
+    wc.hInstance        = m_hInstance;
+    wc.hIcon            = NULL;
+    wc.hCursor          = 0;
+    wc.hbrBackground    = (HBRUSH) GetStockObject(WHITE_BRUSH);
+    wc.lpszMenuName     = 0;
+    wc.lpszClassName    = m_wcsClassName.w_str();
+
+    if(RegisterClass(&wc) == 0) 
+        return FALSE;
+    
+    s_fRegistered = TRUE;
+
+    return TRUE;
+}
+
+
+BOOL SRBibleWidget::OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl)
+{
+    if(m_pParentWnd)
+        return m_pParentWnd->OnCommand(wNotifyCode, wID, hWndCtl);
+    return FALSE;
+}
+
+VOID SRBibleWidget::SetModule(SWModule *pModule)
+{
+    if(m_viewBible)
+        m_viewBible->SetModule(pModule);
+}
+
+VOID SRBibleWidget::SetKey(const VerseKey &verse)
+{
+    if(m_viewBible)
+        m_viewBible->SetKey(verse);
+}
+
+VOID SRBibleWidget::SetBook(INT nBook)
+{
+    if(m_viewBible)
+        m_viewBible->SetBook(nBook);
+}
+
+VOID SRBibleWidget::SetChapter(INT nChapter)
+{
+    if(m_viewBible)
+        m_viewBible->SetChapter(nChapter);
+}
+
+VOID SRBibleWidget::SetVerse(INT nVerse, BOOL fScroll)
+{
+    if(m_viewBible)
+        m_viewBible->SetVerse(nVerse, fScroll);
+}
+
+WCString SRBibleWidget::GetWindowTitle()
+{
+    if(m_viewBible)
+        return m_viewBible->GetWindowTitle();
+    return "";
+}
+
+const SWModule*   SRBibleWidget::GetModule() 
+{ 
+    if(m_viewBible)
+        return m_viewBible->GetModule();
+    return NULL;
+}
+
+INT SRBibleWidget::GetBook()
+{
+    if(m_viewBible)
+        return m_viewBible->GetBook();
+    return -1;
+}
+
+INT SRBibleWidget::GetChapter()
+{
+    if(m_viewBible)
+        return m_viewBible->GetChapter();
+    return -1;
+}
+
+INT SRBibleWidget::GetVerse()
+{
+    if(m_viewBible)
+        return m_viewBible->GetVerse();
+    return -1;
+}
+
+const VerseKey& SRBibleWidget::GetVerseKey() const
+{
+    if(m_viewBible)
+        return m_viewBible->GetVerseKey();
+    return m_keyDummy;
+}
+
+INT SRBibleWidget::GetTestament()
+{
+    if(m_viewBible)
+        return m_viewBible->GetTestament();
+    return -1;
+}
+
+INT SRBibleWidget::GetChapterMax() 
+{
+    if(m_viewBible)
+        return m_viewBible->GetChapterMax();
+    return -1;
+}
+
+INT SRBibleWidget::GetVerseMax()
+{
+    if(m_viewBible)
+        return m_viewBible->GetVerseMax();
+    return -1;
+}
+VOID SRBibleWidget::SetSwordReady()
+{
+    if(m_viewBible)
+        m_viewBible->SetSwordReady();
+    if(m_viewLexi)
+        m_viewLexi->SetSwordReady();
+}
+
+BOOL SRBibleWidget::Init()
+{
+    RECT clientRect;
+    RECT lexiRect = {0,0,0,0};
+    GetClientRect(m_hWnd, &clientRect);
+
+    m_viewBible = new SRModuleView(BibleView);
+    if(!m_viewBible || !m_viewBible->Create(this, clientRect))
+        return FALSE;
+
+    m_viewLexi = new SRLexiView(TRUE);
+    if(!m_viewLexi || !m_viewLexi->Create(this, lexiRect))
+        return FALSE;
+    
+
+    return TRUE;
+}
+
+VOID SRBibleWidget::Show()
+{
+    SRWnd::Show();
+    if(m_viewBible)
+        m_viewBible->Show();
+}
+    
+BOOL SRBibleWidget::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+    if(m_viewBible)
+        return m_viewBible->OnKeyDown(nChar, nRepCnt, nFlags);
+    return FALSE;
+}
+
+VOID SRBibleWidget::SetGreekDefModule(SWModule *pModule)
+{
+    m_modGreekDef = pModule;
+}
+
+VOID SRBibleWidget::SetGreekMorphModule(SWModule *pModule)
+{
+    m_modGreekMorph = pModule;
+}
+
+VOID SRBibleWidget::SetHebrewDefModule(SWModule *pModule)
+{
+    m_modHebrewDef = pModule;
+}
+
+VOID SRBibleWidget::SetHebrewMorphModule(SWModule *pModule)
+{
+    m_modHebrewMorph = pModule;
+}
+
+VOID SRBibleWidget::ShowSubWindow()
+{
+    RECT clientRect;
+    RECT mainRect, subRect;
+    GetClientRect(m_hWnd, &clientRect);
+    mainRect = clientRect;
+    subRect = clientRect;
+    mainRect.bottom -= 80;
+    subRect.top = mainRect.bottom;
+    if(m_viewBible && m_viewLexi){
+        m_viewBible->MoveWindow(&mainRect);
+        m_viewLexi->Show();
+        m_viewLexi->MoveWindow(&subRect);
+    }
+}
\ No newline at end of file

Added: trunk/src/SwordReader_GUI/SRBibleWidget.h
===================================================================
--- trunk/src/SwordReader_GUI/SRBibleWidget.h	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRBibleWidget.h	2009-01-04 05:45:25 UTC (rev 191)
@@ -0,0 +1,50 @@
+#pragma once
+#include "SRModuleView.h"
+#include "SRModuleHolder.h"
+#include "SRLexiView.h"
+#include "swmodule.h"
+#include "versekey.h"
+
+class SRBibleWidget : public SRWnd, public SRModuleHolder
+{
+public:
+    SRBibleWidget();
+    ~SRBibleWidget();
+    BOOL Create(SRWnd *pParentWnd, RECT bounds);
+    BOOL Register();
+    BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
+    VOID        SetModule(SWModule *pModule);
+    VOID        SetKey(const VerseKey &verse);
+    VOID        SetBook(INT nBook);
+    VOID        SetChapter(INT nChapter);
+    VOID        SetVerse(INT nVerse, BOOL fScroll);
+    BOOL        Init();
+    WCString    GetWindowTitle();
+    const SWModule*   GetModule();
+    INT         GetBook();
+    INT         GetChapter();
+    INT         GetVerse();
+    const VerseKey& GetVerseKey() const;
+    INT         GetTestament();
+    INT         GetChapterMax();
+    INT         GetVerseMax();
+    VOID        SetSwordReady();
+    VOID        Show();
+    VOID        SetGreekDefModule(SWModule *pModule);
+    VOID        SetGreekMorphModule(SWModule *pModule);
+    VOID        SetHebrewDefModule(SWModule *pModule);
+    VOID        SetHebrewMorphModule(SWModule *pModule);
+
+    VOID        ShowSubWindow();
+    
+    BOOL        OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+private:
+    static BOOL s_fRegistered;
+    SRModuleView    *m_viewBible;
+    SRLexiView      *m_viewLexi;
+    SWModule        *m_modGreekDef;
+    SWModule        *m_modGreekMorph;
+    SWModule        *m_modHebrewMorph;
+    SWModule        *m_modHebrewDef;
+    VerseKey        m_keyDummy;
+};
\ No newline at end of file

Modified: trunk/src/SwordReader_GUI/SRLexiView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRLexiView.cpp	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRLexiView.cpp	2009-01-04 05:45:25 UTC (rev 191)
@@ -1,7 +1,8 @@
 #include "SRLexiView.h"
 
-SRLexiView::SRLexiView()
-:m_pModule(NULL)
+SRLexiView::SRLexiView(BOOL fIsSubWindow)
+:SRTextView(fIsSubWindow)
+,m_pModule(NULL)
 ,m_fSwordInit(FALSE)
 {
 }

Modified: trunk/src/SwordReader_GUI/SRLexiView.h
===================================================================
--- trunk/src/SwordReader_GUI/SRLexiView.h	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRLexiView.h	2009-01-04 05:45:25 UTC (rev 191)
@@ -11,7 +11,7 @@
 class SRLexiView : public SRTextView
 {
 public:
-    SRLexiView();
+    SRLexiView(BOOL fIsSubWindow = FALSE);
     virtual ~SRLexiView();
 
     VOID        SetEntry(const WCString &entry);

Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp	2009-01-04 05:45:25 UTC (rev 191)
@@ -229,15 +229,19 @@
         
         if (curMod->getConfig().has("Feature", "GreekDef")) {
             m_modGreekLex = curMod;
+            m_tabViews->SetGreekDefModule(curMod);
         }
         if (curMod->getConfig().has("Feature", "GreekParse")) {
             m_modGreekMorph = curMod;
+            m_tabViews->SetGreekMorphModule(curMod);
         }
         if (curMod->getConfig().has("Feature", "HebrewDef")) {
             m_modHebrewLex = curMod;
+            m_tabViews->SetHebrewDefModule(curMod);
         }
         if (curMod->getConfig().has("Feature", "HebrewParse")) {
             m_modHebrewMorph = curMod;
+            m_tabViews->SetHebrewMorphModule(curMod);
         }
     }
     
@@ -267,6 +271,7 @@
     INT nDictsID = 0;
     INT nOptsID = 0;
     INT newValue = (INT)hWndCtl; // I am using this parameter in a strange way I know.
+    TCHAR *pszWordFound = NULL;
 
     switch(wID) {	
         case IDOK:
@@ -336,6 +341,10 @@
         case SR_SETVERSEKEY:
             SetVerseKey(*reinterpret_cast<VerseKey*>(hWndCtl));
             break;
+        case SR_HYPERLINK_CLICKED:
+            pszWordFound = (TCHAR*)hWndCtl;
+            m_tabViews->HyperLinkClicked();
+            break;
         default:
             // Check the custom made menu items...
             nBiblesID = wID - MENU_BIBLE_TRANS_START;
@@ -361,7 +370,7 @@
             }
             SaveOptions();
     }
-    return TRUE;
+    return FALSE;
 }
 
 VOID SRMainFrame::SaveOptions()

Modified: trunk/src/SwordReader_GUI/SRModuleView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.cpp	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRModuleView.cpp	2009-01-04 05:45:25 UTC (rev 191)
@@ -39,6 +39,14 @@
         CloseHandle(m_hLoadTextThread);
 }
 
+BOOL SRModuleView::OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl)
+{
+    if(m_pParentWnd){
+        return m_pParentWnd->OnCommand(wNotifyCode, wID, hWndCtl);
+    }
+    return FALSE;
+}
+
 VOID SRModuleView::SetModule(SWModule *pModule)
 {
     //EnterCriticalSection(EnterCriticalSection(&m_csLoadText);m_csLoadText);

Modified: trunk/src/SwordReader_GUI/SRModuleView.h
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.h	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRModuleView.h	2009-01-04 05:45:25 UTC (rev 191)
@@ -1,5 +1,6 @@
 #pragma once
 #include "SRTextView.h"
+#include "SRModuleHolder.h"
 #include <versekey.h>
 #include <swmodule.h>
 
@@ -9,12 +10,14 @@
 enum SRViewType { BibleView, CommView, DictView };
 
 class SRModuleView :
-    public SRTextView
+    public SRTextView, public SRModuleHolder
 {
 public:
     SRModuleView(SRViewType viewType);
     virtual ~SRModuleView(void);
 
+    BOOL        OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
+    
     VOID        SetModule(SWModule *pModule);
     VOID        SetKey(const VerseKey &verse);
     VOID        SetBook(INT nBook);

Modified: trunk/src/SwordReader_GUI/SRTabbedViews.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.cpp	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.cpp	2009-01-04 05:45:25 UTC (rev 191)
@@ -61,6 +61,13 @@
     return TRUE;
 }
 
+BOOL SRTabbedViews::OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl)
+{
+    if(m_pParentWnd)
+        return m_pParentWnd->OnCommand(wNotifyCode, wID, hWndCtl);
+    return FALSE;
+}
+
 BOOL SRTabbedViews::InitTabs()
 {
     INT i = 0;
@@ -80,10 +87,12 @@
 {
     RECT tab_rect;
     RECT views_rect = m_rect;
-    m_viewBible = new SRModuleView(BibleView);
+
+    m_viewBible = new SRBibleWidget();
     if(!m_viewBible || !m_viewBible->Create(this, m_rect))
         return FALSE;
     m_viewBible->Show();
+    m_viewBible->Init();
     
     m_viewComm = new SRModuleView(CommView);
     if(!m_viewComm || !m_viewComm->Create(this, m_rect))
@@ -244,58 +253,58 @@
 
 INT  SRTabbedViews::GetCurrentBookNum()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return -1;
-    return view->GetBook();
+    return mod->GetBook();
 }
 
 INT  SRTabbedViews::GetCurrentChapter()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return -1;
-    return view->GetChapter();
+    return mod->GetChapter();
 }
 
 INT  SRTabbedViews::GetCurrentChapterMax()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return -1;
-    return view->GetChapterMax();
+    return mod->GetChapterMax();
 }
 
 INT  SRTabbedViews::GetCurrentVerse()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return -1;
-    return view->GetVerse();
+    return mod->GetVerse();
 }
 
 INT  SRTabbedViews::GetCurrentVerseMax()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return -1;
-    return view->GetVerseMax();
+    return mod->GetVerseMax();
 }
 
 INT  SRTabbedViews::GetCurrentTestament()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return -1;
-    return view->GetTestament();
+    return mod->GetTestament();
 }
 
 const VerseKey &SRTabbedViews::GetCurrentVerseKey()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
-        return m_verseDummy; // ??? Not a good way to return from this error.
-    return view->GetVerseKey();
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(mod)
+        return mod->GetVerseKey();
+    return m_verseDummy; // ??? Not a good way to return from this error.
 }
 
 
@@ -314,26 +323,26 @@
 
 VOID SRTabbedViews::SetCurrentBookNum(INT nBook)
 {    
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return;
-    return view->SetBook(nBook);
+    return mod->SetBook(nBook);
 }
 
 VOID SRTabbedViews::SetCurrentChapter(INT nChapter)
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return;
-    return view->SetChapter(nChapter);
+    return mod->SetChapter(nChapter);
 }
 
 VOID SRTabbedViews::SetCurrentVerse(INT nVerse, BOOL fScroll)
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return;
-    return view->SetVerse(nVerse, fScroll);
+    return mod->SetVerse(nVerse, fScroll);
 }
 
 
@@ -347,10 +356,10 @@
 
 VOID SRTabbedViews::SetCurrentModule(sword::SWModule *pModule)
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return;
-    view->SetModule(pModule);
+    mod->SetModule(pModule);
 }
 
 WCString SRTabbedViews::GetCurrentWindowTitle()
@@ -371,18 +380,18 @@
 
 const SWModule *SRTabbedViews::GetCurrentModule()
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return NULL;
-    return view->GetModule();
+    return mod->GetModule();
 }
 
 VOID SRTabbedViews::SetCurrentKey(const VerseKey &verse)
 {
-    SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
-    if(!view)
+    SRModuleHolder *mod = dynamic_cast<SRModuleHolder *>(GetCurrentView());
+    if(!mod)
         return;
-    view->SetKey(verse);
+    mod->SetKey(verse);
 }
 
 VOID SRTabbedViews::SetBibleKey(const VerseKey &verse)
@@ -474,4 +483,35 @@
 INT SRTabbedViews::GetCurTabSel()
 {
     return m_tabs.GetCurSel();
+}
+
+   
+VOID SRTabbedViews::SetGreekDefModule(SWModule *pModule)
+{
+    if(m_viewBible)
+        m_viewBible->SetGreekDefModule(pModule);
+}
+
+VOID SRTabbedViews::SetGreekMorphModule(SWModule *pModule)
+{
+    if(m_viewBible)
+        m_viewBible->SetGreekMorphModule(pModule);
+}
+
+VOID SRTabbedViews::SetHebrewDefModule(SWModule *pModule)
+{
+    if(m_viewBible)
+        m_viewBible->SetHebrewDefModule(pModule);
+}
+
+VOID SRTabbedViews::SetHebrewMorphModule(SWModule *pModule)
+{
+    if(m_viewBible)
+        m_viewBible->SetHebrewMorphModule(pModule);
+}
+
+
+VOID SRTabbedViews::HyperLinkClicked()
+{
+    m_viewBible->ShowSubWindow();
 }
\ No newline at end of file

Modified: trunk/src/SwordReader_GUI/SRTabbedViews.h
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.h	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.h	2009-01-04 05:45:25 UTC (rev 191)
@@ -1,6 +1,7 @@
 #pragma once
 #include "SRFramework/SRWnd.h"
 #include "SRFramework/SRTabCtrl.h"
+#include "SRBibleWidget.h"
 #include "SRModuleView.h"
 #include "SRLexiWidget.h"
 
@@ -22,6 +23,7 @@
     BOOL Register();
     BOOL Init();
     BOOL UpdateWindow();
+    BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
     const SWModule *GetBibleModule();
     const SWModule *GetCommModule();
     const SWModule *GetDictModule();
@@ -58,6 +60,12 @@
 
     BOOL OnNotify(int idCtrl, LPNMHDR pnmh);
     INT SwitchToCurrentView();
+    VOID SetGreekDefModule(SWModule *pModule);
+    VOID SetGreekMorphModule(SWModule *pModule);
+    VOID SetHebrewDefModule(SWModule *pModule);
+    VOID SetHebrewMorphModule(SWModule *pModule);
+
+    VOID HyperLinkClicked();
     
     WCString GetWindowTitle();
 private:
@@ -71,8 +79,8 @@
     
     static BOOL s_fRegistered;
     
-    SRModuleView *m_viewBible;
-    SRModuleView *m_viewComm;
+    SRBibleWidget *m_viewBible;
+    SRModuleView  *m_viewComm;
     SRLexiWidget  *m_viewDict;
-    VerseKey     m_keyLinked;
+    VerseKey      m_keyLinked;
 };

Modified: trunk/src/SwordReader_GUI/SRTextView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.cpp	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRTextView.cpp	2009-01-04 05:45:25 UTC (rev 191)
@@ -38,7 +38,7 @@
 #endif
 }
 
-SRTextView::SRTextView()
+SRTextView::SRTextView(BOOL fSubWindow)
 : m_fDragging(FALSE)
 , m_nTop(0)
 , m_nDragStart(0)
@@ -55,6 +55,7 @@
 , m_nLineY(0)
 , m_dwLineNum(0)
 , m_wStatusBarHeight(0)
+,m_fIsSubWindow(fSubWindow)
 {
     m_wcsClassName = "SRTextView";
     m_wcsWindowName = "SwordReader";
@@ -97,7 +98,7 @@
     if(!Register())
         return FALSE;
 
-    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName,WS_CHILD , bounds, pParentWnd, NULL, m_hInstance))
+    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName,WS_CHILD | (m_fIsSubWindow ? WS_BORDER : 0), bounds, pParentWnd, NULL, m_hInstance))
         return FALSE;
 
     return TRUE;
@@ -714,12 +715,12 @@
     COLORREF    crColor     = 0x00000000;
     COLORREF    crOldColor  = SetTextColor(hdc, crColor); 
     INT         nSavedDC    = SaveDC(hdc);
-    RECT        rectDims;
+    RECT        rectDims, clientRect;
     rectDims.top            = 0; 
     rectDims.left           = 0; 
     rectDims.right          = 0; 
     rectDims.bottom         = 0;
-    
+    GetClientRect(m_hWnd, &clientRect);
     INT nOldBkMode = SetBkMode(hdc, TRANSPARENT);
     
 
@@ -825,7 +826,7 @@
     POINT pt = {xPos, yPos};
     SRTextWord *pbtWord;
     DWORD dwLineNum = 0;
-    TCHAR szWordFound[128] = {0};
+    static TCHAR szWordFound[4096] = {0};
 
     while(dwLineNum <= m_BTLines.m_dwLastLine && (m_BTLines.m_lpLines[dwLineNum].m_rect.bottom + m_nTop) < pt.y)
         dwLineNum++;
@@ -837,10 +838,12 @@
     if(pbtWord->m_lpszWord){
         if(pbtWord->m_dwlfFontState & BTEXT_HTML_A_BEG && pbtWord->m_lpszHref){
             wcsncpy(szWordFound, pbtWord->m_lpszHref, pbtWord->m_dwHrefLen);
-        }else{
+            ::SendMessage(m_pParentWnd->GetWindowHandle(), WM_COMMAND, (SR_MSRC_TEXT << 16) | SR_HYPERLINK_CLICKED, (LPARAM)szWordFound);
+        }/*else{
             wcsncpy(szWordFound, (TCHAR*)((DWORD)pbtWord->m_lpszWord + (DWORD)(pbtWord->m_fOwner ? 0 : &m_lpszBuff[0])), pbtWord->m_dwWordLen);
         }
         MessageBox(m_hWnd, szWordFound, L"Found...", MB_OK);
+        */
     }
 }
 

Modified: trunk/src/SwordReader_GUI/SRTextView.h
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.h	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SRTextView.h	2009-01-04 05:45:25 UTC (rev 191)
@@ -417,7 +417,7 @@
 public:
     // Public Methods
     //! Default Constructor
-    SRTextView();
+    SRTextView(BOOL fSubWindow = FALSE);
     //! Destructor
     virtual ~SRTextView();
     //! Adds the given text to the window control for rendering.
@@ -763,6 +763,10 @@
         we can redraw over it while scrolling.
      */
     WORD                        m_wStatusBarHeight;
+    /*! If set indicates this window is a subwindow and some extra drawing 
+        and event handling is required
+     */
+    BOOL                        m_fIsSubWindow;
 
     //CRITICAL_SECTION            m_csLoadText;
 

Modified: trunk/src/SwordReader_GUI/SwordReaderResource.h
===================================================================
--- trunk/src/SwordReader_GUI/SwordReaderResource.h	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SwordReaderResource.h	2009-01-04 05:45:25 UTC (rev 191)
@@ -48,6 +48,7 @@
 #define WM_TXT_START WM_USER + 0x00F1
 #define WM_TXT_END   WM_USER + 0x00F2
 
+#define SR_HYPERLINK_CLICKED   0x00FA
 #define SR_SETBOOK             0x00FB
 #define SR_SETCHAPTER          0x00FC
 #define SR_SETVERSE            0x00FD

Modified: trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
===================================================================
--- trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2009-01-03 23:10:44 UTC (rev 190)
+++ trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2009-01-04 05:45:25 UTC (rev 191)
@@ -338,9 +338,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
-			OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
-			IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
+			Name="Debug|Smartphone 2003 (ARMV4)"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
@@ -361,7 +361,7 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
+				PreprocessorDefinitions="_DEBUG"
 				MkTypLibCompatible="true"
 				SuppressStartupBanner="true"
 				TargetEnvironment="1"
@@ -371,22 +371,18 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				ExecutionBucket="7"
-				Optimization="2"
-				InlineFunctionExpansion="1"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\Dll1\winceSword\include;..\..\..\sword\include"
-				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;UNDER_CE=$(CEVER);UNICODE;NDEBUG;SIMPLE"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
+				PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
+				ExceptionHandling="2"
+				RuntimeLibrary="1"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)/"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)/"
 				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)/"
-				BrowseInformation="1"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -394,7 +390,7 @@
 			<Tool
 				Name="VCResourceCompilerTool"
 				AdditionalOptions="/r "
-				PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),UNICODE,_UNICODE,NDEBUG,$(CePlatform),ARM,_ARM_"
+				PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),UNICODE,_UNICODE,DEBUG,$(CePlatform),ARM,_ARM_"
 				Culture="1033"
 			/>
 			<Tool
@@ -402,19 +398,19 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem)  "
-				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib"
+				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
+				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib corelibc.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)/SwordReader.exe"
-				LinkIncremental="1"
+				LinkIncremental="2"
 				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="..\STL_eVC"
+				AdditionalLibraryDirectories=""
 				IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
+				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pdb"
 				StackReserveSize="65536"
 				StackCommitSize="4096"
 				EntryPointSymbol="WinMainCRTStartup"
 				BaseAddress="0x00010000"
-				TargetMachine="0"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -435,15 +431,15 @@
 			/>
 			<DeploymentTool
 				ForceDirty="-1"
-				RemoteDirectory="\Storage Card\Program Files\Sword\"
+				RemoteDirectory=""
 				RegisterOutput="0"
-				AdditionalFiles="../../sword.dll"
+				AdditionalFiles=""
 			/>
 			<DebuggerTool
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|Smartphone 2003 (ARMV4)"
+			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
 			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
@@ -477,10 +473,12 @@
 				Name="VCCLCompilerTool"
 				ExecutionBucket="7"
 				Optimization="0"
+				FavorSizeOrSpeed="0"
 				AdditionalIncludeDirectories="..\Dll1\winceSword\include;..\..\..\sword\include"
 				PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
-				ExceptionHandling="2"
 				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				RuntimeTypeInfo="true"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)/"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)/"
@@ -503,8 +501,8 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
-				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib corelibc.lib"
+				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem)  "
+				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)/SwordReader.exe"
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
@@ -512,8 +510,9 @@
 				IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pdb"
-				StackReserveSize="65536"
-				StackCommitSize="4096"
+				GenerateMapFile="true"
+				StackReserveSize="131072"
+				StackCommitSize="8192"
 				EntryPointSymbol="WinMainCRTStartup"
 				BaseAddress="0x00010000"
 			/>
@@ -536,15 +535,15 @@
 			/>
 			<DeploymentTool
 				ForceDirty="-1"
-				RemoteDirectory=""
+				RemoteDirectory="\Storage Card\Program Files\Sword\"
 				RegisterOutput="0"
-				AdditionalFiles=""
+				AdditionalFiles="../../sword.dll"
 			/>
 			<DebuggerTool
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
+			Name="Debug|Pocket PC 2003 (ARMV4)"
 			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
@@ -578,19 +577,18 @@
 				Name="VCCLCompilerTool"
 				ExecutionBucket="7"
 				Optimization="0"
-				FavorSizeOrSpeed="0"
 				AdditionalIncludeDirectories="..\Dll1\winceSword\include;..\..\..\sword\include"
 				PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
 				RuntimeLibrary="1"
-				BufferSecurityCheck="false"
 				RuntimeTypeInfo="true"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)/"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)/"
 				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)/"
+				BrowseInformation="1"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
+				DebugInformationFormat="1"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -606,18 +604,19 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem)  "
-				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib"
+				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
+				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib secchk.lib ccrtrtti.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)/SwordReader.exe"
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories=""
+				AdditionalLibraryDirectories="..\STL_eVC"
 				IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pdb"
 				GenerateMapFile="true"
-				StackReserveSize="131072"
-				StackCommitSize="8192"
+				MapExports="true"
+				StackReserveSize="65536"
+				StackCommitSize="4096"
 				EntryPointSymbol="WinMainCRTStartup"
 				BaseAddress="0x00010000"
 			/>
@@ -640,7 +639,7 @@
 			/>
 			<DeploymentTool
 				ForceDirty="-1"
-				RemoteDirectory="\Storage Card\Program Files\Sword\"
+				RemoteDirectory="\Storage Card\Program Files\sword\"
 				RegisterOutput="0"
 				AdditionalFiles="../../sword.dll"
 			/>
@@ -648,9 +647,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|Pocket PC 2003 (ARMV4)"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
 			ConfigurationType="1"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
@@ -671,7 +670,7 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
+				PreprocessorDefinitions="NDEBUG"
 				MkTypLibCompatible="true"
 				SuppressStartupBanner="true"
 				TargetEnvironment="1"
@@ -681,11 +680,15 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				ExecutionBucket="7"
-				Optimization="0"
+				Optimization="2"
+				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Dll1\winceSword\include;..\..\..\sword\include"
-				PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
-				RuntimeLibrary="1"
-				RuntimeTypeInfo="true"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;UNDER_CE=$(CEVER);UNICODE;NDEBUG;SIMPLE"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)/"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)/"
@@ -693,7 +696,6 @@
 				BrowseInformation="1"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
-				DebugInformationFormat="1"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -701,7 +703,7 @@
 			<Tool
 				Name="VCResourceCompilerTool"
 				AdditionalOptions="/r "
-				PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),UNICODE,_UNICODE,DEBUG,$(CePlatform),ARM,_ARM_"
+				PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),UNICODE,_UNICODE,NDEBUG,$(CePlatform),ARM,_ARM_"
 				Culture="1033"
 			/>
 			<Tool
@@ -709,21 +711,19 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
-				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib secchk.lib ccrtrtti.lib"
+				AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem)  "
+				AdditionalDependencies="..\Dll1\&quot;$(PlatformName)\$(ConfigurationName)&quot;\sword.lib htmlview.lib commctrl.lib coredll.lib aygshell.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)/SwordReader.exe"
-				LinkIncremental="2"
+				LinkIncremental="1"
 				SuppressStartupBanner="true"
 				AdditionalLibraryDirectories="..\STL_eVC"
 				IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
-				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pdb"
-				GenerateMapFile="true"
-				MapExports="true"
 				StackReserveSize="65536"
 				StackCommitSize="4096"
 				EntryPointSymbol="WinMainCRTStartup"
 				BaseAddress="0x00010000"
+				TargetMachine="0"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -744,7 +744,7 @@
 			/>
 			<DeploymentTool
 				ForceDirty="-1"
-				RemoteDirectory="\Storage Card\Program Files\sword\"
+				RemoteDirectory="\Storage Card\Program Files\Sword\"
 				RegisterOutput="0"
 				AdditionalFiles="../../sword.dll"
 			/>
@@ -866,6 +866,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\SRBibleWidget.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\SRBookChooser.cpp"
 				>
 			</File>
@@ -983,6 +987,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\SRBibleWidget.h"
+				>
+			</File>
+			<File
 				RelativePath=".\SRBookChooser.h"
 				>
 			</File>
@@ -1007,6 +1015,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\SRModuleHolder.h"
+				>
+			</File>
+			<File
 				RelativePath=".\SRModuleView.h"
 				>
 			</File>




More information about the sword-cvs mailing list