[sword-svn] r135 - in trunk/src: Dll1 SwordReader_GUI

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Tue May 20 22:00:47 MST 2008


Author: dtrotzjr
Date: 2008-05-20 22:00:46 -0700 (Tue, 20 May 2008)
New Revision: 135

Modified:
   trunk/src/Dll1/Dll1.vcproj
   trunk/src/SwordReader_GUI/SRFind.cpp
   trunk/src/SwordReader_GUI/SRFind.h
   trunk/src/SwordReader_GUI/SRTextView.cpp
   trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
Log:
More SRFind stuff. About 70% completed.

Modified: trunk/src/Dll1/Dll1.vcproj
===================================================================
--- trunk/src/Dll1/Dll1.vcproj	2008-05-21 02:47:09 UTC (rev 134)
+++ trunk/src/Dll1/Dll1.vcproj	2008-05-21 05:00:46 UTC (rev 135)
@@ -159,6 +159,7 @@
 				AdditionalIncludeDirectories="..\..\..\sword\include;winceSword\include"
 				PreprocessorDefinitions="ARM;_ARM_;DEBUG;NO_VSNPRINTF;_i386_;_WIN32_WCE=$(CEVER);$(CePlatform);UNDER_CE=$(CEVER);UNICODE;_USRDLL;DLL1_EXPORTS;SWMAKINGDLL"
 				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
 				UsePrecompiledHeader="0"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/Dll1.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)/"
@@ -469,6 +470,7 @@
 				PreprocessorDefinitions="ARM;_ARM_;NDEBUG;NO_VSNPRINTF;DEBUG;_i386_;_WIN32_WCE=$(CEVER);$(CePlatform);UNDER_CE=$(CEVER);UNICODE;_USRDLL;DLL1_EXPORTS;SWMAKINGDLL"
 				StringPooling="true"
 				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
 				EnableFunctionLevelLinking="true"
 				UsePrecompiledHeader="0"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/Dll1.pch"

Modified: trunk/src/SwordReader_GUI/SRFind.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFind.cpp	2008-05-21 02:47:09 UTC (rev 134)
+++ trunk/src/SwordReader_GUI/SRFind.cpp	2008-05-21 05:00:46 UTC (rev 135)
@@ -3,9 +3,17 @@
 #include "SwordReaderResource.h"
 
 using namespace SRFramework;
+using namespace sword;
 
 BOOL SRFind::s_fRegistered = false;
 
+void setPercentCB(char percent, void *userData)
+{
+    SRFind *caller = static_cast<SRFind*>(userData);
+    if(caller)
+        caller->SetProgress((int)percent);
+}
+
 SRFind::SRFind()
 :m_hEdtQuery(NULL)
 ,m_hBtnSearch(NULL)
@@ -31,7 +39,21 @@
         delete m_textPreview;
 }
 
+VOID SRFind::SetProgress(INT nPercent)
+{
+    SendMessage(m_hProgressBar, PBM_SETPOS, nPercent, 0);
+}
 
+VOID SRFind::AddResult(WCString &wcsVerse, SWModule *text)
+{
+    VerseKey* verse = new VerseKey(wcsVerse.c_str());
+	m_verseResults.push_back(*verse);
+    text->SetKey(verse);
+    WCString verseString = text->StripText();
+    SendMessage (m_hLstResults, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)verseString.w_str());
+    delete verse;
+}
+
 BOOL SRFind::OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl)
 {
     switch(wID)

Modified: trunk/src/SwordReader_GUI/SRFind.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFind.h	2008-05-21 02:47:09 UTC (rev 134)
+++ trunk/src/SwordReader_GUI/SRFind.h	2008-05-21 05:00:46 UTC (rev 135)
@@ -1,6 +1,9 @@
 #ifndef _SRFIND_H_
 #define _SRFIND_H_
 #include "SRFramework/SRWnd.h"
+#include <vector>
+#include <swmodule.h>
+#include <versekey.h>
 #include "SRTextView.h"
 
 
@@ -21,7 +24,17 @@
 
 #define SR_FIND_METHOD_EPHRASE   0x0100
 #define SR_FIND_METHOD_MWORD     0x0200
+/*
+class Searchable {
+public:
+	virtual void SetProgress(int percent)=0;
+	virtual void AddResult(const WCString &verse)=0;
+};
+*/
 
+// Calback to set the progress bar from within SWORD
+void setPercentCB(char percent, void *userData);
+
 class SRFind : 
     public SRFramework::SRWnd
 {
@@ -34,6 +47,8 @@
     LRESULT OnCreate(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
     VOID PlaceWidgets();
     BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
+    VOID SetProgress(INT nPercent);
+    VOID AddResult(WCString &wcsVerse, sword::SWModule *text);
 private:
     static BOOL s_fRegistered;
     HWND m_hEdtQuery;
@@ -49,6 +64,7 @@
     SRTextView *m_textPreview;
     WORD m_wRangeMode;
     WORD m_wMethodMode;
+    std::vector<sword::VerseKey> m_verseResults;
 
 };
 

Modified: trunk/src/SwordReader_GUI/SRTextView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.cpp	2008-05-21 02:47:09 UTC (rev 134)
+++ trunk/src/SwordReader_GUI/SRTextView.cpp	2008-05-21 05:00:46 UTC (rev 135)
@@ -1142,7 +1142,7 @@
 
 INT SRTextView::SRTextLines::GetVersePosition(WORD wVerseNum)
 {
-    for(INT i = 0; i < m_dwLastLine; i++){
+    for(DWORD i = 0; i < m_dwLastLine; i++){
         if(m_lppLinesLastWord[i]->m_lpPrevWord->m_wVerseNum == wVerseNum)
             return m_lppLinesLastWord[i]->m_lpPrevWord->m_rect.top;
     }
@@ -1151,7 +1151,7 @@
 
 WORD SRTextView::SRTextLines::GetVerseAt(INT yPos)
 {
-    for(INT i = 0; i < m_dwLastLine; i++){
+    for(DWORD i = 0; i < m_dwLastLine; i++){
         if(!m_lppLinesLastWord[i]->m_lpPrevWord)
             continue; // We hit a blank line (not neccesarrily the end).
         if(m_lppLinesLastWord[i]->m_lpPrevWord->m_rect.top >= -yPos)

Modified: trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
===================================================================
--- trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2008-05-21 02:47:09 UTC (rev 134)
+++ trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2008-05-21 05:00:46 UTC (rev 135)
@@ -163,6 +163,7 @@
 				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"
@@ -467,6 +468,7 @@
 				AdditionalIncludeDirectories="..\Dll1\winceSword\include;..\..\..\sword\include"
 				PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
 				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
 				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)/"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)/"




More information about the sword-cvs mailing list