[sword-cvs] sword/apps/windoze/CBuilder5/BibleCS mainfrm.cpp,1.108,1.109 optionfrm.cpp,1.32,1.33 PrintFrm.cpp,1.10,1.11 PrintFrm.h,1.4,1.5 RxRichEditX.cpp,1.39,1.40 RxRichEditX.h,1.13,1.14

sword@www.crosswire.org sword@www.crosswire.org
Mon, 27 Jan 2003 16:12:41 -0700


Update of /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS
In directory www:/tmp/cvs-serv24546

Modified Files:
	mainfrm.cpp optionfrm.cpp PrintFrm.cpp PrintFrm.h 
	RxRichEditX.cpp RxRichEditX.h 
Log Message:
Made some changes to my printing stuff to be more consistent with how Troy has RxRichEditX setup. More to come but all old functionality is preserved. There are no new features.

Index: mainfrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/mainfrm.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -C2 -d -r1.108 -r1.109
*** mainfrm.cpp	27 Jan 2003 09:23:06 -0000	1.108
--- mainfrm.cpp	27 Jan 2003 23:12:39 -0000	1.109
***************
*** 2067,2070 ****
--- 2067,2071 ----
  
  	locale = optionsconf->Sections["Appearance"].getWithDefault("locale", "en_us");
+ 	/* TODO 5 -oDavid -cLocale : Just a note: Something weird happens here when there are no .conf files and it crashes. This is since Daniel added the TNT stuff. Maybe should look more into this later */
  	i12ize(locale.c_str());
  

Index: optionfrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/optionfrm.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** optionfrm.cpp	27 Jan 2003 09:23:06 -0000	1.32
--- optionfrm.cpp	27 Jan 2003 23:12:39 -0000	1.33
***************
*** 45,49 ****
  //---------------------------------------------------------------------------
  
! //DONE -oDavid 1 -cOptions: add per module font size selection
  //DONE 1 -cOptions: add 'general' dictionary besides strongs for lookups of words
  //TODO 1 -cOptions: add Individual Modules per module 'general' dictionary selection and support so different dictionaries can be chosen for, say: Chinese and KJV and Thai, etc.
--- 45,49 ----
  //---------------------------------------------------------------------------
  
! //DONE 1 -oDavid -cOptions: add per module font size selection
  //DONE 1 -cOptions: add 'general' dictionary besides strongs for lookups of words
  //TODO 1 -cOptions: add Individual Modules per module 'general' dictionary selection and support so different dictionaries can be chosen for, say: Chinese and KJV and Thai, etc.

Index: PrintFrm.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/PrintFrm.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** PrintFrm.cpp	27 Aug 2002 22:52:36 -0000	1.10
--- PrintFrm.cpp	27 Jan 2003 23:12:39 -0000	1.11
***************
*** 192,195 ****
--- 192,196 ----
  void __fastcall TPrintForm::btnPrintClick(TObject *Sender)
  {
+ 	SavePrintPrefs();
  	if(cmbModule->Text.data() != NULL && editStart->Text.data() != NULL){
  		PrepareRTF();
***************
*** 343,356 ****
  }
  //---------------------------------------------------------------------------
- void __fastcall TPrintForm::BitBtn5Click(TObject *Sender)
- {
- 		//To do
- }
- //---------------------------------------------------------------------------
  
  void TPrintForm::PrepareRTF()
  {
      BibleCSMGR* manager = Form1->mainmgr;
!     RTF_FORMAT format;
      AnsiString newtext = "";
      AnsiString moduleName = cmbModule->Text.SubString(2,cmbModule->Text.Pos("]") - 2);
--- 344,352 ----
  }
  //---------------------------------------------------------------------------
  
  void TPrintForm::PrepareRTF()
  {
      BibleCSMGR* manager = Form1->mainmgr;
!     //RTF_FORMAT format;
      AnsiString newtext = "";
      AnsiString moduleName = cmbModule->Text.SubString(2,cmbModule->Text.Pos("]") - 2);
***************
*** 358,362 ****
      ListKey lstKey;
      StrKey testKey;
! 
      format.bkFontHeadSize = 2 * editHeading->Text.ToInt();
      format.bodyFontSize = 2 * editBody->Text.ToInt();
--- 354,359 ----
      ListKey lstKey;
      StrKey testKey;
!     SavePrintPrefs();
!     /*
      format.bkFontHeadSize = 2 * editHeading->Text.ToInt();
      format.bodyFontSize = 2 * editBody->Text.ToInt();
***************
*** 371,388 ****
      format.prVerseNum = ckVSNum->Checked;
      format.superVSNum = ckSuperVS->Checked;
  
      lstKey.Persist(1);
      if(!radLD->Checked){
!    		lstKey = VerseKey().ParseVerseList(editStart->Text.c_str(),*(Form1->DefaultVSKey), true);
! 	   module->setKey(&lstKey);
! 	    rtfPrint->RenderModule(module, format);
! 	module->setKey(Form1->DefaultVSKey);
      }
      else{
!     	testKey.setText(WideStringToUTF8(editStart->Text).c_str());
!         lstKey << testKey;
! 	   module->setKey(&lstKey);
!     	rtfPrint->RenderModule(module, format);
! 	    module->setKey(Form1->DefaultStrKey);
      }
  }
--- 368,388 ----
      format.prVerseNum = ckVSNum->Checked;
      format.superVSNum = ckSuperVS->Checked;
+     */
  
      lstKey.Persist(1);
      if(!radLD->Checked){
! 		lstKey = VerseKey().ParseVerseList(editStart->Text.c_str(),*(Form1->DefaultVSKey), true);
! 		module->setKey(&lstKey);
! 		rtfPrint->type = "PrintedPage";
! 		rtfPrint->RenderModule(module);
! 		module->setKey(Form1->DefaultVSKey);
      }
      else{
! 		testKey.setText(WideStringToUTF8(editStart->Text).c_str());
! 		lstKey << testKey;
! 		module->setKey(&lstKey);
! 		rtfPrint->type = "PrintedPage";
! 		rtfPrint->RenderModule(module);
! 		module->setKey(Form1->DefaultStrKey);
      }
  }
***************
*** 390,393 ****
--- 390,394 ----
  void __fastcall TPrintForm::btnPreviewClick(TObject *Sender)
  {
+      SavePrintPrefs();
  	if(cmbModule->Text.data() != NULL && editStart->Text.data() != NULL){
  		PrepareRTF();
***************
*** 444,447 ****
--- 445,479 ----
  	}
  	 
+ }
+ 
+  /* TODO -oDavid -cPrinting : Find a good place to call this */
+ void TPrintForm::SavePrintPrefs()
+ {
+ 	ConfigEntMap emap;
+ 	SWConfig* config = Form1->optionsconf;
+ 	string type;
+ 	if(radText->Checked){
+ 		type = "Text";
+ 	}else if(radComm->Checked){
+ 		type = "Comment";
+ 	}else if(radLD->Checked){
+ 		type = "LD";
+ 	}
+ 
+ 	emap = config->Sections["PrintedPage"];
+ 	emap[(type + "BkName")]		= IntToStr((ckBookHead->Checked)?1:0).c_str();
+ 	emap[type + "ChHead"]		= IntToStr((ckChHead->Checked)?1:0).c_str();
+ 	emap[type + "Paragraph"]		= IntToStr((ckParagraph->Checked)?1:0).c_str();
+ 	emap[type + "VSNum"]		= IntToStr((ckVSNum->Checked)?1:0).c_str();
+ 	emap[type + "SuperVS"]		= IntToStr((ckSuperVS->Checked)?1:0).c_str();
+ 	emap[type + "PreFixTag"]		= IntToStr((ckPrefix->Checked)?1:0).c_str();
+ 	emap[type + "PostFixTag"]	= IntToStr((ckPostfix->Checked)?1:0).c_str();
+ 
+ 	emap[type + "ChHeadSize"]	= editHeading->Text.c_str();
+ 	emap[type + "FontSize"]		= editBody->Text.c_str();
+ 	emap[type + "VSNumSize"]		= editNumbers->Text.c_str();
+ 	emap[type + "FontName"]		= cmbFont->Text.c_str();
+ 	config->Sections["PrintedPage"] = emap;
+ 	config->Save();
  }
  

Index: PrintFrm.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/PrintFrm.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PrintFrm.h	27 Aug 2002 22:52:36 -0000	1.4
--- PrintFrm.h	27 Jan 2003 23:12:39 -0000	1.5
***************
*** 97,106 ****
     	void __fastcall OnPrint(TRxRichEdit* rtfPrint);
  	void __fastcall btnSetupClick(TObject *Sender);
- 	void __fastcall BitBtn5Click(TObject *Sender);
  	void __fastcall btnPreviewClick(TObject *Sender);
  	void __fastcall ckHeaderClick(TObject *Sender);
  	void __fastcall ckFooterClick(TObject *Sender);
  	void __fastcall ckVSNumClick(TObject *Sender);
! private:	// User declarations
  public:		// User declarations
  	TFontComboBox *cmbFont;
--- 97,106 ----
     	void __fastcall OnPrint(TRxRichEdit* rtfPrint);
  	void __fastcall btnSetupClick(TObject *Sender);
  	void __fastcall btnPreviewClick(TObject *Sender);
  	void __fastcall ckHeaderClick(TObject *Sender);
  	void __fastcall ckFooterClick(TObject *Sender);
  	void __fastcall ckVSNumClick(TObject *Sender);
! private:
! 	void SavePrintPrefs();	// User declarations
  public:		// User declarations
  	TFontComboBox *cmbFont;

Index: RxRichEditX.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/RxRichEditX.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** RxRichEditX.cpp	27 Jan 2003 09:23:06 -0000	1.39
--- RxRichEditX.cpp	27 Jan 2003 23:12:39 -0000	1.40
***************
*** 5,8 ****
--- 5,9 ----
  
  #include "RxRichEditX.h"
+ #include "PrintFrm.h"
  #include <clipbrd.hpp>
  #include <swdisprtf.h>
***************
*** 28,237 ****
  }
  
