[sword-svn] r404 - trunk

scribe at crosswire.org scribe at crosswire.org
Mon Jan 10 01:51:44 MST 2005


Author: scribe
Date: 2005-01-10 01:51:43 -0700 (Mon, 10 Jan 2005)
New Revision: 404

Modified:
   trunk/mainfrm.cpp
   trunk/swdisprtfchap.cpp
   trunk/sword.bpr
   trunk/sword.res
Log:
updated to work better with NASB and lex

Modified: trunk/mainfrm.cpp
===================================================================
--- trunk/mainfrm.cpp	2005-01-03 00:24:57 UTC (rev 403)
+++ trunk/mainfrm.cpp	2005-01-10 08:51:43 UTC (rev 404)
@@ -540,8 +540,30 @@
 	bool hasAlpha  = false;
 	bool hasNonCap = false;
 	WideString retVal = "";
-	
+
 	int len = src.Length();
+
+	if (((src[1] == '<') || (src[1] == '(')) && ((src[len] == '>') || (src[len] == ')'))) {
+		len -= 2;
+		src = src.SubString(2, len);
+	}
+
+	while ((len) && (src[1] < 255)
+			&& !isdigit(src[1])
+			&& !isalpha(src[1])) {
+		len--;
+		src = src.SubString(2, len);
+	}
+
+	while ((len) && (src[len] < 255)
+			&& !isdigit(src[len])
+			&& !isalpha(src[len])) {
+		len--;
+		src.SetLength(len);
+	}
+//	MessageBox(0, ((String)src).c_str(), "key", MB_OK);
+	return src;
+/*	
 	for (int i = 1; i <=len; i++) {
 		if (isdigit(src[i]))
 			hasDigit = true;
@@ -557,11 +579,13 @@
 			if (isdigit(src[i])) retVal += (WideString)src[i];
 		}
 		else if (hasAlpha) {	// alpha
-			if (isalpha(src[i]) || (src[i] > 255) || ((!hasNonCap) && ((src[i] == '-') || isdigit(src[i])))) retVal += (WideString)src[i];
+			if (isalpha(src[i]) || (src[i] > 255) || ((!hasNonCap) && ((src[i] == '-')	|| isdigit(src[i]))))
+				retVal += (WideString)src[i];
 		}
 		else	retVal += (WideString)src[i];
 	}
 	return retVal;
+*/
 }
 
 
@@ -581,9 +605,9 @@
 	}
 	else	{
 		preChar = rtf->Text[(rtf->SelStart)?rtf->SelStart:0];
-		lookupKey = TRxRichEditX::Trim(rtf->GetTextRange(rtf->SelStart, rtf->SelStart + rtf->SelLength));
+		lookupKey = rtf->GetTextRange(rtf->SelStart, rtf->SelStart + rtf->SelLength);
 	}
-		
+	lookupKey = TrimJunk(lookupKey);
 	// check if all digits (strongs)
 	int i;
 	for (i = 0; i < lookupKey.Length(); i++) {
@@ -593,7 +617,7 @@
 			break;
 	}
 
-	if ((i == lookupKey.Length()) && (i)) {
+	if ((i >= (lookupKey.Length()-1)) && (i)) {
 		lookupKey = TrimJunk(lookupKey);
 		String curLex = LexDictPageControl->ActivePage->Caption;
 		String feature = (DefaultVSKey->Testament() == 1)?"Hebrew":"Greek";
@@ -2472,7 +2496,7 @@
 					break;
 			}
 
-			if (!link && (i == strongsWord.Length()+1) && (i-1)) {
+			if (!link && (i >= strongsWord.Length()) && (i-1)) {
 				String feature = (DefaultVSKey->Testament() == 1)?"Hebrew":"Greek";
 				feature += (preChar == '(')?"Parse":"Def";
 				if (!strncmp(HintInfo.HintControl->Name.c_str(), "TextRTFLXX", 10))

Modified: trunk/swdisprtfchap.cpp
===================================================================
--- trunk/swdisprtfchap.cpp	2005-01-03 00:24:57 UTC (rev 403)
+++ trunk/swdisprtfchap.cpp	2005-01-10 08:51:43 UTC (rev 404)
@@ -7,6 +7,10 @@
 #include <winbase.h>
 #include <unicodertf.h>
 
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <io.h>
+
 using namespace std;
 
 //---------------------------------------------------------------------------
@@ -135,7 +139,7 @@
 	}
 	newtext = newtext + RTFTrailer;
 
-	key->Verse(1); //{ When setting chapter: if (verse <> new chapter range) don't autonormalize. (we could've just turned the autonormalize option off then back on, but this is cooler) }
+	key->Verse(1); //{ When setting chapter: if (verse !in new chapter range) don't autonormalize. (we could've just turned the autonormalize option off then back on, but this is cooler) }
 	key->Chapter(1);
 	key->Book(1);
 	key->Testament(testmt);
@@ -144,6 +148,9 @@
 	key->Verse(verse);
 	RTFStream->Clear();
 	RTFStream->WriteBuffer(newtext.c_str(), newtext.Length());
+	int fd = open("rtfout.txt", O_CREAT|O_RDWR|O_TRUNC, S_IREAD|S_IWRITE);
+	write(fd, newtext.c_str(), newtext.Length());
+	close(fd);
 	RTFStream->Position = 0;
        	Lines->LoadFromStream(RTFStream);
         

Modified: trunk/sword.bpr
===================================================================
--- trunk/sword.bpr	2005-01-03 00:24:57 UTC (rev 403)
+++ trunk/sword.bpr	2005-01-10 08:51:43 UTC (rev 404)
@@ -74,7 +74,7 @@
 MajorVer=1
 MinorVer=5
 Release=6
-Build=9
+Build=10
 Debug=0
 PreRelease=0
 Special=0
@@ -86,7 +86,7 @@
 [Version Info Keys]
 CompanyName=CrossWire Software &amp; Bible Society
 FileDescription=Windows 32bit User Interface to The SWORD Project
-FileVersion=1.5.6.9
+FileVersion=1.5.6.10
 InternalName=biblecs
 LegalCopyright=(c) 1990-2003 CrossWire Bible Society under the terms of the GNU General Public License
 LegalTrademarks=

Modified: trunk/sword.res
===================================================================
(Binary files differ)



More information about the sword-cvs mailing list