diff options
author | danglassey <danglassey> | 2002-08-25 13:00:44 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-08-25 13:00:44 +0000 |
commit | 57166de8138034b080473448f74319dcfabd146f (patch) | |
tree | 7f39bece2bd0fd217c1538c175b2bbeeeecd4bf1 /apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp | |
parent | 661e7ce1f588ce7231cf0435f2b7218cfa72b200 (diff) | |
download | sword-sf-cvs-57166de8138034b080473448f74319dcfabd146f.tar.gz |
sync with crosswire 20020825-1300
Diffstat (limited to 'apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp')
-rw-r--r-- | apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp b/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp index d09bac2..94fdf62 100644 --- a/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp +++ b/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp @@ -424,6 +424,8 @@ void TRxRichEditX::fillWithVerses(SWModule *module, ListKey *verses, bool headin string fontname; TMemoryStream *RTFStream = new TMemoryStream(); System::AnsiString newtext, tmptext; + static UnicodeRTF filter; + char buf[255]; this->module = module; this->type = type; @@ -468,8 +470,14 @@ void TRxRichEditX::fillWithVerses(SWModule *module, ListKey *verses, bool headin if (!first) newtext += "\\par\\par "; newtext += RTFHeadingPre; - newtext += module->KeyText(); - newtext += ":"; + + strcpy(buf, module->KeyText()); + SWKey *key = *module; + // VerseKey locales are not yet UTF8, so don't try to convert them. + if (!SWDYNAMIC_CAST(VerseKey, key)) + filter.ProcessText(buf, 253, *module, module); + newtext = newtext + RTFHeadingPre + buf + RTFHeadingPost + ":\\par "; + newtext += RTFHeadingPost; newtext += "\\par "; } @@ -766,8 +774,8 @@ AnsiString TRxRichEditX::getType() { } -WideString __fastcall TRxRichEditX::GetText() { - int MaxLen; +long __fastcall TRxRichEditX::TextLen() { + long MaxLen; if (RichEditVersion >= 2) { TGetTextLengthEx TextLenEx; @@ -777,6 +785,13 @@ WideString __fastcall TRxRichEditX::GetText() { MaxLen = Perform(EM_GETTEXTLENGTHEX, (WPARAM)&TextLenEx, 0); } else MaxLen = GetTextLen(); + return MaxLen; +} + + +WideString __fastcall TRxRichEditX::GetText() { + long MaxLen = TextLen(); + wchar_t *buf = new wchar_t [ MaxLen + 2 ]; GETTEXTEX params; params.cb = (MaxLen + 1) * sizeof(wchar_t); @@ -830,16 +845,21 @@ WideString __fastcall TRxRichEditX::WordAtCursor(void) { WideString Result = ""; if (HandleAllocated()) { - Range.cpMax = SelStart; - if (!Range.cpMax) - Range.cpMin = 0; - else if (SendMessage(Handle, EM_FINDWORDBREAK, WB_ISDELIMITER, Range.cpMax)) - Range.cpMin = SendMessage(Handle, EM_FINDWORDBREAK, WB_MOVEWORDLEFT, Range.cpMax); - else Range.cpMin = SendMessage(Handle, EM_FINDWORDBREAK, WB_LEFT, Range.cpMax); - while (SendMessage(Handle, EM_FINDWORDBREAK, WB_ISDELIMITER, Range.cpMin)) - Range.cpMin++; - Range.cpMax = SendMessage(Handle, EM_FINDWORDBREAK, WB_RIGHTBREAK, Range.cpMax); - Result = Trim(GetTextRange(Range.cpMin, Range.cpMax)); + long max = TextLen() - 1; + for (int i = 0; (SelStart + i) < max; i++) { + Range.cpMax = SelStart + i; + if (!Range.cpMax) + Range.cpMin = 0; + else if (SendMessage(Handle, EM_FINDWORDBREAK, WB_ISDELIMITER, Range.cpMax)) + Range.cpMin = SendMessage(Handle, EM_FINDWORDBREAK, WB_MOVEWORDLEFT, Range.cpMax); + else Range.cpMin = SendMessage(Handle, EM_FINDWORDBREAK, WB_LEFT, Range.cpMax); + while (SendMessage(Handle, EM_FINDWORDBREAK, WB_ISDELIMITER, Range.cpMin)) + Range.cpMin++; + Range.cpMax = SendMessage(Handle, EM_FINDWORDBREAK, WB_RIGHTBREAK, Range.cpMax); + Result = Trim(GetTextRange(Range.cpMin, Range.cpMax)); + if (Range.cpMax - Range.cpMin) + break; + } } return Result; } |