! void TRxRichEditX::RenderModule(SWModule* module, RTF_FORMAT format)
! {
! 	format_ops = format;
! 
!     TMemoryStream* RTFStream = new TMemoryStream();
!     AnsiString rtfText = "{\\rtf1\\ansi{\\fonttbl{\\f0\\fdecor\\fprq2 ";
!     rtfText += format_ops.fontFace;
!     rtfText += ";}}{\\colortbl;\\red0\\green0\\blue0;}";
!     rtfText += "{\\fs8\\cf1\\par\\pard} ";
! 
!     //if(!strcmp(module->Type(), "Biblical Texts"))
! 	    rtfText += GetFormattedBible(module);
!     /*
!     else if(!strcmp(module->Type(), "Commentaries"))
!     	rtfText += GetFormattedComm(module);
!     else if(!strcmp(module->Type(), "Lexicons / Dictionaries"))
! 	rtfText += GetFormattedLD(module);
!     else
! 	rtfText += GetFormattedBook(module);
!     */
!     rtfText += "{ \\par }}";
!     RTFStream->Clear();
!     RTFStream->WriteBuffer(rtfText.c_str(), rtfText.Length());
!     RTFStream->Position = 0;
!     Lines->LoadFromStream(RTFStream);
!     delete RTFStream;
! 
! 	// clear HTML link tags
!         /*
! 	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;
! 	}
!         */
! 		SelLength = 0;
! }
! 
! AnsiString TRxRichEditX::GetFormattedBible(SWModule* module)
  {
!     AnsiString rtfText = "";
! 	VerseKey key;
!     int lastChap, lastBook;
!     AnsiString bookName;
! 
!     key = (VerseKey)module->Key();
!     lastChap = key.Chapter();
!     lastBook = key.Book();
!     bookName = (AnsiString)key.getText();
!     bookName = bookName.SubString(0,bookName.Pos(lastChap) - 2);
! 
!     if(format_ops.prBookHeadings)
!     	rtfText += BookHeading(module, bookName);
! 
!     if(format_ops.prChHeadings)
! 	    rtfText += ChapterHeading(module, lastChap);
! 
! 	for ((*module) = TOP; !module->Error(); (*module)++){
! 	key = (VerseKey)module->Key();
!         if(key.Book() != lastBook){
! 	        rtfText += "\\par\\par";
! 	        bookName = (AnsiString)key.getText();
!             bookName = bookName.SubString(0,bookName.Pos(key.Chapter()) - 2);
!     	    if(format_ops.prBookHeadings)
! 	    		rtfText += BookHeading(module, bookName);
! 		  lastBook = key.Book();
!             lastChap = -1; // Reset the last Chapter since we could jump from Jude 1 to Revelation 1
!         }
!         if(key.Chapter() != lastChap){
!         	rtfText += "\\par";
!             if(format_ops.prChHeadings)
! 	            rtfText += ChapterHeading(module, key.Chapter());
!             lastChap = key.Chapter();
!         }
!         rtfText += PrintEntry(module, key.Verse());
!     }
! 
!     return rtfText;
  }
