[sword-cvs] swordreader/src/gui NavRenderText.cpp,1.2,1.3 NavRenderText.h,1.1.1.1,1.2 SwordIndex.cpp,1.4,1.5 SwordIndex.h,1.1.1.1,1.2 gui.vcl,1.4,1.5 gui.vcp,1.2,1.3

sword@www.crosswire.org sword@www.crosswire.org
Sat, 17 Jan 2004 18:03:26 -0700


Update of /cvs/core/swordreader/src/gui
In directory www:/tmp/cvs-serv24696/src/gui

Modified Files:
	NavRenderText.cpp NavRenderText.h SwordIndex.cpp SwordIndex.h 
	gui.vcl gui.vcp 
Log Message:
experimenting with utf16

Index: NavRenderText.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/gui/NavRenderText.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NavRenderText.cpp	17 Jan 2004 15:49:42 -0000	1.2
+++ NavRenderText.cpp	18 Jan 2004 01:03:23 -0000	1.3
@@ -5,10 +5,14 @@
 #include "ApplicationInterface.h"
 #include "NavRenderText.h"
 #include "Navigator.h"
-
-//#define NOHTML
-
-#ifndef NOHTML
+
+
+//#define NOHTML
+
+
+
+#ifndef NOHTML
+
 
 #include <htmlctrl.h>
 
@@ -19,9 +23,9 @@
 #ifdef debugfile
 	#include <stdio.h>
 	FILE* file;
-	#define addHtml(window,text) SendMessage(window, DTM_ADDTEXT, FALSE, (LPARAM)text);fwprintf(file,text);
+	#define addHtml(window,text) SendMessage(window, DTM_ADDTEXTW, FALSE, (LPARAM)text);fwprintf(file,text);
 #else
-	#define addHtml(window,text) SendMessage(window, DTM_ADDTEXT, FALSE, (LPARAM)text)
+	#define addHtml(window,text) SendMessage(window, DTM_ADDTEXTW, FALSE, (LPARAM)text)
 #endif
 
 #define setZoom(window,zoom) SendMessage(window, DTM_ZOOMLEVEL, 0, zoom);
@@ -74,31 +78,33 @@
 	navigator->position.setVerse(1);
 	currentBook=navigator->position.getBook();
 	currentChapter=navigator->position.getChap();
