[sword-cvs] sword/apps/windoze/CBuilder5/BibleCS paraldisp.cpp,NONE,1.1 paraldisp.h,NONE,1.1 mainfrm.cpp,1.116,1.117 mainfrm.dfm,1.41,1.42 mainfrm.h,1.44,1.45 sword.bpr,1.111,1.112 sword.cpp,1.42,1.43
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 11 Jun 2003 19:03:36 -0700
Update of /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS
In directory www:/tmp/cvs-serv564/apps/windoze/CBuilder5/BibleCS
Modified Files:
mainfrm.cpp mainfrm.dfm mainfrm.h sword.bpr sword.cpp
Added Files:
paraldisp.cpp paraldisp.h
Log Message:
no message
--- NEW FILE: paraldisp.cpp ---
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "biblecsmgr.h"
#include "paraldisp.h"
#include <winbase.h>
#include <unicodertf.h>
using namespace std;
//---------------------------------------------------------------------------
static inline ParallelDisp *ValidCtrCheck()
{
return new ParallelDisp(NULL);
}
//---------------------------------------------------------------------------
__fastcall ParallelDisp::ParallelDisp(TWinControl *Owner)
: SWDispRTFChap(Owner) {
modCount = 3;
}
__fastcall ParallelDisp::~ParallelDisp() {
}
// Display for biblical text
char ParallelDisp::Display(SWModule &Module) {
Display();
}
char ParallelDisp::Display() {
SWModule **mods;
int realModCount = 0;
for (int i = 0; i < modCount; i++) {
ModMap::iterator it = (*mgr)->Modules.find(mod[i].c_str());
if (it != (*mgr)->Modules.end())
realModCount++;
}
// assert we have at least one module to display
if (!realModCount)
return 0; // not an error, just nothing to display
mods = new SWModule *[realModCount];
realModCount = 0;
for (int i = 0; i < modCount; i++) {
ModMap::iterator it = (*mgr)->Modules.find(mod[i].c_str());
if (it != (*mgr)->Modules.end())
mods[realModCount++] = it->second;
}
int testmt, book, chap, verse, versepos;
char buf[254];
System::AnsiString newtext, tmptext, tmptext2;
VerseKey *key = (VerseKey *)(SWKey *)(*mods[0]);
UnicodeRTF uToRTF;
testmt = key->Testament();
chap = key->Chapter();
book = key->Book();
verse = key->Verse();
key->Verse(1);
module = mods[0];
type = "Default";
recalcAppearance();
newtext = RTFHeader;
newtext = newtext + RTFChapterMarkPre + IntToStr(chap) + RTFChapterMarkPost;
newtext = newtext + "\\pard\\f0\\nowidctlpar\\cf7 ";
mods[0]->Error(); // clear error;
string lastEntry = "something the first entry will never be";
while ((key->Book() == book) && (key->Chapter() == chap) && (mods[0]->Error() == 0)) {
if (lastEntry == (string)mods[0]->getRawEntry()) {
(*mods[0])++;
continue;
}
for (int z = 0; z < realModCount; z++) {
newtext = newtext + "{\\par\\pard ";
if (mods[z]->Direction() == DIRECTION_RTL) {
newtext = newtext + "\\qr ";
}
if (mods[z]->Direction() == DIRECTION_RTL && (platformID == VER_PLATFORM_WIN32_NT && (!strnicmp(mods[0]->Lang(), "he", 2) || !strnicmp(mods[0]->Lang(), "ar", 2)))) {
newtext = newtext + "\\rtlpar ";
}
tmptext = "";
lastEntry = mods[z]->getRawEntry();
for (const char *loop = (const char *)(*mods[z]); *loop; loop++) {
if (*loop == '\n') {
tmptext += "\\par ";
}
else tmptext += *loop;
}
if (tmptext.Length() > 3) { // make sure we have an entry
int pvHeading = 0;
do {
sprintf(buf, "%i", pvHeading++);
SWBuf preverseHeading = module->getEntryAttributes()["Heading"]["Preverse"][buf].c_str();
uToRTF.processText(preverseHeading);
if (preverseHeading.length()) {
newtext += ((AnsiString)"\\par\\par {\\i1\\b1 ") + preverseHeading.c_str() + "\\par}";
}
else break;
} while (true);
if (mods[z]->Direction() == DIRECTION_RTL && (platformID == VER_PLATFORM_WIN32_WINDOWS || (mods[z]->Lang() && strnicmp(mods[z]->Lang(), "he", 2) && strnicmp(mods[z]->Lang(), "ar", 2)))) {
newtext = newtext + RTFVersePre;
if ((key->Verse() == verse) && (dispAttribs.markCurrentVerse)) {
newtext = newtext + "\\cf2 "; // \cf2 = second color in color table
}
newtext += tmptext + RTFVersePost;
newtext = newtext + RTFVerseMarkPre + IntToStr(key->Verse()) + RTFVerseMarkPost;
newtext = newtext + "\\par ";
}
else {
newtext = newtext + RTFVerseMarkPre + IntToStr(key->Verse()) + RTFVerseMarkPost;
newtext = newtext + RTFVersePre;
if ((key->Verse() == verse) && (dispAttribs.markCurrentVerse)) {
newtext = newtext + "\\cf2 "; // \cf2 = second color in color table
}
newtext += tmptext + RTFVersePost;
}
}
if (key->Verse() == verse) {
tmptext = newtext + RTFTrailer + "}";
RTFStream->Clear();
RTFStream->WriteBuffer(tmptext.c_str(), tmptext.Length());
RTFStream->Position = 0;
Lines->LoadFromStream(RTFStream);
versepos = GetTextLen() - 3;
}
newtext = newtext + "}";
}
(*mods[0])++;
}
newtext = newtext + RTFTrailer;
key->Verse(1); //{ When setting chapter: if (verse <> new chapter range) don't autonormalize. (we could've just turned the autonormalize option off then back on, but this is cooler) }
key->Chapter(1);
key->Book(1);
key->Testament(testmt);
key->Book(book);
key->Chapter(chap);
key->Verse(verse);
RTFStream->Clear();
RTFStream->WriteBuffer(newtext.c_str(), newtext.Length());
RTFStream->Position = 0;
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;
}
//{ Position control text at current verse }
this->SetFocus();
SelStart = versepos;
SendMessage(Handle, EM_SCROLLCARET, 0, 0);
delete [] mods;
return 0;
}
//---------------------------------------------------------------------------
namespace Paraldisp
{
void __fastcall Register()
{
TComponentClass classes[1] = {__classid(ParallelDisp)};
RegisterComponents("SWORD", classes, 0);
}
}
//---------------------------------------------------------------------------
--- NEW FILE: paraldisp.h ---
/******************************************************************************
* swdisprtfchap.h - definition of class SWDispRTFChap, an SWDisplay used to
* display an entire chapter in Rich Text Format
*
* $Id: paraldisp.h,v 1.1 2003/06/12 02:03:34 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*/
//---------------------------------------------------------------------------
#ifndef PARALDISP_H
#define PARALDISP_H
//---------------------------------------------------------------------------
#include <vcl\SysUtils.hpp>
#include <vcl\Controls.hpp>
#include <vcl\Classes.hpp>
#include <vcl\Forms.hpp>
#include <vcl\ComCtrls.hpp>
#include <vcl\StdCtrls.hpp>
#include <swmgr.h>
#include <swdisprtfchap.h>
#include <string>
using std::string;
//---------------------------------------------------------------------------
class ParallelDisp : public SWDispRTFChap {
protected:
public:
SWMgr **mgr;
int modCount;
string mod[3];
__fastcall ParallelDisp(TWinControl *Owner);
__fastcall ~ParallelDisp();
virtual char Display(SWModule & imodule);
virtual char Display();
};
//---------------------------------------------------------------------------
#endif
Index: mainfrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -C2 -d -r1.116 -r1.117
*** mainfrm.cpp 28 May 2003 07:26:12 -0000 1.116
--- mainfrm.cpp 12 Jun 2003 02:03:34 -0000 1.117
***************
*** 29,32 ****
--- 29,33 ----
#include "rtfhintfrm.h"
#include "newbmfilefrm.h"
+ #include "paraldisp.h"
#include "RangeMaintFrm.h"
#include "PrintFrm.h"
***************
*** 229,232 ****
--- 230,261 ----
return 0;
}
+
+
+ char TForm1::CreateParallelPane(SWMgr **mgr) {
+ TTabSheet *newtab = new TTabSheet(this);
+ parallelDisp = new ParallelDisp(this);
+ char buf[1024];
+ SectionMap::iterator sit;
+
+ newtab->Caption = "PARALLEL";
+ newtab->Hint = "View Parallel Bibles";
+ newtab->ParentShowHint = true;
+ newtab->PageControl = TextPageControl;
+ parallelDisp->Parent = newtab;
+ parallelDisp->Align = alClient;
+ parallelDisp->ScrollBars = ssVertical;
+ parallelDisp->ReadOnly = true;
+ parallelDisp->PopupMenu = PopupMenu5;
+ parallelDisp->OnMouseDown = RTFMouseDown;
+ parallelDisp->OnURLClick = RTFURLClick;
+ parallelDisp->Name = "ParallelRTF";
+
+ parallelDisp->mgr = mgr;
+ parallelDisp->recalcAppearance();
+
+ return 0;
+ }
+
+
//---------------------------------------------------------------------------
char TForm1::CreateCommentPane(SWModule *mod) {
***************
*** 1013,1016 ****
--- 1042,1046 ----
// Load devotion and show form
+ CreateParallelPane((SWMgr **)&mainmgr);
for (it = mainmgr->Modules.begin(); it != mainmgr->Modules.end(); it++) {
bool devotional = false;
***************
*** 1626,1629 ****
--- 1656,1661 ----
else if (menu == PopupMenu3)
staticMenuItemsCount = 7;
+ else if (menu == PopupMenu5)
+ staticMenuItemsCount = 7;
while (menu->Items->Count > staticMenuItemsCount)
***************
*** 2676,2678 ****
--- 2708,2758 ----
}
//---------------------------------------------------------------------------
+
+ void __fastcall TForm1::PopupMenu5Popup(TObject *Sender)
+ {
+ int menuCount = 3;
+ TMenuItem *newitem;
+
+ TMenuItem **menus = new TMenuItem *[menuCount];
+ TMenu *menu = PopupMenu5;
+
+ while (menu->Items->Count > 4)
+ menu->Items->Delete(4);
+
+ for (int i = 0; i < menuCount; i++) {
+ menus[i] = new TMenuItem(menu);
+ menus[i]->Caption = "Bible " + IntToStr(i+1);
+ menu->Items->Add(menus[i]);
+ }
+
+ for (ModMap::iterator it = mainmgr->Modules.begin(); it != mainmgr->Modules.end(); it++) {
+ if (!strcmp(it->second->Type(), "Biblical Texts")) {
+ for (int i = 0; i < menuCount; i++) {
+ newitem = new TMenuItem(menu);
+ newitem->Caption = it->second->Name();
+ newitem->Hint = it->second->Description();
+ newitem->OnClick = ParallelMenuItemClick;
+ menus[i]->Add(newitem);
+ }
+ }
+ }
+ delete [] menus;
+ PopupMenuPopup(Sender);
+ }
+ //---------------------------------------------------------------------------
+ void __fastcall TForm1::ParallelMenuItemClick(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];
+ }
+ value[k] = 0;
+ int bno = atoi((menuchoice->Parent->Caption.c_str()+menuchoice->Parent->Caption.Length()-2));
+ parallelDisp->mod[bno] = value;
+ parallelDisp->Display();
+ }
Index: mainfrm.dfm
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/mainfrm.dfm,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** mainfrm.dfm 26 Mar 2003 22:07:12 -0000 1.41
--- mainfrm.dfm 12 Jun 2003 02:03:34 -0000 1.42
***************
*** 143,147 ****
Top = 246
Width = 627
! Height = 165
Align = alClient
BevelOuter = bvNone
--- 143,147 ----
Top = 246
Width = 627
! Height = 168
Align = alClient
BevelOuter = bvNone
***************
*** 154,158 ****
Top = 0
Width = 5
! Height = 165
Cursor = crHSplit
Align = alRight
--- 154,158 ----
Top = 0
Width = 5
! Height = 168
Cursor = crHSplit
Align = alRight
***************
*** 162,166 ****
Top = 0
Width = 437
! Height = 165
Hint = 'Lexicons / Dictionaries'
Align = alClient
--- 162,166 ----
Top = 0
Width = 437
! Height = 168
Hint = 'Lexicons / Dictionaries'
Align = alClient
***************
*** 182,186 ****
Top = 0
Width = 185
! Height = 165
Align = alRight
Caption = 'Panel2'
--- 182,186 ----
Top = 0
Width = 185
! Height = 168
Align = alRight
Caption = 'Panel2'
***************
*** 210,214 ****
Top = 25
Width = 183
! Height = 139
Align = alClient
ItemHeight = 13
--- 210,214 ----
Top = 25
Width = 183
! Height = 142
Align = alClient
ItemHeight = 13
***************
*** 220,224 ****
object StatusBar1: TStatusBar
Left = 0
! Top = 411
Width = 627
Height = 15
--- 220,224 ----
object StatusBar1: TStatusBar
Left = 0
! Top = 414
Width = 627
Height = 15
***************
*** 787,790 ****
--- 787,810 ----
ShortCut = 16471
OnExecute = Action1Execute
+ end
+ end
+ object PopupMenu5: TPopupMenu
+ OnPopup = PopupMenu5Popup
+ Left = 333
+ Top = 246
+ object MenuItem2: TMenuItem
+ Caption = '&Copy'
+ OnClick = Copy1Click
+ end
+ object MenuItem3: TMenuItem
+ Caption = 'Dictionary Lookup'
+ OnClick = DictionaryLookup1Click
+ end
+ object MenuItem4: TMenuItem
+ Caption = 'Search For Word'
+ OnClick = SearchForWord1Click
+ end
+ object N4: TMenuItem
+ Caption = '-'
end
end
Index: mainfrm.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/mainfrm.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** mainfrm.h 26 Mar 2003 22:07:12 -0000 1.44
--- mainfrm.h 12 Jun 2003 02:03:34 -0000 1.45
***************
*** 16,19 ****
--- 16,20 ----
#include <swgenbook.h>
#include "swdisprtfchap.h"
+ #include "paraldisp.h"
#include <AppEvnts.hpp>
#include <Buttons.hpp>
***************
*** 277,280 ****
--- 278,286 ----
TComboBox *cbBook;
TComboBox *freeHandLookup;
+ TPopupMenu *PopupMenu5;
+ TMenuItem *MenuItem2;
+ TMenuItem *MenuItem3;
+ TMenuItem *MenuItem4;
+ TMenuItem *N4;
void __fastcall TextPageControlChange(TObject *Sender);
void __fastcall btnLookupClick(TObject *Sender);
***************
*** 310,313 ****
--- 316,320 ----
void __fastcall AddBookmark1Click(TObject *Sender);
void __fastcall BookmarkItemClick(TObject *Sender);
+ void __fastcall ParallelMenuItemClick(TObject *Sender);
void __fastcall BookmarkbtnClick(TObject *Sender);
void __fastcall EditBookmarks1Click(TObject *Sender);
***************
*** 351,354 ****
--- 358,362 ----
void __fastcall Action1Execute(TObject *Sender);
void __fastcall NewVer1Click(TObject *Sender);
+ void __fastcall PopupMenu5Popup(TObject *Sender);
private: // User declarations
list <SWDisplay *> displays; // so we can delete each display we create
***************
*** 359,363 ****
--- 367,374 ----
String clickText;
+ ParallelDisp *parallelDisp;
+
char CreateTextPane(SWModule *mod);
+ char CreateParallelPane(SWMgr **mgr);
char CreateCommentPane(SWModule *mod);
char CreateLDPane(SWModule *mod);
Index: sword.bpr
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/sword.bpr,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -d -r1.111 -r1.112
*** sword.bpr 28 May 2003 07:26:12 -0000 1.111
--- sword.bpr 12 Jun 2003 02:03:34 -0000 1.112
***************
*** 17,21 ****
TntUnicodeControls\TntControls.obj TntUnicodeControls\TntForms.obj
TntUnicodeControls\TntStdCtrls.obj TntUnicodeControls\TntClasses.obj
! obj\swwinlog.obj"/>
<RESFILES value="sword.res"/>
<IDLFILES value=""/>
--- 17,21 ----
TntUnicodeControls\TntControls.obj TntUnicodeControls\TntForms.obj
TntUnicodeControls\TntStdCtrls.obj TntUnicodeControls\TntClasses.obj
! obj\swwinlog.obj obj\paraldisp.obj"/>
<RESFILES value="sword.res"/>
<IDLFILES value=""/>
***************
*** 46,50 ****
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
! <USERDEFINES value="_ICU_;_ICUSWORD_;USBINARY"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="sword.cpp"/>
--- 46,50 ----
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
! <USERDEFINES value="_ICU_;_ICUSWORD_;USBINARY;_DEBUG"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="sword.cpp"/>
***************
*** 58,66 ****
-I..\..\..\..\..\icu-sword\source\i18n -I..\..\..\..\include
-I$(BCB)\include -I$(BCB)\include\vcl -Irxlib -src_suffix cpp -D_ICU_"/>
! <CFLAG1 value="-O2 -Vx -Ve -RT- -X- -a8 -4 -b- -k- -vi -c -tW -tWM"/>
! <PFLAGS value="-N2obj -N0obj -$Y- -$L- -$D- -v -M -JPHNE"/>
<RFLAGS value=""/>
! <AFLAGS value="/mx /w2 /zn"/>
! <LFLAGS value="-Iobj -D"" -aa -Tpe -GD -s -Gn"/>
</OPTIONS>
<LINKER>
--- 58,66 ----
-I..\..\..\..\..\icu-sword\source\i18n -I..\..\..\..\include
-I$(BCB)\include -I$(BCB)\include\vcl -Irxlib -src_suffix cpp -D_ICU_"/>
! <CFLAG1 value="-Od -Vx -Ve -RT- -X- -r- -a8 -4 -b- -k -y -v -vi- -c -tW -tWM"/>
! <PFLAGS value="-N2obj -N0obj -$Y+ -$W -$O- -v -M -JPHNE"/>
<RFLAGS value=""/>
! <AFLAGS value="/mx /w2 /zi"/>
! <LFLAGS value="-Iobj -D"" -aa -Tpe -GD -s -Gn -v"/>
</OPTIONS>
<LINKER>
***************
*** 76,80 ****
MinorVer=5
Release=5
! Build=30
Debug=0
PreRelease=0
--- 76,80 ----
MinorVer=5
Release=5
! Build=31
Debug=0
PreRelease=0
***************
*** 88,92 ****
CompanyName=CrossWire Software & Bible Society
FileDescription=Windows 32bit User Interface to The SWORD Project
! FileVersion=1.5.5.30
InternalName=biblecs
LegalCopyright=(c) 2002 CrossWire Bible Society under the terms of the GNU General Public License
--- 88,92 ----
CompanyName=CrossWire Software & Bible Society
FileDescription=Windows 32bit User Interface to The SWORD Project
! FileVersion=1.5.5.31
InternalName=biblecs
LegalCopyright=(c) 2002 CrossWire Bible Society under the terms of the GNU General Public License
***************
*** 133,138 ****
[HistoryLists\hlConditionals]
Count=8
! Item0=_ICU_;_ICUSWORD_;USBINARY
! Item1=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
Item2=_ICU_;_ICUSWORD_;_DEBUG;USBINARY
Item3=_ICU_;_ICUSWORD_;_DEBUG
--- 133,138 ----
[HistoryLists\hlConditionals]
Count=8
! Item0=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
! Item1=_ICU_;_ICUSWORD_;USBINARY
Item2=_ICU_;_ICUSWORD_;_DEBUG;USBINARY
Item3=_ICU_;_ICUSWORD_;_DEBUG
Index: sword.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/sword.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** sword.cpp 26 Jan 2003 12:07:18 -0000 1.42
--- sword.cpp 12 Jun 2003 02:03:34 -0000 1.43
***************
*** 52,57 ****
USELIB("..\..\..\..\lib\libsword.lib");
USEUNIT("..\..\swwinlog.cpp");
//---------------------------------------------------------------------------
-
AnsiString startVerse = "";
--- 52,57 ----
USELIB("..\..\..\..\lib\libsword.lib");
USEUNIT("..\..\swwinlog.cpp");
+ USEUNIT("paraldisp.cpp");
//---------------------------------------------------------------------------
AnsiString startVerse = "";