- /*
- AnsiString TRxRichEditX::GetFormattedComm(SWModule* module)
- {
-     AnsiString rtfText = "";
- 	VerseKey key;
-     int lastChap;
-     AnsiString lastBook;
  
-     key = (VerseKey)module->Key();
-     lastChap = key.Chapter();
-     lastBook = (AnsiString)key.Book();
- 
-     if(format_ops.prBookHeadings)
-     	rtfText += BookHeading(module, lastBook);
- 
-     if(format_ops.prChHeadings)
- 	    rtfText += ChapterHeading(module, lastChap);
- 
- 	for ((*module) = TOP; !module->Error(); (*module)++){
-     	key = (VerseKey)module->Key();
-         if((AnsiString)key.Book() == lastBook){
-     	    if(format_ops.prBookHeadings)
- 	    		rtfText += BookHeading(module, lastBook);
-             lastBook = key.Book();
-         }
-         if(key.Chapter() != lastChap){
-         	rtfText += "\\par\\par";
-             if(format_ops.prChHeadings)
- 	            rtfText += ChapterHeading(module, key.Chapter());
-             lastChap = key.Chapter();
-         }
-         rtfText += PrintEntry(module, key.Verse());
-     }
  
-     return rtfText;
- }
  
! AnsiString TRxRichEditX::GetFormattedLD(SWModule* module)
  {
!     AnsiString rtfText = "";
  	VerseKey key;
!     int lastChap;
!     AnsiString lastBook;
  
!     key = (VerseKey)module->Key();
!     lastChap = key.Chapter();
!     lastBook = (AnsiString)key.Book();
  
!     if(format_ops.prBookHeadings)
!     	rtfText += BookHeading(module, lastBook);
  
!     if(format_ops.prChHeadings)
  	    rtfText += ChapterHeading(module, lastChap);
  
  	for ((*module) = TOP; !module->Error(); (*module)++){
!     	key = (VerseKey)module->Key();
!         if((AnsiString)key.Book() == lastBook){
!     	    if(format_ops.prBookHeadings)
! 	    		rtfText += BookHeading(module, lastBook);
!             lastBook = key.Book();
!         }
!         if(key.Chapter() != lastChap){
!         	rtfText += "\\par\\par";
!             if(format_ops.prChHeadings)
! 	            rtfText += ChapterHeading(module, key.Chapter());
!             lastChap = key.Chapter();
!         }
!         rtfText += PrintEntry(module, key.Verse());
!     }
  
      return rtfText;
  }
  
- AnsiString TRxRichEditX::GetFormattedBook(SWModule* module)
- {
-     AnsiString rtfText = "";
- 	VerseKey key;
-     int lastChap;
-     AnsiString lastBook;
- 
-     key = (VerseKey)module->Key();
-     lastChap = key.Chapter();
-     lastBook = (AnsiString)key.Book();
- 
-     if(format_ops.prBookHeadings)
-     	rtfText += BookHeading(module, lastBook);
- 
-     if(format_ops.prChHeadings)
- 	    rtfText += ChapterHeading(module, lastChap);
- 
- 	for ((*module) = TOP; !module->Error(); (*module)++){
-     	key = (VerseKey)module->Key();
-         if((AnsiString)key.Book() == lastBook){
- 	        rtfText += "\\par\\par";
-     	    if(format_ops.prBookHeadings)
- 	    		rtfText += BookHeading(module, lastBook);
-             lastBook = key.Book();
-         }
-         if(key.Chapter() != lastChap){
-         	rtfText += "\\par\\par";
-             if(format_ops.prChHeadings)
- 	            rtfText += ChapterHeading(module, key.Chapter());
-             lastChap = key.Chapter();
- 	   }
-         rtfText += PrintEntry(module, key.Verse());
-     }
- 
-     return rtfText;
- }
- */
  AnsiString TRxRichEditX::PrintEntry(SWModule* module, int nVerse)
  {
--- 29,94 ----
  }
  
! void TRxRichEditX::RenderModule(SWModule* module/*, RTF_FORMAT format*/)
  {
! 	//format_ops = format;
! 	this->module = module;
! 	TMemoryStream* RTFStream = new TMemoryStream();
! 	recalcAppearance();
! 	AnsiString rtfText = RTFHeader;
! 	rtfText += RTFHeadMargin;
! 	rtfText += GetFormattedText(module);
! 	rtfText += RTFTrailer;
! 	RTFStream->Clear();
! 	RTFStream->WriteBuffer(rtfText.c_str(), rtfText.Length());
! 	RTFStream->Position = 0;
! 	Lines->LoadFromStream(RTFStream);
! 	delete RTFStream;
! 	clearHTMLTags();
  }
  
  
  
! AnsiString TRxRichEditX::GetFormattedText(SWModule* module)
  {
! 	AnsiString rtfText = "";
  	VerseKey key;
! 	int lastChap, lastBook;
! 	AnsiString bookName;
  
! 	key = (VerseKey)module->Key();
! 	lastChap = key.Chapter();
! 	lastBook = key.Book();
! 	bookName = (AnsiString)key.getText();
! 	bookName = bookName.SubString(0,bookName.Pos(lastChap) - 2);
  
! 	if(dispAttribs.prBookHeadings)
! 	rtfText += BookHeading(module, bookName);
  
! 	if(dispAttribs.prChHeadings)
  	    rtfText += ChapterHeading(module, lastChap);
  
  	for ((*module) = TOP; !module->Error(); (*module)++){
! 		key = (VerseKey)module->Key();
! 		if(key.Book() != lastBook){
! 			rtfText += "\\par\\par";
! 			bookName = (AnsiString)key.getText();
! 			bookName = bookName.SubString(0,bookName.Pos(key.Chapter()) - 2);
! 			if(dispAttribs.prBookHeadings)
! 				rtfText += BookHeading(module, bookName);
! 		lastBook = key.Book();
! 		lastChap = -1; // Reset the last Chapter since we could jump from Jude 1 to Revelation 1
! 		}
! 		if(key.Chapter() != lastChap){
! 			rtfText += "\\par";
! 			if(dispAttribs.prChHeadings)
! 				rtfText += ChapterHeading(module, key.Chapter());
! 			lastChap = key.Chapter();
! 		}
! 		rtfText += PrintEntry(module, key.Verse());
! 	}
  
      return rtfText;
  }
  
  AnsiString TRxRichEditX::PrintEntry(SWModule* module, int nVerse)
  {
***************
*** 245,256 ****
  	}
  
