aboutsummaryrefslogtreecommitdiffstats
path: root/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'apps/windoze/CBuilder5/BibleCS/mainfrm.cpp')
-rw-r--r--apps/windoze/CBuilder5/BibleCS/mainfrm.cpp51
1 files changed, 32 insertions, 19 deletions
diff --git a/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp b/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp
index 5df1c50..3d7aec6 100644
--- a/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp
+++ b/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp
@@ -358,14 +358,12 @@ char TForm1::CreateBookPane(SWModule *mod) {
((SWDispRTF *)newrtf)->ScrollBars = ssVertical;
((SWDispRTF *)newrtf)->ReadOnly = true;
- if ((*mainmgr->config->Sections[mod->Name()].find("ModDrv")).second == "RawFiles") {
- ((SWDispRTF *)newrtf)->PopupMenu = PopupMenu3;
- ((SWDispRTF *)newrtf)->ExpandNewLine = false;
- }
- else ((SWDispRTF *)newrtf)->PopupMenu = PopupMenu2;
+ ((SWDispRTF *)newrtf)->PopupMenu = PopupMenu2;
((SWDispRTF *)newrtf)->OnMouseDown = RTFMouseDown;
+ newrtf->Name = String("BookRTF")+mod->Name();
newrtf->Parent = newtab;
newrtf->Align = alClient;
+ ((SWDispRTF *)newrtf)->OnURLClick = RTFURLClick;
((SWDispRTF *)newrtf)->module = mod;
((SWDispRTF *)newrtf)->recalcAppearance();
@@ -1068,10 +1066,16 @@ void __fastcall TForm1::FormShow(TObject *Sender)
}
if ((eit = (*sit).second.find("SearchLeft")) != (*sit).second.end())
searchForm->Left = atoi((*eit).second.c_str());
- if ((eit = (*sit).second.find("SearchHeight")) != (*sit).second.end())
- searchForm->Height = atoi((*eit).second.c_str());
- if ((eit = (*sit).second.find("SearchWidth")) != (*sit).second.end())
- searchForm->Width = atoi((*eit).second.c_str());
+ if ((eit = (*sit).second.find("SearchHeight")) != (*sit).second.end()) {
+ int val = atoi((*eit).second.c_str());
+ val = max(val, searchForm->Constraints->MinHeight);
+ searchForm->Height = val;
+ }
+ if ((eit = (*sit).second.find("SearchWidth")) != (*sit).second.end()) {
+ int val = atoi((*eit).second.c_str());
+ val = max(val, searchForm->Constraints->MinWidth);
+ searchForm->Width = val;
+ }
searchForm->WindowState = (sit->second["SearchMaximized"] == "true") ? wsMaximized : wsNormal;
}
@@ -1217,7 +1221,8 @@ void __fastcall TForm1::LookupPokeData(TObject *Sender)
token = strtok(buf, " ");
if ((it = mainmgr->Modules.find(token)) != mainmgr->Modules.end()) {
token = strtok(NULL, "");
- (*it).second->setKey(token);
+ SWKey *key = (SWKey *)*(it->second);
+ (*key) = token;
Lookup->Text = (const char *)(*(*it).second);
}
else Lookup->Text = "";
@@ -1278,13 +1283,10 @@ void TForm1::RestoreState(ModState *state)
it = mainmgr->Modules.find(state->pc->ActivePage->Caption.c_str());
if (it != mainmgr->Modules.end()) {
SWModule *module = it->second;
- if (!strcmp(module->Type(0), "Generic Books")) {
- module->setKey(state->key);
- }
- else {
- *DefaultVSKey = state->key;
- TextKeyChanged();
- }
+ SWKey *key = (SWKey *)*module;
+ (*key) = state->key;
+ *DefaultVSKey = state->key;
+ TextKeyChanged();
}
}
}
@@ -1595,7 +1597,12 @@ void __fastcall TForm1::PopupMenuPopup(TObject *Sender) {
rtf->SelLength = 0;
if (!verseList.Length()) {
- for (versestart = selstart; ((versestart)&&(entrytext[versestart] != '#')); versestart--);
+ versestart = selstart;
+ for (int i = 0; ((i < versestart) && (i < entrylen)); i++) {
+ if (entrytext[i] == '\r')
+ versestart++;
+ }
+ for (; ((versestart)&&(entrytext[versestart] != '#')); versestart--);
if (versestart) {
for (verseend = versestart; ((verseend < entrylen) && (entrytext[verseend] != '|')); verseend++);
if ((verseend < entrylen) && (verseend > selstart)) {
@@ -2089,6 +2096,7 @@ void __fastcall TForm1::ApplicationEvents1ShowHint(AnsiString &HintStr,
if ((strncmp(HintInfo.HintControl->Name.c_str(), "TextRTF", 7)) &&
(strncmp(HintInfo.HintControl->Name.c_str(), "CommentRTF", 10)) &&
+ (strncmp(HintInfo.HintControl->Name.c_str(), "BookRTF", 7)) &&
(strncmp(HintInfo.HintControl->Name.c_str(), "LexDictRTF", 10))) {
return;
}
@@ -2130,7 +2138,12 @@ void __fastcall TForm1::ApplicationEvents1ShowHint(AnsiString &HintStr,
int selstart = rtf->SelStart;
int versestart, verseend;
strcpy(entrytext, rtf->Text.c_str());
- for (versestart = selstart; ((versestart)&&(entrytext[versestart] != '#')); versestart--);
+ versestart = selstart;
+ for (int i = 0; ((i < versestart) && (i < entrylen)); i++) {
+ if (entrytext[i] == '\r')
+ versestart++;
+ }
+ for (; ((versestart)&&(entrytext[versestart] != '#')); versestart--);
if (versestart) {
for (verseend = versestart; ((verseend < entrylen) && (entrytext[verseend] != '|')); verseend++);
if ((verseend < entrylen) && (verseend > selstart)) {