[sword-svn] r58 - in trunk/src: . Dll1 gui simplegui

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Thu Dec 13 22:10:51 MST 2007


Author: dtrotzjr
Date: 2007-12-13 22:10:50 -0700 (Thu, 13 Dec 2007)
New Revision: 58

Modified:
   trunk/src/Dll1/Dll1.vcp
   trunk/src/SwRd.vcb
   trunk/src/SwRd.vco
   trunk/src/gui/NavRenderText.cpp
   trunk/src/gui/TextControl.cpp
   trunk/src/gui/TextControl.h
   trunk/src/gui/VerseTextControl.cpp
   trunk/src/gui/gui.vcp
   trunk/src/simplegui/simplegui.vcp
Log:
Added initial support for double buffering in the TextControl class. This significantly speeds up the amount of time the screen is blank when loading new text.

Modified: trunk/src/Dll1/Dll1.vcp
===================================================================
--- trunk/src/Dll1/Dll1.vcp	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/Dll1/Dll1.vcp	2007-12-14 05:10:50 UTC (rev 58)
@@ -52,7 +52,7 @@
 # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r
 CPP=clarm.exe
 # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_USRDLL" /D "DLL1_EXPORTS" /YX /Oxs /M$(CECrtMT) /c
-# ADD CPP /nologo /W3 /I "..\..\..\sword\include" /I "winceSword\include" /I "..\STL_eVC" /D "ARM" /D "_ARM_" /D "NDEBUG" /D "NO_VSNPRINTF" /D "DEBUG" /D "_i386_" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_USRDLL" /D "DLL1_EXPORTS" /D "SWMAKINGDLL" /U "USE_AUTOTOOLS" /U "__GNUC__" /U "_ICU_" /FR /Oxs /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /O2 /I "..\..\..\sword\include" /I "winceSword\include" /I "..\STL_eVC" /D "ARM" /D "_ARM_" /D "NDEBUG" /D "NO_VSNPRINTF" /D "DEBUG" /D "_i386_" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_USRDLL" /D "DLL1_EXPORTS" /D "SWMAKINGDLL" /U "USE_AUTOTOOLS" /U "__GNUC__" /U "_ICU_" /FR /Oxs /M$(CECrtMT) /c
 # SUBTRACT CPP /YX
 MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32

Modified: trunk/src/SwRd.vcb
===================================================================
(Binary files differ)

Modified: trunk/src/SwRd.vco
===================================================================
(Binary files differ)

Modified: trunk/src/gui/NavRenderText.cpp
===================================================================
--- trunk/src/gui/NavRenderText.cpp	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/gui/NavRenderText.cpp	2007-12-14 05:10:50 UTC (rev 58)
@@ -2,10 +2,10 @@
 #include "NavRenderText.h"
 #include "SimpleNavigator.h"
 
+
 #include <swordce.h>
 
 NavRenderText::NavRenderText(SimpleNavigator* navigator):NavPage(navigator) {
-
 	textControl = new VerseTextControl(RECT_SCREEN.left, RECT_SCREEN.top, RECT_SCREEN.right, RECT_SCREEN.bottom);
 }
 
@@ -69,8 +69,8 @@
 			navigator->position.next();
 	}
 	textControl->addText(UString(L"</body></html>"));
+	navigator->position.jumpBack();
 
-	navigator->position.jumpBack();
 	textControl->endOfText();
 }
 

Modified: trunk/src/gui/TextControl.cpp
===================================================================
--- trunk/src/gui/TextControl.cpp	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/gui/TextControl.cpp	2007-12-14 05:10:50 UTC (rev 58)
@@ -28,27 +28,46 @@
 
 TextControl::TextControl(int x, int y, int width, int height, bool preview){
 	this->preview = preview;
+	primed = false;
 	if(width < height) 
 		portrait = true;
 	
 	VERIFY(InitHTMLControl(g_hInst));
-	htmlControl = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL, 
+	htmlControl1 = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL, 
 		WS_CHILD | HS_CLEARTYPE | HS_NOSCRIPTING | 
 		HS_NOIMAGES | HS_NOACTIVEX | HS_NOSOUNDS ,
 		x, y, width, height, 
 		g_hWnd,	NULL, g_hInst, NULL);