! 	if(!format_ops.paragraph)
  		rtfText += "\\par";
! 	if(format_ops.prPreFix)
  		rtfText += PrintFix(module) + (AnsiString)" ";
  
! 	if(format_ops.prVerseNum){
! 		rtfText += (AnsiString)"{\\fs" + format_ops.vsNumFontSize;
! 		if(format_ops.superVSNum)
  			rtfText += "\\super ";
  		else rtfText += " ";
--- 102,113 ----
  	}
  
! 	if(!dispAttribs.paragraph)
  		rtfText += "\\par";
! 	if(dispAttribs.prPreFix)
  		rtfText += PrintFix(module) + (AnsiString)" ";
  
! 	if(dispAttribs.prVerseNum){
! 		rtfText += (AnsiString)"{\\fs" + (dispAttribs.vsNumFontSize * 2);
! 		if(dispAttribs.superVSNum)
  			rtfText += "\\super ";
  		else rtfText += " ";
***************
*** 258,265 ****
  		rtfText += " }";
  	}
! 	rtfText += (AnsiString)"{\\fs" + format_ops.bodyFontSize + (AnsiString)" ";
  	rtfText += module->RenderText();
  	rtfText += " }";
! 	if(format_ops.prPostFix)
  	rtfText += (AnsiString)" " + PrintFix(module);
  
--- 115,122 ----
  		rtfText += " }";
  	}
! 	rtfText += (AnsiString)"{\\fs" + (dispAttribs.fontSize * 2) + (AnsiString)" ";
  	rtfText += module->RenderText();
  	rtfText += " }";
! 	if(dispAttribs.prPostFix)
  	rtfText += (AnsiString)" " + PrintFix(module);
  
***************
*** 270,274 ****
  {
  	AnsiString rtfText = "";
! 	rtfText += (AnsiString)" \\qc{\\f1\\cf7\\fs" + format_ops.bkFontHeadSize + (AnsiString)"\\b ";
  	rtfText += _tr("Chapter");
  	rtfText += " ";
--- 127,131 ----
  {
  	AnsiString rtfText = "";
! 	rtfText += (AnsiString)" \\qc{\\f1\\cf7\\fs" + (dispAttribs.chFontHeadSize * 2) + (AnsiString)"\\b ";
  	rtfText += _tr("Chapter");
  	rtfText += " ";
***************
*** 281,285 ****
  {
  	AnsiString rtfText = "";
! 	rtfText += (AnsiString)" \\qc{\\f1\\cf7\\fs" + format_ops.bkFontHeadSize + (AnsiString)"\\b\\ul ";
  	rtfText += name;
  	rtfText += "\\par\\par}";
--- 138,142 ----
  {
  	AnsiString rtfText = "";
! 	rtfText += (AnsiString)" \\qc{\\f1\\cf7\\fs" + (dispAttribs.chFontHeadSize * 2) + (AnsiString)"\\b\\ul ";
  	rtfText += name;
  	rtfText += "\\par\\par}";
***************
*** 291,295 ****
  {
  	AnsiString rtfText = "";
! 	rtfText += (AnsiString)"{\\fs" + format_ops.vsNumFontSize;
  	rtfText += (AnsiString)"(" + (AnsiString)module->KeyText() + (AnsiString)" " + (AnsiString)module->Name() + (AnsiString)")}";
  	return rtfText;
--- 148,152 ----
  {
  	AnsiString rtfText = "";
! 	rtfText += (AnsiString)"{\\fs" + (dispAttribs.vsNumFontSize * 2);
  	rtfText += (AnsiString)"(" + (AnsiString)module->KeyText() + (AnsiString)" " + (AnsiString)module->Name() + (AnsiString)")}";
  	return rtfText;
***************
*** 329,333 ****
  
  	do {
! 	
  		if (calcBestSize) {
  			dispSize = &trySizeRect[trySize++];
--- 186,190 ----
  
  	do {
! 
  		if (calcBestSize) {
  			dispSize = &trySizeRect[trySize++];
***************
*** 337,341 ****
  			}
  		}
! 		
  		memset(&Range, 0, sizeof(TFormatRange));
  	//  with Printer, Range do begin
--- 194,198 ----
  			}
  		}
! 
  		memset(&Range, 0, sizeof(TFormatRange));
  	//  with Printer, Range do begin
***************
*** 385,389 ****
  	if (calcBestSize && size)
  		*size = *dispSize;
! 		
  	return LastChar;
  }
--- 242,246 ----
  	if (calcBestSize && size)
  		*size = *dispSize;
! 
  	return LastChar;
  }
***************
*** 391,395 ****
  
  void TRxRichEditX::fillWithRTFString(SWModule *module, const char *text, const char *type) {
! 	
  	TMemoryStream *RTFStream = new TMemoryStream();
  	System::AnsiString newtext, tmptext;
--- 248,252 ----
  
  void TRxRichEditX::fillWithRTFString(SWModule *module, const char *text, const char *type) {
! 
  	TMemoryStream *RTFStream = new TMemoryStream();
  	System::AnsiString newtext, tmptext;
***************
*** 398,402 ****
  	this->type = type;
  	recalcAppearance();
! 	
  	newtext = RTFHeader;
  	newtext += RTFHeadMargin;
--- 255,259 ----
  	this->type = type;
  	recalcAppearance();
! 
  	newtext = RTFHeader;
  	newtext += RTFHeadMargin;
***************
*** 416,420 ****
  
  	newtext += RTFTrailer;
! 	
  	RTFStream->Clear();
  	RTFStream->WriteBuffer(newtext.c_str(), newtext.Length());
--- 273,277 ----
  
  	newtext += RTFTrailer;
! 
  	RTFStream->Clear();
  	RTFStream->WriteBuffer(newtext.c_str(), newtext.Length());
***************
*** 437,441 ****
  	this->type = type;
  	recalcAppearance();
! 	
  	newtext = RTFHeader;
  
--- 294,298 ----
  	this->type = type;
  	recalcAppearance();
! 
  	newtext = RTFHeader;
  
***************
*** 449,453 ****
  		newtext += "\\rtlpar ";
      }
! 	
  	verses->Persist(1);
  	(*verses) = TOP;
--- 306,310 ----
  		newtext += "\\rtlpar ";
      }
! 
  	verses->Persist(1);
  	(*verses) = TOP;
***************
*** 510,514 ****
  					newtext += "{\\par\\par}";
  				newtext += RTFHeadingPre;
! 				
  				strcpy(buf, module->KeyText());
  				// VerseKey locales are not yet UTF8, so don't try to convert them.
--- 367,371 ----
  					newtext += "{\\par\\par}";
  				newtext += RTFHeadingPre;
! 
  				strcpy(buf, module->KeyText());
  				// VerseKey locales are not yet UTF8, so don't try to convert them.
***************
*** 527,531 ****
  		lastKey = verses->GetElement();
  		first = false;
! 		
  		newtext = newtext + "{";
  
--- 384,388 ----
  		lastKey = verses->GetElement();
  		first = false;
! 
  		newtext = newtext + "{";
  
***************
*** 543,547 ****
  			}
  			else tmptext += *loop;
! 			
  		}
  
--- 400,404 ----
  			}
  			else tmptext += *loop;
! 
  		}
  
