From 6423eeeb7e0d68e62d4e9b818173b2ded9b8a54b Mon Sep 17 00:00:00 2001 From: danglassey Date: Wed, 11 Sep 2002 13:02:15 +0000 Subject: sync with crosswire 20020911-1300 --- apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.cpp | 2 +- apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.dfm | 6 ++-- apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp | 39 ++++++++++++++++++++----- apps/windoze/CBuilder5/BibleCS/mainfrm.cpp | 13 +++++---- apps/windoze/CBuilder5/BibleCS/searchfrm.cpp | 5 +++- apps/windoze/CBuilder5/BibleCS/sword.bpr | 20 ++++++------- apps/windoze/CBuilder5/BibleCS/sword.res | Bin 1976 -> 1976 bytes apps/windoze/CBuilder5/BibleCS/swordlib.bpr | 14 ++++----- include/listkey.h | 3 +- include/treekeyidx.h | 3 +- src/keys/listkey.cpp | 25 ++++++++++++---- src/keys/swkey.cpp | 1 + src/keys/treekeyidx.cpp | 9 +++++- src/modules/common/rawstr.cpp | 2 +- 14 files changed, 98 insertions(+), 44 deletions(-) diff --git a/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.cpp b/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.cpp index b76b9b1..b5d6be1 100644 --- a/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.cpp +++ b/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.cpp @@ -59,7 +59,7 @@ void __fastcall TAboutBox::FormShow(TObject *Sender) { newtext += "sword-patches@crosswire.org (please include unified diffs if possible (diff -u)) \\par\\par "; newtext += "To be on our mailing list: \\par "; newtext += "sword-list-info@crosswire.org \\par\\par "; - newtext += "This software is provided free for the study of God and His Word. You DO NOT NEED TO license or pay for this software. Please: copy it freely and distribute it to athiests in Russia :), post it on your favorite FTP site, write your own modules and features for it, include it on your lastest freeware CDROM, incorporate all the cool utility classes into a product of your own, write a tract module for the program and sneak it onto all of your co-workers' computers and blame it on a virus, make fun of your pastor for spending $400 dollars on a similar package, give it to your pastor who can't figure out how to use his $400 dollar package :) \\par\\par "; + newtext += "This software is provided free for the study of God and His Word. You DO NOT NEED TO license or pay for this software. Please: copy it freely and distribute it to atheists in Russia :), post it on your favorite FTP site, write your own modules and features for it, include it on your lastest freeware CDROM, incorporate all the cool utility classes into a product of your own, write a tract module for the program and sneak it onto all of your co-workers' computers and blame it on a virus, make fun of your pastor for spending $400 dollars on a similar package, give it to your pastor who can't figure out how to use his $400 dollar package :) \\par\\par "; newtext += "OK, if you still feel the need, you can help our organization out at: \\par\\par "; newtext += "CrossWire Software & Bible Society \\par "; newtext += "P. O. Box 2528 \\par "; diff --git a/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.dfm b/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.dfm index c5c7e41..186f784 100644 --- a/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.dfm +++ b/apps/windoze/CBuilder5/BibleCS/AboutBoxfrm.dfm @@ -1,6 +1,6 @@ object AboutBox: TAboutBox - Left = 253 - Top = 97 + Left = 290 + Top = 103 BorderStyle = bsDialog Caption = 'About The SWORD Project' ClientHeight = 448 @@ -102,7 +102,7 @@ object AboutBox: TAboutBox Width = 213 Height = 21 AutoSize = False - Caption = 'v1.5.4rc2' + Caption = 'v1.5.4rc4' IsControl = True end object Copyright: TLabel diff --git a/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp b/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp index c23638f..1fa4976 100644 --- a/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp +++ b/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp @@ -452,7 +452,7 @@ void TRxRichEditX::fillWithVerses(SWModule *module, ListKey *verses, bool headin SWKey *lastKey = 0; bool first = true; - while (verses->Count() && !module->Error() && newtext.Length() < 10000 ) { + while (verses->Count() && !module->Error() && newtext.Length() < 40000 ) { SWKey *testKey = verses->GetElement(); VerseKey *element = SWDYNAMIC_CAST(VerseKey, testKey); if (heading) { @@ -475,17 +475,22 @@ void TRxRichEditX::fillWithVerses(SWModule *module, ListKey *verses, bool headin strcpy(buf, module->KeyText()); toupperstr_utf8(buf); int i; + char *start1 = buf; + char *start2 = buf2; for (i = 0; i < strlen(buf); i++) { - if ((buf[i] == buf2[i]) || (buf[i] != '0')) + if (*start1 == '0') + start1++; + if (*start2 == '0') + start2++; + if ((*start1 != '0') && (*start2 != '0')) if ((buf[i] == buf2[i]) || (buf[i] != '0')) break; } - char *buf3 = buf+i; - for (i = 0; i < strlen(buf2) && (i < strlen(buf3)); i++) { - if ((buf3[i] != buf2[i]) && - (SW_toupper(buf3[i]) != SW_toupper(buf2[i]))) + for (i = 0; i < strlen(start1) && (i < strlen(start2)); i++) { + if ((start1[i] != start2[i]) && + (SW_toupper(start1[i]) != SW_toupper(start2[i]))) break; } - if (!i || i < (strlen(buf2)/2)) { + if (!i || i < (strlen(start1)/2)) { delete [] buf2; verses->Remove(); continue; @@ -888,6 +893,26 @@ WideString __fastcall TRxRichEditX::WordAtCursor(void) { break; } } + int start = 1; + int end = Result.Length(); + if (end) { + if (strchr(",", Result[end])) + end--; + if (strchr(",", Result[start])) + start++; + // see if we're a verse number + if (isdigit(Result[start]) && (end > 3)) { + if (isalpha(Result[start+3])) { + start++; + if (isdigit(Result[start])) + start++; + if (isdigit(Result[start])) + start++; + } + } + Result = Result.SubString(start, end-(start-1)); + } + return Result; } diff --git a/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp b/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp index 511d501..5df1c50 100644 --- a/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp +++ b/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp @@ -547,13 +547,13 @@ void __fastcall TForm1::DictionaryLookup1Click(TObject *Sender) SWDispRTF *rtf = (SWDispRTF *)Screen->ActiveControl; int wordstart; int saveSelStart = rtf->SelStart; - String lookupKey; + WideString lookupKey; ConfigEntMap::iterator eit; char preChar = 0; if (!rtf->SelLength) { preChar = (rtf->WordAtCursor().Length()) ? rtf->WordAtCursor()[1] : 0; - lookupKey = TrimJunk(rtf->WordAtCursor()); + lookupKey = rtf->WordAtCursor(); } else { preChar = rtf->Text[(rtf->SelStart)?rtf->SelStart:0]; @@ -562,12 +562,13 @@ void __fastcall TForm1::DictionaryLookup1Click(TObject *Sender) // check if all digits (strongs) int i; - for (i = 0; i < strlen(lookupKey.c_str()); i++) { - if (!isdigit(lookupKey.c_str()[i])) + for (i = 0; i < lookupKey.Length(); i++) { + if (!isdigit(lookupKey[i+1]) && !strchr("<>()", lookupKey[i+1])) break; } - if ((i == strlen(lookupKey.c_str())) && (i)) { + if ((i == lookupKey.Length()) && (i)) { + lookupKey = TrimJunk(lookupKey); String curLex = LexDictPageControl->ActivePage->Caption; String feature = (DefaultVSKey->Testament() == 1)?"Hebrew":"Greek"; feature += (preChar == '(')?"Parse":"Def"; @@ -584,7 +585,7 @@ void __fastcall TForm1::DictionaryLookup1Click(TObject *Sender) } } - DictKeyEdit->Text = UTF8ToWideString(lookupKey); + DictKeyEdit->Text = lookupKey; } diff --git a/apps/windoze/CBuilder5/BibleCS/searchfrm.cpp b/apps/windoze/CBuilder5/BibleCS/searchfrm.cpp index 4d98ade..c9f70a2 100644 --- a/apps/windoze/CBuilder5/BibleCS/searchfrm.cpp +++ b/apps/windoze/CBuilder5/BibleCS/searchfrm.cpp @@ -180,6 +180,8 @@ void __fastcall TsearchForm::TSearchThread::FillListBox(void) TListItem *pItem; SWKey *savekey = (SWKey *)*(parent->target); + if (!savekey->Persist()) + savekey = 0; for (results = TOP; !results.Error(); results++) { parent->target->setKey(results); pItem = parent->resultsLV->Items->Add(); @@ -188,7 +190,8 @@ void __fastcall TsearchForm::TSearchThread::FillListBox(void) // pItem->SubItems->Add((*parent->target).second->StripText()); // pItem = resultsLV->Items->Add( } - parent->target->setKey(*savekey); + if (savekey) + parent->target->setKey(*savekey); // ListBox1->Items->Pack(); // so Count is set correctly (per helpfile) parent->Caption = ((AnsiString)parent->resultsLV->Items->Count + (AnsiString)" " + (AnsiString)((parent->resultsLV->Items->Count == 1) ? _tr("match") : _tr("matches"))) + (AnsiString)" from [ " + (AnsiString)parent->target->Description() + (AnsiString)" (" + (AnsiString)parent->target->Name() + (AnsiString)") ]"; parent->searchBtn->Caption = _tr("Search"); diff --git a/apps/windoze/CBuilder5/BibleCS/sword.bpr b/apps/windoze/CBuilder5/BibleCS/sword.bpr index 733c891..1de665e 100644 --- a/apps/windoze/CBuilder5/BibleCS/sword.bpr +++ b/apps/windoze/CBuilder5/BibleCS/sword.bpr @@ -43,7 +43,7 @@ - + @@ -55,11 +55,11 @@ - - + + - - + + @@ -73,7 +73,7 @@ AutoIncBuild=1 MajorVer=1 MinorVer=5 Release=3 -Build=116 +Build=118 Debug=0 PreRelease=0 Special=0 @@ -85,13 +85,13 @@ CodePage=1252 [Version Info Keys] CompanyName=CrossWire Software & Bible Society FileDescription=Windows 32bit User Interface to The SWORD Project -FileVersion=1.5.3.116 +FileVersion=1.5.3.118 InternalName=biblecs LegalCopyright=(c) 2002 CrossWire Bible Society under the terms of the GNU General Public License LegalTrademarks= OriginalFilename= ProductName=The SWORD Project -ProductVersion=1.5.4rc2 +ProductVersion=1.5.4rc4 Comments=Seek Him and you will find Him [HistoryLists\hlIncludePath] @@ -125,8 +125,8 @@ Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=5 -Item0=_ICU_;_ICUSWORD_;_DEBUG -Item1=_ICU_;_ICUSWORD_ +Item0=_ICU_;_ICUSWORD_ +Item1=_ICU_;_ICUSWORD_;_DEBUG Item2=_ICU_ Item3=_ICU_;_DEBUG Item4=_DEBUG diff --git a/apps/windoze/CBuilder5/BibleCS/sword.res b/apps/windoze/CBuilder5/BibleCS/sword.res index 2908244..9366299 100644 Binary files a/apps/windoze/CBuilder5/BibleCS/sword.res and b/apps/windoze/CBuilder5/BibleCS/sword.res differ diff --git a/apps/windoze/CBuilder5/BibleCS/swordlib.bpr b/apps/windoze/CBuilder5/BibleCS/swordlib.bpr index b97621d..52ae339 100644 --- a/apps/windoze/CBuilder5/BibleCS/swordlib.bpr +++ b/apps/windoze/CBuilder5/BibleCS/swordlib.bpr @@ -78,7 +78,7 @@ - + @@ -107,11 +107,11 @@ -I..\..\..\..\src\modules\comments\rawcom -I..\..\..\..\src\mgr -I..\..\..\..\src\keys -I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp -D_ICU_ -D_DEBUG"/> - - + + - + @@ -159,8 +159,8 @@ Item5=..\..\..\..\src\modules\lexdict\zld;..\..;..\..\..\..\src\utilfuns\zlib;.. [HistoryLists\hlConditionals] Count=5 -Item0=_ICU_;_ICUSWORD_;_DEBUG -Item1=_ICU_;_ICUSWORD_ +Item0=_ICU_;_ICUSWORD_ +Item1=_ICU_;_ICUSWORD_;_DEBUG Item2=_ICU_ Item3=_ICU_;_DEBUG Item4=_DEBUG diff --git a/include/listkey.h b/include/listkey.h index b64820f..6ea2b95 100644 --- a/include/listkey.h +++ b/include/listkey.h @@ -4,7 +4,7 @@ * (e.g. verse, word, * place, etc.) * - * $Id: listkey.h,v 1.14 2002/08/27 22:52:36 scribe Exp $ + * $Id: listkey.h,v 1.15 2002/09/11 07:04:20 scribe Exp $ * * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -111,6 +111,7 @@ public: * The first parameter is the new index. */ virtual long Index (long index) { SetToElement (index); return Index (); } + virtual const char *getText() const; SWKEY_OPERATORS ListKey & operator =(const ListKey &key) { copyFrom(key); return *this; } diff --git a/include/treekeyidx.h b/include/treekeyidx.h index bd28736..170d87c 100644 --- a/include/treekeyidx.h +++ b/include/treekeyidx.h @@ -1,7 +1,7 @@ /****************************************************************************** * versekey.h - code for class 'versekey'- a standard Biblical verse key * - * $Id: treekeyidx.h,v 1.3 2002/07/28 01:48:38 scribe Exp $ + * $Id: treekeyidx.h,v 1.4 2002/09/11 07:04:20 scribe Exp $ * * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -66,6 +66,7 @@ public: TreeKeyIdx (const char *idxPath, int fileMode = -1); ~TreeKeyIdx (); + virtual SWKey *clone() const; virtual const char *getLocalName(); virtual const char *setLocalName(const char *); diff --git a/src/keys/listkey.cpp b/src/keys/listkey.cpp index 3d5a897..08a1015 100644 --- a/src/keys/listkey.cpp +++ b/src/keys/listkey.cpp @@ -145,8 +145,9 @@ void ListKey::increment(int step) { Error(); // clear error for(; step && !Error(); step--) { if (arraypos < arraycnt) { - (*(array[arraypos]))++; - if (array[arraypos]->Error()) { + if (array[arraypos]->isBoundSet()) + (*(array[arraypos]))++; + if ((array[arraypos]->Error()) || (!array[arraypos]->isBoundSet())) { SetToElement(arraypos+1); } else *this = (const char *)(*array[arraypos]); @@ -168,8 +169,9 @@ void ListKey::decrement(int step) { Error(); // clear error for(; step && !Error(); step--) { if (arraypos > -1) { - (*(array[arraypos]))--; - if (array[arraypos]->Error()) { + if (array[arraypos]->isBoundSet()) + (*(array[arraypos]))--; + if ((array[arraypos]->Error()) || (!array[arraypos]->isBoundSet())) { SetToElement(arraypos-1, BOTTOM); } else *this = (const char *)(*array[arraypos]); @@ -259,7 +261,7 @@ void ListKey::Remove() { /****************************************************************************** - * VerseKey::getRangeText - returns parsable range text for this key + * ListKey::getRangeText - returns parsable range text for this key */ const char *ListKey::getRangeText() const { @@ -271,6 +273,19 @@ const char *ListKey::getRangeText() const { strcat(buf, "; "); } stdstr(&rangeText, buf); + delete [] buf; return rangeText; } + +/****************************************************************************** + * ListKey::getText - returns text key if (const char *) cast is requested + */ + +const char *ListKey::getText() const { + SWKey *key = GetElement(); + return (key) ? key->getText() : keytext; +} + + + diff --git a/src/keys/swkey.cpp b/src/keys/swkey.cpp index f2491c4..1551284 100644 --- a/src/keys/swkey.cpp +++ b/src/keys/swkey.cpp @@ -42,6 +42,7 @@ SWKey::SWKey(SWKey const &k) void SWKey::init() { myclass = &classdef; + boundSet = false; } SWKey *SWKey::clone() const diff --git a/src/keys/treekeyidx.cpp b/src/keys/treekeyidx.cpp index acd9b5a..f5d21b5 100644 --- a/src/keys/treekeyidx.cpp +++ b/src/keys/treekeyidx.cpp @@ -1,7 +1,7 @@ /****************************************************************************** * versekey.h - code for class 'versekey'- a standard Biblical verse key * - * $Id: treekeyidx.cpp,v 1.7 2002/04/15 21:26:44 scribe Exp $ + * $Id: treekeyidx.cpp,v 1.8 2002/09/11 07:04:20 scribe Exp $ * * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -588,3 +588,10 @@ TreeKeyIdx::TreeNode::~TreeNode() { if (userData) delete [] userData; } + + +SWKey *TreeKeyIdx::clone() const +{ + return new TreeKeyIdx(*this); +} + diff --git a/src/modules/common/rawstr.cpp b/src/modules/common/rawstr.cpp index c7363d9..7b23041 100644 --- a/src/modules/common/rawstr.cpp +++ b/src/modules/common/rawstr.cpp @@ -168,7 +168,7 @@ signed char RawStr::findoffset(const char *ikey, long *start, unsigned short *si if (*ikey) { headoff = 0; - key = new char [ strlen(ikey) + 1 ]; + key = new char [ strlen(ikey) + 10 ]; // just in case toupper needs a few extra strcpy(key, ikey); toupperstr_utf8(key); -- cgit