[sword-devel] Here's a quick sample of a BCB6 front-end I'm developing
for personal research using CLX
Jonathan Mickelson
sword-devel@crosswire.org
Fri, 09 Apr 2004 11:06:26 -0400
This is a multi-part message in MIME format.
--------------020804040800080506030703
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
here's a follow up (this produces the screenshot - without the splash
screen)
I created a CLX project as described previously. I changed the TMemo
field to a TTextBrowser field and named it "BrwsrBible".
I downloaded some new hebrew fonts (see
http://www.mechon-mamre.org/c/c.htm ).
I used the Ezra SIL fonts (2.0) and CODE2000. These have to be
installed into your font directory (instructions are at the link).
- And these are my changes to the previous code (yes, I you to get your
hands dirty in my tutorial project - best way to learn Sword API )
// These are my Globals (gasp, choke) used only to keep the simple
example all in one source file.
SWConfig *userPrefs;
SWMgr *mainmgr;
SWConfig *optionsconf;
SWFilter *bidireorder;
SWFilter *precompose;
// I added this Global routine (Guys, I'm being friendly to some of the
old 'C' programmers out there [yeah, like me])
WideString MyAddLine(SWModule *MyMod, char *Font)
{
WideString MyText;
MyText="<tr>";
MyText+="<td>";
if (!strnicmp(MyMod->Lang(), "he", 2))
{
if (!Font)
Font="CODE2000";
MyText+="<font face=\"";
MyText+=Font;
MyText+="\" size=\"6\">";
}
MyText+=(const char *)*MyMod;
if (!strnicmp(MyMod->Lang(), "he", 2))
{
MyText+="</font>";
}
MyText+="</td>";
MyText+="<td>";
MyText+=MyMod->Name();
MyText+=":";
MyText+=MyMod->Lang();
MyText+=":";
MyText+=MyMod->Description();
MyText+=":";
MyText+=(const char *)MyMod->getConfigEntry("Font");
MyText+="</td>";
MyText+="</tr>";
return MyText;
}
// And this is my new FormShow - these hebrew fonts work best if you
download
void __fastcall TForm1::FormShow(TObject *Sender)
{
ModMap::iterator it;
SWModule *MyMod;
bidireorder = new UTF8BiDiReorder();
precompose = new UTF8NFC();
optionsconf = new SWConfig("./options.conf");
try
{
mainmgr = new SWMgr(0, 0, false, new
MarkupFilterMgr(FMT_HTMLHREF, ENC_HTML));
userPrefs = 0;
mainmgr->Load();
userPrefs = new SWConfig("./userprefs.conf");
if ((mainmgr->config) && (userPrefs))
(*(mainmgr->config)) += (*userPrefs);
}
catch (...)
{
Application->Terminate();
}
if (!mainmgr->config)
Application->Terminate();
BrwsrBible->Text="Test";
WideString MyText, Tmp;
MyText="";
MyText+="Gen 1:12<br>";
MyText+="<table border=1>";
for (it = mainmgr->Modules.begin(); it != mainmgr->Modules.end(); it++)
{
MyMod = (*it).second;
MyMod->SetKey("Gen 1:12");
if (!strnicmp(MyMod->Lang(), "he", 2) &&
(!strcmp((*it).second->Type(), "Biblical Texts")))
{
if (MyMod->Direction() == DIRECTION_RTL)
{
MyMod->AddRenderFilter(bidireorder);
}
MyText+=MyAddLine(MyMod, "Ezra SIL SR");
}
else if ((!strcmp((*it).second->Type(), "Biblical Texts")))
{
MyText+=MyAddLine(MyMod, 0);
}
}
MyText+="</table>";
BrwsrBible->Text=MyText;
}
--------------020804040800080506030703
Content-Type: multipart/related;
boundary="------------080607000907010108020103"
--------------080607000907010108020103
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body>
here's a follow up (this produces the screenshot - without the splash
screen)
<br>
<br>
I created a CLX project as described previously. I changed the TMemo
field to a TTextBrowser field and named it "BrwsrBible".<br>
I downloaded some new hebrew fonts (see <a
class="moz-txt-link-freetext"
href="http://www.mechon-mamre.org/c/c.htm">http://www.mechon-mamre.org/c/c.htm</a>
).
<br>
I used the Ezra SIL fonts (2.0) and CODE2000. These have to be
installed into your font directory (instructions are at the link).
<br>
<br>
- And these are my changes to the previous code (yes, I you to get your
hands dirty in my tutorial project - best way to learn Sword API <img
src="cid:part1.09050803.07050301@jkmickelson.com" alt=":)"
class="moz-txt-smily" height="19" width="19" align="middle"> )
<br>
<br>
// These are my Globals (gasp, choke) used only to keep the simple
example all in one source file.
<br>
<br>
SWConfig *userPrefs;
<br>
SWMgr *mainmgr;
<br>
SWConfig *optionsconf;
<br>
SWFilter *bidireorder;
<br>
SWFilter *precompose;
<br>
<br>
// I added this Global routine (Guys, I'm being friendly to some of the
old 'C' programmers out there [yeah, like me])
<br>
<br>
WideString MyAddLine(SWModule *MyMod, char *Font)
<br>
{
<br>
WideString MyText;
<br>
MyText="<tr>";
<br>
MyText+="<td>";
<br>
if (!strnicmp(MyMod->Lang(), "he", 2))
<br>
{
<br>
if (!Font)
<br>
Font="CODE2000";
<br>
MyText+="<font face=\"";
<br>
MyText+=Font;
<br>
MyText+="\" size=\"6\">";
<br>
}
<br>
MyText+=(const char *)*MyMod;
<br>
if (!strnicmp(MyMod->Lang(), "he", 2))
<br>
{
<br>
MyText+="</font>";
<br>
}
<br>
MyText+="</td>";
<br>
MyText+="<td>";
<br>
MyText+=MyMod->Name();
<br>
MyText+=":";
<br>
MyText+=MyMod->Lang();
<br>
MyText+=":";
<br>
MyText+=MyMod->Description();
<br>
MyText+=":";
<br>
MyText+=(const char *)MyMod->getConfigEntry("Font");
<br>
MyText+="</td>";
<br>
MyText+="</tr>";
<br>
return MyText;
<br>
}
<br>
<br>
<br>
// And this is my new FormShow - these hebrew fonts work best if you
download
<br>
void __fastcall TForm1::FormShow(TObject *Sender)
<br>
{
<br>
ModMap::iterator it;
<br>
SWModule *MyMod;
<br>
bidireorder = new UTF8BiDiReorder();
<br>
precompose = new UTF8NFC();
<br>
<br>
optionsconf = new SWConfig("./options.conf");
<br>
<br>
try
<br>
{
<br>
mainmgr = new SWMgr(0, 0, false, new
MarkupFilterMgr(FMT_HTMLHREF, ENC_HTML));
<br>
userPrefs = 0;
<br>
mainmgr->Load();
<br>
<br>
userPrefs = new SWConfig("./userprefs.conf");
<br>
if ((mainmgr->config) && (userPrefs))
<br>
(*(mainmgr->config)) += (*userPrefs);
<br>
}
<br>
catch (...)
<br>
{
<br>
Application->Terminate();
<br>
}
<br>
<br>
if (!mainmgr->config)
<br>
Application->Terminate();
<br>
<br>
BrwsrBible->Text="Test";
<br>
WideString MyText, Tmp;
<br>
MyText="";
<br>
<br>
MyText+="Gen 1:12<br>";
<br>
MyText+="<table border=1>";
<br>
<br>
for (it = mainmgr->Modules.begin(); it !=
mainmgr->Modules.end(); it++)
<br>
{
<br>
MyMod = (*it).second;
<br>
MyMod->SetKey("Gen 1:12");
<br>
<br>
if (!strnicmp(MyMod->Lang(), "he", 2) &&
(!strcmp((*it).second->Type(), "Biblical Texts")))
<br>
{
<br>
if (MyMod->Direction() == DIRECTION_RTL)
<br>
{
<br>
MyMod->AddRenderFilter(bidireorder);
<br>
}
<br>
<br>
MyText+=MyAddLine(MyMod, "Ezra SIL SR");
<br>
}
<br>
else if ((!strcmp((*it).second->Type(), "Biblical Texts")))
<br>
{
<br>
MyText+=MyAddLine(MyMod, 0);
<br>
}
<br>
<br>
}
<br>
<br>
MyText+="</table>";
<br>
BrwsrBible->Text=MyText;
<br>
}
<br>
<br>
</body>
</html>
--------------080607000907010108020103
Content-Type: image/gif;
name="smile_n.gif"
Content-Transfer-Encoding: base64
Content-ID: <part1.09050803.07050301@jkmickelson.com>
Content-Disposition: inline;
filename="smile_n.gif"
R0lGODlhEwATAKIAAP//AMzMAGZmAP8zAAAAAP///wAAAAAAACH5BAEAAAUALAAAAAATABMA
AANVWLrUTisyEoC1oUlFr8dQRHykFRad+Y0gdzlv86KVKdsskOUAjHu312rFK5GCRWDMJDAC
BKxGrTcFXTIo4CPY41QJgzAP69IWT14nWSL97DaiLVqRAAA7
--------------080607000907010108020103--
--------------020804040800080506030703--