***************
*** 568,572 ****
  
  	newtext += RTFTrailer;
! 	
  	RTFStream->Clear();
  	RTFStream->WriteBuffer(newtext.c_str(), newtext.Length());
--- 425,429 ----
  
  	newtext += RTFTrailer;
! 
  	RTFStream->Clear();
  	RTFStream->WriteBuffer(newtext.c_str(), newtext.Length());
***************
*** 575,579 ****
  
  	// make links
-         /*
  	while (true) {
  		int start, len, foundAt, endAt;
--- 432,435 ----
***************
*** 598,607 ****
  		this->SelAttributes->Link = true;
  	}
-         */
  	if (Visible) {
  		TComponent *owner = this->Owner;
  		TForm *parentForm = dynamic_cast<TForm *>(owner);
  		TWinControl *focus = 0;
! 		
  		if (parentForm)
  			focus = parentForm->ActiveControl;
--- 454,462 ----
  		this->SelAttributes->Link = true;
  	}
  	if (Visible) {
  		TComponent *owner = this->Owner;
  		TForm *parentForm = dynamic_cast<TForm *>(owner);
  		TWinControl *focus = 0;
! 
  		if (parentForm)
  			focus = parentForm->ActiveControl;
***************
*** 621,655 ****
  
  
! void TRxRichEditX::getDisplayPrefs(DISP_ATTRIBS *attribs, SWModule *module /*, const char *type*/) {
! 
! 
! 	string keyBackColor = (string)getType().c_str() + "BackColor";
! 	string backColor = Form1->optionsconf->Sections["Appearance"][keyBackColor];	
! 	// This portion of the code sets the default values (If needed) of the background 
! 	// for either typical windows or for popup windows
! 	if (backColor == "") {
! 		if (getType() == "Popup") {
! 			attribs->backColor = 14680063;
! 		}
! 		else attribs->backColor = clWindow;
! 	}
! 	else attribs->backColor = StrToInt((AnsiString)backColor.c_str());
  
! 	string keyFontColor = (string)getType().c_str() + "FontColor";
! 	string fontColor = Form1->optionsconf->Sections["Appearance"][keyFontColor];	
! 	// This portion of the code sets the default values (If needed) of the background 
! 	// for either typical windows or for popup windows
! 	if (backColor == "") {
! 		attribs->fontColor = clBlack;
! 	}
! 	else attribs->fontColor = StrToInt((AnsiString)fontColor.c_str());
  
! 	// If the module uses it's own font load that else we will try the config file else we will use the default
! 	ConfigEntMap::const_iterator eit = module->getConfig().find("Font");
  	if (eit != module->getConfig().end())
  		attribs->fontName = (*eit).second.c_str();
  	else {
! 		string keyFontName = (string)getType().c_str() + "FontName";
! 		attribs->fontName = (AnsiString)Form1->optionsconf->Sections["Appearance"][keyFontName].c_str();
  	}
  	// If we still have no name we will set it to a default value
--- 476,500 ----
  
  
! void TRxRichEditX::getDisplayPrefs(DISP_ATTRIBS *attribs, SWModule *module )
! {
! 	AnsiString fontSize;
! 	string 	keyFontName,
! 			keyFontSize;
! 	ConfigEntMap::const_iterator eit;
! 	string modType = (string)getType().c_str();
  
! 	// If we are printing to a page rather than the screen we want to grab the
! 	// correct settings from that section of the conf file.
! 	string dispType = (type == "PrintedPage") ? "PrintedPage" : "Appearance";
  
! 	//**** Font Name ****//
! 	// If the module uses it's own font load that else we will try the config file
! 	// else we will use the default
! 	eit = module->getConfig().find("Font");
  	if (eit != module->getConfig().end())
  		attribs->fontName = (*eit).second.c_str();
  	else {
! 		keyFontName = modType + "FontName";
! 		attribs->fontName = (AnsiString)Form1->optionsconf->Sections[dispType][keyFontName].c_str();
  	}
  	// If we still have no name we will set it to a default value
***************
*** 657,669 ****
  		attribs->fontName = "Times New Roman";
  
! 
! 	// If the module uses it's own font size load that else we will try the config file else we will use the default
!      AnsiString fontSize;
  	eit = module->getConfig().find("FontSize");
  	if (eit != module->getConfig().end())
  		fontSize = (*eit).second.c_str();
  	else {
! 		string keyFontSize = (string)getType().c_str() + "FontSize";
! 		fontSize = (AnsiString)Form1->optionsconf->Sections["Appearance"][keyFontSize].c_str();
  	}
  	// If we still have no size we will set it to a default value
--- 502,514 ----
  		attribs->fontName = "Times New Roman";
  
! 	//**** Font Size ****//
! 	// If the module uses it's own font size load that else we will try the config
! 	// file else we will use the default
  	eit = module->getConfig().find("FontSize");
  	if (eit != module->getConfig().end())
  		fontSize = (*eit).second.c_str();
  	else {
! 		keyFontSize = modType + "FontSize";
! 		fontSize = (AnsiString)Form1->optionsconf->Sections[dispType][keyFontSize].c_str();
  	}
  	// If we still have no size we will set it to a default value
***************
*** 672,704 ****
  	else attribs->fontSize = StrToInt(fontSize);
  
! 	string entryColor = Form1->optionsconf->Sections["Appearance"]["VSNumberColor"];
  	if (entryColor == "")
  		attribs->entryKeyColor = clBlue;
  	else attribs->entryKeyColor = StrToInt((AnsiString)entryColor.c_str());
  
! 	string currentVSColor = Form1->optionsconf->Sections["Appearance"]["CurrentVSColor"];
  	if (currentVSColor == "")
  		attribs->currentVSColor = clBlue;
  	else attribs->currentVSColor = StrToInt((AnsiString)currentVSColor.c_str());
  
! 	string morphColor = Form1->optionsconf->Sections["Appearance"]["MorphColor"];
  	if (morphColor == "")
  		attribs->morphColor = clBlue;
  	else attribs->morphColor = StrToInt((AnsiString)morphColor.c_str());
! 	
! 	string strongColor = Form1->optionsconf->Sections["Appearance"]["StrongsColor"];
  	if (strongColor == "")
  		attribs->strongsColor = clBlue;
  	else attribs->strongsColor = StrToInt((AnsiString)strongColor.c_str());
  
! 	string fieldColor = Form1->optionsconf->Sections["Appearance"]["FieldColor"];
  	if (fieldColor == "")
  		attribs->lookupFieldColor = clBlue;
  	else attribs->lookupFieldColor = StrToInt((AnsiString)fieldColor.c_str());
  
! 	string autoVSColor = Form1->optionsconf->Sections["Appearance"]["AutoVSColor"];
  	if (autoVSColor == "")
  		attribs->markCurrentVerse = true;
  	else	attribs->markCurrentVerse = (atoi(autoVSColor.c_str())) ? true : false;
  }
  
--- 517,648 ----
  	else attribs->fontSize = StrToInt(fontSize);
  
! 	//**** Chapter Heading Font Size ****//
! 	fontSize = "";
! 	eit = module->getConfig().find("ChHeadSize");
! 	if (eit != module->getConfig().end())
! 		fontSize = (*eit).second.c_str();
! 	else {
! 		keyFontSize = modType + "ChHeadSize";
! 		fontSize = (AnsiString)Form1->optionsconf->Sections[dispType][keyFontSize].c_str();
! 	}
! 	// If we still have no size we will set it to a default value
! 	if (fontSize == "")
! 		attribs->chFontHeadSize = 16;
! 	else attribs->chFontHeadSize = StrToInt(fontSize);
! 
! 	//**** Verse Numbering Font Size ****//
! 	fontSize = "";
! 	eit = module->getConfig().find("VSNumSize");
! 	if (eit != module->getConfig().end())
! 		fontSize = (*eit).second.c_str();
! 	else {
! 		keyFontSize = modType + "VSNumSize";
! 		fontSize = (AnsiString)Form1->optionsconf->Sections[dispType][keyFontSize].c_str();
! 	}
! 	// If we still have no size we will set it to a default value
! 	if (fontSize == "")
! 		attribs->vsNumFontSize = 10;
! 	else attribs->vsNumFontSize = StrToInt(fontSize);
! 
! 	//**** Main Background Color ****//
! 	string keyBackColor = modType + "BackColor";
! 	string backColor = Form1->optionsconf->Sections[dispType][keyBackColor];
! 	// This portion of the code sets the default values (If needed) of the background
! 	// for either typical windows or for popup windows
! 	if (backColor == "") {
! 		if (modType == "Popup") {
! 			attribs->backColor = 14680063;
! 		}
! 		else attribs->backColor = clWindow;
! 	}
! 	else attribs->backColor = StrToInt((AnsiString)backColor.c_str());
! 
! 	//**** Main Font Color ****//
! 	string keyFontColor = modType + "FontColor";
! 	string fontColor = Form1->optionsconf->Sections[dispType][keyFontColor];
! 	// This portion of the code sets the default values (If needed) of the background
! 	// for either typical windows or for popup windows
! 	if (backColor == "") {
! 		attribs->fontColor = clBlack;
! 	}
! 	else attribs->fontColor = StrToInt((AnsiString)fontColor.c_str());
! 
! 	//**** EntryKey Color ****//
! 	string entryColor = Form1->optionsconf->Sections[dispType]["VSNumberColor"];
  	if (entryColor == "")
  		attribs->entryKeyColor = clBlue;
  	else attribs->entryKeyColor = StrToInt((AnsiString)entryColor.c_str());
  
! 	//**** Current Verse Color ****//
! 	string currentVSColor = Form1->optionsconf->Sections[dispType]["CurrentVSColor"];
  	if (currentVSColor == "")
  		attribs->currentVSColor = clBlue;
  	else attribs->currentVSColor = StrToInt((AnsiString)currentVSColor.c_str());
  
! 	//**** Morphological Numbers Color ****//
! 	string morphColor = Form1->optionsconf->Sections[dispType]["MorphColor"];
  	if (morphColor == "")
  		attribs->morphColor = clBlue;
  	else attribs->morphColor = StrToInt((AnsiString)morphColor.c_str());
! 
! 	//**** Strongs Numbers Color ****//
! 	string strongColor = Form1->optionsconf->Sections[dispType]["StrongsColor"];
  	if (strongColor == "")
  		attribs->strongsColor = clBlue;
  	else attribs->strongsColor = StrToInt((AnsiString)strongColor.c_str());
  
! 	//**** Field Lookup Color ****//
! 	string fieldColor = Form1->optionsconf->Sections[dispType]["FieldColor"];
  	if (fieldColor == "")
  		attribs->lookupFieldColor = clBlue;
  	else attribs->lookupFieldColor = StrToInt((AnsiString)fieldColor.c_str());
  
! 	//**** Mark Current Verse? ****//
! 	string autoVSColor = Form1->optionsconf->Sections[dispType]["AutoVSColor"];
  	if (autoVSColor == "")
  		attribs->markCurrentVerse = true;
  	else	attribs->markCurrentVerse = (atoi(autoVSColor.c_str())) ? true : false;
+ 
+ 	//**** Print Chapter Headings? ****//
+ 	string prChHeadings = Form1->optionsconf->Sections[dispType][(modType + "ChHead")];
+ 	if (prChHeadings == "")
+ 		attribs->prChHeadings = true;
+ 	else	attribs->prChHeadings = (atoi(prChHeadings.c_str())) ? true : false;
+ 
+ 	//**** Print Book Name? ****//
+ 	string prBookHeadings = Form1->optionsconf->Sections[dispType][(modType +"BkName")];
+ 	if (prBookHeadings == "")
+ 		attribs->prBookHeadings = true;
+ 	else	attribs->prBookHeadings = (atoi(prBookHeadings.c_str())) ? true : false;
+ 
+ 	//**** Prefix Each Verse? ****//
+ 	string prPreFix = Form1->optionsconf->Sections[dispType][(modType +"PreFixTag")];
+ 	if (prPreFix == "")
+ 		attribs->prPreFix = true;
+ 	else	attribs->prPreFix = (atoi(prPreFix.c_str())) ? true : false;
+ 
+ 	//**** Postfix Each Verse? ****//
+ 	string prPostFix = Form1->optionsconf->Sections[dispType][(modType +"PostFixTag")];
+ 	if (prPostFix == "")
+ 		attribs->prPostFix = true;
+ 	else	attribs->prPostFix = (atoi(prPostFix.c_str())) ? true : false;
+ 
+ 	//**** Print the verse number? ****//
+ 	string prVerseNum = Form1->optionsconf->Sections[dispType][(modType + "VSNum")];
+ 	if (prVerseNum == "")
+ 		attribs->prVerseNum = true;
+ 	else	attribs->prVerseNum = (atoi(prVerseNum.c_str())) ? true : false;
+ 
+ 	//**** Superscript the verse number? ****//
+ 	string superVSNum = Form1->optionsconf->Sections[dispType][(modType + "SuperVS")];
+ 	if (superVSNum == "")
+ 		attribs->superVSNum = true;
+ 	else	attribs->superVSNum = (atoi(superVSNum.c_str())) ? true : false;
+ 
+ 	//**** Print as a paragraph? ****//
+ 	string paragraph = Form1->optionsconf->Sections[dispType][(modType + "Paragraph")];
+ 	if (paragraph == "")
+ 		attribs->paragraph = true;
+ 	else	attribs->paragraph = (atoi(paragraph.c_str())) ? true : false;
  }
  
***************
*** 718,722 ****
  	RTFVerseMarkPost = "}";
  	RTFVersePost = " }";
- 
  	buildRTFHeader();
  
--- 662,665 ----
***************
*** 846,856 ****
  		if (!strcmp(module->Type(), "Biblical Texts"))
  			retVal = "Text";
! 		if ((!strcmp(module->Type(), "Commentaries")) ||
  				(!strcmp(module->Type(), "Generic Books")))
  			retVal = "Comment";
! 		if (!strcmp(module->Type(), "Lexicons / Dictionaries"))
  			retVal = "LD";
! 	}
! 	else retVal = type;
  	
  	return retVal;