-#ifdef debugfile
-	addHtml(htmlControl,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
-#endif
-	addHtml(htmlControl,"<html><head><title>c</title><style type=\"text/css\">small:{display:none}</style></head><body>");
-	String* s=new String(); String* heading=new String();//If not a pointer, warnings will occur
+	UString text = L"";
+//	text += L"<?xml version=\"1.0\" encoding=\"UTF-16\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
+//	text += L"<html><head><title>c</title><style type=\"text/css\">small:{display:none}</style></head><body>";
+	UString s;
+	UString heading;
 	while (true) {
-		__try {
-			*s=navigator->position.verseText();
-			if (s->length()>0) {
-				*heading=getVerseHeader();
-				addHtml(htmlControl,((*heading)+(*s)).c_str());
+			s = navigator->position.verseText();
+			if (s.length() > 0) {
+				heading = getVerseHeader();
+				text += heading;
+				text += s;
 			}
-		}
-		__except(EXCEPTION_EXECUTE_HANDLER) {
-			addHtml(htmlControl,"Not enough memory available");
-			break;
-		}			
 		if (navigator->position.getVerse()==navigator->position.verseCount())
 			break;
 		else
 			navigator->position.next();
 	}
-	delete s;delete heading;
+//	text += L"</body></html>";
+
+	__try {
+		addHtml(htmlControl, text.c_str());
+	}
+	__except(EXCEPTION_EXECUTE_HANDLER) {
+		addHtml(htmlControl,"Not enough memory available");
+	}			
+
 	navigator->position.jumpBack();
-	addHtml(htmlControl,"</body></html>");
 	endHtml(htmlControl);
 #ifdef debugfile
 	fclose(file);
@@ -112,7 +118,7 @@
 void NavRenderText::paint() {
 }
 
-String NavRenderText::getVerseHeader() {
+UString NavRenderText::getVerseHeader() {
 	String result="\n<b><a name=\"";
 	result+=toCString(navigator->position.getVerse());
 	result+="\">";
@@ -122,7 +128,8 @@
 	}
 	result+=toCString(navigator->position.getVerse());
 	result+="</a></b>&nbsp;";
-	return result;
+
+	return toUString(result);
 }
 
 void NavRenderText::keyDown(WPARAM id, LPARAM lparam) {
@@ -146,87 +153,170 @@
 	navigator->updateTitle();
 }
 
-#else //ifndef NOHTML
-
-//simpeler graphical representation not using the HTML component
-NavRenderText::NavRenderText(Navigator* navigator) {
-	this->navigator=navigator;
-}
-
-NavRenderText::~NavRenderText() {
-}
-
-void NavRenderText::show(bool forceRefresh) {
-}
-
-void NavRenderText::showText(bool forceRefresh) {
-}
-
-void NavRenderText::load() {
-}
-
-void NavRenderText::hide() {
-}
-
-void NavRenderText::paint() {
-	clearRect(&RECT_SCREEN);
-	RECT textRect=RECT_SCREEN;
-	setFont(FONT_TEXT);
-	navigator->position.setMark();
-	verseCount=0;
-	bool ready=false;
-	String* s=new String(); String* heading=new String();//If not a pointer, warnings will occur
-	while ((textRect.top<textRect.bottom)&&(!ready)) {
-		__try {
-			*s=navigator->position.verseText();
-			if (s->length()>0) {
-				*heading=getVerseHeader();
-				textRect.top+=drawVerseText(&textRect,toUString((*heading)+(*s)));
-			}
-		}
-		__except(EXCEPTION_EXECUTE_HANDLER) {
-			drawVerseText(&textRect,UString(L"Not enough memory available"));
-			ready=true;
-		}			
-		navigator->position.next();
-		verseCount++;
-	}
-	delete s;delete heading;
-	navigator->position.jumpBack();
-	setFont();
-}
-
-String NavRenderText::getVerseHeader() {
-	String result;
-	if (navigator->position.getVerse()==1) {
-		result+=toCString(navigator->position.getChap());
-		result+=":";
-	}
-	result+=toCString(navigator->position.getVerse());
-	result+=" ";
-	return result;
-}
-
-void NavRenderText::keyDown(WPARAM id, LPARAM lparam) {
-	switch (id) {
-		case VK_UP:
-			navigator->position--;
-			navigator->refresh();
-			break;
-		case VK_DOWN:
-			navigator->position++;
-			navigator->refresh();
-			break;
-		case VK_LEFT:
-			navigator->position-=verseCount-1;
-			navigator->refresh();
-			break;
-		case VK_RIGHT:
-			navigator->position+=verseCount-1;
-			navigator->refresh();
-			break;
-		}
-	navigator->updateTitle();
-}
-
+#else //ifndef NOHTML
+
+
+
+//simpeler graphical representation not using the HTML component
+
+NavRenderText::NavRenderText(Navigator* navigator) {
+
+	this->navigator=navigator;
+
+}
+
+
+
+NavRenderText::~NavRenderText() {
+
+}
+
+
+
+void NavRenderText::show(bool forceRefresh) {
+
+}
+
+
+
+void NavRenderText::showText(bool forceRefresh) {
+
+}
+
+
+
+void NavRenderText::load() {
+
+}
+
+
+
+void NavRenderText::hide() {
+
+}
+
+
+
+void NavRenderText::paint() {
+
+	clearRect(&RECT_SCREEN);
+
+	RECT textRect=RECT_SCREEN;
+
+	setFont(FONT_TEXT);
+
+	navigator->position.setMark();
+
+	verseCount=0;
+
+	bool ready=false;
+
+	String* s=new String(); String* heading=new String();//If not a pointer, warnings will occur
+
+	while ((textRect.top<textRect.bottom)&&(!ready)) {
+
+		__try {
+
+			*s=navigator->position.verseText();
+
+			if (s->length()>0) {
+
+				*heading=getVerseHeader();
+
+				textRect.top+=drawVerseText(&textRect,toUString((*heading)+(*s)));
+
+			}
+
+		}
+
+		__except(EXCEPTION_EXECUTE_HANDLER) {
+
+			drawVerseText(&textRect,UString(L"Not enough memory available"));
+
+			ready=true;
+
+		}			
+
+		navigator->position.next();
+
+		verseCount++;
+
+	}
+
+	delete s;delete heading;
+
+	navigator->position.jumpBack();
+
+	setFont();
+
+}
+
+
+
+String NavRenderText::getVerseHeader() {
+
+	String result;
+
+	if (navigator->position.getVerse()==1) {
+
+		result+=toCString(navigator->position.getChap());
+
+		result+=":";
+
+	}
+
+	result+=toCString(navigator->position.getVerse());
+
+	result+=" ";
+
+	return result;
+
+}
+
+
+
+void NavRenderText::keyDown(WPARAM id, LPARAM lparam) {
+
+	switch (id) {
+
+		case VK_UP:
+
+			navigator->position--;
+
+			navigator->refresh();
+
+			break;
+
+		case VK_DOWN:
+
+			navigator->position++;
+
+			navigator->refresh();
+
+			break;
+
+		case VK_LEFT:
+
+			navigator->position-=verseCount-1;
+
+			navigator->refresh();
+
+			break;
+
+		case VK_RIGHT:
+
+			navigator->position+=verseCount-1;
+
+			navigator->refresh();
+
+			break;
+
+		}
+
+	navigator->updateTitle();
+
+}
+
+
+
 #endif

Index: NavRenderText.h
===================================================================
RCS file: /cvs/core/swordreader/src/gui/NavRenderText.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- NavRenderText.h	16 Jan 2004 17:34:20 -0000	1.1.1.1
+++ NavRenderText.h	18 Jan 2004 01:03:23 -0000	1.2
@@ -26,7 +26,7 @@
 	HWND htmlControl;
 	void load();
 	void showText(bool forceRefresh=false);
-	String getVerseHeader();
+	UString getVerseHeader();
 	int currentBook;
 	int currentChapter;
 };

Index: SwordIndex.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/gui/SwordIndex.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- SwordIndex.cpp	17 Jan 2004 19:13:14 -0000	1.4
+++ SwordIndex.cpp	18 Jan 2004 01:03:23 -0000	1.5
@@ -69,7 +69,7 @@
 
 		texts=new ModuleMap();
 		__try {
-			manager=new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF));
+			manager=new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16));
 			//get the available bibles out of here
 
 //			manager=new sword::SWMgr(swordConfigDir,true, new sword::SWFilterMgr());
