[sword-cvs] swordreader/src/gui SwordIndex.cpp,1.2,1.3 NavRenderText.cpp,1.1.1.1,1.2

sword@www.crosswire.org sword@www.crosswire.org
Sat, 17 Jan 2004 08:49:44 -0700


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

Modified Files:
	SwordIndex.cpp NavRenderText.cpp 
Log Message:
Added a compile-time option to disable HTML layout


Index: SwordIndex.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/gui/SwordIndex.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SwordIndex.cpp	17 Jan 2004 02:57:42 -0000	1.2
+++ SwordIndex.cpp	17 Jan 2004 15:49:42 -0000	1.3
@@ -69,8 +69,12 @@
 
 		texts=new ModuleMap();
 		__try {
-			manager=new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF));
-			//get the available bibles out of here
+			//manager=new sword::SWMgr(swordConfigDir,true, new sword::MarkupFilterMgr(sword::FMT_HTMLHREF));
+			//get the available bibles out of here
+			manager=new sword::SWMgr(swordConfigDir,true, 
+				new sword::SWFilterMgr()
+			);
+
 			sword::ModMap::iterator it;
 			sword::SWModule* curMod = 0;
 			for (it = manager->Modules.begin(); it != manager->Modules.end(); it++) {

Index: NavRenderText.cpp
===================================================================
RCS file: /cvs/core/swordreader/src/gui/NavRenderText.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- NavRenderText.cpp	16 Jan 2004 17:34:19 -0000	1.1.1.1
+++ NavRenderText.cpp	17 Jan 2004 15:49:42 -0000	1.2
@@ -5,6 +5,10 @@
 #include "ApplicationInterface.h"
 #include "NavRenderText.h"
 #include "Navigator.h"
+
+//#define NOHTML
+
+#ifndef NOHTML
 
 #include <htmlctrl.h>
 
@@ -142,3 +146,87 @@
 	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
\ No newline at end of file