-	setZoom(htmlControl, 1);
+	htmlControl2 = CreateWindowEx(WS_EX_NOACTIVATE, WC_HTML, NULL, 
+		WS_CHILD | HS_CLEARTYPE | HS_NOSCRIPTING | 
+		HS_NOIMAGES | HS_NOACTIVEX | HS_NOSOUNDS ,
+		x, y, width, height, 
+		g_hWnd,	NULL, g_hInst, NULL);
+	setZoom(htmlControl1, 1);
+	setZoom(htmlControl2, 1);
+	i = 0;
+	ShowWindow(htmlControl2,SW_HIDE);
 }
 
 TextControl::~TextControl(){
 }
 
 void TextControl::show() {
-	ShowWindow(htmlControl,SW_SHOW);
+	if(preview)
+		ShowWindow(htmlControl1,SW_SHOW);
+	else if(primed){
+		ShowWindow(htmlControl2,SW_SHOW);
+		ShowWindow(htmlControl1,SW_HIDE);
+	}else{
+		ShowWindow(htmlControl1,SW_SHOW);
+		ShowWindow(htmlControl2,SW_HIDE);
+	}
+
 }
 
 void TextControl::hide() {
-	ShowWindow(htmlControl,SW_HIDE);
+	ShowWindow(htmlControl1,SW_HIDE);
+	ShowWindow(htmlControl2,SW_HIDE);
 }
 
 void TextControl::paint() {
@@ -59,34 +78,57 @@
 	int height = GetSystemMetrics(SM_CYSCREEN);
 	if(width < height && !portrait){
 		portrait = true;
-		MoveWindow(htmlControl,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+		MoveWindow(htmlControl1,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+		MoveWindow(htmlControl2,0,0,width,height - 2*MENU_HEIGHT, TRUE);
 
 	}else if(width > height && portrait){
 		portrait = false;
-		MoveWindow(htmlControl,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+		MoveWindow(htmlControl1,0,0,width,height - 2*MENU_HEIGHT, TRUE);
+		MoveWindow(htmlControl2,0,0,width,height - 2*MENU_HEIGHT, TRUE);
 	}
 }
 
 TextControl::moveTo(int x, int y, int width, int height){
-	MoveWindow(htmlControl, x, y, width, height, TRUE);
+	MoveWindow(htmlControl1, x, y, width, height, TRUE);
+	MoveWindow(htmlControl2, x, y, width, height, TRUE);
 }
 
 void TextControl::clearText() {
-	clearHtml(htmlControl);
+	clearHtml(htmlControl1);
+	clearHtml(htmlControl2);
+	primed = false;
+	i = 0;
 	buffer.clear();
 }
 
 void TextControl::addText(UString text) {
 	buffer+=text;
-	//addHtml(htmlControl,text.c_str());
+	
+	if(!preview && !primed && buffer.length() > 1500){
+		clearHtml(htmlControl1);
+		addHtml(htmlControl1,buffer.c_str());
+		addHtml(htmlControl1, UString(L"</body></html>").c_str());
+		endHtml(htmlControl1);
+		ShowWindow(htmlControl1,SW_SHOW);
+		ShowWindow(htmlControl2,SW_HIDE);
+		UpdateWindow(g_hWnd);
+		primed = true;
+	}
 }
 
 void TextControl::endOfText() {
 #ifdef debugfile
 	file=fopen("\\chapter.html","w+");
 #endif
-	addHtml(htmlControl,buffer.c_str());
-	endHtml(htmlControl);
+	if(preview){
+		addHtml(htmlControl1,buffer.c_str());
+		endHtml(htmlControl1);
+	}else{
+		addHtml(htmlControl2,buffer.c_str());
+		endHtml(htmlControl2);
+		ShowWindow(htmlControl1,SW_HIDE);
+		ShowWindow(htmlControl2,SW_SHOW);
+	}
 #ifdef debugfile
 	fclose(file);
 #endif

Modified: trunk/src/gui/TextControl.h
===================================================================
--- trunk/src/gui/TextControl.h	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/gui/TextControl.h	2007-12-14 05:10:50 UTC (rev 58)
@@ -21,11 +21,14 @@
 	void addText(UString text);
 	void endOfText();
 protected:
-	HWND htmlControl;					// in case of HTML
+	HWND htmlControl1;
+	HWND htmlControl2;
 	UString buffer;
 	RECT area;
 	bool portrait;
 	bool preview;
+	bool primed;
+	int i;
 };
 
 #endif

Modified: trunk/src/gui/VerseTextControl.cpp
===================================================================
--- trunk/src/gui/VerseTextControl.cpp	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/gui/VerseTextControl.cpp	2007-12-14 05:10:50 UTC (rev 58)
@@ -20,7 +20,7 @@
 }
 
 void VerseTextControl::gotoAnchor(int anchor) {
-	controlToVerse(htmlControl,anchor);
+	controlToVerse(htmlControl1,anchor);
 }
 
 void VerseTextControl::paint() {

Modified: trunk/src/gui/gui.vcp
===================================================================
--- trunk/src/gui/gui.vcp	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/gui/gui.vcp	2007-12-14 05:10:50 UTC (rev 58)
@@ -52,7 +52,7 @@
 # ADD RSC /l 0x409 /i "..\dll1\sword\include" /i "..\dll1\wincesword\include" /i "..\STL_eVC" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r
 CPP=clarm.exe
 # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /YX /Oxs /M$(CECrtMT) /c
-# ADD CPP /nologo /W3 /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /FR /Oxs /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /O2 /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /FR /Oxs /M$(CECrtMT) /c
 # SUBTRACT CPP /YX
 MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
@@ -187,6 +187,7 @@
 	".\Utils.h"\
 	{$(INCLUDE)}"aygshell.h"\
 	{$(INCLUDE)}"sipapi.h"\
+	{$(INCLUDE)}"vibrate.h"\
 	
 
 !ELSEIF  "$(CFG)" == "gui - Win32 (WCE ARM) Debug"
@@ -270,6 +271,7 @@
 	{$(INCLUDE)}"aygshell.h"\
 	{$(INCLUDE)}"htmlctrl.h"\
 	{$(INCLUDE)}"sipapi.h"\
+	{$(INCLUDE)}"vibrate.h"\
 	
 
 !ELSEIF  "$(CFG)" == "gui - Win32 (WCE ARM) Debug"
@@ -820,6 +822,9 @@
 	".\SwordIndex.h"\
 	".\TextControl.h"\
 	".\Utils.h"\
+	{$(INCLUDE)}"aygshell.h"\
+	{$(INCLUDE)}"sipapi.h"\
+	{$(INCLUDE)}"vibrate.h"\
 	
 
 !ELSEIF  "$(CFG)" == "gui - Win32 (WCE ARM) Debug"
@@ -1710,6 +1715,7 @@
 	"..\..\..\sword\include\swtext.h"\
 	"..\..\..\sword\include\thmlhtml.h"\
 	"..\..\..\sword\include\thmlvariants.h"\
+	"..\..\..\sword\include\url.h"\
 	"..\..\..\sword\include\versekey.h"\
 	"..\..\..\sword\include\ztext.h"\
 	"..\..\..\sword\include\zverse.h"\
@@ -2139,6 +2145,7 @@
 DEP_CPP_UTILS=\
 	"..\..\..\sword\include\defs.h"\
 	"..\..\..\sword\include\swbuf.h"\
+	".\ApplicationInterface.h"\
 	".\Utils.h"\
 	
 

Modified: trunk/src/simplegui/simplegui.vcp
===================================================================
--- trunk/src/simplegui/simplegui.vcp	2007-12-12 18:22:44 UTC (rev 57)
+++ trunk/src/simplegui/simplegui.vcp	2007-12-14 05:10:50 UTC (rev 58)
@@ -52,7 +52,7 @@
 # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r
 CPP=clarm.exe
 # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /YX /Oxs /M$(CECrtMT) /c
-# ADD CPP /nologo /W3 /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /I "winceSword\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "SIMPLE" /FR /Oxs /M$(CECrtMT) /c
+# ADD CPP /nologo /W3 /O2 /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /I "winceSword\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "SIMPLE" /FR /Oxs /M$(CECrtMT) /c
 # SUBTRACT CPP /YX
 MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
@@ -188,11 +188,10 @@
 	"..\..\..\sword\include\swbuf.h"\
 	"..\gui\ApplicationInterface.h"\
 	"..\gui\Utils.h"\
+	{$(INCLUDE)}"aygshell.h"\
+	{$(INCLUDE)}"sipapi.h"\
+	{$(INCLUDE)}"vibrate.h"\
 	
-NODEP_CPP_APPLI=\
-	".\ipapi.h"\
-	".\ygshell.h"\
-	
 
 !ELSEIF  "$(CFG)" == "simplegui - Win32 (WCE ARM) Debug"
 
@@ -223,9 +222,11 @@
 	"..\..\..\sword\include\swbuf.h"\
 	"..\gui\ApplicationInterface.h"\
 	"..\gui\Utils.h"\
-	{$(INCLUDE)}"aygshell.h"\
-	{$(INCLUDE)}"sipapi.h"\
 	
+NODEP_CPP_APPLI=\
+	".\ipapi.h"\
+	".\ygshell.h"\
+	
 
 !ENDIF 
 
@@ -266,12 +267,11 @@
 	"..\gui\SimpleNavigator.h"\
 	"..\gui\SwordIndex.h"\
 	"..\gui\Utils.h"\
+	{$(INCLUDE)}"aygshell.h"\
+	{$(INCLUDE)}"htmlctrl.h"\
+	{$(INCLUDE)}"sipapi.h"\
+	{$(INCLUDE)}"vibrate.h"\
 	
-NODEP_CPP_MAIN_=\
-	".\ipapi.h"\
-	".\tmlctrl.h"\
-	".\ygshell.h"\
-	
 
 !ELSEIF  "$(CFG)" == "simplegui - Win32 (WCE ARM) Debug"
 
@@ -339,10 +339,12 @@
 	"..\gui\SimpleNavigator.h"\
 	"..\gui\SwordIndex.h"\
 	"..\gui\Utils.h"\
-	{$(INCLUDE)}"aygshell.h"\
-	{$(INCLUDE)}"htmlctrl.h"\
-	{$(INCLUDE)}"sipapi.h"\
 	
+NODEP_CPP_MAIN_=\
+	".\ipapi.h"\
+	".\tmlctrl.h"\
+	".\ygshell.h"\
+	
 
 !ENDIF 
 
@@ -587,6 +589,9 @@
 	"..\gui\SwordIndex.h"\
 	"..\gui\TextControl.h"\
 	"..\gui\Utils.h"\
+	{$(INCLUDE)}"aygshell.h"\
+	{$(INCLUDE)}"sipapi.h"\
+	{$(INCLUDE)}"vibrate.h"\
 	
 
 !ELSEIF  "$(CFG)" == "simplegui - Win32 (WCE ARM) Debug"
@@ -989,6 +994,7 @@
 	"..\..\..\sword\include\swtext.h"\
 	"..\..\..\sword\include\thmlhtml.h"\
 	"..\..\..\sword\include\thmlvariants.h"\
+	"..\..\..\sword\include\url.h"\
 	"..\..\..\sword\include\versekey.h"\
 	"..\..\..\sword\include\ztext.h"\
 	"..\..\..\sword\include\zverse.h"\
@@ -1198,10 +1204,8 @@
 	"..\gui\ApplicationInterface.h"\
 	"..\gui\TextControl.h"\
 	"..\gui\Utils.h"\
+	{$(INCLUDE)}"htmlctrl.h"\
 	
-NODEP_CPP_TEXTC=\
-	".\tmlctrl.h"\
-	
 
 !ELSEIF  "$(CFG)" == "simplegui - Win32 (WCE ARM) Debug"
 
@@ -1234,8 +1238,10 @@
 	"..\gui\ApplicationInterface.h"\
 	"..\gui\TextControl.h"\
 	"..\gui\Utils.h"\
-	{$(INCLUDE)}"htmlctrl.h"\
 	
+NODEP_CPP_TEXTC=\
+	".\tmlctrl.h"\
+	
 
 !ENDIF 
 
@@ -1249,6 +1255,7 @@
 DEP_CPP_UTILS=\
 	"..\..\..\sword\include\defs.h"\
 	"..\..\..\sword\include\swbuf.h"\
+	"..\gui\ApplicationInterface.h"\
 	"..\gui\Utils.h"\
 	
 
@@ -1289,10 +1296,8 @@
 	"..\gui\TextControl.h"\
 	"..\gui\Utils.h"\
 	"..\gui\VerseTextControl.h"\
+	{$(INCLUDE)}"htmlctrl.h"\
 	
-NODEP_CPP_VERSE=\
-	".\tmlctrl.h"\
-	
 
 !ELSEIF  "$(CFG)" == "simplegui - Win32 (WCE ARM) Debug"
 
@@ -1322,8 +1327,10 @@
 	"..\gui\TextControl.h"\
 	"..\gui\Utils.h"\
 	"..\gui\VerseTextControl.h"\
-	{$(INCLUDE)}"htmlctrl.h"\
 	
+NODEP_CPP_VERSE=\
+	".\tmlctrl.h"\
+	
 
 !ENDIF 
 




More information about the sword-cvs mailing list