@@ -156,8 +156,9 @@
 	return verse->Verse();
 }
 
-String SwordIndex::verseText() {
-	return String(bible->StripText());
+UString SwordIndex::verseText() {
+	UString utf16 = (WCHAR *)bible->RenderText();
+	return utf16;
 }
 
 void SwordIndex::setMark() {

Index: SwordIndex.h
===================================================================
RCS file: /cvs/core/swordreader/src/gui/SwordIndex.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SwordIndex.h	16 Jan 2004 17:34:19 -0000	1.1.1.1
+++ SwordIndex.h	18 Jan 2004 01:03:23 -0000	1.2
@@ -55,7 +55,7 @@
 	virtual ~SwordIndex();
 	UString toString();
 
-	String verseText();
+	UString verseText();
 
 	ModuleMap::iterator firstModule() {return texts->begin();};
 	ModuleMap::iterator lastModule() {return texts->end();};

Index: gui.vcl
===================================================================
RCS file: /cvs/core/swordreader/src/gui/gui.vcl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gui.vcl	17 Jan 2004 19:13:14 -0000	1.4
+++ gui.vcl	18 Jan 2004 01:03:23 -0000	1.5
@@ -6,64 +6,12 @@
 --------------------Configuration: gui - Win32 (WCE x86) Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating command line "rc.exe /l 0x409 /fo"X86Dbg/BibleReader.res" /i "..\dll1\sword\include" /i "..\dll1\wincesword\include" /d UNDER_CE=300 /d _WIN32_WCE=300 /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "WIN32_PLATFORM_PSPC=310" /d "_X86_" /d "x86" /d "_i386_" /r "D:\src\swordreader\src\gui\BibleReader.rc"" 
-Creating temporary file "C:\DOCUME~1\scribe\LOCALS~1\Temp\RSP3E.tmp" with contents
-[
-/nologo /W3 /Zi /Od /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /D "DEBUG" /D "_i386_" /D UNDER_CE=300 /D _WIN32_WCE=300 /D "WIN32_PLATFORM_PSPC=310" /D "i_386_" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Fp"X86Dbg/gui.pch" /YX /Fo"X86Dbg/" /Fd"X86Dbg/" /Gs8192 /GF /c 
-"D:\src\swordreader\src\gui\ApplicationInterface.cpp"
-"D:\src\swordreader\src\gui\Main.cpp"
-"D:\src\swordreader\src\gui\NavBooks.cpp"
-"D:\src\swordreader\src\gui\Navigator.cpp"
-"D:\src\swordreader\src\gui\NavNumbers.cpp"
-"D:\src\swordreader\src\gui\NavRenderText.cpp"
-"D:\src\swordreader\src\gui\SwordIndex.cpp"
-"D:\src\swordreader\src\gui\Utils.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\scribe\LOCALS~1\Temp\RSP3E.tmp" 
-Creating temporary file "C:\DOCUME~1\scribe\LOCALS~1\Temp\RSP3F.tmp" with contents
-[
-corelibc.lib ..\Dll1\X86Dbg\sword.lib htmlview.lib oleaut32.lib commctrl.lib coredll.lib aygshell.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:yes /pdb:"X86Dbg/gui.pdb" /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:libc.lib /nodefaultlib:libcd.lib /nodefaultlib:libcmt.lib /nodefaultlib:libcmtd.lib /nodefaultlib:msvcrt.lib /nodefaultlib:msvcrtd.lib /nodefaultlib:oldnames.lib /out:"X86Dbg/gui.exe" /subsystem:windowsce,3.00 /MACHINE:IX86 
-.\X86Dbg\ApplicationInterface.obj
-.\X86Dbg\Main.obj
-.\X86Dbg\NavBooks.obj
-.\X86Dbg\Navigator.obj
-.\X86Dbg\NavNumbers.obj
-.\X86Dbg\NavRenderText.obj
-.\X86Dbg\SwordIndex.obj
-.\X86Dbg\Utils.obj
-.\X86Dbg\BibleReader.res
-]
-Creating command line "link.exe @C:\DOCUME~1\scribe\LOCALS~1\Temp\RSP3F.tmp"
-<h3>Output Window</h3>
-Compiling resources...
-Compiling...
-ApplicationInterface.cpp
-Main.cpp
-..\..\..\sword\include\swbuf.h(206) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-..\..\..\sword\include\swbuf.h(213) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-NavBooks.cpp
-..\..\..\sword\include\swbuf.h(206) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-..\..\..\sword\include\swbuf.h(213) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-Navigator.cpp
-..\..\..\sword\include\swbuf.h(206) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-..\..\..\sword\include\swbuf.h(213) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-NavNumbers.cpp
-..\..\..\sword\include\swbuf.h(206) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-..\..\..\sword\include\swbuf.h(213) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-NavRenderText.cpp
-..\..\..\sword\include\swbuf.h(206) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-..\..\..\sword\include\swbuf.h(213) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-SwordIndex.cpp
-..\..\..\sword\include\swbuf.h(206) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-..\..\..\sword\include\swbuf.h(213) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
-Utils.cpp
-Linking...
 
 
 
 
 <h3>Results</h3>
-gui.exe - 0 error(s), 12 warning(s)
+gui.exe - 0 error(s), 0 warning(s)
 </pre>
 </body>
 </html>

Index: gui.vcp
===================================================================
RCS file: /cvs/core/swordreader/src/gui/gui.vcp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gui.vcp	17 Jan 2004 13:20:25 -0000	1.2
+++ gui.vcp	18 Jan 2004 01:03:23 -0000	1.3
@@ -1,1001 +1,799 @@
-# Microsoft eMbedded Visual Tools Project File - Name="gui" - Package Owner=<4>
-# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (WCE x86) Application" 0x8301
-# TARGTYPE "Win32 (WCE ARM) Application" 0x8501
-
-CFG=gui - Win32 (WCE ARM) Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
[...1769 lines suppressed...]
+SOURCE=.\BibleReader.ICO
+# End Source File
+# Begin Source File
+
+SOURCE=.\BibleReader.rc
+
+!IF  "$(CFG)" == "gui - Win32 (WCE ARM) Release"
+
+!ELSEIF  "$(CFG)" == "gui - Win32 (WCE ARM) Debug"
+
+!ELSEIF  "$(CFG)" == "gui - Win32 (WCE x86) Release"
+
+!ELSEIF  "$(CFG)" == "gui - Win32 (WCE x86) Debug"
+
+!ENDIF 
+
+# End Source File
+# End Group
+# End Target
+# End Project