--- 789,805 ----
  		if (!strcmp(module->Type(), "Biblical Texts"))
  			retVal = "Text";
! 		else if ((!strcmp(module->Type(), "Commentaries")) ||
  				(!strcmp(module->Type(), "Generic Books")))
  			retVal = "Comment";
! 		else if (!strcmp(module->Type(), "Lexicons / Dictionaries"))
  			retVal = "LD";
! 	}else if(!strcmp(type.c_str(), "PrintedPage")){
! 		if(PrintForm->radText->Checked)
! 			retVal = "Text";
! 		else if(PrintForm->radComm->Checked)
! 			retVal = "Comment";
! 		else if(PrintForm->radLD->Checked)
! 			retVal = "LD";
! 	}else retVal = type;
  	
  	return retVal;
***************
*** 926,935 ****
  
  	TCharRange Range;
- 	WideString TestStr = "";
  	WideString Result = "";
  
  	if (HandleAllocated()) {
  		long max = TextLen() - 1;
- 		bool pre = true;
  		for (int i = 0; (SelStart + i) < max; i++) {
  			Range.cpMax = SelStart + i;
--- 875,882 ----
***************
*** 942,982 ****
  				Range.cpMin++;
  			Range.cpMax = SendMessage(Handle, EM_FINDWORDBREAK, WB_RIGHTBREAK, Range.cpMax);
! 			TestStr = Trim(GetTextRange(Range.cpMin, Range.cpMax));
! 			if (pre)
! 				Result = TestStr;
! 			else	Result += TestStr;
! 			
! 			if (Range.cpMin > 1)
! 				Range.cpMin--;
! 			TestStr = Trim(GetTextRange(Range.cpMin, Range.cpMax));
! 			
! 			int testlen = TestStr.Length();
! 
! 			if (!testlen)
! 				continue;
! 
! 			if ((pre) && (TestStr[1] == '-') && (Range.cpMin > 1)) {
! 				if (testlen > 1) {
! 					if ((isdigit(TestStr[2])) || (toupper(TestStr[2]) == TestStr[2])) {
! 						i = 0;
! 						SelStart = Range.cpMin-1;
! 						continue;
! 					}
! 				}
! 			}
! 			
! 			if ((TestStr[testlen] == '-') && (Range.cpMax < (max-1))) {
! 				if (testlen > 1) {
! 					if ((isdigit(TestStr[testlen-1])) || (toupper(TestStr[testlen-1]) == TestStr[testlen-1])) {
! 						i = 0;
! 						SelStart = Range.cpMax+1;
! 						pre = false;
! 						continue;
! 					}
! 				}
! 			}
! 			if (Result.Length())
  				break;
- 				
  		}
  	}
