[sword-cvs] sword/apps/windoze/CBuilder5/BibleCS RxRichEditX.cpp,1.42,1.43 RxRichEditX.h,1.15,1.16 mainfrm.cpp,1.120,1.121
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 18 Jun 2003 16:37:24 -0700
Update of /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS
In directory www:/tmp/cvs-serv21123/apps/windoze/CBuilder5/BibleCS
Modified Files:
RxRichEditX.cpp RxRichEditX.h mainfrm.cpp
Log Message:
Added note popups for ESV (well, should work for all osis encoded notes)
Fixed static bug in SWModule::RenderText
Index: RxRichEditX.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** RxRichEditX.cpp 30 Apr 2003 08:18:45 -0000 1.42
--- RxRichEditX.cpp 18 Jun 2003 23:37:21 -0000 1.43
***************
*** 387,391 ****
tmptext = "";
! for (const char *loop = (const char *)*module; *loop; loop++) {
if (stripNewlines) {
if (!strnicmp(loop, "\\par", 4)) {
--- 387,391 ----
tmptext = "";
! for (const char *loop = module->RenderText(); *loop; loop++) {
if (stripNewlines) {
if (!strnicmp(loop, "\\par", 4)) {
***************
*** 430,456 ****
Lines->LoadFromStream(RTFStream);
! // make links
! while (true) {
! int start, len, foundAt, endAt;
!
! start = (SelLength) ? SelStart + SelLength : 0;
! len = Text.Length() - start;
! foundAt = this->SearchText("<a href=\"\">", start, len, TRichSearchTypes());
! if (foundAt == -1)
! break;
!
! SelStart = foundAt;
! SelLength = 11;
! this->SelText = "";
! endAt = this->SearchText("</a>", foundAt, len, TRichSearchTypes());
! if (foundAt == -1)
! break;
! SelStart = endAt;
! SelLength = 4;
! this->SelText = "";
! SelStart = foundAt;
! SelLength = endAt - foundAt;
! this->SelAttributes->Link = true;
! }
if (Visible) {
TComponent *owner = this->Owner;
--- 430,435 ----
Lines->LoadFromStream(RTFStream);
! makeLinks();
!
if (Visible) {
TComponent *owner = this->Owner;
***************
*** 942,945 ****
--- 921,948 ----
}
+ void TRxRichEditX::makeLinks() {
+ while (true) {
+ int start, len, foundAt, endAt;
+
+ start = (SelLength) ? SelStart + SelLength : 0;
+ len = Text.Length() - start;
+ foundAt = this->SearchText("<a href=\"\">", start, len, TRichSearchTypes());
+ if (foundAt == -1)
+ break;
+
+ SelStart = foundAt;
+ SelLength = 11;
+ this->SelText = "";
+ endAt = this->SearchText("</a>", foundAt, len, TRichSearchTypes());
+ if (foundAt == -1)
+ break;
+ SelStart = endAt;
+ SelLength = 4;
+ this->SelText = "";
+ SelStart = foundAt;
+ SelLength = endAt - foundAt;
+ this->SelAttributes->Link = true;
+ }
+ }
void TRxRichEditX::clearHTMLTags()
Index: RxRichEditX.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/RxRichEditX.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** RxRichEditX.h 26 Mar 2003 22:07:12 -0000 1.15
--- RxRichEditX.h 18 Jun 2003 23:37:21 -0000 1.16
***************
*** 113,116 ****
--- 113,117 ----
AnsiString type;
void recalcAppearance();
+ void makeLinks();
AnsiString getType();
static WideString Trim(WideString &src);
Index: mainfrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -d -r1.120 -r1.121
*** mainfrm.cpp 15 Jun 2003 00:27:18 -0000 1.120
--- mainfrm.cpp 18 Jun 2003 23:37:21 -0000 1.121
***************
*** 1682,1686 ****
if (clickText.Length()) {
string highlight = Trim(clickText).c_str();
! tmpVerseList = DefaultVSKey->ParseVerseList((char *)highlight.c_str(), *DefaultVSKey);
if (tmpVerseList.Count())
AddVerseChoices(menu, highlight.c_str(), rtf);
--- 1682,1710 ----
if (clickText.Length()) {
string highlight = Trim(clickText).c_str();
!
! if (clickText.c_str()[0] == '*') { // '*' = NOTE
! ModMap::iterator it;
! it = mainmgr->Modules.find(TextPageControl->ActivePage->Caption.c_str());
! if (it != mainmgr->Modules.end()) {
! SWModule *module = it->second;
! SWBuf verseNum = clickText.c_str()+2;
! int offset = (strchr(verseNum.c_str(), '.') - verseNum.c_str());
! verseNum.setSize(offset);
! SWBuf fnNum = clickText.c_str()+3+offset;
! int oldVerse = DefaultVSKey->Verse();
! DefaultVSKey->Verse(atoi(verseNum));
! module->RenderText(); // force entry attributes to get set
! SWBuf type = module->getEntryAttributes()["Footnote"][fnNum.c_str()]["type"].c_str();
! SWBuf body = module->getEntryAttributes()["Footnote"][fnNum.c_str()]["body"].c_str();
! DefaultVSKey->Verse(oldVerse);
! if ((type == "crossReference") || (type == "x-cross-ref")) {
! tmpVerseList = DefaultVSKey->ParseVerseList(body.c_str(), *DefaultVSKey);
! if (tmpVerseList.Count())
! AddVerseChoices(menu, body.c_str(), rtf);
! }
! }
! }
!
! tmpVerseList = DefaultVSKey->ParseVerseList(highlight.c_str(), *DefaultVSKey);
if (tmpVerseList.Count())
AddVerseChoices(menu, highlight.c_str(), rtf);
***************
*** 2340,2355 ****
lastWord = targetWord;
! // currently assume all links are verselists
! if (verseList.Length() && hintVLists) {
! ModMap::iterator it;
! it = mainmgr->Modules.find(TextPageControl->ActivePage->Caption.c_str());
! if (it != mainmgr->Modules.end()) {
! SWModule *module = it->second;
! ListKey verses = DefaultVSKey->ParseVerseList(verseList.c_str(), *DefaultVSKey, true);
! if (verses.Count()) {
! RTFHintForm->rtfDrawer->fillWithVerses(module, &verses, true, true, "Popup");
! HintStr = "show rtf";
}
- else HintStr = "";
break;
}
--- 2364,2413 ----
lastWord = targetWord;
! // currently assume all links are verselists (added note types still using verseList variable name)
! if (verseList.Length()) {
! if (verseList.c_str()[0] == '*') { // '*' = NOTE
! ModMap::iterator it;
! it = mainmgr->Modules.find(TextPageControl->ActivePage->Caption.c_str());
! if (it != mainmgr->Modules.end()) {
! SWModule *module = it->second;
! SWBuf verseNum = verseList.c_str()+2;
! int offset = (strchr(verseNum.c_str(), '.') - verseNum.c_str());
! verseNum.setSize(offset);
! SWBuf fnNum = verseList.c_str()+3+offset;
! int oldVerse = DefaultVSKey->Verse();
! DefaultVSKey->Verse(atoi(verseNum));
! module->RenderText(); // force entry attributes to get set
! SWBuf type = module->getEntryAttributes()["Footnote"][fnNum.c_str()]["type"].c_str();
! SWBuf body = module->getEntryAttributes()["Footnote"][fnNum.c_str()]["body"].c_str();
! DefaultVSKey->Verse(oldVerse);
! if ((type == "crossReference") || (type == "x-cross-ref")) {
! ListKey verses = DefaultVSKey->ParseVerseList(body.c_str(), *DefaultVSKey, true);
! if (verses.Count()) {
! RTFHintForm->rtfDrawer->fillWithVerses(module, &verses, true, true, "Popup");
! HintStr = "show rtf";
! }
! else HintStr = "";
! }
! else {
! SWBuf text = module->RenderText(body.c_str());
! RTFHintForm->rtfDrawer->fillWithRTFString(module, text.c_str());
! HintStr = "show rtf";
! }
! }
! break;
!
! }
! else if (hintVLists) { // otherwise assume verselist
! ModMap::iterator it;
! it = mainmgr->Modules.find(TextPageControl->ActivePage->Caption.c_str());
! if (it != mainmgr->Modules.end()) {
! SWModule *module = it->second;
! ListKey verses = DefaultVSKey->ParseVerseList(verseList.c_str(), *DefaultVSKey, true);
! if (verses.Count()) {
! RTFHintForm->rtfDrawer->fillWithVerses(module, &verses, true, true, "Popup");
! HintStr = "show rtf";
! }
! else HintStr = "";
}
break;
}