[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.&nbsp; 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.&nbsp; 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>
&nbsp;&nbsp; WideString MyText;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText="&lt;tr&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;td&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!strnicmp(MyMod-&gt;Lang(), "he", 2))
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!Font)
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Font="CODE2000";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;font face=\"";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=Font;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="\" size=\"6\"&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=(const char *)*MyMod;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!strnicmp(MyMod-&gt;Lang(), "he", 2))
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;/font&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;/td&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;td&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=MyMod-&gt;Name();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=":";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=MyMod-&gt;Lang();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=":";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=MyMod-&gt;Description();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=":";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=(const char *)MyMod-&gt;getConfigEntry("Font");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;/td&gt;";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+="&lt;/tr&gt;";
<br>
&nbsp;&nbsp; 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>
&nbsp;&nbsp; ModMap::iterator it;
<br>
&nbsp;&nbsp; SWModule *MyMod;
<br>
&nbsp;&nbsp; bidireorder = new UTF8BiDiReorder();
<br>
&nbsp;&nbsp; precompose =&nbsp; new UTF8NFC();
<br>
<br>
&nbsp;&nbsp; optionsconf = new SWConfig("./options.conf");
<br>
<br>
&nbsp;&nbsp; try
<br>
&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mainmgr = new SWMgr(0, 0, false, new
MarkupFilterMgr(FMT_HTMLHREF, ENC_HTML));
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; userPrefs = 0;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mainmgr-&gt;Load();
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; userPrefs = new SWConfig("./userprefs.conf");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((mainmgr-&gt;config) &amp;&amp; (userPrefs))
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*(mainmgr-&gt;config)) += (*userPrefs);
<br>
&nbsp;&nbsp; }
<br>
&nbsp;&nbsp; catch (...)
<br>
&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Application-&gt;Terminate();
<br>
&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp; if (!mainmgr-&gt;config)
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Application-&gt;Terminate();
<br>
<br>
&nbsp;&nbsp; BrwsrBible-&gt;Text="Test";
<br>
&nbsp;&nbsp; WideString MyText, Tmp;
<br>
&nbsp;&nbsp; MyText="";
<br>
<br>
&nbsp;&nbsp; MyText+="Gen 1:12&lt;br&gt;";
<br>
&nbsp;&nbsp; MyText+="&lt;table border=1&gt;";
<br>
<br>
&nbsp;&nbsp; for (it = mainmgr-&gt;Modules.begin(); it !=
mainmgr-&gt;Modules.end(); it++)
<br>
&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyMod = (*it).second;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyMod-&gt;SetKey("Gen 1:12");
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!strnicmp(MyMod-&gt;Lang(), "he", 2) &amp;&amp;
(!strcmp((*it).second-&gt;Type(), "Biblical Texts")))
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (MyMod-&gt;Direction() == DIRECTION_RTL)
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyMod-&gt;AddRenderFilter(bidireorder);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=MyAddLine(MyMod, "Ezra SIL SR");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ((!strcmp((*it).second-&gt;Type(), "Biblical Texts")))
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyText+=MyAddLine(MyMod, 0);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp; MyText+="&lt;/table&gt;";
<br>
&nbsp;&nbsp; BrwsrBible-&gt;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--