[sword-svn] r497 - branches/BCB5

chrislit at crosswire.org chrislit at crosswire.org
Fri Apr 10 15:25:33 MST 2009


Author: chrislit
Date: 2009-04-10 15:25:33 -0700 (Fri, 10 Apr 2009)
New Revision: 497

Modified:
   branches/BCB5/RxRichEditX.cpp
   branches/BCB5/RxRichEditX.h
   branches/BCB5/paraldisp.cpp
   branches/BCB5/swdisprtf.cpp
Log:
made images loadable from module paths outside of the BibleCS installation


Modified: branches/BCB5/RxRichEditX.cpp
===================================================================
--- branches/BCB5/RxRichEditX.cpp	2009-03-09 03:21:01 UTC (rev 496)
+++ branches/BCB5/RxRichEditX.cpp	2009-04-10 22:25:33 UTC (rev 497)
@@ -284,7 +284,7 @@
 
 	delete RTFStream;
 	makeLinks();
-	makeImages();
+	makeImages(module);
 }
 
 
@@ -464,7 +464,7 @@
 	Lines->LoadFromStream(RTFStream);
 
 	makeLinks();
-	makeImages();
+	makeImages(module);
 	
 	if (Visible) {
 		TComponent *owner = this->Owner;
@@ -1060,7 +1060,7 @@
 }
 
 
-void TRxRichEditX::makeImages() {
+void TRxRichEditX::makeImages(const SWModule *module) {
 	WordWrap = true;
 	while (true) {
 		int start, len, foundAt, endAt;
@@ -1080,7 +1080,17 @@
 		SelLength = (endAt - foundAt)+4;
 		XMLTag tag(this->SelText.c_str());
 		SelText = "";
-		insertImage(tag.getAttribute("src"));
+
+		SWBuf imgPath = "";
+		if (module) {
+			imgPath = module->getConfigEntry("AbsoluteDataPath");
+			char ch = imgPath.c_str()[strlen(imgPath.c_str())-1];
+			if ((ch != '/') && (ch != '\\')) {
+				imgPath.append('/');
+			}
+		}
+		imgPath.append(tag.getAttribute("src"));
+		insertImage(imgPath);
 	}
 }
 

Modified: branches/BCB5/RxRichEditX.h
===================================================================
--- branches/BCB5/RxRichEditX.h	2009-03-09 03:21:01 UTC (rev 496)
+++ branches/BCB5/RxRichEditX.h	2009-04-10 22:25:33 UTC (rev 497)
@@ -114,8 +114,8 @@
 	AnsiString type;
 	void recalcAppearance();
 	void makeLinks();
-	void makeImages();
-        void makeBracketsEven(AnsiString &rtfText);
+	void makeImages(const SWModule *mod = NULL);
+	void makeBracketsEven(AnsiString &rtfText);
 	void insertImage(const char *filePath);
 	SWBuf bitmapToRTF(Graphics::TBitmap *pict);
 	void insertRTF(const char *rtf);

Modified: branches/BCB5/paraldisp.cpp
===================================================================
--- branches/BCB5/paraldisp.cpp	2009-03-09 03:21:01 UTC (rev 496)
+++ branches/BCB5/paraldisp.cpp	2009-04-10 22:25:33 UTC (rev 497)
@@ -238,7 +238,7 @@
 				RTFStream->Position = 0;
 				Lines->LoadFromStream(RTFStream);
 				makeLinks();
-				makeImages();
+				makeImages(mods[z]);
 				versepos =  GetTextLen() - 3;
 			}
 //			newtext = newtext + "}";

Modified: branches/BCB5/swdisprtf.cpp
===================================================================
--- branches/BCB5/swdisprtf.cpp	2009-03-09 03:21:01 UTC (rev 496)
+++ branches/BCB5/swdisprtf.cpp	2009-04-10 22:25:33 UTC (rev 497)
@@ -84,7 +84,7 @@
 	Lines->LoadFromStream(RTFStream);
 
 	makeLinks();
-	makeImages();
+	makeImages(&Module);
 
 	SendMessage(Handle, EM_SCROLLCARET, 0, 0);
 




More information about the sword-cvs mailing list