--- 889,895 ----
  				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;
  		}
  	}
***************
*** 1002,1005 ****
--- 915,946 ----
  		
  	return Result;
+ }
+ 
+ 
+ void TRxRichEditX::clearHTMLTags()
+ {
+ 	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;
+ 	}
+ 	SelLength = 0;
  }
  

Index: RxRichEditX.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/RxRichEditX.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** RxRichEditX.h	27 Jan 2003 09:23:06 -0000	1.13
--- RxRichEditX.h	27 Jan 2003 23:12:39 -0000	1.14
***************
*** 16,20 ****
  
  using namespace sword;
! 
  struct RTF_FORMAT {
  	AnsiString fontFace; 	// Font Name
--- 16,20 ----
  
  using namespace sword;
! /*
  struct RTF_FORMAT {
  	AnsiString fontFace; 	// Font Name
***************
*** 31,46 ****
  	bool superVSNum;		// Verse Numbers superscripted
  };
! 
  struct DISP_ATTRIBS {
  	AnsiString fontName;	// Font Name (Type Dependant)
  	int fontSize;			// Font Size (Type Dependant)
! 	bool markCurrentVerse;	// whether or not to mark current verse
! 	int backColor;		// Background Color (Type Dependant)
! 	int fontColor;		// Foreground Color (Type Dependant)
  	int entryKeyColor;		// Verse Number Color (Should be type dependant but isn't yet)
! 	int currentVSColor;	// Current Verse Color
  	int morphColor;		// MorphTags Color
  	int strongsColor;		// Strongs Tags Color
! 	int lookupFieldColor;		// Lookup Key Fields color
  };
  
--- 31,59 ----
  	bool superVSNum;		// Verse Numbers superscripted
  };
! */
  struct DISP_ATTRIBS {
+ 	// ** Type Dependant means that each text type (Bible, Commentary, etc.) has it's own setting ** //
+ 	// Font name and size
  	AnsiString fontName;	// Font Name (Type Dependant)
  	int fontSize;			// Font Size (Type Dependant)
! 	int chFontHeadSize;		// Chapter Name Heading Size (Type Dependant)
! 	int vsNumFontSize;		// VerseNumbering or Pre/Post-Fix Size (Type Dependant)
! 	// Font Colors
! 	int backColor;			// Background Color (Type Dependant)
! 	int fontColor;			// Foreground Color (Type Dependant)
  	int entryKeyColor;		// Verse Number Color (Should be type dependant but isn't yet)
! 	int currentVSColor;		// Current Verse Color
  	int morphColor;		// MorphTags Color
  	int strongsColor;		// Strongs Tags Color
! 	int lookupFieldColor;	// Lookup Key Fields color
! 	// Options
! 	bool markCurrentVerse;	// whether or not to mark current verse
! 	bool prChHeadings;		// Print Heading (Type Dependant)
! 	bool prBookHeadings;	// Print Book Name (Type Dependant)
! 	bool prPreFix;			// Print Verse Prefix (James 1:19 KJV) (Type Dependant)
! 	bool prPostFix;		// Print Verse Postfix (Type Dependant)
! 	bool prVerseNum;		// Print Verse Number  (Type Dependant)
! 	bool superVSNum;		// Verse Numbers superscripted (Type Dependant)
! 	bool paragraph;		// Print Bible Text as a paragraph rather than seperate lines (Type Dependant)
  };
  
***************
*** 58,90 ****
  #endif
  private:
! 	AnsiString GetFormattedBible(SWModule* module);
! 	//AnsiString GetFormattedComm(SWModule* module);
! 	//AnsiString GetFormattedLD(SWModule* module);
! 	//AnsiString GetFormattedBook(SWModule* module);
  	AnsiString ChapterHeading(SWModule* module, int nChapter);
  	AnsiString BookHeading(SWModule* module, AnsiString name);
  	AnsiString PrintEntry(SWModule* module, int nVerse);
  	AnsiString PrintFix(SWModule* module);
! 	RTF_FORMAT format_ops;
  	void buildRTFHeader();
  
  public:
  	static char platformID;
  	static void TColorToRGB(const TColor& color, int& red, int& green, int& blue);
  
  	AnsiString RTFHeader;
  	AnsiString RTFHeadMargin;
  	AnsiString RTFTrailer;
! 
  	AnsiString RTFChapterMarkPre;
  	AnsiString RTFChapterMarkPost;
! 
  	AnsiString RTFHeadingPre;
  	AnsiString RTFHeadingPost;
! 
  	AnsiString RTFVerseMarkPre;
  	AnsiString RTFVerseMarkPost;
! 
  	AnsiString RTFVersePre;
  	AnsiString RTFVersePost;
  	DISP_ATTRIBS dispAttribs;
--- 71,111 ----
  #endif
  private:
! 	AnsiString GetFormattedText(SWModule* module);
  	AnsiString ChapterHeading(SWModule* module, int nChapter);
  	AnsiString BookHeading(SWModule* module, AnsiString name);
  	AnsiString PrintEntry(SWModule* module, int nVerse);
  	AnsiString PrintFix(SWModule* module);
! 	//RTF_FORMAT format_ops;
  	void buildRTFHeader();
+ 	void clearHTMLTags();
  
  public:
  	static char platformID;
  	static void TColorToRGB(const TColor& color, int& red, int& green, int& blue);
+ 	// The following RTF variables are used to simplify streaming rtf formatting
+ 	// be sure to call recalcAppearance() so that these variables are set according 
+ 	// to the module type being rendered.
  
+ 	// RTFHeader: use to open a new RTF stream with font and color tables defined here. 
  	AnsiString RTFHeader;
+ 	//RTFHeadMargin: Use to place a margin above the Heading.
  	AnsiString RTFHeadMargin;
+ 	// RTFTrailer: Use to close your rtf stream.
  	AnsiString RTFTrailer;
! 	// RTFChapterMarkPre: Use to begin a new chapter heading. Includes the text "Chapter "
  	AnsiString RTFChapterMarkPre;
+ 	// RTFChapterMarkPost: Use to close your chapter heading.
  	AnsiString RTFChapterMarkPost;
! 	// RTFHeadingPre: Use to begin a mini-heading such as for pop-up windows 
  	AnsiString RTFHeadingPre;
+ 	// RTFHeadingPost: Closes the mini-heading
  	AnsiString RTFHeadingPost;
! 	// RTFVerseMarkPre: Use to begin a verse number
  	AnsiString RTFVerseMarkPre;
+ 	// RTFVerseMarkPost: Use to close a verse number
  	AnsiString RTFVerseMarkPost;
! 	// RTFVersePre: Use to begin the actual text of a verse
  	AnsiString RTFVersePre;
+ 	// RTFVersePost: Use to close the actual text of a verse
  	AnsiString RTFVersePost;
  	DISP_ATTRIBS dispAttribs;
***************
*** 94,100 ****
  	void fillWithVerses(SWModule *module, ListKey *verses, bool heading = true, bool verseNum = true, const char* type = "Default", bool stripNewlines = true);
  	void fillWithRTFString(SWModule *module, const char *text, const char *type = "Default");
! 	void getDisplayPrefs(DISP_ATTRIBS *attribs, SWModule *module /*,const char *type = "Default"*/);
  	void drawTo(HDC dc) { PaintControls(dc, 0); }
! 	void RenderModule(SWModule* module, RTF_FORMAT format);
  	SWModule *module;
  	AnsiString type;
--- 115,121 ----
  	void fillWithVerses(SWModule *module, ListKey *verses, bool heading = true, bool verseNum = true, const char* type = "Default", bool stripNewlines = true);
  	void fillWithRTFString(SWModule *module, const char *text, const char *type = "Default");
! 	void getDisplayPrefs(DISP_ATTRIBS *attribs, SWModule *module);
  	void drawTo(HDC dc) { PaintControls(dc, 0); }
! 	void RenderModule(SWModule* module);
  	SWModule *module;
  	AnsiString type;