[sword-svn] r411 - in trunk: . clucene clucene/src/CLucene/index
clucene/src/CLucene/search
scribe at crosswire.org
scribe at crosswire.org
Thu Feb 10 07:47:19 MST 2005
Author: scribe
Date: 2005-02-10 07:47:18 -0700 (Thu, 10 Feb 2005)
New Revision: 411
Modified:
trunk/AboutBoxfrm.dfm
trunk/RxRichEditX.cpp
trunk/clucene/clucene.bpr
trunk/clucene/src/CLucene/index/IndexWriter.cpp
trunk/clucene/src/CLucene/index/SegmentTermEnum.cpp
trunk/clucene/src/CLucene/search/FilteredTermEnum.cpp
trunk/mainfrm.cpp
trunk/mainfrm.h
trunk/searchfrm.cpp
trunk/searchfrm.dfm
trunk/swdisprtf.cpp
trunk/sword.bpr
trunk/sword.res
trunk/vrslstfrm.cpp
Log:
Added support for UTF8 in most places
Switched search window around to allow all types of searching when indecies exist.
Fixed CLucene bugs and dropped mergeFactor to 4 so indecies are build correctly.
1.5.8pre2 release
Modified: trunk/AboutBoxfrm.dfm
===================================================================
(Binary files differ)
Modified: trunk/RxRichEditX.cpp
===================================================================
--- trunk/RxRichEditX.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/RxRichEditX.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -329,7 +329,11 @@
if (!first)
newtext += "{\\par\\par}";
newtext += RTFHeadingPre;
- newtext += verses->GetElement()->getRangeText();
+
+ buf = verses->GetElement()->getRangeText();
+ filter.processText(buf, *module, module);
+ newtext += buf.c_str();
+
newtext += ":";
newtext += RTFHeadingPost;
newtext += "{\\par}";
@@ -377,7 +381,7 @@
buf = module->KeyText();
// VerseKey locales are not yet UTF8, so don't try to convert them.
- if (!SWDYNAMIC_CAST(VerseKey, testKey))
+// if (!SWDYNAMIC_CAST(VerseKey, testKey))
filter.processText(buf, *module, module);
newtext = newtext + RTFHeadingPre + buf.c_str() + RTFHeadingPost + ":\\par ";
@@ -692,8 +696,8 @@
RTFTrailer = buf;
SWBuf chapBuf;
- //chapBuf = WideStringToUTF8(_tr("Chapter")).c_str();
- chapBuf = _tr("Chapter");
+ chapBuf = WideStringToUTF8(_tr("Chapter")).c_str();
+// chapBuf = _tr("Chapter");
filter.processText(chapBuf);
sprintf(buf,
Modified: trunk/clucene/clucene.bpr
===================================================================
--- trunk/clucene/clucene.bpr 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/clucene/clucene.bpr 2005-02-10 14:47:18 UTC (rev 411)
@@ -119,16 +119,17 @@
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
-Count=9
+Count=10
Item0=LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
-Item1=_DEBUG;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
-Item2=_DEBUG;LUCENE_DISABLE_MULTITHREADING;_WIN32
-Item3=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT;_WIN32
-Item4=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT_H;_WIN32
-Item5=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT_H;_WIN32;UTF8
-Item6=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT_H
-Item7=_DEBUG;LUCENE_DISABLE_MULTITHREADING
-Item8=_DEBUG
+Item1=LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT;_DEBUG
+Item2=_DEBUG;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
+Item3=_DEBUG;LUCENE_DISABLE_MULTITHREADING;_WIN32
+Item4=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT;_WIN32
+Item5=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT_H;_WIN32
+Item6=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT_H;_WIN32;UTF8
+Item7=_DEBUG;LUCENE_DISABLE_MULTITHREADING;HAVE_DIRENT_H
+Item8=_DEBUG;LUCENE_DISABLE_MULTITHREADING
+Item9=_DEBUG
[HistoryLists\hlTlibPageSize]
Count=8
Modified: trunk/clucene/src/CLucene/index/IndexWriter.cpp
===================================================================
--- trunk/clucene/src/CLucene/index/IndexWriter.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/clucene/src/CLucene/index/IndexWriter.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -73,7 +73,7 @@
writeLock = NULL;
//Initialize the mergeFactor to 10 indicating that a merge will occur after 10 documents
//have been added to the index managed by this IndexWriter
- mergeFactor = 5;
+ mergeFactor = 4;
//Initialize maxMergeDocs to INT_MAX
maxMergeDocs = INT_MAX;
Modified: trunk/clucene/src/CLucene/index/SegmentTermEnum.cpp
===================================================================
--- trunk/clucene/src/CLucene/index/SegmentTermEnum.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/clucene/src/CLucene/index/SegmentTermEnum.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -187,7 +187,8 @@
term = t.pointer();
//finalize prev
- prev->finalize();
+ if (prev != NULL)
+ prev->finalize();
//prev is unknown so set it to NULL
prev = NULL;
Modified: trunk/clucene/src/CLucene/search/FilteredTermEnum.cpp
===================================================================
--- trunk/clucene/src/CLucene/search/FilteredTermEnum.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/clucene/src/CLucene/search/FilteredTermEnum.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -44,8 +44,9 @@
}
//Finalize the currentTerm and reset it to NULL
- currentTerm->finalize();
- currentTerm = NULL;
+ if (currentTerm != NULL)
+ currentTerm->finalize();
+ currentTerm = NULL;
//Iterate through the enumeration
while (currentTerm == NULL) {
@@ -57,7 +58,8 @@
//Compare the retrieved term
if (termCompare(term)){
//Matched so finalize the current
- currentTerm->finalize();
+ if (currentTerm != NULL)
+ currentTerm->finalize();
//Get a reference to the matched term
currentTerm = term->pointer();
return true;
@@ -65,11 +67,12 @@
}
else
return false;
- }
- currentTerm->finalize();
- currentTerm = NULL;
+ }
+ if (currentTerm != NULL)
+ currentTerm->finalize();
+ currentTerm = NULL;
- return false;
+ return false;
}
Term* FilteredTermEnum::getTerm(const bool pointer) {
@@ -100,7 +103,8 @@
_DELETE(actualEnum);
//Destroy currentTerm
- currentTerm->finalize();
+ if (currentTerm != NULL)
+ currentTerm->finalize();
currentTerm = NULL;
}
@@ -118,12 +122,13 @@
// Find the first term that matches
//Ordered getTerm not to return reference ownership here.
Term* term = actualEnum->getTerm(false);
- if (termCompare(term)){
- currentTerm->finalize();
- currentTerm = term->pointer();
- }
+ if (termCompare(term)){
+ if (currentTerm != NULL)
+ currentTerm->finalize();
+ currentTerm = term->pointer();
+ }
else{
- next();
+ next();
}
}
Modified: trunk/mainfrm.cpp
===================================================================
--- trunk/mainfrm.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/mainfrm.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -59,70 +59,70 @@
void __fastcall TForm1::AppMessage(tagMSG &Msg, bool &Handled)
{
- if (Msg.message == WM_VERSE) {
- HKEY hkey;
- LONG result;
- unsigned long verSize = 32;
- result = RegOpenKeyEx(HKEY_CLASSES_ROOT, "sword\\OpenVerse", NULL, KEY_READ | KEY_WRITE, &hkey);
- result = RegQueryValueEx(hkey, NULL, NULL, NULL, NULL, &verSize);
- char* verStr = new char[verSize];
- result = RegQueryValueEx(hkey, NULL, NULL, NULL, verStr, &verSize);
- result = RegCloseKey(hkey);
- result = RegDeleteKey(HKEY_CLASSES_ROOT, "sword\\OpenVerse");
- NavigateVerseURL(verStr);
- Handled = true;
- Form1->Show();
- ::SetForegroundWindow(this->Handle);
- }
+ if (Msg.message == WM_VERSE) {
+ HKEY hkey;
+ LONG result;
+ unsigned long verSize = 32;
+ result = RegOpenKeyEx(HKEY_CLASSES_ROOT, "sword\\OpenVerse", NULL, KEY_READ | KEY_WRITE, &hkey);
+ result = RegQueryValueEx(hkey, NULL, NULL, NULL, NULL, &verSize);
+ char* verStr = new char[verSize];
+ result = RegQueryValueEx(hkey, NULL, NULL, NULL, verStr, &verSize);
+ result = RegCloseKey(hkey);
+ result = RegDeleteKey(HKEY_CLASSES_ROOT, "sword\\OpenVerse");
+ NavigateVerseURL(verStr);
+ Handled = true;
+ Form1->Show();
+ ::SetForegroundWindow(this->Handle);
+ }
}
void TForm1::NavigateVerseURL (char* verStrIN)
{
- unsigned long verSize = strlen(verStrIN) + 1;
- char * verStr = new char[verSize];
- strcpy (verStr, verStrIN);
- char * verStr2 = new char[verSize];
- unsigned long verSize2 = 0;
- if (*(verStr + verSize - 2) == '\"') {
- *(verStr + verSize - 2) = 0;
- }
- verSize = 0;
- if (strstr(verStr, "libronix")) {
- char* bib = strstr(verStr, "bible:");
- if (bib) {
- verSize = 6 + (unsigned long)(bib - verStr);
- }
- }
- else if (strstr(verStr, "sword://")) {
- verSize = 9;
- }
- else if (*verStr == '\"') {
- verSize = 1;
- }
+ unsigned long verSize = strlen(verStrIN) + 1;
+ char * verStr = new char[verSize];
+ strcpy (verStr, verStrIN);
+ char * verStr2 = new char[verSize];
+ unsigned long verSize2 = 0;
+ if (*(verStr + verSize - 2) == '\"') {
+ *(verStr + verSize - 2) = 0;
+ }
+ verSize = 0;
+ if (strstr(verStr, "libronix")) {
+ char* bib = strstr(verStr, "bible:");
+ if (bib) {
+ verSize = 6 + (unsigned long)(bib - verStr);
+ }
+ }
+ else if (strstr(verStr, "sword://")) {
+ verSize = 9;
+ }
+ else if (*verStr == '\"') {
+ verSize = 1;
+ }
- while (verStr[verSize] != 0) {
- verStr2[verSize2] = verStr[verSize];
- verSize++;
- verSize2++;
- }
- verStr2[verSize2] = 0;
+ while (verStr[verSize] != 0) {
+ verStr2[verSize2] = verStr[verSize];
+ verSize++;
+ verSize2++;
+ }
+ verStr2[verSize2] = 0;
- char * verse = strstr(verStr2, "/");
- if (verse) {
- *verse = 0;
- verse++;
- }
- else {
- verse = verStr2;
- verStr2 = 0;
- }
+ char * verse = strstr(verStr2, "/");
+ if (verse) {
+ *verse = 0;
+ verse++;
+ }
+ else {
+ verse = verStr2;
+ verStr2 = 0;
+ }
- //freeHandLookup->Text = UTF8ToWideString(verse);
- freeHandLookup->Text = verse;
- freeHandLookupoldKeyPress(0, '\r');
+ freeHandLookup->Text = UTF8ToWideString(verse);
+// freeHandLookup->Text = verse;
+ freeHandLookupoldKeyPress(0, '\r');
- delete [] verStr;
- delete [] verStr2;
+ delete [] verStr;
+ delete [] verStr2;
}
__fastcall TForm1::TForm1(TComponent* Owner)
@@ -280,7 +280,7 @@
((SWDispRTF *)newrtf)->Name = String("CommentRTF")+mod->Name();
if (!strcmp(mod->getConfigEntry("ModDrv"), "RawFiles") ||
- ((mod->getConfigEntry("Writable")) && (!strcmp(mod->getConfigEntry("Writable"), "true")))) {
+ ((mod->getConfigEntry("Writable")) && (!strcmp(mod->getConfigEntry("Writable"), "true")))) {
((SWDispRTF *)newrtf)->PopupMenu = PopupMenu3;
((SWDispRTF *)newrtf)->ExpandNewLine = false;
}
@@ -419,11 +419,11 @@
void TForm1::TextKeyChanged()
{
- cbBook->ItemIndex = cbBook->Items->IndexOf(DefaultVSKey->books[DefaultVSKey->Testament()-1][DefaultVSKey->Book()-1].name);
+ cbBook->ItemIndex = cbBook->Items->IndexOf(UTF8ToWideString(DefaultVSKey->books[DefaultVSKey->Testament()-1][DefaultVSKey->Book()-1].name));
CHBox->Text = DefaultVSKey->Chapter();
VSBox->Text = DefaultVSKey->Verse();
- //freeHandLookup->Text = UTF8ToWideString((const char *)*DefaultVSKey);
- freeHandLookup->Text = (const char *)*DefaultVSKey;
+ freeHandLookup->Text = UTF8ToWideString((const char *)*DefaultVSKey);
+// freeHandLookup->Text = (const char *)*DefaultVSKey;
RefreshActiveSheet(TextPageControl);
logmodstate = false; // only log state once
RefreshActiveSheet(CommentaryPageControl);
@@ -441,8 +441,8 @@
if (StrToInt(VSBox->Text) < 0)
VSBox->Text = StrToInt(VSBox->Text) + 1;
- //(*DefaultVSKey) = WideStringToUTF8((cbBook->Text + " " + CHBox->Text + ":" + VSBox->Text)).c_str();
- (*DefaultVSKey) = (cbBook->Text + " " + CHBox->Text + ":" + VSBox->Text).c_str();
+ (*DefaultVSKey) = WideStringToUTF8((cbBook->Text + " " + CHBox->Text + ":" + VSBox->Text)).c_str();
+// (*DefaultVSKey) = (cbBook->Text + " " + CHBox->Text + ":" + VSBox->Text).c_str();
TextKeyChanged();
DefaultVSKey->AutoNormalize(1);
}
@@ -543,7 +543,7 @@
int len = src.Length();
- if (((src[1] == '<') || (src[1] == '(')) && ((src[len] == '>') || (src[len] == ')'))) {
+ if (len && ((src[1] == '<') || (src[1] == '(')) && ((src[len] == '>') || (src[len] == ')'))) {
len -= 2;
src = src.SubString(2, len);
}
@@ -705,8 +705,8 @@
while (!myVk->Error()) {
AnsiString s1 = (const char *)(*myVk);
s1.SetLength(s1.Length() - 4);
- //cbBook->Items->Add(UTF8ToWideString(s1));
- cbBook->Items->Add(s1);
+ cbBook->Items->Add(UTF8ToWideString(s1));
+// cbBook->Items->Add(s1);
myVk->Book(myVk->Book() + 1);
}
delete myVk;
@@ -748,15 +748,15 @@
delete pic;
- TFont *UIFont = new TFont();
- UIFont->Name = optionsconf->Sections["Appearance"]["UIFontName"].c_str();
+ TFont *UIFont = new TFont();
+ UIFont->Name = optionsconf->Sections["Appearance"]["UIFontName"].c_str();
- tmp = optionsconf->Sections["Appearance"]["UIFontColor"].c_str();
- if (tmp.Length() > 0)
- UIFont->Color = StrToInt(tmp);
- tmp = optionsconf->Sections["Appearance"]["UIFontSize"].c_str();
- if (tmp.Length() > 0)
- UIFont->Size = StrToInt(tmp);
+ tmp = optionsconf->Sections["Appearance"]["UIFontColor"].c_str();
+ if (tmp.Length() > 0)
+ UIFont->Color = StrToInt(tmp);
+ tmp = optionsconf->Sections["Appearance"]["UIFontSize"].c_str();
+ if (tmp.Length() > 0)
+ UIFont->Size = StrToInt(tmp);
// MainForm
File1->Caption = _tr("&File");
SaveLayout1->Caption = _tr("S&ave Layout");
@@ -798,12 +798,12 @@
CommentaryPageControl->Hint = _tr("Commentaries");
LexDictPageControl->Hint = _tr("Lexicons / Dictionaries");
- cbBook->Font = UIFont;
- freeHandLookup->Font = UIFont;
- DictKeyEditOld->Font = UIFont;
- lbDictKeysOld->Font = UIFont;
- lbDictKeys->Font = UIFont;
- DictKeyEdit->Font = UIFont;
+ cbBook->Font = UIFont;
+ freeHandLookup->Font = UIFont;
+ DictKeyEditOld->Font = UIFont;
+ lbDictKeysOld->Font = UIFont;
+ lbDictKeys->Font = UIFont;
+ DictKeyEdit->Font = UIFont;
// AboutBox
AboutBox->Caption = _tr("About The SWORD Project");
@@ -975,7 +975,7 @@
PreviewForm->btnPrint->Caption = "Print";
PreviewForm->btnClose->Caption = "&Close";
- delete UIFont;
+ delete UIFont;
}
@@ -1028,7 +1028,7 @@
fillVKeySelector(DefaultVSKey);
- cbBook->ItemIndex = cbBook->Items->IndexOf("James");
+// cbBook->ItemIndex = cbBook->Items->IndexOf("James");
DefaultVSKey->Persist(1); // when set to a module, make the module hold on to this actual key and not a copy
*DefaultVSKey = "James 1:19"; // set to our standard starting verse
@@ -1210,12 +1210,12 @@
eitend = (*sit).second.upper_bound("SearchText");
for (eit = (*sit).second.lower_bound("SearchText"); eit != eitend; eit++)
- //searchForm->SearchText->Items->Add(UTF8ToWideString(eit->second.c_str()));
- searchForm->SearchText->Items->Add(eit->second.c_str());
+ searchForm->SearchText->Items->Add(UTF8ToWideString(eit->second.c_str()));
+// searchForm->SearchText->Items->Add(eit->second.c_str());
eitend = (*sit).second.upper_bound("LookupText");
for (eit = (*sit).second.lower_bound("LookupText"); eit != eitend; eit++)
- freeHandLookup->Items->Add(eit->second.c_str());
+ freeHandLookup->Items->Add(UTF8ToWideString(eit->second.c_str()));
if ((eit = (*sit).second.find("LastTextModule")) != (*sit).second.end()) {
for (int i = 0; i < TextPageControl->PageCount; i++) {
@@ -1244,7 +1244,7 @@
}
if ((eit = (*sit).second.find("LastLDKey")) != (*sit).second.end()) {
//DictKeyEdit->Text = UTF8ToWideString((*eit).second.c_str());
- DictKeyEdit->Text = (*eit).second.c_str();
+ DictKeyEdit->Text = (*eit).second.c_str();
}
}
@@ -1289,7 +1289,7 @@
else {
startVerse = layoutconf->Sections["History"].getWithDefault("LastVerse", "").c_str();
if (startVerse.Length()) {
- freeHandLookup->Text = startVerse.c_str();
+ freeHandLookup->Text = UTF8ToWideString(startVerse.c_str());
char ret = '\r';
freeHandLookupoldKeyPress(0, ret);
}
@@ -1462,16 +1462,14 @@
void __fastcall TForm1::BookmarkItemClick(TObject *Sender)
{
TMenuItem *menuchoice = (TMenuItem *)Sender;
- const char *source = menuchoice->Caption.c_str();
- char *value = new char [strlen(source) + 1];
- int k = 0;
- for (unsigned int j = 0; j < strlen(source); j++) {
- if (source[j] != '&')
- value[k++] = source[j];
+ SWBuf src = WideStringToUTF8(menuchoice->Caption).c_str();
+ const char *source = src.c_str();
+ SWBuf value;
+ for (unsigned int j = 0; j < src.length(); j++) {
+ if (src[j] != '&')
+ value.append(src[j]);
}
- value[k] = 0;
*DefaultVSKey = value;
- delete [] value;
TextKeyChanged();
}
@@ -1479,7 +1477,7 @@
{
// TMenuItem *newitem;
- bookmarkForm->bmtree->Items->AddChild(bookmarkForm->bmtree->Items->Item[0], (const char *)*DefaultVSKey);
+ bookmarkForm->bmtree->Items->AddChild(bookmarkForm->bmtree->Items->Item[0], UTF8ToWideString((const char *)*DefaultVSKey));
}
void TForm1::AddSectionToMenu(TMenu *menu, TMenuItem *item, TTreeNode *tree)
@@ -1629,7 +1627,8 @@
if (keytext[strlen(keytext)-1] == '\r')
keytext[strlen(keytext)-1] = 0;
- tmpVerseListCaption = String("VerseList from- ") + (*target).first.c_str() + ": " + keytext;
+ String cap = String(WideStringToUTF8(_tr("VerseList from- "))) + (*target).first.c_str() + ": " + keytext;
+ tmpVerseListCaption = cap;
delete [] keytext; // ---------------------------------
}
newitem = new TMenuItem(menu);
@@ -1645,7 +1644,7 @@
while (!tmpVerseList.Error()) {
breakcnt++;
newitem = new TMenuItem(menu);
- newitem->Caption = (const char *)tmpVerseList;
+ newitem->Caption = UTF8ToWideString((const char *)tmpVerseList);
newitem->OnClick = BookmarkItemClick;
if (!(breakcnt%15))
newitem->Break = mbBreak;
@@ -1702,7 +1701,7 @@
if (tmpVerseList.Count())
AddVerseChoices(menu, refList.c_str(), rtf);
}
- }
+ }
}
else {
tmpVerseList = DefaultVSKey->ParseVerseList(highlight.c_str(), *DefaultVSKey);
@@ -1790,7 +1789,7 @@
void __fastcall TForm1::createVerseList(TObject *Sender)
{
TVerseListForm *tmpForm = new TVerseListForm(this, tmpVerseList);
- tmpForm->Caption = tmpVerseListCaption;
+ tmpForm->Caption = UTF8ToWideString(tmpVerseListCaption);
tmpForm->Show();
}
//---------------------------------------------------------------------------
@@ -1984,7 +1983,7 @@
caption[k] = 0;
if (!stricmp(caption, value.c_str()))
menuChoice->Items[i]->Checked = true;
- else menuChoice->Items[i]->Checked = false;
+ else menuChoice->Items[i]->Checked = false;
delete [] caption;
}
}
@@ -2123,10 +2122,10 @@
ModVisForm->mgr = mainmgr;
ModVisForm->section = section;
if (ModVisForm->ShowModal() == mrOk) {
- for (int i = 0; i < pc->PageCount; i++) {
- SWBuf heading = pc->Pages[i]->Caption.c_str();
+ for (int i = 0; i < pc->PageCount; i++) {
+ SWBuf heading = pc->Pages[i]->Caption.c_str();
pc->Pages[i]->TabVisible = ((*section)[heading.c_str()] == "true");
- }
+ }
}
}
//---------------------------------------------------------------------------
@@ -2456,7 +2455,7 @@
RTFHintForm->rtfDrawer->fillWithRTFString(module, body.c_str());
HintStr = "show rtf";
}
- }
+ }
break;
}
Modified: trunk/mainfrm.h
===================================================================
--- trunk/mainfrm.h 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/mainfrm.h 2005-02-10 14:47:18 UTC (rev 411)
@@ -52,8 +52,8 @@
#include <list>
#include <vector>
-//#define _tr(text) UTF8ToWideString(LocaleMgr::systemLocaleMgr.translate(text))
-#define _tr(text) LocaleMgr::getSystemLocaleMgr()->translate(text)
+#define _tr(text) UTF8ToWideString(LocaleMgr::getSystemLocaleMgr()->translate(text))
+//#define _tr(text) LocaleMgr::getSystemLocaleMgr()->translate(text)
#define MONITOR_CENTER 0x0001 // center rect to monitor
#define MONITOR_CLIP 0x0000 // clip rect to monitor
#define MONITOR_WORKAREA 0x0002 // use monitor work area
Modified: trunk/searchfrm.cpp
===================================================================
--- trunk/searchfrm.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/searchfrm.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -68,14 +68,16 @@
Caption = "";
if (target) {
- Caption = _tr("Searching");
- Caption += (AnsiString)" [ " + (AnsiString)target->Description() + (AnsiString)" (" + (AnsiString)target->Name() + (AnsiString)") ]...";
+ AnsiString cap = _tr("Searching");
+ cap += (AnsiString)" [ " + (AnsiString)target->Description() + (AnsiString)" (" + (AnsiString)target->Name() + (AnsiString)") ]...";
+ Caption = UTF8ToWideString(cap);
resultsLV->Items->Clear();
int searchType;
switch (searchTypeGroup->ItemIndex) {
case 0: searchType = -2; break;
case 1: searchType = -1; break;
case 2: searchType = 0; break;
+ case 3: searchType = -4; break;
}
int searchOptions = (caseSensitiveCkBx->Checked) ? 0 : REG_ICASE;
SWKey *scope = 0;
@@ -115,10 +117,10 @@
if (focused) {
int row = focused->Index;
SWKey *key = (SWKey *)*target;
- (*key) = resultsLV->Items->Item[row]->Caption.c_str();
+ (*key) = WideStringToUTF8(resultsLV->Items->Item[row]->Caption).c_str();
if (targetpc == Form1->LexDictPageControl) {
- //Form1->DictKeyEdit->Text = UTF8ToWideString(resultsLV->Items->Item[row]->Caption.c_str());
- Form1->DictKeyEdit->Text = resultsLV->Items->Item[row]->Caption.c_str();
+// Form1->DictKeyEdit->Text = UTF8ToWideString(resultsLV->Items->Item[row]->Caption.c_str());
+ Form1->DictKeyEdit->Text = WideStringToUTF8(resultsLV->Items->Item[row]->Caption).c_str();
}
else {
Form1->TextKeyChanged();
@@ -136,7 +138,7 @@
int row = focused->Index;
ListKey verse;
SWKey *key = target->CreateKey();
- *key = resultsLV->Items->Item[row]->Caption.c_str();
+ *key = WideStringToUTF8(resultsLV->Items->Item[row]->Caption).c_str();
verse << *key;
delete key;
pvrtf->fillWithVerses(target, &verse, 0, true, false, "Search");
@@ -190,7 +192,7 @@
for (results = TOP; !results.Error(); results++) {
parent->target->setKey(results);
pItem = parent->resultsLV->Items->Add();
- pItem->Caption = (const char *)results;
+ pItem->Caption = UTF8ToWideString((const char *)results);
pItem->SubItems->Add("");
// pItem->SubItems->Add((*parent->target).second->StripText());
// pItem = resultsLV->Items->Add(
@@ -200,9 +202,11 @@
else parent->target->setKey(origKeyVal); //remove our persist key
// 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)") ]";
+ AnsiString cap = ((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->Caption = UTF8ToWideString(cap);
parent->searchBtn->Caption = _tr("Search");
parent->searchBtn->OnClick = parent->searchBtnClick;
+ parent->progressBar->Position = 0;
}
void __fastcall TsearchForm::TSearchThread::Execute()
@@ -239,7 +243,7 @@
end = config.Sections["CustomRanges"].end();
while (loop != end) {
TCustomRange *rs = new TCustomRange(loop->first.c_str(), loop->second.c_str());
- ComboBox1->Items->AddObject(rs->name.c_str(), rs);
+ ComboBox1->Items->AddObject(UTF8ToWideString(rs->name.c_str()), rs);
loop++;
}
}
@@ -267,10 +271,10 @@
TRect rect = Item->DisplayRect(drSelectBounds);
static UnicodeRTF filter;
SWBuf buf;
- buf = Item->Caption.c_str();
+ buf = WideStringToUTF8(Item->Caption).c_str();
SWKey *key = *target;
- if (!SWDYNAMIC_CAST(VerseKey, key))
+// if (!SWDYNAMIC_CAST(VerseKey, key))
filter.processText(buf, *target, target);
RTFHintForm->searchListDrawer->fillWithRTFString(target, ((String)" \\b " + buf.c_str() + " ").c_str(), "Search");
@@ -356,17 +360,17 @@
void TsearchForm::setTarget(SWModule *itarget) {
target = itarget;
- moduleName->Caption = target->Description() + (AnsiString) " (" + target->Name() + ")";
+ AnsiString cap = target->Description() + (AnsiString) " (" + target->Name() + ")";
+ moduleName->Caption = UTF8ToWideString(cap);
RTFHintForm->searchListDrawer->fillWithRTFString(target, "yoyo");
SearchText->Font->Name = RTFHintForm->searchListDrawer->dispAttribs.fontName;
// SearchText->Font->Size = RTFHintForm->searchListDrawer->dispAttribs.fontSize;
resultsLV->StateImages->Height = 1;
// search framework stuff
- if (target->hasSearchFramework() && target->isSearchOptimallySupported("God", -2, 0, 0)) {
- searchTypeGroup->Enabled = false;
- searchTypeGroup->ItemIndex = 0;
- searchOptionsGroup->Enabled = false;
+ if (target->hasSearchFramework() && target->isSearchOptimallySupported("God", -4, 0, 0)) {
+ searchTypeGroup->Items->CommaText = _tr("\"Multi Word\",\"Phrase\",\"Regular Expression\",\"Optimized Search\"");
+ searchTypeGroup->ItemIndex = 3;
toggleIndexBtn->Caption = _tr("Delete Index");
indexStatus->Caption = _tr("Using Indexed Searching Framework For This Book");
toggleIndexBtn->Enabled = true;
@@ -375,11 +379,11 @@
}
else {
usingSearchFramework = false;
- searchTypeGroup->Enabled = true;
- searchOptionsGroup->Enabled = true;
+ searchTypeGroup->Items->CommaText = _tr("\"Multi Word\",\"Phrase\",\"Regular Expression\"");
+ searchTypeGroup->ItemIndex = 0;
toggleIndexBtn->Caption = _tr("Create Index");
indexStatus->Caption = _tr("Not Using Indexed Searching Framework For This Book");
- if (!target->isSearchOptimallySupported("God", -2, 0, 0)) {
+ if (!target->isSearchOptimallySupported("God", -4, 0, 0)) {
toggleIndexBtn->Enabled = true;
}
}
@@ -464,7 +468,7 @@
if (resultsLV->Items->Count > 0) {
ListKey tmpVerseList;
for (int i = 0; i < resultsLV->Items->Count; i++) {
- tmpVerseList << resultsLV->Items->Item[i]->Caption.c_str();
+ tmpVerseList << WideStringToUTF8(resultsLV->Items->Item[i]->Caption).c_str();
}
TVerseListForm *tmpForm = new TVerseListForm(this, tmpVerseList);
tmpForm->Caption = _tr("Search Verse List");
Modified: trunk/searchfrm.dfm
===================================================================
(Binary files differ)
Modified: trunk/swdisprtf.cpp
===================================================================
--- trunk/swdisprtf.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/swdisprtf.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -65,7 +65,7 @@
SWKey *key = Module;
// VerseKey locales are not yet UTF8, so don't try to convert them.
- if (!SWDYNAMIC_CAST(VerseKey, key))
+// if (!SWDYNAMIC_CAST(VerseKey, key))
filter.processText(buf, Module, &Module);
newtext = newtext + RTFHeadingPre + buf.c_str() + RTFHeadingPost + ":{\\par}";
Modified: trunk/sword.bpr
===================================================================
--- trunk/sword.bpr 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/sword.bpr 2005-02-10 14:47:18 UTC (rev 411)
@@ -74,7 +74,7 @@
MajorVer=1
MinorVer=5
Release=6
-Build=15
+Build=21
Debug=0
PreRelease=0
Special=0
@@ -86,13 +86,13 @@
[Version Info Keys]
CompanyName=CrossWire Software & Bible Society
FileDescription=Windows 32bit User Interface to The SWORD Project
-FileVersion=1.5.6.15
+FileVersion=1.5.6.21
InternalName=biblecs
LegalCopyright=(c) 1990-2005 CrossWire Bible Society under the terms of the GNU General Public License
LegalTrademarks=
OriginalFilename=
ProductName=The SWORD Project
-ProductVersion=1.5.8pre1
+ProductVersion=1.5.8pre2
Comments=Seek Him and you will find Him
[HistoryLists\hlIncludePath]
@@ -137,20 +137,21 @@
Item2=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
-Count=13
+Count=14
Item0=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE
-Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
-Item2=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
-Item3=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
-Item4=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
-Item5=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
-Item6=_ICU_;_ICUSWORD_;USBINARY
-Item7=_ICU_;_ICUSWORD_;_DEBUG;USBINARY
-Item8=_ICU_;_ICUSWORD_;_DEBUG
-Item9=_ICU_;_ICUSWORD_
-Item10=_ICU_
-Item11=_ICU_;_DEBUG
-Item12=_DEBUG
+Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_DEBUG
+Item2=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
+Item3=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
+Item4=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
+Item5=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
+Item6=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
+Item7=_ICU_;_ICUSWORD_;USBINARY
+Item8=_ICU_;_ICUSWORD_;_DEBUG;USBINARY
+Item9=_ICU_;_ICUSWORD_;_DEBUG
+Item10=_ICU_;_ICUSWORD_
+Item11=_ICU_
+Item12=_ICU_;_DEBUG
+Item13=_DEBUG
[HistoryLists\hlIntOutputDir]
Count=2
Modified: trunk/sword.res
===================================================================
(Binary files differ)
Modified: trunk/vrslstfrm.cpp
===================================================================
--- trunk/vrslstfrm.cpp 2005-02-10 09:46:45 UTC (rev 410)
+++ trunk/vrslstfrm.cpp 2005-02-10 14:47:18 UTC (rev 411)
@@ -49,7 +49,7 @@
if (target) {
ListKey key;
SWKey *tkey = target->CreateKey();
- *tkey = ListBox1->Items->Strings[ListBox1->ItemIndex].c_str();
+ *tkey = WideStringToUTF8(ListBox1->Items->Strings[ListBox1->ItemIndex]).c_str();
key << *tkey;
delete tkey;
pvrtf->fillWithVerses(target, &key, 0, true, false);
@@ -59,7 +59,7 @@
void __fastcall TVerseListForm::ListBox1DblClick(TObject *Sender)
{
- *(Form1->DefaultVSKey) = ListBox1->Items->Strings[ListBox1->ItemIndex].c_str();
+ *(Form1->DefaultVSKey) = WideStringToUTF8(ListBox1->Items->Strings[ListBox1->ItemIndex]).c_str();
Form1->TextKeyChanged();
}
//---------------------------------------------------------------------------
@@ -83,16 +83,16 @@
ListBox1->Items->Clear();
for (verseList = TOP; (!verseList.Error()); verseList++)
- ListBox1->Items->Add((const char *)verseList);
+ ListBox1->Items->Add(UTF8ToWideString((const char *)verseList));
}
-
+// ADD CURRENT
void __fastcall TVerseListForm::SpeedButton1Click(TObject *Sender)
{
- ListBox1->Items->Add((const char *)*(Form1->DefaultVSKey));
+ ListBox1->Items->Add(UTF8ToWideString((const char *)*(Form1->DefaultVSKey)));
}
//---------------------------------------------------------------------------
-
+// DELETE SELECTED
void __fastcall TVerseListForm::SpeedButton2Click(TObject *Sender)
{
int item = ListBox1->ItemIndex;
@@ -101,12 +101,12 @@
}
}
//---------------------------------------------------------------------------
-
+// to clipboard
void __fastcall TVerseListForm::SpeedButton3Click(TObject *Sender)
{
ListKey verses;
for (int i = 0; i < ListBox1->Items->Count; i++) {
- verses << ListBox1->Items->Strings[i].c_str();
+ verses << WideStringToUTF8(ListBox1->Items->Strings[i]).c_str();
}
TPageControl *targetpc = Form1->TextPageControl;
@@ -134,17 +134,17 @@
}
}
//---------------------------------------------------------------------------
-
+// PRINT
void __fastcall TVerseListForm::SpeedButton4Click(TObject *Sender)
{
ListKey verses;
for (int i = 0; i < ListBox1->Items->Count; i++) {
- verses << ListBox1->Items->Strings[i].c_str();
+ verses << WideStringToUTF8(ListBox1->Items->Strings[i]).c_str();
}
PrintForm->print(&verses);
}
//---------------------------------------------------------------------------
-
+// SAVE
void __fastcall TVerseListForm::SpeedButton5Click(TObject *Sender)
{
int result = VLSaveDialog->Execute();
@@ -174,7 +174,7 @@
}
}
//---------------------------------------------------------------------------
-
+// OPEN
void __fastcall TVerseListForm::SpeedButton6Click(TObject *Sender)
{
int result = VLOpenDialog->Execute();
More information about the sword-cvs
mailing list